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.
Files changed (517) hide show
  1. package/CLAUDE.md +60 -15
  2. package/README.md +135 -24
  3. package/agent-skill/semiotic-charts/SKILL.md +146 -0
  4. package/ai/cli.js +133 -45
  5. package/ai/componentMetadata.cjs +6 -1
  6. package/ai/dist/mcp-server.js +1651 -154
  7. package/ai/examples.md +174 -0
  8. package/ai/schema.json +2934 -517
  9. package/ai/surface-manifest.json +200 -0
  10. package/ai/system-prompt.md +19 -3
  11. package/dist/components/Annotation.d.ts +4 -0
  12. package/dist/components/CategoryColors.d.ts +1 -1
  13. package/dist/components/ChartContainer.d.ts +91 -0
  14. package/dist/components/ChartGrid.d.ts +11 -1
  15. package/dist/components/CircularBrush.d.ts +61 -0
  16. package/dist/components/ContextLayout.d.ts +5 -1
  17. package/dist/components/DataSummaryContext.d.ts +1 -0
  18. package/dist/components/DirectManipulationControl.d.ts +63 -0
  19. package/dist/components/LinkedCharts.d.ts +3 -1
  20. package/dist/components/MobileAnnotationCalloutList.d.ts +13 -0
  21. package/dist/components/MobileChartContainer.d.ts +51 -0
  22. package/dist/components/MobileStandardControls.d.ts +68 -0
  23. package/dist/components/SmallMultipleChart.d.ts +84 -0
  24. package/dist/components/Tooltip/FlippingTooltip.d.ts +21 -0
  25. package/dist/components/ai/ChartRecipe.d.ts +16 -0
  26. package/dist/components/ai/IntentMark.d.ts +15 -0
  27. package/dist/components/ai/chartCapabilities.d.ts +8 -1
  28. package/dist/components/ai/chartCapabilityTypes.d.ts +42 -1
  29. package/dist/components/ai/chartClinic.d.ts +91 -0
  30. package/dist/components/ai/chartRecipeRegistry.d.ts +14 -0
  31. package/dist/components/ai/chartRecipes.d.ts +278 -0
  32. package/dist/components/ai/dataPitfallsBridge.d.ts +203 -0
  33. package/dist/components/ai/dataQualityBridge.d.ts +201 -0
  34. package/dist/components/ai/describeChart.d.ts +9 -0
  35. package/dist/components/ai/describeRecipeChart.d.ts +16 -0
  36. package/dist/components/ai/generativeChart.d.ts +170 -0
  37. package/dist/components/ai/intentManifest.d.ts +62 -0
  38. package/dist/components/ai/navigationTree.d.ts +3 -0
  39. package/dist/components/ai/observedSceneAudit.d.ts +72 -0
  40. package/dist/components/ai/readerGrounding.d.ts +83 -0
  41. package/dist/components/ai/recipeCapability.d.ts +8 -0
  42. package/dist/components/ai/recipeNavigation.d.ts +13 -0
  43. package/dist/components/ai/recipeSemantics.d.ts +11 -0
  44. package/dist/components/ai/repairChartConfig.d.ts +9 -0
  45. package/dist/components/ai/suggestCharts.d.ts +11 -1
  46. package/dist/components/charts/custom/GeoCustomChart.d.ts +48 -0
  47. package/dist/components/charts/custom/NetworkCustomChart.d.ts +22 -3
  48. package/dist/components/charts/custom/OrdinalCustomChart.d.ts +8 -2
  49. package/dist/components/charts/custom/XYCustomChart.d.ts +11 -2
  50. package/dist/components/charts/geo/DistanceCartogram.d.ts +1 -1
  51. package/dist/components/charts/geo/FlowMap.d.ts +1 -1
  52. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +1 -1
  53. package/dist/components/charts/geo/index.d.ts +2 -0
  54. package/dist/components/charts/index.d.ts +29 -1
  55. package/dist/components/charts/network/ChordDiagram.d.ts +1 -1
  56. package/dist/components/charts/network/CirclePack.d.ts +1 -1
  57. package/dist/components/charts/network/ForceDirectedGraph.d.ts +15 -5
  58. package/dist/components/charts/network/OrbitDiagram.d.ts +1 -1
  59. package/dist/components/charts/network/ProcessSankey.d.ts +1 -1
  60. package/dist/components/charts/network/SankeyDiagram.d.ts +1 -1
  61. package/dist/components/charts/network/TreeDiagram.d.ts +1 -1
  62. package/dist/components/charts/network/Treemap.d.ts +1 -1
  63. package/dist/components/charts/network/useForceLayout.d.ts +17 -0
  64. package/dist/components/charts/ordinal/BarChart.d.ts +1 -1
  65. package/dist/components/charts/ordinal/BoxPlot.d.ts +1 -1
  66. package/dist/components/charts/ordinal/DonutChart.d.ts +1 -1
  67. package/dist/components/charts/ordinal/DotPlot.d.ts +1 -1
  68. package/dist/components/charts/ordinal/FunnelChart.d.ts +1 -1
  69. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +1 -1
  70. package/dist/components/charts/ordinal/Histogram.d.ts +1 -1
  71. package/dist/components/charts/ordinal/PieChart.d.ts +1 -1
  72. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +1 -1
  73. package/dist/components/charts/ordinal/StackedBarChart.d.ts +1 -1
  74. package/dist/components/charts/ordinal/SwarmPlot.d.ts +8 -1
  75. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +1 -1
  76. package/dist/components/charts/ordinal/ViolinPlot.d.ts +1 -1
  77. package/dist/components/charts/physics/ChainReactionChart.d.ts +9 -0
  78. package/dist/components/charts/physics/CollisionSwarmChart.capability.d.ts +2 -0
  79. package/dist/components/charts/physics/CollisionSwarmChart.d.ts +47 -0
  80. package/dist/components/charts/physics/EventDropChart.capability.d.ts +2 -0
  81. package/dist/components/charts/physics/EventDropChart.d.ts +53 -0
  82. package/dist/components/charts/physics/GaltonBoardChart.capability.d.ts +2 -0
  83. package/dist/components/charts/physics/GaltonBoardChart.d.ts +66 -0
  84. package/dist/components/charts/physics/GauntletChart.capability.d.ts +2 -0
  85. package/dist/components/charts/physics/GauntletChart.d.ts +73 -0
  86. package/dist/components/charts/physics/PhysicalFlowChart.capability.d.ts +2 -0
  87. package/dist/components/charts/physics/PhysicalFlowChart.d.ts +63 -0
  88. package/dist/components/charts/physics/PhysicsCustomChart.d.ts +120 -0
  89. package/dist/components/charts/physics/PhysicsPileChart.capability.d.ts +2 -0
  90. package/dist/components/charts/physics/PhysicsPileChart.d.ts +53 -0
  91. package/dist/components/charts/physics/ProcessFlowChart.capability.d.ts +2 -0
  92. package/dist/components/charts/physics/ProcessFlowChart.d.ts +96 -0
  93. package/dist/components/charts/physics/chainReactionOverlay.d.ts +22 -0
  94. package/dist/components/charts/physics/chainReactionRuntime.d.ts +37 -0
  95. package/dist/components/charts/physics/chainReactionTypes.d.ts +97 -0
  96. package/dist/components/charts/physics/collisionSwarmPhysics.d.ts +27 -0
  97. package/dist/components/charts/physics/dependencyMachine.d.ts +188 -0
  98. package/dist/components/charts/physics/eventDropPhysics.d.ts +64 -0
  99. package/dist/components/charts/physics/galtonBoardPhysics.d.ts +28 -0
  100. package/dist/components/charts/physics/gauntletChartProps.d.ts +67 -0
  101. package/dist/components/charts/physics/gauntletChrome.d.ts +33 -0
  102. package/dist/components/charts/physics/gauntletController.d.ts +73 -0
  103. package/dist/components/charts/physics/gauntletEffects.d.ts +36 -0
  104. package/dist/components/charts/physics/gauntletPhysics.d.ts +71 -0
  105. package/dist/components/charts/physics/gauntletRuntime.d.ts +42 -0
  106. package/dist/components/charts/physics/gauntletTypes.d.ts +213 -0
  107. package/dist/components/charts/physics/physicalFlowPhysics.d.ts +57 -0
  108. package/dist/components/charts/physics/physicsChartShared.d.ts +41 -0
  109. package/dist/components/charts/physics/physicsChartUtils.d.ts +18 -0
  110. package/dist/components/charts/physics/physicsEncoding.d.ts +142 -0
  111. package/dist/components/charts/physics/physicsHocHandle.d.ts +53 -0
  112. package/dist/components/charts/physics/physicsHocUtils.d.ts +128 -0
  113. package/dist/components/charts/physics/physicsPilePhysics.d.ts +41 -0
  114. package/dist/components/charts/physics/physicsProcessPrimitives.d.ts +38 -0
  115. package/dist/components/charts/physics/processFlowPhysics.d.ts +97 -0
  116. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +9 -1
  117. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +9 -1
  118. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +30 -1
  119. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +16 -2
  120. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +9 -1
  121. package/dist/components/charts/realtime/aggregate.d.ts +51 -0
  122. package/dist/components/charts/realtime/eventTime.d.ts +26 -0
  123. package/dist/components/charts/shared/auditMobileVisualization.d.ts +91 -0
  124. package/dist/components/charts/shared/chartDefinitionPilot.d.ts +145 -0
  125. package/dist/components/charts/shared/chartFamilySets.d.ts +20 -0
  126. package/dist/components/charts/shared/chartSpecCore.d.ts +165 -0
  127. package/dist/components/charts/shared/chartSpecs.d.ts +8 -127
  128. package/dist/components/charts/shared/chartSpecsGeo.d.ts +2 -0
  129. package/dist/components/charts/shared/chartSpecsNetwork.d.ts +2 -0
  130. package/dist/components/charts/shared/chartSpecsOrdinal.d.ts +2 -0
  131. package/dist/components/charts/shared/chartSpecsPhysics.d.ts +2 -0
  132. package/dist/components/charts/shared/chartSpecsRealtime.d.ts +2 -0
  133. package/dist/components/charts/shared/chartSpecsValue.d.ts +2 -0
  134. package/dist/components/charts/shared/chartSpecsXY.d.ts +2 -0
  135. package/dist/components/charts/shared/colorContrast.d.ts +3 -0
  136. package/dist/components/charts/shared/colorPalettes.d.ts +2 -0
  137. package/dist/components/charts/shared/colorUtils.d.ts +17 -13
  138. package/dist/components/charts/shared/diagnoseAnnotationChecks.d.ts +4 -0
  139. package/dist/components/charts/shared/diagnoseConfig.d.ts +9 -14
  140. package/dist/components/charts/shared/diagnoseMisleadingChecks.d.ts +9 -0
  141. package/dist/components/charts/shared/diagnosePhysicsChecks.d.ts +3 -0
  142. package/dist/components/charts/shared/diagnoseTypes.d.ts +10 -0
  143. package/dist/components/charts/shared/hooks.d.ts +28 -5
  144. package/dist/components/charts/shared/minMax.d.ts +3 -0
  145. package/dist/components/charts/shared/motionEncoding.d.ts +145 -0
  146. package/dist/components/charts/shared/radialGeometry.d.ts +0 -18
  147. package/dist/components/charts/shared/responsiveRules.d.ts +56 -0
  148. package/dist/components/charts/shared/smartTooltip.d.ts +27 -0
  149. package/dist/components/charts/shared/statisticalOverlays.d.ts +35 -0
  150. package/dist/components/charts/shared/streamPropsHelpers.d.ts +12 -2
  151. package/dist/components/charts/shared/temporalStrings.d.ts +7 -0
  152. package/dist/components/charts/shared/tooltipUtils.d.ts +2 -0
  153. package/dist/components/charts/shared/types.d.ts +49 -1
  154. package/dist/components/charts/shared/useChartSetup.d.ts +10 -3
  155. package/dist/components/charts/shared/useCustomChartSetup.d.ts +15 -6
  156. package/dist/components/charts/shared/useNetworkChartSetup.d.ts +6 -2
  157. package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +1 -1
  158. package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
  159. package/dist/components/charts/shared/useSyncedPushData.d.ts +49 -0
  160. package/dist/components/charts/shared/validateChartData.d.ts +1 -1
  161. package/dist/components/charts/shared/validationMap.d.ts +0 -11
  162. package/dist/components/charts/xy/AreaChart.d.ts +1 -1
  163. package/dist/components/charts/xy/BubbleChart.d.ts +1 -1
  164. package/dist/components/charts/xy/LineChart.d.ts +1 -1
  165. package/dist/components/charts/xy/MinimapChart.d.ts +1 -1
  166. package/dist/components/charts/xy/MultiAxisLineChart.d.ts +2 -2
  167. package/dist/components/charts/xy/QuadrantChart.d.ts +1 -1
  168. package/dist/components/charts/xy/Scatterplot.d.ts +10 -1
  169. package/dist/components/charts/xy/ScatterplotMatrix.d.ts +11 -1
  170. package/dist/components/charts/xy/StackedAreaChart.d.ts +9 -4
  171. package/dist/components/controls/controlAudit.d.ts +24 -0
  172. package/dist/components/controls/controlContract.d.ts +57 -0
  173. package/dist/components/data/fromArrow.d.ts +54 -0
  174. package/dist/components/data/fromFlintChart.d.ts +74 -0
  175. package/dist/components/data/fromMermaid.d.ts +47 -0
  176. package/dist/components/data/fromObservablePlot.d.ts +69 -0
  177. package/dist/components/data/fromVegaLite.d.ts +27 -0
  178. package/dist/components/data/portability/index.d.ts +17 -0
  179. package/dist/components/data/portability/result.d.ts +52 -0
  180. package/dist/components/data/portability/spec.d.ts +160 -0
  181. package/dist/components/data/portability/vegaLite.d.ts +80 -0
  182. package/dist/components/export/chartConfig.d.ts +11 -0
  183. package/dist/components/realtime/ReorderBuffer.d.ts +54 -0
  184. package/dist/components/realtime/RunningStats.d.ts +66 -0
  185. package/dist/components/realtime/WindowAccumulator.d.ts +105 -0
  186. package/dist/components/realtime/parseWindowDuration.d.ts +12 -0
  187. package/dist/components/realtime/types.d.ts +11 -0
  188. package/dist/components/recipes/annotationLayout.d.ts +29 -0
  189. package/dist/components/recipes/axisFixedForce.d.ts +119 -0
  190. package/dist/components/recipes/boba.d.ts +23 -0
  191. package/dist/components/recipes/customTooltip.d.ts +31 -0
  192. package/dist/components/recipes/cyclical.d.ts +39 -0
  193. package/dist/components/recipes/edgeRouter.d.ts +103 -0
  194. package/dist/components/recipes/forceLayout.d.ts +48 -0
  195. package/dist/components/recipes/forceLayoutAsync.d.ts +17 -0
  196. package/dist/components/recipes/gofishBobaHandwritten.d.ts +3 -0
  197. package/dist/components/recipes/gofishDisplayListFixtures.generated.d.ts +37 -0
  198. package/dist/components/recipes/gofishIR.d.ts +215 -0
  199. package/dist/components/recipes/gofishIRExamples.d.ts +38 -0
  200. package/dist/components/recipes/intervalLanes.d.ts +87 -0
  201. package/dist/components/recipes/intervals.d.ts +80 -0
  202. package/dist/components/recipes/isometricLandmarks.d.ts +88 -0
  203. package/dist/components/recipes/isotypeGlyphs.d.ts +17 -0
  204. package/dist/components/recipes/mermaidDag.d.ts +44 -0
  205. package/dist/components/recipes/mobileAnnotationStrategy.d.ts +48 -0
  206. package/dist/components/recipes/mobileChartFamilyRecipes.d.ts +59 -0
  207. package/dist/components/recipes/networkAnalysis.d.ts +102 -0
  208. package/dist/components/recipes/networkLayouts.d.ts +83 -0
  209. package/dist/components/recipes/packedClusterMatrix.d.ts +166 -0
  210. package/dist/components/recipes/physics.d.ts +122 -0
  211. package/dist/components/recipes/physicsReference.d.ts +102 -0
  212. package/dist/components/recipes/processAggregates.d.ts +32 -0
  213. package/dist/components/recipes/processChrome.d.ts +67 -0
  214. package/dist/components/recipes/processJourney.d.ts +54 -0
  215. package/dist/components/recipes/processPhysics.d.ts +300 -0
  216. package/dist/components/recipes/processVolumeGeometry.d.ts +28 -0
  217. package/dist/components/recipes/radialCoords.d.ts +69 -0
  218. package/dist/components/recipes/random.d.ts +2 -0
  219. package/dist/components/recipes/recipeChrome.d.ts +191 -0
  220. package/dist/components/recipes/recipeGlyph.d.ts +42 -0
  221. package/dist/components/recipes/recipeLegend.d.ts +109 -0
  222. package/dist/components/recipes/recipeUtils.d.ts +157 -0
  223. package/dist/components/recipes/runs.d.ts +59 -0
  224. package/dist/components/recipes/tokenEncoding.d.ts +157 -0
  225. package/dist/components/recipes/tokenLayer.d.ts +79 -0
  226. package/dist/components/recipes/unitize.d.ts +108 -0
  227. package/dist/components/recipes/vector.d.ts +28 -0
  228. package/dist/components/recipes/waffle.d.ts +43 -0
  229. package/dist/components/semiotic-ai-core.d.ts +47 -0
  230. package/dist/components/semiotic-ai.d.ts +52 -4
  231. package/dist/components/semiotic-controls.d.ts +18 -0
  232. package/dist/components/semiotic-data.d.ts +2 -0
  233. package/dist/components/semiotic-experimental.d.ts +49 -0
  234. package/dist/components/semiotic-geo.d.ts +11 -0
  235. package/dist/components/semiotic-network.d.ts +14 -1
  236. package/dist/components/semiotic-ordinal.d.ts +10 -0
  237. package/dist/components/semiotic-physics-matter.d.ts +10 -0
  238. package/dist/components/semiotic-physics-rapier.d.ts +9 -0
  239. package/dist/components/semiotic-physics.d.ts +56 -0
  240. package/dist/components/semiotic-realtime-core.d.ts +34 -0
  241. package/dist/components/semiotic-realtime-react.d.ts +10 -0
  242. package/dist/components/semiotic-realtime.d.ts +4 -22
  243. package/dist/components/semiotic-recipes-core.d.ts +92 -0
  244. package/dist/components/semiotic-recipes-react.d.ts +7 -0
  245. package/dist/components/semiotic-recipes.d.ts +4 -26
  246. package/dist/components/semiotic-server-edge.d.ts +8 -0
  247. package/dist/components/semiotic-server-node.d.ts +5 -0
  248. package/dist/components/semiotic-server.d.ts +2 -2
  249. package/dist/components/semiotic-themes-core.d.ts +53 -0
  250. package/dist/components/semiotic-themes-react.d.ts +4 -0
  251. package/dist/components/semiotic-themes.d.ts +6 -74
  252. package/dist/components/semiotic-utils-core.d.ts +46 -0
  253. package/dist/components/semiotic-utils-react.d.ts +5 -0
  254. package/dist/components/semiotic-utils.d.ts +3 -39
  255. package/dist/components/semiotic-xy.d.ts +10 -0
  256. package/dist/components/semiotic.d.ts +39 -7
  257. package/dist/components/server/animatedGif.d.ts +36 -0
  258. package/dist/components/server/renderEvidence.d.ts +1 -1
  259. package/dist/components/server/renderToStaticSVG.d.ts +3 -35
  260. package/dist/components/server/serverChartConfigShared.d.ts +17 -0
  261. package/dist/components/server/serverChartConfigs.d.ts +19 -9
  262. package/dist/components/server/serverChartConfigsCustom.d.ts +5 -0
  263. package/dist/components/server/serverChartConfigsGeo.d.ts +9 -0
  264. package/dist/components/server/serverChartConfigsNetwork.d.ts +8 -0
  265. package/dist/components/server/serverChartConfigsOrdinal.d.ts +16 -0
  266. package/dist/components/server/serverChartConfigsPhysics.d.ts +9 -0
  267. package/dist/components/server/serverChartConfigsXY.d.ts +11 -0
  268. package/dist/components/server/staticGeo.d.ts +4 -0
  269. package/dist/components/server/staticLegend.d.ts +1 -1
  270. package/dist/components/server/staticNetwork.d.ts +8 -0
  271. package/dist/components/server/staticOrdinal.d.ts +11 -0
  272. package/dist/components/server/staticPhysics.d.ts +3 -0
  273. package/dist/components/server/staticSVGChrome.d.ts +110 -0
  274. package/dist/components/server/staticXY.d.ts +4 -0
  275. package/dist/components/store/ObservationStore.d.ts +23 -3
  276. package/dist/components/store/SelectionStore.d.ts +1 -1
  277. package/dist/components/store/ThemeStore.d.ts +1 -1
  278. package/dist/components/store/TooltipStore.d.ts +1 -1
  279. package/dist/components/store/createStore.d.ts +1 -1
  280. package/dist/components/store/designTokens.d.ts +15 -0
  281. package/dist/components/store/themeSerialization.d.ts +32 -0
  282. package/dist/components/store/useChartInterrogation.d.ts +9 -0
  283. package/dist/components/stream/AccessibleDataTable.d.ts +3 -13
  284. package/dist/components/stream/FocusRing.d.ts +4 -2
  285. package/dist/components/stream/GeoCanvasHitTester.d.ts +1 -1
  286. package/dist/components/stream/GeoPipelineStore.d.ts +28 -0
  287. package/dist/components/stream/NetworkHtmlMarksLayer.d.ts +44 -0
  288. package/dist/components/stream/NetworkPipelineStore.d.ts +62 -25
  289. package/dist/components/stream/NetworkSVGOverlay.d.ts +15 -0
  290. package/dist/components/stream/OrdinalPipelineStore.d.ts +64 -2
  291. package/dist/components/stream/PipelineStore.d.ts +100 -162
  292. package/dist/components/stream/SceneGraph.d.ts +14 -2
  293. package/dist/components/stream/StreamGeoFrame.d.ts +1 -1
  294. package/dist/components/stream/StreamNetworkFrame.d.ts +1 -1
  295. package/dist/components/stream/StreamOrdinalFrame.d.ts +1 -1
  296. package/dist/components/stream/StreamXYFrame.d.ts +2 -18
  297. package/dist/components/stream/accessibleDataRows.d.ts +33 -0
  298. package/dist/components/stream/accessorUtils.d.ts +23 -10
  299. package/dist/components/stream/brushAccessibility.d.ts +25 -0
  300. package/dist/components/stream/canvasBackground.d.ts +24 -0
  301. package/dist/components/stream/canvasSetup.d.ts +4 -1
  302. package/dist/components/stream/customLayout.d.ts +20 -0
  303. package/dist/components/stream/customLayoutDiagnostics.d.ts +11 -0
  304. package/dist/components/stream/customLayoutFailure.d.ts +33 -0
  305. package/dist/components/stream/customLayoutPalette.d.ts +19 -9
  306. package/dist/components/stream/customLayoutSelection.d.ts +52 -0
  307. package/dist/components/stream/frameThemeColors.d.ts +24 -0
  308. package/dist/components/stream/geoAnnotationAnchors.d.ts +14 -0
  309. package/dist/components/stream/geoCartogram.d.ts +17 -0
  310. package/dist/components/stream/geoCustomLayout.d.ts +59 -0
  311. package/dist/components/stream/geoDefaultTooltip.d.ts +11 -0
  312. package/dist/components/stream/geoFrameHelpers.d.ts +34 -0
  313. package/dist/components/stream/geoPipelineHelpers.d.ts +46 -0
  314. package/dist/components/stream/geoTypes.d.ts +56 -7
  315. package/dist/components/stream/glyphDef.d.ts +98 -0
  316. package/dist/components/stream/hitTarget.d.ts +170 -0
  317. package/dist/components/stream/hoverUtils.d.ts +3 -0
  318. package/dist/components/stream/keyboardNav.d.ts +4 -1
  319. package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +9 -1
  320. package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +57 -0
  321. package/dist/components/stream/networkBezier.d.ts +10 -0
  322. package/dist/components/stream/networkColorAccessors.d.ts +49 -0
  323. package/dist/components/stream/networkCustomLayout.d.ts +66 -1
  324. package/dist/components/stream/networkDefaultTooltip.d.ts +10 -0
  325. package/dist/components/stream/networkFrameInteraction.d.ts +37 -0
  326. package/dist/components/stream/networkFramePaint.d.ts +43 -0
  327. package/dist/components/stream/networkPipelineConfig.d.ts +22 -0
  328. package/dist/components/stream/networkPipelineHelpers.d.ts +12 -0
  329. package/dist/components/stream/networkRealtimeEncoding.d.ts +41 -0
  330. package/dist/components/stream/networkTypes.d.ts +104 -5
  331. package/dist/components/stream/ordinalCanvasRenderers.d.ts +7 -0
  332. package/dist/components/stream/ordinalCustomLayout.d.ts +17 -1
  333. package/dist/components/stream/ordinalDataIndex.d.ts +5 -0
  334. package/dist/components/stream/ordinalDefaultTooltip.d.ts +10 -0
  335. package/dist/components/stream/ordinalDomain.d.ts +38 -0
  336. package/dist/components/stream/ordinalPipelineUpdateResults.d.ts +12 -0
  337. package/dist/components/stream/ordinalPulse.d.ts +10 -0
  338. package/dist/components/stream/ordinalPulseResources.d.ts +3 -0
  339. package/dist/components/stream/ordinalSceneBuilders/sceneBuilderMap.d.ts +5 -0
  340. package/dist/components/stream/ordinalSceneBuilders/types.d.ts +2 -0
  341. package/dist/components/stream/ordinalSpatialIndex.d.ts +9 -0
  342. package/dist/components/stream/ordinalTypes.d.ts +56 -8
  343. package/dist/components/stream/paintNeeds.d.ts +31 -0
  344. package/dist/components/stream/physics/CapacityQueueController.d.ts +5 -0
  345. package/dist/components/stream/physics/CapacityQueueTypes.d.ts +134 -0
  346. package/dist/components/stream/physics/MatterPhysicsEngineAdapter.d.ts +42 -0
  347. package/dist/components/stream/physics/PhysicsAccessibility.d.ts +48 -0
  348. package/dist/components/stream/physics/PhysicsAnnotations.d.ts +58 -0
  349. package/dist/components/stream/physics/PhysicsBodyBudget.d.ts +26 -0
  350. package/dist/components/stream/physics/PhysicsBodySpatialIndex.d.ts +10 -0
  351. package/dist/components/stream/physics/PhysicsCanvasTheme.d.ts +26 -0
  352. package/dist/components/stream/physics/PhysicsControllers.d.ts +75 -0
  353. package/dist/components/stream/physics/PhysicsEngineAdapter.d.ts +59 -0
  354. package/dist/components/stream/physics/PhysicsEngineConformance.d.ts +23 -0
  355. package/dist/components/stream/physics/PhysicsEvidence.d.ts +25 -0
  356. package/dist/components/stream/physics/PhysicsKernel.d.ts +207 -0
  357. package/dist/components/stream/physics/PhysicsOptionalEngineAdapters.d.ts +12 -0
  358. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +84 -0
  359. package/dist/components/stream/physics/PhysicsPipelineTypes.d.ts +181 -0
  360. package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +72 -0
  361. package/dist/components/stream/physics/PhysicsSediment.d.ts +69 -0
  362. package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +18 -0
  363. package/dist/components/stream/physics/PhysicsSettledScene.d.ts +21 -0
  364. package/dist/components/stream/physics/PhysicsWorkerClient.d.ts +24 -0
  365. package/dist/components/stream/physics/PhysicsWorkerProtocol.d.ts +101 -0
  366. package/dist/components/stream/physics/PhysicsWorkerRuntime.d.ts +5 -0
  367. package/dist/components/stream/physics/RapierPhysicsEngineAdapter.d.ts +18 -0
  368. package/dist/components/stream/physics/ServiceOperationsControllers.d.ts +27 -0
  369. package/dist/components/stream/physics/ServiceOperationsTypes.d.ts +89 -0
  370. package/dist/components/stream/physics/StreamPhysicsFrame.d.ts +6 -0
  371. package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +302 -0
  372. package/dist/components/stream/physics/physicsBodyCanvas.d.ts +27 -0
  373. package/dist/components/stream/physics/physicsPipelineControls.d.ts +4 -0
  374. package/dist/components/stream/physics/physicsPipelineHelpers.d.ts +41 -0
  375. package/dist/components/stream/physics/physicsPipelineObservations.d.ts +14 -0
  376. package/dist/components/stream/physics/physicsPipelineUpdateResults.d.ts +9 -0
  377. package/dist/components/stream/physics/physicsRegionRuntime.d.ts +54 -0
  378. package/dist/components/stream/physics/physicsSemanticUI.d.ts +20 -0
  379. package/dist/components/stream/physics/usePhysicsFrameLifecyclePolicy.d.ts +16 -0
  380. package/dist/components/stream/pipelineBufferUtils.d.ts +26 -0
  381. package/dist/components/stream/pipelineConfig.d.ts +177 -0
  382. package/dist/components/stream/pipelineDecay.d.ts +20 -2
  383. package/dist/components/stream/pipelineDomainResolution.d.ts +62 -0
  384. package/dist/components/stream/pipelineIdentityOps.d.ts +26 -0
  385. package/dist/components/stream/pipelinePulse.d.ts +16 -2
  386. package/dist/components/stream/pipelineRibbons.d.ts +41 -0
  387. package/dist/components/stream/pipelineSpatialIndex.d.ts +12 -0
  388. package/dist/components/stream/pipelineStoreUpdateResults.d.ts +12 -0
  389. package/dist/components/stream/pipelineStyleResolvers.d.ts +46 -0
  390. package/dist/components/stream/pipelineTransitions.d.ts +2 -0
  391. package/dist/components/stream/pipelineUpdateContract.d.ts +62 -0
  392. package/dist/components/stream/pulseFrameRefresh.d.ts +22 -0
  393. package/dist/components/stream/renderers/glyphCanvasRenderer.d.ts +6 -0
  394. package/dist/components/stream/renderers/networkSymbolRenderer.d.ts +2 -0
  395. package/dist/components/stream/renderers/resolveCSSColor.d.ts +6 -0
  396. package/dist/components/stream/renderers/symbolCanvasRenderer.d.ts +2 -0
  397. package/dist/components/stream/sceneRevisionDiagnostics.d.ts +18 -0
  398. package/dist/components/stream/stalenessBands.d.ts +28 -0
  399. package/dist/components/stream/streamStoreSync.d.ts +37 -0
  400. package/dist/components/stream/symbolPath.d.ts +24 -0
  401. package/dist/components/stream/types.d.ts +206 -9
  402. package/dist/components/stream/useFrame.d.ts +21 -2
  403. package/dist/components/stream/useHydration.d.ts +6 -0
  404. package/dist/components/stream/useLegendCategoryEmission.d.ts +5 -0
  405. package/dist/components/stream/useStalenessCheck.d.ts +6 -1
  406. package/dist/components/stream/workerModuleUrl.d.ts +10 -0
  407. package/dist/components/stream/xyAnnotationAnchors.d.ts +13 -0
  408. package/dist/components/stream/xyCanvasRenderers.d.ts +7 -0
  409. package/dist/components/stream/xyCrosshair.d.ts +11 -0
  410. package/dist/components/stream/xyDateTicks.d.ts +9 -0
  411. package/dist/components/stream/xyDefaultTooltip.d.ts +10 -0
  412. package/dist/components/stream/xySceneBuilders/pointScene.d.ts +2 -2
  413. package/dist/components/stream/xySceneBuilders/types.d.ts +9 -4
  414. package/dist/controls.min.js +2 -0
  415. package/dist/controls.module.min.js +2 -0
  416. package/dist/forceLayoutWorker.js +1 -0
  417. package/dist/geo.min.js +1 -1
  418. package/dist/geo.module.min.js +1 -1
  419. package/dist/network.min.js +1 -1
  420. package/dist/network.module.min.js +1 -1
  421. package/dist/ordinal.min.js +1 -1
  422. package/dist/ordinal.module.min.js +1 -1
  423. package/dist/physics-matter.min.js +1 -0
  424. package/dist/physics-matter.module.min.js +1 -0
  425. package/dist/physics-rapier.min.js +1 -0
  426. package/dist/physics-rapier.module.min.js +1 -0
  427. package/dist/physics.min.js +2 -0
  428. package/dist/physics.module.min.js +2 -0
  429. package/dist/physicsWorker.js +1 -0
  430. package/dist/realtime.min.js +1 -1
  431. package/dist/realtime.module.min.js +1 -1
  432. package/dist/semiotic-ai-chunk-OG7BQUUW.module.min.js +2 -0
  433. package/dist/semiotic-ai-core.d.ts +47 -0
  434. package/dist/semiotic-ai-core.min.js +1 -0
  435. package/dist/semiotic-ai-core.module.min.js +1 -0
  436. package/dist/semiotic-ai-statisticalOverlays-CY4WKR4A.module.min.js +2 -0
  437. package/dist/semiotic-ai.d.ts +52 -4
  438. package/dist/semiotic-ai.min.js +1 -1
  439. package/dist/semiotic-ai.module.min.js +1 -1
  440. package/dist/semiotic-chunk-3FSVZ46U.module.min.js +2 -0
  441. package/dist/semiotic-controls.d.ts +18 -0
  442. package/dist/semiotic-data.d.ts +2 -0
  443. package/dist/semiotic-data.min.js +1 -1
  444. package/dist/semiotic-data.module.min.js +1 -1
  445. package/dist/semiotic-experimental.d.ts +49 -0
  446. package/dist/semiotic-experimental.min.js +1 -0
  447. package/dist/semiotic-experimental.module.min.js +1 -0
  448. package/dist/semiotic-geo.d.ts +11 -0
  449. package/dist/semiotic-network.d.ts +14 -1
  450. package/dist/semiotic-ordinal.d.ts +10 -0
  451. package/dist/semiotic-physics-matter.d.ts +10 -0
  452. package/dist/semiotic-physics-rapier.d.ts +9 -0
  453. package/dist/semiotic-physics.d.ts +56 -0
  454. package/dist/semiotic-realtime-core.d.ts +34 -0
  455. package/dist/semiotic-realtime-core.min.js +1 -0
  456. package/dist/semiotic-realtime-core.module.min.js +1 -0
  457. package/dist/semiotic-realtime-react.d.ts +10 -0
  458. package/dist/semiotic-realtime-react.min.js +2 -0
  459. package/dist/semiotic-realtime-react.module.min.js +2 -0
  460. package/dist/semiotic-realtime.d.ts +4 -22
  461. package/dist/semiotic-recipes-core.d.ts +92 -0
  462. package/dist/semiotic-recipes-core.min.js +1 -0
  463. package/dist/semiotic-recipes-core.module.min.js +1 -0
  464. package/dist/semiotic-recipes-react.d.ts +7 -0
  465. package/dist/semiotic-recipes-react.min.js +2 -0
  466. package/dist/semiotic-recipes-react.module.min.js +2 -0
  467. package/dist/semiotic-recipes.d.ts +4 -26
  468. package/dist/semiotic-recipes.min.js +1 -1
  469. package/dist/semiotic-recipes.module.min.js +1 -1
  470. package/dist/semiotic-server-edge.d.ts +8 -0
  471. package/dist/semiotic-server-edge.min.js +1 -0
  472. package/dist/semiotic-server-edge.module.min.js +1 -0
  473. package/dist/semiotic-server-node.d.ts +5 -0
  474. package/dist/semiotic-server-node.min.js +1 -0
  475. package/dist/semiotic-server-node.module.min.js +1 -0
  476. package/dist/semiotic-server.d.ts +2 -2
  477. package/dist/semiotic-statisticalOverlays-UOMSFKVJ.module.min.js +2 -0
  478. package/dist/semiotic-themes-core.d.ts +53 -0
  479. package/dist/semiotic-themes-core.min.js +1 -0
  480. package/dist/semiotic-themes-core.module.min.js +1 -0
  481. package/dist/semiotic-themes-react.d.ts +4 -0
  482. package/dist/semiotic-themes-react.min.js +2 -0
  483. package/dist/semiotic-themes-react.module.min.js +2 -0
  484. package/dist/semiotic-themes.d.ts +6 -74
  485. package/dist/semiotic-themes.min.js +1 -2
  486. package/dist/semiotic-themes.module.min.js +1 -2
  487. package/dist/semiotic-utils-core.d.ts +46 -0
  488. package/dist/semiotic-utils-core.min.js +1 -0
  489. package/dist/semiotic-utils-core.module.min.js +1 -0
  490. package/dist/semiotic-utils-react.d.ts +5 -0
  491. package/dist/semiotic-utils-react.min.js +2 -0
  492. package/dist/semiotic-utils-react.module.min.js +2 -0
  493. package/dist/semiotic-utils.d.ts +3 -39
  494. package/dist/semiotic-utils.min.js +1 -2
  495. package/dist/semiotic-utils.module.min.js +1 -2
  496. package/dist/semiotic-value.min.js +1 -1
  497. package/dist/semiotic-value.module.min.js +1 -1
  498. package/dist/semiotic-xy.d.ts +10 -0
  499. package/dist/semiotic.d.ts +39 -7
  500. package/dist/semiotic.min.js +1 -1
  501. package/dist/semiotic.module.min.js +1 -1
  502. package/dist/server.min.js +1 -1
  503. package/dist/server.module.min.js +1 -1
  504. package/dist/xy-chunk-IWD6IB6V.module.min.js +2 -0
  505. package/dist/xy-statisticalOverlays-7RWG6LJT.module.min.js +2 -0
  506. package/dist/xy.min.js +1 -1
  507. package/dist/xy.module.min.js +1 -1
  508. package/package.json +246 -86
  509. package/spec/README.md +152 -0
  510. package/spec/bindings/README.md +35 -0
  511. package/spec/bindings/vega-lite.mjs +112 -0
  512. package/spec/v0.1/annotation-provenance.schema.json +127 -0
  513. package/spec/v0.1/audience-profile.schema.json +67 -0
  514. package/spec/v0.1/chart-capability.schema.json +186 -0
  515. package/dist/semiotic-ai-statisticalOverlays-C2PPlmXv.js +0 -1
  516. package/dist/semiotic-statisticalOverlays-C3DsOgr_.js +0 -1
  517. package/dist/xy-statisticalOverlays-C2PPlmXv.js +0 -1
package/dist/geo.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-geo"),o=require("d3-scale"),i=require("d3-quadtree"),r=require("d3-array"),s=require("d3-hierarchy"),l=require("d3-shape"),a=require("regression"),c=require("d3-zoom"),u=require("d3-selection");function d(e){return e&&e.__esModule?e:{default:e}}function h(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 f=h(t),p=d(a);class g{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}}function m(e,t,n){return e+(t-e)*n}function y(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,l=n-1-t;switch(e.type){case"linear":return s+(1-l/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,l/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>l?1:s;default:return 1}}function v(e,t,n){var o;const i=null!==(o=e.duration)&&void 0!==o?o:500,r=n-t;return i>r?1-r/i:0}const b={mercator:n.geoMercator,equalEarth:n.geoEqualEarth,albersUsa:n.geoAlbersUsa,orthographic:n.geoOrthographic,naturalEarth:n.geoNaturalEarth1,equirectangular:n.geoEquirectangular};function x(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function j(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function k(e,t,n){return e?Object.assign(Object.assign({},n),"function"==typeof e?e(t):e):Object.assign({},n)}function w(e,t){if(2>e.length)return[e];const n=.4*t,o=[];let i=[e[0]];for(let t=1;e.length>t;t++){const r=e[t];Math.abs(r[0]-e[t-1][0])>n?(2>i.length||o.push(i),i=[r]):i.push(r)}return 2>i.length||o.push(i),o}function M(e,t,n=24){const o=t[0]-e[0],i=t[1]-e[1],r=Math.sqrt(o*o+i*i);if(0===r)return[e,t];const s=-i/r,l=o/r,a=Math.min(.3*r,80),c=(e[0]+t[0])/2+s*a,u=(e[1]+t[1])/2+l*a,d=[];for(let o=0;n>=o;o++){const i=o/n,r=1-i;d.push([r*r*e[0]+2*r*i*c+i*i*t[0],r*r*e[1]+2*r*i*u+i*i*t[1]])}return d}function O(e,t){if(2>e.length)return e;const n=t/2+1,o=[];for(let t=0;e.length>t;t++){const i=e[t];let r,s;0===t?(r=e[1][0]-i[0],s=e[1][1]-i[1]):t===e.length-1?(r=i[0]-e[t-1][0],s=i[1]-e[t-1][1]):(r=e[t+1][0]-e[t-1][0],s=e[t+1][1]-e[t-1][1]);const l=Math.sqrt(r*r+s*s)||1;o.push([i[0]+s/l*n,i[1]+-r/l*n])}return o}function S(e,t,n,o,i){const r=t[0]-e[0],s=t[1]-e[1],l=Math.sqrt(r*r+s*s);if(0===l)return[e,t];const a=s/l,c=-r/l,u=i/2+1;return[[e[0]+a*u,e[1]+c*u],[t[0]+a*u,t[1]+c*u]]}class A{constructor(e){this.scene=[],this.scales=null,this.version=0,this._quadtree=null,this._maxPointRadius=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this._hasRenderedOnce=!1,this.config=e}updateConfig(e){this.config=Object.assign(Object.assign({},this.config),e)}setAreas(e){this.areas=e}setPoints(e){this.pointData=e,this.streaming=!1}setLines(e){this.lineData=e.slice()}initStreaming(e=500){this.pointBuffer=new g(e),this.timestampBuffer=new g(e),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming(),this.pointBuffer.push(e),this.timestampBuffer.push(performance.now()),this.lastIngestTime=performance.now()}pushMany(e){this.pointBuffer||this.initStreaming();const t=performance.now();for(const n of e)this.pointBuffer.push(n),this.timestampBuffer.push(t);this.lastIngestTime=t}pushLine(e){null!=e&&"object"==typeof e&&(this.lineData.push(e),this.version++)}pushManyLines(e){if(!Array.isArray(e)||0===e.length)return;const t=e.filter(e=>null!=e&&"object"==typeof e);if(0!==t.length){for(const e of t)this.lineData.push(e);this.version++}}removeLine(e){const{lineIdAccessor:t}=this.config;if(!t)throw Error("removeLine() requires lineIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],o=new Set(Array.isArray(e)?e:[e]),i=[];return this.lineData=this.lineData.filter(e=>!o.has(n(e)+"")||(i.push(e),!1)),i.length>0&&this.version++,i}getLines(){return this.lineData.slice()}removePoint(e){const{pointIdAccessor:t}=this.config;if(!t)throw Error("removePoint() requires pointIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],o=new Set(Array.isArray(e)?e:[e]);if(this.streaming&&this.pointBuffer){const e=e=>o.has(n(e)+"");if(this.timestampBuffer&&this.timestampBuffer.size>0){const t=this.timestampBuffer.toArray(),n=new Set;this.pointBuffer.forEach((t,o)=>{e(t)&&n.add(o)}),this.timestampBuffer.clear();for(let e=0;t.length>e;e++)n.has(e)||this.timestampBuffer.push(t[e])}const t=this.pointBuffer.remove(e);return t.length>0&&this.version++,t}{const e=[];return this.pointData=this.pointData.filter(t=>!o.has(n(t)+"")||(e.push(t),!1)),e.length>0&&this.version++,e}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.scene=[],this.scales=null,this._hasRenderedOnce=!1,this.activeTransition=null,this.prevPositions=null,this._quadtree=null,this._maxPointRadius=0,this.version++}computeScene(e){const{config:t}=this;this.projection=function(e){if(!e)return n.geoEqualEarth();if("string"==typeof e){const t=b[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),n.geoEqualEarth())}if("object"==typeof e&&"type"in e){const t=b[e.type],o=t?t():n.geoEqualEarth();return e.rotate&&"rotate"in o&&o.rotate(e.rotate),e.center&&"center"in o&&o.center(e.center),o}return e}(t.projection),this.geoPath=n.geoPath(this.projection),this.fitProjection(e),this.geoPath=n.geoPath(this.projection);const o=this.projection;this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null};const i=this.scene;if(this.scene=this.buildSceneNodes(e),this.rebuildQuadtree(),t.projectionTransform&&this.applyCartogramTransform(t.projectionTransform,e),t.decay&&this.streaming&&this.applyDecay(),t.pulse&&this.streaming&&this.applyPulse(),t.transition&&!this._hasRenderedOnce&&this.scene.length>0&&t.introAnimation){const t=e.width/2,n=e.height/2,o=this.scene.filter(e=>"point"===e.type).map(e=>Object.assign(Object.assign({},e),{x:t,y:n}));o.length>0&&this.startTransition(o)}this._hasRenderedOnce=!0,t.transition&&i.length>0&&this.startTransition(i),this.version++}fitProjection(e){var t,n,o,i,r;const s=this.projection,l=this.config,a=[...this.areas],c=x(l.xAccessor,"lon"),u=x(l.yAccessor,"lat"),d=this.getPoints();if(d.length>0){const e=d.map(e=>[c(e),u(e)]);a.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const h=j(l.lineDataAccessor);for(const e of this.lineData){const t=h(e);if(t&&t.length>0){const e=t.map(e=>[c(e),u(e)]);a.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==a.length){if(l.projectionExtent){const[[t,n],[o,i]]=l.projectionExtent;s.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[t,n],[o,n],[o,i],[t,i],[t,n]]]}})}else if(s.clipAngle&&(null!==(t=s.clipAngle())&&void 0!==t?t:0)>0){const t=null!==(n=l.fitPadding)&&void 0!==n?n:0,o=Math.min(e.width,e.height);s.scale(o/2-o*t),s.translate([e.width/2,e.height/2])}else{const t=null!==(o=l.fitPadding)&&void 0!==o?o:0,n=e.width*t,i=e.height*t;s.fitExtent([[n,i],[e.width-n,e.height-i]],{type:"FeatureCollection",features:a})}this.baseScale=s.scale(),this.baseTranslate=s.translate(),this.baseRotation=null!==(r=null===(i=s.rotate)||void 0===i?void 0:i.call(s))&&void 0!==r?r:[0,0,0]}}applyZoomTransform(e,t){const o=this.projection;o&&(o.scale(this.baseScale*e.k),o.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=n.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const o=this.projection;o&&(o.scale(this.baseScale*e),o.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=n.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const o=this.projection;o&&o.rotate&&(o.rotate(e),this.geoPath=n.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}setRotation(e){const t=this.projection;t&&t.rotate&&t.rotate(e)}getRotation(){var e,t,n;return null!==(n=null===(t=null===(e=this.projection)||void 0===e?void 0:e.rotate)||void 0===t?void 0:t.call(e))&&void 0!==n?n:this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}rebuildQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(t++,n.r>e&&(e=n.r));if(this._maxPointRadius=e,A.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const n=Array(t);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._quadtree=i.quadtree().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){var t,o,i;const r=[],{config:s}=this,l=this.projection,a=this.geoPath,c=x(s.xAccessor,"lon"),u=x(s.yAccessor,"lat"),d=function(e){var t,n;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.surface)||"#e0e0e0",stroke:(null===(n=e.themeSemantic)||void 0===n?void 0:n.border)||"#999",strokeWidth:.5,fillOpacity:1}}(s),h=function(e){var t;return{stroke:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",strokeWidth:1.5,fill:"none"}}(s),f=function(e){var t;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",r:4,fillOpacity:.8}}(s);if(s.graticule){const t=!0===s.graticule?{}:s.graticule,o=n.geoGraticule();t.step&&o.step(t.step);const i=a(o())||"";i&&r.push({type:"geoarea",pathData:i,centroid:[e.width/2,e.height/2],bounds:[[0,0],[e.width,e.height]],screenArea:0,style:{fill:"none",stroke:t.stroke||"#e0e0e0",strokeWidth:t.strokeWidth||.5,strokeDasharray:t.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of this.areas){const t=a(e);if(!t)continue;const n=a.centroid(e),o=a.bounds(e),i=a.area(e),l=k(s.areaStyle,e,d);r.push({type:"geoarea",pathData:t,centroid:n,bounds:o,screenArea:i,style:l,datum:e,interactive:!0})}const p=j(s.lineDataAccessor);for(const t of this.lineData){const o=p(t);if(!o||2>o.length)continue;let i=[];if("geo"===s.lineType){const e=Array(o.length);for(let t=0;o.length>t;t++)e[t]=[c(o[t]),u(o[t])];for(let t=0;e.length-1>t;t++){const o=e[t],r=e[t+1],s=n.geoDistance(o,r)||0,a=Math.max(2,Math.ceil(s/(Math.PI/180))),c=n.geoInterpolate(o,r);for(let e=0;a>=e;e++){if(t>0&&0===e)continue;const n=l(c(e/a));null!=n&&i.push(n)}}}else for(let e=0;o.length>e;e++){const t=o[e],n=l([c(t),u(t)]);null!=n&&i.push(n)}if(2>i.length)continue;const a=k(s.lineStyle,t,h),d="number"==typeof a.strokeWidth?a.strokeWidth:1;2!==o.length||2>i.length||"arc"!==s.flowStyle?2!==o.length||2>i.length||"offset"!==s.flowStyle||(i="geo"===s.lineType?O(i,d):S(i[0],i[i.length-1],0,0,d)):i=M(i[0],i[i.length-1]);const f=w(i,e.width);if(f.length>1)for(const e of f){if(2>e.length)continue;const n={type:"line",path:e,style:Object.assign(Object.assign({},a),{_edgeFade:!0}),datum:t};r.push(n)}else r.push({type:"line",path:2>i.length&&f[0]||i,style:a,datum:t})}const g=this.getPoints(),m=s.pointIdAccessor?"function"==typeof s.pointIdAccessor?s.pointIdAccessor:e=>e[s.pointIdAccessor]:null,y=l.clipAngle&&null!==(t=l.clipAngle())&&void 0!==t?t:0,v=y>0?y*Math.PI/180:null,b=l.rotate?l.rotate():[0,0,0],A="function"==typeof l.center?l.center():[0,0],C=[(null!==(o=A[0])&&void 0!==o?o:0)-b[0],(null!==(i=A[1])&&void 0!==i?i:0)-b[1]];for(let e=0;g.length>e;e++){const t=g[e],o=c(t),i=u(t);if(null!=v&&n.geoDistance([o,i],C)>v)continue;const a=l([o,i]);if(!a)continue;const d=s.pointStyle?s.pointStyle(t):Object.assign({},f),h={type:"point",x:a[0],y:a[1],r:d.r||4,style:d,datum:t,pointId:m?m(t)+"":void 0};r.push(h)}return r}applyCartogramTransform(e,t){var n,i,r;const s=this.scene.filter(e=>"point"===e.type);if(2>s.length)return;const l=null!==(n=e.strength)&&void 0!==n?n:1;if(0===l)return;const a=e.centerAccessor?"function"==typeof e.centerAccessor?e.centerAccessor:t=>t[e.centerAccessor]:e=>e.id,c="function"==typeof e.costAccessor?e.costAccessor:t=>t[e.costAccessor],u=s.find(t=>t.datum&&a(t.datum)+""==e.center+"");if(!u)return void("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${e.center}" not found in point data`));const d=u.x,h=u.y,f=s.map(e=>e.datum?c(e.datum):NaN).filter(e=>isFinite(e)&&e>=0),p=Math.max(...f,1),g=Math.min(t.width,t.height)/2,m=o.scaleLinear().domain([0,p]).range([0,g]);this.cartogramLayout={cx:d,cy:h,maxCost:p,availableRadius:g},this.areas.length>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them."),this.scene=this.scene.filter(e=>"geoarea"!==e.type||!e.interactive);for(const e of s){if(e===u)continue;if(!e.datum)continue;const t=Math.atan2(e.y-h,e.x-d),n=Math.sqrt(Math.pow(e.x-d,2)+Math.pow(e.y-h,2)),o=c(e.datum),i=n+((isFinite(o)?m(o):n)-n)*l;e.x=d+Math.cos(t)*i,e.y=h+Math.sin(t)*i}const y=t.width/2,v=t.height/2,b=y-u.x,x=v-u.y;if(Math.abs(b)>.5||Math.abs(x)>.5)for(const e of s)e.x+=b,e.y+=x;this.cartogramLayout={cx:y,cy:v,maxCost:p,availableRadius:g};const j=this.scene.filter(e=>"line"===e.type);if(j.length>0&&"fractional"!==e.lineMode){const e=new Map;for(const t of s)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of j){const n=null===(i=t.datum)||void 0===i?void 0:i.source,o=null===(r=t.datum)||void 0===r?void 0:r.target;if(n&&o){const i=e.get(n+""),r=e.get(o+"");i&&r&&(t.path=[i,r])}}}}applyDecay(){const e=this.config.decay;if(!e||!this.pointBuffer)return;const t=this.pointBuffer.size;if(0===t)return;const n=this.scene.filter(e=>"point"===e.type);for(let o=0;n.length>o;o++){const i=y(e,o,t);n[o]._decayOpacity=i,n[o].style=Object.assign(Object.assign({},n[o].style),{opacity:i})}}applyPulse(){var e;const t=this.config.pulse;if(!t||!this.timestampBuffer)return;const n=performance.now(),o=this.scene.filter(e=>"point"===e.type),i=this.timestampBuffer.toArray();for(let r=0;o.length>r&&i.length>r;r++){const s=v(t,i[r],n);s>0&&(o[r]._pulseIntensity=s,o[r]._pulseColor=t.color||"rgba(255,255,255,0.6)",o[r]._pulseGlowRadius=null!==(e=t.glowRadius)&&void 0!==e?e:4)}}get hasActivePulses(){var e;return function(e,t){var n;if(!t||0===t.size)return!1;const o="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=e.duration)&&void 0!==n?n:500,r=t.peek();return null!=r&&i>o-r}(null!==(e=this.config.pulse)&&void 0!==e?e:{},this.timestampBuffer)}startTransition(e){var t,n,o,i;const r=null!==(n=null===(t=this.config.transition)||void 0===t?void 0:t.duration)&&void 0!==n?n:300;if(0>=r)return;const s=new Map;for(const t of e)"point"===t.type&&t.pointId&&s.set(t.pointId,[t.x,t.y]);const l=this.scene.filter(e=>"point"===e.type);let a=!1;for(const e of l)if(e.pointId){const t=s.get(e.pointId);t&&(e._targetX=e.x,e._targetY=e.y,e.x=t[0],e.y=t[1],(Math.abs(t[0]-e._targetX)>.5||Math.abs(t[1]-e._targetY)>.5)&&(a=!0))}for(const e of l)e.pointId&&!s.has(e.pointId)&&(e._targetOpacity=null!==(i=null===(o=e.style)||void 0===o?void 0:o.opacity)&&void 0!==i?i:1,e.style=Object.assign(Object.assign({},e.style),{opacity:0}),a=!0);a&&(this.activeTransition={startTime:performance.now(),duration:r})}cancelIntroAnimation(){this.activeTransition=null}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t),o=this.scene.filter(e=>"point"===e.type);for(const e of o){if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=m(e.x,e._targetX,n),e.y=m(t,e._targetY,n)}null!=e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style),{opacity:e._targetOpacity*n}))}if(t>=1){for(const e of o)null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0),null!=e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style),{opacity:e._targetOpacity}),e._targetOpacity=void 0);return this.activeTransition=null,!1}return!0}}function C(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function P(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function L(e,t){const n=P(e);if(!n)return!1;const o=P(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function z(e,t,n,o,i,r,s=0){if(r){const e=function(e,t,n,o,i,r=e=>e.x,s=e=>e.y,l=e=>e.r){const a=Math.max(o,i+5,12),c=t-a,u=t+a,d=n-a,h=n+a;let f=null,p=1/0;return e.visit((e,i,a,g,m)=>{if(i>u||c>g||a>h||d>m)return!0;if(!e.length){let i=e;do{const e=i.data,a=r(e)-t,c=s(e)-n,u=Math.sqrt(a*a+c*c);C(l(e),o)>=u&&p>u&&(f=e,p=u),i=i.next}while(i)}return!1}),f?{node:f,distance:p}:null}(r,t,n,o,s);if(e)return e}else{let i=null,r=o;for(const s of e){if("point"!==s.type)continue;const e=s.x-t,l=s.y-n,a=Math.sqrt(e*e+l*l);C(s.r,o)>=a&&r>a&&(i=s,r=a)}if(i)return{node:i,distance:r}}for(let o=e.length-1;o>=0;o--){const r=e[o];if("geoarea"!==r.type)continue;const s=r;if(!1===s.interactive)continue;const[[l,a],[c,u]]=s.bounds;if(!(l>t||t>c||a>n||n>u)&&(s._cachedPath2D||(s._cachedPath2D=new Path2D(s.pathData)),i.isPointInPath(s._cachedPath2D,t,n)))return{node:s,distance:0}}let l=null,a=o;for(const o of e){if("line"!==o.type)continue;const e=o,{path:i}=e,r=Math.max((e.style.strokeWidth||2)+4,5);for(let o=0;i.length-1>o;o++){const[s,c]=i[o],[u,d]=i[o+1],h=R(t,n,s,c,u,d);r>=h&&a>h&&(l=e,a=h)}}return l?{node:l,distance:a}:null}function R(e,t,n,o,i,r){const s=i-n,l=r-o,a=s*s+l*l;if(0===a)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*s+(t-o)*l)/a;c=Math.max(0,Math.min(1,c));const u=o+c*l;return Math.sqrt(Math.pow(e-(n+c*s),2)+Math.pow(t-u,2))}function D(n){let o=null;const i=()=>(o||(o=t.createContext(null)),o),r=I(n);return[function({children:o,initialState:r}){const s=t.useRef(r),l=t.useMemo(()=>I(n,s.current),[]),a=i();return e.jsx(a.Provider,{value:l,children:o})},e=>{var n;const o=i(),s=null!==(n=t.useContext(o))&&void 0!==n?n:r,l=t.useRef(e);l.current=e;const a=t.useCallback(()=>l.current(s.getState()),[s]),c=t.useCallback(()=>l.current(s.getState()),[s]);return t.useSyncExternalStore(s.subscribe,a,c)}]}function I(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 $(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 E(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:N})})),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}A.QUADTREE_THRESHOLD=500;const N=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],W={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}},B={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}},_={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:N,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 T(e,t){if("light"===t)return W;if("dark"===t)return B;if("high-contrast"===t)return _;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?B:W;return E(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 E(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[F,H]=D(e=>({theme:W,setTheme(t){e(e=>({theme:T(e.theme,t)}))}}));const q=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,G=new WeakMap;let V=0,U=!1,Z=null,Y=null,X=null;function Q(e,t){var n,o;if(!t)return t;const i=q.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(U)return;if("undefined"==typeof window||"undefined"==typeof document)return;U=!0;const e=()=>{V++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Z=new MutationObserver(e),Z.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Y=window.matchMedia("(prefers-color-scheme: dark)"),X=e,"function"==typeof Y.addEventListener?Y.addEventListener("change",X):"function"==typeof Y.addListener&&Y.addListener(X)}catch(e){}}();let s=G.get(r);s&&s.version===V||(s={version:V,map:new Map},G.set(r,s));const l=s.map.get(t);if(void 0!==l)return l;const a=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,a),a}const K="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function J(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function ee(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]),l=r[0]-s.left-s.right,a=r[1]-s.top-s.bottom,c=J(e.foregroundGraphics,r,s),u=J(e.backgroundGraphics,r,s),d=H(e=>e.theme),{transition:h,introEnabled:p}=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),g="semiotic-table-"+f.useId(),m=t.useRef(0),y=t.useRef(()=>{}),v=t.useCallback(()=>{m.current||(m.current=requestAnimationFrame(()=>y.current()))},[]);t.useEffect(()=>()=>{m.current&&(cancelAnimationFrame(m.current),m.current=0)},[]);const b=t.useRef(()=>{}),x=t.useRef(()=>{}),j=t.useRef(null),k=t.useRef(0),w=t.useCallback(()=>{k.current=0;const e=j.current;j.current=null,e&&b.current(e)},[]),M=t.useCallback(e=>{j.current={clientX:e.clientX,clientY:e.clientY},0===k.current&&(k.current=requestAnimationFrame(w))},[w]),O=t.useCallback(()=>{j.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0),x.current()},[]);t.useEffect(()=>()=>{j.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0)},[]);const S=e.themeDirtyRef;return K(()=>{S&&(V++,S.current=!0,v())},[d,v,S]),{reducedMotion:n,reducedMotionRef:o,responsiveRef:i,size:r,margin:s,adjustedWidth:l,adjustedHeight:a,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:h,introEnabled:p,tableId:g,rafRef:m,renderFnRef:y,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:M,onPointerLeave:O}}function te({isStale:t,position:n}){return e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===n?{top:4,left:4}:"bottom-left"===n?{bottom:4,left:4}:"bottom-right"===n?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:t?"#dc3545":"#28a745",color:"white"}),children:t?"STALE":"LIVE"})}const ne={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 oe(e,t,n,o,i){let r;return r="function"==typeof n?n(e):(0,ne[n])(o(e,t),i),r}function ie({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 re(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const se=(t,n,o,i,r,s,l,a,c,u,d)=>{const{type:h="fill",styleFn:f,items:p}=t,g=[];let m=0;const y=!(!n&&!o),v="isolate"===u||void 0===u&&null!=r,{swatchSize:b,labelGap:x,rowHeight:j}=d;return p.forEach((t,u)=>{const d=oe(t,u,h,f,b),k=re(t,i,r),w=r&&r.size>0&&r.has(t.label);g.push(e.jsxs("g",{transform:`translate(0,${m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?a===s&&u===l?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&v?w||!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)+p.length)%p.length;c(a,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:y?e=>{c(a,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,w&&e.jsx(ie,{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)),m+=j}),g};function le({config:t,orientation:n="vertical",width:o=100}){const{colorFn:i,domain:r,label:s,format:l}=t,a=l||(e=>Math.round(100*e)/100+""),c="grad-legend-"+f.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),l=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(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:l+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("rect",{x:l,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:l,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),e.jsx("text",{x:l+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(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:a(r[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function ae(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,legendInteraction:l,title:a="Legend",width:c=100,height:u=20,orientation:d="vertical",legendLayout:h}=t,p=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),l=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:l,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}}(h),[g,m]=f.useState(0),[y,v]=f.useState(0),b=f.useCallback((e,t)=>{m(e),v(t)},[]),x="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:l,focusedItemIndex:a,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=24;const f=[];return t.forEach((t,p)=>{h+=5,f.push(e.jsx("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+p)),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-"+p)),h+=8),f.push(e.jsx("g",{className:"legend-item",transform:`translate(0,${h})`,children:se(t,o,i,r,s,l,a,p,c,u,d)},"legend-group-"+p)),h+=t.items.length*d.rowHeight+8}),f})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:g,focusedItemIndex:y,onFocusedIndexChange:b,legendInteraction:l,metrics:p}):(({legendGroups:t,height:n,width:o,customClickBehavior:i,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:l,focusedGroupIndex:a,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d,metrics:h})=>{var f;let p=0;const g=[];t.forEach((t,n)=>{var f;let m=0;t.label&&(m+=16);const y=((t,n,o,i,r,s,l,a,c,u,d,h)=>{const{type:f="fill",styleFn:p,items:g}=t,m=[],{swatchSize:y,labelGap:v,itemGap:b,rowHeight:x,align:j}=d,k=!(!n&&!o),w="isolate"===u||void 0===u&&null!=r,M=g.map(e=>y+v+7*e.label.length),O=[];let S=0,A=0;M.forEach((e,t)=>{const n=0===A?e:A+b+e;h&&h>0&&A>0&&n>h?(O.push({start:S,end:t,width:A}),S=t,A=e):A=n}),g.length>0&&O.push({start:S,end:g.length,width:A}),O.forEach((t,u)=>{let d="center"===j?Math.max(0,((null!=h?h:t.width)-t.width)/2):"end"===j?Math.max(0,(null!=h?h:t.width)-t.width):0;for(let h=t.start;t.end>h;h++){const t=g[h],j=oe(t,h,f,p,y),O=re(t,i,r),S=r&&r.size>0&&r.has(t.label);m.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?a===s&&h===l?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?S||!1:void 0,"aria-current":k&&!w&&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)+g.length)%g.length;c(a,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:k?e=>{c(a,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"}),j,S&&e.jsx(ie,{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+=M[h]+b}});const C=Math.max(0,...O.map(e=>e.width)),P=O.length;return{items:m,offset:C,totalRows:P,totalHeight:P*x}})(t,i,r,s,l,a,c,n,u,d,h,null!==(f=h.maxWidth)&&void 0!==f?f:o);m+=y.offset+5,g.push(Object.assign(Object.assign({label:t.label},y),{offset:m,totalRows:y.totalRows,totalHeight:y.totalHeight})),p+=m+12});const m=null!==(f=h.maxWidth)&&void 0!==f?f:o;let y=p>m?0:"center"===h.align?Math.max(0,(m-p)/2):"end"===h.align?Math.max(0,m-p):0;const v=[];return g.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:a,height:u,width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:g,focusedItemIndex:y,onFocusedIndexChange:b,legendInteraction:l,metrics:p}),j=!(!o&&!i);return e.jsxs("g",{role:j?"listbox":void 0,"aria-multiselectable":!(!j||"isolate"!==l&&(void 0!==l||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===d&&e.jsx("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),x]})}function ce(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function ue(t){var n;const{legend:o,totalWidth:i,totalHeight:r,margin:s,legendPosition:l="right",legendLayout:a,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:f,legendInteraction:p}=t;if(!o)return null;const g="top"===l||"bottom"===l,m=!!c,y=Math.max(1,g?null!==(n=null==a?void 0:a.maxWidth)&&void 0!==n?n:Math.max(0,i-s.left-s.right):100);let v,b;return"left"===l?(v=Math.max(4,s.left-y-10),b=s.top):"top"===l?(v=s.left,b=m?32:8):"bottom"===l?(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(le,{config:o.gradient,orientation:g?"horizontal":"vertical",width:y}):ce(o)?e.jsx(ae,{legendGroups:o.legendGroups,title:"",width:y,orientation:g?"horizontal":"vertical",legendLayout:a,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:f,legendInteraction:p}):o)});var x}function de(e){return"string"==typeof e?{type:e}:e}function he({orient:n,config:o,values:i,scale:s,size:l,length:a}){const c=function(e){var t,n,o,i,r;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(o),u="top"===n||"bottom"===n,d=t.useMemo(()=>{if(0===i.length)return null;const t=s.domain(),o=l-8;if("boxplot"===c.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],i=t[Math.floor(.5*n)],r=t[Math.floor(.75*n)],s=r-o;return{q1:o,median:i,q3:r,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],r+1.5*s)}}(i);if(!t)return null;const{q1:r,median:l,q3:a,whiskerLow:d,whiskerHigh:h}=t,f=Math.min(.5*o,20),p=(o-f)/2+4;if(u){const t=s(r),o=s(a),i=s(l),u=s(d),g=s(h),m="top"===n?-1:1,y=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:u,y1:y+m*(p+f/2),x2:g,y2:y+m*(p+f/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:u,y1:y+m*p,x2:u,y2:y+m*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:g,y1:y+m*p,x2:g,y2:y+m*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:Math.min(t,o),y:"top"===n?y-p-f:y+p,width:Math.abs(o-t),height:f,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:i,y1:"top"===n?y-p-f:y+p,x2:i,y2:"top"===n?y-p:y+p+f,stroke:c.fill,strokeWidth:2})]})}{const t=s(r),o=s(a),i=s(l),u=s(d),g=s(h),m="left"===n?-1:1,y=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:y+m*(p+f/2),y1:u,x2:y+m*(p+f/2),y2:g,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:y+m*p,y1:u,x2:y+m*(p+f),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:y+m*p,y1:g,x2:y+m*(p+f),y2:g,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:"left"===n?y-p-f:y+p,y:Math.min(t,o),width:f,height:Math.abs(o-t),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:"left"===n?y-p-f:y+p,y1:i,x2:"left"===n?y-p:y+p+f,y2:i,stroke:c.fill,strokeWidth:2})]})}}const d=r.bin().domain(t).thresholds(c.bins)(i);if(0===d.length)return null;const h=Math.max(...d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e.jsx("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,i)=>{if(null==t.x0||null==t.x1)return null;const r=t.length/h*o;if(u){const o=s(t.x0),l=s(t.x1)-s(t.x0);return e.jsx("rect",{x:o,y:"top"===n?-4-r:4,width:Math.max(l,.5),height:r,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}{const o=s(t.x0),l=s(t.x1)-s(t.x0);return e.jsx("rect",{x:"left"===n?-4-r:4,y:Math.min(o,o+l),width:r,height:Math.abs(l),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}})});if("violin"===c.type){const t=o/2+4,i=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const r=e.length/h*(o/2),l=s((e.x0+e.x1)/2);i.push(u?`${l},${"top"===n?-(t-r):t-r}`:`${"left"===n?-(t-r):t-r},${l}`)}for(let e=d.length-1;e>=0;e--){const r=d[e];if(null==r.x0||null==r.x1)continue;const l=r.length/h*(o/2),a=s((r.x0+r.x1)/2);i.push(u?`${a},${"top"===n?-(t+l):t+l}`:`${"left"===n?-(t+l):t+l},${a}`)}return e.jsx("g",{"data-testid":"marginal-violin-"+n,children:e.jsx("polygon",{points:i.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,i=null!=d[0].x0?s(d[0].x0):0;t.push(`M${i},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*o,r=s((e.x0+e.x1)/2);t.push(`L${r},${"top"===n?-i-4:i+4}`)}const r=null!=d[d.length-1].x1?s(d[d.length-1].x1):a;t.push(`L${r},${e}`),t.push("Z")}else{const e=0,i=null!=d[0].x0?s(d[0].x0):0;t.push(`M${e},${i}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*o,r=s((e.x0+e.x1)/2);t.push(`L${"left"===n?-i-4:i+4},${r}`)}const r=null!=d[d.length-1].x1?s(d[d.length-1].x1):a;t.push(`L${e},${r}`),t.push("Z")}return e.jsx("g",{"data-testid":"marginal-ridgeline-"+n,children:e.jsx("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,s,c,l,a,n,u,4]);return d?e.jsx("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function fe(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 pe(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 ge(t,n,o,i){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:r,title:s,orientation:l,align:a,wrap:c=120,noWrap:u}=t;if(!r&&!s)return e.jsx("g",{className:"annotation-note"});let d=l;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=a;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let f="start";"topBottom"===d?"right"===h?f="end":"middle"===h&&(f="middle"):f=0>n?"end":"start";const p=16,g=s?u?[s]:fe(s,c):[],m=r?u?[r]:fe(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))";g.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:f,fontWeight:"bold",children:g.map((t,n)=>e.jsx("tspan",{x:y,dy:0===n?0:p,children:t},n))},"annotation-note-title")),v=g.length*p),m.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:f,y:v,children:m.map((t,n)=>e.jsx("tspan",{x:y,dy:0===n?0:p,children:t},n))},"annotation-note-label"));let j=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),j=e.jsx("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(g.length+m.length)*p+(m.length>0?p:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),j=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,g.length+m.length-1)*p;let w=0;return"topBottom"===d?w=0>o?-(k+2):18:"leftRight"===d&&(w="middle"===h?-(k+p+(m.length>0&&g.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!==w?`translate(0,${w})`:void 0,children:b}),j]})}function me(t,n,o,i,r){var s;const l=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&l.push(e.jsx("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&l.push(e.jsx("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&l.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;l.push(e.jsx("line",{x1:i,y1:(n.y1||0)-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;l.push(e.jsx("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?l.push(e.jsx("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||l.push(e.jsx("line",{x1:0,y1:(n.y1||0)-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&&l.push(e.jsx("path",{d:pe((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e.jsx("g",{className:"annotation-subject",children:l})}function ye(t,n,o,i,r,s){var l;const a=[];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,l=n-r;if(0!==s||0!==l){const t=Math.abs(s),n=Math.abs(l),a=e/2,d=o/2,h=t*d>n*a?a/t:d/n;c=i+s*h,u=r+l*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!==(l=null==o?void 0:o.curve)&&void 0!==l?l:.25)*d,s=(c+t)/2+-(n-u)/d*i,f=(u+n)/2+(t-c)/d*i;a.push(e.jsx("path",{className:"connector-curve",d:`M${c},${u}Q${s},${f} ${t},${n}`,fill:"none",stroke:r},"connector-line")),h=Math.atan2(f-u,s-c)}else a.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;a.push(e.jsx("path",{d:`M${c},${u}L${c+t*Math.cos(h+n)},${u+t*Math.sin(h+n)}L${c+t*Math.cos(h-n)},${u+t*Math.sin(h-n)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return e.jsx("g",{className:"annotation-connector",children:a})}function ve(t){var n,o;const{x:i=0,y:r=0,dx:s,dy:l,nx:a,ny:c,note:u,connector:d,subject:h,type:f,color:p,className:g,disable:m,opacity:y,strokeDasharray:v,events:b={},"data-testid":x}=t,j=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,w=new Set(Array.isArray(m)?m:[]);let M=s||0,O=l||0;null!=a&&(M=a-j),null!=c&&(O=c-k);const S="string"==typeof f?f:"label";if("bracket"===S&&h&&0===M&&0===O)if(void 0!==h.width){M=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;M=e+(0>e?-5:5),O=h.height/2}return e.jsxs("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${j},${k})`,"data-testid":x},null!=y&&{opacity:y},v&&{strokeDasharray:v},b,{children:[!w.has("connector")&&ye(M,O,d,p,S,h),!w.has("subject")&&me(S,h,p,j,k),!w.has("note")&&ge(u,M,O,p)]}))}function be(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",l=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),l=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),a=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:l});return e.jsx(ve,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return e.jsx("g",{children:a})}const a=i.note||{title:"none",label:i.label},c=`${a.label}-${a.title}-${i.i}`;return e.jsx(ve,Object.assign({"data-testid":"semiotic-annotation",events:l},i,{type:s}),c)}function xe(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 je(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 ke(e){return null==e?null:e+""}function we(e,t,n){var o;return null===(o=t.stickyPositionCache)||void 0===o||o.set(e,n),n}function Me(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 we(t,n,{x:i.x,y:i.y})}const o=function(e){var t,n,o,i,r,s;const l=e.data;if(!l||0===l.length)return null;const a=l[l.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(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=a[e.xAccessor||"x"],h=a[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return o?we(t,n,o):null}if("semantic"===r){const o=function(e,t,n){var o,i;const r=function(e){var t,n;return ke(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=>ke(e.pointId)===r);if(s)return we(t,n,{x:s.x,y:s.y});const l=null===(i=n.data)||void 0===i?void 0:i.find(e=>function(e){var t,n,o;return ke(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(!l)return null;const a=xe(l,n),c=je(l,n);return null==a||null==c?null:we(t,n,{x:a,y:c})}(e,t,n);if(o)return o}let s=null,l=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(s=t.x,l=t.y)}if(null!=s&&null!=l||(s=xe(e,n),l=je(e,n)),null!=s&&null!=l)return we(t,n,{x:s,y:l});if("sticky"===r){const e=null===(i=n.stickyPositionCache)||void 0===i?void 0:i.get(t);if(e)return e}return null}function Oe(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Se={secondary:0,primary:3};function Ae(e){return!0===(null==e?void 0:e._annotationDeferred)}function Ce(e){return"blended"===(null==e?void 0:e.cohesion)||"layer"===(null==e?void 0:e.cohesion)?e.cohesion:null}function Pe(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 Le(e){return Math.max(.72,.95-.06*e)}const ze={linear:l.curveLinear,monotoneX:l.curveMonotoneX,monotoneY:l.curveMonotoneY,step:l.curveStep,stepAfter:l.curveStepAfter,stepBefore:l.curveStepBefore,basis:l.curveBasis,cardinal:l.curveCardinal,catmullRom:l.curveCatmullRom};const Re=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function De(e){return!!e&&"object"==typeof e&&Re.has(function(e){return"string"==typeof(null==e?void 0:e.type)?e.type:""}(e))}function Ie(e){return"primary"===(null==e?void 0:e.emphasis)||!0===(null==e?void 0:e.defensive)}function $e(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 Ee(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 Ne=32,We=6,Be=4,_e=8,Te=72;const Fe={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function He(e){return De(e)}function qe(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 Ge(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 Ve(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function Ue(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 Ze(e,t,n,o,i,r,s,l){const a=Ve(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}(a,i,r,l);for(const e of n)c+=12*Ue(a,e);for(const e of o)c+=4*Ue(a,e);return c}function Ye(e){var t;const{annotations:n,context:o,defaultOffset:i=Ne,notePadding:r=We,markPadding:s=Be,edgePadding:l=_e,preserveManualOffsets:a=!0,routeLongConnectors:c=!0,connectorThreshold:u=Te,density:d,progressiveDisclosure:h=!1,redundantCues:f=!1,responsive:p,cohesion:g,audience:m}=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 j=!1;const k=n.map((e,t)=>{if(!He(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,l=null===(i=n.scales)||void 0===i?void 0:i.geoProjection;if(Array.isArray(s)&&s.length>=2&&l){const e=s[0],t=s[1];if("number"==typeof e&&"number"==typeof t){const n=l([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?Me(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=[...qe("string"==typeof e.title?e.title:void 0,t),...qe("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return b.push(Ve(Ge(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=Ze(Ge(n.x,n.y,e.dx,e.dy,s),e,b,x,y,v,r,l);f>t&&(h=e,f=t)}if(!h)return e;const p=Ve(Ge(n.x,n.y,h.dx,h.dy,s),r);b.push(p);const g=Math.hypot(h.dx,h.dy),m=c&&g>=u&&"text"!==e.type&&"widget"!==e.type?Object.assign(Object.assign({},e.connector||{end:"arrow"}),{type:"curve"}):e.connector;return j=!0,Object.assign(Object.assign(Object.assign({},e),{dx:h.dx,dy:h.dy}),m?{connector:m}:{})}),w=j?k:n.slice();let M=w;if(f){let e=!1;const t=w.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});M=e?t:w}{let e=!1;const t=M.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=Fe[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});M=e?t:M}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}(m),o=1===n?e:Object.assign(Object.assign({},e),{maxAnnotations:Math.max(0,Math.round((null!==(t=e.maxAnnotations)&&void 0!==t?t:$e(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=$e(o,i,e),l=n.map((e,t)=>{return{annotation:e,index:t,note:(n=e,De(n))};var n}),a=l.filter(e=>e.note);if(0===a.length||s>=a.length)return{visible:n.slice(),deferred:[],budget:s};const c=a.filter(e=>Ie(e.annotation)),u=a.filter(e=>!Ie(e.annotation)).sort((e,t)=>Ee(t.annotation)-Ee(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=[],p=[];for(const{annotation:e,index:t,note:n}of l)!n||h.has(t)?f.push(e):p.push(e);return{visible:f,deferred:p,budget:s}}(Object.assign({annotations:M,width:y,height:v},o));for(const e of i)O.add(e)}if(p&&("object"==typeof p&&"number"==typeof p.minWidth?p.minWidth:480)>=y)for(const e of M)He(e)&&"secondary"===e.emphasis&&O.add(e);if(O.size>0)for(const e of M)!0===(null==e?void 0:e.defensive)&&O.delete(e);let S;return S=0===O.size?M:h?M.map(e=>O.has(e)?Object.assign(Object.assign({},e),{_annotationDeferred:!0}):e):M.filter(e=>!O.has(e)),g?function(e,t){let n=!1;const o=e.map(e=>He(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,Object.assign(Object.assign({},e),{cohesion:t})):e);return n?o:e}(S,g):S}let Xe={positions:new Map};const Qe=new Set;function Ke(){for(const e of Qe)e()}function Je(e,t){const n=Xe.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Xe.positions);o.delete(e),Xe={positions:o},Ke()}function et(e,t){const n=Xe.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(Xe.positions);o.delete(e),Xe={positions:o},Ke()}function tt(){return Xe}function nt(e){return Qe.add(e),()=>Qe.delete(e)}const ot={positions:new Map};function it(){return()=>{}}function rt(){return ot}function st(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,l=i instanceof Date?i.getTime():i;if(2>t||s===l)return r?[new Date(s),new Date(l)]:[s,l];const a=(l-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?l:s+e*a;c[e]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function lt(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function at(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function ct(e){if(0===e.length)return{min:null,max:null};let t=1/0,n=-1/0;for(const o of e)t>o.pixel&&(t=o.pixel),o.pixel>n&&(n=o.pixel);return{min:t,max:n}}function ut(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function dt(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,i="left"===e?-1:1,r=Math.ceil(t/8);let s="M0,"+o;for(let e=0;r>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*i}`,s+=`L${Math.min(n,t)},${o}`}return s}{const o="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;r>e;e++){const t=8*(e+1);s+=`L${o+4*i},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}}function ht(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function ft(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function pt(n){var o,i;const{width:r,height:a,totalWidth:c,totalHeight:u,margin:d,scales:h,showAxes:g,axes:m,xLabel:y,yLabel:v,yLabelRight:b,xFormat:x,yFormat:j,axisExtent:k,showGrid:w,title:M,legend:O,legendHoverBehavior:S,legendClickBehavior:A,legendHighlightedCategory:C,legendIsolatedCategories:P,legendPosition:z="right",legendLayout:R,foregroundGraphics:D,marginalGraphics:I,xValues:$,yValues:E,annotations:N,autoPlaceAnnotations:W,svgAnnotationRules:B,xAccessor:_,yAccessor:T,annotationData:F,pointNodes:H,curve:q,underlayRendered:G,canvasObscuresUnderlay:V=!0,linkedCrosshairName:U,linkedCrosshairSourceId:Z,children:Y}=n,X=t.useMemo(()=>{var e,t;if(!g||!h)return[];const n=null==m?void 0:m.find(e=>"bottom"===e.orient),o=(null==n?void 0:n.tickFormat)||x||ht,i=Math.max(2,Math.floor(r/70)),s=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5,l=null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:st(h.x,"exact"===k?Math.max(2,s):Math.min(s,i),k),a=l.map(e=>e.valueOf()),c=l.map((e,t)=>({value:e,pixel:h.x(e),label:o(e,t,a)})),u=c.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),d=(null==n?void 0:n.autoRotate)?Math.max(20,Math.min(u+8,55)):Math.max(55,u+8);let f=ft(c,d);if(f.length>1&&(f=f.filter((e,t)=>0===t||e.label+""!=f[t-1].label+"")),(null==n?void 0:n.includeMax)&&f.length>0&&"exact"!==k&&!(null==n?void 0:n.tickValues)){const e=h.x.domain()[1],t=h.x(e),n=f[f.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e,f.length,a);d>t-n&&f.length>1&&(f=f.slice(0,-1)),f.push({value:e,pixel:t,label:i})}}return f},[g,h,m,x,r,k]),Q=t.useMemo(()=>{var e,t;if(!g||!h)return[];const n=null==m?void 0:m.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||j||ht,i=Math.max(2,Math.floor(a/30)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;let s=ft((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:st(h.y,"exact"===k?Math.max(2,r):Math.min(r,i),k)).map(e=>({value:e,pixel:h.y(e),label:o(e)})),22);if(s.length>1&&(s=s.filter((e,t)=>0===t||e.label+""!=s[t-1].label+"")),(null==n?void 0:n.includeMax)&&s.length>0&&"exact"!==k&&!(null==n?void 0:n.tickValues)){const e=h.y.domain()[1],t=h.y(e),n=s[s.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e);22>Math.abs(t-n)&&s.length>1&&(s=s.slice(0,-1)),s.push({value:e,pixel:t,label:i})}}return s},[g,h,m,j,a,k]),K=t.useMemo(()=>{var e,t;if(!g||!h)return[];const n=null==m?void 0:m.find(e=>"right"===e.orient);if(!n)return[];const o=n.tickFormat||j||ht,i=Math.max(2,Math.floor(a/30)),r=null!==(e=n.ticks)&&void 0!==e?e:5;return ft((null!==(t=n.tickValues)&&void 0!==t?t:st(h.y,"exact"===k?Math.max(2,r):Math.min(r,i),k)).map(e=>({value:e,pixel:h.y(e),label:o(e)})),22)},[g,h,m,j,a,k]),J=t.useRef(new Map),ee=t.useRef(null!==(o=null==N?void 0:N.length)&&void 0!==o?o:0),te=null!==(i=null==N?void 0:N.length)&&void 0!==i?i:0;ee.current!==te&&(ee.current=te,J.current=new Map);const ne=t.useMemo(()=>{if(!N||0===N.length)return null;const t=function(t,n,o){var i,r,a,c,u,d,h,g,m,y,v,b,x,j,k,w,M,O,S,A,C,P,L,z,R,D,I,$,E,N,W,B,_,T,F,H,q,G,V,U,Z,Y,X,Q,K,J,ee,te,ne,oe,ie;switch(t.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const s=Me(t,n,o);if(!s)return null;const{x:l,y:c}=s;if(!Oe(l,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(be,{noteData:Object.assign(Object.assign({x:l,y:c,dx:null!==(r=t.dx)&&void 0!==r?r:30,dy:null!==(a=t.dy)&&void 0!==a?a:-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=xe(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 l;return l="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:l,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"y-threshold":{const i=je(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 l,a;return"left"===s?(l=4,a="start"):"center"===s?(l=(o.width||0)/2,a="middle"):(l=(o.width||0)-4,a="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:l,y:i-4,textAnchor:a,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+n)}case"enclose":{const i=(t.coordinates||[]).map(e=>({x:xe(Object.assign(Object.assign({},e),{type:"point"}),o),y:je(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 r=s.packEnclose(i),l=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:r.x,cy:r.y,r:r.r+l,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:r.x,y:r.y-r.r-l-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:xe(Object.assign(Object.assign({},e),{type:"point"}),o),y:je(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),l=i.map(e=>e.y),a=Math.min(...s)-r,c=Math.max(...s)+r,u=Math.min(...l)-r,d=Math.max(...l)+r;return e.jsxs("g",{children:[e.jsx("rect",{x:a,y:u,width:c-a,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:(a+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=xe(n,o),l=je(n,o);if(null==r||null==l)return null;const a="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||s;return e.jsx("circle",Object.assign({cx:r,cy:l,r:a},c),"hl-"+i)})},"ann-"+n)}case"bracket":{const i=xe(t,o),r=je(t,o);return e.jsx(be,{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",l="ordinal"===o.frameType,a="horizontal"===o.projection,f=l?r:null,v=l?s:null;let b;const x=[],j=new Map;if(l&&f&&v){for(const e of i){const t=e[f];if(null==t)continue;const n=t+"";j.has(n)||(j.set(n,x.length),x.push(n))}b=i.map(e=>{const t=e[f],n=e[v];if(null==t||null==n)return null;const o=j.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,w=null!==(g=null===(h=o.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(m=o.scales)||void 0===m?void 0:m.value;if(!k||!w)return null;const M=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=w;let A;if(l)if(a){const e=M(S);A=(t,n)=>[O(n),e(t)]}else{const e=M(O);A=(t,n)=>[e(t),S(n)]}else A=(e,t)=>[O(e),S(t)];const C=t.method||"linear";let P;P="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)),l=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),a=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===a?0:o[e]/a;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,p=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],p+=t*i[e]*r[e])}if(0===u){l.push([t,r[e]]);continue}const g=u*f-d*d;if(1e-12>Math.abs(g))l.push([t,h/u]);else{const e=(u*p-d*h)/g;l.push([t,(h-e*d)/u+e*t])}}return l}(b,null!==(y=t.bandwidth)&&void 0!==y?y:.3):("polynomial"===C?p.default.polynomial(b,{order:t.order||2}):p.default.linear(b)).points;const L=P.map(([e,t])=>{const[n,o]=A(e,t);return`${n},${o}`}).join(" "),z=t.color||"#6366f1",R=P[P.length-1],[D,I]=A(R[0],R[1]);return e.jsxs("g",{children:[e.jsx("polyline",{points:L,fill:"none",stroke:z,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:D+4,y:I-4,fill:z,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!==(j=null==i?void 0:i(t.y0))&&void 0!==j?j: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",s=null!==(M=null===(w=o.scales)||void 0===w?void 0:w.x)&&void 0!==M?M:null===(O=o.scales)||void 0===O?void 0:O.time,a=null!==(A=null===(S=o.scales)||void 0===S?void 0:S.y)&&void 0!==A?A:null===(C=o.scales)||void 0===C?void 0:C.value;if(!s||!a)return null;const c=t.upperAccessor||"upperBounds",u=t.lowerAccessor||"lowerBounds",d=t.filter,h=i.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[r]-t[r]);if(2>h.length)return null;const f=ze[o.curve||"linear"]||l.curveLinear,p=l.area().x(e=>s(e[r])).y0(e=>a(e[u])).y1(e=>a(e[c])).curve(f)(h);if(!p)return null;const g=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:p,fill:g,fillOpacity:null!==(P=t.fillOpacity)&&void 0!==P?P:.15,stroke:"none"}),t.label&&h.length>0&&e.jsx("text",{x:s(h[h.length-1][r])+4,y:a(h[h.length-1][c])-4,fill:g,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!==(z=null===(L=o.scales)||void 0===L?void 0:L.x)&&void 0!==z?z:null===(R=o.scales)||void 0===R?void 0:R.time,l=null!==(I=null===(D=o.scales)||void 0===D?void 0:D.y)&&void 0!==I?I:null===($=o.scales)||void 0===$?void 0:$.value;if(!s||!l)return null;const a=i.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const c=a.reduce((e,t)=>e+t,0)/a.length,u=a.reduce((e,t)=>e+Math.pow(t-c,2),0)/a.length,d=Math.sqrt(u),h=null!==(E=t.threshold)&&void 0!==E?E:2,f=c-h*d,p=!1!==t.showBand,g=t.fill||"#6366f1",m=null!==(N=t.fillOpacity)&&void 0!==N?N:.1,y=t.anomalyColor||"#ef4444",v=null!==(W=t.anomalyRadius)&&void 0!==W?W:6,b=l(c+h*d),x=l(f),j=i.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-c)>h*d});return e.jsxs("g",{children:[p&&e.jsx("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:g,fillOpacity:m}),j.map((t,n)=>{const i=xe(t,o),r=je(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:g,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",l=null!==(_=null===(B=o.scales)||void 0===B?void 0:B.x)&&void 0!==_?_:null===(T=o.scales)||void 0===T?void 0:T.time,a=null!==(H=null===(F=o.scales)||void 0===F?void 0:F.y)&&void 0!==H?H:null===(q=o.scales)||void 0===q?void 0:q.value;if(!l||!a)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=p.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,l=(n-s*t)/e;u=e=>l+s*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(d-2,1)),g=c.reduce((e,t)=>e+t[0],0)/d,m=c.reduce((e,t)=>e+Math.pow(t[0]-g,2),0),y=null!==(G=t.confidence)&&void 0!==G?G:.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],j=(x-c[0][0])/Math.max(d-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*j);const w=[];for(const e of k){const t=u(e),n=f*Math.sqrt(1+1/d+(m>0?Math.pow(e-g,2)/m:0))*v;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const M=`M${w.map(e=>`${l(e.x)},${a(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${l(e.x)},${a(e.yLower)}`).join(" L")} Z`,O=w.map(e=>`${l(e.x)},${a(e.yCenter)}`).join(" "),S=`${l(x)},${a(u(x))}`,A=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:M,fill:t.fill||"#6366f1",fillOpacity:null!==(U=t.fillOpacity)&&void 0!==U?U:.15,stroke:"none"}),e.jsx("polyline",{points:`${S} ${O}`,fill:"none",stroke:A,strokeWidth:null!==(Z=t.strokeWidth)&&void 0!==Z?Z:2,strokeDasharray:null!==(Y=t.strokeDasharray)&&void 0!==Y?Y:"6,3"}),t.label&&w.length>0&&e.jsx("text",{x:l(w[w.length-1].x)+4,y:a(w[w.length-1].yCenter)-4,fill:A,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=Me(t,n,o);if(!e)return null;i=e.x,r=e.y}if(null==i||null==r)return null;if(!Oe(i,r,o))return null;const s=null!==(X=t.dx)&&void 0!==X?X:0,l=null!==(Q=t.dy)&&void 0!==Q?Q:0,a=null!==(K=t.width)&&void 0!==K?K: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-a/2,y:r+l-c/2,width:a,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:a,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const i=Me(t,n,o);if(!i)return null;const{x:r,y:s}=i,l=r+(t.dx||0),a=s+(t.dy||0),c=t.color||"var(--semiotic-text, #333)",u=e.jsx("text",{x:l,y:a,fill:c,fontSize:t.fontSize||11,opacity:t.opacity,strokeDasharray:t.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label});return!0!==t._redundantConnector?f.cloneElement(u,{key:"ann-text-"+n}):e.jsxs("g",{opacity:t.opacity,strokeDasharray:t.strokeDasharray,children:[e.jsx("line",{x1:r,y1:s,x2:l,y2:a,stroke:c,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),f.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,l=null===(ne=o.scales)||void 0===ne?void 0:ne.x,a=null===(oe=o.scales)||void 0===oe?void 0:oe.y,c=r(s)?s:r(l)?l:r(a)?a:null;if(!c)return null;const u=c(i+"");if(null==u)return null;const d=c.bandwidth(),h=t.color||"var(--semiotic-primary, #4589ff)",f=null!==(ie=t.opacity)&&void 0!==ie?ie:.15,p=t.label;return e.jsxs("g",(o.projection?"vertical"===o.projection:c===l)?{children:[e.jsx("rect",{x:u,y:0,width:d,height:o.height||0,fill:h,fillOpacity:f}),p&&e.jsx("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]}:{children:[e.jsx("rect",{x:0,y:u,width:o.width||0,height:d,fill:h,fillOpacity:f}),p&&e.jsx("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+n)}default:return null}},n={scales:h?{x:h.x,y:h.y,time:h.x,value:h.y}:null,timeAxis:"x",xAccessor:_,yAccessor:T,width:r,height:a,data:F,frameType:"xy",pointNodes:H,curve:q,stickyPositionCache:J.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:Pe(e.annotation),readingOrder:null,rank:1};var n}),o=n.some(e=>null!=e.emphasis||null!=e.confidence),i=t.some(e=>Ae(e.annotation)),r=t.some(e=>null!=Ce(e.annotation)),s=t.some(e=>"layer"===Ce(e.annotation));if(!o&&!i&&!r)return t.map(e=>e.node);const l=n.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>{var n,o;return(null!==(n=t.confidence)&&void 0!==n?n:0)-(null!==(o=e.confidence)&&void 0!==o?o:0)||e.i-t.i});l.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,l.length)});for(const e of n)e.emphasis&&(e.rank=Se[e.emphasis]);const a=n.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(t=>{const{p:n,i:o,emphasis:i,readingOrder:r}=t,s=Ae(n.annotation);let l=n.node;if("primary"===i||"secondary"===i||null!=r){const t=null==i&&null!=r;l=e.jsx("g",Object.assign({className:t?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+i},"secondary"===i?{opacity:.6,fontSize:"0.88em"}:{},t?{opacity:Le(r),"data-annotation-reading-order":r}:{},{children:n.node}),"annotation-emphasis-"+o)}const a=Ce(n.annotation);return a&&(l=e.jsx("g",{className:"annotation-cohesion--"+a,children:l},"annotation-cohesion-"+o)),s&&(l=e.jsx("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:l},"annotation-deferred-"+o)),l});return i&&a.unshift(e.jsx("style",{children:".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}"},"annotation-disclosure-style")),s&&a.unshift(e.jsx("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),a}(r)}(W?Ye(Object.assign({annotations:N,context:n},"object"==typeof W?W:{})):N,t,B,n)},[N,W,B,r,a,_,T,F,h,H,q]),oe=function(e){var n;const o=t.useSyncExternalStore(e?nt:it,e?tt:rt,e?tt:rt);return e&&null!==(n=o.positions.get(e))&&void 0!==n?n:null}(U);return t.useEffect(()=>{if(!(null==oe?void 0:oe.locked)||!U)return;const e=e=>{"Escape"===e.key&&et(U)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==oe?void 0:oe.locked,U]),g||M||O||D||I||ne&&ne.length>0||w||Y||oe?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 M?M:"XY Chart"}),e.jsx("desc",{children:"string"==typeof M?M+" — XY data visualization":"XY data visualization"}),e.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[w&&h&&(!G||V)&&(()=>{var t,n;const o=ut(null===(t=null==m?void 0:m.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),i=ut(null===(n=null==m?void 0:m.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[X.map((t,n)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:a,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"xgrid-"+n)),Q.map((t,n)=>e.jsx("line",{x1:0,y1:t.pixel,x2:r,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"ygrid-"+n))]})})(),g&&h&&(()=>{const t=null==m?void 0:m.find(e=>"left"===e.orient),n=null==m?void 0:m.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,i=!n||!1!==n.baseline,s=(null==t?void 0:t.jaggedBase)||!1,l=(null==n?void 0:n.jaggedBase)||!1,c=null==n?void 0:n.landmarkTicks,u=null==t?void 0:t.landmarkTicks,h="var(--semiotic-border, #ccc)",f="var(--semiotic-text-secondary, var(--semiotic-text, #666))",p="var(--semiotic-text, #333)",g=!!(null==n?void 0:n.autoRotate)&&X.length>1&&(()=>{const e=r/Math.max(X.length-1,1);return X.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),x={fontSize:"var(--semiotic-tick-font-size, 12px)"},j={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},k={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},w=null==n?void 0:n.tickAnchor,M=null==t?void 0:t.tickAnchor,O=ct(X),S=ct(Q);return e.jsxs("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!G||V)&&i&&!l&&e.jsx("line",{x1:0,y1:a,x2:r,y2:a,stroke:h,strokeWidth:1}),(!G||V)&&l&&e.jsx("path",{d:dt("bottom",r,a),fill:"none",stroke:h,strokeWidth:1}),X.map((t,n)=>{const o=!!c&&("function"==typeof c?c(t.value,n):L(t.value,n>0?X[n-1].value:void 0));return e.jsxs("g",{transform:`translate(${t.pixel},${a})`,children:[e.jsx("line",{y2:5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{y:g?10:18,textAnchor:g?"end":lt(w,t.pixel===O.min,t.pixel===O.max),fontWeight:o?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o?j:x),transform:g?"rotate(-45)":void 0,children:t.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"center",userSelect:"none"},x),children:t.label})})]},"xtick-"+n)}),y&&e.jsx("text",{x:r/2,y:a+40,textAnchor:"middle",fill:p,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},k),children:y})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!G||V)&&o&&!s&&e.jsx("line",{x1:0,y1:0,x2:0,y2:a,stroke:h,strokeWidth:1}),(!G||V)&&s&&e.jsx("path",{d:dt("left",r,a),fill:"none",stroke:h,strokeWidth:1}),Q.map((t,n)=>{const o=!!u&&("function"==typeof u?u(t.value,n):L(t.value,n>0?Q[n-1].value:void 0));return e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:at(M,t.pixel===S.min,t.pixel===S.max),fontWeight:o?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o?j:x),children:t.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"right",userSelect:"none"},x),children:t.label})})]},"ytick-"+n)}),(()=>{const n=(null==t?void 0:t.label)||v;return n?e.jsx("text",{x:15-d.left,y:a/2,textAnchor:"middle",fill:p,transform:`rotate(-90, ${15-d.left}, ${a/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},k),children:n}):null})()]}),(()=>{const t=null==m?void 0:m.find(e=>"right"===e.orient);if(!t||0===K.length)return null;const n=!1!==t.baseline,o=t.landmarkTicks,i=t.label||b,s=t.tickAnchor,l=ct(K);return e.jsxs("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[n&&e.jsx("line",{x1:r,y1:0,x2:r,y2:a,stroke:h,strokeWidth:1}),K.map((t,n)=>{const i=!!o&&("function"==typeof o?o(t.value,n):L(t.value,n>0?K[n-1].value:void 0));return e.jsxs("g",{transform:`translate(${r},${t.pixel})`,children:[e.jsx("line",{x2:5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:8,textAnchor:"start",dominantBaseline:at(s,t.pixel===l.min,t.pixel===l.max),fontWeight:i?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?j:x),children:t.label}):e.jsx("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"left",userSelect:"none"},x),children:t.label})})]},"ytick-r-"+n)}),i&&e.jsx("text",{x:r+d.right-15,y:a/2,textAnchor:"middle",fill:p,transform:`rotate(90, ${r+d.right-15}, ${a/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},k),children:i})]})})()]})})(),ne,I&&h&&$&&E&&e.jsxs(e.Fragment,{children:[I.top&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(he,{orient:"top",config:de(I.top),values:$,scale:h.x,size:d.top,length:r})}),I.bottom&&e.jsx("g",{transform:`translate(0, ${a})`,children:e.jsx(he,{orient:"bottom",config:de(I.bottom),values:$,scale:h.x,size:d.bottom,length:r})}),I.left&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(he,{orient:"left",config:de(I.left),values:E,scale:h.y,size:d.left,length:a})}),I.right&&e.jsx("g",{transform:`translate(${r}, 0)`,children:e.jsx(he,{orient:"right",config:de(I.right),values:E,scale:h.y,size:d.right,length:a})})]}),D,oe&&oe.sourceId!==Z&&(null==h?void 0:h.x)&&(()=>{const t=h.x(oe.xValue);if(null==t||0>t||t>r)return null;const n=oe.locked;return e.jsx("line",{x1:t,y1:0,x2:t,y2:a,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),Y]}),M&&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 M?M:null}),ue({legend:O,totalWidth:c,totalHeight:u,margin:d,legendPosition:z,title:M,legendLayout:R,legendHoverBehavior:S,legendClickBehavior:A,legendHighlightedCategory:C,legendIsolatedCategories:P})]}):null}function gt(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const mt="undefined"==typeof window||"undefined"==typeof document,yt="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,vt=()=>()=>{},bt=()=>!1,xt=()=>!0;function jt(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 kt(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 wt(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 Mt=f.createContext(null),Ot={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function St(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 At=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""};function Ct(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 Pt="semiotic-accessible-data-table",Lt=Pt+" semiotic-accessible-data-table-hidden",zt=Pt+" semiotic-accessible-data-table-visible",Rt={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"},Dt={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},It={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)"},$t={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Et={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))"},Nt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Wt={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Bt={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 _t({scene:t,chartType:n,tableId:o,chartTitle:i}){var r;const[s,l]=f.useState(!1),[a,c]=f.useState(5),u=f.useContext(Mt),d=null!==(r=null==u?void 0:u.visible)&&void 0!==r&&r,h=s||d,p=f.useRef(null),g=i?"Data summary for "+i:o?`Data summary for ${n} ${o}`:"Data summary for "+n;f.useEffect(()=>{h||c(5)},[h]);const m=f.useCallback(e=>{e.target===e.currentTarget&&(s||d||l(!0))},[s,d]),y=f.useCallback(e=>{var t;d||(null===(t=p.current)||void 0===t?void 0:t.contains(e.relatedTarget))||l(!1)},[d]);if(!t||0===t.length)return o?e.jsx("span",{id:o,tabIndex:-1,style:Ot}):null;if(!h)return e.jsx("div",{id:o,className:Lt,tabIndex:-1,onFocus:m,style:Ot,role:"region","aria-label":g,children:e.jsxs("button",{type:"button",onClick:()=>l(!0),children:["View data summary (",t.length," elements)"]})});const v=function(e){var t,n,o,i,r,s,l,a,c,u,d,h,f,p,g,m,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:Ct(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:Ct(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=Ct(x.datum);null==e.value&&"number"==typeof x.value&&Number.isFinite(x.value)&&(e.value=x.value),v.push({label:"Cell",values:e});break}case"wedge":v.push({label:"Wedge",values:{category:null!==(a=null!==(s=null===(r=x.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(l=x.datum)||void 0===l?void 0:l.label)&&void 0!==a?a:"",value:null!==(u=null===(c=x.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":v.push({label:"Node",values:Ct(x.datum)});break;case"arc":v.push({label:"Arc",values:Ct(x.datum)});break;case"candlestick":v.push({label:"Candlestick",values:Ct(x.datum)});break;case"geoarea":v.push({label:"Region",values:{name:null!==(g=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===(p=x.datum)||void 0===p?void 0:p.name)&&void 0!==g?g:"",value:null!==(y=null===(m=x.datum)||void 0===m?void 0:m.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}: ${At(e.min)} to ${At(e.max)}, mean ${At(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),j=Math.min(a,v.length),k=v.slice(0,j),w=v.length-j,M=new Set;for(const e of k)for(const t of Object.keys(e.values))M.add(t);const O=Array.from(M);return e.jsxs("div",{ref:p,id:o,className:zt,tabIndex:-1,onBlur:y,style:Rt,role:"region","aria-label":g,children:[e.jsx("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{d&&u&&u.setVisible(!1),l(!1)},"aria-label":"Close data summary",style:It,children:"×"}),e.jsx("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Dt,children:x}),e.jsxs("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+n,style:$t,children:[e.jsx("caption",{className:"semiotic-accessible-data-table-caption",style:Wt,children:w>0?`First ${j} of ${v.length} data points`:`All ${v.length} data points`}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:Et,children:"type"}),O.map(t=>e.jsx("th",{style:Et,children:t},t))]})}),e.jsx("tbody",{children:k.map((t,n)=>e.jsxs("tr",{children:[e.jsx("td",{style:Nt,children:t.label}),O.map(n=>{return e.jsx("td",{style:Nt,children:(o=t.values[n],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":At(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},n);var o})]},n))})]}),w>0&&e.jsxs("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>c(e=>e+25),style:Bt,children:["Show ",Math.min(25,w)," more"," ",1===w?"row":"rows"," (",w," remaining)"]})]})}function Tt({summary:t}){return t?e.jsx("div",{role:"note",style:Ot,children:t}):null}function Ft({tableId:t}){return e.jsx("a",{href:"#"+t,style:Ot,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,Ot)},children:"Skip to data table"})}function Ht({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:Ot,children:n})}const qt=Object.freeze([]);function Gt(e){if(!e)return qt;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}const Vt="var(--semiotic-focus, #005fcc)";function Ut({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:l}){if(!t||!n)return null;const a=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=s&&null!=l){const t=Math.max(s,4),n=Math.max(l,4);u=e.jsx("rect",{x:a-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:Vt,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===r?{cx:a,cy:c,r:12,fill:"none",stroke:Vt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:a,cy:c,r:8,fill:"none",stroke:Vt,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})}const Zt={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 Yt(e,t){return"function"==typeof t?t(e):e[t]}function Xt(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 Qt(t={}){const{fields:n,title:o,format:i,style:r={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let l;const a=[];if(o){const e=Yt(t,o);l=Xt(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=Yt(t,o);a.push({label:n,value:Xt(s,r)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){l=Xt(t[n],i);break}if(!l){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(l=Xt(t[e[0]],i))}}const c=Object.assign(Object.assign({},Zt),r);return e.jsxs("div",{className:("semiotic-tooltip "+s).trim(),style:c,children:[l&&e.jsx("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:l}),a.map((t,n)=>e.jsxs("div",{style:{marginTop:0===n&&l?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},n))]})}}function Kt(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;const i=(r=!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,Array.isArray(r)?r[0]:r);var r;const s=n(i);return null==s?null:e.jsx("div",{className:"semiotic-tooltip",style:Zt,children:s})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Qt(t):Qt())}}function Jt({x:t,y:n,containerWidth:o,containerHeight:i,margin:r,children:s,className:l="stream-frame-tooltip",zIndex:a=1}){const c=Number.isFinite(t)&&Number.isFinite(n),u=f.useRef(null),[d,h]=f.useState(null);f.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,l,o,i]);let p;p=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 g=function(e){if(!f.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),m=g?null:Zt;return c?e.jsx("div",{ref:u,className:g?l:(l+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},m||{}),{position:"absolute",left:r.left+t,top:r.top+n,transform:p,pointerEvents:"none",zIndex:a,width:"max-content"}),children:s}):null}function en(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function tn(e,t,n=.6){var o,i,r,s,l;if(!en(t))return;const a=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+a*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(l=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==l?l:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function nn(e,t,n,o=.35){en(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function on(e){switch(e){case"monotoneX":return l.curveMonotoneX;case"monotoneY":return l.curveMonotoneY;case"cardinal":return l.curveCardinal;case"catmullRom":return l.curveCatmullRom;case"step":return l.curveStep;case"stepBefore":return l.curveStepBefore;case"stepAfter":return l.curveStepAfter;case"basis":return l.curveBasis;case"natural":return l.curveNatural;default:return null}}function rn(e,t,n){return null==t?n:"string"!=typeof t?t:Q(e,t)||n}function sn(e,t,n,o,i,r){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const l=e.createLinearGradient(n,o,i,r);for(const e of s)l.addColorStop(e.offset,e.color);return l}function ln(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function an(e,t,n,o,i,r){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const l=s[s.length-1];if(0===l)return;const a=Math.min(.2*l,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=r;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let r=i;a>o&&(r*=o/a),a>l-o&&(r*=(l-o)/a),e.globalAlpha=Math.max(0,r),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function cn(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const r=t[0]*o,s=t[1]*o,l=t[0]+"px",a=t[1]+"px";return e.style.width!==l&&(e.style.width=l),e.style.height!==a&&(e.style.height=a),e.width===r&&e.height===s||(e.width=r,e.height=s),i.setTransform(o,0,0,o,0,0),i.translate(n.left,n.top),i}function un(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function dn([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t,n]}function hn(e,t,n,o,i){return"function"==typeof e?e(t,n,o,i):e.replace("{z}",t+"").replace("{x}",n+"").replace("{y}",o+"").replace("{r}",i>1?"@2x":"")}class fn{constructor(e=256){this.cache=new Map,this.limit=e}get(e){const t=this.cache.get(e);return t&&(t.lastUsed=performance.now()),t}set(e,t){this.cache.set(e,t),this.cache.size>this.limit&&this.evict()}evict(){for(;this.cache.size>this.limit;){let e,t=1/0;for(const[n,o]of this.cache)t>o.lastUsed&&(t=o.lastUsed,e=n);if(!e)break;{const t=this.cache.get(e);t&&(t.img.onload=null,t.img.onerror=null,t.img.src=""),this.cache.delete(e)}}}clear(){for(const e of this.cache.values())e.img.onload=null,e.img.onerror=null,e.img.src="";this.cache.clear()}}class pn{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,lineIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const n=this.particles[t];if(!n.active)return n.active=!0,n.t=0,n.offset=.6*(Math.random()-.5),n.lineIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n,o){for(let i=0;this.capacity>i;i++){const r=this.particles[i];if(!r.active)continue;const s=n[r.lineIndex];if(!s||2>s.length){r.active=!1;continue}if(r.t+=e*t,r.t>=1){r.active=!1;continue}const l=gn(s),a=mn(s,r.t*l),c=(o[r.lineIndex]||2)/2;r.x=a.x+a.nx*r.offset*c*2,r.y=a.y+a.ny*r.offset*c*2}}countForLine(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].lineIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}}function gn(e){let t=0;for(let n=1;e.length>n;n++){const o=e[n][0]-e[n-1][0],i=e[n][1]-e[n-1][1];t+=Math.sqrt(o*o+i*i)}return t}function mn(e,t){let n=0;for(let o=1;e.length>o;o++){const i=e[o][0]-e[o-1][0],r=e[o][1]-e[o-1][1],s=Math.sqrt(i*i+r*r);if(n+s>=t||o===e.length-1){const l=s>0?(t-n)/s:0,a=s>.001?s:1;return{x:e[o-1][0]+i*l,y:e[o-1][1]+r*l,nx:-r/a,ny:i/a}}n+=s}const o=e[e.length-1];return{x:o[0],y:o[1],nx:0,ny:0}}const yn={top:10,right:10,bottom:10,left:10},vn={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"},bn={width:28,height:28,border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,background:"rgba(255,255,255,0.9)",color:"#333",fontSize:16,fontWeight:600,lineHeight:1,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,boxShadow:"0 1px 3px rgba(0,0,0,0.1)"};function xn(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function jn(e){return e?e.getContext("2d"):null}function kn({data:t}){if(!t)return null;if(t.properties)return e.jsx("div",{className:"semiotic-tooltip",style:vn,children:e.jsx("div",{style:{fontWeight:600},children:t.properties.name||t.properties.NAME||t.properties.id||"Feature"})});const n=null!=t.data?t.data:t;if(!n||"object"!=typeof n)return null;const o=Object.entries(n).filter(([e])=>"data"!==e&&!e.startsWith("__")).slice(0,3);return 0===o.length?null:e.jsx("div",{className:"semiotic-tooltip",style:vn,children:o.map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,": "]}),e.jsx("span",{style:{fontWeight:600},children:n+""})]},t))})}kn.ownsChrome=!0;const wn=t.forwardRef(function(n,o){var i,r,s,a,d,h,f,p,g,m;const{projection:y,projectionExtent:v,fitPadding:b,projectionTransform:x,areas:j,points:k,lines:w,xAccessor:M,yAccessor:O,lineDataAccessor:S,pointIdAccessor:C,lineIdAccessor:P,lineType:L="geo",flowStyle:R="basic",graticule:D,zoomable:I,zoomExtent:E,onZoom:N,dragRotate:W,showParticles:B,particleStyle:_,tileURL:T,tileAttribution:F,tileCacheSize:H,size:q,width:G,height:V,responsiveWidth:U,responsiveHeight:Z,margin:Y,className:X,background:K,areaStyle:J,pointStyle:ne,lineStyle:oe,colorScheme:ie,enableHover:re=!0,hoverAnnotation:se,tooltipContent:le,customClickBehavior:ae,customHoverBehavior:ce,annotations:ue,autoPlaceAnnotations:de,decay:he,pulse:fe,transition:pe,animate:ge,staleness:me,backgroundGraphics:ye,foregroundGraphics:ve,title:be,legend:xe,legendPosition:je,legendLayout:ke,legendHoverBehavior:we,legendClickBehavior:Me,legendHighlightedCategory:Oe,legendIsolatedCategories:Se,legendCategoryAccessor:Ae,onCategoriesChange:Ce,showAxes:Pe,accessibleTable:Le=!0,description:ze,summary:Re}=n,De=q||[G||600,V||400],Ie=t.useRef(!0),$e=ee({sizeProp:De,responsiveWidth:U,responsiveHeight:Z,userMargin:Y,marginDefault:yn,foregroundGraphics:ve,backgroundGraphics:ye,animate:ge,transitionProp:pe,themeDirtyRef:Ie}),{reducedMotionRef:Ee,responsiveRef:Ne,size:We,margin:Be,adjustedWidth:_e,adjustedHeight:Te,resolvedForeground:Fe,resolvedBackground:He,transition:qe,introEnabled:Ge,tableId:Ve,rafRef:Ue,renderFnRef:Ze,scheduleRender:Ye,currentTheme:Xe}=$e,Qe=function(){const[e,n]=t.useState(!1);return yt(()=>{n(!0)},[]),e}(),Ke=function(){const e=t.useSyncExternalStore(vt,bt,xt);return t.useRef(e).current}(),Je=t.useMemo(()=>Array.isArray(j)?Gt(j):j,[j]),et=t.useMemo(()=>Gt(k),[k]),tt=t.useMemo(()=>Gt(w),[w]),nt=t.useMemo(()=>null!=W?W:"orthographic"===xn(y),[W,y]),ot=t.useMemo(()=>{var e,t;return{projection:y,projectionExtent:v,fitPadding:b,xAccessor:M,yAccessor:O,lineDataAccessor:S,lineType:L,flowStyle:R,areaStyle:J,pointStyle:ne,lineStyle:oe,colorScheme:ie,themeSemantic:$(Xe),themeSequential:null===(e=null==Xe?void 0:Xe.colors)||void 0===e?void 0:e.sequential,themeDiverging:null===(t=null==Xe?void 0:Xe.colors)||void 0===t?void 0:t.diverging,graticule:D,projectionTransform:x,decay:he,pulse:fe,transition:qe,introAnimation:Ge,annotations:ue,pointIdAccessor:C,lineIdAccessor:P}},[y,v,b,M,O,S,L,R,J,ne,oe,ie,D,x,he,fe,null==qe?void 0:qe.duration,null==qe?void 0:qe.easing,Ge,ue,C,P,Xe]),it=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 kt(e,t);if(!wt(e)||!wt(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(!kt(n,i))return!1}else{if(!wt(n)||!wt(i))return!1;if(!jt(n,i))return!1}}return!0}(n.current,e)||(n.current=e),n.current}(ot),rt=t.useRef(null);rt.current||(rt.current=new A(it));const st=t.useRef(null),lt=t.useRef(null),at=t.useRef(null),ct=t.useRef(null),ut=t.useRef(null);T&&!ut.current&&(ut.current=new fn(H||256));const dt=t.useRef(ue),ht=t.useRef(null),ft=t.useRef(c.zoomIdentity),Mt=t.useRef(!1),Ot=t.useRef(null),At=t.useCallback(e=>{Ot.current=e,Ne&&"object"==typeof Ne&&(Ne.current=e)},[Ne]),Ct=t.useRef(null),Pt=t.useRef(null),Lt=t.useRef(null),zt=t.useRef(0);if(B&&!Lt.current){const e=null!==(i=null==_?void 0:_.maxPerLine)&&void 0!==i?i:30;Lt.current=new pn(50*e)}const Rt=t.useRef(null),Dt=t.useRef(null),[It,$t]=t.useState(null),[Et,Nt]=t.useState(0),[Wt,Bt]=t.useState(!1),qt=t.useRef([]),Vt=t.useRef(Ae),Zt=t.useRef(Ce);Vt.current=Ae,Zt.current=Ce;const Yt=t.useCallback(()=>{var e,t;const n=Vt.current,o=Zt.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=rt.current)||void 0===e?void 0:e.getPoints())&&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,qt.current)||(qt.current=i,o(i))},[]);t.useEffect(()=>{var e;null===(e=rt.current)||void 0===e||e.updateConfig(it),Ie.current=!0,Ye()},[it,Ye]),t.useEffect(()=>{const e=rt.current;e&&(Je&&e.setAreas(Je),k&&e.setPoints(et),w&&e.setLines(tt),Ie.current=!0,Ye())},[Je,k,et,w,tt,Ye]);const Xt=t.useCallback(e=>{var t;null!=e&&"object"==typeof e&&(null===(t=rt.current)||void 0===t||t.pushPoint(e),Ie.current=!0,Ye())},[Ye]),Qt=t.useCallback(e=>{var t;const n=Gt(e);0!==n.length&&(null===(t=rt.current)||void 0===t||t.pushMany(n),Ie.current=!0,Ye())},[Ye]),Kt=t.useCallback(e=>{var t;null!=e&&"object"==typeof e&&(null===(t=rt.current)||void 0===t||t.pushLine(e),Ie.current=!0,Ye())},[Ye]),en=t.useCallback(e=>{var t;const n=Gt(e);0!==n.length&&(null===(t=rt.current)||void 0===t||t.pushManyLines(n),Ie.current=!0,Ye())},[Ye]),gn=t.useCallback(()=>{var e;null===(e=rt.current)||void 0===e||e.clear(),Ie.current=!0,Ye()},[Ye]);t.useImperativeHandle(o,()=>({push:Xt,pushMany:Qt,removePoint:e=>{var t,n;const o=null!==(n=null===(t=rt.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[];return o.length>0&&(Ie.current=!0,Ye()),o},pushLine:Kt,pushManyLines:en,removeLine:e=>{var t,n;const o=null!==(n=null===(t=rt.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==n?n:[];return o.length>0&&(Ie.current=!0,Ye()),o},getLines:()=>{var e,t;return null!==(t=null===(e=rt.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]},clear:gn,getProjection:()=>{var e,t,n;return null!==(n=null===(t=null===(e=rt.current)||void 0===e?void 0:e.scales)||void 0===t?void 0:t.projection)&&void 0!==n?n:null},getGeoPath:()=>{var e,t,n;return null!==(n=null===(t=null===(e=rt.current)||void 0===e?void 0:e.scales)||void 0===t?void 0:t.geoPath)&&void 0!==n?n:null},getCartogramLayout:()=>{var e,t;return null!==(t=null===(e=rt.current)||void 0===e?void 0:e.cartogramLayout)&&void 0!==t?t:null},getZoom:()=>ft.current.k,resetZoom:()=>{const e=Ot.current;e&&ht.current&&u.select(e).call(ht.current.transform,c.zoomIdentity)},getData:()=>{var e,t;return null!==(t=null===(e=rt.current)||void 0===e?void 0:e.getPoints())&&void 0!==t?t:[]}}),[Xt,Qt,Kt,en,gn,Ye]);const{hoverHandlerRef:mn,onPointerMove:vn,onPointerLeave:wn}=$e;t.useEffect(()=>{mn.current=e=>{if(!re)return;const t=rt.current;if(!t||!t.scene.length)return;const n=lt.current;if(!n)return;const o=n.getBoundingClientRect(),i=e.clientX-o.left-Be.left,r=e.clientY-o.top-Be.top;if(0>i||i>_e||0>r||r>Te)return Rt.current=null,Dt.current=null,$t(null),null==ce||ce(null),void Ye();ct.current||(ct.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const s=jn(ct.current);if(!s)return;const l=z(t.scene,i,r,30,s,t.quadtree,t.maxPointRadius);if(l){const e=l.node,t=e.datum,n=Array.isArray(t)?null:(null==t?void 0:t.properties)?t:(null==t?void 0:t.data)||t;let o,s;"point"===e.type?(o=e.x,s=e.y):"geoarea"===e.type?(o=e.centroid[0],s=e.centroid[1]):(o=i,s=r);const a=Object.assign(Object.assign(Object.assign({},n),(null==n?void 0:n.properties)||{}),{data:n,properties:null==n?void 0:n.properties,__semioticHoverData:!0,x:o,y:s});Rt.current=a,Dt.current=e,$t(a),null==ce||ce(a),Ye()}else Rt.current&&(Rt.current=null,Dt.current=null,$t(null),null==ce||ce(null),Ye())}},[re,_e,Te,Be,ce,Ye]),$e.hoverLeaveRef.current=()=>{Rt.current=null,Dt.current=null,$t(null),null==ce||ce(null),Ye()};const Mn=t.useCallback(e=>{if(!ae)return;const t=rt.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-Be.left,i=e.clientY-n.top-Be.top;ct.current||(ct.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const r=jn(ct.current);if(!r)return;const s=z(t.scene,o,i,30,r,t.quadtree,t.maxPointRadius);if(s){const e=s.node.datum,t=Array.isArray(e)?null:(null==e?void 0:e.properties)?e:(null==e?void 0:e.data)||e,n=(null==t?void 0:t.properties)?Object.assign(Object.assign({},t),t.properties):t;ae(Object.assign(Object.assign({},n),{data:t,properties:null==t?void 0:t.properties,__semioticHoverData:!0,x:o,y:i,time:o,value:i}))}},[ae,Be]),On=t.useRef(-1),Sn=t.useRef(null),An=t.useCallback(e=>{const t=rt.current;if(!t||0===t.scene.length)return;const n=function(e){const t=[];for(const n of e)"point"===n.type&&null!=n.x?t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"}):"geoarea"===n.type&&n.centroid&&t.push({x:n.centroid[0],y:n.centroid[1],datum:n.datum,shape:"circle"});return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===n.length)return;const o=On.current,i=function(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"PageDown":return Math.min(t+Math.max(1,Math.floor(.1*n)),n-1);case"PageUp":return Math.max(t-Math.max(1,Math.floor(.1*n)),0);case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}(e.key,0>o?-1:o,n.length);if(null===i)return;if(e.preventDefault(),0>i)return On.current=-1,Sn.current=null,Rt.current=null,Dt.current=null,$t(null),null==ce||ce(null),void Ye();const r=0>o?0:i;On.current=r;const s=n[r];Sn.current={shape:s.shape,w:s.w,h:s.h};const l=s.datum,a=Object.assign(Object.assign(Object.assign({},l||{}),(null==l?void 0:l.properties)||{}),{data:l,properties:null==l?void 0:l.properties,x:s.x,y:s.y,__semioticHoverData:!0});Rt.current=a,$t(a),null==ce||ce(a),Ye()},[ce,Ye]),Cn=t.useCallback(e=>{On.current=-1,Sn.current=null,vn(e)},[vn]);Ze.current=()=>{var e,t,n,o,i,r,s;Ue.current=0;const a=lt.current,c=rt.current;if(!a||!c)return;const u=performance.now();let d=!1;const h=Pt.current;h&&(Pt.current=null,c.applyRotation(h,{width:_e,height:Te}));const f=c.advanceTransition(Ee.current?u+1e6:u),p=!Ee.current&&f;if(Ie.current&&!f){const e={width:_e,height:Te},t=nt?c.getRotation():null;c.computeScene(e);const n=ft.current,o=1!==n.k||0!==n.x||0!==n.y;nt&&t?o?(c.setRotation(t),c.applyZoomScale(n.k,e)):c.applyRotation(t,e):o&&c.applyZoomTransform(n,e),Ie.current=!1,a.setAttribute("aria-label",St(c.scene,"Geographic chart")),Yt()}const g=un();if(T&&ut.current){const t=st.current;if(t&&(null===(e=c.scales)||void 0===e?void 0:e.projection)){const e=cn(t,We,Be,g);if(e){e.clearRect(-Be.left,-Be.top,We[0],We[1]),e.save(),e.beginPath(),e.rect(0,0,_e,Te),e.clip();const t=function(e,t){const{tileURL:n,projection:o,width:i,height:r,tileCache:s,onTileLoad:l}=t,a=o.scale(),c=o.translate(),u=function(e){const{size:t,scale:n,translate:o,clampX:i=!0,clampY:r=!0}=e,s=Math.max(Math.log(n)/Math.LN2-8,0),l=Math.round(s),a=1<<l,c=Math.pow(2,s-l+8),u=o[0]-n/2,d=o[1]-n/2,h=Math.max(i?0:-1/0,Math.floor((0-u)/c)),f=Math.min(i?a:1/0,Math.ceil((t[0]-u)/c)),p=Math.max(r?0:-1/0,Math.floor((0-d)/c)),g=Math.min(r?a:1/0,Math.ceil((t[1]-d)/c)),m=[];for(let e=p;g>e;++e)for(let t=h;f>t;++t)m.push([t,e,l]);return{tiles:m,translate:[u/c,d/c],scale:c}}({size:[i,r],scale:2*a*Math.PI,translate:c}),d=un();let h=!0;for(const t of u.tiles){const[o,i,r]=dn(t),a=`${r}/${o}/${i}`;let c=s.get(a);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:a,lastUsed:performance.now()};s.set(a,t),e.onload=()=>{t.loaded=!0,null==l||l()},e.onerror=()=>{t.loaded=!0},e.src=hn(n,r,o,i,d),c=t}if(!c.loaded){h=!1;continue}const f=u.scale;e.drawImage(c.img,(t[0]+u.translate[0])*f-.5,(t[1]+u.translate[1])*f-.5,f+1,f+1)}return h}(e,{tileURL:T,projection:c.scales.projection,width:_e,height:Te,tileCache:ut.current,onTileLoad:()=>Ye()});e.restore(),t||(d=!0)}}}const m=cn(a,We,Be,g);if(!m)return;if(m.clearRect(-Be.left,-Be.top,We[0],We[1]),K&&!T){const e=Q(m,K);e&&(m.fillStyle=e,m.fillRect(0,0,_e,Te))}m.save(),m.beginPath(),m.rect(0,0,_e,Te),m.clip();const y=c.scene,v={width:_e,height:Te};if(function(e,t){var n,o,i;const r=t.filter(e=>"geoarea"===e.type);for(const t of r){if(!t.pathData)continue;t._cachedPath2D||(t._cachedPath2D=new Path2D(t.pathData));const r=t._cachedPath2D,s=t.style.fill||"#e0e0e0";if("none"!==s&&(e.fillStyle=s,e.globalAlpha=(null!==(n=t._decayOpacity)&&void 0!==n?n:1)*(null!==(o=t.style.fillOpacity)&&void 0!==o?o:1),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=Q(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||.5,e.globalAlpha=null!==(i=t._decayOpacity)&&void 0!==i?i:1,t.style.strokeDasharray){const n=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(n)}else e.setLineDash([]);e.stroke(r)}nn(e,t,r),e.globalAlpha=1,e.setLineDash([])}}(m,y),((e,t,n,o)=>{var i,r;const s=t.filter(e=>"line"===e.type);for(const a of s){if(2>a.path.length)continue;const c=a._introClipFraction;void 0!==c&&1>c&&(e.save(),e.beginPath(),e.rect(0,0,o.width*c,o.height),e.clip());const u=a.style.stroke||"#007bff",d=Q(e,u)||u,h=a.style.strokeWidth||2,f=a.colorThresholds,p=a.rawValues;if(e.setLineDash(a.style.strokeDasharray?a.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=a.style.opacity&&(e.globalAlpha=a.style.opacity),e.lineWidth=h,e.lineCap=a.style.strokeLinecap||"butt",a.style._edgeFade){const v=null!==(i=a.style.opacity)&&void 0!==i?i:1;an(e,a.path,d,h,v,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const g=on(a.curve),m=f&&f.length>0&&p&&p.length===a.path.length,y=a._decayOpacities;if(y&&y.length===a.path.length&&!m){e.strokeStyle=d;const b=null!==(r=a.style.opacity)&&void 0!==r?r:1;for(let x=0;a.path.length-1>x;x++)e.globalAlpha=.5*(y[x]+y[x+1])*b,e.beginPath(),e.moveTo(a.path[x][0],a.path[x][1]),e.lineTo(a.path[x+1][0],a.path[x+1][1]),e.stroke()}else if(m){let j=null,k=null,w=null,M=null,O=!1;function S(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),O=!0}function A(){O&&(e.stroke(),O=!1)}for(let C=0;a.path.length>C;C++){const[P,L]=a.path[C],z=p[C],R=ln(z,f,d);if(null!==j&&null!==M&&null!==w){if(R===M)e.lineTo(P,L);else{const D=[];for(const I of f){const $=I.value;(w>$||$>z)&&($>w||z>$)||w===$||z===$||D.push({t:($-w)/(z-w)})}D.sort((e,t)=>e.t-t.t);for(const E of D){const N=j+(P-j)*E.t,W=k+(L-k)*E.t,B=ln(w+(z-w)*Math.min(E.t+1e-4,1),f,d);e.lineTo(N,W),A(),S(B,N,W)}e.lineTo(P,L)}j=P,k=L,w=z,M=R}else S(R,P,L),j=P,k=L,w=z,M=R}A()}else{e.beginPath();const _=a.strokeGradient&&a.path.length>=2?sn(e,a.strokeGradient,a.path[0][0],0,a.path[a.path.length-1][0],0):null;if(e.strokeStyle=_||d,g)l.line().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(a.path);else{const[T,F]=a.path[0];e.moveTo(T,F);for(let H=1;a.path.length>H;H++)e.lineTo(a.path[H][0],a.path[H][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=rn(e,a.style.fill,a.style.fill),g&&!m)l.line().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(a.path);else{const[G,V]=a.path[0];e.moveTo(G,V);for(let U=1;a.path.length>U;U++)e.lineTo(a.path[U][0],a.path[U][1])}const q=a.path[0][0];e.lineTo(a.path[a.path.length-1][0],o.height),e.lineTo(q,o.height),e.closePath(),e.fill()}void 0!==c&&1>c&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(m,y,0,v),((e,t)=>{var n;const o=t.filter(e=>"point"===e.type);if(0!==o.length){e.save();try{for(const t of o){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(n=t.style.opacity)&&void 0!==n?n:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=rn(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=rn(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),tn(e,t),e.globalAlpha=1}}finally{e.restore()}}})(m,y),B&&Lt.current){const e=Lt.current,l=y.filter(e=>"line"===e.type);if(l.length>0){const a=_||{},c=.3*(null!==(t=a.speedMultiplier)&&void 0!==t?t:1),h=null!==(n=a.maxPerLine)&&void 0!==n?n:30,f=null!==(o=a.spawnRate)&&void 0!==o?o:.15,p=null!==(i=a.radius)&&void 0!==i?i:2,g=null!==(r=a.opacity)&&void 0!==r?r:.7,y=u/1e3,v=zt.current>0?Math.min(y-zt.current,.1):.016;zt.current=y;const b=l.map(e=>e.path),x=l.map(e=>e.style.strokeWidth||2);for(let t=0;l.length>t;t++)Math.random()<f&&e.countForLine(t)<h&&e.spawn(t);e.step(v,c,b,x),m.globalAlpha=g;for(let t=0;e.particles.length>t;t++){const n=e.particles[t];if(!n.active)continue;const o=l[n.lineIndex],i="function"==typeof a.color?a.color(null!==(s=null==o?void 0:o.datum)&&void 0!==s?s:{}):"source"!==a.color&&a.color?a.color:(null==o?void 0:o.style.stroke)||"#fff";m.beginPath(),m.arc(n.x,n.y,p,0,2*Math.PI),m.fillStyle=i,m.fill()}m.globalAlpha=1,d=!0}}m.restore();const b=at.current;if(b){const e=cn(b,We,Be,g);if(e){e.clearRect(-Be.left,-Be.top,We[0],We[1]);const t=Dt.current;if(t&&"geoarea"===t.type){const n=new Path2D(t.pathData);e.fillStyle="rgba(255, 255, 255, 0.3)",e.fill(n),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke(n)}if(t&&"point"===t.type){const n=t,o="object"==typeof se?se:void 0,i=(null==o?void 0:o.pointColor)||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(t);e.beginPath(),e.arc(n.x,n.y,n.r+3,0,2*Math.PI),i?(e.save(),e.globalAlpha=.4,e.fillStyle=i,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=i||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}}const x=ue!==dt.current;x&&(dt.current=ue),(Ie.current||x)&&Nt(e=>e+1),(p||null!=c.activeTransition||c.hasActivePulses||d)&&(Ue.current=requestAnimationFrame(()=>Ze.current()))},function(e){const{hydrated:n,wasHydratingFromSSR:o,storeRef:i,dirtyRef:r,renderFnRef:s,cleanup:l}=e;yt(()=>{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 a=t.useRef(l);a.current=l,t.useEffect(()=>()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.call(a)},[])}({hydrated:Qe,wasHydratingFromSSR:Ke,storeRef:rt,dirtyRef:Ie,renderFnRef:Ze,cleanup:()=>{var e;return null===(e=ut.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{Ie.current=!0,Ye()},[_e,Te,K,Ye]),function(e,n,o,i,r,s){t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{var t;const l=n.current;if(!l||0===l.lastIngestTime)return;const a="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=a-l.lastIngestTime>c;u!==r&&(s(u),o.current=!0,i())},1e3);return()=>clearInterval(t)},[e,r,i])}(me,rt,Ie,Ye,Wt,Bt),t.useEffect(()=>{if("production"!==process.env.NODE_ENV&&T){const e=xn(y);e&&"mercator"!==e&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${e}". Raster tiles use Web Mercator and will not align with other projections.`)}},[T,y]),t.useEffect(()=>{const e=Ot.current;if(!I||!e)return ht.current&&e&&(u.select(e).on(".zoom",null),ht.current=null),void(e&&u.select(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=E||[1,8],o={width:_e,height:Te};if(nt){let i=ft.current.k;const r=e=>{var r;i=Math.max(t,Math.min(n,e)),ft.current=c.zoomIdentity.scale(i);const s=rt.current;s&&(s.applyZoomScale(i,o),Ie.current=!1,Ye(),(null===(r=s.scales)||void 0===r?void 0:r.projection)&&(null==N||N({projection:s.scales.projection,zoom:s.currentZoom})))};ht.current={scaleBy:(e,t)=>r(i*t),transform:(e,t)=>{var n;return r(null!==(n=null==t?void 0:t.k)&&void 0!==n?n:1)}};const s=e=>{e.preventDefault(),r(i*(0>e.deltaY?1.1:1/1.1))},l=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),r(1.5*i))};e.addEventListener("wheel",s,{passive:!1}),e.addEventListener("dblclick",l);const a=.4,u=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const o=rt.current;if(!o)return;const i=o.getRotation();Ct.current={x:t.clientX,y:t.clientY,rotation:[...i]},e.setPointerCapture(t.pointerId),t.preventDefault()},d=e=>{const t=Ct.current;t&&(Pt.current=[t.rotation[0]+(e.clientX-t.x)*a,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*a)),t.rotation[2]],Ye())},h=t=>{var n;if(!Ct.current)return;Ct.current=null,e.releasePointerCapture(t.pointerId);const i=Pt.current;if(i){Pt.current=null;const e=rt.current;e&&(e.applyRotation(i,o),Ye())}const r=rt.current;(null===(n=null==r?void 0:r.scales)||void 0===n?void 0:n.projection)&&(null==N||N({projection:r.scales.projection,zoom:r.currentZoom}))};return e.addEventListener("pointerdown",u),e.addEventListener("pointermove",d),e.addEventListener("pointerup",h),e.addEventListener("pointercancel",h),()=>{e.removeEventListener("wheel",s),e.removeEventListener("dblclick",l),e.removeEventListener("pointerdown",u),e.removeEventListener("pointermove",d),e.removeEventListener("pointerup",h),e.removeEventListener("pointercancel",h),ht.current=null}}const i=c.zoom().scaleExtent([t,n]).extent([[0,0],[We[0],We[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;ft.current=t,Mt.current=!0;const n=rt.current;n&&(n.applyZoomTransform(t,o),Ie.current=!1,Ye())}).on("end",e=>{var t;ft.current=e.transform,Mt.current=!1;const n=rt.current;(null===(t=null==n?void 0:n.scales)||void 0===t?void 0:t.projection)&&(null==N||N({projection:n.scales.projection,zoom:n.currentZoom}))});return ht.current=i,u.select(e).call(i),()=>{u.select(e).on(".zoom",null)}},[I,E,nt,We,_e,Te,Be,N,Ye]);const Pn=re&&!1!==se,Ln=Pn&&It?le?le(It):e.jsx(kn,{data:It}):null,zn=Ln?e.jsx(Jt,{x:It.x,y:It.y,containerWidth:_e,containerHeight:Te,margin:Be,className:"stream-frame-tooltip",zIndex:10,children:Ln}):null;if(mt||!Qe&&Ke){const t=rt.current;t&&(Je||k||w)&&(Je&&t.setAreas(Je),k&&t.setPoints(et),w&&t.setLines(tt),t.computeScene({width:_e,height:Te}));const n=null!==(r=null==t?void 0:t.scene)&&void 0!==r?r:[];return e.jsxs("div",{ref:At,className:"stream-geo-frame"+(X?" "+X:""),role:"img","aria-label":ze||("string"==typeof be?be:"Geographic chart"),style:{position:"relative",width:U?"100%":We[0],height:Z?"100%":We[1]},children:[e.jsx(Tt,{summary:Re}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:We[0],height:We[1],style:{position:"absolute",left:0,top:0},children:[e.jsx("g",{transform:`translate(${Be.left},${Be.top})`,children:He}),e.jsxs("g",{transform:`translate(${Be.left},${Be.top})`,children:[K&&e.jsx("rect",{x:0,y:0,width:_e,height:Te,fill:K}),n.map((t,n)=>function(t,n){var o,i,r,s,l,a;switch(t.type){case"geoarea":{const r=t;return r.pathData?e.jsx("path",{d:r.pathData,fill:gt(r.style.fill,"#e0e0e0"),fillOpacity:null!==(o=r.style.fillOpacity)&&void 0!==o?o:1,stroke:r.style.stroke||"none",strokeWidth:r.style.strokeWidth||.5,strokeDasharray:r.style.strokeDasharray,opacity:null!==(i=r._decayOpacity)&&void 0!==i?i:1},"geoarea-"+n):null}case"point":{const o=t;return e.jsx("circle",{cx:o.x,cy:o.y,r:o.r,fill:gt(o.style.fill),fillOpacity:null!==(r=o.style.fillOpacity)&&void 0!==r?r:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:null!==(s=o._decayOpacity)&&void 0!==s?s:null!==(l=o.style.opacity)&&void 0!==l?l:1},"point-"+n)}case"line":{const o=t;if(2>o.path.length)return null;const i="M"+o.path.map(e=>`${e[0]},${e[1]}`).join("L");return e.jsx("path",{d:i,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||1.5,strokeDasharray:o.style.strokeDasharray,opacity:null!==(a=o.style.opacity)&&void 0!==a?a:1},"line-"+n)}default:return null}}(t,n))]})]}),e.jsx(pt,{width:_e,height:Te,totalWidth:We[0],totalHeight:We[1],margin:Be,scales:null,showAxes:!1,title:be,legend:xe,legendPosition:je,legendLayout:ke,legendHoverBehavior:we,legendClickBehavior:Me,legendHighlightedCategory:Oe,legendIsolatedCategories:Se,foregroundGraphics:Fe,annotations:ue,autoPlaceAnnotations:de,annotationFrame:0,xValues:[],yValues:[],pointNodes:n.filter(e=>"point"===e.type)})]})}return e.jsxs("div",{ref:At,className:"stream-geo-frame"+(X?" "+X:""),role:"group","aria-label":ze||("string"==typeof be?be:"Geographic chart"),tabIndex:0,style:Object.assign({position:"relative",width:U?"100%":We[0],height:Z?"100%":We[1],overflow:"hidden"},I?{touchAction:"none"}:{}),onKeyDown:An,children:[Le&&e.jsx(Ft,{tableId:Ve}),Le&&e.jsx(_t,{scene:null!==(a=null===(s=rt.current)||void 0===s?void 0:s.scene)&&void 0!==a?a:[],chartType:"Geographic chart",tableId:Ve,chartTitle:"string"==typeof be?be:void 0}),e.jsx(Tt,{summary:Re}),e.jsx(Ht,{hoverPoint:It}),e.jsxs("div",{role:"img","aria-label":ze||("string"==typeof be?be:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Pn?Cn:void 0,onMouseLeave:Pn?wn:void 0,onClick:ae?Mn:void 0,children:[He&&e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:We[0],height:We[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${Be.left},${Be.top})`,children:He})}),T&&e.jsx("canvas",{ref:st,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx("canvas",{ref:lt,"aria-label":St(null!==(h=null===(d=rt.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),e.jsx("canvas",{ref:at,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx(pt,{width:_e,height:Te,totalWidth:We[0],totalHeight:We[1],margin:Be,scales:null,showAxes:null!=Pe&&Pe,title:be,legend:xe,legendPosition:je,legendLayout:ke,legendHoverBehavior:we,legendClickBehavior:Me,legendHighlightedCategory:Oe,legendIsolatedCategories:Se,foregroundGraphics:Fe,annotations:ue,autoPlaceAnnotations:de,annotationFrame:Et,xValues:[],yValues:[],pointNodes:null===(f=rt.current)||void 0===f?void 0:f.scene.filter(e=>"point"===e.type)}),(null==me?void 0:me.showBadge)&&e.jsx(te,{isStale:Wt,position:me.badgePosition}),I&&e.jsxs("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Be.bottom+8,left:Be.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[e.jsx("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=Ot.current,n=ht.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(u.select(t),1.5)},style:bn,children:"+"}),e.jsx("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=Ot.current,n=ht.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(u.select(t),1/1.5)},style:bn,children:"−"})]}),F&&e.jsx("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Be.bottom+2,right:Be.right+4,fontSize:10,color:"rgba(0,0,0,0.6)",background:"rgba(255,255,255,0.7)",padding:"1px 4px",borderRadius:2,pointerEvents:"none",zIndex:2},children:F}),e.jsx(Ut,{active:On.current>=0,hoverPoint:It,margin:Be,size:We,shape:null===(p=Sn.current)||void 0===p?void 0:p.shape,width:null===(g=Sn.current)||void 0===g?void 0:g.w,height:null===(m=Sn.current)||void 0===m?void 0:m.h}),zn]})]})});function Mn(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function On(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function Sn(e){const t=e.map(Mn),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return On(e,n,o)}if(e>=1){const[e,o,i]=t[n];return On(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[s,l,a]=t[i],[c,u,d]=t[i+1];return On(Math.round(s+(c-s)*r),Math.round(l+(u-l)*r),Math.round(a+(d-a)*r))}}wn.displayName="StreamGeoFrame";const An=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Cn=Sn(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Pn=Sn(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Ln=Sn(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),zn=Sn(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),Rn=Sn(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Dn=Sn(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),In=Sn(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),$n=Sn(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),En=Sn(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Nn=Sn(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Wn=Sn(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Bn=Sn(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]);Sn(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),Sn(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),Sn(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),Sn(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),Sn(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),Sn(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),Sn(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);const _n={category10:An,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:Cn,reds:Pn,greens:Ln,oranges:zn,purples:Rn,viridis:In,plasma:$n},Tn=An,Fn=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Hn=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 qn(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")||Hn.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):Tn[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))%Tn.length]}function Gn(e,t,n="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(n))return o.scaleOrdinal().domain(i).range(n).unknown("#999");const s=_n[n]||_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:Tn;return o.scaleOrdinal().domain(i).range(e).unknown("#999")}}function Vn(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,[l,a]=n;if(s===r)return(l+a)/2;let c=(i-r)/(s-r);return 0>c?c=0:c>1&&(c=1),l+c*(a-l)}const Un=t.createContext(null);function Zn(){return t.useContext(Un)}function Yn(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 Xn(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Qn,Kn]=D(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),i=Xn(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=Xn(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}})}})),[Jn,eo]=D(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function to(e){const n=t.useId(),o=e.clientId||n,{name:i}=e,r=Kn(e=>e.selections.get(i)),s=Kn(e=>e.setClause),l=Kn(e=>e.clearClause),a=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(Yn(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:a,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(()=>{l(i,o)},[l,i,o]),clientId:o}}function no(e){const n=e.name||"hover",{fields:o}=e,{predicate:i,isActive:r,selectPoints:s,clear:l}=to({name:n});return{onHover:t.useCallback(e=>{if(!e)return void l();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&s(t)},[o,s,l,n]),predicate:i,isActive:r}}const oo=t.createContext(!1),io=t.createContext(null),ro="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function so(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}function lo(e,t,n){return t?(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}function ao(){return H(e=>e.theme)}f.createContext(void 0);const co="#007bff";function uo(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 ho(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 fo(){var e;const t=ao(),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 po({selection:e,linkedHover:n,fallbackFields:o=[],unwrapData:i=!1,onObservation:r,chartType:s,chartId:l,onClick:a,hoverHighlight:c,colorByField:u}){const d=t.useId(),h=so(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||[],p=to({name:(null==e?void 0:e.name)||"__unused__"}),g=no({name:(null==h?void 0:h.name)||"hover",fields:f}),m=eo(e=>e.pushObservation),y=e?{isActive:p.isActive,predicate:p.predicate}:null,[v,b]=t.useState(null),x=u||o[0],j=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=uo(e,t,h.xField);null!=n&&function(e,t,n){const o=Xe.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(Xe={positions:new Map(Xe.positions).set(e,{xValue:t,sourceId:n})},Ke())}(h.name||"hover",n,d)}"x-position"!==(null==h?void 0:h.mode)&&g.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&Je(h.name||"hover",d),"x-position"!==(null==h?void 0:h.mode)&&g.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||m){const n={timestamp:Date.now(),chartType:s||"unknown",chartId:l};if(e){const i=ho(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),m&&m(s)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});r&&r(e),m&&m(e)}}},[n,g,h,d,r,s,l,m,c,x]),w=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=uo(e,t,h.xField);null!=n&&function(e,t,n){const o=Xe.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(Xe.positions);return t.delete(e),Xe={positions:t},Ke(),!1}Xe={positions:new Map(Xe.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Ke()}(h.name||"hover",n,d)}if(e&&a){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),a(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(r||m){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:l};if(e){const n=ho(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),m&&m(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});r&&r(e),m&&m(e)}}},[a,r,m,s,l,h,d]);return t.useEffect(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{et(e,d),Je(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:y,hoverSelectionHook:j,customHoverBehavior:k,customClickBehavior:w,crosshairSourceId:d}}function go({data:e,colorBy:n,colorScale:o,showLegend:i,legendPosition:r="right",userMargin:s,defaults:l={top:50,bottom:60,left:70,right:40},categories:a}){const c=t.useContext(oo),u=null!==t.useContext(io),d=void 0!==i?i:!c&&!!n,h=!!n&&(d||u),f=t.useMemo(()=>{if(!h)return[];if(void 0!==a)return a;const t=new Set;for(const o of e){const e="function"==typeof n?n(o):o[n];null!=e&&t.add(e+"")}return Array.from(t)},[a,n,e,h]);!function(e){const n=t.useContext(io),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;ro(()=>{if(n)return()=>n.unregisterCategories(o)},[n,o]),ro(()=>{n&&n.registerCategories(o,s)},[n,o,s])}(u&&n?f:[]);const p=t.useMemo(()=>{if(!d||!n)return;const t=function({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),l=s?o(s,t,n):n?n(i):Fn[r%Fn.length];return{label:i+"",color:l}}),label:""}]}}({data:e,colorBy:n,colorScale:o,getColor:qn,categories:f});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[d,n,e,o,f]),g=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:l[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return p&&("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},[l,s,p,r]);return{legend:p,margin:g,legendPosition:r}}const mo={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 yo(e,t,n){var o,i,r,s,l,a,c;const u=mo[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:u.width,height:null!==(i=t.height)&&void 0!==i?i:u.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!==(l=t.enableHover)&&void 0!==l?l:!!t.linkedHover||u.enableHover,showLegend:null!==(a=t.showLegend)&&void 0!==a?a:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:vo(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function vo(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 bo(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 xo({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 jo extends f.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(xo,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var ko;const wo="undefined"!=typeof process&&"production"!==(null===(ko=process.env)||void 0===ko?void 0:ko.NODE_ENV);function Mo({componentName:t,width:n,height:o,children:i}){return e.jsx(jo,{fallback:i=>e.jsx(xo,{componentName:t,message:i.message,width:n,height:o}),children:i})}const Oo={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"},So={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Ao(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({},Oo),{width:n,height:o}),children:i||"No data available"}):null}function Co(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))),l=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(s+l)-l))/2);return e.jsx("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,o)=>e.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},So),{position:"absolute",top:a+o*(s+l),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:s,opacity:.5+o%2*.2})},o))})}function Po(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 Lo(e){const n=H(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,o;if(void 0!==e||void 0!==n)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:n})},[e,n])}function zo(e,t,n,o){return new(n||(n=Promise))(function(i,r){function s(e){try{a(o.next(e))}catch(e){r(e)}}function l(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,l)}a((o=o.apply(e,t||[])).next())})}function Ro(e){return e}function Do(e,t){var n=t.id,o=t.bbox,i=null==t.properties?{}:t.properties,r=function(e,t){var n=function(e){if(null==e)return Ro;var t,n,o=e.scale[0],i=e.scale[1],r=e.translate[0],s=e.translate[1];return function(e,l){l||(t=n=0);var a=2,c=e.length,u=Array(c);for(u[0]=(t+=e[0])*o+r,u[1]=(n+=e[1])*i+s;c>a;)u[a]=e[a],++a;return u}}(e.transform),o=e.arcs;function i(e,t){t.length&&t.pop();for(var i=o[0>e?~e:e],r=0,s=i.length;s>r;++r)t.push(n(i[r],r));0>e&&function(e,t){for(var n,o=e.length,i=o-t;i<--o;)n=e[i],e[i++]=e[o],e[o]=n}(t,s)}function r(e){return n(e)}function s(e){for(var t=[],n=0,o=e.length;o>n;++n)i(e[n],t);return 2>t.length&&t.push(t[0]),t}function l(e){for(var t=s(e);4>t.length;)t.push(t[0]);return t}function a(e){return e.map(l)}return function e(t){var n,o=t.type;switch(o){case"GeometryCollection":return{type:o,geometries:t.geometries.map(e)};case"Point":n=r(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(r);break;case"LineString":n=s(t.arcs);break;case"MultiLineString":n=t.arcs.map(s);break;case"Polygon":n=a(t.arcs);break;case"MultiPolygon":n=t.arcs.map(a);break;default:return null}return{type:o,coordinates:n}}(t)}(e,t);return null==n&&null==o?{type:"Feature",properties:i,geometry:r}:null==o?{type:"Feature",id:n,properties:i,geometry:r}:{type:"Feature",id:n,bbox:o,properties:i,geometry:r}}"function"==typeof SuppressedError&&SuppressedError;const Io=new Map;function $o(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function Eo(e){return zo(this,void 0,void 0,function*(){const t=Io.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return zo(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:$o(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:$o(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:$o(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:$o(yield import("world-atlas/land-50m.json")),objectName:"land"};default:throw Error(`Unknown reference geography: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}})}(e);if(!n||!n.objects)throw Error(`resolveReferenceGeography("${e}"): Failed to load topology. Got ${typeof n} with keys: ${n?Object.keys(n).join(", "):"none"}`);const i=function(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return Do(e,t)})}:Do(e,t)}(n,n.objects[o]),r="features"in i?i.features:[i];return Io.set(e,r),r})}function No(e){const n=t.useMemo(()=>Array.isArray(e)?e:void 0,[e]),[o,i]=t.useState(null);return t.useEffect(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return i(null),Eo(e).then(e=>{t||i(e)}),()=>{t=!0}}var t;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),i(null)}else i(null)},[e]),void 0!==n?n:o}const Wo={blues:Cn,reds:Pn,greens:Ln,viridis:In,oranges:zn,purples:Rn,greys:Dn,plasma:$n,inferno:En,magma:Nn,cividis:Wn,turbo:Bn};function Bo(n){var i;const s=yo(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),l=function(){var e;const t=ao();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),{areas:a,valueAccessor:c,colorScheme:u,projection:d="equalEarth",graticule:h,fitPadding:f,zoomable:p,zoomExtent:g,onZoom:m,dragRotate:y,tileURL:v,tileAttribution:b,tileCacheSize:x,tooltip:j,areaOpacity:k=1,annotations:w,margin:M,className:O,selection:S,linkedHover:A,onObservation:C,onClick:P,chartId:L,loading:z,loadingContent:R,emptyContent:D,frameProps:I={},stroke:$,strokeWidth:E,opacity:N}=n,W=null!=p?p:!!v,B=No(a),_=t.useMemo(()=>B?Gt(B):B,[B]),T=t.useMemo(()=>"function"==typeof c?c:e=>{var t,n;return null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t[c])&&void 0!==n?n:null==e?void 0:e[c]},[c]),F=null!==(i=null!=u?u:l)&&void 0!==i?i:"blues",H=t.useMemo(()=>{if(!_)return o.scaleSequential(Cn).domain([0,1]);const e=_.map(e=>T(e)).filter(e=>null!=e&&isFinite(e)),[t,n]=r.extent(e);return o.scaleSequential(Wo[F]||Cn).domain([null!=t?t:0,null!=n?n:1])},[_,T,F]),{activeSelectionHook:q,customHoverBehavior:G,customClickBehavior:V}=po({selection:S,linkedHover:A,onObservation:C,onClick:P,chartType:"ChoroplethMap",chartId:L}),U=Lo(S),Z=t.useMemo(()=>{const e=bo(e=>{const t=T(e);return{fill:null!=t&&isFinite(t)?H(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:k}},{stroke:$,strokeWidth:E,opacity:N});return q?lo(e,q,U):e},[T,H,q,U,k,$,E,N]),Y=t.useMemo(()=>t=>{var n,o;const i=(null===(n=null==t?void 0:t.properties)||void 0===n?void 0:n.name)||(null===(o=null==t?void 0:t.properties)||void 0===o?void 0:o.NAME)||(null==t?void 0:t.name)||(null==t?void 0:t.NAME)||"Feature",r=T(t);return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e.jsx("div",{style:{fontWeight:600},children:i}),null!=r&&e.jsx("div",{style:{opacity:.7},children:(s=r,"number"==typeof s&&isFinite(s)?Number.isInteger(s)?s.toLocaleString():s.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=s?s:"")+"")})]});var s},[T]),X=t.useMemo(()=>Object.assign({top:10,right:10,bottom:10,left:10},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}(M)),[M]),Q=Co(z,s.width,s.height,R)||(_?null:Co(!0,s.width,s.height,R)),K=Q?null:Ao(_,s.width,s.height,D);if(Array.isArray(_)&&_.length>0){const t=_[0];if(!t||"object"!=typeof t||!t.geometry)return e.jsx(xo,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:s.width,height:s.height})}const J=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({projection:d,areas:_,areaStyle:Z,size:[s.width,s.height],margin:X,enableHover:!0,tooltipContent:!1===j?()=>null:!0===j?Y:Kt(j)||Y},null!=h&&{graticule:h}),null!=f&&{fitPadding:f}),W&&{zoomable:!0}),g&&{zoomExtent:g}),m&&{onZoom:m}),null!=y&&{dragRotate:y}),v&&{tileURL:v}),b&&{tileAttribution:b}),x&&{tileCacheSize:x}),(A||C||P)&&{customHoverBehavior:G}),(C||P)&&{customClickBehavior:V}),w&&w.length>0&&{annotations:w}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),s.title&&{title:s.title}),s.description&&{description:s.description}),s.summary&&{summary:s.summary}),void 0!==s.accessibleTable&&{accessibleTable:s.accessibleTable}),O&&{className:O}),null!=n.animate&&{animate:n.animate}),I);return Q||K||e.jsx(Mo,{componentName:"ChoroplethMap",width:s.width,height:s.height,children:e.jsx(wn,Object.assign({},J))})}function _o(e){const{data:n,rawData:o,colorBy:i,colorScheme:r,legendInteraction:s,legendPosition:l,selection:a,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:f,chartId:p,showLegend:g,userMargin:m,marginDefaults:y,onClick:v,hoverHighlight:b,loading:x,loadingContent:j,emptyContent:k,width:w,height:M}=e,O=void 0===o,S=t.useMemo(()=>Gt(n),[n]),[A,C]=t.useState([]),P=t.useCallback(e=>{C(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),L="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:z,hoverSelectionHook:R,customHoverBehavior:D,customClickBehavior:I,crosshairSourceId:$}=po({selection:a,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:f,chartId:p,onClick:v,hoverHighlight:b,colorByField:L}),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}}(c,$),N=function(e,n,o){const i=Zn(),r=fo();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=Gn(t.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return Gn(t.map(e=>({_cat:e})),"_cat",s)}if(i&&Object.keys(i).length>0){const t=Gn(e,n,s);return e=>i[e]||t(e)}return Gn(e,n,s)}if(i&&Object.keys(i).length>0){const e=Gn([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,n,o,i,r])}(S,i,r),W=t.useMemo(()=>{if(!i)return[];const e=new Set;for(const t of S){const n="function"==typeof i?i(t):t[i];null!=n&&e.add(n+"")}return Array.from(e)},[S,i]),B=t.useMemo(()=>O&&A.length>0?A:W,[O,A,W]),_=function(e,n,o){const[i,r]=t.useState(null),[s,l]=t.useState(new Set),a=t.useCallback(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=t.useCallback(t=>{"isolate"===e&&l(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),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:a,onLegendClick:c,legendSelectionHook:u}}(s,i,B),T=t.useMemo(()=>R||(_.legendSelectionHook?_.legendSelectionHook:z),[R,_.legendSelectionHook,z]),F=Lo(a),H=fo(),q=Zn(),G=t.useMemo(()=>{if(N)return N;if(!i||0===B.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:H&&H.length>0?H:Fn,t="__streamCat",n=Gn(B.map(e=>({[t]:e})),t,e);return e=>(null==q?void 0:q[e])||n(e)||"#999"},[N,i,B,r,H,q]),{legend:V,margin:U,legendPosition:Z}=go({data:S,colorBy:i,colorScale:G,showLegend:g,legendPosition:l,userMargin:m,defaults:y,categories:B}),Y=t.useMemo(()=>{const e={};return V&&(e.legend=V,e.legendPosition=Z),s&&"none"!==s&&(e.legendHoverBehavior=_.onLegendHover,e.legendClickBehavior=_.onLegendClick,e.legendHighlightedCategory=_.highlightedCategory,e.legendIsolatedCategories=_.isolatedCategories),O&&i&&(e.legendCategoryAccessor=i,e.onCategoriesChange=P),e},[V,Z,s,_.onLegendHover,_.onLegendClick,_.highlightedCategory,_.isolatedCategories,O,i,P]),X=Array.isArray(o)?Gt(o):o,Q=Co(x,w,M,j),K=Q?null:Ao(X,w,M,k);return{data:S,colorScale:N,allCategories:B,legendState:_,effectiveSelectionHook:T,activeSelectionHook:z,customHoverBehavior:D,customClickBehavior:I,legend:V,margin:U,legendPosition:Z,earlyReturn:Q||K||null,legendBehaviorProps:Y,crosshairProps:E,resolvedSelection:F}}function To(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 l=Array.isArray(t)?t:[t],a=null!==(i=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==i?i:[],c=[];for(const t of l){const n=a.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(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:[])}Bo.displayName="ChoroplethMap";const Fo=t.forwardRef(function(n,o){const i=t.useRef(null);To(o,{variant:"geo-points",frameRef:i});const r=yo(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:s,xAccessor:l="lon",yAccessor:a="lat",sizeBy:c,sizeRange:u=[3,30],colorBy:d,colorScheme:h,projection:f="equalEarth",graticule:p,fitPadding:g,zoomable:m,zoomExtent:y,onZoom:v,dragRotate:b,tileURL:x,tileAttribution:j,tileCacheSize:k,areas:w,areaStyle:M={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:O,annotations:S,margin:A,className:C,selection:P,linkedHover:L,onObservation:z,onClick:R,chartId:D,loading:I,loadingContent:$,emptyContent:E,legendInteraction:N,legendPosition:W,frameProps:B={},stroke:_,strokeWidth:T,opacity:F}=n,H=null!=m?m:!!x,q=No(w),G=_o({data:null!=s?s:qt,rawData:s,colorBy:d,colorScheme:h,legendInteraction:N,legendPosition:W,selection:P,linkedHover:L,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!1,onObservation:z,onClick:R,chartType:"ProportionalSymbolMap",chartId:D,showLegend:r.showLegend,userMargin:A,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:I,loadingContent:$,emptyContent:E,width:r.width,height:r.height}),V=G.data,U=t.useMemo(()=>{if(!c)return;const e="function"==typeof c?c:e=>null==e?void 0:e[c],t=V.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?[Math.min(...t),Math.max(...t)]:void 0},[V,c]),Z=t.useMemo(()=>{const e=bo(e=>({fill:d?qn(e,d,G.colorScale):co,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:c?Vn(e,c,u,U):6}),{stroke:_,strokeWidth:T,opacity:F});return G.effectiveSelectionHook?lo(e,G.effectiveSelectionHook,G.resolvedSelection):e},[d,G.colorScale,G.effectiveSelectionHook,G.resolvedSelection,c,u,U,_,T,F]),Y=t.useMemo(()=>t=>{const n=(null==t?void 0:t.name)||(null==t?void 0:t.label)||(null==t?void 0:t.NAME)||(null==t?void 0:t.id),o="string"==typeof c?c:null,i=("function"==typeof c?c:e=>e[c])(t),r=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=e?e:"")+"",s="string"==typeof d?d:null,l=s?null==t?void 0:t[s]:null;return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[n&&e.jsx("div",{style:{fontWeight:600,marginBottom:2},children:n}),o&&null!=i&&e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[o,": "]}),r(i)]}),s&&null!=l&&e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[s,": "]}),l+""]}),!n&&!o&&Object.entries(t).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,": "]}),r(n)]},t))]})},[c,d]);if(G.earlyReturn)return G.earlyReturn;Po("ProportionalSymbolMap",V,"xAccessor",l),Po("ProportionalSymbolMap",V,"yAccessor",a);const X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:f},null!=s&&{points:V}),{xAccessor:l,yAccessor:a,pointStyle:Z}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),q&&{areas:q,areaStyle:M}),null!=p&&{graticule:p}),null!=g&&{fitPadding:g}),H&&{zoomable:!0}),y&&{zoomExtent:y}),v&&{onZoom:v}),null!=b&&{dragRotate:b}),x&&{tileURL:x}),j&&{tileAttribution:j}),k&&{tileCacheSize:k}),{size:[r.width,r.height],margin:G.margin,enableHover:!0,tooltipContent:!1===O?()=>null:Kt(O)||Y}),G.legendBehaviorProps),(L||z||R)&&{customHoverBehavior:G.customHoverBehavior}),(z||R)&&{customClickBehavior:G.customClickBehavior}),S&&S.length>0&&{annotations:S}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),C&&{className:C}),null!=n.animate&&{animate:n.animate}),B);return e.jsx(Mo,{componentName:"ProportionalSymbolMap",width:r.width,height:r.height,children:e.jsx(wn,Object.assign({ref:i},X))})});Fo.displayName="ProportionalSymbolMap";const Ho="__semiotic_x",qo="__semiotic_y",Go=t.forwardRef(function(n,i){const r=yo(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{flows:s,nodes:l,nodeIdAccessor:a="id",xAccessor:c="lon",yAccessor:u="lat",valueAccessor:d="value",projection:h="equalEarth",graticule:f,fitPadding:p,zoomable:g,zoomExtent:m,onZoom:y,dragRotate:v,tileURL:b,tileAttribution:x,tileCacheSize:j,lineType:k="geo",flowStyle:w="basic",areas:M,areaStyle:O={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:S,edgeOpacity:A=.6,edgeWidthRange:C=[1,8],edgeLinecap:P="round",colorScheme:L,showParticles:z,particleStyle:R,tooltip:D,annotations:I,margin:$,className:E,selection:N,linkedHover:W,onObservation:B,onClick:_,chartId:T,loading:F,loadingContent:H,emptyContent:q,frameProps:G={},legendInteraction:V,legendPosition:U,stroke:Z,strokeWidth:Y,opacity:X,lineIdAccessor:Q}=n,K=null!=g?g:!!b,J=No(M),ee=t.useMemo(()=>Gt(l),[l]),te=_o({data:null!=s?s:qt,rawData:s,colorBy:S,colorScheme:L,legendInteraction:V,legendPosition:U,selection:N,linkedHover:W,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:B,onClick:_,chartType:"FlowMap",chartId:T,showLegend:r.showLegend,userMargin:$,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:F,loadingContent:H,emptyContent:q,width:r.width,height:r.height}),ne=te.data,oe=so(W),ie=no({name:(null==oe?void 0:oe.name)||"hover",fields:(null==oe?void 0:oe.fields)||[]}),re=eo(e=>e.pushObservation),se=t.useMemo(()=>{const e=new Map;for(const t of ee)e.set(t[a]+"",t);return e},[ee,a]),le=t.useRef(null),ae=t.useRef(se);ae.current=se;const ce=t.useRef(c);ce.current=c;const ue=t.useRef(u);ue.current=u;const de=t.useCallback(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=ae.current,n=t.get(e.source+""),o=t.get(e.target+"");if(!n||!o)return null;const i="function"==typeof ce.current?ce.current:e=>e[ce.current],r="function"==typeof ue.current?ue.current:e=>e[ue.current];return Object.assign(Object.assign({},e),{coordinates:[{[Ho]:i(n),[qo]:r(n)},{[Ho]:i(o),[qo]:r(o)}]})},[]);To(i,{variant:"geo-lines",frameRef:le,overrides:{push:e=>{var t;const n=de(e);n&&(null===(t=le.current)||void 0===t||t.pushLine(n))},pushMany:e=>{var t;const n=[];for(const t of e){const e=de(t);e&&n.push(e)}n.length>0&&(null===(t=le.current)||void 0===t||t.pushManyLines(n))}}});const he=t.useMemo(()=>{const e=new Map;for(const t of ne)t&&"object"==typeof t&&(null==t.source||e.has(t.source)||e.set(t.source,t),null==t.target||e.has(t.target)||e.set(t.target,t));return e},[ne]),fe=t.useCallback(e=>{var t,n;if(W)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=he.get(t[a]+"");e&&ie.onHover(e)}else ie.onHover(t)}else ie.onHover(null);if(B||re){const o={timestamp:Date.now(),chartType:"FlowMap",chartId:T};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const r=Object.assign(Object.assign({},o),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});B&&B(r),re&&re(r)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});B&&B(e),re&&re(e)}}},[W,ie,a,he,B,T,re]),pe=te.customClickBehavior,ge=t.useMemo(()=>{const e="function"==typeof c?c:e=>e[c],t="function"==typeof u?u:e=>e[u];return ne.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=se.get(n.source+""),i=se.get(n.target+"");return o&&i?Object.assign(Object.assign({},n),{coordinates:[{[Ho]:e(o),[qo]:t(o)},{[Ho]:e(i),[qo]:t(i)}]}):null}).filter(Boolean)},[ne,se,c,u]),me=t.useMemo(()=>{const e="function"==typeof c?c:e=>e[c];return t=>null!=t&&"object"==typeof t&&Ho in t?t[Ho]:e(t)},[c]),ye=t.useMemo(()=>{const e="function"==typeof u?u:e=>e[u];return t=>null!=t&&"object"==typeof t&&qo in t?t[qo]:e(t)},[u]),ve=t.useMemo(()=>{const e=ne.filter(e=>e&&"object"==typeof e).map(e=>{var t;return null!==(t=e[d])&&void 0!==t?t:0}).filter(e=>isFinite(e));return 0===e.length?()=>C[0]:o.scaleLinear().domain([Math.min(...e),Math.max(...e)]).range(C)},[ne,d,C]),be=t.useMemo(()=>e=>{var t;return{stroke:S?qn(e,S,te.colorScale):co,strokeWidth:ve(null!==(t=e[d])&&void 0!==t?t:0),strokeLinecap:P,opacity:A}},[S,te.colorScale,ve,d,A,P]),xe=t.useMemo(()=>{var e;const t=bo(be,{stroke:Z,strokeWidth:Y,opacity:X});if(!te.effectiveSelectionHook)return t;const n=Object.assign(Object.assign({},(null===(e=te.resolvedSelection)||void 0===e?void 0:e.unselectedStyle)||{}),{fillOpacity:0});return lo(t,te.effectiveSelectionHook,Object.assign(Object.assign({},te.resolvedSelection||{}),{unselectedStyle:n}))},[be,te.effectiveSelectionHook,te.resolvedSelection,Z,Y,X]),je=t.useMemo(()=>bo(()=>({fill:"#333",r:5,fillOpacity:.8}),{stroke:Z,strokeWidth:Y,opacity:X}),[Z,Y,X]),ke=t.useMemo(()=>t=>{var n,o,i,r,s,l,c;if((null==t?void 0:t.geometry)||(null==t?void 0:t.properties)||(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.geometry)){const n=(null===(o=null==t?void 0:t.properties)||void 0===o?void 0:o.name)||(null===(i=null==t?void 0:t.properties)||void 0===i?void 0:i.NAME)||(null==t?void 0:t.name)||(null==t?void 0:t.NAME)||(null===(s=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.properties)||void 0===s?void 0:s.name)||(null===(c=null===(l=null==t?void 0:t.data)||void 0===l?void 0:l.properties)||void 0===c?void 0:c.NAME);if(n)return e.jsx("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e.jsx("div",{style:{fontWeight:600},children:n})})}if(null!=(null==t?void 0:t.source)&&null!=(null==t?void 0:t.target)){const n=t[d];return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e.jsxs("div",{style:{fontWeight:600},children:[t.source," → ",t.target]}),null!=n&&e.jsx("div",{style:{opacity:.7},children:"number"==typeof n?n.toLocaleString():n})]})}const u=(null==t?void 0:t.name)||(null==t?void 0:t.label)||(null==t?void 0:t[a]);return null!=u?e.jsx("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e.jsx("div",{style:{fontWeight:600},children:u})}):null},[d,a]);if(te.earlyReturn)return te.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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:h},null!=s&&{lines:ge}),{points:ee,xAccessor:me,yAccessor:ye,lineDataAccessor:"coordinates"}),null!=Q&&{lineIdAccessor:Q}),{lineType:k,flowStyle:w,lineStyle:xe,pointStyle:je}),J&&{areas:J,areaStyle:O}),null!=f&&{graticule:f}),null!=p&&{fitPadding:p}),K&&{zoomable:!0}),m&&{zoomExtent:m}),y&&{onZoom:y}),null!=v&&{dragRotate:v}),z&&{showParticles:z}),R&&{particleStyle:R}),b&&{tileURL:b}),x&&{tileAttribution:x}),j&&{tileCacheSize:j}),{size:[r.width,r.height],margin:te.margin,enableHover:!0,tooltipContent:!1===D?()=>null:Kt(D)||ke}),te.legendBehaviorProps),(W||B||_)&&{customHoverBehavior:fe}),(B||_)&&{customClickBehavior:pe}),I&&I.length>0&&{annotations:I}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),E&&{className:E}),null!=n.animate&&{animate:n.animate}),G);return e.jsx(Mo,{componentName:"FlowMap",width:r.width,height:r.height,children:e.jsx(wn,Object.assign({ref:le},we))})});Go.displayName="FlowMap";const Vo=t.forwardRef(function(n,o){const i=yo(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:r,lines:s,xAccessor:l="lon",yAccessor:a="lat",nodeIdAccessor:c="id",center:u,costAccessor:d,strength:h=1,lineMode:f="straight",projection:p="mercator",graticule:g,fitPadding:m,zoomable:y,zoomExtent:v,onZoom:b,dragRotate:x,tileURL:j,tileAttribution:k,tileCacheSize:w,transition:M,colorBy:O,colorScheme:S,pointRadius:A=5,tooltip:C,showRings:P=!0,ringStyle:L,showNorth:z=!0,costLabel:R,annotations:D,margin:I,className:$,selection:E,linkedHover:N,onObservation:W,onClick:B,chartId:_,loading:T,loadingContent:F,emptyContent:H,legendPosition:q,frameProps:G={},stroke:V,strokeWidth:U,opacity:Z}=n,Y=null!=y?y:!!j,X=t.useMemo(()=>Gt(r),[r]),Q=_o({data:X,rawData:r,colorBy:O,colorScheme:S,legendInteraction:void 0,legendPosition:q,selection:E,linkedHover:N,fallbackFields:O?["string"==typeof O?O:""]:[],unwrapData:!1,onObservation:W,onClick:B,chartType:"DistanceCartogram",chartId:_,showLegend:i.showLegend,userMargin:I,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:T,loadingContent:F,emptyContent:H,width:i.width,height:i.height}),K=t.useMemo(()=>{const e=bo(e=>({fill:O?qn(e,O,Q.colorScale):co,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:A}),{stroke:V,strokeWidth:U,opacity:Z});return Q.effectiveSelectionHook?lo(e,Q.effectiveSelectionHook,Q.resolvedSelection):e},[O,Q.colorScale,Q.effectiveSelectionHook,Q.resolvedSelection,A,V,U,Z]),J=t.useMemo(()=>({center:u,centerAccessor:c,costAccessor:d,strength:h,lineMode:f}),[u,c,d,h,f]),ee=t.useMemo(()=>{if(!s)return;const e="function"==typeof l?l:e=>e[l],t="function"==typeof a?a:e=>e[a],n=new Map;for(const e of X)n.set(e[c]+"",e);return s.map(o=>{if(o.coordinates)return o;const i=n.get(o.source+""),r=n.get(o.target+"");return i&&r?Object.assign(Object.assign({},o),{coordinates:[{[l]:e(i),[a]:t(i)},{[l]:e(r),[a]:t(r)}]}):null}).filter(Boolean)},[s,X,l,a,c]),te=t.useMemo(()=>t=>{const n=("function"==typeof d?d:e=>e[d])(t);return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e.jsx("div",{style:{fontWeight:600},children:t[c]||t.name||t.id||"Point"}),null!=n&&e.jsxs("div",{style:{opacity:.7},children:["Cost: ","number"==typeof n?n.toFixed(1):n]})]})},[d,c]),ne=t.useRef(null);To(o,{variant:"geo-points",frameRef:ne});const[oe,ie]=t.useState(null),re=t.useCallback(()=>{var e,t;const n=null===(t=null===(e=ne.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&ie(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);t.useEffect(()=>{const e=requestAnimationFrame(re);return()=>cancelAnimationFrame(e)},[re,h,u,i.width,i.height,X]);const se=t.useMemo(()=>{if(!P||!oe)return[];const{maxCost:e}=oe;if(0>=e)return[];if(Array.isArray(P))return P.filter(t=>t>0&&e>=t);const t="number"==typeof P?P:Math.min(5,Math.max(2,Math.ceil(e/5))),n=e/t,o=[];for(let e=1;t>=e;e++)o.push(Math.round(n*e*10)/10);return o},[P,oe]),le=t.useMemo(()=>{var t,n;if(!oe)return G.foregroundGraphics||null;const{cx:o,cy:i,maxCost:r,availableRadius:s}=oe,l=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},L),a=null!==(t=Q.margin.left)&&void 0!==t?t:10,c=null!==(n=Q.margin.top)&&void 0!==n?n:10;return e.jsxs("g",{children:[se.map(t=>{const n=t/r*s;return e.jsxs("g",{children:[e.jsx("circle",{cx:o+a,cy:i+c,r:n,fill:"none",stroke:l.stroke,strokeWidth:l.strokeWidth,strokeDasharray:l.strokeDasharray,opacity:.5}),e.jsxs("text",{x:o+a+n+3,y:i+c-2,fontSize:l.labelSize,fill:l.labelColor,fontFamily:"system-ui, sans-serif",children:[t,R?" "+R:""]})]},t)}),z&&e.jsxs("g",{transform:`translate(${a+24}, ${c+24})`,children:[e.jsx("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),e.jsx("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),e.jsx("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),e.jsx("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),e.jsx("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),e.jsx("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]}),G.foregroundGraphics]})},[oe,se,z,R,L,Q.margin,G.foregroundGraphics]);if(Q.earlyReturn)return Q.earlyReturn;Po("DistanceCartogram",X,"xAccessor",l),Po("DistanceCartogram",X,"yAccessor",a);const ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:p},null!=r&&{points:X}),ee&&{lines:ee,lineDataAccessor:"coordinates"}),{xAccessor:l,yAccessor:a,pointIdAccessor:c,pointStyle:K,projectionTransform:J}),M&&{transition:{duration:M}}),null!=g&&{graticule:g}),null!=m&&{fitPadding:m}),Y&&{zoomable:!0}),v&&{zoomExtent:v}),b&&{onZoom:b}),null!=x&&{dragRotate:x}),j&&{tileURL:j}),k&&{tileAttribution:k}),w&&{tileCacheSize:w}),{size:[i.width,i.height],margin:Q.margin,enableHover:!0,tooltipContent:!1===C?()=>null:Kt(C)||te}),Q.legendBehaviorProps),(N||W||B)&&{customHoverBehavior:Q.customHoverBehavior}),(W||B)&&{customClickBehavior:Q.customClickBehavior}),D&&D.length>0&&{annotations:D}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),i.title&&{title:i.title}),i.description&&{description:i.description}),i.summary&&{summary:i.summary}),void 0!==i.accessibleTable&&{accessibleTable:i.accessibleTable}),$&&{className:$}),null!=n.animate&&{animate:n.animate}),G),le&&{foregroundGraphics:le});return e.jsx(Mo,{componentName:"DistanceCartogram",width:i.width,height:i.height,children:e.jsx(wn,Object.assign({ref:ne},ae))})});Vo.displayName="DistanceCartogram",exports.ChoroplethMap=Bo,exports.DistanceCartogram=Vo,exports.FlowMap=Go,exports.ProportionalSymbolMap=Fo,exports.StreamGeoFrame=wn,exports.mergeData=function(e,t,n){const{featureKey:o,dataKey:i}=n,r=new Map;for(const e of t)r.set(e[i]+"",e);return e.map(e=>{const t=(e=>{const t=o.split(".");let n=e;for(const e of t)n=null==n?void 0:n[e];return(null!=n?n:"")+""})(e),n=r.get(t);return n?Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),n)}):e})},exports.resolveReferenceGeography=Eo;
2
+ "use strict";var e,t=Object.create,n=Object.defineProperty,o=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||n(e,l,{get:()=>t[l],enumerable:!(a=o(t,l))||a.enumerable});return e},l=(e,o,r)=>(r=null!=e?t(i(e)):{},a(!o&&e&&e.__esModule?r:n(r,"default",{value:e,enumerable:!0}),e)),c={};((e,t)=>{for(var o in t)n(e,o,{get:t[o],enumerable:!0})})(c,{ChoroplethMap:()=>_i,DEFAULT_HIT_RADIUS:()=>ls,DistanceCartogram:()=>ns,FlowMap:()=>Ji,GeoCustomChart:()=>ss,ProportionalSymbolMap:()=>Ui,StreamGeoFrame:()=>Sr,geoAreaHitTarget:()=>hs,geoHitTarget:()=>us,glyphExtent:()=>me,glyphPlacement:()=>pe,hitTargetPoint:()=>cs,mergeData:()=>ds,resolveReferenceGeography:()=>Ti,resolveResponsiveRules:()=>Jr,responsiveRuleMatches:()=>Kr}),module.exports=(e=c,a(n({},"__esModule",{value:!0}),e));var u=require("react"),h=require("d3-geo"),d=require("d3-quadtree"),f=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray();let n=0,o=[];t.length>e&&(n=t.length-e,o=t.slice(0,n)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=n;t.length>e;e++)this.push(t[e]);return o}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(o+r)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:{...s},n.push(e),this.buffer[i]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}};function p(e,t,n){return e+(t-e)*n}function m(){return"undefined"!=typeof performance?performance.now():Date.now()}function y(e,t,n){if(1>=n)return 1;const o=n-1;return function(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||0>=e.extent)return 1;const n=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>n?1:t;if("exponential"===e.type){const o=e.halfLife??e.extent/2;return t+Math.pow(.5,n/(o>0?o:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}({age:o-t,extent:o,type:e.type,halfLife:e.halfLife??n/2,threshold:e.stepThreshold??.5*n,minOpacity:e.minOpacity??.1})}function g(e,t,n){const o=e.duration??500,r=n-t;return o>r?1-r/o:0}var b=require("d3-scale");function x(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function v(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function k(e){const t=e.map(x),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return v(e,n,o)}if(e>=1){const[e,o,r]=t[n];return v(e,o,r)}const o=e*n,r=Math.floor(o),i=o-r,[s,a,l]=t[r],[c,u,h]=t[r+1];return v(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(h-l)*i))}}var w=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],j=k(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),M=k(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),S=k(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),A=k(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),C=k(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),L=k(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),R=k(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),P=k(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),I=k(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),D=k(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),z=k(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),O=k(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),T={blues:j,reds:M,greens:S,viridis:R,oranges:A,purples:C,greys:L,plasma:P,inferno:I,magma:D,cividis:z,turbo:O};function E(e){return e&&T[e]||j}k(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),k(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),k(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),k(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),k(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),k(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),k(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);var N={category10:w,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...T},$=w,W=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],_=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 B(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")||_.has(t)}(o)?n(o):o}const o=e?.[t]+"";return n?n(o):$[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))%$.length]}function H(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function F(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>H(e,t)??"#999"}const o=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),r=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return(0,b.scaleOrdinal)().domain(o).range(n).unknown("#999");const i=N[n]||N.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:$;return(0,b.scaleOrdinal)().domain(o).range(e).unknown("#999")}}function q(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e?.[t],!o)return r;const[i,s]=o,[a,l]=n;if(s===i)return(a+l)/2;let c=(r-i)/(s-i);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function G(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>n&&H(n,e)||"#4e79a7":t=>{if(n){const e=H(n,t);if(e)return e}let o=0;for(let e=0;t.length>e;e++)o=31*o+t.charCodeAt(e)|0;return e[Math.abs(o)%e.length]??"#4e79a7"}}function V(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(V))}function U(e,t,n){e.has(t)||(e.add(t),console.warn(n))}var Z=require("d3-geo"),Y={mercator:Z.geoMercator,equalEarth:Z.geoEqualEarth,albersUsa:Z.geoAlbersUsa,orthographic:Z.geoOrthographic,naturalEarth:Z.geoNaturalEarth1,equirectangular:Z.geoEquirectangular};function X(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function Q(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function K(e,t,n){return e?"function"==typeof e?{...n,...e(t)}:{...n,...e}:{...n}}function J(e,t){if(2>e.length)return[e];const n=.4*t,o=[];let r=[e[0]];for(let t=1;e.length>t;t++){const i=e[t];Math.abs(i[0]-e[t-1][0])>n?(2>r.length||o.push(r),r=[i]):r.push(i)}return 2>r.length||o.push(r),o}function ee(e,t,n=24){const o=t[0]-e[0],r=t[1]-e[1],i=Math.sqrt(o*o+r*r);if(0===i)return[e,t];const s=-r/i,a=o/i,l=Math.min(.3*i,80),c=(e[0]+t[0])/2+s*l,u=(e[1]+t[1])/2+a*l,h=[];for(let o=0;n>=o;o++){const r=o/n,i=1-r;h.push([i*i*e[0]+2*i*r*c+r*r*t[0],i*i*e[1]+2*i*r*u+r*r*t[1]])}return h}function te(e,t){if(2>e.length)return e;const n=t/2+1,o=[];for(let t=0;e.length>t;t++){const r=e[t];let i,s;0===t?(i=e[1][0]-r[0],s=e[1][1]-r[1]):t===e.length-1?(i=r[0]-e[t-1][0],s=r[1]-e[t-1][1]):(i=e[t+1][0]-e[t-1][0],s=e[t+1][1]-e[t-1][1]);const a=Math.sqrt(i*i+s*s)||1;o.push([r[0]+s/a*n,r[1]+-i/a*n])}return o}function ne(e,t,n,o,r){const i=t[0]-e[0],s=t[1]-e[1],a=Math.sqrt(i*i+s*s);if(0===a)return[e,t];const l=s/a,c=-i/a,u=r/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}var oe=require("d3-scale");function re(e){let t=1/0,n=-1/0;for(const o of e)t>o&&(t=o),o>n&&(n=o);return[t,n]}function ie(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}function se(e,t,n,o){const r=e.push(t);return n&&n.push(o),r}var ae=class e{constructor(e){this.scene=[],this.scales=null,this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._customLayoutFailedThisBuild=!1,this._quadtree=null,this._maxPointRadius=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this._hasRenderedOnce=!1,this._stylePaintPending=!1,this.config=e}updateConfig(e){this.config={...this.config,...e},"customLayout"in e&&!e.customLayout&&(this.lastCustomLayoutFailure=null)}setAreas(e){this.areas=e}setPoints(e){this.pointData=e,this.streaming=!1}setLines(e){this.lineData=e.slice()}initStreaming(e=500){this.pointBuffer=new f(e),this.timestampBuffer=new f(e),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming();const t=m();se(this.pointBuffer,e,this.timestampBuffer,t),this.lastIngestTime=t}pushMany(e){this.pointBuffer||this.initStreaming();const t=m();for(const n of e)se(this.pointBuffer,n,this.timestampBuffer,t);this.lastIngestTime=t}pushLine(e){null!=e&&"object"==typeof e&&(this.lineData.push(e),this.version++)}pushManyLines(e){if(!Array.isArray(e)||0===e.length)return;const t=e.filter(e=>null!=e&&"object"==typeof e);if(0!==t.length){for(const e of t)this.lineData.push(e);this.version++}}removeLine(e){const{lineIdAccessor:t}=this.config;if(!t)throw Error("removeLine() requires lineIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],o=new Set(Array.isArray(e)?e:[e]),r=[];return this.lineData=this.lineData.filter(e=>!o.has(n(e)+"")||(r.push(e),!1)),r.length>0&&this.version++,r}getLines(){return this.lineData.slice()}removePoint(e){const{pointIdAccessor:t}=this.config;if(!t)throw Error("removePoint() requires pointIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],o=new Set(Array.isArray(e)?e:[e]);if(this.streaming&&this.pointBuffer){const e=e=>o.has(n(e)+"");!function(e,t,n){if(!t||0===t.size)return;const o=new Set;if(e.forEach((e,t)=>{n(e)&&o.add(t)}),0===o.size)return;const r=t.toArray();t.clear();for(let e=0;r.length>e;e++)o.has(e)||t.push(r[e])}(this.pointBuffer,this.timestampBuffer,e);const t=this.pointBuffer.remove(e);return t.length>0&&this.version++,t}{const e=[];return this.pointData=this.pointData.filter(t=>!o.has(n(t)+"")||(e.push(t),!1)),e.length>0&&this.version++,e}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.scene=[],this.scales=null,this._hasRenderedOnce=!1,this.activeTransition=null,this.prevPositions=null,this._quadtree=null,this._maxPointRadius=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._customLayoutFailedThisBuild=!1,this.version++}setLayoutSelection(e){this.config.layoutSelection=e}consumeStylePaintPending(){const e=this._stylePaintPending;return this._stylePaintPending=!1,e}restyleScene(e){const t=this._customRestyle;if(t){for(const n of this.scene){const o=this._baseStyles.get(n)??n.style,r=t(n,e);n.style=r?{...o,...r}:o}this._stylePaintPending=!0}}computeScene(e){const{config:t}=this,n=this.projection,o=this.geoPath,r=this.scales,i=this.baseScale,s=[...this.baseTranslate],a=[...this.baseRotation],l=this.scene;this.projection=function(e){if(!e)return(0,Z.geoEqualEarth)();if("string"==typeof e){const t=Y[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),(0,Z.geoEqualEarth)())}if("object"==typeof e&&"type"in e){const t=Y[e.type],n=t?t():(0,Z.geoEqualEarth)();return e.rotate&&"rotate"in n&&n.rotate(e.rotate),e.center&&"center"in n&&n.center(e.center),n}return e}(t.projection),this.geoPath=(0,h.geoPath)(this.projection),this.fitProjection(e),this.geoPath=(0,h.geoPath)(this.projection);const c=this.projection;this.scales={projection:c,geoPath:this.geoPath,projectedPoint:(e,t)=>c([e,t]),invertedPoint:(e,t)=>c.invert?c.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const u=this.buildSceneNodes(e);if(this._customLayoutFailedThisBuild)!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.projection=n,this.geoPath=o,this.scales=r,this.baseScale=i,this.baseTranslate=s,this.baseRotation=a):(this.scene=[],this.rebuildQuadtree());else{if(this.scene=u,this.rebuildQuadtree(),t.projectionTransform&&this.applyCartogramTransform(t.projectionTransform,e),t.decay&&this.streaming&&this.applyDecay(),t.pulse&&this.streaming&&this.applyPulse(),t.transition&&!this._hasRenderedOnce&&this.scene.length>0&&t.introAnimation){const t=e.width/2,n=e.height/2,o=this.scene.filter(e=>"point"===e.type).map(e=>({...e,x:t,y:n}));o.length>0&&this.startTransition(o)}this._hasRenderedOnce=!0,t.transition&&l.length>0&&this.startTransition(l),this.version++}}fitProjection(e){const t=this.projection,n=this.config,o=[...this.areas],r=X(n.xAccessor,"lon"),i=X(n.yAccessor,"lat"),s=this.getPoints();if(s.length>0){const e=s.map(e=>[r(e),i(e)]);o.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const a=Q(n.lineDataAccessor);for(const e of this.lineData){const t=a(e);if(t&&t.length>0){const e=t.map(e=>[r(e),i(e)]);o.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==o.length){if(n.projectionExtent){const[[o,r],[i,s]]=n.projectionExtent;t.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[o,r],[i,r],[i,s],[o,s],[o,r]]]}})}else if(t.clipAngle&&(t.clipAngle()??0)>0){const o=n.fitPadding??0,r=Math.min(e.width,e.height);t.scale(r/2-r*o),t.translate([e.width/2,e.height/2])}else{const r={type:"FeatureCollection",features:o},i=n.fitPadding??0;1>i||"undefined"==typeof process||"production"===process.env.NODE_ENV||console.warn(`[semiotic] fitPadding=${i} looks like pixels, but it's a fraction of the plot (0–0.5). A value >= 1 collapses the projection off-canvas — use e.g. 0.06.`);const s=e.width*i,a=e.height*i;t.fitExtent([[s,a],[e.width-s,e.height-a]],r)}this.baseScale=t.scale(),this.baseTranslate=t.translate(),this.baseRotation=t.rotate?.()??[0,0,0]}}applyZoomTransform(e,t){const n=this.projection;if(!n)return;const o=this.geoPath,r=this.scales,i=n.scale(),s=[...n.translate()],a=this.currentZoom;n.scale(this.baseScale*e.k),n.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=(0,h.geoPath)(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const l=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(i),n.translate(s),this.currentZoom=a,this.geoPath=o,this.scales=r):(this.scene=[],this.rebuildQuadtree()):(this.scene=l,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const n=this.projection;if(!n)return;const o=this.geoPath,r=this.scales,i=n.scale(),s=[...n.translate()],a=this.currentZoom;n.scale(this.baseScale*e),n.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=(0,h.geoPath)(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const l=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(i),n.translate(s),this.currentZoom=a,this.geoPath=o,this.scales=r):(this.scene=[],this.rebuildQuadtree()):(this.scene=l,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const n=this.projection;if(!n||!n.rotate)return;const o=this.geoPath,r=this.scales,i=[...n.rotate()];n.rotate(e),this.geoPath=(0,h.geoPath)(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const s=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.rotate(i),this.geoPath=o,this.scales=r):(this.scene=[],this.rebuildQuadtree()):(this.scene=s,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}setRotation(e){const t=this.projection;t&&t.rotate&&t.rotate(e)}getRotation(){return this.projection?.rotate?.()??this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}rebuildQuadtree(){let t=0,n=0;for(const e of this.scene)"point"===e.type&&(n++,e.r>t&&(t=e.r));if(this._maxPointRadius=t,e.QUADTREE_THRESHOLD>=n)return void(this._quadtree=null);const o=Array(n);let r=0;for(const e of this.scene)"point"===e.type&&(o[r++]=e);this._quadtree=(0,d.quadtree)().x(e=>e.x).y(e=>e.y).addAll(o)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){this._customLayoutFailedThisBuild=!1;const{config:t}=this,n=this.projection,o=this.geoPath,r=X(t.xAccessor,"lon"),i=X(t.yAccessor,"lat");if(t.customLayout&&this.scales){const n=t.layoutMargin??{top:0,right:0,bottom:0,left:0},o=function(e,t,n){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=N[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(t.colorScheme,t.themeCategorical,W),r={areas:this.areas.slice(),points:this.getPoints().slice(),lines:this.lineData.slice(),scales:this.scales,dimensions:{width:e.width,height:e.height,margin:n,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:t.themeSemantic??{},categorical:[...o]},resolveColor:G(o,t.colorScheme),config:t.layoutConfig??{},selection:t.layoutSelection??null};let i;try{i=t.customLayout(r)}catch(e){const n=null!==this.lastCustomLayoutResult,o=function(e,t,n,o){const r=function(e){if(e instanceof Error)return{name:e.name||"Error",message:e.message||"Custom layout threw."};if("string"==typeof e)return{name:"Error",message:e};if(null==e)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:e+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(t),i="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:i,message:`Semiotic ${e} ${i} failed: ${r.message}`,error:r,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:o}}("geo",e,n,this.version);this.lastCustomLayoutFailure=o,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] geo customLayout threw:",e);try{t.onLayoutError?.(o)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return n?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}const s=i.nodes??[];if(this.customLayoutOverlays=i.overlays??null,this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null,this._customRestyle=i.restyle,this.hasCustomRestyle=!!i.restyle,this._baseStyles=new WeakMap,this.hasCustomRestyle){for(const e of s)this._baseStyles.set(e,e.style);this.restyleScene(t.layoutSelection??null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:o,warned:r}=e;V(o)&&0===n.length&&U(r,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(e=>null==e.datum)&&U(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:"geo customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap;const s=[],a=function(e){return{fill:e.themeSemantic?.surface||"#e0e0e0",stroke:e.themeSemantic?.border||"#999",strokeWidth:.5,fillOpacity:1}}(t),l=function(e){return{stroke:e.themeSemantic?.primary||"#4e79a7",strokeWidth:1.5,fill:"none"}}(t),c=function(e){return{fill:e.themeSemantic?.primary||"#4e79a7",r:4,fillOpacity:.8}}(t);if(t.graticule){const n=!0===t.graticule?{}:t.graticule,r=(0,h.geoGraticule)();n.step&&r.step(n.step);const i=o(r())||"";i&&s.push({type:"geoarea",pathData:i,centroid:[e.width/2,e.height/2],bounds:[[0,0],[e.width,e.height]],screenArea:0,style:{fill:"none",stroke:n.stroke||"#e0e0e0",strokeWidth:n.strokeWidth||.5,strokeDasharray:n.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of this.areas){const n=o(e);if(!n)continue;const r=o.centroid(e),i=o.bounds(e),l=o.area(e),c=K(t.areaStyle,e,a);s.push({type:"geoarea",pathData:n,centroid:r,bounds:i,screenArea:l,style:c,datum:e,interactive:!0})}const u=Q(t.lineDataAccessor);for(const o of this.lineData){const a=u(o);if(!a||2>a.length)continue;let c=[];if("geo"===t.lineType){const e=Array(a.length);for(let t=0;a.length>t;t++)e[t]=[r(a[t]),i(a[t])];for(let t=0;e.length-1>t;t++){const o=e[t],r=e[t+1],i=(0,h.geoDistance)(o,r)||0,s=Math.max(2,Math.ceil(i/(Math.PI/180))),a=(0,h.geoInterpolate)(o,r);for(let e=0;s>=e;e++){if(t>0&&0===e)continue;const o=n(a(e/s));null!=o&&c.push(o)}}}else for(let e=0;a.length>e;e++){const t=a[e],o=n([r(t),i(t)]);null!=o&&c.push(o)}if(2>c.length)continue;const d=K(t.lineStyle,o,l),f="number"==typeof d.strokeWidth?d.strokeWidth:1;2!==a.length||2>c.length||"arc"!==t.flowStyle?2!==a.length||2>c.length||"offset"!==t.flowStyle||(c="geo"===t.lineType?te(c,f):ne(c[0],c[c.length-1],0,0,f)):c=ee(c[0],c[c.length-1]);const p=J(c,e.width);if(p.length>1)for(const e of p){if(2>e.length)continue;const t={type:"line",path:e,style:{...d,_edgeFade:!0},datum:o};s.push(t)}else s.push({type:"line",path:2>c.length&&p[0]||c,style:d,datum:o})}const d=this.getPoints(),f=t.pointIdAccessor?"function"==typeof t.pointIdAccessor?t.pointIdAccessor:e=>e[t.pointIdAccessor]:null,p=n.clipAngle?n.clipAngle()??0:0,m=p>0?p*Math.PI/180:null,y=n.rotate?n.rotate():[0,0,0],g="function"==typeof n.center?n.center():[0,0],b=[(g[0]??0)-y[0],(g[1]??0)-y[1]];for(let e=0;d.length>e;e++){const o=d[e],a=r(o),l=i(o);if(null!=m&&(0,h.geoDistance)([a,l],b)>m)continue;const u=n([a,l]);if(!u)continue;const p=t.pointStyle?t.pointStyle(o):{...c},y={type:"point",x:u[0],y:u[1],r:p.r||4,style:p,datum:o,pointId:f?f(o)+"":void 0};s.push(y)}return s}applyCartogramTransform(e,t){const n=function(e,t,n,o){const r=e.filter(e=>"point"===e.type);if(2>r.length)return null;const i=t.strength??1;if(0===i)return null;const s=t.centerAccessor?"function"==typeof t.centerAccessor?t.centerAccessor:e=>e[t.centerAccessor]:e=>e.id,a="function"==typeof t.costAccessor?t.costAccessor:e=>e[t.costAccessor],l=r.find(e=>e.datum&&s(e.datum)+""==t.center+"");if(!l)return"production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${t.center}" not found in point data`),null;const c=l.x,u=l.y,h=ie(r.map(e=>e.datum?a(e.datum):NaN).filter(e=>isFinite(e)&&e>=0),1),d=Math.min(n.width,n.height)/2,f=(0,oe.scaleLinear)().domain([0,h]).range([0,d]);o>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them.");for(let t=e.length-1;t>=0;t--){const n=e[t];"geoarea"===n.type&&n.interactive&&e.splice(t,1)}for(const e of r){if(e===l)continue;if(!e.datum)continue;const t=Math.atan2(e.y-u,e.x-c),n=Math.sqrt((e.x-c)**2+(e.y-u)**2),o=a(e.datum),r=n+((isFinite(o)?f(o):n)-n)*i;e.x=c+Math.cos(t)*r,e.y=u+Math.sin(t)*r}const p=n.width/2,m=n.height/2,y=p-l.x,g=m-l.y;if(Math.abs(y)>.5||Math.abs(g)>.5)for(const e of r)e.x+=y,e.y+=g;const b={cx:p,cy:m,maxCost:h,availableRadius:d},x=e.filter(e=>"line"===e.type);if(x.length>0&&"fractional"!==t.lineMode){const e=new Map;for(const t of r)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of x){const n=t.datum?.source,o=t.datum?.target;if(n&&o){const r=e.get(n+""),i=e.get(o+"");r&&i&&(t.path=[r,i])}}}return b}(this.scene,e,t,this.areas.length);n&&(this.cartogramLayout=n)}applyDecay(){const e=this.config.decay;if(!e||!this.pointBuffer)return;const t=this.pointBuffer.size;if(0===t)return;const n=this.scene.filter(e=>"point"===e.type);for(let o=0;n.length>o;o++){const r=y(e,o,t);n[o]._decayOpacity=r,n[o].style={...n[o].style,opacity:r}}}applyPulse(){const e=this.config.pulse;if(!e||!this.timestampBuffer)return;const t=m(),n=this.scene.filter(e=>"point"===e.type),o=this.timestampBuffer.toArray();for(let r=0;n.length>r&&o.length>r;r++){const i=g(e,o[r],t);i>0&&(n[r]._pulseIntensity=i,n[r]._pulseColor=e.color||"rgba(255,255,255,0.6)",n[r]._pulseGlowRadius=e.glowRadius??4)}}get hasActivePulses(){return function(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const o=e.duration??500,r=t.peek();return null!=r&&o>n-r}(this.config.pulse??{},this.timestampBuffer)}startTransition(e){const t=this.config.transition?.duration??300;if(0>=t)return;const n=new Map;for(const t of e)"point"===t.type&&t.pointId&&n.set(t.pointId,[t.x,t.y]);const o=this.scene.filter(e=>"point"===e.type);let r=!1;for(const e of o)if(e.pointId){const t=n.get(e.pointId);t&&(e._targetX=e.x,e._targetY=e.y,e.x=t[0],e.y=t[1],(Math.abs(t[0]-e._targetX)>.5||Math.abs(t[1]-e._targetY)>.5)&&(r=!0))}for(const e of o)e.pointId&&!n.has(e.pointId)&&(e._targetOpacity=e.style?.opacity??1,e.style={...e.style,opacity:0},r=!0);r&&(this.activeTransition={startTime:m(),duration:t})}cancelIntroAnimation(){this.activeTransition=null}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t),o=this.scene.filter(e=>"point"===e.type);for(const e of o){if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=p(e.x,e._targetX,n),e.y=p(t,e._targetY,n)}null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity*n})}if(t>=1){for(const e of o)null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0),null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity},e._targetOpacity=void 0);return this.activeTransition=null,!1}return!0}};ae.QUADTREE_THRESHOLD=500;var le=ae;function ce(e,t=30){return Math.max((e??4)+5,12,t)}function ue(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function he(e,t){const n=ue(e);if(!n)return!1;const o=ue(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}var de=[40,40],fe=[.5,.5];function pe(e,t){const[n,o]=e.viewBox??de,[r,i]=e.anchor??fe,s=o>0?o:1,a=Math.max(0,t)/s,l=(n>0?n:s)*a,c=s*a;return{width:l,height:c,scale:a,offsetX:-r*l,offsetY:-i*c}}function me(e,t){const n=pe(e,t),o=[[n.offsetX,n.offsetY],[n.offsetX+n.width,n.offsetY],[n.offsetX,n.offsetY+n.height],[n.offsetX+n.width,n.offsetY+n.height]];let r=0;for(const[e,t]of o){const n=Math.sqrt(e*e+t*t);n>r&&(r=n)}return r}function ye(e,t,n,o){if("none"!==e)return"color"===e||null==e?t??o:"accent"===e?n:e}var ge=null;function be(e){if("undefined"==typeof Path2D)return null;ge||(ge=new Map);const t=ge.get(e);if(t)return t;const n=new Path2D(e);return ge.size>1024&&ge.clear(),ge.set(e,n),n}function xe(e,t,n=0,o="horizontal"){const[r,i]=e.viewBox??de,s=Math.min(1,Math.max(0,n)),a=Math.min(1,Math.max(0,t));return a>s?s>0||1>a?"vertical"===o?{x:0,y:i*(1-a),width:r,height:i*(a-s)}:{x:r*s,y:0,width:r*(a-s),height:i}:null:{x:0,y:0,width:0,height:0}}function ve(e,t){const n=pe(e,t);return{centerDx:n.offsetX+n.width/2,centerDy:n.offsetY+n.height/2,halfWidth:n.width/2,halfHeight:n.height/2,radius:Math.hypot(n.width,n.height)/2}}function ke(e,t,n,o,r,i=e=>e){for(const s of t.parts){const t=be(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:ye(s.fill,n,o);c&&(e.fillStyle=i(c),e.fill(t));const u=r?s.stroke&&"none"!==s.stroke?r:void 0:ye(s.stroke??"none",n,o);u&&(e.strokeStyle=i(u),e.lineWidth=s.strokeWidth??1,e.lineCap=s.strokeLinecap??"butt",e.lineJoin=s.strokeLinejoin??"miter",e.stroke(t)),1!==a&&(e.globalAlpha=l)}}function we(e,t,n,o,r,i,s=0,a=o){if(i){const e=function(e,t,n,o,r,i=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(o,r+5,12),c=t-l,u=t+l,h=n-l,d=n+l;let f=null,p=1/0;return e.visit((e,r,l,m,y)=>{if(r>u||c>m||l>d||h>y)return!0;if(!e.length){let r=e;do{const e=r.data,l=i(e)-t,c=s(e)-n,u=Math.sqrt(l*l+c*c);ce(a(e),o)>=u&&p>u&&(f=e,p=u),r=r.next}while(r)}return!1}),f?{node:f,distance:p}:null}(i,t,n,o,s);if(e)return e}else{let r=null,i=o;for(const s of e){if("point"!==s.type)continue;const e=s.x-t,a=s.y-n,l=Math.sqrt(e*e+a*a);ce(s.r,o)>=l&&i>l&&(r=s,i=l)}if(r)return{node:r,distance:i}}let l=null,c=o;for(const r of e){if("glyph"!==r.type)continue;if(null==r.datum)continue;const e=ve(r.glyph,r.size),i=r.x+e.centerDx-t,s=r.y+e.centerDy-n,a=Math.sqrt(i*i+s*s);ce(e.radius,o)>=a&&c>a&&(l=r,c=a)}if(l)return{node:l,distance:c};for(let o=e.length-1;o>=0;o--){const i=e[o];if("geoarea"!==i.type)continue;const s=i;if(!1===s.interactive)continue;const[[a,l],[c,u]]=s.bounds;if(!(a>t||t>c||l>n||n>u)&&(s._cachedPath2D||(s._cachedPath2D=new Path2D(s.pathData)),r.isPointInPath(s._cachedPath2D,t,n)))return{node:s,distance:0}}let u=null,h=a;for(const o of e){if("line"!==o.type)continue;const e=o,{path:r}=e,i=Math.max((e.style.strokeWidth||2)+4,5,a);for(let o=0;r.length-1>o;o++){const[s,a]=r[o],[l,c]=r[o+1],d=je(t,n,s,a,l,c);i>=d&&h>d&&(u=e,h=d)}}return u?{node:u,distance:h}:null}function je(e,t,n,o,r,i){const s=r-n,a=i-o,l=s*s+a*a;if(0===l)return Math.sqrt((e-n)**2+(t-o)**2);let c=((e-n)*s+(t-o)*a)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(n+c*s))**2+(t-(o+c*a))**2)}var Me=l(require("react")),Se=require("react"),Ae=require("react"),Ce=require("react/jsx-runtime");function Le(e){let t=null;const n=()=>(t||(t=(0,Ae.createContext)(null)),t),o=Re(e);return[function({children:t,initialState:o}){const r=(0,Ae.useRef)(o),i=(0,Ae.useMemo)(()=>Re(e,r.current),[]),s=n();return(0,Ce.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const r=n(),i=(0,Ae.useContext)(r)??o,s=(0,Ae.useRef)(e);s.current=e;const a=(0,Ae.useRef)({hasValue:!1,value:void 0}),l=(0,Ae.useCallback)(()=>{const e=s.current(i.getState()),n=a.current;return n.hasValue&&t&&t(n.value,e)?n.value:(a.current={hasValue:!0,value:e},e)},[i,t]),c=(0,Ae.useCallback)(()=>s.current(i.getState()),[i]);return(0,Ae.useSyncExternalStore)(i.subscribe,l,c)}]}function Re(e,t){const n=new Set;let o={...e(function(e){const t=e(o);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){o={...o,...t};for(const e of n)e()}}),...t??{}};return{getState:()=>o,subscribe:function(e){return n.add(e),()=>{n.delete(e)}}}}function Pe(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 Ie(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:De}}),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 De=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],ze={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}},Oe={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}},Te={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:De,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 Ee(e,t){if("light"===t)return ze;if("dark"===t)return Oe;if("high-contrast"===t)return Te;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?Oe:ze;return Ie({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return Ie({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[Ne,$e]=Le(e=>({theme:ze,setTheme(t){e(e=>({theme:Ee(e.theme,t)}))}})),We=require("react");var _e=require("react"),Be=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,He=new WeakMap,Fe=0,qe=!1,Ge=null,Ve=null;function Ue(e,t){if(!t)return t;const n=Be.exec(t);if(!n)return t;const o=e.canvas;if(!o)return n[2]?.trim()||t;!function(){if(qe)return;if("undefined"==typeof window||"undefined"==typeof document)return;qe=!0;const e=()=>{Fe++};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{Ge=window.matchMedia("(prefers-color-scheme: dark)"),Ve=e,"function"==typeof Ge.addEventListener?Ge.addEventListener("change",Ve):"function"==typeof Ge.addListener&&Ge.addListener(Ve)}catch{}}();let r=He.get(o);r&&r.version===Fe||(r={version:Fe,map:new Map},He.set(o,r));const i=r.map.get(t);if(void 0!==i)return i;const s=getComputedStyle(o).getPropertyValue(n[1]).trim()||n[2]?.trim()||t;return r.map.set(t,s),s}var Ze="undefined"==typeof window?Se.useEffect:Se.useLayoutEffect,Ye={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function Xe(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Qe(e){const t=function(){const[e,t]=(0,We.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,We.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>t(e.matches))},[]),e}(),n=(0,Se.useRef)(t);n.current=t;const[o,r]=function(e,t,n){const o=(0,_e.useRef)(null),[r,i]=(0,_e.useState)(null);return(0,_e.useEffect)(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const r=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return r.observe(e),()=>r.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=(0,Se.useMemo)(()=>({...e.marginDefault,...e.userMargin}),[e.marginDefault,e.userMargin]),s=r[0]-i.left-i.right,a=r[1]-i.top-i.bottom,l=Xe(e.foregroundGraphics,r,i),c=Xe(e.backgroundGraphics,r,i),u=$e(e=>e.theme),{transition:h,introEnabled:d}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(n||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),f="semiotic-table-"+Me.useId(),p=(0,Se.useRef)(null),m=(0,Se.useRef)(e.frameScheduler??Ye);m.current=e.frameScheduler??Ye;const y=(0,Se.useRef)(null),g=(0,Se.useRef)(!1),b=(0,Se.useRef)(()=>{}),x=(0,Se.useCallback)(()=>{if(null!==p.current||g.current)return;const e=m.current;let t=!1,n=!1;const o=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(g.current=!0),p.current=null,y.current=null;try{b.current()}finally{e&&(g.current=!1)}});n=!0,t||(p.current=o,y.current=e)},[]),v=(0,Se.useCallback)(()=>{null!==p.current&&((y.current??m.current).cancelAnimationFrame(p.current),p.current=null,y.current=null)},[]);(0,Se.useEffect)(()=>()=>{v()},[v]);const k=(0,Se.useRef)(()=>{}),w=(0,Se.useRef)(()=>{}),j=(0,Se.useRef)(null),M=(0,Se.useRef)(null),S=(0,Se.useRef)(null),A=(0,Se.useCallback)(()=>{const e=j.current;j.current=null,e&&k.current(e)},[]),C=(0,Se.useCallback)(e=>{if(j.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===M.current){const e=m.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,M.current=null,S.current=null,A()});t||(M.current=n,S.current=e)}},[A]),L=(0,Se.useCallback)(()=>{j.current=null,null!==M.current&&((S.current??m.current).cancelAnimationFrame(M.current),M.current=null,S.current=null),w.current()},[]);(0,Se.useEffect)(()=>()=>{j.current=null,null!==M.current&&((S.current??m.current).cancelAnimationFrame(M.current),M.current=null,S.current=null)},[]);const R=e.themeDirtyRef;return Ze(()=>{R&&(Fe++,R.current=!0,x())},[u,x,R]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:o,size:r,margin:i,adjustedWidth:s,adjustedHeight:a,resolvedForeground:l,resolvedBackground:c,currentTheme:u,transition:h,introEnabled:d,tableId:f,rafRef:p,renderFnRef:b,scheduleRender:x,cancelRender:v,hoverHandlerRef:k,hoverLeaveRef:w,onPointerMove:C,onPointerLeave:L}}var Ke=require("react"),Je=require("react"),et={fresh:1,aging:.7,stale:.45,expired:.25},tt={alpha:1,band:"fresh",isStale:!1};var nt=require("react/jsx-runtime");function ot({isStale:e,position:t}){return(0,nt.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 rt=require("react"),it=l(require("react")),st=require("react/jsx-runtime"),at={fill:(e,t)=>(0,st.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,st.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function lt(e,t,n,o,r){let i;return i="function"==typeof n?n(e):(0,at[n])(o(e,t),r),i}function ct({swatchSize:e}){return(0,st.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 ut(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var ht=(e,t,n,o,r,i,s,a,l,c,u)=>{const{type:h="fill",styleFn:d,items:f}=e,p=[];let m=0;const y=!(!t&&!n),g="isolate"===c||void 0===c&&null!=r,{swatchSize:b,labelGap:x,rowHeight:v}=u;return f.forEach((e,c)=>{const u=lt(e,c,h,d,b),k=ut(e,o,r),w=r&&r.size>0&&r.has(e.label);p.push((0,st.jsxs)("g",{transform:`translate(0,${m})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:y?a===i&&c===s?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&g?w||!1:void 0,"aria-current":y&&!g&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:y?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:y?t=>{l(a,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{n&&n(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&&(0,st.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+x+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,w&&(0,st.jsx)(ct,{swatchSize:b}),(0,st.jsx)("text",{y:b/2,x:b+x,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),m+=v}),p};function dt({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:r,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+it.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),s=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,st.jsx)("stop",{offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))},e))}return(0,st.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,st.jsx)("defs",{children:(0,st.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,st.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,st.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,st.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),(0,st.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,st.jsx)("stop",{offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))},e))}return(0,st.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,st.jsx)("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,st.jsx)("defs",{children:(0,st.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,st.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,st.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),(0,st.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function ft(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:h}=e,d=function(e){const t=Math.max(1,e?.swatchSize??16),n=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(h),[f,p]=it.useState(0),[m,y]=it.useState(0),g=it.useCallback((e,t)=>{p(e),y(t)},[]),b="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{let h=24;const d=[];return e.forEach((e,f)=>{h+=5,d.push((0,st.jsx)("line",{stroke:"gray",x1:0,y1:h,x2:t,y2:h},"legend-top-line legend-symbol-"+f)),h+=8,e.label&&(h+=16,d.push((0,st.jsx)("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),h+=8),d.push((0,st.jsx)("g",{className:"legend-item",transform:`translate(0,${h})`,children:ht(e,n,o,r,i,s,a,f,l,c,u)},"legend-group-"+f)),h+=e.items.length*u.rowHeight+8}),d})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:g,legendInteraction:s,metrics:d}):(({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:h})=>{let d=0;const f=[];e.forEach((e,t)=>{let p=0;e.label&&(p+=16);const m=((e,t,n,o,r,i,s,a,l,c,u,h)=>{const{type:d="fill",styleFn:f,items:p}=e,m=[],{swatchSize:y,labelGap:g,itemGap:b,rowHeight:x,align:v}=u,k=!(!t&&!n),w="isolate"===c||void 0===c&&null!=r,j=p.map(e=>y+g+7*e.label.length),M=[];let S=0,A=0;j.forEach((e,t)=>{const n=0===A?e:A+b+e;h&&h>0&&A>0&&n>h?(M.push({start:S,end:t,width:A}),S=t,A=e):A=n}),p.length>0&&M.push({start:S,end:p.length,width:A}),M.forEach((e,c)=>{let u="center"===v?Math.max(0,((h??e.width)-e.width)/2):"end"===v?Math.max(0,(h??e.width)-e.width):0;for(let h=e.start;e.end>h;h++){const e=p[h],v=lt(e,h,d,f,y),M=ut(e,o,r),S=r&&r.size>0&&r.has(e.label);m.push((0,st.jsxs)("g",{transform:`translate(${u},${c*x})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:k?a===i&&h===s?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?S||!1:void 0,"aria-current":k&&!w&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:k?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(h+("ArrowRight"===n.key?1:-1)+p.length)%p.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:k?t=>{l(a,h),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:M,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&(0,st.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:y+g+2+7*e.label.length,height:y+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,S&&(0,st.jsx)(ct,{swatchSize:y}),(0,st.jsx)("text",{y:y/2,x:y+g,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+h)),u+=j[h]+b}});const C=Math.max(0,...M.map(e=>e.width)),L=M.length;return{items:m,offset:C,totalRows:L,totalHeight:L*x}})(e,o,r,i,s,a,l,t,c,u,h,h.maxWidth??n);p+=m.offset+5,f.push({label:e.label,...m,offset:p,totalRows:m.totalRows,totalHeight:m.totalHeight}),d+=p+12});const p=h.maxWidth??n;let m=d>p?0:"center"===h.align?Math.max(0,(p-d)/2):"end"===h.align?Math.max(0,p-d):0;const y=[];return f.forEach((n,o)=>{const r=e[o];r.label&&(y.push((0,st.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-"+o)),m+=16),y.push((0,st.jsx)("g",{className:"legend-item",transform:`translate(${m},0)`,children:n.items},"legend-group-"+o)),m+=n.offset+5,e[o+1]&&y.push((0,st.jsx)("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+o)),m+=12}),(0,st.jsx)("g",{children:y})})({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:g,legendInteraction:s,metrics:d}),x=!(!n&&!o);return(0,st.jsxs)("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"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,st.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 pt(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}var mt=require("react/jsx-runtime");function yt(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",legendLayout:s,title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:h,legendInteraction:d}=e;if(!t)return null;const f="top"===i||"bottom"===i,p=!!a,m=Math.max(0,n-r.left-r.right),y=Math.max(1,f?s?.maxWidth??m:100);let g,b;return"left"===i?(g=Math.max(4,r.left-y-10),b=r.top):"top"===i?(g=r.left,b=p?32:8):"bottom"===i?(g=r.left,b=o-r.bottom+38):(g=n-r.right+10,b=r.top),(0,mt.jsx)("g",{transform:`translate(${g}, ${b})`,children:(x=t,"object"==typeof x&&null!==x&&"gradient"in x?(0,mt.jsx)(dt,{config:t.gradient,orientation:f?"horizontal":"vertical",width:y}):pt(t)?(0,mt.jsx)(ft,{legendGroups:t.legendGroups,title:"",width:y,orientation:f?"horizontal":"vertical",legendLayout:s,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:h,legendInteraction:d}):t)});var x}var gt=require("react"),bt=require("d3-array"),xt=require("react/jsx-runtime");function vt(e){return"string"==typeof e?{type:e}:e}function kt({orient:e,config:t,values:n,scale:o,size:r,length:i}){const s=function(e){return{type:e.type,bins:e.bins??20,fill:e.fill??"#4e79a7",fillOpacity:e.fillOpacity??.5,stroke:e.stroke??"none",strokeWidth:e.strokeWidth??1}}(t),a="top"===e||"bottom"===e,l=(0,gt.useMemo)(()=>{if(0===n.length)return null;const t=o.domain(),l=r-8;if("boxplot"===s.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],s=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],i+1.5*s)}}(n);if(!t)return null;const{q1:r,median:i,q3:c,whiskerLow:u,whiskerHigh:h}=t,d=Math.min(.5*l,20),f=(l-d)/2+4;if(a){const t=o(r),n=o(c),a=o(i),l=o(u),p=o(h),m="top"===e?-1:1,y=0;return(0,xt.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,xt.jsx)("line",{x1:l,y1:y+m*(f+d/2),x2:p,y2:y+m*(f+d/2),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,xt.jsx)("line",{x1:l,y1:y+m*f,x2:l,y2:y+m*(f+d),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,xt.jsx)("line",{x1:p,y1:y+m*f,x2:p,y2:y+m*(f+d),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,xt.jsx)("rect",{x:Math.min(t,n),y:"top"===e?y-f-d:y+f,width:Math.abs(n-t),height:d,fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,xt.jsx)("line",{x1:a,y1:"top"===e?y-f-d:y+f,x2:a,y2:"top"===e?y-f:y+f+d,stroke:s.fill,strokeWidth:2})]})}{const t=o(r),n=o(c),a=o(i),l=o(u),p=o(h),m="left"===e?-1:1,y=0;return(0,xt.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,xt.jsx)("line",{x1:y+m*(f+d/2),y1:l,x2:y+m*(f+d/2),y2:p,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,xt.jsx)("line",{x1:y+m*f,y1:l,x2:y+m*(f+d),y2:l,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,xt.jsx)("line",{x1:y+m*f,y1:p,x2:y+m*(f+d),y2:p,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,xt.jsx)("rect",{x:"left"===e?y-f-d:y+f,y:Math.min(t,n),width:d,height:Math.abs(n-t),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,xt.jsx)("line",{x1:"left"===e?y-f-d:y+f,y1:a,x2:"left"===e?y-f:y+f+d,y2:a,stroke:s.fill,strokeWidth:2})]})}}const c=(0,bt.bin)().domain(t).thresholds(s.bins)(n);if(0===c.length)return null;const u=ie(c.map(e=>e.length));if(0===u)return null;if("histogram"===s.type)return(0,xt.jsx)("g",{"data-testid":"marginal-histogram-"+e,children:c.map((t,n)=>{if(null==t.x0||null==t.x1)return null;const r=t.length/u*l;if(a){const i=o(t.x0),a=o(t.x1)-o(t.x0);return(0,xt.jsx)("rect",{x:i,y:"top"===e?-4-r:4,width:Math.max(a,.5),height:r,fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},n)}{const i=o(t.x0),a=o(t.x1)-o(t.x0);return(0,xt.jsx)("rect",{x:"left"===e?-4-r:4,y:Math.min(i,i+a),width:r,height:Math.abs(a),fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},n)}})});if("violin"===s.type){const t=l/2+4,n=[];for(const r of c){if(null==r.x0||null==r.x1)continue;const i=r.length/u*(l/2),s=o((r.x0+r.x1)/2);n.push(a?`${s},${"top"===e?-(t-i):t-i}`:`${"left"===e?-(t-i):t-i},${s}`)}for(let r=c.length-1;r>=0;r--){const i=c[r];if(null==i.x0||null==i.x1)continue;const s=i.length/u*(l/2),h=o((i.x0+i.x1)/2);n.push(a?`${h},${"top"===e?-(t+s):t+s}`:`${"left"===e?-(t+s):t+s},${h}`)}return(0,xt.jsx)("g",{"data-testid":"marginal-violin-"+e,children:(0,xt.jsx)("polygon",{points:n.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}if("ridgeline"===s.type){const t=[];if(a){const n=0,r=null!=c[0].x0?o(c[0].x0):0;t.push(`M${r},${n}`);for(const n of c){if(null==n.x0||null==n.x1)continue;const r=n.length/u*l,i=o((n.x0+n.x1)/2);t.push(`L${i},${"top"===e?-r-4:r+4}`)}const s=null!=c[c.length-1].x1?o(c[c.length-1].x1):i;t.push(`L${s},${n}`),t.push("Z")}else{const n=0,r=null!=c[0].x0?o(c[0].x0):0;t.push(`M${n},${r}`);for(const n of c){if(null==n.x0||null==n.x1)continue;const r=n.length/u*l,i=o((n.x0+n.x1)/2);t.push(`L${"left"===e?-r-4:r+4},${i}`)}const s=null!=c[c.length-1].x1?o(c[c.length-1].x1):i;t.push(`L${n},${s}`),t.push("Z")}return(0,xt.jsx)("g",{"data-testid":"marginal-ridgeline-"+e,children:(0,xt.jsx)("path",{d:t.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}return null},[n,o,s,r,i,e,a,4]);return l?(0,xt.jsx)("g",{className:"marginal-"+e,"data-testid":"marginal-"+e,children:l}):null}var wt=l(require("react")),jt=require("react/jsx-runtime");function Mt(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>o?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function St(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 At(e,t,n,o){if(!e)return(0,jt.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,jt.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let h=a;h&&"dynamic"!==h||(h="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let d="start";"topBottom"===u?"right"===h?d="end":"middle"===h&&(d="middle"):d=0>t?"end":"start";const f=16,p=i?c?[i]:Mt(i,l):[],m=r?c?[r]:Mt(r,l):[],y="leftRight"===u?"end"===d?-4:4:0;let g=0;const b=[],x=o||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push((0,jt.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===d?y-l:"middle"===d?y-l/2:y,y:-16,width:l,height:Math.max(f,(p.length+m.length)*f+(i&&r?2:0))+f,style:{overflow:"visible"},children:(0,jt.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:x,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===d?"right":"middle"===d?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&(0,jt.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),r&&(0,jt.jsx)("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")):(p.length>0&&(b.push((0,jt.jsx)("text",{className:"annotation-note-title",fill:x,textAnchor:d,fontWeight:"bold",children:p.map((e,t)=>(0,jt.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-title")),g=p.length*f),m.length>0&&b.push((0,jt.jsx)("text",{className:"annotation-note-label",fill:x,textAnchor:d,y:g,children:m.map((e,t)=>(0,jt.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let v=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),v=(0,jt.jsx)("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(p.length+m.length)*f+(m.length>0?f:0);let t=0,n=e;"bottom"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),v=(0,jt.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,p.length+m.length-1)*f;let w=0;return"topBottom"===u?w=0>n?-(k+2):18:"leftRight"===u&&(w="middle"===h?-(k+f+(m.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>n?-(k+2):18),(0,jt.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[(0,jt.jsx)("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:b}),v]})}function Ct(e,t,n,o,r){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push((0,jt.jsx)("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,o=t?.height||0;(e>0||o>0)&&i.push((0,jt.jsx)("rect",{width:e,height:o,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,s=r||0;if(void 0!==t?.x){const o=(t.x||0)-e;i.push((0,jt.jsx)("line",{x1:o,y1:(t.y1||0)-s,x2:o,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const o=(t.y||0)-s;i.push((0,jt.jsx)("line",{x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push((0,jt.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push((0,jt.jsx)("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",o=t?.width??t?.height;void 0!==o&&i.push((0,jt.jsx)("path",{d:St(e,o,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,jt.jsx)("g",{className:"annotation-subject",children:i})}function Lt(e,t,n,o,r,i){const s=[];let a=0,l=0;if("callout-circle"!==r&&"label"!==r||!i?.radius){if("callout-rect"===r&&i){const n=i.width||0,o=i.height||0;if(n>0||o>0){const r=n/2,i=o/2,s=e-r,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=n/2,h=o/2,d=e*h>t*u?u/e:h/t;a=r+s*d,l=i+c*d}}}else if("bracket"===r&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(a=e/2,l=n):void 0!==t&&(a=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);a=Math.cos(o)*n,l=Math.sin(o)*n}}const c=Math.sqrt((e-a)**2+(t-l)**2);if(c>.5){const r=o||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let u=Math.atan2(t-l,e-a);if(i){const o=(a+e)/2,i=(l+t)/2,h=-(t-l)/c,d=(e-a)/c,f=(n?.curve??.25)*c,p=o+h*f,m=i+d*f;s.push((0,jt.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${p},${m} ${e},${t}`,fill:"none",stroke:r},"connector-line")),u=Math.atan2(m-l,p-a)}else s.push((0,jt.jsx)("line",{x1:a,y1:l,x2:e,y2:t,stroke:r},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;s.push((0,jt.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,jt.jsx)("g",{className:"annotation-connector",children:s})}function Rt(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:h,className:d,disable:f,opacity:p,strokeDasharray:m,events:y={},"data-testid":g}=e,b=Array.isArray(t)?t[0]??0:t,x=Array.isArray(n)?n[0]??0:n,v=new Set(Array.isArray(f)?f:[]);let k=o||0,w=r||0;null!=i&&(k=i-b),null!=s&&(w=s-x);const j="string"==typeof u?u:"label";if("bracket"===j&&c&&0===k&&0===w)if(void 0!==c.width){k=c.width/2;const e=c.depth||30;w=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;k=e+(0>e?-5:5),w=c.height/2}return(0,jt.jsxs)("g",{className:("annotation "+(d||"")).trim(),transform:`translate(${b},${x})`,"data-testid":g,...null!=p&&{opacity:p},...m&&{strokeDasharray:m},...y,children:[!v.has("connector")&&Lt(k,w,l,h,j,c),!v.has("subject")&&Ct(j,c,h,b,x),!v.has("note")&&At(a,k,w,h)]})}function Pt(e){const{noteData:t}=e,{screenCoordinates:n}=t,o="string"==typeof t.type?t.type:"label",r=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),r=t.ny||n[0][1]+(t.dy??0),i=n.map((n,i)=>{const s=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:r});return(0,jt.jsx)(Rt,{"data-testid":"semiotic-annotation",...s,type:o},"multi-annotation-"+i)});return(0,jt.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,jt.jsx)(Rt,{"data-testid":"semiotic-annotation",events:r,...t,type:o},s)}var It=require("d3-hierarchy"),Dt=require("d3-shape"),zt=l(require("regression"));function Ot(e,t){const n=t.scales?.x??t.scales?.time;return n?null!=e.x?n(e.x):t.xAccessor&&null!=e[t.xAccessor]?n(e[t.xAccessor]):null:null}function Tt(e,t){const n=t.scales?.y??t.scales?.value;return n?null!=e.y?n(e.y):t.yAccessor&&null!=e[t.yAccessor]?n(e[t.yAccessor]):null:null}function Et(e){return null==e?null:e+""}function Nt(e,t,n){return t.stickyPositionCache?.set(e,n),n}function $t(e,t,n){const o=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===o){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const r=n.pointNodes[o];if(r.pointId===e.pointId)return Nt(t,n,{x:r.x,y:r.y})}const o=function(e){const t=e.data;if(!t||0===t.length)return null;const n=t[t.length-1],o=e.scales?.x??e.scales?.time,r=e.scales?.y??e.scales?.value;if(!o||!r)return null;const i=n[e.xAccessor||"x"],s=n[e.yAccessor||"y"];return null==i||null==s?null:{x:o(i),y:r(s)}}(n);return o?Nt(t,n,o):null}if("semantic"===o){const o=function(e,t,n){const o=function(e){return Et(e.provenance?.stableId??e.stableId)}(e);if(!o)return null;const r=n.pointNodes?.find(e=>Et(e.pointId)===o);if(r)return Nt(t,n,{x:r.x,y:r.y});const i=n.data?.find(e=>function(e){return Et(e.stableId??e.id??e.provenance?.stableId)}(e)===o);if(!i)return null;const s=Ot(i,n),a=Tt(i,n);return null==s||null==a?null:Nt(t,n,{x:s,y:a})}(e,t,n);if(o)return o}let r=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(r=t.x,i=t.y)}if(null!=r&&null!=i||(r=Ot(e,n),i=Tt(e,n)),null!=r&&null!=i)return Nt(t,n,{x:r,y:i});if("sticky"===o){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function Wt(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}var _t=require("react/jsx-runtime"),Bt={secondary:0,primary:3};function Ht(e){return!0===e?._annotationDeferred}function Ft(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function qt(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function Gt(e){return Math.max(.72,.95-.06*e)}var Vt=require("react/jsx-runtime"),Ut={linear:Dt.curveLinear,monotoneX:Dt.curveMonotoneX,monotoneY:Dt.curveMonotoneY,step:Dt.curveStep,stepAfter:Dt.curveStepAfter,stepBefore:Dt.curveStepBefore,basis:Dt.curveBasis,cardinal:Dt.curveCardinal,catmullRom:Dt.curveCatmullRom};var Zt=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function Yt(e){return!!e&&"object"==typeof e&&Zt.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function Xt(e){return"primary"===e?.emphasis||!0===e?.defensive}function Qt(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 Kt(e){let t;const n=e?.emphasis;t="primary"===n?100:"secondary"===n?10:50;const o=e?.provenance?.confidence;switch("number"==typeof o&&Number.isFinite(o)&&(t+=15*Math.max(0,Math.min(1,o))),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}new Set(["label","callout","callout-circle","callout-rect"]);var Jt=32,en=6,tn=4,nn=8,on=72;var rn={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function sn(e){if(!an(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 an(e){return Yt(e)}function ln(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),r=[];let i="";for(const e of o)i&&i.length+e.length+1>n?(r.push(i),i=e):i=i?`${i} ${e}`:e;return i&&r.push(i),r}function cn(e,t,n,o,r){const i=e+n,s=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?i-r.width-4:i+4,y:0>o?s-r.height:s,width:r.width,height:r.height}:{x:0>n?i-r.width:i,y:0>o?s-r.height-4:s+4,width:r.width,height:r.height}}function un(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function hn(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 dn(e,t,n,o,r,i,s,a){const l=un(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const r=Math.max(0,o-e.x),i=Math.max(0,o-e.y);return(r+Math.max(0,e.x+e.width-(t-o)))*e.height+(i+Math.max(0,e.y+e.height-(n-o)))*e.width}(l,r,i,a);for(const e of n)c+=12*hn(l,e);for(const e of o)c+=4*hn(l,e);return c}function fn(e){const{annotations:t,context:n,defaultOffset:o=Jt,notePadding:r=en,markPadding:i=tn,edgePadding:s=nn,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=on,density:u,progressiveDisclosure:h=!1,redundantCues:d=!1,responsive:f,mobile:p,cohesion:m,audience:y}=e,g=n.width||0,b=n.height||0,x="object"==typeof p?p:{},v=x.breakpoint??480,k=!!p&&v>=g,w=k&&!1!==x.preferShortText?t.map(sn):t,j=k&&!u?{maxAnnotations:x.maxAnnotations??("callout-list"===x.strategy?1:2),minVisible:x.minVisible??1}:u,M=h||k&&(!1!==x.progressiveDisclosure||"callout-list"===x.strategy),S=k&&!f?x.responsive??{minWidth:v}:f,A=k&&!m?x.cohesion:m;if(0===w.length||0>=g||0>=b)return w.slice();const C=[],L=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(n,i);let R=!1;const P=w.map((e,t)=>{if(!an(e))return e;const i=function(e,t,n){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const o=e.pointId??e.nodeId;if(null!=o&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===o);if(e)return{x:e.x,y:e.y}}const r=e.coordinates,i=n.scales?.geoProjection;if(Array.isArray(r)&&r.length>=2&&i){const e=r[0],t=r[1];if("number"==typeof e&&"number"==typeof t){const n=i([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?$t(e,t,n):{x:e.x,y:e.y}}(e,t,n);if(!i)return e;const u=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...ln("string"==typeof e.title?e.title:void 0,t),...ln("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("number"==typeof(h=e).dx||"number"==typeof h.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return C.push(un(cn(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),r)),e}var h;let d=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(o)){const t=dn(cn(i.x,i.y,e.dx,e.dy,u),e,C,L,g,b,r,s);f>t&&(d=e,f=t)}if(!d)return e;const p=un(cn(i.x,i.y,d.dx,d.dy,u),r);C.push(p);const m=Math.hypot(d.dx,d.dy),y=l&&m>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return R=!0,{...e,dx:d.dx,dy:d.dy,...y?{connector:y}:{}}}),I=R?P:w.slice();let D=I;if(d){let e=!1;const t=I.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return n!==t&&(e=!0),n});D=e?t:I}{let e=!1;const t=D.map(t=>{if(!0!==t?.defensive)return t;const n=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const n="string"==typeof t.source?rn[t.source]??t.source:null,o="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!n&&!o)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[n,o].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${r})`)?e:{...e,label:i?`${i} (${r})`:`(${r})`}}(t);return n!==t&&(e=!0),n});D=e?t:D}const z=new Set;if(j){const e="object"==typeof j?j:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(y),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??Qt(g,b,e))*t))},{deferred:o}=function(e){const{annotations:t,width:n,height:o}=e,r=Math.max(0,e.minVisible??1),i=Qt(n,o,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,Yt(n))};var n}),a=s.filter(e=>e.note);if(0===a.length||i>=a.length)return{visible:t.slice(),deferred:[],budget:i};const l=a.filter(e=>Xt(e.annotation)),c=a.filter(e=>!Xt(e.annotation)).sort((e,t)=>Kt(t.annotation)-Kt(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,i-l.length),Math.max(0,r-l.length))),h=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),d=[],f=[];for(const{annotation:e,index:t,note:n}of s)!n||h.has(t)?d.push(e):f.push(e);return{visible:d,deferred:f,budget:i}}({annotations:D,width:g,height:b,...n});for(const e of o)z.add(e)}if(S&&("object"==typeof S&&"number"==typeof S.minWidth?S.minWidth:480)>=g)for(const e of D)an(e)&&"secondary"===e.emphasis&&z.add(e);if(z.size>0)for(const e of D)!0===e?.defensive&&z.delete(e);let O;return O=0===z.size?D:M?D.map(e=>z.has(e)?{...e,_annotationDeferred:!0}:e):D.filter(e=>!z.has(e)),A?function(e,t){let n=!1;const o=e.map(e=>an(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?o:e}(O,A):O}var pn=require("react"),mn={positions:new Map},yn=new Set;function gn(){for(const e of yn)e()}function bn(e,t){const n=mn.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(mn.positions);o.delete(e),mn={positions:o},gn()}function xn(e,t){const n=mn.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const o=new Map(mn.positions);o.delete(e),mn={positions:o},gn()}function vn(){return mn}function kn(e){return yn.add(e),()=>yn.delete(e)}var wn={positions:new Map};function jn(){return()=>{}}function Mn(){return wn}function Sn(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],r=n[n.length-1],i=o instanceof Date,s=o instanceof Date?o.getTime():o,a=r instanceof Date?r.getTime():r;if(2>t||s===a)return i?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?a:s+e*l;c[e]=i?new Date(n):n}return c}(e,t):e.ticks(t)}var An=require("react/jsx-runtime");function Cn(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function Ln(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function Rn(e){if(0===e.length)return{min:null,max:null};let t=1/0,n=-1/0;for(const o of e)t>o.pixel&&(t=o.pixel),o.pixel>n&&(n=o.pixel);return{min:t,max:n}}function Pn(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function In(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let s="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*r}`,s+=`L${Math.min(n,t)},${o}`}return s}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);s+=`L${o+4*r},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}}function Dn(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function zn(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function On(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,axes:l,xLabel:c,yLabel:u,yLabelRight:h,xFormat:d,yFormat:f,axisExtent:p,showGrid:m,title:y,legend:g,legendHoverBehavior:b,legendClickBehavior:x,legendHighlightedCategory:v,legendIsolatedCategories:k,legendPosition:w="right",legendLayout:j,foregroundGraphics:M,marginalGraphics:S,xValues:A,yValues:C,annotations:L,autoPlaceAnnotations:R,svgAnnotationRules:P,xAccessor:I,yAccessor:D,annotationData:z,pointNodes:O,curve:T,underlayRendered:E,canvasObscuresUnderlay:N=!0,linkedCrosshairName:$,linkedCrosshairSourceId:W,children:_}=e,B=(0,rt.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"bottom"===e.orient),n=e?.tickFormat||d||Dn,o=Math.max(2,Math.floor(t/70)),r=e?.ticks??5,i="exact"===p?Math.max(2,r):Math.min(r,o),c=e?.tickValues??Sn(s.x,i,p),u=c.map(e=>e.valueOf()),h=c.map((e,t)=>({value:e,pixel:s.x(e),label:n(e,t,u)})),f=h.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),m=e?.autoRotate?Math.max(20,Math.min(f+8,55)):Math.max(55,f+8);let y=zn(h,m);if(y.length>1&&(y=y.filter((e,t)=>0===t||e.label+""!=y[t-1].label+"")),e?.includeMax&&y.length>0&&"exact"!==p&&!e?.tickValues){const e=s.x.domain()[1],t=s.x(e),o=y[y.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e,y.length,u);m>t-o&&y.length>1&&(y=y.slice(0,-1)),y.push({value:e,pixel:t,label:r})}}return y},[a,s,l,d,t,p]),H=(0,rt.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||f||Dn,o=Math.max(2,Math.floor(n/30)),r=e?.ticks??5,i="exact"===p?Math.max(2,r):Math.min(r,o);let c=zn((e?.tickValues??Sn(s.y,i,p)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22);if(c.length>1&&(c=c.filter((e,t)=>0===t||e.label+""!=c[t-1].label+"")),e?.includeMax&&c.length>0&&"exact"!==p&&!e?.tickValues){const e=s.y.domain()[1],n=s.y(e),o=c[c.length-1].pixel;if(Math.abs(n-o)>1){const r=t(e);22>Math.abs(n-o)&&c.length>1&&(c=c.slice(0,-1)),c.push({value:e,pixel:n,label:r})}}return c},[a,s,l,f,n,p]),F=(0,rt.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"right"===e.orient);if(!e)return[];const t=e.tickFormat||f||Dn,o=Math.max(2,Math.floor(n/30)),r=e.ticks??5;return zn((e.tickValues??Sn(s.y,"exact"===p?Math.max(2,r):Math.min(r,o),p)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22)},[a,s,l,f,n,p]),q=(0,rt.useRef)(new Map),G=(0,rt.useRef)(L?.length??0),V=L?.length??0;G.current!==V&&(G.current=V,q.current=new Map);const U=(0,rt.useMemo)(()=>{if(!L||0===L.length)return null;const e=function(e,t,n){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const o=$t(e,t,n);if(!o)return null;const{x:r,y:i}=o;if(!Wt(r,i,n))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,Vt.jsx)(Pt,{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 o=Ot(null!=e.value?{...e,x:e.value}:e,n);if(null==o)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let s;s="bottom"===i?(n.height||0)-4:"center"===i?(n.height||0)/2:12;const a=o>.6*(n.width||0),l=a?o-4:o+4,c=a?"end":"start";return(0,Vt.jsxs)("g",{opacity:e.opacity,children:[(0,Vt.jsx)("line",{x1:o,y1:0,x2:o,y2:n.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,Vt.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 o=Tt(null!=e.value?{...e,y:e.value}:e,n);if(null==o)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let s,a;return"left"===i?(s=4,a="start"):"center"===i?(s=(n.width||0)/2,a="middle"):(s=(n.width||0)-4,a="end"),(0,Vt.jsxs)("g",{opacity:e.opacity,children:[(0,Vt.jsx)("line",{x1:0,y1:o,x2:n.width||0,y2:o,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,Vt.jsx)("text",{x:s,y:o-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 o=(e.coordinates||[]).map(e=>({x:Ot({...e,type:"point"},n),y:Tt({...e,type:"point"},n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const r=(0,It.packEnclose)(o),i=e.padding||10;return(0,Vt.jsxs)("g",{children:[(0,Vt.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,Vt.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 o=(e.coordinates||[]).map(e=>({x:Ot({...e,type:"point"},n),y:Tt({...e,type:"point"},n)})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const r=e.padding||10,i=o.map(e=>e.x),s=o.map(e=>e.y),[a,l]=re(i),[c,u]=re(s),h=a-r,d=l+r,f=c-r;return(0,Vt.jsxs)("g",{children:[(0,Vt.jsx)("rect",{x:h,y:f,width:d-h,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,Vt.jsx)("text",{x:(h+d)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:e.label})]},"ann-"+t)}case"highlight":{const o=n.data||[],r="function"==typeof e.filter?o.filter(e.filter):e.field&&null!=e.value?o.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return(0,Vt.jsx)("g",{children:r.map((t,o)=>{const r=Ot(t,n),s=Tt(t,n);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,Vt.jsx)("circle",{cx:r,cy:s,r:a,...l},"hl-"+o)})},"ann-"+t)}case"bracket":{const o=Ot(e,n),r=Tt(e,n);return(0,Vt.jsx)(Pt,{noteData:{x:o??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 o=n.data||[];if(2>o.length)return null;const r=n.xAccessor||"x",i=n.yAccessor||"y",s="ordinal"===n.frameType,a="horizontal"===n.projection,l=s?r:null,c=s?i:null;let u;const h=[],d=new Map;if(s&&l&&c){for(const e of o){const t=e[l];if(null==t)continue;const n=t+"";d.has(n)||(d.set(n,h.length),h.push(n))}u=o.map(e=>{const t=e[l],n=e[c];if(null==t||null==n)return null;const o=d.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else u=o.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=n.scales?.x??n.scales?.time,p=n.scales?.y??n.scales?.value;if(!f||!p)return null;const m=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(h.length-1,n+1),r=t-n,i=e(h[n]);return i+(e(h[o])-i)*r},y=f,g=p;let b;if(s)if(a){const e=m(g);b=(t,n)=>[y(n),e(t)]}else{const e=m(y);b=(t,n)=>[e(t),g(n)]}else b=(e,t)=>[y(e),g(t)];const x=e.method||"linear";let v;v="loess"===x?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,h=0,d=0,f=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,h+=t*r[e],d+=t*i[e],f+=t*r[e]*r[e],p+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const m=u*f-h*h;if(1e-12>Math.abs(m))a.push([t,d/u]);else{const e=(u*p-h*d)/m;a.push([t,(d-e*h)/u+e*t])}}return a}(u,e.bandwidth??.3):("polynomial"===x?zt.default.polynomial(u,{order:e.order||2}):zt.default.linear(u)).points;const k=v.map(([e,t])=>{const[n,o]=b(e,t);return`${n},${o}`}).join(" "),w=e.color||"#6366f1",j=v[v.length-1],[M,S]=b(j[0],j[1]);return(0,Vt.jsxs)("g",{children:[(0,Vt.jsx)("polyline",{points:k,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,Vt.jsx)("text",{x:M+4,y:S-4,fill:w,fontSize:11,children:e.label})]},"ann-"+t)}case"band":{const o=n.scales?.y??n.scales?.value,r=o?.(e.y0)??0,i=o?.(e.y1)??(n.height||0);return(0,Vt.jsxs)("g",{opacity:e.opacity,children:[(0,Vt.jsx)("rect",{x:0,y:Math.min(r,i),width:n.width||0,height:Math.abs(i-r),fill:e.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:e.fillOpacity||.1}),e.label&&(0,Vt.jsx)("text",{x:(n.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 o=n.scales?.x??n.scales?.time,r=null!=e.x0&&o?o(e.x0):null,i=null!=e.x1&&o?o(e.x1):null;return null==r||null==i?null:(0,Vt.jsxs)("g",{opacity:e.opacity,children:[(0,Vt.jsx)("rect",{x:Math.min(r,i),y:0,width:Math.abs(i-r),height:n.height||0,fill:e.fill||e.color||"var(--semiotic-primary, #6366f1)",fillOpacity:e.fillOpacity??.1}),e.label&&(0,Vt.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 o=n.data||[];if(2>o.length)return null;const r=n.xAccessor||"x",i=n.scales?.x??n.scales?.time,s=n.scales?.y??n.scales?.value;if(!i||!s)return null;const a=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=o.filter(e=>null!=e[a]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[r]-t[r]);if(2>u.length)return null;const h=Ut[n.curve||"linear"]||Dt.curveLinear,d=(0,Dt.area)().x(e=>i(e[r])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(h)(u);if(!d)return null;const f=e.fill||"#6366f1";return(0,Vt.jsxs)("g",{children:[(0,Vt.jsx)("path",{d:d,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,Vt.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 o=n.data||[];if(2>o.length)return null;const r=n.yAccessor||"y",i=n.scales?.x??n.scales?.time,s=n.scales?.y??n.scales?.value;if(!i||!s)return null;const a=o.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-l)**2,0)/a.length,u=Math.sqrt(c),h=e.threshold??2,d=l-h*u,f=!1!==e.showBand,p=e.fill||"#6366f1",m=e.fillOpacity??.1,y=e.anomalyColor||"#ef4444",g=e.anomalyRadius??6,b=s(l+h*u),x=s(d),v=o.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>h*u});return(0,Vt.jsxs)("g",{children:[f&&(0,Vt.jsx)("rect",{x:0,y:Math.min(b,x),width:n.width||0,height:Math.abs(x-b),fill:p,fillOpacity:m}),v.map((e,t)=>{const o=Ot(e,n),r=Tt(e,n);return null==o||null==r?null:(0,Vt.jsx)("circle",{cx:o,cy:r,r:g,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,Vt.jsx)("text",{x:(n.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:p,fontSize:11,children:e.label})]},"ann-"+t)}case"forecast":{const o=n.data||[];if(3>o.length)return null;const r=n.xAccessor||"x",i=n.yAccessor||"y",s=n.scales?.x??n.scales?.time,a=n.scales?.y??n.scales?.value;if(!s||!a)return null;const l=o.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=zt.default.polynomial(l,{order:e.order||2}).equation;c=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}else{const e=l.length;let t=0,n=0,o=0,r=0;for(const[e,i]of l)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*n)/i,a=(n-s*t)/e;c=e=>a+s*e}const u=l.length,h=l.map(([e,t])=>t-c(e)).reduce((e,t)=>e+t*t,0),d=Math.sqrt(h/Math.max(u-2,1)),f=l.reduce((e,t)=>e+t[0],0)/u,p=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,g=e.steps??5,b=l[u-1][0],x=(b-l[0][0])/Math.max(u-1,1),v=[];for(let e=1;g>=e;e++)v.push(b+e*x);const k=[];for(const e of v){const t=c(e),n=d*Math.sqrt(1+1/u+(p>0?(e-f)**2/p:0))*y;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const w=`M${k.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,j=k.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),M=`${s(b)},${a(c(b))}`,S=e.strokeColor||"#6366f1";return(0,Vt.jsxs)("g",{children:[(0,Vt.jsx)("path",{d:w,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,Vt.jsx)("polyline",{points:`${M} ${j}`,fill:"none",stroke:S,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&k.length>0&&(0,Vt.jsx)("text",{x:s(k[k.length-1].x)+4,y:a(k[k.length-1].yCenter)-4,fill:S,fontSize:11,children:e.label})]},"ann-"+t)}case"widget":{let o,r;if(null!=e.px&&null!=e.py)o=e.px,r=e.py;else{const i=$t(e,t,n);if(!i)return null;o=i.x,r=i.y}if(!Wt(o,r,n))return null;const i=e.width??32,s=e.height??32;return(0,Vt.jsx)("foreignObject",{x:o+(e.dx??0)-i/2,y:r+(e.dy??0)-s/2,width:i,height:s,style:{overflow:"visible",pointerEvents:"auto"},children:(0,Vt.jsx)("div",{style:{width:i,height:s,display:"flex",alignItems:"center",justifyContent:"center"},children:e.content??(0,Vt.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"})})},"ann-"+t)}case"text":{const o=$t(e,t,n);if(!o)return null;const{x:r,y:i}=o,s=r+(e.dx||0),a=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,Vt.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?wt.cloneElement(c,{key:"ann-text-"+t}):(0,Vt.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,Vt.jsx)("line",{x1:r,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),wt.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+t)}case"category-highlight":{const o=e.category;if(null==o)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=n.scales?.o,s=n.scales?.x,a=n.scales?.y,l=r(i)?i:r(s)?s:r(a)?a:null;if(!l)return null;const c=l(o+"");if(null==c)return null;const u=l.bandwidth(),h=e.color||"var(--semiotic-primary, #4589ff)",d=e.opacity??.15,f=e.label;return(0,Vt.jsxs)("g",(n.projection?"vertical"===n.projection:l===s)?{children:[(0,Vt.jsx)("rect",{x:c,y:0,width:u,height:n.height||0,fill:h,fillOpacity:d}),f&&(0,Vt.jsx)("text",{x:c+u/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]}:{children:[(0,Vt.jsx)("rect",{x:0,y:c,width:n.width||0,height:u,fill:h,fillOpacity:d}),f&&(0,Vt.jsx)("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+t)}default:return null}},o={scales:s?{x:s.x,y:s.y,time:s.x,value:s.y}:null,timeAxis:"x",xAccessor:I,yAccessor:D,width:t,height:n,data:z,frameType:"xy",pointNodes:O,curve:T,stickyPositionCache:q.current};return function(e,t,n,o){const r=[];return e.forEach((e,i)=>{let s;if(n){const r=n(e,i,o);s=null!=r?r:t(e,i,o)}else s=t(e,i,o);s&&r.push({node:s,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:qt(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),o=e.some(e=>Ht(e.annotation)),r=e.some(e=>null!=Ft(e.annotation)),i=e.some(e=>"layer"===Ft(e.annotation));if(!n&&!o&&!r)return e.map(e=>e.node);const s=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of t)e.emphasis&&(e.rank=Bt[e.emphasis]);const a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:o,readingOrder:r}=e,i=Ht(t.annotation);let s=t.node;if("primary"===o||"secondary"===o||null!=r){const e=null==o&&null!=r;s=(0,_t.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+o,..."secondary"===o?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:Gt(r),"data-annotation-reading-order":r}:{},children:t.node},"annotation-emphasis-"+n)}const a=Ft(t.annotation);return a&&(s=(0,_t.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+n)),i&&(s=(0,_t.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+n)),s});return o&&a.unshift((0,_t.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,_t.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)}(R?fn({annotations:L,context:o,..."object"==typeof R?R:{}}):L,e,P,o)},[L,R,P,t,n,I,D,z,s,O,T]),Z=function(e){const t=(0,pn.useSyncExternalStore)(e?kn:jn,e?vn:Mn,e?vn:Mn);return e?t.positions.get(e)??null:null}($);return(0,rt.useEffect)(()=>{if(!Z?.locked||!$)return;const e=e=>{"Escape"===e.key&&xn($)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[Z?.locked,$]),a||y||g||M||S||U&&U.length>0||m||_||Z?(0,An.jsxs)("svg",{role:"img",width:o,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,An.jsx)("title",{children:"string"==typeof y?y:"XY Chart"}),(0,An.jsx)("desc",{children:"string"==typeof y?y+" — XY data visualization":"XY data visualization"}),(0,An.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[m&&s&&(!E||N)&&(()=>{const e=Pn(l?.find(e=>"bottom"===e.orient)?.gridStyle),o=Pn(l?.find(e=>"left"===e.orient)?.gridStyle);return(0,An.jsxs)("g",{className:"stream-grid",children:[B.map((t,o)=>(0,An.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+o)),H.map((e,n)=>(0,An.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+n))]})})(),a&&s&&(()=>{const e=l?.find(e=>"left"===e.orient),o=l?.find(e=>"bottom"===e.orient),r=!e||!1!==e.baseline,s=!o||!1!==o.baseline,a=e?.jaggedBase||!1,d=o?.jaggedBase||!1,f=o?.landmarkTicks,p=e?.landmarkTicks,m="var(--semiotic-border, #ccc)",y="var(--semiotic-text-secondary, var(--semiotic-text, #666))",g="var(--semiotic-text, #333)",b=!!o?.autoRotate&&B.length>1&&(()=>{const e=t/Math.max(B.length-1,1);return B.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),x=b?12:18,v=n+(b?58:40),k={fontSize:"var(--semiotic-tick-font-size, 12px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},j={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},M=o?.tickAnchor,S=e?.tickAnchor,A=Rn(B),C=Rn(H);return(0,An.jsxs)("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(0,An.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!E||N)&&s&&!d&&(0,An.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:m,strokeWidth:1}),(!E||N)&&d&&(0,An.jsx)("path",{d:In("bottom",t,n),fill:"none",stroke:m,strokeWidth:1}),B.map((e,t)=>{const o=!!f&&("function"==typeof f?f(e.value,t):he(e.value,t>0?B[t-1].value:void 0));return(0,An.jsxs)("g",{transform:`translate(${e.pixel},${n})`,children:[(0,An.jsx)("line",{y2:5,stroke:m,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,An.jsx)("text",{y:x,textAnchor:b?"end":Cn(M,e.pixel===A.min,e.pixel===A.max),fontWeight:o?600:400,fill:y,className:"semiotic-axis-tick",style:{userSelect:"none",...o?w:k},transform:b?"rotate(-45)":void 0,children:e.label}):(0,An.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,An.jsx)("div",{style:{textAlign:"center",userSelect:"none",...k},children:e.label})})]},"xtick-"+t)}),c&&(0,An.jsx)("text",{x:t/2,y:v,textAnchor:"middle",fill:g,className:"semiotic-axis-label",style:{userSelect:"none",...j},children:c})]}),(0,An.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!E||N)&&r&&!a&&(0,An.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:m,strokeWidth:1}),(!E||N)&&a&&(0,An.jsx)("path",{d:In("left",t,n),fill:"none",stroke:m,strokeWidth:1}),H.map((e,t)=>{const n=!!p&&("function"==typeof p?p(e.value,t):he(e.value,t>0?H[t-1].value:void 0));return(0,An.jsxs)("g",{transform:`translate(0,${e.pixel})`,children:[(0,An.jsx)("line",{x2:-5,stroke:m,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,An.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:Ln(S,e.pixel===C.min,e.pixel===C.max),fontWeight:n?600:400,fill:y,className:"semiotic-axis-tick",style:{userSelect:"none",...n?w:k},children:e.label}):(0,An.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,An.jsx)("div",{style:{textAlign:"right",userSelect:"none",...k},children:e.label})})]},"ytick-"+t)}),(()=>{const t=e?.label||u;return t?(0,An.jsx)("text",{x:15-i.left,y:n/2,textAnchor:"middle",fill:g,transform:`rotate(-90, ${15-i.left}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...j},children:t}):null})()]}),(()=>{const e=l?.find(e=>"right"===e.orient);if(!e||0===F.length)return null;const o=!1!==e.baseline,r=e.landmarkTicks,s=e.label||h,a=e.tickAnchor,c=Rn(F);return(0,An.jsxs)("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&(0,An.jsx)("line",{x1:t,y1:0,x2:t,y2:n,stroke:m,strokeWidth:1}),F.map((e,n)=>{const o=!!r&&("function"==typeof r?r(e.value,n):he(e.value,n>0?F[n-1].value:void 0));return(0,An.jsxs)("g",{transform:`translate(${t},${e.pixel})`,children:[(0,An.jsx)("line",{x2:5,stroke:m,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,An.jsx)("text",{x:8,textAnchor:"start",dominantBaseline:Ln(a,e.pixel===c.min,e.pixel===c.max),fontWeight:o?600:400,fill:y,className:"semiotic-axis-tick",style:{userSelect:"none",...o?w:k},children:e.label}):(0,An.jsx)("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,An.jsx)("div",{style:{textAlign:"left",userSelect:"none",...k},children:e.label})})]},"ytick-r-"+n)}),s&&(0,An.jsx)("text",{x:t+i.right-15,y:n/2,textAnchor:"middle",fill:g,transform:`rotate(90, ${t+i.right-15}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...j},children:s})]})})()]})})(),U,S&&s&&A&&C&&(0,An.jsxs)(An.Fragment,{children:[S.top&&(0,An.jsx)("g",{transform:"translate(0, 0)",children:(0,An.jsx)(kt,{orient:"top",config:vt(S.top),values:A,scale:s.x,size:i.top,length:t})}),S.bottom&&(0,An.jsx)("g",{transform:`translate(0, ${n})`,children:(0,An.jsx)(kt,{orient:"bottom",config:vt(S.bottom),values:A,scale:s.x,size:i.bottom,length:t})}),S.left&&(0,An.jsx)("g",{transform:"translate(0, 0)",children:(0,An.jsx)(kt,{orient:"left",config:vt(S.left),values:C,scale:s.y,size:i.left,length:n})}),S.right&&(0,An.jsx)("g",{transform:`translate(${t}, 0)`,children:(0,An.jsx)(kt,{orient:"right",config:vt(S.right),values:C,scale:s.y,size:i.right,length:n})})]}),M,Z&&Z.sourceId!==W&&s?.x&&(()=>{const e=s.x(Z.xValue);if(null==e||0>e||e>t)return null;const o=Z.locked;return(0,An.jsx)("line",{x1:e,y1:0,x2:e,y2:n,stroke:o?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:o?1.5:1,strokeDasharray:o?"6,3":"4,4",pointerEvents:"none"})})(),_]}),y&&(0,An.jsx)("text",{x:o/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 y?y:null}),yt({legend:g,totalWidth:o,totalHeight:r,margin:i,legendPosition:w,title:y,legendLayout:j,legendHoverBehavior:b,legendClickBehavior:x,legendHighlightedCategory:v,legendIsolatedCategories:k})]}):null}l(require("react")),require("d3-shape");var Tn=require("react/jsx-runtime");function En(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}var Nn="undefined"==typeof window||"undefined"==typeof document,$n=require("react"),Wn="undefined"!=typeof window?$n.useLayoutEffect:$n.useEffect,_n=()=>()=>{},Bn=()=>!1,Hn=()=>!0,Fn=require("react");function qn(e,t){const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function Gn(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 Vn(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 Un=l(require("react")),Zn=l(require("react")),Yn=(require("react/jsx-runtime"),Zn.createContext(null));function Xn(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,o]of Object.entries(e))n.startsWith("_")||null!=o&&""!==o&&("number"==typeof o?Number.isFinite(o)&&(t[n]=o):"string"==typeof o?t[n]=o:"boolean"==typeof o?t[n]=o+"":o instanceof Date&&(t[n]=o.toISOString().slice(0,10)));return t}function Qn(e){return e&&"object"==typeof e?e:{}}function Kn(e){return Qn(e.accessibility).tableFields??e.accessibleDatum??e.datum}var Jn=require("react/jsx-runtime"),eo={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function to(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}var no=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},oo="semiotic-accessible-data-table",ro=oo+" semiotic-accessible-data-table-hidden",io=oo+" semiotic-accessible-data-table-visible",so={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"},ao={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},lo={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},co={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},uo={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},ho={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},fo={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},po={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 mo({scene:e,chartType:t,tableId:n,chartTitle:o}){const[r,i]=Un.useState(!1),[s,a]=Un.useState(5),l=Zn.useContext(Yn),c=l?.visible??!1,u=r||c,h=Un.useRef(null),d=o?"Data summary for "+o:n?`Data summary for ${t} ${n}`:"Data summary for "+t;Un.useEffect(()=>{u||a(5)},[u]);const f=Un.useCallback(e=>{e.target===e.currentTarget&&(r||c||i(!0))},[r,c]),p=Un.useCallback(e=>{c||h.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return n?(0,Jn.jsx)("span",{id:n,tabIndex:-1,style:eo}):null;if(!u)return(0,Jn.jsx)("div",{id:n,className:ro,tabIndex:-1,onFocus:f,style:eo,role:"region","aria-label":d,children:(0,Jn.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 n=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const o of e)if(o&&"object"==typeof o&&null!==o.datum)try{switch(o.type){case"point":if(n)break;t.push({label:"Point",values:Xn(Kn(o))});break;case"line":case"area":{const e=Kn(o),n=Array.isArray(e)?e:[],r="line"===o.type?"Line point":"Area point";for(const e of n)t.push({label:r,values:Xn(e)});break}case"rect":{const e=Kn(o),n=null!=e&&"object"==typeof e?e:{},r=n.category??o.group??"",i=n.value??n.__aggregateValue??n.total,s=Xn(n);null==s.category&&""!==r&&(s.category=r+""),null==s.value&&null!=i&&(s.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:s});break}case"heatcell":{const e=Xn(Kn(o));null==e.value&&"number"==typeof o.value&&Number.isFinite(o.value)&&(e.value=o.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=Kn(o),n=Xn(e);if(null==n.category){const t=Qn(e),o=t.category??t.label;null!=o&&(n.category=o+"")}t.push({label:"Wedge",values:n});break}case"circle":t.push({label:"Node",values:Xn(Kn(o))});break;case"arc":t.push({label:"Arc",values:Xn(Kn(o))});break;case"candlestick":t.push({label:"Candlestick",values:Xn(Kn(o))});break;case"geoarea":{const e=Qn(Kn(o)),n=Xn(e);if(null==n.name){const t=Qn(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}(e),y=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(m),g=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${no(e.min)} to ${no(e.max)}, mean ${no(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(" ")}(m.length,y),b=Math.min(s,m.length),x=m.slice(0,b),v=m.length-b,k=new Set;for(const e of x)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return(0,Jn.jsxs)("div",{ref:h,id:n,className:io,tabIndex:-1,onBlur:p,style:so,role:"region","aria-label":d,children:[(0,Jn.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:lo,children:"×"}),(0,Jn.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:ao,children:g}),(0,Jn.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:co,children:[(0,Jn.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:fo,children:v>0?`First ${b} of ${m.length} data points`:`All ${m.length} data points`}),(0,Jn.jsx)("thead",{children:(0,Jn.jsxs)("tr",{children:[(0,Jn.jsx)("th",{style:uo,children:"type"}),w.map(e=>(0,Jn.jsx)("th",{style:uo,children:e},e))]})}),(0,Jn.jsx)("tbody",{children:x.map((e,t)=>(0,Jn.jsxs)("tr",{children:[(0,Jn.jsx)("td",{style:ho,children:e.label}),w.map(t=>{return(0,Jn.jsx)("td",{style:ho,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":no(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),v>0&&(0,Jn.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:po,children:["Show ",Math.min(25,v)," more"," ",1===v?"row":"rows"," (",v," remaining)"]})]})}function yo({summary:e}){return e?(0,Jn.jsx)("div",{role:"note",style:eo,children:e}):null}function go({tableId:e}){return(0,Jn.jsx)("a",{href:"#"+e,style:eo,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,eo)},children:"Skip to data table"})}function bo({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return(0,Jn.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:eo,children:t})}var xo=Object.freeze([]);function vo(e){if(!e)return xo;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}var ko=require("react/jsx-runtime"),wo="var(--semiotic-focus, #005fcc)";function jo({active:e,hoverPoint:t,margin:n,size:o,shape:r="circle",width:i,height:s,pathData:a}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==r&&"path"!==r||!a)if("rect"===r&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);u=(0,ko.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:wo,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,ko.jsx)("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:wo,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:wo,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,ko.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:(0,ko.jsx)("path",{d:a,fill:"none",stroke:wo,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,ko.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var Mo=l(require("react"));function So(e,t){return"touch"===t?Math.max(e,24):e}var Ao=["name","label","title"],Co=["type","kind","category","group","class","status","role","shape"],Lo=["value","amount","total","count","weight","score"],Ro=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 Po(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}var Io=require("react/jsx-runtime"),Do={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 zo(e,t){return"function"==typeof t?t(e):e[t]}function Oo(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function To(e={}){const{fields:t,title:n,format:o,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(n){const t=zo(e,n);s=Oo(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const s=zo(e,r);a.push({label:n,value:Oo(s,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=Oo(e[n],o);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=Oo(e[t[0]],o))}}const l={...Do,...r};return(0,Io.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,Io.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,Io.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,Io.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function Eo(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=Array.isArray(o=!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)?o[0]:o;var o;("node"===e?.nodeOrEdge&&"number"==typeof n?.x0&&"number"==typeof n?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof n?.sankeyWidth)&&n.data&&"object"==typeof n.data&&(n=n.data);const r=t(n);return null==r?null:(0,Io.jsx)("div",{className:"semiotic-tooltip",style:Do,children:r})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?To(e):To())}}var No=require("react/jsx-runtime");function $o({x:e,y:t,containerWidth:n,containerHeight:o,margin:r,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=Mo.useRef(null),[u,h]=Mo.useState(null);Mo.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[i,s,n,o]);let d;d=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>o-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*o>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!Mo.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if(!0===n["data-semiotic-tooltip-chrome"])return!0;if("true"===n["data-semiotic-tooltip-chrome"])return!0;const o=n.style;if(o&&"object"==typeof o){if(null!=o.background&&""!==o.background&&"transparent"!==o.background)return!0;if(null!=o.backgroundColor&&""!==o.backgroundColor&&"transparent"!==o.backgroundColor)return!0}return!1}(i),p=f?null:Do;return l?(0,No.jsx)("div",{ref:c,className:f?s:(s+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:r.left+e,top:r.top+t,transform:d,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var Wo=require("d3-zoom"),_o=require("d3-selection");function Bo(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Ho(e,t,n=.6){if(!Bo(t))return;const o=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,r=t.cx??t.x??0,i=t.cy??t.y??0;e.beginPath(),e.arc(r,i,o,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Fo(e,t,n,o=.35){Bo(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}var qo=require("d3-shape"),Go=require("d3-shape");function Vo(e){switch(e){case"monotoneX":return Go.curveMonotoneX;case"monotoneY":return Go.curveMonotoneY;case"cardinal":return Go.curveCardinal;case"catmullRom":return Go.curveCatmullRom;case"step":return Go.curveStep;case"stepBefore":return Go.curveStepBefore;case"stepAfter":return Go.curveStepAfter;case"basis":return Go.curveBasis;case"natural":return Go.curveNatural;default:return null}}function Uo(e,t,n){return null==t?n:"string"!=typeof t?t:Ue(e,t)||n}function Zo(e,t,n,o,r,i){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const a=e.createLinearGradient(n,o,r,i);for(const e of s)a.addColorStop(e.offset,e.color);return a}function Yo(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function Xo(e,t,n,o,r,i){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let i=r;l>o&&(i*=o/l),l>a-o&&(i*=(a-o)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function Qo(e,t,n,o,r){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=pe(i,t.size);if(0>=s.scale)return;const a=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=a)return;const l=t=>{const n=Uo(e,t,t);return"string"==typeof n?n:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(n,o),t.rotation&&e.rotate(t.rotation),e.translate(s.offsetX,s.offsetY),e.scale(s.scale,s.scale),e.globalAlpha=r*a*(t.style.fillOpacity??1);const u=xe(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&ke(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),ke(e,i,c,t.accent,void 0,l),e.restore()}function Ko(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=Math.round(t[0]*o),s=Math.round(t[1]*o),a=i/t[0],l=s/t[1],c=t[0]+"px",u=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==u&&(e.style.height=u),e.width===i&&e.height===s||(e.width=i,e.height=s),r.setTransform(a,0,0,l,0,0),r.translate(n.left,n.top),r}function Jo(){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))}function er([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t,n]}function tr(e,t,n,o,r){return"function"==typeof e?e(t,n,o,r):e.replace("{z}",t+"").replace("{x}",n+"").replace("{y}",o+"").replace("{r}",r>1?"@2x":"")}var nr=class{constructor(e=256){this.cache=new Map,this.limit=e}get(e){const t=this.cache.get(e);return t&&(t.lastUsed=performance.now()),t}set(e,t){this.cache.set(e,t),this.cache.size>this.limit&&this.evict()}evict(){for(;this.cache.size>this.limit;){let e,t=1/0;for(const[n,o]of this.cache)t>o.lastUsed&&(t=o.lastUsed,e=n);if(!e)break;{const t=this.cache.get(e);t&&(t.img.onload=null,t.img.onerror=null,t.img.src=""),this.cache.delete(e)}}}clear(){for(const e of this.cache.values())e.img.onload=null,e.img.onerror=null,e.img.src="";this.cache.clear()}};var or=class{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,lineIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const n=this.particles[t];if(!n.active)return n.active=!0,n.t=0,n.offset=.6*(Math.random()-.5),n.lineIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n,o){for(let r=0;this.capacity>r;r++){const i=this.particles[r];if(!i.active)continue;const s=n[i.lineIndex];if(!s||2>s.length){i.active=!1;continue}if(i.t+=e*t,i.t>=1){i.active=!1;continue}const a=rr(s),l=ir(s,i.t*a),c=(o[i.lineIndex]||2)/2;i.x=l.x+l.nx*i.offset*c*2,i.y=l.y+l.ny*i.offset*c*2}}countForLine(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].lineIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}};function rr(e){let t=0;for(let n=1;e.length>n;n++){const o=e[n][0]-e[n-1][0],r=e[n][1]-e[n-1][1];t+=Math.sqrt(o*o+r*r)}return t}function ir(e,t){let n=0;for(let o=1;e.length>o;o++){const r=e[o][0]-e[o-1][0],i=e[o][1]-e[o-1][1],s=Math.sqrt(r*r+i*i);if(n+s>=t||o===e.length-1){const a=s>0?(t-n)/s:0,l=s>.001?s:1;return{x:e[o-1][0]+r*a,y:e[o-1][1]+i*a,nx:-i/l,ny:r/l}}n+=s}const o=e[e.length-1];return{x:o[0],y:o[1],nx:0,ny:0}}var sr=l(require("react"));function ar(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:sr.createElement(sr.Fragment,null,...t)}var lr=l(require("react")),cr=require("react/jsx-runtime"),ur=lr.createContext(null);function hr({value:e,children:t}){return(0,cr.jsx)(ur.Provider,{value:e,children:t})}function dr(e,t){return null!=e?(0,cr.jsx)(hr,{value:t,children:e}):e}function fr(e){if(!e)return;const t=[];for(const n of e)if("point"===n.type)t.push(n);else if("glyph"===n.type){const e=n,o=ve(e.glyph,e.size);t.push({pointId:e.pointId,x:e.x+o.centerDx,y:e.y+o.centerDy,r:o.radius})}return t}require("react/jsx-runtime");var pr=require("react/jsx-runtime");function mr({data:e}){if(!e)return null;if(e.properties)return(0,pr.jsx)("div",{className:"semiotic-tooltip",style:Do,children:(0,pr.jsx)("div",{style:{fontWeight:600},children:e.properties.name||e.properties.NAME||e.properties.id||"Feature"})});const t=null!=e.data?e.data:e;if(!t||"object"!=typeof t)return null;const n=function(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const n=t.maxEntries??6,o=!1!==t.skipPositional,r=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(o&&Ro.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&r.push({key:t,lower:t.toLowerCase(),value:n})}if(0===r.length)return{entries:[]};let i=r.findIndex(e=>Ao.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=Po(l,Co),u=Po(l,Lo),h=new Set(Co),d=new Set(Lo),f=[];c&&f.push({key:c.key,value:c.value}),u&&f.push({key:u.key,value:u.value});for(const e of l){if(f.length>=n)break;e!==c&&e!==u&&(h.has(e.lower)||d.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:a?.key,title:a?.value,entries:f}}(t),o=null!=n.title?n.title+"":null;return null==o&&0===n.entries.length?null:(0,pr.jsxs)("div",{className:"semiotic-tooltip",style:Do,children:[null!=o&&(0,pr.jsx)("div",{style:{fontWeight:600,marginBottom:n.entries.length?2:0},children:o}),n.entries.map(e=>{return(0,pr.jsxs)("div",{children:[(0,pr.jsxs)("span",{style:{opacity:.7},children:[e.key,": "]}),(0,pr.jsx)("span",{style:{fontWeight:600},children:(t=e.value,null==t?"–":"number"==typeof t?Math.abs(t)>9999?t.toLocaleString():t+"":t instanceof Date?t.toLocaleDateString():t+"")})]},e.key);var t})]})}mr.ownsChrome=!0;var yr={top:10,right:10,bottom:10,left:10},gr=null;function br(){if(null!==gr)return gr;if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t="undefined"!=typeof navigator&&"number"==typeof navigator.hardwareConcurrency&&4>=navigator.hardwareConcurrency,n="undefined"!=typeof navigator&&"number"==typeof navigator.deviceMemory&&4>=navigator.deviceMemory;return gr=e||t||n}function xr(){return br()?12:30}var vr={width:28,height:28,border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,background:"rgba(255,255,255,0.9)",color:"#333",fontSize:16,fontWeight:600,lineHeight:1,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,boxShadow:"0 1px 3px rgba(0,0,0,0.1)"};function kr(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function wr(e){return e?e.getContext("2d"):null}var jr=require("react/jsx-runtime"),Mr=(0,u.memo)((0,u.forwardRef)(function(e,t){const{projection:n,projectionExtent:o,fitPadding:r,projectionTransform:i,areas:s,points:a,lines:l,customLayout:c,layoutConfig:h,layoutSelection:d,onLayoutError:f,xAccessor:p,yAccessor:m,lineDataAccessor:y,pointIdAccessor:g,lineIdAccessor:b,lineType:x="geo",flowStyle:v="basic",graticule:k,zoomable:w,zoomExtent:j,onZoom:M,dragRotate:S,showParticles:A,particleStyle:C,tileURL:L,tileAttribution:R,tileCacheSize:P,size:I,width:D,height:z,responsiveWidth:O,responsiveHeight:T,margin:E,className:N,background:$,areaStyle:W,pointStyle:_,lineStyle:B,colorScheme:H,enableHover:F=!0,hoverAnnotation:q,tooltipContent:G,allowTooltipOverflow:V=!1,customClickBehavior:U,customHoverBehavior:Z,annotations:Y,autoPlaceAnnotations:X,decay:Q,pulse:K,transition:J,animate:ee,staleness:te,backgroundGraphics:ne,foregroundGraphics:oe,title:re,legend:ie,legendPosition:se,legendLayout:ae,legendHoverBehavior:ce,legendClickBehavior:ue,legendHighlightedCategory:he,legendIsolatedCategories:de,legendCategoryAccessor:fe,onCategoriesChange:me,showAxes:ge,accessibleTable:be=!0,description:ke,summary:je}=e,Me=I||[D||600,z||400],Se=(0,u.useRef)(!0),Ae=Qe({sizeProp:Me,responsiveWidth:O,responsiveHeight:T,userMargin:E,marginDefault:yr,foregroundGraphics:oe,backgroundGraphics:ne,animate:ee,transitionProp:J,themeDirtyRef:Se}),{reducedMotionRef:Ce,responsiveRef:Le,size:Re,margin:Ie,adjustedWidth:De,adjustedHeight:ze,resolvedForeground:Oe,resolvedBackground:Te,transition:Ee,introEnabled:Ne,tableId:$e,rafRef:We,renderFnRef:_e,scheduleRender:Be,cancelRender:He,currentTheme:Fe}=Ae,qe=function(){const[e,t]=(0,$n.useState)(!1);return Wn(()=>{t(!0)},[]),e}(),Ge=function(){const e=(0,$n.useSyncExternalStore)(_n,Bn,Hn);return(0,$n.useRef)(e).current}(),Ve=(0,u.useMemo)(()=>Array.isArray(s)?vo(s):s,[s]),Ze=(0,u.useMemo)(()=>vo(a),[a]),Ye=(0,u.useMemo)(()=>vo(l),[l]),Xe=(0,u.useMemo)(()=>null!=S?S:"orthographic"===kr(n),[S,n]),nt=function(e){const t=(0,Fn.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Gn(e,t);if(!Vn(e)||!Vn(t))return!1;const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],r=t[o];if(!Object.is(n,r))if(Array.isArray(n)&&Array.isArray(r)){if(!Gn(n,r))return!1}else{if(!Vn(n)||!Vn(r))return!1;if(!qn(n,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}((0,u.useMemo)(()=>({projection:n,projectionExtent:o,fitPadding:r,xAccessor:p,yAccessor:m,lineDataAccessor:y,lineType:x,flowStyle:v,areaStyle:W,pointStyle:_,lineStyle:B,colorScheme:H,themeSemantic:Pe(Fe),themeSequential:Fe?.colors?.sequential,themeDiverging:Fe?.colors?.diverging,themeCategorical:Fe?.colors?.categorical,graticule:k,projectionTransform:i,decay:Q,pulse:K,transition:Ee,introAnimation:Ne,annotations:Y,pointIdAccessor:g,lineIdAccessor:b,customLayout:c,layoutConfig:h,onLayoutError:f,layoutMargin:Ie}),[n,o,r,p,m,y,x,v,W,_,B,H,k,i,Q,K,Ee?.duration,Ee?.easing,Ne,Y,g,b,Fe,c,h,f,Ie])),rt=(0,u.useRef)(null);rt.current||(rt.current=new le(nt));const it=(0,u.useRef)(null),st=(0,u.useRef)(null),at=(0,u.useRef)(null),lt=(0,u.useRef)(null),ct=(0,u.useRef)(null);L&&!ct.current&&(ct.current=new nr(P||256));const ut=(0,u.useRef)(Y),ht=(0,u.useRef)(null),dt=(0,u.useRef)(Wo.zoomIdentity),ft=(0,u.useRef)(!1),pt=(0,u.useRef)(null),mt=(0,u.useCallback)(e=>{pt.current=e,Le&&"object"==typeof Le&&(Le.current=e)},[Le]),yt=(0,u.useRef)(null),gt=(0,u.useRef)(null),bt=(0,u.useRef)(null),xt=(0,u.useRef)(0);if(A&&!bt.current){const e=C?.maxPerLine??xr();bt.current=new or(50*e)}const vt=(0,u.useRef)(null),kt=(0,u.useRef)(null),wt=(0,u.useRef)(!1),jt=(0,u.useRef)(void 0),[Mt,St]=(0,u.useState)(null),[At,Ct]=(0,u.useState)(0),Lt=(0,u.useRef)(0),[Rt,Pt]=(0,u.useState)(!1),It=(0,u.useRef)([]),Dt=(0,u.useRef)(fe),zt=(0,u.useRef)(me);Dt.current=fe,zt.current=me;const Ot=(0,u.useCallback)(()=>{const e=Dt.current,t=zt.current;if(!t||!e)return;const n=function(e,t){if(!t)return[];const n=new Set,o=[];for(const r of e){if(!r||"object"!=typeof r)continue;const e="function"==typeof t?t(r):r[t];if(null==e)continue;const i=e+"";n.has(i)||(n.add(i),o.push(i))}return o}(rt.current?.getPoints()??[],e);(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})(n,It.current)||(It.current=n,t(n))},[]);!function(e,t,n,o){(0,Ke.useEffect)(()=>{e.current?.updateConfig(t),n.current=!0,o()},[t,o,e,n])}(rt,nt,Se,Be),function(e,t,n,o){const r=(0,Ke.useRef)(null);(0,Ke.useEffect)(()=>{const i=e.current;if(!i)return;const s=t??null;r.current!==s&&(r.current=s,i.setLayoutSelection(s),i.hasCustomRestyle?i.restyleScene(s):n.current=!0,o())},[t,o,e,n])}(rt,d,Se,Be),(0,u.useEffect)(()=>{const e=rt.current;e&&(Ve&&e.setAreas(Ve),a&&e.setPoints(Ze),l&&e.setLines(Ye),Se.current=!0,Be())},[Ve,a,Ze,l,Ye,Be]);const Tt=(0,u.useCallback)(e=>{null!=e&&"object"==typeof e&&(rt.current?.pushPoint(e),Se.current=!0,Be())},[Be]),Et=(0,u.useCallback)(e=>{const t=vo(e);0!==t.length&&(rt.current?.pushMany(t),Se.current=!0,Be())},[Be]),Nt=(0,u.useCallback)(e=>{null!=e&&"object"==typeof e&&(rt.current?.pushLine(e),Se.current=!0,Be())},[Be]),$t=(0,u.useCallback)(e=>{const t=vo(e);0!==t.length&&(rt.current?.pushManyLines(t),Se.current=!0,Be())},[Be]),Wt=(0,u.useCallback)(()=>{rt.current?.clear(),Se.current=!0,Be()},[Be]);(0,u.useImperativeHandle)(t,()=>({push:Tt,pushMany:Et,removePoint:e=>{const t=rt.current?.removePoint(e)??[];return t.length>0&&(Se.current=!0,Be()),t},pushLine:Nt,pushManyLines:$t,removeLine:e=>{const t=rt.current?.removeLine(e)??[];return t.length>0&&(Se.current=!0,Be()),t},getLines:()=>rt.current?.getLines()??[],clear:Wt,getProjection:()=>rt.current?.scales?.projection??null,getGeoPath:()=>rt.current?.scales?.geoPath??null,getCartogramLayout:()=>rt.current?.cartogramLayout??null,getCustomLayout:()=>rt.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>rt.current?.lastCustomLayoutFailure??null,getZoom:()=>dt.current.k,resetZoom:()=>{const e=pt.current;e&&ht.current&&(0,_o.select)(e).call(ht.current.transform,Wo.zoomIdentity)},getData:()=>rt.current?.getPoints()??[]}),[Tt,Et,Nt,$t,Wt,Be]);const{hoverHandlerRef:_t,onPointerMove:Bt,onPointerLeave:Ht}=Ae;(0,u.useEffect)(()=>{_t.current=e=>{if(!F)return;const t=rt.current;if(!t||!t.scene.length)return;const n=st.current;if(!n)return;const o=n.getBoundingClientRect(),r=e.clientX-o.left-Ie.left,i=e.clientY-o.top-Ie.top;if(0>r||r>De||0>i||i>ze)return vt.current=null,kt.current=null,St(null),Z?.(null),void Be();lt.current||(lt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const s=wr(lt.current);if(!s)return;const a=So(30,e.pointerType),l=So(6,e.pointerType),c=we(t.scene,r,i,a,s,t.quadtree,t.maxPointRadius,l);if(c){const e=c.node,t=e.datum,n=Array.isArray(t)?null:t?.properties?t:t?.data||t;let o,s;"point"===e.type?(o=e.x,s=e.y):"geoarea"===e.type?(o=e.centroid[0],s=e.centroid[1]):(o=r,s=i);const a={...n,...n?.properties||{},data:n,properties:n?.properties,__semioticHoverData:!0,x:o,y:s};vt.current=a,kt.current=e,St(a),Z?.(a),Be()}else vt.current&&(vt.current=null,kt.current=null,St(null),Z?.(null),Be())}},[F,De,ze,Ie,Z,Be]),Ae.hoverLeaveRef.current=()=>{vt.current=null,kt.current=null,St(null),Z?.(null),Be()};const Ft=(0,u.useCallback)(e=>{if(!U)return;const t=rt.current;if(!t||!t.scene.length)return void U(null);const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-Ie.left,r=e.clientY-n.top-Ie.top;if(0>o||o>De||0>r||r>ze)return void U(null);lt.current||(lt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const i=wr(lt.current);if(!i)return void U(null);const s=So(30,jt.current),a=So(6,jt.current),l=we(t.scene,o,r,s,i,t.quadtree,t.maxPointRadius,a);if(l){const e=l.node.datum,t=Array.isArray(e)?null:e?.properties?e:e?.data||e,n=t?.properties?{...t,...t.properties}:t;return void U({...n,data:t,properties:t?.properties,__semioticHoverData:!0,x:o,y:r,time:o,value:r})}U(null)},[ze,De,U,Ie]),qt=(0,u.useRef)(-1),Gt=(0,u.useRef)(null),Vt=(0,u.useCallback)(e=>{const t=rt.current;if(!t||0===t.scene.length)return;const n=function(e){const t=[];for(const n of e)if("point"===n.type&&null!=n.x)t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"});else if("glyph"===n.type){if(0>=n.size||null==n.datum)continue;const e=ve(n.glyph,n.size);t.push({x:n.x+e.centerDx,y:n.y+e.centerDy,datum:n.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight})}else"geoarea"===n.type&&n.centroid&&!1!==n.interactive&&t.push({x:n.centroid[0],y:n.centroid[1],datum:n.datum,shape:"geoarea",pathData:n.pathData});return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===n.length)return;const o=qt.current,r=function(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"PageDown":return Math.min(t+Math.max(1,Math.floor(.1*n)),n-1);case"PageUp":return Math.max(t-Math.max(1,Math.floor(.1*n)),0);case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}(e.key,0>o?-1:o,n.length);if(null===r)return;if(e.preventDefault(),0>r)return qt.current=-1,Gt.current=null,vt.current=null,kt.current=null,St(null),Z?.(null),void Be();const i=0>o?0:r;qt.current=i;const s=n[i];Gt.current={shape:s.shape,w:s.w,h:s.h,pathData:s.pathData};const a=s.datum,l={...a||{},...a?.properties||{},data:a,properties:a?.properties,x:s.x,y:s.y,__semioticHoverData:!0};vt.current=l,St(l),Z?.(l),Be()},[Z,Be]),Ut=(0,u.useCallback)(e=>{jt.current=e.pointerType,qt.current=-1,Gt.current=null,Bt(e)},[Bt]),Zt=(0,u.useCallback)(e=>{jt.current=e.pointerType},[]);_e.current=()=>{We.current=null;const e=st.current,t=rt.current;if(!e||!t)return;const n=performance.now();let o=!1;const r=gt.current;let i=!1;r&&(gt.current=null,t.applyRotation(r,{width:De,height:ze}),i=!0);const s=t.advanceTransition(Ce.current?n+1e6:n),a=!Ce.current&&s;let l=!1;if(Se.current&&!s){const n={width:De,height:ze},o=Xe?t.getRotation():null;t.computeScene(n);const r=dt.current,i=1!==r.k||0!==r.x||0!==r.y;Xe&&o?i?(t.setRotation(o),t.applyZoomScale(r.k,n)):t.applyRotation(o,n):i&&t.applyZoomTransform(r,n),Se.current=!1,l=!0,e.setAttribute("aria-label",to(t.scene,"Geographic chart")),Ot()}const c=Jo(),u=A&&!Ce.current&&!!bt.current,h=t.consumeStylePaintPending(),d=!!((f={dirtyOrRebuilt:l,transitioning:a,continuous:u,liveEncoding:t.hasActivePulses,forced:i||h}).dirtyOrRebuilt||f.transitioning||f.animationTicked||f.continuous||f.liveEncoding||f.forced);var f;if(L&&ct.current){const e=it.current;if(e&&t.scales?.projection){const n=Ko(e,Re,Ie,c);if(n){n.clearRect(-Ie.left,-Ie.top,Re[0],Re[1]),n.save(),n.beginPath(),n.rect(0,0,De,ze),n.clip();const e=function(e,t){const{tileURL:n,projection:o,width:r,height:i,tileCache:s,onTileLoad:a}=t,l=o.scale(),c=o.translate(),u=function(e){const{size:t,scale:n,translate:o,clampX:r=!0,clampY:i=!0}=e,s=Math.max(Math.log(n)/Math.LN2-8,0),a=Math.round(s),l=1<<a,c=Math.pow(2,s-a+8),u=o[0]-n/2,h=o[1]-n/2,d=Math.max(r?0:-1/0,Math.floor((0-u)/c)),f=Math.min(r?l:1/0,Math.ceil((t[0]-u)/c)),p=Math.max(i?0:-1/0,Math.floor((0-h)/c)),m=Math.min(i?l:1/0,Math.ceil((t[1]-h)/c)),y=[];for(let e=p;m>e;++e)for(let t=d;f>t;++t)y.push([t,e,a]);return{tiles:y,translate:[u/c,h/c],scale:c}}({size:[r,i],scale:2*l*Math.PI,translate:c}),h=Jo();let d=!0;for(const t of u.tiles){const[o,r,i]=er(t),l=`${i}/${o}/${r}`;let c=s.get(l);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:l,lastUsed:performance.now()};s.set(l,t),e.onload=()=>{t.loaded=!0,a?.()},e.onerror=()=>{t.loaded=!0},e.src=tr(n,i,o,r,h),c=t}if(!c.loaded){d=!1;continue}const f=u.scale;e.drawImage(c.img,(t[0]+u.translate[0])*f-.5,(t[1]+u.translate[1])*f-.5,f+1,f+1)}return d}(n,{tileURL:L,projection:t.scales.projection,width:De,height:ze,tileCache:ct.current,onTileLoad:()=>Be()});n.restore(),e||(o=!0)}}}if(d){const r=Ko(e,Re,Ie,c);if(!r)return;r.clearRect(-Ie.left,-Ie.top,Re[0],Re[1]),L||function(e,t){const{background:n,hasBackgroundGraphics:o=!1,themeBackground:r="",x:i=0,y:s=0,width:a,height:l}=t;if("transparent"===n)return!1;if(o)return!1;const c=n||(r&&"transparent"!==r?r:"")||null;if(!c)return!1;const u=Ue(e,c);u&&(e.fillStyle=u,e.fillRect(i,s,a,l))}(r,{background:$,width:De,height:ze}),r.save(),r.beginPath(),r.rect(0,0,De,ze),r.clip();const i=t.scene,s={width:De,height:ze};if(function(e,t){const n=t.filter(e=>"geoarea"===e.type);for(const t of n){if(!t.pathData)continue;t._cachedPath2D||(t._cachedPath2D=new Path2D(t.pathData));const n=t._cachedPath2D,o=t.style.fill||"#e0e0e0";if("none"!==o&&(e.fillStyle=o,e.globalAlpha=(t._decayOpacity??1)*(t.style.fillOpacity??1),e.fill(n)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=Ue(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||.5,e.globalAlpha=t._decayOpacity??1,t.style.strokeDasharray){const n=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(n)}else e.setLineDash([]);e.stroke(n)}Fo(e,t,n),e.globalAlpha=1,e.setLineDash([])}}(r,i),((e,t,n,o)=>{const r=t.filter(e=>"line"===e.type);for(const t of r){if(2>t.path.length)continue;const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,o.width*n,o.height),e.clip());const r=t.style.stroke||"#007bff",i=Ue(e,r)||r,s=t.style.strokeWidth||2,a=t.colorThresholds,l=t.rawValues;if(e.setLineDash(t.style.strokeDasharray?t.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),e.lineWidth=s,e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade){Xo(e,t.path,i,s,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=Vo(t.curve),u=a&&a.length>0&&l&&l.length===t.path.length,h=t._decayOpacities;if(h&&h.length===t.path.length&&!u){e.strokeStyle=i;const n=t.style.opacity??1;for(let o=0;t.path.length-1>o;o++)e.globalAlpha=.5*(h[o]+h[o+1])*n,e.beginPath(),e.moveTo(t.path[o][0],t.path[o][1]),e.lineTo(t.path[o+1][0],t.path[o+1][1]),e.stroke()}else if(u){let n=function(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),h=!0},o=function(){h&&(e.stroke(),h=!1)},r=null,s=null,c=null,u=null,h=!1;for(let h=0;t.path.length>h;h++){const[d,f]=t.path[h],p=l[h],m=Yo(p,a,i);if(null!==r&&null!==u&&null!==c){if(m===u)e.lineTo(d,f);else{const t=[];for(const e of a){const n=e.value;(c>n||n>p)&&(n>c||p>n)||c===n||p===n||t.push({t:(n-c)/(p-c)})}t.sort((e,t)=>e.t-t.t);for(const l of t){const t=r+(d-r)*l.t,u=s+(f-s)*l.t,h=Yo(c+(p-c)*Math.min(l.t+1e-4,1),a,i);e.lineTo(t,u),o(),n(h,t,u)}e.lineTo(d,f)}r=d,s=f,c=p,u=m}else n(m,d,f),r=d,s=f,c=p,u=m}o()}else{e.beginPath();const n=t.strokeGradient&&t.path.length>=2?Zo(e,t.strokeGradient,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=n||i,c)(0,qo.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,o]=t.path[0];e.moveTo(n,o);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}e.stroke()}if(t.style.fill&&t.style.fillOpacity&&t.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=t.style.fillOpacity,e.fillStyle=Uo(e,t.style.fill,t.style.fill),c&&!u)(0,qo.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,o]=t.path[0];e.moveTo(n,o);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}const n=t.path[0][0];e.lineTo(t.path[t.path.length-1][0],o.height),e.lineTo(n,o.height),e.closePath(),e.fill()}void 0!==n&&1>n&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(r,i,0,s),((e,t)=>{const n=t.filter(e=>"point"===e.type);if(0!==n.length){e.save();try{const t=e.globalAlpha;for(const o of n)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=Uo(e,o.style.fill,"#4e79a7"),e.fill(),o.style.stroke&&(e.strokeStyle=Uo(e,o.style.stroke,o.style.stroke),e.lineWidth=o.style.strokeWidth||1,e.stroke()),Ho(e,o)}finally{e.restore()}}})(r,i),((e,t)=>{const n=e.globalAlpha;for(const o of t)"glyph"===o.type&&Qo(e,o,o.x,o.y,n);e.globalAlpha=n})(r,i),u&&bt.current){const e=bt.current,t=i.filter(e=>"line"===e.type);if(t.length>0){const i=C||{},s=.3*(i.speedMultiplier??1),a=i.maxPerLine??xr(),l=i.spawnRate??(br()?.06:.15),c=i.radius??2,u=i.opacity??.7,h=n/1e3,d=xt.current>0?Math.min(h-xt.current,.1):.016;xt.current=h;const f=t.map(e=>e.path),p=t.map(e=>e.style.strokeWidth||2);for(let n=0;t.length>n;n++)Math.random()<l&&e.countForLine(n)<a&&e.spawn(n);e.step(d,s,f,p),r.globalAlpha=u;for(let n=0;e.particles.length>n;n++){const o=e.particles[n];if(!o.active)continue;const s=t[o.lineIndex],a="function"==typeof i.color?i.color(s?.datum??{}):"source"!==i.color&&i.color?i.color:s?.style.stroke||"#fff";r.beginPath(),r.arc(o.x,o.y,c,0,2*Math.PI),r.fillStyle=a,r.fill()}r.globalAlpha=1,o=!0}}r.restore()}const p=kt.current,m=!(!p||"geoarea"!==p.type&&"point"!==p.type),y=m||wt.current;const g=at.current;if(g&&y){const e=Ko(g,Re,Ie,c);if(e){if(e.clearRect(-Ie.left,-Ie.top,Re[0],Re[1]),p&&"geoarea"===p.type){const t=new Path2D(p.pathData);e.fillStyle="rgba(255, 255, 255, 0.3)",e.fill(t),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke(t)}if(p&&"point"===p.type){const t=p,n="object"==typeof q?q:void 0,o=n?.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(p);e.beginPath(),e.arc(t.x,t.y,t.r+3,0,2*Math.PI),o?(e.save(),e.globalAlpha=.4,e.fillStyle=o,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=o||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}wt.current=m}const b=Y!==ut.current;b&&(ut.current=Y),(l||b||a&&Y&&Y.length>0)&&(l||b||n-Lt.current>=33)&&(Ct(e=>e+1),Lt.current=n),(a||null!=t.activeTransition||t.hasActivePulses||o)&&Be()},function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:i,cancelRender:s,cleanup:a}=e;Wn(()=>{t&&n&&o.current?.cancelIntroAnimation?.(),r.current=!0,s?.(),i.current()},[t,n]);const l=(0,$n.useRef)(a);l.current=a,(0,$n.useEffect)(()=>()=>l.current?.(),[])}({hydrated:qe,wasHydratingFromSSR:Ge,storeRef:rt,dirtyRef:Se,renderFnRef:_e,cancelRender:He,cleanup:()=>ct.current?.clear()}),(0,u.useEffect)(()=>{Se.current=!0,Be()},[De,ze,$,Be]),function(e,t,n,o,r,i){const s=(0,Je.useRef)("fresh");(0,Je.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 tt;const n=null!=e.threshold&&e.threshold>0?e.threshold:5e3,o=e.graded;if(o){const e="object"==typeof o?o:{},r=function(e,t,n={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(n.fresh??1)>e?"fresh":t*(n.aging??1.5)>e?"aging":t*(n.stale??3)>e?"stale":"expired":"fresh"}(t,n,e.thresholds);return{alpha:{...et,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:tt}(e,l-a.lastIngestTime);c.band===s.current&&c.isStale===r||(s.current=c.band,c.isStale!==r&&i(c.isStale),n.current=!0,o())},1e3);return()=>clearInterval(a)},[e,r,o])}(te,rt,Se,Be,Rt,Pt),(0,u.useEffect)(()=>{if("production"!==process.env.NODE_ENV&&L){const e=kr(n);e&&"mercator"!==e&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${e}". Raster tiles use Web Mercator and will not align with other projections.`)}},[L,n]),(0,u.useEffect)(()=>{const e=pt.current;if(!w||!e)return ht.current&&e&&((0,_o.select)(e).on(".zoom",null),ht.current=null),void(e&&(0,_o.select)(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=j||[1,8],o={width:De,height:ze};if(Xe){let r=dt.current.k;const i=e=>{r=Math.max(t,Math.min(n,e)),dt.current=Wo.zoomIdentity.scale(r);const i=rt.current;i&&(i.applyZoomScale(r,o),Se.current=!1,Be(),i.scales?.projection&&M?.({projection:i.scales.projection,zoom:i.currentZoom}))};ht.current={scaleBy:(e,t)=>i(r*t),transform:(e,t)=>i(t?.k??1)};const s=e=>{e.preventDefault(),i(r*(0>e.deltaY?1.1:1/1.1))},a=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),i(1.5*r))};e.addEventListener("wheel",s,{passive:!1}),e.addEventListener("dblclick",a);const l=.4,c=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const o=rt.current;if(!o)return;const r=o.getRotation();yt.current={x:t.clientX,y:t.clientY,rotation:[...r]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{const t=yt.current;t&&(gt.current=[t.rotation[0]+(e.clientX-t.x)*l,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*l)),t.rotation[2]],Be())},h=t=>{if(!yt.current)return;yt.current=null,e.releasePointerCapture(t.pointerId);const n=gt.current;if(n){gt.current=null;const e=rt.current;e&&(e.applyRotation(n,o),Be())}const r=rt.current;r?.scales?.projection&&M?.({projection:r.scales.projection,zoom:r.currentZoom})};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",u),e.addEventListener("pointerup",h),e.addEventListener("pointercancel",h),()=>{e.removeEventListener("wheel",s),e.removeEventListener("dblclick",a),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",h),e.removeEventListener("pointercancel",h),ht.current=null}}const r=(0,Wo.zoom)().scaleExtent([t,n]).extent([[0,0],[Re[0],Re[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;dt.current=t,ft.current=!0;const n=rt.current;n&&(n.applyZoomTransform(t,o),Se.current=!1,Be())}).on("end",e=>{dt.current=e.transform,ft.current=!1;const t=rt.current;t?.scales?.projection&&M?.({projection:t.scales.projection,zoom:t.currentZoom})});return ht.current=r,(0,_o.select)(e).call(r),()=>{(0,_o.select)(e).on(".zoom",null)}},[w,j,Xe,Re,De,ze,Ie,M,Be]);const Yt=F&&!1!==q,Xt=Yt&&Mt?G?G(Mt):(0,jr.jsx)(mr,{data:Mt}):null,Qt=Xt?(0,jr.jsx)($o,{x:Mt.x,y:Mt.y,containerWidth:De,containerHeight:ze,margin:Ie,className:"stream-frame-tooltip",zIndex:10,children:Xt}):null;if(Nn||!qe&&Ge){const e=rt.current;e&&(Ve||a||l)&&(Ve&&e.setAreas(Ve),a&&e.setPoints(Ze),l&&e.setLines(Ye),e.computeScene({width:De,height:ze}));const t=e?.scene??[];return(0,jr.jsxs)("div",{ref:mt,className:"stream-geo-frame"+(N?" "+N:""),role:"img","aria-label":ke||("string"==typeof re?re:"Geographic chart"),style:{position:"relative",width:O?"100%":Re[0],height:T?"100%":Re[1]},children:[(0,jr.jsx)(yo,{summary:je}),(0,jr.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:Re[0],height:Re[1],style:{position:"absolute",left:0,top:0},children:[(0,jr.jsx)("g",{transform:`translate(${Ie.left},${Ie.top})`,children:Te}),(0,jr.jsxs)("g",{transform:`translate(${Ie.left},${Ie.top})`,children:[$&&(0,jr.jsx)("rect",{x:0,y:0,width:De,height:ze,fill:$}),t.map((e,t)=>function(e,t){switch(e.type){case"geoarea":{const n=e;return n.pathData?(0,Tn.jsx)("path",{d:n.pathData,fill:En(n.style.fill,"#e0e0e0"),fillOpacity:n.style.fillOpacity??1,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth||.5,strokeDasharray:n.style.strokeDasharray,opacity:n._decayOpacity??1},"geoarea-"+t):null}case"point":{const n=e;return(0,Tn.jsx)("circle",{cx:n.x,cy:n.y,r:n.r,fill:En(n.style.fill),fillOpacity:n.style.fillOpacity??.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n._decayOpacity??n.style.opacity??1},"point-"+t)}case"line":{const n=e;if(2>n.path.length)return null;const o="M"+n.path.map(e=>`${e[0]},${e[1]}`).join("L");return(0,Tn.jsx)("path",{d:o,fill:"none",stroke:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth||1.5,strokeDasharray:n.style.strokeDasharray,opacity:n.style.opacity??1},"line-"+t)}case"glyph":return function(e,t,n,o){const r=e.glyph;if(!r?.parts?.length||0>=e.size)return null;const i=pe(r,e.size);if(0>=i.scale)return null;const s=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,a=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=xe(r,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(o+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),h=t=>r.parts.map((n,o)=>{const r=t?"none"===n.fill?void 0:t:ye(n.fill,a,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:ye(n.stroke??"none",a,e.accent);return r||i?(0,Tn.jsx)("path",{d:n.d,fill:r??"none",stroke:i,strokeWidth:i?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},o):null});return(0,Tn.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,Tn.jsx)("clipPath",{id:c,children:(0,Tn.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,Tn.jsx)("g",{children:h(e.ghostColor)}):null,l&&c?(0,Tn.jsx)("g",{clipPath:`url(#${c})`,children:h()}):h()]},o)}(e,e.x,e.y,"geo-glyph-"+(e.pointId??t));default:return null}}(e,t))]})]}),(0,jr.jsx)(On,{width:De,height:ze,totalWidth:Re[0],totalHeight:Re[1],margin:Ie,scales:null,showAxes:!1,title:re,legend:ie,legendPosition:se,legendLayout:ae,legendHoverBehavior:ce,legendClickBehavior:ue,legendHighlightedCategory:he,legendIsolatedCategories:de,foregroundGraphics:ar(Oe,dr(rt.current?.customLayoutOverlays,d??null)),annotations:Y,autoPlaceAnnotations:X,annotationFrame:0,xValues:[],yValues:[],pointNodes:fr(t)})]})}return(0,jr.jsxs)("div",{ref:mt,className:"stream-geo-frame"+(N?" "+N:""),role:"group","aria-label":ke||("string"==typeof re?re:"Geographic chart"),tabIndex:0,style:{position:"relative",width:O?"100%":Re[0],height:T?"100%":Re[1],overflow:V?"visible":"hidden",...w?{touchAction:"none"}:{}},onKeyDown:Vt,children:[be&&(0,jr.jsx)(go,{tableId:$e}),be&&(0,jr.jsx)(mo,{scene:rt.current?.scene??[],chartType:"Geographic chart",tableId:$e,chartTitle:"string"==typeof re?re:void 0}),(0,jr.jsx)(yo,{summary:je}),(0,jr.jsx)(bo,{hoverPoint:Mt}),(0,jr.jsxs)("div",{role:"img","aria-label":ke||("string"==typeof re?re:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:Yt?Ut:void 0,onPointerLeave:Yt?Ht:void 0,onPointerDown:Yt||U?Zt:void 0,onClick:U?Ft:void 0,children:[Te&&(0,jr.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:Re[0],height:Re[1],pointerEvents:"none"},children:(0,jr.jsx)("g",{transform:`translate(${Ie.left},${Ie.top})`,children:Te})}),L&&(0,jr.jsx)("canvas",{ref:it,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,jr.jsx)("canvas",{ref:st,"aria-label":to(rt.current?.scene??[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),(0,jr.jsx)("canvas",{ref:at,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,jr.jsx)(On,{width:De,height:ze,totalWidth:Re[0],totalHeight:Re[1],margin:Ie,scales:null,showAxes:ge??!1,title:re,legend:ie,legendPosition:se,legendLayout:ae,legendHoverBehavior:ce,legendClickBehavior:ue,legendHighlightedCategory:he,legendIsolatedCategories:de,foregroundGraphics:ar(Oe,dr(rt.current?.customLayoutOverlays,d??null)),annotations:Y,autoPlaceAnnotations:X,annotationFrame:At,xValues:[],yValues:[],pointNodes:fr(rt.current?.scene)}),te?.showBadge&&(0,jr.jsx)(ot,{isStale:Rt,position:te.badgePosition}),w&&(0,jr.jsxs)("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Ie.bottom+8,left:Ie.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[(0,jr.jsx)("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=pt.current,n=ht.current;t&&n?.scaleBy&&n.scaleBy((0,_o.select)(t),1.5)},style:vr,children:"+"}),(0,jr.jsx)("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=pt.current,n=ht.current;t&&n?.scaleBy&&n.scaleBy((0,_o.select)(t),1/1.5)},style:vr,children:"−"})]}),R&&(0,jr.jsx)("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Ie.bottom+2,right:Ie.right+4,fontSize:10,color:"rgba(0,0,0,0.6)",background:"rgba(255,255,255,0.7)",padding:"1px 4px",borderRadius:2,pointerEvents:"none",zIndex:2},children:R}),(0,jr.jsx)(jo,{active:qt.current>=0,hoverPoint:Mt,margin:Ie,size:Re,shape:Gt.current?.shape,width:Gt.current?.w,height:Gt.current?.h,pathData:Gt.current?.pathData}),Qt]})]})}));Mr.displayName="StreamGeoFrame";var Sr=Mr,Ar=require("react");function Cr(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}var Lr=require("react"),Rr=require("react"),Pr=(require("react/jsx-runtime"),(0,Rr.createContext)(null));function Ir(){return(0,Rr.useContext)(Pr)}var Dr=require("react");function zr(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function Or(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function Tr(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const n of e.values)if(!t.values.has(n))return!1;return!0}return!1}var[Er,Nr]=Le(e=>({selections:new Map,setClause(t,n){e(e=>{const o=e.selections.get(t),r=o?.clauses.get(n.clientId);if(r&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,o]of n){const n=t.fields[e];if(!n||!Tr(o,n))return!1}return!0}(r,n))return{};const i=new Map(e.selections),s=Or(i,t),a=new Map(s.clauses);return a.set(n.clientId,n),i.set(t,{...s,clauses:a}),{selections:i}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o||!o.clauses.has(n))return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,{...o,clauses:i}),{selections:r}})},setResolution(t,n){e(e=>{const o=e.selections.get(t);if(o?.resolution===n)return{};const r=new Map(e.selections),i=Or(r,t);return r.set(t,{...i,resolution:n}),{selections:r}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const o=new Map(e.selections);return o.set(t,{...n,clauses:new Map}),{selections:o}})}})),[$r,Wr]=Le(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}))}})),_r=require("react");function Br(e){const t=(0,_r.useId)(),n=e.clientId||t,{name:o}=e,r=Nr(e=>e.selections.get(o)),i=Nr(e=>e.setClause),s=Nr(e=>e.clearClause),a=(0,_r.useMemo)(()=>!!r&&r.clauses.size>0,[r]);return{predicate:(0,_r.useMemo)(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(zr(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,n):()=>!0,[r,n]),isActive:a,selectPoints:(0,_r.useCallback)(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)},r=!0;r&&i(o,{clientId:n,type:"point",fields:t})},[n,o,i]),selectInterval:(0,_r.useCallback)(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o},r=!0;r&&i(o,{clientId:n,type:"interval",fields:t})},[n,o,i]),clear:(0,_r.useCallback)(()=>{s(o,n)},[s,o,n]),clientId:n}}function Hr(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:s}=Br({name:t,fields:n});return{onHover:(0,_r.useCallback)(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1})(t)&&i(t)},[n,i,s,t]),predicate:o,isActive:r}}require("react/jsx-runtime");var Fr=(0,Dr.createContext)(!1);(0,Dr.createContext)(!1);var qr=(0,Dr.createContext)(null),Gr="undefined"==typeof window?Dr.useEffect:Dr.useLayoutEffect;function Vr(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}var Ur=.5;function Zr(e,t,n){return t?(o,...r)=>{const i={...e(o,...r)};if(t.isActive)if(t.predicate(o))n?.selectedStyle&&Object.assign(i,n.selectedStyle);else{const e=n?.unselectedOpacity??Ur;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e}var Yr=l(require("react"));function Xr(){return $e(e=>e.theme)}function Qr(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Kr(e,t){const{when:n}=e,o=t.width,r=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),s=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof n.minWidth&&n.minWidth>o||"number"==typeof n.maxWidth&&o>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof r||n.minHeight>r)||"number"==typeof n.maxHeight&&("number"!=typeof r||r>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&s!==n.orientation)}function Jr(e,t,n=e.responsiveRules){if(!Array.isArray(n)||0===n.length)return{props:e,matches:[]};const o=n.map((e,t)=>({rule:e,index:t})).filter(e=>Kr(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:o.reduce((e,t)=>function(e,t){const n={...e,...t};for(const o of["margin","frameProps","mobileSemantics","style"])Qr(e[o])&&Qr(t[o])&&(n[o]={...e[o],...t[o]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:o}}require("react/jsx-runtime"),Yr.createContext(void 0);var ei="#007bff";function ti(e,t,n){const o=e.xValue??t?.[n];if(null==o)return null;const r=Number(o);return Number.isFinite(r)?r:null}function ni(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 oi(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var ri=44,ii={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:ri,snap:"nearestDatum",brushHandleSize:ri,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function si(e,t={}){const n=t.mobileSemantics?.interaction,o="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,r="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!n||void 0!==o,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!r&&!i)return ii;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??o??ri,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??ri,standardControls:a.standardControls??!1}}function ai(){const e=Xr(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function li({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:r,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const h=(0,Lr.useId)(),d=Vr(t,n),f="series"===d?.mode?[d.seriesField||c||n[0]].filter(e=>!!e):d?.fields||n||[],p=Br({name:e?.name||"__unused__",fields:f}),m=Hr({name:d?.name||"hover",fields:f}),y=Wr(e=>e.pushObservation),g=e?{isActive:p.isActive,predicate:p.predicate}:null,[b,x]=(0,Lr.useState)(null),v=(0,Lr.useRef)(!1),k=c||n[0],w=(0,Lr.useMemo)(()=>{if(!l||null==b||!k)return null;const e=b,t=k;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,b,k]),j=(0,Lr.useCallback)(e=>{const n=!e&&v.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===d?.mode&&d.xField){const n=ti(e,t,d.xField);null!=n&&function(e,t,n){const o=mn.positions.get(e);o?.locked||o&&o.xValue===t&&o.sourceId===n||(mn={positions:new Map(mn.positions).set(e,{xValue:t,sourceId:n})},gn())}(d.name||"hover",n,h)}"x-position"!==d?.mode&&m.onHover(t)}else"x-position"!==d?.mode||n||bn(d.name||"hover",h),"x-position"===d?.mode||n||m.onHover(null);if(l&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[k];x(null!=n?n+"":null)}else n||x(null);if(r||y){const t={timestamp:Date.now(),chartType:i||"unknown",chartId:s};if(e){const n=ni(e),o={...t,type:"hover",datum:n||{},x:e.x??0,y:e.y??0};r&&r(o),y&&y(o)}else{const e={...t,type:"hover-end"};r&&r(e),y&&y(e)}}},[t,m,d,h,r,i,s,y,l,k,u]),M=(0,Lr.useCallback)((n=!0)=>{v.current=!1,t&&"x-position"!==d?.mode&&m.onHover(null),e&&u?.tapToSelect&&p.clear(),n&&l&&x(null),"x-position"===d?.mode&&(xn(d.name||"hover",h),bn(d.name||"hover",h))},[t,d,m,e,u,p,l,h]),S=(0,Lr.useCallback)(n=>{const o=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),c=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===d?.mode&&d.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=ti(n,e,d.xField);null!=t&&function(e,t,n){const o=mn.positions.get(e);if(o?.locked){const t=new Map(mn.positions);return t.delete(e),mn={positions:t},gn(),!1}mn={positions:new Map(mn.positions).set(e,{xValue:t,sourceId:n,locked:!0})},gn()}(d.name||"hover",t,h)}if(o)if(n){v.current=!0;const o=ni(n);if(t&&"x-position"!==d?.mode&&m.onHover(o),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const n=o[t];void 0!==n&&(e[t]=[n])}oi(e)&&p.selectPoints(e)}if(l&&k){const e=o?.[k];x(null!=e?e+"":null)}}else c&&M();if(n||c){if(n&&a){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),a(e,{x:n.x??0,y:n.y??0})}if(r||y){const e={timestamp:Date.now(),chartType:i||"unknown",chartId:s};if(n){const t=ni(n),o={...e,type:"click",datum:t||{},x:n.x??0,y:n.y??0};r&&r(o),y&&y(o)}else{const t={...e,type:"click-end"};r&&r(t),y&&y(t)}}}},[a,r,y,i,s,d,h,u,t,m,e,p,f,l,k,M]);return(0,Lr.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&v.current&&M()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,M]),(0,Lr.useEffect)(()=>()=>{v.current&&M(!1)},[M]),(0,Lr.useEffect)(()=>{if("x-position"!==d?.mode)return;const e=d.name||"hover";return()=>{xn(e,h),bn(e,h)}},[d?.mode,d?.name,h]),{activeSelectionHook:g,hoverSelectionHook:w,customHoverBehavior:j,customClickBehavior:S,crosshairSourceId:h}}function ci({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:r="right",userMargin:i,defaults:s={top:50,bottom:60,left:70,right:40},categories:a}){const l=(0,Dr.useContext)(Fr),c=null!==(0,Dr.useContext)(qr),u=void 0!==o?o:!l&&!!t,h=!!t&&(u||c),d=(0,Lr.useMemo)(()=>{if(!h)return[];if(void 0!==a)return a;const n=new Set;for(const o of e){const e="function"==typeof t?t(o):o[t];null!=e&&n.add(e+"")}return Array.from(n)},[a,t,e,h]);!function(e){const t=(0,Dr.useContext)(qr),n=(0,Dr.useId)(),o=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=(0,Dr.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,o)||(r.current=o);const i=r.current;Gr(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),Gr(()=>{t&&t.registerCategories(n,i)},[t,n,i])}(c&&t?d:[]);const f=(0,Lr.useMemo)(()=>{if(!u||!t)return;const o=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?o(s,t,n):n?n(r):W[i%W.length];return{label:r+"",color:a}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:B,categories:d});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[u,t,e,n,d]),p=(0,Lr.useMemo)(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const n=e[t];return"number"==typeof n?n:s[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return f&&("right"===r&&!o("right")&&110>n.right?n.right=110:"left"===r&&!o("left")&&110>n.left?n.left=110:"top"===r&&!o("top")&&50>n.top?n.top=50:"bottom"===r&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[s,i,f,r]);return{legend:f,margin:p,legendPosition:r}}var ui={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 hi(e,t,n){const o=ui[e||"primary"],r=e&&"primary"!==e||!n?.width?o.width:n.width,i=e&&"primary"!==e||!n?.height?o.height:n.height,s=Jr({...t,mode:e},{width:t.width??r,height:t.height??i}).props,a=s.mode||e,l=ui[a||"primary"],c="context"===a||"sparkline"===a,u=a&&"primary"!==a||!n?.width?l.width:n.width;return{width:s.width??u,height:s.height??(a&&"primary"!==a||!n?.height?l.height:n.height),showAxes:s.showAxes??l.showAxes,showGrid:s.showGrid??l.showGrid,enableHover:s.enableHover??(!!s.linkedHover||l.enableHover),showLegend:s.showLegend??l.showLegend,showLabels:s.showLabels??l.showLabels,title:c?void 0:s.title,description:s.description,summary:s.summary,accessibleTable:s.accessibleTable,xLabel:c?void 0:s.xLabel,yLabel:c?void 0:s.yLabel,categoryLabel:c?void 0:s.categoryLabel,valueLabel:c?void 0:s.valueLabel,marginDefaults:di(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:si(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}function di(e,t,n){if(!1!==t)return e;const o={...e};return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function fi(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return e??(()=>({}));const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>({...e(...t)||{},...n}):(...e)=>({...n})}var pi=require("react/jsx-runtime");function mi({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return(0,pi.jsx)("div",{role:"alert",style:{width:o,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:(0,pi.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,pi.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,pi.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&(0,pi.jsx)("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}var yi=l(require("react")),gi=require("react/jsx-runtime"),bi=class extends yi.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,gi.jsx)(mi,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},xi=require("react/jsx-runtime"),vi="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function ki({componentName:e,width:t,height:n,children:o}){return(0,xi.jsx)(bi,{fallback:o=>(0,xi.jsx)(mi,{componentName:e,message:o.message,width:t,height:n}),children:o})}var wi={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"},ji={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Mi(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,xi.jsx)("div",{style:{...wi,width:t,height:n},children:o||"No data available"}):null}function Si(e,t,n,o){if(!e)return null;if(!1===o)return null;if(null!=o)return(0,xi.jsx)("div",{style:{width:t,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:o});const r=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*r))),s=Math.max(6,Math.floor(n/(2.5*r))),a=Math.floor((n-(r*(i+s)-s))/2);return(0,xi.jsx)("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(e,n)=>(0,xi.jsx)("div",{className:"semiotic-loading-bar",style:{...ji,position:"absolute",top:a+n*(i+s),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}function Ai(e,t,n,o){if(!vi)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}var Ci=require("react");function Li(e){const t=$e(e=>e.theme.colors.selectionOpacity);return(0,Ci.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}var Ri=require("d3-scale"),Pi=require("react"),Ii=require("topojson-client"),Di=new Map;function zi(e){return e.default??e}var Oi="Install the optional peer dependency `world-atlas` (`npm install world-atlas`) to use built-in reference geographies, or pass GeoJSON Feature[] to `areas`.";async function Ti(e){const t=Di.get(e);if(t)return t;const{topology:n,objectName:o}=await async function(e){try{switch(e){case"world-110m":return{topology:zi(await import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:zi(await import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:zi(await import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:zi(await import("world-atlas/land-50m.json")),objectName:"land"};default:throw Error(`Unknown reference geography: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}}catch(t){if(/Cannot find module|Failed to resolve|world-atlas/i.test(t instanceof Error?t.message:t+""))throw Error(`resolveReferenceGeography("${e}"): ${Oi}`,{cause:t});throw t}}(e);if(!n||!n.objects)throw Error(`resolveReferenceGeography("${e}"): Failed to load topology. Got ${typeof n} with keys: ${n?Object.keys(n).join(", "):"none"}`);const r=(0,Ii.feature)(n,n.objects[o]),i="features"in r?r.features:[r];return Di.set(e,i),i}function Ei(e){const t=(0,Pi.useMemo)(()=>Array.isArray(e)?e:void 0,[e]),[n,o]=(0,Pi.useState)(null);return(0,Pi.useEffect)(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return o(null),Ti(e).then(e=>{t||o(e)}),()=>{t=!0}}var t;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),o(null)}else o(null)},[e]),void 0!==t?t:n}function Ni(e){const{title:t,description:n,summary:o,accessibleTable:r,className:i,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),n&&(c.description=n),o&&(c.summary=o),void 0!==r&&(c.accessibleTable=r),i&&(c.className=i),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function $i(e){const{linkedHover:t,selection:n,onObservation:o,onClick:r,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:h,linkedHoverInClickPredicate:d=!0}=e,f={},p=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(a||t||o||r||s)&&(f.customHoverBehavior=u),h&&(l||(d?o||r||t:o||r)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||n))&&(f.customClickBehavior=h),null!=p&&(f.hoverRadius=p),f}var Wi=require("react/jsx-runtime");function _i(e){const t=hi(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=function(){const e=Xr();return e?.colors?.sequential||void 0}(),{areas:o,valueAccessor:r,colorScheme:i,projection:s="equalEarth",graticule:a,fitPadding:l,zoomable:c,zoomExtent:u,onZoom:h,dragRotate:d,tileURL:f,tileAttribution:p,tileCacheSize:m,tooltip:y,areaOpacity:g=1,annotations:b,margin:x,className:v,selection:k,linkedHover:w,onObservation:j,onClick:M,chartId:S,loading:A,loadingContent:C,emptyContent:L,frameProps:R={},stroke:P,strokeWidth:I,opacity:D}=e,z=c??!!f,O=Ei(o),T=(0,Ar.useMemo)(()=>O?vo(O):O,[O]),N=(0,Ar.useMemo)(()=>"function"==typeof r?r:e=>e?.properties?.[r]??e?.[r],[r]),$=i??n??"blues",W=(0,Ar.useMemo)(()=>{if(!T)return(0,Ri.scaleSequential)(E(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(const n of T){const o=N(n);null!=o&&isFinite(o)&&(e>o&&(e=o),o>t&&(t=o))}const n=E($);return(0,Ri.scaleSequential)(n).domain([Number.isFinite(e)?e:0,Number.isFinite(t)?t:1])},[T,N,$]),{activeSelectionHook:_,customHoverBehavior:B,customClickBehavior:H}=li({selection:k,linkedHover:w,onObservation:j,onClick:M,chartType:"ChoroplethMap",chartId:S,mobileInteraction:t.mobileInteraction}),F=Li(k),q=(0,Ar.useMemo)(()=>{const e=fi(e=>{const t=N(e);return{fill:null!=t&&isFinite(t)?W(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:g}},{stroke:P,strokeWidth:I,opacity:D});return _?Zr(e,_,F):e},[N,W,_,F,g,P,I,D]),G=(0,Ar.useMemo)(()=>e=>{const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||"Feature",n=N(e);return(0,Wi.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,Wi.jsx)("div",{style:{fontWeight:600},children:t}),null!=n&&(0,Wi.jsx)("div",{style:{opacity:.7},children:(o=n,"number"==typeof o&&isFinite(o)?Number.isInteger(o)?o.toLocaleString():o.toLocaleString(void 0,{maximumFractionDigits:2}):(o??"")+"")})]});var o},[N]),V=(0,Ar.useMemo)(()=>({top:10,right:10,bottom:10,left:10,...Cr(x)}),[x]),U=Si(A,t.width,t.height,C)||(T?null:Si(!0,t.width,t.height,C)),Z=U?null:Mi(T,t.width,t.height,L);if(Array.isArray(T)&&T.length>0){const e=T[0];if(!e||"object"!=typeof e||!e.geometry)return(0,Wi.jsx)(mi,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:t.width,height:t.height})}const Y={projection:s,areas:T,areaStyle:q,size:[t.width,t.height],margin:V,enableHover:!0,tooltipContent:!1===y?()=>null:!0===y?G:Eo(y)||G,...null!=a&&{graticule:a},...null!=l&&{fitPadding:l},...z&&{zoomable:!0},...u&&{zoomExtent:u},...h&&{onZoom:h},...null!=d&&{dragRotate:d},...f&&{tileURL:f},...p&&{tileAttribution:p},...m&&{tileCacheSize:m},...$i({linkedHover:w,selection:k,onObservation:j,onClick:M,mobileInteraction:t.mobileInteraction,customHoverBehavior:B,customClickBehavior:H,linkedHoverInClickPredicate:!1}),...b&&b.length>0&&{annotations:b},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...t.title&&{title:t.title},...t.description&&{description:t.description},...t.summary&&{summary:t.summary},...void 0!==t.accessibleTable&&{accessibleTable:t.accessibleTable},...v&&{className:v},...null!=e.animate&&{animate:e.animate},...R};return U||Z||(0,Wi.jsx)(ki,{componentName:"ChoroplethMap",width:t.width,height:t.height,children:(0,Wi.jsx)(Sr,{...Y})})}_i.displayName="ChoroplethMap";var Bi=require("react"),Hi=require("react");function Fi(e){const{data:t,rawData:n,colorBy:o,colorScheme:r,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:h,chartType:d,chartId:f,showLegend:p,userMargin:m,marginDefaults:y,onClick:g,hoverHighlight:b,mobileInteraction:x,mobileSemantics:v,loading:k,loadingContent:w,emptyContent:j,width:M,height:S}=e,A=void 0===n,C=(0,Hi.useMemo)(()=>vo(t),[t]),[L,R]=(0,Hi.useState)([]),P=(0,Hi.useCallback)(e=>{R(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),I="string"==typeof e.colorBy?e.colorBy:void 0,D=(0,Hi.useMemo)(()=>si(x,{width:M,mobileSemantics:v}),[x,M,v]),{activeSelectionHook:z,hoverSelectionHook:O,customHoverBehavior:T,customClickBehavior:E,crosshairSourceId:N}=li({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:h,chartType:d,chartId:f,onClick:g,hoverHighlight:b,colorByField:I,mobileInteraction:D}),$=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(l,N),_=function(e,t,n){const o=Ir(),r=ai();return(0,Lr.useMemo)(()=>{if(!t)return;const i=o??void 0,s=n??(r&&r.length>0?r:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&oi(i)){const e=F(n.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return F(n.map(e=>({_cat:e})),"_cat",s)}if(i&&oi(i)){const n=F(e,t,s);return e=>i[e]||n(e)}return F(e,t,s)}if(i&&oi(i)){const e=F([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,n,o,r])}(C,o,r),B=(0,Hi.useMemo)(()=>{if(!o)return[];const e=new Set;for(const t of C){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[C,o]),H=(0,Hi.useMemo)(()=>A&&L.length>0?L:B,[A,L,B]),q=function(e,t,n){const[o,r]=(0,Lr.useState)(null),[i,s]=(0,Lr.useState)(new Set),a=(0,Lr.useMemo)(()=>new Set,[]),l=(0,Lr.useCallback)(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=(0,Lr.useCallback)(t=>{"isolate"===e&&s(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),u=(0,Lr.useMemo)(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return i.has(o)}}:null},[e,t,o,i]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?i:a,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(i,o,H),G=(0,Hi.useMemo)(()=>O||(q.legendSelectionHook?q.legendSelectionHook:z),[O,q.legendSelectionHook,z]),V=Li(a),U=ai(),Z=Ir(),Y=(0,Hi.useMemo)(()=>{if(_)return _;if(!o||0===H.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:U&&U.length>0?U:W,t="__streamCat",n=F(H.map(e=>({[t]:e})),t,e);return e=>Z?.[e]||n(e)||"#999"},[_,o,H,r,U,Z]),{legend:X,margin:Q,legendPosition:K}=ci({data:C,colorBy:o,colorScale:Y,showLegend:p,legendPosition:s,userMargin:m,defaults:y,categories:H}),J=(0,Hi.useMemo)(()=>{const e={};return X&&(e.legend=X,e.legendPosition=K),i&&"none"!==i&&(e.legendHoverBehavior=q.onLegendHover,e.legendClickBehavior=q.onLegendClick,e.legendHighlightedCategory=q.highlightedCategory,e.legendIsolatedCategories=q.isolatedCategories),A&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=P),e},[X,K,i,q.onLegendHover,q.onLegendClick,q.highlightedCategory,q.isolatedCategories,A,o,P]),ee=Array.isArray(n)?vo(n):n,te=Si(k,M,S,w),ne=te?null:Mi(ee,M,S,j);return{data:C,colorScale:_,allCategories:H,legendState:q,effectiveSelectionHook:G,activeSelectionHook:z,customHoverBehavior:T,customClickBehavior:E,mobileInteraction:D,legend:X,margin:Q,legendPosition:K,earlyReturn:te||ne||null,legendBehaviorProps:J,crosshairProps:$,resolvedSelection:V}}var qi=require("react");function Gi(e,t){const{variant:n,frameRef:o,overrides:r,deps:i}=t;(0,qi.useImperativeHandle)(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,n)=>e.current?.update(t,n)??[],clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const n=Array.isArray(t)?t:[t],o=e.current?.getTopology()?.nodes??[],r=[];for(const t of n){const n=o.find(e=>e.id===t);n&&r.push({...n.data??{},id:t}),e.current?.removeNode(t)}return r},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const o=e.current?.updateNode(t,n);return o?[{...o,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,n)=>{const o=e.current?.removePoint(t)??[];for(const t of o)e.current?.push(n(t));return o},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const n=t;return{push:e=>n.current?.pushLine(e),pushMany:e=>n.current?.pushManyLines(e),remove:e=>n.current?.removeLine(e)??[],update:(e,t)=>{const o=n.current?.removeLine(e)??[];for(const e of o)n.current?.pushLine(t(e));return o},clear:()=>n.current?.clear(),getData:()=>n.current?.getLines()??[],getCustomLayout:()=>n.current?.getCustomLayout?.()??null,getLayoutFailure:()=>n.current?.getLayoutFailure?.()??null}}(n,o);return{...e,...r}},i??[])}var Vi=require("react/jsx-runtime"),Ui=(0,Bi.forwardRef)(function(e,t){const n=(0,Bi.useRef)(null);Gi(t,{variant:"geo-points",frameRef:n});const o=hi(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:r,xAccessor:i="lon",yAccessor:s="lat",sizeBy:a,sizeRange:l=[3,30],colorBy:c,colorScheme:u,projection:h="equalEarth",graticule:d,fitPadding:f,zoomable:p,zoomExtent:m,onZoom:y,dragRotate:g,tileURL:b,tileAttribution:x,tileCacheSize:v,areas:k,areaStyle:w={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:j,annotations:M,margin:S,className:A,selection:C,linkedHover:L,onObservation:R,onClick:P,chartId:I,loading:D,loadingContent:z,emptyContent:O,legendInteraction:T,legendPosition:E,frameProps:N={},stroke:$,strokeWidth:W,opacity:_}=e,H=p??!!b,F=Ei(k),G=Fi({data:r??xo,rawData:r,colorBy:c,colorScheme:u,legendInteraction:T,legendPosition:E,selection:C,linkedHover:L,fallbackFields:c?["string"==typeof c?c:""]:[],unwrapData:!1,onObservation:R,onClick:P,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"ProportionalSymbolMap",chartId:I,showLegend:o.showLegend,userMargin:S,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:D,loadingContent:z,emptyContent:O,width:o.width,height:o.height}),V=G.data,U=(0,Bi.useMemo)(()=>{if(!a)return;const e="function"==typeof a?a:e=>e?.[a],t=V.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?re(t):void 0},[V,a]),Z=(0,Bi.useMemo)(()=>{const e=fi(e=>({fill:c?B(e,c,G.colorScale):ei,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:a?q(e,a,l,U):6}),{stroke:$,strokeWidth:W,opacity:_});return G.effectiveSelectionHook?Zr(e,G.effectiveSelectionHook,G.resolvedSelection):e},[c,G.colorScale,G.effectiveSelectionHook,G.resolvedSelection,a,l,U,$,W,_]),Y=(0,Bi.useMemo)(()=>e=>{const t=e?.name||e?.label||e?.NAME||e?.id,n="string"==typeof a?a:null,o=("function"==typeof a?a:e=>e[a])(e),r=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(e??"")+"",i="string"==typeof c?c:null,s=i?e?.[i]:null;return(0,Vi.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t&&(0,Vi.jsx)("div",{style:{fontWeight:600,marginBottom:2},children:t}),n&&null!=o&&(0,Vi.jsxs)("div",{children:[(0,Vi.jsxs)("span",{style:{opacity:.7},children:[n,": "]}),r(o)]}),i&&null!=s&&(0,Vi.jsxs)("div",{children:[(0,Vi.jsxs)("span",{style:{opacity:.7},children:[i,": "]}),s+""]}),!t&&!n&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>(0,Vi.jsxs)("div",{children:[(0,Vi.jsxs)("span",{style:{opacity:.7},children:[e,": "]}),r(t)]},e))]})},[a,c]);if(G.earlyReturn)return G.earlyReturn;Ai("ProportionalSymbolMap",V,"xAccessor",i),Ai("ProportionalSymbolMap",V,"yAccessor",s);const X={projection:h,...null!=r&&{points:V},xAccessor:i,yAccessor:s,pointStyle:Z,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...F&&{areas:F,areaStyle:w},...null!=d&&{graticule:d},...null!=f&&{fitPadding:f},...H&&{zoomable:!0},...m&&{zoomExtent:m},...y&&{onZoom:y},...null!=g&&{dragRotate:g},...b&&{tileURL:b},...x&&{tileAttribution:x},...v&&{tileCacheSize:v},size:[o.width,o.height],margin:G.margin,enableHover:!0,tooltipContent:!1===j?()=>null:Eo(j)||Y,...G.legendBehaviorProps,...$i({linkedHover:L,selection:C,onObservation:R,onClick:P,mobileInteraction:G.mobileInteraction,customHoverBehavior:G.customHoverBehavior,customClickBehavior:G.customClickBehavior,linkedHoverInClickPredicate:!1}),...M&&M.length>0&&{annotations:M},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...o.title&&{title:o.title},...o.description&&{description:o.description},...o.summary&&{summary:o.summary},...void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable},...A&&{className:A},...null!=e.animate&&{animate:e.animate},...N};return(0,Vi.jsx)(ki,{componentName:"ProportionalSymbolMap",width:o.width,height:o.height,children:(0,Vi.jsx)(Sr,{ref:n,...X})})});Ui.displayName="ProportionalSymbolMap";var Zi=require("react"),Yi=require("d3-scale"),Xi=require("react/jsx-runtime"),Qi="__semiotic_x",Ki="__semiotic_y",Ji=(0,Zi.forwardRef)(function(e,t){const n=hi(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{flows:o,nodes:r,nodeIdAccessor:i="id",xAccessor:s="lon",yAccessor:a="lat",valueAccessor:l="value",projection:c="equalEarth",graticule:u,fitPadding:h,zoomable:d,zoomExtent:f,onZoom:p,dragRotate:m,tileURL:y,tileAttribution:g,tileCacheSize:b,lineType:x="geo",flowStyle:v="basic",areas:k,areaStyle:w={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:j,edgeOpacity:M=.6,edgeWidthRange:S=[1,8],edgeLinecap:A="round",colorScheme:C,showParticles:L,particleStyle:R,tooltip:P,annotations:I,margin:D,className:z,selection:O,linkedHover:T,onObservation:E,onClick:N,chartId:$,loading:W,loadingContent:_,emptyContent:H,frameProps:F={},legendInteraction:q,legendPosition:G,stroke:V,strokeWidth:U,opacity:Z,lineIdAccessor:Y}=e,X=d??!!y,Q=Ei(k),K=(0,Zi.useMemo)(()=>vo(r),[r]),J=Fi({data:o??xo,rawData:o,colorBy:j,colorScheme:C,legendInteraction:q,legendPosition:G,selection:O,linkedHover:T,fallbackFields:j?["string"==typeof j?j:""]:[],unwrapData:!1,onObservation:E,onClick:N,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"FlowMap",chartId:$,showLegend:n.showLegend,userMargin:D,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:W,loadingContent:_,emptyContent:H,width:n.width,height:n.height}),ee=J.data,te=Vr(T),ne=Hr({name:te?.name||"hover",fields:te?.fields||[]}),oe=Wr(e=>e.pushObservation),ie=(0,Zi.useMemo)(()=>{const e=new Map;for(const t of K)e.set(t[i]+"",t);return e},[K,i]),se=(0,Zi.useRef)(null),ae=(0,Zi.useRef)(ie);ae.current=ie;const le=(0,Zi.useRef)(s);le.current=s;const ce=(0,Zi.useRef)(a);ce.current=a;const ue=(0,Zi.useCallback)(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=ae.current,n=t.get(e.source+""),o=t.get(e.target+"");if(!n||!o)return null;const r="function"==typeof le.current?le.current:e=>e[le.current],i="function"==typeof ce.current?ce.current:e=>e[ce.current];return{...e,coordinates:[{[Qi]:r(n),[Ki]:i(n)},{[Qi]:r(o),[Ki]:i(o)}]}},[]);Gi(t,{variant:"geo-lines",frameRef:se,overrides:{push:e=>{const t=ue(e);t&&se.current?.pushLine(t)},pushMany:e=>{const t=[];for(const n of e){const e=ue(n);e&&t.push(e)}t.length>0&&se.current?.pushManyLines(t)}}});const he=(0,Zi.useMemo)(()=>{const e=new Map;for(const t of ee)t&&"object"==typeof t&&(null==t.source||e.has(t.source)||e.set(t.source,t),null==t.target||e.has(t.target)||e.set(t.target,t));return e},[ee]),de=(0,Zi.useCallback)(e=>{if(T)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=he.get(t[i]+"");e&&ne.onHover(e)}else ne.onHover(t)}else ne.onHover(null);if(E||oe){const t={timestamp:Date.now(),chartType:"FlowMap",chartId:$};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const o={...t,type:"hover",datum:n||{},x:e.x??0,y:e.y??0};E&&E(o),oe&&oe(o)}else{const e={...t,type:"hover-end"};E&&E(e),oe&&oe(e)}}},[T,ne,i,he,E,$,oe]),fe=J.customClickBehavior,pe=(0,Zi.useMemo)(()=>{const e="function"==typeof s?s:e=>e[s],t="function"==typeof a?a:e=>e[a];return ee.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=ie.get(n.source+""),r=ie.get(n.target+"");return o&&r?{...n,coordinates:[{[Qi]:e(o),[Ki]:t(o)},{[Qi]:e(r),[Ki]:t(r)}]}:null}).filter(Boolean)},[ee,ie,s,a]),me=(0,Zi.useMemo)(()=>{const e="function"==typeof s?s:e=>e[s];return t=>null!=t&&"object"==typeof t&&Qi in t?t[Qi]:e(t)},[s]),ye=(0,Zi.useMemo)(()=>{const e="function"==typeof a?a:e=>e[a];return t=>null!=t&&"object"==typeof t&&Ki in t?t[Ki]:e(t)},[a]),ge=(0,Zi.useMemo)(()=>{const e=ee.filter(e=>e&&"object"==typeof e).map(e=>e[l]??0).filter(e=>isFinite(e));return 0===e.length?()=>S[0]:(0,Yi.scaleLinear)().domain(re(e)).range(S)},[ee,l,S]),be=(0,Zi.useMemo)(()=>e=>({stroke:j?B(e,j,J.colorScale):ei,strokeWidth:ge(e[l]??0),strokeLinecap:A,opacity:M}),[j,J.colorScale,ge,l,M,A]),xe=(0,Zi.useMemo)(()=>{const e=fi(be,{stroke:V,strokeWidth:U,opacity:Z});if(!J.effectiveSelectionHook)return e;const t={...J.resolvedSelection?.unselectedStyle||{},fillOpacity:0};return Zr(e,J.effectiveSelectionHook,{...J.resolvedSelection||{},unselectedStyle:t})},[be,J.effectiveSelectionHook,J.resolvedSelection,V,U,Z]),ve=(0,Zi.useMemo)(()=>fi(()=>({fill:"#333",r:5,fillOpacity:.8}),{stroke:V,strokeWidth:U,opacity:Z}),[V,U,Z]),ke=(0,Zi.useMemo)(()=>e=>{if(e?.geometry||e?.properties||e?.data?.geometry){const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||e?.data?.properties?.name||e?.data?.properties?.NAME;if(t)return(0,Xi.jsx)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:(0,Xi.jsx)("div",{style:{fontWeight:600},children:t})})}if(null!=e?.source&&null!=e?.target){const t=e[l];return(0,Xi.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,Xi.jsxs)("div",{style:{fontWeight:600},children:[e.source," → ",e.target]}),null!=t&&(0,Xi.jsx)("div",{style:{opacity:.7},children:"number"==typeof t?t.toLocaleString():t})]})}const t=e?.name||e?.label||e?.[i];return null!=t?(0,Xi.jsx)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:(0,Xi.jsx)("div",{style:{fontWeight:600},children:t})}):null},[l,i]);if(J.earlyReturn)return J.earlyReturn;const we={projection:c,...null!=o&&{lines:pe},points:K,xAccessor:me,yAccessor:ye,lineDataAccessor:"coordinates",...null!=Y&&{lineIdAccessor:Y},lineType:x,flowStyle:v,lineStyle:xe,pointStyle:ve,...Q&&{areas:Q,areaStyle:w},...null!=u&&{graticule:u},...null!=h&&{fitPadding:h},...X&&{zoomable:!0},...f&&{zoomExtent:f},...p&&{onZoom:p},...null!=m&&{dragRotate:m},...L&&{showParticles:L},...R&&{particleStyle:R},...y&&{tileURL:y},...g&&{tileAttribution:g},...b&&{tileCacheSize:b},size:[n.width,n.height],margin:J.margin,enableHover:!0,tooltipContent:!1===P?()=>null:Eo(P)||ke,...J.legendBehaviorProps,...$i({linkedHover:T,selection:O,onObservation:E,onClick:N,mobileInteraction:J.mobileInteraction,customHoverBehavior:de,customClickBehavior:fe,linkedHoverInClickPredicate:!1}),...I&&I.length>0&&{annotations:I},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...n.title&&{title:n.title},...n.description&&{description:n.description},...n.summary&&{summary:n.summary},...void 0!==n.accessibleTable&&{accessibleTable:n.accessibleTable},...z&&{className:z},...null!=e.animate&&{animate:e.animate},...F};return(0,Xi.jsx)(ki,{componentName:"FlowMap",width:n.width,height:n.height,children:(0,Xi.jsx)(Sr,{ref:se,...we})})});Ji.displayName="FlowMap";var es=require("react"),ts=require("react/jsx-runtime"),ns=(0,es.forwardRef)(function(e,t){const n=hi(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:o,lines:r,xAccessor:i="lon",yAccessor:s="lat",nodeIdAccessor:a="id",center:l,costAccessor:c,strength:u=1,lineMode:h="straight",projection:d="mercator",graticule:f,fitPadding:p,zoomable:m,zoomExtent:y,onZoom:g,dragRotate:b,tileURL:x,tileAttribution:v,tileCacheSize:k,transition:w,colorBy:j,colorScheme:M,pointRadius:S=5,tooltip:A,showRings:C=!0,ringStyle:L,showNorth:R=!0,costLabel:P,annotations:I,margin:D,className:z,selection:O,linkedHover:T,onObservation:E,onClick:N,chartId:$,loading:W,loadingContent:_,emptyContent:H,legendPosition:F,frameProps:q={},stroke:G,strokeWidth:V,opacity:U}=e,Z=m??!!x,Y=(0,es.useMemo)(()=>vo(o),[o]),X=Fi({data:Y,rawData:o,colorBy:j,colorScheme:M,legendInteraction:void 0,legendPosition:F,selection:O,linkedHover:T,fallbackFields:j?["string"==typeof j?j:""]:[],unwrapData:!1,onObservation:E,onClick:N,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DistanceCartogram",chartId:$,showLegend:n.showLegend,userMargin:D,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:W,loadingContent:_,emptyContent:H,width:n.width,height:n.height}),Q=(0,es.useMemo)(()=>{const e=fi(e=>({fill:j?B(e,j,X.colorScale):ei,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:S}),{stroke:G,strokeWidth:V,opacity:U});return X.effectiveSelectionHook?Zr(e,X.effectiveSelectionHook,X.resolvedSelection):e},[j,X.colorScale,X.effectiveSelectionHook,X.resolvedSelection,S,G,V,U]),K=(0,es.useMemo)(()=>({center:l,centerAccessor:a,costAccessor:c,strength:u,lineMode:h}),[l,a,c,u,h]),J=(0,es.useMemo)(()=>{if(!r)return;const e="function"==typeof i?i:e=>e[i],t="function"==typeof s?s:e=>e[s],n=new Map;for(const e of Y)n.set(e[a]+"",e);return r.map(o=>{if(o.coordinates)return o;const r=n.get(o.source+""),a=n.get(o.target+"");return r&&a?{...o,coordinates:[{[i]:e(r),[s]:t(r)},{[i]:e(a),[s]:t(a)}]}:null}).filter(Boolean)},[r,Y,i,s,a]),ee=(0,es.useMemo)(()=>e=>{const t=("function"==typeof c?c:e=>e[c])(e);return(0,ts.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,ts.jsx)("div",{style:{fontWeight:600},children:e[a]||e.name||e.id||"Point"}),null!=t&&(0,ts.jsxs)("div",{style:{opacity:.7},children:["Cost: ","number"==typeof t?t.toFixed(1):t]})]})},[c,a]),te=(0,es.useRef)(null);Gi(t,{variant:"geo-points",frameRef:te});const[ne,oe]=(0,es.useState)(null),re=(0,es.useCallback)(()=>{const e=te.current?.getCartogramLayout?.();e&&oe(t=>t&&t.cx===e.cx&&t.cy===e.cy&&t.maxCost===e.maxCost&&t.availableRadius===e.availableRadius?t:e)},[]);(0,es.useEffect)(()=>{const e=requestAnimationFrame(re);return()=>cancelAnimationFrame(e)},[re,u,l,n.width,n.height,Y]);const ie=(0,es.useMemo)(()=>{if(!C||!ne)return[];const{maxCost:e}=ne;if(0>=e)return[];if(Array.isArray(C))return C.filter(t=>t>0&&e>=t);const t="number"==typeof C?C:Math.min(5,Math.max(2,Math.ceil(e/5))),n=e/t,o=[];for(let e=1;t>=e;e++)o.push(Math.round(n*e*10)/10);return o},[C,ne]),se=(0,es.useMemo)(()=>{if(!ne)return q.foregroundGraphics||null;const{cx:e,cy:t,maxCost:n,availableRadius:o}=ne,r={stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10,...L},i=X.margin.left??10,s=X.margin.top??10;return(0,ts.jsxs)("g",{children:[ie.map(a=>{const l=a/n*o;return(0,ts.jsxs)("g",{children:[(0,ts.jsx)("circle",{cx:e+i,cy:t+s,r:l,fill:"none",stroke:r.stroke,strokeWidth:r.strokeWidth,strokeDasharray:r.strokeDasharray,opacity:.5}),(0,ts.jsxs)("text",{x:e+i+l+3,y:t+s-2,fontSize:r.labelSize,fill:r.labelColor,fontFamily:"system-ui, sans-serif",children:[a,P?" "+P:""]})]},a)}),R&&(0,ts.jsxs)("g",{transform:`translate(${i+24}, ${s+24})`,children:[(0,ts.jsx)("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),(0,ts.jsx)("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),(0,ts.jsx)("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),(0,ts.jsx)("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),(0,ts.jsx)("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),(0,ts.jsx)("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]}),q.foregroundGraphics]})},[ne,ie,R,P,L,X.margin,q.foregroundGraphics]);if(X.earlyReturn)return X.earlyReturn;Ai("DistanceCartogram",Y,"xAccessor",i),Ai("DistanceCartogram",Y,"yAccessor",s);const ae={projection:d,...null!=o&&{points:Y},...J&&{lines:J,lineDataAccessor:"coordinates"},xAccessor:i,yAccessor:s,pointIdAccessor:a,pointStyle:Q,projectionTransform:K,...w&&{transition:{duration:w}},...null!=f&&{graticule:f},...null!=p&&{fitPadding:p},...Z&&{zoomable:!0},...y&&{zoomExtent:y},...g&&{onZoom:g},...null!=b&&{dragRotate:b},...x&&{tileURL:x},...v&&{tileAttribution:v},...k&&{tileCacheSize:k},size:[n.width,n.height],margin:X.margin,enableHover:!0,tooltipContent:!1===A?()=>null:Eo(A)||ee,...X.legendBehaviorProps,...$i({linkedHover:T,selection:O,onObservation:E,onClick:N,mobileInteraction:X.mobileInteraction,customHoverBehavior:X.customHoverBehavior,customClickBehavior:X.customClickBehavior,linkedHoverInClickPredicate:!1}),...I&&I.length>0&&{annotations:I},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...n.title&&{title:n.title},...n.description&&{description:n.description},...n.summary&&{summary:n.summary},...void 0!==n.accessibleTable&&{accessibleTable:n.accessibleTable},...z&&{className:z},...null!=e.animate&&{animate:e.animate},...q,...se&&{foregroundGraphics:se}};return(0,ts.jsx)(ki,{componentName:"DistanceCartogram",width:n.width,height:n.height,children:(0,ts.jsx)(Sr,{ref:te,...ae})})});ns.displayName="DistanceCartogram";var os=require("react"),rs=require("react");var is=require("react/jsx-runtime"),ss=(0,os.forwardRef)(function(e,t){const{points:n,areas:o,lines:r,layout:i,layoutConfig:s,onLayoutError:a,projection:l="equirectangular",xAccessor:c="lon",yAccessor:u="lat",lineDataAccessor:h,colorBy:d,colorScheme:f,tooltip:p,annotations:m,margin:y,selection:g,linkedHover:b,onObservation:x,onClick:v,chartId:k,loading:w,loadingContent:j,emptyContent:M,className:S,frameProps:A={}}=e,{frameRef:C,resolved:L,normalizedMargin:R}=function(e){const t=(0,rs.useRef)(null);return Gi(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:hi(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,rs.useMemo)(()=>Cr(e.margin),[e.margin])}}({imperativeRef:t,imperativeVariant:"geo-points",margin:y,width:e.width,height:e.height,enableHover:e.enableHover,title:e.title,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),P=(0,os.useMemo)(()=>vo(n),[n]),I=(0,os.useMemo)(()=>vo(o),[o]),D=(0,os.useMemo)(()=>vo(r),[r]),z=(0,os.useMemo)(()=>[...P,...D,...I],[P,D,I]),O=Fi({data:z,rawData:void 0!==n||void 0!==r||void 0!==o?z:void 0,colorBy:d,colorScheme:f,legendInteraction:void 0,selection:g,linkedHover:b,fallbackFields:"string"==typeof d?[d]:[],unwrapData:!1,onObservation:x,onClick:v,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:"GeoCustomChart",chartId:k,showLegend:!1,userMargin:R,marginDefaults:L.marginDefaults,loading:w,loadingContent:j,emptyContent:M,width:L.width,height:L.height}),T=O.effectiveSelectionHook,E=(0,os.useMemo)(()=>T?.isActive?{isActive:!0,predicate:T.predicate}:null,[T?.isActive,T?.predicate]);if(O.earlyReturn)return O.earlyReturn;const{width:N,height:$,enableHover:W,title:_,description:B,summary:H,accessibleTable:F}=L,q=Eo(p),G={projection:l,...null!=n&&{points:P},...null!=o&&{areas:I},...null!=r&&{lines:D},xAccessor:c,yAccessor:u,...null!=h&&{lineDataAccessor:h},customLayout:i,layoutConfig:s,onLayoutError:a,layoutSelection:E,colorBy:d,colorScheme:f,size:[N,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:O.margin,enableHover:W,...Ni({title:_,description:B,summary:H,accessibleTable:F,className:S,animate:e.animate,autoPlaceAnnotations:e.autoPlaceAnnotations}),...!1===p?{tooltipContent:()=>null}:q?{tooltipContent:q}:{},...$i({linkedHover:b,selection:g,onObservation:x,onClick:v,hoverHighlight:!1,mobileInteraction:O.mobileInteraction,customHoverBehavior:O.customHoverBehavior,customClickBehavior:O.customClickBehavior,linkedHoverInClickPredicate:!1}),...m&&m.length>0&&{annotations:m},...A};return(0,is.jsx)(ki,{componentName:"GeoCustomChart",width:N,height:$,children:(0,is.jsx)(Sr,{ref:C,...G})})});ss.displayName="GeoCustomChart";var as={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},ls=8;function cs(e){const t=function(e){return null==e?void 0:e+""}(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??ls,style:{...as},datum:e.datum,pointId:t,_transitionKey:t}}function us(e){return cs(e)}function hs(e){const[[t,n],[o,r]]=e.bounds;return{type:"geoarea",pathData:e.pathData,centroid:e.centroid,bounds:e.bounds,screenArea:e.screenArea??Math.abs((o-t)*(r-n)),style:{...as},datum:e.datum,group:e.group,interactive:!0}}function ds(e,t,n){const{featureKey:o,dataKey:r}=n,i=new Map;for(const e of t)i.set(e[r]+"",e);return e.map(e=>{const t=(e=>{const t=o.split(".");let n=e;for(const e of t)n=n?.[e];return(n??"")+""})(e),n=i.get(t);return n?{...e,properties:{...e.properties,...n}}:e})}