boardplot 0.0.0-stage → 0.53.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 (818) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE.md +180 -0
  4. package/README.md +208 -2
  5. package/THIRD_PARTY_NOTICES.md +1110 -0
  6. package/dist/DiagnosticDetails-UNYNYCAH.js +69 -0
  7. package/dist/ReaderBox-VOJSJ66R.js +137 -0
  8. package/dist/annotateEngine-DLMFJZ67.js +30 -0
  9. package/dist/build-identity.json +6 -0
  10. package/dist/chunk-24BHMKDD.js +83 -0
  11. package/dist/chunk-263SZKIL.js +8 -0
  12. package/dist/chunk-27QADBDV.js +211 -0
  13. package/dist/chunk-2CVH5E57.js +128 -0
  14. package/dist/chunk-2DOR5SS6.js +446 -0
  15. package/dist/chunk-2EQE4E3I.js +22 -0
  16. package/dist/chunk-2FNNAPCI.js +24 -0
  17. package/dist/chunk-2L2Q53EP.js +251 -0
  18. package/dist/chunk-2LMCD3ZR.js +6 -0
  19. package/dist/chunk-2ND7ZITT.js +3069 -0
  20. package/dist/chunk-2QT5ZUHO.js +2937 -0
  21. package/dist/chunk-2RSG7JYI.js +24 -0
  22. package/dist/chunk-2V6CLH33.js +1392 -0
  23. package/dist/chunk-2VWJ5BGO.js +566 -0
  24. package/dist/chunk-2WNYRWHG.js +51 -0
  25. package/dist/chunk-323YZWYJ.js +548 -0
  26. package/dist/chunk-33PB4V6K.js +382 -0
  27. package/dist/chunk-33PLBIMA.js +176 -0
  28. package/dist/chunk-3A2IEBCN.js +195 -0
  29. package/dist/chunk-3D3D3D23.js +25 -0
  30. package/dist/chunk-3EZRM4YM.js +92 -0
  31. package/dist/chunk-3H2W76TB.js +2353 -0
  32. package/dist/chunk-3JEQGGVD.js +19 -0
  33. package/dist/chunk-3QWZAEW5.js +26 -0
  34. package/dist/chunk-3SIRPKMP.js +12 -0
  35. package/dist/chunk-3SQCCESO.js +1592 -0
  36. package/dist/chunk-3XHJHQWU.js +42 -0
  37. package/dist/chunk-4G2O2ZPJ.js +83 -0
  38. package/dist/chunk-4JLBVIGW.js +24 -0
  39. package/dist/chunk-4RRNJLCM.js +746 -0
  40. package/dist/chunk-4UVW5WU6.js +76 -0
  41. package/dist/chunk-4X66BTP5.js +344 -0
  42. package/dist/chunk-53OYF4ZT.js +687 -0
  43. package/dist/chunk-57ZGVAU3.js +179 -0
  44. package/dist/chunk-5HECRVXJ.js +62 -0
  45. package/dist/chunk-5LGSRWFC.js +63 -0
  46. package/dist/chunk-5LYXD6ME.js +1112 -0
  47. package/dist/chunk-66RFKRGO.js +28 -0
  48. package/dist/chunk-6KWIQ5KF.js +18 -0
  49. package/dist/chunk-6OCR6ITN.js +72 -0
  50. package/dist/chunk-6RBTTCQD.js +802 -0
  51. package/dist/chunk-6Y7EXYLR.js +563 -0
  52. package/dist/chunk-7CTKTIPF.js +613 -0
  53. package/dist/chunk-7EVIIADO.js +185 -0
  54. package/dist/chunk-7X2ZYVAX.js +89 -0
  55. package/dist/chunk-7X65ZQN4.js +38 -0
  56. package/dist/chunk-A4QZXLXF.js +7 -0
  57. package/dist/chunk-A6CQPJWR.js +49 -0
  58. package/dist/chunk-A7IEVBYI.js +35 -0
  59. package/dist/chunk-ACXX2JNL.js +6 -0
  60. package/dist/chunk-ADKCLH3Z.js +98 -0
  61. package/dist/chunk-ADWSGPH5.js +23 -0
  62. package/dist/chunk-AG2CJ4JY.js +203 -0
  63. package/dist/chunk-AHQ4L3BE.js +30 -0
  64. package/dist/chunk-AOQ6VF5H.js +6 -0
  65. package/dist/chunk-AQROQDLR.js +3303 -0
  66. package/dist/chunk-AWTG3RFF.js +85 -0
  67. package/dist/chunk-B54RN2FD.js +692 -0
  68. package/dist/chunk-B67K6OWJ.js +48 -0
  69. package/dist/chunk-B6GFKYBZ.js +40 -0
  70. package/dist/chunk-BBL3R5YZ.js +186 -0
  71. package/dist/chunk-BBRBCMNR.js +28 -0
  72. package/dist/chunk-BIDIGDGH.js +6 -0
  73. package/dist/chunk-BLFWUMTD.js +12 -0
  74. package/dist/chunk-BM6SFFWF.js +6 -0
  75. package/dist/chunk-BMRD6MAH.js +24 -0
  76. package/dist/chunk-BPKXEMRE.js +197 -0
  77. package/dist/chunk-BUPLB3EX.js +129 -0
  78. package/dist/chunk-BW5VLBSZ.js +15 -0
  79. package/dist/chunk-BWGRWGVA.js +295 -0
  80. package/dist/chunk-BWLOXQDV.js +131 -0
  81. package/dist/chunk-BWTX7LUG.js +203 -0
  82. package/dist/chunk-C54QLNE4.js +69 -0
  83. package/dist/chunk-CAQ5P4VN.js +296 -0
  84. package/dist/chunk-CCCEBIUZ.js +296 -0
  85. package/dist/chunk-CDZHNLO6.js +42 -0
  86. package/dist/chunk-CJGSJKPO.js +25 -0
  87. package/dist/chunk-CN7JRHST.js +25 -0
  88. package/dist/chunk-CNX7EGSU.js +266 -0
  89. package/dist/chunk-COYOTQC2.js +75 -0
  90. package/dist/chunk-CRNMNZJD.js +1161 -0
  91. package/dist/chunk-CUVUDK4O.js +68 -0
  92. package/dist/chunk-CWDHCSL2.js +2919 -0
  93. package/dist/chunk-CYOJZ3GQ.js +631 -0
  94. package/dist/chunk-D4SOADBD.js +19 -0
  95. package/dist/chunk-D7SHZDA3.js +1808 -0
  96. package/dist/chunk-DAVHGK27.js +657 -0
  97. package/dist/chunk-DCCJRLAJ.js +422 -0
  98. package/dist/chunk-DCTCUZ5L.js +51 -0
  99. package/dist/chunk-DDCB7ZA5.js +2511 -0
  100. package/dist/chunk-DDI2W4TR.js +149 -0
  101. package/dist/chunk-DIHUGBZO.js +61 -0
  102. package/dist/chunk-DJHIQWSG.js +25 -0
  103. package/dist/chunk-DO5OZJAO.js +302 -0
  104. package/dist/chunk-DOFYKPTC.js +18 -0
  105. package/dist/chunk-DRTA6JG5.js +160 -0
  106. package/dist/chunk-DRW6KGBK.js +1062 -0
  107. package/dist/chunk-DU4A5AOY.js +1156 -0
  108. package/dist/chunk-DYS7EIXY.js +294 -0
  109. package/dist/chunk-E4IQ6M4S.js +24 -0
  110. package/dist/chunk-EFUWFB64.js +24 -0
  111. package/dist/chunk-EHBB2Z4D.js +290 -0
  112. package/dist/chunk-EHVESNLV.js +30 -0
  113. package/dist/chunk-EJPVVGD7.js +67 -0
  114. package/dist/chunk-EKQK5D6G.js +14 -0
  115. package/dist/chunk-EUADDXAV.js +30 -0
  116. package/dist/chunk-F6CNPC4L.js +47 -0
  117. package/dist/chunk-FBAYZSFC.js +2806 -0
  118. package/dist/chunk-FBB4BWKN.js +30 -0
  119. package/dist/chunk-FF23FYQD.js +1269 -0
  120. package/dist/chunk-FG6EDGMI.js +53 -0
  121. package/dist/chunk-FHA3KMFC.js +43 -0
  122. package/dist/chunk-FIANWJXX.js +19 -0
  123. package/dist/chunk-FIWNDOMO.js +6 -0
  124. package/dist/chunk-FV3VF36K.js +2721 -0
  125. package/dist/chunk-G5FMTRG5.js +37 -0
  126. package/dist/chunk-GCBOHVDZ.js +229 -0
  127. package/dist/chunk-GDOW2KNP.js +19 -0
  128. package/dist/chunk-GTG3IGLF.js +2674 -0
  129. package/dist/chunk-GZTNTHSW.js +21 -0
  130. package/dist/chunk-H4H4O62O.js +46 -0
  131. package/dist/chunk-H5G7T35P.js +24 -0
  132. package/dist/chunk-H63XQ3OO.js +942 -0
  133. package/dist/chunk-H67RTX46.js +43 -0
  134. package/dist/chunk-HA4IPWMM.js +841 -0
  135. package/dist/chunk-HKYTOJLV.js +33 -0
  136. package/dist/chunk-HOAH5XBR.js +542 -0
  137. package/dist/chunk-HTYFQHRC.js +24 -0
  138. package/dist/chunk-HYY5V2KL.js +19 -0
  139. package/dist/chunk-HZI56ASJ.js +79 -0
  140. package/dist/chunk-I6VAWNNU.js +24 -0
  141. package/dist/chunk-IBXXZVG7.js +80 -0
  142. package/dist/chunk-IDDA5INB.js +60 -0
  143. package/dist/chunk-IK4BHOPZ.js +33 -0
  144. package/dist/chunk-IL5T7I2A.js +27 -0
  145. package/dist/chunk-ILSXT6KT.js +24 -0
  146. package/dist/chunk-IV2UXZXX.js +16 -0
  147. package/dist/chunk-IYEFEBRN.js +41 -0
  148. package/dist/chunk-IYMI7YI4.js +829 -0
  149. package/dist/chunk-J6I2YFJH.js +58 -0
  150. package/dist/chunk-JFBEAUJ6.js +24 -0
  151. package/dist/chunk-JR7Y5ONB.js +27 -0
  152. package/dist/chunk-JSEYUJUQ.js +836 -0
  153. package/dist/chunk-JYBT2JNY.js +61 -0
  154. package/dist/chunk-K3HSQPSM.js +24 -0
  155. package/dist/chunk-KAXJFL7N.js +43 -0
  156. package/dist/chunk-KDMKHR5A.js +32 -0
  157. package/dist/chunk-KKWZWP67.js +24 -0
  158. package/dist/chunk-KOJ5QETJ.js +8 -0
  159. package/dist/chunk-KPKXJYQH.js +19 -0
  160. package/dist/chunk-KSJVENRU.js +113 -0
  161. package/dist/chunk-KZJOV4QW.js +33 -0
  162. package/dist/chunk-KZS46KDY.js +58 -0
  163. package/dist/chunk-L3JWM7FR.js +50 -0
  164. package/dist/chunk-L4S6UFTL.js +26 -0
  165. package/dist/chunk-L6DJ4ZY5.js +2008 -0
  166. package/dist/chunk-L7RHB734.js +23 -0
  167. package/dist/chunk-LCWJS34U.js +38 -0
  168. package/dist/chunk-LFTAMH7I.js +24 -0
  169. package/dist/chunk-LFX7W4B7.js +113 -0
  170. package/dist/chunk-LINZPU5D.js +8 -0
  171. package/dist/chunk-LIWLBLCT.js +83 -0
  172. package/dist/chunk-LNKY5Z2X.js +23 -0
  173. package/dist/chunk-LS7HVBI7.js +24 -0
  174. package/dist/chunk-M4EUXOLU.js +170 -0
  175. package/dist/chunk-M4SPKUZE.js +7 -0
  176. package/dist/chunk-M4YLED7M.js +17 -0
  177. package/dist/chunk-MBKZYJRC.js +1424 -0
  178. package/dist/chunk-MCYM3RNF.js +227 -0
  179. package/dist/chunk-MF6IVSBJ.js +48 -0
  180. package/dist/chunk-MIAPBQCA.js +24 -0
  181. package/dist/chunk-MJZHFH5R.js +1075 -0
  182. package/dist/chunk-MQFCG4KS.js +1467 -0
  183. package/dist/chunk-MVV6RQMG.js +128 -0
  184. package/dist/chunk-MYMT5KJL.js +1182 -0
  185. package/dist/chunk-MZL6LGKO.js +587 -0
  186. package/dist/chunk-N23YFPPI.js +47 -0
  187. package/dist/chunk-N3G2FYDL.js +300 -0
  188. package/dist/chunk-N3TPMXS3.js +161 -0
  189. package/dist/chunk-N73IBH55.js +58 -0
  190. package/dist/chunk-N7J7CZS6.js +43 -0
  191. package/dist/chunk-NCB3YLHF.js +28 -0
  192. package/dist/chunk-NHQGRKEA.js +63 -0
  193. package/dist/chunk-NKIYLFXZ.js +2774 -0
  194. package/dist/chunk-NOSDEJ3K.js +25934 -0
  195. package/dist/chunk-NQDVMUHX.js +433 -0
  196. package/dist/chunk-NSSNYY6Y.js +58 -0
  197. package/dist/chunk-NY5NUFDZ.js +117 -0
  198. package/dist/chunk-O3S2KNIW.js +25 -0
  199. package/dist/chunk-O3VN6BTL.js +24 -0
  200. package/dist/chunk-ONZLC47B.js +88 -0
  201. package/dist/chunk-OQEBOVUO.js +30 -0
  202. package/dist/chunk-OUEGGWH7.js +24 -0
  203. package/dist/chunk-OURX73UJ.js +728 -0
  204. package/dist/chunk-P25VEGGX.js +24 -0
  205. package/dist/chunk-P26Z62UV.js +24 -0
  206. package/dist/chunk-P5RNWMZC.js +2984 -0
  207. package/dist/chunk-P6KZIZDV.js +987 -0
  208. package/dist/chunk-PEUSKIFV.js +168 -0
  209. package/dist/chunk-PFVTYFSL.js +24 -0
  210. package/dist/chunk-PWROWDZS.js +137 -0
  211. package/dist/chunk-Q3CV2JJ2.js +3650 -0
  212. package/dist/chunk-QBR6IKIX.js +50 -0
  213. package/dist/chunk-QGCEHR6S.js +13 -0
  214. package/dist/chunk-QHRE2M6V.js +26 -0
  215. package/dist/chunk-QKL7IY42.js +38 -0
  216. package/dist/chunk-QO6HEXIZ.js +272 -0
  217. package/dist/chunk-QOIVXZUF.js +24 -0
  218. package/dist/chunk-QPWRHDLZ.js +17 -0
  219. package/dist/chunk-QSXK6PJL.js +19 -0
  220. package/dist/chunk-QTZVVZ2A.js +54 -0
  221. package/dist/chunk-QWXWVPNE.js +18 -0
  222. package/dist/chunk-QY5ZKUWY.js +383 -0
  223. package/dist/chunk-QZAT46PP.js +95 -0
  224. package/dist/chunk-RA66JA3D.js +24 -0
  225. package/dist/chunk-REOPXBUR.js +600 -0
  226. package/dist/chunk-RGZGLKFB.js +648 -0
  227. package/dist/chunk-RL3NUWMY.js +3378 -0
  228. package/dist/chunk-RNOJSEES.js +16 -0
  229. package/dist/chunk-ROXO4R3J.js +16 -0
  230. package/dist/chunk-RPIW5T55.js +40 -0
  231. package/dist/chunk-RQ5DNYLG.js +10 -0
  232. package/dist/chunk-RZNYW7UP.js +133 -0
  233. package/dist/chunk-S32YYDIB.js +420 -0
  234. package/dist/chunk-S4QSJAGY.js +44 -0
  235. package/dist/chunk-S6UX7KB6.js +335 -0
  236. package/dist/chunk-SDSONLMZ.js +2546 -0
  237. package/dist/chunk-SGD3ZHID.js +250 -0
  238. package/dist/chunk-SKRSCTT5.js +28 -0
  239. package/dist/chunk-SMCDXUIO.js +24 -0
  240. package/dist/chunk-SPTPFY4S.js +528 -0
  241. package/dist/chunk-SREWFAAJ.js +90 -0
  242. package/dist/chunk-SS42FJVN.js +3875 -0
  243. package/dist/chunk-SVZDXFPX.js +891 -0
  244. package/dist/chunk-SZPTTNW7.js +16 -0
  245. package/dist/chunk-T3IGJARD.js +22 -0
  246. package/dist/chunk-TA3TFKYZ.js +86 -0
  247. package/dist/chunk-TBGUEF3M.js +939 -0
  248. package/dist/chunk-TGK6KUGN.js +331 -0
  249. package/dist/chunk-TJSND556.js +1783 -0
  250. package/dist/chunk-TKOJZQAJ.js +24 -0
  251. package/dist/chunk-TM4OC53S.js +97 -0
  252. package/dist/chunk-TNEHPP3H.js +18 -0
  253. package/dist/chunk-TWOREVKJ.js +1760 -0
  254. package/dist/chunk-TXS3U77A.js +60 -0
  255. package/dist/chunk-UB6ODJHO.js +134 -0
  256. package/dist/chunk-UBZXQIDR.js +24 -0
  257. package/dist/chunk-ULTSSIOU.js +38 -0
  258. package/dist/chunk-UMDEWWXT.js +33 -0
  259. package/dist/chunk-V6O6KVOA.js +347 -0
  260. package/dist/chunk-VABRPZVC.js +43 -0
  261. package/dist/chunk-VDAKTZQP.js +18 -0
  262. package/dist/chunk-VDAZPGR2.js +79 -0
  263. package/dist/chunk-VERLFNWR.js +25 -0
  264. package/dist/chunk-VH2UUU7K.js +24 -0
  265. package/dist/chunk-VJ3FCGQF.js +12 -0
  266. package/dist/chunk-VK5ZDV67.js +47 -0
  267. package/dist/chunk-VKQNDOAI.js +40 -0
  268. package/dist/chunk-VTEV3WVF.js +690 -0
  269. package/dist/chunk-VXZFQKBJ.js +21 -0
  270. package/dist/chunk-WI5ITCOH.js +22 -0
  271. package/dist/chunk-WLZ54FWG.js +120 -0
  272. package/dist/chunk-WYJEOMNY.js +31 -0
  273. package/dist/chunk-WZGJSQKN.js +29 -0
  274. package/dist/chunk-WZL4EEBS.js +11 -0
  275. package/dist/chunk-X4YNDLVA.js +54 -0
  276. package/dist/chunk-X6SUFTD7.js +17 -0
  277. package/dist/chunk-XB4KZ6WO.js +81 -0
  278. package/dist/chunk-XJI6SWFS.js +569 -0
  279. package/dist/chunk-XJP5DKIL.js +29 -0
  280. package/dist/chunk-XN4ARQ2W.js +47 -0
  281. package/dist/chunk-XN7MQO45.js +359 -0
  282. package/dist/chunk-XQCQZBGX.js +100 -0
  283. package/dist/chunk-XXOHXA3A.js +69 -0
  284. package/dist/chunk-XZOHR765.js +127 -0
  285. package/dist/chunk-YCNLQYTC.js +133 -0
  286. package/dist/chunk-YCRGWQBS.js +526 -0
  287. package/dist/chunk-YF2PYLC4.js +210 -0
  288. package/dist/chunk-YG5GUELW.js +935 -0
  289. package/dist/chunk-YS6KMYM4.js +91 -0
  290. package/dist/chunk-YWP7XFKD.js +12 -0
  291. package/dist/chunk-Z2MGTKDR.js +20 -0
  292. package/dist/chunk-Z6CL7AR6.js +24 -0
  293. package/dist/chunk-Z7X3RGGA.js +22 -0
  294. package/dist/chunk-ZF43WRG3.js +29 -0
  295. package/dist/chunk-ZMF7WEGG.js +60 -0
  296. package/dist/chunk-ZNHFLJSY.js +375 -0
  297. package/dist/chunk-ZQ4VFQID.js +76 -0
  298. package/dist/chunk-ZQF34VPS.js +72 -0
  299. package/dist/chunk-ZU425HNM.js +24 -0
  300. package/dist/chunk-ZZU5R5UU.js +24 -0
  301. package/dist/cli/index.js +9 -0
  302. package/dist/core-3VCCUFVX.js +32 -0
  303. package/dist/core-4BZQQSHS.js +33 -0
  304. package/dist/core-4VT4MHNB.js +38 -0
  305. package/dist/core-5535KXRD.js +40 -0
  306. package/dist/core-5HQBPCHL.js +35 -0
  307. package/dist/core-6RYHWUJO.js +35 -0
  308. package/dist/core-7BZJCIXN.js +35 -0
  309. package/dist/core-AJTVU6X7.js +37 -0
  310. package/dist/core-C6YUSTZI.js +57 -0
  311. package/dist/core-EEB7HTCL.js +33 -0
  312. package/dist/core-EFMVDWNH.js +38 -0
  313. package/dist/core-ETAGQBZO.js +34 -0
  314. package/dist/core-FVR3WZEC.js +36 -0
  315. package/dist/core-GCTFVYMH.js +29 -0
  316. package/dist/core-GES44OTS.js +33 -0
  317. package/dist/core-GGQREDSI.js +47 -0
  318. package/dist/core-HRYOV6QD.js +38 -0
  319. package/dist/core-IKD3EE3S.js +38 -0
  320. package/dist/core-JM4R426L.js +32 -0
  321. package/dist/core-KKQS3WI2.js +40 -0
  322. package/dist/core-LA6XDYG7.js +40 -0
  323. package/dist/core-MJ7JWQT5.js +37 -0
  324. package/dist/core-MLROKJ2M.js +53 -0
  325. package/dist/core-MR52YBRX.js +31 -0
  326. package/dist/core-NP4VHWXL.js +29 -0
  327. package/dist/core-NQLNZDX5.js +41 -0
  328. package/dist/core-NSIJEKLI.js +44 -0
  329. package/dist/core-OJUQLIQ5.js +35 -0
  330. package/dist/core-PB3VUQSS.js +32 -0
  331. package/dist/core-Q6VLFFYC.js +56 -0
  332. package/dist/core-QY7AVIKZ.js +51 -0
  333. package/dist/core-SBQMHWTA.js +52 -0
  334. package/dist/core-UHECQHJ2.js +38 -0
  335. package/dist/core-V5FV4NWL.js +56 -0
  336. package/dist/core-WGM4XUN3.js +58 -0
  337. package/dist/core-WUQVFARS.js +34 -0
  338. package/dist/core-Z2F3IGSR.js +42 -0
  339. package/dist/dataTable-3CPPIHB3.js +58 -0
  340. package/dist/engine-FXFBCWHB.js +961 -0
  341. package/dist/fixtures.d.ts +1 -0
  342. package/dist/fixtures.js +41 -0
  343. package/dist/fontTables-WYCZNRE7.js +18 -0
  344. package/dist/fonts.d.ts +1 -0
  345. package/dist/fonts.js +19 -0
  346. package/dist/geo/dach.d.ts +1 -0
  347. package/dist/geo/dach.js +14 -0
  348. package/dist/geo/de-states.d.ts +1 -0
  349. package/dist/geo/de-states.js +14 -0
  350. package/dist/geo/eu27.d.ts +1 -0
  351. package/dist/geo/eu27.js +14 -0
  352. package/dist/geo/europe.d.ts +1 -0
  353. package/dist/geo/europe.js +14 -0
  354. package/dist/geo/index.d.ts +1 -0
  355. package/dist/geo/index.js +41 -0
  356. package/dist/geo/us-states.d.ts +1 -0
  357. package/dist/geo/us-states.js +14 -0
  358. package/dist/geo/world.d.ts +1 -0
  359. package/dist/geo/world.js +14 -0
  360. package/dist/index.d.ts +1 -0
  361. package/dist/index.js +364 -0
  362. package/dist/main-YLKBTHJP.js +569 -0
  363. package/dist/mcp/server.js +1025 -0
  364. package/dist/module-SVEW5ZUE.js +137233 -0
  365. package/dist/react/bar.d.ts +1 -0
  366. package/dist/react/bar.js +81 -0
  367. package/dist/react/bartable.d.ts +1 -0
  368. package/dist/react/bartable.js +70 -0
  369. package/dist/react/box.d.ts +1 -0
  370. package/dist/react/box.js +65 -0
  371. package/dist/react/bullet.d.ts +1 -0
  372. package/dist/react/bullet.js +72 -0
  373. package/dist/react/butterfly.d.ts +1 -0
  374. package/dist/react/butterfly.js +66 -0
  375. package/dist/react/choropleth.d.ts +1 -0
  376. package/dist/react/choropleth.js +67 -0
  377. package/dist/react/cohort.d.ts +1 -0
  378. package/dist/react/cohort.js +70 -0
  379. package/dist/react/column.d.ts +1 -0
  380. package/dist/react/column.js +86 -0
  381. package/dist/react/combo.d.ts +1 -0
  382. package/dist/react/combo.js +86 -0
  383. package/dist/react/creative.d.ts +1 -0
  384. package/dist/react/creative.js +61 -0
  385. package/dist/react/diagram.d.ts +1 -0
  386. package/dist/react/diagram.js +60 -0
  387. package/dist/react/dimswitch.d.ts +1 -0
  388. package/dist/react/dimswitch.js +72 -0
  389. package/dist/react/dot.d.ts +1 -0
  390. package/dist/react/dot.js +70 -0
  391. package/dist/react/export.d.ts +1 -0
  392. package/dist/react/export.js +658 -0
  393. package/dist/react/funnel.d.ts +1 -0
  394. package/dist/react/funnel.js +63 -0
  395. package/dist/react/gantt.d.ts +1 -0
  396. package/dist/react/gantt.js +62 -0
  397. package/dist/react/grid.d.ts +1 -0
  398. package/dist/react/grid.js +67 -0
  399. package/dist/react/heatmap.d.ts +1 -0
  400. package/dist/react/heatmap.js +68 -0
  401. package/dist/react/histogram.d.ts +1 -0
  402. package/dist/react/histogram.js +86 -0
  403. package/dist/react/index.d.ts +1 -0
  404. package/dist/react/index.js +504 -0
  405. package/dist/react/kpi.d.ts +1 -0
  406. package/dist/react/kpi.js +67 -0
  407. package/dist/react/likert.d.ts +1 -0
  408. package/dist/react/likert.js +83 -0
  409. package/dist/react/line.d.ts +1 -0
  410. package/dist/react/line.js +81 -0
  411. package/dist/react/mekko.d.ts +1 -0
  412. package/dist/react/mekko.js +71 -0
  413. package/dist/react/pareto.d.ts +1 -0
  414. package/dist/react/pareto.js +90 -0
  415. package/dist/react/pie.d.ts +1 -0
  416. package/dist/react/pie.js +64 -0
  417. package/dist/react/prepare.d.ts +1 -0
  418. package/dist/react/prepare.js +278 -0
  419. package/dist/react/pvm.d.ts +1 -0
  420. package/dist/react/pvm.js +68 -0
  421. package/dist/react/pyramid.d.ts +1 -0
  422. package/dist/react/pyramid.js +67 -0
  423. package/dist/react/sankey.d.ts +1 -0
  424. package/dist/react/sankey.js +59 -0
  425. package/dist/react/scatter.d.ts +1 -0
  426. package/dist/react/scatter.js +63 -0
  427. package/dist/react/slope.d.ts +1 -0
  428. package/dist/react/slope.js +64 -0
  429. package/dist/react/sparkline.d.ts +1 -0
  430. package/dist/react/sparkline.js +59 -0
  431. package/dist/react/spec.d.ts +1 -0
  432. package/dist/react/spec.js +379 -0
  433. package/dist/react/status.d.ts +1 -0
  434. package/dist/react/status.js +64 -0
  435. package/dist/react/story.d.ts +1 -0
  436. package/dist/react/story.js +140 -0
  437. package/dist/react/table.d.ts +1 -0
  438. package/dist/react/table.js +69 -0
  439. package/dist/react/theme.d.ts +1 -0
  440. package/dist/react/theme.js +53 -0
  441. package/dist/react/tilemap.d.ts +1 -0
  442. package/dist/react/tilemap.js +66 -0
  443. package/dist/react/treemap.d.ts +1 -0
  444. package/dist/react/treemap.js +61 -0
  445. package/dist/react/variance.d.ts +1 -0
  446. package/dist/react/variance.js +65 -0
  447. package/dist/react/waffle.d.ts +1 -0
  448. package/dist/react/waffle.js +62 -0
  449. package/dist/react/waterfall.d.ts +1 -0
  450. package/dist/react/waterfall.js +68 -0
  451. package/dist/resvg-ZOVDIZTV.js +23 -0
  452. package/dist/rows.d.ts +1 -0
  453. package/dist/rows.js +23 -0
  454. package/dist/rowsModule-YVLAROIP.js +27 -0
  455. package/dist/schema-2K6C3U24.js +23 -0
  456. package/dist/schema-2KIHLTYI.js +23 -0
  457. package/dist/schema-4HY2MWZC.js +30 -0
  458. package/dist/schema-4S5CXHAO.js +24 -0
  459. package/dist/schema-5BKQV56C.js +27 -0
  460. package/dist/schema-5HA5DSYN.js +24 -0
  461. package/dist/schema-5NKJPSBD.js +23 -0
  462. package/dist/schema-65FOKNHK.js +43 -0
  463. package/dist/schema-6OHZWHUI.js +23 -0
  464. package/dist/schema-6RYJS2GM.js +24 -0
  465. package/dist/schema-6W4M3WJ4.js +23 -0
  466. package/dist/schema-7TLSFG6M.js +24 -0
  467. package/dist/schema-AMFRKUFS.js +27 -0
  468. package/dist/schema-B7CZPPB4.js +28 -0
  469. package/dist/schema-BNRNHGHQ.js +26 -0
  470. package/dist/schema-E4MRCGPZ.js +24 -0
  471. package/dist/schema-F3WYTR65.js +26 -0
  472. package/dist/schema-FA6XIHTW.js +23 -0
  473. package/dist/schema-GZNOW4LX.js +23 -0
  474. package/dist/schema-HEIDGCSL.js +23 -0
  475. package/dist/schema-JB2H6KPA.js +23 -0
  476. package/dist/schema-MPXZNWV3.js +23 -0
  477. package/dist/schema-NHNQK6XO.js +23 -0
  478. package/dist/schema-NN6UPDPW.js +23 -0
  479. package/dist/schema-O4YNAGIY.js +23 -0
  480. package/dist/schema-O7AKK232.js +29 -0
  481. package/dist/schema-OJCML6LV.js +24 -0
  482. package/dist/schema-ORTRMYI6.js +24 -0
  483. package/dist/schema-PJ6P52BC.js +23 -0
  484. package/dist/schema-RTWES6NR.js +24 -0
  485. package/dist/schema-S36SRYGO.js +24 -0
  486. package/dist/schema-S3TCLTYD.js +23 -0
  487. package/dist/schema-SWWMOLOR.js +54 -0
  488. package/dist/schema-WOSEZNKG.js +26 -0
  489. package/dist/schema-Y6KBWUUR.js +23 -0
  490. package/dist/schema-YQYTLKSW.js +23 -0
  491. package/dist/schema-ZUUUY3QS.js +33 -0
  492. package/dist/specValidation-VNWIKLHH.js +49 -0
  493. package/dist/theme.d.ts +1 -0
  494. package/dist/theme.js +24 -0
  495. package/dist/themeShapeRules-2D3KWSPQ.js +11 -0
  496. package/dist/types/core/a11y/accessibility.d.ts +43 -0
  497. package/dist/types/core/a11y/recordsShared.d.ts +44 -0
  498. package/dist/types/core/a11y/structuralRecords.d.ts +6 -0
  499. package/dist/types/core/a11y/types.d.ts +116 -0
  500. package/dist/types/core/annotate.d.ts +300 -0
  501. package/dist/types/core/annotateArms.d.ts +37 -0
  502. package/dist/types/core/annotateFields.d.ts +30 -0
  503. package/dist/types/core/annotateGapBracket.d.ts +66 -0
  504. package/dist/types/core/annotateLinks.d.ts +47 -0
  505. package/dist/types/core/annotateTargets.d.ts +90 -0
  506. package/dist/types/core/axis.d.ts +179 -0
  507. package/dist/types/core/bandSelect.d.ts +10 -0
  508. package/dist/types/core/bands.d.ts +14 -0
  509. package/dist/types/core/calendarLabels.d.ts +101 -0
  510. package/dist/types/core/charts/band/stacks.d.ts +155 -0
  511. package/dist/types/core/charts/bar/fixtures.d.ts +9 -0
  512. package/dist/types/core/charts/bar/layout.d.ts +95 -0
  513. package/dist/types/core/charts/bartable/fixtures.d.ts +4 -0
  514. package/dist/types/core/charts/bartable/types.d.ts +192 -0
  515. package/dist/types/core/charts/box/fixtures.d.ts +12 -0
  516. package/dist/types/core/charts/box/types.d.ts +110 -0
  517. package/dist/types/core/charts/bullet/fixtures.d.ts +11 -0
  518. package/dist/types/core/charts/butterfly/fixtures.d.ts +9 -0
  519. package/dist/types/core/charts/choropleth/fixtures.d.ts +3 -0
  520. package/dist/types/core/charts/choropleth/overlayTypes.d.ts +68 -0
  521. package/dist/types/core/charts/choropleth/types.d.ts +117 -0
  522. package/dist/types/core/charts/cohort/fixtures.d.ts +12 -0
  523. package/dist/types/core/charts/cohort/types.d.ts +165 -0
  524. package/dist/types/core/charts/column/anomaly.d.ts +204 -0
  525. package/dist/types/core/charts/column/fixtures.d.ts +12 -0
  526. package/dist/types/core/charts/column/layout.d.ts +116 -0
  527. package/dist/types/core/charts/column/model.d.ts +295 -0
  528. package/dist/types/core/charts/column/types.d.ts +56 -0
  529. package/dist/types/core/charts/combo/endpoints.d.ts +165 -0
  530. package/dist/types/core/charts/combo/fixtures.d.ts +12 -0
  531. package/dist/types/core/charts/combo/layout.d.ts +48 -0
  532. package/dist/types/core/charts/creative/fixtures.d.ts +4 -0
  533. package/dist/types/core/charts/creative/types.d.ts +73 -0
  534. package/dist/types/core/charts/diagram/fixtures.d.ts +3 -0
  535. package/dist/types/core/charts/dimswitch/compile.d.ts +20 -0
  536. package/dist/types/core/charts/dimswitch/fixtures.d.ts +3 -0
  537. package/dist/types/core/charts/dimswitch/types.d.ts +152 -0
  538. package/dist/types/core/charts/dot/fixtures.d.ts +11 -0
  539. package/dist/types/core/charts/funnel/fixtures.d.ts +11 -0
  540. package/dist/types/core/charts/gantt/fixtures.d.ts +9 -0
  541. package/dist/types/core/charts/gantt/layout.d.ts +63 -0
  542. package/dist/types/core/charts/grid/fixtures.d.ts +3 -0
  543. package/dist/types/core/charts/grid/metricStack.d.ts +108 -0
  544. package/dist/types/core/charts/grid/metricStackSchema.d.ts +74 -0
  545. package/dist/types/core/charts/grid/normalize.d.ts +99 -0
  546. package/dist/types/core/charts/grid/schema.d.ts +168 -0
  547. package/dist/types/core/charts/heatmap/fixtures.d.ts +11 -0
  548. package/dist/types/core/charts/histogram/fixtures.d.ts +15 -0
  549. package/dist/types/core/charts/histogram/types.d.ts +98 -0
  550. package/dist/types/core/charts/kpi/fixtures.d.ts +9 -0
  551. package/dist/types/core/charts/likert/fixtures.d.ts +11 -0
  552. package/dist/types/core/charts/likert/layout.d.ts +111 -0
  553. package/dist/types/core/charts/line/fixtures.d.ts +16 -0
  554. package/dist/types/core/charts/line/types.d.ts +6 -0
  555. package/dist/types/core/charts/mekko/fixtures.d.ts +13 -0
  556. package/dist/types/core/charts/pareto/fixtures.d.ts +5 -0
  557. package/dist/types/core/charts/pareto/layout.d.ts +68 -0
  558. package/dist/types/core/charts/pie/fixtures.d.ts +14 -0
  559. package/dist/types/core/charts/pvm/fixtures.d.ts +13 -0
  560. package/dist/types/core/charts/pvm/types.d.ts +118 -0
  561. package/dist/types/core/charts/pyramid/fixtures.d.ts +4 -0
  562. package/dist/types/core/charts/pyramid/types.d.ts +92 -0
  563. package/dist/types/core/charts/sankey/fixtures.d.ts +4 -0
  564. package/dist/types/core/charts/sankey/types.d.ts +116 -0
  565. package/dist/types/core/charts/scatter/fixtures.d.ts +12 -0
  566. package/dist/types/core/charts/scatter/types.d.ts +58 -0
  567. package/dist/types/core/charts/slope/fixtures.d.ts +13 -0
  568. package/dist/types/core/charts/sparkline/fixtures.d.ts +9 -0
  569. package/dist/types/core/charts/status/fixtures.d.ts +8 -0
  570. package/dist/types/core/charts/status/layout.d.ts +71 -0
  571. package/dist/types/core/charts/table/fitFormats.d.ts +67 -0
  572. package/dist/types/core/charts/table/fixtures.d.ts +7 -0
  573. package/dist/types/core/charts/table/resolve.d.ts +72 -0
  574. package/dist/types/core/charts/table/view.d.ts +156 -0
  575. package/dist/types/core/charts/tilemap/fixtures.d.ts +3 -0
  576. package/dist/types/core/charts/tilemap/types.d.ts +94 -0
  577. package/dist/types/core/charts/treemap/fixtures.d.ts +4 -0
  578. package/dist/types/core/charts/treemap/types.d.ts +78 -0
  579. package/dist/types/core/charts/variance/fixtures.d.ts +12 -0
  580. package/dist/types/core/charts/waffle/fixtures.d.ts +5 -0
  581. package/dist/types/core/charts/waffle/types.d.ts +117 -0
  582. package/dist/types/core/charts/waterfall/fixtures.d.ts +9 -0
  583. package/dist/types/core/claims/browser.d.ts +49 -0
  584. package/dist/types/core/claims/manifest.d.ts +22 -0
  585. package/dist/types/core/dateFormat.d.ts +39 -0
  586. package/dist/types/core/deferred.d.ts +121 -0
  587. package/dist/types/core/diagnostics/describe.d.ts +149 -0
  588. package/dist/types/core/diagnostics/jsonPatch.d.ts +36 -0
  589. package/dist/types/core/doc/bareChart.d.ts +2 -0
  590. package/dist/types/core/doc/diagnostics.d.ts +124 -0
  591. package/dist/types/core/doc/docExpand.d.ts +39 -0
  592. package/dist/types/core/doc/document.d.ts +43 -0
  593. package/dist/types/core/doc/ownedDocumentCopy.d.ts +5 -0
  594. package/dist/types/core/doc/specError.d.ts +6 -0
  595. package/dist/types/core/emptyData.d.ts +27 -0
  596. package/dist/types/core/eventLane.d.ts +208 -0
  597. package/dist/types/core/fontMetrics/index.d.ts +47 -0
  598. package/dist/types/core/fontMetrics/injected.d.ts +40 -0
  599. package/dist/types/core/fontMetrics/tableDocument.d.ts +73 -0
  600. package/dist/types/core/fontMetrics/tables.generated.d.ts +17 -0
  601. package/dist/types/core/footer.d.ts +59 -0
  602. package/dist/types/core/format.d.ts +149 -0
  603. package/dist/types/core/formatPrecision.d.ts +136 -0
  604. package/dist/types/core/formatSpec.d.ts +304 -0
  605. package/dist/types/core/frame.d.ts +583 -0
  606. package/dist/types/core/geo/packs/all.d.ts +7 -0
  607. package/dist/types/core/geo/packs/dach.d.ts +16 -0
  608. package/dist/types/core/geo/packs/de-states.d.ts +16 -0
  609. package/dist/types/core/geo/packs/eu27.d.ts +16 -0
  610. package/dist/types/core/geo/packs/europe.d.ts +16 -0
  611. package/dist/types/core/geo/packs/index.d.ts +22 -0
  612. package/dist/types/core/geo/packs/registry.d.ts +37 -0
  613. package/dist/types/core/geo/packs/us-states.d.ts +16 -0
  614. package/dist/types/core/geo/packs/world.d.ts +16 -0
  615. package/dist/types/core/geo/tiles/eu27.generated.d.ts +412 -0
  616. package/dist/types/core/geo/tiles/europe.generated.d.ts +842 -0
  617. package/dist/types/core/geo/tiles/index.d.ts +8 -0
  618. package/dist/types/core/geo/tiles/types.d.ts +36 -0
  619. package/dist/types/core/geo/tiles/us-states.generated.d.ts +952 -0
  620. package/dist/types/core/geo/tiles/world.generated.d.ts +968 -0
  621. package/dist/types/core/geo/types.d.ts +146 -0
  622. package/dist/types/core/geometry.d.ts +102 -0
  623. package/dist/types/core/grid/sharedScale.d.ts +82 -0
  624. package/dist/types/core/icons.d.ts +227 -0
  625. package/dist/types/core/inputError.d.ts +14 -0
  626. package/dist/types/core/isoDate.d.ts +2 -0
  627. package/dist/types/core/isoTime.d.ts +7 -0
  628. package/dist/types/core/label/categoryRow.d.ts +332 -0
  629. package/dist/types/core/label/occupied.d.ts +41 -0
  630. package/dist/types/core/label/ownership.d.ts +83 -0
  631. package/dist/types/core/label/solver.d.ts +384 -0
  632. package/dist/types/core/label/tickRow.d.ts +78 -0
  633. package/dist/types/core/live/types.d.ts +50 -0
  634. package/dist/types/core/normalize/shared.d.ts +56 -0
  635. package/dist/types/core/notes.d.ts +174 -0
  636. package/dist/types/core/othersShade.d.ts +9 -0
  637. package/dist/types/core/periodYears.d.ts +9 -0
  638. package/dist/types/core/polyline.d.ts +11 -0
  639. package/dist/types/core/rangeRules.d.ts +19 -0
  640. package/dist/types/core/ratioTier.d.ts +120 -0
  641. package/dist/types/core/readerStrings.d.ts +13 -0
  642. package/dist/types/core/reading.d.ts +120 -0
  643. package/dist/types/core/registry.d.ts +178 -0
  644. package/dist/types/core/repaintGeometry.d.ts +19 -0
  645. package/dist/types/core/request.d.ts +124 -0
  646. package/dist/types/core/rows.d.ts +47 -0
  647. package/dist/types/core/scale.d.ts +106 -0
  648. package/dist/types/core/schema/capability.d.ts +229 -0
  649. package/dist/types/core/schema/namedColumns.d.ts +45 -0
  650. package/dist/types/core/schema/reference.d.ts +31 -0
  651. package/dist/types/core/schema/refusals.d.ts +45 -0
  652. package/dist/types/core/schema/unknownKeys.d.ts +45 -0
  653. package/dist/types/core/seriesIdentity.d.ts +120 -0
  654. package/dist/types/core/shareRounding.d.ts +49 -0
  655. package/dist/types/core/sizing.d.ts +330 -0
  656. package/dist/types/core/staticFooter.d.ts +6 -0
  657. package/dist/types/core/story.d.ts +41 -0
  658. package/dist/types/core/structureCounts.d.ts +10 -0
  659. package/dist/types/core/svg/renderSvg.d.ts +51 -0
  660. package/dist/types/core/target.d.ts +89 -0
  661. package/dist/types/core/text.d.ts +113 -0
  662. package/dist/types/core/theme.d.ts +478 -0
  663. package/dist/types/core/themeFields.d.ts +11 -0
  664. package/dist/types/core/themeRules.d.ts +111 -0
  665. package/dist/types/core/themeShape.d.ts +87 -0
  666. package/dist/types/core/themeValidate.d.ts +15 -0
  667. package/dist/types/core/timeAxis.d.ts +106 -0
  668. package/dist/types/core/types/annotations.d.ts +227 -0
  669. package/dist/types/core/types/cell.d.ts +82 -0
  670. package/dist/types/core/types/data.d.ts +314 -0
  671. package/dist/types/core/types/diagram.d.ts +234 -0
  672. package/dist/types/core/types/index.d.ts +8 -0
  673. package/dist/types/core/types/options.d.ts +1583 -0
  674. package/dist/types/core/types/scene.d.ts +990 -0
  675. package/dist/types/core/types/sizing.d.ts +51 -0
  676. package/dist/types/core/types/table.d.ts +873 -0
  677. package/dist/types/core/types/theme.d.ts +806 -0
  678. package/dist/types/core/zoom.d.ts +106 -0
  679. package/dist/types/fixtures/index.d.ts +40 -0
  680. package/dist/types/fixtures/registry.d.ts +15 -0
  681. package/dist/types/fonts.d.ts +10 -0
  682. package/dist/types/index.d.ts +70 -0
  683. package/dist/types/react/BoardplotTheme.d.ts +9 -0
  684. package/dist/types/react/DimSwitchChart.d.ts +36 -0
  685. package/dist/types/react/ScaleGroup.d.ts +31 -0
  686. package/dist/types/react/SceneRenderer.d.ts +23 -0
  687. package/dist/types/react/SizePlaceholder.d.ts +51 -0
  688. package/dist/types/react/StoryFrame.d.ts +42 -0
  689. package/dist/types/react/TableChart.d.ts +220 -0
  690. package/dist/types/react/a11ySurface.d.ts +20 -0
  691. package/dist/types/react/barrelCharts.d.ts +1023 -0
  692. package/dist/types/react/charts/bar.d.ts +28 -0
  693. package/dist/types/react/charts/bartable.d.ts +27 -0
  694. package/dist/types/react/charts/box.d.ts +27 -0
  695. package/dist/types/react/charts/bullet.d.ts +28 -0
  696. package/dist/types/react/charts/butterfly.d.ts +28 -0
  697. package/dist/types/react/charts/choropleth.d.ts +27 -0
  698. package/dist/types/react/charts/cohort.d.ts +52 -0
  699. package/dist/types/react/charts/column.d.ts +27 -0
  700. package/dist/types/react/charts/combo.d.ts +7 -0
  701. package/dist/types/react/charts/creative.d.ts +27 -0
  702. package/dist/types/react/charts/diagram.d.ts +162 -0
  703. package/dist/types/react/charts/dimswitch.d.ts +6 -0
  704. package/dist/types/react/charts/dot.d.ts +28 -0
  705. package/dist/types/react/charts/funnel.d.ts +28 -0
  706. package/dist/types/react/charts/gantt.d.ts +28 -0
  707. package/dist/types/react/charts/grid.d.ts +29 -0
  708. package/dist/types/react/charts/heatmap.d.ts +28 -0
  709. package/dist/types/react/charts/histogram.d.ts +27 -0
  710. package/dist/types/react/charts/kpi.d.ts +28 -0
  711. package/dist/types/react/charts/likert.d.ts +27 -0
  712. package/dist/types/react/charts/line.d.ts +28 -0
  713. package/dist/types/react/charts/mekko.d.ts +28 -0
  714. package/dist/types/react/charts/pareto.d.ts +28 -0
  715. package/dist/types/react/charts/pie.d.ts +28 -0
  716. package/dist/types/react/charts/pvm.d.ts +27 -0
  717. package/dist/types/react/charts/pyramid.d.ts +27 -0
  718. package/dist/types/react/charts/sankey.d.ts +27 -0
  719. package/dist/types/react/charts/scatter.d.ts +28 -0
  720. package/dist/types/react/charts/slope.d.ts +28 -0
  721. package/dist/types/react/charts/sparkline.d.ts +28 -0
  722. package/dist/types/react/charts/status.d.ts +27 -0
  723. package/dist/types/react/charts/table.d.ts +6 -0
  724. package/dist/types/react/charts/tilemap.d.ts +27 -0
  725. package/dist/types/react/charts/treemap.d.ts +27 -0
  726. package/dist/types/react/charts/variance.d.ts +28 -0
  727. package/dist/types/react/charts/waffle.d.ts +28 -0
  728. package/dist/types/react/charts/waterfall.d.ts +28 -0
  729. package/dist/types/react/createChartComponent.d.ts +135 -0
  730. package/dist/types/react/export/clipboard.d.ts +8 -0
  731. package/dist/types/react/export/csv.d.ts +2 -0
  732. package/dist/types/react/export/frame.d.ts +35 -0
  733. package/dist/types/react/export/index.d.ts +7 -0
  734. package/dist/types/react/export/png.d.ts +14 -0
  735. package/dist/types/react/export/svg.d.ts +5 -0
  736. package/dist/types/react/export/types.d.ts +69 -0
  737. package/dist/types/react/export/useExport.d.ts +17 -0
  738. package/dist/types/react/exportLink.d.ts +49 -0
  739. package/dist/types/react/footerFrame.d.ts +25 -0
  740. package/dist/types/react/hover/dataTable.d.ts +13 -0
  741. package/dist/types/react/hover/engine.d.ts +210 -0
  742. package/dist/types/react/hover/keyboard.d.ts +44 -0
  743. package/dist/types/react/hover/labelCard.d.ts +170 -0
  744. package/dist/types/react/hover/placement.d.ts +49 -0
  745. package/dist/types/react/index.d.ts +16 -0
  746. package/dist/types/react/parseChartSpec.d.ts +16 -0
  747. package/dist/types/react/prepare.d.ts +32 -0
  748. package/dist/types/react/prepared.d.ts +53 -0
  749. package/dist/types/react/preparedTable.d.ts +15 -0
  750. package/dist/types/react/rowsInput.d.ts +55 -0
  751. package/dist/types/react/rowsModule.d.ts +18 -0
  752. package/dist/types/react/rowsStore.d.ts +50 -0
  753. package/dist/types/react/scale-group.d.ts +2 -0
  754. package/dist/types/react/scaleGroupContext.d.ts +22 -0
  755. package/dist/types/react/scenePaint.d.ts +10 -0
  756. package/dist/types/react/scrollState.d.ts +26 -0
  757. package/dist/types/react/spec.d.ts +82 -0
  758. package/dist/types/react/specValidation.d.ts +45 -0
  759. package/dist/types/react/story.d.ts +15 -0
  760. package/dist/types/react/theme.d.ts +9 -0
  761. package/dist/types/react/themeContext.d.ts +44 -0
  762. package/dist/types/react/useChartLayout.d.ts +22 -0
  763. package/dist/types/react/useContainerSize.d.ts +57 -0
  764. package/dist/types/react/useHover.d.ts +100 -0
  765. package/dist/types/react/useZoom.d.ts +50 -0
  766. package/dist/types/rows.d.ts +63 -0
  767. package/dist/types/tableLooks.d.ts +6 -0
  768. package/dist/types/theme.d.ts +3 -0
  769. package/dist/types/validate.d.ts +3 -0
  770. package/dist/validate.d.ts +1 -0
  771. package/dist/validate.js +223 -0
  772. package/docs/FONTS.md +68 -0
  773. package/docs/TELEMETRY.md +94 -0
  774. package/docs/manual.md +850 -0
  775. package/docs/reference/bar.md +222 -0
  776. package/docs/reference/bartable.md +143 -0
  777. package/docs/reference/box.md +93 -0
  778. package/docs/reference/bullet.md +118 -0
  779. package/docs/reference/butterfly.md +117 -0
  780. package/docs/reference/choropleth.md +148 -0
  781. package/docs/reference/cohort.md +149 -0
  782. package/docs/reference/column.md +275 -0
  783. package/docs/reference/combo.md +219 -0
  784. package/docs/reference/creative.md +147 -0
  785. package/docs/reference/diagram.md +191 -0
  786. package/docs/reference/dimswitch.md +1395 -0
  787. package/docs/reference/dot.md +117 -0
  788. package/docs/reference/fixtures.md +1089 -0
  789. package/docs/reference/funnel.md +121 -0
  790. package/docs/reference/gantt.md +138 -0
  791. package/docs/reference/grid.md +302 -0
  792. package/docs/reference/heatmap.md +127 -0
  793. package/docs/reference/histogram.md +77 -0
  794. package/docs/reference/kpi.md +115 -0
  795. package/docs/reference/likert.md +113 -0
  796. package/docs/reference/line.md +436 -0
  797. package/docs/reference/mekko.md +114 -0
  798. package/docs/reference/options.md +313 -0
  799. package/docs/reference/pareto.md +102 -0
  800. package/docs/reference/pie.md +114 -0
  801. package/docs/reference/pvm.md +114 -0
  802. package/docs/reference/pyramid.md +99 -0
  803. package/docs/reference/react.md +706 -0
  804. package/docs/reference/reading.md +28 -0
  805. package/docs/reference/sankey.md +110 -0
  806. package/docs/reference/scatter.md +211 -0
  807. package/docs/reference/slope.md +126 -0
  808. package/docs/reference/sparkline.md +74 -0
  809. package/docs/reference/status.md +107 -0
  810. package/docs/reference/table.md +673 -0
  811. package/docs/reference/theme.md +361 -0
  812. package/docs/reference/tilemap.md +121 -0
  813. package/docs/reference/treemap.md +86 -0
  814. package/docs/reference/variance.md +126 -0
  815. package/docs/reference/waffle.md +106 -0
  816. package/docs/reference/waterfall.md +164 -0
  817. package/llms.txt +57 -0
  818. package/package.json +437 -4
