semiotic 3.7.4 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +60 -15
- package/README.md +135 -24
- 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 +1651 -154
- package/ai/examples.md +174 -0
- package/ai/schema.json +2934 -517
- package/ai/surface-manifest.json +200 -0
- package/ai/system-prompt.md +19 -3
- package/dist/components/Annotation.d.ts +4 -0
- 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/DataSummaryContext.d.ts +1 -0
- 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 +42 -1
- package/dist/components/ai/chartClinic.d.ts +91 -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 +203 -0
- package/dist/components/ai/dataQualityBridge.d.ts +201 -0
- package/dist/components/ai/describeChart.d.ts +9 -0
- package/dist/components/ai/describeRecipeChart.d.ts +16 -0
- package/dist/components/ai/generativeChart.d.ts +170 -0
- 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/charts/custom/GeoCustomChart.d.ts +48 -0
- package/dist/components/charts/custom/NetworkCustomChart.d.ts +22 -3
- 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/DistanceCartogram.d.ts +1 -1
- package/dist/components/charts/geo/FlowMap.d.ts +1 -1
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +1 -1
- package/dist/components/charts/geo/index.d.ts +2 -0
- package/dist/components/charts/index.d.ts +29 -1
- package/dist/components/charts/network/ChordDiagram.d.ts +1 -1
- package/dist/components/charts/network/CirclePack.d.ts +1 -1
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +15 -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 +1 -1
- 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 +1 -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 +1 -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 +1 -1
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +8 -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 +47 -0
- package/dist/components/charts/physics/EventDropChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/EventDropChart.d.ts +53 -0
- package/dist/components/charts/physics/GaltonBoardChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/GaltonBoardChart.d.ts +66 -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 +120 -0
- package/dist/components/charts/physics/PhysicsPileChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/PhysicsPileChart.d.ts +53 -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 +41 -0
- package/dist/components/charts/physics/physicsChartUtils.d.ts +18 -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 +30 -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/realtime/aggregate.d.ts +51 -0
- package/dist/components/charts/realtime/eventTime.d.ts +26 -0
- 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/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/colorPalettes.d.ts +2 -0
- package/dist/components/charts/shared/colorUtils.d.ts +17 -13
- package/dist/components/charts/shared/diagnoseAnnotationChecks.d.ts +4 -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/hooks.d.ts +28 -5
- package/dist/components/charts/shared/minMax.d.ts +3 -0
- package/dist/components/charts/shared/motionEncoding.d.ts +145 -0
- package/dist/components/charts/shared/radialGeometry.d.ts +0 -18
- package/dist/components/charts/shared/responsiveRules.d.ts +56 -0
- package/dist/components/charts/shared/smartTooltip.d.ts +27 -0
- package/dist/components/charts/shared/statisticalOverlays.d.ts +35 -0
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +12 -2
- package/dist/components/charts/shared/temporalStrings.d.ts +7 -0
- package/dist/components/charts/shared/tooltipUtils.d.ts +2 -0
- package/dist/components/charts/shared/types.d.ts +49 -1
- package/dist/components/charts/shared/useChartSetup.d.ts +10 -3
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +15 -6
- package/dist/components/charts/shared/useNetworkChartSetup.d.ts +6 -2
- package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +1 -1
- package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
- package/dist/components/charts/shared/useSyncedPushData.d.ts +49 -0
- package/dist/components/charts/shared/validateChartData.d.ts +1 -1
- package/dist/components/charts/shared/validationMap.d.ts +0 -11
- package/dist/components/charts/xy/AreaChart.d.ts +1 -1
- package/dist/components/charts/xy/BubbleChart.d.ts +1 -1
- package/dist/components/charts/xy/LineChart.d.ts +1 -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 +1 -1
- package/dist/components/charts/xy/Scatterplot.d.ts +10 -1
- package/dist/components/charts/xy/ScatterplotMatrix.d.ts +11 -1
- package/dist/components/charts/xy/StackedAreaChart.d.ts +9 -4
- package/dist/components/controls/controlAudit.d.ts +24 -0
- package/dist/components/controls/controlContract.d.ts +57 -0
- package/dist/components/data/fromArrow.d.ts +54 -0
- package/dist/components/data/fromFlintChart.d.ts +74 -0
- package/dist/components/data/fromMermaid.d.ts +47 -0
- package/dist/components/data/fromObservablePlot.d.ts +69 -0
- package/dist/components/data/fromVegaLite.d.ts +27 -0
- package/dist/components/data/portability/index.d.ts +17 -0
- package/dist/components/data/portability/result.d.ts +52 -0
- package/dist/components/data/portability/spec.d.ts +160 -0
- package/dist/components/data/portability/vegaLite.d.ts +80 -0
- package/dist/components/export/chartConfig.d.ts +11 -0
- package/dist/components/realtime/ReorderBuffer.d.ts +54 -0
- package/dist/components/realtime/RunningStats.d.ts +66 -0
- package/dist/components/realtime/WindowAccumulator.d.ts +105 -0
- package/dist/components/realtime/parseWindowDuration.d.ts +12 -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/boba.d.ts +23 -0
- package/dist/components/recipes/customTooltip.d.ts +31 -0
- 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 +215 -0
- package/dist/components/recipes/gofishIRExamples.d.ts +38 -0
- 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/mermaidDag.d.ts +44 -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/packedClusterMatrix.d.ts +166 -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 +191 -0
- package/dist/components/recipes/recipeGlyph.d.ts +42 -0
- package/dist/components/recipes/recipeLegend.d.ts +109 -0
- package/dist/components/recipes/recipeUtils.d.ts +157 -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/semiotic-ai-core.d.ts +47 -0
- package/dist/components/semiotic-ai.d.ts +52 -4
- package/dist/components/semiotic-controls.d.ts +18 -0
- package/dist/components/semiotic-data.d.ts +2 -0
- package/dist/components/semiotic-experimental.d.ts +49 -0
- package/dist/components/semiotic-geo.d.ts +11 -0
- package/dist/components/semiotic-network.d.ts +14 -1
- package/dist/components/semiotic-ordinal.d.ts +10 -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 +56 -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 -22
- 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 -26
- 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 -74
- package/dist/components/semiotic-utils-core.d.ts +46 -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 +10 -0
- package/dist/components/semiotic.d.ts +39 -7
- package/dist/components/server/animatedGif.d.ts +36 -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 +17 -0
- package/dist/components/server/serverChartConfigs.d.ts +19 -9
- 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/staticGeo.d.ts +4 -0
- package/dist/components/server/staticLegend.d.ts +1 -1
- 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 -3
- package/dist/components/store/SelectionStore.d.ts +1 -1
- package/dist/components/store/ThemeStore.d.ts +1 -1
- package/dist/components/store/TooltipStore.d.ts +1 -1
- package/dist/components/store/createStore.d.ts +1 -1
- package/dist/components/store/designTokens.d.ts +15 -0
- 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 +3 -13
- package/dist/components/stream/FocusRing.d.ts +4 -2
- package/dist/components/stream/GeoCanvasHitTester.d.ts +1 -1
- package/dist/components/stream/GeoPipelineStore.d.ts +28 -0
- package/dist/components/stream/NetworkHtmlMarksLayer.d.ts +44 -0
- package/dist/components/stream/NetworkPipelineStore.d.ts +62 -25
- package/dist/components/stream/NetworkSVGOverlay.d.ts +15 -0
- package/dist/components/stream/OrdinalPipelineStore.d.ts +64 -2
- package/dist/components/stream/PipelineStore.d.ts +100 -162
- package/dist/components/stream/SceneGraph.d.ts +14 -2
- 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 +23 -10
- 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/customLayout.d.ts +20 -0
- package/dist/components/stream/customLayoutDiagnostics.d.ts +11 -0
- package/dist/components/stream/customLayoutFailure.d.ts +33 -0
- package/dist/components/stream/customLayoutPalette.d.ts +19 -9
- package/dist/components/stream/customLayoutSelection.d.ts +52 -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/geoTypes.d.ts +56 -7
- package/dist/components/stream/glyphDef.d.ts +98 -0
- package/dist/components/stream/hitTarget.d.ts +170 -0
- package/dist/components/stream/hoverUtils.d.ts +3 -0
- 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 +57 -0
- package/dist/components/stream/networkBezier.d.ts +10 -0
- package/dist/components/stream/networkColorAccessors.d.ts +49 -0
- package/dist/components/stream/networkCustomLayout.d.ts +66 -1
- package/dist/components/stream/networkDefaultTooltip.d.ts +10 -0
- package/dist/components/stream/networkFrameInteraction.d.ts +37 -0
- package/dist/components/stream/networkFramePaint.d.ts +43 -0
- package/dist/components/stream/networkPipelineConfig.d.ts +22 -0
- package/dist/components/stream/networkPipelineHelpers.d.ts +12 -0
- package/dist/components/stream/networkRealtimeEncoding.d.ts +41 -0
- package/dist/components/stream/networkTypes.d.ts +104 -5
- package/dist/components/stream/ordinalCanvasRenderers.d.ts +7 -0
- package/dist/components/stream/ordinalCustomLayout.d.ts +17 -1
- 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 +12 -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 -0
- package/dist/components/stream/ordinalSpatialIndex.d.ts +9 -0
- package/dist/components/stream/ordinalTypes.d.ts +56 -8
- 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 +84 -0
- package/dist/components/stream/physics/PhysicsPipelineTypes.d.ts +181 -0
- package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +72 -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 +302 -0
- package/dist/components/stream/physics/physicsBodyCanvas.d.ts +27 -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 +9 -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 +16 -0
- package/dist/components/stream/pipelineBufferUtils.d.ts +26 -0
- package/dist/components/stream/pipelineConfig.d.ts +177 -0
- package/dist/components/stream/pipelineDecay.d.ts +20 -2
- 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 +16 -2
- 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 +12 -0
- package/dist/components/stream/pipelineStyleResolvers.d.ts +46 -0
- package/dist/components/stream/pipelineTransitions.d.ts +2 -0
- package/dist/components/stream/pipelineUpdateContract.d.ts +62 -0
- package/dist/components/stream/pulseFrameRefresh.d.ts +22 -0
- package/dist/components/stream/renderers/glyphCanvasRenderer.d.ts +6 -0
- package/dist/components/stream/renderers/networkSymbolRenderer.d.ts +2 -0
- package/dist/components/stream/renderers/resolveCSSColor.d.ts +6 -0
- package/dist/components/stream/renderers/symbolCanvasRenderer.d.ts +2 -0
- package/dist/components/stream/sceneRevisionDiagnostics.d.ts +18 -0
- package/dist/components/stream/stalenessBands.d.ts +28 -0
- package/dist/components/stream/streamStoreSync.d.ts +37 -0
- package/dist/components/stream/symbolPath.d.ts +24 -0
- package/dist/components/stream/types.d.ts +206 -9
- package/dist/components/stream/useFrame.d.ts +21 -2
- package/dist/components/stream/useHydration.d.ts +6 -0
- package/dist/components/stream/useLegendCategoryEmission.d.ts +5 -0
- package/dist/components/stream/useStalenessCheck.d.ts +6 -1
- 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/xySceneBuilders/pointScene.d.ts +2 -2
- package/dist/components/stream/xySceneBuilders/types.d.ts +9 -4
- 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/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 +52 -4
- 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 +18 -0
- package/dist/semiotic-data.d.ts +2 -0
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-experimental.d.ts +49 -0
- package/dist/semiotic-experimental.min.js +1 -0
- package/dist/semiotic-experimental.module.min.js +1 -0
- package/dist/semiotic-geo.d.ts +11 -0
- package/dist/semiotic-network.d.ts +14 -1
- package/dist/semiotic-ordinal.d.ts +10 -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 +56 -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 -22
- 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 -26
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- 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 -74
- package/dist/semiotic-themes.min.js +1 -2
- package/dist/semiotic-themes.module.min.js +1 -2
- package/dist/semiotic-utils-core.d.ts +46 -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 +10 -0
- package/dist/semiotic.d.ts +39 -7
- 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/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 +246 -86
- 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/semiotic-ai-statisticalOverlays-C2PPlmXv.js +0 -1
- package/dist/semiotic-statisticalOverlays-C3DsOgr_.js +0 -1
- package/dist/xy-statisticalOverlays-C2PPlmXv.js +0 -1
package/dist/ordinal.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-scale"),o=require("d3-quadtree"),i=require("d3-array"),r=require("d3-hierarchy"),s=require("d3-shape"),a=require("regression"),l=require("d3-selection"),c=require("d3-brush");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(a),g=Object.freeze([]);function m(e){if(!e)return g;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 p{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=m(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=m(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}}class y{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 r=(o+i)%this._capacity,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[r]=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}}class v{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 b(e,t,n){return e+(t-e)*n}function x(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function w(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function k(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function j(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function A(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function O(e){const t=e.map(j),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return A(e,n,o)}if(e>=1){const[e,o,i]=t[n];return A(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[s,a,l]=t[i],[c,u,d]=t[i+1];return A(Math.round(s+(c-s)*r),Math.round(a+(u-a)*r),Math.round(l+(d-l)*r))}}const S=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],M=O(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),C=O(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),_=O(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),P=O(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),L=O(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]);O(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]);const R=O(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),T=O(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]);O(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),O(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),O(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),O(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);const $=O(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),I=O(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),B=O(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),H=O(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),E=O(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),D=O(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),F=O(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),N={category10:S,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:M,reds:C,greens:_,oranges:P,purples:L,viridis:R,plasma:T},W=S,z=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],G=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 q(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")||G.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):W[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))%W.length]}function V(e,t,o="category10"){const i=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),r=i.every(e=>!isNaN(Number(e)));if(Array.isArray(o))return n.scaleOrdinal().domain(i).range(o).unknown("#999");const s=N[o]||N.category10;if(r&&"function"==typeof s){let e=-1/0;for(const t of i){const n=Number(t);n>e&&(e=n)}return t=>s(Number(t)/e)}{const e=Array.isArray(s)?s:W;return n.scaleOrdinal().domain(i).range(e).unknown("#999")}}function X(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[r,s]=o,[a,l]=n;if(s===r)return(a+l)/2;let c=(i-r)/(s-r);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function Y(e,t,n,o,i,r,s){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:r,group:s}}function Q(e,t){var n;const{columns:o,config:i,resolvePieceStyle:r}=e,s=[],a=Math.min(t.width,t.height)/2-4,l="donut"===i.chartType?i.innerRadius||60:0,c=-Math.PI/2+(i.startAngle||0)*Math.PI/180,u=null!=i.sweepAngle?i.sweepAngle*Math.PI/180:2*Math.PI,d=null!=i.sweepAngle&&360>i.sweepAngle,h=Object.values(o),f=h.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),g=d&&!f&&h.length>1&&(null!==(n=i.cornerRadius)&&void 0!==n?n:0)>0;for(let e=0;h.length>e;e++){const t=h[e],n=t.pieceData[0],o="number"==typeof(null==n?void 0:n._pctStart)?n._pctStart:t.pctStart,d=c+o*u,f=c+(o+("number"==typeof(null==n?void 0:n._pct)?n._pct:t.pct))*u,m=r(t.pieceData[0],t.name),p=0===e,y=e===h.length-1,v=Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:l,outerRadius:a,startAngle:d,endAngle:f},i.cornerRadius&&{cornerRadius:i.cornerRadius}),{style:m,datum:(null==n?void 0:n._nonInteractive)?null:t.pieceData,category:t.name});(null==n?void 0:n._roundedEnds)?v.roundedEnds=n._roundedEnds:g&&(v.roundedEnds={start:p,end:y}),(null==n?void 0:n._gradientBand)&&(v._gradientBand=n._gradientBand),s.push(v)}return s}function Z(e){var t,n,o;const r=e.length,s=e[0],a=e[r-1];return{n:r,min:s,q1:null!==(t=i.quantile(e,.25))&&void 0!==t?t:s,median:null!==(n=i.quantile(e,.5))&&void 0!==n?n:(s+a)/2,q3:null!==(o=i.quantile(e,.75))&&void 0!==o?o:a,max:a,mean:e.reduce((e,t)=>e+t,0)/r}}function K(e){return 0===e.length?()=>"#4e79a7":t=>{var n;let o=0;for(let e=0;t.length>e;e++)o=31*o+t.charCodeAt(e)|0;return null!==(n=e[Math.abs(o)%e.length])&&void 0!==n?n:"#4e79a7"}}const U={bar:function(e,t){var n,o,i;const{scales:r,columns:s,config:a,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,projection:h}=r,f=[],g="vertical"===h,m="horizontal"===h,p=a.normalize,y=[];if(c){const e=new Set;for(const t of Object.values(s))for(const n of t.pieceData){const t=c(n);e.has(t)||(e.add(t),y.push(t))}}else y.push("_default");for(const e of Object.values(s)){const t=new Map;for(const n of e.pieceData){const e=c?c(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=l(n),o.pieces.push(n)}let n=0;if(p)for(const e of t.values())n+=Math.abs(e.total);let o=0,i=0;for(const r of y){const s=t.get(r);if(!s)continue;let a=s.total;p&&n>0&&(a/=n);const l=u(s.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(g){const t=d(0>a?i:o+a),n=0>a?d(i+a)-d(i):d(o)-d(o+a);f.push(Y(e.x,t,e.width,Math.abs(n),l,h,r)),0>a?i+=a:o+=a}else if(m){const t=d(0>a?i+a:o),n=0>a?d(i)-d(i+a):d(o+a)-d(o);f.push(Y(t,e.x,Math.abs(n),e.width,l,h,r)),0>a?i+=a:o+=a}}}const v="vertical"===h,b=a.roundedTop&&a.roundedTop>0?Math.max(0,a.roundedTop):0;for(const e of f){if("rect"!==e.type)continue;const t=null!==(o=null===(n=e.datum)||void 0===n?void 0:n.__aggregateValue)&&void 0!==o?o:0;e.roundedEdge=v?0>t?"bottom":"top":0>t?"left":"right",a.gradientFill&&(e.fillGradient=a.gradientFill)}if(b>0){const e=new Map;for(const t of f){if("rect"!==t.type)continue;const n=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(n)||e.set(n,[]),e.get(n).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,n;return(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)>=0}),n=t.filter(e=>{var t,n;return 0>(null!==(n=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==n?n:0)});e.length>0&&(e.reduce(v?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=b),n.length>0&&(n.reduce(v?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=b)}}return f},clusterbar:function(e,t){const{scales:n,columns:o,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h=[],f=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=s?s(t):"_default";f.has(e)||(f.add(e),h.push(e))}const g=h.length||1;for(const e of Object.values(o)){const t=e.width/g,n=.2*t,o=t-n,i=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";i.has(e)||i.set(e,[]),i.get(e).push(t)}for(let s=0;h.length>s;s++){const c=i.get(h[s])||[];for(const i of c){const c=r(i),f=a(i,h[s]);if(d){const r=e.x+s*t+n/2,a=l(0),d=l(c);u.push(Y(r,Math.min(a,d),o,Math.abs(a-d),f,i,h[s]))}else{const r=e.x+s*t+n/2,a=l(0),d=l(c);u.push(Y(Math.min(a,d),r,Math.abs(d-a),o,f,i,h[s]))}}}}const m=i.roundedTop&&i.roundedTop>0?Math.max(0,i.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=r(e.datum);m>0&&(e.roundedTop=m),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return u},point:function(e,t){var n,o;const{scales:i,columns:r,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=i,d=[],h="vertical"===u,f="radial"===u,g=a.length>0,m=2*Math.PI,p=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(n=t.__rIndex)&&void 0!==n?n:0,r=null!==(o=t.__rValue)&&void 0!==o?o:s(t),u=g&&a[i]||c,y=l(t,e.name),v=y.r||5;let b,x;if(f){const t=p+(e.pctStart+e.pct/2)*m,n=u(r);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(r)):(b=u(r),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:y,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="vertical"===a;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=i(o),u=r(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,f=c?e.middle+h:s(a),g=c?s(a):e.middle+h;l.push({type:"point",x:f,y:g,r:d,style:u,datum:o})}}return l},pie:Q,donut:Q,boxplot:function(e,t){var n,o,r,s,a,l;const{scales:c,columns:u,config:d,getR:h,resolveSummaryStyle:f}=e,{r:g,projection:m}=c,p=[],y="vertical"===m,v=!1!==d.showOutliers;for(const t of Object.values(u)){const c=t.pieceData.map(e=>h(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===c.length)continue;const u=c[0],d=c[c.length-1],m=null!==(n=i.quantile(c,.25))&&void 0!==n?n:u,b=null!==(o=i.quantile(c,.5))&&void 0!==o?o:(u+d)/2,x=null!==(r=i.quantile(c,.75))&&void 0!==r?r:d,w=x-m,k=m-1.5*w,j=x+1.5*w,A=null!==(s=c.find(e=>e>=k))&&void 0!==s?s:u,O=null!==(a=[...c].reverse().find(e=>j>=e))&&void 0!==a?a:d,S=f(t.pieceData[0],t.name),M=[];if(v)for(const e of t.pieceData){const n=h(e);if(k>n||n>j){const o=y?t.middle:g(n),i=y?g(n):t.middle;M.push({px:o,py:i,value:n,datum:e})}}if(p.push({type:"boxplot",x:y?t.middle:0,y:y?0:t.middle,projection:y?"vertical":"horizontal",columnWidth:.6*t.width,minPos:g(A),q1Pos:g(m),medianPos:g(b),q3Pos:g(x),maxPos:g(O),stats:{n:c.length,min:A,q1:m,median:b,q3:x,max:O,mean:c.reduce((e,t)=>e+t,0)/c.length},style:S,datum:t.pieceData,category:t.name,outliers:M}),v)for(const t of M)p.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:S.fill||(null===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:.6},datum:t.datum})}return p},violin:function(e,t){var n,o,r;const{scales:s,columns:a,config:l,getR:c,resolveSummaryStyle:u}=e,{r:d,projection:h}=s,f=[],g="vertical"===h,m=l.bins||20,p=!1!==l.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>c(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const s=t[0],a=t[t.length-1],l=(a-s)/m||1,h=Array(m).fill(0);for(const e of t)h[Math.min(Math.floor((e-s)/l),m-1)]++;const y=Math.max(...h,1),v=e.width/2*.9;let b="";if(g){b=`M ${e.middle} ${d(s)}`;for(let t=0;m>t;t++){const n=d(s+(t+.5)*l);b+=` L ${e.middle+h[t]/y*v} ${n}`}b+=` L ${e.middle} ${d(a)}`;for(let t=m-1;t>=0;t--){const n=d(s+(t+.5)*l);b+=` L ${e.middle-h[t]/y*v} ${n}`}b+=" Z"}else{b=`M ${d(s)} ${e.middle}`;for(let t=0;m>t;t++)b+=` L ${d(s+(t+.5)*l)} ${e.middle-h[t]/y*v}`;b+=` L ${d(a)} ${e.middle}`;for(let t=m-1;t>=0;t--)b+=` L ${d(s+(t+.5)*l)} ${e.middle+h[t]/y*v}`;b+=" Z"}const x=u(e.pieceData[0],e.name);let w;if(p&&t.length>=4){const l=null!==(n=i.quantile(t,.25))&&void 0!==n?n:s,c=null!==(o=i.quantile(t,.5))&&void 0!==o?o:(s+a)/2,u=null!==(r=i.quantile(t,.75))&&void 0!==r?r:a;w={q1Pos:d(l),medianPos:d(c),q3Pos:d(u),centerPos:e.middle,isVertical:g}}const k=g?{x:e.x,y:Math.min(d(a),d(s)),width:e.width,height:Math.abs(d(a)-d(s))}:{x:Math.min(d(s),d(a)),y:e.x,width:Math.abs(d(a)-d(s)),height:e.width};f.push({type:"violin",pathString:b,translateX:0,translateY:0,bounds:k,iqrLine:w,stats:Z(t),style:x,datum:e.pieceData,category:e.name})}return f},histogram:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=o,c=[],u=r.bins||25,d=r.normalize,h=null===(n=l.domain)||void 0===n?void 0:n.call(l),f=h?+h[0]:void 0,g=h?+h[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=null!=f&&isFinite(f)?f:Math.min(...t),o=null!=g&&isFinite(g)?g:Math.max(...t),i=(o-n)/u||1,r=Array(u).fill(0);for(const e of t)n>e||e>o||r[Math.min(Math.floor((e-n)/i),u-1)]++;const h=t.length,m=Math.max(...r,1),p=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===r[t])continue;const o=(d?r[t]/h:r[t]/m)*e.width*.9,s=l(n+t*i),a=l(n+(t+1)*i);c.push(Y(Math.min(s,a),e.x+e.width-o,Math.abs(a-s),o,p,{bin:t,count:r[t],range:[n+t*i,n+(t+1)*i],category:e.name},e.name))}}return c},ridgeline:function(e,t){var n;const{scales:o,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,u=[],d=r.bins||20,h="horizontal"===c,f=r.amplitude||1.5;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],i=t[t.length-1],r=(i-o)/d||1,c=Array(d).fill(0);for(const e of t)o>e||e>i||c[Math.min(Math.floor((e-o)/r),d-1)]++;const g=Math.max(...c,1),m=a(e.pieceData[0],e.name),p=e.width*f;let y="";if(h){const t=e.x+e.width;y=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)y+=` L ${l(o+(e+.5)*r)} ${t-c[e]/g*p}`;y+=` L ${l(i)} ${t} Z`}else{const t=e.x;y=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*r);y+=` L ${t+c[e]/g*p} ${n}`}y+=` L ${t} ${l(i)} Z`}const v=h?{x:Math.min(l(o),l(i)),y:e.x,width:Math.abs(l(i)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(i),l(o)),width:e.width,height:Math.abs(l(i)-l(o))};u.push({type:"violin",pathString:y,translateX:0,translateY:0,bounds:v,stats:Z(t),style:Object.assign(Object.assign({},m),{fillOpacity:null!==(n=m.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:i,resolvePieceStyle:r}=e,{r:s,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=i(t);if(!n)continue;const[o,a]=n,u=r(t,e.name);if(c){const n=s(Math.min(o,a)),i=s(Math.max(o,a));l.push(Y(n,e.x,i-n,e.width,u,t,e.name))}else{const n=s(Math.max(o,a)),i=s(Math.min(o,a));l.push(Y(e.x,n,e.width,i-n,u,t,e.name))}}return l},funnel:function(e,t){var o,i,r,s,a,l,c,u;const{columns:d,getR:h,getStack:f,resolvePieceStyle:g}=e,m=[],p=t.width/2,y=!1!==e.config.showLabels,v=e.scales.o.domain().map(e=>d[e]).filter(Boolean);if(0===v.length)return m;const b=[],x=new Set;for(const e of v)for(const t of e.pieceData){const e=f?f(t):"_default";x.has(e)||(x.add(e),b.push(e))}const w=b.length>1&&"_default"!==b[0],k=[];let j=0;for(const e of v){const t=new Map;let n=0;for(const o of e.pieceData){const e=f?f(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=h(o);i.total+=r,i.pieces.push(o),n+=r}k.push({col:e,groups:t,stepTotal:n}),w||n>j&&(j=n)}if(w)for(const e of k){let t=0,n=0;for(let o=0;b.length>o;o++){const i=e.groups.get(b[o]);i&&(o%2==0?t+=i.total:n+=i.total)}const o=Math.max(t,n);o>j&&(j=o)}if(0===j)return m;const A=new Map;for(const e of b){const t=k[0].groups.get(e);A.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const O=k[0].stepTotal,S=w?.95*p:.9*t.width,M=n.scaleLinear().domain([0,j]).range([0,S]),C=null!==(i=e.config.connectorOpacity)&&void 0!==i?i:.3;let _=new Map;for(let t=0;k.length>t;t++){const n=k[t],o=n.col,i=0===t,d=o.width,h=.55*d,f=o.x+(d-h)/2,v=new Map;if(w){let e=0;for(const t of b){const o=n.groups.get(t);o&&(e+=M(o.total))}let t=p,r=p;for(let s=0;b.length>s;s++){const l=b[s],c=n.groups.get(l);if(!c)continue;const u=M(c.total),d=s%2==0,x=d?t:r-u;d?t+=u:r-=u;const w=g(c.pieces[0],l),k=null!==(a=A.get(l))&&void 0!==a?a:c.total,j=k>0?c.total/k*100:0,O=Object.assign(Object.assign({},c.pieces[0]),{__funnelValue:c.total,__funnelPercent:j,__funnelStep:o.name,__funnelIsFirstStep:i,__aggregateValue:c.total,__pieceCount:c.pieces.length,category:l});y&&(0===s&&(O.__funnelStepLabel=o.name,O.__funnelStepLabelX=p,O.__funnelStepLabelY=f,O.__funnelRowWidth=e),O.__funnelValueLabelX=x+u/2,O.__funnelValueLabelY=f,O.__funnelBarW=u),m.push(Y(x,f,u,h,w,O,l)),v.set(l,{x:x,y:f,w:u,h:h})}}else{const e=n.stepTotal,t=M(e),a=p-t/2,l=b[0],c="_default"!==l,u=null!==(s=null===(r=n.groups.get(l))||void 0===r?void 0:r.pieces[0])&&void 0!==s?s:o.pieceData[0],d=c?l:o.name,x=g(u,d),w=O>0?e/O*100:0,k=Object.assign(Object.assign({},u),{__funnelValue:e,__funnelPercent:w,__funnelStep:o.name,__funnelIsFirstStep:i,category:c?l:o.name});y&&(k.__funnelStepLabel=o.name,k.__funnelStepLabelX=p,k.__funnelStepLabelY=f,k.__funnelRowWidth=t,k.__funnelValueLabelX=p,k.__funnelValueLabelY=f,k.__funnelBarW=t),m.push(Y(a,f,t,h,x,k,d)),v.set(l,{x:a,y:f,w:t,h:h})}if(t>0&&_.size>0){const t=w?b:[b[0]];for(const i of t){const t=_.get(i),r=v.get(i);if(!t||!r)continue;const s=(()=>{const e=n.groups.get(i);return g(e?e.pieces[0]:o.pieceData[0],"_default"===i?o.name:i)})(),a={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:s.fill||(null===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:C},datum:null!==(u=null===(c=n.groups.get(i))||void 0===c?void 0:c.pieces[0])&&void 0!==u?u:o.pieceData[0],category:"_default"===i?o.name:i};m.push(a)}}_=v}return m},"bar-funnel":function(e,t){var n,o,i,r;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return d;const f=[],g=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";g.has(e)||(g.add(e),f.push(e))}const m=f.length>1&&"_default"!==f[0],p=[];for(const e of h){const t=new Map;let n=0;for(const o of e.pieceData){const e=l?l(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=a(o);i.total+=r,i.pieces.push(o),n+=r}p.push({col:e,groups:t,stepTotal:n})}const y=new Map;for(const e of f){const t=null===(n=p[0])||void 0===n?void 0:n.groups.get(e);y.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const v=u.r,b=m?f.length:1,x=m?.15:0;for(let e=0;p.length>e;e++){const t=p[e],n=t.col,o=0===e,s=e>0?p[e-1]:null,a=n.width/b,l=a*x,u=a-l;for(let e=0;f.length>e;e++){const h=f[e],g=t.groups.get(h);if(!g)continue;const p=g.total,b=null!==(i=y.get(h))&&void 0!==i?i:p,x=b>0?p/b*100:0,w=null==s?void 0:s.groups.get(h),k=null!==(r=null==w?void 0:w.total)&&void 0!==r?r:p,j=o?0:Math.max(0,k-p),A=n.x+e*a+l/2,O=v(p),S=v(0)-O,M=c(g.pieces[0],m?h:n.name),C=Object.assign(Object.assign({},g.pieces[0]),{__barFunnelValue:p,__barFunnelPercent:x,__barFunnelIsFirstStep:o,__barFunnelIsDropoff:!1,__barFunnelStep:n.name,__barFunnelDropoffValue:j,__barFunnelCategory:"_default"===h?void 0:h,category:m?h:n.name,__barFunnelLabelX:A+u/2,__barFunnelLabelY:v(p+j)});if(d.push(Y(A,O,u,S,M,C,m?h:n.name)),j>0){const e=v(p+j),t=O-e,o=Object.assign({},M),i=Object.assign(Object.assign({},g.pieces[0]),{__barFunnelValue:j,__barFunnelPercent:b>0?j/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:n.name,__barFunnelCategory:"_default"===h?void 0:h,category:m?h:n.name});d.push(Y(A,e,u,t,o,i,m?h:n.name))}}}return d},swimlane:function(e,t){var n;const{scales:o,columns:i,getR:r,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="horizontal"===c,h=e.config.gradientFill,f=d?"left":"bottom",g=e.config.trackFill;if(g){const e="string"==typeof g?g:g.color,t="string"==typeof g?1:null!==(n=g.opacity)&&void 0!==n?n:1,[o,r]=l.range(),s=Math.min(o,r),a=Math.abs(r-o);for(const n of Object.values(i)){const o={fill:e,opacity:t},i=d?Y(s,n.x,a,n.width,o,null,"__track__"):Y(n.x,s,n.width,a,o,null,"__track__");u.push(i)}}const m=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(i)){let t=0;const n=u.length;for(const n of e.pieceData){const o=Math.abs(r(n));if(0===o)continue;const i=s?s(n):e.name,c=a(n,i);let g;if(d){const r=l(t),s=l(t+o);g=Y(r,e.x,s-r,e.width,c,n,i)}else{const r=l(t+o),s=l(t);g=Y(e.x,r,e.width,s-r,c,n,i)}h&&(g.fillGradient=h,g.roundedEdge=f),u.push(g),t+=o}if(m>0&&u.length>n){const e=u.slice(n),t=e[0],o=e[e.length-1];1===e.length?t.cornerRadii={tl:m,tr:m,br:m,bl:m}:d?(t.cornerRadii={tl:m,bl:m},o.cornerRadii={tr:m,br:m}):(t.cornerRadii={bl:m,br:m},o.cornerRadii={tl:m,tr:m})}}return u}};class J{constructor(e){this.rExtent=new v,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.version=0,this._dataVersion=0,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new y(e.windowSize),this.getO=k(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>w(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new v)):(this.getR=w(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=k(e.stackBy),this.getGroup=k(e.groupBy),this.getColor=k(e.colorAccessor),this.getConnector=k(e.connectorAccessor),this.getDataId=k(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new y(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();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)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else{this._hasStreamingData=!0;for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:o}=this;if(0===o.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const i=o.toArray(),r=t.projection||"vertical",s=t.oExtent||this.resolveCategories(i),a=this.computeValueDomain(i,s),l="horizontal"===r,c="radial"===r,u=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===r?e.width:e.height):.1));let d,h;if(c){d=n.scaleBand().domain(s).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,i=t.innerRadius||0;h=n.scaleLinear().domain(a).range([i,o])}else l?(d=n.scaleBand().domain(s).range([0,e.height]).padding(u),h=n.scaleLinear().domain(a).range([0,e.width])):(d=n.scaleBand().domain(s).range([0,e.width]).padding(u),h=n.scaleLinear().domain(a).range([e.height,0]));this.scales={o:d,r:h,projection:r},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((i,r)=>{var s;const a=this.rExtents[r];a.dirty&&a.recalculate(o,i);let[c,u]=a.extent;c===1/0&&(c=0,u=1);const d=null!==(s=t.extentPadding)&&void 0!==s?s:.05,h=u-c,f=h>0?h*d:1;return c-=f,u+=f,c>0&&(c=0),l?n.scaleLinear().domain([c,u]).range([0,e.width]):n.scaleLinear().domain([c,u]).range([e.height,0])}):[];let f=i;this.rAccessors.length>1&&(f=i.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(f,s,d,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(f,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,i),this.config.pulse&&this.applyPulse(this.scene,i),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.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,n=Array.isArray(t)?t[e]:t;return"string"==typeof n?n:"value"+e}resolveCategories(e){const t=this.config.oSort,n="streaming"===this.config.runtimeMode||this._hasStreamingData,o="auto"===t?void 0:t;let i=null;if(n){i=new Set;for(const t of e)i.add(this.getO(t))}const r=i?Array.from(this.categories).filter(e=>i.has(e)):Array.from(this.categories);if(n&&void 0===o){const e=Math.max(50,3*i.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;i.has(e)||(this.categories.delete(e),t--)}}return r}if(!1===o)return r;if("function"==typeof o)return r.sort(o);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===o?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var n,o,i,r,s;const a=this.config.chartType,l=null!==(n=this.config.extentPadding)&&void 0!==n?n:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,u=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===a&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),i=this.getR(o);0>i?n.set(e,(n.get(e)||0)+i):t.set(e,(t.get(e)||0)+i)}for(const e of t.values())e>u&&(u=e);for(const e of n.values())c>e&&(c=e)}else if("bar"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const n of e){const e=this.getO(n),o=Math.abs(this.getR(n));t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(d&&null==(null===(o=this.config.rExtent)||void 0===o?void 0:o[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==a&&"exact"!==this.config.axisExtent){const e=u-c,t=e>0?e*l:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===a||(u+=t)}return[c,u]}buildColumns(e,t,n,o,i){var r;const s={},a=new Map;for(const t of e){const e=this.getO(t);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=a.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const r=("horizontal"===o?i.height:i.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*r)}let d=0,h=0;for(const e of t){const t=a.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),i=l>0?o/l:0;let c,f;u?(c=h,f=u.get(e)||n.bandwidth(),h+=f+n.padding()*n.step()):(c=null!==(r=n(e))&&void 0!==r?r:0,f=n.bandwidth()),s[e]={name:e,x:c,y:0,width:f,middle:c+f/2,padding:n.padding()*n.step(),pieceData:t,pct:i,pctStart:d},d+=i}return s}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){var n,o;if(!this.scales)return[];if(this.config.customLayout){const i=this.buildLayoutContext(e,t);let r;try{r=this.config.customLayout(i)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(n=r.overlays)&&void 0!==n?n:null,null!==(o=r.nodes)&&void 0!==o?o:[]}this.customLayoutOverlays=null;const i=this.getSceneContext(),r=U[this.config.chartType];let s=r?r(i,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var n,o;const{scales:i,config:r,getConnector:s,getO:a}=e;if(!s||!i)return[];const l=[],{projection:c}=i,u=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=s(t);if(!n)continue;let o,i;"point"===e.type?(o=e.x,i=e.y):(o=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),u.has(n)||u.set(n,[]),u.get(n).push({x:o,y:i,datum:t,category:a(t)})}const d=i.o.domain(),h=r.connectorStyle;for(const[t,i]of u)if(i.length>=2){i.sort((e,t)=>d.indexOf(e.category)-d.indexOf(t.category));for(let r=0;i.length-1>r;r++){const s=i[r],a=i[r+1],c="function"==typeof h?h(s.datum):h||{stroke:(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.border)||(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1:s.x,y1:s.y,x2:a.x,y2:a.y,style:c,datum:s.datum,group:t})}}return l}(i,s);s=[...e,...s]}return s}buildLayoutContext(e,t){var n,o,i;const r=this.config,s=null!==(n=r.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},a=function(e,t,n){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=N[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(r.colorScheme,r.themeCategorical,z),l=this.scales;return{data:e,scales:{o:l.o,r:l.r,projection:l.projection},dimensions:{width:t.width,height:t.height,margin:s,plot:"radial"===l.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:null!==(o=r.themeSemantic)&&void 0!==o?o:{},categorical:[...a]},resolveColor:K(a),config:null!==(i=r.layoutConfig)&&void 0!==i?i:{}}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const n=this.config.pieceStyle(e,t);return n&&!n.fill&&t?Object.assign(Object.assign({},n),{fill:this.getColorFromScheme(t)}):n}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||z,o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?function(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return s+(1-a/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>a?1:s;default:return 1}}(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,n="function"==typeof t,o=n?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const s=e[r],a=n?t(s):s[o];let l=i.get(a);l||(l=[],i.set(a,l)),l.push(r)}return this._categoryIndexCache={version:this._dataVersion,map:i},i}rebuildPointQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(e++,n.r>t&&(t=n.r));if(this._maxPointRadius=t,J.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const n=Array(e);let i=0;for(const e of this.scene)"point"===e.type&&(n[i++]=e);this._pointQuadtree=o.quadtree().x(e=>e.x).y(e=>e.y).addAll(n)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var n,o;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,i),a=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var n,o,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,a=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let u=null;for(const n of e){if("connector"===n.type||"violin"===n.type||"boxplot"===n.type)continue;if("wedge"===n.type){const e=n.category;if(!e)continue;u||(u=this.getCategoryIndexMap(t));const o=u.get(e);if(!o)continue;let i=0;for(let e=0;o.length>e;e++){const t=this.timestampBuffer.get(o[e]);if(null==t)continue;const n=r-t;if(s>n){const e=1-n/s;e>i&&(i=e)}}i>0&&(n._pulseIntensity=i,n._pulseColor=a);continue}const e=c.get(n.datum);if(null==e)continue;const o=this.timestampBuffer.get(e);if(null==o)continue;const i=r-o;s>i&&(n._pulseIntensity=1-i/s,n._pulseColor=a,n._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}synthesizeIntroPositions(){var e,t,n,o,i;this.prevPositionMap.clear();const r=new Map,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="horizontal"!==(null===(n=this.scales)||void 0===n?void 0:n.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],n=this.getNodeKey(t,r);n&&("rect"===t.type?this.prevPositionMap.set(n,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}:{x:s,y:t.y,w:0,h:t.h,opacity:null!==(i=t.style.opacity)&&void 0!==i?i:1}):"point"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(n,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var n,o,i;if("point"===e.type){const n=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,o=t.get(n)||0;return t.set(n,o+1),`${n}:${o}`}return"rect"===e.type?`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let n=0;this.scene.length>n;n++){const o=this.scene[n],i=this.getNodeKey(o,t);i&&("point"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(i,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(i,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:null!==(e=o.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,n,o,i,r,s,a,l,c,u,d,h,f,g,m,p,y,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const w=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let k=!1;const j=new Set,A=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,A);if(!u)continue;c._transitionKey=u;const d=this.prevPositionMap.get(u);if("point"===c.type)d?(j.add(u),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(d.x!==c.x||d.y!==c.y||void 0!==d.r&&d.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=d.x,c.y=d.y,void 0!==d.r&&(c.r=d.r),k=!0)):(c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!0);else if("rect"===c.type)d?(j.add(u),c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,d.x===c.x&&d.y===c.y&&d.w===c.w&&d.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=d.x,c.y=d.y,c.w=null!==(i=d.w)&&void 0!==i?i:c.w,c.h=null!==(r=d.h)&&void 0!==r?r:c.h,k=!0)):(c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),k=!0);else if("wedge"===c.type)if(d)j.add(u),c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,d.startAngle===c.startAngle&&d.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=d.startAngle,c.endAngle=d.endAngle,k=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(u,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),k=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!j.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(c=t.r)&&void 0!==c?c:3,style:{opacity:null!==(u=t.opacity)&&void 0!==u?u:1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(d=t.w)&&void 0!==d?d:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(f=t.opacity)&&void 0!==f?f:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const n=((null!==(g=t.startAngle)&&void 0!==g?g:0)+(null!==(m=t.endAngle)&&void 0!==m?m:0))/2,o={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(p=t.innerRadius)&&void 0!==p?p:0,outerRadius:null!==(y=t.outerRadius)&&void 0!==y?y:100,startAngle:null!==(v=t.startAngle)&&void 0!==v?v:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:n,_targetEndAngle:n,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(o)}k=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),k&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:w})}advanceTransition(e){var t,n,o,i;if(!this.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),s=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=b(i,e._targetOpacity,s)}const o=this.prevPositionMap.get(t);void 0!==e._targetX&&o&&(e.x=b(o.x,e._targetX,s),e.y=b(o.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==o?void 0:o.r)&&(e.r=b(o.r,e._targetR,s))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),i=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=b(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=b(n.x,e._targetX,s),e.y=b(n.y,e._targetY,s),void 0!==n.w&&(e.w=b(n.w,e._targetW,s),e.h=b(n.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),o=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:b(o,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=b(n.startAngle,e._targetStartAngle,s),e.endAngle=b(n.endAngle,e._targetEndAngle,s))}}}if(r>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(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"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,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.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,i}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&i.add(t)});const r=this.buffer.update(e=>n.has(o(e)),t);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),i.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,r}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this._pointQuadtree=null,this._maxPointRadius=0,this._colorSchemeMap=null,this._colorSchemeIndex=0,this._dataVersion++,this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!x(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!x(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!x(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(x(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=k(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const n=e.valueAccessor||e.rAccessor,o=t.valueAccessor||t.rAccessor,i=Array.isArray(n)?n:[n],r=Array.isArray(o)?o:[o];if(i.length!==r.length||i.some((e,t)=>!x(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>w(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new v)):(this.getR=w(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!x(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?k(this.config.stackBy):void 0),"groupBy"in e&&!x(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?k(this.config.groupBy):void 0),"colorAccessor"in e&&!x(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?k(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!x(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?k(this.config.connectorAccessor):void 0)}}function ee(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:h.createElement(h.Fragment,null,...t)}function te(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function ne(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function oe(e,t,n){const o=function(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}}(t,n,e);return o.hit?{datum:e.datum,x:o.cx,y:e.y,distance:0,category:e.group}:null}function ie(e,t,n,o=30){const i=t-e.x,r=n-e.y,s=Math.sqrt(i*i+r*r);return s>te(e.r,o)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function re(e,t,n){const o=t-e.cx,i=n-e.cy,r=Math.sqrt(o*o+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const s=ne(Math.atan2(i,o)),a=ne(e.startAngle),l=ne(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function se(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const i=e.y-o,r=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>n||n>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function ae(e,t,n){if(!e.bounds)return null;const{x:o,y:i,width:r,height:s}=e.bounds;return o>t||t>o+r||i>n||n>i+s?null:{datum:e.datum,x:o+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}function le(e,t,n){const o=e.byGroup.get(t);let i=0,r=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);r>t&&(r=t,i=e)}return o[i]._flatIndex}function ce(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}function ue({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"})}J.QUADTREE_THRESHOLD=500;const de={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 he(e,t,n,o,i){let r;return r="function"==typeof n?n(e):(0,de[n])(o(e,t),i),r}function fe({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 ge(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const me=(t,n,o,i,r,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:f,items:g}=t,m=[];let p=0;const y=!(!n&&!o),v="isolate"===u||void 0===u&&null!=r,{swatchSize:b,labelGap:x,rowHeight:w}=d;return g.forEach((t,u)=>{const d=he(t,u,h,f,b),k=ge(t,i,r),j=r&&r.size>0&&r.has(t.label);m.push(e.jsxs("g",{transform:`translate(0,${p})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?l===s&&u===a?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&v?j||!1:void 0,"aria-current":y&&!v&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:y?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(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:y?e=>{c(l,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&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(fe,{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)),p+=w}),m};function pe({config:t,orientation:n="vertical",width:o=100}){const{colorFn:i,domain:r,label:s,format:a}=t,l=a||(e=>Math.round(100*e)/100+""),c="grad-legend-"+h.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),a=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(r[0]+n*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:u})}),s&&e.jsx("text",{x:a+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("rect",{x:a,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[0])}),e.jsx("text",{x:a+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[1])})]})}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[1]-n*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[s&&e.jsx("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),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:l(r[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[0])})]})}function ye(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical",legendLayout:f}=t,g=function(e){var t,n,o,i,r;const s=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),a=Math.max(s,null!==(n=null==e?void 0:e.rowHeight)&&void 0!==n?n:22);return{swatchSize:s,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:a,align:"left"===(null==e?void 0:e.align)?"start":"right"===(null==e?void 0:e.align)?"end":null!==(r=null==e?void 0:e.align)&&void 0!==r?r:"start",maxWidth:null==e?void 0:e.maxWidth}}(f),[m,p]=h.useState(0),[y,v]=h.useState(0),b=h.useCallback((e,t)=>{p(e),v(t)},[]),x="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,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:me(t,o,i,r,s,a,l,g,c,u,d)},"legend-group-"+g)),h+=t.items.length*d.rowHeight+8}),f})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:m,focusedItemIndex:y,onFocusedIndexChange:b,legendInteraction:a,metrics:g}):(({legendGroups:t,height:n,width:o,customClickBehavior:i,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d,metrics:h})=>{var f;let g=0;const m=[];t.forEach((t,n)=>{var f;let p=0;t.label&&(p+=16);const y=((t,n,o,i,r,s,a,l,c,u,d,h)=>{const{type:f="fill",styleFn:g,items:m}=t,p=[],{swatchSize:y,labelGap:v,itemGap:b,rowHeight:x,align:w}=d,k=!(!n&&!o),j="isolate"===u||void 0===u&&null!=r,A=m.map(e=>y+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}),m.length>0&&O.push({start:S,end:m.length,width:M}),O.forEach((t,u)=>{let d="center"===w?Math.max(0,((null!=h?h:t.width)-t.width)/2):"end"===w?Math.max(0,(null!=h?h:t.width)-t.width):0;for(let h=t.start;t.end>h;h++){const t=m[h],w=he(t,h,f,g,y),O=ge(t,i,r),S=r&&r.size>0&&r.has(t.label);p.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:k?l===s&&h===a?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&j?S||!1:void 0,"aria-current":k&&!j&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:k?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)+m.length)%m.length;c(l,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:k?e=>{c(l,h),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:O,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:y+v+2+7*t.label.length,height:y+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),w,S&&e.jsx(fe,{swatchSize:y}),e.jsx("text",{y:y/2,x:y+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:p,offset:C,totalRows:_,totalHeight:_*x}})(t,i,r,s,a,l,c,n,u,d,h,null!==(f=h.maxWidth)&&void 0!==f?f:o);p+=y.offset+5,m.push(Object.assign(Object.assign({label:t.label},y),{offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight})),g+=p+12});const p=null!==(f=h.maxWidth)&&void 0!==f?f:o;let y=g>p?0:"center"===h.align?Math.max(0,(p-g)/2):"end"===h.align?Math.max(0,p-g):0;const v=[];return m.forEach((o,i)=>{const r=t[i];r.label&&(v.push(e.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-"+i)),y+=16),v.push(e.jsx("g",{className:"legend-item",transform:`translate(${y},0)`,children:o.items},"legend-group-"+i)),y+=o.offset+5,t[i+1]&&v.push(e.jsx("line",{stroke:"gray",x1:y,y1:-8,x2:y,y2:(o.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),y+=12}),e.jsx("g",{children:v})})({legendGroups:n||[],title:l,height:u,width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:m,focusedItemIndex:y,onFocusedIndexChange:b,legendInteraction:a,metrics:g}),w=!(!o&&!i);return e.jsxs("g",{role:w?"listbox":void 0,"aria-multiselectable":!(!w||"isolate"!==a&&(void 0!==a||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==l&&""!==l&&"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:l}),x]})}function ve(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function be(t){var n;const{legend:o,totalWidth:i,totalHeight:r,margin:s,legendPosition:a="right",legendLayout:l,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:f,legendInteraction:g}=t;if(!o)return null;const m="top"===a||"bottom"===a,p=!!c,y=Math.max(1,m?null!==(n=null==l?void 0:l.maxWidth)&&void 0!==n?n:Math.max(0,i-s.left-s.right):100);let v,b;return"left"===a?(v=Math.max(4,s.left-y-10),b=s.top):"top"===a?(v=s.left,b=p?32:8):"bottom"===a?(v=s.left,b=r-s.bottom+38):(v=i-s.right+10,b=s.top),e.jsx("g",{transform:`translate(${v}, ${b})`,children:(x=o,"object"==typeof x&&null!==x&&"gradient"in x?e.jsx(pe,{config:o.gradient,orientation:m?"horizontal":"vertical",width:y}):ve(o)?e.jsx(ye,{legendGroups:o.legendGroups,title:"",width:y,orientation:m?"horizontal":"vertical",legendLayout:l,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:f,legendInteraction:g}):o)});var x}function xe(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>o?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function we(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 ke(t,n,o,i){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:r,title:s,orientation:a,align:l,wrap:c=120,noWrap:u}=t;if(!r&&!s)return e.jsx("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;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,m=s?u?[s]:xe(s,c):[],p=r?u?[r]:xe(r,c):[],y="leftRight"===d?"end"===f?-4:4:0;let v=0;const b=[],x=i||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";m.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:f,fontWeight:"bold",children:m.map((t,n)=>e.jsx("tspan",{x:y,dy:0===n?0:g,children:t},n))},"annotation-note-title")),v=m.length*g),p.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:f,y:v,children:p.map((t,n)=>e.jsx("tspan",{x:y,dy:0===n?0:g,children:t},n))},"annotation-note-label"));let w=null;if((s||r)&&(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),w=e.jsx("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(m.length+p.length)*g+(p.length>0?g:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),w=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,m.length+p.length-1)*g;let j=0;return"topBottom"===d?j=0>o?-(k+2):18:"leftRight"===d&&(j="middle"===h?-(k+g+(p.length>0&&m.length>0?2:0))/2+8:"bottom"===h||0>o?-(k+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}),w]})}function je(t,n,o,i,r){var s;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.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)&&a.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)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;a.push(e.jsx("line",{x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,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)-s;a.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)?a.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)||a.push(e.jsx("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&a.push(e.jsx("path",{d:we((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:a})}function Ae(t,n,o,i,r,s){var a;const l=[];let c=0,u=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const i=e/2,r=o/2,s=t-i,a=n-r;if(0!==s||0!==a){const t=Math.abs(s),n=Math.abs(a),l=e/2,d=o/2,h=t*d>n*l?l/t:d/n;c=i+s*h,u=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(c=e/2,u=n):void 0!==t&&(c=n,u=t/2)}}else{const e=(s.radius||0)+(s.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 r=i||"var(--semiotic-text-secondary, currentColor)",s="curve"===(null==o?void 0:o.type);let h=Math.atan2(n-u,t-c);if(s){const i=(null!==(a=null==o?void 0:o.curve)&&void 0!==a?a:.25)*d,s=(c+t)/2+-(n-u)/d*i,f=(u+n)/2+(t-c)/d*i;l.push(e.jsx("path",{className:"connector-curve",d:`M${c},${u}Q${s},${f} ${t},${n}`,fill:"none",stroke:r},"connector-line")),h=Math.atan2(f-u,s-c)}else l.push(e.jsx("line",{x1:c,y1:u,x2:t,y2:n,stroke:r},"connector-line"));if("arrow"===(null==o?void 0:o.end)){const t=10,n=16/180*Math.PI;l.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:r,stroke:"none"},"connector-arrow"))}}return e.jsx("g",{className:"annotation-connector",children:l})}function Oe(t){var n,o;const{x:i=0,y:r=0,dx:s,dy:a,nx:l,ny:c,note:u,connector:d,subject:h,type:f,color:g,className:m,disable:p,opacity:y,strokeDasharray:v,events:b={},"data-testid":x}=t,w=Array.isArray(i)?null!==(n=i[0])&&void 0!==n?n:0:i,k=Array.isArray(r)?null!==(o=r[0])&&void 0!==o?o:0:r,j=new Set(Array.isArray(p)?p:[]);let A=s||0,O=a||0;null!=l&&(A=l-w),null!=c&&(O=c-k);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 "+(m||"")).trim(),transform:`translate(${w},${k})`,"data-testid":x},null!=y&&{opacity:y},v&&{strokeDasharray:v},b,{children:[!j.has("connector")&&Ae(A,O,d,g,S,h),!j.has("subject")&&je(S,h,g,w,k),!j.has("note")&&ke(u,A,O,g)]}))}function Se(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",a=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),a=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),l=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return e.jsx(Oe,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return e.jsx("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return e.jsx(Oe,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function Me(e,t){var n,o,i;const r=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 r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function Ce(e,t){var n,o,i;const r=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 r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function _e(e){return null==e?null:e+""}function Pe(e,t,n){var o;return null===(o=t.stickyPositionCache)||void 0===o||o.set(e,n),n}function Le(e,t,n){var o,i;const r=e.anchor||(null===(o=e.lifecycle)||void 0===o?void 0:o.anchor)||"fixed";if("latest"===r){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 Pe(t,n,{x:i.x,y:i.y})}const o=function(e){var t,n,o,i,r,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.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!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return o?Pe(t,n,o):null}if("semantic"===r){const o=function(e,t,n){var o,i;const r=function(e){var t,n;return _e(null!==(n=null===(t=e.provenance)||void 0===t?void 0:t.stableId)&&void 0!==n?n:e.stableId)}(e);if(!r)return null;const s=null===(o=n.pointNodes)||void 0===o?void 0:o.find(e=>_e(e.pointId)===r);if(s)return Pe(t,n,{x:s.x,y:s.y});const a=null===(i=n.data)||void 0===i?void 0:i.find(e=>function(e){var t,n,o;return _e(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)===r);if(!a)return null;const l=Me(a,n),c=Ce(a,n);return null==l||null==c?null:Pe(t,n,{x:l,y:c})}(e,t,n);if(o)return o}let s=null,a=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(s=t.x,a=t.y)}if(null!=s&&null!=a||(s=Me(e,n),a=Ce(e,n)),null!=s&&null!=a)return Pe(t,n,{x:s,y:a});if("sticky"===r){const e=null===(i=n.stickyPositionCache)||void 0===i?void 0:i.get(t);if(e)return e}return null}function Re(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Te={secondary:0,primary:3};function $e(e){return!0===(null==e?void 0:e._annotationDeferred)}function Ie(e){return"blended"===(null==e?void 0:e.cohesion)||"layer"===(null==e?void 0:e.cohesion)?e.cohesion:null}function Be(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 He(e){return Math.max(.72,.95-.06*e)}const Ee={linear:s.curveLinear,monotoneX:s.curveMonotoneX,monotoneY:s.curveMonotoneY,step:s.curveStep,stepAfter:s.curveStepAfter,stepBefore:s.curveStepBefore,basis:s.curveBasis,cardinal:s.curveCardinal,catmullRom:s.curveCatmullRom};const De=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function Fe(e){return!!e&&"object"==typeof e&&De.has(function(e){return"string"==typeof(null==e?void 0:e.type)?e.type:""}(e))}function Ne(e){return"primary"===(null==e?void 0:e.emphasis)||!0===(null==e?void 0:e.defensive)}function We(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 ze(e){var t,n;let o;const i=null==e?void 0:e.emphasis;o="primary"===i?100:"secondary"===i?10:50;const r=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(o+=15*Math.max(0,Math.min(1,r))),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 Ge=32,qe=6,Ve=4,Xe=8,Ye=72;const Qe={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Ze(e){return Fe(e)}function Ke(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),i=[];let r="";for(const e of o)r&&r.length+e.length+1>n?(i.push(r),r=e):r=r?`${r} ${e}`:e;return r&&i.push(r),i}function Ue(e,t,n,o,i){const r=e+n,s=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?r-i.width-4:r+4,y:0>o?s-i.height:s,width:i.width,height:i.height}:{x:0>n?r-i.width:r,y:0>o?s-i.height-4:s+4,width:i.width,height:i.height}}function Je(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function et(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 tt(e,t,n,o,i,r,s,a){const l=Je(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const i=Math.max(0,o-e.x),r=Math.max(0,o-e.y);return(i+Math.max(0,e.x+e.width-(t-o)))*e.height+(r+Math.max(0,e.y+e.height-(n-o)))*e.width}(l,i,r,a);for(const e of n)c+=12*et(l,e);for(const e of o)c+=4*et(l,e);return c}function nt(e){var t;const{annotations:n,context:o,defaultOffset:i=Ge,notePadding:r=qe,markPadding:s=Ve,edgePadding:a=Xe,preserveManualOffsets:l=!0,routeLongConnectors:c=!0,connectorThreshold:u=Ye,density:d,progressiveDisclosure:h=!1,redundantCues:f=!1,responsive:g,cohesion:m,audience:p}=e,y=o.width||0,v=o.height||0;if(0===n.length||0>=y||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,s);let w=!1;const k=n.map((e,t)=>{if(!Ze(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 r=null!==(o=e.pointId)&&void 0!==o?o:e.nodeId;if(null!=r&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===r);if(e)return{x:e.x,y:e.y}}const s=e.coordinates,a=null===(i=n.scales)||void 0===i?void 0:i.geoProjection;if(Array.isArray(s)&&s.length>=2&&a){const e=s[0],t=s[1];if("number"==typeof e&&"number"==typeof t){const n=a([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?Le(e,t,n):{x:e.x,y:e.y}}(e,t,o);if(!n)return e;const s=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=[...Ke("string"==typeof e.title?e.title:void 0,t),...Ke("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(l&&("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(Je(Ue(n.x,n.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,s),r)),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=tt(Ue(n.x,n.y,e.dx,e.dy,s),e,b,x,y,v,r,a);f>t&&(h=e,f=t)}if(!h)return e;const g=Je(Ue(n.x,n.y,h.dx,h.dy,s),r);b.push(g);const m=Math.hypot(h.dx,h.dy),p=c&&m>=u&&"text"!==e.type&&"widget"!==e.type?Object.assign(Object.assign({},e.connector||{end:"arrow"}),{type:"curve"}):e.connector;return w=!0,Object.assign(Object.assign(Object.assign({},e),{dx:h.dx,dy:h.dy}),p?{connector:p}:{})}),j=w?k: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=Qe[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 r=[o,i].filter(Boolean).join(" · "),s="string"==typeof e.label?e.label:"";return s.includes(`(${r})`)?e:Object.assign(Object.assign({},e),{label:s?`${s} (${r})`:`(${r})`})}(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}(p),o=1===n?e:Object.assign(Object.assign({},e),{maxAnnotations:Math.max(0,Math.round((null!==(t=e.maxAnnotations)&&void 0!==t?t:We(y,v,e))*n))}),{deferred:i}=function(e){var t;const{annotations:n,width:o,height:i}=e,r=Math.max(0,null!==(t=e.minVisible)&&void 0!==t?t:1),s=We(o,i,e),a=n.map((e,t)=>{return{annotation:e,index:t,note:(n=e,Fe(n))};var n}),l=a.filter(e=>e.note);if(0===l.length||s>=l.length)return{visible:n.slice(),deferred:[],budget:s};const c=l.filter(e=>Ne(e.annotation)),u=l.filter(e=>!Ne(e.annotation)).sort((e,t)=>ze(t.annotation)-ze(e.annotation)||e.index-t.index),d=Math.min(u.length,Math.max(Math.max(0,s-c.length),Math.max(0,r-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 a)!n||h.has(t)?f.push(e):g.push(e);return{visible:f,deferred:g,budget:s}}(Object.assign({annotations:A,width:y,height:v},o));for(const e of i)O.add(e)}if(g&&("object"==typeof g&&"number"==typeof g.minWidth?g.minWidth:480)>=y)for(const e of A)Ze(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)),m?function(e,t){let n=!1;const o=e.map(e=>Ze(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,Object.assign(Object.assign({},e),{cohesion:t})):e);return n?o:e}(S,m):S}function ot(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],i=n[n.length-1],r=o instanceof Date,s=o instanceof Date?o.getTime():o,a=i instanceof Date?i.getTime():i;if(s===a)return r?[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]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function it(n){const{width:o,height:i,totalWidth:r,totalHeight:s,margin:a,scales:l,showAxes:c,showGrid:u,rFormat:d}=n,{rTickValues:h,axisExtent:f}=n,g="radial"===(null==l?void 0:l.projection),m="horizontal"===(null==l?void 0:l.projection),p=t.useMemo(()=>!l||g?[]:(h||ot(l.r,5,f)).map(e=>({value:e,pixel:l.r(e),label:(d||rt)(e)})),[l,d,g,h,f]),y=u&&l&&!g,v=c&&l&&!g;return y||v?e.jsx("svg",{width:r,height:s,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:e.jsxs("g",{transform:`translate(${a.left},${a.top})`,children:[y&&e.jsx("g",{className:"ordinal-grid",children:p.map((t,n)=>e.jsx("line",{x1:m?t.pixel:0,y1:m?0:t.pixel,x2:m?t.pixel:o,y2:m?i:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),v&&e.jsx(e.Fragment,{children:e.jsxs(e.Fragment,m?{children:[e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("line",{x1:0,y1:i,x2:o,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e.jsx("line",{x1:0,y1:i,x2:o,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function rt(e){return Math.round(100*e)/100+""}function st(n){var o,i;const{width:a,height:l,totalWidth:c,totalHeight:u,margin:d,scales:g,showAxes:m,showCategoryTicks:p,oLabel:y,rLabel:v,oFormat:b,rFormat:x,showGrid:w,title:k,legend:j,legendHoverBehavior:A,legendClickBehavior:O,legendHighlightedCategory:S,legendIsolatedCategories:M,legendPosition:C="right",legendLayout:_,foregroundGraphics:P,annotations:L,autoPlaceAnnotations:R,svgAnnotationRules:T,xAccessor:$,yAccessor:I,annotationData:B,underlayRendered:H,children:E}=n,D="radial"===(null==g?void 0:g.projection),F="horizontal"===(null==g?void 0:g.projection),N=!1!==p,W=t.useMemo(()=>m&&N&&g&&!D?g.o.domain().map((e,t)=>{var n;return{value:e,pixel:(null!==(n=g.o(e))&&void 0!==n?n:0)+g.o.bandwidth()/2,label:b?b(e,t):e}}):[],[m,N,g,b,D]),z=n.rTickValues,G=n.tickLabelEdgeAlign,q=n.axisExtent,V=t.useMemo(()=>m&&g&&!D?(z||ot(g.r,5,q)).map(e=>({value:e,pixel:g.r(e),label:(x||rt)(e)})):[],[m,g,x,D,z,q]),X=t.useRef(new Map),Y=t.useRef(null!==(o=null==L?void 0:L.length)&&void 0!==o?o:0),Q=null!==(i=null==L?void 0:L.length)&&void 0!==i?i:0;Y.current!==Q&&(Y.current=Q,X.current=new Map);const Z=t.useMemo(()=>{if(!L||0===L.length)return null;const t=function(t,n,o){var i,a,l,c,u,d,g,m,p,y,v,b,x,w,k,j,A,O,S,M,C,_,P,L,R,T,$,I,B,H,E,D,F,N,W,z,G,q,V,X,Y,Q,Z,K,U,J,ee,te,ne,oe,ie;switch(t.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const r=Le(t,n,o);if(!r)return null;const{x:s,y:c}=r;if(!Re(s,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(Se,{noteData:Object.assign(Object.assign({x:s,y:c,dx:null!==(a=t.dx)&&void 0!==a?a: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=Me(null!=t.value?Object.assign(Object.assign({},t),{x:t.value}):t,o);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"top";let a;return a="bottom"===s?(o.height||0)-4:"center"===s?(o.height||0)/2:12,e.jsxs("g",{children:[e.jsx("line",{x1:i,y1:0,x2:i,y2:o.height||0,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:i+4,y:a,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"y-threshold":{const i=Ce(null!=t.value?Object.assign(Object.assign({},t),{y:t.value}):t,o);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"right";let a,l;return"left"===s?(a=4,l="start"):"center"===s?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end"),e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:i,x2:o.width||0,y2:i,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:a,y:i-4,textAnchor:l,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"enclose":{const i=(t.coordinates||[]).map(e=>({x:Me(Object.assign(Object.assign({},e),{type:"point"}),o),y:Ce(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=r.packEnclose(i),a=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:s.x,cy:s.y,r:s.r+a,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-a-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:Me(Object.assign(Object.assign({},e),{type:"point"}),o),y:Ce(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=t.padding||10,s=i.map(e=>e.x),a=i.map(e=>e.y),l=Math.min(...s)-r,c=Math.max(...s)+r,u=Math.min(...a)-r,d=Math.max(...a)+r;return e.jsxs("g",{children:[e.jsx("rect",{x:l,y:u,width:c-l,height:d-u,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:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"highlight":{const i=o.data||[],r="function"==typeof t.filter?i.filter(t.filter):t.field&&null!=t.value?i.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.jsx("g",{children:r.map((n,i)=>{const r=Me(n,o),a=Ce(n,o);if(null==r||null==a)return null;const l="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||s;return e.jsx("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+i)})},"ann-"+n)}case"bracket":{const i=Me(t,o),r=Ce(t,o);return e.jsx(Se,{noteData:{x:null!=i?i:0,y:null!=r?r: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 r=o.xAccessor||"x",s=o.yAccessor||"y",a="ordinal"===o.frameType,l="horizontal"===o.projection,h=a?r:null,v=a?s:null;let b;const x=[],w=new Map;if(a&&h&&v){for(const e of i){const t=e[h];if(null==t)continue;const n=t+"";w.has(n)||(w.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=w.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else b=i.map(e=>[e[r],e[s]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const k=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!==(m=null===(g=o.scales)||void 0===g?void 0:g.y)&&void 0!==m?m:null===(p=o.scales)||void 0===p?void 0:p.value;if(!k||!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,r=e(x[n]);return r+(e(x[o])-r)*i},O=k,S=j;let M;if(a)if(l){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]),r=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=i[e],o=i.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,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*r[e],f+=t*i[e]*i[e],g+=t*i[e]*r[e])}if(0===u){a.push([t,r[e]]);continue}const m=u*f-d*d;if(1e-12>Math.abs(m))a.push([t,h/u]);else{const e=(u*g-d*h)/m;a.push([t,(h-e*d)/u+e*t])}}return a}(b,null!==(y=t.bandwidth)&&void 0!==y?y:.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",R=_[_.length-1],[T,$]=M(R[0],R[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:T+4,y:$-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,r=null!==(w=null==i?void 0:i(t.y0))&&void 0!==w?w:0,s=null!==(k=null==i?void 0:i(t.y1))&&void 0!==k?k:o.height||0;return e.jsxs("g",{children:[e.jsx("rect",{x:0,y:Math.min(r,s),width:o.width||0,height:Math.abs(s-r),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(r,s)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:t.label})]},"ann-"+n)}case"envelope":{const i=o.data||[];if(2>i.length)return null;const r=o.xAccessor||"x",a=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,l=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(!a||!l)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[r]-t[r]);if(2>h.length)return null;const f=Ee[o.curve||"linear"]||s.curveLinear,g=s.area().x(e=>a(e[r])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(f)(h);if(!g)return null;const m=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:g,fill:m,fillOpacity:null!==(_=t.fillOpacity)&&void 0!==_?_:.15,stroke:"none"}),t.label&&h.length>0&&e.jsx("text",{x:a(h[h.length-1][r])+4,y:l(h[h.length-1][c])-4,fill:m,fontSize:11,children:t.label})]},"ann-"+n)}case"anomaly-band":{const i=o.data||[];if(2>i.length)return null;const r=o.yAccessor||"y",s=null!==(L=null===(P=o.scales)||void 0===P?void 0:P.x)&&void 0!==L?L:null===(R=o.scales)||void 0===R?void 0:R.time,a=null!==($=null===(T=o.scales)||void 0===T?void 0:T.y)&&void 0!==$?$:null===(I=o.scales)||void 0===I?void 0:I.value;if(!s||!a)return null;const l=i.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),h=null!==(B=t.threshold)&&void 0!==B?B:2,f=c-h*d,g=!1!==t.showBand,m=t.fill||"#6366f1",p=null!==(H=t.fillOpacity)&&void 0!==H?H:.1,y=t.anomalyColor||"#ef4444",v=null!==(E=t.anomalyRadius)&&void 0!==E?E:6,b=a(c+h*d),x=a(f),w=i.filter(e=>{const t=e[r];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:m,fillOpacity:p}),w.map((t,n)=>{const i=Me(t,o),r=Ce(t,o);return null==i||null==r?null:e.jsx("circle",{cx:i,cy:r,r:v,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+n)}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:m,fontSize:11,children:t.label})]},"ann-"+n)}case"forecast":{const i=o.data||[];if(3>i.length)return null;const r=o.xAccessor||"x",s=o.yAccessor||"y",a=null!==(F=null===(D=o.scales)||void 0===D?void 0:D.x)&&void 0!==F?F:null===(N=o.scales)||void 0===N?void 0:N.time,l=null!==(z=null===(W=o.scales)||void 0===W?void 0:W.y)&&void 0!==z?z:null===(G=o.scales)||void 0===G?void 0:G.value;if(!a||!l)return null;const c=i.map(e=>[e[r],e[s]]).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,r]of c)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*n)/r,a=(n-s*t)/e;u=e=>a+s*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)),m=c.reduce((e,t)=>e+t[0],0)/d,p=c.reduce((e,t)=>e+Math.pow(t[0]-m,2),0),y=null!==(q=t.confidence)&&void 0!==q?q:.95,v=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,b=null!==(V=t.steps)&&void 0!==V?V:5,x=c[d-1][0],w=(x-c[0][0])/Math.max(d-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*w);const j=[];for(const e of k){const t=u(e),n=g*Math.sqrt(1+1/d+(p>0?Math.pow(e-m,2)/p:0))*v;j.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${j.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${j.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,O=j.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),S=`${a(x)},${l(u(x))}`,M=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(X=t.fillOpacity)&&void 0!==X?X:.15,stroke:"none"}),e.jsx("polyline",{points:`${S} ${O}`,fill:"none",stroke:M,strokeWidth:null!==(Y=t.strokeWidth)&&void 0!==Y?Y:2,strokeDasharray:null!==(Q=t.strokeDasharray)&&void 0!==Q?Q:"6,3"}),t.label&&j.length>0&&e.jsx("text",{x:a(j[j.length-1].x)+4,y:l(j[j.length-1].yCenter)-4,fill:M,fontSize:11,children:t.label})]},"ann-"+n)}case"widget":{let i=null,r=null;if(null!=t.px&&null!=t.py)i=t.px,r=t.py;else{const e=Le(t,n,o);if(!e)return null;i=e.x,r=e.y}if(null==i||null==r)return null;if(!Re(i,r,o))return null;const s=null!==(Z=t.dx)&&void 0!==Z?Z:0,a=null!==(K=t.dy)&&void 0!==K?K:0,l=null!==(U=t.width)&&void 0!==U?U: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+s-l/2,y:r+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const i=Le(t,n,o);if(!i)return null;const{x:r,y:s}=i,a=r+(t.dx||0),l=s+(t.dy||0),c=t.color||"var(--semiotic-text, #333)",u=e.jsx("text",{x:a,y:l,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:r,y1:s,x2:a,y2:l,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 r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,s=null===(te=o.scales)||void 0===te?void 0:te.o,a=null===(ne=o.scales)||void 0===ne?void 0:ne.x,l=null===(oe=o.scales)||void 0===oe?void 0:oe.y,c=r(s)?s:r(a)?a:r(l)?l: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===a)?{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="horizontal"===(null==g?void 0:g.projection),o=(null==g?void 0:g.o)?e=>{var t;return(null!==(t=g.o(e))&&void 0!==t?t:0)+g.o.bandwidth()/2}:null,i={scales:g?{x:n?g.r:o||g.r,y:n&&o||g.r,time:g.r,value:g.r,o:g.o}:null,timeAxis:"x",xAccessor:$,yAccessor:I,width:a,height:l,data:B,frameType:"ordinal",projection:n?"horizontal":"vertical",stickyPositionCache:X.current};return function(t,n,o,i){const r=[];return t.forEach((e,t)=>{let s;if(o){const r=o(e,t,i);s=null!=r?r:n(e,t,i)}else s=n(e,t,i);s&&r.push({node:s,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:Be(e.annotation),readingOrder:null,rank:1};var n}),o=n.some(e=>null!=e.emphasis||null!=e.confidence),i=t.some(e=>$e(e.annotation)),r=t.some(e=>null!=Ie(e.annotation)),s=t.some(e=>"layer"===Ie(e.annotation));if(!o&&!i&&!r)return t.map(e=>e.node);const a=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});a.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,a.length)});for(const e of n)e.emphasis&&(e.rank=Te[e.emphasis]);const l=n.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(t=>{const{p:n,i:o,emphasis:i,readingOrder:r}=t,s=$e(n.annotation);let a=n.node;if("primary"===i||"secondary"===i||null!=r){const t=null==i&&null!=r;a=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:He(r),"data-annotation-reading-order":r}:{},{children:n.node}),"annotation-emphasis-"+o)}const l=Ie(n.annotation);return l&&(a=e.jsx("g",{className:"annotation-cohesion--"+l,children:a},"annotation-cohesion-"+o)),s&&(a=e.jsx("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},"annotation-deferred-"+o)),a});return i&&l.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")),s&&l.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")),l}(r)}(R?nt(Object.assign({annotations:L,context:i},"object"==typeof R?R:{})):L,t,T,i)},[L,R,T,a,l,g,$,I,B]);return m||k||j||P||Z&&Z.length>0||w||E?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 k?k:"Ordinal Chart"}),e.jsx("desc",{children:"string"==typeof k?k+" — ordinal data visualization":"Ordinal data visualization"}),e.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[w&&g&&!D&&!H&&e.jsx("g",{className:"ordinal-grid",children:V.map((t,n)=>e.jsx("line",{x1:F?t.pixel:0,y1:F?0:t.pixel,x2:F?t.pixel:a,y2:F?l:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),m&&g&&!D&&(()=>{const t={fontSize:"var(--semiotic-tick-font-size, 12px)"},n={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return e.jsx("g",{className:"ordinal-axes",children:e.jsxs(e.Fragment,F?{children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!H&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),W.map((n,o)=>e.jsxs("g",{transform:`translate(0,${n.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:n.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"},t),children:n.label})})]},"cat-"+o)),y&&e.jsx("text",{x:15-d.left,y:l/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-d.left}, ${l/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},n),children:y})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!H&&e.jsx("line",{x1:0,y1:l,x2:a,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!H&&(null==g?void 0:g.r)&&(()=>{const t=g.r(0);return t>1&&a-1>t?e.jsx("line",{x1:t,y1:0,x2:t,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),V.map((n,o)=>{const i=G?0===o?"start":o===V.length-1?"end":"middle":"middle";return e.jsxs("g",{transform:`translate(${n.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{y:18,textAnchor:i,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:n.label})]},"val-"+o)}),v&&e.jsx("text",{x:a/2,y:l+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},n),children:v})]})]}:{children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!H&&(()=>{const t=(null==g?void 0:g.r)?g.r(0):l,n=0>t||t>l?l:t;return e.jsx("line",{x1:0,y1:n,x2:a,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),W.map((n,o)=>e.jsxs("g",{transform:`translate(${n.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e.jsx("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:n.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"},t),children:n.label})})]},"cat-"+o)),y&&e.jsx("text",{x:a/2,y:l+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},n),children:y})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!H&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),V.map((n,o)=>e.jsxs("g",{transform:`translate(0,${n.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:n.label})]},"val-"+o)),v&&e.jsx("text",{x:15-d.left,y:l/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-d.left}, ${l/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},n),children:v})]})]})})})(),Z,P,E]}),k&&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 k?k:null}),be({legend:j,totalWidth:c,totalHeight:u,margin:d,legendPosition:C,title:k,legendLayout:_,legendHoverBehavior:A,legendClickBehavior:O,legendHighlightedCategory:S,legendIsolatedCategories:M})]}):null}function at(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:{key:void 0,fn:null}}function lt({width:n,height:o,totalWidth:i,totalHeight:r,margin:s,scales:a,onBrush:u}){const d=t.useRef(null),h=t.useRef(null),f=t.useRef(u);f.current=u;const g=t.useRef(a);g.current=a;const m=t.useRef(!1),p=t.useRef(null),y="horizontal"===(null==a?void 0:a.projection),v=t.useRef(y);return v.current=y,t.useEffect(()=>{if(!d.current)return;const e=l.select(d.current).select(".brush-g"),t=y?c.brushX():c.brushY();return t.extent([[0,0],[n,o]]),t.on("brush end",e=>{if(m.current)return;const t=g.current;if(!t)return;if(!e.selection)return p.current=null,void f.current(null);const[n,o]=e.selection;let i;i=v.current?[t.r.invert(n),t.r.invert(o)]:[t.r.invert(o),t.r.invert(n)];const r={r:i};p.current=r,f.current(r)}),e.call(t),h.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),h.current=null}},[n,o,y]),t.useEffect(()=>{if(!a||!h.current||!p.current)return;if(!d.current)return;const e=p.current,t=l.select(d.current).select(".brush-g"),n=a.r(e.r[0]),o=a.r(e.r[1]);y?(m.current=!0,t.call(h.current.move,[n,o]),m.current=!1):(m.current=!0,t.call(h.current.move,[o,n]),m.current=!1)},[a,y]),e.jsx("svg",{ref:d,width:i,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e.jsx("g",{className:"brush-g",transform:`translate(${s.left},${s.top})`,style:{pointerEvents:"all"}})})}function ct(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 ut(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)}}const dt=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function ht(e){var t,n;const{innerRadius:o,outerRadius:i,startAngle:r,endAngle:s}=e,a=0>=o;if(0>=(null!==(t=e.cornerRadius)&&void 0!==t?t:0)||!e.roundStart&&!e.roundEnd){if(a){const e=dt(i,r),t=dt(i,s);return`M0,0 L${e.x},${e.y} A${i},${i} 0 ${s-r>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=dt(i,r),t=dt(i,s),n=dt(o,s),l=dt(o,r),c=s-r>Math.PI?1:0;return`M${e.x},${e.y} A${i},${i} 0 ${c} 1 ${t.x},${t.y} L${n.x},${n.y} A${o},${o} 0 ${c} 0 ${l.x},${l.y} Z`}const l=Math.max(0,Math.min(null!==(n=e.cornerRadius)&&void 0!==n?n:0,(i-o)/2));if(0===l)return ht(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const c=Math.asin(Math.min(1,l/Math.max(1e-9,i-l))),u=a?0:Math.asin(Math.min(1,l/Math.max(1e-9,o+l))),d=s-r,h=e.roundStart&&e.roundEnd?d/2:d,f=!!e.roundStart&&h>c,g=!!e.roundEnd&&h>c;if(!f&&!g)return ht(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const m=r+(f?c:0),p=s-(g?c:0),y=r+(f?u:0),v=s-(g?u:0),b=dt(i,m),x=dt(i,p),w=(i-l)*Math.cos(c),k=dt(w,r),j=dt(w,s),A=a?null:dt(o,v),O=a?null:dt(o,y),S=a?0:(o+l)*Math.cos(u),M=a?null:dt(S,r),C=a?null:dt(S,s),_=p-m>Math.PI?1:0,P=a?0:v-y>Math.PI?1:0;let L="";if(f)L+=`M${k.x},${k.y}`,L+=` A${l},${l} 0 0 1 ${b.x},${b.y}`;else{const e=dt(i,r);L+=`M${e.x},${e.y}`}if(g)L+=` A${i},${i} 0 ${_} 1 ${x.x},${x.y}`,L+=` A${l},${l} 0 0 1 ${j.x},${j.y}`;else{const e=dt(i,s);L+=` A${i},${i} 0 ${_} 1 ${e.x},${e.y}`}if(a)L+=" L0,0";else{if(g)L+=` L${C.x},${C.y}`,L+=` A${l},${l} 0 0 1 ${A.x},${A.y}`;else{const e=dt(o,s);L+=` L${e.x},${e.y}`}if(f)L+=` A${o},${o} 0 ${P} 0 ${O.x},${O.y}`,L+=` A${l},${l} 0 0 1 ${M.x},${M.y}`;else{const e=dt(o,r);L+=` A${o},${o} 0 ${P} 0 ${e.x},${e.y}`}}return L+=" Z",L}function ft(e){const t=ht({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),n=[],o=e.colors;if(o.length>0){const t=(e.endAngle-e.startAngle)/o.length;for(let i=0;o.length>i;i++)n.push({d:ht({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+i*t,endAngle:e.endAngle}),color:o[i]})}return{clipPath:t,slices:n}}const gt={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function mt(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}function pt(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}const yt="undefined"==typeof window||"undefined"==typeof document,vt="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,bt=()=>()=>{},xt=()=>!1,wt=()=>!0;function kt(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 jt(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 At(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 Ot=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,St=new WeakMap;let Mt=0,Ct=!1,_t=null,Pt=null,Lt=null;function Rt(e,t){var n,o;if(!t)return t;const i=Ot.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(Ct)return;if("undefined"==typeof window||"undefined"==typeof document)return;Ct=!0;const e=()=>{Mt++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(_t=new MutationObserver(e),_t.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Pt=window.matchMedia("(prefers-color-scheme: dark)"),Lt=e,"function"==typeof Pt.addEventListener?Pt.addEventListener("change",Lt):"function"==typeof Pt.addListener&&Pt.addListener(Lt)}catch(e){}}();let s=St.get(r);s&&s.version===Mt||(s={version:Mt,map:new Map},St.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,l),l}const Tt=h.createContext(null),$t={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function It(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"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const Bt=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""};function Ht(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 Et="semiotic-accessible-data-table",Dt=Et+" semiotic-accessible-data-table-hidden",Ft=Et+" semiotic-accessible-data-table-visible",Nt={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"},Wt={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},zt={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)"},Gt={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},qt={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))"},Vt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Xt={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Yt={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 Qt({scene:t,chartType:n,tableId:o,chartTitle:i}){var r;const[s,a]=h.useState(!1),[l,c]=h.useState(5),u=h.useContext(Tt),d=null!==(r=null==u?void 0:u.visible)&&void 0!==r&&r,f=s||d,g=h.useRef(null),m=i?"Data summary for "+i:o?`Data summary for ${n} ${o}`:"Data summary for "+n;h.useEffect(()=>{f||c(5)},[f]);const p=h.useCallback(e=>{e.target===e.currentTarget&&(s||d||a(!0))},[s,d]),y=h.useCallback(e=>{var t;d||(null===(t=g.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[d]);if(!t||0===t.length)return o?e.jsx("span",{id:o,tabIndex:-1,style:$t}):null;if(!f)return e.jsx("div",{id:o,className:Dt,tabIndex:-1,onFocus:p,style:$t,role:"region","aria-label":m,children:e.jsxs("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",t.length," elements)"]})});const v=function(e){var t,n,o,i,r,s,a,l,c,u,d,h,f,g,m,p,y;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:Ht(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:Ht(n)});break}case"rect":{const e=null!=x.datum&&"object"==typeof x.datum?x.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:x.group)&&void 0!==n?n:"",s=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;v.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":{const e=Ht(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!==(l=null!==(s=null===(r=x.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(a=x.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",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:Ht(x.datum)});break;case"arc":v.push({label:"Arc",values:Ht(x.datum)});break;case"candlestick":v.push({label:"Candlestick",values:Ht(x.datum)});break;case"geoarea":v.push({label:"Region",values:{name:null!==(m=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!==m?m:"",value:null!==(y=null===(p=x.datum)||void 0===p?void 0:p.value)&&void 0!==y?y:""}})}}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],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/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}: ${Bt(e.min)} to ${Bt(e.max)}, mean ${Bt(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),w=Math.min(l,v.length),k=v.slice(0,w),j=v.length-w,A=new Set;for(const e of k)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:Ft,tabIndex:-1,onBlur:y,style:Nt,role:"region","aria-label":m,children:[e.jsx("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{d&&u&&u.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:zt,children:"×"}),e.jsx("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Wt,children:x}),e.jsxs("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+n,style:Gt,children:[e.jsx("caption",{className:"semiotic-accessible-data-table-caption",style:Xt,children:j>0?`First ${w} of ${v.length} data points`:`All ${v.length} data points`}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:qt,children:"type"}),O.map(t=>e.jsx("th",{style:qt,children:t},t))]})}),e.jsx("tbody",{children:k.map((t,n)=>e.jsxs("tr",{children:[e.jsx("td",{style:Vt,children:t.label}),O.map(n=>{return e.jsx("td",{style:Vt,children:(o=t.values[n],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Bt(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:Yt,children:["Show ",Math.min(25,j)," more"," ",1===j?"row":"rows"," (",j," remaining)"]})]})}function Zt({summary:t}){return t?e.jsx("div",{role:"note",style:$t,children:t}):null}function Kt({tableId:t}){return e.jsx("a",{href:"#"+t,style:$t,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,$t)},children:"Skip to data table"})}function Ut({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:$t,children:n})}const Jt="var(--semiotic-focus, #005fcc)";function en({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:a}){if(!t||!n)return null;const l=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=s&&null!=a){const t=Math.max(s,4),n=Math.max(a,4);u=e.jsx("rect",{x:l-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:Jt,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:Jt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Jt,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 tn(e){return Array.isArray(e)?e[0]:e}const nn={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 on(e,t){return"function"==typeof t?t(e):e[t]}function rn(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 sn(t={}){const{fields:n,title:o,format:i,style:r={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(o){const e=on(t,o);a=rn(e,i)}if(n&&n.length>0)n.forEach(e=>{let n,o,r;"string"==typeof e?(n=e,o=e,r=i):(n=e.label,o=e.accessor||e.key||"",r=e.format||i);const s=on(t,o);l.push({label:n,value:rn(s,r)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){a=rn(t[n],i);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=rn(t[e[0]],i))}}const c=Object.assign(Object.assign({},nn),r);return e.jsxs("div",{className:("semiotic-tooltip "+s).trim(),style:c,children:[a&&e.jsx("div",{style:{fontWeight:l.length>0?"bold":"normal"},children:a}),l.map((t,n)=>e.jsxs("div",{style:{marginTop:0===n&&a?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},n))]})}}function an(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;const i=tn(!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),r=n(i);return null==r?null:e.jsx("div",{className:"semiotic-tooltip",style:nn,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?sn(t):sn())}}function ln({x:t,y:n,containerWidth:o,containerHeight:i,margin:r,children:s,className:a="stream-frame-tooltip",zIndex:l=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})},[s,a,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 m=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}(s),p=m?null:nn;return c?e.jsx("div",{ref:u,className:m?a:(a+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},p||{}),{position:"absolute",left:r.left+t,top:r.top+n,transform:g,pointerEvents:"none",zIndex:l,width:"max-content"}),children:s}):null}function cn(n){let o=null;const i=()=>(o||(o=t.createContext(null)),o),r=un(n);return[function({children:o,initialState:r}){const s=t.useRef(r),a=t.useMemo(()=>un(n,s.current),[]),l=i();return e.jsx(l.Provider,{value:a,children:o})},e=>{var n;const o=i(),s=null!==(n=t.useContext(o))&&void 0!==n?n:r,a=t.useRef(e);a.current=e;const l=t.useCallback(()=>a.current(s.getState()),[s]),c=t.useCallback(()=>a.current(s.getState()),[s]);return t.useSyncExternalStore(s.subscribe,l,c)}]}function un(e,t){const n=new EventTarget;let o=Object.assign(Object.assign({},e(function(e){o=Object.assign(Object.assign({},o),e(o)),n.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.addEventListener("update",e),()=>n.removeEventListener("update",e)}}}function dn(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 hn(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:fn})})),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 fn=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],gn={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}},mn={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}},pn={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:fn,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 yn(e,t){if("light"===t)return gn;if("dark"===t)return mn;if("high-contrast"===t)return pn;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?mn:gn;return hn(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 hn(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[vn,bn]=cn(e=>({theme:gn,setTheme(t){e(e=>({theme:yn(e.theme,t)}))}}));const xn="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function wn(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function kn(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,r]=function(e,n,o){const i=t.useRef(null),[r,s]=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;s(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[i,[n&&r?r.w:e[0],o&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),s=t.useMemo(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),a=r[0]-s.left-s.right,l=r[1]-s.top-s.bottom,c=wn(e.foregroundGraphics,r,s),u=wn(e.backgroundGraphics,r,s),d=bn(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),m="semiotic-table-"+h.useId(),p=t.useRef(0),y=t.useRef(()=>{}),v=t.useCallback(()=>{p.current||(p.current=requestAnimationFrame(()=>y.current()))},[]);t.useEffect(()=>()=>{p.current&&(cancelAnimationFrame(p.current),p.current=0)},[]);const b=t.useRef(()=>{}),x=t.useRef(()=>{}),w=t.useRef(null),k=t.useRef(0),j=t.useCallback(()=>{k.current=0;const e=w.current;w.current=null,e&&b.current(e)},[]),A=t.useCallback(e=>{w.current={clientX:e.clientX,clientY:e.clientY},0===k.current&&(k.current=requestAnimationFrame(j))},[j]),O=t.useCallback(()=>{w.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0),x.current()},[]);t.useEffect(()=>()=>{w.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0)},[]);const S=e.themeDirtyRef;return xn(()=>{S&&(Mt++,S.current=!0,v())},[d,v,S]),{reducedMotion:n,reducedMotionRef:o,responsiveRef:i,size:r,margin:s,adjustedWidth:a,adjustedHeight:l,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:f,introEnabled:g,tableId:m,rafRef:p,renderFnRef:y,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:A,onPointerLeave:O}}function jn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function An(e,t,n=.3){jn(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 On(e,t,n=.6){var o,i,r,s,a;if(!jn(t))return;const l=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+l*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a: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 Sn(e,t,n,o=.35){jn(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function Mn(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 r=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}function Cn(e,t,n){return null==t?n:"string"!=typeof t?t:Rt(e,t)||n}function _n(e,t,n,o,i,r,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,i,r,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)),d=e.createLinearGradient(o,i,r,s),[h,f,g]=Mn(e,n);return d.addColorStop(0,`rgba(${h},${f},${g},${c})`),d.addColorStop(1,`rgba(${h},${f},${g},${u})`),d}function Pn(e,t){const{x:n,y:o,w:i,h:r}=t,{tl:s,tr:a,br:l,bl:c}=ut(t);e.beginPath(),e.moveTo(n+s,o),e.lineTo(n+i-a,o),a>0&&e.arcTo(n+i,o,n+i,o+a,a),e.lineTo(n+i,o+r-l),l>0&&e.arcTo(n+i,o+r,n+i-l,o+r,l),e.lineTo(n+c,o+r),c>0&&e.arcTo(n,o+r,n,o+r-c,c),e.lineTo(n,o+s),s>0&&e.arcTo(n,o,n+s,o,s),e.closePath()}function Ln(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 Rn=(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)Tn(e,t);else if(t.cornerRadii&&ct(t.cornerRadii)){const n=Cn(e,t.style.fill,Rt(e,"var(--semiotic-primary, #007bff)")),o=Ln(t),i=t.fillGradient&&"string"==typeof n?_n(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,Pn(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=Cn(e,t.style.fill,Rt(e,"var(--semiotic-primary, #007bff)")),o=Ln(t),i=t.fillGradient&&"string"==typeof n?_n(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n;const r=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-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+r,a),e.arcTo(s,a,s,a+r,r),e.lineTo(s,a+c-r),e.arcTo(s,a+c,s+r,a+c,r),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s+r,a+c),e.arcTo(s,a+c,s,a+c-r,r);break;default:e.moveTo(s,a+c),e.lineTo(s,a+r),e.arcTo(s,a,s+r,a,r),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=Cn(e,t.style.fill,Rt(e,"var(--semiotic-primary, #007bff)")),o=Ln(t),i=t.fillGradient&&"string"==typeof n?_n(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=Rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}An(e,t),e.globalAlpha=1}};function Tn(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 r=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),r){const r=i+o,s=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=r)e.drawImage(n,s,o,i,i)}else{const r=i+o,s=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=r)e.drawImage(n,o,s,i,i)}e.restore()}const $n=(e,t,n,o)=>{var i;const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{for(const t of r){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=n&&(e.globalAlpha=n),e.fillStyle=Cn(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=Cn(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),On(e,t),e.globalAlpha=1}}finally{e.restore()}}};function In(e,t){var n,o,i,r;const s=t._gradientBand.colors;if(0===s.length)return;const{clipPath:a,slices:l}=ft({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:null===(o=null===(n=t.roundedEnds)||void 0===n?void 0:n.start)||void 0===o||o,roundEnd:null===(r=null===(i=t.roundedEnds)||void 0===i?void 0:i.end)||void 0===r||r,colors:s}),c=new Path2D(a);e.save(),e.translate(t.cx,t.cy),e.clip(c);for(const t of l)e.fillStyle=Rt(e,t.color)||t.color||"#007bff",e.fill(new Path2D(t.d));e.restore(),t.style.stroke&&"none"!==t.style.stroke&&(e.save(),e.translate(t.cx,t.cy),e.strokeStyle=Rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(c),e.restore())}function Bn(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function Hn(e,t){const n={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},o=s.arc().cornerRadius(t.cornerRadius)(n);if(!o)return;e.save(),e.translate(t.cx,t.cy);const i=new Path2D(o);e.fill(i),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(i),e.restore()}const En=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,o=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(e.globalAlpha=n*o,t._gradientBand&&t._gradientBand.colors.length>0)In(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(Bn(e,t),Sn(e,t)),e.globalAlpha=1;else{if(e.fillStyle=("string"==typeof t.style.fill?Rt(e,t.style.fill):t.style.fill)||"#007bff",t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const n=ht({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});e.save(),e.translate(t.cx,t.cy);const o=new Path2D(n);e.fill(o),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(o),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Hn(e,t)):(Bn(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(Bn(e,t),Sn(e,t)),e.globalAlpha=1}}},Dn=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const n=t.columnWidth/2,o="vertical"===t.projection,s=Rt(e,"var(--semiotic-primary, #007bff)"),a=Rt(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?Rt(e,l)||l:null!=l?l:s,u=t.style.stroke,d="string"==typeof u?Rt(e,u)||u:a,h=t.style.strokeWidth||1,f=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=d,e.lineWidth=h,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=f,e.fillStyle=c,o){const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,i)}else{const o=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,i,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},Fn=(e,t,n,o)=>{var i,r;const s=t.filter(e=>"violin"===e.type);for(const t of s){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6,e.fillStyle=("string"==typeof t.style.fill?Rt(e,t.style.fill):t.style.fill)||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Nn=(e,t,n,o)=>{var i,r,s;const a=t.filter(e=>"connector"===e.type);if(0===a.length)return;const l=new Map;for(const e of a){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(r=null!==(i=n.fillOpacity)&&void 0!==i?i:n.opacity)&&void 0!==r?r:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=Rt(e,n.style.stroke)||("string"==typeof n.style.fill?Rt(e,n.style.fill):n.style.fill)||Rt(e,"var(--semiotic-border, #999)"),e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(s=n.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}},Wn=(e,t,n,o)=>{var i,r,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const n=t.points;if(n.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;n.length>t;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),e.fillStyle=(null===(s=t.style)||void 0===s?void 0:s.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=Rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function zn(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Gn(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let qn=null;function Vn(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:i=1.5,spacing:r=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*r));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(qn||(qn=document.createElement("canvas")),qn.width=e,qn.height=e,qn)}(a)}catch(e){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=i,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+=r)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+=r)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const Xn=new Map;function Yn(e,t){const n=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,o=Xn.get(n);if(void 0!==o)return o;const i=Vn({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Xn.set(n,i),i}function Qn(e,t,n,o,i,r){e.moveTo(t+r,n),e.lineTo(t+o-r,n),e.quadraticCurveTo(t+o,n,t+o,n+r),e.lineTo(t+o,n+i-r),e.quadraticCurveTo(t+o,n+i,t+o-r,n+i),e.lineTo(t+r,n+i),e.quadraticCurveTo(t,n+i,t,n+i-r),e.lineTo(t,n+r),e.quadraticCurveTo(t,n,t+r,n),e.closePath()}function Zn(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Kn(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const Un=e=>[Nn,...e],Jn={bar:Un([Rn]),clusterbar:Un([Rn]),point:Un([$n]),swarm:Un([$n]),pie:[En],donut:[En],boxplot:Un([Dn,$n]),violin:Un([Fn]),histogram:Un([Rn]),ridgeline:Un([Fn]),timeline:Un([Rn]),funnel:[Rn,Wn,(e,t,n,o)=>{var i,r,s,a;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>{var t,n;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(n=e.datum)||void 0===n?void 0:n.__funnelValueLabelX)})){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(!n.__funnelStepLabel)continue;const o=n.__funnelStepLabel;if(e.measureText(o).width+16>(null!==(r=null!==(i=n.__funnelRowWidth)&&void 0!==i?i:n.__funnelBarW)&&void 0!==r?r:0))continue;const s=n.__funnelStepLabelX,a=n.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(o,s,a),e.fillStyle="#fff",e.fillText(o,s,a)}e.font="bold 13px sans-serif";for(const t of l){const n=t.datum;if(!n)continue;if(null==n.__funnelValueLabelX)continue;const o=null!==(s=n.__funnelBarW)&&void 0!==s?s:0;if(60>o)continue;const i=n.__funnelValue;if(null==i||0===i)continue;const r=n.__funnelPercent,l=!0===n.__funnelIsFirstStep;let c;if(c=l?zn(i):null!=r?`${zn(i)} (${Gn(r)})`:zn(i),e.measureText(c).width+16>o){if(l||null==r)continue;if(c=zn(i),e.measureText(c).width+16>o)continue}const u=n.__funnelValueLabelX,d=(null!==(a=n.__funnelValueLabelY)&&void 0!==a?a:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[Rn,(e,t,n,o)=>{var i,r;const s=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of s){const n=("string"==typeof t.style.fill?t.style.fill:null)||Rt(e,"var(--semiotic-border, #999)"),o=Yn(n,e);e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),o?e.fillStyle=o:(e.fillStyle=n,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,n,o)=>{const i=t.filter(e=>{var t,n;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(n=e.datum)||void 0===n?void 0:n.__barFunnelLabelX)});if(0===i.length)return;const r=function(e,t){const[n,o,i]=Mn(e,t);return(.2126*n+.7152*o+.0722*i)/255>.6}(e,Rt(e,"var(--semiotic-text, #333)")),s=r?"#1f2937":"#ffffff",a=r?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=r?"#f3f4f6":"#1a1a1a",c=l;for(const t of i){const n=t.datum;if(!n)continue;const o=n.__barFunnelValue;if(null==o)continue;if(25>t.w)continue;const i=n.__barFunnelPercent,r=!(!0===n.__barFunnelIsFirstStep)&&null!=i,u=r?Kn(i):"",d=Zn(o);e.font="bold 13px sans-serif";const h=r?e.measureText(u).width:0;e.font="11px sans-serif";const f=e.measureText(d).width,g=Math.max(h,f)+12,m=r?32:17,p=n.__barFunnelLabelX,y=p-g/2,v=n.__barFunnelLabelY-m-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),Qn(e,y,v,g,m,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),Qn(e,y,v,g,m,4),e.stroke(),e.textAlign="center",e.textBaseline="top",r?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,p,v+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,p,v+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,p,v+3))}e.lineWidth=1}],swimlane:Un([Rn]),custom:Un([Rn,$n,En,Dn,Fn,Wn])},eo={top:50,right:40,bottom:60,left:70},to={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function no({hover:t}){var n,o,i,r,s,a;const l=t.data||{},c=t.stats,u=t.category;if(Array.isArray(l)){const t=u||(null===(n=l[0])||void 0===n?void 0:n.category)||"";if(c)return e.jsxs("div",{className:"semiotic-tooltip",style:to,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:["n = ",c.n]}),e.jsxs("div",{children:["Min: ",c.min.toLocaleString()]}),e.jsxs("div",{children:["Q1: ",c.q1.toLocaleString()]}),e.jsxs("div",{children:["Median: ",c.median.toLocaleString()]}),e.jsxs("div",{children:["Q3: ",c.q3.toLocaleString()]}),e.jsxs("div",{children:["Max: ",c.max.toLocaleString()]}),e.jsxs("div",{style:{opacity:.8},children:["Mean: ",c.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const o=l.length;return e.jsxs("div",{className:"semiotic-tooltip",style:to,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:[o," items"]})]})}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.jsxs("div",{className:"semiotic-tooltip",style:to,children:[l.category&&e.jsx("div",{style:{fontWeight:"bold"},children:l.category+""}),e.jsxs("div",{children:["Count: ",l.count]}),2===t.length&&e.jsxs("div",{style:{opacity:.8},children:[Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)]})]})}const d=t.__oAccessor,h=t.__rAccessor,f=t.__chartType;if("swarm"===f||"point"===f){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.jsx("div",{className:"semiotic-tooltip",style:to,children:t.map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},t))})}const g=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",m=null!==(a=null!==(s=null!==(r=null!==(i=null!==(o=l.__aggregateValue)&&void 0!==o?o:h&&null!=l[h]?l[h]:null)&&void 0!==i?i:l.value)&&void 0!==r?r:l.__rValue)&&void 0!==s?s:l.pct)&&void 0!==a?a:"";if(!g&&""===m){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.jsx("div",{className:"semiotic-tooltip",style:to,children:t.map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof n?n.toLocaleString():n+""]},t))})}return e.jsxs("div",{className:"semiotic-tooltip",style:to,children:[g&&e.jsx("div",{style:{fontWeight:"bold"},children:g+""}),""!==m&&e.jsx("div",{children:"number"==typeof m?m.toLocaleString():m+""})]})}no.ownsChrome=!0;const oo=t.forwardRef(function(n,o){var i,r,a,l,c,u,d,f,g,y,v,b;const{chartType:x,runtimeMode:w,data:k,oAccessor:j="category",rAccessor:A="value",colorAccessor:O,stackBy:S,groupBy:M,multiAxis:C,timeAccessor:_,valueAccessor:P,categoryAccessor:L,projection:R="vertical",size:T=[600,400],responsiveWidth:$,responsiveHeight:I,margin:B,barPadding:H,roundedTop:E,gradientFill:D,trackFill:F,baselinePadding:N,innerRadius:W,cornerRadius:z,normalize:G,startAngle:q,sweepAngle:V,dynamicColumnWidth:X,bins:Y,showOutliers:Q,showIQR:Z,amplitude:K,connectorOpacity:U,showLabels:ne,connectorAccessor:de,connectorStyle:he,dataIdAccessor:fe,rExtent:ge,oExtent:me,extentPadding:pe=.05,oSort:ye,windowMode:ve="sliding",windowSize:be=200,pieceStyle:xe,summaryStyle:we,colorScheme:ke,barColors:je,showAxes:Ae=!0,showCategoryTicks:Oe,categoryLabel:Se,valueLabel:Me,categoryFormat:Ce,valueFormat:_e,oLabel:Pe,rLabel:Le,oFormat:Re,rFormat:Te,rTickValues:$e,tickLabelEdgeAlign:Ie,axisExtent:Be,enableHover:He=!0,hoverAnnotation:Ee,tooltipContent:De,customHoverBehavior:Fe,annotations:Ne,autoPlaceAnnotations:We,svgAnnotationRules:ze,showGrid:Ge=!1,legend:qe,legendHoverBehavior:Ve,legendClickBehavior:Xe,legendHighlightedCategory:Ye,legendIsolatedCategories:Qe,legendPosition:Ze,legendLayout:Ke,legendCategoryAccessor:Ue,onCategoriesChange:Je,backgroundGraphics:et,foregroundGraphics:tt,title:nt,className:ot,background:rt,centerContent:dt,decay:Ot,pulse:St,transition:Mt,animate:Ct,staleness:_t,brush:Pt,onBrush:Lt,accessibleTable:Tt=!0,description:$t,summary:Bt,customLayout:Ht,layoutConfig:Et}=n,Dt=t.useRef(!0),Ft=kn({sizeProp:T,responsiveWidth:$,responsiveHeight:I,userMargin:B,marginDefault:eo,foregroundGraphics:tt,backgroundGraphics:et,animate:Ct,transitionProp:Mt,themeDirtyRef:Dt}),{reducedMotionRef:Nt,responsiveRef:Wt,size:zt,margin:Gt,adjustedWidth:qt,adjustedHeight:Vt,resolvedForeground:Xt,resolvedBackground:Yt,currentTheme:Jt,transition:nn,introEnabled:on,tableId:rn,rafRef:sn,renderFnRef:an,scheduleRender:cn}=Ft,un=function(){const[e,n]=t.useState(!1);return vt(()=>{n(!0)},[]),e}(),hn=function(){const e=t.useSyncExternalStore(bt,xt,wt);return t.useRef(e).current}(),fn=t.useMemo(()=>m(k),[k]),gn=null!=Se?Se:Pe,mn=null!=Me?Me:Le,pn=null!=Ce?Ce:Re,yn=null!=_e?_e:Te,vn=t.useRef(null),bn=t.useRef(null),xn=t.useRef([]),wn=t.useRef(Ue),jn=t.useRef(Je);wn.current=Ue,jn.current=Je;const[An,On]=t.useState(null),[Sn,Mn]=t.useState(null),[Cn,_n]=t.useState(0),[Pn,Ln]=t.useState(!1),Rn=He||Ee,Tn="streaming"===w,$n=t.useMemo(()=>{var e,t,n;return{chartType:x,runtimeMode:Tn?"streaming":"bounded",windowSize:be,windowMode:ve,extentPadding:pe,projection:R,oAccessor:Tn?void 0:j,rAccessor:Tn?void 0:A,colorAccessor:O,stackBy:S,groupBy:M,multiAxis:C,timeAccessor:Tn?_:void 0,valueAccessor:Tn?P||("string"==typeof A||"function"==typeof A?A:void 0):void 0,categoryAccessor:Tn?L||j:void 0,rExtent:ge,oExtent:me,axisExtent:Be,barPadding:H,roundedTop:E,gradientFill:D,trackFill:F,baselinePadding:N,innerRadius:W,cornerRadius:z,normalize:G,startAngle:q,sweepAngle:V,dynamicColumnWidth:X,bins:Y,showOutliers:Q,showIQR:Z,amplitude:K,connectorOpacity:U,showLabels:ne,connectorAccessor:de,connectorStyle:he,dataIdAccessor:fe,oSort:ye,pieceStyle:xe,summaryStyle:we,colorScheme:ke,themeCategorical:null===(e=null==Jt?void 0:Jt.colors)||void 0===e?void 0:e.categorical,themeSemantic:dn(Jt),themeSequential:null===(t=null==Jt?void 0:Jt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==Jt?void 0:Jt.colors)||void 0===n?void 0:n.diverging,barColors:je,decay:Ot,pulse:St,transition:nn,introAnimation:on,staleness:_t,customLayout:Ht,layoutConfig:Et,layoutMargin:Gt}},[x,be,ve,pe,R,j,A,O,S,M,C,_,P,L,ge,me,Be,H,E,D,F,N,W,z,G,q,V,X,Y,Q,Z,K,U,ne,de,he,fe,ye,xe,we,ke,je,Ot,St,null==nn?void 0:nn.duration,null==nn?void 0:nn.easing,on,_t,Tn,Jt,Ht,Et,Gt]),In=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 jt(e,t);if(!At(e)||!At(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(!jt(n,i))return!1}else{if(!At(n)||!At(i))return!1;if(!kt(n,i))return!1}}return!0}(n.current,e)||(n.current=e),n.current}($n),Bn=t.useRef(null);Bn.current||(Bn.current=new J(In));const Hn=t.useCallback(()=>{var e,t;const n=wn.current,o=jn.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 r=e+"";n.has(r)||(n.add(r),o.push(r))}return o}(null!==(t=null===(e=Bn.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,xn.current)||(xn.current=i,o(i))},[]);t.useEffect(()=>{var e;null===(e=Bn.current)||void 0===e||e.updateConfig(In),Dt.current=!0,cn()},[In,cn]);const En=t.useRef(null);En.current||(En.current=new p(e=>{const t=Bn.current;t&&t.ingest(e)&&(Dt.current=!0,cn())}));const Dn=t.useCallback(e=>{var t;null===(t=En.current)||void 0===t||t.push(e)},[]),Fn=t.useCallback(e=>{var t;null===(t=En.current)||void 0===t||t.pushMany(e)},[]),Nn=t.useCallback(()=>{var e,t;null===(e=En.current)||void 0===e||e.clear(),null===(t=Bn.current)||void 0===t||t.clear(),Dt.current=!0,cn()},[cn]),Wn=t.useCallback(e=>{var t,n;null===(t=En.current)||void 0===t||t.clearLastData(),null===(n=En.current)||void 0===n||n.setReplacementData(e)},[]);t.useImperativeHandle(o,()=>({push:Dn,pushMany:Fn,replace:Wn,remove:e=>{var t,n,o,i;null===(t=En.current)||void 0===t||t.flush();const r=null!==(o=null===(n=Bn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];if(r.length>0){const e=null===(i=bn.current)||void 0===i?void 0:i.data;!!bn.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(bn.current=null,On(null)),Dt.current=!0,cn()}return r},update:(e,t)=>{var n,o,i;null===(n=En.current)||void 0===n||n.flush();const r=null!==(i=null===(o=Bn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Dt.current=!0,cn()),r},clear:Nn,getData:()=>{var e,t,n;return null===(e=En.current)||void 0===e||e.flush(),null!==(n=null===(t=Bn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Bn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[Dn,Fn,Wn,Nn,cn]),t.useEffect(()=>{var e;k&&(null===(e=En.current)||void 0===e||e.setBoundedData(fn))},[k,fn]);const{hoverHandlerRef:zn,hoverLeaveRef:Gn,onPointerMove:qn,onPointerLeave:Vn}=Ft;zn.current=e=>{if(!Rn)return;const t=vn.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Gt.left,i=e.clientY-n.top-Gt.top;if(0>o||o>qt||0>i||i>Vt)return void(bn.current&&(bn.current=null,On(null),Fe&&Fe(null),cn()));const r=Bn.current;if(!r||0===r.scene.length)return;const s="radial"===R,a=function(e,t,n,o=30,i,r=0){let s=null;if(i){const e=function(e,t,n,o,i,r=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(o,i+5,12),c=t-l,u=t+l,d=n-l,h=n+l;let f=null,g=1/0;return e.visit((e,i,l,m,p)=>{if(i>u||c>m||l>h||d>p)return!0;if(!e.length){let i=e;do{const e=i.data,l=r(e)-t,c=s(e)-n,u=Math.sqrt(l*l+c*c);te(a(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,r);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"rect":if(null==r.datum)break;e=oe(r,t,n);break;case"point":if(i)break;e=ie(r,t,n,o);break;case"wedge":if(null===r.datum)break;e=re(r,t,n);break;case"boxplot":e=se(r,t,n);break;case"violin":e=ae(r,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?o-qt/2:o,s?i-Vt/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(bn.current&&(bn.current=null,On(null),Fe&&Fe(null),cn()));const l=(c=a.datum||{},u=a.x,d=a.y,h=Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof j?j:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:x}),Object.assign({data:tn(c),x:u,y:d,__semioticHoverData:!0},h));var c,u,d,h;bn.current=l,On(l),Fe&&(Fe(l),Dt.current=!0),cn()},Gn.current=()=>{bn.current&&(bn.current=null,On(null),Fe&&(Fe(null),Dt.current=!0),cn())};const Xn=t.useRef(-1),Yn=t.useRef(null),Qn=t.useRef(null),Zn=t.useCallback(e=>{const t=Bn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(Qn.current&&Qn.current.version===n)o=Qn.current.graph;else{const e=function(e){var t,n,o;const i=[];for(const r of e)if("rect"===r.type&&null!=r.x){if(null==r.datum)continue;const e=null!==(n=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:"";i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(o=r.group)&&void 0!==o?o:e})}else if("point"===r.type)i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});else if("wedge"===r.type&&null!=r.cx){if(null===r.datum)continue;const e=((r.startAngle||0)+(r.endAngle||0))/2,t=((r.innerRadius||0)+(r.outerRadius||50))/2;i.push({x:r.cx+Math.cos(e)*t,y:r.cy+Math.sin(e)*t,datum:r.datum,shape:"wedge",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)}),r=Array.from(o.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(n=r[e].datum)||void 0===n?void 0:n.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:o,idToIdx:s}}(e),Qn.current={version:n,graph:o}}const i=Xn.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Xn.current=0;const t=o.flat[0];Yn.current={shape:t.shape,w:t.w,h:t.h};const n=Object.assign(Object.assign({},ce(t)),{__oAccessor:"string"==typeof j?j:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:x});return bn.current=n,On(n),Fe&&Fe(n),void cn()}const r=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)),r=e.flat[i];return{flatIndex:i,group:null!==(n=r.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=r._groupIndex)&&void 0!==o?o:0}}(o,i),s=function(e,t,n){const{group:o,indexInGroup:i}=t,r=n.byGroup.get(o);switch(e){case"ArrowRight":return r.length-1>i?r[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?r[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?le(n,n.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?le(n,n.groups[e-1],r[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,r,o);if(null===s)return;if(e.preventDefault(),0>s)return Xn.current=-1,Yn.current=null,bn.current=null,On(null),Fe&&Fe(null),void cn();Xn.current=s;const a=o.flat[s];Yn.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},ce(a)),{__oAccessor:"string"==typeof j?j:void 0,__rAccessor:"string"==typeof A?A:void 0,__chartType:x});bn.current=l,On(l),Fe&&Fe(l),cn()},[Fe,cn]),Kn=t.useCallback(e=>{Xn.current=-1,Yn.current=null,qn(e)},[qn]);an.current=()=>{var e,t;sn.current=0;const n=vn.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const i=Bn.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(Nt.current?r+1e6:r),a=!Nt.current&&s,l=Dt.current;l&&!s&&(i.computeScene({width:qt,height:Vt}),Hn(),Dt.current=!1),(l||a)&&n.setAttribute("aria-label",It(i.scene,x+" chart"));const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=zt[0]*c,d=zt[1]*c;n.width===u&&n.height===d||(n.width=u,n.height=d,n.style.width=zt[0]+"px",n.style.height=zt[1]+"px"),o.setTransform(c,0,0,c,0,0),o.clearRect(0,0,zt[0],zt[1]);const h=null!==(e=null==_t?void 0:_t.threshold)&&void 0!==e?e:5e3,f=_t&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(f&&(o.globalAlpha=null!==(t=null==_t?void 0:_t.dimOpacity)&&void 0!==t?t:.5),"transparent"!==rt&&!et){const e=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",t=rt||(e&&"transparent"!==e?e:null),i=t?Rt(o,t):null;i&&(o.fillStyle=i,o.fillRect(0,0,zt[0],zt[1]))}const g="radial"===R;o.save(),o.beginPath(),o.rect(Gt.left,Gt.top,qt,Vt),o.clip(),g?(o.save(),o.translate(Gt.left+qt/2,Gt.top+Vt/2)):o.translate(Gt.left,Gt.top);const m=Ht?Jn.custom:Jn[x]||[],p={width:qt,height:Vt};for(const e of m)e(o,i.scene,i.scales,p);g&&o.restore(),o.restore(),f&&(o.globalAlpha=1),l&&i.scales&&(Mn(i.scales),_n(e=>e+1)),(null==_t?void 0:_t.showBadge)&&Ln(!!f),(a||null!=i.activeTransition||i.hasActivePulses)&&(sn.current=requestAnimationFrame(()=>an.current()))},function(e){const{hydrated:n,wasHydratingFromSSR:o,storeRef:i,dirtyRef:r,renderFnRef:s,cleanup:a}=e;vt(()=>{var e,t;n&&o&&(null===(t=null===(e=i.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===t||t.call(e)),r.current=!0,s.current()},[n,o]);const l=t.useRef(a);l.current=a,t.useEffect(()=>()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.call(l)},[])}({hydrated:un,wasHydratingFromSSR:hn,storeRef:Bn,dirtyRef:Dt,renderFnRef:an,cleanup:()=>{var e;return null===(e=En.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{Dt.current=!0,cn()},[x,qt,Vt,Ae,rt,cn]),function(e,n,o,i,r,s){t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{var t;const a=n.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=l-a.lastIngestTime>c;u!==r&&(s(u),o.current=!0,i())},1e3);return()=>clearInterval(t)},[e,r,i])}(_t,Bn,Dt,cn,Pn,Ln);const Un=Rn&&An?De?De(An):e.jsx(no,{hover:An}):null,to="radial"===R,oo=Un?e.jsx(ln,{x:An?to?An.x+qt/2:An.x:0,y:An?to?An.y+Vt/2:An.y:0,containerWidth:qt,containerHeight:Vt,margin:Gt,className:"stream-ordinal-tooltip",children:Un}):null,io=at(j,0,"__semiotic_resolvedO"),ro=at(A,0,"__semiotic_resolvedR"),so=io.key,ao=ro.key,lo=function(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let i=!1;const r=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),r=t.fn&&t.key&&!(t.key in n);if(!o&&!r)return n;i=!0;const s=Object.assign({},n);return o&&(s[e.key]=e.fn(n)),r&&(s[t.key]=t.fn(n)),s});return i?r:o}}(io,ro,Ne&&Ne.length>0||!1);if(yt||!un&&hn){const t=Bn.current;t&&k&&(t.ingest({inserts:fn,bounded:!0}),t.computeScene({width:qt,height:Vt}));const n=null!==(i=null==t?void 0:t.scene)&&void 0!==i?i:[],o=null!==(r=null==t?void 0:t.scales)&&void 0!==r?r:null,l="radial"===R,c=l?Gt.left+qt/2:Gt.left,u=l?Gt.top+Vt/2:Gt.top;return e.jsxs("div",{ref:Wt,className:"stream-ordinal-frame"+(ot?" "+ot:""),role:"img","aria-label":$t||("string"==typeof nt?nt:"Ordinal chart"),style:{position:"relative",width:$?"100%":zt[0],height:I?"100%":zt[1]},children:[e.jsx(Zt,{summary:Bt}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:zt[0],height:zt[1],style:{position:"absolute",left:0,top:0},children:[Yt&&e.jsx("g",{transform:`translate(${Gt.left},${Gt.top})`,children:Yt}),e.jsxs("g",{transform:`translate(${c},${u})`,children:[rt&&e.jsx("rect",{x:0,y:0,width:qt,height:Vt,fill:rt}),n.map((t,n)=>function(t,n,o){var i,r,a,l,c,u,d,f,g;const m=("category"in t?t.category:void 0)||("group"in t?t.group:void 0)||"",p=e=>`ord-${t.type}-${m}-${n}-${e}`,y=`ord-${t.type}-${m}-${n}`;switch(t.type){case"rect":{const n=t,o=pt(y)+"-grad",i=function(t,n){const o=t.fillGradient;if(!o)return null;let i=t.x,r=t.y,s=t.x,a=t.y+t.h;"bottom"===t.roundedEdge?(r=t.y+t.h,a=t.y):"right"===t.roundedEdge?(i=t.x+t.w,r=t.y,s=t.x,a=t.y):"left"===t.roundedEdge&&(i=t.x,r=t.y,s=t.x+t.w,a=t.y);const l=[];if("colorStops"in o){const t=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>t.length)return null;for(let n=0;t.length>n;n++)l.push(e.jsx("stop",{offset:t[n].offset,stopColor:t[n].color},n))}else{const n=mt(t.style.fill);l.push(e.jsx("stop",{offset:0,stopColor:n,stopOpacity:o.topOpacity},"0")),l.push(e.jsx("stop",{offset:1,stopColor:n,stopOpacity:o.bottomOpacity},"1"))}return e.jsx("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(n,o),r=i?`url(#${o})`:mt(n.style.fill);if(n.cornerRadii&&ct(n.cornerRadii)){const t=function(e){const{x:t,y:n,w:o,h:i}=e,{tl:r,tr:s,br:a,bl:l}=ut(e);let c=`M${t+r},${n}`;return c+=` L${t+o-s},${n}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+o},${n+s}`),c+=` L${t+o},${n+i-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+o-a},${n+i}`),c+=` L${t+l},${n+i}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${n+i-l}`),c+=` L${t},${n+r}`,r>0&&(c+=` A${r},${r} 0 0 1 ${t+r},${n}`),c+=" Z",c}(n);return e.jsxs(h.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("path",{d:t,fill:r,opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},y)}if(n.roundedTop&&n.roundedTop>0){const t=Math.min(n.roundedTop,n.w/2,n.h/2),{x:o,y:s,w:a,h:l}=n;let c;switch(n.roundedEdge){case"right":c=`M${o},${s} L${o+a-t},${s} A${t},${t} 0 0 1 ${o+a},${s+t} L${o+a},${s+l-t} A${t},${t} 0 0 1 ${o+a-t},${s+l} L${o},${s+l} Z`;break;case"left":c=`M${o+a},${s} L${o+t},${s} A${t},${t} 0 0 0 ${o},${s+t} L${o},${s+l-t} A${t},${t} 0 0 0 ${o+t},${s+l} L${o+a},${s+l} Z`;break;case"bottom":c=`M${o},${s} L${o+a},${s} L${o+a},${s+l-t} A${t},${t} 0 0 1 ${o+a-t},${s+l} L${o+t},${s+l} A${t},${t} 0 0 1 ${o},${s+l-t} Z`;break;default:c=`M${o},${s+l} L${o},${s+t} A${t},${t} 0 0 1 ${o+t},${s} L${o+a-t},${s} A${t},${t} 0 0 1 ${o+a},${s+t} L${o+a},${s+l} Z`}return e.jsxs(h.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("path",{d:c,fill:r,opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},y)}return e.jsxs(h.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:r,opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},y)}case"point":{const n=t;return e.jsx("circle",{cx:n.x,cy:n.y,r:n.r,fill:mt(n.style.fill),opacity:null!==(i=n.style.opacity)&&void 0!==i?i:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},y)}case"wedge":{const i=t;if(i._gradientBand&&i._gradientBand.colors.length>0){const t=pt(`${o?o+"-":""}gauge-grad-${i.category||y}-${n}`),{clipPath:s,slices:u}=ft({innerRadius:i.innerRadius,outerRadius:i.outerRadius,startAngle:i.startAngle,endAngle:i.endAngle,cornerRadius:i.cornerRadius,roundStart:null===(a=null===(r=i.roundedEnds)||void 0===r?void 0:r.start)||void 0===a||a,roundEnd:null===(c=null===(l=i.roundedEnds)||void 0===l?void 0:l.end)||void 0===c||c,colors:i._gradientBand.colors});return e.jsxs("g",{transform:`translate(${i.cx},${i.cy})`,opacity:i.style.opacity,fillOpacity:i.style.fillOpacity,children:[e.jsx("defs",{children:e.jsx("clipPath",{id:t,children:e.jsx("path",{d:s})})}),e.jsx("g",{clipPath:`url(#${t})`,children:u.map((t,n)=>e.jsx("path",{d:t.d,fill:mt(t.color)},n))}),i.style.stroke&&"none"!==i.style.stroke&&e.jsx("path",{d:s,fill:"none",stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},y)}let u;if(i.roundedEnds)u=ht({innerRadius:i.innerRadius,outerRadius:i.outerRadius,startAngle:i.startAngle,endAngle:i.endAngle,cornerRadius:i.cornerRadius,roundStart:i.roundedEnds.start,roundEnd:i.roundedEnds.end});else{const e=s.arc().innerRadius(i.innerRadius).outerRadius(i.outerRadius).startAngle(i.startAngle+Math.PI/2).endAngle(i.endAngle+Math.PI/2);i.cornerRadius&&e.cornerRadius(i.cornerRadius),u=e(gt)||""}return e.jsx("path",{d:u,transform:`translate(${i.cx},${i.cy})`,fill:mt(i.style.fill),stroke:i.style.stroke,strokeWidth:i.style.strokeWidth,opacity:i.style.opacity},y)}case"boxplot":{const n=t,o=n.columnWidth/2;return e.jsxs("g","vertical"===n.projection?{children:[e.jsx("line",{x1:n.x,y1:n.minPos,x2:n.x,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:n.x-o,y:Math.min(n.q1Pos,n.q3Pos),width:n.columnWidth,height:Math.abs(n.q3Pos-n.q1Pos),fill:mt(n.style.fill),fillOpacity:null!==(u=n.style.fillOpacity)&&void 0!==u?u:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.x-o,y1:n.medianPos,x2:n.x+o,y2:n.medianPos,stroke:n.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:n.x-.5*o,y1:n.minPos,x2:n.x+.5*o,y2:n.minPos,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.x-.5*o,y1:n.maxPos,x2:n.x+.5*o,y2:n.maxPos,stroke:n.style.stroke||"#333",strokeWidth:1})]}:{children:[e.jsx("line",{x1:n.minPos,y1:n.y,x2:n.maxPos,y2:n.y,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:Math.min(n.q1Pos,n.q3Pos),y:n.y-o,width:Math.abs(n.q3Pos-n.q1Pos),height:n.columnWidth,fill:mt(n.style.fill),fillOpacity:null!==(d=n.style.fillOpacity)&&void 0!==d?d:.6,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.medianPos,y1:n.y-o,x2:n.medianPos,y2:n.y+o,stroke:n.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:n.minPos,y1:n.y-.5*o,x2:n.minPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:n.maxPos,y1:n.y-.5*o,x2:n.maxPos,y2:n.y+.5*o,stroke:n.style.stroke||"#333",strokeWidth:1})]},y)}case"violin":{const n=t,o=[e.jsx("path",{d:n.pathString,transform:n.translateX||n.translateY?`translate(${n.translateX},${n.translateY})`:void 0,fill:mt(n.style.fill),fillOpacity:null!==(f=n.style.fillOpacity)&&void 0!==f?f:.6,stroke:n.style.stroke||"#333",strokeWidth:n.style.strokeWidth||1},p("path"))];if(n.iqrLine&&n.bounds){const t=n.bounds,i=t.x+t.width/2,r=t.y+t.height/2;t.height>t.width?o.push(e.jsx("line",{x1:i,y1:n.iqrLine.q1Pos,x2:i,y2:n.iqrLine.q3Pos,stroke:n.style.stroke||"#333",strokeWidth:2},p("iqr")),e.jsx("circle",{cx:i,cy:n.iqrLine.medianPos,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1},p("med"))):o.push(e.jsx("line",{x1:n.iqrLine.q1Pos,y1:r,x2:n.iqrLine.q3Pos,y2:r,stroke:n.style.stroke||"#333",strokeWidth:2},p("iqr")),e.jsx("circle",{cx:n.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:n.style.stroke||"#333",strokeWidth:1},p("med")))}return e.jsx("g",{children:o},y)}case"connector":return e.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:null!==(g=t.style.opacity)&&void 0!==g?g:.5},y);case"trapezoid":{const n=t,o=n.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e.jsx("polygon",{points:o,fill:mt(n.style.fill,"#999"),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},y)}default:return null}}(t,n,rn)).filter(Boolean)]})]}),e.jsx(st,{width:qt,height:Vt,totalWidth:zt[0],totalHeight:zt[1],margin:Gt,scales:o,showAxes:Ae,showCategoryTicks:Oe,oLabel:gn,rLabel:mn,oFormat:pn,rFormat:yn,rTickValues:$e,tickLabelEdgeAlign:Ie,axisExtent:Be,showGrid:Ge,title:nt,legend:qe,legendHoverBehavior:Ve,legendClickBehavior:Xe,legendHighlightedCategory:Ye,legendIsolatedCategories:Qe,legendPosition:Ze,legendLayout:Ke,foregroundGraphics:ee(Xt,null===(a=Bn.current)||void 0===a?void 0:a.customLayoutOverlays),annotations:Ne,autoPlaceAnnotations:We,svgAnnotationRules:ze,annotationFrame:0,xAccessor:so,yAccessor:ao,annotationData:lo(null==t?void 0:t.getData())}),dt&&"radial"===R&&e.jsx("div",{style:{position:"absolute",left:Gt.left+qt/2,top:Gt.top+Vt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:dt})]})}return e.jsxs("div",{ref:Wt,className:"stream-ordinal-frame"+(ot?" "+ot:""),role:"group","aria-label":$t||("string"==typeof nt?nt:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:$?"100%":zt[0],height:I?"100%":zt[1],overflow:"visible"},onKeyDown:Zn,children:[Tt&&e.jsx(Kt,{tableId:rn}),Tt&&e.jsx(Qt,{scene:null!==(c=null===(l=Bn.current)||void 0===l?void 0:l.scene)&&void 0!==c?c:[],chartType:x+" chart",tableId:rn,chartTitle:"string"==typeof nt?nt:void 0}),e.jsx(Zt,{summary:Bt}),e.jsx(Ut,{hoverPoint:An}),e.jsxs("div",{role:"img","aria-label":$t||("string"==typeof nt?nt:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Rn?Kn:void 0,onMouseLeave:Rn?Vn:void 0,children:[Yt&&e.jsx("svg",{style:{position:"absolute",top:0,left:0,width:zt[0],height:zt[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${Gt.left},${Gt.top})`,children:Yt})}),e.jsx(it,{width:qt,height:Vt,totalWidth:zt[0],totalHeight:zt[1],margin:Gt,scales:Sn,showAxes:Ae,showGrid:Ge,rFormat:yn,rTickValues:$e,axisExtent:Be}),e.jsx("canvas",{ref:vn,"aria-label":It(null!==(d=null===(u=Bn.current)||void 0===u?void 0:u.scene)&&void 0!==d?d:[],x+" chart"),style:{position:"absolute",top:0,left:0,width:zt[0],height:zt[1]}}),e.jsx(st,{width:qt,height:Vt,totalWidth:zt[0],totalHeight:zt[1],margin:Gt,scales:Sn,showAxes:Ae,showCategoryTicks:Oe,oLabel:gn,rLabel:mn,oFormat:pn,rFormat:yn,rTickValues:$e,axisExtent:Be,showGrid:Ge,title:nt,legend:qe,legendHoverBehavior:Ve,legendClickBehavior:Xe,legendHighlightedCategory:Ye,legendIsolatedCategories:Qe,legendPosition:Ze,legendLayout:Ke,foregroundGraphics:ee(Xt,null===(f=Bn.current)||void 0===f?void 0:f.customLayoutOverlays),annotations:Ne,autoPlaceAnnotations:We,svgAnnotationRules:ze,annotationFrame:Cn,xAccessor:so,yAccessor:ao,annotationData:lo(null===(g=Bn.current)||void 0===g?void 0:g.getData()),underlayRendered:!0}),(Pt||Lt)&&"radial"!==R&&e.jsx(lt,{width:qt,height:Vt,totalWidth:zt[0],totalHeight:zt[1],margin:Gt,scales:Sn,onBrush:Lt||(()=>{})}),dt&&"radial"===R&&e.jsx("div",{style:{position:"absolute",left:Gt.left+qt/2,top:Gt.top+Vt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:dt}),(null==_t?void 0:_t.showBadge)&&e.jsx(ue,{isStale:Pn,position:_t.badgePosition}),e.jsx(en,{active:Xn.current>=0,hoverPoint:An,margin:Gt,size:zt,shape:null===(y=Yn.current)||void 0===y?void 0:y.shape,width:null===(v=Yn.current)||void 0===v?void 0:v.w,height:null===(b=Yn.current)||void 0===b?void 0:b.h}),oo]})]})});function io(e){const{title:t,description:n,summary:o,accessibleTable:i,className:r,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),n&&(c.description=n),o&&(c.summary=o),void 0!==i&&(c.accessibleTable=i),r&&(c.className=r),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function ro(e){const{linkedHover:t,onObservation:n,onClick:o,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:s,linkedHoverInClickPredicate:a=!0}=e,l={};return(t||n||o||i)&&(l.customHoverBehavior=r),(a?n||o||t:n||o)&&(l.customClickBehavior=s),l}function so(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:an(t)||n}}oo.displayName="StreamOrdinalFrame";const ao=t.createContext(null);function lo(){return t.useContext(ao)}function co(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 uo(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[ho,fo]=cn(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=uo(o,t),r=new Map(i.clauses);return r.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const i=new Map(e.selections),r=new Map(o.clauses);return r.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:r})),{selections:i}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),i=uo(o,t);return o.set(t,Object.assign(Object.assign({},i),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}})),[go,mo]=cn(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}))}}));let po={positions:new Map};const yo=new Set;function vo(){for(const e of yo)e()}function bo(e,t){const n=po.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(po.positions);o.delete(e),po={positions:o},vo()}function xo(e){const n=t.useId(),o=e.clientId||n,{name:i}=e,r=fo(e=>e.selections.get(i)),s=fo(e=>e.setClause),a=fo(e=>e.clearClause),l=t.useMemo(()=>!!r&&r.clauses.size>0,[r]);return{predicate:t.useMemo(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(co(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,o):()=>!0,[r,o]),isActive:l,selectPoints:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(i,{clientId:o,type:"point",fields:t})},[o,i,s]),selectInterval:t.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(i,{clientId:o,type:"interval",fields:t})},[o,i,s]),clear:t.useCallback(()=>{a(i,o)},[a,i,o]),clientId:o}}function wo(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}const ko=t.createContext(!1),jo=t.createContext(null),Ao="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function Oo(e){const n=t.useContext(jo),o=t.useId(),i=function(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}(e),r=t.useRef([]);(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})(r.current,i)||(r.current=i);const s=r.current;Ao(()=>{if(n)return()=>n.unregisterCategories(o)},[n,o]),Ao(()=>{n&&n.registerCategories(o,s)},[n,o,s])}function So({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),a=s?o(s,t,n):n?n(i):z[r%z.length];return{label:i+"",color:a}}),label:""}]}}function Mo(){return bn(e=>e.theme)}function Co(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 r=Number(i);return Number.isFinite(r)?r:null}function _o(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 Po(){var e;const t=Mo(),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 Lo(e,n,o){return t.useMemo(()=>{if(!n||"auto"===n||"function"==typeof n)return e;const t=[...e],i="function"==typeof(r=o)?r:e=>e[r];var r;return t.sort("asc"===n?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,n,o])}h.createContext(void 0);const Ro={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 To(e,t,n){var o,i,r,s,a,l,c;const u=Ro[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!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l: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:$o(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function $o(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 Io(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Bo(e,t){if(!t)return Io(e);try{const n=t(e);return null==n?Io(e):n}catch(t){return Io(e)}}function Ho(e,t){return"function"==typeof t?t(e):e[t]}function Eo({categoryAccessor:t,valueAccessor:n,groupAccessor:o,groupLabel:i,pieData:r=!1,valueFormat:s}){return a=>{var l;const c=r?(null===(l=a.data)||void 0===l?void 0:l[0])||a.data||a:a.data||a,u=Ho(c,t),d=Ho(c,n),h=o?Ho(c,o):void 0;return e.jsxs("div",{className:"semiotic-tooltip",style:nn,children:[e.jsx("div",{style:{fontWeight:"bold"},children:Io(u)}),e.jsx("div",{style:{marginTop:4},children:Bo(d,s)}),null!=h&&e.jsxs("div",{style:{marginTop:2,opacity:.8},children:[i||(f=o,"string"==typeof f?f:"value"),": ",Io(h)]})]});var f}}function Do({componentName:t,message:n,diagnosticHint:o,width:i,height:r}){return e.jsx("div",{role:"alert",style:{width:i,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: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 Fo 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(Do,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var No;const Wo="undefined"!=typeof process&&"production"!==(null===(No=process.env)||void 0===No?void 0:No.NODE_ENV);function zo({componentName:t,width:n,height:o,children:i}){return e.jsx(Fo,{fallback:i=>e.jsx(Do,{componentName:t,message:i.message,width:n,height:o}),children:i})}const Go={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"},qo={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Vo(e,t,n,o){if(!Wo)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 r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${r}`)}function Xo(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 r=1;n>=r;r++){let n=i[0];i[0]=r;for(let s=1;o>=s;s++){const o=i[s];i[s]=e[r-1]===t[s-1]?n:1+Math.min(n,i[s],i[s-1]),n=o}}return i[o]}function Yo(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=Xo(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 Qo({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)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";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(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,r]of Object.entries(n))if(r&&"string"==typeof r&&!(r in o)){const n=Yo(r,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function Zo(n){const{data:o,rawData:i,colorBy:r,colorScheme:s,legendInteraction:a,legendPosition:l,selection:c,linkedHover:u,fallbackFields:d,unwrapData:h=!1,onObservation:f,chartType:g,chartId:p,showLegend:y,userMargin:v,marginDefaults:b,onClick:x,hoverHighlight:w,loading:k,loadingContent:j,emptyContent:A,width:O,height:S}=n,M=void 0===i,C=t.useMemo(()=>m(o),[o]),[_,P]=t.useState([]),L=t.useCallback(e=>{P(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),R="string"==typeof n.colorBy?n.colorBy:void 0,{activeSelectionHook:T,hoverSelectionHook:$,customHoverBehavior:I,customClickBehavior:B,crosshairSourceId:H}=function({selection:e,linkedHover:n,fallbackFields:o=[],unwrapData:i=!1,onObservation:r,chartType:s,chartId:a,onClick:l,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=xo({name:(null==e?void 0:e.name)||"__unused__"}),m=function(e){const n=e.name||"hover",{fields:o}=e,{predicate:i,isActive:r,selectPoints:s,clear:a}=xo({name:n});return{onHover:t.useCallback(e=>{if(!e)return void a();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&s(t)},[o,s,a,n]),predicate:i,isActive:r}}({name:(null==h?void 0:h.name)||"hover",fields:f}),p=mo(e=>e.pushObservation),y=e?{isActive:g.isActive,predicate:g.predicate}:null,[v,b]=t.useState(null),x=u||o[0],w=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]),k=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=Co(e,t,h.xField);null!=n&&function(e,t,n){const o=po.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(po={positions:new Map(po.positions).set(e,{xValue:t,sourceId:n})},vo())}(h.name||"hover",n,d)}"x-position"!==(null==h?void 0:h.mode)&&m.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&bo(h.name||"hover",d),"x-position"!==(null==h?void 0:h.mode)&&m.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(r||p){const n={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){const i=_o(e),s=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});r&&r(s),p&&p(s)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});r&&r(e),p&&p(e)}}},[n,m,h,d,r,s,a,p,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=Co(e,t,h.xField);null!=n&&function(e,t,n){const o=po.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(po.positions);return t.delete(e),po={positions:t},vo(),!1}po={positions:new Map(po.positions).set(e,{xValue:t,sourceId:n,locked:!0})},vo()}(h.name||"hover",n,d)}if(e&&l){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),l(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(r||p){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){const n=_o(e),s=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});r&&r(s),p&&p(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});r&&r(e),p&&p(e)}}},[l,r,p,s,a,h,d]);return t.useEffect(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{!function(e,t){const n=po.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(po.positions);o.delete(e),po={positions:o},vo()}(e,d),bo(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:y,hoverSelectionHook:w,customHoverBehavior:k,customClickBehavior:j,crosshairSourceId:d}}({selection:c,linkedHover:u,fallbackFields:d,unwrapData:h,onObservation:f,chartType:g,chartId:p,onClick:x,hoverHighlight:w,colorByField:R}),E=function(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}}(u,H),D=function(e,n,o){const i=lo(),r=Po();return t.useMemo(()=>{var t;if(!n)return;const s=null!==(t=null!=o?o:r&&r.length>0?r: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(i&&Object.keys(i).length>0){const e=V(t.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return V(t.map(e=>({_cat:e})),"_cat",s)}if(i&&Object.keys(i).length>0){const t=V(e,n,s);return e=>i[e]||t(e)}return V(e,n,s)}if(i&&Object.keys(i).length>0){const e=V([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,n,o,i,r])}(C,r,s),F=t.useMemo(()=>{if(!r)return[];const e=new Set;for(const t of C){const n="function"==typeof r?r(t):t[r];null!=n&&e.add(n+"")}return Array.from(e)},[C,r]),N=t.useMemo(()=>M&&_.length>0?_:F,[M,_,F]),W=function(e,n,o){const[i,r]=t.useState(null),[s,a]=t.useState(new Set),l=t.useCallback(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=t.useCallback(t=>{"isolate"===e&&a(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]),u=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&&s.size>0?{isActive:!0,predicate:e=>{const o=t?e[t]:"function"==typeof n?n(e):null;return s.has(o)}}:null},[e,n,i,s]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(a,r,N),G=t.useMemo(()=>$||(W.legendSelectionHook?W.legendSelectionHook:T),[$,W.legendSelectionHook,T]),X=function(e){const n=bn(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])}(c),Y=Po(),Q=lo(),Z=t.useMemo(()=>{if(D)return D;if(!r||0===N.length)return;const e=Array.isArray(s)&&s.length>0||"string"==typeof s&&s.length>0?s:Y&&Y.length>0?Y:z,t="__streamCat",n=V(N.map(e=>({[t]:e})),t,e);return e=>(null==Q?void 0:Q[e])||n(e)||"#999"},[D,r,N,s,Y,Q]),{legend:K,margin:U,legendPosition:J}=function({data:e,colorBy:n,colorScale:o,showLegend:i,legendPosition:r="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=t.useContext(ko),u=null!==t.useContext(jo),d=void 0!==i?i:!c&&!!n,h=!!n&&(d||u),f=t.useMemo(()=>{if(!h)return[];if(void 0!==l)return l;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)},[l,n,e,h]);Oo(u&&n?f:[]);const g=t.useMemo(()=>{if(!d||!n)return;const t=So({data:e,colorBy:n,colorScale:o,getColor:q,categories:f});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[d,n,e,o,f]),m=t.useMemo(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=t=>{const n=e[t];return"number"==typeof n?n:a[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return g&&("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},[a,s,g,r]);return{legend:g,margin:m,legendPosition:r}}({data:C,colorBy:r,colorScale:Z,showLegend:y,legendPosition:l,userMargin:v,defaults:b,categories:N}),ee=t.useMemo(()=>{const e={};return K&&(e.legend=K,e.legendPosition=J),a&&"none"!==a&&(e.legendHoverBehavior=W.onLegendHover,e.legendClickBehavior=W.onLegendClick,e.legendHighlightedCategory=W.highlightedCategory,e.legendIsolatedCategories=W.isolatedCategories),M&&r&&(e.legendCategoryAccessor=r,e.onCategoriesChange=L),e},[K,J,a,W.onLegendHover,W.onLegendClick,W.highlightedCategory,W.isolatedCategories,M,r,L]),te=Array.isArray(i)?m(i):i,ne=function(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 r=Math.min(5,Math.floor(o/40)),s=Math.max(8,Math.floor(o/(3*r))),a=Math.max(6,Math.floor(o/(2.5*r))),l=Math.floor((o-(r*(s+a)-a))/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:r},(t,o)=>e.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},qo),{position:"absolute",top:l+o*(s+a),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:s,opacity:.5+o%2*.2})},o))})}(k,O,S,j),oe=ne?null:function(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({},Go),{width:n,height:o}),children:i||"No data available"}):null}(te,O,S,A);return{data:C,colorScale:D,allCategories:N,legendState:W,effectiveSelectionHook:G,activeSelectionHook:T,customHoverBehavior:I,customClickBehavior:B,legend:K,margin:U,legendPosition:J,earlyReturn:ne||oe||null,legendBehaviorProps:ee,crosshairProps:E,resolvedSelection:X}}function Ko({ref:e,frameRef:n,setup:o}){return t.useImperativeHandle(e,()=>({push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i;return null!==(i=null===(o=n.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[]},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.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[n]),{effectiveLegendProps:o.legendBehaviorProps,effectiveMargin:o.margin}}function Uo(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 Jo(e){const{colorBy:n,colorScale:o,color:i,themeCategorical:r,colorScheme:s,categoryIndexMap:a,userPieceStyle:l,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:f,cycleByCategory:g=!1,baseStyleExtras:m,linkStrokeToFill:p=!1}=e,y=t.useMemo(()=>(e,t)=>{const l="function"==typeof m?m(e,t):m,c=l?Object.assign({},l):{};if(void 0===c.fill)if(n){if(!o)return c;c.fill=q(e,n,o)}else c.fill=function(e,t,n,o,i){if(e)return e;let r;if(Array.isArray(n))r=n;else if(t&&t.length>0)r=t;else if("string"==typeof n){const e=N[n];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=o?(i.has(o)||i.set(o,i.size),r[i.get(o)%r.length]):r[0]:"#007bff"}(i,r,s,g?t:void 0,a);return p&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[n,o,i,r,s,a,g,m,p]),v=t.useMemo(()=>Uo(l?"function"==typeof l?(e,t)=>Object.assign(Object.assign({},y(e,t)),l(e,t)||{}):(e,t)=>Object.assign(Object.assign({},y(e,t)),l):y,{stroke:c,strokeWidth:u,opacity:d}),[y,l,c,u,d]);return t.useMemo(()=>{return e=v,n=f,(t=null!=h?h:null)?(o,...i)=>{var r;const s=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(s,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;s.opacity=e,s.fillOpacity=e,s.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(s,n.unselectedStyle)}return s}:e;var e,t,n},[v,h,f])}function ei(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})}const ti=t.forwardRef(function(n,o){const i=To(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:f,colorScheme:g,sort:p=!1,barPadding:y=40,roundedTop:v,gradientFill:b=!1,baselinePadding:x=!1,tooltip:w,annotations:k,regression:j,valueExtent:A,frameProps:O={},selection:S,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:R,loadingContent:T,emptyContent:$,legendInteraction:I,legendPosition:B,color:H,stroke:E,strokeWidth:D,opacity:F,showCategoryTicks:N,categoryFormat:W,dataIdAccessor:z}=n,{width:G,height:q,enableHover:V,showGrid:X,showLegend:Y,title:Q,description:Z,summary:K,accessibleTable:U,categoryLabel:J,valueLabel:ee}=i,te=t.useMemo(()=>m(s),[s]),ne=Zo({data:te,rawData:s,colorBy:f,colorScheme:g,legendInteraction:I,legendPosition:B,selection:S,linkedHover:M,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"BarChart",chartId:L,showLegend:Y,userMargin:a,marginDefaults:i.marginDefaults,loading:R,loadingContent:T,emptyContent:$,width:G,height:q}),{effectiveLegendProps:oe,effectiveMargin:ie}=Ko({ref:o,frameRef:r,setup:ne});Vo("BarChart",te,"categoryAccessor",c),Vo("BarChart",te,"valueAccessor",u);const re=Lo(te,p,u),se=Po(),ae=t.useMemo(()=>new Map,[te]),le=Jo({colorBy:f,colorScale:ne.colorScale,color:H,themeCategorical:se,colorScheme:g,categoryIndexMap:ae,userPieceStyle:null==O?void 0:O.pieceStyle,stroke:E,strokeWidth:D,opacity:F,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection}),ce=t.useMemo(()=>Eo({categoryAccessor:c,valueAccessor:u,groupAccessor:f&&f!==c?f:void 0,groupLabel:"string"==typeof f?f:"group",valueFormat:h}),[c,u,f,h]);if(ne.earlyReturn)return ne.earlyReturn;const ue=Qo({componentName:"BarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ue)return e.jsx(Do,{componentName:"BarChart",message:ue,width:G,height:q});const de=ei(j),he=de?[de,...k||[]]:k,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({chartType:"bar"},null!=s&&{data:re}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:le,size:[G,q],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie,barPadding:y}),null!=v&&{roundedTop:v}),b&&{gradientFill:!0===b?{topOpacity:.8,bottomOpacity:.05}:b}),z&&{dataIdAccessor:z}),{baselinePadding:x,enableHover:V,showAxes:i.showAxes,oLabel:J,rLabel:ee,rFormat:h}),W&&{oFormat:W}),{showGrid:X,showCategoryTicks:N,oSort:p}),oe),io({title:Q,description:Z,summary:K,accessibleTable:U,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),so({tooltip:w,defaultTooltipContent:ce})),ro({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),he&&he.length>0&&{annotations:he}),A&&{rExtent:A}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e.jsx(zo,{componentName:"BarChart",width:G,height:q,children:e.jsx(oo,Object.assign({ref:r},fe))})});ti.displayName="BarChart";const ni=t.forwardRef(function(n,o){const i=To(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",stackBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:f,colorBy:g,colorScheme:p,normalize:y=!1,sort:v=!1,barPadding:b=40,roundedTop:x,baselinePadding:w=!1,tooltip:k,annotations:j,valueExtent:A,frameProps:O={},selection:S,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:R,loadingContent:T,emptyContent:$,legendInteraction:I,legendPosition:B,color:H,stroke:E,strokeWidth:D,opacity:F,categoryFormat:N}=n,{width:W,height:z,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:Z,categoryLabel:K,valueLabel:U}=i,J=t.useMemo(()=>m(s),[s]),ee=g||u,te=Zo({data:J,rawData:s,colorBy:ee,colorScheme:p,legendInteraction:I,legendPosition:B,selection:S,linkedHover:M,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"StackedBarChart",chartId:L,showLegend:V,userMargin:a,marginDefaults:i.marginDefaults,loading:R,loadingContent:T,emptyContent:$,width:W,height:z}),ne=Po(),oe=t.useMemo(()=>new Map,[J]),ie=Jo({colorBy:ee,colorScale:te.colorScale,color:H,themeCategorical:ne,colorScheme:p,categoryIndexMap:oe,userPieceStyle:null==O?void 0:O.pieceStyle,stroke:E,strokeWidth:D,opacity:F,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=t.useMemo(()=>Eo({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:f}),[u,c,d,f]),se=Qo({componentName:"StackedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{stackBy:u}}),{effectiveLegendProps:ae,effectiveMargin:le}=Ko({ref:o,frameRef:r,setup:te});if(te.earlyReturn)return te.earlyReturn;const ce=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:"bar"},null!=s&&{data:J}),{oAccessor:c,rAccessor:d,stackBy:u,normalize:y,oSort:v,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ie,size:[W,z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:le,barPadding:b}),null!=x&&{roundedTop:x}),{baselinePadding:w,enableHover:G}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:U,rFormat:f}),N&&{oFormat:N}),{showGrid:q}),ae),io({title:X,description:Y,summary:Q,accessibleTable:Z,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),so({tooltip:k,defaultTooltipContent:re})),ro({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),j&&j.length>0&&{annotations:j}),A&&{rExtent:A}),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return se?e.jsx(Do,{componentName:"StackedBarChart",message:se,width:W,height:z}):e.jsx(zo,{componentName:"StackedBarChart",width:W,height:z,children:e.jsx(oo,Object.assign({ref:r},ce))})});ni.displayName="StackedBarChart";const oi=t.forwardRef(function(n,o){const i=To(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",groupBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:f,colorBy:g,colorScheme:p,sort:y=!1,barPadding:v=60,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:k,valueExtent:j,frameProps:A={},selection:O,linkedHover:S,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:R,emptyContent:T,legendInteraction:$,legendPosition:I,color:B,stroke:H,strokeWidth:E,opacity:D,categoryFormat:F}=n,{width:N,height:W,enableHover:z,showGrid:G,showLegend:q,title:V,description:X,summary:Y,accessibleTable:Q,categoryLabel:Z,valueLabel:K}=i,U=t.useMemo(()=>m(s),[s]),J=g||u,ee=Zo({data:U,rawData:s,colorBy:J,colorScheme:p,legendInteraction:$,legendPosition:I,selection:O,linkedHover:S,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"GroupedBarChart",chartId:P,showLegend:q,userMargin:a,marginDefaults:i.marginDefaults,loading:L,loadingContent:R,emptyContent:T,width:N,height:W}),te=Po(),ne=t.useMemo(()=>new Map,[U]),oe=Jo({colorBy:J,colorScale:ee.colorScale,color:B,themeCategorical:te,colorScheme:p,categoryIndexMap:ne,userPieceStyle:A.pieceStyle,stroke:H,strokeWidth:E,opacity:D,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ie=t.useMemo(()=>Eo({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:f}),[u,c,d,f]),re=Qo({componentName:"GroupedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{groupBy:u}}),{effectiveLegendProps:se,effectiveMargin:ae}=Ko({ref:o,frameRef:r,setup:ee});if(ee.earlyReturn)return ee.earlyReturn;const le=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:"clusterbar"},null!=s&&{data:U}),{oAccessor:c,rAccessor:d,groupBy:u,oSort:y,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:oe,size:[N,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ae,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:z}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Z,rLabel:K,rFormat:f}),F&&{oFormat:F}),{showGrid:G}),se),io({title:V,description:X,summary:Y,accessibleTable:Q,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),so({tooltip:w,defaultTooltipContent:ie})),ro({linkedHover:S,onObservation:M,onClick:C,hoverHighlight:_,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),k&&k.length>0&&{annotations:k}),j&&{rExtent:j}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return re?e.jsx(Do,{componentName:"GroupedBarChart",message:re,width:N,height:W}):e.jsx(zo,{componentName:"GroupedBarChart",width:N,height:W,children:e.jsx(oo,Object.assign({ref:r},le))})});function ii({brushProp:e,onBrushProp:n,linkedBrush:o,valueAccessor:i}){const r=(s="string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0)?"string"==typeof s?{name:s}:s:null;var s;const a=function(e){const{name:n,xField:o,yField:i}=e,{predicate:r,isActive:s,selectInterval:a,clear:l}=xo({name:n}),c=o&&i?"xyBrush":o?"xBrush":"yBrush",u=t.useCallback(e=>{if(!e)return void l();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&&wo(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&wo(e)&&i&&(t[i]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,o,i,a,l]);return{brushInteraction:t.useMemo(()=>({brush:c,during:u,end:u}),[c,u]),predicate:r,isActive:s,clear:l}}({name:(null==r?void 0:r.name)||"__unused_ordinal_brush__",xField:(null==r?void 0:r.xField)||("string"==typeof i?i:"value")}),l=t.useRef(a.brushInteraction);l.current=a.brushInteraction;const c=t.useCallback(e=>{if(r){l.current.end(e?e.r:null)}null==n||n(e)},[n,r]),u=!!(e||o||n);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}oi.displayName="GroupedBarChart";const ri=t.forwardRef(function(n,o){const i=To(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",subcategoryAccessor:u,valueAccessor:d="value",orientation:h="horizontal",valueFormat:f,colorBy:g,colorScheme:p,barPadding:y,tooltip:v,annotations:b,brush:x,onBrush:w,linkedBrush:k,frameProps:j={},selection:A,linkedHover:O,onObservation:S,onClick:M,hoverHighlight:C,chartId:_,loading:P,loadingContent:L,emptyContent:R,legendInteraction:T,legendPosition:$,color:I,stroke:B,strokeWidth:H,opacity:E,categoryFormat:D,rTickValues:F,tickLabelEdgeAlign:N,showCategoryTicks:W,gradientFill:z,trackFill:G,roundedTop:q,valueExtent:V}=n,{width:X,height:Y,enableHover:Q,showGrid:Z,showLegend:K,title:U,description:J,summary:ee,accessibleTable:te,categoryLabel:ne,valueLabel:oe}=i,ie=t.useMemo(()=>m(s),[s]),re=g||u,se=t.useMemo(()=>{if(null!=y)return y;if("sparkline"!==n.mode)return 40;const e=new Set(ie.map(e=>"function"==typeof c?c(e):e[c])),t=Math.max(1,e.size);return t>1?Math.max(0,Math.min(1,(("horizontal"===h?Y:X)-2*t)/(t-1))):1},[y,n.mode,ie,c,h,X,Y]),ae=Zo({data:ie,rawData:s,colorBy:re,colorScheme:p,legendInteraction:T,legendPosition:$,selection:A,linkedHover:O,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!0,onObservation:S,onClick:M,hoverHighlight:C,chartType:"SwimlaneChart",chartId:_,showLegend:K,userMargin:a,marginDefaults:i.marginDefaults,loading:P,loadingContent:L,emptyContent:R,width:X,height:Y}),le=ii({brushProp:x,onBrushProp:w,linkedBrush:k,valueAccessor:d}),ce=Po(),ue=t.useMemo(()=>new Map,[ie]),de=Jo({colorBy:re,colorScale:ae.colorScale,color:I,themeCategorical:ce,colorScheme:p,categoryIndexMap:ue,userPieceStyle:null==j?void 0:j.pieceStyle,stroke:B,strokeWidth:H,opacity:E,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection,cycleByCategory:!0}),he=t.useMemo(()=>Eo({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:f}),[u,c,d,f]),fe=Qo({componentName:"SwimlaneChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d,subcategoryAccessor:u},requiredProps:{subcategoryAccessor:u}}),{effectiveLegendProps:ge,effectiveMargin:me}=Ko({ref:o,frameRef:r,setup:ae});if(ae.earlyReturn)return ae.earlyReturn;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(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=s&&{data:ie}),{oAccessor:c,rAccessor:d,stackBy:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:de,size:[X,Y],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:me,barPadding:se,enableHover:Q}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:!1===W?void 0:ne,rLabel:oe,rFormat:f}),F&&{rTickValues:F}),null!=N&&{tickLabelEdgeAlign:N}),D&&{oFormat:D}),void 0!==W&&{showCategoryTicks:W}),{showGrid:Z}),ge),io({title:U,description:J,summary:ee,accessibleTable:te,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),so({tooltip:v,defaultTooltipContent:he})),ro({linkedHover:O,onObservation:S,onClick:M,hoverHighlight:C,customHoverBehavior:ae.customHoverBehavior,customClickBehavior:ae.customClickBehavior})),b&&b.length>0&&{annotations:b}),z&&{gradientFill:!0===z?{topOpacity:.8,bottomOpacity:.05}:z}),null!=G&&{trackFill:G}),null!=q&&{roundedTop:q}),V&&{rExtent:V}),le.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return fe?e.jsx(Do,{componentName:"SwimlaneChart",message:fe,width:X,height:Y}):e.jsx(zo,{componentName:"SwimlaneChart",width:X,height:Y,children:e.jsx(oo,Object.assign({ref:r},pe))})});function si(e,n){const{variant:o,frameRef:i,overrides:r,deps:s}=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,r,s;const a=Array.isArray(t)?t:[t],l=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 a){const n=l.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(r=n.data)&&void 0!==r?r:{}),{id:t})),null===(s=e.current)||void 0===s||s.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,r;const s=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of s)null===(r=e.current)||void 0===r||r.push(n(t));return s},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,r;const s=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of s)null===(r=n.current)||void 0===r||r.pushLine(t(e));return s},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),r)},null!=s?s:[])}ri.displayName="SwimlaneChart";const ai=t.forwardRef(function(n,o){const i=To(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null);si(o,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:f,colorScheme:g,sizeBy:p,sizeRange:y=[3,8],pointRadius:v=4,pointOpacity:b=.7,categoryPadding:x=20,tooltip:w,annotations:k,valueExtent:j,brush:A,onBrush:O,linkedBrush:S,frameProps:M={},selection:C,linkedHover:_,onObservation:P,onClick:L,hoverHighlight:R,chartId:T,loading:$,loadingContent:I,emptyContent:B,legendInteraction:H,legendPosition:E,color:D,stroke:F,strokeWidth:N,opacity:W,showCategoryTicks:z,categoryFormat:G}=n,{width:q,height:V,enableHover:Y,showGrid:Q,showLegend:Z,title:K,description:U,summary:J,accessibleTable:ee,categoryLabel:te,valueLabel:ne}=i,oe=t.useMemo(()=>m(s),[s]),ie=Zo({data:oe,rawData:s,colorBy:f,colorScheme:g,legendInteraction:H,legendPosition:E,selection:C,linkedHover:_,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:R,chartType:"SwarmPlot",chartId:T,showLegend:Z,userMargin:a,marginDefaults:i.marginDefaults,loading:$,loadingContent:I,emptyContent:B,width:q,height:V}),re=ii({brushProp:A,onBrushProp:O,linkedBrush:S,valueAccessor:u}),se=t.useMemo(()=>{if(!p)return;const e=oe.map(e=>"function"==typeof p?p(e):e[p]);return[Math.min(...e),Math.max(...e)]},[oe,p]),ae=Po(),le=t.useMemo(()=>new Map,[oe]),ce=Jo({colorBy:f,colorScale:ie.colorScale,color:D,themeCategorical:ae,colorScheme:g,categoryIndexMap:le,userPieceStyle:null==M?void 0:M.pieceStyle,stroke:F,strokeWidth:N,opacity:W,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,baseStyleExtras:e=>({fillOpacity:b,r:p?X(e,p,y,se):v})}),ue=t.useMemo(()=>Eo({categoryAccessor:c,valueAccessor:u,groupAccessor:f||void 0,valueFormat:h}),[c,u,f,h]);if(ie.earlyReturn)return ie.earlyReturn;const de=Qo({componentName:"SwarmPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(de)return e.jsx(Do,{componentName:"SwarmPlot",message:de,width:q,height:V});const 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({chartType:"swarm"},null!=s&&{data:oe}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:ce,size:[q,V],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie.margin,barPadding:x,enableHover:Y}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:te,rLabel:ne,rFormat:h}),G&&{oFormat:G}),{showGrid:Q,showCategoryTicks:z}),ie.legendBehaviorProps),io({title:K,description:U,summary:J,accessibleTable:ee,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),so({tooltip:w,defaultTooltipContent:ue})),ro({linkedHover:_,onObservation:P,onClick:L,hoverHighlight:R,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior})),k&&k.length>0&&{annotations:k}),j&&{rExtent:j}),re.brushStreamProps),Object.fromEntries(Object.entries(M).filter(([e])=>"pieceStyle"!==e)));return e.jsx(zo,{componentName:"SwarmPlot",width:q,height:V,children:e.jsx(oo,Object.assign({ref:r},he))})});function li(t){return n=>{var o;const i=n.category||n.data&&(null===(o=n.data[0])||void 0===o?void 0:o.category)||"",r=n.stats||(n.data||n).stats;if(r&&null!=r.median)return e.jsxs("div",{className:"semiotic-tooltip",style:nn,children:[i&&e.jsx("div",{style:{fontWeight:"bold"},children:i+""}),null!=r.n&&e.jsxs("div",{children:["n = ",r.n]}),null!=r.min&&e.jsxs("div",{children:["Min: ",r.min.toLocaleString()]}),null!=r.q1&&e.jsxs("div",{children:["Q1: ",r.q1.toLocaleString()]}),e.jsxs("div",{children:["Median: ",r.median.toLocaleString()]}),null!=r.q3&&e.jsxs("div",{children:["Q3: ",r.q3.toLocaleString()]}),null!=r.max&&e.jsxs("div",{children:["Max: ",r.max.toLocaleString()]}),null!=r.mean&&e.jsxs("div",{style:{opacity:.8},children:["Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==t?void 0:t.valueAccessor){const o=t.valueAccessor,r=(Array.isArray(n.data)?n.data:[]).map(e=>Number("function"==typeof o?o(e):e[o])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),s=r.length,a=s>0?s%2!=0?r[Math.floor(s/2)]:(r[s/2-1]+r[s/2])/2:null;return e.jsxs("div",{className:"semiotic-tooltip",style:nn,children:[i&&e.jsx("div",{style:{fontWeight:"bold"},children:i+""}),s>0&&e.jsxs("div",{children:["n = ",s]}),null!=a&&e.jsxs("div",{children:["Median: ",a.toLocaleString()]})]})}return e.jsx("div",{className:"semiotic-tooltip",style:nn,children:e.jsx("div",{style:{fontWeight:"bold"},children:i+""})})}}ai.displayName="SwarmPlot";const ci=t.forwardRef(function(n,o){const i=To(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null);si(o,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:f,colorScheme:g,showOutliers:p=!0,categoryPadding:y=20,tooltip:v,annotations:b,valueExtent:x,frameProps:w={},selection:k,linkedHover:j,onObservation:A,onClick:O,hoverHighlight:S,chartId:M,loading:C,loadingContent:_,emptyContent:P,legendInteraction:L,legendPosition:R,color:T,stroke:$,strokeWidth:I,opacity:B,showCategoryTicks:H,categoryFormat:E}=n,{width:D,height:F,enableHover:N,showGrid:W,showLegend:z,title:G,description:q,summary:V,accessibleTable:X,categoryLabel:Y,valueLabel:Q}=i,Z=t.useMemo(()=>m(s),[s]),K=Zo({data:Z,rawData:s,colorBy:f,colorScheme:g,legendInteraction:L,legendPosition:R,selection:k,linkedHover:j,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:A,onClick:O,hoverHighlight:S,chartType:"BoxPlot",chartId:M,showLegend:z,userMargin:a,marginDefaults:i.marginDefaults,loading:C,loadingContent:_,emptyContent:P,width:D,height:F}),U=Po(),J=t.useMemo(()=>new Map,[Z]),ee=Jo({colorBy:f,colorScale:K.colorScale,color:T,themeCategorical:U,colorScheme:g,categoryIndexMap:J,userPieceStyle:void 0,stroke:$,strokeWidth:I,opacity:B,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),te=t.useMemo(()=>li(),[]);if(K.earlyReturn)return K.earlyReturn;const ne=Qo({componentName:"BoxPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ne)return e.jsx(Do,{componentName:"BoxPlot",message:ne,width:D,height:F});const oe=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:"boxplot"},null!=s&&{data:Z}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:ee,showOutliers:p,size:[D,F],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:K.margin,barPadding:y,enableHover:N}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Y,rLabel:Q,rFormat:h}),E&&{oFormat:E}),{showGrid:W,showCategoryTicks:H}),K.legendBehaviorProps),io({title:G,description:q,summary:V,accessibleTable:X,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),so({tooltip:v,defaultTooltipContent:te})),ro({linkedHover:j,onObservation:A,onClick:O,hoverHighlight:S,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.jsx(zo,{componentName:"BoxPlot",width:D,height:F,children:e.jsx(oo,Object.assign({ref:r},oe))})});ci.displayName="BoxPlot";const ui=e=>{const t=null==e?void 0:e.category;return null==t?"All":t+""},di=t.forwardRef(function(n,o){const i=To(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:"horizontal"}),r=t.useRef(null);si(o,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c=ui,valueAccessor:u="value",bins:d=25,relative:h=!1,valueFormat:f,colorBy:g,colorScheme:p,categoryPadding:y=20,tooltip:v,annotations:b,valueExtent:x,brush:w,onBrush:k,linkedBrush:j,frameProps:A={},selection:O,linkedHover:S,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:R,emptyContent:T,legendInteraction:$,legendPosition:I,color:B,stroke:H,strokeWidth:E,opacity:D,showCategoryTicks:F,categoryFormat:N}=n,{width:W,height:z,enableHover:G,showGrid:q,showLegend:V,title:X,description:Y,summary:Q,accessibleTable:Z,categoryLabel:K,valueLabel:U}=i,J=t.useMemo(()=>m(s),[s]),ee=Zo({data:J,rawData:s,colorBy:g,colorScheme:p,legendInteraction:$,legendPosition:I,selection:O,linkedHover:S,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"Histogram",chartId:P,showLegend:V,userMargin:a,marginDefaults:i.marginDefaults,loading:L,loadingContent:R,emptyContent:T,width:W,height:z}),te=ii({brushProp:w,onBrushProp:k,linkedBrush:j,valueAccessor:u}),ne=t.useMemo(()=>{if(0===J.length)return;const e="function"==typeof u?u:e=>e[u];let t=1/0,n=-1/0;for(const o of J){const i=e(o);null!=i&&isFinite(i)&&(t>i&&(t=i),i>n&&(n=i))}return t>n?void 0:[t,n]},[J,u]),oe=Po(),ie=t.useMemo(()=>new Map,[J]),re=Jo({colorBy:g,colorScale:ee.colorScale,color:B,themeCategorical:oe,colorScheme:p,categoryIndexMap:ie,userPieceStyle:void 0,stroke:H,strokeWidth:E,opacity:D,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),se=t.useMemo(()=>t=>{const n=t.data||t,o=n.category||t.category||"",i=n.count,r=n.range;return e.jsxs("div",{className:"semiotic-tooltip",style:nn,children:[o&&e.jsx("div",{style:{fontWeight:"bold"},children:o+""}),null!=i&&e.jsxs("div",{children:["Count: ",i]}),r&&2===r.length&&e.jsxs("div",{style:{opacity:.8},children:[Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)]})]})},[]);if(ee.earlyReturn)return ee.earlyReturn;const ae=Qo({componentName:"Histogram",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ae)return e.jsx(Do,{componentName:"Histogram",message:ae,width:W,height:z});const le=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:"histogram"},null!=s&&{data:J}),{oAccessor:c,rAccessor:u,projection:"horizontal",summaryStyle:re,bins:d,normalize:h}),x?{rExtent:x}:ne&&{rExtent:ne}),{size:[W,z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ee.margin,barPadding:y,enableHover:G}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:U,rFormat:f}),N&&{oFormat:N}),{showGrid:q,showCategoryTicks:F}),ee.legendBehaviorProps),io({title:X,description:Y,summary:Q,accessibleTable:Z,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),so({tooltip:v,defaultTooltipContent:se})),ro({linkedHover:S,onObservation:M,onClick:C,hoverHighlight:_,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),b&&b.length>0&&{annotations:b}),te.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.jsx(zo,{componentName:"Histogram",width:W,height:z,children:e.jsx(oo,Object.assign({ref:r},le))})});di.displayName="Histogram";const hi=t.forwardRef(function(n,o){const i=To(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null);si(o,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",bins:h=25,showIQR:f=!0,valueFormat:g,colorBy:p,colorScheme:y,categoryPadding:v=20,tooltip:b,annotations:x,valueExtent:w,brush:k,onBrush:j,linkedBrush:A,frameProps:O={},selection:S,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:R,loadingContent:T,emptyContent:$,legendInteraction:I,legendPosition:B,color:H,stroke:E,strokeWidth:D,opacity:F,showCategoryTicks:N,categoryFormat:W}=n,{width:z,height:G,enableHover:q,showGrid:V,showLegend:X,title:Y,description:Q,summary:Z,accessibleTable:K,categoryLabel:U,valueLabel:J}=i,ee=t.useMemo(()=>m(s),[s]),te=Zo({data:ee,rawData:s,colorBy:p,colorScheme:y,legendInteraction:I,legendPosition:B,selection:S,linkedHover:M,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:X,userMargin:a,marginDefaults:i.marginDefaults,loading:R,loadingContent:T,emptyContent:$,width:z,height:G}),ne=ii({brushProp:k,onBrushProp:j,linkedBrush:A,valueAccessor:u}),oe=Po(),ie=t.useMemo(()=>new Map,[ee]),re=Jo({colorBy:p,colorScale:te.colorScale,color:H,themeCategorical:oe,colorScheme:y,categoryIndexMap:ie,userPieceStyle:void 0,stroke:E,strokeWidth:D,opacity:F,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),se=t.useMemo(()=>li({valueAccessor:u}),[u]);if(te.earlyReturn)return te.earlyReturn;const ae=Qo({componentName:"ViolinPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ae)return e.jsx(Do,{componentName:"ViolinPlot",message:ae,width:z,height:G});const le=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:"violin"},null!=s&&{data:ee}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:re,bins:h,showIQR:f,size:[z,G],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:te.margin,barPadding:v,enableHover:q}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:U,rLabel:J,rFormat:g}),W&&{oFormat:W}),{showGrid:V,showCategoryTicks:N}),te.legendBehaviorProps),io({title:Y,description:Q,summary:Z,accessibleTable:K,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),so({tooltip:b,defaultTooltipContent:se})),ro({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),x&&x.length>0&&{annotations:x}),w&&{rExtent:w}),ne.brushStreamProps),Object.fromEntries(Object.entries(O).filter(([e])=>"pieceStyle"!==e)));return e.jsx(zo,{componentName:"ViolinPlot",width:z,height:G,children:e.jsx(oo,Object.assign({ref:r},le))})});hi.displayName="ViolinPlot";const fi=t.forwardRef(function(n,o){var i;const r=To(n.mode,{width:n.width,height:n.height,showGrid:null===(i=n.showGrid)||void 0===i||i,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),s=t.useRef(null);si(o,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",valueFormat:f,colorBy:g,colorScheme:p,sort:y="auto",dotRadius:v=5,categoryPadding:b=10,tooltip:x,annotations:w,regression:k,valueExtent:j,frameProps:A={},selection:O,linkedHover:S,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:R,emptyContent:T,legendInteraction:$,legendPosition:I,color:B,stroke:H,strokeWidth:E,opacity:D,categoryFormat:F}=n,{width:N,height:W,enableHover:z,showGrid:G,showLegend:q,title:V,description:X,summary:Y,accessibleTable:Q,categoryLabel:Z,valueLabel:K}=r,U=t.useMemo(()=>m(a),[a]),J=Zo({data:U,rawData:a,colorBy:g,colorScheme:p,legendInteraction:$,legendPosition:I,selection:O,linkedHover:S,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"DotPlot",chartId:P,showLegend:q,userMargin:l,marginDefaults:r.marginDefaults,loading:L,loadingContent:R,emptyContent:T,width:N,height:W}),ee=Lo(U,y,d),te=Po(),ne=t.useMemo(()=>new Map,[U]),oe=Jo({colorBy:g,colorScale:J.colorScale,color:B,themeCategorical:te,colorScheme:p,categoryIndexMap:ne,userPieceStyle:null==A?void 0:A.pieceStyle,stroke:H,strokeWidth:E,opacity:D,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection,baseStyleExtras:{r:v,fillOpacity:.8}}),ie=t.useMemo(()=>Eo({categoryAccessor:u,valueAccessor:d,valueFormat:f}),[u,d,f]);if(J.earlyReturn)return J.earlyReturn;const re=Qo({componentName:"DotPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(re)return e.jsx(Do,{componentName:"DotPlot",message:re,width:N,height:W});const se=ei(k),ae=se?[se,...w||[]]:w,le=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:"point"},null!=a&&{data:ee}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:oe,size:[N,W],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:J.margin,barPadding:b,enableHover:z}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:r.showAxes,oLabel:Z,rLabel:K,rFormat:f}),F&&{oFormat:F}),{showGrid:G,oSort:y}),J.legendBehaviorProps),io({title:V,description:X,summary:Y,accessibleTable:Q,className:c,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),so({tooltip:x,defaultTooltipContent:ie})),ro({linkedHover:S,onObservation:M,onClick:C,hoverHighlight:_,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),ae&&ae.length>0&&{annotations:ae}),j&&{rExtent:j}),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return e.jsx(zo,{componentName:"DotPlot",width:N,height:W,children:e.jsx(oo,Object.assign({ref:s},le))})});fi.displayName="DotPlot";const gi=t.forwardRef(function(n,o){var i,r;const s=To(n.mode,{width:null!==(i=n.width)&&void 0!==i?i:400,height:null!==(r=n.height)&&void 0!==r?r:400,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:n.showCategoryTicks}),a=t.useRef(null),{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",colorBy:f,colorScheme:g,startAngle:p=0,cornerRadius:y,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:j,onClick:A,hoverHighlight:O,chartId:S,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:R,stroke:T,strokeWidth:$,opacity:I}=n,{width:B,height:H,enableHover:E,showLegend:D,title:F,description:N,summary:W,accessibleTable:z}=s,G=t.useMemo(()=>m(l),[l]),q=f||d,V=Zo({data:G,rawData:l,colorBy:q,colorScheme:g,legendInteraction:P,legendPosition:L,selection:w,linkedHover:k,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:O,chartType:"PieChart",chartId:S,showLegend:D,userMargin:c,marginDefaults:s.marginDefaults,loading:M,loadingContent:C,emptyContent:_,width:B,height:H}),X=Po(),Y=t.useMemo(()=>new Map,[G]),Q=Jo({colorBy:q,colorScale:V.colorScale,color:R,themeCategorical:X,colorScheme:g,categoryIndexMap:Y,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:T,strokeWidth:$,opacity:I,effectiveSelectionHook:V.effectiveSelectionHook,resolvedSelection:V.resolvedSelection,cycleByCategory:!0}),Z=t.useMemo(()=>Eo({categoryAccessor:d,valueAccessor:h,groupAccessor:f&&f!==d?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[d,h,f]),K=Qo({componentName:"PieChart",data:l,accessors:{categoryAccessor:d,valueAccessor:h}}),{effectiveLegendProps:U,effectiveMargin:J}=Ko({ref:o,frameRef:a,setup:V});if(V.earlyReturn)return V.earlyReturn;const 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({chartType:"pie"},null!=l&&{data:G}),{oAccessor:d,rAccessor:h,projection:"radial",pieceStyle:Q,startAngle:p}),null!=y&&{cornerRadius:y}),{size:[B,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:J,enableHover:E}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:!1}),U),io({title:F,description:N,summary:W,accessibleTable:z,className:u,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),so({tooltip:v,defaultTooltipContent:Z})),ro({linkedHover:k,onObservation:j,onClick:A,hoverHighlight:O,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return K?e.jsx(Do,{componentName:"PieChart",message:K,width:B,height:H}):e.jsx(zo,{componentName:"PieChart",width:B,height:H,children:e.jsx(oo,Object.assign({ref:a},ee))})});gi.displayName="PieChart";const mi=t.forwardRef(function(n,o){const i=To(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,linkedHover:n.linkedHover,showCategoryTicks:n.showCategoryTicks},{width:400,height:400}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",innerRadius:d,centerContent:h,colorBy:f,colorScheme:g,startAngle:p=0,cornerRadius:y,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:j,onClick:A,hoverHighlight:O,chartId:S,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:R,stroke:T,strokeWidth:$,opacity:I}=n,{width:B,height:H,enableHover:E,showLegend:D,title:F,description:N,summary:W,accessibleTable:z}=i,G=t.useMemo(()=>m(s),[s]),q=f||c,V=Zo({data:G,rawData:s,colorBy:q,colorScheme:g,legendInteraction:P,legendPosition:L,selection:w,linkedHover:k,fallbackFields:q?["string"==typeof q?q:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:O,chartType:"DonutChart",chartId:S,showLegend:D,userMargin:a,marginDefaults:i.marginDefaults,loading:M,loadingContent:C,emptyContent:_,width:B,height:H}),X=null!=d?d:Math.max(2,.15*Math.min(B,H)),Y=Po(),Q=t.useMemo(()=>new Map,[G]),Z=Jo({colorBy:q,colorScale:V.colorScale,color:R,themeCategorical:Y,colorScheme:g,categoryIndexMap:Q,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:T,strokeWidth:$,opacity:I,effectiveSelectionHook:V.effectiveSelectionHook,resolvedSelection:V.resolvedSelection,cycleByCategory:!0}),K=t.useMemo(()=>Eo({categoryAccessor:c,valueAccessor:u,groupAccessor:f&&f!==c?f:void 0,groupLabel:"string"==typeof f?f:"group",pieData:!0}),[c,u,f]),U=Qo({componentName:"DonutChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u}}),{effectiveLegendProps:J,effectiveMargin:ee}=Ko({ref:o,frameRef:r,setup:V});if(V.earlyReturn)return V.earlyReturn;const te=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:"donut"},null!=s&&{data:G}),{oAccessor:c,rAccessor:u,projection:"radial",pieceStyle:Z,innerRadius:X,startAngle:p}),null!=y&&{cornerRadius:y}),{centerContent:h,size:[B,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ee,enableHover:E}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:!1}),J),io({title:F,description:N,summary:W,accessibleTable:z,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),so({tooltip:v,defaultTooltipContent:K})),ro({linkedHover:k,onObservation:j,onClick:A,hoverHighlight:O,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior})),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return U?e.jsx(Do,{componentName:"DonutChart",message:U,width:B,height:H}):e.jsx(zo,{componentName:"DonutChart",width:B,height:H,children:e.jsx(oo,Object.assign({ref:r},te))})});function pi(e=240){const t=360-e,n=180+t/2,o=n*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:n,startAngleRad:o,offsetRad:-Math.PI/2+o}}function yi(e){return Math.max(0,Math.min(1,e))}function vi(e){const t=e.trim();if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),6===e.length&&/^[0-9a-f]{6}$/i.test(e))return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const n=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(n){const e=[Number(n[1]),Number(n[2]),Number(n[3])];if(e.every(Number.isFinite))return e}return null}function bi(e,t,n){const o=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function xi(e,t){const n=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:yi(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===n.length)return"#999999";if(1===n.length)return n[0].color;const o=yi(t);if(n[0].offset>=o)return n[0].color;if(o>=n[n.length-1].offset)return n[n.length-1].color;for(let e=0;n.length-1>e;e++){const t=n[e],i=n[e+1];if(t.offset>o||o>i.offset)continue;const r=i.offset-t.offset,s=r>0?(o-t.offset)/r:0,a=vi(t.color),l=vi(i.color);if(!a||!l)return.5>s?t.color:i.color;const[c,u,d]=a,[h,f,g]=l;return bi(c+(h-c)*s,u+(f-u)*s,d+(g-d)*s)}return n[n.length-1].color}function wi(e,t,n){return`${e}-${t}`}mi.displayName="DonutChart";const ki=t.forwardRef(function(n,o){const i=To(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:!1,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary},{width:300,height:250}),r=t.useRef(null),s="context"===n.mode,{compactMode:a}=i,{value:l,min:c=0,max:u=100,thresholds:d,gradientFill:h,color:f,backgroundColor:g="var(--semiotic-grid, #e0e0e0)",arcWidth:m=.3,cornerRadius:p,showNeedle:y=!0,needleColor:v="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:w=!a,sweep:k=240,fillZones:j=!0,tooltip:A,annotations:O,frameProps:S={},className:M,stroke:C,strokeWidth:_,opacity:P}=n,{width:L,height:R,title:T,description:$,summary:I,accessibleTable:B}=i,H=h&&"object"==typeof h?h:void 0,E=Math.max(c,Math.min(u,l)),D=u-c||1,F=(E-c)/D,{gaugeData:N,pieceStyle:W,gaugeAnnotations:z}=t.useMemo(()=>function(e){const{min:t,max:n,value:o,thresholds:i,fillColor:r,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=n-t||1,h=(Math.max(t,Math.min(n,o))-t)/d;let f=i&&i.length>0?[...i].sort((e,t)=>e.value-t.value):[{value:n,color:r||"#007bff"}];f=f.map(e=>Object.assign(Object.assign({},e),{value:Math.max(t,Math.min(n,e.value))})),n>f[f.length-1].value&&f.push({value:n,color:f[f.length-1].color});const g=!!c&&c.colorStops.length>=2,m=[],p=new Map,y=[];if(g){const e=a?h:1,t=wi("bg",0);if(m.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),p.set(t,{fill:s,opacity:.4}),e>0){const t=Math.max(1,Math.floor(u)),n=Math.max(1,Math.min(t,Math.round(e*t))),o=[];for(let t=0;n>t;t++)o.push(xi(c.colorStops,e*(t+.5)/n));const i=wi("fill",0);m.push({category:i,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:o}}),p.set(i,{fill:o[0]||s})}}else{let e=t;for(let n=0;f.length>n;n++){const o=f[n],i=(o.value-e)/d,r=(e-t)/d,l=(o.value-t)/d,c=Math.max(0,(a?Math.min(h,l):l)-r),u=a?Math.max(0,i-c):0;if(c>0){const e=wi("fill",n);m.push({category:e,value:c,_zone:o.label||"Zone "+(n+1),_isFill:!0}),p.set(e,{fill:o.color})}if(u>0){const e=wi("bg",n);m.push({category:e,value:u,_zone:o.label||"Zone "+(n+1),_isFill:!1}),p.set(e,{fill:s,opacity:.4})}e=o.value}}if(l&&i&&i.length>0)for(const e of i)e.value>t&&n>e.value&&y.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:m,pieceStyle:(e,t)=>p.get(t||e.category)||{fill:s},gaugeAnnotations:y}}({min:c,max:u,value:l,thresholds:d,fillColor:f,backgroundColor:g,fillZones:j,showScaleLabels:w,gradientFill:H}),[l,c,u,d,f,g,w,j,H]),G=t.useMemo(()=>Uo(W,{stroke:C,strokeWidth:_,opacity:P}),[W,C,_,P]),{sweepRad:q,startAngleDeg:V}=pi(k),X=function(e=240){const{sweepRad:t,offsetRad:n}=pi(e),o=[[Math.cos(n),Math.sin(n)],[Math.cos(n+t),Math.sin(n+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-n)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||o.push([Math.cos(e),Math.sin(e)]);const i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.min(...i),a=Math.max(...i),l=Math.min(...r),c=Math.max(...r);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(k),Y=Math.min(10,Math.max(1,Math.min(L,R)/12)),Q=X.cx,Z=X.cy,K=Math.max(4,Math.min((L-2*Y)/X.width,(R-2*Y)/X.height)-2),U=Math.max(0,Math.min(K-1.5,K*(1-m))),J=L/2-Q*K,ee=R/2-Z*K,te=2*(K+4),ne=t.useMemo(()=>{if(a&&null==b)return null;if(null!=b)return"function"==typeof b?b(E,c,u):b;const t=x?x(E):Math.round(E)+"";return e.jsxs("div",{style:{textAlign:"center",lineHeight:1.2},children:[e.jsx("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"},children:t}),w&&e.jsxs("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[c," – ",u]})]})},[b,E,c,u,x,w,K,a]),oe=t.useMemo(()=>s&&null==b?{type:"gauge-value",text:x?x(E):Math.round(E)+""}:null,[s,b,E,x]),ie=t.useMemo(()=>{if(!y)return null;const e=-Math.PI/2+V*Math.PI/180+F*q,t=U>20?U-8:K-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:v}},[y,F,V,q,U,v]),re=t.useMemo(()=>(t,n,o)=>{if("gauge-needle"===t.type){const i=(o.width||L)/2,r=(o.height||R)/2,s=Math.max(1,K-U),a=Math.max(1,Math.min(2.5,.4*s)),l=Math.max(1,Math.min(5,.6*s));return e.jsxs("g",{transform:`translate(${i},${r})`,children:[e.jsx("line",{x1:0,y1:0,x2:t.tipX,y2:t.tipY,stroke:t.color,strokeWidth:a,strokeLinecap:"round"}),e.jsx("circle",{cx:0,cy:0,r:l,fill:t.color})]},"gauge-needle-"+n)}if("gauge-label"===t.type){const i=-Math.PI/2+V*Math.PI/180+(t.value-c)/D*q,r=(o.width||L)/2,s=(o.height||R)/2,a=U-1,l=K+1,u=Math.cos(i)*a,d=Math.sin(i)*a,h=Math.cos(i)*l,f=Math.sin(i)*l,g=K+10,m=Math.cos(i)*g,p=Math.sin(i)*g,y=((i+Math.PI/2)/(2*Math.PI)*12+12)%12;let v="middle",b="middle";return y>=11||1>y?(v="middle",b="auto"):y>=1&&5>y?(v="start",b="middle"):y>=5&&7>y?(v="middle",b="hanging"):(v="end",b="middle"),e.jsxs("g",{transform:`translate(${r},${s})`,children:[e.jsx("line",{x1:u,y1:d,x2:h,y2:f,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),e.jsx("text",{x:m,y:p,textAnchor:v,dominantBaseline:b,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:t.label})]},"gauge-label-"+n)}return"gauge-value"===t.type?e.jsx("text",{x:(o.width||L)/2,y:(o.height||R)/2-.2*U,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*K)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:t.text},"gauge-value-"+n):null},[L,R,c,D,V,q,U,K]),se=t.useMemo(()=>{const e=[...z,...O||[]];return ie&&e.push(ie),oe&&e.push(oe),e},[z,O,ie,oe]),ae=t.useMemo(()=>t=>{var n;const o=(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n[0])||(null==t?void 0:t.data)||t,i=null==o?void 0:o._isFill;return e.jsxs("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[e.jsx("div",{style:{fontWeight:600},children:(null==o?void 0:o._zone)||""}),e.jsx("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:i?"Current: "+Math.round(E):"Remaining"})]})},[E]);if(0===N.length)return e.jsx(Do,{componentName:"GaugeChart",message:"No data to display",width:L,height:R});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:N,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:G,innerRadius:U,startAngle:V,sweepAngle:k},null!=p&&{cornerRadius:p}),{centerContent:ne,size:[L,R],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:{top:ee-te/2,bottom:R-ee-te/2,left:J-te/2,right:L-J-te/2},enableHover:i.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===A?()=>null:an(A)||ae,svgAnnotationRules:re}),se.length>0&&{annotations:se}),T&&{title:T}),$&&{description:$}),I&&{summary:I}),void 0!==B&&{accessibleTable:B}),M&&{className:M}),null!=n.animate&&{animate:n.animate}),S);return e.jsx(zo,{componentName:"GaugeChart",width:L,height:R,children:e.jsx(oo,Object.assign({ref:r},le))})});ki.displayName="GaugeChart";const ji=t.forwardRef(function(n,o){const i=To(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null);si(o,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="horizontal",bins:h=20,amplitude:f=1.5,valueFormat:g,colorBy:p,colorScheme:y,categoryPadding:v=5,tooltip:b,annotations:x,valueExtent:w,frameProps:k={},selection:j,linkedHover:A,onObservation:O,onClick:S,hoverHighlight:M,chartId:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:R,legendPosition:T,color:$,stroke:I,strokeWidth:B,opacity:H,showCategoryTicks:E,categoryFormat:D}=n,{width:F,height:N,enableHover:W,showGrid:z,showLegend:G,title:q,description:V,summary:X,accessibleTable:Y,categoryLabel:Q,valueLabel:Z}=i,K=t.useMemo(()=>m(s),[s]),U=Zo({data:K,rawData:s,colorBy:p,colorScheme:y,legendInteraction:R,legendPosition:T,selection:j,linkedHover:A,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:O,onClick:S,hoverHighlight:M,chartType:"RidgelinePlot",chartId:C,showLegend:G,userMargin:a,marginDefaults:i.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:F,height:N}),J=Po(),ee=t.useMemo(()=>new Map,[K]),te=Jo({colorBy:p,colorScale:U.colorScale,color:$,themeCategorical:J,colorScheme:y,categoryIndexMap:ee,userPieceStyle:void 0,stroke:I,strokeWidth:B,opacity:H,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ne=t.useMemo(()=>li(),[]);if(U.earlyReturn)return U.earlyReturn;const oe=Qo({componentName:"RidgelinePlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(oe)return e.jsx(Do,{componentName:"RidgelinePlot",message:oe,width:F,height:N});const ie=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:"ridgeline"},null!=s&&{data:K}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:te,bins:h,size:[F,N],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:U.margin,barPadding:v,enableHover:W}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Q,rLabel:Z,rFormat:g}),D&&{oFormat:D}),{showGrid:z,showCategoryTicks:E,oSort:!1,amplitude:f}),U.legendBehaviorProps),io({title:q,description:V,summary:X,accessibleTable:Y,className:l,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),so({tooltip:b,defaultTooltipContent:ne})),ro({linkedHover:A,onObservation:O,onClick:S,hoverHighlight:M,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior})),x&&x.length>0&&{annotations:x}),w&&{rExtent:w}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return e.jsx(zo,{componentName:"RidgelinePlot",width:F,height:N,children:e.jsx(oo,Object.assign({ref:r},ie))})});ji.displayName="RidgelinePlot";const Ai=t.forwardRef(function(n,o){const i=To(n.mode,{width:n.width,height:n.height,showGrid:!1,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,showCategoryTicks:!1}),r=t.useRef(null);si(o,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,stepAccessor:c="step",valueAccessor:u="value",categoryAccessor:d,colorBy:h,colorScheme:f,orientation:g="horizontal",connectorOpacity:p=.3,showLabels:y=!0,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:j,onClick:A,hoverHighlight:O,chartId:S,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:R,stroke:T,strokeWidth:$,opacity:I,categoryFormat:B}=n,H="vertical"===g,{width:E,height:D,enableHover:F,showLegend:N,title:W,description:z,summary:G,accessibleTable:q}=i,V=H?{top:W?60:40,right:20,bottom:60,left:60}:{top:W?40:10,right:10,bottom:10,left:10},X=t.useMemo(()=>m(s),[s]),Y=h||d,Q=!Y,Z=Zo({data:X,rawData:s,colorBy:Y,colorScheme:f,legendInteraction:P,legendPosition:L,selection:w,linkedHover:k,fallbackFields:Y?["string"==typeof Y?Y:""]:[],unwrapData:!0,onObservation:j,onClick:A,hoverHighlight:O,chartType:"FunnelChart",chartId:S,showLegend:N,userMargin:a,marginDefaults:V,loading:M,loadingContent:C,emptyContent:_,width:E,height:D});Vo("FunnelChart",X,"stepAccessor",c),Vo("FunnelChart",X,"valueAccessor",u);const K=Po(),U=t.useMemo(()=>new Map,[X]),J=t.useMemo(()=>{if(Q)return R||((null==K?void 0:K[0])?K[0]:Array.isArray(f)&&f[0]?f[0]:"#4e79a7")},[Q,R,K,f]),ee=Jo({colorBy:J?void 0:Y,colorScale:Z.colorScale,color:null!=J?J:R,themeCategorical:K,colorScheme:f,categoryIndexMap:U,userPieceStyle:null==x?void 0:x.pieceStyle,stroke:T,strokeWidth:$,opacity:I,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection}),te=t.useMemo(()=>t=>{var n,o,i,r,s,a;const l=(null==t?void 0:t.data)||t,c=(null==l?void 0:l.__funnelStep)||(null==l?void 0:l.__barFunnelStep)||(null==l?void 0:l.step)||"",u=null!==(i=null!==(o=null!==(n=null==l?void 0:l.__funnelValue)&&void 0!==n?n:null==l?void 0:l.__barFunnelValue)&&void 0!==o?o:null==l?void 0:l.value)&&void 0!==i?i:"",d=null!==(r=null==l?void 0:l.__funnelPercent)&&void 0!==r?r:null==l?void 0:l.__barFunnelPercent,h=null!==(s=null==l?void 0:l.__funnelIsFirstStep)&&void 0!==s?s:null==l?void 0:l.__barFunnelIsFirstStep,f=null==l?void 0:l.__barFunnelIsDropoff,g=null!==(a=null==l?void 0:l.__barFunnelCategory)&&void 0!==a?a:null==l?void 0:l.category,m=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return e.jsxs("div",{className:"semiotic-tooltip",style:nn,children:[c&&e.jsx("div",{style:{fontWeight:"bold"},children:c+""}),g&&g!==c&&e.jsx("div",{style:{marginTop:2,opacity:.8},children:g+""}),f&&e.jsx("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),e.jsxs("div",{style:{marginTop:4},children:[u+"",m]})]})},[]);if(Z.earlyReturn)return Z.earlyReturn;const ne=Qo({componentName:"FunnelChart",data:s,accessors:{stepAccessor:c,valueAccessor:u}});if(ne)return e.jsx(Do,{componentName:"FunnelChart",message:ne,width:E,height:D});const oe=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:H?"bar-funnel":"funnel"},null!=s&&{data:X}),{oAccessor:c,rAccessor:u}),d&&{stackBy:d}),{projection:H?"vertical":"horizontal",barPadding:H?40:0,pieceStyle:ee,size:[E,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Z.margin,enableHover:F}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:H,showCategoryTicks:H}),B&&{oFormat:B}),{showGrid:H}),!H&&{connectorOpacity:p}),{showLabels:y}),Z.legendBehaviorProps),W&&{title:W}),z&&{description:z}),G&&{summary:G}),void 0!==q&&{accessibleTable:q}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===v?()=>null:!0===v||null==v?te:an(v)||te}),(k||j||A||O)&&{customHoverBehavior:Z.customHoverBehavior}),(j||A||k)&&{customClickBehavior:Z.customClickBehavior}),b&&b.length>0&&{annotations:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return e.jsx(zo,{componentName:"FunnelChart",width:E,height:D,children:e.jsx(oo,Object.assign({ref:r},oe))})});Ai.displayName="FunnelChart";const Oi={RdBu:$,PiYG:I,PRGn:B,BrBG:H,RdYlBu:E,RdYlGn:D,Spectral:F},Si="__likert_neutral_neg",Mi="__likert_neutral_pos";function Ci(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function _i(e,t,n,o,i,r){const s=new Map,a=new Set(t);for(const l of e){const e=n(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(o){const e=o(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const n=e-1;if(0>n||n>=t.length)continue;const i=t[n];c.set(i,(c.get(i)||0)+1)}else if(i&&r){const e=i(l),t=r(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,n]of s){let o=0;for(const e of t)o+=n.get(e)||0;if(0!==o)for(let i=0;t.length>i;i++){const r=t[i],s=n.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:s,__likertPct:s/o*100,__likertLevelIndex:i})}}return l}function Pi(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(o&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:Si,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:Mi,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function Li(e,t){const n=t.length,o=n%2!=0,i=Math.floor(n/2),r=new Map;for(const t of e){const e=r.get(t.__likertCategory)||[];e.push(t),r.set(t.__likertCategory,e)}const s=[];for(const[,e]of r){const t=new Map;let r,a;for(const n of e)n.__likertLevel===Si?r=n:n.__likertLevel===Mi?a=n:t.set(n.__likertLevelIndex,n);o&&r&&s.push(r);for(let e=i-1;e>=0;e--){const n=t.get(e);n&&s.push(n)}o&&a&&s.push(a);for(let e=o?i+1:i;n>e;e++){const n=t.get(e);n&&s.push(n)}}return s}const Ri=["Very Low","Low","Neutral","High","Very High"],Ti=new Map,$i=t.forwardRef(function(n,o){const i=To(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel,showCategoryTicks:n.showCategoryTicks,orientation:n.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="question",valueAccessor:u,levelAccessor:d,countAccessor:f="count",levels:g=Ri,orientation:m="horizontal",colorScheme:p,barPadding:y=20,tooltip:v,annotations:b,valueExtent:x,frameProps:w={},selection:k,linkedHover:j,onObservation:A,onClick:O,hoverHighlight:S,chartId:M,valueFormat:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:R,legendPosition:T,categoryFormat:$,stroke:I,strokeWidth:B,opacity:H}=n,{width:E,height:D,enableHover:F,showGrid:N,showLegend:W,title:G,description:X,summary:Y,accessibleTable:Q,categoryLabel:Z,valueLabel:K}=i,U="horizontal"===m,J=void 0===s,ee=!d,te=function(){var e;const t=Mo();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),ne=t.useMemo(()=>p&&Array.isArray(p)&&p.length>=g.length?p:function(e,t){if(0>=e)return[];if(t){const n=Oi[t];if(n){if(1===e)return[n(.5)];const t=[];for(let o=0;e>o;o++)t.push(n(o/(e-1)));return t}}const n=["#da1e28","#ff8389","#ffb3b8"],o=["#a6c8ff","#4589ff","#0043ce"],i="#a8a8a8";if(1===e)return[i];const r=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);r&&a.push(i);for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);return a}(g.length,te),[p,g.length,te]),oe=t.useMemo(()=>{const e=new Map;for(let t=0;g.length>t;t++)e.set(g[t],ne[t]||"#888");return e},[g,ne]),{processedData:ie,reAggregate:re,accumulatorRef:se}=function({data:e,levels:n,categoryAccessor:o,valueAccessor:i,levelAccessor:r,countAccessor:s,isDiverging:a,frameRef:l}){const c=!r,u=t.useMemo(()=>Ci(o,"question"),[o]),d=t.useMemo(()=>c?Ci(i,"score"):null,[c,i]),h=t.useMemo(()=>c?null:Ci(r,"level"),[c,r]),f=t.useMemo(()=>c?null:Ci(s,"count"),[c,s]),g=e||[],m=t.useRef([]),p=t.useMemo(()=>{if(0===g.length)return[];let e=_i(g,n,u,d,h,f);return a&&(e=Pi(e,n),e=Li(e,n)),e},[g,n,u,d,h,f,a]),y=t.useCallback(e=>{var t;let o=_i(e,n,u,d,h,f);a&&(o=Pi(o,n),o=Li(o,n)),null===(t=l.current)||void 0===t||t.replace(o)},[n,u,d,h,f,a,l]);return{processedData:p,reAggregate:y,accumulatorRef:m}}({data:s,levels:g,categoryAccessor:c,valueAccessor:u,levelAccessor:d,countAccessor:f,isDiverging:U,frameRef:r}),ae="__likertLevelLabel",le=function({isPushMode:e,colorBy:n,colorScheme:o,showLegend:i,legendPosition:r="right"}){const s=t.useRef(new Set),a=t.useRef([]),[l,c]=t.useState(0),u=lo(),d=Po(),h=t.useCallback(e=>{const t=e[n];return null!=t?t+"":null},[n]),f=t.useCallback(t=>{if(!e||!n)return;let o=!1;for(const e of t){if(!e||"object"!=typeof e)continue;const t=h(e);null==t||s.current.has(t)||(s.current.add(t),a.current.push(t),o=!0)}o&&c(e=>e+1)},[e,n,h]),g=t.useCallback(t=>{if(!e||!n)return;const o=Array.from(new Set(t.map(String))),i=a.current;i.length===o.length&&i.every((e,t)=>e===o[t])||(s.current=new Set(o),a.current=o,c(e=>e+1))},[e,n]),m=t.useCallback(e=>t=>{f([t]),e(t)},[f]),p=t.useCallback(e=>t=>{f(t),e(t)},[f]),y=t.useCallback(()=>{s.current=new Set,a.current=[],c(e=>e+1)},[]);Oo(e&&n?a.current:[]);const v=t.useMemo(()=>{if(!e||!n||!1===i)return;const t=a.current;if(0===t.length)return;const r=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:d&&d.length>0?d:z,s=n,l=t.map(e=>({[s]:e})),c=V(l,s,r);return So({data:l,colorBy:s,colorScale:e=>(null==u?void 0:u[e])||c(e)||"#999",getColor:q})},[e,n,i,o,u,d,l]),b=t.useMemo(()=>{if(v)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[v,r]);return{wrapPush:m,wrapPushMany:p,resetCategories:y,categories:a.current,categoryDomainProps:e&&n?{legendCategoryAccessor:n,onCategoriesChange:g}:{},streamingLegend:v,streamingMarginAdjust:b}}({isPushMode:J,colorBy:ae,colorScheme:ne,showLegend:W,legendPosition:T}),ce=t.useCallback(le.wrapPush(e=>{se.current.push(e),re(se.current)}),[le.wrapPush,re,se]),ue=t.useCallback(le.wrapPushMany(e=>{se.current.push(...e),re(se.current)}),[le.wrapPushMany,re,se]);t.useImperativeHandle(o,()=>({push:ce,pushMany:ue,remove:e=>{var t,n;return null!==(n=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=r.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;se.current=[],le.resetCategories(),null===(e=r.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[ce,ue,le.resetCategories,se]);const de=Zo({data:ie,rawData:s,colorBy:ae,colorScheme:ne,legendInteraction:R,legendPosition:T,selection:k,linkedHover:j,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:A,onClick:O,hoverHighlight:S,chartType:"LikertChart",chartId:M,showLegend:W,userMargin:a,marginDefaults:i.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:E,height:D}),he=t.useMemo(()=>{const e=g.length;return e%2!=0&&oe.get(g[Math.floor(e/2)])||"#888"},[g,oe]),fe=Jo({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:Ti,userPieceStyle:null==w?void 0:w.pieceStyle,stroke:I,strokeWidth:B,opacity:H,effectiveSelectionHook:de.effectiveSelectionHook,resolvedSelection:de.resolvedSelection,baseStyleExtras:e=>{var t,n;const o=e.__likertLevelLabel||(null===(t=e.data)||void 0===t?void 0:t.__likertLevelLabel),i=e.__likertLevel||(null===(n=e.data)||void 0===n?void 0:n.__likertLevel);if(i===Si||i===Mi)return{fill:he};const r=o||i;return r&&oe.has(r)?{fill:oe.get(r)}:{fill:"#888"}}}),ge=t.useMemo(()=>{const e=g.length;return e%2!=0?g[Math.floor(e/2)]:""},[g]),me=t.useMemo(()=>e=>{const t=e.data||e,n=t.__likertLevel||"Unknown",o=n===Si||n===Mi?ge:n,i=t.__likertCategory||"",r=Math.abs(t.__likertPct||0),s=n===Si||n===Mi?2*r:r,a=t.__likertCount||0;return h.createElement("div",{className:"semiotic-tooltip",style:nn},h.createElement("div",{style:{fontWeight:"bold"}},i),h.createElement("div",{style:{marginTop:4}},`${o}: ${s.toFixed(1)}% (n=${a})`))},[ge]),pe=t.useMemo(()=>{if(!g||2>g.length)return"LikertChart requires `levels` with at least 2 entries.";if(u&&d)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(d&&!f)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==s&&0===s.length)return null;const e={categoryAccessor:c};return ee?u&&(e.valueAccessor=u):(d&&(e.levelAccessor=d),f&&(e.countAccessor=f)),Qo({componentName:"LikertChart",data:s,accessors:e,requiredProps:{levels:g}})},[s,c,u,d,f,g,ee]),ye=t.useMemo(()=>[{styleFn:e=>({fill:oe.get(e.label)||"#888"}),items:g.map(e=>({label:e})),label:""}],[g,oe]),ve=t.useMemo(()=>!1!==W?Object.assign(Object.assign({},de.legendBehaviorProps),{legend:{legendGroups:ye},legendPosition:T||de.legendPosition||"bottom"}):de.legendBehaviorProps,[de.legendBehaviorProps,de.legendPosition,T,W,ye]),be=t.useMemo(()=>{const e=Object.assign({},de.margin);if(J&&!1!==W){const t=T||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(le.streamingMarginAdjust)for(const[t,n]of Object.entries(le.streamingMarginAdjust))n>e[t]&&(e[t]=n);return U&&100>e.left&&(e.left=100),e},[de.margin,le.streamingMarginAdjust,U,J,W,T]),xe=t.useMemo(()=>C||(U?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[U,C]);if(de.earlyReturn)return de.earlyReturn;const we=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:"bar"},null!=s&&{data:ie}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:U?"horizontal":"vertical",pieceStyle:fe,size:[E,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:be,barPadding:y,enableHover:F}),n.dataIdAccessor&&{dataIdAccessor:n.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Z,rLabel:K||(U?void 0:"Percentage"),rFormat:xe}),$&&{oFormat:$}),{showGrid:N}),ve),G&&{title:G}),X&&{description:X}),Y&&{summary:Y}),void 0!==Q&&{accessibleTable:Q}),l&&{className:l}),null!=n.animate&&{animate:n.animate}),void 0!==n.axisExtent&&{axisExtent:n.axisExtent}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),{tooltipContent:!1===v?()=>null:!0===v?me:an(v)||me}),(j||A||O||S)&&{customHoverBehavior:de.customHoverBehavior}),(A||O||j)&&{customClickBehavior:de.customClickBehavior}),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return pe?e.jsx(Do,{componentName:"LikertChart",message:pe,width:E,height:D}):e.jsx(zo,{componentName:"LikertChart",width:E,height:D,children:e.jsx(oo,Object.assign({ref:r},we))})});$i.displayName="LikertChart";const Ii=t.forwardRef(function(n,o){const{data:i,layout:r,layoutConfig:s,categoryAccessor:a="category",valueAccessor:l="value",oExtent:c,rExtent:u,projection:d="vertical",margin:h,className:f,colorScheme:g,showAxes:m=!1,annotations:p,onObservation:y,onClick:v,selection:b,linkedHover:x,chartId:w,loading:k,loadingContent:j,emptyContent:A,frameProps:O={}}=n,{frameRef:S,resolved:M,safeData:C,setup:_,earlyReturn:P}=function(e){var n;const o=function(e){const n=t.useRef(null);return si(e.imperativeRef,{variant:e.imperativeVariant,frameRef:n}),{frameRef:n,resolved:To(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(()=>function(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}(e.margin),[e.margin])}}(e),{resolved:i,normalizedMargin:r}=o,s=Zo({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:r,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:s.data,setup:s,earlyReturn:s.earlyReturn})}({imperativeRef:o,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:i,colorScheme:g,selection:b,linkedHover:x,onObservation:y,onClick:v,chartId:w,loading:k,loadingContent:j,emptyContent:A,margin:h,width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,title:n.title,mode:n.mode});if(P)return P;const{width:L,height:R,enableHover:T,showGrid:$,title:I,description:B,summary:H,accessibleTable:E}=M,D=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=i&&{data:C}),{customLayout:r,layoutConfig:s,oAccessor:a,rAccessor:l,oExtent:c,rExtent:u,projection:d,colorScheme:g,size:[L,R],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:_.margin,enableHover:T,showAxes:m,showGrid:$,annotations:p}),io({title:I,description:B,summary:H,accessibleTable:E,className:f,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),ro({linkedHover:x,onObservation:y,onClick:v,hoverHighlight:!1,customHoverBehavior:_.customHoverBehavior,customClickBehavior:_.customClickBehavior})),O);return e.jsx(zo,{componentName:"OrdinalCustomChart",width:L,height:R,children:e.jsx(oo,Object.assign({ref:S},D))})});Ii.displayName="OrdinalCustomChart",exports.BarChart=ti,exports.BoxPlot=ci,exports.DonutChart=mi,exports.DotPlot=fi,exports.FunnelChart=Ai,exports.GaugeChart=ki,exports.GroupedBarChart=oi,exports.Histogram=di,exports.LikertChart=$i,exports.OrdinalCustomChart=Ii,exports.PieChart=gi,exports.RidgelinePlot=ji,exports.StackedBarChart=ni,exports.StreamOrdinalFrame=oo,exports.SwarmPlot=ai,exports.SwimlaneChart=ri,exports.ViolinPlot=hi,exports.createHatchPattern=Vn;
|
|
2
|
+
"use strict";var e,t=Object.create,o=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,a=(e,t,i,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of r(t))s.call(e,l)||l===i||o(e,l,{get:()=>t[l],enumerable:!(a=n(t,l))||a.enumerable});return e},l=(e,n,r)=>(r=null!=e?t(i(e)):{},a(!n&&e&&e.__esModule?r:o(r,"default",{value:e,enumerable:!0}),e)),c={};((e,t)=>{for(var n in t)o(e,n,{get:t[n],enumerable:!0})})(c,{BarChart:()=>As,BoxPlot:()=>Gs,DEFAULT_HIT_RADIUS:()=>Wa,DonutChart:()=>aa,DotPlot:()=>ta,FunnelChart:()=>ka,GaugeChart:()=>ya,GroupedBarChart:()=>Rs,Histogram:()=>Ks,LikertChart:()=>Oa,OrdinalCustomChart:()=>Na,PieChart:()=>ra,RidgelinePlot:()=>va,StackedBarChart:()=>js,StreamOrdinalFrame:()=>ni,SwarmPlot:()=>Fs,SwimlaneChart:()=>Bs,ViolinPlot:()=>Us,createHatchPattern:()=>Wr,glyphExtent:()=>qe,glyphPlacement:()=>We,hitTargetPoint:()=>Ga,hitTargetRect:()=>Va,resolveResponsiveRules:()=>Ei,responsiveRuleMatches:()=>Oi,useCustomLayoutSelection:()=>He}),module.exports=(e=c,a(o({},"__esModule",{value:!0}),e));var u=require("react"),d=Object.freeze([]);function h(e){if(!e)return d;let t=!1;for(let o=0;e.length>o;o++){const n=e[o];if(null==n||"object"!=typeof n){t=!0;break}}if(!t)return e;const o=[];for(const t of e)null!=t&&"object"==typeof t&&o.push(t);return o}var f=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=h(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 o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}setReplacementData(e){if(e=h(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 o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}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 o=0;e.length>o;o++){const n=e[o];null!=n&&"object"==typeof n&&(this.pushBuffer.push(n),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}},g=require("d3-scale"),m=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 o of e){const e=this.push(o);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 o=0;this._size>o;o++)e(this.buffer[(t+o)%this._capacity],o)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e[o]=this.buffer[(t+o)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray();let o=0,n=[];t.length>e&&(o=t.length-e,n=t.slice(0,o)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=o;t.length>e;e++)this.push(t[e]);return n}update(e,t){const o=[],n=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(n+r)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:{...s},o.push(e),this.buffer[i]=t(s)}}return o}remove(e){const t=[],o=[];if(this.forEach(n=>{e(n)?o.push(n):t.push(n)}),0===o.length)return o;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return o}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}},y=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 o of e){const e=t?t(o):o;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 p(e,t,o){const n=e.duration??500,r=o-t;return n>r?1-r/n:0}function b(e,t,o,n){let r=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,r=!0),e._pulseColor!==o&&(e._pulseColor=o,r=!0),e._pulseGlowRadius!==n&&(e._pulseGlowRadius=n,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 v(e,t,o){return e+(t-e)*o}function x(){return"undefined"!=typeof performance?performance.now():Date.now()}function w(e,t){return e===t}function k(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function S(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function A(e){return new Set(Array.isArray(e)?e:[e])}var M=require("d3-scale");function C(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function j(e,t,o){const n=e=>e.toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function _(e){const t=e.map(C),o=t.length-1;return e=>{if(0>=e){const[e,o,n]=t[0];return j(e,o,n)}if(e>=1){const[e,n,r]=t[o];return j(e,n,r)}const n=e*o,r=Math.floor(n),i=n-r,[s,a,l]=t[r],[c,u,d]=t[r+1];return j(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(d-l)*i))}}var P=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],R=_(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),L=_(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),I=_(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),T=_(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),$=_(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),B=_(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),H={blues:R,reds:L,greens:I,viridis:_(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),oranges:T,purples:$,greys:B,plasma:_(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),inferno:_(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),magma:_(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),cividis:_(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),turbo:_(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"])},O=_(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),E=_(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),D=_(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),F=_(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),N=_(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),z=_(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),W=_(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),q={category10:P,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...H},G=P,V=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],X=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 Y(e,t,o){if("function"==typeof t){const n=t(e);return o&&n&&"string"==typeof n&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||X.has(t)}(n)?o(n):n}const n=e?.[t]+"";return o?o(n):G[Math.abs(function(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o),t&=t;return Math.abs(t)}(n))%G.length]}function K(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const o=e[t];return"string"==typeof o&&o.length>0?o:void 0}function Z(e,t,o="category10"){if(o&&"object"==typeof o&&!Array.isArray(o)){const e=o;return t=>K(e,t)??"#999"}const n=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),r=n.every(e=>!isNaN(Number(e)));if(Array.isArray(o))return(0,M.scaleOrdinal)().domain(n).range(o).unknown("#999");const i=q[o]||q.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of n){const o=Number(t);o>e&&(e=o)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:G;return(0,M.scaleOrdinal)().domain(n).range(e).unknown("#999")}}function Q(e,t,o=[3,20],n){let r;if(r="function"==typeof t?t(e):e?.[t],!n)return r;const[i,s]=n,[a,l]=o;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 U(e,t,o,n,r,i,s){return{type:"rect",x:e,y:t,w:o,h:n,style:r,datum:i,group:s}}var J=require("d3-shape"),ee={circle:J.symbolCircle,square:J.symbolSquare,triangle:J.symbolTriangle,diamond:J.symbolDiamond,star:J.symbolStar,cross:J.symbolCross,wye:J.symbolWye},te=["circle","triangle","diamond","star","square","chevron","cross","wye"];function oe(e,t,o){if(o)return o;const n=e??"circle";return"chevron"===n?function(e){const t=1.5*ne(e),o=.92*t;return`M0,${-t}L${o},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-o},${(.78*t).toFixed(3)}Z`}(t):(0,J.symbol)(ee[n]??J.symbolCircle,Math.max(1,t))()??""}function ne(e){return Math.sqrt(Math.max(1,e)/Math.PI)}function re(e){const t=e.getSymbol;if(!t)return null;const o=e.config.symbolMap,n=new Map;let r=0;return e=>{const i=t(e)+"",s=o?.[i];if(s)return s;let a=n.get(i);return a||(a=te[r%te.length],r++,n.set(i,a)),a}}function ie(e,t,o,n,r,i,s){e.push(t?{type:"symbol",x:n,y:r,size:Math.PI*i*i,symbolType:t(o),style:s,datum:o}:{type:"point",x:n,y:r,r:i,style:s,datum:o})}function se(e,t){const{columns:o,config:n,resolvePieceStyle:r}=e,i=[],s=Math.min(t.width,t.height)/2-4,a="donut"===n.chartType?n.innerRadius||60:0,l=-Math.PI/2+(n.startAngle||0)*Math.PI/180,c=null!=n.sweepAngle?n.sweepAngle*Math.PI/180:2*Math.PI,u=null!=n.sweepAngle&&360>n.sweepAngle,d=Object.values(o),h=d.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),f=u&&!h&&d.length>1&&(n.cornerRadius??0)>0;for(let e=0;d.length>e;e++){const t=d[e],o=t.pieceData[0],u="number"==typeof o?._pctStart?o._pctStart:t.pctStart,h=l+u*c,g=l+(u+("number"==typeof o?._pct?o._pct:t.pct))*c,m=r(t.pieceData[0],t.name),y=0===e,p=e===d.length-1,b={type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:h,endAngle:g,...n.cornerRadius&&{cornerRadius:n.cornerRadius},style:m,datum:o?._nonInteractive?null:t.pieceData,category:t.name};o?._roundedEnds?b.roundedEnds=o._roundedEnds:f&&(b.roundedEnds={start:y,end:p}),o?._gradientBand&&(b._gradientBand=o._gradientBand),i.push(b)}return i}var ae=require("d3-array");function le(e){let t=1/0,o=-1/0;for(const n of e)t>n&&(t=n),n>o&&(o=n);return[t,o]}function ce(e,t=-1/0){let o=t;for(const t of e)t>o&&(o=t);return o}function ue(e){const t=e.length,o=e[0],n=e[t-1];return{n:t,min:o,q1:(0,ae.quantile)(e,.25)??o,median:(0,ae.quantile)(e,.5)??(o+n)/2,q3:(0,ae.quantile)(e,.75)??n,max:n,mean:e.reduce((e,t)=>e+t,0)/t}}var de=require("d3-scale"),he={bar:function(e,t){const{scales:o,columns:n,config:r,getR:i,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h="horizontal"===c,f=r.normalize,g=[];if(s){const e=new Set;for(const t of Object.values(n))for(const o of t.pieceData){const t=s(o);e.has(t)||(e.add(t),g.push(t))}}else g.push("_default");for(const e of Object.values(n)){const t=new Map;for(const o of e.pieceData){const e=s?s(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const n=t.get(e);n.total+=i(o),n.pieces.push(o)}let o=0;if(f)for(const e of t.values())o+=Math.abs(e.total);let n=0,r=0;for(const i of g){const c=t.get(i);if(!c)continue;let g=c.total;f&&o>0&&(g/=o);const m=a(c.pieces[0],s?i:e.name),y={...c.pieces[0],__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name};if(d){const t=l(0>g?r:n+g),o=0>g?l(r+g)-l(r):l(n)-l(n+g);u.push(U(e.x,t,e.width,Math.abs(o),m,y,i)),0>g?r+=g:n+=g}else if(h){const t=l(0>g?r+g:n),o=0>g?l(r)-l(r+g):l(n+g)-l(n);u.push(U(t,e.x,Math.abs(o),e.width,m,y,i)),0>g?r+=g:n+=g}}}const m="vertical"===c,y=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;const t=e.datum?.__aggregateValue??0;e.roundedEdge=m?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}if(y>0){const e=new Map;for(const t of u){if("rect"!==t.type)continue;const o=t.datum?.category||"";e.has(o)||e.set(o,[]),e.get(o).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>(e.datum?.__aggregateValue??0)>=0),o=t.filter(e=>0>(e.datum?.__aggregateValue??0));e.length>0&&(e.reduce(m?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=y),o.length>0&&(o.reduce(m?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=y)}}return u},clusterbar:function(e,t){const{scales:o,columns:n,config:r,getR:i,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h=[],f=new Set;for(const e of Object.values(n))for(const t of e.pieceData){const e=s?s(t):"_default";f.has(e)||(f.add(e),h.push(e))}const g=h.length||1;for(const e of Object.values(n)){const t=e.width/g,o=.2*t,n=t-o,r=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";r.has(e)||r.set(e,[]),r.get(e).push(t)}for(let s=0;h.length>s;s++){const c=r.get(h[s])||[];for(const r of c){const c=i(r),f=a(r,h[s]);if(d){const i=e.x+s*t+o/2,a=l(0),d=l(c);u.push(U(i,Math.min(a,d),n,Math.abs(a-d),f,r,h[s]))}else{const i=e.x+s*t+o/2,a=l(0),d=l(c);u.push(U(Math.min(a,d),i,Math.abs(d-a),n,f,r,h[s]))}}}}const m=r.roundedTop&&r.roundedTop>0?Math.max(0,r.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=i(e.datum);m>0&&(e.roundedTop=m),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",r.gradientFill&&(e.fillGradient=r.gradientFill)}return u},point:function(e,t){const{scales:o,columns:n,getR:r,multiScales:i,resolvePieceStyle:s}=e,{r:a,projection:l}=o,c=[],u="vertical"===l,d="radial"===l,h=i.length>0,f=re(e),g=2*Math.PI,m=-Math.PI/2;for(const e of Object.values(n))for(const t of e.pieceData){const o=t.__rIndex??0,n=t.__rValue??r(t),l=h&&i[o]||a,y=s(t,e.name),p=y.r||5;let b,v;if(d){const t=m+(e.pctStart+e.pct/2)*g,o=l(n);b=Math.cos(t)*o,v=Math.sin(t)*o}else u?(b=e.middle,v=l(n)):(b=l(n),v=e.middle);ie(c,f,t,b,v,p,y)}return c},swarm:function(e,t){const{scales:o,columns:n,getR:r,resolvePieceStyle:i}=e,{r:s,projection:a}=o,l=[],c="vertical"===a,u=re(e);for(const e of Object.values(n)){const t=e.width/2;for(let o=0;e.pieceData.length>o;o++){const n=e.pieceData[o],a=r(n),d=i(n,e.name),h=d.r||4,f=(7919*o%100/100-.5)*t*.8;ie(l,u,n,c?e.middle+f:s(a),c?s(a):e.middle+f,h,d)}}return l},pie:se,donut:se,boxplot:function(e,t){const{scales:o,columns:n,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],u="vertical"===l,d=!1!==r.showOutliers;for(const t of Object.values(n)){const o=t.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===o.length)continue;const n=o[0],r=o[o.length-1],l=(0,ae.quantile)(o,.25)??n,h=(0,ae.quantile)(o,.5)??(n+r)/2,f=(0,ae.quantile)(o,.75)??r,g=f-l,m=l-1.5*g,y=f+1.5*g,p=o.find(e=>e>=m)??n,b=[...o].reverse().find(e=>y>=e)??r,v=s(t.pieceData[0],t.name),x=[];if(d)for(const e of t.pieceData){const o=i(e);if(m>o||o>y){const n=u?t.middle:a(o),r=u?a(o):t.middle;x.push({px:n,py:r,value:o,datum:e})}}if(c.push({type:"boxplot",x:u?t.middle:0,y:u?0:t.middle,projection:u?"vertical":"horizontal",columnWidth:.6*t.width,minPos:a(p),q1Pos:a(l),medianPos:a(h),q3Pos:a(f),maxPos:a(b),stats:{n:o.length,min:p,q1:l,median:h,q3:f,max:b,mean:o.reduce((e,t)=>e+t,0)/o.length},style:v,datum:t.pieceData,category:t.name,outliers:x}),d)for(const t of x)c.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:v.fill||e.config.themeSemantic?.secondary||"#999",opacity:.6},datum:t.datum})}return c},violin:function(e,t){const{scales:o,columns:n,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],u="vertical"===l,d=r.bins||20,h=!1!==r.showIQR;for(const e of Object.values(n)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],n=t[t.length-1],r=(n-o)/d||1,l=Array(d).fill(0);for(const e of t)l[Math.min(Math.floor((e-o)/r),d-1)]++;const f=ce(l,1),g=e.width/2*.9;let m;if(u){m=`M ${e.middle} ${a(o)}`;for(let t=0;d>t;t++){const n=a(o+(t+.5)*r);m+=` L ${e.middle+l[t]/f*g} ${n}`}m+=` L ${e.middle} ${a(n)}`;for(let t=d-1;t>=0;t--){const n=a(o+(t+.5)*r);m+=` L ${e.middle-l[t]/f*g} ${n}`}m+=" Z"}else{m=`M ${a(o)} ${e.middle}`;for(let t=0;d>t;t++)m+=` L ${a(o+(t+.5)*r)} ${e.middle-l[t]/f*g}`;m+=` L ${a(n)} ${e.middle}`;for(let t=d-1;t>=0;t--)m+=` L ${a(o+(t+.5)*r)} ${e.middle+l[t]/f*g}`;m+=" Z"}const y=s(e.pieceData[0],e.name);let p;if(h&&t.length>=4){const r=(0,ae.quantile)(t,.25)??o,i=(0,ae.quantile)(t,.5)??(o+n)/2,s=(0,ae.quantile)(t,.75)??n;p={q1Pos:a(r),medianPos:a(i),q3Pos:a(s),centerPos:e.middle,isVertical:u}}const b=u?{x:e.x,y:Math.min(a(n),a(o)),width:e.width,height:Math.abs(a(n)-a(o))}:{x:Math.min(a(o),a(n)),y:e.x,width:Math.abs(a(n)-a(o)),height:e.width};c.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:b,iqrLine:p,stats:ue(t),style:y,datum:e.pieceData,category:e.name})}return c},histogram:function(e,t){const{scales:o,columns:n,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a}=o,l=[],c=r.bins||25,u=r.normalize,d=a.domain?.(),h=d?+d[0]:void 0,f=d?+d[1]:void 0;for(const e of Object.values(n)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const[o,n]=le(t),r=null!=h&&isFinite(h)?h:o,d=null!=f&&isFinite(f)?f:n,g=(d-r)/c||1,m=Array(c).fill(0);for(const e of t)r>e||e>d||m[Math.min(Math.floor((e-r)/g),c-1)]++;const y=t.length,p=ce(m,1),b=s(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===m[t])continue;const o=(u?m[t]/y:m[t]/p)*e.width*.9,n=a(r+t*g),i=a(r+(t+1)*g);l.push(U(Math.min(n,i),e.x+e.width-o,Math.abs(i-n),o,b,{bin:t,count:m[t],range:[r+t*g,r+(t+1)*g],category:e.name},e.name))}}return l},ridgeline:function(e,t){const{scales:o,columns:n,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],u=r.bins||20,d="horizontal"===l,h=r.amplitude||1.5;for(const e of Object.values(n)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],n=t[t.length-1],r=(n-o)/u||1,l=Array(u).fill(0);for(const e of t)o>e||e>n||l[Math.min(Math.floor((e-o)/r),u-1)]++;const f=ce(l,1),g=s(e.pieceData[0],e.name),m=e.width*h;let y;if(d){const t=e.x+e.width;y=`M ${a(o)} ${t}`;for(let e=0;u>e;e++)y+=` L ${a(o+(e+.5)*r)} ${t-l[e]/f*m}`;y+=` L ${a(n)} ${t} Z`}else{const t=e.x;y=`M ${t} ${a(o)}`;for(let e=0;u>e;e++){const n=a(o+(e+.5)*r);y+=` L ${t+l[e]/f*m} ${n}`}y+=` L ${t} ${a(n)} Z`}const p=d?{x:Math.min(a(o),a(n)),y:e.x,width:Math.abs(a(n)-a(o)),height:e.width}:{x:e.x,y:Math.min(a(n),a(o)),width:e.width,height:Math.abs(a(n)-a(o))};c.push({type:"violin",pathString:y,translateX:0,translateY:0,bounds:p,stats:ue(t),style:{...g,fillOpacity:g.fillOpacity??.5},datum:e.pieceData,category:e.name})}return c},timeline:function(e,t){const{scales:o,columns:n,getRawRange:r,resolvePieceStyle:i}=e,{r:s,projection:a}=o,l=[],c="horizontal"===a;for(const e of Object.values(n))for(const t of e.pieceData){const o=r(t);if(!o)continue;const[n,a]=o,u=i(t,e.name);if(c){const o=s(Math.min(n,a)),r=s(Math.max(n,a));l.push(U(o,e.x,r-o,e.width,u,t,e.name))}else{const o=s(Math.max(n,a)),r=s(Math.min(n,a));l.push(U(e.x,o,e.width,r-o,u,t,e.name))}}return l},funnel:function(e,t){const{columns:o,getR:n,getStack:r,resolvePieceStyle:i}=e,s=[],a=t.width/2,l=!1!==e.config.showLabels,c=e.scales.o.domain().map(e=>o[e]).filter(Boolean);if(0===c.length)return s;const u=[],d=new Set;for(const e of c)for(const t of e.pieceData){const e=r?r(t):"_default";d.has(e)||(d.add(e),u.push(e))}const h=u.length>1&&"_default"!==u[0],f=[];let g=0;for(const e of c){const t=new Map;let o=0;for(const i of e.pieceData){const e=r?r(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=n(i);s.total+=a,s.pieces.push(i),o+=a}f.push({col:e,groups:t,stepTotal:o}),h||o>g&&(g=o)}if(h)for(const e of f){let t=0,o=0;for(let n=0;u.length>n;n++){const r=e.groups.get(u[n]);r&&(n%2==0?t+=r.total:o+=r.total)}const n=Math.max(t,o);n>g&&(g=n)}if(0===g)return s;const m=new Map;for(const e of u){const t=f[0].groups.get(e);m.set(e,t?.total??0)}const y=f[0].stepTotal,p=h?.95*a:.9*t.width,b=(0,de.scaleLinear)().domain([0,g]).range([0,p]),v=e.config.connectorOpacity??.3;let x=new Map;for(let t=0;f.length>t;t++){const o=f[t],n=o.col,r=0===t,c=n.width,d=.55*c,g=n.x+(c-d)/2,p=new Map;if(h){let e=0;for(const t of u){const n=o.groups.get(t);n&&(e+=b(n.total))}let t=a,c=a;for(let h=0;u.length>h;h++){const f=u[h],y=o.groups.get(f);if(!y)continue;const v=b(y.total),x=h%2==0,w=x?t:c-v;x?t+=v:c-=v;const k=i(y.pieces[0],f),S=m.get(f)??y.total,A={...y.pieces[0],__funnelValue:y.total,__funnelPercent:S>0?y.total/S*100:0,__funnelStep:n.name,__funnelIsFirstStep:r,__aggregateValue:y.total,__pieceCount:y.pieces.length,category:f};l&&(0===h&&(A.__funnelStepLabel=n.name,A.__funnelStepLabelX=a,A.__funnelStepLabelY=g,A.__funnelRowWidth=e),A.__funnelValueLabelX=w+v/2,A.__funnelValueLabelY=g,A.__funnelBarW=v),s.push(U(w,g,v,d,k,A,f)),p.set(f,{x:w,y:g,w:v,h:d})}}else{const e=o.stepTotal,t=b(e),c=a-t/2,h=u[0],f="_default"!==h,m=o.groups.get(h)?.pieces[0]??n.pieceData[0],v=f?h:n.name,x=i(m,v),w=y>0?e/y*100:0,k={...m,__funnelValue:e,__funnelPercent:w,__funnelStep:n.name,__funnelIsFirstStep:r,category:f?h:n.name};l&&(k.__funnelStepLabel=n.name,k.__funnelStepLabelX=a,k.__funnelStepLabelY=g,k.__funnelRowWidth=t,k.__funnelValueLabelX=a,k.__funnelValueLabelY=g,k.__funnelBarW=t),s.push(U(c,g,t,d,x,k,v)),p.set(h,{x:c,y:g,w:t,h:d})}if(t>0&&x.size>0){const t=h?u:[u[0]];for(const r of t){const t=x.get(r),a=p.get(r);if(!t||!a)continue;const l=(()=>{const e=o.groups.get(r);return i(e?e.pieces[0]:n.pieceData[0],"_default"===r?n.name:r)})(),c={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[a.x+a.w,a.y],[a.x,a.y]],style:{fill:l.fill||e.config.themeSemantic?.secondary||"#999",opacity:v},datum:o.groups.get(r)?.pieces[0]??n.pieceData[0],category:"_default"===r?n.name:r};s.push(c)}}x=p}return s},"bar-funnel":function(e,t){const{columns:o,getR:n,getStack:r,resolvePieceStyle:i,scales:s}=e,a=[],l=s.o.domain().map(e=>o[e]).filter(Boolean);if(0===l.length)return a;const c=[],u=new Set;for(const e of l)for(const t of e.pieceData){const e=r?r(t):"_default";u.has(e)||(u.add(e),c.push(e))}const d=c.length>1&&"_default"!==c[0],h=[];for(const e of l){const t=new Map;let o=0;for(const i of e.pieceData){const e=r?r(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=n(i);s.total+=a,s.pieces.push(i),o+=a}h.push({col:e,groups:t,stepTotal:o})}const f=new Map;for(const e of c){const t=h[0]?.groups.get(e);f.set(e,t?.total??0)}const g=s.r,m=d?c.length:1,y=d?.15:0;for(let e=0;h.length>e;e++){const t=h[e],o=t.col,n=0===e,r=e>0?h[e-1]:null,s=o.width/m,l=s*y,u=s-l;for(let e=0;c.length>e;e++){const h=c[e],m=t.groups.get(h);if(!m)continue;const y=m.total,p=f.get(h)??y,b=p>0?y/p*100:0,v=r?.groups.get(h),x=n?0:Math.max(0,(v?.total??y)-y),w=o.x+e*s+l/2,k=g(y),S=g(0)-k,A=i(m.pieces[0],d?h:o.name),M={...m.pieces[0],__barFunnelValue:y,__barFunnelPercent:b,__barFunnelIsFirstStep:n,__barFunnelIsDropoff:!1,__barFunnelStep:o.name,__barFunnelDropoffValue:x,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:o.name,__barFunnelLabelX:w+u/2,__barFunnelLabelY:g(y+x)};if(a.push(U(w,k,u,S,A,M,d?h:o.name)),x>0){const e=g(y+x),t=k-e,n={...A},r={...m.pieces[0],__barFunnelValue:x,__barFunnelPercent:p>0?x/p*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:o.name,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:o.name};a.push(U(w,e,u,t,n,r,d?h:o.name))}}}return a},swimlane:function(e,t){const{scales:o,columns:n,getR:r,getStack:i,resolvePieceStyle:s}=e,{r:a,projection:l}=o,c=[],u="horizontal"===l,d=e.config.gradientFill,h=u?"left":"bottom",f=e.config.trackFill;if(f){const e="string"==typeof f?f:f.color,t="string"==typeof f?1:f.opacity??1,[o,r]=a.range(),i=Math.min(o,r),s=Math.abs(r-o);for(const o of Object.values(n)){const n={fill:e,opacity:t},r=u?U(i,o.x,s,o.width,n,null,"__track__"):U(o.x,i,o.width,s,n,null,"__track__");c.push(r)}}const g=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(n)){let t=0;const o=c.length;for(const o of e.pieceData){const n=Math.abs(r(o));if(0===n)continue;const l=i?i(o):e.name,f=s(o,l);let g;if(u){const r=a(t),i=a(t+n);g=U(r,e.x,i-r,e.width,f,o,l)}else{const r=a(t+n),i=a(t);g=U(e.x,r,e.width,i-r,f,o,l)}d&&(g.fillGradient=d,g.roundedEdge=h),c.push(g),t+=n}if(g>0&&c.length>o){const e=c.slice(o),t=e[0],n=e[e.length-1];1===e.length?t.cornerRadii={tl:g,tr:g,br:g,bl:g}:u?(t.cornerRadii={tl:g,bl:g},n.cornerRadii={tr:g,br:g}):(t.cornerRadii={bl:g,br:g},n.cornerRadii={tl:g,tr:g})}}return c}};function fe(e,t){const o=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>o&&K(o,e)||"#4e79a7":t=>{if(o){const e=K(o,t);if(e)return e}let n=0;for(let e=0;t.length>e;e++)n=31*n+t.charCodeAt(e)|0;return e[Math.abs(n)%e.length]??"#4e79a7"}}function ge(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(ge))}function me(e,t,o){e.has(t)||(e.add(t),console.warn(o))}function ye(e,t,o,n){const r=e.push(t);return o&&o.push(n),r}var pe={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 be(e,t){const o={...e};for(const e of t)o[pe[e]]++;return o}function ve(e,t,o){const n=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:n,revisions:be(o,n)}}var xe=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=ve({kind:"initialize"},[],this.revisions)}get last(){return this.latest}record(e,t){const o=ve(e,t,this.revisions);return this.revisions=o.revisions,this.latest=o,o}},we=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],ke=["scene-style","data-paint","accessibility","evidence"],Se=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ae=new Set(["accessorRevision","axisExtent","categoryAccessor","chartType","extentPadding","groupBy","multiAxis","normalize","oAccessor","oExtent","oSort","rAccessor","rExtent","runtimeMode","stackBy","timeAccessor","valueAccessor"]),Me=new Set(["barColors","colorScheme","connectorStyle","pieceStyle","summaryStyle","themeCategorical","themeDiverging","themeSemantic","themeSequential"]),Ce=class{constructor(){this.tracker=new xe}get last(){return this.tracker.last}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},we)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},ke):this.recordNoop("restyle")}recordConfig(e){if(0===e.length)return this.tracker.record({kind:"config",keys:e},[]);const t=new Set(Se);return e.some(e=>Ae.has(e))&&t.add("domain"),e.some(e=>Me.has(e))&&t.add("scene-style"),this.tracker.record({kind:"config",keys:e},t)}};var je=require("d3-quadtree"),_e=class{constructor(e){this.rExtent=new y,this.rExtents=[],this.windowSizeWarned=!1,this.updateResults=new Ce,this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},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.version=0,this._dataVersion=0,this._bufferArrayCache=null,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new m(e.windowSize),this.getO=S(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>k(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new y)):(this.getR=k(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=S(e.stackBy),this.getGroup=S(e.groupBy),this.getColor=S(e.colorAccessor),this.getSymbol=S(e.symbolAccessor),this.getConnector=S(e.connectorAccessor),this.getDataId=S(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new m(e.windowSize))}syncPulseTimestampBuffer(){var e,t,o,n;this.timestampBuffer=(e=!!this.config.pulse,t=this.buffer,o=this.timestampBuffer,n=x(),e?null!=o&&o.capacity===t.capacity&&o.size===t.size?o:function(e,t){const o=new m(e.capacity);return e.forEach(()=>o.push(t)),o}(t,n):null)}ingest(e){const t=x();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),r=this.timestampBuffer,(n=e.totalSize||e.inserts.length)>(o=this.buffer).capacity&&(o.resize(n),r&&n>r.capacity&&r.resize(n));for(const o of e.inserts)ye(this.buffer,o,this.timestampBuffer,t),this.categories.add(this.getO(o)),this.pushValueExtent(o)}else{this._hasStreamingData=!0;for(const o of e.inserts){const e=ye(this.buffer,o,this.timestampBuffer,t);this.categories.add(this.getO(o)),this.pushValueExtent(o),null!=e&&this.evictValueExtent(e)}}var o,n,r;return this.updateResults.recordData(e.bounded?"replace":"ingest",e.inserts.length),!0}ingestWithResult(e){return this.ingest(e),this.updateResults.last}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.valueAccessor||this.config.rAccessor;if(!t)return null;const o="function"==typeof t?t(e):e[t];return Array.isArray(o)&&o.length>=2?[+o[0],+o[1]]:null}computeScene(e){const{config:t,buffer:o}=this,n=this.scales,r=this.multiScales,i=this.columns;if(0===o.size)return this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const s=this.getBufferArray(),a=t.projection||"vertical",l=t.oExtent||this.resolveCategories(s),c=this.computeValueDomain(s,l),u="horizontal"===a,d="radial"===a,h=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===a?e.width:e.height):.1));let f,m;if(d){f=(0,g.scaleBand)().domain(l).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,n=t.innerRadius||0;m=(0,g.scaleLinear)().domain(c).range([n,o])}else u?(f=(0,g.scaleBand)().domain(l).range([0,e.height]).padding(h),m=(0,g.scaleLinear)().domain(c).range([0,e.width])):(f=(0,g.scaleBand)().domain(l).range([0,e.width]).padding(h),m=(0,g.scaleLinear)().domain(c).range([e.height,0]));this.scales={o:f,r:m,projection:a},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((n,r)=>{const i=this.rExtents[r];i.dirty&&i.recalculate(o,n);let[s,a]=i.extent;s===1/0&&(s=0,a=1);const l=a-s,c=l>0?l*(t.extentPadding??.05):1;return s-=c,a+=c,s>0&&(s=0),u?(0,g.scaleLinear)().domain([s,a]).range([0,e.width]):(0,g.scaleLinear)().domain([s,a]).range([e.height,0])}):[];let y=s;this.rAccessors.length>1&&(y=s.flatMap(e=>this.rAccessors.map((t,o)=>({...e,__rIndex:o,__rValue:t(e),__rName:this.resolveRAccessorName(o)})))),this.columns=this.buildColumns(y,l,f,a,e),this._customLayoutFailedThisBuild=!1;const p=this.buildSceneNodes(y,e);this._customLayoutFailedThisBuild?!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=n,this.multiScales=r,this.columns=i):(this.scene=[],this.rebuildPointQuadtree()):(this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=p,this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,s),this.config.pulse&&this.applyPulse(this.scene,s),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.startTransition(),this.version++)}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,o=Array.isArray(t)?t[e]:t;return"string"==typeof o?o:"value"+e}resolveCategories(e){const t=this.config.oSort,o="streaming"===this.config.runtimeMode||this._hasStreamingData,n="auto"===t?void 0:t;let r=null;if(o){r=new Set;for(const t of e)r.add(this.getO(t))}const i=r?Array.from(this.categories).filter(e=>r.has(e)):Array.from(this.categories);if(o&&void 0===n){const e=Math.max(50,3*r.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;r.has(e)||(this.categories.delete(e),t--)}}return i}if(!1===n)return i;if("function"==typeof n)return i.sort(n);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return i.sort("asc"===n?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){return function(e){const{data:t,chartType:o,projection:n,normalize:r,rExtent:i,extentPadding:s=.05,baselinePadding:a,axisExtent:l,getO:c,getR:u,getStack:d,rawRExtent:h}=e,f=s;if("radial"===n&&("pie"===o||"donut"===o))return[0,1];let g=0,m=0;if("bar"===o&&d&&r)g=0,m=1;else if("bar"===o&&d){const e=new Map,o=new Map;for(const n of t){const t=c(n),r=u(n);0>r?o.set(t,(o.get(t)||0)+r):e.set(t,(e.get(t)||0)+r)}for(const t of e.values())t>m&&(m=t);for(const e of o.values())g>e&&(g=e)}else if("bar"===o){const e=new Map;for(const o of t){const t=c(o),n=u(o);e.set(t,(e.get(t)||0)+n)}for(const t of e.values())t>m&&(m=t),g>t&&(g=t)}else if("swimlane"===o){const e=new Map;for(const o of t){const t=c(o),n=Math.abs(u(o));e.set(t,(e.get(t)||0)+n)}for(const t of e.values())t>m&&(m=t)}else if("clusterbar"===o||"bar-funnel"===o)for(const e of t){const t=u(e);t>m&&(m=t),g>t&&(g=t)}else{const e=h[0],t=h[1];e!==1/0&&(g=e),t!==-1/0&&(m=t)}i&&(null!=i[0]&&(g=i[0]),null!=i[1]&&(m=i[1]));const y="bar"===o||"clusterbar"===o||"bar-funnel"===o||"swimlane"===o;if(y&&null==i?.[0]&&null==i?.[1]&&(g>0&&(g=0),0>m&&(m=0)),"bar-funnel"!==o&&"exact"!==l){const e=m-g,t=e>0?e*f:1,n=y&&!a&&0===g,r=y&&!a&&0===m||"swimlane"===o;null!=i?.[0]||n||(g-=t),null!=i?.[1]||r||(m+=t)}return[g,m]}({data:e,chartType:this.config.chartType,projection:this.config.projection,normalize:this.config.normalize,rExtent:this.config.rExtent,extentPadding:this.config.extentPadding,baselinePadding:this.config.baselinePadding,axisExtent:this.config.axisExtent,getO:this.getO,getR:this.getR,getStack:this.getStack,rawRExtent:this.rExtent.extent})}buildColumns(e,t,o,n,r){return function(e){const{data:t,oExtent:o,oScale:n,projection:r,layout:i,dynamicColumnWidth:s,getO:a,getR:l}=e,c={},u=new Map;for(const e of t){const t=a(e);u.has(t)||u.set(t,[]),u.get(t).push(e)}let d=0;if("radial"===r)for(const e of t)d+=Math.abs(l(e));let h=null;if(s&&"radial"!==r){h=new Map;let e=0;for(const t of o){const o=u.get(t)||[];let n;n="string"==typeof s?o.reduce((e,t)=>e+(Number(t[s])||0),0):s(o),h.set(t,n),e+=n}const t=("horizontal"===r?i.height:i.width)-n.padding()*n.step()*o.length;if(e>0)for(const[o,n]of h)h.set(o,n/e*t)}let f=0,g=0;for(const e of o){const t=u.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(l(t)),0),r=d>0?o/d:0;let i,s;h?(i=g,s=h.get(e)||n.bandwidth(),g+=s+n.padding()*n.step()):(i=n(e)??0,s=n.bandwidth()),c[e]={name:e,x:i,y:0,width:s,middle:i+s/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:f},f+=r}return c}({data:e,oExtent:t,oScale:o,projection:n,layout:r,dynamicColumnWidth:this.config.dynamicColumnWidth,getO:this.getO,getR:this.getR})}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getSymbol:this.getSymbol,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];if(this.config.customLayout){const o=this.buildLayoutContext(e,t);let n;try{n=this.config.customLayout(o)}catch(e){const t=null!==this.lastCustomLayoutResult,o=function(e,t,o,n){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:o?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:o,affectedRevision:n}}("ordinal",e,t,this.version);this.lastCustomLayoutFailure=o,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e);try{this.config.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=n.overlays??null,this.lastCustomLayoutResult=n,this.lastCustomLayoutFailure=null;const r=n.nodes??[];if(this._customRestyle=n.restyle,this.hasCustomRestyle=!!n.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of r)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(r,this.config.layoutSelection??null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:o,overlays:n,warned:r}=e;ge(n)&&0===o.length&&me(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.`),o.length>0&&o.every(e=>null==e.datum)&&me(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:"ordinal customLayout",nodes:r,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),r}this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1;const o=this.getSceneContext(),n=he[this.config.chartType];let r=n?n(o,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:o,config:n,getConnector:r,getO:i}=e;if(!r||!o)return[];const s=[],{projection:a}=o,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const o=r(t);if(!o)continue;let n,s;"point"===e.type?(n=e.x,s=e.y):(n=e.x+e.w/2,s=e.y+("vertical"===a?0:e.h/2)),l.has(o)||l.set(o,[]),l.get(o).push({x:n,y:s,datum:t,category:i(t)})}const c=o.o.domain(),u=n.connectorStyle;for(const[t,o]of l)if(o.length>=2){o.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let n=0;o.length-1>n;n++){const r=o[n],i=o[n+1],a="function"==typeof u?u(r.datum):u||{stroke:e.config.themeSemantic?.border||e.config.themeSemantic?.secondary||"#999",strokeWidth:1,opacity:.5};s.push({type:"connector",x1:r.x,y1:r.y,x2:i.x,y2:i.y,style:a,datum:r.datum,group:t})}}return s}(o,r);r=[...e,...r]}return r}buildLayoutContext(e,t){const o=this.config,n=o.layoutMargin??{top:0,right:0,bottom:0,left:0},r=function(e,t,o){if(e&&"object"==typeof e&&!Array.isArray(e)){const t=Object.values(e).filter(e=>"string"==typeof e&&e.length>0);if(t.length>0)return t}if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=q[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:o}(o.colorScheme,o.themeCategorical,V),i=this.scales;return{data:e,scales:{o:i.o,r:i.r,projection:i.projection},dimensions:{width:t.width,height:t.height,margin:n,plot:"radial"===i.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:o.themeSemantic??{},categorical:[...r]},resolveColor:fe(r,o.colorScheme),config:o.layoutConfig??{},selection:o.layoutSelection??null}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const o=this.config.pieceStyle(e,t);return o&&!o.fill&&t?{...o,fill:this.getColorFromScheme(t)}:o}return this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const o=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||V,n=o[this._colorSchemeIndex%o.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,n),n}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?function(e,t,o){if(1>=o)return 1;const n=o-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 o=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>o?1:t;if("exponential"===e.type){const n=e.halfLife??e.extent/2;return t+Math.pow(.5,o/(n>0?n:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-o/e.extent))*(1-t)}({age:n-t,extent:n,type:e.type,halfLife:e.halfLife??o/2,threshold:e.stepThreshold??.5*o,minOpacity:e.minOpacity??.1})}(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=function(e){const t=new Map;for(let o=0;e.length>o;o++)t.set(e[o],o);return t}(e);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=function(e,t){const o="function"==typeof t,n=o?null:t||"category",r=new Map;for(let i=0;e.length>i;i++){const s=e[i],a=o?t(s):s[n],l=r.get(a);l?l.push(i):r.set(a,[i])}return r}(e,this.config.categoryAccessor||this.config.oAccessor);return this._categoryIndexCache={version:this._dataVersion,map:t},t}rebuildPointQuadtree(){const e=function(e){let t=0,o=0;for(const n of e)"point"===n.type&&(t++,n.r>o&&(o=n.r));if(500>=t)return{quadtree:null,maxRadius:o};const n=Array(t);let r=0;for(const t of e)"point"===t.type&&(n[r++]=t);return{maxRadius:o,quadtree:(0,je.quadtree)().x(e=>e.x).y(e=>e.y).addAll(n)}}(this.scene);this._pointQuadtree=e.quadtree,this._maxPointRadius=e.maxRadius}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){if(!this.config.decay)return;const o=t.length;if(1>=o)return;const n=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=n.get(t.datum);if(null==e)continue;const r=this.computeDecayOpacity(e,o);t.style={...t.style,opacity:(t.style?.opacity??1)*r}}}applyPulse(e,t,o=x()){return!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,o,n,r,i){const s=e.color??"rgba(255,255,255,0.6)",a=e.glowRadius??4;let l=!1;for(const c of t){if("connector"===c.type||"violin"===c.type||"boxplot"===c.type)continue;if("wedge"===c.type){const t=c.category;if(!t)continue;let n=0;for(const s of r(t)??[]){const t=o.get(s);null!=t&&(n=Math.max(n,p(e,t,i)))}l=b(c,n,s)||l;continue}if(null==c.datum)continue;const t=n.get(c.datum);if(null==t)continue;const u=o.get(t);l=b(c,null==u?0:p(e,u,i),s,a)||l}return l}(this.config.pulse,e,this.timestampBuffer,this.getDatumIndexMap(t),e=>this.getCategoryIndexMap(t).get(e),o)}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&&function(e,t,o=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const n=e.duration??500,r=t.peek();return null!=r&&n>o-r}(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(x())}synthesizeIntroPositions(){this.prevPositionMap.clear();const e=new Map,t=this.scales?.r(0)??0,o="horizontal"!==this.scales?.projection;let n;for(let r=0;this.scene.length>r;r++){const i=this.scene[r],s=this.getNodeKey(i,e);s&&("rect"===i.type?this.prevPositionMap.set(s,o?{x:i.x,y:t,w:i.w,h:0,opacity:i.style.opacity??1}:{x:t,y:i.y,w:0,h:i.h,opacity:i.style.opacity??1}):"point"===i.type?this.prevPositionMap.set(s,{x:i.x,y:i.y,r:0,opacity:0}):"wedge"===i.type&&(void 0===n&&(n=i.startAngle),this.prevPositionMap.set(s,{x:i.cx,y:i.cy,startAngle:n,endAngle:n,innerRadius:i.innerRadius,outerRadius:i.outerRadius,opacity:0})))}}getNodeKey(e,t){if("point"===e.type){const o=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,n=t.get(o)||0;return t.set(o,n+1),`${o}:${n}`}return"rect"===e.type?`r:${e.group||""}:${e.datum?.category??""}`:"wedge"===e.type?"w:"+(e.category??""):null}snapshotPositions(){this.prevPositionMap.clear();const e=new Map;for(let t=0;this.scene.length>t;t++){const o=this.scene[t],n=this.getNodeKey(o,e);n&&("point"===o.type?this.prevPositionMap.set(n,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(n,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(n,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:o.style.opacity??1}))}}startTransition(){if(!this.config.transition||0===this.prevPositionMap.size)return;const e=this.config.transition.duration??300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let t=!1;const o=new Set,n=new Map;for(let e=0;this.scene.length>e;e++){const r=this.scene[e],i=this.getNodeKey(r,n);if(!i)continue;r._transitionKey=i;const s=this.prevPositionMap.get(i);if("point"===r.type)s?(o.add(i),r._targetOpacity=r.style.opacity??1,(s.x!==r.x||s.y!==r.y||void 0!==s.r&&s.r!==r.r)&&(r._targetX=r.x,r._targetY=r.y,r._targetR=r.r,r.x=s.x,r.y=s.y,void 0!==s.r&&(r.r=s.r),t=!0)):(r._targetOpacity=r.style.opacity??1,r._targetR=r.r,r.r=0,r.style={...r.style,opacity:0},t=!0);else if("rect"===r.type)s?(o.add(i),r._targetOpacity=r.style.opacity??1,s.x===r.x&&s.y===r.y&&s.w===r.w&&s.h===r.h||(r._targetX=r.x,r._targetY=r.y,r._targetW=r.w,r._targetH=r.h,r.x=s.x,r.y=s.y,r.w=s.w??r.w,r.h=s.h??r.h,t=!0)):(r._targetOpacity=r.style.opacity??1,r.style={...r.style,opacity:0},t=!0);else if("wedge"===r.type)if(s)o.add(i),r._targetOpacity=r.style.opacity??1,s.startAngle===r.startAngle&&s.endAngle===r.endAngle||(r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle,r.startAngle=s.startAngle,r.endAngle=s.endAngle,t=!0);else{r._targetOpacity=r.style.opacity??1,r._targetStartAngle=r.startAngle,r._targetEndAngle=r.endAngle;const e=r.startAngle;r.startAngle=e,r.endAngle=e,r.style={...r.style,opacity:0},this.prevPositionMap.set(i,{x:r.cx,y:r.cy,startAngle:e,endAngle:e,innerRadius:r.innerRadius,outerRadius:r.outerRadius,opacity:0}),t=!0}}this.exitNodes=[];for(const[e,n]of this.prevPositionMap)if(!o.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:n.x,y:n.y,r:n.r??3,style:{opacity:n.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:n.x,y:n.y,w:n.w??0,h:n.h??0,style:{opacity:n.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const t=((n.startAngle??0)+(n.endAngle??0))/2,o={type:"wedge",cx:n.x,cy:n.y,innerRadius:n.innerRadius??0,outerRadius:n.outerRadius??100,startAngle:n.startAngle??0,endAngle:n.endAngle??0,style:{opacity:n.opacity??1},datum:null,category:e.slice(2),_targetStartAngle:t,_targetEndAngle:t,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(o)}t=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),t&&(this.activeTransition={startTime:x(),duration:e})}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),o=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t,"linear"===this.config.transition?.easing?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t);e.style.opacity=v(n?n.opacity??1:0,e._targetOpacity,o)}const n=this.prevPositionMap.get(t);void 0!==e._targetX&&n&&(e.x=v(n.x,e._targetX,o),e.y=v(n.y,e._targetY,o)),void 0!==e._targetR&&void 0!==n?.r&&(e.r=v(n.r,e._targetR,o))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t);e.style.opacity=v(n?n.opacity??1:0,e._targetOpacity,o)}if(void 0===e._targetX)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=v(n.x,e._targetX,o),e.y=v(n.y,e._targetY,o),void 0!==n.w&&(e.w=v(n.w,e._targetW,o),e.h=v(n.h,e._targetH,o))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t);e.style={...e.style,opacity:v(n?n.opacity??1:0,e._targetOpacity,o)}}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const n=this.prevPositionMap.get(t);n&&void 0!==n.startAngle&&(e.startAngle=v(n.startAngle,e._targetStartAngle,o),e.endAngle=v(n.endAngle,e._targetEndAngle,o))}}}if(t>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style={...e.style||{},opacity:0===e._targetOpacity?0:e._targetOpacity},e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(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"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getBufferArray(){return this._bufferArrayCache?.version!==this._dataVersion&&(this._bufferArrayCache={version:this._dataVersion,data:this.buffer.toArray()}),this._bufferArrayCache.data}getData(){return this.buffer.toArray()}getLastUpdateResult(){return this.updateResults.last}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=A(e),o=this.getDataId,n=e=>t.has(o(e));!function(e,t,o){if(!t||0===t.size)return;const n=new Set;if(e.forEach((e,t)=>{o(e)&&n.add(t)}),0===n.size)return;const r=t.toArray();t.clear();for(let e=0;r.length>e;e++)n.has(e)||t.push(r[e])}(this.buffer,this.timestampBuffer,n);const r=this.buffer.remove(n);if(0===r.length)return this.updateResults.recordNoop("remove"),r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,this.lastIngestTime=x(),this.updateResults.recordData("remove",r.length),r}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const o=A(e),n=this.getDataId,r=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&r.add(t)});const i=this.buffer.update(e=>o.has(n(e)),t);if(0===i.length)return this.updateResults.recordNoop("update"),i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),r.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,this.lastIngestTime=x(),this.updateResults.recordData("update",i.length),i}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this.multiScales=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._pointQuadtree=null,this._maxPointRadius=0,this._colorSchemeMap=null,this._colorSchemeIndex=0,this._dataVersion++,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}setLayoutSelection(e){this.config.layoutSelection=e}applyCustomRestyle(e,t){const o=this._customRestyle;if(o)for(const n of e){const e=this._baseStyles.get(n)??n.style??{},r=o(n,t);n.style=r?{...e,...r}:e}}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}rebuildAccessorDerivedState(){this.categories.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();this._categoryIndexCache=null,this.buffer.forEach(e=>{this.categories.add(this.getO(e)),this.pushValueExtent(e)})}updateConfig(e){const t={...this.config},o=Object.keys(e).filter(o=>e[o]!==t[o]);"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&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!w(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!w(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!w(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();let n=!1;("categoryAccessor"in e||"oAccessor"in e)&&(w(this.config.categoryAccessor||this.config.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=S(this.config.categoryAccessor||this.config.oAccessor,"category"),n=!0));let r=!1;if("valueAccessor"in e||"rAccessor"in e){const e=this.config.valueAccessor||this.config.rAccessor,o=t.valueAccessor||t.rAccessor,n=Array.isArray(e)?e:[e],i=Array.isArray(o)?o:[o];if(r=n.length!==i.length||n.some((e,t)=>!w(e,i[t])),r){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>k(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new y)):(this.getR=k(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!w(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?S(this.config.stackBy):void 0),"groupBy"in e&&!w(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?S(this.config.groupBy):void 0),"colorAccessor"in e&&!w(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?S(this.config.colorAccessor):void 0),"symbolAccessor"in e&&!w(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?S(this.config.symbolAccessor):void 0),"connectorAccessor"in e&&!w(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?S(this.config.connectorAccessor):void 0),(n||r||"accessorRevision"in e&&e.accessorRevision!==t.accessorRevision)&&this.rebuildAccessorDerivedState(),this.updateResults.recordConfig(o)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}},Pe=l(require("react"));function Re(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:Pe.createElement(Pe.Fragment,null,...t)}var Le=l(require("react")),Ie=require("react/jsx-runtime"),Te={isActive:!1,predicate:()=>!0},$e=Le.createContext(null);function Be({value:e,children:t}){return(0,Ie.jsx)($e.Provider,{value:e,children:t})}function He(){return Le.useContext($e)??Te}function Oe(e,t){return null!=e?(0,Ie.jsx)(Be,{value:t,children:e}):e}var Ee=require("react");function De(e,t=30){return Math.max((e??4)+5,12,t)}function Fe(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}var Ne=[40,40],ze=[.5,.5];function We(e,t){const[o,n]=e.viewBox??Ne,[r,i]=e.anchor??ze,s=n>0?n:1,a=Math.max(0,t)/s,l=(o>0?o:s)*a,c=s*a;return{width:l,height:c,scale:a,offsetX:-r*l,offsetY:-i*c}}function qe(e,t){const o=We(e,t),n=[[o.offsetX,o.offsetY],[o.offsetX+o.width,o.offsetY],[o.offsetX,o.offsetY+o.height],[o.offsetX+o.width,o.offsetY+o.height]];let r=0;for(const[e,t]of n){const o=Math.sqrt(e*e+t*t);o>r&&(r=o)}return r}function Ge(e,t,o,n){if("none"!==e)return"color"===e||null==e?t??n:"accent"===e?o:e}var Ve=null;function Xe(e){if("undefined"==typeof Path2D)return null;Ve||(Ve=new Map);const t=Ve.get(e);if(t)return t;const o=new Path2D(e);return Ve.size>1024&&Ve.clear(),Ve.set(e,o),o}function Ye(e,t,o=0,n="horizontal"){const[r,i]=e.viewBox??Ne,s=Math.min(1,Math.max(0,o)),a=Math.min(1,Math.max(0,t));return a>s?s>0||1>a?"vertical"===n?{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 Ke(e,t){const o=We(e,t);return{centerDx:o.offsetX+o.width/2,centerDy:o.offsetY+o.height/2,halfWidth:o.width/2,halfHeight:o.height/2,radius:Math.hypot(o.width,o.height)/2}}function Ze(e,t,o,n,r,i=e=>e){for(const s of t.parts){const t=Xe(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:Ge(s.fill,o,n);c&&(e.fillStyle=i(c),e.fill(t));const u=r?s.stroke&&"none"!==s.stroke?r:void 0:Ge(s.stroke??"none",o,n);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)}}function Qe(e,t,o,n=30,r,i=0){let s=null;if(r){const e=function(e,t,o,n,r,i=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(n,r+5,12),c=t-l,u=t+l,d=o-l,h=o+l;let f=null,g=1/0;return e.visit((e,r,l,m,y)=>{if(r>u||c>m||l>h||d>y)return!0;if(!e.length){let r=e;do{const e=r.data,l=i(e)-t,c=s(e)-o,u=Math.sqrt(l*l+c*c);De(a(e),n)>=u&&g>u&&(f=e,g=u),r=r.next}while(r)}return!1}),f?{node:f,distance:g}:null}(r,t,o,n,i);e&&(s={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"rect":if(null==i.datum)break;e=Ue(i,t,o);break;case"point":if(r)break;e=Je(i,t,o,n);break;case"symbol":e=et(i,t,o,n);break;case"glyph":e=tt(i,t,o,n);break;case"wedge":if(null===i.datum)break;e=ot(i,t,o);break;case"boxplot":e=nt(i,t,o);break;case"violin":e=rt(i,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function Ue(e,t,o){const n=function(e,t,o){return o.x>e||e>o.x+o.w||o.y>t||t>o.y+o.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:o.x+o.w/2,cy:o.y+o.h/2}}(t,o,e);return n.hit?{datum:e.datum,x:n.cx,y:e.y,distance:0,category:e.group}:null}function Je(e,t,o,n=30){const r=t-e.x,i=o-e.y,s=Math.sqrt(r*r+i*i);return s>De(e.r,n)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function et(e,t,o,n=30){const r=t-e.x,i=o-e.y,s=Math.sqrt(r*r+i*i);return s>De(ne(e.size),n)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function tt(e,t,o,n=30){if(null==e.datum)return null;const r=Ke(e.glyph,e.size),i=e.x+r.centerDx,s=e.y+r.centerDy,a=t-i,l=o-s,c=Math.sqrt(a*a+l*l);return c>De(r.radius,n)?null:{datum:e.datum,x:i,y:s,distance:c}}function ot(e,t,o){const n=t-e.cx,r=o-e.cy,i=Math.sqrt(n*n+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;const s=Fe(Math.atan2(r,n)),a=Fe(e.startAngle),l=Fe(e.endAngle);if(!(a>l?s>=a||l>=s:s>=a&&l>=s))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function nt(e,t,o){const n=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-n>t||t>e.x+n||Math.min(e.minPos,e.maxPos)>o||o>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:e.stats}}else{const r=e.y-n,i=e.y+n;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>o||o>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function rt(e,t,o){if(!e.bounds)return null;const{x:n,y:r,width:i,height:s}=e.bounds;return n>t||t>n+i||r>o||o>r+s?null:{datum:e.datum,x:n+i/2,y:r+s/2,distance:0,category:e.category,stats:e.stats}}function it(e,t,o){const n=e.byGroup.get(t);let r=0,i=Math.abs(n[0].x-o.x);for(let e=1;n.length>e;e++){const t=Math.abs(n[e].x-o.x);i>t&&(i=t,r=e)}return n[r]._flatIndex}function st(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}var at=require("react"),lt={fresh:1,aging:.7,stale:.45,expired:.25},ct={alpha:1,band:"fresh",isStale:!1};var ut=require("react/jsx-runtime");function dt({isStale:e,position:t}){return(0,ut.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 ht=require("react"),ft=l(require("react")),gt=require("react/jsx-runtime"),mt={fill:(e,t)=>(0,gt.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,gt.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function yt(e,t,o,n,r){let i;return i="function"==typeof o?o(e):(0,mt[o])(n(e,t),r),i}function pt({swatchSize:e}){return(0,gt.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 bt(e,t,o){return o&&o.size>0?o.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var vt=(e,t,o,n,r,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:f}=e,g=[];let m=0;const y=!(!t&&!o),p="isolate"===c||void 0===c&&null!=r,{swatchSize:b,labelGap:v,rowHeight:x}=u;return f.forEach((e,c)=>{const u=yt(e,c,d,h,b),w=bt(e,n,r),k=r&&r.size>0&&r.has(e.label);g.push((0,gt.jsxs)("g",{transform:`translate(0,${m})`,onClick:t?()=>t(e):void 0,onMouseEnter:o?()=>o(e):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?a===i&&c===s?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&p?k||!1:void 0,"aria-current":y&&!p&&null!=n&&e.label===n||void 0,"aria-label":e.label,onKeyDown:y?o=>{if("Enter"!==o.key&&" "!==o.key||(o.preventDefault(),t&&t(e)),"ArrowDown"===o.key||"ArrowUp"===o.key){o.preventDefault();const e=(c+("ArrowDown"===o.key?1:-1)+f.length)%f.length;l(a,e);const t=o.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:y?t=>{l(a,c),o&&o(e);const n=t.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&(0,gt.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+v+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,k&&(0,gt.jsx)(pt,{swatchSize:b}),(0,gt.jsx)("text",{y:b/2,x:b+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),m+=x}),g};function xt({config:e,orientation:t="vertical",width:o=100}){const{colorFn:n,domain:r,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+ft.useId();if("horizontal"===t){const e=12,t=Math.min(o,200),s=Math.max(0,(o-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,gt.jsx)("stop",{offset:100*t+"%",stopColor:n(r[0]+t*(r[1]-r[0]))},e))}return(0,gt.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,gt.jsx)("defs",{children:(0,gt.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,gt.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,gt.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,gt.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),(0,gt.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,gt.jsx)("stop",{offset:100*t+"%",stopColor:n(r[1]-t*(r[1]-r[0]))},e))}return(0,gt.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,gt.jsx)("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,gt.jsx)("defs",{children:(0,gt.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,gt.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,gt.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),(0,gt.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function wt(e){const{legendGroups:t,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=function(e){const t=Math.max(1,e?.swatchSize??16),o=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:o,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(d),[f,g]=ft.useState(0),[m,y]=ft.useState(0),p=ft.useCallback((e,t)=>{g(e),y(t)},[]),b="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{let d=24;const h=[];return e.forEach((e,f)=>{d+=5,h.push((0,gt.jsx)("line",{stroke:"gray",x1:0,y1:d,x2:t,y2:d},"legend-top-line legend-symbol-"+f)),d+=8,e.label&&(d+=16,h.push((0,gt.jsx)("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),d+=8),h.push((0,gt.jsx)("g",{className:"legend-item",transform:`translate(0,${d})`,children:vt(e,o,n,r,i,s,a,f,l,c,u)},"legend-group-"+f)),d+=e.items.length*u.rowHeight+8}),h})({legendGroups:t||[],width:l,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:p,legendInteraction:s,metrics:h}):(({legendGroups:e,height:t,width:o,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=0;const f=[];e.forEach((e,t)=>{let g=0;e.label&&(g+=16);const m=((e,t,o,n,r,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:f,items:g}=e,m=[],{swatchSize:y,labelGap:p,itemGap:b,rowHeight:v,align:x}=u,w=!(!t&&!o),k="isolate"===c||void 0===c&&null!=r,S=g.map(e=>y+p+7*e.label.length),A=[];let M=0,C=0;S.forEach((e,t)=>{const o=0===C?e:C+b+e;d&&d>0&&C>0&&o>d?(A.push({start:M,end:t,width:C}),M=t,C=e):C=o}),g.length>0&&A.push({start:M,end:g.length,width:C}),A.forEach((e,c)=>{let u="center"===x?Math.max(0,((d??e.width)-e.width)/2):"end"===x?Math.max(0,(d??e.width)-e.width):0;for(let d=e.start;e.end>d;d++){const e=g[d],x=yt(e,d,h,f,y),A=bt(e,n,r),M=r&&r.size>0&&r.has(e.label);m.push((0,gt.jsxs)("g",{transform:`translate(${u},${c*v})`,onClick:t?()=>t(e):void 0,onMouseEnter:o?()=>o(e):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:w?a===i&&d===s?0:-1:void 0,role:w?"option":void 0,"aria-selected":w&&k?M||!1:void 0,"aria-current":w&&!k&&null!=n&&e.label===n||void 0,"aria-label":e.label,onKeyDown:w?o=>{if("Enter"!==o.key&&" "!==o.key||(o.preventDefault(),t&&t(e)),"ArrowRight"===o.key||"ArrowLeft"===o.key){o.preventDefault();const e=(d+("ArrowRight"===o.key?1:-1)+g.length)%g.length;l(a,e);const t=o.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:w?t=>{l(a,d),o&&o(e);const n=t.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:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[w&&(0,gt.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:y+p+2+7*e.label.length,height:y+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,M&&(0,gt.jsx)(pt,{swatchSize:y}),(0,gt.jsx)("text",{y:y/2,x:y+p,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+d)),u+=S[d]+b}});const j=Math.max(0,...A.map(e=>e.width)),_=A.length;return{items:m,offset:j,totalRows:_,totalHeight:_*v}})(e,n,r,i,s,a,l,t,c,u,d,d.maxWidth??o);g+=m.offset+5,f.push({label:e.label,...m,offset:g,totalRows:m.totalRows,totalHeight:m.totalHeight}),h+=g+12});const g=d.maxWidth??o;let m=h>g?0:"center"===d.align?Math.max(0,(g-h)/2):"end"===d.align?Math.max(0,g-h):0;const y=[];return f.forEach((o,n)=>{const r=e[n];r.label&&(y.push((0,gt.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:r.label},"legend-text-"+n)),m+=16),y.push((0,gt.jsx)("g",{className:"legend-item",transform:`translate(${m},0)`,children:o.items},"legend-group-"+n)),m+=o.offset+5,e[n+1]&&y.push((0,gt.jsx)("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(o.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+n)),m+=12}),(0,gt.jsx)("g",{children:y})})({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:o,customHoverBehavior:n,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:p,legendInteraction:s,metrics:h}),v=!(!o&&!n);return(0,gt.jsxs)("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"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,gt.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}),b]})}function kt(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}var St=require("react/jsx-runtime");function At(e){const{legend:t,totalWidth:o,totalHeight:n,margin:r,legendPosition:i="right",legendLayout:s,title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const f="top"===i||"bottom"===i,g=!!a,m=Math.max(0,o-r.left-r.right),y=Math.max(1,f?s?.maxWidth??m:100);let p,b;return"left"===i?(p=Math.max(4,r.left-y-10),b=r.top):"top"===i?(p=r.left,b=g?32:8):"bottom"===i?(p=r.left,b=n-r.bottom+38):(p=o-r.right+10,b=r.top),(0,St.jsx)("g",{transform:`translate(${p}, ${b})`,children:(v=t,"object"==typeof v&&null!==v&&"gradient"in v?(0,St.jsx)(xt,{config:t.gradient,orientation:f?"horizontal":"vertical",width:y}):kt(t)?(0,St.jsx)(wt,{legendGroups:t.legendGroups,title:"",width:y,orientation:f?"horizontal":"vertical",legendLayout:s,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t)});var v}var Mt=l(require("react")),Ct=require("react/jsx-runtime");function jt(e,t=120,o=8){if(!e)return[];const n=Math.max(1,Math.floor(t/o)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>n?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function _t(e,t,o,n){return"curly"===e?n?`M0,0 C${.6*o},0 ${.4*o},${t/2} ${o},${t/2} C${.4*o},${t/2} ${.6*o},${t} 0,${t}`:`M0,0 C0,${.6*o} ${t/2},${.4*o} ${t/2},${o} C${t/2},${.4*o} ${t},${.6*o} ${t},0`:n?`M0,0 L${o},0 L${o},${t} L0,${t}`:`M0,0 L0,${o} L${t},${o} L${t},0`}function Pt(e,t,o,n){if(!e)return(0,Ct.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,Ct.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(o)?"leftRight":"topBottom");let d=a;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>o?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const f=16,g=i?c?[i]:jt(i,l):[],m=r?c?[r]:jt(r,l):[],y="leftRight"===u?"end"===h?-4:4:0;let p=0;const b=[],v=n||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push((0,Ct.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===h?y-l:"middle"===h?y-l/2:y,y:-16,width:l,height:Math.max(f,(g.length+m.length)*f+(i&&r?2:0))+f,style:{overflow:"visible"},children:(0,Ct.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:v,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&(0,Ct.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),r&&(0,Ct.jsx)("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")):(g.length>0&&(b.push((0,Ct.jsx)("text",{className:"annotation-note-title",fill:v,textAnchor:h,fontWeight:"bold",children:g.map((e,t)=>(0,Ct.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-title")),p=g.length*f),m.length>0&&b.push((0,Ct.jsx)("text",{className:"annotation-note-label",fill:v,textAnchor:h,y:p,children:m.map((e,t)=>(0,Ct.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let x=null;if((i||r)&&(0!==t||0!==o))if("topBottom"===u){const e=Math.min(l,120);let t=0,o=e;"end"===h?(t=-e,o=0):"middle"===h&&(t=-e/2,o=e/2),x=(0,Ct.jsx)("line",{className:"note-line",x1:t,x2:o,y1:0,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(g.length+m.length)*f+(m.length>0?f:0);let t=0,o=e;"bottom"===d?(t=-e,o=0):"middle"===d&&(t=-e/2,o=e/2),x=(0,Ct.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:o,stroke:n||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,g.length+m.length-1)*f;let k=0;return"topBottom"===u?k=0>o?-(w+2):18:"leftRight"===u&&(k="middle"===d?-(w+f+(m.length>0&&g.length>0?2:0))/2+8:"bottom"===d||0>o?-(w+2):18),(0,Ct.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${o})`,children:[(0,Ct.jsx)("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0,children:b}),x]})}function Rt(e,t,o,n,r){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push((0,Ct.jsx)("circle",{r:e,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,n=t?.height||0;(e>0||n>0)&&i.push((0,Ct.jsx)("rect",{width:e,height:n,fill:"none",stroke:o||"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=n||0,s=r||0;if(void 0!==t?.x){const n=(t.x||0)-e;i.push((0,Ct.jsx)("line",{x1:n,y1:(t.y1||0)-s,x2:n,y2:(t.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const n=(t.y||0)-s;i.push((0,Ct.jsx)("line",{x1:(t.x1||0)-e,y1:n,x2:(t.x2||0)-e,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push((0,Ct.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push((0,Ct.jsx)("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",n=t?.width??t?.height;void 0!==n&&i.push((0,Ct.jsx)("path",{d:_t(e,n,t?.depth||30,void 0===t?.width),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,Ct.jsx)("g",{className:"annotation-subject",children:i})}function Lt(e,t,o,n,r,i){const s=[];let a=0,l=0;if("callout-circle"!==r&&"label"!==r||!i?.radius){if("callout-rect"===r&&i){const o=i.width||0,n=i.height||0;if(o>0||n>0){const r=o/2,i=n/2,s=e-r,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=o/2,d=n/2,h=e*d>t*u?u/e:d/t;a=r+s*h,l=i+c*h}}}else if("bracket"===r&&i){const e=i.width,t=i.height,o=i.depth||30;void 0!==e?(a=e/2,l=o):void 0!==t&&(a=o,l=t/2)}}else{const o=(i.radius||0)+(i.radiusPadding||0);if(o>0&&(0!==e||0!==t)){const n=Math.atan2(t,e);a=Math.cos(n)*o,l=Math.sin(n)*o}}const c=Math.sqrt((e-a)**2+(t-l)**2);if(c>.5){const r=n||"var(--semiotic-text-secondary, currentColor)",i="curve"===o?.type;let u=Math.atan2(t-l,e-a);if(i){const n=(a+e)/2,i=(l+t)/2,d=-(t-l)/c,h=(e-a)/c,f=(o?.curve??.25)*c,g=n+d*f,m=i+h*f;s.push((0,Ct.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${g},${m} ${e},${t}`,fill:"none",stroke:r},"connector-line")),u=Math.atan2(m-l,g-a)}else s.push((0,Ct.jsx)("line",{x1:a,y1:l,x2:e,y2:t,stroke:r},"connector-line"));if("arrow"===o?.end){const e=10,t=16/180*Math.PI;s.push((0,Ct.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,Ct.jsx)("g",{className:"annotation-connector",children:s})}function It(e){const{x:t=0,y:o=0,dx:n,dy:r,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:d,className:h,disable:f,opacity:g,strokeDasharray:m,events:y={},"data-testid":p}=e,b=Array.isArray(t)?t[0]??0:t,v=Array.isArray(o)?o[0]??0:o,x=new Set(Array.isArray(f)?f:[]);let w=n||0,k=r||0;null!=i&&(w=i-b),null!=s&&(k=s-v);const S="string"==typeof u?u:"label";if("bracket"===S&&c&&0===w&&0===k)if(void 0!==c.width){w=c.width/2;const e=c.depth||30;k=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;w=e+(0>e?-5:5),k=c.height/2}return(0,Ct.jsxs)("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${v})`,"data-testid":p,...null!=g&&{opacity:g},...m&&{strokeDasharray:m},...y,children:[!x.has("connector")&&Lt(w,k,l,d,S,c),!x.has("subject")&&Rt(S,c,d,b,v),!x.has("note")&&Pt(a,w,k,d)]})}function Tt(e){const{noteData:t}=e,{screenCoordinates:o}=t,n="string"==typeof t.type?t.type:"label",r=t.eventListeners||t.events||{};if(t.coordinates&&o){const e=t.nx||o[0][0]+(t.dx??0),r=t.ny||o[0][1]+(t.dy??0),i=o.map((o,i)=>{const s=Object.assign({},t,{note:0===i?t.note:{label:""},x:o[0],y:o[1],nx:e,ny:r});return(0,Ct.jsx)(It,{"data-testid":"semiotic-annotation",...s,type:n},"multi-annotation-"+i)});return(0,Ct.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,Ct.jsx)(It,{"data-testid":"semiotic-annotation",events:r,...t,type:n},s)}var $t=require("d3-hierarchy"),Bt=require("d3-shape"),Ht=l(require("regression"));function Ot(e,t){const o=t.scales?.x??t.scales?.time;return o?null!=e.x?o(e.x):t.xAccessor&&null!=e[t.xAccessor]?o(e[t.xAccessor]):null:null}function Et(e,t){const o=t.scales?.y??t.scales?.value;return o?null!=e.y?o(e.y):t.yAccessor&&null!=e[t.yAccessor]?o(e[t.yAccessor]):null:null}function Dt(e){return null==e?null:e+""}function Ft(e,t,o){return t.stickyPositionCache?.set(e,o),o}function Nt(e,t,o){const n=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===n){if(null!=e.pointId&&o.pointNodes&&o.pointNodes.length>0)for(let n=o.pointNodes.length-1;n>=0;n--){const r=o.pointNodes[n];if(r.pointId===e.pointId)return Ft(t,o,{x:r.x,y:r.y})}const n=function(e){const t=e.data;if(!t||0===t.length)return null;const o=t[t.length-1],n=e.scales?.x??e.scales?.time,r=e.scales?.y??e.scales?.value;if(!n||!r)return null;const i=o[e.xAccessor||"x"],s=o[e.yAccessor||"y"];return null==i||null==s?null:{x:n(i),y:r(s)}}(o);return n?Ft(t,o,n):null}if("semantic"===n){const n=function(e,t,o){const n=function(e){return Dt(e.provenance?.stableId??e.stableId)}(e);if(!n)return null;const r=o.pointNodes?.find(e=>Dt(e.pointId)===n);if(r)return Ft(t,o,{x:r.x,y:r.y});const i=o.data?.find(e=>function(e){return Dt(e.stableId??e.id??e.provenance?.stableId)}(e)===n);if(!i)return null;const s=Ot(i,o),a=Et(i,o);return null==s||null==a?null:Ft(t,o,{x:s,y:a})}(e,t,o);if(n)return n}let r=null,i=null;if(null!=e.pointId&&o.pointNodes){const t=o.pointNodes.find(t=>t.pointId===e.pointId);t&&(r=t.x,i=t.y)}if(null!=r&&null!=i||(r=Ot(e,o),i=Et(e,o)),null!=r&&null!=i)return Ft(t,o,{x:r,y:i});if("sticky"===n){const e=o.stickyPositionCache?.get(t);if(e)return e}return null}function zt(e,t,o,n=50){return!(-n>e||e>(o.width||0)+n||-n>t||t>(o.height||0)+n)}var Wt=require("react/jsx-runtime"),qt={secondary:0,primary:3};function Gt(e){return!0===e?._annotationDeferred}function Vt(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function Xt(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function Yt(e){return Math.max(.72,.95-.06*e)}var Kt=require("react/jsx-runtime"),Zt={linear:Bt.curveLinear,monotoneX:Bt.curveMonotoneX,monotoneY:Bt.curveMonotoneY,step:Bt.curveStep,stepAfter:Bt.curveStepAfter,stepBefore:Bt.curveStepBefore,basis:Bt.curveBasis,cardinal:Bt.curveCardinal,catmullRom:Bt.curveCatmullRom};var Qt=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function Ut(e){return!!e&&"object"==typeof e&&Qt.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function Jt(e){return"primary"===e?.emphasis||!0===e?.defensive}function eo(e,t,o={}){return"number"==typeof o.maxAnnotations&&Number.isFinite(o.maxAnnotations)?Math.max(0,Math.floor(o.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(o.areaPerAnnotation&&o.areaPerAnnotation>0?o.areaPerAnnotation:2e4))):1/0}function to(e){let t;const o=e?.emphasis;t="primary"===o?100:"secondary"===o?10:50;const n=e?.provenance?.confidence;switch("number"==typeof n&&Number.isFinite(n)&&(t+=15*Math.max(0,Math.min(1,n))),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 oo=32,no=6,ro=4,io=8,so=72;var ao={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function lo(e){if(!co(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 co(e){return Ut(e)}function uo(e,t){if(!e)return[];const o=Math.max(1,Math.floor(t/7)),n=e.split(/\s+/).filter(Boolean),r=[];let i="";for(const e of n)i&&i.length+e.length+1>o?(r.push(i),i=e):i=i?`${i} ${e}`:e;return i&&r.push(i),r}function ho(e,t,o,n,r){const i=e+o,s=t+n;return Math.abs(o)>Math.abs(n)?{x:0>o?i-r.width-4:i+4,y:0>n?s-r.height:s,width:r.width,height:r.height}:{x:0>o?i-r.width:i,y:0>n?s-r.height-4:s+4,width:r.width,height:r.height}}function fo(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function go(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 mo(e,t,o,n,r,i,s,a){const l=fo(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,o,n){const r=Math.max(0,n-e.x),i=Math.max(0,n-e.y);return(r+Math.max(0,e.x+e.width-(t-n)))*e.height+(i+Math.max(0,e.y+e.height-(o-n)))*e.width}(l,r,i,a);for(const e of o)c+=12*go(l,e);for(const e of n)c+=4*go(l,e);return c}function yo(e){const{annotations:t,context:o,defaultOffset:n=oo,notePadding:r=no,markPadding:i=ro,edgePadding:s=io,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=so,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:g,cohesion:m,audience:y}=e,p=o.width||0,b=o.height||0,v="object"==typeof g?g:{},x=v.breakpoint??480,w=!!g&&x>=p,k=w&&!1!==v.preferShortText?t.map(lo):t,S=w&&!u?{maxAnnotations:v.maxAnnotations??("callout-list"===v.strategy?1:2),minVisible:v.minVisible??1}:u,A=d||w&&(!1!==v.progressiveDisclosure||"callout-list"===v.strategy),M=w&&!f?v.responsive??{minWidth:x}:f,C=w&&!m?v.cohesion:m;if(0===k.length||0>=p||0>=b)return k.slice();const j=[],_=function(e,t){return(e.pointNodes||[]).map(e=>{const o=Math.max(1,e.r||1)+t;return{x:e.x-o,y:e.y-o,width:2*o,height:2*o}})}(o,i);let P=!1;const R=k.map((e,t)=>{if(!co(e))return e;const i=function(e,t,o){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const n=e.pointId??e.nodeId;if(null!=n&&o.pointNodes){const e=o.pointNodes.find(e=>e.pointId===n);if(e)return{x:e.x,y:e.y}}const r=e.coordinates,i=o.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 o=i([e,t]);if(o&&"number"==typeof o[0]&&"number"==typeof o[1])return{x:o[0],y:o[1]}}}return o.scales||"number"!=typeof e.x||"number"!=typeof e.y?Nt(e,t,o):{x:e.x,y:e.y}}(e,t,o);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,o=[...uo("string"==typeof e.title?e.title:void 0,t),...uo("string"==typeof e.label?e.label:void 0,t)],n=o.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*n)+10),height:Math.max(18,16*o.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 j.push(fo(ho(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),r)),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}]}(n)){const t=mo(ho(i.x,i.y,e.dx,e.dy,u),e,j,_,p,b,r,s);f>t&&(h=e,f=t)}if(!h)return e;const g=fo(ho(i.x,i.y,h.dx,h.dy,u),r);j.push(g);const m=Math.hypot(h.dx,h.dy),y=l&&m>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return P=!0,{...e,dx:h.dx,dy:h.dy,...y?{connector:y}:{}}}),L=P?R:k.slice();let I=L;if(h){let e=!1;const t=L.map(t=>{const o=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 o!==t&&(e=!0),o});I=e?t:L}{let e=!1;const t=I.map(t=>{if(!0!==t?.defensive)return t;const o=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const o="string"==typeof t.source?ao[t.source]??t.source:null,n="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!o&&!n)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[o,n].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${r})`)?e:{...e,label:i?`${i} (${r})`:`(${r})`}}(t);return o!==t&&(e=!0),o});I=e?t:I}const T=new Set;if(S){const e="object"==typeof S?S:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const o=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===o.length?3:o.reduce((e,t)=>e+t,0)/o.length}(e);return t>2?4>t?1:.6:1.5}(y),o=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??eo(p,b,e))*t))},{deferred:n}=function(e){const{annotations:t,width:o,height:n}=e,r=Math.max(0,e.minVisible??1),i=eo(o,n,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(o=e,Ut(o))};var o}),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=>Jt(e.annotation)),c=a.filter(e=>!Jt(e.annotation)).sort((e,t)=>to(t.annotation)-to(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))),d=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),h=[],f=[];for(const{annotation:e,index:t,note:o}of s)!o||d.has(t)?h.push(e):f.push(e);return{visible:h,deferred:f,budget:i}}({annotations:I,width:p,height:b,...o});for(const e of n)T.add(e)}if(M&&("object"==typeof M&&"number"==typeof M.minWidth?M.minWidth:480)>=p)for(const e of I)co(e)&&"secondary"===e.emphasis&&T.add(e);if(T.size>0)for(const e of I)!0===e?.defensive&&T.delete(e);let $;return $=0===T.size?I:A?I.map(e=>T.has(e)?{...e,_annotationDeferred:!0}:e):I.filter(e=>!T.has(e)),C?function(e,t){let o=!1;const n=e.map(e=>co(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(o=!0,{...e,cohesion:t}):e);return o?n:e}($,C):$}function po(e,t,o){return"exact"===o?function(e,t){const o=e.domain(),n=o[0],r=o[o.length-1],i=n instanceof Date,s=n instanceof Date?n.getTime():n,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 o=e===t-1?a:s+e*l;c[e]=i?new Date(o):o}return c}(e,t):e.ticks(t)}var bo=require("react/jsx-runtime");function vo(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,scales:s,showAxes:a,showGrid:l,rFormat:c}=e,{rTickValues:u,axisExtent:d}=e,h="radial"===s?.projection,f="horizontal"===s?.projection,g=(0,ht.useMemo)(()=>!s||h?[]:(u||po(s.r,5,d)).map(e=>({value:e,pixel:s.r(e),label:(c||xo)(e)})),[s,c,h,u,d]),m=l&&s&&!h,y=a&&s&&!h;return m||y?(0,bo.jsx)("svg",{width:n,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:(0,bo.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[m&&(0,bo.jsx)("g",{className:"ordinal-grid",children:g.map((e,n)=>(0,bo.jsx)("line",{x1:f?e.pixel:0,y1:f?0:e.pixel,x2:f?e.pixel:t,y2:f?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),y&&(0,bo.jsx)(bo.Fragment,{children:(0,bo.jsxs)(bo.Fragment,f?{children:[(0,bo.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,bo.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[(0,bo.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,bo.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function xo(e){return Math.round(100*e)/100+""}function wo(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,scales:s,showAxes:a,showCategoryTicks:l,oLabel:c,rLabel:u,oFormat:d,rFormat:h,showGrid:f,title:g,legend:m,legendHoverBehavior:y,legendClickBehavior:p,legendHighlightedCategory:b,legendIsolatedCategories:v,legendPosition:x="right",legendLayout:w,foregroundGraphics:k,annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:M,xAccessor:C,yAccessor:j,annotationData:_,underlayRendered:P,children:R}=e,L="radial"===s?.projection,I="horizontal"===s?.projection,T=!1!==l,$=(0,ht.useMemo)(()=>{if(!a||!T||!s||L)return[];const e=s.o.bandwidth(),t=s.o.domain().map((t,o)=>({value:t,pixel:(s.o(t)??0)+e/2,label:d?d(t,o):t}));if(2>=t.length)return t;const o=Math.abs(t[1].pixel-t[0].pixel)||e;let n,r=0,i=!1;for(const e of t)"string"==typeof e.label?r=Math.max(r,e.label.length):"number"==typeof e.label?r=Math.max(r,(e.label+"").length):i=!0;n=I?i?24:16:Math.max(6.5*r,i?60:0)+6;const l=Math.max(1,Math.ceil(n/o));return 1===l?t:t.filter((e,t)=>t%l===0)},[a,T,s,d,L,I]),B=e.rTickValues,H=e.tickLabelEdgeAlign,O=e.axisExtent,E=(0,ht.useMemo)(()=>a&&s&&!L?(B||po(s.r,5,O)).map(e=>({value:e,pixel:s.r(e),label:(h||xo)(e)})):[],[a,s,h,L,B,O]),D=(0,ht.useRef)(new Map),F=(0,ht.useRef)(S?.length??0),N=S?.length??0;F.current!==N&&(F.current=N,D.current=new Map);const z=(0,ht.useMemo)(()=>{if(!S||0===S.length)return null;const e=function(e,t,o){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const n=Nt(e,t,o);if(!n)return null;const{x:r,y:i}=n;if(!zt(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,Kt.jsx)(Tt,{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-"+t)}case"x-threshold":{const n=Ot(null!=e.value?{...e,x:e.value}:e,o);if(null==n)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:12;const a=n>.6*(o.width||0),l=a?n-4:n+4,c=a?"end":"start";return(0,Kt.jsxs)("g",{opacity:e.opacity,children:[(0,Kt.jsx)("line",{x1:n,y1:0,x2:n,y2:o.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,Kt.jsx)("text",{x:l,y:s,textAnchor:c,fill:r,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"y-threshold":{const n=Et(null!=e.value?{...e,y:e.value}:e,o);if(null==n)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let s,a;return"left"===i?(s=4,a="start"):"center"===i?(s=(o.width||0)/2,a="middle"):(s=(o.width||0)-4,a="end"),(0,Kt.jsxs)("g",{opacity:e.opacity,children:[(0,Kt.jsx)("line",{x1:0,y1:n,x2:o.width||0,y2:n,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,Kt.jsx)("text",{x:s,y:n-4,textAnchor:a,fill:r,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"enclose":{const n=(e.coordinates||[]).map(e=>({x:Ot({...e,type:"point"},o),y:Et({...e,type:"point"},o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>n.length)return null;const r=(0,$t.packEnclose)(n),i=e.padding||10;return(0,Kt.jsxs)("g",{children:[(0,Kt.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,Kt.jsx)("text",{x:r.x,y:r.y-r.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:e.label})]},"ann-"+t)}case"rect-enclose":{const n=(e.coordinates||[]).map(e=>({x:Ot({...e,type:"point"},o),y:Et({...e,type:"point"},o)})).filter(e=>null!=e.x&&null!=e.y);if(2>n.length)return null;const r=e.padding||10,i=n.map(e=>e.x),s=n.map(e=>e.y),[a,l]=le(i),[c,u]=le(s),d=a-r,h=l+r,f=c-r;return(0,Kt.jsxs)("g",{children:[(0,Kt.jsx)("rect",{x:d,y:f,width:h-d,height:u+r-f,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,Kt.jsx)("text",{x:(d+h)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:e.label})]},"ann-"+t)}case"highlight":{const n=o.data||[],r="function"==typeof e.filter?n.filter(e.filter):e.field&&null!=e.value?n.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return(0,Kt.jsx)("g",{children:r.map((t,n)=>{const r=Ot(t,o),s=Et(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,Kt.jsx)("circle",{cx:r,cy:s,r:a,...l},"hl-"+n)})},"ann-"+t)}case"bracket":{const n=Ot(e,o),r=Et(e,o);return(0,Kt.jsx)(Tt,{noteData:{x:n??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-"+t)}case"trend":{const n=o.data||[];if(2>n.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 d=[],h=new Map;if(s&&l&&c){for(const e of n){const t=e[l];if(null==t)continue;const o=t+"";h.has(o)||(h.set(o,d.length),d.push(o))}u=n.map(e=>{const t=e[l],o=e[c];if(null==t||null==o)return null;const n=h.get(t+"");return null!=n?[n,+o]:null}).filter(e=>null!==e)}else u=n.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,g=o.scales?.y??o.scales?.value;if(!f||!g)return null;const m=e=>t=>{const o=Math.max(0,Math.floor(t)),n=Math.min(d.length-1,o+1),r=t-o,i=e(d[o]);return i+(e(d[n])-i)*r},y=f,p=g;let b;if(s)if(a){const e=m(p);b=(t,o)=>[y(o),e(t)]}else{const e=m(y);b=(t,o)=>[e(t),p(o)]}else b=(e,t)=>[y(e),p(t)];const v=e.method||"linear";let x;x="loess"===v?function(e,t=.3){const o=e.length;if(2>o)return e.slice();const n=e.slice().sort((e,t)=>e[0]-t[0]),r=n.map(e=>e[0]),i=n.map(e=>e[1]),s=Math.max(2,Math.ceil(t*o)),a=[];for(let e=0;o>e;e++){const t=r[e],n=r.map(e=>Math.abs(e-t)),l=n.slice().sort((e,t)=>e-t)[Math.min(s-1,o-1)]||1,c=[];for(let e=0;o>e;e++){const t=0===l?0:n[e]/l;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;o>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],f+=t*r[e]*r[e],g+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const m=u*f-d*d;if(1e-12>Math.abs(m))a.push([t,h/u]);else{const e=(u*g-d*h)/m;a.push([t,(h-e*d)/u+e*t])}}return a}(u,e.bandwidth??.3):("polynomial"===v?Ht.default.polynomial(u,{order:e.order||2}):Ht.default.linear(u)).points;const w=x.map(([e,t])=>{const[o,n]=b(e,t);return`${o},${n}`}).join(" "),k=e.color||"#6366f1",S=x[x.length-1],[A,M]=b(S[0],S[1]);return(0,Kt.jsxs)("g",{children:[(0,Kt.jsx)("polyline",{points:w,fill:"none",stroke:k,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,Kt.jsx)("text",{x:A+4,y:M-4,fill:k,fontSize:11,children:e.label})]},"ann-"+t)}case"band":{const n=o.scales?.y??o.scales?.value,r=n?.(e.y0)??0,i=n?.(e.y1)??(o.height||0);return(0,Kt.jsxs)("g",{opacity:e.opacity,children:[(0,Kt.jsx)("rect",{x:0,y:Math.min(r,i),width:o.width||0,height:Math.abs(i-r),fill:e.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:e.fillOpacity||.1}),e.label&&(0,Kt.jsx)("text",{x:(o.width||0)-4,y:Math.max(Math.min(r,i),0)+13,textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"x-band":{const n=o.scales?.x??o.scales?.time,r=null!=e.x0&&n?n(e.x0):null,i=null!=e.x1&&n?n(e.x1):null;return null==r||null==i?null:(0,Kt.jsxs)("g",{opacity:e.opacity,children:[(0,Kt.jsx)("rect",{x:Math.min(r,i),y:0,width:Math.abs(i-r),height:o.height||0,fill:e.fill||e.color||"var(--semiotic-primary, #6366f1)",fillOpacity:e.fillOpacity??.1}),e.label&&(0,Kt.jsx)("text",{x:Math.min(r,i)+4,y:13,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"envelope":{const n=o.data||[];if(2>n.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=n.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 d=Zt[o.curve||"linear"]||Bt.curveLinear,h=(0,Bt.area)().x(e=>i(e[r])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(d)(u);if(!h)return null;const f=e.fill||"#6366f1";return(0,Kt.jsxs)("g",{children:[(0,Kt.jsx)("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,Kt.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-"+t)}case"anomaly-band":{const n=o.data||[];if(2>n.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=n.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),d=e.threshold??2,h=l-d*u,f=!1!==e.showBand,g=e.fill||"#6366f1",m=e.fillOpacity??.1,y=e.anomalyColor||"#ef4444",p=e.anomalyRadius??6,b=s(l+d*u),v=s(h),x=n.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>d*u});return(0,Kt.jsxs)("g",{children:[f&&(0,Kt.jsx)("rect",{x:0,y:Math.min(b,v),width:o.width||0,height:Math.abs(v-b),fill:g,fillOpacity:m}),x.map((e,t)=>{const n=Ot(e,o),r=Et(e,o);return null==n||null==r?null:(0,Kt.jsx)("circle",{cx:n,cy:r,r:p,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,Kt.jsx)("text",{x:(o.width||0)-4,y:Math.min(b,v)-4,textAnchor:"end",fill:g,fontSize:11,children:e.label})]},"ann-"+t)}case"forecast":{const n=o.data||[];if(3>n.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=n.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=Ht.default.polynomial(l,{order:e.order||2}).equation;c=e=>t.reduce((t,o,n)=>t+o*Math.pow(e,n),0)}else{const e=l.length;let t=0,o=0,n=0,r=0;for(const[e,i]of l)t+=e,o+=i,n+=e*e,r+=e*i;const i=e*n-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*o)/i,a=(o-s*t)/e;c=e=>a+s*e}const u=l.length,d=l.map(([e,t])=>t-c(e)).reduce((e,t)=>e+t*t,0),h=Math.sqrt(d/Math.max(u-2,1)),f=l.reduce((e,t)=>e+t[0],0)/u,g=l.reduce((e,t)=>e+(t[0]-f)**2,0),m=e.confidence??.95,y=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,p=e.steps??5,b=l[u-1][0],v=(b-l[0][0])/Math.max(u-1,1),x=[];for(let e=1;p>=e;e++)x.push(b+e*v);const w=[];for(const e of x){const t=c(e),o=h*Math.sqrt(1+1/u+(g>0?(e-f)**2/g:0))*y;w.push({x:e,yCenter:t,yUpper:t+o,yLower:t-o})}const k=`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(" "),A=`${s(b)},${a(c(b))}`,M=e.strokeColor||"#6366f1";return(0,Kt.jsxs)("g",{children:[(0,Kt.jsx)("path",{d:k,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,Kt.jsx)("polyline",{points:`${A} ${S}`,fill:"none",stroke:M,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&w.length>0&&(0,Kt.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-"+t)}case"widget":{let n,r;if(null!=e.px&&null!=e.py)n=e.px,r=e.py;else{const i=Nt(e,t,o);if(!i)return null;n=i.x,r=i.y}if(!zt(n,r,o))return null;const i=e.width??32,s=e.height??32;return(0,Kt.jsx)("foreignObject",{x:n+(e.dx??0)-i/2,y:r+(e.dy??0)-s/2,width:i,height:s,style:{overflow:"visible",pointerEvents:"auto"},children:(0,Kt.jsx)("div",{style:{width:i,height:s,display:"flex",alignItems:"center",justifyContent:"center"},children:e.content??(0,Kt.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"})})},"ann-"+t)}case"text":{const n=Nt(e,t,o);if(!n)return null;const{x:r,y:i}=n,s=r+(e.dx||0),a=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,Kt.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?Mt.cloneElement(c,{key:"ann-text-"+t}):(0,Kt.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,Kt.jsx)("line",{x1:r,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Mt.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+t)}case"category-highlight":{const n=e.category;if(null==n)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(n+"");if(null==c)return null;const u=l.bandwidth(),d=e.color||"var(--semiotic-primary, #4589ff)",h=e.opacity??.15,f=e.label;return(0,Kt.jsxs)("g",(o.projection?"vertical"===o.projection:l===s)?{children:[(0,Kt.jsx)("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),f&&(0,Kt.jsx)("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",children:f})]}:{children:[(0,Kt.jsx)("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),f&&(0,Kt.jsx)("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+t)}default:return null}},n="horizontal"===s?.projection,r=s?.o?e=>(s.o(e)??0)+s.o.bandwidth()/2:null,i={scales:s?{x:n?s.r:r||s.r,y:n&&r||s.r,time:s.r,value:s.r,o:s.o}:null,timeAxis:"x",xAccessor:C,yAccessor:j,width:t,height:o,data:_,frameType:"ordinal",projection:n?"horizontal":"vertical",stickyPositionCache:D.current};return function(e,t,o,n){const r=[];return e.forEach((e,i)=>{let s;if(o){const r=o(e,i,n);s=null!=r?r:t(e,i,n)}else s=t(e,i,n);s&&r.push({node:s,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(o=e.annotation,"primary"===o?.emphasis||"secondary"===o?.emphasis?o.emphasis:null),confidence:Xt(e.annotation),readingOrder:null,rank:1};var o}),o=t.some(e=>null!=e.emphasis||null!=e.confidence),n=e.some(e=>Gt(e.annotation)),r=e.some(e=>null!=Vt(e.annotation)),i=e.some(e=>"layer"===Vt(e.annotation));if(!o&&!n&&!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=qt[e.emphasis]);const a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:o,emphasis:n,readingOrder:r}=e,i=Gt(t.annotation);let s=t.node;if("primary"===n||"secondary"===n||null!=r){const e=null==n&&null!=r;s=(0,Wt.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+n,..."secondary"===n?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:Yt(r),"data-annotation-reading-order":r}:{},children:t.node},"annotation-emphasis-"+o)}const a=Vt(t.annotation);return a&&(s=(0,Wt.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+o)),i&&(s=(0,Wt.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+o)),s});return n&&a.unshift((0,Wt.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,Wt.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)}(A?yo({annotations:S,context:i,..."object"==typeof A?A:{}}):S,e,M,i)},[S,A,M,t,o,s,C,j,_]);return a||g||m||k||z&&z.length>0||f||R?(0,bo.jsxs)("svg",{role:"img",width:n,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,bo.jsx)("title",{children:"string"==typeof g?g:"Ordinal Chart"}),(0,bo.jsx)("desc",{children:"string"==typeof g?g+" — ordinal data visualization":"Ordinal data visualization"}),(0,bo.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[f&&s&&!L&&!P&&(0,bo.jsx)("g",{className:"ordinal-grid",children:E.map((e,n)=>(0,bo.jsx)("line",{x1:I?e.pixel:0,y1:I?0:e.pixel,x2:I?e.pixel:t,y2:I?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+n))}),a&&s&&!L&&(()=>{const e={fontSize:"var(--semiotic-tick-font-size, 12px)"},n={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return(0,bo.jsx)("g",{className:"ordinal-axes",children:(0,bo.jsxs)(bo.Fragment,I?{children:[(0,bo.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!P&&(0,bo.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),$.map((t,o)=>(0,bo.jsxs)("g",{transform:`translate(0,${t.pixel})`,children:[(0,bo.jsx)("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?(0,bo.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):(0,bo.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,bo.jsx)("div",{style:{textAlign:"right",userSelect:"none",...e},children:t.label})})]},"cat-"+o)),c&&(0,bo.jsx)("text",{x:15-i.left,y:o/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...n},children:c})]}),(0,bo.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!P&&(0,bo.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!P&&s?.r&&(()=>{const e=s.r(0);return e>1&&t-1>e?(0,bo.jsx)("line",{x1:e,y1:0,x2:e,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),E.map((t,n)=>{const r=H?0===n?"start":n===E.length-1?"end":"middle":"middle";return(0,bo.jsxs)("g",{transform:`translate(${t.pixel},${o})`,children:[(0,bo.jsx)("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,bo.jsx)("text",{y:18,textAnchor:r,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+n)}),u&&(0,bo.jsx)("text",{x:t/2,y:o+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...n},children:u})]})]}:{children:[(0,bo.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!P&&(()=>{const e=s?.r?s.r(0):o,n=0>e||e>o?o:e;return(0,bo.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),$.map((t,n)=>(0,bo.jsxs)("g",{transform:`translate(${t.pixel},${o})`,children:[(0,bo.jsx)("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?(0,bo.jsx)("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):(0,bo.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,bo.jsx)("div",{style:{textAlign:"center",userSelect:"none",...e},children:t.label})})]},"cat-"+n)),c&&(0,bo.jsx)("text",{x:t/2,y:o+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...n},children:c})]}),(0,bo.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!P&&(0,bo.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),E.map((t,o)=>(0,bo.jsxs)("g",{transform:`translate(0,${t.pixel})`,children:[(0,bo.jsx)("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,bo.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+o)),u&&(0,bo.jsx)("text",{x:15-i.left,y:o/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...n},children:u})]})]})})})(),z,k,R]}),g&&(0,bo.jsx)("text",{x:n/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 g?g:null}),At({legend:m,totalWidth:n,totalHeight:r,margin:i,legendPosition:x,title:g,legendLayout:w,legendHoverBehavior:y,legendClickBehavior:p,legendHighlightedCategory:b,legendIsolatedCategories:v})]}):null}function ko(e,t,o,n){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:o,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:n,fn:t}:{key:void 0,fn:null}}var So=require("react"),Ao=require("d3-selection"),Mo=require("d3-brush"),Co=l(require("react")),jo=require("react/jsx-runtime");function _o({width:e,height:t,totalWidth:o,totalHeight:n,margin:r,scales:i,onBrush:s}){const a=(0,So.useRef)(null),l=(0,So.useRef)(null),c=(0,So.useRef)(s);c.current=s;const u=(0,So.useRef)(i);u.current=i;const d=(0,So.useRef)(!1),h=(0,So.useRef)(null),f="horizontal"===i?.projection,g=(0,So.useRef)(f);g.current=f;const m=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:o}={}){const n=Co.useId().replace(/:/g,""),r=Co.useRef(o);return r.current=o,{description:t,descriptionId:"semiotic-brush-description-"+n,svgProps:{role:"region",tabIndex:0,"aria-label":e,"aria-describedby":"semiotic-brush-description-"+n,onKeyDown:Co.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:"Ordinal value range brush",onAction:e=>{const t=u.current,o=l.current;if(!t||!o||!a.current)return;const n=(0,Ao.select)(a.current).select(".brush-g");if("clear"===e.type)return d.current=!0,n.call(o.move,null),d.current=!1,h.current=null,void c.current(null);if(("left"===e.direction||"right"===e.direction)!=!!g.current)return;const r=t.r.domain(),[i,s]=[Math.min(...r),Math.max(...r)],f=(s-i)/20,m=h.current?.r??[i+.4*(s-i),i+.6*(s-i)],y="left"===e.direction||"down"===e.direction?-1:1;let[p,b]=m;if(e.resize)0>y?p=Math.max(i,p-f):b=Math.min(s,b+f);else{const e=b-p;p=Math.max(i,Math.min(s-e,p+y*f)),b=p+e}const v={r:[p,b]};d.current=!0,n.call(o.move,g.current?[t.r(p),t.r(b)]:[t.r(b),t.r(p)]),d.current=!1,h.current=v,c.current(v)}});return(0,So.useEffect)(()=>{if(!a.current)return;const o=(0,Ao.select)(a.current).select(".brush-g"),n=f?(0,Mo.brushX)():(0,Mo.brushY)();return n.extent([[0,0],[e,t]]),n.on("brush end",e=>{if(d.current)return;const t=u.current;if(!t)return;if(!e.selection)return h.current=null,void c.current(null);const[o,n]=e.selection;let r;r=g.current?[t.r.invert(o),t.r.invert(n)]:[t.r.invert(n),t.r.invert(o)];const i={r:r};h.current=i,c.current(i)}),o.call(n),l.current=n,o.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null),l.current=null}},[e,t,f]),(0,So.useEffect)(()=>{if(!i||!l.current||!h.current)return;if(!a.current)return;const e=h.current,t=(0,Ao.select)(a.current).select(".brush-g"),o=i.r(e.r[0]),n=i.r(e.r[1]);f?(d.current=!0,t.call(l.current.move,[o,n]),d.current=!1):(d.current=!0,t.call(l.current.move,[n,o]),d.current=!1)},[i,f]),(0,jo.jsxs)("svg",{ref:a,width:o,height:n,...m.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[(0,jo.jsx)("title",{children:m.svgProps["aria-label"]}),(0,jo.jsx)("desc",{id:m.descriptionId,children:m.description}),(0,jo.jsx)("g",{className:"brush-g",transform:`translate(${r.left},${r.top})`,style:{pointerEvents:"all"}})]})}var Po=l(require("react")),Ro=require("d3-shape");function Lo(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}function Io(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const o=Math.min(e.w,e.h)/2,n=e=>Math.max(0,Math.min(e??0,o));return{tl:n(t.tl),tr:n(t.tr),br:n(t.br),bl:n(t.bl)}}var To=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function $o(e){const{innerRadius:t,outerRadius:o,startAngle:n,endAngle:r}=e,i=0>=t;if(0>=(e.cornerRadius??0)||!e.roundStart&&!e.roundEnd){if(i){const e=To(o,n),t=To(o,r);return`M0,0 L${e.x},${e.y} A${o},${o} 0 ${r-n>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=To(o,n),s=To(o,r),a=To(t,r),l=To(t,n),c=r-n>Math.PI?1:0;return`M${e.x},${e.y} A${o},${o} 0 ${c} 1 ${s.x},${s.y} L${a.x},${a.y} A${t},${t} 0 ${c} 0 ${l.x},${l.y} Z`}const s=Math.max(0,Math.min(e.cornerRadius??0,(o-t)/2));if(0===s)return $o({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const a=Math.asin(Math.min(1,s/Math.max(1e-9,o-s))),l=i?0:Math.asin(Math.min(1,s/Math.max(1e-9,t+s))),c=r-n,u=e.roundStart&&e.roundEnd?c/2:c,d=!!e.roundStart&&u>a,h=!!e.roundEnd&&u>a;if(!d&&!h)return $o({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const f=n+(d?a:0),g=r-(h?a:0),m=n+(d?l:0),y=r-(h?l:0),p=To(o,f),b=To(o,g),v=(o-s)*Math.cos(a),x=To(v,n),w=To(v,r),k=i?null:To(t,y),S=i?null:To(t,m),A=i?0:(t+s)*Math.cos(l),M=i?null:To(A,n),C=i?null:To(A,r),j=g-f>Math.PI?1:0,_=i?0:y-m>Math.PI?1:0;let P="";if(d)P+=`M${x.x},${x.y}`,P+=` A${s},${s} 0 0 1 ${p.x},${p.y}`;else{const e=To(o,n);P+=`M${e.x},${e.y}`}if(h)P+=` A${o},${o} 0 ${j} 1 ${b.x},${b.y}`,P+=` A${s},${s} 0 0 1 ${w.x},${w.y}`;else{const e=To(o,r);P+=` A${o},${o} 0 ${j} 1 ${e.x},${e.y}`}if(i)P+=" L0,0";else{if(h)P+=` L${C.x},${C.y}`,P+=` A${s},${s} 0 0 1 ${k.x},${k.y}`;else{const e=To(t,r);P+=` L${e.x},${e.y}`}if(d)P+=` A${t},${t} 0 ${_} 0 ${S.x},${S.y}`,P+=` A${s},${s} 0 0 1 ${M.x},${M.y}`;else{const e=To(t,n);P+=` A${t},${t} 0 ${_} 0 ${e.x},${e.y}`}}return P+=" Z",P}function Bo(e){const t=$o({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),o=[],n=e.colors;if(n.length>0){const t=(e.endAngle-e.startAngle)/n.length;for(let r=0;n.length>r;r++)o.push({d:$o({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+r*t,endAngle:e.endAngle}),color:n[r]})}return{clipPath:t,slices:o}}var Ho=require("react/jsx-runtime"),Oo={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function Eo(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}function Do(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}var Fo="undefined"==typeof window||"undefined"==typeof document,No=require("react"),zo="undefined"!=typeof window?No.useLayoutEffect:No.useEffect,Wo=()=>()=>{},qo=()=>!1,Go=()=>!0,Vo=require("react");function Xo(e,t){const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;if(!Object.is(e[n],t[n]))return!1}return!0}function Yo(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(!Object.is(e[o],t[o]))return!1;return!0}function Ko(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 Zo=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Qo=new WeakMap,Uo=0,Jo=!1,en=null,tn=null;function on(e,t){if(!t)return t;const o=Zo.exec(t);if(!o)return t;const n=e.canvas;if(!n)return o[2]?.trim()||t;!function(){if(Jo)return;if("undefined"==typeof window||"undefined"==typeof document)return;Jo=!0;const e=()=>{Uo++};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{en=window.matchMedia("(prefers-color-scheme: dark)"),tn=e,"function"==typeof en.addEventListener?en.addEventListener("change",tn):"function"==typeof en.addListener&&en.addListener(tn)}catch{}}();let r=Qo.get(n);r&&r.version===Uo||(r={version:Uo,map:new Map},Qo.set(n,r));const i=r.map.get(t);if(void 0!==i)return i;const s=getComputedStyle(n).getPropertyValue(o[1]).trim()||o[2]?.trim()||t;return r.map.set(t,s),s}var nn=l(require("react")),rn=l(require("react")),sn=(require("react/jsx-runtime"),rn.createContext(null));function an(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[o,n]of Object.entries(e))o.startsWith("_")||null!=n&&""!==n&&("number"==typeof n?Number.isFinite(n)&&(t[o]=n):"string"==typeof n?t[o]=n:"boolean"==typeof n?t[o]=n+"":n instanceof Date&&(t[o]=n.toISOString().slice(0,10)));return t}function ln(e){return e&&"object"==typeof e?e:{}}function cn(e){return ln(e.accessibility).tableFields??e.accessibleDatum??e.datum}var un=require("react/jsx-runtime"),dn={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function hn(e,t){if(!e||0===e.length)return t+", empty";const o={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";o[e]=(o[e]||0)+1}if(0===Object.keys(o).length)return t+", empty";const n=[],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(o).sort((e,t)=>{const o=i.indexOf(e),n=i.indexOf(t);return(-1===o?999:o)-(-1===n?999:n)});for(const e of s)n.push(`${o[e]} ${r[e]||e}`);return`${t}, ${n.join(", ")}`}var fn=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},gn="semiotic-accessible-data-table",mn=gn+" semiotic-accessible-data-table-hidden",yn=gn+" semiotic-accessible-data-table-visible",pn={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"},bn={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},vn={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)"},xn={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},wn={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))"},kn={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Sn={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},An={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 Mn({scene:e,chartType:t,tableId:o,chartTitle:n}){const[r,i]=nn.useState(!1),[s,a]=nn.useState(5),l=rn.useContext(sn),c=l?.visible??!1,u=r||c,d=nn.useRef(null),h=n?"Data summary for "+n:o?`Data summary for ${t} ${o}`:"Data summary for "+t;nn.useEffect(()=>{u||a(5)},[u]);const f=nn.useCallback(e=>{e.target===e.currentTarget&&(r||c||i(!0))},[r,c]),g=nn.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return o?(0,un.jsx)("span",{id:o,tabIndex:-1,style:dn}):null;if(!u)return(0,un.jsx)("div",{id:o,className:mn,tabIndex:-1,onFocus:f,style:dn,role:"region","aria-label":h,children:(0,un.jsxs)("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const m=function(e){const t=[];if(!Array.isArray(e))return t;const o=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const n of e)if(n&&"object"==typeof n&&null!==n.datum)try{switch(n.type){case"point":if(o)break;t.push({label:"Point",values:an(cn(n))});break;case"line":case"area":{const e=cn(n),o=Array.isArray(e)?e:[],r="line"===n.type?"Line point":"Area point";for(const e of o)t.push({label:r,values:an(e)});break}case"rect":{const e=cn(n),o=null!=e&&"object"==typeof e?e:{},r=o.category??n.group??"",i=o.value??o.__aggregateValue??o.total,s=an(o);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=an(cn(n));null==e.value&&"number"==typeof n.value&&Number.isFinite(n.value)&&(e.value=n.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=cn(n),o=an(e);if(null==o.category){const t=ln(e),n=t.category??t.label;null!=n&&(o.category=n+"")}t.push({label:"Wedge",values:o});break}case"circle":t.push({label:"Node",values:an(cn(n))});break;case"arc":t.push({label:"Arc",values:an(cn(n))});break;case"candlestick":t.push({label:"Candlestick",values:an(cn(n))});break;case"geoarea":{const e=ln(cn(n)),o=an(e);if(null==o.name){const t=ln(e.properties).name??e.name;null!=t&&(o.name=t+"")}t.push({label:"Region",values:o});break}}}catch{}return t}(e),y=function(e){if(!e||0===e.length)return[];const t=new Set;for(const o of e)if(o&&o.values)for(const e of Object.keys(o.values))t.add(e);const o=[];for(const n of t){const t=[],r=new Set;for(const o of e){if(!o||!o.values)continue;const e=o.values[n];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 o of t)e>o&&(e=o),o>r&&(r=o),i+=o;o.push({name:n,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);o.push({name:n,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return o}(m),p=function(e,t){const o=[e+" data points."];for(const e of t)if(e.numeric)o.push(`${e.name}: ${fn(e.min)} to ${fn(e.max)}, mean ${fn(e.mean)}.`);else{const t=e.uniqueValues,n=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");o.push(`${e.name}: ${n}.`)}return o.join(" ")}(m.length,y),b=Math.min(s,m.length),v=m.slice(0,b),x=m.length-b,w=new Set;for(const e of v)for(const t of Object.keys(e.values))w.add(t);const k=Array.from(w);return(0,un.jsxs)("div",{ref:d,id:o,className:yn,tabIndex:-1,onBlur:g,style:pn,role:"region","aria-label":h,children:[(0,un.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:vn,children:"×"}),(0,un.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:bn,children:p}),(0,un.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:xn,children:[(0,un.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:Sn,children:x>0?`First ${b} of ${m.length} data points`:`All ${m.length} data points`}),(0,un.jsx)("thead",{children:(0,un.jsxs)("tr",{children:[(0,un.jsx)("th",{style:wn,children:"type"}),k.map(e=>(0,un.jsx)("th",{style:wn,children:e},e))]})}),(0,un.jsx)("tbody",{children:v.map((e,t)=>(0,un.jsxs)("tr",{children:[(0,un.jsx)("td",{style:kn,children:e.label}),k.map(t=>{return(0,un.jsx)("td",{style:kn,children:(o=e.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":fn(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},t))})]}),x>0&&(0,un.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:An,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function Cn({summary:e}){return e?(0,un.jsx)("div",{role:"note",style:dn,children:e}):null}function jn({tableId:e}){return(0,un.jsx)("a",{href:"#"+e,style:dn,onClick:t=>{t.preventDefault();const o=document.getElementById(e);o&&requestAnimationFrame(()=>o.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,dn)},children:"Skip to data table"})}function _n({hoverPoint:e}){let t="";if(e){const o=e.data||e;t="object"==typeof o?"Data point: "+Object.entries(o).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+o}return(0,un.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:dn,children:t})}var Pn=require("react/jsx-runtime"),Rn="var(--semiotic-focus, #005fcc)";function Ln({active:e,hoverPoint:t,margin:o,size:n,shape:r="circle",width:i,height:s,pathData:a}){if(!e||!t)return null;const l=t.x+o.left,c=t.y+o.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,Pn.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Rn,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,Pn.jsx)("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:Rn,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Rn,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,Pn.jsx)("g",{transform:`translate(${o.left},${o.top})`,children:(0,Pn.jsx)("path",{d:a,fill:"none",stroke:Rn,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,Pn.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:n[0],height:n[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var In=l(require("react"));function Tn(e){return Array.isArray(e)?e[0]:e}function $n(e,t,o,n){return{data:Tn(e),x:t,y:o,__semioticHoverData:!0,...n}}var Bn=["name","label","title"],Hn=["type","kind","category","group","class","status","role","shape"],On=["value","amount","total","count","weight","score"],En=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 Dn(e,t){for(const o of t){const t=e.find(e=>e.lower===o);if(t)return t}}var Fn=require("react/jsx-runtime"),Nn={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 zn(e,t){return"function"==typeof t?t(e):e[t]}function Wn(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 qn(e={}){const{fields:t,title:o,format:n,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(o){const t=zn(e,o);s=Wn(t,n)}if(t&&t.length>0)t.forEach(t=>{let o,r,i;"string"==typeof t?(o=t,r=t,i=n):(o=t.label,r=t.accessor||t.key||"",i=t.format||n);const s=zn(e,r);a.push({label:o,value:Wn(s,i)})});else if(!o){const t=["value","y","name","id","label"];for(const o of t)if(void 0!==e[o]){s=Wn(e[o],n);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=Wn(e[t[0]],n))}}const l={...Nn,...r};return(0,Fn.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,Fn.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,Fn.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,Fn.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function Gn(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let o=Tn(!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);("node"===e?.nodeOrEdge&&"number"==typeof o?.x0&&"number"==typeof o?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof o?.sankeyWidth)&&o.data&&"object"==typeof o.data&&(o=o.data);const n=t(o);return null==n?null:(0,Fn.jsx)("div",{className:"semiotic-tooltip",style:Nn,children:n})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?qn(e):qn())}}var Vn=require("react/jsx-runtime");function Xn({x:e,y:t,containerWidth:o,containerHeight:n,margin:r,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=In.useRef(null),[u,d]=In.useState(null);In.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();d(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[i,s,o,n]);let h;h=u?`translate(${u.width+12>o-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>n-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*n>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!In.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const o=e.props;if(!0===o["data-semiotic-tooltip-chrome"])return!0;if("true"===o["data-semiotic-tooltip-chrome"])return!0;const n=o.style;if(n&&"object"==typeof n){if(null!=n.background&&""!==n.background&&"transparent"!==n.background)return!0;if(null!=n.backgroundColor&&""!==n.backgroundColor&&"transparent"!==n.backgroundColor)return!0}return!1}(i),g=f?null:Nn;return l?(0,Vn.jsx)("div",{ref:c,className:f?s:(s+" semiotic-tooltip").trim(),style:{...g||{},position:"absolute",left:r.left+e,top:r.top+t,transform:h,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var Yn=l(require("react")),Kn=require("react"),Zn=require("react"),Qn=require("react/jsx-runtime");function Un(e){let t=null;const o=()=>(t||(t=(0,Zn.createContext)(null)),t),n=Jn(e);return[function({children:t,initialState:n}){const r=(0,Zn.useRef)(n),i=(0,Zn.useMemo)(()=>Jn(e,r.current),[]),s=o();return(0,Qn.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const r=o(),i=(0,Zn.useContext)(r)??n,s=(0,Zn.useRef)(e);s.current=e;const a=(0,Zn.useRef)({hasValue:!1,value:void 0}),l=(0,Zn.useCallback)(()=>{const e=s.current(i.getState()),o=a.current;return o.hasValue&&t&&t(o.value,e)?o.value:(a.current={hasValue:!0,value:e},e)},[i,t]),c=(0,Zn.useCallback)(()=>s.current(i.getState()),[i]);return(0,Zn.useSyncExternalStore)(i.subscribe,l,c)}]}function Jn(e,t){const o=new Set;let n={...e(function(e){const t=e(n);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){n={...n,...t};for(const e of o)e()}}),...t??{}};return{getState:()=>n,subscribe:function(e){return o.add(e),()=>{o.delete(e)}}}}function er(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 tr(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:or}}),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 or=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],nr={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}},rr={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}},ir={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:or,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 sr(e,t){if("light"===t)return nr;if("dark"===t)return rr;if("high-contrast"===t)return ir;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?rr:nr;return tr({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return tr({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[ar,lr]=Un(e=>({theme:nr,setTheme(t){e(e=>({theme:sr(e.theme,t)}))}})),cr=require("react");var ur=require("react"),dr="undefined"==typeof window?Kn.useEffect:Kn.useLayoutEffect,hr={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function fr(e,t,o){return"function"==typeof e?e({size:t,margin:o}):e}function gr(e){const t=function(){const[e,t]=(0,cr.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,cr.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 o=e;return o.addListener(t),()=>o.removeListener(t)}(e,e=>t(e.matches))},[]),e}(),o=(0,Kn.useRef)(t);o.current=t;const[n,r]=function(e,t,o){const n=(0,ur.useRef)(null),[r,i]=(0,ur.useState)(null);return(0,ur.useEffect)(()=>{if(!t&&!o)return;const e=n.current;if(!e)return;const r=new ResizeObserver(e=>{for(const t of e){const{width:e,height:o}=t.contentRect;i(t=>t&&t.w===e&&t.h===o?t:{w:e,h:o})}});return r.observe(e),()=>r.disconnect()},[t,o]),[n,[t&&r?r.w:e[0],o&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=(0,Kn.useMemo)(()=>({...e.marginDefault,...e.userMargin}),[e.marginDefault,e.userMargin]),s=r[0]-i.left-i.right,a=r[1]-i.top-i.bottom,l=fr(e.foregroundGraphics,r,i),c=fr(e.backgroundGraphics,r,i),u=lr(e=>e.theme),{transition:d,introEnabled:h}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const o="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:!(o||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),f="semiotic-table-"+Yn.useId(),g=(0,Kn.useRef)(null),m=(0,Kn.useRef)(e.frameScheduler??hr);m.current=e.frameScheduler??hr;const y=(0,Kn.useRef)(null),p=(0,Kn.useRef)(!1),b=(0,Kn.useRef)(()=>{}),v=(0,Kn.useCallback)(()=>{if(null!==g.current||p.current)return;const e=m.current;let t=!1,o=!1;const n=e.requestAnimationFrame(()=>{t=!0;const e=!o;e&&(p.current=!0),g.current=null,y.current=null;try{b.current()}finally{e&&(p.current=!1)}});o=!0,t||(g.current=n,y.current=e)},[]),x=(0,Kn.useCallback)(()=>{null!==g.current&&((y.current??m.current).cancelAnimationFrame(g.current),g.current=null,y.current=null)},[]);(0,Kn.useEffect)(()=>()=>{x()},[x]);const w=(0,Kn.useRef)(()=>{}),k=(0,Kn.useRef)(()=>{}),S=(0,Kn.useRef)(null),A=(0,Kn.useRef)(null),M=(0,Kn.useRef)(null),C=(0,Kn.useCallback)(()=>{const e=S.current;S.current=null,e&&w.current(e)},[]),j=(0,Kn.useCallback)(e=>{if(S.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===A.current){const e=m.current;let t=!1;const o=e.requestAnimationFrame(()=>{t=!0,A.current=null,M.current=null,C()});t||(A.current=o,M.current=e)}},[C]),_=(0,Kn.useCallback)(()=>{S.current=null,null!==A.current&&((M.current??m.current).cancelAnimationFrame(A.current),A.current=null,M.current=null),k.current()},[]);(0,Kn.useEffect)(()=>()=>{S.current=null,null!==A.current&&((M.current??m.current).cancelAnimationFrame(A.current),A.current=null,M.current=null)},[]);const P=e.themeDirtyRef;return dr(()=>{P&&(Uo++,P.current=!0,v())},[u,v,P]),{reducedMotion:t,reducedMotionRef:o,responsiveRef:n,size:r,margin:i,adjustedWidth:s,adjustedHeight:a,resolvedForeground:l,resolvedBackground:c,currentTheme:u,transition:d,introEnabled:h,tableId:f,rafRef:g,renderFnRef:b,scheduleRender:v,cancelRender:x,hoverHandlerRef:w,hoverLeaveRef:k,onPointerMove:j,onPointerLeave:_}}function mr(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function yr(e,t,o=.3){mr(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function pr(e,t,o=.6){if(!mr(t))return;const n=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,n,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*o,e.stroke()}function br(e,t,o,n=.35){mr(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",o?e.fill(o):e.fill())}function vr(e,t){const o=e.fillStyle,n="#010203";try{e.fillStyle=n,e.fillStyle=t}catch{return e.fillStyle=o,[78,121,167]}const r=e.fillStyle;if(e.fillStyle=o,"string"!=typeof r)return[78,121,167];if(r.toLowerCase()===n&&t.trim().toLowerCase()!==n)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]}function xr(e,t,o){return null==t?o:"string"!=typeof t?t:on(e,t)||o}function wr(e,t,o,n,r,i,s){if("colorStops"in t){const o=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>o.length)return null;const a=e.createLinearGradient(n,r,i,s);for(const e of o)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)),d=e.createLinearGradient(n,r,i,s),[h,f,g]=vr(e,o);return d.addColorStop(0,`rgba(${h},${f},${g},${c})`),d.addColorStop(1,`rgba(${h},${f},${g},${u})`),d}function kr(e,t){const{x:o,y:n,w:r,h:i}=t,{tl:s,tr:a,br:l,bl:c}=Io(t);e.beginPath(),e.moveTo(o+s,n),e.lineTo(o+r-a,n),a>0&&e.arcTo(o+r,n,o+r,n+a,a),e.lineTo(o+r,n+i-l),l>0&&e.arcTo(o+r,n+i,o+r-l,n+i,l),e.lineTo(o+c,n+i),c>0&&e.arcTo(o,n+i,o,n+i-c,c),e.lineTo(o,n+s),s>0&&e.arcTo(o,n,o+s,n,s),e.closePath()}function Sr(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}}}require("d3-shape");var Ar=(e,t,o,n)=>{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)Mr(e,t);else if(t.cornerRadii&&Lo(t.cornerRadii)){const o=xr(e,t.style.fill,on(e,"var(--semiotic-primary, #007bff)")),n=Sr(t),r=t.fillGradient&&"string"==typeof o?wr(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=r||o,kr(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=on(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const o=xr(e,t.style.fill,on(e,"var(--semiotic-primary, #007bff)")),n=Sr(t),r=t.fillGradient&&"string"==typeof o?wr(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=r||o;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=on(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const o=xr(e,t.style.fill,on(e,"var(--semiotic-primary, #007bff)")),n=Sr(t),r=t.fillGradient&&"string"==typeof o?wr(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=r||o,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=on(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}yr(e,t),e.globalAlpha=1}};function Mr(e,t){const o=t.style.icon,n=t.style.iconPadding||2,r=Math.min(t.w,t.h)-n;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+n,s=t.x+(t.w-r)/2;for(let n=t.y+t.h-r;n>=t.y-r;n-=i)e.drawImage(o,s,n,r,r)}else{const i=r+n,s=t.y+(t.h-r)/2;for(let n=t.x;t.x+t.w>n;n+=i)e.drawImage(o,n,s,r,r)}e.restore()}var Cr=(e,t,o,n)=>{const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{const t=e.globalAlpha;for(const o of r)e.beginPath(),e.arc(o.x,o.y,o.r,0,2*Math.PI),e.globalAlpha=t*(o.style.opacity??o.style.fillOpacity??1),e.fillStyle=xr(e,o.style.fill,"#4e79a7"),e.fill(),o.style.stroke&&(e.strokeStyle=xr(e,o.style.stroke,o.style.stroke),e.lineWidth=o.style.strokeWidth||1,e.stroke()),pr(e,o)}finally{e.restore()}}},jr=new Map;function _r(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let o=jr.get(t);return o||(o=new Path2D(oe(e.symbolType,e.size)),jr.size>256&&jr.clear(),jr.set(t,o)),o}catch{return null}}var Pr=(e,t)=>{const o=e.globalAlpha;for(const n of t){if("symbol"!==n.type)continue;const t=n;if(0>=t.size)continue;const r=_r(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=o*i*(t.style.fillOpacity??1),e.fillStyle=xr(e,t.style.fill,"#4e79a7"),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=o*i,e.strokeStyle=xr(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth??1,e.stroke(r)),e.restore()}e.globalAlpha=o};function Rr(e,t,o,n,r){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=We(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 o=xr(e,t,t);return"string"==typeof o?o:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(o,n),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=Ye(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&Ze(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),Ze(e,i,c,t.accent,void 0,l),e.restore()}var Lr=require("d3-shape");function Ir(e,t){const o=t._gradientBand.colors;if(0===o.length)return;const{clipPath:n,slices:r}=Bo({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds?.start??!0,roundEnd:t.roundedEnds?.end??!0,colors:o}),i=new Path2D(n);e.save(),e.translate(t.cx,t.cy),e.clip(i);for(const t of r)e.fillStyle=on(e,t.color)||t.color||"#007bff",e.fill(new Path2D(t.d));e.restore(),t.style.stroke&&"none"!==t.style.stroke&&(e.save(),e.translate(t.cx,t.cy),e.strokeStyle=on(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(i),e.restore())}function Tr(e,t){e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath()}function $r(e,t){const o={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},n=(0,Lr.arc)().cornerRadius(t.cornerRadius)(o);if(!n)return;e.save(),e.translate(t.cx,t.cy);const r=new Path2D(n);e.fill(r),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(r),e.restore()}var Br=(e,t,o,n)=>{const r=t.filter(e=>"wedge"===e.type);for(const t of r)if(e.globalAlpha=(t.style.fillOpacity??1)*(t.style.opacity??1),t._gradientBand&&t._gradientBand.colors.length>0)Ir(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(Tr(e,t),br(e,t)),e.globalAlpha=1;else{if(e.fillStyle=("string"==typeof t.style.fill?on(e,t.style.fill):t.style.fill)||"#007bff",t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=on(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const o=$o({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});e.save(),e.translate(t.cx,t.cy);const n=new Path2D(o);e.fill(n),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(n),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=on(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),$r(e,t)):(Tr(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=on(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(Tr(e,t),br(e,t)),e.globalAlpha=1}},Hr=(e,t,o,n)=>{const r=t.filter(e=>"boxplot"===e.type);for(const t of r){const o=t.columnWidth/2,n="vertical"===t.projection,r=on(e,"var(--semiotic-primary, #007bff)"),i=on(e,"var(--semiotic-text, #333)"),s=t.style.fill,a="string"==typeof s?on(e,s)||s:s??r,l=t.style.stroke,c="string"==typeof l?on(e,l)||l:i,u=t.style.strokeWidth||1,d=t.style.fillOpacity??t.style.opacity??.6;if(e.save(),e.strokeStyle=c,e.lineWidth=u,e.beginPath(),n?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),n?(e.moveTo(t.x-.4*o,t.minPos),e.lineTo(t.x+.4*o,t.minPos),e.moveTo(t.x-.4*o,t.maxPos),e.lineTo(t.x+.4*o,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*o),e.lineTo(t.minPos,t.y+.4*o),e.moveTo(t.maxPos,t.y-.4*o),e.lineTo(t.maxPos,t.y+.4*o)),e.stroke(),e.globalAlpha=d,e.fillStyle=a,n){const n=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-o,n,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-o,n,t.columnWidth,r)}else{const n=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(n,t.y-o,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(n,t.y-o,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),n?(e.moveTo(t.x-o,t.medianPos),e.lineTo(t.x+o,t.medianPos)):(e.moveTo(t.medianPos,t.y-o),e.lineTo(t.medianPos,t.y+o)),e.stroke(),e.restore()}},Or=(e,t,o,n)=>{const r=t.filter(e=>"violin"===e.type);for(const t of r){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const o=new Path2D(t.pathString);if(e.globalAlpha=t.style.fillOpacity??t.style.opacity??.6,e.fillStyle=("string"==typeof t.style.fill?on(e,t.style.fill):t.style.fill)||"#007bff",e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=on(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(o)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const o=t.iqrLine.centerPos,n=!1!==t.iqrLine.isVertical;e.beginPath(),n?(e.moveTo(o,t.iqrLine.q1Pos),e.lineTo(o,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,o),e.lineTo(t.iqrLine.q3Pos,o)),e.stroke(),e.beginPath(),n?e.arc(o,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,o,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Er=(e,t,o,n)=>{const r=t.filter(e=>"connector"===e.type);if(0===r.length)return;const i=new Map;for(const e of r){const t=e.group||"_default";i.has(t)||i.set(t,[]),i.get(t).push(e)}for(const[,t]of i){if(0===t.length)continue;const o=t[0].style;if(o.fill&&"none"!==o.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const o of t)e.lineTo(o.x2,o.y2);e.closePath(),e.globalAlpha=o.fillOpacity??o.opacity??.3,e.fillStyle=o.fill,e.fill(),e.globalAlpha=1}for(const o of t)e.beginPath(),e.moveTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.strokeStyle=on(e,o.style.stroke)||("string"==typeof o.style.fill?on(e,o.style.fill):o.style.fill)||on(e,"var(--semiotic-border, #999)"),e.lineWidth=o.style.strokeWidth||1,e.globalAlpha=o.style.opacity??.5,e.stroke(),e.globalAlpha=1}},Dr=(e,t,o,n)=>{const r=t.filter(e=>"trapezoid"===e.type);for(const t of r){const o=t.points;if(o.length>=4){e.globalAlpha=t.style?.opacity??1,e.beginPath(),e.moveTo(o[0][0],o[0][1]);for(let t=1;o.length>t;t++)e.lineTo(o[t][0],o[t][1]);e.closePath(),e.fillStyle=t.style?.fill||"#999",e.fill(),t.style?.stroke&&(e.strokeStyle=on(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function Fr(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Nr(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}var zr=null;function Wr(e={},t){const{background:o="transparent",stroke:n="#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):(zr||(zr=document.createElement("canvas")),zr.width=e,zr.height=e,zr)}(a)}catch{return null}const c=l.getContext("2d");if(!c)return null;o&&"transparent"!==o?(c.fillStyle=o,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=n,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")}var qr=new Map;function Gr(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,n=qr.get(o);if(void 0!==n)return n;const r=Wr({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return qr.set(o,r),r}function Vr(e,t,o,n,r,i){e.moveTo(t+i,o),e.lineTo(t+n-i,o),e.quadraticCurveTo(t+n,o,t+n,o+i),e.lineTo(t+n,o+r-i),e.quadraticCurveTo(t+n,o+r,t+n-i,o+r),e.lineTo(t+i,o+r),e.quadraticCurveTo(t,o+r,t,o+r-i),e.lineTo(t,o+i),e.quadraticCurveTo(t,o,t+i,o),e.closePath()}function Xr(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Yr(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}var Kr=e=>[Er,...e],Zr={bar:Kr([Ar]),clusterbar:Kr([Ar]),point:Kr([Cr,Pr]),swarm:Kr([Cr,Pr]),pie:[Br],donut:[Br],boxplot:Kr([Hr,Cr]),violin:Kr([Or]),histogram:Kr([Ar]),ridgeline:Kr([Or]),timeline:Kr([Ar]),funnel:[Ar,Dr,(e,t,o,n)=>{const r=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==r.length&&r.some(e=>null!=e.datum?.__funnelStepLabel||null!=e.datum?.__funnelValueLabelX)){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of r){const o=t.datum;if(!o)continue;if(!o.__funnelStepLabel)continue;const n=o.__funnelStepLabel;if(e.measureText(n).width+16>(o.__funnelRowWidth??o.__funnelBarW??0))continue;const r=o.__funnelStepLabelX,i=o.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(n,r,i),e.fillStyle="#fff",e.fillText(n,r,i)}e.font="bold 13px sans-serif";for(const t of r){const o=t.datum;if(!o)continue;if(null==o.__funnelValueLabelX)continue;const n=o.__funnelBarW??0;if(60>n)continue;const r=o.__funnelValue;if(null==r||0===r)continue;const i=o.__funnelPercent,s=!0===o.__funnelIsFirstStep;let a;if(a=s?Fr(r):null!=i?`${Fr(r)} (${Nr(i)})`:Fr(r),e.measureText(a).width+16>n){if(s||null==i)continue;if(a=Fr(r),e.measureText(a).width+16>n)continue}const l=o.__funnelValueLabelX,c=(o.__funnelValueLabelY??t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(a,l,c),e.fillStyle="#fff",e.fillText(a,l,c)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[Ar,(e,t,o,n)=>{const r=t.filter(e=>"rect"===e.type&&!0===e.datum?.__barFunnelIsDropoff);for(const t of r){const o=("string"==typeof t.style.fill?t.style.fill:null)||on(e,"var(--semiotic-border, #999)"),n=Gr(o,e);e.globalAlpha=t.style.opacity??1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),n?e.fillStyle=n:(e.fillStyle=o,e.globalAlpha=.4*(t.style.opacity??1)),e.fill(),e.globalAlpha=1}},(e,t,o,n)=>{const r=t.filter(e=>"rect"===e.type&&!0!==e.datum?.__barFunnelIsDropoff&&null!=e.datum?.__barFunnelLabelX);if(0===r.length)return;const i=function(e,t){const[o,n,r]=vr(e,t);return(.2126*o+.7152*n+.0722*r)/255>.6}(e,on(e,"var(--semiotic-text, #333)")),s=i?"#1f2937":"#ffffff",a=i?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=i?"#f3f4f6":"#1a1a1a",c=l;for(const t of r){const o=t.datum;if(!o)continue;const n=o.__barFunnelValue;if(null==n)continue;if(25>t.w)continue;const r=o.__barFunnelPercent,i=!(!0===o.__barFunnelIsFirstStep)&&null!=r,u=i?Yr(r):"",d=Xr(n);e.font="bold 13px sans-serif";const h=i?e.measureText(u).width:0;e.font="11px sans-serif";const f=e.measureText(d).width,g=Math.max(h,f)+12,m=i?32:17,y=o.__barFunnelLabelX,p=y-g/2,b=o.__barFunnelLabelY-m-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),Vr(e,p,b,g,m,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),Vr(e,p,b,g,m,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,y,b+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,y,b+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,y,b+3))}e.lineWidth=1}],swimlane:Kr([Ar]),custom:Kr([Ar,Cr,Pr,(e,t)=>{const o=e.globalAlpha;for(const n of t)"glyph"===n.type&&Rr(e,n,n.x,n.y,o);e.globalAlpha=o},Br,Hr,Or,Dr])},Qr=require("react/jsx-runtime");function Ur(e){const t=function(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const o=t.maxEntries??6,n=!1!==t.skipPositional,r=[];for(const[t,o]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(n&&En.has(t.toLowerCase()))continue;if(null==o)continue;const e=typeof o;("string"===e||"number"===e||"boolean"===e||o instanceof Date)&&r.push({key:t,lower:t.toLowerCase(),value:o})}if(0===r.length)return{entries:[]};let i=r.findIndex(e=>Bn.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=Dn(l,Hn),u=Dn(l,On),d=new Set(Hn),h=new Set(On),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>=o)break;e!==c&&e!==u&&(d.has(e.lower)||h.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:a?.key,title:a?.value,entries:f}}(e,{skipPositional:!1});return null==t.title&&0===t.entries.length?null:(0,Qr.jsxs)("div",{className:"semiotic-tooltip",style:Nn,children:[null!=t.title&&(0,Qr.jsx)("div",{style:{fontWeight:"bold"},children:t.title+""}),t.entries.map(e=>(0,Qr.jsxs)("div",{children:[(0,Qr.jsxs)("span",{style:{opacity:.7},children:[e.key,":"]})," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]},e.key))]})}function Jr({hover:e}){const t=e.data||{},o=e.stats,n=e.category;if(Array.isArray(t)){const e=n||t[0]?.category||"";if(o)return(0,Qr.jsxs)("div",{className:"semiotic-tooltip",style:Nn,children:[e&&(0,Qr.jsx)("div",{style:{fontWeight:"bold"},children:e+""}),(0,Qr.jsxs)("div",{children:["n = ",o.n]}),(0,Qr.jsxs)("div",{children:["Min: ",o.min.toLocaleString()]}),(0,Qr.jsxs)("div",{children:["Q1: ",o.q1.toLocaleString()]}),(0,Qr.jsxs)("div",{children:["Median: ",o.median.toLocaleString()]}),(0,Qr.jsxs)("div",{children:["Q3: ",o.q3.toLocaleString()]}),(0,Qr.jsxs)("div",{children:["Max: ",o.max.toLocaleString()]}),(0,Qr.jsxs)("div",{style:{opacity:.8},children:["Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const r=t.length;return(0,Qr.jsxs)("div",{className:"semiotic-tooltip",style:Nn,children:[e&&(0,Qr.jsx)("div",{style:{fontWeight:"bold"},children:e+""}),(0,Qr.jsxs)("div",{children:[r," items"]})]})}if(null!=t.bin&&null!=t.count){const e=t.range||[];return(0,Qr.jsxs)("div",{className:"semiotic-tooltip",style:Nn,children:[t.category&&(0,Qr.jsx)("div",{style:{fontWeight:"bold"},children:t.category+""}),(0,Qr.jsxs)("div",{children:["Count: ",t.count]}),2===e.length&&(0,Qr.jsxs)("div",{style:{opacity:.8},children:[Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)]})]})}const r=e.__oAccessor,i=e.__rAccessor,s=e.__chartType;if("swarm"===s||"point"===s)return Ur(t);const a=(r&&null!=t[r]?t[r]:null)||t.category||t.name||t.group||t.__rName||"",l=t.__aggregateValue??(i&&null!=t[i]?t[i]:null)??t.value??t.__rValue??t.pct??"";return a||""!==l?(0,Qr.jsxs)("div",{className:"semiotic-tooltip",style:Nn,children:[a&&(0,Qr.jsx)("div",{style:{fontWeight:"bold"},children:a+""}),""!==l&&(0,Qr.jsx)("div",{children:"number"==typeof l?l.toLocaleString():l+""})]}):Ur(t)}Jr.ownsChrome=!0;var ei=require("react/jsx-runtime"),ti={top:50,right:40,bottom:60,left:70},oi=(0,u.memo)((0,u.forwardRef)(function(e,t){const{chartType:o,runtimeMode:n,data:r,oAccessor:i="category",rAccessor:s="value",colorAccessor:a,symbolAccessor:l,symbolMap:c,stackBy:d,groupBy:g,multiAxis:m,timeAccessor:y,valueAccessor:p,categoryAccessor:b,accessorRevision:v,projection:x="vertical",size:w=[600,400],responsiveWidth:k,responsiveHeight:S,margin:A,barPadding:M,roundedTop:C,gradientFill:j,trackFill:_,baselinePadding:P,innerRadius:R,cornerRadius:L,normalize:I,startAngle:T,sweepAngle:$,dynamicColumnWidth:B,bins:H,showOutliers:O,showIQR:E,amplitude:D,connectorOpacity:F,showLabels:N,connectorAccessor:z,connectorStyle:W,dataIdAccessor:q,rExtent:G,oExtent:V,extentPadding:X=.05,oSort:Y,windowMode:K="sliding",windowSize:Z=200,pieceStyle:Q,summaryStyle:U,colorScheme:J,barColors:ee,showAxes:te=!0,showCategoryTicks:ne,categoryLabel:re,valueLabel:ie,categoryFormat:se,valueFormat:ae,oLabel:le,rLabel:ce,oFormat:ue,rFormat:de,rTickValues:he,tickLabelEdgeAlign:fe,axisExtent:ge,enableHover:me=!0,hoverAnnotation:ye,tooltipContent:pe,customHoverBehavior:be,customClickBehavior:ve,annotations:xe,autoPlaceAnnotations:we,svgAnnotationRules:ke,showGrid:Se=!1,legend:Ae,legendHoverBehavior:Me,legendClickBehavior:Ce,legendHighlightedCategory:je,legendIsolatedCategories:Pe,legendPosition:Le,legendLayout:Ie,legendCategoryAccessor:Te,onCategoriesChange:$e,backgroundGraphics:Be,foregroundGraphics:He,title:De,className:Fe,background:Ne,centerContent:ze,decay:qe,pulse:Ve,transition:Xe,animate:Ze,staleness:Ue,brush:Je,onBrush:et,accessibleTable:tt=!0,description:ot,summary:nt,customLayout:rt,onLayoutError:ut,layoutConfig:ht,layoutSelection:ft}=e,gt=(0,u.useRef)(!0),mt=gr({sizeProp:w,responsiveWidth:k,responsiveHeight:S,userMargin:A,marginDefault:ti,animate:Ze,transitionProp:Xe,themeDirtyRef:gt}),{reducedMotionRef:yt,responsiveRef:pt,size:bt,margin:vt,adjustedWidth:xt,adjustedHeight:wt,currentTheme:kt,transition:St,introEnabled:At,tableId:Mt,rafRef:Ct,renderFnRef:jt,scheduleRender:_t,cancelRender:Pt}=mt,Rt=function(){const[e,t]=(0,No.useState)(!1);return zo(()=>{t(!0)},[]),e}(),Lt=function(){const e=(0,No.useSyncExternalStore)(Wo,qo,Go);return(0,No.useRef)(e).current}(),It=(0,u.useMemo)(()=>h(r),[r]),Tt=re??le,$t=ie??ce,Bt=se??ue,Ht=ae??de,Ot=(0,u.useRef)(null),Et=(0,u.useRef)(null),Dt=(0,u.useRef)([]),Ft=(0,u.useRef)(Te),Nt=(0,u.useRef)($e);Ft.current=Te,Nt.current=$e;const[zt,Wt]=(0,u.useState)(null),[qt,Gt]=(0,u.useState)(null),Vt=(e,t)=>"function"==typeof e?e({size:bt,margin:vt,scales:t}):e,Xt=Vt(He,qt),Yt=Vt(Be,qt),[Kt,Zt]=(0,u.useState)(0),Qt=(0,u.useRef)(0),[Ut,Jt]=(0,u.useState)(!1),eo=(0,u.useRef)({w:-1,h:-1}),to=(0,u.useRef)(!1),oo=me||ye,no="streaming"===n,ro=function(e){const t=(0,Vo.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Yo(e,t);if(!Ko(e)||!Ko(t))return!1;const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;const o=e[n],r=t[n];if(!Object.is(o,r))if(Array.isArray(o)&&Array.isArray(r)){if(!Yo(o,r))return!1}else{if(!Ko(o)||!Ko(r))return!1;if(!Xo(o,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}((0,u.useMemo)(()=>({chartType:o,runtimeMode:no?"streaming":"bounded",windowSize:Z,windowMode:K,extentPadding:X,projection:x,oAccessor:no?void 0:i,rAccessor:no?void 0:s,accessorRevision:v,colorAccessor:a,symbolAccessor:l,symbolMap:c,stackBy:d,groupBy:g,multiAxis:m,timeAccessor:no?y:void 0,valueAccessor:no?p||("string"==typeof s||"function"==typeof s?s:void 0):void 0,categoryAccessor:no?b||i:void 0,rExtent:G,oExtent:V,axisExtent:ge,barPadding:M,roundedTop:C,gradientFill:j,trackFill:_,baselinePadding:P,innerRadius:R,cornerRadius:L,normalize:I,startAngle:T,sweepAngle:$,dynamicColumnWidth:B,bins:H,showOutliers:O,showIQR:E,amplitude:D,connectorOpacity:F,showLabels:N,connectorAccessor:z,connectorStyle:W,dataIdAccessor:q,oSort:Y,pieceStyle:Q,summaryStyle:U,colorScheme:J,themeCategorical:kt?.colors?.categorical,themeSemantic:er(kt),themeSequential:kt?.colors?.sequential,themeDiverging:kt?.colors?.diverging,barColors:ee,decay:qe,pulse:Ve,transition:St,introAnimation:At,staleness:Ue,customLayout:rt,onLayoutError:ut,layoutConfig:ht,layoutMargin:vt}),[o,Z,K,X,x,i,s,v,a,l,c,d,g,m,y,p,b,G,V,ge,M,C,j,_,P,R,L,I,T,$,B,H,O,E,D,F,N,z,W,q,Y,Q,U,J,ee,qe,Ve,St?.duration,St?.easing,At,Ue,no,kt,rt,ut,ht,vt])),io=(0,u.useRef)(null);io.current||(io.current=new _e(ro));const so=(0,u.useCallback)(()=>{const e=Ft.current,t=Nt.current;if(!t||!e)return;const o=function(e,t){if(!t)return[];const o=new Set,n=[];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+"";o.has(i)||(o.add(i),n.push(i))}return n}(io.current?.getData()??[],e);(function(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0})(o,Dt.current)||(Dt.current=o,t(o))},[]);!function(e,t,o,n){(0,Ee.useEffect)(()=>{e.current?.updateConfig(t),o.current=!0,n()},[t,n,e,o])}(io,ro,gt,_t),function(e,t,o,n){const r=(0,Ee.useRef)(null);(0,Ee.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):o.current=!0,n())},[t,n,e,o])}(io,ft,gt,_t);const ao=(0,u.useRef)(null);ao.current||(ao.current=new f(e=>{const t=io.current;t&&t.ingest(e)&&(gt.current=!0,_t())}));const lo=(0,u.useCallback)(e=>{ao.current?.push(e)},[]),co=(0,u.useCallback)(e=>{ao.current?.pushMany(e)},[]),uo=(0,u.useCallback)(()=>{ao.current?.clear(),io.current?.clear(),gt.current=!0,_t()},[_t]),ho=(0,u.useCallback)(e=>{ao.current?.clearLastData(),ao.current?.setReplacementData(e)},[]);(0,u.useImperativeHandle)(t,()=>({push:lo,pushMany:co,replace:ho,remove:e=>{ao.current?.flush();const t=io.current?.remove(e)??[];if(t.length>0){const e=Et.current?.data;!!Et.current&&t.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Et.current=null,Wt(null)),gt.current=!0,_t()}return t},update:(e,t)=>{ao.current?.flush();const o=io.current?.update(e,t)??[];return o.length>0&&(gt.current=!0,_t()),o},clear:uo,getData:()=>(ao.current?.flush(),io.current?.getData()??[]),getScales:()=>io.current?.scales??null,getCustomLayout:()=>io.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>io.current?.lastCustomLayoutFailure??null}),[lo,co,ho,uo,_t]),(0,u.useEffect)(()=>{r&&ao.current?.setBoundedData(It)},[r,It]);const{hoverHandlerRef:fo,hoverLeaveRef:go,onPointerMove:mo,onPointerLeave:yo}=mt;fo.current=e=>{if(!oo)return;const t=Ot.current;if(!t)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left-vt.left,a=e.clientY-n.top-vt.top;if(0>r||r>xt||0>a||a>wt)return void(Et.current&&(Et.current=null,Wt(null),be&&be(null),_t()));const l=io.current;if(!l||0===l.scene.length)return;const c="radial"===x,u=Qe(l.scene,c?r-xt/2:r,c?a-wt/2:a,30,l.pointQuadtree,l.maxPointRadius);if(!u)return void(Et.current&&(Et.current=null,Wt(null),be&&be(null),_t()));const d=$n(u.datum||{},u.x,u.y,{...u.stats&&{stats:u.stats},...u.category&&{category:u.category},__oAccessor:"string"==typeof i?i:void 0,__rAccessor:"string"==typeof s?s:void 0,__chartType:o});Et.current=d,Wt(d),be&&(be(d),gt.current=!0),_t()},go.current=()=>{Et.current&&(Et.current=null,Wt(null),be&&(be(null),gt.current=!0),_t())};const po=(0,u.useCallback)(e=>{if(!ve)return;const t=Ot.current;if(!t)return ve(null),gt.current=!0,void _t();const n=t.getBoundingClientRect(),r=e.clientX-n.left-vt.left,a=e.clientY-n.top-vt.top;if(0>r||r>xt||0>a||a>wt)return ve(null),gt.current=!0,void _t();const l=io.current;if(!l||0===l.scene.length)return ve(null),gt.current=!0,void _t();const c="radial"===x,u=Qe(l.scene,c?r-xt/2:r,c?a-wt/2:a,30,l.pointQuadtree,l.maxPointRadius);if(!u)return ve(null),gt.current=!0,void _t();ve($n(u.datum||{},u.x,u.y,{...u.stats&&{stats:u.stats},...u.category&&{category:u.category},__oAccessor:"string"==typeof i?i:void 0,__rAccessor:"string"==typeof s?s:void 0,__chartType:o})),gt.current=!0,_t()},[wt,xt,o,ve,vt,i,x,s,_t]),bo=(0,u.useRef)(-1),xo=(0,u.useRef)(null),So=(0,u.useRef)(null),Ao=(0,u.useCallback)(e=>{const t=io.current;if(!t||0===t.scene.length)return;const n=t.version;let r;if(So.current&&So.current.version===n)r=So.current.graph;else{const e=function(e){const t=[];for(const o of e)if("rect"===o.type&&null!=o.x){if(null==o.datum)continue;t.push({x:o.x+o.w/2,y:o.y+o.h/2,datum:o.datum,shape:"rect",w:o.w,h:o.h,group:o.group??o.datum?.category??""})}else if("point"===o.type)t.push({x:o.x,y:o.y,datum:o.datum,shape:"circle",group:"_default"});else if("symbol"===o.type){if(0>=o.size)continue;t.push({x:o.x,y:o.y,datum:o.datum,shape:"circle",group:"_default"})}else if("glyph"===o.type){if(0>=o.size||null==o.datum)continue;const e=Ke(o.glyph,o.size);t.push({x:o.x+e.centerDx,y:o.y+e.centerDy,datum:o.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"})}else if("wedge"===o.type&&null!=o.cx){if(null===o.datum)continue;const e=((o.startAngle||0)+(o.endAngle||0))/2,n=((o.innerRadius||0)+(o.outerRadius||50))/2;t.push({x:o.cx+Math.cos(e)*n,y:o.cy+Math.sin(e)*n,datum:o.datum,shape:"wedge",group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===e.length)return;r=function(e){const t=new Map;for(const o of e){const e=o.group??"_default";let n=t.get(e);n||(n=[],t.set(e,n)),n.push(o)}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 o=Array.from(t.keys()).sort((e,o)=>{const n=t.get(e),r=t.get(o);return(n.length>0?n[0].y:0)-(r.length>0?r[0].y:0)}),n=Array.from(t.values()).flat();n.sort((e,t)=>e.x-t.x||e.y-t.y);const r=new Map;for(let e=0;n.length>e;e++){n[e]._flatIndex=e;const t=n[e].datum?.id;null!=t&&r.set(t+"",e)}return{flat:n,groups:o,byGroup:t,idToIdx:r}}(e),So.current={version:n,graph:r}}const a=bo.current;if(0>a){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),bo.current=0;const t=r.flat[0];xo.current={shape:t.shape,w:t.w,h:t.h};const n={...st(t),__oAccessor:"string"==typeof i?i:void 0,__rAccessor:"string"==typeof s?s:void 0,__chartType:o};return Et.current=n,Wt(n),be&&be(n),void _t()}const l=function(e,t){if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const o=Math.max(0,Math.min(t,e.flat.length-1)),n=e.flat[o];return{flatIndex:o,group:n.group??"_default",indexInGroup:n._groupIndex??0}}(r,a),c=function(e,t,o){const{group:n,indexInGroup:r}=t,i=o.byGroup.get(n);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=o.groups.indexOf(n);return o.groups.length-1>e?it(o,o.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=o.groups.indexOf(n);return e>0?it(o,o.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*o.flat.length)),o.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*o.flat.length)),0);case"Home":return 0;case"End":return o.flat.length-1;case"Escape":return-1;default:return null}}(e.key,l,r);if(null===c)return;if(e.preventDefault(),0>c)return bo.current=-1,xo.current=null,Et.current=null,Wt(null),be&&be(null),void _t();bo.current=c;const u=r.flat[c];xo.current={shape:u.shape,w:u.w,h:u.h};const d={...st(u),__oAccessor:"string"==typeof i?i:void 0,__rAccessor:"string"==typeof s?s:void 0,__chartType:o};Et.current=d,Wt(d),be&&be(d),_t()},[be,_t]),Mo=(0,u.useCallback)(e=>{bo.current=-1,xo.current=null,mo(e)},[mo]);jt.current=()=>{Ct.current=null;const e=Ot.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const n=io.current;if(!n)return;const r="undefined"!=typeof performance?performance.now():Date.now(),i=n.advanceTransition(yt.current?r+1e6:r),s=!yt.current&&i,a=eo.current.w!==xt||eo.current.h!==wt,l=gt.current;let c=!1;!l&&!a||s&&!a||(n.computeScene({width:xt,height:wt}),eo.current={w:xt,h:wt},c=!0,so()),gt.current=l&&s&&!c;const u=function(e,t,o,n){const r=n.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,s=!i&&e.hasActivePulsesAt(t),a=!(o||i||!s&&!r)&&e.refreshPulse(t);return n.current=s,{changed:a,pending:s}}(n,r,c,to);(c||s)&&e.setAttribute("aria-label",hn(n.scene,o+" chart"));const d=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))}(),h=bt[0]*d,f=bt[1]*d;e.width===h&&e.height===f||(e.width=h,e.height=f,e.style.width=bt[0]+"px",e.style.height=bt[1]+"px"),t.setTransform(d,0,0,d,0,0),t.clearRect(0,0,bt[0],bt[1]);const g=Ue&&n.lastIngestTime>0&&r-n.lastIngestTime>(Ue?.threshold??5e3);g&&(t.globalAlpha=Ue?.dimOpacity??.5),function(e,t){const{background:o,hasBackgroundGraphics:n=!1,themeBackground:r="",x:i=0,y:s=0,width:a,height:l}=t;if("transparent"===o)return!1;if(n)return!1;const c=o||(r&&"transparent"!==r?r:"")||null;if(!c)return!1;const u=on(e,c);u&&(e.fillStyle=u,e.fillRect(i,s,a,l))}(t,{background:Ne,hasBackgroundGraphics:!!Be,themeBackground:Be||"transparent"===Ne||Ne?"":getComputedStyle(e).getPropertyValue("--semiotic-bg").trim(),width:bt[0],height:bt[1]});const m="radial"===x;t.save(),t.beginPath(),t.rect(vt.left,vt.top,xt,wt),t.clip(),m?(t.save(),t.translate(vt.left+xt/2,vt.top+wt/2)):t.translate(vt.left,vt.top);const y=rt?Zr.custom:Zr[o]||[],p={width:xt,height:wt};for(const e of y)e(t,n.scene,n.scales,p);m&&t.restore(),t.restore(),g&&(t.globalAlpha=1),c&&n.scales?(Gt(n.scales),Zt(e=>e+1),Qt.current=r):s&&n.scales&&r-Qt.current>=33&&(Zt(e=>e+1),Qt.current=r),Ue?.showBadge&&Jt(!!g),(s||null!=n.activeTransition||u.pending)&&_t()},function(e){const{hydrated:t,wasHydratingFromSSR:o,storeRef:n,dirtyRef:r,renderFnRef:i,cancelRender:s,cleanup:a}=e;zo(()=>{t&&o&&n.current?.cancelIntroAnimation?.(),r.current=!0,s?.(),i.current()},[t,o]);const l=(0,No.useRef)(a);l.current=a,(0,No.useEffect)(()=>()=>l.current?.(),[])}({hydrated:Rt,wasHydratingFromSSR:Lt,storeRef:io,dirtyRef:gt,renderFnRef:jt,cancelRender:Pt,cleanup:()=>ao.current?.clear()}),(0,u.useEffect)(()=>{gt.current=!0,_t()},[o,xt,wt,te,Ne,_t]),function(e,t,o,n,r,i){const s=(0,at.useRef)("fresh");(0,at.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=function(e,t){if(!e||0>=t)return ct;const o=null!=e.threshold&&e.threshold>0?e.threshold:5e3,n=e.graded;if(n){const e="object"==typeof n?n:{},r=function(e,t,o={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(o.fresh??1)>e?"fresh":t*(o.aging??1.5)>e?"aging":t*(o.stale??3)>e?"stale":"expired":"fresh"}(t,o,e.thresholds);return{alpha:{...lt,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>o?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:ct}(e,l-a.lastIngestTime);c.band===s.current&&c.isStale===r||(s.current=c.band,c.isStale!==r&&i(c.isStale),o.current=!0,n())},1e3);return()=>clearInterval(a)},[e,r,n])}(Ue,io,gt,_t,Ut,Jt);const Co=oo&&zt?pe?pe(zt):(0,ei.jsx)(Jr,{hover:zt}):null,jo="radial"===x,To=Co?(0,ei.jsx)(Xn,{x:zt?jo?zt.x+xt/2:zt.x:0,y:zt?jo?zt.y+wt/2:zt.y:0,containerWidth:xt,containerHeight:wt,margin:vt,className:"stream-ordinal-tooltip",children:Co}):null,Zo=ko(i,void 0,"__semiotic_resolvedO",""),Qo=ko(s,void 0,"__semiotic_resolvedR",""),Uo=Zo.key,Jo=Qo.key,en=function(e,t,o){return n=>{if(!n||!o||!e.fn&&!t.fn)return n;let r=!1;const i=n.map(o=>{const n=e.fn&&e.key&&!(e.key in o),i=t.fn&&t.key&&!(t.key in o);if(!n&&!i)return o;r=!0;const s={...o};return n&&(s[e.key]=e.fn(o)),i&&(s[t.key]=t.fn(o)),s});return r?i:n}}(Zo,Qo,xe&&xe.length>0||!1);if(Fo||!Rt&&Lt){const e=io.current;e&&r&&(e.ingest({inserts:It,bounded:!0}),e.computeScene({width:xt,height:wt}));const t=e?.scene??[],o=e?.scales??null,n=Vt(He,o),i=Vt(Be,o),s="radial"===x,a=s?vt.left+xt/2:vt.left,l=s?vt.top+wt/2:vt.top;return(0,ei.jsxs)("div",{ref:pt,className:"stream-ordinal-frame"+(Fe?" "+Fe:""),role:"img","aria-label":ot||("string"==typeof De?De:"Ordinal chart"),style:{position:"relative",width:k?"100%":bt[0],height:S?"100%":bt[1]},children:[(0,ei.jsx)(Cn,{summary:nt}),(0,ei.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:bt[0],height:bt[1],style:{position:"absolute",left:0,top:0},children:[i&&(0,ei.jsx)("g",{transform:`translate(${vt.left},${vt.top})`,children:i}),(0,ei.jsxs)("g",{transform:`translate(${a},${l})`,children:[Ne&&(0,ei.jsx)("rect",{x:0,y:0,width:xt,height:wt,fill:Ne}),t.map((e,t)=>function(e,t,o){const n=("category"in e?e.category:void 0)||("group"in e?e.group:void 0)||"",r=o=>`ord-${e.type}-${n}-${t}-${o}`,i=`ord-${e.type}-${n}-${t}`;switch(e.type){case"rect":{const t=e,o=Do(i)+"-grad",n=function(e,t){const o=e.fillGradient;if(!o)return null;let n=e.x,r=e.y,i=e.x,s=e.y+e.h;"bottom"===e.roundedEdge?(r=e.y+e.h,s=e.y):"right"===e.roundedEdge?(n=e.x+e.w,r=e.y,i=e.x,s=e.y):"left"===e.roundedEdge&&(n=e.x,r=e.y,i=e.x+e.w,s=e.y);const a=[];if("colorStops"in o){const e=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>e.length)return null;for(let t=0;e.length>t;t++)a.push((0,Ho.jsx)("stop",{offset:e[t].offset,stopColor:e[t].color},t))}else{const t=Eo(e.style.fill);a.push((0,Ho.jsx)("stop",{offset:0,stopColor:t,stopOpacity:o.topOpacity},"0")),a.push((0,Ho.jsx)("stop",{offset:1,stopColor:t,stopOpacity:o.bottomOpacity},"1"))}return(0,Ho.jsx)("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:n,y1:r,x2:i,y2:s,children:a})}(t,o),r=n?`url(#${o})`:Eo(t.style.fill);if(t.cornerRadii&&Lo(t.cornerRadii)){const e=function(e){const{x:t,y:o,w:n,h:r}=e,{tl:i,tr:s,br:a,bl:l}=Io(e);let c=`M${t+i},${o}`;return c+=` L${t+n-s},${o}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+n},${o+s}`),c+=` L${t+n},${o+r-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+n-a},${o+r}`),c+=` L${t+l},${o+r}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${o+r-l}`),c+=` L${t},${o+i}`,i>0&&(c+=` A${i},${i} 0 0 1 ${t+i},${o}`),c+=" Z",c}(t);return(0,Ho.jsxs)(Po.Fragment,{children:[n&&(0,Ho.jsx)("defs",{children:n}),(0,Ho.jsx)("path",{d:e,fill:r,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}if(t.roundedTop&&t.roundedTop>0){const e=Math.min(t.roundedTop,t.w/2,t.h/2),{x:o,y:s,w:a,h:l}=t;let c;switch(t.roundedEdge){case"right":c=`M${o},${s} L${o+a-e},${s} A${e},${e} 0 0 1 ${o+a},${s+e} L${o+a},${s+l-e} A${e},${e} 0 0 1 ${o+a-e},${s+l} L${o},${s+l} Z`;break;case"left":c=`M${o+a},${s} L${o+e},${s} A${e},${e} 0 0 0 ${o},${s+e} L${o},${s+l-e} A${e},${e} 0 0 0 ${o+e},${s+l} L${o+a},${s+l} Z`;break;case"bottom":c=`M${o},${s} L${o+a},${s} L${o+a},${s+l-e} A${e},${e} 0 0 1 ${o+a-e},${s+l} L${o+e},${s+l} A${e},${e} 0 0 1 ${o},${s+l-e} Z`;break;default:c=`M${o},${s+l} L${o},${s+e} A${e},${e} 0 0 1 ${o+e},${s} L${o+a-e},${s} A${e},${e} 0 0 1 ${o+a},${s+e} L${o+a},${s+l} Z`}return(0,Ho.jsxs)(Po.Fragment,{children:[n&&(0,Ho.jsx)("defs",{children:n}),(0,Ho.jsx)("path",{d:c,fill:r,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}return(0,Ho.jsxs)(Po.Fragment,{children:[n&&(0,Ho.jsx)("defs",{children:n}),(0,Ho.jsx)("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:r,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}case"point":{const t=e;return(0,Ho.jsx)("circle",{cx:t.x,cy:t.y,r:t.r,fill:Eo(t.style.fill),opacity:t.style.opacity??.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}case"symbol":return function(e,t,o){const n=oe(e.symbolType,e.size,e.path);return(0,Ho.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?Eo(e.style.fill):"none",opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},`${o??""}symbol-${t}`)}(e,t,o);case"glyph":return function(e,t,o,n){const r=e.glyph;if(!r?.parts?.length||0>=e.size)return null;const i=We(r,e.size);if(0>=i.scale)return null;const s=`translate(${t},${o})${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=Ye(r,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?Do(n+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),d=t=>r.parts.map((o,n)=>{const r=t?"none"===o.fill?void 0:t:Ge(o.fill,a,e.accent),i=t?o.stroke&&"none"!==o.stroke?t:void 0:Ge(o.stroke??"none",a,e.accent);return r||i?(0,Ho.jsx)("path",{d:o.d,fill:r??"none",stroke:i,strokeWidth:i?o.strokeWidth??1:void 0,strokeLinecap:o.strokeLinecap,strokeLinejoin:o.strokeLinejoin,opacity:o.opacity},n):null});return(0,Ho.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,Ho.jsx)("clipPath",{id:c,children:(0,Ho.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,Ho.jsx)("g",{children:d(e.ghostColor)}):null,l&&c?(0,Ho.jsx)("g",{clipPath:`url(#${c})`,children:d()}):d()]},n)}(e,e.x,e.y,`${o??""}ord-glyph-${e.pointId??t}`);case"wedge":{const n=e;if(n._gradientBand&&n._gradientBand.colors.length>0){const e=Do(`${o?o+"-":""}gauge-grad-${n.category||i}-${t}`),{clipPath:r,slices:s}=Bo({innerRadius:n.innerRadius,outerRadius:n.outerRadius,startAngle:n.startAngle,endAngle:n.endAngle,cornerRadius:n.cornerRadius,roundStart:n.roundedEnds?.start??!0,roundEnd:n.roundedEnds?.end??!0,colors:n._gradientBand.colors});return(0,Ho.jsxs)("g",{transform:`translate(${n.cx},${n.cy})`,opacity:n.style.opacity,fillOpacity:n.style.fillOpacity,children:[(0,Ho.jsx)("defs",{children:(0,Ho.jsx)("clipPath",{id:e,children:(0,Ho.jsx)("path",{d:r})})}),(0,Ho.jsx)("g",{clipPath:`url(#${e})`,children:s.map((e,t)=>(0,Ho.jsx)("path",{d:e.d,fill:Eo(e.color)},t))}),n.style.stroke&&"none"!==n.style.stroke&&(0,Ho.jsx)("path",{d:r,fill:"none",stroke:n.style.stroke,strokeWidth:n.style.strokeWidth})]},i)}let r;if(n.roundedEnds)r=$o({innerRadius:n.innerRadius,outerRadius:n.outerRadius,startAngle:n.startAngle,endAngle:n.endAngle,cornerRadius:n.cornerRadius,roundStart:n.roundedEnds.start,roundEnd:n.roundedEnds.end});else{const e=(0,Ro.arc)().innerRadius(n.innerRadius).outerRadius(n.outerRadius).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2);n.cornerRadius&&e.cornerRadius(n.cornerRadius),r=e(Oo)||""}return(0,Ho.jsx)("path",{d:r,transform:`translate(${n.cx},${n.cy})`,fill:Eo(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},i)}case"boxplot":{const t=e,o=t.columnWidth/2;return(0,Ho.jsxs)("g","vertical"===t.projection?{children:[(0,Ho.jsx)("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Ho.jsx)("rect",{x:t.x-o,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:Eo(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Ho.jsx)("line",{x1:t.x-o,y1:t.medianPos,x2:t.x+o,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),(0,Ho.jsx)("line",{x1:t.x-.5*o,y1:t.minPos,x2:t.x+.5*o,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Ho.jsx)("line",{x1:t.x-.5*o,y1:t.maxPos,x2:t.x+.5*o,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})]}:{children:[(0,Ho.jsx)("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Ho.jsx)("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-o,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:Eo(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Ho.jsx)("line",{x1:t.medianPos,y1:t.y-o,x2:t.medianPos,y2:t.y+o,stroke:t.style.stroke||"#333",strokeWidth:2}),(0,Ho.jsx)("line",{x1:t.minPos,y1:t.y-.5*o,x2:t.minPos,y2:t.y+.5*o,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,Ho.jsx)("line",{x1:t.maxPos,y1:t.y-.5*o,x2:t.maxPos,y2:t.y+.5*o,stroke:t.style.stroke||"#333",strokeWidth:1})]},i)}case"violin":{const t=e,o=[(0,Ho.jsx)("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:Eo(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},r("path"))];if(t.iqrLine&&t.bounds){const e=t.bounds,n=e.x+e.width/2,i=e.y+e.height/2;e.height>e.width?o.push((0,Ho.jsx)("line",{x1:n,y1:t.iqrLine.q1Pos,x2:n,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},r("iqr")),(0,Ho.jsx)("circle",{cx:n,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},r("med"))):o.push((0,Ho.jsx)("line",{x1:t.iqrLine.q1Pos,y1:i,x2:t.iqrLine.q3Pos,y2:i,stroke:t.style.stroke||"#333",strokeWidth:2},r("iqr")),(0,Ho.jsx)("circle",{cx:t.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},r("med")))}return(0,Ho.jsx)("g",{children:o},i)}case"connector":return(0,Ho.jsx)("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity??.5},i);case"trapezoid":{const t=e,o=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return(0,Ho.jsx)("polygon",{points:o,fill:Eo(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}default:return null}}(e,t,Mt)).filter(Boolean)]})]}),(0,ei.jsx)(wo,{width:xt,height:wt,totalWidth:bt[0],totalHeight:bt[1],margin:vt,scales:o,showAxes:te,showCategoryTicks:ne,oLabel:Tt,rLabel:$t,oFormat:Bt,rFormat:Ht,rTickValues:he,tickLabelEdgeAlign:fe,axisExtent:ge,showGrid:Se,title:De,legend:Ae,legendHoverBehavior:Me,legendClickBehavior:Ce,legendHighlightedCategory:je,legendIsolatedCategories:Pe,legendPosition:Le,legendLayout:Ie,foregroundGraphics:Re(n,Oe(io.current?.customLayoutOverlays,ft??null)),annotations:xe,autoPlaceAnnotations:we,svgAnnotationRules:ke,annotationFrame:0,xAccessor:Uo,yAccessor:Jo,annotationData:en(e?.getData())}),ze&&"radial"===x&&(0,ei.jsx)("div",{style:{position:"absolute",left:vt.left+xt/2,top:vt.top+wt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:ze})]})}return(0,ei.jsxs)("div",{ref:pt,className:"stream-ordinal-frame"+(Fe?" "+Fe:""),role:"group","aria-label":ot||("string"==typeof De?De:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:k?"100%":bt[0],height:S?"100%":bt[1],overflow:"visible"},onKeyDown:Ao,children:[tt&&(0,ei.jsx)(jn,{tableId:Mt}),tt&&(0,ei.jsx)(Mn,{scene:io.current?.scene??[],chartType:o+" chart",tableId:Mt,chartTitle:"string"==typeof De?De:void 0}),(0,ei.jsx)(Cn,{summary:nt}),(0,ei.jsx)(_n,{hoverPoint:zt}),(0,ei.jsxs)("div",{role:"img","aria-label":ot||("string"==typeof De?De:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:oo?Mo:void 0,onMouseLeave:oo?yo:void 0,onClick:ve?po:void 0,children:[Yt&&(0,ei.jsx)("svg",{style:{position:"absolute",top:0,left:0,width:bt[0],height:bt[1],pointerEvents:"none"},children:(0,ei.jsx)("g",{transform:`translate(${vt.left},${vt.top})`,children:Yt})}),(0,ei.jsx)(vo,{width:xt,height:wt,totalWidth:bt[0],totalHeight:bt[1],margin:vt,scales:qt,showAxes:te,showGrid:Se,rFormat:Ht,rTickValues:he,axisExtent:ge}),(0,ei.jsx)("canvas",{ref:Ot,"aria-label":hn(io.current?.scene??[],o+" chart"),style:{position:"absolute",top:0,left:0,width:bt[0],height:bt[1]}}),(0,ei.jsx)(wo,{width:xt,height:wt,totalWidth:bt[0],totalHeight:bt[1],margin:vt,scales:qt,showAxes:te,showCategoryTicks:ne,oLabel:Tt,rLabel:$t,oFormat:Bt,rFormat:Ht,rTickValues:he,axisExtent:ge,showGrid:Se,title:De,legend:Ae,legendHoverBehavior:Me,legendClickBehavior:Ce,legendHighlightedCategory:je,legendIsolatedCategories:Pe,legendPosition:Le,legendLayout:Ie,foregroundGraphics:Re(Xt,Oe(io.current?.customLayoutOverlays,ft??null)),annotations:xe,autoPlaceAnnotations:we,svgAnnotationRules:ke,annotationFrame:Kt,xAccessor:Uo,yAccessor:Jo,annotationData:en(io.current?.getData()),underlayRendered:!0}),(Je||et)&&"radial"!==x&&(0,ei.jsx)(_o,{width:xt,height:wt,totalWidth:bt[0],totalHeight:bt[1],margin:vt,scales:qt,onBrush:et||(()=>{})}),ze&&"radial"===x&&(0,ei.jsx)("div",{style:{position:"absolute",left:vt.left+xt/2,top:vt.top+wt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:ze}),Ue?.showBadge&&(0,ei.jsx)(dt,{isStale:Ut,position:Ue.badgePosition}),(0,ei.jsx)(Ln,{active:bo.current>=0,hoverPoint:zt,margin:vt,size:bt,shape:xo.current?.shape,width:xo.current?.w,height:xo.current?.h}),To]})]})}));oi.displayName="StreamOrdinalFrame";var ni=oi;function ri(e){const{title:t,description:o,summary:n,accessibleTable:r,className:i,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),o&&(c.description=o),n&&(c.summary=n),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 ii(e){const{linkedHover:t,selection:o,onObservation:n,onClick:r,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,f={},g=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(a||t||n||r||s)&&(f.customHoverBehavior=u),d&&(l||(h?n||r||t:n||r)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||o))&&(f.customClickBehavior=d),null!=g&&(f.hoverRadius=g),f}function si(e){const{tooltip:t,defaultTooltipContent:o}=e;return{tooltipContent:!1===t?()=>null:Gn(t)||o}}var ai=require("react"),li=require("react"),ci=require("react"),ui=(require("react/jsx-runtime"),(0,ci.createContext)(null));function di(){return(0,ci.useContext)(ui)}var hi=require("react");function fi(e){const t=[];for(const[o,n]of Object.entries(e.fields))if("point"===n.type)t.push(e=>n.values.has(e[o]));else{const[e,r]=n.range;t.push(t=>{const n=t[o];return n>=e&&r>=n})}return e=>t.every(t=>t(e))}function gi(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}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 o of e.values)if(!t.values.has(o))return!1;return!0}return!1}var[yi,pi]=Un(e=>({selections:new Map,setClause(t,o){e(e=>{const n=e.selections.get(t),r=n?.clauses.get(o.clientId);if(r&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const o=Object.entries(e.fields);if(o.length!==function(e){let t=0;for(const o in e)t++;return t}(t.fields))return!1;for(const[e,n]of o){const o=t.fields[e];if(!o||!mi(n,o))return!1}return!0}(r,o))return{};const i=new Map(e.selections),s=gi(i,t),a=new Map(s.clauses);return a.set(o.clientId,o),i.set(t,{...s,clauses:a}),{selections:i}})},clearClause(t,o){e(e=>{const n=e.selections.get(t);if(!n||!n.clauses.has(o))return{};const r=new Map(e.selections),i=new Map(n.clauses);return i.delete(o),r.set(t,{...n,clauses:i}),{selections:r}})},setResolution(t,o){e(e=>{const n=e.selections.get(t);if(n?.resolution===o)return{};const r=new Map(e.selections),i=gi(r,t);return r.set(t,{...i,resolution:o}),{selections:r}})},clearSelection(t){e(e=>{const o=e.selections.get(t);if(!o||0===o.clauses.size)return{};const n=new Map(e.selections);return n.set(t,{...o,clauses:new Map}),{selections:n}})}})),[bi,vi]=Un(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const o=e.observations;return o.push(t),o.length>e.maxObservations&&o.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}})),xi=require("react"),wi=(require("react"),{positions:new Map}),ki=new Set;function Si(){for(const e of ki)e()}function Ai(e,t){const o=wi.positions.get(e);if(o?.locked)return;if(!o||o.sourceId!==t)return;const n=new Map(wi.positions);n.delete(e),wi={positions:n},Si()}function Mi(e,t){const o=wi.positions.get(e);if(!o?.locked)return;if(t&&o.sourceId!==t)return;const n=new Map(wi.positions);n.delete(e),wi={positions:n},Si()}function Ci(e){const t=(0,xi.useId)(),o=e.clientId||t,{name:n}=e,r=pi(e=>e.selections.get(n)),i=pi(e=>e.setClause),s=pi(e=>e.clearClause),a=(0,xi.useMemo)(()=>!!r&&r.clauses.size>0,[r]);return{predicate:(0,xi.useMemo)(()=>r&&0!==r.clauses.size?function(e,t){const o=[];for(const[n,r]of e.clauses)"crossfilter"===e.resolution&&n===t||o.push(fi(r));return 0===o.length?()=>!0:"intersect"===e.resolution?e=>o.every(t=>t(e)):e=>o.some(t=>t(e))}(r,o):()=>!0,[r,o]),isActive:a,selectPoints:(0,xi.useCallback)(e=>{const t={};let r=!1;for(const[o,n]of Object.entries(e))t[o]={type:"point",values:new Set(n)},r=!0;r&&i(n,{clientId:o,type:"point",fields:t})},[o,n,i]),selectInterval:(0,xi.useCallback)(e=>{const t={};let r=!1;for(const[o,n]of Object.entries(e))t[o]={type:"interval",range:n},r=!0;r&&i(n,{clientId:o,type:"interval",fields:t})},[o,n,i]),clear:(0,xi.useCallback)(()=>{s(n,o)},[s,n,o]),clientId:o}}function ji(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function _i(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}require("react/jsx-runtime");var Pi=(0,hi.createContext)(!1);(0,hi.createContext)(!1);var Ri=(0,hi.createContext)(null),Li="undefined"==typeof window?hi.useEffect:hi.useLayoutEffect;function Ii(e){const t=(0,hi.useContext)(Ri),o=(0,hi.useId)(),n=function(e){const t=new Set,o=[];for(const n of e)t.has(n)||(t.add(n),o.push(n));return o}(e),r=(0,hi.useRef)([]);(function(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0})(r.current,n)||(r.current=n);const i=r.current;Li(()=>{if(t)return()=>t.unregisterCategories(o)},[t,o]),Li(()=>{t&&t.registerCategories(o,i)},[t,o,i])}function Ti({data:e,colorBy:t,colorScale:o,getColor:n,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",o={fill:t,stroke:t};return void 0!==r&&(o.stroke=r),void 0!==i&&(o.strokeWidth=i),o},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?n(s,t,o):o?o(r):V[i%V.length];return{label:r+"",color:a}}),label:""}]}}var $i=l(require("react"));function Bi(){return lr(e=>e.theme)}function Hi(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Oi(e,t){const{when:o}=e,n=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 o.minWidth&&o.minWidth>n||"number"==typeof o.maxWidth&&n>o.maxWidth||"number"==typeof o.minHeight&&("number"!=typeof r||o.minHeight>r)||"number"==typeof o.maxHeight&&("number"!=typeof r||r>o.maxHeight)||"number"==typeof o.minAspectRatio&&("number"!=typeof i||o.minAspectRatio>i)||"number"==typeof o.maxAspectRatio&&("number"!=typeof i||i>o.maxAspectRatio)||o.orientation&&s!==o.orientation)}function Ei(e,t,o=e.responsiveRules){if(!Array.isArray(o)||0===o.length)return{props:e,matches:[]};const n=o.map((e,t)=>({rule:e,index:t})).filter(e=>Oi(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:n.reduce((e,t)=>function(e,t){const o={...e,...t};for(const n of["margin","frameProps","mobileSemantics","style"])Hi(e[n])&&Hi(t[n])&&(o[n]={...e[n],...t[n]});return"string"==typeof e.className&&"string"==typeof t.className&&(o.className=`${e.className} ${t.className}`),o}(e,t.rule.transform),e),matches:n}}function Di(e,t,o){const n=e.xValue??t?.[o];if(null==n)return null;const r=Number(n);return Number.isFinite(r)?r:null}function Fi(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 Ni(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"),$i.createContext(void 0);var zi={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Wi(e,t={}){const o=t.mobileSemantics?.interaction,n="number"==typeof o?.targetSize?o.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,r="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!o||void 0!==n,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!r&&!i)return zi;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??n??44,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??44,standardControls:a.standardControls??!1}}function qi(){const e=Bi(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function Gi(e,t,o){return(0,li.useMemo)(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const n=[...e],r="function"==typeof(i=o)?i:e=>e[i];var i;return n.sort("asc"===t?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,t,o])}var Vi={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 Xi(e,t,o){const n=Vi[e||"primary"],r=e&&"primary"!==e||!o?.width?n.width:o.width,i=e&&"primary"!==e||!o?.height?n.height:o.height,s=Ei({...t,mode:e},{width:t.width??r,height:t.height??i}).props,a=s.mode||e,l=Vi[a||"primary"],c="context"===a||"sparkline"===a,u=a&&"primary"!==a||!o?.width?l.width:o.width;return{width:s.width??u,height:s.height??(a&&"primary"!==a||!o?.height?l.height:o.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:Yi(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:Wi(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}function Yi(e,t,o){if(!1!==t)return e;const n={...e};return"horizontal"===o?n.left=Math.min(n.left,15):n.bottom=Math.min(n.bottom,15),n}var Ki=require("react/jsx-runtime");function Zi(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Qi(e,t){if(!t)return Zi(e);try{const o=t(e);return null==o?Zi(e):o}catch{return Zi(e)}}function Ui(e,t){return"function"==typeof t?t(e):e[t]}function Ji({categoryAccessor:e,valueAccessor:t,groupAccessor:o,groupLabel:n,pieData:r=!1,valueFormat:i}){return s=>{const a=r?s.data?.[0]||s.data||s:s.data||s,l=Ui(a,e),c=Ui(a,t),u=o?Ui(a,o):void 0;return(0,Ki.jsxs)("div",{className:"semiotic-tooltip",style:Nn,children:[(0,Ki.jsx)("div",{style:{fontWeight:"bold"},children:Zi(l)}),(0,Ki.jsx)("div",{style:{marginTop:4},children:Qi(c,i)}),null!=u&&(0,Ki.jsxs)("div",{style:{marginTop:2,opacity:.8},children:[n||(d=o,"string"==typeof d?d:"value"),": ",Zi(u)]})]});var d}}var es=require("react/jsx-runtime");function ts({componentName:e,message:t,diagnosticHint:o,width:n,height:r}){return(0,es.jsx)("div",{role:"alert",style:{width:n,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,es.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,es.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,es.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),o&&(0,es.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})]})})}var os=l(require("react")),ns=require("react/jsx-runtime"),rs=class extends os.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,ns.jsx)(ts,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},is=require("react/jsx-runtime"),ss="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function as({componentName:e,width:t,height:o,children:n}){return(0,is.jsx)(rs,{fallback:n=>(0,is.jsx)(ts,{componentName:e,message:n.message,width:t,height:o}),children:n})}var ls={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(e,t,o,n){if(!ss)return;if(!t||0===t.length)return;if("string"!=typeof n)return;const r=t[0];if(!r||"object"!=typeof r)return;if(n in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${o} "${n}" not found in data. Available keys: ${i}`)}function ds(e,t){const o=e.length,n=t.length,r=Array(n+1);for(let e=0;n>=e;e++)r[e]=e;for(let i=1;o>=i;i++){let o=r[0];r[0]=i;for(let s=1;n>=s;s++){const n=r[s];r[s]=e[i-1]===t[s-1]?o:1+Math.min(o,r[s],r[s-1]),o=n}}return r[n]}function hs(e,t){if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(function(e,t,o=3){let n,r=o+1;for(const o of t){const t=ds(e.toLowerCase(),o.toLowerCase());r>t&&(r=t,n=o)}return r>o?void 0:n}(e,t,3)??null)}function fs({componentName:e,data:t,accessors:o,requiredProps:n}){if(n)for(const[t,o]of Object.entries(n))if(null==o)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(o){const n=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(n){const t=Object.keys(n);for(const[r,i]of Object.entries(o))if(i&&"string"==typeof i&&!(i in n)){const o=hs(i,t),n=o?` Try ${r}="${o}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${n}`}}}return null}var gs=require("react"),ms=require("react");function ys(e){const{data:t,rawData:o,colorBy:n,colorScheme:r,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:d,chartType:f,chartId:g,showLegend:m,userMargin:y,marginDefaults:p,onClick:b,hoverHighlight:v,mobileInteraction:x,mobileSemantics:w,loading:k,loadingContent:S,emptyContent:A,width:M,height:C}=e,j=void 0===o,_=(0,gs.useMemo)(()=>h(t),[t]),[P,R]=(0,gs.useState)([]),L=(0,gs.useCallback)(e=>{R(t=>t.length===e.length&&t.every((t,o)=>t===e[o])?t:e)},[]),I="string"==typeof e.colorBy?e.colorBy:void 0,T=(0,gs.useMemo)(()=>Wi(x,{width:M,mobileSemantics:w}),[x,M,w]),{activeSelectionHook:$,hoverSelectionHook:B,customHoverBehavior:H,customClickBehavior:O,crosshairSourceId:E}=function({selection:e,linkedHover:t,fallbackFields:o=[],unwrapData:n=!1,onObservation:r,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=(0,li.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}(t,o),f="series"===h?.mode?[h.seriesField||c||o[0]].filter(e=>!!e):h?.fields||o||[],g=Ci({name:e?.name||"__unused__",fields:f}),m=function(e){const t=e.name||"hover",{fields:o}=e,{predicate:n,isActive:r,selectPoints:i,clear:s}=Ci({name:t,fields:o});return{onHover:(0,xi.useCallback)(e=>{if(!e)return void s();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}_i(t)&&i(t)},[o,i,s,t]),predicate:n,isActive:r}}({name:h?.name||"hover",fields:f}),y=vi(e=>e.pushObservation),p=e?{isActive:g.isActive,predicate:g.predicate}:null,[b,v]=(0,li.useState)(null),x=(0,li.useRef)(!1),w=c||o[0],k=(0,li.useMemo)(()=>{if(!l||null==b||!w)return null;const e=b,t=w;return{isActive:!0,predicate:o=>("string"==typeof o[t]?o[t]:(o[t]??"")+"")===e}},[l,b,w]),S=(0,li.useCallback)(e=>{const o=!e&&x.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"===h?.mode&&h.xField){const o=Di(e,t,h.xField);null!=o&&function(e,t,o){const n=wi.positions.get(e);n?.locked||n&&n.xValue===t&&n.sourceId===o||(wi={positions:new Map(wi.positions).set(e,{xValue:t,sourceId:o})},Si())}(h.name||"hover",o,d)}"x-position"!==h?.mode&&m.onHover(t)}else"x-position"!==h?.mode||o||Ai(h.name||"hover",d),"x-position"===h?.mode||o||m.onHover(null);if(l&&w)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=t?.[w];v(null!=o?o+"":null)}else o||v(null);if(r||y){const t={timestamp:Date.now(),chartType:i||"unknown",chartId:s};if(e){const o=Fi(e),n={...t,type:"hover",datum:o||{},x:e.x??0,y:e.y??0};r&&r(n),y&&y(n)}else{const e={...t,type:"hover-end"};r&&r(e),y&&y(e)}}},[t,m,h,d,r,i,s,y,l,w,u]),A=(0,li.useCallback)((o=!0)=>{x.current=!1,t&&"x-position"!==h?.mode&&m.onHover(null),e&&u?.tapToSelect&&g.clear(),o&&l&&v(null),"x-position"===h?.mode&&(Mi(h.name||"hover",d),Ai(h.name||"hover",d))},[t,h,m,e,u,g,l,d]),M=(0,li.useCallback)(o=>{const n=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),c=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===h?.mode&&h.xField&&o){let e=o.data||o.datum||o;Array.isArray(e)&&(e=e[0]);const t=Di(o,e,h.xField);null!=t&&function(e,t,o){const n=wi.positions.get(e);if(n?.locked){const t=new Map(wi.positions);return t.delete(e),wi={positions:t},Si(),!1}wi={positions:new Map(wi.positions).set(e,{xValue:t,sourceId:o,locked:!0})},Si()}(h.name||"hover",t,d)}if(n)if(o){x.current=!0;const n=Fi(o);if(t&&"x-position"!==h?.mode&&m.onHover(n),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const o=n[t];void 0!==o&&(e[t]=[o])}Ni(e)&&g.selectPoints(e)}if(l&&w){const e=n?.[w];v(null!=e?e+"":null)}}else c&&A();if(o||c){if(o&&a){let e=o.data||o.datum||o;Array.isArray(e)&&(e=e[0]),a(e,{x:o.x??0,y:o.y??0})}if(r||y){const e={timestamp:Date.now(),chartType:i||"unknown",chartId:s};if(o){const t=Fi(o),n={...e,type:"click",datum:t||{},x:o.x??0,y:o.y??0};r&&r(n),y&&y(n)}else{const t={...e,type:"click-end"};r&&r(t),y&&y(t)}}}},[a,r,y,i,s,h,d,u,t,m,e,g,f,l,w,A]);return(0,li.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&x.current&&A()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,A]),(0,li.useEffect)(()=>()=>{x.current&&A(!1)},[A]),(0,li.useEffect)(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{Mi(e,d),Ai(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:p,hoverSelectionHook:k,customHoverBehavior:S,customClickBehavior:M,crosshairSourceId:d}}({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:d,chartType:f,chartId:g,onClick:b,hoverHighlight:v,colorByField:I,mobileInteraction:T}),D=function(e,t){const o="object"==typeof e&&null!==e?e:void 0;if("x-position"===o?.mode)return{linkedCrosshairName:o.name||"hover",linkedCrosshairSourceId:t}}(l,E),F=function(e,t,o){const n=di(),r=qi();return(0,li.useMemo)(()=>{if(!t)return;const i=n??void 0,s=o??(r&&r.length>0?r:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const o=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&Ni(i)){const e=Z(o.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return Z(o.map(e=>({_cat:e})),"_cat",s)}if(i&&Ni(i)){const o=Z(e,t,s);return e=>i[e]||o(e)}return Z(e,t,s)}if(i&&Ni(i)){const e=Z([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,o,n,r])}(_,n,r),N=(0,gs.useMemo)(()=>{if(!n)return[];const e=new Set;for(const t of _){const o="function"==typeof n?n(t):t[n];null!=o&&e.add(o+"")}return Array.from(e)},[_,n]),z=(0,gs.useMemo)(()=>j&&P.length>0?P:N,[j,P,N]),W=function(e,t,o){const[n,r]=(0,li.useState)(null),[i,s]=(0,li.useState)(new Set),a=(0,li.useMemo)(()=>new Set,[]),l=(0,li.useCallback)(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=(0,li.useCallback)(t=>{"isolate"===e&&s(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]),u=(0,li.useMemo)(()=>{if(!e||"none"===e||!t)return null;const o="string"==typeof t?t:null;return"highlight"===e&&null!=n?{isActive:!0,predicate:e=>(o?e[o]:"function"==typeof t?t(e):null)===n}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const n=o?e[o]:"function"==typeof t?t(e):null;return i.has(n)}}:null},[e,t,n,i]);return{highlightedCategory:"highlight"===e?n:null,isolatedCategories:"isolate"===e?i:a,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(i,n,z),q=(0,gs.useMemo)(()=>B||(W.legendSelectionHook?W.legendSelectionHook:$),[B,W.legendSelectionHook,$]),G=function(e){const t=lr(e=>e.theme.colors.selectionOpacity);return(0,ms.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}(a),X=qi(),K=di(),Q=(0,gs.useMemo)(()=>{if(F)return F;if(!n||0===z.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:X&&X.length>0?X:V,t="__streamCat",o=Z(z.map(e=>({[t]:e})),t,e);return e=>K?.[e]||o(e)||"#999"},[F,n,z,r,X,K]),{legend:U,margin:J,legendPosition:ee}=function({data:e,colorBy:t,colorScale:o,showLegend:n,legendPosition:r="right",userMargin:i,defaults:s={top:50,bottom:60,left:70,right:40},categories:a}){const l=(0,hi.useContext)(Pi),c=null!==(0,hi.useContext)(Ri),u=void 0!==n?n:!l&&!!t,d=!!t&&(u||c),h=(0,li.useMemo)(()=>{if(!d)return[];if(void 0!==a)return a;const o=new Set;for(const n of e){const e="function"==typeof t?t(n):n[t];null!=e&&o.add(e+"")}return Array.from(o)},[a,t,e,d]);Ii(c&&t?h:[]);const f=(0,li.useMemo)(()=>{if(!u||!t)return;const n=Ti({data:e,colorBy:t,colorScale:o,getColor:Y,categories:h});return 0!==n.legendGroups.reduce((e,t)=>e+t.items.length,0)?n:void 0},[u,t,e,o,h]),g=(0,li.useMemo)(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const o=e[t];return"number"==typeof o?o:s[t]},o={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},n=t=>"number"==typeof e[t];return f&&("right"===r&&!n("right")&&110>o.right?o.right=110:"left"===r&&!n("left")&&110>o.left?o.left=110:"top"===r&&!n("top")&&50>o.top?o.top=50:"bottom"===r&&!n("bottom")&&80>o.bottom&&(o.bottom=80)),o},[s,i,f,r]);return{legend:f,margin:g,legendPosition:r}}({data:_,colorBy:n,colorScale:Q,showLegend:m,legendPosition:s,userMargin:y,defaults:p,categories:z}),te=(0,gs.useMemo)(()=>{const e={};return U&&(e.legend=U,e.legendPosition=ee),i&&"none"!==i&&(e.legendHoverBehavior=W.onLegendHover,e.legendClickBehavior=W.onLegendClick,e.legendHighlightedCategory=W.highlightedCategory,e.legendIsolatedCategories=W.isolatedCategories),j&&n&&(e.legendCategoryAccessor=n,e.onCategoriesChange=L),e},[U,ee,i,W.onLegendHover,W.onLegendClick,W.highlightedCategory,W.isolatedCategories,j,n,L]),oe=Array.isArray(o)?h(o):o,ne=function(e,t,o,n){if(!e)return null;if(!1===n)return null;if(null!=n)return(0,is.jsx)("div",{style:{width:t,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:n});const r=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*r))),s=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(i+s)-s))/2);return(0,is.jsx)("div",{style:{width:t,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(e,o)=>(0,is.jsx)("div",{className:"semiotic-loading-bar",style:{...cs,position:"absolute",top:a+o*(i+s),left:Math.floor(.1*t),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2}},o))})}(k,M,C,S),re=ne?null:function(e,t,o,n){return!1===n||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,is.jsx)("div",{style:{...ls,width:t,height:o},children:n||"No data available"}):null}(oe,M,C,A);return{data:_,colorScale:F,allCategories:z,legendState:W,effectiveSelectionHook:q,activeSelectionHook:$,customHoverBehavior:H,customClickBehavior:O,mobileInteraction:T,legend:U,margin:J,legendPosition:ee,earlyReturn:ne||re||null,legendBehaviorProps:te,crosshairProps:D,resolvedSelection:G}}var ps=require("react");function bs({ref:e,frameRef:t,setup:o}){return(0,ps.useImperativeHandle)(e,()=>({push:e=>t.current?.push(e),pushMany:e=>t.current?.pushMany(e),remove:e=>t.current?.remove(e)??[],update:(e,o)=>t.current?.update(e,o)??[],clear:()=>t.current?.clear(),getData:()=>t.current?.getData()??[],getScales:()=>t.current?.getScales()??null}),[t]),{effectiveLegendProps:o.legendBehaviorProps,effectiveMargin:o.margin}}var vs=require("react");function xs(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return e??(()=>({}));const o={};return void 0!==t.stroke&&(o.stroke=t.stroke),void 0!==t.strokeWidth&&(o.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(o.opacity=t.opacity),e?(...t)=>({...e(...t)||{},...o}):(...e)=>({...o})}function ws(e){const{colorBy:t,colorScale:o,color:n,themeCategorical:r,colorScheme:i,categoryIndexMap:s,userPieceStyle:a,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,cycleByCategory:f=!1,baseStyleExtras:g,linkStrokeToFill:m=!1}=e,y=(0,vs.useMemo)(()=>(e,a)=>{const l="function"==typeof g?g(e,a):g,c=l?{...l}:{};if(void 0===c.fill)if(t){if(!o)return c;c.fill=Y(e,t,o)}else c.fill=function(e,t,o,n,r){if(e)return e;if(o&&"object"==typeof o&&!Array.isArray(o)){const e=K(o,n);if(e)return e}let i;if(Array.isArray(o))i=o;else if(t&&t.length>0)i=t;else if("string"==typeof o){const e=q[o];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=n?(r.has(n)||r.set(n,r.size),i[r.get(n)%i.length]):i[0]:"#007bff"}(n,r,i,f?a:void 0,s);return m&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,o,n,r,i,s,f,g,m]),p=(0,vs.useMemo)(()=>xs(a?"function"==typeof a?(e,t)=>({...y(e,t),...a(e,t)||{}}):(e,t)=>({...y(e,t),...a}):y,{stroke:l,strokeWidth:c,opacity:u}),[y,a,l,c,u]);return(0,vs.useMemo)(()=>{return e=p,o=h,(t=d??null)?(n,...r)=>{const i={...e(n,...r)};if(t.isActive)if(t.predicate(n))o?.selectedStyle&&Object.assign(i,o.selectedStyle);else{const e=o?.unselectedOpacity??.5;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,o?.unselectedStyle&&Object.assign(i,o.unselectedStyle)}return i}:e;var e,t,o},[p,d,h])}function ks(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 Ss=require("react/jsx-runtime"),As=(0,ai.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,ai.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:f,sort:g=!1,barPadding:m=40,roundedTop:y,gradientFill:p=!1,baselinePadding:b=!1,tooltip:v,annotations:x,regression:w,valueExtent:k,frameProps:S={},selection:A,linkedHover:M,onObservation:C,onClick:j,hoverHighlight:_,chartId:P,loading:R,loadingContent:L,emptyContent:I,legendInteraction:T,legendPosition:$,color:B,stroke:H,strokeWidth:O,opacity:E,showCategoryTicks:D,categoryFormat:F,dataIdAccessor:N}=e,{width:z,height:W,enableHover:q,showGrid:G,showLegend:V,title:X,description:Y,summary:K,accessibleTable:Z,categoryLabel:Q,valueLabel:U}=o,J=(0,ai.useMemo)(()=>h(r),[r]),ee=ys({data:J,rawData:r,colorBy:d,colorScheme:f,legendInteraction:T,legendPosition:$,selection:A,linkedHover:M,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:C,onClick:j,hoverHighlight:_,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BarChart",chartId:P,showLegend:V,userMargin:i,marginDefaults:o.marginDefaults,loading:R,loadingContent:L,emptyContent:I,width:z,height:W}),{effectiveLegendProps:te,effectiveMargin:oe}=bs({ref:t,frameRef:n,setup:ee});us("BarChart",J,"categoryAccessor",a),us("BarChart",J,"valueAccessor",l);const ne=Gi(J,g,l),re=qi(),ie=(0,ai.useMemo)(()=>new Map,[J]),se=ws({colorBy:d,colorScale:ee.colorScale,color:B,themeCategorical:re,colorScheme:f,categoryIndexMap:ie,userPieceStyle:S?.pieceStyle,stroke:H,strokeWidth:O,opacity:E,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ae=(0,ai.useMemo)(()=>Ji({categoryAccessor:a,valueAccessor:l,groupAccessor:d&&d!==a?d:void 0,groupLabel:"string"==typeof d?d:"group",valueFormat:u}),[a,l,d,u]);if(ee.earlyReturn)return ee.earlyReturn;const le=fs({componentName:"BarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(le)return(0,Ss.jsx)(ts,{componentName:"BarChart",message:le,width:z,height:W});const ce=ks(w),ue=ce?[ce,...x||[]]:x,de={chartType:"bar",...null!=r&&{data:ne},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:se,size:[z,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe,barPadding:m,...null!=y&&{roundedTop:y},...p&&{gradientFill:!0===p?{topOpacity:.8,bottomOpacity:.05}:p},...N&&{dataIdAccessor:N},baselinePadding:b,enableHover:q,showAxes:o.showAxes,oLabel:Q,rLabel:U,rFormat:u,...F&&{oFormat:F},showGrid:G,showCategoryTicks:D,oSort:g,...te,...ri({title:X,description:Y,summary:K,accessibleTable:Z,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:v,defaultTooltipContent:ae}),...ii({linkedHover:M,selection:A,onObservation:C,onClick:j,hoverHighlight:_,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...ue&&ue.length>0&&{annotations:ue},...k&&{rExtent:k},...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return(0,Ss.jsx)(as,{componentName:"BarChart",width:z,height:W,children:(0,Ss.jsx)(ni,{ref:n,...de})})});As.displayName="BarChart";var Ms=require("react"),Cs=require("react/jsx-runtime"),js=(0,Ms.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,Ms.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",stackBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:f,colorScheme:g,normalize:m=!1,sort:y=!1,barPadding:p=40,roundedTop:b,baselinePadding:v=!1,tooltip:x,annotations:w,valueExtent:k,frameProps:S={},selection:A,linkedHover:M,onObservation:C,onClick:j,hoverHighlight:_,chartId:P,loading:R,loadingContent:L,emptyContent:I,legendInteraction:T,legendPosition:$,color:B,stroke:H,strokeWidth:O,opacity:E,categoryFormat:D}=e,{width:F,height:N,enableHover:z,showGrid:W,showLegend:q,title:G,description:V,summary:X,accessibleTable:Y,categoryLabel:K,valueLabel:Z}=o,Q=(0,Ms.useMemo)(()=>h(r),[r]),U=f||l,J=ys({data:Q,rawData:r,colorBy:U,colorScheme:g,legendInteraction:T,legendPosition:$,selection:A,linkedHover:M,fallbackFields:U?["string"==typeof U?U:""]:[],unwrapData:!0,onObservation:C,onClick:j,hoverHighlight:_,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"StackedBarChart",chartId:P,showLegend:q,userMargin:i,marginDefaults:o.marginDefaults,loading:R,loadingContent:L,emptyContent:I,width:F,height:N}),ee=qi(),te=(0,Ms.useMemo)(()=>new Map,[Q]),oe=ws({colorBy:U,colorScale:J.colorScale,color:B,themeCategorical:ee,colorScheme:g,categoryIndexMap:te,userPieceStyle:S?.pieceStyle,stroke:H,strokeWidth:O,opacity:E,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection}),ne=(0,Ms.useMemo)(()=>Ji({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),re=fs({componentName:"StackedBarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c},requiredProps:{stackBy:l}}),{effectiveLegendProps:ie,effectiveMargin:se}=bs({ref:t,frameRef:n,setup:J});if(J.earlyReturn)return J.earlyReturn;const ae={chartType:"bar",...null!=r&&{data:Q},oAccessor:a,rAccessor:c,stackBy:l,normalize:m,oSort:y,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:oe,size:[F,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:se,barPadding:p,...null!=b&&{roundedTop:b},baselinePadding:v,enableHover:z,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:K,rLabel:Z,rFormat:d,...D&&{oFormat:D},showGrid:W,...ie,...ri({title:G,description:V,summary:X,accessibleTable:Y,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:x,defaultTooltipContent:ne}),...ii({linkedHover:M,selection:A,onObservation:C,onClick:j,hoverHighlight:_,mobileInteraction:J.mobileInteraction,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior}),...w&&w.length>0&&{annotations:w},...k&&{rExtent:k},...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return re?(0,Cs.jsx)(ts,{componentName:"StackedBarChart",message:re,width:F,height:N}):(0,Cs.jsx)(as,{componentName:"StackedBarChart",width:F,height:N,children:(0,Cs.jsx)(ni,{ref:n,...ae})})});js.displayName="StackedBarChart";var _s=require("react"),Ps=require("react/jsx-runtime"),Rs=(0,_s.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,_s.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",groupBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:f,colorScheme:g,sort:m=!1,barPadding:y=60,roundedTop:p,baselinePadding:b=!1,tooltip:v,annotations:x,valueExtent:w,frameProps:k={},selection:S,linkedHover:A,onObservation:M,onClick:C,hoverHighlight:j,chartId:_,loading:P,loadingContent:R,emptyContent:L,legendInteraction:I,legendPosition:T,color:$,stroke:B,strokeWidth:H,opacity:O,categoryFormat:E}=e,{width:D,height:F,enableHover:N,showGrid:z,showLegend:W,title:q,description:G,summary:V,accessibleTable:X,categoryLabel:Y,valueLabel:K}=o,Z=(0,_s.useMemo)(()=>h(r),[r]),Q=f||l,U=ys({data:Z,rawData:r,colorBy:Q,colorScheme:g,legendInteraction:I,legendPosition:T,selection:S,linkedHover:A,fallbackFields:Q?["string"==typeof Q?Q:""]:[],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:j,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"GroupedBarChart",chartId:_,showLegend:W,userMargin:i,marginDefaults:o.marginDefaults,loading:P,loadingContent:R,emptyContent:L,width:D,height:F}),J=qi(),ee=(0,_s.useMemo)(()=>new Map,[Z]),te=ws({colorBy:Q,colorScale:U.colorScale,color:$,themeCategorical:J,colorScheme:g,categoryIndexMap:ee,userPieceStyle:k.pieceStyle,stroke:B,strokeWidth:H,opacity:O,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection}),oe=(0,_s.useMemo)(()=>Ji({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),ne=fs({componentName:"GroupedBarChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c},requiredProps:{groupBy:l}}),{effectiveLegendProps:re,effectiveMargin:ie}=bs({ref:t,frameRef:n,setup:U});if(U.earlyReturn)return U.earlyReturn;const se={chartType:"clusterbar",...null!=r&&{data:Z},oAccessor:a,rAccessor:c,groupBy:l,oSort:m,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:te,size:[D,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ie,barPadding:y,...null!=p&&{roundedTop:p},baselinePadding:b,enableHover:N,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:Y,rLabel:K,rFormat:d,...E&&{oFormat:E},showGrid:z,...re,...ri({title:q,description:G,summary:V,accessibleTable:X,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:v,defaultTooltipContent:oe}),...ii({linkedHover:A,selection:S,onObservation:M,onClick:C,hoverHighlight:j,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior}),...x&&x.length>0&&{annotations:x},...w&&{rExtent:w},...Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e))};return ne?(0,Ps.jsx)(ts,{componentName:"GroupedBarChart",message:ne,width:D,height:F}):(0,Ps.jsx)(as,{componentName:"GroupedBarChart",width:D,height:F,children:(0,Ps.jsx)(ni,{ref:n,...se})})});Rs.displayName="GroupedBarChart";var Ls=require("react"),Is=require("react");function Ts({brushProp:e,onBrushProp:t,linkedBrush:o,valueAccessor:n}){const r=(i="string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0)?"string"==typeof i?{name:i}:i:null;var i;const s="string"==typeof n?n:"value",a=function(e){const{name:t,xField:o,yField:n}=e,{predicate:r,isActive:i,selectInterval:s,clear:a}=Ci({name:t,fields:[o,n].filter(Boolean)}),l=o&&n?"xyBrush":o?"xBrush":"yBrush",c=(0,xi.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)?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),n&&(t[n]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===l&&ji(e)?o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&ji(e)&&n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),_i(t)&&s(t)},[l,o,n,s,a]);return{brushInteraction:(0,xi.useMemo)(()=>({brush:l,during:c,end:c}),[l,c]),predicate:r,isActive:i,clear:a}}({name:r?.name||"__unused_ordinal_brush__",xField:r?.xField||s}),l=(0,Is.useRef)(a.brushInteraction);l.current=a.brushInteraction;const c=(0,Is.useCallback)(e=>{if(r){l.current.end(e?e.r:null)}t?.(e)},[t,r]),u=!!(e||o||t);return{hasBrush:u,handleBrush:c,brushStreamProps:u?{brush:{dimension:"r"},onBrush:c}:{}}}var $s=require("react/jsx-runtime"),Bs=(0,Ls.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,Ls.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",subcategoryAccessor:l,valueAccessor:c="value",orientation:u="horizontal",valueFormat:d,colorBy:f,colorScheme:g,barPadding:m,tooltip:y,annotations:p,brush:b,onBrush:v,linkedBrush:x,frameProps:w={},selection:k,linkedHover:S,onObservation:A,onClick:M,hoverHighlight:C,chartId:j,loading:_,loadingContent:P,emptyContent:R,legendInteraction:L,legendPosition:I,color:T,stroke:$,strokeWidth:B,opacity:H,categoryFormat:O,rTickValues:E,tickLabelEdgeAlign:D,showCategoryTicks:F,gradientFill:N,trackFill:z,roundedTop:W,valueExtent:q}=e,{width:G,height:V,enableHover:X,showGrid:Y,showLegend:K,title:Z,description:Q,summary:U,accessibleTable:J,categoryLabel:ee,valueLabel:te}=o,oe=(0,Ls.useMemo)(()=>h(r),[r]),ne=f||l,re=(0,Ls.useMemo)(()=>{if(null!=m)return m;if("sparkline"!==e.mode)return 40;const t=new Set(oe.map(e=>"function"==typeof a?a(e):e[a])),o=Math.max(1,t.size);return o>1?Math.max(0,Math.min(1,(("horizontal"===u?V:G)-2*o)/(o-1))):1},[m,e.mode,oe,a,u,G,V]),ie=ys({data:oe,rawData:r,colorBy:ne,colorScheme:g,legendInteraction:L,legendPosition:I,selection:k,linkedHover:S,fallbackFields:ne?["string"==typeof ne?ne:""]:[],unwrapData:!0,onObservation:A,onClick:M,hoverHighlight:C,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"SwimlaneChart",chartId:j,showLegend:K,userMargin:i,marginDefaults:o.marginDefaults,loading:_,loadingContent:P,emptyContent:R,width:G,height:V}),se=Ts({brushProp:b,onBrushProp:v,linkedBrush:x,valueAccessor:c}),ae=qi(),le=(0,Ls.useMemo)(()=>new Map,[oe]),ce=ws({colorBy:ne,colorScale:ie.colorScale,color:T,themeCategorical:ae,colorScheme:g,categoryIndexMap:le,userPieceStyle:w?.pieceStyle,stroke:$,strokeWidth:B,opacity:H,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,cycleByCategory:!0}),ue=(0,Ls.useMemo)(()=>Ji({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),de=fs({componentName:"SwimlaneChart",data:r,accessors:{categoryAccessor:a,valueAccessor:c,subcategoryAccessor:l},requiredProps:{subcategoryAccessor:l}}),{effectiveLegendProps:he,effectiveMargin:fe}=bs({ref:t,frameRef:n,setup:ie});if(ie.earlyReturn)return ie.earlyReturn;const ge={chartType:"swimlane",...null!=r&&{data:oe},oAccessor:a,rAccessor:c,stackBy:l,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:ce,size:[G,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:fe,barPadding:re,enableHover:X,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:!1===F?void 0:ee,rLabel:te,rFormat:d,...E&&{rTickValues:E},...null!=D&&{tickLabelEdgeAlign:D},...O&&{oFormat:O},...void 0!==F&&{showCategoryTicks:F},showGrid:Y,...he,...ri({title:Z,description:Q,summary:U,accessibleTable:J,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:y,defaultTooltipContent:ue}),...ii({linkedHover:S,selection:k,onObservation:A,onClick:M,hoverHighlight:C,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...p&&p.length>0&&{annotations:p},...N&&{gradientFill:!0===N?{topOpacity:.8,bottomOpacity:.05}:N},...null!=z&&{trackFill:z},...null!=W&&{roundedTop:W},...q&&{rExtent:q},...se.brushStreamProps,...Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e))};return de?(0,$s.jsx)(ts,{componentName:"SwimlaneChart",message:de,width:G,height:V}):(0,$s.jsx)(as,{componentName:"SwimlaneChart",width:G,height:V,children:(0,$s.jsx)(ni,{ref:n,...ge})})});Bs.displayName="SwimlaneChart";var Hs=require("react"),Os=require("react");function Es(e,t){const{variant:o,frameRef:n,overrides:r,deps:i}=t;(0,Os.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,o)=>e.current?.update(t,o)??[],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 o=Array.isArray(t)?t:[t],n=e.current?.getTopology()?.nodes??[],r=[];for(const t of o){const o=n.find(e=>e.id===t);o&&r.push({...o.data??{},id:t}),e.current?.removeNode(t)}return r},update:(t,o)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const n=e.current?.updateNode(t,o);return n?[{...n,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,o)=>{const n=e.current?.removePoint(t)??[];for(const t of n)e.current?.push(o(t));return n},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const o=t;return{push:e=>o.current?.pushLine(e),pushMany:e=>o.current?.pushManyLines(e),remove:e=>o.current?.removeLine(e)??[],update:(e,t)=>{const n=o.current?.removeLine(e)??[];for(const e of n)o.current?.pushLine(t(e));return n},clear:()=>o.current?.clear(),getData:()=>o.current?.getLines()??[],getCustomLayout:()=>o.current?.getCustomLayout?.()??null,getLayoutFailure:()=>o.current?.getLayoutFailure?.()??null}}(o,n);return{...e,...r}},i??[])}var Ds=require("react/jsx-runtime"),Fs=(0,Hs.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,Hs.useRef)(null);Es(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:f,sizeBy:g,sizeRange:m=[3,8],symbolBy:y,symbolMap:p,pointRadius:b=4,pointOpacity:v=.7,categoryPadding:x=20,tooltip:w,annotations:k,valueExtent:S,brush:A,onBrush:M,linkedBrush:C,frameProps:j={},selection:_,linkedHover:P,onObservation:R,onClick:L,hoverHighlight:I,chartId:T,loading:$,loadingContent:B,emptyContent:H,legendInteraction:O,legendPosition:E,color:D,stroke:F,strokeWidth:N,opacity:z,showCategoryTicks:W,categoryFormat:q}=e,{width:G,height:V,enableHover:X,showGrid:Y,showLegend:K,title:Z,description:U,summary:J,accessibleTable:ee,categoryLabel:te,valueLabel:oe}=o,ne=(0,Hs.useMemo)(()=>h(r),[r]),re=ys({data:ne,rawData:r,colorBy:d,colorScheme:f,legendInteraction:O,legendPosition:E,selection:_,linkedHover:P,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:R,onClick:L,hoverHighlight:I,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"SwarmPlot",chartId:T,showLegend:K,userMargin:i,marginDefaults:o.marginDefaults,loading:$,loadingContent:B,emptyContent:H,width:G,height:V}),ie=Ts({brushProp:A,onBrushProp:M,linkedBrush:C,valueAccessor:l}),se=(0,Hs.useMemo)(()=>{if(g)return le(ne.map(e=>"function"==typeof g?g(e):e[g]))},[ne,g]),ae=qi(),ce=(0,Hs.useMemo)(()=>new Map,[ne]),ue=ws({colorBy:d,colorScale:re.colorScale,color:D,themeCategorical:ae,colorScheme:f,categoryIndexMap:ce,userPieceStyle:j?.pieceStyle,stroke:F,strokeWidth:N,opacity:z,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection,baseStyleExtras:e=>({fillOpacity:v,r:g?Q(e,g,m,se):b})}),de=(0,Hs.useMemo)(()=>Ji({categoryAccessor:a,valueAccessor:l,groupAccessor:d||void 0,valueFormat:u}),[a,l,d,u]);if(re.earlyReturn)return re.earlyReturn;const he=fs({componentName:"SwarmPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(he)return(0,Ds.jsx)(ts,{componentName:"SwarmPlot",message:he,width:G,height:V});const fe={chartType:"swarm",...null!=r&&{data:ne},oAccessor:a,rAccessor:l,...y&&{symbolAccessor:y},...p&&{symbolMap:p},projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:ue,size:[G,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:re.margin,barPadding:x,enableHover:X,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:te,rLabel:oe,rFormat:u,...q&&{oFormat:q},showGrid:Y,showCategoryTicks:W,...re.legendBehaviorProps,...ri({title:Z,description:U,summary:J,accessibleTable:ee,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:w,defaultTooltipContent:de}),...ii({linkedHover:P,selection:_,onObservation:R,onClick:L,hoverHighlight:I,mobileInteraction:re.mobileInteraction,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior}),...k&&k.length>0&&{annotations:k},...S&&{rExtent:S},...ie.brushStreamProps,...Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e))};return(0,Ds.jsx)(as,{componentName:"SwarmPlot",width:G,height:V,children:(0,Ds.jsx)(ni,{ref:n,...fe})})});Fs.displayName="SwarmPlot";var Ns=require("react"),zs=require("react/jsx-runtime");function Ws(e){return t=>{const o=t.category||t.data&&t.data[0]?.category||"",n=t.stats||(t.data||t).stats;if(n&&null!=n.median)return(0,zs.jsxs)("div",{className:"semiotic-tooltip",style:Nn,children:[o&&(0,zs.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),null!=n.n&&(0,zs.jsxs)("div",{children:["n = ",n.n]}),null!=n.min&&(0,zs.jsxs)("div",{children:["Min: ",n.min.toLocaleString()]}),null!=n.q1&&(0,zs.jsxs)("div",{children:["Q1: ",n.q1.toLocaleString()]}),(0,zs.jsxs)("div",{children:["Median: ",n.median.toLocaleString()]}),null!=n.q3&&(0,zs.jsxs)("div",{children:["Q3: ",n.q3.toLocaleString()]}),null!=n.max&&(0,zs.jsxs)("div",{children:["Max: ",n.max.toLocaleString()]}),null!=n.mean&&(0,zs.jsxs)("div",{style:{opacity:.8},children:["Mean: ",n.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(e?.valueAccessor){const n=e.valueAccessor,r=(Array.isArray(t.data)?t.data:[]).map(e=>Number("function"==typeof n?n(e):e[n])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),i=r.length,s=i>0?i%2!=0?r[Math.floor(i/2)]:(r[i/2-1]+r[i/2])/2:null;return(0,zs.jsxs)("div",{className:"semiotic-tooltip",style:Nn,children:[o&&(0,zs.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),i>0&&(0,zs.jsxs)("div",{children:["n = ",i]}),null!=s&&(0,zs.jsxs)("div",{children:["Median: ",s.toLocaleString()]})]})}return(0,zs.jsx)("div",{className:"semiotic-tooltip",style:Nn,children:(0,zs.jsx)("div",{style:{fontWeight:"bold"},children:o+""})})}}var qs=require("react/jsx-runtime"),Gs=(0,Ns.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,Ns.useRef)(null);Es(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:f,showOutliers:g=!0,outlierRadius:m=3,categoryPadding:y=20,tooltip:p,annotations:b,valueExtent:v,frameProps:x={},selection:w,linkedHover:k,onObservation:S,onClick:A,hoverHighlight:M,chartId:C,loading:j,loadingContent:_,emptyContent:P,legendInteraction:R,legendPosition:L,color:I,stroke:T,strokeWidth:$,opacity:B,showCategoryTicks:H,categoryFormat:O}=e,{width:E,height:D,enableHover:F,showGrid:N,showLegend:z,title:W,description:q,summary:G,accessibleTable:V,categoryLabel:X,valueLabel:Y}=o,K=(0,Ns.useMemo)(()=>h(r),[r]),Z=ys({data:K,rawData:r,colorBy:d,colorScheme:f,legendInteraction:R,legendPosition:L,selection:w,linkedHover:k,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:S,onClick:A,hoverHighlight:M,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BoxPlot",chartId:C,showLegend:z,userMargin:i,marginDefaults:o.marginDefaults,loading:j,loadingContent:_,emptyContent:P,width:E,height:D}),Q=qi(),U=(0,Ns.useMemo)(()=>new Map,[K]),J=ws({colorBy:d,colorScale:Z.colorScale,color:I,themeCategorical:Q,colorScheme:f,categoryIndexMap:U,userPieceStyle:void 0,stroke:T,strokeWidth:$,opacity:B,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ee=(0,Ns.useMemo)(()=>Ws(),[]);if(Z.earlyReturn)return Z.earlyReturn;const te=fs({componentName:"BoxPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(te)return(0,qs.jsx)(ts,{componentName:"BoxPlot",message:te,width:E,height:D});const oe={chartType:"boxplot",...null!=r&&{data:K},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:J,showOutliers:g,size:[E,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,barPadding:y,enableHover:F,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:X,rLabel:Y,rFormat:u,...O&&{oFormat:O},showGrid:N,showCategoryTicks:H,...Z.legendBehaviorProps,...ri({title:W,description:q,summary:G,accessibleTable:V,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:p,defaultTooltipContent:ee}),...ii({linkedHover:k,selection:w,onObservation:S,onClick:A,hoverHighlight:M,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior}),...b&&b.length>0&&{annotations:b},...v&&{rExtent:v},...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return(0,qs.jsx)(as,{componentName:"BoxPlot",width:E,height:D,children:(0,qs.jsx)(ni,{ref:n,...oe})})});Gs.displayName="BoxPlot";var Vs=require("react"),Xs=require("react/jsx-runtime"),Ys=e=>{const t=e?.category;return null==t?"All":t+""},Ks=(0,Vs.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:"horizontal",mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,Vs.useRef)(null);Es(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a=Ys,valueAccessor:l="value",bins:c=25,relative:u=!1,valueFormat:d,colorBy:f,colorScheme:g,categoryPadding:m=20,tooltip:y,annotations:p,valueExtent:b,brush:v,onBrush:x,linkedBrush:w,frameProps:k={},selection:S,linkedHover:A,onObservation:M,onClick:C,hoverHighlight:j,chartId:_,loading:P,loadingContent:R,emptyContent:L,legendInteraction:I,legendPosition:T,color:$,stroke:B,strokeWidth:H,opacity:O,showCategoryTicks:E,categoryFormat:D}=e,{width:F,height:N,enableHover:z,showGrid:W,showLegend:q,title:G,description:V,summary:X,accessibleTable:Y,categoryLabel:K,valueLabel:Z}=o,Q=(0,Vs.useMemo)(()=>h(r),[r]),U=ys({data:Q,rawData:r,colorBy:f,colorScheme:g,legendInteraction:I,legendPosition:T,selection:S,linkedHover:A,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:j,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"Histogram",chartId:_,showLegend:q,userMargin:i,marginDefaults:o.marginDefaults,loading:P,loadingContent:R,emptyContent:L,width:F,height:N}),J=Ts({brushProp:v,onBrushProp:x,linkedBrush:w,valueAccessor:l}),ee=(0,Vs.useMemo)(()=>{if(0===Q.length)return;const e="function"==typeof l?l:e=>e[l];let t=1/0,o=-1/0;for(const n of Q){const r=e(n);null!=r&&isFinite(r)&&(t>r&&(t=r),r>o&&(o=r))}return t>o?void 0:[t,o]},[Q,l]),te=qi(),oe=(0,Vs.useMemo)(()=>new Map,[Q]),ne=ws({colorBy:f,colorScale:U.colorScale,color:$,themeCategorical:te,colorScheme:g,categoryIndexMap:oe,userPieceStyle:void 0,stroke:B,strokeWidth:H,opacity:O,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),re=(0,Vs.useMemo)(()=>e=>{const t=e.data||e,o=t.category||e.category||"",n=t.count,r=t.range;return(0,Xs.jsxs)("div",{className:"semiotic-tooltip",style:Nn,children:[o&&(0,Xs.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),null!=n&&(0,Xs.jsxs)("div",{children:["Count: ",n]}),r&&2===r.length&&(0,Xs.jsxs)("div",{style:{opacity:.8},children:[Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)]})]})},[]);if(U.earlyReturn)return U.earlyReturn;const ie=fs({componentName:"Histogram",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(ie)return(0,Xs.jsx)(ts,{componentName:"Histogram",message:ie,width:F,height:N});const se={chartType:"histogram",...null!=r&&{data:Q},oAccessor:a,rAccessor:l,projection:"horizontal",summaryStyle:ne,bins:c,normalize:u,...b?{rExtent:b}:ee&&{rExtent:ee},size:[F,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,barPadding:m,enableHover:z,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:K,rLabel:Z,rFormat:d,...D&&{oFormat:D},showGrid:W,showCategoryTicks:E,...U.legendBehaviorProps,...ri({title:G,description:V,summary:X,accessibleTable:Y,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:y,defaultTooltipContent:re}),...ii({linkedHover:A,selection:S,onObservation:M,onClick:C,hoverHighlight:j,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior}),...p&&p.length>0&&{annotations:p},...J.brushStreamProps,...Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e))};return(0,Xs.jsx)(as,{componentName:"Histogram",width:F,height:N,children:(0,Xs.jsx)(ni,{ref:n,...se})})});Ks.displayName="Histogram";var Zs=require("react"),Qs=require("react/jsx-runtime"),Us=(0,Zs.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,Zs.useRef)(null);Es(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",bins:u=25,curve:d="catmullRom",showIQR:f=!0,valueFormat:g,colorBy:m,colorScheme:y,categoryPadding:p=20,tooltip:b,annotations:v,valueExtent:x,brush:w,onBrush:k,linkedBrush:S,frameProps:A={},selection:M,linkedHover:C,onObservation:j,onClick:_,hoverHighlight:P,chartId:R,loading:L,loadingContent:I,emptyContent:T,legendInteraction:$,legendPosition:B,color:H,stroke:O,strokeWidth:E,opacity:D,showCategoryTicks:F,categoryFormat:N}=e,{width:z,height:W,enableHover:q,showGrid:G,showLegend:V,title:X,description:Y,summary:K,accessibleTable:Z,categoryLabel:Q,valueLabel:U}=o,J=(0,Zs.useMemo)(()=>h(r),[r]),ee=ys({data:J,rawData:r,colorBy:m,colorScheme:y,legendInteraction:$,legendPosition:B,selection:M,linkedHover:C,fallbackFields:m?["string"==typeof m?m:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:j,onClick:_,hoverHighlight:P,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"ViolinPlot",chartId:R,showLegend:V,userMargin:i,marginDefaults:o.marginDefaults,loading:L,loadingContent:I,emptyContent:T,width:z,height:W}),te=Ts({brushProp:w,onBrushProp:k,linkedBrush:S,valueAccessor:l}),oe=qi(),ne=(0,Zs.useMemo)(()=>new Map,[J]),re=ws({colorBy:m,colorScale:ee.colorScale,color:H,themeCategorical:oe,colorScheme:y,categoryIndexMap:ne,userPieceStyle:void 0,stroke:O,strokeWidth:E,opacity:D,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),ie=(0,Zs.useMemo)(()=>Ws({valueAccessor:l}),[l]);if(ee.earlyReturn)return ee.earlyReturn;const se=fs({componentName:"ViolinPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(se)return(0,Qs.jsx)(ts,{componentName:"ViolinPlot",message:se,width:z,height:W});const ae={chartType:"violin",...null!=r&&{data:J},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:re,bins:u,showIQR:f,size:[z,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ee.margin,barPadding:p,enableHover:q,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:Q,rLabel:U,rFormat:g,...N&&{oFormat:N},showGrid:G,showCategoryTicks:F,...ee.legendBehaviorProps,...ri({title:X,description:Y,summary:K,accessibleTable:Z,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:b,defaultTooltipContent:ie}),...ii({linkedHover:C,selection:M,onObservation:j,onClick:_,hoverHighlight:P,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...v&&v.length>0&&{annotations:v},...x&&{rExtent:x},...te.brushStreamProps,...Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e))};return(0,Qs.jsx)(as,{componentName:"ViolinPlot",width:z,height:W,children:(0,Qs.jsx)(ni,{ref:n,...ae})})});Us.displayName="ViolinPlot";var Js=require("react"),ea=require("react/jsx-runtime"),ta=(0,Js.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid??!0,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,Js.useRef)(null);Es(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="horizontal",valueFormat:u,colorBy:d,colorScheme:f,sort:g="auto",dotRadius:m=5,categoryPadding:y=10,tooltip:p,annotations:b,regression:v,valueExtent:x,frameProps:w={},selection:k,linkedHover:S,onObservation:A,onClick:M,hoverHighlight:C,chartId:j,loading:_,loadingContent:P,emptyContent:R,legendInteraction:L,legendPosition:I,color:T,stroke:$,strokeWidth:B,opacity:H,categoryFormat:O}=e,{width:E,height:D,enableHover:F,showGrid:N,showLegend:z,title:W,description:q,summary:G,accessibleTable:V,categoryLabel:X,valueLabel:Y}=o,K=(0,Js.useMemo)(()=>h(r),[r]),Z=ys({data:K,rawData:r,colorBy:d,colorScheme:f,legendInteraction:L,legendPosition:I,selection:k,linkedHover:S,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:A,onClick:M,hoverHighlight:C,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DotPlot",chartId:j,showLegend:z,userMargin:i,marginDefaults:o.marginDefaults,loading:_,loadingContent:P,emptyContent:R,width:E,height:D}),Q=Gi(K,g,l),U=qi(),J=(0,Js.useMemo)(()=>new Map,[K]),ee=ws({colorBy:d,colorScale:Z.colorScale,color:T,themeCategorical:U,colorScheme:f,categoryIndexMap:J,userPieceStyle:w?.pieceStyle,stroke:$,strokeWidth:B,opacity:H,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{r:m,fillOpacity:.8}}),te=(0,Js.useMemo)(()=>Ji({categoryAccessor:a,valueAccessor:l,valueFormat:u}),[a,l,u]);if(Z.earlyReturn)return Z.earlyReturn;const oe=fs({componentName:"DotPlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(oe)return(0,ea.jsx)(ts,{componentName:"DotPlot",message:oe,width:E,height:D});const ne=ks(v),re=ne?[ne,...b||[]]:b,ie={chartType:"point",...null!=r&&{data:Q},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:ee,size:[E,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,barPadding:y,enableHover:F,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:X,rLabel:Y,rFormat:u,...O&&{oFormat:O},showGrid:N,oSort:g,...Z.legendBehaviorProps,...ri({title:W,description:q,summary:G,accessibleTable:V,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:p,defaultTooltipContent:te}),...ii({linkedHover:S,selection:k,onObservation:A,onClick:M,hoverHighlight:C,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior}),...re&&re.length>0&&{annotations:re},...x&&{rExtent:x},...Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e))};return(0,ea.jsx)(as,{componentName:"DotPlot",width:E,height:D,children:(0,ea.jsx)(ni,{ref:n,...ie})})});ta.displayName="DotPlot";var oa=require("react"),na=require("react/jsx-runtime"),ra=(0,oa.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width??400,height:e.height??400,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:e.showCategoryTicks,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,oa.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",colorBy:c,colorScheme:u,startAngle:d=0,cornerRadius:f,tooltip:g,annotations:m,frameProps:y={},selection:p,linkedHover:b,onObservation:v,onClick:x,hoverHighlight:w,chartId:k,loading:S,loadingContent:A,emptyContent:M,legendInteraction:C,legendPosition:j,color:_,stroke:P,strokeWidth:R,opacity:L}=e,{width:I,height:T,enableHover:$,showLegend:B,title:H,description:O,summary:E,accessibleTable:D}=o,F=(0,oa.useMemo)(()=>h(r),[r]),N=c||a,z=ys({data:F,rawData:r,colorBy:N,colorScheme:u,legendInteraction:C,legendPosition:j,selection:p,linkedHover:b,fallbackFields:N?["string"==typeof N?N:""]:[],unwrapData:!0,onObservation:v,onClick:x,hoverHighlight:w,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"PieChart",chartId:k,showLegend:B,userMargin:i,marginDefaults:o.marginDefaults,loading:S,loadingContent:A,emptyContent:M,width:I,height:T}),W=qi(),q=(0,oa.useMemo)(()=>new Map,[F]),G=ws({colorBy:N,colorScale:z.colorScale,color:_,themeCategorical:W,colorScheme:u,categoryIndexMap:q,userPieceStyle:y?.pieceStyle,stroke:P,strokeWidth:R,opacity:L,effectiveSelectionHook:z.effectiveSelectionHook,resolvedSelection:z.resolvedSelection,cycleByCategory:!0}),V=(0,oa.useMemo)(()=>Ji({categoryAccessor:a,valueAccessor:l,groupAccessor:c&&c!==a?c:void 0,groupLabel:"string"==typeof c?c:"group",pieData:!0}),[a,l,c]),X=fs({componentName:"PieChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}}),{effectiveLegendProps:Y,effectiveMargin:K}=bs({ref:t,frameRef:n,setup:z});if(z.earlyReturn)return z.earlyReturn;const Z={chartType:"pie",...null!=r&&{data:F},oAccessor:a,rAccessor:l,projection:"radial",pieceStyle:G,startAngle:d,...null!=f&&{cornerRadius:f},size:[I,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K,enableHover:$,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...Y,...ri({title:H,description:O,summary:E,accessibleTable:D,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:g,defaultTooltipContent:V}),...ii({linkedHover:b,selection:p,onObservation:v,onClick:x,hoverHighlight:w,mobileInteraction:z.mobileInteraction,customHoverBehavior:z.customHoverBehavior,customClickBehavior:z.customClickBehavior}),...m&&m.length>0&&{annotations:m},...Object.fromEntries(Object.entries(y).filter(([e])=>"pieceStyle"!==e))};return X?(0,na.jsx)(ts,{componentName:"PieChart",message:X,width:I,height:T}):(0,na.jsx)(as,{componentName:"PieChart",width:I,height:T,children:(0,na.jsx)(ni,{ref:n,...Z})})});ra.displayName="PieChart";var ia=require("react"),sa=require("react/jsx-runtime"),aa=(0,ia.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,showCategoryTicks:e.showCategoryTicks,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:400,height:400}),n=(0,ia.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",innerRadius:c,centerContent:u,colorBy:d,colorScheme:f,startAngle:g=0,cornerRadius:m,tooltip:y,annotations:p,frameProps:b={},selection:v,linkedHover:x,onObservation:w,onClick:k,hoverHighlight:S,chartId:A,loading:M,loadingContent:C,emptyContent:j,legendInteraction:_,legendPosition:P,color:R,stroke:L,strokeWidth:I,opacity:T}=e,{width:$,height:B,enableHover:H,showLegend:O,title:E,description:D,summary:F,accessibleTable:N}=o,z=(0,ia.useMemo)(()=>h(r),[r]),W=d||a,q=ys({data:z,rawData:r,colorBy:W,colorScheme:f,legendInteraction:_,legendPosition:P,selection:v,linkedHover:x,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DonutChart",chartId:A,showLegend:O,userMargin:i,marginDefaults:o.marginDefaults,loading:M,loadingContent:C,emptyContent:j,width:$,height:B}),G=c??Math.max(2,.15*Math.min($,B)),V=qi(),X=(0,ia.useMemo)(()=>new Map,[z]),Y=ws({colorBy:W,colorScale:q.colorScale,color:R,themeCategorical:V,colorScheme:f,categoryIndexMap:X,userPieceStyle:b?.pieceStyle,stroke:L,strokeWidth:I,opacity:T,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),K=(0,ia.useMemo)(()=>Ji({categoryAccessor:a,valueAccessor:l,groupAccessor:d&&d!==a?d:void 0,groupLabel:"string"==typeof d?d:"group",pieData:!0}),[a,l,d]),Z=fs({componentName:"DonutChart",data:r,accessors:{categoryAccessor:a,valueAccessor:l}}),{effectiveLegendProps:Q,effectiveMargin:U}=bs({ref:t,frameRef:n,setup:q});if(q.earlyReturn)return q.earlyReturn;const J={chartType:"donut",...null!=r&&{data:z},oAccessor:a,rAccessor:l,projection:"radial",pieceStyle:Y,innerRadius:G,startAngle:g,...null!=m&&{cornerRadius:m},centerContent:u,size:[$,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U,enableHover:H,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...Q,...ri({title:E,description:D,summary:F,accessibleTable:N,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:y,defaultTooltipContent:K}),...ii({linkedHover:x,selection:v,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:q.mobileInteraction,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior}),...p&&p.length>0&&{annotations:p},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return Z?(0,sa.jsx)(ts,{componentName:"DonutChart",message:Z,width:$,height:B}):(0,sa.jsx)(as,{componentName:"DonutChart",width:$,height:B,children:(0,sa.jsx)(ni,{ref:n,...J})})});aa.displayName="DonutChart";var la=require("react");function ca(e=240){const t=360-e,o=180+t/2,n=o*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:o,startAngleRad:n,offsetRad:-Math.PI/2+n}}function ua(e){return Math.max(0,Math.min(1,e))}function da(e){const t=e.trim();if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),6===e.length&&/^[0-9a-f]{6}$/i.test(e))return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const o=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(o){const e=[Number(o[1]),Number(o[2]),Number(o[3])];if(e.every(Number.isFinite))return e}return null}function ha(e,t,o){const n=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function fa(e,t){const o=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:ua(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===o.length)return"#999999";if(1===o.length)return o[0].color;const n=ua(t);if(o[0].offset>=n)return o[0].color;if(n>=o[o.length-1].offset)return o[o.length-1].color;for(let e=0;o.length-1>e;e++){const t=o[e],r=o[e+1];if(t.offset>n||n>r.offset)continue;const i=r.offset-t.offset,s=i>0?(n-t.offset)/i:0,a=da(t.color),l=da(r.color);if(!a||!l)return.5>s?t.color:r.color;const[c,u,d]=a,[h,f,g]=l;return ha(c+(h-c)*s,u+(f-u)*s,d+(g-d)*s)}return o[o.length-1].color}function ga(e,t,o){return null==o?`${e}-${t}`:`${e}-${t}-${o}`}var ma=require("react/jsx-runtime"),ya=(0,la.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:!1,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:300,height:250}),n=(0,la.useRef)(null),r="context"===e.mode,{compactMode:i}=o,{value:s,min:a=0,max:l=100,thresholds:c,gradientFill:u,color:d,backgroundColor:h="var(--semiotic-grid, #e0e0e0)",arcWidth:f=.3,cornerRadius:g,showNeedle:m=!0,needleColor:y="var(--semiotic-text, #333)",centerContent:p,valueFormat:b,showScaleLabels:v=!i,sweep:x=240,fillZones:w=!0,tooltip:k,annotations:S,frameProps:A={},className:M,stroke:C,strokeWidth:j,opacity:_}=e,{width:P,height:R,title:L,description:I,summary:T,accessibleTable:$}=o,B=u&&"object"==typeof u?u:void 0,H=Math.max(a,Math.min(l,s)),O=l-a||1,E=(H-a)/O,{gaugeData:D,pieceStyle:F,gaugeAnnotations:N}=(0,la.useMemo)(()=>function(e){const{min:t,max:o,value:n,thresholds:r,fillColor:i,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=o-t||1,h=(Math.max(t,Math.min(o,n))-t)/d;let f=r&&r.length>0?[...r].sort((e,t)=>e.value-t.value):[{value:o,color:i||"#007bff"}];f=f.map(e=>({...e,value:Math.max(t,Math.min(o,e.value))})),o>f[f.length-1].value&&f.push({value:o,color:f[f.length-1].color});const g=!!c&&c.colorStops.length>=2,m=[],y=new Map,p=[];if(g){const e=a?h:1,t=ga("bg",0);if(m.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),y.set(t,{fill:s,opacity:.4}),e>0){const t=Math.max(1,Math.floor(u)),o=Math.max(1,Math.min(t,Math.round(e*t))),n=[];for(let t=0;o>t;t++)n.push(fa(c.colorStops,e*(t+.5)/o));const r=ga("fill",0);m.push({category:r,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:n}}),y.set(r,{fill:n[0]||s})}}else{let e=t;for(let o=0;f.length>o;o++){const n=f[o],r=(n.value-e)/d,i=(e-t)/d,l=(n.value-t)/d,c=Math.max(0,(a?Math.min(h,l):l)-i),u=a?Math.max(0,r-c):0;if(c>0){const e=ga("fill",o);m.push({category:e,value:c,_zone:n.label||"Zone "+(o+1),_isFill:!0}),y.set(e,{fill:n.color})}if(u>0){const e=ga("bg",o);m.push({category:e,value:u,_zone:n.label||"Zone "+(o+1),_isFill:!1}),y.set(e,{fill:s,opacity:.4})}e=n.value}}if(l&&r&&r.length>0)for(const e of r)e.value>t&&o>e.value&&p.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:m,pieceStyle:(e,t)=>y.get(t||e.category)||{fill:s},gaugeAnnotations:p}}({min:a,max:l,value:s,thresholds:c,fillColor:d,backgroundColor:h,fillZones:w,showScaleLabels:v,gradientFill:B}),[s,a,l,c,d,h,v,w,B]),z=(0,la.useMemo)(()=>xs(F,{stroke:C,strokeWidth:j,opacity:_}),[F,C,j,_]),{sweepRad:W,startAngleDeg:q}=ca(x),G=function(e=240){const{sweepRad:t,offsetRad:o}=ca(e),n=[[Math.cos(o),Math.sin(o)],[Math.cos(o+t),Math.sin(o+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-o)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||n.push([Math.cos(e),Math.sin(e)]);const r=n.map(e=>e[0]),i=n.map(e=>e[1]),[s,a]=le(r),[l,c]=le(i);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(x),V=Math.min(10,Math.max(1,Math.min(P,R)/12)),X=G.cx,Y=G.cy,K=Math.max(4,Math.min((P-2*V)/G.width,(R-2*V)/G.height)-2),Z=Math.max(0,Math.min(K-1.5,K*(1-f))),Q=P/2-X*K,U=R/2-Y*K,J=2*(K+4),ee=(0,la.useMemo)(()=>{if(i&&null==p)return null;if(null!=p)return"function"==typeof p?p(H,a,l):p;const e=b?b(H):Math.round(H)+"";return(0,ma.jsxs)("div",{style:{textAlign:"center",lineHeight:1.2},children:[(0,ma.jsx)("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"},children:e}),v&&(0,ma.jsxs)("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[a," – ",l]})]})},[p,H,a,l,b,v,K,i]),te=(0,la.useMemo)(()=>r&&null==p?{type:"gauge-value",text:b?b(H):Math.round(H)+""}:null,[r,p,H,b]),oe=(0,la.useMemo)(()=>{if(!m)return null;const e=-Math.PI/2+q*Math.PI/180+E*W,t=Z>20?Z-8:K-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:y}},[m,E,q,W,Z,y]),ne=(0,la.useMemo)(()=>(e,t,o)=>{if("gauge-needle"===e.type){const n=(o.width||P)/2,r=(o.height||R)/2,i=Math.max(1,K-Z),s=Math.max(1,Math.min(2.5,.4*i)),a=Math.max(1,Math.min(5,.6*i));return(0,ma.jsxs)("g",{transform:`translate(${n},${r})`,children:[(0,ma.jsx)("line",{x1:0,y1:0,x2:e.tipX,y2:e.tipY,stroke:e.color,strokeWidth:s,strokeLinecap:"round"}),(0,ma.jsx)("circle",{cx:0,cy:0,r:a,fill:e.color})]},"gauge-needle-"+t)}if("gauge-label"===e.type){const n=-Math.PI/2+q*Math.PI/180+(e.value-a)/O*W,r=(o.width||P)/2,i=(o.height||R)/2,s=Z-1,l=K+1,c=Math.cos(n)*s,u=Math.sin(n)*s,d=Math.cos(n)*l,h=Math.sin(n)*l,f=K+10,g=Math.cos(n)*f,m=Math.sin(n)*f,y=((n+Math.PI/2)/(2*Math.PI)*12+12)%12;let p,b;return y>=11||1>y?(p="middle",b="auto"):y>=1&&5>y?(p="start",b="middle"):y>=5&&7>y?(p="middle",b="hanging"):(p="end",b="middle"),(0,ma.jsxs)("g",{transform:`translate(${r},${i})`,children:[(0,ma.jsx)("line",{x1:c,y1:u,x2:d,y2:h,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),(0,ma.jsx)("text",{x:g,y:m,textAnchor:p,dominantBaseline:b,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:e.label})]},"gauge-label-"+t)}return"gauge-value"===e.type?(0,ma.jsx)("text",{x:(o.width||P)/2,y:(o.height||R)/2-.2*Z,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*K)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:e.text},"gauge-value-"+t):null},[P,R,a,O,q,W,Z,K]),re=(0,la.useMemo)(()=>{const e=[...N,...S||[]];return oe&&e.push(oe),te&&e.push(te),e},[N,S,oe,te]),ie=(0,la.useMemo)(()=>e=>{const t=e?.data?.[0]||e?.data||e,o=t?._zone||"",n=t?._isFill;return(0,ma.jsxs)("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[(0,ma.jsx)("div",{style:{fontWeight:600},children:o}),(0,ma.jsx)("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:n?"Current: "+Math.round(H):"Remaining"})]})},[H]);if(0===D.length)return(0,ma.jsx)(ts,{componentName:"GaugeChart",message:"No data to display",width:P,height:R});const se={chartType:"donut",data:D,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:z,innerRadius:Z,startAngle:q,sweepAngle:x,...null!=g&&{cornerRadius:g},centerContent:ee,size:[P,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:{top:U-J/2,bottom:R-U-J/2,left:Q-J/2,right:P-Q-J/2},enableHover:o.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===k?()=>null:Gn(k)||ie,svgAnnotationRules:ne,...re.length>0&&{annotations:re},...L&&{title:L},...I&&{description:I},...T&&{summary:T},...void 0!==$&&{accessibleTable:$},...M&&{className:M},...null!=e.animate&&{animate:e.animate},...A};return(0,ma.jsx)(as,{componentName:"GaugeChart",width:P,height:R,children:(0,ma.jsx)(ni,{ref:n,...se})})});ya.displayName="GaugeChart";var pa=require("react"),ba=require("react/jsx-runtime"),va=(0,pa.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,pa.useRef)(null);Es(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="horizontal",bins:u=20,amplitude:d=1.5,valueFormat:f,colorBy:g,colorScheme:m,categoryPadding:y=5,tooltip:p,annotations:b,valueExtent:v,frameProps:x={},selection:w,linkedHover:k,onObservation:S,onClick:A,hoverHighlight:M,chartId:C,loading:j,loadingContent:_,emptyContent:P,legendInteraction:R,legendPosition:L,color:I,stroke:T,strokeWidth:$,opacity:B,showCategoryTicks:H,categoryFormat:O}=e,{width:E,height:D,enableHover:F,showGrid:N,showLegend:z,title:W,description:q,summary:G,accessibleTable:V,categoryLabel:X,valueLabel:Y}=o,K=(0,pa.useMemo)(()=>h(r),[r]),Z=ys({data:K,rawData:r,colorBy:g,colorScheme:m,legendInteraction:R,legendPosition:L,selection:w,linkedHover:k,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:S,onClick:A,hoverHighlight:M,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"RidgelinePlot",chartId:C,showLegend:z,userMargin:i,marginDefaults:o.marginDefaults,loading:j,loadingContent:_,emptyContent:P,width:E,height:D}),Q=qi(),U=(0,pa.useMemo)(()=>new Map,[K]),J=ws({colorBy:g,colorScale:Z.colorScale,color:I,themeCategorical:Q,colorScheme:m,categoryIndexMap:U,userPieceStyle:void 0,stroke:T,strokeWidth:$,opacity:B,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ee=(0,pa.useMemo)(()=>Ws(),[]);if(Z.earlyReturn)return Z.earlyReturn;const te=fs({componentName:"RidgelinePlot",data:r,accessors:{categoryAccessor:a,valueAccessor:l}});if(te)return(0,ba.jsx)(ts,{componentName:"RidgelinePlot",message:te,width:E,height:D});const oe={chartType:"ridgeline",...null!=r&&{data:K},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:J,bins:u,size:[E,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,barPadding:y,enableHover:F,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:X,rLabel:Y,rFormat:f,...O&&{oFormat:O},showGrid:N,showCategoryTicks:H,oSort:!1,amplitude:d,...Z.legendBehaviorProps,...ri({title:W,description:q,summary:G,accessibleTable:V,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...si({tooltip:p,defaultTooltipContent:ee}),...ii({linkedHover:k,selection:w,onObservation:S,onClick:A,hoverHighlight:M,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior}),...b&&b.length>0&&{annotations:b},...v&&{rExtent:v},...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return(0,ba.jsx)(as,{componentName:"RidgelinePlot",width:E,height:D,children:(0,ba.jsx)(ni,{ref:n,...oe})})});va.displayName="RidgelinePlot";var xa=require("react"),wa=require("react/jsx-runtime"),ka=(0,xa.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:!1,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:!1,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,xa.useRef)(null);Es(t,{variant:"xy",frameRef:n});const{data:r,margin:i,className:s,stepAccessor:a="step",valueAccessor:l="value",categoryAccessor:c,colorBy:u,colorScheme:d,orientation:f="horizontal",connectorOpacity:g=.3,showLabels:m=!0,tooltip:y,annotations:p,frameProps:b={},selection:v,linkedHover:x,onObservation:w,onClick:k,hoverHighlight:S,chartId:A,loading:M,loadingContent:C,emptyContent:j,legendInteraction:_,legendPosition:P,color:R,stroke:L,strokeWidth:I,opacity:T,categoryFormat:$}=e,B="vertical"===f,{width:H,height:O,enableHover:E,showLegend:D,title:F,description:N,summary:z,accessibleTable:W}=o,q=B?{top:F?60:40,right:20,bottom:60,left:60}:{top:F?40:10,right:10,bottom:10,left:10},G=(0,xa.useMemo)(()=>h(r),[r]),V=u||c,X=!V,Y=ys({data:G,rawData:r,colorBy:V,colorScheme:d,legendInteraction:_,legendPosition:P,selection:v,linkedHover:x,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"FunnelChart",chartId:A,showLegend:D,userMargin:i,marginDefaults:q,loading:M,loadingContent:C,emptyContent:j,width:H,height:O});us("FunnelChart",G,"stepAccessor",a),us("FunnelChart",G,"valueAccessor",l);const K=qi(),Z=(0,xa.useMemo)(()=>new Map,[G]),Q=(0,xa.useMemo)(()=>{if(X)return R||(K?.[0]?K[0]:Array.isArray(d)&&d[0]?d[0]:"#4e79a7")},[X,R,K,d]),U=ws({colorBy:Q?void 0:V,colorScale:Y.colorScale,color:Q??R,themeCategorical:K,colorScheme:d,categoryIndexMap:Z,userPieceStyle:b?.pieceStyle,stroke:L,strokeWidth:I,opacity:T,effectiveSelectionHook:Y.effectiveSelectionHook,resolvedSelection:Y.resolvedSelection}),J=(0,xa.useMemo)(()=>e=>{const t=e?.data||e,o=t?.__funnelStep||t?.__barFunnelStep||t?.step||"",n=t?.__funnelValue??t?.__barFunnelValue??t?.value??"",r=t?.__funnelPercent??t?.__barFunnelPercent,i=t?.__funnelIsFirstStep??t?.__barFunnelIsFirstStep,s=t?.__barFunnelIsDropoff,a=t?.__barFunnelCategory??t?.category,l=null==r||i?"":` (${.05>Math.abs(r-Math.round(r))?Math.round(r)+"%":r.toFixed(1)+"%"})`;return(0,wa.jsxs)("div",{className:"semiotic-tooltip",style:Nn,children:[o&&(0,wa.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),a&&a!==o&&(0,wa.jsx)("div",{style:{marginTop:2,opacity:.8},children:a+""}),s&&(0,wa.jsx)("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),(0,wa.jsxs)("div",{style:{marginTop:4},children:[n+"",l]})]})},[]);if(Y.earlyReturn)return Y.earlyReturn;const ee=fs({componentName:"FunnelChart",data:r,accessors:{stepAccessor:a,valueAccessor:l}});if(ee)return(0,wa.jsx)(ts,{componentName:"FunnelChart",message:ee,width:H,height:O});const te={chartType:B?"bar-funnel":"funnel",...null!=r&&{data:G},oAccessor:a,rAccessor:l,...c&&{stackBy:c},projection:B?"vertical":"horizontal",barPadding:B?40:0,pieceStyle:U,size:[H,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Y.margin,enableHover:E,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:B,showCategoryTicks:B,...$&&{oFormat:$},showGrid:B,...!B&&{connectorOpacity:g},showLabels:m,...Y.legendBehaviorProps,...F&&{title:F},...N&&{description:N},...z&&{summary:z},...void 0!==W&&{accessibleTable:W},...s&&{className:s},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===y?()=>null:!0===y||null==y?J:Gn(y)||J,...ii({linkedHover:x,selection:v,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:Y.mobileInteraction,customHoverBehavior:Y.customHoverBehavior,customClickBehavior:Y.customClickBehavior}),...p&&p.length>0&&{annotations:p},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return(0,wa.jsx)(as,{componentName:"FunnelChart",width:H,height:O,children:(0,wa.jsx)(ni,{ref:n,...te})})});ka.displayName="FunnelChart";var Sa=l(require("react")),Aa=require("react"),Ma=require("react"),Ca=require("react"),ja={RdBu:O,PiYG:E,PRGn:D,BrBG:F,RdYlBu:N,RdYlGn:z,Spectral:W},_a="__likert_neutral_neg",Pa="__likert_neutral_pos";function Ra(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function La(e,t,o,n,r,i){const s=new Map,a=new Set(t);for(const l of e){const e=o(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(n){const e=n(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const o=e-1;if(0>o||o>=t.length)continue;const r=t[o];c.set(r,(c.get(r)||0)+1)}else if(r&&i){const e=r(l),t=i(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,o]of s){let n=0;for(const e of t)n+=o.get(e)||0;if(0!==n)for(let r=0;t.length>r;r++){const i=t[r],s=o.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:s,__likertPct:s/n*100,__likertLevelIndex:r})}}return l}function Ia(e,t){const o=t.length,n=o%2!=0,r=Math.floor(o/2),i=[];for(const t of e){const e=t.__likertLevelIndex;if(n&&e===r){const e=t.__likertPct/2;i.push({...t,__likertLevel:_a,__likertPct:-e}),i.push({...t,__likertLevel:Pa,__likertPct:e})}else i.push(r>e?{...t,__likertPct:-t.__likertPct}:t)}return i}function Ta(e,t){const o=t.length,n=o%2!=0,r=Math.floor(o/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const s=[];for(const[,e]of i){const t=new Map;let i,a;for(const o of e)o.__likertLevel===_a?i=o:o.__likertLevel===Pa?a=o:t.set(o.__likertLevelIndex,o);n&&i&&s.push(i);for(let e=r-1;e>=0;e--){const o=t.get(e);o&&s.push(o)}n&&a&&s.push(a);for(let e=n?r+1:r;o>e;e++){const o=t.get(e);o&&s.push(o)}}return s}var $a=["Very Low","Low","Neutral","High","Very High"],Ba=require("react/jsx-runtime"),Ha=new Map,Oa=(0,Aa.forwardRef)(function(e,t){const o=Xi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=(0,Aa.useRef)(null),{data:r,margin:i,className:s,categoryAccessor:a="question",valueAccessor:l,levelAccessor:c,countAccessor:u="count",levels:d=$a,orientation:h="horizontal",colorScheme:f,barPadding:g=20,tooltip:m,annotations:y,valueExtent:p,frameProps:b={},selection:v,linkedHover:x,onObservation:w,onClick:k,hoverHighlight:S,chartId:A,valueFormat:M,loading:C,loadingContent:j,emptyContent:_,legendInteraction:P,legendPosition:R,categoryFormat:L,stroke:I,strokeWidth:T,opacity:$}=e,{width:B,height:H,enableHover:O,showGrid:E,showLegend:D,title:F,description:N,summary:z,accessibleTable:W,categoryLabel:q,valueLabel:G}=o,X="horizontal"===h,K=void 0===r,Q=!c,U=function(){const e=Bi();return e?.colors?.diverging||void 0}(),J=(0,Aa.useMemo)(()=>f&&Array.isArray(f)&&f.length>=d.length?f:function(e,t){if(0>=e)return[];if(t){const o=ja[t];if(o){if(1===e)return[o(.5)];const t=[];for(let n=0;e>n;n++)t.push(o(n/(e-1)));return t}}const o=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],r="#a8a8a8";if(1===e)return[r];const i=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);i&&a.push(r);for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);return a}(d.length,U),[f,d.length,U]),ee=(0,Aa.useMemo)(()=>{const e=new Map;for(let t=0;d.length>t;t++)e.set(d[t],J[t]||"#888");return e},[d,J]),{processedData:te,reAggregate:oe,accumulatorRef:ne}=function({data:e,levels:t,categoryAccessor:o,valueAccessor:n,levelAccessor:r,countAccessor:i,isDiverging:s,frameRef:a}){const l=!r,c=(0,Ca.useMemo)(()=>Ra(o,"question"),[o]),u=(0,Ca.useMemo)(()=>l?Ra(n,"score"):null,[l,n]),d=(0,Ca.useMemo)(()=>l?null:Ra(r,"level"),[l,r]),h=(0,Ca.useMemo)(()=>l?null:Ra(i,"count"),[l,i]),f=e||[],g=(0,Ca.useRef)([]);return{processedData:(0,Ca.useMemo)(()=>{if(0===f.length)return[];let e=La(f,t,c,u,d,h);return s&&(e=Ia(e,t),e=Ta(e,t)),e},[f,t,c,u,d,h,s]),reAggregate:(0,Ca.useCallback)(e=>{let o=La(e,t,c,u,d,h);s&&(o=Ia(o,t),o=Ta(o,t)),a.current?.replace(o)},[t,c,u,d,h,s,a]),accumulatorRef:g}}({data:r,levels:d,categoryAccessor:a,valueAccessor:l,levelAccessor:c,countAccessor:u,isDiverging:X,frameRef:n}),re="__likertLevelLabel",ie=function({isPushMode:e,colorBy:t,colorScheme:o,showLegend:n,legendPosition:r="right"}){const i=(0,Ma.useRef)(new Set),s=(0,Ma.useRef)([]),[a,l]=(0,Ma.useState)(0),c=di(),u=qi(),d=(0,Ma.useCallback)(e=>{if(!t)return null;const o="function"==typeof t?t(e):e[t];return null!=o?o+"":null},[t]),h=(0,Ma.useCallback)(o=>{if(!e||!t)return;let n=!1;for(const e of o){if(!e||"object"!=typeof e)continue;const t=d(e);null==t||i.current.has(t)||(i.current.add(t),s.current.push(t),n=!0)}n&&l(e=>e+1)},[e,t,d]),f=(0,Ma.useCallback)(o=>{if(!e||!t)return;const n=Array.from(new Set(o.map(String))),r=s.current;r.length===n.length&&r.every((e,t)=>e===n[t])||(i.current=new Set(n),s.current=n,l(e=>e+1))},[e,t]),g=(0,Ma.useCallback)(e=>t=>{h([t]),e(t)},[h]),m=(0,Ma.useCallback)(e=>t=>{h(t),e(t)},[h]),y=(0,Ma.useCallback)(()=>{i.current=new Set,s.current=[],l(e=>e+1)},[]);Ii(e&&t?s.current:[]);const p=(0,Ma.useMemo)(()=>{if(!e||!t||!1===n)return;const r=s.current;if(0===r.length)return;const i=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:u&&u.length>0?u:V,a="string"==typeof t?t:"__streamCat",l=r.map(e=>({[a]:e})),d=Z(l,a,i);return Ti({data:l,colorBy:a,colorScale:e=>c?.[e]||d(e)||"#999",getColor:Y})},[e,t,n,o,c,u,a]),b=(0,Ma.useMemo)(()=>{if(p)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[p,r]);return{wrapPush:g,wrapPushMany:m,resetCategories:y,categories:s.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:f}:{},streamingLegend:p,streamingMarginAdjust:b}}({isPushMode:K,colorBy:re,colorScheme:J,showLegend:D,legendPosition:R}),se=(0,Aa.useCallback)(ie.wrapPush(e=>{ne.current.push(e),oe(ne.current)}),[ie.wrapPush,oe,ne]),ae=(0,Aa.useCallback)(ie.wrapPushMany(e=>{ne.current.push(...e),oe(ne.current)}),[ie.wrapPushMany,oe,ne]);(0,Aa.useImperativeHandle)(t,()=>({push:se,pushMany:ae,remove:e=>n.current?.remove(e)??[],update:(e,t)=>n.current?.update(e,t)??[],clear:()=>{ne.current=[],ie.resetCategories(),n.current?.clear()},getData:()=>n.current?.getData()??[],getScales:()=>n.current?.getScales()??null}),[se,ae,ie.resetCategories,ne]);const le=ys({data:te,rawData:r,colorBy:re,colorScheme:J,legendInteraction:P,legendPosition:R,selection:v,linkedHover:x,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"LikertChart",chartId:A,showLegend:D,userMargin:i,marginDefaults:o.marginDefaults,loading:C,loadingContent:j,emptyContent:_,width:B,height:H}),ce=(0,Aa.useMemo)(()=>{const e=d.length;return e%2!=0&&ee.get(d[Math.floor(e/2)])||"#888"},[d,ee]),ue=ws({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:Ha,userPieceStyle:b?.pieceStyle,stroke:I,strokeWidth:T,opacity:$,effectiveSelectionHook:le.effectiveSelectionHook,resolvedSelection:le.resolvedSelection,baseStyleExtras:e=>{const t=e.__likertLevelLabel||e.data?.__likertLevelLabel,o=e.__likertLevel||e.data?.__likertLevel;if(o===_a||o===Pa)return{fill:ce};const n=t||o;return n&&ee.has(n)?{fill:ee.get(n)}:{fill:"#888"}}}),de=(0,Aa.useMemo)(()=>{const e=d.length;return e%2!=0?d[Math.floor(e/2)]:""},[d]),he=(0,Aa.useMemo)(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",n=o===_a||o===Pa?de:o,r=t.__likertCategory||"",i=Math.abs(t.__likertPct||0),s=o===_a||o===Pa?2*i:i,a=t.__likertCount||0;return Sa.createElement("div",{className:"semiotic-tooltip",style:Nn},Sa.createElement("div",{style:{fontWeight:"bold"}},r),Sa.createElement("div",{style:{marginTop:4}},`${n}: ${s.toFixed(1)}% (n=${a})`))},[de]),fe=(0,Aa.useMemo)(()=>{if(!d||2>d.length)return"LikertChart requires `levels` with at least 2 entries.";if(l&&c)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(c&&!u)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==r&&0===r.length)return null;const e={categoryAccessor:a};return Q?l&&(e.valueAccessor=l):(c&&(e.levelAccessor=c),u&&(e.countAccessor=u)),fs({componentName:"LikertChart",data:r,accessors:e,requiredProps:{levels:d}})},[r,a,l,c,u,d,Q]),ge=(0,Aa.useMemo)(()=>[{styleFn:e=>({fill:ee.get(e.label)||"#888"}),items:d.map(e=>({label:e})),label:""}],[d,ee]),me=(0,Aa.useMemo)(()=>!1!==D?{...le.legendBehaviorProps,legend:{legendGroups:ge},legendPosition:R||le.legendPosition||"bottom"}:le.legendBehaviorProps,[le.legendBehaviorProps,le.legendPosition,R,D,ge]),ye=(0,Aa.useMemo)(()=>{const e={...le.margin};if(K&&!1!==D){const t=R||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(ie.streamingMarginAdjust)for(const[t,o]of Object.entries(ie.streamingMarginAdjust))o>e[t]&&(e[t]=o);return X&&100>e.left&&(e.left=100),e},[le.margin,ie.streamingMarginAdjust,X,K,D,R]),pe=(0,Aa.useMemo)(()=>M||(X?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[X,M]);if(le.earlyReturn)return le.earlyReturn;const be={chartType:"bar",...null!=r&&{data:te},oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:X?"horizontal":"vertical",pieceStyle:ue,size:[B,H],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ye,barPadding:g,enableHover:O,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:q,rLabel:G||(X?void 0:"Percentage"),rFormat:pe,...L&&{oFormat:L},showGrid:E,...me,...F&&{title:F},...N&&{description:N},...z&&{summary:z},...void 0!==W&&{accessibleTable:W},...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===m?()=>null:!0===m?he:Gn(m)||he,...ii({linkedHover:x,selection:v,onObservation:w,onClick:k,hoverHighlight:S,mobileInteraction:le.mobileInteraction,customHoverBehavior:le.customHoverBehavior,customClickBehavior:le.customClickBehavior}),...y&&y.length>0&&{annotations:y},...p&&{rExtent:p},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return fe?(0,Ba.jsx)(ts,{componentName:"LikertChart",message:fe,width:B,height:H}):(0,Ba.jsx)(as,{componentName:"LikertChart",width:B,height:H,children:(0,Ba.jsx)(ni,{ref:n,...be})})});Oa.displayName="LikertChart";var Ea=require("react"),Da=require("react");var Fa=require("react/jsx-runtime"),Na=(0,Ea.forwardRef)(function(e,t){const{data:o,layout:n,layoutConfig:r,onLayoutError:i,categoryAccessor:s="category",valueAccessor:a="value",oExtent:l,rExtent:c,projection:u="vertical",margin:d,className:h,colorBy:f,colorScheme:g,showAxes:m=!1,annotations:y,onObservation:p,onClick:b,selection:v,linkedHover:x,chartId:w,loading:k,loadingContent:S,emptyContent:A,frameProps:M={}}=e,{frameRef:C,resolved:j,safeData:_,setup:P,earlyReturn:R}=function(e){const t=function(e){const t=(0,Da.useRef)(null);return Es(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Xi(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}),normalizedMargin:(0,Da.useMemo)(()=>function(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}(e.margin),[e.margin])}}(e),{resolved:o,normalizedMargin:n}=t,r=ys({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:o.showLegend,userMargin:n,marginDefaults:o.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:o.width,height:o.height});return{...t,safeData:r.data,setup:r,earlyReturn:r.earlyReturn}}({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:o,colorBy:f,colorScheme:g,selection:v,linkedHover:x,onObservation:p,onClick:b,chartId:w,loading:k,loadingContent:S,emptyContent:A,margin:d,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),L=P.effectiveSelectionHook,I=(0,Ea.useMemo)(()=>L?.isActive?{isActive:!0,predicate:L.predicate}:null,[L?.isActive,L?.predicate]);if(R)return R;const{width:T,height:$,enableHover:B,showGrid:H,title:O,description:E,summary:D,accessibleTable:F}=j,N={chartType:"custom",...null!=o&&{data:_},customLayout:n,layoutConfig:r,onLayoutError:i,...I&&{layoutSelection:I},oAccessor:s,rAccessor:a,oExtent:l,rExtent:c,projection:u,colorAccessor:f,colorScheme:g,size:[T,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:P.margin,enableHover:B,showAxes:m,showGrid:H,annotations:y,...ri({title:O,description:E,summary:D,accessibleTable:F,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...ii({linkedHover:x,selection:v,onObservation:p,onClick:b,hoverHighlight:!1,mobileInteraction:P.mobileInteraction,customHoverBehavior:P.customHoverBehavior,customClickBehavior:P.customClickBehavior}),...M};return(0,Fa.jsx)(as,{componentName:"OrdinalCustomChart",width:T,height:$,children:(0,Fa.jsx)(ni,{ref:C,...N})})});Na.displayName="OrdinalCustomChart";var za={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},Wa=8;function qa(e){return null==e?void 0:e+""}function Ga(e){const t=qa(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??Wa,style:{...za},datum:e.datum,pointId:t,_transitionKey:t}}function Va(e){return{type:"rect",x:e.x,y:e.y,w:e.width,h:e.height,style:{...za},datum:e.datum,group:e.group,_transitionKey:qa(e.id)}}
|