prographs 0.12.0 → 0.13.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 (269) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/README.md +6 -4
  3. package/dist/AutoGraph-PDPEAIXL.cjs +145 -0
  4. package/dist/GraphType.js +19 -0
  5. package/dist/autograph/chartIndex.js +521 -0
  6. package/dist/autograph/chartModules.js +2 -1
  7. package/dist/autograph/index.cjs +98 -93
  8. package/dist/catalog-DI4XZ46L.cjs +142 -0
  9. package/dist/catalog.js +2 -1
  10. package/dist/charts/biologycharts/BiologySamples.js +59 -0
  11. package/dist/charts/biologycharts/PunnettSquare.js +342 -0
  12. package/dist/charts/biologycharts/biologyEnums.js +22 -1
  13. package/dist/charts/biologycharts/index.js +5 -3
  14. package/dist/charts/doecharts/DoeSamples.js +78 -0
  15. package/dist/charts/doecharts/SipocDiagram.js +453 -0
  16. package/dist/charts/doecharts/index.js +4 -2
  17. package/dist/charts/fieldcharts/SpeciesAccumulationCurve.js +350 -0
  18. package/dist/charts/fieldcharts/fieldEnums.js +8 -1
  19. package/dist/charts/fieldcharts/index.js +5 -3
  20. package/dist/charts/signals/AntennaPatternChart.js +492 -0
  21. package/dist/charts/signals/SignalSamples.js +17 -0
  22. package/dist/charts/signals/index.js +5 -3
  23. package/dist/charts/softwarediagrams/ComponentDiagram.js +504 -0
  24. package/dist/charts/softwarediagrams/DeploymentDiagram.js +419 -0
  25. package/dist/charts/softwarediagrams/SoftwareSamples.js +283 -1
  26. package/dist/charts/softwarediagrams/index.js +7 -3
  27. package/dist/charts/softwarediagrams/softwareEnums.js +45 -1
  28. package/dist/charts/sportscharts/PowerDurationCurve.js +301 -0
  29. package/dist/charts/sportscharts/SportsSamples.js +102 -0
  30. package/dist/charts/sportscharts/TrainingLoadChart.js +325 -0
  31. package/dist/charts/sportscharts/index.js +6 -2
  32. package/dist/charts/strategycharts/BassDiffusionChart.js +362 -0
  33. package/dist/charts/strategycharts/BassModel.js +96 -0
  34. package/dist/charts/strategycharts/BurnRunwayChart.js +284 -0
  35. package/dist/charts/strategycharts/CapTableChart.js +366 -0
  36. package/dist/charts/strategycharts/KanbanBoard.js +324 -0
  37. package/dist/charts/strategycharts/OkrTree.js +339 -0
  38. package/dist/charts/strategycharts/StrategyPane.js +27 -0
  39. package/dist/charts/strategycharts/StrategySamples.js +251 -0
  40. package/dist/charts/strategycharts/index.js +15 -3
  41. package/dist/charts/threefields/BsfcMap3DChart.js +231 -0
  42. package/dist/charts/threefields/CompressorMap3DChart.js +217 -0
  43. package/dist/charts/threefields/FieldGrid.js +50 -0
  44. package/dist/charts/threefields/LossLandscape3DChart.js +201 -0
  45. package/dist/charts/threefields/MapSheet.js +77 -0
  46. package/dist/charts/threefields/TerrainRoute3DChart.js +201 -0
  47. package/dist/charts/threefields/TerrainRouteMath.js +40 -0
  48. package/dist/charts/threefields/ThreeFieldBase.js +117 -0
  49. package/dist/charts/threefields/ThreeFieldsSamples.js +80 -0
  50. package/dist/charts/threefields/WaferMap3DChart.js +218 -0
  51. package/dist/charts/threefields/index.js +19 -0
  52. package/dist/charts/threesurfaces/index.js +2 -2
  53. package/dist/charts/tradingcharts/KeltnerChannelChart.js +171 -0
  54. package/dist/charts/tradingcharts/TradingMath.js +20 -0
  55. package/dist/charts/tradingcharts/index.js +4 -2
  56. package/dist/{chunk-ZL6XDXMK.cjs → chunk-26PSLEP4.cjs} +8 -8
  57. package/dist/{chunk-W3US6EFP.cjs → chunk-2BO5DZUP.cjs} +12 -12
  58. package/dist/{chunk-5DP7OUSE.cjs → chunk-2GG5YYSC.cjs} +6 -6
  59. package/dist/{chunk-7FG4JSVO.cjs → chunk-2GL2VNJU.cjs} +253 -33
  60. package/dist/{chunk-LCWMRCLF.cjs → chunk-2PYOI7OY.cjs} +21 -21
  61. package/dist/{chunk-JFWJAEBD.cjs → chunk-3U4MCSKI.cjs} +4 -4
  62. package/dist/{chunk-CUPLHZRR.cjs → chunk-3ZMM3FSK.cjs} +4 -4
  63. package/dist/{chunk-L2AV62DP.cjs → chunk-4767WQJ7.cjs} +6 -6
  64. package/dist/{chunk-DA2EYIIP.cjs → chunk-4E7FSSBF.cjs} +1210 -168
  65. package/dist/{chunk-VS5LQEZB.cjs → chunk-526STI2S.cjs} +5 -5
  66. package/dist/{chunk-RXIMEK6C.cjs → chunk-55767YPI.cjs} +20 -20
  67. package/dist/{chunk-JXLSKIUV.cjs → chunk-5FBQOMMT.cjs} +26 -26
  68. package/dist/{chunk-27PZV5BR.cjs → chunk-5N4Z7MTS.cjs} +4 -4
  69. package/dist/{chunk-KEWCUIQA.cjs → chunk-5WEV6YWA.cjs} +22 -22
  70. package/dist/chunk-5XOVVC5X.cjs +3281 -0
  71. package/dist/{chunk-HK5J7Q2W.cjs → chunk-6HLXVWXU.cjs} +9 -9
  72. package/dist/{chunk-7JG47RW4.cjs → chunk-6LQT4WJ5.cjs} +25 -25
  73. package/dist/{chunk-OCVTI6X4.cjs → chunk-6YTWOUFD.cjs} +329 -36
  74. package/dist/{chunk-W7IQCAVN.cjs → chunk-7F6W6HKL.cjs} +11 -11
  75. package/dist/{chunk-F2DCJXDM.cjs → chunk-7L6KYU5A.cjs} +21 -21
  76. package/dist/{chunk-GTGR6LPR.cjs → chunk-A4GIN4FE.cjs} +17 -17
  77. package/dist/{chunk-B2CETSR6.cjs → chunk-A4US7SA7.cjs} +5 -5
  78. package/dist/{chunk-3DIF2YYW.cjs → chunk-AOXPBLPW.cjs} +10 -10
  79. package/dist/{chunk-7TTR4UF5.cjs → chunk-ATI45Z4M.cjs} +2 -2
  80. package/dist/{chunk-5BFCIX2V.cjs → chunk-CPPMO4IQ.cjs} +434 -148
  81. package/dist/{chunk-AYZZQ6AC.cjs → chunk-CZ5KGF6Q.cjs} +9 -9
  82. package/dist/{chunk-7THJ3ZBK.cjs → chunk-D4I35MCE.cjs} +2 -2
  83. package/dist/{chunk-MCPPFRLN.cjs → chunk-DCGAAN3Z.cjs} +2 -2
  84. package/dist/{chunk-VABL6CVX.cjs → chunk-DEY36N37.cjs} +21 -21
  85. package/dist/{chunk-RNCKGJCC.cjs → chunk-DXHXD3DK.cjs} +3 -3
  86. package/dist/{chunk-A56ZGMVZ.cjs → chunk-E7B45DBZ.cjs} +11 -11
  87. package/dist/{chunk-DOR6L4MT.cjs → chunk-EJC6EAC5.cjs} +18 -18
  88. package/dist/{chunk-UPGNM7MA.cjs → chunk-EULJOOMA.cjs} +11 -11
  89. package/dist/{chunk-G4AZL4GO.cjs → chunk-EYM6LEIF.cjs} +474 -70
  90. package/dist/{chunk-NJ4X6XGV.cjs → chunk-EZTYX2GH.cjs} +5 -5
  91. package/dist/chunk-FDD4UP73.cjs +521 -0
  92. package/dist/{chunk-WJ3VH2Q4.cjs → chunk-GEAIGM3J.cjs} +110 -615
  93. package/dist/{chunk-P3SBHF43.cjs → chunk-GRUYVXTS.cjs} +2 -2
  94. package/dist/{chunk-NX4Z5LMS.cjs → chunk-H3SZXND5.cjs} +5 -5
  95. package/dist/{chunk-EE4S4TOE.cjs → chunk-HS45TOFJ.cjs} +21 -21
  96. package/dist/chunk-INGOG6OV.cjs +899 -0
  97. package/dist/{chunk-UDKA6DGT.cjs → chunk-J3CDXZHF.cjs} +4 -4
  98. package/dist/{chunk-YO6G7TKI.cjs → chunk-JAU5ADEU.cjs} +11 -11
  99. package/dist/{chunk-22LBK4GA.cjs → chunk-JQEBSHX3.cjs} +4 -4
  100. package/dist/{chunk-RXX3U7VQ.cjs → chunk-KLXGLMFU.cjs} +10 -10
  101. package/dist/chunk-KVOX36J3.cjs +327 -0
  102. package/dist/chunk-L6BGNHFL.cjs +139 -0
  103. package/dist/{chunk-GMER35L3.cjs → chunk-L7TB7PU5.cjs} +20 -20
  104. package/dist/{chunk-AFXYNBL2.cjs → chunk-LBTRYEM2.cjs} +4 -4
  105. package/dist/{chunk-WYYCKIOD.cjs → chunk-LLULNJSP.cjs} +11 -11
  106. package/dist/{chunk-J27XOSLP.cjs → chunk-LSO46AFV.cjs} +8 -8
  107. package/dist/{chunk-5XJO45ES.cjs → chunk-LZ2KJ7ZX.cjs} +11 -11
  108. package/dist/chunk-M4IQ5LIZ.cjs +422 -0
  109. package/dist/{chunk-Y2KIUKJF.cjs → chunk-MPDHDKYZ.cjs} +11 -11
  110. package/dist/{chunk-4EMPKRZU.cjs → chunk-MRQ42ZJE.cjs} +3 -3
  111. package/dist/{chunk-EU5D2MF4.cjs → chunk-MYV4KZWP.cjs} +9 -9
  112. package/dist/{chunk-XD7KN4UN.cjs → chunk-MZXVLC24.cjs} +6 -6
  113. package/dist/{chunk-PPSONARU.cjs → chunk-NLBVDFIR.cjs} +41 -2
  114. package/dist/{chunk-L3PEGMGM.cjs → chunk-NY3TBZY4.cjs} +33 -33
  115. package/dist/{chunk-6YNYXXB6.cjs → chunk-OGVVSFAR.cjs} +3 -3
  116. package/dist/{chunk-MLV7QLB6.cjs → chunk-OMTQIQMN.cjs} +6 -6
  117. package/dist/{chunk-BEEOSNK7.cjs → chunk-PEJJ6TXJ.cjs} +15 -144
  118. package/dist/{chunk-SOKOWUF5.cjs → chunk-PPGWHIU7.cjs} +2 -2
  119. package/dist/{chunk-IELWOM2J.cjs → chunk-PPO6SDAN.cjs} +6 -6
  120. package/dist/{chunk-6JTZZCSL.cjs → chunk-PUMKX5F2.cjs} +3 -3
  121. package/dist/{chunk-RFOXFY2U.cjs → chunk-PXBYWCNB.cjs} +190 -799
  122. package/dist/{chunk-3BYXOISI.cjs → chunk-Q3HB3IX6.cjs} +4 -4
  123. package/dist/{chunk-RXCOVONX.cjs → chunk-RBMUOIXE.cjs} +289 -34
  124. package/dist/{chunk-MSBNHCSE.cjs → chunk-RJHGCUUD.cjs} +6 -6
  125. package/dist/{chunk-I6VG7F6Z.cjs → chunk-RSONDMYW.cjs} +708 -141
  126. package/dist/{chunk-GZDNPHMT.cjs → chunk-SHMPFCUE.cjs} +19 -19
  127. package/dist/{chunk-ZIBVCOW6.cjs → chunk-SN4FCXFC.cjs} +19 -19
  128. package/dist/{chunk-7KM52NMN.cjs → chunk-SN5T7WYO.cjs} +2 -2
  129. package/dist/{chunk-7MSZR65Z.cjs → chunk-SQJZGVDR.cjs} +7 -7
  130. package/dist/chunk-SYABFMD7.cjs +633 -0
  131. package/dist/{chunk-2RRFEYFH.cjs → chunk-TICB3MAC.cjs} +16 -16
  132. package/dist/{chunk-AOOKHUV5.cjs → chunk-U7Z7XYR2.cjs} +5 -5
  133. package/dist/{chunk-JEWQAXVG.cjs → chunk-UA2THQFV.cjs} +6 -6
  134. package/dist/{chunk-LHZPAHU3.cjs → chunk-VIK4L2YF.cjs} +112 -521
  135. package/dist/{chunk-4YWMAQ4J.cjs → chunk-VM2Y6BDY.cjs} +4 -4
  136. package/dist/{chunk-IRRKE2ZE.cjs → chunk-VMS3KWYI.cjs} +21 -21
  137. package/dist/{chunk-4SLARW6F.cjs → chunk-VU5NUD46.cjs} +17 -17
  138. package/dist/{chunk-XHY6TVYG.cjs → chunk-VV5CVOF7.cjs} +13 -13
  139. package/dist/{chunk-CCIBPGPZ.cjs → chunk-VYSAWPSS.cjs} +57 -57
  140. package/dist/{chunk-TTNEMQ2A.cjs → chunk-W7YRWEWQ.cjs} +22 -22
  141. package/dist/{chunk-C7MUOGEW.cjs → chunk-X7R5SY62.cjs} +6 -6
  142. package/dist/{chunk-ILR5KBMB.cjs → chunk-XOK3KTSS.cjs} +6 -6
  143. package/dist/{chunk-2CZM2I3T.cjs → chunk-XUIX45VU.cjs} +19 -19
  144. package/dist/{chunk-TGRMPS3A.cjs → chunk-XWH46PVJ.cjs} +165 -43
  145. package/dist/{chunk-WQYXXECR.cjs → chunk-Y5XVMK3K.cjs} +6 -6
  146. package/dist/{chunk-AK4TX2WG.cjs → chunk-YCNKEDTG.cjs} +13 -13
  147. package/dist/{chunk-PJJB24DU.cjs → chunk-YEF7SE3X.cjs} +20 -20
  148. package/dist/{chunk-RVLV4XW6.cjs → chunk-YMTVPMU3.cjs} +22 -22
  149. package/dist/data/index.cjs +2 -2
  150. package/dist/entries/autograph-lazy.cjs +2 -2
  151. package/dist/entries/charts/acoustictransport.cjs +3 -3
  152. package/dist/entries/charts/analysischarts.cjs +3 -3
  153. package/dist/entries/charts/astrocharts.cjs +3 -3
  154. package/dist/entries/charts/bars.cjs +3 -3
  155. package/dist/entries/charts/bayesiancharts.cjs +3 -3
  156. package/dist/entries/charts/biocharts.cjs +3 -3
  157. package/dist/entries/charts/biologycharts.cjs +11 -3
  158. package/dist/entries/charts/biologycharts.d.ts +1 -1
  159. package/dist/entries/charts/biologycharts.js +3 -2
  160. package/dist/entries/charts/business.cjs +3 -3
  161. package/dist/entries/charts/carecharts.cjs +3 -3
  162. package/dist/entries/charts/chemistrycharts.cjs +3 -3
  163. package/dist/entries/charts/civicscharts.cjs +3 -3
  164. package/dist/entries/charts/clinicalcharts.cjs +3 -3
  165. package/dist/entries/charts/comparison.cjs +3 -3
  166. package/dist/entries/charts/demography.cjs +3 -3
  167. package/dist/entries/charts/density.cjs +3 -3
  168. package/dist/entries/charts/diagrams.cjs +3 -3
  169. package/dist/entries/charts/distribution.cjs +3 -3
  170. package/dist/entries/charts/doecharts.cjs +13 -3
  171. package/dist/entries/charts/doecharts.d.ts +1 -1
  172. package/dist/entries/charts/doecharts.js +2 -1
  173. package/dist/entries/charts/earthscience.cjs +3 -3
  174. package/dist/entries/charts/economicscharts.cjs +3 -3
  175. package/dist/entries/charts/energycharts.cjs +3 -3
  176. package/dist/entries/charts/engineering.cjs +3 -3
  177. package/dist/entries/charts/fieldcharts.cjs +7 -3
  178. package/dist/entries/charts/fieldcharts.d.ts +1 -1
  179. package/dist/entries/charts/fieldcharts.js +3 -2
  180. package/dist/entries/charts/financial.cjs +3 -3
  181. package/dist/entries/charts/flow.cjs +3 -3
  182. package/dist/entries/charts/frameworks.cjs +3 -3
  183. package/dist/entries/charts/genomics.cjs +3 -3
  184. package/dist/entries/charts/geoflows.cjs +3 -3
  185. package/dist/entries/charts/geomaps.cjs +3 -3
  186. package/dist/entries/charts/geosciencecharts.cjs +3 -3
  187. package/dist/entries/charts/hierarchy.cjs +3 -3
  188. package/dist/entries/charts/indicators.cjs +3 -3
  189. package/dist/entries/charts/inferencecharts.cjs +3 -3
  190. package/dist/entries/charts/layoutcharts.cjs +3 -3
  191. package/dist/entries/charts/lifescience.cjs +4 -4
  192. package/dist/entries/charts/linesareas.cjs +3 -3
  193. package/dist/entries/charts/logisticscharts.cjs +3 -3
  194. package/dist/entries/charts/machinecharts.cjs +7 -3
  195. package/dist/entries/charts/machinecharts.d.ts +1 -1
  196. package/dist/entries/charts/machinecharts.js +2 -1
  197. package/dist/entries/charts/massive.cjs +3 -3
  198. package/dist/entries/charts/mathematical.cjs +3 -3
  199. package/dist/entries/charts/matrix.cjs +3 -3
  200. package/dist/entries/charts/medicalcharts.cjs +4 -4
  201. package/dist/entries/charts/mlcharts.cjs +4 -4
  202. package/dist/entries/charts/modelcharts.cjs +6 -5
  203. package/dist/entries/charts/multivariate.cjs +3 -3
  204. package/dist/entries/charts/musiccharts.cjs +3 -3
  205. package/dist/entries/charts/network.cjs +3 -3
  206. package/dist/entries/charts/physicscharts.cjs +3 -3
  207. package/dist/entries/charts/pictorial.cjs +4 -4
  208. package/dist/entries/charts/portfoliocharts.cjs +3 -3
  209. package/dist/entries/charts/productcharts.cjs +3 -3
  210. package/dist/entries/charts/proportion.cjs +3 -3
  211. package/dist/entries/charts/qualitycharts.cjs +3 -3
  212. package/dist/entries/charts/radial.cjs +3 -3
  213. package/dist/entries/charts/reliabilitycharts.cjs +5 -3
  214. package/dist/entries/charts/scatter.cjs +3 -3
  215. package/dist/entries/charts/scientific.cjs +3 -3
  216. package/dist/entries/charts/seriescharts.cjs +3 -3
  217. package/dist/entries/charts/signals.cjs +7 -3
  218. package/dist/entries/charts/signals.d.ts +1 -1
  219. package/dist/entries/charts/signals.js +2 -1
  220. package/dist/entries/charts/softwarediagrams.cjs +21 -3
  221. package/dist/entries/charts/softwarediagrams.d.ts +1 -1
  222. package/dist/entries/charts/softwarediagrams.js +4 -2
  223. package/dist/entries/charts/sportscharts.cjs +13 -3
  224. package/dist/entries/charts/sportscharts.d.ts +1 -1
  225. package/dist/entries/charts/sportscharts.js +3 -1
  226. package/dist/entries/charts/statistics.cjs +6 -6
  227. package/dist/entries/charts/strategycharts.cjs +30 -3
  228. package/dist/entries/charts/strategycharts.d.ts +1 -1
  229. package/dist/entries/charts/strategycharts.js +6 -1
  230. package/dist/entries/charts/structure.cjs +3 -3
  231. package/dist/entries/charts/surveycharts.cjs +3 -3
  232. package/dist/entries/charts/systemscharts.cjs +3 -3
  233. package/dist/entries/charts/textcharts.cjs +5 -5
  234. package/dist/entries/charts/thematicmaps.cjs +4 -4
  235. package/dist/entries/charts/threebars.cjs +3 -3
  236. package/dist/entries/charts/threefields.cjs +53 -0
  237. package/dist/entries/charts/threefields.d.ts +1 -0
  238. package/dist/entries/charts/threefields.js +6 -0
  239. package/dist/entries/charts/threeglobe.cjs +3 -3
  240. package/dist/entries/charts/threenetwork.cjs +3 -3
  241. package/dist/entries/charts/threestrata.cjs +3 -3
  242. package/dist/entries/charts/threesurfaces.cjs +7 -3
  243. package/dist/entries/charts/threesurfaces.d.ts +1 -1
  244. package/dist/entries/charts/threesurfaces.js +2 -1
  245. package/dist/entries/charts/threevolume.cjs +4 -4
  246. package/dist/entries/charts/timeline.cjs +3 -3
  247. package/dist/entries/charts/tracecharts.cjs +3 -3
  248. package/dist/entries/charts/trackscharts.cjs +3 -3
  249. package/dist/entries/charts/tradingcharts.cjs +6 -4
  250. package/dist/entries/charts/tradingcharts.d.ts +1 -1
  251. package/dist/entries/charts/tradingcharts.js +2 -1
  252. package/dist/entries/three.cjs +60 -20
  253. package/dist/entries/three.d.ts +1 -1
  254. package/dist/entries/three.js +7 -1
  255. package/dist/index.cjs +258 -97
  256. package/dist/index.d.cts +1953 -10
  257. package/dist/index.d.ts +1953 -10
  258. package/dist/index.js +26 -5
  259. package/dist/page/index.cjs +2 -2
  260. package/dist/react/components.js +58 -1
  261. package/dist/react/index.cjs +135 -92
  262. package/dist/react/index.d.ts +1 -1
  263. package/dist/react/index.js +2 -2
  264. package/package.json +1 -1
  265. package/dist/AutoGraph-XLBJQDRB.cjs +0 -140
  266. package/dist/catalog-O7XGDD2H.cjs +0 -137
  267. package/dist/chunk-77K2HTRC.cjs +0 -3220
  268. package/dist/chunk-XEK47TVD.cjs +0 -323
  269. /package/dist/{chunk-UMEKIIHJ.cjs → chunk-LNWTC72Y.cjs} +0 -0