@@ -0,0 +1,1760 @@
1
+ import {
2
+ liftOrFallback,
3
+ missesSize,
4
+ tightSpacingWarning
5
+ } from "./chunk-XN4ARQ2W.js";
6
+ import {
7
+ chartTheme
8
+ } from "./chunk-3QWZAEW5.js";
9
+ import {
10
+ ZERO_LIFT,
11
+ arrowKey,
12
+ badSide,
13
+ cellDrawsTabular,
14
+ cellHoldsNumber,
15
+ emitArrow,
16
+ emitHeat,
17
+ emptyMessageRow,
18
+ expansionRootsHidden,
19
+ finalClosers,
20
+ groupSpans,
21
+ heatColumn,
22
+ heatKey,
23
+ heatRanges,
24
+ isCohortDensity,
25
+ levelLadder,
26
+ presetLanguage,
27
+ printsFigures,
28
+ resolveTable,
29
+ rowGrounds,
30
+ tableFootnotes,
31
+ tableWidths,
32
+ visibleColumns,
33
+ visibleInlineRows,
34
+ visibleRows
35
+ } from "./chunk-SDSONLMZ.js";
36
+ import {
37
+ tableCellKey,
38
+ tableCellNodeId
39
+ } from "./chunk-M4SPKUZE.js";
40
+ import {
41
+ TABLE_SPARK_STYLE,
42
+ emitSparklineMarks,
43
+ lastObservedIndex,
44
+ plotSparkline,
45
+ sparklineDomain
46
+ } from "./chunk-XJI6SWFS.js";
47
+ import {
48
+ rowDrivenHeight
49
+ } from "./chunk-GZTNTHSW.js";
50
+ import {
51
+ structureCount
52
+ } from "./chunk-LFX7W4B7.js";
53
+ import {
54
+ CHIP_PAD_X,
55
+ ENGINE_NOTES,
56
+ HEADING_CUT_MIN,
57
+ HINT_GAP,
58
+ INDENT_BASE,
59
+ INLINE_LABEL_INDENT,
60
+ MARK_SIZE,
61
+ SECTION_CHIP_GAP,
62
+ cellPadX,
63
+ changeLineFitFont,
64
+ changeLineFont,
65
+ figureFont,
66
+ groupHeadingFaces,
67
+ groupHeadingLabel,
68
+ groupHeadingNote,
69
+ groupHeadingWidth,
70
+ inlineFont,
71
+ kindFont,
72
+ rowFont,
73
+ tableFonts
74
+ } from "./chunk-V6O6KVOA.js";
75
+ import {
76
+ chipHeight,
77
+ chipPaints,
78
+ hasPolarityBadge,
79
+ isFigureCell,
80
+ onTableGround,
81
+ polarityBadgeInk,
82
+ statusSquare,
83
+ statusSquarePaint,
84
+ tableGround,
85
+ toneTextPaint
86
+ } from "./chunk-4UVW5WU6.js";
87
+ import {
88
+ qualifierFont,
89
+ tableInk,
90
+ tableRuleInk
91
+ } from "./chunk-Z2MGTKDR.js";
92
+ import {
93
+ emptyIdRecord
94
+ } from "./chunk-LINZPU5D.js";
95
+ import {
96
+ DEFAULT_EMPTY_MESSAGE,
97
+ hasNoDataRows
98
+ } from "./chunk-H67RTX46.js";
99
+ import {
100
+ CARD_CLASS_WIDTH,
101
+ VERIFY_ADVICE,
102
+ heightOmitted,
103
+ rowSizing
104
+ } from "./chunk-RL3NUWMY.js";
105
+ import {
106
+ authoredNotes,
107
+ composedTextRole,
108
+ createOccupiedIndex,
109
+ cutWithTitle,
110
+ distinctCut,
111
+ fitText,
112
+ frameTextOptions,
113
+ groundTextWarnings,
114
+ legendOff,
115
+ legendRequired,
116
+ solveFrame
117
+ } from "./chunk-SS42FJVN.js";
118
+ import {
119
+ copyFrame,
120
+ disclosureNote,
121
+ footerPlans
122
+ } from "./chunk-BPKXEMRE.js";
123
+ import {
124
+ AUTOMATIC_FORMAT,
125
+ MAGNITUDE_DIVISOR,
126
+ MAGNITUDE_GROUP,
127
+ MAGNITUDE_LABEL,
128
+ effectiveScale,
129
+ formatWithSpec,
130
+ parseFormatExample,
131
+ specUnitKind,
132
+ unitOfSpec
133
+ } from "./chunk-RGZGLKFB.js";
134
+ import {
135
+ currentSmallValues,
136
+ formatExactNumber,
137
+ nonzeroDecimals,
138
+ roundHalfUp,
139
+ roundsToZero,
140
+ zeroLifts
141
+ } from "./chunk-53OYF4ZT.js";
142
+ import {
143
+ canvasMargin,
144
+ colorblindRoles,
145
+ markRolePaint,
146
+ panelTypeClass,
147
+ resolveSemanticPaletteTheme,
148
+ resolveSurface,
149
+ semanticPalettePaint,
150
+ signedFillPaint,
151
+ strokeToken,
152
+ tableEmphasis,
153
+ textScaleOf,
154
+ typeWidthClass
155
+ } from "./chunk-CWDHCSL2.js";
156
+ import {
157
+ TARGET_SIZE,
158
+ accessibleTitle,
159
+ resolveSize
160
+ } from "./chunk-SGD3ZHID.js";
161
+ import {
162
+ maxOf,
163
+ minOf,
164
+ pushAll
165
+ } from "./chunk-WYJEOMNY.js";
166
+ import {
167
+ WIDTH_SAFETY,
168
+ defaultMeasurer,
169
+ ellipsize
170
+ } from "./chunk-AG2CJ4JY.js";
171
+
172
+ // src/core/charts/table/encodings/inCellBar.ts
173
+ var TEXT_GAP = 8, BAR_HEIGHT = 10;
174
+ function emitInCellBar(context, metrics) {
175
+ let value = context.cell.raw;
176
+ if (context.cell.state !== "value" || typeof value != "number" || value === 0 || metrics.maxAbs <= 0)
177
+ return [];
178
+ let width = Math.max(0, metrics.contentBox.w - metrics.textReserve - TEXT_GAP) * Math.min(1, Math.abs(value) / metrics.maxAbs);
179
+ if (width <= 0) return [];
180
+ let height = Math.min(BAR_HEIGHT, metrics.contentBox.h), fill = badSide(value < 0, context.cell.polarity) ? { ...signedFillPaint("bad"), tint: 0.55 } : semanticPalettePaint(context.theme, context.palette, "focus", 0.55);
181
+ return [
182
+ {
183
+ t: "rect",
184
+ id: context.nodeId("bar"),
185
+ rect: {
186
+ x: metrics.contentBox.x,
187
+ y: metrics.contentBox.y + (metrics.contentBox.h - height) / 2,
188
+ w: width,
189
+ h: height
190
+ },
191
+ fill,
192
+ owner: context.owner,
193
+ part: "tableBar"
194
+ }
195
+ ];
196
+ }
197
+
198
+ // src/core/charts/table/encodings/sparkline.ts
199
+ function sparklineSourceValues(row, sourceColumns) {
200
+ return sourceColumns.map((sourceId) => {
201
+ let source = row.cells[sourceId];
202
+ return source?.state === "value" && typeof source.raw == "number" ? source.raw : null;
203
+ });
204
+ }
205
+ function tableSparklineDomain(rows, sourceColumns, shape) {
206
+ return sparklineDomain(
207
+ rows.filter((row) => row.role !== "section").map((row) => sparklineSourceValues(row, sourceColumns)),
208
+ shape
209
+ );
210
+ }
211
+ function sparklineDomains(columns, rows) {
212
+ let domains = /* @__PURE__ */ new Map();
213
+ for (let column of columns)
214
+ column.kind !== "encoding" || column.encoding?.type !== "sparkline" || domains.set(column.id, tableSparklineDomain(rows, column.encoding.sourceColumns, column.encoding.kind ?? "line"));
215
+ return domains;
216
+ }
217
+ function emitSparkline(context, values, metrics) {
218
+ if (!values.some((value) => value !== null)) {
219
+ let font2 = { family: context.theme.type.family, ...context.theme.type.label }, mark = context.theme.table?.glyphs?.missing ?? "\u2014";
220
+ return [
221
+ {
222
+ t: "text",
223
+ typeRole: "label",
224
+ id: context.nodeId("sparkEmpty"),
225
+ x: context.box.x + context.box.w / 2,
226
+ y: context.box.y + (context.box.h - context.measure(mark, font2).height) / 2,
227
+ lines: [mark],
228
+ align: "middle",
229
+ font: font2,
230
+ ink: { token: "inkMuted" },
231
+ owner: context.owner,
232
+ part: "tableSparkEmpty"
233
+ }
234
+ ];
235
+ }
236
+ let kind = metrics.kind ?? "line", font = { family: context.theme.type.family, ...context.theme.type.label }, lastIndex = lastObservedIndex(values), lastText = metrics.lastText ?? (lastIndex === void 0 ? void 0 : formatExactNumber(values[lastIndex], metrics.language)), plot = plotSparkline({
237
+ box: context.box,
238
+ values,
239
+ shape: kind,
240
+ domain: metrics.domain,
241
+ style: TABLE_SPARK_STYLE,
242
+ lastText,
243
+ font,
244
+ measure: context.measure
245
+ });
246
+ return emitSparklineMarks({
247
+ plot,
248
+ shape: kind,
249
+ theme: context.theme,
250
+ palette: context.palette,
251
+ style: TABLE_SPARK_STYLE,
252
+ nodeId: context.nodeId,
253
+ owner: context.owner,
254
+ partPrefix: "table"
255
+ }).map((node) => node.t === "text" ? { ...node, typeRole: "label" } : node);
256
+ }
257
+
258
+ // src/core/charts/table/fitFormats.ts
259
+ var NEXT_MAGNITUDE = {
260
+ none: "k",
261
+ k: "m",
262
+ m: "bn",
263
+ bn: "t",
264
+ t: void 0
265
+ }, FIT_DIGITS = 2;
266
+ function keptDigits(value, magnitude, decimals) {
267
+ return roundHalfUp(Math.abs(value) / MAGNITUDE_DIVISOR[magnitude], decimals).replace(".", "").replace(/^0+/, "").length;
268
+ }
269
+ function keepsDigits(figures, spec, next) {
270
+ return figures.every((value) => {
271
+ let kept = keptDigits(value, next.magnitude, next.decimals);
272
+ return kept === 0 && spec.automatic || kept >= Math.min(FIT_DIGITS, keptDigits(value, spec.magnitude, spec.decimals));
273
+ });
274
+ }
275
+ function floorDecimals(figures, spec, magnitude, from = 0) {
276
+ let decimals = from;
277
+ for (; decimals < 6 && !keepsDigits(figures, spec, { magnitude, decimals }); ) decimals++;
278
+ return decimals;
279
+ }
280
+ function shorterSpec(spec, figures) {
281
+ let maxAbs = figures === void 0 ? 1 / 0 : Math.max(0, maxOf(figures));
282
+ if (figures ??= [], spec.decimals > 0) {
283
+ let decimals = spec.decimals === 4 && spec.thousandsSep === "" ? 2 : spec.decimals - 1, plain = { ...spec, decimals }, next2 = plain.magnitude === "none" || maxAbs === 1 / 0 ? plain : { ...plain, ...effectiveScale(maxAbs, plain) };
284
+ return keepsDigits(figures, spec, next2) ? next2 : void 0;
285
+ }
286
+ if (specUnitKind(spec) !== "number" || !/^(?:|\p{Sc}|[A-Z]{3})$/u.test(spec.suffix.trim())) return;
287
+ let magnitude = NEXT_MAGNITUDE[spec.magnitude];
288
+ if (magnitude === void 0 || maxAbs / MAGNITUDE_DIVISOR[magnitude] < 1) return;
289
+ let next = { ...spec, magnitude, decimals: 1, rollMagnitude: void 0 };
290
+ if (maxAbs === 1 / 0) return next;
291
+ let rolled = { ...next, ...effectiveScale(maxAbs, next) };
292
+ rolled.decimals = floorDecimals(figures, spec, rolled.magnitude, rolled.decimals);
293
+ let widest = (candidate) => maxOf(figures.map((value) => formatWithSpec(value, candidate).length)), held = { ...next, decimals: floorDecimals(figures, spec, magnitude), thousandsSep: spec.thousandsSep || ",", rollMagnitude: !1 }, step = rolled.magnitude === magnitude || widest(held) > widest(rolled) ? rolled : held;
294
+ return widest(step) >= widest(spec) ? void 0 : step;
295
+ }
296
+ function exampleOf(spec) {
297
+ let whole = spec.thousandsSep === "" ? "1" : `1${spec.thousandsSep}234`, fraction = spec.decimals > 0 ? `${spec.decimalSep}${"2345678".slice(0, spec.decimals)}` : "", body = `${spec.signed ? "+" : ""}${spec.prefix}${whole}${fraction}${MAGNITUDE_LABEL[spec.magnitude]}${spec.suffix}`;
298
+ return spec.negative === "parens" ? `(${body})` : body;
299
+ }
300
+ function withRowFormats(rows, formats) {
301
+ return rows.map((row) => {
302
+ let next = formats.get(row.id), children = row.children === void 0 ? void 0 : withRowFormats(row.children, formats);
303
+ return next === void 0 && children === row.children ? row : {
304
+ ...row,
305
+ ...next === void 0 ? {} : { format: next.format },
306
+ ...next?.unitAffix === void 0 ? {} : { unitAffix: next.unitAffix },
307
+ ...children === void 0 ? {} : { children }
308
+ };
309
+ });
310
+ }
311
+ function withCellFormats(rows, formats) {
312
+ return rows.map((row) => {
313
+ let next = formats.get(row.id), children = row.children === void 0 ? void 0 : withCellFormats(row.children, formats);
314
+ if (next === void 0 && children === void 0) return row;
315
+ let cells = next === void 0 ? row.cells : { ...row.cells };
316
+ for (let [columnId, format] of next ?? []) {
317
+ let cell = row.cells[columnId];
318
+ cells[columnId] = typeof cell == "number" ? { v: cell, format } : { ...cell, format };
319
+ }
320
+ return { ...row, ...cells === void 0 ? {} : { cells }, ...children === void 0 ? {} : { children } };
321
+ });
322
+ }
323
+ function rowExample(row, decimal) {
324
+ if (row === void 0) return;
325
+ if (row.format !== void 0) return row.format;
326
+ let calc = row.calc;
327
+ return calc !== void 0 && "op" in calc && (calc.op === "share" || calc.op === "percentDelta") ? `1${decimal}2%` : void 0;
328
+ }
329
+ function authoredRows(rows, into = /* @__PURE__ */ new Map()) {
330
+ for (let row of rows)
331
+ into.set(row.id, row), row.children && authoredRows(row.children, into);
332
+ return into;
333
+ }
334
+ function fitTableFormats(data, options, resolved, columns, ctx) {
335
+ let current = data, unlifted = { ...options, [ZERO_LIFT]: "none" }, result = resolved.lifted ? resolveTable(data, unlifted) : resolved, fitted, exhausted = /* @__PURE__ */ new Set(), decimal = ctx.decimal ?? ".", fittedRows = /* @__PURE__ */ new Set(), fittedColumns = /* @__PURE__ */ new Set(), fittedCells = /* @__PURE__ */ new Set();
336
+ for (let round = 0; round < 8; round++) {
337
+ let table = result.table, resolvedById = new Map(table.rows.map((row) => [row.id, row])), rowsById = authoredRows(current.rows), authoredColumns = new Map(current.columns.map((column) => [column.id, column])), rowOverflow = /* @__PURE__ */ new Set(), rowPrinting = /* @__PURE__ */ new Set(), columnOverflow = /* @__PURE__ */ new Set(), cellOverflow = [], rowFigures = /* @__PURE__ */ new Map(), columnFigures = /* @__PURE__ */ new Map(), figure = (map, id, value) => {
338
+ value !== 0 && map.set(id, [...map.get(id) ?? [], Math.abs(value)]);
339
+ };
340
+ for (let column of columns(table)) {
341
+ if (column.width === void 0 || column.kind !== "value" && column.kind !== "computed") continue;
342
+ let room = column.width - 2 * ctx.padX, authoredColumn = authoredColumns.get(column.id);
343
+ for (let row of table.rows) {
344
+ if (row.role === "section") continue;
345
+ let parent = row.inline === !0 && row.parentId !== void 0 ? resolvedById.get(row.parentId) : void 0;
346
+ if (row.inline === !0 && (parent === void 0 || ctx.lineFont === void 0)) continue;
347
+ let cell = row.cells[column.id];
348
+ if (cell === void 0 || cell.state !== "value" || typeof cell.raw != "number") continue;
349
+ let tabular = ctx.figures?.(column, cell.displayed), font = parent !== void 0 ? ctx.lineFont(parent, row, cell.displayed, tabular) : ctx.cellFont(cell), measured = ctx.measure(cell.displayed, figureFont(font, tabular)).width, overflows = measured + (ctx.slack?.(font, measured) ?? 0) > room;
350
+ if (cell.format !== void 0) {
351
+ overflows && cellOverflow.push({ rowId: row.id, columnId: column.id, format: cell.format, max: Math.abs(cell.raw) });
352
+ continue;
353
+ }
354
+ figure(rowFigures, row.id, cell.raw), figure(columnFigures, column.id, cell.raw);
355
+ let authoredRow = rowsById.get(row.id), rowFormatted = rowExample(authoredRow, decimal) !== void 0 && (authoredRow.calc !== void 0 || authoredRow.inline === !0 || authoredColumn?.format === void 0), fits = authoredRow?.fitFormat !== !1 && !(authoredRow?.scale === "money" && authoredRow[MAGNITUDE_GROUP] !== void 0);
356
+ rowFormatted && fits && rowPrinting.add(row.id), overflows && (rowFormatted ? fits : authoredColumn?.fitFormat !== !1) && (rowFormatted ? rowOverflow.add(row.id) : columnOverflow.add(column.id));
357
+ }
358
+ }
359
+ let rowFormattedColumn = (columnId) => authoredColumns.get(columnId)?.format !== void 0 ? !1 : table.rows.some((row) => {
360
+ let authored = rowsById.get(row.id);
361
+ return authored?.format !== void 0 && authored.calc === void 0 && row.inline !== !0 && typeof row.cells[columnId]?.raw == "number";
362
+ }), rowFormats = /* @__PURE__ */ new Map();
363
+ for (let rowId of rowOverflow) {
364
+ if (exhausted.has(`row:${rowId}`)) continue;
365
+ let row = rowsById.get(rowId), spec = parseFormatExample(rowExample(row, decimal)), automatic = row.format === void 0 || row[AUTOMATIC_FORMAT] === !0, next = shorterSpec({ ...spec, automatic }, rowFigures.get(rowId) ?? []);
366
+ if (next === void 0) {
367
+ exhausted.add(`row:${rowId}`);
368
+ continue;
369
+ }
370
+ let before = unitOfSpec(spec), after = unitOfSpec(next);
371
+ rowFormats.set(rowId, {
372
+ format: exampleOf(next),
373
+ // The label names the unit the cells now read in.
374
+ ...row.unitAffix !== void 0 && before !== null && after !== null && row.unitAffix === before && before !== after ? { unitAffix: after } : {}
375
+ });
376
+ }
377
+ let unitOf = (row, spec) => `${row.inline === !0 ? "line" : "row"}|${row.unitAffix ?? ""}|${spec.prefix.trim()}|${spec.suffix.trim()}|${specUnitKind(spec)}|${spec.magnitude}`, caps = /* @__PURE__ */ new Map();
378
+ for (let [rowId, next] of rowFormats) {
379
+ let row = resolvedById.get(rowId);
380
+ if (row === void 0) continue;
381
+ let spec = parseFormatExample(next.format), key = unitOf(row, spec);
382
+ caps.set(key, Math.min(caps.get(key) ?? 1 / 0, spec.decimals));
383
+ }
384
+ for (let rowId of rowPrinting) {
385
+ if (exhausted.has(`row:${rowId}`)) continue;
386
+ let row = resolvedById.get(rowId), shortened = rowFormats.get(rowId), example = shortened?.format ?? rowExample(rowsById.get(rowId), decimal);
387
+ if (row === void 0 || example === void 0) continue;
388
+ let spec = parseFormatExample(example), cap = caps.get(unitOf(row, spec));
389
+ if (cap === void 0 || spec.decimals <= cap || cap === 3 && spec.thousandsSep === "") continue;
390
+ let decimals = floorDecimals(rowFigures.get(rowId) ?? [], spec, spec.magnitude, cap);
391
+ decimals >= spec.decimals || rowFormats.set(rowId, { ...shortened, format: exampleOf({ ...spec, decimals }) });
392
+ }
393
+ let columnFormats = /* @__PURE__ */ new Map();
394
+ for (let columnId of columnOverflow) {
395
+ if (exhausted.has(`col:${columnId}`)) continue;
396
+ if (rowFormattedColumn(columnId)) {
397
+ exhausted.add(`col:${columnId}`);
398
+ continue;
399
+ }
400
+ let authoredExample = authoredColumns.get(columnId), example = authoredExample?.format ?? table.columns.find((column) => column.id === columnId)?.format, automatic = options.format === void 0 && (authoredExample?.format === void 0 || authoredExample[AUTOMATIC_FORMAT] === !0), next = example === void 0 ? void 0 : shorterSpec({ ...parseFormatExample(example), automatic }, columnFigures.get(columnId) ?? []);
401
+ if (next === void 0) {
402
+ exhausted.add(`col:${columnId}`);
403
+ continue;
404
+ }
405
+ columnFormats.set(columnId, exampleOf(next));
406
+ }
407
+ let cellFormats = /* @__PURE__ */ new Map();
408
+ for (let { rowId, columnId, format, max } of cellOverflow) {
409
+ let key = tableCellNodeId("cell", rowId, columnId);
410
+ if (exhausted.has(key)) continue;
411
+ let next = shorterSpec(parseFormatExample(format), [max]);
412
+ if (next === void 0) {
413
+ exhausted.add(key);
414
+ continue;
415
+ }
416
+ cellFormats.set(rowId, (cellFormats.get(rowId) ?? /* @__PURE__ */ new Map()).set(columnId, exampleOf(next)));
417
+ }
418
+ if (rowFormats.size === 0 && columnFormats.size === 0 && cellFormats.size === 0) break;
419
+ for (let rowId of rowFormats.keys()) fittedRows.add(rowId);
420
+ for (let columnId of columnFormats.keys()) fittedColumns.add(columnId);
421
+ for (let [rowId, formats] of cellFormats) for (let columnId of formats.keys()) fittedCells.add(`${rowId}\0${columnId}`);
422
+ let rows = rowFormats.size === 0 ? current.rows : withRowFormats(current.rows, rowFormats);
423
+ current = {
424
+ ...current,
425
+ columns: current.columns.map((column) => columnFormats.has(column.id) ? { ...column, format: columnFormats.get(column.id) } : column),
426
+ rows: cellFormats.size === 0 ? rows : withCellFormats(rows, cellFormats)
427
+ }, fitted = resolveTable(current, unlifted, data), result = fitted;
428
+ }
429
+ if (fitted === void 0) return;
430
+ {
431
+ let table = result.table, resolvedById = new Map(table.rows.map((row) => [row.id, row])), rowsById = authoredRows(current.rows), familyKey = (row, spec) => `${row.inline === !0 ? "line" : "row"}|${row.unitAffix ?? ""}|${spec.prefix.trim()}|${spec.suffix.trim()}|${specUnitKind(spec)}|${spec.magnitude}`, families = /* @__PURE__ */ new Map();
432
+ for (let [id, authored] of rowsById) {
433
+ let row = resolvedById.get(id), example = rowExample(authored, decimal);
434
+ if (row === void 0 || example === void 0 || authored.calc !== void 0 || authored.fitFormat === !1) continue;
435
+ let spec = parseFormatExample(example), key = familyKey(row, spec);
436
+ families.set(key, [...families.get(key) ?? [], { id, spec }]);
437
+ }
438
+ let unified = /* @__PURE__ */ new Map();
439
+ for (let members of families.values()) {
440
+ if (!members.some((member) => fittedRows.has(member.id))) continue;
441
+ let least = minOf(members.map((member) => member.spec.decimals));
442
+ for (let member of members) {
443
+ if (member.spec.decimals <= least || least === 3 && member.spec.thousandsSep === "") continue;
444
+ let figures = Object.values(resolvedById.get(member.id).cells).flatMap((cell) => cell?.state === "value" && typeof cell.raw == "number" && cell.raw !== 0 && cell.format === void 0 ? [Math.abs(cell.raw)] : []), decimals = floorDecimals(figures, member.spec, member.spec.magnitude, least);
445
+ decimals < member.spec.decimals && unified.set(member.id, { format: exampleOf({ ...member.spec, decimals }) });
446
+ }
447
+ }
448
+ if (unified.size > 0) {
449
+ for (let id of unified.keys()) fittedRows.add(id);
450
+ current = { ...current, rows: withRowFormats(current.rows, unified) }, fitted = resolveTable(current, unlifted, data);
451
+ }
452
+ }
453
+ let lifts = zeroFigureFormats(current, fitted.table, fittedRows, fittedColumns, fittedCells, decimal, options, data);
454
+ return lifts.size > 0 && (current = { ...current, rows: withCellFormats(current.rows, lifts) }), (lifts.size > 0 || options[ZERO_LIFT] !== "none") && (fitted = resolveTable(current, options, data)), { data: current, resolved: fitted, changes: formatChanges(data, current, decimal) };
455
+ }
456
+ function formatsFittedWarning(changes) {
457
+ if (changes.length === 0) return;
458
+ let name = (change) => change.row !== void 0 && change.column !== void 0 ? `cell '${change.row}/${change.column}'` : change.row !== void 0 ? `row '${change.row}'` : `column '${change.column}'`, listed = changes.slice(0, 6).map((change) => `${name(change)} ${change.from ?? "derived"} to ${change.to}`).join("; ");
459
+ return {
460
+ code: "table-formats-fitted",
461
+ severity: "info",
462
+ message: `fitFormats shortened ${changes.length} format${changes.length === 1 ? "" : "s"} to fit authored widths: ${listed}${changes.length > 6 ? `; and ${changes.length - 6} more` : ""}`,
463
+ detail: { changes },
464
+ suggest: "Widen the column, or set fitFormat: false on the row or column to keep its format as authored."
465
+ };
466
+ }
467
+ function formatChanges(before, after, decimal) {
468
+ let changes = [], rowsBefore = authoredRows(before.rows), rowsAfter = authoredRows(after.rows);
469
+ for (let [id, row] of rowsAfter) {
470
+ let from = rowExample(rowsBefore.get(id), decimal), to = rowExample(row, decimal);
471
+ from !== to && to !== void 0 && changes.push({ row: id, ...from === void 0 ? {} : { from }, to });
472
+ }
473
+ let columnsBefore = new Map(before.columns.map((column) => [column.id, column]));
474
+ for (let column of after.columns) {
475
+ let from = columnsBefore.get(column.id)?.format, to = column.format;
476
+ from !== to && to !== void 0 && changes.push({ column: column.id, ...from === void 0 ? {} : { from }, to });
477
+ }
478
+ for (let [id, row] of rowsAfter)
479
+ for (let [columnId, cell] of Object.entries(row.cells ?? {})) {
480
+ let to = typeof cell == "object" && cell !== null ? cell.format : void 0, earlier = rowsBefore.get(id)?.cells?.[columnId], from = typeof earlier == "object" && earlier !== null ? earlier.format : void 0;
481
+ to !== void 0 && from !== to && changes.push({ row: id, column: columnId, ...from === void 0 ? {} : { from }, to });
482
+ }
483
+ return changes;
484
+ }
485
+ function zeroFigureFormats(data, table, fittedRows, fittedColumns, fittedCells, decimal, options, source) {
486
+ let lifts = /* @__PURE__ */ new Map();
487
+ if (fittedRows.size === 0 && fittedColumns.size === 0 && fittedCells.size === 0) return lifts;
488
+ let rowsById = authoredRows(data.rows), sourceRows = authoredRows(source.rows), automatic = options.format === void 0 && options.unit === void 0 && options.magnitude !== "million" && options.magnitude !== "thousand";
489
+ for (let column of data.columns) {
490
+ if (column.kind !== "value") continue;
491
+ let columnFormat = column.format, automaticColumn = automatic && source.columns.find((entry) => entry.id === column.id)?.format === void 0;
492
+ for (let row of table.rows) {
493
+ let authoredRow = rowsById.get(row.id), authored = authoredRow?.cells?.[column.id], ownFitted = typeof authored == "object" && authored !== null && authored.format !== void 0 && fittedCells.has(`${row.id}\0${column.id}`) ? authored.format : void 0, raw = typeof authored == "number" ? authored : typeof authored == "object" && authored !== null && typeof authored.v == "number" && (authored.format === void 0 || ownFitted !== void 0) ? authored.v : void 0;
494
+ if (raw === void 0 || raw === 0 || authoredRow.calc !== void 0) continue;
495
+ let rowFormat = rowExample(authoredRow, decimal), line = row.inline === !0, rowFormatted = rowFormat !== void 0 && (columnFormat === void 0 || line), example = ownFitted ?? (rowFormatted ? fittedRows.has(row.id) && (line || specUnitKind(parseFormatExample(rowFormat)) !== "number") ? rowFormat : void 0 : fittedColumns.has(column.id) ? columnFormat ?? table.columns.find((entry) => entry.id === column.id)?.format : void 0);
496
+ if (example === void 0) continue;
497
+ let sourceRow = sourceRows.get(row.id);
498
+ if (ownFitted === void 0 && (rowFormatted ? automatic && (sourceRow?.format === void 0 || sourceRow[AUTOMATIC_FORMAT] === !0) : automaticColumn)) continue;
499
+ let spec = parseFormatExample(example), scaled = raw / MAGNITUDE_DIVISOR[spec.magnitude];
500
+ if (roundsToZero(scaled, spec.decimals)) {
501
+ if (ownFitted !== void 0 || row.inline === !0) {
502
+ if (options[ZERO_LIFT] !== void 0) continue;
503
+ zeroLifts.count++;
504
+ }
505
+ lifts.set(row.id, (lifts.get(row.id) ?? /* @__PURE__ */ new Map()).set(column.id, exampleOf({ ...spec, decimals: nonzeroDecimals(scaled, spec.decimals) })));
506
+ }
507
+ }
508
+ }
509
+ return lifts;
510
+ }
511
+
512
+ // src/core/charts/table/layout.ts
513
+ var CRISP = 0.5, NOTE_BASELINE_LOCK = 0.88, HEADER_RULE_GAP = 7, GROUP_PAD_TOP = 6, GROUP_PAD_BOTTOM = 2, HEAT_ONLY_ROW_H = 14;
514
+ function cellRole(kind, text) {
515
+ return cellHoldsNumber(kind, text) ? {} : { role: "category" };
516
+ }
517
+ var COMPACT_RETRY = /* @__PURE__ */ Symbol("tableCompactRetry"), SIZING_ONLY = /* @__PURE__ */ Symbol("tableSizingOnly"), HEAD_LINES = /* @__PURE__ */ Symbol("tableHeadLines"), TIGHT_SPACING = /* @__PURE__ */ Symbol("tableTightSpacing"), HEAD_AIR_MIN = /* @__PURE__ */ Symbol("tableHeadAirMin"), TIGHT_PAD = 2, SUB_LINES = /* @__PURE__ */ Symbol("tableSubLines"), REGULAR_SPACING = /* @__PURE__ */ Symbol("tableRegularSpacing"), CARD_GUTTER = 12;
518
+ function cutCount(geometry) {
519
+ return geometry.scene.filter((node) => node.t === "text" && node.id.startsWith("cell:") && node.title !== void 0).length;
520
+ }
521
+ function layoutTable(authoredData, options = {}, resolved = resolveTable(authoredData, options)) {
522
+ return liftOrFallback(
523
+ (mode) => {
524
+ if (mode === "full") return layoutTableLadder(authoredData, options, resolved);
525
+ let step = { ...options, [ZERO_LIFT]: mode };
526
+ return layoutTableLadder(authoredData, step, resolveTable(authoredData, step));
527
+ },
528
+ (lifted, plain) => costsWidth(lifted, plain, options),
529
+ resolved.lifted,
530
+ (bound, plain) => missesFrame(bound, options) && !missesFrame(plain, options)
531
+ );
532
+ }
533
+ function missesFrame(geometry, options) {
534
+ let open = options[TARGET_SIZE]?.fixed;
535
+ return geometry.sizing !== void 0 && (open?.width !== !1 && geometry.size.width < geometry.sizing.minWidth || options.size !== void 0 && open?.height !== !1 && geometry.size.height < geometry.sizing.minHeight);
536
+ }
537
+ function costsWidth(lifted, plain, options) {
538
+ let misses = (geometry) => missesFrame(geometry, options);
539
+ if (misses(plain)) return !1;
540
+ if (misses(lifted) || cutCount(lifted) > cutCount(plain)) return !0;
541
+ let stepped = /* @__PURE__ */ new Set(["table-compact-fallback", "table-column-clipped", "table-overflow", "table-formats-fitted"]), before = new Set(plain.warnings.map((warning) => warning.code));
542
+ return lifted.warnings.some((warning) => stepped.has(warning.code) && !before.has(warning.code));
543
+ }
544
+ function themeGroupPad(theme) {
545
+ let pad = theme.table?.groupPad;
546
+ return pad?.top === void 0 && pad?.bottom === void 0 ? void 0 : { top: pad?.top ?? GROUP_PAD_TOP, bottom: pad?.bottom ?? GROUP_PAD_BOTTOM };
547
+ }
548
+ var groupAirAboveLeast = (pad, ruleSpace) => pad.top + ruleSpace + pad.bottom > 9;
549
+ function hasHeadAir(options) {
550
+ let theme = chartTheme(options), group = themeGroupPad(theme);
551
+ return (theme.table?.headPad?.top ?? 0) > 0 || (theme.table?.headPad?.bottom ?? HEADER_RULE_GAP) > HEADER_RULE_GAP || group !== void 0 && groupAirAboveLeast(group, Math.ceil(strokeToken(theme, "hair")));
552
+ }
553
+ function layoutTableLadder(authoredData, options, resolved) {
554
+ let base = options, sizingOnly = options[SIZING_ONLY] === !0, formatFits = /* @__PURE__ */ new Map(), once = (step) => layoutTableOnce(authoredData, step, resolved, sizingOnly, formatFits), targetSize = options[TARGET_SIZE], fullSizingOnly = sizingOnly && resolveSize(options.size).width !== targetSize?.sizePx.width, full = layoutTableOnce(authoredData, base, resolved, fullSizingOnly, formatFits), widthRepair = full.warnings.find((warning) => warning.code === "table-overflow" && warning.fix?.length), withWidthRepair = (drawn) => (widthRepair && (drawn.warnings = drawn.warnings.map((warning) => warning.code === "table-overflow" && warning.fix?.length ? widthRepair : warning)), drawn), open = options[TARGET_SIZE]?.fixed, widthFits = (geometry) => open?.width === !1 || geometry.size.width >= (geometry.sizing?.minWidth ?? 0), heightFits = (geometry) => options.size === void 0 || open?.height === !1 || geometry.size.height >= (geometry.sizing?.minHeight ?? 0), pad = options.cellPadX ?? cellPadX(full.marks.columns.length), margin = { ...base.margin, left: Math.min(base.margin?.left ?? CARD_GUTTER, CARD_GUTTER), right: Math.min(base.margin?.right ?? CARD_GUTTER, CARD_GUTTER) }, gutterHelps = full.plot.x > margin.left + 0.5 || full.size.width - (full.plot.x + full.plot.w) > margin.right + 0.5, fits = (geometry) => widthFits(geometry) && heightFits(geometry), fixedHeight = !heightOmitted(options.size) && open?.height !== !1, withFloor = (drawn) => {
555
+ let compact = drawn.sizing === void 0 ? void 0 : compactTable(authoredData, options, full, margin, Math.min(pad, 3), 2, resolved, !0, formatFits);
556
+ return compact?.sizing && !compact.refused && (drawn.sizing = {
557
+ ...drawn.sizing,
558
+ minWidth: Math.min(drawn.sizing.minWidth, compact.sizing.minWidth),
559
+ minHeight: fixedHeight ? Math.min(drawn.sizing.minHeight, compact.sizing.minHeight) : drawn.sizing.minHeight
560
+ }), withWidthRepair(drawn);
561
+ };
562
+ if (options.belowMinimum === "refuse" || !full.sizing) return full;
563
+ if (fits(full)) {
564
+ fullSizingOnly && (full = layoutTableOnce(authoredData, base, resolved, !1, formatFits));
565
+ let cut = cutCount(full), gutter = cut === 0 || !gutterHelps ? void 0 : layoutTableOnce(authoredData, { ...base, margin }, resolved, !1, formatFits), drawn = gutter?.sizing !== void 0 && fits(gutter) && cutCount(gutter) < cut ? gutter : full;
566
+ return open?.width === !1 ? drawn : withFloor(drawn);
567
+ }
568
+ if (widthFits(full) && fixedHeight && hasHeadAir(options)) {
569
+ let lean = once({ ...base, [HEAD_AIR_MIN]: !0 });
570
+ if (lean.sizing !== void 0 && fits(lean))
571
+ return withFloor(lean), lean.warnings.push({ code: "table-compact-fallback", severity: "info", message: "The full table did not fit. The head and group rows took their least air." }), lean;
572
+ }
573
+ if (widthFits(full)) return withWidthRepair(compactTable(authoredData, options, full, margin, Math.min(pad, 6), void 0, resolved, sizingOnly, formatFits));
574
+ let rung = (step) => once({ ...base, margin, cellPadX: step.pad, ...step.heads === void 0 ? {} : { [HEAD_LINES]: step.heads } }), narrowest = rung({ pad: Math.min(pad, 3), heads: 2 });
575
+ if (narrowest.sizing !== void 0 && !widthFits(narrowest)) return withWidthRepair(compactTable(authoredData, options, full, margin, Math.min(pad, 3), 2, resolved, sizingOnly, formatFits));
576
+ let tried = new Set(gutterHelps ? [] : [`${pad}`]);
577
+ for (let step of [{ pad }, { pad: Math.min(pad, 6) }, { pad: Math.min(pad, 3) }, { pad: Math.min(pad, 3), heads: 2 }]) {
578
+ let key = `${step.pad}${step.heads === void 0 ? "" : `:${step.heads}`}`;
579
+ if (tried.has(key)) continue;
580
+ tried.add(key);
581
+ let last = step.heads === void 0 ? rung(step) : narrowest;
582
+ if (last.sizing === void 0 || widthFits(last) && heightFits(last))
583
+ return withFloor(last), last.warnings.push({ code: "table-compact-fallback", severity: "info", message: `The full table did not fit. ${step.pad === pad && step.heads === void 0 ? "12 px side margins were" : `${step.pad} px cell air${step.heads === void 0 ? "" : ", heads on two lines"} and 12 px side margins were`} used.` }), last;
584
+ }
585
+ return withWidthRepair(compactTable(authoredData, options, full, margin, Math.min(pad, 3), 2, resolved, sizingOnly, formatFits));
586
+ }
587
+ function layoutTableCard(data, options = {}) {
588
+ return memoLayout(data, options, () => cardHeightFloor(layoutTableCard, data, options, classFloor(layoutTable, data, options, layoutTable(data, options))));
589
+ }
590
+ var layouts = /* @__PURE__ */ new WeakMap(), functionIds = /* @__PURE__ */ new WeakMap(), nextFunctionId = 0;
591
+ function memoLayout(data, options, layout) {
592
+ if (typeof options.theme == "string") return layout();
593
+ let key = layoutKey(data, options), byKey = layouts.get(data);
594
+ return (!byKey || byKey.size >= 32) && layouts.set(data, byKey = /* @__PURE__ */ new Map()), byKey.has(key) || byKey.set(key, layout()), deepCopy(byKey.get(key));
595
+ }
596
+ function layoutKey(data, options) {
597
+ let symbols = Object.getOwnPropertySymbols(options).map((symbol) => [symbol.description, options[symbol]]);
598
+ return JSON.stringify([data, options, symbols, currentSmallValues()], (_key, value) => typeof value != "function" ? value : (functionIds.has(value) || functionIds.set(value, nextFunctionId++), `function ${functionIds.get(value)}`));
599
+ }
600
+ function deepCopy(value, copies = /* @__PURE__ */ new Map()) {
601
+ if (value === null || typeof value != "object") return value;
602
+ if (copies.has(value)) return copies.get(value);
603
+ if (Array.isArray(value)) {
604
+ let copy2 = [];
605
+ copies.set(value, copy2);
606
+ for (let entry of value) copy2.push(deepCopy(entry, copies));
607
+ return copy2;
608
+ }
609
+ if (value instanceof Map) {
610
+ let copy2 = /* @__PURE__ */ new Map();
611
+ copies.set(value, copy2);
612
+ for (let [key, entry] of value) copy2.set(key, deepCopy(entry, copies));
613
+ return copy2;
614
+ }
615
+ if (value instanceof Set) {
616
+ let copy2 = /* @__PURE__ */ new Set();
617
+ copies.set(value, copy2);
618
+ for (let entry of value) copy2.add(deepCopy(entry, copies));
619
+ return copy2;
620
+ }
621
+ if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) return value;
622
+ let copy = footerPlans.has(value) ? copyFrame(value) : Object.getPrototypeOf(value) === null ? emptyIdRecord() : {};
623
+ copies.set(value, copy);
624
+ for (let key of Reflect.ownKeys(value)) copy[key] = deepCopy(value[key], copies);
625
+ return copy;
626
+ }
627
+ function classFloor(layout, data, options, geometry) {
628
+ if (geometry.refused || !geometry.sizing || panelTypeClass(options) !== void 0) return geometry;
629
+ let sizing = geometry.sizing;
630
+ if (sizing.minWidth >= geometry.size.width || typeWidthClass(sizing.minWidth) === typeWidthClass(geometry.size.width)) return geometry;
631
+ let height = Math.max(geometry.size.height, sizing.minHeight), byKey = classFloors.get(data);
632
+ (!byKey || byKey.size >= 32) && classFloors.set(data, byKey = /* @__PURE__ */ new Map());
633
+ let key = layoutKey(data, { ...options, size: [sizing.minWidth, typeWidthClass(geometry.size.width), height] }), floor = byKey.get(key);
634
+ if (floor === void 0) {
635
+ floor = sizing.minWidth;
636
+ for (let pass = 0; pass < 3 && typeWidthClass(floor) !== typeWidthClass(geometry.size.width); pass++) {
637
+ let probe = layout(data, { ...options, size: { width: floor, height }, [SIZING_ONLY]: !0, [REGULAR_SPACING]: !0 });
638
+ if (probe.refused || !probe.sizing || probe.sizing.minWidth >= floor) break;
639
+ floor = probe.sizing.minWidth;
640
+ }
641
+ byKey.set(key, floor);
642
+ }
643
+ return floor !== sizing.minWidth && (geometry.sizing = { ...sizing, minWidth: floor }), geometry;
644
+ }
645
+ var classFloors = /* @__PURE__ */ new WeakMap(), cardHeights = /* @__PURE__ */ new WeakMap();
646
+ function cardHeightFloor(layout, data, options, geometry) {
647
+ let width = geometry.size.width;
648
+ if (!(options[TARGET_SIZE]?.fixed?.height === !1) || geometry.refused || !geometry.sizing || width >= CARD_CLASS_WIDTH || panelTypeClass(options) !== void 0) return geometry;
649
+ let step = width < 400 ? 400 : CARD_CLASS_WIDTH, byKey = cardHeights.get(data);
650
+ (!byKey || byKey.size >= 32) && cardHeights.set(data, byKey = /* @__PURE__ */ new Map());
651
+ let key = layoutKey(data, { ...options, size: step });
652
+ if (!byKey.has(key)) {
653
+ let wider = layout(data, { ...options, size: { width: step } });
654
+ byKey.set(key, wider.refused || !wider.sizing ? void 0 : wider.sizing.naturalHeight);
655
+ }
656
+ let floor = byKey.get(key);
657
+ return floor !== void 0 && floor > geometry.sizing.naturalHeight && (geometry.sizing = { ...geometry.sizing, naturalHeight: floor }), geometry;
658
+ }
659
+ function compactTable(authoredData, options, full, margin, cellPadX2, heads, resolved, sizingOnly, formatFits) {
660
+ let compactOptions = {
661
+ ...options,
662
+ density: isCohortDensity(options.density ?? "regular") ? options.density : "compact",
663
+ margin,
664
+ // Tighter than the full table, never wider: a dense table already pads 3 or 5 px.
665
+ cellPadX: cellPadX2,
666
+ labelIndent: { base: 8 + (options.outlineMarks === !0 ? INDENT_BASE : 0), step: 8 },
667
+ // A fixed height never grows (docs/manual.md, "Fixed height"): only an omitted height turns automatic.
668
+ size: heightOmitted(options.size) ? { width: full.size.width } : { width: full.size.width, height: full.size.height },
669
+ [COMPACT_RETRY]: full.size.height,
670
+ ...heads === void 0 ? {} : { [HEAD_LINES]: heads }
671
+ }, compact = layoutTableOnce(authoredData, compactOptions, resolved, sizingOnly, formatFits), across = 2 * Math.max(0, cellPadX2 - TIGHT_PAD) * compact.marks.columns.length + Math.max(0, compact.plot.x - TIGHT_PAD * 2) + Math.max(0, compact.size.width - compact.plot.x - compact.plot.w - TIGHT_PAD * 2) + (authoredData.columnGroups ?? []).reduce((sum, group) => sum + Math.max(0, (group.spacer ?? 0) - TIGHT_PAD * 2), 0) + 6 + 4 * Math.max(0, maxOf(resolved.table.rows.map((row) => row.level))) + 4, misses = missesSize(compact, options), { width: missesWidth, height: missesHeight } = misses, reachable = !missesWidth || (compact.sizing?.minWidth ?? 0) - compact.size.width <= across, lastOptions = compactOptions;
672
+ if (!options[REGULAR_SPACING] && compact.sizing && (missesWidth || missesHeight) && reachable) {
673
+ let tightWarning = tightSpacingWarning(misses, { width: "cell air, column gaps and side margins", height: "row air and top and bottom margins" }, "the table", "compact", { ...compact, sizing: compact.sizing }, options);
674
+ compact = layoutTableOnce(authoredData, lastOptions = {
675
+ ...compactOptions,
676
+ [TIGHT_SPACING]: { columns: missesWidth, rows: missesHeight },
677
+ ...missesWidth ? {
678
+ cellPadX: Math.min(cellPadX2, TIGHT_PAD),
679
+ labelIndent: { base: TIGHT_PAD + (options.outlineMarks === !0 ? INDENT_BASE : 0), step: TIGHT_PAD * 2 }
680
+ } : {},
681
+ margin: {
682
+ ...missesHeight ? { top: TIGHT_PAD * 2, bottom: TIGHT_PAD * 2 } : {},
683
+ ...margin,
684
+ ...missesWidth ? { left: Math.min(margin.left ?? CARD_GUTTER, TIGHT_PAD * 2), right: Math.min(margin.right ?? CARD_GUTTER, TIGHT_PAD * 2) } : {}
685
+ }
686
+ }, resolved, sizingOnly, formatFits), compact.warnings.push(tightWarning);
687
+ }
688
+ if (missesHeight && compact.sizing && compact.size.height + 0.5 < compact.sizing.minHeight && resolved.table.columns.some((col) => col.subLabel !== void 0)) {
689
+ let warnings = compact.warnings;
690
+ compact = layoutTableOnce(authoredData, { ...lastOptions, [SUB_LINES]: 1 }, resolved, sizingOnly, formatFits);
691
+ for (let warning of warnings) warning.code === "table-tight-spacing" && !compact.warnings.includes(warning) && compact.warnings.push(warning);
692
+ }
693
+ return compact.warnings.push({ code: "table-compact-fallback", severity: "info", message: `The full table did not fit. Compact spacing and tight margins${heightOmitted(options.size) ? " and automatic height" : ""} were used.` }), compact;
694
+ }
695
+ function layoutTableOnce(authoredData, options, initialResolved, sizingOnly, formatFits) {
696
+ let tight = options[TIGHT_SPACING]?.columns === !0, tightRows = options[TIGHT_SPACING]?.rows === !0, size = resolveSize(options.size), measure = options.measure ?? defaultMeasurer, data = authoredData, resolved = initialResolved, warnings = [...resolved.warnings], theme = resolveSemanticPaletteTheme(
697
+ chartTheme(options),
698
+ options.palette,
699
+ warnings
700
+ ), ruleSpace = Math.ceil(strokeToken(theme, "hair")), heavySectionRule = theme.table?.section?.rule !== "hair", rowRuleWidth = theme.table?.ruleWidths?.row ?? strokeToken(theme, "hair"), sectionRuleWidth = heavySectionRule ? 2 * strokeToken(theme, "rule") : rowRuleWidth, sectionRuleSpace = Math.ceil(sectionRuleWidth);
701
+ if (options.fitFormats === !0) {
702
+ let padX = options.cellPadX ?? cellPadX(visibleColumns(resolved.table).length), fitKey = `${options.density ?? "regular"}:${padX}`, fitted = formatFits.get(fitKey);
703
+ if (!formatFits.has(fitKey)) {
704
+ let fitLadder = levelLadder(theme, options.density ?? "regular", options.target, textScaleOf(options)), fitFonts = tableFonts(theme, fitLadder), rowById2 = new Map(resolved.table.rows.map((row) => [row.id, row])), fitChanges = new Set(resolved.table.rows.filter((row) => visibleInlineRows(row, options.inlineVisibility).length > 0).map((row) => row.id));
705
+ fitted = fitTableFormats(data, options, resolved, (table2) => visibleColumns(table2), {
706
+ measure,
707
+ padX,
708
+ cellFont: (cell) => {
709
+ let row = rowById2.get(cell.rowId);
710
+ return kindFont(rowFont(theme, fitLadder, fitFonts, cell.role, row?.step ?? cell.level, row?.hasChildren === !0, fitChanges.size > 0 && fitChanges.has(cell.rowId)), row?.kind, cell.kind === "rowLabel", theme);
711
+ },
712
+ figures: (col, text) => cellDrawsTabular(theme, col.kind, text),
713
+ lineFont: (parent, line, text, tabular) => changeLineFitFont(theme, fitLadder, parent.step, line.polarity !== void 0, text, measure, tabular),
714
+ ...options.locale?.decimal === void 0 ? {} : { decimal: options.locale.decimal }
715
+ }), formatFits.set(fitKey, fitted);
716
+ }
717
+ if (fitted !== void 0) {
718
+ let warningsAfter = warnings.splice(resolved.warnings.length);
719
+ warnings.length = 0, pushAll(warnings, fitted.resolved.warnings), pushAll(warnings, warningsAfter);
720
+ let fittedNote = formatsFittedWarning(fitted.changes);
721
+ fittedNote !== void 0 && warnings.push(fittedNote), data = fitted.data, resolved = fitted.resolved;
722
+ }
723
+ }
724
+ let table = resolved.table, dataRows = visibleRows(table, void 0, expansionRootsHidden(table, options.expansion)), rows = hasNoDataRows(table) ? [...dataRows, emptyMessageRow(table, DEFAULT_EMPTY_MESSAGE)] : dataRows, fullRows = options.topN ? resolveTable(data, { ...options, topN: void 0 }).table.rows : table.rows, fullIds = new Set(fullRows.map((row) => row.id)), widthRows = [...fullRows, ...table.rows.filter((row) => !fullIds.has(row.id)), ...rows.filter((row) => !fullIds.has(row.id) && !table.rows.includes(row))], cols = visibleColumns(table), spans = groupSpans(table, cols), bandedColumnRuns = [];
725
+ for (let col of cols) {
726
+ if (col.band !== !0) continue;
727
+ let previous = bandedColumnRuns[bandedColumnRuns.length - 1];
728
+ previous !== void 0 && cols[cols.indexOf(col) - 1]?.id === previous.columnIds[previous.columnIds.length - 1] ? previous.columnIds.push(col.id) : bandedColumnRuns.push({ columnIds: [col.id] });
729
+ }
730
+ let spacerBefore = /* @__PURE__ */ new Map();
731
+ for (let group of table.columnGroups) {
732
+ if (group.spacer === void 0 || group.spacer <= 0) continue;
733
+ let first = cols.find((col) => group.columnIds.includes(col.id));
734
+ first === void 0 || first.id === cols[0]?.id || spacerBefore.set(first.id, tight ? Math.min(group.spacer, TIGHT_PAD * 2) : group.spacer);
735
+ }
736
+ let spacerTotal = [...spacerBefore.values()].reduce((a, b) => a + b, 0), figures = printsFigures(options.figures, cols), rowRule = figures ? { paint: tableRuleInk(), width: rowRuleWidth } : { paint: { token: "grid" }, width: strokeToken(theme, "hair") };
737
+ options.figures === !1 && figures && warnings.push({
738
+ code: "figures-need-heat",
739
+ severity: "warn",
740
+ message: "figures: false needs a heat column, and this table draws none, so it prints its figures",
741
+ field: ["options", "figures"],
742
+ suggest: "Remove figures: false, or give a column a heat lane in options.encodings."
743
+ });
744
+ let cellPadX2 = options.cellPadX ?? cellPadX(cols.length), occupied = createOccupiedIndex({ x: 0, y: 0, w: size.width, h: size.height }), keyless = options.legend === "none", heatLanes = heatRanges(cols, rows), heatEntries = heatKey(cols, heatLanes, theme, options.strings, options.locale?.language), arrowShapes = arrowKey(cols, rows);
745
+ keyless && legendOff(warnings, "table", [...heatEntries, ...arrowShapes].map((entry) => entry.label));
746
+ let keyEntries = keyless ? [] : heatEntries, arrowEntries = keyless ? [] : arrowShapes, authored = authoredNotes(options), frameInput = {
747
+ size,
748
+ margin: { ...canvasMargin(theme, size.width), ...options.margin },
749
+ ...frameTextOptions(options),
750
+ // uniform money unit hoisted out of every cell → the frame slot
751
+ // (solveFrame prepends 'in' itself)
752
+ unit: table.unit ?? options.unit,
753
+ // rows/cols, not table.rows/table.columns: this surface is static, so a
754
+ // marker inside a collapsed row or a hidden column is unreachable here
755
+ // and its footnote would point at nothing
756
+ footnotes: [...tableFootnotes(table, rows, cols), ...authored, ...options[ENGINE_NOTES] ?? []],
757
+ // Nothing in a table points at a note: no head or cell carries a
758
+ // mark, so a "1)" before the note is a number the reader cannot follow
759
+ // (the same rule as for the engine's own notes). The author's
760
+ // notes stay notes and print without a number.
761
+ numberedFootnotes: authored,
762
+ unreferencedNotes: authored.map((_, i) => i + 1),
763
+ // A table's notes read in the tertiary ink where the theme names one.
764
+ footnoteInk: "inkMeta",
765
+ // The notes and the source keep the cell air in from both edges, as on React, also at canvas margin 0.
766
+ footerInset: cellPadX2,
767
+ ...keyEntries.length + arrowEntries.length > 0 ? {
768
+ legend: {
769
+ options: legendRequired(options.legend, warnings, "table", theme, keyEntries.length > 0 ? "its heat bands cut at edges no cell prints" : "its arrow shapes stand for shares no cell prints"),
770
+ items: [
771
+ ...keyEntries.map((entry) => ({ id: entry.id, label: entry.label, paint: entry.fill, key: "box", stroke: { token: "grid" } })),
772
+ ...arrowEntries.map((entry) => ({ id: entry.id, label: entry.label, paint: { token: "ink" }, key: "glyph", glyph: entry.glyph }))
773
+ ]
774
+ },
775
+ legendFont: "footnote"
776
+ } : {},
777
+ theme,
778
+ measure
779
+ }, frame = solveFrame(frameInput, occupied), plot = frame.plot, groundTexts = /* @__PURE__ */ new Map(), statusCuts = /* @__PURE__ */ new Map(), statusFits = /* @__PURE__ */ new Map(), surface = resolveSurface(theme), density = options.density ?? "regular", language = presetLanguage(options.variant), ladder = levelLadder(theme, density, options.target, textScaleOf(options));
780
+ tightRows && (ladder.pad = () => 1, ladder.totalPad = 1, ladder.rowHeight !== void 0 && (ladder.rowHeight = ladder.lineBox(ladder.label) + 2));
781
+ let { lineBox, pad: levelPad } = ladder, widthPlan = tableWidths(table, theme, measure, options, {
782
+ columns: cols,
783
+ rows,
784
+ widthRows,
785
+ fullRows,
786
+ available: plot.w,
787
+ spacerTotal,
788
+ headLines: options[HEAD_LINES],
789
+ subLines: options[SUB_LINES]
790
+ });
791
+ cellPadX2 = widthPlan.cellPadX, frameInput.footerInset !== cellPadX2 && (frameInput.footerInset = cellPadX2, occupied = createOccupiedIndex({ x: 0, y: 0, w: size.width, h: size.height }), frame = solveFrame(frameInput, occupied), plot = frame.plot);
792
+ let nodes = [...frame.nodes], gridX = Math.round(plot.x), gridY = Math.round(plot.y), { widths, sizingMinimums, totalW, minimumW, fonts, regularFonts, columnHeaderText, cellFont, cellStep, rowIndent, operatorSlot, childCount, hasChanges: hasChangesById } = widthPlan, rowFont2 = (role, level, hasChildren, hasChanges = !1) => rowFont(theme, ladder, regularFonts, role, level, hasChildren, hasChanges), sectionInk = theme.table?.section?.ink, ofWhichMuted = theme.table?.ofWhich !== "ink";
793
+ function rowHeight(row) {
794
+ if (row.role === "total" && row.kind !== "result" && row.kind !== "driver")
795
+ return ladder.totalPad * 2 + lineBox(fonts.total.size) + 2 * ruleSpace;
796
+ if (row.role === "section") {
797
+ if (tightRows || options[COMPACT_RETRY] !== void 0) return sectionNatural();
798
+ let space = theme.table?.section?.spaceBefore ?? lineBox(ladder.label);
799
+ return sectionNatural() + Math.round(row.id === rows[0]?.id ? Math.min(space, lineBox(ladder.label) / 4) : space);
800
+ }
801
+ let pad = levelPad(row.step, row.hasChildren);
802
+ return figures ? ladder.rowHeight !== void 0 ? ladder.rowHeight + inlineBlock(row).extra : pad * 2 + lineBox(rowFont2(row.role, row.step, row.hasChildren, hasChangesById.size > 0 && hasChangesById.has(row.id)).size) + ruleSpace + inlineBlock(row).extra : Math.max(HEAT_ONLY_ROW_H, lineBox(ladder.size(0)));
803
+ }
804
+ function sectionNatural() {
805
+ return levelPad(1, !1) * 2 + ladder.sectionBox(fonts.section.size) + sectionRuleSpace;
806
+ }
807
+ function lineHoldsValue(line, colId) {
808
+ let cell = line.cells[colId];
809
+ return cell !== void 0 && cell.state === "value" && cell.displayed !== "";
810
+ }
811
+ let labelColumnId = cols.find((col) => col.kind === "rowLabel")?.id;
812
+ function labelNoteOf(row) {
813
+ if (!(labelColumnId === void 0 || row.role === "section"))
814
+ return row.cells[labelColumnId]?.note;
815
+ }
816
+ let inlineBlocks = /* @__PURE__ */ new Map();
817
+ function inlineBlock(row) {
818
+ let cached = inlineBlocks.get(row);
819
+ if (cached !== void 0) return cached;
820
+ let lines = visibleInlineRows(row, options.inlineVisibility), box = ladder.inlineBox(Math.max(ladder.inlineSize(), lines.length ? changeLineFont(theme, ladder, row.step).size : 0)), note = labelNoteOf(row), base = note === void 0 ? 0 : 1, stacked = base + lines.length, noteSlots = /* @__PURE__ */ new Map();
821
+ for (let col of cols) {
822
+ if (col.noteLine !== !0 || col.kind === "rowLabel" || row.cells[col.id]?.note === void 0) continue;
823
+ let slot = base + lines.length;
824
+ for (let [index, line] of lines.entries())
825
+ if (!lineHoldsValue(line, col.id)) {
826
+ slot = base + index;
827
+ break;
828
+ }
829
+ noteSlots.set(col.id, slot), stacked = Math.max(stacked, slot + 1);
830
+ }
831
+ let block = {
832
+ lines,
833
+ ...note === void 0 ? {} : { note },
834
+ box,
835
+ noteSlots,
836
+ extra: stacked === 0 ? 0 : ladder.inlineGap + stacked * box
837
+ };
838
+ return inlineBlocks.set(row, block), block;
839
+ }
840
+ let inlineFont2 = (level, signed) => inlineFont(theme, ladder, level, signed), sumOf = (map) => [...map.values()].reduce((a, b) => a + b, spacerTotal);
841
+ pushAll(warnings, widthPlan.warnings);
842
+ function sizingProbe(sizing2, marks2) {
843
+ return {
844
+ type: "table",
845
+ size,
846
+ sizing: sizing2,
847
+ plot,
848
+ scene: [],
849
+ labels: [],
850
+ axes: [],
851
+ annotations: [],
852
+ frame: frame.frame,
853
+ marks: marks2,
854
+ derived: { table, computedCells: resolved.computedCells },
855
+ a11y: { title: "", desc: "", counts: [] },
856
+ warnings,
857
+ debug: { occupied: [], decisions: [] }
858
+ };
859
+ }
860
+ if (sizingOnly && options[TARGET_SIZE]?.fixed.height === !1 && !heightOmitted(options.size))
861
+ return sizingProbe(tableSizing(size, plot, plot.y, totalW, minimumW), {
862
+ table: { x: gridX, y: gridY, w: totalW, h: 0 },
863
+ columns: cols.map((col) => ({ id: col.id, x: gridX, w: widths.get(col.id) })),
864
+ rows: [],
865
+ headerBand: { x: gridX, y: gridY, w: totalW, h: 0 }
866
+ });
867
+ let hasGroups = table.columnGroups.length > 0, hasGroupHeads = table.columnGroups.some((g) => g.heading !== !1), leanHead = options[HEAD_AIR_MIN] === !0 || options[COMPACT_RETRY] !== void 0, headPadTop = tightRows || leanHead ? 0 : theme.table?.headPad?.top ?? 0, themeHeadBottom = theme.table?.headPad?.bottom ?? HEADER_RULE_GAP, headPadBottom = tightRows ? 2 : leanHead ? Math.min(themeHeadBottom, HEADER_RULE_GAP) : themeHeadBottom, themeGroup = themeGroupPad(theme), groupPad = tightRows ? { top: 2, bottom: 2 } : leanHead && themeGroup !== void 0 && groupAirAboveLeast(themeGroup, ruleSpace) ? void 0 : themeGroup, headRoom = (col) => Math.max(1, Math.round(widths.get(col.id)) - 2 * cellPadX2 - (col.kind === "rowLabel" ? rowIndent(0) : 0)), headerFits = new Map(cols.map((col) => [col.id, fitText(
868
+ columnHeaderText(col),
869
+ fonts.header,
870
+ headRoom(col),
871
+ 1 / 0,
872
+ measure,
873
+ { target: options.target, typeRole: "axis" }
874
+ )])), subFits = new Map(cols.flatMap((col) => col.subLabel === void 0 ? [] : [[col.id, fitText(
875
+ col.subLabel,
876
+ fonts.sub,
877
+ headRoom(col),
878
+ !col.label && col.kind === "rowLabel" ? 1 : options[SUB_LINES] ?? 1 / 0,
879
+ measure,
880
+ { target: options.target, typeRole: "axis" }
881
+ )]])), headerSubH = subFits.size === 0 ? 0 : maxOf([...subFits.values()].map((fit) => lineBox(fonts.sub.size) + (fit.lines.length > 1 ? fit.h * (fit.lines.length - 1) / fit.lines.length : 0))), headerTextH = Math.max(fonts.header.size * 1.2, maxOf([...headerFits.values()].map((fit) => fit.h))), headerLabelH = headPadTop + Math.max(ladder.headBox(fonts.header.size), headerTextH) + headerSubH + headPadBottom + ruleSpace, headerGroupH = hasGroupHeads ? groupPad === void 0 ? ladder.headBox(fonts.group.size) + 9 : groupPad.top + ladder.headBox(fonts.group.size) + ruleSpace + groupPad.bottom : 0, headerH = headerGroupH + headerLabelH, spanRule = (options.groupRule ?? "span") === "span", groupAlign = options.groupAlign ?? "center", colX = /* @__PURE__ */ new Map(), x = gridX;
882
+ for (let col of cols) {
883
+ x += spacerBefore.get(col.id) ?? 0;
884
+ let w = Math.round(widths.get(col.id));
885
+ colX.set(col.id, { x, w }), x += w;
886
+ }
887
+ let tableW = x - gridX, rowX = options.rowExtent === "frame" && (options.margin?.left ?? 0) > 0 ? 0 : gridX, filledShort = options.rowExtent === void 0 && options.frameFill !== "none" && Math.floor(plot.w - tableW) >= 1, rowW = (options.rowExtent ?? "frame") === "frame" && !filledShort ? Math.max(tableW + gridX - rowX, (options.rowExtent === "frame" && (options.margin?.right ?? 0) > 0 ? size.width : Math.round(plot.x + plot.w)) - rowX) : tableW + gridX - rowX, wrappedLines = /* @__PURE__ */ new Map(), cutTitles = /* @__PURE__ */ new Map(), rowExtra = /* @__PURE__ */ new Map(), labelHead = /* @__PURE__ */ new Map(), affixBelow = /* @__PURE__ */ new Set(), labelTexts = (colId) => rows.flatMap((row) => row.role === "section" ? [] : [row.cells[colId]?.displayed ?? ""]);
888
+ for (let row of rows) {
889
+ let sectionCol = row.role === "section" ? cols.find((col) => col.kind === "rowLabel") : void 0, sectionCell = sectionCol === void 0 ? void 0 : row.cells[sectionCol.id];
890
+ if (sectionCol !== void 0 && sectionCell?.displayed) {
891
+ let font = cellFont(sectionCell), text = theme.table?.section?.case === "asis" ? sectionCell.displayed : sectionCell.displayed.toUpperCase(), badgeW = row.badge === void 0 ? 0 : Math.round(measure(row.badge.text, fonts.chip).width + 2 * CHIP_PAD_X) + SECTION_CHIP_GAP, room = tableW - (colX.get(sectionCol.id).x - gridX) - 2 * cellPadX2 - rowIndent(cellStep(sectionCell)) - affixRoom(row, font) - badgeW;
892
+ if (measure(text, font).width > room) {
893
+ let wrap = fitText(text, font, Math.max(room, 20), 2, measure, { target: options.target, typeRole: "label" });
894
+ wrappedLines.set(tableCellKey(row.id, sectionCol.id), wrap.lines), wrap.title !== void 0 && cutTitles.set(tableCellKey(row.id, sectionCol.id), wrap.title), wrap.lines.length > 1 && rowExtra.set(row.id, Math.ceil((wrap.lines.length - 1) * font.size * 1.2));
895
+ }
896
+ }
897
+ for (let col of cols) {
898
+ let rowLabel = col.kind === "rowLabel" && row.role !== "section";
899
+ if (col.kind !== "text" && !rowLabel) continue;
900
+ let cell = row.cells[col.id];
901
+ if (!cell || !cell.displayed) continue;
902
+ let font = cellFont(cell), w = colX.get(col.id).w, indent = cell.kind === "rowLabel" ? rowIndent(cellStep(cell)) : 0, room = w - 2 * cellPadX2 - indent - (cell.note && cell.kind !== "rowLabel" && col.noteLine !== !0 ? measure(` ${cell.note}`, fonts.note).width : 0), affix = cell.kind === "rowLabel" ? affixRoom(row, font) : 0, textW = measure(cell.displayed, font).width, authoredBreak = col.kind === "text" && col.wrap === !0 && cell.displayed.includes(`
903
+ `);
904
+ if (textW <= room - affix && !authoredBreak) continue;
905
+ let ownLine = rowLabel && affix > 0, maxW = ownLine ? room : room - affix, slack = rowLabel && !visibleInlineRows(row, options.inlineVisibility).some((line) => line.label !== "") ? inlineBlock(row).extra : 0, affixHead = ownLine ? Math.ceil((theme.table?.qualifier === void 0 ? inlineFont2(row.step, !1) : qualifierFont(font, theme)).size * 1.2) : 0, setHead = (own) => {
906
+ let head = Math.max(0, own - slack);
907
+ head > 0 && labelHead.set(row.id, head), head > 0 && rowExtra.set(row.id, Math.max(rowExtra.get(row.id) ?? 0, head));
908
+ };
909
+ if (ownLine && (affixBelow.add(row.id), textW <= maxW)) {
910
+ wrappedLines.set(tableCellKey(row.id, col.id), [cell.displayed]), setHead(affixHead);
911
+ continue;
912
+ }
913
+ let wrap = rowLabel ? fitText(cell.displayed, font, Math.max(maxW, 20), options.rowLabelLines ?? 2, measure, { target: options.target, typeRole: "label", breakAfter: !0 }) : fitText(cell.displayed, font, Math.max(maxW, 20), col.kind === "text" && col.wrap ? 1 / 0 : 2, measure, { target: options.target, typeRole: "label" }), last = rowLabel && wrap.title !== void 0 ? distinctCut(cell.displayed, wrap.lines, labelTexts(col.id), font, Math.max(maxW, 20), measure, !0) : void 0;
914
+ last !== void 0 && (wrap.lines = [...wrap.lines.slice(0, -1), last]), wrappedLines.set(tableCellKey(row.id, col.id), wrap.lines), wrap.title !== void 0 && cutTitles.set(tableCellKey(row.id, col.id), wrap.title);
915
+ let grow = Math.ceil((wrap.lines.length - 1) * font.size * 1.2);
916
+ rowLabel ? setHead(grow + affixHead) : grow > 0 && rowExtra.set(row.id, Math.max(rowExtra.get(row.id) ?? 0, grow));
917
+ }
918
+ }
919
+ let rowY = /* @__PURE__ */ new Map(), y = gridY + headerH;
920
+ for (let [index, row] of rows.entries()) {
921
+ index > 0 && row.spacer !== void 0 && (y += Math.round(row.spacer));
922
+ let h = rowHeight(row) + (rowExtra.get(row.id) ?? 0);
923
+ rowY.set(row.id, { y, h }), y += h;
924
+ }
925
+ let tableH = y - gridY;
926
+ {
927
+ let callerH = options[COMPACT_RETRY], grow = rowDrivenHeight({
928
+ options: callerH === void 0 || !heightOmitted(options.size) ? options : {},
929
+ width: size.width,
930
+ height: size.height,
931
+ chromeH: size.height - plot.h,
932
+ rowsH: y - plot.y + 4,
933
+ ...callerH === void 0 ? {} : { ceiling: callerH }
934
+ });
935
+ if (grow !== void 0) return layoutTableOnce(authoredData, { ...options, size: { width: size.width, height: grow } }, initialResolved, sizingOnly, formatFits);
936
+ }
937
+ let targetSize = options[TARGET_SIZE];
938
+ if (!sizingOnly && targetSize?.fixed.height === !1 && size.width === targetSize.sizePx.width && size.height === targetSize.sizePx.height) {
939
+ let height = tableSizing(size, plot, y, totalW, 0).naturalHeight;
940
+ if (height !== size.height) {
941
+ let nextSize = { width: size.width, height }, nextOccupied = createOccupiedIndex({ x: 0, y: 0, w: size.width, h: height }), nextFrame = solveFrame({ ...frameInput, size: nextSize }, nextOccupied);
942
+ nextFrame.plot.x === plot.x && nextFrame.plot.y === plot.y && nextFrame.plot.w === plot.w && tableSizing(nextSize, nextFrame.plot, y, totalW, 0).naturalHeight === height && (size = nextSize, occupied = nextOccupied, frame = nextFrame, plot = frame.plot, nodes.length = 0, pushAll(nodes, frame.nodes));
943
+ }
944
+ }
945
+ y > plot.y + plot.h && warnings.push({
946
+ code: "table-overflow",
947
+ severity: "error",
948
+ message: `${rows.length} rows exceed the plot height at density '${density}' \u2014 use 'compact', fewer rows, or a taller size`
949
+ });
950
+ let wrapFits = !1;
951
+ if (widthPlan.wouldWrap.length > 0 && size.width - plot.w + sumOf(sizingMinimums) > size.width)
952
+ if (options[VERIFY_ADVICE]) {
953
+ let ids = new Set(widthPlan.wouldWrap.map((col) => col.id)), wrapped = { ...authoredData, columns: authoredData.columns.map((col) => ids.has(col.id) ? { ...col, wrap: !0 } : col) };
954
+ wrapFits = !missesFrame(layoutTable(wrapped, options), options);
955
+ } else
956
+ wrapFits = widthPlan.wrapMinimumWidth === void 0 || widthPlan.wrapMinimumWidth <= plot.w;
957
+ let sizing = {
958
+ ...tableSizing(size, plot, y, totalW, minimumW),
959
+ ...wrapFits ? { hint: `Or set wrap: true on text column ${widthPlan.wouldWrap.map((col) => `'${col.id}'`).join(", ")}: its cells then take as many lines as they need instead of one line's width.` } : {}
960
+ };
961
+ if (sizingOnly) return sizingProbe(sizing, { table: { x: gridX, y: gridY, w: tableW, h: tableH }, columns: cols.map((col) => ({ id: col.id, ...colX.get(col.id) })), rows: [], headerBand: { x: gridX, y: gridY, w: tableW, h: headerH } });
962
+ let numericStats = /* @__PURE__ */ new Map();
963
+ for (let col of cols) {
964
+ if (col.kind !== "value" && col.kind !== "computed") continue;
965
+ let values = [], textReserve = 0;
966
+ for (let row of rows) {
967
+ let cell = row.cells[col.id];
968
+ cell && (cell.state === "value" && typeof cell.raw == "number" && values.push(cell.raw), textReserve = Math.max(textReserve, measure(cell.displayed, figureFont(cellFont(cell), cellDrawsTabular(theme, col.kind, cell.displayed))).width));
969
+ }
970
+ let signed = col.kind === "computed" && !!col.polarity || (col.format ? parseFormatExample(col.format).signed : !1);
971
+ numericStats.set(col.id, {
972
+ min: values.length > 0 ? minOf(values) : 0,
973
+ max: values.length > 0 ? maxOf(values) : 0,
974
+ maxAbs: values.length > 0 ? maxOf(values.map((value) => Math.abs(value))) : 0,
975
+ textReserve,
976
+ signed
977
+ });
978
+ }
979
+ let sparkDomains = sparklineDomains(cols, rows);
980
+ if (hasGroupHeads) {
981
+ let headingFrom = -1 / 0, headingEnd = -1 / 0;
982
+ for (let [groupIndex, g] of table.columnGroups.entries()) {
983
+ if (spans[groupIndex].span === 0 || g.heading === !1) continue;
984
+ let tracks = g.columnIds.filter((columnId) => colX.has(columnId)).map((columnId) => colX.get(columnId)), first = tracks.reduce((a, b) => b.x < a.x ? b : a), last = tracks.reduce((a, b) => b.x + b.w > a.x + a.w ? b : a), cx = Math.round(first.x + (last.x + last.w - first.x) / 2), bracketY = groupPad === void 0 ? gridY + headerGroupH - 3 + CRISP : gridY + groupPad.top + ladder.headBox(fonts.group.size) + CRISP, label = groupHeadingLabel(g.label), labelY = groupPad === void 0 ? bracketY - 4 - fonts.group.size * 1.2 : gridY + groupPad.top + (ladder.headBox(fonts.group.size) - fonts.group.size * 1.2) / 2, note = groupHeadingNote(g.note), faces = groupHeadingFaces(fonts.group), noteFont = faces.note, measured = groupHeadingWidth(g, faces, measure), trackedW = measured.label, labelW = trackedW + measured.note, spanStart = Math.round(first.x + cellPadX2), spanEnd = Math.round(last.x + last.w - cellPadX2), overflows = labelW > spanEnd - spanStart, centred = groupAlign === "center" && !overflows, clear = first.x > headingFrom ? Math.round(headingEnd + fonts.group.size) : -1 / 0, startX = overflows || groupAlign === "left" ? Math.max(spanStart, clear) : Math.round(groupAlign === "right" ? spanEnd - labelW : cx - labelW / 2);
985
+ headingFrom = first.x, headingEnd = centred ? cx + labelW / 2 : startX + labelW, centred ? note === void 0 ? nodes.push({
986
+ t: "text",
987
+ typeRole: "axis",
988
+ id: `group:${g.id}`,
989
+ x: cx,
990
+ y: labelY,
991
+ lines: [label],
992
+ align: "middle",
993
+ font: fonts.group,
994
+ ink: tableInk("head"),
995
+ owner: {},
996
+ part: "tableGroupHeader"
997
+ }) : (nodes.push({
998
+ t: "text",
999
+ typeRole: "axis",
1000
+ id: `group:${g.id}`,
1001
+ x: startX,
1002
+ y: labelY,
1003
+ lines: [label],
1004
+ align: "start",
1005
+ font: fonts.group,
1006
+ ink: tableInk("head"),
1007
+ owner: {},
1008
+ part: "tableGroupHeader"
1009
+ }), nodes.push({
1010
+ t: "text",
1011
+ typeRole: "footnote",
1012
+ id: `group-note:${g.id}`,
1013
+ x: startX + trackedW,
1014
+ y: labelY,
1015
+ lines: [note],
1016
+ align: "start",
1017
+ font: noteFont,
1018
+ ink: tableInk("secondary"),
1019
+ owner: {},
1020
+ part: "tableGroupHeader"
1021
+ })) : (nodes.push({
1022
+ t: "text",
1023
+ typeRole: "axis",
1024
+ id: `group:${g.id}`,
1025
+ x: startX,
1026
+ y: labelY,
1027
+ lines: [label],
1028
+ align: "start",
1029
+ font: fonts.group,
1030
+ ink: tableInk("head"),
1031
+ owner: {},
1032
+ part: "tableGroupHeader"
1033
+ }), note !== void 0 && nodes.push({
1034
+ t: "text",
1035
+ typeRole: "footnote",
1036
+ id: `group-note:${g.id}`,
1037
+ x: startX + trackedW,
1038
+ y: labelY,
1039
+ lines: [note],
1040
+ align: "start",
1041
+ font: noteFont,
1042
+ ink: tableInk("secondary"),
1043
+ owner: {},
1044
+ part: "tableGroupHeader"
1045
+ })), nodes.push({
1046
+ t: "line",
1047
+ id: `group-rule:${g.id}`,
1048
+ x1: spanRule ? spanStart : centred ? Math.round(cx - labelW / 2) : startX,
1049
+ y1: bracketY,
1050
+ // A heading wider than its block runs on, but the rule stops at the block's last column.
1051
+ x2: spanRule ? spanEnd : Math.round(centred ? cx + labelW / 2 : startX + labelW),
1052
+ y2: bracketY,
1053
+ stroke: tableRuleInk(),
1054
+ width: rowRuleWidth,
1055
+ owner: {},
1056
+ part: "tableGroupRule"
1057
+ });
1058
+ }
1059
+ }
1060
+ let headerRuleY = gridY + headerH - 1 + CRISP, headerSubY = headerRuleY - headPadBottom - headerSubH - fonts.header.size * 1.2 + fonts.header.size * 1.2;
1061
+ for (let col of cols) {
1062
+ if (!col.label && col.kind === "rowLabel") continue;
1063
+ let { x: cx, w } = colX.get(col.id), align = col.align === "right" ? "end" : col.align === "center" ? "middle" : "start", headerIndent = col.kind === "rowLabel" ? rowIndent(0) : 0, tx = align === "end" ? cx + w - cellPadX2 : align === "middle" ? cx + w / 2 : cx + cellPadX2 + headerIndent, label = columnHeaderText(col);
1064
+ nodes.push({
1065
+ t: "text",
1066
+ typeRole: "axis",
1067
+ id: `header:${col.id}`,
1068
+ x: tx,
1069
+ y: headerSubY - headerFits.get(col.id).h,
1070
+ lines: headerFits.get(col.id).lines,
1071
+ ...headerFits.get(col.id).title ? { title: label } : {},
1072
+ align,
1073
+ font: fonts.header,
1074
+ ink: tableInk("head"),
1075
+ owner: { colId: col.id },
1076
+ part: "tableHeader"
1077
+ }), col.subLabel !== void 0 && nodes.push({
1078
+ t: "text",
1079
+ typeRole: "axis",
1080
+ id: `header-sub:${col.id}`,
1081
+ x: tx,
1082
+ y: headerSubY,
1083
+ lines: subFits.get(col.id).lines,
1084
+ ...subFits.get(col.id).title ? { title: col.subLabel } : {},
1085
+ align,
1086
+ font: fonts.sub,
1087
+ ink: tableInk("subLabel"),
1088
+ owner: { colId: col.id },
1089
+ part: "tableHeaderSub"
1090
+ });
1091
+ }
1092
+ nodes.push({
1093
+ t: "line",
1094
+ id: "rule:header",
1095
+ x1: rowX,
1096
+ y1: headerRuleY,
1097
+ x2: rowX + rowW,
1098
+ y2: headerRuleY,
1099
+ // `table.headRule: 'ink'` closes the head on the text ink.
1100
+ stroke: { token: theme.table?.headRule === "ink" ? "ink" : "rule" },
1101
+ width: theme.table?.ruleWidths?.head ?? strokeToken(theme, "hair"),
1102
+ owner: {},
1103
+ part: "tableHeaderRule"
1104
+ });
1105
+ let bodyBottom = rowY.size > 0 ? maxOf([...rowY.values()].map((r) => r.y + r.h)) : gridY + headerH, spacerGaps = [];
1106
+ rows.forEach((row, index) => {
1107
+ if (index === 0 || row.spacer === void 0) return;
1108
+ let previous = rowY.get(rows[index - 1].id);
1109
+ spacerGaps.push({ from: previous.y + previous.h, to: rowY.get(row.id).y });
1110
+ });
1111
+ let blockDivider = (id, columnId, fromY = gridY) => {
1112
+ let edge = colX.get(columnId)?.x;
1113
+ edge === void 0 || edge <= gridX || dividerAt(id, Math.round(edge) + CRISP, fromY);
1114
+ };
1115
+ function dividerAt(id, x2, fromY) {
1116
+ if (nodes.some((node) => node.t === "line" && node.x1 === x2 && node.part === "tableGroupDivider")) return;
1117
+ let segments = [], start = fromY;
1118
+ for (let gap of spacerGaps)
1119
+ gap.from <= start || (segments.push([start, Math.round(gap.from) + CRISP]), start = Math.round(gap.to));
1120
+ segments.push([start, Math.round(bodyBottom) + CRISP]), segments.forEach(([y1, y2], index) => nodes.push({
1121
+ t: "line",
1122
+ id: index === 0 ? id : `${id}:${index}`,
1123
+ x1: x2,
1124
+ y1,
1125
+ x2,
1126
+ y2,
1127
+ stroke: tableRuleInk(),
1128
+ width: rowRuleWidth,
1129
+ owner: {},
1130
+ part: "tableGroupDivider"
1131
+ }));
1132
+ }
1133
+ if (hasGroups)
1134
+ for (let [groupIndex, g] of table.columnGroups.entries()) {
1135
+ if (groupIndex === 0 || spans[groupIndex].span === 0 || g.spacer !== void 0 && g.spacer > 0) continue;
1136
+ let firstVisible = g.columnIds.find((columnId) => colX.has(columnId));
1137
+ firstVisible !== void 0 && blockDivider(`rule:group-divider:${g.id}`, firstVisible);
1138
+ }
1139
+ for (let run of bandedColumnRuns)
1140
+ blockDivider(`rule:band-divider:${run.columnIds[0]}`, run.columnIds[0], gridY + headerGroupH);
1141
+ let closeBlock = (id, lastId, fromY) => {
1142
+ let index = cols.findIndex((col) => col.id === lastId), next = cols[index + 1];
1143
+ if (next !== void 0) {
1144
+ let nextGroup = table.columnGroups.find((group) => group.columnIds.includes(next.id));
1145
+ nextGroup !== void 0 && (nextGroup.spacer ?? 0) > 0 && nextGroup.columnIds.find((columnId) => colX.has(columnId)) === next.id || blockDivider(id, next.id, fromY);
1146
+ return;
1147
+ }
1148
+ if (options.rowExtent !== "frame") return;
1149
+ let last = colX.get(lastId);
1150
+ dividerAt(id, Math.round(last.x + last.w) - 1 + CRISP, fromY);
1151
+ };
1152
+ for (let group of table.columnGroups) {
1153
+ if (group.band !== !0) continue;
1154
+ let visible = group.columnIds.filter((columnId) => colX.has(columnId));
1155
+ visible.length > 0 && closeBlock(`rule:band-close:${group.id}`, visible[visible.length - 1], gridY);
1156
+ }
1157
+ for (let run of bandedColumnRuns)
1158
+ closeBlock(`rule:band-close:${run.columnIds[run.columnIds.length - 1]}`, run.columnIds[run.columnIds.length - 1], gridY + headerGroupH);
1159
+ let bandPaint = semanticPalettePaint(theme, options.palette, "neutral", 1 - surface.bandTint), totalGroundPaint = semanticPalettePaint(
1160
+ theme,
1161
+ options.palette,
1162
+ "neutral",
1163
+ 1 - Math.min(1, surface.bandTint * 2)
1164
+ ), strongColumnBandPaint = {
1165
+ token: "neutral",
1166
+ theme: { kind: "mix", from: { token: "ink" }, to: totalGroundPaint, weight: surface.bandTint }
1167
+ }, grounds = rowGrounds(table), columnBandFills = /* @__PURE__ */ new Map(), rowWashes = /* @__PURE__ */ new Map(), bandedGroups = table.columnGroups.filter((g) => g.band === !0), bandRect = (g) => {
1168
+ let visible = g.columnIds.filter((columnId) => colX.has(columnId));
1169
+ if (visible.length === 0) return;
1170
+ let first = colX.get(visible[0]), last = colX.get(visible[visible.length - 1]);
1171
+ return { x: first.x, w: last.x + last.w - first.x };
1172
+ }, expandedIds = new Set(rows.map((row) => row.parentId).filter((id) => id !== void 0)), groundMode = options.groupGround ?? theme.table?.groupGround ?? "expanded", groundShown = (open) => groundMode === "always" || groundMode === "expanded" && open, closers = finalClosers(rows), totalGroundless = theme.table?.grounds?.total !== void 0 && transparentCss(theme.table.grounds.total), rowById = new Map(rows.map((row) => [row.id, row])), topOf = (row) => {
1173
+ let top = row;
1174
+ for (; top.parentId !== void 0 && rowById.has(top.parentId); ) top = rowById.get(top.parentId);
1175
+ return top;
1176
+ }, blockRuled = /* @__PURE__ */ new Set(), opensBlock = (row) => row.parentId === void 0 && row.role !== "section" && expandedIds.has(row.id), blockRuleAbove = (row, next) => theme.table?.blockRule === "rule" && next.parentId === void 0 && (opensBlock(next) || next.id !== topOf(row).id && opensBlock(topOf(row))), lastRow = rows[rows.length - 1];
1177
+ rows.forEach((row, ri) => {
1178
+ let { y: ry, h: rh } = rowY.get(row.id), isTotal = row.role === "total" && row.kind !== "result" && row.kind !== "driver", isSection = row.role === "section", ground = row.kind === "member" ? expandedIds.has(row.id) && groundMode !== "none" ? "band" : void 0 : row.kind === "measure" || row.kind === "detail" || row.kind === "split" || row.kind === "subtotal" || row.kind === "result" || row.kind === "driver" ? void 0 : isTotal ? "emphasis" : language.groupBand && groundShown(expandedIds.has(row.id)) ? grounds.get(row.id) : void 0;
1179
+ ri > 0 && row.kind === "member" ? nodes.push(rule(`rule:member:${row.id}`, ry, { token: "rule" }, strokeToken(theme, "rule"), "tableMemberRule")) : ri > 0 && row.divider && nodes.push(rule(`rule:divider:${row.id}`, ry, { token: "rule" }, strokeToken(theme, "rule"), "tableDividerRule"));
1180
+ let customGround = authoredGround(row, isTotal);
1181
+ if (customGround !== void 0 && nodes.push({ t: "rect", id: `statementground:${row.id}`, rect: { x: rowX, y: ry, w: rowW, h: rh }, fill: { css: customGround }, owner: { rowId: row.id }, part: "tableStatementGround" }), row.kind === "result" && theme.table?.resultRule !== "none" && nodes.push(rule(`rule:result:${row.id}`, ry, { token: theme.table?.resultRule === "rule" ? "rule" : "ink" }, strokeToken(theme, "hair"), "tableResultRule")), ground !== void 0 && customGround === void 0 && !(isTotal && totalGroundless)) {
1182
+ let part = isTotal ? "tableTotalGround" : ground === "emphasis" ? "tableGroupGround" : "tableGroupBand";
1183
+ nodes.push({
1184
+ t: "rect",
1185
+ id: `${isTotal ? "totalground" : ground === "emphasis" ? "groupground" : "groupband"}:${row.id}`,
1186
+ rect: blockRuled.has(row.id) ? { x: rowX, y: ry + 1, w: rowW, h: rh - 1 } : { x: rowX, y: ry, w: rowW, h: rh },
1187
+ fill: isTotal ? totalGroundPaint : bandPaint,
1188
+ owner: { rowId: row.id },
1189
+ part
1190
+ });
1191
+ }
1192
+ for (let g of [...bandedGroups, ...bandedColumnRuns]) {
1193
+ let band = bandRect(g);
1194
+ if (band !== void 0) {
1195
+ for (let id of g.columnIds) columnBandFills.set(`${row.id}\0${id}`, ground === "emphasis" ? strongColumnBandPaint : totalGroundPaint);
1196
+ nodes.push({
1197
+ t: "rect",
1198
+ id: `columnband:${"id" in g ? g.id : g.columnIds[0]}:${row.id}`,
1199
+ rect: { x: band.x, y: ry, w: band.w, h: rh },
1200
+ fill: ground === "emphasis" ? strongColumnBandPaint : totalGroundPaint,
1201
+ owner: { rowId: row.id },
1202
+ part: "tableColumnBand"
1203
+ });
1204
+ }
1205
+ }
1206
+ let rowWash;
1207
+ if (options.anchorWash && row.step === 0 && row.hasChildren && row.defaultExpanded && (rowWash = semanticPalettePaint(theme, options.palette, "neutral", surface.anchorTint), nodes.push({
1208
+ t: "rect",
1209
+ id: `anchorwash:${row.id}`,
1210
+ rect: { x: rowX, y: ry, w: rowW, h: rh },
1211
+ fill: rowWash,
1212
+ owner: { rowId: row.id },
1213
+ part: "tableAnchorTint"
1214
+ })), row.highlightTone) {
1215
+ let tone = row.highlightTone, edgePaint = tone === "highlight" ? semanticPalettePaint(theme, options.palette, "focus") : { token: tone };
1216
+ rowWash = tone === "highlight" ? semanticPalettePaint(theme, options.palette, "focus", surface.rowTint) : { ...markRolePaint(tone, !0), tint: surface.rowTint }, nodes.push({
1217
+ t: "rect",
1218
+ id: `rowtint:${row.id}`,
1219
+ rect: { x: rowX, y: ry, w: rowW, h: rh },
1220
+ fill: rowWash,
1221
+ owner: { rowId: row.id },
1222
+ part: "tableRowTint"
1223
+ }), nodes.push({
1224
+ t: "rect",
1225
+ id: `rowedge:${row.id}`,
1226
+ rect: { x: rowX, y: ry, w: 3, h: rh },
1227
+ fill: edgePaint,
1228
+ owner: { rowId: row.id },
1229
+ part: "tableRowEdge"
1230
+ });
1231
+ }
1232
+ rowWash !== void 0 && rowWashes.set(row.id, rowWash);
1233
+ for (let col of cols) {
1234
+ let cell = row.cells[col.id];
1235
+ if (!cell) continue;
1236
+ let { x: cx, w } = colX.get(col.id);
1237
+ if (col.kind === "encoding") {
1238
+ pushAll(
1239
+ nodes,
1240
+ encodingSparklineNodes(col, row, { x: cx, y: ry, w, h: rh }, theme, options.palette, measure, sparkDomains.get(col.id), options.locale?.language)
1241
+ );
1242
+ continue;
1243
+ }
1244
+ if ((isSection || row.kind === "member" && expandedIds.has(row.id)) && col.kind !== "rowLabel") continue;
1245
+ let drop = isSection ? Math.max(0, rh - sectionNatural() - (rowExtra.get(row.id) ?? 0)) : 0;
1246
+ emitCell(cell, row, col.id, cx, w, ry + drop, rh - drop, isTotal, isSection);
1247
+ }
1248
+ let isLast = row.id === lastRow?.id, next = rows[ri + 1], spacedNext = next?.spacer !== void 0;
1249
+ if (closers.has(row.id)) {
1250
+ let finalRule = theme.table?.finalRule ?? "double";
1251
+ finalRule === "double" ? (nodes.push(rule(`rule:final:${row.id}:1`, ry + rh - 2, { token: "ink" }, strokeToken(theme, "hair"), "tableFinalRule")), nodes.push(rule(`rule:final:${row.id}:2`, ry + rh, { token: "ink" }, strokeToken(theme, "hair"), "tableFinalRule"))) : finalRule === "rule" && nodes.push(rule(`rule:final:${row.id}`, ry + rh, { token: "rule" }, strokeToken(theme, "hair"), "tableFinalRule"));
1252
+ } else if (next?.kind !== "result") {
1253
+ if (spacedNext && next.role === "total")
1254
+ nodes.push(rule(`rule:pre-total:${next.id}`, rowY.get(next.id).y, { token: "rule" }, strokeToken(theme, "rule"), "tableTotalRule")), isTotal && nodes.push(rule(`rule:total:${row.id}`, ry + rh, { token: "rule" }, strokeToken(theme, "rule"), "tableTotalRule"));
1255
+ else if (!(spacedNext && !isTotal))
1256
+ if (isTotal && next)
1257
+ nodes.push(rule(`rule:total:${row.id}`, ry + rh, { token: "rule" }, strokeToken(theme, "rule"), "tableTotalRule"));
1258
+ else if (isLast) {
1259
+ let close = isTotal ? "rule" : theme.table?.closeRule ?? "rule";
1260
+ close !== "none" && nodes.push(rule("rule:close", ry + rh, close === "grid" ? tableRuleInk() : { token: close }, close === "grid" ? rowRuleWidth : strokeToken(theme, "rule"), "tableCloseRule"));
1261
+ } else next?.role === "total" ? nodes.push(rule(`rule:pre-total:${next.id}`, ry + rh, { token: "rule" }, strokeToken(theme, "rule"), "tableTotalRule")) : isSection && heavySectionRule || (isSection ? nodes.push(rule(`rule:section:${row.id}`, ry + rh, theme.table?.headRule === "ink" ? { token: "ink" } : tableRuleInk(), rowRuleWidth, "tableSectionRule")) : next !== void 0 && blockRuleAbove(row, next) ? (nodes.push(rule(`rule:block:${next.id}`, ry + rh, { token: "rule" }, strokeToken(theme, "rule"), "tableBlockRule")), blockRuled.add(next.id)) : nodes.push(rule(`rule:row:${row.id}`, ry + rh, rowRule.paint, rowRule.width, "tableRowRule")));
1262
+ }
1263
+ let ruleRefused = isLast && theme.table?.closeRule === "none" || next?.kind === "result" && theme.table?.resultRule === "none";
1264
+ if (isSection && heavySectionRule && !ruleRefused) {
1265
+ let atY = Math.round(ry + rh) + ruleSpace - sectionRuleSpace / 2;
1266
+ nodes.push({ t: "line", id: `rule:section:${row.id}`, x1: rowX, y1: atY, x2: rowX + rowW, y2: atY, stroke: { token: "ink" }, width: sectionRuleWidth, owner: {}, part: "tableSectionRule" });
1267
+ }
1268
+ });
1269
+ function rule(id, atY, stroke, width, part) {
1270
+ let yCrisp = Math.round(atY) + CRISP;
1271
+ return { t: "line", id, x1: rowX, y1: yCrisp, x2: rowX + rowW, y2: yCrisp, stroke, width, owner: {}, part };
1272
+ }
1273
+ function usesTotalFace(kind) {
1274
+ return kind === void 0 ? !0 : kind === "subtotal" || kind === "result" || kind === "driver" ? !1 : kind !== "member" && kind !== "measure" || theme.table?.weights?.figures?.[kind] === void 0;
1275
+ }
1276
+ function affixRoom(row, font) {
1277
+ return row.unitAffix === void 0 ? 0 : theme.table?.qualifier === void 0 ? measure(` ${row.unitAffix}`, inlineFont2(row.step, !1)).width : measure(row.unitAffix, qualifierFont(font, theme)).width + (theme.table.qualifier.gap ?? 4);
1278
+ }
1279
+ function noteStatusCut(col, row, shown, full) {
1280
+ let cuts = statusCuts.get(col.id);
1281
+ cuts || statusCuts.set(col.id, cuts = /* @__PURE__ */ new Map());
1282
+ let key = `${shown}\0${full}`, cut = cuts.get(key) ?? { shown, full, rows: [] };
1283
+ cuts.set(key, cut), shown === "" && !cut.rows.includes(row.label) && cut.rows.push(row.label);
1284
+ }
1285
+ function emitStatusMark(cell, row, col, cx, w, ry, rh) {
1286
+ let owner = { rowId: row.id, colId: col.id }, square = statusSquare(fonts.body.size), side = Math.min(square.side, Math.max(0, w - 2));
1287
+ nodes.push({
1288
+ t: "rect",
1289
+ id: tableCellNodeId("chip", row.id, col.id),
1290
+ rect: { x: Math.round(cx + (w - side) / 2), y: Math.round(ry + (rh - side) / 2), w: side, h: side },
1291
+ fill: statusSquarePaint(cell.tone),
1292
+ owner,
1293
+ part: "tableChip",
1294
+ title: cell.displayed,
1295
+ display: { state: cell.displayed }
1296
+ }), noteStatusCut(col, row, "", cell.displayed);
1297
+ }
1298
+ function statusFit(col, label, font, room, trackRoom) {
1299
+ let key = `${col.id}\0${room}\0${trackRoom}`, fits = statusFits.get(key);
1300
+ if (fits === void 0) {
1301
+ let labels = [...new Set(widthRows.flatMap((row) => {
1302
+ let cell = row.cells[col.id];
1303
+ return cell?.kind === "status" && cell.state === "value" ? [cell.displayed] : [];
1304
+ }))];
1305
+ fits = new Map(labels.map((text) => {
1306
+ let fit2 = fitStatusLabel(text, font, room, trackRoom, measure), distinct = fit2?.title === void 0 ? void 0 : distinctCut(text, [fit2.text], labels, font, room, measure), cut = distinct === void 0 ? fit2 : { text: distinct, title: text };
1307
+ return [text, cut && cut.text !== text && cut.text.slice(text.startsWith("\u2026") ? 1 : 0).startsWith("\u2026") ? null : cut];
1308
+ }));
1309
+ let keeper = /* @__PURE__ */ new Map();
1310
+ for (let [text, fit2] of fits) {
1311
+ let kept = fit2?.title === void 0 ? void 0 : keeper.get(fit2.text);
1312
+ fit2?.title !== void 0 && (kept === void 0 || text.length < kept.length) && keeper.set(fit2.text, text);
1313
+ }
1314
+ for (let [text, fit2] of fits) fit2?.title !== void 0 && keeper.get(fit2.text) !== text && fits.set(text, null);
1315
+ statusFits.set(key, fits);
1316
+ }
1317
+ let fit = fits.get(label);
1318
+ return fit === void 0 ? fitStatusLabel(label, font, room, trackRoom, measure) : fit;
1319
+ }
1320
+ function authoredGround(row, isTotal) {
1321
+ let css = row.kind === "subtotal" ? theme.table?.grounds?.subtotal : isTotal ? theme.table?.grounds?.total : void 0;
1322
+ return css === void 0 || transparentCss(css) ? void 0 : css;
1323
+ }
1324
+ function groundInk(ground, ink, tone) {
1325
+ if (ground === void 0 || "theme" in ink && ink.theme?.kind === "ground-text") return ink;
1326
+ let paint = onTableGround(ink, ground, tone), key = JSON.stringify(paint), known = groundTexts.get(key);
1327
+ return known !== void 0 ? known : (groundTexts.set(key, paint), paint);
1328
+ }
1329
+ function toneInk(ground, tone) {
1330
+ return groundInk(ground, toneTextPaint(theme, tone, options.palette), tone);
1331
+ }
1332
+ function emitCell(cell, row, colId, cx, w, ry, rh, isTotal, isSection) {
1333
+ let rowId = row.id, col = cols.find((c) => c.id === colId), font = cellFont(cell), owner = { rowId, colId };
1334
+ cell.state === "open" && nodes.push({ t: "rect", id: tableCellNodeId("openground", rowId, colId), rect: { x: cx, y: ry, w, h: rh }, fill: bandPaint, owner, part: "tableOpenGround" });
1335
+ let inline = inlineBlock(row), valueBox = lineBox(font.size), head = inline.extra > 0 || affixBelow.has(rowId) ? labelHead.get(rowId) ?? 0 : 0, blockTop = ry + Math.max(0, (rh - ruleSpace - (valueBox + head + inline.extra)) / 2), figureCell = isFigureCell(cell, col), tintBox = { x: cx + 1, y: ry + ruleSpace + 1, w: Math.max(0, w - 2), h: Math.max(0, rh - ruleSpace - 2) }, toneFill = figureCell && cell.tone !== "neutral" && theme.table?.tones === "fill" && !isTotal ? tableGround(cell.tone === "good" && cell.strong ? "goodStrong" : cell.tone) : void 0;
1336
+ toneFill !== void 0 && nodes.push({ t: "rect", id: tableCellNodeId("toneground", rowId, colId), rect: tintBox, fill: toneFill, owner, part: "tableToneGround" });
1337
+ let rowGround = authoredGround(row, isTotal), columnBand = columnBandFills.get(`${rowId}\0${colId}`), textGround = toneFill ?? (rowGround === void 0 ? columnBand === strongColumnBandPaint && !rowWashes.has(rowId) ? columnBand : void 0 : rowWashes.get(rowId) ?? columnBand ?? { css: rowGround });
1338
+ if (figureCell && cell.bar !== void 0 && cell.bar > 0) {
1339
+ let top = (inline.extra + head > 0 ? blockTop : ry + (rh - ruleSpace - valueBox) / 2) + 2;
1340
+ nodes.push({ t: "rect", id: tableCellNodeId("sizebar", rowId, colId), rect: { x: cx + 1, y: top, w: (w - 1) * cell.bar, h: valueBox - 4 }, fill: { token: "background", theme: { kind: "table-ground", ground: col.emphasis === "muted" ? "barMuted" : "bar" } }, owner, part: "tableSizeBar" });
1341
+ }
1342
+ let stacked = inline.extra + head > 0, textY = stacked ? blockTop + (valueBox - font.size * 1.2) / 2 : ry + (rh - font.size * 1.2) / 2, contentX = cx + cellPadX2, contentW = (isSection ? tableW - (cx - gridX) : w) - 2 * cellPadX2;
1343
+ if (cell.kind === "status" && cell.state === "value" && col.statusMark === "square") {
1344
+ let square = statusSquare(fonts.body.size), fit = statusFit(col, cell.displayed, fonts.body, w - 2 * cellPadX2 - square.side - square.gap, w - square.side - square.gap);
1345
+ if (fit === null) return emitStatusMark(cell, row, col, cx, w, ry, rh);
1346
+ let { text: label, title } = fit;
1347
+ title !== void 0 && noteStatusCut(col, row, label, title);
1348
+ let groupW = square.side + square.gap + measure(label, fonts.body).width, markX = Math.round(cx + (w - groupW) / 2);
1349
+ nodes.push({
1350
+ t: "rect",
1351
+ id: tableCellNodeId("chip", rowId, colId),
1352
+ rect: { x: markX, y: Math.round(ry + (rh - square.side) / 2), w: square.side, h: square.side },
1353
+ fill: statusSquarePaint(cell.tone),
1354
+ owner,
1355
+ part: "tableChip"
1356
+ }), nodes.push({
1357
+ t: "text",
1358
+ typeRole: "label",
1359
+ id: tableCellNodeId("cell", rowId, colId),
1360
+ x: markX + square.side + square.gap,
1361
+ y: ry + (rh - fonts.body.size * 1.2) / 2,
1362
+ lines: [label],
1363
+ align: "start",
1364
+ font: fonts.body,
1365
+ ink: groundInk(textGround, { token: "ink" }),
1366
+ owner,
1367
+ part: "tableCell",
1368
+ role: "category",
1369
+ display: { state: cell.displayed },
1370
+ ...title === void 0 ? {} : { title }
1371
+ });
1372
+ return;
1373
+ }
1374
+ if (cell.kind === "status" && cell.state === "value") {
1375
+ let fit = statusFit(col, cell.displayed, fonts.chip, w - 2 * cellPadX2 - 2 * CHIP_PAD_X, w - 2 * CHIP_PAD_X);
1376
+ if (fit === null) return emitStatusMark(cell, row, col, cx, w, ry, rh);
1377
+ let { text: label, title } = fit;
1378
+ title !== void 0 && noteStatusCut(col, row, label, title);
1379
+ let tw = measure(label, fonts.chip).width, chipW = Math.round(tw + 2 * CHIP_PAD_X), chipH = chipHeight(rh, fonts.chip.size), chipX = Math.round(cx + (w - chipW) / 2), chipY = Math.round(ry + (rh - chipH) / 2), chip = chipPaints(theme, cell.tone, options.palette);
1380
+ nodes.push({
1381
+ t: "rect",
1382
+ id: tableCellNodeId("chip", rowId, colId),
1383
+ rect: { x: chipX, y: chipY, w: chipW, h: chipH },
1384
+ fill: chip.fill,
1385
+ // A status preset's chips are square; everywhere else they keep the
1386
+ // theme's chip radius.
1387
+ radius: language.squareChips ? 0 : surface.chipRadius,
1388
+ owner,
1389
+ part: "tableChip"
1390
+ }), nodes.push({
1391
+ t: "text",
1392
+ typeRole: "label",
1393
+ id: tableCellNodeId("cell", rowId, colId),
1394
+ x: chipX + chipW / 2,
1395
+ y: chipY + (chipH - fonts.chip.size * 1.2) / 2,
1396
+ lines: [label],
1397
+ align: "middle",
1398
+ font: fonts.chip,
1399
+ ink: chip.ink,
1400
+ owner,
1401
+ part: "tableCell",
1402
+ role: "category",
1403
+ display: { state: cell.displayed },
1404
+ ...title === void 0 ? {} : { title }
1405
+ });
1406
+ return;
1407
+ }
1408
+ let indent = cell.kind === "rowLabel" ? rowIndent(cellStep(cell)) : 0, align = col.align === "right" ? "end" : col.align === "center" ? "middle" : "start", tx = align === "end" ? cx + w - cellPadX2 : align === "middle" ? cx + w / 2 : contentX + indent, parentRow = cell.kind === "rowLabel" && row.hasChildren, expanded = parentRow && expandedIds.has(rowId);
1409
+ if (parentRow && options.outlineMarks === !0 && row.foldable !== !1) {
1410
+ let boxed = (theme.table?.mark ?? (options.variant === "steering" ? "boxed" : "bare")) === "boxed", mx = Math.round(Math.max(cx + 2, contentX + indent - operatorSlot - (theme.table?.toggle?.gap ?? (boxed ? 17 : 16)))), my = Math.round(stacked ? blockTop + (valueBox - MARK_SIZE) / 2 : ry + (rh - MARK_SIZE) / 2), toggleSize = theme.table?.toggle?.size ?? 11, boxY = my + (MARK_SIZE - toggleSize) / 2;
1411
+ boxed && nodes.push({ t: "path", id: `markbox:${rowId}`, d: `M${mx} ${boxY}h${toggleSize}v${toggleSize}h-${toggleSize}Z`, stroke: tableInk("toggle"), width: strokeToken(theme, "mark"), owner, part: "tableOutlineBox" }), nodes.push({
1412
+ t: "path",
1413
+ id: `mark:${rowId}`,
1414
+ d: boxed ? `M${mx + (toggleSize - 5) / 2} ${my + 4}h5${expanded ? "" : `M${mx + toggleSize / 2} ${my + 1.5}v5`}` : expanded ? `M${mx + 1} ${my + 4}h6` : `M${mx + 1} ${my + 4}h6M${mx + 4} ${my + 1}v6`,
1415
+ stroke: boxed ? { token: "ink" } : tableInk("toggle"),
1416
+ width: strokeToken(theme, "mark"),
1417
+ lineCap: "round",
1418
+ owner,
1419
+ part: "tableOutlineMark"
1420
+ });
1421
+ }
1422
+ let badge = isSection && col.kind === "rowLabel" ? row.badge : void 0, badgeW = badge === void 0 ? 0 : Math.round(measure(badge.text, fonts.chip).width + 2 * CHIP_PAD_X), badgeReserve = badgeW === 0 ? 0 : badgeW + SECTION_CHIP_GAP, affixFont = theme.table?.qualifier === void 0 ? { ...inlineFont2(row.step, !1), weight: theme.type.label.weight, ...font.style ? { style: font.style } : {} } : qualifierFont(font, theme), affixWidth = col.kind === "rowLabel" && row.unitAffix !== void 0 && !(row.kind === "member" && expandedIds.has(row.id)) ? theme.table?.qualifier === void 0 ? measure(` ${row.unitAffix}`, affixFont).width : measure(row.unitAffix, affixFont).width + (theme.table.qualifier.gap ?? 4) : 0, lineAffix = affixBelow.has(rowId) ? 0 : affixWidth, maxW = contentW - indent - badgeReserve - lineAffix - (cell.note && col.kind !== "rowLabel" && col.noteLine !== !0 ? measure(` ${cell.note}`, fonts.note).width : 0), wrappedCell = wrappedLines.get(tableCellKey(rowId, colId)), { text, title: cutTitle } = cellText(
1423
+ cell,
1424
+ col.kind,
1425
+ isSection,
1426
+ font,
1427
+ maxW,
1428
+ wrappedCell,
1429
+ cutTitles.get(tableCellKey(rowId, colId)),
1430
+ measure,
1431
+ theme.table?.section?.case
1432
+ ), lines = wrappedCell ?? [text], sectionLabel = isSection && col.kind === "rowLabel";
1433
+ if (sectionLabel && align !== "start") {
1434
+ let groupW = measure(lines[lines.length - 1] ?? text, font).width / WIDTH_SAFETY + lineAffix + badgeReserve, start = contentX + indent;
1435
+ tx = align === "end" ? contentX + contentW - groupW : start + (contentX + contentW - start - groupW) / 2;
1436
+ }
1437
+ let drawnAlign = sectionLabel ? "start" : align, textTop = lines.length > 1 ? stacked ? blockTop : ry + (rh - lines.length * font.size * 1.2) / 2 : textY, drawnFont = cell.state !== "value" ? row.kind === "driver" ? kindFont(fonts.body, "driver", !1, theme) : fonts.body : isTotal && cell.kind !== "rowLabel" && usesTotalFace(row.kind) ? fonts.totalValue : col.emphasis === "strong" && !cell.deEmphasized && row.kind !== "subtotal" && row.kind !== "result" ? { ...font, weight: theme.table?.weights?.block ?? tableEmphasis(theme) } : col.emphasis === "muted" && isCohortDensity(density) ? { ...font, weight: fonts.body.weight } : font, enc = col.cellEncoding, context = {
1438
+ cell,
1439
+ box: { x: cx, y: ry, w, h: rh },
1440
+ theme,
1441
+ ...options.palette === void 0 ? {} : { palette: options.palette },
1442
+ ...cell.tone === "neutral" || enc?.type !== "arrow" ? {} : { toneInk: toneInk(textGround, cell.tone) },
1443
+ measure,
1444
+ nodeId: (suffix) => tableCellNodeId(suffix, rowId, colId),
1445
+ owner
1446
+ }, stats = numericStats.get(colId), encodingInk, ownGround = hasPolarityBadge(cell, col), lane = heatLanes.get(colId);
1447
+ if ((col.kind === "value" || col.kind === "computed") && enc?.type === "heat" && lane) {
1448
+ let heat = emitHeat({ ...context, box: tintBox }, lane, enc), heatGround = heat.nodes.find((node) => node.t === "rect")?.fill;
1449
+ heatGround !== void 0 && (textGround = heatGround), nodes.push(...heat.nodes), !cell.deEmphasized && !(cell.relation === "ofWhich" && ofWhichMuted) && (encodingInk = heat.ink), heat.weight !== void 0 && !isTotal && (drawnFont = { ...drawnFont, weight: heat.weight });
1450
+ } else (col.kind === "value" || col.kind === "computed") && enc?.type === "inCellBar" && stats ? nodes.push(
1451
+ ...emitInCellBar(context, {
1452
+ contentBox: { x: contentX, y: ry, w: contentW, h: rh },
1453
+ maxAbs: stats.maxAbs,
1454
+ textReserve: stats.textReserve
1455
+ })
1456
+ ) : col.kind === "computed" && col.polarity && enc?.type === "arrow" && stats && nodes.push(...emitArrow(context, { scale: enc.scale, target: options.target, textScale: textScaleOf(options), font, maxAbs: stats.maxAbs, valueX: cx + w - cellPadX2 }));
1457
+ if (ownGround) {
1458
+ let badgeH = chipHeight(rh, font.size), tw = measure(text, figureFont(font, cellDrawsTabular(theme, col.kind, text))).width;
1459
+ nodes.push({
1460
+ t: "rect",
1461
+ id: tableCellNodeId("badge", rowId, colId),
1462
+ rect: {
1463
+ x: Math.round(cx + w - cellPadX2 - tw - 6),
1464
+ y: Math.round(textTop + (font.size * 1.2 - badgeH) / 2),
1465
+ w: Math.round(tw + 12),
1466
+ h: badgeH
1467
+ },
1468
+ fill: chipPaints(theme, cell.tone, options.palette).fill,
1469
+ radius: surface.chipRadius,
1470
+ owner,
1471
+ part: "tableBadge"
1472
+ }), tx = cx + w - cellPadX2;
1473
+ }
1474
+ let isGlyph = cell.state !== "value", quiet = col.emphasis === "muted", driverToned = row.driverTone === !0 && cell.kind !== "rowLabel" && cell.state === "value" && cell.tone !== "neutral", plainInk = row.kind === "driver" && !driverToned ? tableInk("driver") : cell.kind === "rowLabel" && (row.kind === "detail" || row.kind === "split") ? tableInk("child") : isGlyph ? tableInk("secondary") : quiet ? tableInk("secondary") : isSection && sectionInk !== void 0 ? { token: sectionInk } : encodingInk ?? (cell.deEmphasized || cell.relation === "ofWhich" && ofWhichMuted ? tableInk("secondary") : cell.tone === "neutral" ? cell.zero ? tableInk("secondary") : tableInk(cell.kind === "rowLabel" ? "label" : "figure") : theme.table?.tones === "fill" && (col.kind === "value" || col.kind === "computed") && !isTotal ? tableInk("figure") : enc?.type === "polarityBadge" ? toneTextPaint(theme, cell.tone, options.palette) : toneInk(textGround, cell.tone)), ink = ownGround ? polarityBadgeInk(theme, cell, col, row, options.palette) : groundInk(textGround, plainInk), printsFigure = figures || !heatColumn(col) || isTotal;
1475
+ if (cell.kind === "rowLabel" && row.operator !== void 0 && operatorSlot > 0 && nodes.push({
1476
+ t: "text",
1477
+ id: `operator:${rowId}`,
1478
+ x: tx - operatorSlot,
1479
+ y: textTop,
1480
+ lines: [row.operator],
1481
+ align: "start",
1482
+ font,
1483
+ ink: groundInk(textGround, tableInk("operator")),
1484
+ owner,
1485
+ part: "tableOperator",
1486
+ typeRole: "label",
1487
+ role: "category"
1488
+ }), printsFigure && nodes.push({
1489
+ t: "text",
1490
+ typeRole: "label",
1491
+ id: tableCellNodeId("cell", rowId, colId),
1492
+ x: tx,
1493
+ y: textTop,
1494
+ lines,
1495
+ ...cutTitle !== void 0 ? { title: cutTitle } : {},
1496
+ align: drawnAlign,
1497
+ font: drawnFont,
1498
+ ink,
1499
+ owner,
1500
+ part: "tableCell",
1501
+ ...cellRole(col.kind, lines.join(" ")),
1502
+ ...cell.displayed === "" ? {} : {
1503
+ display: cell.state === "value" ? { value: cell.displayed } : { state: cell.displayed }
1504
+ }
1505
+ }), inline.lines.length > 0 && (col.kind === "rowLabel" || col.kind === "value" || col.kind === "computed")) {
1506
+ let base = inline.note === void 0 ? 0 : 1, lineY = blockTop + valueBox + head + ladder.inlineGap + base * inline.box;
1507
+ for (let [index, line] of inline.lines.entries()) {
1508
+ let baseLineFont = changeLineFont(theme, ladder, row.step), driverLine = row.kind === "driver" || line.kind === "driver", lineFont = driverLine && theme.table?.driver?.italic !== !1 ? { ...baseLineFont, style: "italic" } : baseLineFont, lineCell = line.cells[colId], printed = col.kind === "rowLabel" ? ellipsize(line.label, lineFont, contentW - indent - INLINE_LABEL_INDENT, measure).text : lineCell?.displayed ?? "", y2 = lineY + (inline.box - lineFont.size * 1.2) / 2;
1509
+ if (lineY += inline.box, inline.noteSlots.get(colId) === base + index || !printed) continue;
1510
+ let toned = col.kind !== "rowLabel" && lineCell?.state === "value" && lineCell.tone !== "neutral";
1511
+ nodes.push({
1512
+ t: "text",
1513
+ typeRole: "label",
1514
+ id: tableCellNodeId("cellline", rowId, colId, line.id),
1515
+ x: col.kind === "rowLabel" ? contentX + indent + INLINE_LABEL_INDENT : cx + w - cellPadX2,
1516
+ y: y2,
1517
+ lines: [printed],
1518
+ align: col.kind === "rowLabel" ? "start" : "end",
1519
+ font: lineFont,
1520
+ ink: groundInk(textGround, driverLine && !(toned && (row.driverTone === !0 || line.driverTone === !0)) ? tableInk("driver") : toned && !(theme.table?.tones === "fill" && lineCell.tone === "warn") ? toneInk(textGround, lineCell.tone) : tableInk("secondary")),
1521
+ owner,
1522
+ part: "tableCellLine",
1523
+ ...col.kind === "rowLabel" ? { role: "category" } : cellRole(col.kind, printed),
1524
+ ...lineCell === void 0 || lineCell.displayed === "" || col.kind === "rowLabel" ? {} : { display: lineCell.state === "value" ? { value: lineCell.displayed } : { state: lineCell.displayed } }
1525
+ });
1526
+ }
1527
+ }
1528
+ if (affixWidth > 0 && nodes.push({
1529
+ t: "text",
1530
+ typeRole: "label",
1531
+ id: `unit:${rowId}`,
1532
+ // Measured in the face the label is drawn in: a bolder label measured in the body face ran
1533
+ // into its unit ("marginof product sales"). Under the label, the unit starts its own line.
1534
+ x: affixBelow.has(rowId) ? tx : tx + measure(lines[lines.length - 1] ?? text, drawnFont).width + Math.max(theme.table?.qualifier?.gap ?? 4, measure(" ", affixFont).width),
1535
+ // baseline lock: the affix shares the label's baseline exactly
1536
+ y: affixBelow.has(rowId) ? textTop + lines.length * font.size * 1.2 : textTop + (lines.length - 1) * font.size * 1.2 + (font.size - affixFont.size) * NOTE_BASELINE_LOCK,
1537
+ lines: [row.unitAffix],
1538
+ align: "start",
1539
+ font: affixFont,
1540
+ ink: groundInk(textGround, tableInk(row.kind === "driver" ? "driver" : "qualifier")),
1541
+ owner,
1542
+ part: "tableRowUnit",
1543
+ // A hoisted scale letter is a number's tail and takes the figures;
1544
+ // an authored unit is a phrase ("$ per order") and reads as prose,
1545
+ // which is the composed-role rule.
1546
+ role: composedTextRole(row.unitAffix, "caption")
1547
+ }), badge !== void 0) {
1548
+ let chip = chipPaints(theme, badge.tone, options.palette), chipH = chipHeight(rh, fonts.chip.size), chipX = Math.round(tx + measure(lines[lines.length - 1] ?? text, font).width / WIDTH_SAFETY + lineAffix + SECTION_CHIP_GAP), clearAbove = lines.length > 1 ? Math.ceil(textTop + (lines.length - 2) * font.size * 1.2 + font.size) : -1 / 0, chipY = Math.max(clearAbove, Math.round(textTop + (lines.length - 1) * font.size * 1.2 + (font.size * 1.2 - chipH) / 2));
1549
+ nodes.push({
1550
+ t: "rect",
1551
+ id: `sectionbadge:${rowId}`,
1552
+ rect: { x: chipX, y: chipY, w: badgeW, h: chipH },
1553
+ fill: chip.fill,
1554
+ radius: language.squareChips ? 0 : surface.chipRadius,
1555
+ owner,
1556
+ part: "tableSectionBadge"
1557
+ }), nodes.push({
1558
+ t: "text",
1559
+ typeRole: "label",
1560
+ id: `sectionbadge-text:${rowId}`,
1561
+ x: chipX + badgeW / 2,
1562
+ y: chipY + (chipH - fonts.chip.size * 1.2) / 2,
1563
+ lines: [badge.text],
1564
+ align: "middle",
1565
+ font: fonts.chip,
1566
+ ink: chip.ink,
1567
+ owner,
1568
+ part: "tableSectionBadge",
1569
+ role: "category",
1570
+ display: { state: badge.text }
1571
+ });
1572
+ }
1573
+ if (parentRow && !expanded && align === "start") {
1574
+ let noun = table.levelNouns?.[cell.level + 1], count = childCount.get(rowId) ?? 0;
1575
+ if (noun !== void 0 && count > 0) {
1576
+ let word = count === 1 ? noun.one : noun.other, hintX = tx + measure(lines[lines.length - 1] ?? text, font).width + lineAffix + badgeReserve + HINT_GAP, full = `\xB7 ${count} ${word}`, room = contentX + contentW - hintX, short = `\xB7 ${count}\u2026`, hint = measure(full, fonts.hint).width <= room ? { text: full } : measure(short, fonts.hint).width <= room ? { text: short, title: full } : void 0;
1577
+ hint !== void 0 && nodes.push({
1578
+ t: "text",
1579
+ typeRole: "label",
1580
+ id: `hint:${rowId}`,
1581
+ x: hintX,
1582
+ y: textTop + (lines.length - 1) * font.size * 1.2 + (font.size - fonts.hint.size) * NOTE_BASELINE_LOCK,
1583
+ lines: [hint.text],
1584
+ ...hint.title === void 0 ? {} : { title: hint.title },
1585
+ align: "start",
1586
+ font: fonts.hint,
1587
+ ink: groundInk(textGround, tableInk("secondary")),
1588
+ owner,
1589
+ part: "tableCollapsedHint",
1590
+ role: "category"
1591
+ });
1592
+ }
1593
+ }
1594
+ let noteSlot = inline.noteSlots.get(colId);
1595
+ if (cell.note && noteSlot !== void 0) {
1596
+ let noteFont = inlineFont2(row.step, !1);
1597
+ nodes.push({
1598
+ t: "text",
1599
+ typeRole: "footnote",
1600
+ id: tableCellNodeId("note", rowId, colId),
1601
+ x: align === "end" ? cx + w - cellPadX2 : align === "middle" ? cx + w / 2 : contentX + indent,
1602
+ y: blockTop + valueBox + head + ladder.inlineGap + noteSlot * inline.box + (inline.box - noteFont.size * 1.2) / 2,
1603
+ lines: [cell.note],
1604
+ align,
1605
+ font: noteFont,
1606
+ ink: groundInk(textGround, tableInk("secondary")),
1607
+ owner,
1608
+ part: "tableCellNote"
1609
+ });
1610
+ } else if (cell.note && col.kind === "rowLabel" && inline.note !== void 0) {
1611
+ let noteFont = inlineFont2(row.step, !1);
1612
+ nodes.push({
1613
+ t: "text",
1614
+ typeRole: "footnote",
1615
+ id: tableCellNodeId("note", rowId, colId),
1616
+ x: contentX + indent,
1617
+ y: blockTop + valueBox + head + ladder.inlineGap + (inline.box - noteFont.size * 1.2) / 2,
1618
+ lines: [cell.note],
1619
+ align: "start",
1620
+ font: noteFont,
1621
+ ink: groundInk(textGround, tableInk("secondary")),
1622
+ owner,
1623
+ part: "tableCellNote"
1624
+ });
1625
+ } else if (cell.note) {
1626
+ let lastLine = lines[lines.length - 1] ?? text, noteX = align === "end" ? tx - measure(lastLine, font).width - 4 : tx + measure(lastLine, font).width + 4, hostFont = drawnFont, noteY = textTop + (lines.length - 1) * font.size * 1.2 + (hostFont.size - fonts.note.size) * NOTE_BASELINE_LOCK;
1627
+ nodes.push({
1628
+ t: "text",
1629
+ typeRole: "footnote",
1630
+ id: tableCellNodeId("note", rowId, colId),
1631
+ x: noteX,
1632
+ y: noteY,
1633
+ lines: [cell.note],
1634
+ align: align === "end" ? "end" : "start",
1635
+ font: fonts.note,
1636
+ ink: groundInk(textGround, tableInk("secondary")),
1637
+ owner,
1638
+ part: "tableCellNote"
1639
+ });
1640
+ }
1641
+ }
1642
+ occupied.claim({ x: rowX, y: gridY, w: rowW, h: headerH }, "mark", {}, "tableHeader");
1643
+ for (let row of rows) {
1644
+ let { y: ry, h: rh } = rowY.get(row.id);
1645
+ occupied.claim({ x: rowX, y: ry, w: rowW, h: rh }, "mark", { rowId: row.id }, "tableRow");
1646
+ }
1647
+ for (let col of cols) {
1648
+ let { x: cx, w } = colX.get(col.id);
1649
+ occupied.claim({ x: cx, y: gridY, w, h: tableH }, "mark", { colId: col.id }, "tableColumn");
1650
+ }
1651
+ let marks = {
1652
+ table: { x: gridX, y: gridY, w: tableW, h: tableH },
1653
+ headerBand: { x: gridX, y: gridY, w: tableW, h: headerH },
1654
+ columns: cols.map((c) => ({ id: c.id, ...colX.get(c.id) })),
1655
+ rows: rows.map((r) => ({ id: r.id, ...rowY.get(r.id) }))
1656
+ }, paintWarningRules = [];
1657
+ if (groundTexts.size > 0) {
1658
+ let texts = options.colorblindSafe === !0 ? colorblindRoles([...groundTexts.values()]).value : [...groundTexts.values()];
1659
+ paintWarningRules.push({ kind: "table-ground-text", texts, before: warnings.length }), pushAll(warnings, groundTextWarnings(theme, texts));
1660
+ }
1661
+ let scene = nodes;
1662
+ if (options.colorblindSafe === !0) {
1663
+ let swap = colorblindRoles(nodes);
1664
+ scene = swap.value, swap.swapped === 0 && warnings.push({
1665
+ code: "table-colorblind-safe-unused",
1666
+ severity: "error",
1667
+ message: "colorblindSafe swaps the good/bad pair, and this table paints none: no good or bad tone, diverging or status heat lane, in-cell bar below zero, toned badge or row highlight, so it would change nothing",
1668
+ suggest: "drop colorblindSafe; options.palette names a colorblind-safe categorical ramp",
1669
+ field: ["options", "colorblindSafe"],
1670
+ fix: [{ op: "remove", path: "/options/colorblindSafe" }]
1671
+ });
1672
+ }
1673
+ let cutNotes = cols.flatMap((col) => {
1674
+ let cuts = statusCuts.get(col.id), entry = ({ shown, full, rows: named }) => `${shown !== "" ? shown : named.join(", ")} = ${full}`;
1675
+ return cuts ? [disclosureNote(`${col.label}: ${[...cuts.values()].map(entry).join("; ")}`)] : [];
1676
+ }).filter((note) => !(options[ENGINE_NOTES] ?? []).includes(note));
1677
+ return cutNotes.length > 0 ? layoutTableOnce(authoredData, { ...options, [ENGINE_NOTES]: [...options[ENGINE_NOTES] ?? [], ...cutNotes] }, initialResolved, sizingOnly, formatFits) : {
1678
+ type: "table",
1679
+ size,
1680
+ sizing,
1681
+ plot,
1682
+ scene,
1683
+ labels: [],
1684
+ axes: [],
1685
+ annotations: [],
1686
+ frame: frame.frame,
1687
+ marks,
1688
+ derived: { table, computedCells: resolved.computedCells },
1689
+ a11y: {
1690
+ title: accessibleTitle(options.title, "Table"),
1691
+ counts: [structureCount("rows", dataRows.length), structureCount("columns", cols.length)],
1692
+ desc: `Table with ${dataRows.length} rows and ${cols.length} columns`
1693
+ },
1694
+ warnings,
1695
+ ...paintWarningRules.length > 0 ? { paintWarningRules } : {},
1696
+ debug: { occupied: occupied.snapshot(), decisions: [] }
1697
+ };
1698
+ }
1699
+ function tableSizing(size, plot, bottom, totalW, minimumW) {
1700
+ return rowSizing("table", size, {
1701
+ chromeH: size.height - plot.h,
1702
+ minimumRowsH: bottom - plot.y + 4,
1703
+ naturalRowsH: bottom - plot.y + 4,
1704
+ minWidth: size.width - plot.w + minimumW,
1705
+ naturalWidth: size.width - plot.w + totalW
1706
+ });
1707
+ }
1708
+ function fitStatusLabel(label, font, room, trackRoom, measure) {
1709
+ let width = measure(label, font).width;
1710
+ if (width <= room) return { text: label };
1711
+ if (room < HEADING_CUT_MIN) return width <= trackRoom ? { text: label } : null;
1712
+ let cut = cutWithTitle(label, font, room, measure);
1713
+ return cut.text === "\u2026" || cut.text === "" ? null : cut;
1714
+ }
1715
+ function cellText(cell, kind, isSection, font, maxW, wrapped, wrappedTitle, measure, sectionCase) {
1716
+ let text = isSection && sectionCase !== "asis" ? sectionText(cell.displayed) : cell.displayed;
1717
+ return wrapped ? { text: wrapped[0] ?? text, ...wrappedTitle !== void 0 ? { title: wrappedTitle } : {} } : (kind === "rowLabel" || kind === "text") && measure(text, font).width > maxW ? cutWithTitle(text, font, Math.max(maxW, HEADING_CUT_MIN), measure) : { text };
1718
+ }
1719
+ function sectionText(s) {
1720
+ return s.toUpperCase();
1721
+ }
1722
+ function encodingSparklineNodes(col, row, box, theme, palette, measure, domain, language) {
1723
+ if (row.role === "section" || col.encoding?.type !== "sparkline") return [];
1724
+ let values = sparklineSourceValues(row, col.encoding.sourceColumns), last = lastObservedIndex(values), lastSource = last === void 0 ? void 0 : col.encoding.sourceColumns[last];
1725
+ return emitSparkline(
1726
+ {
1727
+ cell: row.cells[col.id],
1728
+ box,
1729
+ theme,
1730
+ ...palette === void 0 ? {} : { palette },
1731
+ measure,
1732
+ nodeId: (suffix) => tableCellNodeId(suffix, row.id, col.id),
1733
+ owner: { rowId: row.id, colId: col.id }
1734
+ },
1735
+ values,
1736
+ {
1737
+ kind: col.encoding.kind ?? "line",
1738
+ domain: domain ?? tableSparklineDomain([row], col.encoding.sourceColumns, col.encoding.kind ?? "line"),
1739
+ lastText: lastSource === void 0 ? void 0 : row.cells[lastSource]?.displayed,
1740
+ language
1741
+ }
1742
+ );
1743
+ }
1744
+ function transparentCss(css) {
1745
+ return css.trim().toLowerCase() === "transparent";
1746
+ }
1747
+
1748
+ export {
1749
+ sparklineSourceValues,
1750
+ sparklineDomains,
1751
+ emitSparkline,
1752
+ fitTableFormats,
1753
+ formatsFittedWarning,
1754
+ REGULAR_SPACING,
1755
+ layoutTable,
1756
+ layoutTableCard,
1757
+ memoLayout,
1758
+ classFloor,
1759
+ cardHeightFloor
1760
+ };