semiotic 2.0.3 → 3.0.0-beta.2

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 (508) hide show
  1. package/CLAUDE.md +828 -0
  2. package/README.md +215 -37
  3. package/ai/cli.js +48 -0
  4. package/ai/dist/ai/componentRegistry.js +45 -0
  5. package/ai/dist/ai/mcp-server.js +99 -0
  6. package/ai/dist/ai/renderHOCToSVG.js +77 -0
  7. package/ai/dist/src/components/Annotation.js +358 -0
  8. package/ai/dist/src/components/AnnotationLayer/AnnotationLayer.js +369 -0
  9. package/ai/dist/src/components/Axis/Axis.js +374 -0
  10. package/ai/dist/src/components/Axis/axisTitle.js +14 -0
  11. package/ai/dist/src/components/Axis/index.js +7 -0
  12. package/ai/dist/src/components/Axis/summaryGraphic.js +37 -0
  13. package/ai/dist/src/components/Brush.js +84 -0
  14. package/ai/dist/src/components/ChartErrorBoundary.js +91 -0
  15. package/ai/dist/src/components/DividedLine.js +65 -0
  16. package/ai/dist/src/components/Legend.js +140 -0
  17. package/ai/dist/src/components/LinkedCharts.js +95 -0
  18. package/ai/dist/src/components/ThemeProvider.js +79 -0
  19. package/ai/dist/src/components/Tooltip/Tooltip.js +309 -0
  20. package/ai/dist/src/components/TooltipPositioner/index.js +132 -0
  21. package/ai/dist/src/components/annotationLayerBehavior/annotationHandling.js +73 -0
  22. package/ai/dist/src/components/annotationLayerBehavior/d3labeler.js +254 -0
  23. package/ai/dist/src/components/annotationRules/baseRules.js +150 -0
  24. package/ai/dist/src/components/annotationRules/networkframeRules.js +196 -0
  25. package/ai/dist/src/components/annotationRules/xyframeRules.js +297 -0
  26. package/ai/dist/src/components/batchWork.js +35 -0
  27. package/ai/dist/src/components/charts/index.js +109 -0
  28. package/ai/dist/src/components/charts/network/ChordDiagram.js +142 -0
  29. package/ai/dist/src/components/charts/network/CirclePack.js +108 -0
  30. package/ai/dist/src/components/charts/network/ForceDirectedGraph.js +121 -0
  31. package/ai/dist/src/components/charts/network/SankeyDiagram.js +155 -0
  32. package/ai/dist/src/components/charts/network/TreeDiagram.js +110 -0
  33. package/ai/dist/src/components/charts/network/Treemap.js +106 -0
  34. package/ai/dist/src/components/charts/ordinal/BarChart.js +156 -0
  35. package/ai/dist/src/components/charts/ordinal/BoxPlot.js +139 -0
  36. package/ai/dist/src/components/charts/ordinal/DonutChart.js +130 -0
  37. package/ai/dist/src/components/charts/ordinal/DotPlot.js +126 -0
  38. package/ai/dist/src/components/charts/ordinal/GroupedBarChart.js +129 -0
  39. package/ai/dist/src/components/charts/ordinal/Histogram.js +132 -0
  40. package/ai/dist/src/components/charts/ordinal/PieChart.js +128 -0
  41. package/ai/dist/src/components/charts/ordinal/RidgelinePlot.js +130 -0
  42. package/ai/dist/src/components/charts/ordinal/StackedBarChart.js +130 -0
  43. package/ai/dist/src/components/charts/ordinal/SwarmPlot.js +147 -0
  44. package/ai/dist/src/components/charts/ordinal/ViolinPlot.js +138 -0
  45. package/ai/dist/src/components/charts/realtime/RealtimeHeatmap.js +79 -0
  46. package/ai/dist/src/components/charts/realtime/RealtimeHistogram.js +114 -0
  47. package/ai/dist/src/components/charts/realtime/RealtimeLineChart.js +93 -0
  48. package/ai/dist/src/components/charts/realtime/RealtimeSwarmChart.js +105 -0
  49. package/ai/dist/src/components/charts/realtime/RealtimeWaterfallChart.js +106 -0
  50. package/ai/dist/src/components/charts/shared/ChartError.js +72 -0
  51. package/ai/dist/src/components/charts/shared/colorUtils.js +138 -0
  52. package/ai/dist/src/components/charts/shared/formatUtils.js +213 -0
  53. package/ai/dist/src/components/charts/shared/hooks.js +49 -0
  54. package/ai/dist/src/components/charts/shared/legendUtils.js +57 -0
  55. package/ai/dist/src/components/charts/shared/selectionUtils.js +67 -0
  56. package/ai/dist/src/components/charts/shared/tooltipUtils.js +79 -0
  57. package/ai/dist/src/components/charts/shared/types.js +2 -0
  58. package/ai/dist/src/components/charts/shared/validateChartData.js +82 -0
  59. package/ai/dist/src/components/charts/shared/validateProps.js +736 -0
  60. package/ai/dist/src/components/charts/xy/AreaChart.js +230 -0
  61. package/ai/dist/src/components/charts/xy/BubbleChart.js +251 -0
  62. package/ai/dist/src/components/charts/xy/Heatmap.js +235 -0
  63. package/ai/dist/src/components/charts/xy/LineChart.js +307 -0
  64. package/ai/dist/src/components/charts/xy/MinimapChart.js +298 -0
  65. package/ai/dist/src/components/charts/xy/Scatterplot.js +172 -0
  66. package/ai/dist/src/components/charts/xy/ScatterplotMatrix.js +426 -0
  67. package/ai/dist/src/components/charts/xy/StackedAreaChart.js +231 -0
  68. package/ai/dist/src/components/constants/coordinateNames.js +11 -0
  69. package/ai/dist/src/components/constants/frame_props.js +251 -0
  70. package/ai/dist/src/components/data/dataFunctions.js +487 -0
  71. package/ai/dist/src/components/data/multiAccessorUtils.js +14 -0
  72. package/ai/dist/src/components/data/transforms.js +143 -0
  73. package/ai/dist/src/components/data/unflowedFunctions.js +5 -0
  74. package/ai/dist/src/components/export/exportChart.js +121 -0
  75. package/ai/dist/src/components/generic_utilities/functions.js +5 -0
  76. package/ai/dist/src/components/geometry/areaDrawing.js +312 -0
  77. package/ai/dist/src/components/geometry/contourLayout.js +73 -0
  78. package/ai/dist/src/components/geometry/hexbinLayout.js +163 -0
  79. package/ai/dist/src/components/geometry/lineDrawing.js +356 -0
  80. package/ai/dist/src/components/geometry/sankeyLinks.js +331 -0
  81. package/ai/dist/src/components/geometry/summaryLayouts.js +136 -0
  82. package/ai/dist/src/components/index.js +18 -0
  83. package/ai/dist/src/components/processing/InteractionItems.js +223 -0
  84. package/ai/dist/src/components/processing/hierarchyUtils.js +104 -0
  85. package/ai/dist/src/components/processing/layouts/chordLayout.js +58 -0
  86. package/ai/dist/src/components/processing/layouts/forceLayout.js +142 -0
  87. package/ai/dist/src/components/processing/layouts/hierarchyLayout.js +31 -0
  88. package/ai/dist/src/components/processing/layouts/index.js +32 -0
  89. package/ai/dist/src/components/processing/layouts/sankeyLayout.js +96 -0
  90. package/ai/dist/src/components/processing/layouts/simpleLayouts.js +34 -0
  91. package/ai/dist/src/components/processing/layouts/types.js +2 -0
  92. package/ai/dist/src/components/processing/networkDefaults.js +39 -0
  93. package/ai/dist/src/components/realtime/BinAccumulator.js +36 -0
  94. package/ai/dist/src/components/realtime/IncrementalExtent.js +55 -0
  95. package/ai/dist/src/components/realtime/RingBuffer.js +104 -0
  96. package/ai/dist/src/components/realtime/renderers/barRenderer.js +133 -0
  97. package/ai/dist/src/components/realtime/renderers/candlestickRenderer.js +7 -0
  98. package/ai/dist/src/components/realtime/renderers/lineRenderer.js +164 -0
  99. package/ai/dist/src/components/realtime/renderers/swarmRenderer.js +91 -0
  100. package/ai/dist/src/components/realtime/renderers/types.js +2 -0
  101. package/ai/dist/src/components/realtime/renderers/waterfallRenderer.js +163 -0
  102. package/ai/dist/src/components/realtime/types.js +2 -0
  103. package/ai/dist/src/components/semiotic-ai.js +89 -0
  104. package/ai/dist/src/components/semiotic-data.js +12 -0
  105. package/ai/dist/src/components/semiotic-network.js +38 -0
  106. package/ai/dist/src/components/semiotic-ordinal.js +28 -0
  107. package/ai/dist/src/components/semiotic-realtime.js +30 -0
  108. package/ai/dist/src/components/semiotic-server.js +8 -0
  109. package/ai/dist/src/components/semiotic-xy.js +35 -0
  110. package/ai/dist/src/components/semiotic.js +109 -0
  111. package/ai/dist/src/components/server/renderToStaticSVG.js +594 -0
  112. package/ai/dist/src/components/store/SelectionStore.js +91 -0
  113. package/ai/dist/src/components/store/ThemeStore.js +78 -0
  114. package/ai/dist/src/components/store/TooltipStore.js +13 -0
  115. package/ai/dist/src/components/store/createStore.js +81 -0
  116. package/ai/dist/src/components/store/useSelection.js +133 -0
  117. package/ai/dist/src/components/stream/CanvasHitTester.js +164 -0
  118. package/ai/dist/src/components/stream/DataSourceAdapter.js +99 -0
  119. package/ai/dist/src/components/stream/MarginalGraphics.js +266 -0
  120. package/ai/dist/src/components/stream/NetworkCanvasHitTester.js +228 -0
  121. package/ai/dist/src/components/stream/NetworkPipelineStore.js +498 -0
  122. package/ai/dist/src/components/stream/NetworkSVGOverlay.js +70 -0
  123. package/ai/dist/src/components/stream/NetworkSceneGraph.js +38 -0
  124. package/ai/dist/src/components/stream/OrdinalCanvasHitTester.js +146 -0
  125. package/ai/dist/src/components/stream/OrdinalPipelineStore.js +786 -0
  126. package/ai/dist/src/components/stream/OrdinalSVGOverlay.js +130 -0
  127. package/ai/dist/src/components/stream/ParticlePool.js +174 -0
  128. package/ai/dist/src/components/stream/PipelineStore.js +1243 -0
  129. package/ai/dist/src/components/stream/SVGOverlay.js +129 -0
  130. package/ai/dist/src/components/stream/SceneGraph.js +132 -0
  131. package/ai/dist/src/components/stream/StreamNetworkFrame.js +561 -0
  132. package/ai/dist/src/components/stream/StreamOrdinalFrame.js +492 -0
  133. package/ai/dist/src/components/stream/StreamXYFrame.js +590 -0
  134. package/ai/dist/src/components/stream/accessorUtils.js +20 -0
  135. package/ai/dist/src/components/stream/index.js +32 -0
  136. package/ai/dist/src/components/stream/layouts/chordLayoutPlugin.js +352 -0
  137. package/ai/dist/src/components/stream/layouts/forceLayoutPlugin.js +230 -0
  138. package/ai/dist/src/components/stream/layouts/hierarchyLayoutPlugin.js +568 -0
  139. package/ai/dist/src/components/stream/layouts/index.js +28 -0
  140. package/ai/dist/src/components/stream/layouts/sankeyLayoutPlugin.js +245 -0
  141. package/ai/dist/src/components/stream/networkTypes.js +17 -0
  142. package/ai/dist/src/components/stream/ordinalSceneBuilders/barScene.js +126 -0
  143. package/ai/dist/src/components/stream/ordinalSceneBuilders/connectorScene.js +62 -0
  144. package/ai/dist/src/components/stream/ordinalSceneBuilders/pieScene.js +33 -0
  145. package/ai/dist/src/components/stream/ordinalSceneBuilders/pointScene.js +63 -0
  146. package/ai/dist/src/components/stream/ordinalSceneBuilders/statisticalScene.js +278 -0
  147. package/ai/dist/src/components/stream/ordinalSceneBuilders/timelineScene.js +30 -0
  148. package/ai/dist/src/components/stream/ordinalSceneBuilders/types.js +2 -0
  149. package/ai/dist/src/components/stream/ordinalTypes.js +2 -0
  150. package/ai/dist/src/components/stream/renderers/areaCanvasRenderer.js +48 -0
  151. package/ai/dist/src/components/stream/renderers/barCanvasRenderer.js +70 -0
  152. package/ai/dist/src/components/stream/renderers/boxplotCanvasRenderer.js +75 -0
  153. package/ai/dist/src/components/stream/renderers/candlestickCanvasRenderer.js +28 -0
  154. package/ai/dist/src/components/stream/renderers/connectorCanvasRenderer.js +47 -0
  155. package/ai/dist/src/components/stream/renderers/heatmapCanvasRenderer.js +31 -0
  156. package/ai/dist/src/components/stream/renderers/lineCanvasRenderer.js +140 -0
  157. package/ai/dist/src/components/stream/renderers/networkArcRenderer.js +38 -0
  158. package/ai/dist/src/components/stream/renderers/networkCircleRenderer.js +37 -0
  159. package/ai/dist/src/components/stream/renderers/networkEdgeRenderer.js +102 -0
  160. package/ai/dist/src/components/stream/renderers/networkParticleRenderer.js +63 -0
  161. package/ai/dist/src/components/stream/renderers/networkRectRenderer.js +35 -0
  162. package/ai/dist/src/components/stream/renderers/pointCanvasRenderer.js +38 -0
  163. package/ai/dist/src/components/stream/renderers/swarmCanvasRenderer.js +10 -0
  164. package/ai/dist/src/components/stream/renderers/types.js +2 -0
  165. package/ai/dist/src/components/stream/renderers/violinCanvasRenderer.js +47 -0
  166. package/ai/dist/src/components/stream/renderers/waterfallCanvasRenderer.js +38 -0
  167. package/ai/dist/src/components/stream/renderers/wedgeCanvasRenderer.js +33 -0
  168. package/ai/dist/src/components/stream/types.js +2 -0
  169. package/ai/dist/src/components/types/annotationTypes.js +2 -0
  170. package/ai/dist/src/components/types/canvasTypes.js +2 -0
  171. package/ai/dist/src/components/types/generalTypes.js +2 -0
  172. package/ai/dist/src/components/types/interactionTypes.js +2 -0
  173. package/ai/dist/src/components/types/legendTypes.js +2 -0
  174. package/ai/dist/src/components/types/networkTypes.js +2 -0
  175. package/ai/dist/src/components/types/ordinalTypes.js +2 -0
  176. package/ai/dist/src/components/types/xyTypes.js +2 -0
  177. package/ai/dist/src/components/useBoundingRect.js +24 -0
  178. package/ai/dist/src/components/visualizationLayerBehavior/axis.js +301 -0
  179. package/ai/dist/src/components/visualizationLayerBehavior/general.js +435 -0
  180. package/ai/dist/src/setupTests.js +4 -0
  181. package/ai/examples.md +489 -0
  182. package/ai/schema.json +1338 -0
  183. package/ai/system-prompt.md +41 -0
  184. package/dist/AnnotationLayer/AnnotationLayer.d.ts +0 -1
  185. package/dist/Axis/axisTitle.d.ts +3 -3
  186. package/dist/Axis/summaryGraphic.d.ts +1 -1
  187. package/dist/ChartErrorBoundary.d.ts +39 -0
  188. package/dist/LinkedCharts.d.ts +42 -0
  189. package/dist/ThemeProvider.d.ts +12 -0
  190. package/dist/Tooltip/Tooltip.d.ts +141 -0
  191. package/dist/TooltipPositioner/index.d.ts +1 -1
  192. package/dist/annotationLayerBehavior/annotationHandling.d.ts +2 -2
  193. package/dist/annotationRules/networkframeRules.d.ts +2 -2
  194. package/dist/annotationRules/xyframeRules.d.ts +2 -2
  195. package/dist/batchWork.d.ts +1 -1
  196. package/dist/charts/index.d.ts +74 -0
  197. package/dist/charts/network/ChordDiagram.d.ts +36 -0
  198. package/dist/charts/network/CirclePack.d.ts +32 -0
  199. package/dist/charts/network/ForceDirectedGraph.d.ts +38 -0
  200. package/dist/charts/network/SankeyDiagram.d.ts +38 -0
  201. package/dist/charts/network/TreeDiagram.d.ts +34 -0
  202. package/dist/charts/network/Treemap.d.ts +33 -0
  203. package/dist/charts/ordinal/BarChart.d.ts +32 -0
  204. package/dist/charts/ordinal/BoxPlot.d.ts +27 -0
  205. package/dist/charts/ordinal/DonutChart.d.ts +23 -0
  206. package/dist/charts/ordinal/DotPlot.d.ts +27 -0
  207. package/dist/charts/ordinal/GroupedBarChart.d.ts +26 -0
  208. package/dist/charts/ordinal/Histogram.d.ts +26 -0
  209. package/dist/charts/ordinal/PieChart.d.ts +21 -0
  210. package/dist/charts/ordinal/RidgelinePlot.d.ts +34 -0
  211. package/dist/charts/ordinal/StackedBarChart.d.ts +27 -0
  212. package/dist/charts/ordinal/SwarmPlot.d.ts +29 -0
  213. package/dist/charts/ordinal/ViolinPlot.d.ts +28 -0
  214. package/dist/charts/realtime/RealtimeHeatmap.d.ts +95 -0
  215. package/dist/charts/realtime/RealtimeHistogram.d.ts +119 -0
  216. package/dist/charts/realtime/RealtimeLineChart.d.ts +98 -0
  217. package/dist/charts/realtime/RealtimeSwarmChart.d.ts +100 -0
  218. package/dist/charts/realtime/RealtimeWaterfallChart.d.ts +97 -0
  219. package/dist/charts/shared/ChartError.d.ts +19 -0
  220. package/dist/charts/shared/colorUtils.d.ts +62 -0
  221. package/dist/charts/shared/formatUtils.d.ts +94 -0
  222. package/dist/charts/shared/hooks.d.ts +20 -0
  223. package/dist/charts/shared/legendUtils.d.ts +32 -0
  224. package/dist/charts/shared/selectionUtils.d.ts +51 -0
  225. package/dist/charts/shared/tooltipUtils.d.ts +18 -0
  226. package/dist/charts/shared/types.d.ts +97 -0
  227. package/dist/charts/shared/validateChartData.d.ts +41 -0
  228. package/dist/charts/shared/validateProps.d.ts +18 -0
  229. package/dist/charts/xy/AreaChart.d.ts +130 -0
  230. package/dist/charts/xy/BubbleChart.d.ts +164 -0
  231. package/dist/charts/xy/Heatmap.d.ts +156 -0
  232. package/dist/charts/xy/LineChart.d.ts +196 -0
  233. package/dist/charts/xy/MinimapChart.d.ts +73 -0
  234. package/dist/charts/xy/Scatterplot.d.ts +55 -0
  235. package/dist/charts/xy/ScatterplotMatrix.d.ts +71 -0
  236. package/dist/charts/xy/StackedAreaChart.d.ts +134 -0
  237. package/dist/constants/frame_props.d.ts +9 -0
  238. package/dist/data/dataFunctions.d.ts +10 -11
  239. package/dist/data/transforms.d.ts +45 -0
  240. package/dist/export/exportChart.d.ts +16 -0
  241. package/dist/{svg → geometry}/areaDrawing.d.ts +3 -13
  242. package/dist/geometry/contourLayout.d.ts +6 -0
  243. package/dist/geometry/hexbinLayout.d.ts +7 -0
  244. package/dist/{svg → geometry}/lineDrawing.d.ts +7 -35
  245. package/dist/geometry/sankeyLinks.d.ts +2 -0
  246. package/dist/geometry/summaryLayouts.d.ts +45 -0
  247. package/dist/index.d.ts +1 -125
  248. package/dist/network.js +7495 -0
  249. package/dist/network.js.map +1 -0
  250. package/dist/network.min.js +1 -0
  251. package/dist/network.module.js +7458 -0
  252. package/dist/network.module.js.map +1 -0
  253. package/dist/network.module.min.js +1 -0
  254. package/dist/ordinal.js +6497 -0
  255. package/dist/ordinal.js.map +1 -0
  256. package/dist/ordinal.min.js +1 -0
  257. package/dist/ordinal.module.js +6465 -0
  258. package/dist/ordinal.module.js.map +1 -0
  259. package/dist/ordinal.module.min.js +1 -0
  260. package/dist/processing/InteractionItems.d.ts +5 -4
  261. package/dist/processing/hierarchyUtils.d.ts +16 -0
  262. package/dist/processing/layouts/chordLayout.d.ts +2 -0
  263. package/dist/processing/layouts/forceLayout.d.ts +3 -0
  264. package/dist/processing/layouts/hierarchyLayout.d.ts +10 -0
  265. package/dist/processing/layouts/index.d.ts +8 -0
  266. package/dist/processing/layouts/sankeyLayout.d.ts +8 -0
  267. package/dist/processing/layouts/simpleLayouts.d.ts +7 -0
  268. package/dist/processing/layouts/types.d.ts +17 -0
  269. package/dist/processing/networkDefaults.d.ts +36 -0
  270. package/dist/realtime/BinAccumulator.d.ts +8 -0
  271. package/dist/realtime/IncrementalExtent.d.ts +13 -0
  272. package/dist/realtime/RingBuffer.d.ts +19 -0
  273. package/dist/realtime/renderers/barRenderer.d.ts +2 -0
  274. package/dist/realtime/renderers/candlestickRenderer.d.ts +2 -0
  275. package/dist/realtime/renderers/lineRenderer.d.ts +2 -0
  276. package/dist/realtime/renderers/swarmRenderer.d.ts +2 -0
  277. package/dist/realtime/renderers/types.d.ts +9 -0
  278. package/dist/realtime/renderers/waterfallRenderer.d.ts +3 -0
  279. package/dist/realtime/types.d.ts +113 -0
  280. package/dist/realtime.js +7072 -0
  281. package/dist/realtime.js.map +1 -0
  282. package/dist/realtime.min.js +1 -0
  283. package/dist/realtime.module.js +7043 -0
  284. package/dist/realtime.module.js.map +1 -0
  285. package/dist/realtime.module.min.js +1 -0
  286. package/dist/semiotic-ai.d.ts +36 -0
  287. package/dist/semiotic-ai.js +13323 -0
  288. package/dist/semiotic-ai.js.map +1 -0
  289. package/dist/semiotic-ai.min.js +1 -0
  290. package/dist/semiotic-ai.module.js +13264 -0
  291. package/dist/semiotic-ai.module.js.map +1 -0
  292. package/dist/semiotic-ai.module.min.js +1 -0
  293. package/dist/semiotic-data.d.ts +5 -0
  294. package/dist/semiotic-data.js +141 -0
  295. package/dist/semiotic-data.js.map +1 -0
  296. package/dist/semiotic-data.min.js +1 -0
  297. package/dist/semiotic-data.module.js +136 -0
  298. package/dist/semiotic-data.module.js.map +1 -0
  299. package/dist/semiotic-data.module.min.js +1 -0
  300. package/dist/semiotic-network.d.ts +23 -0
  301. package/dist/semiotic-ordinal.d.ts +19 -0
  302. package/dist/semiotic-realtime.d.ts +22 -0
  303. package/dist/semiotic-server.d.ts +1 -0
  304. package/dist/semiotic-xy.d.ts +21 -0
  305. package/dist/semiotic.d.ts +41 -28
  306. package/dist/semiotic.js +16257 -13130
  307. package/dist/semiotic.js.map +1 -0
  308. package/dist/semiotic.min.js +1 -0
  309. package/dist/semiotic.module.js +16198 -13100
  310. package/dist/semiotic.module.js.map +1 -0
  311. package/dist/semiotic.module.min.js +1 -0
  312. package/dist/server/renderToStaticSVG.d.ts +9 -0
  313. package/dist/server.js +5191 -0
  314. package/dist/server.js.map +1 -0
  315. package/dist/server.min.js +1 -0
  316. package/dist/server.module.js +5166 -0
  317. package/dist/server.module.js.map +1 -0
  318. package/dist/server.module.min.js +1 -0
  319. package/dist/store/SelectionStore.d.ts +29 -0
  320. package/dist/store/ThemeStore.d.ts +26 -0
  321. package/dist/store/useSelection.d.ts +66 -0
  322. package/dist/stream/CanvasHitTester.d.ts +18 -0
  323. package/dist/stream/DataSourceAdapter.d.ts +32 -0
  324. package/dist/stream/MarginalGraphics.d.ts +19 -0
  325. package/dist/stream/NetworkCanvasHitTester.d.ts +14 -0
  326. package/dist/stream/NetworkPipelineStore.d.ts +74 -0
  327. package/dist/stream/NetworkSVGOverlay.d.ts +40 -0
  328. package/dist/stream/NetworkSceneGraph.d.ts +14 -0
  329. package/dist/stream/OrdinalCanvasHitTester.d.ts +9 -0
  330. package/dist/stream/OrdinalPipelineStore.d.ts +65 -0
  331. package/dist/stream/OrdinalSVGOverlay.d.ts +34 -0
  332. package/dist/stream/ParticlePool.d.ts +28 -0
  333. package/dist/stream/PipelineStore.d.ts +161 -0
  334. package/dist/stream/SVGOverlay.d.ts +37 -0
  335. package/dist/stream/SceneGraph.d.ts +16 -0
  336. package/dist/stream/StreamNetworkFrame.d.ts +4 -0
  337. package/dist/stream/StreamOrdinalFrame.d.ts +4 -0
  338. package/dist/stream/StreamXYFrame.d.ts +4 -0
  339. package/dist/stream/accessorUtils.d.ts +2 -0
  340. package/dist/stream/index.d.ts +16 -0
  341. package/dist/stream/layouts/chordLayoutPlugin.d.ts +8 -0
  342. package/dist/stream/layouts/forceLayoutPlugin.d.ts +9 -0
  343. package/dist/stream/layouts/hierarchyLayoutPlugin.d.ts +17 -0
  344. package/dist/stream/layouts/index.d.ts +11 -0
  345. package/dist/stream/layouts/sankeyLayoutPlugin.d.ts +8 -0
  346. package/dist/stream/networkTypes.d.ts +346 -0
  347. package/dist/stream/ordinalSceneBuilders/barScene.d.ts +4 -0
  348. package/dist/stream/ordinalSceneBuilders/connectorScene.d.ts +3 -0
  349. package/dist/stream/ordinalSceneBuilders/pieScene.d.ts +3 -0
  350. package/dist/stream/ordinalSceneBuilders/pointScene.d.ts +4 -0
  351. package/dist/stream/ordinalSceneBuilders/statisticalScene.d.ts +6 -0
  352. package/dist/stream/ordinalSceneBuilders/timelineScene.d.ts +3 -0
  353. package/dist/stream/ordinalSceneBuilders/types.d.ts +21 -0
  354. package/dist/stream/ordinalTypes.d.ts +225 -0
  355. package/dist/stream/renderers/areaCanvasRenderer.d.ts +7 -0
  356. package/dist/stream/renderers/barCanvasRenderer.d.ts +7 -0
  357. package/dist/stream/renderers/boxplotCanvasRenderer.d.ts +2 -0
  358. package/dist/stream/renderers/candlestickCanvasRenderer.d.ts +2 -0
  359. package/dist/stream/renderers/connectorCanvasRenderer.d.ts +2 -0
  360. package/dist/stream/renderers/heatmapCanvasRenderer.d.ts +6 -0
  361. package/dist/stream/renderers/lineCanvasRenderer.d.ts +8 -0
  362. package/dist/stream/renderers/networkArcRenderer.d.ts +5 -0
  363. package/dist/stream/renderers/networkCircleRenderer.d.ts +5 -0
  364. package/dist/stream/renderers/networkEdgeRenderer.d.ts +10 -0
  365. package/dist/stream/renderers/networkParticleRenderer.d.ts +11 -0
  366. package/dist/stream/renderers/networkRectRenderer.d.ts +5 -0
  367. package/dist/stream/renderers/pointCanvasRenderer.d.ts +7 -0
  368. package/dist/stream/renderers/swarmCanvasRenderer.d.ts +7 -0
  369. package/dist/stream/renderers/types.d.ts +7 -0
  370. package/dist/stream/renderers/violinCanvasRenderer.d.ts +2 -0
  371. package/dist/stream/renderers/waterfallCanvasRenderer.d.ts +8 -0
  372. package/dist/stream/renderers/wedgeCanvasRenderer.d.ts +2 -0
  373. package/dist/stream/types.d.ts +307 -0
  374. package/dist/types/annotationTypes.d.ts +13 -18
  375. package/dist/types/canvasTypes.d.ts +1 -1
  376. package/dist/types/generalTypes.d.ts +41 -36
  377. package/dist/types/interactionTypes.d.ts +7 -9
  378. package/dist/types/legendTypes.d.ts +2 -2
  379. package/dist/types/networkTypes.d.ts +40 -30
  380. package/dist/types/ordinalTypes.d.ts +27 -18
  381. package/dist/types/xyTypes.d.ts +1 -95
  382. package/dist/visualizationLayerBehavior/axis.d.ts +3 -5
  383. package/dist/visualizationLayerBehavior/general.d.ts +8 -12
  384. package/dist/xy.js +6993 -0
  385. package/dist/xy.js.map +1 -0
  386. package/dist/xy.min.js +1 -0
  387. package/dist/xy.module.js +6957 -0
  388. package/dist/xy.module.js.map +1 -0
  389. package/dist/xy.module.min.js +1 -0
  390. package/package.json +123 -67
  391. package/dist/AnnotationLayer/helpers.d.ts +0 -6
  392. package/dist/AnnotationLayer/index.d.ts +0 -2
  393. package/dist/FacetController.d.ts +0 -12
  394. package/dist/Frame.d.ts +0 -2
  395. package/dist/InteractionLayer.d.ts +0 -3
  396. package/dist/Mark/Mark.d.ts +0 -3
  397. package/dist/Mark/Mark.types.d.ts +0 -10
  398. package/dist/Mark/constants/markTransition.d.ts +0 -10
  399. package/dist/Mark/markBehavior/drawing.d.ts +0 -13
  400. package/dist/MiniMap.d.ts +0 -14
  401. package/dist/MinimapXYFrame.d.ts +0 -10
  402. package/dist/NetworkFrame.d.ts +0 -4
  403. package/dist/OrdinalFrame.d.ts +0 -4
  404. package/dist/ResponsiveFrame.d.ts +0 -22
  405. package/dist/ResponsiveMinimapXYFrame.d.ts +0 -6
  406. package/dist/ResponsiveNetworkFrame.d.ts +0 -6
  407. package/dist/ResponsiveOrdinalFrame.d.ts +0 -6
  408. package/dist/ResponsiveXYFrame.d.ts +0 -6
  409. package/dist/SpanOrDiv.d.ts +0 -10
  410. package/dist/SparkFrame.d.ts +0 -14
  411. package/dist/SparkNetworkFrame.d.ts +0 -5
  412. package/dist/SparkOrdinalFrame.d.ts +0 -5
  413. package/dist/SparkXYFrame.d.ts +0 -5
  414. package/dist/VisualizationLayer.d.ts +0 -33
  415. package/dist/XYFrame.d.ts +0 -4
  416. package/dist/annotationRules/orframeRules.d.ts +0 -105
  417. package/dist/components/Annotation.d.ts +0 -3
  418. package/dist/components/AnnotationLayer/AnnotationLayer.d.ts +0 -26
  419. package/dist/components/Axis/Axis.d.ts +0 -7
  420. package/dist/components/Axis/axisTitle.d.ts +0 -10
  421. package/dist/components/Axis/index.d.ts +0 -2
  422. package/dist/components/Axis/summaryGraphic.d.ts +0 -17
  423. package/dist/components/Brush.d.ts +0 -12
  424. package/dist/components/DividedLine.d.ts +0 -16
  425. package/dist/components/FacetController.d.ts +0 -12
  426. package/dist/components/Frame.d.ts +0 -2
  427. package/dist/components/InteractionLayer.d.ts +0 -3
  428. package/dist/components/Legend.d.ts +0 -3
  429. package/dist/components/Mark/Mark.d.ts +0 -3
  430. package/dist/components/Mark/Mark.types.d.ts +0 -10
  431. package/dist/components/Mark/markBehavior/drawing.d.ts +0 -13
  432. package/dist/components/MiniMap.d.ts +0 -14
  433. package/dist/components/MinimapXYFrame.d.ts +0 -10
  434. package/dist/components/NetworkFrame.d.ts +0 -4
  435. package/dist/components/OrdinalFrame.d.ts +0 -4
  436. package/dist/components/ResponsiveFrame.d.ts +0 -22
  437. package/dist/components/ResponsiveMinimapXYFrame.d.ts +0 -6
  438. package/dist/components/ResponsiveNetworkFrame.d.ts +0 -6
  439. package/dist/components/ResponsiveOrdinalFrame.d.ts +0 -6
  440. package/dist/components/ResponsiveXYFrame.d.ts +0 -6
  441. package/dist/components/SpanOrDiv.d.ts +0 -10
  442. package/dist/components/SparkFrame.d.ts +0 -14
  443. package/dist/components/SparkNetworkFrame.d.ts +0 -5
  444. package/dist/components/SparkOrdinalFrame.d.ts +0 -5
  445. package/dist/components/SparkXYFrame.d.ts +0 -5
  446. package/dist/components/TooltipPositioner/index.d.ts +0 -7
  447. package/dist/components/VisualizationLayer.d.ts +0 -33
  448. package/dist/components/XYFrame.d.ts +0 -4
  449. package/dist/components/annotationLayerBehavior/annotationHandling.d.ts +0 -19
  450. package/dist/components/annotationLayerBehavior/d3labeler.d.ts +0 -9
  451. package/dist/components/annotationRules/baseRules.d.ts +0 -25
  452. package/dist/components/annotationRules/networkframeRules.d.ts +0 -48
  453. package/dist/components/annotationRules/orframeRules.d.ts +0 -105
  454. package/dist/components/annotationRules/xyframeRules.d.ts +0 -117
  455. package/dist/components/batchWork.d.ts +0 -6
  456. package/dist/components/constants/coordinateNames.d.ts +0 -8
  457. package/dist/components/constants/frame_props.d.ts +0 -4
  458. package/dist/components/constants/jsx.d.ts +0 -19
  459. package/dist/components/data/dataFunctions.d.ts +0 -46
  460. package/dist/components/data/multiAccessorUtils.d.ts +0 -1
  461. package/dist/components/data/unflowedFunctions.d.ts +0 -1
  462. package/dist/components/generic_utilities/functions.d.ts +0 -1
  463. package/dist/components/index.d.ts +0 -125
  464. package/dist/components/interactionLayerBehavior/InteractionCanvas.d.ts +0 -20
  465. package/dist/components/processing/InteractionItems.d.ts +0 -12
  466. package/dist/components/processing/network.d.ts +0 -114
  467. package/dist/components/processing/ordinal.d.ts +0 -102
  468. package/dist/components/processing/xyDrawing.d.ts +0 -135
  469. package/dist/components/semiotic.d.ts +0 -35
  470. package/dist/components/store/TooltipStore.d.ts +0 -2
  471. package/dist/components/store/createStore.d.ts +0 -1
  472. package/dist/components/svg/SvgHelper.d.ts +0 -37
  473. package/dist/components/svg/areaDrawing.d.ts +0 -31
  474. package/dist/components/svg/ckmeans.d.ts +0 -69
  475. package/dist/components/svg/frameFunctions.d.ts +0 -119
  476. package/dist/components/svg/lineDrawing.d.ts +0 -99
  477. package/dist/components/svg/networkDrawing.d.ts +0 -134
  478. package/dist/components/svg/pieceDrawing.d.ts +0 -13
  479. package/dist/components/svg/pieceLayouts.d.ts +0 -71
  480. package/dist/components/svg/summaryLayouts.d.ts +0 -74
  481. package/dist/components/types/annotationTypes.d.ts +0 -140
  482. package/dist/components/types/canvasTypes.d.ts +0 -9
  483. package/dist/components/types/generalTypes.d.ts +0 -236
  484. package/dist/components/types/interactionTypes.d.ts +0 -74
  485. package/dist/components/types/legendTypes.d.ts +0 -20
  486. package/dist/components/types/networkTypes.d.ts +0 -165
  487. package/dist/components/types/ordinalTypes.d.ts +0 -103
  488. package/dist/components/types/xyTypes.d.ts +0 -118
  489. package/dist/components/useBoundingRect.d.ts +0 -2
  490. package/dist/components/useDerivedStateFromProps.d.ts +0 -1
  491. package/dist/components/useLegacyUnmountCallback.d.ts +0 -1
  492. package/dist/components/visualizationLayerBehavior/axis.d.ts +0 -38
  493. package/dist/components/visualizationLayerBehavior/general.d.ts +0 -84
  494. package/dist/constants/jsx.d.ts +0 -19
  495. package/dist/interactionLayerBehavior/InteractionCanvas.d.ts +0 -20
  496. package/dist/processing/network.d.ts +0 -114
  497. package/dist/processing/ordinal.d.ts +0 -102
  498. package/dist/processing/xyDrawing.d.ts +0 -135
  499. package/dist/setupTests.d.ts +0 -1
  500. package/dist/svg/SvgHelper.d.ts +0 -37
  501. package/dist/svg/ckmeans.d.ts +0 -69
  502. package/dist/svg/frameFunctions.d.ts +0 -119
  503. package/dist/svg/networkDrawing.d.ts +0 -134
  504. package/dist/svg/pieceDrawing.d.ts +0 -13
  505. package/dist/svg/pieceLayouts.d.ts +0 -71
  506. package/dist/svg/summaryLayouts.d.ts +0 -74
  507. package/dist/useDerivedStateFromProps.d.ts +0 -1
  508. package/dist/useLegacyUnmountCallback.d.ts +0 -1
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react"),t=require("d3-brush"),n=require("d3-selection"),o=require("d3-scale"),r=require("d3-array"),s=require("d3-scale-chromatic"),i=require("d3-interpolate"),a=require("d3-sankey-circular"),l=require("d3-shape"),c=require("d3-force"),u=require("d3-chord"),d=require("d3-hierarchy");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 p=h(e),g=5e3;class y{constructor(e){this.lastBoundedData=null,this.chunkTimer=0,this.callback=e}setBoundedData(e){if(e===this.lastBoundedData)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),5e3>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,g),bounded:!0,totalSize:e.length});let t=g;const n=()=>{if(t>=e.length)return;if(e!==this.lastBoundedData)return;const o=Math.min(t+g,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}push(e){this.callback({inserts:[e],bounded:!1})}pushMany(e){0!==e.length&&this.callback({inserts:e,bounded:!1})}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null}}class f{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;const t=this;return{next:()=>t._size>e?{done:!1,value:t.get(e++)}:{done:!0,value:void 0}}}toArray(){const e=[];for(const t of this)e.push(t);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}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class m{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function v(e,t,n,o,r){const s=new Map;for(const i of e){const e=t(i),a=n(i);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/o)*o;let c=s.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},s.set(l,c)),c.total+=a,r){const e=r(i);c.categories.set(e,(c.categories.get(e)||0)+a)}}return s}function b(e,t,n,o,r,s){const i=[],a=[];for(const r of e){const e=n(r),s=o(r);null==e||null==s||Number.isNaN(e)||Number.isNaN(s)||(i.push([t.x(e),t.y(s)]),a.push(s))}return{type:"line",path:i,rawValues:a,style:r,datum:e,group:s}}function x(e,t,n,o,r,s,i){const a=[],l=[];for(const s of e){const e=n(s),i=o(s);if(null==e||null==i||Number.isNaN(e)||Number.isNaN(i))continue;const c=t.x(e);a.push([c,t.y(i)]),l.push([c,t.y(r)])}return{type:"area",topPath:a,bottomPath:l,style:s,datum:e,group:i}}function A(e,t,n,o,r,s){const i=n(e),a=o(e);return null==i||null==a||Number.isNaN(i)||Number.isNaN(a)?null:{type:"point",x:t.x(i),y:t.y(a),r:r,style:s,datum:e}}function w(e,t,n,o,r,s,i){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:s,group:i}}function k(e,t,n,o,r,s){return{type:"heatcell",x:e,y:t,w:n,h:o,fill:r,datum:s}}function S(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function E(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}class M{constructor(e){this.xExtent=new m,this.yExtent=new m,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.lastIngestTime=0,this.scales=null,this.scene=[],this.version=0,this.config=e,this.buffer=new f(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=S(e.timeAccessor||e.xAccessor,"time"),this.getY=S(e.valueAccessor||e.yAccessor,"value")):(this.getX=S(e.xAccessor,"x"),this.getY=S(e.yAccessor,"y")),this.getGroup=E(e.groupAccessor),this.getCategory=E(e.categoryAccessor),this.getSize=e.sizeAccessor?S(e.sizeAccessor,"size"):void 0,this.getColor=E(e.colorAccessor),this.getBounds=e.boundsAccessor?S(e.boundsAccessor,"bounds"):void 0,"candlestick"===e.chartType&&(this.getOpen=S(e.openAccessor,"open"),this.getHigh=S(e.highAccessor,"high"),this.getLow=S(e.lowAccessor,"low"),this.getClose=S(e.closeAccessor,"close")),e.pulse&&(this.timestampBuffer=new f(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,e.bounded){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n))):this.yExtent.push(this.getY(n))}else for(const n of e.inserts){"growing"===this.config.windowMode&&this.buffer.full&&(this.growingCap*=2,this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap));const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n))):this.yExtent.push(this.getY(n)),null!=e&&(this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):this.yExtent.evict(this.getY(e)))}return!0}computeScene(e){var t,n,r,s,i,a;const{config:l,buffer:c}=this;if(this.xExtent.dirty&&this.xExtent.recalculate(c,this.getX),this.yExtent.dirty)if("candlestick"===l.chartType&&this.getHigh&&this.getLow){this.yExtent.clear();for(const e of c)this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))}else this.yExtent.recalculate(c,this.getY);const u=this.xExtent.extent,d=this.yExtent.extent;let h=l.xExtent?[null!==(t=l.xExtent[0])&&void 0!==t?t:u[0],null!==(n=l.xExtent[1])&&void 0!==n?n:u[1]]:u,p=l.yExtent?[null!==(r=l.yExtent[0])&&void 0!==r?r:d[0],null!==(s=l.yExtent[1])&&void 0!==s?s:d[1]]:d;const g=l.yExtent&&null!=l.yExtent[0]&&null!=l.yExtent[1];if("stackedarea"===l.chartType&&!g&&c.size>0)if(l.normalize)p=[0,1+l.extentPadding];else{const e=c.toArray(),t=this.groupData(e),n=new Map;for(const e of t)for(const t of e.data){const e=this.getX(t),o=this.getY(t);null==e||null==o||Number.isNaN(e)||Number.isNaN(o)||n.set(e,(n.get(e)||0)+o)}let o=0;for(const e of n.values())e>o&&(o=e);p=[0,o+(o>0?o*l.extentPadding:1)]}else if("bar"===l.chartType&&l.binSize&&!g&&c.size>0){const[,e]=function(e,t,n,o,r){const s=v(e,t,n,o,r);if(0===s.size)return[0,0];let i=0;for(const e of s.values())e.total>i&&(i=e.total);return[0,i]}(c,this.getX,this.getY,l.binSize,this.getCategory);p=[0,e+e*l.extentPadding]}else if("waterfall"===l.chartType&&!g&&c.size>0){const[e,t]=function(e,t){let n=0,o=0,r=0;for(const s of e){const e=t(s);null==e||Number.isNaN(e)||(r+=e,n>r&&(n=r),r>o&&(o=r))}return[n,o]}(c,this.getY),n=t-e,o=n>0?n*l.extentPadding:1;p=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!g&&p[0]!==1/0){if(this.getBounds){const e=c.toArray();for(const t of e){const e=this.getY(t),n=this.getBounds(t);null!=e&&!Number.isNaN(e)&&n&&(e+n>p[1]&&(p[1]=e+n),p[0]>e-n&&(p[0]=e-n))}}const e=p[1]-p[0],t=e>0?e*l.extentPadding:1,n=null===(i=l.yExtent)||void 0===i?void 0:i[0],o=null===(a=l.yExtent)||void 0===a?void 0:a[1];p=[null!=n?p[0]:p[0]-t,null!=o?p[1]:p[1]+t]}if(h[0]!==1/0&&h[1]!==-1/0||(h=[0,1]),p[0]!==1/0&&p[1]!==-1/0||(p=[0,1]),void 0!==l.arrowOfTime)if("x"==("up"===(y=l.arrowOfTime)||"down"===y?"y":"x")){const t="right"===l.arrowOfTime?[0,e.width]:[e.width,0];this.scales={x:o.scaleLinear().domain(h).range(t),y:o.scaleLinear().domain(p).range([e.height,0])}}else{const t="down"===l.arrowOfTime?[0,e.height]:[e.height,0];this.scales={x:o.scaleLinear().domain(p).range([0,e.width]),y:o.scaleLinear().domain(h).range(t)}}else this.scales={x:o.scaleLinear().domain(h).range([0,e.width]),y:o.scaleLinear().domain(p).range([e.height,0])};var y;this.config.transition&&this.scene.length>0&&this.snapshotPositions();const f=c.toArray();this.scene=this.buildSceneNodes(e),this.config.decay&&this.applyDecay(this.scene,f),this.config.pulse&&this.applyPulse(this.scene,f),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}buildSceneNodes(e){const{config:t,buffer:n,scales:o}=this;if(!o||0===n.size)return[];const r=n.toArray();switch(t.chartType){case"line":return this.buildLineScene(r);case"area":return this.buildAreaScene(r);case"stackedarea":return this.buildStackedAreaScene(r);case"scatter":case"bubble":return this.buildPointScene(r);case"heatmap":return this.buildHeatmapScene(r,e);case"bar":return this.buildBarScene(r);case"swarm":return this.buildSwarmScene(r);case"waterfall":return this.buildWaterfallScene(r,e);case"candlestick":return this.buildCandlestickScene(r,e);default:return[]}}buildLineScene(e){var t;const n=this.groupData(e),o=[],r=null===(t=this.config.annotations)||void 0===t?void 0:t.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(this.getBounds)for(const e of n){const t=this.buildBoundsForGroup(e.data,e.key);t&&o.push(t)}for(const e of n){const t=this.resolveLineStyle(e.key,e.data[0]),n=b(e.data,this.scales,this.getX,this.getY,t,e.key);r&&r.length>0&&(n.colorThresholds=r),o.push(n)}return o}buildAreaScene(e){const t=this.groupData(e),n=[],o=this.scales.y.domain()[0];for(const e of t){const t=this.resolveAreaStyle(e.key,e.data[0]);n.push(x(e.data,this.scales,this.getX,this.getY,o,t,e.key))}return n}buildStackedAreaScene(e){return function(e,t,n,o,r,s){var i;const a=new Set;for(const t of e)for(const e of t.data){const t=n(e);null==t||Number.isNaN(t)||a.add(t)}const l=Array.from(a).sort((e,t)=>e-t),c=new Map;for(const t of e){const e=new Map;for(const r of t.data){const t=n(r),s=o(r);null==t||null==s||Number.isNaN(t)||Number.isNaN(s)||e.set(t,(e.get(t)||0)+s)}c.set(t.key,e)}let u;if(s){u=new Map;for(const t of l){let n=0;for(const o of e)n+=(null===(i=c.get(o.key))||void 0===i?void 0:i.get(t))||0;u.set(t,n||1)}}const d=[],h=new Map;for(const e of l)h.set(e,0);for(const n of e){const e=c.get(n.key),o=[],i=[];for(const n of l){let r=e.get(n)||0;const a=h.get(n);s&&(r/=u.get(n));const l=t.x(n);i.push([l,t.y(a)]),o.push([l,t.y(a+r)]),h.set(n,a+r)}d.push({type:"area",topPath:o,bottomPath:i,style:r(n.key,n.data[0]),datum:n.data,group:n.key})}return d}(this.groupData(e),this.scales,this.getX,this.getY,(e,t)=>this.resolveAreaStyle(e,t),this.config.normalize)}buildPointScene(e){const t=[],n="bubble"===this.config.chartType?10:5,o=this.config.sizeRange||[3,15];let r=null;if(this.getSize&&!this.config.pointStyle){const t=e.map(e=>this.getSize(e)).filter(e=>null!=e&&!Number.isNaN(e));if(t.length>0){const e=Math.min(...t),n=Math.max(...t);r=t=>e===n?(o[0]+o[1])/2:o[0]+(t-e)/(n-e)*(o[1]-o[0])}}let s=null;if(this.getColor&&!this.config.pointStyle){const t=new Set;for(const n of e){const e=this.getColor(n);e&&t.add(e)}const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"];s=new Map;let o=0;for(const e of t)s.set(e,n[o%n.length]),o++}for(const o of e){let e=this.config.pointStyle?this.config.pointStyle(o):{fill:"#4e79a7",opacity:.8},i=e.r||n;if(r&&this.getSize){const e=this.getSize(o);null==e||Number.isNaN(e)||(i=r(e))}if(s&&this.getColor){const t=this.getColor(o);t&&s.has(t)&&(e=Object.assign(Object.assign({},e),{fill:s.get(t)}))}const a=A(o,this.scales,this.getX,this.getY,i,e);a&&t.push(a)}return t}buildHeatmapScene(e,t){const n=[];if(this.config.heatmapAggregation)return this.buildStreamingHeatmapScene(e,t);const o=S(this.config.valueAccessor,"value"),r=new Set,s=new Set;for(const t of e)r.add(this.getX(t)),s.add(this.getY(t));const i=Array.from(r).sort((e,t)=>e-t),a=Array.from(s).sort((e,t)=>e-t);if(0===i.length||0===a.length)return n;const l=t.width/i.length,c=t.height/a.length,u=new Map;for(const t of e){const e=`${this.getX(t)}_${this.getY(t)}`;u.set(e,{val:o(t),datum:t})}let d=1/0,h=-1/0;for(const{val:e}of u.values())d>e&&(d=e),e>h&&(h=e);const p=h-d||1;for(let e=0;i.length>e;e++)for(let t=0;a.length>t;t++){const o=u.get(`${i[e]}_${a[t]}`);if(!o)continue;const r=(o.val-d)/p;n.push(k(e*l,(a.length-1-t)*c,l,c,`rgb(${Math.round(220-180*r)},${Math.round(220-100*r)},${Math.round(255-50*r)})`,o.datum))}return n}buildStreamingHeatmapScene(e,t){var n,o,r;const s=[],i=null!==(n=this.config.heatmapXBins)&&void 0!==n?n:20,a=null!==(o=this.config.heatmapYBins)&&void 0!==o?o:20,l=null!==(r=this.config.heatmapAggregation)&&void 0!==r?r:"count",c=S(this.config.valueAccessor,"value");if(!this.scales||0===e.length)return s;const[u,d]=this.scales.x.domain(),[h,p]=this.scales.y.domain(),g=(d-u||1)/i,y=(p-h||1)/a,f=new Map;for(const t of e){const e=this.getX(t),n=this.getY(t),o=Math.min(Math.floor((e-u)/g),i-1),r=Math.min(Math.floor((n-h)/y),a-1);if(0>o||0>r)continue;const s=`${o}_${r}`;let l=f.get(s);l||(l={sum:0,count:0,data:[]},f.set(s,l)),l.count++,l.sum+=c(t),l.data.push(t)}let m=1/0,v=-1/0;const b=new Map;for(const[e,t]of f){let n;switch(l){case"sum":n=t.sum;break;case"mean":n=t.count>0?t.sum/t.count:0;break;default:n=t.count}b.set(e,n),m>n&&(m=n),n>v&&(v=n)}const x=v-m||1,A=t.width/i,w=t.height/a;for(const[e,t]of b){const[n,o]=e.split("_"),r=+n,i=+o,l=(t-m)/x,c=`rgb(${Math.round(220-180*l)},${Math.round(220-100*l)},${Math.round(255-50*l)})`,u=f.get(e);s.push(k(r*A,(a-1-i)*w,A,w,c,{xi:r,yi:i,value:t,count:u.count,sum:u.sum,data:u.data}))}return s}buildBarScene(e){var t;if(!this.config.binSize)return[];const n=v(e,this.getX,this.getY,this.config.binSize,this.getCategory);if(0===n.size)return[];let o=null;if(this.getCategory){const e=new Set;for(const t of n.values())for(const n of t.categories.keys())e.add(n);const t=this.config.barColors?Object.keys(this.config.barColors):[],r=new Set(t),s=Array.from(e).filter(e=>!r.has(e)).sort();o=[...t.filter(t=>e.has(t)),...s]}const r=[],s=this.scales,[i,a]=s.x.domain();for(const e of n.values()){const n=Math.max(e.start,i),l=Math.min(e.end,a);if(n>=l)continue;const c=s.x(n),u=s.x(l),d=Math.min(c,u)+.5,h=Math.max(c,u)-.5-d;if(h>0)if(o&&e.categories.size>0){let n=0;for(const i of o){const o=e.categories.get(i)||0;if(0===o)continue;const a=s.y(n),l=s.y(n+o);r.push(w(d,Math.min(a,l),h,Math.abs(a-l),{fill:(null===(t=this.config.barColors)||void 0===t?void 0:t[i])||"#4e79a7"},{binStart:e.start,binEnd:e.end,total:e.total,category:i,categoryValue:o},i)),n+=o}}else{const t=s.y(0),n=s.y(e.total);r.push(w(d,Math.min(t,n),h,Math.abs(t-n),{fill:"#007bff"},{binStart:e.start,binEnd:e.end,total:e.total}))}}return r}buildSwarmScene(e){var t,n,o,r;const s=[],i=this.config.swarmStyle||{},a=null!==(t=i.radius)&&void 0!==t?t:3,l=null!==(n=i.fill)&&void 0!==n?n:"#007bff",c=null!==(o=i.opacity)&&void 0!==o?o:.7,u=i.stroke,d=i.strokeWidth;for(const t of e){const e=this.getX(t),n=this.getY(t);if(null==n||Number.isNaN(n))continue;const o=this.scales.x(e),i=this.scales.y(n);let h=l;if(this.getCategory){const e=this.getCategory(t);h=(null===(r=this.config.barColors)||void 0===r?void 0:r[e])||h}s.push({type:"point",x:o,y:i,r:a,style:{fill:h,opacity:c,stroke:u,strokeWidth:d},datum:t})}return s}buildWaterfallScene(e,t){const n=[],o=this.scales,r=e.filter(e=>{const t=this.getY(e);return null!=t&&!Number.isNaN(t)});if(0===r.length)return n;let s=0;for(let e=0;r.length>e;e++){const i=r[e],a=this.getX(i),l=this.getY(i),c=s+l;let u;u=r.length-1>e?this.getX(r[e+1])-a:e>0?a-this.getX(r[e-1]):0;const d=o.x(a),h=0!==u?o.x(a+u):d+t.width/10,p=Math.min(d,h)+.5,g=Math.max(d,h)-.5-p;if(0>=g){s=c;continue}const y=o.y(s),f=o.y(c);n.push(w(p,Math.min(y,f),g,Math.abs(y-f),{fill:0>l?"#dc3545":"#28a745"},Object.assign(Object.assign({},i),{baseline:s,cumEnd:c,delta:l}))),s=c}return n}buildCandlestickScene(e,t){if(!(this.getOpen&&this.getHigh&&this.getLow&&this.getClose&&this.scales))return[];const n=[],o=this.config.candlestickStyle||{},r=o.upColor||"#28a745",s=o.downColor||"#dc3545",i=o.wickColor||"#333",a=o.wickWidth||1,l=e.map(e=>this.getX(e)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let c=o.bodyWidth||6;if(!o.bodyWidth&&l.length>1){let e=1/0;for(let t=1;l.length>t;t++){const n=Math.abs(this.scales.x(l[t])-this.scales.x(l[t-1]));n>0&&e>n&&(e=n)}e!==1/0&&(c=Math.max(2,Math.min(.6*e,20)))}for(const t of e){const e=this.getX(t);if(null==e||Number.isNaN(e))continue;const o=this.getOpen(t),l=this.getHigh(t),u=this.getLow(t),d=this.getClose(t);if([o,l,u,d].some(e=>null==e||Number.isNaN(e)))continue;const h=d>=o;n.push({type:"candlestick",x:this.scales.x(e),openY:this.scales.y(o),closeY:this.scales.y(d),highY:this.scales.y(l),lowY:this.scales.y(u),bodyWidth:c,upColor:r,downColor:s,wickColor:i,wickWidth:a,isUp:h,datum:t})}return n}buildBoundsForGroup(e,t){if(!this.getBounds||!this.scales)return null;const n=[],o=[];for(const t of e){const e=this.getX(t),r=this.getY(t);if(null==e||null==r||Number.isNaN(e)||Number.isNaN(r))continue;const s=this.getBounds(t),i=this.scales.x(e);if(s&&0!==s)n.push([i,this.scales.y(r+s)]),o.push([i,this.scales.y(r-s)]);else{const e=this.scales.y(r);n.push([i,e]),o.push([i,e])}}return 2>n.length?null:{type:"area",topPath:n,bottomPath:o,style:this.resolveBoundsStyle(t,e[0]),datum:e,group:t,interactive:!1}}resolveBoundsStyle(e,t){const n=this.config.boundsStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?n:{fill:this.resolveLineStyle(e,t).stroke||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){var n,o,r;const s=this.config.decay;if(!s||1>=t)return 1;const i=null!==(n=s.minOpacity)&&void 0!==n?n:.1,a=t-1-e;switch(s.type){case"linear":return i+(1-a/(t-1))*(1-i);case"exponential":{const e=null!==(o=s.halfLife)&&void 0!==o?o:t/2;return i+Math.pow(.5,a/e)*(1-i)}case"step":return(null!==(r=s.stepThreshold)&&void 0!==r?r:.5*t)>a?1:i;default:return 1}}applyDecay(e,t){var n,o;if(!this.config.decay)return;const r=t.length;if(1>=r)return;const s=new Map;for(let e=0;t.length>e;e++)s.set(t[e],e);for(const t of e){if("line"===t.type||"area"===t.type)continue;const e=s.get(t.datum);if(null==e)continue;const i=this.computeDecayOpacity(e,r);if("heatcell"===t.type)t.style={opacity:i};else if("candlestick"===t.type)t._decayOpacity=i;else{const e=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:e*i})}}}computePulseIntensity(e,t){var n;const o=this.config.pulse;if(!o)return 0;const r=null!==(n=o.duration)&&void 0!==n?n:500,s=t-e;return r>s?1-s/r:0}applyPulse(e,t){var n;if(!this.config.pulse||!this.timestampBuffer)return;const o="undefined"!=typeof performance?performance.now():Date.now(),r=null!==(n=this.config.pulse.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",s=new Map;for(let e=0;t.length>e;e++)s.set(t[e],e);for(const t of e){if("line"===t.type||"area"===t.type)continue;const e=s.get(t.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const i=this.computePulseIntensity(n,o);i>0&&(t._pulseIntensity=i,t._pulseColor=r)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}snapshotPositions(){this.prevPositionMap.clear();for(let e=0;this.scene.length>e;e++){const t=this.scene[e],n=this.getNodeIdentity(t,e);n&&("point"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,r:t.r}):"rect"===t.type||"heatcell"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,w:t.w,h:t.h}):"candlestick"===t.type&&this.prevPositionMap.set(n,{x:t.x,y:t.openY}))}}getNodeIdentity(e,t){var n,o,r,s;switch(e.type){case"point":return`p:${void 0===e.datum?t:this.getX(e.datum)}_${this.getY(e.datum)}`;case"rect":return`r:${e.group||""}:${null!==(s=null!==(o=null===(n=e.datum)||void 0===n?void 0:n.binStart)&&void 0!==o?o:null===(r=e.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:t}`;case"heatcell":return`h:${e.x}_${e.y}`;case"candlestick":return"c:"+this.getX(e.datum);default:return null}}startTransition(){var e,t,n,o,r,s;if(!this.config.transition||0===this.prevPositionMap.size)return;const i=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;let a=!1;for(let e=0;this.scene.length>e;e++){const i=this.scene[e],l=this.getNodeIdentity(i,e);if(!l)continue;const c=this.prevPositionMap.get(l);if(c)if("point"===i.type){const e={x:i.x,y:i.y,r:i.r};c.x===e.x&&c.y===e.y||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.r,i.x=c.x,i.y=c.y,i.r=null!==(t=c.r)&&void 0!==t?t:i.r,a=!0)}else if("rect"===i.type){const e={x:i.x,y:i.y,w:i.w,h:i.h};c.x===e.x&&c.y===e.y&&c.w===e.w&&c.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=c.x,i.y=c.y,i.w=null!==(n=c.w)&&void 0!==n?n:i.w,i.h=null!==(o=c.h)&&void 0!==o?o:i.h,a=!0)}else if("heatcell"===i.type){const e={x:i.x,y:i.y,w:i.w,h:i.h};c.x===e.x&&c.y===e.y||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=c.x,i.y=c.y,i.w=null!==(r=c.w)&&void 0!==r?r:i.w,i.h=null!==(s=c.h)&&void 0!==s?s:i.h,a=!0)}}a&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:i})}advanceTransition(e){var t;if(!this.activeTransition)return!1;const n=Math.min((e-this.activeTransition.startTime)/this.activeTransition.duration,1),o="linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?n:1-Math.pow(1-n,3);for(const e of this.scene)if("point"===e.type){if(void 0===e._targetX)continue;const t=this.getNodeIdentity(e,0);if(!t)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=n.x+(e._targetX-n.x)*o,e.y=n.y+(e._targetY-n.y)*o,void 0!==e._targetR&&void 0!==n.r&&(e.r=n.r+(e._targetR-n.r)*o)}else if("rect"===e.type){if(void 0===e._targetX)continue;const t=this.getNodeIdentity(e,0);if(!t)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=n.x+(e._targetX-n.x)*o,e.y=n.y+(e._targetY-n.y)*o,void 0!==n.w&&(e.w=n.w+(e._targetW-n.w)*o),void 0!==n.h&&(e.h=n.h+(e._targetH-n.h)*o)}else if("heatcell"===e.type){if(void 0===e._targetX)continue;const t=this.getNodeIdentity(e,0);if(!t)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=n.x+(e._targetX-n.x)*o,e.y=n.y+(e._targetY-n.y)*o,void 0!==n.w&&(e.w=n.w+(e._targetW-n.w)*o),void 0!==n.h&&(e.h=n.h+(e._targetH-n.h)*o)}if(n>=1){for(const e of this.scene)if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}return this.activeTransition=null,!1}return!0}groupData(e){if(!this.getGroup)return[{key:"_default",data:e}];const t=new Map;for(const n of e){const e=this.getGroup(n);t.has(e)||t.set(e,[]),t.get(e).push(n)}return Array.from(t.entries()).map(([e,t])=>({key:e,data:t}))}resolveLineStyle(e,t){const n=this.config.lineStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?{stroke:n.stroke||"#007bff",strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray,fill:n.fill,fillOpacity:n.fillOpacity,opacity:n.opacity}:{stroke:"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var n;if(this.config.areaStyle)return this.config.areaStyle(t||{});const o=this.config.lineStyle;return"function"==typeof o?o(t||{},e):o&&"object"==typeof o?{fill:o.fill||o.stroke||"#4e79a7",fillOpacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.7,stroke:o.stroke||"#4e79a7",strokeWidth:o.strokeWidth||2}:{fill:"#4e79a7",fillOpacity:.7,stroke:"#4e79a7",strokeWidth:2}}getData(){return this.buffer.toArray()}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}updateConfig(e){Object.assign(this.config,e)}}function O(e,t,n){const o=t-e.x,r=n-e.y,s=Math.sqrt(o*o+r*r);return s>e.r+5?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function j(e,t,n){if(0===e.path.length)return null;const o=z(e.path,t);if(0>o)return null;const[r,s]=e.path[o],i=t-r,a=n-s,l=Math.sqrt(i*i+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:r,y:s,distance:l}}function P(e,t,n){return e.x>t||t>e.x+e.w||e.y>n||n>e.y+e.h?null:{node:e,datum:e.datum,x:e.x+e.w/2,y:e.y+e.h/2,distance:0}}function N(e,t,n){return e.x>t||t>e.x+e.w||e.y>n||n>e.y+e.h?null:{node:e,datum:e.datum,x:e.x+e.w/2,y:e.y+e.h/2,distance:0}}function C(e,t,n){const o=e.bodyWidth/2,r=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,s=t-e.x,i=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(s*s+i*i)}}return null}function _(e,t,n){if(0===e.topPath.length)return null;const o=z(e.topPath,t);if(0>o)return null;const[r,s]=e.topPath[o],i=t-r,a=n-s;return{node:e,datum:e.datum,x:r,y:s,distance:Math.sqrt(i*i+a*a)}}function z(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const r=n+o>>1;t>e[r][0]?n=r+1:o=r}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}const B={fill:e=>p.createElement("rect",{style:e,width:20,height:20}),line:e=>p.createElement("line",{style:e,x1:0,y1:0,x2:20,y2:20})};function W(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,B[n])(o(e,t)),r}function L(e){const{legendGroups:t,customClickBehavior:n,title:o="Legend",width:r=100,height:s=20,orientation:i="vertical"}=e,a="vertical"===i?(({legendGroups:e,width:t,customClickBehavior:n})=>{let o=30;const r=[];return e.forEach((e,s)=>{o+=5,r.push(p.createElement("line",{key:"legend-top-line legend-symbol-"+s,stroke:"gray",x1:0,y1:o,x2:t,y2:o})),o+=10,e.label&&(o+=20,r.push(p.createElement("text",{key:"legend-text-"+s,y:o,className:"legend-group-label"},e.label)),o+=10),r.push(p.createElement("g",{key:"legend-group-"+s,className:"legend-item",transform:`translate(0,${o})`},((e,t)=>{const{type:n="fill",styleFn:o,items:r}=e,s=[];let i=0;return r.forEach((e,r)=>{const a=W(e,r,n,o);s.push(p.createElement("g",{key:"legend-item-"+r,transform:`translate(0,${i})`,onClick:t?()=>t(e):void 0,style:{cursor:t?"pointer":"default"}},a,p.createElement("text",{y:15,x:30},e.label))),i+=25}),s})(e,n))),o+=25*e.items.length+10}),r})({legendGroups:t,width:r,customClickBehavior:n}):(({legendGroups:e,title:t,height:n,customClickBehavior:o})=>{let r=0;const s=[],i=!1===t?10:40;return e.forEach((t,a)=>{t.label&&(s.push(p.createElement("text",{key:"legend-text-"+a,transform:`translate(${r},${i}) rotate(90)`,textAnchor:"start",className:"legend-group-label"},t.label)),r+=20);const l=((e,t)=>{const{type:n="fill",styleFn:o,items:r}=e,s=[];let i=0;return r.forEach((e,r)=>{const a=W(e,r,n,o);s.push(p.createElement("g",{key:"legend-item-"+r,transform:`translate(${i},0)`,onClick:t?()=>t(e):void 0,style:{cursor:t?"pointer":"default"}},a,p.createElement("text",{y:15,x:25},e.label))),i+=35,i+=8*e.label.length}),{items:s,offset:i}})(t,o);s.push(p.createElement("g",{key:"legend-group-"+a,className:"legend-item",transform:`translate(${r},${i})`},l.items)),r+=l.offset+5,e[a+1]&&s.push(p.createElement("line",{key:"legend-top-line legend-symbol-"+a,stroke:"gray",x1:r,y1:i-10,x2:r,y2:n+i+10})),r+=15}),p.createElement("g",null,!1!==t&&p.createElement("line",{x1:0,x2:r+10,y1:i-10,y2:i-10,stroke:"gray",className:"title-neatline"}),s)})({legendGroups:t,title:o,height:s,customClickBehavior:n});return p.createElement("g",null,void 0!==o&&p.createElement("text",{className:"legend-title",y:20,x:"horizontal"===i?0:r/2,textAnchor:"horizontal"===i?"start":"middle"},o),a)}function R(e){return"string"==typeof e?{type:e}:e}function T({orient:t,config:n,values:o,scale:s,size:i,length:a}){const l=function(e){var t,n,o,r,s;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(r=e.stroke)&&void 0!==r?r:"none",strokeWidth:null!==(s=e.strokeWidth)&&void 0!==s?s:1}}(n),c="top"===t||"bottom"===t,u=e.useMemo(()=>{if(0===o.length)return null;const e=s.domain(),n=i-8;if("boxplot"===l.type){const e=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],s=t[Math.floor(.75*n)],i=s-o;return{q1:o,median:r,q3:s,whiskerLow:Math.max(t[0],o-1.5*i),whiskerHigh:Math.min(t[n-1],s+1.5*i)}}(o);if(!e)return null;const{q1:r,median:i,q3:a,whiskerLow:u,whiskerHigh:d}=e,h=Math.min(.5*n,20),g=(n-h)/2+4;if(c){const e=s(r),n=s(a),o=s(i),c=s(u),y=s(d),f="top"===t?-1:1,m=0;return p.createElement("g",{"data-testid":"marginal-boxplot-"+t},p.createElement("line",{x1:c,y1:m+f*(g+h/2),x2:y,y2:m+f*(g+h/2),stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:c,y1:m+f*g,x2:c,y2:m+f*(g+h),stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:y,y1:m+f*g,x2:y,y2:m+f*(g+h),stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("rect",{x:Math.min(e,n),y:"top"===t?m-g-h:m+g,width:Math.abs(n-e),height:h,fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:o,y1:"top"===t?m-g-h:m+g,x2:o,y2:"top"===t?m-g:m+g+h,stroke:l.fill,strokeWidth:2}))}{const e=s(r),n=s(a),o=s(i),c=s(u),y=s(d),f="left"===t?-1:1,m=0;return p.createElement("g",{"data-testid":"marginal-boxplot-"+t},p.createElement("line",{x1:m+f*(g+h/2),y1:c,x2:m+f*(g+h/2),y2:y,stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:m+f*g,y1:c,x2:m+f*(g+h),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:m+f*g,y1:y,x2:m+f*(g+h),y2:y,stroke:l.fill,strokeWidth:l.strokeWidth}),p.createElement("rect",{x:"left"===t?m-g-h:m+g,y:Math.min(e,n),width:h,height:Math.abs(n-e),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),p.createElement("line",{x1:"left"===t?m-g-h:m+g,y1:o,x2:"left"===t?m-g:m+g+h,y2:o,stroke:l.fill,strokeWidth:2}))}}const u=r.bin().domain(e).thresholds(l.bins)(o);if(0===u.length)return null;const d=Math.max(...u.map(e=>e.length));if(0===d)return null;if("histogram"===l.type)return p.createElement("g",{"data-testid":"marginal-histogram-"+t},u.map((e,o)=>{if(null==e.x0||null==e.x1)return null;const r=e.length/d*n;if(c){const n=s(e.x0),i=s(e.x1)-s(e.x0);return p.createElement("rect",{key:o,x:n,y:"top"===t?-4-r:4,width:Math.max(i,.5),height:r,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const n=s(e.x0),i=s(e.x1)-s(e.x0);return p.createElement("rect",{key:o,x:"left"===t?-4-r:4,y:Math.min(n,n+i),width:r,height:Math.abs(i),fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}}));if("violin"===l.type){const e=n/2+4,o=[];for(const r of u){if(null==r.x0||null==r.x1)continue;const i=r.length/d*(n/2),a=s((r.x0+r.x1)/2);o.push(c?`${a},${"top"===t?-(e-i):e-i}`:`${"left"===t?-(e-i):e-i},${a}`)}for(let r=u.length-1;r>=0;r--){const i=u[r];if(null==i.x0||null==i.x1)continue;const a=i.length/d*(n/2),l=s((i.x0+i.x1)/2);o.push(c?`${l},${"top"===t?-(e+a):e+a}`:`${"left"===t?-(e+a):e+a},${l}`)}return p.createElement("g",{"data-testid":"marginal-violin-"+t},p.createElement("polygon",{points:o.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}if("ridgeline"===l.type){const e=[];if(c){const o=0,r=null!=u[0].x0?s(u[0].x0):0;e.push(`M${r},${o}`);for(const o of u){if(null==o.x0||null==o.x1)continue;const r=o.length/d*n,i=s((o.x0+o.x1)/2);e.push(`L${i},${"top"===t?-r-4:r+4}`)}const i=null!=u[u.length-1].x1?s(u[u.length-1].x1):a;e.push(`L${i},${o}`),e.push("Z")}else{const o=0,r=null!=u[0].x0?s(u[0].x0):0;e.push(`M${o},${r}`);for(const o of u){if(null==o.x0||null==o.x1)continue;const r=o.length/d*n,i=s((o.x0+o.x1)/2);e.push(`L${"left"===t?-r-4:r+4},${i}`)}const i=null!=u[u.length-1].x1?s(u[u.length-1].x1):a;e.push(`L${o},${i}`),e.push("Z")}return p.createElement("g",{"data-testid":"marginal-ridgeline-"+t},p.createElement("path",{d:e.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}return null},[o,s,l,i,a,t,c,4]);return u?p.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function D(e){return Math.round(100*e)/100+""}function $(t){const{width:n,height:o,totalWidth:r,totalHeight:s,margin:i,scales:a,showAxes:l,xLabel:c,yLabel:u,xFormat:d,yFormat:h,showGrid:g,title:y,legend:f,foregroundGraphics:m,marginalGraphics:v,xValues:b,yValues:x,annotations:A,svgAnnotationRules:w,annotationFrame:k,children:S}=t,E=e.useMemo(()=>l&&a?a.x.ticks(5).map(e=>({value:e,pixel:a.x(e),label:(d||D)(e)})):[],[l,a,d]),M=e.useMemo(()=>l&&a?a.y.ticks(5).map(e=>({value:e,pixel:a.y(e),label:(h||D)(e)})):[],[l,a,h]),O=e.useMemo(()=>A&&0!==A.length&&w?A.map((e,t)=>w(e,t,{scales:a?{time:a.x,value:a.y}:null,timeAxis:"x",width:n,height:o})).filter(Boolean):null,[A,w,n,o,k]);return l||y||f||m||v||O&&O.length>0||g||S?p.createElement("svg",{width:r,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},p.createElement("g",{transform:`translate(${i.left},${i.top})`},g&&a&&p.createElement("g",{className:"stream-grid"},E.map((e,t)=>p.createElement("line",{key:"xgrid-"+t,x1:e.pixel,y1:0,x2:e.pixel,y2:o,stroke:"#e0e0e0",strokeWidth:1})),M.map((e,t)=>p.createElement("line",{key:"ygrid-"+t,x1:0,y1:e.pixel,x2:n,y2:e.pixel,stroke:"#e0e0e0",strokeWidth:1}))),l&&a&&p.createElement("g",{className:"stream-axes"},p.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"#ccc",strokeWidth:1}),E.map((e,t)=>p.createElement("g",{key:"xtick-"+t,transform:`translate(${e.pixel},${o})`},p.createElement("line",{y2:5,stroke:"#ccc",strokeWidth:1}),p.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},e.label))),c&&p.createElement("text",{x:n/2,y:o+40,textAnchor:"middle",fontSize:12,fill:"#333",style:{userSelect:"none"}},c),p.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"#ccc",strokeWidth:1}),M.map((e,t)=>p.createElement("g",{key:"ytick-"+t,transform:`translate(0,${e.pixel})`},p.createElement("line",{x2:-5,stroke:"#ccc",strokeWidth:1}),p.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},e.label))),u&&p.createElement("text",{x:15-i.left,y:o/2,textAnchor:"middle",fontSize:12,fill:"#333",transform:`rotate(-90, ${15-i.left}, ${o/2})`,style:{userSelect:"none"}},u)),O,v&&a&&b&&x&&p.createElement(p.Fragment,null,v.top&&p.createElement("g",{transform:"translate(0, 0)"},p.createElement(T,{orient:"top",config:R(v.top),values:b,scale:a.x,size:i.top,length:n})),v.bottom&&p.createElement("g",{transform:`translate(0, ${o})`},p.createElement(T,{orient:"bottom",config:R(v.bottom),values:b,scale:a.x,size:i.bottom,length:n})),v.left&&p.createElement("g",{transform:"translate(0, 0)"},p.createElement(T,{orient:"left",config:R(v.left),values:x,scale:a.y,size:i.left,length:o})),v.right&&p.createElement("g",{transform:`translate(${n}, 0)`},p.createElement(T,{orient:"right",config:R(v.right),values:x,scale:a.y,size:i.right,length:o}))),m,S),y&&p.createElement("text",{x:r/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"#333",style:{userSelect:"none"}},"string"==typeof y?y:null),f&&p.createElement("g",{transform:`translate(${r-i.right+10}, ${i.top})`},"object"==typeof(j=f)&&null!==j&&!p.isValidElement(j)&&"legendGroups"in j?p.createElement(L,{legendGroups:f.legendGroups,title:"",width:100}):f)):null;var j}function F(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}const H=(e,t,n,o)=>{var r;const s=t.filter(e=>"area"===e.type);for(const t of s){if(2>t.topPath.length)continue;e.beginPath();const[n,o]=t.topPath[0];e.moveTo(n,o);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath();const s=null!==(r=t.style.fillOpacity)&&void 0!==r?r:.7;if(e.globalAlpha=s,e.fillStyle=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=1,e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]),e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);e.stroke()}e.globalAlpha=1}},I=(e,t,n,o)=>{var r;const s=t.filter(e=>"point"===e.type);for(const t of s){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(r=t.style.opacity)&&void 0!==r?r:t.style.fillOpacity;if(null!=n&&(e.globalAlpha=n),e.fillStyle=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),t._pulseIntensity&&t._pulseIntensity>0){const n=4;e.beginPath(),e.arc(t.x,t.y,t.r+n*t._pulseIntensity,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=.5*t._pulseIntensity,e.stroke()}e.globalAlpha=1}},Y=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r)null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon?q(e,t):(e.fillStyle=t.style.fill||"#007bff",e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))),t._pulseIntensity&&t._pulseIntensity>0&&(e.globalAlpha=.3*t._pulseIntensity,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h)),e.globalAlpha=1};function q(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.w)-o;if(0>=r)return;const s=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),s){const s=r+o,i=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=s)e.drawImage(n,i,o,r,r)}else{const s=r+o,i=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=s)e.drawImage(n,o,i,r,r)}e.restore()}const X={line:[H,(e,t,n,o)=>{const r=t.filter(e=>"line"===e.type);for(const s of r){if(2>s.path.length)continue;const i=s.style.stroke||"#007bff",a=s.style.strokeWidth||2,l=s.colorThresholds,c=s.rawValues;if(e.setLineDash(s.style.strokeDasharray?s.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=s.style.opacity&&(e.globalAlpha=s.style.opacity),e.lineWidth=a,l&&0!==l.length&&c&&c.length===s.path.length){let u=null,d=null,h=null,p=null,g=!1;function y(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),g=!0}function f(){g&&(e.stroke(),g=!1)}for(let m=0;s.path.length>m;m++){const[v,b]=s.path[m],x=c[m],A=F(x,l,i);if(null!==u&&null!==p&&null!==h){if(A===p)e.lineTo(v,b);else{const w=[];for(const k of l){const S=k.value;(h>S||S>x)&&(S>h||x>S)||h===S||x===S||w.push({t:(S-h)/(x-h)})}w.sort((e,t)=>e.t-t.t);for(const E of w){const M=u+(v-u)*E.t,O=d+(b-d)*E.t,j=F(h+(x-h)*Math.min(E.t+1e-4,1),l,i);e.lineTo(M,O),f(),y(j,M,O)}e.lineTo(v,b)}u=v,d=b,h=x,p=A}else y(A,v,b),u=v,d=b,h=x,p=A}f()}else{e.beginPath(),e.strokeStyle=i;const[P,N]=s.path[0];e.moveTo(P,N);for(let C=1;s.path.length>C;C++)e.lineTo(s.path[C][0],s.path[C][1]);e.stroke()}if(s.style.fill&&s.style.fillOpacity&&s.style.fillOpacity>0){e.beginPath(),e.globalAlpha=s.style.fillOpacity,e.fillStyle=s.style.fill;const[_,z]=s.path[0];e.moveTo(_,z);for(let W=1;s.path.length>W;W++)e.lineTo(s.path[W][0],s.path[W][1]);const B=s.path[0][0];e.lineTo(s.path[s.path.length-1][0],o.height),e.lineTo(B,o.height),e.closePath(),e.fill()}e.globalAlpha=1,e.setLineDash([])}}],area:[H],stackedarea:[H],scatter:[I],bubble:[I],heatmap:[(e,t,n,o)=>{const r=t.filter(e=>"heatcell"===e.type);for(const t of r){const n=t.style;null!=(null==n?void 0:n.opacity)&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle="#fff",e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),t._pulseIntensity&&t._pulseIntensity>0&&(e.globalAlpha=.3*t._pulseIntensity,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h)),e.globalAlpha=1}}],bar:[Y],swarm:[I],waterfall:[(e,t,n,o)=>{var r,s;Y(e,t);const i=t.filter(e=>"rect"===e.type);if(i.length>=2){e.save(),e.strokeStyle="#999",e.lineWidth=1,e.setLineDash([]);for(let t=0;i.length-1>t;t++){const o=i[t],a=i[t+1];if(!(null===(r=o.datum)||void 0===r?void 0:r.cumEnd)||!(null===(s=a.datum)||void 0===s?void 0:s.baseline))continue;const l=n.y(o.datum.cumEnd),c=o.x+o.w,u=a.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[(e,t,n,o)=>{for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=t.wickColor,e.lineWidth=t.wickWidth,e.stroke();const o=Math.min(t.openY,t.closeY),r=Math.abs(t.openY-t.closeY),s=t.isUp?t.upColor:t.downColor;e.fillStyle=s,e.fillRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(r,1)),e.strokeStyle=s,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(r,1))}}]},G={top:20,right:20,bottom:30,left:40},V={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white"},U={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function Q({hover:e}){const t=e=>Number.isInteger(e)?e+"":e.toFixed(2);return p.createElement("div",{className:"semiotic-tooltip",style:U},p.createElement("div",{style:{fontWeight:600,marginBottom:2}},t(e.value)),p.createElement("div",{style:{opacity:.7,fontSize:11}},t(e.time)))}function Z({width:o,height:r,totalWidth:s,totalHeight:i,margin:a,dimension:l,scales:c,onBrush:u}){const d=e.useRef(null),h=e.useRef(null);return e.useEffect(()=>{if(!d.current)return;const e=n.select(d.current).select(".brush-g"),s="x"===l?t.brushX():"y"===l?t.brushY():t.brush();return s.extent([[0,0],[o,r]]),s.on("brush end",e=>{if(!c)return;if(!e.selection)return void u(null);let t,n;if("x"===l){const[o,s]=e.selection;t=[c.x.invert(o),c.x.invert(s)],n=[c.y.invert(r),c.y.invert(0)]}else if("y"===l){const[r,s]=e.selection;t=[c.x.invert(0),c.x.invert(o)],n=[c.y.invert(s),c.y.invert(r)]}else{const[[o,r],[s,i]]=e.selection;t=[c.x.invert(o),c.x.invert(s)],n=[c.y.invert(i),c.y.invert(r)]}u({x:t,y:n})}),e.call(s),h.current=s,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{s.on("brush end",null),h.current=null}},[o,r,l,c,u]),p.createElement("svg",{ref:d,width:s,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},p.createElement("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`}))}const J=e.forwardRef(function(t,n){var o;const{chartType:r,runtimeMode:s,data:i,xAccessor:a,yAccessor:l,colorAccessor:c,sizeAccessor:u,groupAccessor:d,lineDataAccessor:h,normalize:g,binSize:f,valueAccessor:m,arrowOfTime:v="right",windowMode:b="sliding",windowSize:x=200,timeAccessor:A,xExtent:w,yExtent:k,extentPadding:S=.1,sizeRange:E,size:z=[500,300],margin:B,className:W,background:L,lineStyle:R,pointStyle:T,areaStyle:D,swarmStyle:F,barColors:H,colorScheme:I,boundsAccessor:Y,boundsStyle:q,openAccessor:U,highAccessor:J,lowAccessor:K,closeAccessor:ee,candlestickStyle:te,showAxes:ne=!0,xLabel:oe,yLabel:re,xFormat:se,yFormat:ie,tickFormatTime:ae,tickFormatValue:le,hoverAnnotation:ce,tooltipContent:ue,customHoverBehavior:de,enableHover:he,annotations:pe,svgAnnotationRules:ge,showGrid:ye,legend:fe,backgroundGraphics:me,foregroundGraphics:ve,title:be,categoryAccessor:xe,brush:Ae,onBrush:we,decay:ke,pulse:Se,transition:Ee,staleness:Me,heatmapAggregation:Oe,heatmapXBins:je,heatmapYBins:Pe,marginalGraphics:Ne}=t,Ce=Object.assign(Object.assign({},G),B);if(Ne){const e=60;Ne.top&&e>Ce.top&&(Ce.top=e),Ne.bottom&&e>Ce.bottom&&(Ce.bottom=e),Ne.left&&e>Ce.left&&(Ce.left=e),Ne.right&&e>Ce.right&&(Ce.right=e)}const _e=z[0]-Ce.left-Ce.right,ze=z[1]-Ce.top-Ce.bottom,Be=null!=ce?ce:he,We=e.useRef(null),Le=e.useRef(0),Re=e.useRef(!1),[Te,De]=e.useState(0),[$e,Fe]=e.useState(null),He=e.useRef(null),[Ie,Ye]=e.useState(null),[qe,Xe]=e.useState(!1),[Ge,Ve]=e.useState([]),[Ue,Qe]=e.useState([]),Ze=e.useRef(()=>{}),Je="streaming"===s||["bar","swarm","waterfall"].includes(r),Ke=e.useMemo(()=>({chartType:r,runtimeMode:Je?"streaming":"bounded",windowSize:x,windowMode:b,arrowOfTime:Je?v:"right",extentPadding:S,xAccessor:Je?void 0:a,yAccessor:Je?void 0:l,timeAccessor:Je?A:void 0,valueAccessor:m,colorAccessor:c,sizeAccessor:u,groupAccessor:d,categoryAccessor:xe,lineDataAccessor:h,xExtent:w,yExtent:k,sizeRange:E,binSize:f,normalize:g,boundsAccessor:Y,boundsStyle:q,openAccessor:U,highAccessor:J,lowAccessor:K,closeAccessor:ee,candlestickStyle:te,lineStyle:R,pointStyle:T,areaStyle:D,swarmStyle:F,colorScheme:I,barColors:H,annotations:pe,decay:ke,pulse:Se,transition:Ee,staleness:Me,heatmapAggregation:Oe,heatmapXBins:je,heatmapYBins:Pe}),[r,x,b,v,S,a,l,A,m,c,u,d,xe,h,w,k,E,f,g,Y,q,U,J,K,ee,te,R,T,D,F,I,H,pe,ke,Se,Ee,Me,Oe,je,Pe,Je]),et=e.useRef(null);et.current||(et.current=new M(Ke));const tt=e.useCallback(()=>{Le.current||(Le.current=requestAnimationFrame(()=>Ze.current()))},[]);e.useEffect(()=>{var e;null===(e=et.current)||void 0===e||e.updateConfig(Ke),Re.current=!0,tt()},[Ke,tt]);const nt=e.useRef(null);nt.current||(nt.current=new y(e=>{const t=et.current;t&&t.ingest(e)&&(Re.current=!0,tt())}));const ot=e.useCallback(e=>{var t;null===(t=nt.current)||void 0===t||t.push(e)},[]),rt=e.useCallback(e=>{var t;null===(t=nt.current)||void 0===t||t.pushMany(e)},[]),st=e.useCallback(()=>{var e,t;null===(e=nt.current)||void 0===e||e.clear(),null===(t=et.current)||void 0===t||t.clear(),Re.current=!0,tt()},[tt]);e.useImperativeHandle(n,()=>({push:ot,pushMany:rt,clear:st,getData:()=>{var e,t;return null!==(t=null===(e=et.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=et.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=et.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[ot,rt,st]),e.useEffect(()=>{var e;i&&(null===(e=nt.current)||void 0===e||e.setBoundedData(i))},[i]);const it=e.useRef(()=>{}),at=e.useRef(()=>{});it.current=e=>{if(!Be)return;const t=We.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Ce.left,r=e.clientY-n.top-Ce.top;if(0>o||o>_e||0>r||r>ze)return void(He.current&&(He.current=null,Ye(null),de&&de(null),tt()));const s=et.current;if(!s||0===s.scene.length)return;const i=function(e,t,n,o=30){let r=null;for(const s of e){let e=null;switch(s.type){case"point":e=O(s,t,n);break;case"line":e=j(s,t,n);break;case"rect":e=P(s,t,n);break;case"heatcell":e=N(s,t,n);break;case"area":if(!1===s.interactive)break;e=_(s,t,n);break;case"candlestick":e=C(s,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(s.scene,o,r);if(!i)return void(He.current&&(He.current=null,Ye(null),de&&de(null),tt()));const a={data:i.datum,time:i.x,value:i.y,x:i.x,y:i.y};He.current=a,Ye(a),de&&de(a),tt()},at.current=()=>{He.current&&(He.current=null,Ye(null),de&&de(null),tt())};const lt=e.useCallback(e=>it.current(e),[]),ct=e.useCallback(()=>at.current(),[]);Ze.current=()=>{var e,t;Le.current=0;const n=We.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const s=et.current;if(!s)return;const i="undefined"!=typeof performance?performance.now():Date.now(),c=s.advanceTransition(i);c||s.computeScene({width:_e,height:ze});const u="undefined"!=typeof window&&window.devicePixelRatio||1;n.width=z[0]*u,n.height=z[1]*u,n.style.width=z[0]+"px",n.style.height=z[1]+"px",o.scale(u,u),o.translate(Ce.left,Ce.top),o.clearRect(-Ce.left,-Ce.top,z[0],z[1]);const d=function(e){if(!e)return V;const t=getComputedStyle(e),n=t.getPropertyValue("--text-secondary").trim(),o=t.getPropertyValue("--text-primary").trim(),r=t.getPropertyValue("--surface-3").trim(),s=t.getPropertyValue("--surface-0").trim();return n||o?{axisStroke:r||V.axisStroke,tickText:n||V.tickText,crosshair:n?n+"66":V.crosshair,hoverFill:s?s+"4D":V.hoverFill,hoverStroke:n?n+"99":V.hoverStroke,pointRing:s||V.pointRing}:V}(n),h=null!==(e=null==Me?void 0:Me.threshold)&&void 0!==e?e:5e3,p=Me&&s.lastIngestTime>0&&i-s.lastIngestTime>h;p&&(o.globalAlpha=null!==(t=null==Me?void 0:Me.dimOpacity)&&void 0!==t?t:.5),L&&(o.fillStyle=L,o.fillRect(0,0,_e,ze));const g=X[r];if(g&&s.scales)for(const e of g)e(o,s.scene,s.scales,{width:_e,height:ze});p&&(o.globalAlpha=1),Be&&He.current&&s.scales&&function(e,t,n,o,r,s,i){if(!1===r.crosshair)return;e.save();const a="object"==typeof r.crosshair?r.crosshair:{};e.strokeStyle=a.stroke||i.crosshair,e.lineWidth=a.strokeWidth||1,e.setLineDash(a.strokeDasharray?a.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(t.x,0),e.lineTo(t.x,o),e.stroke(),e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke(),e.restore(),e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle="#007bff",e.fill(),e.strokeStyle=i.pointRing,e.lineWidth=2,e.stroke()}(o,He.current,_e,ze,"object"==typeof Be?Be:{},0,d);const y=Re.current;if(Re.current=!1,y&&s.scales&&(Fe(s.scales),Ne)){const e=s.getData(),t="function"==typeof a?a:e=>e[a||"x"],n="function"==typeof l?l:e=>e[l||"y"];Ve(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Qe(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}y&&pe&&pe.length>0&&ge&&De(e=>e+1),(null==Me?void 0:Me.showBadge)&&Xe(!!p),(c||s.hasActivePulses)&&(Le.current=requestAnimationFrame(()=>Ze.current()))},e.useEffect(()=>(tt(),()=>{Le.current&&cancelAnimationFrame(Le.current)}),[tt]),e.useEffect(()=>{Re.current=!0,tt()},[r,_e,ze,ne,L,R,tt]),e.useEffect(()=>{if(!Me)return;const e=setInterval(()=>{var e;const t=et.current;if(!t||0===t.lastIngestTime)return;const n="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(e=Me.threshold)&&void 0!==e?e:5e3,r=n-t.lastIngestTime>o;r!==qe&&(Xe(r),Re.current=!0,tt())},1e3);return()=>clearInterval(e)},[Me,qe,tt]);const ut=Be&&Ie?ue?ue(Ie):p.createElement(Q,{hover:Ie}):null,dt=ut?p.createElement("div",{className:"stream-frame-tooltip",style:{position:"absolute",left:Ce.left+Ie.x,top:Ce.top+Ie.y,transform:`translate(${Ie.x>.7*_e?"calc(-100% - 12px)":"12px"}, ${.3*ze>Ie.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1}},ut):null;return p.createElement("div",{className:"stream-xy-frame"+(W?" "+W:""),style:{position:"relative",width:z[0],height:z[1]},onMouseMove:Be?lt:void 0,onMouseLeave:Be?ct:void 0},me&&p.createElement("svg",{style:{position:"absolute",left:0,top:0,width:z[0],height:z[1],pointerEvents:"none"}},me),p.createElement("canvas",{ref:We,style:{position:"absolute",left:0,top:0}}),p.createElement($,{width:_e,height:ze,totalWidth:z[0],totalHeight:z[1],margin:Ce,scales:$e,showAxes:ne,xLabel:oe,yLabel:re,xFormat:se||ae,yFormat:ie||le,showGrid:ye,title:be,legend:fe,foregroundGraphics:ve,marginalGraphics:Ne,xValues:Ge,yValues:Ue,annotations:pe,svgAnnotationRules:ge,annotationFrame:Te}),(Ae||we)&&p.createElement(Z,{width:_e,height:ze,totalWidth:z[0],totalHeight:z[1],margin:Ce,dimension:null!==(o=null==Ae?void 0:Ae.dimension)&&void 0!==o?o:"xy",scales:$e,onBrush:null!=we?we:()=>{}}),(null==Me?void 0:Me.showBadge)&&p.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Me.badgePosition?{top:4,left:4}:"bottom-left"===Me.badgePosition?{bottom:4,left:4}:"bottom-right"===Me.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:qe?"#dc3545":"#28a745",color:"white"})},qe?"STALE":"LIVE"),dt)});J.displayName="StreamXYFrame";const K={category10:s.schemeCategory10,tableau10:s.schemeTableau10,set3:s.schemeSet3,blues:s.interpolateBlues,reds:s.interpolateReds,greens:s.interpolateGreens,oranges:s.interpolateOranges,purples:s.interpolatePurples,viridis:s.interpolateViridis,plasma:s.interpolatePlasma},ee=s.schemeCategory10;function te(e,t,n){if("function"==typeof t)return t(e);const o=e[t];return n?n(o):ee[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+""))%ee.length]}function ne(e,t,n="category10"){const r=Array.from(new Set(e.map(e=>e[t]))),s=r.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return o.scaleOrdinal().domain(r).range(n).unknown("#999");const i=K[n]||K.category10;if(s&&"function"==typeof i)return e=>i(Number(e)/Math.max(...r.map(Number)));{const e=Array.isArray(i)?i:ee;return o.scaleOrdinal().domain(r).range(e).unknown("#999")}}function oe(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e[t],!o)return r;const[s,i]=o,[a,l]=n;return i===s?(a+l)/2:a+(r-s)/(i-s)*(l-a)}const re="#007bff";function se(e){return"function"==typeof e?e:t=>t[e]}function ie(t,n,o="category10"){return e.useMemo(()=>{if(n&&"function"!=typeof n)return ne(t,n,o)},[t,n,o])}function ae(t,n,o){return e.useMemo(()=>{if(!n)return t;const e=[...t];if("function"==typeof n)return e.sort(n);const r=se(o);return e.sort("asc"===n?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[t,n,o])}function le({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:s}){return{legendGroups:[{styleFn:e=>{const t={fill:e.color,stroke:e.color};return void 0!==r&&(t.stroke=r),void 0!==s&&(t.strokeWidth=s),t},type:"fill",items:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t]))).map(r=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),i=s?o(s,t,n):n?n(r):"#000000";return{label:r+"",color:i}}),label:""}]}}const ce={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"8px 12px",borderRadius:"4px",fontSize:"14px",lineHeight:"1.5",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function ue(e,t){return"function"==typeof t?t(e):e[t]}function de(e,t){return t?t(e):null==e?"":"number"==typeof e?e.toLocaleString():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 he(e){return!0===e||("function"==typeof e?e:!1!==e&&void 0!==e&&("object"!=typeof e||null===e||!("fields"in e)&&!("title"in e)||function(e={}){const{fields:t,title:n,format:o,style:r={},className:s=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let i;const a=[];if(n){const t=ue(e,n);i=de(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,r,s;"string"==typeof t?(n=t,r=t,s=o):(n=t.label,r=t.accessor||t.key||"",s=t.format||o);const i=ue(e,r);a.push({label:n,value:de(i,s)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){i=de(e[n],o);break}if(!i){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(i=de(e[t[0]],o))}}const l=Object.assign(Object.assign({},ce),r);return p.createElement("div",{className:("semiotic-tooltip "+s).trim(),style:l},i&&p.createElement("div",{style:{fontWeight:a.length>0?"bold":"normal"}},i),a.map((e,t)=>p.createElement("div",{key:t,style:{marginTop:0===t&&i?"4px":0}},e.label&&p.createElement("span",null,e.label,": "),e.value)))}}(e)))}function pe(e){return"string"==typeof e?e:"value"}function ge(e){return t=>{const n=t.data;return n?p.createElement("div",{className:"semiotic-tooltip",style:ce},e.map((e,t)=>{const o=function(e,t){return"function"==typeof t?t(e):e[t]}(n,e.accessor),r=null==(s=o)?"–":"number"==typeof s?s.toLocaleString():s instanceof Date?s.toLocaleDateString():s+"";var s;return p.createElement("div",{key:t,style:t>0?{marginTop:2}:void 0},p.createElement("span",{style:{opacity:.8}},e.label,": "),p.createElement("span",{style:{fontWeight:"color"===e.role||"group"===e.role?"bold":"normal"}},r))})):null}}function ye({componentName:e,message:t,width:n,height:o}){return p.createElement("div",{role:"alert",style:{width:n,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"}},p.createElement("div",{style:{textAlign:"center",maxWidth:400}},p.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},e),p.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},t)))}function fe({data:e,accessors:t,requiredProps:n}){if(n)for(const[e,t]of Object.entries(n))if(null==t)return e+" is required. Provide a field name or function.";if(!e||!Array.isArray(e)||0===e.length)return"No data provided. Pass a non-empty array to the data prop.";if(t){const n=e[0];if(n&&"object"==typeof n)for(const[e,o]of Object.entries(t))if(o&&"string"==typeof o&&!(o in n))return`${e} "${o}" not found in data. Available fields: ${Object.keys(n).join(", ")}.`}return null}function me({data:e,dataLabel:t="data"}){return null==e?`No ${t} provided. Pass a hierarchical data object to the ${t} prop.`:null}function ve({nodes:e,edges:t,nodesRequired:n=!1,edgesRequired:o=!0,accessors:r}){if(o&&(!t||!Array.isArray(t)||0===t.length))return"No edges provided. Pass a non-empty array to the edges prop.";if(n&&(!e||!Array.isArray(e)||0===e.length))return"No nodes provided. Pass a non-empty array to the nodes prop.";if(r&&e&&e.length>0){const t=e[0];if(t&&"object"==typeof t)for(const[e,n]of Object.entries(r))if(n&&"string"==typeof n&&!(n in t))return`${e} "${n}" not found in node data. Available fields: ${Object.keys(t).join(", ")}.`}return null}function be(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields}:null}function xe(e){return e?"string"==typeof e?{name:e}:e:null}function Ae(e,t,n){return t?o=>{var r,s;const i=Object.assign({},e(o));return t.isActive&&(t.predicate(o)?(null==n?void 0:n.selectedStyle)&&Object.assign(i,n.selectedStyle):(i.fillOpacity=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.2,i.strokeOpacity=null!==(s=null==n?void 0:n.unselectedOpacity)&&void 0!==s?s:.2,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle))),i}:e}function we(t){let n=e.createContext(null),o=ke(t);return[function({children:o}){let r=e.useMemo(()=>ke(t),[]);return p.createElement(n.Provider,{value:r,children:o})},t=>{var r;let s=null!==(r=e.useContext(n))&&void 0!==r?r:o;return function(t,n){const[o,r]=e.useState(n);return e.useLayoutEffect(()=>t(()=>r(n)),[t]),o}(s.subscribe,()=>t(s.getState()))}]}function ke(e){let t=new EventTarget,n=e(function(e){n=Object.assign(n,e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function Se(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function Ee(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Se(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}function Me(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[Oe,je]=we(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=Me(o,t),s=new Map(r.clauses);return s.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},r),{clauses:s})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const r=new Map(e.selections),s=new Map(o.clauses);return s.delete(n),r.set(t,Object.assign(Object.assign({},o),{clauses:s})),{selections:r}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),r=Me(o,t);return o.set(t,Object.assign(Object.assign({},r),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}}));function Pe(t){const n=e.useId(),o=t.clientId||n,{name:r}=t,s=je(e=>e.selections.get(r)),i=je(e=>e.setClause),a=je(e=>e.clearClause),l=e.useMemo(()=>!!s&&s.clauses.size>0,[s]);return{predicate:e.useMemo(()=>s&&0!==s.clauses.size?Ee(s,o):()=>!0,[s,o]),isActive:l,selectPoints:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};i(r,{clientId:o,type:"point",fields:t})},[o,r,i]),selectInterval:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};i(r,{clientId:o,type:"interval",fields:t})},[o,r,i]),clear:e.useCallback(()=>{a(r,o)},[a,r,o]),clientId:o}}function Ne(t){const n=t.name||"hover",{fields:o}=t,{predicate:r,isActive:s,selectPoints:i,clear:a}=Pe({name:n});return{onHover:e.useCallback(e=>{if(!e)return void a();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&i(t)},[o,i,a]),predicate:r,isActive:s}}function Ce(t){const{name:n,xField:o,yField:r}=t,{predicate:s,isActive:i,selectInterval:a,clear:l}=Pe({name:n}),c=o&&r?"xyBrush":o?"xBrush":"yBrush",u=e.useCallback(e=>{if(!e)return void l();const t={};"xyBrush"===c&&Array.isArray(e)&&2===e.length?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&Array.isArray(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&Array.isArray(e)&&r&&(t[r]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,o,r,a,l]);return{brushInteraction:e.useMemo(()=>({brush:c,during:u,end:u}),[c,u]),predicate:s,isActive:i,clear:l}}function _e(t){var n;const{data:o,width:r=600,height:s=400,margin:i,className:a,title:l,xLabel:c,yLabel:u,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:y="y",lineBy:f,lineDataAccessor:m="coordinates",colorBy:v,colorScheme:b="category10",curve:x="linear",showPoints:A=!1,pointRadius:w=3,fillArea:k=!1,areaOpacity:S=.3,lineWidth:E=2,enableHover:M=!0,showGrid:O=!1,showLegend:j,tooltip:P,frameProps:N={},selection:C,linkedHover:_}=t,z=o||[],B=be(_,v?["string"==typeof v?v:""]:[]),W=Pe({name:(null==C?void 0:C.name)||"__unused__"}),L=Ne({name:(null==B?void 0:B.name)||"hover",fields:(null==B?void 0:B.fields)||[]}),R=C?{isActive:W.isActive,predicate:W.predicate}:null,T=void 0!==(null===(n=z[0])||void 0===n?void 0:n[m]),D=e.useMemo(()=>{if(T)return z;if(f){const e=z.reduce((e,t)=>{const n="function"==typeof f?f(t):t[f];if(!e[n]){const t={[m]:[]};"string"==typeof f&&(t[f]=n),e[n]=t}return e[n][m].push(t),e},{});return Object.values(e)}return[{[m]:z}]},[z,f,m,T]),$=ie(z,v,b),F=e.useMemo(()=>e=>{const t={strokeWidth:E};return t.stroke=v?te(e,v,$):re,k&&(t.fill=t.stroke,t.fillOpacity=S),t},[v,$,E,k,S]),H=e.useMemo(()=>Ae(F,R,C),[F,R,C]),I=e.useMemo(()=>{if(A)return e=>{const t={r:w,fillOpacity:1};return t.fill=v?te(e.parentLine||e,v,$):re,t}},[A,w,v,$]),Y=k?"area":"line",q=void 0!==j?j:D.length>1,X=e.useMemo(()=>{if(q&&v)return le({data:D,colorBy:v,colorScale:$,getColor:te})},[q,v,D,$]),G=e.useMemo(()=>{const e=Object.assign(Object.assign({},{top:50,bottom:60,left:70,right:40}),i);return X&&120>e.right&&(e.right=120),e},[i,X]),V=e.useCallback(e=>{_&&L.onHover(e)},[_,L]),U=f||v,Q=e.useMemo(()=>ge([{label:c||pe(g),accessor:g,role:"x"},{label:u||pe(y),accessor:y,role:"y"},...U?[{label:pe(U),accessor:U,role:"group"}]:[]]),[g,y,c,u,U]),Z=fe({componentName:"LineChart",data:z,accessors:{xAccessor:g,yAccessor:y}});if(Z)return p.createElement(ye,{componentName:"LineChart",message:Z,width:r,height:s});const K=e.useMemo(()=>T||f?D.flatMap(e=>{const t=e[m]||[];return f&&"string"==typeof f?t.map(t=>Object.assign(Object.assign({},t),{[f]:e[f]})):t}):z,[D,m,T,f,z]),ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:Y,data:K,xAccessor:g,yAccessor:y,groupAccessor:f||void 0,curve:x,lineStyle:H},A&&{pointStyle:I}),{size:[r,s],margin:G,showAxes:!0,xLabel:c,yLabel:u,xFormat:d,yFormat:h,enableHover:M,showGrid:O}),X&&{legend:X}),l&&{title:l}),a&&{className:a}),{tooltipContent:P?he(P):Q}),_&&{customHoverBehavior:V}),N);return p.createElement(J,Object.assign({},ee))}function ze(t){var n;const{data:o,width:r=600,height:s=400,margin:i,className:a,title:l,xLabel:c,yLabel:u,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:y="y",areaBy:f,lineDataAccessor:m="coordinates",colorBy:v,colorScheme:b="category10",curve:x="monotoneX",areaOpacity:A=.7,showLine:w=!0,lineWidth:k=2,enableHover:S=!0,showGrid:E=!1,showLegend:M,tooltip:O,frameProps:j={},selection:P,linkedHover:N}=t,C=o||[],_=be(N,v?["string"==typeof v?v:""]:[]),z=Pe({name:(null==P?void 0:P.name)||"__unused__"}),B=Ne({name:(null==_?void 0:_.name)||"hover",fields:(null==_?void 0:_.fields)||[]}),W=P?{isActive:z.isActive,predicate:z.predicate}:null,L=void 0!==(null===(n=C[0])||void 0===n?void 0:n[m]),R=e.useMemo(()=>{if(L)return C;if(f){const e=C.reduce((e,t)=>{const n="function"==typeof f?f(t):t[f];if(!e[n]){const t={[m]:[]};"string"==typeof f&&(t[f]=n),e[n]=t}return e[n][m].push(t),e},{});return Object.values(e)}return[{[m]:C}]},[C,f,m,L]),T=ie(C,v,b),D=e.useMemo(()=>e=>{const t={},n=v?te(e,v,T):re;return t.fill=n,t.fillOpacity=A,w?(t.stroke=n,t.strokeWidth=k):t.stroke="none",t},[v,T,A,w,k]),$=e.useMemo(()=>Ae(D,W,P),[D,W,P]),F=void 0!==M?M:R.length>1,H=e.useMemo(()=>{if(F&&v)return le({data:R,colorBy:v,colorScale:T,getColor:te})},[F,v,R,T]),I=e.useMemo(()=>{const e=Object.assign(Object.assign({},{top:50,bottom:60,left:70,right:40}),i);return H&&120>e.right&&(e.right=120),e},[i,H]),Y=e.useCallback(e=>{N&&B.onHover(e)},[N,B]),q=f||v,X=e.useMemo(()=>ge([{label:c||pe(g),accessor:g,role:"x"},{label:u||pe(y),accessor:y,role:"y"},...q?[{label:pe(q),accessor:q,role:"group"}]:[]]),[g,y,c,u,q]),G=fe({componentName:"AreaChart",data:C,accessors:{xAccessor:g,yAccessor:y}});if(G)return p.createElement(ye,{componentName:"AreaChart",message:G,width:r,height:s});const V=e.useMemo(()=>L||f?R.flatMap(e=>{const t=e[m]||[];return f&&"string"==typeof f?t.map(t=>Object.assign(Object.assign({},t),{[f]:e[f]})):t}):C,[R,m,L,f,C]),U=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area",data:V,xAccessor:g,yAccessor:y,groupAccessor:f||void 0,curve:x,lineStyle:$,size:[r,s],margin:I,showAxes:!0,xLabel:c,yLabel:u,xFormat:d,yFormat:h,enableHover:S,showGrid:E},H&&{legend:H}),l&&{title:l}),a&&{className:a}),{tooltipContent:O?he(O):X}),N&&{customHoverBehavior:Y}),j);return p.createElement(J,Object.assign({},U))}function Be(t){var n;const{data:o,width:r=600,height:s=400,margin:i,className:a,title:l,xLabel:c,yLabel:u,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:y="y",areaBy:f,lineDataAccessor:m="coordinates",colorBy:v,colorScheme:b="category10",curve:x="monotoneX",areaOpacity:A=.7,showLine:w=!0,lineWidth:k=2,normalize:S=!1,enableHover:E=!0,showGrid:M=!1,showLegend:O,tooltip:j,frameProps:P={},selection:N,linkedHover:C}=t,_=o||[],z=be(C,v?["string"==typeof v?v:""]:[]),B=Pe({name:(null==N?void 0:N.name)||"__unused__"}),W=Ne({name:(null==z?void 0:z.name)||"hover",fields:(null==z?void 0:z.fields)||[]}),L=N?{isActive:B.isActive,predicate:B.predicate}:null,R=void 0!==(null===(n=_[0])||void 0===n?void 0:n[m]),T=e.useMemo(()=>{if(R)return _;if(f){const e=_.reduce((e,t)=>{const n="function"==typeof f?f(t):t[f];if(!e[n]){const t={[m]:[]};"string"==typeof f&&(t[f]=n),e[n]=t}return e[n][m].push(t),e},{});return Object.values(e)}return[{[m]:_}]},[_,f,m,R]),D=ie(_,v,b),$=e.useMemo(()=>e=>{const t={},n=v?te(e,v,D):re;return t.fill=n,t.fillOpacity=A,w?(t.stroke=n,t.strokeWidth=k):t.stroke="none",t},[v,D,A,w,k]),F=e.useMemo(()=>Ae($,L,N),[$,L,N]),H=void 0!==O?O:T.length>1,I=e.useMemo(()=>{if(H&&v)return le({data:T,colorBy:v,colorScale:D,getColor:te})},[H,v,T,D]),Y=e.useMemo(()=>{const e=Object.assign(Object.assign({},{top:50,bottom:60,left:70,right:40}),i);return I&&120>e.right&&(e.right=120),e},[i,I]),q=e.useCallback(e=>{C&&W.onHover(e)},[C,W]),X=f||v,G=e.useMemo(()=>ge([{label:c||pe(g),accessor:g,role:"x"},{label:u||pe(y),accessor:y,role:"y"},...X?[{label:pe(X),accessor:X,role:"group"}]:[]]),[g,y,c,u,X]),V=fe({componentName:"StackedAreaChart",data:_,accessors:{xAccessor:g,yAccessor:y}});if(V)return p.createElement(ye,{componentName:"StackedAreaChart",message:V,width:r,height:s});const U=e.useMemo(()=>R||f?T.flatMap(e=>{const t=e[m]||[];return f&&"string"==typeof f?t.map(t=>Object.assign(Object.assign({},t),{[f]:e[f]})):t}):_,[T,m,R,f,_]),Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea",data:U,xAccessor:g,yAccessor:y,groupAccessor:f||void 0,curve:x,normalize:S,lineStyle:F,size:[r,s],margin:Y,showAxes:!0,xLabel:c,yLabel:u,xFormat:d,yFormat:h,enableHover:E,showGrid:M},I&&{legend:I}),l&&{title:l}),a&&{className:a}),{tooltipContent:j?he(j):G}),C&&{customHoverBehavior:q}),P);return p.createElement(J,Object.assign({},Q))}function We(t){const{data:n,width:o=600,height:r=400,margin:s,className:i,title:a,xLabel:l,yLabel:c,xFormat:u,yFormat:d,xAccessor:h="x",yAccessor:g="y",colorBy:y,colorScheme:f="category10",sizeBy:m,sizeRange:v=[3,15],pointRadius:b=5,pointOpacity:x=.8,enableHover:A=!0,showGrid:w=!1,showLegend:k,tooltip:S,marginalGraphics:E,frameProps:M={},selection:O,linkedHover:j,linkedBrush:P}=t,N=n||[],C=be(j,y?["string"==typeof y?y:""]:[]),_=xe(P),z=Pe({name:(null==O?void 0:O.name)||"__unused__"}),B=Ne({name:(null==C?void 0:C.name)||"hover",fields:(null==C?void 0:C.fields)||[]});Ce({name:(null==_?void 0:_.name)||"__unused_brush__",xField:(null==_?void 0:_.xField)||("string"==typeof h?h:void 0),yField:(null==_?void 0:_.yField)||("string"==typeof g?g:void 0)});const W=O?{isActive:z.isActive,predicate:z.predicate}:null,L=ie(N,y,f),R=e.useMemo(()=>{if(!m||0===N.length)return;const e=N.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[N,m]),T=e.useMemo(()=>e=>{const t={fillOpacity:x};return t.fill=y?te(e,y,L):re,t.r=m?oe(e,m,v,R):b,t},[y,L,m,v,R,b,x]),D=e.useMemo(()=>Ae(T,W,O),[T,W,O]),$=void 0!==k?k:!!y,F=e.useMemo(()=>{if($&&y)return le({data:N,colorBy:y,colorScale:L,getColor:te})},[$,y,N,L]),H=e.useMemo(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},s);return F&&120>e.right&&(e.right=120),e},[s,F]),I=e.useCallback(e=>{j&&B.onHover(e)},[j,B]),Y=e.useMemo(()=>ge([{label:l||pe(h),accessor:h,role:"x"},{label:c||pe(g),accessor:g,role:"y"},...y?[{label:pe(y),accessor:y,role:"color"}]:[],...m?[{label:pe(m),accessor:m,role:"size"}]:[]]),[h,g,l,c,y,m]),q=fe({componentName:"Scatterplot",data:N,accessors:{xAccessor:h,yAccessor:g}});if(q)return p.createElement(ye,{componentName:"Scatterplot",message:q,width:o,height:r});const X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter",data:N,xAccessor:h,yAccessor:g,colorAccessor:y||void 0,sizeAccessor:m||void 0,sizeRange:v,pointStyle:D,colorScheme:f,size:[o,r],margin:H,showAxes:!0,xLabel:l,yLabel:c,xFormat:u,yFormat:d,enableHover:A,showGrid:w},F&&{legend:F}),a&&{title:a}),i&&{className:i}),{tooltipContent:S?he(S):Y}),j&&{customHoverBehavior:I}),E&&{marginalGraphics:E}),M);return p.createElement(J,Object.assign({},X))}function Le(t){const{data:n,width:o=600,height:r=400,margin:s,className:i,title:a,xLabel:l,yLabel:c,xFormat:u,yFormat:d,xAccessor:h="x",yAccessor:g="y",sizeBy:y,sizeRange:f=[5,40],colorBy:m,colorScheme:v="category10",bubbleOpacity:b=.6,bubbleStrokeWidth:x=1,bubbleStrokeColor:A="white",enableHover:w=!0,showGrid:k=!1,showLegend:S,tooltip:E,marginalGraphics:M,frameProps:O={},selection:j,linkedHover:P,linkedBrush:N}=t,C=n||[],_=be(P,m?["string"==typeof m?m:""]:[]),z=xe(N),B=Pe({name:(null==j?void 0:j.name)||"__unused__"}),W=Ne({name:(null==_?void 0:_.name)||"hover",fields:(null==_?void 0:_.fields)||[]});Ce({name:(null==z?void 0:z.name)||"__unused_brush__",xField:(null==z?void 0:z.xField)||("string"==typeof h?h:void 0),yField:(null==z?void 0:z.yField)||("string"==typeof g?g:void 0)});const L=j?{isActive:B.isActive,predicate:B.predicate}:null,R=ie(C,m,v),T=e.useMemo(()=>{const e=C.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[C,y]),D=e.useMemo(()=>e=>{const t={fillOpacity:b,strokeWidth:x,stroke:A};return t.fill=m?te(e,m,R):re,t.r=oe(e,y,f,T),t},[m,R,y,f,T,b,x,A]),$=e.useMemo(()=>Ae(D,L,j),[D,L,j]),F=void 0!==S?S:!!m,H=e.useMemo(()=>{if(F&&m)return le({data:C,colorBy:m,colorScale:R,getColor:te,strokeColor:A,strokeWidth:x})},[F,m,C,R,A,x]),I=e.useMemo(()=>{const e=Object.assign(Object.assign({},{top:50,bottom:60,left:70,right:40}),s);return H&&120>e.right&&(e.right=120),e},[s,H]),Y=e.useCallback(e=>{P&&W.onHover(e)},[P,W]),q=e.useMemo(()=>ge([{label:l||pe(h),accessor:h,role:"x"},{label:c||pe(g),accessor:g,role:"y"},{label:pe(y),accessor:y,role:"size"},...m?[{label:pe(m),accessor:m,role:"color"}]:[]]),[h,g,l,c,y,m]),X=fe({componentName:"BubbleChart",data:C,accessors:{xAccessor:h,yAccessor:g},requiredProps:{sizeBy:y}});if(X)return p.createElement(ye,{componentName:"BubbleChart",message:X,width:o,height:r});const G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble",data:C,xAccessor:h,yAccessor:g,colorAccessor:m||void 0,sizeAccessor:y,sizeRange:f,pointStyle:$,colorScheme:v,size:[o,r],margin:I,showAxes:!0,xLabel:l,yLabel:c,xFormat:u,yFormat:d,enableHover:w,showGrid:k},H&&{legend:H}),a&&{title:a}),i&&{className:i}),{tooltipContent:E?he(E):q}),P&&{customHoverBehavior:Y}),M&&{marginalGraphics:M}),O);return p.createElement(J,Object.assign({},G))}function Re(t){const{data:n,width:r=600,height:i=400,margin:a={top:50,bottom:60,left:70,right:80},className:l,title:c,xAccessor:u="x",yAccessor:d="y",valueAccessor:h="value",xLabel:g,yLabel:y,xFormat:f,yFormat:m,colorScheme:v="blues",customColorScale:b,showValues:x=!1,valueFormat:A,cellBorderColor:w="#fff",cellBorderWidth:k=1,enableHover:S=!0,tooltip:E,frameProps:M={},selection:O,linkedHover:j}=t,P=n||[],N=be(j,[]),C=Pe({name:(null==O?void 0:O.name)||"__unused__"}),_=Ne({name:(null==N?void 0:N.name)||"hover",fields:(null==N?void 0:N.fields)||[]}),z=O?{isActive:C.isActive,predicate:C.predicate}:null,B=e.useMemo(()=>"function"==typeof h?e=>h(e):e=>e[h],[h]),W=e.useMemo(()=>{const e=P.map(B);return[Math.min(...e),Math.max(...e)]},[P,B]),L=e.useMemo(()=>"custom"===v&&b?b:o.scaleSequential({blues:s.interpolateBlues,reds:s.interpolateReds,greens:s.interpolateGreens,viridis:s.interpolateViridis}[v]||s.interpolateBlues).domain(W),[v,b,W]);e.useMemo(()=>{const e=se(u),t=se(d);return{xBinCount:new Set(P.map(e)).size,yBinCount:new Set(P.map(t)).size}},[P,u,d]),e.useMemo(()=>({coordinates:P}),[P]);const R=e.useMemo(()=>e=>{const t=B(e);return{fill:L(t),stroke:w,strokeWidth:k}},[B,L,w,k]);e.useMemo(()=>Ae(R,z,O),[R,z,O]),e.useMemo(()=>{if(!x)return;const e=(W[0]+W[1])/2;return(t,n)=>{const o=B(t),r=A?A(o):o+"";return p.createElement("text",{textAnchor:"middle",dominantBaseline:"middle",fill:B(t)>e?"#fff":"#000",fontSize:"12px"},r)}},[x,B,A,W]);const T=e.useCallback(e=>{j&&_.onHover(e)},[j,_]),D=e.useMemo(()=>ge([{label:g||pe(u),accessor:u,role:"x"},{label:y||pe(d),accessor:d,role:"y"},{label:pe(h),accessor:h,role:"value"}]),[u,d,g,y,h]),$=fe({componentName:"Heatmap",data:P,accessors:{xAccessor:u,yAccessor:d,valueAccessor:h}});if($)return p.createElement(ye,{componentName:"Heatmap",message:$,width:r,height:i});const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"heatmap",data:P,xAccessor:u,yAccessor:d,valueAccessor:h,size:[r,i],margin:a,showAxes:!0,xLabel:g,yLabel:y,xFormat:f,yFormat:m,enableHover:S},c&&{title:c}),l&&{className:l}),{tooltipContent:E?he(E):D}),j&&{customHoverBehavior:T}),M);return p.createElement(J,Object.assign({},F))}function Te({selections:t}){const n=je(e=>e.setResolution);return e.useEffect(()=>{for(const[e,o]of Object.entries(t))o.resolution&&n(e,o.resolution)},[]),null}function De({children:e,selections:t}){return p.createElement(Oe,null,t&&p.createElement(Te,{selections:t}),e)}_e.displayName="LineChart",ze.displayName="AreaChart",Be.displayName="StackedAreaChart",We.displayName="Scatterplot",Le.displayName="BubbleChart",Re.displayName="Heatmap";const $e="__splomIdx",Fe={top:4,bottom:4,left:4,right:4};function He({frameRef:o,cellSize:r,onBrush:s}){const i=e.useRef(null),a=r-Fe.left-Fe.right,l=r-Fe.top-Fe.bottom;return e.useEffect(()=>{if(!i.current)return;const e=n.select(i.current).select(".brush-g"),r=t.brush().extent([[0,0],[a,l]]).on("brush end",e=>{var t;const n=null===(t=o.current)||void 0===t?void 0:t.getScales();if(!n)return;if(!e.selection)return void s(null);const[[r,i],[a,l]]=e.selection,c=[[n.x.invert(r),n.y.invert(i)],[n.x.invert(a),n.y.invert(l)]];s(c)});return e.call(r),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{r.on("brush end",null)}},[a,l,o,s]),p.createElement("svg",{ref:i,width:r,height:r,style:{position:"absolute",top:0,left:0}},p.createElement("g",{className:"brush-g",transform:`translate(${Fe.left},${Fe.top})`}))}function Ie({data:t,xField:n,yField:o,cellSize:r,pointRadius:s,pointOpacity:i,colorBy:a,colorScale:l,brushSelectionName:c,hoverSelectionName:u,unselectedOpacity:d,mode:h,onPointHover:g}){const y=e.useRef(null),f=Pe({name:c,clientId:`splom-${n}-${o}`}),m=Ce({name:c,xField:n,yField:o}),v=Pe({name:u,clientId:"splom-hover-source"}),b=v.selectPoints,x=e.useCallback(e=>{e?m.brushInteraction.during(e):m.brushInteraction.end(null)},[m.brushInteraction]),A=e.useCallback(e=>{if(!e)return void(null==g||g(null));const t=e.data,n=null==t?void 0:t[$e];void 0!==n&&(b({[$e]:[n]}),null==g||g(t,e.x+Fe.left,e.y+Fe.top))},[b,g]),w=e.useCallback(e=>{const t={opacity:i,r:s};return t.fill=a?te(e,a,l):re,"hover"===h?v.isActive&&v.predicate(e)?(t.opacity=1,t.r=2.5*s,t.stroke="#333",t.strokeWidth=1.5):v.isActive&&(t.opacity=.6*i):f.isActive&&!f.predicate(e)&&(t.opacity=d),t},[a,l,i,s,h,f.isActive,f.predicate,v.isActive,v.predicate,d]);return p.createElement("div",{style:{position:"relative",width:r,height:r}},p.createElement(J,{ref:y,chartType:"scatter",data:t,size:[r,r],xAccessor:n,yAccessor:o,pointStyle:w,margin:Fe,showAxes:!1,enableHover:"hover"===h,customHoverBehavior:"hover"===h?A:void 0,tooltipContent:"hover"===h?()=>null:void 0}),"brush"===h&&p.createElement(He,{frameRef:y,cellSize:r,xField:n,yField:o,onBrush:x}))}function Ye({data:t,field:n,label:o,cellSize:r,bins:s,brushSelectionName:i,hoverSelectionName:a,mode:l}){const c=Pe({name:i,clientId:"splom-diag-"+n}),u=Pe({name:a,clientId:`splom-diag-${n}-hover`}),d="hover"===l?u:c,h=d.isActive,g=d.predicate,y=e.useMemo(()=>{const e=t.map(e=>e[n]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],max:0};const o=Math.min(...e),i=(Math.max(...e)-o)/s||1,a=Array(s).fill(0),l=Array(s).fill(0);for(const e of t){const t=e[n];if(null==t||isNaN(t))continue;const r=Math.min(Math.floor((t-o)/i),s-1);a[r]++,h&&!g(e)||l[r]++}const c=Math.max(...a,1);return{bars:a.map((e,t)=>({x:t/s*r,w:r/s-1,h:e/c*(r-24),count:e})),selectedBars:l.map((e,t)=>({x:t/s*r,w:r/s-1,h:e/c*(r-24),count:e})),max:c}},[t,n,s,r,h,g]);return p.createElement("svg",{width:r,height:r,style:{overflow:"hidden"}},p.createElement("text",{x:r/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333"},o),y.bars.map((e,t)=>p.createElement("rect",{key:"bg-"+t,x:e.x,y:r-e.h,width:Math.max(e.w,1),height:e.h,fill:"#ccc",opacity:h?.3:.6})),h&&y.selectedBars.map((e,t)=>p.createElement("rect",{key:"sel-"+t,x:e.x,y:r-e.h,width:Math.max(e.w,1),height:e.h,fill:re,opacity:.7})))}function qe({label:e,cellSize:t}){return p.createElement("svg",{width:t,height:t},p.createElement("text",{x:t/2,y:t/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333"},e))}function Xe(t){const{data:n,fields:o,fieldLabels:r={},colorBy:s,colorScheme:i="category10",cellSize:a=150,cellGap:l=4,pointRadius:c=2,pointOpacity:u=.5,diagonal:d="histogram",histogramBins:h=20,brushMode:g="crossfilter",hoverMode:y=!0,unselectedOpacity:f=.1,showGrid:m=!1,tooltip:v,showLegend:b,idAccessor:x,className:A}=t,w="splom",k="splom-hover",S=y?"hover":g?"brush":"hover",E=je(e=>e.clearSelection),[M,O]=e.useState(null),j=e.useCallback(()=>{E(k),O(null)},[E,k]),P=e.useMemo(()=>(n||[]).map((e,t)=>void 0!==e[$e]?e:Object.assign(Object.assign({},e),{[$e]:t})),[n]),N=ie(P,s,i),C=void 0!==b?b:!!s,_=e.useMemo(()=>{if(!C||!s)return null;const e="string"==typeof s?s:null;return e?[...new Set(P.map(t=>t[e]))].map(e=>({label:e+"",color:N?N(e+""):re})):null},[C,s,P,N]),z=e.useMemo(()=>({display:"grid",gridTemplateColumns:"40px "+o.map(()=>a+"px").join(" "),gridTemplateRows:o.map(()=>a+"px").join(" ")+" 40px",gap:l+"px",width:"fit-content"}),[o,a,l,40]);return p.createElement("div",{className:A,style:{position:"relative"}},_&&p.createElement("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"}},_.map(e=>p.createElement("div",{key:e.label,style:{display:"flex",alignItems:"center",gap:4}},p.createElement("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:e.color}}),p.createElement("span",{style:{fontSize:11}},e.label)))),p.createElement("div",{style:z,onMouseLeave:"hover"===S?j:void 0},o.map((e,t)=>p.createElement(p.Fragment,{key:"row-"+e},p.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"}},r[e]||e),o.map((n,o)=>t===o?"label"===d?p.createElement(qe,{key:"diag-"+e,label:r[e]||e,cellSize:a}):p.createElement(Ye,{key:"diag-"+e,data:P,field:e,label:r[e]||e,cellSize:a,bins:h,colorBy:s,colorScale:N,brushSelectionName:w,hoverSelectionName:k,unselectedOpacity:f,mode:S}):p.createElement(Ie,{key:`cell-${e}-${n}`,data:P,xField:n,yField:e,fieldLabels:r,cellSize:a,pointRadius:c,pointOpacity:u,colorBy:s,colorScale:N,brushSelectionName:w,hoverSelectionName:k,unselectedOpacity:f,showGrid:m,tooltip:v,mode:S,onPointHover:"hover"===S?(r,s,i)=>{O(r?{datum:r,xField:n,yField:e,colIndex:o,rowIndex:t,px:null!=s?s:0,py:null!=i?i:0}:null)}:void 0})))),p.createElement("div",null)," ",o.map(e=>p.createElement("div",{key:"col-label-"+e,style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"}},r[e]||e))),M&&"hover"===S&&(()=>{const e=M.datum,t=r[M.xField]||M.xField,n=r[M.yField]||M.yField,o=s?"function"==typeof s?s(e):e[s]:null,i=x?"function"==typeof x?x(e):e[x]:"Row "+e[$e];return p.createElement("div",{style:{position:"absolute",left:40+M.colIndex*(a+l)+M.px,top:M.rowIndex*(a+l)+M.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10}},p.createElement("div",{style:{fontWeight:"bold",marginBottom:2}},i+""),p.createElement("div",null,t,": ",null!=e[M.xField]?Number(e[M.xField]).toFixed(1):"–"),p.createElement("div",null,n,": ",null!=e[M.yField]?Number(e[M.yField]).toFixed(1):"–"),null!=o&&p.createElement("div",{style:{opacity:.8}},"string"==typeof s?s:"group",": ",o+""))})())}function Ge(e){const{brushMode:t="crossfilter",hoverMode:n=!0}=e,o={};return!n&&t&&(o.splom={resolution:t}),n&&(o["splom-hover"]={resolution:"union"}),p.createElement(De,{selections:o},p.createElement(Xe,Object.assign({},e)))}function Ve(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,s=[],i=Math.min(t.width,t.height)/2-4,a="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,o=r(e.pieceData[0],e.name);s.push({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:i,startAngle:t,endAngle:n,style:o,datum:e.pieceData,category:e.name})}return s}Ge.displayName="ScatterplotMatrix";const Ue={bar:function(e,t){const{scales:n,columns:o,config:r,getR:s,getStack:i,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h="horizontal"===c,p=r.normalize;for(const e of Object.values(o)){const t=new Map;for(const n of e.pieceData){const e=i?i(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=s(n),o.pieces.push(n)}let n=0;if(p)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const[s,c]of t){let t=c.total;p&&n>0&&(t/=n);const g=a(c.pieces[0],i?s:e.name),y=Object.assign(Object.assign({},c.pieces[0]),{__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name});if(d){const n=l(0>t?r:o+t),i=0>t?l(r+t)-l(r):l(o)-l(o+t);u.push(w(e.x,n,e.width,Math.abs(i),g,y,s)),0>t?r+=t:o+=t}else if(h){const n=l(0>t?r+t:o),i=0>t?l(r)-l(r+t):l(o+t)-l(o);u.push(w(n,e.x,Math.abs(i),e.width,g,y,s)),0>t?r+=t:o+=t}}}return u},clusterbar:function(e,t){const{scales:n,columns:o,getR:r,getGroup:s,resolvePieceStyle:i}=e,{r:a,projection:l}=n,c=[],u="vertical"===l,d=[],h=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=s?s(t):"_default";h.has(e)||(h.add(e),d.push(e))}const p=d.length||1;for(const e of Object.values(o)){const t=e.width/p,n=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";n.has(e)||n.set(e,[]),n.get(e).push(t)}for(let o=0;d.length>o;o++){const s=n.get(d[o])||[];for(const n of s){const s=r(n),l=i(n,e.name);if(u){const r=e.x+o*t,i=a(0),u=a(s);c.push(w(r,Math.min(i,u),t,Math.abs(i-u),l,n,d[o]))}else{const r=e.x+o*t,i=a(0),u=a(s);c.push(w(Math.min(i,u),r,Math.abs(u-i),t,l,n,d[o]))}}}}return c},point:function(e,t){var n,o;const{scales:r,columns:s,getR:i,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=r,d=[],h="vertical"===u,p="radial"===u,g=a.length>0,y=2*Math.PI,f=-Math.PI/2;for(const e of Object.values(s))for(const t of e.pieceData){const r=null!==(n=t.__rIndex)&&void 0!==n?n:0,s=null!==(o=t.__rValue)&&void 0!==o?o:i(t),u=g&&a[r]||c,m=l(t,e.name),v=m.r||5;let b,x;if(p){const t=f+(e.pctStart+e.pct/2)*y,n=u(s);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(s)):(b=u(s),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:s}=e,{r:i,projection:a}=n,l=[],c="vertical"===a;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],a=r(o),u=s(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,p=c?e.middle+h:i(a),g=c?i(a):e.middle+h;l.push({type:"point",x:p,y:g,r:d,style:u,datum:o})}}return l},pie:Ve,donut:Ve,boxplot:function(e,t){var n,o,s,i,a;const{scales:l,columns:c,config:u,getR:d,resolveSummaryStyle:h}=e,{r:p,projection:g}=l,y=[],f="vertical"===g,m=!1!==u.showOutliers;for(const e of Object.values(c)){const t=e.pieceData.map(e=>d(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const l=t[0],c=t[t.length-1],u=null!==(n=r.quantile(t,.25))&&void 0!==n?n:l,g=null!==(o=r.quantile(t,.5))&&void 0!==o?o:(l+c)/2,v=null!==(s=r.quantile(t,.75))&&void 0!==s?s:c,b=v-u,x=u-1.5*b,A=v+1.5*b,w=null!==(i=t.find(e=>e>=x))&&void 0!==i?i:l,k=null!==(a=[...t].reverse().find(e=>A>=e))&&void 0!==a?a:c,S=h(e.pieceData[0],e.name),E=[];if(m)for(const t of e.pieceData){const n=d(t);if(x>n||n>A){const o=f?e.middle:p(n),r=f?p(n):e.middle;E.push({px:o,py:r,value:n,datum:t})}}if(y.push({type:"boxplot",x:f?e.middle:0,y:f?0:e.middle,projection:f?"vertical":"horizontal",columnWidth:.6*e.width,minPos:p(w),q1Pos:p(u),medianPos:p(g),q3Pos:p(v),maxPos:p(k),stats:{min:w,q1:u,median:g,q3:v,max:k},style:S,datum:e.pieceData,category:e.name,outliers:E}),m)for(const e of E)y.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:S.fill||"#999",opacity:.6},datum:e.datum})}return y},violin:function(e,t){var n,o,s;const{scales:i,columns:a,config:l,getR:c,resolveSummaryStyle:u}=e,{r:d,projection:h}=i,p=[],g="vertical"===h,y=l.bins||20,f=!1!==l.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>c(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const i=t[0],a=t[t.length-1],l=(a-i)/y||1,h=Array(y).fill(0);for(const e of t)h[Math.min(Math.floor((e-i)/l),y-1)]++;const m=Math.max(...h,1),v=e.width/2*.9;let b="";if(g){for(let t=0;y>t;t++){const n=d(i+(t+.5)*l),o=h[t]/m*v;b+=0===t?`M ${e.middle+o} ${n}`:` L ${e.middle+o} ${n}`}for(let t=y-1;t>=0;t--){const n=d(i+(t+.5)*l);b+=` L ${e.middle-h[t]/m*v} ${n}`}b+=" Z"}else{for(let t=0;y>t;t++){const n=d(i+(t+.5)*l),o=h[t]/m*v;b+=0===t?`M ${n} ${e.middle-o}`:` L ${n} ${e.middle-o}`}for(let t=y-1;t>=0;t--)b+=` L ${d(i+(t+.5)*l)} ${e.middle+h[t]/m*v}`;b+=" Z"}const x=u(e.pieceData[0],e.name);let A;if(f&&t.length>=4){const e=null!==(n=r.quantile(t,.25))&&void 0!==n?n:i,l=null!==(o=r.quantile(t,.5))&&void 0!==o?o:(i+a)/2,c=null!==(s=r.quantile(t,.75))&&void 0!==s?s:a;A={q1Pos:d(e),medianPos:d(l),q3Pos:d(c)}}const w=g?{x:e.x,y:Math.min(d(a),d(i)),width:e.width,height:Math.abs(d(a)-d(i))}:{x:Math.min(d(i),d(a)),y:e.x,width:Math.abs(d(a)-d(i)),height:e.width};p.push({type:"violin",pathString:b,translateX:0,translateY:0,bounds:w,iqrLine:A,style:x,datum:e.pieceData,category:e.name})}return p},histogram:function(e,t){const{scales:n,columns:o,config:r,getR:s,resolveSummaryStyle:i}=e,{r:a}=n,l=[],c=r.bins||25,u=r.normalize;for(const e of Object.values(o)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=Math.min(...t),o=(Math.max(...t)-n)/c||1,r=Array(c).fill(0);for(const e of t)r[Math.min(Math.floor((e-n)/o),c-1)]++;const d=t.length,h=Math.max(...r,1),p=i(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===r[t])continue;const s=(u?r[t]/d:r[t]/h)*e.width*.9,i=a(n+t*o),c=a(n+(t+1)*o);l.push(w(Math.min(i,c),e.x+e.width-s,Math.abs(c-i),s,p,{bin:t,count:r[t],range:[n+t*o,n+(t+1)*o],category:e.name},e.name))}}return l},ridgeline:function(e,t){var n;const{scales:o,columns:r,config:s,getR:i,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,u=[],d=s.bins||20,h="horizontal"===c,p=s.amplitude||1.5;for(const e of Object.values(r)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],s=(r-o)/d||1,c=Array(d).fill(0);for(const e of t)c[Math.min(Math.floor((e-o)/s),d-1)]++;const g=Math.max(...c,1),y=a(e.pieceData[0],e.name),f=e.width*p;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(o+(e+.5)*s)} ${t-c[e]/g*f}`;m+=` L ${l(r)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*s);m+=` L ${t+c[e]/g*f} ${n}`}m+=` L ${t} ${l(r)} Z`}const v=h?{x:Math.min(l(o),l(r)),y:e.x,width:Math.abs(l(r)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(r),l(o)),width:e.width,height:Math.abs(l(r)-l(o))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,style:Object.assign(Object.assign({},y),{fillOpacity:null!==(n=y.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:s}=e,{r:i,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,a]=n,u=s(t,e.name);if(c){const n=i(Math.min(o,a)),r=i(Math.max(o,a));l.push(w(n,e.x,r-n,e.width,u,t,e.name))}else{const n=i(Math.max(o,a)),r=i(Math.min(o,a));l.push(w(e.x,n,e.width,r-n,u,t,e.name))}}return l}};class Qe{constructor(e){this.rExtent=new m,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.version=0,this.config=e,this.buffer=new f(e.windowSize),this.getO=E(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>S(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new m)):(this.getR=S(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=E(e.stackBy),this.getGroup=E(e.groupBy),this.getColor=E(e.colorAccessor),this.getConnector=E(e.connectorAccessor),e.pulse&&(this.timestampBuffer=new f(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,e.bounded){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const r=n.toArray(),s=t.projection||"vertical",i=t.oExtent||this.resolveCategories(r),a=this.computeValueDomain(r,i),l="horizontal"===s,c=null!=t.barPadding?t.barPadding/("vertical"===s?e.width:e.height):.1;let u,d;if("radial"===s){u=o.scaleBand().domain(i).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,r=t.innerRadius||0;d=o.scaleLinear().domain(a).range([r,n])}else l?(u=o.scaleBand().domain(i).range([0,e.height]).padding(c),d=o.scaleLinear().domain(a).range([0,e.width])):(u=o.scaleBand().domain(i).range([0,e.width]).padding(c),d=o.scaleLinear().domain(a).range([e.height,0]));this.scales={o:u,r:d,projection:s},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((r,s)=>{const i=this.rExtents[s];i.dirty&&i.recalculate(n,r);let[a,c]=i.extent;a===1/0&&(a=0,c=1);const u=c-a,d=u>0?u*(t.extentPadding||.05):1;return a-=d,c+=d,a>0&&(a=0),l?o.scaleLinear().domain([a,c]).range([0,e.width]):o.scaleLinear().domain([a,c]).range([e.height,0])}):[];let h=r;this.rAccessors.length>1&&(h=r.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(h,i,u,s,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.config.decay&&this.applyDecay(this.scene,r),this.config.pulse&&this.applyPulse(this.scene,r),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=Array.isArray(this.config.rAccessor)?this.config.rAccessor[e]:this.config.rAccessor;return"string"==typeof t?t:"value"+e}resolveCategories(e){const t=Array.from(this.categories),n=this.config.oSort;if("streaming"===this.config.runtimeMode&&void 0===n)return t;if(!1===n)return t;if("function"==typeof n)return t.sort(n);const o=new Map;for(const t of e){const e=this.getO(t);o.set(e,(o.get(e)||0)+Math.abs(this.getR(t)))}return t.sort("asc"===n?(e,t)=>(o.get(e)||0)-(o.get(t)||0):(e,t)=>(o.get(t)||0)-(o.get(e)||0))}computeValueDomain(e,t){var n,o;const r=this.config.chartType,s=this.config.extentPadding||.05;if("radial"===this.config.projection&&("pie"===r||"donut"===r))return[0,1];let i=0,a=0;if("bar"===r&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),r=this.getR(o);0>r?n.set(e,(n.get(e)||0)+r):t.set(e,(t.get(e)||0)+r)}for(const e of t.values())e>a&&(a=e);for(const e of n.values())i>e&&(i=e)}else if("bar"===r){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>a&&(a=e),i>e&&(i=e)}else if("clusterbar"===r)for(const t of e){const e=this.getR(t);e>a&&(a=e),i>e&&(i=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(i=e),t!==-1/0&&(a=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(i=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(a=this.config.rExtent[1]));const l=a-i,c=l>0?l*s:1;return(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])||(i-=c),(null===(o=this.config.rExtent)||void 0===o?void 0:o[1])||(a+=c),"bar"!==r&&"clusterbar"!==r||(i>0&&(i=0),0>a&&(a=0)),[i,a]}buildColumns(e,t,n,o,r){var s;const i={},a=new Map;for(const t of e){const e=this.getO(t);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=a.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const s=("horizontal"===o?r.height:r.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*s)}let d=0,h=0;for(const e of t){const t=a.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),r=l>0?o/l:0;let c,p;u?(c=h,p=u.get(e)||n.bandwidth(),h+=p+n.padding()*n.step()):(c=null!==(s=n(e))&&void 0!==s?s:0,p=n.bandwidth()),i[e]={name:e,x:c,y:0,width:p,middle:c+p/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:d},d+=r}return i}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];const n=this.getSceneContext(),o=Ue[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:r,getO:s}=e;if(!r||!n)return[];const i=[],{projection:a}=n,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=r(t);if(!n)continue;let o,i;"point"===e.type?(o=e.x,i=e.y):(o=e.x+e.w/2,i=e.y+("vertical"===a?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:i,datum:t,category:s(t)})}const c=n.o.domain(),u=o.connectorStyle;for(const[e,t]of l)if(t.length>=2){t.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let n=0;t.length-1>n;n++){const o=t[n],r=t[n+1],s="function"==typeof u?u(o.datum):u||{stroke:"#999",strokeWidth:1,opacity:.5};i.push({type:"connector",x1:o.x,y1:o.y,x2:r.x,y2:r.y,style:s,datum:o.datum,group:e})}}return i}(n,r);r=[...e,...r]}return r}resolvePieceStyle(e,t){return"function"==typeof this.config.pieceStyle?this.config.pieceStyle(e,t):this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){var n,o,r;const s=this.config.decay;if(!s||1>=t)return 1;const i=null!==(n=s.minOpacity)&&void 0!==n?n:.1,a=t-1-e;switch(s.type){case"linear":return i+(1-a/(t-1))*(1-i);case"exponential":{const e=null!==(o=s.halfLife)&&void 0!==o?o:t/2;return i+Math.pow(.5,a/e)*(1-i)}case"step":return(null!==(r=s.stepThreshold)&&void 0!==r?r:.5*t)>a?1:i;default:return 1}}applyDecay(e,t){var n,o;if(!this.config.decay)return;const r=t.length;if(1>=r)return;const s=new Map;for(let e=0;t.length>e;e++)s.set(t[e],e);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=s.get(t.datum);if(null==e)continue;const i=this.computeDecayOpacity(e,r),a=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*i})}}applyPulse(e,t){var n,o;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,i=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",a=new Map;for(let e=0;t.length>e;e++)a.set(t[e],e);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=a.get(t.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const o=r-n;s>o&&(t._pulseIntensity=1-o/s,t._pulseColor=i)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}snapshotPositions(){var e,t;this.prevPositionMap.clear();for(let n=0;this.scene.length>n;n++){const o=this.scene[n];if("point"===o.type)this.prevPositionMap.set("p:"+n,{x:o.x,y:o.y,r:o.r});else if("rect"===o.type){const r=`r:${o.group||""}:${null!==(t=null===(e=o.datum)||void 0===e?void 0:e.category)&&void 0!==t?t:n}`;this.prevPositionMap.set(r,{x:o.x,y:o.y,w:o.w,h:o.h})}}}startTransition(){var e,t,n,o,r;if(!this.config.transition||0===this.prevPositionMap.size)return;const s=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;let i=!1;for(let e=0;this.scene.length>e;e++){const s=this.scene[e];let a=null;if("point"===s.type?a="p:"+e:"rect"===s.type&&(a=`r:${s.group||""}:${null!==(n=null===(t=s.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:e}`),!a)continue;const l=this.prevPositionMap.get(a);l&&("point"===s.type?l.x===s.x&&l.y===s.y||(s._targetX=s.x,s._targetY=s.y,s.x=l.x,s.y=l.y,i=!0):"rect"===s.type&&(l.x===s.x&&l.y===s.y&&l.w===s.w&&l.h===s.h||(s._targetX=s.x,s._targetY=s.y,s._targetW=s.w,s._targetH=s.h,s.x=l.x,s.y=l.y,s.w=null!==(o=l.w)&&void 0!==o?o:s.w,s.h=null!==(r=l.h)&&void 0!==r?r:s.h,i=!0)))}i&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:s})}advanceTransition(e){var t,n,o;if(!this.activeTransition)return!1;const r=Math.min((e-this.activeTransition.startTime)/this.activeTransition.duration,1),s="linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?r:1-Math.pow(1-r,3);for(const e of this.scene)if("point"===e.type){if(void 0===e._targetX)continue;const t=this.prevPositionMap.get("p:0");if(!t)continue;e.x=t.x+(e._targetX-t.x)*s,e.y=t.y+(e._targetY-t.y)*s}else if("rect"===e.type){if(void 0===e._targetX)continue;const t=`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:0}`,r=this.prevPositionMap.get(t);if(!r)continue;e.x=r.x+(e._targetX-r.x)*s,e.y=r.y+(e._targetY-r.y)*s,void 0!==r.w&&(e.w=r.w+(e._targetW-r.w)*s,e.h=r.h+(e._targetH-r.h)*s)}if(r>=1){for(const e of this.scene)if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}return this.activeTransition=null,!1}return!0}getData(){return this.buffer.toArray()}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){e.colorScheme!==this.config.colorScheme&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),Object.assign(this.config,e)}}function Ze(e,t,n){return e.x>t||t>e.x+e.w||e.y>n||n>e.y+e.h?null:{datum:e.datum,x:e.x+e.w/2,y:e.y,distance:0,category:e.group}}function Je(e,t,n){const o=t-e.x,r=n-e.y,s=Math.sqrt(o*o+r*r);return s>Math.max(e.r,5)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function Ke(e,t,n){const o=t-e.cx,r=n-e.cy,s=Math.sqrt(o*o+r*r);if(e.innerRadius>s||s>e.outerRadius)return null;let i=Math.atan2(r,o);0>i&&(i+=2*Math.PI);let a=e.startAngle%(2*Math.PI),l=e.endAngle%(2*Math.PI);if(0>a&&(a+=2*Math.PI),0>l&&(l+=2*Math.PI),!(a>l?i>=a||l>=i:i>=a&&l>=i))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function et(e,t,n){const o=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category}}else{const r=e.y-o,s=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>n||n>s))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category}}return null}function tt(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:s,height:i}=e.bounds;return o>t||t>o+s||r>n||n>r+i?null:{datum:e.datum,x:o+s/2,y:r+i/2,distance:0,category:e.category}}function nt(e){return Math.round(100*e)/100+""}function ot(t){const{width:n,height:o,totalWidth:r,totalHeight:s,margin:i,scales:a,showAxes:l,oLabel:c,rLabel:u,oFormat:d,rFormat:h,showGrid:g,title:y,legend:f,foregroundGraphics:m,annotations:v,svgAnnotationRules:b,annotationFrame:x,children:A}=t,w="radial"===(null==a?void 0:a.projection),k="horizontal"===(null==a?void 0:a.projection),S=e.useMemo(()=>l&&a&&!w?a.o.domain().map(e=>{var t;return{value:e,pixel:(null!==(t=a.o(e))&&void 0!==t?t:0)+a.o.bandwidth()/2,label:d?d(e):e}}):[],[l,a,d,w]),E=e.useMemo(()=>l&&a&&!w?a.r.ticks(5).map(e=>({value:e,pixel:a.r(e),label:(h||nt)(e)})):[],[l,a,h,w]),M=e.useMemo(()=>v&&0!==v.length&&b?v.map((e,t)=>b(e,t,{scales:a?{time:a.r,value:a.r}:null,timeAxis:"x",width:n,height:o})).filter(Boolean):null,[v,b,n,o,x]);return l||y||f||m||M&&M.length>0||g||A?p.createElement("svg",{width:r,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},p.createElement("g",{transform:`translate(${i.left},${i.top})`},g&&a&&!w&&p.createElement("g",{className:"ordinal-grid"},E.map((e,t)=>p.createElement("line",{key:"grid-"+t,x1:k?e.pixel:0,y1:k?0:e.pixel,x2:k?e.pixel:n,y2:k?o:e.pixel,stroke:"#e0e0e0",strokeWidth:1}))),l&&a&&!w&&p.createElement("g",{className:"ordinal-axes"},k?p.createElement(p.Fragment,null,p.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"#ccc",strokeWidth:1}),S.map((e,t)=>p.createElement("g",{key:"cat-"+t,transform:`translate(0,${e.pixel})`},p.createElement("line",{x2:-5,stroke:"#ccc",strokeWidth:1}),p.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},e.label))),c&&p.createElement("text",{x:15-i.left,y:o/2,textAnchor:"middle",fontSize:12,fill:"#333",transform:`rotate(-90, ${15-i.left}, ${o/2})`,style:{userSelect:"none"}},c),p.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"#ccc",strokeWidth:1}),E.map((e,t)=>p.createElement("g",{key:"val-"+t,transform:`translate(${e.pixel},${o})`},p.createElement("line",{y2:5,stroke:"#ccc",strokeWidth:1}),p.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},e.label))),u&&p.createElement("text",{x:n/2,y:o+40,textAnchor:"middle",fontSize:12,fill:"#333",style:{userSelect:"none"}},u)):p.createElement(p.Fragment,null,p.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"#ccc",strokeWidth:1}),S.map((e,t)=>p.createElement("g",{key:"cat-"+t,transform:`translate(${e.pixel},${o})`},p.createElement("line",{y2:5,stroke:"#ccc",strokeWidth:1}),p.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},e.label))),c&&p.createElement("text",{x:n/2,y:o+40,textAnchor:"middle",fontSize:12,fill:"#333",style:{userSelect:"none"}},c),p.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"#ccc",strokeWidth:1}),E.map((e,t)=>p.createElement("g",{key:"val-"+t,transform:`translate(0,${e.pixel})`},p.createElement("line",{x2:-5,stroke:"#ccc",strokeWidth:1}),p.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},e.label))),u&&p.createElement("text",{x:15-i.left,y:o/2,textAnchor:"middle",fontSize:12,fill:"#333",transform:`rotate(-90, ${15-i.left}, ${o/2})`,style:{userSelect:"none"}},u))),M,m,A),y&&p.createElement("text",{x:r/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"#333",style:{userSelect:"none"}},"string"==typeof y?y:null),f&&p.createElement("g",{transform:`translate(${r-i.right+10}, ${i.top})`},"object"==typeof(O=f)&&null!==O&&!p.isValidElement(O)&&"legendGroups"in O?p.createElement(L,{legendGroups:f.legendGroups,title:"",width:100}):f)):null;var O}const rt=(e,t,n,o)=>{const r=t.filter(e=>"wedge"===e.type);for(const t of r)e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath(),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),null!=t.style.fillOpacity&&(e.globalAlpha=t.style.fillOpacity),e.fillStyle=t.style.fill||"#007bff",e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1},st=(e,t,n,o)=>{var r,s;const i=t.filter(e=>"violin"===e.type);for(const t of i){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);e.globalAlpha=null!==(s=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==s?s:.6,e.fillStyle=t.style.fill||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine&&(e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8,e.beginPath(),e.moveTo(0,t.iqrLine.q1Pos),e.lineTo(0,t.iqrLine.q3Pos),e.stroke(),e.beginPath(),e.arc(0,t.iqrLine.medianPos,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1),e.restore()}},it=(e,t,n,o)=>{var r,s,i;const a=t.filter(e=>"connector"===e.type);if(0===a.length)return;const l=new Map;for(const e of a){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(s=null!==(r=n.fillOpacity)&&void 0!==r?r:n.opacity)&&void 0!==s?s:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=n.style.stroke||n.style.fill||"#999",e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(i=n.style.opacity)&&void 0!==i?i:.5,e.stroke(),e.globalAlpha=1}},at=e=>[it,...e],lt={bar:at([Y]),clusterbar:at([Y]),point:at([I]),swarm:at([I]),pie:[rt],donut:[rt],boxplot:at([(e,t,n,o)=>{var r,s;const i=t.filter(e=>"boxplot"===e.type);for(const t of i){const n=t.columnWidth/2,o="vertical"===t.projection,i=t.style.fill||"#007bff",a=t.style.stroke||"#333",l=t.style.strokeWidth||1,c=null!==(s=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==s?s:.6;if(e.save(),e.strokeStyle=a,e.lineWidth=l,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=c,e.fillStyle=i,o){const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},I]),violin:at([st]),histogram:at([Y]),ridgeline:at([st]),timeline:at([Y])},ct={top:50,right:40,bottom:60,left:70},ut={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function dt({hover:e}){var t,n,o,r;const s=e.data||{};if(Array.isArray(s)){const e=(null===(t=s[0])||void 0===t?void 0:t.category)||"",n=s.length;return p.createElement("div",{className:"semiotic-tooltip",style:ut},e&&p.createElement("div",{style:{fontWeight:"bold"}},e+""),p.createElement("div",null,n," items"))}if(null!=s.bin&&null!=s.count){const e=s.range||[];return p.createElement("div",{className:"semiotic-tooltip",style:ut},s.category&&p.createElement("div",{style:{fontWeight:"bold"}},s.category+""),p.createElement("div",null,"Count: ",s.count),2===e.length&&p.createElement("div",{style:{opacity:.8}},Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)))}const i=s.category||s.name||s.group||s.__rName||"",a=null!==(r=null!==(o=null!==(n=s.value)&&void 0!==n?n:s.__rValue)&&void 0!==o?o:s.pct)&&void 0!==r?r:"";if(!i&&""===a){const e=Object.entries(s).filter(([e])=>!e.startsWith("_")&&"data"!==e);return p.createElement("div",{className:"semiotic-tooltip",style:ut},e.map(([e,t])=>p.createElement("div",{key:e},p.createElement("span",{style:{opacity:.7}},e,":")," ","number"==typeof t?t.toLocaleString():t+"")))}return p.createElement("div",{className:"semiotic-tooltip",style:ut},i&&p.createElement("div",{style:{fontWeight:"bold"}},i+""),""!==a&&p.createElement("div",null,"number"==typeof a?a.toLocaleString():a+""))}const ht=e.forwardRef(function(t,n){const{chartType:o,runtimeMode:r,data:s,oAccessor:i="category",rAccessor:a="value",colorAccessor:l,stackBy:c,groupBy:u,multiAxis:d,timeAccessor:h,valueAccessor:g,categoryAccessor:f,projection:m="vertical",size:v=[600,400],margin:b,barPadding:x,innerRadius:A,normalize:w,startAngle:k,dynamicColumnWidth:S,bins:E,showOutliers:M,showIQR:O,amplitude:j,connectorAccessor:P,connectorStyle:N,rExtent:C,oExtent:_,extentPadding:z=.05,oSort:B,windowMode:W="sliding",windowSize:L=200,pieceStyle:R,summaryStyle:T,colorScheme:D,barColors:$,showAxes:F=!0,oLabel:H,rLabel:I,oFormat:Y,rFormat:q,enableHover:X=!0,hoverAnnotation:G,tooltipContent:V,customHoverBehavior:U,annotations:Q,svgAnnotationRules:Z,showGrid:J=!1,legend:K,backgroundGraphics:ee,foregroundGraphics:te,title:ne,className:oe,background:re,centerContent:se,decay:ie,pulse:ae,transition:le,staleness:ce}=t,ue=e.useMemo(()=>Object.assign(Object.assign({},ct),b),[b]),de=v[0]-ue.left-ue.right,he=v[1]-ue.top-ue.bottom,pe=e.useRef(null),ge=e.useRef(!0),ye=e.useRef(0),fe=e.useRef(null),me=e.useRef(()=>{}),[ve,be]=e.useState(null),[xe,Ae]=e.useState(null),[we,ke]=e.useState(0),[Se,Ee]=e.useState(!1),Me=X||G,Oe="streaming"===r,je=e.useMemo(()=>({chartType:o,runtimeMode:Oe?"streaming":"bounded",windowSize:L,windowMode:W,extentPadding:z,projection:m,oAccessor:Oe?void 0:i,rAccessor:Oe?void 0:a,colorAccessor:l,stackBy:c,groupBy:u,multiAxis:d,timeAccessor:Oe?h:void 0,valueAccessor:Oe?g||("string"==typeof a||"function"==typeof a?a:void 0):void 0,categoryAccessor:Oe?f||i:void 0,rExtent:C,oExtent:_,barPadding:x,innerRadius:A,normalize:w,startAngle:k,dynamicColumnWidth:S,bins:E,showOutliers:M,showIQR:O,amplitude:j,connectorAccessor:P,connectorStyle:N,oSort:B,pieceStyle:R,summaryStyle:T,colorScheme:D,barColors:$,decay:ie,pulse:ae,transition:le,staleness:ce}),[o,L,W,z,m,i,a,l,c,u,d,h,g,f,C,_,x,A,w,k,S,E,M,O,j,P,N,B,R,T,D,$,ie,ae,le,ce,Oe]),Pe=e.useRef(null);Pe.current||(Pe.current=new Qe(je));const Ne=e.useCallback(()=>{ye.current||(ye.current=requestAnimationFrame(()=>me.current()))},[]);e.useEffect(()=>{var e;null===(e=Pe.current)||void 0===e||e.updateConfig(je),ge.current=!0,Ne()},[je,Ne]);const Ce=e.useRef(null);Ce.current||(Ce.current=new y(e=>{const t=Pe.current;t&&t.ingest(e)&&(ge.current=!0,Ne())}));const _e=e.useCallback(e=>{var t;null===(t=Ce.current)||void 0===t||t.push(e)},[]),ze=e.useCallback(e=>{var t;null===(t=Ce.current)||void 0===t||t.pushMany(e)},[]),Be=e.useCallback(()=>{var e,t;null===(e=Ce.current)||void 0===e||e.clear(),null===(t=Pe.current)||void 0===t||t.clear(),ge.current=!0,Ne()},[Ne]);e.useImperativeHandle(n,()=>({push:_e,pushMany:ze,clear:Be,getData:()=>{var e,t;return null!==(t=null===(e=Pe.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Pe.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[_e,ze,Be]),e.useEffect(()=>{var e;s&&(null===(e=Ce.current)||void 0===e||e.setBoundedData(s))},[s]);const We=e.useRef(()=>{}),Le=e.useRef(()=>{});We.current=e=>{if(!Me)return;const t=pe.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-ue.left,r=e.clientY-n.top-ue.top;if(0>o||o>de||0>r||r>he)return void(fe.current&&(fe.current=null,be(null),U&&U(null),Ne()));const s=Pe.current;if(!s||0===s.scene.length)return;const i="radial"===m,a=function(e,t,n,o=30){let r=null;for(const s of e){let e=null;switch(s.type){case"rect":e=Ze(s,t,n);break;case"point":e=Je(s,t,n);break;case"wedge":e=Ke(s,t,n);break;case"boxplot":e=et(s,t,n);break;case"violin":e=tt(s,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(s.scene,i?o-de/2:o,i?r-he/2:r);if(!a)return void(fe.current&&(fe.current=null,be(null),U&&U(null),Ne()));const l={data:a.datum,time:a.x,value:a.y,x:a.x,y:a.y};fe.current=l,be(l),U&&U(l),Ne()},Le.current=()=>{fe.current&&(fe.current=null,be(null),U&&U(null),Ne())};const Re=e.useCallback(e=>We.current(e),[]),Te=e.useCallback(()=>Le.current(),[]);me.current=()=>{var e,t;ye.current=0;const n=pe.current;if(!n)return;const r=n.getContext("2d");if(!r)return;const s=Pe.current;if(!s)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=s.advanceTransition(i),l=ge.current;l&&!a&&(s.computeScene({width:de,height:he}),ge.current=!1);const c="undefined"!=typeof window&&window.devicePixelRatio||1;n.width=v[0]*c,n.height=v[1]*c,n.style.width=v[0]+"px",n.style.height=v[1]+"px",r.scale(c,c),r.clearRect(0,0,v[0],v[1]);const u=null!==(e=null==ce?void 0:ce.threshold)&&void 0!==e?e:5e3,d=ce&&s.lastIngestTime>0&&i-s.lastIngestTime>u;d&&(r.globalAlpha=null!==(t=null==ce?void 0:ce.dimOpacity)&&void 0!==t?t:.5),re&&(r.fillStyle=re,r.fillRect(0,0,v[0],v[1]));const h="radial"===m;h?(r.save(),r.translate(ue.left+de/2,ue.top+he/2)):r.translate(ue.left,ue.top);const p=lt[o]||[],g={width:de,height:he};for(const e of p)e(r,s.scene,s.scales,g);h&&r.restore(),d&&(r.globalAlpha=1),l&&s.scales&&(Ae(s.scales),ke(e=>e+1)),(null==ce?void 0:ce.showBadge)&&Ee(!!d),(a||s.hasActivePulses)&&(ye.current=requestAnimationFrame(()=>me.current()))},e.useEffect(()=>(Ne(),()=>{ye.current&&cancelAnimationFrame(ye.current)}),[Ne]),e.useEffect(()=>{ge.current=!0,Ne()},[o,de,he,F,re,Ne]),e.useEffect(()=>{if(!ce)return;const e=setInterval(()=>{var e;const t=Pe.current;if(!t||0===t.lastIngestTime)return;const n="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(e=ce.threshold)&&void 0!==e?e:5e3,r=n-t.lastIngestTime>o;r!==Se&&(Ee(r),ge.current=!0,Ne())},1e3);return()=>clearInterval(e)},[ce,Se,Ne]);const De=Me&&ve?V?V(ve):p.createElement(dt,{hover:ve}):null,$e="radial"===m,Fe=ve?$e?ve.x+de/2:ve.x:0,He=ve?$e?ve.y+he/2:ve.y:0,Ie=De?p.createElement("div",{className:"stream-ordinal-tooltip",style:{position:"absolute",left:ue.left+Fe,top:ue.top+He,transform:`translate(${Fe>.7*de?"calc(-100% - 12px)":"12px"}, ${.3*he>He?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1}},De):null;return p.createElement("div",{className:"stream-ordinal-frame"+(oe?" "+oe:""),style:{position:"relative",width:v[0],height:v[1]},onMouseMove:Me?Re:void 0,onMouseLeave:Me?Te:void 0},ee&&p.createElement("svg",{style:{position:"absolute",top:0,left:0,width:v[0],height:v[1],pointerEvents:"none"}},p.createElement("g",{transform:`translate(${ue.left},${ue.top})`},ee)),p.createElement("canvas",{ref:pe,style:{position:"absolute",top:0,left:0,width:v[0],height:v[1]}}),p.createElement(ot,{width:de,height:he,totalWidth:v[0],totalHeight:v[1],margin:ue,scales:xe,showAxes:F,oLabel:H,rLabel:I,oFormat:Y,rFormat:q,showGrid:J,title:ne,legend:K,foregroundGraphics:te,annotations:Q,svgAnnotationRules:Z,annotationFrame:we}),se&&"radial"===m&&p.createElement("div",{style:{position:"absolute",left:ue.left+de/2,top:ue.top+he/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},se),(null==ce?void 0:ce.showBadge)&&p.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ce.badgePosition?{top:4,left:4}:"bottom-left"===ce.badgePosition?{bottom:4,left:4}:"bottom-right"===ce.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Se?"#dc3545":"#28a745",color:"white"})},Se?"STALE":"LIVE"),Ie)});function pt(t){const{data:n,width:o=600,height:r=400,margin:s,className:i,title:a,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="vertical",categoryLabel:d,valueLabel:h,valueFormat:g,colorBy:y,colorScheme:f="category10",sort:m=!1,barPadding:v=5,enableHover:b=!0,showGrid:x=!1,showLegend:A,tooltip:w,frameProps:k={},selection:S,linkedHover:E}=t,M=n||[],O=be(E,y?["string"==typeof y?y:""]:[]),j=Pe({name:(null==S?void 0:S.name)||"__unused__"}),P=Ne({name:(null==O?void 0:O.name)||"hover",fields:(null==O?void 0:O.fields)||[]}),N=S?{isActive:j.isActive,predicate:j.predicate}:null,C=ae(M,m,c),_=ie(M,y,f),z=e.useMemo(()=>e=>{const t={};return t.fill=y?te(e,y,_):re,t},[y,_]),B=e.useMemo(()=>Ae(z,N,S),[z,N,S]),W=void 0!==A?A:!!y,L=e.useMemo(()=>{if(W&&y)return le({data:C,colorBy:y,colorScale:_,getColor:te})},[W,y,C,_]),R=e.useMemo(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},s);return L&&120>e.right&&(e.right=120),e},[s,L]),T=e.useCallback(e=>{E&&P.onHover(e?e.data||e:null)},[E,P]),D=e.useMemo(()=>{const e=y&&y!==l;return t=>{const n=t.data||t,o="function"==typeof l?l(n):n[l],r="function"==typeof c?c(n):n[c],s=e?"function"==typeof y?y(n):n[y]:null;return p.createElement("div",{className:"semiotic-tooltip",style:ce},p.createElement("div",{style:{fontWeight:"bold"}},o+""),p.createElement("div",{style:{marginTop:"4px"}},"number"==typeof r?r.toLocaleString():r+""),null!=s&&p.createElement("div",{style:{marginTop:"2px",opacity:.8}},"string"==typeof y?y:"group",": ",s+""))}},[l,c,y]),$=fe({componentName:"BarChart",data:M,accessors:{categoryAccessor:l,valueAccessor:c}});if($)return p.createElement(ye,{componentName:"BarChart",message:$,width:o,height:r});const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar",data:C,oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:B,size:[o,r],margin:R,barPadding:v,enableHover:b,showAxes:!0,oLabel:d,rLabel:h,rFormat:g,showGrid:x,oSort:m},L&&{legend:L}),a&&{title:a}),i&&{className:i}),{tooltipContent:w?he(w):D}),E&&{customHoverBehavior:T}),k);return p.createElement(ht,Object.assign({},F))}function gt(t){const{data:n,width:o=600,height:r=400,margin:s,className:i,title:a,categoryAccessor:l="category",stackBy:c,valueAccessor:u="value",orientation:d="vertical",categoryLabel:h,valueLabel:g,valueFormat:y,colorBy:f,colorScheme:m="category10",normalize:v=!1,barPadding:b=5,enableHover:x=!0,showGrid:A=!1,showLegend:w=!0,tooltip:k,frameProps:S={},selection:E,linkedHover:M}=t,O=n||[],j=f||c,P=be(M,j?["string"==typeof j?j:""]:[]),N=Pe({name:(null==E?void 0:E.name)||"__unused__"}),C=Ne({name:(null==P?void 0:P.name)||"hover",fields:(null==P?void 0:P.fields)||[]}),_=E?{isActive:N.isActive,predicate:N.predicate}:null,z=ie(O,j,m),B=e.useMemo(()=>e=>j?{fill:te(e,j,z)}:{fill:re},[j,z]),W=e.useMemo(()=>Ae(B,_,E),[B,_,E]),L=e.useMemo(()=>{if(w)return le({data:O,colorBy:j,colorScale:z,getColor:te})},[w,O,j,z]),R=e.useMemo(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:120},s);return L&&120>e.right&&(e.right=120),e},[s,L]),T=e.useCallback(e=>{M&&C.onHover(e)},[M,C]),D=e.useMemo(()=>{const e=se(c),t=se(l),n=se(u);return o=>{const r=o.data||o;return p.createElement("div",{className:"semiotic-tooltip",style:ce},p.createElement("div",{style:{fontWeight:"bold"}},e(r)+""),p.createElement("div",{style:{marginTop:"4px"}},t(r)+""," · ",Number(n(r)).toLocaleString()))}},[c,l,u]),$=fe({componentName:"StackedBarChart",data:O,accessors:{categoryAccessor:l,valueAccessor:u},requiredProps:{stackBy:c}});if($)return p.createElement(ye,{componentName:"StackedBarChart",message:$,width:o,height:r});const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar",data:O,oAccessor:l,rAccessor:u,stackBy:c,normalize:v,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:W,size:[o,r],margin:R,barPadding:b,enableHover:x,showAxes:!0,oLabel:h,rLabel:g,rFormat:y,showGrid:A},L&&{legend:L}),a&&{title:a}),i&&{className:i}),{tooltipContent:k?he(k):D}),M&&{customHoverBehavior:T}),S);return p.createElement(ht,Object.assign({},F))}function yt(t){const{data:n,width:o=600,height:r=400,margin:s,className:i,title:a,categoryAccessor:l="category",groupBy:c,valueAccessor:u="value",orientation:d="vertical",categoryLabel:h,valueLabel:g,valueFormat:y,colorBy:f,colorScheme:m="category10",barPadding:v=5,enableHover:b=!0,showGrid:x=!1,showLegend:A=!0,tooltip:w,frameProps:k={},selection:S,linkedHover:E}=t,M=n||[],O=f||c,j=be(E,O?["string"==typeof O?O:""]:[]),P=Pe({name:(null==S?void 0:S.name)||"__unused__"}),N=Ne({name:(null==j?void 0:j.name)||"hover",fields:(null==j?void 0:j.fields)||[]}),C=S?{isActive:P.isActive,predicate:P.predicate}:null,_=ie(M,O,m),z=e.useMemo(()=>e=>O?{fill:te(e,O,_)}:{fill:re},[O,_]),B=e.useMemo(()=>Ae(z,C,S),[z,C,S]),W=e.useMemo(()=>{if(A)return le({data:M,colorBy:O,colorScale:_,getColor:te})},[A,M,O,_]),L=e.useMemo(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},s);return W&&120>e.right&&(e.right=120),e},[s,W]),R=e.useCallback(e=>{E&&N.onHover(e)},[E,N]),T=e.useMemo(()=>{const e=se(c),t=se(l),n=se(u);return o=>{const r=o.data||o;return p.createElement("div",{className:"semiotic-tooltip",style:ce},p.createElement("div",{style:{fontWeight:"bold"}},e(r)+""),p.createElement("div",{style:{marginTop:"4px"}},t(r)+""," · ",Number(n(r)).toLocaleString()))}},[c,l,u]),D=fe({componentName:"GroupedBarChart",data:M,accessors:{categoryAccessor:l,valueAccessor:u},requiredProps:{groupBy:c}});if(D)return p.createElement(ye,{componentName:"GroupedBarChart",message:D,width:o,height:r});const $=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar",data:M,oAccessor:l,rAccessor:u,groupBy:c,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:B,size:[o,r],margin:L,barPadding:v,enableHover:b,showAxes:!0,oLabel:h,rLabel:g,rFormat:y,showGrid:x},W&&{legend:W}),a&&{title:a}),i&&{className:i}),{tooltipContent:w?he(w):T}),E&&{customHoverBehavior:R}),k);return p.createElement(ht,Object.assign({},$))}function ft(t){const{data:n,width:o=600,height:r=400,margin:s,className:i,title:a,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="vertical",categoryLabel:d,valueLabel:h,valueFormat:g,colorBy:y,colorScheme:f="category10",sizeBy:m,sizeRange:v=[3,8],pointRadius:b=4,pointOpacity:x=.7,categoryPadding:A=20,enableHover:w=!0,showGrid:k=!1,showLegend:S,tooltip:E,frameProps:M={},selection:O,linkedHover:j}=t,P=n||[],N=be(j,y?["string"==typeof y?y:""]:["string"==typeof l?l:""]),C=Pe({name:(null==O?void 0:O.name)||"__unused__"}),_=Ne({name:(null==N?void 0:N.name)||"hover",fields:(null==N?void 0:N.fields)||[]}),z=O?{isActive:C.isActive,predicate:C.predicate}:null,B=ie(P,y,f),W=e.useMemo(()=>{if(!m)return;const e=P.map(e=>"function"==typeof m?m(e):e[m]);return[Math.min(...e),Math.max(...e)]},[P,m]),L=e.useMemo(()=>e=>{const t={fillOpacity:x};return t.fill=y?te(e,y,B):re,t.r=m?oe(e,m,v,W):b,t},[y,B,m,v,W,b,x]),R=e.useMemo(()=>Ae(L,z,O),[L,z,O]),T=void 0!==S?S:!!y,D=e.useMemo(()=>{if(T&&y)return le({data:P,colorBy:y,colorScale:B,getColor:te})},[T,y,P,B]),$=e.useMemo(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},s);return D&&120>e.right&&(e.right=120),e},[s,D]),F=e.useCallback(e=>{j&&_.onHover(e)},[j,_]),H=e.useMemo(()=>{const e=se(c),t=se(l);return n=>{const o=n.data||n,r=t(o),s=e(o),i=y?"function"==typeof y?y(o):o[y]:null,a=m?"function"==typeof m?m(o):o[m]:null;return p.createElement("div",{className:"semiotic-tooltip",style:ce},p.createElement("div",{style:{fontWeight:"bold"}},r+""),p.createElement("div",{style:{marginTop:"4px"}},"number"==typeof s?s.toLocaleString():s+""),null!=i&&p.createElement("div",{style:{marginTop:"2px",opacity:.8}},"string"==typeof y?y:"color",": ",i+""),null!=a&&p.createElement("div",{style:{marginTop:"2px",opacity:.8}},"string"==typeof m?m:"size",": ","number"==typeof a?a.toLocaleString():a+""))}},[l,c,y,m]),I=fe({componentName:"SwarmPlot",data:P,accessors:{categoryAccessor:l,valueAccessor:c}});if(I)return p.createElement(ye,{componentName:"SwarmPlot",message:I,width:o,height:r});const Y=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm",data:P,oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:R,size:[o,r],margin:$,barPadding:A,enableHover:w,showAxes:!0,oLabel:d,rLabel:h,rFormat:g,showGrid:k},D&&{legend:D}),a&&{title:a}),i&&{className:i}),{tooltipContent:E?he(E):H}),j&&{customHoverBehavior:F}),M);return p.createElement(ht,Object.assign({},Y))}function mt(t){const{data:n,width:o=600,height:r=400,margin:s,className:i,title:a,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="vertical",categoryLabel:d,valueLabel:h,valueFormat:g,colorBy:y,colorScheme:f="category10",showOutliers:m=!0,categoryPadding:v=20,enableHover:b=!0,showGrid:x=!1,showLegend:A,tooltip:w,frameProps:k={},selection:S,linkedHover:E}=t,M=n||[],O=be(E,y?["string"==typeof y?y:""]:["string"==typeof l?l:""]),j=Pe({name:(null==S?void 0:S.name)||"__unused__"}),P=Ne({name:(null==O?void 0:O.name)||"hover",fields:(null==O?void 0:O.fields)||[]}),N=S?{isActive:j.isActive,predicate:j.predicate}:null,C=ie(M,y,f),_=e.useMemo(()=>e=>{const t=y?te(e,y,C):re;return{fill:t,stroke:t,fillOpacity:.8}},[y,C]),z=e.useMemo(()=>Ae(_,N,S),[_,N,S]),B=void 0!==A?A:!!y,W=e.useMemo(()=>{if(B&&y)return le({data:M,colorBy:y,colorScale:C,getColor:te})},[B,y,M,C]),L=e.useMemo(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},s);return W&&120>e.right&&(e.right=120),e},[s,W]),R=e.useCallback(e=>{E&&P.onHover(e)},[E,P]),T=e.useMemo(()=>e=>{const t=e.data||e,n=t.stats||{};return p.createElement("div",{className:"semiotic-tooltip",style:ce},p.createElement("div",{style:{fontWeight:"bold",marginBottom:"4px"}},(t.category||e.category||"")+""),null!=n.median&&p.createElement(p.Fragment,null,p.createElement("div",null,"Median: ",n.median.toLocaleString()),p.createElement("div",null,"Q1: ",n.q1.toLocaleString()),p.createElement("div",null,"Q3: ",n.q3.toLocaleString()),p.createElement("div",null,"Min: ",n.min.toLocaleString()),p.createElement("div",null,"Max: ",n.max.toLocaleString())))},[]),D=fe({componentName:"BoxPlot",data:M,accessors:{categoryAccessor:l,valueAccessor:c}});if(D)return p.createElement(ye,{componentName:"BoxPlot",message:D,width:o,height:r});const $=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot",data:M,oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",summaryStyle:z,showOutliers:m,size:[o,r],margin:L,barPadding:v,enableHover:b,showAxes:!0,oLabel:d,rLabel:h,rFormat:g,showGrid:x},W&&{legend:W}),a&&{title:a}),i&&{className:i}),{tooltipContent:w?he(w):T}),E&&{customHoverBehavior:R}),k);return p.createElement(ht,Object.assign({},$))}function vt(t){const{data:n,width:o=600,height:r=400,margin:s,className:i,title:a,categoryAccessor:l="category",valueAccessor:c="value",bins:u=25,relative:d=!1,categoryLabel:h,valueLabel:g,valueFormat:y,colorBy:f,colorScheme:m="category10",categoryPadding:v=20,enableHover:b=!0,showGrid:x=!1,showLegend:A,tooltip:w,frameProps:k={},selection:S,linkedHover:E}=t,M=n||[],O=be(E,f?["string"==typeof f?f:""]:["string"==typeof l?l:""]),j=Pe({name:(null==S?void 0:S.name)||"__unused__"}),P=Ne({name:(null==O?void 0:O.name)||"hover",fields:(null==O?void 0:O.fields)||[]}),N=S?{isActive:j.isActive,predicate:j.predicate}:null,C=ie(M,f,m),_=e.useMemo(()=>e=>{const t=f?te(e,f,C):re;return{fill:t,stroke:t,fillOpacity:.8}},[f,C]),z=e.useMemo(()=>Ae(_,N,S),[_,N,S]),B=void 0!==A?A:!!f,W=e.useMemo(()=>{if(B&&f)return le({data:M,colorBy:f,colorScale:C,getColor:te})},[B,f,M,C]),L=e.useMemo(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},s);return W&&120>e.right&&(e.right=120),e},[s,W]),R=e.useCallback(e=>{E&&P.onHover(e)},[E,P]),T=e.useMemo(()=>e=>{const t=e.data||e,n=t.category||e.category||"",o=t.count,r=t.range;return p.createElement("div",{className:"semiotic-tooltip",style:ce},n&&p.createElement("div",{style:{fontWeight:"bold"}},n+""),null!=o&&p.createElement("div",null,"Count: ",o),r&&2===r.length&&p.createElement("div",{style:{opacity:.8}},Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)))},[]),D=fe({componentName:"Histogram",data:M,accessors:{categoryAccessor:l,valueAccessor:c}});if(D)return p.createElement(ye,{componentName:"Histogram",message:D,width:o,height:r});const $=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram",data:M,oAccessor:l,rAccessor:c,projection:"horizontal",summaryStyle:z,bins:u,normalize:d,size:[o,r],margin:L,barPadding:v,enableHover:b,showAxes:!0,oLabel:h,rLabel:g,rFormat:y,showGrid:x},W&&{legend:W}),a&&{title:a}),i&&{className:i}),{tooltipContent:w?he(w):T}),E&&{customHoverBehavior:R}),k);return p.createElement(ht,Object.assign({},$))}function bt(t){const{data:n,width:o=600,height:r=400,margin:s,className:i,title:a,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="vertical",bins:d=25,showIQR:h=!0,categoryLabel:g,valueLabel:y,valueFormat:f,colorBy:m,colorScheme:v="category10",categoryPadding:b=20,enableHover:x=!0,showGrid:A=!1,showLegend:w,tooltip:k,frameProps:S={},selection:E,linkedHover:M}=t,O=n||[],j=be(M,m?["string"==typeof m?m:""]:["string"==typeof l?l:""]),P=Pe({name:(null==E?void 0:E.name)||"__unused__"}),N=Ne({name:(null==j?void 0:j.name)||"hover",fields:(null==j?void 0:j.fields)||[]}),C=E?{isActive:P.isActive,predicate:P.predicate}:null,_=ie(O,m,v),z=e.useMemo(()=>e=>{const t=m?te(e,m,_):re;return{fill:t,stroke:t,fillOpacity:.6}},[m,_]),B=e.useMemo(()=>Ae(z,C,E),[z,C,E]),W=void 0!==w?w:!!m,L=e.useMemo(()=>{if(W&&m)return le({data:O,colorBy:m,colorScale:_,getColor:te})},[W,m,O,_]),R=e.useMemo(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},s);return L&&120>e.right&&(e.right=120),e},[s,L]),T=e.useCallback(e=>{M&&N.onHover(e)},[M,N]),D=e.useMemo(()=>e=>{const t=e.data||e,n=t.category||e.category||"",o=(Array.isArray(t)?t:[]).map(e=>{const t="function"==typeof c?c(e):e[c];return Number(t)}).filter(e=>!isNaN(e)).sort((e,t)=>e-t),r=o.length,s=r>0?o[Math.floor(r/2)]:null;return p.createElement("div",{className:"semiotic-tooltip",style:ce},n&&p.createElement("div",{style:{fontWeight:"bold"}},n+""),r>0&&p.createElement("div",null,"n = ",r),null!=s&&p.createElement("div",null,"Median: ",s.toLocaleString()))},[c]),$=fe({componentName:"ViolinPlot",data:O,accessors:{categoryAccessor:l,valueAccessor:c}});if($)return p.createElement(ye,{componentName:"ViolinPlot",message:$,width:o,height:r});const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin",data:O,oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",summaryStyle:B,bins:d,showIQR:h,size:[o,r],margin:R,barPadding:b,enableHover:x,showAxes:!0,oLabel:g,rLabel:y,rFormat:f,showGrid:A},L&&{legend:L}),a&&{title:a}),i&&{className:i}),{tooltipContent:k?he(k):D}),M&&{customHoverBehavior:T}),S);return p.createElement(ht,Object.assign({},F))}function xt(t){const{data:n,width:o=600,height:r=400,margin:s,className:i,title:a,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="horizontal",categoryLabel:d,valueLabel:h,valueFormat:g,colorBy:y,colorScheme:f="category10",sort:m=!0,dotRadius:v=5,categoryPadding:b=10,enableHover:x=!0,showGrid:A=!0,showLegend:w,tooltip:k,frameProps:S={},selection:E,linkedHover:M}=t,O=n||[],j=be(M,y?["string"==typeof y?y:""]:["string"==typeof l?l:""]),P=Pe({name:(null==E?void 0:E.name)||"__unused__"}),N=Ne({name:(null==j?void 0:j.name)||"hover",fields:(null==j?void 0:j.fields)||[]}),C=E?{isActive:P.isActive,predicate:P.predicate}:null,_=ae(O,m,c),z=ie(O,y,f),B=e.useMemo(()=>e=>{const t={r:v,fillOpacity:.8};return t.fill=y?te(e,y,z):re,t},[y,z,v]),W=e.useMemo(()=>Ae(B,C,E),[B,C,E]),L=void 0!==w?w:!!y,R=e.useMemo(()=>{if(L&&y)return le({data:_,colorBy:y,colorScale:z,getColor:te})},[L,y,_,z]),T=e.useMemo(()=>{const e=Object.assign({top:50,bottom:60,left:120,right:40},s);return R&&120>e.right&&(e.right=120),e},[s,R]),D=e.useCallback(e=>{M&&N.onHover(e)},[M,N]),$=e.useMemo(()=>e=>{const t=e.data||e,n="function"==typeof l?l(t):t[l],o="function"==typeof c?c(t):t[c];return p.createElement("div",{className:"semiotic-tooltip",style:ce},p.createElement("div",{style:{fontWeight:"bold"}},n+""),p.createElement("div",{style:{marginTop:"4px"}},"number"==typeof o?o.toLocaleString():o+""))},[l,c]),F=fe({componentName:"DotPlot",data:O,accessors:{categoryAccessor:l,valueAccessor:c}});if(F)return p.createElement(ye,{componentName:"DotPlot",message:F,width:o,height:r});const H=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point",data:_,oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:W,size:[o,r],margin:T,barPadding:b,enableHover:x,showAxes:!0,oLabel:d,rLabel:h,rFormat:g,showGrid:A,oSort:m},R&&{legend:R}),a&&{title:a}),i&&{className:i}),{tooltipContent:k?he(k):$}),M&&{customHoverBehavior:D}),S);return p.createElement(ht,Object.assign({},H))}function At(t){const{data:n,width:o=400,height:r=400,margin:s,className:i,title:a,categoryAccessor:l="category",valueAccessor:c="value",colorBy:u,colorScheme:d="category10",startAngle:h=0,enableHover:g=!0,showLegend:y=!0,tooltip:f,frameProps:m={},selection:v,linkedHover:b}=t,x=n||[],A=u||l,w=be(b,A?["string"==typeof A?A:""]:[]),k=Pe({name:(null==v?void 0:v.name)||"__unused__"}),S=Ne({name:(null==w?void 0:w.name)||"hover",fields:(null==w?void 0:w.fields)||[]}),E=v?{isActive:k.isActive,predicate:k.predicate}:null,M=ie(x,A,d),O=e.useMemo(()=>e=>A?{fill:te(e,A,M)}:{fill:re},[A,M]),j=e.useMemo(()=>Ae(O,E,v),[O,E,v]),P=e.useMemo(()=>{if(y)return le({data:x,colorBy:A,colorScale:M,getColor:te})},[y,x,A,M]),N=e.useMemo(()=>{const e=Object.assign({top:20,bottom:20,left:20,right:20},s);return P&&120>e.right&&(e.right=120),e},[s,P]),C=e.useCallback(e=>{b&&S.onHover(e)},[b,S]),_=e.useMemo(()=>{const e=u&&u!==l;return t=>{var n;const o=(null===(n=t.data)||void 0===n?void 0:n[0])||t.data||t,r="function"==typeof l?l(o):o[l],s="function"==typeof c?c(o):o[c],i=e?"function"==typeof u?u(o):o[u]:null;return p.createElement("div",{className:"semiotic-tooltip",style:ce},p.createElement("div",{style:{fontWeight:"bold"}},r+""),p.createElement("div",{style:{marginTop:"4px"}},"number"==typeof s?s.toLocaleString():s+""),null!=i&&p.createElement("div",{style:{marginTop:"2px",opacity:.8}},"string"==typeof u?u:"group",": ",i+""))}},[l,c,u]),z=fe({componentName:"PieChart",data:x,accessors:{categoryAccessor:l,valueAccessor:c}});if(z)return p.createElement(ye,{componentName:"PieChart",message:z,width:o,height:r});const B=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie",data:x,oAccessor:l,rAccessor:c,projection:"radial",pieceStyle:j,startAngle:h,size:[o,r],margin:N,enableHover:g,showAxes:!1},P&&{legend:P}),a&&{title:a}),i&&{className:i}),{tooltipContent:f?he(f):_}),b&&{customHoverBehavior:C}),m);return p.createElement(ht,Object.assign({},B))}function wt(t){const{data:n,width:o=400,height:r=400,margin:s,className:i,title:a,categoryAccessor:l="category",valueAccessor:c="value",innerRadius:u=60,centerContent:d,colorBy:h,colorScheme:g="category10",startAngle:y=0,enableHover:f=!0,showLegend:m=!0,tooltip:v,frameProps:b={},selection:x,linkedHover:A}=t,w=n||[],k=h||l,S=be(A,k?["string"==typeof k?k:""]:[]),E=Pe({name:(null==x?void 0:x.name)||"__unused__"}),M=Ne({name:(null==S?void 0:S.name)||"hover",fields:(null==S?void 0:S.fields)||[]}),O=x?{isActive:E.isActive,predicate:E.predicate}:null,j=ie(w,k,g),P=e.useMemo(()=>e=>k?{fill:te(e,k,j)}:{fill:re},[k,j]),N=e.useMemo(()=>Ae(P,O,x),[P,O,x]),C=e.useMemo(()=>{if(m)return le({data:w,colorBy:k,colorScale:j,getColor:te})},[m,w,k,j]),_=e.useMemo(()=>{const e=Object.assign({top:20,bottom:20,left:20,right:20},s);return C&&120>e.right&&(e.right=120),e},[s,C]),z=e.useCallback(e=>{A&&M.onHover(e)},[A,M]),B=e.useMemo(()=>{const e=h&&h!==l;return t=>{var n;const o=(null===(n=t.data)||void 0===n?void 0:n[0])||t.data||t,r="function"==typeof l?l(o):o[l],s="function"==typeof c?c(o):o[c],i=e?"function"==typeof h?h(o):o[h]:null;return p.createElement("div",{className:"semiotic-tooltip",style:ce},p.createElement("div",{style:{fontWeight:"bold"}},r+""),p.createElement("div",{style:{marginTop:"4px"}},"number"==typeof s?s.toLocaleString():s+""),null!=i&&p.createElement("div",{style:{marginTop:"2px",opacity:.8}},"string"==typeof h?h:"group",": ",i+""))}},[l,c,h]),W=fe({componentName:"DonutChart",data:w,accessors:{categoryAccessor:l,valueAccessor:c}});if(W)return p.createElement(ye,{componentName:"DonutChart",message:W,width:o,height:r});const L=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:w,oAccessor:l,rAccessor:c,projection:"radial",pieceStyle:N,innerRadius:u,startAngle:y,centerContent:d,size:[o,r],margin:_,enableHover:f,showAxes:!1},C&&{legend:C}),a&&{title:a}),i&&{className:i}),{tooltipContent:v?he(v):B}),A&&{customHoverBehavior:z}),b);return p.createElement(ht,Object.assign({},L))}ht.displayName="StreamOrdinalFrame",pt.displayName="BarChart",gt.displayName="StackedBarChart",yt.displayName="GroupedBarChart",ft.displayName="SwarmPlot",mt.displayName="BoxPlot",vt.displayName="Histogram",bt.displayName="ViolinPlot",xt.displayName="DotPlot",At.displayName="PieChart",wt.displayName="DonutChart";const kt={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},St={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class Et{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex: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=Math.random()-.5,n.edgeIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n){for(let o=0;this.capacity>o;o++){const r=this.particles[o];if(!r.active)continue;const s=n[r.edgeIndex];if(!s||!s.bezier){r.active=!1;continue}if(r.t+=e*t,r.t>=1){r.active=!1;continue}const i=Mt(s.bezier,r.t,r.offset);r.x=i.x,r.y=i.y}}countForEdge(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let n=0;e>n;n++)this.particles[n]=t.length>n?t[n]:{t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0};this.capacity=e}}function Mt(e,t,n){if(e.circular&&e.segments)return function(e,t,n,o){const r=e.length,s=t*r,i=Math.min(Math.floor(s),r-1),a=s-i,[l,c,u,d]=e[i],h=Ot(l,c,u,d,a),p=d.x-l.x,g=d.y-l.y,y=Math.sqrt(p*p+g*g);if(y>.001){const e=p/y;h.x+=-g/y*n*o*2,h.y+=e*n*o*2}return h}(e.segments,t,n,e.halfWidth);if(!e.points)return{x:0,y:0};const[o,r,s,i]=e.points,a=Ot(o,r,s,i,t),l=i.x-o.x,c=i.y-o.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;a.x+=-c/u*n*e.halfWidth*2,a.y+=t*n*e.halfWidth*2}return a}function Ot(e,t,n,o,r){const s=1-r,i=s*s,a=i*s,l=r*r,c=l*r;return{x:a*e.x+3*i*r*t.x+3*s*l*n.x+c*o.x,y:a*e.y+3*i*r*t.y+3*s*l*n.y+c*o.y}}const jt=(e=1)=>(t,n)=>{const o=t[t.length-1];return o&&Math.round(o.x/e)===Math.round(n.x/e)&&Math.round(o.y/e)===Math.round(n.y/e)||t.push(n),t},Pt=e=>{let t,n,o,r,s,a,l,c,u;return"down"===e.direction?(t=e.y0-e.sankeyWidth/2,n=e.y1-e.sankeyWidth/2,o=e.y1+e.sankeyWidth/2,r=e.y0+e.sankeyWidth/2,s=e.source.y1,a=e.target.y0,l=i.interpolateNumber(s,a),c=l(.5),u=l(.5),`M${t},${s}C${t},${c} ${n},${u} ${n},${a}L${o},${a}C${o},${u} ${r},${c} ${r},${s}Z`):(t=e.source.x1,n=e.target.x0,l=i.interpolateNumber(t,n),o=l(.5),r=l(.5),s=e.y0-e.sankeyWidth/2,a=e.y1-e.sankeyWidth/2,c=e.y1+e.sankeyWidth/2,u=e.y0+e.sankeyWidth/2,`M${t},${s}C${o},${s} ${r},${a} ${n},${a}L${n},${c}C${r},${c} ${o},${u} ${t},${u}Z`)};function Nt(e){const t=function(){const e=l.line();let t=function(e){return e.x},n=function(e){return e.y},o=function(e){return e.r},r=l.curveLinearClosed;function s(s){if(s.multiple){const i=o,l=s.multiple.reduce((e,t)=>e+t.weight,0);o=()=>l;let c=a(s.points).filter(e=>"forward"===e.direction).reduce(jt(),[]);const u=[];return s.multiple.forEach((e,t)=>{o=()=>e.weight;const n=a(c);u.push(n);const r=s.multiple[t+1];if(r){const e=n.reverse().filter(e=>"back"===e.direction).reduce(jt(),[]);o=()=>r.weight;const t=a(e);c=t.reverse().filter(e=>"back"===e.direction).reduce(jt(),[])}}),o=i,u.map(o=>e.x(t).y(n).curve(r)(o))}const i=a(s).reduce(jt(),[]);return e.x(t).y(n).curve(r)(i)}return s.x=function(e){return arguments.length?(t=e,s):t},s.y=function(e){return arguments.length?(n=e,s):n},s.r=function(e){return arguments.length?(o=e,s):o},s.interpolate=function(e){return arguments.length?(r=e,s):r},s;function i(e){const r=n(e.target)-n(e.source),s=t(e.target)-t(e.source),i=Math.atan2(s,r)+Math.PI/2,a=i+.5*Math.PI,l=i+.5*Math.PI;return{x1:t(e.source)+o(e.source)*Math.cos(a),y1:n(e.source)-o(e.source)*Math.sin(a),x2:t(e.target)+o(e.target)*Math.cos(l),y2:n(e.target)-o(e.target)*Math.sin(l)}}function a(e){const t=[];let n=0,o={x1:0,y1:0,x2:0,y2:0};for(;e.length>n;){if(n!==e.length-1&&(o=i({source:e[n],target:e[n+1]}),t.push({x:o.x1,y:o.y1,direction:"forward"},{x:o.x2,y:o.y2,direction:"forward"}),t.length>3)){const e=t.length-1,n={a:t[e-3],b:t[e-2]},o={a:t[e-1],b:t[e]},r=c(n.a.x,n.a.y,n.b.x,n.b.y,o.a.x,o.a.y,o.b.x,o.b.y);!0===r.found&&(n.b.x=r.x,n.b.y=r.y,o.a.x=r.x,o.a.y=r.y)}n++}for(n--;n>=0;){if(0!==n&&(o=i({source:e[n],target:e[n-1]}),t.push({x:o.x1,y:o.y1,direction:"back"},{x:o.x2,y:o.y2,direction:"back"}),t.length>3)){const e=t.length-1,n={a:t[e-3],b:t[e-2]},o={a:t[e-1],b:t[e]},r=c(n.a.x,n.a.y,n.b.x,n.b.y,o.a.x,o.a.y,o.b.x,o.b.y);!0===r.found&&(n.b.x=r.x,n.b.y=r.y,o.a.x=r.x,o.a.y=r.y)}n--}return t}function c(e,t,n,o,r,s,i,a){let l,c;const u={x:null,y:null,found:!1},d=(a-s)*(n-e)-(i-r)*(o-t);if(0===d)return u;l=t-s,c=e-r;const h=(n-e)*l-(o-t)*c;return l=((i-r)*l-(a-s)*c)/d,c=h/d,u.x=e+l*(n-e),u.y=t+l*(o-t),l>0&&1>l&&c>0&&1>c&&(u.found=!0),u}}();return t.x(e=>e.x),t.y(e=>e.y),t.r(()=>e.sankeyWidth/2),t("down"===e.direction?[{x:e.circularPathData.sourceY,y:e.circularPathData.sourceX},{x:e.circularPathData.sourceY,y:e.circularPathData.leftFullExtent},{x:e.circularPathData.verticalFullExtent,y:e.circularPathData.leftFullExtent},{x:e.circularPathData.verticalFullExtent,y:e.circularPathData.rightFullExtent},{x:e.circularPathData.targetY,y:e.circularPathData.rightFullExtent},{x:e.circularPathData.targetY,y:e.circularPathData.targetX}]:[{x:e.circularPathData.sourceX,y:e.circularPathData.sourceY},{x:e.circularPathData.leftFullExtent,y:e.circularPathData.sourceY},{x:e.circularPathData.leftFullExtent,y:e.circularPathData.verticalFullExtent},{x:e.circularPathData.rightFullExtent,y:e.circularPathData.verticalFullExtent},{x:e.circularPathData.rightFullExtent,y:e.circularPathData.targetY},{x:e.circularPathData.targetX,y:e.circularPathData.targetY}])}const Ct={left:a.sankeyLeft,right:a.sankeyRight,center:a.sankeyCenter,justify:a.sankeyJustify},_t={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var r,s,i,l;if(0===e.length)return;const c="vertical"===n.orientation?"down":"right",u=n.nodeAlign||"justify",d=null!==(r=n.nodeWidth)&&void 0!==r?r:15,h=null!==(s=n.nodePaddingRatio)&&void 0!==s?s:.05,p=null!==(i=n.iterations)&&void 0!==i?i:100,g=e.map(e=>Object.assign({},e)),y=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));let f;f="down"===c?[[0,0],[o[1],o[0]]]:[[0,0],[o[0],o[1]]];const m=a.sankeyCircular().extent(f).links(y).nodes(g).nodeAlign(Ct[u]||a.sankeyJustify).nodeId(e=>e.id).nodeWidth(d).iterations(p);m.nodePaddingRatio&&m.nodePaddingRatio(h),m();for(const t of g){const n=e.find(e=>e.id===t.id);n&&(n.x0=t.x0,n.x1=t.x1,n.y0=t.y0,n.y1=t.y1,n.value=t.value,n.depth=t.depth,n.sourceLinks=t.sourceLinks,n.targetLinks=t.targetLinks,n.width=t.x1-t.x0,n.height=t.y1-t.y0,n.x=t.x0+(t.x1-t.x0)/2,n.y=t.y0+(t.y1-t.y0)/2)}for(const n of y){const o=n.source,r=n.target,s="object"==typeof o&&null!==o?o.id:o+"",i="object"==typeof r&&null!==r?r.id:r+"",a=t.find(e=>("string"==typeof e.source?e.source:e.source.id)===s&&("string"==typeof e.target?e.target:e.target.id)===i);if(a){a.y0=n.y0,a.y1=n.y1,a.sankeyWidth=null!==(l=n.width)&&void 0!==l?l:0,a.circular=!!n.circular,a.circularPathData=n.circularPathData,a.direction=c;const t=e.find(e=>e.id===s),o=e.find(e=>e.id===i);t&&(a.source=t),o&&(a.target=o)}}},buildScene(e,t,n,o){var r,i;const a="vertical"===n.orientation?"down":"right",l=n.nodeStyle,c=n.edgeStyle,u=null!==(r=n.edgeOpacity)&&void 0!==r?r:.5,d=n.edgeColorBy||"source",h=Array.isArray(n.colorScheme)?n.colorScheme:s.schemeCategory10,p=new Map;e.forEach((e,t)=>{p.set(e.id,h[t%h.length])});const g=[],y=[],f=[];for(const t of e){const e=t.x1-t.x0,n=t.y1-t.y0;if(0>=e||0>=n)continue;const o=l?l(t):{},r={fill:o.fill||p.get(t.id)||"#4d430c",stroke:o.stroke,strokeWidth:o.strokeWidth,opacity:o.opacity};g.push({type:"rect",x:t.x0,y:t.y0,w:e,h:n,style:r,datum:t,id:t.id,label:t.id})}const m=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of m){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let o;o=e.circular&&e.circularPathData?Nt(e):Pt(e);let r="#999";c?r=c(e).fill||r:"target"===d&&n?r=p.get(n.id)||r:t&&(r=p.get(t.id)||r);const s=c?c(e):{},a={fill:r,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:u,stroke:s.stroke||"none",strokeWidth:s.strokeWidth,opacity:s.opacity};y.push({type:"bezier",pathD:o,bezierCache:e.bezier,style:a,datum:e})}if(!1!==n.showLabels){const t=(v=n.nodeLabel)?"function"==typeof v?v:e=>e[v]||e.id:null;for(const n of e){const e=n.x1-n.x0,r=n.y1-n.y0;if(0>=e||0>=r)continue;const s=t?t(n):n.id;if(!s)continue;let i,l,c;"down"===a?(i=n.x0+e/2,l=n.y1+14,c="middle"):(o[0]/2>n.x0+e/2?(i=n.x0-6,c="end"):(i=n.x1+6,c="start"),l=n.y0+r/2),f.push({x:i,y:l,text:s+"",anchor:c,baseline:"middle",fontSize:11})}}var v;return{sceneNodes:g,sceneEdges:y,labels:f}}},zt={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,o){var r,s;if(0===e.length)return;const i=null!==(r=n.iterations)&&void 0!==r?r:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),a=null!==(s=n.forceStrength)&&void 0!==s?s:.1,l=o[0]/2,u=o[1]/2;for(let t=0;e.length>t;t++){const n=e[t];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(t+.5),o=2.399963229728653*t;n.x=l+e*Math.cos(o),n.y=u+e*Math.sin(o)}}const d=Wt(n.nodeSize,n.nodeSizeRange,e),h=c.forceLink().strength(e=>Math.min(2.5,e.weight?e.weight*a:a)).id(e=>e.id),p=o[1]/o[0],g=c.forceSimulation().force("charge",c.forceManyBody().strength(e=>-25*(e=>d(e))(e))).force("x",c.forceX(o[0]/2).strength(.1*p)).force("y",c.forceY(o[1]/2).strength(.1));if(g.nodes(e),t.length>0){const e=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));g.force("link",h),g.force("link").links(e)}.1>g.alpha()&&g.alpha(1),g.stop();for(let e=0;i>e;++e)g.tick();for(const n of t){if("string"==typeof n.source){const t=e.find(e=>e.id===n.source);t&&(n.source=t)}if("string"==typeof n.target){const t=e.find(e=>e.id===n.target);t&&(n.target=t)}}},buildScene(e,t,n,o){var r,i,a;const l=n.nodeStyle,c=n.edgeStyle,u=Wt(n.nodeSize,n.nodeSizeRange,e),d=Array.isArray(n.colorScheme)?n.colorScheme:s.schemeCategory10,h=new Map;e.forEach((e,t)=>{h.set(e.id,d[t%d.length])});const p=[],g=[],y=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=u(t),n=l?l(t):{},o={fill:n.fill||h.get(t.id)||"#007bff",stroke:n.stroke||"#fff",strokeWidth:null!==(r=n.strokeWidth)&&void 0!==r?r:2,opacity:n.opacity};p.push({type:"circle",cx:t.x,cy:t.y,r:e,style:o,datum:t,id:t.id,label:t.id})}for(const n of t){const t="object"==typeof n.source?n.source:Bt(e,n.source),o="object"==typeof n.target?n.target:Bt(e,n.target);if(!t||!o)continue;if(null==t.x||null==t.y)continue;if(null==o.x||null==o.y)continue;const r=c?c(n):{},s={stroke:r.stroke||"#999",strokeWidth:null!==(i=r.strokeWidth)&&void 0!==i?i:1,opacity:null!==(a=r.opacity)&&void 0!==a?a:.6};g.push({type:"line",x1:t.x,y1:t.y,x2:o.x,y2:o.y,style:s,datum:n})}if(!1!==n.showLabels){const t=(f=n.nodeLabel)?"function"==typeof f?f:e=>e[f]||e.id:null;for(const n of e){if(null==n.x||null==n.y)continue;const e=t?t(n):n.id;if(!e)continue;const o=u(n);y.push({x:n.x,y:n.y-o-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var f;return{sceneNodes:p,sceneEdges:g,labels:y}}};function Bt(e,t){return e.find(e=>e.id===t)}function Wt(e,t,n){var s,i;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const a=t||[5,20],l=n.map(t=>{var n;return null===(n=t.data)||void 0===n?void 0:n[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===l.length)return()=>a[0];const c=null!==(s=r.min(l))&&void 0!==s?s:0,u=null!==(i=r.max(l))&&void 0!==i?i:1;if(c===u)return()=>(a[0]+a[1])/2;const d=o.scaleLinear().domain([c,u]).range(a).clamp(!0);return t=>{var n;const o=null===(n=t.data)||void 0===n?void 0:n[e];return null==o||"number"!=typeof o?a[0]:d(o)}}const Lt=s.schemeCategory10,Rt={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,o){if(0===e.length)return;const{padAngle:r=.01,groupWidth:s=20,sortGroups:i}=n,a=Math.min(o[0],o[1])/2,c=a-s,d=o[0]/2,h=o[1]/2,p=(g=n.valueAccessor)?"function"==typeof g?g:e=>{var t;return null!==(t=e[g])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var g;const y=new Map;for(let t=0;e.length>t;t++)y.set(e[t].id,t);const f=e.length,m=Array.from({length:f},()=>Array.from({length:f},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=y.get("string"==typeof e.source?e.source:e.source.id),o=y.get(t);if(void 0===n||void 0===o)continue;const r=p(e);m[n][o]=r}const v=u.chord().padAngle(r);i&&v.sortGroups(i);const b=v(m),x=b.groups,A=l.arc().innerRadius(c).outerRadius(a);for(const t of x){const n=e[t.index],o=A.centroid(t);n.x=o[0]+d,n.y=o[1]+h,n.arcData={startAngle:t.startAngle,endAngle:t.endAngle}}for(const n of t){const t="string"==typeof n.source?n.source:n.source.id,o="string"==typeof n.target?n.target:n.target.id,r=e.find(e=>e.id===t),s=e.find(e=>e.id===o);r&&(n.source=r),s&&(n.target=s)}for(const n of b){const o=e[n.source.index].id,r=e[n.target.index].id,s=t.find(e=>{const t="string"==typeof e.source?e.source:e.source.id,n="string"==typeof e.target?e.target:e.target.id;return t===o&&n===r||t===r&&n===o});s&&(s.chordData=n)}},buildScene(e,t,n,o){var r,s;const{groupWidth:i=20,edgeOpacity:a=.5}=n,l=Math.min(o[0],o[1])/2,c=l-i,d=o[0]/2,h=o[1]/2,p=n.nodeStyle,g=n.edgeStyle,y=n.edgeColorBy||"source",f=Array.isArray(n.colorScheme)?n.colorScheme:Lt,m=new Map;e.forEach((e,t)=>{m.set(e.id,f[t%f.length])});const v=u.ribbon().radius(c),b=[],x=[],A=[];for(let t=0;e.length>t;t++){const n=e[t],o=n.arcData;if(!o)continue;let s;s=p?p(n).fill||m.get(n.id)||f[t%f.length]:m.get(n.id)||f[t%f.length];const i=p?p(n):{},a={fill:s,stroke:i.stroke||"black",strokeWidth:null!==(r=i.strokeWidth)&&void 0!==r?r:1,opacity:i.opacity};b.push({type:"arc",cx:d,cy:h,innerR:c,outerR:l,startAngle:o.startAngle-Math.PI/2,endAngle:o.endAngle-Math.PI/2,style:a,datum:n,id:n.id,label:n.id})}for(const e of t){const t=e.chordData;if(!t)continue;const n=v({source:Object.assign(Object.assign({},t.source),{startAngle:t.source.startAngle-Math.PI/2,endAngle:t.source.endAngle-Math.PI/2}),target:Object.assign(Object.assign({},t.target),{startAngle:t.target.startAngle-Math.PI/2,endAngle:t.target.endAngle-Math.PI/2})});if(!n)continue;const o=Tt(n,d,h);let r="#999";if(g)r=g(e).fill||r;else{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;"target"===y&&n?r=m.get(n.id)||r:t&&(r=m.get(t.id)||r)}const i=g?g(e):{},l={fill:r,fillOpacity:null!==(s=i.fillOpacity)&&void 0!==s?s:a,stroke:i.stroke||"none",strokeWidth:i.strokeWidth,opacity:i.opacity};x.push({type:"ribbon",pathD:o,style:l,datum:e})}if(!1!==n.showLabels){const t=(w=n.nodeLabel)?"function"==typeof w?w:e=>e[w]||e.id:null,o=l+12;for(const n of e){const e=n.arcData;if(!e)continue;const r=t?t(n):n.id;if(!r)continue;const s=(e.startAngle+e.endAngle)/2,i=s-Math.PI/2;A.push({x:d+Math.cos(i)*o,y:h+Math.sin(i)*o,text:r+"",anchor:s>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var w;return{sceneNodes:b,sceneEdges:x,labels:A}}};function Tt(e,t,n){const o=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!o)return e;const r=[];let s=0;for(;o.length>s;){const e=o[s];if("M"===e||"L"===e)for(r.push(e),s++;o.length>s&&!isNaN(Number(o[s]));)r.push(Number(o[s])+t+""),s++,o.length>s&&!isNaN(Number(o[s]))&&(r.push(Number(o[s])+n+""),s++);else if("C"===e)for(r.push(e),s++;o.length>s&&!isNaN(Number(o[s]));)for(let e=0;3>e&&o.length>s&&!isNaN(Number(o[s]));e++)r.push(Number(o[s])+t+""),s++,o.length>s&&!isNaN(Number(o[s]))&&(r.push(Number(o[s])+n+""),s++);else if("Q"===e)for(r.push(e),s++;o.length>s&&!isNaN(Number(o[s]));)for(let e=0;2>e&&o.length>s&&!isNaN(Number(o[s]));e++)r.push(Number(o[s])+t+""),s++,o.length>s&&!isNaN(Number(o[s]))&&(r.push(Number(o[s])+n+""),s++);else if("A"===e)for(r.push(e),s++;o.length>s&&!isNaN(Number(o[s]));)r.push(o[s++]),o.length>s&&r.push(o[s++]),o.length>s&&r.push(o[s++]),o.length>s&&r.push(o[s++]),o.length>s&&r.push(o[s++]),o.length>s&&(r.push(Number(o[s])+t+""),s++),o.length>s&&(r.push(Number(o[s])+n+""),s++);else"Z"===e||"z"===e?(r.push(e),s++):(r.push(o[s]),s++)}return r.join(" ")}const Dt={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,n,o){var r;const s=n.__hierarchyRoot;if(!s)return;const i=n.chartType,a=(l=n.childrenAccessor)?"function"==typeof l?l:e=>e[l]:void 0;var l;const c=n.hierarchySum||(e=>{var t;return null!==(t=e.value)&&void 0!==t?t:0}),u=d.hierarchy(s,a);u.sum(c),u.sort((e,t)=>{var n,o;return(null!==(n=t.value)&&void 0!==n?n:0)-(null!==(o=e.value)&&void 0!==o?o:0)});const[h,p]=o;switch(i){case"tree":!function(e,t,n,o){const r=t.treeOrientation||"vertical",s=d.tree();s.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),s(e)}(u,n,h,p);break;case"cluster":!function(e,t,n,o){const r=t.treeOrientation||"vertical",s=d.cluster();s.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),s(e)}(u,n,h,p);break;case"treemap":!function(e,t,n,o){var r,s;const i=null!==(r=t.padding)&&void 0!==r?r:4,a=null!==(s=t.paddingTop)&&void 0!==s?s:0,l=d.treemap().size([n,o]).tile(d.treemapBinary).padding(i);a>0&&l.paddingTop(a),l(e)}(u,n,h,p);break;case"circlepack":!function(e,t,n,o){var r;const s=null!==(r=t.padding)&&void 0!==r?r:4;d.pack().size([n,o]).padding(s)(e)}(u,n,h,p);break;case"partition":!function(e,t,n,o){var r;d.partition().size([n,o]).padding(null!==(r=t.padding)&&void 0!==r?r:1)(e)}(u,n,h,p)}const g=u.descendants();e.length=0,t.length=0;const y=new Map;for(let t=0;g.length>t;t++){const o=g[t],s={id:Yt(o,n,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(r=o.value)&&void 0!==r?r:0,depth:o.depth,data:o.data,createdByFrame:!0};"tree"===i||"cluster"===i?$t(s,o,n):"treemap"===i||"partition"===i?Ft(s,o):"circlepack"===i&&Ht(s,o),s.__hierarchyNode=o,e.push(s),y.set(o,s)}if("tree"===i||"cluster"===i)for(const e of g)if(e.parent){const n=y.get(e.parent),o=y.get(e);n&&o&&t.push({source:n,target:o,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,n,o){const r=n.nodeStyle||(()=>({})),s=n.edgeStyle||(()=>({}));switch(n.chartType){case"tree":case"cluster":return function(e,t,n,o,r,s){var i,a,l,c,u;const d=[],h=[],p=[],g=n.treeOrientation||"vertical",y="radial"===g,f=o[0]/2,m=o[1]/2,v="number"==typeof(b=n.nodeSize)?b:5;var b;for(const t of e){let e=t.x,n=t.y;y&&(e+=f,n+=m);const o=r(t),s={fill:o.fill||"#4d430c",stroke:o.stroke||"#fff",strokeWidth:null!==(i=o.strokeWidth)&&void 0!==i?i:1,opacity:o.opacity};d.push({type:"circle",cx:e,cy:n,r:v,style:s,datum:t,id:t.id,label:t.id,depth:t.depth})}const x=null!==(a=n.edgeOpacity)&&void 0!==a?a:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let o=t.x,r=t.y,i=n.x,a=n.y;y&&(o+=f,r+=m,i+=f,a+=m);const u=It(o,r,i,a,g),d=s(e),p={fill:"none",stroke:d.stroke||"#999",strokeWidth:null!==(l=d.strokeWidth)&&void 0!==l?l:1.5,opacity:null!==(c=d.opacity)&&void 0!==c?c:x};h.push({type:"curved",pathD:u,style:p,datum:e})}if(!1!==n.showLabels){const t=qt(n.nodeLabel);for(const n of e){const e=t?t(n):n.id;if(!e)continue;let o,r,s,i=n.x,a=n.y;if(y&&(i+=f,a+=m),y){const e=i-f,t=a-m,n=Math.sqrt(e*e+t*t);n>0?(o=i+e/n*10,r=a+t/n*10,s=0>e?"end":"start"):(o=i,r=a-12,s="middle")}else"horizontal"===g?((null===(u=n.data)||void 0===u?void 0:u.children)&&0!==n.data.children.length?(o=i-v-6,s="end"):(o=i+v+6,s="start"),r=a):(o=i,r=a+v+14,s="middle");p.push({x:o,y:r,text:e+"",anchor:s,baseline:"middle",fontSize:11})}}return{sceneNodes:d,sceneEdges:h,labels:p}}(e,t,n,o,r,s);case"treemap":case"partition":return function(e,t,n,o){var r,s;const i=[],a=[],l=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];for(const n of e){const e=n.x1-n.x0,s=n.y1-n.y0;if(0>=e||0>=s)continue;const a=o(n);let c=a.fill||"#4d430c";t.colorByDepth&&void 0!==n.depth&&(c=l[n.depth%l.length]);const u={fill:c,stroke:a.stroke||"#fff",strokeWidth:null!==(r=a.strokeWidth)&&void 0!==r?r:1,opacity:a.opacity};i.push({type:"rect",x:n.x0,y:n.y0,w:e,h:s,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=qt(t.nodeLabel);for(const o of e){const e=o.x1-o.x0,r=o.y1-o.y0;if(0>=e||0>=r)continue;if((null===(s=o.data)||void 0===s?void 0:s.children)&&o.data.children.length>0&&"partition"!==t.chartType)continue;const i=n?n(o):o.id;i&&(30>e||16>r||a.push({x:o.x0+e/2,y:o.y0+r/2,text:i+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,r)/6))}))}}return{sceneNodes:i,sceneEdges:[],labels:a}}(e,n,0,r);case"circlepack":return function(e,t,n,o){var r,s,i,a,l;const c=[],u=[],d=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];for(const n of e){const e=null!==(r=n.__radius)&&void 0!==r?r:5;if(0>=e)continue;const a=o(n);let l=a.fill||"#4d430c";t.colorByDepth&&void 0!==n.depth&&(l=d[n.depth%d.length]);const u={fill:l,stroke:a.stroke||"#fff",strokeWidth:null!==(s=a.strokeWidth)&&void 0!==s?s:1,opacity:null!==(i=a.opacity)&&void 0!==i?i:.7};c.push({type:"circle",cx:n.x,cy:n.y,r:e,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=qt(t.nodeLabel);for(const t of e){const e=null!==(a=t.__radius)&&void 0!==a?a:5,o=n?n(t):t.id;if(!o)continue;if(15>e)continue;const r=!((null===(l=t.data)||void 0===l?void 0:l.children)&&t.data.children.length>0);u.push({x:t.x,y:r?t.y:t.y-e+14,text:o+"",anchor:"middle",baseline:r?"middle":"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:r?void 0:"#000",stroke:r?void 0:"#fff",strokeWidth:r?void 0:3,paintOrder:r?void 0:"stroke"})}}return{sceneNodes:c,sceneEdges:[],labels:u}}(e,n,0,r);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function $t(e,t,n){const o=n.treeOrientation||"vertical";if("radial"===o){const n=t.x,o=t.y;e.x=o*Math.cos(n-Math.PI/2),e.y=o*Math.sin(n-Math.PI/2)}else"horizontal"===o?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function Ft(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function Ht(e,t){var n;const o=null!==(n=t.r)&&void 0!==n?n:0;e.x=t.x,e.y=t.y,e.x0=t.x-o,e.x1=t.x+o,e.y0=t.y-o,e.y1=t.y+o,e.width=2*o,e.height=2*o,e.__radius=o}function It(e,t,n,o,r){if("horizontal"===r){const r=(e+n)/2;return`M ${e},${t} C ${r},${t} ${r},${o} ${n},${o}`}if("radial"===r){const r=(e+n)/2;return`M ${e},${t} Q ${r},${t} ${r},${(t+o)/2} T ${n},${o}`}{const r=(t+o)/2;return`M ${e},${t} C ${e},${r} ${n},${r} ${n},${o}`}}function Yt(e,t,n){const o=t.nodeIDAccessor;return"function"==typeof o?o(e.data)+"":"string"==typeof o&&void 0!==e.data[o]?e.data[o]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+n}function qt(e){return e?"function"==typeof e?e:t=>{var n;return(null===(n=t.data)||void 0===n?void 0:n[e])||t[e]||t.id}:null}const Xt={sankey:_t,force:zt,chord:Rt,tree:Dt,cluster:Dt,treemap:Dt,circlepack:Dt,partition:Dt};function Gt(e){return Xt[e]}class Vt{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.particlePool=null,this.transition=null,this.config=e,this.tensionConfig=Object.assign(Object.assign({},kt),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&(this.particlePool=new Et(2e3))}updateConfig(e){this.config=e,this.tensionConfig=Object.assign(Object.assign({},kt),e.tensionConfig),"sankey"===e.chartType&&e.showParticles?this.particlePool||(this.particlePool=new Et(2e3)):this.particlePool=null}ingestHierarchy(e,t){this.nodes.clear(),this.edges.clear(),this.config.__hierarchyRoot=e,this.runLayout(t)}ingestBounded(e,t,n){const{nodeIDAccessor:o="id",sourceAccessor:r="source",targetAccessor:s="target",valueAccessor:i="value"}=this.config,a="function"==typeof o?o:e=>e[o],l="function"==typeof r?r:e=>e[r],c="function"==typeof s?s:e=>e[s],u="function"==typeof i?i:e=>{var t;return null!==(t=e[i])&&void 0!==t?t:1};this.nodes.clear(),this.edges.clear();for(const t of e){const e=a(t)+"";this.nodes.set(e,Object.assign(Object.assign({},Ut(e)),{data:t}))}for(const e of t){const t=l(e)+"",n=c(e)+"",o=Number(u(e))||1;this.nodes.has(t)||this.nodes.set(t,Object.assign(Object.assign({},Ut(t)),{data:e})),this.nodes.has(n)||this.nodes.set(n,Object.assign(Object.assign({},Ut(n)),{data:e})),this.edges.set(`${t}\0${n}`,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0,data:e})}this.runLayout(n)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:n,value:o}=e,r=0===this.nodes.size;let s=!1;this.nodes.has(t)||(this.nodes.set(t,Ut(t)),this.tension+=this.tensionConfig.newNode,s=!0),this.nodes.has(n)||(this.nodes.set(n,Ut(n)),this.tension+=this.tensionConfig.newNode,s=!0);const i=this.edgeKey(t,n),a=this.edges.get(i);return a?(a.value+=o,this.tension+=this.tensionConfig.weightChange):(this.edges.set(i,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0}),this.tension+=this.tensionConfig.newEdge,s=!0),r||s||this.tension>=this.tensionConfig.threshold}runLayout(e){const t=Gt(this.config.chartType);if(!t)return;let n=Array.from(this.nodes.values()),o=Array.from(this.edges.values());if(0!==n.length||t.hierarchical){if(this.prepareForRelayout(),t.computeLayout(n,o,this.config,e),t.hierarchical&&n.length>0){this.nodes.clear(),this.edges.clear();for(const e of n)this.nodes.set(e.id,e);for(const e of o)this.edges.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e)}this.finalizeLayout(),this.saveTargetPositions(),n.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1))&&this.tensionConfig.transitionDuration>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:this.tensionConfig.transitionDuration}),this.layoutVersion++}}buildScene(e){const t=Gt(this.config.chartType);if(!t)return;const n=Array.from(this.nodes.values()),o=Array.from(this.edges.values()),{sceneNodes:r,sceneEdges:s,labels:i}=t.buildScene(n,o,this.config,e);this.sceneNodes=r,this.sceneEdges=s,this.labels=i}advanceTransition(e){if(!this.transition)return!1;const t=Math.min((e-this.transition.startTime)/this.transition.duration,1),n=1-Math.pow(1-t,3);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0+(e._targetX0-e._prevX0)*n,e.x1=e._prevX1+(e._targetX1-e._prevX1)*n,e.y0=e._prevY0+(e._targetY0-e._prevY0)*n,e.y1=e._prevY1+(e._targetY1-e._prevY1)*n);for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0+(e._targetY0-e._prevY0)*n,e.y1=e._prevY1+(e._targetY1-e._prevY1)*n,e.sankeyWidth=e._prevSankeyWidth+(e._targetSankeyWidth-e._prevSankeyWidth)*n);return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){for(const e of this.nodes.values())e._prevX0=e.x0,e._prevX1=e.x1,e._prevY0=e.y0,e._prevY1=e.y1;for(const e of this.edges.values())e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth);this.rebuildAllBeziers()}updateEdgeBezier(e){const t="string"==typeof e.source?this.nodes.get(e.source):e.source,n="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&n&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,n))}buildStandardBezier(e,t,n){const o=(e.sankeyWidth||1)/2;if("down"===e.direction){const r=t.y1,s=n.y0,a=i.interpolateNumber(r,s);return{circular:!1,points:[{x:e.y0,y:r},{x:e.y0,y:a(.5)},{x:e.y1,y:a(.5)},{x:e.y1,y:s}],halfWidth:o}}const r=t.x1,s=n.x0,a=i.interpolateNumber(r,s);return{circular:!1,points:[{x:r,y:e.y0},{x:a(.5),y:e.y0},{x:a(.5),y:e.y1},{x:s,y:e.y1}],halfWidth:o}}buildCircularBezier(e){const t=(e.sankeyWidth||1)/2,n=e.circularPathData;let o;o="down"===e.direction?[{x:n.sourceY,y:n.sourceX},{x:n.sourceY,y:n.leftFullExtent},{x:n.verticalFullExtent,y:n.leftFullExtent},{x:n.verticalFullExtent,y:n.rightFullExtent},{x:n.targetY,y:n.rightFullExtent},{x:n.targetY,y:n.targetX}]:[{x:n.sourceX,y:n.sourceY},{x:n.leftFullExtent,y:n.sourceY},{x:n.leftFullExtent,y:n.verticalFullExtent},{x:n.rightFullExtent,y:n.verticalFullExtent},{x:n.rightFullExtent,y:n.targetY},{x:n.targetX,y:n.targetY}];const r=[];for(let e=0;o.length-1>e;e++){const t=o[e],n=o[e+1],s=n.x-t.x,i=n.y-t.y;r.push([t,{x:t.x+s/3,y:t.y+i/3},{x:t.x+2*s/3,y:t.y+2*i/3},n])}return{circular:!0,segments:r,halfWidth:t}}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}clear(){this.nodes.clear(),this.edges.clear(),this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.transition=null,this.particlePool&&this.particlePool.clear()}}function Ut(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function Qt(e,t,n){switch(e.type){case"circle":return function(e,t,n){const o=t-e.cx,r=n-e.cy,s=Math.sqrt(o*o+r*r);return s>Math.max(e.r,5)+5?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:s}}(e,t,n);case"rect":return function(e,t,n){return e.x>t||t>e.x+e.w||e.y>n||n>e.y+e.h?null:{type:"node",datum:e.datum,x:e.x+e.w/2,y:e.y+e.h/2,distance:0}}(e,t,n);case"arc":return function(e,t,n){const o=t-e.cx,r=n-e.cy,s=Math.sqrt(o*o+r*r);if(e.innerR-2>s||s>e.outerR+2)return null;let i=Math.atan2(r,o);0>i&&(i+=2*Math.PI);let a,l=e.startAngle,c=e.endAngle;if(0>l&&(l+=2*Math.PI),0>c&&(c+=2*Math.PI),a=l>c?i>=l||c>=i:i>=l&&c>=i,a){const t=(e.startAngle+e.endAngle)/2,n=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+n*Math.cos(t),y:e.cy+n*Math.sin(t),distance:0}}return null}(e,t,n);default:return null}}function Zt(e,t,n){switch(e.type){case"bezier":return function(e,t,n){var o,r;if(!e.pathD)return null;try{const s=new Path2D(e.pathD),i=document.createElement("canvas").getContext("2d");if(!i)return null;if(i.isPointInPath(s,t,n)){const s="object"==typeof(null===(o=e.datum)||void 0===o?void 0:o.source)?e.datum.source:null,i="object"==typeof(null===(r=e.datum)||void 0===r?void 0:r.target)?e.datum.target:null;return{type:"edge",datum:e.datum,x:s&&i?(s.x1+i.x0)/2:t,y:e.datum?(e.datum.y0+e.datum.y1)/2:n,distance:0}}}catch(e){}return null}(e,t,n);case"line":return function(e,t,n){const o=e.x2-e.x1,r=e.y2-e.y1,s=o*o+r*r;if(0===s)return null;let i=((t-e.x1)*o+(n-e.y1)*r)/s;i=Math.max(0,Math.min(1,i));const a=e.x1+i*o,l=e.y1+i*r,c=Math.sqrt(Math.pow(t-a,2)+Math.pow(n-l,2));return c>5?null:{type:"edge",datum:e.datum,x:a,y:l,distance:c}}(e,t,n);case"ribbon":case"curved":return function(e,t,n){if(!e.pathD)return null;try{const o=new Path2D(e.pathD),r=document.createElement("canvas").getContext("2d");if(!r)return null;if(r.isPointInPath(o,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0}}catch(e){}return null}(e,t,n);default:return null}}function Jt(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:s,labels:i,title:a,legend:l,foregroundGraphics:c,annotations:u,svgAnnotationRules:d}=e;return p.createElement("svg",{width:o,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},p.createElement("g",{transform:`translate(${s.left},${s.top})`},i.map((e,t)=>p.createElement("text",{key:"label-"+t,x:e.x,y:e.y,textAnchor:e.anchor||"start",dominantBaseline:e.baseline||"middle",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"currentColor",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,style:{pointerEvents:"none"}},e.text)),u&&d&&u.map((e,o)=>{const r=d(e,o,{width:t,height:n});return r?p.createElement(p.Fragment,{key:"annotation-"+o},r):null}),c),a&&"string"==typeof a?p.createElement("text",{x:o/2,y:16,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"currentColor"},a):a?p.createElement("foreignObject",{x:0,y:0,width:o,height:s.top},a):null,l&&"object"==typeof l&&"legendGroups"in l?p.createElement("g",{transform:`translate(${o-s.right+10},${s.top})`},l.legendGroups.map((e,t)=>{var n;return p.createElement("g",{key:"legend-group-"+t},null===(n=e.items)||void 0===n?void 0:n.map((e,t)=>p.createElement("g",{key:"legend-item-"+t,transform:`translate(0,${20*t})`},p.createElement("rect",{x:0,y:0,width:12,height:12,fill:e.color,rx:2}),p.createElement("text",{x:18,y:10,fontSize:11,fill:"currentColor"},e.label))))})):l?p.createElement("g",{transform:`translate(${o-s.right+10},${s.top})`},l):null)}function Kt(e,t){var n,o,r,s;if(!t.pathD)return;e.save();const i=new Path2D(t.pathD);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,e.fill(i)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:.5,e.globalAlpha=.5*(null!==(s=t.style.opacity)&&void 0!==s?s:1),e.stroke(i)),e.restore()}function en(e,t){var n;e.save(),e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),e.restore()}function tn(e,t){var n,o,r,s;if(!t.pathD)return;e.save();const i=new Path2D(t.pathD);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,e.fill(i)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:.5,e.globalAlpha=.3*(null!==(s=t.style.opacity)&&void 0!==s?s:1),e.stroke(i)),e.restore()}function nn(e,t){var n,o;if(!t.pathD)return;e.save();const r=new Path2D(t.pathD);e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(r),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=t.style.fillOpacity)&&void 0!==o?o:.1,e.fill(r)),e.restore()}Jt.displayName="NetworkSVGOverlay";const on={top:20,right:80,bottom:20,left:80},rn={top:40,right:40,bottom:40,left:40},sn=new Set(["chord","force","circlepack"]),an=[800,600],ln={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function cn({data:e}){var t,n,o,r,s,i;if("edge"===e.type){const t=e.data;return p.createElement("div",{className:"semiotic-tooltip",style:ln},p.createElement("div",{style:{fontWeight:600}},"object"==typeof t.source?t.source.id:t.source," → ","object"==typeof t.target?t.target.id:t.target),null!=t.value&&p.createElement("div",{style:{marginTop:4,opacity:.8}},"Value:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""))}const a=e.data,l=null==a?void 0:a.__hierarchyNode;if(l){const e=[];let s=l;for(;s;){const i=null!==(r=null!==(n=null===(t=s.data)||void 0===t?void 0:t.name)&&void 0!==n?n:null===(o=s.data)||void 0===o?void 0:o.id)&&void 0!==r?r:a.id;null!=i&&e.unshift(i+""),s=s.parent}e.length>1&&e.shift();const i=e.length-1;return p.createElement("div",{className:"semiotic-tooltip",style:ln},p.createElement("div",null,e.map((e,t)=>p.createElement("span",{key:t},t>0&&p.createElement("span",{style:{margin:"0 3px",opacity:.5}}," → "),t===i?p.createElement("strong",null,e):p.createElement("span",{style:{opacity:.7}},e)))),null!=a.value&&a.value>0&&p.createElement("div",{style:{marginTop:4,opacity:.8}},"number"==typeof a.value?a.value.toLocaleString():a.value+""))}const c=((null===(s=a.sourceLinks)||void 0===s?void 0:s.length)||0)+((null===(i=a.targetLinks)||void 0===i?void 0:i.length)||0),u=(a.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(a.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return p.createElement("div",{className:"semiotic-tooltip",style:ln},p.createElement("div",{style:{fontWeight:600}},a.id),null!=a.value&&a.value>0&&p.createElement("div",{style:{marginTop:4,opacity:.8}},"Total:"," ","number"==typeof a.value?a.value.toLocaleString():a.value+""),c>0&&p.createElement("div",{style:{marginTop:4,opacity:.8}},"Connections: ",c,u!==c&&` (weighted: ${u.toLocaleString()})`))}const un=e.forwardRef(function(t,n){const{chartType:o,nodes:r,edges:s,data:i,initialEdges:a,nodeIDAccessor:l="id",sourceAccessor:c="source",targetAccessor:u="target",valueAccessor:d="value",childrenAccessor:h,hierarchySum:g,orientation:y="horizontal",nodeAlign:f="justify",nodePaddingRatio:m=.05,nodeWidth:v=15,iterations:b=300,forceStrength:x=.1,padAngle:A=.01,groupWidth:w=20,sortGroups:k,edgeSort:S,treeOrientation:E="vertical",edgeType:M="curve",padding:O,paddingTop:j,tensionConfig:P,showParticles:N=!1,particleStyle:C,nodeStyle:_,edgeStyle:z,colorBy:B,colorScheme:W="category10",edgeColorBy:L="source",edgeOpacity:R=.5,colorByDepth:T=!1,nodeSize:D=8,nodeSizeRange:$=[5,20],nodeLabel:F,showLabels:H=!0,size:I=an,margin:Y,className:q,background:X,enableHover:G=!0,tooltipContent:V,onTopologyChange:U,annotations:Q,svgAnnotationRules:Z,legend:J,title:K,foregroundGraphics:te,backgroundGraphics:ne}=t,oe=sn.has(o)?rn:on,re=Object.assign(Object.assign({},oe),Y),se=I[0]-re.left-re.right,ie=I[1]-re.top-re.bottom,ae=e.useMemo(()=>Object.assign(Object.assign({},kt),P),[P]),le=e.useMemo(()=>Object.assign(Object.assign({},St),C),[C]),ce=e.useMemo(()=>({chartType:o,nodeIDAccessor:l,sourceAccessor:c,targetAccessor:u,valueAccessor:d,childrenAccessor:h,hierarchySum:g,orientation:y,nodeAlign:f,nodePaddingRatio:m,nodeWidth:v,iterations:b,forceStrength:x,padAngle:A,groupWidth:w,sortGroups:k,edgeSort:S,treeOrientation:E,edgeType:M,padding:O,paddingTop:j,tensionConfig:ae,showParticles:N,particleStyle:le,nodeStyle:_,edgeStyle:z,nodeLabel:F,showLabels:H,colorBy:B,colorScheme:W,edgeColorBy:L,edgeOpacity:R,colorByDepth:T,nodeSize:D,nodeSizeRange:$}),[o,l,c,u,d,h,g,y,f,m,v,b,x,A,w,k,S,E,M,O,j,ae,N,le,_,z,F,H,B,W,L,R,T,D,$]),ue=e.useRef(null),de=e.useRef(0),he=e.useRef(0),pe=e.useRef(!0),ge=e.useRef(()=>{}),ye=e.useRef(null);ye.current||(ye.current=new Vt(ce));const[fe,me]=e.useState(null),[ve,be]=e.useState(0),[xe,Ae]=e.useState(0),we=e.useRef(null),ke=e.useRef(new Map),Se=e.useRef(0),Ee=e.useCallback(e=>{if("function"==typeof B)return B(e);if("string"==typeof B&&e.data){const t=e.data[B];if(void 0!==t){if(!ke.current.has(t+"")){const e=Array.isArray(W)?W:ee;ke.current.set(t+"",e[Se.current++%e.length])}return ke.current.get(t+"")}}if(!ke.current.has(e.id)){const t=Array.isArray(W)?W:ee;ke.current.set(e.id,t[Se.current++%t.length])}return ke.current.get(e.id)},[B,W]);e.useCallback(e=>{if("function"==typeof L)return L(e);const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===L&&n?Ee(n):t?Ee(t):"#999"},[L,Ee]);const Me=e.useCallback(e=>{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===(le.colorBy||"source")&&n?Ee(n):t?Ee(t):"#999"},[le.colorBy,Ee]),Oe="sankey"===o&&N,je=e.useCallback(()=>{de.current&&!Oe||de.current||(de.current=requestAnimationFrame(()=>ge.current()))},[Oe]);e.useEffect(()=>{var e;null===(e=ye.current)||void 0===e||e.updateConfig(ce),pe.current=!0,je()},[ce,je]);const Pe=e.useCallback(()=>{const e=ye.current;if(e&&(e.runLayout([se,ie]),e.buildScene([se,ie]),pe.current=!0,be(e.layoutVersion),U)){const{nodes:t,edges:n}=e.getLayoutData();U(t,n)}},[se,ie,U]),Ne=e.useCallback(e=>{const t=ye.current;t&&(t.ingestEdge(e)&&Pe(),je())},[Pe,je]),Ce=e.useCallback(e=>{const t=ye.current;if(!t)return;let n=!1;for(const o of e)t.ingestEdge(o)&&(n=!0);n&&Pe(),je()},[Pe,je]),_e=e.useCallback(()=>{var e;null===(e=ye.current)||void 0===e||e.clear(),ke.current.clear(),Se.current=0,be(0),me(null),we.current=null,pe.current=!0,je()},[je]),ze=e.useCallback(()=>{const e=ye.current;e&&(e.tension+=999,Pe(),je())},[Pe,je]);e.useImperativeHandle(n,()=>({push:Ne,pushMany:Ce,clear:_e,getTopology:()=>{var e,t;return null!==(t=null===(e=ye.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},relayout:ze,getTension:()=>{var e,t;return null!==(t=null===(e=ye.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[Ne,Ce,_e,ze]);const Be=["tree","cluster","treemap","circlepack","partition"].includes(o),We=Be?i||(Array.isArray(s)?void 0:s):void 0;e.useEffect(()=>{const e=ye.current;if(e)if(Be&&We)e.ingestHierarchy(We,[se,ie]),e.buildScene([se,ie]),pe.current=!0,je();else{const t=r||[],n=Array.isArray(s)?s:[];if(0===t.length&&0===n.length)return;e.ingestBounded(t,n,[se,ie]),e.buildScene([se,ie]),pe.current=!0,je()}},[r,s,i,We,Be,se,ie,ce,je]),e.useEffect(()=>{a&&a.length>0&&Ce(a)},[]);const Le=e.useRef(()=>{}),Re=e.useRef(()=>{});Le.current=e=>{if(!G)return;const t=ue.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-re.left,r=e.clientY-n.top-re.top;if(0>o||o>se||0>r||r>ie)return void(we.current&&(we.current=null,me(null),je()));const s=ye.current;if(!s)return;const i=function(e,t,n,o,r=30){let s=null,i=r,a=1/0;for(const t of e){const e=Qt(t,n,o);if(e)if("rect"===t.type){const n=t.w*t.h;a>n&&(s=e,a=n)}else i>e.distance&&(s=e,i=e.distance)}if(s)return s;for(const e of t){const t=Zt(e,n,o);t&&i>t.distance&&(s=t,i=t.distance)}return s}(s.sceneNodes,s.sceneEdges,o,r);if(!i)return void(we.current&&(we.current=null,me(null),je()));const a={type:i.type,data:i.datum,x:i.x,y:i.y};we.current=a,me(a),je()},Re.current=()=>{we.current&&(we.current=null,me(null),je())};const Te=e.useCallback(e=>Le.current(e),[]),De=e.useCallback(()=>Re.current(),[]);ge.current=()=>{var e;de.current=0;const t=ue.current;if(!t)return;const n=t.getContext("2d");if(!n)return;const o=ye.current;if(!o)return;const r=performance.now(),s=he.current?Math.min((r-he.current)/1e3,.1):.016;he.current=r;const i=o.advanceTransition(r);(i||pe.current)&&o.buildScene([se,ie]);const a="undefined"!=typeof window&&window.devicePixelRatio||1;if(t.width=I[0]*a,t.height=I[1]*a,t.style.width=I[0]+"px",t.style.height=I[1]+"px",n.scale(a,a),n.translate(re.left,re.top),n.clearRect(-re.left,-re.top,I[0],I[1]),X&&(n.fillStyle=X,n.fillRect(0,0,se,ie)),function(e,t){for(const n of t)switch(n.type){case"bezier":Kt(e,n);break;case"line":en(e,n);break;case"ribbon":tn(e,n);break;case"curved":nn(e,n)}}(n,o.sceneEdges),function(e,t){var n,o,r;for(const s of t){if("rect"!==s.type)continue;const t=s;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.strokeRect(t.x,t.y,t.w,t.h)),e.restore())}}(n,o.sceneNodes),function(e,t){var n,o,r;for(const s of t){if("circle"!==s.type)continue;const t=s;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),e.restore())}}(n,o.sceneNodes),function(e,t){var n,o,r;for(const s of t){if("arc"!==s.type)continue;const t=s;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),e.restore()}}(n,o.sceneNodes),N&&o.particlePool){const t=Array.from(o.edges.values());if(t.length>0){!function(e,t,n,o){var r,s;const i=null!==(r=o.spawnRate)&&void 0!==r?r:St.spawnRate,a=null!==(s=o.maxPerEdge)&&void 0!==s?s:St.maxPerEdge;for(let o=0;t.length>o;o++){const r=t[o];if(!r.bezier)continue;if(e.countForEdge(o)>=a)continue;const s=r.value*i*n,l=Math.floor(s),c=s-l;let u=l;Math.random()<c&&u++;for(let t=0;u>t&&e.countForEdge(o)<a;t++)e.spawn(o)}}(o.particlePool,t,s,le);const r=.5*(null!==(e=le.speedMultiplier)&&void 0!==e?e:1);o.particlePool.step(s,r,t),function(e,t,n,o,r){var s,i;const a=null!==(s=o.radius)&&void 0!==s?s:St.radius,l=null!==(i=o.opacity)&&void 0!==i?i:St.opacity;e.globalAlpha=l;for(let s=0;t.particles.length>s;s++){const i=t.particles[s];if(!i.active)continue;const l=n[i.edgeIndex];if(l){if("function"==typeof o.color){const t="object"==typeof l.source?l.source:null;e.fillStyle=t?o.color(l,t):"#666"}else e.fillStyle=o.color&&"inherit"!==o.color?o.color:r(l);e.beginPath(),e.arc(i.x,i.y,a,0,2*Math.PI),e.fill()}}e.globalAlpha=1}(n,o.particlePool,t,le,Me)}}const l=pe.current;pe.current=!1,(l||i)&&Ae(e=>e+1),(Oe||i)&&(de.current=requestAnimationFrame(()=>ge.current()))},e.useEffect(()=>(je(),()=>{de.current&&cancelAnimationFrame(de.current)}),[je]),e.useEffect(()=>{pe.current=!0,je()},[o,se,ie,X,je]);const $e=G&&fe?p.createElement("div",{className:"stream-network-tooltip",style:{position:"absolute",left:re.left+fe.x,top:re.top+fe.y,transform:`translate(${fe.x>.6*se?"calc(-100% - 12px)":"12px"}, ${.3*ie>fe.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:2}},V?V(fe):p.createElement(cn,{data:fe})):null,Fe=ye.current;return p.createElement("div",{className:"stream-network-frame"+(q?" "+q:""),style:{position:"relative",width:I[0],height:I[1]},onMouseMove:G?Te:void 0,onMouseLeave:G?De:void 0},ne&&p.createElement("svg",{style:{position:"absolute",top:0,left:0,width:I[0],height:I[1],pointerEvents:"none"}},p.createElement("g",{transform:`translate(${re.left},${re.top})`},ne)),p.createElement("canvas",{ref:ue,style:{position:"absolute",top:0,left:0}}),p.createElement(Jt,{width:se,height:ie,totalWidth:I[0],totalHeight:I[1],margin:re,labels:(null==Fe?void 0:Fe.labels)||[],title:K,legend:J,foregroundGraphics:te,annotations:Q,svgAnnotationRules:Z,annotationFrame:xe}),$e)});function dn(t){const{nodes:n,edges:o,width:r=600,height:s=600,margin:i,className:a,title:l,nodeIDAccessor:c="id",sourceAccessor:u="source",targetAccessor:d="target",nodeLabel:h,colorBy:g,colorScheme:y="category10",nodeSize:f=8,nodeSizeRange:m=[5,20],edgeWidth:v=1,edgeColor:b="#999",edgeOpacity:x=.6,iterations:A=300,forceStrength:w=.1,showLabels:k=!1,enableHover:S=!0,showLegend:E,tooltip:M,frameProps:O={}}=t,j=n||[],P=o||[],N=ie(j,g,y),C=e.useMemo(()=>e=>{const t={};return t.fill=g?te(e.data||e,g,N):re,"number"==typeof f&&(t.r=f),t},[g,N,f]),_=e.useMemo(()=>e=>({stroke:b,strokeWidth:"number"==typeof v?v:"function"==typeof v?v(e):e[v]||1,opacity:x}),[v,b,x]),z=e.useMemo(()=>{if(k&&h)return"function"==typeof h?h:e=>e[h]},[k,h]),B=void 0!==E?E:!!g,W=e.useMemo(()=>{if(B&&g)return le({data:j,colorBy:g,colorScale:N,getColor:te})},[B,g,j,N]),L=e.useMemo(()=>{const e=Object.assign(Object.assign({},{top:20,bottom:20,left:20,right:20}),i);return W&&120>e.right&&(e.right=120),e},[i,W]),R=ve({componentName:"ForceDirectedGraph",nodes:n,edges:o,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:c}});return R?p.createElement(ye,{componentName:"ForceDirectedGraph",message:R,width:r,height:s}):p.createElement(un,Object.assign({chartType:"force",nodes:j,edges:P,size:[r,s],margin:L,nodeIDAccessor:c,sourceAccessor:u,targetAccessor:d,iterations:A,forceStrength:w,nodeStyle:C,edgeStyle:_,colorBy:g,colorScheme:y,nodeSize:f,nodeSizeRange:m,nodeLabel:z,showLabels:k,enableHover:S,tooltipContent:M?e=>he(M)(e.data):void 0,legend:W,className:a,title:l},O))}function hn(t){const{nodes:n,edges:o,width:r=600,height:s=600,margin:i={top:50,bottom:50,left:50,right:50},className:a,title:l,sourceAccessor:c="source",targetAccessor:u="target",valueAccessor:d="value",nodeIdAccessor:h="id",colorBy:g,colorScheme:y="category10",edgeColorBy:f="source",padAngle:m=.01,groupWidth:v=20,sortGroups:b,nodeLabel:x,showLabels:A=!0,enableHover:w=!0,edgeOpacity:k=.5,tooltip:S,frameProps:E={}}=t,M=o||[],O=e.useMemo(()=>{if(n&&n.length>0)return n;const e=new Set;return M.forEach(t=>{const n="function"==typeof c?c(t):t[c],o="function"==typeof u?u(t):t[u];e.add(n),e.add(o)}),Array.from(e).map(e=>({id:e}))},[n,M,c,u]),j=ie(O,g,y),P=e.useMemo(()=>(e,t)=>{var n,o;const r={stroke:"black",strokeWidth:1};if(g)r.fill=te(e.data||e,g,j);else{const s=Array.isArray(y)?y:K[y]||ee,i=Array.isArray(s)?s:ee,a=null!==(o=null!==(n=e.index)&&void 0!==n?n:t)&&void 0!==o?o:0;r.fill=i[a%i.length]}return r},[g,j,y]),N=e.useMemo(()=>e=>{const t={stroke:"black",strokeWidth:.5,fillOpacity:k,strokeOpacity:k};if("function"==typeof f)t.fill=f(e);else if("source"===f){const n="object"==typeof e.source?e.source:null;g&&n?t.fill=te(n.data||n,g,j):n&&(t.fill=P(n,n.index).fill)}else if("target"===f){const n="object"==typeof e.target?e.target:null;g&&n?t.fill=te(n.data||n,g,j):n&&(t.fill=P(n,n.index).fill)}return t},[f,g,j,P,k]),C=e.useMemo(()=>{if(!A)return;const e=x||h;return"function"==typeof e?e:t=>t[e]},[A,x,h]),_=ve({componentName:"ChordDiagram",edges:o,edgesRequired:!0});return _?p.createElement(ye,{componentName:"ChordDiagram",message:_,width:r,height:s}):p.createElement(un,Object.assign({chartType:"chord",nodes:O,edges:M,size:[r,s],margin:i,nodeIDAccessor:h,sourceAccessor:c,targetAccessor:u,valueAccessor:d,padAngle:m,groupWidth:v,sortGroups:b,nodeStyle:P,edgeStyle:N,colorBy:g,colorScheme:y,edgeColorBy:f,edgeOpacity:k,nodeLabel:C,showLabels:A,enableHover:w,tooltipContent:S?e=>he(S)(e.data):void 0,className:a,title:l},E))}function pn(t){const{nodes:n,edges:o,width:r=800,height:s=600,margin:i={top:50,bottom:50,left:50,right:50},className:a,title:l,sourceAccessor:c="source",targetAccessor:u="target",valueAccessor:d="value",nodeIdAccessor:h="id",colorBy:g,colorScheme:y="category10",edgeColorBy:f="source",orientation:m="horizontal",nodeAlign:v="justify",nodePaddingRatio:b=.05,nodeWidth:x=15,nodeLabel:A,showLabels:w=!0,enableHover:k=!0,edgeOpacity:S=.5,edgeSort:E,tooltip:M,frameProps:O={}}=t,j=o||[],P=e.useMemo(()=>{if(n&&n.length>0)return n;const e=new Set;return j.forEach(t=>{const n="function"==typeof c?c(t):t[c],o="function"==typeof u?u(t):t[u];e.add(n),e.add(o)}),Array.from(e).map(e=>({id:e}))},[n,j,c,u]),N=ie(P,g,y),C=e.useMemo(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=g?te(e.data||e,g,N):"#4d430c",t},[g,N]),_=e.useMemo(()=>e=>{const t={stroke:"none",strokeWidth:0,fillOpacity:S};if("function"==typeof f)t.fill=f(e);else if("source"===f){const n="object"==typeof e.source?e.source:null;g&&n?t.fill=te(n.data||n,g,N):n&&(t.fill=C(n).fill)}else if("target"===f){const n="object"==typeof e.target?e.target:null;g&&n?t.fill=te(n.data||n,g,N):n&&(t.fill=C(n).fill)}else"gradient"===f&&(t.fill="#999",t.fillOpacity=.7*S);return t},[f,g,N,C,S]),z=e.useMemo(()=>{if(!w)return;const e=A||h;return"function"==typeof e?e:t=>t[e]},[w,A,h]),B=e.useMemo(()=>{if("function"==typeof M)return M},[M]),W=ve({componentName:"SankeyDiagram",edges:o,edgesRequired:!0});return W?p.createElement(ye,{componentName:"SankeyDiagram",message:W,width:r,height:s}):p.createElement(un,Object.assign({chartType:"sankey",nodes:P,edges:j,size:[r,s],margin:i,nodeIDAccessor:h,sourceAccessor:c,targetAccessor:u,valueAccessor:d,orientation:m,nodeAlign:v,nodePaddingRatio:b,nodeWidth:x,nodeStyle:C,edgeStyle:_,colorBy:g,colorScheme:y,edgeColorBy:f,edgeOpacity:S,edgeSort:E,nodeLabel:z,showLabels:w,enableHover:k,tooltipContent:B?e=>B(e.data):void 0,className:a,title:l},O))}function gn(t){const{data:n,width:o=600,height:r=600,margin:s={top:50,bottom:50,left:50,right:50},className:i,title:a,layout:l="tree",orientation:c="vertical",childrenAccessor:u="children",valueAccessor:d="value",nodeIdAccessor:h="name",colorBy:g,colorScheme:y="category10",colorByDepth:f=!1,edgeStyle:m="curve",nodeLabel:v,showLabels:b=!0,nodeSize:x=5,enableHover:A=!0,tooltip:w,frameProps:k={}}=t,S=e.useMemo(()=>{if(!n)return[];const e=[],t=n=>{e.push(n);const o="function"==typeof u?u(n):n[u];o&&Array.isArray(o)&&o.forEach(t)};return t(n),e},[n,u]),E=e.useMemo(()=>f?ne(S.map((e,t)=>({depth:t%5})),"depth",y):g&&"function"!=typeof g?ne(S,g,y):void 0,[S,g,f,y]),M=e.useMemo(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=f?te({depth:e.depth||0},"depth",E):g?te(e.data||e,g,E):re,t},[g,f,E]),O=e.useMemo(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),j=e.useMemo(()=>{if("treemap"===l||"circlepack"===l||"partition"===l)return"function"==typeof d?d:e=>e[d]||1},[l,d]),P=me({componentName:"TreeDiagram",data:n});return P?p.createElement(ye,{componentName:"TreeDiagram",message:P,width:o,height:r}):p.createElement(un,Object.assign({chartType:l,data:n,size:[o,r],margin:s,nodeIDAccessor:h,childrenAccessor:u,hierarchySum:j,treeOrientation:c,edgeType:m,nodeStyle:M,edgeStyle:O,colorBy:g,colorScheme:y,colorByDepth:f,nodeSize:x,nodeLabel:b?v||h:void 0,showLabels:b,enableHover:A,tooltipContent:w?e=>he(w)(e.data):void 0,className:i,title:a},k))}function yn(t){const{data:n,width:o=600,height:r=600,margin:s={top:10,bottom:10,left:10,right:10},className:i,title:a,childrenAccessor:l="children",valueAccessor:c="value",nodeIdAccessor:u="name",colorBy:d,colorScheme:h="category10",colorByDepth:g=!1,showLabels:y=!0,labelMode:f="leaf",nodeLabel:m,padding:v=4,paddingTop:b,enableHover:x=!0,tooltip:A,frameProps:w={}}=t,k=e.useMemo(()=>{if(!n)return[];const e=[],t=n=>{e.push(n);const o="function"==typeof l?l(n):n[l];o&&Array.isArray(o)&&o.forEach(t)};return t(n),e},[n,l]),S=e.useMemo(()=>{if(!g&&d&&"function"!=typeof d)return ne(k,d,h)},[k,d,g,h]),E=e.useMemo(()=>{const e=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"];return t=>{const n={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return n.fill=g?e[(t.depth||0)%e.length]:d?te(t.data||t,d,S):re,n}},[d,g,S]),M=e.useMemo(()=>"function"==typeof c?c:e=>e[c]||1,[c]),O=void 0!==b?b:y&&"parent"===f?18:void 0,j=me({componentName:"Treemap",data:n});return j?p.createElement(ye,{componentName:"Treemap",message:j,width:o,height:r}):p.createElement(un,Object.assign({chartType:"treemap",data:n,size:[o,r],margin:s,nodeIDAccessor:u,childrenAccessor:l,hierarchySum:M,padding:v,paddingTop:O,nodeStyle:E,colorBy:d,colorScheme:h,colorByDepth:g,nodeLabel:y?m||u:void 0,showLabels:y,enableHover:x,tooltipContent:A?e=>he(A)(e.data):void 0,className:i,title:a},w))}function fn(t){const{data:n,width:o=600,height:r=600,margin:s={top:10,bottom:10,left:10,right:10},className:i,title:a,childrenAccessor:l="children",valueAccessor:c="value",nodeIdAccessor:u="name",colorBy:d,colorScheme:h="category10",colorByDepth:g=!1,showLabels:y=!0,nodeLabel:f,circleOpacity:m=.7,padding:v=4,enableHover:b=!0,tooltip:x,frameProps:A={}}=t,w=e.useMemo(()=>{if(!n)return[];const e=[],t=n=>{e.push(n);const o="function"==typeof l?l(n):n[l];o&&Array.isArray(o)&&o.forEach(t)};return t(n),e},[n,l]),k=e.useMemo(()=>{if(!g&&d&&"function"!=typeof d)return ne(w,d,h)},[w,d,g,h]),S=e.useMemo(()=>{const e=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"];return t=>{const n={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:m};return n.fill=g?e[(t.depth||0)%e.length]:d?te(t.data||t,d,k):re,n}},[d,g,k,m]),E=e.useMemo(()=>"function"==typeof c?c:e=>e[c]||1,[c]),M=me({componentName:"CirclePack",data:n});return M?p.createElement(ye,{componentName:"CirclePack",message:M,width:o,height:r}):p.createElement(un,Object.assign({chartType:"circlepack",data:n,size:[o,r],margin:s,nodeIDAccessor:u,childrenAccessor:l,hierarchySum:E,padding:v,nodeStyle:S,colorBy:d,colorScheme:h,colorByDepth:g,nodeLabel:y?f||u:void 0,showLabels:y,enableHover:b,tooltipContent:x?e=>he(x)(e.data):void 0,className:i,title:a},A))}un.displayName="StreamNetworkFrame",dn.displayName="ForceDirectedGraph",hn.displayName="ChordDiagram",pn.displayName="SankeyDiagram",gn.displayName="TreeDiagram",yn.displayName="Treemap",fn.displayName="CirclePack";const mn=e.forwardRef(function(t,n){const{size:o,width:r,height:s,margin:i,className:a,arrowOfTime:l="right",windowMode:c="sliding",windowSize:u=200,data:d,timeAccessor:h,valueAccessor:g,timeExtent:y,valueExtent:f,extentPadding:m,stroke:v="#007bff",strokeWidth:b=2,strokeDasharray:x,showAxes:A=!0,background:w,enableHover:k,tooltipContent:S,tooltip:E,onHover:M,annotations:O,svgAnnotationRules:j,tickFormatTime:P,tickFormatValue:N,decay:C,pulse:_,staleness:z,transition:B,linkedHover:W}=t,L=null!=r&&null!=s?[r,s]:o||[500,300],R=null!=S?S:E,T=e.useRef(null),D=be(W),$=Ne({name:(null==D?void 0:D.name)||"hover",fields:(null==D?void 0:D.fields)||[]}),F=e.useCallback(e=>{M&&M(e),W&&$.onHover(e?e.data||e:null)},[M,W,$]);return e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=T.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=T.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=T.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=T.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}})),p.createElement(J,{ref:T,chartType:"line",runtimeMode:"streaming",size:L,margin:i,className:a,arrowOfTime:l,windowMode:c,windowSize:u,data:d,timeAccessor:h,valueAccessor:g,xExtent:y,yExtent:f,extentPadding:m,lineStyle:{stroke:v,strokeWidth:b,strokeDasharray:x},showAxes:A,background:w,hoverAnnotation:k,tooltipContent:R,customHoverBehavior:F,annotations:O,svgAnnotationRules:j,tickFormatTime:P,tickFormatValue:N,decay:C,pulse:_,staleness:z,transition:B})});mn.displayName="RealtimeLineChart";const vn=e.forwardRef(function(t,n){const{binSize:o,size:r,width:s,height:i,margin:a,className:l,arrowOfTime:c="right",windowMode:u="sliding",windowSize:d=200,data:h,timeAccessor:g,valueAccessor:y,timeExtent:f,valueExtent:m,extentPadding:v,categoryAccessor:b,colors:x,fill:A,stroke:w,strokeWidth:k,gap:S,showAxes:E=!0,background:M,enableHover:O,tooltipContent:j,tooltip:P,onHover:N,annotations:C,svgAnnotationRules:_,tickFormatTime:z,tickFormatValue:B,linkedHover:W}=t,L=null!=s&&null!=i?[s,i]:r||[500,300],R=null!=j?j:P,T=e.useRef(null),D=be(W),$=Ne({name:(null==D?void 0:D.name)||"hover",fields:(null==D?void 0:D.fields)||[]}),F=e.useCallback(e=>{N&&N(e),W&&$.onHover(e?e.data||e:null)},[N,W,$]);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=T.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=T.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=T.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=T.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const H={};return null!=A&&(H.fill=A),null!=w&&(H.stroke=w),null!=k&&(H.strokeWidth=k),null!=S&&(H.gap=S),p.createElement(J,{ref:T,chartType:"bar",runtimeMode:"streaming",size:L,margin:a,className:l,arrowOfTime:c,windowMode:u,windowSize:d,data:h,timeAccessor:g,valueAccessor:y,xExtent:f,yExtent:m,extentPadding:v,binSize:o,categoryAccessor:b,barColors:x,barStyle:H,showAxes:E,background:M,hoverAnnotation:O,tooltipContent:R,customHoverBehavior:F,annotations:C,svgAnnotationRules:_,tickFormatTime:z,tickFormatValue:B})});vn.displayName="RealtimeTemporalHistogram";const bn=vn,xn=e.forwardRef(function(t,n){const{size:o,width:r,height:s,margin:i,className:a,arrowOfTime:l="right",windowMode:c="sliding",windowSize:u=200,data:d,timeAccessor:h,valueAccessor:g,timeExtent:y,valueExtent:f,extentPadding:m,categoryAccessor:v,colors:b,radius:x,fill:A,opacity:w,stroke:k,strokeWidth:S,showAxes:E=!0,background:M,enableHover:O,tooltipContent:j,tooltip:P,onHover:N,annotations:C,svgAnnotationRules:_,tickFormatTime:z,tickFormatValue:B,linkedHover:W}=t,L=null!=r&&null!=s?[r,s]:o||[500,300],R=null!=j?j:P,T=e.useRef(null),D=be(W),$=Ne({name:(null==D?void 0:D.name)||"hover",fields:(null==D?void 0:D.fields)||[]}),F=e.useCallback(e=>{N&&N(e),W&&$.onHover(e?e.data||e:null)},[N,W,$]);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=T.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=T.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=T.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=T.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const H={};return null!=x&&(H.radius=x),null!=A&&(H.fill=A),null!=w&&(H.opacity=w),null!=k&&(H.stroke=k),null!=S&&(H.strokeWidth=S),p.createElement(J,{ref:T,chartType:"swarm",runtimeMode:"streaming",size:L,margin:i,className:a,arrowOfTime:l,windowMode:c,windowSize:u,data:d,timeAccessor:h,valueAccessor:g,xExtent:y,yExtent:f,extentPadding:m,categoryAccessor:v,barColors:b,swarmStyle:H,showAxes:E,background:M,hoverAnnotation:O,tooltipContent:R,customHoverBehavior:F,annotations:C,svgAnnotationRules:_,tickFormatTime:z,tickFormatValue:B})});xn.displayName="RealtimeSwarmChart";const An=e.forwardRef(function(t,n){const{size:o,width:r,height:s,margin:i,className:a,arrowOfTime:l="right",windowMode:c="sliding",windowSize:u=200,data:d,timeAccessor:h,valueAccessor:g,timeExtent:y,valueExtent:f,extentPadding:m,positiveColor:v,negativeColor:b,connectorStroke:x,connectorWidth:A,gap:w,stroke:k,strokeWidth:S,showAxes:E=!0,background:M,enableHover:O,tooltipContent:j,tooltip:P,onHover:N,annotations:C,svgAnnotationRules:_,tickFormatTime:z,tickFormatValue:B,linkedHover:W}=t,L=null!=r&&null!=s?[r,s]:o||[500,300],R=null!=j?j:P,T=e.useRef(null),D=be(W),$=Ne({name:(null==D?void 0:D.name)||"hover",fields:(null==D?void 0:D.fields)||[]}),F=e.useCallback(e=>{N&&N(e),W&&$.onHover(e?e.data||e:null)},[N,W,$]);e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=T.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=T.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=T.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=T.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const H={};return null!=v&&(H.positiveColor=v),null!=b&&(H.negativeColor=b),null!=x&&(H.connectorStroke=x),null!=A&&(H.connectorWidth=A),null!=w&&(H.gap=w),null!=k&&(H.stroke=k),null!=S&&(H.strokeWidth=S),p.createElement(J,{ref:T,chartType:"waterfall",runtimeMode:"streaming",size:L,margin:i,className:a,arrowOfTime:l,windowMode:c,windowSize:u,data:d,timeAccessor:h,valueAccessor:g,xExtent:y,yExtent:f,extentPadding:m,waterfallStyle:H,showAxes:E,background:M,hoverAnnotation:O,tooltipContent:R,customHoverBehavior:F,annotations:C,svgAnnotationRules:_,tickFormatTime:z,tickFormatValue:B})});An.displayName="RealtimeWaterfallChart";const wn=e.forwardRef(function(t,n){const{size:o,width:r,height:s,margin:i,className:a,arrowOfTime:l="right",windowMode:c="sliding",windowSize:u=200,data:d,timeAccessor:h,valueAccessor:g,categoryAccessor:y,timeExtent:f,valueExtent:m,extentPadding:v,heatmapXBins:b=20,heatmapYBins:x=20,aggregation:A="count",showAxes:w=!0,background:k,enableHover:S,tooltipContent:E,tooltip:M,onHover:O,annotations:j,svgAnnotationRules:P,tickFormatTime:N,tickFormatValue:C,decay:_,pulse:z,staleness:B}=t,W=null!=r&&null!=s?[r,s]:o||[500,300],L=null!=E?E:M,R=e.useRef(null);return e.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=R.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=R.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=R.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=R.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}})),p.createElement(J,{ref:R,chartType:"heatmap",runtimeMode:"streaming",size:W,margin:i,className:a,arrowOfTime:l,windowMode:c,windowSize:u,data:d,timeAccessor:h,valueAccessor:g,categoryAccessor:y,xExtent:f,yExtent:m,extentPadding:v,heatmapXBins:b,heatmapYBins:x,heatmapAggregation:A,showAxes:w,background:k,hoverAnnotation:S,tooltipContent:L,customHoverBehavior:O,annotations:j,svgAnnotationRules:P,tickFormatTime:N,tickFormatValue:C,decay:_,pulse:z,staleness:B})});wn.displayName="RealtimeHeatmap";let[kn]=we(e=>({tooltip:null,changeTooltip(t){e(()=>({tooltip:t}))}}));const Sn={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},En={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},[Mn,On]=we(e=>({theme:Sn,setTheme(t){e(e=>"light"===t?{theme:Sn}:"dark"===t?{theme:En}:{theme:Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})})})}}));function jn({theme:e}){const t=On(e=>e.setTheme);return p.useEffect(()=>{void 0!==e&&t(e)},[e,t]),null}function Pn({children:e}){const t=On(e=>e.theme);return p.createElement("div",{style:{position:"relative","--semiotic-bg":t.colors.background,"--semiotic-text":t.colors.text,"--semiotic-text-secondary":t.colors.textSecondary,"--semiotic-grid":t.colors.grid,"--semiotic-border":t.colors.border,"--semiotic-primary":t.colors.primary,"--semiotic-font-family":t.typography.fontFamily}},e)}function Nn(e,t){var n;const o=e.children,r=t.children,s=window.getComputedStyle(e),i=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of i){const o=s.getPropertyValue(e);o&&"none"!==o&&""!==o&&(null===(n=t.style)||void 0===n||n.setProperty(e,o))}for(let e=0;Math.min(o.length,r.length)>e;e++)Nn(o[e],r[e])}function Cn(e,t){const n=URL.createObjectURL(e),o=document.createElement("a");o.href=n,o.download=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}"function"==typeof SuppressedError&&SuppressedError;const _n={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["function","object"]},frameProps:{type:"object"}},zn={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Bn={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"}},Wn=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],Ln=["vertical","horizontal"],Rn={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},_n),zn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Wn},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},_n),zn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Wn},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},_n),zn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Wn},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},normalize:{type:"boolean"}})},Scatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},_n),zn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},_n),zn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_n),zn),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"]},showValues:{type:"boolean"},valueFormat:{type:"function"},cellBorderColor:{type:"string"},cellBorderWidth:{type:"number"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_n),Bn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ln},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_n),Bn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ln},normalize:{type:"boolean"},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_n),Bn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ln},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_n),Bn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ln},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_n),Bn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ln},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_n),Bn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_n),Bn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ln},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},_n),Bn),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:Ln},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},_n),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},_n),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},_n),{nodes:{type:"array"},edges:{type:"array"},nodeIDAccessor:{type:["string","function"]},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},nodeLabel:{type:["string","function"]},nodeSize:{type:["number","string","function"]},nodeSizeRange:{type:"array"},edgeWidth:{type:["number","string","function"]},edgeColor:{type:"string"},edgeOpacity:{type:"number"},iterations:{type:"number"},forceStrength:{type:"number"},showLabels:{type:"boolean"}})},SankeyDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},_n),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:Ln},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},_n),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target"]},padAngle:{type:"number"},groupWidth:{type:"number"},sortGroups:{type:"function"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"}})},TreeDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},_n),{data:{type:"object"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"]},orientation:{type:"string",enum:["vertical","horizontal","radial"]},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},edgeStyle:{type:"string",enum:["line","curve"]},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},nodeSize:{type:"number"}})},Treemap:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},_n),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},_n),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}}};function Tn(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}exports.AreaChart=ze,exports.BarChart=pt,exports.BoxPlot=mt,exports.BubbleChart=Le,exports.ChordDiagram=hn,exports.CirclePack=fn,exports.DonutChart=wt,exports.DotPlot=xt,exports.ForceDirectedGraph=dn,exports.GroupedBarChart=yt,exports.Heatmap=Re,exports.Histogram=vt,exports.LineChart=_e,exports.LinkedCharts=De,exports.MultiLineTooltip=function(e={}){const{fields:t=[],title:n,format:o,style:r={},className:s="",showLabels:i=!0,separator:a=": "}=e;return e=>{if(!e||"object"!=typeof e)return null;const l=[];if(n){const t=ue(e,n);l.push({value:de(t,o)})}t&&Array.isArray(t)&&t.length>0?t.forEach(t=>{let n,r,s;"string"==typeof t?(n=t,r=t,s=o):(n=t.label,r=t.accessor||t.key||"",s=t.format||o);const a=de(ue(e,r),s);l.push({label:i?n:void 0,value:a})}):Object.keys(e).filter(e=>!e.startsWith("_")&&"data"!==e).forEach(t=>{l.push({label:i?t:void 0,value:de(e[t],o)})});const c=Object.assign(Object.assign({},ce),r);return Array.isArray(l)&&0!==l.length?p.createElement("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+s).trim(),style:c},l.map((e,t)=>p.createElement("div",{key:t,style:{marginBottom:l.length-1>t?"4px":0}},e.label&&p.createElement("strong",null,e.label,a),e.value))):null}},exports.PieChart=At,exports.RealtimeHeatmap=wn,exports.RealtimeHistogram=bn,exports.RealtimeLineChart=mn,exports.RealtimeSwarmChart=xn,exports.RealtimeWaterfallChart=An,exports.SankeyDiagram=pn,exports.Scatterplot=We,exports.ScatterplotMatrix=Ge,exports.StackedAreaChart=Be,exports.StackedBarChart=gt,exports.SwarmPlot=ft,exports.ThemeProvider=function({theme:e,children:t}){return p.createElement(Mn,null,p.createElement(jn,{theme:e}),p.createElement(Pn,null,t))},exports.TooltipProvider=kn,exports.TreeDiagram=gn,exports.Treemap=yn,exports.ViolinPlot=bt,exports.exportChart=function(e,t){return n=this,o=void 0,s=function*(){const{format:n="svg",filename:o="chart",scale:r=2,background:s="white"}=t||{},i=e.querySelector("svg");if(!i)throw Error("No SVG element found in the container");const a=i.cloneNode(!0),l=i.getBoundingClientRect();if(a.getAttribute("width")||a.setAttribute("width",l.width+""),a.getAttribute("height")||a.setAttribute("height",l.height+""),a.getAttribute("xmlns")||a.setAttribute("xmlns","http://www.w3.org/2000/svg"),Nn(i,a),"svg"===n){const e=(new XMLSerializer).serializeToString(a);Cn(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),o+".svg")}else{const e=l.width*r,t=l.height*r,n=(new XMLSerializer).serializeToString(a),i=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),c=URL.createObjectURL(i),u=new Image;u.width=l.width,u.height=l.height,yield new Promise((n,i)=>{u.onload=()=>{const a=document.createElement("canvas");a.width=e,a.height=t;const l=a.getContext("2d");l.fillStyle=s,l.fillRect(0,0,e,t),l.scale(r,r),l.drawImage(u,0,0),a.toBlob(e=>{e?(Cn(e,o+".png"),n()):i(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(c)},u.onerror=()=>{URL.revokeObjectURL(c),i(Error("Failed to load SVG image"))},u.src=c})}},new((r=void 0)||(r=Promise))(function(e,t){function i(e){try{l(s.next(e))}catch(e){t(e)}}function a(e){try{l(s.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r(function(e){e(n)})).then(i,a)}l((s=s.apply(n,o||[])).next())});var n,o,r,s},exports.useBrushSelection=Ce,exports.useFilteredData=function(t,n,o){const r=je(e=>e.selections.get(n));return e.useMemo(()=>{if(!r||0===r.clauses.size)return t;const e=Ee(r,o);return t.filter(e)},[t,r,o])},exports.useLinkedHover=Ne,exports.useSelection=Pe,exports.useTheme=function(){return On(e=>e.theme)},exports.validateProps=function(e,t){const n=[],o=Rn[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(Rn).join(", ")}`]};for(const r of o.required)null==t[r]&&n.push(`"${r}" is required for ${e}.`);for(const[e,r]of Object.entries(t)){if(null==r)continue;const t=o.props[e];if(t){if(!Tn(r,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(r)?"array":typeof r}.`);continue}t.enum&&"string"==typeof r&&!t.enum.includes(r)&&n.push(`"${e}" value "${r}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const r=new Set(Object.keys(o.props));for(const o of Object.keys(t))void 0!==t[o]&&(r.has(o)||n.push(`Unknown prop "${o}" for ${e}. Check for typos.`));if("array"===o.dataShape){const r=t.data,s={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(s[e]=n)}const i=fe({componentName:e,data:r,accessors:Object.keys(s).length>0?s:void 0});i&&n.push(i)}else if("object"===o.dataShape){const o=me({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=ve({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});r&&n.push(r)}return{valid:0===n.length,errors:n}};