semiotic 3.8.9 → 3.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (502) hide show
  1. package/README.md +55 -81
  2. package/agent-skill/semiotic-charts/SKILL.md +11 -2
  3. package/ai/behaviorContracts.cjs +33 -3
  4. package/ai/cli.js +53 -2
  5. package/ai/componentMetadata.cjs +15 -0
  6. package/ai/dist/mcp-server.js +1530 -611
  7. package/ai/examples.md +48 -42
  8. package/{CLAUDE.md → ai/reference.md} +43 -22
  9. package/ai/schema.json +10603 -986
  10. package/ai/surface-manifest.json +643 -2
  11. package/ai/system-prompt.md +83 -130
  12. package/dist/c-3BLJEQNG.min.js +1 -0
  13. package/dist/c-3KZD6AXJ.min.js +1 -0
  14. package/dist/c-4TWEX5HG.min.js +1 -0
  15. package/dist/c-52TEGIUJ.min.js +1 -0
  16. package/dist/c-5YCIX3VZ.min.js +1 -0
  17. package/dist/c-6FEKTA3U.min.js +1 -0
  18. package/dist/c-6O5EVOPH.min.js +1 -0
  19. package/dist/c-74HEEZGK.min.js +1 -0
  20. package/dist/c-AKAF6JAD.min.js +1 -0
  21. package/dist/c-BBKITSXB.min.js +1 -0
  22. package/dist/c-BWNB6USU.min.js +1 -0
  23. package/dist/c-C25ENHIK.min.js +1 -0
  24. package/dist/c-CDR5AO3R.min.js +1 -0
  25. package/dist/c-COHXCW3Q.min.js +1 -0
  26. package/dist/{chunk-scatterplotMatrixBrushOverlay-SDIZSN66.module.min.js → c-DADXPJXV.min.js} +0 -1
  27. package/dist/c-E3JFRRMI.min.js +1 -0
  28. package/dist/c-EBFPQHHO.min.js +1 -0
  29. package/dist/c-G36WS6LN.min.js +1 -0
  30. package/dist/c-GIKRQI4X.min.js +1 -0
  31. package/dist/c-GPYOFETM.min.js +1 -0
  32. package/dist/c-IDUHYYSI.min.js +1 -0
  33. package/dist/{chunk-chunk-FQPKOAIH.module.min.js → c-IUHFPMHD.min.js} +0 -1
  34. package/dist/c-J5G56TUH.min.js +1 -0
  35. package/dist/c-JAZ73J32.min.js +1 -0
  36. package/dist/c-KG3NXHAL.min.js +1 -0
  37. package/dist/c-KII3PLZE.min.js +1 -0
  38. package/dist/c-LIXGXMNS.min.js +1 -0
  39. package/dist/c-LVEY6D6B.min.js +1 -0
  40. package/dist/c-M4Y3BHFR.min.js +1 -0
  41. package/dist/c-MAIICR2Z.min.js +1 -0
  42. package/dist/c-MG5DM6VE.min.js +1 -0
  43. package/dist/{chunk-minimapBrushOverlay-JU57U7NM.module.min.js → c-MNF2S4AA.min.js} +0 -1
  44. package/dist/c-MT3WBK7M.min.js +1 -0
  45. package/dist/c-NY3JWV2K.min.js +1 -0
  46. package/dist/c-O6U6K4CW.min.js +1 -0
  47. package/dist/c-OCI56QF2.min.js +1 -0
  48. package/dist/c-OQ7M4AGV.min.js +1 -0
  49. package/dist/c-OXYMVK7Q.min.js +1 -0
  50. package/dist/c-PPWDL5ZI.min.js +1 -0
  51. package/dist/c-QHF5YON3.min.js +1 -0
  52. package/dist/c-RR3GO5SW.min.js +1 -0
  53. package/dist/{chunk-chunk-J5QD4RAM.module.min.js → c-RSVIHIQ4.min.js} +0 -1
  54. package/dist/{chunk-chunk-EMO5NUGE.module.min.js → c-S2BXNNJN.min.js} +0 -1
  55. package/dist/{chunk-chunk-YCQYG6J5.module.min.js → c-SLGMUBUL.min.js} +0 -1
  56. package/dist/c-SUILCHWU.min.js +1 -0
  57. package/dist/c-TZW3JGJ5.min.js +1 -0
  58. package/dist/c-US5ZFT6E.min.js +1 -0
  59. package/dist/{chunk-chunk-RZH7VZYS.module.min.js → c-USFMFKIH.min.js} +0 -1
  60. package/dist/c-UUKVD4WB.min.js +1 -0
  61. package/dist/{chunk-chunk-SV4XAZ3Q.module.min.js → c-VGW3VG3I.min.js} +0 -1
  62. package/dist/c-W3CE4A4S.min.js +1 -0
  63. package/dist/{chunk-chunk-2NVFEB7P.module.min.js → c-WJCD5EUY.min.js} +0 -1
  64. package/dist/{chunk-chunk-2JGJ5GUG.module.min.js → c-X5UBGU2V.min.js} +0 -1
  65. package/dist/c-YDAY2WFR.min.js +1 -0
  66. package/dist/c-ZOWWU34K.min.js +1 -0
  67. package/dist/components/AccessibleNavTree.d.ts +1 -1
  68. package/dist/components/CategoryColors.d.ts +1 -1
  69. package/dist/components/GradientLegend.d.ts +14 -0
  70. package/dist/components/Legend.d.ts +2 -7
  71. package/dist/components/LinkedCharts.d.ts +1 -1
  72. package/dist/components/MobileAnnotationCalloutList.d.ts +1 -1
  73. package/dist/components/ObservationReadout.d.ts +45 -0
  74. package/dist/components/ThemeProvider.d.ts +4 -4
  75. package/dist/components/Tooltip/FlippingTooltip.d.ts +5 -7
  76. package/dist/components/Tooltip/Tooltip.d.ts +30 -5
  77. package/dist/components/Tooltip/tooltipChrome.d.ts +43 -0
  78. package/dist/components/ai/chartCapabilityTypes.d.ts +86 -2
  79. package/dist/components/ai/chartClinic.d.ts +2 -0
  80. package/dist/components/ai/deriveProfileFields.d.ts +40 -0
  81. package/dist/components/ai/evaluateChart.d.ts +85 -0
  82. package/dist/components/ai/fieldPolicy.d.ts +7 -0
  83. package/dist/components/ai/fieldRoles.d.ts +24 -0
  84. package/dist/components/ai/generativeChart.d.ts +18 -2
  85. package/dist/components/ai/inferIntent.d.ts +26 -2
  86. package/dist/components/ai/intents.d.ts +35 -0
  87. package/dist/components/ai/navigationTree.d.ts +2 -2
  88. package/dist/components/ai/observedSceneAudit.d.ts +2 -1
  89. package/dist/components/ai/profileData.d.ts +11 -0
  90. package/dist/components/ai/repairChartConfig.d.ts +2 -3
  91. package/dist/components/ai/semanticEvidence.d.ts +4 -0
  92. package/dist/components/ai/semanticViability.d.ts +11 -0
  93. package/dist/components/ai/semanticViabilityRegistry.d.ts +5 -0
  94. package/dist/components/ai/streamingTypes.d.ts +4 -0
  95. package/dist/components/ai/suggestCharts.d.ts +5 -6
  96. package/dist/components/ai/suggestDashboard.d.ts +2 -3
  97. package/dist/components/ai/suggestStreamCharts.d.ts +1 -1
  98. package/dist/components/ai/suggestStretchCharts.d.ts +2 -3
  99. package/dist/components/ai/suggestionPropContracts.d.ts +20 -0
  100. package/dist/components/ai/variantDiscovery.d.ts +3 -1
  101. package/dist/components/charts/custom/NetworkCustomChart.d.ts +3 -0
  102. package/dist/components/charts/custom/OrdinalCustomChart.d.ts +3 -0
  103. package/dist/components/charts/custom/XYCustomChart.d.ts +1 -1
  104. package/dist/components/charts/geo/ChoroplethMap.d.ts +3 -1
  105. package/dist/components/charts/geo/DistanceCartogram.d.ts +2 -7
  106. package/dist/components/charts/geo/cartogramOverlay.d.ts +28 -0
  107. package/dist/components/charts/index.d.ts +4 -3
  108. package/dist/components/charts/network/ProcessSankey.d.ts +2 -136
  109. package/dist/components/charts/network/ProcessSankeyProps.d.ts +139 -0
  110. package/dist/components/charts/network/Treemap.d.ts +2 -1
  111. package/dist/components/charts/network/processSankey/boundaryHubOrdering.d.ts +23 -0
  112. package/dist/components/charts/network/processSankey/layoutGeometry.d.ts +2 -0
  113. package/dist/components/charts/network/processSankey/ordering.d.ts +3 -41
  114. package/dist/components/charts/network/processSankey/orderingTypes.d.ts +32 -0
  115. package/dist/components/charts/network/processSankey/packing.d.ts +1 -1
  116. package/dist/components/charts/network/processSankey/packingCache.d.ts +1 -1
  117. package/dist/components/charts/network/processSankey/packingOptimization.d.ts +72 -0
  118. package/dist/components/charts/ordinal/BarChart.d.ts +4 -3
  119. package/dist/components/charts/ordinal/FunnelChart.d.ts +2 -0
  120. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +3 -2
  121. package/dist/components/charts/ordinal/StackedBarChart.d.ts +4 -3
  122. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +2 -2
  123. package/dist/components/charts/physics/GaltonBoardChart.d.ts +2 -9
  124. package/dist/components/charts/physics/GauntletChart.d.ts +10 -41
  125. package/dist/components/charts/physics/ProcessFlowChart.d.ts +1 -1
  126. package/dist/components/charts/physics/chainReactionAccessibleTable.d.ts +9 -0
  127. package/dist/components/charts/physics/chainReactionRuntime.d.ts +2 -1
  128. package/dist/components/charts/physics/chainReactionTypes.d.ts +5 -1
  129. package/dist/components/charts/physics/crucibleBodyRenderers.d.ts +2 -2
  130. package/dist/components/charts/physics/crucibleClone.d.ts +6 -0
  131. package/dist/components/charts/physics/crucibleEffects.d.ts +1 -2
  132. package/dist/components/charts/physics/crucibleRecord.d.ts +7 -0
  133. package/dist/components/charts/physics/gauntletChrome.d.ts +4 -4
  134. package/dist/components/charts/physics/gauntletPhysics.d.ts +1 -0
  135. package/dist/components/charts/physics/gauntletPublic.d.ts +4 -0
  136. package/dist/components/charts/physics/packetFlowOverlay.d.ts +7 -0
  137. package/dist/components/charts/physics/physicsChartLayout.d.ts +8 -0
  138. package/dist/components/charts/physics/physicsChartShared.d.ts +3 -1
  139. package/dist/components/charts/physics/physicsChartUtils.d.ts +1 -1
  140. package/dist/components/charts/physics/physicsHocUtils.d.ts +25 -12
  141. package/dist/components/charts/physics/physicsProjectionOverlays.d.ts +24 -0
  142. package/dist/components/charts/physics/processFlowOverlays.d.ts +9 -0
  143. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +15 -12
  144. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +10 -7
  145. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +35 -14
  146. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +21 -14
  147. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +20 -13
  148. package/dist/components/charts/realtime/aggregate.d.ts +4 -1
  149. package/dist/components/charts/realtime/eventTime.d.ts +4 -0
  150. package/dist/components/charts/realtime/realtimeChartRuntime.d.ts +27 -0
  151. package/dist/components/charts/realtime/realtimeChartTypes.d.ts +30 -0
  152. package/dist/components/charts/realtime/useRealtimeCategoryColors.d.ts +30 -0
  153. package/dist/components/charts/shared/FrameTextAnnotationSVG.d.ts +10 -0
  154. package/dist/components/charts/shared/annotationActivation.d.ts +3 -7
  155. package/dist/components/charts/shared/annotationBandFill.d.ts +6 -0
  156. package/dist/components/charts/shared/annotationDispatch.d.ts +31 -0
  157. package/dist/components/charts/shared/annotationIdentity.d.ts +8 -0
  158. package/dist/components/charts/shared/annotationRules.d.ts +1 -15
  159. package/dist/components/charts/shared/boundedCategoryRegistry.d.ts +8 -0
  160. package/dist/components/charts/shared/chainReactionChartSpec.d.ts +3 -0
  161. package/dist/components/charts/shared/chartMode.d.ts +3 -2
  162. package/dist/components/charts/shared/chartSpecCore.d.ts +1 -0
  163. package/dist/components/charts/shared/frameTextAnnotation.d.ts +63 -0
  164. package/dist/components/charts/shared/gradient.d.ts +16 -0
  165. package/dist/components/charts/shared/hatchFill.d.ts +15 -0
  166. package/dist/components/charts/shared/hooks.d.ts +4 -4
  167. package/dist/components/charts/shared/legendUtils.d.ts +1 -0
  168. package/dist/components/charts/shared/streamPropsHelpers.d.ts +2 -1
  169. package/dist/components/charts/shared/styleRules.d.ts +9 -2
  170. package/dist/components/charts/shared/styleRulesWireSchema.d.ts +353 -0
  171. package/dist/components/charts/shared/types.d.ts +18 -9
  172. package/dist/components/charts/shared/useChartLegend.d.ts +43 -9
  173. package/dist/components/charts/shared/useChartSetup.d.ts +3 -1
  174. package/dist/components/charts/shared/useCustomChartSetup.d.ts +5 -2
  175. package/dist/components/charts/shared/useNetworkChartSetup.d.ts +5 -1
  176. package/dist/components/charts/shared/useOrdinalBrush.d.ts +3 -3
  177. package/dist/components/charts/shared/useStreamingLegend.d.ts +6 -1
  178. package/dist/components/charts/value/types.d.ts +1 -1
  179. package/dist/components/charts/xy/BubbleChart.d.ts +1 -1
  180. package/dist/components/charts/xy/BumpChart.capability.d.ts +14 -1
  181. package/dist/components/charts/xy/BumpChart.d.ts +13 -73
  182. package/dist/components/charts/xy/BumpChart.semanticViability.d.ts +5 -0
  183. package/dist/components/charts/xy/CandlestickChart.d.ts +2 -2
  184. package/dist/components/charts/xy/LineChart.d.ts +2 -2
  185. package/dist/components/charts/xy/Scatterplot.d.ts +1 -1
  186. package/dist/components/charts/xy/bumpData.d.ts +44 -0
  187. package/dist/components/charts/xy/bumpIdentity.d.ts +2 -0
  188. package/dist/components/charts/xy/bumpLayout.d.ts +45 -0
  189. package/dist/components/charts/xy/bumpTooltip.d.ts +20 -0
  190. package/dist/components/legendLayout.d.ts +131 -4
  191. package/dist/components/realtime/ReorderBuffer.d.ts +2 -0
  192. package/dist/components/realtime/types.d.ts +10 -1
  193. package/dist/components/recipes/balanceSnapshotsToFlows.d.ts +42 -0
  194. package/dist/components/recipes/directedReachability.d.ts +14 -0
  195. package/dist/components/recipes/gofishDisplayListFixtures.generated.d.ts +6 -6
  196. package/dist/components/recipes/gridObservatory.d.ts +1 -1
  197. package/dist/components/recipes/networkAnalysis.d.ts +1 -18
  198. package/dist/components/recipes/physics.d.ts +7 -4
  199. package/dist/components/recipes/processPhysics.d.ts +0 -1
  200. package/dist/components/recipes/waffle.d.ts +7 -4
  201. package/dist/components/semiotic-ai-core.d.ts +13 -4
  202. package/dist/components/semiotic-ai-observations.d.ts +3 -0
  203. package/dist/components/semiotic-ai.d.ts +16 -9
  204. package/dist/components/semiotic-client-shared.d.ts +10 -0
  205. package/dist/components/semiotic-experimental.d.ts +1 -1
  206. package/dist/components/semiotic-geo.d.ts +4 -1
  207. package/dist/components/semiotic-network.d.ts +7 -4
  208. package/dist/components/semiotic-ordinal.d.ts +4 -1
  209. package/dist/components/semiotic-physics.d.ts +11 -4
  210. package/dist/components/semiotic-realtime-core.d.ts +11 -4
  211. package/dist/components/semiotic-realtime-react.d.ts +4 -3
  212. package/dist/components/semiotic-realtime.d.ts +3 -1
  213. package/dist/components/semiotic-recipes-core.d.ts +7 -5
  214. package/dist/components/semiotic-server-edge.d.ts +3 -2
  215. package/dist/components/semiotic-server.d.ts +3 -2
  216. package/dist/components/semiotic-themes-core.d.ts +5 -48
  217. package/dist/components/semiotic-utils-core.d.ts +10 -5
  218. package/dist/components/semiotic-utils-react.d.ts +2 -0
  219. package/dist/components/semiotic-utils.d.ts +1 -1
  220. package/dist/components/semiotic-xy.d.ts +4 -1
  221. package/dist/components/semiotic.d.ts +68 -26
  222. package/dist/components/server/animatedGif.d.ts +1 -1
  223. package/dist/components/server/renderEvidence.d.ts +25 -2
  224. package/dist/components/server/renderToStaticSVG.d.ts +15 -7
  225. package/dist/components/server/serverChartConfigShared.d.ts +8 -1
  226. package/dist/components/server/serverChartConfigs.d.ts +1 -0
  227. package/dist/components/server/serverChartConfigsNetwork.d.ts +3 -3
  228. package/dist/components/server/serverChartConfigsNetworkChord.d.ts +2 -0
  229. package/dist/components/server/serverChartConfigsNetworkForce.d.ts +2 -0
  230. package/dist/components/server/serverChartConfigsNetworkHierarchy.d.ts +3 -0
  231. package/dist/components/server/serverChartConfigsXY.d.ts +3 -3
  232. package/dist/components/server/serverChartConfigsXYBubble.d.ts +5 -0
  233. package/dist/components/server/serverChartConfigsXYBump.d.ts +7 -0
  234. package/dist/components/server/serverChartConfigsXYScatter.d.ts +5 -0
  235. package/dist/components/server/staticAnnotationFallbacks.d.ts +10 -0
  236. package/dist/components/server/staticAnnotations.d.ts +28 -1
  237. package/dist/components/server/staticAxisTickLabel.d.ts +13 -0
  238. package/dist/components/server/staticLegend.d.ts +1 -1
  239. package/dist/components/server/staticLegendMargin.d.ts +41 -0
  240. package/dist/components/server/staticOrdinal.d.ts +8 -2
  241. package/dist/components/server/staticPhysics.d.ts +13 -1
  242. package/dist/components/server/staticPhysicsChrome.d.ts +20 -0
  243. package/dist/components/server/staticRawLegend.d.ts +15 -0
  244. package/dist/components/server/staticSVGChrome.d.ts +16 -55
  245. package/dist/components/server/staticXYAxes.d.ts +27 -0
  246. package/dist/components/server/staticXYAxisTicks.d.ts +39 -0
  247. package/dist/components/server/staticXYGrid.d.ts +11 -0
  248. package/dist/components/server/themeResolver.d.ts +5 -1
  249. package/dist/components/store/ThemeStore.d.ts +2 -98
  250. package/dist/components/store/designTokens.d.ts +1 -1
  251. package/dist/components/store/themeCSSVariables.d.ts +10 -0
  252. package/dist/components/store/themeCore.d.ts +91 -0
  253. package/dist/components/store/themePresets.d.ts +81 -0
  254. package/dist/components/store/themeSerialization.d.ts +2 -1
  255. package/dist/components/stream/AccessibleDataTable.d.ts +12 -14
  256. package/dist/components/stream/AccessibleTablePortalImpl.d.ts +6 -0
  257. package/dist/components/stream/GeoTileRenderer.d.ts +2 -0
  258. package/dist/components/stream/NetworkCanvasHitTester.d.ts +3 -1
  259. package/dist/components/stream/NetworkSSRFrame.d.ts +2 -1
  260. package/dist/components/stream/NetworkSVGOverlay.d.ts +3 -31
  261. package/dist/components/stream/OrdinalCanvasHitTester.d.ts +2 -0
  262. package/dist/components/stream/SVGChartTitle.d.ts +9 -0
  263. package/dist/components/stream/SVGOverlay.d.ts +1 -21
  264. package/dist/components/stream/SVGUnderlay.d.ts +24 -0
  265. package/dist/components/stream/SceneToSVG.d.ts +1 -1
  266. package/dist/components/stream/StreamGeoFrame.d.ts +1 -1
  267. package/dist/components/stream/StreamOrdinalFrame.d.ts +1 -1
  268. package/dist/components/stream/StreamXYFrame.d.ts +1 -1
  269. package/dist/components/stream/accessibleDataRows.d.ts +11 -0
  270. package/dist/components/stream/accessibleDataTableModel.d.ts +40 -0
  271. package/dist/components/stream/accessibleTableTypes.d.ts +11 -0
  272. package/dist/components/stream/axisTickUtils.d.ts +19 -0
  273. package/dist/components/stream/canvasBackground.d.ts +10 -0
  274. package/dist/components/stream/canvasSetup.d.ts +9 -0
  275. package/dist/components/stream/frameCursorInteraction.d.ts +25 -0
  276. package/dist/components/stream/frameDefaultMargins.d.ts +37 -0
  277. package/dist/components/stream/frameGraphics.d.ts +18 -0
  278. package/dist/components/stream/frameGraphicsSubscription.d.ts +26 -0
  279. package/dist/components/stream/frameLegendOptions.d.ts +18 -0
  280. package/dist/components/stream/geoFrameCursorInteraction.d.ts +9 -0
  281. package/dist/components/stream/geoFrameHelpers.d.ts +29 -1
  282. package/dist/components/stream/geoTypes.d.ts +10 -11
  283. package/dist/components/stream/hitTarget.d.ts +61 -2
  284. package/dist/components/stream/moduleWorkerSession.d.ts +6 -0
  285. package/dist/components/stream/networkAnnotationAnchors.d.ts +37 -0
  286. package/dist/components/stream/networkCustomLayout.d.ts +2 -2
  287. package/dist/components/stream/networkFrameCursorInteraction.d.ts +12 -0
  288. package/dist/components/stream/networkFrameInteraction.d.ts +2 -0
  289. package/dist/components/stream/networkFramePaint.d.ts +7 -0
  290. package/dist/components/stream/networkPipelineConfig.d.ts +1 -1
  291. package/dist/components/stream/networkTypes.d.ts +30 -32
  292. package/dist/components/stream/normalizeXYData.d.ts +7 -0
  293. package/dist/components/stream/ordinalFrameCursorInteraction.d.ts +7 -0
  294. package/dist/components/stream/ordinalFrameInteraction.d.ts +29 -0
  295. package/dist/components/stream/ordinalSceneSVG.d.ts +10 -0
  296. package/dist/components/stream/ordinalTypes.d.ts +10 -4
  297. package/dist/components/stream/physics/PhysicsBodySpatialIndex.d.ts +9 -1
  298. package/dist/components/stream/physics/PhysicsCanvasTheme.d.ts +25 -0
  299. package/dist/components/stream/physics/PhysicsControllers.d.ts +0 -3
  300. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +4 -1
  301. package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +3 -24
  302. package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +9 -21
  303. package/dist/components/stream/physics/PhysicsSettledSVGElement.d.ts +37 -0
  304. package/dist/components/stream/physics/PhysicsSettledScene.d.ts +7 -3
  305. package/dist/components/stream/physics/StreamPhysicsFrame.d.ts +1 -1
  306. package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +23 -4
  307. package/dist/components/stream/physics/physicsAnnotationContext.d.ts +19 -0
  308. package/dist/components/stream/physics/physicsBodyCanvas.d.ts +4 -0
  309. package/dist/components/stream/physics/physicsSettledChrome.d.ts +7 -0
  310. package/dist/components/stream/physics/usePhysicsCanvasPointer.d.ts +32 -0
  311. package/dist/components/stream/physics/usePhysicsSemanticNavigation.d.ts +36 -0
  312. package/dist/components/stream/pipelineConfig.d.ts +6 -17
  313. package/dist/components/stream/pipelineDomainResolution.d.ts +1 -1
  314. package/dist/components/stream/renderBackend.d.ts +2 -0
  315. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +13 -2
  316. package/dist/components/stream/renderers/resolveCSSColor.d.ts +7 -0
  317. package/dist/components/stream/responsiveSize.d.ts +17 -0
  318. package/dist/components/stream/sceneCursor.d.ts +41 -0
  319. package/dist/components/stream/sceneRevisionDiagnostics.d.ts +1 -1
  320. package/dist/components/stream/svgOverlayUtils.d.ts +22 -1
  321. package/dist/components/stream/types.d.ts +25 -12
  322. package/dist/components/stream/useCanvasFrameHost.d.ts +3 -1
  323. package/dist/components/stream/useFrame.d.ts +24 -1
  324. package/dist/components/stream/useResponsiveSize.d.ts +6 -1
  325. package/dist/components/stream/useStalenessCheck.d.ts +1 -1
  326. package/dist/components/stream/xyFrameAxisTypes.d.ts +15 -4
  327. package/dist/components/stream/xyFrameCursorInteraction.d.ts +6 -0
  328. package/dist/components/stream/xySceneBuilders/swarmScene.d.ts +1 -1
  329. package/dist/components/stream/xySceneBuilders/types.d.ts +6 -26
  330. package/dist/components/types/legendTypes.d.ts +6 -0
  331. package/dist/components/types/marginType.d.ts +7 -8
  332. package/dist/controls.min.js +1 -1
  333. package/dist/controls.module.min.js +1 -1
  334. package/dist/forceLayoutWorker.js +1 -1
  335. package/dist/geo.min.js +1 -1
  336. package/dist/geo.module.min.js +1 -1
  337. package/dist/network.min.js +1 -1
  338. package/dist/network.module.min.js +1 -1
  339. package/dist/ordinal.min.js +1 -1
  340. package/dist/ordinal.module.min.js +1 -1
  341. package/dist/physics-matter.module.min.js +1 -1
  342. package/dist/physics-rapier.module.min.js +1 -1
  343. package/dist/physics.min.js +1 -1
  344. package/dist/physics.module.min.js +1 -1
  345. package/dist/physicsWorker.js +1 -1
  346. package/dist/processSankeyLayoutWorker.js +1 -1
  347. package/dist/realtime.min.js +1 -1
  348. package/dist/realtime.module.min.js +1 -1
  349. package/dist/rough.min.js +1 -1
  350. package/dist/rough.module.min.js +1 -1
  351. package/dist/semiotic-ai-core.d.ts +13 -4
  352. package/dist/semiotic-ai-core.min.js +1 -1
  353. package/dist/semiotic-ai-core.module.min.js +1 -1
  354. package/dist/semiotic-ai.d.ts +16 -9
  355. package/dist/semiotic-ai.min.js +1 -1
  356. package/dist/semiotic-ai.module.min.js +1 -1
  357. package/dist/semiotic-client-cjs-shared.min.js +1 -0
  358. package/dist/semiotic-client-glyph.module.min.js +2 -0
  359. package/dist/semiotic-client-responsive.module.min.js +2 -0
  360. package/dist/semiotic-client-shared.module.min.js +2 -0
  361. package/dist/semiotic-custom-layout-selection-cjs-shared.min.js +2 -0
  362. package/dist/semiotic-data.min.js +1 -1
  363. package/dist/semiotic-data.module.min.js +1 -1
  364. package/dist/semiotic-experimental-auxiliary.module.min.js +2 -0
  365. package/dist/semiotic-experimental-node-auxiliary.module.min.js +2 -0
  366. package/dist/semiotic-experimental-node.module.min.js +2 -0
  367. package/dist/semiotic-experimental-react-shared.module.min.js +2 -0
  368. package/dist/semiotic-experimental-vacp.min.js +1 -1
  369. package/dist/semiotic-experimental-vacp.module.min.js +1 -1
  370. package/dist/semiotic-experimental.d.ts +1 -1
  371. package/dist/semiotic-experimental.min.js +1 -1
  372. package/dist/semiotic-experimental.module.min.js +1 -1
  373. package/dist/semiotic-geo.d.ts +4 -1
  374. package/dist/semiotic-network.d.ts +7 -4
  375. package/dist/semiotic-ordinal.d.ts +4 -1
  376. package/dist/semiotic-physics.d.ts +11 -4
  377. package/dist/semiotic-realtime-core.d.ts +11 -4
  378. package/dist/semiotic-realtime-core.min.js +2 -1
  379. package/dist/semiotic-realtime-core.module.min.js +2 -1
  380. package/dist/semiotic-realtime-react.d.ts +4 -3
  381. package/dist/semiotic-realtime-react.min.js +1 -1
  382. package/dist/semiotic-realtime-react.module.min.js +1 -1
  383. package/dist/semiotic-realtime.d.ts +3 -1
  384. package/dist/semiotic-recipes-core-cjs-base.min.js +1 -0
  385. package/dist/semiotic-recipes-core.d.ts +7 -5
  386. package/dist/semiotic-recipes-core.min.js +9 -1
  387. package/dist/semiotic-recipes-core.module.min.js +1 -1
  388. package/dist/semiotic-recipes-geo-cjs.min.js +1 -0
  389. package/dist/semiotic-recipes-react.min.js +1 -1
  390. package/dist/semiotic-recipes-react.module.min.js +1 -1
  391. package/dist/semiotic-recipes.min.js +7 -1
  392. package/dist/semiotic-recipes.module.min.js +2 -1
  393. package/dist/semiotic-server-edge-node.module.min.js +1 -0
  394. package/dist/semiotic-server-edge.d.ts +3 -2
  395. package/dist/semiotic-server-edge.min.js +1 -1
  396. package/dist/semiotic-server-edge.module.min.js +1 -1
  397. package/dist/semiotic-server-node.min.js +1 -1
  398. package/dist/semiotic-server-node.module.min.js +1 -1
  399. package/dist/semiotic-server.d.ts +3 -2
  400. package/dist/semiotic-themes-core.d.ts +5 -48
  401. package/dist/semiotic-themes-core.min.js +1 -1
  402. package/dist/semiotic-themes-core.module.min.js +1 -1
  403. package/dist/semiotic-themes-react.min.js +1 -1
  404. package/dist/semiotic-themes-react.module.min.js +1 -1
  405. package/dist/semiotic-themes.min.js +1 -1
  406. package/dist/semiotic-themes.module.min.js +1 -1
  407. package/dist/semiotic-utils-core.d.ts +10 -5
  408. package/dist/semiotic-utils-core.min.js +1 -1
  409. package/dist/semiotic-utils-core.module.min.js +1 -1
  410. package/dist/semiotic-utils-react.d.ts +2 -0
  411. package/dist/semiotic-utils-react.min.js +1 -1
  412. package/dist/semiotic-utils-react.module.min.js +1 -1
  413. package/dist/semiotic-utils.d.ts +1 -1
  414. package/dist/semiotic-utils.min.js +2 -1
  415. package/dist/semiotic-utils.module.min.js +2 -1
  416. package/dist/semiotic-value.min.js +1 -1
  417. package/dist/semiotic-value.module.min.js +1 -1
  418. package/dist/semiotic-xy.d.ts +4 -1
  419. package/dist/semiotic.d.ts +68 -26
  420. package/dist/semiotic.min.js +1 -1
  421. package/dist/semiotic.module.min.js +1 -1
  422. package/dist/server.min.js +1 -1
  423. package/dist/server.module.min.js +1 -1
  424. package/dist/xy.min.js +1 -1
  425. package/dist/xy.module.min.js +1 -1
  426. package/package.json +53 -19
  427. package/dist/__tests__/scenarios/mcpProtocolTypes.d.ts +0 -20
  428. package/dist/chunk-OrdinalBrushOverlay-PXHQYDB2.module.min.js +0 -2
  429. package/dist/chunk-XYBrushOverlay-ECZJJLAJ.module.min.js +0 -1
  430. package/dist/chunk-XYBrushOverlay-EP2SV3UI.module.min.js +0 -2
  431. package/dist/chunk-chartContainerDataAudit-IQ3NBN3Q.module.min.js +0 -2
  432. package/dist/chunk-chunk-2B3AIKUZ.module.min.js +0 -2
  433. package/dist/chunk-chunk-2CXCXRB4.module.min.js +0 -1
  434. package/dist/chunk-chunk-2X3FJCME.module.min.js +0 -1
  435. package/dist/chunk-chunk-2ZHHWZQM.module.min.js +0 -2
  436. package/dist/chunk-chunk-4ITOQRXM.module.min.js +0 -2
  437. package/dist/chunk-chunk-5UKL5W76.module.min.js +0 -2
  438. package/dist/chunk-chunk-5VVNW5AZ.module.min.js +0 -1
  439. package/dist/chunk-chunk-5ZON5NMV.module.min.js +0 -2
  440. package/dist/chunk-chunk-66PCWJUG.module.min.js +0 -1
  441. package/dist/chunk-chunk-6S3YGYW7.module.min.js +0 -1
  442. package/dist/chunk-chunk-6V5VQVCT.module.min.js +0 -2
  443. package/dist/chunk-chunk-7C5EDZ3Z.module.min.js +0 -2
  444. package/dist/chunk-chunk-A3I4HBD5.module.min.js +0 -1
  445. package/dist/chunk-chunk-ACLDBMRH.module.min.js +0 -2
  446. package/dist/chunk-chunk-AFQHURLO.module.min.js +0 -2
  447. package/dist/chunk-chunk-DDB4TLQG.module.min.js +0 -2
  448. package/dist/chunk-chunk-DTH3SUOU.module.min.js +0 -2
  449. package/dist/chunk-chunk-DTSNLGRK.module.min.js +0 -2
  450. package/dist/chunk-chunk-DVCWU7MT.module.min.js +0 -2
  451. package/dist/chunk-chunk-FEPXDKJP.module.min.js +0 -1
  452. package/dist/chunk-chunk-FJ76HWQZ.module.min.js +0 -1
  453. package/dist/chunk-chunk-FSIHAW6L.module.min.js +0 -2
  454. package/dist/chunk-chunk-G2RGVEYY.module.min.js +0 -2
  455. package/dist/chunk-chunk-G75OPF5N.module.min.js +0 -2
  456. package/dist/chunk-chunk-HADHLMY5.module.min.js +0 -1
  457. package/dist/chunk-chunk-HAJVODLO.module.min.js +0 -2
  458. package/dist/chunk-chunk-HBFA4NN6.module.min.js +0 -1
  459. package/dist/chunk-chunk-HIV7AW2V.module.min.js +0 -2
  460. package/dist/chunk-chunk-IY7RYD4S.module.min.js +0 -1
  461. package/dist/chunk-chunk-J3QOW4OE.module.min.js +0 -0
  462. package/dist/chunk-chunk-J3XWETBJ.module.min.js +0 -2
  463. package/dist/chunk-chunk-JZAMMSQQ.module.min.js +0 -2
  464. package/dist/chunk-chunk-KTWEBFMX.module.min.js +0 -2
  465. package/dist/chunk-chunk-LSJUXBMF.module.min.js +0 -1
  466. package/dist/chunk-chunk-MXMRXSCI.module.min.js +0 -2
  467. package/dist/chunk-chunk-MXVBXFKW.module.min.js +0 -2
  468. package/dist/chunk-chunk-NWIGA3UK.module.min.js +0 -1
  469. package/dist/chunk-chunk-OFAP623Y.module.min.js +0 -2
  470. package/dist/chunk-chunk-OHLRAEQZ.module.min.js +0 -2
  471. package/dist/chunk-chunk-OZK46A5U.module.min.js +0 -1
  472. package/dist/chunk-chunk-PMR47KRY.module.min.js +0 -2
  473. package/dist/chunk-chunk-PRNXOCYZ.module.min.js +0 -2
  474. package/dist/chunk-chunk-Q2YADC2V.module.min.js +0 -2
  475. package/dist/chunk-chunk-RLKZVJMQ.module.min.js +0 -2
  476. package/dist/chunk-chunk-ROP4HI7H.module.min.js +0 -2
  477. package/dist/chunk-chunk-SK2TQMG4.module.min.js +0 -2
  478. package/dist/chunk-chunk-SKLYXNYW.module.min.js +0 -2
  479. package/dist/chunk-chunk-TCMHJWFJ.module.min.js +0 -1
  480. package/dist/chunk-chunk-TSCFL235.module.min.js +0 -1
  481. package/dist/chunk-chunk-U4NZCU5T.module.min.js +0 -2
  482. package/dist/chunk-chunk-U66USBWU.module.min.js +0 -1
  483. package/dist/chunk-chunk-UOQRPGPK.module.min.js +0 -2
  484. package/dist/chunk-chunk-VKL6DI43.module.min.js +0 -2
  485. package/dist/chunk-chunk-W62673ZE.module.min.js +0 -1
  486. package/dist/chunk-chunk-WFHZHWT7.module.min.js +0 -1
  487. package/dist/chunk-chunk-XCC25CZZ.module.min.js +0 -2
  488. package/dist/chunk-chunk-XECNOUZY.module.min.js +0 -2
  489. package/dist/chunk-chunk-XYZDTYAF.module.min.js +0 -2
  490. package/dist/chunk-chunk-YHNZCPOZ.module.min.js +0 -2
  491. package/dist/chunk-chunk-YWZB3KPI.module.min.js +0 -2
  492. package/dist/chunk-statisticalOverlays-HMYYSGPE.module.min.js +0 -2
  493. package/dist/components/stream/test-utils/frameScheduler.d.ts +0 -12
  494. package/dist/components/stream/test-utils/revisionConsumption.d.ts +0 -13
  495. package/dist/test-utils/canvasMock.d.ts +0 -86
  496. package/dist/test-utils/capturedFrameProps.d.ts +0 -67
  497. package/dist/test-utils/frameMock.d.ts +0 -81
  498. package/dist/test-utils/ordinalFixtures.d.ts +0 -48
  499. /package/dist/{chunk-chunk-JJ2OOIET.module.min.js → c-GGISSW5E.min.js} +0 -0
  500. /package/dist/{chunk-chunk-SIRIJ3DY.module.min.js → c-N4G2L7ID.min.js} +0 -0
  501. /package/dist/{chunk-chunk-CA3YDW6F.module.min.js → c-S6U5CGT5.min.js} +0 -0
  502. /package/dist/components/recipes/{mobileAnnotationStrategy.d.ts → mobileAnnotationBehavior.d.ts} +0 -0
@@ -1 +1,2 @@
1
- var e,t,n,r,i,o,s=Object.create,a=Object.defineProperty,l=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,u=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty,d=(e,t,n)=>function(){if(n)throw n[0];try{return e&&(t=(0,e[c(e)[0]])(e=0)),t}catch(e){throw n=[e],e}},f=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},y=(e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of c(t))h.call(e,i)||i===n||a(e,i,{get:()=>t[i],enumerable:!(r=l(t,i))||r.enumerable});return e},p=(e,t,n)=>(n=null!=e?s(u(e)):{},y(!t&&e&&e.__esModule?n:a(n,"default",{value:e,enumerable:!0}),e)),g=d({"src/components/stream/brushAccessibility.ts"(){e=p(require("react")),t="Use arrow keys to move the selected range, Shift plus an arrow key to resize it, and Escape to clear it."}}),m={};function x(e,t,n,r){const[i,o]=[Math.min(...t),Math.max(...t)],s=(o-i)/20;let[a,l]=e;if(r)0>n?a=Math.max(i,a-s):l=Math.min(o,l+s);else{const e=l-a;a=Math.max(i,Math.min(o-e,a+n*s)),l=a+e}return[a,l]}function v(e,t){let n=0,r=t.length-1;for(;r>n;){const i=n+r+1>>1;t[i]>e?r=i-1:n=i}return t[n]}function b(e,t){let n=0,r=t.length-1;for(;r>n;){const i=n+r>>1;e>t[i]?n=i+1:r=i}return t[n]}function k({width:s,height:a,totalWidth:l,totalHeight:c,margin:u,dimension:h,scales:d,onBrush:f,binSize:y,snap:p,binBoundaries:g,snapDuring:m,streaming:k}){const w=(0,n.useRef)(null),A=(0,n.useRef)(null),S=(0,n.useRef)(f);S.current=f;const _=(0,n.useRef)(d);_.current=d;const M=(0,n.useMemo)(()=>g?[...g].sort((e,t)=>e-t):void 0,[g]),C=(0,n.useRef)(M);C.current=M;const P=(0,n.useRef)(!1),R=(0,n.useRef)(null),j=function({label:n="Data range brush",description:r=t,onAction:i}={}){const o=e.useId().replace(/:/g,""),s=e.useRef(i);return s.current=i,{description:r,descriptionId:"semiotic-brush-description-"+o,svgProps:{role:"region",tabIndex:0,"aria-label":n,"aria-describedby":"semiotic-brush-description-"+o,onKeyDown:e.useCallback(e=>{const t=function(e){return"Escape"===e.key?{type:"clear"}:"ArrowLeft"===e.key?{type:"nudge",direction:"left",resize:e.shiftKey}:"ArrowRight"===e.key?{type:"nudge",direction:"right",resize:e.shiftKey}:"ArrowUp"===e.key?{type:"nudge",direction:"up",resize:e.shiftKey}:"ArrowDown"===e.key?{type:"nudge",direction:"down",resize:e.shiftKey}:null}(e);t&&(e.preventDefault(),s.current?.(t))},[])}}}({label:"xy"===h?"Two-dimensional data range brush":h.toUpperCase()+" data range brush",onAction:e=>{const t=_.current,n=A.current;if(!t||!n||!w.current)return;const i=(0,r.select)(w.current).select(".brush-g");if("clear"===e.type)return P.current=!0,i.call(n.move,null),P.current=!1,R.current=null,void S.current(null);const o=t.x.domain(),s=t.y.domain(),a=R.current;let l=a?.x??[o[0]+.4*(o[1]-o[0]),o[0]+.6*(o[1]-o[0])],c=a?.y??[s[0]+.4*(s[1]-s[0]),s[0]+.6*(s[1]-s[0])];const u="left"===e.direction||"right"===e.direction,d="left"===e.direction||"down"===e.direction?-1:1;if(u&&"y"!==h&&(l=x(l,o,d,e.resize)),u||"x"===h||(c=x(c,s,d,e.resize)),u&&"y"===h||!u&&"x"===h)return;const f={x:l,y:c};P.current=!0,i.call(n.move,"x"===h?[t.x(l[0]),t.x(l[1])]:"y"===h?[t.y(c[1]),t.y(c[0])]:[[t.x(l[0]),t.y(c[1])],[t.x(l[1]),t.y(c[0])]]),P.current=!1,R.current=f,S.current(f)}});return(0,n.useEffect)(()=>{if(!w.current)return;const e=(0,r.select)(w.current).select(".brush-g"),t="x"===h?(0,i.brushX)():"y"===h?(0,i.brushY)():(0,i.brush)();return t.extent([[0,0],[s,a]]),t.on("brush end",n=>{if(P.current)return;const r=_.current;if(!r)return;if(!n.selection)return R.current=null,void S.current(null);let i,o;if("x"===h){const[e,t]=n.selection;i=[r.x.invert(e),r.x.invert(t)],o=[r.y.invert(a),r.y.invert(0)]}else if("y"===h){const[e,t]=n.selection;i=[r.x.invert(0),r.x.invert(s)],o=[r.y.invert(t),r.y.invert(e)]}else{const[[e,t],[s,a]]=n.selection;i=[r.x.invert(e),r.x.invert(s)],o=[r.y.invert(a),r.y.invert(t)]}if("bin"===p&&"y"!==h&&("end"===n.type||"brush"===n.type&&m)){const o=C.current;o&&o.length>0?i=function(e,t){return 0===t.length?e:[v(e[0],t),b(e[1],t)]}(i,o):y&&y>0&&(i=[Math.floor(i[0]/y)*y,Math.ceil(i[1]/y)*y]);const s=r.x(i[0]),a=r.x(i[1]);if(P.current=!0,"x"===h)e.call(t.move,[s,a]);else if("xy"===h){const r=n.selection;e.call(t.move,[[s,r[0][1]],[a,r[1][1]]])}P.current=!1}const l={x:i,y:o};R.current=l,S.current(l)}),e.call(t),A.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),A.current=null}},[s,a,h,p,y,m]),(0,n.useEffect)(()=>{if(!(k&&d&&A.current&&R.current))return;if(!w.current)return;if("y"===h)return;const e=R.current,t=d.x.domain()[0],n=(0,r.select)(w.current).select(".brush-g");if(t>=e.x[1])return P.current=!0,n.call(A.current.move,null),P.current=!1,R.current=null,void S.current(null);let i=e.x[0],o=!1;if(t>e.x[0]){if(i=t,"bin"===p){const e=C.current;e&&e.length>0?i=b(t,e):y&&y>0&&(i=Math.ceil(t/y)*y)}if(i>=e.x[1])return P.current=!0,n.call(A.current.move,null),P.current=!1,R.current=null,void S.current(null);o=!0}const s=d.x(i),a=d.x(e.x[1]);if(P.current=!0,"x"===h)n.call(A.current.move,[s,a]);else{const t=d.y(e.y[1]),r=d.y(e.y[0]);n.call(A.current.move,[[s,t],[a,r]])}if(P.current=!1,o){const t={x:[i,e.x[1]],y:e.y};R.current=t,S.current(t)}},[d,k,h,p,y]),(0,o.jsxs)("svg",{ref:w,width:l,height:c,...j.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:[(0,o.jsx)("title",{children:j.svgProps["aria-label"]}),(0,o.jsx)("desc",{id:j.descriptionId,children:j.description}),(0,o.jsx)("g",{className:"brush-g",transform:`translate(${u.left},${u.top})`})]})}f(m,{XYBrushOverlay:()=>k});var w,A=d({"src/components/stream/XYBrushOverlay.tsx"(){n=require("react"),r=require("d3-selection"),i=require("d3-brush"),g(),o=require("react/jsx-runtime")}}),S={};f(S,{DEFAULT_LIFECYCLE_THRESHOLDS:()=>Ee,IncrementalExtent:()=>K,RealtimeHeatmap:()=>Md,RealtimeHistogram:()=>gd,RealtimeLineChart:()=>dd,RealtimeSwarmChart:()=>bd,RealtimeWaterfallChart:()=>Ad,ReorderBuffer:()=>bh,RingBuffer:()=>U,RunningStats:()=>fh,StreamNetworkFrame:()=>dh,StreamXYFrame:()=>Sl,TemporalHistogram:()=>md,WindowAccumulator:()=>yh,bandBounds:()=>gh,bandFromAge:()=>Ne,compileMotionEncoding:()=>We,deriveMotionVector:()=>Oe,opacityFromAge:()=>$e,parseWindowDuration:()=>vh,resolveMotionAccessor:()=>Ie,resolveMotionVector:()=>ze,statValue:()=>ph}),module.exports=(w=S,y(a({},"__esModule",{value:!0}),w));var _=p(require("react")),M=require("react"),C=p(require("react")),P=require("react/jsx-runtime"),R=null,j=null;function T(e){const[t,n]=C.useState(()=>R);return C.useEffect(()=>{if(t)return;let e=!1;return(R?Promise.resolve(R):(j||(j=Promise.resolve().then(()=>(A(),m)).then(e=>R=e.XYBrushOverlay).catch(e=>{throw j=null,e})),j)).then(t=>{e||n(()=>t)}),()=>{e=!0}},[t]),t?(0,P.jsx)(t,{...e}):null}var D=Object.freeze([]);function L(e){if(!e)return D;let t=!1;for(let n=0;e.length>n;n++){const r=e[n];if(null==r||"object"!=typeof r){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}var E=class{constructor(e,t){this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=t?.chunkThreshold??5e3,this.chunkSize=t?.chunkSize??5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=L(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const r=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,r),bounded:!1}),t=r,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(e=L(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const r=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,r),bounded:!1}),t=r,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let n=0;e.length>n;n++){const r=e[n];null!=r&&"object"==typeof r&&(this.pushBuffer.push(r),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}},N=require("react"),I=require("react/jsx-runtime");function W(e){let t=null;const n=()=>(t||(t=(0,N.createContext)(null)),t),r=$(e);return[function({children:t,initialState:r}){const i=(0,N.useRef)(r),o=(0,N.useMemo)(()=>$(e,i.current),[]),s=n();return(0,I.jsx)(s.Provider,{value:o,children:t})},(e,t)=>{const i=n(),o=(0,N.useContext)(i)??r,s=(0,N.useRef)(e);s.current=e;const a=(0,N.useRef)({hasValue:!1,value:void 0}),l=(0,N.useCallback)(()=>{const e=s.current(o.getState()),n=a.current;return n.hasValue&&t&&t(n.value,e)?n.value:(a.current={hasValue:!0,value:e},e)},[o,t]),c=(0,N.useCallback)(()=>s.current(o.getState()),[o]);return(0,N.useSyncExternalStore)(o.subscribe,l,c)}]}function $(e,t){const n=new Set;let r={...e(function(e){const t=e(r);if(z(t)){r={...r,...t};for(const e of n)e()}}),...t??{}};return{getState:()=>r,subscribe:function(e){return n.add(e),()=>{n.delete(e)}}}}function z(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function O(e){if(!e?.colors)return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function F(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:B}}),e.accessibility.highContrast){const e="dark"===t.mode;t={...t,colors:{...t.colors,text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"}}}return t}var B=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Y={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},H={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},X={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:B,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function q(e,t){if("light"===t)return Y;if("dark"===t)return H;if("high-contrast"===t)return X;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?H:Y;return F({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return F({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[G,V]=W(e=>({theme:Y,setTheme(t){e(e=>({theme:q(e.theme,t)}))}})),U=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray();let n=0,r=[];t.length>e&&(n=t.length-e,r=t.slice(0,n)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=n;t.length>e;e++)this.push(t[e]);return r}update(e,t){const n=[],r=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const o=(r+i)%this._capacity,s=this.buffer[o];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:{...s},n.push(e),this.buffer[o]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(r=>{e(r)?n.push(r):t.push(r)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}},K=class{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}};function Q(e,t){return e===t}function Z(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function J(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function ee(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function te(e){return e?"function"==typeof e?e:t=>t[e]||t.id:null}function ne(e){return"string"==typeof e?e:e.id}var re=/^\d{4}-\d{1,2}$/;function ie(e){const t=e.trim();if(!t||!Number.isNaN(Number(t)))return NaN;const n=re.test(t)?t+"-01":t;if(n===t&&10>t.length)return NaN;const r=Date.parse(n);return Number.isFinite(r)?r:NaN}function oe(e){return e instanceof Date?e.getTime():"string"==typeof e?ie(e):+e}function se(e){return new Set(Array.isArray(e)?e:[e])}function ae(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function le(e,t,n){const r=e=>e.toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function ce(e){const t=e.map(ae),n=t.length-1;return e=>{if(0>=e){const[e,n,r]=t[0];return le(e,n,r)}if(e>=1){const[e,r,i]=t[n];return le(e,r,i)}const r=e*n,i=Math.floor(r),o=r-i,[s,a,l]=t[i],[c,u,h]=t[i+1];return le(Math.round(s+(c-s)*o),Math.round(a+(u-a)*o),Math.round(l+(h-l)*o))}}require("d3-scale");var ue=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],he=ce(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),de=ce(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),fe=ce(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),ye=ce(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),pe=ce(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),ge=ce(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),me=ce(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),xe=ce(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),ve=ce(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),be=ce(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),ke=ce(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),we=ce(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),Ae={blues:he,reds:de,greens:fe,viridis:me,oranges:ye,purples:pe,greys:ge,plasma:xe,inferno:ve,magma:be,cividis:ke,turbo:we};ce(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),ce(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),ce(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),ce(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),ce(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),ce(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),ce(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);var Se={category10:ue,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...Ae},_e=ue,Me=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Ce=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function Pe(e,t,n){if("function"==typeof t){const r=t(e);return n&&r&&"string"==typeof r&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||Ce.has(t)}(r)?n(r):r}const r=e?.[t]+"";return n?n(r):_e[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(r))%_e.length]}function Re(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function je(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function Te(e,t){return Math.min((e-t.startTime)/t.duration,1)}function De(e,t,n){return e+(t-e)*n}function Le(){return"undefined"!=typeof performance?performance.now():Date.now()}var Ee={fresh:1,aging:1.5,stale:3};function Ne(e,t,n={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(n.fresh??Ee.fresh)>e?"fresh":t*(n.aging??Ee.aging)>e?"aging":t*(n.stale??Ee.stale)>e?"stale":"expired":"fresh"}function Ie(e,t,n){if(null!=e)return"function"==typeof e?e(t,n):"object"==typeof e&&null!==e&&"constant"in e?e.constant:t[e]}function We(e){const{data:t,encoding:n}=e,r=[],i=new Map;return t.forEach((e,t)=>{const o=Ie(n.id,e,t);if(null==o||""===o)throw Error(`[semiotic] Motion encoding row ${t} resolved an empty id.`);const s=o+"";if(i.has(s))throw Error(`[semiotic] Duplicate motion encoding id "${s}".`);const a=Ie(n.process?.group,e,t),l=Ie(n.process?.stage,e,t),c=Ie(n.accessible?.group,e,t)??(null!=a?a+"":null!=l?l+"":void 0),u={};for(const r of Object.keys(n.evidence??{}))u[r]=Ie(n.evidence?.[r],e,t);const h={id:s,datum:e,time:{arrival:Ie(n.time?.arrival,e,t),basis:n.time?.basis,unit:n.time?.unit},placement:{x:Ie(n.placement?.x,e,t),y:Ie(n.placement?.y,e,t),lane:Ie(n.placement?.lane,e,t),space:n.placement?.space},kinematics:{velocityX:Ie(n.kinematics?.velocityX,e,t),velocityY:Ie(n.kinematics?.velocityY,e,t),space:n.kinematics?.space},process:{group:a,stage:l,target:Ie(n.process?.target,e,t),work:Ie(n.process?.work,e,t)},evidence:u,accessible:{description:Ie(n.accessible?.description,e,t),group:c,label:Ie(n.accessible?.label,e,t)??s}};r.push(h),i.set(s,h)}),{rows:r,byId:i}}function $e(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||0>=e.extent)return 1;const n=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>n?1:t;if("exponential"===e.type){const r=e.halfLife??e.extent/2;return t+Math.pow(.5,n/(r>0?r:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}function ze(e,t){const n=Number.isFinite(e)?e:0,r=Number.isFinite(t)?t:0;return{velocityX:n,velocityY:r,speed:Math.hypot(n,r),direction:Math.atan2(r,n)}}function Oe(e,t,n){return Number.isFinite(n)&&n>0?ze((t.x-e.x)/n,(t.y-e.y)/n):ze(0,0)}function Fe(e,t,n){if(1>=n)return 1;const r=n-1;return $e({age:r-t,extent:r,type:e.type,halfLife:e.halfLife??n/2,threshold:e.stepThreshold??.5*n,minOpacity:e.minOpacity??.1})}function Be(e){const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return t}function Ye(e,t,n){const r=e.duration??500,i=n-t;return r>i?1-i/r:0}function He(e,t,n,r){let i=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,i=!0),e._pulseColor!==n&&(e._pulseColor=n,i=!0),e._pulseGlowRadius!==r&&(e._pulseGlowRadius=r,i=!0),i):(0!==e._pulseIntensity&&(e._pulseIntensity=0,i=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,i=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,i=!0),i)}function Xe(e,t,n){if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const n=e.getX(t.datum),r=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${r}`;if(null!=n&&null!=r)return`p:${n}:${r}`}return"p:"+n;case"glyph":return t.pointId?"g:"+t.pointId:"g:"+n;case"rect":return`r:${t.group||""}:${t.datum?.binStart??t.datum?.category??n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function qe(e){return e?null!=e.opacity?e.opacity:null!=e.fillOpacity?e.fillOpacity:1:1}function Ge(e,t,n,r,i,o){const s=[];for(const i of e){const e=n(i),o=r(i);Number.isFinite(e)&&Number.isFinite(o)&&s.push({px:t.x(e),py:t.y(o),rawY:o,d:i})}s.sort((e,t)=>e.px-t.px);const a=Array(s.length),l=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];a[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:a,rawValues:l,style:i,datum:c,group:o}}function Ve(e,t,n,r,i,o,s,a){const l=[];for(const o of e){const e=n(o),s=r(o);if(!Number.isFinite(e)||!Number.isFinite(s))continue;const c=t.x(e),u=a?a(o):i;l.push({px:c,topY:t.y(s),botY:t.y(u),rawY:s})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length),h=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY],h[e]=t.rawY}return{type:"area",topPath:c,bottomPath:u,rawValues:h,style:o,datum:e,group:s}}function Ue(e,t,n,r){const i=new Map;if("silhouette"===r)for(const r of e){let e=0;for(const i of t)e+=n(i,r)||0;i.set(r,-e/2)}else if("wiggle"===r){e.length>0&&i.set(e[0],0);for(let r=1;e.length>r;r++){const o=e[r-1],s=e[r];let a=0,l=0,c=0;for(const e of t){const t=n(e,s)||0;a+=(2*c+t)*(t-(n(e,o)||0)),l+=t,c+=t}const u=i.get(o)??0;i.set(s,u-(l>0?a/(2*l):0))}if(e.length>0){let r=0;for(const o of e){let e=0;for(const r of t)e+=n(r,o)||0;r+=(i.get(o)??0)+e/2}const o=r/e.length;for(const t of e)i.set(t,(i.get(t)??0)-o)}}else for(const t of e)i.set(t,0);return i}function Ke(e,t,n,r,i,o,s){const a=n(e),l=r(e);if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:i,style:o,datum:e};return void 0!==s&&(c.pointId=s),c}function Qe(e,t,n,r,i,o,s,a){const l=n(e),c=r(e);if(!Number.isFinite(l)||!Number.isFinite(c))return null;const u={type:"symbol",x:t.x(l),y:t.y(c),size:i,symbolType:o,style:s,datum:e};return void 0!==a&&(u.pointId=a),u}function Ze(e,t,n,r,i,o,s){return{type:"rect",x:e,y:t,w:n,h:r,style:i,datum:o,group:s}}function Je(e,t,n,r,i,o,s){const a={type:"heatcell",x:e,y:t,w:n,h:r,fill:i,datum:o};return s?.showValues&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function et(e,t,n,r){return"function"==typeof t.style?t.style(r||{},n):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(n,r)}function tt(e,t,n,r){if(!e.scales)return null;const i=[],o=[];for(const n of t){const t=e.getX(n);if(!Number.isFinite(t))continue;const s=r.getTop(n),a=r.getBottom(n);if(!Number.isFinite(s)||!Number.isFinite(a))continue;const l=e.scales.x(t),c=e.scales.y(s),u=e.scales.y(a);Number.isFinite(l)&&Number.isFinite(c)&&Number.isFinite(u)&&(i.push([l,c]),o.push([l,u]))}return 2>i.length?null:{type:"area",topPath:i,bottomPath:o,...e.config.curve&&"linear"!==e.config.curve&&{curve:e.config.curve},style:et(e,r,n,t[0]),datum:t,group:n,interactive:r.interactive}}function nt(e){const t=[],n=[];if(!e)return{perSeries:t,aggregate:n};for(const r of e)r.perSeries?t.push(r):n.push(r);return{perSeries:t,aggregate:n}}function rt(e,t,n){const r=[];for(const i of n){const n=tt(e,t,"__ribbon_aggregate",i);n&&r.push(n)}return r}function it(e,t,n,r){const i=[];for(const o of r){const r=tt(e,t,n,o);r&&i.push(r)}return i}function ot(e,t){if(!e)return{};if(!t||0===t.length)return e;const n=[];for(const r of t){if("band"!==r.kind)continue;const t=r.getTop(e),i=r.getBottom(e);Number.isFinite(i)&&Number.isFinite(t)&&n.push({y0:i,y1:t})}return 0===n.length?e:{...e,band:n[0],bands:n}}function st(e,t,n,r){if(!e.config.pointStyle)return;const i=r??e.getY;for(const r of t){const t=e.resolveGroupColor(r.key);for(const o of r.data){let r=e.config.pointStyle(o);!r.fill&&t&&(r={...r,fill:t});const s=r.r??3,a=e.getPointId?e.getPointId(o)+"":void 0,l=Ke(o,e.scales,e.getX,i,s,r,a);l&&n.push(l)}}}function at(e){return"threshold"===e.type&&"string"==typeof e.color&&"number"==typeof e.value}var lt={stops:[{offset:0,opacity:.8},{offset:1,opacity:.05}]};function ct(e,t=lt){if(e)return!0===e?t:"stops"in e?Array.isArray(e.stops)?e:void 0:"colorStops"in e?Array.isArray(e.colorStops)?{stops:e.colorStops.map(({offset:e,color:t})=>({offset:e,color:t}))}:void 0:{stops:[{offset:0,opacity:e.topOpacity??t.stops[0]?.opacity??.8},{offset:1,opacity:e.bottomOpacity??t.stops.at(-1)?.opacity??.05}]}}function ut(e){return ct(e)}var ht=require("d3-shape"),dt={circle:ht.symbolCircle,square:ht.symbolSquare,triangle:ht.symbolTriangle,diamond:ht.symbolDiamond,star:ht.symbolStar,cross:ht.symbolCross,wye:ht.symbolWye},ft=["circle","triangle","diamond","star","square","chevron","cross","wye"];function yt(e,t,n){if(n)return n;const r=e??"circle";return"chevron"===r?function(e){const t=1.5*pt(e),n=.92*t;return`M0,${-t}L${n},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-n},${(.78*t).toFixed(3)}Z`}(t):(0,ht.symbol)(dt[r]??ht.symbolCircle,Math.max(1,t))()??""}function pt(e){return Math.sqrt(Math.max(1,e)/Math.PI)}var gt=new Map;function mt(e,t,n){const r=n.config.areaStyle?.(t);return r&&(e.style=r),e}function xt(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){const r=Math.max(1,Math.floor(e.config.heatmapXBins??20)),i=Math.max(1,Math.floor(e.config.heatmapYBins??20)),o=e.config.heatmapAggregation??"count",s=Z(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[a,l]=e.scales.x.domain(),[c,u]=e.scales.y.domain(),h=(l-a||1)/r,d=(u-c||1)/i,f=r*i;if(f>1e6)return[];const y=new Int32Array(f),p=new Float64Array(f);for(let n=0;t.length>n;n++){const o=t[n],l=e.getX(o),u=e.getY(o);if(!isFinite(l)||!isFinite(u))continue;const f=Math.min(Math.floor((l-a)/h),r-1),g=Math.min(Math.floor((u-c)/d),i-1);if(0>f||0>g)continue;const m=g*r+f;y[m]++;const x=s(o);p[m]+=isFinite(x)?x:0}let g=1/0,m=-1/0;for(let e=0;f>e;e++){if(0===y[e])continue;let t;switch(o){case"sum":t=p[e];break;case"mean":t=p[e]/y[e];break;default:t=y[e]}g>t&&(g=t),t>m&&(m=t)}if(!isFinite(g))return[];const x=m-g||1,v=n.width/r,b=n.height/i,k=e.config.showValues,w=e.config.heatmapValueFormat,A=[];for(let t=0;i>t;t++){const n=t*r;for(let s=0;r>s;s++){const r=n+s;if(0===y[r])continue;let l;switch(o){case"sum":l=p[r];break;case"mean":l=p[r]/y[r];break;default:l=y[r]}const u=(l-g)/x,f={xi:s,yi:t,value:l,count:y[r],sum:p[r],xCenter:a+(s+.5)*h,yCenter:c+(t+.5)*d,agg:o};A.push(mt(Je(s*v,(i-1-t)*b,v,b,`rgb(${220-(180*u+.5)|0},${220-(100*u+.5)|0},${255-(50*u+.5)|0})`,f,k?{value:l,showValues:!0,valueFormat:w}:void 0),f,e))}}return A}(e,t,n);if(0===t.length)return[];const r=Z(e.config.valueAccessor,"value"),i=J(e.config.xAccessor,"x"),o=J(e.config.yAccessor,"y"),s=new Map,a=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],r=i(n),u=o(n);l[e]=r,c[e]=u,s.has(r)||s.set(r,s.size),a.has(u)||a.set(u,a.size)}const u=s.size,h=a.size;if(0===u||0===h)return[];const d=Array.from(s.keys()),f=Array.from(a.keys()),y=d.every(e=>"number"==typeof e&&!isNaN(e)),p=f.every(e=>"number"==typeof e&&!isNaN(e));if(y){d.sort((e,t)=>Number(e)-Number(t)),s.clear();for(let e=0;d.length>e;e++)s.set(d[e],e)}if(p){f.sort((e,t)=>Number(e)-Number(t)),a.clear();for(let e=0;f.length>e;e++)a.set(f[e],e)}const g=new Float64Array(t.length),m=new Float64Array(t.length),x=Array(t.length),v=new Map;let b=0;for(let e=0;t.length>e;e++){const n=t[e],i=s.get(l[e]),o=a.get(c[e]);if(void 0===i||void 0===o)continue;const h=r(n),d=o*u+i,f=v.get(d);let y;void 0!==f?y=f:(y=b++,v.set(d,y)),g[y]=d,m[y]=h,x[y]=n}let k=1/0,w=-1/0;for(let e=0;b>e;e++){const t=m[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const A=function(e){const t=e in Ae?e:"blues";let n=gt.get(t);if(n)return n;n=Array(256);const r=(i=t)&&Ae[i]||he;var i;for(let e=0;256>e;e++)n[e]=r(e/255);return gt.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),S=255/(w-k||1),_=n.width/u,M=n.height/h,C=e.config.showValues,P=e.config.heatmapValueFormat,R=[];for(let t=0;b>t;t++){const n=m[t];if(!isFinite(n))continue;const r=g[t],i=r%u,o=x[t];R.push(mt(Je(i*_,(h-1-(r-i)/u)*M,_,M,A[Math.min((n-k)*S+.5|0,255)],o,C?{value:n,showValues:!0,valueFormat:P}:void 0),o,e))}return R}function vt(e,t,n,r,i){const o=new Map;for(const s of e){const e=t(s),a=n(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/r)*r;let c=o.get(l);if(c||(c={start:l,end:l+r,total:0,categories:new Map},o.set(l,c)),c.total+=a,i){const e=i(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return o}function bt(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:r,warned:i}=e;kt(r)&&0===n.length&&wt(i,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(e=>null==e.datum)&&wt(i,"null-datums",`[semiotic] ${t} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}function kt(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(kt))}function wt(e,t,n){e.has(t)||(e.add(t),console.warn(n))}function At(e,t,n,r){const i=function(e){if(e instanceof Error)return{name:e.name||"Error",message:e.message||"Custom layout threw."};if("string"==typeof e)return{name:"Error",message:e};if(null==e)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:e+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(t),o="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:o,message:`Semiotic ${e} ${o} failed: ${i.message}`,error:i,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:r}}function St(e,t){const n="function"==typeof e?e:n=>n[e||t];return e=>{const t=n(e);return null==t?NaN:+t}}function _t(e){const t=[],n=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,r=St(n&&e.valueAccessor||e.yAccessor,n?"value":"y");if(e.boundsAccessor){const n=Z(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=r(e);if(!Number.isFinite(t))return NaN;const i=n(e);return Number.isFinite(i)&&0!==i?t+i:t},getBottom:e=>{const t=r(e);if(!Number.isFinite(t))return NaN;const i=n(e);return Number.isFinite(i)&&0!==i?t-i:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const n=Array.isArray(e.band)?e.band:[e.band];for(const e of n)t.push({kind:"band",getTop:St(e.y1Accessor,"y1"),getBottom:St(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}var Mt=require("d3-scale");function Ct(e,t){return t?[t[0]??e[0],t[1]??e[1]]:e}function Pt(e,t,n){if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return(0,Mt.scaleLog)().domain(e).range(n).clamp(!0)}return"symlog"===e?(0,Mt.scaleSymlog)().domain(t).range(n):"time"===e?(0,Mt.scaleTime)().domain([new Date(t[0]),new Date(t[1])]).range(n):(0,Mt.scaleLinear)().domain(t).range(n)}function Rt(e,t,n,r){const i=e.push(t);return n&&n.push(r),i}var jt=new WeakMap;function Tt(){return this.updateResults.last}function Dt(){return this.updateResults.last}function Lt(e){return this.updateResults.subscribe(e)}function Et(e){this.config.layoutSelection=e}function Nt(){jt.set(this,!0)}function It(){const e=!0===jt.get(this);return jt.delete(this),e}function Wt(e){Object.assign(e.prototype,{getLastUpdateResult:Tt,getUpdateSnapshot:Dt,subscribeUpdateResult:Lt,setLayoutSelection:Et,markStylePaintPending:Nt,consumeStylePaintPending:It})}var $t={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"};function zt(e,t){const n={...e};for(const e of t)n[$t[e]]++;return n}function Ot(e,t,n){const r=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:r,revisions:zt(n,r)}}var Ft=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=Ot({kind:"initialize"},[],this.revisions),this.listeners=new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){const n=Ot(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}},Bt=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Yt=["scene-style","data-paint","accessibility","evidence"],Ht=(e,t)=>({retainedData:e,invalidations:t}),Xt=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],qt=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Gt=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Vt=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ut=["scene-geometry","data-paint","accessibility","evidence"],Kt=["scene-style","data-paint","accessibility","evidence"],Qt=[],Zt={chartType:Ht("rebuild",Xt),runtimeMode:Ht("rebuild",Xt),xAccessor:Ht("rebuild",Xt),yAccessor:Ht("rebuild",Xt),timeAccessor:Ht("rebuild",Xt),valueAccessor:Ht("rebuild",Xt),y0Accessor:Ht("rebuild",Xt),boundsAccessor:Ht("rebuild",Xt),band:Ht("rebuild",Xt),openAccessor:Ht("rebuild",Xt),highAccessor:Ht("rebuild",Xt),lowAccessor:Ht("rebuild",Xt),closeAccessor:Ht("rebuild",Xt),candlestickRangeMode:Ht("rebuild",Xt),accessorRevision:Ht("rebuild",Xt),groupAccessor:Ht("rebuild",qt),categoryAccessor:Ht("rebuild",qt),lineDataAccessor:Ht("rebuild",qt),colorAccessor:Ht("rebuild",Kt),sizeAccessor:Ht("rebuild",Ut),symbolAccessor:Ht("rebuild",Ut),pointIdAccessor:Ht("rebuild",Ut),xScaleType:Ht("preserve",Gt),yScaleType:Ht("preserve",Gt),xExtent:Ht("preserve",Gt),yExtent:Ht("preserve",Gt),extentPadding:Ht("preserve",Gt),scalePadding:Ht("preserve",Gt),axisExtent:Ht("preserve",Gt),yAxisExtent:Ht("preserve",Gt),binSize:Ht("preserve",Gt),normalize:Ht("preserve",Gt),heatmapAggregation:Ht("preserve",Gt),heatmapXBins:Ht("preserve",Gt),heatmapYBins:Ht("preserve",Gt),arrowOfTime:Ht("preserve",Vt),baseline:Ht("preserve",Vt),stackOrder:Ht("preserve",Vt),sizeRange:Ht("preserve",Vt),curve:Ht("preserve",Vt),areaGroups:Ht("preserve",Vt),customLayout:Ht("preserve",Vt),layoutConfig:Ht("preserve",Vt),layoutMargin:Ht("preserve",Vt),symbolMap:Ht("preserve",Ut),showValues:Ht("preserve",Ut),heatmapValueFormat:Ht("preserve",Ut),lineStyle:Ht("preserve",Kt),pointStyle:Ht("preserve",Kt),areaStyle:Ht("preserve",Kt),barStyle:Ht("preserve",Kt),swarmStyle:Ht("preserve",Kt),waterfallStyle:Ht("preserve",Kt),candlestickStyle:Ht("preserve",Kt),boundsStyle:Ht("preserve",Kt),gradientFill:Ht("preserve",Kt),lineGradient:Ht("preserve",Kt),semanticLineStops:Ht("preserve",Kt),colorScheme:Ht("preserve",Kt),themeCategorical:Ht("preserve",Kt),themeSemantic:Ht("preserve",Kt),themeSequential:Ht("preserve",Kt),themeDiverging:Ht("preserve",Kt),barColors:Ht("preserve",Kt),decay:Ht("preserve",Kt),pulse:Ht("preserve",Kt),staleness:Ht("preserve",Kt),layoutSelection:Ht("preserve",Kt),annotations:Ht("preserve",["overlay","accessibility","evidence"]),windowSize:Ht("preserve",Qt),windowMode:Ht("preserve",Qt),maxCapacity:Ht("preserve",Qt),clock:Ht("preserve",Qt),transition:Ht("preserve",Qt),introAnimation:Ht("preserve",Qt),onLayoutError:Ht("preserve",Qt)},Jt=Ht("preserve",Vt),en=class{constructor(){this.tracker=new Ft}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},Bt)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Yt):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const n=new Set;for(const r of e){const e=Zt[r]??Jt;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)n.add(t)}return{retainedData:t,invalidations:n}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}},tn=require("d3-quadtree"),nn=class{constructor(){this.maxRadius=0,this.tree=null}get quadtree(){return this.tree}get maxPointRadius(){return this.maxRadius}clear(){this.tree=null,this.maxRadius=0}rebuild(e,t){if("scatter"!==e&&"bubble"!==e&&"custom"!==e)return void this.clear();let n=0,r=0;for(const e of t)"point"===e.type&&(n++,e.r>r&&(r=e.r));if(this.maxRadius=r,500>=n)return void(this.tree=null);const i=Array(n);let o=0;for(const e of t)"point"===e.type&&(i[o++]=e);this.tree=(0,tn.quadtree)().x(e=>e.x).y(e=>e.y).addAll(i)}},rn=class e{constructor(e){if(this.xExtent=new K,this.yExtent=new K,this.growingCapacityWarned=!1,this.windowSizeWarned=!1,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._datumIndexCache=null,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.updateResults=new en,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.xIsDate=!1,this.spatialIndex=new nn,this._lastBoundedInsertsRef=null,this.applyPulse=(e,t,n)=>!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,n,r,i,o=("undefined"!=typeof performance?performance.now():Date.now())){const s=e.color??"rgba(255,255,255,0.6)",a=e.glowRadius??4;let l=!1;const c=i??(()=>{const e=new Map;for(let t=0;n.length>t;t++)e.set(n[t],t);return e})();for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let i=0,a=!1;for(const n of t){const t=c.get(n);if(null==t)continue;a=!0;const s=r.get(t);if(null==s)continue;const l=Ye(e,s,o);l>i&&(i=l)}a&&(l=He(n,i,s)||l);continue}const t=c.get(n.datum);if(null==t)continue;const i=r.get(t);l=He(n,null==i?0:Ye(e,i,o),s,a)||l}return l}(this.config.pulse,e,t,this.timestampBuffer,this.getDatumIndexMap(t),n),this.config=e,this.buffer=new U(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=Z(e.timeAccessor||e.xAccessor,"time"),this.getY=Z(e.valueAccessor||e.yAccessor,"value")):(this.getX=Z(e.xAccessor,"x"),this.getY=Z(e.yAccessor,"y")),this.getGroup=ee(e.groupAccessor),this.getCategory=ee(e.categoryAccessor),this.getSize=e.sizeAccessor?Z(e.sizeAccessor,"size"):void 0,this.getColor=ee(e.colorAccessor),this.getSymbol=ee(e.symbolAccessor),this.getY0=e.y0Accessor?Z(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=_t(e),this.getPointId=ee(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?Z(e.openAccessor,"open"):void 0,this.getHigh=Z(e.highAccessor,"high"),this.getLow=Z(e.lowAccessor,"low"),this.getClose=n?Z(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new U(e.windowSize))}currentTime(){return this.config.clock?.()??Le()}syncPulseTimestampBuffer(){this.config.pulse?null!=this.timestampBuffer&&this.timestampBuffer.capacity===this.buffer.capacity&&this.timestampBuffer.size===this.buffer.size||(this.timestampBuffer=function(e,t){const n=new U(e.capacity);return e.forEach(()=>n.push(t)),n}(this.buffer,this.currentTime())):this.timestampBuffer=null}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),r=t.getBottom(e);Number.isFinite(n)&&this.yExtent.push(n),Number.isFinite(r)&&this.yExtent.push(r)}}evictDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.evict(this.getHigh(e)),void this.yExtent.evict(this.getLow(e));this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),r=t.getBottom(e);Number.isFinite(n)&&this.yExtent.evict(n),Number.isFinite(r)&&this.yExtent.evict(r)}}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return this.updateResults.recordNoop("replace"),!1;const t=this.currentTime();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const o=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode;if(this.getX=o?Z(this.config.timeAccessor||this.config.xAccessor,"time"):Z(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,r="function"==typeof n?n(t):t[n||"x"],i=r instanceof Date,o="string"==typeof r&&Number.isFinite(ie(r));if(this.xIsDate=i||o,o){const e="string"==typeof n?n:void 0;this.getX=e?t=>oe(t[e]):e=>oe(n(e))}}i=this.timestampBuffer,(r=e.totalSize||e.inserts.length)>(n=this.buffer).capacity&&(n.resize(r),i&&r>i.capacity&&i.resize(r));for(const n of e.inserts)Rt(this.buffer,n,this.timestampBuffer,t),this.xExtent.push(this.getX(n)),this.pushDatumYExtent(n)}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity??1e5;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap),"production"===process.env.NODE_ENV||this.growingCapacityWarned||5e4>this.growingCap||(this.growingCapacityWarned=!0,console.warn(`[Semiotic] Growing window buffer reached ${this.growingCap} points (cap ${e}). Large canvas scenes are expensive — prefer a sliding window, aggregation, or an explicit maxCapacity if this is intentional.`)))}const e=Rt(this.buffer,n,this.timestampBuffer,t);this.xExtent.push(this.getX(n)),this.pushDatumYExtent(n),null!=e&&(this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e))}var n,r,i;return this.updateResults.recordData(e.bounded?"replace":"ingest",e.inserts.length),!0}ingestWithResult(e){return this.ingest(e),this.updateResults.last}computeScene(e){const{config:t,buffer:n}=this,r=this.scales,i=this.lastLayout;if(!this.needsFullRebuild&&!t.customLayout&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(this.config.scalePadding??0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(n,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const o=this.getBufferArray(),s=this.yExtent.extent;let a=Ct(this.xExtent.extent,t.xExtent),l=Ct(s,t.yExtent);const c=!(!(u=t.yExtent)||null==u[0]||null==u[1]);var u;const h="exact"===(t.yAxisExtent??t.axisExtent);if("stackedarea"===t.chartType&&!c&&n.size>0){const e=function(e){const{config:t,groups:n,getX:r,getY:i}=e,o="exact"===(t.yAxisExtent??t.axisExtent);if(t.normalize){const n=[0,o?1:1+t.extentPadding];return{yDomain:n,stackExtentCache:{key:`${e.bufferSize}:${e.ingestVersion}:norm`,yDomain:n}}}const s=`${e.bufferSize}:${e.ingestVersion}:${t.baseline??"zero"}:${t.stackOrder??"key"}`;if(e.stackExtentCache&&e.stackExtentCache.key===s)return{yDomain:e.stackExtentCache.yDomain,stackExtentCache:e.stackExtentCache};const a=new Map,l=new Set;let c=0;const u=new Map,h=new Map;for(const e of n){const t=new Map;let n=0;for(const o of e.data){const e=r(o),s=i(o);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),l.add(e),n+=s;const a=(u.get(e)||0)+s;u.set(e,a),a>c&&(c=a)}a.set(e.key,t),h.set(e.key,n)}const d=t.stackOrder??"key",f=(e,t)=>t>e?-1:e>t?1:0;let y,p;if("input"===d)y=n.map(e=>e.key);else if("insideOut"===d){const e=[...n].map(e=>e.key).sort((e,t)=>{const n=(h.get(t)??0)-(h.get(e)??0);return 0!==n?n:f(e,t)}),t=[],r=[];let i=0,o=0;for(const n of e)o>i?(t.push(n),i+=h.get(n)??0):(r.push(n),o+=h.get(n)??0);y=[...r.reverse(),...t]}else y="asc"===d?n.map(e=>e.key).sort((e,t)=>{const n=(h.get(e)??0)-(h.get(t)??0);return 0!==n?n:f(e,t)}):"desc"===d?n.map(e=>e.key).sort((e,t)=>{const n=(h.get(t)??0)-(h.get(e)??0);return 0!==n?n:f(e,t)}):n.map(e=>e.key).sort(f);if("wiggle"===t.baseline||"silhouette"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),n=Ue(e,y,(e,t)=>a.get(e)?.get(t)||0,t.baseline);let r=1/0,i=-1/0;for(const t of e){const e=n.get(t)??0,o=u.get(t)??0;r>e&&(r=e),e+o>i&&(i=e+o)}Number.isFinite(r)&&Number.isFinite(i)||(r=0,i=0);const s=i-r,c=o?0:s>0?s*t.extentPadding:1;p=[r-c,i+c]}else if("diverging"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),[n,r]=function(e,t,n){let r=0,i=0;for(const o of e){let e=0,s=0;for(const r of t){const t=n(r,o)||0;0>t?s+=t:e+=t}r>s&&(r=s),e>i&&(i=e)}return[r,i]}(e,y,(e,t)=>a.get(e)?.get(t)||0),i=r-n,s=o?0:i>0?i*t.extentPadding:1;p=[n-s,r+s]}else p=[0,c+(o?0:c>0?c*t.extentPadding:1)];return{yDomain:p,stackExtentCache:{key:s,yDomain:p}}}({config:t,groups:this.groupData(o),getX:this.getX,getY:this.getY,bufferSize:n.size,ingestVersion:this._ingestVersion,stackExtentCache:this._stackExtentCache});l=e.yDomain,this._stackExtentCache=e.stackExtentCache}else"bar"===t.chartType&&t.binSize&&!c&&n.size>0?l=function(e,t,n,r,i,o,s){const[,a]=function(e,t,n,r,i){const o=vt(e,t,n,r,i);if(0===o.size)return[0,0];let s=0;for(const e of o.values())e.total>s&&(s=e.total);return[0,s]}(e,t,n,r,i);return[0,s?a:a+a*o]}(n,this.getX,this.getY,t.binSize,this.getCategory,t.extentPadding,h):"waterfall"===t.chartType&&!c&&n.size>0?l=function(e,t,n,r){const[i,o]=function(e,t){let n=0,r=0,i=0;for(const o of e){const e=t(o);null==e||Number.isNaN(e)||(i+=e,n>i&&(n=i),i>r&&(r=i))}return[n,r]}(e,t),s=o-i,a=r?0:s>0?s*n:1;return[Math.min(0,i-Math.abs(a)),Math.max(0,o+Math.abs(a))]}(n,this.getY,t.extentPadding,h):c||l[0]===1/0||(l=function(e,t,n){if(!n.length)return e;let[r,i]=e;for(const e of t)for(const t of n){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&(r>n&&(r=n),n>i&&(i=n)),Number.isFinite(o)&&(r>o&&(r=o),o>i&&(i=o))}return[r,i]}(l,o,this.resolvedRibbons),l=function(e,t){const n=e[1]-e[0],r=t.exactMode?0:n>0?n*t.extentPadding:1,i=[null!=t.userMin?e[0]:e[0]-r,null!=t.userMax?e[1]:e[1]+r];return"log"!==t.yScaleType||i[0]>0||0>=t.dataYDomain[0]||t.exactMode||null==t.userMin&&(i[0]=t.dataYDomain[0]/(1+t.extentPadding)),i}(l,{exactMode:h,extentPadding:t.extentPadding,userMin:t.yExtent?.[0],userMax:t.yExtent?.[1],yScaleType:t.yScaleType,dataYDomain:s}));l=function(e,t,n){if(!t||n)return e;const r=t[0],i=t[1];return null==r&&null==i?e:[null!=r?r:e[0],null!=i?i:e[1]]}(l,t.yExtent,!!c),({xDomain:a,yDomain:l}=function(e,t,n){let r=e,i=t;if(r[0]===1/0||r[1]===-1/0)if("time"===n){const e=Date.now();r=[e-864e5,e]}else r=[0,1];return i[0]!==1/0&&i[1]!==-1/0||(i=[0,1]),{xDomain:r,yDomain:i}}(a,l,t.xScaleType)),this.scales=function(e){const{config:t,layout:n,xDomain:r,yDomain:i}=e,o="streaming"===t.runtimeMode,s=Math.max(0,Math.min(t.scalePadding||0,Math.min(n.width,n.height)/2-1));if(o){if("x"==("up"===(a=t.arrowOfTime)||"down"===a?"y":"x")){const e="right"===t.arrowOfTime?[s,n.width-s]:[n.width-s,s];return{x:(0,Mt.scaleLinear)().domain(r).range(e),y:Pt(t.yScaleType,i,[n.height-s,s])}}const e="down"===t.arrowOfTime?[s,n.height-s]:[n.height-s,s];return{x:Pt(t.yScaleType,i,[s,n.width-s]),y:(0,Mt.scaleLinear)().domain(r).range(e)}}var a;return{x:Pt(t.xScaleType,r,[s,n.width-s]),y:Pt(t.yScaleType,i,[n.height-s,s])}}({config:t,layout:e,xDomain:a,yDomain:l}),this._customLayoutFailedThisBuild=!1;const d=this.buildSceneNodes(e,o);if(this._customLayoutFailedThisBuild)return!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=r,this.lastLayout=i):(this.scene=[],this.spatialIndex.rebuild(this.config.chartType,this.scene)),void(this.needsFullRebuild=!0);this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=d,this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o,this.currentTime()),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.spatialIndex.rebuild(this.config.chartType,this.scene),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}get quadtree(){return this.spatialIndex.quadtree}get maxPointRadius(){return this.spatialIndex.maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const r of e.path)r[0]*=t,r[1]*=n;break;case"area":for(const r of e.topPath)r[0]*=t,r[1]*=n;for(const r of e.bottomPath)r[0]*=t,r[1]*=n;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*n,width:e.clipRect.width*t,height:e.clipRect.height*n}),e.strokeColorBands&&(e.strokeColorBands=e.strokeColorBands.map(e=>({...e,y:e.y*n,height:e.height*n})));break;case"point":case"glyph":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const r=this.scales.x.domain(),i=this.scales.y.domain(),o=this.scales.x.range(),s=this.scales.y.range(),a=Pt,l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=s[1]>s[0];this.scales={x:a(this.config.xScaleType,r,o[0]>o[1]?[e.width-l,l]:[l,e.width-l]),y:a(this.config.yScaleType,i,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.spatialIndex.rebuild(this.config.chartType,this.scene),this.version++}buildSceneNodes(e,t){const{config:n,scales:r}=this;if(!r)return[];if(n.customLayout){const i={data:t,scales:r,dimensions:{width:e.width,height:e.height,margin:n.layoutMargin??{top:0,right:0,bottom:0,left:0},plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:n.themeSemantic??{},categorical:n.themeCategorical??Me},resolveColor:(e,t)=>{const r=this.resolveGroupColor(e);if(r)return r;const i=this.resolveLineStyle(e,t);return i.stroke?i.stroke:"string"==typeof i.fill?i.fill:n.themeSemantic?.primary??"#4e79a7"},config:n.layoutConfig??{},selection:n.layoutSelection??null};let o;try{o=n.customLayout(i)}catch(e){const t=null!==this.lastCustomLayoutResult,r=At("xy",e,t,this.version);this.lastCustomLayoutFailure=r,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e);try{n.onLayoutError?.(r)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return t?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=o.overlays??null,this.lastCustomLayoutResult=o,this.lastCustomLayoutFailure=null;const s=o.nodes??[];if(this._customRestyle=o.restyle,this.hasCustomRestyle=!!o.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of s)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(s,n.layoutSelection??null)}return bt({label:"customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}if(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===t.length)return[];const i={scales:r,config:n,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getSymbol:this.getSymbol,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(n.chartType){case"line":return function(e,t){const n=e.groupData(t),r=[],i=e.config.annotations?.filter(at).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:o}=nt(e.ribbons);if(o.length>0&&r.push(...rt(e,t,o)),i.length>0)for(const t of n)r.push(...it(e,t.data,t.key,i))}for(const t of n){const n=e.resolveLineStyle(t.key,t.data[0]),o=Ge(t.data,e.scales,e.getX,e.getY,n,t.key);i&&i.length>0&&(o.colorThresholds=i),e.config.curve&&"linear"!==e.config.curve&&(o.curve=e.config.curve),e.config.lineGradient&&(o.strokeGradient=e.config.lineGradient),r.push(o)}return st(e,n,r),r}(i,t);case"area":return function(e,t){const n=e.groupData(t),r=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:o}=nt(e.ribbons);if(o.length>0&&r.push(...rt(e,t,o)),i.length>0)for(const t of n)r.push(...it(e,t.data,t.key,i))}const i=e.scales.y.domain(),o=i[0],s=e.config.semanticLineStops?.filter(e=>Number.isFinite(e.offset)).map(e=>({value:i[0]+Math.max(0,Math.min(1,e.offset))*(i[1]-i[0]),color:e.color,thresholdType:"greater"})).sort((e,t)=>e.value-t.value),a=s&&s.length>0?(()=>{const t=s.reduce((e,t)=>(e.at(-1)?.value===t.value?e[e.length-1]=t:e.push(t),e),[]),n=[{from:i[0],to:t[0].value}];for(let e=0;t.length>e;e++)n.push({from:t[e].value,to:t[e+1]?.value??i[1],color:t[e].color});return n.map(({from:t,to:n,color:r})=>{const i=e.scales.y(t),o=e.scales.y(n);return{y:Math.min(i,o),height:Math.abs(o-i),color:r}}).filter(e=>e.height>0)})():void 0,l=e.getY0?t=>{const n=e.getY0(t);return null==n?o:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),i=Ve(t.data,e.scales,e.getX,e.getY,o,n,t.key,l),c=ut(e.config.gradientFill);c&&(i.fillGradient=c),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),s&&s.length>0&&(i.colorThresholds=s,i.strokeColorBands=a),r.push(i)}return st(e,n,r),r}(i,t);case"mixed":return function(e,t){const n=e.groupData(t),r=[],i=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:o}=nt(e.ribbons);if(o.length>0&&r.push(...rt(e,t,o)),i.length>0)for(const t of n)r.push(...it(e,t.data,t.key,i))}const o=e.scales.y.domain()[0],s=e.getY0?t=>{const n=e.getY0(t);return null==n?o:n}:void 0;for(const t of n)if(i.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),i=Ve(t.data,e.scales,e.getX,e.getY,o,n,t.key,s),a=ut(e.config.gradientFill);a&&(i.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),r.push(i)}else{const n=e.resolveLineStyle(t.key,t.data[0]),i=Ge(t.data,e.scales,e.getX,e.getY,n,t.key);e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),r.push(i)}return st(e,n,r),r}(i,t);case"stackedarea":return function(e,t){const n=e.groupData(t),r=e.config.stackOrder??"key",i=()=>n.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("input"===r);else if("key"===r)i();else if("asc"===r||"desc"===r||"insideOut"===r){const t=new Map;for(const r of n){let n=0;for(const t of r.data){const r=e.getX(t),i=e.getY(t);Number.isFinite(r)&&Number.isFinite(i)&&(n+=i)}t.set(r.key,n)}const i=(e,t)=>t>e?-1:e>t?1:0;if("asc"===r)n.sort((e,n)=>{const r=(t.get(e.key)??0)-(t.get(n.key)??0);return 0!==r?r:i(e.key,n.key)});else if("desc"===r)n.sort((e,n)=>{const r=(t.get(n.key)??0)-(t.get(e.key)??0);return 0!==r?r:i(e.key,n.key)});else{const e=[...n].sort((e,n)=>{const r=(t.get(n.key)??0)-(t.get(e.key)??0);return 0!==r?r:i(e.key,n.key)}),r=[],o=[];let s=0,a=0;for(const n of e)a>s?(r.push(n),s+=t.get(n.key)??0):(o.push(n),a+=t.get(n.key)??0);n.length=0,n.push(...o.reverse(),...r)}}else i();const o=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,s=e.config.normalize?"zero":e.config.baseline??"zero",{nodes:a,stackedTops:l}=function(e,t,n,r,i,o,s,a="zero"){const l=new Set;for(const t of e)for(const e of t.data){const t=n(e);Number.isFinite(t)&&l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const i of t.data){const t=n(i),o=r(i);Number.isFinite(t)&&Number.isFinite(o)&&e.set(t,(e.get(t)||0)+o)}u.set(t.key,e)}let h;if(o){h=new Map;for(const t of c){let n=0;for(const r of e)n+=u.get(r.key)?.get(t)||0;h.set(t,n||1)}}const d=Ue(c,e.map(e=>e.key),(e,t)=>u.get(e)?.get(t)||0,a),f="diverging"===a&&!o,y=[],p=new Map,g=new Map,m=new Map,x=new Map;for(const e of c)g.set(e,d.get(e)??0),m.set(e,0),x.set(e,0);for(const n of e){const e=u.get(n.key),r=new Map;let a=[],l=[];const d=()=>{if(a.length>=2){const e={type:"area",topPath:a,bottomPath:l,style:i(n.key,n.data[0]),datum:n.data,group:n.key};s&&(e.curve=s),y.push(e)}a=[],l=[]};for(const n of c){const i=e.has(n);let s,c,u=i?e.get(n):0;if(o&&i&&(u/=h.get(n)),!i||!Number.isFinite(u)||0===u){d();continue}f?u>0?(s=m.get(n),c=s+u,m.set(n,c)):(s=x.get(n),c=s+u,x.set(n,c)):(s=g.get(n),c=s+u,g.set(n,c));const y=t.x(n);l.push([y,t.y(s)]),a.push([y,t.y(c)]),r.set(n,c)}d(),p.set(n.key,r)}return{nodes:y,stackedTops:p}}(n,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,o,s),c=a;if(e.config.pointStyle){const t=new WeakMap;for(const r of n){const n=l.get(r.key);if(n)for(const i of r.data){const r=e.getX(i),o=e.getY(i);null==r||Number.isNaN(r)||null==o||Number.isNaN(o)||!n.has(r)||t.set(i,n.get(r))}}const r=n=>t.get(n)??e.getY(n);st(e,n,c,r)}return c}(i,t);case"scatter":case"bubble":return function(e,t){const n=[],r="bubble"===e.config.chartType?10:5,i=e.config.sizeRange||[3,15];let o=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const r of n)e>r&&(e=r),r>t&&(t=r);o=n=>e===t?(i[0]+i[1])/2:i[0]+(n-e)/(t-e)*(i[1]-i[0])}}const s=e.getColor?e.resolveColorMap(t):null,a=e.config.themeSemantic?.primary||"#4e79a7",l=e.getSymbol,c=l?function(e,t){const n=new Map;let r=0;return i=>{const o=e(i)+"",s=t?.[o];if(s)return s;let a=n.get(o);return a||(a=ft[r%ft.length],r++,n.set(o,a)),a}}(l,e.config.symbolMap):null;for(const i of t){let t=e.config.pointStyle?e.config.pointStyle(i):{fill:a,opacity:.8},l=t.r||r;if(o&&e.getSize){const t=e.getSize(i);null==t||Number.isNaN(t)||(l=o(t))}if(s&&e.getColor&&!t.fill){const n=e.getColor(i);n&&s.has(n)&&(t={...t,fill:s.get(n)})}const u=e.getPointId?e.getPointId(i)+"":void 0;if(c){const r=c(i),o=Qe(i,e.scales,e.getX,e.getY,Math.PI*l*l,r,t,u);o&&n.push(o)}else{const r=Ke(i,e.scales,e.getX,e.getY,l,t,u);r&&n.push(r)}}return n}(i,t);case"heatmap":return xt(i,t,e);case"bar":{const e=function(e,t){if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const n=vt(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===n.size)return{nodes:[],binBoundaries:[]};let r=null;if(e.getCategory){const t=new Set;for(const e of n.values())for(const n of e.categories.keys())t.add(n);const i=e.config.barColors?Object.keys(e.config.barColors):[],o=new Set(i),s=Array.from(t).filter(e=>!o.has(e)).sort(),a=i.filter(e=>t.has(e)),l=a.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...a,...s],e.barCategoryCache={key:l,order:r})}const i=[],o=e.scales,[s,a]=o.x.domain(),l=e.config.barStyle,c=e.config.themeSemantic?.primary,u=l?.gap,h="number"!=typeof u||0>u?1:u,d={};l?.stroke&&(d.stroke=l.stroke),"number"==typeof l?.strokeWidth&&(d.strokeWidth=l.strokeWidth),"number"==typeof l?.opacity&&(d.opacity=l.opacity);for(const t of n.values()){const n=Math.max(t.start,s),u=Math.min(t.end,a);if(n>=u)continue;const f=o.x(n),y=o.x(u),p=Math.abs(y-f),g=p>h+1?h:0,m=Math.min(f,y)+g/2,x=Math.max(p-g,1);if(x>0)if(r&&t.categories.size>0){let n=0;for(const s of r){const r=t.categories.get(s)||0;if(0===r)continue;const a=o.y(n),u=o.y(n+r);i.push(Ze(m,Math.min(a,u),x,Math.abs(a-u),{fill:e.config.barColors?.[s]||l?.fill||c||"#4e79a7",...d},{binStart:t.start,binEnd:t.end,total:t.total,category:s,categoryValue:r},s)),n+=r}}else{const e=o.y(0),n=o.y(t.total);i.push(Ze(m,Math.min(e,n),x,Math.abs(e-n),{fill:l?.fill||c||"#007bff",...d},{binStart:t.start,binEnd:t.end,total:t.total}))}}const f=new Set;for(const e of n.values())f.add(e.start),f.add(e.end);return{nodes:i,binBoundaries:Array.from(f).sort((e,t)=>e-t)}}(i,t);return this._barCategoryCache=i.barCategoryCache??null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){const n=[],r=e.config.swarmStyle||{},i=r.radius??3,o=r.fill??e.config.themeSemantic?.primary??"#007bff",s=r.opacity??.7,a=r.stroke,l=r.strokeWidth;for(const r of t){const t=e.getX(r),c=e.getY(r);if(null==c||Number.isNaN(c))continue;const u=e.scales.x(t),h=e.scales.y(c);let d=o;if(e.getCategory){const t=e.getCategory(r);d=e.config.barColors?.[t]||d}const{r:f,...y}=e.config.pointStyle?.(r)??{},p={type:"point",x:u,y:h,r:f??i,style:{fill:d,opacity:s,stroke:a,strokeWidth:l,...y},datum:r};e.getPointId&&(p.pointId=e.getPointId(r)+""),n.push(p)}return n}(i,t);case"waterfall":return function(e,t,n){const r=[],i=e.scales,o=e.config.waterfallStyle,s=t.filter(t=>{const n=e.getY(t),r=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=r&&isFinite(r)});if(0===s.length)return r;const a=o?.positiveColor??e.config.themeSemantic?.success??"#28a745",l=o?.negativeColor??e.config.themeSemantic?.danger??"#dc3545",c=o?.gap??1,u=o?.stroke,h=o?.strokeWidth,d=o?.opacity;let f=0;for(let t=0;s.length>t;t++){const y=s[t],p=e.getX(y),g=e.getY(y),m=f+g;let x;x=s.length-1>t?e.getX(s[t+1])-p:t>0?p-e.getX(s[t-1]):0;const v=i.x(p),b=0!==x?i.x(p+x):v+n.width/10,k=Math.min(v,b)+c/2,w=Math.max(v,b)-c/2-k;if(0>=w){f=m;continue}const A=i.y(f),S=i.y(m),_=Math.min(A,S),M=Math.abs(A-S),C={fill:0>g?l:a,stroke:u,strokeWidth:h};null!=d&&(C.opacity=d),r.push(Ze(k,_,w,M,C,{...y,baseline:f,cumEnd:m,delta:g,_connectorStroke:o?.connectorStroke,_connectorWidth:o?.connectorWidth})),f=m}return r}(i,t,e);case"candlestick":return function(e,t,n){if(!e.getHigh||!e.getLow||!e.scales)return[];const r=e.config.candlestickRangeMode??!1;if(!(r||e.getOpen&&e.getClose))return[];const i=[],o=e.config.candlestickStyle||{},s=o.rangeColor||"#6366f1",a=r?s:o.upColor||"#28a745",l=r?s:o.downColor||"#dc3545",c=r?s:o.wickColor||"#333",u=o.wickWidth||(r?2:1),h=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let d=o.bodyWidth??0;if(null==o.bodyWidth)if(h.length>1){let t=1/0;for(let n=1;h.length>n;n++){const r=Math.abs(e.scales.x(h[n])-e.scales.x(h[n-1]));r>0&&t>r&&(t=r)}d=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else d=6;for(const o of t){const t=e.getX(o);if(null==t||Number.isNaN(t))continue;const s=e.getHigh(o),h=e.getLow(o);if(null==s||Number.isNaN(s)||null==h||Number.isNaN(h))continue;const f=r?s:e.getOpen(o),y=r?h:e.getClose(o);if(!r&&[f,y].some(e=>null==e||Number.isNaN(e)))continue;const p=y>=f,g={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(f),closeY:e.scales.y(y),highY:e.scales.y(s),lowY:e.scales.y(h),bodyWidth:d,upColor:a,downColor:l,wickColor:c,wickWidth:u,isUp:p,datum:o};r&&(g.isRange=!0,g.dotRadius=Math.max(2,Math.min(d/2,.12*n.height))),i.push(g)}return i}(i,t,e);default:return[]}}resolveBoundsStyle(e,t){return function(e,t,n,r){const i=e.boundsStyle;return"function"==typeof i?i(n||{},t):i&&"object"==typeof i?i:{fill:r(t,n).stroke||e.themeSemantic?.primary||"#4e79a7",fillOpacity:.2,stroke:"none"}}(this.config,e,t,(e,t)=>this.resolveLineStyle(e,t))}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?Fe(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._ingestVersion)return this._datumIndexCache.map;const t=Be(e);return this._datumIndexCache={version:this._ingestVersion,map:t},t}applyDecay(e,t){this.config.decay&&function(e,t,n,r=Be(n)){const i=n.length;if(i>1)for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const o=Array(t.length);let s=!1;for(let n=0;t.length>n;n++){const a=r.get(t[n]);null!=a?(o[n]=Fe(e,a,i),1>o[n]&&(s=!0)):o[n]=1}s&&(n._decayOpacities=o);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],o=n.topPath?n.topPath.length:t.length;if(2>o)continue;if(t.length===o){const s=Array(o);let a=!1;for(let n=0;t.length>n;n++){const o=r.get(t[n]);null!=o?(s[n]=Fe(e,o,i),1>s[n]&&(a=!0)):s[n]=1}a&&(n._decayOpacities=s)}else{let s=1;for(const n of t){const t=r.get(n);if(null!=t){const n=Fe(e,t,i);s>n&&(s=n)}}if(1>s){const e=Array(o);e.fill(s),n._decayOpacities=e}}continue}const t=r.get(n.datum);if(null==t)continue;const o=Fe(e,t,i);"heatcell"===n.type?n.style={opacity:o}:"candlestick"===n.type?n._decayOpacity=o:n.style={...n.style,opacity:(n.style?.opacity??1)*o}}}(this.config.decay,e,t,this.getDatumIndexMap(t))}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&&function(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const r=e.duration??500,i=t.peek();return null!=i&&r>n-i}(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,n,r){n.clear(),r.clear();for(let i=0;t.length>i;i++){const o=t[i],s=Xe(e,o,i);s&&("point"===o.type?n.set(s,{x:o.x,y:o.y,r:o.r,opacity:qe(o.style)}):"glyph"===o.type?n.set(s,{x:o.x,y:o.y,r:o.size,opacity:qe(o.style),glyph:o.glyph}):"rect"===o.type||"heatcell"===o.type?n.set(s,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:qe(o.style)}):"candlestick"===o.type?n.set(s,{x:o.x,y:o.openY,w:o.bodyWidth,openY:o.openY,closeY:o.closeY,highY:o.highY,lowY:o.lowY,opacity:qe(o.style)}):"line"===o.type?r.set(s,{path:o.path.map(e=>[e[0],e[1]]),opacity:o.style?.opacity}):"area"===o.type&&r.set(s,{topPath:o.topPath.map(e=>[e[0],e[1]]),bottomPath:o.bottomPath.map(e=>[e[0],e[1]]),opacity:o.style?.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){this.prevPositionMap.clear(),this.prevPathMap.clear();const e=this.scales?.y(0)??0;for(let t=0;this.scene.length>t;t++){const n=this.scene[t],r=Xe(this.transitionContext,n,t);r&&("point"===n.type?this.prevPositionMap.set(r,{x:n.x,y:n.y,r:0,opacity:0}):"rect"===n.type?this.prevPositionMap.set(r,{x:n.x,y:e,w:n.w,h:0,opacity:n.style.opacity??1}):"heatcell"===n.type?this.prevPositionMap.set(r,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:0}):"line"===n.type?(n._introClipFraction=0,this.prevPathMap.set(r,{path:n.path.map(e=>[e[0],e[1]]),opacity:n.style.opacity})):"area"===n.type&&(n._introClipFraction=0,this.prevPathMap.set(r,{topPath:n.topPath.map(e=>[e[0],e[1]]),bottomPath:n.bottomPath.map(e=>[e[0],e[1]]),opacity:n.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,n,r,i,o=Le()){if(0===r.size&&0===i.size)return n;const s=t.duration??300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let a=!1;const l=new Set,c=new Set;for(let t=0;n.scene.length>t;t++){const o=n.scene[t],s=Xe(e,o,t);if(!s)continue;if(o._transitionKey=s,"line"===o.type||"area"===o.type){const e=i.get(s);if(e){if(c.add(s),"line"===o.type&&e.path&&e.path.length===o.path.length){o._targetPath=o.path.map(e=>[e[0],e[1]]),o._prevPath=e.path;for(let t=0;o.path.length>t;t++)o.path[t]=[e.path[t][0],e.path[t][1]];a=!0}else if("area"===o.type&&e.topPath&&e.bottomPath&&e.topPath.length===o.topPath.length&&e.bottomPath.length===o.bottomPath.length){o._targetTopPath=o.topPath.map(e=>[e[0],e[1]]),o._targetBottomPath=o.bottomPath.map(e=>[e[0],e[1]]),o._prevTopPath=e.topPath,o._prevBottomPath=e.bottomPath;for(let t=0;o.topPath.length>t;t++)o.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;o.bottomPath.length>t;t++)o.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];a=!0}o._targetOpacity=o.style.opacity??1,o._startOpacity=e.opacity??o.style.opacity??1}else o._targetOpacity=o.style.opacity??1,o._startOpacity=0,o.style={...o.style,opacity:0},a=!0;continue}const u=r.get(s);if("point"===o.type)if(u){l.add(s);const e={x:o.x,y:o.y,r:o.r};o._targetOpacity=qe(o.style),u.x===e.x&&u.y===e.y&&u.r===e.r||(o._targetX=e.x,o._targetY=e.y,o._targetR=e.r,o.x=u.x,o.y=u.y,o.r=u.r??o.r,a=!0)}else o._targetOpacity=qe(o.style),o.style={...o.style,opacity:0},a=!0;else if("glyph"===o.type)if(u){l.add(s);const e={x:o.x,y:o.y,size:o.size};o._targetOpacity=qe(o.style),u.x===e.x&&u.y===e.y&&u.r===e.size||(o._targetX=e.x,o._targetY=e.y,o._targetR=e.size,o.x=u.x,o.y=u.y,o.size=u.r??o.size,a=!0)}else o._targetOpacity=qe(o.style),o.style={...o.style,opacity:0},a=!0;else if("rect"===o.type)if(u){l.add(s);const e={x:o.x,y:o.y,w:o.w,h:o.h};o._targetOpacity=qe(o.style),u.x===e.x&&u.y===e.y&&u.w===e.w&&u.h===e.h||(o._targetX=e.x,o._targetY=e.y,o._targetW=e.w,o._targetH=e.h,o.x=u.x,o.y=u.y,o.w=u.w??o.w,o.h=u.h??o.h,a=!0)}else o._targetOpacity=qe(o.style),o.style={...o.style,opacity:0},a=!0;else if("heatcell"===o.type)if(u){l.add(s);const e={x:o.x,y:o.y,w:o.w,h:o.h};o._targetOpacity=qe(o.style),u.x===e.x&&u.y===e.y&&u.w===e.w&&u.h===e.h||(o._targetX=e.x,o._targetY=e.y,o._targetW=e.w,o._targetH=e.h,o.x=u.x,o.y=u.y,o.w=u.w??o.w,o.h=u.h??o.h,a=!0)}else o._targetOpacity=qe(o.style),o.style={...o.style||{},opacity:0},a=!0;else if("candlestick"===o.type)if(u&&null!=u.openY){l.add(s);const e={x:o.x,openY:o.openY,closeY:o.closeY,highY:o.highY,lowY:o.lowY};o._targetOpacity=qe(o.style),(u.x!==e.x||u.openY!==e.openY||u.closeY!==e.closeY||u.highY!==e.highY||u.lowY!==e.lowY)&&(o._targetX=e.x,o._targetOpenY=e.openY,o._targetCloseY=e.closeY,o._targetHighY=e.highY,o._targetLowY=e.lowY,o.x=u.x,o.openY=u.openY,o.closeY=u.closeY??o.closeY,o.highY=u.highY??o.highY,o.lowY=u.lowY??o.lowY,a=!0)}else o._targetOpacity=qe(o.style),o.style={...o.style||{},opacity:0},a=!0}for(const[e,t]of i)if(!c.has(e))if(e.startsWith("l:")&&t.path){const r={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(r),a=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const r={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(r),a=!0}for(const[e,t]of r)if(!l.has(e)){if(e.startsWith("p:"))n.exitNodes.push({type:"point",x:t.x,y:t.y,r:t.r??3,style:{opacity:t.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("g:")&&t.glyph)n.exitNodes.push({type:"glyph",x:t.x,y:t.y,size:t.r??12,glyph:t.glyph,color:"#999",accent:"#999",style:{opacity:t.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))n.exitNodes.push({type:"rect",x:t.x,y:t.y,w:t.w??0,h:t.h??0,style:{opacity:t.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("h:"))n.exitNodes.push({type:"heatcell",x:t.x,y:t.y,w:t.w??0,h:t.h??0,fill:"#999",datum:null,style:{opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e});else if(e.startsWith("c:")){const r=t.openY??t.y;n.exitNodes.push({type:"candlestick",x:t.x,openY:r,closeY:t.closeY??r,highY:t.highY??r,lowY:t.lowY??r,bodyWidth:t.w??6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e})}a=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),a&&(n.activeTransition={startTime:o,duration:s}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap,this.currentTime());this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(e,t,n,r){if(!n.activeTransition)return!1;const i=Te(e,n.activeTransition),o=je(i,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?r.get(t):void 0;e.style.opacity=De(n?n.opacity??1:0,e._targetOpacity,o)}if(void 0===e._targetX)continue;if(!t)continue;const n=r.get(t);if(!n)continue;e.x=De(n.x,e._targetX,o),e.y=De(n.y,e._targetY,o),void 0!==e._targetR&&void 0!==n.r&&(e.r=De(n.r,e._targetR,o))}else if("glyph"===e.type){if(void 0!==e._targetOpacity){const n=t?r.get(t):void 0;e.style.opacity=De(n?n.opacity??1:0,e._targetOpacity,o)}if(void 0===e._targetX)continue;if(!t)continue;const n=r.get(t);if(!n)continue;e.x=De(n.x,e._targetX,o),e.y=De(n.y,e._targetY,o),void 0!==e._targetR&&void 0!==n.r&&(e.size=De(n.r,e._targetR,o))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?r.get(t):void 0;e.style.opacity=De(n?n.opacity??1:0,e._targetOpacity,o)}if(void 0===e._targetX)continue;if(!t)continue;const n=r.get(t);if(!n)continue;e.x=De(n.x,e._targetX,o),e.y=De(n.y,e._targetY,o),void 0!==n.w&&(e.w=De(n.w,e._targetW,o)),void 0!==n.h&&(e.h=De(n.h,e._targetH,o))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?r.get(t):void 0;e.style={...e.style||{},opacity:De(n?n.opacity??1:0,e._targetOpacity,o)}}if(void 0===e._targetX)continue;if(!t)continue;const n=r.get(t);if(!n)continue;e.x=De(n.x,e._targetX,o),e.y=De(n.y,e._targetY,o),void 0!==n.w&&(e.w=De(n.w,e._targetW,o)),void 0!==n.h&&(e.h=De(n.h,e._targetH,o))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const n=t?r.get(t):void 0;e.style={...e.style||{},opacity:De(n?n.opacity??1:0,e._targetOpacity,o)}}if(void 0===e._targetX)continue;if(!t)continue;const n=r.get(t);if(!n)continue;e.x=De(n.x,e._targetX,o),void 0!==n.openY&&(e.openY=De(n.openY,e._targetOpenY,o)),void 0!==n.closeY&&(e.closeY=De(n.closeY,e._targetCloseY,o)),void 0!==n.highY&&(e.highY=De(n.highY,e._targetHighY,o)),void 0!==n.lowY&&(e.lowY=De(n.lowY,e._targetLowY,o))}else if("line"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:De(e._startOpacity??0,e._targetOpacity,o)}),void 0!==e._introClipFraction&&(e._introClipFraction=o);const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let r=0;e.path.length>r;r++)e.path[r][0]=De(t[r][0],n[r][0],o),e.path[r][1]=De(t[r][1],n[r][1],o)}else if("area"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:De(e._startOpacity??0,e._targetOpacity,o)}),void 0!==e._introClipFraction&&(e._introClipFraction=o);const t=e._prevTopPath,n=e._prevBottomPath,r=e._targetTopPath,i=e._targetBottomPath;if(t&&r&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=De(t[n][0],r[n][0],o),e.topPath[n][1]=De(t[n][1],r[n][1],o);if(n&&i&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=De(n[t][0],i[t][0],o),e.bottomPath[t][1]=De(n[t][1],i[t][1],o)}}if(i>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style="line"===e.type||"area"===e.type?{...e.style,opacity:0===t?0:t}:{...e.style||{},opacity:0===t?0:t},e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("glyph"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.size=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null,function(e){for(const t of e){if(void 0!==t._targetOpacity){const e=t._targetOpacity;t.style={...t.style||{},opacity:0===e?0:e},t._targetOpacity=void 0}if("point"===t.type)void 0!==t._targetX&&(t.x=t._targetX,t.y=t._targetY,void 0!==t._targetR&&(t.r=t._targetR),t._targetX=void 0,t._targetY=void 0,t._targetR=void 0);else if("glyph"===t.type)void 0!==t._targetX&&(t.x=t._targetX,t.y=t._targetY,void 0!==t._targetR&&(t.size=t._targetR),t._targetX=void 0,t._targetY=void 0,t._targetR=void 0);else if("rect"===t.type||"heatcell"===t.type)void 0!==t._targetX&&(t.x=t._targetX,t.y=t._targetY,t.w=t._targetW,t.h=t._targetH,t._targetX=void 0,t._targetY=void 0,t._targetW=void 0,t._targetH=void 0);else if("candlestick"===t.type)void 0!==t._targetX&&(t.x=t._targetX,void 0!==t._targetOpenY&&(t.openY=t._targetOpenY),void 0!==t._targetCloseY&&(t.closeY=t._targetCloseY),void 0!==t._targetHighY&&(t.highY=t._targetHighY),void 0!==t._targetLowY&&(t.lowY=t._targetLowY),t._targetX=void 0,t._targetOpenY=void 0,t._targetCloseY=void 0,t._targetHighY=void 0,t._targetLowY=void 0);else if("line"===t.type||"area"===t.type){if(t._introClipFraction=void 0,"line"===t.type&&t._targetPath){for(let e=0;t.path.length>e;e++)t.path[e]=t._targetPath[e];t._prevPath=void 0,t._targetPath=void 0}if("area"===t.type){if(t._targetTopPath)for(let e=0;t.topPath.length>e;e++)t.topPath[e]=t._targetTopPath[e];if(t._targetBottomPath)for(let e=0;t.bottomPath.length>e;e++)t.bottomPath[e]=t._targetBottomPath[e];t._prevTopPath=void 0,t._prevBottomPath=void 0,t._targetTopPath=void 0,t._targetBottomPath=void 0}}}}(this.scene),this.exitNodes=[]}groupData(e){const{result:t,cache:n}=function(e,t,n,r){if(r&&r.version===n&&r.group===t&&r.data===e)return{result:r.result,cache:r};let i;if(t){const n=new Map;for(const r of e){const e=t(r);n.has(e)||n.set(e,[]),n.get(e).push(r)}i=Array.from(n.entries()).map(([e,t])=>({key:e,data:t}))}else i=[{key:"_default",data:e}];return{result:i,cache:{version:n,group:t,data:e,result:i}}}(e,this.getGroup,this._ingestVersion,this._groupDataCache);return this._groupDataCache=n,t}resolveColorMap(e){const{map:t,cache:n}=function(e,t,n,r,i){if(i&&i.version===r)return{map:i.map,cache:i};const o=new Set;if(t)for(const n of e){const e=t(n);e&&o.add(e)}const s=Array.from(o).sort(),a=s.join("\0");if(i&&i.key===a){const e={...i,version:r};return{map:e.map,cache:e}}const l=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical||Me,c=new Map;for(let e=0;s.length>e;e++)c.set(s[e],l[e%l.length]);return{map:c,cache:{key:a,map:c,version:r}}}(e,this.getColor,this.config,this._ingestVersion,this._colorMapCache);return this._colorMapCache=n,t}resolveLineStyle(e,t){return function(e,t,n,r){const i=e.lineStyle;if("function"==typeof i){const e=i(n||{},t);if(e&&!e.stroke&&t){const n=r(t);if(n)return{...e,stroke:n}}return e}const o=e.themeSemantic?.primary;return i&&"object"==typeof i?{stroke:i.stroke||o||"#007bff",strokeWidth:i.strokeWidth||2,strokeDasharray:i.strokeDasharray,fill:i.fill,fillOpacity:i.fillOpacity,opacity:i.opacity}:{stroke:r(t)||o||"#007bff",strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveAreaStyle(e,t){return function(e,t,n,r){if(e.areaStyle){const i=e.areaStyle(n||{});if(i&&!i.fill&&t){const e=r(t);if(e)return{...i,fill:e,stroke:i.stroke||e}}return i}const i=e.lineStyle;if("function"==typeof i){const e=i(n||{},t);if(e&&!e.fill&&t){const n=r(t);if(n)return{...e,fill:n,stroke:e.stroke||n}}return e}const o=e.themeSemantic?.primary;if(i&&"object"==typeof i)return{fill:i.fill||i.stroke||o||"#4e79a7",fillOpacity:i.fillOpacity??.7,stroke:i.stroke||o||"#4e79a7",strokeWidth:i.strokeWidth||2};const s=r(t)||o||"#4e79a7";return{fill:s,fillOpacity:.7,stroke:s,strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveGroupColor(t){const{color:n,groupColorCounter:r}=function(e){const{group:t,colorMapCache:n,groupColorMap:r,groupColorMapCap:i,config:o}=e;let{groupColorCounter:s}=e;if(n){const e=n.map.get(t);if(e)return{color:e,groupColorCounter:s}}const a=r.get(t);if(a)return{color:a,groupColorCounter:s};const l=(Array.isArray(o.colorScheme)&&o.colorScheme.length>0?o.colorScheme:null)||(Array.isArray(o.themeCategorical)&&o.themeCategorical.length>0?o.themeCategorical:null)||Me;if(0===l.length)return{color:null,groupColorCounter:s};const c=l[s%l.length];if(s++,r.set(t,c),r.size>i){const e=r.keys().next().value;void 0!==e&&r.delete(e)}return{color:c,groupColorCounter:s}}({group:t,colorMapCache:this._colorMapCache,groupColorMap:this._groupColorMap,groupColorCounter:this._groupColorCounter,groupColorMapCap:e.GROUP_COLOR_MAP_CAP,config:this.config});return this._groupColorCounter=r,n}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=se(e),n=this.getPointId,r=e=>t.has(n(e));!function(e,t,n){if(!t||0===t.size)return;const r=new Set;if(e.forEach((e,t)=>{n(e)&&r.add(t)}),0===r.size)return;const i=t.toArray();t.clear();for(let e=0;i.length>e;e++)r.has(e)||t.push(i[e])}(this.buffer,this.timestampBuffer,r);const i=this.buffer.remove(r);if(0===i.length)return this.updateResults.recordNoop("remove"),i;for(const e of i)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",i.length),i}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=se(e),r=this.getPointId,i=new Set;this.buffer.forEach((e,t)=>{n.has(r(e))&&i.add(t)});const o=this.buffer.update(e=>n.has(r(e)),t);if(0===o.length)return this.updateResults.recordNoop("update"),o;for(const e of o)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.buffer.forEach((e,t)=>{i.has(t)&&(this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",o.length),o}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this._datumIndexCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.spatialIndex.clear(),this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}applyCustomRestyle(e,t){const n=this._customRestyle;if(n)for(const r of e){const e=this._baseStyles.get(r)??r.style??{},i=n(r,t);r.style=i?{...e,...i}:e}}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this.markStylePaintPending(),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}updateConfig(e){const t={...this.config},n=Object.keys(e).filter(n=>e[n]!==t[n]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in e&&e.windowSize!==t.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${t.windowSize} → ${e.windowSize}) but it is a mount-only setting — the ring buffer keeps its original capacity. Remount the chart (e.g. via a React key) to apply a new windowSize.`)),("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"band"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let r=!1,i=!1;Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();const o="chartType"in e&&e.chartType!==t.chartType||"runtimeMode"in e&&e.runtimeMode!==t.runtimeMode;if(o||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const e=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode,n=e&&this.config.valueAccessor||this.config.yAccessor,s=e&&t.valueAccessor||t.yAccessor,a=o||!Q(e&&this.config.timeAccessor||this.config.xAccessor,e&&t.timeAccessor||t.xAccessor),l=o||!Q(n,s);(a||l)&&(e?(this.getX=Z(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=Z(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=Z(this.config.xAccessor,"x"),this.getY=Z(this.config.yAccessor,"y")),l&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=_t(this.config)),r=!0,i=!0)}if("groupAccessor"in e&&!Q(e.groupAccessor,t.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?ee(this.config.groupAccessor):void 0,r=!0),"categoryAccessor"in e&&!Q(e.categoryAccessor,t.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?ee(this.config.categoryAccessor):void 0,r=!0),"sizeAccessor"in e&&!Q(e.sizeAccessor,t.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?Z(this.config.sizeAccessor,"size"):void 0,r=!0),"symbolAccessor"in e&&!Q(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?ee(this.config.symbolAccessor):void 0,r=!0),"colorAccessor"in e&&!Q(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?ee(this.config.colorAccessor):void 0,r=!0),"y0Accessor"in e&&!Q(e.y0Accessor,t.y0Accessor)&&(this.getY0=this.config.y0Accessor?Z(this.config.y0Accessor,"y0"):void 0,r=!0,i=!0),("boundsAccessor"in e&&!Q(e.boundsAccessor,t.boundsAccessor)||"band"in e&&e.band!==t.band||"boundsStyle"in e&&e.boundsStyle!==t.boundsStyle)&&(this.resolvedRibbons=_t(this.config),r=!0,i=!0),"pointIdAccessor"in e&&!Q(e.pointIdAccessor,t.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?ee(this.config.pointIdAccessor):void 0,r=!0),"candlestick"===this.config.chartType&&(o||"openAccessor"in e&&!Q(e.openAccessor,t.openAccessor)||"closeAccessor"in e&&!Q(e.closeAccessor,t.closeAccessor)||"highAccessor"in e&&!Q(e.highAccessor,t.highAccessor)||"lowAccessor"in e&&!Q(e.lowAccessor,t.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?Z(this.config.openAccessor,"open"):void 0,this.getHigh=Z(this.config.highAccessor,"high"),this.getLow=Z(this.config.lowAccessor,"low"),this.getClose=t?Z(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,r=!0,i=!0}if("accessorRevision"in e&&e.accessorRevision!==t.accessorRevision&&(r=!0,i=!0),!r){const n=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const i of n)if(e[i]!==t[i]){r=!0;break}}r&&(i&&this.rebuildExtents(),this.needsFullRebuild=!0),this.updateResults.recordConfig(n)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};rn.GROUP_COLOR_MAP_CAP=1e3;var on=rn;Wt(on);var sn=require("react"),an={sceneGeometry:0,layout:0,domain:0};function ln(e){const{domain:t,layout:n,sceneGeometry:r}=e.revisions;return{domain:t,layout:n,sceneGeometry:r}}function cn(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}var un="production"!==process.env.NODE_ENV,hn={revisions:an,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},dn=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=an,this.lastObserved=an,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){un&&(this.lastObserved=cn(this.lastObserved,ln(e)))}beforeCompute(e,t){if(!un)return hn;const n=cn(ln(e),this.lastObserved),r=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),i=!((o=n).sceneGeometry===(s=this.lastConsumed).sceneGeometry&&o.layout===s.layout&&o.domain===s.domain);var o,s;return{revisions:n,signature:r,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:i,warnUnconsumed:!t&&i&&this.lastUnconsumedWarning!==r}}afterCompute(e,t,n){if(un){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}};function fn(e){return(0,sn.useRef)(new dn(e))}var yn=(0,sn.memo)(function({store:e,diagnostics:t}){return(0,sn.useEffect)(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null}),pn=p(require("react"));function gn(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:pn.createElement(pn.Fragment,null,...t)}var mn=p(require("react")),xn=require("react/jsx-runtime"),vn=mn.createContext(null);function bn({value:e,children:t}){return(0,xn.jsx)(vn.Provider,{value:e,children:t})}function kn(e,t){return null!=e?(0,xn.jsx)(bn,{value:t,children:e}):e}var wn=require("react");function An(e,t,n,r){(0,wn.useEffect)(()=>{e.current?.updateConfig(t),n.current=!0,r()},[t,r,e,n])}function Sn(e,t,n,r){const i=(0,wn.useRef)(null);(0,wn.useEffect)(()=>{const o=e.current;if(!o)return;const s=t??null;i.current!==s&&(i.current=s,o.setLayoutSelection(s),o.hasCustomRestyle?o.restyleScene(s):n.current=!0,r())},[t,r,e,n])}function _n(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}function Mn(e,t=30){return Math.max((e??4)+5,12,t)}function Cn(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Pn(e,t){const n=Cn(e);if(!n)return!1;const r=Cn(t);return!r||n.getFullYear()!==r.getFullYear()||n.getMonth()!==r.getMonth()}function Rn(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}var jn=[40,40],Tn=[.5,.5];function Dn(e,t){const[n,r]=e.viewBox??jn,[i,o]=e.anchor??Tn,s=r>0?r:1,a=Math.max(0,t)/s,l=(n>0?n:s)*a,c=s*a;return{width:l,height:c,scale:a,offsetX:-i*l,offsetY:-o*c}}function Ln(e,t,n,r){if("none"!==e)return"color"===e||null==e?t??r:"accent"===e?n:e}var En=null;function Nn(e){if("undefined"==typeof Path2D)return null;En||(En=new Map);const t=En.get(e);if(t)return t;const n=new Path2D(e);return En.size>1024&&En.clear(),En.set(e,n),n}function In(e,t,n=0,r="horizontal"){const[i,o]=e.viewBox??jn,s=Math.min(1,Math.max(0,n)),a=Math.min(1,Math.max(0,t));return a>s?s>0||1>a?"vertical"===r?{x:0,y:o*(1-a),width:i,height:o*(a-s)}:{x:i*s,y:0,width:i*(a-s),height:o}:null:{x:0,y:0,width:0,height:0}}function Wn(e,t){const n=Dn(e,t);return{centerDx:n.offsetX+n.width/2,centerDy:n.offsetY+n.height/2,halfWidth:n.width/2,halfHeight:n.height/2,radius:Math.hypot(n.width,n.height)/2}}function $n(e,t,n,r,i,o=e=>e){for(const s of t.parts){const t=Nn(s.d);if(!t)continue;const a=s.opacity??1,l=e.globalAlpha;1!==a&&(e.globalAlpha=l*a);const c=i?"none"===s.fill?void 0:i:Ln(s.fill,n,r);c&&(e.fillStyle=o(c),e.fill(t));const u=i?s.stroke&&"none"!==s.stroke?i:void 0:Ln(s.stroke??"none",n,r);u&&(e.strokeStyle=o(u),e.lineWidth=s.strokeWidth??1,e.lineCap=s.strokeLinecap??"butt",e.lineJoin=s.strokeLinejoin??"miter",e.stroke(t)),1!==a&&(e.globalAlpha=l)}}function zn(e,t,n,r,i,o=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(r,i+5,12),c=t-l,u=t+l,h=n-l,d=n+l;let f=null,y=1/0;return e.visit((e,i,l,p,g)=>{if(i>u||c>p||l>d||h>g)return!0;if(!e.length){let i=e;do{const e=i.data,l=o(e)-t,c=s(e)-n,u=Math.sqrt(l*l+c*c);Mn(a(e),r)>=u&&y>u&&(f=e,y=u),i=i.next}while(i)}return!1}),f?{node:f,distance:y}:null}var On=new WeakMap,Fn=0,Bn=!1,Yn=null,Hn=null;function Xn(e,t){if(!t)return t;const n=function(e){const t=e.trim();if(!t.startsWith("var(")||!t.endsWith(")"))return null;const n=t.slice(4,-1),r=n.indexOf(",");if(-1===r){const e=n.trim();return e.startsWith("--")?{name:e}:null}const i=n.slice(0,r).trim(),o=n.slice(r+1).trim();return i.startsWith("--")?{name:i,fallback:o||void 0}:null}(t);if(!n)return t;const r=()=>n.fallback?Xn(e,n.fallback):t,i=e.canvas;if(!i)return r();!function(){if(Bn)return;if("undefined"==typeof window||"undefined"==typeof document)return;Bn=!0;const e=()=>{Fn++};if("undefined"!=typeof MutationObserver&&document.documentElement&&new MutationObserver(e).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"],subtree:!0}),"function"==typeof window.matchMedia)try{Yn=window.matchMedia("(prefers-color-scheme: dark)"),Hn=e,"function"==typeof Yn.addEventListener?Yn.addEventListener("change",Hn):"function"==typeof Yn.addListener&&Yn.addListener(Hn)}catch{}}();let o=On.get(i);o&&o.version===Fn||(o={version:Fn,map:new Map},On.set(i,o));const s=o.map.get(t);if(void 0!==s)return s;const a=getComputedStyle(i).getPropertyValue(n.name).trim()||r()||t;return o.map.set(t,a),a}function qn(e){return{type:"hatch",background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle}}var Gn=null;var Vn=require("react/jsx-runtime");function Un(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function Kn(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}var Qn=new Map;function Zn(e,t){const{background:n="transparent",stroke:r="#000",lineWidth:i=1.5,spacing:o=6,angle:s=45,lineOpacity:a=1}=e,l=Math.max(8,Math.ceil(2*o));return(0,Vn.jsxs)("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==s?`rotate(${s})`:void 0,children:[n&&"transparent"!==n&&(0,Vn.jsx)("rect",{width:l,height:l,fill:n}),(0,Vn.jsx)("line",{x1:0,y1:0,x2:0,y2:l,stroke:r,strokeWidth:i,strokeOpacity:a}),(0,Vn.jsx)("line",{x1:o,y1:0,x2:o,y2:l,stroke:r,strokeWidth:i,strokeOpacity:a})]},t)}function Jn(e,t,n="#4e79a7"){if(Un(e)){const n=function(e,t){let n=2166136261;const r=Kn(t);for(let e=0;r.length>e;e++)n^=r.charCodeAt(e),n=Math.imul(n,16777619);return`${e}-hatch-${(n>>>0).toString(36)}`}(t,e);return{fill:`url(#${n})`,def:Zn(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}var er=require("d3-shape");function tr(e){switch(e){case"monotoneX":return er.curveMonotoneX;case"monotoneY":return er.curveMonotoneY;case"cardinal":return er.curveCardinal;case"catmullRom":return er.curveCatmullRom;case"step":return er.curveStep;case"stepBefore":return er.curveStepBefore;case"stepAfter":return er.curveStepAfter;case"basis":return er.curveBasis;case"natural":return er.curveNatural;default:return null}}function nr(e,t,n){if(null==t)return n;if(Un(t)){const r=function(e,t){const n=e.background??"transparent",r=e.stroke??"#000",i="transparent"===n||"none"===n?n:Xn(t,n)||n,o=Xn(t,r)||r||"#000",s="undefined"!=typeof window&&window.devicePixelRatio||1,a=`${Kn(e)}|${i}|${o}@${s}`,l=Qn.get(a);if(void 0!==l)return l;const c=function(e={},t){const{background:n="transparent",stroke:r="#000",lineWidth:i=1.5,spacing:o=6,angle:s=45}=e,a={background:n,stroke:r,lineWidth:i,spacing:o,angle:s},l=Math.max(8,Math.ceil(2*o));let c;try{c=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Gn||(Gn=document.createElement("canvas")),Gn.width=e,Gn.height=e,Gn)}(l)}catch{return qn(a)}const u=c.getContext("2d");if(!u)return qn(a);n&&"transparent"!==n?(u.fillStyle=n,u.fillRect(0,0,l,l)):u.clearRect(0,0,l,l),u.strokeStyle=r,u.lineWidth=i,u.lineCap="square";const h=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-l;2*l>=t;t+=o)u.beginPath(),u.moveTo(t,0),u.lineTo(t+e*l,l),u.stroke()}else{u.save(),u.translate(l/2,l/2),u.rotate(h);const e=2*l;for(let t=-e;e>=t;t+=o)u.beginPath(),u.moveTo(-e,t),u.lineTo(e,t),u.stroke();u.restore()}return(t||u).createPattern(c,"repeat")}({background:i,stroke:o,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t),u=Un(c)?null:c;return Qn.set(a,u),u}(t,e);return r||t.background&&Xn(e,t.background)||n}return"string"!=typeof t?t:Xn(e,t)||n}function rr(e,t,n,r,i,o,s){const a=t.stops.filter(e=>Number.isFinite(e.offset)&&(null==e.opacity||Number.isFinite(e.opacity)));if(2>a.length)return null;const l=e.createLinearGradient(r,i,o,s);for(const t of a)l.addColorStop(Math.max(0,Math.min(1,t.offset)),ir(e,t,n));return l}function ir(e,t,n){const r=t.color??n,i=Xn(e,r)||r;if(null==t.opacity)return i;const o=Math.max(0,Math.min(1,t.opacity)),[s,a,l]=function(e,t){const n=e.fillStyle,r="#010203";try{e.fillStyle=r,e.fillStyle=t}catch{return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===r&&t.trim().toLowerCase()!==r)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const o=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return o?[+o[1],+o[2],+o[3]]:[78,121,167]}(e,i);return`rgba(${s},${a},${l},${o})`}function or(e,t,n,r){t.fill&&(e.fillStyle=nr(e,t.fill,n),void 0!==t.fillOpacity&&(e.globalAlpha=(t.opacity??1)*t.fillOpacity),r())}function sr(e,t,n){t.stroke&&"none"!==t.stroke&&(e.strokeStyle=Xn(e,t.stroke)||t.stroke,e.lineWidth=t.strokeWidth??1,e.globalAlpha=(t.opacity??1)*(t.strokeOpacity??1),n())}var ar=require("d3-shape"),lr=new WeakMap;function cr(e,t){const n=tr(t);if(!n)return e;const r=lr.get(e);if(r)return r;const i=function(e,t,n=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const r=[];let i=null;const o={moveTo(e,t){i=[e,t],r.push([e,t])},lineTo(e,t){i=[e,t],r.push([e,t])},bezierCurveTo(e,t,o,s,a,l){if(!i)return i=[a,l],void r.push([a,l]);const[c,u]=i;for(let i=1;n>=i;i++){const h=i/n,d=1-h;r.push([d*d*d*c+3*d*d*h*e+3*d*h*h*o+h*h*h*a,d*d*d*u+3*d*d*h*t+3*d*h*h*s+h*h*h*l])}i=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,n,o){i=[n,o],r.push([n,o])}};return(0,ar.line)().x(e=>e[0]).y(e=>e[1]).curve(t).context(o)(e),r}(e,n);return lr.set(e,i),i}function ur(e,t,n,r=30,i,o=0){let s=null;if(i){const e=zn(i,t,n,r,o);e&&(s={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const o of e){let e=null;switch(o.type){case"point":if(i)break;e=dr(o,t,n,r);break;case"symbol":e=fr(o,t,n,r);break;case"glyph":e=yr(o,t,n,r);break;case"line":e=pr(o,t,n,r);break;case"rect":if(null==o.datum)break;e=mr(o,t,n);break;case"heatcell":e=xr(o,t,n);break;case"area":if(!1===o.interactive)break;e=br(o,t,n);break;case"candlestick":e=vr(o,t,n)}e&&r>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function hr(e,t,n){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const r=kr(e,t);if(0>r)return null;if(Math.abs(e[r][0]-t)>n)return null;let i=r,o=r;r>0&&e[r][0]>=t?(i=r-1,o=r):e.length-1>r&&(i=r,o=r+1);const[s,a]=e[i],[l,c]=e[o];return l===s?a:a+Math.max(0,Math.min(1,(t-s)/(l-s)))*(c-a)}function dr(e,t,n,r=30){const i=t-e.x,o=n-e.y,s=Math.sqrt(i*i+o*o);return s>Mn(e.r,r)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function fr(e,t,n,r=30){const i=t-e.x,o=n-e.y,s=Math.sqrt(i*i+o*o);return s>Mn(pt(e.size),r)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function yr(e,t,n,r=30){if(null==e.datum)return null;const i=Wn(e.glyph,e.size),o=e.x+i.centerDx,s=e.y+i.centerDy,a=t-o,l=n-s,c=Math.sqrt(a*a+l*l);return c>Mn(i.radius,r)?null:{node:e,datum:e.datum,x:o,y:s,distance:c}}function pr(e,t,n,r=30){if(0===e.path.length)return null;const i=kr(e.path,t);if(0>i)return null;const[o,s]=e.path[i];let a;if(e.path.length>1){let r=1/0;const o=Math.max(0,i-1),s=Math.min(e.path.length-2,i);for(let i=o;s>=i;i++){const[o,s]=e.path[i],[a,l]=e.path[i+1],c=gr(t,n,o,s,a,l);r>c&&(r=c)}a=r}else{const e=t-o,r=n-s;a=Math.sqrt(e*e+r*r)}const l=e.style;return a>Math.max(5,(l.strokeWidth??l.lineWidth??1)/2+2,r)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[i]?e.datum[i]:e.datum,x:o,y:s,distance:a}}function gr(e,t,n,r,i,o){const s=i-n,a=o-r,l=s*s+a*a;if(0===l)return Math.sqrt((e-n)**2+(t-r)**2);let c=((e-n)*s+(t-r)*a)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(n+c*s))**2+(t-(r+c*a))**2)}function mr(e,t,n){const r=_n(t,n,e);return r.hit?{node:e,datum:e.datum,x:r.cx,y:r.cy,distance:0}:null}function xr(e,t,n){const r=_n(t,n,e);return r.hit?{node:e,datum:e.datum,x:r.cx,y:r.cy,distance:0}:null}function vr(e,t,n){const r=e.bodyWidth/2,i=Math.min(e.openY,e.closeY);if(!(e.x-r-3>t||t>e.x+r+3||e.highY-3>n||n>e.lowY+3)){const r=i+Math.max(Math.max(e.openY,e.closeY)-i,1)/2,o=t-e.x,s=n-r;return{node:e,datum:e.datum,x:e.x,y:r,distance:Math.sqrt(o*o+s*s)}}return null}function br(e,t,n){if(0===e.topPath.length)return null;const r=kr(e.topPath,t);if(0>r)return null;const[i,o]=e.topPath[r],s=t-i,a=n-o,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[r]?e.datum[r]:e.datum,x:i,y:o,distance:l}}function kr(e,t){if(0===e.length)return-1;let n=0,r=e.length-1;for(;r>n;){const i=n+r>>1;t>e[i][0]?n=i+1:r=i}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}var wr=require("react"),Ar={fresh:1,aging:.7,stale:.45,expired:.25},Sr={alpha:1,band:"fresh",isStale:!1};function _r(e,t){if(!e||0>=t)return Sr;const n=null!=e.threshold&&e.threshold>0?e.threshold:5e3,r=e.graded;if(r){const e="object"==typeof r?r:{},i=Ne(t,n,e.thresholds);return{alpha:{...Ar,...e.opacities??{}}[i],band:i,isStale:"fresh"!==i}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:Sr}function Mr(e,t,n,r,i,o){const s=(0,wr.useRef)("fresh");(0,wr.useEffect)(()=>{if(!e)return;const a=setInterval(()=>{const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=_r(e,l-a.lastIngestTime);c.band===s.current&&c.isStale===i||(s.current=c.band,c.isStale!==i&&o(c.isStale),n.current=!0,r())},1e3);return()=>clearInterval(a)},[e,i,r,t,o,n])}var Cr=require("react/jsx-runtime");function Pr({isStale:e,position:t}){return(0,Cr.jsx)("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}var Rr=require("react"),jr=p(require("react"));function Tr(e){return"object"==typeof e&&null!==e&&"legendGroups"in e&&Array.isArray(e.legendGroups)}function Dr(e){return"object"==typeof e&&null!==e&&"gradient"in e}function Lr(e){return Math.ceil(7*e.length)}function Er(e,t){if(Tr(e)){const n=zr(t),r=e.legendGroups.flatMap(e=>[e.label?Lr(e.label):0,...e.items.map(e=>n.swatchSize+n.labelGap+Lr(e.label))]);return Math.max(100,...r)}if(Dr(e)){const{gradient:t}=e,n=t.format||(e=>Math.round(100*e)/100+""),r=Math.max(Lr(n(t.domain[0])),Lr(n(t.domain[1]))),i=t.label?Lr(t.label):0;return Math.max(100,19+r,i)}return 100}function Nr(e){return(Tr(e)||Dr(e))&&Number.isFinite(e.legendDistance)?Math.max(0,e.legendDistance):10}function Ir(e){return Math.max(0,e?.sideGutter??0)}function Wr(e,t){return null!=t?.axisGutter?Math.max(0,t.axisGutter):e?.hasAxis?e.hasAxisLabel?e.rotatedTicks?64:46:22:0}function $r(e,t,n){if(Dr(e))return e.gradient.label?34:26;if(!Tr(e))return 20;const r=zr(n),i=Math.max(1,n?.maxWidth??t);let o=r.rowHeight;for(const t of e.legendGroups){let e=0,n=0;for(const o of t.items){const t=r.swatchSize+r.labelGap+Lr(o.label),s=0===n?t:n+r.itemGap+t;n>0&&s>i?(e+=1,n=t):n=s}t.items.length>0&&(e+=1),o=Math.max(o,e*r.rowHeight,t.label?Lr(t.label):0)}return o+(e.legendGroups.length>1?16:0)}function zr(e){const t=Math.max(1,e?.swatchSize??16),n=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}var Or=require("react/jsx-runtime"),Fr={fill:(e,t)=>(0,Or.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,Or.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function Br(e,t,n,r,i){let o;return o="function"==typeof n?n(e):(0,Fr[n])(r(e,t),i),o}function Yr({swatchSize:e}){return(0,Or.jsx)("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Hr(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var Xr=(e,t,n,r,i,o,s,a,l,c,u)=>{const{type:h="fill",styleFn:d,items:f}=e,y=[];let p=0;const g=!(!t&&!n),m="isolate"===c||void 0===c&&null!=i,{swatchSize:x,labelGap:v,rowHeight:b}=u;return f.forEach((e,c)=>{const u=Br(e,c,h,d,x),k=Hr(e,r,i),w=i&&i.size>0&&i.has(e.label);y.push((0,Or.jsxs)("g",{transform:`translate(0,${p})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:g?a===o&&c===s?0:-1:void 0,role:g?"option":void 0,"aria-selected":g&&m?w||!1:void 0,"aria-current":g&&!m&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:g?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:g?t=>{l(a,c),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:g?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:g?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[g&&(0,Or.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+v+2+7*e.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,w&&(0,Or.jsx)(Yr,{swatchSize:x}),(0,Or.jsx)("text",{y:x/2,x:x+v,dominantBaseline:"central",fontSize:12,style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),p+=b}),y};function qr({config:e,orientation:t="vertical",width:n=100}){const{colorFn:r,domain:i,label:o,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+jr.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),s=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Or.jsx)("stop",{offset:100*t+"%",stopColor:r(i[0]+t*(i[1]-i[0]))},e))}return(0,Or.jsxs)("g",{"aria-label":o||"Gradient legend",children:[(0,Or.jsx)("defs",{children:(0,Or.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),o&&(0,Or.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:o}),(0,Or.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,Or.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(i[0])}),(0,Or.jsx)("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(i[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Or.jsx)("stop",{offset:100*t+"%",stopColor:r(i[1]-t*(i[1]-i[0]))},e))}return(0,Or.jsxs)("g",{"aria-label":o||"Gradient legend",children:[o&&(0,Or.jsx)("text",{x:0,y:-6,textAnchor:"start",fontSize:11,fill:"var(--semiotic-text, #333)",children:o}),(0,Or.jsx)("defs",{children:(0,Or.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,Or.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,Or.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(i[1])}),(0,Or.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(i[0])})]})}function Gr(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:o,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:h}=e,d=zr(h),[f,y]=jr.useState(0),[p,g]=jr.useState(0),m=jr.useCallback((e,t)=>{y(e),g(t)},[]),x="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:o,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{const h=[],d=function(e,t){let n=24;return e.map(({hasLabel:e,itemCount:r})=>{n+=5;const i=n;let o;n+=8,e&&(n+=16,o=n,n+=8);const s=n;return n+=r*t+8,{lineY:i,labelY:o,itemsY:s,endY:n}})}(e.map(e=>({hasLabel:!!e.label,itemCount:e.items.length})),u.rowHeight);return e.forEach((e,f)=>{const y=d[f];h.push((0,Or.jsx)("line",{stroke:"gray",x1:0,y1:y.lineY,x2:t,y2:y.lineY},"legend-top-line legend-symbol-"+f)),e.label&&null!=y.labelY&&h.push((0,Or.jsx)("text",{y:y.labelY,className:"legend-group-label",fontSize:12,style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),h.push((0,Or.jsx)("g",{className:"legend-item",transform:`translate(0,${y.itemsY})`,children:Xr(e,n,r,i,o,s,a,f,l,c,u)},"legend-group-"+f))}),h})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:o,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:m,legendInteraction:s,metrics:d}):(({legendGroups:e,height:t,width:n,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:o,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:h})=>{let d=0;const f=[];e.forEach((e,t)=>{let y=0;e.label&&(y+=16);const p=((e,t,n,r,i,o,s,a,l,c,u,h)=>{const{type:d="fill",styleFn:f,items:y}=e,p=[],{swatchSize:g,labelGap:m,itemGap:x,rowHeight:v,align:b}=u,k=!(!t&&!n),w="isolate"===c||void 0===c&&null!=i,A=y.map(e=>g+m+7*e.label.length),S=[];let _=0,M=0;A.forEach((e,t)=>{const n=0===M?e:M+x+e;h&&h>0&&M>0&&n>h?(S.push({start:_,end:t,width:M}),_=t,M=e):M=n}),y.length>0&&S.push({start:_,end:y.length,width:M}),S.forEach((e,c)=>{let u="center"===b?Math.max(0,((h??e.width)-e.width)/2):"end"===b?Math.max(0,(h??e.width)-e.width):0;for(let h=e.start;e.end>h;h++){const e=y[h],b=Br(e,h,d,f,g),S=Hr(e,r,i),_=i&&i.size>0&&i.has(e.label);p.push((0,Or.jsxs)("g",{transform:`translate(${u},${c*v})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:k?a===o&&h===s?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?_||!1:void 0,"aria-current":k&&!w&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:k?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(h+("ArrowRight"===n.key?1:-1)+y.length)%y.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:k?t=>{l(a,h),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:S,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&(0,Or.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:g+m+2+7*e.label.length,height:g+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),b,_&&(0,Or.jsx)(Yr,{swatchSize:g}),(0,Or.jsx)("text",{y:g/2,x:g+m,dominantBaseline:"central",fontSize:12,style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+h)),u+=A[h]+x}});const C=Math.max(0,...S.map(e=>e.width)),P=S.length;return{items:p,offset:C,totalRows:P,totalHeight:P*v}})(e,r,i,o,s,a,l,t,c,u,h,h.maxWidth??n);y+=p.offset+5,f.push({label:e.label,...p,offset:y,totalRows:p.totalRows,totalHeight:p.totalHeight}),d+=y+12});const y=h.maxWidth??n;let p=d>y?0:"center"===h.align?Math.max(0,(y-d)/2):"end"===h.align?Math.max(0,y-d):0;const g=[];return f.forEach((n,r)=>{const i=e[r];i.label&&(g.push((0,Or.jsx)("text",{transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",fontSize:12,style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:i.label},"legend-text-"+r)),p+=16),g.push((0,Or.jsx)("g",{className:"legend-item",transform:`translate(${p},0)`,children:n.items},"legend-group-"+r)),p+=n.offset+5,e[r+1]&&g.push((0,Or.jsx)("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+r)),p+=12}),(0,Or.jsx)("g",{children:g})})({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:o,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:m,legendInteraction:s,metrics:d}),v=!(!n&&!r);return(0,Or.jsxs)("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==o))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===u&&(0,Or.jsx)("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",fontSize:12,style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),x]})}var Vr=require("react/jsx-runtime");function Ur(e){const{legend:t,totalWidth:n,totalHeight:r,margin:i,legendPosition:o="right",legendLayout:s,legendHoverBehavior:a,legendClickBehavior:l,legendHighlightedCategory:c,legendIsolatedCategories:u,legendInteraction:h}=e;if(!t)return null;const d="top"===o||"bottom"===o,f=Math.max(0,n-i.left-i.right),y=Math.max(1,d?s?.maxWidth??f:Er(t,s)),p=Nr(t),g=Ir(s),m=Wr(e.axisChrome,s),x=Wr(void 0,s),v=$r(t,f,s);let b,k;if("left"===o)b=i.left-g-y-p,k=i.top;else if("top"===o)b=i.left,k=i.top-x-p-v;else if("bottom"===o){b=i.left;const e=r-i.bottom;k=Math.max(e+p,Math.min(e+m+p,r-v))}else b=n-i.right+g+p,k=i.top;return(0,Vr.jsx)("g",{transform:`translate(${b}, ${k})`,children:Dr(t)?(0,Vr.jsx)(qr,{config:t.gradient,orientation:d?"horizontal":"vertical",width:y}):Tr(t)?(0,Vr.jsx)(Gr,{legendGroups:t.legendGroups,title:"",width:y,orientation:d?"horizontal":"vertical",legendLayout:s,customHoverBehavior:a,customClickBehavior:l,highlightedCategory:c,isolatedCategories:u,legendInteraction:h}):t})}var Kr=require("react"),Qr=require("d3-array");function Zr(e){let t=1/0,n=-1/0;for(const r of e)t>r&&(t=r),r>n&&(n=r);return[t,n]}var Jr=require("react/jsx-runtime");function ei(e){return"string"==typeof e?{type:e}:e}function ti({orient:e,config:t,values:n,scale:r,size:i,length:o}){const s=function(e){return{type:e.type,bins:e.bins??20,fill:e.fill??"#4e79a7",fillOpacity:e.fillOpacity??.5,stroke:e.stroke??"none",strokeWidth:e.strokeWidth??1}}(t),a="top"===e||"bottom"===e,l=(0,Kr.useMemo)(()=>{if(0===n.length)return null;const t=r.domain(),l=i-8;if("boxplot"===s.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const r=t[Math.floor(.25*n)],i=t[Math.floor(.5*n)],o=t[Math.floor(.75*n)],s=o-r;return{q1:r,median:i,q3:o,whiskerLow:Math.max(t[0],r-1.5*s),whiskerHigh:Math.min(t[n-1],o+1.5*s)}}(n);if(!t)return null;const{q1:i,median:o,q3:c,whiskerLow:u,whiskerHigh:h}=t,d=Math.min(.5*l,20),f=(l-d)/2+4;if(a){const t=r(i),n=r(c),a=r(o),l=r(u),y=r(h),p="top"===e?-1:1,g=0;return(0,Jr.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,Jr.jsx)("line",{x1:l,y1:g+p*(f+d/2),x2:y,y2:g+p*(f+d/2),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Jr.jsx)("line",{x1:l,y1:g+p*f,x2:l,y2:g+p*(f+d),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Jr.jsx)("line",{x1:y,y1:g+p*f,x2:y,y2:g+p*(f+d),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Jr.jsx)("rect",{x:Math.min(t,n),y:"top"===e?g-f-d:g+f,width:Math.abs(n-t),height:d,fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,Jr.jsx)("line",{x1:a,y1:"top"===e?g-f-d:g+f,x2:a,y2:"top"===e?g-f:g+f+d,stroke:s.fill,strokeWidth:2})]})}{const t=r(i),n=r(c),a=r(o),l=r(u),y=r(h),p="left"===e?-1:1,g=0;return(0,Jr.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,Jr.jsx)("line",{x1:g+p*(f+d/2),y1:l,x2:g+p*(f+d/2),y2:y,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Jr.jsx)("line",{x1:g+p*f,y1:l,x2:g+p*(f+d),y2:l,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Jr.jsx)("line",{x1:g+p*f,y1:y,x2:g+p*(f+d),y2:y,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Jr.jsx)("rect",{x:"left"===e?g-f-d:g+f,y:Math.min(t,n),width:d,height:Math.abs(n-t),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,Jr.jsx)("line",{x1:"left"===e?g-f-d:g+f,y1:a,x2:"left"===e?g-f:g+f+d,y2:a,stroke:s.fill,strokeWidth:2})]})}}const c=(0,Qr.bin)().domain(t).thresholds(s.bins)(n);if(0===c.length)return null;const u=function(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}(c.map(e=>e.length));if(0===u)return null;if("histogram"===s.type)return(0,Jr.jsx)("g",{"data-testid":"marginal-histogram-"+e,children:c.map((t,n)=>{if(null==t.x0||null==t.x1)return null;const i=t.length/u*l;if(a){const o=r(t.x0),a=r(t.x1)-r(t.x0);return(0,Jr.jsx)("rect",{x:o,y:"top"===e?-4-i:4,width:Math.max(a,.5),height:i,fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},n)}{const o=r(t.x0),a=r(t.x1)-r(t.x0);return(0,Jr.jsx)("rect",{x:"left"===e?-4-i:4,y:Math.min(o,o+a),width:i,height:Math.abs(a),fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},n)}})});if("violin"===s.type){const t=l/2+4,n=[];for(const i of c){if(null==i.x0||null==i.x1)continue;const o=i.length/u*(l/2),s=r((i.x0+i.x1)/2);n.push(a?`${s},${"top"===e?-(t-o):t-o}`:`${"left"===e?-(t-o):t-o},${s}`)}for(let i=c.length-1;i>=0;i--){const o=c[i];if(null==o.x0||null==o.x1)continue;const s=o.length/u*(l/2),h=r((o.x0+o.x1)/2);n.push(a?`${h},${"top"===e?-(t+s):t+s}`:`${"left"===e?-(t+s):t+s},${h}`)}return(0,Jr.jsx)("g",{"data-testid":"marginal-violin-"+e,children:(0,Jr.jsx)("polygon",{points:n.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}if("ridgeline"===s.type){const t=[];if(a){const n=0,i=null!=c[0].x0?r(c[0].x0):0;t.push(`M${i},${n}`);for(const n of c){if(null==n.x0||null==n.x1)continue;const i=n.length/u*l,o=r((n.x0+n.x1)/2);t.push(`L${o},${"top"===e?-i-4:i+4}`)}const s=null!=c[c.length-1].x1?r(c[c.length-1].x1):o;t.push(`L${s},${n}`),t.push("Z")}else{const n=0,i=null!=c[0].x0?r(c[0].x0):0;t.push(`M${n},${i}`);for(const n of c){if(null==n.x0||null==n.x1)continue;const i=n.length/u*l,o=r((n.x0+n.x1)/2);t.push(`L${"left"===e?-i-4:i+4},${o}`)}const s=null!=c[c.length-1].x1?r(c[c.length-1].x1):o;t.push(`L${n},${s}`),t.push("Z")}return(0,Jr.jsx)("g",{"data-testid":"marginal-ridgeline-"+e,children:(0,Jr.jsx)("path",{d:t.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}return null},[n,r,s,i,o,e,a,4]);return l?(0,Jr.jsx)("g",{className:"marginal-"+e,"data-testid":"marginal-"+e,children:l}):null}var ni=p(require("react")),ri=require("react/jsx-runtime");function ii(e,t=120,n=8){if(!e)return[];const r=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),o=[];let s="";for(const e of i)s&&s.length+1+e.length>r?(o.push(s),s=e):s=s?`${s} ${e}`:e;return s&&o.push(s),o}function oi(e,t,n,r){return"curly"===e?r?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:r?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function si(e,t,n,r){if(!e)return(0,ri.jsx)("g",{className:"annotation-note"});const{label:i,title:o,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!i&&!o)return(0,ri.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let h=a;h&&"dynamic"!==h||(h="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let d="start";"topBottom"===u?"right"===h?d="end":"middle"===h&&(d="middle"):d=0>t?"end":"start";const f=16,y=o?c?[o]:ii(o,l):[],p=i?c?[i]:ii(i,l):[],g="leftRight"===u?"end"===d?-4:4:0;let m=0;const x=[],v=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?x.push((0,ri.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===d?g-l:"middle"===d?g-l/2:g,y:-16,width:l,height:Math.max(f,(y.length+p.length)*f+(o&&i?2:0))+f,style:{overflow:"visible"},children:(0,ri.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:v,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===d?"right":"middle"===d?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[o&&(0,ri.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:o}),i&&(0,ri.jsx)("div",{className:"annotation-note-label",children:i})]})},"annotation-note-html")):(y.length>0&&(x.push((0,ri.jsx)("text",{className:"annotation-note-title",fill:v,textAnchor:d,fontWeight:"bold",children:y.map((e,t)=>(0,ri.jsx)("tspan",{x:g,dy:0===t?0:f,children:e},t))},"annotation-note-title")),m=y.length*f),p.length>0&&x.push((0,ri.jsx)("text",{className:"annotation-note-label",fill:v,textAnchor:d,y:m,children:p.map((e,t)=>(0,ri.jsx)("tspan",{x:g,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let b=null;if((o||i)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),b=(0,ri.jsx)("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(y.length+p.length)*f+(p.length>0?f:0);let t=0,n=e;"bottom"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),b=(0,ri.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,y.length+p.length-1)*f;let w=0;return"topBottom"===u?w=0>n?-(k+2):18:"leftRight"===u&&(w="middle"===h?-(k+f+(p.length>0&&y.length>0?2:0))/2+8:"bottom"===h||0>n?-(k+2):18),(0,ri.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[(0,ri.jsx)("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:x}),b]})}function ai(e,t,n,r,i){const o=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&o.push((0,ri.jsx)("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,r=t?.height||0;(e>0||r>0)&&o.push((0,ri.jsx)("rect",{width:e,height:r,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&o.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=r||0,s=i||0;if(void 0!==t?.x){const r=(t.x||0)-e;o.push((0,ri.jsx)("line",{x1:r,y1:(t.y1||0)-s,x2:r,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const r=(t.y||0)-s;o.push((0,ri.jsx)("line",{x1:(t.x1||0)-e,y1:r,x2:(t.x2||0)-e,y2:r,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?o.push((0,ri.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||o.push((0,ri.jsx)("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",r=t?.width??t?.height;void 0!==r&&o.push((0,ri.jsx)("path",{d:oi(e,r,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,ri.jsx)("g",{className:"annotation-subject",children:o})}function li(e,t,n,r,i,o){const s=[];let a=0,l=0;if("callout-circle"!==i&&"label"!==i||!o?.radius){if("callout-rect"===i&&o){const n=o.width||0,r=o.height||0;if(n>0||r>0){const i=n/2,o=r/2,s=e-i,c=t-o;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=n/2,h=r/2,d=e*h>t*u?u/e:h/t;a=i+s*d,l=o+c*d}}}else if("bracket"===i&&o){const e=o.width,t=o.height,n=o.depth||30;void 0!==e?(a=e/2,l=n):void 0!==t&&(a=n,l=t/2)}}else{const n=(o.radius||0)+(o.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const r=Math.atan2(t,e);a=Math.cos(r)*n,l=Math.sin(r)*n}}const c=Math.sqrt((e-a)**2+(t-l)**2);if(c>.5){const i=r||"var(--semiotic-text-secondary, currentColor)",o="curve"===n?.type;let u=Math.atan2(t-l,e-a);if(o){const r=(a+e)/2,o=(l+t)/2,h=-(t-l)/c,d=(e-a)/c,f=(n?.curve??.25)*c,y=r+h*f,p=o+d*f;s.push((0,ri.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${y},${p} ${e},${t}`,fill:"none",stroke:i},"connector-line")),u=Math.atan2(p-l,y-a)}else s.push((0,ri.jsx)("line",{x1:a,y1:l,x2:e,y2:t,stroke:i},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;s.push((0,ri.jsx)("path",{d:`M${a},${l}L${a+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${a+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:i,stroke:"none"},"connector-arrow"))}}return(0,ri.jsx)("g",{className:"annotation-connector",children:s})}function ci(e){const{x:t=0,y:n=0,dx:r,dy:i,nx:o,ny:s,note:a,connector:l,subject:c,type:u,color:h,className:d,disable:f,opacity:y,strokeDasharray:p,events:g={},"data-testid":m}=e,x=Array.isArray(t)?t[0]??0:t,v=Array.isArray(n)?n[0]??0:n,b=new Set(Array.isArray(f)?f:[]);let k=r||0,w=i||0;null!=o&&(k=o-x),null!=s&&(w=s-v);const A="string"==typeof u?u:"label";if("bracket"===A&&c&&0===k&&0===w)if(void 0!==c.width){k=c.width/2;const e=c.depth||30;w=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;k=e+(0>e?-5:5),w=c.height/2}return(0,ri.jsxs)("g",{className:("annotation "+(d||"")).trim(),transform:`translate(${x},${v})`,"data-testid":m,...null!=y&&{opacity:y},...p&&{strokeDasharray:p},...g,children:[!b.has("connector")&&li(k,w,l,h,A,c),!b.has("subject")&&ai(A,c,h,x,v),!b.has("note")&&si(a,k,w,h)]})}function ui(e){const{noteData:t}=e,{screenCoordinates:n}=t,r="string"==typeof t.type?t.type:"label",i=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),i=t.ny||n[0][1]+(t.dy??0),o=n.map((n,o)=>{const s=Object.assign({},t,{note:0===o?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:i});return(0,ri.jsx)(ci,{"data-testid":"semiotic-annotation",...s,type:r},"multi-annotation-"+o)});return(0,ri.jsx)("g",{children:o})}const o=t.note||{title:"none",label:t.label},s=`${o.label}-${o.title}-${t.i}`;return(0,ri.jsx)(ci,{"data-testid":"semiotic-annotation",events:i,...t,type:r},s)}var hi=require("d3-hierarchy"),di=require("d3-shape");function fi(e){return Math.round(100*e)/100}function yi(e,t=2){const n=[],r=[],i=t+1;for(let t=0;i>t;t++){let o=0;for(const[n,r]of e)null!==r&&(o+=n**t*r);n.push(o);const s=[];for(let n=0;i>n;n++){let r=0;for(const[i,o]of e)null!==o&&(r+=i**(t+n));s.push(r)}r.push(s)}r.push(n);const o=function(e,t){const n=e,r=e.length-1,i=[t];for(let e=0;r>e;e++){let t=e;for(let i=e+1;r>i;i++)Math.abs(n[e][i])>Math.abs(n[e][t])&&(t=i);for(let i=e;r+1>i;i++){const r=n[i][e];n[i][e]=n[i][t],n[i][t]=r}for(let t=e+1;r>t;t++)for(let i=r;i>=e;i--)n[i][t]-=n[i][e]*n[e][t]/n[e][e]}for(let e=r-1;e>=0;e--){let t=0;for(let o=e+1;r>o;o++)t+=n[o][e]*i[o];i[e]=(n[r][e]-t)/n[e][e]}return i}(r,i).map(fi);return{points:e.map(([e])=>[fi(e),fi(o.reduce((t,n,r)=>t+n*e**r,0))]),equation:[...o].reverse()}}function pi(e,t){const n=t.scales?.x??t.scales?.time;return n?null!=e.x?n(e.x):t.xAccessor&&null!=e[t.xAccessor]?n(e[t.xAccessor]):null:null}function gi(e,t){const n=t.scales?.y??t.scales?.value;return n?null!=e.y?n(e.y):t.yAccessor&&null!=e[t.yAccessor]?n(e[t.yAccessor]):null:null}function mi(e){return null==e?null:e+""}function xi(e,t,n){return t.stickyPositionCache?.set(e,n),n}function vi(e,t,n){const r=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===r){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId)return xi(t,n,{x:i.x,y:i.y})}const r=function(e){const t=e.data;if(!t||0===t.length)return null;const n=t[t.length-1],r=e.scales?.x??e.scales?.time,i=e.scales?.y??e.scales?.value;if(!r||!i)return null;const o=n[e.xAccessor||"x"],s=n[e.yAccessor||"y"];return null==o||null==s?null:{x:r(o),y:i(s)}}(n);return r?xi(t,n,r):null}if("semantic"===r){const r=function(e,t,n){const r=function(e){return mi(e.provenance?.stableId??e.stableId)}(e);if(!r)return null;const i=n.pointNodes?.find(e=>mi(e.pointId)===r);if(i)return xi(t,n,{x:i.x,y:i.y});const o=n.data?.find(e=>function(e){return mi(e.stableId??e.id??e.provenance?.stableId)}(e)===r);if(!o)return null;const s=pi(o,n),a=gi(o,n);return null==s||null==a?null:xi(t,n,{x:s,y:a})}(e,t,n);if(r)return r}let i=null,o=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(i=t.x,o=t.y)}if(null!=i&&null!=o||(i=pi(e,n),o=gi(e,n)),null!=i&&null!=o)return xi(t,n,{x:i,y:o});if("sticky"===r){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function bi(e,t,n,r=50){return!(-r>e||e>(n.width||0)+r||-r>t||t>(n.height||0)+r)}var ki=require("react/jsx-runtime"),wi={secondary:0,primary:3},Ai=".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}";function Si(e){return!0===e?._annotationDeferred}function _i(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function Mi(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function Ci(e){return Math.max(.72,.95-.06*e)}var Pi=p(require("react")),[Ri,ji]=W(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function Ti(e){const t=ji(e=>e.pushObservation),n=Pi.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return Pi.useMemo(()=>({...e,onObservation:n}),[n,e])}function Di(e,t={}){const n=function(e){const t=e.provenance,n=e.id??e.stableId??t?.stableId;return null==n||""===n?void 0:n+""}(e);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(r){const i=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(r);t.onAnnotationActivate?.({annotation:e,annotationId:n,chartId:t.chartId,inputType:i}),n&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:n,inputType:i,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}function Li(e){return e instanceof Element&&null!=e.closest("[data-semiotic-annotation-widget]")}var Ei=require("react/jsx-runtime"),Ni="var(--semiotic-bg, #ffffff)";function Ii(e){const{x:t,y:n,text:r,fill:i,fontSize:o=12,fontWeight:s,fontFamily:a,textAnchor:l="start",dominantBaseline:c,background:u,className:h}=e,d=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(u),f=e=>(0,Ei.jsx)("text",{x:t,y:n,textAnchor:l,dominantBaseline:c,fill:i,fontSize:o,fontWeight:s,fontFamily:a,className:h,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:r});if(!d)return f();if("halo"===d.type)return f({stroke:d.fill??Ni,strokeWidth:d.haloWidth??3});const y=d.padding??{x:6,y:3},p="number"==typeof y?y:y.x,g="number"==typeof y?y:y.y,m=function(e,t){return(e+"").length*t*.6}(r,o),x=o+2*g;let v,b;return v="middle"===l?t-m/2-p:"end"===l?t-m-p:t-p,b="middle"===c||"central"===c?n-x/2:"hanging"===c||"text-before-edge"===c?n-g:n-.8*o-g,(0,Ei.jsxs)("g",{className:h,children:[(0,Ei.jsx)("rect",{x:v,y:b,width:m+2*p,height:x,rx:d.radius??3,ry:d.radius??3,fill:d.fill??Ni,fillOpacity:d.opacity??.85,stroke:d.stroke,strokeWidth:d.strokeWidth}),f()]})}var Wi=require("react/jsx-runtime"),$i={linear:di.curveLinear,monotoneX:di.curveMonotoneX,monotoneY:di.curveMonotoneY,step:di.curveStep,stepAfter:di.curveStepAfter,stepBefore:di.curveStepBefore,basis:di.curveBasis,cardinal:di.curveCardinal,catmullRom:di.curveCatmullRom};function zi(e,t,n,r){const i=[];return e.forEach((e,o)=>{let s;if(n){const i=n(e,o,r);s=null!=i?i:t(e,o,r)}else s=t(e,o,r);s&&i.push({node:s,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:Mi(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),r=e.some(e=>Si(e.annotation)),i=e.some(e=>null!=_i(e.annotation)),o=e.some(e=>"layer"===_i(e.annotation));if(!n&&!r&&!i)return e.map(e=>e.node);const s=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of t)e.emphasis&&(e.rank=wi[e.emphasis]);const a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:r,readingOrder:i}=e,o=Si(t.annotation);let s=t.node;if("primary"===r||"secondary"===r||null!=i){const e=null==r&&null!=i;s=(0,ki.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+r,..."secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:Ci(i),"data-annotation-reading-order":i}:{},children:t.node},"annotation-emphasis-"+n)}const a=_i(t.annotation);return a&&(s=(0,ki.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+n)),o&&(s=(0,ki.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+n)),s});return r&&a.unshift((0,ki.jsx)("style",{children:Ai},"annotation-disclosure-style")),o&&a.unshift((0,ki.jsx)("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),a}(i)}function Oi(e,t={}){return function(e,n,r){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=vi(e,n,r);if(!t)return null;const{x:i,y:o}=t;if(!bi(i,o,r))return null;const s="callout"===e.type?"callout-circle":e.type,a="callout-circle"===s?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===s?{width:e.width,height:e.height}:void 0;return(0,Wi.jsx)(ui,{noteData:{x:i,y:o,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:s,...a?{subject:a}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+n)}case"x-threshold":{const t=pi(null!=e.value?{...e,x:e.value}:e,r);if(null==t)return null;const i=e.color||"#f97316",o=e.labelPosition||"top";let s;s="bottom"===o?(r.height||0)-4:"center"===o?(r.height||0)/2:16;const a=t>.6*(r.width||0),l=a?t-4:t+4,c=a?"end":"start";return(0,Wi.jsxs)("g",{opacity:e.opacity,children:[(0,Wi.jsx)("line",{x1:t,y1:0,x2:t,y2:r.height||0,stroke:i,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,Wi.jsx)(Ii,{x:l,y:s,text:e.label,textAnchor:c,fill:i,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"y-threshold":{const t=gi(null!=e.value?{...e,y:e.value}:e,r);if(null==t)return null;const i=e.color||"#f97316",o=e.labelPosition||"right";let s,l;"left"===o?(s=4,l="start"):"center"===o?(s=(r.width||0)/2,l="middle"):(s=(r.width||0)-4,l="end");const c=20>(a=t)?Math.min((r.height||0)-4,a+16):a-4;return(0,Wi.jsxs)("g",{opacity:e.opacity,children:[(0,Wi.jsx)("line",{x1:0,y1:t,x2:r.width||0,y2:t,stroke:i,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,Wi.jsx)(Ii,{x:s,y:c,text:e.label,textAnchor:l,fill:i,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:pi({...e,type:"point"},r),y:gi({...e,type:"point"},r),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const i=(0,hi.packEnclose)(t),o=e.padding||10;return(0,Wi.jsxs)("g",{children:[(0,Wi.jsx)("circle",{cx:i.x,cy:i.y,r:i.r+o,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,Wi.jsx)(Ii,{x:i.x,y:i.y-i.r-o-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:pi({...e,type:"point"},r),y:gi({...e,type:"point"},r)})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const i=e.padding||10,o=t.map(e=>e.x),s=t.map(e=>e.y),[a,l]=Zr(o),[c,u]=Zr(s),h=a-i,d=l+i,f=c-i;return(0,Wi.jsxs)("g",{children:[(0,Wi.jsx)("rect",{x:h,y:f,width:d-h,height:u+i-f,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,Wi.jsx)(Ii,{x:(h+d)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"highlight":{const t=r.data||[],i="function"==typeof e.filter?t.filter(e.filter):e.field&&null!=e.value?t.filter(t=>t[e.field]===e.value):[],o={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return(0,Wi.jsx)("g",{children:i.map((t,n)=>{const i=pi(t,r),s=gi(t,r);if(null==i||null==s)return null;const a="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||o;return(0,Wi.jsx)("circle",{cx:i,cy:s,r:a,...l},"hl-"+n)})},"ann-"+n)}case"bracket":{const t=pi(e,r),i=gi(e,r);return(0,Wi.jsx)(ui,{noteData:{x:t??0,y:i??0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}},"ann-"+n)}case"trend":{const t=r.data||[];if(2>t.length)return null;const i=r.xAccessor||"x",o=r.yAccessor||"y",s="ordinal"===r.frameType,a="horizontal"===r.projection,l=s?i:null,c=s?o:null;let u;const h=[],d=new Map;if(s&&l&&c){for(const e of t){const t=e[l];if(null==t)continue;const n=t+"";d.has(n)||(d.set(n,h.length),h.push(n))}u=t.map(e=>{const t=e[l],n=e[c];if(null==t||null==n)return null;const r=d.get(t+"");return null!=r?[r,+n]:null}).filter(e=>null!==e)}else u=t.map(e=>[e[i],e[o]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=r.scales?.x??r.scales?.time,y=r.scales?.y??r.scales?.value;if(!f||!y)return null;const p=e=>t=>{const n=Math.max(0,Math.floor(t)),r=Math.min(h.length-1,n+1),i=t-n,o=e(h[n]);return o+(e(h[r])-o)*i},g=f,m=y;let x;if(s)if(a){const e=p(m);x=(t,n)=>[g(n),e(t)]}else{const e=p(g);x=(t,n)=>[e(t),m(n)]}else x=(e,t)=>[g(e),m(t)];const v=e.method||"linear";let b;if("loess"===v)b=function(e,t=.3){const n=e.length;if(2>n)return e.slice();const r=e.slice().sort((e,t)=>e[0]-t[0]),i=r.map(e=>e[0]),o=r.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=i[e],r=i.map(e=>Math.abs(e-t)),l=r.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:r[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,h=0,d=0,f=0,y=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,h+=t*i[e],d+=t*o[e],f+=t*i[e]*i[e],y+=t*i[e]*o[e])}if(0===u){a.push([t,o[e]]);continue}const p=u*f-h*h;if(1e-12>Math.abs(p))a.push([t,d/u]);else{const e=(u*y-h*d)/p;a.push([t,(d-e*h)/u+e*t])}}return a}(u,e.bandwidth??.3);else{const t="polynomial"===v?yi(u,e.order||2):function(e){const t=[0,0,0,0];let n=0;for(const[r,i]of e)null!==i&&(n++,t[0]+=r,t[1]+=i,t[2]+=r*r,t[3]+=r*i);const r=n*t[2]-t[0]*t[0],i=0===r?0:fi((n*t[3]-t[0]*t[1])/r),o=fi(t[1]/n-i*t[0]/n);return{points:e.map(([e])=>[fi(e),fi(i*e+o)]),equation:[i,o]}}(u);b=t.points}const k=b.map(([e,t])=>{const[n,r]=x(e,t);return`${n},${r}`}).join(" "),w=e.color||"#6366f1",A=b[b.length-1],[S,_]=x(A[0],A[1]);return(0,Wi.jsxs)("g",{children:[(0,Wi.jsx)("polyline",{points:k,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,Wi.jsx)("text",{x:S+4,y:_-4,fill:w,fontSize:11,children:e.label})]},"ann-"+n)}case"band":{const t=r.scales?.y??r.scales?.value,i=t?.domain?.(),a=e.y0??i?.[0],l=e.y1??i?.[1],c=null!=a&&t?t(a):0,u=null!=l&&t?t(l):r.height||0,h=Jn(e.fill,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,Wi.jsxs)("g",{opacity:e.opacity,children:[h.def&&(0,Wi.jsx)("defs",{children:h.def}),(0,Wi.jsx)("rect",{x:0,y:Math.min(c,u),width:r.width||0,height:Math.abs(u-c),fill:h.fill,fillOpacity:e.fillOpacity||.1}),e.label&&(0,Wi.jsx)(Ii,{x:(r.width||0)-4,y:(o=c,s=u,Math.max(Math.min(o,s),0)+16),textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"x-band":{const t=r.scales?.x??r.scales?.time,i=t?.domain?.(),o=e.x0??i?.[0],s=e.x1??i?.[1],a=null!=o&&t?t(o):null,l=null!=s&&t?t(s):null;if(null==a||null==l)return null;const c=Jn(e.fill||e.color,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,Wi.jsxs)("g",{opacity:e.opacity,children:[c.def&&(0,Wi.jsx)("defs",{children:c.def}),(0,Wi.jsx)("rect",{x:Math.min(a,l),y:0,width:Math.abs(l-a),height:r.height||0,fill:c.fill,fillOpacity:e.fillOpacity??.1}),e.label&&(0,Wi.jsx)(Ii,{x:Math.min(a,l)+4,y:16,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"envelope":{const t=r.data||[];if(2>t.length)return null;const i=r.xAccessor||"x",o=r.scales?.x??r.scales?.time,s=r.scales?.y??r.scales?.value;if(!o||!s)return null;const a=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=t.filter(e=>null!=e[a]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[i]-t[i]);if(2>u.length)return null;const h=$i[r.curve||"linear"]||di.curveLinear,d=(0,di.area)().x(e=>o(e[i])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(h)(u);if(!d)return null;const f=e.fill||"#6366f1";return(0,Wi.jsxs)("g",{children:[(0,Wi.jsx)("path",{d:d,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,Wi.jsx)("text",{x:o(u[u.length-1][i])+4,y:s(u[u.length-1][a])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+n)}case"anomaly-band":{const t=r.data||[];if(2>t.length)return null;const i=r.yAccessor||"y",o=r.scales?.x??r.scales?.time,s=r.scales?.y??r.scales?.value;if(!o||!s)return null;const a=t.map(e=>e[i]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-l)**2,0)/a.length,u=Math.sqrt(c),h=e.threshold??2,d=l-h*u,f=!1!==e.showBand,y=e.fill||"#6366f1",p=e.fillOpacity??.1,g=e.anomalyColor||"#ef4444",m=e.anomalyRadius??6,x=s(l+h*u),v=s(d),b=t.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-l)>h*u});return(0,Wi.jsxs)("g",{children:[f&&(0,Wi.jsx)("rect",{x:0,y:Math.min(x,v),width:r.width||0,height:Math.abs(v-x),fill:y,fillOpacity:p}),b.map((e,t)=>{const n=pi(e,r),i=gi(e,r);return null==n||null==i?null:(0,Wi.jsx)("circle",{cx:n,cy:i,r:m,fill:g,fillOpacity:.7,stroke:g,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,Wi.jsx)("text",{x:(r.width||0)-4,y:Math.min(x,v)-4,textAnchor:"end",fill:y,fontSize:11,children:e.label})]},"ann-"+n)}case"forecast":{const t=r.data||[];if(3>t.length)return null;const o=r.xAccessor||"x",s=r.yAccessor||"y",a=r.scales?.x??r.scales?.time,l=r.scales?.y??r.scales?.value;if(!a||!l)return null;const c=t.map(e=>[e[o],e[s]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(e.method||"linear")){const t=yi(c,e.order||2).equation;u=e=>t.reduce((t,n,r)=>t+n*Math.pow(e,r),0)}else{const e=function(e){const t=e.length;let n=0,r=0,i=0,o=0;for(const[t,s]of e)n+=t,r+=s,i+=t*t,o+=t*s;const s=t*i-n*n;if(1e-12>Math.abs(s))return null;const a=(t*o-n*r)/s,l=(r-a*n)/t;return e=>l+a*e}(c);if(!e)return null;u=e}const h=c.length,{se:d,meanX:f,ssX:y}=function(e,t){const n=e.length,r=e.map(([e,n])=>n-t(e)).reduce((e,t)=>e+t*t,0),i=Math.sqrt(r/Math.max(n-2,1)),o=e.reduce((e,t)=>e+t[0],0)/n,s=e.reduce((e,t)=>e+(t[0]-o)**2,0);return{se:i,meanX:o,ssX:s}}(c,u),p=.99>(i=e.confidence??.95)?.95>i?.9>i?1:1.645:1.96:2.576,g=e.steps??5,m=c[h-1][0],x=(m-c[0][0])/Math.max(h-1,1),v=[];for(let e=1;g>=e;e++)v.push(m+e*x);const b=[];for(const e of v){const t=u(e),n=d*Math.sqrt(1+1/h+(y>0?(e-f)**2/y:0))*p;b.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const k=`M${b.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${b.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,w=b.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),A=`${a(m)},${l(u(m))}`,S=e.strokeColor||"#6366f1";return(0,Wi.jsxs)("g",{children:[(0,Wi.jsx)("path",{d:k,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,Wi.jsx)("polyline",{points:`${A} ${w}`,fill:"none",stroke:S,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&b.length>0&&(0,Wi.jsx)("text",{x:a(b[b.length-1].x)+4,y:l(b[b.length-1].yCenter)-4,fill:S,fontSize:11,children:e.label})]},"ann-"+n)}case"widget":{let i,o;if(null!=e.px&&null!=e.py)i=e.px,o=e.py;else{const t=vi(e,n,r);if(!t)return null;i=t.x,o=t.y}if(!bi(i,o,r))return null;const s=e.dx??0,a=e.dy??0,l=e.width??32,c=e.height??32,u=e.content??(0,Wi.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return(0,Wi.jsx)("foreignObject",{x:i+s-l/2,y:o+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:(0,Wi.jsx)("div",{...Di(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const t=vi(e,n,r);if(!t)return null;const{x:i,y:o}=t,s=i+(e.dx||0),a=o+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,Wi.jsx)("text",{x:s,y:a,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?ni.cloneElement(c,{key:"ann-text-"+n}):(0,Wi.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,Wi.jsx)("line",{x1:i,y1:o,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),ni.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const t=e.category;if(null==t)return null;const i=e=>"function"==typeof e&&"function"==typeof e.bandwidth,o=r.scales?.o,s=r.scales?.x,a=r.scales?.y,l=i(o)?o:i(s)?s:i(a)?a:null;if(!l)return null;const c=l(t+"");if(null==c)return null;const u=l.bandwidth(),h=e.color||"var(--semiotic-primary, #4589ff)",d=e.opacity??.15,f=e.label;return(0,Wi.jsxs)("g",(r.projection?"vertical"===r.projection:l===s)?{children:[(0,Wi.jsx)("rect",{x:c,y:0,width:u,height:r.height||0,fill:h,fillOpacity:d}),f&&(0,Wi.jsx)(Ii,{x:c+u/2,y:16,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[(0,Wi.jsx)("rect",{x:0,y:c,width:r.width||0,height:u,fill:h,fillOpacity:d}),f&&(0,Wi.jsx)(Ii,{x:12,y:c+u/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+n)}default:return null}var i,o,s,a}}var Fi=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function Bi(e){return!!e&&"object"==typeof e&&Fi.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function Yi(e){return"primary"===e?.emphasis||!0===e?.defensive}function Hi(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function Xi(e){let t;const n=e?.emphasis;t="primary"===n?100:"secondary"===n?10:50;const r=e?.provenance?.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(t+=15*Math.max(0,Math.min(1,r))),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}new Set(["label","callout","callout-circle","callout-rect"]);var qi=32,Gi=6,Vi=4,Ui=8,Ki=72;var Qi={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Zi(e){if(!Ji(e))return e;const t=("string"==typeof e.mobileText?e.mobileText:void 0)??("string"==typeof e.shortText?e.shortText:void 0);return!t||"string"!=typeof e.label&&null!=e.label?e:{...e,label:t}}function Ji(e){return Bi(e)}function eo(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),r=e.split(/\s+/).filter(Boolean),i=[];let o="";for(const e of r)o&&o.length+e.length+1>n?(i.push(o),o=e):o=o?`${o} ${e}`:e;return o&&i.push(o),i}function to(e,t,n,r,i){const o=e+n,s=t+r;return Math.abs(n)>Math.abs(r)?{x:0>n?o-i.width-4:o+4,y:0>r?s-i.height:s,width:i.width,height:i.height}:{x:0>n?o-i.width:o,y:0>r?s-i.height-4:s+4,width:i.width,height:i.height}}function no(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function ro(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function io(e,t,n,r,i,o,s,a){const l=no(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,r){const i=Math.max(0,r-e.x),o=Math.max(0,r-e.y);return(i+Math.max(0,e.x+e.width-(t-r)))*e.height+(o+Math.max(0,e.y+e.height-(n-r)))*e.width}(l,i,o,a);for(const e of n)c+=12*ro(l,e);for(const e of r)c+=4*ro(l,e);return c}function oo(e){const{annotations:t,context:n,defaultOffset:r=qi,notePadding:i=Gi,markPadding:o=Vi,edgePadding:s=Ui,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=Ki,density:u,progressiveDisclosure:h=!1,redundantCues:d=!1,responsive:f,mobile:y,cohesion:p,audience:g}=e,m=n.width||0,x=n.height||0,v="object"==typeof y?y:{},b=v.breakpoint??480,k=!!y&&b>=m,w=k&&!1!==v.preferShortText?t.map(Zi):t,A=k&&!u?{maxAnnotations:v.maxAnnotations??("callout-list"===v.strategy?1:2),minVisible:v.minVisible??1}:u,S=h||k&&(!1!==v.progressiveDisclosure||"callout-list"===v.strategy),_=k&&!f?v.responsive??{minWidth:b}:f,M=k&&!p?v.cohesion:p;if(0===w.length||0>=m||0>=x)return w.slice();const C=[],P=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(n,o);let R=!1;const j=w.map((e,t)=>{if(!Ji(e))return e;const o=function(e,t,n){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const r=e.pointId??e.nodeId;if(null!=r&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===r);if(e)return{x:e.x,y:e.y}}const i=e.coordinates,o=n.scales?.geoProjection;if(Array.isArray(i)&&i.length>=2&&o){const e=i[0],t=i[1];if("number"==typeof e&&"number"==typeof t){const n=o([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?vi(e,t,n):{x:e.x,y:e.y}}(e,t,n);if(!o)return e;const u=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...eo("string"==typeof e.title?e.title:void 0,t),...eo("string"==typeof e.label?e.label:void 0,t)],r=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*r)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("number"==typeof(h=e).dx||"number"==typeof h.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return C.push(no(to(o.x,o.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),i)),e}var h;let d=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(r)){const t=io(to(o.x,o.y,e.dx,e.dy,u),e,C,P,m,x,i,s);f>t&&(d=e,f=t)}if(!d)return e;const y=no(to(o.x,o.y,d.dx,d.dy,u),i);C.push(y);const p=Math.hypot(d.dx,d.dy),g=l&&p>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return R=!0,{...e,dx:d.dx,dy:d.dy,...g?{connector:g}:{}}}),T=R?j:w.slice();let D=T;if(d){let e=!1;const t=T.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return n!==t&&(e=!0),n});D=e?t:T}{let e=!1;const t=D.map(t=>{if(!0!==t?.defensive)return t;const n=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const n="string"==typeof t.source?Qi[t.source]??t.source:null,r="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!n&&!r)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const i=[n,r].filter(Boolean).join(" · "),o="string"==typeof e.label?e.label:"";return o.includes(`(${i})`)?e:{...e,label:o?`${o} (${i})`:`(${i})`}}(t);return n!==t&&(e=!0),n});D=e?t:D}const L=new Set;if(A){const e="object"==typeof A?A:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(g),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??Hi(m,x,e))*t))},{deferred:r}=function(e){const{annotations:t,width:n,height:r}=e,i=Math.max(0,e.minVisible??1),o=Hi(n,r,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,Bi(n))};var n}),a=s.filter(e=>e.note);if(0===a.length||o>=a.length)return{visible:t.slice(),deferred:[],budget:o};const l=a.filter(e=>Yi(e.annotation)),c=a.filter(e=>!Yi(e.annotation)).sort((e,t)=>Xi(t.annotation)-Xi(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,o-l.length),Math.max(0,i-l.length))),h=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),d=[],f=[];for(const{annotation:e,index:t,note:n}of s)!n||h.has(t)?d.push(e):f.push(e);return{visible:d,deferred:f,budget:o}}({annotations:D,width:m,height:x,...n});for(const e of r)L.add(e)}if(_&&("object"==typeof _&&"number"==typeof _.minWidth?_.minWidth:480)>=m)for(const e of D)Ji(e)&&"secondary"===e.emphasis&&L.add(e);if(L.size>0)for(const e of D)!0===e?.defensive&&L.delete(e);let E;return E=0===L.size?D:S?D.map(e=>L.has(e)?{...e,_annotationDeferred:!0}:e):D.filter(e=>!L.has(e)),M?function(e,t){let n=!1;const r=e.map(e=>Ji(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?r:e}(E,M):E}function so(e,t={}){const n=!0===t.showRetractedAnnotations,r=!0===t.showSupersededAnnotations,i=new Set;for(const t of e){const e=t?.lifecycle?.supersedes;e&&"retracted"!==t?.lifecycle?.status&&i.add(e)}return e.filter(e=>{if("retracted"===e?.lifecycle?.status&&!n)return!1;const t=e?.provenance?.stableId;return!(t&&i.has(t)&&!r)})}var ao=require("react"),lo={positions:new Map},co=new Set;function uo(){for(const e of co)e()}function ho(e,t){const n=lo.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const r=new Map(lo.positions);r.delete(e),lo={positions:r},uo()}function fo(e,t){const n=lo.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const r=new Map(lo.positions);r.delete(e),lo={positions:r},uo()}function yo(){return lo}function po(e){return co.add(e),()=>co.delete(e)}var go={positions:new Map};function mo(){return()=>{}}function xo(){return go}function vo(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),r=n[0],i=n[n.length-1],o=r instanceof Date,s=r instanceof Date?r.getTime():r,a=i instanceof Date?i.getTime():i;if(2>t||s===a)return o?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?a:s+e*l;c[e]=o?new Date(n):n}return c}(e,t):e.ticks(t)}function bo(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function ko(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function wo(e){if(0===e.length)return{min:null,max:null};let t=1/0,n=-1/0;for(const r of e)t>r.pixel&&(t=r.pixel),r.pixel>n&&(n=r.pixel);return{min:t,max:n}}function Ao(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function So(e,t,n){if("left"===e||"right"===e){const r="left"===e?n:0,i="left"===e?-1:1,o=Math.ceil(t/8);let s="M0,"+r;for(let e=0;o>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${r+4*i}`,s+=`L${Math.min(n,t)},${r}`}return s}const r="bottom"===e?0:t,i="bottom"===e?1:-1,o=Math.ceil(n/8);let s=`M${r},0`;for(let e=0;o>e;e++){const t=8*(e+1);s+=`L${r+4*i},${Math.min(8*e+4,n)}`,s+=`L${r},${Math.min(t,n)}`}return s}var _o=require("react/jsx-runtime");function Mo(e){const{width:t,height:n,totalWidth:r,totalHeight:i,margin:o,scales:s,showAxes:a,axes:l,showGrid:c,xFormat:u,yFormat:h,axisExtent:d}=e,f=(0,Rr.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"bottom"===e.orient),n=l?.find(e=>"top"===e.orient),r=e??n,i=r?.extent??d,o=r?.tickFormat||u||Co,a=Math.max(2,Math.floor(t/70)),c=r?.ticks??5,h="exact"===i?Math.max(2,c):Math.min(c,a),f=r?.tickValues??vo(s.x,h,i),y=f.map(e=>e.valueOf()),p=f.map((e,t)=>({value:e,pixel:s.x(e),label:o(e,t,y)})),g=p.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return Po(p,Math.max(55,g+8))},[s,l,u,t,d]),y=(0,Rr.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.extent??d,r=e?.tickFormat||h||Co,i=Math.max(2,Math.floor(n/30)),o=e?.ticks??5,a="exact"===t?Math.max(2,o):Math.min(o,i);return Po((e?.tickValues??vo(s.y,a,t)).map(e=>({value:e,pixel:s.y(e),label:r(e)})),22)},[s,l,h,n,d]),p=c&&s,g=a&&s;if(!p&&!g)return null;const m=l?.find(e=>"bottom"===e.orient),x=l?.find(e=>"left"===e.orient),v=g&&(!m||!1!==m.baseline),b=g&&(!x||!1!==x.baseline),k=m?.jaggedBase||!1,w=x?.jaggedBase||!1,A="var(--semiotic-border, #ccc)";return(0,_o.jsx)("svg",{width:r,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:(0,_o.jsxs)("g",{transform:`translate(${o.left},${o.top})`,children:[p&&(()=>{const e=Ao(l?.find(e=>"bottom"===e.orient)?.gridStyle),r=Ao(l?.find(e=>"left"===e.orient)?.gridStyle),i=!1!==l?.find(e=>"bottom"===e.orient)?.grid,o=!1!==l?.find(e=>"left"===e.orient)?.grid;return(0,_o.jsxs)("g",{className:"stream-grid",children:[i&&f.map((t,r)=>(0,_o.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+r)),o&&y.map((e,n)=>(0,_o.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),v&&!k&&(0,_o.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:A,strokeWidth:1}),k&&(0,_o.jsx)("path",{d:So("bottom",t,n),fill:"none",stroke:A,strokeWidth:1}),b&&!w&&(0,_o.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:A,strokeWidth:1}),w&&(0,_o.jsx)("path",{d:So("left",t,n),fill:"none",stroke:A,strokeWidth:1})]})})}function Co(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Po(e,t){if(2>=e.length)return e;const n=[e[0]];for(let r=1;e.length-1>r;r++)t>Math.abs(e[r].pixel-n[n.length-1].pixel)||n.push(e[r]);const r=e[e.length-1];return t>Math.abs(r.pixel-n[n.length-1].pixel)?n[n.length-1]=r:n.push(r),n}function Ro(e){const{width:t,height:n,totalWidth:r,totalHeight:i,margin:o,scales:s,showAxes:a,axes:l,xLabel:c,yLabel:u,yLabelRight:h,xFormat:d,yFormat:f,axisExtent:y,showGrid:p,title:g,legend:m,legendHoverBehavior:x,legendClickBehavior:v,legendHighlightedCategory:b,legendIsolatedCategories:k,legendPosition:w="right",legendLayout:A,foregroundGraphics:S,marginalGraphics:_,xValues:M,yValues:C,annotations:P,onAnnotationActivate:R,onObservation:j,chartId:T,chartType:D,autoPlaceAnnotations:L,svgAnnotationRules:E,xAccessor:N,yAccessor:I,annotationData:W,pointNodes:$,curve:z,underlayRendered:O,canvasObscuresUnderlay:F=!0,linkedCrosshairName:B,linkedCrosshairSourceId:Y,children:H}=e,X=Ti({onAnnotationActivate:R,onObservation:j,chartId:T,chartType:D}),q=Ir(A),G=m&&"left"===w&&q>0?q:o.left,V=m&&"right"===w&&q>0?q:o.right,U=(0,Rr.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"bottom"===e.orient),n=l?.find(e=>"top"===e.orient),r=e??n,i=r?.extent??y,o=r?.tickFormat||d||Co,c=Math.max(2,Math.floor(t/70)),u=r?.ticks??5,h="exact"===i?Math.max(2,u):Math.min(u,c),f=r?.tickValues??vo(s.x,h,i),p=f.map(e=>e.valueOf()),g=f.map((e,t)=>({value:e,pixel:s.x(e),label:o(e,t,p)})),m=g.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),x=r?.autoRotate?Math.max(20,Math.min(m+8,55)):Math.max(55,m+8);let v=Po(g,x);if(v.length>1&&(v=v.filter((e,t)=>0===t||e.label+""!=v[t-1].label+"")),r?.includeMax&&v.length>0&&"exact"!==i&&!r?.tickValues){const e=s.x.domain()[1],t=s.x(e),n=v[v.length-1].pixel;if(Math.abs(t-n)>1){const r=o(e,v.length,p);x>t-n&&v.length>1&&(v=v.slice(0,-1)),v.push({value:e,pixel:t,label:r})}}return v},[a,s,l,d,t,y]),K=(0,Rr.useMemo)(()=>{const e=l?.find(e=>"bottom"===e.orient);if(!e?.autoRotate||1>=U.length)return!1;const n=t/Math.max(U.length-1,1);return U.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>n},[l,U,t]),Q=(0,Rr.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.extent??y,r=e?.tickFormat||f||Co,i=Math.max(2,Math.floor(n/30)),o=e?.ticks??5,c="exact"===t?Math.max(2,o):Math.min(o,i);let u=Po((e?.tickValues??vo(s.y,c,t)).map(e=>({value:e,pixel:s.y(e),label:r(e)})),22);if(u.length>1&&(u=u.filter((e,t)=>0===t||e.label+""!=u[t-1].label+"")),e?.includeMax&&u.length>0&&"exact"!==t&&!e?.tickValues){const e=s.y.domain()[1],t=s.y(e),n=u[u.length-1].pixel;if(Math.abs(t-n)>1){const i=r(e);22>Math.abs(t-n)&&u.length>1&&(u=u.slice(0,-1)),u.push({value:e,pixel:t,label:i})}}return u},[a,s,l,f,n,y]),Z=(0,Rr.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"right"===e.orient);if(!e)return[];const t=e.extent??y,r=e.tickFormat||f||Co,i=Math.max(2,Math.floor(n/30)),o=e.ticks??5;return Po((e.tickValues??vo(s.y,"exact"===t?Math.max(2,o):Math.min(o,i),t)).map(e=>({value:e,pixel:s.y(e),label:r(e)})),22)},[a,s,l,f,n,y]),J=(0,Rr.useRef)(new Map),ee=(0,Rr.useRef)(P?.length??0),te=P?.length??0;ee.current!==te&&(ee.current=te,J.current=new Map);const ne=(0,Rr.useMemo)(()=>{if(!P||0===P.length)return null;const e=so(P),r=Oi(0,X),i={scales:s?{x:s.x,y:s.y,time:s.x,value:s.y}:null,timeAxis:"x",xAccessor:N,yAccessor:I,width:t,height:n,data:W,frameType:"xy",pointNodes:$,curve:z,stickyPositionCache:J.current};return zi(L?oo({annotations:e,context:i,..."object"==typeof L?L:{}}):e,r,E,i)},[P,L,E,t,n,N,I,W,s,$,z,X]),re=function(e){const t=(0,ao.useSyncExternalStore)(e?po:mo,e?yo:xo,e?yo:xo);return e?t.positions.get(e)??null:null}(B);return(0,Rr.useEffect)(()=>{if(!re?.locked||!B)return;const e=e=>{"Escape"===e.key&&fo(B)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[re?.locked,B]),a||g||m||S||_||ne&&ne.length>0||p||H||re?(0,_o.jsxs)("svg",{role:"img",width:r,height:i,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,_o.jsx)("title",{children:"string"==typeof g?g:"XY Chart"}),(0,_o.jsx)("desc",{children:"string"==typeof g?g+" (XY data visualization)":"XY data visualization"}),(0,_o.jsxs)("g",{transform:`translate(${o.left},${o.top})`,children:[p&&s&&(!O||F)&&(()=>{const e=Ao(l?.find(e=>"bottom"===e.orient)?.gridStyle),r=Ao(l?.find(e=>"left"===e.orient)?.gridStyle),i=!1!==l?.find(e=>"bottom"===e.orient)?.grid,o=!1!==l?.find(e=>"left"===e.orient)?.grid;return(0,_o.jsxs)("g",{className:"stream-grid",children:[i&&U.map((t,r)=>(0,_o.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+r)),o&&Q.map((e,n)=>(0,_o.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),a&&s&&(()=>{const e=l?.find(e=>"left"===e.orient),r=l?.find(e=>"bottom"===e.orient),i=!e||!1!==e.baseline,o=!r||!1!==r.baseline,s=e?.jaggedBase||!1,a=r?.jaggedBase||!1,d=r?.landmarkTicks,f=e?.landmarkTicks,y="var(--semiotic-border, #ccc)",p="var(--semiotic-text-secondary, var(--semiotic-text, #666))",g="var(--semiotic-text, #333)",m=K,x={fontSize:"var(--semiotic-tick-font-size, 12px)"},v={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},b={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},k=r?.tickAnchor,w=e?.tickAnchor,A=wo(U),S=wo(Q);return(0,_o.jsxs)("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(0,_o.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!O||F)&&o&&!a&&(0,_o.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:y,strokeWidth:1}),(!O||F)&&a&&(0,_o.jsx)("path",{d:So("bottom",t,n),fill:"none",stroke:y,strokeWidth:1}),U.map((e,t)=>{const r=!!d&&("function"==typeof d?d(e.value,t):Pn(e.value,t>0?U[t-1].value:void 0));return(0,_o.jsxs)("g",{transform:`translate(${e.pixel},${n})`,children:[(0,_o.jsx)("line",{y2:5,stroke:y,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,_o.jsx)("text",{y:m?12:18,textAnchor:m?"end":bo(k,e.pixel===A.min,e.pixel===A.max),fontWeight:r?600:400,fill:p,fontSize:r?13:12,className:"semiotic-axis-tick",style:{userSelect:"none",...r?v:x},transform:m?"rotate(-45)":void 0,children:e.label}):(0,_o.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,_o.jsx)("div",{style:{textAlign:"center",userSelect:"none",...x},children:e.label})})]},"xtick-"+t)}),c&&(0,_o.jsx)("text",{x:t/2,y:n+(m?58:40),textAnchor:"middle",fill:g,fontSize:12,className:"semiotic-axis-label",style:{userSelect:"none",...b},children:c})]}),(0,_o.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!O||F)&&i&&!s&&(0,_o.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:y,strokeWidth:1}),(!O||F)&&s&&(0,_o.jsx)("path",{d:So("left",t,n),fill:"none",stroke:y,strokeWidth:1}),Q.map((e,t)=>{const n=!!f&&("function"==typeof f?f(e.value,t):Pn(e.value,t>0?Q[t-1].value:void 0));return(0,_o.jsxs)("g",{transform:`translate(0,${e.pixel})`,children:[(0,_o.jsx)("line",{x2:-5,stroke:y,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,_o.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:ko(w,e.pixel===S.min,e.pixel===S.max),fontWeight:n?600:400,fill:p,fontSize:n?13:12,className:"semiotic-axis-tick",style:{userSelect:"none",...n?v:x},children:e.label}):(0,_o.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,_o.jsx)("div",{style:{textAlign:"right",userSelect:"none",...x},children:e.label})})]},"ytick-"+t)}),(()=>{const t=e?.label||u;return t?(0,_o.jsx)("text",{x:15-G,y:n/2,textAnchor:"middle",fill:g,transform:`rotate(-90, ${15-G}, ${n/2})`,fontSize:12,className:"semiotic-axis-label",style:{userSelect:"none",...b},children:t}):null})()]}),(()=>{const e=l?.find(e=>"right"===e.orient);if(!e||0===Z.length)return null;const r=!1!==e.baseline,i=e.landmarkTicks,o=e.label||h,s=e.tickAnchor,a=wo(Z);return(0,_o.jsxs)("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[r&&(0,_o.jsx)("line",{x1:t,y1:0,x2:t,y2:n,stroke:y,strokeWidth:1}),Z.map((e,n)=>{const r=!!i&&("function"==typeof i?i(e.value,n):Pn(e.value,n>0?Z[n-1].value:void 0));return(0,_o.jsxs)("g",{transform:`translate(${t},${e.pixel})`,children:[(0,_o.jsx)("line",{x2:5,stroke:y,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,_o.jsx)("text",{x:8,textAnchor:"start",dominantBaseline:ko(s,e.pixel===a.min,e.pixel===a.max),fontWeight:r?600:400,fill:p,fontSize:r?13:12,className:"semiotic-axis-tick",style:{userSelect:"none",...r?v:x},children:e.label}):(0,_o.jsx)("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,_o.jsx)("div",{style:{textAlign:"left",userSelect:"none",...x},children:e.label})})]},"ytick-r-"+n)}),o&&(0,_o.jsx)("text",{x:t+V-15,y:n/2,textAnchor:"middle",fill:g,transform:`rotate(90, ${t+V-15}, ${n/2})`,fontSize:12,className:"semiotic-axis-label",style:{userSelect:"none",...b},children:o})]})})()]})})(),ne,_&&s&&M&&C&&(0,_o.jsxs)(_o.Fragment,{children:[_.top&&(0,_o.jsx)("g",{transform:"translate(0, 0)",children:(0,_o.jsx)(ti,{orient:"top",config:ei(_.top),values:M,scale:s.x,size:o.top,length:t})}),_.bottom&&(0,_o.jsx)("g",{transform:`translate(0, ${n})`,children:(0,_o.jsx)(ti,{orient:"bottom",config:ei(_.bottom),values:M,scale:s.x,size:o.bottom,length:t})}),_.left&&(0,_o.jsx)("g",{transform:"translate(0, 0)",children:(0,_o.jsx)(ti,{orient:"left",config:ei(_.left),values:C,scale:s.y,size:o.left,length:n})}),_.right&&(0,_o.jsx)("g",{transform:`translate(${t}, 0)`,children:(0,_o.jsx)(ti,{orient:"right",config:ei(_.right),values:C,scale:s.y,size:o.right,length:n})})]}),S,re&&re.sourceId!==Y&&s?.x&&(()=>{const e=s.x(re.xValue);if(null==e||0>e||e>t)return null;const r=re.locked;return(0,_o.jsx)("line",{x1:e,y1:0,x2:e,y2:n,stroke:r?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:r?1.5:1,strokeDasharray:r?"6,3":"4,4",pointerEvents:"none"})})(),H]}),g&&"string"==typeof g?(0,_o.jsx)("text",{x:r/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",fontSize:14,className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:g}):g?(0,_o.jsx)("foreignObject",{x:0,y:0,width:r,height:o.top,children:g}):null,Ur({legend:m,totalWidth:r,totalHeight:i,margin:o,legendPosition:w,title:g,legendLayout:A,axisChrome:{hasAxis:!!a,hasAxisLabel:!!c,rotatedTicks:K},legendHoverBehavior:x,legendClickBehavior:v,legendHighlightedCategory:b,legendIsolatedCategories:k})]}):null}var jo=p(require("react")),To=require("d3-shape");function Do(e,t,n){let r=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(r=n.color):e>n.value&&(r=n.color);return r}function Lo(e,t,n,r){if(2>e.length||t.length!==e.length||0===n.length)return[];const i=[],o=(e,t,n)=>{const r=i[i.length-1];r?.color===e?r.path.push(n):i.push({color:e,path:[t,n]})};for(let i=1;e.length>i;i++){const[s,a]=e[i-1],[l,c]=e[i],u=t[i-1],h=t[i]-u,d=[0,...0===h?[]:n.map(({value:e})=>(e-u)/h).filter(e=>e>0&&1>e&&Number.isFinite(e)).sort((e,t)=>e-t).filter((e,t,n)=>0===t||e!==n[t-1]),1];for(let e=1;d.length>e;e++){const t=d[e-1],i=d[e];o(Do(u+h*((t+i)/2),n,r),[s+(l-s)*t,a+(c-a)*t],[s+(l-s)*i,a+(c-a)*i])}}return i}function Eo(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}var No=require("react/jsx-runtime"),Io={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function Wo(e,t="#4e79a7"){return Un(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}function $o(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}function zo(e,t,n,r){const i=e.glyph;if(!i?.parts?.length||0>=e.size)return null;const o=Dn(i,e.size);if(0>=o.scale)return null;const s=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${o.offsetX},${o.offsetY}) scale(${o.scale})`,a=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=In(i,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?$o(r+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),h=t=>i.parts.map((n,r)=>{const i=t?"none"===n.fill?void 0:t:Ln(n.fill,a,e.accent),o=t?n.stroke&&"none"!==n.stroke?t:void 0:Ln(n.stroke??"none",a,e.accent);return i||o?(0,No.jsx)("path",{d:n.d,fill:i??"none",stroke:o,strokeWidth:o?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},r):null});return(0,No.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,No.jsx)("clipPath",{id:c,children:(0,No.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,No.jsx)("g",{children:h(e.ghostColor)}):null,l&&c?(0,No.jsx)("g",{clipPath:`url(#${c})`,children:h()}):h()]},r)}function Oo(e,t){const n=e.filter(e=>Number.isFinite(e.offset)&&(null==e.opacity||Number.isFinite(e.opacity))).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color??t,opacity:null==e.opacity?void 0:Math.max(0,Math.min(1,e.opacity))}));return 2>n.length?null:n.map((e,t)=>(0,No.jsx)("stop",{offset:e.offset,stopColor:e.color,stopOpacity:e.opacity},t))}var Fo=p(require("react")),Bo=require("d3-shape"),Yo=require("react/jsx-runtime"),Ho=require("react/jsx-runtime");function Xo(e,t,n,r){if(!e||2>t.length)return null;const i=Oo(e.stops,r);return i?(0,Ho.jsx)("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:t[0][0],y1:0,x2:t[t.length-1][0],y2:0,children:i}):null}var qo="undefined"==typeof window||"undefined"==typeof document,Go=require("react"),Vo="undefined"!=typeof window?Go.useLayoutEffect:Go.useEffect;function Uo(){const[e,t]=(0,Go.useState)(!1);return Vo(()=>{t(!0)},[]),e}var Ko=()=>()=>{},Qo=()=>!1,Zo=()=>!0;function Jo(){const e=(0,Go.useSyncExternalStore)(Ko,Qo,Zo);return(0,Go.useRef)(e).current}var es=require("react");function ts(e){const t=(0,es.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return rs(e,t);if(!is(e)||!is(t))return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;const n=e[r],i=t[r];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!rs(n,i))return!1}else{if(!is(n)||!is(i))return!1;if(!ns(n,i))return!1}}return!0}(t.current,e)||(t.current=e),t.current}function ns(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;if(!Object.is(e[r],t[r]))return!1}return!0}function rs(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function is(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function os(e){const{background:t,hasBackgroundGraphics:n=!1,themeBackground:r=""}=e;return"transparent"===t||n?null:t||(r&&"transparent"!==r?r:"")||null}function ss(e,t){const{background:n,hasBackgroundGraphics:r=!1,themeBackground:i="",x:o=0,y:s=0,width:a,height:l}=t,c=os({background:n,hasBackgroundGraphics:r,themeBackground:i});if(!c)return!1;const u=Xn(e,c);return!!u&&(e.fillStyle=u,e.fillRect(o,s,a,l),!0)}var as={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff",background:""};function ls(e,t){const n=e.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const e=n[1],r=n[2],i=n[3];return`#${e}${e}${r}${r}${i}${i}${t}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${t}`;const r=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return r?`rgba(${r[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:n}var cs=p(require("react")),us=p(require("react")),hs=(require("react/jsx-runtime"),us.createContext(null));function ds(){return us.useContext(hs)}var fs=require("react/jsx-runtime"),ys={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function ps({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return(0,fs.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:ys,children:t})}function gs(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e))n.startsWith("_")||null!=r&&""!==r&&("number"==typeof r?Number.isFinite(r)&&(t[n]=r):"string"==typeof r?t[n]=r:"boolean"==typeof r?t[n]=r+"":r instanceof Date&&(t[n]=r.toISOString().slice(0,10)));return t}function ms(e){return e&&"object"==typeof e?e:{}}function xs(e){return ms(e.accessibility).tableFields??e.accessibleDatum??e.datum}var vs=require("react/jsx-runtime");function bs(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const r=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},o=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=o.indexOf(e),r=o.indexOf(t);return(-1===n?999:n)-(-1===r?999:r)});for(const e of s)r.push(`${n[e]} ${i[e]||e}`);return`${t}, ${r.join(", ")}`}function ks(e,t,n){const r=[];return e>0&&r.push(e+" nodes"),t>0&&r.push(t+" edges"),0===r.length?n+", empty":`${n}, ${r.join(", ")}`}var ws=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},As="semiotic-accessible-data-table",Ss=As+" semiotic-accessible-data-table-hidden",_s=As+" semiotic-accessible-data-table-visible",Ms=_s+" semiotic-accessible-data-table-network",Cs={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},Ps={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Rs={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},js={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Ts={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},Ds={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Ls={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Es={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"};function Ns({scene:e,chartType:t,tableId:n,chartTitle:r}){const[i,o]=cs.useState(!1),[s,a]=cs.useState(5),l=ds(),c=l?.visible??!1,u=i||c,h=cs.useRef(null),d=r?"Data summary for "+r:n?`Data summary for ${t} ${n}`:"Data summary for "+t;cs.useEffect(()=>{u||a(5)},[u]);const f=cs.useCallback(e=>{e.target===e.currentTarget&&(i||c||o(!0))},[i,c]),y=cs.useCallback(e=>{c||h.current?.contains(e.relatedTarget)||o(!1)},[c]);if(!e||0===e.length)return n?(0,vs.jsx)("span",{id:n,tabIndex:-1,style:ys}):null;if(!u)return(0,vs.jsx)("div",{id:n,className:Ss,tabIndex:-1,onFocus:f,style:ys,role:"region","aria-label":d,children:(0,vs.jsxs)("button",{type:"button",onClick:()=>o(!0),children:["View data summary (",e.length," elements)"]})});const p=function(e){const t=[];if(!Array.isArray(e))return t;const n=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const r of e)if(r&&"object"==typeof r&&null!==r.datum)try{switch(r.type){case"point":if(n)break;t.push({label:"Point",values:gs(xs(r))});break;case"line":case"area":{const e=xs(r),n=Array.isArray(e)?e:[],i="line"===r.type?"Line point":"Area point";for(const e of n)t.push({label:i,values:gs(e)});break}case"rect":{const e=xs(r),n=null!=e&&"object"==typeof e?e:{},i=n.category??r.group??"",o=n.value??n.__aggregateValue??n.total,s=gs(n);null==s.category&&""!==i&&(s.category=i+""),null==s.value&&null!=o&&(s.value="number"==typeof o||"string"==typeof o?o:o+""),t.push({label:"Bar",values:s});break}case"heatcell":{const e=gs(xs(r));null==e.value&&"number"==typeof r.value&&Number.isFinite(r.value)&&(e.value=r.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=xs(r),n=gs(e);if(null==n.category){const t=ms(e),r=t.category??t.label;null!=r&&(n.category=r+"")}t.push({label:"Wedge",values:n});break}case"circle":t.push({label:"Node",values:gs(xs(r))});break;case"arc":t.push({label:"Arc",values:gs(xs(r))});break;case"candlestick":t.push({label:"Candlestick",values:gs(xs(r))});break;case"geoarea":{const e=ms(xs(r)),n=gs(e);if(null==n.name){const t=ms(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}(e),g=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const r of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[r];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],o=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),o+=n;n.push({name:r,count:t.length,numeric:!0,min:e,max:i,mean:o/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:r,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(p),m=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${ws(e.min)} to ${ws(e.max)}, mean ${ws(e.mean)}.`);else{const t=e.uniqueValues,r=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${r}.`)}return n.join(" ")}(p.length,g),x=Math.min(s,p.length),v=p.slice(0,x),b=p.length-x,k=new Set;for(const e of v)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return(0,vs.jsxs)("div",{ref:h,id:n,className:_s,tabIndex:-1,onBlur:y,style:Cs,role:"region","aria-label":d,children:[(0,vs.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),o(!1)},"aria-label":"Close data summary",style:Rs,children:"×"}),(0,vs.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Ps,children:m}),(0,vs.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:js,children:[(0,vs.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:Ls,children:b>0?`First ${x} of ${p.length} data points`:`All ${p.length} data points`}),(0,vs.jsx)("thead",{children:(0,vs.jsxs)("tr",{children:[(0,vs.jsx)("th",{style:Ts,children:"type"}),w.map(e=>(0,vs.jsx)("th",{style:Ts,children:e},e))]})}),(0,vs.jsx)("tbody",{children:v.map((e,t)=>(0,vs.jsxs)("tr",{children:[(0,vs.jsx)("td",{style:Ds,children:e.label}),w.map(t=>{return(0,vs.jsx)("td",{style:Ds,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":ws(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),b>0&&(0,vs.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:Es,children:["Show ",Math.min(25,b)," more"," ",1===b?"row":"rows"," (",b," remaining)"]})]})}function Is({nodes:e,edges:t,chartType:n,tableId:r,chartTitle:i}){const[o,s]=cs.useState(!1),[a,l]=cs.useState(5),c=ds(),u=c?.visible??!1,h=o||u,d=i?"Data summary for "+i:r?`Data summary for ${n} ${r}`:"Data summary for "+n,f=cs.useRef(null);cs.useEffect(()=>{h||l(5)},[h]);const y=cs.useCallback(e=>{e.target===e.currentTarget&&(o||u||s(!0))},[o,u]),p=cs.useCallback(e=>{u||f.current?.contains(e.relatedTarget)||s(!1)},[u]);if(!e||0===e.length)return r?(0,vs.jsx)("span",{id:r,tabIndex:-1,style:ys}):null;if(!h)return(0,vs.jsx)("div",{id:r,className:Ss,tabIndex:-1,onFocus:y,style:ys,role:"region","aria-label":d,children:(0,vs.jsxs)("button",{type:"button",onClick:()=>s(!0),children:["View data summary (",e.length," nodes, ",t.length," edges)"]})});const g=Array.isArray(e)?e:[],m=Array.isArray(t)?t:[],x=new Map,v=new Map,b=new Map,k=new Map;for(const e of m){if(!e||"object"!=typeof e)continue;const t=e.datum??{source:e.source,target:e.target},n="object"==typeof t.source?t.source?.id:t.source,r="object"==typeof t.target?t.target?.id:t.target,i="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=n&&""!==n){const e=n+"";v.set(e,(v.get(e)??0)+1),k.set(e,(k.get(e)??0)+i)}if(null!=r&&""!==r){const e=r+"";x.set(e,(x.get(e)??0)+1),b.set(e,(b.get(e)??0)+i)}}const w=[];for(let e=0;g.length>e;e++){const t=g[e];if(!t||"object"!=typeof t)continue;const n=t.datum?.id??t.id,r=null!=n?n+"":"node-"+e,i=x.get(r)??0,o=v.get(r)??0,s=b.get(r)??0,a=k.get(r)??0;w.push({id:r,degree:i+o,inDeg:i,outDeg:o,wDegree:s+a,wInDeg:s,wOutDeg:a})}w.sort((e,t)=>t.degree-e.degree);let A=0,S=0;if(w.length>0){let e=0;for(const t of w)e+=t.degree,t.degree>S&&(S=t.degree);A=e/w.length}const _=m.some(e=>{const t=e?.datum??{source:e?.source,target:e?.target};return"number"==typeof t?.value&&Number.isFinite(t.value)}),M=[`${w.length} nodes, ${m.length} edges.`];w.length>0&&M.push(`Mean degree: ${ws(A)}, max degree: ${S}.`);const C=Math.min(a,w.length),P=w.slice(0,C),R=w.length-C;return(0,vs.jsxs)("div",{ref:f,id:r,className:Ms,tabIndex:-1,onBlur:p,style:Cs,role:"region","aria-label":d,children:[(0,vs.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{u&&c&&c.setVisible(!1),s(!1)},"aria-label":"Close data summary",style:Rs,children:"×"}),(0,vs.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Ps,children:M.join(" ")}),(0,vs.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+n,style:js,children:[(0,vs.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:Ls,children:R>0?`Top ${C} of ${w.length} nodes by degree`:`All ${w.length} nodes by degree`}),(0,vs.jsx)("thead",{children:(0,vs.jsxs)("tr",{children:[(0,vs.jsx)("th",{style:Ts,children:"id"}),(0,vs.jsx)("th",{style:Ts,children:"degree"}),(0,vs.jsx)("th",{style:Ts,children:"in"}),(0,vs.jsx)("th",{style:Ts,children:"out"}),_&&(0,vs.jsx)("th",{style:Ts,children:"w. degree"}),_&&(0,vs.jsx)("th",{style:Ts,children:"w. in"}),_&&(0,vs.jsx)("th",{style:Ts,children:"w. out"})]})}),(0,vs.jsx)("tbody",{children:P.map((e,t)=>(0,vs.jsxs)("tr",{children:[(0,vs.jsx)("td",{style:Ds,children:e.id}),(0,vs.jsx)("td",{style:Ds,children:e.degree}),(0,vs.jsx)("td",{style:Ds,children:e.inDeg}),(0,vs.jsx)("td",{style:Ds,children:e.outDeg}),_&&(0,vs.jsx)("td",{style:Ds,children:ws(e.wDegree)}),_&&(0,vs.jsx)("td",{style:Ds,children:ws(e.wInDeg)}),_&&(0,vs.jsx)("td",{style:Ds,children:ws(e.wOutDeg)})]},t))})]}),R>0&&(0,vs.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>l(e=>e+25),style:Es,children:["Show ",Math.min(25,R)," more"," ",1===R?"node":"nodes"," (",R," remaining)"]})]})}function Ws({summary:e}){return e?(0,vs.jsx)("div",{role:"note",style:ys,children:e}):null}function $s({tableId:e}){return(0,vs.jsx)("a",{href:"#"+e,style:ys,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,ys)},children:"Skip to data table"})}var zs=require("react/jsx-runtime"),Os="var(--semiotic-focus, #005fcc)";function Fs({active:e,hoverPoint:t,margin:n,size:r,shape:i="circle",width:o,height:s,pathData:a}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==i&&"path"!==i||!a)if("rect"===i&&null!=o&&null!=s){const e=Math.max(o,4),t=Math.max(s,4);u=(0,zs.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Os,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,zs.jsx)("circle","wedge"===i?{cx:l,cy:c,r:12,fill:"none",stroke:Os,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Os,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,zs.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:(0,zs.jsx)("path",{d:a,fill:"none",stroke:Os,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,zs.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var Bs=p(require("react"));function Ys(e,t){return"touch"===t?Math.max(e,24):e}function Hs(e){return Array.isArray(e)?e[0]:e}function Xs(e,t,n,r){return{data:Hs(e),x:t,y:n,__semioticHoverData:!0,...r}}var qs=["name","label","title"],Gs=["type","kind","category","group","class","status","role","shape"],Vs=["value","amount","total","count","weight","score"],Us=new Set(["x","y","z","x0","x1","y0","y1","r","cx","cy","radius","layer","row","rowindex","col","column","depth","index","order","sankeywidth","coincidentpoints","sourcelinks","targetlinks","parent","children","fx","fy","vx","vy"]);function Ks(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}function Qs(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const n=t.maxEntries??6,r=!1!==t.skipPositional,i=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(r&&Us.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&i.push({key:t,lower:t.toLowerCase(),value:n})}if(0===i.length)return{entries:[]};let o=i.findIndex(e=>qs.includes(e.lower));const s=o>=0;0>o&&(o=i.findIndex(e=>"id"===e.lower)),0>o&&(o=i.findIndex(e=>"string"==typeof e.value));const a=0>o?void 0:i[o];let l=i.filter((e,t)=>t!==o);s&&(l=l.filter(e=>"id"!==e.lower));const c=Ks(l,Gs),u=Ks(l,Vs),h=new Set(Gs),d=new Set(Vs),f=[];c&&f.push({key:c.key,value:c.value}),u&&f.push({key:u.key,value:u.value});for(const e of l){if(f.length>=n)break;e!==c&&e!==u&&(h.has(e.lower)||d.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:a?.key,title:a?.value,entries:f}}require("react/jsx-runtime");var Zs={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"},Js=require("react/jsx-runtime");function ea({x:e,y:t,containerWidth:n,containerHeight:r,margin:i,children:o,className:s="stream-frame-tooltip",zIndex:a=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=Bs.useRef(null),[u,h]=Bs.useState(null);Bs.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&h(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[s,n,r,l]);let d;d=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*r>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!Bs.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if(!0===n["data-semiotic-tooltip-chrome"])return!0;if("true"===n["data-semiotic-tooltip-chrome"])return!0;const r=n.style;if(r&&"object"==typeof r){if(null!=r.background&&""!==r.background&&"transparent"!==r.background)return!0;if(null!=r.backgroundColor&&""!==r.backgroundColor&&"transparent"!==r.backgroundColor)return!0}return!1}(o),y=f?null:Zs;return l?(0,Js.jsx)("div",{ref:c,className:f?s:(s+" semiotic-tooltip").trim(),style:{...y||{},position:"absolute",left:i.left+e,top:i.top+t,transform:d,pointerEvents:"none",zIndex:a,width:"max-content"},children:o}):null}var ta=p(require("react")),na=require("react"),ra=require("react");var ia=require("react"),oa=()=>"undefined"!=typeof performance?performance.now():Date.now();function sa(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}function aa(e,t){const n=e();return Number.isFinite(n)?n:t}var la=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??oa,this.lastWallTime=aa(this.clock,0),this.logicalTime=this.lastWallTime,this.pausedValue=!0===e.paused,this.visibleValue=!1!==e.visible,this.setRandomSource(e.random,e.seed)}get isActive(){return!this.pausedValue&&this.visibleValue}get paused(){return this.pausedValue}get seed(){return this.seedValue}get visible(){return this.visibleValue}configure(e){this.setClock(e.clock),this.setRandomSource(e.random,e.seed)}setPaused(e){this.pausedValue!==e&&(this.advance(),this.pausedValue=e,this.emit())}setVisible(e){this.visibleValue!==e&&(this.advance(),this.visibleValue=e,this.emit())}snapshot(){return{now:this.now(),paused:this.pausedValue,seed:this.seedValue,visible:this.visibleValue}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}advance(){const e=aa(this.clock,this.lastWallTime),t=Math.max(0,e-this.lastWallTime);return this.lastWallTime=e,this.isActive&&(this.logicalTime+=t),this.logicalTime}emit(){for(const e of this.subscribers)e()}setClock(e){const t=e??oa;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=aa(t,this.lastWallTime))}setRandomSource(e,t){const n=function(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}(t);e===this.randomInput&&n===this.seedValue||(this.randomInput=e,this.seedValue=n,this.randomSource=e??(void 0===n?Math.random:sa(n)))}},ca="undefined"==typeof window?na.useEffect:na.useLayoutEffect,ua={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function ha(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function da(e){const t=function(){const[e,t]=(0,ra.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,ra.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>t(e.matches))},[]),e}(),n=(0,na.useRef)(t);n.current=t;const[r,i]=function(e,t,n){const r=(0,ia.useRef)(null),[i,o]=(0,ia.useState)(null);return(0,ia.useEffect)(()=>{if(!t&&!n)return;const e=r.current;if(!e)return;const i=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;o(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return i.observe(e),()=>i.disconnect()},[t,n]),[r,[t&&i?i.w:e[0],n&&i?i.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),o=!!e.title,s=!!e.legend&&"top"===e.legendPosition,a=(0,na.useMemo)(()=>function(e,t,n=!1){const r=n?t?58:34:t?36:0;return r>e.top?{...e,top:r}:e}({...e.marginDefault,...e.userMargin},o,s),[e.marginDefault,e.userMargin,o,s]),l=i[0]-a.left-a.right,c=i[1]-a.top-a.bottom,u=ha(e.foregroundGraphics,i,a),h=ha(e.backgroundGraphics,i,a),d=V(e=>e.theme),{transition:f,introEnabled:y}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(n||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),p="semiotic-table-"+ta.useId(),g=(0,na.useRef)(null);if(!g.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;g.current=new la({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const m=g.current;m.configure({clock:e.clock,random:e.random,seed:e.seed});const x=(0,na.useRef)(null),v=(0,na.useRef)(e.frameScheduler??ua);v.current=e.frameScheduler??ua;const b=(0,na.useRef)(null),k=(0,na.useRef)(!1),w=(0,na.useRef)(()=>{}),A=(0,na.useCallback)(()=>{if(null!==x.current||k.current)return;const e=v.current;let t=!1,n=!1;const r=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(k.current=!0),x.current=null,b.current=null;try{w.current()}finally{e&&(k.current=!1)}});n=!0,t||(x.current=r,b.current=e)},[]),S=(0,na.useCallback)(()=>{null!==x.current&&((b.current??v.current).cancelAnimationFrame(x.current),x.current=null,b.current=null)},[]);ca(()=>{m.setPaused(!0===e.paused)},[m,e.paused]),(0,na.useEffect)(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void m.setVisible(!0);const t=()=>m.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[m,e.suspendWhenHidden]),(0,na.useEffect)(()=>()=>{S()},[S]);const _=(0,na.useRef)(()=>{}),M=(0,na.useRef)(()=>{}),C=(0,na.useRef)(null),P=(0,na.useRef)(null),R=(0,na.useRef)(null),j=(0,na.useCallback)(()=>{const e=C.current;C.current=null,e&&_.current(e)},[]),T=(0,na.useCallback)(e=>{if(C.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===P.current){const e=v.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,P.current=null,R.current=null,j()});t||(P.current=n,R.current=e)}},[j]),D=(0,na.useCallback)(()=>{C.current=null,null!==P.current&&((R.current??v.current).cancelAnimationFrame(P.current),P.current=null,R.current=null),M.current()},[]);(0,na.useEffect)(()=>()=>{C.current=null,null!==P.current&&((R.current??v.current).cancelAnimationFrame(P.current),P.current=null,R.current=null)},[]);const L=e.themeDirtyRef;return ca(()=>{L&&(Fn++,L.current=!0,A())},[d,A,L]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:r,size:i,margin:a,adjustedWidth:l,adjustedHeight:c,resolvedForeground:u,resolvedBackground:h,currentTheme:d,transition:f,introEnabled:y,tableId:p,frameRuntime:m,rafRef:x,renderFnRef:w,scheduleRender:A,cancelRender:S,hoverHandlerRef:_,hoverLeaveRef:M,onPointerMove:T,onPointerLeave:D}}var fa=require("react");function ya(e,t,n,r){const i=e.getContext("2d");if(!i)return null;const o=Math.round(t[0]*r),s=Math.round(t[1]*r),a=o/t[0],l=s/t[1],c=t[0]+"px",u=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==u&&(e.style.height=u),e.width===o&&e.height===s||(e.width=o,e.height=s),i.setTransform(a,0,0,l,0,0),i.translate(n.left,n.top),i}function pa(e){if("undefined"==typeof window)return 1;const t=window.devicePixelRatio||1,n=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(t,"number"==typeof e&&e>0?e:n))}var ga=require("react/jsx-runtime");function ma(e){const{cancelRender:t,dirtyRef:n,frameRuntime:r,manageFrameRuntime:i,maxDevicePixelRatio:o,scheduleRender:s}=e,a=(0,fa.useRef)(null),l=(0,fa.useRef)(null),c=(0,fa.useRef)(!1),u=(0,fa.useRef)(!1),h=(0,fa.useRef)(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:r,dirtyRef:i,renderFnRef:o,cancelRender:s,cleanup:a}=e;Vo(()=>{const e=r.current;t&&n&&e?.cancelIntroAnimation?.(),!n&&e?.sceneNodes&&e.sceneNodes.length>0&&e?.markStylePaintPending?e.markStylePaintPending():i.current=!0,s?.(),o.current()},[t,n]);const l=(0,Go.useRef)(a);l.current=a,(0,Go.useEffect)(()=>()=>l.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),(0,fa.useEffect)(()=>{if(!1!==i)return r.subscribe(()=>{r.isActive?(n.current=!0,s()):t()})},[t,n,r,i,s]),(0,fa.useEffect)(()=>function(){if("undefined"==typeof window||"function"!=typeof window.matchMedia)return()=>{};let e=null,t=!1;const n=()=>{e&&("function"==typeof e.removeEventListener?e.removeEventListener("change",i):"function"==typeof e.removeListener&&e.removeListener(i))},r=()=>{const t=`(resolution: ${window.devicePixelRatio||1}dppx)`;e=window.matchMedia(t),e.media.includes("resolution")?"function"==typeof e.addEventListener?e.addEventListener("change",i):"function"==typeof e.addListener&&e.addListener(i):e=null};function i(){t||(n(),e=null,c.current=!0,s(),queueMicrotask(()=>{t||r()}))}return r(),()=>{t=!0,n(),e=null}}(),[s]),(0,fa.useEffect)(()=>{h.current?(c.current=!0,s()):h.current=!0},[o,s]),(0,fa.useEffect)(()=>{!u.current&&(u.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.canvasPaintInvalidator?e.canvasPaintInvalidator():e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:a,interactionCanvasRef:l,resolutionDirtyRef:c}}function xa(e,t){return ma({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}function va({children:e,size:t,margin:n,overflowVisible:r=!1}){return e?(0,ga.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:r?"visible":void 0},children:(0,ga.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}function ba(e,t,n,r){return"function"==typeof e?e({size:t,margin:n,scales:r}):e}var ka=require("react");function wa(e,t,n,r){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:r,fn:t}:{key:void 0,fn:null}}var Aa=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Sa=3156e7;function _a(e){const t=e[1]-e[0];return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:Sa>t?e=>{const t=new Date(e);return`${Aa[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*Sa>t?e=>{const t=new Date(e);return`${Aa[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}function Ma(e){if(!e)return;const t=[];for(const n of e)if("point"===n.type)t.push(n);else if("symbol"===n.type)t.push({pointId:n.pointId,x:n.x,y:n.y,r:pt(n.size)});else if("glyph"===n.type){const e=Wn(n.glyph,n.size);t.push({pointId:n.pointId,x:n.x+e.centerDx,y:n.y+e.centerDy,r:e.radius})}return t}var Ca=require("d3-shape");function Pa(e,t,n,r,i,o){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],r=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+r*r))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=r,e.lineCap=o;for(let n=0;t.length-1>n;n++){const r=(s[n]+s[n+1])/2;let o=i;l>r&&(o*=r/l),l>a-r&&(o*=(a-r)/l),e.globalAlpha=Math.max(0,o),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}var Ra=(e,t,n,r)=>{const i=t.filter(e=>"line"===e.type);for(const t of i){if(2>t.path.length)continue;const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,r.width*n,r.height),e.clip());const i=t.style.stroke||"#007bff",o=Xn(e,i)||i,s=t.style.strokeWidth||2,a=t.colorThresholds,l=t.rawValues;if(e.setLineDash(t.style.strokeDasharray?t.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),e.lineWidth=s,e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade){Pa(e,t.path,o,s,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=tr(t.curve),u=a&&a.length>0&&l&&l.length===t.path.length,h=t._decayOpacities;if(h&&h.length===t.path.length&&!u){e.strokeStyle=o;const n=t.style.opacity??1;for(let r=0;t.path.length-1>r;r++)e.globalAlpha=.5*(h[r]+h[r+1])*n,e.beginPath(),e.moveTo(t.path[r][0],t.path[r][1]),e.lineTo(t.path[r+1][0],t.path[r+1][1]),e.stroke()}else if(u){const n=Lo(t.path,l,a,o);for(const t of n){e.beginPath(),e.strokeStyle=Xn(e,t.color)||t.color,e.moveTo(t.path[0][0],t.path[0][1]);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1]);e.stroke()}}else{e.beginPath();const n=t.strokeGradient&&t.path.length>=2?rr(e,t.strokeGradient,o,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=n||o,c)(0,Ca.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,r]=t.path[0];e.moveTo(n,r);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}e.stroke()}if(t.style.fill&&t.style.fillOpacity&&t.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=t.style.fillOpacity,e.fillStyle=nr(e,t.style.fill,t.style.fill),c&&!u)(0,Ca.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,r]=t.path[0];e.moveTo(n,r);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}const n=t.path[0][0];e.lineTo(t.path[t.path.length-1][0],r.height),e.lineTo(n,r.height),e.closePath(),e.fill()}void 0!==n&&1>n&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function ja(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Ta(e,t,n=.3){ja(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function Da(e,t,n=.6){if(!ja(t))return;const r=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,i=t.cx??t.x??0,o=t.cy??t.y??0;e.beginPath(),e.arc(i,o,r,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function La(e,t,n,r=.35){ja(t)&&(e.globalAlpha=t._pulseIntensity*r,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}var Ea=require("d3-shape");function Na(e,t){const n=tr(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const r=(0,Ea.area)().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),r(t.topPath)}}function Ia(e,t){const n=tr(t.curve);if(e.beginPath(),n)(0,Ea.line)().x(e=>e[0]).y(e=>e[1]).curve(n).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}}var Wa=(e,t,n,r)=>{const i=t.filter(e=>"area"===e.type);for(const t of i){if(2>t.topPath.length)continue;let n=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),n=!0);const i=t._introClipFraction;void 0!==i&&1>i&&(e.save(),e.beginPath(),e.rect(0,0,r.width*i,r.height),e.clip());const o=nr(e,t.style.fill,"#4e79a7"),s=t._decayOpacities,a=!(!t.colorThresholds?.length||!t.rawValues||t.rawValues.length!==t.topPath.length),l=!!t.strokeColorBands?.length;if(s&&s.length===t.topPath.length&&!a&&!l){const n=t.style.fillOpacity??.7;e.fillStyle=o;for(let r=0;t.topPath.length-1>r;r++)e.globalAlpha=.5*(s[r]+s[r+1])*n,e.beginPath(),e.moveTo(t.topPath[r][0],t.topPath[r][1]),e.lineTo(t.topPath[r+1][0],t.topPath[r+1][1]),e.lineTo(t.bottomPath[r+1][0],t.bottomPath[r+1][1]),e.lineTo(t.bottomPath[r][0],t.bottomPath[r][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=Xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(s[n]+s[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const c=t.style.opacity??1;if(Na(e,t),t.fillGradient&&t.fillGradient.stops.length>=2&&t.fillGradient){let n=1/0;for(const e of t.topPath)n>e[1]&&(n=e[1]);let r=-1/0;for(const e of t.bottomPath)e[1]>r&&(r=e[1]);const i=rr(e,t.fillGradient,"string"==typeof o?o:"#4e79a7",0,n,0,r);e.fillStyle=i||o,e.globalAlpha=c}else e.globalAlpha=(t.style.fillOpacity??.7)*c,e.fillStyle=o;if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(Na(e,t),La(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=c;const n=Xn(e,t.style.stroke)||t.style.stroke,r=a||l||!t.strokeGradient||2>t.topPath.length?null:rr(e,t.strokeGradient,n,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0);if(e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]),l){let r=1/0,i=-1/0;for(const[e]of t.topPath)r=Math.min(r,e),i=Math.max(i,e);const o=e.lineWidth;for(const s of t.strokeColorBands){e.save(),e.beginPath(),e.rect(r-o,s.y,i-r+2*o,s.height),e.clip();const a=s.color??n;e.strokeStyle=Xn(e,a)||a,Ia(e,t),e.stroke(),e.restore()}}else if(a){const r=Lo(t.topPath,t.rawValues,t.colorThresholds,n);for(const t of r){e.beginPath(),e.strokeStyle=Xn(e,t.color)||t.color,e.moveTo(t.path[0][0],t.path[0][1]);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1]);e.stroke()}}else e.strokeStyle=r||n,Ia(e,t),e.stroke()}void 0!==i&&1>i&&e.restore(),n&&e.restore(),e.globalAlpha=1}},$a=(e,t,n,r)=>{const i=t.filter(e=>"point"===e.type);if(0!==i.length){e.save();try{const t=e.globalAlpha;for(const n of i)e.beginPath(),e.arc(n.x,n.y,n.r,0,2*Math.PI),e.globalAlpha=t*(n.style.opacity??n.style.fillOpacity??1),e.fillStyle=nr(e,n.style.fill,"#4e79a7"),e.fill(),n.style.stroke&&"none"!==n.style.stroke&&(e.strokeStyle=nr(e,n.style.stroke,n.style.stroke),e.lineWidth=n.style.strokeWidth||1,e.stroke()),Da(e,n)}finally{e.restore()}}},za=new Map;function Oa(e,t,n,r,i,o){if(0>=t.size)return;const s=function(e,t,n){try{if(n)return new Path2D(n);const r=`${e??"circle"}:${Math.round(t)}`;let i=za.get(r);return i||(i=new Path2D(yt(e,t)),za.size>256&&za.clear(),za.set(r,i)),i}catch{return null}}(t.symbolType,t.size,t.path);if(!s)return;e.save(),e.translate(n,r),t.rotation&&e.rotate(t.rotation);const a=(t.style.opacity??1)*(t._decayOpacity??1);t.style.fill&&(e.globalAlpha=i*a*(t.style.fillOpacity??1),e.fillStyle=nr(e,t.style.fill,o),e.fill(s)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=i*a,e.strokeStyle=Xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.stroke(s)),e.restore()}var Fa=(e,t)=>{const n=e.globalAlpha;for(const r of t)"symbol"===r.type&&Oa(e,r,r.x,r.y,n,"#4e79a7");e.globalAlpha=n};function Ba(e,t,n,r,i){if(0>=t.size)return;const o=t.glyph;if(!o||!o.parts?.length)return;const s=Dn(o,t.size);if(0>=s.scale)return;const a=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=a)return;const l=t=>{const n=nr(e,t,t);return"string"==typeof n?n:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(n,r),t.rotation&&e.rotate(t.rotation),e.translate(s.offsetX,s.offsetY),e.scale(s.scale,s.scale),e.globalAlpha=i*a*(t.style.fillOpacity??1);const u=In(o,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&$n(e,o,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),$n(e,o,c,t.accent,void 0,l),e.restore()}function Ya(e,t){const{x:n,y:r,w:i,h:o}=t,{tl:s,tr:a,br:l,bl:c}=function(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,r=e=>Math.max(0,Math.min(e??0,n));return{tl:r(t.tl),tr:r(t.tr),br:r(t.br),bl:r(t.bl)}}(t);e.beginPath(),e.moveTo(n+s,r),e.lineTo(n+i-a,r),a>0&&e.arcTo(n+i,r,n+i,r+a,a),e.lineTo(n+i,r+o-l),l>0&&e.arcTo(n+i,r+o,n+i-l,r+o,l),e.lineTo(n+c,r+o),c>0&&e.arcTo(n,r+o,n,r+o-c,c),e.lineTo(n,r+s),s>0&&e.arcTo(n,r,n+s,r,s),e.closePath()}function Ha(e,t){const n=nr(e,t.style.fill,Xn(e,"var(--semiotic-primary, #007bff)")),r=function(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}(t);return(t.fillGradient&&"string"==typeof n?rr(e,t.fillGradient,n,r.x0,r.y0,r.x1,r.y1):null)||n}function Xa(e,t){return!(!t.style.stroke||"none"===t.style.stroke||(e.strokeStyle=Xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,0))}var qa=(e,t,n,r)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)Ga(e,t);else if(t.cornerRadii&&Eo(t.cornerRadii))e.fillStyle=Ha(e,t),Ya(e,t),e.fill(),Xa(e,t)&&e.stroke();else if(t.roundedTop&&t.roundedTop>0){e.fillStyle=Ha(e,t);const n=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:r,y:i,w:o,h:s}=t;switch(t.roundedEdge){case"right":e.moveTo(r,i),e.lineTo(r+o-n,i),e.arcTo(r+o,i,r+o,i+n,n),e.lineTo(r+o,i+s-n),e.arcTo(r+o,i+s,r+o-n,i+s,n),e.lineTo(r,i+s);break;case"left":e.moveTo(r+o,i),e.lineTo(r+n,i),e.arcTo(r,i,r,i+n,n),e.lineTo(r,i+s-n),e.arcTo(r,i+s,r+n,i+s,n),e.lineTo(r+o,i+s);break;case"bottom":e.moveTo(r,i),e.lineTo(r+o,i),e.lineTo(r+o,i+s-n),e.arcTo(r+o,i+s,r+o-n,i+s,n),e.lineTo(r+n,i+s),e.arcTo(r,i+s,r,i+s-n,n);break;default:e.moveTo(r,i+s),e.lineTo(r,i+n),e.arcTo(r,i,r+n,i,n),e.lineTo(r+o-n,i),e.arcTo(r+o,i,r+o,i+n,n),e.lineTo(r+o,i+s)}e.closePath(),e.fill(),Xa(e,t)&&e.stroke()}else e.fillStyle=Ha(e,t),e.fillRect(t.x,t.y,t.w,t.h),Xa(e,t)&&e.strokeRect(t.x,t.y,t.w,t.h);Ta(e,t),e.globalAlpha=1}};function Ga(e,t){const n=t.style.icon,r=t.style.iconPadding||2,i=Math.min(t.w,t.h)-r;if(0>=i)return;const o=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),o){const o=i+r,s=t.x+(t.w-i)/2;for(let r=t.y+t.h-i;r>=t.y-i;r-=o)e.drawImage(n,s,r,i,i)}else{const o=i+r,s=t.y+(t.h-i)/2;for(let r=t.x;t.x+t.w>r;r+=o)e.drawImage(n,r,s,i,i)}e.restore()}function Va(e){const[t,n,r]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*r>128?"#000":"#fff"}function Ua(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}var Ka=(e,t,n,r)=>{const i=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of i){const n=t.style;null!=n?.opacity&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h);const r=Math.max(0,n?.strokeWidth??1);if(r>0&&(e.strokeStyle=Xn(e,n?.stroke??"var(--semiotic-surface, #fff)"),e.lineWidth=r,e.strokeRect(t.x,t.y,t.w,t.h)),Ta(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):Ua(t.value),r=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),i=t.x+t.w/2,o=t.y+t.h/2;e.fillStyle=Va(t.fill),e.font=r+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,i,o)}}}finally{e.restore()}},Qa=(e,t,n,r)=>{for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const i=(t._decayOpacity??1)*(t.style?.opacity??1);1!==i&&(e.globalAlpha=i);const o=Xn(e,t.wickColor)||t.wickColor,s=60>r.height,a=s?Math.max(t.wickWidth,2):t.wickWidth,l=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=o,e.lineWidth=a,e.stroke()};if(s||l(),t.isRange){const n=t.dotRadius??Math.max(2,Math.min(t.bodyWidth/2,.12*r.height));e.fillStyle=o,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),r=Math.abs(t.openY-t.closeY),i=t.isUp?t.upColor:t.downColor,o=Xn(e,i)||i;e.fillStyle=o,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(r,1)),e.strokeStyle=o,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(r,1))}s&&l(),e.restore()}},Za={line:[Wa,Ra,$a],area:[Wa,$a],stackedarea:[Wa,$a],scatter:[$a,Fa],bubble:[$a,Fa],heatmap:[Ka],bar:[qa],swarm:[$a],waterfall:[(e,t,n,r)=>{qa(e,t);const i=t.filter(e=>"rect"===e.type);if(2>i.length)return;const o=i[0].datum,s=o?._connectorStroke;if(s){e.save(),e.strokeStyle=Xn(e,s)||s,e.lineWidth=o?._connectorWidth??1,e.setLineDash([]);for(let t=0;i.length-1>t;t++){const r=i[t],o=i[t+1],s=r.datum,a=o.datum;if(null==s?.cumEnd||null==a?.baseline)continue;const l=n.y(s.cumEnd),c=r.x+r.w,u=o.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[Qa],mixed:[Wa,Ra,$a],custom:[Wa,qa,Ka,Ra,$a,Fa,(e,t)=>{const n=e.globalAlpha;for(const r of t)"glyph"===r.type&&Ba(e,r,r.x,r.y,n);e.globalAlpha=n},Qa]},Ja=new Set;function el(e,t){const n="function"==typeof e?e(t.datum??null,t):e;return(r=n)&&"object"==typeof r&&"string"==typeof r.id&&"function"==typeof r.cacheKey&&"function"==typeof r.drawCanvas&&"function"==typeof r.renderStaticSVG?n:void 0;var r}function tl(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${e}:${t}`;Ja.has(n)||(Ja.add(n),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}function nl(e){const{context:t,nodes:n,renderMode:r,pixelRatio:i,paintBuiltIn:o}=e;if(!r||"sketchy"===r)return void o(n);let s=[];const a=()=>{s.length&&(o(s),s=[])};for(const e of n){const n=el(r,e);if(!n){s.push(e);continue}let l;a(),t.save();try{l=n.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:i})}finally{t.restore()}l||(tl(n.id,e.type??"unknown"),o([e]))}a()}function rl(e){const{node:t,index:n,renderMode:r,fallback:i}=e,o=el(r,t);if(!o)return i();const s=o.renderStaticSVG({node:t,style:t.style??{},key:`${o.id}-${n}`});return null!=s?s:(tl(o.id,t.type??"unknown"),i())}require("react/jsx-runtime");var il=require("react/jsx-runtime");function ol(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function sl({hover:e}){const t=e.data??{},n=t.y??t.value,r=t.x??t.time;if(void 0===n&&void 0===r){const e=Qs(t);if(null!=e.title||e.entries.length>0)return(0,il.jsxs)("div",{className:"semiotic-tooltip",style:Zs,children:[null!=e.title&&(0,il.jsx)("div",{style:{fontWeight:600,marginBottom:e.entries.length?2:0},children:e.title+""}),e.entries.map(e=>(0,il.jsxs)("div",{style:{opacity:.7,fontSize:11},children:[e.key,":"," ",(0,il.jsx)("span",{style:{fontWeight:600},children:ol(e.value)})]},e.key))]})}return(0,il.jsxs)("div",{className:"semiotic-tooltip",style:Zs,children:[(0,il.jsx)("div",{style:{fontWeight:600,marginBottom:2},children:ol(n)}),(0,il.jsx)("div",{style:{opacity:.7,fontSize:11},children:ol(r)})]})}function al(e){return"touch"===e?"touch":"pointer"}function ll(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}function cl(e){const{onObservation:t,datum:n,x:r=0,y:i=0,chartType:o,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:r,y:i,timestamp:l,chartType:o,chartId:s}),"focus"===a?.type&&t({type:"focus",datum:n,inputType:"touch"===a.inputType?"pointer":a.inputType,timestamp:l,chartType:o,chartId:s})):t({type:"hover-end",timestamp:l,chartType:o,chartId:s}))}function ul(e){const{onObservation:t,datum:n,x:r=0,y:i=0,chartType:o,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:r,y:i,timestamp:l,chartType:o,chartId:s}),"activate"===a?.type&&t({type:"activate",datum:n,inputType:a.inputType,timestamp:l,chartType:o,chartId:s})):t({type:"click-end",timestamp:l,chartType:o,chartId:s}))}sl.ownsChrome=!0;var hl=require("react"),dl=require("react");function fl(e){const t=new Map;for(const n of e){const e=n.group??"_default";let r=t.get(e);r||(r=[],t.set(e,r)),r.push(n)}for(const e of t.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const n=Array.from(t.keys()).sort((e,n)=>{const r=t.get(e),i=t.get(n);return(r.length>0?r[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(t.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const i=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=r[e].datum?.id;null!=t&&i.set(t+"",e)}return{flat:r,groups:n,byGroup:t,idToIdx:i}}function yl(e,t){if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const n=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[n];return{flatIndex:n,group:r.group??"_default",indexInGroup:r._groupIndex??0}}function pl(e,t,n){const{group:r,indexInGroup:i}=t,o=n.byGroup.get(r);switch(e){case"ArrowRight":return o.length-1>i?o[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?o[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(r);return n.groups.length-1>e?gl(n,n.groups[e+1],o[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(r);return e>0?gl(n,n.groups[e-1],o[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}function gl(e,t,n){const r=e.byGroup.get(t);let i=0,o=Math.abs(r[0].x-n.x);for(let e=1;r.length>e;e++){const t=Math.abs(r[e].x-n.x);o>t&&(o=t,i=e)}return r[i]._flatIndex}function ml(e){const t=[];for(const n of e)switch(n.type){case"point":t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=n.size)break;t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"glyph":{if(0>=n.size||null==n.datum)break;const e=Wn(n.glyph,n.size);t.push({x:n.x+e.centerDx,y:n.y+e.centerDy,datum:n.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"});break}case"line":{const e=n,r=Array.isArray(e.datum)?e.datum:[],i=e.group??"_default";for(let n=0;e.path.length>n&&r.length>n;n++)t.push({x:e.path[n][0],y:e.path[n][1],datum:r[n],shape:"circle",group:i});break}case"area":{const e=n,r=Array.isArray(e.datum)?e.datum:[],i=e.group??"_default";for(let n=0;e.topPath.length>n&&r.length>n;n++)t.push({x:e.topPath[n][0],y:e.topPath[n][1],datum:r[n],shape:"circle",group:i});break}case"rect":t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.group??"_default"});break;case"heatcell":t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}function xl(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}var vl=require("react/jsx-runtime"),bl={top:20,right:20,bottom:30,left:40},kl=as;function wl(e){if(e)return"x"===e.dimension?"pan-y":"y"===e.dimension?"pan-x":"none"}var Al=(0,M.memo)((0,M.forwardRef)(function(e,t){const{chartType:n,runtimeMode:r,data:i,chunkThreshold:o,chunkSize:s,xAccessor:a,yAccessor:l,accessorRevision:c,colorAccessor:u,sizeAccessor:h,symbolAccessor:d,symbolMap:f,groupAccessor:y,lineDataAccessor:p,curve:g,normalize:m,baseline:x,stackOrder:v,binSize:b,valueAccessor:k,arrowOfTime:w="right",windowMode:A="sliding",windowSize:S=200,timeAccessor:C,xExtent:P,yExtent:R,extentPadding:j=.1,scalePadding:D,sizeRange:N,size:I=[500,300],responsiveWidth:W,responsiveHeight:$,margin:z,className:F,background:B,maxDevicePixelRatio:Y,renderMode:H,lineStyle:X,pointStyle:q,areaStyle:G,barStyle:V,waterfallStyle:U,swarmStyle:K,barColors:Q,colorScheme:Z,boundsAccessor:J,boundsStyle:ee,y0Accessor:te,band:ne,gradientFill:re,lineGradient:ie,semanticLineStops:oe,areaGroups:se,openAccessor:ae,highAccessor:le,lowAccessor:ce,closeAccessor:ue,candlestickStyle:he,showAxes:de=!0,axes:fe,xLabel:ye,yLabel:pe,yLabelRight:ge,xFormat:me,yFormat:xe,axisExtent:ve,tickFormatTime:be,tickFormatValue:ke,hoverAnnotation:we,tooltipContent:Ae,customHoverBehavior:Se,customClickBehavior:_e,onObservation:Me,annotationObservationCallback:Ce,chartId:Pe,enableHover:Re,hoverRadius:je=30,tooltipMode:Te,annotations:De,onAnnotationActivate:Le,autoPlaceAnnotations:Ee,svgAnnotationRules:Ne,showGrid:Ie,legend:We,legendHoverBehavior:$e,legendClickBehavior:ze,legendHighlightedCategory:Oe,legendIsolatedCategories:Fe,legendPosition:Be,legendLayout:Ye,legendCategoryAccessor:He,onCategoriesChange:Xe,backgroundGraphics:qe,foregroundGraphics:Ge,canvasPreRenderers:Ve,svgPreRenderers:Ue,title:Ke,categoryAccessor:Qe,brush:Ze,onBrush:Je,decay:et,pulse:tt,transition:nt,animate:rt,staleness:it,frameScheduler:st,clock:at,random:lt,seed:ut,paused:ht=!1,suspendWhenHidden:dt=!0,heatmapAggregation:ft,heatmapXBins:pt,heatmapYBins:gt,showValues:mt,heatmapValueFormat:xt,marginalGraphics:vt,pointIdAccessor:bt,xScaleType:kt,yScaleType:wt,accessibleTable:At=!0,description:St,summary:_t,linkedCrosshairName:Mt,linkedCrosshairSourceId:Ct,customLayout:Pt,onLayoutError:Rt,layoutConfig:jt,layoutSelection:Tt}=e,{customHoverBehavior:Dt,customClickBehavior:Lt,hasClickBehavior:Et}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:r,chartType:i}){const o=!(!e&&!n),s=!(!t&&!n),a=(0,hl.useCallback)((t,o)=>{e?.(t,o),cl({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:i,chartId:r,context:o})},[r,i,e,n]),l=(0,hl.useCallback)((e,o)=>{t?.(e,o),ul({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:i,chartId:r,context:o})},[r,i,t,n]);return{customHoverBehavior:o?a:void 0,customClickBehavior:s?l:void 0,hasClickBehavior:s}}({customHoverBehavior:Se,customClickBehavior:_e,onObservation:Me,chartId:Pe,chartType:"StreamXYFrame"}),Nt=(0,M.useId)().replace(/:/g,""),It=(0,M.useRef)(!1),Wt=(0,M.useRef)({w:-1,h:-1}),$t=(0,M.useRef)(!1),zt=da({sizeProp:I,responsiveWidth:W,responsiveHeight:$,userMargin:z,marginDefault:bl,title:Ke,legend:We,legendPosition:Be,animate:rt,transitionProp:nt,frameScheduler:st,clock:at,random:lt,seed:ut,paused:ht,suspendWhenHidden:dt,themeDirtyRef:It}),Ot=Uo(),Ft=Jo(),{reducedMotionRef:Bt,responsiveRef:Yt,size:Ht,currentTheme:Xt,transition:qt,introEnabled:Gt,tableId:Vt,rafRef:Ut,renderFnRef:Kt,scheduleRender:Qt,frameRuntime:Zt}=zt;let Jt=zt.margin;if(vt){const e=60,t={...zt.margin};vt.top&&e>t.top&&(t.top=e),vt.bottom&&e>t.bottom&&(t.bottom=e),vt.left&&e>t.left&&(t.left=e),vt.right&&e>t.right&&(t.right=e),Jt=t}const en=Ht[0]-Jt.left-Jt.right,tn=Ht[1]-Jt.top-Jt.bottom,nn=(fe?.find(e=>"left"===e.orient)??fe?.find(e=>"right"===e.orient))?.extent??ve,rn=(0,M.useMemo)(()=>L(i),[i]),sn=we??Re,[an,ln]=(0,M.useState)(0),cn=(0,M.useRef)(0),[un,hn]=(0,M.useState)(null),dn=ba(Ge,Ht,Jt,un),pn=ba(qe,Ht,Jt,un),mn=(0,M.useRef)(null),xn=(0,M.useRef)(null),vn=(0,M.useRef)(void 0),[bn,wn]=(0,M.useState)(null),_n=(0,M.useRef)(kl.primary),Mn=(0,M.useRef)(function(){let e=-1,t=as;return{resolve(n){if(!n)return as;const r=Fn;return r===e||(t=function(e){if(!e)return as;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),r=t.getPropertyValue("--semiotic-text-secondary").trim(),i=t.getPropertyValue("--semiotic-bg").trim(),o=t.getPropertyValue("--semiotic-primary").trim(),s=r||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),l=n||t.getPropertyValue("--surface-3").trim(),c=i||t.getPropertyValue("--surface-0").trim();return s||a||n||o?{axisStroke:l||as.axisStroke,tickText:s||as.tickText,crosshair:s?ls(s,"66"):as.crosshair,hoverFill:c?ls(c,"4D"):as.hoverFill,hoverStroke:s?ls(s,"99"):as.hoverStroke,pointRing:c||as.pointRing,primary:o||as.primary,background:c||as.background}:as}(n),e=r),t},invalidate(){e=-1}}}()),Cn=(0,M.useRef)(!1),Pn=fn("StreamXYFrame"),[Rn,jn]=(0,M.useState)(!1),[Tn,Dn]=(0,M.useState)([]),[Ln,En]=(0,M.useState)([]),Nn="streaming"===r||["bar","swarm","waterfall"].includes(n),In=ts((0,M.useMemo)(()=>{return{chartType:n,runtimeMode:Nn?"streaming":"bounded",windowSize:S,windowMode:A,arrowOfTime:Nn?w:"right",extentPadding:j,scalePadding:D,axisExtent:ve,yAxisExtent:nn,xAccessor:a,yAccessor:l,accessorRevision:c,timeAccessor:Nn?C:void 0,valueAccessor:k,colorAccessor:u,sizeAccessor:h,symbolAccessor:d,symbolMap:f,groupAccessor:y||(p?"_lineGroup":void 0),categoryAccessor:Qe,lineDataAccessor:p,xScaleType:kt,yScaleType:wt,xExtent:P,yExtent:R,sizeRange:N,binSize:b,normalize:m,baseline:x,stackOrder:v,boundsAccessor:J,boundsStyle:ee,y0Accessor:te,band:ne,gradientFill:ct(re),areaGroups:se?new Set(se):void 0,lineGradient:(e=ie,e?ct(e):void 0),semanticLineStops:oe,openAccessor:ae,highAccessor:le,lowAccessor:ce,closeAccessor:ue,candlestickStyle:he,lineStyle:X,pointStyle:q,areaStyle:G,swarmStyle:K,waterfallStyle:U,colorScheme:Z,barColors:Q,barStyle:V,annotations:De,decay:et,pulse:tt,transition:qt,introAnimation:Gt,staleness:it,clock:Zt.now,heatmapAggregation:ft,heatmapXBins:pt,heatmapYBins:gt,showValues:mt,heatmapValueFormat:xt,pointIdAccessor:bt,curve:g,themeCategorical:Xt?.colors?.categorical,themeSemantic:O(Xt),themeSequential:Xt?.colors?.sequential,themeDiverging:Xt?.colors?.diverging,customLayout:Pt,onLayoutError:Rt,layoutConfig:jt,layoutMargin:Jt};var e},[n,Nn,S,A,w,j,D,ve,nn,a,l,c,C,k,u,h,d,f,y,p,Qe,kt,wt,P,R,N,b,m,x,v,J,ee,te,ne,re,se,ie,oe,ae,le,ce,ue,he,X,q,G,K,U,Z,Q,V,De,et,tt,qt,Gt,it,Zt.now,ft,pt,gt,mt,xt,bt,g,Xt,Pt,Rt,jt,Jt])),Wn=(0,M.useRef)(null);Wn.current||(Wn.current=new on(In));const $n=function(e,t,n,r){const i=(0,ka.useRef)({accessor:t,onChange:n,readData:r}),o=(0,ka.useRef)([]);return i.current={accessor:t,onChange:n,readData:r},(0,ka.useCallback)(()=>{const{accessor:t,onChange:n,readData:r}=i.current;if(!n||!t)return;const s=function(e,t){if(!t)return[];const n=new Set,r=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const o=e+"";n.has(o)||(n.add(o),r.push(o))}return r}(e.current?r(e.current):[],t);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(s,o.current)||(o.current=s,n(s))},[e])}(Wn,He,Xe,e=>e.getData());An(Wn,In,It,Qt),Sn(Wn,Tt,It,Qt);const zn=(0,M.useRef)(null);zn.current||(zn.current=new E(e=>{const t=Wn.current;t&&t.ingest(e)&&(It.current=!0,Qt())},{chunkThreshold:o,chunkSize:s})),(0,M.useEffect)(()=>{zn.current?.updateChunkOptions({chunkThreshold:o,chunkSize:s})},[o,s]);const On=(0,M.useCallback)(e=>{zn.current?.push(e)},[]),Bn=(0,M.useCallback)(e=>{zn.current?.pushMany(e)},[]),Yn=(0,M.useCallback)(()=>{zn.current?.clear(),Wn.current?.clear(),It.current=!0,Qt()},[Qt]);(0,M.useImperativeHandle)(t,()=>({push:On,pushMany:Bn,remove:e=>{zn.current?.flush();const t=Wn.current?.remove(e)??[];return t.length>0&&(mn.current&&t.some(e=>e===mn.current?.data)&&(mn.current=null,wn(null)),It.current=!0,Qt()),t},update:(e,t)=>{zn.current?.flush();const n=Wn.current?.update(e,t)??[];return n.length>0&&(It.current=!0,Qt()),n},clear:Yn,getData:()=>(zn.current?.flush(),Wn.current?.getData()??[]),getScales:()=>Wn.current?.scales??null,getExtents:()=>Wn.current?.getExtents()??null,getCustomLayout:()=>Wn.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>Wn.current?.lastCustomLayoutFailure??null}),[On,Bn,Yn,Qt]),(0,M.useEffect)(()=>{if(i){if(p&&rn.length>0&&"object"==typeof rn[0]&&null!==rn[0]){const e="string"==typeof p?p:"coordinates";if(Array.isArray(rn[0][e])){const t=[];for(const n of rn){const r=n[e];if(Array.isArray(r)){const e=n.label||n.id||n.key;if(null!=e)for(const n of r)t.push({...n,_lineGroup:e});else for(const e of r)t.push(e)}}return void zn.current?.setBoundedData(t)}}zn.current?.setBoundedData(rn)}},[i,rn,p]);const{canvasRef:Hn,interactionCanvasRef:Xn,resolutionDirtyRef:qn}=xa(zt,{storeRef:Wn,dirtyRef:It,hydrated:Ot,wasHydratingFromSSR:Ft,cleanup:()=>zn.current?.clear(),maxDevicePixelRatio:Y,canvasPaintDependencies:[n,en,tn,de,B,qe,X,H,Ve,Qt]}),{hoverHandlerRef:Gn,hoverLeaveRef:Vn,onPointerMove:Kn,onPointerLeave:Qn}=zt;Gn.current=e=>{if(!sn)return;const t=Hn.current;if(!t)return;const r=t.getBoundingClientRect(),i=e.clientX-r.left-Jt.left,o=e.clientY-r.top-Jt.top;if(0>i||i>en||0>o||o>tn)return void(mn.current&&(mn.current=null,xn.current=null,wn(null),Dt?.(null),Qt()));const s=Wn.current;if(!s||0===s.scene.length)return;const l=Ys(je,e.pointerType),c=ur(s.scene,i,o,l,s.quadtree,s.maxPointRadius),u="multi"===Te,h=()=>{mn.current&&(mn.current=null,xn.current=null,wn(null),Dt&&Dt(null),Qt())};if(!c&&!u)return void h();const d=u||!c?i:c.x,f=u||!c?o:c.y,y=c?.datum?ot(c.datum,s.resolvedRibbons):{},p=s.scales?.x?.invert,g="function"==typeof p?p(d):void 0;let m=Xs(y,d,f,null!=g?{xValue:g,xPx:d}:void 0);if(u&&s.scene.length>0&&s.scales){const e=function(e,t,n=30){const r=[];for(const i of e)if("line"===i.type){const e=i;if(2>e.path.length)continue;const o=hr(cr(e.path,e.curve),t,n);if(null===o)continue;const s=kr(e.path,t);r.push({node:i,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:o,group:e.group,color:e.style.stroke})}else if("area"===i.type){const e=i;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const o=cr(e.topPath,e.curve),s=cr(e.bottomPath,e.curve),a=hr(o,t,n);if(null===a)continue;const l=hr(s,t,n),c=kr(e.topPath,t);r.push({node:i,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:a,y0:l??void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return r}(s.scene,d,Math.max(l,en));if(e.length>0){const t=s.scales.y.invert,r=_n.current,i=p?p(d):d;if(c)m.xValue=i,m.xPx=d;else{const e={xValue:i};"string"==typeof a&&(e[a]=i),m=Xs(e,d,f,{xValue:i,xPx:d})}m.allSeries=e.map(e=>{const i=t?t(e.y):e.y,o=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===n&&null!=o?i-o:i,valuePx:e.y,color:e.color||r,datum:ot(e.datum,s.resolvedRibbons)}})}}c||m.allSeries?.length?(mn.current=m,xn.current=c?.node??null,wn(m),Dt?.(m),Qt()):h()},Vn.current=()=>{mn.current&&(mn.current=null,xn.current=null,wn(null),Dt?.(null),Qt())};const Jn=(0,M.useRef)(()=>{});Jn.current=e=>{if(Li(e.target))return;if(!Lt)return;const t=Hn.current;if(!t)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left-Jt.left,i=e.clientY-n.top-Jt.top;if(0>r||r>en||0>i||i>tn)return void Lt(null);const o=Wn.current;if(!o||0===o.scene.length)return void Lt(null);const s=Ys(je,vn.current),a=ur(o.scene,r,i,s,o.quadtree,o.maxPointRadius);if(!a)return void Lt(null);const l=a.datum||{},c=o.scales?.x?.invert,u="function"==typeof c?c(a.x):void 0;Lt(Xs(l,a.x,a.y,null!=u?{xValue:u,xPx:a.x}:void 0),{type:"activate",inputType:al(vn.current)})};const er=(0,M.useCallback)(e=>Jn.current(e),[]),{kbFocusIndexRef:nr,focusedNavPointRef:rr,onKeyDown:ir}=(lr={storeRef:Wn,hoverRef:mn,hoveredNodeRef:xn,setHoverPoint:wn,customHoverBehavior:Dt,customClickBehavior:Lt,scheduleRender:Qt},function({storeRef:e,hoverRef:t,hoveredNodeRef:n,setHoverPoint:r,customHoverBehavior:i,customClickBehavior:o,scheduleRender:s,extractPoints:a,toHover:l}){const c=(0,dl.useRef)(-1),u=(0,dl.useRef)(null),h=(0,dl.useRef)(null),d=(0,dl.useCallback)(d=>{if(ll(d))return;const f=e.current;if(!f)return;const y=()=>{c.current=-1,u.current=null,t.current=null,n&&(n.current=null),r(null),i?.(null),s()};if(0===f.scene.length)return void(0>c.current||y());let p;if(h.current?.version===f.version)p=h.current.graph;else{const e=a(f.scene);if(0===e.length)return void(0>c.current||y());p=fl(e),h.current={version:f.version,graph:p}}let g=c.current;if(p.flat.length>g||(y(),g=-1),("Enter"===d.key||" "===d.key)&&g>=0)return d.preventDefault(),void o?.(l(p.flat[g],f),{type:"activate",inputType:"keyboard"});if(0>g){if("Escape"===d.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(d.key))return;d.preventDefault(),c.current=0;const e=p.flat[0];u.current=e;const n=l(e,f);return t.current=n,r(n),i?.(n,{type:"focus",inputType:"keyboard"}),void s()}const m=pl(d.key,yl(p,g),p);if(null===m)return;if(d.preventDefault(),0>m)return void y();c.current=m;const x=p.flat[m];u.current=x;const v=l(x,f);t.current=v,r(v),i?.(v,{type:"focus",inputType:"keyboard"}),s()},[o,i,a,t,n,s,r,e,l]);return{kbFocusIndexRef:c,focusedNavPointRef:u,onKeyDown:d}}({...lr,extractPoints:ml,toHover:(e,t)=>function(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}({...e,datum:ot(e.datum,t.resolvedRibbons)})})),or=(0,M.useCallback)(e=>{vn.current=e.pointerType,nr.current=-1,rr.current=null,Kn(e)},[rr,nr,Kn]),sr=(0,M.useCallback)(e=>{vn.current="mouse",nr.current=-1,rr.current=null,Kn({clientX:e.clientX,clientY:e.clientY,pointerType:"mouse"})},[rr,nr,Kn]),ar=(0,M.useCallback)(e=>{vn.current=e.pointerType},[]);var lr;Kt.current=()=>{if(Ut.current=null,!Zt.isActive)return;const e=Hn.current,t=Xn.current;if(!e||!t)return;const r=Wn.current;if(!r)return;const i=Zt.now(),o=r.advanceTransition(Bt.current?i+1e6:i),s=!Bt.current&&o,c=Wt.current.w!==en||Wt.current.h!==tn,u=qn.current,h=It.current||o||c,d=r.consumeStylePaintPending();let f=!1;const y=r.getLastUpdateResult(),p=Pn.current.beforeCompute(y,s);!h||s&&!c||(r.computeScene({width:en,height:tn}),Wt.current={w:en,h:tn},f=!0,$n()),Pn.current.afterCompute(p,f,c);const g=function(e,t,n,r){const i=r.current,o=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,s=!o&&e.hasActivePulsesAt(t),a=!(n||o||!s&&!i)&&e.refreshPulse(t);return r.current=s,{changed:a,pending:s}}(r,i,f,$t),m=pa(Y),x=Mn.current.resolve(e);_n.current=x.primary;const v=_r(it,r.lastIngestTime>0?i-r.lastIngestTime:0),b=it&&v.isStale;if(h||d||g.changed||u){const t=ya(e,Ht,Jt,m);if(t){if(t.clearRect(-Jt.left,-Jt.top,Ht[0],Ht[1]),it&&1>v.alpha&&(t.globalAlpha=v.alpha),ss(t,{background:B,hasBackgroundGraphics:!!qe,themeBackground:x.background,x:-Jt.left,y:-Jt.top,width:Ht[0],height:Ht[1]}),t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,en,tn),t.clip()),Ve&&r.scales)for(const e of Ve)t.save(),e(t,r.scene,r.scales,{width:en,height:tn}),t.restore();const e=Pt?Za.custom:Za[n];nl({context:t,nodes:r.scene,renderMode:H,pixelRatio:m,paintBuiltIn:n=>{if(e&&r.scales)for(const i of e)i(t,n,r.scales,{width:en,height:tn})}}),t.restore(),it&&1>v.alpha&&(t.globalAlpha=1)}}const k=!!(sn&&mn.current&&r.scales),w=!!(xn.current&&Array.isArray(we)&&we.some(e=>e&&"object"==typeof e&&"highlight"===e.type)),A=k||w;if(A||Cn.current){const e=ya(t,Ht,Jt,m);if(e&&(e.clearRect(-Jt.left,-Jt.top,Ht[0],Ht[1]),k&&mn.current&&function(e,t,n,r,i,o,s){if(!1===i.crosshair)return;const a=t.allSeries,l=a&&a.length>0,c=t.xPx??t.x;e.save();const u="object"==typeof i.crosshair?i.crosshair:{};if(e.strokeStyle=u.stroke||s.crosshair,e.lineWidth=u.strokeWidth||1,e.setLineDash(u.strokeDasharray?u.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(l?c:t.x,0),e.lineTo(l?c:t.x,r),e.stroke(),l||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),l){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of a)null!=t.valuePx&&(e.beginPath(),e.arc(c,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||s.primary,e.fill(),e.stroke())}else{const n=i.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(o)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=n,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,mn.current,en,tn,"object"==typeof sn?sn:{},xn.current,x),w&&xn.current&&Array.isArray(we))){const t=we.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,r,i){if(!n)return;const o="group"in n?n.group:void 0;if(void 0!==o)for(const n of t){if("line"!==n.type)continue;if(n.group!==o)continue;if(2>n.path.length)continue;const t="function"==typeof r.style?n.datum?r.style(n.datum):{}:r.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||i.primary,e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=t.opacity??1,e.stroke(),e.restore()}}(e,r.scene,xn.current,t,x)}Cn.current=A}h&&e&&e.setAttribute("aria-label",bs(r.scene,n+" chart"));const S=It.current;if(It.current=S&&s&&!f,qn.current=!1,S&&r.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!un||e(un.x.domain()[0])!==e(r.scales.x.domain()[0])||e(un.x.domain()[1])!==e(r.scales.x.domain()[1])||e(un.y.domain()[0])!==e(r.scales.y.domain()[0])||e(un.y.domain()[1])!==e(r.scales.y.domain()[1])||un.x.range()[0]!==r.scales.x.range()[0]||un.x.range()[1]!==r.scales.x.range()[1]||un.y.range()[0]!==r.scales.y.range()[0]||un.y.range()[1]!==r.scales.y.range()[1])&&hn(r.scales),vt){const e=r.getData(),t="function"==typeof a?a:e=>e[a||"x"],n="function"==typeof l?l:e=>e[l||"y"];Dn(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),En(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}!((De&&De.length>0||Pt)&&(f||s))||!f&&33>i-cn.current||(ln(e=>e+1),cn.current=i),it?.showBadge&&jn(!!b),(s||null!=r.activeTransition||g.pending)&&Qt()},Mr(it,Wn,It,Qt,Rn,jn);const dr=(0,M.useMemo)(()=>{if(me||be)return;const e=Wn.current;return e?.xIsDate&&un?_a(un.x.domain()):void 0},[me,be,un]),fr=me||be||dr,yr=sn&&bn?Ae?Ae(bn):(0,vl.jsx)(sl,{hover:bn}):null,pr=yr?(0,vl.jsx)(ea,{x:bn.x,y:bn.y,containerWidth:en,containerHeight:tn,margin:Jt,className:"stream-frame-tooltip",children:yr}):null,gr=rr.current,mr=(0,vl.jsx)(Fs,{active:nr.current>=0,hoverPoint:bn,margin:Jt,size:Ht,shape:gr?.shape,width:gr?.w,height:gr?.h}),xr=wa(a,C,"__semiotic_resolvedX","__semiotic_resolvedTime"),vr=wa(l,k,"__semiotic_resolvedY","__semiotic_resolvedValue"),br=xr.key,wr=vr.key,Ar=function(e,t,n){return r=>{if(!r||!n||!e.fn&&!t.fn)return r;let i=!1;const o=r.map(n=>{const r=e.fn&&e.key&&!(e.key in n),o=t.fn&&t.key&&!(t.key in n);if(!r&&!o)return n;i=!0;const s={...n};return r&&(s[e.key]=e.fn(n)),o&&(s[t.key]=t.fn(n)),s});return i?o:r}}(xr,vr,De&&De.length>0||!1);if(qo||!Ot&&Ft){const e=Wn.current;e&&i&&(e.ingest({inserts:rn,bounded:!0}),e.computeScene({width:en,height:tn}));const t=e?.scene??[],n=e?.scales??null,r=ba(Ge,Ht,Jt,n),o=ba(qe,Ht,Jt,n),s=fr||(()=>{if(e?.xIsDate&&n)return _a(n.x.domain())})();return(0,vl.jsxs)("div",{ref:Yt,className:"stream-xy-frame"+(F?" "+F:""),role:"img","aria-label":St||("string"==typeof Ke?Ke:"XY chart"),style:{position:"relative",width:W?"100%":Ht[0],height:$?"100%":Ht[1]},children:[(0,vl.jsx)(Ws,{summary:_t}),(0,vl.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ht[0],height:Ht[1],style:{position:"absolute",left:0,top:0},children:[(0,vl.jsx)("g",{transform:`translate(${Jt.left},${Jt.top})`,children:o}),(0,vl.jsxs)("g",{transform:`translate(${Jt.left},${Jt.top})`,children:[B&&(0,vl.jsx)("rect",{x:0,y:0,width:en,height:tn,fill:B}),Ue&&n&&Ue.map((e,r)=>(0,vl.jsx)(_.Fragment,{children:e(t,n,{width:en,height:tn})},"svgpre-"+r)),t.map((e,t)=>rl({node:e,index:t,renderMode:H,fallback:()=>function(e,t,n){switch(e.type){case"line":{const r=e;if(0===r.path.length)return null;const i=tr(r.curve),o=i?(0,To.line)().x(([e])=>e).y(([,e])=>e).curve(i)(r.path)??"":"M"+r.path.map(([e,t])=>`${e},${t}`).join("L"),s=$o(`${n?n+"-":""}line-${t}-stroke-gradient`),a=Xo(r.strokeGradient,r.path,s,r.style.stroke||"#4e79a7");return(0,Ho.jsxs)(jo.Fragment,{children:[a&&(0,Ho.jsx)("defs",{children:a}),(0,Ho.jsx)("path",{d:o,fill:"none",stroke:a?`url(#${s})`:r.style.stroke||"#4e79a7",strokeWidth:r.style.strokeWidth||2,strokeDasharray:r.style.strokeDasharray,opacity:r.style.opacity})]},"line-"+t)}case"area":{const r=e;if(0===r.topPath.length)return null;const i=tr(r.curve),o=!i||2>r.topPath.length||2>r.bottomPath.length?`M${r.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...r.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`:(0,To.area)().x(([e])=>e).y0((e,t)=>r.bottomPath[t][1]).y1(([,e])=>e).curve(i)(r.topPath)??"",s=`${n?n+"-":""}area-${t}-hatch`,a=Un(r.style.fill)?Zn(r.style.fill,s):void 0,l=$o(`${n?n+"-":""}area-${t}-gradient`),c=function(e,t){const n=e.fillGradient;if(!n||"object"!=typeof n)return null;let r=1/0;for(const[,t]of e.topPath)r=Math.min(r,t);let i=-1/0;for(const[,t]of e.bottomPath)i=Math.max(i,t);if(!Number.isFinite(r)||!Number.isFinite(i))return null;const o=Oo(n.stops,Wo(e.style.fill));return o?(0,Ho.jsx)("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:0,y1:r,x2:0,y2:i,children:o}):null}(r,l),u=c?`url(#${l})`:a?`url(#${s})`:Wo(r.style.fill),h=c?void 0:r.style.fillOpacity??r.style.opacity??.7,d=i?(0,To.line)().x(([e])=>e).y(([,e])=>e).curve(i)(r.topPath)??"":"M"+r.topPath.map(([e,t])=>`${e},${t}`).join("L"),f=$o(`${n?n+"-":""}area-${t}-stroke-gradient`),y=!(!r.colorThresholds?.length||!r.rawValues||r.rawValues.length!==r.topPath.length),p=!!r.strokeColorBands?.length,g=y||p?null:Xo(r.strokeGradient,r.topPath,f,r.style.stroke||"#4e79a7"),m=r.style.strokeWidth||2;let x=1/0,v=-1/0;for(const[e]of r.topPath)x>e&&(x=e),e>v&&(v=e);const b=p?r.strokeColorBands.map((e,r)=>$o(`${n?n+"-":""}area-${t}-stroke-band-${r}`)):[],k=p?r.strokeColorBands.map((e,t)=>(0,Ho.jsx)("clipPath",{id:b[t],children:(0,Ho.jsx)("rect",{x:x-m,y:e.y,width:v-x+2*m,height:e.height})},b[t])):null,w=r.style.stroke&&"none"!==r.style.stroke?p?r.strokeColorBands.map((e,n)=>(0,Ho.jsx)("path",{d:d,fill:"none",stroke:e.color??Wo(r.style.stroke),strokeWidth:m,opacity:r.style.opacity,clipPath:`url(#${b[n]})`},`area-${t}-stroke-band-${n}`)):y?Lo(r.topPath,r.rawValues,r.colorThresholds,Wo(r.style.stroke)).map((e,n)=>(0,Ho.jsx)("path",{d:"M"+e.path.map(([e,t])=>`${e},${t}`).join("L"),fill:"none",stroke:e.color,strokeWidth:m,opacity:r.style.opacity},`area-${t}-threshold-${n}`)):(0,Ho.jsx)("path",{d:d,fill:"none",stroke:g?`url(#${f})`:Wo(r.style.stroke),strokeWidth:m,opacity:r.style.opacity}):null;if(r.clipRect){const e=`${n?n+"-":""}area-clip-${t}`;return(0,Ho.jsxs)("g",{children:[(0,Ho.jsxs)("defs",{children:[c,!c&&a,g,k,(0,Ho.jsx)("clipPath",{id:e,children:(0,Ho.jsx)("rect",{x:r.clipRect.x,y:r.clipRect.y,width:r.clipRect.width,height:r.clipRect.height})})]}),(0,Ho.jsxs)("g",{clipPath:`url(#${e})`,children:[(0,Ho.jsx)("path",{d:o,fill:u,fillOpacity:h,opacity:c?r.style.opacity:void 0,stroke:"none"}),w]})]},"area-"+t)}return(0,Ho.jsxs)(jo.Fragment,{children:[(c||a||g||k)&&(0,Ho.jsxs)("defs",{children:[c,!c&&a,g,k]}),(0,Ho.jsx)("path",{d:o,fill:u,fillOpacity:h,opacity:c?r.style.opacity:void 0,stroke:"none"}),w]},"area-"+t)}case"point":{const r=e,i=`${n?n+"-":""}point-${t}-hatch`,o=Un(r.style.fill)?Zn(r.style.fill,i):void 0;return(0,Ho.jsxs)(jo.Fragment,{children:[o&&(0,Ho.jsx)("defs",{children:o}),(0,Ho.jsx)("circle",{cx:r.x,cy:r.y,r:r.r,fill:o?`url(#${i})`:Wo(r.style.fill),opacity:r.style.opacity??r.style.fillOpacity??.8,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},"point-"+t)}case"symbol":return function(e,t){const n=yt(e.symbolType,e.size,e.path);return(0,No.jsx)("path",{d:n,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?Wo(e.style.fill):"none",fillOpacity:e.style.fillOpacity,opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},"symbol-"+t)}(e,t);case"glyph":return zo(e,e.x,e.y,`${n??""}glyph-${e.pointId??t}`);case"rect":{const r=e,i=`${n?n+"-":""}xyrect-${t}-hatch`,o=Un(r.style.fill)?Zn(r.style.fill,i):void 0;return(0,Ho.jsxs)(jo.Fragment,{children:[o&&(0,Ho.jsx)("defs",{children:o}),(0,Ho.jsx)("rect",{x:r.x,y:r.y,width:r.w,height:r.h,fill:o?`url(#${i})`:Wo(r.style.fill),opacity:r.style.opacity,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},"rect-"+t)}case"heatcell":{const n=e,r={x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill,stroke:n.style?.stroke,strokeWidth:n.style?.strokeWidth,...null!=n.style?.opacity&&{opacity:n.style.opacity}};if(n.showValues&&null!=n.value&&n.w>=20&&n.h>=20){const e=n.valueFormat?n.valueFormat(n.value):Number.isInteger(n.value)?n.value+"":100>Math.abs(n.value)?1>Math.abs(n.value)?n.value.toPrecision(3):n.value.toFixed(1):n.value.toFixed(0),[i,o,s]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(n.fill),a=.299*i+.587*o+.114*s>128?"#000":"#fff",l=Math.max(10,Math.min(16,.3*Math.min(n.w,n.h)));return(0,Ho.jsxs)("g",{children:[(0,Ho.jsx)("rect",{...r}),(0,Ho.jsx)("text",{x:n.x+n.w/2,y:n.y+n.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:l+"px",children:e})]},"heatcell-"+t)}return(0,Ho.jsx)("rect",{...r},"heatcell-"+t)}case"candlestick":{const n=e;if(n.isRange){const e=n.dotRadius??Math.max(2,n.bodyWidth/2);return(0,Ho.jsxs)("g",{children:[(0,Ho.jsx)("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),(0,Ho.jsx)("circle",{cx:n.x,cy:n.highY,r:e,fill:n.wickColor}),(0,Ho.jsx)("circle",{cx:n.x,cy:n.lowY,r:e,fill:n.wickColor})]},"candle-"+t)}const r=Math.min(n.openY,n.closeY),i=Math.max(Math.abs(n.openY-n.closeY),1),o=n.isUp?n.upColor:n.downColor;return(0,Ho.jsxs)("g",{children:[(0,Ho.jsx)("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),(0,Ho.jsx)("rect",{x:n.x-n.bodyWidth/2,y:r,width:n.bodyWidth,height:i,fill:o,stroke:o,strokeWidth:1})]},"candle-"+t)}default:return null}}(e,t,Nt)})).filter(Boolean)]})]}),(0,vl.jsx)(Ro,{width:en,height:tn,totalWidth:Ht[0],totalHeight:Ht[1],margin:Jt,scales:n,showAxes:de,axes:fe,xLabel:ye,yLabel:pe,yLabelRight:ge,xFormat:s,yFormat:xe||ke,axisExtent:ve,showGrid:Ie,title:Ke,legend:We,legendHoverBehavior:$e,legendClickBehavior:ze,legendHighlightedCategory:Oe,legendIsolatedCategories:Fe,legendPosition:Be,legendLayout:Ye,foregroundGraphics:gn(r,kn(Wn.current?.customLayoutOverlays,Tt??null)),marginalGraphics:vt,xValues:[],yValues:[],annotations:De,onAnnotationActivate:Le,onObservation:Ce??Me,chartId:Pe,chartType:"StreamXYFrame",autoPlaceAnnotations:Ee,svgAnnotationRules:Ne,annotationFrame:0,xAccessor:br,yAccessor:wr,annotationData:Ar(Wn.current?.getData()),pointNodes:Ma(Wn.current?.scene),curve:"string"==typeof g?g:void 0,linkedCrosshairName:Mt,linkedCrosshairSourceId:Ct})]})}return(0,vl.jsxs)("div",{ref:Yt,className:"stream-xy-frame"+(F?" "+F:""),role:"group","aria-label":St||("string"==typeof Ke?Ke:"XY chart"),tabIndex:0,style:{position:"relative",width:W?"100%":Ht[0],height:$?"100%":Ht[1],overflow:"visible",touchAction:wl(Ze)},onKeyDown:ir,children:["production"!==process.env.NODE_ENV&&Wn.current&&(0,vl.jsx)(yn,{store:Wn.current,diagnostics:Pn.current}),At&&(0,vl.jsx)($s,{tableId:Vt}),At&&(0,vl.jsx)(Ns,{scene:Wn.current?.scene??[],chartType:n+" chart",tableId:Vt,chartTitle:"string"==typeof Ke?Ke:void 0}),(0,vl.jsx)(Ws,{summary:_t}),(0,vl.jsx)(ps,{hoverPoint:bn}),(0,vl.jsxs)("div",{role:"img","aria-label":St||("string"==typeof Ke?Ke:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:sn?or:void 0,onMouseMove:sn?sr:void 0,onPointerLeave:sn?Qn:void 0,onMouseLeave:sn?Qn:void 0,onPointerDown:sn||Et?ar:void 0,onClick:Et?er:void 0,children:[(0,vl.jsx)(va,{size:Ht,margin:Jt,children:pn}),(0,vl.jsx)(Mo,{width:en,height:tn,totalWidth:Ht[0],totalHeight:Ht[1],margin:Jt,scales:un,showAxes:de,axes:fe,showGrid:Ie,xFormat:fr,yFormat:xe||ke,axisExtent:ve}),(0,vl.jsx)("canvas",{ref:Hn,"aria-label":bs(Wn.current?.scene??[],n+" chart"),style:{position:"absolute",left:0,top:0}}),(0,vl.jsx)("canvas",{ref:Xn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,vl.jsx)(Ro,{width:en,height:tn,totalWidth:Ht[0],totalHeight:Ht[1],margin:Jt,scales:un,showAxes:de,axes:fe,xLabel:ye,yLabel:pe,yLabelRight:ge,xFormat:fr,yFormat:xe||ke,axisExtent:ve,showGrid:Ie,title:Ke,legend:We,legendHoverBehavior:$e,legendClickBehavior:ze,legendHighlightedCategory:Oe,legendIsolatedCategories:Fe,legendPosition:Be,legendLayout:Ye,foregroundGraphics:gn(dn,kn(Wn.current?.customLayoutOverlays,Tt??null)),marginalGraphics:vt,xValues:Tn,yValues:Ln,annotations:De,onAnnotationActivate:Le,onObservation:Ce??Me,chartId:Pe,chartType:"StreamXYFrame",autoPlaceAnnotations:Ee,svgAnnotationRules:Ne,annotationFrame:an,xAccessor:br,yAccessor:wr,annotationData:Ar(Wn.current?.getData()),pointNodes:Ma(Wn.current?.scene),curve:"string"==typeof g?g:void 0,underlayRendered:!0,canvasObscuresUnderlay:!!os({background:B,hasBackgroundGraphics:!!qe,themeBackground:Xt?.colors.background}),linkedCrosshairName:Mt,linkedCrosshairSourceId:Ct}),(Ze||Je)&&(0,vl.jsx)(T,{width:en,height:tn,totalWidth:Ht[0],totalHeight:Ht[1],margin:Jt,dimension:Ze?.dimension??"xy",scales:un,onBrush:Je??(()=>{}),binSize:b,snap:Ze?.snap,binBoundaries:Ze?.binBoundaries??("bar"===n?Wn.current?.getBinBoundaries():void 0),snapDuring:Ze?.snapDuring,streaming:"streaming"===r}),it?.showBadge&&(0,vl.jsx)(Pr,{isStale:Rn,position:it.badgePosition}),mr,pr]})]})}));Al.displayName="StreamXYFrame";var Sl=Al,_l=p(require("react")),Ml=require("react"),Cl={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},Pl={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1},Rl=class{constructor(e){this.capacity=e,this.particles=Array(e),this._freeIndices=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[t]=e-1-t}spawn(e,t=Math.random){const n=this._freeIndices.pop();if(void 0===n)return null;const r=this.particles[n];return r.active=!0,r.t=0,r.offset=t()-.5,r.edgeIndex=e,r.x=0,r.y=0,r}step(e,t,n,r){for(let i=0;this.capacity>i;i++){const o=this.particles[i];if(!o.active)continue;const s=n[o.edgeIndex];s&&s.bezier?(o.t+=e*t*(r?r[o.edgeIndex]??1:1)*(s.bezier.circular?.3:1),1>o.t?jl(s.bezier,o.t,o.offset,o):(o.active=!1,this._freeIndices.push(i))):(o.active=!1,this._freeIndices.push(i))}}countForEdge(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1;this._freeIndices.length=0;for(let e=this.capacity-1;e>=0;e--)this._freeIndices.push(e)}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let n=0;e>n;n++)t.length>n?this.particles[n]=t[n]:(this.particles[n]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(n));this.capacity=e}};function jl(e,t,n,r){if(e.circular&&e.segments)return void function(e,t,n,r,i){const o=e.length,s=t*o,a=Math.min(Math.floor(s),o-1),l=s-a,[c,u,h,d]=e[a];Tl(c,u,h,d,l,i);const f=d.x-c.x,y=d.y-c.y,p=Math.sqrt(f*f+y*y);if(p>.001){const e=f/p;i.x+=-y/p*n*r*2,i.y+=e*n*r*2}}(e.segments,t,n,e.halfWidth,r);if(!e.points)return r.x=0,void(r.y=0);const[i,o,s,a]=e.points;Tl(i,o,s,a,t,r);const l=a.x-i.x,c=a.y-i.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;r.x+=-c/u*n*e.halfWidth*2,r.y+=t*n*e.halfWidth*2}}function Tl(e,t,n,r,i,o){const s=1-i,a=s*s,l=a*s,c=i*i,u=c*i;o.x=l*e.x+3*a*i*t.x+3*s*c*n.x+u*r.x,o.y=l*e.y+3*a*i*t.y+3*s*c*n.y+u*r.y}function Dl(e,t){var n=e.get(t);if(!n)throw Error("missing: "+t);return n}function Ll(e,t){var n,r=[],i=[],o=[],s={},a=[];function l(e){o[e]=!1,s.hasOwnProperty(e)&&Object.keys(s[e]).forEach(function(t){delete s[e][t],o[t]&&l(t)})}function c(e){var t,r,h=!1;for(i.push(e),o[e]=!0,t=0;a[e].length>t;t++)(r=a[e][t])===n?(u(n,i),h=!0):o[r]||(h=c(r));if(h)l(e);else for(t=0;a[e].length>t;t++){var d=s[r=a[e][t]];d||(s[r]=d={}),d[r]=!0}return i.pop(),h}function u(e,n){var i=[].concat(n).concat(e);t?t(i):r.push(i)}function h(t){!function(t){for(var n=0;e.length>n;n++)n>=t&&e[n]||(e[n]=[]),e[n]=e[n].filter(function(e){return e>=t})}(t);for(var n,r=function(e){for(var t=e.length,n=Array(t),r=Array(t),i=Array(t),o=Array(t),s=Array(t),a=Array(t),l=0;t>l;++l)n[l]=-1,r[l]=0,i[l]=!1,o[l]=0,s[l]=-1,a[l]=[];var c,u=0,h=[],d=[];function f(t){var l=[t],c=[t];for(n[t]=r[t]=u,i[t]=!0,u+=1;c.length>0;){var f=e[t=c[c.length-1]];if(f.length>o[t]){for(var y=o[t];f.length>y;++y){var p=f[y];if(0>n[p]){n[p]=r[p]=u,i[p]=!0,u+=1,l.push(p),c.push(p);break}i[p]&&(r[t]=0|Math.min(r[t],r[p])),0>s[p]||a[t].push(s[p])}o[t]=y}else{if(r[t]===n[t]){var g=[],m=[],x=0;for(y=l.length-1;y>=0;--y){var v=l[y];if(i[v]=!1,g.push(v),m.push(a[v]),x+=a[v].length,s[v]=h.length,v===t){l.length=y;break}}h.push(g);var b=Array(x);for(y=0;m.length>y;y++)for(var k=0;m[y].length>k;k++)b[--x]=m[y][k];d.push(b)}c.pop()}}}for(l=0;t>l;++l)0>n[l]&&f(l);for(l=0;d.length>l;l++){var y=d[l];if(0!==y.length){y.sort(function(e,t){return e-t}),c=[y[0]];for(var p=1;y.length>p;p++)y[p]!==y[p-1]&&c.push(y[p]);d[l]=c}}return{components:h,adjacencyList:d}}(e),i=r.components.filter(function(e){return e.length>1}),o=1/0,s=0;i.length>s;s++)for(var a=0;i[s].length>a;a++)o>i[s][a]&&(o=i[s][a],n=s);var l=i[n];return!!l&&{leastVertex:o,adjList:e.map(function(e,t){return-1===l.indexOf(t)?[]:e.filter(function(e){return-1!==l.indexOf(e)})})}}n=0;for(var d=e.length;d>n;){var f=h(n);if(n=f.leastVertex,a=f.adjList){for(var y=0;a.length>y;y++)for(var p=0;a[y].length>p;p++){var g=a[y][p];o[+g]=!1,s[g]={}}c(n),n+=1}else n=d}return t?void 0:r}function El(e){return e.y0-e.y1>0?"up":"down"}function Nl(e,t){return t(e.source)==t(e.target)}function Il(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var n=0;return e.target.targetLinks.forEach(function(e){n=e.circular?n+1:n}),1>=t&&1>=n}function Wl(e){return e.target.x0-e.source.x1}function $l(e,t){var n=Ol(e),r=Wl(t)/Math.tan(n);return"up"==El(e)?e.y1-r:e.y1+r}function zl(e,t){var n=Ol(e),r=Wl(t)/Math.tan(n);return"up"==El(e)?e.y1+r:e.y1-r}function Ol(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function Fl(e,t){return t(e)}function Bl(e){return Hl(e.source)}function Yl(e){return Hl(e.target)}function Hl(e){return(e.y0+e.y1)/2}function Xl(e){return e.virtual?0:e.value}function ql(e,t){var n=0;e.sourceLinks.forEach(function(e){n=e.circular&&!Nl(e,t)?n+1:n});var r=0;return e.targetLinks.forEach(function(e){r=e.circular&&!Nl(e,t)?r+1:r}),n+r}function Gl(e){return e.target.depth}function Vl(e,t){return e.sourceLinks.length?e.depth:t-1}function Ul(e,t){return e.y0-t.y0}function Kl(e,t){return t.y0-e.y0}function Ql(e,t){return e.y1-t.y1}function Zl(e,t){return t.y1-e.y1}function Jl(e,t){return tc(e.source,t.source)||e.index-t.index}function ec(e,t){return tc(e.target,t.target)||e.index-t.index}function tc(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function nc(e,t){return rc(e)==rc(t)?"bottom"==e.circularLinkType?Kl(e,t):Ul(e,t):rc(t)-rc(e)}function rc(e){return e.target.column-e.source.column}function ic(e,t){return oc(e)==oc(t)}function oc(e){return e.y0-e.y1>0?"up":"down"}var sc=require("d3-array");function ac(e,t,n,r,i){let o=e;var s=Math.max(8,.15*(o.y1-o.y0));o.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,s))});var a=(0,sc.min)(o.links,function(e){return e.source.y0});o.links.forEach(function(e){e.circular&&(e.circularPathData={})});var l=o.links.filter(function(e){return e.circular});return l.sort(function(e,t){return t.value-e.value}),l.forEach(function(e,t){e._circularStub=t>=4}),lc(o.links.filter(function(e){return"top"==e.circularLinkType}),t,n),lc(o.links.filter(function(e){return"bottom"==e.circularLinkType}),t,n),o.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+r,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,Nl(e,t)&&Il(e))e.circularPathData.rightSmallArcRadius=r+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=r+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=r+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=r+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+i+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-i-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var s=e.source.column,l=e.circularLinkType,c=o.links.filter(function(e){return e.source.column==s&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?Kl:Ul);var u=0;c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=r+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=r+e._circularWidth/2+i*n+u),u+=t._circularWidth||t.width}),s=e.target.column,(c=o.links.filter(function(e){return e.target.column==s&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?Zl:Ql),u=0,c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=r+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=r+e._circularWidth/2+i*n+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(o.y1,e.source.y1,e.target.y1)+i+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=a-i-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,n=e.y0,r=e.target.x0,i=e.y1,o=(t+r)/2;return"M"+t+","+n+"C"+o+","+n+" "+o+","+i+" "+r+","+i}(e)}),o}function lc(e,t,n){e.sort(nc);var r=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,i){var o=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(Nl(e,t)&&Il(e))e.circularPathData.verticalBuffer=o+e._circularWidth/2;else{for(var s=0;r.length>s;s++){var a=r[s];if(a!==e&&a.circularPathData&&void 0!==a.circularPathData.verticalBuffer&&cc(e,a)){var l=a.circularPathData.verticalBuffer+(a._circularWidth||a.width)/2+n;o=l>o?l:o}}e.circularPathData.verticalBuffer=o+e._circularWidth/2}}),e}function cc(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}var uc=require("d3-array");function hc(e){return function(){return e}}function dc(e){return e.index}function fc(e){return e.nodes}function yc(e){return e.links}function pc(e,t,n){var r=(0,uc.groups)(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});r.forEach(function(i,o){var s=i.length;if(t)i.sort(t);else if(o>0){var a=new Map;i.forEach(function(e,t){var n,r,i,o=(r=0,i=0,(n=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=Hl(e.source)*t,r+=t}}),n.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=Hl(e.target)*t,r+=t}}),r>0?i/r:NaN);a.set(e,{bc:o,idx:t})}),i.sort(function(e,t){var n=a.get(e),r=a.get(t),i=n.bc,o=r.bc;if(e.circularLinkType!==t.circularLinkType){if("top"==e.circularLinkType&&"bottom"==t.circularLinkType)return-1;if("bottom"==e.circularLinkType&&"top"==t.circularLinkType)return 1;if("top"==e.circularLinkType)return-1;if("top"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return-1}return isNaN(i)||isNaN(o)?isNaN(i)?isNaN(o)?n.idx-r.idx:1:-1:i-o})}else i.sort(function(e,t){return e.circularLinkType==t.circularLinkType?ql(t,n)-ql(e,n):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});i.forEach(function(t,i){t.depth==r.length-1&&1==s||0==t.depth&&1==s?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==ql(t,n)?(t.y0=e.y1/2+i,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+i,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-i,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/s*i,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-s/2+i,t.y1=t.y0+t.value*e.ky)})})}function gc(e,t,n,r,i,o){var s=(0,uc.groups)(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var a=1,l=o;l>0;--l)c(a*=.99,n),u();function c(t,n){var r=s.length;s.forEach(function(i){var o=i.length,s=i[0].depth;i.forEach(function(i){var a;if(i.sourceLinks.length||i.targetLinks.length)if(i.partOfCycle&&ql(i,n)>0){var l=(0,uc.mean)(i.sourceLinks,Yl),c=(0,uc.mean)(i.targetLinks,Bl),u=l&&c?(l+c)/2:l||c;if(u){var h=(u-Hl(i))*t*.3;i.y0+=h,i.y1+=h}}else if(0==s&&1==o)i.y0=e.y1/2-(a=i.y1-i.y0)/2,i.y1=e.y1/2+a/2;else if(s==r-1&&1==o)i.y0=e.y1/2-(a=i.y1-i.y0)/2,i.y1=e.y1/2+a/2;else if(1==i.targetLinks.length&&1==i.targetLinks[0].source.sourceLinks.length)a=i.y1-i.y0,i.y0=i.targetLinks[0].source.y0,i.y1=i.y0+a;else{var d=(0,uc.mean)(i.sourceLinks,Yl),f=(0,uc.mean)(i.targetLinks,Bl),y=((d&&f?(d+f)/2:d||f)-Hl(i))*t;i.y0+=y,i.y1+=y}})})}function u(){s.forEach(function(n){var o,s,a,l=e.y0,c=n.length;for(n.sort(t||tc),a=0;c>a;++a)(s=l-(o=n[a]).y0)>0&&(o.y0+=s,o.y1+=s),l=o.y1+r;if((s=l-r-e.y1)>0)for(l=o.y0-=s,o.y1-=s,a=c-2;a>=0;--a)(s=(o=n[a]).y1+i-l)>0&&(o.y0-=s,o.y1-=s),l=o.y0})}}function mc(e){e.nodes.forEach(function(e){e.sourceLinks.sort(ec),e.targetLinks.sort(Jl)}),e.nodes.forEach(function(e){var t=e.y0,n=t,r=e.y1,i=r;e.sourceLinks.forEach(function(e){e.circular?(e.y0=r-e.width/2,r-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=i-e.width/2,i-=e.width):(e.y1=n+e.width/2,n+=e.width)})})}function xc(){var e=0,t=0,n=1,r=1,i=24,o=8,s=null,a=dc,l=Vl,c=void 0,u=32,h=2,d=fc,f=yc;function y(){var y={nodes:d.apply(null,arguments),links:f.apply(null,arguments)};return function(d){d.x0=e,d.y0=t,d.x1=n,d.y1=r,d.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var n=function(e,t){var n=new Map;return(0,uc.group)(e,t).forEach(function(e,t){n.set(t,e[0])}),n}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var r=e.source,i=e.target;"object"!=typeof r&&(r=e.source=Dl(n,r)),"object"!=typeof i&&(i=e.target=Dl(n,i)),r.sourceLinks.push(e),i.targetLinks.push(e)})}(d,a),function(e,t){var n=0;if(null==t){for(var r=[],i=0;e.links.length>i;i++){var o=e.links[i],s=o.source.index,a=o.target.index;r[s]||(r[s]=[]),r[a]||(r[a]=[]),-1===r[s].indexOf(a)&&r[s].push(a)}var l=Ll(r);l.sort(function(e,t){return e.length-t.length});var c={};for(i=0;l.length>i;i++){var u=l[i].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,r=e.source.index;t===r||c[r]&&c[r][t]?(e.circular=!0,e.circularLinkID=n++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=n++)})}(d,c),function(e,t){var n=0,r=0;e.links.forEach(function(i){i.circular&&(i.circularLinkType=i.source.circularLinkType||i.target.circularLinkType?i.source.circularLinkType?i.source.circularLinkType:i.target.circularLinkType:r>n?"top":"bottom","top"==i.circularLinkType?n++:r++,e.nodes.forEach(function(e){Fl(e,t)!=Fl(i.source,t)&&Fl(e,t)!=Fl(i.target,t)||(e.circularLinkType=i.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),Nl(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(d,a),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max((0,uc.sum)(e.sourceLinks,Xl),(0,uc.sum)(e.targetLinks,Xl)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(d),function(e,t,n){var r,i,o;if(null!=t){e.nodes.sort(function(e,n){return t(e)<t(n)?-1:1});var s=0,a=t(e.nodes[0]);e.nodes.forEach(function(e){s=t(e)==a?s:s+1,a=t(e)==a?a:t(e),e.column=s})}for(r=e.nodes,i=[],o=0;r.length;++o,r=i,i=[])r.forEach(function(e){e.depth=o,e.sourceLinks.forEach(function(e){0>i.indexOf(e.target)&&!e.circular&&i.push(e.target)})});for(r=e.nodes,i=[],o=0;r.length;++o,r=i,i=[])r.forEach(function(e){e.height=o,e.targetLinks.forEach(function(e){0>i.indexOf(e.source)&&!e.circular&&i.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?n(e,o):e.column})}(d,c,l);var f=o;if(null!==s){var y=(0,uc.groups)(d.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),p=(0,uc.max)(y,function(e){return e.length});p>1&&(f=Math.max(1,(r-t)*s/(p-1)))}(function(e,t,n){var r=(0,uc.groups)(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var i=(0,uc.min)(r,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/(0,uc.sum)(t,function(e){return e.value})});e.ky=i,e.links.forEach(function(t){t.width=t.value*e.ky});var o=(0,uc.max)(e.nodes,function(e){return e.column});e.nodes.forEach(o>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-n)/o),t.x1=t.x0+n}:function(t){t.x0=e.x0,t.x1=t.x0+n})})(d,f,i),pc(d,c,a),gc(d,c,a,f,f,u),mc(d),ac(d,a,h,10,8),pc(d,c,a),gc(d,c,a,f,f,u),mc(d),ac(d,a,h,10,8),function(e,t){let n=e;n.nodes.forEach(function(e){e.y+(e.y1-e.y0)>n.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-n.y1));var r=n.links.filter(function(n){return Fl(n.source,t)==Fl(e,t)}),i=r.length;i>1&&r.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!ic(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var n=$l(t,e);return e.y1-n}if(t.target.column>e.target.column)return $l(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var o=e.y0;r.forEach(function(e){e.y0=o+e.width/2,o+=e.width}),r.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var o=n+1,s=0;i>o;o++)s+=r[o].width;t.y0=e.y1-s-t.width/2}})})}(d,a),function(e,t){let n=e;n.nodes.forEach(function(e){var r=n.links.filter(function(n){return Fl(n.target,t)==Fl(e,t)}),i=r.length;i>1&&r.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!ic(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var n=zl(t,e);return e.y0-n}if(t.source.column>e.source.column)return zl(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var o=e.y0;r.forEach(function(e){e.y1=o+e.width/2,o+=e.width}),r.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var o=n+1,s=0;i>o;o++)s+=r[o].width;t.y1=e.y1-s-t.width/2}})})}(d,a),function(e){var t=e.nodes,n=e.links,r=!1,i=!1;if(n.forEach(function(e){"top"==e.circularLinkType?r=!0:"bottom"==e.circularLinkType&&(i=!0)}),0==r||0==i){let r=function(t){return(t-o)/(s-o)*(e.y1-e.y0)+e.y0};var o=(0,uc.min)(t,function(e){return e.y0}),s=(0,uc.max)(t,function(e){return e.y1}),a=(e.y1-e.y0)/(s-o);1>a?(t.forEach(function(e){e.y0=r(e.y0),e.y1=r(e.y1)}),n.forEach(function(e){e.y0=r(e.y0),e.y1=r(e.y1),e.width=e.width*a})):t.forEach(function(e){var t=e.y1-e.y0,n=r(e.y0)-e.y0;e.y0=r(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+n}),e.targetLinks.forEach(function(e){e.y1=e.y1+n})})}}(d),ac(d,a,h,10,8)}(y),y}return y.update=function(e){return mc(e),ac(e,a,h,10,8),e},y.nodeWidth=function(e){return arguments.length?(i=+e,y):i},y.nodePadding=function(e){return arguments.length?(o=+e,y):o},y.nodePaddingRatio=function(e){return arguments.length?(s=+e,y):s},y.nodes=function(e){return arguments.length?(d="function"==typeof e?e:hc(e),y):d},y.links=function(e){return arguments.length?(f="function"==typeof e?e:hc(e),y):f},y.nodeId=function(e){return arguments.length?(a="function"==typeof e?e:hc(e),y):a},y.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:hc(e),y):l},y.nodeSort=function(e){return arguments.length?(c=e,y):c},y.iterations=function(e){return arguments.length?(u=+e,y):u},y.circularLinkGap=function(e){return arguments.length?(h=+e,y):h},y.extent=function(i){return arguments.length?(e=+i[0][0],t=+i[0][1],n=+i[1][0],r=+i[1][1],y):[[e,t],[n,r]]},y.size=function(i){return arguments.length?(e=t=0,n=+i[0],r=+i[1],y):[n-e,r-t]},y}var vc=require("d3-interpolate");require("d3-shape");var bc=e=>{let t,n,r,i,o,s,a,l,c;if("down"===e.direction)return t=e.y0-e.sankeyWidth/2,n=e.y1-e.sankeyWidth/2,r=e.y1+e.sankeyWidth/2,i=e.y0+e.sankeyWidth/2,o=e.source.x1,s=e.target.x0,a=(0,vc.interpolateNumber)(o,s),l=a(.5),c=a(.5),`M${t},${o}C${t},${l} ${n},${c} ${n},${s}L${r},${s}C${r},${c} ${i},${l} ${i},${o}Z`;const u=e.sankeyWidth/2,h=(0,vc.interpolateNumber)(e.source.x1,e.target.x0),{pathD:d}=function(e){const{sx:t,sTop:n,sBot:r,tx:i,tTop:o,tBot:s,cp1X:a,cp2X:l}=e,c=(n+r)/2,u=(o+s)/2;return{pathD:[`M${t},${n}`,`C${a},${n} ${l},${o} ${i},${o}`,`L${i},${s}`,`C${l},${s} ${a},${r} ${t},${r}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:t,y:c},{x:a,y:c},{x:l,y:u},{x:i,y:u}],halfWidth:(r-n)/2}}}({sx:e.source.x1,sTop:e.y0-u,sBot:e.y0+u,tx:e.target.x0,tTop:e.y1-u,tBot:e.y1+u,cp1X:h(.5),cp2X:h(.5)});return d};function kc(e){const t=e.sankeyWidth/2,n=(e._circularWidth??e.sankeyWidth)/2,r=e.circularPathData;if(!r)return null;if("down"===e.direction)return null;if(e._circularStub){const n=r.sourceX,i=r.sourceY,o=r.targetX,s=r.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const a=Math.max(15,Math.min(40,.33*(r.rightFullExtent-n))),l=Math.max(15,Math.min(40,.33*(o-r.leftFullExtent)));return`M${n},${i-t}L${n+a},${i-t}L${n+a},${i+t}L${n},${i+t}ZM${o},${s-t}L${o-l},${s-t}L${o-l},${s+t}L${o},${s+t}Z`}const i=r.sourceX,o=r.sourceY,s=r.targetX,a=r.targetY,l=r.rightFullExtent,c=r.leftFullExtent,u=r.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,d=Math.max(4,Math.min(n,15));return`M${i},${o-h*t}L${l},${o-h*t}L${l+n},${o-h*t+h*d}L${l+n},${u+h*n-h*d}L${l+n-d},${u+h*n}L${c-n+d},${u+h*n}L${c-n},${u+h*n-h*d}L${c-n},${a-h*t+h*d}L${c-n+d},${a-h*t}L${s},${a-h*t}L${s},${a+h*t}L${c+n},${a+h*t}L${c+n},${u-h*n}L${l-n},${u-h*n}L${l-n},${o+h*t}L${i},${o+h*t}Z`}var wc=new Set,Ac=new WeakMap;function Sc(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let n=Ac.get(e);if(n){const e=n.get(t);if(e)return e}else n=new Map,Ac.set(e,n);const r=new Proxy(e,{get(e,n,r){if("string"==typeof n&&!(n in e)&&e.data&&n in e.data){const e=`${t}:${n}`;wc.has(e)||(wc.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${n}" on the wrapper object, but it only exists on ".data". Use d.data.${n} (or d.data?.${n}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,n,r)}});return n.set(t,r),r}var _c={left:function(e){return e.depth},right:function(e,t){return t-1-e.height},center:function(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min.apply(Math,e.sourceLinks.map(Gl))-1:0},justify:Vl},Mc={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,r){if(0===e.length)return;const i="vertical"===n.orientation?"down":"right",o=n.nodeAlign||"justify",s=n.nodeWidth??15,a=n.nodePaddingRatio??.05,l=n.iterations??100,c=e.map(e=>({...e})),u=t.map(e=>({...e,source:ne(e.source),target:ne(e.target),value:Math.sqrt(Math.max(1,e.value||1))}));let h;h="down"===i?[[0,0],[r[1],r[0]]]:[[0,0],[r[0],r[1]]];const d=xc().extent(h).links(u).nodes(c).nodeAlign(_c[o]||Vl).nodeId(e=>e.id).nodeWidth(s).iterations(l);d.nodePaddingRatio&&d.nodePaddingRatio(a),d();{let e=1/0,t=-1/0,n=1/0,i=-1/0;for(const r of c)e>r.x0&&(e=r.x0),r.x1>t&&(t=r.x1),n>r.y0&&(n=r.y0),r.y1>i&&(i=r.y1);for(const r of u){if(!r.circular||!r.circularPathData)continue;const o=r.circularPathData,s=(r._circularWidth??r.width??0)/2;e>o.leftFullExtent-s&&(e=o.leftFullExtent-s),o.rightFullExtent+s>t&&(t=o.rightFullExtent+s),n>o.verticalFullExtent-s&&(n=o.verticalFullExtent-s),o.verticalFullExtent+s>i&&(i=o.verticalFullExtent+s)}const o=t-e,s=i-n,a=r[0],l=r[1];if(o>0&&s>0&&(0>e||0>n||t>a||i>l)){const t=Math.min(a/o,l/s),r=-e*t+(a-o*t)/2,i=-n*t+(l-s*t)/2;for(const e of c)e.x0=e.x0*t+r,e.x1=e.x1*t+r,e.y0=e.y0*t+i,e.y1=e.y1*t+i;for(const e of u)if(e.y0=e.y0*t+i,e.y1=e.y1*t+i,e.width=(e.width??0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const n=e.circularPathData;n.sourceX=n.sourceX*t+r,n.targetX=n.targetX*t+r,n.sourceY=n.sourceY*t+i,n.targetY=n.targetY*t+i,n.rightFullExtent=n.rightFullExtent*t+r,n.leftFullExtent=n.leftFullExtent*t+r,n.verticalFullExtent=n.verticalFullExtent*t+i,n.rightInnerExtent=n.rightInnerExtent*t+r,n.leftInnerExtent=n.leftInnerExtent*t+r,n.verticalRightInnerExtent=n.verticalRightInnerExtent*t+i,n.verticalLeftInnerExtent=n.verticalLeftInnerExtent*t+i,n.rightSmallArcRadius*=t,n.rightLargeArcRadius*=t,n.leftSmallArcRadius*=t,n.leftLargeArcRadius*=t,n.sourceWidth*=t,n.rightNodeBuffer*=t,n.leftNodeBuffer*=t,n.arcRadius*=t}}}const f=new Map;for(const t of e)f.set(t.id,t);for(const e of c){const t=f.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const y=new Map;for(const e of t)if(e._edgeKey)y.set(e._edgeKey,e);else{const t=ne(e.source),n=ne(e.target);y.set(`${t}\0${n}`,e)}for(const e of u){const t=ne(e.source),n=ne(e.target),r=y.get(e._edgeKey?e._edgeKey:`${t}\0${n}`);if(r){r.y0=e.y0,r.y1=e.y1,r.sankeyWidth=e.width??0,r.circular=!!e.circular,r.circularPathData=e.circularPathData,r._circularWidth=e._circularWidth,r._circularStub=e._circularStub,r.path=e.path,r.circularLinkType=e.circularLinkType,r.direction=i;const o=f.get(t),s=f.get(n);o&&(r.source=o),s&&(r.target=s)}}},buildScene(e,t,n,r){const i="vertical"===n.orientation?"down":"right",o=n.nodeStyle,s=n.edgeStyle,a=n.edgeOpacity??.5,l=n.edgeColorBy||"source",c=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:ue,u=new Map;e.forEach((e,t)=>{u.set(e.id,c[t%c.length])});const h=[],d=[],f=[],y=new Map;for(const t of e){const e=t.x1-t.x0,n=t.y1-t.y0;if(0>=e||0>=n)continue;const r=o?o(Sc(t,"nodeStyle")):{},s={fill:r.fill||u.get(t.id)||"#4d430c",stroke:r.stroke,strokeWidth:r.strokeWidth,opacity:r.opacity};y.set(t.id,("string"==typeof s.fill?s.fill:null)||u.get(t.id)||"#4d430c"),h.push("down"===i?{type:"rect",x:t.y0,y:t.x0,w:n,h:e,style:s,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:n,style:s,datum:t,id:t.id,label:t.id})}const p=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of p){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;if(!t||!r)continue;let i=n.themeSemantic?.border||n.themeSemantic?.secondary||"#999";i="function"==typeof l?l(e)||i:"target"===l?y.get(r.id)||u.get(r.id)||i:y.get(t.id)||u.get(t.id)||i;const o=s?s(Sc(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,n=e.sankeyWidth/2,r=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),s=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),l=o.fill||i;d.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-n}L${t.sourceX+r},${t.sourceY-n}L${t.sourceX+r},${t.sourceY+n}L${t.sourceX},${t.sourceY+n}Z`,style:{fill:l,fillOpacity:o.fillOpacity??a,stroke:"none",opacity:o.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+r}}),d.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-n}L${t.targetX-s},${t.targetY-n}L${t.targetX-s},${t.targetY+n}L${t.targetX},${t.targetY+n}Z`,style:{fill:l,fillOpacity:o.fillOpacity??a,stroke:"none",opacity:o.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-s,x1:t.targetX}});continue}let c;(c=e.circular&&e.circularPathData?kc(e):bc(e),c)&&d.push({type:"bezier",pathD:c,bezierCache:e.bezier,style:{fill:o.fill||i,fillOpacity:o.fillOpacity??a,stroke:o.stroke||"none",strokeWidth:o.strokeWidth,opacity:o.opacity},datum:e})}if(!1!==n.showLabels){const t=te(n.nodeLabel);for(const n of e){const e=n.x1-n.x0,o=n.y1-n.y0;if(0>=e||0>=o)continue;const s=t?t(n):n.id;if(!s)continue;let a,l,c;"down"===i?(a=n.y0+(n.y1-n.y0)/2,l=n.x1+14,c="start"):(r[0]/2>n.x0+e/2?(a=n.x0-6,c="end"):(a=n.x1+6,c="start"),l=n.y0+o/2),f.push({x:a,y:l,text:s+"",anchor:"down"===i?"middle":c,baseline:"middle",fontSize:11})}}return{sceneNodes:h,sceneEdges:d,labels:f}}},Cc=require("d3-force"),Pc=require("d3-scale"),Rc={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,r){if(0===e.length)return;const i=n.forceStrength??.1,o=r[0]/2,s=r[1]/2,a=Math.max(.1,Math.min(1,Math.min(r[0],r[1])/200)),l=Math.min(.5,.06+1.8*(1-a)),c=n.__previousPositions;let u=0;const h=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),n=c?.get(t.id);e?u++:n?(t.x=n.x,t.y=n.y,u++):h.push(t)}const d=u>0&&.3>=(e.length>0?h.length/e.length:1);if(d){const n=new Map;for(const t of e)n.set(t.id,t);for(const e of h){const r=jc(e.id,t,n);if(r.length>0){let t=0,n=0;for(const e of r)t+=e.x,n+=e.y;const i=Tc(e.id),o=i%360*(Math.PI/180),s=(10+i%20)*a;e.x=t/r.length+s*Math.cos(o),e.y=n/r.length+s*Math.sin(o)}else{const t=Tc(e.id),n=t%360*(Math.PI/180),r=(15+t%30)*a;e.x=o+r*Math.cos(n),e.y=s+r*Math.sin(n)}}}else{const t=2.399963229728653;for(let n=0;e.length>n;n++){const r=e[n];if(null==r.x||null==r.y||0===r.x&&0===r.y){const e=10*Math.sqrt(n+.5)*a,i=n*t;r.x=o+e*Math.cos(i),r.y=s+e*Math.sin(i)}}}const f=n.__skipForceSimulation||0===n.iterations?0:d?40:n.iterations??Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),y=Dc(n.nodeSize,n.nodeSizeRange,e),p=e=>y(e);if(f>0){const c=new Map,u=new Map;for(const t of e)c.set(t.id,0),u.set(t.id,t);for(const e of t){const t=ne(e.source),n=ne(e.target);c.set(t,(c.get(t)??0)+1),c.set(n,(c.get(n)??0)+1)}const h=(0,Cc.forceLink)().strength(e=>{const t=e.weight,n=ne(e.source),r=ne(e.target),o=Math.max(1,Math.min(c.get(n)??1,c.get(r)??1));return Math.min(2.5,(t&&t>0?Math.sqrt(t):1)*i/(.1*o))}).distance(e=>{const t="string"==typeof e.source?u.get(e.source):e.source,n="string"==typeof e.target?u.get(e.target):e.target,r=(t?p(t):0)+(n?p(n):0)+Math.max(6,12*a);return Math.max(16,40*a,r)}).id(e=>e.id),y=(0,Cc.forceSimulation)();if(void 0===n.random&&void 0===n.seed||y.randomSource(n.random??sa(n.seed)),y.force("charge",(0,Cc.forceManyBody)().strength(e=>{const t=c.get(e.id)??0;return-15*a*p(e)*Math.sqrt(t+1)})).force("collide",(0,Cc.forceCollide)(e=>p(e)+3*a).strength(.9).iterations(2)).force("center",(0,Cc.forceCenter)(o,s).strength(.8)).force("x",(0,Cc.forceX)(o).strength(l)).force("y",(0,Cc.forceY)(s).strength(l)).force("bounds",function(e,t,n=2,r=.6){let i=[];const o=o=>{const s=r*Math.max(o,.2);for(const r of i){const i=r.x??e[0]/2,o=r.y??e[1]/2,a=r.vx??0,l=r.vy??0,c=t(r)+n,u=Math.min(e[0]/2,c),h=Math.max(e[0]/2,e[0]-c),d=Math.min(e[1]/2,c),f=Math.max(e[1]/2,e[1]-c),y=i+a,p=o+l;u>y?r.vx=a+(u-y)*s:y>h&&(r.vx=a+(h-y)*s),d>p?r.vy=l+(d-p)*s:p>f&&(r.vy=l+(f-p)*s)}};return o.initialize=e=>{i=e},o}(r,p)),y.nodes(e),t.length>0){const e=t.map(e=>({...e,source:ne(e.source),target:ne(e.target)}));h.links(e),y.force("link",h)}d?y.alpha(.3):.1>y.alpha()&&y.alpha(1),y.stop();for(let e=0;f>e;++e)y.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=p(t),n=f>0?2:0,i=Math.min(r[0]/2,e+n),o=Math.min(r[1]/2,e+n);t.x=Math.max(i,Math.min(r[0]-i,t.x)),t.y=Math.max(o,Math.min(r[1]-o,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const g=new Map;for(const t of e)g.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=g.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=g.get(e.target);t&&(e.target=t)}}},buildScene(e,t,n,r){const i=n.nodeStyle,o=n.edgeStyle,s=Dc(n.nodeSize,n.nodeSizeRange,e),a=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:ue,l=new Map;e.forEach((e,t)=>{l.set(e.id,a[t%a.length])});const c=[],u=[],h=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=s(Sc(t,"nodeSize")),r=i?i(Sc(t,"nodeStyle")):{},o={fill:r.fill||l.get(t.id)||n.themeSemantic?.primary||"#007bff",stroke:r.stroke||n.themeSemantic?.surface||"#fff",strokeWidth:r.strokeWidth??2,opacity:r.opacity};c.push({type:"circle",cx:t.x,cy:t.y,r:e,style:o,datum:t,id:t.id,label:t.id})}const d=new Map;for(const t of e)d.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:d.get(e.source),r="object"==typeof e.target?e.target:d.get(e.target);if(!t||!r)continue;if(null==t.x||null==t.y)continue;if(null==r.x||null==r.y)continue;const i=o?o(Sc(e,"edgeStyle")):{};u.push({type:"line",x1:t.x,y1:t.y,x2:r.x,y2:r.y,style:{stroke:i.stroke||n.themeSemantic?.border||n.themeSemantic?.secondary||"#999",strokeWidth:i.strokeWidth??1,opacity:i.opacity??.6},datum:e})}if(!1!==n.showLabels){const t=te(n.nodeLabel);for(const n of e){if(null==n.x||null==n.y)continue;const e=t?t(n):n.id;if(!e)continue;const r=s(Sc(n,"nodeSize"));h.push({x:n.x,y:n.y-r-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}return{sceneNodes:c,sceneEdges:u,labels:h}}};function jc(e,t,n){const r=[];for(const i of t){const t=ne(i.source),o=ne(i.target);let s=null;if(t===e?s=o:o===e&&(s=t),s){const e=n.get(s);!e||0===e.x&&0===e.y||r.push({x:e.x,y:e.y})}}return r}function Tc(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}function Dc(e,t,n){if(n.some(e=>null!=e.__forceRadius))return e=>e.__forceRadius??8;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const r=t||[5,20],i=[];for(const t of n){const n=t.data?.[e];"number"==typeof n&&i.push(n)}if(0===i.length)return()=>r[0];const[o,s]=Zr(i);if(o===s)return()=>(r[0]+r[1])/2;const a=(0,Pc.scaleLinear)().domain([o,s]).range(r).clamp(!0);return t=>{const n=t.data?.[e];return null==n||"number"!=typeof n?r[0]:a(n)}}var Lc=require("d3-chord"),Ec=require("d3-shape"),Nc=ue,Ic={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,r){if(0===e.length)return;const{padAngle:i=.01,groupWidth:o=20,sortGroups:s}=n,a=Math.min(r[0],r[1])/2,l=a-o,c=r[0]/2,u=r[1]/2,h=(d=n.valueAccessor)?"function"==typeof d?d:e=>e[d]??1:e=>e.value??1;var d;const f=new Map;for(let t=0;e.length>t;t++)f.set(e[t].id,t);const y=e.length,p=Array.from({length:y},()=>Array.from({length:y},()=>0));for(const e of t){const t=ne(e.source),n=ne(e.target),r=f.get(t),i=f.get(n);if(void 0===r||void 0===i)continue;const o=h(e);p[r][i]=o}const g=(0,Lc.chord)().padAngle(i);s&&g.sortGroups(s);const m=g(p),x=m.groups,v=(0,Ec.arc)().innerRadius(l).outerRadius(a);for(const t of x){const n=e[t.index],r=v.centroid({innerRadius:l,outerRadius:a,startAngle:t.startAngle,endAngle:t.endAngle});n.x=r[0]+c,n.y=r[1]+u,n.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const b=new Map;for(const t of e)b.set(t.id,t);for(const e of t){const t=ne(e.source),n=ne(e.target),r=b.get(t),i=b.get(n);r&&(e.source=r),i&&(e.target=i)}const k=new Map;for(const e of t){const t=ne(e.source),n=ne(e.target);k.set(`${t}\0${n}`,e)}for(const t of m){const n=e[t.source.index].id,r=e[t.target.index].id,i=k.get(`${n}\0${r}`)||k.get(`${r}\0${n}`);i&&(i.__chordData=t)}},buildScene(e,t,n,r){const{groupWidth:i=20,edgeOpacity:o=.5}=n,s=Math.min(r[0],r[1])/2,a=s-i,l=r[0]/2,c=r[1]/2,u=n.nodeStyle,h=n.edgeStyle,d=n.edgeColorBy||"source",f=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:Nc,y=new Map;e.forEach((e,t)=>{y.set(e.id,f[t%f.length])});const p=(0,Lc.ribbon)().radius(a),g=[],m=[],x=[];for(let t=0;e.length>t;t++){const n=e[t],r=n.__arcData;if(!r)continue;let i;i=u?u(Sc(n,"nodeStyle")).fill||y.get(n.id)||f[t%f.length]:y.get(n.id)||f[t%f.length];const o=u?u(Sc(n,"nodeStyle")):{};g.push({type:"arc",cx:l,cy:c,innerR:a,outerR:s,startAngle:r.startAngle-Math.PI/2,endAngle:r.endAngle-Math.PI/2,style:{fill:i,stroke:o.stroke||"black",strokeWidth:o.strokeWidth??1,opacity:o.opacity},datum:n,id:n.id,label:n.id})}for(const e of t){const t=e.__chordData;if(!t)continue;const r=p(t);if(!r)continue;const i=Wc(r,l,c);let s=n.themeSemantic?.border||n.themeSemantic?.secondary||"#999";if(h)s=h(Sc(e,"edgeStyle")).fill||s;else{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;"target"===d&&n?s=y.get(n.id)||s:t&&(s=y.get(t.id)||s)}const a=h?h(Sc(e,"edgeStyle")):{};m.push({type:"ribbon",pathD:i,style:{fill:s,fillOpacity:a.fillOpacity??o,stroke:a.stroke||"none",strokeWidth:a.strokeWidth,opacity:a.opacity},datum:e})}if(!1!==n.showLabels){const t=te(n.nodeLabel),r=s+12;for(const n of e){const e=n.__arcData;if(!e)continue;const i=t?t(n):n.id;if(!i)continue;const o=(e.startAngle+e.endAngle)/2,s=o-Math.PI/2;x.push({x:l+Math.cos(s)*r,y:c+Math.sin(s)*r,text:i+"",anchor:o>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}return{sceneNodes:g,sceneEdges:m,labels:x}}};function Wc(e,t,n){const r=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!r)return e;const i=[];let o=0;for(;r.length>o;){const e=r[o];if("M"===e||"L"===e)for(i.push(e),o++;r.length>o&&!isNaN(Number(r[o]));)i.push(Number(r[o])+t+""),o++,r.length>o&&!isNaN(Number(r[o]))&&(i.push(Number(r[o])+n+""),o++);else if("C"===e)for(i.push(e),o++;r.length>o&&!isNaN(Number(r[o]));)for(let e=0;3>e&&r.length>o&&!isNaN(Number(r[o]));e++)i.push(Number(r[o])+t+""),o++,r.length>o&&!isNaN(Number(r[o]))&&(i.push(Number(r[o])+n+""),o++);else if("Q"===e)for(i.push(e),o++;r.length>o&&!isNaN(Number(r[o]));)for(let e=0;2>e&&r.length>o&&!isNaN(Number(r[o]));e++)i.push(Number(r[o])+t+""),o++,r.length>o&&!isNaN(Number(r[o]))&&(i.push(Number(r[o])+n+""),o++);else if("A"===e)for(i.push(e),o++;r.length>o&&!isNaN(Number(r[o]));)i.push(r[o++]),r.length>o&&i.push(r[o++]),r.length>o&&i.push(r[o++]),r.length>o&&i.push(r[o++]),r.length>o&&i.push(r[o++]),r.length>o&&(i.push(Number(r[o])+t+""),o++),r.length>o&&(i.push(Number(r[o])+n+""),o++);else"Z"===e||"z"===e?(i.push(e),o++):(i.push(r[o]),o++)}return i.join(" ")}var $c=require("d3-hierarchy"),zc=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function Oc(e){const[t,n,r]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*r>150?"#222":"#fff"}function Fc(e,t,n){const r=t.nodeIDAccessor;return"function"==typeof r?r(e.data)+"":"string"==typeof r&&void 0!==e.data[r]?e.data[r]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+n}function Bc(e){if(!e)return null;if("function"==typeof e){const t=e;return e=>t(e.data??e)}return t=>t.data?.[e]||t[e]||t.id}function Yc(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:zc}function Hc(e){return Array.isArray(e.colorScheme)&&e.colorScheme.length>0?e.colorScheme[0]:e.themeSemantic?.primary?e.themeSemantic.primary:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical[0]:"#4d430c"}function Xc(e,t,n,r,i){if("horizontal"===i){const i=(e+n)/2;return`M ${e},${t} C ${i},${t} ${i},${r} ${n},${r}`}if("radial"===i){const i=(e+n)/2;return`M ${e},${t} Q ${i},${t} ${i},${(t+r)/2} T ${n},${r}`}{const i=(t+r)/2;return`M ${e},${t} C ${e},${i} ${n},${i} ${n},${r}`}}var qc={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,n,r){const i=n.__hierarchyRoot;if(!i)return;const o=n.chartType,s=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(n.childrenAccessor),a=n.hierarchySum,l="function"==typeof a?a:"string"==typeof a?e=>Number(e[a])||0:e=>Number(e.value)||0,c=(0,$c.hierarchy)(i,s);c.sum(l),c.sort((e,t)=>(t.value??0)-(e.value??0));const[u,h]=r;switch(o){case"tree":!function(e,t,n,r){const i=t.treeOrientation||"vertical",o=(0,$c.tree)();o.size("horizontal"===i?[r,n]:"radial"===i?[2*Math.PI,Math.min(n,r)/2*.8]:[n,r]),o(e)}(c,n,u,h);break;case"cluster":!function(e,t,n,r){const i=t.treeOrientation||"vertical",o=(0,$c.cluster)();o.size("horizontal"===i?[r,n]:"radial"===i?[2*Math.PI,Math.min(n,r)/2*.8]:[n,r]),o(e)}(c,n,u,h);break;case"treemap":!function(e,t,n,r){const i=t.padding??4,o=t.paddingTop??0,s=(0,$c.treemap)().size([n,r]).tile($c.treemapBinary).padding(i);o>0&&s.paddingTop(o),s(e)}(c,n,u,h);break;case"circlepack":!function(e,t,n,r){const i=t.padding??4;(0,$c.pack)().size([n,r]).padding(i)(e)}(c,n,u,h);break;case"partition":!function(e,t,n,r){(0,$c.partition)().size([n,r]).padding(t.padding??1)(e)}(c,n,u,h)}const d=c.descendants();e.length=0,t.length=0;const f=new Map;for(let t=0;d.length>t;t++){const r=d[t],i={id:Fc(r,n,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:r.value??0,depth:r.depth,data:r.data,createdByFrame:!0};"tree"===o||"cluster"===o?Gc(i,r,n):"treemap"===o||"partition"===o?Vc(i,r):"circlepack"===o&&Uc(i,r),i.__hierarchyNode=r,e.push(i),f.set(r,i)}if("tree"===o||"cluster"===o)for(const e of d)if(e.parent){const n=f.get(e.parent),r=f.get(e);n&&r&&t.push({source:n,target:r,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,n,r){const i=n.nodeStyle||(()=>({})),o=n.edgeStyle||(()=>({}));switch(n.chartType){case"tree":case"cluster":return function(e,t,n,r,i,o){const s=[],a=[],l=[],c=n.treeOrientation||"vertical",u="radial"===c,h=r[0]/2,d=r[1]/2,f="number"==typeof(y=n.nodeSize)?y:5;var y;for(const t of e){let e=t.x,r=t.y;u&&(e+=h,r+=d);const o=i(Sc(t,"nodeStyle"));let a=o.fill||Hc(n);if(n.colorByDepth&&void 0!==t.depth){const e=Yc(n);a=e[t.depth%e.length]}s.push({type:"circle",cx:e,cy:r,r:f,style:{fill:a,stroke:o.stroke||n.themeSemantic?.surface||"#fff",strokeWidth:o.strokeWidth??1,opacity:o.opacity},datum:t,id:t.id,label:t.id,depth:t.depth})}const p=n.edgeOpacity??.5;for(const e of t){const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;if(!t||!r)continue;let i=t.x,s=t.y,l=r.x,f=r.y;u&&(i+=h,s+=d,l+=h,f+=d);const y=Xc(i,s,l,f,c),g=o(Sc(e,"edgeStyle"));a.push({type:"curved",pathD:y,style:{fill:"none",stroke:g.stroke||n.themeSemantic?.border||n.themeSemantic?.secondary||"#999",strokeWidth:g.strokeWidth??1.5,opacity:g.opacity??p},datum:e})}if(!1!==n.showLabels){const t=Bc(n.nodeLabel);for(const n of e){const e=t?t(n):n.id;if(!e)continue;let r,i,o,s=n.x,a=n.y;if(u&&(s+=h,a+=d),u){const e=s-h,t=a-d,n=Math.sqrt(e*e+t*t);n>0?(r=s+e/n*10,i=a+t/n*10,o=0>e?"end":"start"):(r=s,i=a-12,o="middle")}else"horizontal"===c?(n.data?.children&&0!==n.data.children.length?(r=s-f-6,o="end"):(r=s+f+6,o="start"),i=a):(r=s,i=a+f+14,o="middle");l.push({x:r,y:i,text:e+"",anchor:o,baseline:"middle",fontSize:11})}}return{sceneNodes:s,sceneEdges:a,labels:l}}(e,t,n,r,i,o);case"treemap":case"partition":return function(e,t,n,r){const i=[],o=[];for(const n of e){const e=n.x1-n.x0,o=n.y1-n.y0;if(0>=e||0>=o)continue;const s=r(Sc(n,"nodeStyle"));let a=s.fill||Hc(t);if(t.colorByDepth&&void 0!==n.depth){const e=Yc(t);a=e[n.depth%e.length]}i.push({type:"rect",x:n.x0,y:n.y0,w:e,h:o,style:{fill:a,stroke:s.stroke||t.themeSemantic?.surface||"#fff",strokeWidth:s.strokeWidth??1,opacity:s.opacity,fillOpacity:s.fillOpacity,strokeOpacity:s.strokeOpacity},datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=Bc(t.nodeLabel),i=t.labelMode||"leaf",s="partition"===t.chartType;for(const a of e){const e=a.x1-a.x0,l=a.y1-a.y0;if(0>=e||0>=l)continue;const c=!(a.data?.children&&a.data.children.length>0);if(!s){if("leaf"===i&&!c)continue;if("parent"===i&&c)continue}const u=n?n(a):a.id;if(!u)continue;if((c?30:40)>e||(c?16:14)>l)continue;let h=r(Sc(a,"nodeStyle")).fill||Hc(t);if(t.colorByDepth&&void 0!==a.depth){const e=Yc(t);h=e[a.depth%e.length]}const d="string"==typeof h?Oc(h):t.themeSemantic?.text??"#000";o.push(c?{x:a.x0+e/2,y:a.y0+l/2,text:u+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,l)/6)),fill:d}:{x:a.x0+4,y:a.y0+12,text:u+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:d})}}return{sceneNodes:i,sceneEdges:[],labels:o}}(e,n,0,i);case"circlepack":return function(e,t,n,r){const i=[],o=[];for(const n of e){const e=n.__radius??5;if(0>=e)continue;const o=r(Sc(n,"nodeStyle"));let s=o.fill||Hc(t);if(t.colorByDepth&&void 0!==n.depth){const e=Yc(t);s=e[n.depth%e.length]}i.push({type:"circle",cx:n.x,cy:n.y,r:e,style:{fill:s,stroke:o.stroke||t.themeSemantic?.surface||"#fff",strokeWidth:o.strokeWidth??1,opacity:o.opacity??.7},datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=Bc(t.nodeLabel);for(const i of e){const e=i.__radius??5,s=n?n(i):i.id;if(!s)continue;if(15>e)continue;const a=!(i.data?.children&&i.data.children.length>0);let l=r(Sc(i,"nodeStyle")).fill||Hc(t);if(t.colorByDepth&&void 0!==i.depth){const e=Yc(t);l=e[i.depth%e.length]}if(a){const n="string"==typeof l?Oc(l):t.themeSemantic?.text??"#000";o.push({x:i.x,y:i.y,text:s+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:n})}else o.push({x:i.x,y:i.y-e+14,text:s+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:t.themeSemantic?.text||"#000",stroke:t.themeSemantic?.surface||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:i,sceneEdges:[],labels:o}}(e,n,0,i);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function Gc(e,t,n){const r=n.treeOrientation||"vertical";if("radial"===r){const n=t.x,r=t.y;e.x=r*Math.cos(n-Math.PI/2),e.y=r*Math.sin(n-Math.PI/2)}else"horizontal"===r?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function Vc(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function Uc(e,t){const n=t.r??0;e.x=t.x,e.y=t.y,e.x0=t.x-n,e.x1=t.x+n,e.y0=t.y-n,e.y1=t.y+n,e.width=2*n,e.height=2*n,e.__radius=n}var Kc=require("d3-shape");function Qc(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}var Zc={sankey:Mc,force:Rc,chord:Ic,tree:qc,cluster:qc,treemap:qc,circlepack:qc,partition:qc,orbit:{supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,n,r){const i=n.__hierarchyRoot;i&&function(e,t,n,r,i){const o=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(n.childrenAccessor),s=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>(e[t]??"")+""}(n.nodeIDAccessor),a=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(n.orbitMode),l=n.orbitSize??2.95,c=n.orbitEccentricity??1,u="number"==typeof l?()=>l:l,h="number"==typeof c?()=>c:c,d=Qc(n);d.metaMap.clear(),r.length=0,i.length=0;const f=new Map;function y(e){const t=f.get(e)??0;return f.set(e,t+1),0===t?e:`${e}__${t}`}const p=t[0]/2,g=t[1]/2,m=Math.min(t[0],t[1])/2*.85,x=y(s(e));r.push({id:x,x:p,y:g,x0:p,x1:p,y0:g,y1:g,width:0,height:0,value:0,depth:0,data:e}),d.metaMap.set(x,{ring:m,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,n,l,c,f,p,g){const m=o(t);if(!m?.length)return;const x=m.length;let v=0,b=0,k=0;for(;x>b;)b+=a[Math.min(k,a.length-1)],k++,v++;let w=0;for(let x=0;v>x;x++){const b=a[Math.min(x,a.length-1)],k=m.slice(w,w+b);if(!k.length)break;const A=(x+1)/v,S={id:n,depth:p,data:t,parentId:n},_=g?f/u(S)*A:f*A,M=(0,Kc.pie)().value(e=>{const t=o(e)?.length;return t?4:1}).sort(null)(k),C=h(S);for(let t=0;k.length>t;t++){const o=(M[t].startAngle+M[t].endAngle)/2,a=k[t],u=y(s(a)),h=l+_*Math.sin(o),f=c+_*Math.cos(o)*C;r.push({id:u,x:h,y:f,x0:h,x1:h,y0:f,y1:f,width:0,height:0,value:0,depth:p,data:a}),d.metaMap.set(u,{ring:_,angle:o,depth:p,parentId:n,eccentricity:C}),i.push({source:n,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:n,target:u}}),e(a,u,h,f,_,p+1,!0)}w+=b}}(e,x,p,g,m,1,!1)}(i,r,n,e,t)},buildScene(e,t,n,r){const i=n.nodeStyle,o=n.nodeSize,s="number"==typeof o?()=>o:"function"==typeof o?o:()=>6,a=[],l=[],c=[];if(!1!==n.orbitShowRings){const t=Qc(n),r=new Map;for(const t of e)r.set(t.id,t);const i=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=r.get(e.parentId);if(!t)continue;const n=`${e.parentId}:${e.ring}`;i.has(n)||i.set(n,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const o=48,s={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:n,ecc:r}]of i)for(let i=0;o>i;i++){const a=i/o*Math.PI*2,c=(i+1)/o*Math.PI*2;l.push({type:"line",x1:e+n*Math.sin(a),y1:t+n*Math.cos(a)*r,x2:e+n*Math.sin(c),y2:t+n*Math.cos(c)*r,style:s,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=s(Sc(t,"nodeSize")),r=i?i(Sc(t,"nodeStyle")):{};a.push({type:"circle",cx:t.x,cy:t.y,r:e,style:{fill:r.fill||n.themeSemantic?.primary||"#6366f1",stroke:r.stroke||n.themeSemantic?.surface||"#fff",strokeWidth:r.strokeWidth??1,opacity:r.opacity??(0===(t.depth??0)?1:.85)},datum:t,id:t.id,label:t.id,depth:t.depth})}const u=new Map;for(const t of e)u.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:u.get(e.source),n="object"==typeof e.target?e.target:u.get(e.target);t&&n&&(null!=t.x&&null!=n.x&&l.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(n.showLabels){const t=n.nodeLabel;for(const n of e){const e=s(Sc(n,"nodeSize"));if(4>=e)continue;const r="function"==typeof t?t(n):t?n.data?.[t]??n.id:n.id;c.push({x:n.x,y:n.y+e+12,text:r+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:a,sceneEdges:l,labels:c}},tick:(e,t,n,r,i)=>!1!==n.orbitAnimated&&(function(e,t){const n=Qc(t),r=t.orbitSpeed??.25,i=t.orbitRevolution??function(e){switch(e){case"decay":return e=>Math.pow(.6,e.depth??0);case"alternate":return e=>{const t=e.depth??0;return(t%2==0?1:-1)/(t+1)};default:return e=>1/((e.depth??0)+1)}}(t.orbitRevolutionStyle),o=(("undefined"!=typeof performance?performance.now():Date.now())-n.startTime)/1e3,s=r*(Math.PI/6),a=new Map;for(const t of e)a.set(t.id,t);for(const t of e){const e=n.metaMap.get(t.id);if(!e||!e.parentId)continue;const r=a.get(e.parentId);if(!r)continue;const l=e.angle+o*s*i({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=r.x+e.ring*Math.sin(l),t.y=r.y+e.ring*Math.cos(l)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,n),!0)}};function Jc(e){return Zc[e]}var eu=require("d3-quadtree");function tu(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function nu(e){if(!e||"object"!=typeof e)return!1;const t=e;if("boolean"!=typeof t.circular)return!1;if("number"!=typeof t.halfWidth||!Number.isFinite(t.halfWidth))return!1;if(t.circular){if(!Array.isArray(t.segments)||0===t.segments.length)return!1;for(const e of t.segments)if(!ru(e))return!1;return!0}return ru(t.points)}function ru(e){if(!Array.isArray(e)||4!==e.length)return!1;for(const t of e){if(!t||"object"!=typeof t)return!1;const e=t;if("number"!=typeof e.x||!Number.isFinite(e.x))return!1;if("number"!=typeof e.y||!Number.isFinite(e.y))return!1}return!0}var iu=require("d3-interpolate");var ou="rgba(34, 197, 94, 0.7)",su=2e3,au=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],lu=["scene-style","data-paint","accessibility","evidence"],cu=(e,t)=>({retainedData:e,invalidations:t}),uu=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],hu=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],du=["scene-geometry","data-paint","overlay","accessibility","evidence"],fu=["scene-style","data-paint","accessibility","evidence"],yu=["scene-geometry","data-paint","overlay","accessibility","evidence"],pu=[],gu={chartType:cu("rebuild",uu),nodeIDAccessor:cu("rebuild",uu),sourceAccessor:cu("rebuild",uu),targetAccessor:cu("rebuild",uu),valueAccessor:cu("rebuild",uu),edgeIdAccessor:cu("rebuild",uu),childrenAccessor:cu("rebuild",uu),hierarchySum:cu("rebuild",uu),orientation:cu("preserve",hu),nodeAlign:cu("preserve",hu),nodePaddingRatio:cu("preserve",hu),nodeWidth:cu("preserve",hu),edgeSort:cu("preserve",hu),iterations:cu("preserve",hu),forceStrength:cu("preserve",hu),padAngle:cu("preserve",hu),groupWidth:cu("preserve",hu),sortGroups:cu("preserve",hu),treeOrientation:cu("preserve",hu),edgeType:cu("preserve",hu),padding:cu("preserve",hu),paddingTop:cu("preserve",hu),orbitMode:cu("preserve",hu),orbitSize:cu("preserve",hu),orbitSpeed:cu("preserve",hu),orbitRevolution:cu("preserve",hu),orbitRevolutionStyle:cu("preserve",hu),orbitEccentricity:cu("preserve",hu),orbitShowRings:cu("preserve",hu),orbitAnimated:cu("preserve",hu),customNetworkLayout:cu("preserve",hu),layoutConfig:cu("preserve",hu),nodeSize:cu("preserve",du),nodeSizeRange:cu("preserve",du),colorByDepth:cu("preserve",du),nodeLabel:cu("preserve",yu),showLabels:cu("preserve",yu),labelMode:cu("preserve",yu),nodeStyle:cu("preserve",fu),edgeStyle:cu("preserve",fu),colorBy:cu("preserve",fu),colorScheme:cu("preserve",fu),themeCategorical:cu("preserve",fu),themeSemantic:cu("preserve",fu),edgeColorBy:cu("preserve",fu),edgeOpacity:cu("preserve",fu),showParticles:cu("preserve",fu),particleStyle:cu("preserve",fu),decay:cu("preserve",fu),pulse:cu("preserve",fu),thresholds:cu("preserve",fu),staleness:cu("preserve",fu),layoutSelection:cu("preserve",fu),clock:cu("preserve",pu),random:cu("preserve",pu),seed:cu("preserve",pu),tensionConfig:cu("preserve",pu),transition:cu("preserve",pu),introAnimation:cu("preserve",pu),onLayoutError:cu("preserve",pu),__skipForceSimulation:cu("preserve",pu),__hierarchyRoot:cu("preserve",pu),__orbitState:cu("preserve",pu),__previousPositions:cu("preserve",pu)},mu=cu("preserve",hu),xu=class{constructor(){this.tracker=new Ft}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},au)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},lu):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const n=new Set;for(const r of e){const e=gu[r]??mu;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)n.add(t)}return{retainedData:t,invalidations:n}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}};function vu(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>n&&Re(n,e)||"#4e79a7":t=>{if(n){const e=Re(n,t);if(e)return e}let r=0;for(let e=0;t.length>e;e++)r=31*r+t.charCodeAt(e)|0;return e[Math.abs(r)%e.length]??"#4e79a7"}}var bu=class e{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this.customLayoutHtmlMarks=[],this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._nodeQuadtree=null,this._maxNodeRadius=0,this._sceneNodesRevision=0,this._nodeQuadtreeRevision=-1,this._nodesArrCache=null,this._edgesArrCache=null,this._arrCacheVersion=-1,this.particlePool=null,this.updateResults=new xu,this.transition=null,this._hasRenderedOnce=!1,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this._decayAgeMap=null,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._networkDecayCache=null,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig={...Cl,...e.tensionConfig},e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new Rl(2e3))}currentTime(){return this.config.clock?.()??Le()}updateConfig(e){const t=this.config,n={...t,...e};t.__orbitState&&(n.__orbitState=t.__orbitState),t.__hierarchyRoot&&(n.__hierarchyRoot=t.__hierarchyRoot),void 0===e.layoutSelection&&null!=t.layoutSelection&&(n.layoutSelection=t.layoutSelection);const r=[...new Set([...Object.keys(t),...Object.keys(n)])].filter(e=>t[e]!==n[e]);this.config=n,this.tensionConfig={...Cl,...n.tensionConfig},!n.showParticles||"sankey"!==n.chartType&&!n.customNetworkLayout||this.particlePool||(this.particlePool=new Rl(2e3)),this.updateResults.recordConfig(r)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}ingestHierarchy(e,t){this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this.config.__hierarchyRoot=e,this.runLayout(t),this._boundedPrevSnapshot=null,this.updateResults.recordData("replace",1)}ingestBounded(e,t,n,r){const{nodeIDAccessor:i="id",sourceAccessor:o="source",targetAccessor:s="target",valueAccessor:a="value"}=this.config,l="function"==typeof i?i:e=>e[i],c="function"==typeof o?o:e=>e[o],u="function"==typeof s?s:e=>e[s],h="function"==typeof a?a:e=>e[a]??1;this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=new Map;for(const[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(const t of e){const e=l(t)+"";this.nodes.set(e,{...tu(e),data:t})}for(let e=0;t.length>e;e++){const n=t[e],r=c(n)+"",i=u(n)+"",o=h(n),s=null==o?NaN:Number(o),a=Number.isFinite(s)?s:1;this.nodes.has(r)||this.nodes.set(r,{...tu(r),data:n}),this.nodes.has(i)||this.nodes.set(i,{...tu(i),data:n});const l=`${r}\0${i}\0${e}`,d={source:r,target:i,value:a,y0:0,y1:0,sankeyWidth:0,data:n,_edgeKey:l};n&&"object"==typeof n&&nu(n.bezier)&&(d.bezier=n.bezier),this.edges.set(l,d)}r?.deferLayout||this.runLayout(n),this.updateResults.recordData("replace",e.length+t.length)}ingestBoundedWithResult(e,t,n,r){return this.ingestBounded(e,t,n,r),this.updateResults.last}applyForceLayoutPositions(e,t){for(const[t,n]of Object.entries(e)){const e=this.nodes.get(t);e&&(e.x=n.x,e.y=n.y)}this.config.__skipForceSimulation=!0;try{this.runLayout(t)}finally{this.config.__skipForceSimulation=void 0}}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:n,value:r}=e,i=0===this.nodes.size;let o=!1;const s=this.currentTime();this.lastIngestTime=s,this._decaySortedNodes=null,this._networkDecayCache=null,this.nodes.has(t)||(this.nodes.set(t,tu(t)),this.nodeTimestamps.set(t,s),this.tension+=this.tensionConfig.newNode,o=!0),this.nodes.has(n)||(this.nodes.set(n,tu(n)),this.nodeTimestamps.set(n,s),this.tension+=this.tensionConfig.newNode,o=!0);const a=this.edgeKey(t,n),l=this.edges.get(a);let c=!1;l?(l.value+=r,this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(a,{source:t,target:n,value:r,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.newEdge,o=!0);const u=i||o||c||this.tension>=this.tensionConfig.threshold;return this.updateResults.recordData("ingest",1),u}ingestEdgeWithResult(e){return this.ingestEdge(e),this.updateResults.last}runLayout(e){if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const t=Jc(this.config.chartType);if(!t)return;let n=Array.from(this.nodes.values());const r=Array.from(this.edges.values());if(0===n.length&&!t.hierarchical)return;if(this.prepareForRelayout(),t.supportsStreaming&&!t.hierarchical){const e=new Map;for(const t of n)void 0!==t._prevX0?e.set(t.id,{x:(t._prevX0??0)+((t._prevX1??0)-(t._prevX0??0))/2,y:(t._prevY0??0)+((t._prevY1??0)-(t._prevY0??0))/2}):0===t.x&&0===t.y||e.set(t.id,{x:t.x,y:t.y});if(this._lastPositionSnapshot)for(const[t,n]of this._lastPositionSnapshot)e.has(t)||e.set(t,n);this.config.__previousPositions=e.size>0?e:void 0}if(t.computeLayout(n,r,this.config,e),this.config.__previousPositions=void 0,t.hierarchical&&n.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(const e of n)this.nodes.set(e.id,e);for(let e=0;r.length>e;e++){const t=r[e],n=t._edgeKey||`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}\0${e}`;t._edgeKey=n,this.edges.set(n,t)}const e=this._boundedPrevSnapshot;if(e&&e.size>0)for(const t of this.nodes.values()){const n=e.get(t.id);n&&(t._prevX0=n.x0,t._prevX1=n.x1,t._prevY0=n.y0,t._prevY1=n.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,n=Array.from(this.nodes.values())}this.finalizeLayout();const i=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||i.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=i,this.saveTargetPositions();const o=n.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),s=this.config.transition?.duration??this.tensionConfig.transitionDuration,a=["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType);if(!this._hasRenderedOnce&&this.config.introAnimation&&a&&n.length>0&&s>0){const t=e[0]/2,n=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=n,e._prevY1=n;for(const e of this.edges.values())e._prevY0=n,e._prevY1=n,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:s}}else o&&s>0&&(this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:s});this._hasRenderedOnce=!0,this.recordTopologyDiff(),this.layoutVersion++}recordTopologyDiff(){const e=new Set(this.nodes.keys()),t=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 e)this.previousNodeIds.has(t)||this.addedNodes.add(t);for(const t of this.previousNodeIds)e.has(t)||this.removedNodes.add(t);for(const e of t)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)t.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime=this.currentTime()),this.previousNodeIds=e,this.previousEdgeKeys=t}restyleScene(e){const t=function({nodes:e,edges:t,restyle:n,restyleEdge:r,baseStyles:i,selection:o}){const s=!(!n&&!r);if(n)for(const t of e){const e=i.get(t)??t.style,r=n(t,o);t.style=r?{...e,...r}:e}if(r)for(const e of t){const t=i.get(e)??e.style,n=r(e,o);e.style=n?{...t,...n}:t}return s}({nodes:this.sceneNodes,edges:this.sceneEdges,restyle:this._customRestyle,restyleEdge:this._customRestyleEdge,baseStyles:this._baseStyles,selection:e});this.markStylePaintPending(),this.updateResults.recordRestyle(t)}buildScene(e){if(this.config.customNetworkLayout){const t=function({config:e,customLayout:t,size:n,nodes:r,edges:i,previousResult:o,revision:s}){const a=function(e,t,n=_e){if(e&&"object"==typeof e&&!Array.isArray(e)){const t=Object.values(e).filter(e=>"string"==typeof e&&e.length>0);if(t.length>0)return t}if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=Se[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(e.colorScheme,e.themeCategorical,ue),l={nodes:r,edges:i,dimensions:{width:n[0],height:n[1],plot:{x:0,y:0,width:n[0],height:n[1]}},theme:{semantic:e.themeSemantic??{},categorical:[...a]},resolveColor:vu(a,e.colorScheme),config:e.layoutConfig??{},selection:e.layoutSelection??null};try{return{kind:"success",result:t(l)}}catch(t){const n=null!==o,r=At("network",t,n,s);"production"!==process.env.NODE_ENV&&console.error("[semiotic] customNetworkLayout threw:",t);try{e.onLayoutError?.(r)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return{kind:"failure",diagnostic:r,preservedLastGoodScene:n}}}({config:this.config,customLayout:this.config.customNetworkLayout,size:e,nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values()),previousResult:this.lastCustomLayoutResult,revision:this.layoutVersion});if("failure"===t.kind)return this.lastCustomLayoutFailure=t.diagnostic,void(t.preservedLastGoodScene||(this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._sceneNodesRevision++));const n=t.result;return this.sceneNodes=n.sceneNodes??[],this.sceneEdges=n.sceneEdges??[],this.labels=n.labels??[],this.customLayoutOverlays=n.overlays??null,this.customLayoutHtmlMarks=n.htmlMarks??[],this.lastCustomLayoutResult=n,this.lastCustomLayoutFailure=null,this._sceneNodesRevision++,this._customRestyle=n.restyle,this._customRestyleEdge=n.restyleEdge,this.hasCustomRestyle=!(!n.restyle&&!n.restyleEdge),this.hasCustomRestyle&&(this._baseStyles=function(e,t){const n=new WeakMap;for(const t of e)n.set(t,t.style);for(const e of t)n.set(e,e.style);return n}(this.sceneNodes,this.sceneEdges),this.restyleScene(this.config.layoutSelection??null)),void bt({label:"customNetworkLayout",nodes:this.sceneNodes,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned})}this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null;const t=Jc(this.config.chartType);if(!t)return void this._sceneNodesRevision++;const n=t.hierarchical?Array.from(this.nodes.values()):this.nodesArray,r=t.hierarchical?Array.from(this.edges.values()):this.edgesArray,{sceneNodes:i,sceneEdges:o,labels:s}=t.buildScene(n,r,this.config,e);this.sceneNodes=i,this.sceneEdges=o,this.labels=s,this._sceneNodesRevision++}rebuildNodeQuadtree(){let t=0,n=0;for(const e of this.sceneNodes)"circle"===e.type&&(t++,e.r>n&&(n=e.r));if(this._maxNodeRadius=n,e.QUADTREE_THRESHOLD>=t)return void(this._nodeQuadtree=null);const r=Array(t);let i=0;for(const e of this.sceneNodes)"circle"===e.type&&(r[i++]=e);this._nodeQuadtree=(0,eu.quadtree)().x(e=>e.cx).y(e=>e.cy).addAll(r)}get nodeQuadtree(){return this._nodeQuadtreeRevision!==this._sceneNodesRevision&&(this.rebuildNodeQuadtree(),this._nodeQuadtreeRevision=this._sceneNodesRevision),this._nodeQuadtree}get maxNodeRadius(){return this._maxNodeRadius}_ensureArrays(){this._arrCacheVersion===this.layoutVersion&&this._nodesArrCache&&this._edgesArrCache||(this._nodesArrCache=Array.from(this.nodes.values()),this._edgesArrCache=Array.from(this.edges.values()),this._arrCacheVersion=this.layoutVersion)}get nodesArray(){return this._ensureArrays(),this._nodesArrCache}get edgesArray(){return this._ensureArrays(),this._edgesArrCache}get isAnimating(){const e=Jc(this.config.chartType);return!!e?.supportsAnimation&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const n=Jc(this.config.chartType);if(!n?.tick)return!1;const r=n.hierarchical?Array.from(this.nodes.values()):this.nodesArray,i=n.hierarchical?Array.from(this.edges.values()):this.edgesArray;return n.tick(r,i,this.config,e,t)}cancelIntroAnimation(){this.transition=null;for(const e of this.nodes.values())e._prevX0=void 0,e._prevX1=void 0,e._prevY0=void 0,e._prevY1=void 0;for(const e of this.edges.values())e._prevY0=void 0,e._prevY1=void 0,e._prevSankeyWidth=void 0,e._introFromZero=!1}advanceTransition(e){if(!this.transition)return!1;const t=Te(e,this.transition),n=je(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=De(e._prevX0,e._targetX0,n),e.x1=De(e._prevX1,e._targetX1,n),e.y0=De(e._prevY0,e._targetY0,n),e.y1=De(e._prevY1,e._targetY1,n));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&(e._prevSankeyWidth>0||e._introFromZero)&&(e.y0=De(e._prevY0,e._targetY0,n),e.y1=De(e._prevY1,e._targetY1,n),e.sankeyWidth=De(e._prevSankeyWidth,e._targetSankeyWidth,n));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const n=e?.get(t.id);n&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=n.x0,t._prevX1=n.x1,t._prevY0=n.y0,t._prevY1=n.y1):(t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1)}const t=this._boundedEdgeSnapshot;for(const e of this.edges.values()){if(t&&0===e.sankeyWidth){const n=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(n){e._prevY0=n.y0,e._prevY1=n.y1,e._prevSankeyWidth=n.sankeyWidth;continue}}e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth),e._introFromZero=void 0;this.rebuildAllBeziers()}updateEdgeBezier(e){!function(e,t,n=.5){const r="string"==typeof e.source?t.get(e.source):e.source,i="string"==typeof e.target?t.get(e.target):e.target;!r||!i||(e.bezier=e.circular&&e.circularPathData?function(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,n=e.circularPathData;if(!n)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(n.rightFullExtent-n.sourceX))),r=Math.max(15,Math.min(40,.33*(n.targetX-n.leftFullExtent)));return{circular:!0,segments:[[{x:n.sourceX,y:n.sourceY},{x:n.sourceX+.33*e,y:n.sourceY},{x:n.sourceX+.66*e,y:n.sourceY},{x:n.sourceX+e,y:n.sourceY}],[{x:n.targetX-r,y:n.targetY},{x:n.targetX-.66*r,y:n.targetY},{x:n.targetX-.33*r,y:n.targetY},{x:n.targetX,y:n.targetY}]],halfWidth:t}}let r;r="down"===e.direction?[{x:n.sourceY,y:n.sourceX},{x:n.sourceY,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.leftFullExtent},{x:n.targetY,y:n.leftFullExtent},{x:n.targetY,y:n.targetX}]:[{x:n.sourceX,y:n.sourceY},{x:n.rightFullExtent,y:n.sourceY},{x:n.rightFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.targetY},{x:n.targetX,y:n.targetY}];const i=[];for(let e=0;r.length-1>e;e++){const t=r[e],n=r[e+1],o=n.x-t.x,s=n.y-t.y;i.push([t,{x:t.x+o/3,y:t.y+s/3},{x:t.x+2*o/3,y:t.y+2*s/3},n])}return{circular:!0,segments:i,halfWidth:t}}(e):function(e,t,n,r=.5){const i=(e.sankeyWidth||1)/2;if("down"===e.direction){const o=t.x1,s=n.x0,a=(0,iu.interpolateNumber)(o,s);return{circular:!1,points:[{x:e.y0,y:o},{x:e.y0,y:a(r)},{x:e.y1,y:a(1-r)},{x:e.y1,y:s}],halfWidth:i}}const o=t.x1,s=n.x0,a=(0,iu.interpolateNumber)(o,s);return{circular:!1,points:[{x:o,y:e.y0},{x:a(r),y:e.y0},{x:a(1-r),y:e.y1},{x:s,y:e.y1}],halfWidth:i}}(e,r,i,n))}(e,this.nodes,.5)}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){!function(e){const t=e.pulse;if(!t)return;const n=t.duration??500,r=t.color??"rgba(255,255,255,0.6)",i=t.glowRadius??4,{now:o}=e;for(const t of e.sceneNodes){const s=t.id;if(!s)continue;const a=e.nodeTimestamps.get(s);if(!a)continue;const l=o-a;n>l&&(t._pulseIntensity=1-l/n,t._pulseColor=r,t._pulseGlowRadius=i)}for(const t of e.sceneEdges){const i=t.datum;if(!i)continue;const s="object"==typeof i.source?i.source?.id:i.source,a="object"==typeof i.target?i.target?.id:i.target;if(!s||!a)continue;const l=e.edgeTimestamps.get(`${s}\0${a}`);if(!l)continue;const c=o-l;n>c&&(t._pulseIntensity=1-c/n,t._pulseColor=r)}}({sceneNodes:this.sceneNodes,sceneEdges:this.sceneEdges,nodeTimestamps:this.nodeTimestamps,edgeTimestamps:this.edgeTimestamps,pulse:this.config.pulse,now:e})}applyDecay(){this._networkDecayCache||(this._networkDecayCache={sortedNodes:null,ageMap:null}),this._decaySortedNodes||(this._networkDecayCache.sortedNodes=null,this._networkDecayCache.ageMap=null),function(e){const t=e.decay;if(!t)return;const n=e.nodeTimestamps.size;if(1>=n)return;if(!e.cache.sortedNodes){e.cache.sortedNodes=Array.from(e.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]);const t=new Map;for(let n=0;e.cache.sortedNodes.length>n;n++)t.set(e.cache.sortedNodes[n][0],n);e.cache.ageMap=t}const r=e.cache.ageMap;for(const i of e.sceneNodes){const e=i.id;if(!e)continue;const o=r.get(e);if(void 0===o)continue;const s=Fe(t,o,n);i.style={...i.style,opacity:(i.style?.opacity??1)*s}}}({sceneNodes:this.sceneNodes,nodeTimestamps:this.nodeTimestamps,decay:this.config.decay,cache:this._networkDecayCache}),this._decaySortedNodes=this._networkDecayCache.sortedNodes,this._decayAgeMap=this._networkDecayCache.ageMap}applyTopologyDiff(e){!function(e){for(const t of e.sceneNodes)t._pulseColor===ou&&(t._pulseIntensity=0,t._pulseColor=void 0,t._pulseGlowRadius=void 0);if(0===e.addedNodes.size)return;const t=e.now-e.lastTopologyChangeTime;if(t>=su)return;const n=1-t/su;for(const t of e.sceneNodes){const r=t.id;r&&e.addedNodes.has(r)&&(t._pulseIntensity=Math.max(t._pulseIntensity??0,n),t._pulseColor=ou,t._pulseGlowRadius=8)}}({sceneNodes:this.sceneNodes,addedNodes:this.addedNodes,lastTopologyChangeTime:this.lastTopologyChangeTime,now:e})}get hasActiveTopologyDiff(){return function(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){return 0!==e.size&&su>n-t}(this.addedNodes,this.lastTopologyChangeTime)}applyThresholds(e){!function(e){const t=e.thresholds;if(!t)return;const n=t.warningColor??"#f59e0b",r=t.criticalColor??"#ef4444",i=!1!==t.pulse;for(const o of e.sceneNodes){const s=o.id;if(!s)continue;const a=e.nodes.get(s);if(!a)continue;const l=t.metric(a);let c=null;void 0===t.critical||t.critical>l?void 0===t.warning||t.warning>l||(c=n):c=r,c&&(o.style={...o.style,fill:c},i&&(o._pulseIntensity=.6+.4*Math.sin(e.now/300),o._pulseColor=c,o._pulseGlowRadius=6))}}({sceneNodes:this.sceneNodes,nodes:this.nodes,thresholds:this.config.thresholds,now:e})}get hasActiveThresholds(){return function(e,t){if(!t)return!1;for(const n of e){const e=t.metric(n);if(void 0!==t.warning&&e>=t.warning||void 0!==t.critical&&e>=t.critical)return!0}return!1}(this.nodes.values(),this.config.thresholds)}get hasActivePulses(){return function(e){const t=e.pulse;if(!t||0===e.lastIngestTime)return!1;const n=e.now??("undefined"!=typeof performance?performance.now():Date.now());return(t.duration??500)>n-e.lastIngestTime}({pulse:this.config.pulse,lastIngestTime:this.lastIngestTime})}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){const n=this.nodes.get(e);if(!n)return this.updateResults.recordNoop("update"),null;const r=n.data?{...n.data}:{};return n.data=t(n.data??{}),this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",1),r}updateEdge(e,t,n){const r=this.config.valueAccessor,i="function"==typeof r?r:r?e=>e[r]:e=>e.value,o=[];for(const[,r]of this.edges)if(("string"==typeof r.source?r.source:r.source.id)===e&&("string"==typeof r.target?r.target:r.target.id)===t){o.push(r.data?{...r.data}:{}),r.data=n(r.data??{});const e=i(r.data);null!=e&&(r.value=Number(e))}return o.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",o.length)):this.updateResults.recordNoop("update"),o}removeNode(e){if(!this.nodes.has(e))return this.updateResults.recordNoop("remove"),!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,n]of this.edges)("string"==typeof n.source?n.source:n.source.id)!==e&&("string"==typeof n.target?n.target:n.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",1),!0}removeEdge(e,t){const n=[];if(void 0===t){const t=this.config.edgeIdAccessor;if(!t)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");const r="function"==typeof t?t:e=>e?.[t];for(const[t,i]of this.edges)i.data&&r(i.data)===e&&n.push(t)}else for(const[r,i]of this.edges)("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t&&n.push(r);for(const e of n)this.edges.delete(e),this.edgeTimestamps.delete(e);return n.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",n.length)):this.updateResults.recordNoop("remove"),n.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this._decayAgeMap=null,this._nodeQuadtree=null,this._nodesArrCache=null,this._edgesArrCache=null,this._sceneNodesRevision++,this.tension=0,this.layoutVersion++,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.particlePool&&this.particlePool.clear(),this.updateResults.recordData("clear")}};bu.QUADTREE_THRESHOLD=500;var ku=bu;Wt(ku);var wu=p(require("react")),Au=require("react/jsx-runtime");function Su(e){const{width:t,height:n,totalWidth:r,totalHeight:i,margin:o,labels:s,title:a,legend:l,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:h,legendIsolatedCategories:d,legendPosition:f="right",legendLayout:y,foregroundGraphics:p,sceneNodes:g,annotations:m,onAnnotationActivate:x,onObservation:v,chartId:b,chartType:k,autoPlaceAnnotations:w,svgAnnotationRules:A}=e,S=Ti({onAnnotationActivate:x,onObservation:v,chartId:b,chartType:k}),_=wu.useMemo(()=>{const e=(g||[]).flatMap(e=>{const t=function(e){if("glyph"===e.type&&e.glyph&&"number"==typeof e.size){const t=e.cx??e.x,n=e.cy??e.y;if("number"!=typeof t||"number"!=typeof n)return null;const r=Wn(e.glyph,e.size);return{x:t+r.centerDx,y:n+r.centerDy,r:Math.max(1,r.radius)}}const t=e.cx??(null!=e.x&&null!=e.w?e.x+e.w/2:e.x),n=e.cy??(null!=e.y&&null!=e.h?e.y+e.h/2:e.y);return"number"!=typeof t||"number"!=typeof n?null:{x:t,y:n,r:"number"==typeof e.r?Math.max(1,e.r):"number"==typeof e.outerR?Math.max(1,e.outerR):"number"==typeof e.size?Math.max(1,pt(e.size)):Math.max(1,e.w??0,e.h??0)/2}}(e),n=function(e){const t=e.id??e.datum?.id??e.datum?.data?.id??e.datum?.data?.name;return null==t?void 0:t+""}(e);return t?[{pointId:n,...t}]:[]});return{scales:null,width:t,height:n,frameType:"network",pointNodes:e,sceneNodes:g}},[n,g,t]),M=wu.useMemo(()=>{if(!m)return m;const e=so(m);return w?oo({annotations:e,context:_,..."object"==typeof w?w:{}}):e},[m,w,_]),C=wu.useMemo(()=>Oi(),[]),P=M?zi(M.filter(e=>"widget"!==e.type),C,A,_):null,R=!0===M?.some(e=>"widget"===e.type&&!0===e._annotationDeferred);return(0,Au.jsxs)(Au.Fragment,{children:[R&&(0,Au.jsx)("style",{children:Ai},"annotation-widget-disclosure-style"),(0,Au.jsxs)("svg",{role:"img",width:r,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[(0,Au.jsx)("title",{children:"string"==typeof a?a:"Network Chart"}),(0,Au.jsx)("desc",{children:"string"==typeof a?a+" (network data visualization)":"Network data visualization"}),(0,Au.jsxs)("g",{transform:`translate(${o.left},${o.top})`,children:[s.map((e,t)=>(0,Au.jsx)("text",{x:e.x,y:e.y,textAnchor:e.anchor||"start",dominantBaseline:e.baseline||"middle",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,style:{pointerEvents:"none"},children:e.text},"label-"+t)),P,p]}),a&&"string"==typeof a?(0,Au.jsx)("text",{x:r/2,y:22,textAnchor:"middle",fontWeight:600,fill:"currentColor",fontSize:14,className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:a}):a?(0,Au.jsx)("foreignObject",{x:0,y:0,width:r,height:o.top,children:a}):null,Ur({legend:l,totalWidth:r,totalHeight:i,margin:o,legendPosition:f,title:a,legendLayout:y,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:h,legendIsolatedCategories:d})]}),M?.filter(e=>"widget"===e.type&&e.nodeId&&g).map((e,t)=>{const n=!0===e._annotationDeferred,r=g.find(t=>t.id===e.nodeId||t.datum?.id===e.nodeId||t.datum?.data?.id===e.nodeId||t.datum?.data?.name===e.nodeId);if(!r)return null;const i=o.left+(r.cx??(null!=r.x&&null!=r.w?r.x+r.w/2:r.x??0)),s=o.top+(r.cy??(null!=r.y&&null!=r.h?r.y+r.h/2:r.y??0)),a=e.dx??0,l=e.dy??-16,c=e.width??32,u=e.height??32,h=e.content??(0,Au.jsx)("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return(0,Au.jsx)("div",{...Di(e,S),className:n?"annotation-deferred":void 0,"data-annotation-disclosure":n?"deferred":void 0,style:{position:"absolute",left:i+a-c/2,top:s+l-u/2,width:c,height:u,display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:h},"widget-"+t)})]})}Su.displayName="NetworkSVGOverlay";var _u=p(require("react")),Mu=require("react/jsx-runtime"),Cu={position:"absolute",top:0,left:0,pointerEvents:"none"};function Pu({marks:e,margin:t,selection:n=null,overscan:r=400}){const i=_u.useRef(null),o=function(e,t,n){const[r,i]=_u.useState(null);return _u.useLayoutEffect(()=>{const e=t.current,n=function(e){let t=e?.parentElement??null;for(;t;){const{overflow:e,overflowX:n,overflowY:r}=window.getComputedStyle(t);if(/(auto|scroll|overlay)/.test(`${e} ${r} ${n}`))return t;t=t.parentElement}return null}(e);if(!e||!n)return void i(null);let r=0;const o=()=>{r=0;const t=n.getBoundingClientRect(),o=e.getBoundingClientRect();i(0!==t.width&&0!==t.height?{scroll:{left:t.left,top:t.top,right:t.right,bottom:t.bottom},originX:o.left,originY:o.top}:null)},s=()=>{0===r&&(r=window.requestAnimationFrame(o))};o(),n.addEventListener("scroll",s,{passive:!0});const a=new ResizeObserver(s);return a.observe(n),()=>{0!==r&&window.cancelAnimationFrame(r),n.removeEventListener("scroll",s),a.disconnect()}},[t,e,n]),_u.useMemo(()=>{if(!e||!r)return e;const{scroll:t,originX:i,originY:o}=r,s=t.left-n,a=t.right+n,l=t.top-n,c=t.bottom+n;return e.filter(e=>{const t=i+e.x,n=o+e.y;return!(s>t+e.width||t>a||l>n+e.height||n>c)})},[e,r,n])}(e,i,r);if(!e||0===e.length)return null;const s=(0,Mu.jsx)("div",{className:"semiotic-network-html-marks",ref:i,style:{...Cu,transform:`translate(${t.left}px, ${t.top}px)`},children:(o??e).map(e=>(0,Mu.jsx)("div",{className:"semiotic-network-html-mark","data-mark-id":e.id,style:{position:"absolute",transform:`translate(${e.x}px, ${e.y}px)`,width:e.width,height:e.height,pointerEvents:"none"},children:e.content},e.id))});return null!=n?(0,Mu.jsx)(bn,{value:n,children:s}):s}var Ru=require("react/jsx-runtime");function ju({props:e,store:t,responsiveRef:n,size:r,margin:i,adjustedWidth:o,adjustedHeight:s,resolvedBackground:a,resolvedForeground:l}){const{chartType:c,nodes:u,edges:h,data:d,className:f,description:y,title:p,responsiveWidth:g,responsiveHeight:m,summary:x,background:v,renderMode:b,legend:k,legendPosition:w,legendLayout:A,legendHoverBehavior:S,legendClickBehavior:_,legendHighlightedCategory:M,legendIsolatedCategories:C,layoutSelection:P,annotations:R,onAnnotationActivate:j,annotationObservationCallback:T,onObservation:D,chartId:E,autoPlaceAnnotations:N,svgAnnotationRules:I}=e;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(c),n=e?d||(Array.isArray(h)?void 0:h):void 0;if(e&&n)t.ingestHierarchy(n,[o,s]),t.buildScene([o,s]);else{const e=L(u),n=Array.isArray(h)?L(h):[];(e.length>0||n.length>0)&&(t.ingestBounded(e,n,[o,s]),t.buildScene([o,s]))}}const W=t?.sceneNodes??[],$=t?.sceneEdges??[],z=t?.labels??[];return(0,Ru.jsxs)("div",{ref:n,className:"stream-network-frame"+(f?" "+f:""),role:"img","aria-label":y||("string"==typeof p?p:"Network chart"),style:{position:"relative",width:g?"100%":r[0],height:m?"100%":r[1]},children:[(0,Ru.jsx)(Ws,{summary:x}),(0,Ru.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:r[0],height:r[1],style:{position:"absolute",left:0,top:0},children:[a&&(0,Ru.jsx)("g",{transform:`translate(${i.left},${i.top})`,children:a}),(0,Ru.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[v&&(0,Ru.jsx)("rect",{x:0,y:0,width:o,height:s,fill:v}),$.map((e,t)=>rl({node:e,index:t,renderMode:b,fallback:()=>function(e,t){switch(e.type){case"line":return(0,Yo.jsx)("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity},"net-edge-"+t);case"bezier":{const n=e,r=`net-bezier-${t}-hatch`,i=Un(n.style.fill)?Zn(n.style.fill,r):void 0;return(0,Yo.jsxs)(Fo.Fragment,{children:[i&&(0,Yo.jsx)("defs",{children:i}),(0,Yo.jsx)("path",{d:n.pathD,fill:i?`url(#${r})`:Wo(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-edge-"+t)}case"ribbon":{const n=e,r=`net-ribbon-${t}-hatch`,i=Un(n.style.fill)?Zn(n.style.fill,r):void 0;return(0,Yo.jsxs)(Fo.Fragment,{children:[i&&(0,Yo.jsx)("defs",{children:i}),(0,Yo.jsx)("path",{d:n.pathD,fill:i?`url(#${r})`:Wo(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-edge-"+t)}case"curved":{const n=e;return(0,Yo.jsx)("path",{d:n.pathD,fill:Wo(n.style.fill,"none"),stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:n.style.opacity},"net-edge-"+t)}default:return null}}(e,t)})).filter(Boolean),W.map((e,t)=>rl({node:e,index:t,renderMode:b,fallback:()=>function(e,t){switch(e.type){case"circle":{const n=e,r=Un(n.style.fill)?Zn(n.style.fill,`net-circle-${t}-hatch`):void 0;return(0,Yo.jsxs)(Fo.Fragment,{children:[r&&(0,Yo.jsx)("defs",{children:r}),(0,Yo.jsx)("circle",{cx:n.cx,cy:n.cy,r:n.r,fill:r?`url(#net-circle-${t}-hatch)`:Wo(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,fillOpacity:n.style.fillOpacity,strokeOpacity:n.style.strokeOpacity,opacity:n.style.opacity})]},"net-circle-"+t)}case"rect":{const n=e,r=Un(n.style.fill)?Zn(n.style.fill,`net-rect-${t}-hatch`):void 0;return(0,Yo.jsxs)(Fo.Fragment,{children:[r&&(0,Yo.jsx)("defs",{children:r}),(0,Yo.jsx)("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:r?`url(#net-rect-${t}-hatch)`:Wo(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,fillOpacity:n.style.fillOpacity,strokeOpacity:n.style.strokeOpacity,opacity:n.style.opacity})]},"net-rect-"+t)}case"arc":{const n=e,r=(0,Bo.arc)().innerRadius(n.innerR).outerRadius(n.outerR).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2)(Io)||"",i=Un(n.style.fill)?Zn(n.style.fill,`net-arc-${t}-hatch`):void 0;return(0,Yo.jsxs)(Fo.Fragment,{children:[i&&(0,Yo.jsx)("defs",{children:i}),(0,Yo.jsx)("path",{d:r,transform:`translate(${n.cx},${n.cy})`,fill:i?`url(#net-arc-${t}-hatch)`:Wo(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,fillOpacity:n.style.fillOpacity,strokeOpacity:n.style.strokeOpacity,opacity:n.style.opacity})]},"net-arc-"+t)}case"symbol":{const n=e,r=yt(n.symbolType,n.size,n.path);return(0,Yo.jsx)("path",{d:r,transform:n.rotation?`translate(${n.cx},${n.cy}) rotate(${180*n.rotation/Math.PI})`:`translate(${n.cx},${n.cy})`,fill:n.style.fill?Wo(n.style.fill):"none",stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,fillOpacity:n.style.fillOpacity,strokeOpacity:n.style.strokeOpacity,opacity:n.style.opacity},"net-symbol-"+t)}case"glyph":return zo(e,e.cx,e.cy,"net-glyph-"+(e.id??t));default:return null}}(e,t)})).filter(Boolean),z.map((e,t)=>function(e,t){return(0,Yo.jsx)("text",{x:e.x,y:e.y,textAnchor:e.anchor||"middle",dominantBaseline:e.baseline||"auto",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,children:e.text},"net-label-"+t)}(e,t)).filter(Boolean)]})]}),(0,Ru.jsx)(Su,{width:o,height:s,totalWidth:r[0],totalHeight:r[1],margin:i,labels:z,sceneNodes:W,title:p,legend:k,legendPosition:w,legendLayout:A,legendHoverBehavior:S,legendClickBehavior:_,legendHighlightedCategory:M,legendIsolatedCategories:C,foregroundGraphics:gn(l,kn(t?.customLayoutOverlays,P??null)),annotations:R,onAnnotationActivate:j,onObservation:T??D,chartId:E,chartType:"StreamNetworkFrame",autoPlaceAnnotations:N,svgAnnotationRules:I,annotationFrame:0}),(0,Ru.jsx)(Pu,{marks:t?.customLayoutHtmlMarks,margin:i,selection:P??null})]})}var Tu=require("react/jsx-runtime"),Du=("undefined"!=typeof process&&process,{display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"}),Lu={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Eu(e,t,n,r){return!1===r||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,Tu.jsx)("div",{style:{...Du,width:t,height:n},children:r||"No data available"}):null}function Nu(e,t,n,r){if(!e)return null;if(!1===r)return null;if(null!=r)return(0,Tu.jsx)("div",{style:{width:t,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:r});const i=Math.min(5,Math.floor(n/40)),o=Math.max(8,Math.floor(n/(3*i))),s=Math.max(6,Math.floor(n/(2.5*i))),a=Math.floor((n-(i*(o+s)-s))/2);return(0,Tu.jsx)("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(e,n)=>(0,Tu.jsx)("div",{className:"semiotic-loading-bar",style:{...Lu,position:"absolute",top:a+n*(o+s),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:o,opacity:.5+n%2*.2}},n))})}function Iu(e){if("undefined"!=typeof DOMException)return new DOMException(e+" aborted","AbortError");const t=Error(e+" aborted");return t.name="AbortError",t}function Wu(e){const t=Error(e.message);return t.name=e.name??"Error",e.stack&&(t.stack=e.stack),t}var $u=class{constructor(e){this.nextRequestId=1,this.pending=new Map,this.dead=!1,this.options=e,this.worker=e.createWorker(),this.worker.onmessage=e=>{const t=this.options.parseMessage(e.data),n=t.requestId,r=null!=n?this.pending.get(n):this.pending.values().next().value;if(r){if(null!=n)this.pending.delete(n);else{for(const e of this.pending.values())e!==r&&(e.cleanup(),e.reject(Error(this.options.name+" worker response missing requestId")));this.pending.clear()}r.cleanup(),t.ok?r.resolve(t.payload):r.reject(t.error)}},this.worker.onerror=e=>{this.rejectAll(Error(e.message||this.options.name+" worker failed")),this.terminate()}}get isDead(){return this.dead}request(e,t){if(this.dead)return Promise.reject(Error(this.options.name+" worker session is closed"));if(t?.aborted)return Promise.reject(Iu(this.options.name));const n=this.nextRequestId;this.nextRequestId+=1;const r=this.options.encodeRequest?.(n,e)??{requestId:n,request:e};return new Promise((e,i)=>{const o=()=>{this.pending.delete(n),t?.removeEventListener("abort",o),i(Iu(this.options.name))},s=()=>t?.removeEventListener("abort",o);this.pending.set(n,{cleanup:s,reject:i,resolve:e}),t?.addEventListener("abort",o,{once:!0});try{this.worker.postMessage(r)}catch(e){this.pending.delete(n),s(),i(e instanceof Error?e:Error(e+""))}})}terminate(){this.dead||(this.dead=!0,this.rejectAll(Error(this.options.name+" worker terminated")),this.worker.terminate())}rejectAll(e){for(const t of this.pending.values())t.cleanup(),t.reject(e);this.pending.clear()}},zu={};function Ou(){return"undefined"!=typeof window&&"undefined"!=typeof Worker}var Fu=class{constructor(e=function(){const e="string"==typeof zu.url&&zu.url?new URL("./forceLayoutWorker.js",zu.url):function(e){if("undefined"!=typeof __filename){const t=__filename.replace(/\\/g,"/"),n=t.startsWith("/")?t:"/"+t;return new URL("./"+e,"file:"+n)}throw Error("Cannot resolve module worker asset: "+e)}("forceLayoutWorker.js");return new Worker(e,{type:"module",name:"semiotic-force-layout"})}()){this.session=new $u({name:"Force layout",createWorker:()=>e,parseMessage:e=>{const t=e,{requestId:n,error:r}=function(e){return e&&"object"==typeof e?{requestId:e.requestId,error:e.error}:{}}(t);return r?{requestId:n,ok:!1,error:Wu(r)}:{requestId:n,ok:!0,payload:{positions:t.positions??{}}}}})}get isDead(){return this.session.isDead}request(e,t){return this.session.request(e,t)}terminate(){this.session.terminate()}},Bu=function(){let e=null;return{get:()=>(e&&!e.isDead||(e=new Fu),e),resetForTest:()=>{if(e){try{e.terminate()}catch{}e=null}}}}(),Yu=require("react/jsx-runtime"),Hu=/^(value|amount|total|count|weight|score)$/i;function Xu({data:e}){if("edge"===e.nodeOrEdge){const t=e.data;return t?(0,Yu.jsxs)("div",{className:"semiotic-tooltip",style:Zs,children:[(0,Yu.jsxs)("div",{style:{fontWeight:600},children:["object"==typeof t.source?t.source.id:t.source," → ","object"==typeof t.target?t.target.id:t.target]}),null!=t.value&&(0,Yu.jsxs)("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]})]}):null}const t=e.data;if(!t)return null;const n=t.__hierarchyNode;if(n){const e=[];let r=n;for(;r;){const n=r.data?.name??r.data?.id??t.id;null!=n&&e.unshift(n+""),r=r.parent}e.length>1&&e.shift();const i=e.length-1;return(0,Yu.jsxs)("div",{className:"semiotic-tooltip",style:Zs,children:[(0,Yu.jsx)("div",{children:e.map((e,t)=>(0,Yu.jsxs)("span",{children:[t>0&&(0,Yu.jsx)("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),t===i?(0,Yu.jsx)("strong",{children:e}):(0,Yu.jsx)("span",{style:{opacity:.7},children:e})]},t))}),null!=t.value&&t.value>0&&(0,Yu.jsx)("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof t.value?t.value.toLocaleString():t.value+""})]})}const r=(t.sourceLinks?.length||0)+(t.targetLinks?.length||0),i=(t.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(t.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0),o=Qs(t.data??t),s=null!=o.title?o.title+"":t.id,a=o.entries.some(e=>Hu.test(e.key));return(0,Yu.jsxs)("div",{className:"semiotic-tooltip",style:Zs,children:[(0,Yu.jsx)("div",{style:{fontWeight:600},children:s}),o.entries.map(e=>{return(0,Yu.jsxs)("div",{style:{marginTop:4,opacity:.8},children:[e.key,": ",(t=e.value,null==t?"–":"number"==typeof t?Math.abs(t)>9999?t.toLocaleString():t+"":t instanceof Date?t.toLocaleDateString():t+"")]},e.key);var t}),!a&&null!=t.value&&t.value>0&&(0,Yu.jsxs)("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]}),r>0&&(0,Yu.jsxs)("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",r,i!==r&&` (weighted: ${i.toLocaleString()})`]})]})}function qu(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function Gu(e,t){if(!t.pathD)return;e.save();const n=qu(t);if(t.style.fill&&"none"!==t.style.fill){const r=t._gradient;if(r){const n=e.createLinearGradient(r.x0,r.y0??0,r.x1,r.y1??0),i=t.style.fillOpacity??t.style.opacity??.5,o="string"==typeof t.style.fill?t.style.fill:"#999",s=Xn(e,o)||o;n.addColorStop(0,1===r.from?s:"transparent"),n.addColorStop(1,1===r.to?s:"transparent"),e.fillStyle=n,e.globalAlpha=i}else e.fillStyle=nr(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5;e.fill(n)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.5*(t.style.opacity??1),e.stroke(n)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(n)),e.restore()}function Vu(e,t){e.save();const n=t.style.stroke||"#999";e.strokeStyle=Xn(e,n)||n,e.lineWidth=t.style.strokeWidth??1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(t.style.strokeWidth??1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function Uu(e,t){if(!t.pathD)return;e.save();const n=qu(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=nr(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5,e.fill(n)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Xn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.3*(t.style.opacity??1),e.stroke(n)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(n)),e.restore()}function Ku(e,t){if(!t.pathD)return;e.save();const n=qu(t),r=t.style.stroke||"#999";e.strokeStyle=Xn(e,r)||r,e.lineWidth=t.style.strokeWidth??1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(n),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=nr(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??.1,e.fill(n)),e.restore()}function Qu(e,t,n,r=30){switch(e.type){case"circle":return function(e,t,n,r=30){const i=t-e.cx,o=n-e.cy,s=Math.sqrt(i*i+o*o);return s>Mn(e.r,r)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:s}}(e,t,n,r);case"rect":return function(e,t,n){const r=_n(t,n,e);return r.hit?{type:"node",datum:e.datum,x:r.cx,y:r.cy,distance:0}:null}(e,t,n);case"arc":return function(e,t,n){const r=t-e.cx,i=n-e.cy,o=Math.sqrt(r*r+i*i);if(e.innerR-2>o||o>e.outerR+2)return null;const s=Rn(Math.atan2(i,r)),a=Rn(e.startAngle),l=Rn(e.endAngle);if(a>l?s>=a||l>=s:s>=a&&l>=s){const t=(e.startAngle+e.endAngle)/2,n=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+n*Math.cos(t),y:e.cy+n*Math.sin(t),distance:0}}return null}(e,t,n);case"symbol":return function(e,t,n,r=30){const i=t-e.cx,o=n-e.cy,s=Math.sqrt(i*i+o*o);return s>Mn(pt(e.size),r)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:s}}(e,t,n,r);case"glyph":return function(e,t,n,r=30){if(null==e.datum)return null;const i=Wn(e.glyph,e.size),o=e.cx+i.centerDx,s=e.cy+i.centerDy,a=t-o,l=n-s,c=Math.sqrt(a*a+l*l);return c>Mn(i.radius,r)?null:{type:"node",datum:e.datum,x:o,y:s,distance:c}}(e,t,n,r);default:return null}}Xu.ownsChrome=!0;var Zu=null,Ju=null;function eh(){return Ju||((Zu=document.createElement("canvas")).width=1,Zu.height=1,Ju=Zu.getContext("2d")),Ju}function th(e){if(e._cachedPath2D&&e._cachedPath2DSource===e.pathD)return e._cachedPath2D;try{return e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD,e._cachedPath2D}catch{return null}}function nh(e,t,n){switch(e.type){case"bezier":return function(e,t,n){if(!e.pathD)return null;const r=th(e),i=eh();if(!r||!i)return null;try{if(i.isPointInPath(r,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0};const o=i.lineWidth;i.lineWidth=10;const s=i.isPointInStroke(r,t,n);if(i.lineWidth=o,s)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch{}return null}(e,t,n);case"line":return function(e,t,n){const r=e.x2-e.x1,i=e.y2-e.y1,o=r*r+i*i;if(0===o)return null;let s=((t-e.x1)*r+(n-e.y1)*i)/o;s=Math.max(0,Math.min(1,s));const a=e.x1+s*r,l=e.y1+s*i,c=Math.sqrt((t-a)**2+(n-l)**2);return c>5?null:{type:"edge",datum:e.datum,x:a,y:l,distance:c}}(e,t,n);case"ribbon":case"curved":return function(e,t,n){if(!e.pathD)return null;const r=th(e),i=eh();if(!r||!i)return null;try{if(i.isPointInPath(r,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0};const o=i.lineWidth;i.lineWidth=10;const s=i.isPointInStroke(r,t,n);if(i.lineWidth=o,s)return{type:"edge",datum:e.datum,x:t,y:n,distance:4}}catch{}return null}(e,t,n);default:return null}}function rh(e){const{clientX:t,clientY:n,canvasRect:r,margin:i,adjustedWidth:o,adjustedHeight:s,sceneNodes:a,sceneEdges:l,nodeQuadtree:c,maxNodeRadius:u,hitRadius:h=30}=e,d=t-r.left-i.left,f=n-r.top-i.top;if(0>d||d>o||0>f||f>s)return{kind:"miss-outside"};const y=function(e,t,n,r,i=30,o,s=0){let a=null,l=i,c=1/0;if(o){const e=zn(o,n,r,i,s,e=>e.cx,e=>e.cy,e=>e.r);e&&(a={type:"node",datum:e.node.datum,x:e.node.cx,y:e.node.cy,distance:e.distance},l=e.distance)}for(const t of e){if(o&&"circle"===t.type)continue;const e=Qu(t,n,r,i);if(e)if("rect"===t.type){const n=t.w*t.h;c>n&&(a=e,c=n)}else l>e.distance&&(a=e,l=e.distance)}if(a)return a;for(const e of t){if(!1===e.interactive)continue;const t=nh(e,n,r);t&&l>t.distance&&(a=t,l=t.distance)}return a}(a,l,d,f,h,c,u);return y?{kind:"hit",hover:Xs(y.datum||{},y.x,y.y,{nodeOrEdge:y.type})}:{kind:"miss"}}var ih=require("react"),oh="StreamNetworkFrame",sh=require("react/jsx-runtime"),ah={top:20,right:80,bottom:20,left:80},lh={top:40,right:40,bottom:40,left:40},ch=new Set(["chord","force","circlepack","orbit"]),uh=[800,600],hh=(0,Ml.memo)((0,Ml.forwardRef)(function(e,t){const{chartType:n,nodes:r,edges:i,data:o,initialEdges:s,nodeIDAccessor:a="id",sourceAccessor:l="source",targetAccessor:c="target",valueAccessor:u="value",edgeIdAccessor:h,childrenAccessor:d,hierarchySum:f,orientation:y="horizontal",nodeAlign:p="justify",nodePaddingRatio:g=.05,nodeWidth:m=15,iterations:x=300,forceStrength:v=.1,layoutExecution:b="auto",layoutLoadingContent:k,onLayoutStateChange:w,padAngle:A=.01,groupWidth:S=20,sortGroups:_,edgeSort:M,treeOrientation:C="vertical",edgeType:P="curve",padding:R,paddingTop:j,tensionConfig:T,showParticles:D=!1,particleStyle:E,renderMode:N,nodeStyle:I,edgeStyle:W,colorBy:$,colorScheme:z="category10",edgeColorBy:F="source",edgeOpacity:B=.5,colorByDepth:Y=!1,nodeSize:H=8,nodeSizeRange:X=[5,20],nodeLabel:q,showLabels:G=!0,labelMode:V,size:U=uh,responsiveWidth:K,responsiveHeight:Q,margin:Z,className:J,background:ee,maxDevicePixelRatio:te,enableHover:ne=!0,tooltipContent:re,customHoverBehavior:ie,customClickBehavior:oe,onObservation:se,annotationObservationCallback:ae,chartId:le,onTopologyChange:ce,annotations:ue,onAnnotationActivate:he,autoPlaceAnnotations:de,svgAnnotationRules:fe,legend:ye,legendPosition:pe,legendLayout:ge,legendHoverBehavior:me,legendClickBehavior:xe,legendHighlightedCategory:ve,legendIsolatedCategories:be,title:ke,foregroundGraphics:we,backgroundGraphics:Ae,decay:Se,pulse:Me,transition:Ce,animate:Pe,staleness:Re,frameScheduler:je,clock:Te,random:De,seed:Le,paused:Ee=!1,suspendWhenHidden:Ne=!0,thresholds:Ie,accessibleTable:We=!0,description:$e,summary:ze,orbitMode:Oe,orbitSize:Fe,orbitSpeed:Be,orbitRevolution:Ye,orbitRevolutionStyle:He,orbitEccentricity:Xe,orbitShowRings:qe,orbitAnimated:Ge,customNetworkLayout:Ve,onLayoutError:Ue,layoutConfig:Ke,layoutSelection:Qe}=e,Ze=ch.has(n)?lh:ah,Je=(0,Ml.useRef)(!0),et=da({sizeProp:U,responsiveWidth:K,responsiveHeight:Q,userMargin:Z,marginDefault:Ze,title:ke,legend:ye,legendPosition:pe,foregroundGraphics:we,backgroundGraphics:Ae,animate:Pe,transitionProp:Ce,frameScheduler:je,clock:Te,random:De,seed:Le,paused:Ee,suspendWhenHidden:Ne,themeDirtyRef:Je}),{reducedMotionRef:tt,responsiveRef:nt,size:rt,margin:it,adjustedWidth:ot,adjustedHeight:st,resolvedForeground:at,resolvedBackground:lt,transition:ct,introEnabled:ut,tableId:ht,rafRef:dt,renderFnRef:ft,scheduleRender:yt,frameRuntime:pt,currentTheme:gt}=et,mt=Uo(),xt=Jo(),vt=(0,Ml.useMemo)(()=>L(r),[r]),bt=(0,Ml.useMemo)(()=>Array.isArray(i)?L(i):i,[i]),kt=(0,Ml.useMemo)(()=>({...Cl,...T}),[T]),wt=(0,Ml.useMemo)(()=>({...Pl,...E}),[E]),At=(0,Ml.useMemo)(()=>{return{chartType:(e={chartType:n,clock:pt.now,random:De,seed:Le,nodeIDAccessor:a,sourceAccessor:l,targetAccessor:c,valueAccessor:u,edgeIdAccessor:h,childrenAccessor:d,hierarchySum:f,orientation:y,nodeAlign:p,nodePaddingRatio:g,nodeWidth:m,iterations:x,forceStrength:v,padAngle:A,groupWidth:S,sortGroups:_,edgeSort:M,treeOrientation:C,edgeType:P,padding:R,paddingTop:j,tensionConfig:kt,showParticles:D,particleStyle:wt,nodeStyle:I,edgeStyle:W,nodeLabel:q,showLabels:G,labelMode:V,colorBy:$,colorScheme:z,edgeColorBy:F,edgeOpacity:B,colorByDepth:Y,nodeSize:H,nodeSizeRange:X,decay:Se,pulse:Me,transition:ct,introAnimation:ut,staleness:Re,thresholds:Ie,orbitMode:Oe,orbitSize:Fe,orbitSpeed:Be,orbitRevolution:Ye,orbitRevolutionStyle:He,orbitEccentricity:Xe,orbitShowRings:qe,orbitAnimated:Ge,customNetworkLayout:Ve,onLayoutError:Ue,layoutConfig:Ke,currentTheme:gt}).chartType,clock:e.clock,random:e.random,seed:e.seed,nodeIDAccessor:e.nodeIDAccessor,sourceAccessor:e.sourceAccessor,targetAccessor:e.targetAccessor,valueAccessor:e.valueAccessor,edgeIdAccessor:e.edgeIdAccessor,childrenAccessor:e.childrenAccessor,hierarchySum:e.hierarchySum,orientation:e.orientation,nodeAlign:e.nodeAlign,nodePaddingRatio:e.nodePaddingRatio,nodeWidth:e.nodeWidth,iterations:e.iterations,forceStrength:e.forceStrength,padAngle:e.padAngle,groupWidth:e.groupWidth,sortGroups:e.sortGroups,edgeSort:e.edgeSort,treeOrientation:e.treeOrientation,edgeType:e.edgeType,padding:e.padding,paddingTop:e.paddingTop,tensionConfig:e.tensionConfig,showParticles:e.showParticles,particleStyle:e.particleStyle,nodeStyle:e.nodeStyle,edgeStyle:e.edgeStyle,nodeLabel:e.nodeLabel,showLabels:e.showLabels,labelMode:e.labelMode,colorBy:e.colorBy,colorScheme:e.colorScheme,themeCategorical:e.currentTheme?.colors?.categorical,themeSemantic:O(e.currentTheme),edgeColorBy:e.edgeColorBy,edgeOpacity:e.edgeOpacity,colorByDepth:e.colorByDepth,nodeSize:e.nodeSize,nodeSizeRange:e.nodeSizeRange,decay:e.decay,pulse:e.pulse,transition:e.transition,introAnimation:e.introAnimation,staleness:e.staleness,thresholds:e.thresholds,orbitMode:e.orbitMode,orbitSize:e.orbitSize,orbitSpeed:e.orbitSpeed,orbitRevolution:e.orbitRevolution,orbitRevolutionStyle:e.orbitRevolutionStyle,orbitEccentricity:e.orbitEccentricity,orbitShowRings:e.orbitShowRings,orbitAnimated:e.orbitAnimated,customNetworkLayout:e.customNetworkLayout,onLayoutError:e.onLayoutError,layoutConfig:e.layoutConfig};var e},[n,pt.now,De,Le,a,l,c,u,h,d,f,y,p,g,m,x,v,A,S,_,M,C,P,R,j,kt,D,wt,I,W,q,G,V,$,z,F,B,Y,H,X,Se,Me,ct,ut,Re,Ie,Oe,Fe,Be,Ye,He,Xe,qe,Ge,Ve,Ue,Ke,gt]),St=ts(At),_t=ts({chartType:(Mt={chartType:n,nodeIDAccessor:a,sourceAccessor:l,targetAccessor:c,valueAccessor:u,edgeIdAccessor:h,childrenAccessor:d,hierarchySum:f,orientation:y,nodeAlign:p,nodePaddingRatio:g,nodeWidth:m,iterations:x,forceStrength:v,padAngle:A,groupWidth:S,sortGroups:_,edgeSort:M,treeOrientation:C,edgeType:P,padding:R,paddingTop:j,random:De,seed:Le,tensionConfig:kt,customNetworkLayout:Ve,orbitMode:Oe,orbitSize:Fe,orbitEccentricity:Xe}).chartType,nodeIDAccessor:Mt.nodeIDAccessor,sourceAccessor:Mt.sourceAccessor,targetAccessor:Mt.targetAccessor,valueAccessor:Mt.valueAccessor,edgeIdAccessor:Mt.edgeIdAccessor,childrenAccessor:Mt.childrenAccessor,hierarchySum:Mt.hierarchySum,orientation:Mt.orientation,nodeAlign:Mt.nodeAlign,nodePaddingRatio:Mt.nodePaddingRatio,nodeWidth:Mt.nodeWidth,iterations:Mt.iterations,forceStrength:Mt.forceStrength,padAngle:Mt.padAngle,groupWidth:Mt.groupWidth,sortGroups:Mt.sortGroups,edgeSort:Mt.edgeSort,treeOrientation:Mt.treeOrientation,edgeType:Mt.edgeType,padding:Mt.padding,paddingTop:Mt.paddingTop,random:Mt.random,seed:Mt.seed,tensionConfig:Mt.tensionConfig,customNetworkLayout:Mt.customNetworkLayout,orbitMode:Mt.orbitMode,orbitSize:Mt.orbitSize,orbitEccentricity:Mt.orbitEccentricity});var Mt;const Ct=(0,Ml.useRef)(0),Pt=(0,Ml.useRef)(0),Rt=(0,Ml.useRef)(!1),jt=(0,Ml.useRef)(null);jt.current||(jt.current=new ku(St));const Tt=fn("StreamNetworkFrame"),Dt=(0,Ml.useCallback)((e,t,n=!1)=>function(e,t,n,r=!1,i=!1){const o=e.beforeCompute(t.getLastUpdateResult(),r);n(),e.afterCompute(o,!0,i)}(Tt.current,e,()=>e.buildScene(t),n),[Tt]),[Lt,Et]=(0,Ml.useState)(null),[Nt,It]=(0,Ml.useState)(0),[Wt,$t]=(0,Ml.useState)(0),[zt,Ot]=(0,Ml.useState)(!1),[Ft,Bt]=(0,Ml.useState)(!1),Yt=(0,Ml.useRef)(0),Ht=(0,Ml.useRef)(null),Xt=(0,Ml.useRef)(!1),qt=(0,Ml.useRef)(w);qt.current=w;const Gt=(0,Ml.useRef)(St);Gt.current=St;const Vt=(0,Ml.useRef)(null),Ut=(0,Ml.useRef)(new Map),Kt=(0,Ml.useRef)(0),Qt=(0,Ml.useCallback)(e=>function(e){const{node:t,colorBy:n,colorScheme:r,nodeColorMap:i,colorIndexRef:o}=e;if("function"==typeof n)return n(t)+"";if("string"==typeof n&&t.data){const e=t.data[n];if(void 0!==e){if(!i.has(e+"")){const t=Array.isArray(r)?r:_e;i.set(e+"",t[o.current++%t.length])}return i.get(e+"")}}if(i.has(t.id))return i.get(t.id);const s=Array.isArray(r)?r:_e,a=n?s[o.current++%s.length]:s[0];return i.set(t.id,a),a}({node:e,colorBy:$,colorScheme:z,nodeColorMap:Ut.current,colorIndexRef:Kt}),[$,z]),Zt=(0,Ml.useCallback)(e=>{Kt.current=function(e){const{sceneNodes:t,nodes:n,nodeColorMap:r,colorScheme:i}=e;for(const e of t)e.id&&"string"==typeof e.style?.fill&&r.set(e.id,e.style.fill);const o=Array.isArray(i)?i:_e,s=Array.from(n);for(let e=0;s.length>e;e++){const t=s[e];r.has(t.id)||r.set(t.id,o[e%o.length])}return s.length}({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Ut.current,colorScheme:z})},[z]),Jt=(0,Ml.useCallback)((e,t)=>{Dt(e,t),Zt(e),Je.current=!1,e.markStylePaintPending()},[Dt,Zt]),en=(0,Ml.useCallback)(()=>{jt.current?.markStylePaintPending()},[]),tn=(nn=gt,nn?.colors?.border||nn?.colors?.secondary||nn?.colors?.primary||"#999");var nn;const rn=(0,Ml.useCallback)(e=>function(e,t){return e?"object"==typeof e?e:t?.get(e)??null:null}(e,jt.current?.nodes),[]),on=(0,Ml.useCallback)(e=>function(e){const{edge:t,edgeColorBy:n,getNodeColor:r,resolveEndpoint:i,fallback:o}=e;if("function"==typeof n)return n(t);const s=i(t.source),a=i(t.target);return"target"===n&&a?r(a):s?r(s):o}({edge:e,edgeColorBy:F,getNodeColor:Qt,resolveEndpoint:rn,fallback:tn}),[F,Qt,tn,rn]),sn=(0,Ml.useCallback)(e=>function(e){const{edge:t,particleStyleColor:n,particleColorBy:r,hasExplicitParticleColorBy:i,getEdgeColor:o,getNodeColor:s,resolveEndpoint:a,fallback:l}=e;if("function"==typeof n){const e=a(t.source);return e?n(t,e):l}if(!i)return o(t);const c=r,u=a(t.source),h=a(t.target);return"target"===c&&h?s(h):u?s(u):l}({edge:e,particleStyleColor:wt.color,particleColorBy:wt.colorBy,hasExplicitParticleColorBy:!!E?.colorBy,getEdgeColor:on,getNodeColor:Qt,resolveEndpoint:rn,fallback:tn}),[E?.colorBy,wt.color,wt.colorBy,Qt,on,tn,rn]),an=function(e,t,n,r,i){return("sankey"===e||t)&&n||r||i}(n,!!Ve,D,!!Me,jt.current?.isAnimating??!1);An(jt,St,Je,yt),Sn(jt,Qe,Je,yt),(0,Ml.useEffect)(()=>{const e=jt.current;e&&(Jt(e,[ot,st]),It(e=>e+1),yt())},[gt,ot,st,Jt,yt]);const ln=(0,Ml.useCallback)(()=>{const e=jt.current;if(e&&(e.runLayout([ot,st]),Jt(e,[ot,st]),It(e.layoutVersion),ce)){const{nodes:t,edges:n}=e.getLayoutData();ce(t,n)}},[ot,st,Jt,ce]),cn=(0,Ml.useRef)(!1),un=(0,Ml.useCallback)((e=!1)=>!(!e&&!cn.current||(cn.current=!1,ln(),0)),[ln]),hn=(0,Ml.useCallback)(()=>un(!1),[un]),dn=(0,Ml.useCallback)(e=>{const t=jt.current;if(!t)return!1;let n=!1,r=cn.current;for(const i of e)null!=i&&"object"==typeof i&&(n=!0,t.ingestEdge(i)&&(r=!0));const i=un(r);return n||i},[un]),pn=(0,Ml.useCallback)(e=>{if(null==e||"object"!=typeof e)return;const t=jt.current;t&&(t.ingestEdge(e)&&(cn.current=!0),pt.isActive?yt():hn())},[hn,pt,yt]),mn=(0,Ml.useCallback)(e=>{dn(e)&&yt()},[dn,yt]);(0,Ml.useEffect)(()=>pt.subscribe(()=>{pt.isActive||hn()}),[hn,pt]);const xn=(0,Ml.useCallback)(()=>{cn.current=!1,jt.current?.clear(),Ut.current.clear(),Kt.current=0,It(jt.current?.layoutVersion??0),Et(null),Vt.current=null,Je.current=!0,yt()},[yt]),vn=(0,Ml.useCallback)(()=>{const e=jt.current;e&&(e.tension+=999,un(!0),yt())},[un,yt]);(0,Ml.useImperativeHandle)(t,()=>({push:pn,pushMany:mn,removeNode:e=>{const t=jt.current?.removeNode(e)??!1;if(t){const t=Vt.current?.data?"function"==typeof a?a(Vt.current.data):Vt.current.data[a]:void 0;Vt.current&&"node"===Vt.current.nodeOrEdge&&t===e&&(Vt.current=null,Et(null)),Ut.current.delete(e)}return un(t)&&(Je.current=!0,yt()),t},removeEdge:(e,t)=>{const n=jt.current?.removeEdge(e,t)??!1;if(n&&Vt.current&&"edge"===Vt.current.nodeOrEdge){const n=Vt.current.data;let r;r=void 0!==t?("object"==typeof n?.source?n.source.id:n?.source)===e&&("object"==typeof n?.target?n.target.id:n?.target)===t:!h||!n||("function"==typeof h?h:e=>e?.[h])(n)===e,r&&(Vt.current=null,Et(null))}return un(n)&&(Je.current=!0,yt()),n},updateNode:(e,t)=>{const n=jt.current?.updateNode(e,t)??null;return un(null!==n)&&(Je.current=!0,yt()),n},updateEdge:(e,t,n)=>{const r=jt.current?.updateEdge(e,t,n)??[];return un(r.length>0)&&(Je.current=!0,yt()),r},clear:xn,getTopology:()=>(hn(),jt.current?.getLayoutData()??{nodes:[],edges:[]}),getCustomLayout:()=>(hn(),jt.current?.lastCustomLayoutResult??null),getLayoutFailure:()=>(hn(),jt.current?.lastCustomLayoutFailure??null),getTopologyDiff:()=>{hn();const e=jt.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:vn,getTension:()=>(hn(),jt.current?.tension??0)}),[pn,mn,xn,vn,hn,un,a,yt,h]);const bn=["tree","cluster","treemap","circlepack","partition","orbit"].includes(n),wn=bn?o||(Array.isArray(i)?void 0:i):void 0;(0,Ml.useEffect)(()=>{const e=jt.current;if(!e)return;const t=++Yt.current;if(Ht.current?.abort(),Ht.current=null,bn&&wn)cn.current=!1,e.ingestHierarchy(wn,[ot,st]),Jt(e,[ot,st]),It(e.layoutVersion),Bt(!1),qt.current?.("ready"),yt();else{const o=vt,s=Array.isArray(bt)?bt:[];if(null==r&&null==i||(cn.current=!1),0===o.length&&0===s.length)return null==r&&null==i||0>=e.nodes.size&&0>=e.edges.size||xn(),Bt(!1),void qt.current?.("ready");const a=[ot,st],l="force"===n&&!Ve&&Ou()&&!De&&function(e,t,n,r,i=4e4){return"sync"!==e&&("worker"===e||r*(t+n)>=i)}(b,o.length,s.length,x);if(l&&xt&&!Xt.current&&e.sceneNodes.length>0)return Xt.current=!0,Bt(!1),qt.current?.("ready"),Je.current=!0,void yt();if(l){const n=new AbortController;Ht.current=n;const r=e._lastPositionSnapshot;e.ingestBounded(o,s,a,{deferLayout:!0});const i=e.getLayoutData(),l=function(e,t,n,r,i){const o=Dc(n.nodeSize,n.nodeSizeRange,e);return{kind:"frame",nodes:e.map(e=>{const t=i?.get(e.id);return{id:e.id,x:0!==e.x||0!==e.y?e.x:t?.x??0,y:0!==e.x||0!==e.y?e.y:t?.y??0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:e.value,__forceRadius:o(e)}}),edges:t.map(e=>{const t="string"==typeof e.source?e.source:e.source.id,n="string"==typeof e.target?e.target:e.target.id,r=e.data?.weight,i="number"==typeof r&&Number.isFinite(r)?r:e.value;return{source:t,target:n,value:e.value,y0:0,y1:0,sankeyWidth:0,weight:i}}),config:{chartType:"force",iterations:n.iterations,forceStrength:n.forceStrength,seed:n.seed},size:r}}(i.nodes,i.edges,Gt.current,a,r);return Bt(!0),qt.current?.("pending"),function(e,t){return Ou()?Bu.get().request(e,t):Promise.reject(Error("Web Workers are unavailable"))}(l,n.signal).then(({positions:n})=>{t===Yt.current&&(e.applyForceLayoutPositions(n,a),Jt(e,a),Bt(!1),qt.current?.("ready"),It(e.layoutVersion),yt())}).catch(n=>{"AbortError"!==n.name&&t===Yt.current&&(e.runLayout(a),Jt(e,a),Bt(!1),qt.current?.("error"),It(e.layoutVersion),yt())}),()=>n.abort()}e.ingestBounded(o,s,a),Jt(e,a),It(e.layoutVersion),Bt(!1),qt.current?.("ready"),yt()}},[vt,bt,r,i,o,wn,bn,ot,st,_t,b,x,xt,n,Ve,De,yt,xn,Jt]);const _n=_l.useRef(!1);(0,Ml.useEffect)(()=>{_n.current||s&&s.length>0&&(_n.current=!0,mn(s))},[s,mn]);const{customHoverBehavior:Mn,customClickBehavior:Cn}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:r}){return{customHoverBehavior:(0,ih.useCallback)((t,i)=>{e?.(t,i),cl({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:oh,chartId:r,context:i})},[e,n,r]),customClickBehavior:(0,ih.useCallback)((e,i)=>{t?.(e,i),ul({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:oh,chartId:r,context:i})},[t,n,r])}}({customHoverBehavior:ie,customClickBehavior:oe,onObservation:se,chartId:le}),{hoverHandlerRef:Pn,hoverLeaveRef:Rn,onPointerMove:jn,onPointerLeave:Tn}=et,Dn=()=>!Ve||(jt.current?.hasCustomRestyle??!1);Pn.current=e=>{if(!ne)return;const t=Dn(),n=Fn.current;if(!n)return;const r=jt.current;if(!r)return;const i=rh({clientX:e.clientX,clientY:e.clientY,canvasRect:n.getBoundingClientRect(),margin:it,adjustedWidth:ot,adjustedHeight:st,sceneNodes:r.sceneNodes,sceneEdges:r.sceneEdges,nodeQuadtree:r.nodeQuadtree,maxNodeRadius:r.maxNodeRadius});"hit"===i.kind?(Vt.current=i.hover,Et(i.hover),Mn?.(i.hover),t&&yt()):Vt.current&&(Vt.current=null,Et(null),Mn?.(null),t&&yt())},Rn.current=()=>{if(Vt.current){const e=Dn();Vt.current=null,Et(null),Mn?.(null),e&&yt()}};const Ln=(0,Ml.useRef)(()=>{});Ln.current=e=>{if(Li(e.target))return;if(!oe&&!se)return;const t=Fn.current;if(!t)return;const n=jt.current;if(!n)return;const r=rh({clientX:e.clientX,clientY:e.clientY,canvasRect:t.getBoundingClientRect(),margin:it,adjustedWidth:ot,adjustedHeight:st,sceneNodes:n.sceneNodes,sceneEdges:n.sceneEdges,nodeQuadtree:n.nodeQuadtree,maxNodeRadius:n.maxNodeRadius});"hit"===r.kind?Cn(r.hover,{type:"activate",inputType:al(e.nativeEvent.pointerType)}):"miss"===r.kind&&Cn(null)};const En=(0,Ml.useCallback)(e=>Ln.current(e),[]),Nn=(0,Ml.useRef)(-1),In=(0,Ml.useRef)(null),$n=(0,Ml.useRef)(-1),zn=(0,Ml.useCallback)(e=>{if(ll(e))return;const t=jt.current;if(!t)return;const n=()=>{Nn.current=-1,In.current=null,$n.current=-1,Vt.current=null,Et(null),Mn?.(null),yt()},r=function(e){const t=[];for(const n of e)if("circle"===n.type&&null!=n.cx){if(0>=n.r)continue;t.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"})}else if("rect"===n.type&&null!=n.x){if(0>=n.w||0>=n.h)continue;t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.datum?.id??"_default"})}else if("arc"===n.type&&null!=n.cx)t.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"});else if("symbol"===n.type&&null!=n.cx){if(0>=n.size)continue;t.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"})}else if("glyph"===n.type&&null!=n.cx){if(0>=n.size||null==n.datum)continue;const e=Wn(n.glyph,n.size);t.push({x:n.cx+e.centerDx,y:n.cy+e.centerDy,datum:n.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:n.datum?.id??"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.sceneNodes);if(0===r.length)return void(0>Nn.current||n());const i=fl(r);let o=Nn.current;if(i.flat.length>o||(n(),o=-1)," "===e.key&&o>=0){e.preventDefault();const t=i.flat[o];return void Cn?.(Xs(t.datum||{},t.x,t.y,{nodeOrEdge:"node"}),{type:"activate",inputType:"keyboard"})}if(0>o){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),Nn.current=0,$n.current=-1;const t=i.flat[0];In.current={shape:t.shape,w:t.w,h:t.h};const n=Xs(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Vt.current=n,Et(n),Mn?.(n,{type:"focus",inputType:"keyboard"}),void yt()}const s=yl(i,o),a=function(e,t,n,r,i){const o=n.flat[t.flatIndex];if(!o)return pl(e,t,n);const s=o.datum?.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const r=function(e,t,n){let r=null,i=1/0;for(let o=0;e.flat.length>o;o++){const s=e.flat[o];if(s===t)continue;const a=s.x-t.x,l=s.y-t.y;let c=!1;switch(n){case"right":c=a>0&&Math.abs(a)>=Math.abs(l);break;case"left":c=0>a&&Math.abs(a)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(a);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(a)}if(!c)continue;const u=a*a+l*l;i>u&&(i=u,r=o)}return r}(n,o,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up")??t.flatIndex;return r!==t.flatIndex&&(i.current=-1),r}case"Enter":{if(null==s)return t.flatIndex;const e=function(e,t){const n=e+"",r=[];for(const e of t){const t=e.datum??e,i=xl(t.source),o=xl(t.target),s=null!=i,a=null!=o;s&&i+""===n&&a?r.push(o+""):a&&o+""===n&&s&&r.push(i+"")}return r}(s,r);if(0===e.length)return t.flatIndex;const o=n.idToIdx.get(e[(i.current+1)%e.length])??-1;return 0>o?t.flatIndex:(i.current=-1,o)}default:{const r=pl(e,t,n);return null!==r&&r!==t.flatIndex&&(i.current=-1),r}}}(e.key,s,i,t.sceneEdges??[],$n);if(null===a)return;if(e.preventDefault(),0>a)return void n();Nn.current=a;const l=i.flat[a];In.current={shape:l.shape,w:l.w,h:l.h};const c={data:l.datum||{},x:l.x,y:l.y,__semioticHoverData:!0,nodeOrEdge:"node"};Vt.current=c,Et(c),Mn?.(c,{type:"focus",inputType:"keyboard"}),yt()},[Cn,Mn,yt]),On=(0,Ml.useCallback)(e=>{Nn.current=-1,In.current=null,jn(e)},[jn]);ft.current=()=>{if(dt.current=null,hn(),!pt.isActive)return;const e=Fn.current;if(!e)return;const t=jt.current;t&&function(e){const{canvas:t,store:n,sceneRevisionDiagnostics:r,size:i,margin:o,adjustedWidth:s,adjustedHeight:a,background:l,maxDevicePixelRatio:c,renderMode:u,hasBackgroundGraphics:h=!1,dirtyRef:d,resolutionDirtyRef:f,lastFrameTimeRef:y,now:p,random:g,reducedMotion:m,showParticles:x,isContinuous:v,animate:b,decay:k,pulse:w,thresholds:A,staleness:S,particleStyle:_,getParticleColor:M,pendingAnnotationFrameRef:C,lastAnnotationFrameTimeRef:P,setAnnotationFrame:R,scheduleNextFrame:j,syncColorMap:T}=e,D=t.getContext("2d");if(!D)return;const L=y.current?Math.min((p-y.current)/1e3,.1):.016;y.current=p;const E=n.advanceTransition(m?p+1e6:p),N=!m&&E,I=!m&&n.tickAnimation([s,a],L),W=d.current,$=r?.beforeCompute(n.getLastUpdateResult(),N),z=E||W||I;z&&(n.buildScene([s,a]),W&&T?.()),$&&r?.afterCompute($,z,!1);const O=x&&!m&&!!n.particlePool,F=!!((B={dirtyOrRebuilt:W,transitioning:N,animationTicked:I,continuous:O||v,liveEncoding:!!k||!!w||!!A||!1!==b&&n.hasActiveTopologyDiff||n.hasActivePulses||n.hasActiveThresholds,forced:n.consumeStylePaintPending()||!0===f?.current}).dirtyOrRebuilt||B.transitioning||B.animationTicked||B.continuous||B.liveEncoding||B.forced);var B;f&&(f.current=!1);const Y=!!S&&n.lastIngestTime>0&&p-n.lastIngestTime>(S?.threshold??5e3);if(F){const e=pa(c);if(!ya(t,i,o,e))return;if(D.clearRect(-o.left,-o.top,i[0],i[1]),ss(D,{background:l,hasBackgroundGraphics:h,width:s,height:a}),k&&n.applyDecay(),w&&n.applyPulse(p),A&&n.applyThresholds(p),!1!==b&&n.applyTopologyDiff(p),Y&&(D.globalAlpha=S?.dimOpacity??.5),nl({context:D,nodes:n.sceneEdges,renderMode:u,pixelRatio:e,paintBuiltIn:e=>function(e,t){for(const n of t)switch(n.type){case"bezier":Gu(e,n);break;case"line":Vu(e,n);break;case"ribbon":Uu(e,n);break;case"curved":Ku(e,n)}}(D,e)}),nl({context:D,nodes:n.sceneNodes,renderMode:u,pixelRatio:e,paintBuiltIn:e=>{const t=e;!function(e,t){for(const n of t){if("rect"!==n.type)continue;const t=n;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),or(e,t.style,"#007bff",()=>e.fillRect(t.x,t.y,t.w,t.h)),sr(e,t.style,()=>e.strokeRect(t.x,t.y,t.w,t.h)),Ta(e,t),e.restore())}}(D,t),function(e,t){for(const n of t){if("circle"!==n.type)continue;const t=n;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),or(e,t.style,"#007bff",()=>e.fill()),sr(e,t.style,()=>e.stroke()),Da(e,t),e.restore())}}(D,t),function(e,t){for(const n of t){if("arc"!==n.type)continue;const t=n;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),or(e,t.style,"#007bff",()=>e.fill()),sr(e,t.style,()=>e.stroke()),e.restore()}}(D,t),function(e,t){const n=e.globalAlpha;for(const r of t)"symbol"===r.type&&Oa(e,r,r.cx,r.cy,n,"#007bff");e.globalAlpha=n}(D,t),function(e,t){const n=e.globalAlpha;for(const r of t)"glyph"===r.type&&Ba(e,r,r.cx,r.cy,n);e.globalAlpha=n}(D,t)}}),O&&!Y){const e=n.edgesArray;if(e.length>0){!function(e,t,n,r,i=Math.random){const o=r.spawnRate??.1,s=r.maxPerEdge??50;for(let r=0;t.length>r;r++){const a=t[r];if(!a.bezier)continue;if(e.countForEdge(r)>=s)continue;const l=a.value*o*n*(a.bezier.circular?.3:1),c=Math.floor(l),u=l-c;let h=c;i()<u&&h++;for(let t=0;h>t&&e.countForEdge(r)<s;t++)e.spawn(r,i)}}(n.particlePool,e,L,_,g);const t=.5*(_.speedMultiplier??1);let r;if(_.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);r=e.map(e=>.3+(e.value||1)/t*1.7)}n.particlePool.step(L,t,e,r),function(e,t,n,r,i){const o=r.radius??3;e.globalAlpha=r.opacity??.7;for(let s=0;t.particles.length>s;s++){const a=t.particles[s];if(!a.active)continue;const l=n[a.edgeIndex];if(!l)continue;let c;c="string"==typeof r.color&&"inherit"!==r.color?r.color:i(l),e.fillStyle=Xn(e,c)||c,e.beginPath(),e.arc(a.x,a.y,o,0,2*Math.PI),e.fill()}e.globalAlpha=1}(D,n.particlePool,e,_,M)}}Y&&(D.globalAlpha=1)}d.current=!1,(W||N||I)&&t.setAttribute("aria-label",ks(n.sceneNodes?.length??0,n.sceneEdges?.length??0,"Network chart"));const H=W||N||I||C.current;H&&p-P.current>=33?(R(e=>e+1),P.current=p,C.current=!1):C.current=!!H,(v||N||null!=n.transition||I||n.hasActivePulses||n.hasActiveThresholds||!1!==b&&n.hasActiveTopologyDiff||C.current)&&j()}({canvas:e,store:t,sceneRevisionDiagnostics:Tt.current,size:rt,margin:it,adjustedWidth:ot,adjustedHeight:st,background:ee,maxDevicePixelRatio:te,renderMode:N,hasBackgroundGraphics:!!Ae,dirtyRef:Je,resolutionDirtyRef:Bn,lastFrameTimeRef:Ct,now:pt.now(),random:pt.random,reducedMotion:!!tt.current,showParticles:D,isContinuous:an,animate:Pe,decay:Se,pulse:Me,thresholds:Ie,staleness:Re,particleStyle:wt,getParticleColor:sn,pendingAnnotationFrameRef:Rt,lastAnnotationFrameTimeRef:Pt,setAnnotationFrame:$t,scheduleNextFrame:()=>{yt()},syncColorMap:()=>Zt(t)})};const{canvasRef:Fn,resolutionDirtyRef:Bn}=xa(et,{hydrated:mt,wasHydratingFromSSR:xt,storeRef:jt,dirtyRef:Je,skipInitialCanvasPaintInvalidation:!0,canvasPaintInvalidator:en,maxDevicePixelRatio:te,canvasPaintDependencies:[n,ot,st,ee,Ae,N,yt]});Mr(Re,jt,Je,yt,zt,Ot);const Yn=ne&&Lt?(0,sh.jsx)(ea,{x:Lt.x,y:Lt.y,containerWidth:ot,containerHeight:st,margin:it,className:"stream-network-tooltip",zIndex:2,children:re?re(Lt):(0,sh.jsx)(Xu,{data:Lt})}):null;if(qo||!mt&&xt)return(0,sh.jsx)(ju,{props:e,store:jt.current,responsiveRef:nt,size:rt,margin:it,adjustedWidth:ot,adjustedHeight:st,resolvedBackground:lt,resolvedForeground:at});const Hn=jt.current;return(0,sh.jsxs)("div",{ref:nt,className:"stream-network-frame"+(J?" "+J:""),role:"group","aria-label":$e||("string"==typeof ke?ke:"Network chart"),tabIndex:0,"aria-busy":Ft||void 0,style:{position:"relative",width:K?"100%":rt[0],height:Q?"100%":rt[1],overflow:"visible"},onKeyDown:zn,children:["production"!==process.env.NODE_ENV&&jt.current&&(0,sh.jsx)(yn,{store:jt.current,diagnostics:Tt.current}),We&&(0,sh.jsx)($s,{tableId:ht}),We&&(0,sh.jsx)(Is,{nodes:Hn?.sceneNodes??[],edges:Hn?.sceneEdges??[],chartType:"Network chart",tableId:ht,chartTitle:"string"==typeof ke?ke:void 0}),(0,sh.jsx)(Ws,{summary:ze}),(0,sh.jsx)(ps,{hoverPoint:Lt}),(0,sh.jsxs)("div",{role:"img","aria-label":$e||("string"==typeof ke?ke:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:ne?On:void 0,onMouseLeave:ne?Tn:void 0,onClick:oe||se?En:void 0,children:[Ft&&!1!==k&&(0,sh.jsx)("div",{style:{position:"absolute",inset:0,zIndex:3,background:"var(--semiotic-bg, #fff)"},children:Nu(!0,rt[0],rt[1],k)}),(0,sh.jsx)(va,{size:rt,margin:it,overflowVisible:!0,children:lt}),(0,sh.jsx)("canvas",{ref:Fn,"aria-label":ks(Hn?.sceneNodes?.length??0,Hn?.sceneEdges?.length??0,"Network chart"),style:{position:"absolute",top:0,left:0}}),(0,sh.jsx)(Su,{width:ot,height:st,totalWidth:rt[0],totalHeight:rt[1],margin:it,labels:Hn?.labels||[],sceneNodes:Hn?.sceneNodes,title:ke,legend:ye,legendPosition:pe,legendLayout:ge,legendHoverBehavior:me,legendClickBehavior:xe,legendHighlightedCategory:ve,legendIsolatedCategories:be,foregroundGraphics:gn(at,kn(jt.current?.customLayoutOverlays,Qe??null)),annotations:ue,onAnnotationActivate:he,onObservation:ae??se,chartId:le,chartType:"StreamNetworkFrame",autoPlaceAnnotations:de,svgAnnotationRules:fe,annotationFrame:Wt}),(0,sh.jsx)(Pu,{marks:Hn?.customLayoutHtmlMarks,margin:it,selection:Qe??null}),(0,sh.jsx)(Fs,{active:Nn.current>=0,hoverPoint:Lt,margin:it,size:rt,shape:In.current?.shape,width:In.current?.w,height:In.current?.h}),Yn,Re?.showBadge&&(0,sh.jsx)(Pr,{isStale:zt,position:Re.badgePosition})]})]})}));hh.displayName="StreamNetworkFrame";var dh=hh,fh=class e{constructor(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}push(e){if(!Number.isFinite(e))return;this._count+=1;const t=e-this._mean;this._mean+=t/this._count,this._m2+=t*(e-this._mean),this._min>e&&(this._min=e),e>this._max&&(this._max=e)}merge(e){if(0===e._count)return;if(0===this._count)return this._count=e._count,this._mean=e._mean,this._m2=e._m2,this._min=e._min,void(this._max=e._max);const t=this._count+e._count,n=e._mean-this._mean;this._mean+=n*e._count/t,this._m2+=e._m2+n*n*this._count*e._count/t,this._count=t,this._min>e._min&&(this._min=e._min),e._max>this._max&&(this._max=e._max)}clear(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}clone(){const t=new e;return t._count=this._count,t._mean=this._mean,t._m2=this._m2,t._min=this._min,t._max=this._max,t}get count(){return this._count}get mean(){return 0===this._count?0:this._mean}get sum(){return 0===this._count?0:this._mean*this._count}get variance(){return 2>this._count?0:this._m2/this._count}get stddev(){return Math.sqrt(this.variance)}get sampleVariance(){return 2>this._count?0:this._m2/(this._count-1)}get sampleStddev(){return Math.sqrt(this.sampleVariance)}get min(){return this._min}get max(){return this._max}},yh=class{constructor(e){this.windows=new Map,this.sessions=[],this.latest=-1/0,this.type=e.window??"tumbling",this.size=e.size;const t=e.hop??e.size;this.hop=t>0&&e.size>=t?t:e.size,this.gap=e.gap??e.size,this.retain=null!=e.retain&&e.retain>0?e.retain:1/0}push(e,t){Number.isFinite(e)&&Number.isFinite(t)&&(e>this.latest&&(this.latest=e),"session"===this.type?this.pushSession(e,t):this.pushFixed(e,t),this.prune())}pushFixed(e,t){if("tumbling"===this.type||this.hop>=this.size)return void this.bump(Math.floor(e/this.size)*this.size,t);const n=this.hop,r=Math.floor(e/n);for(let i=Math.floor((e-this.size)/n)+1;r>=i;i++)this.bump(i*n,t)}bump(e,t){let n=this.windows.get(e);n||(n=new fh,this.windows.set(e,n)),n.push(t)}pushSession(e,t){const n=this.gap,r=new fh;r.push(t);let i=e,o=e;const s=[],a={start:i,end:o,stats:r};for(const t of this.sessions)e-n>t.end||t.start>e+n?s.push(t):(a.stats.merge(t.stats),i>t.start&&(i=t.start),t.end>o&&(o=t.end));a.start=i,a.end=o,s.push(a),s.sort((e,t)=>e.start-t.start),this.sessions=s}prune(){if(this.retain===1/0)return;if("session"===this.type)return void(this.sessions.length>this.retain&&(this.sessions=this.sessions.slice(this.sessions.length-this.retain)));if(this.retain>=this.windows.size)return;const e=[...this.windows.keys()].sort((e,t)=>e-t),t=e.length-this.retain;for(let n=0;t>n;n++)this.windows.delete(e[n])}emit(){return"session"===this.type?this.emitSessions():this.emitFixed()}emitFixed(){const e=[];for(const[t,n]of this.windows){const r=t+this.size;e.push(this.row(t,r,n,r>this.latest))}return e.sort((e,t)=>e.start-t.start),e}emitSessions(){return this.sessions.map(e=>this.row(e.start,e.end,e.stats,this.gap>this.latest-e.end))}row(e,t,n,r){return{start:e,end:t,count:n.count,mean:n.mean,sum:n.sum,min:n.min,max:n.max,stddev:n.stddev,partial:r}}get windowCount(){return"session"===this.type?this.sessions.length:this.windows.size}get watermark(){return this.latest}clear(){this.windows.clear(),this.sessions=[],this.latest=-1/0}};function ph(e,t){switch(t){case"sum":return e.sum;case"min":return e.min;case"max":return e.max;case"count":return e.count;default:return e.mean}}function gh(e,t,n,r=1){if("none"===t)return null;if("minmax"===t)return[e.min,e.max];const i=ph(e,n),o=e.stddev*r;return[i-o,i+o]}var mh={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},xh=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g;function vh(e){if("number"==typeof e)return Number.isFinite(e)&&e>0?e:null;if("string"!=typeof e)return null;const t=e.trim();if(""===t)return null;xh.lastIndex=0;let n,r=0,i=0;for(;null!==(n=xh.exec(t));){const e=parseFloat(n[1]),t=mh[n[2]];if(null==t||!Number.isFinite(e))return null;r+=e*t,i+=n[0].length}return i!==t.length?null:r>0?r:null}var bh=class{constructor(e){this.held=[],this._watermark=-1/0,this._lateCount=0,this.lateness=e.lateness>0?e.lateness:0,this.getTime=e.getTime,this.latePolicy=e.latePolicy??"drop"}push(e){const t=this.getTime(e);if(!Number.isFinite(t))return{released:[e],late:[]};const n=[];return this._watermark!==-1/0&&this._watermark-this.lateness>t?(this._lateCount+=1,n.push(e),"drop"===this.latePolicy?{released:[],late:n}:{released:[e],late:n}):(t>this._watermark&&(this._watermark=t),this.held.push(e),{released:this.drain(),late:n})}drain(){const e=this._watermark-this.lateness;if(0===this.held.length)return[];const t=[],n=[];for(const r of this.held)this.getTime(r)>e?n.push(r):t.push(r);return this.held=n,t.sort((e,t)=>this.getTime(e)-this.getTime(t)),t}flush(){const e=this.held;return this.held=[],e.sort((e,t)=>this.getTime(e)-this.getTime(t)),e}clear(){this.held=[],this._watermark=-1/0,this._lateCount=0}get watermark(){return this._watermark}get lateCount(){return this._lateCount}get heldCount(){return this.held.length}},kh=require("react"),wh=require("react"),Ah=require("react");function Sh(e){const t=[];for(const[n,r]of Object.entries(e.fields))if("point"===r.type)t.push(e=>r.values.has(e[n]));else{const[e,i]=r.range;t.push(t=>{const r=t[n];return r>=e&&i>=r})}return e=>t.every(t=>t(e))}function _h(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function Mh(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const n of e.values)if(!t.values.has(n))return!1;return!0}return!1}var[Ch,Ph]=W(e=>({selections:new Map,setClause(t,n){e(e=>{const r=e.selections.get(t),i=r?.clauses.get(n.clientId);if(i&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,r]of n){const n=t.fields[e];if(!n||!Mh(r,n))return!1}return!0}(i,n))return{};const o=new Map(e.selections),s=_h(o,t),a=new Map(s.clauses);return a.set(n.clientId,n),o.set(t,{...s,clauses:a}),{selections:o}})},clearClause(t,n){e(e=>{const r=e.selections.get(t);if(!r||!r.clauses.has(n))return{};const i=new Map(e.selections),o=new Map(r.clauses);return o.delete(n),i.set(t,{...r,clauses:o}),{selections:i}})},setResolution(t,n){e(e=>{const r=e.selections.get(t);if(r?.resolution===n)return{};const i=new Map(e.selections),o=_h(i,t);return i.set(t,{...o,resolution:n}),{selections:i}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const r=new Map(e.selections);return r.set(t,{...n,clauses:new Map}),{selections:r}})}}));function Rh(e){const t=(0,Ah.useId)(),n=e.clientId||t,{name:r}=e,i=Ph(e=>e.selections.get(r)),o=Ph(e=>e.setClause),s=Ph(e=>e.clearClause),a=(0,Ah.useMemo)(()=>!!i&&i.clauses.size>0,[i]);return{predicate:(0,Ah.useMemo)(()=>i&&0!==i.clauses.size?function(e,t){const n=[];for(const[r,i]of e.clauses)"crossfilter"===e.resolution&&r===t||n.push(Sh(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(i,n):()=>!0,[i,n]),isActive:a,selectPoints:(0,Ah.useCallback)(e=>{const t={};let i=!1;for(const[n,r]of Object.entries(e))t[n]={type:"point",values:new Set(r)},i=!0;i&&o(r,{clientId:n,type:"point",fields:t})},[n,r,o]),selectInterval:(0,Ah.useCallback)(e=>{const t={};let i=!1;for(const[n,r]of Object.entries(e))t[n]={type:"interval",range:r},i=!0;i&&o(r,{clientId:n,type:"interval",fields:t})},[n,r,o]),clear:(0,Ah.useCallback)(()=>{s(r,n)},[s,r,n]),clientId:n}}function jh(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Th(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}var Dh={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Lh(e,t={}){const n=t.mobileSemantics?.interaction,r="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,i="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,o=!!n||void 0!==r,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!i&&!o)return Dh;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??r??44,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??44,standardControls:a.standardControls??!1}}var Eh={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}},mobile:{width:390,height:300,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:!1,showLabels:!0,marginDefaults:{top:28,bottom:42,left:44,right:16}}};function Nh(e,t,n){if(!1!==t)return e;const r={...e};return"horizontal"===n?r.left=Math.min(r.left,15):r.bottom=Math.min(r.bottom,15),r}function Ih(e,t,n){const r=e.xValue??t?.[n];if(null==r)return null;const i=Number(r);return Number.isFinite(i)?i:null}function Wh(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?{...t,xValue:e.xValue}:t||{}}var $h=require("react"),zh=require("react"),Oh=(require("react/jsx-runtime"),(0,zh.createContext)(!1));(0,zh.createContext)(!1);var Fh=(0,zh.createContext)(null),Bh="undefined"==typeof window?zh.useEffect:zh.useLayoutEffect;function Yh({data:e,colorBy:t,colorScale:n,showLegend:r,legendPosition:i="right",userMargin:o,defaults:s={top:50,bottom:60,left:70,right:40},categories:a,additionalLegend:l,chartWidth:c,legendLayout:u,hasTitle:h=!1,axisChrome:d}){const f=(0,zh.useContext)(Oh),y=null!==(0,zh.useContext)(Fh),p=void 0!==r?r:!f&&!!t,g=!!t&&(p||y),m=(0,$h.useMemo)(()=>g?void 0!==a?a:function(e,t){if(!t)return[];const n=new Set;for(const r of e){const e="function"==typeof t?t(r):r[t];null!=e&&n.add(e+"")}return Array.from(n)}(e,t):[],[a,t,e,g]);!function(e){const t=(0,zh.useContext)(Fh),n=(0,zh.useId)(),r=function(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}(e),i=(0,zh.useRef)([]);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(i.current,r)||(i.current=r);const o=i.current;Bh(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),Bh(()=>{t&&t.registerCategories(n,o)},[t,n,o])}(y&&t?m:[]);const x=(0,$h.useMemo)(()=>{if(!p||!t)return;const r=function({data:e,colorBy:t,colorScale:n,getColor:r,strokeColor:i,strokeWidth:o,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==o&&(n.strokeWidth=o),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,o)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),a=s?r(s,t,n):n?n(i):Me[o%Me.length];return{label:i+"",color:a}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:Pe,categories:m});return 0!==r.legendGroups.reduce((e,t)=>e+t.items.length,0)?r:void 0},[p,t,e,n,m]),v=(0,$h.useMemo)(()=>function(...e){let t;for(const n of e)n&&(t=Tr(t)&&Tr(n)?{legendGroups:[...t.legendGroups,...n.legendGroups],legendDistance:n.legendDistance??t.legendDistance}:n);return t}(x,l),[x,l]),{hasAxis:b,hasAxisLabel:k,rotatedTicks:w}=d??{},A=(0,$h.useMemo)(()=>{const e="number"==typeof o?{top:o,bottom:o,left:o,right:o}:o??{},t=t=>{const n=e[t];return"number"==typeof n?n:s[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},r=t=>"number"==typeof e[t];if(v){const e=function(e,t){return Er(e,t)+Nr(e)+Ir(t)}(v,u),t=void 0===b?{hasAxis:!0,hasAxisLabel:!0}:{hasAxis:b,hasAxisLabel:k,rotatedTicks:w},o=$r(v,Math.max(1,(c??600)-n.left-n.right),u)+Nr(v)+Wr("bottom"===i?t:void 0,u)+("top"===i&&h?24:0);"right"===i&&!r("right")&&e>n.right?n.right=e:"left"===i&&!r("left")&&e>n.left?n.left=e:"top"!==i||r("top")?"bottom"!==i||r("bottom")||(n.bottom=Math.max(n.bottom,80,o)):n.top=Math.max(n.top,50,o)}return n},[s,o,v,i,c,u,h,b,k,w]);return{legend:v,margin:A,legendPosition:i}}var Hh=[];function Xh({selection:e,linkedHover:t,fallbackFields:n=Hh,unwrapData:r=!1,onObservation:i,chartType:o,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const h=(0,wh.useId)(),d=(0,wh.useMemo)(()=>function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,n),[t,n]),f=(0,wh.useMemo)(()=>"series"===d?.mode?[d.seriesField||c||n[0]].filter(e=>!!e):d?.fields||n,[d,c,n]),y=Rh({name:e?.name||"__unused__",fields:f}),p=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:r,isActive:i,selectPoints:o,clear:s}=Rh({name:t,fields:n});return{onHover:(0,Ah.useCallback)(e=>{if(!e)return void s();const t={};for(const r of n){const n=e[r];void 0!==n&&(t[r]=[n])}z(t)&&o(t)},[n,o,s]),predicate:r,isActive:i}}({name:d?.name||"hover",fields:f}),g=ji(e=>e.pushObservation),m=(0,wh.useCallback)(e=>{i?.(e),g?.(e)},[i,g]),x=e?{isActive:y.isActive,predicate:y.predicate}:null,[v,b]=(0,wh.useState)(null),k=(0,wh.useRef)(!1),w=c||n[0],A=(0,wh.useMemo)(()=>{if(!l||null==v||!w)return null;const e=v,t=w;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,v,w]),S=(0,wh.useCallback)((e,n)=>{const r=!e&&k.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===d?.mode&&d.xField){const n=Ih(e,t,d.xField);null!=n&&function(e,t,n){const r=lo.positions.get(e);r?.locked||r&&r.xValue===t&&r.sourceId===n||(lo={positions:new Map(lo.positions).set(e,{xValue:t,sourceId:n})},uo())}(d.name||"hover",n,h)}"x-position"!==d?.mode&&p.onHover(t)}else"x-position"!==d?.mode||r||ho(d.name||"hover",h),"x-position"===d?.mode||r||p.onHover(null);if(l&&w)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[w];b(null!=n?n+"":null)}else r||b(null);(i||g)&&cl({onObservation:m,datum:e?Wh(e):null,x:e?.x,y:e?.y,chartType:o||"unknown",chartId:s,context:n})},[t,p,d,h,i,o,s,g,m,l,w,u]),_=(0,wh.useCallback)((n=!0)=>{k.current=!1,t&&"x-position"!==d?.mode&&p.onHover(null),e&&u?.tapToSelect&&y.clear(),n&&l&&b(null),"x-position"===d?.mode&&(fo(d.name||"hover",h),ho(d.name||"hover",h))},[t,d,p,e,u,y,l,h]),M=(0,wh.useCallback)((n,r)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),x=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===d?.mode&&d.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=Ih(n,e,d.xField);null!=t&&function(e,t,n){const r=lo.positions.get(e);if(r?.locked){const t=new Map(lo.positions);return t.delete(e),lo={positions:t},uo(),!1}lo={positions:new Map(lo.positions).set(e,{xValue:t,sourceId:n,locked:!0})},uo()}(d.name||"hover",t,h)}if(c)if(n){k.current=!0;const r=Wh(n);if(t&&"x-position"!==d?.mode&&p.onHover(r),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const n=r[t];void 0!==n&&(e[t]=[n])}(function(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1})(e)&&y.selectPoints(e)}if(l&&w){const e=r?.[w];b(null!=e?e+"":null)}}else x&&_();if(n||x){if(n&&a){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),a(e,{x:n.x??0,y:n.y??0})}(i||g)&&ul({onObservation:m,datum:n?Wh(n):null,x:n?.x,y:n?.y,chartType:o||"unknown",chartId:s,context:r})}},[a,i,g,m,o,s,d,h,u,t,p,e,y,f,l,w,_]);return(0,wh.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&k.current&&_()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,_]),(0,wh.useEffect)(()=>()=>{k.current&&_(!1)},[_]),(0,wh.useEffect)(()=>{if("x-position"!==d?.mode)return;const e=d.name||"hover";return()=>{fo(e,h),ho(e,h)}},[d?.mode,d?.name,h]),{activeSelectionHook:x,hoverSelectionHook:A,customHoverBehavior:S,customClickBehavior:M,crosshairSourceId:h}}function qh(e,t,n){return function(e,t,n){const r=Eh[e||"primary"],i=e&&"primary"!==e||!n?.width?r.width:n.width,o=e&&"primary"!==e||!n?.height?r.height:n.height,s=function(e,t,n=e.responsiveRules){if(!Array.isArray(n)||0===n.length)return{props:e,matches:[]};const r=n.map((e,t)=>({rule:e,index:t})).filter(e=>function(e,t){const{when:n}=e,r=t.width,i=t.height,o=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),s=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof n.minWidth&&n.minWidth>r||"number"==typeof n.maxWidth&&r>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof i||n.minHeight>i)||"number"==typeof n.maxHeight&&("number"!=typeof i||i>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof o||n.minAspectRatio>o)||"number"==typeof n.maxAspectRatio&&("number"!=typeof o||o>n.maxAspectRatio)||n.orientation&&s!==n.orientation)}(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:r.reduce((e,t)=>function(e,t){const n={...e,...t};for(const r of["margin","frameProps","mobileSemantics","style"])Th(e[r])&&Th(t[r])&&(n[r]={...e[r],...t[r]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:r}}({...t,mode:e},{width:t.width??i,height:t.height??o}).props,a=s.mode||e||"primary",l=Eh[a],c="context"===a||"sparkline"===a,u="primary"===a&&n?.width?n.width:l.width;return{mode:a,width:s.width??u,height:s.height??("primary"===a&&n?.height?n.height:l.height),showAxes:s.showAxes??l.showAxes,showGrid:s.showGrid??l.showGrid,enableHover:s.enableHover??(!!s.linkedHover||l.enableHover),showLegend:s.showLegend??l.showLegend,showLabels:s.showLabels??l.showLabels,title:c?void 0:s.title,description:s.description,summary:s.summary,accessibleTable:s.accessibleTable,xLabel:c?void 0:s.xLabel,yLabel:c?void 0:s.yLabel,categoryLabel:c?void 0:s.categoryLabel,valueLabel:c?void 0:s.valueLabel,marginDefaults:Nh(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:Lh(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}(e,t,n)}var Gh=require("react/jsx-runtime"),Vh={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, #f3f4f6)",padding:"6px 10px",borderRadius:"var(--semiotic-tooltip-radius, 4px)",fontSize:"var(--semiotic-tooltip-font-size, 12px)",fontFamily:"var(--semiotic-tick-font-family, var(--semiotic-font-family, sans-serif))",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.25))",lineHeight:1.4,pointerEvents:"none",whiteSpace:"nowrap"},Uh={opacity:.7,marginRight:4};function Kh(e,t,n){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:n]}function Qh(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Zh(e={}){const{timeAccessor:t,valueAccessor:n,xLabel:r="x",yLabel:i="y"}=e;return e=>{const o=e?.data??null,s=Kh(o,t,"time"),a=Kh(o,n,"value");return(0,Gh.jsxs)("div",{className:"semiotic-tooltip",style:Vh,children:[(0,Gh.jsxs)("div",{children:[(0,Gh.jsxs)("span",{style:Uh,children:[r,":"]}),Qh(s)]}),(0,Gh.jsxs)("div",{children:[(0,Gh.jsxs)("span",{style:Uh,children:[i,":"]}),Qh(a)]})]})}}function Jh(e,t){return null!=e?e:Math.max(t?.length??0,200)}var ed="time",td="value",nd="__aggLower",rd="__aggUpper",id="__aggPartial",od="count",sd="__aggStart",ad="__aggEnd";function ld(e,t){const n=t.stat??"mean",r=t.band??"none",i=t.sigma??1;return e.emit().map(e=>{const t={[ed]:(e.start+e.end)/2,[td]:ph(e,n),[od]:e.count,[id]:e.partial,[sd]:e.start,[ad]:e.end},o=gh(e,r,n,i);return o&&(t[nd]=o[0],t[rd]=o[1]),t})}function cd(e){const{linkedHover:t,selection:n,onObservation:r,onClick:i,hoverRadius:o,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:h,linkedHoverInClickPredicate:d=!0}=e,f={};r&&(f.annotationObservationCallback=r);const y=c?.enabled?Math.max(o??30,Math.ceil((c.targetSize||44)/2),24):o;return(a||t||r||i||s)&&(f.customHoverBehavior=u),h&&(l||(d?r||i||t:r||i)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||n))&&(f.customClickBehavior=h),null!=y&&(f.hoverRadius=y),f}var ud=require("react/jsx-runtime");function hd(e,t,n){const r="function"==typeof t?t(e):e[t??n];if(null==r)return null;if(r instanceof Date)return r.getTime();const i=Number(r);return Number.isFinite(i)?i:null}var dd=(0,kh.forwardRef)(function(e,t){const n=qh(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:r,margin:i,className:o,arrowOfTime:s="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:h,timeExtent:d,valueExtent:f,extentPadding:y,stroke:p="#007bff",strokeWidth:g=2,strokeDasharray:m,opacity:x,background:v,tooltipContent:b,tooltip:k,onHover:w,annotations:A,autoPlaceAnnotations:S,svgAnnotationRules:_,tickFormatTime:M,tickFormatValue:C,decay:P,pulse:R,staleness:j,transition:T,linkedHover:D,selection:L,onObservation:E,chartId:N,loading:I,loadingContent:W,emptyContent:$,emphasis:z,legendPosition:O,aggregate:F,eventTime:B}=e,Y=n.showAxes,H=n.enableHover,X=i??n.marginDefaults,q=r??[n.width,n.height],G=b??k??Zh({timeAccessor:u,valueAccessor:h}),V=(0,kh.useRef)(null),{customHoverBehavior:U}=Xh({selection:L,linkedHover:D,unwrapData:!0,onObservation:E,chartType:"RealtimeLineChart",chartId:N}),K=(0,kh.useCallback)(e=>{w&&w(e),U(e)},[w,U]),Q=null!=F,[Z,J]=(0,kh.useState)([]),ee=(0,kh.useRef)(null),te=(0,kh.useRef)(F);te.current=F;const ne=(0,kh.useRef)(Q);ne.current=Q;const re=(0,kh.useRef)(Z);re.current=Z;const ie=(0,kh.useRef)({timeAccessor:u,valueAccessor:h});ie.current={timeAccessor:u,valueAccessor:h},(0,kh.useEffect)(()=>{if(!Q)return void(ee.current=null);const e=te.current,t=function(e){const t=e.window??"tumbling",n=vh("session"===t?e.gap??e.size:e.size);if(null==n)return null;const r=null!=e.hop?vh(e.hop):void 0,i=null!=e.gap?vh(e.gap):void 0;return new yh({window:t,size:n,hop:r??void 0,gap:i??void 0,retain:e.retain})}(e);if(ee.current=t,t&&c){const{timeAccessor:e,valueAccessor:n}=ie.current;for(const r of c){const i=hd(r,e,"time"),o=hd(r,n,"value");null!=i&&null!=o&&t.push(i,o)}}J(t?ld(t,e):[])},[Q?[F.window??"tumbling",F.size,F.hop??"",F.gap??"",F.retain??""].join("|"):"",Q,c]),(0,kh.useEffect)(()=>{Q&&ee.current&&J(ld(ee.current,te.current))},[F?.stat,F?.band,F?.sigma]);const oe=(0,kh.useCallback)(e=>{const t=ee.current,n=te.current;if(!t||!n)return;const{timeAccessor:r,valueAccessor:i}=ie.current;for(const n of e){const e=hd(n,r,"time"),o=hd(n,i,"value");null!=e&&null!=o&&t.push(e,o)}J(ld(t,n))},[]),se=null!=B,ae=(0,kh.useRef)(null),le=(0,kh.useRef)(B);le.current=B;const ce=(0,kh.useRef)(se);ce.current=se;const ue=(0,kh.useRef)(E);ue.current=E;const he=(0,kh.useRef)(N);he.current=N,(0,kh.useEffect)(()=>{ae.current=se?function(e){const t=vh(e.lateness);return null==t?null:new bh({lateness:t,getTime:e=>hd(e,ie.current.timeAccessor,"time")??NaN,latePolicy:e.latePolicy??"drop"})}(le.current):null},[se?`${B.lateness}|${B.latePolicy??"drop"}`:"",se]);const de=(0,kh.useCallback)(e=>{0!==e.length&&(ne.current?oe(e):V.current?.pushMany(e))},[oe]),fe=(0,kh.useCallback)(e=>{const t=ae.current;if(!ce.current||!t)return void de(e);const n=[];for(const r of e){const e=t.push(r);if(e.released.length&&n.push(...e.released),e.late.length){const n=ue.current;if(n){const{timeAccessor:r}=ie.current,i=le.current?.latePolicy??"drop";for(const o of e.late)n({type:"late-data",datum:o,eventTime:hd(o,r,"time")??NaN,watermark:t.watermark,policy:i,lateCount:t.lateCount,timestamp:Date.now(),chartType:"RealtimeLineChart",chartId:he.current})}}}de(n)},[de]);(0,kh.useImperativeHandle)(t,()=>({push:e=>fe([e]),pushMany:e=>fe(e),remove:e=>ne.current?[]:V.current?.remove(e)??[],update:(e,t)=>ne.current?[]:V.current?.update(e,t)??[],clear:()=>{ae.current?.clear(),ne.current?(ee.current?.clear(),J([])):V.current?.clear()},getData:()=>ne.current?re.current:V.current?.getData()??[],getScales:()=>V.current?.getScales()??null}),[fe]);const ye=Nu(I,q[0],q[1],W),pe=ye?null:Eu(Q?void 0:c,q[0],q[1],$),ge={stroke:p,strokeWidth:g,strokeDasharray:m};null!=x&&(ge.opacity=x);const me=Jh(l,c),xe=Q?Z:c,ve=Q?ed:u,be=Q?td:h,ke=Q&&F&&"none"!==(F.band??"none")?{y0Accessor:nd,y1Accessor:rd,perSeries:!1}:void 0;return ye||pe||(0,ud.jsx)(Sl,{ref:V,chartType:"line",runtimeMode:"streaming",size:q,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:X,className:z?`${o||""} semiotic-emphasis-${z}`.trim():o,arrowOfTime:s,windowMode:Q?"growing":a,windowSize:Q?Math.max(1,F?.retain??Math.max(Z.length,600)):me,data:xe,timeAccessor:ve,valueAccessor:be,xExtent:d,yExtent:f,extentPadding:y,band:ke,lineStyle:ge,showAxes:Y,background:v,hoverAnnotation:H,tooltipContent:G,...cd({linkedHover:D,selection:L,onObservation:E,forceHoverBehavior:!0,mobileInteraction:n.mobileInteraction,customHoverBehavior:K}),annotations:A,autoPlaceAnnotations:S,svgAnnotationRules:_,tickFormatTime:M,tickFormatValue:C,decay:P,pulse:R,staleness:j,transition:T,pointIdAccessor:e.pointIdAccessor,legendPosition:O})});dd.displayName="RealtimeLineChart";var fd=require("react");function yd(e,t,n){const r="function"==typeof t?t(e):e[t??n];if(null==r)return null;if(r instanceof Date)return r.getTime();if("string"==typeof r&&""===r.trim())return null;const i=Number(r);return Number.isFinite(i)?i:null}var pd=require("react/jsx-runtime"),gd=(0,fd.forwardRef)(function(e,t){const n=qh(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,showAxes:e.showAxes,showLegend:e.showLegend,enableHover:null!=e.enableHover?!!e.enableHover:void 0,linkedHover:e.linkedHover,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{binSize:r,size:i,margin:o,className:s,arrowOfTime:a="right",windowMode:l="sliding",windowSize:c,data:u,timeAccessor:h,valueAccessor:d,direction:f="up",timeExtent:y,valueExtent:p,extentPadding:g,categoryAccessor:m,colors:x,fill:v,stroke:b,strokeWidth:k,opacity:w,gap:A,background:S,tooltipContent:_,tooltip:M,onHover:C,annotations:P,autoPlaceAnnotations:R,svgAnnotationRules:j,tickFormatTime:T,tickFormatValue:D,linkedHover:L,selection:E,decay:N,pulse:I,staleness:W,transition:$,onObservation:O,chartId:F,loading:B,loadingContent:Y,emptyContent:H,emphasis:X,legendPosition:q,legend:G,brush:V,onBrush:U,linkedBrush:K}=e,Q=n.showAxes,Z=n.enableHover,J=i??[n.width,n.height],ee=(0,fd.useMemo)(()=>x?e=>x[e]??v??"#999":void 0,[x,v]),{legend:te,margin:ne,legendPosition:re}=Yh({data:u??[],colorBy:m,colorScale:ee,showLegend:n.showLegend,legendPosition:q,userMargin:o,defaults:n.marginDefaults,additionalLegend:G,chartWidth:J[0],axisChrome:{hasAxis:!1!==n.showAxes}}),ie=_??M??function(e={}){const{timeAccessor:t,valueAccessor:n}=e;return e=>{const r=e?.data??null;if(null==r?.binStart||null==r?.binEnd){const e=Kh(r,t,"time"),i=Kh(r,n,"value");return(0,Gh.jsxs)("div",{className:"semiotic-tooltip",style:Vh,children:[(0,Gh.jsxs)("div",{children:[(0,Gh.jsx)("span",{style:Uh,children:"x:"}),Qh(e)]}),(0,Gh.jsxs)("div",{children:[(0,Gh.jsx)("span",{style:Uh,children:"y:"}),Qh(i)]})]})}return(0,Gh.jsxs)("div",{className:"semiotic-tooltip",style:Vh,children:[(0,Gh.jsxs)("div",{children:[(0,Gh.jsx)("span",{style:Uh,children:"range:"}),Qh(r.binStart),"–",Qh(r.binEnd)]}),null!=r.total&&(0,Gh.jsxs)("div",{children:[(0,Gh.jsx)("span",{style:Uh,children:"count:"}),Qh(r.total)]}),null!=r.category&&(0,Gh.jsxs)("div",{children:[(0,Gh.jsx)("span",{style:Uh,children:"category:"}),Qh(r.category)]})]})}}({timeAccessor:h,valueAccessor:d}),oe=(0,fd.useRef)(null),{customHoverBehavior:se}=Xh({selection:E,linkedHover:L,unwrapData:!0,onObservation:O,chartType:"RealtimeHistogram",chartId:F}),ae=(0,fd.useCallback)(e=>{C&&C(e),se(e)},[C,se]),le=!0===V?{dimension:"x",snap:"bin"}:"x"===V?{dimension:"x"}:"object"==typeof V?V:void 0,ce=(ue=K)?"string"==typeof ue?{name:ue}:ue:null;var ue;const he="string"==typeof h?h:"time",de=function(e){const{name:t,xField:n,yField:r}=e,{predicate:i,isActive:o,selectInterval:s,clear:a}=Rh({name:t,fields:[n,r].filter(Boolean)}),l=n&&r?"xyBrush":n?"xBrush":"yBrush",c=(0,Ah.useCallback)(e=>{if(!e)return void a();const t={};"xyBrush"===l&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===l&&jh(e)?n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&jh(e)&&r&&(t[r]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),z(t)&&s(t)},[l,n,r,s,a]);return{brushInteraction:(0,Ah.useMemo)(()=>({brush:l,during:c,end:c}),[l,c]),predicate:i,isActive:o,clear:a}}({name:ce?.name||"__unused_hist_brush__",xField:ce?.xField||he,...ce?.yField?{yField:ce.yField}:{}}),fe=(0,fd.useRef)(de.brushInteraction);fe.current=de.brushInteraction;const ye=(0,fd.useCallback)(e=>{if(U&&U(e),O&&O(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:F}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:F}),ce){const t=fe.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[U,O,F,ce]);(0,fd.useImperativeHandle)(t,()=>({push:e=>oe.current?.push(e),pushMany:e=>oe.current?.pushMany(e),remove:e=>oe.current?.remove(e)??[],update:(e,t)=>oe.current?.update(e,t)??[],clear:()=>oe.current?.clear(),getData:()=>oe.current?.getData()??[],getScales:()=>oe.current?.getScales()??null}),[]);const pe=Nu(B,J[0],J[1],Y),ge=pe?null:Eu(u,J[0],J[1],H),me={};null!=v&&(me.fill=v),null!=b&&(me.stroke=b),null!=k&&(me.strokeWidth=k),null!=w&&(me.opacity=w),null!=A&&(me.gap=A);const xe=X?`${s||""} semiotic-emphasis-${X}`.trim():s,ve=Jh(c,u),be=(0,fd.useMemo)(()=>"down"!==f?p:function({data:e,valueAccessor:t,timeAccessor:n,binSize:r,valueExtent:i,extentPadding:o}){if(i)return[i[1],i[0]];if(!e||0===e.length)return;const s=new Map;for(const i of e){const e=yd(i,n,"time"),o=yd(i,t,"value");if(null==e||null==o)continue;const a=Math.floor(e/r)*r;s.set(a,(s.get(a)??0)+o)}let a=0;for(const e of s.values())a=Math.max(a,e);return[a>0?a+a*(o??.1):1,0]}({data:u,valueAccessor:d,timeAccessor:h,binSize:r,valueExtent:p,extentPadding:g}),[f,u,d,h,r,p,g]);return pe||ge||(0,pd.jsx)(Sl,{ref:oe,chartType:"bar",runtimeMode:"streaming",size:J,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:ne,className:xe,arrowOfTime:a,windowMode:l,windowSize:ve,data:u,timeAccessor:h,valueAccessor:d,xExtent:y,yExtent:be,extentPadding:g,binSize:r,categoryAccessor:m,barColors:x,barStyle:me,showAxes:Q,background:S,hoverAnnotation:Z,tooltipContent:ie,...cd({linkedHover:L,selection:E,onObservation:O,forceHoverBehavior:!0,mobileInteraction:n.mobileInteraction,customHoverBehavior:ae}),annotations:P,autoPlaceAnnotations:R,svgAnnotationRules:j,tickFormatTime:T,tickFormatValue:D,decay:N,pulse:I,staleness:W,transition:$,pointIdAccessor:e.pointIdAccessor,legend:te,legendPosition:re,brush:le||(K?{dimension:"x"}:void 0),onBrush:le||K?ye:void 0})});function md(e){return(0,pd.jsx)(gd,{...e,windowMode:"growing"})}gd.displayName="RealtimeHistogram",md.displayName="TemporalHistogram";var xd=require("react"),vd=require("react/jsx-runtime"),bd=(0,xd.forwardRef)(function(e,t){const n=qh(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:r,margin:i,className:o,arrowOfTime:s="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:h,timeExtent:d,valueExtent:f,yScaleType:y,extentPadding:p,categoryAccessor:g,colors:m,radius:x,fill:v,opacity:b,stroke:k,strokeWidth:w,pointStyle:A,background:S,tooltipContent:_,tooltip:M,onHover:C,annotations:P,autoPlaceAnnotations:R,svgAnnotationRules:j,tickFormatTime:T,tickFormatValue:D,linkedHover:L,selection:E,onObservation:N,chartId:I,loading:W,loadingContent:$,emptyContent:z,emphasis:O,legendPosition:F}=e,B=n.showAxes,Y=n.enableHover,H=i??n.marginDefaults,X=r??[n.width,n.height],q=_??M??Zh({timeAccessor:u,valueAccessor:h}),G=(0,xd.useRef)(null),{customHoverBehavior:V}=Xh({selection:E,linkedHover:L,unwrapData:!0,onObservation:N,chartType:"RealtimeSwarmChart",chartId:I}),U=(0,xd.useCallback)(e=>{C&&C(e),V(e)},[C,V]);(0,xd.useImperativeHandle)(t,()=>({push:e=>G.current?.push(e),pushMany:e=>G.current?.pushMany(e),remove:e=>G.current?.remove(e)??[],update:(e,t)=>G.current?.update(e,t)??[],clear:()=>G.current?.clear(),getData:()=>G.current?.getData()??[],getScales:()=>G.current?.getScales()??null}),[]);const K=Nu(W,X[0],X[1],$),Q=K?null:Eu(c,X[0],X[1],z),Z={};null!=x&&(Z.radius=x),null!=v&&(Z.fill=v),null!=b&&(Z.opacity=b),null!=k&&(Z.stroke=k),null!=w&&(Z.strokeWidth=w);const J=A,ee=O?`${o||""} semiotic-emphasis-${O}`.trim():o,te=Jh(l,c);return K||Q||(0,vd.jsx)(Sl,{ref:G,chartType:"swarm",runtimeMode:"streaming",size:X,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:H,className:ee,arrowOfTime:s,windowMode:a,windowSize:te,data:c,timeAccessor:u,valueAccessor:h,xExtent:d,yExtent:f,yScaleType:y,extentPadding:p,categoryAccessor:g,barColors:m,swarmStyle:Z,pointStyle:J,showAxes:B,background:S,hoverAnnotation:Y,tooltipContent:q,...cd({linkedHover:L,selection:E,onObservation:N,forceHoverBehavior:!0,mobileInteraction:n.mobileInteraction,customHoverBehavior:U}),annotations:P,autoPlaceAnnotations:R,svgAnnotationRules:j,tickFormatTime:T,tickFormatValue:D,legendPosition:F,pointIdAccessor:e.pointIdAccessor})});bd.displayName="RealtimeSwarmChart";var kd=require("react"),wd=require("react/jsx-runtime"),Ad=(0,kd.forwardRef)(function(e,t){const n=qh(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:r,margin:i,className:o,arrowOfTime:s="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:h,timeExtent:d,valueExtent:f,extentPadding:y,positiveColor:p,negativeColor:g,connectorStroke:m,connectorWidth:x,gap:v,stroke:b,strokeWidth:k,opacity:w,background:A,tooltipContent:S,tooltip:_,onHover:M,annotations:C,autoPlaceAnnotations:P,svgAnnotationRules:R,tickFormatTime:j,tickFormatValue:T,linkedHover:D,selection:L,onObservation:E,chartId:N,loading:I,loadingContent:W,emptyContent:$,emphasis:z,legendPosition:O}=e,F=n.showAxes,B=n.enableHover,Y=i??n.marginDefaults,H=r??[n.width,n.height],X=S??_??function(e={}){const{timeAccessor:t,valueAccessor:n}=e;return e=>{const r=e?.data??null,i=Kh(r,t,"time"),o=r?.delta??Kh(r,n,"value"),s=r?.cumEnd,a="number"==typeof o?0>o?Qh(o):"+"+Qh(o):Qh(o);return(0,Gh.jsxs)("div",{className:"semiotic-tooltip",style:Vh,children:[(0,Gh.jsxs)("div",{children:[(0,Gh.jsx)("span",{style:Uh,children:"x:"}),Qh(i)]}),(0,Gh.jsxs)("div",{children:[(0,Gh.jsx)("span",{style:Uh,children:"Δ:"}),a]}),null!=s&&(0,Gh.jsxs)("div",{children:[(0,Gh.jsx)("span",{style:Uh,children:"total:"}),Qh(s)]})]})}}({timeAccessor:u,valueAccessor:h}),q=(0,kd.useRef)(null),{customHoverBehavior:G}=Xh({selection:L,linkedHover:D,unwrapData:!0,onObservation:E,chartType:"RealtimeWaterfallChart",chartId:N}),V=(0,kd.useCallback)(e=>{M&&M(e),G(e)},[M,G]);(0,kd.useImperativeHandle)(t,()=>({push:e=>q.current?.push(e),pushMany:e=>q.current?.pushMany(e),remove:e=>q.current?.remove(e)??[],update:(e,t)=>q.current?.update(e,t)??[],clear:()=>q.current?.clear(),getData:()=>q.current?.getData()??[],getScales:()=>q.current?.getScales()??null}),[]);const U=Nu(I,H[0],H[1],W),K=U?null:Eu(c,H[0],H[1],$),Q={};null!=p&&(Q.positiveColor=p),null!=g&&(Q.negativeColor=g),null!=m&&(Q.connectorStroke=m),null!=x&&(Q.connectorWidth=x),null!=v&&(Q.gap=v),null!=b&&(Q.stroke=b),null!=k&&(Q.strokeWidth=k),null!=w&&(Q.opacity=w);const Z=z?`${o||""} semiotic-emphasis-${z}`.trim():o,J=Jh(l,c);return U||K||(0,wd.jsx)(Sl,{ref:q,chartType:"waterfall",runtimeMode:"streaming",size:H,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:Y,className:Z,arrowOfTime:s,windowMode:a,windowSize:J,data:c,timeAccessor:u,valueAccessor:h,xExtent:d,yExtent:f,extentPadding:y,waterfallStyle:Q,showAxes:F,background:A,hoverAnnotation:B,tooltipContent:X,...cd({linkedHover:D,selection:L,onObservation:E,forceHoverBehavior:!0,mobileInteraction:n.mobileInteraction,customHoverBehavior:V}),annotations:C,autoPlaceAnnotations:P,svgAnnotationRules:R,tickFormatTime:j,tickFormatValue:T,legendPosition:O,pointIdAccessor:e.pointIdAccessor})});Ad.displayName="RealtimeWaterfallChart";var Sd=require("react"),_d=require("react/jsx-runtime"),Md=(0,Sd.forwardRef)(function(e,t){const n=qh(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:r,margin:i,className:o,arrowOfTime:s="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:h,categoryAccessor:d,timeExtent:f,valueExtent:y,extentPadding:p,heatmapXBins:g=20,heatmapYBins:m=20,aggregation:x="count",background:v,tooltipContent:b,tooltip:k,onHover:w,annotations:A,autoPlaceAnnotations:S,svgAnnotationRules:_,tickFormatTime:M,tickFormatValue:C,decay:P,pulse:R,staleness:j,linkedHover:T,selection:D,onObservation:L,chartId:E,loading:N,loadingContent:I,emptyContent:W,emphasis:$,legendPosition:z}=e,O=n.showAxes,F=n.enableHover,B=i??n.marginDefaults,Y=r??[n.width,n.height],H=b??k??function(e={}){const{timeAccessor:t,valueAccessor:n,xLabel:r="x",yLabel:i="y"}=e;return e=>{const o=e?.data??null,s=o?.xCenter??Kh(o,t,"time"),a=o?.yCenter??Kh(o,n,"value"),l=o?.count,c=o?.sum,u=o?.value,h=o?.agg??"count";return(0,Gh.jsxs)("div",{className:"semiotic-tooltip",style:Vh,children:[(0,Gh.jsxs)("div",{children:[(0,Gh.jsxs)("span",{style:Uh,children:[r,":"]}),Qh(s)]}),(0,Gh.jsxs)("div",{children:[(0,Gh.jsxs)("span",{style:Uh,children:[i,":"]}),Qh(a)]}),null!=l&&(0,Gh.jsxs)("div",{children:[(0,Gh.jsx)("span",{style:Uh,children:"count:"}),Qh(l)]}),"sum"===h&&null!=c&&(0,Gh.jsxs)("div",{children:[(0,Gh.jsx)("span",{style:Uh,children:"sum:"}),Qh(c)]}),"mean"===h&&null!=u&&(0,Gh.jsxs)("div",{children:[(0,Gh.jsx)("span",{style:Uh,children:"mean:"}),Qh(u)]})]})}}({timeAccessor:u,valueAccessor:h}),X=(0,Sd.useRef)(null),{customHoverBehavior:q}=Xh({selection:D,linkedHover:T,unwrapData:!0,onObservation:L,chartType:"RealtimeHeatmap",chartId:E}),G=(0,Sd.useCallback)(e=>{w&&w(e),q(e)},[w,q]);(0,Sd.useImperativeHandle)(t,()=>({push:e=>X.current?.push(e),pushMany:e=>X.current?.pushMany(e),remove:e=>X.current?.remove(e)??[],update:(e,t)=>X.current?.update(e,t)??[],clear:()=>X.current?.clear(),getData:()=>X.current?.getData()??[],getScales:()=>X.current?.getScales()??null}),[]);const V=Nu(N,Y[0],Y[1],I),U=V?null:Eu(c,Y[0],Y[1],W),K=$?`${o||""} semiotic-emphasis-${$}`.trim():o,Q=Jh(l,c);return V||U||(0,_d.jsx)(Sl,{ref:X,chartType:"heatmap",runtimeMode:"streaming",size:Y,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:B,className:K,arrowOfTime:s,windowMode:a,windowSize:Q,data:c,timeAccessor:u,valueAccessor:h,categoryAccessor:d,xExtent:f,yExtent:y,extentPadding:p,heatmapXBins:g,heatmapYBins:m,heatmapAggregation:x,showAxes:O,background:v,hoverAnnotation:F,tooltipContent:H,...cd({linkedHover:T,selection:D,onObservation:L,forceHoverBehavior:!0,mobileInteraction:n.mobileInteraction,customHoverBehavior:G}),annotations:A,autoPlaceAnnotations:S,svgAnnotationRules:_,tickFormatTime:M,tickFormatValue:C,decay:P,pulse:R,staleness:j,legendPosition:z,pointIdAccessor:e.pointIdAccessor})});Md.displayName="RealtimeHeatmap";
1
+ "use client";
2
+ module.exports=require("./semiotic-client-cjs-shared.min.js").realtimeCore;