@@ -0,0 +1,633 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2;
2
+
3
+ var _chunkCM7X3KFUcjs = require('./chunk-CM7X3KFU.cjs');
4
+
5
+
6
+ var _chunk6KYVL5HYcjs = require('./chunk-6KYVL5HY.cjs');
7
+
8
+
9
+ var _chunkPY4R3IFFcjs = require('./chunk-PY4R3IFF.cjs');
10
+
11
+ // src/charts/threesurfaces/SurfaceBase.ts
12
+ var _d3 = require('d3');
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+ var _three = require('./vendor/three.js');
28
+
29
+ // src/charts/threesurfaces/ColorRamp.ts
30
+
31
+ var ColorRamp = class {
32
+ constructor(fn, lo = 0, hi = 1, size = 128) {
33
+ this.lo = lo;
34
+ this.hi = hi;
35
+ this.table = Array.from({ length: size }, (_, k) => new (0, _three.Color)(fn(lo + (hi - lo) * k / (size - 1))));
36
+ }
37
+
38
+
39
+
40
+ at(t) {
41
+ const position = Number.isFinite(t) ? (t - this.lo) / (this.hi - this.lo) : 0;
42
+ return this.table[Math.round(Math.max(0, Math.min(1, position)) * (this.table.length - 1))];
43
+ }
44
+ };
45
+
46
+ // src/charts/threesurfaces/SurfaceGeometry.ts
47
+
48
+ var _BufferGeometryUtilsjs = require('three/addons/utils/BufferGeometryUtils.js');
49
+ var SurfaceGeometry = class _SurfaceGeometry {
50
+ /** `nx × ny` vertex lattice. A vertex with a non-finite coordinate is a hole and its triangles are skipped. */
51
+ static grid(nx, ny, place, paint, wrap = {}) {
52
+ const positions = new Float32Array(nx * ny * 3), colors = new Float32Array(nx * ny * 3), solid = new Uint8Array(nx * ny);
53
+ for (let j = 0; j < ny; j++) for (let i = 0; i < nx; i++) {
54
+ const point = place(i, j), k = i + j * nx;
55
+ if (!point.every(Number.isFinite)) continue;
56
+ solid[k] = 1;
57
+ positions.set(point, k * 3);
58
+ const color = paint(i, j);
59
+ colors.set([color.r, color.g, color.b], k * 3);
60
+ }
61
+ const indices = [];
62
+ const cellsX = wrap.x ? nx : nx - 1, cellsY = wrap.y ? ny : ny - 1;
63
+ for (let j = 0; j < cellsY; j++) for (let i = 0; i < cellsX; i++) {
64
+ const a = i + j * nx, b = (i + 1) % nx + j * nx, c = i + (j + 1) % ny * nx, d = (i + 1) % nx + (j + 1) % ny * nx;
65
+ if (solid[a] && solid[b] && solid[d]) indices.push(a, d, b);
66
+ if (solid[a] && solid[d] && solid[c]) indices.push(a, c, d);
67
+ }
68
+ const geometry = new (0, _three.BufferGeometry)();
69
+ geometry.setAttribute("position", new (0, _three.Float32BufferAttribute)(positions, 3));
70
+ geometry.setAttribute("color", new (0, _three.Float32BufferAttribute)(colors, 3));
71
+ geometry.setIndex(indices);
72
+ geometry.computeVertexNormals();
73
+ return geometry;
74
+ }
75
+ /** Split shared vertices so each triangle shades flat. `userData.source` keeps the way back to the grid for picking. */
76
+ static faceted(geometry) {
77
+ const source = Uint32Array.from(_nullishCoalesce(_optionalChain([geometry, 'access', _3 => _3.getIndex, 'call', _4 => _4(), 'optionalAccess', _5 => _5.array]), () => ( [])));
78
+ const flat = geometry.toNonIndexed();
79
+ flat.computeVertexNormals();
80
+ flat.userData.source = source;
81
+ return flat;
82
+ }
83
+ /** Vertical wall hanging from a polyline to `base`, with colours for its top and bottom edges. */
84
+ static curtain(top, base, upper, lower) {
85
+ const floor = typeof base === "number" ? () => base : base;
86
+ const finite = top.map((point) => point.every(Number.isFinite));
87
+ return _SurfaceGeometry.grid(
88
+ top.length,
89
+ 2,
90
+ (k, row) => finite[k] ? row ? top[k] : [top[k][0], floor(k), top[k][2]] : [NaN, NaN, NaN],
91
+ (k, row) => row ? upper(k) : lower(k)
92
+ );
93
+ }
94
+ /** A curtain with thickness along `(dx, dz)`: front, back and lid. */
95
+ static slab(top, [dx, dz], base, upper, lower) {
96
+ const shift = (sign) => top.map(([x, y, z]) => [x + dx * sign / 2, y, z + dz * sign / 2]);
97
+ const front = shift(1), back = shift(-1);
98
+ const lid = _SurfaceGeometry.grid(top.length, 2, (k, row) => (row ? back : front)[k], upper);
99
+ const ends = [0, top.length - 1].map((k) => {
100
+ const floor = typeof base === "number" ? base : base(k);
101
+ const wall = (point) => [[point[0], floor, point[2]], point];
102
+ return _SurfaceGeometry.grid(2, 2, (i, row) => wall((i ? back : front)[k])[row], (_, row) => row ? upper(k) : lower(k));
103
+ });
104
+ return _SurfaceGeometry.merge([_SurfaceGeometry.curtain(front, base, upper, lower), _SurfaceGeometry.curtain(back, base, upper, lower), lid, ...ends]);
105
+ }
106
+ /** Drop vertices no triangle uses. `userData.source` maps the survivors back to their original index. */
107
+ static compact(geometry) {
108
+ const index = geometry.getIndex();
109
+ const source = [...new Set(index.array)], renumber = new Map(source.map((vertex, k) => [vertex, k]));
110
+ const out = new (0, _three.BufferGeometry)();
111
+ for (const name of Object.keys(geometry.attributes)) {
112
+ const attribute = geometry.getAttribute(name), size = attribute.itemSize;
113
+ const values = new Float32Array(source.length * size);
114
+ source.forEach((vertex, k) => {
115
+ for (let c = 0; c < size; c++) values[k * size + c] = attribute.array[vertex * size + c];
116
+ });
117
+ out.setAttribute(name, new (0, _three.Float32BufferAttribute)(values, size));
118
+ }
119
+ out.setIndex(Array.from(index.array, (vertex) => renumber.get(vertex)));
120
+ out.userData.source = Uint32Array.from(source);
121
+ return out;
122
+ }
123
+ /** Give a three.js primitive the uniform vertex colour that lets it merge with painted geometry. */
124
+ static tinted(geometry, color) {
125
+ const count = geometry.getAttribute("position").count;
126
+ const colors = new Float32Array(count * 3);
127
+ for (let k = 0; k < count; k++) colors.set([color.r, color.g, color.b], k * 3);
128
+ geometry.setAttribute("color", new (0, _three.Float32BufferAttribute)(colors, 3));
129
+ geometry.deleteAttribute("uv");
130
+ return geometry;
131
+ }
132
+ static merge(parts) {
133
+ const unified = parts.filter((part) => part.getAttribute("position").count).map((part) => part.index ? part : indexed(part));
134
+ return _nullishCoalesce((unified.length ? _BufferGeometryUtilsjs.mergeGeometries.call(void 0, unified) : null), () => ( new (0, _three.BufferGeometry)()));
135
+ }
136
+ };
137
+ function indexed(geometry) {
138
+ geometry.setIndex(Array.from({ length: geometry.getAttribute("position").count }, (_, k) => k));
139
+ return geometry;
140
+ }
141
+
142
+ // src/charts/threesurfaces/SurfaceSpace.ts
143
+
144
+ var FLOOR = -0.7;
145
+ var CEIL = 0.75;
146
+ var SurfaceSpace = class _SurfaceSpace {
147
+ constructor(field, kind = "linear" /* Linear */, range = [FLOOR, CEIL], domain = field.zDomain) {
148
+ this.field = field;
149
+ this.range = range;
150
+ this.level = _SurfaceSpace.height(kind, domain, range);
151
+ }
152
+
153
+
154
+
155
+ /** Height scale. Log becomes symlog so zero and negative heights stay on the chart. */
156
+ static height(kind, [lo, hi], range) {
157
+ const scale = kind === "log" /* Log */ || kind === "symlog" /* Symlog */ ? _d3.scaleSymlog.call(void 0, ).constant(Math.max(hi - lo, 1e-9) / 8) : _chunkPY4R3IFFcjs.Scales.continuous(kind);
158
+ return scale.domain([lo, hi]).range(range);
159
+ }
160
+ /** Position of a fractional index along a possibly uneven axis, 0..1. */
161
+ fraction(axis, index) {
162
+ const i = Math.max(0, Math.min(axis.length - 2, Math.floor(index)));
163
+ const span = axis.at(-1) - axis[0] || 1;
164
+ return (axis[i] + (axis[i + 1] - axis[i]) * (index - i) - axis[0]) / span;
165
+ }
166
+ /** World x and z of a fractional grid index. */
167
+ ground(fi, fj) {
168
+ return [this.fraction(this.field.x, fi) * 2 - 1, 1 - this.fraction(this.field.y, fj) * 2];
169
+ }
170
+ at(fi, fj, lift = 0) {
171
+ const [x, z] = this.ground(fi, fj);
172
+ return [x, this.level(this.field.sample(fi, fj)) + lift, z];
173
+ }
174
+ floor(fi, fj, lift = 0) {
175
+ const [x, z] = this.ground(fi, fj);
176
+ return [x, this.range[0] + lift, z];
177
+ }
178
+ };
179
+ var PolarSurfaceSpace = class extends SurfaceSpace {
180
+ constructor(field, kind, sweep, inner, swap = false) {
181
+ super(field, kind);
182
+ this.sweep = sweep;
183
+ this.inner = inner;
184
+ this.swap = swap;
185
+ }
186
+
187
+
188
+
189
+ polar(angle, radius) {
190
+ const a = ((angle - 0.5) * this.sweep - 90) * (Math.PI / 180);
191
+ return [Math.cos(a) * radius, Math.sin(a) * radius];
192
+ }
193
+ ground(fi, fj) {
194
+ const { x, y } = this.field;
195
+ const angular = this.swap ? y : x, radial = this.swap ? x : y;
196
+ const turn = this.fraction(angular, this.swap ? fj : fi) * (this.sweep === 360 ? (angular.length - 1) / angular.length : 1);
197
+ return this.polar(turn, this.inner + (1 - this.inner) * this.fraction(radial, this.swap ? fi : fj));
198
+ }
199
+ };
200
+
201
+ // src/charts/threesurfaces/TubeBatch.ts
202
+
203
+ var WHITE = new (0, _three.Color)(1, 1, 1);
204
+ var WEIGHT = 1.6;
205
+ var TubeBatch = (_class = class {
206
+ constructor(radius = 65e-4, sides = 5) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);
207
+ this.radius = radius;
208
+ this.sides = sides;
209
+ }
210
+
211
+
212
+ __init() {this.positions = []}
213
+ __init2() {this.normals = []}
214
+ __init3() {this.colors = []}
215
+ __init4() {this.indices = []}
216
+ /** Add a polyline. A non-finite point breaks it into separate runs. */
217
+ add(path, paint = WHITE, radius = this.radius) {
218
+ radius *= WEIGHT;
219
+ let run = [], first = 0;
220
+ const flush = (start) => {
221
+ if (run.length > 1) this.tube(run, start, paint, radius);
222
+ run = [];
223
+ };
224
+ path.forEach((point, k) => {
225
+ if (!point.every(Number.isFinite)) return flush(first);
226
+ const next = new (0, _three.Vector3)(...point);
227
+ if (run.length && run.at(-1).distanceToSquared(next) < 1e-10) return;
228
+ if (!run.length) first = k;
229
+ run.push(next);
230
+ });
231
+ flush(first);
232
+ return this;
233
+ }
234
+ tube(run, start, paint, radius) {
235
+ const { sides } = this;
236
+ const base = this.positions.length / 3;
237
+ const tangent = new (0, _three.Vector3)(), side = new (0, _three.Vector3)(), up = new (0, _three.Vector3)(), ring = new (0, _three.Vector3)();
238
+ tangent.subVectors(run[1], run[0]).normalize();
239
+ side.set(Math.abs(tangent.y) > 0.9 ? 1 : 0, Math.abs(tangent.y) > 0.9 ? 0 : 1, 0);
240
+ run.forEach((point, k) => {
241
+ tangent.subVectors(run[Math.min(k + 1, run.length - 1)], run[Math.max(k - 1, 0)]).normalize();
242
+ side.addScaledVector(tangent, -side.dot(tangent)).normalize();
243
+ up.crossVectors(tangent, side);
244
+ const color = typeof paint === "function" ? paint(start + k) : paint;
245
+ for (let s = 0; s < sides; s++) {
246
+ const angle = s / sides * Math.PI * 2;
247
+ ring.copy(side).multiplyScalar(Math.cos(angle)).addScaledVector(up, Math.sin(angle));
248
+ this.positions.push(point.x + ring.x * radius, point.y + ring.y * radius, point.z + ring.z * radius);
249
+ this.normals.push(ring.x, ring.y, ring.z);
250
+ this.colors.push(color.r, color.g, color.b);
251
+ }
252
+ });
253
+ for (let k = 0; k < run.length - 1; k++) for (let s = 0; s < sides; s++) {
254
+ const a = base + k * sides + s, b = base + k * sides + (s + 1) % sides, c = a + sides, d = b + sides;
255
+ this.indices.push(a, b, c, b, d, c);
256
+ }
257
+ }
258
+ get empty() {
259
+ return !this.indices.length;
260
+ }
261
+ geometry() {
262
+ const geometry = new (0, _three.BufferGeometry)();
263
+ geometry.setAttribute("position", new (0, _three.Float32BufferAttribute)(this.positions, 3));
264
+ geometry.setAttribute("normal", new (0, _three.Float32BufferAttribute)(this.normals, 3));
265
+ geometry.setAttribute("color", new (0, _three.Float32BufferAttribute)(this.colors, 3));
266
+ geometry.setIndex(this.indices);
267
+ return geometry;
268
+ }
269
+ }, _class);
270
+
271
+ // src/charts/threesurfaces/SurfaceBase.ts
272
+ var SurfaceOverlay = /* @__PURE__ */ ((SurfaceOverlay2) => {
273
+ SurfaceOverlay2["None"] = "bare";
274
+ SurfaceOverlay2["Mesh"] = "mesh-lines";
275
+ SurfaceOverlay2["Contours"] = "contour-lines";
276
+ return SurfaceOverlay2;
277
+ })(SurfaceOverlay || {});
278
+ var SurfaceProjection = /* @__PURE__ */ ((SurfaceProjection2) => {
279
+ SurfaceProjection2["None"] = "unprojected";
280
+ SurfaceProjection2["FloorContours"] = "floor-contours";
281
+ SurfaceProjection2["FloorHeatmap"] = "floor-heatmap";
282
+ SurfaceProjection2["Walls"] = "wall-profiles";
283
+ return SurfaceProjection2;
284
+ })(SurfaceProjection || {});
285
+ var LINE = 65e-4;
286
+ var SurfaceBase = class extends _chunk6KYVL5HYcjs.Chart3D {
287
+ defaults() {
288
+ return { azimuth: 38, elevation: 26, distance: 5.2 };
289
+ }
290
+ ticks(domain, map, count = 4) {
291
+ const reach = Math.abs(domain[1] - domain[0]);
292
+ return _d3.scaleLinear.call(void 0, domain, [0, 1]).ticks(count).map((value) => [map(value), _chunkPY4R3IFFcjs.Scales.format(value, reach)]);
293
+ }
294
+ /** Back walls and floor with gridlines at the ticks. The walls swap sides as the camera orbits, so they never block the data. */
295
+ box(ctx, { x, y, z }, { walls = true, bottom = FLOOR, outline = true } = {}) {
296
+ const stage = new (0, _three.Group)();
297
+ const grid = new (0, _three.LineBasicMaterial)({ color: ctx.theme.grid }), edge = new (0, _three.LineBasicMaterial)({ color: ctx.theme.axis });
298
+ const lines = (points, material) => {
299
+ const geometry = new (0, _three.BufferGeometry)();
300
+ geometry.setAttribute("position", new (0, _three.Float32BufferAttribute)(points, 3));
301
+ return new (0, _three.LineSegments)(geometry, material);
302
+ };
303
+ const top = walls ? Math.max(CEIL, bottom) : bottom;
304
+ stage.add(lines([...x.flatMap(([at]) => [at, bottom, -1, at, bottom, 1]), ...y.flatMap(([at]) => [-1, bottom, at, 1, bottom, at])], grid));
305
+ if (outline) stage.add(lines([-1, bottom, -1, 1, bottom, -1, 1, bottom, -1, 1, bottom, 1, 1, bottom, 1, -1, bottom, 1, -1, bottom, 1, -1, bottom, -1], edge));
306
+ const catcher = new (0, _three.Mesh)(new (0, _three.PlaneGeometry)(2, 2), new (0, _three.ShadowMaterial)({ opacity: 0.16 }));
307
+ catcher.rotation.x = -Math.PI / 2;
308
+ catcher.position.y = bottom - 2e-3;
309
+ catcher.receiveShadow = true;
310
+ stage.add(catcher);
311
+ if (walls) {
312
+ const across = lines([...x.flatMap(([at]) => [at, bottom, -1, at, top, -1]), ...z.flatMap(([at]) => [-1, at, -1, 1, at, -1])], grid);
313
+ const along = lines([...y.flatMap(([at]) => [-1, bottom, at, -1, top, at]), ...z.flatMap(([at]) => [-1, at, -1, -1, at, 1])], grid);
314
+ stage.add(across, along);
315
+ catcher.onBeforeRender = (_renderer, _scene, camera) => {
316
+ across.position.z = camera.position.z >= 0 ? 0 : 2;
317
+ along.position.x = camera.position.x >= 0 ? 0 : 2;
318
+ across.updateMatrixWorld();
319
+ along.updateMatrixWorld();
320
+ };
321
+ }
322
+ ctx.root.add(stage);
323
+ const { xLabel, yLabel, zLabel } = this.options;
324
+ for (const [at, text] of x) ctx.label(text, [at, bottom - 0.03, 1.12], "muted", 10);
325
+ for (const [at, text] of y) ctx.label(text, [1.13, bottom - 0.03, at], "muted", 10);
326
+ if (walls) for (const [at, text] of z) ctx.label(text, [-1.1, at, 1.02], "muted", 10);
327
+ const longest = Math.max(0, ...y.map(([, text]) => text.length));
328
+ if (xLabel && x.some(([, text]) => text)) ctx.label(xLabel, [0, bottom - 0.03, 1.5], "secondary", 11);
329
+ if (yLabel && y.some(([, text]) => text)) ctx.label(yLabel, [1.4 + longest * 0.04, bottom - 0.03, 0], "secondary", 11);
330
+ if (zLabel && walls) ctx.label(zLabel, [-1.1, CEIL + 0.12, 1.02], "secondary", 11);
331
+ }
332
+ /** Group that grows out of the floor on entry. */
333
+ rise(ctx, floor = FLOOR) {
334
+ const group = new (0, _three.Group)();
335
+ ctx.reveal((progress) => {
336
+ group.scale.y = Math.max(1e-3, progress);
337
+ group.position.y = floor * (1 - group.scale.y);
338
+ }, 1.1);
339
+ ctx.root.add(group);
340
+ return group;
341
+ }
342
+ /** Group that scales and turns into place, for free-standing shapes. */
343
+ bloom(ctx) {
344
+ const group = new (0, _three.Group)();
345
+ ctx.reveal((progress) => {
346
+ group.scale.setScalar(Math.max(1e-3, progress));
347
+ group.rotation.y = (progress - 1) * 1.2;
348
+ }, 1.3);
349
+ ctx.root.add(group);
350
+ return group;
351
+ }
352
+ /** Height colour: polarity when the data crosses zero, magnitude otherwise. */
353
+ painter(ctx, [lo, hi]) {
354
+ const scale = _nullishCoalesce(this.options.color, () => ( (lo < 0 && hi > 0 ? "diverging" /* Diverging */ : "sequential" /* Sequential */)));
355
+ if (scale === "diverging" /* Diverging */) {
356
+ const ramp2 = new ColorRamp(ctx.palette.diverging, -1, 1), reach = Math.max(Math.abs(lo), Math.abs(hi)) || 1;
357
+ return (value) => ramp2.at(value / reach);
358
+ }
359
+ const ramp = new ColorRamp(ctx.palette.sequential);
360
+ return (value) => ramp.at(0.05 + 0.95 * (value - lo) / (hi - lo || 1));
361
+ }
362
+ material(overrides = {}) {
363
+ return new (0, _three.MeshStandardMaterial)({ vertexColors: true, side: _three.DoubleSide, roughness: 0.62, metalness: 0, ...overrides });
364
+ }
365
+ /** Painted, shadow-casting surface. `pick` receives the nearest vertex. */
366
+ solid(ctx, geometry, parent, pick, overrides) {
367
+ const mesh = new (0, _chunkCM7X3KFUcjs.SurfaceMesh)(geometry, this.material(overrides));
368
+ mesh.castShadow = true;
369
+ parent.add(mesh);
370
+ if (pick) ctx.pick(mesh, pick);
371
+ return mesh;
372
+ }
373
+ /** Draw a tube batch. Pass `color` for a single tone; otherwise the batch's own colours are used. */
374
+ tubes(batch, parent, color, opacity = 1) {
375
+ if (batch.empty) return null;
376
+ const mesh = new (0, _three.Mesh)(batch.geometry(), this.material({ vertexColors: !color, side: 0, roughness: 0.5, ...color ? { color } : {}, transparent: opacity < 1, opacity }));
377
+ parent.add(mesh);
378
+ return mesh;
379
+ }
380
+ /** Round markers on one instanced mesh; sizes in world units. */
381
+ dots(ctx, points, radius, paint, parent, pick) {
382
+ if (!points.length) return null;
383
+ const mesh = new (0, _three.InstancedMesh)(new (0, _three.SphereGeometry)(1, 12, 10), new (0, _three.MeshStandardMaterial)({ roughness: 0.45 }), points.length);
384
+ const dummy = new (0, _three.Object3D)();
385
+ points.forEach((point, k) => {
386
+ dummy.position.set(...point);
387
+ dummy.scale.setScalar(typeof radius === "number" ? radius : radius(k));
388
+ dummy.updateMatrix();
389
+ mesh.setMatrixAt(k, dummy.matrix);
390
+ mesh.setColorAt(k, paint(k));
391
+ });
392
+ mesh.castShadow = true;
393
+ parent.add(mesh);
394
+ if (pick) ctx.pick(mesh, pick);
395
+ return mesh;
396
+ }
397
+ /** Thin surface-coloured lattice that reveals the shape of the mesh without adding a new hue. */
398
+ meshLines(ctx, space, parent, cells = 12) {
399
+ const { nx, ny } = space.field;
400
+ const batch = new TubeBatch(LINE * 0.7), stepX = Math.max(1, Math.round((nx - 1) / cells)), stepY = Math.max(1, Math.round((ny - 1) / cells));
401
+ const columns = Array.from({ length: Math.ceil(nx / stepX) }, (_, k) => k * stepX), rows = Array.from({ length: Math.ceil(ny / stepY) }, (_, k) => k * stepY);
402
+ for (const i of columns) batch.add(Array.from({ length: ny }, (_, j) => space.at(i, j, 3e-3)));
403
+ for (const j of rows) batch.add(Array.from({ length: nx }, (_, i) => space.at(i, j, 3e-3)));
404
+ this.tubes(batch, parent, ctx.theme.surface, 0.8);
405
+ }
406
+ thresholds({ zMin, zMax, zDomain }, levels) {
407
+ if (zMax === zMin) return [zDomain[0]];
408
+ return Array.from({ length: levels }, (_, k) => zMin + (k + 1) * (zMax - zMin) / (levels + 1));
409
+ }
410
+ contourLines(ctx, space, parent, levels = 8) {
411
+ const batch = new TubeBatch(LINE * 0.6);
412
+ for (const { paths } of space.field.lines(this.thresholds(space.field, levels))) {
413
+ for (const path of paths) batch.add(path.map(([i, j]) => space.at(i, j, 4e-3)));
414
+ }
415
+ this.tubes(batch, parent, ctx.theme.ink, 0.55);
416
+ }
417
+ floorContours(ctx, space, paint, levels = 8) {
418
+ const batch = new TubeBatch(LINE * 0.7);
419
+ for (const { value, paths } of space.field.lines(this.thresholds(space.field, levels))) {
420
+ const color = paint(value);
421
+ for (const path of paths) batch.add(path.map(([i, j]) => space.floor(i, j, 6e-3)), color);
422
+ }
423
+ this.tubes(batch, ctx.root);
424
+ }
425
+ floorHeatmap(ctx, space, paint) {
426
+ const { field } = space;
427
+ this.solid(ctx, SurfaceGeometry.grid(field.nx, field.ny, (i, j) => Number.isNaN(field.at(i, j)) ? [NaN, NaN, NaN] : space.floor(i, j, 4e-3), (i, j) => paint(field.at(i, j))), ctx.root).castShadow = false;
428
+ }
429
+ /** The surface's upper envelope along each axis, drawn as a silhouette on the back walls. */
430
+ wallProfiles(ctx, space, paint) {
431
+ const { field } = space;
432
+ const envelope = (count, across, read) => Array.from({ length: count }, (_, k) => {
433
+ let top = -Infinity;
434
+ for (let c = 0; c < across; c++) {
435
+ const value = read(k, c);
436
+ if (value > top) top = value;
437
+ }
438
+ return top;
439
+ });
440
+ const low = paint(field.zDomain[0]);
441
+ const wall = (peaks, place) => {
442
+ const top = peaks.map((peak, k) => place(k, Number.isFinite(peak) ? space.level(peak) : NaN));
443
+ const batch = new TubeBatch(LINE).add(top, (k) => paint(peaks[k]));
444
+ this.solid(ctx, SurfaceGeometry.curtain(top, FLOOR, (k) => paint(peaks[k]), () => low), ctx.root, void 0, { transparent: true, opacity: 0.4, depthWrite: false }).castShadow = false;
445
+ this.tubes(batch, ctx.root);
446
+ };
447
+ wall(envelope(field.nx, field.ny, (i, j) => field.at(i, j)), (i, h) => [space.ground(i, 0)[0], h, -0.995]);
448
+ wall(envelope(field.ny, field.nx, (j, i) => field.at(i, j)), (j, h) => [-0.995, h, space.ground(0, j)[1]]);
449
+ }
450
+ /** Vertical wall from the surface's boundary to the floor, turning the sheet into a solid. */
451
+ skirt(ctx, space, paint, parent, sides = [0, 1, 2, 3], closed = false) {
452
+ const { nx, ny } = space.field;
453
+ const edges = [
454
+ Array.from({ length: nx }, (_, i) => [i, 0]),
455
+ Array.from({ length: ny }, (_, j) => [nx - 1, j]),
456
+ Array.from({ length: nx }, (_, i) => [i, ny - 1]),
457
+ Array.from({ length: ny }, (_, j) => [0, j])
458
+ ];
459
+ const low = paint(space.field.zDomain[0]);
460
+ const parts = sides.map((side) => closed ? [...edges[side], edges[side][0]] : edges[side]).map((edge) => SurfaceGeometry.curtain(edge.map(([i, j]) => space.at(i, j)), FLOOR, (k) => paint(space.field.at(...edge[k])), () => low));
461
+ this.solid(ctx, SurfaceGeometry.merge(parts), parent);
462
+ }
463
+ };
464
+
465
+ // src/charts/threesurfaces/SurfaceField.ts
466
+
467
+ var numeric = (cell) => {
468
+ if (cell === null || cell === void 0 || cell === "") return NaN;
469
+ const value = +cell;
470
+ return Number.isFinite(value) ? value : NaN;
471
+ };
472
+ var catmullRom = (a, b, c, d, t) => b + 0.5 * t * (c - a + t * (2 * a - 5 * b + 4 * c - d + t * (3 * (b - c) + d - a)));
473
+ var SurfaceField = (_class2 = class _SurfaceField {
474
+ constructor(x, y, z) {;_class2.prototype.__init5.call(this);
475
+ this.x = x;
476
+ this.y = y;
477
+ this.z = z;
478
+ this.nx = x.length;
479
+ this.ny = y.length;
480
+ const [lo, hi] = _d3.extent.call(void 0, z);
481
+ this.zMin = _nullishCoalesce(lo, () => ( 0));
482
+ this.zMax = _nullishCoalesce(hi, () => ( 1));
483
+ }
484
+
485
+
486
+
487
+
488
+
489
+
490
+
491
+ static empty() {
492
+ return new _SurfaceField([0, 1], [0, 1], new Float64Array(4).fill(NaN));
493
+ }
494
+ static from(data, columns = {}) {
495
+ if (Array.isArray(data)) return _SurfaceField.pivot(data, columns);
496
+ if (!_optionalChain([data, 'optionalAccess', _6 => _6.x, 'optionalAccess', _7 => _7.length]) || !_optionalChain([data, 'access', _8 => _8.y, 'optionalAccess', _9 => _9.length]) || !_optionalChain([data, 'access', _10 => _10.z, 'optionalAccess', _11 => _11.length])) return _SurfaceField.empty();
497
+ const z = new Float64Array(data.x.length * data.y.length);
498
+ data.y.forEach((_, j) => data.x.forEach((_2, i) => {
499
+ z[i + j * data.x.length] = numeric(_optionalChain([data, 'access', _12 => _12.z, 'access', _13 => _13[j], 'optionalAccess', _14 => _14[i]]));
500
+ }));
501
+ return _SurfaceField.widened(data.x.map(Number), data.y.map(Number), z);
502
+ }
503
+ /** Long rows to grid: duplicate cells average, missing cells become holes, text axes index by first appearance. */
504
+ static pivot(rows, { x = "x", y = "y", z = "z" }) {
505
+ if (!rows.length) return _SurfaceField.empty();
506
+ const axis = (column) => {
507
+ const seen = [...new Set(rows.map((row) => row[column]))].filter((cell) => cell !== null && cell !== void 0);
508
+ if (seen.every((cell) => Number.isFinite(numeric(cell)))) return new Map([...new Set(seen.map(numeric))].sort((a, b) => a - b).map((value, i) => [value, i]));
509
+ return new Map(seen.map((cell, i) => [cell, i]));
510
+ };
511
+ const lookup = (map, cell) => _nullishCoalesce(map.get(cell), () => ( map.get(numeric(cell))));
512
+ const xs = axis(x), ys = axis(y);
513
+ if (!xs.size || !ys.size) return _SurfaceField.empty();
514
+ const totals = new Float64Array(xs.size * ys.size), counts = new Uint32Array(xs.size * ys.size);
515
+ for (const row of rows) {
516
+ const i = lookup(xs, row[x]), j = lookup(ys, row[y]), value = numeric(row[z]);
517
+ if (i === void 0 || j === void 0 || Number.isNaN(value)) continue;
518
+ totals[i + j * xs.size] += value;
519
+ counts[i + j * xs.size]++;
520
+ }
521
+ const values = totals.map((total, k) => counts[k] ? total / counts[k] : NaN);
522
+ const labels = (map) => [...map.keys()].map((key, i) => typeof key === "number" ? key : i);
523
+ return _SurfaceField.widened(labels(xs), labels(ys), values);
524
+ }
525
+ /** A single row or column still needs width to make a surface. */
526
+ static widened(x, y, z) {
527
+ if (x.length > 1 && y.length > 1) return new _SurfaceField(x, y, z);
528
+ const gx = x.length > 1 ? x : [x[0], x[0] + 1], gy = y.length > 1 ? y : [y[0], y[0] + 1];
529
+ const out = new Float64Array(gx.length * gy.length);
530
+ gy.forEach((_, j) => gx.forEach((_2, i) => {
531
+ out[i + j * gx.length] = z[Math.min(i, x.length - 1) + Math.min(j, y.length - 1) * x.length];
532
+ }));
533
+ return new _SurfaceField(gx, gy, out);
534
+ }
535
+ static compute(x, y, fn) {
536
+ const z = new Float64Array(x.length * y.length);
537
+ y.forEach((v, j) => x.forEach((u, i) => {
538
+ const value = fn(u, v);
539
+ z[i + j * x.length] = Number.isFinite(value) ? value : NaN;
540
+ }));
541
+ return new _SurfaceField(x, y, z);
542
+ }
543
+ get xDomain() {
544
+ return [this.x[0], this.x[this.nx - 1]];
545
+ }
546
+ get yDomain() {
547
+ return [this.y[0], this.y[this.ny - 1]];
548
+ }
549
+ get zDomain() {
550
+ return this.zMax > this.zMin ? [this.zMin, this.zMax] : [this.zMin - 1, this.zMin + 1];
551
+ }
552
+ get hasData() {
553
+ return this.z.some((value) => !Number.isNaN(value));
554
+ }
555
+ at(i, j) {
556
+ return this.z[Math.max(0, Math.min(this.nx - 1, i)) + Math.max(0, Math.min(this.ny - 1, j)) * this.nx];
557
+ }
558
+ /** Bilinear read at fractional indices. A hole with any weight makes the read a hole. */
559
+ sample(fi, fj) {
560
+ const i = Math.max(0, Math.min(this.nx - 2, Math.floor(fi))), j = Math.max(0, Math.min(this.ny - 2, Math.floor(fj)));
561
+ const a = fi - i, b = fj - j;
562
+ const part = (weight, value) => weight > 0 ? weight * value : 0;
563
+ return part((1 - a) * (1 - b), this.at(i, j)) + part(a * (1 - b), this.at(i + 1, j)) + part((1 - a) * b, this.at(i, j + 1)) + part(a * b, this.at(i + 1, j + 1));
564
+ }
565
+ /** Catmull-Rom read at fractional indices. */
566
+ cubic(fi, fj) {
567
+ const i = Math.floor(fi), j = Math.floor(fj);
568
+ const row = (r) => catmullRom(this.at(i - 1, r), this.at(i, r), this.at(i + 1, r), this.at(i + 2, r), fi - i);
569
+ return catmullRom(row(j - 1), row(j), row(j + 1), row(j + 2), fj - j);
570
+ }
571
+ resample(nx, ny, smooth = false) {
572
+ const lerp = (axis, t) => {
573
+ const i = Math.min(axis.length - 2, Math.floor(t));
574
+ return axis[i] + (axis[i + 1] - axis[i]) * (t - i);
575
+ };
576
+ const xs = Array.from({ length: nx }, (_, i) => i * (this.nx - 1) / (nx - 1)), ys = Array.from({ length: ny }, (_, j) => j * (this.ny - 1) / (ny - 1));
577
+ const z = new Float64Array(nx * ny);
578
+ ys.forEach((fj, j) => xs.forEach((fi, i) => {
579
+ z[i + j * nx] = smooth ? this.cubic(fi, fj) : this.sample(fi, fj);
580
+ }));
581
+ return new _SurfaceField(xs.map((t) => lerp(this.x, t)), ys.map((t) => lerp(this.y, t)), z);
582
+ }
583
+ /** Keep vertex counts sane when a user hands in a huge grid. */
584
+ capped(limit) {
585
+ return this.nx <= limit && this.ny <= limit ? this : this.resample(Math.min(this.nx, limit), Math.min(this.ny, limit));
586
+ }
587
+ map(fn) {
588
+ const z = this.z.map((value, k) => {
589
+ const out = fn(value, k % this.nx, Math.floor(k / this.nx));
590
+ return Number.isFinite(out) ? out : NaN;
591
+ });
592
+ return new _SurfaceField(this.x, this.y, z);
593
+ }
594
+ raw(thresholds) {
595
+ const clean = this.z.map((value) => Number.isNaN(value) ? -Infinity : value);
596
+ return _d3.contours.call(void 0, ).size([this.nx, this.ny]).thresholds(thresholds)(Array.from(clean));
597
+ }
598
+ __init5() {this.toGrid = ([x, y]) => [Math.max(0, Math.min(this.nx - 1, x - 0.5)), Math.max(0, Math.min(this.ny - 1, y - 0.5))]}
599
+ /** Filled iso-bands: each polygon is an outer ring followed by its holes. */
600
+ bands(thresholds) {
601
+ return this.raw(thresholds).map(({ value, coordinates }) => ({ value, polygons: coordinates.map((polygon) => polygon.map((ring) => ring.map(this.toGrid))) }));
602
+ }
603
+ /** Iso-lines with the grid border removed, so a contour ends at the edge rather than running along it. */
604
+ lines(thresholds) {
605
+ const edge = ([x, y]) => x <= 0 || y <= 0 || x >= this.nx || y >= this.ny;
606
+ return this.raw(thresholds).map(({ value, coordinates }) => ({
607
+ value,
608
+ paths: coordinates.flat().flatMap((ring) => {
609
+ const paths = [[]];
610
+ for (const point of ring) {
611
+ if (edge(point)) {
612
+ if (paths.at(-1).length) paths.push([]);
613
+ } else paths.at(-1).push(this.toGrid(point));
614
+ }
615
+ return paths.filter((path) => path.length > 1);
616
+ })
617
+ }));
618
+ }
619
+ }, _class2);
620
+
621
+
622
+
623
+
624
+
625
+
626
+
627
+
628
+
629
+
630
+
631
+
632
+
633
+ exports.ColorRamp = ColorRamp; exports.SurfaceGeometry = SurfaceGeometry; exports.FLOOR = FLOOR; exports.CEIL = CEIL; exports.SurfaceSpace = SurfaceSpace; exports.PolarSurfaceSpace = PolarSurfaceSpace; exports.TubeBatch = TubeBatch; exports.SurfaceOverlay = SurfaceOverlay; exports.SurfaceProjection = SurfaceProjection; exports.SurfaceBase = SurfaceBase; exports.SurfaceField = SurfaceField;