semiotic 3.7.5 → 3.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (575) hide show
  1. package/CLAUDE.md +63 -18
  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 +1741 -163
  7. package/ai/examples.md +174 -0
  8. package/ai/schema.json +2733 -536
  9. package/ai/surface-manifest.json +201 -0
  10. package/ai/system-prompt.md +20 -4
  11. package/dist/__tests__/scenarios/mcpProtocolTypes.d.ts +20 -0
  12. package/dist/components/AccessibleNavTree.d.ts +7 -1
  13. package/dist/components/CategoryColors.d.ts +1 -1
  14. package/dist/components/ChartContainer.d.ts +91 -0
  15. package/dist/components/ChartGrid.d.ts +11 -1
  16. package/dist/components/CircularBrush.d.ts +61 -0
  17. package/dist/components/ContextLayout.d.ts +5 -1
  18. package/dist/components/DirectManipulationControl.d.ts +63 -0
  19. package/dist/components/LinkedCharts.d.ts +3 -1
  20. package/dist/components/MobileAnnotationCalloutList.d.ts +13 -0
  21. package/dist/components/MobileChartContainer.d.ts +51 -0
  22. package/dist/components/MobileStandardControls.d.ts +68 -0
  23. package/dist/components/SmallMultipleChart.d.ts +84 -0
  24. package/dist/components/Tooltip/FlippingTooltip.d.ts +21 -0
  25. package/dist/components/ai/ChartRecipe.d.ts +16 -0
  26. package/dist/components/ai/IntentMark.d.ts +15 -0
  27. package/dist/components/ai/chartCapabilities.d.ts +8 -1
  28. package/dist/components/ai/chartCapabilityTypes.d.ts +26 -1
  29. package/dist/components/ai/chartClinic.d.ts +91 -0
  30. package/dist/components/ai/chartClinicMetadata.generated.d.ts +15 -0
  31. package/dist/components/ai/chartRecipeRegistry.d.ts +14 -0
  32. package/dist/components/ai/chartRecipes.d.ts +278 -0
  33. package/dist/components/ai/dataPitfallsBridge.d.ts +102 -0
  34. package/dist/components/ai/describeChart.d.ts +7 -0
  35. package/dist/components/ai/describeRecipeChart.d.ts +16 -0
  36. package/dist/components/ai/generativeChart.d.ts +28 -3
  37. package/dist/components/ai/intentManifest.d.ts +62 -0
  38. package/dist/components/ai/navigationTree.d.ts +3 -0
  39. package/dist/components/ai/observedSceneAudit.d.ts +72 -0
  40. package/dist/components/ai/readerGrounding.d.ts +83 -0
  41. package/dist/components/ai/recipeCapability.d.ts +8 -0
  42. package/dist/components/ai/recipeNavigation.d.ts +13 -0
  43. package/dist/components/ai/recipeSemantics.d.ts +11 -0
  44. package/dist/components/ai/repairChartConfig.d.ts +9 -0
  45. package/dist/components/ai/suggestCharts.d.ts +11 -1
  46. package/dist/components/ai/useNavigationSync.d.ts +17 -2
  47. package/dist/components/chartContainerMobile.d.ts +9 -0
  48. package/dist/components/charts/custom/GeoCustomChart.d.ts +48 -0
  49. package/dist/components/charts/custom/NetworkCustomChart.d.ts +8 -2
  50. package/dist/components/charts/custom/OrdinalCustomChart.d.ts +8 -2
  51. package/dist/components/charts/custom/XYCustomChart.d.ts +11 -2
  52. package/dist/components/charts/geo/ChoroplethMap.d.ts +19 -2
  53. package/dist/components/charts/geo/DistanceCartogram.d.ts +15 -3
  54. package/dist/components/charts/geo/FlowMap.d.ts +11 -7
  55. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +15 -3
  56. package/dist/components/charts/geo/index.d.ts +2 -0
  57. package/dist/components/charts/index.d.ts +35 -1
  58. package/dist/components/charts/network/ChordDiagram.d.ts +10 -2
  59. package/dist/components/charts/network/CirclePack.d.ts +1 -1
  60. package/dist/components/charts/network/ForceDirectedGraph.d.ts +26 -5
  61. package/dist/components/charts/network/OrbitDiagram.d.ts +1 -1
  62. package/dist/components/charts/network/ProcessSankey.d.ts +1 -1
  63. package/dist/components/charts/network/SankeyDiagram.d.ts +10 -2
  64. package/dist/components/charts/network/TreeDiagram.d.ts +1 -1
  65. package/dist/components/charts/network/Treemap.d.ts +1 -1
  66. package/dist/components/charts/network/useForceLayout.d.ts +17 -0
  67. package/dist/components/charts/ordinal/BarChart.d.ts +22 -1
  68. package/dist/components/charts/ordinal/BoxPlot.d.ts +1 -1
  69. package/dist/components/charts/ordinal/DonutChart.d.ts +1 -1
  70. package/dist/components/charts/ordinal/DotPlot.d.ts +1 -1
  71. package/dist/components/charts/ordinal/FunnelChart.d.ts +1 -1
  72. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +12 -1
  73. package/dist/components/charts/ordinal/Histogram.d.ts +1 -1
  74. package/dist/components/charts/ordinal/PieChart.d.ts +1 -1
  75. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +1 -1
  76. package/dist/components/charts/ordinal/StackedBarChart.d.ts +12 -1
  77. package/dist/components/charts/ordinal/SwarmPlot.d.ts +1 -1
  78. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +1 -1
  79. package/dist/components/charts/ordinal/ViolinPlot.d.ts +1 -1
  80. package/dist/components/charts/physics/ChainReactionChart.d.ts +9 -0
  81. package/dist/components/charts/physics/CollisionSwarmChart.capability.d.ts +2 -0
  82. package/dist/components/charts/physics/CollisionSwarmChart.d.ts +54 -0
  83. package/dist/components/charts/physics/EventDropChart.capability.d.ts +2 -0
  84. package/dist/components/charts/physics/EventDropChart.d.ts +60 -0
  85. package/dist/components/charts/physics/GaltonBoardChart.capability.d.ts +2 -0
  86. package/dist/components/charts/physics/GaltonBoardChart.d.ts +74 -0
  87. package/dist/components/charts/physics/GauntletChart.capability.d.ts +2 -0
  88. package/dist/components/charts/physics/GauntletChart.d.ts +73 -0
  89. package/dist/components/charts/physics/PhysicalFlowChart.capability.d.ts +2 -0
  90. package/dist/components/charts/physics/PhysicalFlowChart.d.ts +63 -0
  91. package/dist/components/charts/physics/PhysicsCustomChart.d.ts +99 -0
  92. package/dist/components/charts/physics/PhysicsPileChart.capability.d.ts +2 -0
  93. package/dist/components/charts/physics/PhysicsPileChart.d.ts +60 -0
  94. package/dist/components/charts/physics/ProcessFlowChart.capability.d.ts +2 -0
  95. package/dist/components/charts/physics/ProcessFlowChart.d.ts +96 -0
  96. package/dist/components/charts/physics/chainReactionOverlay.d.ts +22 -0
  97. package/dist/components/charts/physics/chainReactionRuntime.d.ts +37 -0
  98. package/dist/components/charts/physics/chainReactionTypes.d.ts +97 -0
  99. package/dist/components/charts/physics/collisionSwarmPhysics.d.ts +27 -0
  100. package/dist/components/charts/physics/dependencyMachine.d.ts +188 -0
  101. package/dist/components/charts/physics/eventDropPhysics.d.ts +64 -0
  102. package/dist/components/charts/physics/galtonBoardPhysics.d.ts +28 -0
  103. package/dist/components/charts/physics/gauntletChartProps.d.ts +67 -0
  104. package/dist/components/charts/physics/gauntletChrome.d.ts +33 -0
  105. package/dist/components/charts/physics/gauntletController.d.ts +73 -0
  106. package/dist/components/charts/physics/gauntletEffects.d.ts +36 -0
  107. package/dist/components/charts/physics/gauntletPhysics.d.ts +71 -0
  108. package/dist/components/charts/physics/gauntletRuntime.d.ts +42 -0
  109. package/dist/components/charts/physics/gauntletTypes.d.ts +213 -0
  110. package/dist/components/charts/physics/physicalFlowPhysics.d.ts +57 -0
  111. package/dist/components/charts/physics/physicsChartShared.d.ts +57 -0
  112. package/dist/components/charts/physics/physicsChartUtils.d.ts +18 -0
  113. package/dist/components/charts/physics/physicsCustomLayout.d.ts +32 -0
  114. package/dist/components/charts/physics/physicsEncoding.d.ts +142 -0
  115. package/dist/components/charts/physics/physicsHocHandle.d.ts +53 -0
  116. package/dist/components/charts/physics/physicsHocUtils.d.ts +128 -0
  117. package/dist/components/charts/physics/physicsPilePhysics.d.ts +41 -0
  118. package/dist/components/charts/physics/physicsProcessPrimitives.d.ts +38 -0
  119. package/dist/components/charts/physics/processFlowPhysics.d.ts +97 -0
  120. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +9 -1
  121. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +9 -1
  122. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +9 -1
  123. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +16 -2
  124. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +9 -1
  125. package/dist/components/charts/shared/AnnotationLabel.d.ts +88 -0
  126. package/dist/components/charts/shared/annotationActivation.d.ts +35 -0
  127. package/dist/components/charts/shared/annotationLabelLayout.d.ts +5 -0
  128. package/dist/components/charts/shared/annotationRules.d.ts +2 -1
  129. package/dist/components/charts/shared/auditMobileVisualization.d.ts +91 -0
  130. package/dist/components/charts/shared/chartDefinitionPilot.d.ts +145 -0
  131. package/dist/components/charts/shared/chartFamilySets.d.ts +20 -0
  132. package/dist/components/charts/shared/chartSelectionUtils.d.ts +4 -0
  133. package/dist/components/charts/shared/chartSpecCore.d.ts +165 -0
  134. package/dist/components/charts/shared/chartSpecs.d.ts +8 -127
  135. package/dist/components/charts/shared/chartSpecsGeo.d.ts +2 -0
  136. package/dist/components/charts/shared/chartSpecsNetwork.d.ts +2 -0
  137. package/dist/components/charts/shared/chartSpecsOrdinal.d.ts +2 -0
  138. package/dist/components/charts/shared/chartSpecsPhysics.d.ts +2 -0
  139. package/dist/components/charts/shared/chartSpecsRealtime.d.ts +2 -0
  140. package/dist/components/charts/shared/chartSpecsValue.d.ts +2 -0
  141. package/dist/components/charts/shared/chartSpecsXY.d.ts +2 -0
  142. package/dist/components/charts/shared/colorContrast.d.ts +3 -0
  143. package/dist/components/charts/shared/colorUtils.d.ts +16 -1
  144. package/dist/components/charts/shared/datumTypes.d.ts +2 -0
  145. package/dist/components/charts/shared/diagnoseAnnotationChecks.d.ts +6 -0
  146. package/dist/components/charts/shared/diagnoseConfig.d.ts +9 -14
  147. package/dist/components/charts/shared/diagnoseMisleadingChecks.d.ts +9 -0
  148. package/dist/components/charts/shared/diagnosePhysicsChecks.d.ts +3 -0
  149. package/dist/components/charts/shared/diagnoseTypes.d.ts +10 -0
  150. package/dist/components/charts/shared/formatUtils.d.ts +3 -3
  151. package/dist/components/charts/shared/hatchFill.d.ts +87 -0
  152. package/dist/components/charts/shared/hooks.d.ts +34 -10
  153. package/dist/components/charts/shared/knownChartComponents.d.ts +9 -0
  154. package/dist/components/charts/shared/leastSquaresRegression.d.ts +16 -0
  155. package/dist/components/charts/shared/mergeShapeStyle.d.ts +3 -2
  156. package/dist/components/charts/shared/motionEncoding.d.ts +145 -0
  157. package/dist/components/charts/shared/responsiveRules.d.ts +56 -0
  158. package/dist/components/charts/shared/semanticInteractions.d.ts +42 -0
  159. package/dist/components/charts/shared/sparseArray.d.ts +1 -1
  160. package/dist/components/charts/shared/streamPropsHelpers.d.ts +17 -5
  161. package/dist/components/charts/shared/styleRules.d.ts +205 -0
  162. package/dist/components/charts/shared/temporalStrings.d.ts +7 -0
  163. package/dist/components/charts/shared/tooltipUtils.d.ts +22 -9
  164. package/dist/components/charts/shared/types.d.ts +58 -7
  165. package/dist/components/charts/shared/useAreaSeriesSetup.d.ts +16 -2
  166. package/dist/components/charts/shared/useChartSetup.d.ts +11 -4
  167. package/dist/components/charts/shared/useCustomChartSetup.d.ts +17 -5
  168. package/dist/components/charts/shared/useFrameImperativeHandle.d.ts +1 -2
  169. package/dist/components/charts/shared/useLikertAggregation.d.ts +4 -4
  170. package/dist/components/charts/shared/useNetworkChartSetup.d.ts +6 -2
  171. package/dist/components/charts/shared/useOrdinalBrush.d.ts +2 -1
  172. package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +25 -2
  173. package/dist/components/charts/shared/useStreamingLegend.d.ts +2 -2
  174. package/dist/components/charts/shared/useSyncedPushData.d.ts +49 -0
  175. package/dist/components/charts/shared/useXYLineStyle.d.ts +10 -0
  176. package/dist/components/charts/shared/useXYPointStyle.d.ts +19 -1
  177. package/dist/components/charts/shared/validateChartData.d.ts +7 -5
  178. package/dist/components/charts/shared/validationMap.d.ts +7 -9
  179. package/dist/components/charts/shared/validationMap.generated.d.ts +6 -0
  180. package/dist/components/charts/shared/withChartWrapper.d.ts +4 -3
  181. package/dist/components/charts/value/targetPresentation.d.ts +22 -0
  182. package/dist/components/charts/value/types.d.ts +5 -6
  183. package/dist/components/charts/xy/AreaChart.d.ts +9 -1
  184. package/dist/components/charts/xy/BubbleChart.d.ts +10 -1
  185. package/dist/components/charts/xy/ConnectedScatterplot.d.ts +7 -0
  186. package/dist/components/charts/xy/DifferenceChart.d.ts +1 -52
  187. package/dist/components/charts/xy/Heatmap.d.ts +2 -2
  188. package/dist/components/charts/xy/LineChart.d.ts +12 -1
  189. package/dist/components/charts/xy/MinimapChart.d.ts +1 -1
  190. package/dist/components/charts/xy/MultiAxisLineChart.d.ts +2 -2
  191. package/dist/components/charts/xy/QuadrantChart.d.ts +8 -1
  192. package/dist/components/charts/xy/Scatterplot.d.ts +11 -1
  193. package/dist/components/charts/xy/ScatterplotMatrix.d.ts +11 -1
  194. package/dist/components/charts/xy/StackedAreaChart.d.ts +16 -4
  195. package/dist/components/charts/xy/differenceSegments.d.ts +49 -0
  196. package/dist/components/charts/xy/scatterplotMatrixInteractionTypes.d.ts +12 -0
  197. package/dist/components/controls/SentenceFilter.d.ts +97 -0
  198. package/dist/components/controls/controlAudit.d.ts +24 -0
  199. package/dist/components/controls/controlContract.d.ts +57 -0
  200. package/dist/components/data/fromFlintChart.d.ts +74 -0
  201. package/dist/components/data/fromVegaLite.d.ts +46 -9
  202. package/dist/components/data/portability/index.d.ts +6 -3
  203. package/dist/components/data/portability/result.d.ts +52 -0
  204. package/dist/components/data/portability/spec.d.ts +31 -0
  205. package/dist/components/data/portability/vegaLite.d.ts +24 -6
  206. package/dist/components/export/chartConfig.d.ts +11 -0
  207. package/dist/components/realtime/types.d.ts +11 -0
  208. package/dist/components/recipes/annotationLayout.d.ts +29 -0
  209. package/dist/components/recipes/axisFixedForce.d.ts +119 -0
  210. package/dist/components/recipes/{gofishBoba.d.ts → boba.d.ts} +2 -2
  211. package/dist/components/recipes/cyclical.d.ts +39 -0
  212. package/dist/components/recipes/edgeRouter.d.ts +103 -0
  213. package/dist/components/recipes/forceLayout.d.ts +48 -0
  214. package/dist/components/recipes/forceLayoutAsync.d.ts +17 -0
  215. package/dist/components/recipes/gofishBobaHandwritten.d.ts +3 -0
  216. package/dist/components/recipes/gofishDisplayListFixtures.generated.d.ts +37 -0
  217. package/dist/components/recipes/gofishIR.d.ts +178 -132
  218. package/dist/components/recipes/gofishIRExamples.d.ts +30 -81
  219. package/dist/components/recipes/intervalLanes.d.ts +87 -0
  220. package/dist/components/recipes/intervals.d.ts +80 -0
  221. package/dist/components/recipes/isometricLandmarks.d.ts +88 -0
  222. package/dist/components/recipes/isotypeGlyphs.d.ts +17 -0
  223. package/dist/components/recipes/mobileAnnotationStrategy.d.ts +48 -0
  224. package/dist/components/recipes/mobileChartFamilyRecipes.d.ts +59 -0
  225. package/dist/components/recipes/networkAnalysis.d.ts +102 -0
  226. package/dist/components/recipes/networkLayouts.d.ts +83 -0
  227. package/dist/components/recipes/physics.d.ts +122 -0
  228. package/dist/components/recipes/physicsReference.d.ts +102 -0
  229. package/dist/components/recipes/processAggregates.d.ts +32 -0
  230. package/dist/components/recipes/processChrome.d.ts +67 -0
  231. package/dist/components/recipes/processJourney.d.ts +54 -0
  232. package/dist/components/recipes/processPhysics.d.ts +300 -0
  233. package/dist/components/recipes/processVolumeGeometry.d.ts +28 -0
  234. package/dist/components/recipes/radialCoords.d.ts +69 -0
  235. package/dist/components/recipes/random.d.ts +2 -0
  236. package/dist/components/recipes/recipeChrome.d.ts +91 -0
  237. package/dist/components/recipes/recipeGlyph.d.ts +42 -0
  238. package/dist/components/recipes/recipeLegend.d.ts +53 -1
  239. package/dist/components/recipes/recipeUtils.d.ts +52 -0
  240. package/dist/components/recipes/runs.d.ts +59 -0
  241. package/dist/components/recipes/tokenEncoding.d.ts +157 -0
  242. package/dist/components/recipes/tokenLayer.d.ts +79 -0
  243. package/dist/components/recipes/unitize.d.ts +108 -0
  244. package/dist/components/recipes/vector.d.ts +28 -0
  245. package/dist/components/recipes/waffle.d.ts +43 -0
  246. package/dist/components/rough/createRoughRenderMode.d.ts +46 -0
  247. package/dist/components/semiotic-ai-core.d.ts +47 -0
  248. package/dist/components/semiotic-ai.d.ts +53 -9
  249. package/dist/components/semiotic-controls.d.ts +20 -0
  250. package/dist/components/semiotic-experimental.d.ts +38 -9
  251. package/dist/components/semiotic-geo.d.ts +15 -0
  252. package/dist/components/semiotic-network.d.ts +15 -0
  253. package/dist/components/semiotic-ordinal.d.ts +14 -0
  254. package/dist/components/semiotic-physics-matter.d.ts +10 -0
  255. package/dist/components/semiotic-physics-rapier.d.ts +9 -0
  256. package/dist/components/semiotic-physics.d.ts +60 -0
  257. package/dist/components/semiotic-realtime-core.d.ts +34 -0
  258. package/dist/components/semiotic-realtime-react.d.ts +10 -0
  259. package/dist/components/semiotic-realtime.d.ts +4 -30
  260. package/dist/components/semiotic-recipes-core.d.ts +92 -0
  261. package/dist/components/semiotic-recipes-react.d.ts +7 -0
  262. package/dist/components/semiotic-recipes.d.ts +4 -43
  263. package/dist/components/semiotic-rough.d.ts +4 -0
  264. package/dist/components/semiotic-server-edge.d.ts +8 -0
  265. package/dist/components/semiotic-server-node.d.ts +5 -0
  266. package/dist/components/semiotic-server.d.ts +2 -2
  267. package/dist/components/semiotic-themes-core.d.ts +53 -0
  268. package/dist/components/semiotic-themes-react.d.ts +4 -0
  269. package/dist/components/semiotic-themes.d.ts +6 -76
  270. package/dist/components/semiotic-utils-core.d.ts +50 -0
  271. package/dist/components/semiotic-utils-react.d.ts +5 -0
  272. package/dist/components/semiotic-utils.d.ts +3 -39
  273. package/dist/components/semiotic-xy.d.ts +12 -0
  274. package/dist/components/semiotic.d.ts +44 -8
  275. package/dist/components/server/animatedGif.d.ts +36 -0
  276. package/dist/components/server/optionalImageTypes.d.ts +37 -0
  277. package/dist/components/server/renderEvidence.d.ts +1 -1
  278. package/dist/components/server/renderToStaticSVG.d.ts +3 -35
  279. package/dist/components/server/serverChartConfigShared.d.ts +21 -0
  280. package/dist/components/server/serverChartConfigs.d.ts +22 -12
  281. package/dist/components/server/serverChartConfigsCustom.d.ts +5 -0
  282. package/dist/components/server/serverChartConfigsGeo.d.ts +9 -0
  283. package/dist/components/server/serverChartConfigsNetwork.d.ts +8 -0
  284. package/dist/components/server/serverChartConfigsOrdinal.d.ts +16 -0
  285. package/dist/components/server/serverChartConfigsPhysics.d.ts +9 -0
  286. package/dist/components/server/serverChartConfigsXY.d.ts +11 -0
  287. package/dist/components/server/staticAnnotations.d.ts +6 -3
  288. package/dist/components/server/staticGeo.d.ts +4 -0
  289. package/dist/components/server/staticLegend.d.ts +2 -2
  290. package/dist/components/server/staticNetwork.d.ts +8 -0
  291. package/dist/components/server/staticOrdinal.d.ts +11 -0
  292. package/dist/components/server/staticPhysics.d.ts +3 -0
  293. package/dist/components/server/staticSVGChrome.d.ts +110 -0
  294. package/dist/components/server/staticXY.d.ts +4 -0
  295. package/dist/components/store/ObservationStore.d.ts +23 -2
  296. package/dist/components/store/themeSerialization.d.ts +32 -0
  297. package/dist/components/store/useChartInterrogation.d.ts +9 -0
  298. package/dist/components/stream/AccessibleDataTable.d.ts +7 -23
  299. package/dist/components/stream/AriaLiveTooltip.d.ts +9 -0
  300. package/dist/components/stream/CanvasHitTester.d.ts +4 -4
  301. package/dist/components/stream/DataSourceAdapter.d.ts +1 -1
  302. package/dist/components/stream/FocusRing.d.ts +4 -2
  303. package/dist/components/stream/FrameRuntime.d.ts +57 -0
  304. package/dist/components/stream/GeoCanvasHitTester.d.ts +1 -1
  305. package/dist/components/stream/GeoParticlePool.d.ts +1 -1
  306. package/dist/components/stream/GeoPipelineStore.d.ts +62 -3
  307. package/dist/components/stream/GeoSVGOverlay.d.ts +64 -0
  308. package/dist/components/stream/NetworkCanvasHitTester.d.ts +2 -1
  309. package/dist/components/stream/NetworkPipelineStore.d.ts +44 -36
  310. package/dist/components/stream/NetworkSSRFrame.d.ts +17 -0
  311. package/dist/components/stream/NetworkSVGOverlay.d.ts +10 -1
  312. package/dist/components/stream/OrdinalCanvasHitTester.d.ts +2 -2
  313. package/dist/components/stream/OrdinalPipelineStore.d.ts +55 -11
  314. package/dist/components/stream/OrdinalSVGOverlay.d.ts +9 -1
  315. package/dist/components/stream/OrdinalStyleResolver.d.ts +12 -0
  316. package/dist/components/stream/ParticlePool.d.ts +1 -1
  317. package/dist/components/stream/PipelineStore.d.ts +81 -174
  318. package/dist/components/stream/SVGOverlay.d.ts +6 -0
  319. package/dist/components/stream/SceneGraph.d.ts +12 -4
  320. package/dist/components/stream/StreamGeoFrame.d.ts +1 -1
  321. package/dist/components/stream/StreamNetworkFrame.d.ts +1 -1
  322. package/dist/components/stream/StreamOrdinalFrame.d.ts +1 -1
  323. package/dist/components/stream/StreamXYFrame.d.ts +2 -18
  324. package/dist/components/stream/accessibleDataRows.d.ts +33 -0
  325. package/dist/components/stream/accessorUtils.d.ts +25 -12
  326. package/dist/components/stream/annotationAccessorResolver.d.ts +2 -2
  327. package/dist/components/stream/brushAccessibility.d.ts +25 -0
  328. package/dist/components/stream/canvasBackground.d.ts +24 -0
  329. package/dist/components/stream/canvasSetup.d.ts +4 -1
  330. package/dist/components/stream/customLayoutFailure.d.ts +33 -0
  331. package/dist/components/stream/customLayoutPalette.d.ts +19 -9
  332. package/dist/components/stream/frameGraphics.d.ts +4 -0
  333. package/dist/components/stream/frameKeyboardNavigation.d.ts +45 -0
  334. package/dist/components/stream/frameThemeColors.d.ts +24 -0
  335. package/dist/components/stream/geoAnnotationAnchors.d.ts +14 -0
  336. package/dist/components/stream/geoCartogram.d.ts +17 -0
  337. package/dist/components/stream/geoCustomLayout.d.ts +59 -0
  338. package/dist/components/stream/geoDefaultTooltip.d.ts +11 -0
  339. package/dist/components/stream/geoFrameHelpers.d.ts +34 -0
  340. package/dist/components/stream/geoPipelineHelpers.d.ts +46 -0
  341. package/dist/components/stream/geoPipelineUpdateResults.d.ts +34 -0
  342. package/dist/components/stream/geoSceneBuilder.d.ts +16 -0
  343. package/dist/components/stream/geoTypes.d.ts +97 -15
  344. package/dist/components/stream/glyphDef.d.ts +98 -0
  345. package/dist/components/stream/hitTarget.d.ts +170 -0
  346. package/dist/components/stream/hitTestUtils.d.ts +2 -2
  347. package/dist/components/stream/hoverUtils.d.ts +7 -2
  348. package/dist/components/stream/keyboardNav.d.ts +4 -1
  349. package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +9 -1
  350. package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +58 -0
  351. package/dist/components/stream/layouts/hierarchyUtils.d.ts +2 -2
  352. package/dist/components/stream/networkBezier.d.ts +10 -0
  353. package/dist/components/stream/networkColorAccessors.d.ts +49 -0
  354. package/dist/components/stream/networkCustomLayoutRunner.d.ts +23 -0
  355. package/dist/components/stream/networkCustomRestyle.d.ts +15 -0
  356. package/dist/components/stream/networkDefaultTooltip.d.ts +10 -0
  357. package/dist/components/stream/networkFrameAnimation.d.ts +7 -0
  358. package/dist/components/stream/networkFrameHandleTypes.d.ts +39 -0
  359. package/dist/components/stream/networkFrameInteraction.d.ts +37 -0
  360. package/dist/components/stream/networkFrameObservations.d.ts +15 -0
  361. package/dist/components/stream/networkFramePaint.d.ts +52 -0
  362. package/dist/components/stream/networkInteractionTypes.d.ts +26 -0
  363. package/dist/components/stream/networkPipelineConfig.d.ts +22 -0
  364. package/dist/components/stream/networkPipelineHelpers.d.ts +12 -0
  365. package/dist/components/stream/networkPipelineUpdateResults.d.ts +38 -0
  366. package/dist/components/stream/networkRealtimeEncoding.d.ts +41 -0
  367. package/dist/components/stream/networkTypes.d.ts +103 -51
  368. package/dist/components/stream/ordinalCanvasRenderers.d.ts +7 -0
  369. package/dist/components/stream/ordinalDataIndex.d.ts +5 -0
  370. package/dist/components/stream/ordinalDefaultTooltip.d.ts +10 -0
  371. package/dist/components/stream/ordinalDomain.d.ts +38 -0
  372. package/dist/components/stream/ordinalPipelineUpdateResults.d.ts +31 -0
  373. package/dist/components/stream/ordinalPulse.d.ts +10 -0
  374. package/dist/components/stream/ordinalPulseResources.d.ts +3 -0
  375. package/dist/components/stream/ordinalSceneBuilders/sceneBuilderMap.d.ts +5 -0
  376. package/dist/components/stream/ordinalSceneBuilders/types.d.ts +2 -2
  377. package/dist/components/stream/ordinalSpatialIndex.d.ts +9 -0
  378. package/dist/components/stream/ordinalTypes.d.ts +68 -9
  379. package/dist/components/stream/paintNeeds.d.ts +31 -0
  380. package/dist/components/stream/physics/CapacityQueueController.d.ts +5 -0
  381. package/dist/components/stream/physics/CapacityQueueTypes.d.ts +134 -0
  382. package/dist/components/stream/physics/MatterPhysicsEngineAdapter.d.ts +42 -0
  383. package/dist/components/stream/physics/PhysicsAccessibility.d.ts +48 -0
  384. package/dist/components/stream/physics/PhysicsAnnotations.d.ts +58 -0
  385. package/dist/components/stream/physics/PhysicsBodyBudget.d.ts +26 -0
  386. package/dist/components/stream/physics/PhysicsBodySpatialIndex.d.ts +10 -0
  387. package/dist/components/stream/physics/PhysicsCanvasTheme.d.ts +26 -0
  388. package/dist/components/stream/physics/PhysicsControllers.d.ts +75 -0
  389. package/dist/components/stream/physics/PhysicsEngineAdapter.d.ts +59 -0
  390. package/dist/components/stream/physics/PhysicsEngineConformance.d.ts +23 -0
  391. package/dist/components/stream/physics/PhysicsEvidence.d.ts +25 -0
  392. package/dist/components/stream/physics/PhysicsKernel.d.ts +207 -0
  393. package/dist/components/stream/physics/PhysicsOptionalEngineAdapters.d.ts +12 -0
  394. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +86 -0
  395. package/dist/components/stream/physics/PhysicsPipelineTypes.d.ts +181 -0
  396. package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +78 -0
  397. package/dist/components/stream/physics/PhysicsSediment.d.ts +69 -0
  398. package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +18 -0
  399. package/dist/components/stream/physics/PhysicsSettledScene.d.ts +21 -0
  400. package/dist/components/stream/physics/PhysicsWorkerClient.d.ts +24 -0
  401. package/dist/components/stream/physics/PhysicsWorkerProtocol.d.ts +101 -0
  402. package/dist/components/stream/physics/PhysicsWorkerRuntime.d.ts +5 -0
  403. package/dist/components/stream/physics/RapierPhysicsEngineAdapter.d.ts +18 -0
  404. package/dist/components/stream/physics/ServiceOperationsControllers.d.ts +27 -0
  405. package/dist/components/stream/physics/ServiceOperationsTypes.d.ts +89 -0
  406. package/dist/components/stream/physics/StreamPhysicsFrame.d.ts +6 -0
  407. package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +317 -0
  408. package/dist/components/stream/physics/physicsBodyCanvas.d.ts +27 -0
  409. package/dist/components/stream/physics/physicsFrameObservations.d.ts +19 -0
  410. package/dist/components/stream/physics/physicsFrameSetup.d.ts +4 -0
  411. package/dist/components/stream/physics/physicsPipelineControls.d.ts +4 -0
  412. package/dist/components/stream/physics/physicsPipelineHelpers.d.ts +41 -0
  413. package/dist/components/stream/physics/physicsPipelineObservations.d.ts +14 -0
  414. package/dist/components/stream/physics/physicsPipelineUpdateResults.d.ts +27 -0
  415. package/dist/components/stream/physics/physicsRegionRuntime.d.ts +54 -0
  416. package/dist/components/stream/physics/physicsSemanticUI.d.ts +20 -0
  417. package/dist/components/stream/physics/usePhysicsFrameLifecyclePolicy.d.ts +18 -0
  418. package/dist/components/stream/pipelineBufferUtils.d.ts +26 -0
  419. package/dist/components/stream/pipelineConfig.d.ts +179 -0
  420. package/dist/components/stream/pipelineDecay.d.ts +21 -3
  421. package/dist/components/stream/pipelineDomainResolution.d.ts +62 -0
  422. package/dist/components/stream/pipelineIdentityOps.d.ts +26 -0
  423. package/dist/components/stream/pipelinePulse.d.ts +17 -3
  424. package/dist/components/stream/pipelineRibbons.d.ts +41 -0
  425. package/dist/components/stream/pipelineSpatialIndex.d.ts +12 -0
  426. package/dist/components/stream/pipelineStoreUpdateResults.d.ts +33 -0
  427. package/dist/components/stream/pipelineStyleResolvers.d.ts +46 -0
  428. package/dist/components/stream/pipelineTransitions.d.ts +3 -1
  429. package/dist/components/stream/pipelineUpdateContract.d.ts +69 -0
  430. package/dist/components/stream/pipelineUpdateStore.d.ts +21 -0
  431. package/dist/components/stream/pulseFrameRefresh.d.ts +22 -0
  432. package/dist/components/stream/renderBackend.d.ts +27 -0
  433. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +15 -1
  434. package/dist/components/stream/renderers/geoCanvasRenderer.d.ts +3 -2
  435. package/dist/components/stream/renderers/glyphCanvasRenderer.d.ts +6 -0
  436. package/dist/components/stream/renderers/networkParticleRenderer.d.ts +1 -1
  437. package/dist/components/stream/renderers/resolveCSSColor.d.ts +6 -0
  438. package/dist/components/stream/sceneRenderBackendTypes.d.ts +28 -0
  439. package/dist/components/stream/sceneRevisionDiagnostics.d.ts +45 -0
  440. package/dist/components/stream/streamSemanticTypes.d.ts +16 -0
  441. package/dist/components/stream/streamStoreSync.d.ts +37 -0
  442. package/dist/components/stream/streamThemeTypes.d.ts +14 -0
  443. package/dist/components/stream/svgOverlayUtils.d.ts +10 -0
  444. package/dist/components/stream/test-utils/frameScheduler.d.ts +12 -0
  445. package/dist/components/stream/test-utils/revisionConsumption.d.ts +13 -0
  446. package/dist/components/stream/titleLayout.d.ts +31 -0
  447. package/dist/components/stream/types.d.ts +165 -72
  448. package/dist/components/stream/useCanvasFrameHost.d.ts +71 -0
  449. package/dist/components/stream/useFrame.d.ts +44 -2
  450. package/dist/components/stream/useHydration.d.ts +6 -0
  451. package/dist/components/stream/useLegendCategoryEmission.d.ts +5 -0
  452. package/dist/components/stream/useSemanticFrameInteractions.d.ts +22 -0
  453. package/dist/components/stream/useUpdateResultSnapshot.d.ts +7 -0
  454. package/dist/components/stream/workerModuleUrl.d.ts +10 -0
  455. package/dist/components/stream/xyAnnotationAnchors.d.ts +13 -0
  456. package/dist/components/stream/xyCanvasRenderers.d.ts +7 -0
  457. package/dist/components/stream/xyCrosshair.d.ts +11 -0
  458. package/dist/components/stream/xyDateTicks.d.ts +9 -0
  459. package/dist/components/stream/xyDefaultTooltip.d.ts +10 -0
  460. package/dist/components/stream/xyFrameAxisTypes.d.ts +50 -0
  461. package/dist/components/stream/xySceneBuilders/types.d.ts +10 -9
  462. package/dist/controls.min.js +2 -0
  463. package/dist/controls.module.min.js +2 -0
  464. package/dist/forceLayoutWorker.js +1 -0
  465. package/dist/geo.min.js +1 -1
  466. package/dist/geo.module.min.js +1 -1
  467. package/dist/network.min.js +1 -1
  468. package/dist/network.module.min.js +1 -1
  469. package/dist/ordinal.min.js +1 -1
  470. package/dist/ordinal.module.min.js +1 -1
  471. package/dist/physics-matter.min.js +1 -0
  472. package/dist/physics-matter.module.min.js +1 -0
  473. package/dist/physics-rapier.min.js +1 -0
  474. package/dist/physics-rapier.module.min.js +1 -0
  475. package/dist/physics.min.js +2 -0
  476. package/dist/physics.module.min.js +2 -0
  477. package/dist/physicsWorker.js +1 -0
  478. package/dist/realtime.min.js +1 -1
  479. package/dist/realtime.module.min.js +1 -1
  480. package/dist/rough.min.js +1 -0
  481. package/dist/rough.module.min.js +1 -0
  482. package/dist/semiotic-ai-chunk-OG7BQUUW.module.min.js +2 -0
  483. package/dist/semiotic-ai-core.d.ts +47 -0
  484. package/dist/semiotic-ai-core.min.js +1 -0
  485. package/dist/semiotic-ai-core.module.min.js +1 -0
  486. package/dist/semiotic-ai-statisticalOverlays-CY4WKR4A.module.min.js +2 -0
  487. package/dist/semiotic-ai.d.ts +53 -9
  488. package/dist/semiotic-ai.min.js +1 -1
  489. package/dist/semiotic-ai.module.min.js +1 -1
  490. package/dist/semiotic-chunk-3FSVZ46U.module.min.js +2 -0
  491. package/dist/semiotic-controls.d.ts +20 -0
  492. package/dist/semiotic-data.min.js +1 -1
  493. package/dist/semiotic-data.module.min.js +1 -1
  494. package/dist/semiotic-experimental.d.ts +38 -9
  495. package/dist/semiotic-experimental.min.js +1 -1
  496. package/dist/semiotic-experimental.module.min.js +1 -1
  497. package/dist/semiotic-geo.d.ts +15 -0
  498. package/dist/semiotic-network.d.ts +15 -0
  499. package/dist/semiotic-ordinal.d.ts +14 -0
  500. package/dist/semiotic-physics-matter.d.ts +10 -0
  501. package/dist/semiotic-physics-rapier.d.ts +9 -0
  502. package/dist/semiotic-physics.d.ts +60 -0
  503. package/dist/semiotic-realtime-core.d.ts +34 -0
  504. package/dist/semiotic-realtime-core.min.js +1 -0
  505. package/dist/semiotic-realtime-core.module.min.js +1 -0
  506. package/dist/semiotic-realtime-react.d.ts +10 -0
  507. package/dist/semiotic-realtime-react.min.js +2 -0
  508. package/dist/semiotic-realtime-react.module.min.js +2 -0
  509. package/dist/semiotic-realtime.d.ts +4 -30
  510. package/dist/semiotic-recipes-core.d.ts +92 -0
  511. package/dist/semiotic-recipes-core.min.js +1 -0
  512. package/dist/semiotic-recipes-core.module.min.js +1 -0
  513. package/dist/semiotic-recipes-react.d.ts +7 -0
  514. package/dist/semiotic-recipes-react.min.js +2 -0
  515. package/dist/semiotic-recipes-react.module.min.js +2 -0
  516. package/dist/semiotic-recipes.d.ts +4 -43
  517. package/dist/semiotic-recipes.min.js +1 -1
  518. package/dist/semiotic-recipes.module.min.js +1 -1
  519. package/dist/semiotic-rough.d.ts +4 -0
  520. package/dist/semiotic-server-edge.d.ts +8 -0
  521. package/dist/semiotic-server-edge.min.js +1 -0
  522. package/dist/semiotic-server-edge.module.min.js +1 -0
  523. package/dist/semiotic-server-node.d.ts +5 -0
  524. package/dist/semiotic-server-node.min.js +1 -0
  525. package/dist/semiotic-server-node.module.min.js +1 -0
  526. package/dist/semiotic-server.d.ts +2 -2
  527. package/dist/semiotic-statisticalOverlays-UOMSFKVJ.module.min.js +2 -0
  528. package/dist/semiotic-themes-core.d.ts +53 -0
  529. package/dist/semiotic-themes-core.min.js +1 -0
  530. package/dist/semiotic-themes-core.module.min.js +1 -0
  531. package/dist/semiotic-themes-react.d.ts +4 -0
  532. package/dist/semiotic-themes-react.min.js +2 -0
  533. package/dist/semiotic-themes-react.module.min.js +2 -0
  534. package/dist/semiotic-themes.d.ts +6 -76
  535. package/dist/semiotic-themes.min.js +1 -2
  536. package/dist/semiotic-themes.module.min.js +1 -2
  537. package/dist/semiotic-utils-core.d.ts +50 -0
  538. package/dist/semiotic-utils-core.min.js +1 -0
  539. package/dist/semiotic-utils-core.module.min.js +1 -0
  540. package/dist/semiotic-utils-react.d.ts +5 -0
  541. package/dist/semiotic-utils-react.min.js +2 -0
  542. package/dist/semiotic-utils-react.module.min.js +2 -0
  543. package/dist/semiotic-utils.d.ts +3 -39
  544. package/dist/semiotic-utils.min.js +1 -2
  545. package/dist/semiotic-utils.module.min.js +1 -2
  546. package/dist/semiotic-value.min.js +1 -1
  547. package/dist/semiotic-value.module.min.js +1 -1
  548. package/dist/semiotic-xy.d.ts +12 -0
  549. package/dist/semiotic.d.ts +44 -8
  550. package/dist/semiotic.min.js +1 -1
  551. package/dist/semiotic.module.min.js +1 -1
  552. package/dist/server.min.js +1 -1
  553. package/dist/server.module.min.js +1 -1
  554. package/dist/test-utils/capturedFrameProps.d.ts +67 -0
  555. package/dist/test-utils/frameMock.d.ts +12 -9
  556. package/dist/xy-chunk-IWD6IB6V.module.min.js +2 -0
  557. package/dist/xy-statisticalOverlays-7RWG6LJT.module.min.js +2 -0
  558. package/dist/xy.min.js +1 -1
  559. package/dist/xy.module.min.js +1 -1
  560. package/package.json +259 -88
  561. package/spec/README.md +152 -0
  562. package/spec/bindings/README.md +35 -0
  563. package/spec/bindings/vega-lite.mjs +112 -0
  564. package/spec/v0.1/annotation-provenance.schema.json +127 -0
  565. package/spec/v0.1/audience-profile.schema.json +67 -0
  566. package/spec/v0.1/chart-capability.schema.json +186 -0
  567. package/dist/components/recipes/gofish.d.ts +0 -207
  568. package/dist/components/recipes/gofishInterpreter.d.ts +0 -52
  569. package/dist/components/recipes/gofishLambdas.d.ts +0 -145
  570. package/dist/semiotic-ai-semiotic-ai-u954ylUn.js +0 -2
  571. package/dist/semiotic-ai-statisticalOverlays-CU7jW05Q.js +0 -1
  572. package/dist/semiotic-semiotic-BmrYbi99.js +0 -2
  573. package/dist/semiotic-statisticalOverlays-IjZw8Lsu.js +0 -1
  574. package/dist/xy-semiotic-xy-Dufu3D0-.js +0 -2
  575. package/dist/xy-statisticalOverlays-3Ni9bRph.js +0 -1
package/dist/geo.min.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";const e=require("react/jsx-runtime"),t=require("react"),n=require("d3-geo"),o=require("d3-scale"),i=require("d3-quadtree"),r=require("d3-array"),s=require("d3-hierarchy"),l=require("d3-shape"),a=require("regression"),c=require("d3-zoom"),u=require("d3-selection");function d(e){return e&&e.__esModule?e:{default:e}}function h(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const f=h(t),p=d(a);class g{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(o+i)%this._capacity,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),n.push(e),this.buffer[r]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}function m(e,t,n){return e+(t-e)*n}function y(e,t,n){var o,i,r;if(1>=n)return 1;const s=null!==(o=e.minOpacity)&&void 0!==o?o:.1,l=n-1-t;switch(e.type){case"linear":return s+(1-l/(n-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return s+Math.pow(.5,l/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*n)>l?1:s;default:return 1}}function v(e){let t=1/0,n=-1/0;for(const o of e)t>o&&(t=o),o>n&&(n=o);return[t,n]}function b(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}function x(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 j={mercator:n.geoMercator,equalEarth:n.geoEqualEarth,albersUsa:n.geoAlbersUsa,orthographic:n.geoOrthographic,naturalEarth:n.geoNaturalEarth1,equirectangular:n.geoEquirectangular};function k(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function w(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function O(e,t,n){return e?Object.assign(Object.assign({},n),"function"==typeof e?e(t):e):Object.assign({},n)}function M(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 S(e,t,n=24){const o=t[0]-e[0],i=t[1]-e[1],r=Math.sqrt(o*o+i*i);if(0===r)return[e,t];const s=-i/r,l=o/r,a=Math.min(.3*r,80),c=(e[0]+t[0])/2+s*a,u=(e[1]+t[1])/2+l*a,d=[];for(let o=0;n>=o;o++){const i=o/n,r=1-i;d.push([r*r*e[0]+2*r*i*c+i*i*t[0],r*r*e[1]+2*r*i*u+i*i*t[1]])}return d}function A(e,t){if(2>e.length)return e;const n=t/2+1,o=[];for(let t=0;e.length>t;t++){const i=e[t];let r,s;0===t?(r=e[1][0]-i[0],s=e[1][1]-i[1]):t===e.length-1?(r=i[0]-e[t-1][0],s=i[1]-e[t-1][1]):(r=e[t+1][0]-e[t-1][0],s=e[t+1][1]-e[t-1][1]);const l=Math.sqrt(r*r+s*s)||1;o.push([i[0]+s/l*n,i[1]+-r/l*n])}return o}function C(e,t,n,o,i){const r=t[0]-e[0],s=t[1]-e[1],l=Math.sqrt(r*r+s*s);if(0===l)return[e,t];const a=s/l,c=-r/l,u=i/2+1;return[[e[0]+a*u,e[1]+c*u],[t[0]+a*u,t[1]+c*u]]}class P{constructor(e){this.scene=[],this.scales=null,this.version=0,this._quadtree=null,this._maxPointRadius=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this._hasRenderedOnce=!1,this.config=e}updateConfig(e){this.config=Object.assign(Object.assign({},this.config),e)}setAreas(e){this.areas=e}setPoints(e){this.pointData=e,this.streaming=!1}setLines(e){this.lineData=e.slice()}initStreaming(e=500){this.pointBuffer=new g(e),this.timestampBuffer=new g(e),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming(),this.pointBuffer.push(e),this.timestampBuffer.push(performance.now()),this.lastIngestTime=performance.now()}pushMany(e){this.pointBuffer||this.initStreaming();const t=performance.now();for(const n of e)this.pointBuffer.push(n),this.timestampBuffer.push(t);this.lastIngestTime=t}pushLine(e){null!=e&&"object"==typeof e&&(this.lineData.push(e),this.version++)}pushManyLines(e){if(!Array.isArray(e)||0===e.length)return;const t=e.filter(e=>null!=e&&"object"==typeof e);if(0!==t.length){for(const e of t)this.lineData.push(e);this.version++}}removeLine(e){const{lineIdAccessor:t}=this.config;if(!t)throw Error("removeLine() requires lineIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],o=new Set(Array.isArray(e)?e:[e]),i=[];return this.lineData=this.lineData.filter(e=>!o.has(n(e)+"")||(i.push(e),!1)),i.length>0&&this.version++,i}getLines(){return this.lineData.slice()}removePoint(e){const{pointIdAccessor:t}=this.config;if(!t)throw Error("removePoint() requires pointIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],o=new Set(Array.isArray(e)?e:[e]);if(this.streaming&&this.pointBuffer){const e=e=>o.has(n(e)+"");if(this.timestampBuffer&&this.timestampBuffer.size>0){const t=this.timestampBuffer.toArray(),n=new Set;this.pointBuffer.forEach((t,o)=>{e(t)&&n.add(o)}),this.timestampBuffer.clear();for(let e=0;t.length>e;e++)n.has(e)||this.timestampBuffer.push(t[e])}const t=this.pointBuffer.remove(e);return t.length>0&&this.version++,t}{const e=[];return this.pointData=this.pointData.filter(t=>!o.has(n(t)+"")||(e.push(t),!1)),e.length>0&&this.version++,e}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.scene=[],this.scales=null,this._hasRenderedOnce=!1,this.activeTransition=null,this.prevPositions=null,this._quadtree=null,this._maxPointRadius=0,this.version++}computeScene(e){const{config:t}=this;this.projection=function(e){if(!e)return n.geoEqualEarth();if("string"==typeof e){const t=j[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),n.geoEqualEarth())}if("object"==typeof e&&"type"in e){const t=j[e.type],o=t?t():n.geoEqualEarth();return e.rotate&&"rotate"in o&&o.rotate(e.rotate),e.center&&"center"in o&&o.center(e.center),o}return e}(t.projection),this.geoPath=n.geoPath(this.projection),this.fitProjection(e),this.geoPath=n.geoPath(this.projection);const o=this.projection;this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null};const i=this.scene;if(this.scene=this.buildSceneNodes(e),this.rebuildQuadtree(),t.projectionTransform&&this.applyCartogramTransform(t.projectionTransform,e),t.decay&&this.streaming&&this.applyDecay(),t.pulse&&this.streaming&&this.applyPulse(),t.transition&&!this._hasRenderedOnce&&this.scene.length>0&&t.introAnimation){const t=e.width/2,n=e.height/2,o=this.scene.filter(e=>"point"===e.type).map(e=>Object.assign(Object.assign({},e),{x:t,y:n}));o.length>0&&this.startTransition(o)}this._hasRenderedOnce=!0,t.transition&&i.length>0&&this.startTransition(i),this.version++}fitProjection(e){var t,n,o,i,r;const s=this.projection,l=this.config,a=[...this.areas],c=k(l.xAccessor,"lon"),u=k(l.yAccessor,"lat"),d=this.getPoints();if(d.length>0){const e=d.map(e=>[c(e),u(e)]);a.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const h=w(l.lineDataAccessor);for(const e of this.lineData){const t=h(e);if(t&&t.length>0){const e=t.map(e=>[c(e),u(e)]);a.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==a.length){if(l.projectionExtent){const[[t,n],[o,i]]=l.projectionExtent;s.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[t,n],[o,n],[o,i],[t,i],[t,n]]]}})}else if(s.clipAngle&&(null!==(t=s.clipAngle())&&void 0!==t?t:0)>0){const t=null!==(n=l.fitPadding)&&void 0!==n?n:0,o=Math.min(e.width,e.height);s.scale(o/2-o*t),s.translate([e.width/2,e.height/2])}else{const t=null!==(o=l.fitPadding)&&void 0!==o?o:0,n=e.width*t,i=e.height*t;s.fitExtent([[n,i],[e.width-n,e.height-i]],{type:"FeatureCollection",features:a})}this.baseScale=s.scale(),this.baseTranslate=s.translate(),this.baseRotation=null!==(r=null===(i=s.rotate)||void 0===i?void 0:i.call(s))&&void 0!==r?r:[0,0,0]}}applyZoomTransform(e,t){const o=this.projection;o&&(o.scale(this.baseScale*e.k),o.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=n.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const o=this.projection;o&&(o.scale(this.baseScale*e),o.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=n.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const o=this.projection;o&&o.rotate&&(o.rotate(e),this.geoPath=n.geoPath(o),this.scales={projection:o,geoPath:this.geoPath,projectedPoint:(e,t)=>o([e,t]),invertedPoint:(e,t)=>o.invert?o.invert([e,t]):null},this.scene=this.buildSceneNodes(t),this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}setRotation(e){const t=this.projection;t&&t.rotate&&t.rotate(e)}getRotation(){var e,t,n;return null!==(n=null===(t=null===(e=this.projection)||void 0===e?void 0:e.rotate)||void 0===t?void 0:t.call(e))&&void 0!==n?n:this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}rebuildQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&(t++,n.r>e&&(e=n.r));if(this._maxPointRadius=e,P.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const n=Array(t);let o=0;for(const e of this.scene)"point"===e.type&&(n[o++]=e);this._quadtree=i.quadtree().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){var t,o,i;const r=[],{config:s}=this,l=this.projection,a=this.geoPath,c=k(s.xAccessor,"lon"),u=k(s.yAccessor,"lat"),d=function(e){var t,n;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.surface)||"#e0e0e0",stroke:(null===(n=e.themeSemantic)||void 0===n?void 0:n.border)||"#999",strokeWidth:.5,fillOpacity:1}}(s),h=function(e){var t;return{stroke:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",strokeWidth:1.5,fill:"none"}}(s),f=function(e){var t;return{fill:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)||"#4e79a7",r:4,fillOpacity:.8}}(s);if(s.graticule){const t=!0===s.graticule?{}:s.graticule,o=n.geoGraticule();t.step&&o.step(t.step);const i=a(o())||"";i&&r.push({type:"geoarea",pathData:i,centroid:[e.width/2,e.height/2],bounds:[[0,0],[e.width,e.height]],screenArea:0,style:{fill:"none",stroke:t.stroke||"#e0e0e0",strokeWidth:t.strokeWidth||.5,strokeDasharray:t.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of this.areas){const t=a(e);if(!t)continue;const n=a.centroid(e),o=a.bounds(e),i=a.area(e),l=O(s.areaStyle,e,d);r.push({type:"geoarea",pathData:t,centroid:n,bounds:o,screenArea:i,style:l,datum:e,interactive:!0})}const p=w(s.lineDataAccessor);for(const t of this.lineData){const o=p(t);if(!o||2>o.length)continue;let i=[];if("geo"===s.lineType){const e=Array(o.length);for(let t=0;o.length>t;t++)e[t]=[c(o[t]),u(o[t])];for(let t=0;e.length-1>t;t++){const o=e[t],r=e[t+1],s=n.geoDistance(o,r)||0,a=Math.max(2,Math.ceil(s/(Math.PI/180))),c=n.geoInterpolate(o,r);for(let e=0;a>=e;e++){if(t>0&&0===e)continue;const n=l(c(e/a));null!=n&&i.push(n)}}}else for(let e=0;o.length>e;e++){const t=o[e],n=l([c(t),u(t)]);null!=n&&i.push(n)}if(2>i.length)continue;const a=O(s.lineStyle,t,h),d="number"==typeof a.strokeWidth?a.strokeWidth:1;2!==o.length||2>i.length||"arc"!==s.flowStyle?2!==o.length||2>i.length||"offset"!==s.flowStyle||(i="geo"===s.lineType?A(i,d):C(i[0],i[i.length-1],0,0,d)):i=S(i[0],i[i.length-1]);const f=M(i,e.width);if(f.length>1)for(const e of f){if(2>e.length)continue;const n={type:"line",path:e,style:Object.assign(Object.assign({},a),{_edgeFade:!0}),datum:t};r.push(n)}else r.push({type:"line",path:2>i.length&&f[0]||i,style:a,datum:t})}const g=this.getPoints(),m=s.pointIdAccessor?"function"==typeof s.pointIdAccessor?s.pointIdAccessor:e=>e[s.pointIdAccessor]:null,y=l.clipAngle&&null!==(t=l.clipAngle())&&void 0!==t?t:0,v=y>0?y*Math.PI/180:null,b=l.rotate?l.rotate():[0,0,0],x="function"==typeof l.center?l.center():[0,0],j=[(null!==(o=x[0])&&void 0!==o?o:0)-b[0],(null!==(i=x[1])&&void 0!==i?i:0)-b[1]];for(let e=0;g.length>e;e++){const t=g[e],o=c(t),i=u(t);if(null!=v&&n.geoDistance([o,i],j)>v)continue;const a=l([o,i]);if(!a)continue;const d=s.pointStyle?s.pointStyle(t):Object.assign({},f),h={type:"point",x:a[0],y:a[1],r:d.r||4,style:d,datum:t,pointId:m?m(t)+"":void 0};r.push(h)}return r}applyCartogramTransform(e,t){var n,i,r;const s=this.scene.filter(e=>"point"===e.type);if(2>s.length)return;const l=null!==(n=e.strength)&&void 0!==n?n:1;if(0===l)return;const a=e.centerAccessor?"function"==typeof e.centerAccessor?e.centerAccessor:t=>t[e.centerAccessor]:e=>e.id,c="function"==typeof e.costAccessor?e.costAccessor:t=>t[e.costAccessor],u=s.find(t=>t.datum&&a(t.datum)+""==e.center+"");if(!u)return void("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${e.center}" not found in point data`));const d=u.x,h=u.y,f=b(s.map(e=>e.datum?c(e.datum):NaN).filter(e=>isFinite(e)&&e>=0),1),p=Math.min(t.width,t.height)/2,g=o.scaleLinear().domain([0,f]).range([0,p]);this.cartogramLayout={cx:d,cy:h,maxCost:f,availableRadius:p},this.areas.length>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them."),this.scene=this.scene.filter(e=>"geoarea"!==e.type||!e.interactive);for(const e of s){if(e===u)continue;if(!e.datum)continue;const t=Math.atan2(e.y-h,e.x-d),n=Math.sqrt(Math.pow(e.x-d,2)+Math.pow(e.y-h,2)),o=c(e.datum),i=n+((isFinite(o)?g(o):n)-n)*l;e.x=d+Math.cos(t)*i,e.y=h+Math.sin(t)*i}const m=t.width/2,y=t.height/2,v=m-u.x,x=y-u.y;if(Math.abs(v)>.5||Math.abs(x)>.5)for(const e of s)e.x+=v,e.y+=x;this.cartogramLayout={cx:m,cy:y,maxCost:f,availableRadius:p};const j=this.scene.filter(e=>"line"===e.type);if(j.length>0&&"fractional"!==e.lineMode){const e=new Map;for(const t of s)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of j){const n=null===(i=t.datum)||void 0===i?void 0:i.source,o=null===(r=t.datum)||void 0===r?void 0:r.target;if(n&&o){const i=e.get(n+""),r=e.get(o+"");i&&r&&(t.path=[i,r])}}}}applyDecay(){const e=this.config.decay;if(!e||!this.pointBuffer)return;const t=this.pointBuffer.size;if(0===t)return;const n=this.scene.filter(e=>"point"===e.type);for(let o=0;n.length>o;o++){const i=y(e,o,t);n[o]._decayOpacity=i,n[o].style=Object.assign(Object.assign({},n[o].style),{opacity:i})}}applyPulse(){var e;const t=this.config.pulse;if(!t||!this.timestampBuffer)return;const n=performance.now(),o=this.scene.filter(e=>"point"===e.type),i=this.timestampBuffer.toArray();for(let r=0;o.length>r&&i.length>r;r++){const s=x(t,i[r],n);s>0&&(o[r]._pulseIntensity=s,o[r]._pulseColor=t.color||"rgba(255,255,255,0.6)",o[r]._pulseGlowRadius=null!==(e=t.glowRadius)&&void 0!==e?e:4)}}get hasActivePulses(){var e;return function(e,t){var n;if(!t||0===t.size)return!1;const o="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=e.duration)&&void 0!==n?n:500,r=t.peek();return null!=r&&i>o-r}(null!==(e=this.config.pulse)&&void 0!==e?e:{},this.timestampBuffer)}startTransition(e){var t,n,o,i;const r=null!==(n=null===(t=this.config.transition)||void 0===t?void 0:t.duration)&&void 0!==n?n:300;if(0>=r)return;const s=new Map;for(const t of e)"point"===t.type&&t.pointId&&s.set(t.pointId,[t.x,t.y]);const l=this.scene.filter(e=>"point"===e.type);let a=!1;for(const e of l)if(e.pointId){const t=s.get(e.pointId);t&&(e._targetX=e.x,e._targetY=e.y,e.x=t[0],e.y=t[1],(Math.abs(t[0]-e._targetX)>.5||Math.abs(t[1]-e._targetY)>.5)&&(a=!0))}for(const e of l)e.pointId&&!s.has(e.pointId)&&(e._targetOpacity=null!==(i=null===(o=e.style)||void 0===o?void 0:o.opacity)&&void 0!==i?i:1,e.style=Object.assign(Object.assign({},e.style),{opacity:0}),a=!0);a&&(this.activeTransition={startTime:performance.now(),duration:r})}cancelIntroAnimation(){this.activeTransition=null}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t),o=this.scene.filter(e=>"point"===e.type);for(const e of o){if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=m(e.x,e._targetX,n),e.y=m(t,e._targetY,n)}null!=e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style),{opacity:e._targetOpacity*n}))}if(t>=1){for(const e of o)null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0),null!=e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style),{opacity:e._targetOpacity}),e._targetOpacity=void 0);return this.activeTransition=null,!1}return!0}}function z(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function R(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function L(e,t){const n=R(e);if(!n)return!1;const o=R(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}function D(e,t,n,o,i,r,s=0){if(r){const e=function(e,t,n,o,i,r=e=>e.x,s=e=>e.y,l=e=>e.r){const a=Math.max(o,i+5,12),c=t-a,u=t+a,d=n-a,h=n+a;let f=null,p=1/0;return e.visit((e,i,a,g,m)=>{if(i>u||c>g||a>h||d>m)return!0;if(!e.length){let i=e;do{const e=i.data,a=r(e)-t,c=s(e)-n,u=Math.sqrt(a*a+c*c);z(l(e),o)>=u&&p>u&&(f=e,p=u),i=i.next}while(i)}return!1}),f?{node:f,distance:p}:null}(r,t,n,o,s);if(e)return e}else{let i=null,r=o;for(const s of e){if("point"!==s.type)continue;const e=s.x-t,l=s.y-n,a=Math.sqrt(e*e+l*l);z(s.r,o)>=a&&r>a&&(i=s,r=a)}if(i)return{node:i,distance:r}}for(let o=e.length-1;o>=0;o--){const r=e[o];if("geoarea"!==r.type)continue;const s=r;if(!1===s.interactive)continue;const[[l,a],[c,u]]=s.bounds;if(!(l>t||t>c||a>n||n>u)&&(s._cachedPath2D||(s._cachedPath2D=new Path2D(s.pathData)),i.isPointInPath(s._cachedPath2D,t,n)))return{node:s,distance:0}}let l=null,a=o;for(const o of e){if("line"!==o.type)continue;const e=o,{path:i}=e,r=Math.max((e.style.strokeWidth||2)+4,5);for(let o=0;i.length-1>o;o++){const[s,c]=i[o],[u,d]=i[o+1],h=I(t,n,s,c,u,d);r>=h&&a>h&&(l=e,a=h)}}return l?{node:l,distance:a}:null}function I(e,t,n,o,i,r){const s=i-n,l=r-o,a=s*s+l*l;if(0===a)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*s+(t-o)*l)/a;c=Math.max(0,Math.min(1,c));const u=o+c*l;return Math.sqrt(Math.pow(e-(n+c*s),2)+Math.pow(t-u,2))}function N(n){let o=null;const i=()=>(o||(o=t.createContext(null)),o),r=$(n);return[function({children:o,initialState:r}){const s=t.useRef(r),l=t.useMemo(()=>$(n,s.current),[]),a=i();return e.jsx(a.Provider,{value:l,children:o})},(e,n)=>{var o;const s=i(),l=null!==(o=t.useContext(s))&&void 0!==o?o:r,a=t.useRef(e);a.current=e;const c=t.useRef({hasValue:!1,value:void 0}),u=t.useCallback(()=>{const e=a.current(l.getState()),t=c.current;return t.hasValue&&n&&n(t.value,e)?t.value:(c.current={hasValue:!0,value:e},e)},[l,n]),d=t.useCallback(()=>a.current(l.getState()),[l]);return t.useSyncExternalStore(l.subscribe,u,d)}]}function $(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 E(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 W(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:B})})),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}P.QUADTREE_THRESHOLD=500;const B=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],_={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}},T={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}},F={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:B,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 H(e,t){if("light"===t)return _;if("dark"===t)return T;if("high-contrast"===t)return F;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?T:_;return W(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 W(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[q,G]=N(e=>({theme:_,setTheme(t){e(e=>({theme:H(e.theme,t)}))}}));const V=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,U=new WeakMap;let Z=0,Y=!1,X=null,Q=null,K=null;function J(e,t){var n,o;if(!t)return t;const i=V.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(Y)return;if("undefined"==typeof window||"undefined"==typeof document)return;Y=!0;const e=()=>{Z++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(X=new MutationObserver(e),X.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Q=window.matchMedia("(prefers-color-scheme: dark)"),K=e,"function"==typeof Q.addEventListener?Q.addEventListener("change",K):"function"==typeof Q.addListener&&Q.addListener(K)}catch(e){}}();let s=U.get(r);s&&s.version===Z||(s={version:Z,map:new Map},U.set(r,s));const l=s.map.get(t);if(void 0!==l)return l;const a=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return s.map.set(t,a),a}const ee="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function te(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function ne(e){const n=function(){const[e,n]=t.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>n(e.matches))},[]),e}(),o=t.useRef(n);o.current=n;const[i,r]=function(e,n,o){const i=t.useRef(null),[r,s]=t.useState(null);return t.useEffect(()=>{if(!n&&!o)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;s(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[i,[n&&r?r.w:e[0],o&&r?r.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),s=t.useMemo(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),l=r[0]-s.left-s.right,a=r[1]-s.top-s.bottom,c=te(e.foregroundGraphics,r,s),u=te(e.backgroundGraphics,r,s),d=G(e=>e.theme),{transition:h,introEnabled:p}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),g="semiotic-table-"+f.useId(),m=t.useRef(0),y=t.useRef(()=>{}),v=t.useCallback(()=>{m.current||(m.current=requestAnimationFrame(()=>y.current()))},[]);t.useEffect(()=>()=>{m.current&&(cancelAnimationFrame(m.current),m.current=0)},[]);const b=t.useRef(()=>{}),x=t.useRef(()=>{}),j=t.useRef(null),k=t.useRef(0),w=t.useCallback(()=>{k.current=0;const e=j.current;j.current=null,e&&b.current(e)},[]),O=t.useCallback(e=>{j.current={clientX:e.clientX,clientY:e.clientY},0===k.current&&(k.current=requestAnimationFrame(w))},[w]),M=t.useCallback(()=>{j.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0),x.current()},[]);t.useEffect(()=>()=>{j.current=null,0!==k.current&&(cancelAnimationFrame(k.current),k.current=0)},[]);const S=e.themeDirtyRef;return ee(()=>{S&&(Z++,S.current=!0,v())},[d,v,S]),{reducedMotion:n,reducedMotionRef:o,responsiveRef:i,size:r,margin:s,adjustedWidth:l,adjustedHeight:a,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:h,introEnabled:p,tableId:g,rafRef:m,renderFnRef:y,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:O,onPointerLeave:M}}const oe={fresh:1,aging:.7,stale:.45,expired:.25},ie={alpha:1,band:"fresh",isStale:!1};function re({isStale:t,position:n}){return e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===n?{top:4,left:4}:"bottom-left"===n?{bottom:4,left:4}:"bottom-right"===n?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:t?"#dc3545":"#28a745",color:"white"}),children:t?"STALE":"LIVE"})}const se={fill:(t,n)=>e.jsx("rect",{style:t,width:n,height:n}),line:(t,n)=>e.jsx("line",{style:t,x1:0,y1:0,x2:n,y2:n})};function le(e,t,n,o,i){let r;return r="function"==typeof n?n(e):(0,se[n])(o(e,t),i),r}function ae({swatchSize:t}){return e.jsx("path",{d:`M${.25*t},${.55*t} L${.45*t},${.75*t} L${.8*t},${.3*t}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function ce(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const ue=(t,n,o,i,r,s,l,a,c,u,d)=>{const{type:h="fill",styleFn:f,items:p}=t,g=[];let m=0;const y=!(!n&&!o),v="isolate"===u||void 0===u&&null!=r,{swatchSize:b,labelGap:x,rowHeight:j}=d;return p.forEach((t,u)=>{const d=le(t,u,h,f,b),k=ce(t,i,r),w=r&&r.size>0&&r.has(t.label);g.push(e.jsxs("g",{transform:`translate(0,${m})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:y?a===s&&u===l?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&v?w||!1:void 0,"aria-current":y&&!v&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:y?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+p.length)%p.length;c(a,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:y?e=>{c(a,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+x+2+7*t.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),d,w&&e.jsx(ae,{swatchSize:b}),e.jsx("text",{y:b/2,x:b+x,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),m+=j}),g};function de({config:t,orientation:n="vertical",width:o=100}){const{colorFn:i,domain:r,label:s,format:l}=t,a=l||(e=>Math.round(100*e)/100+""),c="grad-legend-"+f.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),l=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[0]+n*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:u})}),s&&e.jsx("text",{x:l+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("rect",{x:l,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:l,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),e.jsx("text",{x:l+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])})]})}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(r[1]-n*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[s&&e.jsx("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:u})}),e.jsx("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function he(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,legendInteraction:l,title:a="Legend",width:c=100,height:u=20,orientation:d="vertical",legendLayout:h}=t,p=function(e){var t,n,o,i,r;const s=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),l=Math.max(s,null!==(n=null==e?void 0:e.rowHeight)&&void 0!==n?n:22);return{swatchSize:s,labelGap:Math.max(0,null!==(o=null==e?void 0:e.labelGap)&&void 0!==o?o:6),itemGap:Math.max(0,null!==(i=null==e?void 0:e.itemGap)&&void 0!==i?i:10),rowHeight:l,align:"left"===(null==e?void 0:e.align)?"start":"right"===(null==e?void 0:e.align)?"end":null!==(r=null==e?void 0:e.align)&&void 0!==r?r:"start",maxWidth:null==e?void 0:e.maxWidth}}(h),[g,m]=f.useState(0),[y,v]=f.useState(0),b=f.useCallback((e,t)=>{m(e),v(t)},[]),x="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:l,focusedItemIndex:a,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=24;const f=[];return t.forEach((t,p)=>{h+=5,f.push(e.jsx("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+p)),h+=8,t.label&&(h+=16,f.push(e.jsx("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+p)),h+=8),f.push(e.jsx("g",{className:"legend-item",transform:`translate(0,${h})`,children:ue(t,o,i,r,s,l,a,p,c,u,d)},"legend-group-"+p)),h+=t.items.length*d.rowHeight+8}),f})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:g,focusedItemIndex:y,onFocusedIndexChange:b,legendInteraction:l,metrics:p}):(({legendGroups:t,height:n,width:o,customClickBehavior:i,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:l,focusedGroupIndex:a,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d,metrics:h})=>{var f;let p=0;const g=[];t.forEach((t,n)=>{var f;let m=0;t.label&&(m+=16);const y=((t,n,o,i,r,s,l,a,c,u,d,h)=>{const{type:f="fill",styleFn:p,items:g}=t,m=[],{swatchSize:y,labelGap:v,itemGap:b,rowHeight:x,align:j}=d,k=!(!n&&!o),w="isolate"===u||void 0===u&&null!=r,O=g.map(e=>y+v+7*e.label.length),M=[];let S=0,A=0;O.forEach((e,t)=>{const n=0===A?e:A+b+e;h&&h>0&&A>0&&n>h?(M.push({start:S,end:t,width:A}),S=t,A=e):A=n}),g.length>0&&M.push({start:S,end:g.length,width:A}),M.forEach((t,u)=>{let d="center"===j?Math.max(0,((null!=h?h:t.width)-t.width)/2):"end"===j?Math.max(0,(null!=h?h:t.width)-t.width):0;for(let h=t.start;t.end>h;h++){const t=g[h],j=le(t,h,f,p,y),M=ce(t,i,r),S=r&&r.size>0&&r.has(t.label);m.push(e.jsxs("g",{transform:`translate(${d},${u*x})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:k?a===s&&h===l?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?S||!1:void 0,"aria-current":k&&!w&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:k?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(h+("ArrowRight"===e.key?1:-1)+g.length)%g.length;c(a,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:k?e=>{c(a,h),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:M,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:y+v+2+7*t.label.length,height:y+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),j,S&&e.jsx(ae,{swatchSize:y}),e.jsx("text",{y:y/2,x:y+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+h)),d+=O[h]+b}});const C=Math.max(0,...M.map(e=>e.width)),P=M.length;return{items:m,offset:C,totalRows:P,totalHeight:P*x}})(t,i,r,s,l,a,c,n,u,d,h,null!==(f=h.maxWidth)&&void 0!==f?f:o);m+=y.offset+5,g.push(Object.assign(Object.assign({label:t.label},y),{offset:m,totalRows:y.totalRows,totalHeight:y.totalHeight})),p+=m+12});const m=null!==(f=h.maxWidth)&&void 0!==f?f:o;let y=p>m?0:"center"===h.align?Math.max(0,(m-p)/2):"end"===h.align?Math.max(0,m-p):0;const v=[];return g.forEach((o,i)=>{const r=t[i];r.label&&(v.push(e.jsx("text",{transform:`translate(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),y+=16),v.push(e.jsx("g",{className:"legend-item",transform:`translate(${y},0)`,children:o.items},"legend-group-"+i)),y+=o.offset+5,t[i+1]&&v.push(e.jsx("line",{stroke:"gray",x1:y,y1:-8,x2:y,y2:(o.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),y+=12}),e.jsx("g",{children:v})})({legendGroups:n||[],title:a,height:u,width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:g,focusedItemIndex:y,onFocusedIndexChange:b,legendInteraction:l,metrics:p}),j=!(!o&&!i);return e.jsxs("g",{role:j?"listbox":void 0,"aria-multiselectable":!(!j||"isolate"!==l&&(void 0!==l||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===d&&e.jsx("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),x]})}function fe(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function pe(t){var n;const{legend:o,totalWidth:i,totalHeight:r,margin:s,legendPosition:l="right",legendLayout:a,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:f,legendInteraction:p}=t;if(!o)return null;const g="top"===l||"bottom"===l,m=!!c,y=Math.max(1,g?null!==(n=null==a?void 0:a.maxWidth)&&void 0!==n?n:Math.max(0,i-s.left-s.right):100);let v,b;return"left"===l?(v=Math.max(4,s.left-y-10),b=s.top):"top"===l?(v=s.left,b=m?32:8):"bottom"===l?(v=s.left,b=r-s.bottom+38):(v=i-s.right+10,b=s.top),e.jsx("g",{transform:`translate(${v}, ${b})`,children:(x=o,"object"==typeof x&&null!==x&&"gradient"in x?e.jsx(de,{config:o.gradient,orientation:g?"horizontal":"vertical",width:y}):fe(o)?e.jsx(he,{legendGroups:o.legendGroups,title:"",width:y,orientation:g?"horizontal":"vertical",legendLayout:a,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:f,legendInteraction:p}):o)});var x}function ge(e){return"string"==typeof e?{type:e}:e}function me({orient:n,config:o,values:i,scale:s,size:l,length:a}){const c=function(e){var t,n,o,i,r;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(o),u="top"===n||"bottom"===n,d=t.useMemo(()=>{if(0===i.length)return null;const t=s.domain(),o=l-8;if("boxplot"===c.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],i=t[Math.floor(.5*n)],r=t[Math.floor(.75*n)],s=r-o;return{q1:o,median:i,q3:r,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],r+1.5*s)}}(i);if(!t)return null;const{q1:r,median:l,q3:a,whiskerLow:d,whiskerHigh:h}=t,f=Math.min(.5*o,20),p=(o-f)/2+4;if(u){const t=s(r),o=s(a),i=s(l),u=s(d),g=s(h),m="top"===n?-1:1,y=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:u,y1:y+m*(p+f/2),x2:g,y2:y+m*(p+f/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:u,y1:y+m*p,x2:u,y2:y+m*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:g,y1:y+m*p,x2:g,y2:y+m*(p+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:Math.min(t,o),y:"top"===n?y-p-f:y+p,width:Math.abs(o-t),height:f,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:i,y1:"top"===n?y-p-f:y+p,x2:i,y2:"top"===n?y-p:y+p+f,stroke:c.fill,strokeWidth:2})]})}{const t=s(r),o=s(a),i=s(l),u=s(d),g=s(h),m="left"===n?-1:1,y=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:y+m*(p+f/2),y1:u,x2:y+m*(p+f/2),y2:g,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:y+m*p,y1:u,x2:y+m*(p+f),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:y+m*p,y1:g,x2:y+m*(p+f),y2:g,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:"left"===n?y-p-f:y+p,y:Math.min(t,o),width:f,height:Math.abs(o-t),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:"left"===n?y-p-f:y+p,y1:i,x2:"left"===n?y-p:y+p+f,y2:i,stroke:c.fill,strokeWidth:2})]})}}const d=r.bin().domain(t).thresholds(c.bins)(i);if(0===d.length)return null;const h=b(d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e.jsx("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,i)=>{if(null==t.x0||null==t.x1)return null;const r=t.length/h*o;if(u){const o=s(t.x0),l=s(t.x1)-s(t.x0);return e.jsx("rect",{x:o,y:"top"===n?-4-r:4,width:Math.max(l,.5),height:r,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}{const o=s(t.x0),l=s(t.x1)-s(t.x0);return e.jsx("rect",{x:"left"===n?-4-r:4,y:Math.min(o,o+l),width:r,height:Math.abs(l),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}})});if("violin"===c.type){const t=o/2+4,i=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const r=e.length/h*(o/2),l=s((e.x0+e.x1)/2);i.push(u?`${l},${"top"===n?-(t-r):t-r}`:`${"left"===n?-(t-r):t-r},${l}`)}for(let e=d.length-1;e>=0;e--){const r=d[e];if(null==r.x0||null==r.x1)continue;const l=r.length/h*(o/2),a=s((r.x0+r.x1)/2);i.push(u?`${a},${"top"===n?-(t+l):t+l}`:`${"left"===n?-(t+l):t+l},${a}`)}return e.jsx("g",{"data-testid":"marginal-violin-"+n,children:e.jsx("polygon",{points:i.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,i=null!=d[0].x0?s(d[0].x0):0;t.push(`M${i},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*o,r=s((e.x0+e.x1)/2);t.push(`L${r},${"top"===n?-i-4:i+4}`)}const r=null!=d[d.length-1].x1?s(d[d.length-1].x1):a;t.push(`L${r},${e}`),t.push("Z")}else{const e=0,i=null!=d[0].x0?s(d[0].x0):0;t.push(`M${e},${i}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*o,r=s((e.x0+e.x1)/2);t.push(`L${"left"===n?-i-4:i+4},${r}`)}const r=null!=d[d.length-1].x1?s(d[d.length-1].x1):a;t.push(`L${e},${r}`),t.push("Z")}return e.jsx("g",{"data-testid":"marginal-ridgeline-"+n,children:e.jsx("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,s,c,l,a,n,u,4]);return d?e.jsx("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function ye(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>o?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function ve(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 be(t,n,o,i){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:r,title:s,orientation:l,align:a,wrap:c=120,noWrap:u}=t;if(!r&&!s)return e.jsx("g",{className:"annotation-note"});let d=l;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=a;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let f="start";"topBottom"===d?"right"===h?f="end":"middle"===h&&(f="middle"):f=0>n?"end":"start";const p=16,g=s?u?[s]:ye(s,c):[],m=r?u?[r]:ye(r,c):[],y="leftRight"===d?"end"===f?-4:4:0;let v=0;const b=[],x=i||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";t.useHTML||t.html?(b.push(e.jsx("foreignObject",{className:"annotation-note-html",x:"end"===f?y-c:"middle"===f?y-c/2:y,y:-16,width:c,height:Math.max(p,(g.length+m.length)*p+(s&&r?2:0))+p,style:{overflow:"visible"},children:e.jsxs("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:x,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===f?"right":"middle"===f?"center":"left",whiteSpace:u?"nowrap":"normal",wordBreak:"break-word"},children:[s&&e.jsx("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:s}),r&&e.jsx("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")),v=g.length*p):(g.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:f,fontWeight:"bold",children:g.map((t,n)=>e.jsx("tspan",{x:y,dy:0===n?0:p,children:t},n))},"annotation-note-title")),v=g.length*p),m.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:f,y:v,children:m.map((t,n)=>e.jsx("tspan",{x:y,dy:0===n?0:p,children:t},n))},"annotation-note-label")));let j=null;if((s||r)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),j=e.jsx("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(g.length+m.length)*p+(m.length>0?p:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),j=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,g.length+m.length-1)*p;let w=0;return"topBottom"===d?w=0>o?-(k+2):18:"leftRight"===d&&(w="middle"===h?-(k+p+(m.length>0&&g.length>0?2:0))/2+8:"bottom"===h||0>o?-(k+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${n},${o})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:b}),j]})}function xe(t,n,o,i,r){var s;const l=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&l.push(e.jsx("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&l.push(e.jsx("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&l.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;l.push(e.jsx("line",{x1:i,y1:(n.y1||0)-s,x2:i,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-s;l.push(e.jsx("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?l.push(e.jsx("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||l.push(e.jsx("line",{x1:0,y1:(n.y1||0)-s,x2:0,y2:(n.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==n?void 0:n.width)&&void 0!==s?s:null==n?void 0:n.height;void 0!==t&&l.push(e.jsx("path",{d:ve((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e.jsx("g",{className:"annotation-subject",children:l})}function je(t,n,o,i,r,s){var l;const a=[];let c=0,u=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const e=s.width||0,o=s.height||0;if(e>0||o>0){const i=e/2,r=o/2,s=t-i,l=n-r;if(0!==s||0!==l){const t=Math.abs(s),n=Math.abs(l),a=e/2,d=o/2,h=t*d>n*a?a/t:d/n;c=i+s*h,u=r+l*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,n=s.depth||30;void 0!==e?(c=e/2,u=n):void 0!==t&&(c=n,u=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);c=Math.cos(o)*e,u=Math.sin(o)*e}}const d=Math.sqrt(Math.pow(t-c,2)+Math.pow(n-u,2));if(d>.5){const r=i||"var(--semiotic-text-secondary, currentColor)",s="curve"===(null==o?void 0:o.type);let h=Math.atan2(n-u,t-c);if(s){const i=(null!==(l=null==o?void 0:o.curve)&&void 0!==l?l:.25)*d,s=(c+t)/2+-(n-u)/d*i,f=(u+n)/2+(t-c)/d*i;a.push(e.jsx("path",{className:"connector-curve",d:`M${c},${u}Q${s},${f} ${t},${n}`,fill:"none",stroke:r},"connector-line")),h=Math.atan2(f-u,s-c)}else a.push(e.jsx("line",{x1:c,y1:u,x2:t,y2:n,stroke:r},"connector-line"));if("arrow"===(null==o?void 0:o.end)){const t=10,n=16/180*Math.PI;a.push(e.jsx("path",{d:`M${c},${u}L${c+t*Math.cos(h+n)},${u+t*Math.sin(h+n)}L${c+t*Math.cos(h-n)},${u+t*Math.sin(h-n)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return e.jsx("g",{className:"annotation-connector",children:a})}function ke(t){var n,o;const{x:i=0,y:r=0,dx:s,dy:l,nx:a,ny:c,note:u,connector:d,subject:h,type:f,color:p,className:g,disable:m,opacity:y,strokeDasharray:v,events:b={},"data-testid":x}=t,j=Array.isArray(i)?null!==(n=i[0])&&void 0!==n?n:0:i,k=Array.isArray(r)?null!==(o=r[0])&&void 0!==o?o:0:r,w=new Set(Array.isArray(m)?m:[]);let O=s||0,M=l||0;null!=a&&(O=a-j),null!=c&&(M=c-k);const S="string"==typeof f?f:"label";if("bracket"===S&&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 e.jsxs("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${j},${k})`,"data-testid":x},null!=y&&{opacity:y},v&&{strokeDasharray:v},b,{children:[!w.has("connector")&&je(O,M,d,p,S,h),!w.has("subject")&&xe(S,h,p,j,k),!w.has("note")&&be(u,O,M,p)]}))}function we(t){var n,o;const{noteData:i}=t,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",l=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),l=i.ny||r[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),a=r.map((n,o)=>{const r=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:l});return e.jsx(ke,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+o)});return e.jsx("g",{children:a})}const a=i.note||{title:"none",label:i.label},c=`${a.label}-${a.title}-${i.i}`;return e.jsx(ke,Object.assign({"data-testid":"semiotic-annotation",events:l},i,{type:s}),c)}function Oe(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 Me(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 Se(e){return null==e?null:e+""}function Ae(e,t,n){var o;return null===(o=t.stickyPositionCache)||void 0===o||o.set(e,n),n}function Ce(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 Ae(t,n,{x:i.x,y:i.y})}const o=function(e){var t,n,o,i,r,s;const l=e.data;if(!l||0===l.length)return null;const a=l[l.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=a[e.xAccessor||"x"],h=a[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return o?Ae(t,n,o):null}if("semantic"===r){const o=function(e,t,n){var o,i;const r=function(e){var t,n;return Se(null!==(n=null===(t=e.provenance)||void 0===t?void 0:t.stableId)&&void 0!==n?n:e.stableId)}(e);if(!r)return null;const s=null===(o=n.pointNodes)||void 0===o?void 0:o.find(e=>Se(e.pointId)===r);if(s)return Ae(t,n,{x:s.x,y:s.y});const l=null===(i=n.data)||void 0===i?void 0:i.find(e=>function(e){var t,n,o;return Se(null!==(n=null!==(t=e.stableId)&&void 0!==t?t:e.id)&&void 0!==n?n:null===(o=e.provenance)||void 0===o?void 0:o.stableId)}(e)===r);if(!l)return null;const a=Oe(l,n),c=Me(l,n);return null==a||null==c?null:Ae(t,n,{x:a,y:c})}(e,t,n);if(o)return o}let s=null,l=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(s=t.x,l=t.y)}if(null!=s&&null!=l||(s=Oe(e,n),l=Me(e,n)),null!=s&&null!=l)return Ae(t,n,{x:s,y:l});if("sticky"===r){const e=null===(i=n.stickyPositionCache)||void 0===i?void 0:i.get(t);if(e)return e}return null}function Pe(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const ze={secondary:0,primary:3};function Re(e){return!0===(null==e?void 0:e._annotationDeferred)}function Le(e){return"blended"===(null==e?void 0:e.cohesion)||"layer"===(null==e?void 0:e.cohesion)?e.cohesion:null}function De(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 Ie(e){return Math.max(.72,.95-.06*e)}const Ne={linear:l.curveLinear,monotoneX:l.curveMonotoneX,monotoneY:l.curveMonotoneY,step:l.curveStep,stepAfter:l.curveStepAfter,stepBefore:l.curveStepBefore,basis:l.curveBasis,cardinal:l.curveCardinal,catmullRom:l.curveCatmullRom};const $e=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function Ee(e){return!!e&&"object"==typeof e&&$e.has(function(e){return"string"==typeof(null==e?void 0:e.type)?e.type:""}(e))}function We(e){return"primary"===(null==e?void 0:e.emphasis)||!0===(null==e?void 0:e.defensive)}function Be(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 _e(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 Te=32,Fe=6,He=4,qe=8,Ge=72;const Ve={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Ue(e){return Ee(e)}function Ze(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 Ye(e,t,n,o,i){const r=e+n,s=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?r-i.width-4:r+4,y:0>o?s-i.height:s,width:i.width,height:i.height}:{x:0>n?r-i.width:r,y:0>o?s-i.height-4:s+4,width:i.width,height:i.height}}function Xe(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function Qe(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 Ke(e,t,n,o,i,r,s,l){const a=Xe(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const i=Math.max(0,o-e.x),r=Math.max(0,o-e.y);return(i+Math.max(0,e.x+e.width-(t-o)))*e.height+(r+Math.max(0,e.y+e.height-(n-o)))*e.width}(a,i,r,l);for(const e of n)c+=12*Qe(a,e);for(const e of o)c+=4*Qe(a,e);return c}function Je(e){var t;const{annotations:n,context:o,defaultOffset:i=Te,notePadding:r=Fe,markPadding:s=He,edgePadding:l=qe,preserveManualOffsets:a=!0,routeLongConnectors:c=!0,connectorThreshold:u=Ge,density:d,progressiveDisclosure:h=!1,redundantCues:f=!1,responsive:p,cohesion:g,audience:m}=e,y=o.width||0,v=o.height||0;if(0===n.length||0>=y||0>=v)return n.slice();const b=[],x=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(o,s);let j=!1;const k=n.map((e,t)=>{if(!Ue(e))return e;const n=function(e,t,n){var o,i;if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const r=null!==(o=e.pointId)&&void 0!==o?o:e.nodeId;if(null!=r&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===r);if(e)return{x:e.x,y:e.y}}const s=e.coordinates,l=null===(i=n.scales)||void 0===i?void 0:i.geoProjection;if(Array.isArray(s)&&s.length>=2&&l){const e=s[0],t=s[1];if("number"==typeof e&&"number"==typeof t){const n=l([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?Ce(e,t,n):{x:e.x,y:e.y}}(e,t,o);if(!n)return e;const s=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...Ze("string"==typeof e.title?e.title:void 0,t),...Ze("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return b.push(Xe(Ye(n.x,n.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,s),r)),e}var d;let h=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(i)){const t=Ke(Ye(n.x,n.y,e.dx,e.dy,s),e,b,x,y,v,r,l);f>t&&(h=e,f=t)}if(!h)return e;const p=Xe(Ye(n.x,n.y,h.dx,h.dy,s),r);b.push(p);const g=Math.hypot(h.dx,h.dy),m=c&&g>=u&&"text"!==e.type&&"widget"!==e.type?Object.assign(Object.assign({},e.connector||{end:"arrow"}),{type:"curve"}):e.connector;return j=!0,Object.assign(Object.assign(Object.assign({},e),{dx:h.dx,dy:h.dy}),m?{connector:m}:{})}),w=j?k:n.slice();let O=w;if(f){let e=!1;const t=w.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:Object.assign(Object.assign({},e),{_redundantConnector:!0})}(t);return n!==t&&(e=!0),n});O=e?t:w}{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=Ve[n.source])&&void 0!==t?t:n.source:null,i="number"==typeof n.confidence&&Number.isFinite(n.confidence)?Math.round(100*Math.max(0,Math.min(1,n.confidence)))+"%":null;if(!o&&!i)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[o,i].filter(Boolean).join(" · "),s="string"==typeof e.label?e.label:"";return s.includes(`(${r})`)?e:Object.assign(Object.assign({},e),{label:s?`${s} (${r})`:`(${r})`})}(t);return n!==t&&(e=!0),n});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}(m),o=1===n?e:Object.assign(Object.assign({},e),{maxAnnotations:Math.max(0,Math.round((null!==(t=e.maxAnnotations)&&void 0!==t?t:Be(y,v,e))*n))}),{deferred:i}=function(e){var t;const{annotations:n,width:o,height:i}=e,r=Math.max(0,null!==(t=e.minVisible)&&void 0!==t?t:1),s=Be(o,i,e),l=n.map((e,t)=>{return{annotation:e,index:t,note:(n=e,Ee(n))};var n}),a=l.filter(e=>e.note);if(0===a.length||s>=a.length)return{visible:n.slice(),deferred:[],budget:s};const c=a.filter(e=>We(e.annotation)),u=a.filter(e=>!We(e.annotation)).sort((e,t)=>_e(t.annotation)-_e(e.annotation)||e.index-t.index),d=Math.min(u.length,Math.max(Math.max(0,s-c.length),Math.max(0,r-c.length))),h=new Set([...c.map(e=>e.index),...u.slice(0,d).map(e=>e.index)]),f=[],p=[];for(const{annotation:e,index:t,note:n}of l)!n||h.has(t)?f.push(e):p.push(e);return{visible:f,deferred:p,budget:s}}(Object.assign({annotations:O,width:y,height:v},o));for(const e of i)M.add(e)}if(p&&("object"==typeof p&&"number"==typeof p.minWidth?p.minWidth:480)>=y)for(const e of O)Ue(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 S;return S=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=>Ue(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,Object.assign(Object.assign({},e),{cohesion:t})):e);return n?o:e}(S,g):S}let et={positions:new Map};const tt=new Set;function nt(){for(const e of tt)e()}function ot(e,t){const n=et.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(et.positions);o.delete(e),et={positions:o},nt()}function it(e,t){const n=et.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(et.positions);o.delete(e),et={positions:o},nt()}function rt(){return et}function st(e){return tt.add(e),()=>tt.delete(e)}const lt={positions:new Map};function at(){return()=>{}}function ct(){return lt}function ut(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],i=n[n.length-1],r=o instanceof Date,s=o instanceof Date?o.getTime():o,l=i instanceof Date?i.getTime():i;if(2>t||s===l)return r?[new Date(s),new Date(l)]:[s,l];const a=(l-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?l:s+e*a;c[e]=r?new Date(n):n}return c}(e,t):e.ticks(t)}function dt(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function ht(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function ft(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 pt(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function gt(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,i="left"===e?-1:1,r=Math.ceil(t/8);let s="M0,"+o;for(let e=0;r>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*i}`,s+=`L${Math.min(n,t)},${o}`}return s}{const o="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;r>e;e++){const t=8*(e+1);s+=`L${o+4*i},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}}function mt(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function yt(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 vt(n){var o,i;const{width:r,height:a,totalWidth:c,totalHeight:u,margin:d,scales:h,showAxes:g,axes:m,xLabel:y,yLabel:b,yLabelRight:x,xFormat:j,yFormat:k,axisExtent:w,showGrid:O,title:M,legend:S,legendHoverBehavior:A,legendClickBehavior:C,legendHighlightedCategory:P,legendIsolatedCategories:z,legendPosition:R="right",legendLayout:D,foregroundGraphics:I,marginalGraphics:N,xValues:$,yValues:E,annotations:W,autoPlaceAnnotations:B,svgAnnotationRules:_,xAccessor:T,yAccessor:F,annotationData:H,pointNodes:q,curve:G,underlayRendered:V,canvasObscuresUnderlay:U=!0,linkedCrosshairName:Z,linkedCrosshairSourceId:Y,children:X}=n,Q=t.useMemo(()=>{var e,t;if(!g||!h)return[];const n=null==m?void 0:m.find(e=>"bottom"===e.orient),o=(null==n?void 0:n.tickFormat)||j||mt,i=Math.max(2,Math.floor(r/70)),s=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5,l=null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:ut(h.x,"exact"===w?Math.max(2,s):Math.min(s,i),w),a=l.map(e=>e.valueOf()),c=l.map((e,t)=>({value:e,pixel:h.x(e),label:o(e,t,a)})),u=c.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),d=(null==n?void 0:n.autoRotate)?Math.max(20,Math.min(u+8,55)):Math.max(55,u+8);let f=yt(c,d);if(f.length>1&&(f=f.filter((e,t)=>0===t||e.label+""!=f[t-1].label+"")),(null==n?void 0:n.includeMax)&&f.length>0&&"exact"!==w&&!(null==n?void 0:n.tickValues)){const e=h.x.domain()[1],t=h.x(e),n=f[f.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e,f.length,a);d>t-n&&f.length>1&&(f=f.slice(0,-1)),f.push({value:e,pixel:t,label:i})}}return f},[g,h,m,j,r,w]),K=t.useMemo(()=>{var e,t;if(!g||!h)return[];const n=null==m?void 0:m.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||k||mt,i=Math.max(2,Math.floor(a/30)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;let s=yt((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:ut(h.y,"exact"===w?Math.max(2,r):Math.min(r,i),w)).map(e=>({value:e,pixel:h.y(e),label:o(e)})),22);if(s.length>1&&(s=s.filter((e,t)=>0===t||e.label+""!=s[t-1].label+"")),(null==n?void 0:n.includeMax)&&s.length>0&&"exact"!==w&&!(null==n?void 0:n.tickValues)){const e=h.y.domain()[1],t=h.y(e),n=s[s.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e);22>Math.abs(t-n)&&s.length>1&&(s=s.slice(0,-1)),s.push({value:e,pixel:t,label:i})}}return s},[g,h,m,k,a,w]),J=t.useMemo(()=>{var e,t;if(!g||!h)return[];const n=null==m?void 0:m.find(e=>"right"===e.orient);if(!n)return[];const o=n.tickFormat||k||mt,i=Math.max(2,Math.floor(a/30)),r=null!==(e=n.ticks)&&void 0!==e?e:5;return yt((null!==(t=n.tickValues)&&void 0!==t?t:ut(h.y,"exact"===w?Math.max(2,r):Math.min(r,i),w)).map(e=>({value:e,pixel:h.y(e),label:o(e)})),22)},[g,h,m,k,a,w]),ee=t.useRef(new Map),te=t.useRef(null!==(o=null==W?void 0:W.length)&&void 0!==o?o:0),ne=null!==(i=null==W?void 0:W.length)&&void 0!==i?i:0;te.current!==ne&&(te.current=ne,ee.current=new Map);const oe=t.useMemo(()=>{if(!W||0===W.length)return null;const t=function(t,n,o){var i,r,a,c,u,d,h,g,m,y,b,x,j,k,w,O,M,S,A,C,P,z,R,L,D,I,N,$,E,W,B,_,T,F,H,q,G,V,U,Z,Y,X,Q,K,J,ee,te,ne,oe,ie,re;switch(t.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const s=Ce(t,n,o);if(!s)return null;const{x:l,y:c}=s;if(!Pe(l,c,o))return null;const u="callout"===t.type?"callout-circle":t.type,d="callout-circle"===u?{radius:null!==(i=t.radius)&&void 0!==i?i:12,radiusPadding:t.radiusPadding}:"callout-rect"===u?{width:t.width,height:t.height}:void 0;return e.jsx(we,{noteData:Object.assign(Object.assign({x:l,y:c,dx:null!==(r=t.dx)&&void 0!==r?r:30,dy:null!==(a=t.dy)&&void 0!==a?a:-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:u},d?{subject:d}:{}),{connector:t.connector||{end:"arrow"},color:t.color,disable:t.disable,opacity:t.opacity,strokeDasharray:t.strokeDasharray,className:t.className})},"ann-"+n)}case"x-threshold":{const i=Oe(null!=t.value?Object.assign(Object.assign({},t),{x:t.value}):t,o);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"top";let l;l="bottom"===s?(o.height||0)-4:"center"===s?(o.height||0)/2:12;const a=i>.6*(o.width||0),c=a?i-4:i+4,u=a?"end":"start";return e.jsxs("g",{opacity:t.opacity,children:[e.jsx("line",{x1:i,y1:0,x2:i,y2:o.height||0,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:c,y:l,textAnchor:u,fill:r,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:t.label})]},"ann-"+n)}case"y-threshold":{const i=Me(null!=t.value?Object.assign(Object.assign({},t),{y:t.value}):t,o);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"right";let l,a;return"left"===s?(l=4,a="start"):"center"===s?(l=(o.width||0)/2,a="middle"):(l=(o.width||0)-4,a="end"),e.jsxs("g",{opacity:t.opacity,children:[e.jsx("line",{x1:0,y1:i,x2:o.width||0,y2:i,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:l,y:i-4,textAnchor:a,fill:r,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:t.label})]},"ann-"+n)}case"enclose":{const i=(t.coordinates||[]).map(e=>({x:Oe(Object.assign(Object.assign({},e),{type:"point"}),o),y:Me(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=s.packEnclose(i),l=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:r.x,cy:r.y,r:r.r+l,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:r.x,y:r.y-r.r-l-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"rect-enclose":{const i=(t.coordinates||[]).map(e=>({x:Oe(Object.assign(Object.assign({},e),{type:"point"}),o),y:Me(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=t.padding||10,s=i.map(e=>e.x),l=i.map(e=>e.y),[a,c]=v(s),[u,d]=v(l),h=a-r,f=c+r,p=u-r;return e.jsxs("g",{children:[e.jsx("rect",{x:h,y:p,width:f-h,height:d+r-p,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:(h+f)/2,y:p-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"highlight":{const i=o.data||[],r="function"==typeof t.filter?i.filter(t.filter):t.field&&null!=t.value?i.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.jsx("g",{children:r.map((n,i)=>{const r=Oe(n,o),l=Me(n,o);if(null==r||null==l)return null;const a="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||s;return e.jsx("circle",Object.assign({cx:r,cy:l,r:a},c),"hl-"+i)})},"ann-"+n)}case"bracket":{const i=Oe(t,o),r=Me(t,o);return e.jsx(we,{noteData:{x:null!=i?i:0,y:null!=r?r:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+n)}case"trend":{const i=o.data||[];if(2>i.length)return null;const r=o.xAccessor||"x",s=o.yAccessor||"y",l="ordinal"===o.frameType,a="horizontal"===o.projection,f=l?r:null,v=l?s:null;let b;const x=[],j=new Map;if(l&&f&&v){for(const e of i){const t=e[f];if(null==t)continue;const n=t+"";j.has(n)||(j.set(n,x.length),x.push(n))}b=i.map(e=>{const t=e[f],n=e[v];if(null==t||null==n)return null;const o=j.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else b=i.map(e=>[e[r],e[s]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const k=null!==(u=null===(c=o.scales)||void 0===c?void 0:c.x)&&void 0!==u?u:null===(d=o.scales)||void 0===d?void 0:d.time,w=null!==(g=null===(h=o.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(m=o.scales)||void 0===m?void 0:m.value;if(!k||!w)return null;const 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,S=w;let A;if(l)if(a){const e=O(S);A=(t,n)=>[M(n),e(t)]}else{const e=O(M);A=(t,n)=>[e(t),S(n)]}else A=(e,t)=>[M(e),S(t)];const C=t.method||"linear";let P;P="loess"===C?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),r=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),l=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),a=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===a?0:o[e]/a;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],f+=t*i[e]*i[e],p+=t*i[e]*r[e])}if(0===u){l.push([t,r[e]]);continue}const g=u*f-d*d;if(1e-12>Math.abs(g))l.push([t,h/u]);else{const e=(u*p-d*h)/g;l.push([t,(h-e*d)/u+e*t])}}return l}(b,null!==(y=t.bandwidth)&&void 0!==y?y:.3):("polynomial"===C?p.default.polynomial(b,{order:t.order||2}):p.default.linear(b)).points;const z=P.map(([e,t])=>{const[n,o]=A(e,t);return`${n},${o}`}).join(" "),R=t.color||"#6366f1",L=P[P.length-1],[D,I]=A(L[0],L[1]);return e.jsxs("g",{children:[e.jsx("polyline",{points:z,fill:"none",stroke:R,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:D+4,y:I-4,fill:R,fontSize:11,children:t.label})]},"ann-"+n)}case"band":{const i=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.y)&&void 0!==x?x:null===(j=o.scales)||void 0===j?void 0:j.value,r=null!==(k=null==i?void 0:i(t.y0))&&void 0!==k?k:0,s=null!==(w=null==i?void 0:i(t.y1))&&void 0!==w?w:o.height||0;return e.jsxs("g",{opacity:t.opacity,children:[e.jsx("rect",{x:0,y:Math.min(r,s),width:o.width||0,height:Math.abs(s-r),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.max(Math.min(r,s),0)+13,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:t.label})]},"ann-"+n)}case"envelope":{const i=o.data||[];if(2>i.length)return null;const r=o.xAccessor||"x",s=null!==(M=null===(O=o.scales)||void 0===O?void 0:O.x)&&void 0!==M?M:null===(S=o.scales)||void 0===S?void 0:S.time,a=null!==(C=null===(A=o.scales)||void 0===A?void 0:A.y)&&void 0!==C?C:null===(P=o.scales)||void 0===P?void 0:P.value;if(!s||!a)return null;const c=t.upperAccessor||"upperBounds",u=t.lowerAccessor||"lowerBounds",d=t.filter,h=i.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[r]-t[r]);if(2>h.length)return null;const f=Ne[o.curve||"linear"]||l.curveLinear,p=l.area().x(e=>s(e[r])).y0(e=>a(e[u])).y1(e=>a(e[c])).curve(f)(h);if(!p)return null;const g=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:p,fill:g,fillOpacity:null!==(z=t.fillOpacity)&&void 0!==z?z:.15,stroke:"none"}),t.label&&h.length>0&&e.jsx("text",{x:s(h[h.length-1][r])+4,y:a(h[h.length-1][c])-4,fill:g,fontSize:11,children:t.label})]},"ann-"+n)}case"anomaly-band":{const i=o.data||[];if(2>i.length)return null;const r=o.yAccessor||"y",s=null!==(L=null===(R=o.scales)||void 0===R?void 0:R.x)&&void 0!==L?L:null===(D=o.scales)||void 0===D?void 0:D.time,l=null!==(N=null===(I=o.scales)||void 0===I?void 0:I.y)&&void 0!==N?N:null===($=o.scales)||void 0===$?void 0:$.value;if(!s||!l)return null;const a=i.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const c=a.reduce((e,t)=>e+t,0)/a.length,u=a.reduce((e,t)=>e+Math.pow(t-c,2),0)/a.length,d=Math.sqrt(u),h=null!==(E=t.threshold)&&void 0!==E?E:2,f=c-h*d,p=!1!==t.showBand,g=t.fill||"#6366f1",m=null!==(W=t.fillOpacity)&&void 0!==W?W:.1,y=t.anomalyColor||"#ef4444",v=null!==(B=t.anomalyRadius)&&void 0!==B?B:6,b=l(c+h*d),x=l(f),j=i.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-c)>h*d});return e.jsxs("g",{children:[p&&e.jsx("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:g,fillOpacity:m}),j.map((t,n)=>{const i=Oe(t,o),r=Me(t,o);return null==i||null==r?null:e.jsx("circle",{cx:i,cy:r,r:v,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+n)}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:g,fontSize:11,children:t.label})]},"ann-"+n)}case"forecast":{const i=o.data||[];if(3>i.length)return null;const r=o.xAccessor||"x",s=o.yAccessor||"y",l=null!==(T=null===(_=o.scales)||void 0===_?void 0:_.x)&&void 0!==T?T:null===(F=o.scales)||void 0===F?void 0:F.time,a=null!==(q=null===(H=o.scales)||void 0===H?void 0:H.y)&&void 0!==q?q:null===(G=o.scales)||void 0===G?void 0:G.value;if(!l||!a)return null;const c=i.map(e=>[e[r],e[s]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=p.default.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,i=0;for(const[e,r]of c)t+=e,n+=r,o+=e*e,i+=e*r;const r=e*o-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*n)/r,l=(n-s*t)/e;u=e=>l+s*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(d-2,1)),g=c.reduce((e,t)=>e+t[0],0)/d,m=c.reduce((e,t)=>e+Math.pow(t[0]-g,2),0),y=null!==(V=t.confidence)&&void 0!==V?V:.95,v=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,b=null!==(U=t.steps)&&void 0!==U?U:5,x=c[d-1][0],j=(x-c[0][0])/Math.max(d-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*j);const w=[];for(const e of k){const t=u(e),n=f*Math.sqrt(1+1/d+(m>0?Math.pow(e-g,2)/m:0))*v;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const O=`M${w.map(e=>`${l(e.x)},${a(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${l(e.x)},${a(e.yLower)}`).join(" L")} Z`,M=w.map(e=>`${l(e.x)},${a(e.yCenter)}`).join(" "),S=`${l(x)},${a(u(x))}`,A=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:O,fill:t.fill||"#6366f1",fillOpacity:null!==(Z=t.fillOpacity)&&void 0!==Z?Z:.15,stroke:"none"}),e.jsx("polyline",{points:`${S} ${M}`,fill:"none",stroke:A,strokeWidth:null!==(Y=t.strokeWidth)&&void 0!==Y?Y:2,strokeDasharray:null!==(X=t.strokeDasharray)&&void 0!==X?X:"6,3"}),t.label&&w.length>0&&e.jsx("text",{x:l(w[w.length-1].x)+4,y:a(w[w.length-1].yCenter)-4,fill:A,fontSize:11,children:t.label})]},"ann-"+n)}case"widget":{let i=null,r=null;if(null!=t.px&&null!=t.py)i=t.px,r=t.py;else{const e=Ce(t,n,o);if(!e)return null;i=e.x,r=e.y}if(null==i||null==r)return null;if(!Pe(i,r,o))return null;const s=null!==(Q=t.dx)&&void 0!==Q?Q:0,l=null!==(K=t.dy)&&void 0!==K?K:0,a=null!==(J=t.width)&&void 0!==J?J:32,c=null!==(ee=t.height)&&void 0!==ee?ee:32,u=null!==(te=t.content)&&void 0!==te?te:e.jsx("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return e.jsx("foreignObject",{x:i+s-a/2,y:r+l-c/2,width:a,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:a,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const i=Ce(t,n,o);if(!i)return null;const{x:r,y:s}=i,l=r+(t.dx||0),a=s+(t.dy||0),c=t.color||"var(--semiotic-text, #333)",u=e.jsx("text",{x:l,y:a,fill:c,fontSize:t.fontSize||11,opacity:t.opacity,strokeDasharray:t.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label});return!0!==t._redundantConnector?f.cloneElement(u,{key:"ann-text-"+n}):e.jsxs("g",{opacity:t.opacity,strokeDasharray:t.strokeDasharray,children:[e.jsx("line",{x1:r,y1:s,x2:l,y2:a,stroke:c,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),f.cloneElement(u,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const i=t.category;if(null==i)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,s=null===(ne=o.scales)||void 0===ne?void 0:ne.o,l=null===(oe=o.scales)||void 0===oe?void 0:oe.x,a=null===(ie=o.scales)||void 0===ie?void 0:ie.y,c=r(s)?s:r(l)?l:r(a)?a:null;if(!c)return null;const u=c(i+"");if(null==u)return null;const d=c.bandwidth(),h=t.color||"var(--semiotic-primary, #4589ff)",f=null!==(re=t.opacity)&&void 0!==re?re:.15,p=t.label;return e.jsxs("g",(o.projection?"vertical"===o.projection:c===l)?{children:[e.jsx("rect",{x:u,y:0,width:d,height:o.height||0,fill:h,fillOpacity:f}),p&&e.jsx("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]}:{children:[e.jsx("rect",{x:0,y:u,width:o.width||0,height:d,fill:h,fillOpacity:f}),p&&e.jsx("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+n)}default:return null}},n={scales:h?{x:h.x,y:h.y,time:h.x,value:h.y}:null,timeAxis:"x",xAccessor:T,yAccessor:F,width:r,height:a,data:H,frameType:"xy",pointNodes:q,curve:G,stickyPositionCache:ee.current};return function(t,n,o,i){const r=[];return t.forEach((e,t)=>{let s;if(o){const r=o(e,t,i);s=null!=r?r:n(e,t,i)}else s=n(e,t,i);s&&r.push({node:s,annotation:e})}),function(t){const n=t.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===(null==n?void 0:n.emphasis)||"secondary"===(null==n?void 0:n.emphasis)?n.emphasis:null),confidence:De(e.annotation),readingOrder:null,rank:1};var n}),o=n.some(e=>null!=e.emphasis||null!=e.confidence),i=t.some(e=>Re(e.annotation)),r=t.some(e=>null!=Le(e.annotation)),s=t.some(e=>"layer"===Le(e.annotation));if(!o&&!i&&!r)return t.map(e=>e.node);const l=n.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>{var n,o;return(null!==(n=t.confidence)&&void 0!==n?n:0)-(null!==(o=e.confidence)&&void 0!==o?o:0)||e.i-t.i});l.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,l.length)});for(const e of n)e.emphasis&&(e.rank=ze[e.emphasis]);const a=n.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(t=>{const{p:n,i:o,emphasis:i,readingOrder:r}=t,s=Re(n.annotation);let l=n.node;if("primary"===i||"secondary"===i||null!=r){const t=null==i&&null!=r;l=e.jsx("g",Object.assign({className:t?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+i},"secondary"===i?{opacity:.6,fontSize:"0.88em"}:{},t?{opacity:Ie(r),"data-annotation-reading-order":r}:{},{children:n.node}),"annotation-emphasis-"+o)}const a=Le(n.annotation);return a&&(l=e.jsx("g",{className:"annotation-cohesion--"+a,children:l},"annotation-cohesion-"+o)),s&&(l=e.jsx("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:l},"annotation-deferred-"+o)),l});return i&&a.unshift(e.jsx("style",{children:".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}"},"annotation-disclosure-style")),s&&a.unshift(e.jsx("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),a}(r)}(B?Je(Object.assign({annotations:W,context:n},"object"==typeof B?B:{})):W,t,_,n)},[W,B,_,r,a,T,F,H,h,q,G]),ie=function(e){var n;const o=t.useSyncExternalStore(e?st:at,e?rt:ct,e?rt:ct);return e&&null!==(n=o.positions.get(e))&&void 0!==n?n:null}(Z);return t.useEffect(()=>{if(!(null==ie?void 0:ie.locked)||!Z)return;const e=e=>{"Escape"===e.key&&it(Z)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==ie?void 0:ie.locked,Z]),g||M||S||I||N||oe&&oe.length>0||O||X||ie?e.jsxs("svg",{role:"img",width:c,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof M?M:"XY Chart"}),e.jsx("desc",{children:"string"==typeof M?M+" — XY data visualization":"XY data visualization"}),e.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[O&&h&&(!V||U)&&(()=>{var t,n;const o=pt(null===(t=null==m?void 0:m.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),i=pt(null===(n=null==m?void 0:m.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[Q.map((t,n)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:a,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"xgrid-"+n)),K.map((t,n)=>e.jsx("line",{x1:0,y1:t.pixel,x2:r,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"ygrid-"+n))]})})(),g&&h&&(()=>{const t=null==m?void 0:m.find(e=>"left"===e.orient),n=null==m?void 0:m.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,i=!n||!1!==n.baseline,s=(null==t?void 0:t.jaggedBase)||!1,l=(null==n?void 0:n.jaggedBase)||!1,c=null==n?void 0:n.landmarkTicks,u=null==t?void 0:t.landmarkTicks,h="var(--semiotic-border, #ccc)",f="var(--semiotic-text-secondary, var(--semiotic-text, #666))",p="var(--semiotic-text, #333)",g=!!(null==n?void 0:n.autoRotate)&&Q.length>1&&(()=>{const e=r/Math.max(Q.length-1,1);return Q.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),v={fontSize:"var(--semiotic-tick-font-size, 12px)"},j={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},k={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},w=null==n?void 0:n.tickAnchor,O=null==t?void 0:t.tickAnchor,M=ft(Q),S=ft(K);return e.jsxs("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!V||U)&&i&&!l&&e.jsx("line",{x1:0,y1:a,x2:r,y2:a,stroke:h,strokeWidth:1}),(!V||U)&&l&&e.jsx("path",{d:gt("bottom",r,a),fill:"none",stroke:h,strokeWidth:1}),Q.map((t,n)=>{const o=!!c&&("function"==typeof c?c(t.value,n):L(t.value,n>0?Q[n-1].value:void 0));return e.jsxs("g",{transform:`translate(${t.pixel},${a})`,children:[e.jsx("line",{y2:5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{y:g?10:18,textAnchor:g?"end":dt(w,t.pixel===M.min,t.pixel===M.max),fontWeight:o?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o?j:v),transform:g?"rotate(-45)":void 0,children:t.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"center",userSelect:"none"},v),children:t.label})})]},"xtick-"+n)}),y&&e.jsx("text",{x:r/2,y:a+40,textAnchor:"middle",fill:p,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},k),children:y})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!V||U)&&o&&!s&&e.jsx("line",{x1:0,y1:0,x2:0,y2:a,stroke:h,strokeWidth:1}),(!V||U)&&s&&e.jsx("path",{d:gt("left",r,a),fill:"none",stroke:h,strokeWidth:1}),K.map((t,n)=>{const o=!!u&&("function"==typeof u?u(t.value,n):L(t.value,n>0?K[n-1].value:void 0));return e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:ht(O,t.pixel===S.min,t.pixel===S.max),fontWeight:o?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o?j:v),children:t.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"right",userSelect:"none"},v),children:t.label})})]},"ytick-"+n)}),(()=>{const n=(null==t?void 0:t.label)||b;return n?e.jsx("text",{x:15-d.left,y:a/2,textAnchor:"middle",fill:p,transform:`rotate(-90, ${15-d.left}, ${a/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},k),children:n}):null})()]}),(()=>{const t=null==m?void 0:m.find(e=>"right"===e.orient);if(!t||0===J.length)return null;const n=!1!==t.baseline,o=t.landmarkTicks,i=t.label||x,s=t.tickAnchor,l=ft(J);return e.jsxs("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[n&&e.jsx("line",{x1:r,y1:0,x2:r,y2:a,stroke:h,strokeWidth:1}),J.map((t,n)=>{const i=!!o&&("function"==typeof o?o(t.value,n):L(t.value,n>0?J[n-1].value:void 0));return e.jsxs("g",{transform:`translate(${r},${t.pixel})`,children:[e.jsx("line",{x2:5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:8,textAnchor:"start",dominantBaseline:ht(s,t.pixel===l.min,t.pixel===l.max),fontWeight:i?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?j:v),children:t.label}):e.jsx("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"left",userSelect:"none"},v),children:t.label})})]},"ytick-r-"+n)}),i&&e.jsx("text",{x:r+d.right-15,y:a/2,textAnchor:"middle",fill:p,transform:`rotate(90, ${r+d.right-15}, ${a/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},k),children:i})]})})()]})})(),oe,N&&h&&$&&E&&e.jsxs(e.Fragment,{children:[N.top&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(me,{orient:"top",config:ge(N.top),values:$,scale:h.x,size:d.top,length:r})}),N.bottom&&e.jsx("g",{transform:`translate(0, ${a})`,children:e.jsx(me,{orient:"bottom",config:ge(N.bottom),values:$,scale:h.x,size:d.bottom,length:r})}),N.left&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(me,{orient:"left",config:ge(N.left),values:E,scale:h.y,size:d.left,length:a})}),N.right&&e.jsx("g",{transform:`translate(${r}, 0)`,children:e.jsx(me,{orient:"right",config:ge(N.right),values:E,scale:h.y,size:d.right,length:a})})]}),I,ie&&ie.sourceId!==Y&&(null==h?void 0:h.x)&&(()=>{const t=h.x(ie.xValue);if(null==t||0>t||t>r)return null;const n=ie.locked;return e.jsx("line",{x1:t,y1:0,x2:t,y2:a,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),X]}),M&&e.jsx("text",{x:c/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof M?M:null}),pe({legend:S,totalWidth:c,totalHeight:u,margin:d,legendPosition:R,title:M,legendLayout:D,legendHoverBehavior:A,legendClickBehavior:C,legendHighlightedCategory:P,legendIsolatedCategories:z})]}):null}function bt(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const xt="undefined"==typeof window||"undefined"==typeof document,jt="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,kt=()=>()=>{},wt=()=>!1,Ot=()=>!0;function Mt(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 St(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function At(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}const Ct=f.createContext(null),Pt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function zt(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===(null==t?void 0:t.datum))continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=r.indexOf(e),o=r.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const Rt=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""};function Lt(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 Dt="semiotic-accessible-data-table",It=Dt+" semiotic-accessible-data-table-hidden",Nt=Dt+" semiotic-accessible-data-table-visible",$t={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"},Et={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Wt={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)"},Bt={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},_t={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))"},Tt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Ft={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Ht={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"};function qt({scene:t,chartType:n,tableId:o,chartTitle:i}){var r;const[s,l]=f.useState(!1),[a,c]=f.useState(5),u=f.useContext(Ct),d=null!==(r=null==u?void 0:u.visible)&&void 0!==r&&r,h=s||d,p=f.useRef(null),g=i?"Data summary for "+i:o?`Data summary for ${n} ${o}`:"Data summary for "+n;f.useEffect(()=>{h||c(5)},[h]);const m=f.useCallback(e=>{e.target===e.currentTarget&&(s||d||l(!0))},[s,d]),y=f.useCallback(e=>{var t;d||(null===(t=p.current)||void 0===t?void 0:t.contains(e.relatedTarget))||l(!1)},[d]);if(!t||0===t.length)return o?e.jsx("span",{id:o,tabIndex:-1,style:Pt}):null;if(!h)return e.jsx("div",{id:o,className:It,tabIndex:-1,onFocus:m,style:Pt,role:"region","aria-label":g,children:e.jsxs("button",{type:"button",onClick:()=>l(!0),children:["View data summary (",t.length," elements)"]})});const v=function(e){var t,n,o,i,r,s,l,a,c,u,d,h,f,p,g,m,y;const v=[];if(!Array.isArray(e))return v;const b=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const x of e)if(x&&"object"==typeof x&&null!==x.datum)try{switch(x.type){case"point":if(b)break;v.push({label:"Point",values:Lt(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:Lt(n)});break}case"rect":{const e=null!=x.datum&&"object"==typeof x.datum?x.datum:{},r=null!==(n=null!==(t=e.category)&&void 0!==t?t:x.group)&&void 0!==n?n:"",s=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;v.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":{const e=Lt(x.datum);null==e.value&&"number"==typeof x.value&&Number.isFinite(x.value)&&(e.value=x.value),v.push({label:"Cell",values:e});break}case"wedge":v.push({label:"Wedge",values:{category:null!==(a=null!==(s=null===(r=x.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(l=x.datum)||void 0===l?void 0:l.label)&&void 0!==a?a:"",value:null!==(u=null===(c=x.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":v.push({label:"Node",values:Lt(x.datum)});break;case"arc":v.push({label:"Arc",values:Lt(x.datum)});break;case"candlestick":v.push({label:"Candlestick",values:Lt(x.datum)});break;case"geoarea":v.push({label:"Region",values:{name:null!==(g=null!==(f=null===(h=null===(d=x.datum)||void 0===d?void 0:d.properties)||void 0===h?void 0:h.name)&&void 0!==f?f:null===(p=x.datum)||void 0===p?void 0:p.name)&&void 0!==g?g:"",value:null!==(y=null===(m=x.datum)||void 0===m?void 0:m.value)&&void 0!==y?y:""}})}}catch(e){}return v}(t),b=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),r+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(v),x=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Rt(e.min)} to ${Rt(e.max)}, mean ${Rt(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(v.length,b),j=Math.min(a,v.length),k=v.slice(0,j),w=v.length-j,O=new Set;for(const e of k)for(const t of Object.keys(e.values))O.add(t);const M=Array.from(O);return e.jsxs("div",{ref:p,id:o,className:Nt,tabIndex:-1,onBlur:y,style:$t,role:"region","aria-label":g,children:[e.jsx("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{d&&u&&u.setVisible(!1),l(!1)},"aria-label":"Close data summary",style:Wt,children:"×"}),e.jsx("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Et,children:x}),e.jsxs("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+n,style:Bt,children:[e.jsx("caption",{className:"semiotic-accessible-data-table-caption",style:Ft,children:w>0?`First ${j} of ${v.length} data points`:`All ${v.length} data points`}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:_t,children:"type"}),M.map(t=>e.jsx("th",{style:_t,children:t},t))]})}),e.jsx("tbody",{children:k.map((t,n)=>e.jsxs("tr",{children:[e.jsx("td",{style:Tt,children:t.label}),M.map(n=>{return e.jsx("td",{style:Tt,children:(o=t.values[n],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Rt(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},n);var o})]},n))})]}),w>0&&e.jsxs("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>c(e=>e+25),style:Ht,children:["Show ",Math.min(25,w)," more"," ",1===w?"row":"rows"," (",w," remaining)"]})]})}function Gt({summary:t}){return t?e.jsx("div",{role:"note",style:Pt,children:t}):null}function Vt({tableId:t}){return e.jsx("a",{href:"#"+t,style:Pt,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,Pt)},children:"Skip to data table"})}function Ut({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+e}return e.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:Pt,children:n})}const Zt=Object.freeze([]);function Yt(e){if(!e)return Zt;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 Xt="var(--semiotic-focus, #005fcc)";function Qt({active:t,hoverPoint:n,margin:o,size:i,shape:r="circle",width:s,height:l}){if(!t||!n)return null;const a=n.x+o.left,c=n.y+o.top;let u;if("rect"===r&&null!=s&&null!=l){const t=Math.max(s,4),n=Math.max(l,4);u=e.jsx("rect",{x:a-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:Xt,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===r?{cx:a,cy:c,r:12,fill:"none",stroke:Xt,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:a,cy:c,r:8,fill:"none",stroke:Xt,strokeWidth:2,strokeDasharray:"4,2"});return e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}const Kt={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 Jt(e,t){return"function"==typeof t?t(e):e[t]}function en(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 tn(t={}){const{fields:n,title:o,format:i,style:r={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let l;const a=[];if(o){const e=Jt(t,o);l=en(e,i)}if(n&&n.length>0)n.forEach(e=>{let n,o,r;"string"==typeof e?(n=e,o=e,r=i):(n=e.label,o=e.accessor||e.key||"",r=e.format||i);const s=Jt(t,o);a.push({label:n,value:en(s,r)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){l=en(t[n],i);break}if(!l){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(l=en(t[e[0]],i))}}const c=Object.assign(Object.assign({},Kt),r);return e.jsxs("div",{className:("semiotic-tooltip "+s).trim(),style:c,children:[l&&e.jsx("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:l}),a.map((t,n)=>e.jsxs("div",{style:{marginTop:0===n&&l?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},n))]})}}function nn(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 s=n(i);return null==s?null:e.jsx("div",{className:"semiotic-tooltip",style:Kt,children:s})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?tn(t):tn())}}function on({x:t,y:n,containerWidth:o,containerHeight:i,margin:r,children:s,className:l="stream-frame-tooltip",zIndex:a=1}){const c=Number.isFinite(t)&&Number.isFinite(n),u=f.useRef(null),[d,h]=f.useState(null);f.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,l,o,i]);let p;p=d?`translate(${d.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${d.height+12>i-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*i>n?"4px":"calc(-100% - 4px)"})`;const g=function(e){if(!f.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const o=n.style;if(o&&"object"==typeof o){if(null!=o.background&&""!==o.background)return!0;if(null!=o.backgroundColor&&""!==o.backgroundColor)return!0}return!1}(s),m=g?null:Kt;return c?e.jsx("div",{ref:u,className:g?l:(l+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},m||{}),{position:"absolute",left:r.left+t,top:r.top+n,transform:p,pointerEvents:"none",zIndex:a,width:"max-content"}),children:s}):null}function rn(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function sn(e,t,n=.6){var o,i,r,s,l;if(!rn(t))return;const a=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+a*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(l=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==l?l:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function ln(e,t,n,o=.35){rn(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function an(e){switch(e){case"monotoneX":return l.curveMonotoneX;case"monotoneY":return l.curveMonotoneY;case"cardinal":return l.curveCardinal;case"catmullRom":return l.curveCatmullRom;case"step":return l.curveStep;case"stepBefore":return l.curveStepBefore;case"stepAfter":return l.curveStepAfter;case"basis":return l.curveBasis;case"natural":return l.curveNatural;default:return null}}function cn(e,t,n){return null==t?n:"string"!=typeof t?t:J(e,t)||n}function un(e,t,n,o,i,r){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const l=e.createLinearGradient(n,o,i,r);for(const e of s)l.addColorStop(e.offset,e.color);return l}function dn(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 hn(e,t,n,o,i,r){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const l=s[s.length-1];if(0===l)return;const a=Math.min(.2*l,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=r;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let r=i;a>o&&(r*=o/a),a>l-o&&(r*=(l-o)/a),e.globalAlpha=Math.max(0,r),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function fn(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const r=t[0]*o,s=t[1]*o,l=t[0]+"px",a=t[1]+"px";return e.style.width!==l&&(e.style.width=l),e.style.height!==a&&(e.style.height=a),e.width===r&&e.height===s||(e.width=r,e.height=s),i.setTransform(o,0,0,o,0,0),i.translate(n.left,n.top),i}function pn(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function gn([e,t,n]){const o=1<<n;return[e-Math.floor(e/o)*o,t,n]}function mn(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 yn{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 vn{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,lineIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const n=this.particles[t];if(!n.active)return n.active=!0,n.t=0,n.offset=.6*(Math.random()-.5),n.lineIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n,o){for(let i=0;this.capacity>i;i++){const r=this.particles[i];if(!r.active)continue;const s=n[r.lineIndex];if(!s||2>s.length){r.active=!1;continue}if(r.t+=e*t,r.t>=1){r.active=!1;continue}const l=bn(s),a=xn(s,r.t*l),c=(o[r.lineIndex]||2)/2;r.x=a.x+a.nx*r.offset*c*2,r.y=a.y+a.ny*r.offset*c*2}}countForLine(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].lineIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}}function bn(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 xn(e,t){let n=0;for(let o=1;e.length>o;o++){const i=e[o][0]-e[o-1][0],r=e[o][1]-e[o-1][1],s=Math.sqrt(i*i+r*r);if(n+s>=t||o===e.length-1){const l=s>0?(t-n)/s:0,a=s>.001?s:1;return{x:e[o-1][0]+i*l,y:e[o-1][1]+r*l,nx:-r/a,ny:i/a}}n+=s}const o=e[e.length-1];return{x:o[0],y:o[1],nx:0,ny:0}}const jn={top:10,right:10,bottom:10,left:10},kn={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"},wn={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 On(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function Mn(e){return e?e.getContext("2d"):null}function Sn({data:t}){if(!t)return null;if(t.properties)return e.jsx("div",{className:"semiotic-tooltip",style:kn,children:e.jsx("div",{style:{fontWeight:600},children:t.properties.name||t.properties.NAME||t.properties.id||"Feature"})});const n=null!=t.data?t.data:t;if(!n||"object"!=typeof n)return null;const o=Object.entries(n).filter(([e])=>"data"!==e&&!e.startsWith("__")).slice(0,3);return 0===o.length?null:e.jsx("div",{className:"semiotic-tooltip",style:kn,children:o.map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,": "]}),e.jsx("span",{style:{fontWeight:600},children:n+""})]},t))})}Sn.ownsChrome=!0;const An=t.forwardRef(function(n,o){var i,r,s,a,d,h,f,p,g,m;const{projection:y,projectionExtent:v,fitPadding:b,projectionTransform:x,areas:j,points:k,lines:w,xAccessor:O,yAccessor:M,lineDataAccessor:S,pointIdAccessor:A,lineIdAccessor:C,lineType:z="geo",flowStyle:R="basic",graticule:L,zoomable:I,zoomExtent:N,onZoom:$,dragRotate:W,showParticles:B,particleStyle:_,tileURL:T,tileAttribution:F,tileCacheSize:H,size:q,width:G,height:V,responsiveWidth:U,responsiveHeight:Z,margin:Y,className:X,background:Q,areaStyle:K,pointStyle:ee,lineStyle:te,colorScheme:se,enableHover:le=!0,hoverAnnotation:ae,tooltipContent:ce,customClickBehavior:ue,customHoverBehavior:de,annotations:he,autoPlaceAnnotations:fe,decay:pe,pulse:ge,transition:me,animate:ye,staleness:ve,backgroundGraphics:be,foregroundGraphics:xe,title:je,legend:ke,legendPosition:we,legendLayout:Oe,legendHoverBehavior:Me,legendClickBehavior:Se,legendHighlightedCategory:Ae,legendIsolatedCategories:Ce,legendCategoryAccessor:Pe,onCategoriesChange:ze,showAxes:Re,accessibleTable:Le=!0,description:De,summary:Ie}=n,Ne=q||[G||600,V||400],$e=t.useRef(!0),Ee=ne({sizeProp:Ne,responsiveWidth:U,responsiveHeight:Z,userMargin:Y,marginDefault:jn,foregroundGraphics:xe,backgroundGraphics:be,animate:ye,transitionProp:me,themeDirtyRef:$e}),{reducedMotionRef:We,responsiveRef:Be,size:_e,margin:Te,adjustedWidth:Fe,adjustedHeight:He,resolvedForeground:qe,resolvedBackground:Ge,transition:Ve,introEnabled:Ue,tableId:Ze,rafRef:Ye,renderFnRef:Xe,scheduleRender:Qe,currentTheme:Ke}=Ee,Je=function(){const[e,n]=t.useState(!1);return jt(()=>{n(!0)},[]),e}(),et=function(){const e=t.useSyncExternalStore(kt,wt,Ot);return t.useRef(e).current}(),tt=t.useMemo(()=>Array.isArray(j)?Yt(j):j,[j]),nt=t.useMemo(()=>Yt(k),[k]),ot=t.useMemo(()=>Yt(w),[w]),it=t.useMemo(()=>null!=W?W:"orthographic"===On(y),[W,y]),rt=t.useMemo(()=>{var e,t;return{projection:y,projectionExtent:v,fitPadding:b,xAccessor:O,yAccessor:M,lineDataAccessor:S,lineType:z,flowStyle:R,areaStyle:K,pointStyle:ee,lineStyle:te,colorScheme:se,themeSemantic:E(Ke),themeSequential:null===(e=null==Ke?void 0:Ke.colors)||void 0===e?void 0:e.sequential,themeDiverging:null===(t=null==Ke?void 0:Ke.colors)||void 0===t?void 0:t.diverging,graticule:L,projectionTransform:x,decay:pe,pulse:ge,transition:Ve,introAnimation:Ue,annotations:he,pointIdAccessor:A,lineIdAccessor:C}},[y,v,b,O,M,S,z,R,K,ee,te,se,L,x,pe,ge,null==Ve?void 0:Ve.duration,null==Ve?void 0:Ve.easing,Ue,he,A,C,Ke]),st=function(e){const n=t.useRef(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return St(e,t);if(!At(e)||!At(t))return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],i=t[o];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!St(n,i))return!1}else{if(!At(n)||!At(i))return!1;if(!Mt(n,i))return!1}}return!0}(n.current,e)||(n.current=e),n.current}(rt),lt=t.useRef(null);lt.current||(lt.current=new P(st));const at=t.useRef(null),ct=t.useRef(null),ut=t.useRef(null),dt=t.useRef(null),ht=t.useRef(null);T&&!ht.current&&(ht.current=new yn(H||256));const ft=t.useRef(he),pt=t.useRef(null),gt=t.useRef(c.zoomIdentity),mt=t.useRef(!1),yt=t.useRef(null),Ct=t.useCallback(e=>{yt.current=e,Be&&"object"==typeof Be&&(Be.current=e)},[Be]),Pt=t.useRef(null),Rt=t.useRef(null),Lt=t.useRef(null),Dt=t.useRef(0);if(B&&!Lt.current){const e=null!==(i=null==_?void 0:_.maxPerLine)&&void 0!==i?i:30;Lt.current=new vn(50*e)}const It=t.useRef(null),Nt=t.useRef(null),[$t,Et]=t.useState(null),[Wt,Bt]=t.useState(0),_t=t.useRef(0),[Tt,Ft]=t.useState(!1),Ht=t.useRef([]),Zt=t.useRef(Pe),Xt=t.useRef(ze);Zt.current=Pe,Xt.current=ze;const Kt=t.useCallback(()=>{var e,t;const n=Zt.current,o=Xt.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=lt.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,Ht.current)||(Ht.current=i,o(i))},[]);t.useEffect(()=>{var e;null===(e=lt.current)||void 0===e||e.updateConfig(st),$e.current=!0,Qe()},[st,Qe]),t.useEffect(()=>{const e=lt.current;e&&(tt&&e.setAreas(tt),k&&e.setPoints(nt),w&&e.setLines(ot),$e.current=!0,Qe())},[tt,k,nt,w,ot,Qe]);const Jt=t.useCallback(e=>{var t;null!=e&&"object"==typeof e&&(null===(t=lt.current)||void 0===t||t.pushPoint(e),$e.current=!0,Qe())},[Qe]),en=t.useCallback(e=>{var t;const n=Yt(e);0!==n.length&&(null===(t=lt.current)||void 0===t||t.pushMany(n),$e.current=!0,Qe())},[Qe]),tn=t.useCallback(e=>{var t;null!=e&&"object"==typeof e&&(null===(t=lt.current)||void 0===t||t.pushLine(e),$e.current=!0,Qe())},[Qe]),nn=t.useCallback(e=>{var t;const n=Yt(e);0!==n.length&&(null===(t=lt.current)||void 0===t||t.pushManyLines(n),$e.current=!0,Qe())},[Qe]),rn=t.useCallback(()=>{var e;null===(e=lt.current)||void 0===e||e.clear(),$e.current=!0,Qe()},[Qe]);t.useImperativeHandle(o,()=>({push:Jt,pushMany:en,removePoint:e=>{var t,n;const o=null!==(n=null===(t=lt.current)||void 0===t?void 0:t.removePoint(e))&&void 0!==n?n:[];return o.length>0&&($e.current=!0,Qe()),o},pushLine:tn,pushManyLines:nn,removeLine:e=>{var t,n;const o=null!==(n=null===(t=lt.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==n?n:[];return o.length>0&&($e.current=!0,Qe()),o},getLines:()=>{var e,t;return null!==(t=null===(e=lt.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]},clear:rn,getProjection:()=>{var e,t,n;return null!==(n=null===(t=null===(e=lt.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=lt.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=lt.current)||void 0===e?void 0:e.cartogramLayout)&&void 0!==t?t:null},getZoom:()=>gt.current.k,resetZoom:()=>{const e=yt.current;e&&pt.current&&u.select(e).call(pt.current.transform,c.zoomIdentity)},getData:()=>{var e,t;return null!==(t=null===(e=lt.current)||void 0===e?void 0:e.getPoints())&&void 0!==t?t:[]}}),[Jt,en,tn,nn,rn,Qe]);const{hoverHandlerRef:bn,onPointerMove:xn,onPointerLeave:kn}=Ee;t.useEffect(()=>{bn.current=e=>{if(!le)return;const t=lt.current;if(!t||!t.scene.length)return;const n=ct.current;if(!n)return;const o=n.getBoundingClientRect(),i=e.clientX-o.left-Te.left,r=e.clientY-o.top-Te.top;if(0>i||i>Fe||0>r||r>He)return It.current=null,Nt.current=null,Et(null),null==de||de(null),void Qe();dt.current||(dt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const s=Mn(dt.current);if(!s)return;const l=D(t.scene,i,r,30,s,t.quadtree,t.maxPointRadius);if(l){const e=l.node,t=e.datum,n=Array.isArray(t)?null:(null==t?void 0:t.properties)?t:(null==t?void 0:t.data)||t;let o,s;"point"===e.type?(o=e.x,s=e.y):"geoarea"===e.type?(o=e.centroid[0],s=e.centroid[1]):(o=i,s=r);const a=Object.assign(Object.assign(Object.assign({},n),(null==n?void 0:n.properties)||{}),{data:n,properties:null==n?void 0:n.properties,__semioticHoverData:!0,x:o,y:s});It.current=a,Nt.current=e,Et(a),null==de||de(a),Qe()}else It.current&&(It.current=null,Nt.current=null,Et(null),null==de||de(null),Qe())}},[le,Fe,He,Te,de,Qe]),Ee.hoverLeaveRef.current=()=>{It.current=null,Nt.current=null,Et(null),null==de||de(null),Qe()};const An=t.useCallback(e=>{if(!ue)return;const t=lt.current;if(!t||!t.scene.length)return;const n=e.currentTarget.getBoundingClientRect(),o=e.clientX-n.left-Te.left,i=e.clientY-n.top-Te.top;dt.current||(dt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const r=Mn(dt.current);if(!r)return;const s=D(t.scene,o,i,30,r,t.quadtree,t.maxPointRadius);if(s){const e=s.node.datum,t=Array.isArray(e)?null:(null==e?void 0:e.properties)?e:(null==e?void 0:e.data)||e,n=(null==t?void 0:t.properties)?Object.assign(Object.assign({},t),t.properties):t;ue(Object.assign(Object.assign({},n),{data:t,properties:null==t?void 0:t.properties,__semioticHoverData:!0,x:o,y:i,time:o,value:i}))}},[ue,Te]),Cn=t.useRef(-1),Pn=t.useRef(null),zn=t.useCallback(e=>{const t=lt.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=Cn.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 Cn.current=-1,Pn.current=null,It.current=null,Nt.current=null,Et(null),null==de||de(null),void Qe();const r=0>o?0:i;Cn.current=r;const s=n[r];Pn.current={shape:s.shape,w:s.w,h:s.h};const l=s.datum,a=Object.assign(Object.assign(Object.assign({},l||{}),(null==l?void 0:l.properties)||{}),{data:l,properties:null==l?void 0:l.properties,x:s.x,y:s.y,__semioticHoverData:!0});It.current=a,Et(a),null==de||de(a),Qe()},[de,Qe]),Rn=t.useCallback(e=>{Cn.current=-1,Pn.current=null,xn(e)},[xn]);Xe.current=()=>{var e,t,n,o,i,r,s;Ye.current=0;const a=ct.current,c=lt.current;if(!a||!c)return;const u=performance.now();let d=!1;const h=Rt.current;h&&(Rt.current=null,c.applyRotation(h,{width:Fe,height:He}));const f=c.advanceTransition(We.current?u+1e6:u),p=!We.current&&f;if($e.current&&!f){const e={width:Fe,height:He},t=it?c.getRotation():null;c.computeScene(e);const n=gt.current,o=1!==n.k||0!==n.x||0!==n.y;it&&t?o?(c.setRotation(t),c.applyZoomScale(n.k,e)):c.applyRotation(t,e):o&&c.applyZoomTransform(n,e),$e.current=!1,a.setAttribute("aria-label",zt(c.scene,"Geographic chart")),Kt()}const g=pn();if(T&&ht.current){const t=at.current;if(t&&(null===(e=c.scales)||void 0===e?void 0:e.projection)){const e=fn(t,_e,Te,g);if(e){e.clearRect(-Te.left,-Te.top,_e[0],_e[1]),e.save(),e.beginPath(),e.rect(0,0,Fe,He),e.clip();const t=function(e,t){const{tileURL:n,projection:o,width:i,height:r,tileCache:s,onTileLoad:l}=t,a=o.scale(),c=o.translate(),u=function(e){const{size:t,scale:n,translate:o,clampX:i=!0,clampY:r=!0}=e,s=Math.max(Math.log(n)/Math.LN2-8,0),l=Math.round(s),a=1<<l,c=Math.pow(2,s-l+8),u=o[0]-n/2,d=o[1]-n/2,h=Math.max(i?0:-1/0,Math.floor((0-u)/c)),f=Math.min(i?a:1/0,Math.ceil((t[0]-u)/c)),p=Math.max(r?0:-1/0,Math.floor((0-d)/c)),g=Math.min(r?a:1/0,Math.ceil((t[1]-d)/c)),m=[];for(let e=p;g>e;++e)for(let t=h;f>t;++t)m.push([t,e,l]);return{tiles:m,translate:[u/c,d/c],scale:c}}({size:[i,r],scale:2*a*Math.PI,translate:c}),d=pn();let h=!0;for(const t of u.tiles){const[o,i,r]=gn(t),a=`${r}/${o}/${i}`;let c=s.get(a);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:a,lastUsed:performance.now()};s.set(a,t),e.onload=()=>{t.loaded=!0,null==l||l()},e.onerror=()=>{t.loaded=!0},e.src=mn(n,r,o,i,d),c=t}if(!c.loaded){h=!1;continue}const f=u.scale;e.drawImage(c.img,(t[0]+u.translate[0])*f-.5,(t[1]+u.translate[1])*f-.5,f+1,f+1)}return h}(e,{tileURL:T,projection:c.scales.projection,width:Fe,height:He,tileCache:ht.current,onTileLoad:()=>Qe()});e.restore(),t||(d=!0)}}}const m=fn(a,_e,Te,g);if(!m)return;if(m.clearRect(-Te.left,-Te.top,_e[0],_e[1]),Q&&!T){const e=J(m,Q);e&&(m.fillStyle=e,m.fillRect(0,0,Fe,He))}m.save(),m.beginPath(),m.rect(0,0,Fe,He),m.clip();const y=c.scene,v={width:Fe,height:He};if(function(e,t){var n,o,i;const r=t.filter(e=>"geoarea"===e.type);for(const t of r){if(!t.pathData)continue;t._cachedPath2D||(t._cachedPath2D=new Path2D(t.pathData));const r=t._cachedPath2D,s=t.style.fill||"#e0e0e0";if("none"!==s&&(e.fillStyle=s,e.globalAlpha=(null!==(n=t._decayOpacity)&&void 0!==n?n:1)*(null!==(o=t.style.fillOpacity)&&void 0!==o?o:1),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=J(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)}ln(e,t,r),e.globalAlpha=1,e.setLineDash([])}}(m,y),((e,t,n,o)=>{var i,r;const s=t.filter(e=>"line"===e.type);for(const a of s){if(2>a.path.length)continue;const c=a._introClipFraction;void 0!==c&&1>c&&(e.save(),e.beginPath(),e.rect(0,0,o.width*c,o.height),e.clip());const u=a.style.stroke||"#007bff",d=J(e,u)||u,h=a.style.strokeWidth||2,f=a.colorThresholds,p=a.rawValues;if(e.setLineDash(a.style.strokeDasharray?a.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=a.style.opacity&&(e.globalAlpha=a.style.opacity),e.lineWidth=h,e.lineCap=a.style.strokeLinecap||"butt",a.style._edgeFade){const v=null!==(i=a.style.opacity)&&void 0!==i?i:1;hn(e,a.path,d,h,v,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const g=an(a.curve),m=f&&f.length>0&&p&&p.length===a.path.length,y=a._decayOpacities;if(y&&y.length===a.path.length&&!m){e.strokeStyle=d;const b=null!==(r=a.style.opacity)&&void 0!==r?r:1;for(let x=0;a.path.length-1>x;x++)e.globalAlpha=.5*(y[x]+y[x+1])*b,e.beginPath(),e.moveTo(a.path[x][0],a.path[x][1]),e.lineTo(a.path[x+1][0],a.path[x+1][1]),e.stroke()}else if(m){let j=null,k=null,w=null,O=null,M=!1;function S(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),M=!0}function A(){M&&(e.stroke(),M=!1)}for(let C=0;a.path.length>C;C++){const[P,z]=a.path[C],R=p[C],L=dn(R,f,d);if(null!==j&&null!==O&&null!==w){if(L===O)e.lineTo(P,z);else{const D=[];for(const I of f){const N=I.value;(w>N||N>R)&&(N>w||R>N)||w===N||R===N||D.push({t:(N-w)/(R-w)})}D.sort((e,t)=>e.t-t.t);for(const $ of D){const E=j+(P-j)*$.t,W=k+(z-k)*$.t,B=dn(w+(R-w)*Math.min($.t+1e-4,1),f,d);e.lineTo(E,W),A(),S(B,E,W)}e.lineTo(P,z)}j=P,k=z,w=R,O=L}else S(L,P,z),j=P,k=z,w=R,O=L}A()}else{e.beginPath();const _=a.strokeGradient&&a.path.length>=2?un(e,a.strokeGradient,a.path[0][0],0,a.path[a.path.length-1][0],0):null;if(e.strokeStyle=_||d,g)l.line().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(a.path);else{const[T,F]=a.path[0];e.moveTo(T,F);for(let H=1;a.path.length>H;H++)e.lineTo(a.path[H][0],a.path[H][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=cn(e,a.style.fill,a.style.fill),g&&!m)l.line().x(e=>e[0]).y(e=>e[1]).curve(g).context(e)(a.path);else{const[G,V]=a.path[0];e.moveTo(G,V);for(let U=1;a.path.length>U;U++)e.lineTo(a.path[U][0],a.path[U][1])}const q=a.path[0][0];e.lineTo(a.path[a.path.length-1][0],o.height),e.lineTo(q,o.height),e.closePath(),e.fill()}void 0!==c&&1>c&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(m,y,0,v),((e,t)=>{var n,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=cn(e,r.style.fill,"#4e79a7"),e.fill(),r.style.stroke&&(e.strokeStyle=cn(e,r.style.stroke,r.style.stroke),e.lineWidth=r.style.strokeWidth||1,e.stroke()),sn(e,r)}}finally{e.restore()}}})(m,y),B&&Lt.current){const e=Lt.current,l=y.filter(e=>"line"===e.type);if(l.length>0){const a=_||{},c=.3*(null!==(t=a.speedMultiplier)&&void 0!==t?t:1),h=null!==(n=a.maxPerLine)&&void 0!==n?n:30,f=null!==(o=a.spawnRate)&&void 0!==o?o:.15,p=null!==(i=a.radius)&&void 0!==i?i:2,g=null!==(r=a.opacity)&&void 0!==r?r:.7,y=u/1e3,v=Dt.current>0?Math.min(y-Dt.current,.1):.016;Dt.current=y;const b=l.map(e=>e.path),x=l.map(e=>e.style.strokeWidth||2);for(let t=0;l.length>t;t++)Math.random()<f&&e.countForLine(t)<h&&e.spawn(t);e.step(v,c,b,x),m.globalAlpha=g;for(let t=0;e.particles.length>t;t++){const n=e.particles[t];if(!n.active)continue;const o=l[n.lineIndex],i="function"==typeof a.color?a.color(null!==(s=null==o?void 0:o.datum)&&void 0!==s?s:{}):"source"!==a.color&&a.color?a.color:(null==o?void 0:o.style.stroke)||"#fff";m.beginPath(),m.arc(n.x,n.y,p,0,2*Math.PI),m.fillStyle=i,m.fill()}m.globalAlpha=1,d=!0}}m.restore();const b=ut.current;if(b){const e=fn(b,_e,Te,g);if(e){e.clearRect(-Te.left,-Te.top,_e[0],_e[1]);const t=Nt.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 ae?ae:void 0,i=(null==o?void 0:o.pointColor)||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(t);e.beginPath(),e.arc(n.x,n.y,n.r+3,0,2*Math.PI),i?(e.save(),e.globalAlpha=.4,e.fillStyle=i,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=i||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}}const x=he!==ft.current;x&&(ft.current=he),($e.current||x||p&&he&&he.length>0)&&($e.current||x||u-_t.current>=33)&&(Bt(e=>e+1),_t.current=u),(p||null!=c.activeTransition||c.hasActivePulses||d)&&(Ye.current=requestAnimationFrame(()=>Xe.current()))},function(e){const{hydrated:n,wasHydratingFromSSR:o,storeRef:i,dirtyRef:r,renderFnRef:s,cleanup:l}=e;jt(()=>{var e,t;n&&o&&(null===(t=null===(e=i.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===t||t.call(e)),r.current=!0,s.current()},[n,o]);const a=t.useRef(l);a.current=l,t.useEffect(()=>()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.call(a)},[])}({hydrated:Je,wasHydratingFromSSR:et,storeRef:lt,dirtyRef:$e,renderFnRef:Xe,cleanup:()=>{var e;return null===(e=ht.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{$e.current=!0,Qe()},[Fe,He,Q,Qe]),function(e,n,o,i,r,s){const l=t.useRef("fresh");t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{const t=n.current;if(!t||0===t.lastIngestTime)return;const a="undefined"!=typeof performance?performance.now():Date.now(),c=function(e,t){var n,o;if(!e||0>=t)return ie;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 s=null!==(o=n.fresh)&&void 0!==o?o:1,l=null!==(i=n.aging)&&void 0!==i?i:1.5,a=null!==(r=n.stale)&&void 0!==r?r:3;return t*s>e?"fresh":t*l>e?"aging":t*a>e?"stale":"expired"}(t,i,e.thresholds);return{alpha:Object.assign(Object.assign({},oe),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}:ie}(e,a-t.lastIngestTime);c.band===l.current&&c.isStale===r||(l.current=c.band,c.isStale!==r&&s(c.isStale),o.current=!0,i())},1e3);return()=>clearInterval(t)},[e,r,i])}(ve,lt,$e,Qe,Tt,Ft),t.useEffect(()=>{if("production"!==process.env.NODE_ENV&&T){const e=On(y);e&&"mercator"!==e&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${e}". Raster tiles use Web Mercator and will not align with other projections.`)}},[T,y]),t.useEffect(()=>{const e=yt.current;if(!I||!e)return pt.current&&e&&(u.select(e).on(".zoom",null),pt.current=null),void(e&&u.select(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=N||[1,8],o={width:Fe,height:He};if(it){let i=gt.current.k;const r=e=>{var r;i=Math.max(t,Math.min(n,e)),gt.current=c.zoomIdentity.scale(i);const s=lt.current;s&&(s.applyZoomScale(i,o),$e.current=!1,Qe(),(null===(r=s.scales)||void 0===r?void 0:r.projection)&&(null==$||$({projection:s.scales.projection,zoom:s.currentZoom})))};pt.current={scaleBy:(e,t)=>r(i*t),transform:(e,t)=>{var n;return r(null!==(n=null==t?void 0:t.k)&&void 0!==n?n:1)}};const s=e=>{e.preventDefault(),r(i*(0>e.deltaY?1.1:1/1.1))},l=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),r(1.5*i))};e.addEventListener("wheel",s,{passive:!1}),e.addEventListener("dblclick",l);const a=.4,u=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const o=lt.current;if(!o)return;const i=o.getRotation();Pt.current={x:t.clientX,y:t.clientY,rotation:[...i]},e.setPointerCapture(t.pointerId),t.preventDefault()},d=e=>{const t=Pt.current;t&&(Rt.current=[t.rotation[0]+(e.clientX-t.x)*a,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*a)),t.rotation[2]],Qe())},h=t=>{var n;if(!Pt.current)return;Pt.current=null,e.releasePointerCapture(t.pointerId);const i=Rt.current;if(i){Rt.current=null;const e=lt.current;e&&(e.applyRotation(i,o),Qe())}const r=lt.current;(null===(n=null==r?void 0:r.scales)||void 0===n?void 0:n.projection)&&(null==$||$({projection:r.scales.projection,zoom:r.currentZoom}))};return e.addEventListener("pointerdown",u),e.addEventListener("pointermove",d),e.addEventListener("pointerup",h),e.addEventListener("pointercancel",h),()=>{e.removeEventListener("wheel",s),e.removeEventListener("dblclick",l),e.removeEventListener("pointerdown",u),e.removeEventListener("pointermove",d),e.removeEventListener("pointerup",h),e.removeEventListener("pointercancel",h),pt.current=null}}const i=c.zoom().scaleExtent([t,n]).extent([[0,0],[_e[0],_e[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;gt.current=t,mt.current=!0;const n=lt.current;n&&(n.applyZoomTransform(t,o),$e.current=!1,Qe())}).on("end",e=>{var t;gt.current=e.transform,mt.current=!1;const n=lt.current;(null===(t=null==n?void 0:n.scales)||void 0===t?void 0:t.projection)&&(null==$||$({projection:n.scales.projection,zoom:n.currentZoom}))});return pt.current=i,u.select(e).call(i),()=>{u.select(e).on(".zoom",null)}},[I,N,it,_e,Fe,He,Te,$,Qe]);const Ln=le&&!1!==ae,Dn=Ln&&$t?ce?ce($t):e.jsx(Sn,{data:$t}):null,In=Dn?e.jsx(on,{x:$t.x,y:$t.y,containerWidth:Fe,containerHeight:He,margin:Te,className:"stream-frame-tooltip",zIndex:10,children:Dn}):null;if(xt||!Je&&et){const t=lt.current;t&&(tt||k||w)&&(tt&&t.setAreas(tt),k&&t.setPoints(nt),w&&t.setLines(ot),t.computeScene({width:Fe,height:He}));const n=null!==(r=null==t?void 0:t.scene)&&void 0!==r?r:[];return e.jsxs("div",{ref:Ct,className:"stream-geo-frame"+(X?" "+X:""),role:"img","aria-label":De||("string"==typeof je?je:"Geographic chart"),style:{position:"relative",width:U?"100%":_e[0],height:Z?"100%":_e[1]},children:[e.jsx(Gt,{summary:Ie}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:_e[0],height:_e[1],style:{position:"absolute",left:0,top:0},children:[e.jsx("g",{transform:`translate(${Te.left},${Te.top})`,children:Ge}),e.jsxs("g",{transform:`translate(${Te.left},${Te.top})`,children:[Q&&e.jsx("rect",{x:0,y:0,width:Fe,height:He,fill:Q}),n.map((t,n)=>function(t,n){var o,i,r,s,l,a;switch(t.type){case"geoarea":{const r=t;return r.pathData?e.jsx("path",{d:r.pathData,fill:bt(r.style.fill,"#e0e0e0"),fillOpacity:null!==(o=r.style.fillOpacity)&&void 0!==o?o:1,stroke:r.style.stroke||"none",strokeWidth:r.style.strokeWidth||.5,strokeDasharray:r.style.strokeDasharray,opacity:null!==(i=r._decayOpacity)&&void 0!==i?i:1},"geoarea-"+n):null}case"point":{const o=t;return e.jsx("circle",{cx:o.x,cy:o.y,r:o.r,fill:bt(o.style.fill),fillOpacity:null!==(r=o.style.fillOpacity)&&void 0!==r?r:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:null!==(s=o._decayOpacity)&&void 0!==s?s:null!==(l=o.style.opacity)&&void 0!==l?l:1},"point-"+n)}case"line":{const o=t;if(2>o.path.length)return null;const i="M"+o.path.map(e=>`${e[0]},${e[1]}`).join("L");return e.jsx("path",{d:i,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||1.5,strokeDasharray:o.style.strokeDasharray,opacity:null!==(a=o.style.opacity)&&void 0!==a?a:1},"line-"+n)}default:return null}}(t,n))]})]}),e.jsx(vt,{width:Fe,height:He,totalWidth:_e[0],totalHeight:_e[1],margin:Te,scales:null,showAxes:!1,title:je,legend:ke,legendPosition:we,legendLayout:Oe,legendHoverBehavior:Me,legendClickBehavior:Se,legendHighlightedCategory:Ae,legendIsolatedCategories:Ce,foregroundGraphics:qe,annotations:he,autoPlaceAnnotations:fe,annotationFrame:0,xValues:[],yValues:[],pointNodes:n.filter(e=>"point"===e.type)})]})}return e.jsxs("div",{ref:Ct,className:"stream-geo-frame"+(X?" "+X:""),role:"group","aria-label":De||("string"==typeof je?je:"Geographic chart"),tabIndex:0,style:Object.assign({position:"relative",width:U?"100%":_e[0],height:Z?"100%":_e[1],overflow:"hidden"},I?{touchAction:"none"}:{}),onKeyDown:zn,children:[Le&&e.jsx(Vt,{tableId:Ze}),Le&&e.jsx(qt,{scene:null!==(a=null===(s=lt.current)||void 0===s?void 0:s.scene)&&void 0!==a?a:[],chartType:"Geographic chart",tableId:Ze,chartTitle:"string"==typeof je?je:void 0}),e.jsx(Gt,{summary:Ie}),e.jsx(Ut,{hoverPoint:$t}),e.jsxs("div",{role:"img","aria-label":De||("string"==typeof je?je:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:Ln?Rn:void 0,onMouseLeave:Ln?kn:void 0,onClick:ue?An:void 0,children:[Ge&&e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:_e[0],height:_e[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${Te.left},${Te.top})`,children:Ge})}),T&&e.jsx("canvas",{ref:at,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx("canvas",{ref:ct,"aria-label":zt(null!==(h=null===(d=lt.current)||void 0===d?void 0:d.scene)&&void 0!==h?h:[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),e.jsx("canvas",{ref:ut,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx(vt,{width:Fe,height:He,totalWidth:_e[0],totalHeight:_e[1],margin:Te,scales:null,showAxes:null!=Re&&Re,title:je,legend:ke,legendPosition:we,legendLayout:Oe,legendHoverBehavior:Me,legendClickBehavior:Se,legendHighlightedCategory:Ae,legendIsolatedCategories:Ce,foregroundGraphics:qe,annotations:he,autoPlaceAnnotations:fe,annotationFrame:Wt,xValues:[],yValues:[],pointNodes:null===(f=lt.current)||void 0===f?void 0:f.scene.filter(e=>"point"===e.type)}),(null==ve?void 0:ve.showBadge)&&e.jsx(re,{isStale:Tt,position:ve.badgePosition}),I&&e.jsxs("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:[e.jsx("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=yt.current,n=pt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(u.select(t),1.5)},style:wn,children:"+"}),e.jsx("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=yt.current,n=pt.current;t&&(null==n?void 0:n.scaleBy)&&n.scaleBy(u.select(t),1/1.5)},style:wn,children:"−"})]}),F&&e.jsx("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:F}),e.jsx(Qt,{active:Cn.current>=0,hoverPoint:$t,margin:Te,size:_e,shape:null===(p=Pn.current)||void 0===p?void 0:p.shape,width:null===(g=Pn.current)||void 0===g?void 0:g.w,height:null===(m=Pn.current)||void 0===m?void 0:m.h}),In]})]})});function Cn(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function Pn(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function zn(e){const t=e.map(Cn),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return Pn(e,n,o)}if(e>=1){const[e,o,i]=t[n];return Pn(e,o,i)}const o=e*n,i=Math.floor(o),r=o-i,[s,l,a]=t[i],[c,u,d]=t[i+1];return Pn(Math.round(s+(c-s)*r),Math.round(l+(u-l)*r),Math.round(a+(d-a)*r))}}An.displayName="StreamGeoFrame";const Rn=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ln=zn(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Dn=zn(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),In=zn(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Nn=zn(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),$n=zn(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),En=zn(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),Wn=zn(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),Bn=zn(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),_n=zn(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Tn=zn(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Fn=zn(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Hn=zn(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),qn={blues:Ln,reds:Dn,greens:In,viridis:Wn,oranges:Nn,purples:$n,greys:En,plasma:Bn,inferno:_n,magma:Tn,cividis:Fn,turbo:Hn};function Gn(e){return e&&qn[e]||Ln}zn(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),zn(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),zn(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),zn(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),zn(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),zn(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),zn(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);const Vn=Object.assign({category10:Rn,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]},qn),Un=Rn,Zn=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Yn=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 Xn(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")||Yn.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):Un[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))%Un.length]}function Qn(e,t,n="category10"){const i=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),r=i.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return o.scaleOrdinal().domain(i).range(n).unknown("#999");const s=Vn[n]||Vn.category10;if(r&&"function"==typeof s){let e=-1/0;for(const t of i){const n=Number(t);n>e&&(e=n)}return t=>s(Number(t)/e)}{const e=Array.isArray(s)?s:Un;return o.scaleOrdinal().domain(i).range(e).unknown("#999")}}function Kn(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[r,s]=o,[l,a]=n;if(s===r)return(l+a)/2;let c=(i-r)/(s-r);return 0>c?c=0:c>1&&(c=1),l+c*(a-l)}const Jn=t.createContext(null);function eo(){return t.useContext(Jn)}function to(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 no(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function oo(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[io,ro]=N(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||!oo(o,n))return!1}return!0}(i,n))return{};const r=new Map(e.selections),s=no(r,t),l=new Map(s.clauses);return l.set(n.clientId,n),r.set(t,Object.assign(Object.assign({},s),{clauses:l})),{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=no(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}})}})),[so,lo]=N(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 ao(e){const n=t.useId(),o=e.clientId||n,{name:i}=e,r=ro(e=>e.selections.get(i)),s=ro(e=>e.setClause),l=ro(e=>e.clearClause),a=t.useMemo(()=>!!r&&r.clauses.size>0,[r]);return{predicate:t.useMemo(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(to(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,o):()=>!0,[r,o]),isActive:a,selectPoints:t.useCallback(e=>{const t={};let n=!1;for(const[o,i]of Object.entries(e))t[o]={type:"point",values:new Set(i)},n=!0;n&&s(i,{clientId:o,type:"point",fields:t})},[o,i,s]),selectInterval:t.useCallback(e=>{const t={};let n=!1;for(const[o,i]of Object.entries(e))t[o]={type:"interval",range:i},n=!0;n&&s(i,{clientId:o,type:"interval",fields:t})},[o,i,s]),clear:t.useCallback(()=>{l(i,o)},[l,i,o]),clientId:o}}function co(e){const n=e.name||"hover",{fields:o}=e,{predicate:i,isActive:r,selectPoints:s,clear:l}=ao({name:n});return{onHover:t.useCallback(e=>{if(!e)return void l();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1})(t)&&s(t)},[o,s,l,n]),predicate:i,isActive:r}}const uo=t.createContext(!1),ho=t.createContext(null),fo="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function po(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 go(e,t,n){return t?(o,...i)=>{var r;const s=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(s,n.selectedStyle);else{const e=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.5;s.opacity=e,s.fillOpacity=e,s.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(s,n.unselectedStyle)}return s}:e}function mo(){return G(e=>e.theme)}f.createContext(void 0);const yo="#007bff";function vo(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 bo(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 xo(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function jo(){var e;const t=mo(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function ko({selection:e,linkedHover:n,fallbackFields:o=[],unwrapData:i=!1,onObservation:r,chartType:s,chartId:l,onClick:a,hoverHighlight:c,colorByField:u}){const d=t.useId(),h=po(n,o),f="series"===(null==h?void 0:h.mode)?[h.seriesField||u||o[0]].filter(e=>!!e):(null==h?void 0:h.fields)||o||[],p=ao({name:(null==e?void 0:e.name)||"__unused__"}),g=co({name:(null==h?void 0:h.name)||"hover",fields:f}),m=lo(e=>e.pushObservation),y=e?{isActive:p.isActive,predicate:p.predicate}:null,[v,b]=t.useState(null),x=u||o[0],j=t.useMemo(()=>{if(!c||null==v||!x)return null;const e=v,t=x;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[c,v,x]),k=t.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const n=vo(e,t,h.xField);null!=n&&function(e,t,n){const o=et.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(et={positions:new Map(et.positions).set(e,{xValue:t,sourceId:n})},nt())}(h.name||"hover",n,d)}"x-position"!==(null==h?void 0:h.mode)&&g.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&ot(h.name||"hover",d),"x-position"!==(null==h?void 0:h.mode)&&g.onHover(null);if(c&&x)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[x];b(null!=n?n+"":null)}else b(null);if(r||m){const n={timestamp:Date.now(),chartType:s||"unknown",chartId:l};if(e){const i=bo(e),s=Object.assign(Object.assign({},n),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(s),m&&m(s)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});r&&r(e),m&&m(e)}}},[n,g,h,d,r,s,l,m,c,x]),w=t.useCallback(e=>{var t,n,o,i;if("x-position"===(null==h?void 0:h.mode)&&h.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=vo(e,t,h.xField);null!=n&&function(e,t,n){const o=et.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(et.positions);return t.delete(e),et={positions:t},nt(),!1}et={positions:new Map(et.positions).set(e,{xValue:t,sourceId:n,locked:!0})},nt()}(h.name||"hover",n,d)}if(e&&a){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),a(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(r||m){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:l};if(e){const n=bo(e),s=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(i=e.y)&&void 0!==i?i:0});r&&r(s),m&&m(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});r&&r(e),m&&m(e)}}},[a,r,m,s,l,h,d]);return t.useEffect(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{it(e,d),ot(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:y,hoverSelectionHook:j,customHoverBehavior:k,customClickBehavior:w,crosshairSourceId:d}}function wo({data:e,colorBy:n,colorScale:o,showLegend:i,legendPosition:r="right",userMargin:s,defaults:l={top:50,bottom:60,left:70,right:40},categories:a}){const c=t.useContext(uo),u=null!==t.useContext(ho),d=void 0!==i?i:!c&&!!n,h=!!n&&(d||u),f=t.useMemo(()=>{if(!h)return[];if(void 0!==a)return a;const t=new Set;for(const o of e){const e="function"==typeof n?n(o):o[n];null!=e&&t.add(e+"")}return Array.from(t)},[a,n,e,h]);!function(e){const n=t.useContext(ho),o=t.useId(),i=function(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}(e),r=t.useRef([]);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(r.current,i)||(r.current=i);const s=r.current;fo(()=>{if(n)return()=>n.unregisterCategories(o)},[n,o]),fo(()=>{n&&n.registerCategories(o,s)},[n,o,s])}(u&&n?f:[]);const p=t.useMemo(()=>{if(!d||!n)return;const t=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:r,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==r&&(n.strokeWidth=r),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),l=s?o(s,t,n):n?n(i):Zn[r%Zn.length];return{label:i+"",color:l}}),label:""}]}}({data:e,colorBy:n,colorScale:o,getColor:Xn,categories:f});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[d,n,e,o,f]),g=t.useMemo(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=t=>{const n=e[t];return"number"==typeof n?n:l[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return p&&("right"===r&&!o("right")&&110>n.right?n.right=110:"left"===r&&!o("left")&&110>n.left?n.left=110:"top"===r&&!o("top")&&50>n.top?n.top=50:"bottom"===r&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[l,s,p,r]);return{legend:p,margin:g,legendPosition:r}}const Oo={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 Mo(e,t,n){var o,i,r,s,l,a,c;const u=Oo[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:u.width,height:null!==(i=t.height)&&void 0!==i?i:u.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(l=t.enableHover)&&void 0!==l?l:!!t.linkedHover||u.enableHover,showLegend:null!==(a=t.showLegend)&&void 0!==a?a:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:So(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function So(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 Ao(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 Co({componentName:t,message:n,diagnosticHint:o,width:i,height:r}){return e.jsx("div",{role:"alert",style:{width:i,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:e.jsxs("div",{style:{textAlign:"center",maxWidth:400},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),e.jsx("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),o&&e.jsx("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:o})]})})}class Po extends f.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.jsx(Co,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var zo;const Ro="undefined"!=typeof process&&"production"!==(null===(zo=process.env)||void 0===zo?void 0:zo.NODE_ENV);function Lo({componentName:t,width:n,height:o,children:i}){return e.jsx(Po,{fallback:i=>e.jsx(Co,{componentName:t,message:i.message,width:n,height:o}),children:i})}const Do={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"},Io={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function No(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},Do),{width:n,height:o}),children:i||"No data available"}):null}function $o(t,n,o,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e.jsx("div",{style:{width:n,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const r=Math.min(5,Math.floor(o/40)),s=Math.max(8,Math.floor(o/(3*r))),l=Math.max(6,Math.floor(o/(2.5*r))),a=Math.floor((o-(r*(s+l)-l))/2);return e.jsx("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,o)=>e.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},Io),{position:"absolute",top:a+o*(s+l),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:s,opacity:.5+o%2*.2})},o))})}function Eo(e,t,n,o){if(!Ro)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 Wo(e){const n=G(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,o;if(void 0!==e||void 0!==n)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:n})},[e,n])}function Bo(e,t,n,o){return new(n||(n=Promise))(function(i,r){function s(e){try{a(o.next(e))}catch(e){r(e)}}function l(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,l)}a((o=o.apply(e,t||[])).next())})}function _o(e){return e}function To(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 _o;var t,n,o=e.scale[0],i=e.scale[1],r=e.translate[0],s=e.translate[1];return function(e,l){l||(t=n=0);var a=2,c=e.length,u=Array(c);for(u[0]=(t+=e[0])*o+r,u[1]=(n+=e[1])*i+s;c>a;)u[a]=e[a],++a;return u}}(e.transform),o=e.arcs;function i(e,t){t.length&&t.pop();for(var i=o[0>e?~e:e],r=0,s=i.length;s>r;++r)t.push(n(i[r],r));0>e&&function(e,t){for(var n,o=e.length,i=o-t;i<--o;)n=e[i],e[i++]=e[o],e[o]=n}(t,s)}function r(e){return n(e)}function s(e){for(var t=[],n=0,o=e.length;o>n;++n)i(e[n],t);return 2>t.length&&t.push(t[0]),t}function l(e){for(var t=s(e);4>t.length;)t.push(t[0]);return t}function a(e){return e.map(l)}return function e(t){var n,o=t.type;switch(o){case"GeometryCollection":return{type:o,geometries:t.geometries.map(e)};case"Point":n=r(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(r);break;case"LineString":n=s(t.arcs);break;case"MultiLineString":n=t.arcs.map(s);break;case"Polygon":n=a(t.arcs);break;case"MultiPolygon":n=t.arcs.map(a);break;default:return null}return{type:o,coordinates:n}}(t)}(e,t);return null==n&&null==o?{type:"Feature",properties:i,geometry:r}:null==o?{type:"Feature",id:n,properties:i,geometry:r}:{type:"Feature",id:n,bbox:o,properties:i,geometry:r}}"function"==typeof SuppressedError&&SuppressedError;const Fo=new Map;function Ho(e){var t;return null!==(t=e.default)&&void 0!==t?t:e}function qo(e){return Bo(this,void 0,void 0,function*(){const t=Fo.get(e);if(t)return t;const{topology:n,objectName:o}=yield function(e){return Bo(this,void 0,void 0,function*(){switch(e){case"world-110m":return{topology:Ho(yield import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:Ho(yield import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:Ho(yield import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:Ho(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 To(e,t)})}:To(e,t)}(n,n.objects[o]),r="features"in i?i.features:[i];return Fo.set(e,r),r})}function Go(e){const n=t.useMemo(()=>Array.isArray(e)?e:void 0,[e]),[o,i]=t.useState(null);return t.useEffect(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return i(null),qo(e).then(e=>{t||i(e)}),()=>{t=!0}}var t;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),i(null)}else i(null)},[e]),void 0!==n?n:o}function Vo(n){var i;const r=Mo(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),s=function(){var e;const t=mo();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),{areas:l,valueAccessor:a,colorScheme:c,projection:u="equalEarth",graticule:d,fitPadding:h,zoomable:f,zoomExtent:p,onZoom:g,dragRotate:m,tileURL:y,tileAttribution:v,tileCacheSize:b,tooltip:x,areaOpacity:j=1,annotations:k,margin:w,className:O,selection:M,linkedHover:S,onObservation:A,onClick:C,chartId:P,loading:z,loadingContent:R,emptyContent:L,frameProps:D={},stroke:I,strokeWidth:N,opacity:$}=n,E=null!=f?f:!!y,W=Go(l),B=t.useMemo(()=>W?Yt(W):W,[W]),_=t.useMemo(()=>"function"==typeof a?a:e=>{var t,n;return null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t[a])&&void 0!==n?n:null==e?void 0:e[a]},[a]),T=null!==(i=null!=c?c:s)&&void 0!==i?i:"blues",F=t.useMemo(()=>{if(!B)return o.scaleSequential(Gn(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(const n of B){const o=_(n);null!=o&&isFinite(o)&&(e>o&&(e=o),o>t&&(t=o))}const n=Gn(T);return o.scaleSequential(n).domain([Number.isFinite(e)?e:0,Number.isFinite(t)?t:1])},[B,_,T]),{activeSelectionHook:H,customHoverBehavior:q,customClickBehavior:G}=ko({selection:M,linkedHover:S,onObservation:A,onClick:C,chartType:"ChoroplethMap",chartId:P}),V=Wo(M),U=t.useMemo(()=>{const e=Ao(e=>{const t=_(e);return{fill:null!=t&&isFinite(t)?F(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:j}},{stroke:I,strokeWidth:N,opacity:$});return H?go(e,H,V):e},[_,F,H,V,j,I,N,$]),Z=t.useMemo(()=>t=>{var n,o;const i=(null===(n=null==t?void 0:t.properties)||void 0===n?void 0:n.name)||(null===(o=null==t?void 0:t.properties)||void 0===o?void 0:o.NAME)||(null==t?void 0:t.name)||(null==t?void 0:t.NAME)||"Feature",r=_(t);return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e.jsx("div",{style:{fontWeight:600},children:i}),null!=r&&e.jsx("div",{style:{opacity:.7},children:(s=r,"number"==typeof s&&isFinite(s)?Number.isInteger(s)?s.toLocaleString():s.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=s?s:"")+"")})]});var s},[_]),Y=t.useMemo(()=>Object.assign({top:10,right:10,bottom:10,left:10},function(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}(w)),[w]),X=$o(z,r.width,r.height,R)||(B?null:$o(!0,r.width,r.height,R)),Q=X?null:No(B,r.width,r.height,L);if(Array.isArray(B)&&B.length>0){const t=B[0];if(!t||"object"!=typeof t||!t.geometry)return e.jsx(Co,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:r.width,height:r.height})}const K=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:B,areaStyle:U,size:[r.width,r.height],margin:Y,enableHover:!0,tooltipContent:!1===x?()=>null:!0===x?Z:nn(x)||Z},null!=d&&{graticule:d}),null!=h&&{fitPadding:h}),E&&{zoomable:!0}),p&&{zoomExtent:p}),g&&{onZoom:g}),null!=m&&{dragRotate:m}),y&&{tileURL:y}),v&&{tileAttribution:v}),b&&{tileCacheSize:b}),(S||A||C)&&{customHoverBehavior:q}),(A||C)&&{customClickBehavior:G}),k&&k.length>0&&{annotations:k}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),O&&{className:O}),null!=n.animate&&{animate:n.animate}),D);return X||Q||e.jsx(Lo,{componentName:"ChoroplethMap",width:r.width,height:r.height,children:e.jsx(An,Object.assign({},K))})}function Uo(e){const{data:n,rawData:o,colorBy:i,colorScheme:r,legendInteraction:s,legendPosition:l,selection:a,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:f,chartId:p,showLegend:g,userMargin:m,marginDefaults:y,onClick:v,hoverHighlight:b,loading:x,loadingContent:j,emptyContent:k,width:w,height:O}=e,M=void 0===o,S=t.useMemo(()=>Yt(n),[n]),[A,C]=t.useState([]),P=t.useCallback(e=>{C(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),z="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:R,hoverSelectionHook:L,customHoverBehavior:D,customClickBehavior:I,crosshairSourceId:N}=ko({selection:a,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:f,chartId:p,onClick:v,hoverHighlight:b,colorByField:z}),$=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(c,N),E=function(e,n,o){const i=eo(),r=jo();return t.useMemo(()=>{var t;if(!n)return;const s=null!=i?i:void 0,l=null!==(t=null!=o?o:r&&r.length>0?r:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof n){const t=Array.from(new Set(e.map(e=>n(e)+"")));if(s&&xo(s)){const e=Qn(t.map(e=>({_cat:e})),"_cat",l);return t=>s[t]||e(t)}return Qn(t.map(e=>({_cat:e})),"_cat",l)}if(s&&xo(s)){const t=Qn(e,n,l);return e=>s[e]||t(e)}return Qn(e,n,l)}if(s&&xo(s)){const e=Qn([{_:"a"}],"_",l);return t=>s[t]||e(t)}},[e,n,o,i,r])}(S,i,r),W=t.useMemo(()=>{if(!i)return[];const e=new Set;for(const t of S){const n="function"==typeof i?i(t):t[i];null!=n&&e.add(n+"")}return Array.from(e)},[S,i]),B=t.useMemo(()=>M&&A.length>0?A:W,[M,A,W]),_=function(e,n,o){const[i,r]=t.useState(null),[s,l]=t.useState(new Set),a=t.useMemo(()=>new Set,[]),c=t.useCallback(t=>{"highlight"===e&&r(t?t.label:null)},[e]),u=t.useCallback(t=>{"isolate"===e&&l(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),d=t.useMemo(()=>{if(!e||"none"===e||!n)return null;const t="string"==typeof n?n:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof n?n(e):null)===i}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const o=t?e[t]:"function"==typeof n?n(e):null;return s.has(o)}}:null},[e,n,i,s]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?s:a,onLegendHover:c,onLegendClick:u,legendSelectionHook:d}}(s,i,B),T=t.useMemo(()=>L||(_.legendSelectionHook?_.legendSelectionHook:R),[L,_.legendSelectionHook,R]),F=Wo(a),H=jo(),q=eo(),G=t.useMemo(()=>{if(E)return E;if(!i||0===B.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:H&&H.length>0?H:Zn,t="__streamCat",n=Qn(B.map(e=>({[t]:e})),t,e);return e=>(null==q?void 0:q[e])||n(e)||"#999"},[E,i,B,r,H,q]),{legend:V,margin:U,legendPosition:Z}=wo({data:S,colorBy:i,colorScale:G,showLegend:g,legendPosition:l,userMargin:m,defaults:y,categories:B}),Y=t.useMemo(()=>{const e={};return V&&(e.legend=V,e.legendPosition=Z),s&&"none"!==s&&(e.legendHoverBehavior=_.onLegendHover,e.legendClickBehavior=_.onLegendClick,e.legendHighlightedCategory=_.highlightedCategory,e.legendIsolatedCategories=_.isolatedCategories),M&&i&&(e.legendCategoryAccessor=i,e.onCategoriesChange=P),e},[V,Z,s,_.onLegendHover,_.onLegendClick,_.highlightedCategory,_.isolatedCategories,M,i,P]),X=Array.isArray(o)?Yt(o):o,Q=$o(x,w,O,j),K=Q?null:No(X,w,O,k);return{data:S,colorScale:E,allCategories:B,legendState:_,effectiveSelectionHook:T,activeSelectionHook:R,customHoverBehavior:D,customClickBehavior:I,legend:V,margin:U,legendPosition:Z,earlyReturn:Q||K||null,legendBehaviorProps:Y,crosshairProps:$,resolvedSelection:F}}function Zo(e,n){const{variant:o,frameRef:i,overrides:r,deps:s}=n;t.useImperativeHandle(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.remove(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i;return null!==(i=null===(o=e.current)||void 0===o?void 0:o.update(t,n))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==n?n:null}}}if("network"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o,i,r,s;const l=Array.isArray(t)?t:[t],a=null!==(i=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==i?i:[],c=[];for(const t of l){const n=a.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(r=n.data)&&void 0!==r?r:{}),{id:t})),null===(s=e.current)||void 0===s||s.removeNode(t)}return c},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var o;const i=null===(o=e.current)||void 0===o?void 0:o.updateNode(t,n);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n,o,i;return null!==(i=null===(o=null===(n=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}}if("geo-points"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.removePoint(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i,r;const s=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of s)null===(r=e.current)||void 0===r||r.push(n(t));return s},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushLine(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushManyLines(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i,r;const s=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of s)null===(r=n.current)||void 0===r||r.pushLine(t(e));return s},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]}}}(o,i);return Object.assign(Object.assign({},e),r)},null!=s?s:[])}Vo.displayName="ChoroplethMap";const Yo=t.forwardRef(function(n,o){const i=t.useRef(null);Zo(o,{variant:"geo-points",frameRef:i});const r=Mo(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:s,xAccessor:l="lon",yAccessor:a="lat",sizeBy:c,sizeRange:u=[3,30],colorBy:d,colorScheme:h,projection:f="equalEarth",graticule:p,fitPadding:g,zoomable:m,zoomExtent:y,onZoom:b,dragRotate:x,tileURL:j,tileAttribution:k,tileCacheSize:w,areas:O,areaStyle:M={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:S,annotations:A,margin:C,className:P,selection:z,linkedHover:R,onObservation:L,onClick:D,chartId:I,loading:N,loadingContent:$,emptyContent:E,legendInteraction:W,legendPosition:B,frameProps:_={},stroke:T,strokeWidth:F,opacity:H}=n,q=null!=m?m:!!j,G=Go(O),V=Uo({data:null!=s?s:Zt,rawData:s,colorBy:d,colorScheme:h,legendInteraction:W,legendPosition:B,selection:z,linkedHover:R,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!1,onObservation:L,onClick:D,chartType:"ProportionalSymbolMap",chartId:I,showLegend:r.showLegend,userMargin:C,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:N,loadingContent:$,emptyContent:E,width:r.width,height:r.height}),U=V.data,Z=t.useMemo(()=>{if(!c)return;const e="function"==typeof c?c:e=>null==e?void 0:e[c],t=U.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?v(t):void 0},[U,c]),Y=t.useMemo(()=>{const e=Ao(e=>({fill:d?Xn(e,d,V.colorScale):yo,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:c?Kn(e,c,u,Z):6}),{stroke:T,strokeWidth:F,opacity:H});return V.effectiveSelectionHook?go(e,V.effectiveSelectionHook,V.resolvedSelection):e},[d,V.colorScale,V.effectiveSelectionHook,V.resolvedSelection,c,u,Z,T,F,H]),X=t.useMemo(()=>t=>{const n=(null==t?void 0:t.name)||(null==t?void 0:t.label)||(null==t?void 0:t.NAME)||(null==t?void 0:t.id),o="string"==typeof c?c:null,i=("function"==typeof c?c:e=>e[c])(t),r=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(null!=e?e:"")+"",s="string"==typeof d?d:null,l=s?null==t?void 0:t[s]:null;return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[n&&e.jsx("div",{style:{fontWeight:600,marginBottom:2},children:n}),o&&null!=i&&e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[o,": "]}),r(i)]}),s&&null!=l&&e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[s,": "]}),l+""]}),!n&&!o&&Object.entries(t).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([t,n])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,": "]}),r(n)]},t))]})},[c,d]);if(V.earlyReturn)return V.earlyReturn;Eo("ProportionalSymbolMap",U,"xAccessor",l),Eo("ProportionalSymbolMap",U,"yAccessor",a);const Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:f},null!=s&&{points:U}),{xAccessor:l,yAccessor:a,pointStyle:Y}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),G&&{areas:G,areaStyle:M}),null!=p&&{graticule:p}),null!=g&&{fitPadding:g}),q&&{zoomable:!0}),y&&{zoomExtent:y}),b&&{onZoom:b}),null!=x&&{dragRotate:x}),j&&{tileURL:j}),k&&{tileAttribution:k}),w&&{tileCacheSize:w}),{size:[r.width,r.height],margin:V.margin,enableHover:!0,tooltipContent:!1===S?()=>null:nn(S)||X}),V.legendBehaviorProps),(R||L||D)&&{customHoverBehavior:V.customHoverBehavior}),(L||D)&&{customClickBehavior:V.customClickBehavior}),A&&A.length>0&&{annotations:A}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),P&&{className:P}),null!=n.animate&&{animate:n.animate}),_);return e.jsx(Lo,{componentName:"ProportionalSymbolMap",width:r.width,height:r.height,children:e.jsx(An,Object.assign({ref:i},Q))})});Yo.displayName="ProportionalSymbolMap";const Xo="__semiotic_x",Qo="__semiotic_y",Ko=t.forwardRef(function(n,i){const r=Mo(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{flows:s,nodes:l,nodeIdAccessor:a="id",xAccessor:c="lon",yAccessor:u="lat",valueAccessor:d="value",projection:h="equalEarth",graticule:f,fitPadding:p,zoomable:g,zoomExtent:m,onZoom:y,dragRotate:b,tileURL:x,tileAttribution:j,tileCacheSize:k,lineType:w="geo",flowStyle:O="basic",areas:M,areaStyle:S={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:A,edgeOpacity:C=.6,edgeWidthRange:P=[1,8],edgeLinecap:z="round",colorScheme:R,showParticles:L,particleStyle:D,tooltip:I,annotations:N,margin:$,className:E,selection:W,linkedHover:B,onObservation:_,onClick:T,chartId:F,loading:H,loadingContent:q,emptyContent:G,frameProps:V={},legendInteraction:U,legendPosition:Z,stroke:Y,strokeWidth:X,opacity:Q,lineIdAccessor:K}=n,J=null!=g?g:!!x,ee=Go(M),te=t.useMemo(()=>Yt(l),[l]),ne=Uo({data:null!=s?s:Zt,rawData:s,colorBy:A,colorScheme:R,legendInteraction:U,legendPosition:Z,selection:W,linkedHover:B,fallbackFields:A?["string"==typeof A?A:""]:[],unwrapData:!1,onObservation:_,onClick:T,chartType:"FlowMap",chartId:F,showLegend:r.showLegend,userMargin:$,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:H,loadingContent:q,emptyContent:G,width:r.width,height:r.height}),oe=ne.data,ie=po(B),re=co({name:(null==ie?void 0:ie.name)||"hover",fields:(null==ie?void 0:ie.fields)||[]}),se=lo(e=>e.pushObservation),le=t.useMemo(()=>{const e=new Map;for(const t of te)e.set(t[a]+"",t);return e},[te,a]),ae=t.useRef(null),ce=t.useRef(le);ce.current=le;const ue=t.useRef(c);ue.current=c;const de=t.useRef(u);de.current=u;const he=t.useCallback(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=ce.current,n=t.get(e.source+""),o=t.get(e.target+"");if(!n||!o)return null;const i="function"==typeof ue.current?ue.current:e=>e[ue.current],r="function"==typeof de.current?de.current:e=>e[de.current];return Object.assign(Object.assign({},e),{coordinates:[{[Xo]:i(n),[Qo]:r(n)},{[Xo]:i(o),[Qo]:r(o)}]})},[]);Zo(i,{variant:"geo-lines",frameRef:ae,overrides:{push:e=>{var t;const n=he(e);n&&(null===(t=ae.current)||void 0===t||t.pushLine(n))},pushMany:e=>{var t;const n=[];for(const t of e){const e=he(t);e&&n.push(e)}n.length>0&&(null===(t=ae.current)||void 0===t||t.pushManyLines(n))}}});const fe=t.useMemo(()=>{const e=new Map;for(const t of oe)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},[oe]),pe=t.useCallback(e=>{var t,n;if(B)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=fe.get(t[a]+"");e&&re.onHover(e)}else re.onHover(t)}else re.onHover(null);if(_||se){const o={timestamp:Date.now(),chartType:"FlowMap",chartId:F};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});_&&_(r),se&&se(r)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});_&&_(e),se&&se(e)}}},[B,re,a,fe,_,F,se]),ge=ne.customClickBehavior,me=t.useMemo(()=>{const e="function"==typeof c?c:e=>e[c],t="function"==typeof u?u:e=>e[u];return oe.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const o=le.get(n.source+""),i=le.get(n.target+"");return o&&i?Object.assign(Object.assign({},n),{coordinates:[{[Xo]:e(o),[Qo]:t(o)},{[Xo]:e(i),[Qo]:t(i)}]}):null}).filter(Boolean)},[oe,le,c,u]),ye=t.useMemo(()=>{const e="function"==typeof c?c:e=>e[c];return t=>null!=t&&"object"==typeof t&&Xo in t?t[Xo]:e(t)},[c]),ve=t.useMemo(()=>{const e="function"==typeof u?u:e=>e[u];return t=>null!=t&&"object"==typeof t&&Qo in t?t[Qo]:e(t)},[u]),be=t.useMemo(()=>{const e=oe.filter(e=>e&&"object"==typeof e).map(e=>{var t;return null!==(t=e[d])&&void 0!==t?t:0}).filter(e=>isFinite(e));return 0===e.length?()=>P[0]:o.scaleLinear().domain(v(e)).range(P)},[oe,d,P]),xe=t.useMemo(()=>e=>{var t;return{stroke:A?Xn(e,A,ne.colorScale):yo,strokeWidth:be(null!==(t=e[d])&&void 0!==t?t:0),strokeLinecap:z,opacity:C}},[A,ne.colorScale,be,d,C,z]),je=t.useMemo(()=>{var e;const t=Ao(xe,{stroke:Y,strokeWidth:X,opacity:Q});if(!ne.effectiveSelectionHook)return t;const n=Object.assign(Object.assign({},(null===(e=ne.resolvedSelection)||void 0===e?void 0:e.unselectedStyle)||{}),{fillOpacity:0});return go(t,ne.effectiveSelectionHook,Object.assign(Object.assign({},ne.resolvedSelection||{}),{unselectedStyle:n}))},[xe,ne.effectiveSelectionHook,ne.resolvedSelection,Y,X,Q]),ke=t.useMemo(()=>Ao(()=>({fill:"#333",r:5,fillOpacity:.8}),{stroke:Y,strokeWidth:X,opacity:Q}),[Y,X,Q]),we=t.useMemo(()=>t=>{var n,o,i,r,s,l,c;if((null==t?void 0:t.geometry)||(null==t?void 0:t.properties)||(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.geometry)){const n=(null===(o=null==t?void 0:t.properties)||void 0===o?void 0:o.name)||(null===(i=null==t?void 0:t.properties)||void 0===i?void 0:i.NAME)||(null==t?void 0:t.name)||(null==t?void 0:t.NAME)||(null===(s=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.properties)||void 0===s?void 0:s.name)||(null===(c=null===(l=null==t?void 0:t.data)||void 0===l?void 0:l.properties)||void 0===c?void 0:c.NAME);if(n)return e.jsx("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e.jsx("div",{style:{fontWeight:600},children:n})})}if(null!=(null==t?void 0:t.source)&&null!=(null==t?void 0:t.target)){const n=t[d];return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e.jsxs("div",{style:{fontWeight:600},children:[t.source," → ",t.target]}),null!=n&&e.jsx("div",{style:{opacity:.7},children:"number"==typeof n?n.toLocaleString():n})]})}const u=(null==t?void 0:t.name)||(null==t?void 0:t.label)||(null==t?void 0:t[a]);return null!=u?e.jsx("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:e.jsx("div",{style:{fontWeight:600},children:u})}):null},[d,a]);if(ne.earlyReturn)return ne.earlyReturn;const Oe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:h},null!=s&&{lines:me}),{points:te,xAccessor:ye,yAccessor:ve,lineDataAccessor:"coordinates"}),null!=K&&{lineIdAccessor:K}),{lineType:w,flowStyle:O,lineStyle:je,pointStyle:ke}),ee&&{areas:ee,areaStyle:S}),null!=f&&{graticule:f}),null!=p&&{fitPadding:p}),J&&{zoomable:!0}),m&&{zoomExtent:m}),y&&{onZoom:y}),null!=b&&{dragRotate:b}),L&&{showParticles:L}),D&&{particleStyle:D}),x&&{tileURL:x}),j&&{tileAttribution:j}),k&&{tileCacheSize:k}),{size:[r.width,r.height],margin:ne.margin,enableHover:!0,tooltipContent:!1===I?()=>null:nn(I)||we}),ne.legendBehaviorProps),(B||_||T)&&{customHoverBehavior:pe}),(_||T)&&{customClickBehavior:ge}),N&&N.length>0&&{annotations:N}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),r.title&&{title:r.title}),r.description&&{description:r.description}),r.summary&&{summary:r.summary}),void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable}),E&&{className:E}),null!=n.animate&&{animate:n.animate}),V);return e.jsx(Lo,{componentName:"FlowMap",width:r.width,height:r.height,children:e.jsx(An,Object.assign({ref:ae},Oe))})});Ko.displayName="FlowMap";const Jo=t.forwardRef(function(n,o){const i=Mo(n.mode,{width:n.width,height:n.height,showLegend:n.showLegend,title:n.title,description:n.description,accessibleTable:n.accessibleTable,summary:n.summary}),{points:r,lines:s,xAccessor:l="lon",yAccessor:a="lat",nodeIdAccessor:c="id",center:u,costAccessor:d,strength:h=1,lineMode:f="straight",projection:p="mercator",graticule:g,fitPadding:m,zoomable:y,zoomExtent:v,onZoom:b,dragRotate:x,tileURL:j,tileAttribution:k,tileCacheSize:w,transition:O,colorBy:M,colorScheme:S,pointRadius:A=5,tooltip:C,showRings:P=!0,ringStyle:z,showNorth:R=!0,costLabel:L,annotations:D,margin:I,className:N,selection:$,linkedHover:E,onObservation:W,onClick:B,chartId:_,loading:T,loadingContent:F,emptyContent:H,legendPosition:q,frameProps:G={},stroke:V,strokeWidth:U,opacity:Z}=n,Y=null!=y?y:!!j,X=t.useMemo(()=>Yt(r),[r]),Q=Uo({data:X,rawData:r,colorBy:M,colorScheme:S,legendInteraction:void 0,legendPosition:q,selection:$,linkedHover:E,fallbackFields:M?["string"==typeof M?M:""]:[],unwrapData:!1,onObservation:W,onClick:B,chartType:"DistanceCartogram",chartId:_,showLegend:i.showLegend,userMargin:I,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:T,loadingContent:F,emptyContent:H,width:i.width,height:i.height}),K=t.useMemo(()=>{const e=Ao(e=>({fill:M?Xn(e,M,Q.colorScale):yo,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:A}),{stroke:V,strokeWidth:U,opacity:Z});return Q.effectiveSelectionHook?go(e,Q.effectiveSelectionHook,Q.resolvedSelection):e},[M,Q.colorScale,Q.effectiveSelectionHook,Q.resolvedSelection,A,V,U,Z]),J=t.useMemo(()=>({center:u,centerAccessor:c,costAccessor:d,strength:h,lineMode:f}),[u,c,d,h,f]),ee=t.useMemo(()=>{if(!s)return;const e="function"==typeof l?l:e=>e[l],t="function"==typeof a?a:e=>e[a],n=new Map;for(const e of X)n.set(e[c]+"",e);return s.map(o=>{if(o.coordinates)return o;const i=n.get(o.source+""),r=n.get(o.target+"");return i&&r?Object.assign(Object.assign({},o),{coordinates:[{[l]:e(i),[a]:t(i)},{[l]:e(r),[a]:t(r)}]}):null}).filter(Boolean)},[s,X,l,a,c]),te=t.useMemo(()=>t=>{const n=("function"==typeof d?d:e=>e[d])(t);return e.jsxs("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[e.jsx("div",{style:{fontWeight:600},children:t[c]||t.name||t.id||"Point"}),null!=n&&e.jsxs("div",{style:{opacity:.7},children:["Cost: ","number"==typeof n?n.toFixed(1):n]})]})},[d,c]),ne=t.useRef(null);Zo(o,{variant:"geo-points",frameRef:ne});const[oe,ie]=t.useState(null),re=t.useCallback(()=>{var e,t;const n=null===(t=null===(e=ne.current)||void 0===e?void 0:e.getCartogramLayout)||void 0===t?void 0:t.call(e);n&&ie(e=>e&&e.cx===n.cx&&e.cy===n.cy&&e.maxCost===n.maxCost&&e.availableRadius===n.availableRadius?e:n)},[]);t.useEffect(()=>{const e=requestAnimationFrame(re);return()=>cancelAnimationFrame(e)},[re,h,u,i.width,i.height,X]);const se=t.useMemo(()=>{if(!P||!oe)return[];const{maxCost:e}=oe;if(0>=e)return[];if(Array.isArray(P))return P.filter(t=>t>0&&e>=t);const t="number"==typeof P?P:Math.min(5,Math.max(2,Math.ceil(e/5))),n=e/t,o=[];for(let e=1;t>=e;e++)o.push(Math.round(n*e*10)/10);return o},[P,oe]),le=t.useMemo(()=>{var t,n;if(!oe)return G.foregroundGraphics||null;const{cx:o,cy:i,maxCost:r,availableRadius:s}=oe,l=Object.assign({stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10},z),a=null!==(t=Q.margin.left)&&void 0!==t?t:10,c=null!==(n=Q.margin.top)&&void 0!==n?n:10;return e.jsxs("g",{children:[se.map(t=>{const n=t/r*s;return e.jsxs("g",{children:[e.jsx("circle",{cx:o+a,cy:i+c,r:n,fill:"none",stroke:l.stroke,strokeWidth:l.strokeWidth,strokeDasharray:l.strokeDasharray,opacity:.5}),e.jsxs("text",{x:o+a+n+3,y:i+c-2,fontSize:l.labelSize,fill:l.labelColor,fontFamily:"system-ui, sans-serif",children:[t,L?" "+L:""]})]},t)}),R&&e.jsxs("g",{transform:`translate(${a+24}, ${c+24})`,children:[e.jsx("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),e.jsx("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),e.jsx("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),e.jsx("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),e.jsx("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),e.jsx("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]}),G.foregroundGraphics]})},[oe,se,R,L,z,Q.margin,G.foregroundGraphics]);if(Q.earlyReturn)return Q.earlyReturn;Eo("DistanceCartogram",X,"xAccessor",l),Eo("DistanceCartogram",X,"yAccessor",a);const ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({projection:p},null!=r&&{points:X}),ee&&{lines:ee,lineDataAccessor:"coordinates"}),{xAccessor:l,yAccessor:a,pointIdAccessor:c,pointStyle:K,projectionTransform:J}),O&&{transition:{duration:O}}),null!=g&&{graticule:g}),null!=m&&{fitPadding:m}),Y&&{zoomable:!0}),v&&{zoomExtent:v}),b&&{onZoom:b}),null!=x&&{dragRotate:x}),j&&{tileURL:j}),k&&{tileAttribution:k}),w&&{tileCacheSize:w}),{size:[i.width,i.height],margin:Q.margin,enableHover:!0,tooltipContent:!1===C?()=>null:nn(C)||te}),Q.legendBehaviorProps),(E||W||B)&&{customHoverBehavior:Q.customHoverBehavior}),(W||B)&&{customClickBehavior:Q.customClickBehavior}),D&&D.length>0&&{annotations:D}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),i.title&&{title:i.title}),i.description&&{description:i.description}),i.summary&&{summary:i.summary}),void 0!==i.accessibleTable&&{accessibleTable:i.accessibleTable}),N&&{className:N}),null!=n.animate&&{animate:n.animate}),G),le&&{foregroundGraphics:le});return e.jsx(Lo,{componentName:"DistanceCartogram",width:i.width,height:i.height,children:e.jsx(An,Object.assign({ref:ne},ae))})});Jo.displayName="DistanceCartogram",exports.ChoroplethMap=Vo,exports.DistanceCartogram=Jo,exports.FlowMap=Ko,exports.ProportionalSymbolMap=Yo,exports.StreamGeoFrame=An,exports.mergeData=function(e,t,n){const{featureKey:o,dataKey:i}=n,r=new Map;for(const e of t)r.set(e[i]+"",e);return e.map(e=>{const t=(e=>{const t=o.split(".");let n=e;for(const e of t)n=null==n?void 0:n[e];return(null!=n?n:"")+""})(e),n=r.get(t);return n?Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),n)}):e})},exports.resolveReferenceGeography=qo;
2
+ "use strict";var e,t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,a=(e,t,i,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of o(t))s.call(e,l)||l===i||n(e,l,{get:()=>t[l],enumerable:!(a=r(t,l))||a.enumerable});return e},l=(e,r,o)=>(o=null!=e?t(i(e)):{},a(!r&&e&&e.__esModule?o:n(o,"default",{value:e,enumerable:!0}),e)),c={};((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})(c,{ChoroplethMap:()=>Is,DEFAULT_HIT_RADIUS:()=>Js,DistanceCartogram:()=>Us,FlowMap:()=>qs,GeoCustomChart:()=>Qs,ProportionalSymbolMap:()=>Bs,StreamGeoFrame:()=>ii,composeStyleRules:()=>os,geoAreaHitTarget:()=>na,geoHitTarget:()=>ta,glyphExtent:()=>_e,glyphPlacement:()=>Be,hatchFillId:()=>mn,hatchPatternDef:()=>gn,hitTargetPoint:()=>ea,isHatchFill:()=>fn,makeNodeRuleContext:()=>Ji,makeRuleValueResolver:()=>Ki,matchesThreshold:()=>ts,mergeData:()=>ra,resolveReferenceGeography:()=>Cs,resolveResponsiveRules:()=>Ni,resolveStyleRules:()=>rs,resolveSvgFill:()=>bn,responsiveRuleMatches:()=>Oi,ruleMatches:()=>ns}),module.exports=(e=c,a(n({},"__esModule",{value:!0}),e));var u=require("react"),d=require("d3-geo"),h=require("d3-quadtree"),f=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray();let n=0,r=[];t.length>e&&(n=t.length-e,r=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 r}update(e,t){const n=[],r=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++){const i=(r+o)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:{...s},n.push(e),this.buffer[i]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(r=>{e(r)?n.push(r):t.push(r)}),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(e,t,n){if(1>=n)return 1;const r=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 r=e.halfLife??e.extent/2;return t+Math.pow(.5,n/(r>0?r:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}({age:r-t,extent:r,type:e.type,halfLife:e.halfLife??n/2,threshold:e.stepThreshold??.5*n,minOpacity:e.minOpacity??.1})}function y(e,t,n){const r=e.duration??500,o=n-t;return r>o?1-o/r:0}function g(e,t,n,r){let o=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,o=!0),e._pulseColor!==n&&(e._pulseColor=n,o=!0),e._pulseGlowRadius!==r&&(e._pulseGlowRadius=r,o=!0),o):(0!==e._pulseIntensity&&(e._pulseIntensity=0,o=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,o=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,o=!0),o)}var b=require("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 r=e=>e.toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function w(e){const t=e.map(v),n=t.length-1;return e=>{if(0>=e){const[e,n,r]=t[0];return x(e,n,r)}if(e>=1){const[e,r,o]=t[n];return x(e,r,o)}const r=e*n,o=Math.floor(r),i=r-o,[s,a,l]=t[o],[c,u,d]=t[o+1];return x(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(d-l)*i))}}var k=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],j=w(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),S=w(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),M=w(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),C=w(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),A=w(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),R=w(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),L=w(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),P=w(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),I=w(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),D=w(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),T=w(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),z=w(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),O={blues:j,reds:S,greens:M,viridis:L,oranges:C,purples:A,greys:R,plasma:P,inferno:I,magma:D,cividis:T,turbo:z};function N(e){return e&&O[e]||j}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 E={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"],...O},B=k,_=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],W=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 H(e,t,n){if("function"==typeof t){const r=t(e);return n&&r&&"string"==typeof r&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||W.has(t)}(r)?n(r):r}const r=e?.[t]+"";return n?n(r):B[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)}(r))%B.length]}function F(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 $(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>F(e,t)??"#999"}const r=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),o=r.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return(0,b.scaleOrdinal)().domain(r).range(n).unknown("#999");const i=E[n]||E.category10;if(o&&"function"==typeof i){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:B;return(0,b.scaleOrdinal)().domain(r).range(e).unknown("#999")}}function q(e,t,n=[3,20],r){let o;if(o="function"==typeof t?t(e):e?.[t],!r)return o;const[i,s]=r,[a,l]=n;if(s===i)return(a+l)/2;let c=(o-i)/(s-i);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function G(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>n&&F(n,e)||"#4e79a7":t=>{if(n){const e=F(n,t);if(e)return e}let r=0;for(let e=0;t.length>e;e++)r=31*r+t.charCodeAt(e)|0;return e[Math.abs(r)%e.length]??"#4e79a7"}}function V(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(V))}function U(e,t,n){e.has(t)||(e.add(t),console.warn(n))}var Z=require("d3-geo"),Y={mercator:Z.geoMercator,equalEarth:Z.geoEqualEarth,albersUsa:Z.geoAlbersUsa,orthographic:Z.geoOrthographic,naturalEarth:Z.geoNaturalEarth1,equirectangular:Z.geoEquirectangular};function X(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function Q(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function K(e,t,n){return e?"function"==typeof e?{...n,...e(t)}:{...n,...e}:{...n}}function J(e,t){if(2>e.length)return[e];const n=.4*t,r=[];let o=[e[0]];for(let t=1;e.length>t;t++){const i=e[t];Math.abs(i[0]-e[t-1][0])>n?(2>o.length||r.push(o),o=[i]):o.push(i)}return 2>o.length||r.push(o),r}function ee(e,t,n=24){const r=t[0]-e[0],o=t[1]-e[1],i=Math.sqrt(r*r+o*o);if(0===i)return[e,t];const s=-o/i,a=r/i,l=Math.min(.3*i,80),c=(e[0]+t[0])/2+s*l,u=(e[1]+t[1])/2+a*l,d=[];for(let r=0;n>=r;r++){const o=r/n,i=1-o;d.push([i*i*e[0]+2*i*o*c+o*o*t[0],i*i*e[1]+2*i*o*u+o*o*t[1]])}return d}function te(e,t){if(2>e.length)return e;const n=t/2+1,r=[];for(let t=0;e.length>t;t++){const o=e[t];let i,s;0===t?(i=e[1][0]-o[0],s=e[1][1]-o[1]):t===e.length-1?(i=o[0]-e[t-1][0],s=o[1]-e[t-1][1]):(i=e[t+1][0]-e[t-1][0],s=e[t+1][1]-e[t-1][1]);const a=Math.sqrt(i*i+s*s)||1;r.push([o[0]+s/a*n,o[1]+-i/a*n])}return r}function ne(e,t,n,r,o){const i=t[0]-e[0],s=t[1]-e[1],a=Math.sqrt(i*i+s*s);if(0===a)return[e,t];const l=s/a,c=-i/a,u=o/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}var re=require("d3-scale");function oe(e){let t=1/0,n=-1/0;for(const r of e)t>r&&(t=r),r>n&&(n=r);return[t,n]}function ie(e,t,n,r){const o=e.push(t);return n&&n.push(r),o}var se={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"};function ae(e,t){const n={...e};for(const e of t)n[se[e]]++;return n}function le(e,t,n){const r=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:r,revisions:ae(n,r)}}var ce=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=le({kind:"initialize"},[],this.revisions),this.listeners=new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){const n=le(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}},ue=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],de=["scene-style","data-paint","accessibility","evidence"],he=(e,t)=>({retainedData:e,invalidations:t}),fe=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],pe=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],me=["scene-geometry","data-paint","accessibility","evidence"],ye=["scene-style","data-paint","accessibility","evidence"],ge=["overlay","accessibility","evidence"],be=[],ve={xAccessor:he("rebuild",fe),yAccessor:he("rebuild",fe),lineDataAccessor:he("rebuild",fe),pointIdAccessor:he("rebuild",me),lineIdAccessor:he("rebuild",me),windowSize:he("rebuild",fe),projection:he("preserve",pe),projectionExtent:he("preserve",pe),fitPadding:he("preserve",pe),lineType:he("preserve",pe),flowStyle:he("preserve",pe),graticule:he("preserve",pe),projectionTransform:he("preserve",pe),customLayout:he("preserve",pe),layoutConfig:he("preserve",pe),layoutMargin:he("preserve",pe),areaStyle:he("preserve",ye),pointStyle:he("preserve",["scene-geometry","scene-style","data-paint","accessibility","evidence"]),lineStyle:he("preserve",ye),colorScheme:he("preserve",ye),themeCategorical:he("preserve",ye),themeDiverging:he("preserve",ye),themeSemantic:he("preserve",ye),themeSequential:he("preserve",ye),decay:he("preserve",ye),pulse:he("preserve",ye),layoutSelection:he("preserve",ye),annotations:he("preserve",ge),autoPlaceAnnotations:he("preserve",ge),clock:he("preserve",be),transition:he("preserve",be),introAnimation:he("preserve",be),onLayoutError:he("preserve",be)},xe=he("preserve",pe),we=class{constructor(){this.tracker=new ce}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},ue)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},de):this.recordNoop("restyle")}recordConfig(e,t={}){const n=function(e){let t="preserve";const n=new Set;for(const r of e){const e=ve[r]??xe;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)n.add(t)}return{retainedData:t,invalidations:n}}(e),r=new Set(n.invalidations);return t.retainedDataChanged&&r.add("data"),this.tracker.record({kind:"config",keys:e},r)}},ke=new WeakMap;var je=require("d3-geo");function Se(e){if(null==e)return 0;if("number"==typeof e&&Number.isFinite(e)&&e>=0&&.5>e)return e;throw new RangeError(`[semiotic] fitPadding must be a finite fraction in [0, 0.5); received ${e+""}.`)}var Me=class e{constructor(e){this.updateResults=new we,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.config=function(e){return{...e,fitPadding:Se(e.fitPadding)}}(e)}currentTime(){return this.config.clock?.()??("undefined"!=typeof performance?performance.now():Date.now())}getConfiguredWindowSize(){const e=this.config.windowSize??500;if(!Number.isInteger(e)||1>e)throw Error("GeoPipelineStore windowSize must be a positive integer");return e}retainNewestLines(e=this.getConfiguredWindowSize()){this.lineData.length>e&&(this.lineData=this.lineData.slice(-e))}resizeStreamingWindow(e){if(this.pointBuffer){const t=this.pointBuffer.toArray(),n=this.timestampBuffer?.toArray()??[],r=t.slice(-e),o=n.slice(-r.length),i=this.currentTime();this.pointBuffer=new f(e),this.timestampBuffer=new f(e),r.forEach((e,t)=>{this.pointBuffer.push(e),this.timestampBuffer.push(o[t]??i)})}this.retainNewestLines(e)}updateConfig(e){const t=function(e){return"fitPadding"in e?{...e,fitPadding:Se(e.fitPadding)}:e}(e),n=this.config,r=this.getConfiguredWindowSize(),o=Object.keys(t).filter(e=>t[e]!==n[e]);this.config={...this.config,...t};const i=this.getConfiguredWindowSize(),s=this.streaming&&i!==r;s&&(this.resizeStreamingWindow(i),this.version++),"customLayout"in t&&!t.customLayout&&(this.lastCustomLayoutFailure=null),this.updateResults.recordConfig(o,{retainedDataChanged:s})}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}setAreas(e){this.areas=e,this.updateResults.recordData("replace",e.length)}setAreasWithResult(e){return this.setAreas(e),this.updateResults.last}setPoints(e){this.pointData=e.slice(),this.pointBuffer=null,this.timestampBuffer=null,this.streaming=!1,this.updateResults.recordData("replace",e.length)}setPointsWithResult(e){return this.setPoints(e),this.updateResults.last}setLines(e){this.lineData=e.slice(),this.streaming&&this.retainNewestLines(),this.updateResults.recordData("replace",e.length)}setLinesWithResult(e){return this.setLines(e),this.updateResults.last}initStreaming(e){void 0!==e&&e!==this.config.windowSize&&(this.config={...this.config,windowSize:e});const t=this.getConfiguredWindowSize(),n=this.pointBuffer?this.pointBuffer.toArray():this.pointData,r=this.timestampBuffer?.toArray()??[],o=n.slice(-t),i=r.slice(-o.length),s=this.currentTime();this.pointBuffer=new f(t),this.timestampBuffer=new f(t),o.forEach((e,t)=>{this.pointBuffer.push(e),this.timestampBuffer.push(i[t]??s)}),this.pointData=[],this.retainNewestLines(t),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming();const t=this.currentTime();ie(this.pointBuffer,e,this.timestampBuffer,t),this.lastIngestTime=t,this.updateResults.recordData("ingest",1)}pushPointWithResult(e){return this.pushPoint(e),this.updateResults.last}pushMany(e){this.pointBuffer||this.initStreaming();const t=this.currentTime();for(const n of e)ie(this.pointBuffer,n,this.timestampBuffer,t);this.lastIngestTime=t,this.updateResults.recordData("ingest",e.length)}pushManyWithResult(e){return this.pushMany(e),this.updateResults.last}pushLine(e){null!=e&&"object"==typeof e?(this.streaming||this.initStreaming(),this.lineData.push(e),this.retainNewestLines(),this.version++,this.updateResults.recordData("ingest",1)):this.updateResults.recordNoop("ingest")}pushManyLines(e){if(!Array.isArray(e)||0===e.length)return void this.updateResults.recordNoop("ingest");const t=e.filter(e=>null!=e&&"object"==typeof e);if(0!==t.length){this.streaming||this.initStreaming();for(const e of t)this.lineData.push(e);this.retainNewestLines(),this.version++,this.updateResults.recordData("ingest",t.length)}else this.updateResults.recordNoop("ingest")}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],r=new Set(Array.isArray(e)?e:[e]),o=[];return this.lineData=this.lineData.filter(e=>!r.has(n(e)+"")||(o.push(e),!1)),o.length>0?(this.version++,this.updateResults.recordData("remove",o.length)):this.updateResults.recordNoop("remove"),o}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],r=new Set(Array.isArray(e)?e:[e]);if(this.streaming&&this.pointBuffer){const e=e=>r.has(n(e)+"");!function(e,t,n){if(!t||0===t.size)return;const r=new Set;if(e.forEach((e,t)=>{n(e)&&r.add(t)}),0===r.size)return;const o=t.toArray();t.clear();for(let e=0;o.length>e;e++)r.has(e)||t.push(o[e])}(this.pointBuffer,this.timestampBuffer,e);const t=this.pointBuffer.remove(e);return t.length>0?(this.version++,this.updateResults.recordData("remove",t.length)):this.updateResults.recordNoop("remove"),t}{const e=[];return this.pointData=this.pointData.filter(t=>!r.has(n(t)+"")||(e.push(t),!1)),e.length>0?(this.version++,this.updateResults.recordData("remove",e.length)):this.updateResults.recordNoop("remove"),e}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.streaming=!1,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++,this.updateResults.recordData("clear")}restyleScene(e){const t=this._customRestyle;if(t){for(const n of this.scene){const r=this._baseStyles.get(n)??n.style,o=t(n,e);n.style=o?{...r,...o}:r}this.markStylePaintPending(),this.updateResults.recordRestyle(!0)}else this.updateResults.recordRestyle(!1)}computeScene(e){const{config:t}=this,n=this.projection,r=this.geoPath,o=this.scales,i=this.baseScale,s=[...this.baseTranslate],a=[...this.baseRotation],l=this.scene;this.projection=function(e){if(!e)return(0,Z.geoEqualEarth)();if("string"==typeof e){const t=Y[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),(0,Z.geoEqualEarth)())}if("object"==typeof e&&"type"in e){const t=Y[e.type],n=t?t():(0,Z.geoEqualEarth)();return e.rotate&&"rotate"in n&&n.rotate(e.rotate),e.center&&"center"in n&&n.center(e.center),n}return e}(t.projection),this.geoPath=(0,d.geoPath)(this.projection),this.fitProjection(e),this.geoPath=(0,d.geoPath)(this.projection);const c=this.projection;this.scales={projection:c,geoPath:this.geoPath,projectedPoint:(e,t)=>c([e,t]),invertedPoint:(e,t)=>c.invert?c.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const u=this.buildSceneNodes(e);if(this._customLayoutFailedThisBuild)!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.projection=n,this.geoPath=r,this.scales=o,this.baseScale=i,this.baseTranslate=s,this.baseRotation=a):(this.scene=[],this.rebuildQuadtree());else{if(this.scene=u,this.rebuildQuadtree(),t.projectionTransform&&this.applyCartogramTransform(t.projectionTransform,e),t.decay&&this.streaming&&this.applyDecay(),t.pulse&&this.streaming&&this.applyPulse(),t.transition&&!this._hasRenderedOnce&&this.scene.length>0&&t.introAnimation){const t=e.width/2,n=e.height/2,r=this.scene.filter(e=>"point"===e.type).map(e=>({...e,x:t,y:n}));r.length>0&&this.startTransition(r)}this._hasRenderedOnce=!0,t.transition&&l.length>0&&this.startTransition(l),this.version++}}fitProjection(e){const t=this.projection,n=this.config,r=[...this.areas],o=X(n.xAccessor,"lon"),i=X(n.yAccessor,"lat"),s=this.getPoints();if(s.length>0){const e=s.map(e=>[o(e),i(e)]);r.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const a=Q(n.lineDataAccessor);for(const e of this.lineData){const t=a(e);if(t&&t.length>0){const e=t.map(e=>[o(e),i(e)]);r.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==r.length){if(n.projectionExtent){const[[r,o],[i,s]]=n.projectionExtent;t.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[r,o],[i,o],[i,s],[r,s],[r,o]]]}})}else if(t.clipAngle&&(t.clipAngle()??0)>0){const r=n.fitPadding??0,o=Math.min(e.width,e.height);t.scale(o/2-o*r),t.translate([e.width/2,e.height/2])}else{const o=n.fitPadding??0,i=e.width*o,s=e.height*o;t.fitExtent([[i,s],[e.width-i,e.height-s]],{type:"FeatureCollection",features: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 r=this.geoPath,o=this.scales,i=n.scale(),s=[...n.translate()],a=this.currentZoom;n.scale(this.baseScale*e.k),n.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=(0,d.geoPath)(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const l=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(i),n.translate(s),this.currentZoom=a,this.geoPath=r,this.scales=o):(this.scene=[],this.rebuildQuadtree()):(this.scene=l,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const n=this.projection;if(!n)return;const r=this.geoPath,o=this.scales,i=n.scale(),s=[...n.translate()],a=this.currentZoom;n.scale(this.baseScale*e),n.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=(0,d.geoPath)(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const l=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(i),n.translate(s),this.currentZoom=a,this.geoPath=r,this.scales=o):(this.scene=[],this.rebuildQuadtree()):(this.scene=l,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const n=this.projection;if(!n||!n.rotate)return;const r=this.geoPath,o=this.scales,i=[...n.rotate()];n.rotate(e),this.geoPath=(0,d.geoPath)(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const s=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.rotate(i),this.geoPath=r,this.scales=o):(this.scene=[],this.rebuildQuadtree()):(this.scene=s,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}setRotation(e){const t=this.projection;t&&t.rotate&&t.rotate(e)}getRotation(){return this.projection?.rotate?.()??this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}rebuildQuadtree(){let t=0,n=0;for(const e of this.scene)"point"===e.type&&(n++,e.r>t&&(t=e.r));if(this._maxPointRadius=t,e.QUADTREE_THRESHOLD>=n)return void(this._quadtree=null);const r=Array(n);let o=0;for(const e of this.scene)"point"===e.type&&(r[o++]=e);this._quadtree=(0,h.quadtree)().x(e=>e.x).y(e=>e.y).addAll(r)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){this._customLayoutFailedThisBuild=!1;const{config:t}=this,n=this.projection,r=this.geoPath;if(t.customLayout&&this.scales){const n=t.layoutMargin??{top:0,right:0,bottom:0,left:0},r=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[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(t.colorScheme,t.themeCategorical,_),o={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:[...r]},resolveColor:G(r,t.colorScheme),config:t.layoutConfig??{},selection:t.layoutSelection??null};let i;try{i=t.customLayout(o)}catch(e){const n=null!==this.lastCustomLayoutResult,r=function(e,t,n,r){const o=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: ${o.message}`,error:o,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:r}}("geo",e,n,this.version);this.lastCustomLayoutFailure=r,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] geo customLayout threw:",e);try{t.onLayoutError?.(r)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return n?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}const s=i.nodes??[];if(this.customLayoutOverlays=i.overlays??null,this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null,this._customRestyle=i.restyle,this.hasCustomRestyle=!!i.restyle,this._baseStyles=new WeakMap,this.hasCustomRestyle){for(const e of s)this._baseStyles.set(e,e.style);this.restyleScene(t.layoutSelection??null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:r,warned:o}=e;V(r)&&0===n.length&&U(o,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(e=>null==e.datum)&&U(o,"null-datums",`[semiotic] ${t} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}({label:"geo customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}return this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,function({config:e,projection:t,path:n,areas:r,points:o,lines:i,layout:s}){const a=X(e.xAccessor,"lon"),l=X(e.yAccessor,"lat"),c=[],u=function(e){return{fill:e.themeSemantic?.surface||"#e0e0e0",stroke:e.themeSemantic?.border||"#999",strokeWidth:.5,fillOpacity:1}}(e),d=function(e){return{stroke:e.themeSemantic?.primary||"#4e79a7",strokeWidth:1.5,fill:"none"}}(e),h=function(e){return{fill:e.themeSemantic?.primary||"#4e79a7",r:4,fillOpacity:.8}}(e);if(e.graticule){const t=!0===e.graticule?{}:e.graticule,r=(0,je.geoGraticule)();t.step&&r.step(t.step);const o=n(r())||"";o&&c.push({type:"geoarea",pathData:o,centroid:[s.width/2,s.height/2],bounds:[[0,0],[s.width,s.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 t of r){const r=n(t);if(!r)continue;const o=n.centroid(t),i=n.bounds(t),s=n.area(t);c.push({type:"geoarea",pathData:r,centroid:o,bounds:i,screenArea:s,style:K(e.areaStyle,t,u),datum:t,interactive:!0})}const f=Q(e.lineDataAccessor);for(const n of i){const r=f(n);if(!r||2>r.length)continue;let o=[];if("geo"===e.lineType){const e=Array(r.length);for(let t=0;r.length>t;t++)e[t]=[a(r[t]),l(r[t])];for(let n=0;e.length-1>n;n++){const r=e[n],i=e[n+1],s=(0,je.geoDistance)(r,i)||0,a=Math.max(2,Math.ceil(s/(Math.PI/180))),l=(0,je.geoInterpolate)(r,i);for(let e=0;a>=e;e++){if(n>0&&0===e)continue;const r=t(l(e/a));null!=r&&o.push(r)}}}else for(let e=0;r.length>e;e++){const n=r[e],i=t([a(n),l(n)]);null!=i&&o.push(i)}if(2>o.length)continue;const i=K(e.lineStyle,n,d),u="number"==typeof i.strokeWidth?i.strokeWidth:1;2!==r.length||2>o.length||"arc"!==e.flowStyle?2!==r.length||2>o.length||"offset"!==e.flowStyle||(o="geo"===e.lineType?te(o,u):ne(o[0],o[o.length-1],0,0,u)):o=ee(o[0],o[o.length-1]);const h=J(o,s.width);if(h.length>1)for(const e of h)2>e.length||c.push({type:"line",path:e,style:{...i,_edgeFade:!0},datum:n});else c.push({type:"line",path:2>o.length&&h[0]||o,style:i,datum:n})}const p=e.pointIdAccessor?"function"==typeof e.pointIdAccessor?e.pointIdAccessor:t=>t[e.pointIdAccessor]:null,m=t.clipAngle?t.clipAngle()??0:0,y=m>0?m*Math.PI/180:null,g=t.rotate?t.rotate():[0,0,0],b="function"==typeof t.center?t.center():[0,0],v=[(b[0]??0)-g[0],(b[1]??0)-g[1]];for(const n of o){const r=a(n),o=l(n);if(null!=y&&(0,je.geoDistance)([r,o],v)>y)continue;const i=t([r,o]);if(!i)continue;const s=e.pointStyle?e.pointStyle(n):{...h},u={type:"point",x:i[0],y:i[1],r:s.r||4,style:s,datum:n,pointId:p?p(n)+"":void 0};c.push(u)}return c}({config:t,projection:n,path:r,areas:this.areas,points:this.getPoints(),lines:this.lineData,layout:e})}applyCartogramTransform(e,t){const n=function(e,t,n,r){const o=e.filter(e=>"point"===e.type);if(2>o.length)return null;const i=t.strength??1;if(0===i)return null;const s=t.centerAccessor?"function"==typeof t.centerAccessor?t.centerAccessor:e=>e[t.centerAccessor]:e=>e.id,a="function"==typeof t.costAccessor?t.costAccessor:e=>e[t.costAccessor],l=o.find(e=>e.datum&&s(e.datum)+""==t.center+"");if(!l)return"production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${t.center}" not found in point data`),null;const c=l.x,u=l.y,d=function(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}(o.map(e=>e.datum?a(e.datum):NaN).filter(e=>isFinite(e)&&e>=0),1),h=Math.min(n.width,n.height)/2,f=(0,re.scaleLinear)().domain([0,d]).range([0,h]);r>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 o){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),r=a(e.datum),o=n+((isFinite(r)?f(r):n)-n)*i;e.x=c+Math.cos(t)*o,e.y=u+Math.sin(t)*o}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 o)e.x+=y,e.y+=g;const b={cx:p,cy:m,maxCost:d,availableRadius:h},v=e.filter(e=>"line"===e.type);if(v.length>0&&"fractional"!==t.lineMode){const e=new Map;for(const t of o)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of v){const n=t.datum?.source,r=t.datum?.target;if(n&&r){const o=e.get(n+""),i=e.get(r+"");o&&i&&(t.path=[o,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 r=0;n.length>r;r++){const o=m(e,r,t);n[r]._decayOpacity=o,n[r].style={...n[r].style,opacity:o}}}applyPulse(e=this.currentTime()){const t=this.config.pulse;if(!t||!this.timestampBuffer)return!1;const n=this.scene.filter(e=>"point"===e.type),r=this.timestampBuffer.toArray(),o=t.color||"rgba(255,255,255,0.6)",i=t.glowRadius??4;let s=!1;for(let a=0;n.length>a&&r.length>a;a++){const l=y(t,r[a],e);s=g(n[a],l,o,i)||s}return s}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(e)}hasActivePulsesAt(e){return!!this.config.pulse&&function(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const r=e.duration??500,o=t.peek();return null!=o&&r>n-o}(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}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 r=this.scene.filter(e=>"point"===e.type);let o=!1;for(const e of r)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)&&(o=!0))}for(const e of r)e.pointId&&!n.has(e.pointId)&&(e._targetOpacity=e.style?.opacity??1,e.style={...e.style,opacity:0},o=!0);o&&(this.activeTransition={startTime:this.currentTime(),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),r=this.scene.filter(e=>"point"===e.type);for(const e of r){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 r)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}};Me.QUADTREE_THRESHOLD=500;var Ce=Me;Object.assign(Ce.prototype,{getLastUpdateResult:function(){return this.updateResults.last},getUpdateSnapshot:function(){return this.updateResults.last},subscribeUpdateResult:function(e){return this.updateResults.subscribe(e)},setLayoutSelection:function(e){this.config.layoutSelection=e},markStylePaintPending:function(){ke.set(this,!0)},consumeStylePaintPending:function(){const e=!0===ke.get(this);return ke.delete(this),e}});var Ae=require("react"),Re={sceneGeometry:0,layout:0,domain:0};function Le(e){const{domain:t,layout:n,sceneGeometry:r}=e.revisions;return{domain:t,layout:n,sceneGeometry:r}}function Pe(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}var Ie="production"!==process.env.NODE_ENV,De={revisions:Re,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},Te=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=Re,this.lastObserved=Re,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){Ie&&(this.lastObserved=Pe(this.lastObserved,Le(e)))}beforeCompute(e,t){if(!Ie)return De;const n=Pe(Le(e),this.lastObserved),r=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),o=!((i=n).sceneGeometry===(s=this.lastConsumed).sceneGeometry&&i.layout===s.layout&&i.domain===s.domain);var i,s;return{revisions:n,signature:r,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:o,warnUnconsumed:!t&&o&&this.lastUnconsumedWarning!==r}}afterCompute(e,t,n){if(Ie){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}},ze=(0,Ae.memo)(function({store:e,diagnostics:t}){return(0,Ae.useEffect)(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null});function Oe(e,t=30){return Math.max((e??4)+5,12,t)}var Ne=[40,40],Ee=[.5,.5];function Be(e,t){const[n,r]=e.viewBox??Ne,[o,i]=e.anchor??Ee,s=r>0?r:1,a=Math.max(0,t)/s,l=(n>0?n:s)*a,c=s*a;return{width:l,height:c,scale:a,offsetX:-o*l,offsetY:-i*c}}function _e(e,t){const n=Be(e,t),r=[[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 o=0;for(const[e,t]of r){const n=Math.sqrt(e*e+t*t);n>o&&(o=n)}return o}function We(e,t,n,r){if("none"!==e)return"color"===e||null==e?t??r:"accent"===e?n:e}var He=null;function Fe(e){if("undefined"==typeof Path2D)return null;He||(He=new Map);const t=He.get(e);if(t)return t;const n=new Path2D(e);return He.size>1024&&He.clear(),He.set(e,n),n}function $e(e,t,n=0,r="horizontal"){const[o,i]=e.viewBox??Ne,s=Math.min(1,Math.max(0,n)),a=Math.min(1,Math.max(0,t));return a>s?s>0||1>a?"vertical"===r?{x:0,y:i*(1-a),width:o,height:i*(a-s)}:{x:o*s,y:0,width:o*(a-s),height:i}:null:{x:0,y:0,width:0,height:0}}function qe(e,t){const n=Be(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 Ge(e,t,n,r,o,i=e=>e){for(const s of t.parts){const t=Fe(s.d);if(!t)continue;const a=s.opacity??1,l=e.globalAlpha;1!==a&&(e.globalAlpha=l*a);const c=o?"none"===s.fill?void 0:o:We(s.fill,n,r);c&&(e.fillStyle=i(c),e.fill(t));const u=o?s.stroke&&"none"!==s.stroke?o:void 0:We(s.stroke??"none",n,r);u&&(e.strokeStyle=i(u),e.lineWidth=s.strokeWidth??1,e.lineCap=s.strokeLinecap??"butt",e.lineJoin=s.strokeLinejoin??"miter",e.stroke(t)),1!==a&&(e.globalAlpha=l)}}function Ve(e,t,n,r,o,i,s=0,a=r){if(i){const e=function(e,t,n,r,o,i=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(r,o+5,12),c=t-l,u=t+l,d=n-l,h=n+l;let f=null,p=1/0;return e.visit((e,o,l,m,y)=>{if(o>u||c>m||l>h||d>y)return!0;if(!e.length){let o=e;do{const e=o.data,l=i(e)-t,c=s(e)-n,u=Math.sqrt(l*l+c*c);Oe(a(e),r)>=u&&p>u&&(f=e,p=u),o=o.next}while(o)}return!1}),f?{node:f,distance:p}:null}(i,t,n,r,s);if(e)return e}else{let o=null,i=r;for(const s of e){if("point"!==s.type)continue;const e=s.x-t,a=s.y-n,l=Math.sqrt(e*e+a*a);Oe(s.r,r)>=l&&i>l&&(o=s,i=l)}if(o)return{node:o,distance:i}}let l=null,c=r;for(const o of e){if("glyph"!==o.type)continue;if(null==o.datum)continue;const e=qe(o.glyph,o.size),i=o.x+e.centerDx-t,s=o.y+e.centerDy-n,a=Math.sqrt(i*i+s*s);Oe(e.radius,r)>=a&&c>a&&(l=o,c=a)}if(l)return{node:l,distance:c};for(let r=e.length-1;r>=0;r--){const i=e[r];if("geoarea"!==i.type)continue;const s=i;if(!1===s.interactive)continue;const[[a,l],[c,u]]=s.bounds;if(!(a>t||t>c||l>n||n>u)&&(s._cachedPath2D||(s._cachedPath2D=new Path2D(s.pathData)),o.isPointInPath(s._cachedPath2D,t,n)))return{node:s,distance:0}}let u=null,d=a;for(const r of e){if("line"!==r.type)continue;const e=r,{path:o}=e,i=Math.max((e.style.strokeWidth||2)+4,5,a);for(let r=0;o.length-1>r;r++){const[s,a]=o[r],[l,c]=o[r+1],h=Ue(t,n,s,a,l,c);i>=h&&d>h&&(u=e,d=h)}}return u?{node:u,distance:d}:null}function Ue(e,t,n,r,o,i){const s=o-n,a=i-r,l=s*s+a*a;if(0===l)return Math.sqrt((e-n)**2+(t-r)**2);let c=((e-n)*s+(t-r)*a)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(n+c*s))**2+(t-(r+c*a))**2)}var Ze=l(require("react")),Ye=require("react"),Xe=require("react"),Qe=require("react/jsx-runtime");function Ke(e){let t=null;const n=()=>(t||(t=(0,Xe.createContext)(null)),t),r=Je(e);return[function({children:t,initialState:r}){const o=(0,Xe.useRef)(r),i=(0,Xe.useMemo)(()=>Je(e,o.current),[]),s=n();return(0,Qe.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const o=n(),i=(0,Xe.useContext)(o)??r,s=(0,Xe.useRef)(e);s.current=e;const a=(0,Xe.useRef)({hasValue:!1,value:void 0}),l=(0,Xe.useCallback)(()=>{const e=s.current(i.getState()),n=a.current;return n.hasValue&&t&&t(n.value,e)?n.value:(a.current={hasValue:!0,value:e},e)},[i,t]),c=(0,Xe.useCallback)(()=>s.current(i.getState()),[i]);return(0,Xe.useSyncExternalStore)(i.subscribe,l,c)}]}function Je(e,t){const n=new Set;let r={...e(function(e){const t=e(r);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){r={...r,...t};for(const e of n)e()}}),...t??{}};return{getState:()=>r,subscribe:function(e){return n.add(e),()=>{n.delete(e)}}}}function et(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 tt(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:nt}}),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 nt=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],rt={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}},ot={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}},it={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:nt,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 st(e,t){if("light"===t)return rt;if("dark"===t)return ot;if("high-contrast"===t)return it;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?ot:rt;return tt({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return tt({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[at,lt]=Ke(e=>({theme:rt,setTheme(t){e(e=>({theme:st(e.theme,t)}))}})),ct=require("react");var ut=require("react"),dt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,ht=new WeakMap,ft=0,pt=!1,mt=null,yt=null;function gt(e,t){if(!t)return t;const n=dt.exec(t);if(!n)return t;const r=e.canvas;if(!r)return n[2]?.trim()||t;!function(){if(pt)return;if("undefined"==typeof window||"undefined"==typeof document)return;pt=!0;const e=()=>{ft++};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{mt=window.matchMedia("(prefers-color-scheme: dark)"),yt=e,"function"==typeof mt.addEventListener?mt.addEventListener("change",yt):"function"==typeof mt.addListener&&mt.addListener(yt)}catch{}}();let o=ht.get(r);o&&o.version===ft||(o={version:ft,map:new Map},ht.set(r,o));const i=o.map.get(t);if(void 0!==i)return i;const s=getComputedStyle(r).getPropertyValue(n[1]).trim()||n[2]?.trim()||t;return o.map.set(t,s),s}var bt=()=>"undefined"!=typeof performance?performance.now():Date.now();function vt(e,t){const n=e();return Number.isFinite(n)?n:t}var xt=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??bt,this.lastWallTime=vt(this.clock,0),this.logicalTime=this.lastWallTime,this.pausedValue=!0===e.paused,this.visibleValue=!1!==e.visible,this.setRandomSource(e.random,e.seed)}get isActive(){return!this.pausedValue&&this.visibleValue}get paused(){return this.pausedValue}get seed(){return this.seedValue}get visible(){return this.visibleValue}configure(e){this.setClock(e.clock),this.setRandomSource(e.random,e.seed)}setPaused(e){this.pausedValue!==e&&(this.advance(),this.pausedValue=e,this.emit())}setVisible(e){this.visibleValue!==e&&(this.advance(),this.visibleValue=e,this.emit())}snapshot(){return{now:this.now(),paused:this.pausedValue,seed:this.seedValue,visible:this.visibleValue}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}advance(){const e=vt(this.clock,this.lastWallTime),t=Math.max(0,e-this.lastWallTime);return this.lastWallTime=e,this.isActive&&(this.logicalTime+=t),this.logicalTime}emit(){for(const e of this.subscribers)e()}setClock(e){const t=e??bt;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=vt(t,this.lastWallTime))}setRandomSource(e,t){const n=function(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}(t);e===this.randomInput&&n===this.seedValue||(this.randomInput=e,this.seedValue=n,this.randomSource=e??(void 0===n?Math.random:function(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n)))}},wt="undefined"==typeof window?Ye.useEffect:Ye.useLayoutEffect,kt={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function jt(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function St(e){const t=function(){const[e,t]=(0,ct.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,ct.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>t(e.matches))},[]),e}(),n=(0,Ye.useRef)(t);n.current=t;const[r,o]=function(e,t,n){const r=(0,ut.useRef)(null),[o,i]=(0,ut.useState)(null);return(0,ut.useEffect)(()=>{if(!t&&!n)return;const e=r.current;if(!e)return;const o=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 o.observe(e),()=>o.disconnect()},[t,n]),[r,[t&&o?o.w:e[0],n&&o?o.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=!!e.title,s=!!e.legend&&"top"===e.legendPosition,a=(0,Ye.useMemo)(()=>function(e,t,n=!1){const r=n?t?58:34:t?36:0;return r>e.top?{...e,top:r}:e}({...e.marginDefault,...e.userMargin},i,s),[e.marginDefault,e.userMargin,i,s]),l=o[0]-a.left-a.right,c=o[1]-a.top-a.bottom,u=jt(e.foregroundGraphics,o,a),d=jt(e.backgroundGraphics,o,a),h=lt(e=>e.theme),{transition:f,introEnabled:p}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(n||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),m="semiotic-table-"+Ze.useId(),y=(0,Ye.useRef)(null);if(!y.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;y.current=new xt({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const g=y.current;g.configure({clock:e.clock,random:e.random,seed:e.seed});const b=(0,Ye.useRef)(null),v=(0,Ye.useRef)(e.frameScheduler??kt);v.current=e.frameScheduler??kt;const x=(0,Ye.useRef)(null),w=(0,Ye.useRef)(!1),k=(0,Ye.useRef)(()=>{}),j=(0,Ye.useCallback)(()=>{if(null!==b.current||w.current)return;const e=v.current;let t=!1,n=!1;const r=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(w.current=!0),b.current=null,x.current=null;try{k.current()}finally{e&&(w.current=!1)}});n=!0,t||(b.current=r,x.current=e)},[]),S=(0,Ye.useCallback)(()=>{null!==b.current&&((x.current??v.current).cancelAnimationFrame(b.current),b.current=null,x.current=null)},[]);wt(()=>{g.setPaused(!0===e.paused)},[g,e.paused]),(0,Ye.useEffect)(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void g.setVisible(!0);const t=()=>g.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[g,e.suspendWhenHidden]),(0,Ye.useEffect)(()=>()=>{S()},[S]);const M=(0,Ye.useRef)(()=>{}),C=(0,Ye.useRef)(()=>{}),A=(0,Ye.useRef)(null),R=(0,Ye.useRef)(null),L=(0,Ye.useRef)(null),P=(0,Ye.useCallback)(()=>{const e=A.current;A.current=null,e&&M.current(e)},[]),I=(0,Ye.useCallback)(e=>{if(A.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===R.current){const e=v.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,R.current=null,L.current=null,P()});t||(R.current=n,L.current=e)}},[P]),D=(0,Ye.useCallback)(()=>{A.current=null,null!==R.current&&((L.current??v.current).cancelAnimationFrame(R.current),R.current=null,L.current=null),C.current()},[]);(0,Ye.useEffect)(()=>()=>{A.current=null,null!==R.current&&((L.current??v.current).cancelAnimationFrame(R.current),R.current=null,L.current=null)},[]);const T=e.themeDirtyRef;return wt(()=>{T&&(ft++,T.current=!0,j())},[h,j,T]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:r,size:o,margin:a,adjustedWidth:l,adjustedHeight:c,resolvedForeground:u,resolvedBackground:d,currentTheme:h,transition:f,introEnabled:p,tableId:m,frameRuntime:g,rafRef:b,renderFnRef:k,scheduleRender:j,cancelRender:S,hoverHandlerRef:M,hoverLeaveRef:C,onPointerMove:I,onPointerLeave:D}}var Mt=require("react"),Ct=require("react"),At={fresh:1,aging:.7,stale:.45,expired:.25},Rt={alpha:1,band:"fresh",isStale:!1};var Lt=require("react/jsx-runtime");function Pt({isStale:e,position:t}){return(0,Lt.jsx)("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}var It=l(require("react")),[Dt,Tt]=Ke(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 zt(e,t={}){const n=function(e){const t=e.provenance,n=e.id??e.stableId??t?.stableId;return null==n||""===n?void 0:n+""}(e);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(r){const o=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(r);t.onAnnotationActivate?.({annotation:e,annotationId:n,chartId:t.chartId,inputType:o}),n&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:n,inputType:o,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}var Ot=require("react"),Nt=l(require("react")),Et=require("react/jsx-runtime");function Bt(e,t=120,n=8){if(!e)return[];const r=Math.max(1,Math.floor(t/n)),o=e.split(/\s+/),i=[];let s="";for(const e of o)s&&s.length+1+e.length>r?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function _t(e,t,n,r){return"curly"===e?r?`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`:r?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Wt(e,t,n,r){if(!e)return(0,Et.jsx)("g",{className:"annotation-note"});const{label:o,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!o&&!i)return(0,Et.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d=a;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const f=16,p=i?c?[i]:Bt(i,l):[],m=o?c?[o]:Bt(o,l):[],y="leftRight"===u?"end"===h?-4:4:0;let g=0;const b=[],v=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push((0,Et.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===h?y-l:"middle"===h?y-l/2:y,y:-16,width:l,height:Math.max(f,(p.length+m.length)*f+(i&&o?2:0))+f,style:{overflow:"visible"},children:(0,Et.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:v,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&(0,Et.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),o&&(0,Et.jsx)("div",{className:"annotation-note-label",children:o})]})},"annotation-note-html")):(p.length>0&&(b.push((0,Et.jsx)("text",{className:"annotation-note-title",fill:v,textAnchor:h,fontWeight:"bold",children:p.map((e,t)=>(0,Et.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-title")),g=p.length*f),m.length>0&&b.push((0,Et.jsx)("text",{className:"annotation-note-label",fill:v,textAnchor:h,y:g,children:m.map((e,t)=>(0,Et.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let x=null;if((i||o)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),x=(0,Et.jsx)("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(p.length+m.length)*f+(m.length>0?f:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),x=(0,Et.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:r||"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"===d?-(w+f+(m.length>0&&p.length>0?2:0))/2+8:"bottom"===d||0>n?-(w+2):18),(0,Et.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[(0,Et.jsx)("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0,children:b}),x]})}function Ht(e,t,n,r,o){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push((0,Et.jsx)("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,r=t?.height||0;(e>0||r>0)&&i.push((0,Et.jsx)("rect",{width:e,height:r,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=r||0,s=o||0;if(void 0!==t?.x){const r=(t.x||0)-e;i.push((0,Et.jsx)("line",{x1:r,y1:(t.y1||0)-s,x2:r,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const r=(t.y||0)-s;i.push((0,Et.jsx)("line",{x1:(t.x1||0)-e,y1:r,x2:(t.x2||0)-e,y2:r,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push((0,Et.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push((0,Et.jsx)("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",r=t?.width??t?.height;void 0!==r&&i.push((0,Et.jsx)("path",{d:_t(e,r,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,Et.jsx)("g",{className:"annotation-subject",children:i})}function Ft(e,t,n,r,o,i){const s=[];let a=0,l=0;if("callout-circle"!==o&&"label"!==o||!i?.radius){if("callout-rect"===o&&i){const n=i.width||0,r=i.height||0;if(n>0||r>0){const o=n/2,i=r/2,s=e-o,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=n/2,d=r/2,h=e*d>t*u?u/e:d/t;a=o+s*h,l=i+c*h}}}else if("bracket"===o&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(a=e/2,l=n):void 0!==t&&(a=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const r=Math.atan2(t,e);a=Math.cos(r)*n,l=Math.sin(r)*n}}const c=Math.sqrt((e-a)**2+(t-l)**2);if(c>.5){const o=r||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let u=Math.atan2(t-l,e-a);if(i){const r=(a+e)/2,i=(l+t)/2,d=-(t-l)/c,h=(e-a)/c,f=(n?.curve??.25)*c,p=r+d*f,m=i+h*f;s.push((0,Et.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${p},${m} ${e},${t}`,fill:"none",stroke:o},"connector-line")),u=Math.atan2(m-l,p-a)}else s.push((0,Et.jsx)("line",{x1:a,y1:l,x2:e,y2:t,stroke:o},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;s.push((0,Et.jsx)("path",{d:`M${a},${l}L${a+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${a+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:o,stroke:"none"},"connector-arrow"))}}return(0,Et.jsx)("g",{className:"annotation-connector",children:s})}function $t(e){const{x:t=0,y:n=0,dx:r,dy:o,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:d,className:h,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=r||0,k=o||0;null!=i&&(w=i-b),null!=s&&(k=s-v);const j="string"==typeof u?u:"label";if("bracket"===j&&c&&0===w&&0===k)if(void 0!==c.width){w=c.width/2;const e=c.depth||30;k=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;w=e+(0>e?-5:5),k=c.height/2}return(0,Et.jsxs)("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${v})`,"data-testid":g,...null!=p&&{opacity:p},...m&&{strokeDasharray:m},...y,children:[!x.has("connector")&&Ft(w,k,l,d,j,c),!x.has("subject")&&Ht(j,c,d,b,v),!x.has("note")&&Wt(a,w,k,d)]})}function qt(e){const{noteData:t}=e,{screenCoordinates:n}=t,r="string"==typeof t.type?t.type:"label",o=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),o=t.ny||n[0][1]+(t.dy??0),i=n.map((n,i)=>{const s=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:o});return(0,Et.jsx)($t,{"data-testid":"semiotic-annotation",...s,type:r},"multi-annotation-"+i)});return(0,Et.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,Et.jsx)($t,{"data-testid":"semiotic-annotation",events:o,...t,type:r},s)}var Gt=require("d3-hierarchy"),Vt=require("d3-shape");function Ut(e){return Math.round(100*e)/100}function Zt(e,t=2){const n=[],r=[],o=t+1;for(let t=0;o>t;t++){let i=0;for(const[n,r]of e)null!==r&&(i+=n**t*r);n.push(i);const s=[];for(let n=0;o>n;n++){let r=0;for(const[o,i]of e)null!==i&&(r+=o**(t+n));s.push(r)}r.push(s)}r.push(n);const i=function(e,t){const n=e,r=e.length-1,o=[t];for(let e=0;r>e;e++){let t=e;for(let o=e+1;r>o;o++)Math.abs(n[e][o])>Math.abs(n[e][t])&&(t=o);for(let o=e;r+1>o;o++){const r=n[o][e];n[o][e]=n[o][t],n[o][t]=r}for(let t=e+1;r>t;t++)for(let o=r;o>=e;o--)n[o][t]-=n[o][e]*n[e][t]/n[e][e]}for(let e=r-1;e>=0;e--){let t=0;for(let i=e+1;r>i;i++)t+=n[i][e]*o[i];o[e]=(n[r][e]-t)/n[e][e]}return o}(r,o).map(Ut);return{points:e.map(([e])=>[Ut(e),Ut(i.reduce((t,n,r)=>t+n*e**r,0))]),equation:[...i].reverse()}}function Yt(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 Xt(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 Qt(e){return null==e?null:e+""}function Kt(e,t,n){return t.stickyPositionCache?.set(e,n),n}function Jt(e,t,n){const r=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===r){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const o=n.pointNodes[r];if(o.pointId===e.pointId)return Kt(t,n,{x:o.x,y:o.y})}const r=function(e){const t=e.data;if(!t||0===t.length)return null;const n=t[t.length-1],r=e.scales?.x??e.scales?.time,o=e.scales?.y??e.scales?.value;if(!r||!o)return null;const i=n[e.xAccessor||"x"],s=n[e.yAccessor||"y"];return null==i||null==s?null:{x:r(i),y:o(s)}}(n);return r?Kt(t,n,r):null}if("semantic"===r){const r=function(e,t,n){const r=function(e){return Qt(e.provenance?.stableId??e.stableId)}(e);if(!r)return null;const o=n.pointNodes?.find(e=>Qt(e.pointId)===r);if(o)return Kt(t,n,{x:o.x,y:o.y});const i=n.data?.find(e=>function(e){return Qt(e.stableId??e.id??e.provenance?.stableId)}(e)===r);if(!i)return null;const s=Yt(i,n),a=Xt(i,n);return null==s||null==a?null:Kt(t,n,{x:s,y:a})}(e,t,n);if(r)return r}let o=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(o=t.x,i=t.y)}if(null!=o&&null!=i||(o=Yt(e,n),i=Xt(e,n)),null!=o&&null!=i)return Kt(t,n,{x:o,y:i});if("sticky"===r){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function en(e,t,n,r=50){return!(-r>e||e>(n.width||0)+r||-r>t||t>(n.height||0)+r)}var tn=require("react/jsx-runtime"),nn={secondary:0,primary:3};function rn(e){return!0===e?._annotationDeferred}function on(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function sn(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)}var ln=require("react/jsx-runtime"),cn="var(--semiotic-bg, #ffffff)";function un(e){const{x:t,y:n,text:r,fill:o,fontSize:i=12,fontWeight:s,fontFamily:a,textAnchor:l="start",dominantBaseline:c,background:u,className:d}=e,h=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(u),f=e=>(0,ln.jsx)("text",{x:t,y:n,textAnchor:l,dominantBaseline:c,fill:o,fontSize:i,fontWeight:s,fontFamily:a,className:d,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:r});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??cn,strokeWidth:h.haloWidth??3});const p=h.padding??{x:6,y:3},m="number"==typeof p?p:p.x,y="number"==typeof p?p:p.y,g=function(e,t){return(e+"").length*t*.6}(r,i),b=i+2*y;let v,x;return v="middle"===l?t-g/2-m:"end"===l?t-g-m:t-m,x="middle"===c||"central"===c?n-b/2:"hanging"===c||"text-before-edge"===c?n-y:n-.8*i-y,(0,ln.jsxs)("g",{className:d,children:[(0,ln.jsx)("rect",{x:v,y:x,width:g+2*m,height:b,rx:h.radius??3,ry:h.radius??3,fill:h.fill??cn,fillOpacity:h.opacity??.85,stroke:h.stroke,strokeWidth:h.strokeWidth}),f()]})}var dn=null;var hn=require("react/jsx-runtime");function fn(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function pn(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function mn(e,t){let n=2166136261;const r=pn(t);for(let e=0;r.length>e;e++)n^=r.charCodeAt(e),n=Math.imul(n,16777619);return`${e}-hatch-${(n>>>0).toString(36)}`}var yn=new Map;function gn(e,t){const{background:n="transparent",stroke:r="#000",lineWidth:o=1.5,spacing:i=6,angle:s=45,lineOpacity:a=1}=e,l=Math.max(8,Math.ceil(2*i));return(0,hn.jsxs)("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==s?`rotate(${s})`:void 0,children:[n&&"transparent"!==n&&(0,hn.jsx)("rect",{width:l,height:l,fill:n}),(0,hn.jsx)("line",{x1:0,y1:0,x2:0,y2:l,stroke:r,strokeWidth:o,strokeOpacity:a}),(0,hn.jsx)("line",{x1:i,y1:0,x2:i,y2:l,stroke:r,strokeWidth:o,strokeOpacity:a})]},t)}function bn(e,t,n="#4e79a7"){if(fn(e)){const n=mn(t,e);return{fill:`url(#${n})`,def:gn(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}var vn=require("react/jsx-runtime"),xn={linear:Vt.curveLinear,monotoneX:Vt.curveMonotoneX,monotoneY:Vt.curveMonotoneY,step:Vt.curveStep,stepAfter:Vt.curveStepAfter,stepBefore:Vt.curveStepBefore,basis:Vt.curveBasis,cardinal:Vt.curveCardinal,catmullRom:Vt.curveCatmullRom};var wn=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function kn(e){return!!e&&"object"==typeof e&&wn.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function jn(e){return"primary"===e?.emphasis||!0===e?.defensive}function Sn(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 Mn(e){let t;const n=e?.emphasis;t="primary"===n?100:"secondary"===n?10:50;const r=e?.provenance?.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(t+=15*Math.max(0,Math.min(1,r))),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 Cn=32,An=6,Rn=4,Ln=8,Pn=72;var In={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Dn(e){if(!Tn(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 Tn(e){return kn(e)}function zn(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),r=e.split(/\s+/).filter(Boolean),o=[];let i="";for(const e of r)i&&i.length+e.length+1>n?(o.push(i),i=e):i=i?`${i} ${e}`:e;return i&&o.push(i),o}function On(e,t,n,r,o){const i=e+n,s=t+r;return Math.abs(n)>Math.abs(r)?{x:0>n?i-o.width-4:i+4,y:0>r?s-o.height:s,width:o.width,height:o.height}:{x:0>n?i-o.width:i,y:0>r?s-o.height-4:s+4,width:o.width,height:o.height}}function Nn(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function En(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 Bn(e,t,n,r,o,i,s,a){const l=Nn(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,r){const o=Math.max(0,r-e.x),i=Math.max(0,r-e.y);return(o+Math.max(0,e.x+e.width-(t-r)))*e.height+(i+Math.max(0,e.y+e.height-(n-r)))*e.width}(l,o,i,a);for(const e of n)c+=12*En(l,e);for(const e of r)c+=4*En(l,e);return c}function _n(e){const{annotations:t,context:n,defaultOffset:r=Cn,notePadding:o=An,markPadding:i=Rn,edgePadding:s=Ln,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=Pn,density:u,progressiveDisclosure:d=!1,redundantCues:h=!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(Dn):t,j=w&&!u?{maxAnnotations:v.maxAnnotations??("callout-list"===v.strategy?1:2),minVisible:v.minVisible??1}:u,S=d||w&&(!1!==v.progressiveDisclosure||"callout-list"===v.strategy),M=w&&!f?v.responsive??{minWidth:x}:f,C=w&&!m?v.cohesion:m;if(0===k.length||0>=g||0>=b)return k.slice();const A=[],R=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 L=!1;const P=k.map((e,t)=>{if(!Tn(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 r=e.pointId??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 o=e.coordinates,i=n.scales?.geoProjection;if(Array.isArray(o)&&o.length>=2&&i){const e=o[0],t=o[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?Jt(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=[...zn("string"==typeof e.title?e.title:void 0,t),...zn("string"==typeof e.label?e.label:void 0,t)],r=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*r)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return A.push(Nn(On(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),o)),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}]}(r)){const t=Bn(On(i.x,i.y,e.dx,e.dy,u),e,A,R,g,b,o,s);f>t&&(h=e,f=t)}if(!h)return e;const p=Nn(On(i.x,i.y,h.dx,h.dy,u),o);A.push(p);const m=Math.hypot(h.dx,h.dy),y=l&&m>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return L=!0,{...e,dx:h.dx,dy:h.dy,...y?{connector:y}:{}}}),I=L?P:k.slice();let D=I;if(h){let e=!1;const t=I.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return n!==t&&(e=!0),n});D=e?t:I}{let e=!1;const t=D.map(t=>{if(!0!==t?.defensive)return t;const n=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const n="string"==typeof t.source?In[t.source]??t.source:null,r="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!n&&!r)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const o=[n,r].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${o})`)?e:{...e,label:i?`${i} (${o})`:`(${o})`}}(t);return n!==t&&(e=!0),n});D=e?t:D}const T=new Set;if(j){const e="object"==typeof j?j:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(y),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??Sn(g,b,e))*t))},{deferred:r}=function(e){const{annotations:t,width:n,height:r}=e,o=Math.max(0,e.minVisible??1),i=Sn(n,r,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,kn(n))};var n}),a=s.filter(e=>e.note);if(0===a.length||i>=a.length)return{visible:t.slice(),deferred:[],budget:i};const l=a.filter(e=>jn(e.annotation)),c=a.filter(e=>!jn(e.annotation)).sort((e,t)=>Mn(t.annotation)-Mn(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,i-l.length),Math.max(0,o-l.length))),d=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),h=[],f=[];for(const{annotation:e,index:t,note:n}of s)!n||d.has(t)?h.push(e):f.push(e);return{visible:h,deferred:f,budget:i}}({annotations:D,width:g,height:b,...n});for(const e of r)T.add(e)}if(M&&("object"==typeof M&&"number"==typeof M.minWidth?M.minWidth:480)>=g)for(const e of D)Tn(e)&&"secondary"===e.emphasis&&T.add(e);if(T.size>0)for(const e of D)!0===e?.defensive&&T.delete(e);let z;return z=0===T.size?D:S?D.map(e=>T.has(e)?{...e,_annotationDeferred:!0}:e):D.filter(e=>!T.has(e)),C?function(e,t){let n=!1;const r=e.map(e=>Tn(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?r:e}(z,C):z}var Wn=l(require("react")),Hn=require("react/jsx-runtime"),Fn={fill:(e,t)=>(0,Hn.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,Hn.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function $n(e,t,n,r,o){let i;return i="function"==typeof n?n(e):(0,Fn[n])(r(e,t),o),i}function qn({swatchSize:e}){return(0,Hn.jsx)("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Gn(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var Vn=(e,t,n,r,o,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:f}=e,p=[];let m=0;const y=!(!t&&!n),g="isolate"===c||void 0===c&&null!=o,{swatchSize:b,labelGap:v,rowHeight:x}=u;return f.forEach((e,c)=>{const u=$n(e,c,d,h,b),w=Gn(e,r,o),k=o&&o.size>0&&o.has(e.label);p.push((0,Hn.jsxs)("g",{transform:`translate(0,${m})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:y?a===i&&c===s?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&g?k||!1:void 0,"aria-current":y&&!g&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:y?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:y?t=>{l(a,c),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.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&&(0,Hn.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+v+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,k&&(0,Hn.jsx)(qn,{swatchSize:b}),(0,Hn.jsx)("text",{y:b/2,x:b+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),m+=x}),p};function Un({config:e,orientation:t="vertical",width:n=100}){const{colorFn:r,domain:o,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+Wn.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),s=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Hn.jsx)("stop",{offset:100*t+"%",stopColor:r(o[0]+t*(o[1]-o[0]))},e))}return(0,Hn.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,Hn.jsx)("defs",{children:(0,Hn.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,Hn.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Hn.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,Hn.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(o[0])}),(0,Hn.jsx)("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(o[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Hn.jsx)("stop",{offset:100*t+"%",stopColor:r(o[1]-t*(o[1]-o[0]))},e))}return(0,Hn.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,Hn.jsx)("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Hn.jsx)("defs",{children:(0,Hn.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,Hn.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,Hn.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(o[1])}),(0,Hn.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(o[0])})]})}function Zn(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=function(e){const t=Math.max(1,e?.swatchSize??16),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}}(d),[f,p]=Wn.useState(0),[m,y]=Wn.useState(0),g=Wn.useCallback((e,t)=>{p(e),y(t)},[]),b="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{let d=24;const h=[];return e.forEach((e,f)=>{d+=5,h.push((0,Hn.jsx)("line",{stroke:"gray",x1:0,y1:d,x2:t,y2:d},"legend-top-line legend-symbol-"+f)),d+=8,e.label&&(d+=16,h.push((0,Hn.jsx)("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),d+=8),h.push((0,Hn.jsx)("g",{className:"legend-item",transform:`translate(0,${d})`,children:Vn(e,n,r,o,i,s,a,f,l,c,u)},"legend-group-"+f)),d+=e.items.length*u.rowHeight+8}),h})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:g,legendInteraction:s,metrics:h}):(({legendGroups:e,height:t,width:n,customClickBehavior:r,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=0;const f=[];e.forEach((e,t)=>{let p=0;e.label&&(p+=16);const m=((e,t,n,r,o,i,s,a,l,c,u,d)=>{const{type:h="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!=o,j=p.map(e=>y+g+7*e.label.length),S=[];let M=0,C=0;j.forEach((e,t)=>{const n=0===C?e:C+b+e;d&&d>0&&C>0&&n>d?(S.push({start:M,end:t,width:C}),M=t,C=e):C=n}),p.length>0&&S.push({start:M,end:p.length,width:C}),S.forEach((e,c)=>{let u="center"===x?Math.max(0,((d??e.width)-e.width)/2):"end"===x?Math.max(0,(d??e.width)-e.width):0;for(let d=e.start;e.end>d;d++){const e=p[d],x=$n(e,d,h,f,y),S=Gn(e,r,o),M=o&&o.size>0&&o.has(e.label);m.push((0,Hn.jsxs)("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?a===i&&d===s?0:-1:void 0,role:w?"option":void 0,"aria-selected":w&&k?M||!1:void 0,"aria-current":w&&!k&&null!=r&&e.label===r||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=(d+("ArrowRight"===n.key?1:-1)+p.length)%p.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:w?t=>{l(a,d),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.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:S,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[w&&(0,Hn.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:y+g+2+7*e.label.length,height:y+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,M&&(0,Hn.jsx)(qn,{swatchSize:y}),(0,Hn.jsx)("text",{y:y/2,x:y+g,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+d)),u+=j[d]+b}});const A=Math.max(0,...S.map(e=>e.width)),R=S.length;return{items:m,offset:A,totalRows:R,totalHeight:R*v}})(e,r,o,i,s,a,l,t,c,u,d,d.maxWidth??n);p+=m.offset+5,f.push({label:e.label,...m,offset:p,totalRows:m.totalRows,totalHeight:m.totalHeight}),h+=p+12});const p=d.maxWidth??n;let m=h>p?0:"center"===d.align?Math.max(0,(p-h)/2):"end"===d.align?Math.max(0,p-h):0;const y=[];return f.forEach((n,r)=>{const o=e[r];o.label&&(y.push((0,Hn.jsx)("text",{transform:`translate(${m},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label},"legend-text-"+r)),m+=16),y.push((0,Hn.jsx)("g",{className:"legend-item",transform:`translate(${m},0)`,children:n.items},"legend-group-"+r)),m+=n.offset+5,e[r+1]&&y.push((0,Hn.jsx)("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+r)),m+=12}),(0,Hn.jsx)("g",{children:y})})({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:g,legendInteraction:s,metrics:h}),v=!(!n&&!r);return(0,Hn.jsxs)("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===u&&(0,Hn.jsx)("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),b]})}function Yn(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}var Xn=require("react/jsx-runtime");function Qn(e){const{legend:t,totalWidth:n,totalHeight:r,margin:o,legendPosition:i="right",legendLayout:s,title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const f="top"===i||"bottom"===i,p=!!a,m=Math.max(0,n-o.left-o.right),y=Math.max(1,f?s?.maxWidth??m:100);let g,b;return"left"===i?(g=Math.max(4,o.left-y-10),b=o.top):"top"===i?(g=o.left,b=p?32:8):"bottom"===i?(g=o.left,b=r-o.bottom+38):(g=n-o.right+10,b=o.top),(0,Xn.jsx)("g",{transform:`translate(${g}, ${b})`,children:(v=t,"object"==typeof v&&null!==v&&"gradient"in v?(0,Xn.jsx)(Un,{config:t.gradient,orientation:f?"horizontal":"vertical",width:y}):Yn(t)?(0,Xn.jsx)(Zn,{legendGroups:t.legendGroups,title:"",width:y,orientation:f?"horizontal":"vertical",legendLayout:s,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t)});var v}var Kn=require("react/jsx-runtime");function Jn(e){const{width:t,height:n,totalWidth:r,totalHeight:o,margin:i,showAxes:s,title:a,legend:l,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h,legendPosition:f,legendLayout:p,foregroundGraphics:m,annotations:y,onAnnotationActivate:g,onObservation:b,chartId:v,chartType:x,autoPlaceAnnotations:w,pointNodes:k}=e,j=function(e){const t=Tt(e=>e.pushObservation),n=It.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return It.useMemo(()=>({...e,onObservation:n}),[n,e])}({onAnnotationActivate:g,onObservation:b,chartId:v,chartType:x}),S=(0,Ot.useRef)([y?.length??0,new Map]),M=y?.length??0;S.current[0]!==M&&(S.current=[M,new Map]);const C=(0,Ot.useMemo)(()=>{if(!y||0===y.length)return null;const e={scales:null,timeAxis:"x",width:t,height:n,frameType:"xy",pointNodes:k,stickyPositionCache:S.current[1]};return function(e,t,n,r){const o=[];return e.forEach((e,i)=>{let s;if(n){const o=n(e,i,r);s=null!=o?o:t(e,i,r)}else s=t(e,i,r);s&&o.push({node:s,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:sn(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),r=e.some(e=>rn(e.annotation)),o=e.some(e=>null!=on(e.annotation)),i=e.some(e=>"layer"===on(e.annotation));if(!n&&!r&&!o)return e.map(e=>e.node);const s=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of t)e.emphasis&&(e.rank=nn[e.emphasis]);const a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:r,readingOrder:o}=e,i=rn(t.annotation);let s=t.node;if("primary"===r||"secondary"===r||null!=o){const e=null==r&&null!=o;s=(0,tn.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+r,..."secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:an(o),"data-annotation-reading-order":o}:{},children:t.node},"annotation-emphasis-"+n)}const a=on(t.annotation);return a&&(s=(0,tn.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+n)),i&&(s=(0,tn.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+n)),s});return r&&a.unshift((0,tn.jsx)("style",{children:".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}"},"annotation-disclosure-style")),i&&a.unshift((0,tn.jsx)("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),a}(o)}(w?_n({annotations:y,context:e,..."object"==typeof w?w:{}}):y,function(e,t={}){return function(e,n,r){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=Jt(e,n,r);if(!t)return null;const{x:o,y:i}=t;if(!en(o,i,r))return null;const s="callout"===e.type?"callout-circle":e.type,a="callout-circle"===s?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===s?{width:e.width,height:e.height}:void 0;return(0,vn.jsx)(qt,{noteData:{x:o,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:s,...a?{subject:a}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+n)}case"x-threshold":{const t=Yt(null!=e.value?{...e,x:e.value}:e,r);if(null==t)return null;const o=e.color||"#f97316",i=e.labelPosition||"top";let s;s="bottom"===i?(r.height||0)-4:"center"===i?(r.height||0)/2:16;const a=t>.6*(r.width||0),l=a?t-4:t+4,c=a?"end":"start";return(0,vn.jsxs)("g",{opacity:e.opacity,children:[(0,vn.jsx)("line",{x1:t,y1:0,x2:t,y2:r.height||0,stroke:o,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,vn.jsx)(un,{x:l,y:s,text:e.label,textAnchor:c,fill:o,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"y-threshold":{const t=Xt(null!=e.value?{...e,y:e.value}:e,r);if(null==t)return null;const o=e.color||"#f97316",i=e.labelPosition||"right";let a,l;"left"===i?(a=4,l="start"):"center"===i?(a=(r.width||0)/2,l="middle"):(a=(r.width||0)-4,l="end");const c=20>(s=t)?Math.min((r.height||0)-4,s+16):s-4;return(0,vn.jsxs)("g",{opacity:e.opacity,children:[(0,vn.jsx)("line",{x1:0,y1:t,x2:r.width||0,y2:t,stroke:o,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,vn.jsx)(un,{x:a,y:c,text:e.label,textAnchor:l,fill:o,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:Yt({...e,type:"point"},r),y:Xt({...e,type:"point"},r),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const o=(0,Gt.packEnclose)(t),i=e.padding||10;return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("circle",{cx:o.x,cy:o.y,r:o.r+i,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,vn.jsx)(un,{x:o.x,y:o.y-o.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:Yt({...e,type:"point"},r),y:Xt({...e,type:"point"},r)})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const o=e.padding||10,i=t.map(e=>e.x),s=t.map(e=>e.y),[a,l]=oe(i),[c,u]=oe(s),d=a-o,h=l+o,f=c-o;return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("rect",{x:d,y:f,width:h-d,height:u+o-f,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,vn.jsx)(un,{x:(d+h)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"highlight":{const t=r.data||[],o="function"==typeof e.filter?t.filter(e.filter):e.field&&null!=e.value?t.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return(0,vn.jsx)("g",{children:o.map((t,n)=>{const o=Yt(t,r),s=Xt(t,r);if(null==o||null==s)return null;const a="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return(0,vn.jsx)("circle",{cx:o,cy:s,r:a,...l},"hl-"+n)})},"ann-"+n)}case"bracket":{const t=Yt(e,r),o=Xt(e,r);return(0,vn.jsx)(qt,{noteData:{x:t??0,y:o??0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}},"ann-"+n)}case"trend":{const t=r.data||[];if(2>t.length)return null;const o=r.xAccessor||"x",i=r.yAccessor||"y",s="ordinal"===r.frameType,a="horizontal"===r.projection,l=s?o:null,c=s?i:null;let u;const d=[],h=new Map;if(s&&l&&c){for(const e of t){const t=e[l];if(null==t)continue;const n=t+"";h.has(n)||(h.set(n,d.length),d.push(n))}u=t.map(e=>{const t=e[l],n=e[c];if(null==t||null==n)return null;const r=h.get(t+"");return null!=r?[r,+n]:null}).filter(e=>null!==e)}else u=t.map(e=>[e[o],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=r.scales?.x??r.scales?.time,p=r.scales?.y??r.scales?.value;if(!f||!p)return null;const m=e=>t=>{const n=Math.max(0,Math.floor(t)),r=Math.min(d.length-1,n+1),o=t-n,i=e(d[n]);return i+(e(d[r])-i)*o},y=f,g=p;let b;if(s)if(a){const e=m(g);b=(t,n)=>[y(n),e(t)]}else{const e=m(y);b=(t,n)=>[e(t),g(n)]}else b=(e,t)=>[y(e),g(t)];const v=e.method||"linear";let x;if("loess"===v)x=function(e,t=.3){const n=e.length;if(2>n)return e.slice();const r=e.slice().sort((e,t)=>e[0]-t[0]),o=r.map(e=>e[0]),i=r.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=o[e],r=o.map(e=>Math.abs(e-t)),l=r.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:r[e]/l;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*o[e],h+=t*i[e],f+=t*o[e]*o[e],p+=t*o[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const m=u*f-d*d;if(1e-12>Math.abs(m))a.push([t,h/u]);else{const e=(u*p-d*h)/m;a.push([t,(h-e*d)/u+e*t])}}return a}(u,e.bandwidth??.3);else{const t="polynomial"===v?Zt(u,e.order||2):function(e){const t=[0,0,0,0];let n=0;for(const[r,o]of e)null!==o&&(n++,t[0]+=r,t[1]+=o,t[2]+=r*r,t[3]+=r*o);const r=n*t[2]-t[0]*t[0],o=0===r?0:Ut((n*t[3]-t[0]*t[1])/r),i=Ut(t[1]/n-o*t[0]/n);return{points:e.map(([e])=>[Ut(e),Ut(o*e+i)]),equation:[o,i]}}(u);x=t.points}const w=x.map(([e,t])=>{const[n,r]=b(e,t);return`${n},${r}`}).join(" "),k=e.color||"#6366f1",j=x[x.length-1],[S,M]=b(j[0],j[1]);return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("polyline",{points:w,fill:"none",stroke:k,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,vn.jsx)("text",{x:S+4,y:M-4,fill:k,fontSize:11,children:e.label})]},"ann-"+n)}case"band":{const t=r.scales?.y??r.scales?.value,s=t?.(e.y0)??0,a=t?.(e.y1)??(r.height||0),l=bn(e.fill,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,vn.jsxs)("g",{opacity:e.opacity,children:[l.def&&(0,vn.jsx)("defs",{children:l.def}),(0,vn.jsx)("rect",{x:0,y:Math.min(s,a),width:r.width||0,height:Math.abs(a-s),fill:l.fill,fillOpacity:e.fillOpacity||.1}),e.label&&(0,vn.jsx)(un,{x:(r.width||0)-4,y:(o=s,i=a,Math.max(Math.min(o,i),0)+16),textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"x-band":{const t=r.scales?.x??r.scales?.time,o=null!=e.x0&&t?t(e.x0):null,i=null!=e.x1&&t?t(e.x1):null;if(null==o||null==i)return null;const s=bn(e.fill||e.color,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,vn.jsxs)("g",{opacity:e.opacity,children:[s.def&&(0,vn.jsx)("defs",{children:s.def}),(0,vn.jsx)("rect",{x:Math.min(o,i),y:0,width:Math.abs(i-o),height:r.height||0,fill:s.fill,fillOpacity:e.fillOpacity??.1}),e.label&&(0,vn.jsx)(un,{x:Math.min(o,i)+4,y:16,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"envelope":{const t=r.data||[];if(2>t.length)return null;const o=r.xAccessor||"x",i=r.scales?.x??r.scales?.time,s=r.scales?.y??r.scales?.value;if(!i||!s)return null;const a=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=t.filter(e=>null!=e[a]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[o]-t[o]);if(2>u.length)return null;const d=xn[r.curve||"linear"]||Vt.curveLinear,h=(0,Vt.area)().x(e=>i(e[o])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(d)(u);if(!h)return null;const f=e.fill||"#6366f1";return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,vn.jsx)("text",{x:i(u[u.length-1][o])+4,y:s(u[u.length-1][a])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+n)}case"anomaly-band":{const t=r.data||[];if(2>t.length)return null;const o=r.yAccessor||"y",i=r.scales?.x??r.scales?.time,s=r.scales?.y??r.scales?.value;if(!i||!s)return null;const a=t.map(e=>e[o]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-l)**2,0)/a.length,u=Math.sqrt(c),d=e.threshold??2,h=l-d*u,f=!1!==e.showBand,p=e.fill||"#6366f1",m=e.fillOpacity??.1,y=e.anomalyColor||"#ef4444",g=e.anomalyRadius??6,b=s(l+d*u),v=s(h),x=t.filter(e=>{const t=e[o];return null!=t&&Math.abs(t-l)>d*u});return(0,vn.jsxs)("g",{children:[f&&(0,vn.jsx)("rect",{x:0,y:Math.min(b,v),width:r.width||0,height:Math.abs(v-b),fill:p,fillOpacity:m}),x.map((e,t)=>{const n=Yt(e,r),o=Xt(e,r);return null==n||null==o?null:(0,vn.jsx)("circle",{cx:n,cy:o,r:g,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,vn.jsx)("text",{x:(r.width||0)-4,y:Math.min(b,v)-4,textAnchor:"end",fill:p,fontSize:11,children:e.label})]},"ann-"+n)}case"forecast":{const t=r.data||[];if(3>t.length)return null;const o=r.xAccessor||"x",i=r.yAccessor||"y",s=r.scales?.x??r.scales?.time,a=r.scales?.y??r.scales?.value;if(!s||!a)return null;const l=t.map(e=>[e[o],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=Zt(l,e.order||2).equation;c=e=>t.reduce((t,n,r)=>t+n*Math.pow(e,r),0)}else{const e=l.length;let t=0,n=0,r=0,o=0;for(const[e,i]of l)t+=e,n+=i,r+=e*e,o+=e*i;const i=e*r-t*t;if(1e-12>Math.abs(i))return null;const s=(e*o-t*n)/i,a=(n-s*t)/e;c=e=>a+s*e}const u=l.length,d=l.map(([e,t])=>t-c(e)),h=d.reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(u-2,1)),p=l.reduce((e,t)=>e+t[0],0)/u,m=l.reduce((e,t)=>e+(t[0]-p)**2,0),y=e.confidence??.95,g=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,b=e.steps??5,v=l[u-1][0],x=(v-l[0][0])/Math.max(u-1,1),w=[];for(let e=1;b>=e;e++)w.push(v+e*x);const k=[];for(const e of w){const t=c(e),n=f*Math.sqrt(1+1/u+(m>0?(e-p)**2/m:0))*g;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const j=`M${k.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,S=k.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),M=`${s(v)},${a(c(v))}`,C=e.strokeColor||"#6366f1";return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("path",{d:j,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,vn.jsx)("polyline",{points:`${M} ${S}`,fill:"none",stroke:C,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&k.length>0&&(0,vn.jsx)("text",{x:s(k[k.length-1].x)+4,y:a(k[k.length-1].yCenter)-4,fill:C,fontSize:11,children:e.label})]},"ann-"+n)}case"widget":{let o,i;if(null!=e.px&&null!=e.py)o=e.px,i=e.py;else{const t=Jt(e,n,r);if(!t)return null;o=t.x,i=t.y}if(!en(o,i,r))return null;const s=e.dx??0,a=e.dy??0,l=e.width??32,c=e.height??32,u=e.content??(0,vn.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return(0,vn.jsx)("foreignObject",{x:o+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:(0,vn.jsx)("div",{...zt(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const t=Jt(e,n,r);if(!t)return null;const{x:o,y:i}=t,s=o+(e.dx||0),a=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,vn.jsx)("text",{x:s,y:a,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?Nt.cloneElement(c,{key:"ann-text-"+n}):(0,vn.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,vn.jsx)("line",{x1:o,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Nt.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const t=e.category;if(null==t)return null;const o=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=r.scales?.o,s=r.scales?.x,a=r.scales?.y,l=o(i)?i:o(s)?s:o(a)?a:null;if(!l)return null;const c=l(t+"");if(null==c)return null;const u=l.bandwidth(),d=e.color||"var(--semiotic-primary, #4589ff)",h=e.opacity??.15,f=e.label;return(0,vn.jsxs)("g",(r.projection?"vertical"===r.projection:l===s)?{children:[(0,vn.jsx)("rect",{x:c,y:0,width:u,height:r.height||0,fill:d,fillOpacity:h}),f&&(0,vn.jsx)(un,{x:c+u/2,y:16,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[(0,vn.jsx)("rect",{x:0,y:c,width:r.width||0,height:u,fill:d,fillOpacity:h}),f&&(0,vn.jsx)(un,{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+n)}default:return null}var o,i,s}}(0,j),void 0,e)},[y,w,t,n,k,j]);return s||a||l||m||C&&C.length>0?(0,Kn.jsxs)("svg",{role:"img",width:r,height:o,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,Kn.jsx)("title",{children:"string"==typeof a?a:"XY Chart"}),(0,Kn.jsx)("desc",{children:"string"==typeof a?a+" — XY data visualization":"XY data visualization"}),(0,Kn.jsxs)("g",{transform:"translate("+i.left+","+i.top+")",children:[C,m]}),a&&"string"==typeof a?(0,Kn.jsx)("text",{x:r/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:a}):a?(0,Kn.jsx)("foreignObject",{x:0,y:0,width:r,height:i.top,children:a}):null,Qn({legend:l,totalWidth:r,totalHeight:o,margin:i,legendPosition:f,title:a,legendLayout:p,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h})]}):null}var er=l(require("react")),tr=(require("d3-shape"),require("react/jsx-runtime"));function nr(e,t="#4e79a7"){return fn(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}var rr="undefined"==typeof window||"undefined"==typeof document,or=require("react"),ir="undefined"!=typeof window?or.useLayoutEffect:or.useEffect,sr=()=>()=>{},ar=()=>!1,lr=()=>!0,cr=require("react"),ur=require("react/jsx-runtime");function dr({children:e,size:t,margin:n,overflowVisible:r=!1}){return e?(0,ur.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:r?"visible":void 0},children:(0,ur.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}var hr=require("react");function fr(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;if(!Object.is(e[r],t[r]))return!1}return!0}function pr(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 mr(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}var yr=l(require("react")),gr=l(require("react")),br=(require("react/jsx-runtime"),gr.createContext(null)),vr=require("react/jsx-runtime"),xr={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function wr({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return(0,vr.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:xr,children:t})}function kr(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e))n.startsWith("_")||null!=r&&""!==r&&("number"==typeof r?Number.isFinite(r)&&(t[n]=r):"string"==typeof r?t[n]=r:"boolean"==typeof r?t[n]=r+"":r instanceof Date&&(t[n]=r.toISOString().slice(0,10)));return t}function jr(e){return e&&"object"==typeof e?e:{}}function Sr(e){return jr(e.accessibility).tableFields??e.accessibleDatum??e.datum}var Mr=require("react/jsx-runtime");function Cr(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 r=[],o={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),r=i.indexOf(t);return(-1===n?999:n)-(-1===r?999:r)});for(const e of s)r.push(`${n[e]} ${o[e]||e}`);return`${t}, ${r.join(", ")}`}var Ar=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Rr="semiotic-accessible-data-table",Lr=Rr+" semiotic-accessible-data-table-hidden",Pr=Rr+" semiotic-accessible-data-table-visible",Ir={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"},Dr={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Tr={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)"},zr={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Or={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))"},Nr={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Er={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Br={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 _r({scene:e,chartType:t,tableId:n,chartTitle:r}){const[o,i]=yr.useState(!1),[s,a]=yr.useState(5),l=gr.useContext(br),c=l?.visible??!1,u=o||c,d=yr.useRef(null),h=r?"Data summary for "+r:n?`Data summary for ${t} ${n}`:"Data summary for "+t;yr.useEffect(()=>{u||a(5)},[u]);const f=yr.useCallback(e=>{e.target===e.currentTarget&&(o||c||i(!0))},[o,c]),p=yr.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return n?(0,Mr.jsx)("span",{id:n,tabIndex:-1,style:xr}):null;if(!u)return(0,Mr.jsx)("div",{id:n,className:Lr,tabIndex:-1,onFocus:f,style:xr,role:"region","aria-label":h,children:(0,Mr.jsxs)("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const m=function(e){const t=[];if(!Array.isArray(e))return t;const n=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const r of e)if(r&&"object"==typeof r&&null!==r.datum)try{switch(r.type){case"point":if(n)break;t.push({label:"Point",values:kr(Sr(r))});break;case"line":case"area":{const e=Sr(r),n=Array.isArray(e)?e:[],o="line"===r.type?"Line point":"Area point";for(const e of n)t.push({label:o,values:kr(e)});break}case"rect":{const e=Sr(r),n=null!=e&&"object"==typeof e?e:{},o=n.category??r.group??"",i=n.value??n.__aggregateValue??n.total,s=kr(n);null==s.category&&""!==o&&(s.category=o+""),null==s.value&&null!=i&&(s.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:s});break}case"heatcell":{const e=kr(Sr(r));null==e.value&&"number"==typeof r.value&&Number.isFinite(r.value)&&(e.value=r.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=Sr(r),n=kr(e);if(null==n.category){const t=jr(e),r=t.category??t.label;null!=r&&(n.category=r+"")}t.push({label:"Wedge",values:n});break}case"circle":t.push({label:"Node",values:kr(Sr(r))});break;case"arc":t.push({label:"Arc",values:kr(Sr(r))});break;case"candlestick":t.push({label:"Candlestick",values:kr(Sr(r))});break;case"geoarea":{const e=jr(Sr(r)),n=kr(e);if(null==n.name){const t=jr(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 r of t){const t=[],o=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[r];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&o.add(e+""))}if(t.length>0){let e=t[0],o=t[0],i=0;for(const n of t)e>n&&(e=n),n>o&&(o=n),i+=n;n.push({name:r,count:t.length,numeric:!0,min:e,max:o,mean:i/t.length})}else if(o.size>0){const e=Array.from(o);n.push({name:r,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}: ${Ar(e.min)} to ${Ar(e.max)}, mean ${Ar(e.mean)}.`);else{const t=e.uniqueValues,r=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${r}.`)}return n.join(" ")}(m.length,y),b=Math.min(s,m.length),v=m.slice(0,b),x=m.length-b,w=new Set;for(const e of v)for(const t of Object.keys(e.values))w.add(t);const k=Array.from(w);return(0,Mr.jsxs)("div",{ref:d,id:n,className:Pr,tabIndex:-1,onBlur:p,style:Ir,role:"region","aria-label":h,children:[(0,Mr.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:Tr,children:"×"}),(0,Mr.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Dr,children:g}),(0,Mr.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:zr,children:[(0,Mr.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:Er,children:x>0?`First ${b} of ${m.length} data points`:`All ${m.length} data points`}),(0,Mr.jsx)("thead",{children:(0,Mr.jsxs)("tr",{children:[(0,Mr.jsx)("th",{style:Or,children:"type"}),k.map(e=>(0,Mr.jsx)("th",{style:Or,children:e},e))]})}),(0,Mr.jsx)("tbody",{children:v.map((e,t)=>(0,Mr.jsxs)("tr",{children:[(0,Mr.jsx)("td",{style:Nr,children:e.label}),k.map(t=>{return(0,Mr.jsx)("td",{style:Nr,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":Ar(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),x>0&&(0,Mr.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:Br,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function Wr({summary:e}){return e?(0,Mr.jsx)("div",{role:"note",style:xr,children:e}):null}function Hr({tableId:e}){return(0,Mr.jsx)("a",{href:"#"+e,style:xr,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,xr)},children:"Skip to data table"})}var Fr=require("react");var $r=Object.freeze([]);function qr(e){if(!e)return $r;let t=!1;for(let n=0;e.length>n;n++){const r=e[n];if(null==r||"object"!=typeof r){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}var Gr=require("react/jsx-runtime"),Vr="var(--semiotic-focus, #005fcc)";function Ur({active:e,hoverPoint:t,margin:n,size:r,shape:o="circle",width:i,height:s,pathData:a}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==o&&"path"!==o||!a)if("rect"===o&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);u=(0,Gr.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Vr,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,Gr.jsx)("circle","wedge"===o?{cx:l,cy:c,r:12,fill:"none",stroke:Vr,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Vr,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,Gr.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:(0,Gr.jsx)("path",{d:a,fill:"none",stroke:Vr,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,Gr.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var Zr=l(require("react"));function Yr(e,t){return"touch"===t?Math.max(e,24):e}var Xr=["name","label","title"],Qr=["type","kind","category","group","class","status","role","shape"],Kr=["value","amount","total","count","weight","score"],Jr=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 eo(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}var to=require("react/jsx-runtime"),no={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 ro(e,t){return"function"==typeof t?t(e):e[t]}function oo(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function io(e={}){const{fields:t,title:n,format:r,style:o={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(n){const t=ro(e,n);s=oo(t,r)}if(t&&t.length>0)t.forEach(t=>{let n,o,i;"string"==typeof t?(n=t,o=t,i=r):(n=t.label,o=t.accessor||t.key||"",i=t.format||r);const s=ro(e,o);a.push({label:n,value:oo(s,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=oo(e[n],r);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=oo(e[t[0]],r))}}const l={...no,...o};return(0,to.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,to.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,to.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,to.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function so(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=Array.isArray(r=!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)?r[0]:r;var r;if(!n)return null;if(("node"===e?.nodeOrEdge&&"number"==typeof n?.x0&&"number"==typeof n?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof n?.sankeyWidth)&&n.data&&"object"==typeof n.data&&(n=n.data),!n)return null;const o=t(n);return null==o?null:(0,to.jsx)("div",{className:"semiotic-tooltip",style:no,children:o})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?io(e):io())}}var ao=require("react/jsx-runtime");function lo({x:e,y:t,containerWidth:n,containerHeight:r,margin:o,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=Zr.useRef(null),[u,d]=Zr.useState(null);Zr.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&d(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[s,n,r,l]);let h;h=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*r>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!Zr.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 r=n.style;if(r&&"object"==typeof r){if(null!=r.background&&""!==r.background&&"transparent"!==r.background)return!0;if(null!=r.backgroundColor&&""!==r.backgroundColor&&"transparent"!==r.backgroundColor)return!0}return!1}(i),p=f?null:no;return l?(0,ao.jsx)("div",{ref:c,className:f?s:(s+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:o.left+e,top:o.top+t,transform:h,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var co=require("d3-zoom"),uo=require("d3-selection"),ho=require("d3-shape");function fo(e){switch(e){case"monotoneX":return ho.curveMonotoneX;case"monotoneY":return ho.curveMonotoneY;case"cardinal":return ho.curveCardinal;case"catmullRom":return ho.curveCatmullRom;case"step":return ho.curveStep;case"stepBefore":return ho.curveStepBefore;case"stepAfter":return ho.curveStepAfter;case"basis":return ho.curveBasis;case"natural":return ho.curveNatural;default:return null}}function po(e,t,n){if(null==t)return n;if(fn(t)){const r=function(e,t){const n="undefined"!=typeof window&&window.devicePixelRatio||1,r=`${pn(e)}@${n}`,o=yn.get(r);if(void 0!==o)return o;const i=function(e={},t){const{background:n="transparent",stroke:r="#000",lineWidth:o=1.5,spacing:i=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(dn||(dn=document.createElement("canvas")),dn.width=e,dn.height=e,dn)}(a)}catch{return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=r,c.lineWidth=o,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}({background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t);return yn.set(r,i),i}(t,e);return r||t.background&&gt(e,t.background)||n}return"string"!=typeof t?t:gt(e,t)||n}function mo(e,t){if(null==t)return;const n=po(e,t,"");return""===n?void 0:n}function yo(e,t,n,r,o,i){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const a=e.createLinearGradient(n,r,o,i);for(const e of s)a.addColorStop(e.offset,e.color);return a}function go(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function bo(e,t,n=.6){if(!go(t))return;const r=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,o=t.cx??t.x??0,i=t.cy??t.y??0;e.beginPath(),e.arc(o,i,r,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 vo(e,t,n,r=.35){go(t)&&(e.globalAlpha=t._pulseIntensity*r,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}var xo=require("d3-shape");function wo(e,t,n){let r=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(r=n.color):e>n.value&&(r=n.color);return r}function ko(e,t,n,r,o,i){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],r=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+r*r))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=r,e.lineCap=i;for(let n=0;t.length-1>n;n++){const r=(s[n]+s[n+1])/2;let i=o;l>r&&(i*=r/l),l>a-r&&(i*=(a-r)/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 jo(e,t,n,r,o){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=Be(i,t.size);if(0>=s.scale)return;const a=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=a)return;const l=t=>{const n=po(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,r),t.rotation&&e.rotate(t.rotation),e.translate(s.offsetX,s.offsetY),e.scale(s.scale,s.scale),e.globalAlpha=o*a*(t.style.fillOpacity??1);const u=$e(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&Ge(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),Ge(e,i,c,t.accent,void 0,l),e.restore()}function So(e,t,n,r){const o=e.getContext("2d");if(!o)return null;const i=Math.round(t[0]*r),s=Math.round(t[1]*r),a=i/t[0],l=s/t[1],c=t[0]+"px",u=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==u&&(e.style.height=u),e.width===i&&e.height===s||(e.width=i,e.height=s),o.setTransform(a,0,0,l,0,0),o.translate(n.left,n.top),o}function Mo(){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 Co([e,t,n]){const r=1<<n;return[e-Math.floor(e/r)*r,t,n]}function Ao(e,t,n,r,o){return"function"==typeof e?e(t,n,r,o):e.replace("{z}",t+"").replace("{x}",n+"").replace("{y}",r+"").replace("{r}",o>1?"@2x":"")}var Ro=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,r]of this.cache)t>r.lastUsed&&(t=r.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 Lo=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,t=Math.random){for(let n=0;this.capacity>n;n++){const r=this.particles[n];if(!r.active)return r.active=!0,r.t=0,r.offset=.6*(t()-.5),r.lineIndex=e,r.x=0,r.y=0,r}return null}step(e,t,n,r){for(let o=0;this.capacity>o;o++){const i=this.particles[o];if(!i.active)continue;const s=n[i.lineIndex];if(!s||2>s.length){i.active=!1;continue}if(i.t+=e*t,i.t>=1){i.active=!1;continue}const a=Po(s),l=Io(s,i.t*a),c=(r[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 Po(e){let t=0;for(let n=1;e.length>n;n++){const r=e[n][0]-e[n-1][0],o=e[n][1]-e[n-1][1];t+=Math.sqrt(r*r+o*o)}return t}function Io(e,t){let n=0;for(let r=1;e.length>r;r++){const o=e[r][0]-e[r-1][0],i=e[r][1]-e[r-1][1],s=Math.sqrt(o*o+i*i);if(n+s>=t||r===e.length-1){const a=s>0?(t-n)/s:0,l=s>.001?s:1;return{x:e[r-1][0]+o*a,y:e[r-1][1]+i*a,nx:-i/l,ny:o/l}}n+=s}const r=e[e.length-1];return{x:r[0],y:r[1],nx:0,ny:0}}var Do=l(require("react"));function To(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:Do.createElement(Do.Fragment,null,...t)}var zo=l(require("react")),Oo=require("react/jsx-runtime"),No=zo.createContext(null);function Eo({value:e,children:t}){return(0,Oo.jsx)(No.Provider,{value:e,children:t})}function Bo(e,t){return null!=e?(0,Oo.jsx)(Eo,{value:t,children:e}):e}var _o=new Set;function Wo(e,t){const n="function"==typeof e?e(t.datum??null,t):e;return(r=n)&&"object"==typeof r&&"string"==typeof r.id&&"function"==typeof r.cacheKey&&"function"==typeof r.drawCanvas&&"function"==typeof r.renderStaticSVG?n:void 0;var r}function Ho(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${e}:${t}`;_o.has(n)||(_o.add(n),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}function Fo(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,r=qe(e.glyph,e.size);t.push({pointId:e.pointId,x:e.x+r.centerDx,y:e.y+r.centerDy,r:r.radius})}return t}require("react/jsx-runtime");var $o=require("react/jsx-runtime");function qo({data:e}){if(!e)return null;if(e.properties)return(0,$o.jsx)("div",{className:"semiotic-tooltip",style:no,children:(0,$o.jsx)("div",{style:{fontWeight:600},children:e.properties.name||e.properties.NAME||e.properties.id||"Feature"})});const t=null!=e.data?e.data:e;if(!t||"object"!=typeof t)return null;const n=function(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const n=t.maxEntries??6,r=!1!==t.skipPositional,o=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(r&&Jr.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&o.push({key:t,lower:t.toLowerCase(),value:n})}if(0===o.length)return{entries:[]};let i=o.findIndex(e=>Xr.includes(e.lower));const s=i>=0;0>i&&(i=o.findIndex(e=>"id"===e.lower)),0>i&&(i=o.findIndex(e=>"string"==typeof e.value));const a=0>i?void 0:o[i];let l=o.filter((e,t)=>t!==i);s&&(l=l.filter(e=>"id"!==e.lower));const c=eo(l,Qr),u=eo(l,Kr),d=new Set(Qr),h=new Set(Kr),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&&(d.has(e.lower)||h.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:a?.key,title:a?.value,entries:f}}(t),r=null!=n.title?n.title+"":null;return null==r&&0===n.entries.length?null:(0,$o.jsxs)("div",{className:"semiotic-tooltip",style:no,children:[null!=r&&(0,$o.jsx)("div",{style:{fontWeight:600,marginBottom:n.entries.length?2:0},children:r}),n.entries.map(e=>{return(0,$o.jsxs)("div",{children:[(0,$o.jsxs)("span",{style:{opacity:.7},children:[e.key,": "]}),(0,$o.jsx)("span",{style:{fontWeight:600},children:(t=e.value,null==t?"–":"number"==typeof t?Math.abs(t)>9999?t.toLocaleString():t+"":t instanceof Date?t.toLocaleDateString():t+"")})]},e.key);var t})]})}qo.ownsChrome=!0;var Go={top:10,right:10,bottom:10,left:10},Vo=null;function Uo(){if(null!==Vo)return Vo;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 Vo=e||t||n}function Zo(){return Uo()?12:30}var Yo={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 Xo(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function Qo(e){return e?e.getContext("2d"):null}function Ko(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:r,y:o,timestamp:l,chartType:i,chartId:s}),"focus"===a?.type&&t({type:"focus",datum:n,inputType:"touch"===a.inputType?"pointer":a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"hover-end",timestamp:l,chartType:i,chartId:s}))}function Jo(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:r,y:o,timestamp:l,chartType:i,chartId:s}),"activate"===a?.type&&t({type:"activate",datum:n,inputType:a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"click-end",timestamp:l,chartType:i,chartId:s}))}var ei=require("react"),ti=require("react");function ni(e){const t=e.datum;return{...t||{},...t?.properties||{},data:t,properties:t?.properties,x:e.x,y:e.y,__semioticHoverData:!0}}var ri=require("react/jsx-runtime"),oi=(0,u.memo)((0,u.forwardRef)(function(e,t){const{projection:n,projectionExtent:r,fitPadding:o,projectionTransform:i,areas:s,points:a,lines:l,customLayout:c,layoutConfig:d,layoutSelection:h,onLayoutError:f,xAccessor:p,yAccessor:m,lineDataAccessor:y,pointIdAccessor:g,lineIdAccessor:b,lineType:v="geo",flowStyle:x="basic",graticule:w,zoomable:k,zoomExtent:j,onZoom:S,dragRotate:M,showParticles:C,particleStyle:A,tileURL:R,tileAttribution:L,tileCacheSize:P,size:I,width:D,height:T,responsiveWidth:z,responsiveHeight:O,margin:N,className:E,background:B,windowSize:_=500,renderMode:W,areaStyle:H,pointStyle:F,lineStyle:$,colorScheme:q,enableHover:G=!0,hoverAnnotation:V,tooltipContent:U,allowTooltipOverflow:Z=!1,customClickBehavior:Y,customHoverBehavior:X,onObservation:Q,annotationObservationCallback:K,chartId:J,annotations:ee,onAnnotationActivate:te,autoPlaceAnnotations:ne,decay:re,pulse:oe,transition:ie,animate:se,staleness:ae,frameScheduler:le,clock:ce,random:ue,seed:de,paused:he=!1,suspendWhenHidden:fe=!0,backgroundGraphics:pe,foregroundGraphics:me,title:ye,legend:ge,legendPosition:be,legendLayout:ve,legendHoverBehavior:xe,legendClickBehavior:we,legendHighlightedCategory:ke,legendIsolatedCategories:je,legendCategoryAccessor:Se,onCategoriesChange:Me,showAxes:Re,accessibleTable:Le=!0,description:Pe,summary:Ie}=e,{customHoverBehavior:De,customClickBehavior:Oe,hasClickBehavior:Ne}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:r,chartType:o}){return{customHoverBehavior:(0,ei.useCallback)((t,i)=>{e?.(t,i),Ko({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:o,chartId:r,context:i})},[r,o,e,n]),customClickBehavior:(0,ei.useCallback)((e,i)=>{t?.(e,i),Jo({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:o,chartId:r,context:i})},[r,o,t,n]),hasClickBehavior:!(!t&&!n)}}({customHoverBehavior:X,customClickBehavior:Y,onObservation:Q,chartId:J,chartType:"StreamGeoFrame"}),Ee=I||[D||600,T||400],_e=(0,u.useRef)(!0),He=St({sizeProp:Ee,responsiveWidth:z,responsiveHeight:O,userMargin:N,marginDefault:Go,title:ye,legend:ge,legendPosition:be,foregroundGraphics:me,backgroundGraphics:pe,animate:se,transitionProp:ie,frameScheduler:le,clock:ce,random:ue,seed:de,paused:he,suspendWhenHidden:fe,themeDirtyRef:_e}),{reducedMotionRef:Fe,responsiveRef:Ge,size:Ue,margin:Ze,adjustedWidth:Ye,adjustedHeight:Xe,resolvedForeground:Qe,resolvedBackground:Ke,transition:Je,introEnabled:tt,tableId:nt,frameRuntime:rt,rafRef:ot,renderFnRef:it,scheduleRender:st,currentTheme:at}=He,lt=function(){const[e,t]=(0,or.useState)(!1);return ir(()=>{t(!0)},[]),e}(),ct=function(){const e=(0,or.useSyncExternalStore)(sr,ar,lr);return(0,or.useRef)(e).current}(),ut=(0,u.useMemo)(()=>Array.isArray(s)?qr(s):s,[s]),dt=(0,u.useMemo)(()=>qr(a),[a]),ht=(0,u.useMemo)(()=>qr(l),[l]),ft=(0,u.useMemo)(()=>null!=M?M:"orthographic"===Xo(n),[M,n]),pt=function(e){const t=(0,hr.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return pr(e,t);if(!mr(e)||!mr(t))return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;const n=e[r],o=t[r];if(!Object.is(n,o))if(Array.isArray(n)&&Array.isArray(o)){if(!pr(n,o))return!1}else{if(!mr(n)||!mr(o))return!1;if(!fr(n,o))return!1}}return!0}(t.current,e)||(t.current=e),t.current}((0,u.useMemo)(()=>({projection:n,projectionExtent:r,fitPadding:o,xAccessor:p,yAccessor:m,lineDataAccessor:y,lineType:v,flowStyle:x,areaStyle:H,pointStyle:F,lineStyle:$,colorScheme:q,themeSemantic:et(at),themeSequential:at?.colors?.sequential,themeDiverging:at?.colors?.diverging,themeCategorical:at?.colors?.categorical,graticule:w,projectionTransform:i,windowSize:_,clock:rt.now,decay:re,pulse:oe,transition:Je,introAnimation:tt,annotations:ee,pointIdAccessor:g,lineIdAccessor:b,customLayout:c,layoutConfig:d,onLayoutError:f,layoutMargin:Ze}),[n,r,o,p,m,y,v,x,H,F,$,q,at,w,i,_,rt.now,re,oe,Je,tt,ee,g,b,c,d,f,Ze])),mt=(0,u.useRef)(null);mt.current||(mt.current=new Ce(pt));const yt=(0,u.useRef)(null),bt=(0,u.useRef)(null),vt=(0,u.useRef)(null);R&&!vt.current&&(vt.current=new Ro(P||256));const xt=(0,u.useRef)(ee),wt=(0,u.useRef)(null),kt=(0,u.useRef)(co.zoomIdentity),jt=(0,u.useRef)(!1),Lt=(0,u.useRef)(null),It=(0,u.useCallback)(e=>{Lt.current=e,Ge&&"object"==typeof Ge&&(Ge.current=e)},[Ge]),Dt=(0,u.useRef)(null),Tt=(0,u.useRef)(null),zt=(0,u.useRef)(null),Ot=(0,u.useRef)(0);if(C&&!zt.current){const e=A?.maxPerLine??Zo();zt.current=new Lo(50*e)}const Nt=(0,u.useRef)(null),Et=(0,u.useRef)(null),Bt=(0,u.useRef)(!1),_t=(0,u.useRef)(!1),Wt=(0,Ae.useRef)(new Te("StreamGeoFrame")),Ht=(0,u.useRef)(void 0),[Ft,$t]=(0,u.useState)(null),[,qt]=(0,u.useState)(0),Gt=(0,u.useRef)(0),[Vt,Ut]=(0,u.useState)(!1),Zt=function(e,t,n,r){const o=(0,Fr.useRef)({accessor:t,onChange:n,readData:r}),i=(0,Fr.useRef)([]);return o.current={accessor:t,onChange:n,readData:r},(0,Fr.useCallback)(()=>{const{accessor:t,onChange:n,readData:r}=o.current;if(!n||!t)return;const s=function(e,t){if(!t)return[];const n=new Set,r=[];for(const o of e){if(!o||"object"!=typeof o)continue;const e="function"==typeof t?t(o):o[t];if(null==e)continue;const i=e+"";n.has(i)||(n.add(i),r.push(i))}return r}(e.current?r(e.current):[],t);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(s,i.current)||(i.current=s,n(s))},[e])}(mt,Se,Me,e=>e.getPoints());!function(e,t,n,r){(0,Mt.useEffect)(()=>{e.current?.updateConfig(t),n.current=!0,r()},[t,r,e,n])}(mt,pt,_e,st),function(e,t,n,r){const o=(0,Mt.useRef)(null);(0,Mt.useEffect)(()=>{const i=e.current;if(!i)return;const s=t??null;o.current!==s&&(o.current=s,i.setLayoutSelection(s),i.hasCustomRestyle?i.restyleScene(s):n.current=!0,r())},[t,r,e,n])}(mt,h,_e,st),(0,u.useEffect)(()=>{const e=mt.current;e&&(ut&&e.setAreas(ut),a&&e.setPoints(dt),l&&e.setLines(ht),_e.current=!0,st())},[ut,a,dt,l,ht,st]);const Yt=(0,u.useCallback)(e=>{null!=e&&"object"==typeof e&&(mt.current?.pushPoint(e),_e.current=!0,st())},[st]),Xt=(0,u.useCallback)(e=>{const t=qr(e);0!==t.length&&(mt.current?.pushMany(t),_e.current=!0,st())},[st]),Qt=(0,u.useCallback)(e=>{null!=e&&"object"==typeof e&&(mt.current?.pushLine(e),_e.current=!0,st())},[st]),Kt=(0,u.useCallback)(e=>{const t=qr(e);0!==t.length&&(mt.current?.pushManyLines(t),_e.current=!0,st())},[st]),Jt=(0,u.useCallback)(()=>{mt.current?.clear(),_e.current=!0,st()},[st]);(0,u.useImperativeHandle)(t,()=>({push:Yt,pushMany:Xt,removePoint:e=>{const t=mt.current?.removePoint(e)??[];return t.length>0&&(_e.current=!0,st()),t},pushLine:Qt,pushManyLines:Kt,removeLine:e=>{const t=mt.current?.removeLine(e)??[];return t.length>0&&(_e.current=!0,st()),t},getLines:()=>mt.current?.getLines()??[],clear:Jt,getProjection:()=>mt.current?.scales?.projection??null,getGeoPath:()=>mt.current?.scales?.geoPath??null,getCartogramLayout:()=>mt.current?.cartogramLayout??null,getCustomLayout:()=>mt.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>mt.current?.lastCustomLayoutFailure??null,getZoom:()=>kt.current.k,resetZoom:()=>{const e=Lt.current;e&&wt.current&&(0,uo.select)(e).call(wt.current.transform,co.zoomIdentity)},getData:()=>mt.current?.getPoints()??[]}),[Yt,Xt,Qt,Kt,Jt,st]);const{hoverHandlerRef:en,onPointerMove:tn,onPointerLeave:nn}=He,{canvasRef:rn,interactionCanvasRef:on}=function(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:r,manageFrameRuntime:o,scheduleRender:i}=e,s=(0,cr.useRef)(null),a=(0,cr.useRef)(null),l=(0,cr.useRef)(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:r,dirtyRef:o,renderFnRef:i,cancelRender:s,cleanup:a}=e;ir(()=>{t&&n&&r.current?.cancelIntroAnimation?.(),o.current=!0,s?.(),i.current()},[t,n]);const l=(0,or.useRef)(a);l.current=a,(0,or.useEffect)(()=>()=>l.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),(0,cr.useEffect)(()=>{if(!1!==o)return r.subscribe(()=>{r.isActive?(n.current=!0,i()):t()})},[t,n,r,o,i]),(0,cr.useEffect)(()=>{!l.current&&(l.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:s,interactionCanvasRef:a}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}(He,{hydrated:lt,wasHydratingFromSSR:ct,storeRef:mt,dirtyRef:_e,cleanup:()=>vt.current?.clear(),canvasPaintDependencies:[Ye,Xe,B,pe,W,st]});(0,u.useEffect)(()=>{en.current=e=>{if(!G)return;const t=mt.current;if(!t||!t.scene.length)return;const n=rn.current;if(!n)return;const r=n.getBoundingClientRect(),o=e.clientX-r.left-Ze.left,i=e.clientY-r.top-Ze.top;if(0>o||o>Ye||0>i||i>Xe)return Nt.current=null,Et.current=null,$t(null),De?.(null),void st();bt.current||(bt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const s=Qo(bt.current);if(!s)return;const a=Yr(30,e.pointerType),l=Yr(6,e.pointerType),c=Ve(t.scene,o,i,a,s,t.quadtree,t.maxPointRadius,l);if(c){const e=c.node,t=e.datum,n=Array.isArray(t)?null:t?.properties?t:t?.data||t;let r,s;"point"===e.type?(r=e.x,s=e.y):"geoarea"===e.type?(r=e.centroid[0],s=e.centroid[1]):(r=o,s=i);const a={...n,...n?.properties||{},data:n,properties:n?.properties,__semioticHoverData:!0,x:r,y:s};Nt.current=a,Et.current=e,$t(a),De?.(a),st()}else Nt.current&&(Nt.current=null,Et.current=null,$t(null),De?.(null),st())}},[G,Ye,Xe,Ze,De,st,en,rn]),He.hoverLeaveRef.current=()=>{Nt.current=null,Et.current=null,$t(null),De?.(null),st()};const sn=(0,u.useCallback)(e=>{if((t=e.target)instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]"))return;var t;if(!Oe)return;const n=mt.current;if(!n||!n.scene.length)return void Oe(null);const r=e.currentTarget.getBoundingClientRect(),o=e.clientX-r.left-Ze.left,i=e.clientY-r.top-Ze.top;if(0>o||o>Ye||0>i||i>Xe)return void Oe(null);bt.current||(bt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const s=Qo(bt.current);if(!s)return void Oe(null);const a=Yr(30,Ht.current),l=Yr(6,Ht.current),c=Ve(n.scene,o,i,a,s,n.quadtree,n.maxPointRadius,l);if(c){const e=c.node.datum,t=Array.isArray(e)?null:e?.properties?e:e?.data||e,n=t?.properties?{...t,...t.properties}:t;return void Oe({...n,data:t,properties:t?.properties,__semioticHoverData:!0,x:o,y:i,time:o,value:i},{type:"activate",inputType:(u=Ht.current,"touch"===u?"touch":"pointer")})}var u;Oe(null)},[Xe,Ye,Oe,Ze]),{kbFocusIndexRef:an,focusedNavPointRef:ln,onKeyDown:cn}=function({storeRef:e,hoverRef:t,hoveredNodeRef:n,setHoverPoint:r,customHoverBehavior:o,customClickBehavior:i,scheduleRender:s}){const a=(0,ti.useRef)(-1),l=(0,ti.useRef)(null),c=(0,ti.useCallback)(c=>{if(function(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}(c))return;const u=e.current;if(!u)return;const d=()=>{a.current=-1,l.current=null,t.current=null,n&&(n.current=null),r(null),o(null),s()};if(0===u.scene.length)return void(0>a.current||d());const h=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=qe(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}(u.scene);if(0===h.length)return void(0>a.current||d());let f=a.current;if(h.length>f||(d(),f=-1),("Enter"===c.key||" "===c.key)&&f>=0)return c.preventDefault(),void i(ni(h[f]),{type:"activate",inputType:"keyboard"});const p=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}}(c.key,0>f?-1:f,h.length);if(null===p)return;if(c.preventDefault(),0>p)return void d();const m=0>f?0:p;a.current=m;const y=h[m];l.current=y;const g=ni(y);t.current=g,r(g),o(g,{type:"focus",inputType:"keyboard"}),s()},[i,o,t,n,s,r,e]);return{kbFocusIndexRef:a,focusedNavPointRef:l,onKeyDown:c}}({storeRef:mt,hoverRef:Nt,hoveredNodeRef:Et,setHoverPoint:$t,customHoverBehavior:De,customClickBehavior:Oe,scheduleRender:st}),un=(0,u.useCallback)(e=>{Ht.current=e.pointerType,an.current=-1,ln.current=null,tn(e)},[ln,an,tn]),dn=(0,u.useCallback)(e=>{Ht.current=e.pointerType},[]);it.current=()=>{if(ot.current=null,!rt.isActive)return;const e=rn.current,t=mt.current;if(!e||!t)return;const n=rt.now();let r=!1;const o=Tt.current;let i=!1;o&&(Tt.current=null,t.applyRotation(o,{width:Ye,height:Xe}),i=!0);const s=t.advanceTransition(Fe.current?n+1e6:n),a=!Fe.current&&s,l=Wt.current.beforeCompute(t.getLastUpdateResult(),a);let c=!1;if(_e.current&&!s){const n={width:Ye,height:Xe},r=ft?t.getRotation():null;t.computeScene(n);const o=kt.current,i=1!==o.k||0!==o.x||0!==o.y;ft&&r?i?(t.setRotation(r),t.applyZoomScale(o.k,n)):t.applyRotation(r,n):i&&t.applyZoomTransform(o,n),_e.current=!1,c=!0,e.setAttribute("aria-label",Cr(t.scene,"Geographic chart")),Zt()}Wt.current.afterCompute(l,c,!1);const u=Mo(),d=C&&!Fe.current&&!!zt.current,h=t.consumeStylePaintPending(),f=function(e,t,n,r){const o=r.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,s=!i&&e.hasActivePulsesAt(t),a=!(n||i||!s&&!o)&&e.refreshPulse(t);return r.current=s,{changed:a,pending:s}}(t,n,c,_t),p=!!((m={dirtyOrRebuilt:c,transitioning:a,continuous:d,liveEncoding:f.changed,forced:i||h}).dirtyOrRebuilt||m.transitioning||m.animationTicked||m.continuous||m.liveEncoding||m.forced);var m;if(R&&vt.current){const e=yt.current;if(e&&t.scales?.projection){const n=So(e,Ue,Ze,u);if(n){n.clearRect(-Ze.left,-Ze.top,Ue[0],Ue[1]),n.save(),n.beginPath(),n.rect(0,0,Ye,Xe),n.clip();const e=function(e,t){const{tileURL:n,projection:r,width:o,height:i,tileCache:s,onTileLoad:a}=t,l=r.scale(),c=r.translate(),u=function(e){const{size:t,scale:n,translate:r,clampX:o=!0,clampY:i=!0}=e,s=Math.max(Math.log(n)/Math.LN2-8,0),a=Math.round(s),l=1<<a,c=Math.pow(2,s-a+8),u=r[0]-n/2,d=r[1]-n/2,h=Math.max(o?0:-1/0,Math.floor((0-u)/c)),f=Math.min(o?l:1/0,Math.ceil((t[0]-u)/c)),p=Math.max(i?0:-1/0,Math.floor((0-d)/c)),m=Math.min(i?l:1/0,Math.ceil((t[1]-d)/c)),y=[];for(let e=p;m>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:[o,i],scale:2*l*Math.PI,translate:c}),d=Mo();let h=!0;for(const t of u.tiles){const[r,o,i]=Co(t),l=`${i}/${r}/${o}`;let c=s.get(l);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:l,lastUsed:performance.now()};s.set(l,t),e.onload=()=>{t.loaded=!0,a?.()},e.onerror=()=>{t.loaded=!0},e.src=Ao(n,i,r,o,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}(n,{tileURL:R,projection:t.scales.projection,width:Ye,height:Xe,tileCache:vt.current,onTileLoad:()=>st()});n.restore(),e||(r=!0)}}}if(p){const o=So(e,Ue,Ze,u);if(!o)return;o.clearRect(-Ze.left,-Ze.top,Ue[0],Ue[1]),R||function(e,t){const{background:n,hasBackgroundGraphics:r=!1,themeBackground:o="",x:i=0,y:s=0,width:a,height:l}=t;if("transparent"===n)return!1;if(r)return!1;const c=n||(o&&"transparent"!==o?o:"")||null;if(!c)return!1;const u=gt(e,c);u&&(e.fillStyle=u,e.fillRect(i,s,a,l))}(o,{background:B,hasBackgroundGraphics:!!pe,width:Ye,height:Xe}),o.save(),o.beginPath(),o.rect(0,0,Ye,Xe),o.clip();const i=t.scene,s={width:Ye,height:Xe};if(function(e){const{context:t,nodes:n,renderMode:r,pixelRatio:o,paintBuiltIn:i}=e;if(!r||"sketchy"===r)return void i(n);let s=[];const a=()=>{s.length&&(i(s),s=[])};for(const e of n){const n=Wo(r,e);if(!n){s.push(e);continue}let l;a(),t.save();try{l=n.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:o})}finally{t.restore()}l||(Ho(n.id,e.type??"unknown"),i([e]))}a()}({context:o,nodes:i,renderMode:W,pixelRatio:u,paintBuiltIn:e=>{!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,r=mo(e,t.style.fill)||"#e0e0e0";if("none"!==r&&(e.fillStyle=r,e.globalAlpha=(t._decayOpacity??1)*(t.style.fillOpacity??1),e.fill(n)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=gt(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)}vo(e,t,n),e.globalAlpha=1,e.setLineDash([])}}(o,e),((e,t,n,r)=>{const o=t.filter(e=>"line"===e.type);for(const t of o){if(2>t.path.length)continue;const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,r.width*n,r.height),e.clip());const o=t.style.stroke||"#007bff",i=gt(e,o)||o,s=t.style.strokeWidth||2,a=t.colorThresholds,l=t.rawValues;if(e.setLineDash(t.style.strokeDasharray?t.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),e.lineWidth=s,e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade){ko(e,t.path,i,s,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=fo(t.curve),u=a&&a.length>0&&l&&l.length===t.path.length,d=t._decayOpacities;if(d&&d.length===t.path.length&&!u){e.strokeStyle=i;const n=t.style.opacity??1;for(let r=0;t.path.length-1>r;r++)e.globalAlpha=.5*(d[r]+d[r+1])*n,e.beginPath(),e.moveTo(t.path[r][0],t.path[r][1]),e.lineTo(t.path[r+1][0],t.path[r+1][1]),e.stroke()}else if(u){let n=function(t,n,r){e.beginPath(),e.strokeStyle=t,e.moveTo(n,r),d=!0},r=function(){d&&(e.stroke(),d=!1)},o=null,s=null,c=null,u=null,d=!1;for(let d=0;t.path.length>d;d++){const[h,f]=t.path[d],p=l[d],m=wo(p,a,i);if(null!==o&&null!==u&&null!==c){if(m===u)e.lineTo(h,f);else{const t=[];for(const e of a){const n=e.value;(c>n||n>p)&&(n>c||p>n)||c===n||p===n||t.push({t:(n-c)/(p-c)})}t.sort((e,t)=>e.t-t.t);for(const l of t){const t=o+(h-o)*l.t,u=s+(f-s)*l.t,d=wo(c+(p-c)*Math.min(l.t+1e-4,1),a,i);e.lineTo(t,u),r(),n(d,t,u)}e.lineTo(h,f)}o=h,s=f,c=p,u=m}else n(m,h,f),o=h,s=f,c=p,u=m}r()}else{e.beginPath();const n=t.strokeGradient&&t.path.length>=2?yo(e,t.strokeGradient,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=n||i,c)(0,xo.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,r]=t.path[0];e.moveTo(n,r);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=po(e,t.style.fill,t.style.fill),c&&!u)(0,xo.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,r]=t.path[0];e.moveTo(n,r);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],r.height),e.lineTo(n,r.height),e.closePath(),e.fill()}void 0!==n&&1>n&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(o,e,0,s),((e,t)=>{const n=t.filter(e=>"point"===e.type);if(0!==n.length){e.save();try{const t=e.globalAlpha;for(const r of n)e.beginPath(),e.arc(r.x,r.y,r.r,0,2*Math.PI),e.globalAlpha=t*(r.style.opacity??r.style.fillOpacity??1),e.fillStyle=po(e,r.style.fill,"#4e79a7"),e.fill(),r.style.stroke&&(e.strokeStyle=po(e,r.style.stroke,r.style.stroke),e.lineWidth=r.style.strokeWidth||1,e.stroke()),bo(e,r)}finally{e.restore()}}})(o,e),((e,t)=>{const n=e.globalAlpha;for(const r of t)"glyph"===r.type&&jo(e,r,r.x,r.y,n);e.globalAlpha=n})(o,e)}}),d&&zt.current){const e=zt.current,t=i.filter(e=>"line"===e.type);if(t.length>0){const i=A||{},s=.3*(i.speedMultiplier??1),a=i.maxPerLine??Zo(),l=i.spawnRate??(Uo()?.06:.15),c=i.radius??2,u=i.opacity??.7,d=n/1e3,h=Ot.current>0?Math.min(d-Ot.current,.1):.016;Ot.current=d;const f=t.map(e=>e.path),p=t.map(e=>e.style.strokeWidth||2);for(let n=0;t.length>n;n++)rt.random()<l&&e.countForLine(n)<a&&e.spawn(n,rt.random);e.step(h,s,f,p),o.globalAlpha=u;for(let n=0;e.particles.length>n;n++){const r=e.particles[n];if(!r.active)continue;const s=t[r.lineIndex],a="function"==typeof i.color?i.color(s?.datum??{}):"source"!==i.color&&i.color?i.color:s?.style.stroke||"#fff";o.beginPath(),o.arc(r.x,r.y,c,0,2*Math.PI),o.fillStyle=a,o.fill()}o.globalAlpha=1,r=!0}}o.restore()}const y=Et.current,g=!(!y||"geoarea"!==y.type&&"point"!==y.type),b=g||Bt.current;const v=on.current;if(v&&b){const e=So(v,Ue,Ze,u);if(e){if(e.clearRect(-Ze.left,-Ze.top,Ue[0],Ue[1]),y&&"geoarea"===y.type){const t=new Path2D(y.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(y&&"point"===y.type){const t=y,n="object"==typeof V?V:void 0,r=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}(y);e.beginPath(),e.arc(t.x,t.y,t.r+3,0,2*Math.PI),r?(e.save(),e.globalAlpha=.4,e.fillStyle=r,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=r||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}Bt.current=g}const x=ee!==xt.current;x&&(xt.current=ee),(c||x||a&&ee&&ee.length>0)&&(c||x||n-Gt.current>=33)&&(qt(e=>e+1),Gt.current=n),(a||null!=t.activeTransition||f.pending||r)&&st()},function(e,t,n,r,o,i){const s=(0,Ct.useRef)("fresh");(0,Ct.useEffect)(()=>{if(!e)return;const a=setInterval(()=>{const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=function(e,t){if(!e||0>=t)return Rt;const n=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={}){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:{...At,...e.opacities??{}}[o],band:o,isStale:"fresh"!==o}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:Rt}(e,l-a.lastIngestTime);c.band===s.current&&c.isStale===o||(s.current=c.band,c.isStale!==o&&i(c.isStale),n.current=!0,r())},1e3);return()=>clearInterval(a)},[e,o,r,t,i,n])}(ae,mt,_e,st,Vt,Ut),(0,u.useEffect)(()=>{if("production"!==process.env.NODE_ENV&&R){const e=Xo(n);e&&"mercator"!==e&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${e}". Raster tiles use Web Mercator and will not align with other projections.`)}},[R,n]),(0,u.useEffect)(()=>{const e=Lt.current;if(!k||!e)return wt.current&&e&&((0,uo.select)(e).on(".zoom",null),wt.current=null),void(e&&(0,uo.select)(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=j||[1,8],r={width:Ye,height:Xe};if(ft){let o=kt.current.k;const i=e=>{o=Math.max(t,Math.min(n,e)),kt.current=co.zoomIdentity.scale(o);const i=mt.current;i&&(i.applyZoomScale(o,r),_e.current=!1,st(),i.scales?.projection&&S?.({projection:i.scales.projection,zoom:i.currentZoom}))};wt.current={scaleBy:(e,t)=>i(o*t),transform:(e,t)=>i(t?.k??1)};const s=e=>{e.preventDefault(),i(o*(0>e.deltaY?1.1:1/1.1))},a=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),i(1.5*o))};e.addEventListener("wheel",s,{passive:!1}),e.addEventListener("dblclick",a);const l=.4,c=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const r=mt.current;if(!r)return;const o=r.getRotation();Dt.current={x:t.clientX,y:t.clientY,rotation:[...o]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{const t=Dt.current;t&&(Tt.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]],st())},d=t=>{if(!Dt.current)return;Dt.current=null,e.releasePointerCapture(t.pointerId);const n=Tt.current;if(n){Tt.current=null;const e=mt.current;e&&(e.applyRotation(n,r),st())}const o=mt.current;o?.scales?.projection&&S?.({projection:o.scales.projection,zoom:o.currentZoom})};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",u),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("wheel",s),e.removeEventListener("dblclick",a),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",d),wt.current=null}}const o=(0,co.zoom)().scaleExtent([t,n]).extent([[0,0],[Ue[0],Ue[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;kt.current=t,jt.current=!0;const n=mt.current;n&&(n.applyZoomTransform(t,r),_e.current=!1,st())}).on("end",e=>{kt.current=e.transform,jt.current=!1;const t=mt.current;t?.scales?.projection&&S?.({projection:t.scales.projection,zoom:t.currentZoom})});return wt.current=o,(0,uo.select)(e).call(o),()=>{(0,uo.select)(e).on(".zoom",null)}},[k,j,ft,Ue,Ye,Xe,Ze,S,st]);const hn=G&&!1!==V,pn=hn&&Ft?U?U(Ft):(0,ri.jsx)(qo,{data:Ft}):null,mn=pn?(0,ri.jsx)(lo,{x:Ft.x,y:Ft.y,containerWidth:Ye,containerHeight:Xe,margin:Ze,className:"stream-frame-tooltip",zIndex:10,children:pn}):null;if(rr||!lt&&ct){const e=mt.current;e&&(ut||a||l)&&(ut&&e.setAreas(ut),a&&e.setPoints(dt),l&&e.setLines(ht),e.computeScene({width:Ye,height:Xe}));const t=e?.scene??[];return(0,ri.jsxs)("div",{ref:It,className:"stream-geo-frame"+(E?" "+E:""),role:"img","aria-label":Pe||("string"==typeof ye?ye:"Geographic chart"),style:{position:"relative",width:z?"100%":Ue[0],height:O?"100%":Ue[1]},children:[(0,ri.jsx)(Wr,{summary:Ie}),(0,ri.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ue[0],height:Ue[1],style:{position:"absolute",left:0,top:0},children:[(0,ri.jsx)("g",{transform:`translate(${Ze.left},${Ze.top})`,children:Ke}),(0,ri.jsxs)("g",{transform:`translate(${Ze.left},${Ze.top})`,children:[B&&(0,ri.jsx)("rect",{x:0,y:0,width:Ye,height:Xe,fill:B}),t.map((e,t)=>function(e){const{node:t,index:n,renderMode:r,fallback:o}=e,i=Wo(r,t);if(!i)return o();const s=i.renderStaticSVG({node:t,style:t.style??{},key:`${i.id}-${n}`});return null!=s?s:(Ho(i.id,t.type??"unknown"),o())}({node:e,index:t,renderMode:W,fallback:()=>function(e,t){switch(e.type){case"geoarea":{const n=e;if(!n.pathData)return null;const r=fn(n.style.fill)?gn(n.style.fill,`geoarea-${t}-hatch`):void 0;return(0,tr.jsxs)(er.Fragment,{children:[r&&(0,tr.jsx)("defs",{children:r}),(0,tr.jsx)("path",{d:n.pathData,fill:r?`url(#geoarea-${t}-hatch)`:nr(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)}case"point":{const n=e,r=fn(n.style.fill)?gn(n.style.fill,`geopoint-${t}-hatch`):void 0;return(0,tr.jsxs)(er.Fragment,{children:[r&&(0,tr.jsx)("defs",{children:r}),(0,tr.jsx)("circle",{cx:n.x,cy:n.y,r:n.r,fill:r?`url(#geopoint-${t}-hatch)`:nr(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 r="M"+n.path.map(e=>`${e[0]},${e[1]}`).join("L");return(0,tr.jsx)("path",{d:r,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,r){const o=e.glyph;if(!o?.parts?.length||0>=e.size)return null;const i=Be(o,e.size);if(0>=i.scale)return null;const s=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,a=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=$e(o,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}(r+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),d=t=>o.parts.map((n,r)=>{const o=t?"none"===n.fill?void 0:t:We(n.fill,a,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:We(n.stroke??"none",a,e.accent);return o||i?(0,tr.jsx)("path",{d:n.d,fill:o??"none",stroke:i,strokeWidth:i?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},r):null});return(0,tr.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,tr.jsx)("clipPath",{id:c,children:(0,tr.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,tr.jsx)("g",{children:d(e.ghostColor)}):null,l&&c?(0,tr.jsx)("g",{clipPath:`url(#${c})`,children:d()}):d()]},r)}(e,e.x,e.y,"geo-glyph-"+(e.pointId??t));default:return null}}(e,t)}))]})]}),(0,ri.jsx)(Jn,{width:Ye,height:Xe,totalWidth:Ue[0],totalHeight:Ue[1],margin:Ze,showAxes:!1,title:ye,legend:ge,legendPosition:be,legendLayout:ve,legendHoverBehavior:xe,legendClickBehavior:we,legendHighlightedCategory:ke,legendIsolatedCategories:je,foregroundGraphics:To(Qe,Bo(mt.current?.customLayoutOverlays,h??null)),annotations:ee,onAnnotationActivate:te,onObservation:K??Q,chartId:J,chartType:"StreamGeoFrame",autoPlaceAnnotations:ne,pointNodes:Fo(t)})]})}return(0,ri.jsxs)("div",{ref:It,className:"stream-geo-frame"+(E?" "+E:""),role:"group","aria-label":Pe||("string"==typeof ye?ye:"Geographic chart"),tabIndex:0,style:{position:"relative",width:z?"100%":Ue[0],height:O?"100%":Ue[1],overflow:Z?"visible":"hidden",...k?{touchAction:"none"}:{}},onKeyDown:cn,children:["production"!==process.env.NODE_ENV&&mt.current&&(0,ri.jsx)(ze,{store:mt.current,diagnostics:Wt.current}),Le&&(0,ri.jsx)(Hr,{tableId:nt}),Le&&(0,ri.jsx)(_r,{scene:mt.current?.scene??[],chartType:"Geographic chart",tableId:nt,chartTitle:"string"==typeof ye?ye:void 0}),(0,ri.jsx)(Wr,{summary:Ie}),(0,ri.jsx)(wr,{hoverPoint:Ft}),(0,ri.jsxs)("div",{role:"img","aria-label":Pe||("string"==typeof ye?ye:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:hn?un:void 0,onPointerLeave:hn?nn:void 0,onPointerDown:hn||Ne?dn:void 0,onClick:Ne?sn:void 0,children:[(0,ri.jsx)(dr,{size:Ue,margin:Ze,children:Ke}),R&&(0,ri.jsx)("canvas",{ref:yt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,ri.jsx)("canvas",{ref:rn,"aria-label":Cr(mt.current?.scene??[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),(0,ri.jsx)("canvas",{ref:on,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,ri.jsx)(Jn,{width:Ye,height:Xe,totalWidth:Ue[0],totalHeight:Ue[1],margin:Ze,showAxes:Re,title:ye,legend:ge,legendPosition:be,legendLayout:ve,legendHoverBehavior:xe,legendClickBehavior:we,legendHighlightedCategory:ke,legendIsolatedCategories:je,foregroundGraphics:To(Qe,Bo(mt.current?.customLayoutOverlays,h??null)),annotations:ee,onAnnotationActivate:te,onObservation:K??Q,chartId:J,chartType:"StreamGeoFrame",autoPlaceAnnotations:ne,pointNodes:Fo(mt.current?.scene)}),ae?.showBadge&&(0,ri.jsx)(Pt,{isStale:Vt,position:ae.badgePosition}),k&&(0,ri.jsxs)("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Ze.bottom+8,left:Ze.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[(0,ri.jsx)("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=Lt.current,n=wt.current;t&&n?.scaleBy&&n.scaleBy((0,uo.select)(t),1.5)},style:Yo,children:"+"}),(0,ri.jsx)("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=Lt.current,n=wt.current;t&&n?.scaleBy&&n.scaleBy((0,uo.select)(t),1/1.5)},style:Yo,children:"−"})]}),L&&(0,ri.jsx)("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Ze.bottom+2,right:Ze.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:L}),(0,ri.jsx)(Ur,{active:an.current>=0,hoverPoint:Ft,margin:Ze,size:Ue,shape:ln.current?.shape,width:ln.current?.w,height:ln.current?.h,pathData:ln.current?.pathData}),mn]})]})}));oi.displayName="StreamGeoFrame";var ii=oi,si=require("react");function ai(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}var li=require("react"),ci=require("react"),ui=(require("react/jsx-runtime"),(0,ci.createContext)(null));function di(){return(0,ci.useContext)(ui)}var hi=require("react");function fi(e){const t=[];for(const[n,r]of Object.entries(e.fields))if("point"===r.type)t.push(e=>r.values.has(e[n]));else{const[e,o]=r.range;t.push(t=>{const r=t[n];return r>=e&&o>=r})}return e=>t.every(t=>t(e))}function pi(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function mi(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const n of e.values)if(!t.values.has(n))return!1;return!0}return!1}var[yi,gi]=Ke(e=>({selections:new Map,setClause(t,n){e(e=>{const r=e.selections.get(t),o=r?.clauses.get(n.clientId);if(o&&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,r]of n){const n=t.fields[e];if(!n||!mi(r,n))return!1}return!0}(o,n))return{};const i=new Map(e.selections),s=pi(i,t),a=new Map(s.clauses);return a.set(n.clientId,n),i.set(t,{...s,clauses:a}),{selections:i}})},clearClause(t,n){e(e=>{const r=e.selections.get(t);if(!r||!r.clauses.has(n))return{};const o=new Map(e.selections),i=new Map(r.clauses);return i.delete(n),o.set(t,{...r,clauses:i}),{selections:o}})},setResolution(t,n){e(e=>{const r=e.selections.get(t);if(r?.resolution===n)return{};const o=new Map(e.selections),i=pi(o,t);return o.set(t,{...i,resolution:n}),{selections:o}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const r=new Map(e.selections);return r.set(t,{...n,clauses:new Map}),{selections:r}})}})),bi=require("react"),vi=(require("react"),{positions:new Map}),xi=new Set;function wi(){for(const e of xi)e()}function ki(e,t){const n=vi.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const r=new Map(vi.positions);r.delete(e),vi={positions:r},wi()}function ji(e,t){const n=vi.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const r=new Map(vi.positions);r.delete(e),vi={positions:r},wi()}function Si(e){const t=(0,bi.useId)(),n=e.clientId||t,{name:r}=e,o=gi(e=>e.selections.get(r)),i=gi(e=>e.setClause),s=gi(e=>e.clearClause),a=(0,bi.useMemo)(()=>!!o&&o.clauses.size>0,[o]);return{predicate:(0,bi.useMemo)(()=>o&&0!==o.clauses.size?function(e,t){const n=[];for(const[r,o]of e.clauses)"crossfilter"===e.resolution&&r===t||n.push(fi(o));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(o,n):()=>!0,[o,n]),isActive:a,selectPoints:(0,bi.useCallback)(e=>{const t={};let o=!1;for(const[n,r]of Object.entries(e))t[n]={type:"point",values:new Set(r)},o=!0;o&&i(r,{clientId:n,type:"point",fields:t})},[n,r,i]),selectInterval:(0,bi.useCallback)(e=>{const t={};let o=!1;for(const[n,r]of Object.entries(e))t[n]={type:"interval",range:r},o=!0;o&&i(r,{clientId:n,type:"interval",fields:t})},[n,r,i]),clear:(0,bi.useCallback)(()=>{s(r,n)},[s,r,n]),clientId:n}}function Mi(e){const t=e.name||"hover",{fields:n}=e,{predicate:r,isActive:o,selectPoints:i,clear:s}=Si({name:t,fields:n});return{onHover:(0,bi.useCallback)(e=>{if(!e)return void s();const t={};for(const r of n){const n=e[r];void 0!==n&&(t[r]=[n])}(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1})(t)&&i(t)},[n,i,s]),predicate:r,isActive:o}}require("react/jsx-runtime");var Ci=(0,hi.createContext)(!1);(0,hi.createContext)(!1);var Ai=(0,hi.createContext)(null),Ri="undefined"==typeof window?hi.useEffect:hi.useLayoutEffect;function Li(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}var Pi=.5;function Ii(e,t,n){return t?(r,...o)=>{const i={...e(r,...o)};if(t.isActive)if(t.predicate(r))n?.selectedStyle&&Object.assign(i,n.selectedStyle);else{const e=n?.unselectedOpacity??Pi;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e}var Di=l(require("react"));function Ti(){return lt(e=>e.theme)}function zi(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Oi(e,t){const{when:n}=e,r=t.width,o=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),s=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof n.minWidth&&n.minWidth>r||"number"==typeof n.maxWidth&&r>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof o||n.minHeight>o)||"number"==typeof n.maxHeight&&("number"!=typeof o||o>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&s!==n.orientation)}function Ni(e,t,n=e.responsiveRules){if(!Array.isArray(n)||0===n.length)return{props:e,matches:[]};const r=n.map((e,t)=>({rule:e,index:t})).filter(e=>Oi(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:r.reduce((e,t)=>function(e,t){const n={...e,...t};for(const r of["margin","frameProps","mobileSemantics","style"])zi(e[r])&&zi(t[r])&&(n[r]={...e[r],...t[r]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:r}}function Ei(e,t,n){const r=e.xValue??t?.[n];if(null==r)return null;const o=Number(r);return Number.isFinite(o)?o:null}function Bi(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 _i(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}require("react/jsx-runtime"),Di.createContext(void 0);var Wi="#007bff",Hi=[],Fi=44,$i={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:Fi,snap:"nearestDatum",brushHandleSize:Fi,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function qi(e,t={}){const n=t.mobileSemantics?.interaction,r="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,o="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!n||void 0!==r,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!o&&!i)return $i;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??r??Fi,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??Fi,standardControls:a.standardControls??!1}}function Gi(){const e=Ti(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function Vi({selection:e,linkedHover:t,fallbackFields:n=Hi,unwrapData:r=!1,onObservation:o,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=(0,li.useId)(),h=(0,li.useMemo)(()=>Li(t,n),[t,n]),f=(0,li.useMemo)(()=>"series"===h?.mode?[h.seriesField||c||n[0]].filter(e=>!!e):h?.fields||n,[h,c,n]),p=Si({name:e?.name||"__unused__",fields:f}),m=Mi({name:h?.name||"hover",fields:f}),y=Tt(e=>e.pushObservation),g=(0,li.useCallback)(e=>{o?.(e),y?.(e)},[o,y]),b=e?{isActive:p.isActive,predicate:p.predicate}:null,[v,x]=(0,li.useState)(null),w=(0,li.useRef)(!1),k=c||n[0],j=(0,li.useMemo)(()=>{if(!l||null==v||!k)return null;const e=v,t=k;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,v,k]),S=(0,li.useCallback)((e,n)=>{const r=!e&&w.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===h?.mode&&h.xField){const n=Ei(e,t,h.xField);null!=n&&function(e,t,n){const r=vi.positions.get(e);r?.locked||r&&r.xValue===t&&r.sourceId===n||(vi={positions:new Map(vi.positions).set(e,{xValue:t,sourceId:n})},wi())}(h.name||"hover",n,d)}"x-position"!==h?.mode&&m.onHover(t)}else"x-position"!==h?.mode||r||ki(h.name||"hover",d),"x-position"===h?.mode||r||m.onHover(null);if(l&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[k];x(null!=n?n+"":null)}else r||x(null);(o||y)&&Ko({onObservation:g,datum:e?Bi(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:s,context:n})},[t,m,h,d,o,i,s,y,g,l,k,u]),M=(0,li.useCallback)((n=!0)=>{w.current=!1,t&&"x-position"!==h?.mode&&m.onHover(null),e&&u?.tapToSelect&&p.clear(),n&&l&&x(null),"x-position"===h?.mode&&(ji(h.name||"hover",d),ki(h.name||"hover",d))},[t,h,m,e,u,p,l,d]),C=(0,li.useCallback)((n,r)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),b=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===h?.mode&&h.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=Ei(n,e,h.xField);null!=t&&function(e,t,n){const r=vi.positions.get(e);if(r?.locked){const t=new Map(vi.positions);return t.delete(e),vi={positions:t},wi(),!1}vi={positions:new Map(vi.positions).set(e,{xValue:t,sourceId:n,locked:!0})},wi()}(h.name||"hover",t,d)}if(c)if(n){w.current=!0;const r=Bi(n);if(t&&"x-position"!==h?.mode&&m.onHover(r),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const n=r[t];void 0!==n&&(e[t]=[n])}_i(e)&&p.selectPoints(e)}if(l&&k){const e=r?.[k];x(null!=e?e+"":null)}}else b&&M();if(n||b){if(n&&a){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),a(e,{x:n.x??0,y:n.y??0})}(o||y)&&Jo({onObservation:g,datum:n?Bi(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:s,context:r})}},[a,o,y,g,i,s,h,d,u,t,m,e,p,f,l,k,M]);return(0,li.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&w.current&&M()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,M]),(0,li.useEffect)(()=>()=>{w.current&&M(!1)},[M]),(0,li.useEffect)(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{ji(e,d),ki(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:b,hoverSelectionHook:j,customHoverBehavior:S,customClickBehavior:C,crosshairSourceId:d}}function Ui({data:e,colorBy:t,colorScale:n,showLegend:r,legendPosition:o="right",userMargin:i,defaults:s={top:50,bottom:60,left:70,right:40},categories:a}){const l=(0,hi.useContext)(Ci),c=null!==(0,hi.useContext)(Ai),u=void 0!==r?r:!l&&!!t,d=!!t&&(u||c),h=(0,li.useMemo)(()=>{if(!d)return[];if(void 0!==a)return a;const n=new Set;for(const r of e){const e="function"==typeof t?t(r):r[t];null!=e&&n.add(e+"")}return Array.from(n)},[a,t,e,d]);!function(e){const t=(0,hi.useContext)(Ai),n=(0,hi.useId)(),r=function(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}(e),o=(0,hi.useRef)([]);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(o.current,r)||(o.current=r);const i=o.current;Ri(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),Ri(()=>{t&&t.registerCategories(n,i)},[t,n,i])}(c&&t?h:[]);const f=(0,li.useMemo)(()=>{if(!u||!t)return;const r=function({data:e,colorBy:t,colorScale:n,getColor:r,strokeColor:o,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==o&&(n.stroke=o),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((o,i)=>{const s=e.find("function"==typeof t?e=>t(e)===o:e=>e[t]===o),a=s?r(s,t,n):n?n(o):_[i%_.length];return{label:o+"",color:a}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:H,categories:h});return 0!==r.legendGroups.reduce((e,t)=>e+t.items.length,0)?r:void 0},[u,t,e,n,h]),p=(0,li.useMemo)(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const n=e[t];return"number"==typeof n?n:s[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},r=t=>"number"==typeof e[t];return f&&("right"===o&&!r("right")&&110>n.right?n.right=110:"left"===o&&!r("left")&&110>n.left?n.left=110:"top"===o&&!r("top")&&50>n.top?n.top=50:"bottom"===o&&!r("bottom")&&80>n.bottom&&(n.bottom=80)),n},[s,i,f,o]);return{legend:f,margin:p,legendPosition:o}}var Zi={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 Yi(e,t,n){const r=Zi[e||"primary"],o=e&&"primary"!==e||!n?.width?r.width:n.width,i=e&&"primary"!==e||!n?.height?r.height:n.height,s=Ni({...t,mode:e},{width:t.width??o,height:t.height??i}).props,a=s.mode||e,l=Zi[a||"primary"],c="context"===a||"sparkline"===a,u=a&&"primary"!==a||!n?.width?l.width:n.width;return{width:s.width??u,height:s.height??(a&&"primary"!==a||!n?.height?l.height:n.height),showAxes:s.showAxes??l.showAxes,showGrid:s.showGrid??l.showGrid,enableHover:s.enableHover??(!!s.linkedHover||l.enableHover),showLegend:s.showLegend??l.showLegend,showLabels:s.showLabels??l.showLabels,title:c?void 0:s.title,description:s.description,summary:s.summary,accessibleTable:s.accessibleTable,xLabel:c?void 0:s.xLabel,yLabel:c?void 0:s.yLabel,categoryLabel:c?void 0:s.categoryLabel,valueLabel:c?void 0:s.valueLabel,marginDefaults:Xi(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:qi(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}function Xi(e,t,n){if(!1!==t)return e;const r={...e};return"horizontal"===n?r.left=Math.min(r.left,15):r.bottom=Math.min(r.bottom,15),r}function Qi(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return e??((...e)=>({}));const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>({...e(...t)||{},...n}):(...e)=>({...n})}function Ki(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>es(t(e))}function Ji(e,t){const n=Ki(t??"value"),r=null==e?void 0:"function"==typeof e?e:t=>t[e];return e=>{const t=r?r(e):void 0;return{value:n(e),category:null==t?void 0:t+""}}}function es(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if("string"==typeof e&&""!==e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function ts(e,t,n){const r=null!=e.axis?n[e.axis]:null!=e.field?t[e.field]:n.value;if(void 0!==e.eq&&r!==e.eq)return!1;if(void 0!==e.ne&&r===e.ne)return!1;if(void 0!==e.in&&!e.in.includes(r))return!1;if(void 0===e.gt&&void 0===e.gte&&void 0===e.lt&&void 0===e.lte&&void 0===e.within&&void 0===e.outside)return!0;const o=es(r);if(void 0===o)return!1;if(void 0!==e.gt&&e.gt>=o)return!1;if(void 0!==e.gte&&e.gte>o)return!1;if(void 0!==e.lt&&o>=e.lt)return!1;if(void 0!==e.lte&&o>e.lte)return!1;if(void 0!==e.within){const[t,n]=e.within;if(t>o||o>n)return!1}if(void 0!==e.outside){const[t,n]=e.outside;if(o>=t&&n>=o)return!1}return!0}function ns(e,t,n){const r=e.when;return void 0===r||!0===r||!1!==r&&("function"==typeof r?r(t,n):ts(r,t,n))}function rs(e,t,n){if(!t||0===t.length)return{};let r={};for(const o of t){if(!ns(o,e,n))continue;const t="function"==typeof o.style?o.style(e,n):o.style;t&&(r={...r,...t})}return r}function os(e,t,n,r=e=>e){const o=e??(()=>({}));return t&&0!==t.length?(e,i)=>{const s=r(e),a={...o(e,i)};return Object.assign(a,rs(s,t,n(s,i))),a}:o}var is=require("react/jsx-runtime");function ss({componentName:e,message:t,diagnosticHint:n,width:r,height:o}){return(0,is.jsx)("div",{role:"alert",style:{width:r,height:Math.max(o,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:(0,is.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,is.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,is.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&(0,is.jsx)("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}var as=l(require("react")),ls=require("react/jsx-runtime"),cs=class extends as.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:(0,ls.jsx)(ss,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},us=require("react/jsx-runtime"),ds="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function hs({componentName:e,width:t,height:n,children:r}){return(0,us.jsx)(cs,{fallback:r=>(0,us.jsx)(ss,{componentName:e,message:r.message,width:t,height:n}),children:r})}var fs={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"},ps={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function ms(e,t,n,r){return!1===r||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,us.jsx)("div",{style:{...fs,width:t,height:n},children:r||"No data available"}):null}function ys(e,t,n,r){if(!e)return null;if(!1===r)return null;if(null!=r)return(0,us.jsx)("div",{style:{width:t,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:r});const o=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*o))),s=Math.max(6,Math.floor(n/(2.5*o))),a=Math.floor((n-(o*(i+s)-s))/2);return(0,us.jsx)("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:o},(e,n)=>(0,us.jsx)("div",{className:"semiotic-loading-bar",style:{...ps,position:"absolute",top:a+n*(i+s),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}function gs(e,t,n,r){if(!ds)return;if(!t||0===t.length)return;if("string"!=typeof r)return;const o=t[0];if(!o||"object"!=typeof o)return;if(r in o)return;const i=Object.keys(o).join(", ");console.warn(`[semiotic] ${e}: ${n} "${r}" not found in data. Available keys: ${i}`)}var bs=require("react");function vs(e){const t=lt(e=>e.theme.colors.selectionOpacity);return(0,bs.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}var xs=require("d3-scale"),ws=require("react"),ks=require("topojson-client"),js=new Map;function Ss(e){return"default"in e?e.default:e}var Ms="Install the optional peer dependency `world-atlas` (`npm install world-atlas`) to use built-in reference geographies, or pass GeoJSON Feature[] to `areas`.";async function Cs(e){const t=js.get(e);if(t)return t;const{topology:n,objectName:r}=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}"): ${Ms}`,{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 o=(0,ks.feature)(n,n.objects[r]),i="features"in o?o.features:[o];return js.set(e,i),i}function As(e){const t=(0,ws.useMemo)(()=>Array.isArray(e)?e:void 0,[e]),[n,r]=(0,ws.useState)(null);return(0,ws.useEffect)(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return r(null),Cs(e).then(e=>{t||r(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".`),r(null)}else r(null)},[e]),void 0!==t?t:n}function Rs(e){const{title:t,description:n,summary:r,accessibleTable:o,className:i,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),n&&(c.description=n),r&&(c.summary=r),void 0!==o&&(c.accessibleTable=o),i&&(c.className=i),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function Ls(e){const{linkedHover:t,selection:n,onObservation:r,onClick:o,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,f={};r&&(f.annotationObservationCallback=r);const p=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(a||t||r||o||s)&&(f.customHoverBehavior=u),d&&(l||(h?r||o||t:r||o)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||n))&&(f.customClickBehavior=d),null!=p&&(f.hoverRadius=p),f}var Ps=require("react/jsx-runtime");function Is(e){const t=Yi(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=Ti();return e?.colors?.sequential||void 0}(),{areas:r,valueAccessor:o,styleRules:i,colorScheme:s,projection:a="equalEarth",graticule:l,fitPadding:c,zoomable:u,zoomExtent:d,onZoom:h,dragRotate:f,tileURL:p,tileAttribution:m,tileCacheSize:y,tooltip:g,areaOpacity:b=1,annotations:v,margin:x,className:w,selection:k,linkedHover:j,onObservation:S,onClick:M,chartId:C,loading:A,loadingContent:R,emptyContent:L,frameProps:P={},stroke:I,strokeWidth:D,opacity:T}=e,z=u??!!p,O=As(r),E=(0,si.useMemo)(()=>O?qr(O):O,[O]),B=(0,si.useMemo)(()=>"function"==typeof o?o:e=>e?.properties?.[o]??e?.[o],[o]),_=s??n??"blues",W=(0,si.useMemo)(()=>{if(!E)return(0,xs.scaleSequential)(N(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(const n of E){const r=B(n);null!=r&&isFinite(r)&&(e>r&&(e=r),r>t&&(t=r))}const n=N(_);return(0,xs.scaleSequential)(n).domain([Number.isFinite(e)?e:0,Number.isFinite(t)?t:1])},[E,B,_]),{activeSelectionHook:H,customHoverBehavior:F,customClickBehavior:$}=Vi({selection:k,linkedHover:j,onObservation:S,onClick:M,chartType:"ChoroplethMap",chartId:C,mobileInteraction:t.mobileInteraction}),q=vs(k),G=(0,si.useMemo)(()=>{const e=Qi(os(e=>{const t=B(e);return{fill:null!=t&&isFinite(t)?W(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:b}},i,e=>({value:B(e)}),e=>e&&"object"==typeof e&&e.properties?{...e.properties,...e}:e),{stroke:I,strokeWidth:D,opacity:T});return H?Ii(e,H,q):e},[B,W,H,q,b,I,D,T,i]),V=(0,si.useMemo)(()=>e=>{const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||"Feature",n=B(e);return(0,Ps.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,Ps.jsx)("div",{style:{fontWeight:600},children:t}),null!=n&&(0,Ps.jsx)("div",{style:{opacity:.7},children:(r=n,"number"==typeof r&&isFinite(r)?Number.isInteger(r)?r.toLocaleString():r.toLocaleString(void 0,{maximumFractionDigits:2}):(r??"")+"")})]});var r},[B]),U=(0,si.useMemo)(()=>({top:10,right:10,bottom:10,left:10,...ai(x)}),[x]),Z=ys(A,t.width,t.height,R)||(E?null:ys(!0,t.width,t.height,R)),Y=Z?null:ms(E,t.width,t.height,L);if(Array.isArray(E)&&E.length>0){const e=E[0];if(!e||"object"!=typeof e||!e.geometry)return(0,Ps.jsx)(ss,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:t.width,height:t.height})}const X={projection:a,areas:E,areaStyle:G,size:[t.width,t.height],margin:U,enableHover:!0,tooltipContent:!1===g?()=>null:!0===g?V:so(g)||V,...null!=l&&{graticule:l},...null!=c&&{fitPadding:c},...z&&{zoomable:!0},...d&&{zoomExtent:d},...h&&{onZoom:h},...null!=f&&{dragRotate:f},...p&&{tileURL:p},...m&&{tileAttribution:m},...y&&{tileCacheSize:y},...Ls({linkedHover:j,selection:k,onObservation:S,onClick:M,mobileInteraction:t.mobileInteraction,customHoverBehavior:F,customClickBehavior:$,linkedHoverInClickPredicate:!1}),...v&&v.length>0&&{annotations:v},...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},...w&&{className:w},...null!=e.animate&&{animate:e.animate},...P};return Z||Y||(0,Ps.jsx)(hs,{componentName:"ChoroplethMap",width:t.width,height:t.height,children:(0,Ps.jsx)(ii,{...X})})}Is.displayName="ChoroplethMap";var Ds=require("react"),Ts=require("react");function zs(e){const{data:t,rawData:n,colorBy:r,colorScheme:o,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:d,chartType:h,chartId:f,showLegend:p,userMargin:m,marginDefaults:y,onClick:g,hoverHighlight:b,mobileInteraction:v,mobileSemantics:x,loading:w,loadingContent:k,emptyContent:j,width:S,height:M}=e,C=void 0===n,A=(0,Ts.useMemo)(()=>qr(t),[t]),[R,L]=(0,Ts.useState)([]),P=(0,Ts.useCallback)(e=>{L(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),I="string"==typeof e.colorBy?e.colorBy:void 0,D=(0,Ts.useMemo)(()=>qi(v,{width:S,mobileSemantics:x}),[v,S,x]),{activeSelectionHook:T,hoverSelectionHook:z,customHoverBehavior:O,customClickBehavior:N,crosshairSourceId:E}=Vi({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:d,chartType:h,chartId:f,onClick:g,hoverHighlight:b,colorByField:I,mobileInteraction:D}),B=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),W=function(e,t,n){const r=di(),o=Gi();return(0,li.useMemo)(()=>{if(!t)return;const i=r??void 0,s=n??(o&&o.length>0?o:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&_i(i)){const e=$(n.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return $(n.map(e=>({_cat:e})),"_cat",s)}if(i&&_i(i)){const n=$(e,t,s);return e=>i[e]||n(e)}return $(e,t,s)}if(i&&_i(i)){const e=$([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,n,r,o])}(A,r,o),H=(0,Ts.useMemo)(()=>{if(!r)return[];const e=new Set;for(const t of A){const n="function"==typeof r?r(t):t[r];null!=n&&e.add(n+"")}return Array.from(e)},[A,r]),F=(0,Ts.useMemo)(()=>C&&R.length>0?R:H,[C,R,H]),q=function(e,t,n){const[r,o]=(0,li.useState)(null),[i,s]=(0,li.useState)(new Set),a=(0,li.useMemo)(()=>new Set,[]),l=(0,li.useCallback)(t=>{"highlight"===e&&o(t?t.label:null)},[e]),c=(0,li.useCallback)(t=>{"isolate"===e&&s(e=>{const r=new Set(e);return r.has(t.label)?r.delete(t.label):r.add(t.label),r.size===n.length?new Set:r})},[e,n.length]),u=(0,li.useMemo)(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===r}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const r=n?e[n]:"function"==typeof t?t(e):null;return i.has(r)}}:null},[e,t,r,i]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?i:a,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(i,r,F),G=(0,Ts.useMemo)(()=>z||(q.legendSelectionHook?q.legendSelectionHook:T),[z,q.legendSelectionHook,T]),V=vs(a),U=Gi(),Z=di(),Y=(0,Ts.useMemo)(()=>{if(W)return W;if(!r||0===F.length)return;const e=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:U&&U.length>0?U:_,t="__streamCat",n=$(F.map(e=>({[t]:e})),t,e);return e=>Z?.[e]||n(e)||"#999"},[W,r,F,o,U,Z]),{legend:X,margin:Q,legendPosition:K}=Ui({data:A,colorBy:r,colorScale:Y,showLegend:p,legendPosition:s,userMargin:m,defaults:y,categories:F}),J=(0,Ts.useMemo)(()=>{const e={};return X&&(e.legend=X,e.legendPosition=K),i&&"none"!==i&&(e.legendHoverBehavior=q.onLegendHover,e.legendClickBehavior=q.onLegendClick,e.legendHighlightedCategory=q.highlightedCategory,e.legendIsolatedCategories=q.isolatedCategories),C&&r&&(e.legendCategoryAccessor=r,e.onCategoriesChange=P),e},[X,K,i,q.onLegendHover,q.onLegendClick,q.highlightedCategory,q.isolatedCategories,C,r,P]),ee=Array.isArray(n)?qr(n):n,te=ys(w,S,M,k),ne=te?null:ms(ee,S,M,j);return{data:A,colorScale:W,allCategories:F,legendState:q,effectiveSelectionHook:G,activeSelectionHook:T,customHoverBehavior:O,customClickBehavior:N,mobileInteraction:D,legend:X,margin:Q,legendPosition:K,earlyReturn:te||ne||null,legendBehaviorProps:J,crosshairProps:B,resolvedSelection:V}}var Os=require("react");function Ns(e,t){const{variant:n,frameRef:r,overrides:o}=t;(0,Os.useImperativeHandle)(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,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],r=e.current?.getTopology()?.nodes??[],o=[];for(const t of n){const n=r.find(e=>e.id===t);n&&o.push({...n.data??{},id:t}),e.current?.removeNode(t)}return o},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const r=e.current?.updateNode(t,n);return r?[{...r,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 r=e.current?.removePoint(t)??[];for(const t of r)e.current?.push(n(t));return r},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 r=n.current?.removeLine(e)??[];for(const e of r)n.current?.pushLine(t(e));return r},clear:()=>n.current?.clear(),getData:()=>n.current?.getLines()??[],getCustomLayout:()=>n.current?.getCustomLayout?.()??null,getLayoutFailure:()=>n.current?.getLayoutFailure?.()??null}}(n,r);return{...e,...o}},[r,o,n])}var Es=require("react/jsx-runtime"),Bs=(0,Ds.forwardRef)(function(e,t){const n=(0,Ds.useRef)(null);Ns(t,{variant:"geo-points",frameRef:n});const r=Yi(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,xAccessor:i="lon",yAccessor:s="lat",sizeBy:a,sizeRange:l=[3,30],colorBy:c,styleRules:u,colorScheme:d,projection:h="equalEarth",graticule:f,fitPadding:p,zoomable:m,zoomExtent:y,onZoom:g,dragRotate:b,tileURL:v,tileAttribution:x,tileCacheSize:w,areas:k,areaStyle:j={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:S,annotations:M,margin:C,className:A,selection:R,linkedHover:L,onObservation:P,onClick:I,chartId:D,loading:T,loadingContent:z,emptyContent:O,legendInteraction:N,legendPosition:E,frameProps:B={},stroke:_,strokeWidth:W,opacity:F}=e,$=m??!!v,G=As(k),V=zs({data:o??$r,rawData:o,colorBy:c,colorScheme:d,legendInteraction:N,legendPosition:E,selection:R,linkedHover:L,fallbackFields:c?["string"==typeof c?c:""]:[],unwrapData:!1,onObservation:P,onClick:I,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"ProportionalSymbolMap",chartId:D,showLegend:r.showLegend,userMargin:C,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:T,loadingContent:z,emptyContent:O,width:r.width,height:r.height}),U=V.data,Z=(0,Ds.useMemo)(()=>{if(!a)return;const e="function"==typeof a?a:e=>e?.[a],t=U.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?oe(t):void 0},[U,a]),Y=(0,Ds.useMemo)(()=>{const e=Qi(os(e=>({fill:c?H(e,c,V.colorScale):Wi,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:a?q(e,a,l,Z):6}),u,Ji(c,a)),{stroke:_,strokeWidth:W,opacity:F});return V.effectiveSelectionHook?Ii(e,V.effectiveSelectionHook,V.resolvedSelection):e},[c,V.colorScale,V.effectiveSelectionHook,V.resolvedSelection,a,l,Z,_,W,F,u]),X=(0,Ds.useMemo)(()=>e=>{const t=e?.name||e?.label||e?.NAME||e?.id,n="string"==typeof a?a:null,r=("function"==typeof a?a:e=>e[a])(e),o=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(e??"")+"",i="string"==typeof c?c:null,s=i?e?.[i]:null;return(0,Es.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t&&(0,Es.jsx)("div",{style:{fontWeight:600,marginBottom:2},children:t}),n&&null!=r&&(0,Es.jsxs)("div",{children:[(0,Es.jsxs)("span",{style:{opacity:.7},children:[n,": "]}),o(r)]}),i&&null!=s&&(0,Es.jsxs)("div",{children:[(0,Es.jsxs)("span",{style:{opacity:.7},children:[i,": "]}),s+""]}),!t&&!n&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>(0,Es.jsxs)("div",{children:[(0,Es.jsxs)("span",{style:{opacity:.7},children:[e,": "]}),o(t)]},e))]})},[a,c]);if(V.earlyReturn)return V.earlyReturn;gs("ProportionalSymbolMap",U,"xAccessor",i),gs("ProportionalSymbolMap",U,"yAccessor",s);const Q={projection:h,...null!=o&&{points:U},xAccessor:i,yAccessor:s,pointStyle:Y,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...G&&{areas:G,areaStyle:j},...null!=f&&{graticule:f},...null!=p&&{fitPadding:p},...$&&{zoomable:!0},...y&&{zoomExtent:y},...g&&{onZoom:g},...null!=b&&{dragRotate:b},...v&&{tileURL:v},...x&&{tileAttribution:x},...w&&{tileCacheSize:w},size:[r.width,r.height],margin:V.margin,enableHover:!0,tooltipContent:!1===S?()=>null:so(S)||X,...V.legendBehaviorProps,...Ls({linkedHover:L,selection:R,onObservation:P,onClick:I,mobileInteraction:V.mobileInteraction,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior,linkedHoverInClickPredicate:!1}),...M&&M.length>0&&{annotations:M},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...r.title&&{title:r.title},...r.description&&{description:r.description},...r.summary&&{summary:r.summary},...void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable},...A&&{className:A},...null!=e.animate&&{animate:e.animate},...B};return(0,Es.jsx)(hs,{componentName:"ProportionalSymbolMap",width:r.width,height:r.height,children:(0,Es.jsx)(ii,{ref:n,...Q})})});Bs.displayName="ProportionalSymbolMap";var _s=require("react"),Ws=require("d3-scale"),Hs=require("react/jsx-runtime"),Fs="__semiotic_x",$s="__semiotic_y",qs=(0,_s.forwardRef)(function(e,t){const n=Yi(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:r,nodes:o,nodeIdAccessor:i="id",xAccessor:s="lon",yAccessor:a="lat",valueAccessor:l="value",projection:c="equalEarth",graticule:u,fitPadding:d,zoomable:h,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:j,edgeOpacity:S=.6,edgeWidthRange:M=[1,8],edgeLinecap:C="round",colorScheme:A,showParticles:R,particleStyle:L,tooltip:P,annotations:I,margin:D,className:T,selection:z,linkedHover:O,onObservation:N,onClick:E,chartId:B,loading:_,loadingContent:W,emptyContent:F,frameProps:$={},legendInteraction:q,legendPosition:G,stroke:V,strokeWidth:U,opacity:Z,lineIdAccessor:Y}=e,X=h??!!y,Q=As(w),K=(0,_s.useMemo)(()=>qr(o),[o]),J=zs({data:r??$r,rawData:r,colorBy:j,colorScheme:A,legendInteraction:q,legendPosition:G,selection:z,linkedHover:O,fallbackFields:j?["string"==typeof j?j:""]:[],unwrapData:!1,onObservation:N,onClick:E,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"FlowMap",chartId:B,showLegend:n.showLegend,userMargin:D,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:_,loadingContent:W,emptyContent:F,width:n.width,height:n.height}),ee=J.data,te=Li(O),ne=Mi({name:te?.name||"hover",fields:te?.fields||[]}),re=Tt(e=>e.pushObservation),ie=(0,_s.useMemo)(()=>{const e=new Map;for(const t of K)e.set(t[i]+"",t);return e},[K,i]),se=(0,_s.useRef)(null),ae=(0,_s.useRef)(ie);ae.current=ie;const le=(0,_s.useRef)(s);le.current=s;const ce=(0,_s.useRef)(a);ce.current=a;const ue=(0,_s.useCallback)(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=ae.current,n=t.get(e.source+""),r=t.get(e.target+"");if(!n||!r)return null;const o="function"==typeof le.current?le.current:e=>e[le.current],i="function"==typeof ce.current?ce.current:e=>e[ce.current];return{...e,coordinates:[{[Fs]:o(n),[$s]:i(n)},{[Fs]:o(r),[$s]:i(r)}]}},[]);Ns(t,{variant:"geo-lines",frameRef:se,overrides:{push:e=>{const t=ue(e);t&&se.current?.pushLine(t)},pushMany:e=>{const t=[];for(const n of e){const e=ue(n);e&&t.push(e)}t.length>0&&se.current?.pushManyLines(t)}}});const de=(0,_s.useMemo)(()=>{const e=new Map;for(const t of ee)t&&"object"==typeof t&&(null==t.source||e.has(t.source)||e.set(t.source,t),null==t.target||e.has(t.target)||e.set(t.target,t));return e},[ee]),he=(0,_s.useCallback)(e=>{if(O)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=de.get(t[i]+"");e&&ne.onHover(e)}else ne.onHover(t)}else ne.onHover(null);if(N||re){const t={timestamp:Date.now(),chartType:"FlowMap",chartId:B};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const r={...t,type:"hover",datum:n||{},x:e.x??0,y:e.y??0};N&&N(r),re&&re(r)}else{const e={...t,type:"hover-end"};N&&N(e),re&&re(e)}}},[O,ne,i,de,N,B,re]),fe=J.customClickBehavior,pe=(0,_s.useMemo)(()=>{const e="function"==typeof s?s:e=>e[s],t="function"==typeof a?a:e=>e[a];return ee.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const r=ie.get(n.source+""),o=ie.get(n.target+"");return r&&o?{...n,coordinates:[{[Fs]:e(r),[$s]:t(r)},{[Fs]:e(o),[$s]:t(o)}]}:null}).filter(Boolean)},[ee,ie,s,a]),me=(0,_s.useMemo)(()=>{const e="function"==typeof s?s:e=>e[s];return t=>null!=t&&"object"==typeof t&&Fs in t?t[Fs]:e(t)},[s]),ye=(0,_s.useMemo)(()=>{const e="function"==typeof a?a:e=>e[a];return t=>null!=t&&"object"==typeof t&&$s in t?t[$s]:e(t)},[a]),ge=(0,_s.useMemo)(()=>{const e=ee.filter(e=>e&&"object"==typeof e).map(e=>e[l]??0).filter(e=>isFinite(e));return 0===e.length?()=>M[0]:(0,Ws.scaleLinear)().domain(oe(e)).range(M)},[ee,l,M]),be=(0,_s.useMemo)(()=>e=>({stroke:j?H(e,j,J.colorScale):Wi,strokeWidth:ge(e[l]??0),strokeLinecap:C,opacity:S}),[j,J.colorScale,ge,l,S,C]),ve=(0,_s.useMemo)(()=>{const e=Qi(be,{stroke:V,strokeWidth:U,opacity:Z});if(!J.effectiveSelectionHook)return e;const t={...J.resolvedSelection?.unselectedStyle||{},fillOpacity:0};return Ii(e,J.effectiveSelectionHook,{...J.resolvedSelection||{},unselectedStyle:t})},[be,J.effectiveSelectionHook,J.resolvedSelection,V,U,Z]),xe=(0,_s.useMemo)(()=>Qi(()=>({fill:"#333",r:5,fillOpacity:.8}),{stroke:V,strokeWidth:U,opacity:Z}),[V,U,Z]),we=(0,_s.useMemo)(()=>e=>{if(e?.geometry||e?.properties||e?.data?.geometry){const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||e?.data?.properties?.name||e?.data?.properties?.NAME;if(t)return(0,Hs.jsx)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:(0,Hs.jsx)("div",{style:{fontWeight:600},children:t})})}if(null!=e?.source&&null!=e?.target){const t=e[l];return(0,Hs.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,Hs.jsxs)("div",{style:{fontWeight:600},children:[e.source," → ",e.target]}),null!=t&&(0,Hs.jsx)("div",{style:{opacity:.7},children:"number"==typeof t?t.toLocaleString():t})]})}const t=e?.name||e?.label||e?.[i];return null!=t?(0,Hs.jsx)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:(0,Hs.jsx)("div",{style:{fontWeight:600},children:t})}):null},[l,i]);if(J.earlyReturn)return J.earlyReturn;const ke={projection:c,...null!=r&&{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!=d&&{fitPadding:d},...X&&{zoomable:!0},...f&&{zoomExtent:f},...p&&{onZoom:p},...null!=m&&{dragRotate:m},...R&&{showParticles:R},...L&&{particleStyle:L},...y&&{tileURL:y},...g&&{tileAttribution:g},...b&&{tileCacheSize:b},size:[n.width,n.height],margin:J.margin,enableHover:!0,tooltipContent:!1===P?()=>null:so(P)||we,...J.legendBehaviorProps,...Ls({linkedHover:O,selection:z,onObservation:N,onClick:E,mobileInteraction:J.mobileInteraction,customHoverBehavior:he,customClickBehavior:fe,linkedHoverInClickPredicate:!1}),...I&&I.length>0&&{annotations:I},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...n.title&&{title:n.title},...n.description&&{description:n.description},...n.summary&&{summary:n.summary},...void 0!==n.accessibleTable&&{accessibleTable:n.accessibleTable},...T&&{className:T},...null!=e.animate&&{animate:e.animate},...$};return(0,Hs.jsx)(hs,{componentName:"FlowMap",width:n.width,height:n.height,children:(0,Hs.jsx)(ii,{ref:se,...ke})})});qs.displayName="FlowMap";var Gs=require("react"),Vs=require("react/jsx-runtime"),Us=(0,Gs.forwardRef)(function(e,t){const n=Yi(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,lines:o,xAccessor:i="lon",yAccessor:s="lat",nodeIdAccessor:a="id",center:l,costAccessor:c,strength:u=1,lineMode:d="straight",projection:h="mercator",graticule:f,fitPadding:p,zoomable:m,zoomExtent:y,onZoom:g,dragRotate:b,tileURL:v,tileAttribution:x,tileCacheSize:w,transition:k,colorBy:j,styleRules:S,colorScheme:M,pointRadius:C=5,tooltip:A,showRings:R=!0,ringStyle:L,showNorth:P=!0,costLabel:I,annotations:D,margin:T,className:z,selection:O,linkedHover:N,onObservation:E,onClick:B,chartId:_,loading:W,loadingContent:F,emptyContent:$,legendPosition:q,frameProps:G={},stroke:V,strokeWidth:U,opacity:Z}=e,Y=m??!!v,X=(0,Gs.useMemo)(()=>qr(r),[r]),Q=zs({data:X,rawData:r,colorBy:j,colorScheme:M,legendInteraction:void 0,legendPosition:q,selection:O,linkedHover:N,fallbackFields:j?["string"==typeof j?j:""]:[],unwrapData:!1,onObservation:E,onClick:B,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DistanceCartogram",chartId:_,showLegend:n.showLegend,userMargin:T,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:W,loadingContent:F,emptyContent:$,width:n.width,height:n.height}),K=(0,Gs.useMemo)(()=>{const e=Qi(os(e=>({fill:j?H(e,j,Q.colorScale):Wi,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:C}),S,Ji(j)),{stroke:V,strokeWidth:U,opacity:Z});return Q.effectiveSelectionHook?Ii(e,Q.effectiveSelectionHook,Q.resolvedSelection):e},[j,Q.colorScale,Q.effectiveSelectionHook,Q.resolvedSelection,C,V,U,Z,S]),J=(0,Gs.useMemo)(()=>({center:l,centerAccessor:a,costAccessor:c,strength:u,lineMode:d}),[l,a,c,u,d]),ee=(0,Gs.useMemo)(()=>{if(!o)return;const e="function"==typeof i?i:e=>e[i],t="function"==typeof s?s:e=>e[s],n=new Map;for(const e of X)n.set(e[a]+"",e);return o.map(r=>{if(r.coordinates)return r;const o=n.get(r.source+""),a=n.get(r.target+"");return o&&a?{...r,coordinates:[{[i]:e(o),[s]:t(o)},{[i]:e(a),[s]:t(a)}]}:null}).filter(Boolean)},[o,X,i,s,a]),te=(0,Gs.useMemo)(()=>e=>{const t=("function"==typeof c?c:e=>e[c])(e);return(0,Vs.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,Vs.jsx)("div",{style:{fontWeight:600},children:e[a]||e.name||e.id||"Point"}),null!=t&&(0,Vs.jsxs)("div",{style:{opacity:.7},children:["Cost: ","number"==typeof t?t.toFixed(1):t]})]})},[c,a]),ne=(0,Gs.useRef)(null);Ns(t,{variant:"geo-points",frameRef:ne});const[re,oe]=(0,Gs.useState)(null),ie=(0,Gs.useCallback)(()=>{const e=ne.current?.getCartogramLayout?.();e&&oe(t=>t&&t.cx===e.cx&&t.cy===e.cy&&t.maxCost===e.maxCost&&t.availableRadius===e.availableRadius?t:e)},[]);(0,Gs.useEffect)(()=>{const e=requestAnimationFrame(ie);return()=>cancelAnimationFrame(e)},[ie,u,l,n.width,n.height,X]);const se=(0,Gs.useMemo)(()=>{if(!R||!re)return[];const{maxCost:e}=re;if(0>=e)return[];if(Array.isArray(R))return R.filter(t=>t>0&&e>=t);const t="number"==typeof R?R:Math.min(5,Math.max(2,Math.ceil(e/5))),n=e/t,r=[];for(let e=1;t>=e;e++)r.push(Math.round(n*e*10)/10);return r},[R,re]),ae=(0,Gs.useMemo)(()=>{if(!re)return G.foregroundGraphics||null;const{cx:e,cy:t,maxCost:n,availableRadius:r}=re,o={stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10,...L},i=Q.margin.left??10,s=Q.margin.top??10;return(0,Vs.jsxs)("g",{children:[se.map(a=>{const l=a/n*r;return(0,Vs.jsxs)("g",{children:[(0,Vs.jsx)("circle",{cx:e+i,cy:t+s,r:l,fill:"none",stroke:o.stroke,strokeWidth:o.strokeWidth,strokeDasharray:o.strokeDasharray,opacity:.5}),(0,Vs.jsxs)("text",{x:e+i+l+3,y:t+s-2,fontSize:o.labelSize,fill:o.labelColor,fontFamily:"system-ui, sans-serif",children:[a,I?" "+I:""]})]},a)}),P&&(0,Vs.jsxs)("g",{transform:`translate(${i+24}, ${s+24})`,children:[(0,Vs.jsx)("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),(0,Vs.jsx)("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),(0,Vs.jsx)("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),(0,Vs.jsx)("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),(0,Vs.jsx)("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),(0,Vs.jsx)("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]}),G.foregroundGraphics]})},[re,se,P,I,L,Q.margin,G.foregroundGraphics]);if(Q.earlyReturn)return Q.earlyReturn;gs("DistanceCartogram",X,"xAccessor",i),gs("DistanceCartogram",X,"yAccessor",s);const le={projection:h,...null!=r&&{points:X},...ee&&{lines:ee,lineDataAccessor:"coordinates"},xAccessor:i,yAccessor:s,pointIdAccessor:a,pointStyle:K,projectionTransform:J,...k&&{transition:{duration:k}},...null!=f&&{graticule:f},...null!=p&&{fitPadding:p},...Y&&{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:Q.margin,enableHover:!0,tooltipContent:!1===A?()=>null:so(A)||te,...Q.legendBehaviorProps,...Ls({linkedHover:N,selection:O,onObservation:E,onClick:B,mobileInteraction:Q.mobileInteraction,customHoverBehavior:Q.customHoverBehavior,customClickBehavior:Q.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},...z&&{className:z},...null!=e.animate&&{animate:e.animate},...G,foregroundGraphics:ae};return(0,Vs.jsx)(hs,{componentName:"DistanceCartogram",width:n.width,height:n.height,children:(0,Vs.jsx)(ii,{ref:ne,...le})})});Us.displayName="DistanceCartogram";var Zs=require("react"),Ys=require("react");var Xs=require("react/jsx-runtime"),Qs=(0,Zs.forwardRef)(function(e,t){const{points:n,areas:r,lines:o,layout:i,layoutConfig:s,onLayoutError:a,projection:l="equirectangular",xAccessor:c="lon",yAccessor:u="lat",lineDataAccessor:d,colorBy:h,colorScheme:f,tooltip:p,annotations:m,margin:y,selection:g,linkedHover:b,onObservation:v,onClick:x,chartId:w,loading:k,loadingContent:j,emptyContent:S,className:M,frameProps:C={}}=e,{frameRef:A,resolved:R,normalizedMargin:L}=function(e){const t=(0,Ys.useRef)(null);return Ns(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Yi(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:(0,Ys.useMemo)(()=>ai(e.margin),[e.margin])}}({imperativeRef:t,imperativeVariant:"geo-points",margin:y,width:e.width,height:e.height,enableHover:e.enableHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),P=(0,Zs.useMemo)(()=>qr(n),[n]),I=(0,Zs.useMemo)(()=>qr(r),[r]),D=(0,Zs.useMemo)(()=>qr(o),[o]),T=(0,Zs.useMemo)(()=>[...P,...D,...I],[P,D,I]),z=zs({data:T,rawData:void 0!==n||void 0!==o||void 0!==r?T:void 0,colorBy:h,colorScheme:f,legendInteraction:void 0,selection:g,linkedHover:b,fallbackFields:"string"==typeof h?[h]:[],unwrapData:!1,onObservation:v,onClick:x,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:"GeoCustomChart",chartId:w,showLegend:!1,userMargin:L,marginDefaults:R.marginDefaults,loading:k,loadingContent:j,emptyContent:S,width:R.width,height:R.height}),O=z.effectiveSelectionHook,N=(0,Zs.useMemo)(()=>O?.isActive?{isActive:!0,predicate:O.predicate}:null,[O?.isActive,O?.predicate]);if(z.earlyReturn)return z.earlyReturn;const{width:E,height:B,enableHover:_,title:W,description:H,summary:F,accessibleTable:$}=R,q=so(p),G={projection:l,...null!=n&&{points:P},...null!=r&&{areas:I},...null!=o&&{lines:D},xAccessor:c,yAccessor:u,...null!=d&&{lineDataAccessor:d},customLayout:i,layoutConfig:s,onLayoutError:a,layoutSelection:N,colorBy:h,colorScheme:f,size:[E,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:z.margin,enableHover:_,...Rs({title:W,description:H,summary:F,accessibleTable:$,className:M,animate:e.animate,autoPlaceAnnotations:e.autoPlaceAnnotations}),...!1===p?{tooltipContent:()=>null}:q?{tooltipContent:q}:{},...Ls({linkedHover:b,selection:g,onObservation:v,onClick:x,hoverHighlight:!1,mobileInteraction:z.mobileInteraction,customHoverBehavior:z.customHoverBehavior,customClickBehavior:z.customClickBehavior,linkedHoverInClickPredicate:!1}),...m&&m.length>0&&{annotations:m},...C};return(0,Xs.jsx)(hs,{componentName:"GeoCustomChart",width:E,height:B,children:(0,Xs.jsx)(ii,{ref:A,...G})})});Qs.displayName="GeoCustomChart";var Ks={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},Js=8;function ea(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??Js,style:{...Ks},datum:e.datum,pointId:t,_transitionKey:t}}function ta(e){return ea(e)}function na(e){const[[t,n],[r,o]]=e.bounds;return{type:"geoarea",pathData:e.pathData,centroid:e.centroid,bounds:e.bounds,screenArea:e.screenArea??Math.abs((r-t)*(o-n)),style:{...Ks},datum:e.datum,group:e.group,interactive:!0}}function ra(e,t,n){const{featureKey:r,dataKey:o}=n,i=new Map;for(const e of t)i.set(e[o]+"",e);return e.map(e=>{const t=(e=>{const t=r.split(".");let n=e;for(const e of t)n=null!==n&&"object"==typeof n?n[e]:void 0;return(n??"")+""})(e),n=i.get(t);return n?{...e,properties:{...e.properties,...n}}:e})}