semiotic 3.9.1 → 3.10.0

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 (566) hide show
  1. package/README.md +137 -58
  2. package/agent-skill/semiotic-charts/SKILL.md +27 -17
  3. package/ai/artifact-contract-reference.md +408 -0
  4. package/ai/artifact-surface-inventory.json +5586 -0
  5. package/ai/behaviorContracts.cjs +24 -2
  6. package/ai/cli.js +480 -56
  7. package/ai/componentMetadata.cjs +13 -3
  8. package/ai/dist/mcp-server.js +140 -36407
  9. package/ai/examples.md +110 -7
  10. package/ai/reference.md +82 -28
  11. package/ai/schema.json +7675 -1471
  12. package/ai/surface-manifest.json +60 -9
  13. package/ai/system-prompt.md +18 -3
  14. package/ai/task-packets/compare-category-totals.json +301 -0
  15. package/ai/task-packets/compare-category-totals.md +188 -0
  16. package/ai/task-packets/correct-published-chart.json +271 -0
  17. package/ai/task-packets/correct-published-chart.md +597 -0
  18. package/ai/task-packets/index.json +40 -0
  19. package/ai/task-packets/update-live-chart.json +289 -0
  20. package/ai/task-packets/update-live-chart.md +424 -0
  21. package/dist/c-2N7IU2NY.min.js +1 -0
  22. package/dist/c-2WK7YJLL.min.js +1 -0
  23. package/dist/c-33QOXEUG.min.js +1 -0
  24. package/dist/c-42PLDTX7.min.js +1 -0
  25. package/dist/c-447VIMRO.min.js +1 -0
  26. package/dist/c-4FN7Q6VQ.min.js +1 -0
  27. package/dist/c-553QUDKA.min.js +1 -0
  28. package/dist/c-55BAJ333.min.js +1 -0
  29. package/dist/c-7242NXSG.min.js +1 -0
  30. package/dist/c-7EGHJU2F.min.js +1 -0
  31. package/dist/c-7HP7MB2I.min.js +1 -0
  32. package/dist/c-7NBU5ZKS.min.js +1 -0
  33. package/dist/c-AFBSWT77.min.js +1 -0
  34. package/dist/c-AJ7EC32V.min.js +1 -0
  35. package/dist/c-AQADQNY7.min.js +1 -0
  36. package/dist/c-ATM475SA.min.js +1 -0
  37. package/dist/c-AVO3Q7T7.min.js +1 -0
  38. package/dist/c-AZKPVBOC.min.js +1 -0
  39. package/dist/c-BNFJMDHN.min.js +1 -0
  40. package/dist/c-BNG5ECK5.min.js +1 -0
  41. package/dist/c-BOHCQILI.min.js +1 -0
  42. package/dist/c-CCTGN5CK.min.js +1 -0
  43. package/dist/c-CPSPZH6A.min.js +1 -0
  44. package/dist/c-CPV4N35K.min.js +1 -0
  45. package/dist/c-D6HAAPTX.min.js +1 -0
  46. package/dist/c-DE5Q3U2X.min.js +1 -0
  47. package/dist/c-DK662R77.min.js +1 -0
  48. package/dist/c-DY2676CR.min.js +1 -0
  49. package/dist/c-E32M6XW5.min.js +1 -0
  50. package/dist/c-E4JDJH4I.min.js +1 -0
  51. package/dist/c-E7I2L7CU.min.js +1 -0
  52. package/dist/c-EBOQ7ER7.min.js +1 -0
  53. package/dist/c-ELDWAO2V.min.js +1 -0
  54. package/dist/c-EUBTECGM.min.js +1 -0
  55. package/dist/c-GNTXRXRN.min.js +1 -0
  56. package/dist/c-GSZRZRD6.min.js +1 -0
  57. package/dist/c-GWX7JGMF.min.js +1 -0
  58. package/dist/c-GXV3C3MO.min.js +1 -0
  59. package/dist/c-HHTK2R75.min.js +1 -0
  60. package/dist/c-HLLFJYTY.min.js +1 -0
  61. package/dist/c-HPOYKCCG.min.js +1 -0
  62. package/dist/c-HXDKPIKR.min.js +1 -0
  63. package/dist/c-I4QJ6YLM.min.js +1 -0
  64. package/dist/c-IDJV3CZK.min.js +1 -0
  65. package/dist/c-ITKX3RC5.min.js +1 -0
  66. package/dist/c-JG2JCQLP.min.js +1 -0
  67. package/dist/c-JLGRHXGZ.min.js +1 -0
  68. package/dist/c-JO2UGTCP.min.js +1 -0
  69. package/dist/c-JUKIWTBJ.min.js +1 -0
  70. package/dist/c-KCRJGUHP.min.js +1 -0
  71. package/dist/c-LMGSSD2E.min.js +1 -0
  72. package/dist/c-LYQMZMZQ.min.js +1 -0
  73. package/dist/c-LYVKDBQJ.min.js +1 -0
  74. package/dist/c-MVR3RWF3.min.js +1 -0
  75. package/dist/c-MXCP7GNZ.min.js +1 -0
  76. package/dist/c-NG7BLZTR.min.js +1 -0
  77. package/dist/c-NYZ2QNAM.min.js +1 -0
  78. package/dist/c-OO5QLMJC.min.js +1 -0
  79. package/dist/c-OOVX2JPQ.min.js +1 -0
  80. package/dist/c-ORLEBW72.min.js +1 -0
  81. package/dist/c-P65V6HLO.min.js +1 -0
  82. package/dist/c-PP6VY3QU.min.js +1 -0
  83. package/dist/c-PRIKOLTE.min.js +1 -0
  84. package/dist/c-PSNI6KAZ.min.js +1 -0
  85. package/dist/c-PYNW54D2.min.js +1 -0
  86. package/dist/c-QA3HMQJP.min.js +1 -0
  87. package/dist/c-QAVFOEUY.min.js +1 -0
  88. package/dist/c-ROEHCIGV.min.js +1 -0
  89. package/dist/c-S3AZX5PP.min.js +1 -0
  90. package/dist/c-T2V7O2LO.min.js +1 -0
  91. package/dist/c-TIXX5CAU.min.js +1 -0
  92. package/dist/c-TKG2NP7G.min.js +1 -0
  93. package/dist/c-VJTDST2R.min.js +1 -0
  94. package/dist/c-VXLOLYTO.min.js +1 -0
  95. package/dist/c-W4ZUKSEQ.min.js +1 -0
  96. package/dist/c-WH2O53VI.min.js +1 -0
  97. package/dist/c-WNGH47HF.min.js +1 -0
  98. package/dist/c-WUWXGQYA.min.js +1 -0
  99. package/dist/c-XDQKXPX4.min.js +1 -0
  100. package/dist/c-XSB27XPS.min.js +1 -0
  101. package/dist/c-YDECTEUW.min.js +1 -0
  102. package/dist/c-YF3YKVQI.min.js +1 -0
  103. package/dist/c-YLZIV3VS.min.js +1 -0
  104. package/dist/c-ZYPXQF7B.min.js +1 -0
  105. package/dist/components/Annotation.d.ts +3 -2
  106. package/dist/components/access/chartAccessCapabilities.generated.d.ts +14 -0
  107. package/dist/components/access/chartAccessContract.d.ts +90 -0
  108. package/dist/components/access/chartAccessContractFixtures.d.ts +11 -0
  109. package/dist/components/ai/aestheticProfileTypes.d.ts +35 -0
  110. package/dist/components/ai/annotationProvenance.d.ts +2 -7
  111. package/dist/components/ai/auditVisualHierarchy.d.ts +49 -0
  112. package/dist/components/ai/builtInChartRecipeLayouts.d.ts +2 -0
  113. package/dist/components/ai/builtInChartRecipePublic.d.ts +4 -0
  114. package/dist/components/ai/builtInChartRecipes.d.ts +26 -0
  115. package/dist/components/ai/chartCapabilities.d.ts +3 -1
  116. package/dist/components/ai/chartRecipeRegistry.d.ts +7 -1
  117. package/dist/components/ai/chartRecipes.d.ts +10 -0
  118. package/dist/components/ai/colorEvidence.d.ts +12 -0
  119. package/dist/components/ai/describePhysicsProjection.d.ts +18 -0
  120. package/dist/components/ai/describePhysicsSource.d.ts +13 -0
  121. package/dist/components/ai/evaluateAesthetics.d.ts +47 -0
  122. package/dist/components/ai/geoNavigation.d.ts +4 -0
  123. package/dist/components/ai/hierarchyNavigation.d.ts +4 -0
  124. package/dist/components/ai/navigationTree.d.ts +7 -1
  125. package/dist/components/ai/qualityFixtures.d.ts +8 -0
  126. package/dist/components/ai/suggestionPropContracts.d.ts +1 -1
  127. package/dist/components/ai/useNavigationSync.d.ts +3 -3
  128. package/dist/components/artifact/ArtifactInspector.d.ts +26 -0
  129. package/dist/components/artifact/ArtifactInspectorContextSections.d.ts +18 -0
  130. package/dist/components/artifact/artifactContractDiff.d.ts +8 -0
  131. package/dist/components/artifact/artifactInspectorSummary.d.ts +53 -0
  132. package/dist/components/artifact/artifactRevision.d.ts +54 -0
  133. package/dist/components/artifact/artifactTestFixtures.d.ts +17 -0
  134. package/dist/components/artifact/attachmentAudit.d.ts +13 -0
  135. package/dist/components/artifact/claimCorrections.d.ts +3 -0
  136. package/dist/components/artifact/claimGraph.d.ts +5 -0
  137. package/dist/components/artifact/claimLifecycle.d.ts +32 -0
  138. package/dist/components/artifact/claims.d.ts +24 -0
  139. package/dist/components/artifact/collection.d.ts +10 -0
  140. package/dist/components/artifact/collectionCorrectionScope.d.ts +4 -0
  141. package/dist/components/artifact/collectionImpact.d.ts +11 -0
  142. package/dist/components/artifact/collectionLineage.d.ts +3 -0
  143. package/dist/components/artifact/collectionOperations.d.ts +8 -0
  144. package/dist/components/artifact/collectionPolicy.d.ts +22 -0
  145. package/dist/components/artifact/collectionTypes.d.ts +117 -0
  146. package/dist/components/artifact/configurationRepair.d.ts +8 -0
  147. package/dist/components/artifact/contract.d.ts +30 -0
  148. package/dist/components/artifact/evaluateArtifact.d.ts +12 -0
  149. package/dist/components/artifact/evaluateArtifactTypes.d.ts +78 -0
  150. package/dist/components/artifact/evaluationPresentation.d.ts +9 -0
  151. package/dist/components/artifact/evidenceSample.d.ts +8 -0
  152. package/dist/components/artifact/exportPaths.d.ts +8 -0
  153. package/dist/components/artifact/fieldPolicies.d.ts +12 -0
  154. package/dist/components/artifact/fingerprint.d.ts +36 -0
  155. package/dist/components/artifact/grounding.d.ts +51 -0
  156. package/dist/components/artifact/groundingBudget.d.ts +38 -0
  157. package/dist/components/artifact/hostTransfer.d.ts +13 -0
  158. package/dist/components/artifact/identity.d.ts +19 -0
  159. package/dist/components/artifact/inheritance.d.ts +48 -0
  160. package/dist/components/artifact/inheritanceIntegrity.d.ts +3 -0
  161. package/dist/components/artifact/jsonCompatibility.d.ts +2 -0
  162. package/dist/components/artifact/obligations.d.ts +3 -0
  163. package/dist/components/artifact/policies.d.ts +45 -0
  164. package/dist/components/artifact/policyRelations.d.ts +3 -0
  165. package/dist/components/artifact/recordProjection.d.ts +7 -0
  166. package/dist/components/artifact/representation.d.ts +50 -0
  167. package/dist/components/artifact/serialization.d.ts +40 -0
  168. package/dist/components/artifact/temporal.d.ts +32 -0
  169. package/dist/components/artifact/temporalAdapters.d.ts +75 -0
  170. package/dist/components/artifact/temporalAuditHelpers.d.ts +12 -0
  171. package/dist/components/artifact/temporalPresentation.d.ts +8 -0
  172. package/dist/components/artifact/types.d.ts +341 -0
  173. package/dist/components/artifact/validation.d.ts +13 -0
  174. package/dist/components/artifact/validationFieldStatus.d.ts +7 -0
  175. package/dist/components/artifact/validationPrimitives.d.ts +24 -0
  176. package/dist/components/artifact/validationSurfaces.d.ts +7 -0
  177. package/dist/components/artifact/validationTemporal.d.ts +3 -0
  178. package/dist/components/charts/geo/FlowMap.d.ts +7 -0
  179. package/dist/components/charts/geo/flowMapLineStyle.d.ts +18 -0
  180. package/dist/components/charts/index.d.ts +4 -0
  181. package/dist/components/charts/network/ChordDiagram.d.ts +5 -1
  182. package/dist/components/charts/network/CirclePack.d.ts +8 -1
  183. package/dist/components/charts/network/OrbitDiagram.d.ts +9 -0
  184. package/dist/components/charts/network/TreeDiagram.d.ts +8 -1
  185. package/dist/components/charts/network/Treemap.d.ts +8 -1
  186. package/dist/components/charts/ordinal/BarChart.d.ts +6 -0
  187. package/dist/components/charts/ordinal/BoxPlot.d.ts +3 -0
  188. package/dist/components/charts/ordinal/DonutChart.d.ts +5 -0
  189. package/dist/components/charts/ordinal/DotPlot.d.ts +3 -0
  190. package/dist/components/charts/ordinal/FunnelChart.d.ts +5 -0
  191. package/dist/components/charts/ordinal/GaugeChart.d.ts +3 -0
  192. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +6 -0
  193. package/dist/components/charts/ordinal/Histogram.d.ts +3 -0
  194. package/dist/components/charts/ordinal/LikertChart.d.ts +3 -0
  195. package/dist/components/charts/ordinal/PieChart.d.ts +5 -0
  196. package/dist/components/charts/ordinal/RadarChart.capability.d.ts +2 -0
  197. package/dist/components/charts/ordinal/RadarChart.d.ts +77 -0
  198. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +3 -0
  199. package/dist/components/charts/ordinal/StackedBarChart.d.ts +6 -0
  200. package/dist/components/charts/ordinal/SwarmPlot.d.ts +3 -0
  201. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +3 -0
  202. package/dist/components/charts/ordinal/ViolinPlot.d.ts +3 -0
  203. package/dist/components/charts/physics/CollisionSwarmChart.d.ts +1 -1
  204. package/dist/components/charts/physics/EventDropChart.d.ts +3 -1
  205. package/dist/components/charts/physics/GaltonBoardChart.d.ts +4 -2
  206. package/dist/components/charts/physics/GauntletChart.d.ts +1 -5
  207. package/dist/components/charts/physics/ProcessFlowChart.d.ts +6 -0
  208. package/dist/components/charts/physics/UnitPileChart.d.ts +2 -1
  209. package/dist/components/charts/physics/chainReactionTypes.d.ts +3 -0
  210. package/dist/components/charts/physics/collisionSwarmPacking.d.ts +14 -0
  211. package/dist/components/charts/physics/collisionSwarmPhysics.d.ts +1 -0
  212. package/dist/components/charts/physics/eventDropAdmission.d.ts +32 -0
  213. package/dist/components/charts/physics/eventDropPhysics.d.ts +22 -1
  214. package/dist/components/charts/physics/galtonBoardPhysics.d.ts +2 -9
  215. package/dist/components/charts/physics/gauntletPhysics.d.ts +1 -0
  216. package/dist/components/charts/physics/physicsChartReconcile.d.ts +4 -0
  217. package/dist/components/charts/physics/physicsChartUtils.d.ts +1 -1
  218. package/dist/components/charts/physics/physicsGaltonData.d.ts +10 -0
  219. package/dist/components/charts/physics/physicsHocHandle.d.ts +2 -0
  220. package/dist/components/charts/physics/physicsHocUtils.d.ts +7 -1
  221. package/dist/components/charts/physics/physicsPileData.d.ts +11 -0
  222. package/dist/components/charts/physics/physicsPilePhysics.d.ts +5 -12
  223. package/dist/components/charts/physics/physicsProjectionOverlays.d.ts +1 -1
  224. package/dist/components/charts/physics/physicsSourceRows.d.ts +8 -0
  225. package/dist/components/charts/physics/usePhysicsChartData.d.ts +19 -0
  226. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +14 -1
  227. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +25 -7
  228. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +18 -5
  229. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +11 -1
  230. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +11 -1
  231. package/dist/components/charts/realtime/aggregate.d.ts +12 -1
  232. package/dist/components/charts/realtime/realtimeAccessors.d.ts +4 -0
  233. package/dist/components/charts/realtime/realtimeChartRuntime.d.ts +8 -5
  234. package/dist/components/charts/realtime/realtimeChartTypes.d.ts +7 -0
  235. package/dist/components/charts/realtime/realtimeStyleRules.d.ts +4 -0
  236. package/dist/components/charts/realtime/temporalHistogramConfig.d.ts +17 -11
  237. package/dist/components/charts/shared/GaugeReadout.d.ts +9 -0
  238. package/dist/components/charts/shared/ThresholdAnnotation.d.ts +18 -0
  239. package/dist/components/charts/shared/ThresholdEndCap.d.ts +7 -0
  240. package/dist/components/charts/shared/annotationStatusFilter.d.ts +18 -0
  241. package/dist/components/charts/shared/auditAccessibilityText.d.ts +4 -2
  242. package/dist/components/charts/shared/chartDefinitionPilot.d.ts +5 -4
  243. package/dist/components/charts/shared/chartSpecCore.d.ts +2 -2
  244. package/dist/components/charts/shared/heatmapStyleRules.d.ts +13 -0
  245. package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
  246. package/dist/components/charts/shared/networkUtils.d.ts +14 -0
  247. package/dist/components/charts/shared/numericTickFormatter.d.ts +2 -0
  248. package/dist/components/charts/shared/radialCenterContent.d.ts +10 -0
  249. package/dist/components/charts/shared/selectionUtils.d.ts +3 -1
  250. package/dist/components/charts/shared/tooltipUtils.d.ts +1 -1
  251. package/dist/components/charts/shared/types.d.ts +4 -2
  252. package/dist/components/charts/shared/useChartLegend.d.ts +6 -1
  253. package/dist/components/charts/shared/useLikertAggregation.d.ts +8 -2
  254. package/dist/components/charts/shared/useNetworkChartSetup.d.ts +9 -5
  255. package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +1 -1
  256. package/dist/components/charts/shared/useXYBrush.d.ts +24 -0
  257. package/dist/components/charts/shared/useXYPointStyle.d.ts +2 -0
  258. package/dist/components/charts/xy/BubbleChart.d.ts +7 -0
  259. package/dist/components/charts/xy/CandlestickChart.d.ts +7 -0
  260. package/dist/components/charts/xy/DifferenceChart.d.ts +7 -0
  261. package/dist/components/charts/xy/Heatmap.d.ts +16 -0
  262. package/dist/components/charts/xy/LineChart.d.ts +9 -0
  263. package/dist/components/charts/xy/MinimapChart.d.ts +7 -0
  264. package/dist/components/charts/xy/MultiAxisLineChart.d.ts +7 -0
  265. package/dist/components/charts/xy/Scatterplot.d.ts +7 -0
  266. package/dist/components/charts/xy/ScatterplotMatrix.d.ts +6 -0
  267. package/dist/components/charts/xy/WaterfallChart.capability.d.ts +2 -0
  268. package/dist/components/charts/xy/WaterfallChart.d.ts +76 -0
  269. package/dist/components/charts/xy/differenceMarkStyle.d.ts +28 -0
  270. package/dist/components/charts/xy/multiAxisFields.d.ts +23 -0
  271. package/dist/components/charts/xy/scatterplotMatrixCells.d.ts +50 -0
  272. package/dist/components/evidence/chartEvidenceEnvelope.d.ts +154 -0
  273. package/dist/components/evidence/evidenceEnvelopeInput.d.ts +8 -0
  274. package/dist/components/evidence/evidenceEnvelopeValidation.d.ts +11 -0
  275. package/dist/components/evidence/evidenceGate.d.ts +30 -0
  276. package/dist/components/evidence/renderedSceneHash.d.ts +23 -0
  277. package/dist/components/evidence/stableJsonHash.d.ts +4 -0
  278. package/dist/components/export/chartConfig.d.ts +40 -5
  279. package/dist/components/export/chartConfigArtifact.d.ts +6 -0
  280. package/dist/components/legendLayout.d.ts +18 -0
  281. package/dist/components/legendStyles.d.ts +4 -0
  282. package/dist/components/realtime/BinAccumulator.d.ts +5 -1
  283. package/dist/components/realtime/types.d.ts +16 -7
  284. package/dist/components/recipes/adjacencyFlow.d.ts +12 -0
  285. package/dist/components/recipes/adjacencyFlowAggregation.d.ts +72 -0
  286. package/dist/components/recipes/adjacencyFlowGeometry.d.ts +79 -0
  287. package/dist/components/recipes/firstAvailableTrack.d.ts +17 -0
  288. package/dist/components/recipes/intervals.d.ts +1 -1
  289. package/dist/components/recipes/lineageDag.d.ts +17 -0
  290. package/dist/components/recipes/lineageDagHulls.d.ts +22 -0
  291. package/dist/components/recipes/transitDiagram.d.ts +75 -0
  292. package/dist/components/recipes/transitDiagramGeometry.d.ts +47 -0
  293. package/dist/components/semiotic-access.d.ts +9 -0
  294. package/dist/components/semiotic-ai-audits.d.ts +17 -0
  295. package/dist/components/semiotic-ai-core.d.ts +38 -18
  296. package/dist/components/semiotic-ai.d.ts +20 -20
  297. package/dist/components/semiotic-artifact-react.d.ts +10 -0
  298. package/dist/components/semiotic-artifact.d.ts +23 -0
  299. package/dist/components/semiotic-evidence.d.ts +10 -0
  300. package/dist/components/semiotic-experimental.d.ts +1 -1
  301. package/dist/components/semiotic-line.d.ts +9 -0
  302. package/dist/components/semiotic-network.d.ts +3 -0
  303. package/dist/components/semiotic-ordinal.d.ts +2 -0
  304. package/dist/components/semiotic-physics.d.ts +4 -4
  305. package/dist/components/semiotic-realtime-core.d.ts +3 -2
  306. package/dist/components/semiotic-recipes-core.d.ts +6 -0
  307. package/dist/components/semiotic-text.d.ts +2 -0
  308. package/dist/components/semiotic-themes-core.d.ts +3 -0
  309. package/dist/components/semiotic-utils-core.d.ts +19 -14
  310. package/dist/components/semiotic-xy.d.ts +3 -0
  311. package/dist/components/semiotic.d.ts +11 -5
  312. package/dist/components/server/renderDashboard.d.ts +37 -0
  313. package/dist/components/server/renderEvidence.d.ts +39 -0
  314. package/dist/components/server/renderToStaticSVG.d.ts +5 -30
  315. package/dist/components/server/serverChartConfigShared.d.ts +13 -0
  316. package/dist/components/server/serverChartConfigs.d.ts +9 -0
  317. package/dist/components/server/serverChartConfigsComposite.d.ts +4 -0
  318. package/dist/components/server/serverChartConfigsCustom.d.ts +2 -0
  319. package/dist/components/server/serverChartConfigsGeo.d.ts +1 -0
  320. package/dist/components/server/serverChartConfigsOrdinal.d.ts +3 -2
  321. package/dist/components/server/serverChartConfigsXY.d.ts +1 -0
  322. package/dist/components/server/serverChartConfigsXYExtra.d.ts +3 -0
  323. package/dist/components/server/serverCompositeChainReaction.d.ts +3 -0
  324. package/dist/components/server/serverOrdinalGauge.d.ts +3 -0
  325. package/dist/components/server/serverOrdinalLikert.d.ts +2 -0
  326. package/dist/components/server/staticSVGChrome.d.ts +1 -4
  327. package/dist/components/server/staticXYAxisTicks.d.ts +2 -38
  328. package/dist/components/server/staticXYGrid.d.ts +1 -1
  329. package/dist/components/server/svgSizing.d.ts +6 -0
  330. package/dist/components/shared/svgRoot.d.ts +17 -0
  331. package/dist/components/store/selectionProvenance.d.ts +14 -0
  332. package/dist/components/store/themeCore.d.ts +5 -1
  333. package/dist/components/stream/GeoPipelineStore.d.ts +1 -1
  334. package/dist/components/stream/GeoSVGOverlay.d.ts +4 -0
  335. package/dist/components/stream/MarginalGraphics.d.ts +3 -3
  336. package/dist/components/stream/MarginalGraphicsLazy.d.ts +22 -0
  337. package/dist/components/stream/NetworkPipelineStore.d.ts +2 -0
  338. package/dist/components/stream/NetworkSVGOverlay.d.ts +4 -0
  339. package/dist/components/stream/OrdinalPipelineStore.d.ts +1 -1
  340. package/dist/components/stream/OrdinalSVGOverlay.d.ts +4 -0
  341. package/dist/components/stream/PipelineStore.d.ts +1 -1
  342. package/dist/components/stream/SVGOverlay.d.ts +4 -0
  343. package/dist/components/stream/SceneToSVG.d.ts +4 -19
  344. package/dist/components/stream/SceneToSVGXY.d.ts +13 -0
  345. package/dist/components/stream/StreamGeoFrame.d.ts +1 -2
  346. package/dist/components/stream/StreamOrdinalFrame.d.ts +1 -2
  347. package/dist/components/stream/XYGrid.d.ts +11 -0
  348. package/dist/components/stream/axisTickUtils.d.ts +0 -1
  349. package/dist/components/stream/canvasSetup.d.ts +8 -2
  350. package/dist/components/stream/customLayoutAttempt.d.ts +21 -0
  351. package/dist/components/stream/geoTypes.d.ts +1 -1
  352. package/dist/components/stream/hitTestUtils.d.ts +2 -0
  353. package/dist/components/stream/isServerEnvironment.d.ts +6 -0
  354. package/dist/components/stream/layouts/forceLayoutNodeSize.d.ts +12 -0
  355. package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +2 -9
  356. package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +2 -21
  357. package/dist/components/stream/layouts/forceLayoutWorkerPolicy.d.ts +21 -0
  358. package/dist/components/stream/layouts/index.d.ts +6 -12
  359. package/dist/components/stream/layouts/missingPlugin.d.ts +7 -0
  360. package/dist/components/stream/layouts/registerBuiltIn.d.ts +1 -0
  361. package/dist/components/stream/layouts/registry.d.ts +12 -0
  362. package/dist/components/stream/marginalConfig.d.ts +3 -0
  363. package/dist/components/stream/networkCustomLayout.d.ts +7 -0
  364. package/dist/components/stream/networkCustomLayoutOutput.d.ts +13 -0
  365. package/dist/components/stream/networkCustomLayoutRunner.d.ts +1 -1
  366. package/dist/components/stream/networkTypes.d.ts +5 -1
  367. package/dist/components/stream/ordinalTypes.d.ts +1 -1
  368. package/dist/components/stream/overlayAccessibleText.d.ts +18 -0
  369. package/dist/components/stream/physics/PhysicsControllers.d.ts +1 -1
  370. package/dist/components/stream/physics/PhysicsKernel.d.ts +9 -0
  371. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +5 -4
  372. package/dist/components/stream/physics/PhysicsPipelineTypes.d.ts +9 -0
  373. package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +4 -1
  374. package/dist/components/stream/physics/physicsCanvasCoordinates.d.ts +5 -0
  375. package/dist/components/stream/physics/physicsFixedPosition.d.ts +16 -0
  376. package/dist/components/stream/physics/physicsKernelCloning.d.ts +6 -0
  377. package/dist/components/stream/physics/physicsPipelineObservations.d.ts +2 -0
  378. package/dist/components/stream/physics/physicsPipelineSettle.d.ts +15 -9
  379. package/dist/components/stream/physics/physicsRegionRuntime.d.ts +8 -17
  380. package/dist/components/stream/physics/physicsSemanticUI.d.ts +9 -0
  381. package/dist/components/stream/pipelineConfig.d.ts +4 -0
  382. package/dist/components/stream/pipelineDomainResolution.d.ts +6 -0
  383. package/dist/components/stream/pipelineStoreUpdateResults.d.ts +1 -1
  384. package/dist/components/stream/renderers/pointCanvasRenderer.d.ts +4 -0
  385. package/dist/components/stream/renderers/resolveCSSColor.d.ts +4 -4
  386. package/dist/components/stream/resolveXYAxes.d.ts +13 -0
  387. package/dist/components/stream/sceneToSVGShared.d.ts +2 -1
  388. package/dist/components/stream/seriesGeometry.d.ts +13 -0
  389. package/dist/components/stream/streamEncodingTypes.d.ts +53 -0
  390. package/dist/components/stream/types.d.ts +12 -54
  391. package/dist/components/stream/useEnsureCustomXYRenderers.d.ts +18 -0
  392. package/dist/components/stream/useGeoFrameHandle.d.ts +16 -0
  393. package/dist/components/stream/useMarginalValues.d.ts +13 -0
  394. package/dist/components/stream/useOrdinalFrameHandle.d.ts +15 -0
  395. package/dist/components/stream/useXYFrameHandle.d.ts +15 -0
  396. package/dist/components/stream/xyAxisTicks.d.ts +25 -0
  397. package/dist/components/stream/xyCanvasRenderers.d.ts +4 -4
  398. package/dist/components/stream/xyDateTicks.d.ts +3 -2
  399. package/dist/components/stream/xyFrameAxisTypes.d.ts +2 -0
  400. package/dist/components/stream/xyPlugins/areaPlugin.d.ts +2 -0
  401. package/dist/components/stream/xyPlugins/barPlugin.d.ts +2 -0
  402. package/dist/components/stream/xyPlugins/candlestickPlugin.d.ts +2 -0
  403. package/dist/components/stream/xyPlugins/customPlugin.d.ts +6 -0
  404. package/dist/components/stream/xyPlugins/heatmapPlugin.d.ts +2 -0
  405. package/dist/components/stream/xyPlugins/lineFamily.d.ts +5 -0
  406. package/dist/components/stream/xyPlugins/linePlugin.d.ts +2 -0
  407. package/dist/components/stream/xyPlugins/missingPlugin.d.ts +7 -0
  408. package/dist/components/stream/xyPlugins/mixedPlugin.d.ts +2 -0
  409. package/dist/components/stream/xyPlugins/pointPlugin.d.ts +3 -0
  410. package/dist/components/stream/xyPlugins/registerBuiltIn.d.ts +1 -0
  411. package/dist/components/stream/xyPlugins/registry.d.ts +31 -0
  412. package/dist/components/stream/xyPlugins/stackedAreaPlugin.d.ts +2 -0
  413. package/dist/components/stream/xyPlugins/swarmPlugin.d.ts +2 -0
  414. package/dist/components/stream/xyPlugins/waterfallPlugin.d.ts +2 -0
  415. package/dist/components/stream/xySceneBuilders/ribbonScene.d.ts +1 -1
  416. package/dist/components/stream/xySceneBuilders/types.d.ts +1 -0
  417. package/dist/components/text/annotationTextLayout.d.ts +28 -0
  418. package/dist/components/text/pretextAnnotationLayout.d.ts +29 -0
  419. package/dist/components/text/usePretextAnnotations.d.ts +12 -0
  420. package/dist/controls.module.min.js +1 -1
  421. package/dist/forceLayoutWorker.js +1 -1
  422. package/dist/geo.min.js +1 -1
  423. package/dist/geo.module.min.js +1 -1
  424. package/dist/network.module.min.js +1 -1
  425. package/dist/ordinal.module.min.js +1 -1
  426. package/dist/physics-matter.min.js +1 -1
  427. package/dist/physics-matter.module.min.js +1 -1
  428. package/dist/physics-rapier.min.js +1 -1
  429. package/dist/physics-rapier.module.min.js +1 -1
  430. package/dist/physics.module.min.js +1 -1
  431. package/dist/physicsWorker.js +1 -1
  432. package/dist/processSankeyLayoutWorker.js +1 -1
  433. package/dist/rough.min.js +1 -1
  434. package/dist/rough.module.min.js +1 -1
  435. package/dist/semiotic-access.d.ts +9 -0
  436. package/dist/semiotic-access.min.js +2 -0
  437. package/dist/semiotic-access.module.min.js +2 -0
  438. package/dist/semiotic-ai-artifact-policy-constants.module.min.js +2 -0
  439. package/dist/semiotic-ai-core.d.ts +38 -18
  440. package/dist/semiotic-ai-core.min.js +1 -1
  441. package/dist/semiotic-ai-core.module.min.js +1 -1
  442. package/dist/semiotic-ai-hash-primitives.module.min.js +2 -0
  443. package/dist/semiotic-ai.d.ts +20 -20
  444. package/dist/semiotic-ai.module.min.js +1 -1
  445. package/dist/semiotic-artifact-react.d.ts +10 -0
  446. package/dist/semiotic-artifact-react.min.js +2 -0
  447. package/dist/semiotic-artifact-react.module.min.js +2 -0
  448. package/dist/semiotic-artifact.d.ts +23 -0
  449. package/dist/semiotic-artifact.min.js +1 -0
  450. package/dist/semiotic-artifact.module.min.js +1 -0
  451. package/dist/semiotic-client-cjs-shared.min.js +1 -1
  452. package/dist/semiotic-client-glyph.module.min.js +1 -1
  453. package/dist/semiotic-client-responsive.module.min.js +1 -1
  454. package/dist/semiotic-client-shared.module.min.js +1 -1
  455. package/dist/semiotic-custom-layout-selection-cjs-shared.min.js +1 -1
  456. package/dist/semiotic-data.min.js +1 -1
  457. package/dist/semiotic-data.module.min.js +1 -1
  458. package/dist/semiotic-evidence.d.ts +10 -0
  459. package/dist/semiotic-evidence.min.js +1 -0
  460. package/dist/semiotic-evidence.module.min.js +1 -0
  461. package/dist/semiotic-experimental-auxiliary.module.min.js +1 -1
  462. package/dist/semiotic-experimental-node-auxiliary.module.min.js +1 -1
  463. package/dist/semiotic-experimental-react-shared.module.min.js +1 -1
  464. package/dist/semiotic-experimental-vacp.min.js +1 -1
  465. package/dist/semiotic-experimental-vacp.module.min.js +1 -1
  466. package/dist/semiotic-experimental.d.ts +1 -1
  467. package/dist/semiotic-line.d.ts +9 -0
  468. package/dist/semiotic-line.min.js +2 -0
  469. package/dist/semiotic-line.module.min.js +2 -0
  470. package/dist/semiotic-network.d.ts +3 -0
  471. package/dist/semiotic-ordinal.d.ts +2 -0
  472. package/dist/semiotic-physics.d.ts +4 -4
  473. package/dist/semiotic-realtime-core.d.ts +3 -2
  474. package/dist/semiotic-realtime-core.module.min.js +1 -1
  475. package/dist/semiotic-realtime-react.module.min.js +1 -1
  476. package/dist/semiotic-recipes-core-cjs-base.min.js +1 -1
  477. package/dist/semiotic-recipes-core.d.ts +6 -0
  478. package/dist/semiotic-recipes-core.module.min.js +1 -1
  479. package/dist/semiotic-recipes-geo-cjs.min.js +1 -1
  480. package/dist/semiotic-recipes-react.min.js +1 -1
  481. package/dist/semiotic-server-edge-node.module.min.js +1 -1
  482. package/dist/semiotic-server-edge.min.js +1 -1
  483. package/dist/semiotic-server-edge.module.min.js +1 -1
  484. package/dist/semiotic-server-node.min.js +1 -1
  485. package/dist/semiotic-server-node.module.min.js +1 -1
  486. package/dist/semiotic-text.d.ts +2 -0
  487. package/dist/semiotic-text.min.js +2 -0
  488. package/dist/semiotic-text.module.min.js +2 -0
  489. package/dist/semiotic-themes-core.d.ts +3 -0
  490. package/dist/semiotic-themes-core.min.js +1 -1
  491. package/dist/semiotic-themes-core.module.min.js +1 -1
  492. package/dist/semiotic-themes.min.js +1 -1
  493. package/dist/semiotic-themes.module.min.js +1 -1
  494. package/dist/semiotic-utils-core.d.ts +19 -14
  495. package/dist/semiotic-utils-core.min.js +1 -1
  496. package/dist/semiotic-utils-core.module.min.js +1 -1
  497. package/dist/semiotic-value.module.min.js +1 -1
  498. package/dist/semiotic-xy.d.ts +3 -0
  499. package/dist/semiotic.d.ts +11 -5
  500. package/dist/semiotic.module.min.js +1 -1
  501. package/dist/server.min.js +1 -1
  502. package/dist/server.module.min.js +1 -1
  503. package/dist/xy.module.min.js +1 -1
  504. package/package.json +91 -71
  505. package/spec/README.md +8 -3
  506. package/spec/v0.1/artifact-contract.schema.json +2299 -0
  507. package/spec/v0.1/examples/artifact-contract-full.json +369 -0
  508. package/spec/v0.1/examples/artifact-contract-unknown-state.json +46 -0
  509. package/dist/c-3BLJEQNG.min.js +0 -1
  510. package/dist/c-3KZD6AXJ.min.js +0 -1
  511. package/dist/c-4TWEX5HG.min.js +0 -1
  512. package/dist/c-52TEGIUJ.min.js +0 -1
  513. package/dist/c-5YCIX3VZ.min.js +0 -1
  514. package/dist/c-6FEKTA3U.min.js +0 -1
  515. package/dist/c-6O5EVOPH.min.js +0 -1
  516. package/dist/c-74HEEZGK.min.js +0 -1
  517. package/dist/c-AKAF6JAD.min.js +0 -1
  518. package/dist/c-BBKITSXB.min.js +0 -1
  519. package/dist/c-BWNB6USU.min.js +0 -1
  520. package/dist/c-C25ENHIK.min.js +0 -1
  521. package/dist/c-CDR5AO3R.min.js +0 -1
  522. package/dist/c-COHXCW3Q.min.js +0 -1
  523. package/dist/c-DADXPJXV.min.js +0 -1
  524. package/dist/c-E3JFRRMI.min.js +0 -1
  525. package/dist/c-EBFPQHHO.min.js +0 -1
  526. package/dist/c-G36WS6LN.min.js +0 -1
  527. package/dist/c-GGISSW5E.min.js +0 -1
  528. package/dist/c-GIKRQI4X.min.js +0 -1
  529. package/dist/c-GPYOFETM.min.js +0 -1
  530. package/dist/c-IDUHYYSI.min.js +0 -1
  531. package/dist/c-IUHFPMHD.min.js +0 -1
  532. package/dist/c-J5G56TUH.min.js +0 -1
  533. package/dist/c-JAZ73J32.min.js +0 -1
  534. package/dist/c-KG3NXHAL.min.js +0 -1
  535. package/dist/c-KII3PLZE.min.js +0 -1
  536. package/dist/c-LIXGXMNS.min.js +0 -1
  537. package/dist/c-LVEY6D6B.min.js +0 -1
  538. package/dist/c-M4Y3BHFR.min.js +0 -1
  539. package/dist/c-MAIICR2Z.min.js +0 -1
  540. package/dist/c-MG5DM6VE.min.js +0 -1
  541. package/dist/c-MNF2S4AA.min.js +0 -1
  542. package/dist/c-MT3WBK7M.min.js +0 -1
  543. package/dist/c-NY3JWV2K.min.js +0 -1
  544. package/dist/c-O6U6K4CW.min.js +0 -1
  545. package/dist/c-OQ7M4AGV.min.js +0 -1
  546. package/dist/c-OXYMVK7Q.min.js +0 -1
  547. package/dist/c-PPWDL5ZI.min.js +0 -1
  548. package/dist/c-QHF5YON3.min.js +0 -1
  549. package/dist/c-RR3GO5SW.min.js +0 -1
  550. package/dist/c-RSVIHIQ4.min.js +0 -1
  551. package/dist/c-S2BXNNJN.min.js +0 -1
  552. package/dist/c-S6U5CGT5.min.js +0 -1
  553. package/dist/c-SLGMUBUL.min.js +0 -1
  554. package/dist/c-SUILCHWU.min.js +0 -1
  555. package/dist/c-TZW3JGJ5.min.js +0 -1
  556. package/dist/c-US5ZFT6E.min.js +0 -1
  557. package/dist/c-USFMFKIH.min.js +0 -1
  558. package/dist/c-UUKVD4WB.min.js +0 -1
  559. package/dist/c-VGW3VG3I.min.js +0 -1
  560. package/dist/c-W3CE4A4S.min.js +0 -1
  561. package/dist/c-WJCD5EUY.min.js +0 -1
  562. package/dist/c-X5UBGU2V.min.js +0 -1
  563. package/dist/c-YDAY2WFR.min.js +0 -1
  564. package/dist/c-ZOWWU34K.min.js +0 -1
  565. /package/dist/{c-N4G2L7ID.min.js → c-HYW2XA4Q.min.js} +0 -0
  566. /package/dist/{c-OCI56QF2.min.js → c-V4XMSLC3.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
+ function e(e){return"default"in e?e.default:e}async function t(t){let i=Be.get(t);if(i)return i;let{topology:o,objectName:r}=await async function(t){try{switch(t){case"world-110m":return{topology:e(await(import("world-atlas/countries-110m.json"))),objectName:"countries"};case"world-50m":return{topology:e(await(import("world-atlas/countries-50m.json"))),objectName:"countries"};case"land-110m":return{topology:e(await(import("world-atlas/land-110m.json"))),objectName:"land"};case"land-50m":return{topology:e(await(import("world-atlas/land-50m.json"))),objectName:"land"};default:throw Error(`Unknown reference geography: "${t}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}}catch(e){throw/Cannot find module|Failed to resolve|world-atlas/i.test(e instanceof Error?e.message:e+"")?Error(`resolveReferenceGeography("${t}"): Install the optional peer dependency \`world-atlas\` (\`npm install world-atlas\`) to use built-in reference geographies, or pass GeoJSON Feature[] to \`areas\`.`,{cause:e}):e}}(t);if(!o||!o.objects)throw Error(`resolveReferenceGeography("${t}"): Failed to load topology. Got ${typeof o} with keys: ${o?Object.keys(o).join(", "):"none"}`);let n=Te(o,o.objects[r]),a="features"in n?n.features:[n];return Be.set(t,a),a}function i(e){let i=De(()=>Array.isArray(e)?e:void 0,[e]),[o,r]=We(null);return Oe(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(i=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(i)){let i=!1;return r(null),t(e).then(e=>{i||r(e)}),()=>{i=!0}}var i;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),r(null)}else r(null)},[e]),void 0!==i?i:o}function o(e){return e.properties&&"object"==typeof e.properties?{...e.properties,...e}:e}function r(e){let t=fe(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}),r=ve(),{areas:n,valueAccessor:a,styleRules:l,colorScheme:s,projection:c="equalEarth",graticule:u,fitPadding:d,zoomable:m,zoomExtent:h,onZoom:p,dragRotate:f,tileURL:g,tileAttribution:y,tileCacheSize:b,tooltip:v,areaOpacity:x=1,annotations:k,legendInteraction:w,legendPosition:S,margin:M,className:A,selection:C,linkedHover:N,onObservation:R,onClick:j,chartId:F,loading:P,loadingContent:L,emptyContent:H,frameProps:I={},stroke:z,strokeWidth:W,opacity:O}=e,D=m??!!g,T=i(n),E=Ie(()=>T&&ee(T),[T]),G=Ie(()=>"function"==typeof a?a:e=>e?.properties?.[a]??e?.[a],[a]),Z=s??r??"blues",q=Ie(()=>{if(!E)return ze(Me(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(let i of E){let o=G(i);null==o||!isFinite(o)||(e>o&&(e=o),o>t&&(t=o))}let i=Me(Z);return ze(i).domain([Number.isFinite(e)?e:0,Number.isFinite(t)?t:1])},[E,G,Z]),J=Ie(()=>{let e=q.domain();return[e[0]??0,e[1]??1]},[q]),V=ye(w,G,J),{activeSelectionHook:Y,hoverSelectionHook:te,customHoverBehavior:ie,customClickBehavior:oe}=ge({selection:C,linkedHover:N,onObservation:R,onClick:j,chartType:"ChoroplethMap",chartId:F,mobileInteraction:t.mobileInteraction}),re=U(C),ne=te||V.legendSelectionHook||Y,ue=Ie(()=>{let e=X(e=>{let t=G(e);return{fill:null!=t&&isFinite(t)?q(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:x}},l,e=>({value:G(e)}),e=>e&&"object"==typeof e&&e.properties?{...e.properties,...e}:e),t=K(e,{stroke:z,strokeWidth:W,opacity:O});return ne?ke(t,ne,re,o):t},[G,q,ne,re,x,z,W,O,l]),de=Ie(()=>e=>{let t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||"Feature",i=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:t}),null!=i&&Ee("div",{style:{opacity:.7},children:(o=i,"number"==typeof o&&isFinite(o)?Number.isInteger(o)?o.toLocaleString():o.toLocaleString(void 0,{maximumFractionDigits:2}):(o??"")+"")})]});var o},[G]),me=ce(t),he=Ie(()=>!1===t.showLegend?void 0:{gradient:{colorFn:e=>q(e),domain:J,label:"string"==typeof a?a:"value"}},[q,t.showLegend,a,J]),{legend:be,margin:xe,legendPosition:we,legendMarginReserved:Se}=pe({data:[],colorBy:void 0,colorScale:void 0,showLegend:!1,legendPosition:S,userMargin:M,defaults:me,additionalLegend:he,chartWidth:t.width,chartHeight:t.height,legendLayout:I.legendLayout,frameLegend:I,hasTitle:!!t.title,axisChrome:{hasAxis:!1}}),Ae=se(P,t.width,t.height,L)||(E?null:se(!0,t.width,t.height,L)),Ce=Ae?null:le(E,t.width,t.height,H);if(Array.isArray(E)&&E.length>0){let e=E[0];if(!e||"object"!=typeof e||!e.geometry)return Ee(_,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:t.width,height:t.height})}let Ne={projection:c,areas:E,areaStyle:ue,size:[t.width,t.height],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:xe,enableHover:t.enableHover,...be&&{legend:be,legendPosition:we},...Se&&{__legendMarginReservedFor:be},legendHoverBehavior:V.onLegendHover,legendClickBehavior:V.onLegendClick,legendHighlightedCategory:V.highlightedCategory,legendIsolatedCategories:"isolate"===w?V.isolatedCategories:void 0,tooltipContent:!1===v?()=>null:!0===v?de:ae(v)||de,...null!=u&&{graticule:u},...null!=d&&{fitPadding:d},...D&&{zoomable:!0},...h&&{zoomExtent:h},...p&&{onZoom:p},...null!=f&&{dragRotate:f},...g&&{tileURL:g},...y&&{tileAttribution:y},...b&&{tileCacheSize:b},...$({linkedHover:N,selection:C,onObservation:R,onClick:j,mobileInteraction:t.mobileInteraction,customHoverBehavior:ie,customClickBehavior:oe,linkedHoverInClickPredicate:!1}),...k&&k.length>0&&{annotations:k},...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},...A&&{className:A},...null!=e.animate&&{animate:e.animate},...I};return Ae||Ce||Ee(Q,{componentName:"ChoroplethMap",width:t.width,height:t.height,children:Ee(B,{...Ne})})}function n(e,t,i){let[o,r]=i;if(!t)return o;let[n,a]=t,l=a>n?a-n:0,s=Number(e),c=Number.isFinite(s)?s:n;return o+Math.max(0,Math.min(1,l>0?(c-n)/l:0))*(r-o)}function a({bottomMargin:e,costLabel:t,layout:{cx:i,cy:o,maxCost:r,availableRadius:n,layout:a},ringStyle:l,ringValues:s,showNorth:c,showRingLabels:u,showRings:d}){let 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 pt("g",m?{children:[ht("line",{x1:i,y1:o,x2:i+n,y2:o,stroke:h.stroke,strokeWidth:h.strokeWidth,strokeLinecap:"round",opacity:.85}),ht("line",{x1:i,y1:o-3.5,x2:i,y2:o+3.5,stroke:h.stroke,strokeWidth:h.strokeWidth,opacity:.9}),d&&s.map(a=>{let l=i+(r>0?a/r*n:0);return pt("g",{children:[ht("line",{x1:l,y1:o-2.5,x2:l,y2:o+2.5,stroke:h.stroke,strokeWidth:.9,opacity:.65}),u&&pt("text",{x:l,y:o+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=>{let a=e/r*n;return pt("g",{children:[ht("circle",{cx:i,cy:o,r:a,fill:"none",stroke:h.stroke,strokeWidth:h.strokeWidth,strokeDasharray:h.strokeDasharray,opacity:.5}),u&&pt("text",{x:i+a+3,y:o-2,fontSize:h.labelSize,fill:h.labelColor,fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",children:[e,t?" "+t:""]})]},e)}),c&&pt("g",{transform:"translate(24, 24)",children:[ht("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),ht("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),ht("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",children:"N"}),ht("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),ht("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),ht("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]})]})}function l(e){if(Number.isFinite(e))return Math.max(1,Math.round(e))}function s(e,t,i){return Math.max(t,Math.min(i,e))}function c(e){let t=1/0,i=-1/0;for(let o of e)Number.isFinite(o)&&(t>o&&(t=o),o>i&&(i=o));return t===1/0?[0,0]:[t,i]}function u(e,t){let i=t[1]-t[0];return 0===i?.5:(e-t[0])/i}function d(e,t={}){let i=e.map((e,t)=>({...e,index:t})).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y));if(0===i.length)return[];let o=s(Number.isFinite(t.occupancy)?Number(t.occupancy):.72,.2,1),r=Number.isFinite(t.aspectRatio)&&Number(t.aspectRatio)>0?Number(t.aspectRatio):1.8,n=l(t.columns)??Math.max(1,Math.ceil(Math.sqrt(i.length*r/o))),a=l(t.rows)??Math.max(1,Math.ceil(i.length/(n*o)));i.length>n*a&&(null!=t.columns&&null==t.rows?a=Math.ceil(i.length/n):null!=t.rows&&null==t.columns?n=Math.ceil(i.length/a):a=Math.ceil(i.length/n));let d=c(i.map(e=>e.x)),m=c(i.map(e=>e.y)),h=i.map(e=>({...e,desiredColumn:u(e.x,d)*Math.max(0,n-1),desiredRow:u(e.y,m)*Math.max(0,a-1)})),p=(n-1)/2,f=(a-1)/2;h.sort((e,t)=>(t.desiredColumn-p)**2+(t.desiredRow-f)**2-((e.desiredColumn-p)**2+(e.desiredRow-f)**2)||e.desiredRow-t.desiredRow||e.desiredColumn-t.desiredColumn||e.index-t.index);let g=new Set;for(let e=0;a>e;e+=1)for(let t=0;n>t;t+=1)g.add(e*n+t);let y=[];for(let e of h){let t=-1,i=1/0;for(let o of g){let r=(o%n-e.desiredColumn)**2+(Math.floor(o/n)-e.desiredRow)**2;(i>r||r===i&&t>o)&&(t=o,i=r)}0>t||(g.delete(t),y.push({datum:e.datum,x:e.x,y:e.y,row:Math.floor(t/n),column:t%n,index:e.index}))}return y.sort((e,t)=>e.index-t.index),y.map(({index:e,...t})=>t)}function m(e,t,i=[]){if("function"==typeof t)return t(e);if("string"==typeof t)return e[t];for(let t of i)if(null!=e[t])return e[t]}function h(e){return e.map(([e,t],i)=>`${0===i?"M":"L"}${e},${t}`).join("")+"Z"}function p(e,t,i){let o=[];for(let r=0;6>r;r+=1){let n=-Math.PI/2+r*(Math.PI/3);o.push([e+Math.cos(n)*i,t+Math.sin(n)*i])}return h(o)}function f({marks:e,color:t,fontSize:i,fontFamily:o,fontWeight:r}){let n=Z();return vt("g",{"aria-hidden":"true",pointerEvents:"none",children:e.map(e=>{let a=!n.isActive||n.predicate(e.datum);return vt("text",{x:e.x,y:e.y,fill:t,fontFamily:o,fontSize:i,fontWeight:r,opacity:a?1:.18,textAnchor:"middle",dominantBaseline:"central",children:e.label},e.id)})})}function g(e,t,i){return Math.max(t,Math.min(i,e))}function y(e){if(Number.isFinite(e)&&Number(e)>0)return Number(e)}function b(e,t){return"function"==typeof t?t(e,e.dotIndex):"string"==typeof t?e[t]:void 0}function v(e){return e.properties&&"object"==typeof e.properties?{...e.properties}:{}}function x(e,t){let i=v(e);return(e.id??i.id??i.name??"feature-"+t)+""}function k(e,t,i,o){return[Math.ceil((e-i)/o-.5),Math.floor((t-i)/o-.5)]}function w(e){if(!e)return 0;let t=Ct.get(e);if(t)return t;let i=Nt;return Nt+=1,Ct.set(e,i),i}function S(e,t){return!t||!(t[0][1]>e[1]||e[1]>t[1][1]||(i=e[0],o=t[0][0],r=t[1][0],o>r?o>i&&i>r:o>i||i>r));var i,o,r}function M(e,t){for(let i of e){let{feature:e,index:o}=i;if(e.geometry&&S(t,i.bounds))try{if(wt(e,t))return{feature:e,index:o}}catch{}}return null}function A(e,t,i,o={}){let r=e.filter((e,t)=>e.geometry&&(!o.featureFilter||o.featureFilter(e,t))),n=function(e,t){if(0===e.length)return null;let i=t.bounds({type:"FeatureCollection",features:e});return Number.isFinite(i[0][0])&&Number.isFinite(i[0][1])&&Number.isFinite(i[1][0])&&Number.isFinite(i[1][1])?i:null}(r,t.geoPath);if(!n)return{dots:[],cellSize:10,features:r};let a=Math.max(0,o.layoutPadding??0),l=[[g(n[0][0],a,Math.max(a,i.width-a)),g(n[0][1],a,Math.max(a,i.height-a))],[g(n[1][0],a,Math.max(a,i.width-a)),g(n[1][1],a,Math.max(a,i.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:r};let u=y(o.columns),d=Math.max(2,u?s/u:y(o.cellSize)??10),m=Math.max(100,Math.round(y(o.maxSamples)??25e3)),h=Math.ceil(s/d)*Math.ceil(c/d);h>m&&(d*=Math.sqrt(h/m));let p=o.gridOrigin?.[0]??0,f=o.gridOrigin?.[1]??0,[b,w]=k(l[0][0],l[1][0],p,d),[S,A]=k(l[0][1],l[1][1],f,d),C=[],N=function(e){return e.map((e,t)=>{if(At.has(e))return{feature:e,index:t,bounds:At.get(e)??null};try{let i=kt(e);return At.set(e,i),{feature:e,index:t,bounds:i}}catch{return At.set(e,null),{feature:e,index:t,bounds:null}}})}(r);for(let e=S;A>=e;e+=1){let i=f+(e+.5)*d;for(let r=b;w>=r;r+=1){let n=t.invertedPoint(p+(r+.5)*d,i);if(!n||!Number.isFinite(n[0])||!Number.isFinite(n[1]))continue;let a=M(N,n);if(!a)continue;let l={...v(a.feature),featureId:x(a.feature,a.index),featureIndex:a.index,gridRow:e,gridColumn:r,longitude:n[0],latitude:n[1],dotIndex:C.length};o.dotFilter&&!o.dotFilter(l,C.length)||C.push(l)}}return{dots:C,cellSize:d,features:r}}function C(e){return Math.round(1e4*e)/1e4}function N(e){return Array.isArray(e)&&e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1])?`${C(Number(e[0]))},${C(Number(e[1]))}`:"null"}function R(e,t){let i=e[t];return"function"==typeof i?i.call(e):void 0}function j(e){return"number"==typeof e&&Number.isFinite(e)?C(e)+"":null===e?"null":"unavailable"}function F(e){let t=e.scales.projection;return[j(R(t,"scale")),N(R(t,"translate")),N(R(t,"center")),(i=R(t,"rotate"),Array.isArray(i)&&i.every(Number.isFinite)?i.map(e=>C(Number(e))).join(","):"unavailable"),j(R(t,"clipAngle")),j(R(t,"precision")),...[[0,0],[-120,35],[45,45],[120,-30]].map(([t,i])=>N(e.scales.projectedPoint(t,i)))].join("|");var i}function P(e){return e.map(([e,t],i)=>`${0===i?"M":"L"}${e},${t}`).join("")+"Z"}function L(e,t,i){return P([[e-i,t-i],[e+i,t-i],[e+i,t+i],[e-i,t+i]])}function H(e,t,i){return P(Array.from({length:6},(o,r)=>{let n=-Math.PI/2+r*(Math.PI/3);return[e+Math.cos(n)*i,t+Math.sin(n)*i]}))}function I(e,t,i){let{featureKey:o,dataKey:r}=i,n=new Map;for(let e of t){let t=(Object.prototype.hasOwnProperty.call(e,r)?e[r]:void 0)+"";n.set(t,e)}return e.map(e=>{let t=(e=>{let t=o.split("."),i=e;for(let e of t)i=null!==i&&"object"==typeof i&&Object.prototype.hasOwnProperty.call(i,e)?i[e]:void 0;return(i??"")+""})(e),i=n.get(t);return i?{...e,properties:{...e.properties,...i}}:e})}import{DEFAULT_HIT_RADIUS as z,geoAreaHitTarget as W,geoHitTarget as O,hitTargetPoint as D}from"./c-HLLFJYTY.min.js";import{GeoCustomChart as T,StreamGeoFrame_default as B}from"./c-CCTGN5CK.min.js";import"./c-55BAJ333.min.js";import{useChartSetup as E,useFrameImperativeHandle as G,useResolvedSelection as U}from"./c-KCRJGUHP.min.js";import"./c-ORLEBW72.min.js";import"./c-NYZ2QNAM.min.js";import"./c-BNG5ECK5.min.js";import"./c-TKG2NP7G.min.js";import"./c-OO5QLMJC.min.js";import"./c-V4XMSLC3.min.js";import"./c-4FN7Q6VQ.min.js";import{buildCustomBehaviorProps as $,mergeShapeStyle as K}from"./c-ITKX3RC5.min.js";import{useCustomLayoutSelection as Z}from"./c-YDECTEUW.min.js";import"./c-W4ZUKSEQ.min.js";import"./c-EUBTECGM.min.js";import{ChartError as _,EMPTY_ARRAY as q,MultiLineTooltip as J,SafeRender as Q,Tooltip as V,TooltipRoot as Y,composeStyleRules as X,filterSparseArray as ee,makeNodeRuleContext as te,makeRuleValueResolver as ie,markTooltipChrome as oe,matchesThreshold as re,normalizeLinkedHover as ne,normalizeTooltip as ae,renderEmptyState as le,renderLoadingState as se,resolveAxisFreeMarginDefaults as ce,resolveResponsiveRules as ue,resolveStyleRules as de,responsiveRuleMatches as me,ruleMatches as he,useChartLegendAndMargin as pe,useChartMode as fe,useChartSelection as ge,useGradientLegendInteraction as ye,useLinkedHover as be,useThemeSequential as ve,warnMissingField as xe,wrapStyleWithSelection as ke}from"./c-LMGSSD2E.min.js";import{DEFAULT_COLOR as we,getColor as Se,getSequentialInterpolator as Me,getSize as Ae}from"./c-CPV4N35K.min.js";import"./c-ELDWAO2V.min.js";import{useObservationSelector as Ce}from"./c-JUKIWTBJ.min.js";import"./c-T2V7O2LO.min.js";import{getMinMax as Ne}from"./c-QA3HMQJP.min.js";import{glyphExtent as Re,glyphPlacement as je,hatchFillId as Fe,hatchPatternDef as Pe,isHatchFill as Le,resolveSvgFill as He}from"./c-553QUDKA.min.js";import{useMemo as Ie}from"react";import{scaleSequential as ze}from"d3-scale";import{useState as We,useEffect as Oe,useMemo as De}from"react";import{feature as Te}from"topojson-client";var Be=new Map;import{jsx as Ee,jsxs as Ge}from"react/jsx-runtime";r.displayName="ChoroplethMap";import{useMemo as Ue,useRef as $e,forwardRef as Ke}from"react";var Ze={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5};import{jsx as _e,jsxs as qe}from"react/jsx-runtime";var Je=[3,30],Qe=[1,4],Ve=Ke(function(e,t){let o=$e(null);G(t,{variant:"geo-points",frameRef:o});let r=fe(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:a="lon",yAccessor:l="lat",sizeBy:s,sizeRange:c,colorBy:u,styleRules:d,colorScheme:m,projection:h="equalEarth",graticule:p,fitPadding:f,zoomable:g,zoomExtent:y,onZoom:b,dragRotate:v,tileURL:x,tileAttribution:k,tileCacheSize:w,areas:S,areaStyle:M=Ze,tooltip:A,annotations:C,margin:N,className:R,selection:j,linkedHover:F,onObservation:P,onClick:L,chartId:H,loading:I,loadingContent:z,emptyContent:W,legendInteraction:O,legendPosition:D,frameProps:T={},stroke:U,strokeWidth:Z,opacity:_}=e,J=c??("sparkline"===r.mode?Qe:Je),V="sparkline"===r.mode?1.5:6,Y=g??!!x,ee=i(S),ie=E({data:n??q,rawData:n,colorBy:u,colorScheme:m,legendInteraction:O,legendPosition:D,frameLegend:T,selection:j,linkedHover:F,fallbackFields:u?["string"==typeof u?u:""]:[],unwrapData:!1,onObservation:P,onClick:L,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"ProportionalSymbolMap",chartId:H,showLegend:r.showLegend,userMargin:N,marginDefaults:ce(r),loading:I,loadingContent:z,emptyContent:W,width:r.width,height:r.height,hasTitle:!!r.title}),oe=ie.data,re=Ue(()=>{if(!s)return;let e="function"==typeof s?s:e=>e?.[s],t=oe.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?Ne(t):void 0},[oe,s]),ne=Ue(()=>{let e=X(e=>({fill:u?Se(e,u,ie.colorScale):we,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:s?Ae(e,s,J,re):V}),d,te(u,s)),t=K(e,{stroke:U,strokeWidth:Z,opacity:_});return ie.effectiveSelectionHook?ke(t,ie.effectiveSelectionHook,ie.resolvedSelection):t},[u,ie.colorScale,ie.effectiveSelectionHook,ie.resolvedSelection,s,J,re,V,U,Z,_,d]),le=Ue(()=>e=>{let t=e?.name||e?.label||e?.NAME||e?.id,i="string"==typeof s?s:null,o=("function"==typeof s?s:e=>e[s])(e),r=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(e??"")+"",n="string"==typeof u?u:null,a=n?e?.[n]:null;return qe("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t&&_e("div",{style:{fontWeight:600,marginBottom:2},children:t}),i&&null!=o&&qe("div",{children:[qe("span",{style:{opacity:.7},children:[i,": "]}),r(o)]}),n&&null!=a&&qe("div",{children:[qe("span",{style:{opacity:.7},children:[n,": "]}),a+""]}),!t&&!i&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>qe("div",{children:[qe("span",{style:{opacity:.7},children:[e,": "]}),r(t)]},e))]})},[s,u]);if(ie.earlyReturn)return ie.earlyReturn;xe("ProportionalSymbolMap",oe,"xAccessor",a),xe("ProportionalSymbolMap",oe,"yAccessor",l);let se={projection:h,...null!=n&&{points:oe},xAccessor:a,yAccessor:l,pointStyle:ne,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...ee&&{areas:ee,areaStyle:M},...null!=p&&{graticule:p},...null!=f&&{fitPadding:f},...Y&&{zoomable:!0},...y&&{zoomExtent:y},...b&&{onZoom:b},...null!=v&&{dragRotate:v},...x&&{tileURL:x},...k&&{tileAttribution:k},...w&&{tileCacheSize:w},size:[r.width,r.height],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:ie.margin,enableHover:r.enableHover,tooltipContent:!1===A?()=>null:ae(A)||le,...ie.legendBehaviorProps,...$({linkedHover:F,selection:j,onObservation:P,onClick:L,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior,linkedHoverInClickPredicate:!1}),...C&&C.length>0&&{annotations:C},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...r.title&&{title:r.title},...r.description&&{description:r.description},...r.summary&&{summary:r.summary},...void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable},...R&&{className:R},...null!=e.animate&&{animate:e.animate},...T};return _e(Q,{componentName:"ProportionalSymbolMap",width:r.width,height:r.height,children:_e(B,{ref:o,...se})})});Ve.displayName="ProportionalSymbolMap";import{useMemo as Ye,useCallback as Xe,useRef as et,forwardRef as tt}from"react";import{jsx as it,jsxs as ot}from"react/jsx-runtime";var rt="__semiotic_x",nt="__semiotic_y",at=tt(function(e,t){let o=fe(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:r,nodes:a,nodeIdAccessor:l="id",xAccessor:s="lon",yAccessor:c="lat",valueAccessor:u="value",projection:d="equalEarth",graticule:m,fitPadding:h,zoomable:p,zoomExtent:f,onZoom:g,dragRotate:y,tileURL:b,tileAttribution:v,tileCacheSize:x,lineType:k="geo",flowStyle:w="basic",areas:S,areaStyle:M=Ze,edgeColorBy:A,edgeOpacity:C=.6,edgeWidthRange:N=[1,8],pointRadius:R,edgeLinecap:j="round",colorScheme:F,styleRules:P,showParticles:L,particleStyle:H,tooltip:I,annotations:z,margin:W,className:O,selection:D,linkedHover:T,onObservation:U,onClick:Z,chartId:_,loading:J,loadingContent:V,emptyContent:Y,frameProps:te={},legendInteraction:oe,legendPosition:re,stroke:le,strokeWidth:se,opacity:ue,lineIdAccessor:de}=e,me=p??!!b,he=i(S),pe=Ye(()=>ee(a),[a]),ge=E({data:r??q,rawData:r,colorBy:A,colorScheme:F,legendInteraction:oe,legendPosition:re,frameLegend:te,selection:D,linkedHover:T,fallbackFields:A?["string"==typeof A?A:""]:[],unwrapData:!1,onObservation:U,onClick:Z,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"FlowMap",chartId:_,showLegend:o.showLegend,userMargin:W,marginDefaults:ce(o),loading:J,loadingContent:V,emptyContent:Y,width:o.width,height:o.height,hasTitle:!!o.title}),ye=ge.data,ve=ne(T),xe=be({name:ve?.name||"hover",fields:ve?.fields||[]}),Me=Ce(e=>e.pushObservation),Ae=Ye(()=>{let e=new Map;for(let t of pe)e.set(t[l]+"",t);return e},[pe,l]),Re=et(null),je=et(Ae);je.current=Ae;let Fe=et(s);Fe.current=s;let Pe=et(c);Pe.current=c;let Le=Xe(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;let t=je.current,i=t.get(e.source+""),o=t.get(e.target+"");if(!i||!o)return null;let r="function"==typeof Fe.current?Fe.current:e=>e[Fe.current],n="function"==typeof Pe.current?Pe.current:e=>e[Pe.current];return{...e,coordinates:[{[rt]:r(i),[nt]:n(i)},{[rt]:r(o),[nt]:n(o)}]}},[]);G(t,{variant:"geo-lines",frameRef:Re,overrides:{push:e=>{let t=Le(e);t&&Re.current?.pushLine(t)},pushMany:e=>{let t=[];for(let i of e){let e=Le(i);e&&t.push(e)}t.length>0&&Re.current?.pushManyLines(t)}}});let He=Ye(()=>{let e=new Map;for(let t of ye)!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},[ye]),Ie=Xe(e=>{if(T)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){let e=He.get(t[l]+"");e&&xe.onHover(e)}else xe.onHover(t)}else xe.onHover(null);if(U||Me){let t={timestamp:Date.now(),chartType:"FlowMap",chartId:_};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);let o={...t,type:"hover",datum:i||{},x:e.x??0,y:e.y??0};U&&U(o),Me&&Me(o)}else{let e={...t,type:"hover-end"};U&&U(e),Me&&Me(e)}}},[T,xe,l,He,U,_,Me]),ze=ge.customClickBehavior,We=Ye(()=>{let e="function"==typeof s?s:e=>e[s],t="function"==typeof c?c:e=>e[c];return ye.map(i=>{if(!i||"object"!=typeof i||null==i.source||null==i.target)return null;let o=Ae.get(i.source+""),r=Ae.get(i.target+"");return o&&r?{...i,coordinates:[{[rt]:e(o),[nt]:t(o)},{[rt]:e(r),[nt]:t(r)}]}:null}).filter(Boolean)},[ye,Ae,s,c]),Oe=Ye(()=>{let e="function"==typeof s?s:e=>e[s];return t=>null!=t&&"object"==typeof t&&rt in t?t[rt]:e(t)},[s]),De=Ye(()=>{let e="function"==typeof c?c:e=>e[c];return t=>null!=t&&"object"==typeof t&&nt in t?t[nt]:e(t)},[c]),Te=Ye(()=>{let e=ye.filter(e=>e&&"object"==typeof e).map(e=>Number(e[u]??0)).filter(e=>Number.isFinite(e));if(0!==e.length)return Ne(e)},[ye,u]),Be=Ye(()=>function(e){let{valueAccessor:t,valueDomain:i,edgeWidthRange:o,resolveStroke:r,edgeOpacity:a,edgeLinecap:l,styleRules:s}=e,c=ie(t);return X(e=>({stroke:r(e),strokeWidth:n(e[t],i,o),strokeLinecap:l,opacity:a,fillOpacity:0}),s,e=>({value:c(e)}))}({valueAccessor:u,valueDomain:Te,edgeWidthRange:N,resolveStroke:e=>A?Se(e,A,ge.colorScale):we,edgeOpacity:C,edgeLinecap:j,styleRules:P}),[u,Te,N,A,ge.colorScale,C,j,P]),Ee=Ye(()=>{let e=K(Be,{stroke:le,strokeWidth:se,opacity:ue});if(!ge.effectiveSelectionHook)return e;let t={...ge.resolvedSelection?.unselectedStyle||{},fillOpacity:0};return ke(e,ge.effectiveSelectionHook,{...ge.resolvedSelection||{},unselectedStyle:t})},[Be,ge.effectiveSelectionHook,ge.resolvedSelection,le,se,ue]),Ge=R??("sparkline"===o.mode?1.5:5),Ue=Ye(()=>K(()=>({fill:"#333",r:Ge,fillOpacity:.8}),{stroke:le,strokeWidth:se,opacity:ue}),[Ge,le,se,ue]),$e=Ye(()=>e=>{if(e?.geometry||e?.properties||e?.data?.geometry){let t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||e?.data?.properties?.name||e?.data?.properties?.NAME;if(t)return it("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:it("div",{style:{fontWeight:600},children:t})})}if(null!=e?.source&&null!=e?.target){let t=e[u];return ot("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[ot("div",{style:{fontWeight:600},children:[e.source," → ",e.target]}),null!=t&&it("div",{style:{opacity:.7},children:"number"==typeof t?t.toLocaleString():t})]})}let t=e?.name||e?.label||e?.[l];return null!=t?it("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:it("div",{style:{fontWeight:600},children:t})}):null},[u,l]);if(ge.earlyReturn)return ge.earlyReturn;let Ke={projection:d,...null!=r&&{lines:We},points:pe,xAccessor:Oe,yAccessor:De,lineDataAccessor:"coordinates",...null!=de&&{lineIdAccessor:de},lineType:k,flowStyle:w,lineStyle:Ee,pointStyle:Ue,...he&&{areas:he,areaStyle:M},...null!=m&&{graticule:m},...null!=h&&{fitPadding:h},...me&&{zoomable:!0},...f&&{zoomExtent:f},...g&&{onZoom:g},...null!=y&&{dragRotate:y},...L&&{showParticles:L},...H&&{particleStyle:H},...b&&{tileURL:b},...v&&{tileAttribution:v},...x&&{tileCacheSize:x},size:[o.width,o.height],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:ge.margin,enableHover:o.enableHover,tooltipContent:!1===I?()=>null:ae(I)||$e,...ge.legendBehaviorProps,...$({linkedHover:T,selection:D,onObservation:U,onClick:Z,mobileInteraction:ge.mobileInteraction,customHoverBehavior:Ie,customClickBehavior:ze,linkedHoverInClickPredicate:!1}),...z&&z.length>0&&{annotations:z},...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},...O&&{className:O},...null!=e.animate&&{animate:e.animate},...te};return it(Q,{componentName:"FlowMap",width:o.width,height:o.height,children:it(B,{ref:Re,...Ke})})});at.displayName="FlowMap";import{useMemo as lt,useRef as st,useState as ct,useEffect as ut,useCallback as dt,forwardRef as mt}from"react";import{jsx as ht,jsxs as pt}from"react/jsx-runtime";import{Fragment as ft,jsx as gt,jsxs as yt}from"react/jsx-runtime";var bt=mt(function(e,t){let i=fe(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:o,lines:r,xAccessor:n="lon",yAccessor:l="lat",nodeIdAccessor:s="id",center:c,costAccessor:u,strength:d=1,lineMode:m="straight",projection:h="mercator",graticule:p,fitPadding:f,zoomable:g,zoomExtent:y,onZoom:b,dragRotate:v,tileURL:x,tileAttribution:k,tileCacheSize:w,transition:S,colorBy:M,styleRules:A,colorScheme:C,pointRadius:N,tooltip:R,showRings:j,showRingLabels:F,ringStyle:P,showNorth:L,costLabel:H,cartogramLayout:I,annotations:z,margin:W,className:O,selection:D,linkedHover:T,onObservation:U,onClick:Z,chartId:_,loading:q,loadingContent:J,emptyContent:V,legendPosition:Y,frameProps:ie={},stroke:oe,strokeWidth:re,opacity:ne}=e,le="sparkline"===i.mode,se=I??(le?"strip":"radial"),ue=N??(le?1.5:5),de=j??!0,me=F??("strip"!==se&&!i.compactMode),he=L??("strip"!==se&&!le),pe=g??!!x,ge=lt(()=>ee(o),[o]),ye=E({data:ge,rawData:o,colorBy:M,colorScheme:C,legendInteraction:void 0,legendPosition:Y,frameLegend:ie,selection:D,linkedHover:T,fallbackFields:M?["string"==typeof M?M:""]:[],unwrapData:!1,onObservation:U,onClick:Z,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"DistanceCartogram",chartId:_,showLegend:i.showLegend,userMargin:W,marginDefaults:ce(i),loading:q,loadingContent:J,emptyContent:V,width:i.width,height:i.height,hasTitle:!!i.title}),be=lt(()=>{let e=X(e=>{let t=e?.[s],i=null!=t&&t+""==c+"";return{fill:M?Se(e,M,ye.colorScale):we,fillOpacity:i?1:.8,stroke:i?"var(--semiotic-text, #222)":"#fff",strokeWidth:i?1.25:1,r:i?1.35*ue:ue}},A,te(M)),t=K(e,{stroke:oe,strokeWidth:re,opacity:ne});return ye.effectiveSelectionHook?ke(t,ye.effectiveSelectionHook,ye.resolvedSelection):t},[M,ye.colorScale,ye.effectiveSelectionHook,ye.resolvedSelection,ue,oe,re,ne,A,c,s]),ve=lt(()=>({center:c,centerAccessor:s,costAccessor:u,strength:d,lineMode:m,layout:se}),[c,s,u,d,m,se]),Me=lt(()=>{if(!r)return;let e="function"==typeof n?n:e=>e[n],t="function"==typeof l?l:e=>e[l],i=new Map;for(let e of ge)i.set(e[s]+"",e);return r.map(o=>{if(o.coordinates)return o;let r=i.get(o.source+""),a=i.get(o.target+"");return r&&a?{...o,coordinates:[{[n]:e(r),[l]:t(r)},{[n]:e(a),[l]:t(a)}]}:null}).filter(Boolean)},[r,ge,n,l,s]),Ae=lt(()=>e=>{let t=("function"==typeof u?u:e=>e[u])(e);return yt("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[gt("div",{style:{fontWeight:600},children:e[s]||e.name||e.id||"Point"}),null!=t&&yt("div",{style:{opacity:.7},children:["Cost: ","number"==typeof t?t.toFixed(1):t]})]})},[u,s]),Ce=st(null);G(t,{variant:"geo-points",frameRef:Ce});let[Ne,Re]=ct(null),je=dt(()=>{let e=Ce.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"})},[]);ut(()=>{let e=requestAnimationFrame(je);return()=>cancelAnimationFrame(e)},[je,d,c,i.width,i.height,ge,se]);let Fe=lt(()=>{if(!de||!Ne)return[];let{maxCost:e}=Ne;if(0>=e)return[];if(Array.isArray(de))return de.filter(t=>t>0&&e>=t);let t="number"==typeof de?de:Math.min("strip"===Ne.layout?3:5,Math.max(2,Math.ceil(e/5))),i=e/t,o=[];for(let e=1;t>=e;e++)o.push(Math.round(i*e*10)/10);return o},[de,Ne]),Pe=lt(()=>{if(!Ne)return ie.foregroundGraphics||null;let e=gt(a,{bottomMargin:ye.margin.bottom,costLabel:H,layout:Ne,ringStyle:P,ringValues:Fe,showNorth:he,showRingLabels:me,showRings:de}),t=ie.foregroundGraphics;return"function"==typeof t?i=>yt(ft,{children:[e,t(i)]}):yt(ft,{children:[e,t]})},[Ne,Fe,de,me,he,H,P,ye.margin.bottom,ie.foregroundGraphics]);if(ye.earlyReturn)return ye.earlyReturn;xe("DistanceCartogram",ge,"xAccessor",n),xe("DistanceCartogram",ge,"yAccessor",l);let Le={projection:h,...null!=o&&{points:ge},...Me&&{lines:Me,lineDataAccessor:"coordinates"},xAccessor:n,yAccessor:l,pointIdAccessor:s,pointStyle:be,projectionTransform:ve,...S&&{transition:{duration:S}},...null!=p&&{graticule:p},...null!=f&&{fitPadding:f},...pe&&{zoomable:!0},...y&&{zoomExtent:y},...b&&{onZoom:b},...null!=v&&{dragRotate:v},...x&&{tileURL:x},...k&&{tileAttribution:k},...w&&{tileCacheSize:w},size:[i.width,i.height],maxDevicePixelRatio:e.maxDevicePixelRatio,margin:ye.margin,enableHover:i.enableHover,tooltipContent:!1===R?()=>null:ae(R)||Ae,...ye.legendBehaviorProps,...$({linkedHover:T,selection:D,onObservation:U,onClick:Z,mobileInteraction:ye.mobileInteraction,customHoverBehavior:ye.customHoverBehavior,customClickBehavior:ye.customClickBehavior,linkedHoverInClickPredicate:!1}),...z&&z.length>0&&{annotations:z},...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},...O&&{className:O},...null!=e.animate&&{animate:e.animate},...ie,foregroundGraphics:Pe};return gt(Q,{componentName:"DistanceCartogram",width:i.width,height:i.height,children:gt(B,{ref:Ce,...Le})})});bt.displayName="DistanceCartogram";import{jsx as vt}from"react/jsx-runtime";var xt=e=>{let t=e.config,i=t.source??"auto",o="areas"===i||"auto"===i&&e.areas.length>0,r=(o?function(e){return e.areas.map((t,i)=>{let o=function(e,t){let i=e.properties&&"object"==typeof e.properties?e.properties:{},o=e.id??i.id??i.name??"area-"+t;return{...i,id:o+""}}(t,i),r=e.scales.geoPath.centroid(t),n=Number.isFinite(r[0])&&Number.isFinite(r[1])?e.scales.invertedPoint(r[0],r[1]):null;return{datum:{...o,gridLongitude:n?.[0],gridLatitude:n?.[1]},x:r[0],y:r[1]}}).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))}(e):e.points.map((e,t)=>({datum:e,x:t,y:t}))).filter((e,i)=>!t.filter||t.filter(e.datum,i)),n=function(e,t){if(!t.rowAccessor||!t.columnAccessor)return null;let i=e.map(e=>({datum:e,x:Number(m(e,t.columnAccessor)),y:Number(m(e,t.rowAccessor))})).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y));return i.length!==e.length?null:i.map(e=>({...e,row:e.y,column:e.x}))}(r.map(e=>e.datum),t),a=o?r:function(e){return e.points.map(t=>{let i=Number(m(t,e.config.longitudeAccessor,["lon","longitude"])),o=Number(m(t,e.config.latitudeAccessor,["lat","latitude"])),r=Number.isFinite(i)&&Number.isFinite(o)?e.scales.projectedPoint(i,o):null;return{datum:t,x:r?.[0]??NaN,y:r?.[1]??NaN}}).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))}({...e,points:r.map(e=>e.datum)}),l=n??d(a,{columns:t.columns,rows:t.rows,occupancy:t.occupancy,aspectRatio:e.dimensions.width/Math.max(1,e.dimensions.height)});if(0===l.length)return{nodes:[]};let g=c(l.map(e=>e.row)),y=c(l.map(e=>e.column)),b=Math.max(1,Math.round(g[1]-g[0])+1),v=Math.max(1,Math.round(y[1]-y[0])+1),x=Math.max(0,t.layoutPadding??8),k=Math.max(1,e.dimensions.width-2*x)/v,w=Math.max(1,e.dimensions.height-2*x)/b,S=(e.dimensions.width-k*v)/2,M=(e.dimensions.height-w*b)/2,A=s(t.cellPadding??.12,0,.8),C=Math.max(1,.5*Math.min(k,w)*(1-A)),N=t.sizeAccessor?l.map(e=>Number(m(e.datum,t.sizeAccessor))):[],R=t.sizeDomain??c(N),j=t.sizeRange??[.36,1],F=s(Math.min(j[0],j[1]),.05,1),P=s(Math.max(j[0],j[1]),F,1),L=l.map((i,o)=>{let r={...i.datum,gridRow:i.row,gridColumn:i.column},n=(m(r,t.idAccessor,["id","key","name"])??"grid-"+o)+"",a=(m(r,t.labelAccessor,["abbr","code","label","name","id"])??n)+"",l=Math.max(1,t.maxLabelLength??4),c=a.length>l?a.slice(0,l):a,d=m(r,t.categoryAccessor),h=null==d?void 0:d+"",p=m(r,t.fillAccessor),f=null!=p?p+"":h?e.resolveColor(h):e.theme.categorical[0]??"#4f86c6",b=t.sizeAccessor?Number(m(r,t.sizeAccessor)):NaN,v=t.sizeAccessor&&Number.isFinite(b)?Math.sqrt(s(u(b,R),0,1)):1,x=C*(F+v*(P-F)),A="function"==typeof t.markStyle?t.markStyle(r,o):t.markStyle;return{datum:r,id:n,label:c,category:h,row:i.row,column:i.column,x:S+(i.column-y[0]+.5)*k,y:M+(i.row-g[0]+.5)*w,radius:x,style:{fill:f,fillOpacity:.94,stroke:"rgba(255,255,255,0.9)",strokeWidth:1,...A}}}),H=t.shape??"circle";return{nodes:L.map(e=>{return"circle"===H?{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"===H?p(e.x,e.y,e.radius):(t=e.x,i=e.y,o=e.radius,h([[t-o,i-o],[t+o,i-o],[t+o,i+o],[t-o,i+o]])),centroid:[e.x,e.y],bounds:[[e.x-e.radius,e.y-e.radius],[e.x+e.radius,e.y+e.radius]],screenArea:"hexagon"===H?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,i,o}),overlays:!1===t.showLabels?null:vt(f,{marks:L,color:t.labelColor??"#ffffff",fontSize:t.labelFontSize??s(.23*Math.min(k,w),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}}};import{geoBounds as kt,geoContains as wt}from"d3-geo";import{jsx as St}from"react/jsx-runtime";var Mt=new WeakMap,At=new WeakMap,Ct=new WeakMap,Nt=1,Rt=e=>{let t=function(e){let t=Mt.get(e.areas);t||(t=new Map,Mt.set(e.areas,t));let i=function(e){let t=e.config;return[e.areas.length,e.dimensions.width,e.dimensions.height,t.cellSize??"",t.columns??"",t.layoutPadding??"",t.gridOrigin?.join(",")??"",t.maxSamples??"",w(t.featureFilter),w(t.dotFilter),F(e)].join("::")}(e),o=t.get(i);if(o)return o;let r=A(e.areas,e.scales,e.dimensions,e.config);if(t.size>=12){let e=t.keys().next().value;void 0!==e&&t.delete(e)}return t.set(i,r),r}(e),i=e.config,o=i.shape??"circle",r=Math.max(.5,y(i.dotRadius)??t.cellSize*g(i.radiusRatio??.24,.05,.5)),n=i.gridOrigin?.[0]??0,a=i.gridOrigin?.[1]??0;return{nodes:t.dots.map((l,s)=>{let c=n+(l.gridColumn+.5)*t.cellSize,u=a+(l.gridRow+.5)*t.cellSize,d=b(l,i.categoryAccessor),m=b(l,i.fillAccessor),h={fill:null!=m?m+"":null!=d?e.resolveColor(d+""):e.theme.categorical[0]??"#4f86c6",fillOpacity:.92,strokeWidth:0,..."function"==typeof i.markStyle?i.markStyle(l,s):i.markStyle},p=`dot-${l.gridRow}-${l.gridColumn}`;return"circle"===o?{type:"point",x:c,y:u,r:r,style:h,datum:l,interactive:!1,pointId:p,_transitionKey:p}:{type:"geoarea",pathData:"hexagon"===o?H(c,u,r):L(c,u,r),centroid:[c,u],bounds:[[c-r,u-r],[c+r,u+r]],screenArea:"hexagon"===o?3*Math.sqrt(3)*r*r/2:(2*r)**2,style:h,datum:l,group:l.featureId,interactive:!1}}),overlays:i.showOutline?St("g",{"aria-hidden":"true",pointerEvents:"none",children:t.features.map((t,o)=>{let r=e.scales.geoPath(t);return r?St("path",{d:r,fill:"none",stroke:i.outlineStyle?.stroke??"currentColor",strokeOpacity:i.outlineStyle?.opacity??i.outlineStyle?.fillOpacity??.22,strokeWidth:i.outlineStyle?.strokeWidth??.7,strokeDasharray:i.outlineStyle?.strokeDasharray,strokeLinecap:i.outlineStyle?.strokeLinecap,vectorEffect:"non-scaling-stroke"},x(t,o)):null})}):null,restyle:(e,t)=>t?.isActive&&e.datum?{opacity:t.predicate(e.datum)?1:.14}:{opacity:1}}};export{r as ChoroplethMap,z as DEFAULT_HIT_RADIUS,bt as DistanceCartogram,at as FlowMap,T as GeoCustomChart,J as MultiLineTooltip,Ve as ProportionalSymbolMap,B as StreamGeoFrame,V as Tooltip,Y as TooltipRoot,X as composeStyleRules,W as geoAreaHitTarget,O as geoHitTarget,Rt as geographicDotGridLayout,xt as geographicGridLayout,Re as glyphExtent,je as glyphPlacement,d as gridifyGeographicPoints,Fe as hatchFillId,Pe as hatchPatternDef,D as hitTargetPoint,Le as isHatchFill,te as makeNodeRuleContext,ie as makeRuleValueResolver,oe as markTooltipChrome,re as matchesThreshold,I as mergeData,t as resolveReferenceGeography,ue as resolveResponsiveRules,de as resolveStyleRules,He as resolveSvgFill,me as responsiveRuleMatches,he as ruleMatches,A 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
+ function m(){J("sankey",D),J("force",Q),J("chord",A),J("tree",W),J("cluster",W),J("treemap",W),J("circlepack",W),J("partition",W),J("orbit",a)}import{useForceLayout as i}from"./c-WH2O53VI.min.js";import"./c-AFBSWT77.min.js";import{DEFAULT_HIT_RADIUS as r,networkEdgeHitTarget as o,networkHitTarget as t}from"./c-HLLFJYTY.min.js";import{ChordDiagram as c,CirclePack as n,ForceDirectedGraph as p,NetworkCustomChart as s,OrbitDiagram as j,ProcessSankey as e,SankeyDiagram as V,TreeDiagram as T,Treemap as f,chordLayoutPlugin as A,diagnoseProcessSankeyLayout as U,diagnoseProcessSankeyProps as C,explainProcessSankeyLayout as K,forceLayoutPlugin as Q,formatProcessSankeyIssue as S,hierarchyLayoutPlugin as W,inventoryAtTime as X,orbitLayoutPlugin as a,sankeyLayoutPlugin as D,toProcessSankeyTime as E,validateProcessSankey as H}from"./c-PP6VY3QU.min.js";import"./c-GXV3C3MO.min.js";import"./c-55BAJ333.min.js";import"./c-D6HAAPTX.min.js";import"./c-KCRJGUHP.min.js";import{StreamNetworkFrame_default as I,registerLayoutPlugin as J}from"./c-TIXX5CAU.min.js";import"./c-MVR3RWF3.min.js";import"./c-V4XMSLC3.min.js";import"./c-HXDKPIKR.min.js";import"./c-4FN7Q6VQ.min.js";import"./c-2N7IU2NY.min.js";import"./c-YLZIV3VS.min.js";import"./c-ITKX3RC5.min.js";import{useCustomLayoutSelection as L}from"./c-YDECTEUW.min.js";import"./c-W4ZUKSEQ.min.js";import"./c-HYW2XA4Q.min.js";import"./c-VJTDST2R.min.js";import"./c-EUBTECGM.min.js";import{MultiLineTooltip as P,Tooltip as Y,TooltipRoot as M,composeStyleRules as R,makeNodeRuleContext as F,makeRuleValueResolver as N,markTooltipChrome as O,matchesThreshold as B,resolveResponsiveRules as G,resolveStyleRules as k,responsiveRuleMatches as l,ruleMatches as u,useSelectionActions as Z}from"./c-LMGSSD2E.min.js";import"./c-CPV4N35K.min.js";import"./c-ELDWAO2V.min.js";import"./c-JUKIWTBJ.min.js";import"./c-T2V7O2LO.min.js";import"./c-QA3HMQJP.min.js";import{glyphExtent as b,glyphPlacement as d,hatchFillId as h,hatchPatternDef as w,isHatchFill as x,resolveSvgFill as y}from"./c-553QUDKA.min.js";export{c as ChordDiagram,n as CirclePack,r as DEFAULT_HIT_RADIUS,p as ForceDirectedGraph,P as MultiLineTooltip,s as NetworkCustomChart,j as OrbitDiagram,e as ProcessSankey,V as SankeyDiagram,I as StreamNetworkFrame,Y as Tooltip,M as TooltipRoot,T as TreeDiagram,f as Treemap,R as composeStyleRules,U as diagnoseProcessSankeyLayout,C as diagnoseProcessSankeyProps,K as explainProcessSankeyLayout,S as formatProcessSankeyIssue,b as glyphExtent,d as glyphPlacement,h as hatchFillId,w as hatchPatternDef,X as inventoryAtTime,x as isHatchFill,F as makeNodeRuleContext,N as makeRuleValueResolver,O as markTooltipChrome,B as matchesThreshold,o as networkEdgeHitTarget,t as networkHitTarget,m as registerBuiltInNetworkLayouts,G as resolveResponsiveRules,k as resolveStyleRules,y as resolveSvgFill,l as responsiveRuleMatches,u as ruleMatches,E as toProcessSankeyTime,L as useCustomLayoutSelection,i as useForceLayout,Z as useSelectionActions,H 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-HLLFJYTY.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 K,LikertChart as E,OrdinalCustomChart as T,PieChart as C,RadarChart as D,RidgelinePlot as Q,StackedBarChart as G,StreamOrdinalFrame_default as N,SwarmPlot as O,SwimlaneChart as R,ViolinPlot as U}from"./c-DY2676CR.min.js";import"./c-GNTXRXRN.min.js";import"./c-55BAJ333.min.js";import"./c-D6HAAPTX.min.js";import"./c-KCRJGUHP.min.js";import"./c-DE5Q3U2X.min.js";import"./c-DK662R77.min.js";import"./c-ROEHCIGV.min.js";import"./c-AVO3Q7T7.min.js";import"./c-BNG5ECK5.min.js";import"./c-TKG2NP7G.min.js";import"./c-OO5QLMJC.min.js";import"./c-HXDKPIKR.min.js";import"./c-4FN7Q6VQ.min.js";import"./c-2N7IU2NY.min.js";import"./c-YLZIV3VS.min.js";import"./c-ITKX3RC5.min.js";import{useCustomLayoutSelection as V}from"./c-YDECTEUW.min.js";import"./c-W4ZUKSEQ.min.js";import"./c-EUBTECGM.min.js";import{AnnotationLabel as A,MultiLineTooltip as J,Tooltip as L,TooltipRoot as H,composeStyleRules as I,estimateLabelWidth as P,makeNodeRuleContext as X,makeRuleValueResolver as Y,makeStyleRuleStyleFn as f,makeXYRuleContext as S,markTooltipChrome as a,matchesThreshold as B,resolveResponsiveRules as M,resolveStyleRules as W,responsiveRuleMatches as e,ruleMatches as F}from"./c-LMGSSD2E.min.js";import"./c-CPV4N35K.min.js";import"./c-ELDWAO2V.min.js";import"./c-JUKIWTBJ.min.js";import"./c-T2V7O2LO.min.js";import"./c-QA3HMQJP.min.js";import{createHatchPattern as Z,glyphExtent as d,glyphPlacement as l,hatchFillId as x,hatchPatternDef as b,isHatchFill as g,resolveSvgFill as h}from"./c-553QUDKA.min.js";export{A 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,K as Histogram,E as LikertChart,J as MultiLineTooltip,T as OrdinalCustomChart,C as PieChart,D as RadarChart,Q as RidgelinePlot,G as StackedBarChart,N as StreamOrdinalFrame,O as SwarmPlot,R as SwimlaneChart,L as Tooltip,H as TooltipRoot,U as ViolinPlot,I as composeStyleRules,Z as createHatchPattern,P as estimateLabelWidth,d as glyphExtent,l as glyphPlacement,x as hatchFillId,b as hatchPatternDef,i as hitTargetPoint,r as hitTargetRect,g as isHatchFill,X as makeNodeRuleContext,Y as makeRuleValueResolver,f as makeStyleRuleStyleFn,S as makeXYRuleContext,a as markTooltipChrome,B as matchesThreshold,M as resolveResponsiveRules,W as resolveStyleRules,h as resolveSvgFill,e as responsiveRuleMatches,F as ruleMatches,V as useCustomLayoutSelection};
@@ -1 +1 @@
1
- var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,a={};((e,n)=>{for(var i in n)t(e,i,{get:n[i],enumerable:!0})})(a,{MATTER_PHYSICS_CAPABILITIES:()=>m,MATTER_PHYSICS_IMPORT_PATH:()=>l,MATTER_PHYSICS_INSTALL:()=>y,MATTER_PHYSICS_PACKAGE:()=>u,PhysicsOptionalEngineDependencyError:()=>o,loadMatterPhysicsPeer:()=>S,loadOptionalPhysicsPeer:()=>c,matterBodiesToPhysicsColliders:()=>T,matterBodiesToPhysicsSpawns:()=>b,matterBodyToPhysicsBodySpec:()=>f,matterBodyToPhysicsColliderSpec:()=>g,matterPhysicsDependencyError:()=>E,optionalEngineDependencyError:()=>s}),module.exports=(e=a,((e,a,o,s)=>{if(a)for(let o of i(a))r.call(e,o)||void 0===o||t(e,o,{get:()=>a[o],enumerable:!(s=n(a,o))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var o=class extends Error{constructor(e,t){super(`${e.engine} is an optional Semiotic physics engine. Install ${e.packageName} to use ${e.importPath}: ${e.installCommand}`),this.name="PhysicsOptionalEngineDependencyError",this.details=e,t&&(this.cause=t)}};function s(e,t){return new o(e,t)}async function c(e){try{return await import(e.packageName)}catch(t){throw s(e,t)}}var u="matter-js",l="semiotic/physics/matter",m={engine:"matter-js",determinism:"tolerance",sensors:!0,joints:!0,ccd:!1,maxBodiesHint:5e3,worker:!1},y={engine:"Matter.js",importPath:l,packageName:u,installCommand:"npm install "+u};function d(e){return"number"==typeof e&&Number.isFinite(e)?e:null}function p(e,t,n){const i=e.plugin?.id;return(i??e.label??e.id??`${n}-${t}`)+""}function h(e,t){const n=d(e.circleRadius);if(null!=n&&n>0)return{type:"circle",radius:n};const i=e.bounds;return i?{type:"aabb",width:Math.max(1,i.max.x-i.min.x),height:Math.max(1,i.max.y-i.min.y)}:{type:"circle",radius:t}}function x(e,t){const n=e.position??{x:0,y:0},i=d(e.circleRadius);if(null!=i&&i>0)return{type:"aabb",x:n.x,y:n.y,width:2*i,height:2*i};const r=e.bounds;return r?{type:"aabb",x:(r.min.x+r.max.x)/2,y:(r.min.y+r.max.y)/2,width:Math.max(1,r.max.x-r.min.x),height:Math.max(1,r.max.y-r.min.y)}:{type:"aabb",x:n.x,y:n.y,width:2*t,height:2*t}}function P(e,t){return t?e.plugin?.[t]:e.plugin}function f(e,t=0,n={}){const i=n.fallbackRadius??4,r=e.position??{x:0,y:0},a=e.velocity??{x:0,y:0};return{id:p(e,t,n.idPrefix??"matter-body"),x:r.x,y:r.y,vx:a.x,vy:a.y,angle:e.angle,mass:d(e.mass)??1,shape:h(e,i),datum:P(e,n.datumFromPlugin)}}function g(e,t=0,n={}){const i=n.fallbackRadius??4;return{id:p(e,t,n.idPrefix??"matter-collider"),sensor:!!e.isSensor,shape:x(e,i)}}function b(e,t={}){return e.map((e,n)=>f(e,n,t))}function T(e,t={}){return e.map((e,n)=>g(e,n,t))}async function S(){const e=await c(y);return e.default??e}function E(e){return s(y,e)}
1
+ function e(e,t){return new g(e,t)}async function t(t){try{return await(import(t.packageName))}catch(n){throw e(t,n)}}function n(e){return"number"==typeof e&&Number.isFinite(e)?e:null}function i(e,t,n){const i=e.plugin?.id;return(i??e.label??e.id??`${n}-${t}`)+""}function r(e,t){const i=n(e.circleRadius);if(null!=i&&i>0)return{type:"circle",radius:i};const r=e.bounds;return r?{type:"aabb",width:Math.max(1,r.max.x-r.min.x),height:Math.max(1,r.max.y-r.min.y)}:{type:"circle",radius:t}}function a(e,t){const i=e.position??{x:0,y:0},r=n(e.circleRadius);if(null!=r&&r>0)return{type:"aabb",x:i.x,y:i.y,width:2*r,height:2*r};const a=e.bounds;return a?{type:"aabb",x:(a.min.x+a.max.x)/2,y:(a.min.y+a.max.y)/2,width:Math.max(1,a.max.x-a.min.x),height:Math.max(1,a.max.y-a.min.y)}:{type:"aabb",x:i.x,y:i.y,width:2*t,height:2*t}}function o(e,t){return t?e.plugin?.[t]:e.plugin}function s(e,t=0,a={}){const s=a.fallbackRadius??4,c=e.position??{x:0,y:0},u=e.velocity??{x:0,y:0};return{id:i(e,t,a.idPrefix??"matter-body"),x:c.x,y:c.y,vx:u.x,vy:u.y,angle:e.angle,mass:n(e.mass)??1,shape:r(e,s),datum:o(e,a.datumFromPlugin)}}function c(e,t=0,n={}){const r=n.fallbackRadius??4;return{id:i(e,t,n.idPrefix??"matter-collider"),sensor:!!e.isSensor,shape:a(e,r)}}function u(e,t={}){return e.map((e,n)=>s(e,n,t))}function l(e,t={}){return e.map((e,n)=>c(e,n,t))}async function m(){const e=await t(E);return e.default??e}function y(t){return e(E,t)}var d,p=Object.defineProperty,h=Object.getOwnPropertyDescriptor,x=Object.getOwnPropertyNames,P=Object.prototype.hasOwnProperty,f={};((e,t)=>{for(var n in t)p(e,n,{get:t[n],enumerable:!0})})(f,{MATTER_PHYSICS_CAPABILITIES:()=>S,MATTER_PHYSICS_IMPORT_PATH:()=>T,MATTER_PHYSICS_INSTALL:()=>E,MATTER_PHYSICS_PACKAGE:()=>b,PhysicsOptionalEngineDependencyError:()=>g,loadMatterPhysicsPeer:()=>m,loadOptionalPhysicsPeer:()=>t,matterBodiesToPhysicsColliders:()=>l,matterBodiesToPhysicsSpawns:()=>u,matterBodyToPhysicsBodySpec:()=>s,matterBodyToPhysicsColliderSpec:()=>c,matterPhysicsDependencyError:()=>y,optionalEngineDependencyError:()=>e}),module.exports=(d=f,((e,t,n,i)=>{if(t)for(let n of x(t))P.call(e,n)||void 0===n||p(e,n,{get:()=>t[n],enumerable:!(i=h(t,n))||i.enumerable});return e})(p({},"__esModule",{value:!0}),d));var g=class extends Error{constructor(e,t){super(`${e.engine} is an optional Semiotic physics engine. Install ${e.packageName} to use ${e.importPath}: ${e.installCommand}`),this.name="PhysicsOptionalEngineDependencyError",this.details=e,t&&(this.cause=t)}},b="matter-js",T="semiotic/physics/matter",S={engine:"matter-js",determinism:"tolerance",sensors:!0,joints:!0,ccd:!1,maxBodiesHint:5e3,worker:!1},E={engine:"Matter.js",importPath:T,packageName:b,installCommand:"npm install "+b};
@@ -1 +1 @@
1
- import{PhysicsOptionalEngineDependencyError as t,loadOptionalPhysicsPeer as n,optionalEngineDependencyError as i}from"./c-S6U5CGT5.min.js";var e="matter-js",a="semiotic/physics/matter",r={engine:"matter-js",determinism:"tolerance",sensors:!0,joints:!0,ccd:!1,maxBodiesHint:5e3,worker:!1},s={engine:"Matter.js",importPath:a,packageName:e,installCommand:"npm install "+e};function u(t){return"number"==typeof t&&Number.isFinite(t)?t:null}function o(t,n,i){const e=t.plugin?.id;return(e??t.label??t.id??`${i}-${n}`)+""}function m(t,n){const i=u(t.circleRadius);if(null!=i&&i>0)return{type:"circle",radius:i};const e=t.bounds;return e?{type:"aabb",width:Math.max(1,e.max.x-e.min.x),height:Math.max(1,e.max.y-e.min.y)}:{type:"circle",radius:n}}function c(t,n){const i=t.position??{x:0,y:0},e=u(t.circleRadius);if(null!=e&&e>0)return{type:"aabb",x:i.x,y:i.y,width:2*e,height:2*e};const a=t.bounds;return a?{type:"aabb",x:(a.min.x+a.max.x)/2,y:(a.min.y+a.max.y)/2,width:Math.max(1,a.max.x-a.min.x),height:Math.max(1,a.max.y-a.min.y)}:{type:"aabb",x:i.x,y:i.y,width:2*n,height:2*n}}function x(t,n){return n?t.plugin?.[n]:t.plugin}function l(t,n=0,i={}){const e=i.fallbackRadius??4,a=t.position??{x:0,y:0},r=t.velocity??{x:0,y:0};return{id:o(t,n,i.idPrefix??"matter-body"),x:a.x,y:a.y,vx:r.x,vy:r.y,angle:t.angle,mass:u(t.mass)??1,shape:m(t,e),datum:x(t,i.datumFromPlugin)}}function y(t,n=0,i={}){const e=i.fallbackRadius??4;return{id:o(t,n,i.idPrefix??"matter-collider"),sensor:!!t.isSensor,shape:c(t,e)}}function d(t,n={}){return t.map((t,i)=>l(t,i,n))}function p(t,n={}){return t.map((t,i)=>y(t,i,n))}async function f(){const t=await n(s);return t.default??t}function h(t){return i(s,t)}export{r as MATTER_PHYSICS_CAPABILITIES,a as MATTER_PHYSICS_IMPORT_PATH,s as MATTER_PHYSICS_INSTALL,e as MATTER_PHYSICS_PACKAGE,t as PhysicsOptionalEngineDependencyError,f as loadMatterPhysicsPeer,n as loadOptionalPhysicsPeer,p as matterBodiesToPhysicsColliders,d as matterBodiesToPhysicsSpawns,l as matterBodyToPhysicsBodySpec,y as matterBodyToPhysicsColliderSpec,h as matterPhysicsDependencyError,i as optionalEngineDependencyError};
1
+ function t(t){return"number"==typeof t&&Number.isFinite(t)?t:null}function i(t,i,e){let n=t.plugin?.id;return(n??t.label??t.id??`${e}-${i}`)+""}function e(i,e){let n=t(i.circleRadius);if(null!=n&&n>0)return{type:"circle",radius:n};let a=i.bounds;return a?{type:"aabb",width:Math.max(1,a.max.x-a.min.x),height:Math.max(1,a.max.y-a.min.y)}:{type:"circle",radius:e}}function n(i,e){let n=i.position??{x:0,y:0},a=t(i.circleRadius);if(null!=a&&a>0)return{type:"aabb",x:n.x,y:n.y,width:2*a,height:2*a};let r=i.bounds;return r?{type:"aabb",x:(r.min.x+r.max.x)/2,y:(r.min.y+r.max.y)/2,width:Math.max(1,r.max.x-r.min.x),height:Math.max(1,r.max.y-r.min.y)}:{type:"aabb",x:n.x,y:n.y,width:2*e,height:2*e}}function a(t,i){return i?t.plugin?.[i]:t.plugin}function r(n,r=0,u={}){let m=u.fallbackRadius??4,l=n.position??{x:0,y:0},s=n.velocity??{x:0,y:0};return{id:i(n,r,u.idPrefix??"matter-body"),x:l.x,y:l.y,vx:s.x,vy:s.y,angle:n.angle,mass:t(n.mass)??1,shape:e(n,m),datum:a(n,u.datumFromPlugin)}}function u(t,e=0,a={}){let r=a.fallbackRadius??4;return{id:i(t,e,a.idPrefix??"matter-collider"),sensor:!!t.isSensor,shape:n(t,r)}}function m(t,i={}){return t.map((t,e)=>r(t,e,i))}function l(t,i={}){return t.map((t,e)=>u(t,e,i))}async function s(){let t=await c(h);return t.default??t}function o(t){return y(h,t)}import{PhysicsOptionalEngineDependencyError as x,loadOptionalPhysicsPeer as c,optionalEngineDependencyError as y}from"./c-E7I2L7CU.min.js";var d="matter-js",p="semiotic/physics/matter",f={engine:"matter-js",determinism:"tolerance",sensors:!0,joints:!0,ccd:!1,maxBodiesHint:5e3,worker:!1},h={engine:"Matter.js",importPath:p,packageName:d,installCommand:"npm install "+d};export{f as MATTER_PHYSICS_CAPABILITIES,p as MATTER_PHYSICS_IMPORT_PATH,h as MATTER_PHYSICS_INSTALL,d as MATTER_PHYSICS_PACKAGE,x as PhysicsOptionalEngineDependencyError,s as loadMatterPhysicsPeer,c as loadOptionalPhysicsPeer,l as matterBodiesToPhysicsColliders,m as matterBodiesToPhysicsSpawns,r as matterBodyToPhysicsBodySpec,u as matterBodyToPhysicsColliderSpec,o as matterPhysicsDependencyError,y as optionalEngineDependencyError};
@@ -1 +1 @@
1
- var e,r=Object.defineProperty,t=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,n={};((e,t)=>{for(var a in t)r(e,a,{get:t[a],enumerable:!0})})(n,{PhysicsOptionalEngineDependencyError:()=>o,RAPIER_PHYSICS_CAPABILITIES:()=>m,RAPIER_PHYSICS_ENGINE_DECISION:()=>d,RAPIER_PHYSICS_IMPORT_PATH:()=>l,RAPIER_PHYSICS_INSTALL:()=>P,RAPIER_PHYSICS_PACKAGE:()=>p,loadOptionalPhysicsPeer:()=>c,loadRapierPhysicsPeer:()=>u,optionalEngineDependencyError:()=>s,rapierPhysicsDependencyError:()=>h}),module.exports=(e=n,((e,n,o,s)=>{if(n)for(let o of a(n))i.call(e,o)||void 0===o||r(e,o,{get:()=>n[o],enumerable:!(s=t(n,o))||s.enumerable});return e})(r({},"__esModule",{value:!0}),e));var o=class extends Error{constructor(e,r){super(`${e.engine} is an optional Semiotic physics engine. Install ${e.packageName} to use ${e.importPath}: ${e.installCommand}`),this.name="PhysicsOptionalEngineDependencyError",this.details=e,r&&(this.cause=r)}};function s(e,r){return new o(e,r)}async function c(e){try{return await import(e.packageName)}catch(r){throw s(e,r)}}var p="@dimforge/rapier2d-compat",l="semiotic/physics/rapier",d={selectedPackage:p,rejectedPackage:"@dimforge/rapier2d-deterministic",determinism:"tolerance",reason:"Use @dimforge/rapier2d-compat for the optional browser adapter path because it is the maintained npm/WASM package with standard bundler behavior. Treat Rapier visual/position conformance as tolerance-classed; keep the built-in kernel as the strict deterministic default."},m={engine:"rapier2d-compat",determinism:"tolerance",sensors:!0,joints:!0,ccd:!0,maxBodiesHint:2e4,worker:!0},P={engine:"Rapier 2D",importPath:l,packageName:p,installCommand:"npm install "+p};async function u(){const e=await c(P),r=e.default??e;return await(r.init?.()),r}function h(e){return s(P,e)}
1
+ function e(e,r){return new l(e,r)}async function r(r){try{return await(import(r.packageName))}catch(t){throw e(r,t)}}async function t(){const e=await r(h),t=e.default??e;return await(t.init?.()),t}function a(r){return e(h,r)}var i,n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,c=Object.prototype.hasOwnProperty,p={};((e,r)=>{for(var t in r)n(e,t,{get:r[t],enumerable:!0})})(p,{PhysicsOptionalEngineDependencyError:()=>l,RAPIER_PHYSICS_CAPABILITIES:()=>u,RAPIER_PHYSICS_ENGINE_DECISION:()=>P,RAPIER_PHYSICS_IMPORT_PATH:()=>m,RAPIER_PHYSICS_INSTALL:()=>h,RAPIER_PHYSICS_PACKAGE:()=>d,loadOptionalPhysicsPeer:()=>r,loadRapierPhysicsPeer:()=>t,optionalEngineDependencyError:()=>e,rapierPhysicsDependencyError:()=>a}),module.exports=(i=p,((e,r,t,a)=>{if(r)for(let t of s(r))c.call(e,t)||void 0===t||n(e,t,{get:()=>r[t],enumerable:!(a=o(r,t))||a.enumerable});return e})(n({},"__esModule",{value:!0}),i));var l=class extends Error{constructor(e,r){super(`${e.engine} is an optional Semiotic physics engine. Install ${e.packageName} to use ${e.importPath}: ${e.installCommand}`),this.name="PhysicsOptionalEngineDependencyError",this.details=e,r&&(this.cause=r)}},d="@dimforge/rapier2d-compat",m="semiotic/physics/rapier",P={selectedPackage:d,rejectedPackage:"@dimforge/rapier2d-deterministic",determinism:"tolerance",reason:"Use @dimforge/rapier2d-compat for the optional browser adapter path because it is the maintained npm/WASM package with standard bundler behavior. Treat Rapier visual/position conformance as tolerance-classed; keep the built-in kernel as the strict deterministic default."},u={engine:"rapier2d-compat",determinism:"tolerance",sensors:!0,joints:!0,ccd:!0,maxBodiesHint:2e4,worker:!0},h={engine:"Rapier 2D",importPath:m,packageName:d,installCommand:"npm install "+d};
@@ -1 +1 @@
1
- import{PhysicsOptionalEngineDependencyError as e,loadOptionalPhysicsPeer as a,optionalEngineDependencyError as i}from"./c-S6U5CGT5.min.js";var t="@dimforge/rapier2d-compat",r="semiotic/physics/rapier",n={selectedPackage:t,rejectedPackage:"@dimforge/rapier2d-deterministic",determinism:"tolerance",reason:"Use @dimforge/rapier2d-compat for the optional browser adapter path because it is the maintained npm/WASM package with standard bundler behavior. Treat Rapier visual/position conformance as tolerance-classed; keep the built-in kernel as the strict deterministic default."},o={engine:"rapier2d-compat",determinism:"tolerance",sensors:!0,joints:!0,ccd:!0,maxBodiesHint:2e4,worker:!0},s={engine:"Rapier 2D",importPath:r,packageName:t,installCommand:"npm install "+t};async function c(){const e=await a(s),i=e.default??e;return await(i.init?.()),i}function m(e){return i(s,e)}export{e as PhysicsOptionalEngineDependencyError,o as RAPIER_PHYSICS_CAPABILITIES,n as RAPIER_PHYSICS_ENGINE_DECISION,r as RAPIER_PHYSICS_IMPORT_PATH,s as RAPIER_PHYSICS_INSTALL,t as RAPIER_PHYSICS_PACKAGE,a as loadOptionalPhysicsPeer,c as loadRapierPhysicsPeer,i as optionalEngineDependencyError,m as rapierPhysicsDependencyError};
1
+ async function e(){let e=await t(m),a=e.default??e;return await(a.init?.()),a}function a(e){return r(m,e)}import{PhysicsOptionalEngineDependencyError as i,loadOptionalPhysicsPeer as t,optionalEngineDependencyError as r}from"./c-E7I2L7CU.min.js";var n="@dimforge/rapier2d-compat",o="semiotic/physics/rapier",s={selectedPackage:n,rejectedPackage:"@dimforge/rapier2d-deterministic",determinism:"tolerance",reason:"Use @dimforge/rapier2d-compat for the optional browser adapter path because it is the maintained npm/WASM package with standard bundler behavior. Treat Rapier visual/position conformance as tolerance-classed; keep the built-in kernel as the strict deterministic default."},c={engine:"rapier2d-compat",determinism:"tolerance",sensors:!0,joints:!0,ccd:!0,maxBodiesHint:2e4,worker:!0},m={engine:"Rapier 2D",importPath:o,packageName:n,installCommand:"npm install "+n};export{i as PhysicsOptionalEngineDependencyError,c as RAPIER_PHYSICS_CAPABILITIES,s as RAPIER_PHYSICS_ENGINE_DECISION,o as RAPIER_PHYSICS_IMPORT_PATH,m as RAPIER_PHYSICS_INSTALL,n as RAPIER_PHYSICS_PACKAGE,t as loadOptionalPhysicsPeer,e as loadRapierPhysicsPeer,r as optionalEngineDependencyError,a as rapierPhysicsDependencyError};
@@ -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
+ function e(e){let{data:t,encoding:i,defaults:n={},scales:r}=e,o=Dt({data:t,encoding:i}),a=[],s=new Map,l=[],u=[],d=new Map;return o.rows.forEach((e,t)=>{let{id:o,datum:p}=e,c=Math.max(0,Vt(i.appearance?.size,p,t)??n.size??6),h=Vt(i.appearance?.shape,p,t)??n.shape??{type:"circle",radius:c},m=e.placement.x??n.x??0,f=e.placement.y??n.y??0,g=r?.x?r.x(m):m,y=r?.y?r.y(f):f,b=Vt(i.appearance?.color,p,t)??n.color,x=Vt(i.appearance?.opacity,p,t)??n.opacity,w=Vt(i.appearance?.stroke,p,t)??n.stroke,v=Vt(i.appearance?.strokeWidth,p,t)??n.strokeWidth,A=Vt(i.time?.spawnAt,p,t)??e.time.arrival,I=e.kinematics.velocityX,M=e.kinematics.velocityY,S=Vt(i.dynamics?.mass,p,t)??n.mass??1,E=Vt(i.dynamics?.friction,p,t),P=Vt(i.dynamics?.restitution,p,t),j=Vt(i.dynamics?.bodyCollisions,p,t),k={id:o,x:g,y:y,mass:S,shape:{...h},datum:p,...null!=A&&{spawnAt:A},...null!=I&&{vx:I},...null!=M&&{vy:M},...null!=E&&{friction:E},...null!=P&&{restitution:P},...null!=j&&{bodyCollisions:j}},R={...null!=b&&{fill:b},...null!=x&&{opacity:x},...null!=w&&{stroke:w},...null!=v&&{strokeWidth:v}},B={id:o,datum:p,appearance:{color:b,opacity:x,shape:h,size:c,stroke:w,strokeWidth:v},placement:{x:g,y:y,lane:e.placement.lane,space:i.placement?.space??"world"},time:{arrival:A,spawnAt:A,basis:i.time?.basis??"simulation",unit:i.time?.unit},kinematics:{velocityX:I,velocityY:M,space:i.kinematics?.space??"world"},dynamics:{bodyCollisions:j,friction:E,mass:S,restitution:P},process:e.process,evidence:e.evidence,accessible:e.accessible,spawn:k};a.push(B),s.set(o,B),l.push(k),d.set(o,R),u.push({id:o,bodyId:o,label:e.accessible.label,description:e.accessible.description,datum:p,x:g,y:y,group:e.accessible.group})}),{rows:a,byId:s,spawns:l,semanticItems:u,bodyStyle:e=>d.get(e.id)??{}}}function t(t){return i=>{let n=e({data:i.data,encoding:t.encoding,defaults:t.defaults,scales:i.scales}),r=t.extend?.(i,n)??{};return{...r,initialSpawns:n.spawns,bodyStyle:n.bodyStyle,semanticItems:[...n.semanticItems,...r.semanticItems??[]]}}}function i(e,t){let{layout:i,positiveProperties:n,negativeProperties:r,viability:o,outcome:a}=t,s=function(e){return new Map(e.gates.map(e=>[e.id,e]))}(i),l=[...("function"==typeof t.events?t.events(e,i):t.events)??[]].sort((e,t)=>e.time-t.time),u=e;for(let e of l){let t=e.gateId?s.get(e.gateId):void 0,l=e.effects??[],d={...rt(e,l),appliedAt:e.time},p=At(u,d);if(p!==u){u=p;for(let i of l){let o={event:e,gate:t,negativeProperties:r,positiveProperties:n,project:u};i.when&&!i.when(o)||(u=ye(u,i,o))}u={...u,viability:o?.(u,{negativeProperties:r,positiveProperties:n})??tt(u,n,r)},e.final&&(u={...u,outcome:e.outcome??a?.(u,{layout:i,negativeProperties:r,positiveProperties:n})??(u.viability>20?"built":"approved_not_built")})}}return u}function n(e){return e.projects.map(t=>i(t,e))}function r(e){let t=e.resources.map(e=>({...e,bodyId:e.bodyId??e.id})),i=new Map(t.map(e=>[e.bodyId,e])),n=new Map,r=new Map,o=e.assignmentForce??.45,a=e.returnForce??.35,s=e.caseAttraction??.08,l=e.assignmentOffset??{x:0,y:0},u=new Map,d=0,p=0;return{id:e.id??"service-resource-pool",continuous:!0,assign:e=>{let i=n.get(e);if(i)return i;let o=t.find(e=>!r.has(e.id));if(!o)return null;let a={resourceId:o.id,resourceBodyId:o.bodyId,caseBodyId:e,assignedAt:d};return n.set(e,a),r.set(o.id,a),p+=1,a},release:e=>{let t=n.get(e);return!!t&&(n.delete(e),r.delete(t.resourceId),p+=1,!0)},getAssignment:e=>n.get(e),tick:e=>{d=Math.max(d,e.elapsed),u=new Map(e.controls.readBodies().map(e=>[e.id,e]));for(let[e,t]of n)u.has(e)&&u.has(t.resourceBodyId)||(n.delete(e),r.delete(t.resourceId),p+=1)},getSnapshot:()=>({total:t.length,available:t.length-r.size,assigned:r.size,assignments:Array.from(n.values()),simulatedAt:d,metricRevision:p}),bodyForce:e=>{let t=i.get(e.body.id);if(t){let i=r.get(t.id),n=i?u.get(i.caseBodyId):void 0,s=i?o:a;return{x:((n?n.x+(l.x??0):t.home.x)-e.body.x)*s,y:((n?n.y+(l.y??0):t.home.y)-e.body.y)*s}}let d=n.get(e.body.id);if(!d||0>=s)return null;let p=u.get(d.resourceBodyId);return p?{x:(p.x-e.body.x)*s,y:(p.y-e.body.y)*s}:null}}}function o(e,t){let i="function"==typeof t.deadlineAccessor?t.deadlineAccessor(e):$t(e.datum,t.deadlineAccessor)??$t(e,t.deadlineAccessor);return Number.isFinite(Number(i))?Math.max(0,Number(i)):0}function a(e){function t(t){n.set(t.bodyId,t),a+=1,e.onStateChange?.({...t})}function i(e){let i=n.get(e);return!(!i||null!=i.completedAt||(t({...i,completedAt:r,state:"unhappy"===i.state?"resolved-unhappy":"resolved"}),0))}let n=new Map,r=0,a=0;return{id:e.id??"service-level",continuous:!0,protect:e=>{let i=n.get(e);return!(!i||null!=i.completedAt||"unhappy"===i.state||(t({...i,state:"protected",protectedAt:r}),0))},complete:i,getCase:e=>n.get(e),tick:a=>{r=Math.max(r,a.elapsed);for(let s of a.controls.readBodies()){if(!st(s,e.bodyFilter))continue;if(!n.has(s.id)){let i=o(s,e);t({bodyId:s.id,openedAt:r,deadlineAt:r+i,state:"waiting"})}let l=n.get(s.id);l&&null==l.completedAt&&(e.completionRegionId&&a.getRegionState(s.id)?.activeRegionIds.includes(e.completionRegionId)?i(s.id):"waiting"===l.state&&r>=l.deadlineAt&&t({...l,state:"unhappy"}))}},getSnapshot:()=>{let e=Array.from(n.values()),t=t=>e.filter(e=>e.state===t).length;return{total:e.length,waiting:t("waiting"),protected:t("protected"),unhappy:t("unhappy"),resolved:t("resolved"),resolvedUnhappy:t("resolved-unhappy"),simulatedAt:r,metricRevision:a}}}}function s(e){let t=new Set,i=0,n=0,r=0,o=!1;return{id:e.id??"dependency-gate:"+e.regionId,continuous:!0,tick:a=>{i=Math.max(i,a.elapsed);let s=o;var l;l=i,o=e.isOpen?e.isOpen(l):null!=e.opensAt&&l>=e.opensAt;let u=a.controls.readBodies(),d=new Map(u.map(e=>[e.id,e]));for(let i of u)!a.getRegionState(i.id)?.activeRegionIds.includes(e.regionId)||!st(i,e.bodyFilter)||!o&&!t.has(i.id)&&(t.add(i.id),r+=1,e.onHeld?.(i));if(o&&!s){for(let i of t){let t=d.get(i);t&&(a.controls.applyImpulse(i,e.releaseImpulse?.x??86,e.releaseImpulse?.y??0),n+=1,e.onReleased?.(t))}t.clear(),r+=1}for(let e of t)d.has(e)||(t.delete(e),r+=1)},getSnapshot:()=>({regionId:e.regionId,isOpen:o,blocked:t.size,released:n,simulatedAt:i,metricRevision:r}),bodyForce:i=>{if(o||!t.has(i.body.id))return null;let n=i.regions?.find(t=>t.id===e.regionId)?.shape;if(!n||"aabb"!==n.type)return{x:.8*-i.body.vx,y:.8*-i.body.vy};let r=e.holdForce??.4;return{x:(n.x-i.body.x)*r-.45*i.body.vx,y:(n.y-i.body.y)*r-.45*i.body.vy}}}}function l(e,t,i){return Math.max(t,Math.min(i,e))}function u(e,t,i={}){let n=i.random??Math.random,r=e.stages.find(e=>e.id===t)??e.stages[e.stages.length-1],o=l(i.along??.5,.05,.95),a=i.jitterX??0,s=i.padY??20,u=r.x0+(r.x1-r.x0)*o+(2*n()-1)*a,d=Math.min(1,r.width/2),p=l(u,r.x0+d,r.x1-d),c=e.boundaryY(p,"top")+s,h=e.boundaryY(p,"bottom")-s;return{x:p,y:h>c?c+n()*Math.max(1,h-c):e.midY}}function d(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]]}]}function p(e){let t="number"==typeof e?e:"string"==typeof e&&e.trim()?Number(e):NaN;return Number.isFinite(t)?t:null}function c(e,t,i,n,r){return"function"==typeof n?n(e,t,i):function(e,t){let i=e;for(let e of t.split(".")){if(null==i||"object"!=typeof i||!Object.prototype.hasOwnProperty.call(i,e))return;i=i[e]}return i}(e,n??r)}function h(e){let t=Number(e.toFixed(12));return Object.is(t,-0)?0:t}function m(e,t,i,n){let r=e.flatMap((e,r)=>{let o=p(c(e,r,t,i,"time")),a=p(c(e,r,t,n,"value"));return null==o||null==a?[]:[{time:h(o),value:a,index:r}]});r.sort((e,t)=>e.time-t.time||e.index-t.index);let o=[];for(let e of r){let t=o[o.length-1];t?.time===e.time?t.value=e.value:o.push({time:e.time,value:e.value})}return o}function f(e,t,i,n){if(!e.length)return null;let r=e[0],o=e[e.length-1];if(r.time>t)return"clamp"===n?r.value:null;if(t>o.time)return"clamp"===n?o.value:null;let a=function(e,t){let i=0,n=e.length;for(;n>i;){let r=i+n>>>1;t>e[r].time?i=r+1:n=r}return i}(e,t),s=e[a];if(s?.time===t)return s.value;let l=e[Math.max(0,a-1)];return"step"!==i&&s&&s.time!==l.time?l.value+(t-l.time)/(s.time-l.time)*(s.value-l.value):l.value}function g(e,t){if(1===e.length)return e[0];let i=(e.length-1)*t,n=Math.floor(i),r=Math.ceil(i);return n===r?e[n]:e[n]+(e[r]-e[n])*(i-n)}function y(e){let t=e.interpolation??"step",i=e.outsideDomain??"omit",n=function(e){let t=(e??ei).map(e=>{let t=p(e);if(null==t||0>t||t>1)throw new RangeError("physicsReferenceEnvelope quantiles must be finite values from 0 to 1; received "+e);return h(t)});return Array.from(new Set(t)).sort((e,t)=>e-t)}(e.quantiles),r=function(e){if(Array.isArray(e)){if(e.length>ti)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");return Array.from(new Set(e.map(p).filter(e=>null!=e).map(h))).sort((e,t)=>e-t)}let t=e,i=p(t.start),n=p(t.end),r=p(t.step);if(null==i||null==n||null==r||0>=r||i>n)throw new RangeError("physicsReferenceEnvelope sampleAt requires finite start/end values with end >= start and step > 0");let o=Math.floor((n-i)/r)+1;if(o>ti)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");let a=[],s=1e-10*Math.max(1,Math.abs(n),Math.abs(i));for(let e=0;o>e;e+=1){let t=i+e*r;if(t>n+s)break;a.push(h(Math.min(t,n)))}if((!a.length||Math.abs(a[a.length-1]-n)>s)&&a.push(h(n)),a.length>ti)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");return Array.from(new Set(a)).sort((e,t)=>e-t)}(e.sampleAt),o=e.runs.map(t=>m(t.samples,t.id,e.timeAccessor,e.valueAccessor));return{points:r.map(e=>{let r=o.map(n=>f(n,e,t,i)).filter(e=>null!=e).sort((e,t)=>e-t),a={};for(let e of n)a[e]=r.length?g(r,e):null;return{time:e,count:r.length,min:r.length?r[0]:null,max:r.length?r[r.length-1]:null,median:r.length?g(r,.5):null,quantiles:a}}),quantiles:n,interpolation:t,outsideDomain:i,runCount:e.runs.length}}function b(e,t){return e.quantiles.length?"lower"===t?e.quantiles[0]:e.quantiles[e.quantiles.length-1]:"lower"===t?"min":"max"}function x(e,t){if("min"===t||"median"===t||"max"===t)return e[t];let i=p(t);if(null==i||0>i||i>1)throw new RangeError("comparePhysicsTrace quantile selectors must be from 0 to 1; received "+t);let n=h(i);if(!Object.prototype.hasOwnProperty.call(e.quantiles,n))throw Error(`comparePhysicsTrace could not find quantile ${n} in the reference envelope`);return e.quantiles[n]??null}function w(e,t,i){return t>e?"below":e>i?"above":"inside"}function v(e,t){let i=Math.max(0,t.time-e.time);if(0>=i||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};let n=e.value-e.lower,r=t.value-t.lower,o=e.value-e.upper,a=t.value-t.upper,s=[0,1];for(let[e,t]of[[n,r],[o,a]])(0>e&&t>0||e>0&&0>t)&&s.push(-e/(t-e));s.sort((e,t)=>e-t);let l=0,u=0,d=0;for(let n=0;s.length-1>n;n+=1){let r=s[n],o=s[n+1];if(r>=o)continue;let a=(r+o)/2,p=(o-r)*i,c=w(e.value+(t.value-e.value)*a,e.lower+(t.lower-e.lower)*a,e.upper+(t.upper-e.upper)*a);"below"===c?l+=p:"above"===c?d+=p:u+=p}return{below:l,inside:u,above:d,observed:i}}function A(e,t,i={}){let n=i.interpolation??t.interpolation,r=i.outsideDomain??t.outsideDomain,o=m(e,i.traceId??"trace",i.timeAccessor,i.valueAccessor),a=i.lower??b(t,"lower"),s=i.upper??b(t,"upper"),l=t.points.map(e=>{let t=f(o,e.time,n,r),i=x(e,a),l=x(e,s);if(null!=i&&null!=l&&i>l)throw new RangeError("comparePhysicsTrace lower band exceeds upper band at time "+e.time);return{time:e.time,value:t,lower:i,upper:l,status:null==t||null==i||null==l?"unobserved":w(t,i,l)}}),u=0,d=0,p=0,c=0,h=null,g=0,y=null;for(let e of l){if("below"===e.status?u+=1:"inside"===e.status?d+=1:"above"===e.status&&(p+=1),null==e.value||null==e.lower||null==e.upper)continue;let t=Math.max(0,e.value-e.upper),i=Math.max(0,e.lower-e.value);t>c&&(c=t,h=e.time),i>g&&(g=i,y=e.time)}let A=0,I=0,M=0,S=0;for(let e=0;l.length-1>e;e+=1){let t=l[e],i=l[e+1],r=Math.max(0,i.time-t.time);if(r>0){if("linear"===n){let e=v(t,i);A+=e.below,I+=e.inside,M+=e.above,S+=e.observed;continue}"unobserved"!==t.status&&(S+=r,"below"===t.status?A+=r:"above"===t.status?M+=r:I+=r)}}let E=l[0]?.time,P=l[l.length-1]?.time,j=null==E||null==P?0:Math.max(0,P-E);return{points:l,sampleCount:l.length,observedSamples:u+d+p,belowSamples:u,insideSamples:d,aboveSamples:p,totalDuration:j,observedDuration:S,unobservedDuration:Math.max(0,j-S),belowDuration:A,insideDuration:I,aboveDuration:M,peakExcess:c,peakExcessAt:h,peakDeficit:g,peakDeficitAt:y}}function I(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function M(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function S(e){return!!M(e)&&"string"==typeof e.id&&"number"==typeof e.furthestStageIndex&&Number.isFinite(e.furthestStageIndex)&&Array.isArray(e.visitedStageIds)&&e.visitedStageIds.every(e=>"string"==typeof e)&&M(e.visitsByStage)&&M(e.firstEnteredAt)&&M(e.lastEnteredAt)&&"number"==typeof e.regressionCount&&Number.isFinite(e.regressionCount)}function E(e){return{id:e,furthestStageIndex:-1,visitedStageIds:[],visitsByStage:{},firstEnteredAt:{},lastEnteredAt:{},regressionCount:0}}function P(e){let t=Array.from(new Set(e.bodyIds??[]));return{stages:e.stages.map(e=>({...e})),bodyIds:t,entities:Object.fromEntries(t.map(e=>[e,E(e)]))}}function j(e,t,i={}){if("region-enter"!==t.type)return e;let n=function(e,t){let i=t.stageId?.(e);if(i)return i;let n=e.region.metadata;if(n&&"object"==typeof n&&Object.prototype.hasOwnProperty.call(n,"stageId")){let e=n.stageId;if("string"==typeof e)return e}return e.region.id}(t,i),r=e.stages.findIndex(e=>e.id===n);if(0>r)return e;let o=i.entityId?.(t)??t.bodyId;if(!o)return e;let a=I(e.entities,o),s=S(a)?a:E(o),l=s.currentStageId?e.stages.findIndex(e=>e.id===s.currentStageId):-1,u=!s.visitedStageIds.includes(n),d=Number(t.observation.timestamp),p=Number.isFinite(d)?d:0,c=I(s.visitsByStage,n),h="number"==typeof c&&Number.isFinite(c)?c:0,m={...s,currentStageId:n,furthestStageId:r>s.furthestStageIndex?n:s.furthestStageId,furthestStageIndex:Math.max(s.furthestStageIndex,r),visitedStageIds:u?[...s.visitedStageIds,n]:s.visitedStageIds,visitsByStage:{...s.visitsByStage,[n]:h+1},firstEnteredAt:u?{...s.firstEnteredAt,[n]:p}:s.firstEnteredAt,lastEnteredAt:{...s.lastEnteredAt,[n]:p},regressionCount:l>=0&&l>r?s.regressionCount+1:s.regressionCount};return{...e,bodyIds:e.bodyIds.includes(o)?e.bodyIds:[...e.bodyIds,o],entities:{...e.entities,[o]:m}}}function k(e){let t=e.bodyIds.map(t=>{let i=I(e.entities,t);return S(i)?i:E(t)}),i=t.length,n=i;return e.stages.map((e,r)=>{let o=t.filter(e=>e.furthestStageIndex>=r).length,a=t.filter(t=>t.visitedStageIds.includes(e.id)).length,s=t.reduce((t,i)=>{let n=I(i.visitsByStage,e.id);return t+("number"==typeof n&&Number.isFinite(n)?n:0)},0),l={id:e.id,label:e.label??e.id,reached:o,entered:a,total:i,conversion:i>0?o/i:0,fromPrevious:n>0?o/n:0,dropoff:Math.max(0,n-o),visits:s,repeatVisits:Math.max(0,s-a)};return n=o,l})}function R(e){let[t,i]=e.size,n=e.flow??ii,r=null==(v=e.padding)?{top:ni,right:ni,bottom:ni,left:ni}:"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},o=Math.max(.05,Math.min(1,e.channelRatio??si)),a={x:r.left,y:r.top,width:Math.max(1,t-r.left-r.right),height:Math.max(1,i-r.top-r.bottom)},s="down"===n?a.height:a.width,l=s*Math.max(0,e.chargeExtent??ri),u=s*Math.max(0,e.projectionExtent??ai),d=s*Math.max(0,e.destinationExtent??oi),p=Math.max(0,s-l-d-u),c=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"===n?a.width:a.height)/c.length,m="down"===n?(e,t)=>({x:a.x,y:a.y+e,width:a.width,height:t}):(e,t)=>({x:a.x+e,y:a.y,width:t,height:a.height}),f=m(0,l),g=m(l,p),y=l+p,b=m(y,d),x=m(y+d,u),w=c.map((e,t)=>{let i=t*h,r=h*o,s=(h-r)/2;return"down"===n?{id:e.id,label:e.label,order:t,x:a.x+i+s,y:b.y,width:r,height:b.height,centerX:a.x+(t+.5)*h,centerY:b.y+b.height/2}:{id:e.id,label:e.label,order:t,x:b.x,y:a.y+i+s,width:b.width,height:r,centerX:b.x+b.width/2,centerY:a.y+(t+.5)*h}});var v;return{width:t,height:i,flow:n,charge:f,apparatus:g,destinations:w,projection:x}}function B(e,t){return e.destinations.find(e=>e.id===t)}function N(e,t,i){let{charge:n,flow:r}=e,o=Math.max(1,i),a=(t%o+.5)/o;return"down"===r?{x:n.x+n.width*a,y:n.y+n.height/2}:{x:n.x+n.width/2,y:n.y+n.height*a}}function $(e,t={}){let i=t.thickness??4,n=t.idPrefix??"stage",{destinations:r,flow:o,width:a,height:s}=e,l=[];if(r.length>0){let t=r[0];if("down"===o){let o=t.y+t.height;l.push({id:n+"-floor",shape:{type:"segment",x1:e.charge.x,y1:o,x2:e.charge.x+e.charge.width,y2:o,thickness:i}});for(let e=1;r.length>e;e+=1){let a=r[e].centerX-(r[e].centerX-r[e-1].centerX)/2;l.push({id:`${n}-divider-${e}`,shape:{type:"segment",x1:a,y1:t.y,x2:a,y2:o,thickness:i}})}}else{let o=t.x+t.width;l.push({id:n+"-floor",shape:{type:"segment",x1:o,y1:e.charge.y,x2:o,y2:e.charge.y+e.charge.height,thickness:i}});for(let e=1;r.length>e;e+=1){let a=r[e].centerY-(r[e].centerY-r[e-1].centerY)/2;l.push({id:`${n}-divider-${e}`,shape:{type:"segment",x1:t.x,y1:a,x2:o,y2:a,thickness:i}})}}}return!1!==t.walls&&l.push({id:n+"-wall-left",shape:{type:"segment",x1:1,y1:0,x2:1,y2:s,thickness:i}},{id:n+"-wall-right",shape:{type:"segment",x1:a-1,y1:0,x2:a-1,y2:s,thickness:i}}),l}function Y(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 F(e){let t="number"==typeof e?e:"string"==typeof e&&e.trim()?Number(e):NaN;return Number.isFinite(t)?t:null}function O(e,t,i,n){let r="function"==typeof e?e(t,i):e;return Number.isFinite(r)?Number(r):n}function T(e,t,i){return F(e[t])??i}function D(e,t){return"number"==typeof e?e:e?.[t]??0}function C(e){let{band:t,idPrefix:i,plot:n,projection:r}=e,{includeBoundaryWalls:o=!0,includeInteriorWalls:a=!0,wallThickness:s=4}=t,l=function(e){let t=e.bandwidth??e.scale.bandwidth?.()??0,i=new Set;for(let n of e.values){let r=e.scale(n);Number.isFinite(r)&&(i.add(Number(r)),i.add(Number(r)+t))}return Array.from(i).sort((e,t)=>e-t)}(t);if(2>l.length)return[];let u=o?l.length-1:l.length-2,d=[];for(let e=o?0:1;u>=e;e+=1){if(!a&&e>0&&l.length-1>e)continue;let t=l[e];d.push({id:`${i}-wall-${e}`,shape:"x"===r?{type:"aabb",x:t,y:n.y+n.height/2,width:s,height:n.height}:{type:"aabb",x:n.x+n.width/2,y:t,width:n.width,height:s}})}return d}function q(e){let{plot:t,idPrefix:i="physics-scale",bounds:n={},xBins:r,xBands:o,yBands:a}=e,s=[];if(!1!==n&&s.push(...Ce(t,{idPrefix:i,...n})),r){let{idPrefix:e,yTop:n,yBottom:o,...a}=r;s.push(...qe({...a,idPrefix:e??i+"-xbin",yTop:n??t.y,yBottom:o??t.y+t.height}))}return o&&s.push(...C({band:o,idPrefix:o.idPrefix??i+"-xband",plot:t,projection:"x"})),a&&s.push(...C({band:a,idPrefix:a.idPrefix??i+"-yband",plot:t,projection:"y"})),s}function W(e){let{plot:t,rows:i,columns:n=i+1,pegRadius:r=3,idPrefix:o="galton-peg",yStart:a=t.y+.18*t.height,yEnd:s=t.y+.58*t.height,stagger:l=!0,restitution:u=.2,friction:d=.04}=e,p=Math.max(0,Math.floor(i)),c=Math.max(1,Math.floor(n));if(0===p)return[];let h=p>1?(s-a)/(p-1):0,m=t.width/c,f=[];for(let e=0;p>e;e+=1){let i=l&&e%2==1?m/2:0;for(let n=0;c>n;n+=1){let s=t.x+m*(n+.5)+i;t.x+r>s||s>t.x+t.width-r||f.push({id:`${o}-${e}-${n}`,shape:{type:"aabb",x:s,y:a+e*h,width:2*r,height:2*r},restitution:u,friction:d})}}return f}function X(e,t={}){let{idPrefix:i="physics-token",radius:n=5,shape:r,mass:o,vx:a,vy:s,spawnAt:l,seed:u=1,jitter:d,datum:p}=t,c=Yt(u),h=D(d,"x"),m=D(d,"y");return e.map((e,u)=>{let d=O(t.x,e,u,T(e,"x",0)),f=O(t.y,e,u,T(e,"y",0)),g=O(n,e,u,5),y="function"==typeof r?r(e,u):r??{type:"circle",radius:g};return{id:`${i}-${e.index??u}`,x:d+(c()-.5)*h,y:f+(c()-.5)*m,vx:O(a,e,u,0),vy:O(s,e,u,0),mass:O(o,e,u,1),spawnAt:O(l,e,u,void 0),shape:y,datum:p?p(e,u):e.datum??e}}).map(e=>{if(Number.isFinite(e.spawnAt))return e;let{spawnAt:t,...i}=e;return i})}function z(e,t={}){let{idPrefix:i="sediment",collider:n=!0,colliderThickness:r=1,restitution:o=.05,friction:a=.2,...s}=t,l=Nt(e,s),u=n?l.filter(e=>e.height>0).map(e=>({id:`${i}-${e.binId}`,shape:{type:"aabb",x:e.x+e.width/2,y:e.y+r/2,width:e.width,height:r},restitution:o,friction:a})):[];return{columns:l,colliders:u}}function L(e,t={}){let{timeAccessor:i="arrivalTime",timeScale:n=1,startAt:r=0,rebase:o=!0,sort:a=!0}=t,s=e.map((e,t)=>({spawn:e,time:function(e,t,i){return F("function"==typeof i?i(e,t):e[i]??e.datum?.[i])}(e,t,i)??e.spawnAt??t})),l=s.length?Math.min(...s.map(e=>e.time)):0;return{initialSpawns:s.map(({spawn:e,time:t})=>({...e,spawnAt:r+(o?t-l:t)})).sort((e,t)=>a?(e.spawnAt??0)-(t.spawnAt??0):0),initialSpawnPacing:{pacing:"arrival",startAt:r,timeAccessor:"spawnAt",timeScale:n}}}import{BuiltInPhysicsEngineAdapter as V,ChainReactionChart as Q,CollisionSwarmChart as J,CrucibleChart as U,DEFAULT_CRUCIBLE_HEIGHT as H,DEFAULT_CRUCIBLE_OUTLETS as K,DEFAULT_CRUCIBLE_SIZE as G,DEFAULT_CRUCIBLE_WIDTH as _,EventDropChart as Z,GaltonBoardChart as ee,GauntletChart as te,GuantletChart as ie,PacketFlowChart as ne,PhysicalFlowChart as re,PhysicsCustomChart as oe,PhysicsPileChart as ae,PhysicsPipelineStore as se,PhysicsSVGOverlay as le,PhysicsSedimentAccumulator as ue,ProcessFlowChart as de,StreamPhysicsFrame as pe,StreamPhysicsFrame_default as ce,UnitPileChart as he,absorbRegion as me,aggregateRegionCounts as fe,applyCrucibleEvent as ge,applyGauntletEffect as ye,bodiesToAnnotationAnchors as be,bodyGroupSpec as xe,buildCollisionSwarmPhysics as we,buildCrucibleEvidence as ve,buildCrucibleInitialSpawns as Ae,buildCrucibleLayout as Ie,buildCruciblePhysicsConfig as Me,buildCrucibleProductEvents as Se,buildCrucibleProjection as Ee,buildCrucibleStateSpawns as Pe,buildCrucibleTerminalSpawns as je,buildEventDropPhysics as ke,buildGaltonBoardPhysics as Re,buildPhysicalFlowPhysics as Be,buildPhysicsAnnotationContext as Ne,buildPhysicsPile as $e,buildProcessFlowPhysics as Ye,calculateBlockerAmplification as Fe,capacitatedRegion as Oe,chargeGateRegion as Te,cloneCrucibleState as De,collidersFromPlotBounds as Ce,collidersFromXScaleBins as qe,compileCruciblePlan as We,compileDependencyMachine as Xe,composePhysicsControllers as ze,createCapacityQueueController as Le,createDefaultPhysicsEngineAdapter as Ve,createInitialCrucibleState as Qe,createLogicalJoin as Je,createPortalController as Ue,crucibleBondId as He,crucibleBoundaryColliders as Ke,crucibleComponentBodyId as Ge,crucibleProductBodyId as _e,crucibleProjectionRows as Ze,crucibleSemanticKey as et,defaultViability as tt,evaluateCrucibleConservation as it,evaluatePhysicsBodyBudget as nt,eventLogItem as rt,forceFieldRegion as ot,groupCompletionRows as at,matchesPhysicsBodyFilter as st,membraneRegion as lt,normalizePhysicsAnnotations as ut,physicsProcessBoundaryColliders as dt,physicsProcessGroupSemanticItems as pt,physicsProcessRegionSemanticItem as ct,physicsProcessStageSemanticItems as ht,planGauntletPropertyWork as mt,portalRegion as ft,pressureFieldRegion as gt,processChrome as yt,processLaneWalls as bt,processStageLayout as xt,processStageRegions as wt,readEventDropOccupancy as vt,recordGauntletEvent as At,regionCountsToProjectionRows as It,replaceGauntletNegative as Mt,replayCruciblePlan as St,replayStateTransitions as Et,resolveCrucibleSelector as Pt,resolveCrucibleSnapshotAt as jt,resolveCrucibleTime as kt,routeDependencyTracks as Rt,routeSurfaceRegion as Bt,sedimentHeightfield as Nt,valueAtPath as $t}from"./c-447VIMRO.min.js";import"./c-EBOQ7ER7.min.js";import{mulberry32 as Yt}from"./c-HYW2XA4Q.min.js";import"./c-VJTDST2R.min.js";import"./c-EUBTECGM.min.js";import{MultiLineTooltip as Ft,Tooltip as Ot,TooltipRoot as Tt,compileMotionEncoding as Dt,composeStyleRules as Ct,deriveMotionVector as qt,makeRuleValueResolver as Wt,markTooltipChrome as Xt,matchesThreshold as zt,opacityFromAge as Lt,resolveMotionAccessor as Vt,resolveMotionAge as Qt,resolveMotionVector as Jt,resolveStyleRules as Ut,ruleMatches as Ht}from"./c-LMGSSD2E.min.js";import"./c-CPV4N35K.min.js";import"./c-ELDWAO2V.min.js";import"./c-JUKIWTBJ.min.js";import"./c-T2V7O2LO.min.js";import"./c-QA3HMQJP.min.js";import{hatchFillId as Kt,hatchPatternDef as Gt,isHatchFill as _t,resolveSvgFill as Zt}from"./c-553QUDKA.min.js";var ei=[.1,.5,.9],ti=1e6,ii="down",ni=24,ri=.12,oi=.55,ai=0,si=1,li=ce;export{V as BuiltInPhysicsEngineAdapter,Q as ChainReactionChart,J as CollisionSwarmChart,U as CrucibleChart,H as DEFAULT_CRUCIBLE_HEIGHT,K as DEFAULT_CRUCIBLE_OUTLETS,G as DEFAULT_CRUCIBLE_SIZE,_ as DEFAULT_CRUCIBLE_WIDTH,Z as EventDropChart,ee as GaltonBoardChart,te as GauntletChart,ie as GuantletChart,Ft as MultiLineTooltip,ne as PacketFlowChart,re as PhysicalFlowChart,oe as PhysicsCustomChart,ae as PhysicsPileChart,se as PhysicsPipelineStore,le as PhysicsSVGOverlay,ue as PhysicsSedimentAccumulator,de as ProcessFlowChart,pe as StreamPhysicsFrame,Ot as Tooltip,Tt as TooltipRoot,he as UnitPileChart,me as absorbRegion,fe as aggregateRegionCounts,ge as applyCrucibleEvent,L as arrivalReplay,be as bodiesToAnnotationAnchors,xe as bodyGroupSpec,we as buildCollisionSwarmPhysics,ve as buildCrucibleEvidence,Ae as buildCrucibleInitialSpawns,Ie as buildCrucibleLayout,Me as buildCruciblePhysicsConfig,Se as buildCrucibleProductEvents,Ee as buildCrucibleProjection,Pe as buildCrucibleStateSpawns,je as buildCrucibleTerminalSpawns,ke as buildEventDropPhysics,Re as buildGaltonBoardPhysics,Be as buildPhysicalFlowPhysics,Ne as buildPhysicsAnnotationContext,$e as buildPhysicsPile,Ye as buildProcessFlowPhysics,Fe as calculateBlockerAmplification,Oe as capacitatedRegion,Te as chargeGateRegion,De as cloneCrucibleState,q as collidersFromScales,A as comparePhysicsTrace,We as compileCruciblePlan,Xe as compileDependencyMachine,Dt as compileMotionEncoding,e as compilePhysicsEncoding,ze as composePhysicsControllers,Ct as composeStyleRules,Le as createCapacityQueueController,Ve as createDefaultPhysicsEngineAdapter,s as createDependencyGateController,Qe as createInitialCrucibleState,Je as createLogicalJoin,t as createPhysicsEncodingLayout,Ue as createPortalController,P as createProcessJourneyLedger,a as createServiceLevelController,r as createServiceResourcePoolController,He as crucibleBondId,Ke as crucibleBoundaryColliders,Ge as crucibleComponentBodyId,_e as crucibleProductBodyId,Ze as crucibleProjectionRows,et as crucibleSemanticKey,li as default,qt as deriveMotionVector,Y as describePhysicsStageGeography,it as evaluateCrucibleConservation,nt as evaluatePhysicsBodyBudget,ot as forceFieldRegion,W as galtonPegs,at as groupCompletionRows,Kt as hatchFillId,Gt as hatchPatternDef,_t as isHatchFill,Wt as makeRuleValueResolver,Xt as markTooltipChrome,zt as matchesThreshold,lt as membraneRegion,ut as normalizePhysicsAnnotations,Lt as opacityFromAge,N as physicsChargePoint,B as physicsDestination,dt as physicsProcessBoundaryColliders,pt as physicsProcessGroupSemanticItems,ct as physicsProcessRegionSemanticItem,ht as physicsProcessStageSemanticItems,y as physicsReferenceEnvelope,$ as physicsStageColliders,R as physicsStageGeography,mt as planGauntletPropertyWork,ft as portalRegion,gt as pressureFieldRegion,yt as processChrome,k as processJourneyRows,bt as processLaneWalls,xt as processStageLayout,wt as processStageRegions,d as processVolumePolygons,vt as readEventDropOccupancy,It as regionCountsToProjectionRows,Mt as replaceGauntletNegative,St as replayCruciblePlan,Et as replayStateTransitions,Pt as resolveCrucibleSelector,jt as resolveCrucibleSnapshotAt,kt as resolveCrucibleTime,i as resolveGauntletTerminalState,n as resolveGauntletTerminalStates,Vt as resolveMotionAccessor,Qt as resolveMotionAge,Jt as resolveMotionVector,Ut as resolveStyleRules,Zt as resolveSvgFill,Rt as routeDependencyTracks,Bt as routeSurfaceRegion,Ht as ruleMatches,z as sedimentBake,Nt as sedimentHeightfield,X as spawnFromTokens,u as stageTargetInVolume,j as updateProcessJourney};