semiotic 3.7.5 → 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 (481) hide show
  1. package/CLAUDE.md +54 -12
  2. package/README.md +121 -27
  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 +2733 -536
  9. package/ai/surface-manifest.json +200 -0
  10. package/ai/system-prompt.md +18 -3
  11. package/dist/components/CategoryColors.d.ts +1 -1
  12. package/dist/components/ChartContainer.d.ts +91 -0
  13. package/dist/components/ChartGrid.d.ts +11 -1
  14. package/dist/components/CircularBrush.d.ts +61 -0
  15. package/dist/components/ContextLayout.d.ts +5 -1
  16. package/dist/components/DirectManipulationControl.d.ts +63 -0
  17. package/dist/components/LinkedCharts.d.ts +3 -1
  18. package/dist/components/MobileAnnotationCalloutList.d.ts +13 -0
  19. package/dist/components/MobileChartContainer.d.ts +51 -0
  20. package/dist/components/MobileStandardControls.d.ts +68 -0
  21. package/dist/components/SmallMultipleChart.d.ts +84 -0
  22. package/dist/components/Tooltip/FlippingTooltip.d.ts +21 -0
  23. package/dist/components/ai/ChartRecipe.d.ts +16 -0
  24. package/dist/components/ai/IntentMark.d.ts +15 -0
  25. package/dist/components/ai/chartCapabilities.d.ts +8 -1
  26. package/dist/components/ai/chartCapabilityTypes.d.ts +26 -1
  27. package/dist/components/ai/chartClinic.d.ts +91 -0
  28. package/dist/components/ai/chartRecipeRegistry.d.ts +14 -0
  29. package/dist/components/ai/chartRecipes.d.ts +278 -0
  30. package/dist/components/ai/dataPitfallsBridge.d.ts +102 -0
  31. package/dist/components/ai/describeChart.d.ts +7 -0
  32. package/dist/components/ai/describeRecipeChart.d.ts +16 -0
  33. package/dist/components/ai/generativeChart.d.ts +28 -3
  34. package/dist/components/ai/intentManifest.d.ts +62 -0
  35. package/dist/components/ai/navigationTree.d.ts +3 -0
  36. package/dist/components/ai/observedSceneAudit.d.ts +72 -0
  37. package/dist/components/ai/readerGrounding.d.ts +83 -0
  38. package/dist/components/ai/recipeCapability.d.ts +8 -0
  39. package/dist/components/ai/recipeNavigation.d.ts +13 -0
  40. package/dist/components/ai/recipeSemantics.d.ts +11 -0
  41. package/dist/components/ai/repairChartConfig.d.ts +9 -0
  42. package/dist/components/ai/suggestCharts.d.ts +11 -1
  43. package/dist/components/charts/custom/GeoCustomChart.d.ts +48 -0
  44. package/dist/components/charts/custom/NetworkCustomChart.d.ts +8 -2
  45. package/dist/components/charts/custom/OrdinalCustomChart.d.ts +8 -2
  46. package/dist/components/charts/custom/XYCustomChart.d.ts +11 -2
  47. package/dist/components/charts/geo/DistanceCartogram.d.ts +1 -1
  48. package/dist/components/charts/geo/FlowMap.d.ts +1 -1
  49. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +1 -1
  50. package/dist/components/charts/geo/index.d.ts +2 -0
  51. package/dist/components/charts/index.d.ts +29 -1
  52. package/dist/components/charts/network/ChordDiagram.d.ts +1 -1
  53. package/dist/components/charts/network/CirclePack.d.ts +1 -1
  54. package/dist/components/charts/network/ForceDirectedGraph.d.ts +15 -5
  55. package/dist/components/charts/network/OrbitDiagram.d.ts +1 -1
  56. package/dist/components/charts/network/ProcessSankey.d.ts +1 -1
  57. package/dist/components/charts/network/SankeyDiagram.d.ts +1 -1
  58. package/dist/components/charts/network/TreeDiagram.d.ts +1 -1
  59. package/dist/components/charts/network/Treemap.d.ts +1 -1
  60. package/dist/components/charts/network/useForceLayout.d.ts +17 -0
  61. package/dist/components/charts/ordinal/BarChart.d.ts +1 -1
  62. package/dist/components/charts/ordinal/BoxPlot.d.ts +1 -1
  63. package/dist/components/charts/ordinal/DonutChart.d.ts +1 -1
  64. package/dist/components/charts/ordinal/DotPlot.d.ts +1 -1
  65. package/dist/components/charts/ordinal/FunnelChart.d.ts +1 -1
  66. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +1 -1
  67. package/dist/components/charts/ordinal/Histogram.d.ts +1 -1
  68. package/dist/components/charts/ordinal/PieChart.d.ts +1 -1
  69. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +1 -1
  70. package/dist/components/charts/ordinal/StackedBarChart.d.ts +1 -1
  71. package/dist/components/charts/ordinal/SwarmPlot.d.ts +1 -1
  72. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +1 -1
  73. package/dist/components/charts/ordinal/ViolinPlot.d.ts +1 -1
  74. package/dist/components/charts/physics/ChainReactionChart.d.ts +9 -0
  75. package/dist/components/charts/physics/CollisionSwarmChart.capability.d.ts +2 -0
  76. package/dist/components/charts/physics/CollisionSwarmChart.d.ts +47 -0
  77. package/dist/components/charts/physics/EventDropChart.capability.d.ts +2 -0
  78. package/dist/components/charts/physics/EventDropChart.d.ts +53 -0
  79. package/dist/components/charts/physics/GaltonBoardChart.capability.d.ts +2 -0
  80. package/dist/components/charts/physics/GaltonBoardChart.d.ts +66 -0
  81. package/dist/components/charts/physics/GauntletChart.capability.d.ts +2 -0
  82. package/dist/components/charts/physics/GauntletChart.d.ts +73 -0
  83. package/dist/components/charts/physics/PhysicalFlowChart.capability.d.ts +2 -0
  84. package/dist/components/charts/physics/PhysicalFlowChart.d.ts +63 -0
  85. package/dist/components/charts/physics/PhysicsCustomChart.d.ts +120 -0
  86. package/dist/components/charts/physics/PhysicsPileChart.capability.d.ts +2 -0
  87. package/dist/components/charts/physics/PhysicsPileChart.d.ts +53 -0
  88. package/dist/components/charts/physics/ProcessFlowChart.capability.d.ts +2 -0
  89. package/dist/components/charts/physics/ProcessFlowChart.d.ts +96 -0
  90. package/dist/components/charts/physics/chainReactionOverlay.d.ts +22 -0
  91. package/dist/components/charts/physics/chainReactionRuntime.d.ts +37 -0
  92. package/dist/components/charts/physics/chainReactionTypes.d.ts +97 -0
  93. package/dist/components/charts/physics/collisionSwarmPhysics.d.ts +27 -0
  94. package/dist/components/charts/physics/dependencyMachine.d.ts +188 -0
  95. package/dist/components/charts/physics/eventDropPhysics.d.ts +64 -0
  96. package/dist/components/charts/physics/galtonBoardPhysics.d.ts +28 -0
  97. package/dist/components/charts/physics/gauntletChartProps.d.ts +67 -0
  98. package/dist/components/charts/physics/gauntletChrome.d.ts +33 -0
  99. package/dist/components/charts/physics/gauntletController.d.ts +73 -0
  100. package/dist/components/charts/physics/gauntletEffects.d.ts +36 -0
  101. package/dist/components/charts/physics/gauntletPhysics.d.ts +71 -0
  102. package/dist/components/charts/physics/gauntletRuntime.d.ts +42 -0
  103. package/dist/components/charts/physics/gauntletTypes.d.ts +213 -0
  104. package/dist/components/charts/physics/physicalFlowPhysics.d.ts +57 -0
  105. package/dist/components/charts/physics/physicsChartShared.d.ts +41 -0
  106. package/dist/components/charts/physics/physicsChartUtils.d.ts +18 -0
  107. package/dist/components/charts/physics/physicsEncoding.d.ts +142 -0
  108. package/dist/components/charts/physics/physicsHocHandle.d.ts +53 -0
  109. package/dist/components/charts/physics/physicsHocUtils.d.ts +128 -0
  110. package/dist/components/charts/physics/physicsPilePhysics.d.ts +41 -0
  111. package/dist/components/charts/physics/physicsProcessPrimitives.d.ts +38 -0
  112. package/dist/components/charts/physics/processFlowPhysics.d.ts +97 -0
  113. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +9 -1
  114. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +9 -1
  115. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +9 -1
  116. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +16 -2
  117. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +9 -1
  118. package/dist/components/charts/shared/auditMobileVisualization.d.ts +91 -0
  119. package/dist/components/charts/shared/chartDefinitionPilot.d.ts +145 -0
  120. package/dist/components/charts/shared/chartFamilySets.d.ts +20 -0
  121. package/dist/components/charts/shared/chartSpecCore.d.ts +165 -0
  122. package/dist/components/charts/shared/chartSpecs.d.ts +8 -127
  123. package/dist/components/charts/shared/chartSpecsGeo.d.ts +2 -0
  124. package/dist/components/charts/shared/chartSpecsNetwork.d.ts +2 -0
  125. package/dist/components/charts/shared/chartSpecsOrdinal.d.ts +2 -0
  126. package/dist/components/charts/shared/chartSpecsPhysics.d.ts +2 -0
  127. package/dist/components/charts/shared/chartSpecsRealtime.d.ts +2 -0
  128. package/dist/components/charts/shared/chartSpecsValue.d.ts +2 -0
  129. package/dist/components/charts/shared/chartSpecsXY.d.ts +2 -0
  130. package/dist/components/charts/shared/colorContrast.d.ts +3 -0
  131. package/dist/components/charts/shared/colorUtils.d.ts +16 -1
  132. package/dist/components/charts/shared/diagnoseAnnotationChecks.d.ts +4 -0
  133. package/dist/components/charts/shared/diagnoseConfig.d.ts +9 -14
  134. package/dist/components/charts/shared/diagnoseMisleadingChecks.d.ts +9 -0
  135. package/dist/components/charts/shared/diagnosePhysicsChecks.d.ts +3 -0
  136. package/dist/components/charts/shared/diagnoseTypes.d.ts +10 -0
  137. package/dist/components/charts/shared/hooks.d.ts +28 -5
  138. package/dist/components/charts/shared/motionEncoding.d.ts +145 -0
  139. package/dist/components/charts/shared/responsiveRules.d.ts +56 -0
  140. package/dist/components/charts/shared/streamPropsHelpers.d.ts +12 -2
  141. package/dist/components/charts/shared/temporalStrings.d.ts +7 -0
  142. package/dist/components/charts/shared/types.d.ts +49 -1
  143. package/dist/components/charts/shared/useChartSetup.d.ts +9 -2
  144. package/dist/components/charts/shared/useCustomChartSetup.d.ts +14 -5
  145. package/dist/components/charts/shared/useNetworkChartSetup.d.ts +6 -2
  146. package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +1 -1
  147. package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
  148. package/dist/components/charts/shared/useSyncedPushData.d.ts +49 -0
  149. package/dist/components/charts/shared/validationMap.d.ts +0 -11
  150. package/dist/components/charts/xy/AreaChart.d.ts +1 -1
  151. package/dist/components/charts/xy/BubbleChart.d.ts +1 -1
  152. package/dist/components/charts/xy/LineChart.d.ts +1 -1
  153. package/dist/components/charts/xy/MinimapChart.d.ts +1 -1
  154. package/dist/components/charts/xy/MultiAxisLineChart.d.ts +2 -2
  155. package/dist/components/charts/xy/QuadrantChart.d.ts +1 -1
  156. package/dist/components/charts/xy/Scatterplot.d.ts +1 -1
  157. package/dist/components/charts/xy/ScatterplotMatrix.d.ts +11 -1
  158. package/dist/components/charts/xy/StackedAreaChart.d.ts +9 -4
  159. package/dist/components/controls/controlAudit.d.ts +24 -0
  160. package/dist/components/controls/controlContract.d.ts +57 -0
  161. package/dist/components/data/fromFlintChart.d.ts +74 -0
  162. package/dist/components/data/fromVegaLite.d.ts +27 -0
  163. package/dist/components/data/portability/index.d.ts +6 -3
  164. package/dist/components/data/portability/result.d.ts +52 -0
  165. package/dist/components/data/portability/spec.d.ts +31 -0
  166. package/dist/components/data/portability/vegaLite.d.ts +24 -6
  167. package/dist/components/export/chartConfig.d.ts +11 -0
  168. package/dist/components/realtime/types.d.ts +11 -0
  169. package/dist/components/recipes/annotationLayout.d.ts +29 -0
  170. package/dist/components/recipes/axisFixedForce.d.ts +119 -0
  171. package/dist/components/recipes/{gofishBoba.d.ts → boba.d.ts} +2 -2
  172. package/dist/components/recipes/cyclical.d.ts +39 -0
  173. package/dist/components/recipes/edgeRouter.d.ts +103 -0
  174. package/dist/components/recipes/forceLayout.d.ts +48 -0
  175. package/dist/components/recipes/forceLayoutAsync.d.ts +17 -0
  176. package/dist/components/recipes/gofishBobaHandwritten.d.ts +3 -0
  177. package/dist/components/recipes/gofishDisplayListFixtures.generated.d.ts +37 -0
  178. package/dist/components/recipes/gofishIR.d.ts +178 -132
  179. package/dist/components/recipes/gofishIRExamples.d.ts +30 -81
  180. package/dist/components/recipes/intervalLanes.d.ts +87 -0
  181. package/dist/components/recipes/intervals.d.ts +80 -0
  182. package/dist/components/recipes/isometricLandmarks.d.ts +88 -0
  183. package/dist/components/recipes/isotypeGlyphs.d.ts +17 -0
  184. package/dist/components/recipes/mobileAnnotationStrategy.d.ts +48 -0
  185. package/dist/components/recipes/mobileChartFamilyRecipes.d.ts +59 -0
  186. package/dist/components/recipes/networkAnalysis.d.ts +102 -0
  187. package/dist/components/recipes/networkLayouts.d.ts +83 -0
  188. package/dist/components/recipes/physics.d.ts +122 -0
  189. package/dist/components/recipes/physicsReference.d.ts +102 -0
  190. package/dist/components/recipes/processAggregates.d.ts +32 -0
  191. package/dist/components/recipes/processChrome.d.ts +67 -0
  192. package/dist/components/recipes/processJourney.d.ts +54 -0
  193. package/dist/components/recipes/processPhysics.d.ts +300 -0
  194. package/dist/components/recipes/processVolumeGeometry.d.ts +28 -0
  195. package/dist/components/recipes/radialCoords.d.ts +69 -0
  196. package/dist/components/recipes/random.d.ts +2 -0
  197. package/dist/components/recipes/recipeChrome.d.ts +91 -0
  198. package/dist/components/recipes/recipeGlyph.d.ts +42 -0
  199. package/dist/components/recipes/recipeLegend.d.ts +53 -1
  200. package/dist/components/recipes/recipeUtils.d.ts +52 -0
  201. package/dist/components/recipes/runs.d.ts +59 -0
  202. package/dist/components/recipes/tokenEncoding.d.ts +157 -0
  203. package/dist/components/recipes/tokenLayer.d.ts +79 -0
  204. package/dist/components/recipes/unitize.d.ts +108 -0
  205. package/dist/components/recipes/vector.d.ts +28 -0
  206. package/dist/components/recipes/waffle.d.ts +43 -0
  207. package/dist/components/semiotic-ai-core.d.ts +47 -0
  208. package/dist/components/semiotic-ai.d.ts +50 -8
  209. package/dist/components/semiotic-controls.d.ts +18 -0
  210. package/dist/components/semiotic-experimental.d.ts +38 -9
  211. package/dist/components/semiotic-geo.d.ts +11 -0
  212. package/dist/components/semiotic-network.d.ts +11 -0
  213. package/dist/components/semiotic-ordinal.d.ts +8 -0
  214. package/dist/components/semiotic-physics-matter.d.ts +10 -0
  215. package/dist/components/semiotic-physics-rapier.d.ts +9 -0
  216. package/dist/components/semiotic-physics.d.ts +56 -0
  217. package/dist/components/semiotic-realtime-core.d.ts +34 -0
  218. package/dist/components/semiotic-realtime-react.d.ts +10 -0
  219. package/dist/components/semiotic-realtime.d.ts +4 -30
  220. package/dist/components/semiotic-recipes-core.d.ts +92 -0
  221. package/dist/components/semiotic-recipes-react.d.ts +7 -0
  222. package/dist/components/semiotic-recipes.d.ts +4 -43
  223. package/dist/components/semiotic-server-edge.d.ts +8 -0
  224. package/dist/components/semiotic-server-node.d.ts +5 -0
  225. package/dist/components/semiotic-server.d.ts +2 -2
  226. package/dist/components/semiotic-themes-core.d.ts +53 -0
  227. package/dist/components/semiotic-themes-react.d.ts +4 -0
  228. package/dist/components/semiotic-themes.d.ts +6 -76
  229. package/dist/components/semiotic-utils-core.d.ts +46 -0
  230. package/dist/components/semiotic-utils-react.d.ts +5 -0
  231. package/dist/components/semiotic-utils.d.ts +3 -39
  232. package/dist/components/semiotic-xy.d.ts +8 -0
  233. package/dist/components/semiotic.d.ts +35 -7
  234. package/dist/components/server/animatedGif.d.ts +36 -0
  235. package/dist/components/server/renderEvidence.d.ts +1 -1
  236. package/dist/components/server/renderToStaticSVG.d.ts +3 -35
  237. package/dist/components/server/serverChartConfigShared.d.ts +17 -0
  238. package/dist/components/server/serverChartConfigs.d.ts +19 -9
  239. package/dist/components/server/serverChartConfigsCustom.d.ts +5 -0
  240. package/dist/components/server/serverChartConfigsGeo.d.ts +9 -0
  241. package/dist/components/server/serverChartConfigsNetwork.d.ts +8 -0
  242. package/dist/components/server/serverChartConfigsOrdinal.d.ts +16 -0
  243. package/dist/components/server/serverChartConfigsPhysics.d.ts +9 -0
  244. package/dist/components/server/serverChartConfigsXY.d.ts +11 -0
  245. package/dist/components/server/staticGeo.d.ts +4 -0
  246. package/dist/components/server/staticLegend.d.ts +1 -1
  247. package/dist/components/server/staticNetwork.d.ts +8 -0
  248. package/dist/components/server/staticOrdinal.d.ts +11 -0
  249. package/dist/components/server/staticPhysics.d.ts +3 -0
  250. package/dist/components/server/staticSVGChrome.d.ts +110 -0
  251. package/dist/components/server/staticXY.d.ts +4 -0
  252. package/dist/components/store/ObservationStore.d.ts +3 -2
  253. package/dist/components/store/themeSerialization.d.ts +32 -0
  254. package/dist/components/store/useChartInterrogation.d.ts +9 -0
  255. package/dist/components/stream/AccessibleDataTable.d.ts +3 -13
  256. package/dist/components/stream/FocusRing.d.ts +4 -2
  257. package/dist/components/stream/GeoCanvasHitTester.d.ts +1 -1
  258. package/dist/components/stream/GeoPipelineStore.d.ts +28 -0
  259. package/dist/components/stream/NetworkPipelineStore.d.ts +31 -26
  260. package/dist/components/stream/NetworkSVGOverlay.d.ts +4 -1
  261. package/dist/components/stream/OrdinalPipelineStore.d.ts +46 -2
  262. package/dist/components/stream/PipelineStore.d.ts +81 -170
  263. package/dist/components/stream/SceneGraph.d.ts +9 -1
  264. package/dist/components/stream/StreamGeoFrame.d.ts +1 -1
  265. package/dist/components/stream/StreamNetworkFrame.d.ts +1 -1
  266. package/dist/components/stream/StreamOrdinalFrame.d.ts +1 -1
  267. package/dist/components/stream/StreamXYFrame.d.ts +2 -18
  268. package/dist/components/stream/accessibleDataRows.d.ts +33 -0
  269. package/dist/components/stream/accessorUtils.d.ts +23 -10
  270. package/dist/components/stream/brushAccessibility.d.ts +25 -0
  271. package/dist/components/stream/canvasBackground.d.ts +24 -0
  272. package/dist/components/stream/canvasSetup.d.ts +4 -1
  273. package/dist/components/stream/customLayoutFailure.d.ts +33 -0
  274. package/dist/components/stream/customLayoutPalette.d.ts +19 -9
  275. package/dist/components/stream/frameThemeColors.d.ts +24 -0
  276. package/dist/components/stream/geoAnnotationAnchors.d.ts +14 -0
  277. package/dist/components/stream/geoCartogram.d.ts +17 -0
  278. package/dist/components/stream/geoCustomLayout.d.ts +59 -0
  279. package/dist/components/stream/geoDefaultTooltip.d.ts +11 -0
  280. package/dist/components/stream/geoFrameHelpers.d.ts +34 -0
  281. package/dist/components/stream/geoPipelineHelpers.d.ts +46 -0
  282. package/dist/components/stream/geoTypes.d.ts +56 -7
  283. package/dist/components/stream/glyphDef.d.ts +98 -0
  284. package/dist/components/stream/hitTarget.d.ts +170 -0
  285. package/dist/components/stream/hoverUtils.d.ts +3 -0
  286. package/dist/components/stream/keyboardNav.d.ts +4 -1
  287. package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +9 -1
  288. package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +57 -0
  289. package/dist/components/stream/networkBezier.d.ts +10 -0
  290. package/dist/components/stream/networkColorAccessors.d.ts +49 -0
  291. package/dist/components/stream/networkDefaultTooltip.d.ts +10 -0
  292. package/dist/components/stream/networkFrameInteraction.d.ts +37 -0
  293. package/dist/components/stream/networkFramePaint.d.ts +43 -0
  294. package/dist/components/stream/networkPipelineConfig.d.ts +22 -0
  295. package/dist/components/stream/networkPipelineHelpers.d.ts +12 -0
  296. package/dist/components/stream/networkRealtimeEncoding.d.ts +41 -0
  297. package/dist/components/stream/networkTypes.d.ts +76 -5
  298. package/dist/components/stream/ordinalCanvasRenderers.d.ts +7 -0
  299. package/dist/components/stream/ordinalDataIndex.d.ts +5 -0
  300. package/dist/components/stream/ordinalDefaultTooltip.d.ts +10 -0
  301. package/dist/components/stream/ordinalDomain.d.ts +38 -0
  302. package/dist/components/stream/ordinalPipelineUpdateResults.d.ts +12 -0
  303. package/dist/components/stream/ordinalPulse.d.ts +10 -0
  304. package/dist/components/stream/ordinalPulseResources.d.ts +3 -0
  305. package/dist/components/stream/ordinalSceneBuilders/sceneBuilderMap.d.ts +5 -0
  306. package/dist/components/stream/ordinalSpatialIndex.d.ts +9 -0
  307. package/dist/components/stream/ordinalTypes.d.ts +40 -8
  308. package/dist/components/stream/paintNeeds.d.ts +31 -0
  309. package/dist/components/stream/physics/CapacityQueueController.d.ts +5 -0
  310. package/dist/components/stream/physics/CapacityQueueTypes.d.ts +134 -0
  311. package/dist/components/stream/physics/MatterPhysicsEngineAdapter.d.ts +42 -0
  312. package/dist/components/stream/physics/PhysicsAccessibility.d.ts +48 -0
  313. package/dist/components/stream/physics/PhysicsAnnotations.d.ts +58 -0
  314. package/dist/components/stream/physics/PhysicsBodyBudget.d.ts +26 -0
  315. package/dist/components/stream/physics/PhysicsBodySpatialIndex.d.ts +10 -0
  316. package/dist/components/stream/physics/PhysicsCanvasTheme.d.ts +26 -0
  317. package/dist/components/stream/physics/PhysicsControllers.d.ts +75 -0
  318. package/dist/components/stream/physics/PhysicsEngineAdapter.d.ts +59 -0
  319. package/dist/components/stream/physics/PhysicsEngineConformance.d.ts +23 -0
  320. package/dist/components/stream/physics/PhysicsEvidence.d.ts +25 -0
  321. package/dist/components/stream/physics/PhysicsKernel.d.ts +207 -0
  322. package/dist/components/stream/physics/PhysicsOptionalEngineAdapters.d.ts +12 -0
  323. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +84 -0
  324. package/dist/components/stream/physics/PhysicsPipelineTypes.d.ts +181 -0
  325. package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +72 -0
  326. package/dist/components/stream/physics/PhysicsSediment.d.ts +69 -0
  327. package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +18 -0
  328. package/dist/components/stream/physics/PhysicsSettledScene.d.ts +21 -0
  329. package/dist/components/stream/physics/PhysicsWorkerClient.d.ts +24 -0
  330. package/dist/components/stream/physics/PhysicsWorkerProtocol.d.ts +101 -0
  331. package/dist/components/stream/physics/PhysicsWorkerRuntime.d.ts +5 -0
  332. package/dist/components/stream/physics/RapierPhysicsEngineAdapter.d.ts +18 -0
  333. package/dist/components/stream/physics/ServiceOperationsControllers.d.ts +27 -0
  334. package/dist/components/stream/physics/ServiceOperationsTypes.d.ts +89 -0
  335. package/dist/components/stream/physics/StreamPhysicsFrame.d.ts +6 -0
  336. package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +302 -0
  337. package/dist/components/stream/physics/physicsBodyCanvas.d.ts +27 -0
  338. package/dist/components/stream/physics/physicsPipelineControls.d.ts +4 -0
  339. package/dist/components/stream/physics/physicsPipelineHelpers.d.ts +41 -0
  340. package/dist/components/stream/physics/physicsPipelineObservations.d.ts +14 -0
  341. package/dist/components/stream/physics/physicsPipelineUpdateResults.d.ts +9 -0
  342. package/dist/components/stream/physics/physicsRegionRuntime.d.ts +54 -0
  343. package/dist/components/stream/physics/physicsSemanticUI.d.ts +20 -0
  344. package/dist/components/stream/physics/usePhysicsFrameLifecyclePolicy.d.ts +16 -0
  345. package/dist/components/stream/pipelineBufferUtils.d.ts +26 -0
  346. package/dist/components/stream/pipelineConfig.d.ts +177 -0
  347. package/dist/components/stream/pipelineDecay.d.ts +20 -2
  348. package/dist/components/stream/pipelineDomainResolution.d.ts +62 -0
  349. package/dist/components/stream/pipelineIdentityOps.d.ts +26 -0
  350. package/dist/components/stream/pipelinePulse.d.ts +16 -2
  351. package/dist/components/stream/pipelineRibbons.d.ts +41 -0
  352. package/dist/components/stream/pipelineSpatialIndex.d.ts +12 -0
  353. package/dist/components/stream/pipelineStoreUpdateResults.d.ts +12 -0
  354. package/dist/components/stream/pipelineStyleResolvers.d.ts +46 -0
  355. package/dist/components/stream/pipelineTransitions.d.ts +2 -0
  356. package/dist/components/stream/pipelineUpdateContract.d.ts +62 -0
  357. package/dist/components/stream/pulseFrameRefresh.d.ts +22 -0
  358. package/dist/components/stream/renderers/glyphCanvasRenderer.d.ts +6 -0
  359. package/dist/components/stream/renderers/resolveCSSColor.d.ts +6 -0
  360. package/dist/components/stream/sceneRevisionDiagnostics.d.ts +18 -0
  361. package/dist/components/stream/streamStoreSync.d.ts +37 -0
  362. package/dist/components/stream/types.d.ts +135 -7
  363. package/dist/components/stream/useFrame.d.ts +21 -2
  364. package/dist/components/stream/useHydration.d.ts +6 -0
  365. package/dist/components/stream/useLegendCategoryEmission.d.ts +5 -0
  366. package/dist/components/stream/workerModuleUrl.d.ts +10 -0
  367. package/dist/components/stream/xyAnnotationAnchors.d.ts +13 -0
  368. package/dist/components/stream/xyCanvasRenderers.d.ts +7 -0
  369. package/dist/components/stream/xyCrosshair.d.ts +11 -0
  370. package/dist/components/stream/xyDateTicks.d.ts +9 -0
  371. package/dist/components/stream/xyDefaultTooltip.d.ts +10 -0
  372. package/dist/components/stream/xySceneBuilders/types.d.ts +4 -4
  373. package/dist/controls.min.js +2 -0
  374. package/dist/controls.module.min.js +2 -0
  375. package/dist/forceLayoutWorker.js +1 -0
  376. package/dist/geo.min.js +1 -1
  377. package/dist/geo.module.min.js +1 -1
  378. package/dist/network.min.js +1 -1
  379. package/dist/network.module.min.js +1 -1
  380. package/dist/ordinal.min.js +1 -1
  381. package/dist/ordinal.module.min.js +1 -1
  382. package/dist/physics-matter.min.js +1 -0
  383. package/dist/physics-matter.module.min.js +1 -0
  384. package/dist/physics-rapier.min.js +1 -0
  385. package/dist/physics-rapier.module.min.js +1 -0
  386. package/dist/physics.min.js +2 -0
  387. package/dist/physics.module.min.js +2 -0
  388. package/dist/physicsWorker.js +1 -0
  389. package/dist/realtime.min.js +1 -1
  390. package/dist/realtime.module.min.js +1 -1
  391. package/dist/semiotic-ai-chunk-OG7BQUUW.module.min.js +2 -0
  392. package/dist/semiotic-ai-core.d.ts +47 -0
  393. package/dist/semiotic-ai-core.min.js +1 -0
  394. package/dist/semiotic-ai-core.module.min.js +1 -0
  395. package/dist/semiotic-ai-statisticalOverlays-CY4WKR4A.module.min.js +2 -0
  396. package/dist/semiotic-ai.d.ts +50 -8
  397. package/dist/semiotic-ai.min.js +1 -1
  398. package/dist/semiotic-ai.module.min.js +1 -1
  399. package/dist/semiotic-chunk-3FSVZ46U.module.min.js +2 -0
  400. package/dist/semiotic-controls.d.ts +18 -0
  401. package/dist/semiotic-data.min.js +1 -1
  402. package/dist/semiotic-data.module.min.js +1 -1
  403. package/dist/semiotic-experimental.d.ts +38 -9
  404. package/dist/semiotic-experimental.min.js +1 -1
  405. package/dist/semiotic-experimental.module.min.js +1 -1
  406. package/dist/semiotic-geo.d.ts +11 -0
  407. package/dist/semiotic-network.d.ts +11 -0
  408. package/dist/semiotic-ordinal.d.ts +8 -0
  409. package/dist/semiotic-physics-matter.d.ts +10 -0
  410. package/dist/semiotic-physics-rapier.d.ts +9 -0
  411. package/dist/semiotic-physics.d.ts +56 -0
  412. package/dist/semiotic-realtime-core.d.ts +34 -0
  413. package/dist/semiotic-realtime-core.min.js +1 -0
  414. package/dist/semiotic-realtime-core.module.min.js +1 -0
  415. package/dist/semiotic-realtime-react.d.ts +10 -0
  416. package/dist/semiotic-realtime-react.min.js +2 -0
  417. package/dist/semiotic-realtime-react.module.min.js +2 -0
  418. package/dist/semiotic-realtime.d.ts +4 -30
  419. package/dist/semiotic-recipes-core.d.ts +92 -0
  420. package/dist/semiotic-recipes-core.min.js +1 -0
  421. package/dist/semiotic-recipes-core.module.min.js +1 -0
  422. package/dist/semiotic-recipes-react.d.ts +7 -0
  423. package/dist/semiotic-recipes-react.min.js +2 -0
  424. package/dist/semiotic-recipes-react.module.min.js +2 -0
  425. package/dist/semiotic-recipes.d.ts +4 -43
  426. package/dist/semiotic-recipes.min.js +1 -1
  427. package/dist/semiotic-recipes.module.min.js +1 -1
  428. package/dist/semiotic-server-edge.d.ts +8 -0
  429. package/dist/semiotic-server-edge.min.js +1 -0
  430. package/dist/semiotic-server-edge.module.min.js +1 -0
  431. package/dist/semiotic-server-node.d.ts +5 -0
  432. package/dist/semiotic-server-node.min.js +1 -0
  433. package/dist/semiotic-server-node.module.min.js +1 -0
  434. package/dist/semiotic-server.d.ts +2 -2
  435. package/dist/semiotic-statisticalOverlays-UOMSFKVJ.module.min.js +2 -0
  436. package/dist/semiotic-themes-core.d.ts +53 -0
  437. package/dist/semiotic-themes-core.min.js +1 -0
  438. package/dist/semiotic-themes-core.module.min.js +1 -0
  439. package/dist/semiotic-themes-react.d.ts +4 -0
  440. package/dist/semiotic-themes-react.min.js +2 -0
  441. package/dist/semiotic-themes-react.module.min.js +2 -0
  442. package/dist/semiotic-themes.d.ts +6 -76
  443. package/dist/semiotic-themes.min.js +1 -2
  444. package/dist/semiotic-themes.module.min.js +1 -2
  445. package/dist/semiotic-utils-core.d.ts +46 -0
  446. package/dist/semiotic-utils-core.min.js +1 -0
  447. package/dist/semiotic-utils-core.module.min.js +1 -0
  448. package/dist/semiotic-utils-react.d.ts +5 -0
  449. package/dist/semiotic-utils-react.min.js +2 -0
  450. package/dist/semiotic-utils-react.module.min.js +2 -0
  451. package/dist/semiotic-utils.d.ts +3 -39
  452. package/dist/semiotic-utils.min.js +1 -2
  453. package/dist/semiotic-utils.module.min.js +1 -2
  454. package/dist/semiotic-value.min.js +1 -1
  455. package/dist/semiotic-value.module.min.js +1 -1
  456. package/dist/semiotic-xy.d.ts +8 -0
  457. package/dist/semiotic.d.ts +35 -7
  458. package/dist/semiotic.min.js +1 -1
  459. package/dist/semiotic.module.min.js +1 -1
  460. package/dist/server.min.js +1 -1
  461. package/dist/server.module.min.js +1 -1
  462. package/dist/xy-chunk-IWD6IB6V.module.min.js +2 -0
  463. package/dist/xy-statisticalOverlays-7RWG6LJT.module.min.js +2 -0
  464. package/dist/xy.min.js +1 -1
  465. package/dist/xy.module.min.js +1 -1
  466. package/package.json +239 -87
  467. package/spec/README.md +152 -0
  468. package/spec/bindings/README.md +35 -0
  469. package/spec/bindings/vega-lite.mjs +112 -0
  470. package/spec/v0.1/annotation-provenance.schema.json +127 -0
  471. package/spec/v0.1/audience-profile.schema.json +67 -0
  472. package/spec/v0.1/chart-capability.schema.json +186 -0
  473. package/dist/components/recipes/gofish.d.ts +0 -207
  474. package/dist/components/recipes/gofishInterpreter.d.ts +0 -52
  475. package/dist/components/recipes/gofishLambdas.d.ts +0 -145
  476. package/dist/semiotic-ai-semiotic-ai-u954ylUn.js +0 -2
  477. package/dist/semiotic-ai-statisticalOverlays-CU7jW05Q.js +0 -1
  478. package/dist/semiotic-semiotic-BmrYbi99.js +0 -2
  479. package/dist/semiotic-statisticalOverlays-IjZw8Lsu.js +0 -1
  480. package/dist/xy-semiotic-xy-Dufu3D0-.js +0 -2
  481. package/dist/xy-statisticalOverlays-3Ni9bRph.js +0 -1
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{useRef as i,useMemo as r,useContext as l,useCallback as a,useSyncExternalStore as s,createContext as c,useState as u,useEffect as d,useLayoutEffect as h,forwardRef as f,useImperativeHandle as p,useId as g}from"react";import{geoPath as y,geoGraticule as m,geoDistance as v,geoInterpolate as b,geoEqualEarth as x,geoEquirectangular as w,geoNaturalEarth1 as k,geoOrthographic as j,geoAlbersUsa as O,geoMercator as M}from"d3-geo";import{scaleLinear as A,scaleOrdinal as S,scaleSequential as C}from"d3-scale";import{quadtree as P}from"d3-quadtree";import{bin as z}from"d3-array";import{packEnclose as L}from"d3-hierarchy";import{area as D,curveCatmullRom as I,curveCardinal as N,curveBasis as $,curveStepBefore as W,curveStepAfter as R,curveStep as B,curveMonotoneY as _,curveMonotoneX as T,curveLinear as E,curveNatural as F,line as H}from"d3-shape";import G from"regression";import{zoomIdentity as q,zoom as V}from"d3-zoom";import{select as U}from"d3-selection";class Z{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,l=this.buffer[r];if(e(l)){let e;e="object"!=typeof l||null===l?l:Array.isArray(l)?[...l]:Object.assign({},l),n.push(e),this.buffer[r]=t(l)}}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 Y(e,t,n){return e+(t-e)*n}function X(e,t,n){var o,i,r;if(1>=n)return 1;const l=null!==(o=e.minOpacity)&&void 0!==o?o:.1,a=n-1-t;switch(e.type){case"linear":return l+(1-a/(n-1))*(1-l);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return l+Math.pow(.5,a/t)*(1-l)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>a?1:l;default:return 1}}function Q(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 K(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}function J(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 ee={mercator:M,equalEarth:x,albersUsa:O,orthographic:j,naturalEarth:k,equirectangular:w};function te(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function ne(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function oe(e,t,n){return e?Object.assign(Object.assign({},n),"function"==typeof e?e(t):e):Object.assign({},n)}function ie(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 re(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 l=-i/r,a=o/r,s=Math.min(.3*r,80),c=(e[0]+t[0])/2+l*s,u=(e[1]+t[1])/2+a*s,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 le(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,l;0===t?(r=e[1][0]-i[0],l=e[1][1]-i[1]):t===e.length-1?(r=i[0]-e[t-1][0],l=i[1]-e[t-1][1]):(r=e[t+1][0]-e[t-1][0],l=e[t+1][1]-e[t-1][1]);const a=Math.sqrt(r*r+l*l)||1;o.push([i[0]+l/a*n,i[1]+-r/a*n])}return o}function ae(e,t,n,o,i){const r=t[0]-e[0],l=t[1]-e[1],a=Math.sqrt(r*r+l*l);if(0===a)return[e,t];const s=l/a,c=-r/a,u=i/2+1;return[[e[0]+s*u,e[1]+c*u],[t[0]+s*u,t[1]+c*u]]}class se{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 Z(e),this.timestampBuffer=new Z(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 x();if("string"==typeof e){const t=ee[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),x())}if("object"==typeof e&&"type"in e){const t=ee[e.type],n=t?t():x();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=y(this.projection),this.fitProjection(e),this.geoPath=y(this.projection);const n=this.projection;this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null};const o=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&&o.length>0&&this.startTransition(o),this.version++}fitProjection(e){var t,n,o,i,r;const l=this.projection,a=this.config,s=[...this.areas],c=te(a.xAccessor,"lon"),u=te(a.yAccessor,"lat"),d=this.getPoints();if(d.length>0){const e=d.map(e=>[c(e),u(e)]);s.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const h=ne(a.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)]);s.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==s.length){if(a.projectionExtent){const[[t,n],[o,i]]=a.projectionExtent;l.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(l.clipAngle&&(null!==(t=l.clipAngle())&&void 0!==t?t:0)>0){const t=null!==(n=a.fitPadding)&&void 0!==n?n:0,o=Math.min(e.width,e.height);l.scale(o/2-o*t),l.translate([e.width/2,e.height/2])}else{const t=null!==(o=a.fitPadding)&&void 0!==o?o:0,n=e.width*t,i=e.height*t;l.fitExtent([[n,i],[e.width-n,e.height-i]],{type:"FeatureCollection",features:s})}this.baseScale=l.scale(),this.baseTranslate=l.translate(),this.baseRotation=null!==(r=null===(i=l.rotate)||void 0===i?void 0:i.call(l))&&void 0!==r?r:[0,0,0]}}applyZoomTransform(e,t){const n=this.projection;n&&(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=y(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.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const n=this.projection;n&&(n.scale(this.baseScale*e),n.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=y(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.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const n=this.projection;n&&n.rotate&&(n.rotate(e),this.geoPath=y(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.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,se.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=P().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){var t,n,o;const i=[],{config:r}=this,l=this.projection,a=this.geoPath,s=te(r.xAccessor,"lon"),c=te(r.yAccessor,"lat"),u=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}}(r),d=function(e){var t;return{stroke:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",strokeWidth:1.5,fill:"none"}}(r),h=function(e){var t;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",r:4,fillOpacity:.8}}(r);if(r.graticule){const t=!0===r.graticule?{}:r.graticule,n=m();t.step&&n.step(t.step);const o=a(n())||"";o&&i.push({type:"geoarea",pathData:o,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),l=a.area(e),s=oe(r.areaStyle,e,u);i.push({type:"geoarea",pathData:t,centroid:n,bounds:o,screenArea:l,style:s,datum:e,interactive:!0})}const f=ne(r.lineDataAccessor);for(const t of this.lineData){const n=f(t);if(!n||2>n.length)continue;let o=[];if("geo"===r.lineType){const e=Array(n.length);for(let t=0;n.length>t;t++)e[t]=[s(n[t]),c(n[t])];for(let t=0;e.length-1>t;t++){const n=e[t],i=e[t+1],r=v(n,i)||0,a=Math.max(2,Math.ceil(r/(Math.PI/180))),s=b(n,i);for(let e=0;a>=e;e++){if(t>0&&0===e)continue;const n=l(s(e/a));null!=n&&o.push(n)}}}else for(let e=0;n.length>e;e++){const t=n[e],i=l([s(t),c(t)]);null!=i&&o.push(i)}if(2>o.length)continue;const a=oe(r.lineStyle,t,d),u="number"==typeof a.strokeWidth?a.strokeWidth:1;2!==n.length||2>o.length||"arc"!==r.flowStyle?2!==n.length||2>o.length||"offset"!==r.flowStyle||(o="geo"===r.lineType?le(o,u):ae(o[0],o[o.length-1],0,0,u)):o=re(o[0],o[o.length-1]);const h=ie(o,e.width);if(h.length>1)for(const e of h){if(2>e.length)continue;const n={type:"line",path:e,style:Object.assign(Object.assign({},a),{_edgeFade:!0}),datum:t};i.push(n)}else i.push({type:"line",path:2>o.length&&h[0]||o,style:a,datum:t})}const p=this.getPoints(),g=r.pointIdAccessor?"function"==typeof r.pointIdAccessor?r.pointIdAccessor:e=>e[r.pointIdAccessor]:null,y=l.clipAngle&&null!==(t=l.clipAngle())&&void 0!==t?t:0,x=y>0?y*Math.PI/180:null,w=l.rotate?l.rotate():[0,0,0],k="function"==typeof l.center?l.center():[0,0],j=[(null!==(n=k[0])&&void 0!==n?n:0)-w[0],(null!==(o=k[1])&&void 0!==o?o:0)-w[1]];for(let e=0;p.length>e;e++){const t=p[e],n=s(t),o=c(t);if(null!=x&&v([n,o],j)>x)continue;const a=l([n,o]);if(!a)continue;const u=r.pointStyle?r.pointStyle(t):Object.assign({},h),d={type:"point",x:a[0],y:a[1],r:u.r||4,style:u,datum:t,pointId:g?g(t)+"":void 0};i.push(d)}return i}applyCartogramTransform(e,t){var n,o,i;const r=this.scene.filter(e=>"point"===e.type);if(2>r.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,s="function"==typeof e.costAccessor?e.costAccessor:t=>t[e.costAccessor],c=r.find(t=>t.datum&&a(t.datum)+""==e.center+"");if(!c)return void("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${e.center}" not found in point data`));const u=c.x,d=c.y,h=K(r.map(e=>e.datum?s(e.datum):NaN).filter(e=>isFinite(e)&&e>=0),1),f=Math.min(t.width,t.height)/2,p=A().domain([0,h]).range([0,f]);this.cartogramLayout={cx:u,cy:d,maxCost:h,availableRadius:f},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 r){if(e===c)continue;if(!e.datum)continue;const t=Math.atan2(e.y-d,e.x-u),n=Math.sqrt(Math.pow(e.x-u,2)+Math.pow(e.y-d,2)),o=s(e.datum),i=n+((isFinite(o)?p(o):n)-n)*l;e.x=u+Math.cos(t)*i,e.y=d+Math.sin(t)*i}const g=t.width/2,y=t.height/2,m=g-c.x,v=y-c.y;if(Math.abs(m)>.5||Math.abs(v)>.5)for(const e of r)e.x+=m,e.y+=v;this.cartogramLayout={cx:g,cy:y,maxCost:h,availableRadius:f};const b=this.scene.filter(e=>"line"===e.type);if(b.length>0&&"fractional"!==e.lineMode){const e=new Map;for(const t of r)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of b){const n=null===(o=t.datum)||void 0===o?void 0:o.source,r=null===(i=t.datum)||void 0===i?void 0:i.target;if(n&&r){const o=e.get(n+""),i=e.get(r+"");o&&i&&(t.path=[o,i])}}}}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=X(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 l=J(t,i[r],n);l>0&&(o[r]._pulseIntensity=l,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 l=new Map;for(const t of e)"point"===t.type&&t.pointId&&l.set(t.pointId,[t.x,t.y]);const a=this.scene.filter(e=>"point"===e.type);let s=!1;for(const e of a)if(e.pointId){const t=l.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)&&(s=!0))}for(const e of a)e.pointId&&!l.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}),s=!0);s&&(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=Y(e.x,e._targetX,n),e.y=Y(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 ce(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function ue(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function de(e,t){const n=ue(e);if(!n)return!1;const o=ue(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function he(e,t,n,o,i,r,l=0){if(r){const e=function(e,t,n,o,i,r=e=>e.x,l=e=>e.y,a=e=>e.r){const s=Math.max(o,i+5,12),c=t-s,u=t+s,d=n-s,h=n+s;let f=null,p=1/0;return e.visit((e,i,s,g,y)=>{if(i>u||c>g||s>h||d>y)return!0;if(!e.length){let i=e;do{const e=i.data,s=r(e)-t,c=l(e)-n,u=Math.sqrt(s*s+c*c);ce(a(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,l);if(e)return e}else{let i=null,r=o;for(const l of e){if("point"!==l.type)continue;const e=l.x-t,a=l.y-n,s=Math.sqrt(e*e+a*a);ce(l.r,o)>=s&&r>s&&(i=l,r=s)}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 l=r;if(!1===l.interactive)continue;const[[a,s],[c,u]]=l.bounds;if(!(a>t||t>c||s>n||n>u)&&(l._cachedPath2D||(l._cachedPath2D=new Path2D(l.pathData)),i.isPointInPath(l._cachedPath2D,t,n)))return{node:l,distance:0}}let a=null,s=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[l,c]=i[o],[u,d]=i[o+1],h=fe(t,n,l,c,u,d);r>=h&&s>h&&(a=e,s=h)}}return a?{node:a,distance:s}:null}function fe(e,t,n,o,i,r){const l=i-n,a=r-o,s=l*l+a*a;if(0===s)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*l+(t-o)*a)/s;c=Math.max(0,Math.min(1,c));const u=o+c*a;return Math.sqrt(Math.pow(e-(n+c*l),2)+Math.pow(t-u,2))}function pe(t){let n=null;const o=()=>(n||(n=c(null)),n),u=ge(t);return[function({children:n,initialState:l}){const a=i(l),s=r(()=>ge(t,a.current),[]),c=o();return e(c.Provider,{value:s,children:n})},(e,t)=>{var n;const r=o(),c=null!==(n=l(r))&&void 0!==n?n:u,d=i(e);d.current=e;const h=i({hasValue:!1,value:void 0}),f=a(()=>{const e=d.current(c.getState()),n=h.current;return n.hasValue&&t&&t(n.value,e)?n.value:(h.current={hasValue:!0,value:e},e)},[c,t]),p=a(()=>d.current(c.getState()),[c]);return s(c.subscribe,f,p)}]}function ge(e,t){const n=new Set;let o=Object.assign(Object.assign({},e(function(e){const t=e(o);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){o=Object.assign(Object.assign({},o),t);for(const e of n)e()}})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.add(e),()=>{n.delete(e)}}}}function ye(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 me(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:ve})})),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}se.QUADTREE_THRESHOLD=500;const ve=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],be={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}},xe={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}},we={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:ve,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 ke(e,t){if("light"===t)return be;if("dark"===t)return xe;if("high-contrast"===t)return we;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?xe:be;return me(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 me(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[je,Oe]=pe(e=>({theme:be,setTheme(t){e(e=>({theme:ke(e.theme,t)}))}}));const Me=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Ae=new WeakMap;let Se=0,Ce=!1,Pe=null,ze=null,Le=null;function De(e,t){var n,o;if(!t)return t;const i=Me.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(Ce)return;if("undefined"==typeof window||"undefined"==typeof document)return;Ce=!0;const e=()=>{Se++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Pe=new MutationObserver(e),Pe.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{ze=window.matchMedia("(prefers-color-scheme: dark)"),Le=e,"function"==typeof ze.addEventListener?ze.addEventListener("change",Le):"function"==typeof ze.addListener&&ze.addListener(Le)}catch(e){}}();let l=Ae.get(r);l&&l.version===Se||(l={version:Se,map:new Map},Ae.set(r,l));const a=l.map.get(t);if(void 0!==a)return a;const s=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return l.map.set(t,s),s}const Ie="undefined"==typeof window?d:h;function Ne(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function $e(e){const t=function(){const[e,t]=u(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return d(()=>{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=i(t);n.current=t;const[l,s]=function(e,t,n){const o=i(null),[r,l]=u(null);return d(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;l(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return i.observe(e),()=>i.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),c=r(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),h=s[0]-c.left-c.right,f=s[1]-c.top-c.bottom,p=Ne(e.foregroundGraphics,s,c),g=Ne(e.backgroundGraphics,s,c),y=Oe(e=>e.theme),{transition:m,introEnabled:v}=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),b="semiotic-table-"+o.useId(),x=i(0),w=i(()=>{}),k=a(()=>{x.current||(x.current=requestAnimationFrame(()=>w.current()))},[]);d(()=>()=>{x.current&&(cancelAnimationFrame(x.current),x.current=0)},[]);const j=i(()=>{}),O=i(()=>{}),M=i(null),A=i(0),S=a(()=>{A.current=0;const e=M.current;M.current=null,e&&j.current(e)},[]),C=a(e=>{M.current={clientX:e.clientX,clientY:e.clientY},0===A.current&&(A.current=requestAnimationFrame(S))},[S]),P=a(()=>{M.current=null,0!==A.current&&(cancelAnimationFrame(A.current),A.current=0),O.current()},[]);d(()=>()=>{M.current=null,0!==A.current&&(cancelAnimationFrame(A.current),A.current=0)},[]);const z=e.themeDirtyRef;return Ie(()=>{z&&(Se++,z.current=!0,k())},[y,k,z]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:l,size:s,margin:c,adjustedWidth:h,adjustedHeight:f,resolvedForeground:p,resolvedBackground:g,currentTheme:y,transition:m,introEnabled:v,tableId:b,rafRef:x,renderFnRef:w,scheduleRender:k,hoverHandlerRef:j,hoverLeaveRef:O,onPointerMove:C,onPointerLeave:P}}const We={fresh:1,aging:.7,stale:.45,expired:.25},Re={alpha:1,band:"fresh",isStale:!1};function Be({isStale:t,position:n}){return e("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 _e={fill:(t,n)=>e("rect",{style:t,width:n,height:n}),line:(t,n)=>e("line",{style:t,x1:0,y1:0,x2:n,y2:n})};function Te(e,t,n,o,i){let r;return r="function"==typeof n?n(e):(0,_e[n])(o(e,t),i),r}function Ee({swatchSize:t}){return e("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 Fe(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const He=(n,o,i,r,l,a,s,c,u,d,h)=>{const{type:f="fill",styleFn:p,items:g}=n,y=[];let m=0;const v=!(!o&&!i),b="isolate"===d||void 0===d&&null!=l,{swatchSize:x,labelGap:w,rowHeight:k}=h;return g.forEach((n,d)=>{const h=Te(n,d,f,p,x),j=Fe(n,r,l),O=l&&l.size>0&&l.has(n.label);y.push(t("g",{transform:`translate(0,${m})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:v?c===a&&d===s?0:-1:void 0,role:v?"option":void 0,"aria-selected":v&&b?O||!1:void 0,"aria-current":v&&!b&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:v?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const n=(d+("ArrowDown"===e.key?1:-1)+g.length)%g.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:v?e=>{u(c,d),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:v?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:v?"pointer":"default",opacity:j,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[v&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+w+2+7*n.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),h,O&&e(Ee,{swatchSize:x}),e("text",{y:x/2,x:x+w,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+d)),m+=k}),y};function Ge({config:n,orientation:i="vertical",width:r=100}){const{colorFn:l,domain:a,label:s,format:c}=n,u=c||(e=>Math.round(100*e)/100+""),d="grad-legend-"+o.useId();if("horizontal"===i){const n=12,o=Math.min(r,200),i=Math.max(0,(r-o)/2),c=[];for(let t=0;64>=t;t++){const n=t/64;c.push(e("stop",{offset:100*n+"%",stopColor:l(a[0]+n*(a[1]-a[0]))},t))}return t("g",{"aria-label":s||"Gradient legend",children:[e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),s&&e("text",{x:i+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e("rect",{x:i,y:0,width:o,height:n,fill:`url(#${d})`,rx:2}),e("text",{x:i,y:n+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[0])}),e("text",{x:i+o,y:n+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[1])})]})}const h=[];for(let t=0;64>=t;t++){const n=t/64;h.push(e("stop",{offset:100*n+"%",stopColor:l(a[1]-n*(a[1]-a[0]))},t))}return t("g",{"aria-label":s||"Gradient legend",children:[s&&e("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e("defs",{children:e("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:h})}),e("rect",{x:0,y:0,width:14,height:100,fill:`url(#${d})`,rx:2}),e("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[1])}),e("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:u(a[0])})]})}function qe(n){const{legendGroups:i,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:a,isolatedCategories:s,legendInteraction:c,title:u="Legend",width:d=100,height:h=20,orientation:f="vertical",legendLayout:p}=n,g=function(e){var t,n,o,i,r;const l=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),a=Math.max(l,null!==(n=null==e?void 0:e.rowHeight)&&void 0!==n?n:22);return{swatchSize:l,labelGap:Math.max(0,null!==(o=null==e?void 0:e.labelGap)&&void 0!==o?o:6),itemGap:Math.max(0,null!==(i=null==e?void 0:e.itemGap)&&void 0!==i?i:10),rowHeight:a,align:"left"===(null==e?void 0:e.align)?"start":"right"===(null==e?void 0:e.align)?"end":null!==(r=null==e?void 0:e.align)&&void 0!==r?r:"start",maxWidth:null==e?void 0:e.maxWidth}}(p),[y,m]=o.useState(0),[v,b]=o.useState(0),x=o.useCallback((e,t)=>{m(e),b(t)},[]),w="vertical"===f?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:l,focusedGroupIndex:a,focusedItemIndex:s,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=24;const f=[];return t.forEach((t,p)=>{h+=5,f.push(e("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("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("g",{className:"legend-item",transform:`translate(0,${h})`,children:He(t,o,i,r,l,a,s,p,c,u,d)},"legend-group-"+p)),h+=t.items.length*d.rowHeight+8}),f})({legendGroups:i||[],width:d,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:a,isolatedCategories:s,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:g}):(({legendGroups:n,height:o,width:i,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:a,isolatedCategories:s,focusedGroupIndex:c,focusedItemIndex:u,onFocusedIndexChange:d,legendInteraction:h,metrics:f})=>{var p;let g=0;const y=[];n.forEach((n,o)=>{var p;let m=0;n.label&&(m+=16);const v=((n,o,i,r,l,a,s,c,u,d,h,f)=>{const{type:p="fill",styleFn:g,items:y}=n,m=[],{swatchSize:v,labelGap:b,itemGap:x,rowHeight:w,align:k}=h,j=!(!o&&!i),O="isolate"===d||void 0===d&&null!=l,M=y.map(e=>v+b+7*e.label.length),A=[];let S=0,C=0;M.forEach((e,t)=>{const n=0===C?e:C+x+e;f&&f>0&&C>0&&n>f?(A.push({start:S,end:t,width:C}),S=t,C=e):C=n}),y.length>0&&A.push({start:S,end:y.length,width:C}),A.forEach((n,d)=>{let h="center"===k?Math.max(0,((null!=f?f:n.width)-n.width)/2):"end"===k?Math.max(0,(null!=f?f:n.width)-n.width):0;for(let f=n.start;n.end>f;f++){const n=y[f],k=Te(n,f,p,g,v),A=Fe(n,r,l),S=l&&l.size>0&&l.has(n.label);m.push(t("g",{transform:`translate(${h},${d*w})`,onClick:o?()=>o(n):void 0,onMouseEnter:i?()=>i(n):void 0,onMouseLeave:i?()=>i(null):void 0,tabIndex:j?c===a&&f===s?0:-1:void 0,role:j?"option":void 0,"aria-selected":j&&O?S||!1:void 0,"aria-current":j&&!O&&null!=r&&n.label===r||void 0,"aria-label":n.label,onKeyDown:j?e=>{var t;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(n)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const n=(f+("ArrowRight"===e.key?1:-1)+y.length)%y.length;u(c,n);const o=null===(t=e.currentTarget.parentElement)||void 0===t?void 0:t.children[n];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:j?e=>{u(c,f),i&&i(n);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","visible")}:void 0,onBlur:j?e=>{i&&i(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:j?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[j&&e("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:v+b+2+7*n.label.length,height:v+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),k,S&&e(Ee,{swatchSize:v}),e("text",{y:v/2,x:v+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label})]},"legend-item-"+f)),h+=M[f]+x}});const P=Math.max(0,...A.map(e=>e.width)),z=A.length;return{items:m,offset:P,totalRows:z,totalHeight:z*w}})(n,r,l,a,s,c,u,o,d,h,f,null!==(p=f.maxWidth)&&void 0!==p?p:i);m+=v.offset+5,y.push(Object.assign(Object.assign({label:n.label},v),{offset:m,totalRows:v.totalRows,totalHeight:v.totalHeight})),g+=m+12});const m=null!==(p=f.maxWidth)&&void 0!==p?p:i;let v=g>m?0:"center"===f.align?Math.max(0,(m-g)/2):"end"===f.align?Math.max(0,m-g):0;const b=[];return y.forEach((t,i)=>{const r=n[i];r.label&&(b.push(e("text",{transform:`translate(${v},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)),v+=16),b.push(e("g",{className:"legend-item",transform:`translate(${v},0)`,children:t.items},"legend-group-"+i)),v+=t.offset+5,n[i+1]&&b.push(e("line",{stroke:"gray",x1:v,y1:-8,x2:v,y2:(t.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),v+=12}),e("g",{children:b})})({legendGroups:i||[],title:u,height:h,width:d,customClickBehavior:r,customHoverBehavior:l,highlightedCategory:a,isolatedCategories:s,focusedGroupIndex:y,focusedItemIndex:v,onFocusedIndexChange:x,legendInteraction:c,metrics:g}),k=!(!r&&!l);return t("g",{role:k?"listbox":void 0,"aria-multiselectable":!(!k||"isolate"!==c&&(void 0!==c||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==u&&""!==u&&"vertical"===f&&e("text",{className:"legend-title",y:16,x:d/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:u}),w]})}function Ve(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function Ue(t){var n;const{legend:o,totalWidth:i,totalHeight:r,margin:l,legendPosition:a="right",legendLayout:s,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:f,legendInteraction:p}=t;if(!o)return null;const g="top"===a||"bottom"===a,y=!!c,m=Math.max(1,g?null!==(n=null==s?void 0:s.maxWidth)&&void 0!==n?n:Math.max(0,i-l.left-l.right):100);let v,b;return"left"===a?(v=Math.max(4,l.left-m-10),b=l.top):"top"===a?(v=l.left,b=y?32:8):"bottom"===a?(v=l.left,b=r-l.bottom+38):(v=i-l.right+10,b=l.top),e("g",{transform:`translate(${v}, ${b})`,children:(x=o,"object"==typeof x&&null!==x&&"gradient"in x?e(Ge,{config:o.gradient,orientation:g?"horizontal":"vertical",width:m}):Ve(o)?e(qe,{legendGroups:o.legendGroups,title:"",width:m,orientation:g?"horizontal":"vertical",legendLayout:s,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:f,legendInteraction:p}):o)});var x}function Ze(e){return"string"==typeof e?{type:e}:e}function Ye({orient:n,config:o,values:i,scale:l,size:a,length:s}){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=r(()=>{if(0===i.length)return null;const o=l.domain(),r=a-8;if("boxplot"===c.type){const o=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)],l=r-o;return{q1:o,median:i,q3:r,whiskerLow:Math.max(t[0],o-1.5*l),whiskerHigh:Math.min(t[n-1],r+1.5*l)}}(i);if(!o)return null;const{q1:a,median:s,q3:d,whiskerLow:h,whiskerHigh:f}=o,p=Math.min(.5*r,20),g=(r-p)/2+4;if(u){const o=l(a),i=l(d),r=l(s),u=l(h),y=l(f),m="top"===n?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:u,y1:v+m*(g+p/2),x2:y,y2:v+m*(g+p/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:u,y1:v+m*g,x2:u,y2:v+m*(g+p),stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:y,y1:v+m*g,x2:y,y2:v+m*(g+p),stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:Math.min(o,i),y:"top"===n?v-g-p:v+g,width:Math.abs(i-o),height:p,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:r,y1:"top"===n?v-g-p:v+g,x2:r,y2:"top"===n?v-g:v+g+p,stroke:c.fill,strokeWidth:2})]})}{const o=l(a),i=l(d),r=l(s),u=l(h),y=l(f),m="left"===n?-1:1,v=0;return t("g",{"data-testid":"marginal-boxplot-"+n,children:[e("line",{x1:v+m*(g+p/2),y1:u,x2:v+m*(g+p/2),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*g,y1:u,x2:v+m*(g+p),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e("line",{x1:v+m*g,y1:y,x2:v+m*(g+p),y2:y,stroke:c.fill,strokeWidth:c.strokeWidth}),e("rect",{x:"left"===n?v-g-p:v+g,y:Math.min(o,i),width:p,height:Math.abs(i-o),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e("line",{x1:"left"===n?v-g-p:v+g,y1:r,x2:"left"===n?v-g:v+g+p,y2:r,stroke:c.fill,strokeWidth:2})]})}}const d=z().domain(o).thresholds(c.bins)(i);if(0===d.length)return null;const h=K(d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,o)=>{if(null==t.x0||null==t.x1)return null;const i=t.length/h*r;if(u){const r=l(t.x0),a=l(t.x1)-l(t.x0);return e("rect",{x:r,y:"top"===n?-4-i:4,width:Math.max(a,.5),height:i,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}{const r=l(t.x0),a=l(t.x1)-l(t.x0);return e("rect",{x:"left"===n?-4-i:4,y:Math.min(r,r+a),width:i,height:Math.abs(a),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},o)}})});if("violin"===c.type){const t=r/2+4,o=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*(r/2),a=l((e.x0+e.x1)/2);o.push(u?`${a},${"top"===n?-(t-i):t-i}`:`${"left"===n?-(t-i):t-i},${a}`)}for(let e=d.length-1;e>=0;e--){const i=d[e];if(null==i.x0||null==i.x1)continue;const a=i.length/h*(r/2),s=l((i.x0+i.x1)/2);o.push(u?`${s},${"top"===n?-(t+a):t+a}`:`${"left"===n?-(t+a):t+a},${s}`)}return e("g",{"data-testid":"marginal-violin-"+n,children:e("polygon",{points:o.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,o=null!=d[0].x0?l(d[0].x0):0;t.push(`M${o},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=l((e.x0+e.x1)/2);t.push(`L${i},${"top"===n?-o-4:o+4}`)}const i=null!=d[d.length-1].x1?l(d[d.length-1].x1):s;t.push(`L${i},${e}`),t.push("Z")}else{const e=0,o=null!=d[0].x0?l(d[0].x0):0;t.push(`M${e},${o}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const o=e.length/h*r,i=l((e.x0+e.x1)/2);t.push(`L${"left"===n?-o-4:o+4},${i}`)}const i=null!=d[d.length-1].x1?l(d[d.length-1].x1):s;t.push(`L${e},${i}`),t.push("Z")}return e("g",{"data-testid":"marginal-ridgeline-"+n,children:e("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,l,c,a,s,n,u,4]);return d?e("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function Xe(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let l="";for(const e of i)l&&l.length+1+e.length>o?(r.push(l),l=e):l=l?`${l} ${e}`:e;return l&&r.push(l),r}function Qe(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Ke(n,o,i,r){if(!n)return e("g",{className:"annotation-note"});const{label:l,title:a,orientation:s,align:c,wrap:u=120,noWrap:d}=n;if(!l&&!a)return e("g",{className:"annotation-note"});let h=s;h||(h=Math.abs(o)>Math.abs(i)?"leftRight":"topBottom");let f=c;f&&"dynamic"!==f||(f="topBottom"===h?0>o?"right":"left":0>i?"bottom":"top");let p="start";"topBottom"===h?"right"===f?p="end":"middle"===f&&(p="middle"):p=0>o?"end":"start";const g=16,y=a?d?[a]:Xe(a,u):[],m=l?d?[l]:Xe(l,u):[],v="leftRight"===h?"end"===p?-4:4:0;let b=0;const x=[],w=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";n.useHTML||n.html?(x.push(e("foreignObject",{className:"annotation-note-html",x:"end"===p?v-u:"middle"===p?v-u/2:v,y:-16,width:u,height:Math.max(g,(y.length+m.length)*g+(a&&l?2:0))+g,style:{overflow:"visible"},children:t("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:w,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===p?"right":"middle"===p?"center":"left",whiteSpace:d?"nowrap":"normal",wordBreak:"break-word"},children:[a&&e("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:a}),l&&e("div",{className:"annotation-note-label",children:l})]})},"annotation-note-html")),b=y.length*g):(y.length>0&&(x.push(e("text",{className:"annotation-note-title",fill:w,textAnchor:p,fontWeight:"bold",children:y.map((t,n)=>e("tspan",{x:v,dy:0===n?0:g,children:t},n))},"annotation-note-title")),b=y.length*g),m.length>0&&x.push(e("text",{className:"annotation-note-label",fill:w,textAnchor:p,y:b,children:m.map((t,n)=>e("tspan",{x:v,dy:0===n?0:g,children:t},n))},"annotation-note-label")));let k=null;if((a||l)&&(0!==o||0!==i))if("topBottom"===h){const t=Math.min(u,120);let n=0,o=t;"end"===p?(n=-t,o=0):"middle"===p&&(n=-t/2,o=t/2),k=e("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+m.length)*g+(m.length>0?g:0);let n=0,o=t;"bottom"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),k=e("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const j=Math.max(0,y.length+m.length-1)*g;let O=0;return"topBottom"===h?O=0>i?-(j+2):18:"leftRight"===h&&(O="middle"===f?-(j+g+(m.length>0&&y.length>0?2:0))/2+8:"bottom"===f||0>i?-(j+2):18),t("g",{className:"annotation-note",transform:`translate(${o},${i})`,children:[e("g",{className:"annotation-note-content",transform:0!==O?`translate(0,${O})`:void 0,children:x}),k]})}function Je(t,n,o,i,r){var l;const a=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&a.push(e("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&a.push(e("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&a.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,l=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;a.push(e("line",{x1:i,y1:(n.y1||0)-l,x2:i,y2:(n.y2||0)-l,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)-l;a.push(e("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?a.push(e("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||a.push(e("line",{x1:0,y1:(n.y1||0)-l,x2:0,y2:(n.y2||0)-l,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(l=null==n?void 0:n.width)&&void 0!==l?l:null==n?void 0:n.height;void 0!==t&&a.push(e("path",{d:Qe((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("g",{className:"annotation-subject",children:a})}function et(t,n,o,i,r,l){var a;const s=[];let c=0,u=0;if("callout-circle"!==r&&"label"!==r||!(null==l?void 0:l.radius)){if("callout-rect"===r&&l){const e=l.width||0,o=l.height||0;if(e>0||o>0){const i=e/2,r=o/2,l=t-i,a=n-r;if(0!==l||0!==a){const t=Math.abs(l),n=Math.abs(a),s=e/2,d=o/2,h=t*d>n*s?s/t:d/n;c=i+l*h,u=r+a*h}}}else if("bracket"===r&&l){const e=l.width,t=l.height,n=l.depth||30;void 0!==e?(c=e/2,u=n):void 0!==t&&(c=n,u=t/2)}}else{const e=(l.radius||0)+(l.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)",l="curve"===(null==o?void 0:o.type);let h=Math.atan2(n-u,t-c);if(l){const i=(null!==(a=null==o?void 0:o.curve)&&void 0!==a?a:.25)*d,l=(c+t)/2+-(n-u)/d*i,f=(u+n)/2+(t-c)/d*i;s.push(e("path",{className:"connector-curve",d:`M${c},${u}Q${l},${f} ${t},${n}`,fill:"none",stroke:r},"connector-line")),h=Math.atan2(f-u,l-c)}else s.push(e("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;s.push(e("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("g",{className:"annotation-connector",children:s})}function tt(e){var n,o;const{x:i=0,y:r=0,dx:l,dy:a,nx:s,ny:c,note:u,connector:d,subject:h,type:f,color:p,className:g,disable:y,opacity:m,strokeDasharray:v,events:b={},"data-testid":x}=e,w=Array.isArray(i)?null!==(n=i[0])&&void 0!==n?n:0:i,k=Array.isArray(r)?null!==(o=r[0])&&void 0!==o?o:0:r,j=new Set(Array.isArray(y)?y:[]);let O=l||0,M=a||0;null!=s&&(O=s-w),null!=c&&(M=c-k);const A="string"==typeof f?f:"label";if("bracket"===A&&h&&0===O&&0===M)if(void 0!==h.width){O=h.width/2;const e=h.depth||30;M=e+(0>e?-5:5)}else if(void 0!==h.height){const e=h.depth||30;O=e+(0>e?-5:5),M=h.height/2}return t("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${w},${k})`,"data-testid":x},null!=m&&{opacity:m},v&&{strokeDasharray:v},b,{children:[!j.has("connector")&&et(O,M,d,p,A,h),!j.has("subject")&&Je(A,h,p,w,k),!j.has("note")&&Ke(u,O,M,p)]}))}function nt(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,l="string"==typeof i.type?i.type:"label",a=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),a=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),s=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return e(tt,Object.assign({"data-testid":"semiotic-annotation"},r,{type:l}),"multi-annotation-"+o)});return e("g",{children:s})}const s=i.note||{title:"none",label:i.label},c=`${s.label}-${s.title}-${i.i}`;return e(tt,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:l}),c)}function ot(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 it(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 rt(e){return null==e?null:e+""}function lt(e,t,n){var o;return null===(o=t.stickyPositionCache)||void 0===o||o.set(e,n),n}function at(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 lt(t,n,{x:i.x,y:i.y})}const o=function(e){var t,n,o,i,r,l;const a=e.data;if(!a||0===a.length)return null;const s=a[a.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(l=e.scales)||void 0===l?void 0:l.value;if(!c||!u)return null;const d=s[e.xAccessor||"x"],h=s[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return o?lt(t,n,o):null}if("semantic"===r){const o=function(e,t,n){var o,i;const r=function(e){var t,n;return rt(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 l=null===(o=n.pointNodes)||void 0===o?void 0:o.find(e=>rt(e.pointId)===r);if(l)return lt(t,n,{x:l.x,y:l.y});const a=null===(i=n.data)||void 0===i?void 0:i.find(e=>function(e){var t,n,o;return rt(null!==(n=null!==(t=e.stableId)&&void 0!==t?t:e.id)&&void 0!==n?n:null===(o=e.provenance)||void 0===o?void 0:o.stableId)}(e)===r);if(!a)return null;const s=ot(a,n),c=it(a,n);return null==s||null==c?null:lt(t,n,{x:s,y:c})}(e,t,n);if(o)return o}let l=null,a=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,a=t.y)}if(null!=l&&null!=a||(l=ot(e,n),a=it(e,n)),null!=l&&null!=a)return lt(t,n,{x:l,y:a});if("sticky"===r){const e=null===(i=n.stickyPositionCache)||void 0===i?void 0:i.get(t);if(e)return e}return null}function st(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const ct={secondary:0,primary:3};function ut(e){return!0===(null==e?void 0:e._annotationDeferred)}function dt(e){return"blended"===(null==e?void 0:e.cohesion)||"layer"===(null==e?void 0:e.cohesion)?e.cohesion:null}function ht(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 ft(e){return Math.max(.72,.95-.06*e)}const pt={linear:E,monotoneX:T,monotoneY:_,step:B,stepAfter:R,stepBefore:W,basis:$,cardinal:N,catmullRom:I};const gt=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function yt(e){return!!e&&"object"==typeof e&&gt.has(function(e){return"string"==typeof(null==e?void 0:e.type)?e.type:""}(e))}function mt(e){return"primary"===(null==e?void 0:e.emphasis)||!0===(null==e?void 0:e.defensive)}function vt(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 bt(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 xt=32,wt=6,kt=4,jt=8,Ot=72;const Mt={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function At(e){return yt(e)}function St(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 Ct(e,t,n,o,i){const r=e+n,l=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?r-i.width-4:r+4,y:0>o?l-i.height:l,width:i.width,height:i.height}:{x:0>n?r-i.width:r,y:0>o?l-i.height-4:l+4,width:i.width,height:i.height}}function Pt(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function zt(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 Lt(e,t,n,o,i,r,l,a){const s=Pt(e,l);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}(s,i,r,a);for(const e of n)c+=12*zt(s,e);for(const e of o)c+=4*zt(s,e);return c}function Dt(e){var t;const{annotations:n,context:o,defaultOffset:i=xt,notePadding:r=wt,markPadding:l=kt,edgePadding:a=jt,preserveManualOffsets:s=!0,routeLongConnectors:c=!0,connectorThreshold:u=Ot,density:d,progressiveDisclosure:h=!1,redundantCues:f=!1,responsive:p,cohesion:g,audience:y}=e,m=o.width||0,v=o.height||0;if(0===n.length||0>=m||0>=v)return n.slice();const b=[],x=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(o,l);let w=!1;const k=n.map((e,t)=>{if(!At(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 l=e.coordinates,a=null===(i=n.scales)||void 0===i?void 0:i.geoProjection;if(Array.isArray(l)&&l.length>=2&&a){const e=l[0],t=l[1];if("number"==typeof e&&"number"==typeof t){const n=a([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?at(e,t,n):{x:e.x,y:e.y}}(e,t,o);if(!n)return e;const l=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=[...St("string"==typeof e.title?e.title:void 0,t),...St("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(s&&("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(Pt(Ct(n.x,n.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,l),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=Lt(Ct(n.x,n.y,e.dx,e.dy,l),e,b,x,m,v,r,a);f>t&&(h=e,f=t)}if(!h)return e;const p=Pt(Ct(n.x,n.y,h.dx,h.dy,l),r);b.push(p);const g=Math.hypot(h.dx,h.dy),y=c&&g>=u&&"text"!==e.type&&"widget"!==e.type?Object.assign(Object.assign({},e.connector||{end:"arrow"}),{type:"curve"}):e.connector;return w=!0,Object.assign(Object.assign(Object.assign({},e),{dx:h.dx,dy:h.dy}),y?{connector:y}:{})}),j=w?k:n.slice();let O=j;if(f){let e=!1;const t=j.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:Object.assign(Object.assign({},e),{_redundantConnector:!0})}(t);return n!==t&&(e=!0),n});O=e?t:j}{let e=!1;const t=O.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=Mt[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(" · "),l="string"==typeof e.label?e.label:"";return l.includes(`(${r})`)?e:Object.assign(Object.assign({},e),{label:l?`${l} (${r})`:`(${r})`})}(t);return n!==t&&(e=!0),n});O=e?t:O}const M=new Set;if(d){const e="object"==typeof d?d:{},n=function(e){if(!e)return 1;const t=function(e){const t=null==e?void 0:e.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(y),o=1===n?e:Object.assign(Object.assign({},e),{maxAnnotations:Math.max(0,Math.round((null!==(t=e.maxAnnotations)&&void 0!==t?t:vt(m,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),l=vt(o,i,e),a=n.map((e,t)=>{return{annotation:e,index:t,note:(n=e,yt(n))};var n}),s=a.filter(e=>e.note);if(0===s.length||l>=s.length)return{visible:n.slice(),deferred:[],budget:l};const c=s.filter(e=>mt(e.annotation)),u=s.filter(e=>!mt(e.annotation)).sort((e,t)=>bt(t.annotation)-bt(e.annotation)||e.index-t.index),d=Math.min(u.length,Math.max(Math.max(0,l-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 a)!n||h.has(t)?f.push(e):p.push(e);return{visible:f,deferred:p,budget:l}}(Object.assign({annotations:O,width:m,height:v},o));for(const e of i)M.add(e)}if(p&&("object"==typeof p&&"number"==typeof p.minWidth?p.minWidth:480)>=m)for(const e of O)At(e)&&"secondary"===e.emphasis&&M.add(e);if(M.size>0)for(const e of O)!0===(null==e?void 0:e.defensive)&&M.delete(e);let A;return A=0===M.size?O:h?O.map(e=>M.has(e)?Object.assign(Object.assign({},e),{_annotationDeferred:!0}):e):O.filter(e=>!M.has(e)),g?function(e,t){let n=!1;const o=e.map(e=>At(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,Object.assign(Object.assign({},e),{cohesion:t})):e);return n?o:e}(A,g):A}let It={positions:new Map};const Nt=new Set;function $t(){for(const e of Nt)e()}function Wt(e,t){const n=It.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(It.positions);o.delete(e),It={positions:o},$t()}function Rt(e,t){const n=It.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(It.positions);o.delete(e),It={positions:o},$t()}function Bt(){return It}function _t(e){return Nt.add(e),()=>Nt.delete(e)}const Tt={positions:new Map};function Et(){return()=>{}}function Ft(){return Tt}function Ht(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,l=o instanceof Date?o.getTime():o,a=i instanceof Date?i.getTime():i;if(2>t||l===a)return r?[new Date(l),new Date(a)]:[l,a];const s=(a-l)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?a:l+e*s;c[e]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function Gt(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function qt(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function Vt(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 Zt(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 l="M0,"+o;for(let e=0;r>e;e++){const n=8*(e+1);l+=`L${Math.min(8*e+4,t)},${o+4*i}`,l+=`L${Math.min(n,t)},${o}`}return l}{const o="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(n/8);let l=`M${o},0`;for(let e=0;r>e;e++){const t=8*(e+1);l+=`L${o+4*i},${Math.min(8*e+4,n)}`,l+=`L${o},${Math.min(t,n)}`}return l}}function Yt(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Xt(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 Qt(l){var a,c;const{width:u,height:h,totalWidth:f,totalHeight:p,margin:g,scales:y,showAxes:m,axes:v,xLabel:b,yLabel:x,yLabelRight:w,xFormat:k,yFormat:j,axisExtent:O,showGrid:M,title:A,legend:S,legendHoverBehavior:C,legendClickBehavior:P,legendHighlightedCategory:z,legendIsolatedCategories:I,legendPosition:N="right",legendLayout:$,foregroundGraphics:W,marginalGraphics:R,xValues:B,yValues:_,annotations:T,autoPlaceAnnotations:F,svgAnnotationRules:H,xAccessor:q,yAccessor:V,annotationData:U,pointNodes:Z,curve:Y,underlayRendered:X,canvasObscuresUnderlay:K=!0,linkedCrosshairName:J,linkedCrosshairSourceId:ee,children:te}=l,ne=r(()=>{var e,t;if(!m||!y)return[];const n=null==v?void 0:v.find(e=>"bottom"===e.orient),o=(null==n?void 0:n.tickFormat)||k||Yt,i=Math.max(2,Math.floor(u/70)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5,l=null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:Ht(y.x,"exact"===O?Math.max(2,r):Math.min(r,i),O),a=l.map(e=>e.valueOf()),s=l.map((e,t)=>({value:e,pixel:y.x(e),label:o(e,t,a)})),c=s.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(c+8,55)):Math.max(55,c+8);let h=Xt(s,d);if(h.length>1&&(h=h.filter((e,t)=>0===t||e.label+""!=h[t-1].label+"")),(null==n?void 0:n.includeMax)&&h.length>0&&"exact"!==O&&!(null==n?void 0:n.tickValues)){const e=y.x.domain()[1],t=y.x(e),n=h[h.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e,h.length,a);d>t-n&&h.length>1&&(h=h.slice(0,-1)),h.push({value:e,pixel:t,label:i})}}return h},[m,y,v,k,u,O]),oe=r(()=>{var e,t;if(!m||!y)return[];const n=null==v?void 0:v.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||j||Yt,i=Math.max(2,Math.floor(h/30)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;let l=Xt((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:Ht(y.y,"exact"===O?Math.max(2,r):Math.min(r,i),O)).map(e=>({value:e,pixel:y.y(e),label:o(e)})),22);if(l.length>1&&(l=l.filter((e,t)=>0===t||e.label+""!=l[t-1].label+"")),(null==n?void 0:n.includeMax)&&l.length>0&&"exact"!==O&&!(null==n?void 0:n.tickValues)){const e=y.y.domain()[1],t=y.y(e),n=l[l.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e);22>Math.abs(t-n)&&l.length>1&&(l=l.slice(0,-1)),l.push({value:e,pixel:t,label:i})}}return l},[m,y,v,j,h,O]),ie=r(()=>{var e,t;if(!m||!y)return[];const n=null==v?void 0:v.find(e=>"right"===e.orient);if(!n)return[];const o=n.tickFormat||j||Yt,i=Math.max(2,Math.floor(h/30)),r=null!==(e=n.ticks)&&void 0!==e?e:5;return Xt((null!==(t=n.tickValues)&&void 0!==t?t:Ht(y.y,"exact"===O?Math.max(2,r):Math.min(r,i),O)).map(e=>({value:e,pixel:y.y(e),label:o(e)})),22)},[m,y,v,j,h,O]),re=i(new Map),le=i(null!==(a=null==T?void 0:T.length)&&void 0!==a?a:0),ae=null!==(c=null==T?void 0:T.length)&&void 0!==c?c:0;le.current!==ae&&(le.current=ae,re.current=new Map);const se=r(()=>{if(!T||0===T.length)return null;const n=function(n,i,r){var l,a,s,c,u,d,h,f,p,g,y,m,v,b,x,w,k,j,O,M,A,S,C,P,z,I,N,$,W,R,B,_,T,F,H,q,V,U,Z,Y,X,K,J,ee,te,ne,oe,ie,re,le,ae;switch(n.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=at(n,i,r);if(!t)return null;const{x:o,y:c}=t;if(!st(o,c,r))return null;const u="callout"===n.type?"callout-circle":n.type,d="callout-circle"===u?{radius:null!==(l=n.radius)&&void 0!==l?l:12,radiusPadding:n.radiusPadding}:"callout-rect"===u?{width:n.width,height:n.height}:void 0;return e(nt,{noteData:Object.assign(Object.assign({x:o,y:c,dx:null!==(a=n.dx)&&void 0!==a?a:30,dy:null!==(s=n.dy)&&void 0!==s?s:-30,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:u},d?{subject:d}:{}),{connector:n.connector||{end:"arrow"},color:n.color,disable:n.disable,opacity:n.opacity,strokeDasharray:n.strokeDasharray,className:n.className})},"ann-"+i)}case"x-threshold":{const o=ot(null!=n.value?Object.assign(Object.assign({},n),{x:n.value}):n,r);if(null==o)return null;const l=n.color||"#f97316",a=n.labelPosition||"top";let s;s="bottom"===a?(r.height||0)-4:"center"===a?(r.height||0)/2:12;const c=o>.6*(r.width||0),u=c?o-4:o+4,d=c?"end":"start";return t("g",{opacity:n.opacity,children:[e("line",{x1:o,y1:0,x2:o,y2:r.height||0,stroke:l,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:u,y:s,textAnchor:d,fill:l,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:n.label})]},"ann-"+i)}case"y-threshold":{const o=it(null!=n.value?Object.assign(Object.assign({},n),{y:n.value}):n,r);if(null==o)return null;const l=n.color||"#f97316",a=n.labelPosition||"right";let s,c;return"left"===a?(s=4,c="start"):"center"===a?(s=(r.width||0)/2,c="middle"):(s=(r.width||0)-4,c="end"),t("g",{opacity:n.opacity,children:[e("line",{x1:0,y1:o,x2:r.width||0,y2:o,stroke:l,strokeWidth:n.strokeWidth||1.5,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:s,y:o-4,textAnchor:c,fill:l,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:n.label})]},"ann-"+i)}case"enclose":{const o=(n.coordinates||[]).map(e=>({x:ot(Object.assign(Object.assign({},e),{type:"point"}),r),y:it(Object.assign(Object.assign({},e),{type:"point"}),r),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const l=L(o),a=n.padding||10;return t("g",{children:[e("circle",{cx:l.x,cy:l.y,r:l.r+a,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:l.x,y:l.y-l.r-a-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+i)}case"rect-enclose":{const o=(n.coordinates||[]).map(e=>({x:ot(Object.assign(Object.assign({},e),{type:"point"}),r),y:it(Object.assign(Object.assign({},e),{type:"point"}),r)})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const l=n.padding||10,a=o.map(e=>e.x),s=o.map(e=>e.y),[c,u]=Q(a),[d,h]=Q(s),f=c-l,p=u+l,g=d-l;return t("g",{children:[e("rect",{x:f,y:g,width:p-f,height:h+l-g,fill:n.fill||"none",fillOpacity:n.fillOpacity||.1,stroke:n.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),n.label&&e("text",{x:(f+p)/2,y:g-4,textAnchor:"middle",fill:n.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:n.label})]},"ann-"+i)}case"highlight":{const t=r.data||[],o="function"==typeof n.filter?t.filter(n.filter):n.field&&null!=n.value?t.filter(e=>e[n.field]===n.value):[],l={stroke:n.color||"#f97316",strokeWidth:2,fill:"none"};return e("g",{children:o.map((t,o)=>{const i=ot(t,r),a=it(t,r);if(null==i||null==a)return null;const s="function"==typeof n.r?n.r(t):n.r||6,c="function"==typeof n.style?n.style(t):n.style||l;return e("circle",Object.assign({cx:i,cy:a,r:s},c),"hl-"+o)})},"ann-"+i)}case"bracket":{const t=ot(n,r),o=it(n,r);return e(nt,{noteData:{x:null!=t?t:0,y:null!=o?o:0,dx:n.dx||0,dy:n.dy||0,note:{label:n.label,title:n.title,wrap:n.wrap||120},type:"bracket",subject:{type:n.bracketType||"curly",width:n.width,height:n.height,depth:n.depth||30},color:n.color}},"ann-"+i)}case"trend":{const o=r.data||[];if(2>o.length)return null;const l=r.xAccessor||"x",a=r.yAccessor||"y",s="ordinal"===r.frameType,y="horizontal"===r.projection,m=s?l:null,v=s?a:null;let b;const x=[],w=new Map;if(s&&m&&v){for(const e of o){const t=e[m];if(null==t)continue;const n=t+"";w.has(n)||(w.set(n,x.length),x.push(n))}b=o.map(e=>{const t=e[m],n=e[v];if(null==t||null==n)return null;const o=w.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else b=o.map(e=>[e[l],e[a]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const k=null!==(u=null===(c=r.scales)||void 0===c?void 0:c.x)&&void 0!==u?u:null===(d=r.scales)||void 0===d?void 0:d.time,j=null!==(f=null===(h=r.scales)||void 0===h?void 0:h.y)&&void 0!==f?f:null===(p=r.scales)||void 0===p?void 0:p.value;if(!k||!j)return null;const O=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},M=k,A=j;let S;if(s)if(y){const e=O(A);S=(t,n)=>[M(n),e(t)]}else{const e=O(M);S=(t,n)=>[e(t),A(n)]}else S=(e,t)=>[M(e),A(t)];const C=n.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]),l=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),s=o.slice().sort((e,t)=>e-t)[Math.min(l-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===s?0:o[e]/s;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){a.push([t,r[e]]);continue}const g=u*f-d*d;if(1e-12>Math.abs(g))a.push([t,h/u]);else{const e=(u*p-d*h)/g;a.push([t,(h-e*d)/u+e*t])}}return a}(b,null!==(g=n.bandwidth)&&void 0!==g?g:.3):("polynomial"===C?G.polynomial(b,{order:n.order||2}):G.linear(b)).points;const z=P.map(([e,t])=>{const[n,o]=S(e,t);return`${n},${o}`}).join(" "),L=n.color||"#6366f1",D=P[P.length-1],[I,N]=S(D[0],D[1]);return t("g",{children:[e("polyline",{points:z,fill:"none",stroke:L,strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray||"6,3"}),n.label&&e("text",{x:I+4,y:N-4,fill:L,fontSize:11,children:n.label})]},"ann-"+i)}case"band":{const o=null!==(m=null===(y=r.scales)||void 0===y?void 0:y.y)&&void 0!==m?m:null===(v=r.scales)||void 0===v?void 0:v.value,l=null!==(b=null==o?void 0:o(n.y0))&&void 0!==b?b:0,a=null!==(x=null==o?void 0:o(n.y1))&&void 0!==x?x:r.height||0;return t("g",{opacity:n.opacity,children:[e("rect",{x:0,y:Math.min(l,a),width:r.width||0,height:Math.abs(a-l),fill:n.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:n.fillOpacity||.1}),n.label&&e("text",{x:(r.width||0)-4,y:Math.max(Math.min(l,a),0)+13,textAnchor:"end",fill:n.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:n.label})]},"ann-"+i)}case"envelope":{const o=r.data||[];if(2>o.length)return null;const l=r.xAccessor||"x",a=null!==(k=null===(w=r.scales)||void 0===w?void 0:w.x)&&void 0!==k?k:null===(j=r.scales)||void 0===j?void 0:j.time,s=null!==(M=null===(O=r.scales)||void 0===O?void 0:O.y)&&void 0!==M?M:null===(A=r.scales)||void 0===A?void 0:A.value;if(!a||!s)return null;const c=n.upperAccessor||"upperBounds",u=n.lowerAccessor||"lowerBounds",d=n.filter,h=o.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[l]-t[l]);if(2>h.length)return null;const f=pt[r.curve||"linear"]||E,p=D().x(e=>a(e[l])).y0(e=>s(e[u])).y1(e=>s(e[c])).curve(f)(h);if(!p)return null;const g=n.fill||"#6366f1";return t("g",{children:[e("path",{d:p,fill:g,fillOpacity:null!==(S=n.fillOpacity)&&void 0!==S?S:.15,stroke:"none"}),n.label&&h.length>0&&e("text",{x:a(h[h.length-1][l])+4,y:s(h[h.length-1][c])-4,fill:g,fontSize:11,children:n.label})]},"ann-"+i)}case"anomaly-band":{const o=r.data||[];if(2>o.length)return null;const l=r.yAccessor||"y",a=null!==(P=null===(C=r.scales)||void 0===C?void 0:C.x)&&void 0!==P?P:null===(z=r.scales)||void 0===z?void 0:z.time,s=null!==(N=null===(I=r.scales)||void 0===I?void 0:I.y)&&void 0!==N?N:null===($=r.scales)||void 0===$?void 0:$.value;if(!a||!s)return null;const c=o.map(e=>e[l]).filter(e=>null!=e&&isFinite(e));if(2>c.length)return null;const u=c.reduce((e,t)=>e+t,0)/c.length,d=c.reduce((e,t)=>e+Math.pow(t-u,2),0)/c.length,h=Math.sqrt(d),f=null!==(W=n.threshold)&&void 0!==W?W:2,p=u-f*h,g=!1!==n.showBand,y=n.fill||"#6366f1",m=null!==(R=n.fillOpacity)&&void 0!==R?R:.1,v=n.anomalyColor||"#ef4444",b=null!==(B=n.anomalyRadius)&&void 0!==B?B:6,x=s(u+f*h),w=s(p),k=o.filter(e=>{const t=e[l];return null!=t&&Math.abs(t-u)>f*h});return t("g",{children:[g&&e("rect",{x:0,y:Math.min(x,w),width:r.width||0,height:Math.abs(w-x),fill:y,fillOpacity:m}),k.map((t,n)=>{const o=ot(t,r),i=it(t,r);return null==o||null==i?null:e("circle",{cx:o,cy:i,r:b,fill:v,fillOpacity:.7,stroke:v,strokeWidth:1.5},"anomaly-"+n)}),n.label&&e("text",{x:(r.width||0)-4,y:Math.min(x,w)-4,textAnchor:"end",fill:y,fontSize:11,children:n.label})]},"ann-"+i)}case"forecast":{const o=r.data||[];if(3>o.length)return null;const l=r.xAccessor||"x",a=r.yAccessor||"y",s=null!==(T=null===(_=r.scales)||void 0===_?void 0:_.x)&&void 0!==T?T:null===(F=r.scales)||void 0===F?void 0:F.time,c=null!==(q=null===(H=r.scales)||void 0===H?void 0:H.y)&&void 0!==q?q:null===(V=r.scales)||void 0===V?void 0:V.value;if(!s||!c)return null;const u=o.map(e=>[e[l],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>u.length)return null;let d;if("polynomial"===(n.method||"linear")){const e=G.polynomial(u,{order:n.order||2}).equation;d=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=u.length;let t=0,n=0,o=0,i=0;for(const[e,r]of u)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 l=(e*i-t*n)/r,a=(n-l*t)/e;d=e=>a+l*e}const h=u.length,f=u.map(([e,t])=>t-d(e)).reduce((e,t)=>e+t*t,0),p=Math.sqrt(f/Math.max(h-2,1)),g=u.reduce((e,t)=>e+t[0],0)/h,y=u.reduce((e,t)=>e+Math.pow(t[0]-g,2),0),m=null!==(U=n.confidence)&&void 0!==U?U:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(Z=n.steps)&&void 0!==Z?Z:5,x=u[h-1][0],w=(x-u[0][0])/Math.max(h-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*w);const j=[];for(const e of k){const t=d(e),n=p*Math.sqrt(1+1/h+(y>0?Math.pow(e-g,2)/y:0))*v;j.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const O=`M${j.map(e=>`${s(e.x)},${c(e.yUpper)}`).join(" L")} L${j.slice().reverse().map(e=>`${s(e.x)},${c(e.yLower)}`).join(" L")} Z`,M=j.map(e=>`${s(e.x)},${c(e.yCenter)}`).join(" "),A=`${s(x)},${c(d(x))}`,S=n.strokeColor||"#6366f1";return t("g",{children:[e("path",{d:O,fill:n.fill||"#6366f1",fillOpacity:null!==(Y=n.fillOpacity)&&void 0!==Y?Y:.15,stroke:"none"}),e("polyline",{points:`${A} ${M}`,fill:"none",stroke:S,strokeWidth:null!==(X=n.strokeWidth)&&void 0!==X?X:2,strokeDasharray:null!==(K=n.strokeDasharray)&&void 0!==K?K:"6,3"}),n.label&&j.length>0&&e("text",{x:s(j[j.length-1].x)+4,y:c(j[j.length-1].yCenter)-4,fill:S,fontSize:11,children:n.label})]},"ann-"+i)}case"widget":{let t=null,o=null;if(null!=n.px&&null!=n.py)t=n.px,o=n.py;else{const e=at(n,i,r);if(!e)return null;t=e.x,o=e.y}if(null==t||null==o)return null;if(!st(t,o,r))return null;const l=null!==(J=n.dx)&&void 0!==J?J:0,a=null!==(ee=n.dy)&&void 0!==ee?ee:0,s=null!==(te=n.width)&&void 0!==te?te:32,c=null!==(ne=n.height)&&void 0!==ne?ne:32,u=null!==(oe=n.content)&&void 0!==oe?oe:e("span",{style:{fontSize:18,cursor:"default"},title:n.label||"Info",children:"ℹ️"});return e("foreignObject",{x:t+l-s/2,y:o+a-c/2,width:s,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e("div",{style:{width:s,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+i)}case"text":{const l=at(n,i,r);if(!l)return null;const{x:a,y:s}=l,c=a+(n.dx||0),u=s+(n.dy||0),d=n.color||"var(--semiotic-text, #333)",h=e("text",{x:c,y:u,fill:d,fontSize:n.fontSize||11,opacity:n.opacity,strokeDasharray:n.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:n.label});return!0!==n._redundantConnector?o.cloneElement(h,{key:"ann-text-"+i}):t("g",{opacity:n.opacity,strokeDasharray:n.strokeDasharray,children:[e("line",{x1:a,y1:s,x2:c,y2:u,stroke:d,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),o.cloneElement(h,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+i)}case"category-highlight":{const o=n.category;if(null==o)return null;const l=e=>"function"==typeof e&&"function"==typeof e.bandwidth,a=null===(ie=r.scales)||void 0===ie?void 0:ie.o,s=null===(re=r.scales)||void 0===re?void 0:re.x,c=null===(le=r.scales)||void 0===le?void 0:le.y,u=l(a)?a:l(s)?s:l(c)?c:null;if(!u)return null;const d=u(o+"");if(null==d)return null;const h=u.bandwidth(),f=n.color||"var(--semiotic-primary, #4589ff)",p=null!==(ae=n.opacity)&&void 0!==ae?ae:.15,g=n.label;return t("g",(r.projection?"vertical"===r.projection:u===s)?{children:[e("rect",{x:d,y:0,width:h,height:r.height||0,fill:f,fillOpacity:p}),g&&e("text",{x:d+h/2,y:12,textAnchor:"middle",fill:f,fontSize:12,fontWeight:"bold",children:g})]}:{children:[e("rect",{x:0,y:d,width:r.width||0,height:h,fill:f,fillOpacity:p}),g&&e("text",{x:12,y:d+h/2,dominantBaseline:"middle",fill:f,fontSize:12,fontWeight:"bold",children:g})]},"ann-"+i)}default:return null}},i={scales:y?{x:y.x,y:y.y,time:y.x,value:y.y}:null,timeAxis:"x",xAccessor:q,yAccessor:V,width:u,height:h,data:U,frameType:"xy",pointNodes:Z,curve:Y,stickyPositionCache:re.current};return function(t,n,o,i){const r=[];return t.forEach((e,t)=>{let l;if(o){const r=o(e,t,i);l=null!=r?r:n(e,t,i)}else l=n(e,t,i);l&&r.push({node:l,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:ht(e.annotation),readingOrder:null,rank:1};var n}),o=n.some(e=>null!=e.emphasis||null!=e.confidence),i=t.some(e=>ut(e.annotation)),r=t.some(e=>null!=dt(e.annotation)),l=t.some(e=>"layer"===dt(e.annotation));if(!o&&!i&&!r)return t.map(e=>e.node);const a=n.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>{var n,o;return(null!==(n=t.confidence)&&void 0!==n?n:0)-(null!==(o=e.confidence)&&void 0!==o?o:0)||e.i-t.i});a.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,a.length)});for(const e of n)e.emphasis&&(e.rank=ct[e.emphasis]);const s=n.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(t=>{const{p:n,i:o,emphasis:i,readingOrder:r}=t,l=ut(n.annotation);let a=n.node;if("primary"===i||"secondary"===i||null!=r){const t=null==i&&null!=r;a=e("g",Object.assign({className:t?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+i},"secondary"===i?{opacity:.6,fontSize:"0.88em"}:{},t?{opacity:ft(r),"data-annotation-reading-order":r}:{},{children:n.node}),"annotation-emphasis-"+o)}const s=dt(n.annotation);return s&&(a=e("g",{className:"annotation-cohesion--"+s,children:a},"annotation-cohesion-"+o)),l&&(a=e("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},"annotation-deferred-"+o)),a});return i&&s.unshift(e("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")),l&&s.unshift(e("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")),s}(r)}(F?Dt(Object.assign({annotations:T,context:i},"object"==typeof F?F:{})):T,n,H,i)},[T,F,H,u,h,q,V,U,y,Z,Y]),ce=function(e){var t;const n=s(e?_t:Et,e?Bt:Ft,e?Bt:Ft);return e&&null!==(t=n.positions.get(e))&&void 0!==t?t:null}(J);return d(()=>{if(!(null==ce?void 0:ce.locked)||!J)return;const e=e=>{"Escape"===e.key&&Rt(J)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==ce?void 0:ce.locked,J]),m||A||S||W||R||se&&se.length>0||M||te||ce?t("svg",{role:"img",width:f,height:p,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e("title",{children:"string"==typeof A?A:"XY Chart"}),e("desc",{children:"string"==typeof A?A+" — XY data visualization":"XY data visualization"}),t("g",{transform:`translate(${g.left},${g.top})`,children:[M&&y&&(!X||K)&&(()=>{var n,o;const i=Ut(null===(n=null==v?void 0:v.find(e=>"bottom"===e.orient))||void 0===n?void 0:n.gridStyle),r=Ut(null===(o=null==v?void 0:v.find(e=>"left"===e.orient))||void 0===o?void 0:o.gridStyle);return t("g",{className:"stream-grid",children:[ne.map((t,n)=>e("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:h,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"xgrid-"+n)),oe.map((t,n)=>e("line",{x1:0,y1:t.pixel,x2:u,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),m&&y&&(()=>{const n=null==v?void 0:v.find(e=>"left"===e.orient),o=null==v?void 0:v.find(e=>"bottom"===e.orient),i=!n||!1!==n.baseline,r=!o||!1!==o.baseline,l=(null==n?void 0:n.jaggedBase)||!1,a=(null==o?void 0:o.jaggedBase)||!1,s=null==o?void 0:o.landmarkTicks,c=null==n?void 0:n.landmarkTicks,d="var(--semiotic-border, #ccc)",f="var(--semiotic-text-secondary, var(--semiotic-text, #666))",p="var(--semiotic-text, #333)",y=!!(null==o?void 0:o.autoRotate)&&ne.length>1&&(()=>{const e=u/Math.max(ne.length-1,1);return ne.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),m={fontSize:"var(--semiotic-tick-font-size, 12px)"},k={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},j={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},O=null==o?void 0:o.tickAnchor,M=null==n?void 0:n.tickAnchor,A=Vt(ne),S=Vt(oe);return t("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[t("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!X||K)&&r&&!a&&e("line",{x1:0,y1:h,x2:u,y2:h,stroke:d,strokeWidth:1}),(!X||K)&&a&&e("path",{d:Zt("bottom",u,h),fill:"none",stroke:d,strokeWidth:1}),ne.map((n,o)=>{const i=!!s&&("function"==typeof s?s(n.value,o):de(n.value,o>0?ne[o-1].value:void 0));return t("g",{transform:`translate(${n.pixel},${h})`,children:[e("line",{y2:5,stroke:d,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{y:y?10:18,textAnchor:y?"end":Gt(O,n.pixel===A.min,n.pixel===A.max),fontWeight:i?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?k:m),transform:y?"rotate(-45)":void 0,children:n.label}):e("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"center",userSelect:"none"},m),children:n.label})})]},"xtick-"+o)}),b&&e("text",{x:u/2,y:h+40,textAnchor:"middle",fill:p,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},j),children:b})]}),t("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!X||K)&&i&&!l&&e("line",{x1:0,y1:0,x2:0,y2:h,stroke:d,strokeWidth:1}),(!X||K)&&l&&e("path",{d:Zt("left",u,h),fill:"none",stroke:d,strokeWidth:1}),oe.map((n,o)=>{const i=!!c&&("function"==typeof c?c(n.value,o):de(n.value,o>0?oe[o-1].value:void 0));return t("g",{transform:`translate(0,${n.pixel})`,children:[e("line",{x2:-5,stroke:d,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:-8,textAnchor:"end",dominantBaseline:qt(M,n.pixel===S.min,n.pixel===S.max),fontWeight:i?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?k:m),children:n.label}):e("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"right",userSelect:"none"},m),children:n.label})})]},"ytick-"+o)}),(()=>{const t=(null==n?void 0:n.label)||x;return t?e("text",{x:15-g.left,y:h/2,textAnchor:"middle",fill:p,transform:`rotate(-90, ${15-g.left}, ${h/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},j),children:t}):null})()]}),(()=>{const n=null==v?void 0:v.find(e=>"right"===e.orient);if(!n||0===ie.length)return null;const o=!1!==n.baseline,i=n.landmarkTicks,r=n.label||w,l=n.tickAnchor,a=Vt(ie);return t("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&e("line",{x1:u,y1:0,x2:u,y2:h,stroke:d,strokeWidth:1}),ie.map((n,o)=>{const r=!!i&&("function"==typeof i?i(n.value,o):de(n.value,o>0?ie[o-1].value:void 0));return t("g",{transform:`translate(${u},${n.pixel})`,children:[e("line",{x2:5,stroke:d,strokeWidth:1}),"string"==typeof n.label||"number"==typeof n.label?e("text",{x:8,textAnchor:"start",dominantBaseline:qt(l,n.pixel===a.min,n.pixel===a.max),fontWeight:r?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},r?k:m),children:n.label}):e("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e("div",{style:Object.assign({textAlign:"left",userSelect:"none"},m),children:n.label})})]},"ytick-r-"+o)}),r&&e("text",{x:u+g.right-15,y:h/2,textAnchor:"middle",fill:p,transform:`rotate(90, ${u+g.right-15}, ${h/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},j),children:r})]})})()]})})(),se,R&&y&&B&&_&&t(n,{children:[R.top&&e("g",{transform:"translate(0, 0)",children:e(Ye,{orient:"top",config:Ze(R.top),values:B,scale:y.x,size:g.top,length:u})}),R.bottom&&e("g",{transform:`translate(0, ${h})`,children:e(Ye,{orient:"bottom",config:Ze(R.bottom),values:B,scale:y.x,size:g.bottom,length:u})}),R.left&&e("g",{transform:"translate(0, 0)",children:e(Ye,{orient:"left",config:Ze(R.left),values:_,scale:y.y,size:g.left,length:h})}),R.right&&e("g",{transform:`translate(${u}, 0)`,children:e(Ye,{orient:"right",config:Ze(R.right),values:_,scale:y.y,size:g.right,length:h})})]}),W,ce&&ce.sourceId!==ee&&(null==y?void 0:y.x)&&(()=>{const t=y.x(ce.xValue);if(null==t||0>t||t>u)return null;const n=ce.locked;return e("line",{x1:t,y1:0,x2:t,y2:h,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"})})(),te]}),A&&e("text",{x:f/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof A?A:null}),Ue({legend:S,totalWidth:f,totalHeight:p,margin:g,legendPosition:N,title:A,legendLayout:$,legendHoverBehavior:C,legendClickBehavior:P,legendHighlightedCategory:z,legendIsolatedCategories:I})]}):null}function Kt(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Jt="undefined"==typeof window||"undefined"==typeof document,en="undefined"!=typeof window?h:d,tn=()=>()=>{},nn=()=>!1,on=()=>!0;function rn(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 ln(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 an(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 sn=o.createContext(null),cn={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function un(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"],l=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 l)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const dn=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""};function hn(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 fn="semiotic-accessible-data-table",pn=fn+" semiotic-accessible-data-table-hidden",gn=fn+" semiotic-accessible-data-table-visible",yn={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"},mn={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},vn={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},bn={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},xn={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))"},wn={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},kn={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},jn={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 On({scene:n,chartType:i,tableId:r,chartTitle:l}){var a;const[s,c]=o.useState(!1),[u,d]=o.useState(5),h=o.useContext(sn),f=null!==(a=null==h?void 0:h.visible)&&void 0!==a&&a,p=s||f,g=o.useRef(null),y=l?"Data summary for "+l:r?`Data summary for ${i} ${r}`:"Data summary for "+i;o.useEffect(()=>{p||d(5)},[p]);const m=o.useCallback(e=>{e.target===e.currentTarget&&(s||f||c(!0))},[s,f]),v=o.useCallback(e=>{var t;f||(null===(t=g.current)||void 0===t?void 0:t.contains(e.relatedTarget))||c(!1)},[f]);if(!n||0===n.length)return r?e("span",{id:r,tabIndex:-1,style:cn}):null;if(!p)return e("div",{id:r,className:pn,tabIndex:-1,onFocus:m,style:cn,role:"region","aria-label":y,children:t("button",{type:"button",onClick:()=>c(!0),children:["View data summary (",n.length," elements)"]})});const b=function(e){var t,n,o,i,r,l,a,s,c,u,d,h,f,p,g,y,m;const v=[];if(!Array.isArray(e))return v;const b=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const x of e)if(x&&"object"==typeof x&&null!==x.datum)try{switch(x.type){case"point":if(b)break;v.push({label:"Point",values:hn(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:hn(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:"",l=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!=l?l:""}});break}case"heatcell":{const e=hn(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!==(s=null!==(l=null===(r=x.datum)||void 0===r?void 0:r.category)&&void 0!==l?l:null===(a=x.datum)||void 0===a?void 0:a.label)&&void 0!==s?s:"",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:hn(x.datum)});break;case"arc":v.push({label:"Arc",values:hn(x.datum)});break;case"candlestick":v.push({label:"Candlestick",values:hn(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!==(m=null===(y=x.datum)||void 0===y?void 0:y.value)&&void 0!==m?m:""}})}}catch(e){}return v}(n),x=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}(b),w=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${dn(e.min)} to ${dn(e.max)}, mean ${dn(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(" ")}(b.length,x),k=Math.min(u,b.length),j=b.slice(0,k),O=b.length-k,M=new Set;for(const e of j)for(const t of Object.keys(e.values))M.add(t);const A=Array.from(M);return t("div",{ref:g,id:r,className:gn,tabIndex:-1,onBlur:v,style:yn,role:"region","aria-label":y,children:[e("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{f&&h&&h.setVisible(!1),c(!1)},"aria-label":"Close data summary",style:vn,children:"×"}),e("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:mn,children:w}),t("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+i,style:bn,children:[e("caption",{className:"semiotic-accessible-data-table-caption",style:kn,children:O>0?`First ${k} of ${b.length} data points`:`All ${b.length} data points`}),e("thead",{children:t("tr",{children:[e("th",{style:xn,children:"type"}),A.map(t=>e("th",{style:xn,children:t},t))]})}),e("tbody",{children:j.map((n,o)=>t("tr",{children:[e("td",{style:wn,children:n.label}),A.map(t=>{return e("td",{style:wn,children:(o=n.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":dn(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},o))})]}),O>0&&t("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>d(e=>e+25),style:jn,children:["Show ",Math.min(25,O)," more"," ",1===O?"row":"rows"," (",O," remaining)"]})]})}function Mn({summary:t}){return t?e("div",{role:"note",style:cn,children:t}):null}function An({tableId:t}){return e("a",{href:"#"+t,style:cn,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,cn)},children:"Skip to data table"})}function Sn({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("div",{"aria-live":"polite","aria-atomic":"true",style:cn,children:n})}const Cn=Object.freeze([]);function Pn(e){if(!e)return Cn;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 zn="var(--semiotic-focus, #005fcc)";function Ln({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:l,height:a}){if(!t||!n)return null;const s=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=l&&null!=a){const t=Math.max(l,4),n=Math.max(a,4);u=e("rect",{x:s-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:zn,strokeWidth:2,strokeDasharray:"4,2"})}else u=e("circle","wedge"===r?{cx:s,cy:c,r:12,fill:"none",stroke:zn,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:s,cy:c,r:8,fill:"none",stroke:zn,strokeWidth:2,strokeDasharray:"4,2"});return e("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}const Dn={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 In(e,t){return"function"==typeof t?t(e):e[t]}function Nn(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 $n(n={}){const{fields:o,title:i,format:r,style:l={},className:a=""}=n;return n=>{if(!n||"object"!=typeof n)return null;let s;const c=[];if(i){const e=In(n,i);s=Nn(e,r)}if(o&&o.length>0)o.forEach(e=>{let t,o,i;"string"==typeof e?(t=e,o=e,i=r):(t=e.label,o=e.accessor||e.key||"",i=e.format||r);const l=In(n,o);c.push({label:t,value:Nn(l,i)})});else if(!i){const e=["value","y","name","id","label"];for(const t of e)if(void 0!==n[t]){s=Nn(n[t],r);break}if(!s){const e=Object.keys(n).filter(e=>!e.startsWith("_"));e.length>0&&(s=Nn(n[e[0]],r))}}const u=Object.assign(Object.assign({},Dn),l);return t("div",{className:("semiotic-tooltip "+a).trim(),style:u,children:[s&&e("div",{style:{fontWeight:c.length>0?"bold":"normal"},children:s}),c.map((e,n)=>t("div",{style:{marginTop:0===n&&s?"4px":0},children:[e.label&&t("span",{children:[e.label,": "]}),e.value]},n))]})}}function Wn(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;let 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;("node"===(null==t?void 0:t.nodeOrEdge)&&"number"==typeof(null==i?void 0:i.x0)&&"number"==typeof(null==i?void 0:i.x1)||"edge"===(null==t?void 0:t.nodeOrEdge)&&"number"==typeof(null==i?void 0:i.sankeyWidth))&&i.data&&"object"==typeof i.data&&(i=i.data);const l=n(i);return null==l?null:e("div",{className:"semiotic-tooltip",style:Dn,children:l})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?$n(t):$n())}}function Rn({x:t,y:n,containerWidth:i,containerHeight:r,margin:l,children:a,className:s="stream-frame-tooltip",zIndex:c=1}){const u=Number.isFinite(t)&&Number.isFinite(n),d=o.useRef(null),[h,f]=o.useState(null);o.useLayoutEffect(()=>{const e=d.current;if(!e)return;const t=e.getBoundingClientRect();f(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[a,s,i,r]);let p;p=h?`translate(${h.width+12>i-t?"calc(-100% - 12px)":"12px"}, ${h.height+12>r-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*i?"calc(-100% - 12px)":"12px"}, ${.3*r>n?"4px":"calc(-100% - 4px)"})`;const g=function(e){if(!o.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 i=n.style;if(i&&"object"==typeof i){if(null!=i.background&&""!==i.background)return!0;if(null!=i.backgroundColor&&""!==i.backgroundColor)return!0}return!1}(a),y=g?null:Dn;return u?e("div",{ref:d,className:g?s:(s+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},y||{}),{position:"absolute",left:l.left+t,top:l.top+n,transform:p,pointerEvents:"none",zIndex:c,width:"max-content"}),children:a}):null}function Bn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function _n(e,t,n=.6){var o,i,r,l,a;if(!Bn(t))return;const s=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+s*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(a=null!==(l=t.cy)&&void 0!==l?l:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Tn(e,t,n,o=.35){Bn(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function En(e){switch(e){case"monotoneX":return T;case"monotoneY":return _;case"cardinal":return N;case"catmullRom":return I;case"step":return B;case"stepBefore":return W;case"stepAfter":return R;case"basis":return $;case"natural":return F;default:return null}}function Fn(e,t,n){return null==t?n:"string"!=typeof t?t:De(e,t)||n}function Hn(e,t,n,o,i,r){const l=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>l.length)return null;const a=e.createLinearGradient(n,o,i,r);for(const e of l)a.addColorStop(e.offset,e.color);return a}function Gn(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 qn(e,t,n,o,i,r){if(2>t.length)return;const l=[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];l.push(l[e-1]+Math.sqrt(n*n+o*o))}const a=l[l.length-1];if(0===a)return;const s=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=r;for(let n=0;t.length-1>n;n++){const o=(l[n]+l[n+1])/2;let r=i;s>o&&(r*=o/s),s>a-o&&(r*=(a-o)/s),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 Vn(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const r=t[0]*o,l=t[1]*o,a=t[0]+"px",s=t[1]+"px";return e.style.width!==a&&(e.style.width=a),e.style.height!==s&&(e.style.height=s),e.width===r&&e.height===l||(e.width=r,e.height=l),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 Zn([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t,n]}function Yn(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 Xn{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 Qn{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 l=n[r.lineIndex];if(!l||2>l.length){r.active=!1;continue}if(r.t+=e*t,r.t>=1){r.active=!1;continue}const a=Kn(l),s=Jn(l,r.t*a),c=(o[r.lineIndex]||2)/2;r.x=s.x+s.nx*r.offset*c*2,r.y=s.y+s.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 Kn(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 Jn(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],l=Math.sqrt(i*i+r*r);if(n+l>=t||o===e.length-1){const a=l>0?(t-n)/l:0,s=l>.001?l:1;return{x:e[o-1][0]+i*a,y:e[o-1][1]+r*a,nx:-r/s,ny:i/s}}n+=l}const o=e[e.length-1];return{x:o[0],y:o[1],nx:0,ny:0}}const eo={top:10,right:10,bottom:10,left:10},to={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"},no={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 oo(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function io(e){return e?e.getContext("2d"):null}function ro({data:n}){if(!n)return null;if(n.properties)return e("div",{className:"semiotic-tooltip",style:to,children:e("div",{style:{fontWeight:600},children:n.properties.name||n.properties.NAME||n.properties.id||"Feature"})});const o=null!=n.data?n.data:n;if(!o||"object"!=typeof o)return null;const i=Object.entries(o).filter(([e])=>"data"!==e&&!e.startsWith("__")).slice(0,3);return 0===i.length?null:e("div",{className:"semiotic-tooltip",style:to,children:i.map(([n,o])=>t("div",{children:[t("span",{style:{opacity:.7},children:[n,": "]}),e("span",{style:{fontWeight:600},children:o+""})]},n))})}ro.ownsChrome=!0;const lo=f(function(n,o){var l,c,h,f,g,y,m,v,b,x;const{projection:w,projectionExtent:k,fitPadding:j,projectionTransform:O,areas:M,points:A,lines:S,xAccessor:C,yAccessor:P,lineDataAccessor:z,pointIdAccessor:L,lineIdAccessor:D,lineType:I="geo",flowStyle:N="basic",graticule:$,zoomable:W,zoomExtent:R,onZoom:B,dragRotate:_,showParticles:T,particleStyle:E,tileURL:F,tileAttribution:G,tileCacheSize:Z,size:Y,width:X,height:Q,responsiveWidth:K,responsiveHeight:J,margin:ee,className:te,background:ne,areaStyle:oe,pointStyle:ie,lineStyle:re,colorScheme:le,enableHover:ae=!0,hoverAnnotation:ce,tooltipContent:ue,customClickBehavior:de,customHoverBehavior:fe,annotations:pe,autoPlaceAnnotations:ge,decay:me,pulse:ve,transition:be,animate:xe,staleness:we,backgroundGraphics:ke,foregroundGraphics:je,title:Oe,legend:Me,legendPosition:Ae,legendLayout:Se,legendHoverBehavior:Ce,legendClickBehavior:Pe,legendHighlightedCategory:ze,legendIsolatedCategories:Le,legendCategoryAccessor:Ie,onCategoriesChange:Ne,showAxes:_e,accessibleTable:Te=!0,description:Ee,summary:Fe}=n,He=Y||[X||600,Q||400],Ge=i(!0),qe=$e({sizeProp:He,responsiveWidth:K,responsiveHeight:J,userMargin:ee,marginDefault:eo,foregroundGraphics:je,backgroundGraphics:ke,animate:xe,transitionProp:be,themeDirtyRef:Ge}),{reducedMotionRef:Ve,responsiveRef:Ue,size:Ze,margin:Ye,adjustedWidth:Xe,adjustedHeight:Qe,resolvedForeground:Ke,resolvedBackground:Je,transition:et,introEnabled:tt,tableId:nt,rafRef:ot,renderFnRef:it,scheduleRender:rt,currentTheme:lt}=qe,at=function(){const[e,t]=u(!1);return en(()=>{t(!0)},[]),e}(),st=function(){const e=s(tn,nn,on);return i(e).current}(),ct=r(()=>Array.isArray(M)?Pn(M):M,[M]),ut=r(()=>Pn(A),[A]),dt=r(()=>Pn(S),[S]),ht=r(()=>null!=_?_:"orthographic"===oo(w),[_,w]),ft=r(()=>{var e,t;return{projection:w,projectionExtent:k,fitPadding:j,xAccessor:C,yAccessor:P,lineDataAccessor:z,lineType:I,flowStyle:N,areaStyle:oe,pointStyle:ie,lineStyle:re,colorScheme:le,themeSemantic:ye(lt),themeSequential:null===(e=null==lt?void 0:lt.colors)||void 0===e?void 0:e.sequential,themeDiverging:null===(t=null==lt?void 0:lt.colors)||void 0===t?void 0:t.diverging,graticule:$,projectionTransform:O,decay:me,pulse:ve,transition:et,introAnimation:tt,annotations:pe,pointIdAccessor:L,lineIdAccessor:D}},[w,k,j,C,P,z,I,N,oe,ie,re,le,$,O,me,ve,null==et?void 0:et.duration,null==et?void 0:et.easing,tt,pe,L,D,lt]),pt=function(e){const t=i(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return ln(e,t);if(!an(e)||!an(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(!ln(n,i))return!1}else{if(!an(n)||!an(i))return!1;if(!rn(n,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}(ft),gt=i(null);gt.current||(gt.current=new se(pt));const yt=i(null),mt=i(null),vt=i(null),bt=i(null),xt=i(null);F&&!xt.current&&(xt.current=new Xn(Z||256));const wt=i(pe),kt=i(null),jt=i(q),Ot=i(!1),Mt=i(null),At=a(e=>{Mt.current=e,Ue&&"object"==typeof Ue&&(Ue.current=e)},[Ue]),St=i(null),Ct=i(null),Pt=i(null),zt=i(0);if(T&&!Pt.current){const e=null!==(l=null==E?void 0:E.maxPerLine)&&void 0!==l?l:30;Pt.current=new Qn(50*e)}const Lt=i(null),Dt=i(null),[It,Nt]=u(null),[$t,Wt]=u(0),Rt=i(0),[Bt,_t]=u(!1),Tt=i([]),Et=i(Ie),Ft=i(Ne);Et.current=Ie,Ft.current=Ne;const Ht=a(()=>{var e,t;const n=Et.current,o=Ft.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=gt.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,Tt.current)||(Tt.current=i,o(i))},[]);d(()=>{var e;null===(e=gt.current)||void 0===e||e.updateConfig(pt),Ge.current=!0,rt()},[pt,rt]),d(()=>{const e=gt.current;e&&(ct&&e.setAreas(ct),A&&e.setPoints(ut),S&&e.setLines(dt),Ge.current=!0,rt())},[ct,A,ut,S,dt,rt]);const Gt=a(e=>{var t;null!=e&&"object"==typeof e&&(null===(t=gt.current)||void 0===t||t.pushPoint(e),Ge.current=!0,rt())},[rt]),qt=a(e=>{var t;const n=Pn(e);0!==n.length&&(null===(t=gt.current)||void 0===t||t.pushMany(n),Ge.current=!0,rt())},[rt]),Vt=a(e=>{var t;null!=e&&"object"==typeof e&&(null===(t=gt.current)||void 0===t||t.pushLine(e),Ge.current=!0,rt())},[rt]),Ut=a(e=>{var t;const n=Pn(e);0!==n.length&&(null===(t=gt.current)||void 0===t||t.pushManyLines(n),Ge.current=!0,rt())},[rt]),Zt=a(()=>{var e;null===(e=gt.current)||void 0===e||e.clear(),Ge.current=!0,rt()},[rt]);p(o,()=>({push:Gt,pushMany:qt,removePoint:e=>{var t,n;const o=null!==(n=null===(t=gt.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[];return o.length>0&&(Ge.current=!0,rt()),o},pushLine:Vt,pushManyLines:Ut,removeLine:e=>{var t,n;const o=null!==(n=null===(t=gt.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==n?n:[];return o.length>0&&(Ge.current=!0,rt()),o},getLines:()=>{var e,t;return null!==(t=null===(e=gt.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]},clear:Zt,getProjection:()=>{var e,t,n;return null!==(n=null===(t=null===(e=gt.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=gt.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=gt.current)||void 0===e?void 0:e.cartogramLayout)&&void 0!==t?t:null},getZoom:()=>jt.current.k,resetZoom:()=>{const e=Mt.current;e&&kt.current&&U(e).call(kt.current.transform,q)},getData:()=>{var e,t;return null!==(t=null===(e=gt.current)||void 0===e?void 0:e.getPoints())&&void 0!==t?t:[]}}),[Gt,qt,Vt,Ut,Zt,rt]);const{hoverHandlerRef:Yt,onPointerMove:Xt,onPointerLeave:sn}=qe;d(()=>{Yt.current=e=>{if(!ae)return;const t=gt.current;if(!t||!t.scene.length)return;const n=mt.current;if(!n)return;const o=n.getBoundingClientRect(),i=e.clientX-o.left-Ye.left,r=e.clientY-o.top-Ye.top;if(0>i||i>Xe||0>r||r>Qe)return Lt.current=null,Dt.current=null,Nt(null),null==fe||fe(null),void rt();bt.current||(bt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const l=io(bt.current);if(!l)return;const a=he(t.scene,i,r,30,l,t.quadtree,t.maxPointRadius);if(a){const e=a.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,l;"point"===e.type?(o=e.x,l=e.y):"geoarea"===e.type?(o=e.centroid[0],l=e.centroid[1]):(o=i,l=r);const s=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:l});Lt.current=s,Dt.current=e,Nt(s),null==fe||fe(s),rt()}else Lt.current&&(Lt.current=null,Dt.current=null,Nt(null),null==fe||fe(null),rt())}},[ae,Xe,Qe,Ye,fe,rt]),qe.hoverLeaveRef.current=()=>{Lt.current=null,Dt.current=null,Nt(null),null==fe||fe(null),rt()};const cn=a(e=>{if(!de)return;const t=gt.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-Ye.left,i=e.clientY-n.top-Ye.top;bt.current||(bt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const r=io(bt.current);if(!r)return;const l=he(t.scene,o,i,30,r,t.quadtree,t.maxPointRadius);if(l){const e=l.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;de(Object.assign(Object.assign({},n),{data:t,properties:null==t?void 0:t.properties,__semioticHoverData:!0,x:o,y:i,time:o,value:i}))}},[de,Ye]),dn=i(-1),hn=i(null),fn=a(e=>{const t=gt.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=dn.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 dn.current=-1,hn.current=null,Lt.current=null,Dt.current=null,Nt(null),null==fe||fe(null),void rt();const r=0>o?0:i;dn.current=r;const l=n[r];hn.current={shape:l.shape,w:l.w,h:l.h};const a=l.datum,s=Object.assign(Object.assign(Object.assign({},a||{}),(null==a?void 0:a.properties)||{}),{data:a,properties:null==a?void 0:a.properties,x:l.x,y:l.y,__semioticHoverData:!0});Lt.current=s,Nt(s),null==fe||fe(s),rt()},[fe,rt]),pn=a(e=>{dn.current=-1,hn.current=null,Xt(e)},[Xt]);it.current=()=>{var e,t,n,o,i,r,l;ot.current=0;const a=mt.current,s=gt.current;if(!a||!s)return;const c=performance.now();let u=!1;const d=Ct.current;d&&(Ct.current=null,s.applyRotation(d,{width:Xe,height:Qe}));const h=s.advanceTransition(Ve.current?c+1e6:c),f=!Ve.current&&h;if(Ge.current&&!h){const e={width:Xe,height:Qe},t=ht?s.getRotation():null;s.computeScene(e);const n=jt.current,o=1!==n.k||0!==n.x||0!==n.y;ht&&t?o?(s.setRotation(t),s.applyZoomScale(n.k,e)):s.applyRotation(t,e):o&&s.applyZoomTransform(n,e),Ge.current=!1,a.setAttribute("aria-label",un(s.scene,"Geographic chart")),Ht()}const p=Un();if(F&&xt.current){const t=yt.current;if(t&&(null===(e=s.scales)||void 0===e?void 0:e.projection)){const e=Vn(t,Ze,Ye,p);if(e){e.clearRect(-Ye.left,-Ye.top,Ze[0],Ze[1]),e.save(),e.beginPath(),e.rect(0,0,Xe,Qe),e.clip();const t=function(e,t){const{tileURL:n,projection:o,width:i,height:r,tileCache:l,onTileLoad:a}=t,s=o.scale(),c=o.translate(),u=function(e){const{size:t,scale:n,translate:o,clampX:i=!0,clampY:r=!0}=e,l=Math.max(Math.log(n)/Math.LN2-8,0),a=Math.round(l),s=1<<a,c=Math.pow(2,l-a+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?s:1/0,Math.ceil((t[0]-u)/c)),p=Math.max(r?0:-1/0,Math.floor((0-d)/c)),g=Math.min(r?s:1/0,Math.ceil((t[1]-d)/c)),y=[];for(let e=p;g>e;++e)for(let t=h;f>t;++t)y.push([t,e,a]);return{tiles:y,translate:[u/c,d/c],scale:c}}({size:[i,r],scale:2*s*Math.PI,translate:c}),d=Un();let h=!0;for(const t of u.tiles){const[o,i,r]=Zn(t),s=`${r}/${o}/${i}`;let c=l.get(s);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:s,lastUsed:performance.now()};l.set(s,t),e.onload=()=>{t.loaded=!0,null==a||a()},e.onerror=()=>{t.loaded=!0},e.src=Yn(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:F,projection:s.scales.projection,width:Xe,height:Qe,tileCache:xt.current,onTileLoad:()=>rt()});e.restore(),t||(u=!0)}}}const g=Vn(a,Ze,Ye,p);if(!g)return;if(g.clearRect(-Ye.left,-Ye.top,Ze[0],Ze[1]),ne&&!F){const e=De(g,ne);e&&(g.fillStyle=e,g.fillRect(0,0,Xe,Qe))}g.save(),g.beginPath(),g.rect(0,0,Xe,Qe),g.clip();const y=s.scene,m={width:Xe,height:Qe};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,l=t.style.fill||"#e0e0e0";if("none"!==l&&(e.fillStyle=l,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=De(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)}Tn(e,t,r),e.globalAlpha=1,e.setLineDash([])}}(g,y),((e,t,n,o)=>{var i,r;const l=t.filter(e=>"line"===e.type);for(const a of l){if(2>a.path.length)continue;const s=a._introClipFraction;void 0!==s&&1>s&&(e.save(),e.beginPath(),e.rect(0,0,o.width*s,o.height),e.clip());const c=a.style.stroke||"#007bff",u=De(e,c)||c,d=a.style.strokeWidth||2,h=a.colorThresholds,f=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=d,e.lineCap=a.style.strokeLinecap||"butt",a.style._edgeFade){const m=null!==(i=a.style.opacity)&&void 0!==i?i:1;qn(e,a.path,u,d,m,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const p=En(a.curve),g=h&&h.length>0&&f&&f.length===a.path.length,y=a._decayOpacities;if(y&&y.length===a.path.length&&!g){e.strokeStyle=u;const v=null!==(r=a.style.opacity)&&void 0!==r?r:1;for(let b=0;a.path.length-1>b;b++)e.globalAlpha=.5*(y[b]+y[b+1])*v,e.beginPath(),e.moveTo(a.path[b][0],a.path[b][1]),e.lineTo(a.path[b+1][0],a.path[b+1][1]),e.stroke()}else if(g){let x=null,w=null,k=null,j=null,O=!1;function M(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),O=!0}function A(){O&&(e.stroke(),O=!1)}for(let S=0;a.path.length>S;S++){const[C,P]=a.path[S],z=f[S],L=Gn(z,h,u);if(null!==x&&null!==j&&null!==k){if(L===j)e.lineTo(C,P);else{const D=[];for(const I of h){const N=I.value;(k>N||N>z)&&(N>k||z>N)||k===N||z===N||D.push({t:(N-k)/(z-k)})}D.sort((e,t)=>e.t-t.t);for(const $ of D){const W=x+(C-x)*$.t,R=w+(P-w)*$.t,B=Gn(k+(z-k)*Math.min($.t+1e-4,1),h,u);e.lineTo(W,R),A(),M(B,W,R)}e.lineTo(C,P)}x=C,w=P,k=z,j=L}else M(L,C,P),x=C,w=P,k=z,j=L}A()}else{e.beginPath();const _=a.strokeGradient&&a.path.length>=2?Hn(e,a.strokeGradient,a.path[0][0],0,a.path[a.path.length-1][0],0):null;if(e.strokeStyle=_||u,p)H().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(a.path);else{const[T,E]=a.path[0];e.moveTo(T,E);for(let F=1;a.path.length>F;F++)e.lineTo(a.path[F][0],a.path[F][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=Fn(e,a.style.fill,a.style.fill),p&&!g)H().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(a.path);else{const[q,V]=a.path[0];e.moveTo(q,V);for(let U=1;a.path.length>U;U++)e.lineTo(a.path[U][0],a.path[U][1])}const G=a.path[0][0];e.lineTo(a.path[a.path.length-1][0],o.height),e.lineTo(G,o.height),e.closePath(),e.fill()}void 0!==s&&1>s&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(g,y,0,m),((e,t)=>{var n,o;const i=t.filter(e=>"point"===e.type);if(0!==i.length){e.save();try{const t=e.globalAlpha;for(const r of i){e.beginPath(),e.arc(r.x,r.y,r.r,0,2*Math.PI);const i=null!==(o=null!==(n=r.style.opacity)&&void 0!==n?n:r.style.fillOpacity)&&void 0!==o?o:1;e.globalAlpha=t*i,e.fillStyle=Fn(e,r.style.fill,"#4e79a7"),e.fill(),r.style.stroke&&(e.strokeStyle=Fn(e,r.style.stroke,r.style.stroke),e.lineWidth=r.style.strokeWidth||1,e.stroke()),_n(e,r)}}finally{e.restore()}}})(g,y),T&&Pt.current){const e=Pt.current,a=y.filter(e=>"line"===e.type);if(a.length>0){const s=E||{},d=.3*(null!==(t=s.speedMultiplier)&&void 0!==t?t:1),h=null!==(n=s.maxPerLine)&&void 0!==n?n:30,f=null!==(o=s.spawnRate)&&void 0!==o?o:.15,p=null!==(i=s.radius)&&void 0!==i?i:2,y=null!==(r=s.opacity)&&void 0!==r?r:.7,m=c/1e3,v=zt.current>0?Math.min(m-zt.current,.1):.016;zt.current=m;const b=a.map(e=>e.path),x=a.map(e=>e.style.strokeWidth||2);for(let t=0;a.length>t;t++)Math.random()<f&&e.countForLine(t)<h&&e.spawn(t);e.step(v,d,b,x),g.globalAlpha=y;for(let t=0;e.particles.length>t;t++){const n=e.particles[t];if(!n.active)continue;const o=a[n.lineIndex],i="function"==typeof s.color?s.color(null!==(l=null==o?void 0:o.datum)&&void 0!==l?l:{}):"source"!==s.color&&s.color?s.color:(null==o?void 0:o.style.stroke)||"#fff";g.beginPath(),g.arc(n.x,n.y,p,0,2*Math.PI),g.fillStyle=i,g.fill()}g.globalAlpha=1,u=!0}}g.restore();const v=vt.current;if(v){const e=Vn(v,Ze,Ye,p);if(e){e.clearRect(-Ye.left,-Ye.top,Ze[0],Ze[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 ce?ce: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 b=pe!==wt.current;b&&(wt.current=pe),(Ge.current||b||f&&pe&&pe.length>0)&&(Ge.current||b||c-Rt.current>=33)&&(Wt(e=>e+1),Rt.current=c),(f||null!=s.activeTransition||s.hasActivePulses||u)&&(ot.current=requestAnimationFrame(()=>it.current()))},function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:l,cleanup:a}=e;en(()=>{var e,i;t&&n&&(null===(i=null===(e=o.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===i||i.call(e)),r.current=!0,l.current()},[t,n]);const s=i(a);s.current=a,d(()=>()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.call(s)},[])}({hydrated:at,wasHydratingFromSSR:st,storeRef:gt,dirtyRef:Ge,renderFnRef:it,cleanup:()=>{var e;return null===(e=xt.current)||void 0===e?void 0:e.clear()}}),d(()=>{Ge.current=!0,rt()},[Xe,Qe,ne,rt]),function(e,t,n,o,r,l){const a=i("fresh");d(()=>{if(!e)return;const i=setInterval(()=>{const i=t.current;if(!i||0===i.lastIngestTime)return;const s="undefined"!=typeof performance?performance.now():Date.now(),c=function(e,t){var n,o;if(!e||0>=t)return Re;const i=null!=e.threshold&&e.threshold>0?e.threshold:5e3,r=e.graded;if(r){const e="object"==typeof r?r:{},o=function(e,t,n={}){var o,i,r;if(!Number.isFinite(t)||0>=t)return"fresh";if(Number.isNaN(e))return"fresh";if(e===1/0)return"expired";if(0>e)return"fresh";const l=null!==(o=n.fresh)&&void 0!==o?o:1,a=null!==(i=n.aging)&&void 0!==i?i:1.5,s=null!==(r=n.stale)&&void 0!==r?r:3;return t*l>e?"fresh":t*a>e?"aging":t*s>e?"stale":"expired"}(t,i,e.thresholds);return{alpha:Object.assign(Object.assign({},We),null!==(n=e.opacities)&&void 0!==n?n:{})[o],band:o,isStale:"fresh"!==o}}return t>i?{alpha:null!==(o=e.dimOpacity)&&void 0!==o?o:.5,band:"stale",isStale:!0}:Re}(e,s-i.lastIngestTime);c.band===a.current&&c.isStale===r||(a.current=c.band,c.isStale!==r&&l(c.isStale),n.current=!0,o())},1e3);return()=>clearInterval(i)},[e,r,o])}(we,gt,Ge,rt,Bt,_t),d(()=>{if("production"!==process.env.NODE_ENV&&F){const e=oo(w);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.`)}},[F,w]),d(()=>{const e=Mt.current;if(!W||!e)return kt.current&&e&&(U(e).on(".zoom",null),kt.current=null),void(e&&U(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=R||[1,8],o={width:Xe,height:Qe};if(ht){let i=jt.current.k;const r=e=>{var r;i=Math.max(t,Math.min(n,e)),jt.current=q.scale(i);const l=gt.current;l&&(l.applyZoomScale(i,o),Ge.current=!1,rt(),(null===(r=l.scales)||void 0===r?void 0:r.projection)&&(null==B||B({projection:l.scales.projection,zoom:l.currentZoom})))};kt.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 l=e=>{e.preventDefault(),r(i*(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(),r(1.5*i))};e.addEventListener("wheel",l,{passive:!1}),e.addEventListener("dblclick",a);const s=.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=gt.current;if(!o)return;const i=o.getRotation();St.current={x:t.clientX,y:t.clientY,rotation:[...i]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{const t=St.current;t&&(Ct.current=[t.rotation[0]+(e.clientX-t.x)*s,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*s)),t.rotation[2]],rt())},d=t=>{var n;if(!St.current)return;St.current=null,e.releasePointerCapture(t.pointerId);const i=Ct.current;if(i){Ct.current=null;const e=gt.current;e&&(e.applyRotation(i,o),rt())}const r=gt.current;(null===(n=null==r?void 0:r.scales)||void 0===n?void 0:n.projection)&&(null==B||B({projection:r.scales.projection,zoom:r.currentZoom}))};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",u),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("wheel",l),e.removeEventListener("dblclick",a),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",d),kt.current=null}}const i=V().scaleExtent([t,n]).extent([[0,0],[Ze[0],Ze[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;jt.current=t,Ot.current=!0;const n=gt.current;n&&(n.applyZoomTransform(t,o),Ge.current=!1,rt())}).on("end",e=>{var t;jt.current=e.transform,Ot.current=!1;const n=gt.current;(null===(t=null==n?void 0:n.scales)||void 0===t?void 0:t.projection)&&(null==B||B({projection:n.scales.projection,zoom:n.currentZoom}))});return kt.current=i,U(e).call(i),()=>{U(e).on(".zoom",null)}},[W,R,ht,Ze,Xe,Qe,Ye,B,rt]);const gn=ae&&!1!==ce,yn=gn&&It?ue?ue(It):e(ro,{data:It}):null,mn=yn?e(Rn,{x:It.x,y:It.y,containerWidth:Xe,containerHeight:Qe,margin:Ye,className:"stream-frame-tooltip",zIndex:10,children:yn}):null;if(Jt||!at&&st){const n=gt.current;n&&(ct||A||S)&&(ct&&n.setAreas(ct),A&&n.setPoints(ut),S&&n.setLines(dt),n.computeScene({width:Xe,height:Qe}));const o=null!==(c=null==n?void 0:n.scene)&&void 0!==c?c:[];return t("div",{ref:At,className:"stream-geo-frame"+(te?" "+te:""),role:"img","aria-label":Ee||("string"==typeof Oe?Oe:"Geographic chart"),style:{position:"relative",width:K?"100%":Ze[0],height:J?"100%":Ze[1]},children:[e(Mn,{summary:Fe}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ze[0],height:Ze[1],style:{position:"absolute",left:0,top:0},children:[e("g",{transform:`translate(${Ye.left},${Ye.top})`,children:Je}),t("g",{transform:`translate(${Ye.left},${Ye.top})`,children:[ne&&e("rect",{x:0,y:0,width:Xe,height:Qe,fill:ne}),o.map((t,n)=>function(t,n){var o,i,r,l,a,s;switch(t.type){case"geoarea":{const r=t;return r.pathData?e("path",{d:r.pathData,fill:Kt(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("circle",{cx:o.x,cy:o.y,r:o.r,fill:Kt(o.style.fill),fillOpacity:null!==(r=o.style.fillOpacity)&&void 0!==r?r:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:null!==(l=o._decayOpacity)&&void 0!==l?l:null!==(a=o.style.opacity)&&void 0!==a?a: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("path",{d:i,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||1.5,strokeDasharray:o.style.strokeDasharray,opacity:null!==(s=o.style.opacity)&&void 0!==s?s:1},"line-"+n)}default:return null}}(t,n))]})]}),e(Qt,{width:Xe,height:Qe,totalWidth:Ze[0],totalHeight:Ze[1],margin:Ye,scales:null,showAxes:!1,title:Oe,legend:Me,legendPosition:Ae,legendLayout:Se,legendHoverBehavior:Ce,legendClickBehavior:Pe,legendHighlightedCategory:ze,legendIsolatedCategories:Le,foregroundGraphics:Ke,annotations:pe,autoPlaceAnnotations:ge,annotationFrame:0,xValues:[],yValues:[],pointNodes:o.filter(e=>"point"===e.type)})]})}return t("div",{ref:At,className:"stream-geo-frame"+(te?" "+te:""),role:"group","aria-label":Ee||("string"==typeof Oe?Oe:"Geographic chart"),tabIndex:0,style:Object.assign({position:"relative",width:K?"100%":Ze[0],height:J?"100%":Ze[1],overflow:"hidden"},W?{touchAction:"none"}:{}),onKeyDown:fn,children:[Te&&e(An,{tableId:nt}),Te&&e(On,{scene:null!==(f=null===(h=gt.current)||void 0===h?void 0:h.scene)&&void 0!==f?f:[],chartType:"Geographic chart",tableId:nt,chartTitle:"string"==typeof Oe?Oe:void 0}),e(Mn,{summary:Fe}),e(Sn,{hoverPoint:It}),t("div",{role:"img","aria-label":Ee||("string"==typeof Oe?Oe:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:gn?pn:void 0,onMouseLeave:gn?sn:void 0,onClick:de?cn:void 0,children:[Je&&e("svg",{style:{position:"absolute",left:0,top:0,width:Ze[0],height:Ze[1],pointerEvents:"none"},children:e("g",{transform:`translate(${Ye.left},${Ye.top})`,children:Je})}),F&&e("canvas",{ref:yt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e("canvas",{ref:mt,"aria-label":un(null!==(y=null===(g=gt.current)||void 0===g?void 0:g.scene)&&void 0!==y?y:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),e("canvas",{ref:vt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e(Qt,{width:Xe,height:Qe,totalWidth:Ze[0],totalHeight:Ze[1],margin:Ye,scales:null,showAxes:null!=_e&&_e,title:Oe,legend:Me,legendPosition:Ae,legendLayout:Se,legendHoverBehavior:Ce,legendClickBehavior:Pe,legendHighlightedCategory:ze,legendIsolatedCategories:Le,foregroundGraphics:Ke,annotations:pe,autoPlaceAnnotations:ge,annotationFrame:$t,xValues:[],yValues:[],pointNodes:null===(m=gt.current)||void 0===m?void 0:m.scene.filter(e=>"point"===e.type)}),(null==we?void 0:we.showBadge)&&e(Be,{isStale:Bt,position:we.badgePosition}),W&&t("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Ye.bottom+8,left:Ye.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[e("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=Mt.current,n=kt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(U(t),1.5)},style:no,children:"+"}),e("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=Mt.current,n=kt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(U(t),1/1.5)},style:no,children:"−"})]}),G&&e("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Ye.bottom+2,right:Ye.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:G}),e(Ln,{active:dn.current>=0,hoverPoint:It,margin:Ye,size:Ze,shape:null===(v=hn.current)||void 0===v?void 0:v.shape,width:null===(b=hn.current)||void 0===b?void 0:b.w,height:null===(x=hn.current)||void 0===x?void 0:x.h}),mn]})]})});function ao(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function so(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function co(e){const t=e.map(ao),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return so(e,n,o)}if(e>=1){const[e,o,i]=t[n];return so(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[l,a,s]=t[i],[c,u,d]=t[i+1];return so(Math.round(l+(c-l)*r),Math.round(a+(u-a)*r),Math.round(s+(d-s)*r))}}lo.displayName="StreamGeoFrame";const uo=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ho=co(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),fo=co(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),po=co(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),go=co(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),yo=co(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),mo=co(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),vo=co(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),bo=co(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),xo=co(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),wo=co(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),ko=co(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),jo=co(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),Oo={blues:ho,reds:fo,greens:po,viridis:vo,oranges:go,purples:yo,greys:mo,plasma:bo,inferno:xo,magma:wo,cividis:ko,turbo:jo};function Mo(e){return e&&Oo[e]||ho}co(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),co(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),co(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),co(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),co(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),co(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),co(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);const Ao=Object.assign({category10:uo,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]},Oo),So=uo,Co=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Po=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 zo(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")||Po.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):So[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))%So.length]}function Lo(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),i=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return S().domain(o).range(n).unknown("#999");const r=Ao[n]||Ao.category10;if(i&&"function"==typeof r){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:So;return S().domain(o).range(e).unknown("#999")}}function Do(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,l]=o,[a,s]=n;if(l===r)return(a+s)/2;let c=(i-r)/(l-r);return 0>c?c=0:c>1&&(c=1),a+c*(s-a)}const Io=c(null);function No(){return l(Io)}function $o(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 Wo(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function Ro(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}const[Bo,_o]=pe(e=>({selections:new Map,setClause(t,n){e(e=>{const o=e.selections.get(t),i=null==o?void 0:o.clauses.get(n.clientId);if(i&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,o]of n){const n=t.fields[e];if(!n||!Ro(o,n))return!1}return!0}(i,n))return{};const r=new Map(e.selections),l=Wo(r,t),a=new Map(l.clauses);return a.set(n.clientId,n),r.set(t,Object.assign(Object.assign({},l),{clauses:a})),{selections:r}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o||!o.clauses.has(n))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=e.selections.get(t);if((null==o?void 0:o.resolution)===n)return{};const i=new Map(e.selections),r=Wo(i,t);return i.set(t,Object.assign(Object.assign({},r),{resolution:n})),{selections:i}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const o=new Map(e.selections);return o.set(t,Object.assign(Object.assign({},n),{clauses:new Map})),{selections:o}})}})),[To,Eo]=pe(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 Fo(e){const t=g(),n=e.clientId||t,{name:o}=e,i=_o(e=>e.selections.get(o)),l=_o(e=>e.setClause),s=_o(e=>e.clearClause),c=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push($o(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,n):()=>!0,[i,n]),isActive:c,selectPoints:a(e=>{const t={};let i=!1;for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)},i=!0;i&&l(o,{clientId:n,type:"point",fields:t})},[n,o,l]),selectInterval:a(e=>{const t={};let i=!1;for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o},i=!0;i&&l(o,{clientId:n,type:"interval",fields:t})},[n,o,l]),clear:a(()=>{s(o,n)},[s,o,n]),clientId:n}}function Ho(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:i,selectPoints:r,clear:l}=Fo({name:t});return{onHover:a(e=>{if(!e)return void l();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)&&r(t)},[n,r,l,t]),predicate:o,isActive:i}}const Go=c(!1),qo=c(null),Vo="undefined"==typeof window?d:h;function Uo(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 Zo(e,t,n){return t?(o,...i)=>{var r;const l=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(l,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;l.opacity=e,l.fillOpacity=e,l.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(l,n.unselectedStyle)}return l}:e}function Yo(){return Oe(e=>e.theme)}o.createContext(void 0);const Xo="#007bff";function Qo(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 Ko(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 Jo(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function ei(){var e;const t=Yo(),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 ti({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:i,chartType:l,chartId:s,onClick:c,hoverHighlight:h,colorByField:f}){const p=g(),y=Uo(t,n),m="series"===(null==y?void 0:y.mode)?[y.seriesField||f||n[0]].filter(e=>!!e):(null==y?void 0:y.fields)||n||[],v=Fo({name:(null==e?void 0:e.name)||"__unused__"}),b=Ho({name:(null==y?void 0:y.name)||"hover",fields:m}),x=Eo(e=>e.pushObservation),w=e?{isActive:v.isActive,predicate:v.predicate}:null,[k,j]=u(null),O=f||n[0],M=r(()=>{if(!h||null==k||!O)return null;const e=k,t=O;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[h,k,O]),A=a(e=>{var n,o;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==y?void 0:y.mode)&&y.xField){const n=Qo(e,t,y.xField);null!=n&&function(e,t,n){const o=It.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(It={positions:new Map(It.positions).set(e,{xValue:t,sourceId:n})},$t())}(y.name||"hover",n,p)}"x-position"!==(null==y?void 0:y.mode)&&b.onHover(t)}else"x-position"===(null==y?void 0:y.mode)&&Wt(y.name||"hover",p),"x-position"!==(null==y?void 0:y.mode)&&b.onHover(null);if(h&&O)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[O];j(null!=n?n+"":null)}else j(null);if(i||x){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:s};if(e){const r=Ko(e),l=Object.assign(Object.assign({},t),{type:"hover",datum:r||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});i&&i(l),x&&x(l)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});i&&i(e),x&&x(e)}}},[t,b,y,p,i,l,s,x,h,O]),S=a(e=>{var t,n,o,r;if("x-position"===(null==y?void 0:y.mode)&&y.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=Qo(e,t,y.xField);null!=n&&function(e,t,n){const o=It.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(It.positions);return t.delete(e),It={positions:t},$t(),!1}It={positions:new Map(It.positions).set(e,{xValue:t,sourceId:n,locked:!0})},$t()}(y.name||"hover",n,p)}if(e&&c){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),c(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(i||x){const t={timestamp:Date.now(),chartType:l||"unknown",chartId:s};if(e){const n=Ko(e),l=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(r=e.y)&&void 0!==r?r:0});i&&i(l),x&&x(l)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});i&&i(e),x&&x(e)}}},[c,i,x,l,s,y,p]);return d(()=>{if("x-position"!==(null==y?void 0:y.mode))return;const e=y.name||"hover";return()=>{Rt(e,p),Wt(e,p)}},[null==y?void 0:y.mode,null==y?void 0:y.name,p]),{activeSelectionHook:w,hoverSelectionHook:M,customHoverBehavior:A,customClickBehavior:S,crosshairSourceId:p}}function ni({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:a="right",userMargin:s,defaults:c={top:50,bottom:60,left:70,right:40},categories:u}){const d=l(Go),h=null!==l(qo),f=void 0!==o?o:!d&&!!t,p=!!t&&(f||h),y=r(()=>{if(!p)return[];if(void 0!==u)return u;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)},[u,t,e,p]);!function(e){const t=l(qo),n=g(),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=i([]);(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 a=r.current;Vo(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),Vo(()=>{t&&t.registerCategories(n,a)},[t,n,a])}(h&&t?y:[]);const m=r(()=>{if(!f||!t)return;const o=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:l}){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:(l&&l.length>0?l:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const l=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),a=l?o(l,t,n):n?n(i):Co[r%Co.length];return{label:i+"",color:a}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:zo,categories:y});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[f,t,e,n,y]),v=r(()=>{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:c[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return m&&("right"===a&&!o("right")&&110>n.right?n.right=110:"left"===a&&!o("left")&&110>n.left?n.left=110:"top"===a&&!o("top")&&50>n.top?n.top=50:"bottom"===a&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[c,s,m,a]);return{legend:m,margin:v,legendPosition:a}}const oi={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 ii(e,t,n){var o,i,r,l,a,s,c;const u=oi[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!==(l=t.showGrid)&&void 0!==l?l:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||u.enableHover,showLegend:null!==(s=t.showLegend)&&void 0!==s?s: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:ri(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function ri(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 li(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 ai({componentName:n,message:o,diagnosticHint:i,width:r,height:l}){return e("div",{role:"alert",style:{width:r,height:Math.max(l,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:t("div",{style:{textAlign:"center",maxWidth:400},children:[e("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:n}),e("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),i&&e("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:i})]})})}class si extends o.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(ai,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var ci;const ui="undefined"!=typeof process&&"production"!==(null===(ci=process.env)||void 0===ci?void 0:ci.NODE_ENV);function di({componentName:t,width:n,height:o,children:i}){return e(si,{fallback:i=>e(ai,{componentName:t,message:i.message,width:n,height:o}),children:i})}const hi={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"},fi={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function pi(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e("div",{style:Object.assign(Object.assign({},hi),{width:n,height:o}),children:i||"No data available"}):null}function gi(t,n,o,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e("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)),l=Math.max(8,Math.floor(o/(3*r))),a=Math.max(6,Math.floor(o/(2.5*r))),s=Math.floor((o-(r*(l+a)-a))/2);return e("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("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},fi),{position:"absolute",top:s+o*(l+a),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:l,opacity:.5+o%2*.2})},o))})}function yi(e,t,n,o){if(!ui)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 mi(e){const t=Oe(e=>e.theme.colors.selectionOpacity);return r(()=>{var n,o;if(void 0!==e||void 0!==t)return Object.assign(Object.assign({name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:t})},[e,t])}function vi(e,t,n,o){return new(n||(n=Promise))(function(i,r){function l(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(l,a)}s((o=o.apply(e,t||[])).next())})}function bi(e){return e}function xi(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 bi;var t,n,o=e.scale[0],i=e.scale[1],r=e.translate[0],l=e.translate[1];return function(e,a){a||(t=n=0);var s=2,c=e.length,u=Array(c);for(u[0]=(t+=e[0])*o+r,u[1]=(n+=e[1])*i+l;c>s;)u[s]=e[s],++s;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,l=i.length;l>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,l)}function r(e){return n(e)}function l(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 a(e){for(var t=l(e);4>t.length;)t.push(t[0]);return t}function s(e){return e.map(a)}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=l(t.arcs);break;case"MultiLineString":n=t.arcs.map(l);break;case"Polygon":n=s(t.arcs);break;case"MultiPolygon":n=t.arcs.map(s);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 wi=new Map;function ki(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function ji(e){return vi(this,void 0,void 0,function*(){const t=wi.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return vi(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:ki(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:ki(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:ki(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:ki(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 xi(e,t)})}:xi(e,t)}(n,n.objects[o]),r="features"in i?i.features:[i];return wi.set(e,r),r})}function Oi(e){const t=r(()=>Array.isArray(e)?e:void 0,[e]),[n,o]=u(null);return d(()=>{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),ji(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 Mi(n){var o;const i=ii(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=Yo();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),{areas:a,valueAccessor:s,colorScheme:c,projection:u="equalEarth",graticule:d,fitPadding:h,zoomable:f,zoomExtent:p,onZoom:g,dragRotate:y,tileURL:m,tileAttribution:v,tileCacheSize:b,tooltip:x,areaOpacity:w=1,annotations:k,margin:j,className:O,selection:M,linkedHover:A,onObservation:S,onClick:P,chartId:z,loading:L,loadingContent:D,emptyContent:I,frameProps:N={},stroke:$,strokeWidth:W,opacity:R}=n,B=null!=f?f:!!m,_=Oi(a),T=r(()=>_?Pn(_):_,[_]),E=r(()=>"function"==typeof s?s:e=>{var t,n;return null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t[s])&&void 0!==n?n:null==e?void 0:e[s]},[s]),F=null!==(o=null!=c?c:l)&&void 0!==o?o:"blues",H=r(()=>{if(!T)return C(Mo(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(const n of T){const o=E(n);null!=o&&isFinite(o)&&(e>o&&(e=o),o>t&&(t=o))}const n=Mo(F);return C(n).domain([Number.isFinite(e)?e:0,Number.isFinite(t)?t:1])},[T,E,F]),{activeSelectionHook:G,customHoverBehavior:q,customClickBehavior:V}=ti({selection:M,linkedHover:A,onObservation:S,onClick:P,chartType:"ChoroplethMap",chartId:z}),U=mi(M),Z=r(()=>{const e=li(e=>{const t=E(e);return{fill:null!=t&&isFinite(t)?H(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:w}},{stroke:$,strokeWidth:W,opacity:R});return G?Zo(e,G,U):e},[E,H,G,U,w,$,W,R]),Y=r(()=>n=>{var o,i;const r=(null===(o=null==n?void 0:n.properties)||void 0===o?void 0:o.name)||(null===(i=null==n?void 0:n.properties)||void 0===i?void 0:i.NAME)||(null==n?void 0:n.name)||(null==n?void 0:n.NAME)||"Feature",l=E(n);return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e("div",{style:{fontWeight:600},children:r}),null!=l&&e("div",{style:{opacity:.7},children:(a=l,"number"==typeof a&&isFinite(a)?Number.isInteger(a)?a.toLocaleString():a.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=a?a:"")+"")})]});var a},[E]),X=r(()=>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}(j)),[j]),Q=gi(L,i.width,i.height,D)||(T?null:gi(!0,i.width,i.height,D)),K=Q?null:pi(T,i.width,i.height,I);if(Array.isArray(T)&&T.length>0){const t=T[0];if(!t||"object"!=typeof t||!t.geometry)return e(ai,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:i.width,height:i.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:u,areas:T,areaStyle:Z,size:[i.width,i.height],margin:X,enableHover:!0,tooltipContent:!1===x?()=>null:!0===x?Y:Wn(x)||Y},null!=d&&{graticule:d}),null!=h&&{fitPadding:h}),B&&{zoomable:!0}),p&&{zoomExtent:p}),g&&{onZoom:g}),null!=y&&{dragRotate:y}),m&&{tileURL:m}),v&&{tileAttribution:v}),b&&{tileCacheSize:b}),(A||S||P)&&{customHoverBehavior:q}),(S||P)&&{customClickBehavior:V}),k&&k.length>0&&{annotations:k}),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}),O&&{className:O}),null!=n.animate&&{animate:n.animate}),N);return Q||K||e(di,{componentName:"ChoroplethMap",width:i.width,height:i.height,children:e(lo,Object.assign({},J))})}function Ai(e){const{data:t,rawData:n,colorBy:o,colorScheme:i,legendInteraction:l,legendPosition:s,selection:c,linkedHover:d,fallbackFields:h,unwrapData:f=!1,onObservation:p,chartType:g,chartId:y,showLegend:m,userMargin:v,marginDefaults:b,onClick:x,hoverHighlight:w,loading:k,loadingContent:j,emptyContent:O,width:M,height:A}=e,S=void 0===n,C=r(()=>Pn(t),[t]),[P,z]=u([]),L=a(e=>{z(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),D="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:I,hoverSelectionHook:N,customHoverBehavior:$,customClickBehavior:W,crosshairSourceId:R}=ti({selection:c,linkedHover:d,fallbackFields:h,unwrapData:f,onObservation:p,chartType:g,chartId:y,onClick:x,hoverHighlight:w,colorByField:D}),B=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}}(d,R),_=function(e,t,n){const o=No(),i=ei();return r(()=>{var r;if(!t)return;const l=null!=o?o:void 0,a=null!==(r=null!=n?n:i&&i.length>0?i:void 0)&&void 0!==r?r:"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(l&&Jo(l)){const e=Lo(n.map(e=>({_cat:e})),"_cat",a);return t=>l[t]||e(t)}return Lo(n.map(e=>({_cat:e})),"_cat",a)}if(l&&Jo(l)){const n=Lo(e,t,a);return e=>l[e]||n(e)}return Lo(e,t,a)}if(l&&Jo(l)){const e=Lo([{_:"a"}],"_",a);return t=>l[t]||e(t)}},[e,t,n,o,i])}(C,o,i),T=r(()=>{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]),E=r(()=>S&&P.length>0?P:T,[S,P,T]),F=function(e,t,n){const[o,i]=u(null),[l,s]=u(new Set),c=r(()=>new Set,[]),d=a(t=>{"highlight"===e&&i(t?t.label:null)},[e]),h=a(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]),f=r(()=>{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&&l.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return l.has(o)}}:null},[e,t,o,l]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?l:c,onLegendHover:d,onLegendClick:h,legendSelectionHook:f}}(l,o,E),H=r(()=>N||(F.legendSelectionHook?F.legendSelectionHook:I),[N,F.legendSelectionHook,I]),G=mi(c),q=ei(),V=No(),U=r(()=>{if(_)return _;if(!o||0===E.length)return;const e=Array.isArray(i)&&i.length>0||"string"==typeof i&&i.length>0?i:q&&q.length>0?q:Co,t="__streamCat",n=Lo(E.map(e=>({[t]:e})),t,e);return e=>(null==V?void 0:V[e])||n(e)||"#999"},[_,o,E,i,q,V]),{legend:Z,margin:Y,legendPosition:X}=ni({data:C,colorBy:o,colorScale:U,showLegend:m,legendPosition:s,userMargin:v,defaults:b,categories:E}),Q=r(()=>{const e={};return Z&&(e.legend=Z,e.legendPosition=X),l&&"none"!==l&&(e.legendHoverBehavior=F.onLegendHover,e.legendClickBehavior=F.onLegendClick,e.legendHighlightedCategory=F.highlightedCategory,e.legendIsolatedCategories=F.isolatedCategories),S&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=L),e},[Z,X,l,F.onLegendHover,F.onLegendClick,F.highlightedCategory,F.isolatedCategories,S,o,L]),K=Array.isArray(n)?Pn(n):n,J=gi(k,M,A,j),ee=J?null:pi(K,M,A,O);return{data:C,colorScale:_,allCategories:E,legendState:F,effectiveSelectionHook:H,activeSelectionHook:I,customHoverBehavior:$,customClickBehavior:W,legend:Z,margin:Y,legendPosition:X,earlyReturn:J||ee||null,legendBehaviorProps:Q,crosshairProps:B,resolvedSelection:G}}function Si(e,t){const{variant:n,frameRef:o,overrides:i,deps:r}=t;p(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,l;const a=Array.isArray(t)?t:[t],s=null!==(i=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==i?i:[],c=[];for(const t of a){const n=s.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(r=n.data)&&void 0!==r?r:{}),{id:t})),null===(l=e.current)||void 0===l||l.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 l=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of l)null===(r=e.current)||void 0===r||r.push(n(t));return l},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 l=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of l)null===(r=n.current)||void 0===r||r.pushLine(t(e));return l},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:[]}}}(n,o);return Object.assign(Object.assign({},e),i)},null!=r?r:[])}Mi.displayName="ChoroplethMap";const Ci=f(function(n,o){const l=i(null);Si(o,{variant:"geo-points",frameRef:l});const a=ii(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:c="lon",yAccessor:u="lat",sizeBy:d,sizeRange:h=[3,30],colorBy:f,colorScheme:p,projection:g="equalEarth",graticule:y,fitPadding:m,zoomable:v,zoomExtent:b,onZoom:x,dragRotate:w,tileURL:k,tileAttribution:j,tileCacheSize:O,areas:M,areaStyle:A={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:S,annotations:C,margin:P,className:z,selection:L,linkedHover:D,onObservation:I,onClick:N,chartId:$,loading:W,loadingContent:R,emptyContent:B,legendInteraction:_,legendPosition:T,frameProps:E={},stroke:F,strokeWidth:H,opacity:G}=n,q=null!=v?v:!!k,V=Oi(M),U=Ai({data:null!=s?s:Cn,rawData:s,colorBy:f,colorScheme:p,legendInteraction:_,legendPosition:T,selection:L,linkedHover:D,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:I,onClick:N,chartType:"ProportionalSymbolMap",chartId:$,showLegend:a.showLegend,userMargin:P,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:W,loadingContent:R,emptyContent:B,width:a.width,height:a.height}),Z=U.data,Y=r(()=>{if(!d)return;const e="function"==typeof d?d:e=>null==e?void 0:e[d],t=Z.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?Q(t):void 0},[Z,d]),X=r(()=>{const e=li(e=>({fill:f?zo(e,f,U.colorScale):Xo,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:d?Do(e,d,h,Y):6}),{stroke:F,strokeWidth:H,opacity:G});return U.effectiveSelectionHook?Zo(e,U.effectiveSelectionHook,U.resolvedSelection):e},[f,U.colorScale,U.effectiveSelectionHook,U.resolvedSelection,d,h,Y,F,H,G]),K=r(()=>n=>{const o=(null==n?void 0:n.name)||(null==n?void 0:n.label)||(null==n?void 0:n.NAME)||(null==n?void 0:n.id),i="string"==typeof d?d:null,r=("function"==typeof d?d:e=>e[d])(n),l=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=e?e:"")+"",a="string"==typeof f?f:null,s=a?null==n?void 0:n[a]:null;return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[o&&e("div",{style:{fontWeight:600,marginBottom:2},children:o}),i&&null!=r&&t("div",{children:[t("span",{style:{opacity:.7},children:[i,": "]}),l(r)]}),a&&null!=s&&t("div",{children:[t("span",{style:{opacity:.7},children:[a,": "]}),s+""]}),!o&&!i&&Object.entries(n).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,n])=>t("div",{children:[t("span",{style:{opacity:.7},children:[e,": "]}),l(n)]},e))]})},[d,f]);if(U.earlyReturn)return U.earlyReturn;yi("ProportionalSymbolMap",Z,"xAccessor",c),yi("ProportionalSymbolMap",Z,"yAccessor",u);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(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:g},null!=s&&{points:Z}),{xAccessor:c,yAccessor:u,pointStyle:X}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),V&&{areas:V,areaStyle:A}),null!=y&&{graticule:y}),null!=m&&{fitPadding:m}),q&&{zoomable:!0}),b&&{zoomExtent:b}),x&&{onZoom:x}),null!=w&&{dragRotate:w}),k&&{tileURL:k}),j&&{tileAttribution:j}),O&&{tileCacheSize:O}),{size:[a.width,a.height],margin:U.margin,enableHover:!0,tooltipContent:!1===S?()=>null:Wn(S)||K}),U.legendBehaviorProps),(D||I||N)&&{customHoverBehavior:U.customHoverBehavior}),(I||N)&&{customClickBehavior:U.customClickBehavior}),C&&C.length>0&&{annotations:C}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),a.title&&{title:a.title}),a.description&&{description:a.description}),a.summary&&{summary:a.summary}),void 0!==a.accessibleTable&&{accessibleTable:a.accessibleTable}),z&&{className:z}),null!=n.animate&&{animate:n.animate}),E);return e(di,{componentName:"ProportionalSymbolMap",width:a.width,height:a.height,children:e(lo,Object.assign({ref:l},J))})});Ci.displayName="ProportionalSymbolMap";const Pi="__semiotic_x",zi="__semiotic_y",Li=f(function(n,o){const l=ii(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:c,nodeIdAccessor:u="id",xAccessor:d="lon",yAccessor:h="lat",valueAccessor:f="value",projection:p="equalEarth",graticule:g,fitPadding:y,zoomable:m,zoomExtent:v,onZoom:b,dragRotate:x,tileURL:w,tileAttribution:k,tileCacheSize:j,lineType:O="geo",flowStyle:M="basic",areas:S,areaStyle:C={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:P,edgeOpacity:z=.6,edgeWidthRange:L=[1,8],edgeLinecap:D="round",colorScheme:I,showParticles:N,particleStyle:$,tooltip:W,annotations:R,margin:B,className:_,selection:T,linkedHover:E,onObservation:F,onClick:H,chartId:G,loading:q,loadingContent:V,emptyContent:U,frameProps:Z={},legendInteraction:Y,legendPosition:X,stroke:K,strokeWidth:J,opacity:ee,lineIdAccessor:te}=n,ne=null!=m?m:!!w,oe=Oi(S),ie=r(()=>Pn(c),[c]),re=Ai({data:null!=s?s:Cn,rawData:s,colorBy:P,colorScheme:I,legendInteraction:Y,legendPosition:X,selection:T,linkedHover:E,fallbackFields:P?["string"==typeof P?P:""]:[],unwrapData:!1,onObservation:F,onClick:H,chartType:"FlowMap",chartId:G,showLegend:l.showLegend,userMargin:B,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:q,loadingContent:V,emptyContent:U,width:l.width,height:l.height}),le=re.data,ae=Uo(E),se=Ho({name:(null==ae?void 0:ae.name)||"hover",fields:(null==ae?void 0:ae.fields)||[]}),ce=Eo(e=>e.pushObservation),ue=r(()=>{const e=new Map;for(const t of ie)e.set(t[u]+"",t);return e},[ie,u]),de=i(null),he=i(ue);he.current=ue;const fe=i(d);fe.current=d;const pe=i(h);pe.current=h;const ge=a(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=he.current,n=t.get(e.source+""),o=t.get(e.target+"");if(!n||!o)return null;const i="function"==typeof fe.current?fe.current:e=>e[fe.current],r="function"==typeof pe.current?pe.current:e=>e[pe.current];return Object.assign(Object.assign({},e),{coordinates:[{[Pi]:i(n),[zi]:r(n)},{[Pi]:i(o),[zi]:r(o)}]})},[]);Si(o,{variant:"geo-lines",frameRef:de,overrides:{push:e=>{var t;const n=ge(e);n&&(null===(t=de.current)||void 0===t||t.pushLine(n))},pushMany:e=>{var t;const n=[];for(const t of e){const e=ge(t);e&&n.push(e)}n.length>0&&(null===(t=de.current)||void 0===t||t.pushManyLines(n))}}});const ye=r(()=>{const e=new Map;for(const t of le)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},[le]),me=a(e=>{var t,n;if(E)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=ye.get(t[u]+"");e&&se.onHover(e)}else se.onHover(t)}else se.onHover(null);if(F||ce){const o={timestamp:Date.now(),chartType:"FlowMap",chartId:G};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});F&&F(r),ce&&ce(r)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});F&&F(e),ce&&ce(e)}}},[E,se,u,ye,F,G,ce]),ve=re.customClickBehavior,be=r(()=>{const e="function"==typeof d?d:e=>e[d],t="function"==typeof h?h:e=>e[h];return le.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=ue.get(n.source+""),i=ue.get(n.target+"");return o&&i?Object.assign(Object.assign({},n),{coordinates:[{[Pi]:e(o),[zi]:t(o)},{[Pi]:e(i),[zi]:t(i)}]}):null}).filter(Boolean)},[le,ue,d,h]),xe=r(()=>{const e="function"==typeof d?d:e=>e[d];return t=>null!=t&&"object"==typeof t&&Pi in t?t[Pi]:e(t)},[d]),we=r(()=>{const e="function"==typeof h?h:e=>e[h];return t=>null!=t&&"object"==typeof t&&zi in t?t[zi]:e(t)},[h]),ke=r(()=>{const e=le.filter(e=>e&&"object"==typeof e).map(e=>{var t;return null!==(t=e[f])&&void 0!==t?t:0}).filter(e=>isFinite(e));return 0===e.length?()=>L[0]:A().domain(Q(e)).range(L)},[le,f,L]),je=r(()=>e=>{var t;return{stroke:P?zo(e,P,re.colorScale):Xo,strokeWidth:ke(null!==(t=e[f])&&void 0!==t?t:0),strokeLinecap:D,opacity:z}},[P,re.colorScale,ke,f,z,D]),Oe=r(()=>{var e;const t=li(je,{stroke:K,strokeWidth:J,opacity:ee});if(!re.effectiveSelectionHook)return t;const n=Object.assign(Object.assign({},(null===(e=re.resolvedSelection)||void 0===e?void 0:e.unselectedStyle)||{}),{fillOpacity:0});return Zo(t,re.effectiveSelectionHook,Object.assign(Object.assign({},re.resolvedSelection||{}),{unselectedStyle:n}))},[je,re.effectiveSelectionHook,re.resolvedSelection,K,J,ee]),Me=r(()=>li(()=>({fill:"#333",r:5,fillOpacity:.8}),{stroke:K,strokeWidth:J,opacity:ee}),[K,J,ee]),Ae=r(()=>n=>{var o,i,r,l,a,s,c;if((null==n?void 0:n.geometry)||(null==n?void 0:n.properties)||(null===(o=null==n?void 0:n.data)||void 0===o?void 0:o.geometry)){const t=(null===(i=null==n?void 0:n.properties)||void 0===i?void 0:i.name)||(null===(r=null==n?void 0:n.properties)||void 0===r?void 0:r.NAME)||(null==n?void 0:n.name)||(null==n?void 0:n.NAME)||(null===(a=null===(l=null==n?void 0:n.data)||void 0===l?void 0:l.properties)||void 0===a?void 0:a.name)||(null===(c=null===(s=null==n?void 0:n.data)||void 0===s?void 0:s.properties)||void 0===c?void 0:c.NAME);if(t)return e("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e("div",{style:{fontWeight:600},children:t})})}if(null!=(null==n?void 0:n.source)&&null!=(null==n?void 0:n.target)){const o=n[f];return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t("div",{style:{fontWeight:600},children:[n.source," → ",n.target]}),null!=o&&e("div",{style:{opacity:.7},children:"number"==typeof o?o.toLocaleString():o})]})}const d=(null==n?void 0:n.name)||(null==n?void 0:n.label)||(null==n?void 0:n[u]);return null!=d?e("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e("div",{style:{fontWeight:600},children:d})}):null},[f,u]);if(re.earlyReturn)return re.earlyReturn;const Se=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:p},null!=s&&{lines:be}),{points:ie,xAccessor:xe,yAccessor:we,lineDataAccessor:"coordinates"}),null!=te&&{lineIdAccessor:te}),{lineType:O,flowStyle:M,lineStyle:Oe,pointStyle:Me}),oe&&{areas:oe,areaStyle:C}),null!=g&&{graticule:g}),null!=y&&{fitPadding:y}),ne&&{zoomable:!0}),v&&{zoomExtent:v}),b&&{onZoom:b}),null!=x&&{dragRotate:x}),N&&{showParticles:N}),$&&{particleStyle:$}),w&&{tileURL:w}),k&&{tileAttribution:k}),j&&{tileCacheSize:j}),{size:[l.width,l.height],margin:re.margin,enableHover:!0,tooltipContent:!1===W?()=>null:Wn(W)||Ae}),re.legendBehaviorProps),(E||F||H)&&{customHoverBehavior:me}),(F||H)&&{customClickBehavior:ve}),R&&R.length>0&&{annotations:R}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),l.title&&{title:l.title}),l.description&&{description:l.description}),l.summary&&{summary:l.summary}),void 0!==l.accessibleTable&&{accessibleTable:l.accessibleTable}),_&&{className:_}),null!=n.animate&&{animate:n.animate}),Z);return e(di,{componentName:"FlowMap",width:l.width,height:l.height,children:e(lo,Object.assign({ref:de},Se))})});Li.displayName="FlowMap";const Di=f(function(n,o){const l=ii(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,lines:c,xAccessor:h="lon",yAccessor:f="lat",nodeIdAccessor:p="id",center:g,costAccessor:y,strength:m=1,lineMode:v="straight",projection:b="mercator",graticule:x,fitPadding:w,zoomable:k,zoomExtent:j,onZoom:O,dragRotate:M,tileURL:A,tileAttribution:S,tileCacheSize:C,transition:P,colorBy:z,colorScheme:L,pointRadius:D=5,tooltip:I,showRings:N=!0,ringStyle:$,showNorth:W=!0,costLabel:R,annotations:B,margin:_,className:T,selection:E,linkedHover:F,onObservation:H,onClick:G,chartId:q,loading:V,loadingContent:U,emptyContent:Z,legendPosition:Y,frameProps:X={},stroke:Q,strokeWidth:K,opacity:J}=n,ee=null!=k?k:!!A,te=r(()=>Pn(s),[s]),ne=Ai({data:te,rawData:s,colorBy:z,colorScheme:L,legendInteraction:void 0,legendPosition:Y,selection:E,linkedHover:F,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!1,onObservation:H,onClick:G,chartType:"DistanceCartogram",chartId:q,showLegend:l.showLegend,userMargin:_,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:V,loadingContent:U,emptyContent:Z,width:l.width,height:l.height}),oe=r(()=>{const e=li(e=>({fill:z?zo(e,z,ne.colorScale):Xo,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:D}),{stroke:Q,strokeWidth:K,opacity:J});return ne.effectiveSelectionHook?Zo(e,ne.effectiveSelectionHook,ne.resolvedSelection):e},[z,ne.colorScale,ne.effectiveSelectionHook,ne.resolvedSelection,D,Q,K,J]),ie=r(()=>({center:g,centerAccessor:p,costAccessor:y,strength:m,lineMode:v}),[g,p,y,m,v]),re=r(()=>{if(!c)return;const e="function"==typeof h?h:e=>e[h],t="function"==typeof f?f:e=>e[f],n=new Map;for(const e of te)n.set(e[p]+"",e);return c.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:[{[h]:e(i),[f]:t(i)},{[h]:e(r),[f]:t(r)}]}):null}).filter(Boolean)},[c,te,h,f,p]),le=r(()=>n=>{const o=("function"==typeof y?y:e=>e[y])(n);return t("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e("div",{style:{fontWeight:600},children:n[p]||n.name||n.id||"Point"}),null!=o&&t("div",{style:{opacity:.7},children:["Cost: ","number"==typeof o?o.toFixed(1):o]})]})},[y,p]),ae=i(null);Si(o,{variant:"geo-points",frameRef:ae});const[se,ce]=u(null),ue=a(()=>{var e,t;const n=null===(t=null===(e=ae.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&ce(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);d(()=>{const e=requestAnimationFrame(ue);return()=>cancelAnimationFrame(e)},[ue,m,g,l.width,l.height,te]);const de=r(()=>{if(!N||!se)return[];const{maxCost:e}=se;if(0>=e)return[];if(Array.isArray(N))return N.filter(t=>t>0&&e>=t);const t="number"==typeof N?N: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},[N,se]),he=r(()=>{var n,o;if(!se)return X.foregroundGraphics||null;const{cx:i,cy:r,maxCost:l,availableRadius:a}=se,s=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},$),c=null!==(n=ne.margin.left)&&void 0!==n?n:10,u=null!==(o=ne.margin.top)&&void 0!==o?o:10;return t("g",{children:[de.map(n=>{const o=n/l*a;return t("g",{children:[e("circle",{cx:i+c,cy:r+u,r:o,fill:"none",stroke:s.stroke,strokeWidth:s.strokeWidth,strokeDasharray:s.strokeDasharray,opacity:.5}),t("text",{x:i+c+o+3,y:r+u-2,fontSize:s.labelSize,fill:s.labelColor,fontFamily:"system-ui, sans-serif",children:[n,R?" "+R:""]})]},n)}),W&&t("g",{transform:`translate(${c+24}, ${u+24})`,children:[e("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),e("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("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),e("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),e("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),e("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]}),X.foregroundGraphics]})},[se,de,W,R,$,ne.margin,X.foregroundGraphics]);if(ne.earlyReturn)return ne.earlyReturn;yi("DistanceCartogram",te,"xAccessor",h),yi("DistanceCartogram",te,"yAccessor",f);const fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:b},null!=s&&{points:te}),re&&{lines:re,lineDataAccessor:"coordinates"}),{xAccessor:h,yAccessor:f,pointIdAccessor:p,pointStyle:oe,projectionTransform:ie}),P&&{transition:{duration:P}}),null!=x&&{graticule:x}),null!=w&&{fitPadding:w}),ee&&{zoomable:!0}),j&&{zoomExtent:j}),O&&{onZoom:O}),null!=M&&{dragRotate:M}),A&&{tileURL:A}),S&&{tileAttribution:S}),C&&{tileCacheSize:C}),{size:[l.width,l.height],margin:ne.margin,enableHover:!0,tooltipContent:!1===I?()=>null:Wn(I)||le}),ne.legendBehaviorProps),(F||H||G)&&{customHoverBehavior:ne.customHoverBehavior}),(H||G)&&{customClickBehavior:ne.customClickBehavior}),B&&B.length>0&&{annotations:B}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),l.title&&{title:l.title}),l.description&&{description:l.description}),l.summary&&{summary:l.summary}),void 0!==l.accessibleTable&&{accessibleTable:l.accessibleTable}),T&&{className:T}),null!=n.animate&&{animate:n.animate}),X),he&&{foregroundGraphics:he});return e(di,{componentName:"DistanceCartogram",width:l.width,height:l.height,children:e(lo,Object.assign({ref:ae},fe))})});function Ii(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})}Di.displayName="DistanceCartogram";export{Mi as ChoroplethMap,Di as DistanceCartogram,Li as FlowMap,Ci as ProportionalSymbolMap,lo as StreamGeoFrame,Ii as mergeData,ji as resolveReferenceGeography};
2
+ import{useRef as e,useState as t,useEffect as n,useMemo as o,useCallback as r,useImperativeHandle as i,forwardRef as a,memo as s}from"react";import{geoPath as l,geoGraticule as c,geoDistance as u,geoInterpolate as h}from"d3-geo";import{quadtree as d}from"d3-quadtree";var 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,a=this.buffer[i];if(e(a)){let e;e="object"!=typeof a||null===a?a:Array.isArray(a)?[...a]:{...a},n.push(e),this.buffer[i]=t(a)}}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}import{scaleOrdinal as b}from"d3-scale";function v(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function x(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function w(e){const t=e.map(v),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return x(e,n,o)}if(e>=1){const[e,o,r]=t[n];return x(e,o,r)}const o=e*n,r=Math.floor(o),i=o-r,[a,s,l]=t[r],[c,u,h]=t[r+1];return x(Math.round(a+(c-a)*i),Math.round(s+(u-s)*i),Math.round(l+(h-l)*i))}}var k=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],S=w(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),M=w(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),A=w(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),C=w(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),L=w(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),j=w(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),P=w(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),I=w(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),D=w(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),z=w(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),R=w(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),O=w(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),T={blues:S,reds:M,greens:A,viridis:P,oranges:C,purples:L,greys:j,plasma:I,inferno:D,magma:z,cividis:R,turbo:O};function N(e){return e&&T[e]||S}w(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),w(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),w(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),w(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),w(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),w(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),w(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);var $={category10:k,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=k,_=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],E=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")||E.has(t)}(o)?n(o):o}const o=e?.[t]+"";return n?n(o):W[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o))%W.length]}function 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 b().domain(o).range(n).unknown("#999");const i=$[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:W;return b().domain(o).range(e).unknown("#999")}}function G(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e?.[t],!o)return r;const[i,a]=o,[s,l]=n;if(a===i)return(s+l)/2;let c=(r-i)/(a-i);return 0>c?c=0:c>1&&(c=1),s+c*(l-s)}function q(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 Z(e,t,n){e.has(t)||(e.add(t),console.warn(n))}import{geoMercator as U,geoEqualEarth as Y,geoAlbersUsa as X,geoOrthographic as Q,geoNaturalEarth1 as K,geoEquirectangular as J}from"d3-geo";var ee={mercator:U,equalEarth:Y,albersUsa:X,orthographic:Q,naturalEarth:K,equirectangular:J};function te(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function ne(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function oe(e,t,n){return e?"function"==typeof e?{...n,...e(t)}:{...n,...e}:{...n}}function re(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 ie(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 a=-r/i,s=o/i,l=Math.min(.3*i,80),c=(e[0]+t[0])/2+a*l,u=(e[1]+t[1])/2+s*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 ae(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,a;0===t?(i=e[1][0]-r[0],a=e[1][1]-r[1]):t===e.length-1?(i=r[0]-e[t-1][0],a=r[1]-e[t-1][1]):(i=e[t+1][0]-e[t-1][0],a=e[t+1][1]-e[t-1][1]);const s=Math.sqrt(i*i+a*a)||1;o.push([r[0]+a/s*n,r[1]+-i/s*n])}return o}function se(e,t,n,o,r){const i=t[0]-e[0],a=t[1]-e[1],s=Math.sqrt(i*i+a*a);if(0===s)return[e,t];const l=a/s,c=-i/s,u=r/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}import{scaleLinear as le}from"d3-scale";function ce(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 ue(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}function he(e,t,n,o){const r=e.push(t);return n&&n.push(o),r}var de=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();he(this.pointBuffer,e,this.timestampBuffer,t),this.lastIngestTime=t}pushMany(e){this.pointBuffer||this.initStreaming();const t=m();for(const n of e)he(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,a=[...this.baseTranslate],s=[...this.baseRotation],c=this.scene;this.projection=function(e){if(!e)return Y();if("string"==typeof e){const t=ee[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),Y())}if("object"==typeof e&&"type"in e){const t=ee[e.type],n=t?t():Y();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=l(this.projection),this.fitProjection(e),this.geoPath=l(this.projection);const u=this.projection;this.scales={projection:u,geoPath:this.geoPath,projectedPoint:(e,t)=>u([e,t]),invertedPoint:(e,t)=>u.invert?u.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const h=this.buildSceneNodes(e);if(this._customLayoutFailedThisBuild)!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.projection=n,this.geoPath=o,this.scales=r,this.baseScale=i,this.baseTranslate=a,this.baseRotation=s):(this.scene=[],this.rebuildQuadtree());else{if(this.scene=h,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&&c.length>0&&this.startTransition(c),this.version++}}fitProjection(e){const t=this.projection,n=this.config,o=[...this.areas],r=te(n.xAccessor,"lon"),i=te(n.yAccessor,"lat"),a=this.getPoints();if(a.length>0){const e=a.map(e=>[r(e),i(e)]);o.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const s=ne(n.lineDataAccessor);for(const e of this.lineData){const t=s(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,a]]=n.projectionExtent;t.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[o,r],[i,r],[i,a],[o,a],[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 a=e.width*i,s=e.height*i;t.fitExtent([[a,s],[e.width-a,e.height-s]],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(),a=[...n.translate()],s=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=l(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 c=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(i),n.translate(a),this.currentZoom=s,this.geoPath=o,this.scales=r):(this.scene=[],this.rebuildQuadtree()):(this.scene=c,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(),a=[...n.translate()],s=this.currentZoom;n.scale(this.baseScale*e),n.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=l(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 c=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(i),n.translate(a),this.currentZoom=s,this.geoPath=o,this.scales=r):(this.scene=[],this.rebuildQuadtree()):(this.scene=c,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=l(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 a=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.rotate(i),this.geoPath=o,this.scales=r):(this.scene=[],this.rebuildQuadtree()):(this.scene=a,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=d().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=te(t.xAccessor,"lon"),i=te(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=$[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(t.colorScheme,t.themeCategorical,_),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:q(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 a=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 a)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&&Z(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)&&Z(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:a,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),a}this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap;const a=[],s=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),d=function(e){return{fill:e.themeSemantic?.primary||"#4e79a7",r:4,fillOpacity:.8}}(t);if(t.graticule){const n=!0===t.graticule?{}:t.graticule,r=c();n.step&&r.step(n.step);const i=o(r())||"";i&&a.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=oe(t.areaStyle,e,s);a.push({type:"geoarea",pathData:n,centroid:r,bounds:i,screenArea:l,style:c,datum:e,interactive:!0})}const f=ne(t.lineDataAccessor);for(const o of this.lineData){const s=f(o);if(!s||2>s.length)continue;let c=[];if("geo"===t.lineType){const e=Array(s.length);for(let t=0;s.length>t;t++)e[t]=[r(s[t]),i(s[t])];for(let t=0;e.length-1>t;t++){const o=e[t],r=e[t+1],i=u(o,r)||0,a=Math.max(2,Math.ceil(i/(Math.PI/180))),s=h(o,r);for(let e=0;a>=e;e++){if(t>0&&0===e)continue;const o=n(s(e/a));null!=o&&c.push(o)}}}else for(let e=0;s.length>e;e++){const t=s[e],o=n([r(t),i(t)]);null!=o&&c.push(o)}if(2>c.length)continue;const d=oe(t.lineStyle,o,l),p="number"==typeof d.strokeWidth?d.strokeWidth:1;2!==s.length||2>c.length||"arc"!==t.flowStyle?2!==s.length||2>c.length||"offset"!==t.flowStyle||(c="geo"===t.lineType?ae(c,p):se(c[0],c[c.length-1],0,0,p)):c=ie(c[0],c[c.length-1]);const m=re(c,e.width);if(m.length>1)for(const e of m){if(2>e.length)continue;const t={type:"line",path:e,style:{...d,_edgeFade:!0},datum:o};a.push(t)}else a.push({type:"line",path:2>c.length&&m[0]||c,style:d,datum:o})}const p=this.getPoints(),m=t.pointIdAccessor?"function"==typeof t.pointIdAccessor?t.pointIdAccessor:e=>e[t.pointIdAccessor]:null,y=n.clipAngle?n.clipAngle()??0:0,g=y>0?y*Math.PI/180:null,b=n.rotate?n.rotate():[0,0,0],v="function"==typeof n.center?n.center():[0,0],x=[(v[0]??0)-b[0],(v[1]??0)-b[1]];for(let e=0;p.length>e;e++){const o=p[e],s=r(o),l=i(o);if(null!=g&&u([s,l],x)>g)continue;const c=n([s,l]);if(!c)continue;const h=t.pointStyle?t.pointStyle(o):{...d},f={type:"point",x:c[0],y:c[1],r:h.r||4,style:h,datum:o,pointId:m?m(o)+"":void 0};a.push(f)}return a}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 a=t.centerAccessor?"function"==typeof t.centerAccessor?t.centerAccessor:e=>e[t.centerAccessor]:e=>e.id,s="function"==typeof t.costAccessor?t.costAccessor:e=>e[t.costAccessor],l=r.find(e=>e.datum&&a(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=ue(r.map(e=>e.datum?s(e.datum):NaN).filter(e=>isFinite(e)&&e>=0),1),d=Math.min(n.width,n.height)/2,f=le().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=s(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},v=e.filter(e=>"line"===e.type);if(v.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 v){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}};de.QUADTREE_THRESHOLD=500;var fe=de;function pe(e,t=30){return Math.max((e??4)+5,12,t)}function me(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function ye(e,t){const n=me(e);if(!n)return!1;const o=me(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}var ge=[40,40],be=[.5,.5];function ve(e,t){const[n,o]=e.viewBox??ge,[r,i]=e.anchor??be,a=o>0?o:1,s=Math.max(0,t)/a,l=(n>0?n:a)*s,c=a*s;return{width:l,height:c,scale:s,offsetX:-r*l,offsetY:-i*c}}function xe(e,t){const n=ve(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 we(e,t,n,o){if("none"!==e)return"color"===e||null==e?t??o:"accent"===e?n:e}var ke=null;function Se(e){if("undefined"==typeof Path2D)return null;ke||(ke=new Map);const t=ke.get(e);if(t)return t;const n=new Path2D(e);return ke.size>1024&&ke.clear(),ke.set(e,n),n}function Me(e,t,n=0,o="horizontal"){const[r,i]=e.viewBox??ge,a=Math.min(1,Math.max(0,n)),s=Math.min(1,Math.max(0,t));return s>a?a>0||1>s?"vertical"===o?{x:0,y:i*(1-s),width:r,height:i*(s-a)}:{x:r*a,y:0,width:r*(s-a),height:i}:null:{x:0,y:0,width:0,height:0}}function Ae(e,t){const n=ve(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 Ce(e,t,n,o,r,i=e=>e){for(const a of t.parts){const t=Se(a.d);if(!t)continue;const s=a.opacity??1,l=e.globalAlpha;1!==s&&(e.globalAlpha=l*s);const c=r?"none"===a.fill?void 0:r:we(a.fill,n,o);c&&(e.fillStyle=i(c),e.fill(t));const u=r?a.stroke&&"none"!==a.stroke?r:void 0:we(a.stroke??"none",n,o);u&&(e.strokeStyle=i(u),e.lineWidth=a.strokeWidth??1,e.lineCap=a.strokeLinecap??"butt",e.lineJoin=a.strokeLinejoin??"miter",e.stroke(t)),1!==s&&(e.globalAlpha=l)}}function Le(e,t,n,o,r,i,a=0,s=o){if(i){const e=function(e,t,n,o,r,i=e=>e.x,a=e=>e.y,s=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=a(e)-n,u=Math.sqrt(l*l+c*c);pe(s(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,a);if(e)return e}else{let r=null,i=o;for(const a of e){if("point"!==a.type)continue;const e=a.x-t,s=a.y-n,l=Math.sqrt(e*e+s*s);pe(a.r,o)>=l&&i>l&&(r=a,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=Ae(r.glyph,r.size),i=r.x+e.centerDx-t,a=r.y+e.centerDy-n,s=Math.sqrt(i*i+a*a);pe(e.radius,o)>=s&&c>s&&(l=r,c=s)}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 a=i;if(!1===a.interactive)continue;const[[s,l],[c,u]]=a.bounds;if(!(s>t||t>c||l>n||n>u)&&(a._cachedPath2D||(a._cachedPath2D=new Path2D(a.pathData)),r.isPointInPath(a._cachedPath2D,t,n)))return{node:a,distance:0}}let u=null,h=s;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,s);for(let o=0;r.length-1>o;o++){const[a,s]=r[o],[l,c]=r[o+1],d=je(t,n,a,s,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 a=r-n,s=i-o,l=a*a+s*s;if(0===l)return Math.sqrt((e-n)**2+(t-o)**2);let c=((e-n)*a+(t-o)*s)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(n+c*a))**2+(t-(o+c*s))**2)}import*as Pe from"react";import{useCallback as Ie,useEffect as De,useLayoutEffect as ze,useMemo as Re,useRef as Oe}from"react";import{createContext as Te,useCallback as Ne,useContext as $e,useMemo as We,useRef as _e,useSyncExternalStore as Ee}from"react";import{jsx as Be}from"react/jsx-runtime";function He(e){let t=null;const n=()=>(t||(t=Te(null)),t),o=Fe(e);return[function({children:t,initialState:o}){const r=_e(o),i=We(()=>Fe(e,r.current),[]),a=n();return Be(a.Provider,{value:i,children:t})},(e,t)=>{const r=n(),i=$e(r)??o,a=_e(e);a.current=e;const s=_e({hasValue:!1,value:void 0}),l=Ne(()=>{const e=a.current(i.getState()),n=s.current;return n.hasValue&&t&&t(n.value,e)?n.value:(s.current={hasValue:!0,value:e},e)},[i,t]),c=Ne(()=>a.current(i.getState()),[i]);return Ee(i.subscribe,l,c)}]}function Fe(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 Ge(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 qe(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:Ve}}),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 Ve=["#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}},Ue={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}},Ye={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Ve,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 Xe(e,t){if("light"===t)return Ze;if("dark"===t)return Ue;if("high-contrast"===t)return Ye;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?Ue:Ze;return qe({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return qe({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[Qe,Ke]=He(e=>({theme:Ze,setTheme(t){e(e=>({theme:Xe(e.theme,t)}))}}));import{useState as Je,useEffect as et}from"react";import{useRef as tt,useState as nt,useEffect as ot}from"react";var rt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,it=new WeakMap,at=0,st=!1,lt=null,ct=null;function ut(e,t){if(!t)return t;const n=rt.exec(t);if(!n)return t;const o=e.canvas;if(!o)return n[2]?.trim()||t;!function(){if(st)return;if("undefined"==typeof window||"undefined"==typeof document)return;st=!0;const e=()=>{at++};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{lt=window.matchMedia("(prefers-color-scheme: dark)"),ct=e,"function"==typeof lt.addEventListener?lt.addEventListener("change",ct):"function"==typeof lt.addListener&&lt.addListener(ct)}catch{}}();let r=it.get(o);r&&r.version===at||(r={version:at,map:new Map},it.set(o,r));const i=r.map.get(t);if(void 0!==i)return i;const a=getComputedStyle(o).getPropertyValue(n[1]).trim()||n[2]?.trim()||t;return r.map.set(t,a),a}var ht="undefined"==typeof window?De:ze,dt={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function ft(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function pt(e){const t=function(){const[e,t]=Je(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return et(()=>{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=Oe(t);n.current=t;const[o,r]=function(e,t,n){const o=tt(null),[r,i]=nt(null);return ot(()=>{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=Re(()=>({...e.marginDefault,...e.userMargin}),[e.marginDefault,e.userMargin]),a=r[0]-i.left-i.right,s=r[1]-i.top-i.bottom,l=ft(e.foregroundGraphics,r,i),c=ft(e.backgroundGraphics,r,i),u=Ke(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-"+Pe.useId(),p=Oe(null),m=Oe(e.frameScheduler??dt);m.current=e.frameScheduler??dt;const y=Oe(null),g=Oe(!1),b=Oe(()=>{}),v=Ie(()=>{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)},[]),x=Ie(()=>{null!==p.current&&((y.current??m.current).cancelAnimationFrame(p.current),p.current=null,y.current=null)},[]);De(()=>()=>{x()},[x]);const w=Oe(()=>{}),k=Oe(()=>{}),S=Oe(null),M=Oe(null),A=Oe(null),C=Ie(()=>{const e=S.current;S.current=null,e&&w.current(e)},[]),L=Ie(e=>{if(S.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,A.current=null,C()});t||(M.current=n,A.current=e)}},[C]),j=Ie(()=>{S.current=null,null!==M.current&&((A.current??m.current).cancelAnimationFrame(M.current),M.current=null,A.current=null),k.current()},[]);De(()=>()=>{S.current=null,null!==M.current&&((A.current??m.current).cancelAnimationFrame(M.current),M.current=null,A.current=null)},[]);const P=e.themeDirtyRef;return ht(()=>{P&&(at++,P.current=!0,v())},[u,v,P]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:o,size:r,margin:i,adjustedWidth:a,adjustedHeight:s,resolvedForeground:l,resolvedBackground:c,currentTheme:u,transition:h,introEnabled:d,tableId:f,rafRef:p,renderFnRef:b,scheduleRender:v,cancelRender:x,hoverHandlerRef:w,hoverLeaveRef:k,onPointerMove:L,onPointerLeave:j}}import{useEffect as mt,useRef as yt}from"react";import{useEffect as gt,useRef as bt}from"react";var vt={fresh:1,aging:.7,stale:.45,expired:.25},xt={alpha:1,band:"fresh",isStale:!1};import{jsx as wt}from"react/jsx-runtime";function kt({isStale:e,position:t}){return wt("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"})}import{useMemo as St,useRef as Mt,useEffect as At}from"react";import*as Ct from"react";import{jsx as Lt,jsxs as jt}from"react/jsx-runtime";var Pt={fill:(e,t)=>Lt("rect",{style:e,width:t,height:t}),line:(e,t)=>Lt("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function It(e,t,n,o,r){let i;return i="function"==typeof n?n(e):(0,Pt[n])(o(e,t),r),i}function Dt({swatchSize:e}){return Lt("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 zt(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var Rt=(e,t,n,o,r,i,a,s,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:v,rowHeight:x}=u;return f.forEach((e,c)=>{const u=It(e,c,h,d,b),w=zt(e,o,r),k=r&&r.size>0&&r.has(e.label);p.push(jt("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?s===i&&c===a?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&g?k||!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(s,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:y?t=>{l(s,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:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&Lt("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+v+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,k&&Lt(Dt,{swatchSize:b}),Lt("text",{y:b/2,x:b+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),m+=x}),p};function Ot({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:r,label:i,format:a}=e,s=a||(e=>Math.round(100*e)/100+""),l="grad-legend-"+Ct.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),a=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(Lt("stop",{offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))},e))}return jt("g",{"aria-label":i||"Gradient legend",children:[Lt("defs",{children:Lt("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&Lt("text",{x:a+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),Lt("rect",{x:a,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),Lt("text",{x:a,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(r[0])}),Lt("text",{x:a+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(r[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(Lt("stop",{offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))},e))}return jt("g",{"aria-label":i||"Gradient legend",children:[i&&Lt("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),Lt("defs",{children:Lt("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),Lt("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),Lt("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(r[1])}),Lt("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(r[0])})]})}function Tt(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:a,title:s="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]=Ct.useState(0),[m,y]=Ct.useState(0),g=Ct.useCallback((e,t)=>{p(e),y(t)},[]),b="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:a,focusedItemIndex:s,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{let h=24;const d=[];return e.forEach((e,f)=>{h+=5,d.push(Lt("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(Lt("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(Lt("g",{className:"legend-item",transform:`translate(0,${h})`,children:Rt(e,n,o,r,i,a,s,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:a,metrics:d}):(({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,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,a,s,l,c,u,h)=>{const{type:d="fill",styleFn:f,items:p}=e,m=[],{swatchSize:y,labelGap:g,itemGap:b,rowHeight:v,align:x}=u,w=!(!t&&!n),k="isolate"===c||void 0===c&&null!=r,S=p.map(e=>y+g+7*e.label.length),M=[];let A=0,C=0;S.forEach((e,t)=>{const n=0===C?e:C+b+e;h&&h>0&&C>0&&n>h?(M.push({start:A,end:t,width:C}),A=t,C=e):C=n}),p.length>0&&M.push({start:A,end:p.length,width:C}),M.forEach((e,c)=>{let u="center"===x?Math.max(0,((h??e.width)-e.width)/2):"end"===x?Math.max(0,(h??e.width)-e.width):0;for(let h=e.start;e.end>h;h++){const e=p[h],x=It(e,h,d,f,y),M=zt(e,o,r),A=r&&r.size>0&&r.has(e.label);m.push(jt("g",{transform:`translate(${u},${c*v})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:w?s===i&&h===a?0:-1:void 0,role:w?"option":void 0,"aria-selected":w&&k?A||!1:void 0,"aria-current":w&&!k&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:w?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(s,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:w?t=>{l(s,h),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:w?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:w?"pointer":"default",opacity:M,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[w&&Lt("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"}),x,A&&Lt(Dt,{swatchSize:y}),Lt("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+=S[h]+b}});const L=Math.max(0,...M.map(e=>e.width)),j=M.length;return{items:m,offset:L,totalRows:j,totalHeight:j*v}})(e,o,r,i,a,s,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(Lt("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(Lt("g",{className:"legend-item",transform:`translate(${m},0)`,children:n.items},"legend-group-"+o)),m+=n.offset+5,e[o+1]&&y.push(Lt("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+o)),m+=12}),Lt("g",{children:y})})({legendGroups:t||[],title:s,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:g,legendInteraction:a,metrics:d}),v=!(!n&&!o);return jt("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==s&&""!==s&&"vertical"===u&&Lt("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:s}),b]})}function Nt(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}import{jsx as $t}from"react/jsx-runtime";function Wt(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",legendLayout:a,title:s,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:h,legendInteraction:d}=e;if(!t)return null;const f="top"===i||"bottom"===i,p=!!s,m=Math.max(0,n-r.left-r.right),y=Math.max(1,f?a?.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),$t("g",{transform:`translate(${g}, ${b})`,children:(v=t,"object"==typeof v&&null!==v&&"gradient"in v?$t(Ot,{config:t.gradient,orientation:f?"horizontal":"vertical",width:y}):Nt(t)?$t(Tt,{legendGroups:t.legendGroups,title:"",width:y,orientation:f?"horizontal":"vertical",legendLayout:a,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:h,legendInteraction:d}):t)});var v}import{useMemo as _t}from"react";import{bin as Et}from"d3-array";import{jsx as Bt,jsxs as Ht}from"react/jsx-runtime";function Ft(e){return"string"==typeof e?{type:e}:e}function Gt({orient:e,config:t,values:n,scale:o,size:r,length:i}){const a=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),s="top"===e||"bottom"===e,l=_t(()=>{if(0===n.length)return null;const t=o.domain(),l=r-8;if("boxplot"===a.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)],a=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*a),whiskerHigh:Math.min(t[n-1],i+1.5*a)}}(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(s){const t=o(r),n=o(c),s=o(i),l=o(u),p=o(h),m="top"===e?-1:1,y=0;return Ht("g",{"data-testid":"marginal-boxplot-"+e,children:[Bt("line",{x1:l,y1:y+m*(f+d/2),x2:p,y2:y+m*(f+d/2),stroke:a.fill,strokeWidth:a.strokeWidth}),Bt("line",{x1:l,y1:y+m*f,x2:l,y2:y+m*(f+d),stroke:a.fill,strokeWidth:a.strokeWidth}),Bt("line",{x1:p,y1:y+m*f,x2:p,y2:y+m*(f+d),stroke:a.fill,strokeWidth:a.strokeWidth}),Bt("rect",{x:Math.min(t,n),y:"top"===e?y-f-d:y+f,width:Math.abs(n-t),height:d,fill:a.fill,fillOpacity:a.fillOpacity,stroke:"none"===a.stroke?a.fill:a.stroke,strokeWidth:a.strokeWidth}),Bt("line",{x1:s,y1:"top"===e?y-f-d:y+f,x2:s,y2:"top"===e?y-f:y+f+d,stroke:a.fill,strokeWidth:2})]})}{const t=o(r),n=o(c),s=o(i),l=o(u),p=o(h),m="left"===e?-1:1,y=0;return Ht("g",{"data-testid":"marginal-boxplot-"+e,children:[Bt("line",{x1:y+m*(f+d/2),y1:l,x2:y+m*(f+d/2),y2:p,stroke:a.fill,strokeWidth:a.strokeWidth}),Bt("line",{x1:y+m*f,y1:l,x2:y+m*(f+d),y2:l,stroke:a.fill,strokeWidth:a.strokeWidth}),Bt("line",{x1:y+m*f,y1:p,x2:y+m*(f+d),y2:p,stroke:a.fill,strokeWidth:a.strokeWidth}),Bt("rect",{x:"left"===e?y-f-d:y+f,y:Math.min(t,n),width:d,height:Math.abs(n-t),fill:a.fill,fillOpacity:a.fillOpacity,stroke:"none"===a.stroke?a.fill:a.stroke,strokeWidth:a.strokeWidth}),Bt("line",{x1:"left"===e?y-f-d:y+f,y1:s,x2:"left"===e?y-f:y+f+d,y2:s,stroke:a.fill,strokeWidth:2})]})}}const c=Et().domain(t).thresholds(a.bins)(n);if(0===c.length)return null;const u=ue(c.map(e=>e.length));if(0===u)return null;if("histogram"===a.type)return Bt("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(s){const i=o(t.x0),s=o(t.x1)-o(t.x0);return Bt("rect",{x:i,y:"top"===e?-4-r:4,width:Math.max(s,.5),height:r,fill:a.fill,fillOpacity:a.fillOpacity,stroke:a.stroke,strokeWidth:a.strokeWidth},n)}{const i=o(t.x0),s=o(t.x1)-o(t.x0);return Bt("rect",{x:"left"===e?-4-r:4,y:Math.min(i,i+s),width:r,height:Math.abs(s),fill:a.fill,fillOpacity:a.fillOpacity,stroke:a.stroke,strokeWidth:a.strokeWidth},n)}})});if("violin"===a.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),a=o((r.x0+r.x1)/2);n.push(s?`${a},${"top"===e?-(t-i):t-i}`:`${"left"===e?-(t-i):t-i},${a}`)}for(let r=c.length-1;r>=0;r--){const i=c[r];if(null==i.x0||null==i.x1)continue;const a=i.length/u*(l/2),h=o((i.x0+i.x1)/2);n.push(s?`${h},${"top"===e?-(t+a):t+a}`:`${"left"===e?-(t+a):t+a},${h}`)}return Bt("g",{"data-testid":"marginal-violin-"+e,children:Bt("polygon",{points:n.join(" "),fill:a.fill,fillOpacity:a.fillOpacity,stroke:"none"===a.stroke?a.fill:a.stroke,strokeWidth:a.strokeWidth})})}if("ridgeline"===a.type){const t=[];if(s){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 a=null!=c[c.length-1].x1?o(c[c.length-1].x1):i;t.push(`L${a},${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 a=null!=c[c.length-1].x1?o(c[c.length-1].x1):i;t.push(`L${n},${a}`),t.push("Z")}return Bt("g",{"data-testid":"marginal-ridgeline-"+e,children:Bt("path",{d:t.join(" "),fill:a.fill,fillOpacity:a.fillOpacity,stroke:"none"===a.stroke?a.fill:a.stroke,strokeWidth:a.strokeWidth})})}return null},[n,o,a,r,i,e,s,4]);return l?Bt("g",{className:"marginal-"+e,"data-testid":"marginal-"+e,children:l}):null}import*as qt from"react";import{jsx as Vt,jsxs as Zt}from"react/jsx-runtime";function Ut(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let a="";for(const e of r)a&&a.length+1+e.length>o?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function Yt(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 Xt(e,t,n,o){if(!e)return Vt("g",{className:"annotation-note"});const{label:r,title:i,orientation:a,align:s,wrap:l=120,noWrap:c}=e;if(!r&&!i)return Vt("g",{className:"annotation-note"});let u=a;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let h=s;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]:Ut(i,l):[],m=r?c?[r]:Ut(r,l):[],y="leftRight"===u?"end"===d?-4:4:0;let g=0;const b=[],v=o||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push(Vt("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:Zt("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:v,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===d?"right":"middle"===d?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&Vt("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),r&&Vt("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")):(p.length>0&&(b.push(Vt("text",{className:"annotation-note-title",fill:v,textAnchor:d,fontWeight:"bold",children:p.map((e,t)=>Vt("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-title")),g=p.length*f),m.length>0&&b.push(Vt("text",{className:"annotation-note-label",fill:v,textAnchor:d,y:g,children:m.map((e,t)=>Vt("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let x=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),x=Vt("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),x=Vt("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,p.length+m.length-1)*f;let k=0;return"topBottom"===u?k=0>n?-(w+2):18:"leftRight"===u&&(k="middle"===h?-(w+f+(m.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>n?-(w+2):18),Zt("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[Vt("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0,children:b}),x]})}function Qt(e,t,n,o,r){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push(Vt("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(Vt("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,a=r||0;if(void 0!==t?.x){const o=(t.x||0)-e;i.push(Vt("line",{x1:o,y1:(t.y1||0)-a,x2:o,y2:(t.y2||0)-a,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const o=(t.y||0)-a;i.push(Vt("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(Vt("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(Vt("line",{x1:0,y1:(t.y1||0)-a,x2:0,y2:(t.y2||0)-a,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(Vt("path",{d:Yt(e,o,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return Vt("g",{className:"annotation-subject",children:i})}function Kt(e,t,n,o,r,i){const a=[];let s=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,a=e-r,c=t-i;if(0!==a||0!==c){const e=Math.abs(a),t=Math.abs(c),u=n/2,h=o/2,d=e*h>t*u?u/e:h/t;s=r+a*d,l=i+c*d}}}else if("bracket"===r&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(s=e/2,l=n):void 0!==t&&(s=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);s=Math.cos(o)*n,l=Math.sin(o)*n}}const c=Math.sqrt((e-s)**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-s);if(i){const o=(s+e)/2,i=(l+t)/2,h=-(t-l)/c,d=(e-s)/c,f=(n?.curve??.25)*c,p=o+h*f,m=i+d*f;a.push(Vt("path",{className:"connector-curve",d:`M${s},${l}Q${p},${m} ${e},${t}`,fill:"none",stroke:r},"connector-line")),u=Math.atan2(m-l,p-s)}else a.push(Vt("line",{x1:s,y1:l,x2:e,y2:t,stroke:r},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;a.push(Vt("path",{d:`M${s},${l}L${s+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${s+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return Vt("g",{className:"annotation-connector",children:a})}function Jt(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:a,note:s,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,v=Array.isArray(n)?n[0]??0:n,x=new Set(Array.isArray(f)?f:[]);let w=o||0,k=r||0;null!=i&&(w=i-b),null!=a&&(k=a-v);const S="string"==typeof u?u:"label";if("bracket"===S&&c&&0===w&&0===k)if(void 0!==c.width){w=c.width/2;const e=c.depth||30;k=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;w=e+(0>e?-5:5),k=c.height/2}return Zt("g",{className:("annotation "+(d||"")).trim(),transform:`translate(${b},${v})`,"data-testid":g,...null!=p&&{opacity:p},...m&&{strokeDasharray:m},...y,children:[!x.has("connector")&&Kt(w,k,l,h,S,c),!x.has("subject")&&Qt(S,c,h,b,v),!x.has("note")&&Xt(s,w,k,h)]})}function en(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 a=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:r});return Vt(Jt,{"data-testid":"semiotic-annotation",...a,type:o},"multi-annotation-"+i)});return Vt("g",{children:i})}const i=t.note||{title:"none",label:t.label},a=`${i.label}-${i.title}-${t.i}`;return Vt(Jt,{"data-testid":"semiotic-annotation",events:r,...t,type:o},a)}import{packEnclose as tn}from"d3-hierarchy";import{area as nn,curveLinear as on,curveMonotoneX as rn,curveMonotoneY as an,curveStep as sn,curveStepAfter as ln,curveStepBefore as cn,curveBasis as un,curveCardinal as hn,curveCatmullRom as dn}from"d3-shape";import fn from"regression";function pn(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 mn(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 yn(e){return null==e?null:e+""}function gn(e,t,n){return t.stickyPositionCache?.set(e,n),n}function bn(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 gn(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"],a=n[e.yAccessor||"y"];return null==i||null==a?null:{x:o(i),y:r(a)}}(n);return o?gn(t,n,o):null}if("semantic"===o){const o=function(e,t,n){const o=function(e){return yn(e.provenance?.stableId??e.stableId)}(e);if(!o)return null;const r=n.pointNodes?.find(e=>yn(e.pointId)===o);if(r)return gn(t,n,{x:r.x,y:r.y});const i=n.data?.find(e=>function(e){return yn(e.stableId??e.id??e.provenance?.stableId)}(e)===o);if(!i)return null;const a=pn(i,n),s=mn(i,n);return null==a||null==s?null:gn(t,n,{x:a,y:s})}(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=pn(e,n),i=mn(e,n)),null!=r&&null!=i)return gn(t,n,{x:r,y:i});if("sticky"===o){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function vn(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}import{jsx as xn}from"react/jsx-runtime";var wn={secondary:0,primary:3};function kn(e){return!0===e?._annotationDeferred}function Sn(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function Mn(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function An(e){return Math.max(.72,.95-.06*e)}import{jsx as Cn,jsxs as Ln}from"react/jsx-runtime";var jn={linear:on,monotoneX:rn,monotoneY:an,step:sn,stepAfter:ln,stepBefore:cn,basis:un,cardinal:hn,catmullRom:dn};var Pn=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function In(e){return!!e&&"object"==typeof e&&Pn.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function Dn(e){return"primary"===e?.emphasis||!0===e?.defensive}function zn(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 Rn(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 On=32,Tn=6,Nn=4,$n=8,Wn=72;var _n={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function En(e){if(!Bn(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 Bn(e){return In(e)}function Hn(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 Fn(e,t,n,o,r){const i=e+n,a=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?i-r.width-4:i+4,y:0>o?a-r.height:a,width:r.width,height:r.height}:{x:0>n?i-r.width:i,y:0>o?a-r.height-4:a+4,width:r.width,height:r.height}}function Gn(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function qn(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 Vn(e,t,n,o,r,i,a,s){const l=Gn(e,a);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,s);for(const e of n)c+=12*qn(l,e);for(const e of o)c+=4*qn(l,e);return c}function Zn(e){const{annotations:t,context:n,defaultOffset:o=On,notePadding:r=Tn,markPadding:i=Nn,edgePadding:a=$n,preserveManualOffsets:s=!0,routeLongConnectors:l=!0,connectorThreshold:c=Wn,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,v="object"==typeof p?p:{},x=v.breakpoint??480,w=!!p&&x>=g,k=w&&!1!==v.preferShortText?t.map(En):t,S=w&&!u?{maxAnnotations:v.maxAnnotations??("callout-list"===v.strategy?1:2),minVisible:v.minVisible??1}:u,M=h||w&&(!1!==v.progressiveDisclosure||"callout-list"===v.strategy),A=w&&!f?v.responsive??{minWidth:x}:f,C=w&&!m?v.cohesion:m;if(0===k.length||0>=g||0>=b)return k.slice();const L=[],j=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(n,i);let P=!1;const I=k.map((e,t)=>{if(!Bn(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?bn(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=[...Hn("string"==typeof e.title?e.title:void 0,t),...Hn("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(s&&("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 L.push(Gn(Fn(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=Vn(Fn(i.x,i.y,e.dx,e.dy,u),e,L,j,g,b,r,a);f>t&&(d=e,f=t)}if(!d)return e;const p=Gn(Fn(i.x,i.y,d.dx,d.dy,u),r);L.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 P=!0,{...e,dx:d.dx,dy:d.dy,...y?{connector:y}:{}}}),D=P?I:k.slice();let z=D;if(d){let e=!1;const t=D.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});z=e?t:D}{let e=!1;const t=z.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?_n[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});z=e?t:z}const R=new Set;if(S){const e="object"==typeof S?S:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const 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??zn(g,b,e))*t))},{deferred:o}=function(e){const{annotations:t,width:n,height:o}=e,r=Math.max(0,e.minVisible??1),i=zn(n,o,e),a=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,In(n))};var n}),s=a.filter(e=>e.note);if(0===s.length||i>=s.length)return{visible:t.slice(),deferred:[],budget:i};const l=s.filter(e=>Dn(e.annotation)),c=s.filter(e=>!Dn(e.annotation)).sort((e,t)=>Rn(t.annotation)-Rn(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 a)!n||h.has(t)?d.push(e):f.push(e);return{visible:d,deferred:f,budget:i}}({annotations:z,width:g,height:b,...n});for(const e of o)R.add(e)}if(A&&("object"==typeof A&&"number"==typeof A.minWidth?A.minWidth:480)>=g)for(const e of z)Bn(e)&&"secondary"===e.emphasis&&R.add(e);if(R.size>0)for(const e of z)!0===e?.defensive&&R.delete(e);let O;return O=0===R.size?z:M?z.map(e=>R.has(e)?{...e,_annotationDeferred:!0}:e):z.filter(e=>!R.has(e)),C?function(e,t){let n=!1;const o=e.map(e=>Bn(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?o:e}(O,C):O}import{useSyncExternalStore as Un}from"react";var Yn={positions:new Map},Xn=new Set;function Qn(){for(const e of Xn)e()}function Kn(e,t){const n=Yn.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Yn.positions);o.delete(e),Yn={positions:o},Qn()}function Jn(e,t){const n=Yn.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const o=new Map(Yn.positions);o.delete(e),Yn={positions:o},Qn()}function eo(){return Yn}function to(e){return Xn.add(e),()=>Xn.delete(e)}var no={positions:new Map};function oo(){return()=>{}}function ro(){return no}function io(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,a=o instanceof Date?o.getTime():o,s=r instanceof Date?r.getTime():r;if(2>t||a===s)return i?[new Date(a),new Date(s)]:[a,s];const l=(s-a)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?s:a+e*l;c[e]=i?new Date(n):n}return c}(e,t):e.ticks(t)}import{Fragment as ao,jsx as so,jsxs as lo}from"react/jsx-runtime";function co(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function uo(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function ho(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 fo(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function po(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 a="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);a+=`L${Math.min(8*e+4,t)},${o+4*r}`,a+=`L${Math.min(n,t)},${o}`}return a}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let a=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);a+=`L${o+4*r},${Math.min(8*e+4,n)}`,a+=`L${o},${Math.min(t,n)}`}return a}}function mo(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function yo(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 go(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:a,showAxes:s,axes:l,xLabel:c,yLabel:u,yLabelRight:h,xFormat:d,yFormat:f,axisExtent:p,showGrid:m,title:y,legend:g,legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:x,legendIsolatedCategories:w,legendPosition:k="right",legendLayout:S,foregroundGraphics:M,marginalGraphics:A,xValues:C,yValues:L,annotations:j,autoPlaceAnnotations:P,svgAnnotationRules:I,xAccessor:D,yAccessor:z,annotationData:R,pointNodes:O,curve:T,underlayRendered:N,canvasObscuresUnderlay:$=!0,linkedCrosshairName:W,linkedCrosshairSourceId:_,children:E}=e,B=St(()=>{if(!s||!a)return[];const e=l?.find(e=>"bottom"===e.orient),n=e?.tickFormat||d||mo,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??io(a.x,i,p),u=c.map(e=>e.valueOf()),h=c.map((e,t)=>({value:e,pixel:a.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=yo(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=a.x.domain()[1],t=a.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},[s,a,l,d,t,p]),H=St(()=>{if(!s||!a)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||f||mo,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=yo((e?.tickValues??io(a.y,i,p)).map(e=>({value:e,pixel:a.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=a.y.domain()[1],n=a.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},[s,a,l,f,n,p]),F=St(()=>{if(!s||!a)return[];const e=l?.find(e=>"right"===e.orient);if(!e)return[];const t=e.tickFormat||f||mo,o=Math.max(2,Math.floor(n/30)),r=e.ticks??5;return yo((e.tickValues??io(a.y,"exact"===p?Math.max(2,r):Math.min(r,o),p)).map(e=>({value:e,pixel:a.y(e),label:t(e)})),22)},[s,a,l,f,n,p]),G=Mt(new Map),q=Mt(j?.length??0),V=j?.length??0;q.current!==V&&(q.current=V,G.current=new Map);const Z=St(()=>{if(!j||0===j.length)return null;const e=function(e,t,n){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const o=bn(e,t,n);if(!o)return null;const{x:r,y:i}=o;if(!vn(r,i,n))return null;const a="callout"===e.type?"callout-circle":e.type,s="callout-circle"===a?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===a?{width:e.width,height:e.height}:void 0;return Cn(en,{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:a,...s?{subject:s}:{},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=pn(null!=e.value?{...e,x:e.value}:e,n);if(null==o)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let a;a="bottom"===i?(n.height||0)-4:"center"===i?(n.height||0)/2:12;const s=o>.6*(n.width||0),l=s?o-4:o+4,c=s?"end":"start";return Ln("g",{opacity:e.opacity,children:[Cn("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&&Cn("text",{x:l,y:a,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=mn(null!=e.value?{...e,y:e.value}:e,n);if(null==o)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let a,s;return"left"===i?(a=4,s="start"):"center"===i?(a=(n.width||0)/2,s="middle"):(a=(n.width||0)-4,s="end"),Ln("g",{opacity:e.opacity,children:[Cn("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&&Cn("text",{x:a,y:o-4,textAnchor:s,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:pn({...e,type:"point"},n),y:mn({...e,type:"point"},n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const r=tn(o),i=e.padding||10;return Ln("g",{children:[Cn("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&&Cn("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:pn({...e,type:"point"},n),y:mn({...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),a=o.map(e=>e.y),[s,l]=ce(i),[c,u]=ce(a),h=s-r,d=l+r,f=c-r;return Ln("g",{children:[Cn("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&&Cn("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 Cn("g",{children:r.map((t,o)=>{const r=pn(t,n),a=mn(t,n);if(null==r||null==a)return null;const s="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return Cn("circle",{cx:r,cy:a,r:s,...l},"hl-"+o)})},"ann-"+t)}case"bracket":{const o=pn(e,n),r=mn(e,n);return Cn(en,{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",a="ordinal"===n.frameType,s="horizontal"===n.projection,l=a?r:null,c=a?i:null;let u;const h=[],d=new Map;if(a&&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(a)if(s){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 v=e.method||"linear";let x;x="loess"===v?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];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(a-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){s.push([t,i[e]]);continue}const m=u*f-h*h;if(1e-12>Math.abs(m))s.push([t,d/u]);else{const e=(u*p-h*d)/m;s.push([t,(d-e*h)/u+e*t])}}return s}(u,e.bandwidth??.3):("polynomial"===v?fn.polynomial(u,{order:e.order||2}):fn.linear(u)).points;const w=x.map(([e,t])=>{const[n,o]=b(e,t);return`${n},${o}`}).join(" "),k=e.color||"#6366f1",S=x[x.length-1],[M,A]=b(S[0],S[1]);return Ln("g",{children:[Cn("polyline",{points:w,fill:"none",stroke:k,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&Cn("text",{x:M+4,y:A-4,fill:k,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 Ln("g",{opacity:e.opacity,children:[Cn("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&&Cn("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:Ln("g",{opacity:e.opacity,children:[Cn("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&&Cn("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,a=n.scales?.y??n.scales?.value;if(!i||!a)return null;const s=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=o.filter(e=>null!=e[s]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[r]-t[r]);if(2>u.length)return null;const h=jn[n.curve||"linear"]||on,d=nn().x(e=>i(e[r])).y0(e=>a(e[l])).y1(e=>a(e[s])).curve(h)(u);if(!d)return null;const f=e.fill||"#6366f1";return Ln("g",{children:[Cn("path",{d:d,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&Cn("text",{x:i(u[u.length-1][r])+4,y:a(u[u.length-1][s])-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,a=n.scales?.y??n.scales?.value;if(!i||!a)return null;const s=o.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>s.length)return null;const l=s.reduce((e,t)=>e+t,0)/s.length,c=s.reduce((e,t)=>e+(t-l)**2,0)/s.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=a(l+h*u),v=a(d),x=o.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>h*u});return Ln("g",{children:[f&&Cn("rect",{x:0,y:Math.min(b,v),width:n.width||0,height:Math.abs(v-b),fill:p,fillOpacity:m}),x.map((e,t)=>{const o=pn(e,n),r=mn(e,n);return null==o||null==r?null:Cn("circle",{cx:o,cy:r,r:g,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+t)}),e.label&&Cn("text",{x:(n.width||0)-4,y:Math.min(b,v)-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",a=n.scales?.x??n.scales?.time,s=n.scales?.y??n.scales?.value;if(!a||!s)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=fn.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 a=(e*r-t*n)/i,s=(n-a*t)/e;c=e=>s+a*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],v=(b-l[0][0])/Math.max(u-1,1),x=[];for(let e=1;g>=e;e++)x.push(b+e*v);const w=[];for(const e of x){const t=c(e),n=d*Math.sqrt(1+1/u+(p>0?(e-f)**2/p:0))*y;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const k=`M${w.map(e=>`${a(e.x)},${s(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${a(e.x)},${s(e.yLower)}`).join(" L")} Z`,S=w.map(e=>`${a(e.x)},${s(e.yCenter)}`).join(" "),M=`${a(b)},${s(c(b))}`,A=e.strokeColor||"#6366f1";return Ln("g",{children:[Cn("path",{d:k,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),Cn("polyline",{points:`${M} ${S}`,fill:"none",stroke:A,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&w.length>0&&Cn("text",{x:a(w[w.length-1].x)+4,y:s(w[w.length-1].yCenter)-4,fill:A,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=bn(e,t,n);if(!i)return null;o=i.x,r=i.y}if(!vn(o,r,n))return null;const i=e.width??32,a=e.height??32;return Cn("foreignObject",{x:o+(e.dx??0)-i/2,y:r+(e.dy??0)-a/2,width:i,height:a,style:{overflow:"visible",pointerEvents:"auto"},children:Cn("div",{style:{width:i,height:a,display:"flex",alignItems:"center",justifyContent:"center"},children:e.content??Cn("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"})})},"ann-"+t)}case"text":{const o=bn(e,t,n);if(!o)return null;const{x:r,y:i}=o,a=r+(e.dx||0),s=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=Cn("text",{x:a,y:s,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?qt.cloneElement(c,{key:"ann-text-"+t}):Ln("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[Cn("line",{x1:r,y1:i,x2:a,y2:s,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),qt.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,a=n.scales?.x,s=n.scales?.y,l=r(i)?i:r(a)?a:r(s)?s: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 Ln("g",(n.projection?"vertical"===n.projection:l===a)?{children:[Cn("rect",{x:c,y:0,width:u,height:n.height||0,fill:h,fillOpacity:d}),f&&Cn("text",{x:c+u/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]}:{children:[Cn("rect",{x:0,y:c,width:n.width||0,height:u,fill:h,fillOpacity:d}),f&&Cn("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+t)}default:return null}},o={scales:a?{x:a.x,y:a.y,time:a.x,value:a.y}:null,timeAxis:"x",xAccessor:D,yAccessor:z,width:t,height:n,data:R,frameType:"xy",pointNodes:O,curve:T,stickyPositionCache:G.current};return function(e,t,n,o){const r=[];return e.forEach((e,i)=>{let a;if(n){const r=n(e,i,o);a=null!=r?r:t(e,i,o)}else a=t(e,i,o);a&&r.push({node:a,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:Mn(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),o=e.some(e=>kn(e.annotation)),r=e.some(e=>null!=Sn(e.annotation)),i=e.some(e=>"layer"===Sn(e.annotation));if(!n&&!o&&!r)return e.map(e=>e.node);const a=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);a.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,a.length)});for(const e of t)e.emphasis&&(e.rank=wn[e.emphasis]);const s=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=kn(t.annotation);let a=t.node;if("primary"===o||"secondary"===o||null!=r){const e=null==o&&null!=r;a=xn("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+o,..."secondary"===o?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:An(r),"data-annotation-reading-order":r}:{},children:t.node},"annotation-emphasis-"+n)}const s=Sn(t.annotation);return s&&(a=xn("g",{className:"annotation-cohesion--"+s,children:a},"annotation-cohesion-"+n)),i&&(a=xn("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},"annotation-deferred-"+n)),a});return o&&s.unshift(xn("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&&s.unshift(xn("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")),s}(r)}(P?Zn({annotations:j,context:o,..."object"==typeof P?P:{}}):j,e,I,o)},[j,P,I,t,n,D,z,R,a,O,T]),U=function(e){const t=Un(e?to:oo,e?eo:ro,e?eo:ro);return e?t.positions.get(e)??null:null}(W);return At(()=>{if(!U?.locked||!W)return;const e=e=>{"Escape"===e.key&&Jn(W)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[U?.locked,W]),s||y||g||M||A||Z&&Z.length>0||m||E||U?lo("svg",{role:"img",width:o,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[so("title",{children:"string"==typeof y?y:"XY Chart"}),so("desc",{children:"string"==typeof y?y+" — XY data visualization":"XY data visualization"}),lo("g",{transform:`translate(${i.left},${i.top})`,children:[m&&a&&(!N||$)&&(()=>{const e=fo(l?.find(e=>"bottom"===e.orient)?.gridStyle),o=fo(l?.find(e=>"left"===e.orient)?.gridStyle);return lo("g",{className:"stream-grid",children:[B.map((t,o)=>so("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)=>so("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+n))]})})(),s&&a&&(()=>{const e=l?.find(e=>"left"===e.orient),o=l?.find(e=>"bottom"===e.orient),r=!e||!1!==e.baseline,a=!o||!1!==o.baseline,s=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})(),v=b?12:18,x=n+(b?58:40),w={fontSize:"var(--semiotic-tick-font-size, 12px)"},k={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},S={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},M=o?.tickAnchor,A=e?.tickAnchor,C=ho(B),L=ho(H);return lo("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[lo("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!N||$)&&a&&!d&&so("line",{x1:0,y1:n,x2:t,y2:n,stroke:m,strokeWidth:1}),(!N||$)&&d&&so("path",{d:po("bottom",t,n),fill:"none",stroke:m,strokeWidth:1}),B.map((e,t)=>{const o=!!f&&("function"==typeof f?f(e.value,t):ye(e.value,t>0?B[t-1].value:void 0));return lo("g",{transform:`translate(${e.pixel},${n})`,children:[so("line",{y2:5,stroke:m,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?so("text",{y:v,textAnchor:b?"end":co(M,e.pixel===C.min,e.pixel===C.max),fontWeight:o?600:400,fill:y,className:"semiotic-axis-tick",style:{userSelect:"none",...o?k:w},transform:b?"rotate(-45)":void 0,children:e.label}):so("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:so("div",{style:{textAlign:"center",userSelect:"none",...w},children:e.label})})]},"xtick-"+t)}),c&&so("text",{x:t/2,y:x,textAnchor:"middle",fill:g,className:"semiotic-axis-label",style:{userSelect:"none",...S},children:c})]}),lo("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!N||$)&&r&&!s&&so("line",{x1:0,y1:0,x2:0,y2:n,stroke:m,strokeWidth:1}),(!N||$)&&s&&so("path",{d:po("left",t,n),fill:"none",stroke:m,strokeWidth:1}),H.map((e,t)=>{const n=!!p&&("function"==typeof p?p(e.value,t):ye(e.value,t>0?H[t-1].value:void 0));return lo("g",{transform:`translate(0,${e.pixel})`,children:[so("line",{x2:-5,stroke:m,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?so("text",{x:-8,textAnchor:"end",dominantBaseline:uo(A,e.pixel===L.min,e.pixel===L.max),fontWeight:n?600:400,fill:y,className:"semiotic-axis-tick",style:{userSelect:"none",...n?k:w},children:e.label}):so("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:so("div",{style:{textAlign:"right",userSelect:"none",...w},children:e.label})})]},"ytick-"+t)}),(()=>{const t=e?.label||u;return t?so("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",...S},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,a=e.label||h,s=e.tickAnchor,c=ho(F);return lo("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&so("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):ye(e.value,n>0?F[n-1].value:void 0));return lo("g",{transform:`translate(${t},${e.pixel})`,children:[so("line",{x2:5,stroke:m,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?so("text",{x:8,textAnchor:"start",dominantBaseline:uo(s,e.pixel===c.min,e.pixel===c.max),fontWeight:o?600:400,fill:y,className:"semiotic-axis-tick",style:{userSelect:"none",...o?k:w},children:e.label}):so("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:so("div",{style:{textAlign:"left",userSelect:"none",...w},children:e.label})})]},"ytick-r-"+n)}),a&&so("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",...S},children:a})]})})()]})})(),Z,A&&a&&C&&L&&lo(ao,{children:[A.top&&so("g",{transform:"translate(0, 0)",children:so(Gt,{orient:"top",config:Ft(A.top),values:C,scale:a.x,size:i.top,length:t})}),A.bottom&&so("g",{transform:`translate(0, ${n})`,children:so(Gt,{orient:"bottom",config:Ft(A.bottom),values:C,scale:a.x,size:i.bottom,length:t})}),A.left&&so("g",{transform:"translate(0, 0)",children:so(Gt,{orient:"left",config:Ft(A.left),values:L,scale:a.y,size:i.left,length:n})}),A.right&&so("g",{transform:`translate(${t}, 0)`,children:so(Gt,{orient:"right",config:Ft(A.right),values:L,scale:a.y,size:i.right,length:n})})]}),M,U&&U.sourceId!==_&&a?.x&&(()=>{const e=a.x(U.xValue);if(null==e||0>e||e>t)return null;const o=U.locked;return so("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"})})(),E]}),y&&so("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}),Wt({legend:g,totalWidth:o,totalHeight:r,margin:i,legendPosition:k,title:y,legendLayout:S,legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:x,legendIsolatedCategories:w})]}):null}import*as bo from"react";import{arc as vo}from"d3-shape";import{jsx as xo,jsxs as wo}from"react/jsx-runtime";function ko(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}var So="undefined"==typeof window||"undefined"==typeof document;import{useEffect as Mo,useLayoutEffect as Ao,useRef as Co,useState as Lo,useSyncExternalStore as jo}from"react";var Po="undefined"!=typeof window?Ao:Mo,Io=()=>()=>{},Do=()=>!1,zo=()=>!0;import{useRef as Ro}from"react";function Oo(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 To(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 No(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}import*as $o from"react";import*as Wo from"react";import{jsx as _o}from"react/jsx-runtime";var Eo=Wo.createContext(null);function Bo(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 Ho(e){return e&&"object"==typeof e?e:{}}function Fo(e){return Ho(e.accessibility).tableFields??e.accessibleDatum??e.datum}import{jsx as Go,jsxs as qo}from"react/jsx-runtime";var Vo={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Zo(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"],a=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 a)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}var Uo=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Yo="semiotic-accessible-data-table",Xo=Yo+" semiotic-accessible-data-table-hidden",Qo=Yo+" semiotic-accessible-data-table-visible",Ko={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"},Jo={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},er={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)"},tr={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},nr={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))"},or={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},rr={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},ir={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 ar({scene:e,chartType:t,tableId:n,chartTitle:o}){const[r,i]=$o.useState(!1),[a,s]=$o.useState(5),l=Wo.useContext(Eo),c=l?.visible??!1,u=r||c,h=$o.useRef(null),d=o?"Data summary for "+o:n?`Data summary for ${t} ${n}`:"Data summary for "+t;$o.useEffect(()=>{u||s(5)},[u]);const f=$o.useCallback(e=>{e.target===e.currentTarget&&(r||c||i(!0))},[r,c]),p=$o.useCallback(e=>{c||h.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return n?Go("span",{id:n,tabIndex:-1,style:Vo}):null;if(!u)return Go("div",{id:n,className:Xo,tabIndex:-1,onFocus:f,style:Vo,role:"region","aria-label":d,children:qo("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:Bo(Fo(o))});break;case"line":case"area":{const e=Fo(o),n=Array.isArray(e)?e:[],r="line"===o.type?"Line point":"Area point";for(const e of n)t.push({label:r,values:Bo(e)});break}case"rect":{const e=Fo(o),n=null!=e&&"object"==typeof e?e:{},r=n.category??o.group??"",i=n.value??n.__aggregateValue??n.total,a=Bo(n);null==a.category&&""!==r&&(a.category=r+""),null==a.value&&null!=i&&(a.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:a});break}case"heatcell":{const e=Bo(Fo(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=Fo(o),n=Bo(e);if(null==n.category){const t=Ho(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:Bo(Fo(o))});break;case"arc":t.push({label:"Arc",values:Bo(Fo(o))});break;case"candlestick":t.push({label:"Candlestick",values:Bo(Fo(o))});break;case"geoarea":{const e=Ho(Fo(o)),n=Bo(e);if(null==n.name){const t=Ho(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}: ${Uo(e.min)} to ${Uo(e.max)}, mean ${Uo(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(a,m.length),v=m.slice(0,b),x=m.length-b,w=new Set;for(const e of v)for(const t of Object.keys(e.values))w.add(t);const k=Array.from(w);return qo("div",{ref:h,id:n,className:Qo,tabIndex:-1,onBlur:p,style:Ko,role:"region","aria-label":d,children:[Go("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:er,children:"×"}),Go("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Jo,children:g}),qo("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:tr,children:[Go("caption",{className:"semiotic-accessible-data-table-caption",style:rr,children:x>0?`First ${b} of ${m.length} data points`:`All ${m.length} data points`}),Go("thead",{children:qo("tr",{children:[Go("th",{style:nr,children:"type"}),k.map(e=>Go("th",{style:nr,children:e},e))]})}),Go("tbody",{children:v.map((e,t)=>qo("tr",{children:[Go("td",{style:or,children:e.label}),k.map(t=>{return Go("td",{style:or,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":Uo(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),x>0&&qo("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>s(e=>e+25),style:ir,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function sr({summary:e}){return e?Go("div",{role:"note",style:Vo,children:e}):null}function lr({tableId:e}){return Go("a",{href:"#"+e,style:Vo,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,Vo)},children:"Skip to data table"})}function cr({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 Go("div",{"aria-live":"polite","aria-atomic":"true",style:Vo,children:t})}var ur=Object.freeze([]);function hr(e){if(!e)return ur;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}import{jsx as dr}from"react/jsx-runtime";var fr="var(--semiotic-focus, #005fcc)";function pr({active:e,hoverPoint:t,margin:n,size:o,shape:r="circle",width:i,height:a,pathData:s}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==r&&"path"!==r||!s)if("rect"===r&&null!=i&&null!=a){const e=Math.max(i,4),t=Math.max(a,4);u=dr("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:fr,strokeWidth:2,strokeDasharray:"4,2"})}else u=dr("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:fr,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:fr,strokeWidth:2,strokeDasharray:"4,2"});else u=dr("g",{transform:`translate(${n.left},${n.top})`,children:dr("path",{d:s,fill:"none",stroke:fr,strokeWidth:2.5,strokeDasharray:"6,3"})});return dr("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}import*as mr from"react";function yr(e,t){return"touch"===t?Math.max(e,24):e}var gr=["name","label","title"],br=["type","kind","category","group","class","status","role","shape"],vr=["value","amount","total","count","weight","score"],xr=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 wr(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}import{jsx as kr,jsxs as Sr}from"react/jsx-runtime";var Mr={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 Ar(e,t){return"function"==typeof t?t(e):e[t]}function Cr(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 Lr(e={}){const{fields:t,title:n,format:o,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let a;const s=[];if(n){const t=Ar(e,n);a=Cr(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 a=Ar(e,r);s.push({label:n,value:Cr(a,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){a=Cr(e[n],o);break}if(!a){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(a=Cr(e[t[0]],o))}}const l={...Mr,...r};return Sr("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[a&&kr("div",{style:{fontWeight:s.length>0?"bold":"normal"},children:a}),s.map((e,t)=>Sr("div",{style:{marginTop:0===t&&a?"4px":0},children:[e.label&&Sr("span",{children:[e.label,": "]}),e.value]},t))]})}}function jr(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:kr("div",{className:"semiotic-tooltip",style:Mr,children:r})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Lr(e):Lr())}}import{jsx as Pr}from"react/jsx-runtime";function Ir({x:e,y:t,containerWidth:n,containerHeight:o,margin:r,children:i,className:a="stream-frame-tooltip",zIndex:s=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=mr.useRef(null),[u,h]=mr.useState(null);mr.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,a,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(!mr.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:Mr;return l?Pr("div",{ref:c,className:f?a:(a+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:r.left+e,top:r.top+t,transform:d,pointerEvents:"none",zIndex:s,width:"max-content"},children:i}):null}import{zoom as Dr,zoomIdentity as zr}from"d3-zoom";import{select as Rr}from"d3-selection";function Or(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Tr(e,t,n=.6){if(!Or(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 Nr(e,t,n,o=.35){Or(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}import{line as $r}from"d3-shape";import{curveMonotoneX as Wr,curveMonotoneY as _r,curveCardinal as Er,curveCatmullRom as Br,curveStep as Hr,curveStepBefore as Fr,curveStepAfter as Gr,curveBasis as qr,curveNatural as Vr}from"d3-shape";function Zr(e){switch(e){case"monotoneX":return Wr;case"monotoneY":return _r;case"cardinal":return Er;case"catmullRom":return Br;case"step":return Hr;case"stepBefore":return Fr;case"stepAfter":return Gr;case"basis":return qr;case"natural":return Vr;default:return null}}function Ur(e,t,n){return null==t?n:"string"!=typeof t?t:ut(e,t)||n}function Yr(e,t,n,o,r,i){const a=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>a.length)return null;const s=e.createLinearGradient(n,o,r,i);for(const e of a)s.addColorStop(e.offset,e.color);return s}function Xr(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 Qr(e,t,n,o,r,i){if(2>t.length)return;const a=[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];a.push(a[e-1]+Math.sqrt(n*n+o*o))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(a[n]+a[n+1])/2;let i=r;l>o&&(i*=o/l),l>s-o&&(i*=(s-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 Kr(e,t,n,o,r){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const a=ve(i,t.size);if(0>=a.scale)return;const s=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=s)return;const l=t=>{const n=Ur(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(a.offsetX,a.offsetY),e.scale(a.scale,a.scale),e.globalAlpha=r*s*(t.style.fillOpacity??1);const u=Me(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&Ce(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),Ce(e,i,c,t.accent,void 0,l),e.restore()}function Jr(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=Math.round(t[0]*o),a=Math.round(t[1]*o),s=i/t[0],l=a/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===a||(e.width=i,e.height=a),r.setTransform(s,0,0,l,0,0),r.translate(n.left,n.top),r}function ei(){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 ti([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t,n]}function ni(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 oi=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 ri=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 a=n[i.lineIndex];if(!a||2>a.length){i.active=!1;continue}if(i.t+=e*t,i.t>=1){i.active=!1;continue}const s=ii(a),l=ai(a,i.t*s),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 ii(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 ai(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],a=Math.sqrt(r*r+i*i);if(n+a>=t||o===e.length-1){const s=a>0?(t-n)/a:0,l=a>.001?a:1;return{x:e[o-1][0]+r*s,y:e[o-1][1]+i*s,nx:-i/l,ny:r/l}}n+=a}const o=e[e.length-1];return{x:o[0],y:o[1],nx:0,ny:0}}import*as si from"react";function li(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:si.createElement(si.Fragment,null,...t)}import*as ci from"react";import{jsx as ui}from"react/jsx-runtime";var hi=ci.createContext(null);function di({value:e,children:t}){return ui(hi.Provider,{value:e,children:t})}function fi(e,t){return null!=e?ui(di,{value:t,children:e}):e}function pi(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=Ae(e.glyph,e.size);t.push({pointId:e.pointId,x:e.x+o.centerDx,y:e.y+o.centerDy,r:o.radius})}return t}import{jsx as mi,jsxs as yi}from"react/jsx-runtime";import{jsx as gi,jsxs as bi}from"react/jsx-runtime";function vi({data:e}){if(!e)return null;if(e.properties)return gi("div",{className:"semiotic-tooltip",style:Mr,children:gi("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&&xr.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=>gr.includes(e.lower));const a=i>=0;0>i&&(i=r.findIndex(e=>"id"===e.lower)),0>i&&(i=r.findIndex(e=>"string"==typeof e.value));const s=0>i?void 0:r[i];let l=r.filter((e,t)=>t!==i);a&&(l=l.filter(e=>"id"!==e.lower));const c=wr(l,br),u=wr(l,vr),h=new Set(br),d=new Set(vr),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:s?.key,title:s?.value,entries:f}}(t),o=null!=n.title?n.title+"":null;return null==o&&0===n.entries.length?null:bi("div",{className:"semiotic-tooltip",style:Mr,children:[null!=o&&gi("div",{style:{fontWeight:600,marginBottom:n.entries.length?2:0},children:o}),n.entries.map(e=>{return bi("div",{children:[bi("span",{style:{opacity:.7},children:[e.key,": "]}),gi("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})]})}vi.ownsChrome=!0;var xi={top:10,right:10,bottom:10,left:10},wi=null;function ki(){if(null!==wi)return wi;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 wi=e||t||n}function Si(){return ki()?12:30}var Mi={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 Ai(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function Ci(e){return e?e.getContext("2d"):null}import{jsx as Li,jsxs as ji}from"react/jsx-runtime";var Pi=s(a(function(a,s){const{projection:l,projectionExtent:c,fitPadding:u,projectionTransform:h,areas:d,points:f,lines:p,customLayout:m,layoutConfig:y,layoutSelection:g,onLayoutError:b,xAccessor:v,yAccessor:x,lineDataAccessor:w,pointIdAccessor:k,lineIdAccessor:S,lineType:M="geo",flowStyle:A="basic",graticule:C,zoomable:L,zoomExtent:j,onZoom:P,dragRotate:I,showParticles:D,particleStyle:z,tileURL:R,tileAttribution:O,tileCacheSize:T,size:N,width:$,height:W,responsiveWidth:_,responsiveHeight:E,margin:B,className:H,background:F,areaStyle:G,pointStyle:q,lineStyle:V,colorScheme:Z,enableHover:U=!0,hoverAnnotation:Y,tooltipContent:X,allowTooltipOverflow:Q=!1,customClickBehavior:K,customHoverBehavior:J,annotations:ee,autoPlaceAnnotations:te,decay:ne,pulse:oe,transition:re,animate:ie,staleness:ae,backgroundGraphics:se,foregroundGraphics:le,title:ce,legend:ue,legendPosition:he,legendLayout:de,legendHoverBehavior:pe,legendClickBehavior:me,legendHighlightedCategory:ye,legendIsolatedCategories:ge,legendCategoryAccessor:be,onCategoriesChange:xe,showAxes:ke,accessibleTable:Se=!0,description:Ce,summary:je}=a,Pe=N||[$||600,W||400],Ie=e(!0),De=pt({sizeProp:Pe,responsiveWidth:_,responsiveHeight:E,userMargin:B,marginDefault:xi,foregroundGraphics:le,backgroundGraphics:se,animate:ie,transitionProp:re,themeDirtyRef:Ie}),{reducedMotionRef:ze,responsiveRef:Re,size:Oe,margin:Te,adjustedWidth:Ne,adjustedHeight:$e,resolvedForeground:We,resolvedBackground:_e,transition:Ee,introEnabled:Be,tableId:He,rafRef:Fe,renderFnRef:qe,scheduleRender:Ve,cancelRender:Ze,currentTheme:Ue}=De,Ye=function(){const[e,t]=Lo(!1);return Po(()=>{t(!0)},[]),e}(),Xe=function(){const e=jo(Io,Do,zo);return Co(e).current}(),Qe=o(()=>Array.isArray(d)?hr(d):d,[d]),Ke=o(()=>hr(f),[f]),Je=o(()=>hr(p),[p]),et=o(()=>null!=I?I:"orthographic"===Ai(l),[I,l]),tt=function(e){const t=Ro(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return To(e,t);if(!No(e)||!No(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(!To(n,r))return!1}else{if(!No(n)||!No(r))return!1;if(!Oo(n,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}(o(()=>({projection:l,projectionExtent:c,fitPadding:u,xAccessor:v,yAccessor:x,lineDataAccessor:w,lineType:M,flowStyle:A,areaStyle:G,pointStyle:q,lineStyle:V,colorScheme:Z,themeSemantic:Ge(Ue),themeSequential:Ue?.colors?.sequential,themeDiverging:Ue?.colors?.diverging,themeCategorical:Ue?.colors?.categorical,graticule:C,projectionTransform:h,decay:ne,pulse:oe,transition:Ee,introAnimation:Be,annotations:ee,pointIdAccessor:k,lineIdAccessor:S,customLayout:m,layoutConfig:y,onLayoutError:b,layoutMargin:Te}),[l,c,u,v,x,w,M,A,G,q,V,Z,C,h,ne,oe,Ee?.duration,Ee?.easing,Be,ee,k,S,Ue,m,y,b,Te])),nt=e(null);nt.current||(nt.current=new fe(tt));const ot=e(null),rt=e(null),it=e(null),at=e(null),st=e(null);R&&!st.current&&(st.current=new oi(T||256));const lt=e(ee),ct=e(null),ht=e(zr),dt=e(!1),ft=e(null),wt=r(e=>{ft.current=e,Re&&"object"==typeof Re&&(Re.current=e)},[Re]),St=e(null),Mt=e(null),At=e(null),Ct=e(0);if(D&&!At.current){const e=z?.maxPerLine??Si();At.current=new ri(50*e)}const Lt=e(null),jt=e(null),Pt=e(!1),It=e(void 0),[Dt,zt]=t(null),[Rt,Ot]=t(0),Tt=e(0),[Nt,$t]=t(!1),Wt=e([]),_t=e(be),Et=e(xe);_t.current=be,Et.current=xe;const Bt=r(()=>{const e=_t.current,t=Et.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}(nt.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,Wt.current)||(Wt.current=n,t(n))},[]);!function(e,t,n,o){mt(()=>{e.current?.updateConfig(t),n.current=!0,o()},[t,o,e,n])}(nt,tt,Ie,Ve),function(e,t,n,o){const r=yt(null);mt(()=>{const i=e.current;if(!i)return;const a=t??null;r.current!==a&&(r.current=a,i.setLayoutSelection(a),i.hasCustomRestyle?i.restyleScene(a):n.current=!0,o())},[t,o,e,n])}(nt,g,Ie,Ve),n(()=>{const e=nt.current;e&&(Qe&&e.setAreas(Qe),f&&e.setPoints(Ke),p&&e.setLines(Je),Ie.current=!0,Ve())},[Qe,f,Ke,p,Je,Ve]);const Ht=r(e=>{null!=e&&"object"==typeof e&&(nt.current?.pushPoint(e),Ie.current=!0,Ve())},[Ve]),Ft=r(e=>{const t=hr(e);0!==t.length&&(nt.current?.pushMany(t),Ie.current=!0,Ve())},[Ve]),Gt=r(e=>{null!=e&&"object"==typeof e&&(nt.current?.pushLine(e),Ie.current=!0,Ve())},[Ve]),qt=r(e=>{const t=hr(e);0!==t.length&&(nt.current?.pushManyLines(t),Ie.current=!0,Ve())},[Ve]),Vt=r(()=>{nt.current?.clear(),Ie.current=!0,Ve()},[Ve]);i(s,()=>({push:Ht,pushMany:Ft,removePoint:e=>{const t=nt.current?.removePoint(e)??[];return t.length>0&&(Ie.current=!0,Ve()),t},pushLine:Gt,pushManyLines:qt,removeLine:e=>{const t=nt.current?.removeLine(e)??[];return t.length>0&&(Ie.current=!0,Ve()),t},getLines:()=>nt.current?.getLines()??[],clear:Vt,getProjection:()=>nt.current?.scales?.projection??null,getGeoPath:()=>nt.current?.scales?.geoPath??null,getCartogramLayout:()=>nt.current?.cartogramLayout??null,getCustomLayout:()=>nt.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>nt.current?.lastCustomLayoutFailure??null,getZoom:()=>ht.current.k,resetZoom:()=>{const e=ft.current;e&&ct.current&&Rr(e).call(ct.current.transform,zr)},getData:()=>nt.current?.getPoints()??[]}),[Ht,Ft,Gt,qt,Vt,Ve]);const{hoverHandlerRef:Zt,onPointerMove:Ut,onPointerLeave:Yt}=De;n(()=>{Zt.current=e=>{if(!U)return;const t=nt.current;if(!t||!t.scene.length)return;const n=rt.current;if(!n)return;const o=n.getBoundingClientRect(),r=e.clientX-o.left-Te.left,i=e.clientY-o.top-Te.top;if(0>r||r>Ne||0>i||i>$e)return Lt.current=null,jt.current=null,zt(null),J?.(null),void Ve();at.current||(at.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const a=Ci(at.current);if(!a)return;const s=yr(30,e.pointerType),l=yr(6,e.pointerType),c=Le(t.scene,r,i,s,a,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,a;"point"===e.type?(o=e.x,a=e.y):"geoarea"===e.type?(o=e.centroid[0],a=e.centroid[1]):(o=r,a=i);const s={...n,...n?.properties||{},data:n,properties:n?.properties,__semioticHoverData:!0,x:o,y:a};Lt.current=s,jt.current=e,zt(s),J?.(s),Ve()}else Lt.current&&(Lt.current=null,jt.current=null,zt(null),J?.(null),Ve())}},[U,Ne,$e,Te,J,Ve]),De.hoverLeaveRef.current=()=>{Lt.current=null,jt.current=null,zt(null),J?.(null),Ve()};const Xt=r(e=>{if(!K)return;const t=nt.current;if(!t||!t.scene.length)return void K(null);const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-Te.left,r=e.clientY-n.top-Te.top;if(0>o||o>Ne||0>r||r>$e)return void K(null);at.current||(at.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const i=Ci(at.current);if(!i)return void K(null);const a=yr(30,It.current),s=yr(6,It.current),l=Le(t.scene,o,r,a,i,t.quadtree,t.maxPointRadius,s);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 K({...n,data:t,properties:t?.properties,__semioticHoverData:!0,x:o,y:r,time:o,value:r})}K(null)},[$e,Ne,K,Te]),Qt=e(-1),Kt=e(null),Jt=r(e=>{const t=nt.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=Ae(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,Kt.current=null,Lt.current=null,jt.current=null,zt(null),J?.(null),void Ve();const i=0>o?0:r;Qt.current=i;const a=n[i];Kt.current={shape:a.shape,w:a.w,h:a.h,pathData:a.pathData};const s=a.datum,l={...s||{},...s?.properties||{},data:s,properties:s?.properties,x:a.x,y:a.y,__semioticHoverData:!0};Lt.current=l,zt(l),J?.(l),Ve()},[J,Ve]),en=r(e=>{It.current=e.pointerType,Qt.current=-1,Kt.current=null,Ut(e)},[Ut]),tn=r(e=>{It.current=e.pointerType},[]);qe.current=()=>{Fe.current=null;const e=rt.current,t=nt.current;if(!e||!t)return;const n=performance.now();let o=!1;const r=Mt.current;let i=!1;r&&(Mt.current=null,t.applyRotation(r,{width:Ne,height:$e}),i=!0);const a=t.advanceTransition(ze.current?n+1e6:n),s=!ze.current&&a;let l=!1;if(Ie.current&&!a){const n={width:Ne,height:$e},o=et?t.getRotation():null;t.computeScene(n);const r=ht.current,i=1!==r.k||0!==r.x||0!==r.y;et&&o?i?(t.setRotation(o),t.applyZoomScale(r.k,n)):t.applyRotation(o,n):i&&t.applyZoomTransform(r,n),Ie.current=!1,l=!0,e.setAttribute("aria-label",Zo(t.scene,"Geographic chart")),Bt()}const c=ei(),u=D&&!ze.current&&!!At.current,h=t.consumeStylePaintPending(),d=!!((f={dirtyOrRebuilt:l,transitioning:s,continuous:u,liveEncoding:t.hasActivePulses,forced:i||h}).dirtyOrRebuilt||f.transitioning||f.animationTicked||f.continuous||f.liveEncoding||f.forced);var f;if(R&&st.current){const e=ot.current;if(e&&t.scales?.projection){const n=Jr(e,Oe,Te,c);if(n){n.clearRect(-Te.left,-Te.top,Oe[0],Oe[1]),n.save(),n.beginPath(),n.rect(0,0,Ne,$e),n.clip();const e=function(e,t){const{tileURL:n,projection:o,width:r,height:i,tileCache:a,onTileLoad:s}=t,l=o.scale(),c=o.translate(),u=function(e){const{size:t,scale:n,translate:o,clampX:r=!0,clampY:i=!0}=e,a=Math.max(Math.log(n)/Math.LN2-8,0),s=Math.round(a),l=1<<s,c=Math.pow(2,a-s+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,s]);return{tiles:y,translate:[u/c,h/c],scale:c}}({size:[r,i],scale:2*l*Math.PI,translate:c}),h=ei();let d=!0;for(const t of u.tiles){const[o,r,i]=ti(t),l=`${i}/${o}/${r}`;let c=a.get(l);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:l,lastUsed:performance.now()};a.set(l,t),e.onload=()=>{t.loaded=!0,s?.()},e.onerror=()=>{t.loaded=!0},e.src=ni(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:R,projection:t.scales.projection,width:Ne,height:$e,tileCache:st.current,onTileLoad:()=>Ve()});n.restore(),e||(o=!0)}}}if(d){const r=Jr(e,Oe,Te,c);if(!r)return;r.clearRect(-Te.left,-Te.top,Oe[0],Oe[1]),R||function(e,t){const{background:n,hasBackgroundGraphics:o=!1,themeBackground:r="",x:i=0,y:a=0,width:s,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=ut(e,c);u&&(e.fillStyle=u,e.fillRect(i,a,s,l))}(r,{background:F,width:Ne,height:$e}),r.save(),r.beginPath(),r.rect(0,0,Ne,$e),r.clip();const i=t.scene,a={width:Ne,height:$e};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=ut(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)}Nr(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=ut(e,r)||r,a=t.style.strokeWidth||2,s=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=a,e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade){Qr(e,t.path,i,a,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=Zr(t.curve),u=s&&s.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,a=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=Xr(p,s,i);if(null!==r&&null!==u&&null!==c){if(m===u)e.lineTo(d,f);else{const t=[];for(const e of s){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=a+(f-a)*l.t,h=Xr(c+(p-c)*Math.min(l.t+1e-4,1),s,i);e.lineTo(t,u),o(),n(h,t,u)}e.lineTo(d,f)}r=d,a=f,c=p,u=m}else n(m,d,f),r=d,a=f,c=p,u=m}o()}else{e.beginPath();const n=t.strokeGradient&&t.path.length>=2?Yr(e,t.strokeGradient,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=n||i,c)$r().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=Ur(e,t.style.fill,t.style.fill),c&&!u)$r().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,a),((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=Ur(e,o.style.fill,"#4e79a7"),e.fill(),o.style.stroke&&(e.strokeStyle=Ur(e,o.style.stroke,o.style.stroke),e.lineWidth=o.style.strokeWidth||1,e.stroke()),Tr(e,o)}finally{e.restore()}}})(r,i),((e,t)=>{const n=e.globalAlpha;for(const o of t)"glyph"===o.type&&Kr(e,o,o.x,o.y,n);e.globalAlpha=n})(r,i),u&&At.current){const e=At.current,t=i.filter(e=>"line"===e.type);if(t.length>0){const i=z||{},a=.3*(i.speedMultiplier??1),s=i.maxPerLine??Si(),l=i.spawnRate??(ki()?.06:.15),c=i.radius??2,u=i.opacity??.7,h=n/1e3,d=Ct.current>0?Math.min(h-Ct.current,.1):.016;Ct.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)<s&&e.spawn(n);e.step(d,a,f,p),r.globalAlpha=u;for(let n=0;e.particles.length>n;n++){const o=e.particles[n];if(!o.active)continue;const a=t[o.lineIndex],s="function"==typeof i.color?i.color(a?.datum??{}):"source"!==i.color&&i.color?i.color:a?.style.stroke||"#fff";r.beginPath(),r.arc(o.x,o.y,c,0,2*Math.PI),r.fillStyle=s,r.fill()}r.globalAlpha=1,o=!0}}r.restore()}const p=jt.current,m=!(!p||"geoarea"!==p.type&&"point"!==p.type),y=m||Pt.current;const g=it.current;if(g&&y){const e=Jr(g,Oe,Te,c);if(e){if(e.clearRect(-Te.left,-Te.top,Oe[0],Oe[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 Y?Y: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()}}Pt.current=m}const b=ee!==lt.current;b&&(lt.current=ee),(l||b||s&&ee&&ee.length>0)&&(l||b||n-Tt.current>=33)&&(Ot(e=>e+1),Tt.current=n),(s||null!=t.activeTransition||t.hasActivePulses||o)&&Ve()},function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:i,cancelRender:a,cleanup:s}=e;Po(()=>{t&&n&&o.current?.cancelIntroAnimation?.(),r.current=!0,a?.(),i.current()},[t,n]);const l=Co(s);l.current=s,Mo(()=>()=>l.current?.(),[])}({hydrated:Ye,wasHydratingFromSSR:Xe,storeRef:nt,dirtyRef:Ie,renderFnRef:qe,cancelRender:Ze,cleanup:()=>st.current?.clear()}),n(()=>{Ie.current=!0,Ve()},[Ne,$e,F,Ve]),function(e,t,n,o,r,i){const a=bt("fresh");gt(()=>{if(!e)return;const s=setInterval(()=>{const s=t.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=function(e,t){if(!e||0>=t)return xt;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:{...vt,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:xt}(e,l-s.lastIngestTime);c.band===a.current&&c.isStale===r||(a.current=c.band,c.isStale!==r&&i(c.isStale),n.current=!0,o())},1e3);return()=>clearInterval(s)},[e,r,o])}(ae,nt,Ie,Ve,Nt,$t),n(()=>{if("production"!==process.env.NODE_ENV&&R){const e=Ai(l);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.`)}},[R,l]),n(()=>{const e=ft.current;if(!L||!e)return ct.current&&e&&(Rr(e).on(".zoom",null),ct.current=null),void(e&&Rr(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=j||[1,8],o={width:Ne,height:$e};if(et){let r=ht.current.k;const i=e=>{r=Math.max(t,Math.min(n,e)),ht.current=zr.scale(r);const i=nt.current;i&&(i.applyZoomScale(r,o),Ie.current=!1,Ve(),i.scales?.projection&&P?.({projection:i.scales.projection,zoom:i.currentZoom}))};ct.current={scaleBy:(e,t)=>i(r*t),transform:(e,t)=>i(t?.k??1)};const a=e=>{e.preventDefault(),i(r*(0>e.deltaY?1.1:1/1.1))},s=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),i(1.5*r))};e.addEventListener("wheel",a,{passive:!1}),e.addEventListener("dblclick",s);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=nt.current;if(!o)return;const r=o.getRotation();St.current={x:t.clientX,y:t.clientY,rotation:[...r]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{const t=St.current;t&&(Mt.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]],Ve())},h=t=>{if(!St.current)return;St.current=null,e.releasePointerCapture(t.pointerId);const n=Mt.current;if(n){Mt.current=null;const e=nt.current;e&&(e.applyRotation(n,o),Ve())}const r=nt.current;r?.scales?.projection&&P?.({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",a),e.removeEventListener("dblclick",s),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",h),e.removeEventListener("pointercancel",h),ct.current=null}}const r=Dr().scaleExtent([t,n]).extent([[0,0],[Oe[0],Oe[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;ht.current=t,dt.current=!0;const n=nt.current;n&&(n.applyZoomTransform(t,o),Ie.current=!1,Ve())}).on("end",e=>{ht.current=e.transform,dt.current=!1;const t=nt.current;t?.scales?.projection&&P?.({projection:t.scales.projection,zoom:t.currentZoom})});return ct.current=r,Rr(e).call(r),()=>{Rr(e).on(".zoom",null)}},[L,j,et,Oe,Ne,$e,Te,P,Ve]);const nn=U&&!1!==Y,on=nn&&Dt?X?X(Dt):Li(vi,{data:Dt}):null,rn=on?Li(Ir,{x:Dt.x,y:Dt.y,containerWidth:Ne,containerHeight:$e,margin:Te,className:"stream-frame-tooltip",zIndex:10,children:on}):null;if(So||!Ye&&Xe){const e=nt.current;e&&(Qe||f||p)&&(Qe&&e.setAreas(Qe),f&&e.setPoints(Ke),p&&e.setLines(Je),e.computeScene({width:Ne,height:$e}));const t=e?.scene??[];return ji("div",{ref:wt,className:"stream-geo-frame"+(H?" "+H:""),role:"img","aria-label":Ce||("string"==typeof ce?ce:"Geographic chart"),style:{position:"relative",width:_?"100%":Oe[0],height:E?"100%":Oe[1]},children:[Li(sr,{summary:je}),ji("svg",{xmlns:"http://www.w3.org/2000/svg",width:Oe[0],height:Oe[1],style:{position:"absolute",left:0,top:0},children:[Li("g",{transform:`translate(${Te.left},${Te.top})`,children:_e}),ji("g",{transform:`translate(${Te.left},${Te.top})`,children:[F&&Li("rect",{x:0,y:0,width:Ne,height:$e,fill:F}),t.map((e,t)=>function(e,t){switch(e.type){case"geoarea":{const n=e;return n.pathData?xo("path",{d:n.pathData,fill:ko(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 xo("circle",{cx:n.x,cy:n.y,r:n.r,fill:ko(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 xo("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=ve(r,e.size);if(0>=i.scale)return null;const a=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,s=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=Me(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:we(n.fill,s,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:we(n.stroke??"none",s,e.accent);return r||i?xo("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 wo("g",{transform:a,opacity:1===u?void 0:u,children:[l&&c&&xo("clipPath",{id:c,children:xo("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?xo("g",{children:h(e.ghostColor)}):null,l&&c?xo("g",{clipPath:`url(#${c})`,children:h()}):h()]},o)}(e,e.x,e.y,"geo-glyph-"+(e.pointId??t));default:return null}}(e,t))]})]}),Li(go,{width:Ne,height:$e,totalWidth:Oe[0],totalHeight:Oe[1],margin:Te,scales:null,showAxes:!1,title:ce,legend:ue,legendPosition:he,legendLayout:de,legendHoverBehavior:pe,legendClickBehavior:me,legendHighlightedCategory:ye,legendIsolatedCategories:ge,foregroundGraphics:li(We,fi(nt.current?.customLayoutOverlays,g??null)),annotations:ee,autoPlaceAnnotations:te,annotationFrame:0,xValues:[],yValues:[],pointNodes:pi(t)})]})}return ji("div",{ref:wt,className:"stream-geo-frame"+(H?" "+H:""),role:"group","aria-label":Ce||("string"==typeof ce?ce:"Geographic chart"),tabIndex:0,style:{position:"relative",width:_?"100%":Oe[0],height:E?"100%":Oe[1],overflow:Q?"visible":"hidden",...L?{touchAction:"none"}:{}},onKeyDown:Jt,children:[Se&&Li(lr,{tableId:He}),Se&&Li(ar,{scene:nt.current?.scene??[],chartType:"Geographic chart",tableId:He,chartTitle:"string"==typeof ce?ce:void 0}),Li(sr,{summary:je}),Li(cr,{hoverPoint:Dt}),ji("div",{role:"img","aria-label":Ce||("string"==typeof ce?ce:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:nn?en:void 0,onPointerLeave:nn?Yt:void 0,onPointerDown:nn||K?tn:void 0,onClick:K?Xt:void 0,children:[_e&&Li("svg",{style:{position:"absolute",left:0,top:0,width:Oe[0],height:Oe[1],pointerEvents:"none"},children:Li("g",{transform:`translate(${Te.left},${Te.top})`,children:_e})}),R&&Li("canvas",{ref:ot,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),Li("canvas",{ref:rt,"aria-label":Zo(nt.current?.scene??[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),Li("canvas",{ref:it,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),Li(go,{width:Ne,height:$e,totalWidth:Oe[0],totalHeight:Oe[1],margin:Te,scales:null,showAxes:ke??!1,title:ce,legend:ue,legendPosition:he,legendLayout:de,legendHoverBehavior:pe,legendClickBehavior:me,legendHighlightedCategory:ye,legendIsolatedCategories:ge,foregroundGraphics:li(We,fi(nt.current?.customLayoutOverlays,g??null)),annotations:ee,autoPlaceAnnotations:te,annotationFrame:Rt,xValues:[],yValues:[],pointNodes:pi(nt.current?.scene)}),ae?.showBadge&&Li(kt,{isStale:Nt,position:ae.badgePosition}),L&&ji("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Te.bottom+8,left:Te.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[Li("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=ft.current,n=ct.current;t&&n?.scaleBy&&n.scaleBy(Rr(t),1.5)},style:Mi,children:"+"}),Li("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=ft.current,n=ct.current;t&&n?.scaleBy&&n.scaleBy(Rr(t),1/1.5)},style:Mi,children:"−"})]}),O&&Li("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Te.bottom+2,right:Te.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:O}),Li(pr,{active:Qt.current>=0,hoverPoint:Dt,margin:Te,size:Oe,shape:Kt.current?.shape,width:Kt.current?.w,height:Kt.current?.h,pathData:Kt.current?.pathData}),rn]})]})}));Pi.displayName="StreamGeoFrame";var Ii=Pi;import{useMemo as Di}from"react";function zi(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}import{useMemo as Ri,useCallback as Oi,useState as Ti,useId as Ni,useEffect as $i,useRef as Wi}from"react";import{createContext as _i,useContext as Ei,useMemo as Bi}from"react";import{jsx as Hi}from"react/jsx-runtime";var Fi=_i(null);function Gi(){return Ei(Fi)}import{createContext as qi,useContext as Vi,useEffect as Zi,useId as Ui,useLayoutEffect as Yi,useMemo as Xi,useRef as Qi,useState as Ki,useCallback as Ji}from"react";function ea(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 ta(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function na(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[oa,ra]=He(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||!na(o,n))return!1}return!0}(r,n))return{};const i=new Map(e.selections),a=ta(i,t),s=new Map(a.clauses);return s.set(n.clientId,n),i.set(t,{...a,clauses:s}),{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=ta(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}})}})),[ia,aa]=He(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}))}}));import{useId as sa,useMemo as la,useCallback as ca}from"react";function ua(e){const t=sa(),n=e.clientId||t,{name:o}=e,r=ra(e=>e.selections.get(o)),i=ra(e=>e.setClause),a=ra(e=>e.clearClause),s=la(()=>!!r&&r.clauses.size>0,[r]);return{predicate:la(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(ea(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:s,selectPoints:ca(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:ca(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:ca(()=>{a(o,n)},[a,o,n]),clientId:n}}function ha(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:a}=ua({name:t,fields:n});return{onHover:ca(e=>{if(!e)return void a();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,a,t]),predicate:o,isActive:r}}import{jsx as da,jsxs as fa}from"react/jsx-runtime";var pa=qi(!1);qi(!1);var ma=qi(null),ya="undefined"==typeof window?Zi:Yi;function ga(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 ba(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??.5;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e}import*as va from"react";import{jsx as xa,jsxs as wa}from"react/jsx-runtime";function ka(){return Ke(e=>e.theme)}function Sa(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Ma(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),a=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&&a!==n.orientation)}function Aa(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=>Ma(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"])Sa(e[o])&&Sa(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}}va.createContext(void 0);var Ca="#007bff";function La(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 ja(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 Pa(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var Ia={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Da(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,a=e&&"object"==typeof e?e:void 0;if(!1===e||!1===a?.enabled||void 0===e&&!r&&!i)return Ia;const s=a??{};return{enabled:!0,tapToSelect:s.tapToSelect??!0,tapToLockTooltip:s.tapToLockTooltip??!0,clearSelection:s.clearSelection??"backgroundTap",targetSize:s.targetSize??o??44,snap:s.snap??"nearestDatum",brushHandleSize:s.brushHandleSize??44,standardControls:s.standardControls??!1}}function za(){const e=ka(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function Ra({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:r,chartType:i,chartId:a,onClick:s,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const h=Ni(),d=ga(t,n),f="series"===d?.mode?[d.seriesField||c||n[0]].filter(e=>!!e):d?.fields||n||[],p=ua({name:e?.name||"__unused__",fields:f}),m=ha({name:d?.name||"hover",fields:f}),y=aa(e=>e.pushObservation),g=e?{isActive:p.isActive,predicate:p.predicate}:null,[b,v]=Ti(null),x=Wi(!1),w=c||n[0],k=Ri(()=>{if(!l||null==b||!w)return null;const e=b,t=w;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,b,w]),S=Oi(e=>{const n=!e&&x.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===d?.mode&&d.xField){const n=La(e,t,d.xField);null!=n&&function(e,t,n){const o=Yn.positions.get(e);o?.locked||o&&o.xValue===t&&o.sourceId===n||(Yn={positions:new Map(Yn.positions).set(e,{xValue:t,sourceId:n})},Qn())}(d.name||"hover",n,h)}"x-position"!==d?.mode&&m.onHover(t)}else"x-position"!==d?.mode||n||Kn(d.name||"hover",h),"x-position"===d?.mode||n||m.onHover(null);if(l&&w)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[w];v(null!=n?n+"":null)}else n||v(null);if(r||y){const t={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(e){const n=ja(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,a,y,l,w,u]),M=Oi((n=!0)=>{x.current=!1,t&&"x-position"!==d?.mode&&m.onHover(null),e&&u?.tapToSelect&&p.clear(),n&&l&&v(null),"x-position"===d?.mode&&(Jn(d.name||"hover",h),Kn(d.name||"hover",h))},[t,d,m,e,u,p,l,h]),A=Oi(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=La(n,e,d.xField);null!=t&&function(e,t,n){const o=Yn.positions.get(e);if(o?.locked){const t=new Map(Yn.positions);return t.delete(e),Yn={positions:t},Qn(),!1}Yn={positions:new Map(Yn.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Qn()}(d.name||"hover",t,h)}if(o)if(n){x.current=!0;const o=ja(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])}Pa(e)&&p.selectPoints(e)}if(l&&w){const e=o?.[w];v(null!=e?e+"":null)}}else c&&M();if(n||c){if(n&&s){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),s(e,{x:n.x??0,y:n.y??0})}if(r||y){const e={timestamp:Date.now(),chartType:i||"unknown",chartId:a};if(n){const t=ja(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)}}}},[s,r,y,i,a,d,h,u,t,m,e,p,f,l,w,M]);return $i(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&x.current&&M()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,M]),$i(()=>()=>{x.current&&M(!1)},[M]),$i(()=>{if("x-position"!==d?.mode)return;const e=d.name||"hover";return()=>{Jn(e,h),Kn(e,h)}},[d?.mode,d?.name,h]),{activeSelectionHook:g,hoverSelectionHook:k,customHoverBehavior:S,customClickBehavior:A,crosshairSourceId:h}}function Oa({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:r="right",userMargin:i,defaults:a={top:50,bottom:60,left:70,right:40},categories:s}){const l=Vi(pa),c=null!==Vi(ma),u=void 0!==o?o:!l&&!!t,h=!!t&&(u||c),d=Ri(()=>{if(!h)return[];if(void 0!==s)return s;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)},[s,t,e,h]);!function(e){const t=Vi(ma),n=Ui(),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=Qi([]);(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;ya(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),ya(()=>{t&&t.registerCategories(n,i)},[t,n,i])}(c&&t?d:[]);const f=Ri(()=>{if(!u||!t)return;const o=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:a}){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:(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const a=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),s=a?o(a,t,n):n?n(r):_[i%_.length];return{label:r+"",color:s}}),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=Ri(()=>{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:a[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},[a,i,f,r]);return{legend:f,margin:p,legendPosition:r}}var Ta={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 Na(e,t,n){const o=Ta[e||"primary"],r=e&&"primary"!==e||!n?.width?o.width:n.width,i=e&&"primary"!==e||!n?.height?o.height:n.height,a=Aa({...t,mode:e},{width:t.width??r,height:t.height??i}).props,s=a.mode||e,l=Ta[s||"primary"],c="context"===s||"sparkline"===s,u=s&&"primary"!==s||!n?.width?l.width:n.width;return{width:a.width??u,height:a.height??(s&&"primary"!==s||!n?.height?l.height:n.height),showAxes:a.showAxes??l.showAxes,showGrid:a.showGrid??l.showGrid,enableHover:a.enableHover??(!!a.linkedHover||l.enableHover),showLegend:a.showLegend??l.showLegend,showLabels:a.showLabels??l.showLabels,title:c?void 0:a.title,description:a.description,summary:a.summary,accessibleTable:a.accessibleTable,xLabel:c?void 0:a.xLabel,yLabel:c?void 0:a.yLabel,categoryLabel:c?void 0:a.categoryLabel,valueLabel:c?void 0:a.valueLabel,marginDefaults:$a(l.marginDefaults,a.showCategoryTicks,a.orientation),compactMode:c,mobileInteraction:Da(a.mobileInteraction,{mode:s,width:a.width??u,mobileSemantics:a.mobileSemantics}),mobileSemantics:a.mobileSemantics}}function $a(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 Wa(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})}import{jsx as _a,jsxs as Ea}from"react/jsx-runtime";function Ba({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return _a("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:Ea("div",{style:{textAlign:"center",maxWidth:400},children:[_a("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),_a("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&_a("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})]})})}import*as Ha from"react";import{jsx as Fa}from"react/jsx-runtime";var Ga=class extends Ha.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:Fa(Ba,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}};import{jsx as qa}from"react/jsx-runtime";var Va="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function Za({componentName:e,width:t,height:n,children:o}){return qa(Ga,{fallback:o=>qa(Ba,{componentName:e,message:o.message,width:t,height:n}),children:o})}var Ua={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"},Ya={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Xa(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?qa("div",{style:{...Ua,width:t,height:n},children:o||"No data available"}):null}function Qa(e,t,n,o){if(!e)return null;if(!1===o)return null;if(null!=o)return qa("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))),a=Math.max(6,Math.floor(n/(2.5*r))),s=Math.floor((n-(r*(i+a)-a))/2);return qa("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)=>qa("div",{className:"semiotic-loading-bar",style:{...Ya,position:"absolute",top:s+n*(i+a),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}function Ka(e,t,n,o){if(!Va)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}`)}import{useMemo as Ja}from"react";function es(e){const t=Ke(e=>e.theme.colors.selectionOpacity);return Ja(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}import{scaleSequential as ts}from"d3-scale";import{useState as ns,useEffect as os,useMemo as rs}from"react";import{feature as is}from"topojson-client";var as=new Map;function ss(e){return e.default??e}async function ls(e){const t=as.get(e);if(t)return t;const{topology:n,objectName:o}=await async function(e){try{switch(e){case"world-110m":return{topology:ss(await import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:ss(await import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:ss(await import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:ss(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}"): Install the optional peer dependency \`world-atlas\` (\`npm install world-atlas\`) to use built-in reference geographies, or pass GeoJSON Feature[] to \`areas\`.`,{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=is(n,n.objects[o]),i="features"in r?r.features:[r];return as.set(e,i),i}function cs(e){const t=rs(()=>Array.isArray(e)?e:void 0,[e]),[n,o]=ns(null);return os(()=>{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),ls(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 us(e){const{title:t,description:n,summary:o,accessibleTable:r,className:i,animate:a,axisExtent:s,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!=a&&(c.animate=a),void 0!==s&&(c.axisExtent=s),void 0!==l&&(c.autoPlaceAnnotations=l),c}function hs(e){const{linkedHover:t,selection:n,onObservation:o,onClick:r,hoverRadius:i,hoverHighlight:a,forceHoverBehavior:s,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(s||t||o||r||a)&&(f.customHoverBehavior=u),h&&(l||(d?o||r||t:o||r)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||a||n))&&(f.customClickBehavior=h),null!=p&&(f.hoverRadius=p),f}import{jsx as ds,jsxs as fs}from"react/jsx-runtime";function ps(e){const t=Na(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=ka();return e?.colors?.sequential||void 0}(),{areas:o,valueAccessor:r,colorScheme:i,projection:a="equalEarth",graticule:s,fitPadding:l,zoomable:c,zoomExtent:u,onZoom:h,dragRotate:d,tileURL:f,tileAttribution:p,tileCacheSize:m,tooltip:y,areaOpacity:g=1,annotations:b,margin:v,className:x,selection:w,linkedHover:k,onObservation:S,onClick:M,chartId:A,loading:C,loadingContent:L,emptyContent:j,frameProps:P={},stroke:I,strokeWidth:D,opacity:z}=e,R=c??!!f,O=cs(o),T=Di(()=>O?hr(O):O,[O]),$=Di(()=>"function"==typeof r?r:e=>e?.properties?.[r]??e?.[r],[r]),W=i??n??"blues",_=Di(()=>{if(!T)return ts(N(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(const n of T){const o=$(n);null!=o&&isFinite(o)&&(e>o&&(e=o),o>t&&(t=o))}const n=N(W);return ts(n).domain([Number.isFinite(e)?e:0,Number.isFinite(t)?t:1])},[T,$,W]),{activeSelectionHook:E,customHoverBehavior:B,customClickBehavior:H}=Ra({selection:w,linkedHover:k,onObservation:S,onClick:M,chartType:"ChoroplethMap",chartId:A,mobileInteraction:t.mobileInteraction}),F=es(w),G=Di(()=>{const e=Wa(e=>{const t=$(e);return{fill:null!=t&&isFinite(t)?_(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:g}},{stroke:I,strokeWidth:D,opacity:z});return E?ba(e,E,F):e},[$,_,E,F,g,I,D,z]),q=Di(()=>e=>{const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||"Feature",n=$(e);return fs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[ds("div",{style:{fontWeight:600},children:t}),null!=n&&ds("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},[$]),V=Di(()=>({top:10,right:10,bottom:10,left:10,...zi(v)}),[v]),Z=Qa(C,t.width,t.height,L)||(T?null:Qa(!0,t.width,t.height,L)),U=Z?null:Xa(T,t.width,t.height,j);if(Array.isArray(T)&&T.length>0){const e=T[0];if(!e||"object"!=typeof e||!e.geometry)return ds(Ba,{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:a,areas:T,areaStyle:G,size:[t.width,t.height],margin:V,enableHover:!0,tooltipContent:!1===y?()=>null:!0===y?q:jr(y)||q,...null!=s&&{graticule:s},...null!=l&&{fitPadding:l},...R&&{zoomable:!0},...u&&{zoomExtent:u},...h&&{onZoom:h},...null!=d&&{dragRotate:d},...f&&{tileURL:f},...p&&{tileAttribution:p},...m&&{tileCacheSize:m},...hs({linkedHover:k,selection:w,onObservation:S,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},...x&&{className:x},...null!=e.animate&&{animate:e.animate},...P};return Z||U||ds(Za,{componentName:"ChoroplethMap",width:t.width,height:t.height,children:ds(Ii,{...Y})})}ps.displayName="ChoroplethMap";import{useMemo as ms,useRef as ys,forwardRef as gs}from"react";import{useCallback as bs,useMemo as vs,useState as xs}from"react";function ws(e){const{data:t,rawData:n,colorBy:o,colorScheme:r,legendInteraction:i,legendPosition:a,selection:s,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:h,chartType:d,chartId:f,showLegend:p,userMargin:m,marginDefaults:y,onClick:g,hoverHighlight:b,mobileInteraction:v,mobileSemantics:x,loading:w,loadingContent:k,emptyContent:S,width:M,height:A}=e,C=void 0===n,L=vs(()=>hr(t),[t]),[j,P]=xs([]),I=bs(e=>{P(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),D="string"==typeof e.colorBy?e.colorBy:void 0,z=vs(()=>Da(v,{width:M,mobileSemantics:x}),[v,M,x]),{activeSelectionHook:R,hoverSelectionHook:O,customHoverBehavior:T,customClickBehavior:N,crosshairSourceId:$}=Ra({selection:s,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:h,chartType:d,chartId:f,onClick:g,hoverHighlight:b,colorByField:D,mobileInteraction:z}),W=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,$),E=function(e,t,n){const o=Gi(),r=za();return Ri(()=>{if(!t)return;const i=o??void 0,a=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&&Pa(i)){const e=F(n.map(e=>({_cat:e})),"_cat",a);return t=>i[t]||e(t)}return F(n.map(e=>({_cat:e})),"_cat",a)}if(i&&Pa(i)){const n=F(e,t,a);return e=>i[e]||n(e)}return F(e,t,a)}if(i&&Pa(i)){const e=F([{_:"a"}],"_",a);return t=>i[t]||e(t)}},[e,t,n,o,r])}(L,o,r),B=vs(()=>{if(!o)return[];const e=new Set;for(const t of L){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[L,o]),H=vs(()=>C&&j.length>0?j:B,[C,j,B]),G=function(e,t,n){const[o,r]=Ti(null),[i,a]=Ti(new Set),s=Ri(()=>new Set,[]),l=Oi(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=Oi(t=>{"isolate"===e&&a(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=Ri(()=>{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:s,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(i,o,H),q=vs(()=>O||(G.legendSelectionHook?G.legendSelectionHook:R),[O,G.legendSelectionHook,R]),V=es(s),Z=za(),U=Gi(),Y=vs(()=>{if(E)return E;if(!o||0===H.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:Z&&Z.length>0?Z:_,t="__streamCat",n=F(H.map(e=>({[t]:e})),t,e);return e=>U?.[e]||n(e)||"#999"},[E,o,H,r,Z,U]),{legend:X,margin:Q,legendPosition:K}=Oa({data:L,colorBy:o,colorScale:Y,showLegend:p,legendPosition:a,userMargin:m,defaults:y,categories:H}),J=vs(()=>{const e={};return X&&(e.legend=X,e.legendPosition=K),i&&"none"!==i&&(e.legendHoverBehavior=G.onLegendHover,e.legendClickBehavior=G.onLegendClick,e.legendHighlightedCategory=G.highlightedCategory,e.legendIsolatedCategories=G.isolatedCategories),C&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=I),e},[X,K,i,G.onLegendHover,G.onLegendClick,G.highlightedCategory,G.isolatedCategories,C,o,I]),ee=Array.isArray(n)?hr(n):n,te=Qa(w,M,A,k),ne=te?null:Xa(ee,M,A,S);return{data:L,colorScale:E,allCategories:H,legendState:G,effectiveSelectionHook:q,activeSelectionHook:R,customHoverBehavior:T,customClickBehavior:N,mobileInteraction:z,legend:X,margin:Q,legendPosition:K,earlyReturn:te||ne||null,legendBehaviorProps:J,crosshairProps:W,resolvedSelection:V}}import{useImperativeHandle as ks}from"react";function Ss(e,t){const{variant:n,frameRef:o,overrides:r,deps:i}=t;ks(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??[])}import{jsx as Ms,jsxs as As}from"react/jsx-runtime";var Cs=gs(function(e,t){const n=ys(null);Ss(t,{variant:"geo-points",frameRef:n});const o=Na(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:a="lat",sizeBy:s,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:v,tileCacheSize:x,areas:w,areaStyle:k={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:S,annotations:M,margin:A,className:C,selection:L,linkedHover:j,onObservation:P,onClick:I,chartId:D,loading:z,loadingContent:R,emptyContent:O,legendInteraction:T,legendPosition:N,frameProps:$={},stroke:W,strokeWidth:_,opacity:E}=e,H=p??!!b,F=cs(w),q=ws({data:r??ur,rawData:r,colorBy:c,colorScheme:u,legendInteraction:T,legendPosition:N,selection:L,linkedHover:j,fallbackFields:c?["string"==typeof c?c:""]:[],unwrapData:!1,onObservation:P,onClick:I,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"ProportionalSymbolMap",chartId:D,showLegend:o.showLegend,userMargin:A,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:z,loadingContent:R,emptyContent:O,width:o.width,height:o.height}),V=q.data,Z=ms(()=>{if(!s)return;const e="function"==typeof s?s:e=>e?.[s],t=V.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?ce(t):void 0},[V,s]),U=ms(()=>{const e=Wa(e=>({fill:c?B(e,c,q.colorScale):Ca,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:s?G(e,s,l,Z):6}),{stroke:W,strokeWidth:_,opacity:E});return q.effectiveSelectionHook?ba(e,q.effectiveSelectionHook,q.resolvedSelection):e},[c,q.colorScale,q.effectiveSelectionHook,q.resolvedSelection,s,l,Z,W,_,E]),Y=ms(()=>e=>{const t=e?.name||e?.label||e?.NAME||e?.id,n="string"==typeof s?s:null,o=("function"==typeof s?s:e=>e[s])(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,a=i?e?.[i]:null;return As("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t&&Ms("div",{style:{fontWeight:600,marginBottom:2},children:t}),n&&null!=o&&As("div",{children:[As("span",{style:{opacity:.7},children:[n,": "]}),r(o)]}),i&&null!=a&&As("div",{children:[As("span",{style:{opacity:.7},children:[i,": "]}),a+""]}),!t&&!n&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>As("div",{children:[As("span",{style:{opacity:.7},children:[e,": "]}),r(t)]},e))]})},[s,c]);if(q.earlyReturn)return q.earlyReturn;Ka("ProportionalSymbolMap",V,"xAccessor",i),Ka("ProportionalSymbolMap",V,"yAccessor",a);const X={projection:h,...null!=r&&{points:V},xAccessor:i,yAccessor:a,pointStyle:U,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...F&&{areas:F,areaStyle:k},...null!=d&&{graticule:d},...null!=f&&{fitPadding:f},...H&&{zoomable:!0},...m&&{zoomExtent:m},...y&&{onZoom:y},...null!=g&&{dragRotate:g},...b&&{tileURL:b},...v&&{tileAttribution:v},...x&&{tileCacheSize:x},size:[o.width,o.height],margin:q.margin,enableHover:!0,tooltipContent:!1===S?()=>null:jr(S)||Y,...q.legendBehaviorProps,...hs({linkedHover:j,selection:L,onObservation:P,onClick:I,mobileInteraction:q.mobileInteraction,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.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},...C&&{className:C},...null!=e.animate&&{animate:e.animate},...$};return Ms(Za,{componentName:"ProportionalSymbolMap",width:o.width,height:o.height,children:Ms(Ii,{ref:n,...X})})});Cs.displayName="ProportionalSymbolMap";import{useMemo as Ls,useCallback as js,useRef as Ps,forwardRef as Is}from"react";import{scaleLinear as Ds}from"d3-scale";import{jsx as zs,jsxs as Rs}from"react/jsx-runtime";var Os="__semiotic_x",Ts="__semiotic_y",Ns=Is(function(e,t){const n=Na(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:a="lon",yAccessor:s="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:v="geo",flowStyle:x="basic",areas:w,areaStyle:k={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:S,edgeOpacity:M=.6,edgeWidthRange:A=[1,8],edgeLinecap:C="round",colorScheme:L,showParticles:j,particleStyle:P,tooltip:I,annotations:D,margin:z,className:R,selection:O,linkedHover:T,onObservation:N,onClick:$,chartId:W,loading:_,loadingContent:E,emptyContent:H,frameProps:F={},legendInteraction:G,legendPosition:q,stroke:V,strokeWidth:Z,opacity:U,lineIdAccessor:Y}=e,X=d??!!y,Q=cs(w),K=Ls(()=>hr(r),[r]),J=ws({data:o??ur,rawData:o,colorBy:S,colorScheme:L,legendInteraction:G,legendPosition:q,selection:O,linkedHover:T,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:N,onClick:$,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"FlowMap",chartId:W,showLegend:n.showLegend,userMargin:z,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:_,loadingContent:E,emptyContent:H,width:n.width,height:n.height}),ee=J.data,te=ga(T),ne=ha({name:te?.name||"hover",fields:te?.fields||[]}),oe=aa(e=>e.pushObservation),re=Ls(()=>{const e=new Map;for(const t of K)e.set(t[i]+"",t);return e},[K,i]),ie=Ps(null),ae=Ps(re);ae.current=re;const se=Ps(a);se.current=a;const le=Ps(s);le.current=s;const ue=js(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 se.current?se.current:e=>e[se.current],i="function"==typeof le.current?le.current:e=>e[le.current];return{...e,coordinates:[{[Os]:r(n),[Ts]:i(n)},{[Os]:r(o),[Ts]:i(o)}]}},[]);Ss(t,{variant:"geo-lines",frameRef:ie,overrides:{push:e=>{const t=ue(e);t&&ie.current?.pushLine(t)},pushMany:e=>{const t=[];for(const n of e){const e=ue(n);e&&t.push(e)}t.length>0&&ie.current?.pushManyLines(t)}}});const he=Ls(()=>{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=js(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(N||oe){const t={timestamp:Date.now(),chartType:"FlowMap",chartId:W};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};N&&N(o),oe&&oe(o)}else{const e={...t,type:"hover-end"};N&&N(e),oe&&oe(e)}}},[T,ne,i,he,N,W,oe]),fe=J.customClickBehavior,pe=Ls(()=>{const e="function"==typeof a?a:e=>e[a],t="function"==typeof s?s:e=>e[s];return ee.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=re.get(n.source+""),r=re.get(n.target+"");return o&&r?{...n,coordinates:[{[Os]:e(o),[Ts]:t(o)},{[Os]:e(r),[Ts]:t(r)}]}:null}).filter(Boolean)},[ee,re,a,s]),me=Ls(()=>{const e="function"==typeof a?a:e=>e[a];return t=>null!=t&&"object"==typeof t&&Os in t?t[Os]:e(t)},[a]),ye=Ls(()=>{const e="function"==typeof s?s:e=>e[s];return t=>null!=t&&"object"==typeof t&&Ts in t?t[Ts]:e(t)},[s]),ge=Ls(()=>{const e=ee.filter(e=>e&&"object"==typeof e).map(e=>e[l]??0).filter(e=>isFinite(e));return 0===e.length?()=>A[0]:Ds().domain(ce(e)).range(A)},[ee,l,A]),be=Ls(()=>e=>({stroke:S?B(e,S,J.colorScale):Ca,strokeWidth:ge(e[l]??0),strokeLinecap:C,opacity:M}),[S,J.colorScale,ge,l,M,C]),ve=Ls(()=>{const e=Wa(be,{stroke:V,strokeWidth:Z,opacity:U});if(!J.effectiveSelectionHook)return e;const t={...J.resolvedSelection?.unselectedStyle||{},fillOpacity:0};return ba(e,J.effectiveSelectionHook,{...J.resolvedSelection||{},unselectedStyle:t})},[be,J.effectiveSelectionHook,J.resolvedSelection,V,Z,U]),xe=Ls(()=>Wa(()=>({fill:"#333",r:5,fillOpacity:.8}),{stroke:V,strokeWidth:Z,opacity:U}),[V,Z,U]),we=Ls(()=>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 zs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:zs("div",{style:{fontWeight:600},children:t})})}if(null!=e?.source&&null!=e?.target){const t=e[l];return Rs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[Rs("div",{style:{fontWeight:600},children:[e.source," → ",e.target]}),null!=t&&zs("div",{style:{opacity:.7},children:"number"==typeof t?t.toLocaleString():t})]})}const t=e?.name||e?.label||e?.[i];return null!=t?zs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:zs("div",{style:{fontWeight:600},children:t})}):null},[l,i]);if(J.earlyReturn)return J.earlyReturn;const ke={projection:c,...null!=o&&{lines:pe},points:K,xAccessor:me,yAccessor:ye,lineDataAccessor:"coordinates",...null!=Y&&{lineIdAccessor:Y},lineType:v,flowStyle:x,lineStyle:ve,pointStyle:xe,...Q&&{areas:Q,areaStyle:k},...null!=u&&{graticule:u},...null!=h&&{fitPadding:h},...X&&{zoomable:!0},...f&&{zoomExtent:f},...p&&{onZoom:p},...null!=m&&{dragRotate:m},...j&&{showParticles:j},...P&&{particleStyle:P},...y&&{tileURL:y},...g&&{tileAttribution:g},...b&&{tileCacheSize:b},size:[n.width,n.height],margin:J.margin,enableHover:!0,tooltipContent:!1===I?()=>null:jr(I)||we,...J.legendBehaviorProps,...hs({linkedHover:T,selection:O,onObservation:N,onClick:$,mobileInteraction:J.mobileInteraction,customHoverBehavior:de,customClickBehavior:fe,linkedHoverInClickPredicate:!1}),...D&&D.length>0&&{annotations:D},...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},...R&&{className:R},...null!=e.animate&&{animate:e.animate},...F};return zs(Za,{componentName:"FlowMap",width:n.width,height:n.height,children:zs(Ii,{ref:ie,...ke})})});Ns.displayName="FlowMap";import{useMemo as $s,useRef as Ws,useState as _s,useEffect as Es,useCallback as Bs,forwardRef as Hs}from"react";import{jsx as Fs,jsxs as Gs}from"react/jsx-runtime";var qs=Hs(function(e,t){const n=Na(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:a="lat",nodeIdAccessor:s="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:v,tileAttribution:x,tileCacheSize:w,transition:k,colorBy:S,colorScheme:M,pointRadius:A=5,tooltip:C,showRings:L=!0,ringStyle:j,showNorth:P=!0,costLabel:I,annotations:D,margin:z,className:R,selection:O,linkedHover:T,onObservation:N,onClick:$,chartId:W,loading:_,loadingContent:E,emptyContent:H,legendPosition:F,frameProps:G={},stroke:q,strokeWidth:V,opacity:Z}=e,U=m??!!v,Y=$s(()=>hr(o),[o]),X=ws({data:Y,rawData:o,colorBy:S,colorScheme:M,legendInteraction:void 0,legendPosition:F,selection:O,linkedHover:T,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:N,onClick:$,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DistanceCartogram",chartId:W,showLegend:n.showLegend,userMargin:z,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:_,loadingContent:E,emptyContent:H,width:n.width,height:n.height}),Q=$s(()=>{const e=Wa(e=>({fill:S?B(e,S,X.colorScale):Ca,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:A}),{stroke:q,strokeWidth:V,opacity:Z});return X.effectiveSelectionHook?ba(e,X.effectiveSelectionHook,X.resolvedSelection):e},[S,X.colorScale,X.effectiveSelectionHook,X.resolvedSelection,A,q,V,Z]),K=$s(()=>({center:l,centerAccessor:s,costAccessor:c,strength:u,lineMode:h}),[l,s,c,u,h]),J=$s(()=>{if(!r)return;const e="function"==typeof i?i:e=>e[i],t="function"==typeof a?a:e=>e[a],n=new Map;for(const e of Y)n.set(e[s]+"",e);return r.map(o=>{if(o.coordinates)return o;const r=n.get(o.source+""),s=n.get(o.target+"");return r&&s?{...o,coordinates:[{[i]:e(r),[a]:t(r)},{[i]:e(s),[a]:t(s)}]}:null}).filter(Boolean)},[r,Y,i,a,s]),ee=$s(()=>e=>{const t=("function"==typeof c?c:e=>e[c])(e);return Gs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[Fs("div",{style:{fontWeight:600},children:e[s]||e.name||e.id||"Point"}),null!=t&&Gs("div",{style:{opacity:.7},children:["Cost: ","number"==typeof t?t.toFixed(1):t]})]})},[c,s]),te=Ws(null);Ss(t,{variant:"geo-points",frameRef:te});const[ne,oe]=_s(null),re=Bs(()=>{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)},[]);Es(()=>{const e=requestAnimationFrame(re);return()=>cancelAnimationFrame(e)},[re,u,l,n.width,n.height,Y]);const ie=$s(()=>{if(!L||!ne)return[];const{maxCost:e}=ne;if(0>=e)return[];if(Array.isArray(L))return L.filter(t=>t>0&&e>=t);const t="number"==typeof L?L: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},[L,ne]),ae=$s(()=>{if(!ne)return G.foregroundGraphics||null;const{cx:e,cy:t,maxCost:n,availableRadius:o}=ne,r={stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10,...j},i=X.margin.left??10,a=X.margin.top??10;return Gs("g",{children:[ie.map(s=>{const l=s/n*o;return Gs("g",{children:[Fs("circle",{cx:e+i,cy:t+a,r:l,fill:"none",stroke:r.stroke,strokeWidth:r.strokeWidth,strokeDasharray:r.strokeDasharray,opacity:.5}),Gs("text",{x:e+i+l+3,y:t+a-2,fontSize:r.labelSize,fill:r.labelColor,fontFamily:"system-ui, sans-serif",children:[s,I?" "+I:""]})]},s)}),P&&Gs("g",{transform:`translate(${i+24}, ${a+24})`,children:[Fs("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),Fs("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),Fs("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),Fs("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),Fs("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),Fs("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]}),G.foregroundGraphics]})},[ne,ie,P,I,j,X.margin,G.foregroundGraphics]);if(X.earlyReturn)return X.earlyReturn;Ka("DistanceCartogram",Y,"xAccessor",i),Ka("DistanceCartogram",Y,"yAccessor",a);const se={projection:d,...null!=o&&{points:Y},...J&&{lines:J,lineDataAccessor:"coordinates"},xAccessor:i,yAccessor:a,pointIdAccessor:s,pointStyle:Q,projectionTransform:K,...k&&{transition:{duration:k}},...null!=f&&{graticule:f},...null!=p&&{fitPadding:p},...U&&{zoomable:!0},...y&&{zoomExtent:y},...g&&{onZoom:g},...null!=b&&{dragRotate:b},...v&&{tileURL:v},...x&&{tileAttribution:x},...w&&{tileCacheSize:w},size:[n.width,n.height],margin:X.margin,enableHover:!0,tooltipContent:!1===C?()=>null:jr(C)||ee,...X.legendBehaviorProps,...hs({linkedHover:T,selection:O,onObservation:N,onClick:$,mobileInteraction:X.mobileInteraction,customHoverBehavior:X.customHoverBehavior,customClickBehavior:X.customClickBehavior,linkedHoverInClickPredicate:!1}),...D&&D.length>0&&{annotations:D},...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},...R&&{className:R},...null!=e.animate&&{animate:e.animate},...G,...ae&&{foregroundGraphics:ae}};return Fs(Za,{componentName:"DistanceCartogram",width:n.width,height:n.height,children:Fs(Ii,{ref:te,...se})})});qs.displayName="DistanceCartogram";import{forwardRef as Vs,useMemo as Zs}from"react";import{useMemo as Us,useRef as Ys}from"react";import{jsx as Xs}from"react/jsx-runtime";var Qs=Vs(function(e,t){const{points:n,areas:o,lines:r,layout:i,layoutConfig:a,onLayoutError:s,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:v,onClick:x,chartId:w,loading:k,loadingContent:S,emptyContent:M,className:A,frameProps:C={}}=e,{frameRef:L,resolved:j,normalizedMargin:P}=function(e){const t=Ys(null);return Ss(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Na(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:Us(()=>zi(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}),I=Zs(()=>hr(n),[n]),D=Zs(()=>hr(o),[o]),z=Zs(()=>hr(r),[r]),R=Zs(()=>[...I,...z,...D],[I,z,D]),O=ws({data:R,rawData:void 0!==n||void 0!==r||void 0!==o?R:void 0,colorBy:d,colorScheme:f,legendInteraction:void 0,selection:g,linkedHover:b,fallbackFields:"string"==typeof d?[d]:[],unwrapData:!1,onObservation:v,onClick:x,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:"GeoCustomChart",chartId:w,showLegend:!1,userMargin:P,marginDefaults:j.marginDefaults,loading:k,loadingContent:S,emptyContent:M,width:j.width,height:j.height}),T=O.effectiveSelectionHook,N=Zs(()=>T?.isActive?{isActive:!0,predicate:T.predicate}:null,[T?.isActive,T?.predicate]);if(O.earlyReturn)return O.earlyReturn;const{width:$,height:W,enableHover:_,title:E,description:B,summary:H,accessibleTable:F}=j,G=jr(p),q={projection:l,...null!=n&&{points:I},...null!=o&&{areas:D},...null!=r&&{lines:z},xAccessor:c,yAccessor:u,...null!=h&&{lineDataAccessor:h},customLayout:i,layoutConfig:a,onLayoutError:s,layoutSelection:N,colorBy:d,colorScheme:f,size:[$,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:O.margin,enableHover:_,...us({title:E,description:B,summary:H,accessibleTable:F,className:A,animate:e.animate,autoPlaceAnnotations:e.autoPlaceAnnotations}),...!1===p?{tooltipContent:()=>null}:G?{tooltipContent:G}:{},...hs({linkedHover:b,selection:g,onObservation:v,onClick:x,hoverHighlight:!1,mobileInteraction:O.mobileInteraction,customHoverBehavior:O.customHoverBehavior,customClickBehavior:O.customClickBehavior,linkedHoverInClickPredicate:!1}),...m&&m.length>0&&{annotations:m},...C};return Xs(Za,{componentName:"GeoCustomChart",width:$,height:W,children:Xs(Ii,{ref:L,...q})})});Qs.displayName="GeoCustomChart";var Ks={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},Js=8;function el(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??8,style:{...Ks},datum:e.datum,pointId:t,_transitionKey:t}}function tl(e){return el(e)}function nl(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:{...Ks},datum:e.datum,group:e.group,interactive:!0}}function ol(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})}export{ps as ChoroplethMap,Js as DEFAULT_HIT_RADIUS,qs as DistanceCartogram,Ns as FlowMap,Qs as GeoCustomChart,Cs as ProportionalSymbolMap,Ii as StreamGeoFrame,nl as geoAreaHitTarget,tl as geoHitTarget,xe as glyphExtent,ve as glyphPlacement,el as hitTargetPoint,ol as mergeData,ls as resolveReferenceGeography,Aa as resolveResponsiveRules,Ma as responsiveRuleMatches};