semiotic 3.0.0-beta.2 → 3.0.0-beta.4

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 (342) hide show
  1. package/CLAUDE.md +93 -753
  2. package/README.md +92 -7
  3. package/ai/dist/componentRegistry.js +26 -0
  4. package/ai/dist/{ai/mcp-server.js → mcp-server.js} +1 -1
  5. package/ai/dist/{ai/renderHOCToSVG.js → renderHOCToSVG.js} +2 -2
  6. package/dist/ChartContainer.d.ts +60 -0
  7. package/dist/DetailsPanel.d.ts +37 -0
  8. package/dist/LinkedCharts.d.ts +2 -0
  9. package/dist/Tooltip/Tooltip.d.ts +2 -2
  10. package/dist/charts/index.d.ts +1 -1
  11. package/dist/charts/ordinal/BarChart.d.ts +1 -0
  12. package/dist/charts/ordinal/BoxPlot.d.ts +1 -0
  13. package/dist/charts/ordinal/DonutChart.d.ts +1 -0
  14. package/dist/charts/ordinal/DotPlot.d.ts +1 -0
  15. package/dist/charts/ordinal/GroupedBarChart.d.ts +1 -0
  16. package/dist/charts/ordinal/Histogram.d.ts +1 -0
  17. package/dist/charts/ordinal/PieChart.d.ts +1 -0
  18. package/dist/charts/ordinal/RidgelinePlot.d.ts +1 -0
  19. package/dist/charts/ordinal/StackedBarChart.d.ts +1 -0
  20. package/dist/charts/ordinal/SwarmPlot.d.ts +1 -0
  21. package/dist/charts/ordinal/ViolinPlot.d.ts +1 -0
  22. package/dist/charts/realtime/RealtimeHeatmap.d.ts +11 -0
  23. package/dist/charts/realtime/RealtimeHistogram.d.ts +15 -1
  24. package/dist/charts/realtime/RealtimeLineChart.d.ts +6 -0
  25. package/dist/charts/realtime/RealtimeSwarmChart.d.ts +6 -0
  26. package/dist/charts/realtime/RealtimeWaterfallChart.d.ts +6 -0
  27. package/dist/charts/shared/annotationRules.d.ts +3 -0
  28. package/dist/charts/shared/colorUtils.d.ts +17 -11
  29. package/dist/charts/shared/hooks.d.ts +96 -1
  30. package/dist/charts/shared/loess.d.ts +13 -0
  31. package/dist/charts/shared/networkUtils.d.ts +31 -0
  32. package/dist/charts/shared/tooltipUtils.d.ts +16 -0
  33. package/dist/charts/shared/types.d.ts +17 -2
  34. package/dist/charts/shared/validateChartData.d.ts +2 -3
  35. package/dist/charts/shared/validateProps.d.ts +18 -0
  36. package/dist/charts/xy/AreaChart.d.ts +4 -0
  37. package/dist/charts/xy/BubbleChart.d.ts +6 -0
  38. package/dist/charts/xy/Heatmap.d.ts +4 -0
  39. package/dist/charts/xy/LineChart.d.ts +6 -0
  40. package/dist/charts/xy/Scatterplot.d.ts +4 -0
  41. package/dist/charts/xy/StackedAreaChart.d.ts +4 -0
  42. package/dist/data/fromVegaLite.d.ts +48 -0
  43. package/dist/export/chartConfig.d.ts +29 -0
  44. package/dist/export/selectionSerializer.d.ts +20 -0
  45. package/dist/geometry/sankeyLinks.d.ts +1 -1
  46. package/dist/network.min.js +1 -1
  47. package/dist/network.module.min.js +1 -1
  48. package/dist/ordinal.min.js +1 -1
  49. package/dist/ordinal.module.min.js +1 -1
  50. package/dist/realtime/types.d.ts +20 -6
  51. package/dist/realtime.min.js +1 -1
  52. package/dist/realtime.module.min.js +1 -1
  53. package/dist/semiotic-ai.d.ts +14 -0
  54. package/dist/semiotic-ai.min.js +1 -1
  55. package/dist/semiotic-ai.module.min.js +1 -1
  56. package/dist/semiotic-data.d.ts +2 -0
  57. package/dist/semiotic-data.min.js +1 -1
  58. package/dist/semiotic-data.module.min.js +1 -1
  59. package/dist/semiotic-network.d.ts +9 -19
  60. package/dist/semiotic-ordinal.d.ts +12 -14
  61. package/dist/semiotic-xy.d.ts +12 -18
  62. package/dist/semiotic.d.ts +16 -13
  63. package/dist/semiotic.min.js +1 -1
  64. package/dist/semiotic.module.min.js +1 -1
  65. package/dist/server.min.js +1 -1
  66. package/dist/server.module.min.js +1 -1
  67. package/dist/store/ObservationStore.d.ts +61 -0
  68. package/dist/store/SelectionStore.d.ts +9 -1
  69. package/dist/store/ThemeStore.d.ts +6 -1
  70. package/dist/store/TooltipStore.d.ts +3 -1
  71. package/dist/store/createStore.d.ts +4 -1
  72. package/dist/store/useObservation.d.ts +18 -0
  73. package/dist/stream/MarginalGraphics.d.ts +1 -1
  74. package/dist/stream/NetworkPipelineStore.d.ts +44 -0
  75. package/dist/stream/OrdinalCanvasHitTester.d.ts +1 -0
  76. package/dist/stream/OrdinalSVGOverlay.d.ts +6 -2
  77. package/dist/stream/ParticlePool.d.ts +2 -1
  78. package/dist/stream/PipelineStore.d.ts +11 -0
  79. package/dist/stream/SVGOverlay.d.ts +21 -2
  80. package/dist/stream/SceneGraph.d.ts +1 -1
  81. package/dist/stream/networkTypes.d.ts +58 -1
  82. package/dist/stream/ordinalTypes.d.ts +13 -0
  83. package/dist/stream/types.d.ts +14 -0
  84. package/dist/types/annotationTypes.d.ts +10 -0
  85. package/dist/types/networkTypes.d.ts +1 -2
  86. package/dist/xy.min.js +1 -1
  87. package/dist/xy.module.min.js +1 -1
  88. package/package.json +30 -42
  89. package/ai/dist/ai/componentRegistry.js +0 -45
  90. package/ai/dist/src/components/Annotation.js +0 -358
  91. package/ai/dist/src/components/AnnotationLayer/AnnotationLayer.js +0 -369
  92. package/ai/dist/src/components/Axis/Axis.js +0 -374
  93. package/ai/dist/src/components/Axis/axisTitle.js +0 -14
  94. package/ai/dist/src/components/Axis/index.js +0 -7
  95. package/ai/dist/src/components/Axis/summaryGraphic.js +0 -37
  96. package/ai/dist/src/components/Brush.js +0 -84
  97. package/ai/dist/src/components/ChartErrorBoundary.js +0 -91
  98. package/ai/dist/src/components/DividedLine.js +0 -65
  99. package/ai/dist/src/components/Legend.js +0 -140
  100. package/ai/dist/src/components/LinkedCharts.js +0 -95
  101. package/ai/dist/src/components/ThemeProvider.js +0 -79
  102. package/ai/dist/src/components/Tooltip/Tooltip.js +0 -309
  103. package/ai/dist/src/components/TooltipPositioner/index.js +0 -132
  104. package/ai/dist/src/components/annotationLayerBehavior/annotationHandling.js +0 -73
  105. package/ai/dist/src/components/annotationLayerBehavior/d3labeler.js +0 -254
  106. package/ai/dist/src/components/annotationRules/baseRules.js +0 -150
  107. package/ai/dist/src/components/annotationRules/networkframeRules.js +0 -196
  108. package/ai/dist/src/components/annotationRules/xyframeRules.js +0 -297
  109. package/ai/dist/src/components/batchWork.js +0 -35
  110. package/ai/dist/src/components/charts/index.js +0 -109
  111. package/ai/dist/src/components/charts/network/ChordDiagram.js +0 -142
  112. package/ai/dist/src/components/charts/network/CirclePack.js +0 -108
  113. package/ai/dist/src/components/charts/network/ForceDirectedGraph.js +0 -121
  114. package/ai/dist/src/components/charts/network/SankeyDiagram.js +0 -155
  115. package/ai/dist/src/components/charts/network/TreeDiagram.js +0 -110
  116. package/ai/dist/src/components/charts/network/Treemap.js +0 -106
  117. package/ai/dist/src/components/charts/ordinal/BarChart.js +0 -156
  118. package/ai/dist/src/components/charts/ordinal/BoxPlot.js +0 -139
  119. package/ai/dist/src/components/charts/ordinal/DonutChart.js +0 -130
  120. package/ai/dist/src/components/charts/ordinal/DotPlot.js +0 -126
  121. package/ai/dist/src/components/charts/ordinal/GroupedBarChart.js +0 -129
  122. package/ai/dist/src/components/charts/ordinal/Histogram.js +0 -132
  123. package/ai/dist/src/components/charts/ordinal/PieChart.js +0 -128
  124. package/ai/dist/src/components/charts/ordinal/RidgelinePlot.js +0 -130
  125. package/ai/dist/src/components/charts/ordinal/StackedBarChart.js +0 -130
  126. package/ai/dist/src/components/charts/ordinal/SwarmPlot.js +0 -147
  127. package/ai/dist/src/components/charts/ordinal/ViolinPlot.js +0 -138
  128. package/ai/dist/src/components/charts/realtime/RealtimeHeatmap.js +0 -79
  129. package/ai/dist/src/components/charts/realtime/RealtimeHistogram.js +0 -114
  130. package/ai/dist/src/components/charts/realtime/RealtimeLineChart.js +0 -93
  131. package/ai/dist/src/components/charts/realtime/RealtimeSwarmChart.js +0 -105
  132. package/ai/dist/src/components/charts/realtime/RealtimeWaterfallChart.js +0 -106
  133. package/ai/dist/src/components/charts/shared/ChartError.js +0 -72
  134. package/ai/dist/src/components/charts/shared/colorUtils.js +0 -138
  135. package/ai/dist/src/components/charts/shared/formatUtils.js +0 -213
  136. package/ai/dist/src/components/charts/shared/hooks.js +0 -49
  137. package/ai/dist/src/components/charts/shared/legendUtils.js +0 -57
  138. package/ai/dist/src/components/charts/shared/selectionUtils.js +0 -67
  139. package/ai/dist/src/components/charts/shared/tooltipUtils.js +0 -79
  140. package/ai/dist/src/components/charts/shared/types.js +0 -2
  141. package/ai/dist/src/components/charts/shared/validateChartData.js +0 -82
  142. package/ai/dist/src/components/charts/shared/validateProps.js +0 -736
  143. package/ai/dist/src/components/charts/xy/AreaChart.js +0 -230
  144. package/ai/dist/src/components/charts/xy/BubbleChart.js +0 -251
  145. package/ai/dist/src/components/charts/xy/Heatmap.js +0 -235
  146. package/ai/dist/src/components/charts/xy/LineChart.js +0 -307
  147. package/ai/dist/src/components/charts/xy/MinimapChart.js +0 -298
  148. package/ai/dist/src/components/charts/xy/Scatterplot.js +0 -172
  149. package/ai/dist/src/components/charts/xy/ScatterplotMatrix.js +0 -426
  150. package/ai/dist/src/components/charts/xy/StackedAreaChart.js +0 -231
  151. package/ai/dist/src/components/constants/coordinateNames.js +0 -11
  152. package/ai/dist/src/components/constants/frame_props.js +0 -251
  153. package/ai/dist/src/components/data/dataFunctions.js +0 -487
  154. package/ai/dist/src/components/data/multiAccessorUtils.js +0 -14
  155. package/ai/dist/src/components/data/transforms.js +0 -143
  156. package/ai/dist/src/components/data/unflowedFunctions.js +0 -5
  157. package/ai/dist/src/components/export/exportChart.js +0 -121
  158. package/ai/dist/src/components/generic_utilities/functions.js +0 -5
  159. package/ai/dist/src/components/geometry/areaDrawing.js +0 -312
  160. package/ai/dist/src/components/geometry/contourLayout.js +0 -73
  161. package/ai/dist/src/components/geometry/hexbinLayout.js +0 -163
  162. package/ai/dist/src/components/geometry/lineDrawing.js +0 -356
  163. package/ai/dist/src/components/geometry/sankeyLinks.js +0 -331
  164. package/ai/dist/src/components/geometry/summaryLayouts.js +0 -136
  165. package/ai/dist/src/components/index.js +0 -18
  166. package/ai/dist/src/components/processing/InteractionItems.js +0 -223
  167. package/ai/dist/src/components/processing/hierarchyUtils.js +0 -104
  168. package/ai/dist/src/components/processing/layouts/chordLayout.js +0 -58
  169. package/ai/dist/src/components/processing/layouts/forceLayout.js +0 -142
  170. package/ai/dist/src/components/processing/layouts/hierarchyLayout.js +0 -31
  171. package/ai/dist/src/components/processing/layouts/index.js +0 -32
  172. package/ai/dist/src/components/processing/layouts/sankeyLayout.js +0 -96
  173. package/ai/dist/src/components/processing/layouts/simpleLayouts.js +0 -34
  174. package/ai/dist/src/components/processing/layouts/types.js +0 -2
  175. package/ai/dist/src/components/processing/networkDefaults.js +0 -39
  176. package/ai/dist/src/components/realtime/BinAccumulator.js +0 -36
  177. package/ai/dist/src/components/realtime/IncrementalExtent.js +0 -55
  178. package/ai/dist/src/components/realtime/RingBuffer.js +0 -104
  179. package/ai/dist/src/components/realtime/renderers/barRenderer.js +0 -133
  180. package/ai/dist/src/components/realtime/renderers/candlestickRenderer.js +0 -7
  181. package/ai/dist/src/components/realtime/renderers/lineRenderer.js +0 -164
  182. package/ai/dist/src/components/realtime/renderers/swarmRenderer.js +0 -91
  183. package/ai/dist/src/components/realtime/renderers/types.js +0 -2
  184. package/ai/dist/src/components/realtime/renderers/waterfallRenderer.js +0 -163
  185. package/ai/dist/src/components/realtime/types.js +0 -2
  186. package/ai/dist/src/components/semiotic-ai.js +0 -89
  187. package/ai/dist/src/components/semiotic-data.js +0 -12
  188. package/ai/dist/src/components/semiotic-network.js +0 -38
  189. package/ai/dist/src/components/semiotic-ordinal.js +0 -28
  190. package/ai/dist/src/components/semiotic-realtime.js +0 -30
  191. package/ai/dist/src/components/semiotic-server.js +0 -8
  192. package/ai/dist/src/components/semiotic-xy.js +0 -35
  193. package/ai/dist/src/components/semiotic.js +0 -109
  194. package/ai/dist/src/components/server/renderToStaticSVG.js +0 -594
  195. package/ai/dist/src/components/store/SelectionStore.js +0 -91
  196. package/ai/dist/src/components/store/ThemeStore.js +0 -78
  197. package/ai/dist/src/components/store/TooltipStore.js +0 -13
  198. package/ai/dist/src/components/store/createStore.js +0 -81
  199. package/ai/dist/src/components/store/useSelection.js +0 -133
  200. package/ai/dist/src/components/stream/CanvasHitTester.js +0 -164
  201. package/ai/dist/src/components/stream/DataSourceAdapter.js +0 -99
  202. package/ai/dist/src/components/stream/MarginalGraphics.js +0 -266
  203. package/ai/dist/src/components/stream/NetworkCanvasHitTester.js +0 -228
  204. package/ai/dist/src/components/stream/NetworkPipelineStore.js +0 -498
  205. package/ai/dist/src/components/stream/NetworkSVGOverlay.js +0 -70
  206. package/ai/dist/src/components/stream/NetworkSceneGraph.js +0 -38
  207. package/ai/dist/src/components/stream/OrdinalCanvasHitTester.js +0 -146
  208. package/ai/dist/src/components/stream/OrdinalPipelineStore.js +0 -786
  209. package/ai/dist/src/components/stream/OrdinalSVGOverlay.js +0 -130
  210. package/ai/dist/src/components/stream/ParticlePool.js +0 -174
  211. package/ai/dist/src/components/stream/PipelineStore.js +0 -1243
  212. package/ai/dist/src/components/stream/SVGOverlay.js +0 -129
  213. package/ai/dist/src/components/stream/SceneGraph.js +0 -132
  214. package/ai/dist/src/components/stream/StreamNetworkFrame.js +0 -561
  215. package/ai/dist/src/components/stream/StreamOrdinalFrame.js +0 -492
  216. package/ai/dist/src/components/stream/StreamXYFrame.js +0 -590
  217. package/ai/dist/src/components/stream/accessorUtils.js +0 -20
  218. package/ai/dist/src/components/stream/index.js +0 -32
  219. package/ai/dist/src/components/stream/layouts/chordLayoutPlugin.js +0 -352
  220. package/ai/dist/src/components/stream/layouts/forceLayoutPlugin.js +0 -230
  221. package/ai/dist/src/components/stream/layouts/hierarchyLayoutPlugin.js +0 -568
  222. package/ai/dist/src/components/stream/layouts/index.js +0 -28
  223. package/ai/dist/src/components/stream/layouts/sankeyLayoutPlugin.js +0 -245
  224. package/ai/dist/src/components/stream/networkTypes.js +0 -17
  225. package/ai/dist/src/components/stream/ordinalSceneBuilders/barScene.js +0 -126
  226. package/ai/dist/src/components/stream/ordinalSceneBuilders/connectorScene.js +0 -62
  227. package/ai/dist/src/components/stream/ordinalSceneBuilders/pieScene.js +0 -33
  228. package/ai/dist/src/components/stream/ordinalSceneBuilders/pointScene.js +0 -63
  229. package/ai/dist/src/components/stream/ordinalSceneBuilders/statisticalScene.js +0 -278
  230. package/ai/dist/src/components/stream/ordinalSceneBuilders/timelineScene.js +0 -30
  231. package/ai/dist/src/components/stream/ordinalSceneBuilders/types.js +0 -2
  232. package/ai/dist/src/components/stream/ordinalTypes.js +0 -2
  233. package/ai/dist/src/components/stream/renderers/areaCanvasRenderer.js +0 -48
  234. package/ai/dist/src/components/stream/renderers/barCanvasRenderer.js +0 -70
  235. package/ai/dist/src/components/stream/renderers/boxplotCanvasRenderer.js +0 -75
  236. package/ai/dist/src/components/stream/renderers/candlestickCanvasRenderer.js +0 -28
  237. package/ai/dist/src/components/stream/renderers/connectorCanvasRenderer.js +0 -47
  238. package/ai/dist/src/components/stream/renderers/heatmapCanvasRenderer.js +0 -31
  239. package/ai/dist/src/components/stream/renderers/lineCanvasRenderer.js +0 -140
  240. package/ai/dist/src/components/stream/renderers/networkArcRenderer.js +0 -38
  241. package/ai/dist/src/components/stream/renderers/networkCircleRenderer.js +0 -37
  242. package/ai/dist/src/components/stream/renderers/networkEdgeRenderer.js +0 -102
  243. package/ai/dist/src/components/stream/renderers/networkParticleRenderer.js +0 -63
  244. package/ai/dist/src/components/stream/renderers/networkRectRenderer.js +0 -35
  245. package/ai/dist/src/components/stream/renderers/pointCanvasRenderer.js +0 -38
  246. package/ai/dist/src/components/stream/renderers/swarmCanvasRenderer.js +0 -10
  247. package/ai/dist/src/components/stream/renderers/types.js +0 -2
  248. package/ai/dist/src/components/stream/renderers/violinCanvasRenderer.js +0 -47
  249. package/ai/dist/src/components/stream/renderers/waterfallCanvasRenderer.js +0 -38
  250. package/ai/dist/src/components/stream/renderers/wedgeCanvasRenderer.js +0 -33
  251. package/ai/dist/src/components/stream/types.js +0 -2
  252. package/ai/dist/src/components/types/annotationTypes.js +0 -2
  253. package/ai/dist/src/components/types/canvasTypes.js +0 -2
  254. package/ai/dist/src/components/types/generalTypes.js +0 -2
  255. package/ai/dist/src/components/types/interactionTypes.js +0 -2
  256. package/ai/dist/src/components/types/legendTypes.js +0 -2
  257. package/ai/dist/src/components/types/networkTypes.js +0 -2
  258. package/ai/dist/src/components/types/ordinalTypes.js +0 -2
  259. package/ai/dist/src/components/types/xyTypes.js +0 -2
  260. package/ai/dist/src/components/useBoundingRect.js +0 -24
  261. package/ai/dist/src/components/visualizationLayerBehavior/axis.js +0 -301
  262. package/ai/dist/src/components/visualizationLayerBehavior/general.js +0 -435
  263. package/ai/dist/src/setupTests.js +0 -4
  264. package/dist/AnnotationLayer/AnnotationLayer.d.ts +0 -25
  265. package/dist/Axis/Axis.d.ts +0 -7
  266. package/dist/Axis/axisTitle.d.ts +0 -10
  267. package/dist/Axis/index.d.ts +0 -2
  268. package/dist/Axis/summaryGraphic.d.ts +0 -17
  269. package/dist/Brush.d.ts +0 -12
  270. package/dist/DividedLine.d.ts +0 -16
  271. package/dist/TooltipPositioner/index.d.ts +0 -7
  272. package/dist/annotationLayerBehavior/annotationHandling.d.ts +0 -19
  273. package/dist/annotationLayerBehavior/d3labeler.d.ts +0 -9
  274. package/dist/annotationRules/baseRules.d.ts +0 -25
  275. package/dist/annotationRules/networkframeRules.d.ts +0 -48
  276. package/dist/annotationRules/xyframeRules.d.ts +0 -117
  277. package/dist/batchWork.d.ts +0 -6
  278. package/dist/constants/coordinateNames.d.ts +0 -8
  279. package/dist/constants/frame_props.d.ts +0 -13
  280. package/dist/data/dataFunctions.d.ts +0 -45
  281. package/dist/data/multiAccessorUtils.d.ts +0 -1
  282. package/dist/data/unflowedFunctions.d.ts +0 -1
  283. package/dist/generic_utilities/functions.d.ts +0 -1
  284. package/dist/geometry/areaDrawing.d.ts +0 -21
  285. package/dist/geometry/contourLayout.d.ts +0 -6
  286. package/dist/geometry/hexbinLayout.d.ts +0 -7
  287. package/dist/geometry/lineDrawing.d.ts +0 -71
  288. package/dist/geometry/summaryLayouts.d.ts +0 -45
  289. package/dist/index.d.ts +0 -1
  290. package/dist/network.js +0 -7495
  291. package/dist/network.js.map +0 -1
  292. package/dist/network.module.js +0 -7458
  293. package/dist/network.module.js.map +0 -1
  294. package/dist/ordinal.js +0 -6497
  295. package/dist/ordinal.js.map +0 -1
  296. package/dist/ordinal.module.js +0 -6465
  297. package/dist/ordinal.module.js.map +0 -1
  298. package/dist/processing/InteractionItems.d.ts +0 -13
  299. package/dist/processing/hierarchyUtils.d.ts +0 -16
  300. package/dist/processing/layouts/chordLayout.d.ts +0 -2
  301. package/dist/processing/layouts/forceLayout.d.ts +0 -3
  302. package/dist/processing/layouts/hierarchyLayout.d.ts +0 -10
  303. package/dist/processing/layouts/index.d.ts +0 -8
  304. package/dist/processing/layouts/sankeyLayout.d.ts +0 -8
  305. package/dist/processing/layouts/simpleLayouts.d.ts +0 -7
  306. package/dist/processing/layouts/types.d.ts +0 -17
  307. package/dist/processing/networkDefaults.d.ts +0 -36
  308. package/dist/realtime/renderers/barRenderer.d.ts +0 -2
  309. package/dist/realtime/renderers/candlestickRenderer.d.ts +0 -2
  310. package/dist/realtime/renderers/lineRenderer.d.ts +0 -2
  311. package/dist/realtime/renderers/swarmRenderer.d.ts +0 -2
  312. package/dist/realtime.js +0 -7072
  313. package/dist/realtime.js.map +0 -1
  314. package/dist/realtime.module.js +0 -7043
  315. package/dist/realtime.module.js.map +0 -1
  316. package/dist/semiotic-ai.js +0 -13323
  317. package/dist/semiotic-ai.js.map +0 -1
  318. package/dist/semiotic-ai.module.js +0 -13264
  319. package/dist/semiotic-ai.module.js.map +0 -1
  320. package/dist/semiotic-data.js +0 -141
  321. package/dist/semiotic-data.js.map +0 -1
  322. package/dist/semiotic-data.module.js +0 -136
  323. package/dist/semiotic-data.module.js.map +0 -1
  324. package/dist/semiotic.js +0 -16351
  325. package/dist/semiotic.js.map +0 -1
  326. package/dist/semiotic.module.js +0 -16265
  327. package/dist/semiotic.module.js.map +0 -1
  328. package/dist/server.js +0 -5191
  329. package/dist/server.js.map +0 -1
  330. package/dist/server.module.js +0 -5166
  331. package/dist/server.module.js.map +0 -1
  332. package/dist/stream/NetworkSceneGraph.d.ts +0 -14
  333. package/dist/stream/index.d.ts +0 -16
  334. package/dist/types/canvasTypes.d.ts +0 -9
  335. package/dist/types/xyTypes.d.ts +0 -24
  336. package/dist/useBoundingRect.d.ts +0 -2
  337. package/dist/visualizationLayerBehavior/axis.d.ts +0 -36
  338. package/dist/visualizationLayerBehavior/general.d.ts +0 -80
  339. package/dist/xy.js +0 -6993
  340. package/dist/xy.js.map +0 -1
  341. package/dist/xy.module.js +0 -6957
  342. package/dist/xy.module.js.map +0 -1
