semiotic 3.8.0 → 3.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (331) hide show
  1. package/CLAUDE.md +14 -9
  2. package/README.md +56 -55
  3. package/ai/behaviorContracts.cjs +9 -0
  4. package/ai/dist/mcp-server.js +240 -30
  5. package/ai/schema.json +616 -42
  6. package/ai/surface-manifest.json +3 -2
  7. package/ai/system-prompt.md +7 -3
  8. package/dist/__tests__/scenarios/mcpProtocolTypes.d.ts +20 -0
  9. package/dist/chunk-OrdinalBrushOverlay-PXHQYDB2.module.min.js +2 -0
  10. package/dist/chunk-XYBrushOverlay-ECZJJLAJ.module.min.js +1 -0
  11. package/dist/chunk-XYBrushOverlay-EP2SV3UI.module.min.js +2 -0
  12. package/dist/chunk-chunk-255KDHW5.module.min.js +1 -0
  13. package/dist/chunk-chunk-27HVVXS6.module.min.js +1 -0
  14. package/dist/chunk-chunk-2CXCXRB4.module.min.js +1 -0
  15. package/dist/chunk-chunk-2JGJ5GUG.module.min.js +2 -0
  16. package/dist/chunk-chunk-2UN3ANRN.module.min.js +2 -0
  17. package/dist/chunk-chunk-2VUEY5TH.module.min.js +1 -0
  18. package/dist/chunk-chunk-2WVCH4PL.module.min.js +1 -0
  19. package/dist/chunk-chunk-5UKL5W76.module.min.js +2 -0
  20. package/dist/chunk-chunk-5WEFWNUW.module.min.js +2 -0
  21. package/dist/chunk-chunk-6F6GEAQU.module.min.js +1 -0
  22. package/dist/chunk-chunk-7LHMKRKE.module.min.js +2 -0
  23. package/dist/chunk-chunk-BHYTYMY2.module.min.js +2 -0
  24. package/dist/chunk-chunk-C6EJ4IOD.module.min.js +2 -0
  25. package/dist/chunk-chunk-CA3YDW6F.module.min.js +1 -0
  26. package/dist/chunk-chunk-CP3EN6KZ.module.min.js +1 -0
  27. package/dist/chunk-chunk-CYIML3AV.module.min.js +2 -0
  28. package/dist/chunk-chunk-DNY43POY.module.min.js +1 -0
  29. package/dist/chunk-chunk-DSNGDNJY.module.min.js +1 -0
  30. package/dist/chunk-chunk-E7MIQX7D.module.min.js +2 -0
  31. package/dist/chunk-chunk-EMO5NUGE.module.min.js +1 -0
  32. package/dist/chunk-chunk-ES4DCG3L.module.min.js +1 -0
  33. package/dist/chunk-chunk-FAKO3RGQ.module.min.js +2 -0
  34. package/dist/chunk-chunk-FYY2ACNJ.module.min.js +2 -0
  35. package/dist/chunk-chunk-G7WFWHAD.module.min.js +2 -0
  36. package/dist/chunk-chunk-GMQ5AYTD.module.min.js +1 -0
  37. package/dist/chunk-chunk-H4PPRW6N.module.min.js +1 -0
  38. package/dist/chunk-chunk-IFYPMWKY.module.min.js +1 -0
  39. package/dist/chunk-chunk-J3ELI22J.module.min.js +1 -0
  40. package/dist/chunk-chunk-J3QOW4OE.module.min.js +0 -0
  41. package/dist/chunk-chunk-J3XWETBJ.module.min.js +2 -0
  42. package/dist/chunk-chunk-JCG72SGW.module.min.js +2 -0
  43. package/dist/{semiotic-ai-chunk-OG7BQUUW.module.min.js → chunk-chunk-JJ2OOIET.module.min.js} +0 -1
  44. package/dist/chunk-chunk-KTWEBFMX.module.min.js +2 -0
  45. package/dist/chunk-chunk-L6D3I3V7.module.min.js +2 -0
  46. package/dist/chunk-chunk-M337NY6L.module.min.js +1 -0
  47. package/dist/chunk-chunk-NO4MCQVD.module.min.js +1 -0
  48. package/dist/chunk-chunk-ODUZEEBH.module.min.js +2 -0
  49. package/dist/chunk-chunk-P6UBCMSQ.module.min.js +2 -0
  50. package/dist/chunk-chunk-Q2YADC2V.module.min.js +2 -0
  51. package/dist/chunk-chunk-QRIBHZYW.module.min.js +1 -0
  52. package/dist/chunk-chunk-QSQVBIJA.module.min.js +1 -0
  53. package/dist/chunk-chunk-RCF52Z42.module.min.js +2 -0
  54. package/dist/chunk-chunk-RH5TSQPH.module.min.js +1 -0
  55. package/dist/chunk-chunk-ROP4HI7H.module.min.js +2 -0
  56. package/dist/chunk-chunk-RZH7VZYS.module.min.js +2 -0
  57. package/dist/chunk-chunk-SIRIJ3DY.module.min.js +1 -0
  58. package/dist/chunk-chunk-STZFFTAN.module.min.js +2 -0
  59. package/dist/chunk-chunk-SV4XAZ3Q.module.min.js +1 -0
  60. package/dist/chunk-chunk-T27ZEV6A.module.min.js +1 -0
  61. package/dist/chunk-chunk-U3AGQ5EF.module.min.js +2 -0
  62. package/dist/chunk-chunk-U66USBWU.module.min.js +1 -0
  63. package/dist/chunk-chunk-VVCA3DB7.module.min.js +1 -0
  64. package/dist/chunk-chunk-W3DB2MN4.module.min.js +2 -0
  65. package/dist/chunk-chunk-WCX6U47H.module.min.js +2 -0
  66. package/dist/chunk-chunk-WDIN4LRC.module.min.js +1 -0
  67. package/dist/chunk-chunk-XEVJDUTH.module.min.js +1 -0
  68. package/dist/chunk-chunk-XOYX77KF.module.min.js +2 -0
  69. package/dist/chunk-chunk-YCQYG6J5.module.min.js +2 -0
  70. package/dist/chunk-chunk-YHNZCPOZ.module.min.js +2 -0
  71. package/dist/chunk-chunk-YWZB3KPI.module.min.js +2 -0
  72. package/dist/chunk-chunk-Z5KXAVQD.module.min.js +2 -0
  73. package/dist/chunk-chunk-ZCNBUZPL.module.min.js +2 -0
  74. package/dist/chunk-chunk-ZLKRTF5N.module.min.js +2 -0
  75. package/dist/chunk-chunk-ZTNVDWAK.module.min.js +2 -0
  76. package/dist/chunk-statisticalOverlays-6MVAK5RW.module.min.js +2 -0
  77. package/dist/components/AccessibleNavTree.d.ts +7 -1
  78. package/dist/components/ai/chartClinicMetadata.generated.d.ts +15 -0
  79. package/dist/components/ai/useNavigationSync.d.ts +17 -2
  80. package/dist/components/chartContainerMobile.d.ts +9 -0
  81. package/dist/components/charts/geo/ChoroplethMap.d.ts +19 -2
  82. package/dist/components/charts/geo/DistanceCartogram.d.ts +14 -2
  83. package/dist/components/charts/geo/FlowMap.d.ts +10 -6
  84. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +14 -2
  85. package/dist/components/charts/index.d.ts +6 -0
  86. package/dist/components/charts/network/ChordDiagram.d.ts +9 -1
  87. package/dist/components/charts/network/ForceDirectedGraph.d.ts +11 -0
  88. package/dist/components/charts/network/SankeyDiagram.d.ts +9 -1
  89. package/dist/components/charts/ordinal/BarChart.d.ts +21 -0
  90. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +11 -0
  91. package/dist/components/charts/ordinal/StackedBarChart.d.ts +11 -0
  92. package/dist/components/charts/physics/CollisionSwarmChart.d.ts +7 -0
  93. package/dist/components/charts/physics/EventDropChart.d.ts +7 -0
  94. package/dist/components/charts/physics/GaltonBoardChart.d.ts +8 -0
  95. package/dist/components/charts/physics/PhysicalFlowChart.d.ts +7 -0
  96. package/dist/components/charts/physics/PhysicsCustomChart.d.ts +4 -25
  97. package/dist/components/charts/physics/PhysicsPileChart.d.ts +7 -0
  98. package/dist/components/charts/physics/physicsChartShared.d.ts +17 -1
  99. package/dist/components/charts/physics/physicsCustomLayout.d.ts +32 -0
  100. package/dist/components/charts/shared/AnnotationLabel.d.ts +88 -0
  101. package/dist/components/charts/shared/annotationActivation.d.ts +35 -0
  102. package/dist/components/charts/shared/annotationLabelLayout.d.ts +5 -0
  103. package/dist/components/charts/shared/annotationRules.d.ts +2 -1
  104. package/dist/components/charts/shared/auditAccessibilityText.d.ts +13 -0
  105. package/dist/components/charts/shared/chartSelectionUtils.d.ts +4 -0
  106. package/dist/components/charts/shared/chartSpecCore.d.ts +3 -3
  107. package/dist/components/charts/shared/datumTypes.d.ts +2 -0
  108. package/dist/components/charts/shared/diagnoseAnnotationChecks.d.ts +2 -0
  109. package/dist/components/charts/shared/formatUtils.d.ts +3 -3
  110. package/dist/components/charts/shared/hatchFill.d.ts +87 -0
  111. package/dist/components/charts/shared/hooks.d.ts +7 -6
  112. package/dist/components/charts/shared/knownChartComponents.d.ts +9 -0
  113. package/dist/components/charts/shared/leastSquaresRegression.d.ts +16 -0
  114. package/dist/components/charts/shared/mergeShapeStyle.d.ts +3 -2
  115. package/dist/components/charts/shared/semanticInteractions.d.ts +42 -0
  116. package/dist/components/charts/shared/sparseArray.d.ts +1 -1
  117. package/dist/components/charts/shared/streamPropsHelpers.d.ts +6 -4
  118. package/dist/components/charts/shared/styleRules.d.ts +205 -0
  119. package/dist/components/charts/shared/tooltipUtils.d.ts +22 -9
  120. package/dist/components/charts/shared/types.d.ts +9 -6
  121. package/dist/components/charts/shared/useAreaSeriesSetup.d.ts +16 -2
  122. package/dist/components/charts/shared/useChartSetup.d.ts +2 -2
  123. package/dist/components/charts/shared/useCustomChartSetup.d.ts +3 -0
  124. package/dist/components/charts/shared/useFrameImperativeHandle.d.ts +1 -2
  125. package/dist/components/charts/shared/useLikertAggregation.d.ts +4 -4
  126. package/dist/components/charts/shared/useOrdinalBrush.d.ts +2 -1
  127. package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +24 -1
  128. package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
  129. package/dist/components/charts/shared/useXYLineStyle.d.ts +10 -0
  130. package/dist/components/charts/shared/useXYPointStyle.d.ts +19 -1
  131. package/dist/components/charts/shared/validateChartData.d.ts +7 -5
  132. package/dist/components/charts/shared/validationMap.d.ts +11 -2
  133. package/dist/components/charts/shared/validationMap.generated.d.ts +6 -0
  134. package/dist/components/charts/shared/withChartWrapper.d.ts +4 -3
  135. package/dist/components/charts/value/targetPresentation.d.ts +22 -0
  136. package/dist/components/charts/value/types.d.ts +5 -6
  137. package/dist/components/charts/xy/AreaChart.d.ts +8 -0
  138. package/dist/components/charts/xy/BubbleChart.d.ts +9 -0
  139. package/dist/components/charts/xy/ConnectedScatterplot.d.ts +7 -0
  140. package/dist/components/charts/xy/DifferenceChart.d.ts +1 -52
  141. package/dist/components/charts/xy/Heatmap.d.ts +2 -2
  142. package/dist/components/charts/xy/LineChart.d.ts +11 -0
  143. package/dist/components/charts/xy/QuadrantChart.d.ts +7 -0
  144. package/dist/components/charts/xy/Scatterplot.d.ts +10 -0
  145. package/dist/components/charts/xy/StackedAreaChart.d.ts +7 -0
  146. package/dist/components/charts/xy/differenceSegments.d.ts +49 -0
  147. package/dist/components/charts/xy/scatterplotMatrixInteractionTypes.d.ts +12 -0
  148. package/dist/components/controls/SentenceFilter.d.ts +97 -0
  149. package/dist/components/data/fromVegaLite.d.ts +19 -9
  150. package/dist/components/rough/createRoughRenderMode.d.ts +46 -0
  151. package/dist/components/semiotic-ai.d.ts +3 -1
  152. package/dist/components/semiotic-controls.d.ts +2 -0
  153. package/dist/components/semiotic-geo.d.ts +4 -0
  154. package/dist/components/semiotic-network.d.ts +4 -0
  155. package/dist/components/semiotic-ordinal.d.ts +6 -0
  156. package/dist/components/semiotic-physics.d.ts +4 -0
  157. package/dist/components/semiotic-rough.d.ts +4 -0
  158. package/dist/components/semiotic-utils-core.d.ts +4 -0
  159. package/dist/components/semiotic-xy.d.ts +4 -0
  160. package/dist/components/semiotic.d.ts +9 -1
  161. package/dist/components/server/optionalImageTypes.d.ts +37 -0
  162. package/dist/components/server/serverChartConfigShared.d.ts +9 -5
  163. package/dist/components/server/serverChartConfigs.d.ts +4 -4
  164. package/dist/components/server/staticAnnotations.d.ts +6 -3
  165. package/dist/components/server/staticLegend.d.ts +1 -1
  166. package/dist/components/server/staticNetwork.d.ts +4 -4
  167. package/dist/components/server/staticSVGChrome.d.ts +5 -4
  168. package/dist/components/store/ObservationStore.d.ts +21 -1
  169. package/dist/components/stream/AccessibleDataTable.d.ts +4 -10
  170. package/dist/components/stream/AriaLiveTooltip.d.ts +9 -0
  171. package/dist/components/stream/CanvasHitTester.d.ts +4 -4
  172. package/dist/components/stream/DataSourceAdapter.d.ts +1 -1
  173. package/dist/components/stream/FrameRuntime.d.ts +57 -0
  174. package/dist/components/stream/GeoParticlePool.d.ts +1 -1
  175. package/dist/components/stream/GeoPipelineStore.d.ts +43 -12
  176. package/dist/components/stream/GeoSVGOverlay.d.ts +64 -0
  177. package/dist/components/stream/NetworkCanvasHitTester.d.ts +2 -1
  178. package/dist/components/stream/NetworkPipelineStore.d.ts +24 -21
  179. package/dist/components/stream/NetworkSSRFrame.d.ts +17 -0
  180. package/dist/components/stream/NetworkSVGOverlay.d.ts +6 -0
  181. package/dist/components/stream/OrdinalBrushOverlay.d.ts +1 -2
  182. package/dist/components/stream/OrdinalBrushOverlayLazy.d.ts +9 -0
  183. package/dist/components/stream/OrdinalCanvasHitTester.d.ts +2 -2
  184. package/dist/components/stream/OrdinalPipelineStore.d.ts +13 -13
  185. package/dist/components/stream/OrdinalSVGOverlay.d.ts +9 -1
  186. package/dist/components/stream/OrdinalStyleResolver.d.ts +12 -0
  187. package/dist/components/stream/ParticlePool.d.ts +1 -1
  188. package/dist/components/stream/PipelineStore.d.ts +12 -16
  189. package/dist/components/stream/SVGOverlay.d.ts +6 -0
  190. package/dist/components/stream/SceneGraph.d.ts +3 -3
  191. package/dist/components/stream/XYBrushOverlayLazy.d.ts +17 -0
  192. package/dist/components/stream/accessorUtils.d.ts +2 -2
  193. package/dist/components/stream/annotationAccessorResolver.d.ts +2 -2
  194. package/dist/components/stream/frameGraphics.d.ts +4 -0
  195. package/dist/components/stream/frameKeyboardNavigation.d.ts +45 -0
  196. package/dist/components/stream/geoPipelineHelpers.d.ts +3 -3
  197. package/dist/components/stream/geoPipelineUpdateResults.d.ts +34 -0
  198. package/dist/components/stream/geoSceneBuilder.d.ts +16 -0
  199. package/dist/components/stream/geoTypes.d.ts +48 -15
  200. package/dist/components/stream/hitTestUtils.d.ts +2 -2
  201. package/dist/components/stream/hoverUtils.d.ts +4 -2
  202. package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +1 -0
  203. package/dist/components/stream/layouts/hierarchyUtils.d.ts +2 -2
  204. package/dist/components/stream/networkCustomLayoutRunner.d.ts +23 -0
  205. package/dist/components/stream/networkCustomRestyle.d.ts +15 -0
  206. package/dist/components/stream/networkFrameAnimation.d.ts +7 -0
  207. package/dist/components/stream/networkFrameHandleTypes.d.ts +39 -0
  208. package/dist/components/stream/networkFrameObservations.d.ts +15 -0
  209. package/dist/components/stream/networkFramePaint.d.ts +11 -2
  210. package/dist/components/stream/networkInteractionTypes.d.ts +26 -0
  211. package/dist/components/stream/networkPipelineConfig.d.ts +2 -2
  212. package/dist/components/stream/networkPipelineUpdateResults.d.ts +38 -0
  213. package/dist/components/stream/networkTypes.d.ts +37 -56
  214. package/dist/components/stream/ordinalCanvasRenderers.d.ts +2 -2
  215. package/dist/components/stream/ordinalPipelineUpdateResults.d.ts +20 -1
  216. package/dist/components/stream/ordinalSceneBuilders/types.d.ts +2 -2
  217. package/dist/components/stream/ordinalTypes.d.ts +30 -3
  218. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +2 -0
  219. package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +6 -0
  220. package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +21 -6
  221. package/dist/components/stream/physics/physicsFrameObservations.d.ts +19 -0
  222. package/dist/components/stream/physics/physicsFrameSetup.d.ts +4 -0
  223. package/dist/components/stream/physics/physicsPipelineUpdateResults.d.ts +19 -1
  224. package/dist/components/stream/physics/usePhysicsFrameLifecyclePolicy.d.ts +3 -1
  225. package/dist/components/stream/pipelineConfig.d.ts +4 -2
  226. package/dist/components/stream/pipelineDecay.d.ts +2 -2
  227. package/dist/components/stream/pipelinePulse.d.ts +2 -2
  228. package/dist/components/stream/pipelineStoreUpdateResults.d.ts +23 -2
  229. package/dist/components/stream/pipelineTransitions.d.ts +1 -1
  230. package/dist/components/stream/pipelineUpdateContract.d.ts +7 -0
  231. package/dist/components/stream/pipelineUpdateStore.d.ts +21 -0
  232. package/dist/components/stream/renderBackend.d.ts +27 -0
  233. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +15 -1
  234. package/dist/components/stream/renderers/geoCanvasRenderer.d.ts +3 -2
  235. package/dist/components/stream/renderers/networkParticleRenderer.d.ts +1 -1
  236. package/dist/components/stream/sceneRenderBackendTypes.d.ts +28 -0
  237. package/dist/components/stream/sceneRevisionDiagnostics.d.ts +31 -4
  238. package/dist/components/stream/streamSemanticTypes.d.ts +16 -0
  239. package/dist/components/stream/streamThemeTypes.d.ts +14 -0
  240. package/dist/components/stream/svgOverlayUtils.d.ts +10 -0
  241. package/dist/components/stream/test-utils/frameScheduler.d.ts +12 -0
  242. package/dist/components/stream/test-utils/revisionConsumption.d.ts +13 -0
  243. package/dist/components/stream/titleLayout.d.ts +31 -0
  244. package/dist/components/stream/types.d.ts +30 -65
  245. package/dist/components/stream/useCanvasFrameHost.d.ts +71 -0
  246. package/dist/components/stream/useFrame.d.ts +23 -0
  247. package/dist/components/stream/useLegendCategoryEmission.d.ts +3 -3
  248. package/dist/components/stream/useSemanticFrameInteractions.d.ts +22 -0
  249. package/dist/components/stream/useUpdateResultSnapshot.d.ts +7 -0
  250. package/dist/components/stream/xyFrameAxisTypes.d.ts +50 -0
  251. package/dist/components/stream/xySceneBuilders/types.d.ts +6 -5
  252. package/dist/controls.min.js +1 -1
  253. package/dist/controls.module.min.js +1 -1
  254. package/dist/forceLayoutWorker.js +1 -1
  255. package/dist/geo.min.js +1 -1
  256. package/dist/geo.module.min.js +1 -1
  257. package/dist/network.min.js +1 -1
  258. package/dist/network.module.min.js +1 -1
  259. package/dist/ordinal.min.js +1 -1
  260. package/dist/ordinal.module.min.js +1 -1
  261. package/dist/physics-matter.min.js +1 -1
  262. package/dist/physics-matter.module.min.js +1 -1
  263. package/dist/physics-rapier.min.js +1 -1
  264. package/dist/physics-rapier.module.min.js +1 -1
  265. package/dist/physics.min.js +1 -1
  266. package/dist/physics.module.min.js +1 -1
  267. package/dist/physicsWorker.js +1 -1
  268. package/dist/realtime.min.js +1 -1
  269. package/dist/realtime.module.min.js +1 -1
  270. package/dist/rough.min.js +1 -0
  271. package/dist/rough.module.min.js +1 -0
  272. package/dist/semiotic-ai-core.min.js +1 -1
  273. package/dist/semiotic-ai-core.module.min.js +1 -1
  274. package/dist/semiotic-ai.d.ts +3 -1
  275. package/dist/semiotic-ai.min.js +1 -1
  276. package/dist/semiotic-ai.module.min.js +1 -1
  277. package/dist/semiotic-controls.d.ts +2 -0
  278. package/dist/semiotic-data.min.js +1 -1
  279. package/dist/semiotic-data.module.min.js +1 -1
  280. package/dist/semiotic-experimental.min.js +1 -1
  281. package/dist/semiotic-experimental.module.min.js +1 -1
  282. package/dist/semiotic-geo.d.ts +4 -0
  283. package/dist/semiotic-network.d.ts +4 -0
  284. package/dist/semiotic-ordinal.d.ts +6 -0
  285. package/dist/semiotic-physics.d.ts +4 -0
  286. package/dist/semiotic-realtime-core.min.js +1 -1
  287. package/dist/semiotic-realtime-core.module.min.js +1 -1
  288. package/dist/semiotic-realtime-react.min.js +1 -1
  289. package/dist/semiotic-realtime-react.module.min.js +1 -1
  290. package/dist/semiotic-recipes-core.min.js +1 -1
  291. package/dist/semiotic-recipes-core.module.min.js +1 -1
  292. package/dist/semiotic-recipes-react.min.js +1 -1
  293. package/dist/semiotic-recipes-react.module.min.js +1 -1
  294. package/dist/semiotic-recipes.min.js +1 -1
  295. package/dist/semiotic-recipes.module.min.js +1 -1
  296. package/dist/semiotic-rough.d.ts +4 -0
  297. package/dist/semiotic-server-edge.min.js +1 -1
  298. package/dist/semiotic-server-edge.module.min.js +1 -1
  299. package/dist/semiotic-server-node.min.js +1 -1
  300. package/dist/semiotic-server-node.module.min.js +1 -1
  301. package/dist/semiotic-themes-core.min.js +1 -1
  302. package/dist/semiotic-themes-core.module.min.js +1 -1
  303. package/dist/semiotic-themes-react.min.js +1 -1
  304. package/dist/semiotic-themes-react.module.min.js +1 -1
  305. package/dist/semiotic-themes.min.js +1 -1
  306. package/dist/semiotic-themes.module.min.js +1 -1
  307. package/dist/semiotic-utils-core.d.ts +4 -0
  308. package/dist/semiotic-utils-core.min.js +1 -1
  309. package/dist/semiotic-utils-core.module.min.js +1 -1
  310. package/dist/semiotic-utils-react.min.js +1 -1
  311. package/dist/semiotic-utils-react.module.min.js +1 -1
  312. package/dist/semiotic-utils.min.js +1 -1
  313. package/dist/semiotic-utils.module.min.js +1 -1
  314. package/dist/semiotic-value.min.js +1 -1
  315. package/dist/semiotic-value.module.min.js +1 -1
  316. package/dist/semiotic-xy.d.ts +4 -0
  317. package/dist/semiotic.d.ts +9 -1
  318. package/dist/semiotic.min.js +1 -1
  319. package/dist/semiotic.module.min.js +1 -1
  320. package/dist/server.min.js +1 -1
  321. package/dist/server.module.min.js +1 -1
  322. package/dist/test-utils/capturedFrameProps.d.ts +67 -0
  323. package/dist/test-utils/frameMock.d.ts +12 -9
  324. package/dist/xy.min.js +1 -1
  325. package/dist/xy.module.min.js +1 -1
  326. package/package.json +29 -10
  327. package/dist/semiotic-ai-statisticalOverlays-CY4WKR4A.module.min.js +0 -2
  328. package/dist/semiotic-chunk-3FSVZ46U.module.min.js +0 -2
  329. package/dist/semiotic-statisticalOverlays-UOMSFKVJ.module.min.js +0 -2
  330. package/dist/xy-chunk-IWD6IB6V.module.min.js +0 -2
  331. package/dist/xy-statisticalOverlays-7RWG6LJT.module.min.js +0 -2
