semiotic 3.9.0 → 3.9.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/README.md +102 -90
  2. package/agent-skill/semiotic-charts/SKILL.md +14 -10
  3. package/ai/componentMetadata.cjs +13 -3
  4. package/ai/dist/mcp-server.js +140 -36407
  5. package/ai/examples.md +109 -6
  6. package/ai/reference.md +55 -18
  7. package/ai/schema.json +5964 -1190
  8. package/ai/surface-manifest.json +51 -7
  9. package/ai/system-prompt.md +16 -3
  10. package/dist/c-3SCUN5HI.min.js +1 -0
  11. package/dist/c-3VVKFA4M.min.js +1 -0
  12. package/dist/c-43TJZS3F.min.js +1 -0
  13. package/dist/c-4DTZPSUD.min.js +1 -0
  14. package/dist/c-4ES5367Y.min.js +1 -0
  15. package/dist/c-54IRWOGM.min.js +1 -0
  16. package/dist/c-5D2S4RMI.min.js +1 -0
  17. package/dist/c-5JWCTX3G.min.js +1 -0
  18. package/dist/c-6CMMSN6N.min.js +1 -0
  19. package/dist/c-6HRB2L7H.min.js +1 -0
  20. package/dist/c-7W4SV36A.min.js +1 -0
  21. package/dist/c-A4WRGZFX.min.js +1 -0
  22. package/dist/c-AG7WWVIH.min.js +1 -0
  23. package/dist/c-AH6J4MTN.min.js +1 -0
  24. package/dist/c-ALYR5LKK.min.js +1 -0
  25. package/dist/c-BYDPC44I.min.js +1 -0
  26. package/dist/c-CFFIU2MW.min.js +1 -0
  27. package/dist/c-CGNHBHCE.min.js +1 -0
  28. package/dist/c-CJYSXIFV.min.js +1 -0
  29. package/dist/c-CKLIFCGN.min.js +1 -0
  30. package/dist/c-CZF7MV67.min.js +1 -0
  31. package/dist/c-D53OKBSY.min.js +1 -0
  32. package/dist/c-DBQ2V7CH.min.js +1 -0
  33. package/dist/c-DPMVAUAW.min.js +1 -0
  34. package/dist/c-ECJCKLYY.min.js +1 -0
  35. package/dist/c-EGATGOWJ.min.js +1 -0
  36. package/dist/c-EGR6VYBW.min.js +1 -0
  37. package/dist/c-ENF72HU5.min.js +1 -0
  38. package/dist/c-ESNR43AN.min.js +1 -0
  39. package/dist/c-F3LIKINL.min.js +1 -0
  40. package/dist/c-F5ZB5GJ6.min.js +1 -0
  41. package/dist/c-G3VYMHKE.min.js +1 -0
  42. package/dist/c-GR6MOEQC.min.js +1 -0
  43. package/dist/c-GSVCN34B.min.js +1 -0
  44. package/dist/c-GYOQCEFP.min.js +1 -0
  45. package/dist/c-H3DNMTCC.min.js +1 -0
  46. package/dist/c-I6J3FEZE.min.js +1 -0
  47. package/dist/c-IGH6MGJ5.min.js +1 -0
  48. package/dist/c-II2EEAJN.min.js +1 -0
  49. package/dist/c-J6M4JHRS.min.js +1 -0
  50. package/dist/c-JM3MGLQV.min.js +1 -0
  51. package/dist/c-KM3N7F7R.min.js +1 -0
  52. package/dist/c-LF5BZFNC.min.js +1 -0
  53. package/dist/c-LKBSGFQC.min.js +1 -0
  54. package/dist/c-NDJADPIF.min.js +1 -0
  55. package/dist/c-NVPQCIL5.min.js +1 -0
  56. package/dist/c-OFWJBEE5.min.js +1 -0
  57. package/dist/c-OYFHP5F5.min.js +1 -0
  58. package/dist/c-PGKQGGQ2.min.js +1 -0
  59. package/dist/c-Q2IPZ3MU.min.js +1 -0
  60. package/dist/c-QKHMBE2E.min.js +1 -0
  61. package/dist/c-QMVM3AY6.min.js +1 -0
  62. package/dist/c-QSGWX53A.min.js +1 -0
  63. package/dist/c-RJKEKZOO.min.js +1 -0
  64. package/dist/c-SFDIIU5G.min.js +1 -0
  65. package/dist/c-SRTBCRVE.min.js +1 -0
  66. package/dist/c-T6UAIKBH.min.js +1 -0
  67. package/dist/c-TMCTEVVW.min.js +1 -0
  68. package/dist/c-TMOSJLT3.min.js +1 -0
  69. package/dist/c-U6ESPM7V.min.js +1 -0
  70. package/dist/c-UC5PTTFI.min.js +1 -0
  71. package/dist/c-VGKUEZBC.min.js +1 -0
  72. package/dist/c-VN2HG5BS.min.js +1 -0
  73. package/dist/{c-J5G56TUH.min.js → c-VPZDY5Q4.min.js} +1 -1
  74. package/dist/c-VRXUB2F2.min.js +1 -0
  75. package/dist/c-VUBQNQJH.min.js +1 -0
  76. package/dist/c-VUH4PGZY.min.js +1 -0
  77. package/dist/c-XDRV7RKW.min.js +1 -0
  78. package/dist/c-YGZHURXZ.min.js +1 -0
  79. package/dist/components/Annotation.d.ts +1 -1
  80. package/dist/components/access/chartAccessCapabilities.generated.d.ts +14 -0
  81. package/dist/components/access/chartAccessContract.d.ts +90 -0
  82. package/dist/components/access/chartAccessContractFixtures.d.ts +11 -0
  83. package/dist/components/ai/aestheticProfileTypes.d.ts +35 -0
  84. package/dist/components/ai/annotationProvenance.d.ts +2 -7
  85. package/dist/components/ai/auditVisualHierarchy.d.ts +49 -0
  86. package/dist/components/ai/builtInChartRecipeLayouts.d.ts +2 -0
  87. package/dist/components/ai/builtInChartRecipePublic.d.ts +4 -0
  88. package/dist/components/ai/builtInChartRecipes.d.ts +26 -0
  89. package/dist/components/ai/chartCapabilities.d.ts +3 -1
  90. package/dist/components/ai/chartRecipeRegistry.d.ts +2 -1
  91. package/dist/components/ai/chartRecipes.d.ts +6 -0
  92. package/dist/components/ai/colorEvidence.d.ts +12 -0
  93. package/dist/components/ai/evaluateAesthetics.d.ts +47 -0
  94. package/dist/components/ai/geoNavigation.d.ts +4 -0
  95. package/dist/components/ai/hierarchyNavigation.d.ts +4 -0
  96. package/dist/components/ai/navigationTree.d.ts +7 -1
  97. package/dist/components/ai/qualityFixtures.d.ts +8 -0
  98. package/dist/components/ai/suggestionPropContracts.d.ts +1 -1
  99. package/dist/components/ai/useNavigationSync.d.ts +3 -3
  100. package/dist/components/charts/index.d.ts +4 -0
  101. package/dist/components/charts/network/ChordDiagram.d.ts +5 -1
  102. package/dist/components/charts/network/CirclePack.d.ts +8 -1
  103. package/dist/components/charts/network/OrbitDiagram.d.ts +9 -0
  104. package/dist/components/charts/network/TreeDiagram.d.ts +8 -1
  105. package/dist/components/charts/network/Treemap.d.ts +8 -1
  106. package/dist/components/charts/ordinal/BarChart.d.ts +6 -0
  107. package/dist/components/charts/ordinal/BoxPlot.d.ts +3 -0
  108. package/dist/components/charts/ordinal/DonutChart.d.ts +3 -0
  109. package/dist/components/charts/ordinal/DotPlot.d.ts +3 -0
  110. package/dist/components/charts/ordinal/FunnelChart.d.ts +3 -0
  111. package/dist/components/charts/ordinal/GaugeChart.d.ts +3 -0
  112. package/dist/components/charts/ordinal/Histogram.d.ts +3 -0
  113. package/dist/components/charts/ordinal/LikertChart.d.ts +3 -0
  114. package/dist/components/charts/ordinal/PieChart.d.ts +3 -0
  115. package/dist/components/charts/ordinal/RadarChart.capability.d.ts +2 -0
  116. package/dist/components/charts/ordinal/RadarChart.d.ts +75 -0
  117. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +3 -0
  118. package/dist/components/charts/ordinal/SwarmPlot.d.ts +3 -0
  119. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +3 -0
  120. package/dist/components/charts/ordinal/ViolinPlot.d.ts +3 -0
  121. package/dist/components/charts/physics/GauntletChart.d.ts +1 -5
  122. package/dist/components/charts/physics/chainReactionTypes.d.ts +3 -0
  123. package/dist/components/charts/physics/gauntletPhysics.d.ts +1 -0
  124. package/dist/components/charts/physics/physicsHocUtils.d.ts +7 -1
  125. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +10 -1
  126. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +11 -1
  127. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +14 -5
  128. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +7 -1
  129. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +7 -1
  130. package/dist/components/charts/realtime/aggregate.d.ts +12 -1
  131. package/dist/components/charts/realtime/realtimeChartRuntime.d.ts +4 -2
  132. package/dist/components/charts/realtime/realtimeStyleRules.d.ts +4 -0
  133. package/dist/components/charts/shared/annotationStatusFilter.d.ts +18 -0
  134. package/dist/components/charts/shared/chartDefinitionPilot.d.ts +5 -4
  135. package/dist/components/charts/shared/chartSpecCore.d.ts +2 -2
  136. package/dist/components/charts/shared/heatmapStyleRules.d.ts +13 -0
  137. package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
  138. package/dist/components/charts/shared/networkUtils.d.ts +14 -0
  139. package/dist/components/charts/shared/selectionUtils.d.ts +3 -1
  140. package/dist/components/charts/shared/types.d.ts +4 -2
  141. package/dist/components/charts/shared/useChartLegend.d.ts +2 -1
  142. package/dist/components/charts/shared/useLikertAggregation.d.ts +8 -2
  143. package/dist/components/charts/shared/useNetworkChartSetup.d.ts +9 -5
  144. package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +1 -1
  145. package/dist/components/charts/shared/useXYBrush.d.ts +24 -0
  146. package/dist/components/charts/xy/Heatmap.d.ts +16 -0
  147. package/dist/components/charts/xy/LineChart.d.ts +9 -0
  148. package/dist/components/charts/xy/Scatterplot.d.ts +7 -0
  149. package/dist/components/charts/xy/WaterfallChart.capability.d.ts +2 -0
  150. package/dist/components/charts/xy/WaterfallChart.d.ts +68 -0
  151. package/dist/components/evidence/chartEvidenceEnvelope.d.ts +146 -0
  152. package/dist/components/evidence/evidenceGate.d.ts +28 -0
  153. package/dist/components/realtime/BinAccumulator.d.ts +5 -1
  154. package/dist/components/realtime/types.d.ts +16 -7
  155. package/dist/components/recipes/adjacencyFlow.d.ts +12 -0
  156. package/dist/components/recipes/adjacencyFlowAggregation.d.ts +72 -0
  157. package/dist/components/recipes/adjacencyFlowGeometry.d.ts +79 -0
  158. package/dist/components/recipes/lineageDag.d.ts +17 -0
  159. package/dist/components/recipes/lineageDagHulls.d.ts +22 -0
  160. package/dist/components/recipes/transitDiagram.d.ts +75 -0
  161. package/dist/components/recipes/transitDiagramGeometry.d.ts +47 -0
  162. package/dist/components/semiotic-access.d.ts +9 -0
  163. package/dist/components/semiotic-ai-audits.d.ts +17 -0
  164. package/dist/components/semiotic-ai-core.d.ts +9 -0
  165. package/dist/components/semiotic-ai.d.ts +5 -17
  166. package/dist/components/semiotic-evidence.d.ts +10 -0
  167. package/dist/components/semiotic-line.d.ts +9 -0
  168. package/dist/components/semiotic-network.d.ts +3 -0
  169. package/dist/components/semiotic-ordinal.d.ts +2 -0
  170. package/dist/components/semiotic-realtime-core.d.ts +3 -2
  171. package/dist/components/semiotic-recipes-core.d.ts +6 -0
  172. package/dist/components/semiotic-themes-core.d.ts +3 -0
  173. package/dist/components/semiotic-utils-core.d.ts +5 -0
  174. package/dist/components/semiotic-utils.d.ts +1 -1
  175. package/dist/components/semiotic-xy.d.ts +3 -0
  176. package/dist/components/semiotic.d.ts +9 -3
  177. package/dist/components/server/renderDashboard.d.ts +37 -0
  178. package/dist/components/server/renderEvidence.d.ts +27 -0
  179. package/dist/components/server/renderToStaticSVG.d.ts +2 -30
  180. package/dist/components/server/serverChartConfigShared.d.ts +13 -0
  181. package/dist/components/server/serverChartConfigs.d.ts +9 -0
  182. package/dist/components/server/serverChartConfigsComposite.d.ts +4 -0
  183. package/dist/components/server/serverChartConfigsCustom.d.ts +2 -0
  184. package/dist/components/server/serverChartConfigsGeo.d.ts +1 -0
  185. package/dist/components/server/serverChartConfigsOrdinal.d.ts +3 -2
  186. package/dist/components/server/serverChartConfigsXY.d.ts +1 -0
  187. package/dist/components/server/serverChartConfigsXYExtra.d.ts +3 -0
  188. package/dist/components/server/serverCompositeChainReaction.d.ts +3 -0
  189. package/dist/components/server/serverOrdinalGauge.d.ts +3 -0
  190. package/dist/components/server/serverOrdinalLikert.d.ts +2 -0
  191. package/dist/components/store/selectionProvenance.d.ts +8 -0
  192. package/dist/components/store/themeCore.d.ts +5 -1
  193. package/dist/components/stream/GeoPipelineStore.d.ts +1 -1
  194. package/dist/components/stream/MarginalGraphics.d.ts +3 -3
  195. package/dist/components/stream/MarginalGraphicsLazy.d.ts +22 -0
  196. package/dist/components/stream/NetworkPipelineStore.d.ts +2 -0
  197. package/dist/components/stream/OrdinalPipelineStore.d.ts +1 -1
  198. package/dist/components/stream/PipelineStore.d.ts +1 -1
  199. package/dist/components/stream/SceneToSVG.d.ts +1 -1
  200. package/dist/components/stream/canvasSetup.d.ts +8 -2
  201. package/dist/components/stream/customLayoutAttempt.d.ts +21 -0
  202. package/dist/components/stream/geoTypes.d.ts +1 -1
  203. package/dist/components/stream/isServerEnvironment.d.ts +6 -0
  204. package/dist/components/stream/layouts/forceLayoutNodeSize.d.ts +12 -0
  205. package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +2 -9
  206. package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +2 -21
  207. package/dist/components/stream/layouts/forceLayoutWorkerPolicy.d.ts +21 -0
  208. package/dist/components/stream/layouts/index.d.ts +6 -12
  209. package/dist/components/stream/layouts/missingPlugin.d.ts +7 -0
  210. package/dist/components/stream/layouts/registerBuiltIn.d.ts +1 -0
  211. package/dist/components/stream/layouts/registry.d.ts +12 -0
  212. package/dist/components/stream/marginalConfig.d.ts +3 -0
  213. package/dist/components/stream/networkCustomLayout.d.ts +7 -0
  214. package/dist/components/stream/networkCustomLayoutOutput.d.ts +13 -0
  215. package/dist/components/stream/networkCustomLayoutRunner.d.ts +1 -1
  216. package/dist/components/stream/networkTypes.d.ts +5 -1
  217. package/dist/components/stream/ordinalTypes.d.ts +1 -1
  218. package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +1 -1
  219. package/dist/components/stream/pipelineDomainResolution.d.ts +6 -0
  220. package/dist/components/stream/renderers/pointCanvasRenderer.d.ts +4 -0
  221. package/dist/components/stream/renderers/resolveCSSColor.d.ts +4 -4
  222. package/dist/components/stream/types.d.ts +8 -1
  223. package/dist/components/stream/useEnsureCustomXYRenderers.d.ts +18 -0
  224. package/dist/components/stream/useMarginalValues.d.ts +13 -0
  225. package/dist/components/stream/xyCanvasRenderers.d.ts +4 -4
  226. package/dist/components/stream/xyPlugins/areaPlugin.d.ts +2 -0
  227. package/dist/components/stream/xyPlugins/barPlugin.d.ts +2 -0
  228. package/dist/components/stream/xyPlugins/candlestickPlugin.d.ts +2 -0
  229. package/dist/components/stream/xyPlugins/customPlugin.d.ts +6 -0
  230. package/dist/components/stream/xyPlugins/heatmapPlugin.d.ts +2 -0
  231. package/dist/components/stream/xyPlugins/lineFamily.d.ts +5 -0
  232. package/dist/components/stream/xyPlugins/linePlugin.d.ts +2 -0
  233. package/dist/components/stream/xyPlugins/missingPlugin.d.ts +7 -0
  234. package/dist/components/stream/xyPlugins/mixedPlugin.d.ts +2 -0
  235. package/dist/components/stream/xyPlugins/pointPlugin.d.ts +3 -0
  236. package/dist/components/stream/xyPlugins/registerBuiltIn.d.ts +1 -0
  237. package/dist/components/stream/xyPlugins/registry.d.ts +31 -0
  238. package/dist/components/stream/xyPlugins/stackedAreaPlugin.d.ts +2 -0
  239. package/dist/components/stream/xyPlugins/swarmPlugin.d.ts +2 -0
  240. package/dist/components/stream/xyPlugins/waterfallPlugin.d.ts +2 -0
  241. package/dist/forceLayoutWorker.js +1 -1
  242. package/dist/geo.min.js +1 -1
  243. package/dist/geo.module.min.js +1 -1
  244. package/dist/network.module.min.js +1 -1
  245. package/dist/ordinal.module.min.js +1 -1
  246. package/dist/physics.module.min.js +1 -1
  247. package/dist/rough.module.min.js +1 -1
  248. package/dist/semiotic-access.d.ts +9 -0
  249. package/dist/semiotic-access.min.js +2 -0
  250. package/dist/semiotic-access.module.min.js +2 -0
  251. package/dist/semiotic-ai-core.d.ts +9 -0
  252. package/dist/semiotic-ai-core.min.js +1 -1
  253. package/dist/semiotic-ai-core.module.min.js +1 -1
  254. package/dist/semiotic-ai.d.ts +5 -17
  255. package/dist/semiotic-ai.module.min.js +1 -1
  256. package/dist/semiotic-client-cjs-shared.min.js +1 -1
  257. package/dist/semiotic-client-shared.module.min.js +1 -1
  258. package/dist/semiotic-evidence.d.ts +10 -0
  259. package/dist/semiotic-evidence.min.js +1 -0
  260. package/dist/semiotic-evidence.module.min.js +1 -0
  261. package/dist/semiotic-experimental-auxiliary.module.min.js +1 -1
  262. package/dist/semiotic-experimental-node-auxiliary.module.min.js +1 -1
  263. package/dist/semiotic-experimental-react-shared.module.min.js +1 -1
  264. package/dist/semiotic-experimental-vacp.min.js +1 -1
  265. package/dist/semiotic-experimental-vacp.module.min.js +1 -1
  266. package/dist/semiotic-line.d.ts +9 -0
  267. package/dist/semiotic-line.min.js +2 -0
  268. package/dist/semiotic-line.module.min.js +2 -0
  269. package/dist/semiotic-network.d.ts +3 -0
  270. package/dist/semiotic-ordinal.d.ts +2 -0
  271. package/dist/semiotic-realtime-core.d.ts +3 -2
  272. package/dist/semiotic-realtime-core.module.min.js +1 -1
  273. package/dist/semiotic-recipes-core-cjs-base.min.js +1 -1
  274. package/dist/semiotic-recipes-core.d.ts +6 -0
  275. package/dist/semiotic-recipes-core.module.min.js +1 -1
  276. package/dist/semiotic-server-edge-node.module.min.js +1 -1
  277. package/dist/semiotic-server-edge.min.js +1 -1
  278. package/dist/semiotic-server-edge.module.min.js +1 -1
  279. package/dist/semiotic-server-node.min.js +1 -1
  280. package/dist/semiotic-server-node.module.min.js +1 -1
  281. package/dist/semiotic-themes-core.d.ts +3 -0
  282. package/dist/semiotic-themes-core.min.js +1 -1
  283. package/dist/semiotic-themes-core.module.min.js +1 -1
  284. package/dist/semiotic-themes.min.js +1 -1
  285. package/dist/semiotic-themes.module.min.js +1 -1
  286. package/dist/semiotic-utils-core.d.ts +5 -0
  287. package/dist/semiotic-utils-core.min.js +1 -1
  288. package/dist/semiotic-utils-core.module.min.js +1 -1
  289. package/dist/semiotic-utils.d.ts +1 -1
  290. package/dist/semiotic-utils.module.min.js +1 -1
  291. package/dist/semiotic-xy.d.ts +3 -0
  292. package/dist/semiotic.d.ts +9 -3
  293. package/dist/semiotic.module.min.js +1 -1
  294. package/dist/server.min.js +1 -1
  295. package/dist/server.module.min.js +1 -1
  296. package/dist/xy.module.min.js +1 -1
  297. package/package.json +39 -60
  298. package/dist/c-3KZD6AXJ.min.js +0 -1
  299. package/dist/c-4TWEX5HG.min.js +0 -1
  300. package/dist/c-5YCIX3VZ.min.js +0 -1
  301. package/dist/c-6FEKTA3U.min.js +0 -1
  302. package/dist/c-74HEEZGK.min.js +0 -1
  303. package/dist/c-BWNB6USU.min.js +0 -1
  304. package/dist/c-C25ENHIK.min.js +0 -1
  305. package/dist/c-CDR5AO3R.min.js +0 -1
  306. package/dist/c-E3JFRRMI.min.js +0 -1
  307. package/dist/c-EBFPQHHO.min.js +0 -1
  308. package/dist/c-GIKRQI4X.min.js +0 -1
  309. package/dist/c-GPYOFETM.min.js +0 -1
  310. package/dist/c-IDUHYYSI.min.js +0 -1
  311. package/dist/c-JAZ73J32.min.js +0 -1
  312. package/dist/c-KG3NXHAL.min.js +0 -1
  313. package/dist/c-KII3PLZE.min.js +0 -1
  314. package/dist/c-LIXGXMNS.min.js +0 -1
  315. package/dist/c-LVEY6D6B.min.js +0 -1
  316. package/dist/c-M4Y3BHFR.min.js +0 -1
  317. package/dist/c-MAIICR2Z.min.js +0 -1
  318. package/dist/c-MG5DM6VE.min.js +0 -1
  319. package/dist/c-O6U6K4CW.min.js +0 -1
  320. package/dist/c-OQ7M4AGV.min.js +0 -1
  321. package/dist/c-OXYMVK7Q.min.js +0 -1
  322. package/dist/c-QHF5YON3.min.js +0 -1
  323. package/dist/c-RR3GO5SW.min.js +0 -1
  324. package/dist/c-S2BXNNJN.min.js +0 -1
  325. package/dist/c-SUILCHWU.min.js +0 -1
  326. package/dist/c-US5ZFT6E.min.js +0 -1
  327. package/dist/c-UUKVD4WB.min.js +0 -1
  328. package/dist/c-WJCD5EUY.min.js +0 -1
  329. package/dist/c-YDAY2WFR.min.js +0 -1
  330. package/dist/c-ZOWWU34K.min.js +0 -1
  331. /package/dist/{c-COHXCW3Q.min.js → c-YZVRZGX2.min.js} +0 -0
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{DEFAULT_HIT_RADIUS as e,geoAreaHitTarget as t,geoHitTarget as o,hitTargetPoint as i}from"./c-3BLJEQNG.min.js";import{GeoCustomChart as n,StreamGeoFrame_default as r}from"./c-74HEEZGK.min.js";import{mergeShapeStyle as a,useChartSetup as l,useFrameImperativeHandle as s,useResolvedSelection as c}from"./c-3KZD6AXJ.min.js";import"./c-ZOWWU34K.min.js";import"./c-MG5DM6VE.min.js";import"./c-OCI56QF2.min.js";import{buildCustomBehaviorProps as u}from"./c-GPYOFETM.min.js";import{useCustomLayoutSelection as d}from"./c-G36WS6LN.min.js";import{composeStyleRules as m,makeNodeRuleContext as h,makeRuleValueResolver as p,matchesThreshold as f,resolveStyleRules as g,ruleMatches as y}from"./c-S2BXNNJN.min.js";import"./c-J5G56TUH.min.js";import{ChartError as b,DEFAULT_COLOR as v,EMPTY_ARRAY as x,MultiLineTooltip as k,SafeRender as w,Tooltip as S,TooltipRoot as M,filterSparseArray as A,getColor as C,getSequentialInterpolator as N,getSize as R,glyphExtent as F,glyphPlacement as j,hatchFillId as P,hatchPatternDef as H,isHatchFill as I,markTooltipChrome as L,normalizeLinkedHover as z,normalizeTooltip as W,renderEmptyState as O,renderLoadingState as D,resolveAxisFreeMarginDefaults as B,resolveResponsiveRules as T,resolveSvgFill as E,responsiveRuleMatches as G,useChartLegendAndMargin as $,useChartMode as Z,useChartSelection as U,useGradientLegendInteraction as _,useLinkedHover as q,useThemeSequential as K,warnMissingField as J,wrapStyleWithSelection as V}from"./c-GIKRQI4X.min.js";import{useObservationSelector as Y}from"./c-YDAY2WFR.min.js";import{getMinMax as Q}from"./c-WJCD5EUY.min.js";import{useMemo as X}from"react";import{scaleSequential as ee}from"d3-scale";import{useState as te,useEffect as oe,useMemo as ie}from"react";import{feature as ne}from"topojson-client";var re=new Map;function ae(e){return"default"in e?e.default:e}async function le(e){const t=re.get(e);if(t)return t;const{topology:o,objectName:i}=await async function(e){try{switch(e){case"world-110m":return{topology:ae(await import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:ae(await import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:ae(await import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:ae(await import("world-atlas/land-50m.json")),objectName:"land"};default:throw Error(`Unknown reference geography: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}}catch(t){if(/Cannot find module|Failed to resolve|world-atlas/i.test(t instanceof Error?t.message:t+""))throw Error(`resolveReferenceGeography("${e}"): Install the optional peer dependency \`world-atlas\` (\`npm install world-atlas\`) to use built-in reference geographies, or pass GeoJSON Feature[] to \`areas\`.`,{cause:t});throw t}}(e);if(!o||!o.objects)throw Error(`resolveReferenceGeography("${e}"): Failed to load topology. Got ${typeof o} with keys: ${o?Object.keys(o).join(", "):"none"}`);const n=ne(o,o.objects[i]),r="features"in n?n.features:[n];return re.set(e,r),r}function se(e){const t=ie(()=>Array.isArray(e)?e:void 0,[e]),[o,i]=te(null);return oe(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return i(null),le(e).then(e=>{t||i(e)}),()=>{t=!0}}var t;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),i(null)}else i(null)},[e]),void 0!==t?t:o}import{jsx as ce,jsxs as ue}from"react/jsx-runtime";function de(e){const t=Z(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=K(),{areas:i,valueAccessor:n,styleRules:l,colorScheme:s,projection:d="equalEarth",graticule:h,fitPadding:p,zoomable:f,zoomExtent:g,onZoom:y,dragRotate:v,tileURL:x,tileAttribution:k,tileCacheSize:S,tooltip:M,areaOpacity:C=1,annotations:R,legendInteraction:F,legendPosition:j,margin:P,className:H,selection:I,linkedHover:L,onObservation:z,onClick:T,chartId:E,loading:G,loadingContent:q,emptyContent:J,frameProps:Y={},stroke:Q,strokeWidth:te,opacity:oe}=e,ie=f??!!x,ne=se(i),re=X(()=>ne?A(ne):ne,[ne]),ae=X(()=>"function"==typeof n?n:e=>e?.properties?.[n]??e?.[n],[n]),le=s??o??"blues",de=X(()=>{if(!re)return ee(N(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(const o of re){const i=ae(o);null!=i&&isFinite(i)&&(e>i&&(e=i),i>t&&(t=i))}const o=N(le);return ee(o).domain([Number.isFinite(e)?e:0,Number.isFinite(t)?t:1])},[re,ae,le]),me=X(()=>{const e=de.domain();return[e[0]??0,e[1]??1]},[de]),he=_(F,ae,me),{activeSelectionHook:pe,hoverSelectionHook:fe,customHoverBehavior:ge,customClickBehavior:ye}=U({selection:I,linkedHover:L,onObservation:z,onClick:T,chartType:"ChoroplethMap",chartId:E,mobileInteraction:t.mobileInteraction}),be=c(I),ve=fe||he.legendSelectionHook||pe,xe=X(()=>{const e=m(e=>{const t=ae(e);return{fill:null!=t&&isFinite(t)?de(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:C}},l,e=>({value:ae(e)}),e=>e&&"object"==typeof e&&e.properties?{...e.properties,...e}:e),t=a(e,{stroke:Q,strokeWidth:te,opacity:oe});return ve?V(t,ve,be):t},[ae,de,ve,be,C,Q,te,oe,l]),ke=X(()=>e=>{const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||"Feature",o=ae(e);return ue("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[ce("div",{style:{fontWeight:600},children:t}),null!=o&&ce("div",{style:{opacity:.7},children:(i=o,"number"==typeof i&&isFinite(i)?Number.isInteger(i)?i.toLocaleString():i.toLocaleString(void 0,{maximumFractionDigits:2}):(i??"")+"")})]});var i},[ae]),we=B(t),Se=X(()=>{if(!1!==t.showLegend)return{gradient:{colorFn:e=>de(e),domain:me,label:"string"==typeof n?n:"value"}}},[de,t.showLegend,n,me]),{legend:Me,margin:Ae,legendPosition:Ce,legendMarginReserved:Ne}=$({data:[],colorBy:void 0,colorScale:void 0,showLegend:!1,legendPosition:j,userMargin:P,defaults:we,additionalLegend:Se,chartWidth:t.width,chartHeight:t.height,legendLayout:Y.legendLayout,frameLegend:Y,hasTitle:!!t.title,axisChrome:{hasAxis:!1}}),Re=D(G,t.width,t.height,q)||(re?null:D(!0,t.width,t.height,q)),Fe=Re?null:O(re,t.width,t.height,J);if(Array.isArray(re)&&re.length>0){const e=re[0];if(!e||"object"!=typeof e||!e.geometry)return ce(b,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:t.width,height:t.height})}const je={projection:d,areas:re,areaStyle:xe,size:[t.width,t.height],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:Ae,enableHover:t.enableHover,...Me&&{legend:Me,legendPosition:Ce},...Ne&&{__legendMarginReservedFor:Me},legendHoverBehavior:he.onLegendHover,legendClickBehavior:he.onLegendClick,legendHighlightedCategory:he.highlightedCategory,legendIsolatedCategories:"isolate"===F?he.isolatedCategories:void 0,tooltipContent:!1===M?()=>null:!0===M?ke:W(M)||ke,...null!=h&&{graticule:h},...null!=p&&{fitPadding:p},...ie&&{zoomable:!0},...g&&{zoomExtent:g},...y&&{onZoom:y},...null!=v&&{dragRotate:v},...x&&{tileURL:x},...k&&{tileAttribution:k},...S&&{tileCacheSize:S},...u({linkedHover:L,selection:I,onObservation:z,onClick:T,mobileInteraction:t.mobileInteraction,customHoverBehavior:ge,customClickBehavior:ye,linkedHoverInClickPredicate:!1}),...R&&R.length>0&&{annotations:R},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...t.title&&{title:t.title},...t.description&&{description:t.description},...t.summary&&{summary:t.summary},...void 0!==t.accessibleTable&&{accessibleTable:t.accessibleTable},...H&&{className:H},...null!=e.animate&&{animate:e.animate},...Y};return Re||Fe||ce(w,{componentName:"ChoroplethMap",width:t.width,height:t.height,children:ce(r,{...je})})}de.displayName="ChoroplethMap";import{useMemo as me,useRef as he,forwardRef as pe}from"react";var fe={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5};import{jsx as ge,jsxs as ye}from"react/jsx-runtime";var be=[3,30],ve=[1,4],xe=pe(function(e,t){const o=he(null);s(t,{variant:"geo-points",frameRef:o});const i=Z(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:n,xAccessor:c="lon",yAccessor:d="lat",sizeBy:p,sizeRange:f,colorBy:g,styleRules:y,colorScheme:b,projection:k="equalEarth",graticule:S,fitPadding:M,zoomable:A,zoomExtent:N,onZoom:F,dragRotate:j,tileURL:P,tileAttribution:H,tileCacheSize:I,areas:L,areaStyle:z=fe,tooltip:O,annotations:D,margin:T,className:E,selection:G,linkedHover:$,onObservation:U,onClick:_,chartId:q,loading:K,loadingContent:Y,emptyContent:X,legendInteraction:ee,legendPosition:te,frameProps:oe={},stroke:ie,strokeWidth:ne,opacity:re}=e,ae=f??("sparkline"===i.mode?ve:be),le="sparkline"===i.mode?1.5:6,ce=A??!!P,ue=se(L),de=l({data:n??x,rawData:n,colorBy:g,colorScheme:b,legendInteraction:ee,legendPosition:te,frameLegend:oe,selection:G,linkedHover:$,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!1,onObservation:U,onClick:_,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"ProportionalSymbolMap",chartId:q,showLegend:i.showLegend,userMargin:T,marginDefaults:B(i),loading:K,loadingContent:Y,emptyContent:X,width:i.width,height:i.height,hasTitle:!!i.title}),pe=de.data,xe=me(()=>{if(!p)return;const e="function"==typeof p?p:e=>e?.[p],t=pe.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?Q(t):void 0},[pe,p]),ke=me(()=>{const e=m(e=>({fill:g?C(e,g,de.colorScale):v,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:p?R(e,p,ae,xe):le}),y,h(g,p)),t=a(e,{stroke:ie,strokeWidth:ne,opacity:re});return de.effectiveSelectionHook?V(t,de.effectiveSelectionHook,de.resolvedSelection):t},[g,de.colorScale,de.effectiveSelectionHook,de.resolvedSelection,p,ae,xe,le,ie,ne,re,y]),we=me(()=>e=>{const t=e?.name||e?.label||e?.NAME||e?.id,o="string"==typeof p?p:null,i=("function"==typeof p?p:e=>e[p])(e),n=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(e??"")+"",r="string"==typeof g?g:null,a=r?e?.[r]:null;return ye("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t&&ge("div",{style:{fontWeight:600,marginBottom:2},children:t}),o&&null!=i&&ye("div",{children:[ye("span",{style:{opacity:.7},children:[o,": "]}),n(i)]}),r&&null!=a&&ye("div",{children:[ye("span",{style:{opacity:.7},children:[r,": "]}),a+""]}),!t&&!o&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>ye("div",{children:[ye("span",{style:{opacity:.7},children:[e,": "]}),n(t)]},e))]})},[p,g]);if(de.earlyReturn)return de.earlyReturn;J("ProportionalSymbolMap",pe,"xAccessor",c),J("ProportionalSymbolMap",pe,"yAccessor",d);const Se={projection:k,...null!=n&&{points:pe},xAccessor:c,yAccessor:d,pointStyle:ke,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...ue&&{areas:ue,areaStyle:z},...null!=S&&{graticule:S},...null!=M&&{fitPadding:M},...ce&&{zoomable:!0},...N&&{zoomExtent:N},...F&&{onZoom:F},...null!=j&&{dragRotate:j},...P&&{tileURL:P},...H&&{tileAttribution:H},...I&&{tileCacheSize:I},size:[i.width,i.height],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:de.margin,enableHover:i.enableHover,tooltipContent:!1===O?()=>null:W(O)||we,...de.legendBehaviorProps,...u({linkedHover:$,selection:G,onObservation:U,onClick:_,mobileInteraction:de.mobileInteraction,customHoverBehavior:de.customHoverBehavior,customClickBehavior:de.customClickBehavior,linkedHoverInClickPredicate:!1}),...D&&D.length>0&&{annotations:D},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...i.title&&{title:i.title},...i.description&&{description:i.description},...i.summary&&{summary:i.summary},...void 0!==i.accessibleTable&&{accessibleTable:i.accessibleTable},...E&&{className:E},...null!=e.animate&&{animate:e.animate},...oe};return ge(w,{componentName:"ProportionalSymbolMap",width:i.width,height:i.height,children:ge(r,{ref:o,...Se})})});xe.displayName="ProportionalSymbolMap";import{useMemo as ke,useCallback as we,useRef as Se,forwardRef as Me}from"react";import{scaleLinear as Ae}from"d3-scale";import{jsx as Ce,jsxs as Ne}from"react/jsx-runtime";var Re="__semiotic_x",Fe="__semiotic_y",je=Me(function(e,t){const o=Z(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{flows:i,nodes:n,nodeIdAccessor:c="id",xAccessor:d="lon",yAccessor:m="lat",valueAccessor:h="value",projection:p="equalEarth",graticule:f,fitPadding:g,zoomable:y,zoomExtent:b,onZoom:k,dragRotate:S,tileURL:M,tileAttribution:N,tileCacheSize:R,lineType:F="geo",flowStyle:j="basic",areas:P,areaStyle:H=fe,edgeColorBy:I,edgeOpacity:L=.6,edgeWidthRange:O=[1,8],pointRadius:D,edgeLinecap:T="round",colorScheme:E,showParticles:G,particleStyle:$,tooltip:U,annotations:_,margin:K,className:J,selection:X,linkedHover:ee,onObservation:te,onClick:oe,chartId:ie,loading:ne,loadingContent:re,emptyContent:ae,frameProps:le={},legendInteraction:ce,legendPosition:ue,stroke:de,strokeWidth:me,opacity:he,lineIdAccessor:pe}=e,ge=y??!!M,ye=se(P),be=ke(()=>A(n),[n]),ve=l({data:i??x,rawData:i,colorBy:I,colorScheme:E,legendInteraction:ce,legendPosition:ue,frameLegend:le,selection:X,linkedHover:ee,fallbackFields:I?["string"==typeof I?I:""]:[],unwrapData:!1,onObservation:te,onClick:oe,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"FlowMap",chartId:ie,showLegend:o.showLegend,userMargin:K,marginDefaults:B(o),loading:ne,loadingContent:re,emptyContent:ae,width:o.width,height:o.height,hasTitle:!!o.title}),xe=ve.data,Me=z(ee),je=q({name:Me?.name||"hover",fields:Me?.fields||[]}),Pe=Y(e=>e.pushObservation),He=ke(()=>{const e=new Map;for(const t of be)e.set(t[c]+"",t);return e},[be,c]),Ie=Se(null),Le=Se(He);Le.current=He;const ze=Se(d);ze.current=d;const We=Se(m);We.current=m;const Oe=we(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=Le.current,o=t.get(e.source+""),i=t.get(e.target+"");if(!o||!i)return null;const n="function"==typeof ze.current?ze.current:e=>e[ze.current],r="function"==typeof We.current?We.current:e=>e[We.current];return{...e,coordinates:[{[Re]:n(o),[Fe]:r(o)},{[Re]:n(i),[Fe]:r(i)}]}},[]);s(t,{variant:"geo-lines",frameRef:Ie,overrides:{push:e=>{const t=Oe(e);t&&Ie.current?.pushLine(t)},pushMany:e=>{const t=[];for(const o of e){const e=Oe(o);e&&t.push(e)}t.length>0&&Ie.current?.pushManyLines(t)}}});const De=ke(()=>{const e=new Map;for(const t of xe)t&&"object"==typeof t&&(null==t.source||e.has(t.source)||e.set(t.source,t),null==t.target||e.has(t.target)||e.set(t.target,t));return e},[xe]),Be=we(e=>{if(ee)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=De.get(t[c]+"");e&&je.onHover(e)}else je.onHover(t)}else je.onHover(null);if(te||Pe){const t={timestamp:Date.now(),chartType:"FlowMap",chartId:ie};if(e){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]);const i={...t,type:"hover",datum:o||{},x:e.x??0,y:e.y??0};te&&te(i),Pe&&Pe(i)}else{const e={...t,type:"hover-end"};te&&te(e),Pe&&Pe(e)}}},[ee,je,c,De,te,ie,Pe]),Te=ve.customClickBehavior,Ee=ke(()=>{const e="function"==typeof d?d:e=>e[d],t="function"==typeof m?m:e=>e[m];return xe.map(o=>{if(!o||"object"!=typeof o||null==o.source||null==o.target)return null;const i=He.get(o.source+""),n=He.get(o.target+"");return i&&n?{...o,coordinates:[{[Re]:e(i),[Fe]:t(i)},{[Re]:e(n),[Fe]:t(n)}]}:null}).filter(Boolean)},[xe,He,d,m]),Ge=ke(()=>{const e="function"==typeof d?d:e=>e[d];return t=>null!=t&&"object"==typeof t&&Re in t?t[Re]:e(t)},[d]),$e=ke(()=>{const e="function"==typeof m?m:e=>e[m];return t=>null!=t&&"object"==typeof t&&Fe in t?t[Fe]:e(t)},[m]),Ze=ke(()=>{const e=xe.filter(e=>e&&"object"==typeof e).map(e=>e[h]??0).filter(e=>isFinite(e));return 0===e.length?()=>O[0]:Ae().domain(Q(e)).range(O)},[xe,h,O]),Ue=ke(()=>e=>({stroke:I?C(e,I,ve.colorScale):v,strokeWidth:Ze(e[h]??0),strokeLinecap:T,opacity:L}),[I,ve.colorScale,Ze,h,L,T]),_e=ke(()=>{const e=a(Ue,{stroke:de,strokeWidth:me,opacity:he});if(!ve.effectiveSelectionHook)return e;const t={...ve.resolvedSelection?.unselectedStyle||{},fillOpacity:0};return V(e,ve.effectiveSelectionHook,{...ve.resolvedSelection||{},unselectedStyle:t})},[Ue,ve.effectiveSelectionHook,ve.resolvedSelection,de,me,he]),qe=D??("sparkline"===o.mode?1.5:5),Ke=ke(()=>a(()=>({fill:"#333",r:qe,fillOpacity:.8}),{stroke:de,strokeWidth:me,opacity:he}),[qe,de,me,he]),Je=ke(()=>e=>{if(e?.geometry||e?.properties||e?.data?.geometry){const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||e?.data?.properties?.name||e?.data?.properties?.NAME;if(t)return Ce("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:Ce("div",{style:{fontWeight:600},children:t})})}if(null!=e?.source&&null!=e?.target){const t=e[h];return Ne("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[Ne("div",{style:{fontWeight:600},children:[e.source," → ",e.target]}),null!=t&&Ce("div",{style:{opacity:.7},children:"number"==typeof t?t.toLocaleString():t})]})}const t=e?.name||e?.label||e?.[c];return null!=t?Ce("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:Ce("div",{style:{fontWeight:600},children:t})}):null},[h,c]);if(ve.earlyReturn)return ve.earlyReturn;const Ve={projection:p,...null!=i&&{lines:Ee},points:be,xAccessor:Ge,yAccessor:$e,lineDataAccessor:"coordinates",...null!=pe&&{lineIdAccessor:pe},lineType:F,flowStyle:j,lineStyle:_e,pointStyle:Ke,...ye&&{areas:ye,areaStyle:H},...null!=f&&{graticule:f},...null!=g&&{fitPadding:g},...ge&&{zoomable:!0},...b&&{zoomExtent:b},...k&&{onZoom:k},...null!=S&&{dragRotate:S},...G&&{showParticles:G},...$&&{particleStyle:$},...M&&{tileURL:M},...N&&{tileAttribution:N},...R&&{tileCacheSize:R},size:[o.width,o.height],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:ve.margin,enableHover:o.enableHover,tooltipContent:!1===U?()=>null:W(U)||Je,...ve.legendBehaviorProps,...u({linkedHover:ee,selection:X,onObservation:te,onClick:oe,mobileInteraction:ve.mobileInteraction,customHoverBehavior:Be,customClickBehavior:Te,linkedHoverInClickPredicate:!1}),..._&&_.length>0&&{annotations:_},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...o.title&&{title:o.title},...o.description&&{description:o.description},...o.summary&&{summary:o.summary},...void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable},...J&&{className:J},...null!=e.animate&&{animate:e.animate},...le};return Ce(w,{componentName:"FlowMap",width:o.width,height:o.height,children:Ce(r,{ref:Ie,...Ve})})});je.displayName="FlowMap";import{useMemo as Pe,useRef as He,useState as Ie,useEffect as Le,useCallback as ze,forwardRef as We}from"react";import{jsx as Oe,jsxs as De}from"react/jsx-runtime";function Be({bottomMargin:e,costLabel:t,layout:{cx:o,cy:i,maxCost:n,availableRadius:r,layout:a},ringStyle:l,ringValues:s,showNorth:c,showRingLabels:u,showRings:d}){const m="strip"===a,h={stroke:m?"var(--semiotic-border, #999)":"#999",strokeWidth:m?1:.8,strokeDasharray:m?"none":"4,3",labelColor:"var(--semiotic-text-secondary, #777)",labelSize:m?8:10,...l};return De("g",m?{children:[Oe("line",{x1:o,y1:i,x2:o+r,y2:i,stroke:h.stroke,strokeWidth:h.strokeWidth,strokeLinecap:"round",opacity:.85}),Oe("line",{x1:o,y1:i-3.5,x2:o,y2:i+3.5,stroke:h.stroke,strokeWidth:h.strokeWidth,opacity:.9}),d&&s.map(a=>{const l=o+(n>0?a/n*r:0);return De("g",{children:[Oe("line",{x1:l,y1:i-2.5,x2:l,y2:i+2.5,stroke:h.stroke,strokeWidth:.9,opacity:.65}),u&&De("text",{x:l,y:i+Math.min(10,(e??2)+8),textAnchor:"middle",fontSize:h.labelSize,fill:h.labelColor,fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",children:[a,t?" "+t:""]})]},a)})]}:{children:[s.map(e=>{const a=e/n*r;return De("g",{children:[Oe("circle",{cx:o,cy:i,r:a,fill:"none",stroke:h.stroke,strokeWidth:h.strokeWidth,strokeDasharray:h.strokeDasharray,opacity:.5}),u&&De("text",{x:o+a+3,y:i-2,fontSize:h.labelSize,fill:h.labelColor,fontFamily:"system-ui, sans-serif",children:[e,t?" "+t:""]})]},e)}),c&&De("g",{transform:"translate(24, 24)",children:[Oe("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),Oe("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),Oe("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),Oe("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),Oe("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),Oe("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]})]})}import{Fragment as Te,jsx as Ee,jsxs as Ge}from"react/jsx-runtime";var $e=We(function(e,t){const o=Z(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:i,lines:n,xAccessor:c="lon",yAccessor:d="lat",nodeIdAccessor:p="id",center:f,costAccessor:g,strength:y=1,lineMode:b="straight",projection:x="mercator",graticule:k,fitPadding:S,zoomable:M,zoomExtent:N,onZoom:R,dragRotate:F,tileURL:j,tileAttribution:P,tileCacheSize:H,transition:I,colorBy:L,styleRules:z,colorScheme:O,pointRadius:D,tooltip:T,showRings:E,showRingLabels:G,ringStyle:$,showNorth:U,costLabel:_,cartogramLayout:q,annotations:K,margin:Y,className:Q,selection:X,linkedHover:ee,onObservation:te,onClick:oe,chartId:ie,loading:ne,loadingContent:re,emptyContent:ae,legendPosition:le,frameProps:se={},stroke:ce,strokeWidth:ue,opacity:de}=e,me="sparkline"===o.mode,he=q??(me?"strip":"radial"),pe=D??(me?1.5:5),fe=E??!0,ge=G??("strip"!==he&&!o.compactMode),ye=U??("strip"!==he&&!me),be=M??!!j,ve=Pe(()=>A(i),[i]),xe=l({data:ve,rawData:i,colorBy:L,colorScheme:O,legendInteraction:void 0,legendPosition:le,frameLegend:se,selection:X,linkedHover:ee,fallbackFields:L?["string"==typeof L?L:""]:[],unwrapData:!1,onObservation:te,onClick:oe,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DistanceCartogram",chartId:ie,showLegend:o.showLegend,userMargin:Y,marginDefaults:B(o),loading:ne,loadingContent:re,emptyContent:ae,width:o.width,height:o.height,hasTitle:!!o.title}),ke=Pe(()=>{const e=m(e=>{const t=e?.[p],o=null!=t&&t+""==f+"";return{fill:L?C(e,L,xe.colorScale):v,fillOpacity:o?1:.8,stroke:o?"var(--semiotic-text, #222)":"#fff",strokeWidth:o?1.25:1,r:o?1.35*pe:pe}},z,h(L)),t=a(e,{stroke:ce,strokeWidth:ue,opacity:de});return xe.effectiveSelectionHook?V(t,xe.effectiveSelectionHook,xe.resolvedSelection):t},[L,xe.colorScale,xe.effectiveSelectionHook,xe.resolvedSelection,pe,ce,ue,de,z,f,p]),we=Pe(()=>({center:f,centerAccessor:p,costAccessor:g,strength:y,lineMode:b,layout:he}),[f,p,g,y,b,he]),Se=Pe(()=>{if(!n)return;const e="function"==typeof c?c:e=>e[c],t="function"==typeof d?d:e=>e[d],o=new Map;for(const e of ve)o.set(e[p]+"",e);return n.map(i=>{if(i.coordinates)return i;const n=o.get(i.source+""),r=o.get(i.target+"");return n&&r?{...i,coordinates:[{[c]:e(n),[d]:t(n)},{[c]:e(r),[d]:t(r)}]}:null}).filter(Boolean)},[n,ve,c,d,p]),Me=Pe(()=>e=>{const t=("function"==typeof g?g:e=>e[g])(e);return Ge("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[Ee("div",{style:{fontWeight:600},children:e[p]||e.name||e.id||"Point"}),null!=t&&Ge("div",{style:{opacity:.7},children:["Cost: ","number"==typeof t?t.toFixed(1):t]})]})},[g,p]),Ae=He(null);s(t,{variant:"geo-points",frameRef:Ae});const[Ce,Ne]=Ie(null),Re=ze(()=>{const e=Ae.current?.getCartogramLayout?.();e&&Ne(t=>t&&t.cx===e.cx&&t.cy===e.cy&&t.maxCost===e.maxCost&&t.availableRadius===e.availableRadius&&t.layout===(e.layout??"radial")?t:{cx:e.cx,cy:e.cy,maxCost:e.maxCost,availableRadius:e.availableRadius,layout:e.layout??"radial"})},[]);Le(()=>{const e=requestAnimationFrame(Re);return()=>cancelAnimationFrame(e)},[Re,y,f,o.width,o.height,ve,he]);const Fe=Pe(()=>{if(!fe||!Ce)return[];const{maxCost:e}=Ce;if(0>=e)return[];if(Array.isArray(fe))return fe.filter(t=>t>0&&e>=t);const t="number"==typeof fe?fe:Math.min("strip"===Ce.layout?3:5,Math.max(2,Math.ceil(e/5))),o=e/t,i=[];for(let e=1;t>=e;e++)i.push(Math.round(o*e*10)/10);return i},[fe,Ce]),je=Pe(()=>{if(!Ce)return se.foregroundGraphics||null;const e=Ee(Be,{bottomMargin:xe.margin.bottom,costLabel:_,layout:Ce,ringStyle:$,ringValues:Fe,showNorth:ye,showRingLabels:ge,showRings:fe}),t=se.foregroundGraphics;return"function"==typeof t?o=>Ge(Te,{children:[e,t(o)]}):Ge(Te,{children:[e,t]})},[Ce,Fe,fe,ge,ye,_,$,xe.margin.bottom,se.foregroundGraphics]);if(xe.earlyReturn)return xe.earlyReturn;J("DistanceCartogram",ve,"xAccessor",c),J("DistanceCartogram",ve,"yAccessor",d);const We={projection:x,...null!=i&&{points:ve},...Se&&{lines:Se,lineDataAccessor:"coordinates"},xAccessor:c,yAccessor:d,pointIdAccessor:p,pointStyle:ke,projectionTransform:we,...I&&{transition:{duration:I}},...null!=k&&{graticule:k},...null!=S&&{fitPadding:S},...be&&{zoomable:!0},...N&&{zoomExtent:N},...R&&{onZoom:R},...null!=F&&{dragRotate:F},...j&&{tileURL:j},...P&&{tileAttribution:P},...H&&{tileCacheSize:H},size:[o.width,o.height],maxDevicePixelRatio:e.maxDevicePixelRatio,margin:xe.margin,enableHover:o.enableHover,tooltipContent:!1===T?()=>null:W(T)||Me,...xe.legendBehaviorProps,...u({linkedHover:ee,selection:X,onObservation:te,onClick:oe,mobileInteraction:xe.mobileInteraction,customHoverBehavior:xe.customHoverBehavior,customClickBehavior:xe.customClickBehavior,linkedHoverInClickPredicate:!1}),...K&&K.length>0&&{annotations:K},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...o.title&&{title:o.title},...o.description&&{description:o.description},...o.summary&&{summary:o.summary},...void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable},...Q&&{className:Q},...null!=e.animate&&{animate:e.animate},...se,foregroundGraphics:je};return Ee(w,{componentName:"DistanceCartogram",width:o.width,height:o.height,children:Ee(r,{ref:Ae,...We})})});$e.displayName="DistanceCartogram";import{jsx as Ze}from"react/jsx-runtime";function Ue(e){if(Number.isFinite(e))return Math.max(1,Math.round(e))}function _e(e,t,o){return Math.max(t,Math.min(o,e))}function qe(e){let t=1/0,o=-1/0;for(const i of e)Number.isFinite(i)&&(t>i&&(t=i),i>o&&(o=i));return t===1/0?[0,0]:[t,o]}function Ke(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function Je(e,t={}){const o=e.map((e,t)=>({...e,index:t})).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y));if(0===o.length)return[];const i=_e(Number.isFinite(t.occupancy)?Number(t.occupancy):.72,.2,1),n=Number.isFinite(t.aspectRatio)&&Number(t.aspectRatio)>0?Number(t.aspectRatio):1.8;let r=Ue(t.columns)??Math.max(1,Math.ceil(Math.sqrt(o.length*n/i))),a=Ue(t.rows)??Math.max(1,Math.ceil(o.length/(r*i)));o.length>r*a&&(null!=t.columns&&null==t.rows?a=Math.ceil(o.length/r):null!=t.rows&&null==t.columns?r=Math.ceil(o.length/a):a=Math.ceil(o.length/r));const l=qe(o.map(e=>e.x)),s=qe(o.map(e=>e.y)),c=o.map(e=>({...e,desiredColumn:Ke(e.x,l)*Math.max(0,r-1),desiredRow:Ke(e.y,s)*Math.max(0,a-1)})),u=(r-1)/2,d=(a-1)/2;c.sort((e,t)=>(t.desiredColumn-u)**2+(t.desiredRow-d)**2-((e.desiredColumn-u)**2+(e.desiredRow-d)**2)||e.desiredRow-t.desiredRow||e.desiredColumn-t.desiredColumn||e.index-t.index);const m=new Set;for(let e=0;a>e;e+=1)for(let t=0;r>t;t+=1)m.add(e*r+t);const h=[];for(const e of c){let t=-1,o=1/0;for(const i of m){const n=(i%r-e.desiredColumn)**2+(Math.floor(i/r)-e.desiredRow)**2;(o>n||n===o&&t>i)&&(t=i,o=n)}0>t||(m.delete(t),h.push({datum:e.datum,x:e.x,y:e.y,row:Math.floor(t/r),column:t%r,index:e.index}))}return h.sort((e,t)=>e.index-t.index),h.map(({index:e,...t})=>t)}function Ve(e,t,o=[]){if("function"==typeof t)return t(e);if("string"==typeof t)return e[t];for(const t of o)if(null!=e[t])return e[t]}function Ye(e){return e.map(([e,t],o)=>`${0===o?"M":"L"}${e},${t}`).join("")+"Z"}var Qe=e=>{const t=e.config,o=t.source??"auto",i="areas"===o||"auto"===o&&e.areas.length>0,n=i?function(e){return e.areas.map((t,o)=>{const i=function(e,t){const o=e.properties&&"object"==typeof e.properties?e.properties:{},i=e.id??o.id??o.name??"area-"+t;return{...o,id:i+""}}(t,o),n=e.scales.geoPath.centroid(t),r=Number.isFinite(n[0])&&Number.isFinite(n[1])?e.scales.invertedPoint(n[0],n[1]):null;return{datum:{...i,gridLongitude:r?.[0],gridLatitude:r?.[1]},x:n[0],y:n[1]}}).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))}(e):e.points.map((e,t)=>({datum:e,x:t,y:t})),r=n.filter((e,o)=>!t.filter||t.filter(e.datum,o)),a=function(e,t){if(!t.rowAccessor||!t.columnAccessor)return null;const o=e.map(e=>({datum:e,x:Number(Ve(e,t.columnAccessor)),y:Number(Ve(e,t.rowAccessor))})).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y));return o.length!==e.length?null:o.map(e=>({...e,row:e.y,column:e.x}))}(r.map(e=>e.datum),t),l=i?r:function(e){return e.points.map(t=>{const o=Number(Ve(t,e.config.longitudeAccessor,["lon","longitude"])),i=Number(Ve(t,e.config.latitudeAccessor,["lat","latitude"])),n=Number.isFinite(o)&&Number.isFinite(i)?e.scales.projectedPoint(o,i):null;return{datum:t,x:n?.[0]??NaN,y:n?.[1]??NaN}}).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))}({...e,points:r.map(e=>e.datum)}),s=a??Je(l,{columns:t.columns,rows:t.rows,occupancy:t.occupancy,aspectRatio:e.dimensions.width/Math.max(1,e.dimensions.height)});if(0===s.length)return{nodes:[]};const c=qe(s.map(e=>e.row)),u=qe(s.map(e=>e.column)),d=Math.max(1,Math.round(c[1]-c[0])+1),m=Math.max(1,Math.round(u[1]-u[0])+1),h=Math.max(0,t.layoutPadding??8),p=Math.max(1,e.dimensions.width-2*h)/m,f=Math.max(1,e.dimensions.height-2*h)/d,g=(e.dimensions.width-p*m)/2,y=(e.dimensions.height-f*d)/2,b=_e(t.cellPadding??.12,0,.8),v=Math.max(1,.5*Math.min(p,f)*(1-b)),x=t.sizeAccessor?s.map(e=>Number(Ve(e.datum,t.sizeAccessor))):[],k=t.sizeDomain??qe(x),w=t.sizeRange??[.36,1],S=_e(Math.min(w[0],w[1]),.05,1),M=_e(Math.max(w[0],w[1]),S,1),A=s.map((o,i)=>{const n={...o.datum,gridRow:o.row,gridColumn:o.column},r=(Ve(n,t.idAccessor,["id","key","name"])??"grid-"+i)+"",a=(Ve(n,t.labelAccessor,["abbr","code","label","name","id"])??r)+"",l=Math.max(1,t.maxLabelLength??4),s=a.length>l?a.slice(0,l):a,d=Ve(n,t.categoryAccessor),m=null==d?void 0:d+"",h=Ve(n,t.fillAccessor),b=null!=h?h+"":m?e.resolveColor(m):e.theme.categorical[0]??"#4f86c6",x=t.sizeAccessor?Number(Ve(n,t.sizeAccessor)):NaN,w=t.sizeAccessor&&Number.isFinite(x)?Math.sqrt(_e(Ke(x,k),0,1)):1,A=v*(S+w*(M-S)),C="function"==typeof t.markStyle?t.markStyle(n,i):t.markStyle;return{datum:n,id:r,label:s,category:m,row:o.row,column:o.column,x:g+(o.column-u[0]+.5)*p,y:y+(o.row-c[0]+.5)*f,radius:A,style:{fill:b,fillOpacity:.94,stroke:"rgba(255,255,255,0.9)",strokeWidth:1,...C}}}),C=t.shape??"circle";return{nodes:A.map(e=>{return"circle"===C?{type:"point",x:e.x,y:e.y,r:e.radius,style:e.style,datum:e.datum,accessibleDatum:e.datum,accessibility:{label:e.label,tableFields:{name:e.datum.name??e.label,label:e.label,row:e.row,column:e.column,...e.category?{category:e.category}:{}}},pointId:e.id,_transitionKey:e.id}:{type:"geoarea",pathData:"hexagon"===C?function(e,t,o){const i=[];for(let n=0;6>n;n+=1){const r=-Math.PI/2+n*(Math.PI/3);i.push([e+Math.cos(r)*o,t+Math.sin(r)*o])}return Ye(i)}(e.x,e.y,e.radius):Ye([[(t=e.x)-(i=e.radius),(o=e.y)-i],[t+i,o-i],[t+i,o+i],[t-i,o+i]]),centroid:[e.x,e.y],bounds:[[e.x-e.radius,e.y-e.radius],[e.x+e.radius,e.y+e.radius]],screenArea:"hexagon"===C?3*Math.sqrt(3)*e.radius*e.radius/2:(2*e.radius)**2,style:e.style,datum:e.datum,accessibleDatum:e.datum,accessibility:{label:e.label,tableFields:{name:e.datum.name??e.label,label:e.label,row:e.row,column:e.column,...e.category?{category:e.category}:{}}},group:e.category,interactive:!0};var t,o,i}),overlays:!1===t.showLabels?null:Ze(Xe,{marks:A,color:t.labelColor??"#ffffff",fontSize:t.labelFontSize??_e(.23*Math.min(p,f),7,14),fontFamily:t.labelFontFamily,fontWeight:t.labelFontWeight??700}),restyle:(e,t)=>t?.isActive&&e.datum?{opacity:t.predicate(e.datum)?1:.18}:{opacity:1}}};function Xe({marks:e,color:t,fontSize:o,fontFamily:i,fontWeight:n}){const r=d();return Ze("g",{"aria-hidden":"true",pointerEvents:"none",children:e.map(e=>{const a=!r.isActive||r.predicate(e.datum);return Ze("text",{x:e.x,y:e.y,fill:t,fontFamily:i,fontSize:o,fontWeight:n,opacity:a?1:.18,textAnchor:"middle",dominantBaseline:"central",children:e.label},e.id)})})}import{geoBounds as et,geoContains as tt}from"d3-geo";import{jsx as ot}from"react/jsx-runtime";var it=new WeakMap,nt=new WeakMap,rt=new WeakMap,at=1;function lt(e,t,o){return Math.max(t,Math.min(o,e))}function st(e){if(Number.isFinite(e)&&Number(e)>0)return Number(e)}function ct(e,t){return"function"==typeof t?t(e,e.dotIndex):"string"==typeof t?e[t]:void 0}function ut(e){return e.properties&&"object"==typeof e.properties?{...e.properties}:{}}function dt(e,t){const o=ut(e);return(e.id??o.id??o.name??"feature-"+t)+""}function mt(e,t,o,i){return[Math.ceil((e-o)/i-.5),Math.floor((t-o)/i-.5)]}function ht(e){if(!e)return 0;const t=rt.get(e);if(t)return t;const o=at;return at+=1,rt.set(e,o),o}function pt(e,t){return!t||!(t[0][1]>e[1]||e[1]>t[1][1]||(o=e[0],i=t[0][0],n=t[1][0],i>n?i>o&&o>n:i>o||o>n));var o,i,n}function ft(e,t){for(const o of e){const{feature:e,index:i}=o;if(e.geometry&&pt(t,o.bounds))try{if(tt(e,t))return{feature:e,index:i}}catch{}}return null}function gt(e,t,o,i={}){const n=e.filter((e,t)=>e.geometry&&(!i.featureFilter||i.featureFilter(e,t))),r=function(e,t){if(0===e.length)return null;const o=t.bounds({type:"FeatureCollection",features:e});return Number.isFinite(o[0][0])&&Number.isFinite(o[0][1])&&Number.isFinite(o[1][0])&&Number.isFinite(o[1][1])?o:null}(n,t.geoPath);if(!r)return{dots:[],cellSize:10,features:n};const a=Math.max(0,i.layoutPadding??0),l=[[lt(r[0][0],a,Math.max(a,o.width-a)),lt(r[0][1],a,Math.max(a,o.height-a))],[lt(r[1][0],a,Math.max(a,o.width-a)),lt(r[1][1],a,Math.max(a,o.height-a))]],s=Math.max(0,l[1][0]-l[0][0]),c=Math.max(0,l[1][1]-l[0][1]);if(0===s||0===c)return{dots:[],cellSize:10,features:n};const u=st(i.columns);let d=Math.max(2,u?s/u:st(i.cellSize)??10);const m=Math.max(100,Math.round(st(i.maxSamples)??25e3)),h=Math.ceil(s/d)*Math.ceil(c/d);h>m&&(d*=Math.sqrt(h/m));const p=i.gridOrigin?.[0]??0,f=i.gridOrigin?.[1]??0,[g,y]=mt(l[0][0],l[1][0],p,d),[b,v]=mt(l[0][1],l[1][1],f,d),x=[],k=function(e){return e.map((e,t)=>{if(nt.has(e))return{feature:e,index:t,bounds:nt.get(e)??null};try{const o=et(e);return nt.set(e,o),{feature:e,index:t,bounds:o}}catch{return nt.set(e,null),{feature:e,index:t,bounds:null}}})}(n);for(let e=b;v>=e;e+=1){const o=f+(e+.5)*d;for(let n=g;y>=n;n+=1){const r=t.invertedPoint(p+(n+.5)*d,o);if(!r||!Number.isFinite(r[0])||!Number.isFinite(r[1]))continue;const a=ft(k,r);if(!a)continue;const l={...ut(a.feature),featureId:dt(a.feature,a.index),featureIndex:a.index,gridRow:e,gridColumn:n,longitude:r[0],latitude:r[1],dotIndex:x.length};i.dotFilter&&!i.dotFilter(l,x.length)||x.push(l)}}return{dots:x,cellSize:d,features:n}}function yt(e){return Math.round(1e4*e)/1e4}function bt(e){return Array.isArray(e)&&e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1])?`${yt(Number(e[0]))},${yt(Number(e[1]))}`:"null"}function vt(e,t){const o=e[t];return"function"==typeof o?o.call(e):void 0}function xt(e){return"number"==typeof e&&Number.isFinite(e)?yt(e)+"":null===e?"null":"unavailable"}function kt(e){const t=e.scales.projection;return[xt(vt(t,"scale")),bt(vt(t,"translate")),bt(vt(t,"center")),(o=vt(t,"rotate"),Array.isArray(o)&&o.every(Number.isFinite)?o.map(e=>yt(Number(e))).join(","):"unavailable"),xt(vt(t,"clipAngle")),xt(vt(t,"precision")),...[[0,0],[-120,35],[45,45],[120,-30]].map(([t,o])=>bt(e.scales.projectedPoint(t,o)))].join("|");var o}function wt(e){return e.map(([e,t],o)=>`${0===o?"M":"L"}${e},${t}`).join("")+"Z"}var St=e=>{const t=function(e){let t=it.get(e.areas);t||(t=new Map,it.set(e.areas,t));const o=function(e){const t=e.config;return[e.areas.length,e.dimensions.width,e.dimensions.height,t.cellSize??"",t.columns??"",t.layoutPadding??"",t.gridOrigin?.join(",")??"",t.maxSamples??"",ht(t.featureFilter),ht(t.dotFilter),kt(e)].join("::")}(e),i=t.get(o);if(i)return i;const n=gt(e.areas,e.scales,e.dimensions,e.config);if(t.size>=12){const e=t.keys().next().value;void 0!==e&&t.delete(e)}return t.set(o,n),n}(e),o=e.config,i=o.shape??"circle",n=Math.max(.5,st(o.dotRadius)??t.cellSize*lt(o.radiusRatio??.24,.05,.5)),r=o.gridOrigin?.[0]??0,a=o.gridOrigin?.[1]??0;return{nodes:t.dots.map((l,s)=>{const c=r+(l.gridColumn+.5)*t.cellSize,u=a+(l.gridRow+.5)*t.cellSize,d=ct(l,o.categoryAccessor),m=ct(l,o.fillAccessor),h={fill:null!=m?m+"":null!=d?e.resolveColor(d+""):e.theme.categorical[0]??"#4f86c6",fillOpacity:.92,strokeWidth:0,..."function"==typeof o.markStyle?o.markStyle(l,s):o.markStyle},p=`dot-${l.gridRow}-${l.gridColumn}`;if("circle"===i)return{type:"point",x:c,y:u,r:n,style:h,datum:l,interactive:!1,pointId:p,_transitionKey:p};const f="hexagon"===i?function(e,t,o){return wt(Array.from({length:6},(i,n)=>{const r=-Math.PI/2+n*(Math.PI/3);return[e+Math.cos(r)*o,t+Math.sin(r)*o]}))}(c,u,n):function(e,t,o){return wt([[e-o,t-o],[e+o,t-o],[e+o,t+o],[e-o,t+o]])}(c,u,n);return{type:"geoarea",pathData:f,centroid:[c,u],bounds:[[c-n,u-n],[c+n,u+n]],screenArea:"hexagon"===i?3*Math.sqrt(3)*n*n/2:(2*n)**2,style:h,datum:l,group:l.featureId,interactive:!1}}),overlays:o.showOutline?ot("g",{"aria-hidden":"true",pointerEvents:"none",children:t.features.map((t,i)=>{const n=e.scales.geoPath(t);return n?ot("path",{d:n,fill:"none",stroke:o.outlineStyle?.stroke??"currentColor",strokeOpacity:o.outlineStyle?.opacity??o.outlineStyle?.fillOpacity??.22,strokeWidth:o.outlineStyle?.strokeWidth??.7,strokeDasharray:o.outlineStyle?.strokeDasharray,strokeLinecap:o.outlineStyle?.strokeLinecap,vectorEffect:"non-scaling-stroke"},dt(t,i)):null})}):null,restyle:(e,t)=>t?.isActive&&e.datum?{opacity:t.predicate(e.datum)?1:.14}:{opacity:1}}};function Mt(e,t,o){const{featureKey:i,dataKey:n}=o,r=new Map;for(const e of t){const t=(Object.prototype.hasOwnProperty.call(e,n)?e[n]:void 0)+"";r.set(t,e)}return e.map(e=>{const t=(e=>{const t=i.split(".");let o=e;for(const e of t)o=null!==o&&"object"==typeof o&&Object.prototype.hasOwnProperty.call(o,e)?o[e]:void 0;return(o??"")+""})(e),o=r.get(t);return o?{...e,properties:{...e.properties,...o}}:e})}export{de as ChoroplethMap,e as DEFAULT_HIT_RADIUS,$e as DistanceCartogram,je as FlowMap,n as GeoCustomChart,k as MultiLineTooltip,xe as ProportionalSymbolMap,r as StreamGeoFrame,S as Tooltip,M as TooltipRoot,m as composeStyleRules,t as geoAreaHitTarget,o as geoHitTarget,St as geographicDotGridLayout,Qe as geographicGridLayout,F as glyphExtent,j as glyphPlacement,Je as gridifyGeographicPoints,P as hatchFillId,H as hatchPatternDef,i as hitTargetPoint,I as isHatchFill,h as makeNodeRuleContext,p as makeRuleValueResolver,L as markTooltipChrome,f as matchesThreshold,Mt as mergeData,le as resolveReferenceGeography,T as resolveResponsiveRules,g as resolveStyleRules,E as resolveSvgFill,G as responsiveRuleMatches,y as ruleMatches,gt as sampleGeographicDotGrid};
2
+ import{DEFAULT_HIT_RADIUS as e,geoAreaHitTarget as t,geoHitTarget as o,hitTargetPoint as i}from"./c-3BLJEQNG.min.js";import{GeoCustomChart as n,StreamGeoFrame_default as r}from"./c-SFDIIU5G.min.js";import"./c-U6ESPM7V.min.js";import{useChartSetup as a,useFrameImperativeHandle as l,useResolvedSelection as s}from"./c-F5ZB5GJ6.min.js";import"./c-5D2S4RMI.min.js";import"./c-CZF7MV67.min.js";import"./c-RJKEKZOO.min.js";import"./c-VGKUEZBC.min.js";import"./c-T6UAIKBH.min.js";import"./c-OCI56QF2.min.js";import"./c-54IRWOGM.min.js";import{buildCustomBehaviorProps as c,mergeShapeStyle as u}from"./c-AG7WWVIH.min.js";import{useCustomLayoutSelection as d}from"./c-G36WS6LN.min.js";import"./c-UC5PTTFI.min.js";import"./c-DBQ2V7CH.min.js";import"./c-QSGWX53A.min.js";import"./c-VPZDY5Q4.min.js";import{ChartError as m,EMPTY_ARRAY as h,MultiLineTooltip as p,SafeRender as f,Tooltip as g,TooltipRoot as y,composeStyleRules as b,filterSparseArray as v,makeNodeRuleContext as x,makeRuleValueResolver as k,markTooltipChrome as w,matchesThreshold as S,normalizeLinkedHover as M,normalizeTooltip as A,renderEmptyState as C,renderLoadingState as R,resolveAxisFreeMarginDefaults as N,resolveResponsiveRules as j,resolveStyleRules as F,responsiveRuleMatches as P,ruleMatches as H,useChartLegendAndMargin as I,useChartMode as L,useChartSelection as z,useGradientLegendInteraction as W,useLinkedHover as O,useThemeSequential as B,warnMissingField as D,wrapStyleWithSelection as E}from"./c-VN2HG5BS.min.js";import"./c-GR6MOEQC.min.js";import{useObservationSelector as T}from"./c-VRXUB2F2.min.js";import{getMinMax as G}from"./c-GGISSW5E.min.js";import{DEFAULT_COLOR as U,getColor as Z,getSequentialInterpolator as $,getSize as V}from"./c-EGR6VYBW.min.js";import"./c-PGKQGGQ2.min.js";import{glyphExtent as _,glyphPlacement as K,hatchFillId as q,hatchPatternDef as Q,isHatchFill as J,resolveSvgFill as X}from"./c-QKHMBE2E.min.js";import{useMemo as Y}from"react";import{scaleSequential as ee}from"d3-scale";import{useState as te,useEffect as oe,useMemo as ie}from"react";import{feature as ne}from"topojson-client";var re=new Map;function ae(e){return"default"in e?e.default:e}async function le(e){const t=re.get(e);if(t)return t;const{topology:o,objectName:i}=await async function(e){try{switch(e){case"world-110m":return{topology:ae(await import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:ae(await import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:ae(await import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:ae(await import("world-atlas/land-50m.json")),objectName:"land"};default:throw Error(`Unknown reference geography: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}}catch(t){if(/Cannot find module|Failed to resolve|world-atlas/i.test(t instanceof Error?t.message:t+""))throw Error(`resolveReferenceGeography("${e}"): Install the optional peer dependency \`world-atlas\` (\`npm install world-atlas\`) to use built-in reference geographies, or pass GeoJSON Feature[] to \`areas\`.`,{cause:t});throw t}}(e);if(!o||!o.objects)throw Error(`resolveReferenceGeography("${e}"): Failed to load topology. Got ${typeof o} with keys: ${o?Object.keys(o).join(", "):"none"}`);const n=ne(o,o.objects[i]),r="features"in n?n.features:[n];return re.set(e,r),r}function se(e){const t=ie(()=>Array.isArray(e)?e:void 0,[e]),[o,i]=te(null);return oe(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return i(null),le(e).then(e=>{t||i(e)}),()=>{t=!0}}var t;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),i(null)}else i(null)},[e]),void 0!==t?t:o}import{jsx as ce,jsxs as ue}from"react/jsx-runtime";function de(e){return e.properties&&"object"==typeof e.properties?{...e.properties,...e}:e}function me(e){const t=L(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=B(),{areas:i,valueAccessor:n,styleRules:a,colorScheme:l,projection:d="equalEarth",graticule:h,fitPadding:p,zoomable:g,zoomExtent:y,onZoom:x,dragRotate:k,tileURL:w,tileAttribution:S,tileCacheSize:M,tooltip:j,areaOpacity:F=1,annotations:P,legendInteraction:H,legendPosition:O,margin:D,className:T,selection:G,linkedHover:U,onObservation:Z,onClick:V,chartId:_,loading:K,loadingContent:q,emptyContent:Q,frameProps:J={},stroke:X,strokeWidth:te,opacity:oe}=e,ie=g??!!w,ne=se(i),re=Y(()=>ne?v(ne):ne,[ne]),ae=Y(()=>"function"==typeof n?n:e=>e?.properties?.[n]??e?.[n],[n]),le=l??o??"blues",me=Y(()=>{if(!re)return ee($(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(const o of re){const i=ae(o);null!=i&&isFinite(i)&&(e>i&&(e=i),i>t&&(t=i))}const o=$(le);return ee(o).domain([Number.isFinite(e)?e:0,Number.isFinite(t)?t:1])},[re,ae,le]),he=Y(()=>{const e=me.domain();return[e[0]??0,e[1]??1]},[me]),pe=W(H,ae,he),{activeSelectionHook:fe,hoverSelectionHook:ge,customHoverBehavior:ye,customClickBehavior:be}=z({selection:G,linkedHover:U,onObservation:Z,onClick:V,chartType:"ChoroplethMap",chartId:_,mobileInteraction:t.mobileInteraction}),ve=s(G),xe=ge||pe.legendSelectionHook||fe,ke=Y(()=>{const e=b(e=>{const t=ae(e);return{fill:null!=t&&isFinite(t)?me(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:F}},a,e=>({value:ae(e)}),e=>e&&"object"==typeof e&&e.properties?{...e.properties,...e}:e),t=u(e,{stroke:X,strokeWidth:te,opacity:oe});return xe?E(t,xe,ve,de):t},[ae,me,xe,ve,F,X,te,oe,a]),we=Y(()=>e=>{const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||"Feature",o=ae(e);return ue("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[ce("div",{style:{fontWeight:600},children:t}),null!=o&&ce("div",{style:{opacity:.7},children:(i=o,"number"==typeof i&&isFinite(i)?Number.isInteger(i)?i.toLocaleString():i.toLocaleString(void 0,{maximumFractionDigits:2}):(i??"")+"")})]});var i},[ae]),Se=N(t),Me=Y(()=>{if(!1!==t.showLegend)return{gradient:{colorFn:e=>me(e),domain:he,label:"string"==typeof n?n:"value"}}},[me,t.showLegend,n,he]),{legend:Ae,margin:Ce,legendPosition:Re,legendMarginReserved:Ne}=I({data:[],colorBy:void 0,colorScale:void 0,showLegend:!1,legendPosition:O,userMargin:D,defaults:Se,additionalLegend:Me,chartWidth:t.width,chartHeight:t.height,legendLayout:J.legendLayout,frameLegend:J,hasTitle:!!t.title,axisChrome:{hasAxis:!1}}),je=R(K,t.width,t.height,q)||(re?null:R(!0,t.width,t.height,q)),Fe=je?null:C(re,t.width,t.height,Q);if(Array.isArray(re)&&re.length>0){const e=re[0];if(!e||"object"!=typeof e||!e.geometry)return ce(m,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:t.width,height:t.height})}const Pe={projection:d,areas:re,areaStyle:ke,size:[t.width,t.height],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:Ce,enableHover:t.enableHover,...Ae&&{legend:Ae,legendPosition:Re},...Ne&&{__legendMarginReservedFor:Ae},legendHoverBehavior:pe.onLegendHover,legendClickBehavior:pe.onLegendClick,legendHighlightedCategory:pe.highlightedCategory,legendIsolatedCategories:"isolate"===H?pe.isolatedCategories:void 0,tooltipContent:!1===j?()=>null:!0===j?we:A(j)||we,...null!=h&&{graticule:h},...null!=p&&{fitPadding:p},...ie&&{zoomable:!0},...y&&{zoomExtent:y},...x&&{onZoom:x},...null!=k&&{dragRotate:k},...w&&{tileURL:w},...S&&{tileAttribution:S},...M&&{tileCacheSize:M},...c({linkedHover:U,selection:G,onObservation:Z,onClick:V,mobileInteraction:t.mobileInteraction,customHoverBehavior:ye,customClickBehavior:be,linkedHoverInClickPredicate:!1}),...P&&P.length>0&&{annotations:P},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...t.title&&{title:t.title},...t.description&&{description:t.description},...t.summary&&{summary:t.summary},...void 0!==t.accessibleTable&&{accessibleTable:t.accessibleTable},...T&&{className:T},...null!=e.animate&&{animate:e.animate},...J};return je||Fe||ce(f,{componentName:"ChoroplethMap",width:t.width,height:t.height,children:ce(r,{...Pe})})}me.displayName="ChoroplethMap";import{useMemo as he,useRef as pe,forwardRef as fe}from"react";var ge={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5};import{jsx as ye,jsxs as be}from"react/jsx-runtime";var ve=[3,30],xe=[1,4],ke=fe(function(e,t){const o=pe(null);l(t,{variant:"geo-points",frameRef:o});const i=L(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:n,xAccessor:s="lon",yAccessor:d="lat",sizeBy:m,sizeRange:p,colorBy:g,styleRules:y,colorScheme:v,projection:k="equalEarth",graticule:w,fitPadding:S,zoomable:M,zoomExtent:C,onZoom:R,dragRotate:j,tileURL:F,tileAttribution:P,tileCacheSize:H,areas:I,areaStyle:z=ge,tooltip:W,annotations:O,margin:B,className:T,selection:$,linkedHover:_,onObservation:K,onClick:q,chartId:Q,loading:J,loadingContent:X,emptyContent:Y,legendInteraction:ee,legendPosition:te,frameProps:oe={},stroke:ie,strokeWidth:ne,opacity:re}=e,ae=p??("sparkline"===i.mode?xe:ve),le="sparkline"===i.mode?1.5:6,ce=M??!!F,ue=se(I),de=a({data:n??h,rawData:n,colorBy:g,colorScheme:v,legendInteraction:ee,legendPosition:te,frameLegend:oe,selection:$,linkedHover:_,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!1,onObservation:K,onClick:q,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"ProportionalSymbolMap",chartId:Q,showLegend:i.showLegend,userMargin:B,marginDefaults:N(i),loading:J,loadingContent:X,emptyContent:Y,width:i.width,height:i.height,hasTitle:!!i.title}),me=de.data,fe=he(()=>{if(!m)return;const e="function"==typeof m?m:e=>e?.[m],t=me.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?G(t):void 0},[me,m]),ke=he(()=>{const e=b(e=>({fill:g?Z(e,g,de.colorScale):U,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:m?V(e,m,ae,fe):le}),y,x(g,m)),t=u(e,{stroke:ie,strokeWidth:ne,opacity:re});return de.effectiveSelectionHook?E(t,de.effectiveSelectionHook,de.resolvedSelection):t},[g,de.colorScale,de.effectiveSelectionHook,de.resolvedSelection,m,ae,fe,le,ie,ne,re,y]),we=he(()=>e=>{const t=e?.name||e?.label||e?.NAME||e?.id,o="string"==typeof m?m:null,i=("function"==typeof m?m:e=>e[m])(e),n=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(e??"")+"",r="string"==typeof g?g:null,a=r?e?.[r]:null;return be("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t&&ye("div",{style:{fontWeight:600,marginBottom:2},children:t}),o&&null!=i&&be("div",{children:[be("span",{style:{opacity:.7},children:[o,": "]}),n(i)]}),r&&null!=a&&be("div",{children:[be("span",{style:{opacity:.7},children:[r,": "]}),a+""]}),!t&&!o&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>be("div",{children:[be("span",{style:{opacity:.7},children:[e,": "]}),n(t)]},e))]})},[m,g]);if(de.earlyReturn)return de.earlyReturn;D("ProportionalSymbolMap",me,"xAccessor",s),D("ProportionalSymbolMap",me,"yAccessor",d);const Se={projection:k,...null!=n&&{points:me},xAccessor:s,yAccessor:d,pointStyle:ke,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...ue&&{areas:ue,areaStyle:z},...null!=w&&{graticule:w},...null!=S&&{fitPadding:S},...ce&&{zoomable:!0},...C&&{zoomExtent:C},...R&&{onZoom:R},...null!=j&&{dragRotate:j},...F&&{tileURL:F},...P&&{tileAttribution:P},...H&&{tileCacheSize:H},size:[i.width,i.height],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:de.margin,enableHover:i.enableHover,tooltipContent:!1===W?()=>null:A(W)||we,...de.legendBehaviorProps,...c({linkedHover:_,selection:$,onObservation:K,onClick:q,mobileInteraction:de.mobileInteraction,customHoverBehavior:de.customHoverBehavior,customClickBehavior:de.customClickBehavior,linkedHoverInClickPredicate:!1}),...O&&O.length>0&&{annotations:O},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...i.title&&{title:i.title},...i.description&&{description:i.description},...i.summary&&{summary:i.summary},...void 0!==i.accessibleTable&&{accessibleTable:i.accessibleTable},...T&&{className:T},...null!=e.animate&&{animate:e.animate},...oe};return ye(f,{componentName:"ProportionalSymbolMap",width:i.width,height:i.height,children:ye(r,{ref:o,...Se})})});ke.displayName="ProportionalSymbolMap";import{useMemo as we,useCallback as Se,useRef as Me,forwardRef as Ae}from"react";import{scaleLinear as Ce}from"d3-scale";import{jsx as Re,jsxs as Ne}from"react/jsx-runtime";var je="__semiotic_x",Fe="__semiotic_y",Pe=Ae(function(e,t){const o=L(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{flows:i,nodes:n,nodeIdAccessor:s="id",xAccessor:d="lon",yAccessor:m="lat",valueAccessor:p="value",projection:g="equalEarth",graticule:y,fitPadding:b,zoomable:x,zoomExtent:k,onZoom:w,dragRotate:S,tileURL:C,tileAttribution:R,tileCacheSize:j,lineType:F="geo",flowStyle:P="basic",areas:H,areaStyle:I=ge,edgeColorBy:z,edgeOpacity:W=.6,edgeWidthRange:B=[1,8],pointRadius:D,edgeLinecap:$="round",colorScheme:V,showParticles:_,particleStyle:K,tooltip:q,annotations:Q,margin:J,className:X,selection:Y,linkedHover:ee,onObservation:te,onClick:oe,chartId:ie,loading:ne,loadingContent:re,emptyContent:ae,frameProps:le={},legendInteraction:ce,legendPosition:ue,stroke:de,strokeWidth:me,opacity:he,lineIdAccessor:pe}=e,fe=x??!!C,ye=se(H),be=we(()=>v(n),[n]),ve=a({data:i??h,rawData:i,colorBy:z,colorScheme:V,legendInteraction:ce,legendPosition:ue,frameLegend:le,selection:Y,linkedHover:ee,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!1,onObservation:te,onClick:oe,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"FlowMap",chartId:ie,showLegend:o.showLegend,userMargin:J,marginDefaults:N(o),loading:ne,loadingContent:re,emptyContent:ae,width:o.width,height:o.height,hasTitle:!!o.title}),xe=ve.data,ke=M(ee),Ae=O({name:ke?.name||"hover",fields:ke?.fields||[]}),Pe=T(e=>e.pushObservation),He=we(()=>{const e=new Map;for(const t of be)e.set(t[s]+"",t);return e},[be,s]),Ie=Me(null),Le=Me(He);Le.current=He;const ze=Me(d);ze.current=d;const We=Me(m);We.current=m;const Oe=Se(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=Le.current,o=t.get(e.source+""),i=t.get(e.target+"");if(!o||!i)return null;const n="function"==typeof ze.current?ze.current:e=>e[ze.current],r="function"==typeof We.current?We.current:e=>e[We.current];return{...e,coordinates:[{[je]:n(o),[Fe]:r(o)},{[je]:n(i),[Fe]:r(i)}]}},[]);l(t,{variant:"geo-lines",frameRef:Ie,overrides:{push:e=>{const t=Oe(e);t&&Ie.current?.pushLine(t)},pushMany:e=>{const t=[];for(const o of e){const e=Oe(o);e&&t.push(e)}t.length>0&&Ie.current?.pushManyLines(t)}}});const Be=we(()=>{const e=new Map;for(const t of xe)t&&"object"==typeof t&&(null==t.source||e.has(t.source)||e.set(t.source,t),null==t.target||e.has(t.target)||e.set(t.target,t));return e},[xe]),De=Se(e=>{if(ee)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=Be.get(t[s]+"");e&&Ae.onHover(e)}else Ae.onHover(t)}else Ae.onHover(null);if(te||Pe){const t={timestamp:Date.now(),chartType:"FlowMap",chartId:ie};if(e){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]);const i={...t,type:"hover",datum:o||{},x:e.x??0,y:e.y??0};te&&te(i),Pe&&Pe(i)}else{const e={...t,type:"hover-end"};te&&te(e),Pe&&Pe(e)}}},[ee,Ae,s,Be,te,ie,Pe]),Ee=ve.customClickBehavior,Te=we(()=>{const e="function"==typeof d?d:e=>e[d],t="function"==typeof m?m:e=>e[m];return xe.map(o=>{if(!o||"object"!=typeof o||null==o.source||null==o.target)return null;const i=He.get(o.source+""),n=He.get(o.target+"");return i&&n?{...o,coordinates:[{[je]:e(i),[Fe]:t(i)},{[je]:e(n),[Fe]:t(n)}]}:null}).filter(Boolean)},[xe,He,d,m]),Ge=we(()=>{const e="function"==typeof d?d:e=>e[d];return t=>null!=t&&"object"==typeof t&&je in t?t[je]:e(t)},[d]),Ue=we(()=>{const e="function"==typeof m?m:e=>e[m];return t=>null!=t&&"object"==typeof t&&Fe in t?t[Fe]:e(t)},[m]),Ze=we(()=>{const e=xe.filter(e=>e&&"object"==typeof e).map(e=>e[p]??0).filter(e=>isFinite(e));return 0===e.length?()=>B[0]:Ce().domain(G(e)).range(B)},[xe,p,B]),$e=we(()=>e=>({stroke:z?Z(e,z,ve.colorScale):U,strokeWidth:Ze(e[p]??0),strokeLinecap:$,opacity:W}),[z,ve.colorScale,Ze,p,W,$]),Ve=we(()=>{const e=u($e,{stroke:de,strokeWidth:me,opacity:he});if(!ve.effectiveSelectionHook)return e;const t={...ve.resolvedSelection?.unselectedStyle||{},fillOpacity:0};return E(e,ve.effectiveSelectionHook,{...ve.resolvedSelection||{},unselectedStyle:t})},[$e,ve.effectiveSelectionHook,ve.resolvedSelection,de,me,he]),_e=D??("sparkline"===o.mode?1.5:5),Ke=we(()=>u(()=>({fill:"#333",r:_e,fillOpacity:.8}),{stroke:de,strokeWidth:me,opacity:he}),[_e,de,me,he]),qe=we(()=>e=>{if(e?.geometry||e?.properties||e?.data?.geometry){const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||e?.data?.properties?.name||e?.data?.properties?.NAME;if(t)return Re("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:Re("div",{style:{fontWeight:600},children:t})})}if(null!=e?.source&&null!=e?.target){const t=e[p];return Ne("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[Ne("div",{style:{fontWeight:600},children:[e.source," → ",e.target]}),null!=t&&Re("div",{style:{opacity:.7},children:"number"==typeof t?t.toLocaleString():t})]})}const t=e?.name||e?.label||e?.[s];return null!=t?Re("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:Re("div",{style:{fontWeight:600},children:t})}):null},[p,s]);if(ve.earlyReturn)return ve.earlyReturn;const Qe={projection:g,...null!=i&&{lines:Te},points:be,xAccessor:Ge,yAccessor:Ue,lineDataAccessor:"coordinates",...null!=pe&&{lineIdAccessor:pe},lineType:F,flowStyle:P,lineStyle:Ve,pointStyle:Ke,...ye&&{areas:ye,areaStyle:I},...null!=y&&{graticule:y},...null!=b&&{fitPadding:b},...fe&&{zoomable:!0},...k&&{zoomExtent:k},...w&&{onZoom:w},...null!=S&&{dragRotate:S},..._&&{showParticles:_},...K&&{particleStyle:K},...C&&{tileURL:C},...R&&{tileAttribution:R},...j&&{tileCacheSize:j},size:[o.width,o.height],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:ve.margin,enableHover:o.enableHover,tooltipContent:!1===q?()=>null:A(q)||qe,...ve.legendBehaviorProps,...c({linkedHover:ee,selection:Y,onObservation:te,onClick:oe,mobileInteraction:ve.mobileInteraction,customHoverBehavior:De,customClickBehavior:Ee,linkedHoverInClickPredicate:!1}),...Q&&Q.length>0&&{annotations:Q},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...o.title&&{title:o.title},...o.description&&{description:o.description},...o.summary&&{summary:o.summary},...void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable},...X&&{className:X},...null!=e.animate&&{animate:e.animate},...le};return Re(f,{componentName:"FlowMap",width:o.width,height:o.height,children:Re(r,{ref:Ie,...Qe})})});Pe.displayName="FlowMap";import{useMemo as He,useRef as Ie,useState as Le,useEffect as ze,useCallback as We,forwardRef as Oe}from"react";import{jsx as Be,jsxs as De}from"react/jsx-runtime";function Ee({bottomMargin:e,costLabel:t,layout:{cx:o,cy:i,maxCost:n,availableRadius:r,layout:a},ringStyle:l,ringValues:s,showNorth:c,showRingLabels:u,showRings:d}){const m="strip"===a,h={stroke:m?"var(--semiotic-border, #999)":"#999",strokeWidth:m?1:.8,strokeDasharray:m?"none":"4,3",labelColor:"var(--semiotic-text-secondary, #777)",labelSize:m?8:10,...l};return De("g",m?{children:[Be("line",{x1:o,y1:i,x2:o+r,y2:i,stroke:h.stroke,strokeWidth:h.strokeWidth,strokeLinecap:"round",opacity:.85}),Be("line",{x1:o,y1:i-3.5,x2:o,y2:i+3.5,stroke:h.stroke,strokeWidth:h.strokeWidth,opacity:.9}),d&&s.map(a=>{const l=o+(n>0?a/n*r:0);return De("g",{children:[Be("line",{x1:l,y1:i-2.5,x2:l,y2:i+2.5,stroke:h.stroke,strokeWidth:.9,opacity:.65}),u&&De("text",{x:l,y:i+Math.min(10,(e??2)+8),textAnchor:"middle",fontSize:h.labelSize,fill:h.labelColor,fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",children:[a,t?" "+t:""]})]},a)})]}:{children:[s.map(e=>{const a=e/n*r;return De("g",{children:[Be("circle",{cx:o,cy:i,r:a,fill:"none",stroke:h.stroke,strokeWidth:h.strokeWidth,strokeDasharray:h.strokeDasharray,opacity:.5}),u&&De("text",{x:o+a+3,y:i-2,fontSize:h.labelSize,fill:h.labelColor,fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",children:[e,t?" "+t:""]})]},e)}),c&&De("g",{transform:"translate(24, 24)",children:[Be("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),Be("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),Be("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",children:"N"}),Be("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),Be("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),Be("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]})]})}import{Fragment as Te,jsx as Ge,jsxs as Ue}from"react/jsx-runtime";var Ze=Oe(function(e,t){const o=L(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:i,lines:n,xAccessor:s="lon",yAccessor:d="lat",nodeIdAccessor:m="id",center:h,costAccessor:p,strength:g=1,lineMode:y="straight",projection:k="mercator",graticule:w,fitPadding:S,zoomable:M,zoomExtent:C,onZoom:R,dragRotate:j,tileURL:F,tileAttribution:P,tileCacheSize:H,transition:I,colorBy:z,styleRules:W,colorScheme:O,pointRadius:B,tooltip:T,showRings:G,showRingLabels:$,ringStyle:V,showNorth:_,costLabel:K,cartogramLayout:q,annotations:Q,margin:J,className:X,selection:Y,linkedHover:ee,onObservation:te,onClick:oe,chartId:ie,loading:ne,loadingContent:re,emptyContent:ae,legendPosition:le,frameProps:se={},stroke:ce,strokeWidth:ue,opacity:de}=e,me="sparkline"===o.mode,he=q??(me?"strip":"radial"),pe=B??(me?1.5:5),fe=G??!0,ge=$??("strip"!==he&&!o.compactMode),ye=_??("strip"!==he&&!me),be=M??!!F,ve=He(()=>v(i),[i]),xe=a({data:ve,rawData:i,colorBy:z,colorScheme:O,legendInteraction:void 0,legendPosition:le,frameLegend:se,selection:Y,linkedHover:ee,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!1,onObservation:te,onClick:oe,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DistanceCartogram",chartId:ie,showLegend:o.showLegend,userMargin:J,marginDefaults:N(o),loading:ne,loadingContent:re,emptyContent:ae,width:o.width,height:o.height,hasTitle:!!o.title}),ke=He(()=>{const e=b(e=>{const t=e?.[m],o=null!=t&&t+""==h+"";return{fill:z?Z(e,z,xe.colorScale):U,fillOpacity:o?1:.8,stroke:o?"var(--semiotic-text, #222)":"#fff",strokeWidth:o?1.25:1,r:o?1.35*pe:pe}},W,x(z)),t=u(e,{stroke:ce,strokeWidth:ue,opacity:de});return xe.effectiveSelectionHook?E(t,xe.effectiveSelectionHook,xe.resolvedSelection):t},[z,xe.colorScale,xe.effectiveSelectionHook,xe.resolvedSelection,pe,ce,ue,de,W,h,m]),we=He(()=>({center:h,centerAccessor:m,costAccessor:p,strength:g,lineMode:y,layout:he}),[h,m,p,g,y,he]),Se=He(()=>{if(!n)return;const e="function"==typeof s?s:e=>e[s],t="function"==typeof d?d:e=>e[d],o=new Map;for(const e of ve)o.set(e[m]+"",e);return n.map(i=>{if(i.coordinates)return i;const n=o.get(i.source+""),r=o.get(i.target+"");return n&&r?{...i,coordinates:[{[s]:e(n),[d]:t(n)},{[s]:e(r),[d]:t(r)}]}:null}).filter(Boolean)},[n,ve,s,d,m]),Me=He(()=>e=>{const t=("function"==typeof p?p:e=>e[p])(e);return Ue("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[Ge("div",{style:{fontWeight:600},children:e[m]||e.name||e.id||"Point"}),null!=t&&Ue("div",{style:{opacity:.7},children:["Cost: ","number"==typeof t?t.toFixed(1):t]})]})},[p,m]),Ae=Ie(null);l(t,{variant:"geo-points",frameRef:Ae});const[Ce,Re]=Le(null),Ne=We(()=>{const e=Ae.current?.getCartogramLayout?.();e&&Re(t=>t&&t.cx===e.cx&&t.cy===e.cy&&t.maxCost===e.maxCost&&t.availableRadius===e.availableRadius&&t.layout===(e.layout??"radial")?t:{cx:e.cx,cy:e.cy,maxCost:e.maxCost,availableRadius:e.availableRadius,layout:e.layout??"radial"})},[]);ze(()=>{const e=requestAnimationFrame(Ne);return()=>cancelAnimationFrame(e)},[Ne,g,h,o.width,o.height,ve,he]);const je=He(()=>{if(!fe||!Ce)return[];const{maxCost:e}=Ce;if(0>=e)return[];if(Array.isArray(fe))return fe.filter(t=>t>0&&e>=t);const t="number"==typeof fe?fe:Math.min("strip"===Ce.layout?3:5,Math.max(2,Math.ceil(e/5))),o=e/t,i=[];for(let e=1;t>=e;e++)i.push(Math.round(o*e*10)/10);return i},[fe,Ce]),Fe=He(()=>{if(!Ce)return se.foregroundGraphics||null;const e=Ge(Ee,{bottomMargin:xe.margin.bottom,costLabel:K,layout:Ce,ringStyle:V,ringValues:je,showNorth:ye,showRingLabels:ge,showRings:fe}),t=se.foregroundGraphics;return"function"==typeof t?o=>Ue(Te,{children:[e,t(o)]}):Ue(Te,{children:[e,t]})},[Ce,je,fe,ge,ye,K,V,xe.margin.bottom,se.foregroundGraphics]);if(xe.earlyReturn)return xe.earlyReturn;D("DistanceCartogram",ve,"xAccessor",s),D("DistanceCartogram",ve,"yAccessor",d);const Pe={projection:k,...null!=i&&{points:ve},...Se&&{lines:Se,lineDataAccessor:"coordinates"},xAccessor:s,yAccessor:d,pointIdAccessor:m,pointStyle:ke,projectionTransform:we,...I&&{transition:{duration:I}},...null!=w&&{graticule:w},...null!=S&&{fitPadding:S},...be&&{zoomable:!0},...C&&{zoomExtent:C},...R&&{onZoom:R},...null!=j&&{dragRotate:j},...F&&{tileURL:F},...P&&{tileAttribution:P},...H&&{tileCacheSize:H},size:[o.width,o.height],maxDevicePixelRatio:e.maxDevicePixelRatio,margin:xe.margin,enableHover:o.enableHover,tooltipContent:!1===T?()=>null:A(T)||Me,...xe.legendBehaviorProps,...c({linkedHover:ee,selection:Y,onObservation:te,onClick:oe,mobileInteraction:xe.mobileInteraction,customHoverBehavior:xe.customHoverBehavior,customClickBehavior:xe.customClickBehavior,linkedHoverInClickPredicate:!1}),...Q&&Q.length>0&&{annotations:Q},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...o.title&&{title:o.title},...o.description&&{description:o.description},...o.summary&&{summary:o.summary},...void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable},...X&&{className:X},...null!=e.animate&&{animate:e.animate},...se,foregroundGraphics:Fe};return Ge(f,{componentName:"DistanceCartogram",width:o.width,height:o.height,children:Ge(r,{ref:Ae,...Pe})})});Ze.displayName="DistanceCartogram";import{jsx as $e}from"react/jsx-runtime";function Ve(e){if(Number.isFinite(e))return Math.max(1,Math.round(e))}function _e(e,t,o){return Math.max(t,Math.min(o,e))}function Ke(e){let t=1/0,o=-1/0;for(const i of e)Number.isFinite(i)&&(t>i&&(t=i),i>o&&(o=i));return t===1/0?[0,0]:[t,o]}function qe(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function Qe(e,t={}){const o=e.map((e,t)=>({...e,index:t})).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y));if(0===o.length)return[];const i=_e(Number.isFinite(t.occupancy)?Number(t.occupancy):.72,.2,1),n=Number.isFinite(t.aspectRatio)&&Number(t.aspectRatio)>0?Number(t.aspectRatio):1.8;let r=Ve(t.columns)??Math.max(1,Math.ceil(Math.sqrt(o.length*n/i))),a=Ve(t.rows)??Math.max(1,Math.ceil(o.length/(r*i)));o.length>r*a&&(null!=t.columns&&null==t.rows?a=Math.ceil(o.length/r):null!=t.rows&&null==t.columns?r=Math.ceil(o.length/a):a=Math.ceil(o.length/r));const l=Ke(o.map(e=>e.x)),s=Ke(o.map(e=>e.y)),c=o.map(e=>({...e,desiredColumn:qe(e.x,l)*Math.max(0,r-1),desiredRow:qe(e.y,s)*Math.max(0,a-1)})),u=(r-1)/2,d=(a-1)/2;c.sort((e,t)=>(t.desiredColumn-u)**2+(t.desiredRow-d)**2-((e.desiredColumn-u)**2+(e.desiredRow-d)**2)||e.desiredRow-t.desiredRow||e.desiredColumn-t.desiredColumn||e.index-t.index);const m=new Set;for(let e=0;a>e;e+=1)for(let t=0;r>t;t+=1)m.add(e*r+t);const h=[];for(const e of c){let t=-1,o=1/0;for(const i of m){const n=(i%r-e.desiredColumn)**2+(Math.floor(i/r)-e.desiredRow)**2;(o>n||n===o&&t>i)&&(t=i,o=n)}0>t||(m.delete(t),h.push({datum:e.datum,x:e.x,y:e.y,row:Math.floor(t/r),column:t%r,index:e.index}))}return h.sort((e,t)=>e.index-t.index),h.map(({index:e,...t})=>t)}function Je(e,t,o=[]){if("function"==typeof t)return t(e);if("string"==typeof t)return e[t];for(const t of o)if(null!=e[t])return e[t]}function Xe(e){return e.map(([e,t],o)=>`${0===o?"M":"L"}${e},${t}`).join("")+"Z"}var Ye=e=>{const t=e.config,o=t.source??"auto",i="areas"===o||"auto"===o&&e.areas.length>0,n=i?function(e){return e.areas.map((t,o)=>{const i=function(e,t){const o=e.properties&&"object"==typeof e.properties?e.properties:{},i=e.id??o.id??o.name??"area-"+t;return{...o,id:i+""}}(t,o),n=e.scales.geoPath.centroid(t),r=Number.isFinite(n[0])&&Number.isFinite(n[1])?e.scales.invertedPoint(n[0],n[1]):null;return{datum:{...i,gridLongitude:r?.[0],gridLatitude:r?.[1]},x:n[0],y:n[1]}}).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))}(e):e.points.map((e,t)=>({datum:e,x:t,y:t})),r=n.filter((e,o)=>!t.filter||t.filter(e.datum,o)),a=function(e,t){if(!t.rowAccessor||!t.columnAccessor)return null;const o=e.map(e=>({datum:e,x:Number(Je(e,t.columnAccessor)),y:Number(Je(e,t.rowAccessor))})).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y));return o.length!==e.length?null:o.map(e=>({...e,row:e.y,column:e.x}))}(r.map(e=>e.datum),t),l=i?r:function(e){return e.points.map(t=>{const o=Number(Je(t,e.config.longitudeAccessor,["lon","longitude"])),i=Number(Je(t,e.config.latitudeAccessor,["lat","latitude"])),n=Number.isFinite(o)&&Number.isFinite(i)?e.scales.projectedPoint(o,i):null;return{datum:t,x:n?.[0]??NaN,y:n?.[1]??NaN}}).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))}({...e,points:r.map(e=>e.datum)}),s=a??Qe(l,{columns:t.columns,rows:t.rows,occupancy:t.occupancy,aspectRatio:e.dimensions.width/Math.max(1,e.dimensions.height)});if(0===s.length)return{nodes:[]};const c=Ke(s.map(e=>e.row)),u=Ke(s.map(e=>e.column)),d=Math.max(1,Math.round(c[1]-c[0])+1),m=Math.max(1,Math.round(u[1]-u[0])+1),h=Math.max(0,t.layoutPadding??8),p=Math.max(1,e.dimensions.width-2*h)/m,f=Math.max(1,e.dimensions.height-2*h)/d,g=(e.dimensions.width-p*m)/2,y=(e.dimensions.height-f*d)/2,b=_e(t.cellPadding??.12,0,.8),v=Math.max(1,.5*Math.min(p,f)*(1-b)),x=t.sizeAccessor?s.map(e=>Number(Je(e.datum,t.sizeAccessor))):[],k=t.sizeDomain??Ke(x),w=t.sizeRange??[.36,1],S=_e(Math.min(w[0],w[1]),.05,1),M=_e(Math.max(w[0],w[1]),S,1),A=s.map((o,i)=>{const n={...o.datum,gridRow:o.row,gridColumn:o.column},r=(Je(n,t.idAccessor,["id","key","name"])??"grid-"+i)+"",a=(Je(n,t.labelAccessor,["abbr","code","label","name","id"])??r)+"",l=Math.max(1,t.maxLabelLength??4),s=a.length>l?a.slice(0,l):a,d=Je(n,t.categoryAccessor),m=null==d?void 0:d+"",h=Je(n,t.fillAccessor),b=null!=h?h+"":m?e.resolveColor(m):e.theme.categorical[0]??"#4f86c6",x=t.sizeAccessor?Number(Je(n,t.sizeAccessor)):NaN,w=t.sizeAccessor&&Number.isFinite(x)?Math.sqrt(_e(qe(x,k),0,1)):1,A=v*(S+w*(M-S)),C="function"==typeof t.markStyle?t.markStyle(n,i):t.markStyle;return{datum:n,id:r,label:s,category:m,row:o.row,column:o.column,x:g+(o.column-u[0]+.5)*p,y:y+(o.row-c[0]+.5)*f,radius:A,style:{fill:b,fillOpacity:.94,stroke:"rgba(255,255,255,0.9)",strokeWidth:1,...C}}}),C=t.shape??"circle";return{nodes:A.map(e=>{return"circle"===C?{type:"point",x:e.x,y:e.y,r:e.radius,style:e.style,datum:e.datum,accessibleDatum:e.datum,accessibility:{label:e.label,tableFields:{name:e.datum.name??e.label,label:e.label,row:e.row,column:e.column,...e.category?{category:e.category}:{}}},pointId:e.id,_transitionKey:e.id}:{type:"geoarea",pathData:"hexagon"===C?function(e,t,o){const i=[];for(let n=0;6>n;n+=1){const r=-Math.PI/2+n*(Math.PI/3);i.push([e+Math.cos(r)*o,t+Math.sin(r)*o])}return Xe(i)}(e.x,e.y,e.radius):Xe([[(t=e.x)-(i=e.radius),(o=e.y)-i],[t+i,o-i],[t+i,o+i],[t-i,o+i]]),centroid:[e.x,e.y],bounds:[[e.x-e.radius,e.y-e.radius],[e.x+e.radius,e.y+e.radius]],screenArea:"hexagon"===C?3*Math.sqrt(3)*e.radius*e.radius/2:(2*e.radius)**2,style:e.style,datum:e.datum,accessibleDatum:e.datum,accessibility:{label:e.label,tableFields:{name:e.datum.name??e.label,label:e.label,row:e.row,column:e.column,...e.category?{category:e.category}:{}}},group:e.category,interactive:!0};var t,o,i}),overlays:!1===t.showLabels?null:$e(et,{marks:A,color:t.labelColor??"#ffffff",fontSize:t.labelFontSize??_e(.23*Math.min(p,f),7,14),fontFamily:t.labelFontFamily,fontWeight:t.labelFontWeight??700}),restyle:(e,t)=>t?.isActive&&e.datum?{opacity:t.predicate(e.datum)?1:.18}:{opacity:1}}};function et({marks:e,color:t,fontSize:o,fontFamily:i,fontWeight:n}){const r=d();return $e("g",{"aria-hidden":"true",pointerEvents:"none",children:e.map(e=>{const a=!r.isActive||r.predicate(e.datum);return $e("text",{x:e.x,y:e.y,fill:t,fontFamily:i,fontSize:o,fontWeight:n,opacity:a?1:.18,textAnchor:"middle",dominantBaseline:"central",children:e.label},e.id)})})}import{geoBounds as tt,geoContains as ot}from"d3-geo";import{jsx as it}from"react/jsx-runtime";var nt=new WeakMap,rt=new WeakMap,at=new WeakMap,lt=1;function st(e,t,o){return Math.max(t,Math.min(o,e))}function ct(e){if(Number.isFinite(e)&&Number(e)>0)return Number(e)}function ut(e,t){return"function"==typeof t?t(e,e.dotIndex):"string"==typeof t?e[t]:void 0}function dt(e){return e.properties&&"object"==typeof e.properties?{...e.properties}:{}}function mt(e,t){const o=dt(e);return(e.id??o.id??o.name??"feature-"+t)+""}function ht(e,t,o,i){return[Math.ceil((e-o)/i-.5),Math.floor((t-o)/i-.5)]}function pt(e){if(!e)return 0;const t=at.get(e);if(t)return t;const o=lt;return lt+=1,at.set(e,o),o}function ft(e,t){return!t||!(t[0][1]>e[1]||e[1]>t[1][1]||(o=e[0],i=t[0][0],n=t[1][0],i>n?i>o&&o>n:i>o||o>n));var o,i,n}function gt(e,t){for(const o of e){const{feature:e,index:i}=o;if(e.geometry&&ft(t,o.bounds))try{if(ot(e,t))return{feature:e,index:i}}catch{}}return null}function yt(e,t,o,i={}){const n=e.filter((e,t)=>e.geometry&&(!i.featureFilter||i.featureFilter(e,t))),r=function(e,t){if(0===e.length)return null;const o=t.bounds({type:"FeatureCollection",features:e});return Number.isFinite(o[0][0])&&Number.isFinite(o[0][1])&&Number.isFinite(o[1][0])&&Number.isFinite(o[1][1])?o:null}(n,t.geoPath);if(!r)return{dots:[],cellSize:10,features:n};const a=Math.max(0,i.layoutPadding??0),l=[[st(r[0][0],a,Math.max(a,o.width-a)),st(r[0][1],a,Math.max(a,o.height-a))],[st(r[1][0],a,Math.max(a,o.width-a)),st(r[1][1],a,Math.max(a,o.height-a))]],s=Math.max(0,l[1][0]-l[0][0]),c=Math.max(0,l[1][1]-l[0][1]);if(0===s||0===c)return{dots:[],cellSize:10,features:n};const u=ct(i.columns);let d=Math.max(2,u?s/u:ct(i.cellSize)??10);const m=Math.max(100,Math.round(ct(i.maxSamples)??25e3)),h=Math.ceil(s/d)*Math.ceil(c/d);h>m&&(d*=Math.sqrt(h/m));const p=i.gridOrigin?.[0]??0,f=i.gridOrigin?.[1]??0,[g,y]=ht(l[0][0],l[1][0],p,d),[b,v]=ht(l[0][1],l[1][1],f,d),x=[],k=function(e){return e.map((e,t)=>{if(rt.has(e))return{feature:e,index:t,bounds:rt.get(e)??null};try{const o=tt(e);return rt.set(e,o),{feature:e,index:t,bounds:o}}catch{return rt.set(e,null),{feature:e,index:t,bounds:null}}})}(n);for(let e=b;v>=e;e+=1){const o=f+(e+.5)*d;for(let n=g;y>=n;n+=1){const r=t.invertedPoint(p+(n+.5)*d,o);if(!r||!Number.isFinite(r[0])||!Number.isFinite(r[1]))continue;const a=gt(k,r);if(!a)continue;const l={...dt(a.feature),featureId:mt(a.feature,a.index),featureIndex:a.index,gridRow:e,gridColumn:n,longitude:r[0],latitude:r[1],dotIndex:x.length};i.dotFilter&&!i.dotFilter(l,x.length)||x.push(l)}}return{dots:x,cellSize:d,features:n}}function bt(e){return Math.round(1e4*e)/1e4}function vt(e){return Array.isArray(e)&&e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1])?`${bt(Number(e[0]))},${bt(Number(e[1]))}`:"null"}function xt(e,t){const o=e[t];return"function"==typeof o?o.call(e):void 0}function kt(e){return"number"==typeof e&&Number.isFinite(e)?bt(e)+"":null===e?"null":"unavailable"}function wt(e){const t=e.scales.projection;return[kt(xt(t,"scale")),vt(xt(t,"translate")),vt(xt(t,"center")),(o=xt(t,"rotate"),Array.isArray(o)&&o.every(Number.isFinite)?o.map(e=>bt(Number(e))).join(","):"unavailable"),kt(xt(t,"clipAngle")),kt(xt(t,"precision")),...[[0,0],[-120,35],[45,45],[120,-30]].map(([t,o])=>vt(e.scales.projectedPoint(t,o)))].join("|");var o}function St(e){return e.map(([e,t],o)=>`${0===o?"M":"L"}${e},${t}`).join("")+"Z"}var Mt=e=>{const t=function(e){let t=nt.get(e.areas);t||(t=new Map,nt.set(e.areas,t));const o=function(e){const t=e.config;return[e.areas.length,e.dimensions.width,e.dimensions.height,t.cellSize??"",t.columns??"",t.layoutPadding??"",t.gridOrigin?.join(",")??"",t.maxSamples??"",pt(t.featureFilter),pt(t.dotFilter),wt(e)].join("::")}(e),i=t.get(o);if(i)return i;const n=yt(e.areas,e.scales,e.dimensions,e.config);if(t.size>=12){const e=t.keys().next().value;void 0!==e&&t.delete(e)}return t.set(o,n),n}(e),o=e.config,i=o.shape??"circle",n=Math.max(.5,ct(o.dotRadius)??t.cellSize*st(o.radiusRatio??.24,.05,.5)),r=o.gridOrigin?.[0]??0,a=o.gridOrigin?.[1]??0;return{nodes:t.dots.map((l,s)=>{const c=r+(l.gridColumn+.5)*t.cellSize,u=a+(l.gridRow+.5)*t.cellSize,d=ut(l,o.categoryAccessor),m=ut(l,o.fillAccessor),h={fill:null!=m?m+"":null!=d?e.resolveColor(d+""):e.theme.categorical[0]??"#4f86c6",fillOpacity:.92,strokeWidth:0,..."function"==typeof o.markStyle?o.markStyle(l,s):o.markStyle},p=`dot-${l.gridRow}-${l.gridColumn}`;if("circle"===i)return{type:"point",x:c,y:u,r:n,style:h,datum:l,interactive:!1,pointId:p,_transitionKey:p};const f="hexagon"===i?function(e,t,o){return St(Array.from({length:6},(i,n)=>{const r=-Math.PI/2+n*(Math.PI/3);return[e+Math.cos(r)*o,t+Math.sin(r)*o]}))}(c,u,n):function(e,t,o){return St([[e-o,t-o],[e+o,t-o],[e+o,t+o],[e-o,t+o]])}(c,u,n);return{type:"geoarea",pathData:f,centroid:[c,u],bounds:[[c-n,u-n],[c+n,u+n]],screenArea:"hexagon"===i?3*Math.sqrt(3)*n*n/2:(2*n)**2,style:h,datum:l,group:l.featureId,interactive:!1}}),overlays:o.showOutline?it("g",{"aria-hidden":"true",pointerEvents:"none",children:t.features.map((t,i)=>{const n=e.scales.geoPath(t);return n?it("path",{d:n,fill:"none",stroke:o.outlineStyle?.stroke??"currentColor",strokeOpacity:o.outlineStyle?.opacity??o.outlineStyle?.fillOpacity??.22,strokeWidth:o.outlineStyle?.strokeWidth??.7,strokeDasharray:o.outlineStyle?.strokeDasharray,strokeLinecap:o.outlineStyle?.strokeLinecap,vectorEffect:"non-scaling-stroke"},mt(t,i)):null})}):null,restyle:(e,t)=>t?.isActive&&e.datum?{opacity:t.predicate(e.datum)?1:.14}:{opacity:1}}};function At(e,t,o){const{featureKey:i,dataKey:n}=o,r=new Map;for(const e of t){const t=(Object.prototype.hasOwnProperty.call(e,n)?e[n]:void 0)+"";r.set(t,e)}return e.map(e=>{const t=(e=>{const t=i.split(".");let o=e;for(const e of t)o=null!==o&&"object"==typeof o&&Object.prototype.hasOwnProperty.call(o,e)?o[e]:void 0;return(o??"")+""})(e),o=r.get(t);return o?{...e,properties:{...e.properties,...o}}:e})}export{me as ChoroplethMap,e as DEFAULT_HIT_RADIUS,Ze as DistanceCartogram,Pe as FlowMap,n as GeoCustomChart,p as MultiLineTooltip,ke as ProportionalSymbolMap,r as StreamGeoFrame,g as Tooltip,y as TooltipRoot,b as composeStyleRules,t as geoAreaHitTarget,o as geoHitTarget,Mt as geographicDotGridLayout,Ye as geographicGridLayout,_ as glyphExtent,K as glyphPlacement,Qe as gridifyGeographicPoints,q as hatchFillId,Q as hatchPatternDef,i as hitTargetPoint,J as isHatchFill,x as makeNodeRuleContext,k as makeRuleValueResolver,w as markTooltipChrome,S as matchesThreshold,At as mergeData,le as resolveReferenceGeography,j as resolveResponsiveRules,F as resolveStyleRules,X as resolveSvgFill,P as responsiveRuleMatches,H as ruleMatches,yt as sampleGeographicDotGrid};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{useForceLayout as m}from"./c-IDUHYYSI.min.js";import{ChordDiagram as i,CirclePack as r,ForceDirectedGraph as o,NetworkCustomChart as t,OrbitDiagram as p,ProcessSankey as s,SankeyDiagram as c,TreeDiagram as j,Treemap as n,diagnoseProcessSankeyLayout as G,diagnoseProcessSankeyProps as I,explainProcessSankeyLayout as N,formatProcessSankeyIssue as Y,inventoryAtTime as f,toProcessSankeyTime as Q,validateProcessSankey as S}from"./c-QHF5YON3.min.js";import"./c-RSVIHIQ4.min.js";import{StreamNetworkFrame_default as D}from"./c-OXYMVK7Q.min.js";import"./c-RR3GO5SW.min.js";import"./c-N4G2L7ID.min.js";import"./c-VGW3VG3I.min.js";import{DEFAULT_HIT_RADIUS as F,networkEdgeHitTarget as J,networkHitTarget as O}from"./c-3BLJEQNG.min.js";import"./c-3KZD6AXJ.min.js";import"./c-OCI56QF2.min.js";import"./c-GPYOFETM.min.js";import{useCustomLayoutSelection as R}from"./c-G36WS6LN.min.js";import{composeStyleRules as W,makeNodeRuleContext as e,makeRuleValueResolver as H,matchesThreshold as V,resolveStyleRules as X,ruleMatches as a}from"./c-S2BXNNJN.min.js";import"./c-J5G56TUH.min.js";import{MultiLineTooltip as E,Tooltip as K,TooltipRoot as L,glyphExtent as U,glyphPlacement as A,hatchFillId as B,hatchPatternDef as C,isHatchFill as M,markTooltipChrome as T,resolveResponsiveRules as k,resolveSvgFill as w,responsiveRuleMatches as x}from"./c-GIKRQI4X.min.js";import"./c-YDAY2WFR.min.js";import"./c-WJCD5EUY.min.js";export{i as ChordDiagram,r as CirclePack,F as DEFAULT_HIT_RADIUS,o as ForceDirectedGraph,E as MultiLineTooltip,t as NetworkCustomChart,p as OrbitDiagram,s as ProcessSankey,c as SankeyDiagram,D as StreamNetworkFrame,K as Tooltip,L as TooltipRoot,j as TreeDiagram,n as Treemap,W as composeStyleRules,G as diagnoseProcessSankeyLayout,I as diagnoseProcessSankeyProps,N as explainProcessSankeyLayout,Y as formatProcessSankeyIssue,U as glyphExtent,A as glyphPlacement,B as hatchFillId,C as hatchPatternDef,f as inventoryAtTime,M as isHatchFill,e as makeNodeRuleContext,H as makeRuleValueResolver,T as markTooltipChrome,V as matchesThreshold,J as networkEdgeHitTarget,O as networkHitTarget,k as resolveResponsiveRules,X as resolveStyleRules,w as resolveSvgFill,x as responsiveRuleMatches,a as ruleMatches,Q as toProcessSankeyTime,R as useCustomLayoutSelection,m as useForceLayout,S as validateProcessSankey};
2
+ import{useForceLayout as m}from"./c-OFWJBEE5.min.js";import"./c-KM3N7F7R.min.js";import{DEFAULT_HIT_RADIUS as i,networkEdgeHitTarget as r,networkHitTarget as o}from"./c-3BLJEQNG.min.js";import{ChordDiagram as t,CirclePack as c,ForceDirectedGraph as n,NetworkCustomChart as p,OrbitDiagram as s,ProcessSankey as j,SankeyDiagram as G,TreeDiagram as e,Treemap as B,chordLayoutPlugin as V,diagnoseProcessSankeyLayout as W,diagnoseProcessSankeyProps as Q,explainProcessSankeyLayout as S,forceLayoutPlugin as f,formatProcessSankeyIssue as E,hierarchyLayoutPlugin as I,inventoryAtTime as C,orbitLayoutPlugin as H,sankeyLayoutPlugin as M,toProcessSankeyTime as N,validateProcessSankey as R}from"./c-H3DNMTCC.min.js";import"./c-4DTZPSUD.min.js";import"./c-U6ESPM7V.min.js";import"./c-RSVIHIQ4.min.js";import"./c-F5ZB5GJ6.min.js";import{StreamNetworkFrame_default as a,registerLayoutPlugin as F}from"./c-ALYR5LKK.min.js";import"./c-6HRB2L7H.min.js";import"./c-OCI56QF2.min.js";import"./c-5JWCTX3G.min.js";import"./c-54IRWOGM.min.js";import"./c-GSVCN34B.min.js";import"./c-AG7WWVIH.min.js";import{useCustomLayoutSelection as D}from"./c-G36WS6LN.min.js";import"./c-MT3WBK7M.min.js";import"./c-UC5PTTFI.min.js";import"./c-N4G2L7ID.min.js";import"./c-VGW3VG3I.min.js";import"./c-DBQ2V7CH.min.js";import"./c-QSGWX53A.min.js";import"./c-VPZDY5Q4.min.js";import{MultiLineTooltip as K,Tooltip as L,TooltipRoot as T,composeStyleRules as P,makeNodeRuleContext as J,makeRuleValueResolver as O,markTooltipChrome as U,matchesThreshold as k,resolveResponsiveRules as A,resolveStyleRules as X,responsiveRuleMatches as Y,ruleMatches as Z,useSelectionActions as l}from"./c-VN2HG5BS.min.js";import"./c-GR6MOEQC.min.js";import"./c-VRXUB2F2.min.js";import"./c-GGISSW5E.min.js";import"./c-EGR6VYBW.min.js";import"./c-PGKQGGQ2.min.js";import{glyphExtent as u,glyphPlacement as b,hatchFillId as d,hatchPatternDef as h,isHatchFill as w,resolveSvgFill as x}from"./c-QKHMBE2E.min.js";function y(){F("sankey",M),F("force",f),F("chord",V),F("tree",I),F("cluster",I),F("treemap",I),F("circlepack",I),F("partition",I),F("orbit",H)}export{t as ChordDiagram,c as CirclePack,i as DEFAULT_HIT_RADIUS,n as ForceDirectedGraph,K as MultiLineTooltip,p as NetworkCustomChart,s as OrbitDiagram,j as ProcessSankey,G as SankeyDiagram,a as StreamNetworkFrame,L as Tooltip,T as TooltipRoot,e as TreeDiagram,B as Treemap,P as composeStyleRules,W as diagnoseProcessSankeyLayout,Q as diagnoseProcessSankeyProps,S as explainProcessSankeyLayout,E as formatProcessSankeyIssue,u as glyphExtent,b as glyphPlacement,d as hatchFillId,h as hatchPatternDef,C as inventoryAtTime,w as isHatchFill,J as makeNodeRuleContext,O as makeRuleValueResolver,U as markTooltipChrome,k as matchesThreshold,r as networkEdgeHitTarget,o as networkHitTarget,y as registerBuiltInNetworkLayouts,A as resolveResponsiveRules,X as resolveStyleRules,x as resolveSvgFill,Y as responsiveRuleMatches,Z as ruleMatches,N as toProcessSankeyTime,D as useCustomLayoutSelection,m as useForceLayout,l as useSelectionActions,R as validateProcessSankey};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{BarChart as m,BoxPlot as i,DonutChart as r,DotPlot as o,FunnelChart as t,GaugeChart as n,GroupedBarChart as p,Histogram as s,LikertChart as c,OrdinalCustomChart as j,PieChart as G,RidgelinePlot as I,StackedBarChart as N,StreamOrdinalFrame_default as R,SwarmPlot as S,SwimlaneChart as Y,ViolinPlot as f}from"./c-5YCIX3VZ.min.js";import"./c-SLGMUBUL.min.js";import"./c-RSVIHIQ4.min.js";import"./c-M4Y3BHFR.min.js";import"./c-C25ENHIK.min.js";import"./c-RR3GO5SW.min.js";import{DEFAULT_HIT_RADIUS as E,hitTargetPoint as J,hitTargetRect as M}from"./c-3BLJEQNG.min.js";import"./c-3KZD6AXJ.min.js";import"./c-MG5DM6VE.min.js";import"./c-GPYOFETM.min.js";import{useCustomLayoutSelection as a}from"./c-G36WS6LN.min.js";import{composeStyleRules as B,makeNodeRuleContext as D,makeRuleValueResolver as F,makeStyleRuleStyleFn as H,makeXYRuleContext as L,matchesThreshold as U,resolveStyleRules as W,ruleMatches as X}from"./c-S2BXNNJN.min.js";import"./c-J5G56TUH.min.js";import{AnnotationLabel as e,MultiLineTooltip as C,Tooltip as K,TooltipRoot as O,createHatchPattern as Q,estimateLabelWidth as V,glyphExtent as A,glyphPlacement as T,hatchFillId as Z,hatchPatternDef as d,isHatchFill as l,markTooltipChrome as x,resolveResponsiveRules as P,resolveSvgFill as b,responsiveRuleMatches as g}from"./c-GIKRQI4X.min.js";import"./c-YDAY2WFR.min.js";import"./c-WJCD5EUY.min.js";export{e as AnnotationLabel,m as BarChart,i as BoxPlot,E as DEFAULT_HIT_RADIUS,r as DonutChart,o as DotPlot,t as FunnelChart,n as GaugeChart,p as GroupedBarChart,s as Histogram,c as LikertChart,C as MultiLineTooltip,j as OrdinalCustomChart,G as PieChart,I as RidgelinePlot,N as StackedBarChart,R as StreamOrdinalFrame,S as SwarmPlot,Y as SwimlaneChart,K as Tooltip,O as TooltipRoot,f as ViolinPlot,B as composeStyleRules,Q as createHatchPattern,V as estimateLabelWidth,A as glyphExtent,T as glyphPlacement,Z as hatchFillId,d as hatchPatternDef,J as hitTargetPoint,M as hitTargetRect,l as isHatchFill,D as makeNodeRuleContext,F as makeRuleValueResolver,H as makeStyleRuleStyleFn,L as makeXYRuleContext,x as markTooltipChrome,U as matchesThreshold,P as resolveResponsiveRules,W as resolveStyleRules,b as resolveSvgFill,g as responsiveRuleMatches,X as ruleMatches,a as useCustomLayoutSelection};
2
+ import{DEFAULT_HIT_RADIUS as m,hitTargetPoint as i,hitTargetRect as r}from"./c-3BLJEQNG.min.js";import{BarChart as o,BoxPlot as t,DonutChart as n,DotPlot as p,FunnelChart as s,GaugeChart as c,GroupedBarChart as j,Histogram as G,LikertChart as E,OrdinalCustomChart as V,PieChart as B,RadarChart as I,RidgelinePlot as K,StackedBarChart as S,StreamOrdinalFrame_default as M,SwarmPlot as R,SwimlaneChart as W,ViolinPlot as Q}from"./c-II2EEAJN.min.js";import"./c-SLGMUBUL.min.js";import"./c-U6ESPM7V.min.js";import"./c-RSVIHIQ4.min.js";import"./c-F5ZB5GJ6.min.js";import"./c-3VVKFA4M.min.js";import"./c-G3VYMHKE.min.js";import"./c-SRTBCRVE.min.js";import"./c-RJKEKZOO.min.js";import"./c-F3LIKINL.min.js";import"./c-VGKUEZBC.min.js";import"./c-T6UAIKBH.min.js";import"./c-5JWCTX3G.min.js";import"./c-54IRWOGM.min.js";import"./c-GSVCN34B.min.js";import"./c-AG7WWVIH.min.js";import{useCustomLayoutSelection as U}from"./c-G36WS6LN.min.js";import"./c-MT3WBK7M.min.js";import"./c-UC5PTTFI.min.js";import"./c-VPZDY5Q4.min.js";import{AnnotationLabel as C,MultiLineTooltip as F,Tooltip as H,TooltipRoot as L,composeStyleRules as N,estimateLabelWidth as T,makeNodeRuleContext as f,makeRuleValueResolver as J,makeStyleRuleStyleFn as O,makeXYRuleContext as a,markTooltipChrome as A,matchesThreshold as P,resolveResponsiveRules as Z,resolveStyleRules as e,responsiveRuleMatches as Y,ruleMatches as X}from"./c-VN2HG5BS.min.js";import"./c-GR6MOEQC.min.js";import"./c-VRXUB2F2.min.js";import"./c-GGISSW5E.min.js";import"./c-EGR6VYBW.min.js";import"./c-PGKQGGQ2.min.js";import{createHatchPattern as d,glyphExtent as l,glyphPlacement as x,hatchFillId as D,hatchPatternDef as b,isHatchFill as g,resolveSvgFill as h}from"./c-QKHMBE2E.min.js";export{C as AnnotationLabel,o as BarChart,t as BoxPlot,m as DEFAULT_HIT_RADIUS,n as DonutChart,p as DotPlot,s as FunnelChart,c as GaugeChart,j as GroupedBarChart,G as Histogram,E as LikertChart,F as MultiLineTooltip,V as OrdinalCustomChart,B as PieChart,I as RadarChart,K as RidgelinePlot,S as StackedBarChart,M as StreamOrdinalFrame,R as SwarmPlot,W as SwimlaneChart,H as Tooltip,L as TooltipRoot,Q as ViolinPlot,N as composeStyleRules,d as createHatchPattern,T as estimateLabelWidth,l as glyphExtent,x as glyphPlacement,D as hatchFillId,b as hatchPatternDef,i as hitTargetPoint,r as hitTargetRect,g as isHatchFill,f as makeNodeRuleContext,J as makeRuleValueResolver,O as makeStyleRuleStyleFn,a as makeXYRuleContext,A as markTooltipChrome,P as matchesThreshold,Z as resolveResponsiveRules,e as resolveStyleRules,h as resolveSvgFill,Y as responsiveRuleMatches,X as ruleMatches,U as useCustomLayoutSelection};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{BuiltInPhysicsEngineAdapter as e,ChainReactionChart as t,CollisionSwarmChart as n,CrucibleChart as i,DEFAULT_CRUCIBLE_HEIGHT as o,DEFAULT_CRUCIBLE_OUTLETS as r,DEFAULT_CRUCIBLE_SIZE as s,DEFAULT_CRUCIBLE_WIDTH as a,EventDropChart as l,GaltonBoardChart as c,GauntletChart as u,GuantletChart as d,PacketFlowChart as p,PhysicalFlowChart as h,PhysicsCustomChart as m,PhysicsPileChart as f,PhysicsPipelineStore as g,PhysicsSVGOverlay as y,PhysicsSedimentAccumulator as b,ProcessFlowChart as x,StreamPhysicsFrame as w,StreamPhysicsFrame_default as v,UnitPileChart as I,absorbRegion as A,aggregateRegionCounts as M,applyCrucibleEvent as S,applyGauntletEffect as E,bodiesToAnnotationAnchors as k,bodyGroupSpec as P,buildCollisionSwarmPhysics as R,buildCrucibleEvidence as N,buildCrucibleInitialSpawns as j,buildCrucibleLayout as B,buildCruciblePhysicsConfig as Y,buildCrucibleProductEvents as F,buildCrucibleProjection as $,buildCrucibleStateSpawns as D,buildCrucibleTerminalSpawns as T,buildEventDropPhysics as C,buildGaltonBoardPhysics as O,buildPhysicalFlowPhysics as q,buildPhysicsAnnotationContext as X,buildPhysicsPile as W,buildProcessFlowPhysics as z,calculateBlockerAmplification as G,capacitatedRegion as L,chargeGateRegion as U,cloneCrucibleState as J,collidersFromPlotBounds as V,collidersFromXScaleBins as H,compileCruciblePlan as _,compileDependencyMachine as K,composePhysicsControllers as Q,createCapacityQueueController as Z,createDefaultPhysicsEngineAdapter as ee,createInitialCrucibleState as te,createLogicalJoin as ne,createPortalController as ie,crucibleBondId as oe,crucibleBoundaryColliders as re,crucibleComponentBodyId as se,crucibleProductBodyId as ae,crucibleProjectionRows as le,crucibleSemanticKey as ce,defaultViability as ue,evaluateCrucibleConservation as de,evaluatePhysicsBodyBudget as pe,eventLogItem as he,forceFieldRegion as me,groupCompletionRows as fe,matchesPhysicsBodyFilter as ge,membraneRegion as ye,normalizePhysicsAnnotations as be,physicsProcessBoundaryColliders as xe,physicsProcessGroupSemanticItems as we,physicsProcessRegionSemanticItem as ve,physicsProcessStageSemanticItems as Ie,planGauntletPropertyWork as Ae,portalRegion as Me,pressureFieldRegion as Se,processChrome as Ee,processLaneWalls as ke,processStageLayout as Pe,processStageRegions as Re,recordGauntletEvent as Ne,regionCountsToProjectionRows as je,replaceGauntletNegative as Be,replayCruciblePlan as Ye,replayStateTransitions as Fe,resolveCrucibleSelector as $e,resolveCrucibleSnapshotAt as De,resolveCrucibleTime as Te,routeDependencyTracks as Ce,routeSurfaceRegion as Oe,sedimentHeightfield as qe,valueAtPath as Xe}from"./c-US5ZFT6E.min.js";import{mulberry32 as We}from"./c-N4G2L7ID.min.js";import"./c-VGW3VG3I.min.js";import{composeStyleRules as ze,makeRuleValueResolver as Ge,matchesThreshold as Le,resolveStyleRules as Ue,ruleMatches as Je}from"./c-S2BXNNJN.min.js";import"./c-J5G56TUH.min.js";import{MultiLineTooltip as Ve,Tooltip as He,TooltipRoot as _e,compileMotionEncoding as Ke,deriveMotionVector as Qe,hatchFillId as Ze,hatchPatternDef as et,isHatchFill as tt,markTooltipChrome as nt,opacityFromAge as it,resolveMotionAccessor as ot,resolveMotionAge as rt,resolveMotionVector as st,resolveSvgFill as at}from"./c-GIKRQI4X.min.js";import"./c-YDAY2WFR.min.js";import"./c-WJCD5EUY.min.js";function lt(e){const{data:t,encoding:n,defaults:i={},scales:o}=e,r=Ke({data:t,encoding:n}),s=[],a=new Map,l=[],c=[],u=new Map;return r.rows.forEach((e,t)=>{const{id:r,datum:d}=e,p=Math.max(0,ot(n.appearance?.size,d,t)??i.size??6),h=ot(n.appearance?.shape,d,t)??i.shape??{type:"circle",radius:p},m=e.placement.x??i.x??0,f=e.placement.y??i.y??0,g=o?.x?o.x(m):m,y=o?.y?o.y(f):f,b=ot(n.appearance?.color,d,t)??i.color,x=ot(n.appearance?.opacity,d,t)??i.opacity,w=ot(n.appearance?.stroke,d,t)??i.stroke,v=ot(n.appearance?.strokeWidth,d,t)??i.strokeWidth,I=ot(n.time?.spawnAt,d,t)??e.time.arrival,A=e.kinematics.velocityX,M=e.kinematics.velocityY,S=ot(n.dynamics?.mass,d,t)??i.mass??1,E=ot(n.dynamics?.friction,d,t),k=ot(n.dynamics?.restitution,d,t),P=ot(n.dynamics?.bodyCollisions,d,t),R={id:r,x:g,y:y,mass:S,shape:{...h},datum:d,...null!=I&&{spawnAt:I},...null!=A&&{vx:A},...null!=M&&{vy:M},...null!=E&&{friction:E},...null!=k&&{restitution:k},...null!=P&&{bodyCollisions:P}},N={...null!=b&&{fill:b},...null!=x&&{opacity:x},...null!=w&&{stroke:w},...null!=v&&{strokeWidth:v}},j={id:r,datum:d,appearance:{color:b,opacity:x,shape:h,size:p,stroke:w,strokeWidth:v},placement:{x:g,y:y,lane:e.placement.lane,space:n.placement?.space??"world"},time:{arrival:I,spawnAt:I,basis:n.time?.basis??"simulation",unit:n.time?.unit},kinematics:{velocityX:A,velocityY:M,space:n.kinematics?.space??"world"},dynamics:{bodyCollisions:P,friction:E,mass:S,restitution:k},process:e.process,evidence:e.evidence,accessible:e.accessible,spawn:R};s.push(j),a.set(r,j),l.push(R),u.set(r,N),c.push({id:r,bodyId:r,label:e.accessible.label,description:e.accessible.description,datum:d,x:g,y:y,group:e.accessible.group})}),{rows:s,byId:a,spawns:l,semanticItems:c,bodyStyle:e=>u.get(e.id)??{}}}function ct(e){return t=>{const n=lt({data:t.data,encoding:e.encoding,defaults:e.defaults,scales:t.scales}),i=e.extend?.(t,n)??{};return{...i,initialSpawns:n.spawns,bodyStyle:n.bodyStyle,semanticItems:[...n.semanticItems,...i.semanticItems??[]]}}}function ut(e,t){const{layout:n,positiveProperties:i,negativeProperties:o,viability:r,outcome:s}=t,a=function(e){return new Map(e.gates.map(e=>[e.id,e]))}(n),l=[...("function"==typeof t.events?t.events(e,n):t.events)??[]].sort((e,t)=>e.time-t.time);let c=e;for(const e of l){const t=e.gateId?a.get(e.gateId):void 0,l=e.effects??[],u={...he(e,l),appliedAt:e.time},d=Ne(c,u);if(d!==c){c=d;for(const n of l){const r={event:e,gate:t,negativeProperties:o,positiveProperties:i,project:c};n.when&&!n.when(r)||(c=E(c,n,r))}c={...c,viability:r?.(c,{negativeProperties:o,positiveProperties:i})??ue(c,i,o)},e.final&&(c={...c,outcome:e.outcome??s?.(c,{layout:n,negativeProperties:o,positiveProperties:i})??(c.viability>20?"built":"approved_not_built")})}}return c}function dt(e){return e.projects.map(t=>ut(t,e))}function pt(e){const t=e.resources.map(e=>({...e,bodyId:e.bodyId??e.id})),n=new Map(t.map(e=>[e.bodyId,e])),i=new Map,o=new Map,r=e.assignmentForce??.45,s=e.returnForce??.35,a=e.caseAttraction??.08,l=e.assignmentOffset??{x:0,y:0};let c=new Map,u=0,d=0;return{id:e.id??"service-resource-pool",continuous:!0,assign:e=>{const n=i.get(e);if(n)return n;const r=t.find(e=>!o.has(e.id));if(!r)return null;const s={resourceId:r.id,resourceBodyId:r.bodyId,caseBodyId:e,assignedAt:u};return i.set(e,s),o.set(r.id,s),d+=1,s},release:e=>{const t=i.get(e);return!!t&&(i.delete(e),o.delete(t.resourceId),d+=1,!0)},getAssignment:e=>i.get(e),tick:e=>{u=Math.max(u,e.elapsed),c=new Map(e.controls.readBodies().map(e=>[e.id,e]));for(const[e,t]of i)c.has(e)&&c.has(t.resourceBodyId)||(i.delete(e),o.delete(t.resourceId),d+=1)},getSnapshot:()=>({total:t.length,available:t.length-o.size,assigned:o.size,assignments:Array.from(i.values()),simulatedAt:u,metricRevision:d}),bodyForce:e=>{const t=n.get(e.body.id);if(t){const n=o.get(t.id),i=n?c.get(n.caseBodyId):void 0,a=n?r:s;return{x:((i?i.x+(l.x??0):t.home.x)-e.body.x)*a,y:((i?i.y+(l.y??0):t.home.y)-e.body.y)*a}}const u=i.get(e.body.id);if(!u||0>=a)return null;const d=c.get(u.resourceBodyId);return d?{x:(d.x-e.body.x)*a,y:(d.y-e.body.y)*a}:null}}}function ht(e,t){const n="function"==typeof t.deadlineAccessor?t.deadlineAccessor(e):Xe(e.datum,t.deadlineAccessor)??Xe(e,t.deadlineAccessor);return Number.isFinite(Number(n))?Math.max(0,Number(n)):0}function mt(e){const t=new Map;let n=0,i=0;function o(n){t.set(n.bodyId,n),i+=1,e.onStateChange?.({...n})}function r(e){const i=t.get(e);return!(!i||null!=i.completedAt||(o({...i,completedAt:n,state:"unhappy"===i.state?"resolved-unhappy":"resolved"}),0))}return{id:e.id??"service-level",continuous:!0,protect:e=>{const i=t.get(e);return!(!i||null!=i.completedAt||"unhappy"===i.state||(o({...i,state:"protected",protectedAt:n}),0))},complete:r,getCase:e=>t.get(e),tick:i=>{n=Math.max(n,i.elapsed);for(const s of i.controls.readBodies()){if(!ge(s,e.bodyFilter))continue;if(!t.has(s.id)){const t=ht(s,e);o({bodyId:s.id,openedAt:n,deadlineAt:n+t,state:"waiting"})}const a=t.get(s.id);a&&null==a.completedAt&&(e.completionRegionId&&i.getRegionState(s.id)?.activeRegionIds.includes(e.completionRegionId)?r(s.id):"waiting"!==a.state||a.deadlineAt>n||o({...a,state:"unhappy"}))}},getSnapshot:()=>{const e=Array.from(t.values()),o=t=>e.filter(e=>e.state===t).length;return{total:e.length,waiting:o("waiting"),protected:o("protected"),unhappy:o("unhappy"),resolved:o("resolved"),resolvedUnhappy:o("resolved-unhappy"),simulatedAt:n,metricRevision:i}}}}function ft(e){const t=new Set;let n=0,i=0,o=0,r=!1;return{id:e.id??"dependency-gate:"+e.regionId,continuous:!0,tick:s=>{n=Math.max(n,s.elapsed);const a=r;var l;l=n,r=e.isOpen?e.isOpen(l):null!=e.opensAt&&l>=e.opensAt;const c=s.controls.readBodies(),u=new Map(c.map(e=>[e.id,e]));for(const n of c){const i=s.getRegionState(n.id)?.activeRegionIds.includes(e.regionId);i&&ge(n,e.bodyFilter)&&(r||t.has(n.id)||(t.add(n.id),o+=1,e.onHeld?.(n)))}if(r&&!a){for(const n of t){const t=u.get(n);t&&(s.controls.applyImpulse(n,e.releaseImpulse?.x??86,e.releaseImpulse?.y??0),i+=1,e.onReleased?.(t))}t.clear(),o+=1}for(const e of t)u.has(e)||(t.delete(e),o+=1)},getSnapshot:()=>({regionId:e.regionId,isOpen:r,blocked:t.size,released:i,simulatedAt:n,metricRevision:o}),bodyForce:n=>{if(r||!t.has(n.body.id))return null;const i=n.regions?.find(t=>t.id===e.regionId),o=i?.shape;if(!o||"aabb"!==o.type)return{x:.8*-n.body.vx,y:.8*-n.body.vy};const s=e.holdForce??.4;return{x:(o.x-n.body.x)*s-.45*n.body.vx,y:(o.y-n.body.y)*s-.45*n.body.vy}}}}function gt(e,t,n){return Math.max(t,Math.min(n,e))}function yt(e,t,n={}){const i=n.random??Math.random,o=e.stages.find(e=>e.id===t)??e.stages[e.stages.length-1],r=gt(n.along??.5,.05,.95),s=n.jitterX??0,a=n.padY??20,l=o.x0+(o.x1-o.x0)*r+(2*i()-1)*s,c=Math.min(1,o.width/2),u=gt(l,o.x0+c,o.x1-c),d=e.boundaryY(u,"top")+a,p=e.boundaryY(u,"bottom")-a;return{x:u,y:p>d?d+i()*Math.max(1,p-d):e.midY}}function bt(e){return"bowtie"===e.shape?[{id:"incoming",role:"incoming",points:[[e.left,e.topY],[e.centerLeft,e.pinchTop],[e.centerLeft,e.pinchBottom],[e.left,e.bottomY]]},{id:"center",role:"center",points:[[e.centerLeft,e.pinchTop],[e.centerRight,e.pinchTop],[e.centerRight,e.pinchBottom],[e.centerLeft,e.pinchBottom]]},{id:"outgoing",role:"outgoing",points:[[e.centerRight,e.pinchTop],[e.right,e.topY],[e.right,e.bottomY],[e.centerRight,e.pinchBottom]]}]:[{id:"volume",role:"volume",points:[[e.left,e.topY],[e.right,"funnel"===e.shape?e.pinchTop:e.topY],[e.right,"funnel"===e.shape?e.pinchBottom:e.bottomY],[e.left,e.bottomY]]}]}var xt=[.1,.5,.9],wt=1e6;function vt(e){const t="number"==typeof e?e:"string"==typeof e&&e.trim()?Number(e):NaN;return Number.isFinite(t)?t:null}function It(e,t,n,i,o){return"function"==typeof i?i(e,t,n):function(e,t){let n=e;for(const e of t.split(".")){if(null==n||"object"!=typeof n)return;if(!Object.prototype.hasOwnProperty.call(n,e))return;n=n[e]}return n}(e,i??o)}function At(e){const t=Number(e.toFixed(12));return Object.is(t,-0)?0:t}function Mt(e,t,n,i){const o=e.flatMap((e,o)=>{const r=vt(It(e,o,t,n,"time")),s=vt(It(e,o,t,i,"value"));return null==r||null==s?[]:[{time:At(r),value:s,index:o}]});o.sort((e,t)=>e.time-t.time||e.index-t.index);const r=[];for(const e of o){const t=r[r.length-1];t?.time===e.time?t.value=e.value:r.push({time:e.time,value:e.value})}return r}function St(e,t,n,i){if(!e.length)return null;const o=e[0],r=e[e.length-1];if(o.time>t)return"clamp"===i?o.value:null;if(t>r.time)return"clamp"===i?r.value:null;const s=function(e,t){let n=0,i=e.length;for(;i>n;){const o=n+i>>>1;t>e[o].time?n=o+1:i=o}return n}(e,t),a=e[s];if(a?.time===t)return a.value;const l=e[Math.max(0,s-1)];return"step"!==n&&a&&a.time!==l.time?l.value+(t-l.time)/(a.time-l.time)*(a.value-l.value):l.value}function Et(e,t){if(1===e.length)return e[0];const n=(e.length-1)*t,i=Math.floor(n),o=Math.ceil(n);return i===o?e[i]:e[i]+(e[o]-e[i])*(n-i)}function kt(e){const t=e.interpolation??"step",n=e.outsideDomain??"omit",i=function(e){const t=(e??xt).map(e=>{const t=vt(e);if(null==t||0>t||t>1)throw new RangeError("physicsReferenceEnvelope quantiles must be finite values from 0 to 1; received "+e);return At(t)});return Array.from(new Set(t)).sort((e,t)=>e-t)}(e.quantiles),o=function(e){if(Array.isArray(e)){if(e.length>wt)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");return Array.from(new Set(e.map(vt).filter(e=>null!=e).map(At))).sort((e,t)=>e-t)}const t=e,n=vt(t.start),i=vt(t.end),o=vt(t.step);if(null==n||null==i||null==o||0>=o||n>i)throw new RangeError("physicsReferenceEnvelope sampleAt requires finite start/end values with end >= start and step > 0");const r=Math.floor((i-n)/o)+1;if(r>wt)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");const s=[],a=1e-10*Math.max(1,Math.abs(i),Math.abs(n));for(let e=0;r>e;e+=1){const t=n+e*o;if(t>i+a)break;s.push(At(Math.min(t,i)))}if(s.length&&a>=Math.abs(s[s.length-1]-i)||s.push(At(i)),s.length>wt)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");return Array.from(new Set(s)).sort((e,t)=>e-t)}(e.sampleAt),r=e.runs.map(t=>Mt(t.samples,t.id,e.timeAccessor,e.valueAccessor));return{points:o.map(e=>{const o=r.map(i=>St(i,e,t,n)).filter(e=>null!=e).sort((e,t)=>e-t),s={};for(const e of i)s[e]=o.length?Et(o,e):null;return{time:e,count:o.length,min:o.length?o[0]:null,max:o.length?o[o.length-1]:null,median:o.length?Et(o,.5):null,quantiles:s}}),quantiles:i,interpolation:t,outsideDomain:n,runCount:e.runs.length}}function Pt(e,t){return e.quantiles.length?"lower"===t?e.quantiles[0]:e.quantiles[e.quantiles.length-1]:"lower"===t?"min":"max"}function Rt(e,t){if("min"===t||"median"===t||"max"===t)return e[t];const n=vt(t);if(null==n||0>n||n>1)throw new RangeError("comparePhysicsTrace quantile selectors must be from 0 to 1; received "+t);const i=At(n);if(!Object.prototype.hasOwnProperty.call(e.quantiles,i))throw Error(`comparePhysicsTrace could not find quantile ${i} in the reference envelope`);return e.quantiles[i]??null}function Nt(e,t,n){return t>e?"below":e>n?"above":"inside"}function jt(e,t){const n=Math.max(0,t.time-e.time);if(0>=n||null==e.value||null==e.lower||null==e.upper||null==t.value||null==t.lower||null==t.upper)return{below:0,inside:0,above:0,observed:0};const i=e.value-e.lower,o=t.value-t.lower,r=e.value-e.upper,s=t.value-t.upper,a=[0,1];for(const[e,t]of[[i,o],[r,s]])(0>e&&t>0||e>0&&0>t)&&a.push(-e/(t-e));a.sort((e,t)=>e-t);let l=0,c=0,u=0;for(let i=0;a.length-1>i;i+=1){const o=a[i],r=a[i+1];if(o>=r)continue;const s=(o+r)/2,d=(r-o)*n,p=Nt(e.value+(t.value-e.value)*s,e.lower+(t.lower-e.lower)*s,e.upper+(t.upper-e.upper)*s);"below"===p?l+=d:"above"===p?u+=d:c+=d}return{below:l,inside:c,above:u,observed:n}}function Bt(e,t,n={}){const i=n.interpolation??t.interpolation,o=n.outsideDomain??t.outsideDomain,r=Mt(e,n.traceId??"trace",n.timeAccessor,n.valueAccessor),s=n.lower??Pt(t,"lower"),a=n.upper??Pt(t,"upper"),l=t.points.map(e=>{const t=St(r,e.time,i,o),n=Rt(e,s),l=Rt(e,a);if(null!=n&&null!=l&&n>l)throw new RangeError("comparePhysicsTrace lower band exceeds upper band at time "+e.time);return{time:e.time,value:t,lower:n,upper:l,status:null==t||null==n||null==l?"unobserved":Nt(t,n,l)}});let c=0,u=0,d=0,p=0,h=null,m=0,f=null;for(const e of l){if("below"===e.status?c+=1:"inside"===e.status?u+=1:"above"===e.status&&(d+=1),null==e.value||null==e.lower||null==e.upper)continue;const t=Math.max(0,e.value-e.upper),n=Math.max(0,e.lower-e.value);t>p&&(p=t,h=e.time),n>m&&(m=n,f=e.time)}let g=0,y=0,b=0,x=0;for(let e=0;l.length-1>e;e+=1){const t=l[e],n=l[e+1],o=Math.max(0,n.time-t.time);if(o>0){if("linear"===i){const e=jt(t,n);g+=e.below,y+=e.inside,b+=e.above,x+=e.observed;continue}"unobserved"!==t.status&&(x+=o,"below"===t.status?g+=o:"above"===t.status?b+=o:y+=o)}}const w=l[0]?.time,v=l[l.length-1]?.time,I=null==w||null==v?0:Math.max(0,v-w);return{points:l,sampleCount:l.length,observedSamples:c+u+d,belowSamples:c,insideSamples:u,aboveSamples:d,totalDuration:I,observedDuration:x,unobservedDuration:Math.max(0,I-x),belowDuration:g,insideDuration:y,aboveDuration:b,peakExcess:p,peakExcessAt:h,peakDeficit:m,peakDeficitAt:f}}function Yt(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function Ft(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function $t(e){return!!Ft(e)&&"string"==typeof e.id&&"number"==typeof e.furthestStageIndex&&Number.isFinite(e.furthestStageIndex)&&Array.isArray(e.visitedStageIds)&&e.visitedStageIds.every(e=>"string"==typeof e)&&Ft(e.visitsByStage)&&Ft(e.firstEnteredAt)&&Ft(e.lastEnteredAt)&&"number"==typeof e.regressionCount&&Number.isFinite(e.regressionCount)}function Dt(e){return{id:e,furthestStageIndex:-1,visitedStageIds:[],visitsByStage:{},firstEnteredAt:{},lastEnteredAt:{},regressionCount:0}}function Tt(e){const t=Array.from(new Set(e.bodyIds??[]));return{stages:e.stages.map(e=>({...e})),bodyIds:t,entities:Object.fromEntries(t.map(e=>[e,Dt(e)]))}}function Ct(e,t,n={}){if("region-enter"!==t.type)return e;const i=function(e,t){const n=t.stageId?.(e);if(n)return n;const i=e.region.metadata;if(i&&"object"==typeof i&&Object.prototype.hasOwnProperty.call(i,"stageId")){const e=i.stageId;if("string"==typeof e)return e}return e.region.id}(t,n),o=e.stages.findIndex(e=>e.id===i);if(0>o)return e;const r=n.entityId?.(t)??t.bodyId;if(!r)return e;const s=Yt(e.entities,r),a=$t(s)?s:Dt(r),l=a.currentStageId?e.stages.findIndex(e=>e.id===a.currentStageId):-1,c=!a.visitedStageIds.includes(i),u=Number(t.observation.timestamp),d=Number.isFinite(u)?u:0,p=Yt(a.visitsByStage,i),h="number"==typeof p&&Number.isFinite(p)?p:0,m={...a,currentStageId:i,furthestStageId:o>a.furthestStageIndex?i:a.furthestStageId,furthestStageIndex:Math.max(a.furthestStageIndex,o),visitedStageIds:c?[...a.visitedStageIds,i]:a.visitedStageIds,visitsByStage:{...a.visitsByStage,[i]:h+1},firstEnteredAt:c?{...a.firstEnteredAt,[i]:d}:a.firstEnteredAt,lastEnteredAt:{...a.lastEnteredAt,[i]:d},regressionCount:l>=0&&l>o?a.regressionCount+1:a.regressionCount};return{...e,bodyIds:e.bodyIds.includes(r)?e.bodyIds:[...e.bodyIds,r],entities:{...e.entities,[r]:m}}}function Ot(e){const t=e.bodyIds.map(t=>{const n=Yt(e.entities,t);return $t(n)?n:Dt(t)}),n=t.length;let i=n;return e.stages.map((e,o)=>{const r=t.filter(e=>e.furthestStageIndex>=o).length,s=t.filter(t=>t.visitedStageIds.includes(e.id)).length,a=t.reduce((t,n)=>{const i=Yt(n.visitsByStage,e.id);return t+("number"==typeof i&&Number.isFinite(i)?i:0)},0),l={id:e.id,label:e.label??e.id,reached:r,entered:s,total:n,conversion:n>0?r/n:0,fromPrevious:i>0?r/i:0,dropoff:Math.max(0,i-r),visits:a,repeatVisits:Math.max(0,a-s)};return i=r,l})}function qt(e){const[t,n]=e.size,i=e.flow??"down",o=null==(v=e.padding)?{top:24,right:24,bottom:24,left:24}:"number"==typeof v?{top:v,right:v,bottom:v,left:v}:{top:v.top??0,right:v.right??0,bottom:v.bottom??0,left:v.left??0},r=Math.max(.05,Math.min(1,e.channelRatio??1)),s={x:o.left,y:o.top,width:Math.max(1,t-o.left-o.right),height:Math.max(1,n-o.top-o.bottom)},a="down"===i?s.height:s.width,l=a*Math.max(0,e.chargeExtent??.12),c=a*Math.max(0,e.projectionExtent??0),u=a*Math.max(0,e.destinationExtent??.55),d=Math.max(0,a-l-u-c),p=function(e){return"number"==typeof e?Array.from({length:Math.max(1,Math.round(e))},(e,t)=>({id:"bin-"+t,label:t+""})):0===e.length?[{id:"bin-0",label:"0"}]:e.map((e,t)=>({id:e.id,label:e.label??e.id??t+""}))}(e.destinations),h=("down"===i?s.width:s.height)/p.length,m="down"===i?(e,t)=>({x:s.x,y:s.y+e,width:s.width,height:t}):(e,t)=>({x:s.x+e,y:s.y,width:t,height:s.height}),f=m(0,l),g=m(l,d),y=l+d,b=m(y,u),x=m(y+u,c),w=p.map((e,t)=>{const n=t*h,o=h*r,a=(h-o)/2;return"down"===i?{id:e.id,label:e.label,order:t,x:s.x+n+a,y:b.y,width:o,height:b.height,centerX:s.x+(t+.5)*h,centerY:b.y+b.height/2}:{id:e.id,label:e.label,order:t,x:b.x,y:s.y+n+a,width:b.width,height:o,centerX:b.x+b.width/2,centerY:s.y+(t+.5)*h}});var v;return{width:t,height:n,flow:i,charge:f,apparatus:g,destinations:w,projection:x}}function Xt(e,t){return e.destinations.find(e=>e.id===t)}function Wt(e,t,n){const{charge:i,flow:o}=e,r=Math.max(1,n),s=(t%r+.5)/r;return"down"===o?{x:i.x+i.width*s,y:i.y+i.height/2}:{x:i.x+i.width/2,y:i.y+i.height*s}}function zt(e,t={}){const n=t.thickness??4,i=t.idPrefix??"stage",{destinations:o,flow:r,width:s,height:a}=e,l=[];if(o.length>0){const t=o[0];if("down"===r){const r=t.y+t.height;l.push({id:i+"-floor",shape:{type:"segment",x1:e.charge.x,y1:r,x2:e.charge.x+e.charge.width,y2:r,thickness:n}});for(let e=1;o.length>e;e+=1){const s=o[e].centerX-(o[e].centerX-o[e-1].centerX)/2;l.push({id:`${i}-divider-${e}`,shape:{type:"segment",x1:s,y1:t.y,x2:s,y2:r,thickness:n}})}}else{const r=t.x+t.width;l.push({id:i+"-floor",shape:{type:"segment",x1:r,y1:e.charge.y,x2:r,y2:e.charge.y+e.charge.height,thickness:n}});for(let e=1;o.length>e;e+=1){const s=o[e].centerY-(o[e].centerY-o[e-1].centerY)/2;l.push({id:`${i}-divider-${e}`,shape:{type:"segment",x1:t.x,y1:s,x2:r,y2:s,thickness:n}})}}}return!1!==t.walls&&l.push({id:i+"-wall-left",shape:{type:"segment",x1:1,y1:0,x2:1,y2:a,thickness:n}},{id:i+"-wall-right",shape:{type:"segment",x1:s-1,y1:0,x2:s-1,y2:a,thickness:n}}),l}function Gt(e,t={}){return`${t.charge??"bodies"} enter at the ${"down"===e.flow?"top":"left"}, travel ${"down"===e.flow?"downward":"left to right"} through ${t.apparatus??"the apparatus"}, and come to rest in ${e.destinations.length} ${t.destination??"destinations"}: ${e.destinations.map(e=>e.label).join(", ")}.`}function Lt(e){const t="number"==typeof e?e:"string"==typeof e&&e.trim()?Number(e):NaN;return Number.isFinite(t)?t:null}function Ut(e,t,n,i){const o="function"==typeof e?e(t,n):e;return Number.isFinite(o)?Number(o):i}function Jt(e,t,n){return Lt(e[t])??n}function Vt(e,t){return"number"==typeof e?e:e?.[t]??0}function Ht(e){const{band:t,idPrefix:n,plot:i,projection:o}=e,{includeBoundaryWalls:r=!0,includeInteriorWalls:s=!0,wallThickness:a=4}=t,l=function(e){const t=e.bandwidth??e.scale.bandwidth?.()??0,n=new Set;for(const i of e.values){const o=e.scale(i);Number.isFinite(o)&&(n.add(Number(o)),n.add(Number(o)+t))}return Array.from(n).sort((e,t)=>e-t)}(t);if(2>l.length)return[];const c=r?l.length-1:l.length-2,u=[];for(let e=r?0:1;c>=e;e+=1){if(!s&&e>0&&l.length-1>e)continue;const t=l[e];u.push({id:`${n}-wall-${e}`,shape:"x"===o?{type:"aabb",x:t,y:i.y+i.height/2,width:a,height:i.height}:{type:"aabb",x:i.x+i.width/2,y:t,width:i.width,height:a}})}return u}function _t(e){const{plot:t,idPrefix:n="physics-scale",bounds:i={},xBins:o,xBands:r,yBands:s}=e,a=[];if(!1!==i&&a.push(...V(t,{idPrefix:n,...i})),o){const{idPrefix:e,yTop:i,yBottom:r,...s}=o;a.push(...H({...s,idPrefix:e??n+"-xbin",yTop:i??t.y,yBottom:r??t.y+t.height}))}return r&&a.push(...Ht({band:r,idPrefix:r.idPrefix??n+"-xband",plot:t,projection:"x"})),s&&a.push(...Ht({band:s,idPrefix:s.idPrefix??n+"-yband",plot:t,projection:"y"})),a}function Kt(e){const{plot:t,rows:n,columns:i=n+1,pegRadius:o=3,idPrefix:r="galton-peg",yStart:s=t.y+.18*t.height,yEnd:a=t.y+.58*t.height,stagger:l=!0,restitution:c=.2,friction:u=.04}=e,d=Math.max(0,Math.floor(n)),p=Math.max(1,Math.floor(i));if(0===d)return[];const h=d>1?(a-s)/(d-1):0,m=t.width/p,f=[];for(let e=0;d>e;e+=1){const n=l&&e%2==1?m/2:0;for(let i=0;p>i;i+=1){const a=t.x+m*(i+.5)+n;t.x+o>a||a>t.x+t.width-o||f.push({id:`${r}-${e}-${i}`,shape:{type:"aabb",x:a,y:s+e*h,width:2*o,height:2*o},restitution:c,friction:u})}}return f}function Qt(e,t={}){const{idPrefix:n="physics-token",radius:i=5,shape:o,mass:r,vx:s,vy:a,spawnAt:l,seed:c=1,jitter:u,datum:d}=t,p=We(c),h=Vt(u,"x"),m=Vt(u,"y");return e.map((e,c)=>{const u=Ut(t.x,e,c,Jt(e,"x",0)),f=Ut(t.y,e,c,Jt(e,"y",0)),g=Ut(i,e,c,5),y="function"==typeof o?o(e,c):o??{type:"circle",radius:g};return{id:`${n}-${e.index??c}`,x:u+(p()-.5)*h,y:f+(p()-.5)*m,vx:Ut(s,e,c,0),vy:Ut(a,e,c,0),mass:Ut(r,e,c,1),spawnAt:Ut(l,e,c,void 0),shape:y,datum:d?d(e,c):e.datum??e}}).map(e=>{if(Number.isFinite(e.spawnAt))return e;const{spawnAt:t,...n}=e;return n})}function Zt(e,t={}){const{idPrefix:n="sediment",collider:i=!0,colliderThickness:o=1,restitution:r=.05,friction:s=.2,...a}=t,l=qe(e,a),c=i?l.filter(e=>e.height>0).map(e=>({id:`${n}-${e.binId}`,shape:{type:"aabb",x:e.x+e.width/2,y:e.y+o/2,width:e.width,height:o},restitution:r,friction:s})):[];return{columns:l,colliders:c}}function en(e,t={}){const{timeAccessor:n="arrivalTime",timeScale:i=1,startAt:o=0,rebase:r=!0,sort:s=!0}=t,a=e.map((e,t)=>({spawn:e,time:function(e,t,n){return Lt("function"==typeof n?n(e,t):e[n]??e.datum?.[n])}(e,t,n)??e.spawnAt??t})),l=a.length?Math.min(...a.map(e=>e.time)):0;return{initialSpawns:a.map(({spawn:e,time:t})=>({...e,spawnAt:o+(r?t-l:t)})).sort((e,t)=>s?(e.spawnAt??0)-(t.spawnAt??0):0),initialSpawnPacing:{pacing:"arrival",startAt:o,timeAccessor:"spawnAt",timeScale:i}}}var tn=v;export{e as BuiltInPhysicsEngineAdapter,t as ChainReactionChart,n as CollisionSwarmChart,i as CrucibleChart,o as DEFAULT_CRUCIBLE_HEIGHT,r as DEFAULT_CRUCIBLE_OUTLETS,s as DEFAULT_CRUCIBLE_SIZE,a as DEFAULT_CRUCIBLE_WIDTH,l as EventDropChart,c as GaltonBoardChart,u as GauntletChart,d as GuantletChart,Ve as MultiLineTooltip,p as PacketFlowChart,h as PhysicalFlowChart,m as PhysicsCustomChart,f as PhysicsPileChart,g as PhysicsPipelineStore,y as PhysicsSVGOverlay,b as PhysicsSedimentAccumulator,x as ProcessFlowChart,w as StreamPhysicsFrame,He as Tooltip,_e as TooltipRoot,I as UnitPileChart,A as absorbRegion,M as aggregateRegionCounts,S as applyCrucibleEvent,en as arrivalReplay,k as bodiesToAnnotationAnchors,P as bodyGroupSpec,R as buildCollisionSwarmPhysics,N as buildCrucibleEvidence,j as buildCrucibleInitialSpawns,B as buildCrucibleLayout,Y as buildCruciblePhysicsConfig,F as buildCrucibleProductEvents,$ as buildCrucibleProjection,D as buildCrucibleStateSpawns,T as buildCrucibleTerminalSpawns,C as buildEventDropPhysics,O as buildGaltonBoardPhysics,q as buildPhysicalFlowPhysics,X as buildPhysicsAnnotationContext,W as buildPhysicsPile,z as buildProcessFlowPhysics,G as calculateBlockerAmplification,L as capacitatedRegion,U as chargeGateRegion,J as cloneCrucibleState,_t as collidersFromScales,Bt as comparePhysicsTrace,_ as compileCruciblePlan,K as compileDependencyMachine,Ke as compileMotionEncoding,lt as compilePhysicsEncoding,Q as composePhysicsControllers,ze as composeStyleRules,Z as createCapacityQueueController,ee as createDefaultPhysicsEngineAdapter,ft as createDependencyGateController,te as createInitialCrucibleState,ne as createLogicalJoin,ct as createPhysicsEncodingLayout,ie as createPortalController,Tt as createProcessJourneyLedger,mt as createServiceLevelController,pt as createServiceResourcePoolController,oe as crucibleBondId,re as crucibleBoundaryColliders,se as crucibleComponentBodyId,ae as crucibleProductBodyId,le as crucibleProjectionRows,ce as crucibleSemanticKey,tn as default,Qe as deriveMotionVector,Gt as describePhysicsStageGeography,de as evaluateCrucibleConservation,pe as evaluatePhysicsBodyBudget,me as forceFieldRegion,Kt as galtonPegs,fe as groupCompletionRows,Ze as hatchFillId,et as hatchPatternDef,tt as isHatchFill,Ge as makeRuleValueResolver,nt as markTooltipChrome,Le as matchesThreshold,ye as membraneRegion,be as normalizePhysicsAnnotations,it as opacityFromAge,Wt as physicsChargePoint,Xt as physicsDestination,xe as physicsProcessBoundaryColliders,we as physicsProcessGroupSemanticItems,ve as physicsProcessRegionSemanticItem,Ie as physicsProcessStageSemanticItems,kt as physicsReferenceEnvelope,zt as physicsStageColliders,qt as physicsStageGeography,Ae as planGauntletPropertyWork,Me as portalRegion,Se as pressureFieldRegion,Ee as processChrome,Ot as processJourneyRows,ke as processLaneWalls,Pe as processStageLayout,Re as processStageRegions,bt as processVolumePolygons,je as regionCountsToProjectionRows,Be as replaceGauntletNegative,Ye as replayCruciblePlan,Fe as replayStateTransitions,$e as resolveCrucibleSelector,De as resolveCrucibleSnapshotAt,Te as resolveCrucibleTime,ut as resolveGauntletTerminalState,dt as resolveGauntletTerminalStates,ot as resolveMotionAccessor,rt as resolveMotionAge,st as resolveMotionVector,Ue as resolveStyleRules,at as resolveSvgFill,Ce as routeDependencyTracks,Oe as routeSurfaceRegion,Je as ruleMatches,Zt as sedimentBake,qe as sedimentHeightfield,Qt as spawnFromTokens,yt as stageTargetInVolume,Ct as updateProcessJourney};
2
+ import{BuiltInPhysicsEngineAdapter as e,ChainReactionChart as t,CollisionSwarmChart as n,CrucibleChart as i,DEFAULT_CRUCIBLE_HEIGHT as o,DEFAULT_CRUCIBLE_OUTLETS as r,DEFAULT_CRUCIBLE_SIZE as s,DEFAULT_CRUCIBLE_WIDTH as a,EventDropChart as l,GaltonBoardChart as c,GauntletChart as u,GuantletChart as d,PacketFlowChart as p,PhysicalFlowChart as h,PhysicsCustomChart as m,PhysicsPileChart as f,PhysicsPipelineStore as g,PhysicsSVGOverlay as y,PhysicsSedimentAccumulator as b,ProcessFlowChart as x,StreamPhysicsFrame as w,StreamPhysicsFrame_default as v,UnitPileChart as I,absorbRegion as A,aggregateRegionCounts as M,applyCrucibleEvent as S,applyGauntletEffect as E,bodiesToAnnotationAnchors as j,bodyGroupSpec as P,buildCollisionSwarmPhysics as k,buildCrucibleEvidence as R,buildCrucibleInitialSpawns as B,buildCrucibleLayout as N,buildCruciblePhysicsConfig as Y,buildCrucibleProductEvents as $,buildCrucibleProjection as F,buildCrucibleStateSpawns as C,buildCrucibleTerminalSpawns as D,buildEventDropPhysics as O,buildGaltonBoardPhysics as q,buildPhysicalFlowPhysics as T,buildPhysicsAnnotationContext as G,buildPhysicsPile as W,buildProcessFlowPhysics as X,calculateBlockerAmplification as V,capacitatedRegion as z,chargeGateRegion as Q,cloneCrucibleState as L,collidersFromPlotBounds as H,collidersFromXScaleBins as K,compileCruciblePlan as U,compileDependencyMachine as _,composePhysicsControllers as J,createCapacityQueueController as Z,createDefaultPhysicsEngineAdapter as ee,createInitialCrucibleState as te,createLogicalJoin as ne,createPortalController as ie,crucibleBondId as oe,crucibleBoundaryColliders as re,crucibleComponentBodyId as se,crucibleProductBodyId as ae,crucibleProjectionRows as le,crucibleSemanticKey as ce,defaultViability as ue,evaluateCrucibleConservation as de,evaluatePhysicsBodyBudget as pe,eventLogItem as he,forceFieldRegion as me,groupCompletionRows as fe,matchesPhysicsBodyFilter as ge,membraneRegion as ye,normalizePhysicsAnnotations as be,physicsProcessBoundaryColliders as xe,physicsProcessGroupSemanticItems as we,physicsProcessRegionSemanticItem as ve,physicsProcessStageSemanticItems as Ie,planGauntletPropertyWork as Ae,portalRegion as Me,pressureFieldRegion as Se,processChrome as Ee,processLaneWalls as je,processStageLayout as Pe,processStageRegions as ke,recordGauntletEvent as Re,regionCountsToProjectionRows as Be,replaceGauntletNegative as Ne,replayCruciblePlan as Ye,replayStateTransitions as $e,resolveCrucibleSelector as Fe,resolveCrucibleSnapshotAt as Ce,resolveCrucibleTime as De,routeDependencyTracks as Oe,routeSurfaceRegion as qe,sedimentHeightfield as Te,valueAtPath as Ge}from"./c-ECJCKLYY.min.js";import{mulberry32 as We}from"./c-N4G2L7ID.min.js";import"./c-VGW3VG3I.min.js";import"./c-DBQ2V7CH.min.js";import"./c-QSGWX53A.min.js";import"./c-VPZDY5Q4.min.js";import{MultiLineTooltip as Xe,Tooltip as Ve,TooltipRoot as ze,compileMotionEncoding as Qe,composeStyleRules as Le,deriveMotionVector as He,makeRuleValueResolver as Ke,markTooltipChrome as Ue,matchesThreshold as _e,opacityFromAge as Je,resolveMotionAccessor as Ze,resolveMotionAge as et,resolveMotionVector as tt,resolveStyleRules as nt,ruleMatches as it}from"./c-VN2HG5BS.min.js";import"./c-GR6MOEQC.min.js";import"./c-VRXUB2F2.min.js";import"./c-GGISSW5E.min.js";import"./c-EGR6VYBW.min.js";import"./c-PGKQGGQ2.min.js";import{hatchFillId as ot,hatchPatternDef as rt,isHatchFill as st,resolveSvgFill as at}from"./c-QKHMBE2E.min.js";function lt(e){const{data:t,encoding:n,defaults:i={},scales:o}=e,r=Qe({data:t,encoding:n}),s=[],a=new Map,l=[],c=[],u=new Map;return r.rows.forEach((e,t)=>{const{id:r,datum:d}=e,p=Math.max(0,Ze(n.appearance?.size,d,t)??i.size??6),h=Ze(n.appearance?.shape,d,t)??i.shape??{type:"circle",radius:p},m=e.placement.x??i.x??0,f=e.placement.y??i.y??0,g=o?.x?o.x(m):m,y=o?.y?o.y(f):f,b=Ze(n.appearance?.color,d,t)??i.color,x=Ze(n.appearance?.opacity,d,t)??i.opacity,w=Ze(n.appearance?.stroke,d,t)??i.stroke,v=Ze(n.appearance?.strokeWidth,d,t)??i.strokeWidth,I=Ze(n.time?.spawnAt,d,t)??e.time.arrival,A=e.kinematics.velocityX,M=e.kinematics.velocityY,S=Ze(n.dynamics?.mass,d,t)??i.mass??1,E=Ze(n.dynamics?.friction,d,t),j=Ze(n.dynamics?.restitution,d,t),P=Ze(n.dynamics?.bodyCollisions,d,t),k={id:r,x:g,y:y,mass:S,shape:{...h},datum:d,...null!=I&&{spawnAt:I},...null!=A&&{vx:A},...null!=M&&{vy:M},...null!=E&&{friction:E},...null!=j&&{restitution:j},...null!=P&&{bodyCollisions:P}},R={...null!=b&&{fill:b},...null!=x&&{opacity:x},...null!=w&&{stroke:w},...null!=v&&{strokeWidth:v}},B={id:r,datum:d,appearance:{color:b,opacity:x,shape:h,size:p,stroke:w,strokeWidth:v},placement:{x:g,y:y,lane:e.placement.lane,space:n.placement?.space??"world"},time:{arrival:I,spawnAt:I,basis:n.time?.basis??"simulation",unit:n.time?.unit},kinematics:{velocityX:A,velocityY:M,space:n.kinematics?.space??"world"},dynamics:{bodyCollisions:P,friction:E,mass:S,restitution:j},process:e.process,evidence:e.evidence,accessible:e.accessible,spawn:k};s.push(B),a.set(r,B),l.push(k),u.set(r,R),c.push({id:r,bodyId:r,label:e.accessible.label,description:e.accessible.description,datum:d,x:g,y:y,group:e.accessible.group})}),{rows:s,byId:a,spawns:l,semanticItems:c,bodyStyle:e=>u.get(e.id)??{}}}function ct(e){return t=>{const n=lt({data:t.data,encoding:e.encoding,defaults:e.defaults,scales:t.scales}),i=e.extend?.(t,n)??{};return{...i,initialSpawns:n.spawns,bodyStyle:n.bodyStyle,semanticItems:[...n.semanticItems,...i.semanticItems??[]]}}}function ut(e,t){const{layout:n,positiveProperties:i,negativeProperties:o,viability:r,outcome:s}=t,a=function(e){return new Map(e.gates.map(e=>[e.id,e]))}(n),l=[...("function"==typeof t.events?t.events(e,n):t.events)??[]].sort((e,t)=>e.time-t.time);let c=e;for(const e of l){const t=e.gateId?a.get(e.gateId):void 0,l=e.effects??[],u={...he(e,l),appliedAt:e.time},d=Re(c,u);if(d!==c){c=d;for(const n of l){const r={event:e,gate:t,negativeProperties:o,positiveProperties:i,project:c};n.when&&!n.when(r)||(c=E(c,n,r))}c={...c,viability:r?.(c,{negativeProperties:o,positiveProperties:i})??ue(c,i,o)},e.final&&(c={...c,outcome:e.outcome??s?.(c,{layout:n,negativeProperties:o,positiveProperties:i})??(c.viability>20?"built":"approved_not_built")})}}return c}function dt(e){return e.projects.map(t=>ut(t,e))}function pt(e){const t=e.resources.map(e=>({...e,bodyId:e.bodyId??e.id})),n=new Map(t.map(e=>[e.bodyId,e])),i=new Map,o=new Map,r=e.assignmentForce??.45,s=e.returnForce??.35,a=e.caseAttraction??.08,l=e.assignmentOffset??{x:0,y:0};let c=new Map,u=0,d=0;return{id:e.id??"service-resource-pool",continuous:!0,assign:e=>{const n=i.get(e);if(n)return n;const r=t.find(e=>!o.has(e.id));if(!r)return null;const s={resourceId:r.id,resourceBodyId:r.bodyId,caseBodyId:e,assignedAt:u};return i.set(e,s),o.set(r.id,s),d+=1,s},release:e=>{const t=i.get(e);return!!t&&(i.delete(e),o.delete(t.resourceId),d+=1,!0)},getAssignment:e=>i.get(e),tick:e=>{u=Math.max(u,e.elapsed),c=new Map(e.controls.readBodies().map(e=>[e.id,e]));for(const[e,t]of i)c.has(e)&&c.has(t.resourceBodyId)||(i.delete(e),o.delete(t.resourceId),d+=1)},getSnapshot:()=>({total:t.length,available:t.length-o.size,assigned:o.size,assignments:Array.from(i.values()),simulatedAt:u,metricRevision:d}),bodyForce:e=>{const t=n.get(e.body.id);if(t){const n=o.get(t.id),i=n?c.get(n.caseBodyId):void 0,a=n?r:s;return{x:((i?i.x+(l.x??0):t.home.x)-e.body.x)*a,y:((i?i.y+(l.y??0):t.home.y)-e.body.y)*a}}const u=i.get(e.body.id);if(!u||0>=a)return null;const d=c.get(u.resourceBodyId);return d?{x:(d.x-e.body.x)*a,y:(d.y-e.body.y)*a}:null}}}function ht(e,t){const n="function"==typeof t.deadlineAccessor?t.deadlineAccessor(e):Ge(e.datum,t.deadlineAccessor)??Ge(e,t.deadlineAccessor);return Number.isFinite(Number(n))?Math.max(0,Number(n)):0}function mt(e){const t=new Map;let n=0,i=0;function o(n){t.set(n.bodyId,n),i+=1,e.onStateChange?.({...n})}function r(e){const i=t.get(e);return!(!i||null!=i.completedAt||(o({...i,completedAt:n,state:"unhappy"===i.state?"resolved-unhappy":"resolved"}),0))}return{id:e.id??"service-level",continuous:!0,protect:e=>{const i=t.get(e);return!(!i||null!=i.completedAt||"unhappy"===i.state||(o({...i,state:"protected",protectedAt:n}),0))},complete:r,getCase:e=>t.get(e),tick:i=>{n=Math.max(n,i.elapsed);for(const s of i.controls.readBodies()){if(!ge(s,e.bodyFilter))continue;if(!t.has(s.id)){const t=ht(s,e);o({bodyId:s.id,openedAt:n,deadlineAt:n+t,state:"waiting"})}const a=t.get(s.id);a&&null==a.completedAt&&(e.completionRegionId&&i.getRegionState(s.id)?.activeRegionIds.includes(e.completionRegionId)?r(s.id):"waiting"!==a.state||a.deadlineAt>n||o({...a,state:"unhappy"}))}},getSnapshot:()=>{const e=Array.from(t.values()),o=t=>e.filter(e=>e.state===t).length;return{total:e.length,waiting:o("waiting"),protected:o("protected"),unhappy:o("unhappy"),resolved:o("resolved"),resolvedUnhappy:o("resolved-unhappy"),simulatedAt:n,metricRevision:i}}}}function ft(e){const t=new Set;let n=0,i=0,o=0,r=!1;return{id:e.id??"dependency-gate:"+e.regionId,continuous:!0,tick:s=>{n=Math.max(n,s.elapsed);const a=r;var l;l=n,r=e.isOpen?e.isOpen(l):null!=e.opensAt&&l>=e.opensAt;const c=s.controls.readBodies(),u=new Map(c.map(e=>[e.id,e]));for(const n of c){const i=s.getRegionState(n.id)?.activeRegionIds.includes(e.regionId);i&&ge(n,e.bodyFilter)&&(r||t.has(n.id)||(t.add(n.id),o+=1,e.onHeld?.(n)))}if(r&&!a){for(const n of t){const t=u.get(n);t&&(s.controls.applyImpulse(n,e.releaseImpulse?.x??86,e.releaseImpulse?.y??0),i+=1,e.onReleased?.(t))}t.clear(),o+=1}for(const e of t)u.has(e)||(t.delete(e),o+=1)},getSnapshot:()=>({regionId:e.regionId,isOpen:r,blocked:t.size,released:i,simulatedAt:n,metricRevision:o}),bodyForce:n=>{if(r||!t.has(n.body.id))return null;const i=n.regions?.find(t=>t.id===e.regionId),o=i?.shape;if(!o||"aabb"!==o.type)return{x:.8*-n.body.vx,y:.8*-n.body.vy};const s=e.holdForce??.4;return{x:(o.x-n.body.x)*s-.45*n.body.vx,y:(o.y-n.body.y)*s-.45*n.body.vy}}}}function gt(e,t,n){return Math.max(t,Math.min(n,e))}function yt(e,t,n={}){const i=n.random??Math.random,o=e.stages.find(e=>e.id===t)??e.stages[e.stages.length-1],r=gt(n.along??.5,.05,.95),s=n.jitterX??0,a=n.padY??20,l=o.x0+(o.x1-o.x0)*r+(2*i()-1)*s,c=Math.min(1,o.width/2),u=gt(l,o.x0+c,o.x1-c),d=e.boundaryY(u,"top")+a,p=e.boundaryY(u,"bottom")-a;return{x:u,y:p>d?d+i()*Math.max(1,p-d):e.midY}}function bt(e){return"bowtie"===e.shape?[{id:"incoming",role:"incoming",points:[[e.left,e.topY],[e.centerLeft,e.pinchTop],[e.centerLeft,e.pinchBottom],[e.left,e.bottomY]]},{id:"center",role:"center",points:[[e.centerLeft,e.pinchTop],[e.centerRight,e.pinchTop],[e.centerRight,e.pinchBottom],[e.centerLeft,e.pinchBottom]]},{id:"outgoing",role:"outgoing",points:[[e.centerRight,e.pinchTop],[e.right,e.topY],[e.right,e.bottomY],[e.centerRight,e.pinchBottom]]}]:[{id:"volume",role:"volume",points:[[e.left,e.topY],[e.right,"funnel"===e.shape?e.pinchTop:e.topY],[e.right,"funnel"===e.shape?e.pinchBottom:e.bottomY],[e.left,e.bottomY]]}]}var xt=[.1,.5,.9],wt=1e6;function vt(e){const t="number"==typeof e?e:"string"==typeof e&&e.trim()?Number(e):NaN;return Number.isFinite(t)?t:null}function It(e,t,n,i,o){return"function"==typeof i?i(e,t,n):function(e,t){let n=e;for(const e of t.split(".")){if(null==n||"object"!=typeof n)return;if(!Object.prototype.hasOwnProperty.call(n,e))return;n=n[e]}return n}(e,i??o)}function At(e){const t=Number(e.toFixed(12));return Object.is(t,-0)?0:t}function Mt(e,t,n,i){const o=e.flatMap((e,o)=>{const r=vt(It(e,o,t,n,"time")),s=vt(It(e,o,t,i,"value"));return null==r||null==s?[]:[{time:At(r),value:s,index:o}]});o.sort((e,t)=>e.time-t.time||e.index-t.index);const r=[];for(const e of o){const t=r[r.length-1];t?.time===e.time?t.value=e.value:r.push({time:e.time,value:e.value})}return r}function St(e,t,n,i){if(!e.length)return null;const o=e[0],r=e[e.length-1];if(o.time>t)return"clamp"===i?o.value:null;if(t>r.time)return"clamp"===i?r.value:null;const s=function(e,t){let n=0,i=e.length;for(;i>n;){const o=n+i>>>1;t>e[o].time?n=o+1:i=o}return n}(e,t),a=e[s];if(a?.time===t)return a.value;const l=e[Math.max(0,s-1)];return"step"!==n&&a&&a.time!==l.time?l.value+(t-l.time)/(a.time-l.time)*(a.value-l.value):l.value}function Et(e,t){if(1===e.length)return e[0];const n=(e.length-1)*t,i=Math.floor(n),o=Math.ceil(n);return i===o?e[i]:e[i]+(e[o]-e[i])*(n-i)}function jt(e){const t=e.interpolation??"step",n=e.outsideDomain??"omit",i=function(e){const t=(e??xt).map(e=>{const t=vt(e);if(null==t||0>t||t>1)throw new RangeError("physicsReferenceEnvelope quantiles must be finite values from 0 to 1; received "+e);return At(t)});return Array.from(new Set(t)).sort((e,t)=>e-t)}(e.quantiles),o=function(e){if(Array.isArray(e)){if(e.length>wt)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");return Array.from(new Set(e.map(vt).filter(e=>null!=e).map(At))).sort((e,t)=>e-t)}const t=e,n=vt(t.start),i=vt(t.end),o=vt(t.step);if(null==n||null==i||null==o||0>=o||n>i)throw new RangeError("physicsReferenceEnvelope sampleAt requires finite start/end values with end >= start and step > 0");const r=Math.floor((i-n)/o)+1;if(r>wt)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");const s=[],a=1e-10*Math.max(1,Math.abs(i),Math.abs(n));for(let e=0;r>e;e+=1){const t=n+e*o;if(t>i+a)break;s.push(At(Math.min(t,i)))}if(s.length&&a>=Math.abs(s[s.length-1]-i)||s.push(At(i)),s.length>wt)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");return Array.from(new Set(s)).sort((e,t)=>e-t)}(e.sampleAt),r=e.runs.map(t=>Mt(t.samples,t.id,e.timeAccessor,e.valueAccessor));return{points:o.map(e=>{const o=r.map(i=>St(i,e,t,n)).filter(e=>null!=e).sort((e,t)=>e-t),s={};for(const e of i)s[e]=o.length?Et(o,e):null;return{time:e,count:o.length,min:o.length?o[0]:null,max:o.length?o[o.length-1]:null,median:o.length?Et(o,.5):null,quantiles:s}}),quantiles:i,interpolation:t,outsideDomain:n,runCount:e.runs.length}}function Pt(e,t){return e.quantiles.length?"lower"===t?e.quantiles[0]:e.quantiles[e.quantiles.length-1]:"lower"===t?"min":"max"}function kt(e,t){if("min"===t||"median"===t||"max"===t)return e[t];const n=vt(t);if(null==n||0>n||n>1)throw new RangeError("comparePhysicsTrace quantile selectors must be from 0 to 1; received "+t);const i=At(n);if(!Object.prototype.hasOwnProperty.call(e.quantiles,i))throw Error(`comparePhysicsTrace could not find quantile ${i} in the reference envelope`);return e.quantiles[i]??null}function Rt(e,t,n){return t>e?"below":e>n?"above":"inside"}function Bt(e,t){const n=Math.max(0,t.time-e.time);if(0>=n||null==e.value||null==e.lower||null==e.upper||null==t.value||null==t.lower||null==t.upper)return{below:0,inside:0,above:0,observed:0};const i=e.value-e.lower,o=t.value-t.lower,r=e.value-e.upper,s=t.value-t.upper,a=[0,1];for(const[e,t]of[[i,o],[r,s]])(0>e&&t>0||e>0&&0>t)&&a.push(-e/(t-e));a.sort((e,t)=>e-t);let l=0,c=0,u=0;for(let i=0;a.length-1>i;i+=1){const o=a[i],r=a[i+1];if(o>=r)continue;const s=(o+r)/2,d=(r-o)*n,p=Rt(e.value+(t.value-e.value)*s,e.lower+(t.lower-e.lower)*s,e.upper+(t.upper-e.upper)*s);"below"===p?l+=d:"above"===p?u+=d:c+=d}return{below:l,inside:c,above:u,observed:n}}function Nt(e,t,n={}){const i=n.interpolation??t.interpolation,o=n.outsideDomain??t.outsideDomain,r=Mt(e,n.traceId??"trace",n.timeAccessor,n.valueAccessor),s=n.lower??Pt(t,"lower"),a=n.upper??Pt(t,"upper"),l=t.points.map(e=>{const t=St(r,e.time,i,o),n=kt(e,s),l=kt(e,a);if(null!=n&&null!=l&&n>l)throw new RangeError("comparePhysicsTrace lower band exceeds upper band at time "+e.time);return{time:e.time,value:t,lower:n,upper:l,status:null==t||null==n||null==l?"unobserved":Rt(t,n,l)}});let c=0,u=0,d=0,p=0,h=null,m=0,f=null;for(const e of l){if("below"===e.status?c+=1:"inside"===e.status?u+=1:"above"===e.status&&(d+=1),null==e.value||null==e.lower||null==e.upper)continue;const t=Math.max(0,e.value-e.upper),n=Math.max(0,e.lower-e.value);t>p&&(p=t,h=e.time),n>m&&(m=n,f=e.time)}let g=0,y=0,b=0,x=0;for(let e=0;l.length-1>e;e+=1){const t=l[e],n=l[e+1],o=Math.max(0,n.time-t.time);if(o>0){if("linear"===i){const e=Bt(t,n);g+=e.below,y+=e.inside,b+=e.above,x+=e.observed;continue}"unobserved"!==t.status&&(x+=o,"below"===t.status?g+=o:"above"===t.status?b+=o:y+=o)}}const w=l[0]?.time,v=l[l.length-1]?.time,I=null==w||null==v?0:Math.max(0,v-w);return{points:l,sampleCount:l.length,observedSamples:c+u+d,belowSamples:c,insideSamples:u,aboveSamples:d,totalDuration:I,observedDuration:x,unobservedDuration:Math.max(0,I-x),belowDuration:g,insideDuration:y,aboveDuration:b,peakExcess:p,peakExcessAt:h,peakDeficit:m,peakDeficitAt:f}}function Yt(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function $t(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function Ft(e){return!!$t(e)&&"string"==typeof e.id&&"number"==typeof e.furthestStageIndex&&Number.isFinite(e.furthestStageIndex)&&Array.isArray(e.visitedStageIds)&&e.visitedStageIds.every(e=>"string"==typeof e)&&$t(e.visitsByStage)&&$t(e.firstEnteredAt)&&$t(e.lastEnteredAt)&&"number"==typeof e.regressionCount&&Number.isFinite(e.regressionCount)}function Ct(e){return{id:e,furthestStageIndex:-1,visitedStageIds:[],visitsByStage:{},firstEnteredAt:{},lastEnteredAt:{},regressionCount:0}}function Dt(e){const t=Array.from(new Set(e.bodyIds??[]));return{stages:e.stages.map(e=>({...e})),bodyIds:t,entities:Object.fromEntries(t.map(e=>[e,Ct(e)]))}}function Ot(e,t,n={}){if("region-enter"!==t.type)return e;const i=function(e,t){const n=t.stageId?.(e);if(n)return n;const i=e.region.metadata;if(i&&"object"==typeof i&&Object.prototype.hasOwnProperty.call(i,"stageId")){const e=i.stageId;if("string"==typeof e)return e}return e.region.id}(t,n),o=e.stages.findIndex(e=>e.id===i);if(0>o)return e;const r=n.entityId?.(t)??t.bodyId;if(!r)return e;const s=Yt(e.entities,r),a=Ft(s)?s:Ct(r),l=a.currentStageId?e.stages.findIndex(e=>e.id===a.currentStageId):-1,c=!a.visitedStageIds.includes(i),u=Number(t.observation.timestamp),d=Number.isFinite(u)?u:0,p=Yt(a.visitsByStage,i),h="number"==typeof p&&Number.isFinite(p)?p:0,m={...a,currentStageId:i,furthestStageId:o>a.furthestStageIndex?i:a.furthestStageId,furthestStageIndex:Math.max(a.furthestStageIndex,o),visitedStageIds:c?[...a.visitedStageIds,i]:a.visitedStageIds,visitsByStage:{...a.visitsByStage,[i]:h+1},firstEnteredAt:c?{...a.firstEnteredAt,[i]:d}:a.firstEnteredAt,lastEnteredAt:{...a.lastEnteredAt,[i]:d},regressionCount:l>=0&&l>o?a.regressionCount+1:a.regressionCount};return{...e,bodyIds:e.bodyIds.includes(r)?e.bodyIds:[...e.bodyIds,r],entities:{...e.entities,[r]:m}}}function qt(e){const t=e.bodyIds.map(t=>{const n=Yt(e.entities,t);return Ft(n)?n:Ct(t)}),n=t.length;let i=n;return e.stages.map((e,o)=>{const r=t.filter(e=>e.furthestStageIndex>=o).length,s=t.filter(t=>t.visitedStageIds.includes(e.id)).length,a=t.reduce((t,n)=>{const i=Yt(n.visitsByStage,e.id);return t+("number"==typeof i&&Number.isFinite(i)?i:0)},0),l={id:e.id,label:e.label??e.id,reached:r,entered:s,total:n,conversion:n>0?r/n:0,fromPrevious:i>0?r/i:0,dropoff:Math.max(0,i-r),visits:a,repeatVisits:Math.max(0,a-s)};return i=r,l})}function Tt(e){const[t,n]=e.size,i=e.flow??"down",o=null==(v=e.padding)?{top:24,right:24,bottom:24,left:24}:"number"==typeof v?{top:v,right:v,bottom:v,left:v}:{top:v.top??0,right:v.right??0,bottom:v.bottom??0,left:v.left??0},r=Math.max(.05,Math.min(1,e.channelRatio??1)),s={x:o.left,y:o.top,width:Math.max(1,t-o.left-o.right),height:Math.max(1,n-o.top-o.bottom)},a="down"===i?s.height:s.width,l=a*Math.max(0,e.chargeExtent??.12),c=a*Math.max(0,e.projectionExtent??0),u=a*Math.max(0,e.destinationExtent??.55),d=Math.max(0,a-l-u-c),p=function(e){return"number"==typeof e?Array.from({length:Math.max(1,Math.round(e))},(e,t)=>({id:"bin-"+t,label:t+""})):0===e.length?[{id:"bin-0",label:"0"}]:e.map((e,t)=>({id:e.id,label:e.label??e.id??t+""}))}(e.destinations),h=("down"===i?s.width:s.height)/p.length,m="down"===i?(e,t)=>({x:s.x,y:s.y+e,width:s.width,height:t}):(e,t)=>({x:s.x+e,y:s.y,width:t,height:s.height}),f=m(0,l),g=m(l,d),y=l+d,b=m(y,u),x=m(y+u,c),w=p.map((e,t)=>{const n=t*h,o=h*r,a=(h-o)/2;return"down"===i?{id:e.id,label:e.label,order:t,x:s.x+n+a,y:b.y,width:o,height:b.height,centerX:s.x+(t+.5)*h,centerY:b.y+b.height/2}:{id:e.id,label:e.label,order:t,x:b.x,y:s.y+n+a,width:b.width,height:o,centerX:b.x+b.width/2,centerY:s.y+(t+.5)*h}});var v;return{width:t,height:n,flow:i,charge:f,apparatus:g,destinations:w,projection:x}}function Gt(e,t){return e.destinations.find(e=>e.id===t)}function Wt(e,t,n){const{charge:i,flow:o}=e,r=Math.max(1,n),s=(t%r+.5)/r;return"down"===o?{x:i.x+i.width*s,y:i.y+i.height/2}:{x:i.x+i.width/2,y:i.y+i.height*s}}function Xt(e,t={}){const n=t.thickness??4,i=t.idPrefix??"stage",{destinations:o,flow:r,width:s,height:a}=e,l=[];if(o.length>0){const t=o[0];if("down"===r){const r=t.y+t.height;l.push({id:i+"-floor",shape:{type:"segment",x1:e.charge.x,y1:r,x2:e.charge.x+e.charge.width,y2:r,thickness:n}});for(let e=1;o.length>e;e+=1){const s=o[e].centerX-(o[e].centerX-o[e-1].centerX)/2;l.push({id:`${i}-divider-${e}`,shape:{type:"segment",x1:s,y1:t.y,x2:s,y2:r,thickness:n}})}}else{const r=t.x+t.width;l.push({id:i+"-floor",shape:{type:"segment",x1:r,y1:e.charge.y,x2:r,y2:e.charge.y+e.charge.height,thickness:n}});for(let e=1;o.length>e;e+=1){const s=o[e].centerY-(o[e].centerY-o[e-1].centerY)/2;l.push({id:`${i}-divider-${e}`,shape:{type:"segment",x1:t.x,y1:s,x2:r,y2:s,thickness:n}})}}}return!1!==t.walls&&l.push({id:i+"-wall-left",shape:{type:"segment",x1:1,y1:0,x2:1,y2:a,thickness:n}},{id:i+"-wall-right",shape:{type:"segment",x1:s-1,y1:0,x2:s-1,y2:a,thickness:n}}),l}function Vt(e,t={}){return`${t.charge??"bodies"} enter at the ${"down"===e.flow?"top":"left"}, travel ${"down"===e.flow?"downward":"left to right"} through ${t.apparatus??"the apparatus"}, and come to rest in ${e.destinations.length} ${t.destination??"destinations"}: ${e.destinations.map(e=>e.label).join(", ")}.`}function zt(e){const t="number"==typeof e?e:"string"==typeof e&&e.trim()?Number(e):NaN;return Number.isFinite(t)?t:null}function Qt(e,t,n,i){const o="function"==typeof e?e(t,n):e;return Number.isFinite(o)?Number(o):i}function Lt(e,t,n){return zt(e[t])??n}function Ht(e,t){return"number"==typeof e?e:e?.[t]??0}function Kt(e){const{band:t,idPrefix:n,plot:i,projection:o}=e,{includeBoundaryWalls:r=!0,includeInteriorWalls:s=!0,wallThickness:a=4}=t,l=function(e){const t=e.bandwidth??e.scale.bandwidth?.()??0,n=new Set;for(const i of e.values){const o=e.scale(i);Number.isFinite(o)&&(n.add(Number(o)),n.add(Number(o)+t))}return Array.from(n).sort((e,t)=>e-t)}(t);if(2>l.length)return[];const c=r?l.length-1:l.length-2,u=[];for(let e=r?0:1;c>=e;e+=1){if(!s&&e>0&&l.length-1>e)continue;const t=l[e];u.push({id:`${n}-wall-${e}`,shape:"x"===o?{type:"aabb",x:t,y:i.y+i.height/2,width:a,height:i.height}:{type:"aabb",x:i.x+i.width/2,y:t,width:i.width,height:a}})}return u}function Ut(e){const{plot:t,idPrefix:n="physics-scale",bounds:i={},xBins:o,xBands:r,yBands:s}=e,a=[];if(!1!==i&&a.push(...H(t,{idPrefix:n,...i})),o){const{idPrefix:e,yTop:i,yBottom:r,...s}=o;a.push(...K({...s,idPrefix:e??n+"-xbin",yTop:i??t.y,yBottom:r??t.y+t.height}))}return r&&a.push(...Kt({band:r,idPrefix:r.idPrefix??n+"-xband",plot:t,projection:"x"})),s&&a.push(...Kt({band:s,idPrefix:s.idPrefix??n+"-yband",plot:t,projection:"y"})),a}function _t(e){const{plot:t,rows:n,columns:i=n+1,pegRadius:o=3,idPrefix:r="galton-peg",yStart:s=t.y+.18*t.height,yEnd:a=t.y+.58*t.height,stagger:l=!0,restitution:c=.2,friction:u=.04}=e,d=Math.max(0,Math.floor(n)),p=Math.max(1,Math.floor(i));if(0===d)return[];const h=d>1?(a-s)/(d-1):0,m=t.width/p,f=[];for(let e=0;d>e;e+=1){const n=l&&e%2==1?m/2:0;for(let i=0;p>i;i+=1){const a=t.x+m*(i+.5)+n;t.x+o>a||a>t.x+t.width-o||f.push({id:`${r}-${e}-${i}`,shape:{type:"aabb",x:a,y:s+e*h,width:2*o,height:2*o},restitution:c,friction:u})}}return f}function Jt(e,t={}){const{idPrefix:n="physics-token",radius:i=5,shape:o,mass:r,vx:s,vy:a,spawnAt:l,seed:c=1,jitter:u,datum:d}=t,p=We(c),h=Ht(u,"x"),m=Ht(u,"y");return e.map((e,c)=>{const u=Qt(t.x,e,c,Lt(e,"x",0)),f=Qt(t.y,e,c,Lt(e,"y",0)),g=Qt(i,e,c,5),y="function"==typeof o?o(e,c):o??{type:"circle",radius:g};return{id:`${n}-${e.index??c}`,x:u+(p()-.5)*h,y:f+(p()-.5)*m,vx:Qt(s,e,c,0),vy:Qt(a,e,c,0),mass:Qt(r,e,c,1),spawnAt:Qt(l,e,c,void 0),shape:y,datum:d?d(e,c):e.datum??e}}).map(e=>{if(Number.isFinite(e.spawnAt))return e;const{spawnAt:t,...n}=e;return n})}function Zt(e,t={}){const{idPrefix:n="sediment",collider:i=!0,colliderThickness:o=1,restitution:r=.05,friction:s=.2,...a}=t,l=Te(e,a),c=i?l.filter(e=>e.height>0).map(e=>({id:`${n}-${e.binId}`,shape:{type:"aabb",x:e.x+e.width/2,y:e.y+o/2,width:e.width,height:o},restitution:r,friction:s})):[];return{columns:l,colliders:c}}function en(e,t={}){const{timeAccessor:n="arrivalTime",timeScale:i=1,startAt:o=0,rebase:r=!0,sort:s=!0}=t,a=e.map((e,t)=>({spawn:e,time:function(e,t,n){return zt("function"==typeof n?n(e,t):e[n]??e.datum?.[n])}(e,t,n)??e.spawnAt??t})),l=a.length?Math.min(...a.map(e=>e.time)):0;return{initialSpawns:a.map(({spawn:e,time:t})=>({...e,spawnAt:o+(r?t-l:t)})).sort((e,t)=>s?(e.spawnAt??0)-(t.spawnAt??0):0),initialSpawnPacing:{pacing:"arrival",startAt:o,timeAccessor:"spawnAt",timeScale:i}}}var tn=v;export{e as BuiltInPhysicsEngineAdapter,t as ChainReactionChart,n as CollisionSwarmChart,i as CrucibleChart,o as DEFAULT_CRUCIBLE_HEIGHT,r as DEFAULT_CRUCIBLE_OUTLETS,s as DEFAULT_CRUCIBLE_SIZE,a as DEFAULT_CRUCIBLE_WIDTH,l as EventDropChart,c as GaltonBoardChart,u as GauntletChart,d as GuantletChart,Xe as MultiLineTooltip,p as PacketFlowChart,h as PhysicalFlowChart,m as PhysicsCustomChart,f as PhysicsPileChart,g as PhysicsPipelineStore,y as PhysicsSVGOverlay,b as PhysicsSedimentAccumulator,x as ProcessFlowChart,w as StreamPhysicsFrame,Ve as Tooltip,ze as TooltipRoot,I as UnitPileChart,A as absorbRegion,M as aggregateRegionCounts,S as applyCrucibleEvent,en as arrivalReplay,j as bodiesToAnnotationAnchors,P as bodyGroupSpec,k as buildCollisionSwarmPhysics,R as buildCrucibleEvidence,B as buildCrucibleInitialSpawns,N as buildCrucibleLayout,Y as buildCruciblePhysicsConfig,$ as buildCrucibleProductEvents,F as buildCrucibleProjection,C as buildCrucibleStateSpawns,D as buildCrucibleTerminalSpawns,O as buildEventDropPhysics,q as buildGaltonBoardPhysics,T as buildPhysicalFlowPhysics,G as buildPhysicsAnnotationContext,W as buildPhysicsPile,X as buildProcessFlowPhysics,V as calculateBlockerAmplification,z as capacitatedRegion,Q as chargeGateRegion,L as cloneCrucibleState,Ut as collidersFromScales,Nt as comparePhysicsTrace,U as compileCruciblePlan,_ as compileDependencyMachine,Qe as compileMotionEncoding,lt as compilePhysicsEncoding,J as composePhysicsControllers,Le as composeStyleRules,Z as createCapacityQueueController,ee as createDefaultPhysicsEngineAdapter,ft as createDependencyGateController,te as createInitialCrucibleState,ne as createLogicalJoin,ct as createPhysicsEncodingLayout,ie as createPortalController,Dt as createProcessJourneyLedger,mt as createServiceLevelController,pt as createServiceResourcePoolController,oe as crucibleBondId,re as crucibleBoundaryColliders,se as crucibleComponentBodyId,ae as crucibleProductBodyId,le as crucibleProjectionRows,ce as crucibleSemanticKey,tn as default,He as deriveMotionVector,Vt as describePhysicsStageGeography,de as evaluateCrucibleConservation,pe as evaluatePhysicsBodyBudget,me as forceFieldRegion,_t as galtonPegs,fe as groupCompletionRows,ot as hatchFillId,rt as hatchPatternDef,st as isHatchFill,Ke as makeRuleValueResolver,Ue as markTooltipChrome,_e as matchesThreshold,ye as membraneRegion,be as normalizePhysicsAnnotations,Je as opacityFromAge,Wt as physicsChargePoint,Gt as physicsDestination,xe as physicsProcessBoundaryColliders,we as physicsProcessGroupSemanticItems,ve as physicsProcessRegionSemanticItem,Ie as physicsProcessStageSemanticItems,jt as physicsReferenceEnvelope,Xt as physicsStageColliders,Tt as physicsStageGeography,Ae as planGauntletPropertyWork,Me as portalRegion,Se as pressureFieldRegion,Ee as processChrome,qt as processJourneyRows,je as processLaneWalls,Pe as processStageLayout,ke as processStageRegions,bt as processVolumePolygons,Be as regionCountsToProjectionRows,Ne as replaceGauntletNegative,Ye as replayCruciblePlan,$e as replayStateTransitions,Fe as resolveCrucibleSelector,Ce as resolveCrucibleSnapshotAt,De as resolveCrucibleTime,ut as resolveGauntletTerminalState,dt as resolveGauntletTerminalStates,Ze as resolveMotionAccessor,et as resolveMotionAge,tt as resolveMotionVector,nt as resolveStyleRules,at as resolveSvgFill,Oe as routeDependencyTracks,qe as routeSurfaceRegion,it as ruleMatches,Zt as sedimentBake,Te as sedimentHeightfield,Jt as spawnFromTokens,yt as stageTargetInVolume,Ot as updateProcessJourney};
@@ -1 +1 @@
1
- import{resolveCSSColor as e}from"./c-COHXCW3Q.min.js";import t from"roughjs";import{jsx as r}from"react/jsx-runtime";var i=2147483647;function n(e){return"number"==typeof e&&Number.isFinite(e)}function a(e){if(!Array.isArray(e))return null;const t=[];for(const r of e){if(!Array.isArray(r)||!n(r[0])||!n(r[1]))return null;t.push([r[0],r[1]])}return t}function o(e){if(e.style?.icon||e.fillGradient||e.strokeGradient||e.colorThresholds||e.clipRect)return null;if("rect"===e.type&&n(e.x)&&n(e.y)&&n(e.w)&&n(e.h))return{kind:"rectangle",x:e.x,y:e.y,width:e.w,height:e.h};if("point"===e.type&&n(e.x)&&n(e.y)&&n(e.r))return{kind:"circle",x:e.x,y:e.y,diameter:2*e.r};if("circle"===e.type&&n(e.cx)&&n(e.cy)&&n(e.r))return{kind:"circle",x:e.cx,y:e.cy,diameter:2*e.r};if("line"===e.type){const t=a(e.path);if(t&&t.length>=2&&!e._decayOpacities)return{kind:"linearPath",points:t};if(n(e.x1)&&n(e.y1)&&n(e.x2)&&n(e.y2))return{kind:"line",x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}if("area"===e.type){const t=a(e.topPath),r=a(e.bottomPath);if(t&&r&&t.length>1&&r.length>1&&!e._decayOpacities)return{kind:"polygon",points:[...t,...r.slice().reverse()]}}if("geoarea"===e.type&&"string"==typeof e.pathData&&e.pathData)return{kind:"path",d:e.pathData};if(("bezier"===e.type||"ribbon"===e.type||"curved"===e.type)&&"string"==typeof e.pathD&&e.pathD)return{kind:"path",d:e.pathD};if("trapezoid"===e.type){const t=a(e.points);if(t&&t.length>=3)return{kind:"polygon",points:t}}if("connector"===e.type&&n(e.x1)&&n(e.y1)&&n(e.x2)&&n(e.y2))return{kind:"line",x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2};if("violin"===e.type&&"string"==typeof e.pathString&&n(e.translateX)&&n(e.translateY))return{kind:"path",d:e.pathString,transform:{x:e.translateX,y:e.translateY}};if("symbol"===e.type&&"string"==typeof e.path){const t=n(e.x)?e.x:e.cx,r=n(e.y)?e.y:e.cy;if(n(t)&&n(r))return{kind:"path",d:e.path,transform:{x:t,y:r,rotation:n(e.rotation)?e.rotation:void 0}}}return"arc"===e.type&&n(e.cx)&&n(e.cy)&&n(e.outerR)&&n(e.startAngle)&&n(e.endAngle)?{kind:"arc",x:e.cx,y:e.cy,width:2*e.outerR,height:2*e.outerR,start:e.startAngle,stop:e.endAngle,closed:!0}:null}function s(e,t=new WeakSet){if(null==e||"string"==typeof e||"boolean"==typeof e)return e;if("number"==typeof e)return Number.isFinite(e)?e:e+"";if("object"!=typeof e)return e+"";if(t.has(e))return"[Circular]";if(t.add(e),Array.isArray(e))return e.map(e=>s(e,t));const r=e;return Object.fromEntries(Object.keys(r).sort().map(e=>[e,s(r[e],t)]))}function l(e){return JSON.stringify(s(e))??e+""}function c(e){const t="string"==typeof e?e:l(e);let r=2166136261;for(let e=0;t.length>e;e+=1)r^=t.charCodeAt(e),r=Math.imul(r,16777619);return(r>>>0)%i+1}function f(e){const t=e.datum&&"object"==typeof e.datum?e.datum:void 0;return e._transitionKey??e.pointId??e.id??e.category??e.group??t?.id??t?.key??t?.name??null}function p(e){return{fill:"string"==typeof e.fill?e.fill:e.fill?"[CanvasPattern]":void 0,fillOpacity:e.fillOpacity,opacity:e.opacity,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.strokeDasharray,strokeLinecap:e.strokeLinecap}}function u(e){if(!e)return;const t=e.split(/[\s,]+/).map(Number).filter(Number.isFinite);return t.length?t:void 0}function h(e,t,r){switch(t.kind){case"rectangle":return e.rectangle(t.x,t.y,t.width,t.height,r);case"circle":return e.circle(t.x,t.y,t.diameter,r);case"line":return e.line(t.x1,t.y1,t.x2,t.y2,r);case"linearPath":return e.linearPath(t.points,r);case"polygon":return e.polygon(t.points,r);case"path":return e.path(t.d,r);case"arc":return e.arc(t.x,t.y,t.width,t.height,t.start,t.stop,t.closed,r)}}function y(e,t,r){e.beginPath();for(const i of t.ops){const t="number"!=typeof r||0>r?i.data:i.data.map(e=>+e.toFixed(r));"move"===i.op?e.moveTo(t[0],t[1]):"lineTo"===i.op?e.lineTo(t[0],t[1]):"bcurveTo"===i.op&&e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5])}}function d(a={}){const s=function(e){return n(e)&&Math.trunc(Math.abs(e))%i||1}(a.seed),d=n(a.cacheSize)?Math.max(1,Math.trunc(a.cacheSize)):1e3,g=Object.fromEntries(Object.entries({roughness:a.roughness,bowing:a.bowing,maxRandomnessOffset:a.maxRandomnessOffset,curveFitting:a.curveFitting,curveTightness:a.curveTightness,curveStepCount:a.curveStepCount,fillStyle:a.fillStyle,fillWeight:a.fillWeight,hachureAngle:a.hachureAngle,hachureGap:a.hachureGap,dashOffset:a.dashOffset,dashGap:a.dashGap,zigzagOffset:a.zigzagOffset,disableMultiStroke:a.disableMultiStroke,disableMultiStrokeFill:a.disableMultiStrokeFill,preserveVertices:a.preserveVertices,simplification:a.simplification,fixedDecimalPlaceDigits:a.fixedDecimalPlaceDigits}).filter(([,e])=>void 0!==e)),k=l({...g,seed:s}),m=t.generator(),x=new Map;function b(e,t){const r=o(e);return l({backend:"roughjs",identity:f(e),type:e.type,geometry:r,style:p(t),options:k,seed:s})}function v(t,r,i){const n=o(t);if(!n)return null;const a=function(e,t){if(t.fill&&"string"!=typeof t.fill)return null;if("string"==typeof t.fill&&t.fill.startsWith("url("))return null;const r="string"==typeof t.fill&&"none"!==t.fill?t.fill:void 0,i=t.stroke&&"none"!==t.stroke?t.stroke:void 0;switch(e.type){case"line":case"connector":case"curved":return{stroke:i??"#007bff"};case"bezier":case"ribbon":return{fill:r??"#999999",stroke:i??"none"};case"geoarea":return{fill:r??"#e0e0e0",stroke:i??"none"};case"point":case"circle":case"rect":case"area":case"trapezoid":case"violin":case"arc":return{fill:r??"#4e79a7",stroke:i??"none"};case"symbol":return{fill:r,stroke:i??(r?"none":"#4e79a7")};default:return{fill:r,stroke:i??"#007bff"}}}(t,r);if(!a)return null;const p=i?{fill:a.fill?e(i,a.fill)||a.fill:void 0,stroke:e(i,a.stroke)||a.stroke}:a,y=`${b(t,r)}:${l(p)}`,k=x.get(y);if(k)return x.delete(y),x.set(y,k),k;const v=c(`${s}:${f(t)??l(n)}`),D={...g,seed:v,fill:p.fill,stroke:p.stroke,strokeWidth:r.strokeWidth??1,strokeLineDash:u(r.strokeDasharray)},O={drawable:h(m,n,D),geometry:n,style:r};for(x.set(y,O);x.size>d;){const e=x.keys().next().value;if(void 0===e)break;x.delete(e)}return O}const D={id:"roughjs",seed:s,cacheKey:b,drawCanvas({context:e,node:t,style:r}){const i=v(t,r,e);return!!i&&(function(e,t){const{drawable:r,geometry:i,style:n}=t,a=r.options,o=e.globalAlpha,s="path"===i.kind?i.transform:void 0;s&&(e.translate(s.x,s.y),s.rotation&&e.rotate(s.rotation));for(const t of r.sets){if(e.save(),"path"===t.type)e.strokeStyle="none"===a.stroke?"transparent":a.stroke,e.lineWidth=a.strokeWidth,e.globalAlpha=o*(n.opacity??1),a.strokeLineDash&&e.setLineDash(a.strokeLineDash),a.strokeLineDashOffset&&(e.lineDashOffset=a.strokeLineDashOffset),y(e,t,a.fixedDecimalPlaceDigits),e.stroke();else if("fillPath"===t.type)e.fillStyle=a.fill??"transparent",e.globalAlpha=o*(n.opacity??1)*(n.fillOpacity??1),y(e,t,a.fixedDecimalPlaceDigits),e.fill("curve"===r.shape||"polygon"===r.shape||"path"===r.shape?"evenodd":"nonzero");else{const r=0>a.fillWeight?a.strokeWidth/2:a.fillWeight;e.strokeStyle=a.fill??"transparent",e.lineWidth=r,e.globalAlpha=o*(n.opacity??1)*(n.fillOpacity??1),a.fillLineDash&&e.setLineDash(a.fillLineDash),a.fillLineDashOffset&&(e.lineDashOffset=a.fillLineDashOffset),y(e,t,a.fixedDecimalPlaceDigits),e.stroke()}e.restore()}}(e,i),!0)},renderStaticSVG({node:e,style:t,key:i}){const n=v(e,t);if(!n)return null;const a="path"===n.geometry.kind?n.geometry.transform:void 0,o=m.toPaths(n.drawable).map((e,n)=>r("path",{d:e.d,fill:e.fill??"none",fillOpacity:e.fill&&"none"!==e.fill?t.fillOpacity:void 0,stroke:e.stroke,strokeWidth:e.strokeWidth,opacity:t.opacity,strokeLinecap:t.strokeLinecap,strokeDasharray:t.strokeDasharray},`${i}-path-${n}`));return r("g",{"data-semiotic-render-backend":"roughjs",transform:a?`translate(${a.x} ${a.y})${a.rotation?` rotate(${180*a.rotation/Math.PI})`:""}`:void 0,children:o},i)},clearCache(){x.clear()},get cacheEntries(){return x.size}};return D}export{d as createRoughRenderMode,c as stableRoughSeed};
1
+ import{resolveCSSColor as e}from"./c-YZVRZGX2.min.js";import t from"roughjs";import{jsx as r}from"react/jsx-runtime";var i=2147483647;function n(e){return"number"==typeof e&&Number.isFinite(e)}function a(e){if(!Array.isArray(e))return null;const t=[];for(const r of e){if(!Array.isArray(r)||!n(r[0])||!n(r[1]))return null;t.push([r[0],r[1]])}return t}function o(e){if(e.style?.icon||e.fillGradient||e.strokeGradient||e.colorThresholds||e.clipRect)return null;if("rect"===e.type&&n(e.x)&&n(e.y)&&n(e.w)&&n(e.h))return{kind:"rectangle",x:e.x,y:e.y,width:e.w,height:e.h};if("point"===e.type&&n(e.x)&&n(e.y)&&n(e.r))return{kind:"circle",x:e.x,y:e.y,diameter:2*e.r};if("circle"===e.type&&n(e.cx)&&n(e.cy)&&n(e.r))return{kind:"circle",x:e.cx,y:e.cy,diameter:2*e.r};if("line"===e.type){const t=a(e.path);if(t&&t.length>=2&&!e._decayOpacities)return{kind:"linearPath",points:t};if(n(e.x1)&&n(e.y1)&&n(e.x2)&&n(e.y2))return{kind:"line",x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}if("area"===e.type){const t=a(e.topPath),r=a(e.bottomPath);if(t&&r&&t.length>1&&r.length>1&&!e._decayOpacities)return{kind:"polygon",points:[...t,...r.slice().reverse()]}}if("geoarea"===e.type&&"string"==typeof e.pathData&&e.pathData)return{kind:"path",d:e.pathData};if(("bezier"===e.type||"ribbon"===e.type||"curved"===e.type)&&"string"==typeof e.pathD&&e.pathD)return{kind:"path",d:e.pathD};if("trapezoid"===e.type){const t=a(e.points);if(t&&t.length>=3)return{kind:"polygon",points:t}}if("connector"===e.type&&n(e.x1)&&n(e.y1)&&n(e.x2)&&n(e.y2))return{kind:"line",x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2};if("violin"===e.type&&"string"==typeof e.pathString&&n(e.translateX)&&n(e.translateY))return{kind:"path",d:e.pathString,transform:{x:e.translateX,y:e.translateY}};if("symbol"===e.type&&"string"==typeof e.path){const t=n(e.x)?e.x:e.cx,r=n(e.y)?e.y:e.cy;if(n(t)&&n(r))return{kind:"path",d:e.path,transform:{x:t,y:r,rotation:n(e.rotation)?e.rotation:void 0}}}return"arc"===e.type&&n(e.cx)&&n(e.cy)&&n(e.outerR)&&n(e.startAngle)&&n(e.endAngle)?{kind:"arc",x:e.cx,y:e.cy,width:2*e.outerR,height:2*e.outerR,start:e.startAngle,stop:e.endAngle,closed:!0}:null}function s(e,t=new WeakSet){if(null==e||"string"==typeof e||"boolean"==typeof e)return e;if("number"==typeof e)return Number.isFinite(e)?e:e+"";if("object"!=typeof e)return e+"";if(t.has(e))return"[Circular]";if(t.add(e),Array.isArray(e))return e.map(e=>s(e,t));const r=e;return Object.fromEntries(Object.keys(r).sort().map(e=>[e,s(r[e],t)]))}function l(e){return JSON.stringify(s(e))??e+""}function c(e){const t="string"==typeof e?e:l(e);let r=2166136261;for(let e=0;t.length>e;e+=1)r^=t.charCodeAt(e),r=Math.imul(r,16777619);return(r>>>0)%i+1}function f(e){const t=e.datum&&"object"==typeof e.datum?e.datum:void 0;return e._transitionKey??e.pointId??e.id??e.category??e.group??t?.id??t?.key??t?.name??null}function p(e){return{fill:"string"==typeof e.fill?e.fill:e.fill?"[CanvasPattern]":void 0,fillOpacity:e.fillOpacity,opacity:e.opacity,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.strokeDasharray,strokeLinecap:e.strokeLinecap}}function u(e){if(!e)return;const t=e.split(/[\s,]+/).map(Number).filter(Number.isFinite);return t.length?t:void 0}function h(e,t,r){switch(t.kind){case"rectangle":return e.rectangle(t.x,t.y,t.width,t.height,r);case"circle":return e.circle(t.x,t.y,t.diameter,r);case"line":return e.line(t.x1,t.y1,t.x2,t.y2,r);case"linearPath":return e.linearPath(t.points,r);case"polygon":return e.polygon(t.points,r);case"path":return e.path(t.d,r);case"arc":return e.arc(t.x,t.y,t.width,t.height,t.start,t.stop,t.closed,r)}}function y(e,t,r){e.beginPath();for(const i of t.ops){const t="number"!=typeof r||0>r?i.data:i.data.map(e=>+e.toFixed(r));"move"===i.op?e.moveTo(t[0],t[1]):"lineTo"===i.op?e.lineTo(t[0],t[1]):"bcurveTo"===i.op&&e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5])}}function d(a={}){const s=function(e){return n(e)&&Math.trunc(Math.abs(e))%i||1}(a.seed),d=n(a.cacheSize)?Math.max(1,Math.trunc(a.cacheSize)):1e3,g=Object.fromEntries(Object.entries({roughness:a.roughness,bowing:a.bowing,maxRandomnessOffset:a.maxRandomnessOffset,curveFitting:a.curveFitting,curveTightness:a.curveTightness,curveStepCount:a.curveStepCount,fillStyle:a.fillStyle,fillWeight:a.fillWeight,hachureAngle:a.hachureAngle,hachureGap:a.hachureGap,dashOffset:a.dashOffset,dashGap:a.dashGap,zigzagOffset:a.zigzagOffset,disableMultiStroke:a.disableMultiStroke,disableMultiStrokeFill:a.disableMultiStrokeFill,preserveVertices:a.preserveVertices,simplification:a.simplification,fixedDecimalPlaceDigits:a.fixedDecimalPlaceDigits}).filter(([,e])=>void 0!==e)),k=l({...g,seed:s}),m=t.generator(),x=new Map;function b(e,t){const r=o(e);return l({backend:"roughjs",identity:f(e),type:e.type,geometry:r,style:p(t),options:k,seed:s})}function v(t,r,i){const n=o(t);if(!n)return null;const a=function(e,t){if(t.fill&&"string"!=typeof t.fill)return null;if("string"==typeof t.fill&&t.fill.startsWith("url("))return null;const r="string"==typeof t.fill&&"none"!==t.fill?t.fill:void 0,i=t.stroke&&"none"!==t.stroke?t.stroke:void 0;switch(e.type){case"line":case"connector":case"curved":return{stroke:i??"#007bff"};case"bezier":case"ribbon":return{fill:r??"#999999",stroke:i??"none"};case"geoarea":return{fill:r??"#e0e0e0",stroke:i??"none"};case"point":case"circle":case"rect":case"area":case"trapezoid":case"violin":case"arc":return{fill:r??"#4e79a7",stroke:i??"none"};case"symbol":return{fill:r,stroke:i??(r?"none":"#4e79a7")};default:return{fill:r,stroke:i??"#007bff"}}}(t,r);if(!a)return null;const p=i?{fill:a.fill?e(i,a.fill)||a.fill:void 0,stroke:e(i,a.stroke)||a.stroke}:a,y=`${b(t,r)}:${l(p)}`,k=x.get(y);if(k)return x.delete(y),x.set(y,k),k;const v=c(`${s}:${f(t)??l(n)}`),D={...g,seed:v,fill:p.fill,stroke:p.stroke,strokeWidth:r.strokeWidth??1,strokeLineDash:u(r.strokeDasharray)},O={drawable:h(m,n,D),geometry:n,style:r};for(x.set(y,O);x.size>d;){const e=x.keys().next().value;if(void 0===e)break;x.delete(e)}return O}const D={id:"roughjs",seed:s,cacheKey:b,drawCanvas({context:e,node:t,style:r}){const i=v(t,r,e);return!!i&&(function(e,t){const{drawable:r,geometry:i,style:n}=t,a=r.options,o=e.globalAlpha,s="path"===i.kind?i.transform:void 0;s&&(e.translate(s.x,s.y),s.rotation&&e.rotate(s.rotation));for(const t of r.sets){if(e.save(),"path"===t.type)e.strokeStyle="none"===a.stroke?"transparent":a.stroke,e.lineWidth=a.strokeWidth,e.globalAlpha=o*(n.opacity??1),a.strokeLineDash&&e.setLineDash(a.strokeLineDash),a.strokeLineDashOffset&&(e.lineDashOffset=a.strokeLineDashOffset),y(e,t,a.fixedDecimalPlaceDigits),e.stroke();else if("fillPath"===t.type)e.fillStyle=a.fill??"transparent",e.globalAlpha=o*(n.opacity??1)*(n.fillOpacity??1),y(e,t,a.fixedDecimalPlaceDigits),e.fill("curve"===r.shape||"polygon"===r.shape||"path"===r.shape?"evenodd":"nonzero");else{const r=0>a.fillWeight?a.strokeWidth/2:a.fillWeight;e.strokeStyle=a.fill??"transparent",e.lineWidth=r,e.globalAlpha=o*(n.opacity??1)*(n.fillOpacity??1),a.fillLineDash&&e.setLineDash(a.fillLineDash),a.fillLineDashOffset&&(e.lineDashOffset=a.fillLineDashOffset),y(e,t,a.fixedDecimalPlaceDigits),e.stroke()}e.restore()}}(e,i),!0)},renderStaticSVG({node:e,style:t,key:i}){const n=v(e,t);if(!n)return null;const a="path"===n.geometry.kind?n.geometry.transform:void 0,o=m.toPaths(n.drawable).map((e,n)=>r("path",{d:e.d,fill:e.fill??"none",fillOpacity:e.fill&&"none"!==e.fill?t.fillOpacity:void 0,stroke:e.stroke,strokeWidth:e.strokeWidth,opacity:t.opacity,strokeLinecap:t.strokeLinecap,strokeDasharray:t.strokeDasharray},`${i}-path-${n}`));return r("g",{"data-semiotic-render-backend":"roughjs",transform:a?`translate(${a.x} ${a.y})${a.rotation?` rotate(${180*a.rotation/Math.PI})`:""}`:void 0,children:o},i)},clearCache(){x.clear()},get cacheEntries(){return x.size}};return D}export{d as createRoughRenderMode,c as stableRoughSeed};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * semiotic/access — public access-contract surface.
3
+ *
4
+ * This entry is deliberately separate from chart family entries so production
5
+ * routes do not load access tooling merely to render a chart.
6
+ */
7
+ export { CHART_ACCESS_CONTRACT_VERSION, createChartAccessContract, } from "./components/access/chartAccessContract";
8
+ export type { AccessStatusRecord, ChartAccessContract, ChartAccessContractInput, ChartAccessContractText, ChartAccessContractKeyboard, ChartAccessContractNavigation, ChartAccessContractMediaPreferences, ChartAccessContractStreamStatus, ChartAccessContractSsr, ChartAccessContractEvidence, StreamStatusInput, } from "./components/access/chartAccessContract";
9
+ export { BAR_CHART_ACCESS_CONTRACT, LINE_CHART_ACCESS_CONTRACT, REALTIME_LINE_CHART_ACCESS_CONTRACT, } from "./components/access/chartAccessContractFixtures";
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ module.exports=require("./semiotic-client-cjs-shared.min.js").access;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{auditAccessibility as e}from"./c-LKBSGFQC.min.js";import{buildNavigationTree as t,describeChart as a,supportsStructuredNavigation as r}from"./c-TMCTEVVW.min.js";import"./c-IUHFPMHD.min.js";var i=Object.freeze(Object.fromEntries([["AreaChart",13],["BubbleChart",13],["BumpChart",13],["CandlestickChart",13],["ConnectedScatterplot",13],["DifferenceChart",13],["Heatmap",13],["LineChart",13],["MinimapChart",13,"delegated"],["MultiAxisLineChart",13],["QuadrantChart",13],["Scatterplot",13],["ScatterplotMatrix",13,"delegated"],["StackedAreaChart",13],["WaterfallChart",13],["BarChart",13],["BoxPlot",13],["DonutChart",13],["DotPlot",13],["FunnelChart",13],["GaugeChart",5],["GroupedBarChart",13],["Histogram",13],["LikertChart",13],["PieChart",13],["RadarChart",13],["RidgelinePlot",13],["StackedBarChart",13],["SwarmPlot",13],["SwimlaneChart",13],["ViolinPlot",13],["ChordDiagram",13],["CirclePack",13],["ForceDirectedGraph",13],["OrbitDiagram",13],["ProcessSankey",13],["SankeyDiagram",13],["TreeDiagram",13],["Treemap",13],["ChoroplethMap",13],["DistanceCartogram",13],["FlowMap",13],["ProportionalSymbolMap",13],["RealtimeHeatmap",14],["RealtimeHistogram",14],["RealtimeLineChart",14],["RealtimeSwarmChart",14],["RealtimeWaterfallChart",14],["TemporalHistogram",13],["ChainReactionChart",5],["CollisionSwarmChart",13],["CrucibleChart",5],["EventDropChart",13],["GaltonBoardChart",13],["GauntletChart",5],["PacketFlowChart",13],["ProcessFlowChart",13],["UnitPileChart",13],["BigNumber",1,"not-applicable"],["ParallelCoordinatesRecipe",21],["CalendarHeatmapRecipe",21]].map(([e,t,a="unsupported"])=>[e,{supportsSSR:!!(1&t),realtime:!!(2&t),supportsAccessibleTable:!!(4&t),supportsLegend:!!(8&t),...16&t?{recipeNavigation:!0}:{},markNavigation:a}]))),s=1;function n(e,t){return!0===e?.supportsAccessibleTable&&!1!==t.accessibleTable}function o(e){return"string"==typeof e&&e.trim().length>0}function l(e){if(0===e.length)return;const t=e.map(e=>"idle"===e.status?"no data received":"active"===e.status?"receiving data":"not receiving new data"),a=[...new Set(t)],r=1===a.length?a[0]:t.join(", then ");return`Last ${e.length} stream ${1===e.length?"status":"statuses"}: ${r}.`}function c(e,t){return e?e.supportsLegend&&!1!==t.showLegend&&(!0===t.showLegend||null!=t.legend||["colorBy","lineBy","areaBy","stackBy","groupBy"].some(e=>null!=t[e]))?"isolate"===t.legendInteraction||"highlight"===t.legendInteraction?"built-in":"not-enabled":"not-applicable":"unsupported"}function u({component:s,props:u,options:d={}}){const p=i[s],m=p?p.realtime:!0===d.realtime,h=a(s,u,{...d.locale?{locale:d.locale}:{}}),g=r(s,u),v=g||!0===p?.recipeNavigation,b=g&&!1!==d.navigable?t(s,u,{...d.locale?{locale:d.locale}:{}}):void 0,C=e(s,u,{inChartContainer:!0===d.inChartContainer,describe:!0===d.describe||o(u.summary),navigable:!1!==d.navigable&&v}),y=m?function(e){const t=e?.streamStatus;return t?(Array.isArray(t)?t:[t]).filter(e=>!!e&&"string"==typeof e.status).slice(-(e?.streamHistoryLimit??5)):[]}(d):[],f=function(e,t){return e?"delegated"===e.markNavigation||"not-applicable"===e.markNavigation?e.markNavigation:t?"built-in":"unsupported":"unsupported"}(p,v);return{schemaVersion:1,component:s,text:{...o(u.title)?{title:u.title}:{},...o(u.description)?{description:u.description}:{},...o(u.summary)?{summary:u.summary}:{},accessibleTable:n(p,u)},keyboard:{markNavigation:f,legendInteraction:c(p,u),focusRing:f},navigation:{supported:v,composition:"chart-container",...b?{tree:b}:void 0,...b?{}:{note:v?g?"Structured datum navigation is available through ChartContainer; enable its navigable option to materialize the tree.":"Structured datum navigation is declared for this built-in recipe; load its recipe manifest through semiotic/ai before materializing the tree.":"No datum-level structured navigation is registered for this chart. Exact-value table access may still be available."}},table:{enabled:n(p,u),source:"scene",pagination:"built-in"},mediaPreferences:{reducedMotion:p?"built-in":"unknown",forcedColors:p?"css-custom-properties":"unknown",note:p?"Runtime detection is available through useReducedMotion and useHighContrast; canvas styling uses CSS custom properties so forced-colors changes cascade.":"No generated runtime capability record exists for this component; media-preference support is unknown."},streamStatus:m?{supported:!0,status:y.at(-1)?.status??"idle",lastPushTime:y.at(-1)?.lastPushTime??null,history:y,historyLimit:d.streamHistoryLimit??5,...l(y)?{accessibleDescription:l(y)}:{},note:"Hosts may expose this bounded, non-visible description to screen readers or agents. Do not render it in visible UI."}:{supported:!1,note:"Static chart; no push-ingest lifecycle."},ssr:!0===p?.supportsSSR?{supported:!0,evidence:d.ssrEvidence,note:d.ssrEvidence?"Server rendering is registered and attached render evidence records the observed scene.":"Server rendering is registered; supply renderChartWithEvidence output before claiming a non-empty scene."}:{supported:!1,...d.ssrEvidence?{evidence:d.ssrEvidence}:{},note:m?"Live push charts intentionally omit static SSR; capture a supported bounded-window static twin before claiming server evidence.":p?"The chart capability registry does not expose this component through renderChart; do not claim server evidence for the HOC surface.":"No generated capability record exists for this component; SSR support is unknown and therefore reported as unsupported."},evidence:{audit:C,description:h}}}var d=u({component:"LineChart",props:{data:[{date:"2026-01-01",value:12},{date:"2026-02-01",value:18},{date:"2026-03-01",value:15}],xAccessor:"date",yAccessor:"value",title:"Weekly active users",description:"Daily active users from January through March, with a February peak.",summary:"Use keyboard mark navigation to inspect each point; the linked table lists exact values."},options:{navigable:!0}}),p=u({component:"BarChart",props:{data:[{region:"North",total:42},{region:"South",total:31},{region:"East",total:27}],categoryAccessor:"region",valueAccessor:"total",title:"Orders by region",description:"Three regions compared by order count; North leads and East trails.",summary:"The accessible table preserves category labels and numeric totals for exact reading."},options:{navigable:!0}}),m=u({component:"RealtimeLineChart",props:{data:[{time:1,value:4},{time:2,value:7}],timeAccessor:"time",valueAccessor:"value",title:"Requests per second",description:"A bounded live window of requests per second with stale-state indication available through useStreamStatus.",summary:"The current window is exposed as an accessible table; status changes should be announced by the host application."},options:{realtime:!0,navigable:!1,streamStatus:[{status:"idle",lastPushTime:null},{status:"active",lastPushTime:1e3},{status:"active",lastPushTime:2e3},{status:"active",lastPushTime:3e3},{status:"stale",lastPushTime:4e3}],streamHistoryLimit:5}});export{p as BAR_CHART_ACCESS_CONTRACT,s as CHART_ACCESS_CONTRACT_VERSION,d as LINE_CHART_ACCESS_CONTRACT,m as REALTIME_LINE_CHART_ACCESS_CONTRACT,u as createChartAccessContract};
@@ -22,6 +22,11 @@ export { auditData, formatDataAudit, profileNumericFields, toDataAuditNotificati
22
22
  export type { AuditDataOptions, CheckedNumericContract, DataAuditChartNotification, DataAuditDiagnosis, DataAuditNotificationOptions, DataAuditResult, NumericFieldProfile, ProfileNumericFieldsOptions, } from "./components/data/auditData";
23
23
  export { evaluateChart, formatEvaluateChart, toEvaluateChartNotifications, } from "./components/ai/evaluateChart";
24
24
  export type { EvaluateChartFinding, EvaluateChartNotification, EvaluateChartOptions, EvaluateChartResult, EvaluateChartSeverity, EvaluateChartStage, EvaluateChartSummary, } from "./components/ai/evaluateChart";
25
+ export { auditVisualHierarchy } from "./components/ai/auditVisualHierarchy";
26
+ export type { VisualHierarchyAuditResult, VisualHierarchyFinding, VisualHierarchyInput, VisualHierarchyStatus, } from "./components/ai/auditVisualHierarchy";
27
+ export { AESTHETICS_OFF_PROFILE, DEFAULT_AESTHETIC_PROFILE, DEFAULT_AESTHETIC_THRESHOLDS, DEFAULT_AESTHETIC_WEIGHTS, evaluateAesthetics, } from "./components/ai/evaluateAesthetics";
28
+ export type { AestheticEvaluationResult, AestheticFeatureResult, AestheticFeatureStatus, EvaluateAestheticsOptions, } from "./components/ai/evaluateAesthetics";
29
+ export type { AestheticFeatureId, AestheticFeatureWeights, AestheticProfile, AestheticThresholds, } from "./components/ai/aestheticProfileTypes";
25
30
  export type { NumericAggregateContract, NumericContracts, NumericFieldContract, NumericFieldRole, NumericRequirement, } from "./components/data/numericContracts";
26
31
  export { profileData } from "./components/ai/profileData";
27
32
  export type { ProfileDataOptions } from "./components/ai/profileData";
@@ -36,6 +41,10 @@ export { BUILT_IN_INTENT_IDS, getIntent, listIntents, registerIntent } from "./c
36
41
  export type { BuiltInIntentId, IntentDescriptor, IntentFieldKind, IntentId, IntentSignals } from "./components/ai/intents";
37
42
  export { suggestCharts, suggestChartsGrouped, scoreChart, explainCapabilityFit } from "./components/ai/suggestCharts";
38
43
  export type { SuggestChartsOptions, ScoreChartOptions, RejectedCapability, ExplainCapabilityFitResult, } from "./components/ai/suggestCharts";
44
+ export { BUILT_IN_CHART_RECIPES, CALENDAR_HEATMAP_CONFIG_SCHEMA, CALENDAR_HEATMAP_LAYOUT_ID, CALENDAR_HEATMAP_RECIPE_ID, PARALLEL_COORDINATES_CONFIG_SCHEMA, PARALLEL_COORDINATES_LAYOUT_ID, PARALLEL_COORDINATES_RECIPE_ID, calendarHeatmapRecipe, parallelCoordinatesRecipe, registerBuiltInChartRecipeManifests } from "./components/ai/builtInChartRecipes";
45
+ export { defineChartRecipe, isJsonSafe, isRegisteredRecipeLayout, validateChartRecipe } from "./components/ai/chartRecipes";
46
+ export type { ChartRecipe, ChartRecipeFrameFamily, ChartRecipePortability, DataRoleDefinition, EncodingDefinition, SerializableSchema } from "./components/ai/chartRecipes";
47
+ export { getChartRecipe, getRegisteredRecipeCapabilities, hasRegisteredRecipeCapabilities, listChartRecipes, registerChartRecipe, resolveChartRecipe, unregisterChartRecipe } from "./components/ai/chartRecipeRegistry";
39
48
  export { suggestDashboard } from "./components/ai/suggestDashboard";
40
49
  export type { DashboardPanel, DashboardSuggestion, SuggestDashboardOptions } from "./components/ai/suggestDashboard";
41
50
  export { suggestStreamCharts } from "./components/ai/suggestStreamCharts";