@@ -1 +1 @@
1
- import*as t from"react";import e,{forwardRef as n,useMemo as o,useRef as r,useState as a,useCallback as i,useEffect as s,useImperativeHandle as l,createContext as c,useContext as d,useLayoutEffect as u}from"react";import{interpolateNumber as y}from"d3-interpolate";import{sankeyCircular as h,sankeyJustify as p,sankeyCenter as f,sankeyRight as g,sankeyLeft as m}from"d3-sankey-circular";import{schemeCategory10 as x,interpolatePlasma as v,interpolateViridis as b,interpolatePurples as k,interpolateOranges as E,interpolateGreens as A,interpolateReds as M,interpolateBlues as $,schemeSet3 as w,schemeTableau10 as S}from"d3-scale-chromatic";import{line as P,curveLinearClosed as D,arc as j,curveCardinal as N}from"d3-shape";import{forceLink as O,forceSimulation as W,forceManyBody as C,forceX as _,forceY as L}from"d3-force";import{scaleLinear as z,scaleOrdinal as F}from"d3-scale";import{min as T,max as B,sum as I}from"d3-array";import{ribbon as R,chord as Y}from"d3-chord";import{hierarchy as X,partition as G,pack as V,treemap as H,treemapBinary as q,cluster as K,tree as Z}from"d3-hierarchy";import J from"labella";import Q from"regression";import{contourDensity as U}from"d3-contour";import{hexbin as tt}from"d3-hexbin";const et={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},nt={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class ot{constructor(t){this.capacity=t,this.particles=Array(t);for(let e=0;t>e;e++)this.particles[e]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0}}spawn(t){for(let e=0;this.capacity>e;e++){const n=this.particles[e];if(!n.active)return n.active=!0,n.t=0,n.offset=Math.random()-.5,n.edgeIndex=t,n.x=0,n.y=0,n}return null}step(t,e,n){for(let o=0;this.capacity>o;o++){const r=this.particles[o];if(!r.active)continue;const a=n[r.edgeIndex];if(!a||!a.bezier){r.active=!1;continue}if(r.t+=t*e,r.t>=1){r.active=!1;continue}const i=rt(a.bezier,r.t,r.offset);r.x=i.x,r.y=i.y}}countForEdge(t){let e=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].edgeIndex===t&&e++;return e}clear(){for(let t=0;this.capacity>t;t++)this.particles[t].active=!1}resize(t){if(this.capacity>=t)return;const e=this.particles;this.particles=Array(t);for(let n=0;t>n;n++)this.particles[n]=e.length>n?e[n]:{t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0};this.capacity=t}}function rt(t,e,n){if(t.circular&&t.segments)return function(t,e,n,o){const r=t.length,a=e*r,i=Math.min(Math.floor(a),r-1),s=a-i,[l,c,d,u]=t[i],y=at(l,c,d,u,s),h=u.x-l.x,p=u.y-l.y,f=Math.sqrt(h*h+p*p);if(f>.001){const t=h/f;y.x+=-p/f*n*o*2,y.y+=t*n*o*2}return y}(t.segments,e,n,t.halfWidth);if(!t.points)return{x:0,y:0};const[o,r,a,i]=t.points,s=at(o,r,a,i,e),l=i.x-o.x,c=i.y-o.y,d=Math.sqrt(l*l+c*c);if(d>.001){const e=l/d;s.x+=-c/d*n*t.halfWidth*2,s.y+=e*n*t.halfWidth*2}return s}function at(t,e,n,o,r){const a=1-r,i=a*a,s=i*a,l=r*r,c=l*r;return{x:s*t.x+3*i*r*e.x+3*a*l*n.x+c*o.x,y:s*t.y+3*i*r*e.y+3*a*l*n.y+c*o.y}}const it=(t=1)=>(e,n)=>{const o=e[e.length-1];return o&&Math.round(o.x/t)===Math.round(n.x/t)&&Math.round(o.y/t)===Math.round(n.y/t)||e.push(n),e},st=t=>{let e,n,o,r,a,i,s,l,c;return"down"===t.direction?(e=t.y0-t.sankeyWidth/2,n=t.y1-t.sankeyWidth/2,o=t.y1+t.sankeyWidth/2,r=t.y0+t.sankeyWidth/2,a=t.source.y1,i=t.target.y0,s=y(a,i),l=s(.5),c=s(.5),`M${e},${a}C${e},${l} ${n},${c} ${n},${i}L${o},${i}C${o},${c} ${r},${l} ${r},${a}Z`):(e=t.source.x1,n=t.target.x0,s=y(e,n),o=s(.5),r=s(.5),a=t.y0-t.sankeyWidth/2,i=t.y1-t.sankeyWidth/2,l=t.y1+t.sankeyWidth/2,c=t.y0+t.sankeyWidth/2,`M${e},${a}C${o},${a} ${r},${i} ${n},${i}L${n},${l}C${r},${l} ${o},${c} ${e},${c}Z`)};function lt(t){const e=function(){const t=P();let e=function(t){return t.x},n=function(t){return t.y},o=function(t){return t.r},r=D;function a(a){if(a.multiple){const i=o,l=a.multiple.reduce((t,e)=>t+e.weight,0);o=()=>l;let c=s(a.points).filter(t=>"forward"===t.direction).reduce(it(),[]);const d=[];return a.multiple.forEach((t,e)=>{o=()=>t.weight;const n=s(c);d.push(n);const r=a.multiple[e+1];if(r){const t=n.reverse().filter(t=>"back"===t.direction).reduce(it(),[]);o=()=>r.weight;const e=s(t);c=e.reverse().filter(t=>"back"===t.direction).reduce(it(),[])}}),o=i,d.map(o=>t.x(e).y(n).curve(r)(o))}const i=s(a).reduce(it(),[]);return t.x(e).y(n).curve(r)(i)}return a.x=function(t){return arguments.length?(e=t,a):e},a.y=function(t){return arguments.length?(n=t,a):n},a.r=function(t){return arguments.length?(o=t,a):o},a.interpolate=function(t){return arguments.length?(r=t,a):r},a;function i(t){const r=n(t.target)-n(t.source),a=e(t.target)-e(t.source),i=Math.atan2(a,r)+Math.PI/2,s=i+.5*Math.PI,l=i+.5*Math.PI;return{x1:e(t.source)+o(t.source)*Math.cos(s),y1:n(t.source)-o(t.source)*Math.sin(s),x2:e(t.target)+o(t.target)*Math.cos(l),y2:n(t.target)-o(t.target)*Math.sin(l)}}function s(t){const e=[];let n=0,o={x1:0,y1:0,x2:0,y2:0};for(;t.length>n;){if(n!==t.length-1&&(o=i({source:t[n],target:t[n+1]}),e.push({x:o.x1,y:o.y1,direction:"forward"},{x:o.x2,y:o.y2,direction:"forward"}),e.length>3)){const t=e.length-1,n={a:e[t-3],b:e[t-2]},o={a:e[t-1],b:e[t]},r=l(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:t[n],target:t[n-1]}),e.push({x:o.x1,y:o.y1,direction:"back"},{x:o.x2,y:o.y2,direction:"back"}),e.length>3)){const t=e.length-1,n={a:e[t-3],b:e[t-2]},o={a:e[t-1],b:e[t]},r=l(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 e}function l(t,e,n,o,r,a,i,s){let l,c;const d={x:null,y:null,found:!1},u=(s-a)*(n-t)-(i-r)*(o-e);if(0===u)return d;l=e-a,c=t-r;const y=(n-t)*l-(o-e)*c;return l=((i-r)*l-(s-a)*c)/u,c=y/u,d.x=t+l*(n-t),d.y=e+l*(o-e),l>0&&1>l&&c>0&&1>c&&(d.found=!0),d}}();return e.x(t=>t.x),e.y(t=>t.y),e.r(()=>t.sankeyWidth/2),e("down"===t.direction?[{x:t.circularPathData.sourceY,y:t.circularPathData.sourceX},{x:t.circularPathData.sourceY,y:t.circularPathData.leftFullExtent},{x:t.circularPathData.verticalFullExtent,y:t.circularPathData.leftFullExtent},{x:t.circularPathData.verticalFullExtent,y:t.circularPathData.rightFullExtent},{x:t.circularPathData.targetY,y:t.circularPathData.rightFullExtent},{x:t.circularPathData.targetY,y:t.circularPathData.targetX}]:[{x:t.circularPathData.sourceX,y:t.circularPathData.sourceY},{x:t.circularPathData.leftFullExtent,y:t.circularPathData.sourceY},{x:t.circularPathData.leftFullExtent,y:t.circularPathData.verticalFullExtent},{x:t.circularPathData.rightFullExtent,y:t.circularPathData.verticalFullExtent},{x:t.circularPathData.rightFullExtent,y:t.circularPathData.targetY},{x:t.circularPathData.targetX,y:t.circularPathData.targetY}])}const ct={left:m,right:g,center:f,justify:p},dt={supportsStreaming:!0,hierarchical:!1,computeLayout(t,e,n,o){var r,a,i,s;if(0===t.length)return;const l="vertical"===n.orientation?"down":"right",c=n.nodeAlign||"justify",d=null!==(r=n.nodeWidth)&&void 0!==r?r:15,u=null!==(a=n.nodePaddingRatio)&&void 0!==a?a:.05,y=null!==(i=n.iterations)&&void 0!==i?i:100,f=t.map(t=>Object.assign({},t)),g=e.map(t=>Object.assign(Object.assign({},t),{source:"string"==typeof t.source?t.source:t.source.id,target:"string"==typeof t.target?t.target:t.target.id}));let m;m="down"===l?[[0,0],[o[1],o[0]]]:[[0,0],[o[0],o[1]]];const x=h().extent(m).links(g).nodes(f).nodeAlign(ct[c]||p).nodeId(t=>t.id).nodeWidth(d).iterations(y);x.nodePaddingRatio&&x.nodePaddingRatio(u),x();for(const e of f){const n=t.find(t=>t.id===e.id);n&&(n.x0=e.x0,n.x1=e.x1,n.y0=e.y0,n.y1=e.y1,n.value=e.value,n.depth=e.depth,n.sourceLinks=e.sourceLinks,n.targetLinks=e.targetLinks,n.width=e.x1-e.x0,n.height=e.y1-e.y0,n.x=e.x0+(e.x1-e.x0)/2,n.y=e.y0+(e.y1-e.y0)/2)}for(const n of g){const o=n.source,r=n.target,a="object"==typeof o&&null!==o?o.id:o+"",i="object"==typeof r&&null!==r?r.id:r+"",c=e.find(t=>("string"==typeof t.source?t.source:t.source.id)===a&&("string"==typeof t.target?t.target:t.target.id)===i);if(c){c.y0=n.y0,c.y1=n.y1,c.sankeyWidth=null!==(s=n.width)&&void 0!==s?s:0,c.circular=!!n.circular,c.circularPathData=n.circularPathData,c.direction=l;const e=t.find(t=>t.id===a),o=t.find(t=>t.id===i);e&&(c.source=e),o&&(c.target=o)}}},buildScene(t,e,n,o){var r,a;const i="vertical"===n.orientation?"down":"right",s=n.nodeStyle,l=n.edgeStyle,c=null!==(r=n.edgeOpacity)&&void 0!==r?r:.5,d=n.edgeColorBy||"source",u=Array.isArray(n.colorScheme)?n.colorScheme:x,y=new Map;t.forEach((t,e)=>{y.set(t.id,u[e%u.length])});const h=[],p=[],f=[];for(const e of t){const t=e.x1-e.x0,n=e.y1-e.y0;if(0>=t||0>=n)continue;const o=s?s(e):{},r={fill:o.fill||y.get(e.id)||"#4d430c",stroke:o.stroke,strokeWidth:o.strokeWidth,opacity:o.opacity};h.push({type:"rect",x:e.x0,y:e.y0,w:t,h:n,style:r,datum:e,id:e.id,label:e.id})}const g=[...e].sort((t,e)=>(e.sankeyWidth||0)-(t.sankeyWidth||0));for(const t of g){if(!t.sankeyWidth||0>=t.sankeyWidth)continue;const e="object"==typeof t.source?t.source:null,n="object"==typeof t.target?t.target:null;if(!e||!n)continue;let o;o=t.circular&&t.circularPathData?lt(t):st(t);let r="#999";l?r=l(t).fill||r:"target"===d&&n?r=y.get(n.id)||r:e&&(r=y.get(e.id)||r);const i=l?l(t):{},s={fill:r,fillOpacity:null!==(a=i.fillOpacity)&&void 0!==a?a:c,stroke:i.stroke||"none",strokeWidth:i.strokeWidth,opacity:i.opacity};p.push({type:"bezier",pathD:o,bezierCache:t.bezier,style:s,datum:t})}if(!1!==n.showLabels){const e=(m=n.nodeLabel)?"function"==typeof m?m:t=>t[m]||t.id:null;for(const n of t){const t=n.x1-n.x0,r=n.y1-n.y0;if(0>=t||0>=r)continue;const a=e?e(n):n.id;if(!a)continue;let s,l,c;"down"===i?(s=n.x0+t/2,l=n.y1+14,c="middle"):(o[0]/2>n.x0+t/2?(s=n.x0-6,c="end"):(s=n.x1+6,c="start"),l=n.y0+r/2),f.push({x:s,y:l,text:a+"",anchor:c,baseline:"middle",fontSize:11})}}var m;return{sceneNodes:h,sceneEdges:p,labels:f}}},ut={supportsStreaming:!1,hierarchical:!1,computeLayout(t,e,n,o){var r,a;if(0===t.length)return;const i=null!==(r=n.iterations)&&void 0!==r?r:Math.max(50,Math.min(300,Math.floor(300-2*(t.length-30)))),s=null!==(a=n.forceStrength)&&void 0!==a?a:.1,l=o[0]/2,c=o[1]/2;for(let e=0;t.length>e;e++){const n=t[e];if(null==n.x||null==n.y||0===n.x&&0===n.y){const t=10*Math.sqrt(e+.5),o=2.399963229728653*e;n.x=l+t*Math.cos(o),n.y=c+t*Math.sin(o)}}const d=ht(n.nodeSize,n.nodeSizeRange,t),u=O().strength(t=>Math.min(2.5,t.weight?t.weight*s:s)).id(t=>t.id),y=o[1]/o[0],h=W().force("charge",C().strength(t=>-25*(t=>d(t))(t))).force("x",_(o[0]/2).strength(.1*y)).force("y",L(o[1]/2).strength(.1));if(h.nodes(t),e.length>0){const t=e.map(t=>Object.assign(Object.assign({},t),{source:"string"==typeof t.source?t.source:t.source.id,target:"string"==typeof t.target?t.target:t.target.id}));h.force("link",u),h.force("link").links(t)}.1>h.alpha()&&h.alpha(1),h.stop();for(let t=0;i>t;++t)h.tick();for(const n of e){if("string"==typeof n.source){const e=t.find(t=>t.id===n.source);e&&(n.source=e)}if("string"==typeof n.target){const e=t.find(t=>t.id===n.target);e&&(n.target=e)}}},buildScene(t,e,n,o){var r,a,i;const s=n.nodeStyle,l=n.edgeStyle,c=ht(n.nodeSize,n.nodeSizeRange,t),d=Array.isArray(n.colorScheme)?n.colorScheme:x,u=new Map;t.forEach((t,e)=>{u.set(t.id,d[e%d.length])});const y=[],h=[],p=[];for(const e of t){if(null==e.x||null==e.y)continue;const t=c(e),n=s?s(e):{},o={fill:n.fill||u.get(e.id)||"#007bff",stroke:n.stroke||"#fff",strokeWidth:null!==(r=n.strokeWidth)&&void 0!==r?r:2,opacity:n.opacity};y.push({type:"circle",cx:e.x,cy:e.y,r:t,style:o,datum:e,id:e.id,label:e.id})}for(const n of e){const e="object"==typeof n.source?n.source:yt(t,n.source),o="object"==typeof n.target?n.target:yt(t,n.target);if(!e||!o)continue;if(null==e.x||null==e.y)continue;if(null==o.x||null==o.y)continue;const r=l?l(n):{},s={stroke:r.stroke||"#999",strokeWidth:null!==(a=r.strokeWidth)&&void 0!==a?a:1,opacity:null!==(i=r.opacity)&&void 0!==i?i:.6};h.push({type:"line",x1:e.x,y1:e.y,x2:o.x,y2:o.y,style:s,datum:n})}if(!1!==n.showLabels){const e=(f=n.nodeLabel)?"function"==typeof f?f:t=>t[f]||t.id:null;for(const n of t){if(null==n.x||null==n.y)continue;const t=e?e(n):n.id;if(!t)continue;const o=c(n);p.push({x:n.x,y:n.y-o-4,text:t+"",anchor:"middle",baseline:"auto",fontSize:11})}}var f;return{sceneNodes:y,sceneEdges:h,labels:p}}};function yt(t,e){return t.find(t=>t.id===e)}function ht(t,e,n){var o,r;if(null==t)return()=>8;if("number"==typeof t)return()=>t;if("function"==typeof t)return e=>t(e)||8;const a=e||[5,20],i=n.map(e=>{var n;return null===(n=e.data)||void 0===n?void 0:n[t]}).filter(t=>null!=t&&"number"==typeof t);if(0===i.length)return()=>a[0];const s=null!==(o=T(i))&&void 0!==o?o:0,l=null!==(r=B(i))&&void 0!==r?r:1;if(s===l)return()=>(a[0]+a[1])/2;const c=z().domain([s,l]).range(a).clamp(!0);return e=>{var n;const o=null===(n=e.data)||void 0===n?void 0:n[t];return null==o||"number"!=typeof o?a[0]:c(o)}}const pt=x,ft={supportsStreaming:!1,hierarchical:!1,computeLayout(t,e,n,o){if(0===t.length)return;const{padAngle:r=.01,groupWidth:a=20,sortGroups:i}=n,s=Math.min(o[0],o[1])/2,l=s-a,c=o[0]/2,d=o[1]/2,u=(y=n.valueAccessor)?"function"==typeof y?y:t=>{var e;return null!==(e=t[y])&&void 0!==e?e:1}:t=>{var e;return null!==(e=t.value)&&void 0!==e?e:1};var y;const h=new Map;for(let e=0;t.length>e;e++)h.set(t[e].id,e);const p=t.length,f=Array.from({length:p},()=>Array.from({length:p},()=>0));for(const t of e){const e="string"==typeof t.target?t.target:t.target.id,n=h.get("string"==typeof t.source?t.source:t.source.id),o=h.get(e);if(void 0===n||void 0===o)continue;const r=u(t);f[n][o]=r}const g=Y().padAngle(r);i&&g.sortGroups(i);const m=g(f),x=m.groups,v=j().innerRadius(l).outerRadius(s);for(const e of x){const n=t[e.index],o=v.centroid(e);n.x=o[0]+c,n.y=o[1]+d,n.arcData={startAngle:e.startAngle,endAngle:e.endAngle}}for(const n of e){const e="string"==typeof n.source?n.source:n.source.id,o="string"==typeof n.target?n.target:n.target.id,r=t.find(t=>t.id===e),a=t.find(t=>t.id===o);r&&(n.source=r),a&&(n.target=a)}for(const n of m){const o=t[n.source.index].id,r=t[n.target.index].id,a=e.find(t=>{const e="string"==typeof t.source?t.source:t.source.id,n="string"==typeof t.target?t.target:t.target.id;return e===o&&n===r||e===r&&n===o});a&&(a.chordData=n)}},buildScene(t,e,n,o){var r,a;const{groupWidth:i=20,edgeOpacity:s=.5}=n,l=Math.min(o[0],o[1])/2,c=l-i,d=o[0]/2,u=o[1]/2,y=n.nodeStyle,h=n.edgeStyle,p=n.edgeColorBy||"source",f=Array.isArray(n.colorScheme)?n.colorScheme:pt,g=new Map;t.forEach((t,e)=>{g.set(t.id,f[e%f.length])});const m=R().radius(c),x=[],v=[],b=[];for(let e=0;t.length>e;e++){const n=t[e],o=n.arcData;if(!o)continue;let a;a=y?y(n).fill||g.get(n.id)||f[e%f.length]:g.get(n.id)||f[e%f.length];const i=y?y(n):{},s={fill:a,stroke:i.stroke||"black",strokeWidth:null!==(r=i.strokeWidth)&&void 0!==r?r:1,opacity:i.opacity};x.push({type:"arc",cx:d,cy:u,innerR:c,outerR:l,startAngle:o.startAngle-Math.PI/2,endAngle:o.endAngle-Math.PI/2,style:s,datum:n,id:n.id,label:n.id})}for(const t of e){const e=t.chordData;if(!e)continue;const n=m({source:Object.assign(Object.assign({},e.source),{startAngle:e.source.startAngle-Math.PI/2,endAngle:e.source.endAngle-Math.PI/2}),target:Object.assign(Object.assign({},e.target),{startAngle:e.target.startAngle-Math.PI/2,endAngle:e.target.endAngle-Math.PI/2})});if(!n)continue;const o=gt(n,d,u);let r="#999";if(h)r=h(t).fill||r;else{const e="object"==typeof t.source?t.source:null,n="object"==typeof t.target?t.target:null;"target"===p&&n?r=g.get(n.id)||r:e&&(r=g.get(e.id)||r)}const i=h?h(t):{},l={fill:r,fillOpacity:null!==(a=i.fillOpacity)&&void 0!==a?a:s,stroke:i.stroke||"none",strokeWidth:i.strokeWidth,opacity:i.opacity};v.push({type:"ribbon",pathD:o,style:l,datum:t})}if(!1!==n.showLabels){const e=(k=n.nodeLabel)?"function"==typeof k?k:t=>t[k]||t.id:null,o=l+12;for(const n of t){const t=n.arcData;if(!t)continue;const r=e?e(n):n.id;if(!r)continue;const a=(t.startAngle+t.endAngle)/2,i=a-Math.PI/2;b.push({x:d+Math.cos(i)*o,y:u+Math.sin(i)*o,text:r+"",anchor:a>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var k;return{sceneNodes:x,sceneEdges:v,labels:b}}};function gt(t,e,n){const o=t.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!o)return t;const r=[];let a=0;for(;o.length>a;){const t=o[a];if("M"===t||"L"===t)for(r.push(t),a++;o.length>a&&!isNaN(Number(o[a]));)r.push(Number(o[a])+e+""),a++,o.length>a&&!isNaN(Number(o[a]))&&(r.push(Number(o[a])+n+""),a++);else if("C"===t)for(r.push(t),a++;o.length>a&&!isNaN(Number(o[a]));)for(let t=0;3>t&&o.length>a&&!isNaN(Number(o[a]));t++)r.push(Number(o[a])+e+""),a++,o.length>a&&!isNaN(Number(o[a]))&&(r.push(Number(o[a])+n+""),a++);else if("Q"===t)for(r.push(t),a++;o.length>a&&!isNaN(Number(o[a]));)for(let t=0;2>t&&o.length>a&&!isNaN(Number(o[a]));t++)r.push(Number(o[a])+e+""),a++,o.length>a&&!isNaN(Number(o[a]))&&(r.push(Number(o[a])+n+""),a++);else if("A"===t)for(r.push(t),a++;o.length>a&&!isNaN(Number(o[a]));)r.push(o[a++]),o.length>a&&r.push(o[a++]),o.length>a&&r.push(o[a++]),o.length>a&&r.push(o[a++]),o.length>a&&r.push(o[a++]),o.length>a&&(r.push(Number(o[a])+e+""),a++),o.length>a&&(r.push(Number(o[a])+n+""),a++);else"Z"===t||"z"===t?(r.push(t),a++):(r.push(o[a]),a++)}return r.join(" ")}const mt={supportsStreaming:!1,hierarchical:!0,computeLayout(t,e,n,o){var r;const a=n.__hierarchyRoot;if(!a)return;const i=n.chartType,s=(l=n.childrenAccessor)?"function"==typeof l?l:t=>t[l]:void 0;var l;const c=n.hierarchySum||(t=>{var e;return null!==(e=t.value)&&void 0!==e?e:0}),d=X(a,s);d.sum(c),d.sort((t,e)=>{var n,o;return(null!==(n=e.value)&&void 0!==n?n:0)-(null!==(o=t.value)&&void 0!==o?o:0)});const[u,y]=o;switch(i){case"tree":!function(t,e,n,o){const r=e.treeOrientation||"vertical",a=Z();a.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),a(t)}(d,n,u,y);break;case"cluster":!function(t,e,n,o){const r=e.treeOrientation||"vertical",a=K();a.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),a(t)}(d,n,u,y);break;case"treemap":!function(t,e,n,o){var r,a;const i=null!==(r=e.padding)&&void 0!==r?r:4,s=null!==(a=e.paddingTop)&&void 0!==a?a:0,l=H().size([n,o]).tile(q).padding(i);s>0&&l.paddingTop(s),l(t)}(d,n,u,y);break;case"circlepack":!function(t,e,n,o){var r;const a=null!==(r=e.padding)&&void 0!==r?r:4;V().size([n,o]).padding(a)(t)}(d,n,u,y);break;case"partition":!function(t,e,n,o){var r;G().size([n,o]).padding(null!==(r=e.padding)&&void 0!==r?r:1)(t)}(d,n,u,y)}const h=d.descendants();t.length=0,e.length=0;const p=new Map;for(let e=0;h.length>e;e++){const o=h[e],a={id:Et(o,n,e),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?xt(a,o,n):"treemap"===i||"partition"===i?vt(a,o):"circlepack"===i&&bt(a,o),a.__hierarchyNode=o,t.push(a),p.set(o,a)}if("tree"===i||"cluster"===i)for(const t of h)if(t.parent){const n=p.get(t.parent),o=p.get(t);n&&o&&e.push({source:n,target:o,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:t.depth}})}},buildScene(t,e,n,o){const r=n.nodeStyle||(()=>({})),a=n.edgeStyle||(()=>({}));switch(n.chartType){case"tree":case"cluster":return function(t,e,n,o,r,a){var i,s,l,c,d;const u=[],y=[],h=[],p=n.treeOrientation||"vertical",f="radial"===p,g=o[0]/2,m=o[1]/2,x="number"==typeof(v=n.nodeSize)?v:5;var v;for(const e of t){let t=e.x,n=e.y;f&&(t+=g,n+=m);const o=r(e),a={fill:o.fill||"#4d430c",stroke:o.stroke||"#fff",strokeWidth:null!==(i=o.strokeWidth)&&void 0!==i?i:1,opacity:o.opacity};u.push({type:"circle",cx:t,cy:n,r:x,style:a,datum:e,id:e.id,label:e.id,depth:e.depth})}const b=null!==(s=n.edgeOpacity)&&void 0!==s?s:.5;for(const t of e){const e="object"==typeof t.source?t.source:null,n="object"==typeof t.target?t.target:null;if(!e||!n)continue;let o=e.x,r=e.y,i=n.x,s=n.y;f&&(o+=g,r+=m,i+=g,s+=m);const d=kt(o,r,i,s,p),u=a(t),h={fill:"none",stroke:u.stroke||"#999",strokeWidth:null!==(l=u.strokeWidth)&&void 0!==l?l:1.5,opacity:null!==(c=u.opacity)&&void 0!==c?c:b};y.push({type:"curved",pathD:d,style:h,datum:t})}if(!1!==n.showLabels){const e=At(n.nodeLabel);for(const n of t){const t=e?e(n):n.id;if(!t)continue;let o,r,a,i=n.x,s=n.y;if(f&&(i+=g,s+=m),f){const t=i-g,e=s-m,n=Math.sqrt(t*t+e*e);n>0?(o=i+t/n*10,r=s+e/n*10,a=0>t?"end":"start"):(o=i,r=s-12,a="middle")}else"horizontal"===p?((null===(d=n.data)||void 0===d?void 0:d.children)&&0!==n.data.children.length?(o=i-x-6,a="end"):(o=i+x+6,a="start"),r=s):(o=i,r=s+x+14,a="middle");h.push({x:o,y:r,text:t+"",anchor:a,baseline:"middle",fontSize:11})}}return{sceneNodes:u,sceneEdges:y,labels:h}}(t,e,n,o,r,a);case"treemap":case"partition":return function(t,e,n,o){var r,a;const i=[],s=[],l=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];for(const n of t){const t=n.x1-n.x0,a=n.y1-n.y0;if(0>=t||0>=a)continue;const s=o(n);let c=s.fill||"#4d430c";e.colorByDepth&&void 0!==n.depth&&(c=l[n.depth%l.length]);const d={fill:c,stroke:s.stroke||"#fff",strokeWidth:null!==(r=s.strokeWidth)&&void 0!==r?r:1,opacity:s.opacity};i.push({type:"rect",x:n.x0,y:n.y0,w:t,h:a,style:d,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==e.showLabels){const n=At(e.nodeLabel);for(const o of t){const t=o.x1-o.x0,r=o.y1-o.y0;if(0>=t||0>=r)continue;if((null===(a=o.data)||void 0===a?void 0:a.children)&&o.data.children.length>0&&"partition"!==e.chartType)continue;const i=n?n(o):o.id;i&&(30>t||16>r||s.push({x:o.x0+t/2,y:o.y0+r/2,text:i+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(t,r)/6))}))}}return{sceneNodes:i,sceneEdges:[],labels:s}}(t,n,0,r);case"circlepack":return function(t,e,n,o){var r,a,i,s,l;const c=[],d=[],u=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];for(const n of t){const t=null!==(r=n.__radius)&&void 0!==r?r:5;if(0>=t)continue;const s=o(n);let l=s.fill||"#4d430c";e.colorByDepth&&void 0!==n.depth&&(l=u[n.depth%u.length]);const d={fill:l,stroke:s.stroke||"#fff",strokeWidth:null!==(a=s.strokeWidth)&&void 0!==a?a:1,opacity:null!==(i=s.opacity)&&void 0!==i?i:.7};c.push({type:"circle",cx:n.x,cy:n.y,r:t,style:d,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==e.showLabels){const n=At(e.nodeLabel);for(const e of t){const t=null!==(s=e.__radius)&&void 0!==s?s:5,o=n?n(e):e.id;if(!o)continue;if(15>t)continue;const r=!((null===(l=e.data)||void 0===l?void 0:l.children)&&e.data.children.length>0);d.push({x:e.x,y:r?e.y:e.y-t+14,text:o+"",anchor:"middle",baseline:r?"middle":"hanging",fontSize:Math.min(11,Math.max(8,t/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:d}}(t,n,0,r);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function xt(t,e,n){const o=n.treeOrientation||"vertical";if("radial"===o){const n=e.x,o=e.y;t.x=o*Math.cos(n-Math.PI/2),t.y=o*Math.sin(n-Math.PI/2)}else"horizontal"===o?(t.x=e.y,t.y=e.x):(t.x=e.x,t.y=e.y);t.x0=t.x-5,t.x1=t.x+5,t.y0=t.y-5,t.y1=t.y+5,t.width=10,t.height=10}function vt(t,e){t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.x=(e.x0+e.x1)/2,t.y=(e.y0+e.y1)/2,t.width=e.x1-e.x0,t.height=e.y1-e.y0}function bt(t,e){var n;const o=null!==(n=e.r)&&void 0!==n?n:0;t.x=e.x,t.y=e.y,t.x0=e.x-o,t.x1=e.x+o,t.y0=e.y-o,t.y1=e.y+o,t.width=2*o,t.height=2*o,t.__radius=o}function kt(t,e,n,o,r){if("horizontal"===r){const r=(t+n)/2;return`M ${t},${e} C ${r},${e} ${r},${o} ${n},${o}`}if("radial"===r){const r=(t+n)/2;return`M ${t},${e} Q ${r},${e} ${r},${(e+o)/2} T ${n},${o}`}{const r=(e+o)/2;return`M ${t},${e} C ${t},${r} ${n},${r} ${n},${o}`}}function Et(t,e,n){const o=e.nodeIDAccessor;return"function"==typeof o?o(t.data)+"":"string"==typeof o&&void 0!==t.data[o]?t.data[o]+"":void 0!==t.data.name?t.data.name+"":void 0!==t.data.id?t.data.id+"":"node-"+n}function At(t){return t?"function"==typeof t?t:e=>{var n;return(null===(n=e.data)||void 0===n?void 0:n[t])||e[t]||e.id}:null}const Mt={sankey:dt,force:ut,chord:ft,tree:mt,cluster:mt,treemap:mt,circlepack:mt,partition:mt};function $t(t){return Mt[t]}class wt{constructor(t){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=t,this.tensionConfig=Object.assign(Object.assign({},et),t.tensionConfig),"sankey"===t.chartType&&t.showParticles&&(this.particlePool=new ot(2e3))}updateConfig(t){this.config=t,this.tensionConfig=Object.assign(Object.assign({},et),t.tensionConfig),"sankey"===t.chartType&&t.showParticles?this.particlePool||(this.particlePool=new ot(2e3)):this.particlePool=null}ingestHierarchy(t,e){this.nodes.clear(),this.edges.clear(),this.config.__hierarchyRoot=t,this.runLayout(e)}ingestBounded(t,e,n){const{nodeIDAccessor:o="id",sourceAccessor:r="source",targetAccessor:a="target",valueAccessor:i="value"}=this.config,s="function"==typeof o?o:t=>t[o],l="function"==typeof r?r:t=>t[r],c="function"==typeof a?a:t=>t[a],d="function"==typeof i?i:t=>{var e;return null!==(e=t[i])&&void 0!==e?e:1};this.nodes.clear(),this.edges.clear();for(const e of t){const t=s(e)+"";this.nodes.set(t,Object.assign(Object.assign({},St(t)),{data:e}))}for(const t of e){const e=l(t)+"",n=c(t)+"",o=Number(d(t))||1;this.nodes.has(e)||this.nodes.set(e,Object.assign(Object.assign({},St(e)),{data:t})),this.nodes.has(n)||this.nodes.set(n,Object.assign(Object.assign({},St(n)),{data:t})),this.edges.set(`${e}\0${n}`,{source:e,target:n,value:o,y0:0,y1:0,sankeyWidth:0,data:t})}this.runLayout(n)}edgeKey(t,e){return`${t}\0${e}`}ingestEdge(t){const{source:e,target:n,value:o}=t,r=0===this.nodes.size;let a=!1;this.nodes.has(e)||(this.nodes.set(e,St(e)),this.tension+=this.tensionConfig.newNode,a=!0),this.nodes.has(n)||(this.nodes.set(n,St(n)),this.tension+=this.tensionConfig.newNode,a=!0);const i=this.edgeKey(e,n),s=this.edges.get(i);return s?(s.value+=o,this.tension+=this.tensionConfig.weightChange):(this.edges.set(i,{source:e,target:n,value:o,y0:0,y1:0,sankeyWidth:0}),this.tension+=this.tensionConfig.newEdge,a=!0),r||a||this.tension>=this.tensionConfig.threshold}runLayout(t){const e=$t(this.config.chartType);if(!e)return;let n=Array.from(this.nodes.values()),o=Array.from(this.edges.values());if(0!==n.length||e.hierarchical){if(this.prepareForRelayout(),e.computeLayout(n,o,this.config,t),e.hierarchical&&n.length>0){this.nodes.clear(),this.edges.clear();for(const t of n)this.nodes.set(t.id,t);for(const t of o)this.edges.set(`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}`,t)}this.finalizeLayout(),this.saveTargetPositions(),n.some(t=>void 0!==t._prevX0&&(0!==t._prevX0||0!==t._prevX1||0!==t._prevY0||0!==t._prevY1))&&this.tensionConfig.transitionDuration>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:this.tensionConfig.transitionDuration}),this.layoutVersion++}}buildScene(t){const e=$t(this.config.chartType);if(!e)return;const n=Array.from(this.nodes.values()),o=Array.from(this.edges.values()),{sceneNodes:r,sceneEdges:a,labels:i}=e.buildScene(n,o,this.config,t);this.sceneNodes=r,this.sceneEdges=a,this.labels=i}advanceTransition(t){if(!this.transition)return!1;const e=Math.min((t-this.transition.startTime)/this.transition.duration,1),n=1-Math.pow(1-e,3);for(const t of this.nodes.values())void 0===t._targetX0||void 0===t._prevX0||0===t._prevX0&&0===t._prevX1||(t.x0=t._prevX0+(t._targetX0-t._prevX0)*n,t.x1=t._prevX1+(t._targetX1-t._prevX1)*n,t.y0=t._prevY0+(t._targetY0-t._prevY0)*n,t.y1=t._prevY1+(t._targetY1-t._prevY1)*n);for(const t of this.edges.values())void 0!==t._targetY0&&void 0!==t._prevY0&&void 0!==t._prevSankeyWidth&&t._prevSankeyWidth>0&&(t.y0=t._prevY0+(t._targetY0-t._prevY0)*n,t.y1=t._prevY1+(t._targetY1-t._prevY1)*n,t.sankeyWidth=t._prevSankeyWidth+(t._targetSankeyWidth-t._prevSankeyWidth)*n);return this.rebuildAllBeziers(),1>e||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){for(const t of this.nodes.values())t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1;for(const t of this.edges.values())t._prevY0=t.y0,t._prevY1=t.y1,t._prevSankeyWidth=t.sankeyWidth}finalizeLayout(){const t="vertical"===this.config.orientation?"down":"right";for(const t of this.nodes.values())if(0!==t.x0||0!==t.x1||0!==t.y0||0!==t.y1)t.width=t.x1-t.x0,t.height=t.y1-t.y0,t.x=t.x0+t.width/2,t.y=t.y0+t.height/2;else{const e=5;t.x0=t.x-e,t.x1=t.x+e,t.y0=t.y-e,t.y1=t.y+e,t.width=2*e,t.height=2*e}for(const e of this.edges.values())e.direction=t,this.updateEdgeBezier(e);this.tension=0}saveTargetPositions(){for(const t of this.nodes.values())t._targetX0=t.x0,t._targetX1=t.x1,t._targetY0=t.y0,t._targetY1=t.y1;for(const t of this.edges.values())t._targetY0=t.y0,t._targetY1=t.y1,t._targetSankeyWidth=t.sankeyWidth}restorePreviousPositions(){for(const t of this.nodes.values())void 0===t._prevX0||0===t._prevX0&&0===t._prevX1||(t.x0=t._prevX0,t.x1=t._prevX1,t.y0=t._prevY0,t.y1=t._prevY1);for(const t of this.edges.values())void 0!==t._prevY0&&void 0!==t._prevSankeyWidth&&t._prevSankeyWidth>0&&(t.y0=t._prevY0,t.y1=t._prevY1,t.sankeyWidth=t._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const t of this.nodes.values())void 0!==t._targetX0&&(t.x0=t._targetX0,t.x1=t._targetX1,t.y0=t._targetY0,t.y1=t._targetY1);for(const t of this.edges.values())void 0!==t._targetY0&&(t.y0=t._targetY0,t.y1=t._targetY1,t.sankeyWidth=t._targetSankeyWidth);this.rebuildAllBeziers()}updateEdgeBezier(t){const e="string"==typeof t.source?this.nodes.get(t.source):t.source,n="string"==typeof t.target?this.nodes.get(t.target):t.target;e&&n&&(t.bezier=t.circular&&t.circularPathData?this.buildCircularBezier(t):this.buildStandardBezier(t,e,n))}buildStandardBezier(t,e,n){const o=(t.sankeyWidth||1)/2;if("down"===t.direction){const r=e.y1,a=n.y0,i=y(r,a);return{circular:!1,points:[{x:t.y0,y:r},{x:t.y0,y:i(.5)},{x:t.y1,y:i(.5)},{x:t.y1,y:a}],halfWidth:o}}const r=e.x1,a=n.x0,i=y(r,a);return{circular:!1,points:[{x:r,y:t.y0},{x:i(.5),y:t.y0},{x:i(.5),y:t.y1},{x:a,y:t.y1}],halfWidth:o}}buildCircularBezier(t){const e=(t.sankeyWidth||1)/2,n=t.circularPathData;let o;o="down"===t.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 t=0;o.length-1>t;t++){const e=o[t],n=o[t+1],a=n.x-e.x,i=n.y-e.y;r.push([e,{x:e.x+a/3,y:e.y+i/3},{x:e.x+2*a/3,y:e.y+2*i/3},n])}return{circular:!0,segments:r,halfWidth:e}}rebuildAllBeziers(){for(const t of this.nodes.values())t.width=t.x1-t.x0,t.height=t.y1-t.y0,t.x=t.x0+t.width/2,t.y=t.y0+t.height/2;for(const t of this.edges.values())this.updateEdgeBezier(t)}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 St(t){return{id:t,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function Pt(t,e,n){switch(t.type){case"circle":return function(t,e,n){const o=e-t.cx,r=n-t.cy,a=Math.sqrt(o*o+r*r);return a>Math.max(t.r,5)+5?null:{type:"node",datum:t.datum,x:t.cx,y:t.cy,distance:a}}(t,e,n);case"rect":return function(t,e,n){return t.x>e||e>t.x+t.w||t.y>n||n>t.y+t.h?null:{type:"node",datum:t.datum,x:t.x+t.w/2,y:t.y+t.h/2,distance:0}}(t,e,n);case"arc":return function(t,e,n){const o=e-t.cx,r=n-t.cy,a=Math.sqrt(o*o+r*r);if(t.innerR-2>a||a>t.outerR+2)return null;let i=Math.atan2(r,o);0>i&&(i+=2*Math.PI);let s,l=t.startAngle,c=t.endAngle;if(0>l&&(l+=2*Math.PI),0>c&&(c+=2*Math.PI),s=l>c?i>=l||c>=i:i>=l&&c>=i,s){const e=(t.startAngle+t.endAngle)/2,n=(t.innerR+t.outerR)/2;return{type:"node",datum:t.datum,x:t.cx+n*Math.cos(e),y:t.cy+n*Math.sin(e),distance:0}}return null}(t,e,n);default:return null}}function Dt(t,e,n){switch(t.type){case"bezier":return function(t,e,n){var o,r;if(!t.pathD)return null;try{const a=new Path2D(t.pathD),i=document.createElement("canvas").getContext("2d");if(!i)return null;if(i.isPointInPath(a,e,n)){const a="object"==typeof(null===(o=t.datum)||void 0===o?void 0:o.source)?t.datum.source:null,i="object"==typeof(null===(r=t.datum)||void 0===r?void 0:r.target)?t.datum.target:null;return{type:"edge",datum:t.datum,x:a&&i?(a.x1+i.x0)/2:e,y:t.datum?(t.datum.y0+t.datum.y1)/2:n,distance:0}}}catch(t){}return null}(t,e,n);case"line":return function(t,e,n){const o=t.x2-t.x1,r=t.y2-t.y1,a=o*o+r*r;if(0===a)return null;let i=((e-t.x1)*o+(n-t.y1)*r)/a;i=Math.max(0,Math.min(1,i));const s=t.x1+i*o,l=t.y1+i*r,c=Math.sqrt(Math.pow(e-s,2)+Math.pow(n-l,2));return c>5?null:{type:"edge",datum:t.datum,x:s,y:l,distance:c}}(t,e,n);case"ribbon":case"curved":return function(t,e,n){if(!t.pathD)return null;try{const o=new Path2D(t.pathD),r=document.createElement("canvas").getContext("2d");if(!r)return null;if(r.isPointInPath(o,e,n))return{type:"edge",datum:t.datum,x:e,y:n,distance:0}}catch(t){}return null}(t,e,n);default:return null}}function jt(e){const{width:n,height:o,totalWidth:r,totalHeight:a,margin:i,labels:s,title:l,legend:c,foregroundGraphics:d,annotations:u,svgAnnotationRules:y}=e;return t.createElement("svg",{width:r,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},t.createElement("g",{transform:`translate(${i.left},${i.top})`},s.map((e,n)=>t.createElement("text",{key:"label-"+n,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&&y&&u.map((e,r)=>{const a=y(e,r,{width:n,height:o});return a?t.createElement(t.Fragment,{key:"annotation-"+r},a):null}),d),l&&"string"==typeof l?t.createElement("text",{x:r/2,y:16,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"currentColor"},l):l?t.createElement("foreignObject",{x:0,y:0,width:r,height:i.top},l):null,c&&"object"==typeof c&&"legendGroups"in c?t.createElement("g",{transform:`translate(${r-i.right+10},${i.top})`},c.legendGroups.map((e,n)=>{var o;return t.createElement("g",{key:"legend-group-"+n},null===(o=e.items)||void 0===o?void 0:o.map((e,n)=>t.createElement("g",{key:"legend-item-"+n,transform:`translate(0,${20*n})`},t.createElement("rect",{x:0,y:0,width:12,height:12,fill:e.color,rx:2}),t.createElement("text",{x:18,y:10,fontSize:11,fill:"currentColor"},e.label))))})):c?t.createElement("g",{transform:`translate(${r-i.right+10},${i.top})`},c):null)}function Nt(t,e){var n,o,r,a;if(!e.pathD)return;t.save();const i=new Path2D(e.pathD);e.style.fill&&"none"!==e.style.fill&&(t.fillStyle=e.style.fill,t.globalAlpha=null!==(o=null!==(n=e.style.fillOpacity)&&void 0!==n?n:e.style.opacity)&&void 0!==o?o:.5,t.fill(i)),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=e.style.stroke,t.lineWidth=null!==(r=e.style.strokeWidth)&&void 0!==r?r:.5,t.globalAlpha=.5*(null!==(a=e.style.opacity)&&void 0!==a?a:1),t.stroke(i)),t.restore()}function Ot(t,e){var n;t.save(),t.strokeStyle=e.style.stroke||"#999",t.lineWidth=null!==(n=e.style.strokeWidth)&&void 0!==n?n:1,void 0!==e.style.opacity&&(t.globalAlpha=e.style.opacity),e.style.strokeDasharray&&t.setLineDash(e.style.strokeDasharray.split(/[\s,]+/).map(Number)),t.beginPath(),t.moveTo(e.x1,e.y1),t.lineTo(e.x2,e.y2),t.stroke(),t.restore()}function Wt(t,e){var n,o,r,a;if(!e.pathD)return;t.save();const i=new Path2D(e.pathD);e.style.fill&&"none"!==e.style.fill&&(t.fillStyle=e.style.fill,t.globalAlpha=null!==(o=null!==(n=e.style.fillOpacity)&&void 0!==n?n:e.style.opacity)&&void 0!==o?o:.5,t.fill(i)),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=e.style.stroke,t.lineWidth=null!==(r=e.style.strokeWidth)&&void 0!==r?r:.5,t.globalAlpha=.3*(null!==(a=e.style.opacity)&&void 0!==a?a:1),t.stroke(i)),t.restore()}function Ct(t,e){var n,o;if(!e.pathD)return;t.save();const r=new Path2D(e.pathD);t.strokeStyle=e.style.stroke||"#999",t.lineWidth=null!==(n=e.style.strokeWidth)&&void 0!==n?n:1,void 0!==e.style.opacity&&(t.globalAlpha=e.style.opacity),t.stroke(r),e.style.fill&&"none"!==e.style.fill&&(t.fillStyle=e.style.fill,t.globalAlpha=null!==(o=e.style.fillOpacity)&&void 0!==o?o:.1,t.fill(r)),t.restore()}jt.displayName="NetworkSVGOverlay";const _t={category10:x,tableau10:S,set3:w,blues:$,reds:M,greens:A,oranges:E,purples:k,viridis:b,plasma:v},Lt=x;function zt(t,e,n){if("function"==typeof e)return e(t);const o=t[e];return n?n(o):Lt[Math.abs(function(t){let e=0;for(let n=0;t.length>n;n++)e=(e<<5)-e+t.charCodeAt(n),e&=e;return Math.abs(e)}(o+""))%Lt.length]}function Ft(t,e,n="category10"){const o=Array.from(new Set(t.map(t=>t[e]))),r=o.every(t=>"number"==typeof t||!isNaN(Number(t)));if(Array.isArray(n))return F().domain(o).range(n).unknown("#999");const a=_t[n]||_t.category10;if(r&&"function"==typeof a)return t=>a(Number(t)/Math.max(...o.map(Number)));{const t=Array.isArray(a)?a:Lt;return F().domain(o).range(t).unknown("#999")}}const Tt={top:20,right:80,bottom:20,left:80},Bt={top:40,right:40,bottom:40,left:40},It=new Set(["chord","force","circlepack"]),Rt=[800,600],Yt={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 Xt({data:e}){var n,o,r,a,i,s;if("edge"===e.type){const n=e.data;return t.createElement("div",{className:"semiotic-tooltip",style:Yt},t.createElement("div",{style:{fontWeight:600}},"object"==typeof n.source?n.source.id:n.source," → ","object"==typeof n.target?n.target.id:n.target),null!=n.value&&t.createElement("div",{style:{marginTop:4,opacity:.8}},"Value:"," ","number"==typeof n.value?n.value.toLocaleString():n.value+""))}const l=e.data,c=null==l?void 0:l.__hierarchyNode;if(c){const e=[];let i=c;for(;i;){const t=null!==(a=null!==(o=null===(n=i.data)||void 0===n?void 0:n.name)&&void 0!==o?o:null===(r=i.data)||void 0===r?void 0:r.id)&&void 0!==a?a:l.id;null!=t&&e.unshift(t+""),i=i.parent}e.length>1&&e.shift();const s=e.length-1;return t.createElement("div",{className:"semiotic-tooltip",style:Yt},t.createElement("div",null,e.map((e,n)=>t.createElement("span",{key:n},n>0&&t.createElement("span",{style:{margin:"0 3px",opacity:.5}}," → "),n===s?t.createElement("strong",null,e):t.createElement("span",{style:{opacity:.7}},e)))),null!=l.value&&l.value>0&&t.createElement("div",{style:{marginTop:4,opacity:.8}},"number"==typeof l.value?l.value.toLocaleString():l.value+""))}const d=((null===(i=l.sourceLinks)||void 0===i?void 0:i.length)||0)+((null===(s=l.targetLinks)||void 0===s?void 0:s.length)||0),u=(l.sourceLinks||[]).reduce((t,e)=>t+(e.value||0),0)+(l.targetLinks||[]).reduce((t,e)=>t+(e.value||0),0);return t.createElement("div",{className:"semiotic-tooltip",style:Yt},t.createElement("div",{style:{fontWeight:600}},l.id),null!=l.value&&l.value>0&&t.createElement("div",{style:{marginTop:4,opacity:.8}},"Total:"," ","number"==typeof l.value?l.value.toLocaleString():l.value+""),d>0&&t.createElement("div",{style:{marginTop:4,opacity:.8}},"Connections: ",d,u!==d&&` (weighted: ${u.toLocaleString()})`))}const Gt=n(function(e,n){const{chartType:c,nodes:d,edges:u,data:y,initialEdges:h,nodeIDAccessor:p="id",sourceAccessor:f="source",targetAccessor:g="target",valueAccessor:m="value",childrenAccessor:x,hierarchySum:v,orientation:b="horizontal",nodeAlign:k="justify",nodePaddingRatio:E=.05,nodeWidth:A=15,iterations:M=300,forceStrength:$=.1,padAngle:w=.01,groupWidth:S=20,sortGroups:P,edgeSort:D,treeOrientation:j="vertical",edgeType:N="curve",padding:O,paddingTop:W,tensionConfig:C,showParticles:_=!1,particleStyle:L,nodeStyle:z,edgeStyle:F,colorBy:T,colorScheme:B="category10",edgeColorBy:I="source",edgeOpacity:R=.5,colorByDepth:Y=!1,nodeSize:X=8,nodeSizeRange:G=[5,20],nodeLabel:V,showLabels:H=!0,size:q=Rt,margin:K,className:Z,background:J,enableHover:Q=!0,tooltipContent:U,onTopologyChange:tt,annotations:ot,svgAnnotationRules:rt,legend:at,title:it,foregroundGraphics:st,backgroundGraphics:lt}=e,ct=It.has(c)?Bt:Tt,dt=Object.assign(Object.assign({},ct),K),ut=q[0]-dt.left-dt.right,yt=q[1]-dt.top-dt.bottom,ht=o(()=>Object.assign(Object.assign({},et),C),[C]),pt=o(()=>Object.assign(Object.assign({},nt),L),[L]),ft=o(()=>({chartType:c,nodeIDAccessor:p,sourceAccessor:f,targetAccessor:g,valueAccessor:m,childrenAccessor:x,hierarchySum:v,orientation:b,nodeAlign:k,nodePaddingRatio:E,nodeWidth:A,iterations:M,forceStrength:$,padAngle:w,groupWidth:S,sortGroups:P,edgeSort:D,treeOrientation:j,edgeType:N,padding:O,paddingTop:W,tensionConfig:ht,showParticles:_,particleStyle:pt,nodeStyle:z,edgeStyle:F,nodeLabel:V,showLabels:H,colorBy:T,colorScheme:B,edgeColorBy:I,edgeOpacity:R,colorByDepth:Y,nodeSize:X,nodeSizeRange:G}),[c,p,f,g,m,x,v,b,k,E,A,M,$,w,S,P,D,j,N,O,W,ht,_,pt,z,F,V,H,T,B,I,R,Y,X,G]),gt=r(null),mt=r(0),xt=r(0),vt=r(!0),bt=r(()=>{}),kt=r(null);kt.current||(kt.current=new wt(ft));const[Et,At]=a(null),[Mt,$t]=a(0),[St,_t]=a(0),zt=r(null),Ft=r(new Map),Yt=r(0),Gt=i(t=>{if("function"==typeof T)return T(t);if("string"==typeof T&&t.data){const e=t.data[T];if(void 0!==e){if(!Ft.current.has(e+"")){const t=Array.isArray(B)?B:Lt;Ft.current.set(e+"",t[Yt.current++%t.length])}return Ft.current.get(e+"")}}if(!Ft.current.has(t.id)){const e=Array.isArray(B)?B:Lt;Ft.current.set(t.id,e[Yt.current++%e.length])}return Ft.current.get(t.id)},[T,B]);i(t=>{if("function"==typeof I)return I(t);const e="object"==typeof t.source?t.source:null,n="object"==typeof t.target?t.target:null;return"target"===I&&n?Gt(n):e?Gt(e):"#999"},[I,Gt]);const Vt=i(t=>{const e="object"==typeof t.source?t.source:null,n="object"==typeof t.target?t.target:null;return"target"===(pt.colorBy||"source")&&n?Gt(n):e?Gt(e):"#999"},[pt.colorBy,Gt]),Ht="sankey"===c&&_,qt=i(()=>{mt.current&&!Ht||mt.current||(mt.current=requestAnimationFrame(()=>bt.current()))},[Ht]);s(()=>{var t;null===(t=kt.current)||void 0===t||t.updateConfig(ft),vt.current=!0,qt()},[ft,qt]);const Kt=i(()=>{const t=kt.current;if(t&&(t.runLayout([ut,yt]),t.buildScene([ut,yt]),vt.current=!0,$t(t.layoutVersion),tt)){const{nodes:e,edges:n}=t.getLayoutData();tt(e,n)}},[ut,yt,tt]),Zt=i(t=>{const e=kt.current;e&&(e.ingestEdge(t)&&Kt(),qt())},[Kt,qt]),Jt=i(t=>{const e=kt.current;if(!e)return;let n=!1;for(const o of t)e.ingestEdge(o)&&(n=!0);n&&Kt(),qt()},[Kt,qt]),Qt=i(()=>{var t;null===(t=kt.current)||void 0===t||t.clear(),Ft.current.clear(),Yt.current=0,$t(0),At(null),zt.current=null,vt.current=!0,qt()},[qt]),Ut=i(()=>{const t=kt.current;t&&(t.tension+=999,Kt(),qt())},[Kt,qt]);l(n,()=>({push:Zt,pushMany:Jt,clear:Qt,getTopology:()=>{var t,e;return null!==(e=null===(t=kt.current)||void 0===t?void 0:t.getLayoutData())&&void 0!==e?e:{nodes:[],edges:[]}},relayout:Ut,getTension:()=>{var t,e;return null!==(e=null===(t=kt.current)||void 0===t?void 0:t.tension)&&void 0!==e?e:0}}),[Zt,Jt,Qt,Ut]);const te=["tree","cluster","treemap","circlepack","partition"].includes(c),ee=te?y||(Array.isArray(u)?void 0:u):void 0;s(()=>{const t=kt.current;if(t)if(te&&ee)t.ingestHierarchy(ee,[ut,yt]),t.buildScene([ut,yt]),vt.current=!0,qt();else{const e=d||[],n=Array.isArray(u)?u:[];if(0===e.length&&0===n.length)return;t.ingestBounded(e,n,[ut,yt]),t.buildScene([ut,yt]),vt.current=!0,qt()}},[d,u,y,ee,te,ut,yt,ft,qt]),s(()=>{h&&h.length>0&&Jt(h)},[]);const ne=r(()=>{}),oe=r(()=>{});ne.current=t=>{if(!Q)return;const e=gt.current;if(!e)return;const n=e.getBoundingClientRect(),o=t.clientX-n.left-dt.left,r=t.clientY-n.top-dt.top;if(0>o||o>ut||0>r||r>yt)return void(zt.current&&(zt.current=null,At(null),qt()));const a=kt.current;if(!a)return;const i=function(t,e,n,o,r=30){let a=null,i=r,s=1/0;for(const e of t){const t=Pt(e,n,o);if(t)if("rect"===e.type){const n=e.w*e.h;s>n&&(a=t,s=n)}else i>t.distance&&(a=t,i=t.distance)}if(a)return a;for(const t of e){const e=Dt(t,n,o);e&&i>e.distance&&(a=e,i=e.distance)}return a}(a.sceneNodes,a.sceneEdges,o,r);if(!i)return void(zt.current&&(zt.current=null,At(null),qt()));const s={type:i.type,data:i.datum,x:i.x,y:i.y};zt.current=s,At(s),qt()},oe.current=()=>{zt.current&&(zt.current=null,At(null),qt())};const re=i(t=>ne.current(t),[]),ae=i(()=>oe.current(),[]);bt.current=()=>{var t;mt.current=0;const e=gt.current;if(!e)return;const n=e.getContext("2d");if(!n)return;const o=kt.current;if(!o)return;const r=performance.now(),a=xt.current?Math.min((r-xt.current)/1e3,.1):.016;xt.current=r;const i=o.advanceTransition(r);(i||vt.current)&&o.buildScene([ut,yt]);const s="undefined"!=typeof window&&window.devicePixelRatio||1;if(e.width=q[0]*s,e.height=q[1]*s,e.style.width=q[0]+"px",e.style.height=q[1]+"px",n.scale(s,s),n.translate(dt.left,dt.top),n.clearRect(-dt.left,-dt.top,q[0],q[1]),J&&(n.fillStyle=J,n.fillRect(0,0,ut,yt)),function(t,e){for(const n of e)switch(n.type){case"bezier":Nt(t,n);break;case"line":Ot(t,n);break;case"ribbon":Wt(t,n);break;case"curved":Ct(t,n)}}(n,o.sceneEdges),function(t,e){var n,o,r;for(const a of e){if("rect"!==a.type)continue;const e=a;e.w>0&&e.h>0&&(t.save(),void 0!==e.style.opacity&&(t.globalAlpha=e.style.opacity),e.style.fill&&(t.fillStyle=e.style.fill,void 0!==e.style.fillOpacity&&(t.globalAlpha=(null!==(n=e.style.opacity)&&void 0!==n?n:1)*e.style.fillOpacity),t.fillRect(e.x,e.y,e.w,e.h)),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=e.style.stroke,t.lineWidth=null!==(o=e.style.strokeWidth)&&void 0!==o?o:1,t.globalAlpha=null!==(r=e.style.opacity)&&void 0!==r?r:1,t.strokeRect(e.x,e.y,e.w,e.h)),t.restore())}}(n,o.sceneNodes),function(t,e){var n,o,r;for(const a of e){if("circle"!==a.type)continue;const e=a;e.r>0&&(t.save(),void 0!==e.style.opacity&&(t.globalAlpha=e.style.opacity),t.beginPath(),t.arc(e.cx,e.cy,e.r,0,2*Math.PI),e.style.fill&&(t.fillStyle=e.style.fill,void 0!==e.style.fillOpacity&&(t.globalAlpha=(null!==(n=e.style.opacity)&&void 0!==n?n:1)*e.style.fillOpacity),t.fill()),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=e.style.stroke,t.lineWidth=null!==(o=e.style.strokeWidth)&&void 0!==o?o:1,t.globalAlpha=null!==(r=e.style.opacity)&&void 0!==r?r:1,t.stroke()),t.restore())}}(n,o.sceneNodes),function(t,e){var n,o,r;for(const a of e){if("arc"!==a.type)continue;const e=a;t.save(),void 0!==e.style.opacity&&(t.globalAlpha=e.style.opacity),t.beginPath(),t.arc(e.cx,e.cy,e.outerR,e.startAngle,e.endAngle),t.arc(e.cx,e.cy,e.innerR,e.endAngle,e.startAngle,!0),t.closePath(),e.style.fill&&(t.fillStyle=e.style.fill,void 0!==e.style.fillOpacity&&(t.globalAlpha=(null!==(n=e.style.opacity)&&void 0!==n?n:1)*e.style.fillOpacity),t.fill()),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=e.style.stroke,t.lineWidth=null!==(o=e.style.strokeWidth)&&void 0!==o?o:1,t.globalAlpha=null!==(r=e.style.opacity)&&void 0!==r?r:1,t.stroke()),t.restore()}}(n,o.sceneNodes),_&&o.particlePool){const e=Array.from(o.edges.values());if(e.length>0){!function(t,e,n,o){var r,a;const i=null!==(r=o.spawnRate)&&void 0!==r?r:nt.spawnRate,s=null!==(a=o.maxPerEdge)&&void 0!==a?a:nt.maxPerEdge;for(let o=0;e.length>o;o++){const r=e[o];if(!r.bezier)continue;if(t.countForEdge(o)>=s)continue;const a=r.value*i*n,l=Math.floor(a),c=a-l;let d=l;Math.random()<c&&d++;for(let e=0;d>e&&t.countForEdge(o)<s;e++)t.spawn(o)}}(o.particlePool,e,a,pt);const r=.5*(null!==(t=pt.speedMultiplier)&&void 0!==t?t:1);o.particlePool.step(a,r,e),function(t,e,n,o,r){var a,i;const s=null!==(a=o.radius)&&void 0!==a?a:nt.radius,l=null!==(i=o.opacity)&&void 0!==i?i:nt.opacity;t.globalAlpha=l;for(let a=0;e.particles.length>a;a++){const i=e.particles[a];if(!i.active)continue;const l=n[i.edgeIndex];if(l){if("function"==typeof o.color){const e="object"==typeof l.source?l.source:null;t.fillStyle=e?o.color(l,e):"#666"}else t.fillStyle=o.color&&"inherit"!==o.color?o.color:r(l);t.beginPath(),t.arc(i.x,i.y,s,0,2*Math.PI),t.fill()}}t.globalAlpha=1}(n,o.particlePool,e,pt,Vt)}}const l=vt.current;vt.current=!1,(l||i)&&_t(t=>t+1),(Ht||i)&&(mt.current=requestAnimationFrame(()=>bt.current()))},s(()=>(qt(),()=>{mt.current&&cancelAnimationFrame(mt.current)}),[qt]),s(()=>{vt.current=!0,qt()},[c,ut,yt,J,qt]);const ie=Q&&Et?t.createElement("div",{className:"stream-network-tooltip",style:{position:"absolute",left:dt.left+Et.x,top:dt.top+Et.y,transform:`translate(${Et.x>.6*ut?"calc(-100% - 12px)":"12px"}, ${.3*yt>Et.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:2}},U?U(Et):t.createElement(Xt,{data:Et})):null,se=kt.current;return t.createElement("div",{className:"stream-network-frame"+(Z?" "+Z:""),style:{position:"relative",width:q[0],height:q[1]},onMouseMove:Q?re:void 0,onMouseLeave:Q?ae:void 0},lt&&t.createElement("svg",{style:{position:"absolute",top:0,left:0,width:q[0],height:q[1],pointerEvents:"none"}},t.createElement("g",{transform:`translate(${dt.left},${dt.top})`},lt)),t.createElement("canvas",{ref:gt,style:{position:"absolute",top:0,left:0}}),t.createElement(jt,{width:ut,height:yt,totalWidth:q[0],totalHeight:q[1],margin:dt,labels:(null==se?void 0:se.labels)||[],title:it,legend:at,foregroundGraphics:st,annotations:ot,svgAnnotationRules:rt,annotationFrame:St}),ie)});Gt.displayName="StreamNetworkFrame";const Vt=({xy:e,orient:n,i:o,className:r="",jaggedBase:a})=>{let i=`M${e.x1},${e.y1}L${e.x2},${e.y2}`;return a&&0===o&&(i=((t,e)=>{let n="";const{x1:o,x2:r,y1:a,y2:i}=e;if("left"===t||"right"===t){const e=Math.abs(r-o);n=((t,e,n,o)=>{const r=t/e;let a=0,i="M0,"+n;const s="right"===o?-1:1;for(;t>=a;)i+=`L${a},${n}`,t>a&&(i+=`L${a+r/2},${n+10*s}`),a+=r;return i})(e,Math.ceil(e/40),"right"===t?0:a,t)}else{const e=Math.abs(i-a);n=((t,e,n,o)=>{const r=t/e;let a=0,i=`M${n},0`;const s="bottom"===o?-1:1;for(;t>=a;)i+=`L${n},${a}`,t>a&&(i+=`L${n+10*s},${a+r/2}`),a+=r;return i})(e,Math.ceil(e/40),o,t)}return n})(n,e)),t.createElement("path",{key:o,fill:"none",stroke:"currentColor",strokeWidth:"1px",d:i,className:`tick-line tick ${n} ${r}`})};function Ht(t,e,n){const o=Math.abs(n.range()[1]-n.range()[0]);return t||(e||(e=Math.max(1,Math.floor(o/40))),t=n.ticks&&n.ticks(e)||n.domain()),t}function qt({t:t,o:e,w:n}){return"contour"!==t&&"boxplot"!==t||"left"!==e&&"right"!==e?0:n/2}function Kt({t:t,o:e,w:n}){return"contour"!==t&&"boxplot"!==t||"top"!==e&&"bottom"!==e?0:n/2}function Zt(t){const{translation:n,orient:o,decoratedSummaryType:r,summaryWidth:a,renderedSummary:i,points:s}=t;return e.createElement("g",{className:"marginal-graphics",transform:`translate(${n[o]})`},e.createElement("g",{transform:`translate(${qt({t:r.type,o:o,w:a})},${Kt({t:r.type,o:o,w:a})})`},i),s)}function Jt(t){const{className:n,translation:o,position:r,rotation:a,labelName:i,anchorMod:s}=t;return e.createElement("g",{className:"axis-title "+n,transform:`translate(${[o[0]+r[0],o[1]+r[1]]}) rotate(${a})`},e.isValidElement(i)?i:e.createElement("text",{textAnchor:s},i))}function Qt(t){if(null==t)return"";if("number"!=typeof t)return t+"";if(!isFinite(t))return t+"";if(0===t)return"0";const e=parseFloat(t.toPrecision(12)),n=Math.abs(e);return 1e9>n?1e6>n?1e4>n?Number.isInteger(e)?e+"":parseFloat(e.toPrecision(6))+"":parseFloat((e/1e3).toPrecision(3))+"K":parseFloat((e/1e6).toPrecision(3))+"M":parseFloat((e/1e9).toPrecision(3))+"B"}function Ut(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&0>e.indexOf(o)&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(t);o.length>r;r++)0>e.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(n[o[r]]=t[o[r]])}return n}"function"==typeof SuppressedError&&SuppressedError;function te(e){const{rotate:n,label:o,dynamicLabelPosition:i,orient:l="left",marginalSummaryType:c,tickFormat:d=(c?()=>"":Qt),size:u,width:y=u&&u[0]||0,height:h=u&&u[1]||0,className:p,padding:f,tickValues:g,scale:m,ticks:x,footer:v,tickSize:b,tickLineGenerator:k,baseline:E=!0,margin:A={top:0,bottom:0,left:0,right:0},center:M=!1,annotationFunction:$,glyphFunction:w,xyPoints:S}=e,[P,D]=a(0),[j,N]=a(void 0),O=r(null);s(()=>{if(!(null==o?void 0:o.position)&&i){const t=((t,e)=>{const n=t.current;if(!n)return 30;const o="left"===e||"right"===e?"width":"height";return Math.max(...[...n.querySelectorAll(".axis-label")].map(t=>t.getBBox&&t.getBBox()||{height:30,width:30}).map(t=>t[o]))+25})(O,l);t!==j&&N(t)}},[o,i]);let W,{axisParts:C,position:_=[0,0]}=e;if(C||(C=function({renderMode:t=()=>{},padding:e=5,scale:n,ticks:o,tickValues:r=Ht(void 0,o,n),orient:a="left",size:i,footer:s=!1,tickSize:l=(s?-10:["top","bottom"].find(t=>t===a)?i?i[1]:0:i?i[0]:0),jaggedBase:c}){let d,u,y,h,p,f,g=[],m=0,x=0,v="middle";switch(a){case"top":d="x1",u="x2",y="y1",h="y2",g=[0,l],p="tx",f="ty",m-=20-e;break;case"bottom":d="x1",u="x2",y="y2",h="y1",g=i?[i[1],i[1]-l]:[0,-l],p="tx",f="ty",m+=20+e;break;case"right":d="y2",u="y1",y="x2",h="x1",g=i?[i[0],i[0]-l]:[0,-l],p="ty",f="tx",m+=5+e,x+=5,v="start";break;default:d="y1",u="y2",y="x1",h="x2",g=[0,l],p="ty",f="tx",m-=5+e,x+=5,v="end"}let b=r instanceof Function?r({orient:a}):r;return c&&void 0===b.find(t=>t===n.domain()[0])&&(b=[n.domain()[0],...b]),b.map((e,o)=>{const r=n(e);return{[d]:r,[u]:r,[y]:g[0],[h]:g[1],[p]:r+x,[f]:g[0]+m,defaultAnchor:v,renderMode:t(e,o),value:e}})}({padding:f,tickValues:g,scale:m,ticks:x,orient:l,size:[y,h],footer:v,tickSize:b}),W=t.createElement("g",{className:"axis "+p},(({axisParts:e,orient:n,tickLineGenerator:o=Vt,className:r,jaggedBase:a,scale:i,showOutboundTickLines:s=!1})=>{const l=e.map((t,e)=>o({xy:t,orient:n,i:e,className:r,jaggedBase:a,scale:i})),c=s?e.map((e,o)=>(({xy:e,orient:n,i:o,className:r=""})=>{let a=`M-4,${e.y1}L${e.x1},${e.y2}`;return"left"===n?a=`M${e.x1-8},${e.y1}L${e.x1},${e.y2}`:"right"===n?a=`M${e.x2},${e.y1}L${e.x2+8},${e.y2}`:"top"===n?a=`M${e.x1},${e.y1-8}L${e.x1},${e.y1}`:"bottom"===n&&(a=`M${e.x1},${e.y2}L${e.x1},${e.y2+8}`),t.createElement("path",{key:o,fill:"none",stroke:"currentColor",strokeWidth:"1px",d:a,className:`outbound-tick-line tick ${n} ${r}`})})({xy:e,orient:n,i:o,className:r})):[];return[...l,c]})({axisParts:C,orient:l,tickLineGenerator:k,className:p,scale:m}))),0===C.length)return null;let L,z,F,T,B=50,I=h,R=-50,Y=0,X=0,G=0,V=0,H=h,q=25,K=-25,Z=18,J=y+25,Q=0,U=P,tt=0,et="y";switch(l){case"right":_=[_[0],_[1]],R=y,V=X=y,tt=A.top,J=-y-25,K=5,L=t=>{D(t.nativeEvent.offsetY-tt)},!0===M&&(V=X=y/2);break;case"top":_=[_[0],0],B=y,I=50,Y=-50,R=0,tt=A.left,et="x",V=y,H=0,!0===M&&(H=G=h/2),L=t=>{D(t.nativeEvent.offsetX-tt)},q=P,U=25,K=0,Z=-10,J=0,Q=h+25;break;case"bottom":_=[_[0],0],B=y,I=50,G=H=Y=h,X=R=0,V=y,tt=A.left,L=t=>{D(t.nativeEvent.offsetX-tt)},q=P,U=25,K=0,Z=15,J=0,Q=-h-25,et="x",!0===M&&(H=G=h/2);break;default:_=[_[0],_[1]],tt=A.top,!0===M&&(V=X=y/2),L=t=>{D(t.nativeEvent.offsetY-tt)}}if($){const n=function(t,e){return e.tickFormat?e.tickFormat(t):t.toString?""+t:t}(m.invert(P),e),o=w?w({lineHeight:Q,lineWidth:J,value:m.invert(P)}):t.createElement("g",null,t.isValidElement(n)?t.createElement("g",{transform:`translate(${K},${Z})`},n):t.createElement("text",{x:K,y:Z},n),t.createElement("circle",{r:5}),t.createElement("line",{x1:J,y1:Q,style:{stroke:"black"}})),r=P?t.createElement("g",{style:{pointerEvents:"none"},transform:`translate(${q},${U})`},o):null;z=t.createElement("g",{className:"annotation-brush",transform:`translate(${R},${Y})`},t.createElement("rect",{style:{fillOpacity:0},height:I,width:B,onMouseMove:L,onClick:t=>$({className:"dynamic-axis-annotation",type:et,value:m.invert(P),e:t}),onMouseOut:()=>{D(void 0)}}),r)}if(c&&S){const e=Math.max(A[l]-6,5),n="string"==typeof c?{type:c}:c;void 0!==n.flip||"bottom"!==l&&"right"!==l||(n.flip=!0);const o=n.summaryStyle?()=>n.summaryStyle:()=>({fill:"black",fillOpacity:.5,stroke:"black",strokeDasharray:"0"}),r=n.renderMode?()=>n.renderMode:()=>{},a=n.summaryClass?()=>n.summaryClass:()=>"",i=n.filter||(()=>!0),s=S.filter(t=>void 0!==t.x&&void 0!==t.y&&i(t.data)).map(t=>Object.assign(Object.assign({},t),{xy:{x:"top"===l||"bottom"===l?m(t.x):0,y:"left"===l||"right"===l?m(t.y):0},piece:{scaledVerticalValue:m(t.y),scaledValue:m(t.x)},value:m("top"===l||"bottom"===l?t.y:t.x),scaledValue:m(t.x),scaledVerticalValue:m(t.y)})),d=function(e){const n=[];for(const o of e){const e=[],{elements:r,containerProps:a}=o;if(o.Mark)n.push(o.Mark);else{for(let n=0;r.length>n;n++){const o=r[n],{markType:a,style:i={}}=o,s=Ut(o,["markType","style"]),l=Object.assign({},s);void 0!==i.fill&&(l.fill=i.fill),void 0!==i.stroke&&(l.stroke=i.stroke),void 0!==i.strokeWidth&&(l.strokeWidth=i.strokeWidth),void 0!==i.opacity&&(l.opacity=i.opacity),void 0!==i.fillOpacity&&(l.fillOpacity=i.fillOpacity),void 0!==i.strokeOpacity&&(l.strokeOpacity=i.strokeOpacity);const c=Object.assign({},i);delete c.fill,delete c.stroke,delete c.strokeWidth,delete c.opacity,delete c.fillOpacity,delete c.strokeOpacity,Object.keys(c).length>0&&(l.style=c),l.key=o.key||n,a&&e.push(t.createElement(a,l))}a?n.push(t.createElement("g",Object.assign({},a),e)):n.push(...e)}}return n}((({data:t,type:e,renderMode:n,eventListenersGenerator:o,styleFn:r,classFn:a,projection:i,adjustedSize:s,margin:l,axisCreator:c})=>{if(e&&e.type)return function({data:t,type:e,renderMode:n,eventListenersGenerator:o,styleFn:r,classFn:a,projection:i,adjustedSize:s,chartSize:l,margin:c,axisCreator:d}){return"function"==typeof e.type?e.type({data:t,type:e,renderMode:n,eventListenersGenerator:o,styleFn:r,classFn:a,projection:i,adjustedSize:s,chartSize:l,margin:c,axisCreator:d}):(console.error(`Invalid summary type: ${e.type} - Must be a function`),{})}({data:t,type:e="string"==typeof e?{type:e}:e,renderMode:n,eventListenersGenerator:o,styleFn:r,classFn:a,projection:i,adjustedSize:s,chartSize:"vertical"===i?s[1]:s[0],margin:l,axisCreator:c})})({data:{column:{middle:e/2,pieceData:s,width:e,xyData:s}},type:n,renderMode:r,eventListenersGenerator:n.eventListenersGenerator||(()=>({})),styleFn:o,classFn:a,projection:"top"===l||"bottom"===l?"horizontal":"vertical",adjustedSize:u,margin:{top:0,bottom:0,left:0,right:0}}).marks);let y;if(!0===n.showPoints){const o=((t,e,n)=>{const o="left"===t||"right"===t?e/2:0,r="bottom"===t||"top"===t?e/2:0;return n.map(t=>[t.xy.x+o,t.xy.y+r])})(l,e,s);y=o.map((e,o)=>t.createElement("circle",{key:"axis-summary-point-"+o,cx:e[0],cy:e[1],r:n.r||3,style:n.pointStyle||{fill:"black",fillOpacity:.1}}))}F=t.createElement(Zt,{translation:{left:[2-A.left,0],right:[u[0]+2,0],top:[0,2-A.top],bottom:[0,u[1]+2]},orient:l,decoratedSummaryType:n,summaryWidth:e,renderedSummary:d,points:y})}const nt=(({axisParts:e,tickFormat:n,rotate:o=0,center:r=!1,orient:a})=>{const i=e.map((t,e)=>({axisPart:t,i:e,formatted:n(t.value,e)})),s="left"===a||"right"===a;let l=i;if(!o&&i.length>1){const t=8,e=14,n=8,o=t=>"string"==typeof t?t:"number"==typeof t?t+"":null;if("top"===a||"bottom"===a){const e=[...i].sort((t,e)=>t.axisPart.tx-e.axisPart.tx);let r=-1/0;const a=new Set;for(const i of e){const e=o(i.formatted);if(!e){a.add(i.i);continue}const s=e.length*t/2;r+n>i.axisPart.tx-s||(a.add(i.i),r=i.axisPart.tx+s)}l=i.filter(t=>a.has(t.i))}else if(s){const t=[...i].sort((t,e)=>t.axisPart.ty-e.axisPart.ty);let o=-1/0;const r=new Set;for(const a of t)o+e+n>a.axisPart.ty||(r.add(a.i),o=a.axisPart.ty);l=i.filter(t=>r.has(t.i))}}return l.map(({axisPart:e,i:n,formatted:i})=>{("object"!=typeof i||i instanceof Date)&&(i=t.createElement("text",{textAnchor:e.defaultAnchor,className:"axis-label"},i.toString?""+i:i));let s=e.tx,l=e.ty;if(r)switch(a){case"right":s-=(e.x2-e.x1)/2;break;case"left":s+=(e.x2-e.x1)/2;break;case"top":l+=(e.y2-e.y1)/2;break;case"bottom":l-=(e.y2-e.y1)/2}return t.createElement("g",{key:n,pointerEvents:"none",transform:`translate(${s},${l}) rotate(${o})`,className:"axis-label"},i)})})({tickFormat:d,axisParts:C,orient:l,rotate:n,center:M});if(o){const e=o.name||o,n=o.position||{};let r=n.anchor||"middle";const a=o.locationDistance||j,i=n.rotation||{left:-90,right:90,top:0,bottom:0}[l],s={left:{start:[0,u[1]],middle:[0,u[1]/2],end:[0,0],inside:[a||15,0],outside:[-(a||45),0]},right:{start:[u[0]+0,u[1]],middle:[u[0]+0,u[1]/2],end:[u[0]+0,0],inside:[-(a||15),0],outside:[a||45,0]},top:{start:[0,0],middle:[0+u[0]/2,0],end:[0+u[0],0],inside:[0,a||15],outside:[0,-(a||40)]},bottom:{start:[0,u[1]],middle:[0+u[0]/2,u[1]],end:[0+u[0],u[1]],inside:[0,-(a||5)],outside:[0,a||50]}},c=s[l][r],d=s[l][n.location||"outside"];c[0]=c[0]+d[0],c[1]=c[1]+d[1],"start"===r&&"right"===l?r="end":"end"===r&&"right"===l&&(r="start"),T=t.createElement(Jt,{className:p,translation:c,position:_,rotation:i,labelName:e,anchorMod:r})}const ot=`${l} axis ${C&&C.length>0&&`from ${d(C[0].value,0)} to ${d(C[C.length-1].value,C.length-1)}`||"without ticks"}`;return t.createElement("g",{className:p,"aria-label":ot,ref:O},z,nt,W,!0===E?t.createElement("line",{key:"baseline",className:"axis-baseline "+p,stroke:"black",strokeLinecap:"square",x1:X,x2:V,y1:G,y2:H}):null,T,F)}const ee={fill:e=>t.createElement("rect",{style:e,width:20,height:20}),line:e=>t.createElement("line",{style:e,x1:0,y1:0,x2:20,y2:20})};function ne(t,e,n,o){let r;return r="function"==typeof n?n(t):(0,ee[n])(o(t,e)),r}function oe(e){const{legendGroups:n,customClickBehavior:o,title:r="Legend",width:a=100,height:i=20,orientation:s="vertical"}=e,l="vertical"===s?(({legendGroups:e,width:n,customClickBehavior:o})=>{let r=30;const a=[];return e.forEach((e,i)=>{r+=5,a.push(t.createElement("line",{key:"legend-top-line legend-symbol-"+i,stroke:"gray",x1:0,y1:r,x2:n,y2:r})),r+=10,e.label&&(r+=20,a.push(t.createElement("text",{key:"legend-text-"+i,y:r,className:"legend-group-label"},e.label)),r+=10),a.push(t.createElement("g",{key:"legend-group-"+i,className:"legend-item",transform:`translate(0,${r})`},((e,n)=>{const{type:o="fill",styleFn:r,items:a}=e,i=[];let s=0;return a.forEach((e,a)=>{const l=ne(e,a,o,r);i.push(t.createElement("g",{key:"legend-item-"+a,transform:`translate(0,${s})`,onClick:n?()=>n(e):void 0,style:{cursor:n?"pointer":"default"}},l,t.createElement("text",{y:15,x:30},e.label))),s+=25}),i})(e,o))),r+=25*e.items.length+10}),a})({legendGroups:n,width:a,customClickBehavior:o}):(({legendGroups:e,title:n,height:o,customClickBehavior:r})=>{let a=0;const i=[],s=!1===n?10:40;return e.forEach((n,l)=>{n.label&&(i.push(t.createElement("text",{key:"legend-text-"+l,transform:`translate(${a},${s}) rotate(90)`,textAnchor:"start",className:"legend-group-label"},n.label)),a+=20);const c=((e,n)=>{const{type:o="fill",styleFn:r,items:a}=e,i=[];let s=0;return a.forEach((e,a)=>{const l=ne(e,a,o,r);i.push(t.createElement("g",{key:"legend-item-"+a,transform:`translate(${s},0)`,onClick:n?()=>n(e):void 0,style:{cursor:n?"pointer":"default"}},l,t.createElement("text",{y:15,x:25},e.label))),s+=35,s+=8*e.label.length}),{items:i,offset:s}})(n,r);i.push(t.createElement("g",{key:"legend-group-"+l,className:"legend-item",transform:`translate(${a},${s})`},c.items)),a+=c.offset+5,e[l+1]&&i.push(t.createElement("line",{key:"legend-top-line legend-symbol-"+l,stroke:"gray",x1:a,y1:s-10,x2:a,y2:o+s+10})),a+=15}),t.createElement("g",null,!1!==n&&t.createElement("line",{x1:0,x2:a+10,y1:s-10,y2:s-10,stroke:"gray",className:"title-neatline"}),i)})({legendGroups:n,title:r,height:i,customClickBehavior:o});return t.createElement("g",null,void 0!==r&&t.createElement("text",{className:"legend-title",y:20,x:"horizontal"===s?0:a/2,textAnchor:"horizontal"===s?"start":"middle"},r),l)}function re(t,e=120,n=8){if(!t)return[];const o=Math.max(1,Math.floor(e/n)),r=t.split(/\s+/),a=[];let i="";for(const t of r)i&&i.length+1+t.length>o?(a.push(i),i=t):i=i?`${i} ${t}`:t;return i&&a.push(i),a}function ae(t,e,n,o){return"curly"===t?o?`M0,0 C${.6*n},0 ${.4*n},${e/2} ${n},${e/2} C${.4*n},${e/2} ${.6*n},${e} 0,${e}`:`M0,0 C0,${.6*n} ${e/2},${.4*n} ${e/2},${n} C${e/2},${.4*n} ${e},${.6*n} ${e},0`:o?`M0,0 L${n},0 L${n},${e} L0,${e}`:`M0,0 L0,${n} L${e},${n} L${e},0`}function ie(e){const{x:n=0,y:o=0,dx:r,dy:a,nx:i,ny:s,note:l,connector:c,subject:d,type:u,color:y,className:h,disable:p,events:f={},"data-testid":g}=e,m=new Set(Array.isArray(p)?p:[]);let x=r||0,v=a||0;null!=i&&(x=i-n),null!=s&&(v=s-o);const b="string"==typeof u?u:"label";if("bracket"===b&&d&&0===x&&0===v)if(void 0!==d.width){x=d.width/2;const t=d.depth||30;v=t+(0>t?-5:5)}else if(void 0!==d.height){const t=d.depth||30;x=t+(0>t?-5:5),v=d.height/2}return t.createElement("g",Object.assign({className:("annotation "+(h||"")).trim(),transform:`translate(${n},${o})`,"data-testid":g},f),!m.has("connector")&&function(e,n,o,r,a,i){const s=[];let l=0,c=0;if("callout-circle"!==a&&"label"!==a||!(null==i?void 0:i.radius)){if("callout-rect"===a&&i){const t=i.width||0,o=i.height||0;if(t>0||o>0){const r=t/2,a=o/2,i=e-r,s=n-a;if(0!==i||0!==s){const e=Math.abs(i),n=Math.abs(s),d=t/2,u=o/2,y=e*u>n*d?d/e:u/n;l=r+i*y,c=a+s*y}}}else if("bracket"===a&&i){const t=i.width,e=i.height,n=i.depth||30;void 0!==t?(l=t/2,c=n):void 0!==e&&(l=n,c=e/2)}}else{const t=(i.radius||0)+(i.radiusPadding||0);if(t>0&&(0!==e||0!==n)){const o=Math.atan2(n,e);l=Math.cos(o)*t,c=Math.sin(o)*t}}if(Math.sqrt(Math.pow(e-l,2)+Math.pow(n-c,2))>.5&&(s.push(t.createElement("line",{key:"connector-line",x1:l,y1:c,x2:e,y2:n,stroke:r||"currentColor"})),"arrow"===(null==o?void 0:o.end))){const o=10,a=16/180*Math.PI,i=Math.atan2(n-c,e-l);s.push(t.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+o*Math.cos(i+a)},${c+o*Math.sin(i+a)}L${l+o*Math.cos(i-a)},${c+o*Math.sin(i-a)}Z`,fill:r||"currentColor",stroke:"none"}))}return t.createElement("g",{className:"annotation-connector"},s)}(x,v,c,y,b,d),!m.has("subject")&&function(e,n,o,r,a){var i;const s=[];switch(e){case"callout-circle":{const e=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);e>0&&s.push(t.createElement("circle",{key:"subject-circle",r:e,fill:"none",stroke:o||"currentColor"}));break}case"callout-rect":{const e=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(e>0||r>0)&&s.push(t.createElement("rect",{key:"subject-rect",width:e,height:r,fill:"none",stroke:o||"currentColor"}));break}case"callout-custom":(null==n?void 0:n.custom)&&s.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const e=r||0,i=a||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-e;s.push(t.createElement("line",{key:"threshold-line",x1:r,y1:(n.y1||0)-i,x2:r,y2:(n.y2||0)-i,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-i;s.push(t.createElement("line",{key:"threshold-line",x1:(n.x1||0)-e,y1:r,x2:(n.x2||0)-e,y2:r,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?s.push(t.createElement("line",{key:"threshold-line",x1:(n.x1||0)-e,y1:0,x2:(n.x2||0)-e,y2:0,stroke:o||"currentColor",strokeDasharray:"5,5"})):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||s.push(t.createElement("line",{key:"threshold-line",x1:0,y1:(n.y1||0)-i,x2:0,y2:(n.y2||0)-i,stroke:o||"currentColor",strokeDasharray:"5,5"}));break}case"bracket":{const e=null!==(i=null==n?void 0:n.width)&&void 0!==i?i:null==n?void 0:n.height;void 0!==e&&s.push(t.createElement("path",{key:"bracket-path",d:ae((null==n?void 0:n.type)||"curly",e,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"currentColor"}));break}}return t.createElement("g",{className:"annotation-subject"},s)}(b,d,y,n,o),!m.has("note")&&function(e,n,o,r){if(!e)return t.createElement("g",{className:"annotation-note"});const{label:a,title:i,orientation:s,align:l,wrap:c=120,noWrap:d}=e;if(!a&&!i)return t.createElement("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let y=l;y&&"dynamic"!==y||(y="topBottom"===u?0>n?"right":"left":0>o?"bottom":"top");let h="start";"topBottom"===u?"right"===y?h="end":"middle"===y&&(h="middle"):h=0>n?"end":"start";const p=16,f=i?d?[i]:re(i,c):[],g=a?d?[a]:re(a,c):[],m="leftRight"===u?"end"===h?-4:4:0;let x=0;const v=[];f.length>0&&(v.push(t.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:r||void 0,textAnchor:h,fontWeight:"bold"},f.map((e,n)=>t.createElement("tspan",{key:n,x:m,dy:0===n?0:p},e)))),x=f.length*p),g.length>0&&v.push(t.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:r||void 0,textAnchor:h,y:x},g.map((e,n)=>t.createElement("tspan",{key:n,x:m,dy:p},e))));let b=null;if((i||a)&&(0!==n||0!==o))if("topBottom"===u){const e=Math.min(c,120);let n=0,o=e;"end"===h?(n=-e,o=0):"middle"===h&&(n=-e/2,o=e/2),b=t.createElement("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"currentColor"})}else{const e=(f.length+g.length)*p+(g.length>0?p:0);let n=0,o=e;"bottom"===y?(n=-e,o=0):"middle"===y&&(n=-e/2,o=e/2),b=t.createElement("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"currentColor"})}const k=(f.length+g.length)*p+(g.length>0?p:0);let E=0;return"topBottom"===u?0>o&&(E=-k):"leftRight"===u&&("middle"===y?E=-k/2:("bottom"===y||0>o)&&(E=-k)),t.createElement("g",{className:"annotation-note",transform:`translate(${n},${o})`},t.createElement("g",{className:"annotation-note-content",transform:0!==E?`translate(0,${E})`:void 0},v),b)}(l,x,v,y))}function se(e){const{noteData:n}=e,{screenCoordinates:o}=n,r="string"==typeof n.type?n.type:"label",a=n.eventListeners||n.events||{};if(n.coordinates&&o){const e=n.nx||o[0][0]+n.dx,a=n.ny||o[0][1]+n.dy,i=o.map((o,i)=>{const s=Object.assign({},n,{note:0===i?n.note:{label:""},x:o[0],y:o[1],nx:e,ny:a});return t.createElement(ie,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+i},s,{type:r}))});return t.createElement("g",null,i)}const i=n.note||{title:"none",label:n.label};return t.createElement(ie,Object.assign({"data-testid":"semiotic-annotation",key:`${i.label}-${i.title}-${n.i}`,events:a},n,{type:r}))}const le=(t,e,n,o)=>{const r=(t.note.label||t.note.title).length;return[Math.min(t.note.wrap||120,r*e)+2*o,Math.ceil(r*e/120)*n+2*o]};function ce(t){let e=new EventTarget,n=t(function(t){n=Object.assign(n,t(n)),e.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(t){return e.addEventListener("update",t),()=>e.removeEventListener("update",t)}}}let[de,ue]=function(e){let n=c(null),r=ce(e);return[function({children:r}){let a=o(()=>ce(e),[]);return t.createElement(n.Provider,{value:a,children:r})},t=>{var e;let o=null!==(e=d(n))&&void 0!==e?e:r;return function(t,e){const[n,o]=a(e);return u(()=>t(()=>o(e)),[t]),n}(o.subscribe,()=>t(o.getState()))}]}(t=>({tooltip:null,changeTooltip(e){t(()=>({tooltip:e}))}}));function ye(t,e,n){return"number"==typeof n?n:e&&e.find(e=>e.props.orient===t)?50:10}const he=(t,e,n)=>`${t.map(pe).join(",")}${JSON.stringify(e)}${n.join(",")}`;function pe(t){if(!t||!t.props||!t.props.noteData)return"";const{note:e={}}=t.props.noteData,{label:n,title:o}=e;return`${t.props.noteData.id||`${t.props.noteData.x}-${t.props.noteData.y}`}-${n}=${o}`}function fe(t,n=8,o){const{noteWidth:r=o}=t;let a=r;"number"==typeof r&&(a=()=>r);const i=t.note&&t.note.wrap||120,s=t.note.label||t.note.label||"";return r&&a(t)||(e.isValidElement(t.note)?100:Math.min(i,s.length*n))}function ge(t,n=8,o=20,r){const{noteHeight:a=r}=t;let i=a;"number"==typeof a&&(i=()=>a);const s=t.note&&t.note.wrap||120,l=t.note.label||t.note.title||"";return a&&i(t)||(e.isValidElement(t.note)?30:Math.ceil(l.length*n/s)*o+(t.note.label&&t.note.title?o:0))}const me=(t,e)=>e.map((e,n)=>t.svgAnnotationRule(e,n,t)).filter(t=>null!=t),xe=(e,n)=>{let o=n.adjustedAnnotations,r=n.adjustedAnnotationsKey,a=n.adjustableAnnotations,i=n.fixedAnnotations,s=[],l=[];const c=n.adjustedAnnotationsKey,d=n.adjustedAnnotationsDataVersion,{annotations:u,annotationHandling:y=!1,size:h,svgAnnotationRule:p,htmlAnnotationRule:f}=e,g="object"==typeof y?y:{layout:{type:y},dataVersion:""},{dataVersion:m=""}=g;if(p){const n=me(e,u);r=he(n,g,h),!1===y&&(o=a),o=o.length!==a.length||c!==r||d!==m?((e,n,o)=>{const{layout:r={type:!1,noteHeight:void 0,noteWidth:void 0}}=n;if(!1===r.type)return e;const{noteWidth:a,noteHeight:i}=r;let{margin:s={top:0,bottom:0,left:0,right:0}}=o;const{size:l,axes:c=[]}=o;if(s="number"==typeof s?{top:s,left:s,right:s,bottom:s}:s,"bump"===r.type)return function(t,e,n,o,r){const{padding:a=1,characterWidth:i=8,lineHeight:s=20,iterations:l=500,pointSizeFunction:c=o,labelSizeFunction:d=r||le}=e,u=t.map((t,e)=>{const n=(t.props.noteData.x[0]||t.props.noteData.x)+(void 0!==t.props.noteData.dx?t.props.noteData.dx:-10*(e%3-1)),o=(t.props.noteData.y[0]||t.props.noteData.y)+(void 0!==t.props.noteData.dy?t.props.noteData.dy:10*(e%3-1)),[r,l]=d(t.props.noteData,i,s,a);return{x:n,y:o,above:t.props.noteData.y>o,left:t.props.noteData.x>n,width:r,height:l,type:"label",name:"",originalNote:t}}),y=t.map(t=>({x:t.props.noteData.x,y:t.props.noteData.y,fx:t.props.noteData.x,fy:t.props.noteData.y,r:c&&c(t.props.noteData)||5,type:"point",originalNote:t})),h=function(){let t,e=[],n=[],o=1,r=1,a={start:t=>{},width:t=>{},height:t=>{},label:t=>{},anchor:t=>{},alt_energy:t=>{},alt_schedule:t=>{}},i=!1;const s=function(t){let o=e.length,r=0,a=e[t].x-n[t].x,i=n[t].y-e[t].y,s=Math.sqrt(a*a+i*i);s>0&&(r+=.2*s),a/=s,i/=s,r+=a>0&&i>0?0:0>a&&i>0?3:0>a&&0>i?6:9;let l,c,u,y,h,p,f,g=e[t].x,m=e[t].y-e[t].height+2,x=e[t].x+e[t].width,v=e[t].y+2;for(let a=0;o>a;a++)a!==t&&(d(n[t].x,e[t].x,n[a].x,e[a].x,n[t].y,e[t].y,n[a].y,e[a].y)&&(r+=1),l=e[a].x,u=e[a].y-e[a].height+2,c=e[a].x+e[a].width,y=e[a].y+2,h=Math.max(0,Math.min(c,x)-Math.max(l,g)),p=Math.max(0,Math.min(y,v)-Math.max(u,m)),f=h*p,r+=30*f),l=n[a].x-n[a].r,u=n[a].y-n[a].r,c=n[a].x+n[a].r,y=n[a].y+n[a].r,h=Math.max(0,Math.min(c,x)-Math.max(l,g)),p=Math.max(0,Math.min(y,v)-Math.max(u,m)),f=h*p,r+=30*f;return r},l=function(a){let l,c,d=Math.floor(Math.random()*e.length),u=e[d].x,y=e[d].y;l=i?t(d,e,n):s(d),e[d].x+=5*(Math.random()-.5),e[d].y+=5*(Math.random()-.5),e[d].x>o&&(e[d].x=u),0>e[d].x&&(e[d].x=u),e[d].y>r&&(e[d].y=y),0>e[d].y&&(e[d].y=y),c=i?t(d,e,n):s(d);let h=c-l;Math.random()<Math.exp(-h/a)||(e[d].x=u,e[d].y=y)},c=function(a){let l,c=Math.floor(Math.random()*e.length),d=e[c].x,u=e[c].y;l=i?t(c,e,n):s(c);let y=.5*(Math.random()-.5),h=Math.sin(y),p=Math.cos(y);e[c].x-=n[c].x,e[c].y-=n[c].y;let f,g=e[c].x*h+e[c].y*p;e[c].x=e[c].x*p-e[c].y*h+n[c].x,e[c].y=g+n[c].y,e[c].x>o&&(e[c].x=d),0>e[c].x&&(e[c].x=d),e[c].y>r&&(e[c].y=u),0>e[c].y&&(e[c].y=u),f=i?t(c,e,n):s(c);let m=f-l;Math.random()<Math.exp(-m/a)||(e[c].x=d,e[c].y=u)},d=function(t,e,n,o,r,a,i,s){let l,c,d,u,y;return d=(s-i)*(e-t)-(o-n)*(a-r),u=(o-n)*(r-i)-(s-i)*(t-n),y=(e-t)*(r-i)-(a-r)*(t-n),l=u/d,c=y/d,!(0>l||l>1||0>c||c>1)},u=function(t,e,n){return t-e/n};return a.start=function(t){let n=e.length,o=1;for(let e=0;t>e;e++){for(let t=0;n>t;t++).5>Math.random()?l(o):c(o);o=u(o,1,t)}},a.width=function(t){return arguments.length?(o=t,a):o},a.height=function(t){return arguments.length?(r=t,a):r},a.label=function(t){return arguments.length?(e=t,a):e},a.anchor=function(t){return arguments.length?(n=t,a):n},a.alt_energy=function(e){return arguments.length?(t=e,i=!0,a):s},a.alt_schedule=function(t){return arguments.length?a:u},a}();return h.label(u),h.anchor(y),h.width(n[0]),h.height(n[1]),h.start(l),u.forEach(t=>{if("label"===t.type){const e=function(t,e,n){return t.y>e.y?[e.x+e.width/2+n/2,e.y-e.height+n/2]:[e.x+e.width/2,e.y]}(t.originalNote.props.noteData,t,a);t.originalNote.props.noteData.nx=e[0],t.originalNote.props.noteData.ny=e[1]}}),t}(e,r,l,o.pointSizeFunction,o.labelSizeFunction);if("marginalia"===r.type){const{marginOffset:n,orient:o="nearest",characterWidth:d=8,lineHeight:u=20,padding:y=2,axisMarginOverride:h={}}=r,p="nearest"===o?["left","right","top","bottom"]:Array.isArray(o)?o:[o],f=p.find(t=>"left"===t),g=p.find(t=>"right"===t),m=p.find(t=>"top"===t),x=p.find(t=>"bottom"===t),v=[],b=[],k=[],E=[];for(const t of e){const e=t.props.noteData,n=e.x[0]||e.x,o=e.y[0]||e.y,r=f?n:1/0,a=g?l[0]-n:1/0,i=m?o:1/0,s=Math.min(r,a,i,x?l[1]-o:1/0);r===s?v.push(t):a===s?b.push(t):i===s?k.push(t):E.push(t)}const A=new J.Force({minPos:void 0!==h.top?0+h.top:0-s.top,maxPos:void 0!==h.bottom?l[1]-h.bottom:x?l[1]:l[1]+s.bottom}).nodes(v.map(t=>new J.Node(t.props.noteData.y[0]||t.props.noteData.y,ge(t.props.noteData,d,u,a)+y))).compute(),M=new J.Force({minPos:void 0!==h.top?0+h.top:m?0:0-s.top,maxPos:void 0!==h.bottom?l[1]-h.bottom:l[1]+s.bottom}).nodes(b.map(t=>new J.Node(t.props.noteData.y[0]||t.props.noteData.y,ge(t.props.noteData,d,u,a)+y))).compute(),$=new J.Force({minPos:void 0!==h.left?0+h.left:f?0:0-s.left,maxPos:void 0!==h.right?l[0]-h.right:l[0]+s.right}).nodes(k.map(t=>new J.Node(t.props.noteData.x[0]||t.props.noteData.x,fe(t.props.noteData,d,i)+y))).compute(),w=new J.Force({minPos:void 0!==h.left?0+h.left:0-s.left,maxPos:void 0!==h.right?l[0]-h.right:g?l[0]:l[0]+s.right}).nodes(E.map(t=>new J.Node(t.props.noteData.x[0]||t.props.noteData.x,fe(t.props.noteData,d,i)+y))).compute(),S=Math.max(...E.map(t=>ge(t.props.noteData,d,u,a)+y)),P=Math.max(...k.map(t=>ge(t.props.noteData,d,u,a)+y)),D=Math.max(...v.map(t=>fe(t.props.noteData,d,i)+y)),j=Math.max(...b.map(t=>fe(t.props.noteData,d,i)+y)),N=A.nodes(),O=M.nodes(),W=$.nodes(),C=w.nodes();return v.forEach((e,o)=>{const r=0-N[o].layerIndex*D-ye("left",c,n),a=N[o].currentPos;e.props.noteData.nx=r,e.props.noteData.ny=a,e.props.noteData.note&&!t.isValidElement(e)&&(e.props.noteData.note.orientation=e.props.noteData.note.orientation||"leftRight",e.props.noteData.note.align=e.props.noteData.note.align||"right")}),b.forEach((e,o)=>{const r=l[0]+O[o].layerIndex*j+ye("right",c,n),a=O[o].currentPos;e.props.noteData.nx=r,e.props.noteData.ny=a,e.props.noteData.note&&!t.isValidElement(e)&&(e.props.noteData.note.orientation=e.props.noteData.note.orientation||"leftRight",e.props.noteData.note.align=e.props.noteData.note.align||"left")}),k.forEach((t,e)=>{const o=W[e].currentPos,r=0-W[e].layerIndex*P-ye("top",c,n);t.props.noteData.nx=o,t.props.noteData.ny=r}),E.forEach((t,e)=>{const o=C[e].currentPos,r=l[1]+C[e].layerIndex*S+ye("bottom",c,n);t.props.noteData.nx=o,t.props.noteData.ny=r}),e}return e})(a,g,e):a.map((e,n)=>{const r=Object.assign(Object.assign({},o[n].props.noteData),e.props.noteData);return t.createElement(se,{key:e.key,noteData:r})}),s=[...o,...i]}return f&&(l=((t,e)=>e.map((e,n)=>t.htmlAnnotationRule(e,n,t)).filter(t=>null!=t))(e,u)),{svgAnnotations:s,htmlAnnotations:l,adjustedAnnotations:o,adjustedAnnotationsKey:r,adjustedAnnotationsDataVersion:m}};function ve(e){const{legendSettings:n,margin:o,size:r,annotations:i,annotationHandling:l}=e,c=ue(t=>t.tooltip);let d=null!=c?i.concat(c):i,u=ue(t=>t.changeTooltip);const y=Object.assign(Object.assign({},e),{annotations:d,voronoiHover:t=>{u(t)}}),h="object"==typeof l?l:{layout:{type:l},dataVersion:""},{dataVersion:p=""}=h,[f,g]=a([]),[m,x]=a([]),[v,b]=a([]),[k,E]=a(""),[A,M]=a(p),$=me(y,d),w=$.filter(t=>t.props&&t.props.noteData&&!t.props.noteData.fixedPosition),S=he(w,h,r);let P;if(s(()=>{const t=$.filter(t=>!t.props||!t.props.noteData||t.props.noteData.fixedPosition),e=xe(y,{adjustedAnnotations:f,adjustedAnnotationsKey:k,adjustedAnnotationsDataVersion:A,adjustableAnnotations:w,fixedAnnotations:t});g(e.adjustedAnnotations),E(e.adjustedAnnotationsKey),M(e.adjustedAnnotationsDataVersion),x(e.svgAnnotations),b(e.htmlAnnotations)},[S,p,d.length,d.map(t=>function(t){const e=new Set;return JSON.stringify(t,(t,n)=>e.has(n)?"...":"object"==typeof n?(e.add(n),"note"===t?`${n.label}-${n.title}`:"connector"===t?`${n.end}-${n.type}`:"subject"===t?""+n.radius:"object"==typeof n.column?`${n.column.x}-${n.column.y}-${n.column.name}`:n.voronoiX||n.voronoiY||n.x||n.y||n.dx||n.dy||n.label||n.type||n.key||n.hierarchicalID||n.id||n.name?`${n.voronoiX}-${n.voronoiY}-${n.dx}-${n.dy}-${n.x}-${n.y}-${n.label}-${n.type}-${n.key}-${n.hierarchicalID}-${n.id}-${n.name}`:"..."):n)}(t)).join("-")]),n){const e={left:[15,15],right:[r[0]+15,15]},{position:o="right",title:a="Legend"}=n;P=t.createElement("g",{transform:`translate(${e[o].join(",")})`},t.createElement(oe,Object.assign({},n,{title:a,position:o})))}return 0!==d.length||n?t.createElement("div",{className:"annotation-layer",style:{position:"absolute",pointerEvents:"none",background:"none"}},t.createElement("svg",{className:"annotation-layer-svg",height:r[1],width:r[0],style:{background:"none",pointerEvents:"none",position:"absolute",left:o.left+"px",top:o.top+"px",overflow:"visible"}},t.createElement("g",null,P,m)),t.createElement("div",{className:"annotation-layer-html",style:{background:"none",pointerEvents:"none",position:"absolute",height:r[1]+"px",width:r[0]+"px",left:o.left+"px",top:o.top+"px"}},v)):null}const be=t=>t instanceof Date?t.getTime():t,ke=({type:t="stackedarea",data:e,xProp:n,yProp:o,yPropMiddle:r,sort:a,yPropTop:i,yPropBottom:s})=>{const l=new Map,c=e.map(()=>0);let d=0;for(const t of e){t.__lineIndex=d;for(const e of t.data){const t=be(e[n]);c[d]+=e[o],l.has(t)||l.set(t,[]),l.get(t)[d]=e}d++}let u=(t,e)=>c[e.key]-c[t.key];"stackedpercent-invert"!==t&&"stackedarea-invert"!==t||(u=(t,e)=>c[t.key]-c[e.key]),null!==(a=void 0===a?u:a)&&(e=e.sort(a));const y=e.map(t=>t.__lineIndex);for(const[,e]of l){let n=0,a=0;const l=I(e,t=>(null==t?void 0:t[o])>0?t[o]:0),c=I(e,t=>0>(null==t?void 0:t[o])?t[o]:0);for(const d of y){const u=e[d];if(u)if(0>u[o]){if("linepercent"===t||"stackedpercent"===t||"stackedpercent-invert"===t){const e=u[o]/c;if(u.percent=e,"linepercent"===t)u[s]=u[s]=u[i]=u[r]=e;else{const t=0>c?e:0;u[s]=0===c?0:-n/c,u[i]=u[s]-t,u[r]=u[s]-t/2}}else u[s]=n,u[i]=n+u[o],u[r]=n+u[o]/2;n+=u[o]}else{if("linepercent"===t||"stackedpercent"===t||"stackedpercent-invert"===t){const e=u[o]/l;if(u.percent=e,"linepercent"===t)u[s]=u[i]=u[r]=e;else{const t=l>0?e:0;u[s]=0===l?0:a/l,u[i]=u[s]+t,u[r]=u[s]+t/2}}else u[s]=a,u[i]=a+u[o],u[r]=a+u[o]/2;a+=u[o]}}}return e},Ee=({data:t,y1:e,x1:n,yPropTop:o,yPropMiddle:r,yPropBottom:a,xPropTop:i,xPropMiddle:s,xPropBottom:l})=>{if(e)for(const n of t)for(const t of n.data)t[a]=e(t),t[r]=t[o];if(n)for(const e of t)for(const t of e.data)t[l]=n(t),t[s]=(t[l]+t[i])/2;return t},Ae=({data:t,y1:e,yPropTop:n,yPropMiddle:o,yPropBottom:r,type:a="cumulative"})=>{for(const i of t){let t=0;const s="cumulative-reverse"===a?i.data.reverse():i.data;for(const a of s)t+=a[n],a[r]=a[n]=a[o]=t,e&&(a[r]=e(a),a[o]=a[r]+a[n]/2)}return t},Me=({type:t="bumpline",data:e,xProp:n,yProp:o,yPropMiddle:r,yPropTop:a,yPropBottom:i})=>{const s=new Map;for(const t of e)for(const e of t.data){const t=be(e[n]);s.has(t)||s.set(t,[]),s.get(t).push(e)}let l=(t,e)=>t[o]>e[o]?1:-1;"bumparea-invert"!==t&&"bumpline-invert"!==t||(l=(t,e)=>e[o]>t[o]?1:-1);for(const[,e]of s){let n=0,s=0;e.sort(l);let c=1;for(const l of e)"bumparea"===t||"bumparea-invert"===t?0>l[o]?(l[a]=n+l[o],l[r]=n+l[o]/2,l[i]=n,n+=l[o]):(l[a]=s+l[o],l[r]=s+l[o]/2,l[i]=s,s+=l[o]):(l[o]=c,l[a]=c,l[i]=c),c++}return e},$e="x",we="y",Se="yMiddle",Pe="yTop",De="yBottom",je="xMiddle",Ne="xTop",Oe="xBottom",We=(t,e,n,o)=>[...t.map((t,o)=>[t[0],t[1]+n(e[o])]),...t.map((t,n)=>[t[0],t[1]-o(e[n])]).reverse()],Ce=t=>t&&t.extent||Array.isArray(t)&&t||[],_e=()=>!0,Le={top:Pe,bottom:De,orphan:we},ze={top:Ne,bottom:Oe,orphan:$e},Fe={stackedarea:ke,"stackedarea-invert":ke,stackedpercent:ke,"stackedpercent-invert":ke,linepercent:ke,difference:({data:t,yProp:e,yPropTop:n,yPropBottom:o})=>(t.forEach((r,a)=>{r.data.forEach((r,i)=>{const s=0===a?1:0;r[e]>t[s].data[i][e]?(r[o]=t[s].data[i][e],r[n]=r[e]):(r[n]=r[e],r[o]=r[e])})}),t),bumparea:Me,bumpline:Me,"bumparea-invert":Me,line:Ee,area:Ee,cumulative:Ae,"cumulative-reverse":Ae};function Te(t,e){const n=[];for(const t of e)n.push(Object.assign({},t));for(const e of t)e.parentSummary||n.push(e);return n}const Be=({lineDataAccessor:e,xAccessor:n,yAccessor:o,summaries:r,points:a,lines:i,lineType:s,showLinePoints:l,showSummaryPoints:c,xExtent:d,yExtent:u,invertX:y,invertY:h,summaryDataAccessor:p,summaryType:f,adjustedSize:g,margin:m,summaryStyleFn:x,summaryClassFn:v,summaryRenderModeFn:b,chartSize:k,filterRenderedLines:E,filterRenderedSummaries:A,filterRenderedPoints:M,defined:$=_e,annotations:w=[]})=>{let S=[],P=[],D=[],j=[],O=[];if(a){n.forEach((t,e)=>{o.forEach((n,o)=>{let r=0;for(const i of a){const a=t(i,r),s=n(i,r),l={x:a,y:s,data:i,xIndex:e,yIndex:o};Array.isArray(s)&&(l[De]=Math.min(...s),l[Pe]=Math.max(...s),l[Se]=(l[De]+l[Pe])/2),Array.isArray(a)&&(l[Oe]=Math.min(...a),l[Ne]=Math.max(...a),l[je]=(l[Oe]+l[Ne])/2),D.push(l),r++}})});for(const t of D)S.push(Object.assign(Object.assign({},t),{[$e]:t[Ne]||t[Oe]||t.x,[we]:t[Pe]||t[De]||t.y}))}if(i){P=(({data:t,lineDataAccessor:e,xProp:n,xPropTop:o,xPropBottom:r,yProp:a,yPropTop:i,yPropBottom:s,xAccessor:l,yAccessor:c})=>{Array.isArray(t)||(t=[t]);const d=[];return e.forEach((e,u)=>{l.forEach((l,y)=>{c.forEach((c,h)=>{t.forEach(t=>{const p=Object.assign(Object.assign({},t),{xIndex:y,yIndex:h,lineIndex:u});p.data=e(t).map((t,e)=>{const d={data:t};return d[n]=l(t,e),d[o]=d[n],d[r]=d[n],d[a]=c(t,e),d[i]=d[a],d[s]=d[a],d}),p.key=p.key||d.length,d.push(p)})})})}),d})({data:i,lineDataAccessor:e,xProp:$e,xPropTop:Ne,xPropBottom:Oe,yProp:we,yPropTop:Pe,yPropBottom:De,xAccessor:n,yAccessor:o}),j=function(t,e){return n=>Fe[Ie(t.type,n)](Object.assign(Object.assign(Object.assign({},t),e),{data:n}))}(s,{xProp:$e,yProp:we,yPropMiddle:Se,yPropTop:Pe,yPropBottom:De,xPropMiddle:je,xPropTop:Ne,xPropBottom:Oe})(P);for(const t of j)for(let e=0;t.data.length>e;e++){const n=t.data[e];if(!$(Object.assign({},n.data,n),e))continue;const o={parentLine:t,y:n.y,x:n.x,xTop:n.xTop,xMiddle:n.xMiddle,xBottom:n.xBottom,yTop:n.yTop,yMiddle:n.yMiddle,yBottom:n.yBottom,data:n.data};n.percent&&(o.percent=n.percent),S.push(o)}if(l){const t=!0===l?je:ze[l],e=!0===l?Se:Le[l];j.forEach(n=>{n.data.filter((t,e)=>{if($(Object.assign({},t.data,t))){if("orphan"===l){const t=n.data[e-1],o=n.data[e+1];return!(t&&$(Object.assign({},t.data,t))||o&&$(Object.assign({},o.data,o)))}return!0}return!1}).forEach(o=>{D.push(Object.assign(Object.assign({},o),{parentLine:n,[we]:void 0!==o[e]?o[e]:void 0!==o[Se]?o[Se]:void 0!==o[De]?o[De]:o.y,[$e]:void 0!==o[t]?o[t]:void 0!==o[je]?o[je]:void 0!==o[Oe]?o[Oe]:o.y}))})})}}r&&(O=(({data:t,summaryDataAccessor:e,xAccessor:n,yAccessor:o})=>{const r=[];return e.forEach(e=>{n.forEach(n=>{o.forEach(o=>{const a=t=>e(t).map((t,e)=>[n(t,e),o(t,e)]);t.forEach(t=>{r.push(Object.assign(Object.assign({},t),{_baseData:e(t),_xyfCoordinates:a(t)}))})})})}),r})({data:r,summaryDataAccessor:p,xAccessor:n,yAccessor:o}),O.forEach(t=>{const e=t._baseData;t._xyfCoordinates.length>0&&t._xyfCoordinates[0][0][0]?t._xyfCoordinates[0].forEach(n=>{Array.isArray(n)&&n.map((n,o)=>Object.assign({parentSummary:t},e[o],{[$e]:n[0],[we]:n[1]})).forEach(t=>{c&&D.push(Object.assign(Object.assign({x:0},t),{[we]:t[Pe]||t[De]||t[we]})),S.push(Object.assign({x:0,y:0},t))})}):t._xyfCoordinates.length>0&&Array.isArray(t._xyfCoordinates)&&t._xyfCoordinates.map((n,o)=>Object.assign(Object.assign({parentSummary:t},e[o]),{[$e]:n[0],[we]:n[1]})).forEach(t=>{c&&D.push(Object.assign(Object.assign({x:0},t),{[we]:t[Pe]||t[De]||t[we]})),S.push(Object.assign({x:0,y:0},t))})}));let W,C,_,L,F=[],T=[];d&&!Array.isArray(d)&&!0===d.includeAnnotations&&n.forEach(t=>{w.forEach((e,n)=>{const o=t(e,n);isFinite(o)&&F.push({[$e]:o})})}),u&&!Array.isArray(u)&&!0===u.includeAnnotations&&o.forEach(t=>{w.forEach((e,n)=>{const o=t(e,n);isFinite(o)&&T.push({[we]:o})})});for(const t of S){const e=void 0===t[Oe]?t[$e]:Math.min(t[Ne],t[Oe]),n=void 0===t[Ne]?t[$e]:Math.max(t[Oe],t[Ne]),o=void 0===t[De]?t[we]:Math.min(t[Pe],t[De]),r=void 0===t[Pe]?t[we]:Math.max(t[De],t[Pe]);void 0===e||void 0!==W&&e>=W||(W=e),void 0===n||void 0!==C&&C>=n||(C=n),void 0===o||void 0!==_&&o>=_||(_=o),void 0===r||void 0!==L&&L>=r||(L=r)}for(const t of F){const e=t[$e];void 0===e||void 0!==W&&e>=W||(W=e),void 0===e||void 0!==C&&C>=e||(C=e)}for(const t of T){const e=t[we];void 0===e||void 0!==_&&e>=_||(_=e),void 0===e||void 0!==L&&L>=e||(L=e)}const B=[W,C],I=[_,L],R=Ce(d),Y=Ce(u);let X=[Y&&void 0!==Y[0]?Y[0]:I[0],Y&&void 0!==Y[1]?Y[1]:I[1]],G=[R&&void 0!==R[0]?R[0]:B[0],R&&void 0!==R[1]?R[1]:B[1]];if(!y||R&&2===R.length||(G=[G[1],G[0]]),"bumpline"!==s.type&&!h||Y&&2===Y.length||(X=[X[1],X[0]]),f.type&&"contour"===f.type)O=function({summaryType:t,data:e,finalXExtent:n,finalYExtent:o}){let r=[];t.type||(t={type:t});const{resolution:a=500,thresholds:i=10,bandwidth:s=20,neighborhood:l}=t,c=z().domain(n).rangeRound([0,a]).nice(),d=z().domain(o).rangeRound([a,0]).nice();return e.forEach(t=>{let e=U().size([a,a]).x(t=>c(t[0])).y(t=>d(t[1])).thresholds(i).bandwidth(s)(t._xyfCoordinates);l&&(e=[e[0]]);const n=Math.max(...e.map(t=>t.value));e.forEach(e=>{e.parentSummary=t,e.bounds=[],e.percent=e.value/n,e.coordinates.forEach(t=>{t.forEach((n,o)=>{t[o]=n.map(t=>[c.invert(t[0]),d.invert(t[1])]),0===o&&e.bounds.push(function(t){let e=[1/0,0],n=[-1/0,0],o=[0,1/0],r=[0,-1/0];return t.forEach(t=>{e=e[0]>t[0]?t:e,n=t[0]>n[0]?t:n,r=t[1]>r[1]?t:r,o=o[1]>t[1]?t:o}),{center:[(e[0]+n[0])/2,(o[1]+r[1])/2],top:o,left:e,right:n,bottom:r}}(t[o]))})})}),r=[...r,...e]}),r}({summaryType:f,data:O,finalXExtent:G,finalYExtent:X});else if(f.type&&"linebounds"===f.type){if(O=function({summaryType:t,data:e,defined:n}){let o=[];t.type||(t={type:t});const{boundingAccessor:r,topBoundingAccessor:a=r,bottomBoundingAccessor:i=r}=t;return e.forEach(t=>{const e=t._baseData.map(n);let r=[],s=[];const l=[{xyf:s,base:r}];e.forEach((n,o)=>{!0===n?(r.push(t._baseData[o]),s.push(t._xyfCoordinates[o])):e[o+1]&&(r=[],s=[],l.push({xyf:s,base:r}))}),l.forEach(({xyf:e,base:n})=>{const r={data:t,parentSummary:t,_xyfCoordinates:We(e,n,a,i)};o=[...o,r]})}),o}({summaryType:f,data:O,defined:$}),!Y||2!==Y.length)for(const t of O)for(const e of t._xyfCoordinates){const t=e[1];void 0!==t&&isFinite(t)&&(X[0]>t&&(X[0]=t),t>X[1]&&(X[1]=t))}}else f.type&&"hexbin"===f.type?(O=function({preprocess:e=!0,processedData:n=!1,summaryType:o,data:r,finalXExtent:a,finalYExtent:i,size:s,xScaleType:l=z(),yScaleType:c=z(),margin:d,styleFn:u,classFn:y,renderFn:h,chartSize:p}){let f=a,g=i;if(!f){const t=r.coordinates.map(t=>t.x);f=[Math.min(...t),Math.max(...t)]}if(!g){const t=r.coordinates.map(t=>t.y);g=[Math.min(...t),Math.max(...t)]}if(n&&r)return r.coordinates;let m,x=[];m=o.type?o:{type:m};const{bins:v=.05,cellPx:b,binValue:k=t=>t.length,binMax:E,customMark:A}=m;r.coordinates&&!r._xyfCoordinates&&(r._xyfCoordinates=r.coordinates.map(t=>[t.x,t.y]));const M=Array.isArray(r)?r:[r],$=l.domain(f).range([0,s[0]]),w=c.domain(g).range([0,s[1]]),S=b&&b/2||(v>1?1/v:v)*s[0]/2,P=tt().x(t=>$(t._xyfPoint[0])).y(t=>w(t._xyfPoint[1])).radius(S).size(s);let D;const j=P.centers();return M.forEach(e=>{D=0;const n=P(e._xyfCoordinates.map((t,n)=>Object.assign({_xyfPoint:t},e.coordinates[n]))),o={};n.forEach(t=>{o[`${parseInt(t.x)}-${parseInt(t.y)}`]=!0}),j.forEach(t=>{if(!o[`${parseInt(t[0])}-${parseInt(t[1])}`]){const e=[];e.x=t[0],e.y=t[1],n.push(e)}}),D=Math.max(...n.map(t=>k(t))),E&&E(D);const r=[[0,-1],[.866,-.5],[.866,.5],[0,1],[-.866,.5],[-.866,-.5]],a=$.invert(S)-f[0],i=w.invert(S)-g[0],l=r.map(t=>[t[0]*a,t[1]*i]),c=n.map(n=>{const o=k(n),a=n.x,i=n.y;n.x=$.invert(n.x),n.y=w.invert(n.y);const c=o/D;return{customMark:A&&t.createElement("g",{transform:`translate(${a},${s[1]-i})`},A({d:Object.assign(Object.assign({},n),{binItems:n,percent:c,value:o,radius:S,hexCoordinates:r.map(t=>[t[0]*S,t[1]*S])}),margin:d,styleFn:u,classFn:y,renderFn:h,chartSize:p,adjustedSize:s})),_xyfCoordinates:l.map(t=>[t[0]+n.x,t[1]+n.y]),value:o,percent:c,data:n,parentSummary:e,centroid:!0}});x=[...x,...c]}),e?(x.forEach(t=>{t.x=t.data.x,t.y=t.data.y}),{type:"hexbin",processedData:!0,coordinates:x,binMax:D}):x}({summaryType:f,data:O[0],processedData:r&&!!r[0].processedData,preprocess:!1,finalXExtent:G,finalYExtent:X,size:g,margin:m,styleFn:x,classFn:v,renderFn:b,chartSize:k}),S=Te(S,O)):f.type&&"heatmap"===f.type?(O=function({preprocess:e=!0,processedData:n=!1,summaryType:o,data:r,finalXExtent:a=[Math.min(...r.coordinates.map(t=>t.x)),Math.max(...r.coordinates.map(t=>t.x))],finalYExtent:i=[Math.min(...r.coordinates.map(t=>t.y)),Math.max(...r.coordinates.map(t=>t.y))],size:s,xScaleType:l=z(),yScaleType:c=z(),margin:d,styleFn:u,classFn:y,renderFn:h,chartSize:p}){if(n&&r)return r.coordinates;r.coordinates&&!r._xyfCoordinates&&(r._xyfCoordinates=r.coordinates.map(t=>[t.x,t.y]));const f=Array.isArray(r)?r:[r];let g,m=[];g=o.type?o:{type:g};const{binValue:x=t=>t.length,xBins:v=g.yBins||.05,yBins:b=v,xCellPx:k=!g.xBins&&g.xCellPx,yCellPx:E=!g.yBins&&g.yCellPx,customMark:A,binMax:M}=g,$=1>v?v:1/v,w=1>b?b:1/b,S=l.domain(a).range([0,s[0]]),P=c.domain(i).range([s[1],0]),D=[Math.ceil((k&&k/s[0]||$)*s[0]*10)/10,Math.ceil((E&&E/s[1]||w)*s[1]*10)/10];let j=-1/0;return f.forEach(e=>{const n=[],o=[];let r,a;for(let t=0;s[0]>Math.ceil(t);t+=D[0]){const i=S.invert(t),l=S.invert(t+D[0]);a=[],n.push(a);for(let n=0;s[1]>Math.ceil(n);n+=D[1]){const s=P.invert(n),c=P.invert(n+D[1]);r={gx:t,gy:n,gw:D[0],gh:D[1],x:(i+l)/2,y:(s+c)/2,binItems:[],value:0,_xyfCoordinates:[[i,s],[l,s],[l,c],[i,c]],parentSummary:e},a.push(r),o.push(r)}a.push(r)}n.push(a),e._xyfCoordinates.forEach((t,o)=>{const r=S(t[0]),a=P(t[1]),i=Math.floor(r/D[0]),s=Math.floor(a/D[1]);n[i][s]&&n[i][s].binItems.push(e.coordinates[o])}),o.forEach(t=>{t.value=x(t.binItems),j=Math.max(j,t.value)}),o.forEach(e=>{e.percent=e.value/j,e.customMark=A&&t.createElement("g",{transform:`translate(${e.gx},${e.gy})`},A({d:e,margin:d,styleFn:u,classFn:y,renderFn:h,chartSize:p,adjustedSize:s}))}),m=[...m,...o]}),M&&M(j),e?{type:"heatmap",processedData:!0,_baseData:[],_xyfCoordinates:[],data:[],bounds:[],x:0,y:0,coordinates:m,binMax:j}:m}({summaryType:f,data:O[0],processedData:r&&!!r[0].processedData,preprocess:!1,finalXExtent:G,finalYExtent:X,size:g,margin:m,styleFn:x,classFn:v,renderFn:b,chartSize:k}),S=Te(S,O)):f.type&&"trendline"===f.type&&(O=function({preprocess:t=!1,summaryType:e,data:n,finalXExtent:o=[Math.min(...n.coordinates.map(t=>t.x)),Math.max(...n.coordinates.map(t=>t.x))],xScaleType:r=z()}){if(t)return n[0].coordinates;let a,i=[];a=e.type?e:{type:a};const{regressionType:s="linear",order:l=2,precision:c=4,controlPoints:d=20,curve:u=N}=a;let y=s;o[0]>=0||"logarithmic"!==s&&"power"!==s&&"exponential"!==s||(console.error(`Cannot use this ${s} regressionType type with value range that goes below 0, defaulting to linear`),y="linear"),n.coordinates&&!n._xyfCoordinates&&(n._xyfCoordinates=n.coordinates.map(t=>[t.x,t.y]));const h=Array.isArray(n)?n:[n],p=r.domain([0,1]).range(o);return i=[],h.forEach(t=>{const e=Q[y](t._xyfCoordinates.map(t=>{let e=t[0],n=t[1];return"number"!=typeof e&&(e=e.getTime()),"number"!=typeof n&&(n=n.getTime()),[e,n]}),{order:l,precision:c}),n=1/d;let o=[0,1];if("linear"!==y){o=[];for(let t=0;1+n>t;t+=n)o.push(t)}const r=[];o.forEach(t=>{r.push(e.predict(p(t)))}),i.push({centroid:!1,customMark:void 0,data:t,parentSummary:t,value:e.string,r2:e.r2,curve:u,_xyfCoordinates:r})}),i}({summaryType:f,data:O[0],preprocess:r&&!!r[0].processedData,finalXExtent:G}),S=Te(S,O));return E&&(j=j.filter(E),S=S.filter((t,e)=>!t.parentLine||E(t.parentLine,e,[]))),M&&(S=S.filter(M)),A&&(O=O.filter(A),S=S.filter((t,e)=>!t.parentSummary||A(t.parentSummary,e,[]))),{xExtent:G,yExtent:X,projectedLines:j,projectedPoints:D,projectedSummaries:O,fullDataset:S,calculatedXExtent:B,calculatedYExtent:I}},Ie=(t,e)=>!Fe[t]||"difference"===t&&2!==e.length?"line":t;function Re(t,e,n){return e.parent&&(n=`${n}-${Re(t,Object.assign(Object.assign({},e.parent),e.parent.data),n)}`),`${n}-${t(Object.assign(Object.assign({},e),e.data))}`}const Ye=t=>t.id||t.descendantIndex,Xe=(t,e=Ye)=>{var n,o;const r=[],a=[],i=(t.descendants?t:X(t)).descendants();let s=0;for(const t of i)t.descendantIndex=s,s++;for(const t of i){const i=`${null!==(n=e(Object.assign(Object.assign({},t),t.data)))&&void 0!==n?n:Ye(t)}-${t.parent?null!==(o=Re(e,Object.assign(Object.assign({},t.parent),t.parent.data),""))&&void 0!==o?o:t.parent.name:"root"}`,s=Object.assign(t,t.data||{},{hierarchicalID:i});if(a.push(s),null!==t.parent){const e=Object.assign(t.parent,t.parent.data||{});r.push({source:e,target:s,depth:t.depth,weight:1,value:1,_NWFEdgeKey:i})}}return{edges:r,nodes:a}},Ge={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 Ve(t,e){return"function"==typeof e?e(t):t[e]}function He(t,e){return e?e(t):null==t?"":"number"==typeof t?t.toLocaleString():t instanceof Date?t.toLocaleDateString():"object"==typeof t&&null!==t?void 0!==t.id?t.id+"":void 0!==t.name?t.name+"":JSON.stringify(t):t+""}function qe(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:n,title:o,format:r,style:a={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const l=[];if(o){const t=Ve(e,o);s=He(t,r)}if(n&&n.length>0)n.forEach(t=>{let n,o,a;"string"==typeof t?(n=t,o=t,a=r):(n=t.label,o=t.accessor||t.key||"",a=t.format||r);const i=Ve(e,o);l.push({label:n,value:He(i,a)})});else if(!o){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=He(e[n],r);break}if(!s){const t=Object.keys(e).filter(t=>!t.startsWith("_"));t.length>0&&(s=He(e[t[0]],r))}}const c=Object.assign(Object.assign({},Ge),a);return t.createElement("div",{className:("semiotic-tooltip "+i).trim(),style:c},s&&t.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},s),l.map((e,n)=>t.createElement("div",{key:n,style:{marginTop:0===n&&s?"4px":0}},e.label&&t.createElement("span",null,e.label,": "),e.value)))}}(e)))}const Ke="#007bff";function Ze(t,e,n="category10"){return o(()=>{if(e&&"function"!=typeof e)return Ft(t,e,n)},[t,e,n])}function Je({componentName:e,message:n,width:o,height:r}){return t.createElement("div",{role:"alert",style:{width:o,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"}},t.createElement("div",{style:{textAlign:"center",maxWidth:400}},t.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},e),t.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},n)))}function Qe({data:t,dataLabel:e="data"}){return null==t?`No ${e} provided. Pass a hierarchical data object to the ${e} prop.`:null}function Ue({nodes:t,edges:e,nodesRequired:n=!1,edgesRequired:o=!0,accessors:r}){if(o&&(!e||!Array.isArray(e)||0===e.length))return"No edges provided. Pass a non-empty array to the edges prop.";if(n&&(!t||!Array.isArray(t)||0===t.length))return"No nodes provided. Pass a non-empty array to the nodes prop.";if(r&&t&&t.length>0){const e=t[0];if(e&&"object"==typeof e)for(const[t,n]of Object.entries(r))if(n&&"string"==typeof n&&!(n in e))return`${t} "${n}" not found in node data. Available fields: ${Object.keys(e).join(", ")}.`}return null}function tn(e){const{nodes:n,edges:r,width:a=600,height:i=600,margin:s,className:l,title:c,nodeIDAccessor:d="id",sourceAccessor:u="source",targetAccessor:y="target",nodeLabel:h,colorBy:p,colorScheme:f="category10",nodeSize:g=8,nodeSizeRange:m=[5,20],edgeWidth:x=1,edgeColor:v="#999",edgeOpacity:b=.6,iterations:k=300,forceStrength:E=.1,showLabels:A=!1,enableHover:M=!0,showLegend:$,tooltip:w,frameProps:S={}}=e,P=n||[],D=r||[],j=Ze(P,p,f),N=o(()=>t=>{const e={};return e.fill=p?zt(t.data||t,p,j):Ke,"number"==typeof g&&(e.r=g),e},[p,j,g]),O=o(()=>t=>({stroke:v,strokeWidth:"number"==typeof x?x:"function"==typeof x?x(t):t[x]||1,opacity:b}),[x,v,b]),W=o(()=>{if(A&&h)return"function"==typeof h?h:t=>t[h]},[A,h]),C=void 0!==$?$:!!p,_=o(()=>{if(C&&p)return function({data:t,colorBy:e,colorScale:n,getColor:o,strokeColor:r,strokeWidth:a}){return{legendGroups:[{styleFn:t=>{const e={fill:t.color,stroke:t.color};return void 0!==r&&(e.stroke=r),void 0!==a&&(e.strokeWidth=a),e},type:"fill",items:Array.from(new Set(t.map(t=>"function"==typeof e?e(t):t[e]))).map(r=>{const a=t.find("function"==typeof e?t=>e(t)===r:t=>t[e]===r),i=a?o(a,e,n):n?n(r):"#000000";return{label:r+"",color:i}}),label:""}]}}({data:P,colorBy:p,colorScale:j,getColor:zt})},[C,p,P,j]),L=o(()=>{const t=Object.assign(Object.assign({},{top:20,bottom:20,left:20,right:20}),s);return _&&120>t.right&&(t.right=120),t},[s,_]),z=Ue({componentName:"ForceDirectedGraph",nodes:n,edges:r,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:d}});return z?t.createElement(Je,{componentName:"ForceDirectedGraph",message:z,width:a,height:i}):t.createElement(Gt,Object.assign({chartType:"force",nodes:P,edges:D,size:[a,i],margin:L,nodeIDAccessor:d,sourceAccessor:u,targetAccessor:y,iterations:k,forceStrength:E,nodeStyle:N,edgeStyle:O,colorBy:p,colorScheme:f,nodeSize:g,nodeSizeRange:m,nodeLabel:W,showLabels:A,enableHover:M,tooltipContent:w?t=>qe(w)(t.data):void 0,legend:_,className:l,title:c},S))}function en(e){const{nodes:n,edges:r,width:a=800,height:i=600,margin:s={top:50,bottom:50,left:50,right:50},className:l,title:c,sourceAccessor:d="source",targetAccessor:u="target",valueAccessor:y="value",nodeIdAccessor:h="id",colorBy:p,colorScheme:f="category10",edgeColorBy:g="source",orientation:m="horizontal",nodeAlign:x="justify",nodePaddingRatio:v=.05,nodeWidth:b=15,nodeLabel:k,showLabels:E=!0,enableHover:A=!0,edgeOpacity:M=.5,edgeSort:$,tooltip:w,frameProps:S={}}=e,P=r||[],D=o(()=>{if(n&&n.length>0)return n;const t=new Set;return P.forEach(e=>{const n="function"==typeof d?d(e):e[d],o="function"==typeof u?u(e):e[u];t.add(n),t.add(o)}),Array.from(t).map(t=>({id:t}))},[n,P,d,u]),j=Ze(D,p,f),N=o(()=>t=>{const e={stroke:"black",strokeWidth:1};return e.fill=p?zt(t.data||t,p,j):"#4d430c",e},[p,j]),O=o(()=>t=>{const e={stroke:"none",strokeWidth:0,fillOpacity:M};if("function"==typeof g)e.fill=g(t);else if("source"===g){const n="object"==typeof t.source?t.source:null;p&&n?e.fill=zt(n.data||n,p,j):n&&(e.fill=N(n).fill)}else if("target"===g){const n="object"==typeof t.target?t.target:null;p&&n?e.fill=zt(n.data||n,p,j):n&&(e.fill=N(n).fill)}else"gradient"===g&&(e.fill="#999",e.fillOpacity=.7*M);return e},[g,p,j,N,M]),W=o(()=>{if(!E)return;const t=k||h;return"function"==typeof t?t:e=>e[t]},[E,k,h]),C=o(()=>{if("function"==typeof w)return w},[w]),_=Ue({componentName:"SankeyDiagram",edges:r,edgesRequired:!0});return _?t.createElement(Je,{componentName:"SankeyDiagram",message:_,width:a,height:i}):t.createElement(Gt,Object.assign({chartType:"sankey",nodes:D,edges:P,size:[a,i],margin:s,nodeIDAccessor:h,sourceAccessor:d,targetAccessor:u,valueAccessor:y,orientation:m,nodeAlign:x,nodePaddingRatio:v,nodeWidth:b,nodeStyle:N,edgeStyle:O,colorBy:p,colorScheme:f,edgeColorBy:g,edgeOpacity:M,edgeSort:$,nodeLabel:W,showLabels:E,enableHover:A,tooltipContent:C?t=>C(t.data):void 0,className:l,title:c},S))}function nn(e){const{nodes:n,edges:r,width:a=600,height:i=600,margin:s={top:50,bottom:50,left:50,right:50},className:l,title:c,sourceAccessor:d="source",targetAccessor:u="target",valueAccessor:y="value",nodeIdAccessor:h="id",colorBy:p,colorScheme:f="category10",edgeColorBy:g="source",padAngle:m=.01,groupWidth:x=20,sortGroups:v,nodeLabel:b,showLabels:k=!0,enableHover:E=!0,edgeOpacity:A=.5,tooltip:M,frameProps:$={}}=e,w=r||[],S=o(()=>{if(n&&n.length>0)return n;const t=new Set;return w.forEach(e=>{const n="function"==typeof d?d(e):e[d],o="function"==typeof u?u(e):e[u];t.add(n),t.add(o)}),Array.from(t).map(t=>({id:t}))},[n,w,d,u]),P=Ze(S,p,f),D=o(()=>(t,e)=>{var n,o;const r={stroke:"black",strokeWidth:1};if(p)r.fill=zt(t.data||t,p,P);else{const a=Array.isArray(f)?f:_t[f]||Lt,i=Array.isArray(a)?a:Lt,s=null!==(o=null!==(n=t.index)&&void 0!==n?n:e)&&void 0!==o?o:0;r.fill=i[s%i.length]}return r},[p,P,f]),j=o(()=>t=>{const e={stroke:"black",strokeWidth:.5,fillOpacity:A,strokeOpacity:A};if("function"==typeof g)e.fill=g(t);else if("source"===g){const n="object"==typeof t.source?t.source:null;p&&n?e.fill=zt(n.data||n,p,P):n&&(e.fill=D(n,n.index).fill)}else if("target"===g){const n="object"==typeof t.target?t.target:null;p&&n?e.fill=zt(n.data||n,p,P):n&&(e.fill=D(n,n.index).fill)}return e},[g,p,P,D,A]),N=o(()=>{if(!k)return;const t=b||h;return"function"==typeof t?t:e=>e[t]},[k,b,h]),O=Ue({componentName:"ChordDiagram",edges:r,edgesRequired:!0});return O?t.createElement(Je,{componentName:"ChordDiagram",message:O,width:a,height:i}):t.createElement(Gt,Object.assign({chartType:"chord",nodes:S,edges:w,size:[a,i],margin:s,nodeIDAccessor:h,sourceAccessor:d,targetAccessor:u,valueAccessor:y,padAngle:m,groupWidth:x,sortGroups:v,nodeStyle:D,edgeStyle:j,colorBy:p,colorScheme:f,edgeColorBy:g,edgeOpacity:A,nodeLabel:N,showLabels:k,enableHover:E,tooltipContent:M?t=>qe(M)(t.data):void 0,className:l,title:c},$))}function on(e){const{data:n,width:r=600,height:a=600,margin:i={top:50,bottom:50,left:50,right:50},className:s,title:l,layout:c="tree",orientation:d="vertical",childrenAccessor:u="children",valueAccessor:y="value",nodeIdAccessor:h="name",colorBy:p,colorScheme:f="category10",colorByDepth:g=!1,edgeStyle:m="curve",nodeLabel:x,showLabels:v=!0,nodeSize:b=5,enableHover:k=!0,tooltip:E,frameProps:A={}}=e,M=o(()=>{if(!n)return[];const t=[],e=n=>{t.push(n);const o="function"==typeof u?u(n):n[u];o&&Array.isArray(o)&&o.forEach(e)};return e(n),t},[n,u]),$=o(()=>g?Ft(M.map((t,e)=>({depth:e%5})),"depth",f):p&&"function"!=typeof p?Ft(M,p,f):void 0,[M,p,g,f]),w=o(()=>t=>{const e={stroke:"black",strokeWidth:1};return e.fill=g?zt({depth:t.depth||0},"depth",$):p?zt(t.data||t,p,$):Ke,e},[p,g,$]),S=o(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),P=o(()=>{if("treemap"===c||"circlepack"===c||"partition"===c)return"function"==typeof y?y:t=>t[y]||1},[c,y]),D=Qe({componentName:"TreeDiagram",data:n});return D?t.createElement(Je,{componentName:"TreeDiagram",message:D,width:r,height:a}):t.createElement(Gt,Object.assign({chartType:c,data:n,size:[r,a],margin:i,nodeIDAccessor:h,childrenAccessor:u,hierarchySum:P,treeOrientation:d,edgeType:m,nodeStyle:w,edgeStyle:S,colorBy:p,colorScheme:f,colorByDepth:g,nodeSize:b,nodeLabel:v?x||h:void 0,showLabels:v,enableHover:k,tooltipContent:E?t=>qe(E)(t.data):void 0,className:s,title:l},A))}function rn(e){const{data:n,width:r=600,height:a=600,margin:i={top:10,bottom:10,left:10,right:10},className:s,title:l,childrenAccessor:c="children",valueAccessor:d="value",nodeIdAccessor:u="name",colorBy:y,colorScheme:h="category10",colorByDepth:p=!1,showLabels:f=!0,labelMode:g="leaf",nodeLabel:m,padding:x=4,paddingTop:v,enableHover:b=!0,tooltip:k,frameProps:E={}}=e,A=o(()=>{if(!n)return[];const t=[],e=n=>{t.push(n);const o="function"==typeof c?c(n):n[c];o&&Array.isArray(o)&&o.forEach(e)};return e(n),t},[n,c]),M=o(()=>{if(!p&&y&&"function"!=typeof y)return Ft(A,y,h)},[A,y,p,h]),$=o(()=>{const t=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"];return e=>{const n={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return n.fill=p?t[(e.depth||0)%t.length]:y?zt(e.data||e,y,M):Ke,n}},[y,p,M]),w=o(()=>"function"==typeof d?d:t=>t[d]||1,[d]),S=void 0!==v?v:f&&"parent"===g?18:void 0,P=Qe({componentName:"Treemap",data:n});return P?t.createElement(Je,{componentName:"Treemap",message:P,width:r,height:a}):t.createElement(Gt,Object.assign({chartType:"treemap",data:n,size:[r,a],margin:i,nodeIDAccessor:u,childrenAccessor:c,hierarchySum:w,padding:x,paddingTop:S,nodeStyle:$,colorBy:y,colorScheme:h,colorByDepth:p,nodeLabel:f?m||u:void 0,showLabels:f,enableHover:b,tooltipContent:k?t=>qe(k)(t.data):void 0,className:s,title:l},E))}function an(e){const{data:n,width:r=600,height:a=600,margin:i={top:10,bottom:10,left:10,right:10},className:s,title:l,childrenAccessor:c="children",valueAccessor:d="value",nodeIdAccessor:u="name",colorBy:y,colorScheme:h="category10",colorByDepth:p=!1,showLabels:f=!0,nodeLabel:g,circleOpacity:m=.7,padding:x=4,enableHover:v=!0,tooltip:b,frameProps:k={}}=e,E=o(()=>{if(!n)return[];const t=[],e=n=>{t.push(n);const o="function"==typeof c?c(n):n[c];o&&Array.isArray(o)&&o.forEach(e)};return e(n),t},[n,c]),A=o(()=>{if(!p&&y&&"function"!=typeof y)return Ft(E,y,h)},[E,y,p,h]),M=o(()=>{const t=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"];return e=>{const n={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:m};return n.fill=p?t[(e.depth||0)%t.length]:y?zt(e.data||e,y,A):Ke,n}},[y,p,A,m]),$=o(()=>"function"==typeof d?d:t=>t[d]||1,[d]),w=Qe({componentName:"CirclePack",data:n});return w?t.createElement(Je,{componentName:"CirclePack",message:w,width:r,height:a}):t.createElement(Gt,Object.assign({chartType:"circlepack",data:n,size:[r,a],margin:i,nodeIDAccessor:u,childrenAccessor:c,hierarchySum:$,padding:x,nodeStyle:M,colorBy:y,colorScheme:h,colorByDepth:p,nodeLabel:f?g||u:void 0,showLabels:f,enableHover:v,tooltipContent:b?t=>qe(b)(t.data):void 0,className:s,title:l},k))}tn.displayName="ForceDirectedGraph",en.displayName="SankeyDiagram",nn.displayName="ChordDiagram",on.displayName="TreeDiagram",rn.displayName="Treemap",an.displayName="CirclePack";export{se as Annotation,ve as AnnotationLayer,te as Axis,nn as ChordDiagram,an as CirclePack,tn as ForceDirectedGraph,oe as Legend,en as SankeyDiagram,Gt as StreamNetworkFrame,on as TreeDiagram,rn as Treemap,Be as calculateDataExtent,Xe as nodesEdgesFromHierarchy};
1
+ import*as t from"react";import{forwardRef as e,useMemo as r,useRef as n,useState as o,useCallback as a,useEffect as i,useImperativeHandle as c,createContext as l,useContext as s,useLayoutEffect as u,useId as d}from"react";import{interpolateNumber as h}from"d3-interpolate";import{min as f,groups as y,max as g,sum as p,mean as v,group as m}from"d3-array";import{schemeCategory10 as b,interpolatePlasma as x,interpolateViridis as k,interpolatePurples as w,interpolateOranges as L,interpolateGreens as E,interpolateReds as D,interpolateBlues as A,schemeSet3 as P,schemeTableau10 as S}from"d3-scale-chromatic";import{forceLink as T,forceSimulation as O,forceManyBody as $,forceX as _,forceY as I}from"d3-force";import{scaleLinear as N,scaleOrdinal as W}from"d3-scale";import{ribbon as M,chord as j}from"d3-chord";import{arc as R}from"d3-shape";import{hierarchy as C,partition as B,pack as z,treemap as F,treemapBinary as Y,cluster as X,tree as H}from"d3-hierarchy";const G={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},q={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class V{constructor(t){this.capacity=t,this.particles=Array(t);for(let e=0;t>e;e++)this.particles[e]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0}}spawn(t){for(let e=0;this.capacity>e;e++){const r=this.particles[e];if(!r.active)return r.active=!0,r.t=0,r.offset=Math.random()-.5,r.edgeIndex=t,r.x=0,r.y=0,r}return null}step(t,e,r,n){var o;for(let a=0;this.capacity>a;a++){const i=this.particles[a];if(!i.active)continue;const c=r[i.edgeIndex];if(!c||!c.bezier){i.active=!1;continue}const l=n&&null!==(o=n[i.edgeIndex])&&void 0!==o?o:1;if(i.t+=t*e*l*(c.bezier.circular?.3:1),i.t>=1){i.active=!1;continue}const s=Z(c.bezier,i.t,i.offset);i.x=s.x,i.y=s.y}}countForEdge(t){let e=0;for(let r=0;this.capacity>r;r++)this.particles[r].active&&this.particles[r].edgeIndex===t&&e++;return e}clear(){for(let t=0;this.capacity>t;t++)this.particles[t].active=!1}resize(t){if(this.capacity>=t)return;const e=this.particles;this.particles=Array(t);for(let r=0;t>r;r++)this.particles[r]=e.length>r?e[r]:{t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0};this.capacity=t}}function Z(t,e,r){if(t.circular&&t.segments)return function(t,e,r,n){const o=t.length,a=e*o,i=Math.min(Math.floor(a),o-1),c=a-i,[l,s,u,d]=t[i],h=K(l,s,u,d,c),f=d.x-l.x,y=d.y-l.y,g=Math.sqrt(f*f+y*y);if(g>.001){const t=f/g;h.x+=-y/g*r*n*2,h.y+=t*r*n*2}return h}(t.segments,e,r,t.halfWidth);if(!t.points)return{x:0,y:0};const[n,o,a,i]=t.points,c=K(n,o,a,i,e),l=i.x-n.x,s=i.y-n.y,u=Math.sqrt(l*l+s*s);if(u>.001){const e=l/u;c.x+=-s/u*r*t.halfWidth*2,c.y+=e*r*t.halfWidth*2}return c}function K(t,e,r,n,o){const a=1-o,i=a*a,c=i*a,l=o*o,s=l*o;return{x:c*t.x+3*i*o*e.x+3*a*l*r.x+s*n.x,y:c*t.y+3*i*o*e.y+3*a*l*r.y+s*n.y}}function Q(t,e){var r=t.get(e);if(!r)throw Error("missing: "+e);return r}function J(t,e){var r,n=[],o=[],a=[],i={},c=[];function l(t){a[t]=!1,i.hasOwnProperty(t)&&Object.keys(i[t]).forEach(function(e){delete i[t][e],a[e]&&l(e)})}function s(t){var e,n,d=!1;for(o.push(t),a[t]=!0,e=0;c[t].length>e;e++)(n=c[t][e])===r?(u(r,o),d=!0):a[n]||(d=s(n));if(d)l(t);else for(e=0;c[t].length>e;e++){var h=i[n=c[t][e]];h||(i[n]=h={}),h[n]=!0}return o.pop(),d}function u(t,e){var r=[].concat(e).concat(t);n.push(r)}function d(e){!function(e){for(var r=0;t.length>r;r++)r>=e&&t[r]||(t[r]=[]),t[r]=t[r].filter(function(t){return t>=e})}(e);for(var r,n=function(t){for(var e=t.length,r=Array(e),n=Array(e),o=Array(e),a=Array(e),i=Array(e),c=Array(e),l=0;e>l;++l)r[l]=-1,n[l]=0,o[l]=!1,a[l]=0,i[l]=-1,c[l]=[];var s,u=0,d=[],h=[];function f(e){var l=[e],s=[e];for(r[e]=n[e]=u,o[e]=!0,u+=1;s.length>0;){var f=t[e=s[s.length-1]];if(f.length>a[e]){for(var y=a[e];f.length>y;++y){var g=f[y];if(0>r[g]){r[g]=n[g]=u,o[g]=!0,u+=1,l.push(g),s.push(g);break}o[g]&&(n[e]=0|Math.min(n[e],n[g])),0>i[g]||c[e].push(i[g])}a[e]=y}else{if(n[e]===r[e]){var p=[],v=[],m=0;for(y=l.length-1;y>=0;--y){var b=l[y];if(o[b]=!1,p.push(b),v.push(c[b]),m+=c[b].length,i[b]=d.length,b===e){l.length=y;break}}d.push(p);var x=Array(m);for(y=0;v.length>y;y++)for(var k=0;v[y].length>k;k++)x[--m]=v[y][k];h.push(x)}s.pop()}}}for(l=0;e>l;++l)0>r[l]&&f(l);for(l=0;h.length>l;l++){var y=h[l];if(0!==y.length){y.sort(function(t,e){return t-e}),s=[y[0]];for(var g=1;y.length>g;g++)y[g]!==y[g-1]&&s.push(y[g]);h[l]=s}}return{components:d,adjacencyList:h}}(t),o=n.components.filter(function(t){return t.length>1}),a=1/0,i=0;o.length>i;i++)for(var c=0;o[i].length>c;c++)a>o[i][c]&&(a=o[i][c],r=i);var l=o[r];if(!l)return!1;var s=t.map(function(t,e){return-1===l.indexOf(e)?[]:t.filter(function(t){return-1!==l.indexOf(t)})});return{leastVertex:a,adjList:s}}r=0;for(var h=t.length;h>r;){var f=d(r);if(r=f.leastVertex,c=f.adjList){for(var y=0;c.length>y;y++)for(var g=0;c[y].length>g;g++){var p=c[y][g];a[+p]=!1,i[p]={}}s(r),r+=1}else r=h}return n}function U(t){return t.y0-t.y1>0?"up":"down"}function tt(t,e){return e(t.source)==e(t.target)}function et(t){var e=0;t.source.sourceLinks.forEach(function(t){e=t.circular?e+1:e});var r=0;return t.target.targetLinks.forEach(function(t){r=t.circular?r+1:r}),1>=e&&1>=r}function rt(t){return t.target.x0-t.source.x1}function nt(t,e){var r=at(t),n=rt(e)/Math.tan(r);return"up"==U(t)?t.y1-n:t.y1+n}function ot(t,e){var r=at(t),n=rt(e)/Math.tan(r);return"up"==U(t)?t.y1+n:t.y1-n}function at(t){var e=Math.abs(t.y1-t.y0);return Math.atan(Math.abs(t.target.x0-t.source.x1)/e)}function it(t,e){return e(t)}function ct(t){return st(t.source)}function lt(t){return st(t.target)}function st(t){return(t.y0+t.y1)/2}function ut(t){return t.virtual?0:t.value}function dt(t,e){var r=0;t.sourceLinks.forEach(function(t){r=t.circular&&!tt(t,e)?r+1:r});var n=0;return t.targetLinks.forEach(function(t){n=t.circular&&!tt(t,e)?n+1:n}),r+n}function ht(t){return t.target.depth}function ft(t,e){return t.sourceLinks.length?t.depth:e-1}function yt(t,e){return t.y0-e.y0}function gt(t,e){return e.y0-t.y0}function pt(t,e){return t.y1-e.y1}function vt(t,e){return e.y1-t.y1}function mt(t,e){return xt(t.source,e.source)||t.index-e.index}function bt(t,e){return xt(t.target,e.target)||t.index-e.index}function xt(t,e){return t.partOfCycle===e.partOfCycle?t.y0-e.y0:"top"===t.circularLinkType||"bottom"===e.circularLinkType?-1:1}function kt(t,e){return wt(t)==wt(e)?"bottom"==t.circularLinkType?gt(t,e):yt(t,e):wt(e)-wt(t)}function wt(t){return t.target.column-t.source.column}function Lt(t,e){return Et(t)==Et(e)}function Et(t){return t.y0-t.y1>0?"up":"down"}function Dt(t,e,r,n,o){let a=t;var i=Math.max(8,.15*(a.y1-a.y0));a.links.forEach(function(t){t.circular&&(t._circularWidth=Math.min(t.width,i))});var c=f(a.links,function(t){return t.source.y0});a.links.forEach(function(t){t.circular&&(t.circularPathData={})});var l=a.links.filter(function(t){return t.circular});return l.sort(function(t,e){return e.value-t.value}),l.forEach(function(t,e){t._circularStub=e>=4}),At(a.links.filter(function(t){return"top"==t.circularLinkType}),e,r),At(a.links.filter(function(t){return"bottom"==t.circularLinkType}),e,r),a.links.forEach(function(t){if(t.circular){if(t.circularPathData.arcRadius=t._circularWidth+n,t.circularPathData.rightNodeBuffer=5,t.circularPathData.leftNodeBuffer=5,t.circularPathData.sourceWidth=t.source.x1-t.source.x0,t.circularPathData.sourceX=t.source.x0+t.circularPathData.sourceWidth,t.circularPathData.targetX=t.target.x0,t.circularPathData.sourceY=t.y0,t.circularPathData.targetY=t.y1,tt(t,e)&&et(t))t.circularPathData.rightSmallArcRadius=n+t._circularWidth/2,t.circularPathData.rightLargeArcRadius=n+t._circularWidth/2,t.circularPathData.leftSmallArcRadius=n+t._circularWidth/2,t.circularPathData.leftLargeArcRadius=n+t._circularWidth/2,"bottom"==t.circularLinkType?(t.circularPathData.verticalFullExtent=t.source.y1+o+t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.leftLargeArcRadius):(t.circularPathData.verticalFullExtent=t.source.y0-o-t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.leftLargeArcRadius);else{var i=t.source.column,l=t.circularLinkType,s=a.links.filter(function(t){return t.source.column==i&&t.circularLinkType==l});s.sort("bottom"==t.circularLinkType?gt:yt);var u=0;s.forEach(function(e,o){e.circularLinkID==t.circularLinkID&&(t.circularPathData.rightSmallArcRadius=n+t._circularWidth/2+u,t.circularPathData.rightLargeArcRadius=n+t._circularWidth/2+o*r+u),u+=e._circularWidth||e.width}),i=t.target.column,(s=a.links.filter(function(t){return t.target.column==i&&t.circularLinkType==l})).sort("bottom"==t.circularLinkType?vt:pt),u=0,s.forEach(function(e,o){e.circularLinkID==t.circularLinkID&&(t.circularPathData.leftSmallArcRadius=n+t._circularWidth/2+u,t.circularPathData.leftLargeArcRadius=n+t._circularWidth/2+o*r+u),u+=e._circularWidth||e.width}),"bottom"==t.circularLinkType?(t.circularPathData.verticalFullExtent=Math.max(a.y1,t.source.y1,t.target.y1)+o+t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.leftLargeArcRadius):(t.circularPathData.verticalFullExtent=c-o-t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.leftLargeArcRadius)}t.circularPathData.rightInnerExtent=t.circularPathData.sourceX+t.circularPathData.rightNodeBuffer,t.circularPathData.leftInnerExtent=t.circularPathData.targetX-t.circularPathData.leftNodeBuffer,t.circularPathData.rightFullExtent=t.circularPathData.sourceX+t.circularPathData.rightLargeArcRadius+t.circularPathData.rightNodeBuffer,t.circularPathData.leftFullExtent=t.circularPathData.targetX-t.circularPathData.leftLargeArcRadius-t.circularPathData.leftNodeBuffer}t.path=t.circular?function(t){return"top"==t.circularLinkType?"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 0 "+t.circularPathData.rightFullExtent+" "+(t.circularPathData.sourceY-t.circularPathData.rightSmallArcRadius)+" L"+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 0 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 0 "+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" L"+t.circularPathData.leftFullExtent+" "+(t.circularPathData.targetY-t.circularPathData.leftSmallArcRadius)+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 0 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY:"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 1 "+t.circularPathData.rightFullExtent+" "+(t.circularPathData.sourceY+t.circularPathData.rightSmallArcRadius)+" L"+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 1 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 1 "+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" L"+t.circularPathData.leftFullExtent+" "+(t.circularPathData.targetY+t.circularPathData.leftSmallArcRadius)+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 1 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY}(t):function(t){var e=t.source.x1,r=t.y0,n=t.target.x0,o=t.y1,a=(e+n)/2;return"M"+e+","+r+"C"+a+","+r+" "+a+","+o+" "+n+","+o}(t)}),a}function At(t,e,r){t.sort(kt);var n=t.filter(function(t){return!t._circularStub});return t.forEach(function(t,o){var a=0;if(t._circularStub)t.circularPathData.verticalBuffer=0;else if(tt(t,e)&&et(t))t.circularPathData.verticalBuffer=a+t._circularWidth/2;else{for(var i=0;n.length>i;i++){var c=n[i];if(c!==t&&c.circularPathData&&void 0!==c.circularPathData.verticalBuffer&&Pt(t,c)){var l=c.circularPathData.verticalBuffer+(c._circularWidth||c.width)/2+r;a=l>a?l:a}}t.circularPathData.verticalBuffer=a+t._circularWidth/2}}),t}function Pt(t,e){return t.source.column>=e.target.column&&e.source.column>=t.target.column}function St(t){return function(){return t}}function Tt(t){return t.index}function Ot(t){return t.nodes}function $t(t){return t.links}function _t(t,e,r){var n=y(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});n.forEach(function(o){var a=o.length;o.sort(e||function(t,e){return t.circularLinkType==e.circularLinkType?dt(e,r)-dt(t,r):"top"==t.circularLinkType&&"bottom"==e.circularLinkType||"top"==t.circularLinkType&&0==e.partOfCycle||0==t.partOfCycle&&"bottom"==e.circularLinkType?-1:0}),o.forEach(function(e,o){e.depth==n.length-1&&1==a||0==e.depth&&1==a?(e.y0=t.y1/2-e.value*t.ky,e.y1=e.y0+e.value*t.ky):e.partOfCycle?0==dt(e,r)?(e.y0=t.y1/2+o,e.y1=e.y0+e.value*t.ky):"top"==e.circularLinkType?(e.y0=t.y0+o,e.y1=e.y0+e.value*t.ky):(e.y0=t.y1-e.value*t.ky-o,e.y1=e.y0+e.value*t.ky):0==t.y0||0==t.y1?(e.y0=(t.y1-t.y0)/a*o,e.y1=e.y0+e.value*t.ky):(e.y0=(t.y1-t.y0)/2-a/2+o,e.y1=e.y0+e.value*t.ky)})})}function It(t,e,r,n,o,a){var i=y(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});u();for(var c=1,l=a;l>0;--l)s(c*=.99,r),u();function s(e,r){var n=i.length;i.forEach(function(o){var a=o.length,i=o[0].depth;o.forEach(function(o){var c;if(o.sourceLinks.length||o.targetLinks.length)if(o.partOfCycle&&dt(o,r)>0){var l=v(o.sourceLinks,lt),s=v(o.targetLinks,ct),u=l&&s?(l+s)/2:l||s;if(u){var d=(u-st(o))*e*.3;o.y0+=d,o.y1+=d}}else if(0==i&&1==a)o.y0=t.y1/2-(c=o.y1-o.y0)/2,o.y1=t.y1/2+c/2;else if(i==n-1&&1==a)o.y0=t.y1/2-(c=o.y1-o.y0)/2,o.y1=t.y1/2+c/2;else if(1==o.targetLinks.length&&1==o.targetLinks[0].source.sourceLinks.length)c=o.y1-o.y0,o.y0=o.targetLinks[0].source.y0,o.y1=o.y0+c;else{var h=v(o.sourceLinks,lt),f=v(o.targetLinks,ct),y=((h&&f?(h+f)/2:h||f)-st(o))*e;o.y0+=y,o.y1+=y}})})}function u(){i.forEach(function(r){var a,i,c,l=t.y0,s=r.length;for(r.sort(e||xt),c=0;s>c;++c)(i=l-(a=r[c]).y0)>0&&(a.y0+=i,a.y1+=i),l=a.y1+n;if((i=l-n-t.y1)>0)for(l=a.y0-=i,a.y1-=i,c=s-2;c>=0;--c)(i=(a=r[c]).y1+o-l)>0&&(a.y0-=i,a.y1-=i),l=a.y0})}}function Nt(t){t.nodes.forEach(function(t){t.sourceLinks.sort(bt),t.targetLinks.sort(mt)}),t.nodes.forEach(function(t){var e=t.y0,r=e,n=t.y1,o=n;t.sourceLinks.forEach(function(t){t.circular?(t.y0=n-t.width/2,n-=t.width):(t.y0=e+t.width/2,e+=t.width)}),t.targetLinks.forEach(function(t){t.circular?(t.y1=o-t.width/2,o-=t.width):(t.y1=r+t.width/2,r+=t.width)})})}function Wt(){var t=0,e=0,r=1,n=1,o=24,a=8,i=null,c=Tt,l=ft,s=void 0,u=32,d=2,h=Ot,v=$t;function b(){var b={nodes:h.apply(null,arguments),links:v.apply(null,arguments)};return function(h){h.x0=t,h.y0=e,h.x1=r,h.y1=n,h.py=0,function(t,e){t.nodes.forEach(function(t,e){t.index=e,t.sourceLinks=[],t.targetLinks=[]});var r=function(t,e){var r=new Map;return m(t,e).forEach(function(t,e){r.set(e,t[0])}),r}(t.nodes,e);t.links.forEach(function(t,e){t.index=e;var n=t.source,o=t.target;"object"!=typeof n&&(n=t.source=Q(r,n)),"object"!=typeof o&&(o=t.target=Q(r,o)),n.sourceLinks.push(t),o.targetLinks.push(t)})}(h,c),function(t,e){var r=0;if(null==e){for(var n=[],o=0;t.links.length>o;o++){var a=t.links[o],i=a.source.index,c=a.target.index;n[i]||(n[i]=[]),n[c]||(n[c]=[]),-1===n[i].indexOf(c)&&n[i].push(c)}var l=J(n);l.sort(function(t,e){return t.length-e.length});var s={};for(o=0;l.length>o;o++){var u=l[o].slice(-2);s[u[0]]||(s[u[0]]={}),s[u[0]][u[1]]=!0}t.links.forEach(function(t){var e=t.target.index,n=t.source.index;e===n||s[n]&&s[n][e]?(t.circular=!0,t.circularLinkID=r++):t.circular=!1})}else t.links.forEach(function(t){e(t.source)<e(t.target)?t.circular=!1:(t.circular=!0,t.circularLinkID=r++)})}(h,s),function(t,e){var r=0,n=0;t.links.forEach(function(o){o.circular&&(o.circularLinkType=o.source.circularLinkType||o.target.circularLinkType?o.source.circularLinkType?o.source.circularLinkType:o.target.circularLinkType:n>r?"top":"bottom","top"==o.circularLinkType?r++:n++,t.nodes.forEach(function(t){it(t,e)!=it(o.source,e)&&it(t,e)!=it(o.target,e)||(t.circularLinkType=o.circularLinkType)}))}),t.links.forEach(function(t){t.circular&&(t.source.circularLinkType==t.target.circularLinkType&&(t.circularLinkType=t.source.circularLinkType),tt(t,e)&&(t.circularLinkType=t.source.circularLinkType))})}(h,c),function(t){t.nodes.forEach(function(t){t.partOfCycle=!1,t.value=Math.max(p(t.sourceLinks,ut),p(t.targetLinks,ut)),t.sourceLinks.forEach(function(e){e.circular&&(t.partOfCycle=!0,t.circularLinkType=e.circularLinkType)}),t.targetLinks.forEach(function(e){e.circular&&(t.partOfCycle=!0,t.circularLinkType=e.circularLinkType)})})}(h),function(t,e,r){var n,o,a;if(null!=e){t.nodes.sort(function(t,r){return e(t)<e(r)?-1:1});var i=0,c=e(t.nodes[0]);t.nodes.forEach(function(t){i=e(t)==c?i:i+1,c=e(t)==c?c:e(t),t.column=i})}for(n=t.nodes,o=[],a=0;n.length;++a,n=o,o=[])n.forEach(function(t){t.depth=a,t.sourceLinks.forEach(function(t){0>o.indexOf(t.target)&&!t.circular&&o.push(t.target)})});for(n=t.nodes,o=[],a=0;n.length;++a,n=o,o=[])n.forEach(function(t){t.height=a,t.targetLinks.forEach(function(t){0>o.indexOf(t.source)&&!t.circular&&o.push(t.source)})});t.nodes.forEach(function(t){t.column=null==e?r(t,a):t.column})}(h,s,l);var v=a;if(null!==i){var b=y(h.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]}),x=g(b,function(t){return t.length});x>1&&(v=Math.max(1,(n-e)*i/(x-1)))}(function(t,e,r){var n=y(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});t.py=e;var o=f(n,function(e){return(t.y1-t.y0-(e.length-1)*t.py)/p(e,function(t){return t.value})});t.ky=o,t.links.forEach(function(e){e.width=e.value*t.ky});var a=g(t.nodes,function(t){return t.column});t.nodes.forEach(a>0?function(e){e.x0=t.x0+e.column*((t.x1-t.x0-r)/a),e.x1=e.x0+r}:function(e){e.x0=t.x0,e.x1=e.x0+r})})(h,v,o),_t(h,s,c),It(h,s,c,v,v,u),Nt(h),Dt(h,c,d,10,8),_t(h,s,c),It(h,s,c,v,v,u),Nt(h),Dt(h,c,d,10,8),function(t,e){let r=t;r.nodes.forEach(function(t){t.y+(t.y1-t.y0)>r.y1&&(t.y=t.y-(t.y+(t.y1-t.y0)-r.y1));var n=r.links.filter(function(r){return it(r.source,e)==it(t,e)}),o=n.length;o>1&&n.sort(function(t,e){if(!t.circular&&!e.circular){if(t.target.column==e.target.column)return t.y1-e.y1;if(!Lt(t,e))return t.y1-e.y1;if(t.target.column>e.target.column){var r=nt(e,t);return t.y1-r}if(e.target.column>t.target.column)return nt(t,e)-e.y1}return t.circular&&!e.circular?"top"==t.circularLinkType?-1:1:e.circular&&!t.circular?"top"==e.circularLinkType?1:-1:t.circular&&e.circular?t.circularLinkType===e.circularLinkType&&"top"==t.circularLinkType?t.target.column===e.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:t.circularLinkType===e.circularLinkType&&"bottom"==t.circularLinkType?t.target.column===e.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:"top"==t.circularLinkType?-1:1:void 0});var a=t.y0;n.forEach(function(t){t.y0=a+t.width/2,a+=t.width}),n.forEach(function(e,r){if("bottom"==e.circularLinkType){for(var a=r+1,i=0;o>a;a++)i+=n[a].width;e.y0=t.y1-i-e.width/2}})})}(h,c),function(t,e){let r=t;r.nodes.forEach(function(t){var n=r.links.filter(function(r){return it(r.target,e)==it(t,e)}),o=n.length;o>1&&n.sort(function(t,e){if(!t.circular&&!e.circular){if(t.source.column==e.source.column)return t.y0-e.y0;if(!Lt(t,e))return t.y0-e.y0;if(t.source.column>e.source.column){var r=ot(e,t);return t.y0-r}if(e.source.column>t.source.column)return ot(t,e)-e.y0}return t.circular&&!e.circular?"top"==t.circularLinkType?-1:1:e.circular&&!t.circular?"top"==e.circularLinkType?1:-1:t.circular&&e.circular?t.circularLinkType===e.circularLinkType&&"top"==t.circularLinkType?t.source.column===e.source.column?t.source.y1-e.source.y1:t.source.column-e.source.column:t.circularLinkType===e.circularLinkType&&"bottom"==t.circularLinkType?t.source.column===e.source.column?t.source.y1-e.source.y1:e.source.column-t.source.column:"top"==t.circularLinkType?-1:1:void 0});var a=t.y0;n.forEach(function(t){t.y1=a+t.width/2,a+=t.width}),n.forEach(function(e,r){if("bottom"==e.circularLinkType){for(var a=r+1,i=0;o>a;a++)i+=n[a].width;e.y1=t.y1-i-e.width/2}})})}(h,c),function(t){var e=t.nodes,r=t.links,n=!1,o=!1;if(r.forEach(function(t){"top"==t.circularLinkType?n=!0:"bottom"==t.circularLinkType&&(o=!0)}),0==n||0==o){var a=f(e,function(t){return t.y0}),i=g(e,function(t){return t.y1}),c=(t.y1-t.y0)/(i-a);function l(e){return(e-a)/(i-a)*(t.y1-t.y0)+t.y0}1>c?(e.forEach(function(t){t.y0=l(t.y0),t.y1=l(t.y1)}),r.forEach(function(t){t.y0=l(t.y0),t.y1=l(t.y1),t.width=t.width*c})):e.forEach(function(t){var e=t.y1-t.y0,r=l(t.y0)-t.y0;t.y0=l(t.y0),t.y1=t.y0+e,t.sourceLinks.forEach(function(t){t.y0=t.y0+r}),t.targetLinks.forEach(function(t){t.y1=t.y1+r})})}}(h),Dt(h,c,d,10,8)}(b),b}return b.update=function(t){return Nt(t),Dt(t,c,d,10,8),t},b.nodeWidth=function(t){return arguments.length?(o=+t,b):o},b.nodePadding=function(t){return arguments.length?(a=+t,b):a},b.nodePaddingRatio=function(t){return arguments.length?(i=+t,b):i},b.nodes=function(t){return arguments.length?(h="function"==typeof t?t:St(t),b):h},b.links=function(t){return arguments.length?(v="function"==typeof t?t:St(t),b):v},b.nodeId=function(t){return arguments.length?(c="function"==typeof t?t:St(t),b):c},b.nodeAlign=function(t){return arguments.length?(l="function"==typeof t?t:St(t),b):l},b.nodeSort=function(t){return arguments.length?(s=t,b):s},b.iterations=function(t){return arguments.length?(u=+t,b):u},b.circularLinkGap=function(t){return arguments.length?(d=+t,b):d},b.extent=function(o){return arguments.length?(t=+o[0][0],e=+o[0][1],r=+o[1][0],n=+o[1][1],b):[[t,e],[r,n]]},b.size=function(o){return arguments.length?(t=e=0,r=+o[0],n=+o[1],b):[r-t,n-e]},b}const Mt=t=>{let e,r,n,o,a,i,c,l,s;return"down"===t.direction?(e=t.y0-t.sankeyWidth/2,r=t.y1-t.sankeyWidth/2,n=t.y1+t.sankeyWidth/2,o=t.y0+t.sankeyWidth/2,a=t.source.y1,i=t.target.y0,c=h(a,i),l=c(.5),s=c(.5),`M${e},${a}C${e},${l} ${r},${s} ${r},${i}L${n},${i}C${n},${s} ${o},${l} ${o},${a}Z`):(e=t.source.x1,r=t.target.x0,c=h(e,r),n=c(.5),o=c(.5),a=t.y0-t.sankeyWidth/2,i=t.y1-t.sankeyWidth/2,l=t.y1+t.sankeyWidth/2,s=t.y0+t.sankeyWidth/2,`M${e},${a}C${n},${a} ${o},${i} ${r},${i}L${r},${l}C${o},${l} ${n},${s} ${e},${s}Z`)};function jt(t){var e;const r=t.sankeyWidth/2,n=(null!==(e=t._circularWidth)&&void 0!==e?e:t.sankeyWidth)/2,o=t.circularPathData;if(!o)return null;if("down"===t.direction)return null;if(t._circularStub){const e=o.sourceX,n=o.sourceY,a=o.targetX,i=o.targetY;if("object"!=typeof t.source||!t.source||"object"!=typeof t.target||!t.target)return null;const c=Math.max(15,Math.min(40,.33*(o.rightFullExtent-e))),l=Math.max(15,Math.min(40,.33*(a-o.leftFullExtent)));return`M${e},${n-r}L${e+c},${n-r}L${e+c},${n+r}L${e},${n+r}ZM${a},${i-r}L${a-l},${i-r}L${a-l},${i+r}L${a},${i+r}Z`}const a=o.sourceX,i=o.sourceY,c=o.targetX,l=o.targetY,s=o.rightFullExtent,u=o.leftFullExtent,d=o.verticalFullExtent,h="bottom"===t.circularLinkType?1:-1,f=Math.max(4,Math.min(n,15));return`M${a},${i-h*r}L${s},${i-h*r}L${s+n},${i-h*r+h*f}L${s+n},${d+h*n-h*f}L${s+n-f},${d+h*n}L${u-n+f},${d+h*n}L${u-n},${d+h*n-h*f}L${u-n},${l-h*r+h*f}L${u-n+f},${l-h*r}L${c},${l-h*r}L${c},${l+h*r}L${u},${l+h*r}L${u},${d-h*n}L${s},${d-h*n}L${s},${i+h*r}L${a},${i+h*r}Z`}const Rt={left:function(t){return t.depth},right:function(t,e){return e-1-t.height},center:function(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?Math.min.apply(Math,t.sourceLinks.map(ht))-1:0},justify:ft},Ct={supportsStreaming:!0,hierarchical:!1,computeLayout(t,e,r,n){var o,a,i,c,l,s,u;if(0===t.length)return;const d="vertical"===r.orientation?"down":"right",h=r.nodeAlign||"justify",f=null!==(o=r.nodeWidth)&&void 0!==o?o:15,y=null!==(a=r.nodePaddingRatio)&&void 0!==a?a:.05,g=null!==(i=r.iterations)&&void 0!==i?i:100,p=t.map(t=>Object.assign({},t)),v=e.map(t=>Object.assign(Object.assign({},t),{source:"string"==typeof t.source?t.source:t.source.id,target:"string"==typeof t.target?t.target:t.target.id,value:Math.sqrt(Math.max(1,t.value||1))}));let m;m="down"===d?[[0,0],[n[1],n[0]]]:[[0,0],[n[0],n[1]]];const b=Wt().extent(m).links(v).nodes(p).nodeAlign(Rt[h]||ft).nodeId(t=>t.id).nodeWidth(f).iterations(g);b.nodePaddingRatio&&b.nodePaddingRatio(y),b();{let t=1/0,e=-1/0,r=1/0,o=-1/0;for(const n of p)t>n.x0&&(t=n.x0),n.x1>e&&(e=n.x1),r>n.y0&&(r=n.y0),n.y1>o&&(o=n.y1);for(const n of v){if(!n.circular||!n.circularPathData)continue;const a=n.circularPathData,i=(null!==(l=null!==(c=n._circularWidth)&&void 0!==c?c:n.width)&&void 0!==l?l:0)/2;t>a.leftFullExtent-i&&(t=a.leftFullExtent-i),a.rightFullExtent+i>e&&(e=a.rightFullExtent+i),r>a.verticalFullExtent-i&&(r=a.verticalFullExtent-i),a.verticalFullExtent+i>o&&(o=a.verticalFullExtent+i)}const a=e-t,i=o-r,u=n[0],d=n[1];if(a>0&&i>0&&(0>t||0>r||e>u||o>d)){const e=Math.min(u/a,d/i),n=-t*e+(u-a*e)/2,o=-r*e+(d-i*e)/2;for(const t of p)t.x0=t.x0*e+n,t.x1=t.x1*e+n,t.y0=t.y0*e+o,t.y1=t.y1*e+o;for(const t of v)if(t.y0=t.y0*e+o,t.y1=t.y1*e+o,t.width=(null!==(s=t.width)&&void 0!==s?s:0)*e,t._circularWidth&&(t._circularWidth*=e),t.circular&&t.circularPathData){const r=t.circularPathData;r.sourceX=r.sourceX*e+n,r.targetX=r.targetX*e+n,r.sourceY=r.sourceY*e+o,r.targetY=r.targetY*e+o,r.rightFullExtent=r.rightFullExtent*e+n,r.leftFullExtent=r.leftFullExtent*e+n,r.verticalFullExtent=r.verticalFullExtent*e+o,r.rightInnerExtent=r.rightInnerExtent*e+n,r.leftInnerExtent=r.leftInnerExtent*e+n,r.verticalRightInnerExtent=r.verticalRightInnerExtent*e+o,r.verticalLeftInnerExtent=r.verticalLeftInnerExtent*e+o,r.rightSmallArcRadius*=e,r.rightLargeArcRadius*=e,r.leftSmallArcRadius*=e,r.leftLargeArcRadius*=e,r.sourceWidth*=e,r.rightNodeBuffer*=e,r.leftNodeBuffer*=e,r.arcRadius*=e}}}const x=new Map;for(const e of t)x.set(e.id,e);for(const t of p){const e=x.get(t.id);e&&(e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.value=t.value,e.depth=t.depth,e.sourceLinks=t.sourceLinks,e.targetLinks=t.targetLinks,e.width=t.x1-t.x0,e.height=t.y1-t.y0,e.x=t.x0+(t.x1-t.x0)/2,e.y=t.y0+(t.y1-t.y0)/2)}const k=new Map;for(const t of e)k.set(`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}`,t);for(const t of v){const e=t.source,r=t.target,n="object"==typeof e&&null!==e?e.id:e+"",o="object"==typeof r&&null!==r?r.id:r+"",a=k.get(`${n}\0${o}`);if(a){a.y0=t.y0,a.y1=t.y1,a.sankeyWidth=null!==(u=t.width)&&void 0!==u?u:0,a.circular=!!t.circular,a.circularPathData=t.circularPathData,a._circularWidth=t._circularWidth,a._circularStub=t._circularStub,a.path=t.path,a.circularLinkType=t.circularLinkType,a.direction=d;const e=x.get(n),r=x.get(o);e&&(a.source=e),r&&(a.target=r)}}},buildScene(t,e,r,n){var o,a,i,c;const l="vertical"===r.orientation?"down":"right",s=r.nodeStyle,u=r.edgeStyle,d=null!==(o=r.edgeOpacity)&&void 0!==o?o:.5,h=r.edgeColorBy||"source",f=Array.isArray(r.colorScheme)?r.colorScheme:b,y=new Map;t.forEach((t,e)=>{y.set(t.id,f[e%f.length])});const g=[],p=[],v=[];for(const e of t){const t=e.x1-e.x0,r=e.y1-e.y0;if(0>=t||0>=r)continue;const n=s?s(e):{},o={fill:n.fill||y.get(e.id)||"#4d430c",stroke:n.stroke,strokeWidth:n.strokeWidth,opacity:n.opacity};g.push({type:"rect",x:e.x0,y:e.y0,w:t,h:r,style:o,datum:e,id:e.id,label:e.id})}const m=[...e].sort((t,e)=>(e.sankeyWidth||0)-(t.sankeyWidth||0));for(const t of m){if(!t.sankeyWidth||0>=t.sankeyWidth)continue;const e="object"==typeof t.source?t.source:null,r="object"==typeof t.target?t.target:null;if(!e||!r)continue;let n="#999";u?n=u(t).fill||n:"target"===h&&r?n=y.get(r.id)||n:e&&(n=y.get(e.id)||n);const o=u?u(t):{};if(t._circularStub&&t.circular&&t.circularPathData){const e=t.circularPathData,r=t.sankeyWidth/2,c=Math.max(15,Math.min(40,.33*(e.rightFullExtent-e.sourceX))),l=Math.max(15,Math.min(40,.33*(e.targetX-e.leftFullExtent))),s=o.fill||n;p.push({type:"bezier",pathD:`M${e.sourceX},${e.sourceY-r}L${e.sourceX+c},${e.sourceY-r}L${e.sourceX+c},${e.sourceY+r}L${e.sourceX},${e.sourceY+r}Z`,style:{fill:s,fillOpacity:null!==(a=o.fillOpacity)&&void 0!==a?a:d,stroke:"none",opacity:o.opacity},datum:t,_gradient:{direction:"right",from:1,to:0,x0:e.sourceX,x1:e.sourceX+c}}),p.push({type:"bezier",pathD:`M${e.targetX},${e.targetY-r}L${e.targetX-l},${e.targetY-r}L${e.targetX-l},${e.targetY+r}L${e.targetX},${e.targetY+r}Z`,style:{fill:s,fillOpacity:null!==(i=o.fillOpacity)&&void 0!==i?i:d,stroke:"none",opacity:o.opacity},datum:t,_gradient:{direction:"left",from:0,to:1,x0:e.targetX-l,x1:e.targetX}});continue}let l;if(l=t.circular&&t.circularPathData?jt(t):Mt(t),!l)continue;const s={fill:o.fill||n,fillOpacity:null!==(c=o.fillOpacity)&&void 0!==c?c:d,stroke:o.stroke||"none",strokeWidth:o.strokeWidth,opacity:o.opacity};p.push({type:"bezier",pathD:l,bezierCache:t.bezier,style:s,datum:t})}if(!1!==r.showLabels){const e=(x=r.nodeLabel)?"function"==typeof x?x:t=>t[x]||t.id:null;for(const r of t){const t=r.x1-r.x0,o=r.y1-r.y0;if(0>=t||0>=o)continue;const a=e?e(r):r.id;if(!a)continue;let i,c,s;"down"===l?(i=r.x0+t/2,c=r.y1+14,s="middle"):(n[0]/2>r.x0+t/2?(i=r.x0-6,s="end"):(i=r.x1+6,s="start"),c=r.y0+o/2),v.push({x:i,y:c,text:a+"",anchor:s,baseline:"middle",fontSize:11})}}var x;return{sceneNodes:g,sceneEdges:p,labels:v}}},Bt={supportsStreaming:!1,hierarchical:!1,computeLayout(t,e,r,n){var o,a;if(0===t.length)return;const i=null!==(o=r.iterations)&&void 0!==o?o:Math.max(50,Math.min(300,Math.floor(300-2*(t.length-30)))),c=null!==(a=r.forceStrength)&&void 0!==a?a:.1,l=n[0]/2,s=n[1]/2;for(let e=0;t.length>e;e++){const r=t[e];if(null==r.x||null==r.y||0===r.x&&0===r.y){const t=10*Math.sqrt(e+.5),n=2.399963229728653*e;r.x=l+t*Math.cos(n),r.y=s+t*Math.sin(n)}}const u=zt(r.nodeSize,r.nodeSizeRange,t),d=T().strength(t=>Math.min(2.5,t.weight?t.weight*c:c)).id(t=>t.id),h=n[1]/n[0],f=O().force("charge",$().strength(t=>-25*(t=>u(t))(t))).force("x",_(n[0]/2).strength(.1*h)).force("y",I(n[1]/2).strength(.1));if(f.nodes(t),e.length>0){const t=e.map(t=>Object.assign(Object.assign({},t),{source:"string"==typeof t.source?t.source:t.source.id,target:"string"==typeof t.target?t.target:t.target.id}));f.force("link",d),f.force("link").links(t)}.1>f.alpha()&&f.alpha(1),f.stop();for(let t=0;i>t;++t)f.tick();const y=new Map;for(const e of t)y.set(e.id,e);for(const t of e){if("string"==typeof t.source){const e=y.get(t.source);e&&(t.source=e)}if("string"==typeof t.target){const e=y.get(t.target);e&&(t.target=e)}}},buildScene(t,e,r,n){var o,a,i;const c=r.nodeStyle,l=r.edgeStyle,s=zt(r.nodeSize,r.nodeSizeRange,t),u=Array.isArray(r.colorScheme)?r.colorScheme:b,d=new Map;t.forEach((t,e)=>{d.set(t.id,u[e%u.length])});const h=[],f=[],y=[];for(const e of t){if(null==e.x||null==e.y)continue;const t=s(e),r=c?c(e):{},n={fill:r.fill||d.get(e.id)||"#007bff",stroke:r.stroke||"#fff",strokeWidth:null!==(o=r.strokeWidth)&&void 0!==o?o:2,opacity:r.opacity};h.push({type:"circle",cx:e.x,cy:e.y,r:t,style:n,datum:e,id:e.id,label:e.id})}const g=new Map;for(const e of t)g.set(e.id,e);for(const t of e){const e="object"==typeof t.source?t.source:g.get(t.source),r="object"==typeof t.target?t.target:g.get(t.target);if(!e||!r)continue;if(null==e.x||null==e.y)continue;if(null==r.x||null==r.y)continue;const n=l?l(t):{},o={stroke:n.stroke||"#999",strokeWidth:null!==(a=n.strokeWidth)&&void 0!==a?a:1,opacity:null!==(i=n.opacity)&&void 0!==i?i:.6};f.push({type:"line",x1:e.x,y1:e.y,x2:r.x,y2:r.y,style:o,datum:t})}if(!1!==r.showLabels){const e=(p=r.nodeLabel)?"function"==typeof p?p:t=>t[p]||t.id:null;for(const r of t){if(null==r.x||null==r.y)continue;const t=e?e(r):r.id;if(!t)continue;const n=s(r);y.push({x:r.x,y:r.y-n-4,text:t+"",anchor:"middle",baseline:"auto",fontSize:11})}}var p;return{sceneNodes:h,sceneEdges:f,labels:y}}};function zt(t,e,r){var n,o;if(null==t)return()=>8;if("number"==typeof t)return()=>t;if("function"==typeof t)return e=>t(e)||8;const a=e||[5,20],i=r.map(e=>{var r;return null===(r=e.data)||void 0===r?void 0:r[t]}).filter(t=>null!=t&&"number"==typeof t);if(0===i.length)return()=>a[0];const c=null!==(n=f(i))&&void 0!==n?n:0,l=null!==(o=g(i))&&void 0!==o?o:1;if(c===l)return()=>(a[0]+a[1])/2;const s=N().domain([c,l]).range(a).clamp(!0);return e=>{var r;const n=null===(r=e.data)||void 0===r?void 0:r[t];return null==n||"number"!=typeof n?a[0]:s(n)}}const Ft=b,Yt={supportsStreaming:!1,hierarchical:!1,computeLayout(t,e,r,n){if(0===t.length)return;const{padAngle:o=.01,groupWidth:a=20,sortGroups:i}=r,c=Math.min(n[0],n[1])/2,l=c-a,s=n[0]/2,u=n[1]/2,d=(h=r.valueAccessor)?"function"==typeof h?h:t=>{var e;return null!==(e=t[h])&&void 0!==e?e:1}:t=>{var e;return null!==(e=t.value)&&void 0!==e?e:1};var h;const f=new Map;for(let e=0;t.length>e;e++)f.set(t[e].id,e);const y=t.length,g=Array.from({length:y},()=>Array.from({length:y},()=>0));for(const t of e){const e="string"==typeof t.target?t.target:t.target.id,r=f.get("string"==typeof t.source?t.source:t.source.id),n=f.get(e);if(void 0===r||void 0===n)continue;const o=d(t);g[r][n]=o}const p=j().padAngle(o);i&&p.sortGroups(i);const v=p(g),m=v.groups,b=R().innerRadius(l).outerRadius(c);for(const e of m){const r=t[e.index],n=b.centroid(e);r.x=n[0]+s,r.y=n[1]+u,r.arcData={startAngle:e.startAngle,endAngle:e.endAngle}}const x=new Map;for(const e of t)x.set(e.id,e);for(const t of e){const e="string"==typeof t.target?t.target:t.target.id,r=x.get("string"==typeof t.source?t.source:t.source.id),n=x.get(e);r&&(t.source=r),n&&(t.target=n)}const k=new Map;for(const t of e)k.set(`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}`,t);for(const e of v){const r=t[e.source.index].id,n=t[e.target.index].id,o=k.get(`${r}\0${n}`)||k.get(`${n}\0${r}`);o&&(o.chordData=e)}},buildScene(t,e,r,n){var o,a;const{groupWidth:i=20,edgeOpacity:c=.5}=r,l=Math.min(n[0],n[1])/2,s=l-i,u=n[0]/2,d=n[1]/2,h=r.nodeStyle,f=r.edgeStyle,y=r.edgeColorBy||"source",g=Array.isArray(r.colorScheme)?r.colorScheme:Ft,p=new Map;t.forEach((t,e)=>{p.set(t.id,g[e%g.length])});const v=M().radius(s),m=[],b=[],x=[];for(let e=0;t.length>e;e++){const r=t[e],n=r.arcData;if(!n)continue;let a;a=h?h(r).fill||p.get(r.id)||g[e%g.length]:p.get(r.id)||g[e%g.length];const i=h?h(r):{},c={fill:a,stroke:i.stroke||"black",strokeWidth:null!==(o=i.strokeWidth)&&void 0!==o?o:1,opacity:i.opacity};m.push({type:"arc",cx:u,cy:d,innerR:s,outerR:l,startAngle:n.startAngle-Math.PI/2,endAngle:n.endAngle-Math.PI/2,style:c,datum:r,id:r.id,label:r.id})}for(const t of e){const e=t.chordData;if(!e)continue;const r=v(e);if(!r)continue;const n=Xt(r,u,d);let o="#999";if(f)o=f(t).fill||o;else{const e="object"==typeof t.source?t.source:null,r="object"==typeof t.target?t.target:null;"target"===y&&r?o=p.get(r.id)||o:e&&(o=p.get(e.id)||o)}const i=f?f(t):{},l={fill:o,fillOpacity:null!==(a=i.fillOpacity)&&void 0!==a?a:c,stroke:i.stroke||"none",strokeWidth:i.strokeWidth,opacity:i.opacity};b.push({type:"ribbon",pathD:n,style:l,datum:t})}if(!1!==r.showLabels){const e=(k=r.nodeLabel)?"function"==typeof k?k:t=>t[k]||t.id:null,n=l+12;for(const r of t){const t=r.arcData;if(!t)continue;const o=e?e(r):r.id;if(!o)continue;const a=(t.startAngle+t.endAngle)/2,i=a-Math.PI/2;x.push({x:u+Math.cos(i)*n,y:d+Math.sin(i)*n,text:o+"",anchor:a>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var k;return{sceneNodes:m,sceneEdges:b,labels:x}}};function Xt(t,e,r){const n=t.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!n)return t;const o=[];let a=0;for(;n.length>a;){const t=n[a];if("M"===t||"L"===t)for(o.push(t),a++;n.length>a&&!isNaN(Number(n[a]));)o.push(Number(n[a])+e+""),a++,n.length>a&&!isNaN(Number(n[a]))&&(o.push(Number(n[a])+r+""),a++);else if("C"===t)for(o.push(t),a++;n.length>a&&!isNaN(Number(n[a]));)for(let t=0;3>t&&n.length>a&&!isNaN(Number(n[a]));t++)o.push(Number(n[a])+e+""),a++,n.length>a&&!isNaN(Number(n[a]))&&(o.push(Number(n[a])+r+""),a++);else if("Q"===t)for(o.push(t),a++;n.length>a&&!isNaN(Number(n[a]));)for(let t=0;2>t&&n.length>a&&!isNaN(Number(n[a]));t++)o.push(Number(n[a])+e+""),a++,n.length>a&&!isNaN(Number(n[a]))&&(o.push(Number(n[a])+r+""),a++);else if("A"===t)for(o.push(t),a++;n.length>a&&!isNaN(Number(n[a]));)o.push(n[a++]),n.length>a&&o.push(n[a++]),n.length>a&&o.push(n[a++]),n.length>a&&o.push(n[a++]),n.length>a&&o.push(n[a++]),n.length>a&&(o.push(Number(n[a])+e+""),a++),n.length>a&&(o.push(Number(n[a])+r+""),a++);else"Z"===t||"z"===t?(o.push(t),a++):(o.push(n[a]),a++)}return o.join(" ")}const Ht={supportsStreaming:!1,hierarchical:!0,computeLayout(t,e,r,n){var o;const a=r.__hierarchyRoot;if(!a)return;const i=r.chartType,c=(l=r.childrenAccessor)?"function"==typeof l?l:t=>t[l]:void 0;var l;const s=r.hierarchySum||(t=>{var e;return null!==(e=t.value)&&void 0!==e?e:0}),u=C(a,c);u.sum(s),u.sort((t,e)=>{var r,n;return(null!==(r=e.value)&&void 0!==r?r:0)-(null!==(n=t.value)&&void 0!==n?n:0)});const[d,h]=n;switch(i){case"tree":!function(t,e,r,n){const o=e.treeOrientation||"vertical",a=H();a.size("horizontal"===o?[n,r]:"radial"===o?[2*Math.PI,Math.min(r,n)/2*.8]:[r,n]),a(t)}(u,r,d,h);break;case"cluster":!function(t,e,r,n){const o=e.treeOrientation||"vertical",a=X();a.size("horizontal"===o?[n,r]:"radial"===o?[2*Math.PI,Math.min(r,n)/2*.8]:[r,n]),a(t)}(u,r,d,h);break;case"treemap":!function(t,e,r,n){var o,a;const i=null!==(o=e.padding)&&void 0!==o?o:4,c=null!==(a=e.paddingTop)&&void 0!==a?a:0,l=F().size([r,n]).tile(Y).padding(i);c>0&&l.paddingTop(c),l(t)}(u,r,d,h);break;case"circlepack":!function(t,e,r,n){var o;const a=null!==(o=e.padding)&&void 0!==o?o:4;z().size([r,n]).padding(a)(t)}(u,r,d,h);break;case"partition":!function(t,e,r,n){var o;B().size([r,n]).padding(null!==(o=e.padding)&&void 0!==o?o:1)(t)}(u,r,d,h)}const f=u.descendants();t.length=0,e.length=0;const y=new Map;for(let e=0;f.length>e;e++){const n=f[e],a={id:Kt(n,r,e),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(o=n.value)&&void 0!==o?o:0,depth:n.depth,data:n.data,createdByFrame:!0};"tree"===i||"cluster"===i?Gt(a,n,r):"treemap"===i||"partition"===i?qt(a,n):"circlepack"===i&&Vt(a,n),a.__hierarchyNode=n,t.push(a),y.set(n,a)}if("tree"===i||"cluster"===i)for(const t of f)if(t.parent){const r=y.get(t.parent),n=y.get(t);r&&n&&e.push({source:r,target:n,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:t.depth}})}},buildScene(t,e,r,n){const o=r.nodeStyle||(()=>({})),a=r.edgeStyle||(()=>({}));switch(r.chartType){case"tree":case"cluster":return function(t,e,r,n,o,a){var i,c,l,s,u;const d=[],h=[],f=[],y=r.treeOrientation||"vertical",g="radial"===y,p=n[0]/2,v=n[1]/2,m="number"==typeof(x=r.nodeSize)?x:5,b=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];var x;for(const e of t){let t=e.x,n=e.y;g&&(t+=p,n+=v);const a=o(e);let c=a.fill||"#4d430c";r.colorByDepth&&void 0!==e.depth&&(c=b[e.depth%b.length]);const l={fill:c,stroke:a.stroke||"#fff",strokeWidth:null!==(i=a.strokeWidth)&&void 0!==i?i:1,opacity:a.opacity};d.push({type:"circle",cx:t,cy:n,r:m,style:l,datum:e,id:e.id,label:e.id,depth:e.depth})}const k=null!==(c=r.edgeOpacity)&&void 0!==c?c:.5;for(const t of e){const e="object"==typeof t.source?t.source:null,r="object"==typeof t.target?t.target:null;if(!e||!r)continue;let n=e.x,o=e.y,i=r.x,c=r.y;g&&(n+=p,o+=v,i+=p,c+=v);const u=Zt(n,o,i,c,y),d=a(t),f={fill:"none",stroke:d.stroke||"#999",strokeWidth:null!==(l=d.strokeWidth)&&void 0!==l?l:1.5,opacity:null!==(s=d.opacity)&&void 0!==s?s:k};h.push({type:"curved",pathD:u,style:f,datum:t})}if(!1!==r.showLabels){const e=Qt(r.nodeLabel);for(const r of t){const t=e?e(r):r.id;if(!t)continue;let n,o,a,i=r.x,c=r.y;if(g&&(i+=p,c+=v),g){const t=i-p,e=c-v,r=Math.sqrt(t*t+e*e);r>0?(n=i+t/r*10,o=c+e/r*10,a=0>t?"end":"start"):(n=i,o=c-12,a="middle")}else"horizontal"===y?((null===(u=r.data)||void 0===u?void 0:u.children)&&0!==r.data.children.length?(n=i-m-6,a="end"):(n=i+m+6,a="start"),o=c):(n=i,o=c+m+14,a="middle");f.push({x:n,y:o,text:t+"",anchor:a,baseline:"middle",fontSize:11})}}return{sceneNodes:d,sceneEdges:h,labels:f}}(t,e,r,n,o,a);case"treemap":case"partition":return function(t,e,r,n){var o,a;const i=[],c=[],l=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];for(const r of t){const t=r.x1-r.x0,a=r.y1-r.y0;if(0>=t||0>=a)continue;const c=n(r);let s=c.fill||"#4d430c";e.colorByDepth&&void 0!==r.depth&&(s=l[r.depth%l.length]);const u={fill:s,stroke:c.stroke||"#fff",strokeWidth:null!==(o=c.strokeWidth)&&void 0!==o?o:1,opacity:c.opacity};i.push({type:"rect",x:r.x0,y:r.y0,w:t,h:a,style:u,datum:r,id:r.id,label:r.id,depth:r.depth})}if(!1!==e.showLabels){const r=Qt(e.nodeLabel);for(const n of t){const t=n.x1-n.x0,o=n.y1-n.y0;if(0>=t||0>=o)continue;if((null===(a=n.data)||void 0===a?void 0:a.children)&&n.data.children.length>0&&"partition"!==e.chartType)continue;const i=r?r(n):n.id;i&&(30>t||16>o||c.push({x:n.x0+t/2,y:n.y0+o/2,text:i+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(t,o)/6))}))}}return{sceneNodes:i,sceneEdges:[],labels:c}}(t,r,0,o);case"circlepack":return function(t,e,r,n){var o,a,i,c,l;const s=[],u=[],d=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];for(const r of t){const t=null!==(o=r.__radius)&&void 0!==o?o:5;if(0>=t)continue;const c=n(r);let l=c.fill||"#4d430c";e.colorByDepth&&void 0!==r.depth&&(l=d[r.depth%d.length]);const u={fill:l,stroke:c.stroke||"#fff",strokeWidth:null!==(a=c.strokeWidth)&&void 0!==a?a:1,opacity:null!==(i=c.opacity)&&void 0!==i?i:.7};s.push({type:"circle",cx:r.x,cy:r.y,r:t,style:u,datum:r,id:r.id,label:r.id,depth:r.depth})}if(!1!==e.showLabels){const r=Qt(e.nodeLabel);for(const e of t){const t=null!==(c=e.__radius)&&void 0!==c?c:5,n=r?r(e):e.id;if(!n)continue;if(15>t)continue;const o=!((null===(l=e.data)||void 0===l?void 0:l.children)&&e.data.children.length>0);u.push({x:e.x,y:o?e.y:e.y-t+14,text:n+"",anchor:"middle",baseline:o?"middle":"hanging",fontSize:Math.min(11,Math.max(8,t/3)),fill:o?void 0:"#000",stroke:o?void 0:"#fff",strokeWidth:o?void 0:3,paintOrder:o?void 0:"stroke"})}}return{sceneNodes:s,sceneEdges:[],labels:u}}(t,r,0,o);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function Gt(t,e,r){const n=r.treeOrientation||"vertical";if("radial"===n){const r=e.x,n=e.y;t.x=n*Math.cos(r-Math.PI/2),t.y=n*Math.sin(r-Math.PI/2)}else"horizontal"===n?(t.x=e.y,t.y=e.x):(t.x=e.x,t.y=e.y);t.x0=t.x-5,t.x1=t.x+5,t.y0=t.y-5,t.y1=t.y+5,t.width=10,t.height=10}function qt(t,e){t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.x=(e.x0+e.x1)/2,t.y=(e.y0+e.y1)/2,t.width=e.x1-e.x0,t.height=e.y1-e.y0}function Vt(t,e){var r;const n=null!==(r=e.r)&&void 0!==r?r:0;t.x=e.x,t.y=e.y,t.x0=e.x-n,t.x1=e.x+n,t.y0=e.y-n,t.y1=e.y+n,t.width=2*n,t.height=2*n,t.__radius=n}function Zt(t,e,r,n,o){if("horizontal"===o){const o=(t+r)/2;return`M ${t},${e} C ${o},${e} ${o},${n} ${r},${n}`}if("radial"===o){const o=(t+r)/2;return`M ${t},${e} Q ${o},${e} ${o},${(e+n)/2} T ${r},${n}`}{const o=(e+n)/2;return`M ${t},${e} C ${t},${o} ${r},${o} ${r},${n}`}}function Kt(t,e,r){const n=e.nodeIDAccessor;return"function"==typeof n?n(t.data)+"":"string"==typeof n&&void 0!==t.data[n]?t.data[n]+"":void 0!==t.data.name?t.data.name+"":void 0!==t.data.id?t.data.id+"":"node-"+r}function Qt(t){return t?"function"==typeof t?t:e=>{var r;return(null===(r=e.data)||void 0===r?void 0:r[t])||e[t]||e.id}:null}const Jt={sankey:Ct,force:Bt,chord:Yt,tree:Ht,cluster:Ht,treemap:Ht,circlepack:Ht,partition:Ht};function Ut(t){return Jt[t]}class te{constructor(t){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.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this.config=t,this.tensionConfig=Object.assign(Object.assign({},G),t.tensionConfig),"sankey"===t.chartType&&t.showParticles&&(this.particlePool=new V(2e3))}updateConfig(t){this.config=t,this.tensionConfig=Object.assign(Object.assign({},G),t.tensionConfig),"sankey"===t.chartType&&t.showParticles?this.particlePool||(this.particlePool=new V(2e3)):this.particlePool=null}ingestHierarchy(t,e){this.nodes.clear(),this.edges.clear(),this.config.__hierarchyRoot=t,this.runLayout(e)}ingestBounded(t,e,r){const{nodeIDAccessor:n="id",sourceAccessor:o="source",targetAccessor:a="target",valueAccessor:i="value"}=this.config,c="function"==typeof n?n:t=>t[n],l="function"==typeof o?o:t=>t[o],s="function"==typeof a?a:t=>t[a],u="function"==typeof i?i:t=>{var e;return null!==(e=t[i])&&void 0!==e?e:1};this.nodes.clear(),this.edges.clear();for(const e of t){const t=c(e)+"";this.nodes.set(t,Object.assign(Object.assign({},ee(t)),{data:e}))}for(const t of e){const e=l(t)+"",r=s(t)+"",n=Number(u(t))||1;this.nodes.has(e)||this.nodes.set(e,Object.assign(Object.assign({},ee(e)),{data:t})),this.nodes.has(r)||this.nodes.set(r,Object.assign(Object.assign({},ee(r)),{data:t})),this.edges.set(`${e}\0${r}`,{source:e,target:r,value:n,y0:0,y1:0,sankeyWidth:0,data:t})}this.runLayout(r)}edgeKey(t,e){return`${t}\0${e}`}ingestEdge(t){const{source:e,target:r,value:n}=t,o=0===this.nodes.size;let a=!1;const i="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=i,this.nodes.has(e)||(this.nodes.set(e,ee(e)),this.nodeTimestamps.set(e,i),this.tension+=this.tensionConfig.newNode,a=!0),this.nodes.has(r)||(this.nodes.set(r,ee(r)),this.nodeTimestamps.set(r,i),this.tension+=this.tensionConfig.newNode,a=!0);const c=this.edgeKey(e,r),l=this.edges.get(c);return l?(l.value+=n,this.edgeTimestamps.set(c,i),this.tension+=this.tensionConfig.weightChange):(this.edges.set(c,{source:e,target:r,value:n,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(c,i),this.tension+=this.tensionConfig.newEdge,a=!0),o||a||this.tension>=this.tensionConfig.threshold}runLayout(t){const e=Ut(this.config.chartType);if(!e)return;let r=Array.from(this.nodes.values()),n=Array.from(this.edges.values());if(0===r.length&&!e.hierarchical)return;if(this.prepareForRelayout(),e.computeLayout(r,n,this.config,t),e.hierarchical&&r.length>0){this.nodes.clear(),this.edges.clear();for(const t of r)this.nodes.set(t.id,t);for(const t of n)this.edges.set(`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}`,t)}this.finalizeLayout(),this.saveTargetPositions(),r.some(t=>void 0!==t._prevX0&&(0!==t._prevX0||0!==t._prevX1||0!==t._prevY0||0!==t._prevY1))&&this.tensionConfig.transitionDuration>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:this.tensionConfig.transitionDuration});const o=new Set(this.nodes.keys()),a=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const t of o)this.previousNodeIds.has(t)||this.addedNodes.add(t);for(const t of this.previousNodeIds)o.has(t)||this.removedNodes.add(t);for(const t of a)this.previousEdgeKeys.has(t)||this.addedEdges.add(t);for(const t of this.previousEdgeKeys)a.has(t)||this.removedEdges.add(t);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime="undefined"!=typeof performance?performance.now():Date.now()),this.previousNodeIds=o,this.previousEdgeKeys=a,this.layoutVersion++}buildScene(t){const e=Ut(this.config.chartType);if(!e)return;const r=Array.from(this.nodes.values()),n=Array.from(this.edges.values()),{sceneNodes:o,sceneEdges:a,labels:i}=e.buildScene(r,n,this.config,t);this.sceneNodes=o,this.sceneEdges=a,this.labels=i}advanceTransition(t){if(!this.transition)return!1;const e=Math.min((t-this.transition.startTime)/this.transition.duration,1),r=1-Math.pow(1-e,3);for(const t of this.nodes.values())void 0===t._targetX0||void 0===t._prevX0||0===t._prevX0&&0===t._prevX1||(t.x0=t._prevX0+(t._targetX0-t._prevX0)*r,t.x1=t._prevX1+(t._targetX1-t._prevX1)*r,t.y0=t._prevY0+(t._targetY0-t._prevY0)*r,t.y1=t._prevY1+(t._targetY1-t._prevY1)*r);for(const t of this.edges.values())void 0!==t._targetY0&&void 0!==t._prevY0&&void 0!==t._prevSankeyWidth&&t._prevSankeyWidth>0&&(t.y0=t._prevY0+(t._targetY0-t._prevY0)*r,t.y1=t._prevY1+(t._targetY1-t._prevY1)*r,t.sankeyWidth=t._prevSankeyWidth+(t._targetSankeyWidth-t._prevSankeyWidth)*r);return this.rebuildAllBeziers(),1>e||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){for(const t of this.nodes.values())t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1;for(const t of this.edges.values())t._prevY0=t.y0,t._prevY1=t.y1,t._prevSankeyWidth=t.sankeyWidth}finalizeLayout(){const t="vertical"===this.config.orientation?"down":"right";for(const t of this.nodes.values())if(0!==t.x0||0!==t.x1||0!==t.y0||0!==t.y1)t.width=t.x1-t.x0,t.height=t.y1-t.y0,t.x=t.x0+t.width/2,t.y=t.y0+t.height/2;else{const e=5;t.x0=t.x-e,t.x1=t.x+e,t.y0=t.y-e,t.y1=t.y+e,t.width=2*e,t.height=2*e}for(const e of this.edges.values())e.direction=t,this.updateEdgeBezier(e);this.tension=0}saveTargetPositions(){for(const t of this.nodes.values())t._targetX0=t.x0,t._targetX1=t.x1,t._targetY0=t.y0,t._targetY1=t.y1;for(const t of this.edges.values())t._targetY0=t.y0,t._targetY1=t.y1,t._targetSankeyWidth=t.sankeyWidth}restorePreviousPositions(){for(const t of this.nodes.values())void 0===t._prevX0||0===t._prevX0&&0===t._prevX1||(t.x0=t._prevX0,t.x1=t._prevX1,t.y0=t._prevY0,t.y1=t._prevY1);for(const t of this.edges.values())void 0!==t._prevY0&&void 0!==t._prevSankeyWidth&&t._prevSankeyWidth>0&&(t.y0=t._prevY0,t.y1=t._prevY1,t.sankeyWidth=t._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const t of this.nodes.values())void 0!==t._targetX0&&(t.x0=t._targetX0,t.x1=t._targetX1,t.y0=t._targetY0,t.y1=t._targetY1);for(const t of this.edges.values())void 0!==t._targetY0&&(t.y0=t._targetY0,t.y1=t._targetY1,t.sankeyWidth=t._targetSankeyWidth);this.rebuildAllBeziers()}updateEdgeBezier(t){const e="string"==typeof t.source?this.nodes.get(t.source):t.source,r="string"==typeof t.target?this.nodes.get(t.target):t.target;e&&r&&(t.bezier=t.circular&&t.circularPathData?this.buildCircularBezier(t):this.buildStandardBezier(t,e,r))}buildStandardBezier(t,e,r){const n=(t.sankeyWidth||1)/2;if("down"===t.direction){const o=e.y1,a=r.y0,i=h(o,a);return{circular:!1,points:[{x:t.y0,y:o},{x:t.y0,y:i(.5)},{x:t.y1,y:i(.5)},{x:t.y1,y:a}],halfWidth:n}}const o=e.x1,a=r.x0,i=h(o,a);return{circular:!1,points:[{x:o,y:t.y0},{x:i(.5),y:t.y0},{x:i(.5),y:t.y1},{x:a,y:t.y1}],halfWidth:n}}buildCircularBezier(t){const e=(t._circularWidth||t.sankeyWidth||1)/2,r=t.circularPathData;if(t._circularStub){const t=Math.max(15,Math.min(40,.33*(r.rightFullExtent-r.sourceX))),n=Math.max(15,Math.min(40,.33*(r.targetX-r.leftFullExtent)));return{circular:!0,segments:[[{x:r.sourceX,y:r.sourceY},{x:r.sourceX+.33*t,y:r.sourceY},{x:r.sourceX+.66*t,y:r.sourceY},{x:r.sourceX+t,y:r.sourceY}],[{x:r.targetX-n,y:r.targetY},{x:r.targetX-.66*n,y:r.targetY},{x:r.targetX-.33*n,y:r.targetY},{x:r.targetX,y:r.targetY}]],halfWidth:e}}let n;n="down"===t.direction?[{x:r.sourceY,y:r.sourceX},{x:r.sourceY,y:r.rightFullExtent},{x:r.verticalFullExtent,y:r.rightFullExtent},{x:r.verticalFullExtent,y:r.leftFullExtent},{x:r.targetY,y:r.leftFullExtent},{x:r.targetY,y:r.targetX}]:[{x:r.sourceX,y:r.sourceY},{x:r.rightFullExtent,y:r.sourceY},{x:r.rightFullExtent,y:r.verticalFullExtent},{x:r.leftFullExtent,y:r.verticalFullExtent},{x:r.leftFullExtent,y:r.targetY},{x:r.targetX,y:r.targetY}];const o=[];for(let t=0;n.length-1>t;t++){const e=n[t],r=n[t+1],a=r.x-e.x,i=r.y-e.y;o.push([e,{x:e.x+a/3,y:e.y+i/3},{x:e.x+2*a/3,y:e.y+2*i/3},r])}return{circular:!0,segments:o,halfWidth:e}}rebuildAllBeziers(){for(const t of this.nodes.values())t.width=t.x1-t.x0,t.height=t.y1-t.y0,t.x=t.x0+t.width/2,t.y=t.y0+t.height/2;for(const t of this.edges.values())this.updateEdgeBezier(t)}applyPulse(t){var e,r,n,o,a;const i=this.config.pulse;if(!i)return;const c=null!==(e=i.duration)&&void 0!==e?e:500,l=null!==(r=i.color)&&void 0!==r?r:"rgba(255,255,255,0.6)",s=null!==(n=i.glowRadius)&&void 0!==n?n:4;for(const e of this.sceneNodes){const r=e.id;if(!r)continue;const n=this.nodeTimestamps.get(r);if(!n)continue;const o=t-n;c>o&&(e._pulseIntensity=1-o/c,e._pulseColor=l,e._pulseGlowRadius=s)}for(const e of this.sceneEdges){const r=e.datum;if(!r)continue;const n="object"==typeof r.source?null===(o=r.source)||void 0===o?void 0:o.id:r.source,i="object"==typeof r.target?null===(a=r.target)||void 0===a?void 0:a.id:r.target;if(!n||!i)continue;const s=this.edgeTimestamps.get(`${n}\0${i}`);if(!s)continue;const u=t-s;c>u&&(e._pulseIntensity=1-u/c,e._pulseColor=l)}}applyDecay(){var t,e,r,n,o;const a=this.config.decay;if(!a)return;const i=null!==(t=a.minOpacity)&&void 0!==t?t:.1,c=this.nodeTimestamps.size;if(1>=c)return;const l=Array.from(this.nodeTimestamps.entries()).sort((t,e)=>t[1]-e[1]),s=new Map;for(let t=0;l.length>t;t++)s.set(l[t][0],t);for(const t of this.sceneNodes){const l=t.id;if(!l)continue;const u=s.get(l);if(void 0===u)continue;const d=c-1-u;let h;switch(a.type){case"linear":h=i+(1-d/(c-1))*(1-i);break;case"exponential":{const t=null!==(e=a.halfLife)&&void 0!==e?e:c/2;h=i+Math.pow(.5,d/t)*(1-i);break}case"step":h=(null!==(r=a.stepThreshold)&&void 0!==r?r:.5*c)>d?1:i;break;default:h=1}const f=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:f*h})}}applyTopologyDiff(t){var e;if(0===this.addedNodes.size)return;const r=t-this.lastTopologyChangeTime;if(r>=2e3)return;const n=1-r/2e3;for(const t of this.sceneNodes){const r=t.id;r&&this.addedNodes.has(r)&&(t._pulseIntensity=Math.max(null!==(e=t._pulseIntensity)&&void 0!==e?e:0,n),t._pulseColor="rgba(34, 197, 94, 0.7)",t._pulseGlowRadius=8)}}get hasActiveTopologyDiff(){return 0!==this.addedNodes.size&&2e3>("undefined"!=typeof performance?performance.now():Date.now())-this.lastTopologyChangeTime}applyThresholds(t){var e,r;const n=this.config.thresholds;if(!n)return;const o=null!==(e=n.warningColor)&&void 0!==e?e:"#f59e0b",a=null!==(r=n.criticalColor)&&void 0!==r?r:"#ef4444",i=!1!==n.pulse;for(const e of this.sceneNodes){const r=e.id;if(!r)continue;const c=this.nodes.get(r);if(!c)continue;const l=n.metric(c);let s=null;void 0===n.critical||n.critical>l?void 0===n.warning||n.warning>l||(s=o):s=a,s&&(e.style=Object.assign(Object.assign({},e.style),{fill:s}),i&&(e._pulseIntensity=.6+.4*Math.sin(t/300),e._pulseColor=s,e._pulseGlowRadius=6))}}get hasActiveThresholds(){const t=this.config.thresholds;if(!t)return!1;for(const e of this.nodes.values()){const r=t.metric(e);if(void 0!==t.warning&&r>=t.warning||void 0!==t.critical&&r>=t.critical)return!0}return!1}get hasActivePulses(){var t;const e=this.config.pulse;if(!e||0===this.lastIngestTime)return!1;const r="undefined"!=typeof performance?performance.now():Date.now();return(null!==(t=e.duration)&&void 0!==t?t:500)>r-this.lastIngestTime}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.lastIngestTime=0,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.particlePool&&this.particlePool.clear()}}function ee(t){return{id:t,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function re(t,e,r,n,o=30){let a=null,i=o,c=1/0;for(const e of t){const t=ne(e,r,n);if(t)if("rect"===e.type){const r=e.w*e.h;c>r&&(a=t,c=r)}else i>t.distance&&(a=t,i=t.distance)}if(a)return a;for(const t of e){const e=oe(t,r,n);e&&i>e.distance&&(a=e,i=e.distance)}return a}function ne(t,e,r){switch(t.type){case"circle":return function(t,e,r){const n=e-t.cx,o=r-t.cy,a=Math.sqrt(n*n+o*o);return a>Math.max(t.r,5)+5?null:{type:"node",datum:t.datum,x:t.cx,y:t.cy,distance:a}}(t,e,r);case"rect":return function(t,e,r){return t.x>e||e>t.x+t.w||t.y>r||r>t.y+t.h?null:{type:"node",datum:t.datum,x:t.x+t.w/2,y:t.y+t.h/2,distance:0}}(t,e,r);case"arc":return function(t,e,r){const n=e-t.cx,o=r-t.cy,a=Math.sqrt(n*n+o*o);if(t.innerR-2>a||a>t.outerR+2)return null;let i=Math.atan2(o,n);0>i&&(i+=2*Math.PI);let c,l=t.startAngle,s=t.endAngle;if(0>l&&(l+=2*Math.PI),0>s&&(s+=2*Math.PI),c=l>s?i>=l||s>=i:i>=l&&s>=i,c){const e=(t.startAngle+t.endAngle)/2,r=(t.innerR+t.outerR)/2;return{type:"node",datum:t.datum,x:t.cx+r*Math.cos(e),y:t.cy+r*Math.sin(e),distance:0}}return null}(t,e,r);default:return null}}function oe(t,e,r){switch(t.type){case"bezier":return function(t,e,r){var n,o;if(!t.pathD)return null;try{const a=new Path2D(t.pathD),i=document.createElement("canvas").getContext("2d");if(!i)return null;if(i.isPointInPath(a,e,r)){const a="object"==typeof(null===(n=t.datum)||void 0===n?void 0:n.source)?t.datum.source:null,i="object"==typeof(null===(o=t.datum)||void 0===o?void 0:o.target)?t.datum.target:null;return{type:"edge",datum:t.datum,x:a&&i?(a.x1+i.x0)/2:e,y:t.datum?(t.datum.y0+t.datum.y1)/2:r,distance:0}}}catch(t){}return null}(t,e,r);case"line":return function(t,e,r){const n=t.x2-t.x1,o=t.y2-t.y1,a=n*n+o*o;if(0===a)return null;let i=((e-t.x1)*n+(r-t.y1)*o)/a;i=Math.max(0,Math.min(1,i));const c=t.x1+i*n,l=t.y1+i*o,s=Math.sqrt(Math.pow(e-c,2)+Math.pow(r-l,2));return s>5?null:{type:"edge",datum:t.datum,x:c,y:l,distance:s}}(t,e,r);case"ribbon":case"curved":return function(t,e,r){if(!t.pathD)return null;try{const n=new Path2D(t.pathD),o=document.createElement("canvas").getContext("2d");if(!o)return null;if(o.isPointInPath(n,e,r))return{type:"edge",datum:t.datum,x:e,y:r,distance:0}}catch(t){}return null}(t,e,r);default:return null}}function ae(e){const{width:r,height:n,totalWidth:o,totalHeight:a,margin:i,labels:c,title:l,legend:s,foregroundGraphics:u,annotations:d,svgAnnotationRules:h}=e;return t.createElement("svg",{width:o,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},t.createElement("g",{transform:`translate(${i.left},${i.top})`},c.map((e,r)=>t.createElement("text",{key:"label-"+r,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)),d&&h&&d.map((e,o)=>{const a=h(e,o,{width:r,height:n});return a?t.createElement(t.Fragment,{key:"annotation-"+o},a):null}),u),l&&"string"==typeof l?t.createElement("text",{x:o/2,y:16,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"currentColor"},l):l?t.createElement("foreignObject",{x:0,y:0,width:o,height:i.top},l):null,s&&"object"==typeof s&&"legendGroups"in s?t.createElement("g",{transform:`translate(${o-i.right+10},${i.top})`},s.legendGroups.map((e,r)=>{var n;return t.createElement("g",{key:"legend-group-"+r},null===(n=e.items)||void 0===n?void 0:n.map((e,r)=>t.createElement("g",{key:"legend-item-"+r,transform:`translate(0,${20*r})`},t.createElement("rect",{x:0,y:0,width:12,height:12,fill:e.color,rx:2}),t.createElement("text",{x:18,y:10,fontSize:11,fill:"currentColor"},e.label))))})):s?t.createElement("g",{transform:`translate(${o-i.right+10},${i.top})`},s):null)}function ie(t,e){var r,n,o,a,i,c;if(!e.pathD)return;t.save();const l=new Path2D(e.pathD);if(e.style.fill&&"none"!==e.style.fill){const i=e._gradient;if(i){const o=t.createLinearGradient(i.x0,0,i.x1,0),a=null!==(n=null!==(r=e.style.fillOpacity)&&void 0!==r?r:e.style.opacity)&&void 0!==n?n:.5,c=e.style.fill;o.addColorStop(0,1===i.from?c:"transparent"),o.addColorStop(1,1===i.to?c:"transparent"),t.fillStyle=o,t.globalAlpha=a}else t.fillStyle=e.style.fill,t.globalAlpha=null!==(a=null!==(o=e.style.fillOpacity)&&void 0!==o?o:e.style.opacity)&&void 0!==a?a:.5;t.fill(l)}e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=e.style.stroke,t.lineWidth=null!==(i=e.style.strokeWidth)&&void 0!==i?i:.5,t.globalAlpha=.5*(null!==(c=e.style.opacity)&&void 0!==c?c:1),t.stroke(l)),e._pulseIntensity&&e._pulseIntensity>0&&(t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.globalAlpha=.2*e._pulseIntensity,t.fill(l)),t.restore()}function ce(t,e){var r,n;t.save(),t.strokeStyle=e.style.stroke||"#999",t.lineWidth=null!==(r=e.style.strokeWidth)&&void 0!==r?r:1,void 0!==e.style.opacity&&(t.globalAlpha=e.style.opacity),e.style.strokeDasharray&&t.setLineDash(e.style.strokeDasharray.split(/[\s,]+/).map(Number)),t.beginPath(),t.moveTo(e.x1,e.y1),t.lineTo(e.x2,e.y2),t.stroke(),e._pulseIntensity&&e._pulseIntensity>0&&(t.setLineDash([]),t.strokeStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.lineWidth=(null!==(n=e.style.strokeWidth)&&void 0!==n?n:1)+3*e._pulseIntensity,t.globalAlpha=.4*e._pulseIntensity,t.beginPath(),t.moveTo(e.x1,e.y1),t.lineTo(e.x2,e.y2),t.stroke()),t.restore()}function le(t,e){var r,n,o,a;if(!e.pathD)return;t.save();const i=new Path2D(e.pathD);e.style.fill&&"none"!==e.style.fill&&(t.fillStyle=e.style.fill,t.globalAlpha=null!==(n=null!==(r=e.style.fillOpacity)&&void 0!==r?r:e.style.opacity)&&void 0!==n?n:.5,t.fill(i)),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=e.style.stroke,t.lineWidth=null!==(o=e.style.strokeWidth)&&void 0!==o?o:.5,t.globalAlpha=.3*(null!==(a=e.style.opacity)&&void 0!==a?a:1),t.stroke(i)),t.restore()}function se(t,e){var r,n;if(!e.pathD)return;t.save();const o=new Path2D(e.pathD);t.strokeStyle=e.style.stroke||"#999",t.lineWidth=null!==(r=e.style.strokeWidth)&&void 0!==r?r:1,void 0!==e.style.opacity&&(t.globalAlpha=e.style.opacity),t.stroke(o),e.style.fill&&"none"!==e.style.fill&&(t.fillStyle=e.style.fill,t.globalAlpha=null!==(n=e.style.fillOpacity)&&void 0!==n?n:.1,t.fill(o)),t.restore()}ae.displayName="NetworkSVGOverlay";const ue={category10:b,tableau10:S,set3:P,blues:A,reds:D,greens:E,oranges:L,purples:w,viridis:k,plasma:x},de=b,he=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"];function fe(t,e,r){if("function"==typeof e)return e(t);const n=t[e];return r?r(n):de[Math.abs(function(t){let e=0;for(let r=0;t.length>r;r++)e=(e<<5)-e+t.charCodeAt(r),e&=e;return Math.abs(e)}(n+""))%de.length]}function ye(t,e,r="category10"){const n=Array.from(new Set(t.map(t=>t[e]))),o=n.every(t=>"number"==typeof t||!isNaN(Number(t)));if(Array.isArray(r))return W().domain(n).range(r).unknown("#999");const a=ue[r]||ue.category10;if(o&&"function"==typeof a)return t=>a(Number(t)/Math.max(...n.map(Number)));{const t=Array.isArray(a)?a:de;return W().domain(n).range(t).unknown("#999")}}const ge={top:20,right:80,bottom:20,left:80},pe={top:40,right:40,bottom:40,left:40},ve=new Set(["chord","force","circlepack"]),me=[800,600],be={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 xe({data:e}){var r,n,o,a,i,c;if("edge"===e.type){const r=e.data;return t.createElement("div",{className:"semiotic-tooltip",style:be},t.createElement("div",{style:{fontWeight:600}},"object"==typeof r.source?r.source.id:r.source," → ","object"==typeof r.target?r.target.id:r.target),null!=r.value&&t.createElement("div",{style:{marginTop:4,opacity:.8}},"Value:"," ","number"==typeof r.value?r.value.toLocaleString():r.value+""))}const l=e.data,s=null==l?void 0:l.__hierarchyNode;if(s){const e=[];let i=s;for(;i;){const t=null!==(a=null!==(n=null===(r=i.data)||void 0===r?void 0:r.name)&&void 0!==n?n:null===(o=i.data)||void 0===o?void 0:o.id)&&void 0!==a?a:l.id;null!=t&&e.unshift(t+""),i=i.parent}e.length>1&&e.shift();const c=e.length-1;return t.createElement("div",{className:"semiotic-tooltip",style:be},t.createElement("div",null,e.map((e,r)=>t.createElement("span",{key:r},r>0&&t.createElement("span",{style:{margin:"0 3px",opacity:.5}}," → "),r===c?t.createElement("strong",null,e):t.createElement("span",{style:{opacity:.7}},e)))),null!=l.value&&l.value>0&&t.createElement("div",{style:{marginTop:4,opacity:.8}},"number"==typeof l.value?l.value.toLocaleString():l.value+""))}const u=((null===(i=l.sourceLinks)||void 0===i?void 0:i.length)||0)+((null===(c=l.targetLinks)||void 0===c?void 0:c.length)||0),d=(l.sourceLinks||[]).reduce((t,e)=>t+(e.value||0),0)+(l.targetLinks||[]).reduce((t,e)=>t+(e.value||0),0);return t.createElement("div",{className:"semiotic-tooltip",style:be},t.createElement("div",{style:{fontWeight:600}},l.id),null!=l.value&&l.value>0&&t.createElement("div",{style:{marginTop:4,opacity:.8}},"Total:"," ","number"==typeof l.value?l.value.toLocaleString():l.value+""),u>0&&t.createElement("div",{style:{marginTop:4,opacity:.8}},"Connections: ",u,d!==u&&` (weighted: ${d.toLocaleString()})`))}const ke=e(function(e,l){const{chartType:s,nodes:u,edges:d,data:h,initialEdges:f,nodeIDAccessor:y="id",sourceAccessor:g="source",targetAccessor:p="target",valueAccessor:v="value",childrenAccessor:m,hierarchySum:b,orientation:x="horizontal",nodeAlign:k="justify",nodePaddingRatio:w=.05,nodeWidth:L=15,iterations:E=300,forceStrength:D=.1,padAngle:A=.01,groupWidth:P=20,sortGroups:S,edgeSort:T,treeOrientation:O="vertical",edgeType:$="curve",padding:_,paddingTop:I,tensionConfig:N,showParticles:W=!1,particleStyle:M,nodeStyle:j,edgeStyle:R,colorBy:C,colorScheme:B="category10",edgeColorBy:z="source",edgeOpacity:F=.5,colorByDepth:Y=!1,nodeSize:X=8,nodeSizeRange:H=[5,20],nodeLabel:V,showLabels:Z=!0,size:K=me,margin:Q,className:J,background:U,enableHover:tt=!0,tooltipContent:et,customHoverBehavior:rt,customClickBehavior:nt,onObservation:ot,chartId:at,onTopologyChange:it,annotations:ct,svgAnnotationRules:lt,legend:st,title:ut,foregroundGraphics:dt,backgroundGraphics:ht,decay:ft,pulse:yt,staleness:gt,thresholds:pt}=e,vt=ve.has(s)?pe:ge,mt=Object.assign(Object.assign({},vt),Q),bt=K[0]-mt.left-mt.right,xt=K[1]-mt.top-mt.bottom,kt=r(()=>Object.assign(Object.assign({},G),N),[N]),wt=r(()=>Object.assign(Object.assign({},q),M),[M]),Lt=r(()=>({chartType:s,nodeIDAccessor:y,sourceAccessor:g,targetAccessor:p,valueAccessor:v,childrenAccessor:m,hierarchySum:b,orientation:x,nodeAlign:k,nodePaddingRatio:w,nodeWidth:L,iterations:E,forceStrength:D,padAngle:A,groupWidth:P,sortGroups:S,edgeSort:T,treeOrientation:O,edgeType:$,padding:_,paddingTop:I,tensionConfig:kt,showParticles:W,particleStyle:wt,nodeStyle:j,edgeStyle:R,nodeLabel:V,showLabels:Z,colorBy:C,colorScheme:B,edgeColorBy:z,edgeOpacity:F,colorByDepth:Y,nodeSize:X,nodeSizeRange:H,decay:ft,pulse:yt,staleness:gt,thresholds:pt}),[s,y,g,p,v,m,b,x,k,w,L,E,D,A,P,S,T,O,$,_,I,kt,W,wt,j,R,V,Z,C,B,z,F,Y,X,H,ft,yt,gt,pt]),Et=n(null),Dt=n(0),At=n(0),Pt=n(!0),St=n(()=>{}),Tt=n(null);Tt.current||(Tt.current=new te(Lt));const[Ot,$t]=o(null),[_t,It]=o(0),[Nt,Wt]=o(0),[Mt,jt]=o(!1),Rt=n(null),Ct=n(new Map),Bt=n(0),zt=a(t=>{if("function"==typeof C)return C(t);if("string"==typeof C&&t.data){const e=t.data[C];if(void 0!==e){if(!Ct.current.has(e+"")){const t=Array.isArray(B)?B:de;Ct.current.set(e+"",t[Bt.current++%t.length])}return Ct.current.get(e+"")}}if(!Ct.current.has(t.id)){const e=Array.isArray(B)?B:de;Ct.current.set(t.id,e[Bt.current++%e.length])}return Ct.current.get(t.id)},[C,B]),Ft=a(t=>{if("function"==typeof z)return z(t);const e="object"==typeof t.source?t.source:null,r="object"==typeof t.target?t.target:null;return"target"===z&&r?zt(r):e?zt(e):"#999"},[z,zt]),Yt=a(t=>{if(!(null==M?void 0:M.colorBy))return Ft(t);const e="object"==typeof t.source?t.source:null,r="object"==typeof t.target?t.target:null;return"target"===wt.colorBy&&r?zt(r):e?zt(e):"#999"},[null==M?void 0:M.colorBy,wt.colorBy,zt,Ft]),Xt="sankey"===s&&W||!!yt,Ht=a(()=>{Dt.current&&!Xt||Dt.current||(Dt.current=requestAnimationFrame(()=>St.current()))},[Xt]);i(()=>{var t;null===(t=Tt.current)||void 0===t||t.updateConfig(Lt),Pt.current=!0,Ht()},[Lt,Ht]);const Gt=a(()=>{const t=Tt.current;if(!t)return;t.runLayout([bt,xt]),t.buildScene([bt,xt]),Pt.current=!0;const e=Array.isArray(B)?B:de,r=Array.from(t.nodes.values());for(let t=0;r.length>t;t++){const n=r[t];Ct.current.has(n.id)||Ct.current.set(n.id,e[t%e.length])}if(Bt.current=r.length,It(t.layoutVersion),it){const{nodes:e,edges:r}=t.getLayoutData();it(e,r)}},[bt,xt,it,B]),qt=a(t=>{const e=Tt.current;e&&(e.ingestEdge(t)&&Gt(),Ht())},[Gt,Ht]),Vt=a(t=>{const e=Tt.current;if(!e)return;let r=!1;for(const n of t)e.ingestEdge(n)&&(r=!0);r&&Gt(),Ht()},[Gt,Ht]),Zt=a(()=>{var t;null===(t=Tt.current)||void 0===t||t.clear(),Ct.current.clear(),Bt.current=0,It(0),$t(null),Rt.current=null,Pt.current=!0,Ht()},[Ht]),Kt=a(()=>{const t=Tt.current;t&&(t.tension+=999,Gt(),Ht())},[Gt,Ht]);c(l,()=>({push:qt,pushMany:Vt,clear:Zt,getTopology:()=>{var t,e;return null!==(e=null===(t=Tt.current)||void 0===t?void 0:t.getLayoutData())&&void 0!==e?e:{nodes:[],edges:[]}},getTopologyDiff:()=>{const t=Tt.current;return t?{addedNodes:Array.from(t.addedNodes),removedNodes:Array.from(t.removedNodes),addedEdges:Array.from(t.addedEdges),removedEdges:Array.from(t.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:Kt,getTension:()=>{var t,e;return null!==(e=null===(t=Tt.current)||void 0===t?void 0:t.tension)&&void 0!==e?e:0}}),[qt,Vt,Zt,Kt]);const Qt=["tree","cluster","treemap","circlepack","partition"].includes(s),Jt=Qt?h||(Array.isArray(d)?void 0:d):void 0;i(()=>{const t=Tt.current;if(t)if(Qt&&Jt)t.ingestHierarchy(Jt,[bt,xt]),t.buildScene([bt,xt]),Pt.current=!0,Ht();else{const e=u||[],r=Array.isArray(d)?d:[];if(0===e.length&&0===r.length)return;t.ingestBounded(e,r,[bt,xt]),t.buildScene([bt,xt]);const n=Array.isArray(B)?B:de,o=Array.from(t.nodes.values());for(let t=0;o.length>t;t++){const e=o[t];Ct.current.has(e.id)||Ct.current.set(e.id,n[t%n.length])}Bt.current=o.length,Pt.current=!0,Ht()}},[u,d,h,Jt,Qt,bt,xt,Lt,Ht,B]),i(()=>{f&&f.length>0&&Vt(f)},[]);const Ut=a(t=>{if(rt&&rt(t),ot){const e=Date.now();ot(t?{type:"hover",datum:t.data||{},x:t.x,y:t.y,timestamp:e,chartType:"StreamNetworkFrame",chartId:at}:{type:"hover-end",timestamp:e,chartType:"StreamNetworkFrame",chartId:at})}},[rt,ot,at]),ee=a(t=>{if(nt&&nt(t),ot){const e=Date.now();ot(t?{type:"click",datum:t.data||{},x:t.x,y:t.y,timestamp:e,chartType:"StreamNetworkFrame",chartId:at}:{type:"click-end",timestamp:e,chartType:"StreamNetworkFrame",chartId:at})}},[nt,ot,at]),ne=n(()=>{}),oe=n(()=>{});ne.current=t=>{if(!tt)return;const e=Et.current;if(!e)return;const r=e.getBoundingClientRect(),n=t.clientX-r.left-mt.left,o=t.clientY-r.top-mt.top;if(0>n||n>bt||0>o||o>xt)return void(Rt.current&&(Rt.current=null,$t(null),Ut&&Ut(null),Ht()));const a=Tt.current;if(!a)return;const i=re(a.sceneNodes,a.sceneEdges,n,o);if(!i)return void(Rt.current&&(Rt.current=null,$t(null),Ut&&Ut(null),Ht()));const c={type:i.type,data:i.datum,x:i.x,y:i.y};Rt.current=c,$t(c),Ut&&Ut(c),Ht()},oe.current=()=>{Rt.current&&(Rt.current=null,$t(null),Ut&&Ut(null),Ht())};const ue=n(()=>{});ue.current=t=>{if(!nt&&!ot)return;const e=Et.current;if(!e)return;const r=e.getBoundingClientRect(),n=t.clientX-r.left-mt.left,o=t.clientY-r.top-mt.top;if(0>n||n>bt||0>o||o>xt)return;const a=Tt.current;if(!a)return;const i=re(a.sceneNodes,a.sceneEdges,n,o);ee(i?{type:i.type,data:i.datum,x:i.x,y:i.y}:null)};const he=a(t=>ne.current(t),[]),fe=a(()=>oe.current(),[]),ye=a(t=>ue.current(t),[]);St.current=()=>{var t,e,r;Dt.current=0;const n=Et.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const a=Tt.current;if(!a)return;const i=performance.now(),c=At.current?Math.min((i-At.current)/1e3,.1):.016;At.current=i;const l=a.advanceTransition(i);(l||Pt.current)&&a.buildScene([bt,xt]);const s="undefined"!=typeof window&&window.devicePixelRatio||1;n.width=K[0]*s,n.height=K[1]*s,n.style.width=K[0]+"px",n.style.height=K[1]+"px",o.scale(s,s),o.translate(mt.left,mt.top),o.clearRect(-mt.left,-mt.top,K[0],K[1]),U&&(o.fillStyle=U,o.fillRect(0,0,bt,xt)),ft&&a.applyDecay(),yt&&a.applyPulse(i),pt&&a.applyThresholds(i),a.applyTopologyDiff(i);const u=null!==(t=null==gt?void 0:gt.threshold)&&void 0!==t?t:5e3,d=gt&&a.lastIngestTime>0&&i-a.lastIngestTime>u;if(d&&(o.globalAlpha=null!==(e=null==gt?void 0:gt.dimOpacity)&&void 0!==e?e:.5),function(t,e){for(const r of e)switch(r.type){case"bezier":ie(t,r);break;case"line":ce(t,r);break;case"ribbon":le(t,r);break;case"curved":se(t,r)}}(o,a.sceneEdges),function(t,e){var r,n,o;for(const a of e){if("rect"!==a.type)continue;const e=a;e.w>0&&e.h>0&&(t.save(),void 0!==e.style.opacity&&(t.globalAlpha=e.style.opacity),e.style.fill&&(t.fillStyle=e.style.fill,void 0!==e.style.fillOpacity&&(t.globalAlpha=(null!==(r=e.style.opacity)&&void 0!==r?r:1)*e.style.fillOpacity),t.fillRect(e.x,e.y,e.w,e.h)),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=e.style.stroke,t.lineWidth=null!==(n=e.style.strokeWidth)&&void 0!==n?n:1,t.globalAlpha=null!==(o=e.style.opacity)&&void 0!==o?o:1,t.strokeRect(e.x,e.y,e.w,e.h)),e._pulseIntensity&&e._pulseIntensity>0&&(t.globalAlpha=.3*e._pulseIntensity,t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.fillRect(e.x,e.y,e.w,e.h)),t.restore())}}(o,a.sceneNodes),function(t,e){var r,n,o,a;for(const i of e){if("circle"!==i.type)continue;const e=i;if(e.r>0){if(t.save(),void 0!==e.style.opacity&&(t.globalAlpha=e.style.opacity),t.beginPath(),t.arc(e.cx,e.cy,e.r,0,2*Math.PI),e.style.fill&&(t.fillStyle=e.style.fill,void 0!==e.style.fillOpacity&&(t.globalAlpha=(null!==(r=e.style.opacity)&&void 0!==r?r:1)*e.style.fillOpacity),t.fill()),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=e.style.stroke,t.lineWidth=null!==(n=e.style.strokeWidth)&&void 0!==n?n:1,t.globalAlpha=null!==(o=e.style.opacity)&&void 0!==o?o:1,t.stroke()),e._pulseIntensity&&e._pulseIntensity>0){const r=null!==(a=e._pulseGlowRadius)&&void 0!==a?a:4,n=e.r+r*e._pulseIntensity;t.beginPath(),t.arc(e.cx,e.cy,n,0,2*Math.PI),t.strokeStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.lineWidth=2*e._pulseIntensity,t.globalAlpha=.6*e._pulseIntensity,t.stroke()}t.restore()}}}(o,a.sceneNodes),function(t,e){var r,n,o;for(const a of e){if("arc"!==a.type)continue;const e=a;t.save(),void 0!==e.style.opacity&&(t.globalAlpha=e.style.opacity),t.beginPath(),t.arc(e.cx,e.cy,e.outerR,e.startAngle,e.endAngle),t.arc(e.cx,e.cy,e.innerR,e.endAngle,e.startAngle,!0),t.closePath(),e.style.fill&&(t.fillStyle=e.style.fill,void 0!==e.style.fillOpacity&&(t.globalAlpha=(null!==(r=e.style.opacity)&&void 0!==r?r:1)*e.style.fillOpacity),t.fill()),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=e.style.stroke,t.lineWidth=null!==(n=e.style.strokeWidth)&&void 0!==n?n:1,t.globalAlpha=null!==(o=e.style.opacity)&&void 0!==o?o:1,t.stroke()),t.restore()}}(o,a.sceneNodes),W&&a.particlePool&&!d){const t=Array.from(a.edges.values());if(t.length>0){!function(t,e,r,n){var o,a;const i=null!==(o=n.spawnRate)&&void 0!==o?o:q.spawnRate,c=null!==(a=n.maxPerEdge)&&void 0!==a?a:q.maxPerEdge;for(let n=0;e.length>n;n++){const o=e[n];if(!o.bezier)continue;if(t.countForEdge(n)>=c)continue;const a=o.value*i*r*(o.bezier.circular?.3:1),l=Math.floor(a),s=a-l;let u=l;Math.random()<s&&u++;for(let e=0;u>e&&t.countForEdge(n)<c;e++)t.spawn(n)}}(a.particlePool,t,c,wt);const e=.5*(null!==(r=wt.speedMultiplier)&&void 0!==r?r:1);let n;if(wt.proportionalSpeed){const e=t.reduce((t,e)=>Math.max(t,e.value||1),1);n=t.map(t=>.3+(t.value||1)/e*1.7)}a.particlePool.step(c,e,t,n),function(t,e,r,n,o){var a,i;const c=null!==(a=n.radius)&&void 0!==a?a:q.radius,l=null!==(i=n.opacity)&&void 0!==i?i:q.opacity;t.globalAlpha=l;for(let a=0;e.particles.length>a;a++){const i=e.particles[a];if(!i.active)continue;const l=r[i.edgeIndex];if(l){if("function"==typeof n.color){const e="object"==typeof l.source?l.source:null;t.fillStyle=e?n.color(l,e):"#666"}else t.fillStyle=n.color&&"inherit"!==n.color?n.color:o(l);t.beginPath(),t.arc(i.x,i.y,c,0,2*Math.PI),t.fill()}}t.globalAlpha=1}(o,a.particlePool,t,wt,Yt)}}d&&(o.globalAlpha=1);const h=Pt.current;Pt.current=!1,(h||l)&&Wt(t=>t+1),(Xt||l||a.hasActivePulses||a.hasActiveThresholds||a.hasActiveTopologyDiff)&&(Dt.current=requestAnimationFrame(()=>St.current()))},i(()=>(Ht(),()=>{Dt.current&&cancelAnimationFrame(Dt.current)}),[Ht]),i(()=>{Pt.current=!0,Ht()},[s,bt,xt,U,Ht]),i(()=>{if(!gt)return;const t=setInterval(()=>{var t;const e=Tt.current;if(!e||0===e.lastIngestTime)return;const r="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(t=gt.threshold)&&void 0!==t?t:5e3,o=r-e.lastIngestTime>n;o!==Mt&&(jt(o),Pt.current=!0,Ht())},1e3);return()=>clearInterval(t)},[gt,Mt,Ht]);const be=tt&&Ot?t.createElement("div",{className:"stream-network-tooltip",style:{position:"absolute",left:mt.left+Ot.x,top:mt.top+Ot.y,transform:`translate(${Ot.x>.6*bt?"calc(-100% - 12px)":"12px"}, ${.3*xt>Ot.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:2}},et?et(Ot):t.createElement(xe,{data:Ot})):null,ke=Tt.current;return t.createElement("div",{className:"stream-network-frame"+(J?" "+J:""),role:"img","aria-label":"string"==typeof ut?ut:"Network chart",style:{position:"relative",width:K[0],height:K[1]},onMouseMove:tt?he:void 0,onMouseLeave:tt?fe:void 0,onClick:nt||ot?ye:void 0},ht&&t.createElement("svg",{style:{position:"absolute",top:0,left:0,width:K[0],height:K[1],pointerEvents:"none"}},t.createElement("g",{transform:`translate(${mt.left},${mt.top})`},ht)),t.createElement("canvas",{ref:Et,style:{position:"absolute",top:0,left:0}}),t.createElement(ae,{width:bt,height:xt,totalWidth:K[0],totalHeight:K[1],margin:mt,labels:(null==ke?void 0:ke.labels)||[],title:ut,legend:st,foregroundGraphics:dt,annotations:ct,svgAnnotationRules:lt,annotationFrame:Nt}),be,(null==gt?void 0:gt.showBadge)&&t.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===gt.badgePosition?{top:4,left:4}:"bottom-left"===gt.badgePosition?{bottom:4,left:4}:"bottom-right"===gt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{background:Mt?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"})},Mt?"STALE":"LIVE"))});ke.displayName="StreamNetworkFrame";const we={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 Le(t,e){return"function"==typeof e?e(t):t[e]}function Ee(t,e){return e?e(t):null==t?"":"number"==typeof t?t.toLocaleString():t instanceof Date?t.toLocaleDateString():"object"==typeof t&&null!==t?void 0!==t.id?t.id+"":void 0!==t.name?t.name+"":JSON.stringify(t):t+""}function De(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:r,title:n,format:o,style:a={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let c;const l=[];if(n){const t=Le(e,n);c=Ee(t,o)}if(r&&r.length>0)r.forEach(t=>{let r,n,a;"string"==typeof t?(r=t,n=t,a=o):(r=t.label,n=t.accessor||t.key||"",a=t.format||o);const i=Le(e,n);l.push({label:r,value:Ee(i,a)})});else if(!n){const t=["value","y","name","id","label"];for(const r of t)if(void 0!==e[r]){c=Ee(e[r],o);break}if(!c){const t=Object.keys(e).filter(t=>!t.startsWith("_"));t.length>0&&(c=Ee(e[t[0]],o))}}const s=Object.assign(Object.assign({},we),a);return t.createElement("div",{className:("semiotic-tooltip "+i).trim(),style:s},c&&t.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},c),l.map((e,r)=>t.createElement("div",{key:r,style:{marginTop:0===r&&c?"4px":0}},e.label&&t.createElement("span",null,e.label,": "),e.value)))}}(e)))}function Ae(e){const n=l(null),a=Pe(e);return[function({children:o}){const a=r(()=>Pe(e),[]);return t.createElement(n.Provider,{value:a,children:o})},t=>{var e;const r=null!==(e=s(n))&&void 0!==e?e:a;return function(t,e){const[r,n]=o(e);return u(()=>t(()=>n(e)),[t]),r}(r.subscribe,()=>t(r.getState()))}]}function Pe(t){const e=new EventTarget;let r=t(function(t){r=Object.assign(Object.assign({},r),t(r)),e.dispatchEvent(new CustomEvent("update"))});return{getState:()=>r,subscribe:function(t){return e.addEventListener("update",t),()=>e.removeEventListener("update",t)}}}function Se(t){const e=[];for(const[r,n]of Object.entries(t.fields))if("point"===n.type)e.push(t=>n.values.has(t[r]));else{const[t,o]=n.range;e.push(e=>{const n=e[r];return n>=t&&o>=n})}return t=>e.every(e=>e(t))}function Te(t,e){let r=t.get(e);return r||(r={name:e,resolution:"union",clauses:new Map},t.set(e,r)),r}const[Oe,$e]=Ae(t=>({selections:new Map,setClause(e,r){t(t=>{const n=new Map(t.selections),o=Te(n,e),a=new Map(o.clauses);return a.set(r.clientId,r),n.set(e,Object.assign(Object.assign({},o),{clauses:a})),{selections:n}})},clearClause(e,r){t(t=>{const n=t.selections.get(e);if(!n)return{};const o=new Map(t.selections),a=new Map(n.clauses);return a.delete(r),o.set(e,Object.assign(Object.assign({},n),{clauses:a})),{selections:o}})},setResolution(e,r){t(t=>{const n=new Map(t.selections),o=Te(n,e);return n.set(e,Object.assign(Object.assign({},o),{resolution:r})),{selections:n}})},clearSelection(e){t(t=>{const r=new Map(t.selections),n=r.get(e);return n&&r.set(e,Object.assign(Object.assign({},n),{clauses:new Map})),{selections:r}})}}));function _e(t){const e=d(),n=t.clientId||e,{name:o}=t,i=$e(t=>t.selections.get(o)),c=$e(t=>t.setClause),l=$e(t=>t.clearClause),s=r(()=>!!i&&i.clauses.size>0,[i]);return{predicate:r(()=>i&&0!==i.clauses.size?function(t,e){const r=[];for(const[n,o]of t.clauses)"crossfilter"===t.resolution&&n===e||r.push(Se(o));return 0===r.length?()=>!0:"intersect"===t.resolution?t=>r.every(e=>e(t)):t=>r.some(e=>e(t))}(i,n):()=>!0,[i,n]),isActive:s,selectPoints:a(t=>{const e={};for(const[r,n]of Object.entries(t))e[r]={type:"point",values:new Set(n)};c(o,{clientId:n,type:"point",fields:e})},[n,o,c]),selectInterval:a(t=>{const e={};for(const[r,n]of Object.entries(t))e[r]={type:"interval",range:n};c(o,{clientId:n,type:"interval",fields:e})},[n,o,c]),clear:a(()=>{l(o,n)},[l,o,n]),clientId:n}}const[Ie,Ne]=Ae(t=>({observations:[],maxObservations:100,version:0,pushObservation(e){t(t=>{const r=t.observations;return r.push(e),r.length>t.maxObservations&&r.shift(),{version:t.version+1}})},clearObservations(){t(()=>({observations:[],version:0}))}})),We="#007bff";function Me(t,e,n="category10"){return r(()=>{if(e&&"function"!=typeof e)return ye(t,e,n)},[t,e,n])}const je={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}}};function Re(t,e,r){var n,o,a,i,c,l;const s=je[t||"primary"],u="context"===t||"sparkline"===t;return{width:null!==(n=e.width)&&void 0!==n?n:t&&"primary"!==t||!(null==r?void 0:r.width)?s.width:r.width,height:null!==(o=e.height)&&void 0!==o?o:t&&"primary"!==t||!(null==r?void 0:r.height)?s.height:r.height,showAxes:s.showAxes,showGrid:null!==(a=e.showGrid)&&void 0!==a?a:s.showGrid,enableHover:null!==(i=e.enableHover)&&void 0!==i?i:!!e.linkedHover||s.enableHover,showLegend:null!==(c=e.showLegend)&&void 0!==c?c:s.showLegend,showLabels:null!==(l=e.showLabels)&&void 0!==l?l:s.showLabels,title:u?void 0:e.title,xLabel:u?void 0:e.xLabel,yLabel:u?void 0:e.yLabel,categoryLabel:u?void 0:e.categoryLabel,valueLabel:u?void 0:e.valueLabel,marginDefaults:s.marginDefaults}}function Ce({componentName:e,message:r,width:n,height:o}){return t.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"}},t.createElement("div",{style:{textAlign:"center",maxWidth:400}},t.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},e),t.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},r)))}function Be({data:t,dataLabel:e="data"}){return null==t?`No ${e} provided. Pass a hierarchical data object to the ${e} prop.`:null}function ze({nodes:t,edges:e,nodesRequired:r=!1,edgesRequired:n=!0,accessors:o}){if(n&&(!e||!Array.isArray(e)||0===e.length))return"No edges provided. Pass a non-empty array to the edges prop.";if(r&&(!t||!Array.isArray(t)||0===t.length))return"No nodes provided. Pass a non-empty array to the nodes prop.";if(o&&t&&t.length>0)for(const e of(a=t).length>3?[a[0],a[Math.floor(a.length/2)],a[a.length-1]]:a)if(e&&"object"==typeof e)for(const[t,r]of Object.entries(o))if(r&&"string"==typeof r&&!(r in e))return`${t} "${r}" not found in node data. Available fields: ${Object.keys(e).join(", ")}.`;var a;return null}function Fe(e){var n;const o=Re(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:e.showLegend,showLabels:e.showLabels,title:e.title},{width:600,height:600}),{nodes:i,edges:c,margin:l,className:s,nodeIDAccessor:u="id",sourceAccessor:d="source",targetAccessor:h="target",nodeLabel:f,colorBy:y,colorScheme:g="category10",nodeSize:p=8,nodeSizeRange:v=[5,20],edgeWidth:m=1,edgeColor:b="#999",edgeOpacity:x=.6,iterations:k=300,forceStrength:w=.1,tooltip:L,frameProps:E={},onObservation:D,chartId:A}=e,P=o.width,S=o.height,T=o.enableHover,O=o.showLegend,$=null!==(n=o.showLabels)&&void 0!==n&&n,_=o.title,I=i||[],N=c||[],W=Me(I,y,g),M=r(()=>t=>{const e={};return e.fill=y?fe(t.data||t,y,W):We,"number"==typeof p&&(e.r=p),e},[y,W,p]),j=r(()=>t=>({stroke:b,strokeWidth:"number"==typeof m?m:"function"==typeof m?m(t):t[m]||1,opacity:x}),[m,b,x]),R=r(()=>{if($&&f)return"function"==typeof f?f:t=>t[f]},[$,f]),{legend:C,margin:B}=function({data:t,colorBy:e,colorScale:n,showLegend:o,userMargin:a,defaults:i={top:50,bottom:60,left:70,right:40}}){const c=void 0!==o?o:!!e,l=r(()=>{if(c&&e)return function({data:t,colorBy:e,colorScale:r,getColor:n,strokeColor:o,strokeWidth:a}){const i=Array.from(new Set(t.map(t=>"function"==typeof e?e(t):t[e]))).map(o=>{const a=t.find("function"==typeof e?t=>e(t)===o:t=>t[e]===o),i=a?n(a,e,r):r?r(o):"#000000";return{label:o+"",color:i}});return{legendGroups:[{styleFn:t=>{const e={fill:t.color,stroke:t.color};return void 0!==o&&(e.stroke=o),void 0!==a&&(e.strokeWidth=a),e},type:"fill",items:i,label:""}]}}({data:t,colorBy:e,colorScale:n,getColor:fe})},[c,e,t,n]),s=r(()=>{const t=Object.assign(Object.assign({},i),a);return l&&120>t.right&&(t.right=120),t},[i,a,l]);return{legend:l,margin:s}}({data:I,colorBy:y,colorScale:W,showLegend:O,userMargin:l,defaults:o.marginDefaults}),z=a(t=>{if(!D)return;const e=Date.now();D(t?{type:"hover",datum:t.data||{},x:t.x,y:t.y,timestamp:e,chartType:"ForceDirectedGraph",chartId:A}:{type:"hover-end",timestamp:e,chartType:"ForceDirectedGraph",chartId:A})},[D,A]),F=ze({componentName:"ForceDirectedGraph",nodes:i,edges:c,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:u}});return F?t.createElement(Ce,{componentName:"ForceDirectedGraph",message:F,width:P,height:S}):t.createElement(ke,Object.assign({chartType:"force",nodes:I,edges:N,size:[P,S],margin:B,nodeIDAccessor:u,sourceAccessor:d,targetAccessor:h,iterations:k,forceStrength:w,nodeStyle:M,edgeStyle:j,colorBy:y,colorScheme:g,nodeSize:p,nodeSizeRange:v,nodeLabel:R,showLabels:$,enableHover:T,tooltipContent:L?t=>De(L)(t.data):void 0,customHoverBehavior:D?z:void 0,legend:C,className:s,title:_},E))}function Ye(t,e){if(!t)return[];const r=[],n=t=>{r.push(t);const o="function"==typeof e?e(t):t[e];o&&Array.isArray(o)&&o.forEach(n)};return n(t),r}function Xe(t,e,r,n){if(t&&t.length>0)return t;const o=new Set;return e.forEach(t=>{const e="function"==typeof r?r(t):t[r],a="function"==typeof n?n(t):t[n];o.add(e),o.add(a)}),Array.from(o).map(t=>({id:t}))}function He(t){return"function"==typeof t?t:e=>e[t]||1}function Ge({edgeColorBy:t,colorBy:e,colorScale:r,nodeStyleFn:n,edgeOpacity:o,baseStyle:a={}}){return i=>{const c=Object.assign({fillOpacity:o},a);if("function"==typeof t)c.fill=t(i);else if("source"===t){const t="object"==typeof i.source?i.source:null;e&&t?c.fill=fe(t.data||t,e,r):t&&(c.fill=n(t,t.index).fill)}else if("target"===t){const t="object"==typeof i.target?i.target:null;e&&t?c.fill=fe(t.data||t,e,r):t&&(c.fill=n(t,t.index).fill)}else"gradient"===t&&(c.fill="#999",c.fillOpacity=.7*o);return c}}function qe(e){var n;const o=Re(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title},{width:800,height:600}),{nodes:i,edges:c,margin:l,className:s,sourceAccessor:u="source",targetAccessor:d="target",valueAccessor:h="value",nodeIdAccessor:f="id",colorBy:y,colorScheme:g="category10",edgeColorBy:p="source",orientation:v="horizontal",nodeAlign:m="justify",nodePaddingRatio:b=.05,nodeWidth:x=15,nodeLabel:k,edgeOpacity:w=.5,edgeSort:L,tooltip:E,frameProps:D={},onObservation:A,chartId:P}=e,S=o.width,T=o.height,O=o.enableHover,$=null===(n=o.showLabels)||void 0===n||n,_=o.title,I=c||[],N=r(()=>Xe(i,I,u,d),[i,I,u,d]),W=Me(N,y,g),M=r(()=>t=>{const e={stroke:"black",strokeWidth:1};return e.fill=y?fe(t.data||t,y,W):"#4d430c",e},[y,W]),j=r(()=>Ge({edgeColorBy:p,colorBy:y,colorScale:W,nodeStyleFn:M,edgeOpacity:w,baseStyle:{stroke:"none",strokeWidth:0}}),[p,y,W,M,w]),R=r(()=>{if(!$)return;const t=k||f;return"function"==typeof t?t:e=>e[t]},[$,k,f]),C=Object.assign(Object.assign({},o.marginDefaults),l),B=Ne(t=>t.pushObservation),z=a(t=>{const e=Date.now();if(t){const r={type:"hover",datum:t.data||{},x:t.x,y:t.y,timestamp:e,chartType:"SankeyDiagram",chartId:P};A&&A(r),B&&B(r)}else{const t={type:"hover-end",timestamp:e,chartType:"SankeyDiagram",chartId:P};A&&A(t),B&&B(t)}},[A,P,B]),F=a(t=>{const e=Date.now();if(t){const r={type:"click",datum:t.data||{},x:t.x,y:t.y,timestamp:e,chartType:"SankeyDiagram",chartId:P};A&&A(r),B&&B(r)}else{const t={type:"click-end",timestamp:e,chartType:"SankeyDiagram",chartId:P};A&&A(t),B&&B(t)}},[A,P,B]),Y=ze({componentName:"SankeyDiagram",edges:c,edgesRequired:!0});return Y?t.createElement(Ce,{componentName:"SankeyDiagram",message:Y,width:S,height:T}):t.createElement(ke,Object.assign({chartType:"sankey",nodes:N,edges:I,size:[S,T],margin:C,nodeIDAccessor:f,sourceAccessor:u,targetAccessor:d,valueAccessor:h,orientation:v,nodeAlign:m,nodePaddingRatio:b,nodeWidth:x,nodeStyle:M,edgeStyle:j,colorBy:y,colorScheme:g,edgeColorBy:p,edgeOpacity:w,edgeSort:L,nodeLabel:R,showLabels:$,enableHover:O,tooltipContent:E?t=>De(E)(t.data):void 0,customHoverBehavior:A?z:void 0,customClickBehavior:A?F:void 0,className:s,title:_},D))}function Ve(e){var n;const o=Re(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title},{width:600,height:600}),{nodes:i,edges:c,margin:l,className:s,sourceAccessor:u="source",targetAccessor:d="target",valueAccessor:h="value",nodeIdAccessor:f="id",colorBy:y,colorScheme:g="category10",edgeColorBy:p="source",padAngle:v=.01,groupWidth:m=20,sortGroups:b,nodeLabel:x,edgeOpacity:k=.5,tooltip:w,frameProps:L={},onObservation:E,chartId:D}=e,A=o.width,P=o.height,S=o.enableHover,T=null===(n=o.showLabels)||void 0===n||n,O=o.title,$=c||[],_=r(()=>Xe(i,$,u,d),[i,$,u,d]),I=Me(_,y,g),N=r(()=>(t,e)=>{var r,n;const o={stroke:"black",strokeWidth:1};if(y)o.fill=fe(t.data||t,y,I);else{const a=Array.isArray(g)?g:ue[g]||de,i=Array.isArray(a)?a:de,c=null!==(n=null!==(r=t.index)&&void 0!==r?r:e)&&void 0!==n?n:0;o.fill=i[c%i.length]}return o},[y,I,g]),W=r(()=>Ge({edgeColorBy:p,colorBy:y,colorScale:I,nodeStyleFn:N,edgeOpacity:k,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:k}}),[p,y,I,N,k]),M=r(()=>{if(!T)return;const t=x||f;return"function"==typeof t?t:e=>e[t]},[T,x,f]),j=Object.assign(Object.assign({},o.marginDefaults),l),R=a(t=>{if(!E)return;const e=Date.now();E(t?{type:"hover",datum:t.data||{},x:t.x,y:t.y,timestamp:e,chartType:"ChordDiagram",chartId:D}:{type:"hover-end",timestamp:e,chartType:"ChordDiagram",chartId:D})},[E,D]),C=ze({componentName:"ChordDiagram",edges:c,edgesRequired:!0});return C?t.createElement(Ce,{componentName:"ChordDiagram",message:C,width:A,height:P}):t.createElement(ke,Object.assign({chartType:"chord",nodes:_,edges:$,size:[A,P],margin:j,nodeIDAccessor:f,sourceAccessor:u,targetAccessor:d,valueAccessor:h,padAngle:v,groupWidth:m,sortGroups:b,nodeStyle:N,edgeStyle:W,colorBy:y,colorScheme:g,edgeColorBy:p,edgeOpacity:k,nodeLabel:M,showLabels:T,enableHover:S,tooltipContent:w?t=>De(w)(t.data):void 0,customHoverBehavior:E?R:void 0,className:s,title:O},L))}function Ze(e){var n;const o=Re(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title},{width:600,height:600}),{data:i,margin:c,className:l,layout:s="tree",orientation:u="vertical",childrenAccessor:d="children",valueAccessor:h="value",nodeIdAccessor:f="name",colorBy:y,colorScheme:g="category10",colorByDepth:p=!1,edgeStyle:v="curve",nodeLabel:m,nodeSize:b=5,tooltip:x,frameProps:k={},onObservation:w,chartId:L}=e,E=o.width,D=o.height,A=o.enableHover,P=null===(n=o.showLabels)||void 0===n||n,S=o.title,T=r(()=>Ye(i,d),[i,d]),O=r(()=>{if(!p&&y&&"function"!=typeof y)return ye(T,y,g)},[T,y,p,g]),$=r(()=>t=>{const e={stroke:"black",strokeWidth:1};return e.fill=p?he[(t.depth||0)%he.length]:y?fe(t.data||t,y,O):We,e},[y,p,O]),_=r(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),I=r(()=>{if("treemap"===s||"circlepack"===s||"partition"===s)return He(h)},[s,h]),N=Object.assign(Object.assign({},o.marginDefaults),c),W=a(t=>{if(!w)return;const e=Date.now();w(t?{type:"hover",datum:t.data||{},x:t.x,y:t.y,timestamp:e,chartType:"TreeDiagram",chartId:L}:{type:"hover-end",timestamp:e,chartType:"TreeDiagram",chartId:L})},[w,L]),M=Be({componentName:"TreeDiagram",data:i});return M?t.createElement(Ce,{componentName:"TreeDiagram",message:M,width:E,height:D}):t.createElement(ke,Object.assign({chartType:s,data:i,size:[E,D],margin:N,nodeIDAccessor:f,childrenAccessor:d,hierarchySum:I,treeOrientation:u,edgeType:v,nodeStyle:$,edgeStyle:_,colorBy:y,colorScheme:g,colorByDepth:p,nodeSize:b,nodeLabel:P?m||f:void 0,showLabels:P,enableHover:A,tooltipContent:x?t=>De(x)(t.data):void 0,customHoverBehavior:w?W:void 0,className:l,title:S},k))}function Ke(e){var n;const o=Re(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,linkedHover:e.linkedHover},{width:600,height:600}),{data:i,margin:c,className:l,childrenAccessor:s="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:f="category10",colorByDepth:y=!1,labelMode:g="leaf",nodeLabel:p,padding:v=4,paddingTop:m,tooltip:b,frameProps:x={},selection:k,linkedHover:w,onObservation:L,chartId:E}=e,D=o.width,A=o.height,P=o.enableHover,S=null===(n=o.showLabels)||void 0===n||n,T=o.title,{activeSelectionHook:O,customHoverBehavior:$}=function({selection:t,linkedHover:e,fallbackFields:r=[],unwrapData:n=!1,onObservation:o,chartType:i,chartId:c}){const l=function(t,e){return t?!0===t?{name:"hover",fields:e||[]}:"string"==typeof t?{name:t,fields:e||[]}:{name:t.name||"hover",fields:t.fields}:null}(e,r),s=_e({name:(null==t?void 0:t.name)||"__unused__"}),u=function(t){const e=t.name||"hover",{fields:r}=t,{predicate:n,isActive:o,selectPoints:i,clear:c}=_e({name:e});return{onHover:a(t=>{if(!t)return void c();const e={};for(const n of r){const r=t[n];void 0!==r&&(e[n]=[r])}Object.keys(e).length>0&&i(e)},[r,i,c]),predicate:n,isActive:o}}({name:(null==l?void 0:l.name)||"hover",fields:(null==l?void 0:l.fields)||[]}),d=Ne(t=>t.pushObservation);return{activeSelectionHook:t?{isActive:s.isActive,predicate:s.predicate}:null,customHoverBehavior:a(t=>{var r,n;if(e){let e=t&&(t.data||t.datum)||t;Array.isArray(e)&&(e=e[0]),u.onHover(e)}if(o||d){const e={timestamp:Date.now(),chartType:i,chartId:c};if(t){let a=t.data||t.datum||t;Array.isArray(a)&&(a=a[0]);const i=Object.assign(Object.assign({},e),{type:"hover",datum:a||{},x:null!==(r=t.x)&&void 0!==r?r:0,y:null!==(n=t.y)&&void 0!==n?n:0});o&&o(i),d&&d(i)}else{const t=Object.assign(Object.assign({},e),{type:"hover-end"});o&&o(t),d&&d(t)}}},[e,u,o,i,c,d]),customClickBehavior:a(t=>{var e,r;if(o||d){const n={timestamp:Date.now(),chartType:i,chartId:c};if(t){let a=t.data||t.datum||t;Array.isArray(a)&&(a=a[0]);const i=Object.assign(Object.assign({},n),{type:"click",datum:a||{},x:null!==(e=t.x)&&void 0!==e?e:0,y:null!==(r=t.y)&&void 0!==r?r:0});o&&o(i),d&&d(i)}else{const t=Object.assign(Object.assign({},n),{type:"click-end"});o&&o(t),d&&d(t)}}},[o,d,i,c])}}({selection:k,linkedHover:w,fallbackFields:h?["string"==typeof h?h:""]:[],onObservation:L,chartType:"Treemap",chartId:E}),_=a(t=>{if(!t)return $(null);const e=t.data||t;$({data:(null==e?void 0:e.data)||e})},[$]),I=r(()=>Ye(i,s),[i,s]),N=r(()=>{if(y)return;if(!h||"function"==typeof h)return;const t=h;return ye(I.filter(e=>null!=e[t]),t,f)},[I,h,y,f]),W=r(()=>t=>{const e={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return e.fill=y?he[(t.depth||0)%he.length]:h?fe(t.data||t,h,N):We,e},[h,y,N]),M=r(()=>O?t=>{var e,r;const n=Object.assign({},W(t));return O.isActive&&(O.predicate(t.data||t)?(null==k?void 0:k.selectedStyle)&&Object.assign(n,k.selectedStyle):(n.fillOpacity=null!==(e=null==k?void 0:k.unselectedOpacity)&&void 0!==e?e:.2,n.strokeOpacity=null!==(r=null==k?void 0:k.unselectedOpacity)&&void 0!==r?r:.2,(null==k?void 0:k.unselectedStyle)&&Object.assign(n,k.unselectedStyle))),n}:W,[W,O,k]),j=r(()=>He(u),[u]),R=void 0!==m?m:S&&"parent"===g?18:void 0,C=Object.assign(Object.assign({},o.marginDefaults),c),B=Be({componentName:"Treemap",data:i});return B?t.createElement(Ce,{componentName:"Treemap",message:B,width:D,height:A}):t.createElement(ke,Object.assign({chartType:"treemap",data:i,size:[D,A],margin:C,nodeIDAccessor:d,childrenAccessor:s,hierarchySum:j,padding:v,paddingTop:R,nodeStyle:M,colorBy:h,colorScheme:f,colorByDepth:y,nodeLabel:S?p||d:void 0,showLabels:S,enableHover:P,tooltipContent:b?t=>De(b)(t.data):void 0},(w||L)&&{customHoverBehavior:_},{className:l,title:T},x))}function Qe(e){var n;const o=Re(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title},{width:600,height:600}),{data:i,margin:c,className:l,childrenAccessor:s="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:f="category10",colorByDepth:y=!1,nodeLabel:g,circleOpacity:p=.7,padding:v=4,tooltip:m,frameProps:b={},onObservation:x,chartId:k}=e,w=o.width,L=o.height,E=o.enableHover,D=null===(n=o.showLabels)||void 0===n||n,A=o.title,P=r(()=>Ye(i,s),[i,s]),S=r(()=>{if(!y&&h&&"function"!=typeof h)return ye(P,h,f)},[P,h,y,f]),T=r(()=>t=>{const e={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:p};return e.fill=y?he[(t.depth||0)%he.length]:h?fe(t.data||t,h,S):We,e},[h,y,S,p]),O=r(()=>He(u),[u]),$=Object.assign(Object.assign({},o.marginDefaults),c),_=a(t=>{if(!x)return;const e=Date.now();x(t?{type:"hover",datum:t.data||{},x:t.x,y:t.y,timestamp:e,chartType:"CirclePack",chartId:k}:{type:"hover-end",timestamp:e,chartType:"CirclePack",chartId:k})},[x,k]),I=Be({componentName:"CirclePack",data:i});return I?t.createElement(Ce,{componentName:"CirclePack",message:I,width:w,height:L}):t.createElement(ke,Object.assign({chartType:"circlepack",data:i,size:[w,L],margin:$,nodeIDAccessor:d,childrenAccessor:s,hierarchySum:O,padding:v,nodeStyle:T,colorBy:h,colorScheme:f,colorByDepth:y,nodeLabel:D?g||d:void 0,showLabels:D,enableHover:E,tooltipContent:m?t=>De(m)(t.data):void 0,customHoverBehavior:x?_:void 0,className:l,title:A},b))}Fe.displayName="ForceDirectedGraph",qe.displayName="SankeyDiagram",Ve.displayName="ChordDiagram",Ze.displayName="TreeDiagram",Ke.displayName="Treemap",Qe.displayName="CirclePack";export{Ve as ChordDiagram,Qe as CirclePack,Fe as ForceDirectedGraph,qe as SankeyDiagram,ke as StreamNetworkFrame,Ze as TreeDiagram,Ke as Treemap};