@@ -0,0 +1 @@
1
+ import{annotationActivationProps as e,defaultTooltipStyle as t,extractAllRows as n}from"./chunk-chunk-255KDHW5.module.min.js";import{AnnotationLabel as r,SemioticAnnotation as i,applyAnnotationEmphasis as o,isGradientLegendConfig as l,isLegendConfig as a,reserveFrameChromeMargin as s,resolveAnimateConfig as c}from"./chunk-chunk-ES4DCG3L.module.min.js";import{useReducedMotion as d}from"./chunk-chunk-XEVJDUTH.module.min.js";import{isHatchFill as u,resolveHatchCanvasPattern as h,resolveSvgFill as f}from"./chunk-chunk-2WVCH4PL.module.min.js";import{FrameRuntime as m,isInBounds as p,resolveAnchoredPosition as g,resolveX as y,resolveY as b}from"./chunk-chunk-NO4MCQVD.module.min.js";import{getMinMax as x}from"./chunk-chunk-JJ2OOIET.module.min.js";import{clearCSSColorCache as v,resolveCSSColor as w}from"./chunk-chunk-QRIBHZYW.module.min.js";import{useThemeSelector as k}from"./chunk-chunk-DSNGDNJY.module.min.js";import{memo as S,useEffect as M,useRef as C}from"react";var $={sceneGeometry:0,layout:0,domain:0};function R(e){const{domain:t,layout:n,sceneGeometry:r}=e.revisions;return{domain:t,layout:n,sceneGeometry:r}}function z(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 j="production"!==process.env.NODE_ENV,D={revisions:$,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},A=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=$,this.lastObserved=$,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){j&&(this.lastObserved=z(this.lastObserved,R(e)))}beforeCompute(e,t){if(!j)return D;const n=z(R(e),this.lastObserved),r=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),i=!((o=n).sceneGeometry===(l=this.lastConsumed).sceneGeometry&&o.layout===l.layout&&o.domain===l.domain);var o,l;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(j){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 I(e){return C(new A(e))}function N(e,t,n,r=!1,i=!1){const o=e.beforeCompute(t.getLastUpdateResult(),r);n(),e.afterCompute(o,!0,i)}var F=S(function({store:e,diagnostics:t}){return M(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null});import{useEffect as W,useLayoutEffect as B,useRef as E,useState as O,useSyncExternalStore as G}from"react";var H="undefined"!=typeof window?B:W;function T(){const[e,t]=O(!1);return H(()=>{t(!0)},[]),e}var L=()=>()=>{},U=()=>!1,q=()=>!0;function P(){const e=G(L,U,q);return E(e).current}import{jsx as V}from"react/jsx-runtime";var Y={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function X({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 V("div",{"aria-live":"polite","aria-atomic":"true",style:Y,children:t})}import*as J from"react";import*as K from"react";import{jsx as Q}from"react/jsx-runtime";var Z=K.createContext(null);function _(){return K.useContext(Z)}import{jsx as ee,jsxs as te}from"react/jsx-runtime";function ne(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"],l=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 l)r.push(`${n[e]} ${i[e]||e}`);return`${t}, ${r.join(", ")}`}function re(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 ie=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},oe="semiotic-accessible-data-table",le=oe+" semiotic-accessible-data-table-hidden",ae=oe+" semiotic-accessible-data-table-visible",se=ae+" semiotic-accessible-data-table-network",ce={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"},de={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},ue={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)"},he={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},fe={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))"},me={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},pe={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},ge={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 ye({scene:e,chartType:t,tableId:r,chartTitle:i}){const[o,l]=J.useState(!1),[a,s]=J.useState(5),c=_(),d=c?.visible??!1,u=o||d,h=J.useRef(null),f=i?"Data summary for "+i:r?`Data summary for ${t} ${r}`:"Data summary for "+t;J.useEffect(()=>{u||s(5)},[u]);const m=J.useCallback(e=>{e.target===e.currentTarget&&(o||d||l(!0))},[o,d]),p=J.useCallback(e=>{d||h.current?.contains(e.relatedTarget)||l(!1)},[d]);if(!e||0===e.length)return r?ee("span",{id:r,tabIndex:-1,style:Y}):null;if(!u)return ee("div",{id:r,className:le,tabIndex:-1,onFocus:m,style:Y,role:"region","aria-label":f,children:te("button",{type:"button",onClick:()=>l(!0),children:["View data summary (",e.length," elements)"]})});const g=n(e),y=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const r of t){const t=[],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}(g),b=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${ie(e.min)} to ${ie(e.max)}, mean ${ie(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(" ")}(g.length,y),x=Math.min(a,g.length),v=g.slice(0,x),w=g.length-x,k=new Set;for(const e of v)for(const t of Object.keys(e.values))k.add(t);const S=Array.from(k);return te("div",{ref:h,id:r,className:ae,tabIndex:-1,onBlur:p,style:ce,role:"region","aria-label":f,children:[ee("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{d&&c&&c.setVisible(!1),l(!1)},"aria-label":"Close data summary",style:ue,children:"×"}),ee("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:de,children:b}),te("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:he,children:[ee("caption",{className:"semiotic-accessible-data-table-caption",style:pe,children:w>0?`First ${x} of ${g.length} data points`:`All ${g.length} data points`}),ee("thead",{children:te("tr",{children:[ee("th",{style:fe,children:"type"}),S.map(e=>ee("th",{style:fe,children:e},e))]})}),ee("tbody",{children:v.map((e,t)=>te("tr",{children:[ee("td",{style:me,children:e.label}),S.map(t=>{return ee("td",{style:me,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":ie(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),w>0&&te("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>s(e=>e+25),style:ge,children:["Show ",Math.min(25,w)," more"," ",1===w?"row":"rows"," (",w," remaining)"]})]})}function be({nodes:e,edges:t,chartType:n,tableId:r,chartTitle:i}){const[o,l]=J.useState(!1),[a,s]=J.useState(5),c=_(),d=c?.visible??!1,u=o||d,h=i?"Data summary for "+i:r?`Data summary for ${n} ${r}`:"Data summary for "+n,f=J.useRef(null);J.useEffect(()=>{u||s(5)},[u]);const m=J.useCallback(e=>{e.target===e.currentTarget&&(o||d||l(!0))},[o,d]),p=J.useCallback(e=>{d||f.current?.contains(e.relatedTarget)||l(!1)},[d]);if(!e||0===e.length)return r?ee("span",{id:r,tabIndex:-1,style:Y}):null;if(!u)return ee("div",{id:r,className:le,tabIndex:-1,onFocus:m,style:Y,role:"region","aria-label":h,children:te("button",{type:"button",onClick:()=>l(!0),children:["View data summary (",e.length," nodes, ",t.length," edges)"]})});const g=Array.isArray(e)?e:[],y=Array.isArray(t)?t:[],b=new Map,x=new Map,v=new Map,w=new Map;for(const e of y){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+"";x.set(e,(x.get(e)??0)+1),w.set(e,(w.get(e)??0)+i)}if(null!=r&&""!==r){const e=r+"";b.set(e,(b.get(e)??0)+1),v.set(e,(v.get(e)??0)+i)}}const k=[];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=b.get(r)??0,o=x.get(r)??0,l=v.get(r)??0,a=w.get(r)??0;k.push({id:r,degree:i+o,inDeg:i,outDeg:o,wDegree:l+a,wInDeg:l,wOutDeg:a})}k.sort((e,t)=>t.degree-e.degree);let S=0,M=0;if(k.length>0){let e=0;for(const t of k)e+=t.degree,t.degree>M&&(M=t.degree);S=e/k.length}const C=y.some(e=>{const t=e?.datum??{source:e?.source,target:e?.target};return"number"==typeof t?.value&&Number.isFinite(t.value)}),$=[`${k.length} nodes, ${y.length} edges.`];k.length>0&&$.push(`Mean degree: ${ie(S)}, max degree: ${M}.`);const R=Math.min(a,k.length),z=k.slice(0,R),j=k.length-R;return te("div",{ref:f,id:r,className:se,tabIndex:-1,onBlur:p,style:ce,role:"region","aria-label":h,children:[ee("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{d&&c&&c.setVisible(!1),l(!1)},"aria-label":"Close data summary",style:ue,children:"×"}),ee("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:de,children:$.join(" ")}),te("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+n,style:he,children:[ee("caption",{className:"semiotic-accessible-data-table-caption",style:pe,children:j>0?`Top ${R} of ${k.length} nodes by degree`:`All ${k.length} nodes by degree`}),ee("thead",{children:te("tr",{children:[ee("th",{style:fe,children:"id"}),ee("th",{style:fe,children:"degree"}),ee("th",{style:fe,children:"in"}),ee("th",{style:fe,children:"out"}),C&&ee("th",{style:fe,children:"w. degree"}),C&&ee("th",{style:fe,children:"w. in"}),C&&ee("th",{style:fe,children:"w. out"})]})}),ee("tbody",{children:z.map((e,t)=>te("tr",{children:[ee("td",{style:me,children:e.id}),ee("td",{style:me,children:e.degree}),ee("td",{style:me,children:e.inDeg}),ee("td",{style:me,children:e.outDeg}),C&&ee("td",{style:me,children:ie(e.wDegree)}),C&&ee("td",{style:me,children:ie(e.wInDeg)}),C&&ee("td",{style:me,children:ie(e.wOutDeg)})]},t))})]}),j>0&&te("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>s(e=>e+25),style:ge,children:["Show ",Math.min(25,j)," more"," ",1===j?"node":"nodes"," (",j," remaining)"]})]})}function xe({summary:e}){return e?ee("div",{role:"note",style:Y,children:e}):null}function ve({tableId:e}){return ee("a",{href:"#"+e,style:Y,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,Y)},children:"Skip to data table"})}import{jsx as we}from"react/jsx-runtime";var ke="var(--semiotic-focus, #005fcc)";function Se({active:e,hoverPoint:t,margin:n,size:r,shape:i="circle",width:o,height:l,pathData:a}){if(!e||!t)return null;const s=t.x+n.left,c=t.y+n.top;let d;if("geoarea"!==i&&"path"!==i||!a)if("rect"===i&&null!=o&&null!=l){const e=Math.max(o,4),t=Math.max(l,4);d=we("rect",{x:s-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:ke,strokeWidth:2,strokeDasharray:"4,2"})}else d=we("circle","wedge"===i?{cx:s,cy:c,r:12,fill:"none",stroke:ke,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:s,cy:c,r:8,fill:"none",stroke:ke,strokeWidth:2,strokeDasharray:"4,2"});else d=we("g",{transform:`translate(${n.left},${n.top})`,children:we("path",{d:a,fill:"none",stroke:ke,strokeWidth:2.5,strokeDasharray:"6,3"})});return we("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:d})}import*as Me from"react";import{jsx as Ce}from"react/jsx-runtime";function $e({x:e,y:n,containerWidth:r,containerHeight:i,margin:o,children:l,className:a="stream-frame-tooltip",zIndex:s=1}){const c=Number.isFinite(e)&&Number.isFinite(n),d=Me.useRef(null),[u,h]=Me.useState(null);Me.useLayoutEffect(()=>{const e=d.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()},[a,r,i,c]);let f;f=u?`translate(${u.width+12>r-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>i-n?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*r?"calc(-100% - 12px)":"12px"}, ${.3*i>n?"4px":"calc(-100% - 4px)"})`;const m=function(e){if(!Me.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}(l),p=m?null:t;return c?Ce("div",{ref:d,className:m?a:(a+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:o.left+e,top:o.top+n,transform:f,pointerEvents:"none",zIndex:s,width:"max-content"},children:l}):null}import*as Re from"react";import{useCallback as ze,useEffect as je,useLayoutEffect as De,useMemo as Ae,useRef as Ie}from"react";import{useRef as Ne,useState as Fe,useEffect as We}from"react";var Be="undefined"==typeof window?je:De,Ee={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function Oe(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Ge(e){const t=d(),n=Ie(t);n.current=t;const[r,i]=function(e,t,n){const r=Ne(null),[i,o]=Fe(null);return We(()=>{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,l=!!e.legend&&"top"===e.legendPosition,a=Ae(()=>s({...e.marginDefault,...e.userMargin},o,l),[e.marginDefault,e.userMargin,o,l]),u=i[0]-a.left-a.right,h=i[1]-a.top-a.bottom,f=Oe(e.foregroundGraphics,i,a),p=Oe(e.backgroundGraphics,i,a),g=k(e=>e.theme),{transition:y,introEnabled:b}=c(e.animate,e.transitionProp),x="semiotic-table-"+Re.useId(),w=Ie(null);if(!w.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;w.current=new m({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const S=w.current;S.configure({clock:e.clock,random:e.random,seed:e.seed});const M=Ie(null),C=Ie(e.frameScheduler??Ee);C.current=e.frameScheduler??Ee;const $=Ie(null),R=Ie(!1),z=Ie(()=>{}),j=ze(()=>{if(null!==M.current||R.current)return;const e=C.current;let t=!1,n=!1;const r=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(R.current=!0),M.current=null,$.current=null;try{z.current()}finally{e&&(R.current=!1)}});n=!0,t||(M.current=r,$.current=e)},[]),D=ze(()=>{null!==M.current&&(($.current??C.current).cancelAnimationFrame(M.current),M.current=null,$.current=null)},[]);Be(()=>{S.setPaused(!0===e.paused)},[S,e.paused]),je(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void S.setVisible(!0);const t=()=>S.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[S,e.suspendWhenHidden]),je(()=>()=>{D()},[D]);const A=Ie(()=>{}),I=Ie(()=>{}),N=Ie(null),F=Ie(null),W=Ie(null),B=ze(()=>{const e=N.current;N.current=null,e&&A.current(e)},[]),E=ze(e=>{if(N.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===F.current){const e=C.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,F.current=null,W.current=null,B()});t||(F.current=n,W.current=e)}},[B]),O=ze(()=>{N.current=null,null!==F.current&&((W.current??C.current).cancelAnimationFrame(F.current),F.current=null,W.current=null),I.current()},[]);je(()=>()=>{N.current=null,null!==F.current&&((W.current??C.current).cancelAnimationFrame(F.current),F.current=null,W.current=null)},[]);const G=e.themeDirtyRef;return Be(()=>{G&&(v(),G.current=!0,j())},[g,j,G]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:r,size:i,margin:a,adjustedWidth:u,adjustedHeight:h,resolvedForeground:f,resolvedBackground:p,currentTheme:g,transition:y,introEnabled:b,tableId:x,frameRuntime:S,rafRef:M,renderFnRef:z,scheduleRender:j,cancelRender:D,hoverHandlerRef:A,hoverLeaveRef:I,onPointerMove:E,onPointerLeave:O}}import{useEffect as He,useRef as Te}from"react";import{jsx as Le}from"react/jsx-runtime";function Ue(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:r,manageFrameRuntime:i,scheduleRender:o}=e,l=Te(null),a=Te(null),s=Te(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:r,dirtyRef:i,renderFnRef:o,cancelRender:l,cleanup:a}=e;H(()=>{t&&n&&r.current?.cancelIntroAnimation?.(),i.current=!0,l?.(),o.current()},[t,n]);const s=E(a);s.current=a,W(()=>()=>s.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),He(()=>{if(!1!==i)return r.subscribe(()=>{r.isActive?(n.current=!0,o()):t()})},[t,n,r,i,o]),He(()=>{!s.current&&(s.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:l,interactionCanvasRef:a}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}function qe({children:e,size:t,margin:n,overflowVisible:r=!1}){return e?Le("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:r?"visible":void 0},children:Le("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}function Pe(e,t,n,r){const i=e.getContext("2d");if(!i)return null;const o=Math.round(t[0]*r),l=Math.round(t[1]*r),a=o/t[0],s=l/t[1],c=t[0]+"px",d=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==d&&(e.style.height=d),e.width===o&&e.height===l||(e.width=o,e.height=l),i.setTransform(a,0,0,s,0,0),i.translate(n.left,n.top),i}function Ve(){if("undefined"==typeof window)return 1;const e=window.devicePixelRatio||1,t=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(e,t))}import*as Ye from"react";import{jsx as Xe,jsxs as Je}from"react/jsx-runtime";function Ke({componentName:e,message:t,diagnosticHint:n,width:r,height:i}){return Xe("div",{role:"alert",style:{width:r,height:Math.max(i,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:Je("div",{style:{textAlign:"center",maxWidth:400},children:[Xe("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),Xe("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&Xe("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}import{jsx as Qe}from"react/jsx-runtime";var Ze=class extends Ye.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:Qe(Ke,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}};import{jsx as _e}from"react/jsx-runtime";function et({componentName:e,width:t,height:n,children:r}){return _e(Ze,{fallback:r=>_e(Ke,{componentName:e,message:r.message,width:t,height:n}),children:r})}"undefined"!=typeof process&&process;var tt={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"},nt={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function rt(e,t,n,r){return!1===r||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?_e("div",{style:{...tt,width:t,height:n},children:r||"No data available"}):null}function it(e,t,n,r){if(!e)return null;if(!1===r)return null;if(null!=r)return _e("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))),l=Math.max(6,Math.floor(n/(2.5*i))),a=Math.floor((n-(i*(o+l)-l))/2);return _e("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)=>_e("div",{className:"semiotic-loading-bar",style:{...nt,position:"absolute",top:a+n*(o+l),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:o,opacity:.5+n%2*.2}},n))})}import{curveMonotoneX as ot,curveMonotoneY as lt,curveCardinal as at,curveCatmullRom as st,curveStep as ct,curveStepBefore as dt,curveStepAfter as ut,curveBasis as ht,curveNatural as ft}from"d3-shape";function mt(e){switch(e){case"monotoneX":return ot;case"monotoneY":return lt;case"cardinal":return at;case"catmullRom":return st;case"step":return ct;case"stepBefore":return dt;case"stepAfter":return ut;case"basis":return ht;case"natural":return ft;default:return null}}function pt(e,t,n){if(null==t)return n;if(u(t)){return h(t,e)||t.background&&w(e,t.background)||n}return"string"!=typeof t?t:w(e,t)||n}function gt(e,t){if(null==t)return;const n=pt(e,t,"");return""===n?void 0:n}function yt(e,t,n,r,i,o,l){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const a=e.createLinearGradient(r,i,o,l);for(const e of n)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:s}=t;if(!Number.isFinite(a)||!Number.isFinite(s))return null;const c=Math.max(0,Math.min(1,a)),d=Math.max(0,Math.min(1,s)),u=e.createLinearGradient(r,i,o,l),[h,f,m]=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,n);return u.addColorStop(0,`rgba(${h},${f},${m},${c})`),u.addColorStop(1,`rgba(${h},${f},${m},${d})`),u}function bt(e,t,n,r,i,o){const l=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>l.length)return null;const a=e.createLinearGradient(n,r,i,o);for(const e of l)a.addColorStop(e.offset,e.color);return a}import*as xt from"react";import{jsx as vt,jsxs as wt}from"react/jsx-runtime";var kt={fill:(e,t)=>vt("rect",{style:e,width:t,height:t}),line:(e,t)=>vt("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function St(e,t,n,r,i){let o;return o="function"==typeof n?n(e):(0,kt[n])(r(e,t),i),o}function Mt({swatchSize:e}){return vt("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 Ct(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var $t=(e,t,n,r,i,o,l,a,s,c,d)=>{const{type:u="fill",styleFn:h,items:f}=e,m=[];let p=0;const g=!(!t&&!n),y="isolate"===c||void 0===c&&null!=i,{swatchSize:b,labelGap:x,rowHeight:v}=d;return f.forEach((e,c)=>{const d=St(e,c,u,h,b),w=Ct(e,r,i),k=i&&i.size>0&&i.has(e.label);m.push(wt("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===l?0:-1:void 0,role:g?"option":void 0,"aria-selected":g&&y?k||!1:void 0,"aria-current":g&&!y&&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;s(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:g?t=>{s(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:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[g&&vt("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+x+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),d,k&&vt(Mt,{swatchSize:b}),vt("text",{y:b/2,x:b+x,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),p+=v}),m};function Rt({config:e,orientation:t="vertical",width:n=100}){const{colorFn:r,domain:i,label:o,format:l}=e,a=l||(e=>Math.round(100*e)/100+""),s="grad-legend-"+xt.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),l=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(vt("stop",{offset:100*t+"%",stopColor:r(i[0]+t*(i[1]-i[0]))},e))}return wt("g",{"aria-label":o||"Gradient legend",children:[vt("defs",{children:vt("linearGradient",{id:s,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),o&&vt("text",{x:l+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:o}),vt("rect",{x:l,y:0,width:t,height:e,fill:`url(#${s})`,rx:2}),vt("text",{x:l,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(i[0])}),vt("text",{x:l+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(vt("stop",{offset:100*t+"%",stopColor:r(i[1]-t*(i[1]-i[0]))},e))}return wt("g",{"aria-label":o||"Gradient legend",children:[o&&vt("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:o}),vt("defs",{children:vt("linearGradient",{id:s,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),vt("rect",{x:0,y:0,width:14,height:100,fill:`url(#${s})`,rx:2}),vt("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(i[1])}),vt("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(i[0])})]})}function zt(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:o,legendInteraction:l,title:a="Legend",width:s=100,height:c=20,orientation:d="vertical",legendLayout:u}=e,h=function(e){const t=Math.max(1,e?.swatchSize??16),n=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(u),[f,m]=xt.useState(0),[p,g]=xt.useState(0),y=xt.useCallback((e,t)=>{m(e),g(t)},[]),b="vertical"===d?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:o,focusedGroupIndex:l,focusedItemIndex:a,onFocusedIndexChange:s,legendInteraction:c,metrics:d})=>{let u=24;const h=[];return e.forEach((e,f)=>{u+=5,h.push(vt("line",{stroke:"gray",x1:0,y1:u,x2:t,y2:u},"legend-top-line legend-symbol-"+f)),u+=8,e.label&&(u+=16,h.push(vt("text",{y:u,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),u+=8),h.push(vt("g",{className:"legend-item",transform:`translate(0,${u})`,children:$t(e,n,r,i,o,l,a,f,s,c,d)},"legend-group-"+f)),u+=e.items.length*d.rowHeight+8}),h})({legendGroups:t||[],width:s,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:o,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:y,legendInteraction:l,metrics:h}):(({legendGroups:e,height:t,width:n,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:o,isolatedCategories:l,focusedGroupIndex:a,focusedItemIndex:s,onFocusedIndexChange:c,legendInteraction:d,metrics:u})=>{let h=0;const f=[];e.forEach((e,t)=>{let m=0;e.label&&(m+=16);const p=((e,t,n,r,i,o,l,a,s,c,d,u)=>{const{type:h="fill",styleFn:f,items:m}=e,p=[],{swatchSize:g,labelGap:y,itemGap:b,rowHeight:x,align:v}=d,w=!(!t&&!n),k="isolate"===c||void 0===c&&null!=i,S=m.map(e=>g+y+7*e.label.length),M=[];let C=0,$=0;S.forEach((e,t)=>{const n=0===$?e:$+b+e;u&&u>0&&$>0&&n>u?(M.push({start:C,end:t,width:$}),C=t,$=e):$=n}),m.length>0&&M.push({start:C,end:m.length,width:$}),M.forEach((e,c)=>{let d="center"===v?Math.max(0,((u??e.width)-e.width)/2):"end"===v?Math.max(0,(u??e.width)-e.width):0;for(let u=e.start;e.end>u;u++){const e=m[u],v=St(e,u,h,f,g),M=Ct(e,r,i),C=i&&i.size>0&&i.has(e.label);p.push(wt("g",{transform:`translate(${d},${c*x})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:w?a===o&&u===l?0:-1:void 0,role:w?"option":void 0,"aria-selected":w&&k?C||!1:void 0,"aria-current":w&&!k&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:w?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(u+("ArrowRight"===n.key?1:-1)+m.length)%m.length;s(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:w?t=>{s(a,u),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:w?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:w?"pointer":"default",opacity:M,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[w&&vt("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:g+y+2+7*e.label.length,height:g+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,C&&vt(Mt,{swatchSize:g}),vt("text",{y:g/2,x:g+y,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+u)),d+=S[u]+b}});const R=Math.max(0,...M.map(e=>e.width)),z=M.length;return{items:p,offset:R,totalRows:z,totalHeight:z*x}})(e,r,i,o,l,a,s,t,c,d,u,u.maxWidth??n);m+=p.offset+5,f.push({label:e.label,...p,offset:m,totalRows:p.totalRows,totalHeight:p.totalHeight}),h+=m+12});const m=u.maxWidth??n;let p=h>m?0:"center"===u.align?Math.max(0,(m-h)/2):"end"===u.align?Math.max(0,m-h):0;const g=[];return f.forEach((n,r)=>{const i=e[r];i.label&&(g.push(vt("text",{transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:i.label},"legend-text-"+r)),p+=16),g.push(vt("g",{className:"legend-item",transform:`translate(${p},0)`,children:n.items},"legend-group-"+r)),p+=n.offset+5,e[r+1]&&g.push(vt("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+r)),p+=12}),vt("g",{children:g})})({legendGroups:t||[],title:a,height:c,width:s,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:o,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:y,legendInteraction:l,metrics:h}),x=!(!n&&!r);return wt("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==l&&(void 0!==l||null==o))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===d&&vt("text",{className:"legend-title",y:16,x:s/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),b]})}import{jsx as jt}from"react/jsx-runtime";function Dt(e){const{legend:t,totalWidth:n,totalHeight:r,margin:i,legendPosition:o="right",legendLayout:s,title:c,legendHoverBehavior:d,legendClickBehavior:u,legendHighlightedCategory:h,legendIsolatedCategories:f,legendInteraction:m}=e;if(!t)return null;const p="top"===o||"bottom"===o,g=!!c,y=Math.max(0,n-i.left-i.right),b=Math.max(1,p?s?.maxWidth??y:100);let x,v;return"left"===o?(x=Math.max(4,i.left-b-10),v=i.top):"top"===o?(x=i.left,v=g?32:8):"bottom"===o?(x=i.left,v=r-i.bottom+38):(x=n-i.right+10,v=i.top),jt("g",{transform:`translate(${x}, ${v})`,children:l(t)?jt(Rt,{config:t.gradient,orientation:p?"horizontal":"vertical",width:b}):a(t)?jt(zt,{legendGroups:t.legendGroups,title:"",width:b,orientation:p?"horizontal":"vertical",legendLayout:s,customHoverBehavior:d,customClickBehavior:u,highlightedCategory:h,isolatedCategories:f,legendInteraction:m}):t})}import*as At from"react";import{packEnclose as It}from"d3-hierarchy";import{area as Nt,curveLinear as Ft,curveMonotoneX as Wt,curveMonotoneY as Bt,curveStep as Et,curveStepAfter as Ot,curveStepBefore as Gt,curveBasis as Ht,curveCardinal as Tt,curveCatmullRom as Lt}from"d3-shape";function Ut(e){return Math.round(100*e)/100}function qt(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 l=[];for(let n=0;i>n;n++){let r=0;for(const[i,o]of e)null!==o&&(r+=i**(t+n));l.push(r)}r.push(l)}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(Ut);return{points:e.map(([e])=>[Ut(e),Ut(o.reduce((t,n,r)=>t+n*e**r,0))]),equation:[...o].reverse()}}import{jsx as Pt,jsxs as Vt}from"react/jsx-runtime";var Yt={linear:Ft,monotoneX:Wt,monotoneY:Bt,step:Et,stepAfter:Ot,stepBefore:Gt,basis:Ht,cardinal:Tt,catmullRom:Lt};function Xt(e,t,n,r){const i=[];return e.forEach((e,o)=>{let l;if(n){const i=n(e,o,r);l=null!=i?i:t(e,o,r)}else l=t(e,o,r);l&&i.push({node:l,annotation:e})}),o(i)}function Jt(t,n={}){return function(t,o,l){switch(t.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const e=g(t,o,l);if(!e)return null;const{x:n,y:r}=e;if(!p(n,r,l))return null;const a="callout"===t.type?"callout-circle":t.type,s="callout-circle"===a?{radius:t.radius??12,radiusPadding:t.radiusPadding}:"callout-rect"===a?{width:t.width,height:t.height}:void 0;return Pt(i,{noteData:{x:n,y:r,dx:t.dx??30,dy:t.dy??-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:a,...s?{subject:s}:{},connector:t.connector||{end:"arrow"},color:t.color,disable:t.disable,opacity:t.opacity,strokeDasharray:t.strokeDasharray,className:t.className}},"ann-"+o)}case"x-threshold":{const e=y(null!=t.value?{...t,x:t.value}:t,l);if(null==e)return null;const n=t.color||"#f97316",i=t.labelPosition||"top";let a;a="bottom"===i?(l.height||0)-4:"center"===i?(l.height||0)/2:16;const s=e>.6*(l.width||0),c=s?e-4:e+4,d=s?"end":"start";return Vt("g",{opacity:t.opacity,children:[Pt("line",{x1:e,y1:0,x2:e,y2:l.height||0,stroke:n,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&Pt(r,{x:c,y:a,text:t.label,textAnchor:d,fill:n,fontSize:12,fontWeight:"bold",background:t.labelBackground??"halo"})]},"ann-"+o)}case"y-threshold":{const e=b(null!=t.value?{...t,y:t.value}:t,l);if(null==e)return null;const n=t.color||"#f97316",i=t.labelPosition||"right";let a,s;"left"===i?(a=4,s="start"):"center"===i?(a=(l.width||0)/2,s="middle"):(a=(l.width||0)-4,s="end");const d=20>(c=e)?Math.min((l.height||0)-4,c+16):c-4;return Vt("g",{opacity:t.opacity,children:[Pt("line",{x1:0,y1:e,x2:l.width||0,y2:e,stroke:n,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&Pt(r,{x:a,y:d,text:t.label,textAnchor:s,fill:n,fontSize:12,fontWeight:"bold",background:t.labelBackground??"halo"})]},"ann-"+o)}case"enclose":{const e=(t.coordinates||[]).map(e=>({x:y({...e,type:"point"},l),y:b({...e,type:"point"},l),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>e.length)return null;const n=It(e),i=t.padding||10;return Vt("g",{children:[Pt("circle",{cx:n.x,cy:n.y,r:n.r+i,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&Pt(r,{x:n.x,y:n.y-n.r-i-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:t.label,background:t.labelBackground??"none"})]},"ann-"+o)}case"rect-enclose":{const e=(t.coordinates||[]).map(e=>({x:y({...e,type:"point"},l),y:b({...e,type:"point"},l)})).filter(e=>null!=e.x&&null!=e.y);if(2>e.length)return null;const n=t.padding||10,i=e.map(e=>e.x),a=e.map(e=>e.y),[s,c]=x(i),[d,u]=x(a),h=s-n,f=c+n,m=d-n;return Vt("g",{children:[Pt("rect",{x:h,y:m,width:f-h,height:u+n-m,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&Pt(r,{x:(h+f)/2,y:m-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:t.label,background:t.labelBackground??"none"})]},"ann-"+o)}case"highlight":{const e=l.data||[],n="function"==typeof t.filter?e.filter(t.filter):t.field&&null!=t.value?e.filter(e=>e[t.field]===t.value):[],r={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return Pt("g",{children:n.map((e,n)=>{const i=y(e,l),o=b(e,l);if(null==i||null==o)return null;const a="function"==typeof t.r?t.r(e):t.r||6,s="function"==typeof t.style?t.style(e):t.style||r;return Pt("circle",{cx:i,cy:o,r:a,...s},"hl-"+n)})},"ann-"+o)}case"bracket":{const e=y(t,l),n=b(t,l);return Pt(i,{noteData:{x:e??0,y:n??0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+o)}case"trend":{const e=l.data||[];if(2>e.length)return null;const n=l.xAccessor||"x",r=l.yAccessor||"y",i="ordinal"===l.frameType,a="horizontal"===l.projection,s=i?n:null,c=i?r:null;let d;const u=[],h=new Map;if(i&&s&&c){for(const t of e){const e=t[s];if(null==e)continue;const n=e+"";h.has(n)||(h.set(n,u.length),u.push(n))}d=e.map(e=>{const t=e[s],n=e[c];if(null==t||null==n)return null;const r=h.get(t+"");return null!=r?[r,+n]:null}).filter(e=>null!==e)}else d=e.map(e=>[e[n],e[r]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>d.length)return null;const f=l.scales?.x??l.scales?.time,m=l.scales?.y??l.scales?.value;if(!f||!m)return null;const p=e=>t=>{const n=Math.max(0,Math.floor(t)),r=Math.min(u.length-1,n+1),i=t-n,o=e(u[n]);return o+(e(u[r])-o)*i},g=f,y=m;let b;if(i)if(a){const e=p(y);b=(t,n)=>[g(n),e(t)]}else{const e=p(g);b=(t,n)=>[e(t),y(n)]}else b=(e,t)=>[g(e),y(t)];const x=t.method||"linear";let v;if("loess"===x)v=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]),l=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)),s=r.slice().sort((e,t)=>e-t)[Math.min(l-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===s?0:r[e]/s;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let d=0,u=0,h=0,f=0,m=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(d+=t,u+=t*i[e],h+=t*o[e],f+=t*i[e]*i[e],m+=t*i[e]*o[e])}if(0===d){a.push([t,o[e]]);continue}const p=d*f-u*u;if(1e-12>Math.abs(p))a.push([t,h/d]);else{const e=(d*m-u*h)/p;a.push([t,(h-e*u)/d+e*t])}}return a}(d,t.bandwidth??.3);else{const e="polynomial"===x?qt(d,t.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:Ut((n*t[3]-t[0]*t[1])/r),o=Ut(t[1]/n-i*t[0]/n);return{points:e.map(([e])=>[Ut(e),Ut(i*e+o)]),equation:[i,o]}}(d);v=e.points}const w=v.map(([e,t])=>{const[n,r]=b(e,t);return`${n},${r}`}).join(" "),k=t.color||"#6366f1",S=v[v.length-1],[M,C]=b(S[0],S[1]);return Vt("g",{children:[Pt("polyline",{points:w,fill:"none",stroke:k,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&Pt("text",{x:M+4,y:C-4,fill:k,fontSize:11,children:t.label})]},"ann-"+o)}case"band":{const e=l.scales?.y??l.scales?.value,n=e?.(t.y0)??0,i=e?.(t.y1)??(l.height||0),c=f(t.fill,"ann-"+o,"var(--semiotic-primary, #6366f1)");return Vt("g",{opacity:t.opacity,children:[c.def&&Pt("defs",{children:c.def}),Pt("rect",{x:0,y:Math.min(n,i),width:l.width||0,height:Math.abs(i-n),fill:c.fill,fillOpacity:t.fillOpacity||.1}),t.label&&Pt(r,{x:(l.width||0)-4,y:(a=n,s=i,Math.max(Math.min(a,s),0)+16),textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:t.label,background:t.labelBackground??"halo"})]},"ann-"+o)}case"x-band":{const e=l.scales?.x??l.scales?.time,n=null!=t.x0&&e?e(t.x0):null,i=null!=t.x1&&e?e(t.x1):null;if(null==n||null==i)return null;const a=f(t.fill||t.color,"ann-"+o,"var(--semiotic-primary, #6366f1)");return Vt("g",{opacity:t.opacity,children:[a.def&&Pt("defs",{children:a.def}),Pt("rect",{x:Math.min(n,i),y:0,width:Math.abs(i-n),height:l.height||0,fill:a.fill,fillOpacity:t.fillOpacity??.1}),t.label&&Pt(r,{x:Math.min(n,i)+4,y:16,textAnchor:"start",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:t.label,background:t.labelBackground??"halo"})]},"ann-"+o)}case"envelope":{const e=l.data||[];if(2>e.length)return null;const n=l.xAccessor||"x",r=l.scales?.x??l.scales?.time,i=l.scales?.y??l.scales?.value;if(!r||!i)return null;const a=t.upperAccessor||"upperBounds",s=t.lowerAccessor||"lowerBounds",c=t.filter,d=e.filter(e=>null!=e[a]&&null!=e[s]&&!(c&&!c(e))).sort((e,t)=>e[n]-t[n]);if(2>d.length)return null;const u=Yt[l.curve||"linear"]||Ft,h=Nt().x(e=>r(e[n])).y0(e=>i(e[s])).y1(e=>i(e[a])).curve(u)(d);if(!h)return null;const f=t.fill||"#6366f1";return Vt("g",{children:[Pt("path",{d:h,fill:f,fillOpacity:t.fillOpacity??.15,stroke:"none"}),t.label&&d.length>0&&Pt("text",{x:r(d[d.length-1][n])+4,y:i(d[d.length-1][a])-4,fill:f,fontSize:11,children:t.label})]},"ann-"+o)}case"anomaly-band":{const e=l.data||[];if(2>e.length)return null;const n=l.yAccessor||"y",r=l.scales?.x??l.scales?.time,i=l.scales?.y??l.scales?.value;if(!r||!i)return null;const a=e.map(e=>e[n]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const s=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-s)**2,0)/a.length,d=Math.sqrt(c),u=t.threshold??2,h=s-u*d,f=!1!==t.showBand,m=t.fill||"#6366f1",p=t.fillOpacity??.1,g=t.anomalyColor||"#ef4444",x=t.anomalyRadius??6,v=i(s+u*d),w=i(h),k=e.filter(e=>{const t=e[n];return null!=t&&Math.abs(t-s)>u*d});return Vt("g",{children:[f&&Pt("rect",{x:0,y:Math.min(v,w),width:l.width||0,height:Math.abs(w-v),fill:m,fillOpacity:p}),k.map((e,t)=>{const n=y(e,l),r=b(e,l);return null==n||null==r?null:Pt("circle",{cx:n,cy:r,r:x,fill:g,fillOpacity:.7,stroke:g,strokeWidth:1.5},"anomaly-"+t)}),t.label&&Pt("text",{x:(l.width||0)-4,y:Math.min(v,w)-4,textAnchor:"end",fill:m,fontSize:11,children:t.label})]},"ann-"+o)}case"forecast":{const e=l.data||[];if(3>e.length)return null;const n=l.xAccessor||"x",r=l.yAccessor||"y",i=l.scales?.x??l.scales?.time,a=l.scales?.y??l.scales?.value;if(!i||!a)return null;const s=e.map(e=>[e[n],e[r]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>s.length)return null;let c;if("polynomial"===(t.method||"linear")){const e=qt(s,t.order||2).equation;c=t=>e.reduce((e,n,r)=>e+n*Math.pow(t,r),0)}else{const e=s.length;let t=0,n=0,r=0,i=0;for(const[e,o]of s)t+=e,n+=o,r+=e*e,i+=e*o;const o=e*r-t*t;if(1e-12>Math.abs(o))return null;const l=(e*i-t*n)/o,a=(n-l*t)/e;c=e=>a+l*e}const d=s.length,u=s.map(([e,t])=>t-c(e)),h=u.reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(d-2,1)),m=s.reduce((e,t)=>e+t[0],0)/d,p=s.reduce((e,t)=>e+(t[0]-m)**2,0),g=t.confidence??.95,y=.99>g?.95>g?.9>g?1:1.645:1.96:2.576,b=t.steps??5,x=s[d-1][0],v=(x-s[0][0])/Math.max(d-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*v);const k=[];for(const e of w){const t=c(e),n=f*Math.sqrt(1+1/d+(p>0?(e-m)**2/p:0))*y;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const S=`M${k.map(e=>`${i(e.x)},${a(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${i(e.x)},${a(e.yLower)}`).join(" L")} Z`,M=k.map(e=>`${i(e.x)},${a(e.yCenter)}`).join(" "),C=`${i(x)},${a(c(x))}`,$=t.strokeColor||"#6366f1";return Vt("g",{children:[Pt("path",{d:S,fill:t.fill||"#6366f1",fillOpacity:t.fillOpacity??.15,stroke:"none"}),Pt("polyline",{points:`${C} ${M}`,fill:"none",stroke:$,strokeWidth:t.strokeWidth??2,strokeDasharray:t.strokeDasharray??"6,3"}),t.label&&k.length>0&&Pt("text",{x:i(k[k.length-1].x)+4,y:a(k[k.length-1].yCenter)-4,fill:$,fontSize:11,children:t.label})]},"ann-"+o)}case"widget":{let r,i;if(null!=t.px&&null!=t.py)r=t.px,i=t.py;else{const e=g(t,o,l);if(!e)return null;r=e.x,i=e.y}if(!p(r,i,l))return null;const a=t.dx??0,s=t.dy??0,c=t.width??32,d=t.height??32,u=t.content??Pt("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return Pt("foreignObject",{x:r+a-c/2,y:i+s-d/2,width:c,height:d,style:{overflow:"visible",pointerEvents:"auto"},children:Pt("div",{...e(t,n),style:{width:c,height:d,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+o)}case"text":{const e=g(t,o,l);if(!e)return null;const{x:n,y:r}=e,i=n+(t.dx||0),a=r+(t.dy||0),s=t.color||"var(--semiotic-text, #333)",c=Pt("text",{x:i,y:a,fill:s,fontSize:t.fontSize||11,opacity:t.opacity,strokeDasharray:t.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label});return!0!==t._redundantConnector?At.cloneElement(c,{key:"ann-text-"+o}):Vt("g",{opacity:t.opacity,strokeDasharray:t.strokeDasharray,children:[Pt("line",{x1:n,y1:r,x2:i,y2:a,stroke:s,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),At.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+o)}case"category-highlight":{const e=t.category;if(null==e)return null;const n=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=l.scales?.o,a=l.scales?.x,s=l.scales?.y,c=n(i)?i:n(a)?a:n(s)?s:null;if(!c)return null;const d=c(e+"");if(null==d)return null;const u=c.bandwidth(),h=t.color||"var(--semiotic-primary, #4589ff)",f=t.opacity??.15,m=t.label;return Vt("g",(l.projection?"vertical"===l.projection:c===a)?{children:[Pt("rect",{x:d,y:0,width:u,height:l.height||0,fill:h,fillOpacity:f}),m&&Pt(r,{x:d+u/2,y:16,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",text:m,background:t.labelBackground??"none"})]}:{children:[Pt("rect",{x:0,y:d,width:l.width||0,height:u,fill:h,fillOpacity:f}),m&&Pt(r,{x:12,y:d+u/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",text:m,background:t.labelBackground??"none"})]},"ann-"+o)}default:return null}var a,s,c}}export{I as useSceneRevisionDiagnostics,N as runSceneBuild,F as SceneRevisionDiagnosticsObserver,mt as resolveCurveFactory,pt as resolveCanvasFill,gt as coerceCanvasFill,yt as buildLinearFillGradient,bt as buildColorStopGradient,Dt as renderLegendFromConfig,Xt as renderAnnotationPass,Jt as createDefaultAnnotationRules,T as useHydration,P as useWasHydratingFromSSR,_ as useDataSummary,X as AriaLiveTooltip,ne as computeCanvasAriaLabel,re as computeNetworkAriaLabel,ye as AccessibleDataTable,be as NetworkAccessibleDataTable,xe as ScreenReaderSummary,ve as SkipToTableLink,Se as FocusRing,$e as FlippingTooltip,Ge as useFrame,Ue as useFrameCanvasHost,qe as CanvasFrameBackground,Pe as prepareCanvas,Ve as getDevicePixelRatio,et as SafeRender,rt as renderEmptyState,it as renderLoadingState};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{forceLayout as n}from"./chunk-chunk-E7MIQX7D.module.min.js";import{canUseForceWorker as t,runForceLayoutWorker as e,shouldUseForceWorker as o}from"./chunk-chunk-2UN3ANRN.module.min.js";import{useWasHydratingFromSSR as r}from"./chunk-chunk-ZCNBUZPL.module.min.js";import{useEffect as i,useMemo as s,useRef as u,useState as a}from"react";var d=new WeakMap;function l(n){const t=[];for(const e of Object.keys(n).sort()){const o=n[e];if(void 0!==o){if("function"==typeof o)return null;t.push(`${e}:${o+""}`)}}return t.join("|")}function c(n,t,e){return null==e?null:d.get(n)?.get(t)?.get(e)??null}function p(n,t,e,o){if(null==e)return;let r=d.get(n);r||(r=new WeakMap,d.set(n,r));let i=r.get(t);if(i||(i=new Map,r.set(t,i)),!i.has(e)&&i.size>=16){const n=i.keys().next().value;void 0!==n&&i.delete(n)}i.set(e,o)}function f(d,f,m={}){const h=r(),{seed:g,iterations:k,repulsion:y,linkDistance:w,linkStrength:b,centerStrength:j,damping:v,nodeRadius:R,nodePadding:x,inset:E,execution:A,workerThreshold:M}=m,N=s(()=>({seed:g,iterations:k,repulsion:y,linkDistance:w,linkStrength:b,centerStrength:j,damping:v,nodeRadius:R,nodePadding:x,inset:E,execution:A,workerThreshold:M}),[g,k,y,w,b,j,v,R,x,E,A,M]),S=u(h),[D,O]=a(()=>{if("undefined"==typeof window||h){const t=n(d,f,N);return p(d,f,l(N),t),{positions:t,status:"ready",error:null}}const t=c(d,f,l(N));return t?{positions:t,status:"ready",error:null}:{positions:null,status:"pending",error:null}});return i(()=>{if(S.current)return void(S.current=!1);const r=l(N),i=c(d,f,r);if(i)return void O(n=>"ready"===n.status&&n.positions===i?n:{positions:i,status:"ready",error:null});const s=new AbortController;return O(n=>({positions:n.positions,status:"pending",error:null})),async function(r,i,s={}){const{execution:u="auto",signal:a,workerThreshold:d,nodeRadius:l,...c}=s,p=c.iterations??260;if(!t()||!o(u,r.length,i.length,p,d))return n(r,i,{...c,nodeRadius:l});const f={kind:"normalized",nodes:r.map(n=>({...n})),edges:i.map(n=>({...n})),options:c,nodeRadii:"function"==typeof l?Object.fromEntries(r.map(n=>[n.id,l(n)])):null==l?void 0:Object.fromEntries(r.map(n=>[n.id,l]))};try{return(await e(f,a)).positions}catch(t){if("AbortError"===t?.name)throw t;return n(r,i,{...c,nodeRadius:l})}}(d,f,{...N,signal:s.signal}).then(n=>{p(d,f,r,n),O({positions:n,status:"ready",error:null})}).catch(n=>{"AbortError"!==n.name&&O(t=>({positions:t.positions,status:"error",error:n}))}),()=>s.abort()},[d,f,N]),D}export{f as useForceLayout};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{STREAMING_PALETTE as e,createColorScale as t,filterSparseArray as r,getCrosshairProps as o,resolveMobileInteraction as n,useCategoryColors as a,useChartLegendAndMargin as i,useChartMode as l,useChartSelection as c,useColorScale as u,useLegendInteraction as s,useThemeCategorical as d}from"./chunk-chunk-ODUZEEBH.module.min.js";import{useThemeSelector as g}from"./chunk-chunk-WCX6U47H.module.min.js";import{renderEmptyState as m,renderLoadingState as h}from"./chunk-chunk-ZCNBUZPL.module.min.js";import{useMemo as y}from"react";function p(e){const t=g(e=>e.theme.colors.selectionOpacity);return y(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}import{useCallback as f,useMemo as v,useState as b}from"react";function k(l){const{data:g,rawData:y,colorBy:k,colorScheme:L,legendInteraction:C,legendPosition:S,selection:H,linkedHover:w,fallbackFields:B,unwrapData:D=!1,onObservation:M,chartType:I,chartId:F,showLegend:A,userMargin:P,marginDefaults:R,onClick:O,hoverHighlight:T,mobileInteraction:W,mobileSemantics:x,loading:j,loadingContent:N,emptyContent:U,width:Z,height:z}=l,E=void 0===y,G=v(()=>r(g),[g]),[_,V]=b([]),X=f(e=>{V(t=>t.length===e.length&&t.every((t,r)=>t===e[r])?t:e)},[]),q="string"==typeof l.colorBy?l.colorBy:void 0,J=v(()=>n(W,{width:Z,mobileSemantics:x}),[W,Z,x]),{activeSelectionHook:K,hoverSelectionHook:Q,customHoverBehavior:Y,customClickBehavior:$,crosshairSourceId:ee}=c({selection:H,linkedHover:w,fallbackFields:B,unwrapData:D,onObservation:M,chartType:I,chartId:F,onClick:O,hoverHighlight:T,colorByField:q,mobileInteraction:J}),te=o(w,ee),re=u(G,k,L),oe=v(()=>{if(!k)return[];const e=new Set;for(const t of G){const r="function"==typeof k?k(t):t[k];null!=r&&e.add(r+"")}return Array.from(e)},[G,k]),ne=v(()=>E&&_.length>0?_:oe,[E,_,oe]),ae=s(C,k,ne),ie=v(()=>Q||(ae.legendSelectionHook?ae.legendSelectionHook:K),[Q,ae.legendSelectionHook,K]),le=p(H),ce=d(),ue=a(),se=v(()=>{if(re)return re;if(!k||0===ne.length)return;const r=Array.isArray(L)&&L.length>0||"string"==typeof L&&L.length>0?L:ce&&ce.length>0?ce:e,o="__streamCat",n=ne.map(e=>({[o]:e})),a=t(n,o,r);return e=>ue?.[e]||a(e)||"#999"},[re,k,ne,L,ce,ue]),{legend:de,margin:ge,legendPosition:me}=i({data:G,colorBy:k,colorScale:se,showLegend:A,legendPosition:S,userMargin:P,defaults:R,categories:ne}),he=v(()=>{const e={};return de&&(e.legend=de,e.legendPosition=me),C&&"none"!==C&&(e.legendHoverBehavior=ae.onLegendHover,e.legendClickBehavior=ae.onLegendClick,e.legendHighlightedCategory=ae.highlightedCategory,e.legendIsolatedCategories=ae.isolatedCategories),E&&k&&(e.legendCategoryAccessor=k,e.onCategoriesChange=X),e},[de,me,C,ae.onLegendHover,ae.onLegendClick,ae.highlightedCategory,ae.isolatedCategories,E,k,X]),ye=Array.isArray(y)?r(y):y,pe=h(j,Z,z,N),fe=pe?null:m(ye,Z,z,U);return{data:G,colorScale:re,allCategories:ne,legendState:ae,effectiveSelectionHook:ie,activeSelectionHook:K,customHoverBehavior:Y,customClickBehavior:$,mobileInteraction:J,legend:de,margin:ge,legendPosition:me,earlyReturn:pe||fe||null,legendBehaviorProps:he,crosshairProps:te,resolvedSelection:le}}import{useImperativeHandle as L}from"react";function C(e,t){const{variant:r,frameRef:o,overrides:n}=t;L(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,r)=>e.current?.update(t,r)??[],clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const r=Array.isArray(t)?t:[t],o=e.current?.getTopology()?.nodes??[],n=[];for(const t of r){const r=o.find(e=>e.id===t);r&&n.push({...r.data??{},id:t}),e.current?.removeNode(t)}return n},update:(t,r)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const o=e.current?.updateNode(t,r);return o?[{...o,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,r)=>{const o=e.current?.removePoint(t)??[];for(const t of o)e.current?.push(r(t));return o},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const r=t;return{push:e=>r.current?.pushLine(e),pushMany:e=>r.current?.pushManyLines(e),remove:e=>r.current?.removeLine(e)??[],update:(e,t)=>{const o=r.current?.removeLine(e)??[];for(const e of o)r.current?.pushLine(t(e));return o},clear:()=>r.current?.clear(),getData:()=>r.current?.getLines()??[],getCustomLayout:()=>r.current?.getCustomLayout?.()??null,getLayoutFailure:()=>r.current?.getLayoutFailure?.()??null}}(r,o);return{...e,...n}},[o,n,r])}function S(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return e??((...e)=>({}));const r={};return void 0!==t.stroke&&(r.stroke=t.stroke),void 0!==t.strokeWidth&&(r.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(r.opacity=t.opacity),e?(...t)=>({...e(...t)||{},...r}):(...e)=>({...r})}function H(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}import{useMemo as w,useRef as B}from"react";function D(e){const t=B(null);return C(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:l(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:w(()=>H(e.margin),[e.margin])}}function M(e){const t=D(e),{resolved:r,normalizedMargin:o}=t,n=k({data:e.data??[],rawData:e.data,colorBy:e.colorBy,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:"string"==typeof e.colorBy?[e.colorBy]:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:r.showLegend,userMargin:o,marginDefaults:r.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:r.width,height:r.height});return{...t,safeData:n.data,setup:n,earlyReturn:n.earlyReturn}}export{p as useResolvedSelection,k as useChartSetup,C as useFrameImperativeHandle,S as mergeShapeStyle,H as normalizePartialMargin,D as useCustomChartScaffold,M as useCustomChartSetup};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{MobileStandardControls as e,auditVisualizationControls as t}from"./chunk-chunk-RCF52Z42.module.min.js";import{resolveAccessor as i,resolveRawAccessor as n}from"./chunk-chunk-ZLKRTF5N.module.min.js";import{DataSummaryProvider as r,LinkedCharts as o,annotationStableId as a,bandFromAge as s,resolveResponsiveRules as l,useChartObserver as c,useDataSummaryToggle as d,useLinkedChartsActive as u,useObservationSelector as m,useSelection as p}from"./chunk-chunk-ODUZEEBH.module.min.js";import{getMinMax as h}from"./chunk-chunk-JJ2OOIET.module.min.js";import{ChartErrorBoundary as f}from"./chunk-chunk-ZCNBUZPL.module.min.js";async function g(e,t){const{format:i="png",filename:n="chart",scale:r=2,background:o="white"}=t||{},a=e.querySelector("svg");if(!a)throw Error("No SVG element found in the container");const s=a.cloneNode(!0),l=a.getBoundingClientRect();if(s.getAttribute("width")||s.setAttribute("width",l.width+""),s.getAttribute("height")||s.setAttribute("height",l.height+""),s.getAttribute("xmlns")||s.setAttribute("xmlns","http://www.w3.org/2000/svg"),b(a,s),"svg"===i){const e=(new XMLSerializer).serializeToString(s);y(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),n+".svg")}else{const t=l.width*r,i=l.height*r,a=document.createElement("canvas");a.width=t,a.height=i;const c=a.getContext("2d");c.fillStyle=o,c.fillRect(0,0,t,i),c.scale(r,r);const d=e.querySelector("canvas");d&&c.drawImage(d,0,0,l.width,l.height);const u=(new XMLSerializer).serializeToString(s),m=new Blob([u],{type:"image/svg+xml;charset=utf-8"}),p=URL.createObjectURL(m),h=new Image;h.width=l.width,h.height=l.height,await new Promise((e,t)=>{h.onload=()=>{c.drawImage(h,0,0),a.toBlob(i=>{i?(y(i,n+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(p)},h.onerror=()=>{URL.revokeObjectURL(p),t(Error("Failed to load SVG image"))},h.src=p})}}function b(e,t){const i=e.children,n=t.children,r=window.getComputedStyle(e),o=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of o){const i=r.getPropertyValue(e);i&&"none"!==i&&""!==i&&t.style?.setProperty(e,i)}for(let e=0;Math.min(i.length,n.length)>e;e++)b(i[e],n[e])}function y(e,t){const i=URL.createObjectURL(e),n=document.createElement("a");n.href=i,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(i)}function v(e){return x(e),e}function x(e){if(!e||"object"!=typeof e)throw Error("Chart recipe must be an object.");if("string"!=typeof e.id||""===e.id.trim())throw Error("Chart recipe requires a non-empty id.");if("string"!=typeof e.name||""===e.name.trim())throw Error(`Chart recipe "${e.id}" requires a non-empty name.`);if(!Array.isArray(e.dataRoles)||0===e.dataRoles.length)throw Error(`Chart recipe "${e.id}" requires at least one data role.`);if(!Array.isArray(e.intents)||0===e.intents.length)throw Error(`Chart recipe "${e.id}" requires at least one intent.`);for(const t of e.intents)if("string"!=typeof t&&(!t||"string"!=typeof t.id&&"string"!=typeof t.name))throw Error(`Chart recipe "${e.id}" has an intent without an id or name.`);if(!e.designContract?.whyCustom)throw Error(`Chart recipe "${e.id}" requires designContract.whyCustom.`);if(!e.accessibility||"object"!=typeof e.accessibility)throw Error(`Chart recipe "${e.id}" requires accessibility expectations.`);if(void 0!==e.controls){const i=t({controls:e.controls}).findings.filter(e=>"fail"===e.status);if(i.length>0)throw Error(`Chart recipe "${e.id}" has invalid controls: ${i.map(e=>e.message).join(" ")}`)}if("portable"===e.portability){if(!w(e.layout))throw Error(`Portable chart recipe "${e.id}" must reference a registered layout by id.`);const t=e.layoutConfigSchema??e.portabilityConfig?.schema;if(!t)throw Error(`Portable chart recipe "${e.id}" requires a serializable layout config schema.`);if(!k(t))throw Error(`Portable chart recipe "${e.id}" has a layout config schema that is not JSON-safe.`)}}function w(e){return!!e&&"object"==typeof e&&"string"==typeof e.id}function k(e,t=new Set){if(null===e)return!0;const i=typeof e;if("string"===i||"boolean"===i)return!0;if("number"===i)return Number.isFinite(e);if("object"!==i)return!1;if(t.has(e))return!1;t.add(e);const n=Array.isArray(e)?e.every(e=>k(e,t)):Object.entries(e).every(([,e])=>k(e,t));return t.delete(e),n}function $(e){return"string"==typeof e?e:e.id??e.name}function C(e){return"string"==typeof e?3:"number"==typeof e.score&&Number.isFinite(e.score)?Math.max(0,Math.min(5,e.score>1?e.score:5*e.score)):"primary"===e.strength?5:"secondary"===e.strength?3:"supporting"===e.strength?2:3}function S(e){const t=new Set(e.intents.map($));return t.has("geo")?"geo":t.has("hierarchy")?"hierarchy":t.has("flow")?"flow":t.has("relationship")?"network":t.has("distribution")?"distribution":t.has("correlation")?"relationship":t.has("trend")||t.has("composition-over-time")?"time-series":t.has("compare-categories")||t.has("rank")||t.has("part-to-whole")?"categorical":"custom"}function A(e){const t=Object.values(e.audience?.familiarity??{}),i=t.find(e=>"number"==typeof e);if(void 0!==i)return Math.max(1,Math.min(5,Math.round(i)));const n=t.filter(e=>"string"==typeof e);return n.includes("high")?4:n.includes("medium")?3:n.includes("low")?2:e.reception?.memorableForm?3:2}function N(e,t){return"nodes"===t?e.network?.nodes??[]:"edges"===t?e.network?.edges??[]:"areas"===t?e.geo?.features??[]:"points"===t?e.geo?.points??[]:"lines"===t?e.geo?.flows??[]:e.data}function j(e,t,i){return N(e,t.source).some(e=>null!=e&&Object.prototype.hasOwnProperty.call(e,i))}function I(e,t,i){if(t.field&&j(i,t,t.field))return t.field;if("nodes"===t.source||"edges"===t.source){const e="node-id"===t.role?"id":"edge-source"===t.role?"source":"edge-target"===t.role?"target":void 0;if(e&&j(i,t,e))return e}switch(t.semanticType){case"quantitative":return i.primary.y??i.primary.size??i.primary.x;case"temporal":return i.primary.time??i.primary.x;case"nominal":case"ordinal":return i.primary.category??i.primary.series;case"identifier":{const e=N(i,t.source);return["id","key","name"].find(t=>e.some(e=>null!=e&&Object.prototype.hasOwnProperty.call(e,t)))}case"geographic":return i.hasGeo?t.field:void 0;default:return t.field}}function L(e){const t={},i=[];for(const n of e.intents){const e=$(n);e&&(t[e]=C(n),"string"!=typeof n&&n.rationale&&i.push(n.rationale))}i.push(...(e.reception?.strengths??[]).map(e=>"Reception strength: "+e));const n=e.reception?.risks??[],r=e.designContract.misuse??[],o=[...e.designContract.caveats??[],...e.caveats??[]];return{component:e.id,displayName:e.name,candidateKind:"recipe",family:S(e),renderingFamily:e.frameFamily,importPath:"semiotic/ai",rubric:{familiarity:A(e),accuracy:4,precision:n.some(e=>/precis|comparison/i.test(e))?2:3},fits:t=>function(e,t){for(const i of e.dataRoles)if(!1!==i.required&&!I(0,i,t))return`needs data role "${i.role}" (${i.semanticType})`;const i=e.audit?.maxCategories;return"number"==typeof i&&"number"==typeof t.categoryCount&&t.categoryCount>i?`${t.categoryCount} categories exceeds this recipe's declared maximum of ${i}`:null}(e,t),intentScores:t,caveats:()=>[...n,...r,...o],buildProps:t=>function(e,t){const i={};for(const n of e.dataRoles){const e=I(0,n,t);e&&n.accessor&&(i[n.accessor]=e)}const n={recipeId:e.id,layoutConfig:i};e.frameFamily.startsWith("Network")?(n.nodes=t.network?.nodes??t.data,n.edges=t.network?.edges??[]):e.frameFamily.startsWith("Geo")?(n.areas=t.geo?.features??[],n.points=t.geo?.points??t.data,n.lines=t.geo?.flows??[]):n.data=t.data;const r=e.mobile??("number"==typeof e.accessibility.minimumHitTarget?{minimumHitTarget:e.accessibility.minimumHitTarget}:void 0);return r&&(n.mobileSemantics=r),n}(e,t),mobile:e.mobile??("number"==typeof e.accessibility.minimumHitTarget?{minimumHitTarget:e.accessibility.minimumHitTarget}:void 0),recipe:e,positiveRationale:i,whyCustom:{defaultAlternative:e.designContract.defaultAlternative,reason:e.designContract.whyNotDefault??e.designContract.whyCustom,tradeoff:e.designContract.tradeoff??(n.length>0?n[0]:void 0)}}}var P=Symbol.for("semiotic.chartRecipeRegistry");function R(){const e=globalThis;return e[P]||(e[P]={recipes:new Map,capabilities:new Map,layouts:new Map}),e[P]}function M(e){x(e),R().recipes.set(e.id,e),R().capabilities.set(e.id,L(e))}function B(e){R().recipes.delete(e),R().capabilities.delete(e)}function T(e){return R().recipes.get(e)}function D(){return Array.from(R().recipes.values())}function z(){return Array.from(R().capabilities.values())}function F(){return R().capabilities.size>0}function E(e,t){if(!e)throw Error("Recipe layout requires a non-empty id.");if("function"!=typeof t)throw Error(`Recipe layout "${e}" must be a function.`);R().layouts.set(e,t)}function O(e){R().layouts.delete(e)}function H(e){return R().layouts.get(e)}function W(e){return"string"==typeof e?T(e):e&&"object"==typeof e&&"string"==typeof e.id?e:void 0}var V=["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","RidgelinePlot","DotPlot","PieChart","DonutChart","GaugeChart","FunnelChart","SwimlaneChart","LikertChart","LineChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","BubbleChart","Heatmap","QuadrantChart","MultiAxisLineChart","CandlestickChart","ConnectedScatterplot","ScatterplotMatrix","MinimapChart","ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram","TreeDiagram","Treemap","CirclePack","OrbitDiagram","ChoroplethMap","ProportionalSymbolMap","FlowMap","DistanceCartogram","RealtimeLineChart","RealtimeHistogram","TemporalHistogram","RealtimeSwarmChart","RealtimeWaterfallChart","RealtimeHeatmap","GaltonBoardChart","EventDropChart","PhysicsPileChart","CollisionSwarmChart","GauntletChart","ProcessFlowChart","PhysicalFlowChart","BigNumber"],U=new Set(V);function G(e){return U.has(e)}function q(e){return"string"==typeof e?e:e.id??e.name}function J(e){return e.layoutConfig&&"object"==typeof e.layoutConfig?e.layoutConfig:{}}function Z(e){return Array.isArray(e.data)?e.data:Array.isArray(e.nodes)?e.nodes:Array.isArray(e.points)?e.points:Array.isArray(e.areas)?e.areas:[]}function _(e,t,i){return i??W(t.recipe)??W(t.recipeId)??T(e)}function X(e,t,i=[]){const n=e.accessor?t[e.accessor]:void 0;if("string"==typeof n&&n)return n;if(e.field)return e.field;const r=i.find(e=>e&&"object"==typeof e);if(!r)return;const o=Object.entries(r).filter(([e,t])=>!e.startsWith("_")&&null!=t);return"quantitative"===e.semanticType?o.find(([,e])=>"number"==typeof e)?.[0]:"identifier"===e.semanticType?["id","key","name"].find(e=>e in r):o.find(([,e])=>"string"==typeof e)?.[0]}function K(e,t){return e.dataRoles.find(e=>e.role===t)}function Q(e,t){return e.dataRoles.find(e=>t.includes(e.semanticType))}function Y(e,t,i,n,r,o={}){const a={...o};if(t)for(const[e,i]of Object.entries(t))a[e]=i;for(const e of i.dataRoles){const i=X(e,n,r),o=t&&i?t[i]:i;void 0!==o&&(a[e.role]=o)}return e.replace(/\{([^}]+)\}/g,(e,t)=>{const i=a[t];return null==i?`{${t}}`:i+""})}var ee=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend","recipe","layout"]),te=new Set(["data","nodes","edges","points","areas","lines","flows"]);function ie(e,t){return!!te.has(e)&&("areas"!==e||"string"!=typeof t)}var ne="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function re(e,t,i){const n=T(e)??W(t.recipe)??W(t.recipeId);if(n)return function(e,t,i){const n=function(e,t,i){const n={};for(const[r,o]of Object.entries(e))if(null!=o&&!ee.has(r)&&"recipeId"!==r&&(t||!ie(r,o)))if("function"==typeof o||o?.$$typeof){if(i)throw Error(`Portable recipe prop "${r}" is not JSON-safe.`)}else if(k(o))n[r]=ne(o);else if(i)throw Error(`Portable recipe prop "${r}" is not JSON-safe.`);return n}(t,!1!==i?.includeData,"portable"===e.portability),r=e.intents.map(q).filter(e=>!!e),o={name:e.name,intents:r,...e.audience?.primary?{audience:[e.audience.primary]}:{},frameFamily:e.frameFamily};if("portable"===e.portability){if(!k(n))throw Error(`Portable recipe "${e.id}" contains non-JSON-safe props or layoutConfig.`);return{component:"ChartRecipe",recipeId:e.id,portable:!0,props:n,manifest:o,version:"1",createdAt:(new Date).toISOString(),...i?.selections?{selections:i.selections}:{}}}return{component:"ChartRecipe",recipeId:e.id,portable:!1,reason:"Recipe contains or may depend on non-serializable local layout callbacks.",warnings:["This config is inspectable but cannot be rendered remotely by CLI or MCP."],props:n,manifest:o,version:"1",createdAt:(new Date).toISOString(),...i?.selections?{selections:i.selections}:{}}}(n,t,i);if(!G(e))throw Error(`Unknown component "${e}". Known components: ${V.join(", ")}`);const r=!1!==i?.includeData,o={};for(const[e,i]of Object.entries(t))null!=i&&(ee.has(e)||!r&&ie(e,i)||"function"!=typeof i&&(i?.$$typeof||(o[e]=ne(i))));return{component:e,props:o,version:"1",createdAt:(new Date).toISOString(),...i?.selections?{selections:i.selections}:{}}}function oe(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if("ChartRecipe"===e.component||"LocalChartRecipe"===e.component){if(!e.recipeId)throw Error("Invalid chart recipe config: missing recipeId");const t=T(e.recipeId);if(!t)throw Error(`Unknown chart recipe "${e.recipeId}". Register it before deserializing this config.`);if("LocalChartRecipe"!==e.component&&!1!==e.portable&&"portable"!==t.portability)throw Error(`Chart recipe "${e.recipeId}" is registered as local, not portable.`);return{componentName:"ChartRecipe",props:{...ne(e.props),recipeId:e.recipeId}}}if(!G(e.component))throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:ne(e.props)}}function ae(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function se(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const i=t.replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(escape(atob(i)));return JSON.parse(n)}async function le(e,t="json"){const i="jsx"===t?ce(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");await navigator.clipboard.writeText(i)}function ce(e){const{props:t}=e,i=["<"+("LocalChartRecipe"===e.component?"ChartRecipe":e.component)];e.recipeId&&i.push(` recipeId="${e.recipeId}"`);for(const[e,n]of Object.entries(t))if("string"==typeof n)i.push(` ${e}="${n}"`);else if("boolean"==typeof n&&!0===n)i.push(" "+e);else if("boolean"==typeof n&&!1===n)i.push(` ${e}={false}`);else if("number"==typeof n)i.push(` ${e}={${n}}`);else{const t=JSON.stringify(n);i.push(80>t.length?` ${e}={${t}}`:` ${e}={${JSON.stringify(n,null,2)}}`)}return i.push("/>"),i.join("\n")}function de(e){const t={};for(const[i,n]of e){const e=[];for(const[,t]of n.clauses){const i={};for(const[e,n]of Object.entries(t.fields))i[e]="point"===n.type?{type:"point",values:Array.from(n.values)}:{type:"interval",range:n.range};e.push({clientId:t.clientId,type:t.type,fields:i})}t[i]={name:n.name,resolution:n.resolution,clauses:e}}return t}function ue(e){const t=new Map;for(const[i,n]of Object.entries(e)){const e=new Map;for(const t of n.clauses){const i={};for(const[e,n]of Object.entries(t.fields))i[e]="point"===n.type?{type:"point",values:new Set(n.values)}:{type:"interval",range:n.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:i})}t.set(i,{name:n.name,resolution:n.resolution,clauses:e})}return t}function me(e){return"nominal"===e||"ordinal"===e}function pe(e){return"quantitative"===e||"temporal"===e}var he={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},fe={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},ge={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function be(e){e=function(e){if(!function(e){return e.usermeta?.idid}(e)||!Array.isArray(e.layer))return e;const t=e.layer.filter(e=>!function(e){return"annotation-layer"===e.usermeta?.idid?.role}(e));if(1!==t.length)return e;const{layer:i,...n}=e,{usermeta:r,...o}=t[0];return{...n,...o}}(e);const t=[],{type:i,markProps:n}=function(e){if(!e)return{type:"",markProps:{}};if("string"==typeof e)return{type:e,markProps:{}};const{type:t,...i}=e;return{type:t,markProps:i}}(e.mark),r=e.encoding||{},o=r.x,a=r.y,s=r.color,l=r.size,c=r.theta,d=r.opacity;let u;e.data?.values?u=e.data.values:e.data?.url&&t.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&t.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&t.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&t.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||r.facet||r.row||r.column)&&t.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&t.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&t.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const m={};e.width&&(m.width=e.width),e.height&&(m.height=e.height);const p=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(p&&(m.title=p),s?.field&&(m.colorBy=s.field,s.scale?.scheme)){const e=he[s.scale.scheme];e&&(m.colorScheme=e)}void 0!==d?.value&&(m.pointOpacity=d.value);const f=o?.aggregate,g=a?.aggregate;if(u&&(f||g)){const e=g?a:o,t=g?o:a,i=ge[e.aggregate];if(i&&t?.field&&e.field)u=function(e,t){const{groupBy:i,value:n,agg:r="sum"}=t,o=new Map;for(const t of e){const e=t[i]+"";o.has(e)||o.set(e,[]),o.get(e).push(Number(t[n]))}const a=[];for(const[e,t]of o){let n;switch(r){case"count":n=t.length;break;case"mean":n=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":n=h(t)[0];break;case"max":n=h(t)[1];break;default:n=t.reduce((e,t)=>e+t,0)}a.push({[i]:e,value:n})}return a}(u,{groupBy:t.field,value:e.field,agg:i});else if(("count"===i||"count"===e.aggregate)&&t?.field&&u){const e=new Map;for(const i of u){const n=i[t.field]+"";e.set(n,(e.get(n)||0)+1)}u=Array.from(e,([e,i])=>({[t.field]:e,value:i}))}}if(o?.bin||a?.bin){const e="Histogram";u&&(m.data=u),o?.bin?(m.valueAccessor=o.field,a?.field&&(m.categoryAccessor=a.field),o.axis?.title&&(m.valueLabel=o.axis.title)):a?.bin&&(m.valueAccessor=a.field,o?.field&&(m.categoryAccessor=o.field),a.axis?.title&&(m.valueLabel=a.axis.title));const i=o?.bin||a?.bin,n="object"==typeof i?i.maxbins:void 0;return n&&(m.bins=n),ve(e,m,t)}let b;switch(i){case"bar":b=function(e,t,i,n,r,o,a){let s;return i?.field&&!1!==e?.stack&&!1!==t?.stack&&null!==e?.stack&&null!==t?.stack?(s="StackedBarChart",n.stackBy=i.field):s="BarChart",me(e?.type)&&pe(t?.type)?(n.categoryAccessor=e.field,n.valueAccessor=a?"value":t.field,e?.axis?.title&&(n.categoryLabel=e.axis.title),t?.axis?.title&&(n.valueLabel=t.axis.title)):pe(e?.type)&&me(t?.type)?(n.categoryAccessor=t.field,n.valueAccessor=o?"value":e.field,n.orientation="horizontal",t?.axis?.title&&(n.categoryLabel=t.axis.title),e?.axis?.title&&(n.valueLabel=e.axis.title)):(e?.field&&(n.categoryAccessor=e.field),t?.field&&(n.valueAccessor=a?"value":t.field),e?.axis?.title&&(n.categoryLabel=e.axis.title),t?.axis?.title&&(n.valueLabel=t.axis.title)),r&&(n.data=r),s}(o,a,s,m,u,f,g);break;case"line":if(b="LineChart",ye(o,a,m,f,g),s?.field&&(m.lineBy=s.field),n.interpolate){const e=fe[n.interpolate];e&&(m.curve=e)}!0===n.point&&(m.showPoints=!0),u&&(m.data=u);break;case"area":if(s?.field?(b="StackedAreaChart",m.areaBy=s.field):b="AreaChart",ye(o,a,m,f,g),n.interpolate){const e=fe[n.interpolate];e&&(m.curve=e)}void 0!==n.opacity&&(m.areaOpacity=n.opacity),u&&(m.data=u);break;case"point":case"circle":case"square":l?.field?(b="BubbleChart",m.sizeBy=l.field,l.scale?.range&&(m.sizeRange=l.scale.range)):b="Scatterplot",ye(o,a,m,f,g),u&&(m.data=u);break;case"rect":b="Heatmap",o?.field&&(m.xAccessor=o.field),a?.field&&(m.yAccessor=a.field),s?.field&&(m.valueAccessor=s.field,delete m.colorBy),o?.axis?.title&&(m.xLabel=o.axis.title),a?.axis?.title&&(m.yLabel=a.axis.title),u&&(m.data=u);break;case"arc":n.innerRadius&&n.innerRadius>0?(b="DonutChart",m.innerRadius=n.innerRadius):b="PieChart",c?.field?m.valueAccessor=c.field:a?.field&&(m.valueAccessor=g?"value":a.field),s?.field&&(m.categoryAccessor=s.field),o?.field&&!c?.field&&(m.categoryAccessor=o.field),u&&(m.data=u);break;case"tick":b="DotPlot",me(o?.type)?(m.categoryAccessor=o.field,a?.field&&(m.valueAccessor=g?"value":a.field),o?.axis?.title&&(m.categoryLabel=o.axis.title),a?.axis?.title&&(m.valueLabel=a.axis.title)):me(a?.type)?(m.categoryAccessor=a.field,o?.field&&(m.valueAccessor=f?"value":o.field),m.orientation="horizontal",a?.axis?.title&&(m.categoryLabel=a.axis.title),o?.axis?.title&&(m.valueLabel=o.axis.title)):(o?.field&&(m.categoryAccessor=o.field),a?.field&&(m.valueAccessor=g?"value":a.field)),u&&(m.data=u);break;default:t.push(`Unsupported mark type "${i}". Defaulting to Scatterplot.`),b="Scatterplot",ye(o,a,m,f,g),u&&(m.data=u)}return ve(b,m,t)}function ye(e,t,i,n,r){e?.field&&(i.xAccessor=n?"value":e.field),t?.field&&(i.yAccessor=r?"value":t.field),e?.axis?.title&&(i.xLabel=e.axis.title),t?.axis?.title&&(i.yLabel=t.axis.title)}function ve(e,t,i){const n={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(i.length>0){n.warnings=i;for(const e of i)console.warn("[semiotic/fromVegaLite] "+e)}return n}function xe(e,t){const i={...e};return t.provenance&&(i.provenance=t.provenance),t.lifecycle&&(i.lifecycle=t.lifecycle),i}function we(){return(new Date).toISOString()}function ke(e,t={}){const i=e.provenance;return{...e,provenance:{...i,...t,createdAt:t.createdAt??i?.createdAt??we()}}}function $e(e){if(null==e)return null;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();const t=Date.parse(e);return Number.isFinite(t)?t:null}function Ce(e){const t=$e(e?.now);if(null!=t)return t;const i=e?.dataExtent;if(i)if(Array.isArray(i)){const e=$e(i[i.length-1]);if(null!=e)return e}else if("max"in i){const e=$e(i.max);if(null!=e)return e}return Date.now()}function Se(e,t,i={}){const n=e?.lifecycle?.freshness,r=$e(e?.provenance?.createdAt),o=function(e){if(null==e)return null;if("number"==typeof e)return e;const t=function(e){const t=/^P(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/.exec(e);return t?1e3*(3600*(24*parseInt(t[1]||"0",10)+parseInt(t[2]||"0",10))+60*parseInt(t[3]||"0",10)+parseInt(t[4]||"0",10)):0}(e);return t>0?t:null}(e?.lifecycle?.ttlHint);return null==r||null==o?n??"fresh":s(t-r,o,i)}function Ae(e,t={}){const i=Ce(t);return e.map(e=>{const n=Se(e,i,t.thresholds);return{...e,lifecycle:{...e.lifecycle,freshness:n}}})}var Ne={fresh:null,aging:.55,stale:.35,expired:.2},je={fresh:null,aging:null,stale:"4 4",expired:"2 4"};function Ie(e,t,i){return e&&i in e?e[i]:t[i]}function Le(e,t={}){const i=Ce(t),n=!0===t.showExpiredAnnotations,r=[];for(const o of e){const e=Se(o,i,t.thresholds);if("expired"===e&&!n)continue;const a=Ie(t.opacity,Ne,e),s=Ie(t.strokeDasharray,je,e),l=t.labelSuffix?.[e],c={...o,lifecycle:{...o.lifecycle,freshness:e}};null!=a&&null==c.opacity&&(c.opacity=a),null!=s&&null==c.strokeDasharray&&(c.strokeDasharray=s),l&&"string"==typeof c.label&&(c.label=c.label+l);const d=o.lifecycle?.anchor;d&&null==c.anchor&&(c.anchor=d),r.push(c)}return r}var Pe={proposed:.7,accepted:null,disputed:.7,retracted:.25},Re={proposed:"3 3",accepted:null,disputed:"2 3",retracted:"2 4"},Me={proposed:" (proposed)",accepted:"",disputed:" (?)",retracted:""};function Be(e,t,i){return e&&i in e?e[i]:t[i]}function Te(e,t={}){const i=!0===t.showRetractedAnnotations,n=!0===t.showSupersededAnnotations,r=new Set;for(const t of e){const e=t?.lifecycle?.supersedes;e&&"retracted"!==t?.lifecycle?.status&&r.add(e)}return e.filter(e=>{if("retracted"===e?.lifecycle?.status&&!i)return!1;const t=e?.provenance?.stableId;return!(t&&r.has(t)&&!n)})}function De(e,t={}){const i=[];for(const n of Te(e,t)){const e=n?.lifecycle?.status;if(!e){i.push(n);continue}const r=Be(t.opacity,Pe,e),o=Be(t.strokeDasharray,Re,e),a=t.labelSuffix?.[e]??Me[e],s={...n};null!=r&&(s.opacity=("number"==typeof s.opacity?s.opacity:1)*r),null!=o&&null==s.strokeDasharray&&(s.strokeDasharray=o),a&&"string"==typeof s.label&&(s.label=s.label+a),i.push(s)}return i}function ze(e,t,i={}){const n=Z(t),r=J(t),o=i.locale??"en",a="function"==typeof e.description?e.description({data:n,config:r,locale:o}):void 0,s=a?.levels??function(e,t,i,n){const r=Q(e,["nominal","ordinal"]),o=Q(e,["quantitative"]),a=r?X(r,i,t):void 0,s=o?X(o,i,t):void 0,l=r?.role??a??"category",c=o?.role??s??"value",d=e.encodings??[],u=d.length?d.slice(0,3).map(e=>e.meaning.replace(/\.$/,"")).join("; "):`${l} and ${c} are mapped through the recipe's declared visual semantics`,{number:m,percent:p}=function(e){try{return{number:new Intl.NumberFormat(e,{maximumFractionDigits:2}),percent:new Intl.NumberFormat(e,{style:"percent",maximumFractionDigits:1})}}catch{return{number:new Intl.NumberFormat("en",{maximumFractionDigits:2}),percent:new Intl.NumberFormat("en",{style:"percent",maximumFractionDigits:1})}}}(n),h=new Map;if(a&&s)for(const e of t){const t=(e[a]??"Uncategorized")+"",i=Number(e[s]);Number.isFinite(i)&&h.set(t,(h.get(t)??0)+i)}const f=[...h].sort((e,t)=>t[1]-e[1]),g=f.reduce((e,[,t])=>e+t,0),b=f[0],y=f[1],v=g>0?((b?.[1]??0)+(y?.[1]??0))/g:0,x=e.intents.map(e=>({id:q(e),strength:"string"==typeof e?void 0:e.strength})).sort((e,t)=>"primary"===e.strength?-1:"primary"===t.strength?1:0)[0]?.id,w=e.audience?.primary??e.audienceFit?.find(e=>"strong"===e.fit)?.audience;return{l1:`A ${e.name.toLowerCase()} encodes ${l} and ${c}. ${k=u,k?k.charAt(0).toUpperCase()+k.slice(1):k}.`,l2:f.length>0?`${f.length} categories total ${m.format(g)}. ${b[0]} accounts for ${m.format(b[1])}${g>0?` (${p.format(b[1]/g)})`:""}${y?`, followed by ${y[0]} at ${m.format(y[1])}`:""}.`:`${t.length} data ${1===t.length?"item is":"items are"} represented.`,l3:2>f.length?b?b[0]+" is the only represented category.":"No quantitative pattern can be derived from the available data.":.5>v?`The total is distributed across ${f.length} categories without the first two forming a majority.`:`Most of the total is concentrated in ${b[0]} and ${y[0]}, which together account for ${p.format(v)}.`,l4:`The chart is intended for ${x??"explanation"}${w?` with a ${w} audience`:""}: ${e.designContract.whyCustom}`};var k}(e,n,r,o),l=i.levels??["l1","l2","l3","l4"],c={};for(const e of l)s[e]&&(c[e]=s[e]);const d=["l1","l2","l3","l4"].map(e=>c[e]).filter(e=>!!e).join(" "),u=i.includeCaveats?[...e.reception?.risks??[],...e.caveats??[],...(e.designContract.misuse??[]).map(e=>"Misuse: "+e)]:void 0;return{text:d,levels:c,...u?.length?{caveats:u}:{}}}var Fe=new Set(["LineChart","AreaChart","StackedAreaChart","DifferenceChart","Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","MultiAxisLineChart","MinimapChart"]),Ee=new Set(["BarChart","StackedBarChart","GroupedBarChart","DotPlot"]),Oe=new Set(["PieChart","DonutChart","FunnelChart"]),He=new Set(["Histogram","BoxPlot","ViolinPlot","RidgelinePlot","SwarmPlot"]);function We(e,t){return Ee.has(e)||Oe.has(e)||"SwimlaneChart"===e||"GaugeChart"===e?{measure:t.valueAccessor,measureFallback:"value",dimension:t.categoryAccessor??t.stepAccessor,dimensionFallback:"category"}:{measure:t.yAccessor??t.valueAccessor,measureFallback:"y",dimension:t.xAccessor,dimensionFallback:"x"}}function Ve(e){for(const t of["lineBy","areaBy","stackBy","groupBy","colorBy"]){const i=e[t];if("string"==typeof i&&i)return i}}function Ue(e,t){return null==e?"—":e instanceof Date?e.toISOString().slice(0,10):"number"==typeof e?t(e):e+""}var Ge={LineChart:"line chart",AreaChart:"area chart",StackedAreaChart:"stacked area chart",DifferenceChart:"difference chart",Scatterplot:"scatter plot",BubbleChart:"bubble chart",ConnectedScatterplot:"connected scatter plot",QuadrantChart:"quadrant chart",MultiAxisLineChart:"dual-axis line chart",CandlestickChart:"candlestick chart",Heatmap:"heatmap",MinimapChart:"line chart",BarChart:"bar chart",StackedBarChart:"stacked bar chart",GroupedBarChart:"grouped bar chart",DotPlot:"dot plot",Histogram:"histogram",BoxPlot:"box plot",ViolinPlot:"violin plot",RidgelinePlot:"ridgeline plot",SwarmPlot:"swarm plot",PieChart:"pie chart",DonutChart:"donut chart",FunnelChart:"funnel chart",GaugeChart:"gauge",LikertChart:"Likert chart",SwimlaneChart:"swimlane chart",ForceDirectedGraph:"network graph",SankeyDiagram:"Sankey diagram",ProcessSankey:"temporal Sankey diagram",ChordDiagram:"chord diagram",TreeDiagram:"tree diagram",Treemap:"treemap",CirclePack:"circle-packing chart",OrbitDiagram:"orbit diagram",ChoroplethMap:"choropleth map",ProportionalSymbolMap:"proportional-symbol map",FlowMap:"flow map",DistanceCartogram:"distance cartogram",BigNumber:"single value",StreamPhysicsFrame:"physics stream frame",EventDropChart:"event-drop physics chart",GaltonBoardChart:"Galton board chart",PhysicsPileChart:"physics pile chart",CollisionSwarmChart:"collision swarm chart",PhysicalFlowChart:"physical flow chart",ProcessFlowChart:"process flow physics chart",PhysicsCustomChart:"custom physics chart"},qe=new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]),Je=new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","PhysicsPileChart","CollisionSwarmChart","PhysicalFlowChart","ProcessFlowChart","GauntletChart","PhysicsCustomChart"]);function Ze(e){return Ge[e]||e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase()+" chart"}function _e(e){const t="number"==typeof e?e:"string"==typeof e?Number(e):NaN;return Number.isFinite(t)?t:void 0}var Xe=new Set(["Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","ScatterplotMatrix"]),Ke={"outlier-detection":"alerting","change-detection":"alerting",trend:"tracking","composition-over-time":"apportioning","compare-series":"comparing","compare-categories":"comparing",rank:"ranking","part-to-whole":"apportioning",distribution:"characterizing",correlation:"relating",flow:"tracing",hierarchy:"nesting",geo:"locating"},Qe={"time-series":"tracking",categorical:"comparing",distribution:"characterizing",relationship:"relating",flow:"tracing",network:"tracing",hierarchy:"nesting",geo:"locating",realtime:"tracking",value:"presenting",custom:"presenting"},Ye=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","composition-over-time","change-detection","outlier-detection"],et={alerting:"alerting",tracking:"trend",comparing:"comparison",ranking:"ranking",apportioning:"composition",characterizing:"distribution",relating:"correlation",tracing:"flow",nesting:"hierarchy",locating:"locator",presenting:"single-value"};function tt(e){return Ke[e]}function it(e,t){const i=function(e){if(e){if("fits"in e||"buildProps"in e){const t=e,i={};for(const[e,n]of Object.entries(t.intentScores))"number"==typeof n&&Number.isFinite(n)&&(i[e]=n);return{family:t.family,intentScores:Object.keys(i).length?i:void 0}}return e}}(t);if(i?.act)return i.act;if(i?.intentScores){const e=function(e){let t,i=0;for(const[n,r]of Object.entries(e))if("number"==typeof r&&r>0)if(r>i)t=n,i=r;else if(r===i&&void 0!==t){const e=Ye.indexOf(n),i=Ye.indexOf(t);-1===e||-1!==i&&e>=i||(t=n)}return t}(i.intentScores);if(e&&Ke[e]&&(i.intentScores[e]??0)>=3)return Ke[e]}return i?.family?Qe[i.family]:function(e){return Oe.has(e)||"StackedAreaChart"===e?"apportioning":Xe.has(e)?"relating":Ee.has(e)?"comparing":He.has(e)?"characterizing":Fe.has(e)?"tracking":qe.has(e)?"tracing":"BigNumber"===e?"presenting":void 0}(e)}var nt=new Set(["y-threshold","x-threshold","band","x-band","callout","label"]),rt=new Set(["system","agent","watcher"]),ot=new Set(["ai","agent","system","computed","dbt","great-expectations"]),at=new Set(["rule","statistical-test","llm-inference","computed"]);function st(e){const t=e.annotations;return!!Array.isArray(t)&&t.some(e=>{if(!e||"object"!=typeof e)return!1;const t=e;if("string"!=typeof t.type||!nt.has(t.type))return!1;const i=t.provenance;return!(!i||"object"!=typeof i)&&(rt.has(i.authorKind)||ot.has(i.source)||at.has(i.basis))})}function lt(e="en"){let t,i;try{t=new Intl.NumberFormat(e,{notation:"compact",maximumFractionDigits:1}),i=new Intl.NumberFormat(e,{maximumFractionDigits:2})}catch{t=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}),i=new Intl.NumberFormat("en",{maximumFractionDigits:2})}return e=>Number.isFinite(e)?1e4>Math.abs(e)?i.format(e):t.format(e):e+""}var ct={"y-threshold":"a threshold line","x-threshold":"a threshold line",band:"a highlighted band","x-band":"a highlighted band",label:"a label",callout:"a callout","callout-circle":"a callout","callout-rect":"a callout",text:"a text note",bracket:"a bracket",enclose:"an enclosure","rect-enclose":"an enclosure",highlight:"a highlight",widget:"a widget",trend:"a trend line",envelope:"an envelope","anomaly-band":"an anomaly band",forecast:"a forecast","category-highlight":"a category highlight"};function dt(e){const t=ct["string"==typeof e.type?e.type:"annotation"]||"an annotation",i=function(e){const t=e.provenance&&"object"==typeof e.provenance?e.provenance:null,i=t?.authorKind??t?.source??t?.basis;return"watcher"===i?"a watcher-flagged ":"agent"===i||"ai"===i||"llm-inference"===i?"an AI-suggested ":""}(e),n=i?i+t.replace(/^an? /,""):t,r="string"==typeof e.label?e.label:"string"==typeof e.title?e.title:void 0;return r?`${n} labeled "${r}"`:n}function ut(e){const t=Array.isArray(e.annotations)?e.annotations:null;if(!t||0===t.length)return;const i=Te(t.filter(e=>!!e&&"object"==typeof e));if(0===i.length)return;const n=i.map(dt),r=n.slice(0,5),o=n.length-r.length,a=function(e){return e.length>1?2===e.length?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`:e[0]??""}(r)+(o>0?`, and ${o} more`:""),s=i.length;return`The author has marked ${1===s?"one feature":s+" features"} on this chart: ${a}.`}function mt(e,t,r={}){const o=void 0!==r.levels,a=new Set(r.levels??["l1","l2","l3"]);o||!r.capability&&!st(t)||a.add("l4");const s=_(e,t,r.recipe);if(s){const e=["l1","l2","l3","l4"].filter(e=>a.has(e));o||e.includes("l4")||e.push("l4");const i=ze(s,t,{levels:e,locale:r.locale,audience:r.audience,includeCaveats:r.includeCaveats}),n=ut(t);return{...i,text:n?`${n} ${i.text}`.trim():i.text,...n?{annotations:n}:{}}}const l=lt(r.locale??"en"),c=Ze(e),d=Array.isArray(t.data)?t.data:null,u=Ve(t),m=Je.has(e)?function(e,t){const i=e.physics&&"object"==typeof e.physics?e.physics:null,n=e.settledProjection&&"object"==typeof e.settledProjection?e.settledProjection:null,r=[e.settledProjectionRows,e.projectionRows,n?.rows,i?.settledProjectionRows,i?.projectionRows,i?.settledProjection&&"object"==typeof i.settledProjection?i.settledProjection.rows:void 0].find(e=>Array.isArray(e));return Array.isArray(r)?r.map((e,i)=>{if(!e||"object"!=typeof e)return null;const n=e,r=_e(n.count??n.value??n.total??n.bodies??n.events);if(null==r)return null;const o=n.label??n.id??n.name??"container "+(i+1),a=_e(n.secondary??n.secondaryCount),s=_e(n.observed??n.observedCount);return{label:Ue(o,t),count:r,...null!=a?{secondary:a}:{},..."string"==typeof n.secondaryLabel&&n.secondaryLabel?{secondaryLabel:n.secondaryLabel}:{},...null!=s?{observed:s}:{}}}).filter(e=>null!=e):null}(t,l):null,{measure:p,measureFallback:h,dimension:f,dimensionFallback:g}=We(e,t),b="string"==typeof p&&p?p:h,y="string"==typeof f&&f?f:g,v={};if(Je.has(e)&&function(e,t,i,n,r,o){const a=function(e){return"EventDropChart"===e?"time window":"GaltonBoardChart"===e?"bin":"CollisionSwarmChart"===e?"group lane":"PhysicalFlowChart"===e?"flow node":"container"}(e),s=function(e){return"EventDropChart"===e?"event":"GaltonBoardChart"===e?"sample":"CollisionSwarmChart"===e?"point":"PhysicalFlowChart"===e?"packet":"body"}(e);if(r.has("l1")&&(n.l1=function(e,t){return"EventDropChart"===e?"An event-drop physics chart that collapses moving events into a settled projection by event-time window.":"GaltonBoardChart"===e?"A Galton board chart that collapses falling samples into a settled histogram projection.":"PhysicsPileChart"===e?"A physics pile chart that collapses moving bodies into a settled bar-style projection by container.":"CollisionSwarmChart"===e?"A collision swarm chart that separates overlapping points while preserving their quantitative axis position.":"PhysicalFlowChart"===e?"A physical flow chart that keeps authored routes visible while packet bodies show throughput and proximity events.":`A ${t} whose accessible reading is the settled projection rather than individual trajectories.`}(e,t)),!r.has("l2")&&!r.has("l3"))return;if(!i||0===i.length)return void(r.has("l2")&&(n.l2="No settled projection is loaded yet."));const l=i.reduce((e,t)=>e+t.count,0),c=i.filter(e=>e.count>0).sort((e,t)=>t.count-e.count),d=c[0]??i.slice().sort((e,t)=>t.count-e.count)[0];if(!d)return;const u=i.reduce((e,t)=>e+(t.secondary??0),0),m=i.find(e=>e.secondaryLabel)?.secondaryLabel??"secondary";if(r.has("l2"))if(0===c.length)n.l2=`The settled projection contains ${o(l)} ${ht(l,s)} across ${i.length} ${ht(i.length,a)}; no ${ht(2,a)} are non-empty yet.`;else{const e=u>0?` ${o(u)} ${ht(u,s)} ${1===u?"is":"are"} marked ${m}.`:"";n.l2=`The settled projection contains ${o(l)} ${ht(l,s)} across ${i.length} ${ht(i.length,a)}; ${c.length} ${ht(c.length,a)} ${1===c.length?"is":"are"} non-empty. The largest ${a} is ${d.label} with ${o(d.count)} ${ht(d.count,s)}.${e}`}if(r.has("l3")&&l>0&&c.length>0){const e=c.find(e=>e!==d),t=function(e,t){if(0>=t)return"0%";const i=e/t*100;return(10>i?Math.round(10*i)/10:Math.round(i))+"%"}(d.count,l);n.l3=e?`The settled projection is most concentrated in ${d.label}, which holds ${o(d.count)} ${ht(d.count,s)} (${t}); ${e.label} follows with ${o(e.count)} ${ht(e.count,s)}.`:`The settled projection is concentrated in ${d.label}, which holds all ${o(d.count)} ${ht(d.count,s)}.`}}(e,c,m,v,a,l),a.has("l1")&&!Je.has(e))if(Fe.has(e)||Ee.has(e))v.l1=`A ${c} of ${b} by ${y}`+(u?`, split by ${u}.`:".");else if(Oe.has(e))v.l1=`A ${c} showing ${b} across ${y} categories.`;else if(He.has(e))v.l1=`A ${c} of the distribution of ${b}`+(u?` by ${u}.`:".");else if(qe.has(e)){const e=Array.isArray(t.nodes)?t.nodes.length:void 0,i=Array.isArray(t.edges)?t.edges.length:void 0,n=[null!=e?`${e} ${ht(e,"node")}`:null,null!=i?`${i} ${ht(i,"edge")}`:null].filter(Boolean);v.l1=`A ${c}${n.length?" with "+n.join(" and "):""}.`}else if("BigNumber"===e){const e="string"==typeof t.label?t.label:b;v.l1=`A single value${e?" for "+e:""}.`}else v.l1=`A ${c}.`;const x=Fe.has(e)||Ee.has(e)||Oe.has(e)||He.has(e);let w=null;if((a.has("l2")||a.has("l3")||a.has("l4"))&&x&&d&&d.length>0&&(w=function(e,t,i,n){let r=0,o=0,a=1/0,s=-1/0,l=null,c=null,d=0,u=0,m=null,p=null,h=NaN,f=NaN;for(const i of e){const e=t(i);Number.isFinite(e)&&(0===r&&(h=e,m=i),f=e,p=i,a>e&&(a=e,l=i,d=r),e>s&&(s=e,c=i,u=r),r++,o+=e)}return 0===r?null:{count:r,min:a,max:s,mean:o/r,minLabel:Ue(null!=l?i(l):null,n),maxLabel:Ue(null!=c?i(c):null,n),first:h,last:f,firstLabel:Ue(null!=m?i(m):null,n),lastLabel:Ue(null!=p?i(p):null,n),minIndex:d,maxIndex:u}}(d,i(p,h),n(f,g),l)),a.has("l2")&&x&&(d&&0!==d.length?w&&(v.l2=Oe.has(e)?`${w.count} segments totaling ${l(function(e){return e.mean*e.count}(w))}. Largest is ${w.maxLabel} at ${l(w.max)}; smallest is ${w.minLabel} at ${l(w.min)}.`:`${b} ranges from ${l(w.min)} (${w.minLabel}) to ${l(w.max)} (${w.maxLabel}), with a mean of ${l(w.mean)} across ${w.count} points.`):v.l2="No data is loaded yet."),a.has("l3")&&w&&!u&&Fe.has(e)?v.l3=function(e,t,i){const{first:n,last:r,min:o,max:a,maxLabel:s,minLabel:l,firstLabel:c,lastLabel:d,minIndex:u,maxIndex:m,count:p}=e,h=a-o,f=r-n;if(0===h)return`${pt(t)} is constant at ${i(n)} across the series.`;if(.04>h/(Math.abs(e.mean)||1))return`${pt(t)} ends roughly where it started (${i(n)} at ${c} to ${i(r)} at ${d}), ranging between ${i(o)} and ${i(a)}.`;const g=m>0&&p-1>m,b=u>0&&p-1>u,y=(a-Math.max(n,r))/h,v=(Math.min(n,r)-o)/h;return g&&y>.15?`Overall ${t} climbs to a peak of ${i(a)} (${s}), then falls to ${i(r)} (${d}).`:b&&v>.15?`Overall ${t} drops to a low of ${i(o)} (${l}), then recovers to ${i(r)} (${d}).`:.05>Math.abs(f)/h?`${pt(t)} ends roughly where it started (${i(n)} at ${c} to ${i(r)} at ${d}), ranging between ${i(o)} and ${i(a)}.`:f>0?m===p-1?`Overall ${t} rises from ${i(n)} (${c}) to a peak of ${i(r)} (${d}).`:`Overall ${t} rises from ${i(n)} (${c}) to ${i(r)} (${d}), after peaking at ${i(a)} (${s}).`:u===p-1?`Overall ${t} falls from ${i(n)} (${c}) to a low of ${i(r)} (${d}).`:`Overall ${t} falls from ${i(n)} (${c}) to ${i(r)} (${d}), after dipping to ${i(o)} (${l}).`}(w,b,l):a.has("l3")&&w&&!u&&Ee.has(e)&&(v.l3=`The highest ${y} is ${w.maxLabel} and the lowest is ${w.minLabel}.`),a.has("l4")){const i=st(t)?"alerting":it(e,r.capability);i&&(v.l4=function(e,t,i,n,r,o,a,s){const l=et[e],c=/^[aeiou]/i.test(l)?"an":"a";let d,u;switch(e){case"locating":d="This is a map",u="read values by location";break;case"presenting":d="This is a single-value display",u=`read ${"string"==typeof i.label&&i.label?i.label:r} as the headline number`;break;case"tracing":d=`This is ${c} ${l} chart`,u="follow the movement between states";break;case"nesting":d=`This is ${c} ${l} chart`,u="read it for nested structure and how children sum into their parents";break;case"relating":d=`This is ${c} ${l} chart`,u=`read it for whether ${o} and ${r} move together`;break;default:d=`This is ${c} ${l} chart`,u=function(e,t,i,n,r,o){if(!t)switch(e){case"alerting":return"watch for points that break from the rest";case"tracking":return"read it for the overall direction of "+i;case"comparing":return`compare ${i} across ${n}`;case"ranking":return"read it top to bottom by "+i;case"apportioning":return`read each ${n}'s share of the whole`;case"characterizing":return"read it for the spread and shape of "+i;default:return"read the highlighted features"}switch(e){case"alerting":return function(e,t,i){if(Ee.has(i)||Oe.has(i))return`${e.maxLabel} stands out at ${t(e.max)} — check it first`;const{first:n,last:r,min:o,max:a,minLabel:s,maxLabel:l,lastLabel:c,minIndex:d,maxIndex:u,count:m}=e,p=a-o;if(p>0){const e=u>0&&m-1>u,i=d>0&&m-1>d,h=(a-Math.max(n,r))/p,f=(Math.min(n,r)-o)/p;if(e&&h>.15)return`the peak of ${t(a)} at ${l} is the point to investigate`;if(i&&f>.15)return`the dip to ${t(o)} at ${s} is the point to investigate`;if(r>=a)return`the climb to ${t(r)} at ${c} warrants a closer look`;if(o>=r)return`the drop to ${t(r)} at ${c} warrants a closer look`}return`the extremes — ${l} (${t(a)}) and ${s} (${t(o)}) — are the points to check`}(t,r,o);case"tracking":return`read it for the trajectory of ${i}, which ${function(e){const t=e.max-e.min,i=e.last-e.first;return 0===t||.05>Math.abs(i)/t?"holds roughly steady":i>0?"rises":"falls"}(t)} from ${r(t.first)} (${t.firstLabel}) to ${r(t.last)} (${t.lastLabel})`;case"comparing":return`compare ${i} across ${n}; ${t.maxLabel} leads at ${r(t.max)}`;case"ranking":return`read it top to bottom by ${i}; ${t.maxLabel} ranks highest at ${r(t.max)}`;case"apportioning":{const e=t.mean*t.count,i=e>0?Math.round(t.max/e*100):null;return`read each ${n}'s share of the ${r(e)} total; ${t.maxLabel} is the largest at ${r(t.max)}${null!=i?` (${i}%)`:""}`}case"characterizing":return`read it for the spread of ${i}, from ${r(t.min)} to ${r(t.max)}`;default:return"read the highlighted features"}}(e,n,r,o,a,t)}return`${d}; ${u}.${function(e,t){if(!t)return"";const i=t.familiarity?.[e];return"number"!=typeof i||i>2?"":` This ${Ze(e)} may be unfamiliar${t.name?` to ${t.name.toLowerCase()} readers`:""} — lean on this description.`}(t,s)}`}(i,e,t,u?null:w,b,y,l,r.audience))}const k=["l1","l2","l3","l4"].filter(e=>a.has(e)&&v[e]).map(e=>v[e]).join(" "),$=ut(t);return{text:$?`${$} ${k}`.trim():k,levels:v,...$?{annotations:$}:{}}}function pt(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function ht(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:t+"s"}function ft(e){return((e??"unknown")+"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function gt(e,t,i={}){const n=Z(t),r=J(t),o=Math.max(1,i.maxLeaves??200);if("function"==typeof e.navigation)return e.navigation({data:n,config:r,locale:i.locale??"en"});const a=(s=e.navigation)&&"object"==typeof s?e.navigation:void 0;var s;const l=(a?.groupByRole?K(e,a.groupByRole):void 0)??(a?.groupBy?.[0]?K(e,a.groupBy[0])??e.dataRoles.find(e=>e.field===a.groupBy?.[0]):void 0)??Q(e,["nominal","ordinal"]),c=l?X(l,r,n):void 0,d=(a?.idRole?K(e,a.idRole):void 0)??Q(e,["identifier"]),u=d?X(d,r,n):void 0,m={id:"root",role:"chart",label:a?.summaryTemplate?Y(a.summaryTemplate,void 0,e,r,n,{count:n.length}):`${e.name}: ${n.length} ${1===n.length?"item":"items"} represented.`,level:1,children:[]};let p=0;const h=(t,i,o)=>{const s=u?t[u]:void 0,l=a?.itemLabelTemplate?Y(a.itemLabelTemplate,t,e,r,n,{count:n.length}):function(e,t,i,n){const r=Q(t,["nominal","ordinal"]),o=t.dataRoles.filter(e=>"quantitative"===e.semanticType),a=r?X(r,i,n):void 0,s=[];a&&null!=e[a]&&s.push(e[a]+"");for(const t of o){const r=X(t,i,n);r&&null!=e[r]&&s.push(`${t.role}: ${e[r]+""}`)}return s.length>0?s.join(", "):"Data item"}(t,e,r,n);return{id:"datum-"+ft(s??i),role:"datum",label:l,level:o,datum:t}};if(c){const e=new Map;for(const t of n){const i=(t[c]??"Uncategorized")+"",n=e.get(i);n?n.push(t):e.set(i,[t])}m.children=[...e].map(([e,t],i)=>{const n=t.slice(0,Math.max(0,o-p));p+=n.length;const r=n.map((e,t)=>h(e,1e5*i+t,3));return t.length>n.length&&r.push({id:"more-"+ft(e),role:"datum",label:`…and ${t.length-n.length} more items`,level:3}),{id:"group-"+ft(e),role:"series",label:`${e}: ${t.length} ${1===t.length?"item":"items"}.`,level:2,children:r}})}else{const e=n.slice(0,o);m.children=e.map((e,t)=>h(e,t,2)),n.length>e.length&&m.children.push({id:"more",role:"datum",label:`…and ${n.length-e.length} more items`,level:2})}return m}function bt(e,t,r={}){const o=r.locale??"en",a=Math.max(1,r.maxLeaves??200),s=lt(o),l=_(e,t,r.recipe);if(l)return gt(l,t,{maxLeaves:a,locale:o});const c={id:"root",role:"chart",label:mt(e,t,{locale:o}).text||"Chart.",level:1,children:[]},d=function(e,t){const i=Array.isArray(e.annotations)?e.annotations:null;if(!i)return null;const n=Te(i.filter(e=>!!e&&"object"==typeof e));if(0===n.length)return null;let r=0;const o=n.slice(0,t).map(e=>{const t=e.lifecycle?.status,i=t&&"accepted"!==t?` (${t})`:"";return{id:"annotation-"+r++,role:"annotation",level:3,label:`${n=dt(e),n?n.charAt(0).toUpperCase()+n.slice(1):n}${i}.`,datum:e};var n});n.length>t&&o.push({id:"annotation-"+r++,role:"annotation",level:3,label:`…and ${n.length-t} more annotations.`});const a=n.length;return{id:"annotations",role:"annotation",level:2,label:`Annotations: ${1===a?"one marked feature":a+" marked features"}.`,children:o}}(t,a),u=Array.isArray(t.data)?t.data:null,m=Fe.has(e)||Ee.has(e)||Oe.has(e)||He.has(e);if(!u||0===u.length||!m)return d&&(c.children=[d]),c;const{measure:p,measureFallback:h,dimension:f,dimensionFallback:g}=We(e,t),b=i(p,h),y=n(f,g),v="string"==typeof p&&p?p:h,x="string"==typeof f&&f?f:g,w=Ve(t);let k=0;const $=e=>`${e}-${k++}`,C=(e,t)=>{const i=e.slice(0,a).map(e=>((e,t)=>{const i=b(e),n=Ue(y(e),s);return{id:$("datum"),role:"datum",level:t,label:`${n}: ${Number.isFinite(i)?s(i):"—"}`,value:Number.isFinite(i)?i:void 0,datum:e}})(e,t));return e.length>a&&i.push({id:$("more"),role:"datum",level:t,label:`…and ${e.length-a} more points`}),i},S=[];if(Fe.has(e)||Ee.has(e)){let t=1/0,i=-1/0,n=1/0,r=-1/0;const o=[];let a=!0;for(const e of u){const s=b(e);Number.isFinite(s)&&(t>s&&(t=s),s>i&&(i=s));const l=y(e);o.push(l),"number"==typeof l&&Number.isFinite(l)?(n>l&&(n=l),l>r&&(r=l)):a=!1}const l=new Set,c=[];for(const e of o){const t=e+"";l.has(t)||(l.add(t),c.push(e))}const d=a?`${s(n)} to ${s(r)}`:`${Ue(c[0],s)} to ${Ue(c[c.length-1],s)} (${Ee.has(e)?c.length+" categories":u.length+" points"})`;S.push({id:$("axis"),role:"axis",level:2,label:`${Ee.has(e)?"Category axis":"X axis"}: ${x}, ${d}.`}),t>i||S.push({id:$("axis"),role:"axis",level:2,label:`Value axis: ${v}, ${s(t)} to ${s(i)}.`})}if(w){const i=n(w,w),r=new Map;for(const e of u){const t=(i(e)??"—")+"",n=r.get(t);n?n.push(e):r.set(t,[e])}const a=[];for(const[i,n]of r){const r=mt(e,{...t,data:n},{levels:["l2","l3"],locale:o}).text;a.push({id:$("series"),role:"series",level:2,label:`Series ${i}: ${r}`,children:C(n,3)})}c.children=[...S,...a]}else c.children=[...S,...C(u,2)];return d&&c.children.push(d),c}function yt(e,t){const i=[],n=e=>{if(i.push(e),e.children&&e.children.length>0&&t.has(e.id))for(const t of e.children)n(t)};return n(e),i}function vt(e){let t=1;if(e.children)for(const i of e.children)t+=vt(i);return t}var xt=null,wt=new Set,kt=new Set,$t=1e3;function Ct(e,t,i){const n=e??t;if(!Number.isFinite(n)||0>=n)throw new RangeError(`${i} must be a positive number, got ${n+""}`);return Math.floor(n)}function St(e,t){void 0!==console&&console.warn(`[conversationArc] ${e} failed:`,t)}function At(e,t){try{const i=t();i&&"function"==typeof i.then&&Promise.resolve(i).catch(t=>St(e,t))}catch(t){St(e,t)}}function Nt(e){if(e)return e;try{return globalThis.localStorage??null}catch{return null}}function jt(e,t){if(!e)return[];try{return function(e){if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch(e){return St("localStorage load",e),[]}}(e.getItem(t))}catch(e){return St("localStorage read",e),[]}}var It=Object.freeze([]),Lt=It,Pt=!1;function Rt(){return Pt?(Lt=xt?Object.freeze(xt.buffer.slice()):It,Pt=!1,Lt):Lt}function Mt(){Pt=!0}var Bt=new Set;function Tt(){for(const e of Bt)try{e()}catch(e){void 0!==console&&console.warn("[conversationArc] change subscriber threw:",e)}}function Dt(e){return Bt.add(e),()=>{Bt.delete(e)}}function zt(e){if(!e||"object"!=typeof e)throw new TypeError("registerConversationArcSink: sink must be an object");return kt.add(e),()=>{kt.delete(e)}}function Ft(e={}){const t=e.key??"semiotic:conversation-arc",i=Ct(e.maxEvents,$t,"createLocalStorageConversationArcSink: maxEvents");return{record(n){const r=Nt(e.storage),o=jt(r,t);o.push(n),function(e,t,i,n){if(e)try{e.setItem(t,JSON.stringify(i.slice(-n)))}catch(e){St("localStorage write",e)}}(r,t,o,i)},clear(){const i=Nt(e.storage);if(i)try{i.removeItem(t)}catch(e){St("localStorage clear",e)}},load:()=>jt(Nt(e.storage),t)}}function Et(e={}){const t=e.dbName??"semiotic-conversation-arc",i=e.storeName??"events",n=Ct(e.maxEvents,$t,"createIndexedDBConversationArcSink: maxEvents");let r=null;const o=()=>(r??(r=function(e,t,i){const n=function(e){if(e)return e;try{return globalThis.indexedDB??null}catch{return null}}(i);return n?new Promise(i=>{let r;try{r=n.open(e,1)}catch(e){return St("IndexedDB open",e),void i(null)}r.onupgradeneeded=()=>{const e=r.result;e.objectStoreNames.contains(t)||e.createObjectStore(t,{keyPath:"id",autoIncrement:!0})},r.onsuccess=()=>i(r.result),r.onerror=()=>{St("IndexedDB open",r.error),i(null)},r.onblocked=()=>{St("IndexedDB open",Error("upgrade blocked")),i(null)}}):Promise.resolve(null)}(t,i,e.indexedDB)),r);return{async record(e){const t=await o();t&&(await new Promise(n=>{try{const r=t.transaction(i,"readwrite");r.objectStore(i).add({event:e}),r.oncomplete=()=>n(),r.onerror=()=>{St("IndexedDB record",r.error),n()}}catch(e){St("IndexedDB record",e),n()}}),await function(e,t,i){return e?new Promise(n=>{try{const r=e.transaction(t,"readwrite"),o=r.objectStore(t),a=o.getAll();a.onsuccess=()=>{const e=Array.isArray(a.result)?a.result:[],t=e.length-i;if(t>0)for(const i of e.slice(0,t))null!=i.id&&o.delete(i.id)},a.onerror=()=>St("IndexedDB trim",a.error),r.oncomplete=()=>n(),r.onerror=()=>{St("IndexedDB trim",r.error),n()}}catch(e){St("IndexedDB trim",e),n()}}):Promise.resolve()}(t,i,n))},async clear(){const e=await o();e&&await new Promise(t=>{try{const n=e.transaction(i,"readwrite");n.objectStore(i).clear(),n.oncomplete=()=>t(),n.onerror=()=>{St("IndexedDB clear",n.error),t()}}catch(e){St("IndexedDB clear",e),t()}})},load:async()=>function(e,t){return e?new Promise(i=>{try{const n=e.transaction(t,"readonly").objectStore(t).getAll();n.onsuccess=()=>{i((Array.isArray(n.result)?n.result:[]).map(e=>e.event).filter(Boolean))},n.onerror=()=>{St("IndexedDB load",n.error),i([])}}catch(e){St("IndexedDB load",e),i([])}}):Promise.resolve([])}(await o(),i)}}function Ot(e){if(!e.url)throw new TypeError("createWebhookConversationArcSink: url is required");const t=e.method??"POST";return{record(i){const n=e.fetch??globalThis.fetch;if(!n)return;const r=e.mapEvent?e.mapEvent(i):i;return n(e.url,{method:t,headers:{"Content-Type":"application/json",...e.headers},body:JSON.stringify(r)}).then(()=>{})}}}function Ht(e,t={}){const i=Array.isArray(e)?e.slice():[],n=Ct(t.capacity,Math.max(xt?.capacity??$t,i.length,1),"loadConversationArc: capacity"),r=t.sessionId??i[0]?.sessionId??xt?.sessionId??Gt();for(xt?(xt.enabled=t.enabled??!1,xt.sessionId=r,xt.capacity=n):xt={enabled:t.enabled??!1,sessionId:r,capacity:n,buffer:[]},t.append||(xt.buffer=[]),xt.buffer.push(...i);xt.buffer.length>xt.capacity;)xt.buffer.shift();return Mt(),Tt(),Rt()}function Wt(e,t={}){return Ht(e,t)}function Vt(e,t,i){return Xt.record({type:"audience-set",audience:e,previous:t??void 0,...i})}function Ut(e,t){return Xt.record({type:"annotation-status-changed",toStatus:e,annotationId:t?.annotationId,fromStatus:t?.fromStatus,chartId:t?.chartId,arcId:t?.arcId,meta:t?.meta})}function Gt(){return`arc-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function qt(){return xt}function Jt(e={}){const t=e.capacity??1e3;if(!Number.isFinite(t)||0>=t)throw new RangeError("enableConversationArc: capacity must be a positive number, got "+t);if(xt){if(xt.enabled=!0,e.sessionId&&(xt.sessionId=e.sessionId),null!=e.capacity){for(xt.capacity=t;xt.buffer.length>xt.capacity;)xt.buffer.shift();Mt()}}else xt={enabled:!0,sessionId:e.sessionId??Gt(),capacity:t,buffer:[]},Mt();return Tt(),Xt}function Zt(){xt&&(xt.enabled=!1,Tt())}function _t(){return Xt}var Xt={get enabled(){return xt?.enabled??!1},get sessionId(){return xt?.sessionId??null},get capacity(){return xt?.capacity??0},record(e){const t=qt();if(!t||!t.enabled)return null;const i={...e,timestamp:e.timestamp??Date.now(),sessionId:e.sessionId??t.sessionId};for(t.buffer.push(i);t.buffer.length>t.capacity;)t.buffer.shift();Mt(),Tt();for(const e of wt)try{e(i)}catch(e){void 0!==console&&console.warn("[conversationArc] subscriber threw:",e)}return function(e){for(const t of kt)t.record&&At("sink record",()=>t.record?.(e))}(i),i},flush(){const e=qt();if(!e)return[];const t=e.buffer.slice();return e.buffer=[],Mt(),Tt(),function(e){for(const t of kt)t.flush&&At("sink flush",()=>t.flush?.(e))}(t),t},getEvents:()=>Rt(),subscribe:e=>(wt.add(e),()=>{wt.delete(e)}),clear(){const e=qt();e&&(e.buffer=[],Mt(),Tt()),function(){for(const e of kt)e.clear&&At("sink clear",()=>e.clear?.())}()},reset(){if(wt.clear(),kt.clear(),Lt=It,Pt=!1,!xt)return Tt(),void Bt.clear();xt.buffer=[],xt.enabled=!1,xt=null,Tt(),Bt.clear()}};import*as Kt from"react";import{jsx as Qt,jsxs as Yt}from"react/jsx-runtime";var ei={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function ti({tree:e,label:t,visible:i=!1,className:n,onActiveChange:r,activeId:o,chartId:s,onObservation:l,onAnnotationActivate:c}){const[d,u]=Kt.useState(()=>new Set([e.id])),[p,h]=Kt.useState(e.id),f=void 0!==o,g=f?o:p,b=Kt.useRef(null),y=Kt.useRef(new Map),v=m(e=>e.pushObservation),x=Kt.useCallback(e=>{l?.(e),v?.(e)},[l,v]),w=Kt.useMemo(()=>function(e){const t=new Map,i=e=>{for(const n of e.children??[])t.set(n.id,e),i(n)};return i(e),t}(e),[e]),k=Kt.useMemo(()=>yt(e,d),[e,d]);Kt.useEffect(()=>{f||k.some(e=>e.id===p)||h(e.id)},[k,p,e.id,f]),Kt.useEffect(()=>{const e=[];let t=w.get(g);for(;t;)e.push(t.id),t=w.get(t.id);e.length>0&&u(t=>{if(e.every(e=>t.has(e)))return t;const i=new Set(t);for(const t of e)i.add(t);return i})},[g,w]),Kt.useEffect(()=>{b.current?.contains(document.activeElement)&&y.current.get(g)?.focus()},[g]);const $=Kt.useCallback((e,t,i)=>{const n=_t();n.enabled&&n.record("focus"===t?{type:"nav-node-focused",chartId:s,nodeId:e.id,role:e.role,level:e.level,label:e.label.length>200?e.label.slice(0,200):e.label}:{type:"nav-branch-expanded",chartId:s,nodeId:e.id,role:e.role,level:e.level,expanded:!!i})},[s]),C=Kt.useCallback(e=>{e.id!==g&&(f||h(e.id),r?.(e),$(e,"focus"),e.datum&&x({type:"focus",datum:e.datum,inputType:"navigation-tree",timestamp:Date.now(),chartType:"AccessibleNavTree",chartId:s}))},[r,f,$,g,x,s]),S=Kt.useCallback(e=>{if(e.datum){if("annotation"===e.role){const t=a(e.datum);return c?.({annotation:e.datum,annotationId:t,chartId:s,inputType:"navigation-tree"}),void(t&&x({type:"annotation-activate",annotationId:t,inputType:"navigation-tree",timestamp:Date.now(),chartType:"AccessibleNavTree",chartId:s}))}x({type:"activate",datum:e.datum,inputType:"navigation-tree",timestamp:Date.now(),chartType:"AccessibleNavTree",chartId:s})}},[s,x,c]),A=e=>{u(t=>new Set(t).add(e.id)),$(e,"toggle",!0)},N=e=>{u(t=>{const i=new Set(t);return i.delete(e.id),i}),$(e,"toggle",!1)},j=(e,t,n)=>{const r=!!e.children&&e.children.length>0,o=d.has(e.id);return Yt("li",{role:"treeitem","aria-label":e.label,"aria-level":e.level,"aria-posinset":t,"aria-setsize":n,"aria-expanded":r?o:void 0,"aria-selected":e.id===g,tabIndex:e.id===g?0:-1,ref:t=>{y.current.set(e.id,t)},onClick:t=>{t.stopPropagation(),C(e),r?(o?N:A)(e):S(e)},style:i?{listStyle:"none",padding:"2px 6px",paddingLeft:6+16*(e.level-1),cursor:r?"pointer":"default",fontSize:13,color:"var(--semiotic-text, currentColor)",background:e.id===g?"var(--semiotic-surface, var(--semiotic-grid, var(--semiotic-bg, #f0f4f8)))":"transparent",outline:"none"}:void 0,children:[Yt("span",{className:"semiotic-nav-tree-label semiotic-nav-tree-"+e.role,children:[i&&r?o?"▾ ":"▸ ":"",e.label]}),r&&o&&Qt("ul",{role:"group",style:i?{margin:0,padding:0}:void 0,children:e.children.map((t,i)=>j(t,i+1,e.children.length))})]},e.id)};return Qt("div",{ref:b,className:"semiotic-nav-tree"+(n?" "+n:""),style:i?void 0:ei,onKeyDown:e=>{const t=k.findIndex(e=>e.id===g);if(-1===t)return;const i=k[t],n=!!i.children&&i.children.length>0,r=d.has(i.id);let o=!0;switch(e.key){case"ArrowDown":C(k[Math.min(t+1,k.length-1)]);break;case"ArrowUp":C(k[Math.max(t-1,0)]);break;case"Home":C(k[0]);break;case"End":C(k[k.length-1]);break;case"ArrowRight":n&&!r?A(i):n&&r?C(i.children[0]):o=!1;break;case"ArrowLeft":if(n&&r)N(i);else{const e=w.get(i.id);e?C(e):o=!1}break;case"Enter":case" ":n?(r?N:A)(i):S(i);break;default:o=!1}o&&(e.preventDefault(),e.stopPropagation())},children:Qt("ul",{role:"tree","aria-label":t||"Chart navigation",style:i?{margin:0,padding:0}:void 0,children:j(e,1,1)})})}var ii=new Set(["LineChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","ConnectedScatterplot","BubbleChart","QuadrantChart","MultiAxisLineChart","CandlestickChart","Heatmap","MinimapChart","RealtimeLineChart","RealtimeHeatmap"]),ni=new Set(["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","DotPlot","RidgelinePlot","FunnelChart","LikertChart","SwimlaneChart"]),ri={Scatterplot:["pointRadius","hoverRadius"],BubbleChart:["pointRadius","hoverRadius"],ConnectedScatterplot:["pointRadius","hoverRadius"],QuadrantChart:["pointRadius","hoverRadius"],SwarmPlot:["pointRadius","hoverRadius"],DotPlot:["dotRadius","hoverRadius"]};function oi(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function ai(e){return"string"==typeof e&&e.trim().length>0}function si(e){const t=oi(e.capability)?e.capability:null,i=oi(e.recipe)?e.recipe:null,n=[e.mobileSemantics,e.mobileVisualization,e.mobile,t?.mobile,i?.mobile];for(const e of n)if(oi(e))return e;return null}function li(e){return Array.isArray(e)&&e.length>=2&&"number"==typeof e[0]&&"number"==typeof e[1]&&Number.isFinite(e[0])&&Number.isFinite(e[1])?[e[0],e[1]]:null}function ci(e){return li(e.size)||li(oi(e.frameProps)?e.frameProps.size:void 0)||("number"==typeof e.width&&"number"==typeof e.height?[e.width,e.height]:null)}function di(e,t){e.push({...t,status:"pass"})}function ui(e,t){e.push({...t,status:"warn"})}function mi(e,t){e.push({...t,status:"manual"})}function pi(e,t={},i={}){const n=i.viewportWidth??390,r=i.targetSize??44,o=ci(t),a=l(t,{width:n,height:o?.[1]}),s=[],c=ci(t=a.props),d=si(t),u=function(e,t){return e.includes("CustomChart")||e.includes("Custom")||null!=t.recipeId||null!=t.mobileSemantics}(e,t),m=function(e){const t=si(e);return!0===e.responsive||!0===e.mobile||!0===t?.responsive||!0===t?.supportsResponsiveLayout||Array.isArray(t?.breakpoints)||"number"==typeof t?.minViewportWidth||"responsive"===t?.strategy||"small-multiples"===t?.strategy||"summary-cards"===t?.strategy||null!=e.mobileLayout||null!=e.responsiveRules||"mobile-readable"===e.density}(t),p=!0===i.inChartContainer,h=ai(t.title)||ai(t.summary)||ai(t.description)||!0===d?.summary||ai(d?.summary);if(a.matches.length>0&&di(s,{id:"layout.responsive-rule-applied",category:"layout",impact:"medium",message:`${a.matches.length} responsive rule(s) applied for the ${n}px mobile audit.`}),c){const[t,i]=c;t>n&&!m?ui(s,{id:"layout.fixed-desktop-size",category:"layout",impact:"high",message:`Chart size is ${t}px wide against a ${n}px mobile viewport with no responsive/mobile transform hint.`,fix:"Use responsive sizing, responsiveRules/mobileLayout, or an explicit mobile variant that preserves the task instead of clipping the desktop chart."}):di(s,{id:"layout.fixed-desktop-size",category:"layout",impact:"high",message:"No fixed desktop-width overflow risk is visible from the config."}),"number"==typeof d?.minViewportWidth&&d.minViewportWidth>n&&ui(s,{id:"layout.mobile-min-width",category:"layout",impact:"high",message:`The declared mobile contract supports ${d.minViewportWidth}px minimum, wider than the audited ${n}px viewport.`,fix:"Add a narrower breakpoint, summary-card fallback, or explicit horizontal-scroll affordance with a non-visual equivalent."});const r=t/Math.max(1,i);430>=n&&r>2.4&&"BigNumber"!==e&&ui(s,{id:"layout.wide-aspect-ratio",category:"layout",impact:"medium",message:`Chart aspect ratio is ${r.toFixed(1)}:1, which tends to compress phone charts vertically.`,fix:"Prefer stacked sections, small multiples, cards plus a sparkline, or a taller mobile-specific chart ratio."}),160>i&&"BigNumber"!==e&&ui(s,{id:"layout.too-short-for-reading",category:"layout",impact:"medium",message:`Chart height is ${i}px; most phone charts need enough vertical room for marks plus readable labels.`,fix:"Reserve more vertical space, remove nonessential axes, or switch to a card/sparkline pattern with external labels."})}else mi(s,{id:"layout.unknown-size",category:"layout",impact:"medium",message:"No explicit size is available to audit. This may be responsive, but static mobile overflow cannot be checked.",fix:"Audit rendered widths at 320, 360, 390, and 430px, or pass size/responsiveRules metadata into the config."});const f=function(e){const t=[e.data,e.points,e.lines,e.nodes,e.edges,e.areas,oi(e.frameProps)?e.frameProps.data:void 0];let i=0;for(const e of t)Array.isArray(e)&&(i+=e.length);return i}(t);f>0&&(f>("number"==typeof d?.maxMarks?d.maxMarks:ii.has(e)?1.25*n:ni.has(e)?Math.max(8,Math.floor(n/34)):n)?ui(s,{id:"density.mark-budget",category:"density",impact:ii.has(e)?"medium":"high",message:`${f} data item(s) exceed the rough mobile density budget for ${e} at ${n}px.`,fix:"Aggregate, filter, facet into small multiples, switch to a summary-card plus detail view, or use progressive disclosure."}):di(s,{id:"density.mark-budget",category:"density",impact:"medium",message:f+" data item(s) are within the rough mobile density budget for this component."}));const g=function(e){const t=[e.tickValues,e.xTickValues,e.yTickValues,e.rTickValues,e.oTickValues];let i=0;for(const e of t)Array.isArray(e)&&(i+=e.length);return i>0?i:null}(t),b=!1!==t.showAxes&&!1!==t.axis;if(b&&null!=g){const e=Math.max(3,Math.floor(n/58));g>e&&ui(s,{id:"density.explicit-tick-count",category:"density",impact:"medium",message:`${g} explicit tick(s) exceed a phone-friendly budget of about ${e} at ${n}px.`,fix:"Use adaptive ticks, fewer tickValues, direct labels, or move exact values into a tap-accessible detail panel."})}else b&&(ii.has(e)||ni.has(e))&&mi(s,{id:"density.axis-label-collision",category:"density",impact:"medium",message:"Axes are enabled, but label collision depends on rendered tick text and cannot be checked statically.",fix:"Verify tick labels at phone widths or provide explicit mobile tick density."});!function(e){const t=oi(e.frameProps)?e.frameProps:{};return(!0===e.enableHover||null!=e.tooltipContent||null!=e.tooltip||null!=t.tooltipContent||!0===t.enableHover)&&!function(e){const t=si(e),i=oi(e.mobileInteraction)?e.mobileInteraction:null;return null!=e.controls||null!=e.mobileControls||!0===e.alternativeControls||null!=e.selection||null!=e.onClick||null!=e.onSelect||!0===e.mobileInteraction||!0===i?.tapToSelect||!0===i?.tapToLockTooltip||Array.isArray(t?.interaction?.alternatives)&&t.interaction.alternatives.length>0||"tap"===t?.interaction?.primary||"button"===t?.interaction?.primary||ai(t?.interaction?.hoverFallback)}(e)}(t)?di(s,{id:"interaction.hover-only-detail",category:"interaction",impact:"high",message:"No hover-only detail path is visible from the config."}):ui(s,{id:"interaction.hover-only-detail",category:"interaction",impact:"high",message:"The chart exposes tooltip/hover detail without an obvious tap, selection, or control alternative.",fix:"Enable tap-to-select, a persistent details panel, visible segment buttons, or another non-hover path for the same information."});const y=function(e,t){const i=ri[e];if(!i)return null;let n=i.includes("hoverRadius")?30:null;for(const e of i){const i=t[e];"number"==typeof i&&Number.isFinite(i)&&i>0&&(n=null==n?i:Math.max(n,i))}return null==n?null:2*n}(e,t),v=oi(t.mobileInteraction)?t.mobileInteraction:null,x=y??("number"==typeof v?.targetSize?v.targetSize:!0===t.mobileInteraction?44:"number"==typeof d?.minimumHitTarget?d.minimumHitTarget:"number"==typeof d?.interaction?.targetSize?d.interaction.targetSize:null);null!=x&&(24>x?ui(s,{id:"interaction.target-size-minimum",category:"interaction",impact:"high",message:`Small interactive marks expose an estimated ${x}px pointer target, below WCAG's 24px minimum.`,fix:"Increase mark radius/hoverRadius, add tap snapping to nearest datum, or provide larger external controls."}):r>x?ui(s,{id:"interaction.target-size-comfort",category:"interaction",impact:"medium",message:`Pointer target is about ${x}px, above 24px but below the ${r}px comfortable phone target.`,fix:"Use hoverRadius/tapRadius near 44px while keeping the visible mark small if needed."}):di(s,{id:"interaction.target-size-comfort",category:"interaction",impact:"medium",message:`Pointer target is about ${x}px, meeting the configured ${r}px target.`}));const w=[];null==t.brush&&null==t.onBrush||w.push("brush"),!0===t.zoomable&&w.push("pan/zoom"),"isolate"!==t.legendInteraction&&"highlight"!==t.legendInteraction||w.push("legend filtering"),w.length>0&&!function(e,t){const i=si(e),n=oi(e.mobileInteraction)?e.mobileInteraction:null,r=n?.standardControls;return!!(null!=e.controls||null!=e.mobileControls||!0===e.alternativeControls||Array.isArray(i?.interaction?.alternatives)&&i.interaction.alternatives.length>0)||!0===r||"all"===r||t.every(e=>"brush"===e?Array.isArray(r)?r.includes("brush"):"brush"===r:"pan/zoom"===e?Array.isArray(r)?r.includes("zoom"):"zoom"===r:"legend filtering"===e&&(Array.isArray(r)?r.includes("legend"):"legend"===r))}(t,w)&&ui(s,{id:"interaction.complex-gesture-alternative",category:"interaction",impact:"high",message:`Mobile-hostile complex interaction detected: ${w.join(", ")} without standard control alternatives.`,fix:"Pair gestures with buttons, range inputs, chips, or a details panel that works with touch and keyboard."}),!1===t.showLegend||!1===t.legend||!0!==t.showLegend&&!0!==t.legend&&null==t.colorBy&&null==t.groupBy&&null==t.lineBy&&null==t.areaBy&&null==t.stackBy||!0===t.directLabel||!0===t.showLabels||"direct"===t.labelStrategy||"direct-end"===t.labelStrategy||"direct"===d?.labels?.strategy||"inline"===d?.labels?.strategy||"external"===d?.labels?.strategy||n>430||ui(s,{id:"semantics.legend-over-direct-labels",category:"semantics",impact:"medium",message:"The chart appears to rely on a legend instead of direct labels at phone width.",fix:"Prefer direct end labels, inline labels, or a compact chip selector so readers do not bounce between plot and legend."});const k=Array.isArray(t.annotations)?t.annotations.filter(e=>oi(e)):[];if(k.length>("number"==typeof d?.maxAnnotations?d.maxAnnotations:3)&&430>=n&&ui(s,{id:"annotation.mobile-density",category:"annotation",impact:"medium",message:k.length+" annotation(s) compete for phone plot space.",fix:"Assign annotation priority, collapse secondary notes into a callout list, or provide shorter mobileText."}),k.length>0){const e=k.filter(e=>!ai(e.mobileText)&&!ai(e.shortText)&&!ai(e.label));e.length>0&&mi(s,{id:"annotation.mobile-copy",category:"annotation",impact:"low",message:e.length+" annotation(s) lack explicit short/mobile copy.",fix:"Add mobileText or shortText for notes that need to survive narrow layouts."})}m||"BigNumber"===e||mi(s,{id:"layout.no-responsive-transform",category:"layout",impact:"low",message:"No explicit responsive transformation hint is present.",fix:"Declare responsiveRules/mobileLayout or a density/label strategy so the mobile version is a designed transformation, not an accidental resize."}),u&&(d?(di(s,{id:"semantics.custom-mobile-contract",category:"semantics",impact:"medium",message:"Custom chart/recipe provides a mobileSemantics/mobile contract, so the audit can inspect its authored phone behavior."}),!1===d.custom?.dataBearingSceneNodes?ui(s,{id:"semantics.custom-data-bearing-scene",category:"semantics",impact:"medium",message:"Custom mobile contract says emitted scene nodes are not data-bearing.",fix:"Preserve datum references, semantic roles, or accessible-table fields so intelligence, navigation, and tap details can recover the chart's meaning."}):!0!==d.custom?.dataBearingSceneNodes&&mi(s,{id:"semantics.custom-data-bearing-scene",category:"semantics",impact:"low",message:"Custom chart mobile contract does not state whether scene nodes are data-bearing.",fix:"Set mobile.custom.dataBearingSceneNodes and mobile.custom.navigationGranularity for custom layouts and interoperability adapters."})):mi(s,{id:"semantics.custom-mobile-contract",category:"semantics",impact:"medium",message:"Custom chart layout is opaque to static mobile analysis because no mobileSemantics/mobile contract is present.",fix:"Declare mobileSemantics with strategy, breakpoints, mark budgets, touch target size, interaction alternatives, and custom scene semantics."})),h||p||ui(s,{id:"semantics.no-mobile-summary",category:"semantics",impact:"medium",message:"No title, summary, description, or ChartContainer context is visible from the config.",fix:"Add title/summary text or wrap in ChartContainer so the small-screen reader gets the task before the chart."});const $=s.filter(e=>"warn"===e.status),C={highRisk:$.filter(e=>"high"===e.impact).length,warnings:$.length,manual:s.filter(e=>"manual"===e.status).length,passes:s.filter(e=>"pass"===e.status).length};return{component:e,viewportWidth:n,ok:0===C.highRisk,summary:C,findings:s,reference:"Mobile visualization audit: informed by MobileVisFixer, mobile exploratory interaction research, small-multiple mobile studies, responsive visualization grammars, constraint-based breakpoints, and WCAG 2.2 input modalities."}}var hi={pass:"PASS",warn:"WARN",manual:"MANUAL","not-applicable":"N/A"},fi=["layout","density","interaction","annotation","semantics"];function gi(e){const t=[],i=e.summary,n=e.ok?`no high-risk mobile blockers at ${e.viewportWidth}px`:`${i.highRisk} high-risk mobile issue(s) at ${e.viewportWidth}px`;t.push(`${e.ok?"PASS":"WARN"} ${e.component}: mobile visualization audit`),t.push(` ${n} - ${i.warnings} warning(s) - ${i.manual} manual check(s)`);for(const i of fi){const n=e.findings.filter(e=>e.category===i&&"not-applicable"!==e.status);if(0!==n.length){t.push(""),t.push(" "+i.toUpperCase());for(const e of n)t.push(` ${hi[e.status]} [${e.impact}] ${e.id}: ${e.message}`),!e.fix||"warn"!==e.status&&"manual"!==e.status||t.push(" -> "+e.fix)}}return t.push(""),t.push(" Ref: "+e.reference),t.join("\n")}function bi(){return["Static audit only: rendered label collision, CSS-resolved type size, and actual touch behavior still require viewport testing.","Use multiple widths, usually 320, 360, 390, 430, and 768 CSS pixels.","A mobile pass means no high-risk static warnings, not that the chart is perceptually or ergonomically optimal."]}import*as yi from"react";function vi(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function xi(e){return e&&"object"==typeof e&&"number"==typeof e.targetSize?e.targetSize:void 0}function wi(e){return Array.isArray(e)?e.length>0:!!e}import{Fragment as ki,jsx as $i,jsxs as Ci}from"react/jsx-runtime";var Si={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function Ai(){const e=d();return e?$i("button",{className:"semiotic-chart-action",onClick:e,title:"Data summary","aria-label":"Toggle data summary",style:Di,children:Ci("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[$i("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),$i("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),$i("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"})]})}):null}var Ni={info:"var(--semiotic-info, #2563eb)",success:"var(--semiotic-success, #16a34a)",warning:"var(--semiotic-warning, #d97706)",error:"var(--semiotic-error, var(--semiotic-danger, #dc2626))",neutral:"var(--semiotic-text-secondary, #6b7280)"},ji={error:4,warning:3,info:2,success:1,neutral:0};function Ii({level:e}){const t={width:15,height:15,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};switch(e){case"error":case"warning":return Ci("svg",{...t,children:[$i("path",{d:"M8 1.8 15 14H1L8 1.8Z"}),$i("path",{d:"M8 6.4v3.4"}),$i("circle",{cx:"8",cy:"11.8",r:"0.5",fill:"currentColor",stroke:"none"})]});case"success":return Ci("svg",{...t,children:[$i("circle",{cx:"8",cy:"8",r:"6.4"}),$i("path",{d:"M5 8.2 7 10.2 11 5.8"})]});case"info":return Ci("svg",{...t,children:[$i("circle",{cx:"8",cy:"8",r:"6.4"}),$i("path",{d:"M8 7.4V11"}),$i("circle",{cx:"8",cy:"5",r:"0.5",fill:"currentColor",stroke:"none"})]});default:return Ci("svg",{...t,children:[$i("path",{d:"M8 2a3.5 3.5 0 0 0-3.5 3.5c0 4-1.5 5-1.5 5h10s-1.5-1-1.5-5A3.5 3.5 0 0 0 8 2Z"}),$i("path",{d:"M6.5 13a1.5 1.5 0 0 0 3 0"})]})}}function Li({notification:e,level:t,onDismiss:i}){const n=Ni[t]??Ni.info,r=!1!==e.dismissible;return Ci("div",{className:"semiotic-chart-notification semiotic-chart-notification--"+t,style:{display:"flex",alignItems:"flex-start",gap:8,padding:"6px 10px",borderRadius:4,borderLeft:"3px solid "+n,background:"var(--semiotic-surface, rgba(127, 127, 127, 0.08))"},children:[Ci("div",{style:{flex:1,minWidth:0},children:[e.source&&$i("div",{className:"semiotic-chart-notification-source",style:{fontSize:9,fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--semiotic-text-secondary, #666)"},children:e.source}),e.title&&$i("div",{className:"semiotic-chart-notification-title",style:{fontSize:12,fontWeight:600,color:n},children:e.title}),$i("div",{className:"semiotic-chart-notification-message",style:{fontSize:12,lineHeight:1.45,color:"var(--semiotic-text, #333)"},children:e.message})]}),r&&$i("button",{className:"semiotic-chart-notification-dismiss","aria-label":e.title?"Dismiss notification: "+e.title:"Dismiss notification",title:"Dismiss",onClick:i,style:{...Di,width:18,height:18,fontSize:13,lineHeight:1,flex:"none"},children:"×"})]})}function Pi({visible:e,onDismiss:t}){const[i,n]=yi.useState(!1),r=yi.useRef(null),o=yi.useRef(null);if(yi.useEffect(()=>{0===e.length&&i&&n(!1)},[e.length,i]),yi.useEffect(()=>{if(!i)return;const e=e=>{r.current&&!r.current.contains(e.target)&&n(!1)},t=e=>{"Escape"===e.key&&(n(!1),o.current?.focus())};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[i]),0===e.length)return null;const a=e.reduce((e,t)=>ji[t.level]>ji[e]?t.level:e,e[0].level),s=Ni[a]??Ni.info,l=e.length,c=`${l} chart notification${1===l?"":"s"}, most severe: ${a}`;return Ci("div",{ref:r,className:"semiotic-chart-notifications",style:{position:"relative",display:"inline-flex"},children:[$i("span",{style:Si,role:"status","aria-live":"polite",children:c}),Ci("button",{ref:o,className:"semiotic-chart-action semiotic-chart-notifications-toggle","aria-haspopup":"dialog","aria-expanded":i,"aria-label":`${c}. ${i?"Hide":"Show"} notifications`,title:c,onClick:()=>n(e=>!e),style:{...Di,color:s,position:"relative"},children:[$i(Ii,{level:a}),$i("span",{className:"semiotic-chart-notifications-badge","aria-hidden":"true",style:{position:"absolute",top:-3,right:-3,minWidth:15,height:15,padding:"0 3px",boxSizing:"border-box",borderRadius:8,background:s,color:"#fff",fontSize:9,fontWeight:700,lineHeight:"15px",textAlign:"center"},children:l>99?"99+":l})]}),i&&$i("div",{className:"semiotic-chart-notifications-popover",role:"dialog","aria-label":"Chart notifications",style:{position:"absolute",top:"calc(100% + 6px)",right:0,zIndex:20,width:320,maxWidth:"min(360px, 90vw)",maxHeight:320,overflowY:"auto",display:"flex",flexDirection:"column",gap:6,padding:10,textAlign:"left",background:"var(--semiotic-bg, #fff)",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:6,boxShadow:"0 6px 24px rgba(0, 0, 0, 0.16)"},children:e.map(e=>$i(Li,{notification:e.notification,level:e.level,onDismiss:()=>t(e)},e.key))})]})}var Ri={live:{bg:"#22c55e",color:"#fff"},stale:{bg:"#ef4444",color:"#fff"},paused:{bg:"#eab308",color:"#000"},error:{bg:"#ef4444",color:"#fff"},static:{bg:"#6b7280",color:"#fff"}};function Mi({height:e}){return $i("div",{role:"status","aria-busy":"true","aria-label":"Loading chart",style:{width:"100%",height:e,background:"linear-gradient(90deg, var(--semiotic-border, #e0e0e0) 25%, var(--semiotic-bg, #f5f5f5) 50%, var(--semiotic-border, #e0e0e0) 75%)",backgroundSize:"200% 100%",animation:"semiotic-skeleton-pulse 1.5s ease-in-out infinite",borderRadius:4}})}function Bi({error:e}){return $i("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"},children:$i("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5},children:e})})}var Ti=yi.forwardRef(function({title:t,subtitle:i,children:n,width:o="100%",height:a=400,actions:s,chartConfig:l,describe:c,navigable:d,controls:u,banner:m,notifications:p,onNotificationDismiss:h,loading:b=!1,error:y,errorBoundary:v=!1,status:x,detailsPanel:w,mobile:k,mobileAudit:$,className:C,style:S},A){const N=yi.useRef(null),j=yi.useRef(null),[I,L]=yi.useState(!1),[P,R]=yi.useState(()=>new Set);yi.useEffect(()=>{R(e=>{if(0===e.size)return e;const t=new Set((p??[]).map((e,t)=>e.id??t+""));let i=!1;const n=new Set;for(const r of e)t.has(r)?n.add(r):i=!0;return i?n:e})},[p]);const M=yi.useMemo(()=>p?p.map((e,t)=>({notification:e,index:t,key:e.id??t+"",level:e.level??"info"})).filter(({key:e})=>!P.has(e)):[],[p,P]),B=yi.useCallback(e=>{R(t=>new Set(t).add(e.key)),h?.(e.notification,e.index)},[h]),T=!1!==s?.export&&void 0!==s?.export,D=!1!==s?.fullscreen&&void 0!==s?.fullscreen,z=!1!==s?.copyConfig&&void 0!==s?.copyConfig&&l,F=!0===s?.dataSummary,E=yi.useMemo(()=>{if(!c||!l?.component||!l?.props)return"";const e="object"==typeof c?c.levels:void 0;try{return mt(l.component,l.props,e?{levels:e}:{}).text}catch{return""}},[c,l]),O="object"==typeof c&&!0===c.visible,H=yi.useMemo(()=>{if(!d||!l?.component||!l?.props)return null;const e="object"==typeof d?d.maxLeaves:void 0;try{return bt(l.component,l.props,e?{maxLeaves:e}:{})}catch{return null}},[d,l]),W="object"==typeof d&&!0===d.visible,V=yi.useMemo(()=>"object"==typeof s?.export?s.export:{},[s?.export]),U="object"==typeof s?.copyConfig?s.copyConfig.format:"json",G=yi.useCallback(async e=>{j.current&&await g(j.current,{...V,...e})},[V]),q=yi.useCallback(()=>{N.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):N.current.requestFullscreen().catch(()=>{}))},[]),J=yi.useCallback(async e=>{l&&await le({...l,version:l.version??"1",createdAt:l.createdAt??(new Date).toISOString()},e||U||"json")},[l,U]);yi.useEffect(()=>{const e=()=>{L(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),yi.useImperativeHandle(A,()=>({export:G,toggleFullscreen:q,copyConfig:J,element:N.current}),[G,q,J]);const Z=!0===k?{}:k&&"object"==typeof k?k:null,_=!!k,X=Z?.breakpoint??480,K=void 0===Z?.chartMode?"mobile":Z.chartMode,Q=Z?.semantics,Y=Z?.mobileInteraction??(!!_||void 0),ee=Z?.standardControls,te=vi(ee)?ee:null,ie=te?.controls??(vi(ee)?void 0:ee)??function(e){return e&&"object"==typeof e?e.standardControls:void 0}(Y),ne=yi.useMemo(()=>function(e,t){return wi(t)?e&&"object"==typeof e?{...e,standardControls:t}:!1===e||null==e?e:{standardControls:t}:e}(Y,ie),[Y,ie]),re=_&&wi(ie)?$i(e,{controls:ie,targetSize:te?.targetSize??xi(Y)??44,compact:te?.compact??!0,className:te?.className,style:te?.style,ariaLabel:te?.ariaLabel,brush:te?.brush,zoom:te?.zoom,legend:te?.legend}):null,oe=Z?.summary,ae=!0===Z?.allowHorizontalScroll,se=!0===Z?.hideToolbar,ce=yi.useMemo(()=>{if(!$||!l?.component||!l?.props)return null;const e="object"==typeof $?$:{},t=l.props;try{return pi(l.component,{...t,mobileSemantics:t.mobileSemantics??Q,mobileInteraction:t.mobileInteraction??ne},{viewportWidth:e.viewportWidth??390,targetSize:e.targetSize??44,inChartContainer:!0})}catch{return null}},[$,l,Q,ne]);yi.useEffect(()=>{if(!ce||ce.ok)return;const e=ce.findings.filter(e=>"pass"!==e.status).slice(0,5);console.warn(`[Semiotic mobile audit] ${l?.component}: ${ce.summary.highRisk} high-risk mobile finding(s), ${ce.summary.warnings} warning(s).`,e)},[ce,l?.component]);const de=ce&&!ce.ok&&"object"==typeof $&&!0===$.visible?Ci("div",{className:"semiotic-chart-mobile-audit",role:"status",style:{padding:"8px 12px",fontSize:12,lineHeight:1.45,color:"var(--semiotic-warning, #6b3f00)",background:"color-mix(in srgb, var(--semiotic-warning, #d97706) 14%, var(--semiotic-bg, #fff))",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:["Mobile audit: ",ce.summary.highRisk," high-risk finding",1===ce.summary.highRisk?"":"s"," and"," ",ce.summary.warnings," warning",1===ce.summary.warnings?"":"s"," at"," ",("object"==typeof $?$.viewportWidth:void 0)??390,"px."]}):null,ue=M.length>0,me=t||i||u||T||D||z||F||x||ue,pe=yi.useMemo(()=>{if(!_||!yi.isValidElement(n))return n;if(!function(e){const t=e.type;return"function"==typeof t||"object"==typeof t&&null!==t}(n))return n;const e=n.props,t={};return K&&null==e.mode&&(t.mode=K),Q&&null==e.mobileSemantics&&(t.mobileSemantics=Q),void 0!==ne&&null==e.mobileInteraction&&(t.mobileInteraction=ne),Object.keys(t).length>0?yi.cloneElement(n,t):n},[n,_,K,Q,ne]),he=b?$i(Mi,{height:a}):y?$i(Bi,{error:y}):v?$i(f,{children:pe}):pe;return fe=Ci(ki,{children:[$i("style",{dangerouslySetInnerHTML:{__html:`@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}\n@media (max-width: ${X}px) {\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-header {\n padding: 10px 12px !important;\n gap: 10px !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-title-area {\n flex-basis: 100% !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-toolbar {\n width: 100% !important;\n margin-left: 0 !important;\n justify-content: flex-start !important;\n overflow-x: auto !important;\n -webkit-overflow-scrolling: touch;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"][data-semiotic-mobile-hide-toolbar="true"] .semiotic-chart-toolbar {\n display: none !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-action {\n min-width: 32px !important;\n min-height: 32px !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-mobile-summary {\n display: block !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-mobile-standard-controls {\n display: block !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"][data-semiotic-mobile-scroll="true"] .semiotic-chart-body {\n overflow-x: auto !important;\n justify-content: flex-start !important;\n -webkit-overflow-scrolling: touch;\n }\n}`}}),Ci("div",{ref:N,className:"semiotic-chart-container"+(C?" "+C:""),"data-semiotic-mobile":_?"true":void 0,"data-semiotic-mobile-scroll":ae?"true":void 0,"data-semiotic-mobile-hide-toolbar":se?"true":void 0,style:{width:o,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:"var(--semiotic-border-radius, 8px)",overflow:"hidden",background:"var(--semiotic-bg, #fff)",fontFamily:"var(--semiotic-font-family, sans-serif)",position:"relative",...I?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{},...S},children:[me&&Ci("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",flexWrap:"wrap",gap:8,borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:[Ci("div",{className:"semiotic-chart-title-area",style:{minWidth:0,flex:"1 1 200px"},children:[t&&$i("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"},children:t}),i&&$i("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:t?2:0},children:i})]}),Ci("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4,marginLeft:"auto"},children:[u,ue&&$i(Pi,{visible:M,onDismiss:B}),T&&$i("button",{className:"semiotic-chart-action",onClick:()=>G(),title:"Export chart","aria-label":"Export chart",style:Di,children:Ci("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[$i("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),$i("path",{d:"M2 12h10"})]})}),F&&$i(Ai,{}),D&&$i("button",{className:"semiotic-chart-action",onClick:q,title:I?"Exit fullscreen":"Fullscreen","aria-label":I?"Exit fullscreen":"Enter fullscreen",style:Di,children:$i("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:Ci(ki,I?{children:[$i("path",{d:"M9 1v4h4"}),$i("path",{d:"M5 13V9H1"}),$i("path",{d:"M13 5H9V1"}),$i("path",{d:"M1 9h4v4"})]}:{children:[$i("path",{d:"M1 5V1h4"}),$i("path",{d:"M13 9v4H9"}),$i("path",{d:"M9 1h4v4"}),$i("path",{d:"M5 13H1V9"})]})})}),z&&$i("button",{className:"semiotic-chart-action",onClick:()=>J(),title:"Copy config","aria-label":"Copy chart configuration",style:Di,children:Ci("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[$i("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),$i("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"})]})}),x&&$i("div",{className:"semiotic-chart-status","aria-live":"polite","aria-atomic":"true",style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",background:Ri[x].bg,color:Ri[x].color,lineHeight:"18px"},children:x})]})]}),m&&$i("div",{className:"semiotic-chart-banner",children:m}),de,oe&&$i("div",{className:"semiotic-chart-mobile-summary",style:{display:"none",padding:"8px 12px",fontSize:12,lineHeight:1.45,color:"var(--semiotic-text-secondary, #666)",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:oe}),re&&$i("div",{className:"semiotic-chart-mobile-standard-controls",style:{display:"none",padding:"10px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-surface, var(--semiotic-bg, #f6f8fa))"},children:re}),E&&$i("div",{className:"semiotic-chart-description",role:"note",style:O?{padding:"8px 16px",fontSize:12,lineHeight:1.5,color:"var(--semiotic-text-secondary, #666)",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"}:Si,children:E}),H&&$i("div",{className:"semiotic-chart-nav",style:W?{padding:"8px 8px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",maxHeight:240,overflow:"auto"}:void 0,children:$i(ti,{tree:H,label:"string"==typeof t&&t?t+" — navigable structure":"Chart navigable structure",visible:W,chartId:"string"==typeof l?.props?.chartId?l.props.chartId:void 0})}),Ci("div",{className:"semiotic-chart-body",ref:j,style:{position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",...I?{flex:1}:{height:a}},children:[he,w]})]})]}),F?$i(r,{children:fe}):fe;var fe}),Di={width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0};import*as zi from"react";import{jsx as Fi,jsxs as Ei}from"react/jsx-runtime";function Oi({children:e,controls:t,mobile:i,breakpoint:n=480,chartMode:r="mobile",mobileInteraction:o=!0,mobileSemantics:a,mobileSummary:s,chips:l=[],activeChip:c,onChipChange:d,detail:u,detailTitle:m="Details",detailMode:p="sheet",initialDetailOpen:h=!1,allowHorizontalScroll:f=!1,hideToolbar:g=!1,chartDefaults:b,...y}){const[v,x]=zi.useState(()=>c??l.find(e=>!e.disabled)?.id),[w,k]=zi.useState(h);zi.useEffect(()=>{void 0===c&&(l.length?l.some(e=>e.id===v&&!e.disabled)||x(l.find(e=>!e.disabled)?.id):x(void 0))},[c,l,v]);const $=c??v,C=zi.useCallback(e=>{e.disabled||(void 0===c&&x(e.id),d?.(e))},[c,d]),S=l.length?Fi("div",{className:"semiotic-mobile-chip-row",role:"list","aria-label":"Mobile chart controls",children:l.map(e=>Ei("button",{type:"button",className:"semiotic-mobile-chip","aria-pressed":e.id===$,disabled:e.disabled,onClick:()=>C(e),title:"string"==typeof e.description?e.description:void 0,children:[Fi("span",{children:e.label}),e.description&&Fi("small",{className:"semiotic-mobile-chip-description",children:e.description})]},e.id))}):null,A=s||S?Ei("div",{className:"semiotic-mobile-summary-card",children:[s&&Fi("div",{className:"semiotic-mobile-summary-copy",children:s}),S]}):i?.summary,N={breakpoint:n,chartMode:r,mobileInteraction:o,semantics:a,allowHorizontalScroll:f,hideToolbar:g,...i,summary:A},j=zi.useMemo(()=>{if(!b||!zi.isValidElement(e))return e;const t=e.props,i={};for(const[e,n]of Object.entries(b))null==t[e]&&(i[e]=n);return Object.keys(i).length>0?zi.cloneElement(e,i):e},[e,b]),I=!!u&&"sheet"===p,L=!!u&&"inline"===p||I&&w,P=I?Fi("button",{type:"button",className:"semiotic-mobile-detail-toggle","aria-expanded":w,onClick:()=>k(e=>!e),children:w?"Hide details":"Show details"}):null,R=t||P?Ei("div",{className:"semiotic-mobile-control-stack",children:[t,P]}):void 0;return Ei("div",{className:"semiotic-mobile-chart-shell",children:[Fi("style",{children:`\n .semiotic-mobile-chart-shell {\n display: grid;\n gap: 10px;\n width: 100%;\n }\n .semiotic-mobile-summary-card {\n display: grid;\n gap: 10px;\n }\n .semiotic-mobile-summary-copy {\n font-size: 13px;\n line-height: 1.45;\n }\n .semiotic-mobile-chip-row {\n display: flex;\n gap: 8px;\n overflow-x: auto;\n padding-bottom: 2px;\n -webkit-overflow-scrolling: touch;\n }\n .semiotic-mobile-chip {\n display: inline-flex;\n flex: 0 0 auto;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n min-height: 40px;\n min-width: 44px;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 999px;\n padding: 7px 12px;\n background: var(--semiotic-bg, #fff);\n color: var(--semiotic-text, #222);\n font: inherit;\n font-size: 12px;\n font-weight: 700;\n cursor: pointer;\n }\n .semiotic-mobile-chip[aria-pressed="true"] {\n border-color: var(--semiotic-accent, #1f7a6d);\n background: color-mix(in srgb, var(--semiotic-accent, #1f7a6d) 14%, transparent);\n }\n .semiotic-mobile-chip:disabled {\n cursor: not-allowed;\n opacity: 0.45;\n }\n .semiotic-mobile-chip-description {\n display: block;\n max-width: 160px;\n margin-top: 2px;\n color: var(--semiotic-text-secondary, #666);\n font-size: 10px;\n font-weight: 500;\n line-height: 1.2;\n }\n .semiotic-mobile-control-stack {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n flex-wrap: wrap;\n }\n .semiotic-mobile-detail-toggle {\n min-height: 32px;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 999px;\n padding: 5px 10px;\n background: transparent;\n color: var(--semiotic-text, #222);\n font: inherit;\n font-size: 12px;\n font-weight: 700;\n cursor: pointer;\n }\n .semiotic-mobile-detail-panel {\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 16px;\n background: var(--semiotic-bg, #fff);\n color: var(--semiotic-text, #222);\n box-shadow: 0 18px 48px rgba(0, 0, 0, 0.16);\n overflow: hidden;\n }\n .semiotic-mobile-detail-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n padding: 10px 12px;\n border-bottom: 1px solid var(--semiotic-border, #d8d8d8);\n font-size: 13px;\n font-weight: 800;\n }\n .semiotic-mobile-detail-body {\n padding: 12px;\n font-size: 13px;\n line-height: 1.5;\n }\n @media (max-width: ${n}px) {\n .semiotic-mobile-detail-panel[data-mode="sheet"] {\n position: sticky;\n bottom: 8px;\n z-index: 2;\n max-height: min(55vh, 420px);\n overflow: auto;\n }\n }\n `}),Fi(Ti,{...y,controls:R,mobile:N,children:j}),L&&Ei("section",{className:"semiotic-mobile-detail-panel","data-mode":p,"aria-label":"string"==typeof m?m:"Chart details",children:[Ei("div",{className:"semiotic-mobile-detail-header",children:[Fi("span",{children:m}),I&&Fi("button",{type:"button",className:"semiotic-mobile-detail-toggle",onClick:()=>k(!1),children:"Close"})]}),Fi("div",{className:"semiotic-mobile-detail-body",children:u})]})]})}import*as Hi from"react";import{jsx as Wi,jsxs as Vi}from"react/jsx-runtime";function Ui(e,t){if(t)return"function"==typeof t?t(e):e?.[t]}function Gi(e,t){const i="function"==typeof t?t(e):e[t];return Array.isArray(i)?i:[]}function qi(e){return{strategy:"small-multiples",responsive:!0,supportsResponsiveLayout:!0,summary:`${e} vertically stacked small multiple panel${1===e?"":"s"} with shared scale guidance.`,interaction:{primary:"tap",alternatives:["panel summary","linked selection"],hoverFallback:"tap-to-lock",targetSize:44},labels:{strategy:"external",minFontSize:12}}}function Ji(e,t){if(!Hi.isValidElement(e))return e;const i=e.props,n={};for(const[e,r]of Object.entries(t))void 0!==r&&null==i[e]&&(n[e]=r);return Object.keys(n).length>0?Hi.cloneElement(e,n):e}function Zi({items:e,children:t,columns:i=3,tabletColumns:n=2,mobileColumns:r=1,mobileBreakpoint:a=480,tabletBreakpoint:s=860,gap:l=12,mode:c="mobile",chartHeight:d=220,sharedExtent:m=!0,valueAccessor:p,dataAccessor:h="data",extentProps:f=["yExtent","valueExtent"],linkedHover:g,selection:b,linkedBy:y,linkProvider:v="auto",selections:x,showLegend:w=!1,legendPosition:k,legendInteraction:$,legendSelectionName:C,legendField:S,mobileInteraction:A=!0,mobileSemantics:N,labelMode:j="panel",chartDefaults:I,className:L,style:P}){const R=u(),M=e||"function"==typeof t?[]:Hi.Children.toArray(t),B=e??M.map((e,t)=>({id:"panel-"+(t+1)})),T=B.length,D=Hi.useMemo(()=>function(e,t,i,n){if(t&&"object"==typeof t)return t;if(!1===t)return{};const r=[],o=[];for(const t of e)if(t.extent&&r.push(t.extent[0],t.extent[1]),n)for(const e of Gi(t,i))o.push(Ui(e,n));const a=function(e){let t=1/0,i=-1/0;for(const n of e){const e=Number(n);Number.isFinite(e)&&(t>e&&(t=e),e>i&&(i=e))}if(Number.isFinite(t)&&Number.isFinite(i))return t===i?[t-1,i+1]:[t,i]}(o.length?o:r);return a?{yExtent:a,valueExtent:a}:{}}(B,m,h,p),[B,m,h,p]),z=Hi.useMemo(()=>{if(!y)return{name:void 0,fields:void 0,linkedHover:g,selection:b};const e=Array.isArray(y)?"small-multiples":y.name||"small-multiples",t=Array.isArray(y)?y:y.fields||[];return{name:e,fields:t,linkedHover:g??{name:e,fields:t},selection:b??{name:e}}},[y,g,b]),F=Hi.useMemo(()=>({linkedHover:z.linkedHover,selection:z.selection}),[z.linkedHover,z.selection]),E=Hi.useMemo(()=>{const e={mode:c,height:d,responsiveWidth:!0,mobileInteraction:A,mobileSemantics:N??qi(T),...F,...I};"legend"!==j&&(e.showLegend=!1),"direct"===j&&(e.directLabel=!0);for(const t of f)t in D&&(e[t]=D[t]);return e},[c,d,A,N,T,F,I,j,f,D]),O=Vi("section",{className:["semiotic-small-multiple-chart",L].filter(Boolean).join(" "),style:P,"data-semiotic-small-multiple":"true",children:[Wi("style",{children:`\n .semiotic-small-multiple-chart {\n --semiotic-small-multiple-columns: ${i};\n --semiotic-small-multiple-gap: ${l}px;\n display: grid;\n grid-template-columns: repeat(var(--semiotic-small-multiple-columns), minmax(0, 1fr));\n gap: var(--semiotic-small-multiple-gap);\n width: 100%;\n }\n .semiotic-small-multiple-panel {\n min-width: 0;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 16px;\n background: var(--semiotic-bg, #fff);\n overflow: hidden;\n }\n .semiotic-small-multiple-heading {\n display: grid;\n gap: 3px;\n padding: 10px 12px 0;\n }\n .semiotic-small-multiple-title {\n margin: 0;\n color: var(--semiotic-text, #222);\n font-size: 13px;\n font-weight: 800;\n line-height: 1.25;\n }\n .semiotic-small-multiple-subtitle,\n .semiotic-small-multiple-summary {\n margin: 0;\n color: var(--semiotic-text-secondary, #666);\n font-size: 11px;\n line-height: 1.35;\n }\n .semiotic-small-multiple-plot {\n min-width: 0;\n padding: 4px 6px 8px;\n overflow: hidden;\n }\n @media (max-width: ${s}px) {\n .semiotic-small-multiple-chart {\n --semiotic-small-multiple-columns: ${n};\n }\n }\n @media (max-width: ${a}px) {\n .semiotic-small-multiple-chart {\n --semiotic-small-multiple-columns: ${r};\n }\n .semiotic-small-multiple-panel {\n border-radius: 14px;\n }\n .semiotic-small-multiple-heading {\n padding: 9px 10px 0;\n }\n }\n `}),B.map((e,i)=>{const n={...E},r="function"==typeof t?t(e,{item:e,index:i,count:T,chartProps:n,sharedExtent:D}):M[i];return Vi("article",{className:"semiotic-small-multiple-panel","aria-label":"string"==typeof e.title?e.title:void 0,children:[(e.title||e.subtitle||e.summary)&&Vi("header",{className:"semiotic-small-multiple-heading",children:[e.title&&Wi("h3",{className:"semiotic-small-multiple-title",children:e.title}),e.subtitle&&Wi("p",{className:"semiotic-small-multiple-subtitle",children:e.subtitle}),e.summary&&Wi("p",{className:"semiotic-small-multiple-summary",children:e.summary})]}),Wi("div",{className:"semiotic-small-multiple-plot",children:Ji(r,n)})]},e.id??i)})]});return!0===v||"auto"===v&&(y||g||b||x||!0===w)&&!R?Wi(o,{selections:x,showLegend:w,legendPosition:k,legendInteraction:$,legendSelectionName:C??z.name??"small-multiples",legendField:S??z.fields?.[0]??"category",children:O}):O}import*as _i from"react";import{Fragment as Xi,jsx as Ki,jsxs as Qi}from"react/jsx-runtime";function Yi({children:e,columns:t="auto",minCellWidth:i=300,gap:n=16,tabletColumns:r,mobileColumns:o=1,mobileBreakpoint:a=480,tabletBreakpoint:s=860,chartDefaults:l,className:c,style:d}){const u="semiotic-chart-grid-"+_i.useId().replace(/[^a-zA-Z0-9_-]/g,""),m="number"==typeof t?t:void 0,p="auto"===t?`repeat(auto-fill, minmax(${i}px, 1fr))`:`repeat(${t}, 1fr)`,h=["semiotic-chart-grid",u,c].filter(Boolean).join(" ");return Qi(Xi,{children:[Ki("style",{children:`\n ${r?`\n @media (max-width: ${s}px) {\n .${u} {\n grid-template-columns: repeat(${r}, minmax(0, 1fr)) !important;\n }\n }`:""}\n @media (max-width: ${a}px) {\n .${u} {\n grid-template-columns: repeat(${o}, minmax(0, 1fr)) !important;\n }\n .${u} > [data-semiotic-chart-grid-primary="true"] {\n grid-column: span ${o} !important;\n }\n }\n `}),Ki("div",{className:h,style:{display:"grid",gridTemplateColumns:p,gap:n,width:"100%",...d},children:_i.Children.map(e,e=>{if(!_i.isValidElement(e))return e;const t=e.props,i={};if(l)for(const[e,n]of Object.entries(l))null==t[e]&&(i[e]=n);const n=Object.keys(i).length>0?_i.cloneElement(e,i):e;return"primary"!==e.props.emphasis||void 0!==m&&2>m?n:Ki("div",{"data-semiotic-chart-grid-primary":"true",style:{gridColumn:"span 2",minWidth:0},children:n})})})]})}Yi.displayName="ChartGrid";import*as en from"react";import{Fragment as tn,jsx as nn,jsxs as rn}from"react/jsx-runtime";function on({children:e,context:t,position:i="right",contextSize:n=250,mobilePosition:r="bottom",mobileBreakpoint:o=480,gap:a=12,className:s,style:l}){const c="semiotic-context-layout-"+en.useId().replace(/[^a-zA-Z0-9_-]/g,""),d="left"===i||"right"===i,u="left"===i||"top"===i,m={display:"flex",flexDirection:d?u?"row-reverse":"row":u?"column-reverse":"column",gap:a,width:"100%",...l},p=d?{flex:`0 0 ${n}px`,width:n,minHeight:0}:{flex:`0 0 ${n}px`,height:n,minWidth:0};return rn(tn,{children:[nn("style",{children:`\n @media (max-width: ${o}px) {\n .${c}[data-mobile-position="bottom"] {\n flex-direction: column !important;\n }\n .${c}[data-mobile-position="top"] {\n flex-direction: column-reverse !important;\n }\n .${c}[data-mobile-position="bottom"] > .semiotic-context-panel,\n .${c}[data-mobile-position="top"] > .semiotic-context-panel {\n flex: 0 0 auto !important;\n width: 100% !important;\n height: auto !important;\n }\n }\n `}),rn("div",{className:["semiotic-context-layout",c,s].filter(Boolean).join(" "),"data-mobile-position":r,style:m,children:[nn("div",{className:"semiotic-context-primary",style:{flex:"1 1 0%",minWidth:0,minHeight:0},children:e}),nn("div",{className:"semiotic-context-panel",style:p,children:t})]})]})}on.displayName="ContextLayout";import{useState as an,useEffect as sn,useRef as ln,useCallback as cn}from"react";import{jsx as dn,jsxs as un}from"react/jsx-runtime";function mn({children:e,position:t="right",size:i=300,trigger:n="click",chartId:r,observation:o,dismissOnEmpty:a=!0,showClose:s=!0,onToggle:l,className:d,style:u}){const[m,p]=an(null),[h,f]=an(null),[g,b]=an(!1),[y,v]=an(!1),x=ln(null),w=ln(void 0),k="click"===n?["click","click-end"]:["hover","hover-end"],{latest:$}=c({types:k,chartId:r,limit:1}),C=void 0!==o?o:$,S=cn(()=>{v(!0),b(!1),clearTimeout(w.current),w.current=setTimeout(()=>{v(!1),p(null),f(null)},200)},[]);if(sn(()=>{if(C)if("click"===C.type||"hover"===C.type){const e=C;p(e.datum),f(e),b(e=>(e||(v(!0),clearTimeout(w.current),w.current=setTimeout(()=>v(!1),200)),!0))}else!a||"click-end"!==C.type&&"hover-end"!==C.type||S()},[a,S,C]),sn(()=>{l?.(g)},[g,l]),sn(()=>()=>clearTimeout(w.current),[]),!m&&!y)return null;const A=m&&h?e(m,h):null;if(null===A&&!y)return null;const N=function(e,t,i,n){const r={position:"absolute",background:"var(--semiotic-bg, #fff)",borderColor:"var(--semiotic-border, #e0e0e0)",borderStyle:"solid",borderWidth:0,boxSizing:"border-box",zIndex:10,display:"flex",flexDirection:"column",transition:n?"transform 200ms ease-out, opacity 200ms ease-out":void 0};return"right"===e?{...r,top:0,right:0,width:t,height:"100%",borderLeftWidth:1,padding:"12px 16px",transform:i?"translateX(0)":`translateX(${t}px)`,opacity:i?1:0}:"bottom"===e?{...r,bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:i?"translateY(0)":`translateY(${t}px)`,opacity:i?1:0}:{...r,top:"50%",left:"50%",transform:i?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0.95)",opacity:i?1:0,width:Math.min(t,400),maxHeight:"80%",borderWidth:1,borderRadius:8,padding:"16px 20px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)"}}(t,i,g,y);return un("div",{ref:x,className:`semiotic-details-panel semiotic-details-${t}${d?" "+d:""}`,style:{...N,...u},children:[s&&dn("button",{className:"semiotic-details-close",onClick:S,"aria-label":"Close details",style:pn,children:dn("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:dn("path",{d:"M2 2l8 8M10 2l-8 8"})})}),dn("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1},children:A})]})}var pn={position:"absolute",top:8,right:8,width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0,zIndex:1};function hn(e){const t=e.designContract?.chartFamily??e.title??"chart",i=e.audience?.primary?" for "+e.audience.primary:"",n=e.designContract?.whyThisForm;return`${t}: ${e.intent.primary}${i}${n?". "+n:""}`}function fn(e,t){const i=e.intents.map(e=>"string"==typeof e?e:e.id??e.name).filter(e=>!!e),n=e.intents.find(e=>"string"!=typeof e&&"primary"===e.strength),r=("object"==typeof n?n.id??n.name:void 0)??i[0]??"explanation";return{ididVersion:"0.1",chartId:t.chartId,title:t.title??e.name,intent:{primary:r,secondary:i.filter(e=>e!==r)},audience:{primary:e.audience?.primary,familiarityAssumptions:Object.fromEntries(Object.entries(e.audience?.familiarity??{}).map(([e,t])=>[e,t+""])),literacyTargets:e.audience?.literacyTargets?.map(e=>({feature:e.concept,rationale:e.rationale}))},reception:e.reception?{channels:e.reception.channels,strengths:e.reception.strengths,risks:e.reception.risks,scaffolds:e.reception.scaffolds,memorableForm:e.reception.memorableForm}:void 0,designContract:{chartFamily:e.frameFamily,whyThisForm:e.designContract.whyThisForm??e.designContract.whyCustom,whyNotDefault:e.designContract.whyNotDefault,risks:e.reception?.risks,misuse:e.designContract.misuse},accessibility:{description:t.description,navigation:"required"===e.accessibility.keyboardNavigation||null!=e.navigation,dataFallback:!0===e.accessibility.fallbackTable||"required"===e.accessibility.accessibleTable||!0===e.accessibility.requiresAccessibleTable,manualChecks:["real screen-reader behavior","keyboard order quality","custom metaphor comprehension","animation distraction"]},provenance:t.dataSources||t.reviewStatus?{dataSources:t.dataSources,reviewStatus:t.reviewStatus,generatedBy:"Semiotic recipe intelligence"}:void 0}}mn.displayName="DetailsPanel";import*as gn from"react";import{jsx as bn,jsxs as yn}from"react/jsx-runtime";function vn({manifest:e,label:t="Intent Mark",className:i,showSummary:n=!0}){const[r,o]=gn.useState(!1),a=gn.useMemo(()=>JSON.stringify(e,null,2),[e]),s=gn.useCallback(async()=>{"undefined"!=typeof navigator&&navigator.clipboard&&(await navigator.clipboard.writeText(a),o(!0),window.setTimeout(()=>o(!1),1200))},[a]);return yn("details",{className:i?"semiotic-intent-mark "+i:"semiotic-intent-mark",style:{border:"1px solid var(--semiotic-border, #c8c8c8)",borderRadius:6,background:"var(--semiotic-surface, #fff)",color:"var(--semiotic-text, #222)",fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[yn("summary",{style:{cursor:"pointer",padding:"7px 10px",fontSize:12,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase"},children:[t," · ",e.intent.primary]}),yn("div",{style:{padding:"0 10px 10px"},children:[n&&bn("p",{style:{margin:"4px 0 10px",fontSize:13,lineHeight:1.45},children:hn(e)}),bn("button",{type:"button",onClick:s,style:{border:"1px solid currentColor",borderRadius:4,background:"transparent",color:"inherit",padding:"4px 8px",font:"inherit",fontSize:12,cursor:"pointer"},children:r?"Copied":"Copy manifest"}),bn("pre",{style:{maxHeight:280,overflow:"auto",margin:"10px 0 0",padding:10,background:"var(--semiotic-background, #f5f5f5)",fontSize:11,lineHeight:1.45,whiteSpace:"pre-wrap"},children:a})]})]})}import{useCallback as xn,useEffect as wn,useMemo as kn,useRef as $n,useState as Cn}from"react";var Sn=["hover","click","focus","activate"];function An(e){if("datum"===e.role&&e.datum)return e.datum;for(const t of e.children??[]){const e=An(t);if(e)return e}return null}function Nn(e,t){return e?t.map(t=>e[t]+"").join(""):""}function jn(e,t){if(e.id===t)return e;for(const i of e.children??[]){const e=jn(i,t);if(e)return e}return null}function In(e){const{tree:t,chartId:i,observe:n=Sn}=e,r=e.selectionName??"__semiotic-nav-sync"+(i?":"+i:""),o=kn(()=>{if(e.matchFields)return e.matchFields;const i=An(t);return i?Object.keys(i).filter(e=>{return!e.startsWith("_")&&(null==(t=i[e])||"string"==typeof t||"number"==typeof t||"boolean"==typeof t);var t}):[]},[e.matchFields,t]),a=kn(()=>{const e=new Map,i=t=>{if("datum"===t.role&&t.datum){const i=Nn(t.datum,o);e.has(i)||e.set(i,t.id)}for(const e of t.children??[])i(e)};return i(t),e},[t,o]),{selectPoints:s,clear:l}=p({name:r,fields:o}),d=kn(()=>[...n,"hover-end"],[n]),{latest:u}=c({chartId:i,types:d,limit:1}),[m,h]=Cn(t.id),f=$n(m);f.current=m;const g=$n(t);wn(()=>{const e=g.current;g.current=t;const i=jn(e,f.current),n=jn(t,f.current);"datum"===i?.role&&"datum"===n?.role&&i.datum&&n.datum&&o.length>0&&Nn(i.datum,o)===Nn(n.datum,o)||i&&n&&"datum"!==i.role&&"datum"!==n.role||(h(t.id),l())},[t,l,o]);const b=xn(e=>{if(h(e.id),"datum"===e.role&&e.datum&&o.length>0){const t={};for(const i of o)t[i]=[e.datum[i]];s(t)}else l()},[o,s,l]),y=e.annotations,v=kn(()=>{const e=new Set;if(0===o.length||!y)return e;for(const t of y){const i=a.get(Nn(t,o));i&&e.add(i)}return e},[y,a,o]),x=xn(e=>{const t="number"==typeof e?y?.[e]:e;if(!t||0===o.length)return!1;const i=a.get(Nn(t,o));if(!i)return!1;h(i);const n={};for(const e of o)n[e]=[t[e]];return s(n),!0},[y,a,o,s]),w=$n(null),k=xn(e=>{if(i&&e.chartId!==i)return;if("hover-end"===e.type){if(e===w.current)return;return void(w.current=e)}if(!function(e){return"hover"===e.type||"click"===e.type||"focus"===e.type||"activate"===e.type}(e))return;if(!n.includes(e.type))return;if(e===w.current)return;if(w.current=e,0===o.length)return;const t=function(e){const t=e,i=t.data;if(!i||"object"!=typeof i||Array.isArray(i))return e;const n=e=>e.every(e=>"number"==typeof t[e]),r=n(["x0","x1","y0","y1","width","height","value"]),o=n(["y0","y1","sankeyWidth","value"])&&"source"in t&&"target"in t;return r||o?i:e}(e.datum),r=a.get(Nn(t,o));r&&h(e=>e===r?e:r)},[i,n,a,o]),$=$n(null);return wn(()=>{u&&u!==$.current&&($.current=u,k(u))},[u,k]),{activeId:m,onActiveChange:b,selection:{name:r},onObservation:k,handleObservation:k,annotatedIds:v,focusAnnotation:x}}import{Fragment as Ln,jsx as Pn,jsxs as Rn}from"react/jsx-runtime";function Mn({items:e,title:t="Additional notes",empty:i=null,ordered:n=!0,renderItem:r,className:o,style:a}){if(!e.length)return i?Pn(Ln,{children:i}):null;const s=n?"ol":"ul";return Rn("section",{className:["semiotic-mobile-annotation-callouts",o].filter(Boolean).join(" "),style:a,children:[Pn("style",{children:"\n .semiotic-mobile-annotation-callouts {\n display: grid;\n gap: 8px;\n padding: 10px 12px;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 14px;\n background: var(--semiotic-bg, #fff);\n color: var(--semiotic-text, #222);\n }\n .semiotic-mobile-annotation-callouts h3 {\n margin: 0;\n font-size: 13px;\n font-weight: 800;\n line-height: 1.25;\n }\n .semiotic-mobile-annotation-callouts ol,\n .semiotic-mobile-annotation-callouts ul {\n display: grid;\n gap: 8px;\n margin: 0;\n padding-left: 18px;\n }\n .semiotic-mobile-annotation-callouts li {\n font-size: 13px;\n line-height: 1.45;\n }\n .semiotic-mobile-annotation-callouts small {\n display: block;\n margin-top: 2px;\n color: var(--semiotic-text-secondary, #666);\n font-size: 11px;\n line-height: 1.3;\n }\n "}),t&&Pn("h3",{children:t}),Pn(s,{children:e.map((e,t)=>Pn("li",{children:r?r(e,t):Rn(Ln,{children:[Pn("span",{children:e.label}),(e.source||e.emphasis)&&Pn("small",{children:[e.emphasis,e.source].filter(Boolean).join(" - ")})]})},e.id))})]})}export{g as exportChart,v as defineChartRecipe,x as validateChartRecipe,w as isRegisteredRecipeLayout,k as isJsonSafe,I as resolveRecipeRoleField,L as recipeToChartCapability,M as registerChartRecipe,B as unregisterChartRecipe,T as getChartRecipe,D as listChartRecipes,z as getRegisteredRecipeCapabilities,F as hasRegisteredRecipeCapabilities,E as registerRecipeLayout,O as unregisterRecipeLayout,H as getRecipeLayout,W as resolveChartRecipe,q as recipeIntentId,J as recipeConfig,X as fieldForRole,re as toConfig,oe as fromConfig,ae as toURL,se as fromURL,le as copyConfig,ce as configToJSX,de as serializeSelections,ue as deserializeSelections,be as fromVegaLite,xe as withProvenance,we as currentTimestamp,ke as withCurrentProvenance,Se as annotationFreshnessFor,Ae as computeAnnotationFreshness,Le as applyAnnotationLifecycle,Te as filterAnnotationsByStatus,De as applyAnnotationStatus,ze as describeRecipeChart,tt as communicativeActForIntent,it as resolveCommunicativeAct,mt as describeChart,gt as buildRecipeNavigationTree,bt as buildNavigationTree,yt as flattenVisible,vt as countNodes,Dt as subscribeToConversationArcChange,zt as registerConversationArcSink,Ft as createLocalStorageConversationArcSink,Et as createIndexedDBConversationArcSink,Ot as createWebhookConversationArcSink,Ht as loadConversationArc,Wt as replayConversationArc,Vt as recordAudienceChange,Ut as recordAnnotationStatusChange,Jt as enableConversationArc,Zt as disableConversationArc,_t as getConversationArcStore,ti as AccessibleNavTree,pi as auditMobileVisualization,gi as formatMobileVisualizationAudit,bi as mobileVisualizationCaveats,Ti as ChartContainer,Oi as MobileChartContainer,Zi as SmallMultipleChart,Yi as ChartGrid,on as ContextLayout,mn as DetailsPanel,hn as summarizeIntentManifest,fn as intentManifestFromRecipe,vn as IntentMark,In as useNavigationSync,Mn as MobileAnnotationCalloutList};
@@ -0,0 +1 @@
1
+ var n=class extends Error{constructor(n,t){super(`${n.engine} is an optional Semiotic physics engine. Install ${n.packageName} to use ${n.importPath}: ${n.installCommand}`),this.name="PhysicsOptionalEngineDependencyError",this.details=n,t&&(this.cause=t)}};function t(t,e){return new n(t,e)}async function e(n){try{return await import(n.packageName)}catch(e){throw t(n,e)}}export{n as PhysicsOptionalEngineDependencyError,t as optionalEngineDependencyError,e as loadOptionalPhysicsPeer};
@@ -0,0 +1 @@
1
+ function t(t,n,e){return e.x>t||t>e.x+e.w||e.y>n||n>e.y+e.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:e.x+e.w/2,cy:e.y+e.h/2}}function n(t,n=30){return Math.max((t??4)+5,12,n)}function e(t){return t instanceof Date?t:"number"==typeof t&&t>1e9?new Date(t):null}function r(t,n){const r=e(t);if(!r)return!1;const u=e(n);return!u||r.getFullYear()!==u.getFullYear()||r.getMonth()!==u.getMonth()}function u(t){let n=t%(2*Math.PI);return 0>n&&(n+=2*Math.PI),n}export{t as hitTestRect,n as getHitRadius,r as isTimeLandmark,u as normalizeAngle};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{buildColorStopGradient as t,resolveCSSColor as e,resolveCanvasFill as l,resolveCurveFactory as n}from"./chunk-chunk-ODUZEEBH.module.min.js";import{line as o}from"d3-shape";function i(t,e,l){let n=l;for(const l of e)"lesser"===l.thresholdType?l.value>t&&(n=l.color):t>l.value&&(n=l.color);return n}function s(t,e,l,n,o,i){if(2>e.length)return;const s=[0];for(let t=1;e.length>t;t++){const l=e[t][0]-e[t-1][0],n=e[t][1]-e[t-1][1];s.push(s[t-1]+Math.sqrt(l*l+n*n))}const a=s[s.length-1];if(0===a)return;const h=Math.min(.2*a,40);t.strokeStyle=l,t.lineWidth=n,t.lineCap=i;for(let l=0;e.length-1>l;l++){const n=(s[l]+s[l+1])/2;let i=o;h>n&&(i*=n/h),h>a-n&&(i*=(a-n)/h),t.globalAlpha=Math.max(0,i),t.beginPath(),t.moveTo(e[l][0],e[l][1]),t.lineTo(e[l+1][0],e[l+1][1]),t.stroke()}}var a=(a,h,r,p)=>{const c=h.filter(t=>"line"===t.type);for(const h of c){if(2>h.path.length)continue;const r=h._introClipFraction;void 0!==r&&1>r&&(a.save(),a.beginPath(),a.rect(0,0,p.width*r,p.height),a.clip());const c=h.style.stroke||"#007bff",f=e(a,c)||c,u=h.style.strokeWidth||2,y=h.colorThresholds,g=h.rawValues;if(a.setLineDash(h.style.strokeDasharray?h.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=h.style.opacity&&(a.globalAlpha=h.style.opacity),a.lineWidth=u,a.lineCap=h.style.strokeLinecap||"butt",h.style._edgeFade){s(a,h.path,f,u,h.style.opacity??1,h.style.strokeLinecap||"butt"),a.globalAlpha=1,a.setLineDash([]),a.lineCap="butt";continue}const k=n(h.curve),b=y&&y.length>0&&g&&g.length===h.path.length,d=h._decayOpacities;if(d&&d.length===h.path.length&&!b){a.strokeStyle=f;const t=h.style.opacity??1;for(let e=0;h.path.length-1>e;e++)a.globalAlpha=.5*(d[e]+d[e+1])*t,a.beginPath(),a.moveTo(h.path[e][0],h.path[e][1]),a.lineTo(h.path[e+1][0],h.path[e+1][1]),a.stroke()}else if(b){let t=function(t,e,l){a.beginPath(),a.strokeStyle=t,a.moveTo(e,l),r=!0},e=function(){r&&(a.stroke(),r=!1)},l=null,n=null,o=null,s=null,r=!1;for(let r=0;h.path.length>r;r++){const[p,c]=h.path[r],u=g[r],k=i(u,y,f);if(null!==l&&null!==s&&null!==o){if(k===s)a.lineTo(p,c);else{const s=[];for(const t of y){const e=t.value;(o>e||e>u)&&(e>o||u>e)||o===e||u===e||s.push({t:(e-o)/(u-o)})}s.sort((t,e)=>t.t-e.t);for(const h of s){const s=l+(p-l)*h.t,r=n+(c-n)*h.t,g=i(o+(u-o)*Math.min(h.t+1e-4,1),y,f);a.lineTo(s,r),e(),t(g,s,r)}a.lineTo(p,c)}l=p,n=c,o=u,s=k}else t(k,p,c),l=p,n=c,o=u,s=k}e()}else{a.beginPath();const e=h.strokeGradient&&h.path.length>=2?t(a,h.strokeGradient,h.path[0][0],0,h.path[h.path.length-1][0],0):null;if(a.strokeStyle=e||f,k)o().x(t=>t[0]).y(t=>t[1]).curve(k).context(a)(h.path);else{const[t,e]=h.path[0];a.moveTo(t,e);for(let t=1;h.path.length>t;t++)a.lineTo(h.path[t][0],h.path[t][1])}a.stroke()}if(h.style.fill&&h.style.fillOpacity&&h.style.fillOpacity>0){if(a.beginPath(),a.globalAlpha=h.style.fillOpacity,a.fillStyle=l(a,h.style.fill,h.style.fill),k&&!b)o().x(t=>t[0]).y(t=>t[1]).curve(k).context(a)(h.path);else{const[t,e]=h.path[0];a.moveTo(t,e);for(let t=1;h.path.length>t;t++)a.lineTo(h.path[t][0],h.path[t][1])}const t=h.path[0][0];a.lineTo(h.path[h.path.length-1][0],p.height),a.lineTo(t,p.height),a.closePath(),a.fill()}void 0!==r&&1>r&&a.restore(),a.globalAlpha=1,a.setLineDash([]),a.lineCap="butt"}};function h(t){if(!t)return null;if("heatcell"===t.type)return t.fill||null;if("candlestick"===t.type)return t.isUp?t.upColor:t.downColor;const{style:e}=t;if(!e)return null;const l="string"==typeof e.fill?e.fill:null;return"line"===t.type||"area"===t.type?e.stroke||l||null:l||e.stroke||null}export{a as lineCanvasRenderer,h as resolveNodeColor};