boardplot 0.0.0-stage → 0.52.5

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 (817) hide show
  1. package/CHANGELOG.md +18 -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-VUNSFKZY.js +137 -0
  8. package/dist/annotateEngine-H7OW4H3W.js +30 -0
  9. package/dist/build-identity.json +6 -0
  10. package/dist/chunk-24WB3HMB.js +621 -0
  11. package/dist/chunk-263SZKIL.js +8 -0
  12. package/dist/chunk-27QQEWNV.js +18 -0
  13. package/dist/chunk-2AKWCMS4.js +24 -0
  14. package/dist/chunk-2DHJJ2EN.js +24 -0
  15. package/dist/chunk-2EQE4E3I.js +22 -0
  16. package/dist/chunk-2GELJH37.js +88 -0
  17. package/dist/chunk-2JAWQ7VV.js +3874 -0
  18. package/dist/chunk-2LMCD3ZR.js +6 -0
  19. package/dist/chunk-2MTWKMEG.js +841 -0
  20. package/dist/chunk-2SGIHKKU.js +33 -0
  21. package/dist/chunk-2UVTHU7A.js +1146 -0
  22. package/dist/chunk-33CBPK5Q.js +2800 -0
  23. package/dist/chunk-33PLBIMA.js +176 -0
  24. package/dist/chunk-35DZP2R2.js +22 -0
  25. package/dist/chunk-3D3D3D23.js +25 -0
  26. package/dist/chunk-3EZRM4YM.js +92 -0
  27. package/dist/chunk-3GZECHOK.js +802 -0
  28. package/dist/chunk-3HHNQPAH.js +68 -0
  29. package/dist/chunk-3I6RANBJ.js +1058 -0
  30. package/dist/chunk-3SIRPKMP.js +12 -0
  31. package/dist/chunk-3W23F7EY.js +185 -0
  32. package/dist/chunk-3XQ635KD.js +24 -0
  33. package/dist/chunk-3ZCKEANJ.js +24 -0
  34. package/dist/chunk-4DNOEV3Q.js +25857 -0
  35. package/dist/chunk-4GB7TBY7.js +373 -0
  36. package/dist/chunk-4SM2ONUC.js +18 -0
  37. package/dist/chunk-5C7TWNYZ.js +79 -0
  38. package/dist/chunk-5DJXJXDE.js +58 -0
  39. package/dist/chunk-5ENRZX6I.js +687 -0
  40. package/dist/chunk-5KWXRYAT.js +294 -0
  41. package/dist/chunk-5T5YW52S.js +47 -0
  42. package/dist/chunk-627P6T25.js +936 -0
  43. package/dist/chunk-62FR4FYJ.js +23 -0
  44. package/dist/chunk-6JUJ2DU3.js +67 -0
  45. package/dist/chunk-6KWIQ5KF.js +18 -0
  46. package/dist/chunk-6UBEGKIQ.js +25 -0
  47. package/dist/chunk-6XE3GVGU.js +116 -0
  48. package/dist/chunk-76ANFJOI.js +227 -0
  49. package/dist/chunk-7IFLQMJL.js +160 -0
  50. package/dist/chunk-7JVAQX6C.js +28 -0
  51. package/dist/chunk-7QDAHY5M.js +63 -0
  52. package/dist/chunk-7VXZDB45.js +149 -0
  53. package/dist/chunk-7X65ZQN4.js +38 -0
  54. package/dist/chunk-A2FHZH7E.js +1410 -0
  55. package/dist/chunk-A372DLQX.js +54 -0
  56. package/dist/chunk-A3ULWR5N.js +76 -0
  57. package/dist/chunk-A4QZXLXF.js +7 -0
  58. package/dist/chunk-A5JWFZVU.js +1467 -0
  59. package/dist/chunk-A5LZUYK4.js +59 -0
  60. package/dist/chunk-A6XCAQ52.js +89 -0
  61. package/dist/chunk-A7A4PDG5.js +24 -0
  62. package/dist/chunk-A7IEVBYI.js +35 -0
  63. package/dist/chunk-ACXX2JNL.js +6 -0
  64. package/dist/chunk-AFK47A6O.js +25 -0
  65. package/dist/chunk-ALKTNXMR.js +3650 -0
  66. package/dist/chunk-AOQ6VF5H.js +6 -0
  67. package/dist/chunk-ASAON7G4.js +648 -0
  68. package/dist/chunk-ATTE3FYC.js +24 -0
  69. package/dist/chunk-AZOUSKZD.js +728 -0
  70. package/dist/chunk-B2EBEXIS.js +113 -0
  71. package/dist/chunk-B67K5X4M.js +58 -0
  72. package/dist/chunk-BBL3R5YZ.js +186 -0
  73. package/dist/chunk-BIDIGDGH.js +6 -0
  74. package/dist/chunk-BKYMLFUG.js +69 -0
  75. package/dist/chunk-BLFWUMTD.js +12 -0
  76. package/dist/chunk-BM6SFFWF.js +6 -0
  77. package/dist/chunk-BUPLB3EX.js +129 -0
  78. package/dist/chunk-BVWU6GOB.js +47 -0
  79. package/dist/chunk-BW5VLBSZ.js +15 -0
  80. package/dist/chunk-C64FBRJO.js +290 -0
  81. package/dist/chunk-CAE2HK2G.js +295 -0
  82. package/dist/chunk-CCQNL33L.js +446 -0
  83. package/dist/chunk-CDZHNLO6.js +42 -0
  84. package/dist/chunk-COKHNEJP.js +24 -0
  85. package/dist/chunk-COYPDRJK.js +21 -0
  86. package/dist/chunk-CRZKGHZ6.js +1810 -0
  87. package/dist/chunk-CS4DHFNG.js +128 -0
  88. package/dist/chunk-CYDZP5W6.js +1589 -0
  89. package/dist/chunk-D4BIV6WG.js +1072 -0
  90. package/dist/chunk-D4SOADBD.js +19 -0
  91. package/dist/chunk-DCCJRLAJ.js +422 -0
  92. package/dist/chunk-DFKTS6XJ.js +75 -0
  93. package/dist/chunk-DGDOGOTQ.js +25 -0
  94. package/dist/chunk-DLC23CKC.js +53 -0
  95. package/dist/chunk-DRTA6JG5.js +160 -0
  96. package/dist/chunk-DVKBU23L.js +97 -0
  97. package/dist/chunk-E2HEVF23.js +692 -0
  98. package/dist/chunk-EC2NAYPQ.js +24 -0
  99. package/dist/chunk-EKQK5D6G.js +14 -0
  100. package/dist/chunk-EKQMYG2B.js +2353 -0
  101. package/dist/chunk-ELYU6TRQ.js +98 -0
  102. package/dist/chunk-EQT3EPTB.js +203 -0
  103. package/dist/chunk-ERAIVAK5.js +1359 -0
  104. package/dist/chunk-ETHWK2RZ.js +16 -0
  105. package/dist/chunk-EWVKBRLV.js +72 -0
  106. package/dist/chunk-F77BNDAT.js +43 -0
  107. package/dist/chunk-FGAGGPFF.js +566 -0
  108. package/dist/chunk-FIANWJXX.js +19 -0
  109. package/dist/chunk-FIWNDOMO.js +6 -0
  110. package/dist/chunk-FOKEGVPB.js +24 -0
  111. package/dist/chunk-FT3F72C3.js +30 -0
  112. package/dist/chunk-FT47HQ5U.js +47 -0
  113. package/dist/chunk-GDOW2KNP.js +19 -0
  114. package/dist/chunk-GDQ3NGDZ.js +17 -0
  115. package/dist/chunk-GH3ZMBFX.js +563 -0
  116. package/dist/chunk-GQPESFAF.js +3378 -0
  117. package/dist/chunk-GQS46LC3.js +50 -0
  118. package/dist/chunk-GULJ6KVT.js +587 -0
  119. package/dist/chunk-GWQIXU37.js +2774 -0
  120. package/dist/chunk-GZ2VNM4L.js +24 -0
  121. package/dist/chunk-GZ4RHGIW.js +836 -0
  122. package/dist/chunk-H4H4O62O.js +46 -0
  123. package/dist/chunk-H57TJD3B.js +72 -0
  124. package/dist/chunk-H7UZZ7KP.js +24 -0
  125. package/dist/chunk-HAAUJDGB.js +83 -0
  126. package/dist/chunk-HFG76JTS.js +296 -0
  127. package/dist/chunk-HJXXFPOL.js +211 -0
  128. package/dist/chunk-HTYFQHRC.js +24 -0
  129. package/dist/chunk-HUF6TQ2J.js +24 -0
  130. package/dist/chunk-HUFCSX2Y.js +89 -0
  131. package/dist/chunk-HX3MQ3H4.js +26 -0
  132. package/dist/chunk-HZQEQ34U.js +296 -0
  133. package/dist/chunk-I322G5UG.js +888 -0
  134. package/dist/chunk-IDDA5INB.js +60 -0
  135. package/dist/chunk-IDTLHPTK.js +60 -0
  136. package/dist/chunk-II7652VA.js +2918 -0
  137. package/dist/chunk-IN4QT33I.js +38 -0
  138. package/dist/chunk-IV2UXZXX.js +16 -0
  139. package/dist/chunk-IXSZ7OKR.js +133 -0
  140. package/dist/chunk-IYEFEBRN.js +41 -0
  141. package/dist/chunk-IZ35GMGB.js +2543 -0
  142. package/dist/chunk-IZCOG3FS.js +28 -0
  143. package/dist/chunk-JA755JHN.js +379 -0
  144. package/dist/chunk-JETXFF3M.js +33 -0
  145. package/dist/chunk-JFBEAUJ6.js +24 -0
  146. package/dist/chunk-JFG4DHKQ.js +48 -0
  147. package/dist/chunk-JL5BRMDT.js +179 -0
  148. package/dist/chunk-JLCAWQ3H.js +195 -0
  149. package/dist/chunk-JLZM7XMZ.js +525 -0
  150. package/dist/chunk-JMH5MD5A.js +19 -0
  151. package/dist/chunk-JRPI64AQ.js +3066 -0
  152. package/dist/chunk-JSX3C6LL.js +344 -0
  153. package/dist/chunk-JY4R3GML.js +83 -0
  154. package/dist/chunk-JYBT2JNY.js +61 -0
  155. package/dist/chunk-K2HNV4LE.js +2008 -0
  156. package/dist/chunk-KAXJFL7N.js +43 -0
  157. package/dist/chunk-KDMKHR5A.js +32 -0
  158. package/dist/chunk-KFFNCDX6.js +19 -0
  159. package/dist/chunk-KKWZWP67.js +24 -0
  160. package/dist/chunk-KOJ5QETJ.js +8 -0
  161. package/dist/chunk-KPMGGE4W.js +51 -0
  162. package/dist/chunk-KS7DXCXH.js +27 -0
  163. package/dist/chunk-KSYVTEKR.js +24 -0
  164. package/dist/chunk-KU4YS6HN.js +61 -0
  165. package/dist/chunk-KYELSLDJ.js +40 -0
  166. package/dist/chunk-LC3PSQJJ.js +383 -0
  167. package/dist/chunk-LC6DYCTG.js +85 -0
  168. package/dist/chunk-LNKY5Z2X.js +23 -0
  169. package/dist/chunk-LO2DANS6.js +302 -0
  170. package/dist/chunk-M4SPKUZE.js +7 -0
  171. package/dist/chunk-M4YLED7M.js +17 -0
  172. package/dist/chunk-M6KTNAND.js +746 -0
  173. package/dist/chunk-MCOIEWW6.js +54 -0
  174. package/dist/chunk-MDYLOIS2.js +48 -0
  175. package/dist/chunk-MEISCROL.js +24 -0
  176. package/dist/chunk-MFLH5ZDQ.js +69 -0
  177. package/dist/chunk-MIXKQJ64.js +935 -0
  178. package/dist/chunk-MJMJEURO.js +359 -0
  179. package/dist/chunk-MNJ2DHU6.js +526 -0
  180. package/dist/chunk-NEVSQGOI.js +63 -0
  181. package/dist/chunk-NG5IGZXC.js +1179 -0
  182. package/dist/chunk-NLOMCLKI.js +3303 -0
  183. package/dist/chunk-NMCOUVN5.js +24 -0
  184. package/dist/chunk-NT3HAZYT.js +51 -0
  185. package/dist/chunk-NXNQQ3DS.js +382 -0
  186. package/dist/chunk-NYEY6W5R.js +569 -0
  187. package/dist/chunk-OAPCJO6W.js +23 -0
  188. package/dist/chunk-OH7FA4TF.js +251 -0
  189. package/dist/chunk-OLNORNCT.js +331 -0
  190. package/dist/chunk-OQEBOVUO.js +30 -0
  191. package/dist/chunk-ORUJI3VB.js +83 -0
  192. package/dist/chunk-PEN2DK7T.js +49 -0
  193. package/dist/chunk-PGIQMQRU.js +1650 -0
  194. package/dist/chunk-PTVOXB5T.js +39 -0
  195. package/dist/chunk-PUVGWJQ5.js +24 -0
  196. package/dist/chunk-PWROWDZS.js +137 -0
  197. package/dist/chunk-Q6XJOJTY.js +29 -0
  198. package/dist/chunk-QBR6IKIX.js +50 -0
  199. package/dist/chunk-QETGGFH2.js +30 -0
  200. package/dist/chunk-QG6MOQLI.js +2934 -0
  201. package/dist/chunk-QGCEHR6S.js +13 -0
  202. package/dist/chunk-QHFQHQDC.js +43 -0
  203. package/dist/chunk-QHRE2M6V.js +26 -0
  204. package/dist/chunk-QKL7IY42.js +38 -0
  205. package/dist/chunk-QN6JHMGU.js +44 -0
  206. package/dist/chunk-QNHZXFRA.js +347 -0
  207. package/dist/chunk-QPWRHDLZ.js +17 -0
  208. package/dist/chunk-QVABTUDS.js +80 -0
  209. package/dist/chunk-QXILAMAU.js +28 -0
  210. package/dist/chunk-QZAT46PP.js +95 -0
  211. package/dist/chunk-R3WI7ZLE.js +545 -0
  212. package/dist/chunk-R5SWC3EW.js +30 -0
  213. package/dist/chunk-RJQ5YS3Q.js +40 -0
  214. package/dist/chunk-RNOD2UWF.js +613 -0
  215. package/dist/chunk-RNXITK5M.js +24 -0
  216. package/dist/chunk-ROXO4R3J.js +16 -0
  217. package/dist/chunk-RQ5DNYLG.js +10 -0
  218. package/dist/chunk-RSWVH7DB.js +24 -0
  219. package/dist/chunk-RTJXOIIQ.js +12 -0
  220. package/dist/chunk-RZNYW7UP.js +133 -0
  221. package/dist/chunk-S4F27M7N.js +37 -0
  222. package/dist/chunk-S4ONWRJE.js +28 -0
  223. package/dist/chunk-S53OGZL6.js +168 -0
  224. package/dist/chunk-S5ADHIZK.js +2508 -0
  225. package/dist/chunk-S62M63LU.js +19 -0
  226. package/dist/chunk-S7VDRUED.js +62 -0
  227. package/dist/chunk-SGD3ZHID.js +250 -0
  228. package/dist/chunk-SGSPYHFE.js +40 -0
  229. package/dist/chunk-SLTMRTXV.js +597 -0
  230. package/dist/chunk-SXGTRZFN.js +26 -0
  231. package/dist/chunk-SZPTTNW7.js +16 -0
  232. package/dist/chunk-T3IGJARD.js +22 -0
  233. package/dist/chunk-TA3TFKYZ.js +86 -0
  234. package/dist/chunk-TNEHPP3H.js +18 -0
  235. package/dist/chunk-TPYV2FTV.js +25 -0
  236. package/dist/chunk-TPZB2YWR.js +25 -0
  237. package/dist/chunk-TSR5YDPS.js +1266 -0
  238. package/dist/chunk-TTR7EWNH.js +170 -0
  239. package/dist/chunk-TVHLKVUO.js +24 -0
  240. package/dist/chunk-TXINIAFL.js +198 -0
  241. package/dist/chunk-TXZBBZOG.js +58 -0
  242. package/dist/chunk-UEU46Q3D.js +300 -0
  243. package/dist/chunk-UMDEWWXT.js +33 -0
  244. package/dist/chunk-UQSVWO7Z.js +334 -0
  245. package/dist/chunk-UZF3G2FN.js +942 -0
  246. package/dist/chunk-V422EKLW.js +24 -0
  247. package/dist/chunk-V4DYVLOO.js +433 -0
  248. package/dist/chunk-V4VC25UL.js +128 -0
  249. package/dist/chunk-V667FCIJ.js +12 -0
  250. package/dist/chunk-VABRPZVC.js +43 -0
  251. package/dist/chunk-VB2MJLET.js +19 -0
  252. package/dist/chunk-VDAKTZQP.js +18 -0
  253. package/dist/chunk-VDAZPGR2.js +79 -0
  254. package/dist/chunk-VXZFQKBJ.js +21 -0
  255. package/dist/chunk-VYMGZ27S.js +133 -0
  256. package/dist/chunk-W2RGSGRR.js +131 -0
  257. package/dist/chunk-W7UZXD5D.js +1109 -0
  258. package/dist/chunk-WDUNR2VI.js +2718 -0
  259. package/dist/chunk-WHSTEAVP.js +229 -0
  260. package/dist/chunk-WJMUMN3I.js +127 -0
  261. package/dist/chunk-WLZ54FWG.js +120 -0
  262. package/dist/chunk-WMJPFLF3.js +2980 -0
  263. package/dist/chunk-WRHFBCVY.js +24 -0
  264. package/dist/chunk-WVSNSWBJ.js +47 -0
  265. package/dist/chunk-WYJEOMNY.js +31 -0
  266. package/dist/chunk-WYJMV62X.js +24 -0
  267. package/dist/chunk-WZGJSQKN.js +29 -0
  268. package/dist/chunk-WZL4EEBS.js +11 -0
  269. package/dist/chunk-X7TXGKRX.js +272 -0
  270. package/dist/chunk-XB4KZ6WO.js +81 -0
  271. package/dist/chunk-XDLQRSSH.js +266 -0
  272. package/dist/chunk-XDS4UZGR.js +113 -0
  273. package/dist/chunk-XEGRWWNO.js +30 -0
  274. package/dist/chunk-XO5ONLVM.js +420 -0
  275. package/dist/chunk-XPWRD424.js +24 -0
  276. package/dist/chunk-XTNV2YMB.js +50 -0
  277. package/dist/chunk-XW5J5JAX.js +42 -0
  278. package/dist/chunk-XY5O74BH.js +33 -0
  279. package/dist/chunk-XYONCO5Q.js +984 -0
  280. package/dist/chunk-Y4PXIJMD.js +829 -0
  281. package/dist/chunk-YAYRRKC7.js +24 -0
  282. package/dist/chunk-YEDYBMCW.js +210 -0
  283. package/dist/chunk-YFG4E3N2.js +1161 -0
  284. package/dist/chunk-YHTO46W2.js +2670 -0
  285. package/dist/chunk-YI2ZVTCB.js +38 -0
  286. package/dist/chunk-YKO3VCTF.js +24 -0
  287. package/dist/chunk-YP3I6W7T.js +24 -0
  288. package/dist/chunk-YQ2B3YVF.js +687 -0
  289. package/dist/chunk-YS6KMYM4.js +91 -0
  290. package/dist/chunk-YTSSXSZR.js +197 -0
  291. package/dist/chunk-Z256ACGC.js +27 -0
  292. package/dist/chunk-Z2MGTKDR.js +20 -0
  293. package/dist/chunk-Z5VSLLNY.js +23 -0
  294. package/dist/chunk-Z7X3RGGA.js +22 -0
  295. package/dist/chunk-ZF43WRG3.js +29 -0
  296. package/dist/chunk-ZJKOLOVF.js +1754 -0
  297. package/dist/chunk-ZQ4VFQID.js +76 -0
  298. package/dist/chunk-ZSLGN6CO.js +89 -0
  299. package/dist/chunk-ZVTFZF4V.js +542 -0
  300. package/dist/cli/index.js +9 -0
  301. package/dist/core-5Z6UW5DS.js +31 -0
  302. package/dist/core-6ANZ2OWO.js +40 -0
  303. package/dist/core-6LLJNZ4O.js +37 -0
  304. package/dist/core-CPN2HF75.js +33 -0
  305. package/dist/core-CS7AKNME.js +37 -0
  306. package/dist/core-DBRILYNB.js +38 -0
  307. package/dist/core-DU77ZYPR.js +34 -0
  308. package/dist/core-E6YD7VU4.js +32 -0
  309. package/dist/core-EE55P6XK.js +56 -0
  310. package/dist/core-FFLPH5XK.js +41 -0
  311. package/dist/core-IV26EL5C.js +32 -0
  312. package/dist/core-IZVZ2B7Y.js +34 -0
  313. package/dist/core-JQV7STNF.js +34 -0
  314. package/dist/core-KBH3EJZV.js +32 -0
  315. package/dist/core-KFBW5PRT.js +36 -0
  316. package/dist/core-KWGXHBJE.js +37 -0
  317. package/dist/core-MZMR2DF4.js +32 -0
  318. package/dist/core-OK2ZY5OJ.js +29 -0
  319. package/dist/core-OV5MPTZP.js +43 -0
  320. package/dist/core-OW5V74Q4.js +40 -0
  321. package/dist/core-PL64QPOH.js +57 -0
  322. package/dist/core-PVINU5JJ.js +33 -0
  323. package/dist/core-QUYSNTC7.js +34 -0
  324. package/dist/core-RE3L6YCM.js +29 -0
  325. package/dist/core-RUA3EWW3.js +39 -0
  326. package/dist/core-RY6IFRKM.js +35 -0
  327. package/dist/core-SCWEVNUY.js +34 -0
  328. package/dist/core-SE67HHFG.js +55 -0
  329. package/dist/core-T5Q4DSH2.js +32 -0
  330. package/dist/core-TJX3I7KH.js +37 -0
  331. package/dist/core-ULUA5ZB2.js +55 -0
  332. package/dist/core-WLVU2HWX.js +46 -0
  333. package/dist/core-WQPHNVNY.js +51 -0
  334. package/dist/core-XXIOJY2X.js +52 -0
  335. package/dist/core-ZH7XTJTD.js +39 -0
  336. package/dist/core-ZHE7N4NS.js +50 -0
  337. package/dist/core-ZJYLJWZQ.js +38 -0
  338. package/dist/dataTable-IL7HVDHL.js +58 -0
  339. package/dist/engine-MYLZI5VH.js +961 -0
  340. package/dist/fixtures.d.ts +1 -0
  341. package/dist/fixtures.js +40 -0
  342. package/dist/fontTables-ZYBUCJ5N.js +18 -0
  343. package/dist/fonts.d.ts +1 -0
  344. package/dist/fonts.js +19 -0
  345. package/dist/geo/dach.d.ts +1 -0
  346. package/dist/geo/dach.js +14 -0
  347. package/dist/geo/de-states.d.ts +1 -0
  348. package/dist/geo/de-states.js +14 -0
  349. package/dist/geo/eu27.d.ts +1 -0
  350. package/dist/geo/eu27.js +14 -0
  351. package/dist/geo/europe.d.ts +1 -0
  352. package/dist/geo/europe.js +14 -0
  353. package/dist/geo/index.d.ts +1 -0
  354. package/dist/geo/index.js +41 -0
  355. package/dist/geo/us-states.d.ts +1 -0
  356. package/dist/geo/us-states.js +14 -0
  357. package/dist/geo/world.d.ts +1 -0
  358. package/dist/geo/world.js +14 -0
  359. package/dist/index.d.ts +1 -0
  360. package/dist/index.js +363 -0
  361. package/dist/main-ISJ53IS5.js +568 -0
  362. package/dist/mcp/server.js +1023 -0
  363. package/dist/module-SVEW5ZUE.js +137233 -0
  364. package/dist/react/bar.d.ts +1 -0
  365. package/dist/react/bar.js +80 -0
  366. package/dist/react/bartable.d.ts +1 -0
  367. package/dist/react/bartable.js +70 -0
  368. package/dist/react/box.d.ts +1 -0
  369. package/dist/react/box.js +64 -0
  370. package/dist/react/bullet.d.ts +1 -0
  371. package/dist/react/bullet.js +71 -0
  372. package/dist/react/butterfly.d.ts +1 -0
  373. package/dist/react/butterfly.js +65 -0
  374. package/dist/react/choropleth.d.ts +1 -0
  375. package/dist/react/choropleth.js +67 -0
  376. package/dist/react/cohort.d.ts +1 -0
  377. package/dist/react/cohort.js +69 -0
  378. package/dist/react/column.d.ts +1 -0
  379. package/dist/react/column.js +85 -0
  380. package/dist/react/combo.d.ts +1 -0
  381. package/dist/react/combo.js +85 -0
  382. package/dist/react/creative.d.ts +1 -0
  383. package/dist/react/creative.js +61 -0
  384. package/dist/react/diagram.d.ts +1 -0
  385. package/dist/react/diagram.js +60 -0
  386. package/dist/react/dimswitch.d.ts +1 -0
  387. package/dist/react/dimswitch.js +71 -0
  388. package/dist/react/dot.d.ts +1 -0
  389. package/dist/react/dot.js +69 -0
  390. package/dist/react/export.d.ts +1 -0
  391. package/dist/react/export.js +657 -0
  392. package/dist/react/funnel.d.ts +1 -0
  393. package/dist/react/funnel.js +62 -0
  394. package/dist/react/gantt.d.ts +1 -0
  395. package/dist/react/gantt.js +62 -0
  396. package/dist/react/grid.d.ts +1 -0
  397. package/dist/react/grid.js +66 -0
  398. package/dist/react/heatmap.d.ts +1 -0
  399. package/dist/react/heatmap.js +67 -0
  400. package/dist/react/histogram.d.ts +1 -0
  401. package/dist/react/histogram.js +85 -0
  402. package/dist/react/index.d.ts +1 -0
  403. package/dist/react/index.js +503 -0
  404. package/dist/react/kpi.d.ts +1 -0
  405. package/dist/react/kpi.js +67 -0
  406. package/dist/react/likert.d.ts +1 -0
  407. package/dist/react/likert.js +82 -0
  408. package/dist/react/line.d.ts +1 -0
  409. package/dist/react/line.js +80 -0
  410. package/dist/react/mekko.d.ts +1 -0
  411. package/dist/react/mekko.js +70 -0
  412. package/dist/react/pareto.d.ts +1 -0
  413. package/dist/react/pareto.js +89 -0
  414. package/dist/react/pie.d.ts +1 -0
  415. package/dist/react/pie.js +63 -0
  416. package/dist/react/prepare.d.ts +1 -0
  417. package/dist/react/prepare.js +277 -0
  418. package/dist/react/pvm.d.ts +1 -0
  419. package/dist/react/pvm.js +67 -0
  420. package/dist/react/pyramid.d.ts +1 -0
  421. package/dist/react/pyramid.js +66 -0
  422. package/dist/react/sankey.d.ts +1 -0
  423. package/dist/react/sankey.js +59 -0
  424. package/dist/react/scatter.d.ts +1 -0
  425. package/dist/react/scatter.js +62 -0
  426. package/dist/react/slope.d.ts +1 -0
  427. package/dist/react/slope.js +63 -0
  428. package/dist/react/sparkline.d.ts +1 -0
  429. package/dist/react/sparkline.js +59 -0
  430. package/dist/react/spec.d.ts +1 -0
  431. package/dist/react/spec.js +370 -0
  432. package/dist/react/status.d.ts +1 -0
  433. package/dist/react/status.js +64 -0
  434. package/dist/react/story.d.ts +1 -0
  435. package/dist/react/story.js +140 -0
  436. package/dist/react/table.d.ts +1 -0
  437. package/dist/react/table.js +68 -0
  438. package/dist/react/theme.d.ts +1 -0
  439. package/dist/react/theme.js +53 -0
  440. package/dist/react/tilemap.d.ts +1 -0
  441. package/dist/react/tilemap.js +66 -0
  442. package/dist/react/treemap.d.ts +1 -0
  443. package/dist/react/treemap.js +61 -0
  444. package/dist/react/variance.d.ts +1 -0
  445. package/dist/react/variance.js +64 -0
  446. package/dist/react/waffle.d.ts +1 -0
  447. package/dist/react/waffle.js +62 -0
  448. package/dist/react/waterfall.d.ts +1 -0
  449. package/dist/react/waterfall.js +67 -0
  450. package/dist/resvg-ZOVDIZTV.js +23 -0
  451. package/dist/rows.d.ts +1 -0
  452. package/dist/rows.js +23 -0
  453. package/dist/rowsModule-3Y4I3M3E.js +27 -0
  454. package/dist/schema-2BMZOHXI.js +22 -0
  455. package/dist/schema-2GUBWOBC.js +26 -0
  456. package/dist/schema-34ZELWRQ.js +25 -0
  457. package/dist/schema-3BHL2B76.js +22 -0
  458. package/dist/schema-4735XAZX.js +29 -0
  459. package/dist/schema-5YTNQ6JY.js +22 -0
  460. package/dist/schema-7J3NAIN2.js +27 -0
  461. package/dist/schema-AOJJ7JZB.js +22 -0
  462. package/dist/schema-CVMV4LRA.js +22 -0
  463. package/dist/schema-D3RCMN3T.js +22 -0
  464. package/dist/schema-E2ISJ65D.js +23 -0
  465. package/dist/schema-E6YOSOWB.js +28 -0
  466. package/dist/schema-EQQB43AY.js +22 -0
  467. package/dist/schema-EVLLL5UF.js +22 -0
  468. package/dist/schema-EYQ5IBLF.js +23 -0
  469. package/dist/schema-EYZVD73N.js +22 -0
  470. package/dist/schema-G4KFMQBL.js +22 -0
  471. package/dist/schema-GH7IKSOU.js +23 -0
  472. package/dist/schema-IF5N3J56.js +42 -0
  473. package/dist/schema-IG7JIR4H.js +23 -0
  474. package/dist/schema-JJYJOQTT.js +23 -0
  475. package/dist/schema-KFC4WYH4.js +32 -0
  476. package/dist/schema-L7263JMT.js +25 -0
  477. package/dist/schema-MEAFRXVH.js +53 -0
  478. package/dist/schema-P63S63GE.js +23 -0
  479. package/dist/schema-P7LJFJAJ.js +22 -0
  480. package/dist/schema-PA2MXYY4.js +23 -0
  481. package/dist/schema-PDZ6256H.js +23 -0
  482. package/dist/schema-PNC3Z7AH.js +25 -0
  483. package/dist/schema-QEVSIMGO.js +22 -0
  484. package/dist/schema-QJJPRRE7.js +22 -0
  485. package/dist/schema-S3EQKVOT.js +23 -0
  486. package/dist/schema-STGL44TL.js +22 -0
  487. package/dist/schema-T4NE2EAO.js +22 -0
  488. package/dist/schema-TQYTESG3.js +22 -0
  489. package/dist/schema-W376PAJG.js +22 -0
  490. package/dist/schema-XYYDUUHS.js +26 -0
  491. package/dist/specValidation-NVBIZMEE.js +48 -0
  492. package/dist/theme.d.ts +1 -0
  493. package/dist/theme.js +24 -0
  494. package/dist/themeShapeRules-5C2463YH.js +11 -0
  495. package/dist/types/core/a11y/accessibility.d.ts +43 -0
  496. package/dist/types/core/a11y/recordsShared.d.ts +44 -0
  497. package/dist/types/core/a11y/structuralRecords.d.ts +6 -0
  498. package/dist/types/core/a11y/types.d.ts +116 -0
  499. package/dist/types/core/annotate.d.ts +300 -0
  500. package/dist/types/core/annotateArms.d.ts +37 -0
  501. package/dist/types/core/annotateFields.d.ts +30 -0
  502. package/dist/types/core/annotateGapBracket.d.ts +66 -0
  503. package/dist/types/core/annotateLinks.d.ts +47 -0
  504. package/dist/types/core/annotateTargets.d.ts +90 -0
  505. package/dist/types/core/axis.d.ts +179 -0
  506. package/dist/types/core/bandSelect.d.ts +10 -0
  507. package/dist/types/core/bands.d.ts +14 -0
  508. package/dist/types/core/calendarLabels.d.ts +101 -0
  509. package/dist/types/core/charts/band/stacks.d.ts +155 -0
  510. package/dist/types/core/charts/bar/fixtures.d.ts +9 -0
  511. package/dist/types/core/charts/bar/layout.d.ts +95 -0
  512. package/dist/types/core/charts/bartable/fixtures.d.ts +4 -0
  513. package/dist/types/core/charts/bartable/types.d.ts +192 -0
  514. package/dist/types/core/charts/box/fixtures.d.ts +12 -0
  515. package/dist/types/core/charts/box/types.d.ts +110 -0
  516. package/dist/types/core/charts/bullet/fixtures.d.ts +11 -0
  517. package/dist/types/core/charts/butterfly/fixtures.d.ts +9 -0
  518. package/dist/types/core/charts/choropleth/fixtures.d.ts +3 -0
  519. package/dist/types/core/charts/choropleth/overlayTypes.d.ts +68 -0
  520. package/dist/types/core/charts/choropleth/types.d.ts +117 -0
  521. package/dist/types/core/charts/cohort/fixtures.d.ts +12 -0
  522. package/dist/types/core/charts/cohort/types.d.ts +165 -0
  523. package/dist/types/core/charts/column/anomaly.d.ts +204 -0
  524. package/dist/types/core/charts/column/fixtures.d.ts +12 -0
  525. package/dist/types/core/charts/column/layout.d.ts +116 -0
  526. package/dist/types/core/charts/column/model.d.ts +295 -0
  527. package/dist/types/core/charts/column/types.d.ts +56 -0
  528. package/dist/types/core/charts/combo/endpoints.d.ts +165 -0
  529. package/dist/types/core/charts/combo/fixtures.d.ts +12 -0
  530. package/dist/types/core/charts/combo/layout.d.ts +48 -0
  531. package/dist/types/core/charts/creative/fixtures.d.ts +4 -0
  532. package/dist/types/core/charts/creative/types.d.ts +73 -0
  533. package/dist/types/core/charts/diagram/fixtures.d.ts +3 -0
  534. package/dist/types/core/charts/dimswitch/compile.d.ts +20 -0
  535. package/dist/types/core/charts/dimswitch/fixtures.d.ts +3 -0
  536. package/dist/types/core/charts/dimswitch/types.d.ts +152 -0
  537. package/dist/types/core/charts/dot/fixtures.d.ts +11 -0
  538. package/dist/types/core/charts/funnel/fixtures.d.ts +11 -0
  539. package/dist/types/core/charts/gantt/fixtures.d.ts +9 -0
  540. package/dist/types/core/charts/gantt/layout.d.ts +56 -0
  541. package/dist/types/core/charts/grid/fixtures.d.ts +3 -0
  542. package/dist/types/core/charts/grid/metricStack.d.ts +108 -0
  543. package/dist/types/core/charts/grid/metricStackSchema.d.ts +74 -0
  544. package/dist/types/core/charts/grid/normalize.d.ts +99 -0
  545. package/dist/types/core/charts/grid/schema.d.ts +168 -0
  546. package/dist/types/core/charts/heatmap/fixtures.d.ts +11 -0
  547. package/dist/types/core/charts/histogram/fixtures.d.ts +15 -0
  548. package/dist/types/core/charts/histogram/types.d.ts +98 -0
  549. package/dist/types/core/charts/kpi/fixtures.d.ts +9 -0
  550. package/dist/types/core/charts/likert/fixtures.d.ts +11 -0
  551. package/dist/types/core/charts/likert/layout.d.ts +111 -0
  552. package/dist/types/core/charts/line/fixtures.d.ts +16 -0
  553. package/dist/types/core/charts/line/types.d.ts +6 -0
  554. package/dist/types/core/charts/mekko/fixtures.d.ts +13 -0
  555. package/dist/types/core/charts/pareto/fixtures.d.ts +5 -0
  556. package/dist/types/core/charts/pareto/layout.d.ts +68 -0
  557. package/dist/types/core/charts/pie/fixtures.d.ts +14 -0
  558. package/dist/types/core/charts/pvm/fixtures.d.ts +13 -0
  559. package/dist/types/core/charts/pvm/types.d.ts +118 -0
  560. package/dist/types/core/charts/pyramid/fixtures.d.ts +4 -0
  561. package/dist/types/core/charts/pyramid/types.d.ts +92 -0
  562. package/dist/types/core/charts/sankey/fixtures.d.ts +4 -0
  563. package/dist/types/core/charts/sankey/types.d.ts +116 -0
  564. package/dist/types/core/charts/scatter/fixtures.d.ts +12 -0
  565. package/dist/types/core/charts/scatter/types.d.ts +58 -0
  566. package/dist/types/core/charts/slope/fixtures.d.ts +13 -0
  567. package/dist/types/core/charts/sparkline/fixtures.d.ts +9 -0
  568. package/dist/types/core/charts/status/fixtures.d.ts +8 -0
  569. package/dist/types/core/charts/status/layout.d.ts +71 -0
  570. package/dist/types/core/charts/table/fitFormats.d.ts +67 -0
  571. package/dist/types/core/charts/table/fixtures.d.ts +7 -0
  572. package/dist/types/core/charts/table/resolve.d.ts +72 -0
  573. package/dist/types/core/charts/table/view.d.ts +156 -0
  574. package/dist/types/core/charts/tilemap/fixtures.d.ts +3 -0
  575. package/dist/types/core/charts/tilemap/types.d.ts +94 -0
  576. package/dist/types/core/charts/treemap/fixtures.d.ts +4 -0
  577. package/dist/types/core/charts/treemap/types.d.ts +78 -0
  578. package/dist/types/core/charts/variance/fixtures.d.ts +12 -0
  579. package/dist/types/core/charts/waffle/fixtures.d.ts +5 -0
  580. package/dist/types/core/charts/waffle/types.d.ts +117 -0
  581. package/dist/types/core/charts/waterfall/fixtures.d.ts +9 -0
  582. package/dist/types/core/claims/browser.d.ts +49 -0
  583. package/dist/types/core/claims/manifest.d.ts +22 -0
  584. package/dist/types/core/dateFormat.d.ts +39 -0
  585. package/dist/types/core/deferred.d.ts +121 -0
  586. package/dist/types/core/diagnostics/describe.d.ts +149 -0
  587. package/dist/types/core/diagnostics/jsonPatch.d.ts +36 -0
  588. package/dist/types/core/doc/bareChart.d.ts +2 -0
  589. package/dist/types/core/doc/diagnostics.d.ts +124 -0
  590. package/dist/types/core/doc/docExpand.d.ts +39 -0
  591. package/dist/types/core/doc/document.d.ts +43 -0
  592. package/dist/types/core/doc/ownedDocumentCopy.d.ts +5 -0
  593. package/dist/types/core/doc/specError.d.ts +6 -0
  594. package/dist/types/core/emptyData.d.ts +27 -0
  595. package/dist/types/core/eventLane.d.ts +208 -0
  596. package/dist/types/core/fontMetrics/index.d.ts +47 -0
  597. package/dist/types/core/fontMetrics/injected.d.ts +40 -0
  598. package/dist/types/core/fontMetrics/tableDocument.d.ts +73 -0
  599. package/dist/types/core/fontMetrics/tables.generated.d.ts +17 -0
  600. package/dist/types/core/footer.d.ts +59 -0
  601. package/dist/types/core/format.d.ts +149 -0
  602. package/dist/types/core/formatPrecision.d.ts +136 -0
  603. package/dist/types/core/formatSpec.d.ts +302 -0
  604. package/dist/types/core/frame.d.ts +583 -0
  605. package/dist/types/core/geo/packs/all.d.ts +7 -0
  606. package/dist/types/core/geo/packs/dach.d.ts +16 -0
  607. package/dist/types/core/geo/packs/de-states.d.ts +16 -0
  608. package/dist/types/core/geo/packs/eu27.d.ts +16 -0
  609. package/dist/types/core/geo/packs/europe.d.ts +16 -0
  610. package/dist/types/core/geo/packs/index.d.ts +22 -0
  611. package/dist/types/core/geo/packs/registry.d.ts +37 -0
  612. package/dist/types/core/geo/packs/us-states.d.ts +16 -0
  613. package/dist/types/core/geo/packs/world.d.ts +16 -0
  614. package/dist/types/core/geo/tiles/eu27.generated.d.ts +412 -0
  615. package/dist/types/core/geo/tiles/europe.generated.d.ts +842 -0
  616. package/dist/types/core/geo/tiles/index.d.ts +8 -0
  617. package/dist/types/core/geo/tiles/types.d.ts +36 -0
  618. package/dist/types/core/geo/tiles/us-states.generated.d.ts +952 -0
  619. package/dist/types/core/geo/tiles/world.generated.d.ts +968 -0
  620. package/dist/types/core/geo/types.d.ts +146 -0
  621. package/dist/types/core/geometry.d.ts +102 -0
  622. package/dist/types/core/grid/sharedScale.d.ts +82 -0
  623. package/dist/types/core/icons.d.ts +227 -0
  624. package/dist/types/core/inputError.d.ts +14 -0
  625. package/dist/types/core/isoDate.d.ts +2 -0
  626. package/dist/types/core/isoTime.d.ts +7 -0
  627. package/dist/types/core/label/categoryRow.d.ts +332 -0
  628. package/dist/types/core/label/occupied.d.ts +41 -0
  629. package/dist/types/core/label/ownership.d.ts +83 -0
  630. package/dist/types/core/label/solver.d.ts +380 -0
  631. package/dist/types/core/label/tickRow.d.ts +78 -0
  632. package/dist/types/core/live/types.d.ts +50 -0
  633. package/dist/types/core/normalize/shared.d.ts +56 -0
  634. package/dist/types/core/notes.d.ts +174 -0
  635. package/dist/types/core/othersShade.d.ts +9 -0
  636. package/dist/types/core/periodYears.d.ts +9 -0
  637. package/dist/types/core/polyline.d.ts +11 -0
  638. package/dist/types/core/rangeRules.d.ts +19 -0
  639. package/dist/types/core/ratioTier.d.ts +120 -0
  640. package/dist/types/core/readerStrings.d.ts +13 -0
  641. package/dist/types/core/reading.d.ts +120 -0
  642. package/dist/types/core/registry.d.ts +178 -0
  643. package/dist/types/core/repaintGeometry.d.ts +19 -0
  644. package/dist/types/core/request.d.ts +124 -0
  645. package/dist/types/core/rows.d.ts +45 -0
  646. package/dist/types/core/scale.d.ts +106 -0
  647. package/dist/types/core/schema/capability.d.ts +229 -0
  648. package/dist/types/core/schema/namedColumns.d.ts +45 -0
  649. package/dist/types/core/schema/reference.d.ts +31 -0
  650. package/dist/types/core/schema/refusals.d.ts +45 -0
  651. package/dist/types/core/schema/unknownKeys.d.ts +45 -0
  652. package/dist/types/core/seriesIdentity.d.ts +120 -0
  653. package/dist/types/core/shareRounding.d.ts +49 -0
  654. package/dist/types/core/sizing.d.ts +330 -0
  655. package/dist/types/core/staticFooter.d.ts +6 -0
  656. package/dist/types/core/story.d.ts +41 -0
  657. package/dist/types/core/structureCounts.d.ts +10 -0
  658. package/dist/types/core/svg/renderSvg.d.ts +51 -0
  659. package/dist/types/core/target.d.ts +89 -0
  660. package/dist/types/core/text.d.ts +113 -0
  661. package/dist/types/core/theme.d.ts +478 -0
  662. package/dist/types/core/themeFields.d.ts +11 -0
  663. package/dist/types/core/themeRules.d.ts +111 -0
  664. package/dist/types/core/themeShape.d.ts +87 -0
  665. package/dist/types/core/themeValidate.d.ts +15 -0
  666. package/dist/types/core/timeAxis.d.ts +106 -0
  667. package/dist/types/core/types/annotations.d.ts +223 -0
  668. package/dist/types/core/types/cell.d.ts +82 -0
  669. package/dist/types/core/types/data.d.ts +309 -0
  670. package/dist/types/core/types/diagram.d.ts +234 -0
  671. package/dist/types/core/types/index.d.ts +8 -0
  672. package/dist/types/core/types/options.d.ts +1583 -0
  673. package/dist/types/core/types/scene.d.ts +990 -0
  674. package/dist/types/core/types/sizing.d.ts +51 -0
  675. package/dist/types/core/types/table.d.ts +873 -0
  676. package/dist/types/core/types/theme.d.ts +806 -0
  677. package/dist/types/core/zoom.d.ts +106 -0
  678. package/dist/types/fixtures/index.d.ts +40 -0
  679. package/dist/types/fixtures/registry.d.ts +15 -0
  680. package/dist/types/fonts.d.ts +10 -0
  681. package/dist/types/index.d.ts +70 -0
  682. package/dist/types/react/BoardplotTheme.d.ts +9 -0
  683. package/dist/types/react/DimSwitchChart.d.ts +36 -0
  684. package/dist/types/react/ScaleGroup.d.ts +31 -0
  685. package/dist/types/react/SceneRenderer.d.ts +23 -0
  686. package/dist/types/react/SizePlaceholder.d.ts +51 -0
  687. package/dist/types/react/StoryFrame.d.ts +42 -0
  688. package/dist/types/react/TableChart.d.ts +220 -0
  689. package/dist/types/react/a11ySurface.d.ts +20 -0
  690. package/dist/types/react/barrelCharts.d.ts +1023 -0
  691. package/dist/types/react/charts/bar.d.ts +28 -0
  692. package/dist/types/react/charts/bartable.d.ts +27 -0
  693. package/dist/types/react/charts/box.d.ts +27 -0
  694. package/dist/types/react/charts/bullet.d.ts +28 -0
  695. package/dist/types/react/charts/butterfly.d.ts +28 -0
  696. package/dist/types/react/charts/choropleth.d.ts +27 -0
  697. package/dist/types/react/charts/cohort.d.ts +52 -0
  698. package/dist/types/react/charts/column.d.ts +27 -0
  699. package/dist/types/react/charts/combo.d.ts +7 -0
  700. package/dist/types/react/charts/creative.d.ts +27 -0
  701. package/dist/types/react/charts/diagram.d.ts +162 -0
  702. package/dist/types/react/charts/dimswitch.d.ts +6 -0
  703. package/dist/types/react/charts/dot.d.ts +28 -0
  704. package/dist/types/react/charts/funnel.d.ts +28 -0
  705. package/dist/types/react/charts/gantt.d.ts +28 -0
  706. package/dist/types/react/charts/grid.d.ts +29 -0
  707. package/dist/types/react/charts/heatmap.d.ts +28 -0
  708. package/dist/types/react/charts/histogram.d.ts +27 -0
  709. package/dist/types/react/charts/kpi.d.ts +28 -0
  710. package/dist/types/react/charts/likert.d.ts +27 -0
  711. package/dist/types/react/charts/line.d.ts +28 -0
  712. package/dist/types/react/charts/mekko.d.ts +28 -0
  713. package/dist/types/react/charts/pareto.d.ts +28 -0
  714. package/dist/types/react/charts/pie.d.ts +28 -0
  715. package/dist/types/react/charts/pvm.d.ts +27 -0
  716. package/dist/types/react/charts/pyramid.d.ts +27 -0
  717. package/dist/types/react/charts/sankey.d.ts +27 -0
  718. package/dist/types/react/charts/scatter.d.ts +28 -0
  719. package/dist/types/react/charts/slope.d.ts +28 -0
  720. package/dist/types/react/charts/sparkline.d.ts +28 -0
  721. package/dist/types/react/charts/status.d.ts +27 -0
  722. package/dist/types/react/charts/table.d.ts +6 -0
  723. package/dist/types/react/charts/tilemap.d.ts +27 -0
  724. package/dist/types/react/charts/treemap.d.ts +27 -0
  725. package/dist/types/react/charts/variance.d.ts +28 -0
  726. package/dist/types/react/charts/waffle.d.ts +28 -0
  727. package/dist/types/react/charts/waterfall.d.ts +28 -0
  728. package/dist/types/react/createChartComponent.d.ts +135 -0
  729. package/dist/types/react/export/clipboard.d.ts +8 -0
  730. package/dist/types/react/export/csv.d.ts +2 -0
  731. package/dist/types/react/export/frame.d.ts +35 -0
  732. package/dist/types/react/export/index.d.ts +7 -0
  733. package/dist/types/react/export/png.d.ts +14 -0
  734. package/dist/types/react/export/svg.d.ts +5 -0
  735. package/dist/types/react/export/types.d.ts +69 -0
  736. package/dist/types/react/export/useExport.d.ts +17 -0
  737. package/dist/types/react/exportLink.d.ts +49 -0
  738. package/dist/types/react/footerFrame.d.ts +25 -0
  739. package/dist/types/react/hover/dataTable.d.ts +13 -0
  740. package/dist/types/react/hover/engine.d.ts +210 -0
  741. package/dist/types/react/hover/keyboard.d.ts +44 -0
  742. package/dist/types/react/hover/labelCard.d.ts +170 -0
  743. package/dist/types/react/hover/placement.d.ts +49 -0
  744. package/dist/types/react/index.d.ts +16 -0
  745. package/dist/types/react/parseChartSpec.d.ts +16 -0
  746. package/dist/types/react/prepare.d.ts +32 -0
  747. package/dist/types/react/prepared.d.ts +53 -0
  748. package/dist/types/react/preparedTable.d.ts +15 -0
  749. package/dist/types/react/rowsInput.d.ts +55 -0
  750. package/dist/types/react/rowsModule.d.ts +18 -0
  751. package/dist/types/react/rowsStore.d.ts +50 -0
  752. package/dist/types/react/scale-group.d.ts +2 -0
  753. package/dist/types/react/scaleGroupContext.d.ts +22 -0
  754. package/dist/types/react/scenePaint.d.ts +10 -0
  755. package/dist/types/react/scrollState.d.ts +26 -0
  756. package/dist/types/react/spec.d.ts +65 -0
  757. package/dist/types/react/specValidation.d.ts +45 -0
  758. package/dist/types/react/story.d.ts +15 -0
  759. package/dist/types/react/theme.d.ts +9 -0
  760. package/dist/types/react/themeContext.d.ts +44 -0
  761. package/dist/types/react/useChartLayout.d.ts +22 -0
  762. package/dist/types/react/useContainerSize.d.ts +57 -0
  763. package/dist/types/react/useHover.d.ts +100 -0
  764. package/dist/types/react/useZoom.d.ts +50 -0
  765. package/dist/types/rows.d.ts +58 -0
  766. package/dist/types/tableLooks.d.ts +6 -0
  767. package/dist/types/theme.d.ts +3 -0
  768. package/dist/types/validate.d.ts +3 -0
  769. package/dist/validate.d.ts +1 -0
  770. package/dist/validate.js +222 -0
  771. package/docs/FONTS.md +68 -0
  772. package/docs/TELEMETRY.md +94 -0
  773. package/docs/manual.md +838 -0
  774. package/docs/reference/bar.md +222 -0
  775. package/docs/reference/bartable.md +143 -0
  776. package/docs/reference/box.md +93 -0
  777. package/docs/reference/bullet.md +118 -0
  778. package/docs/reference/butterfly.md +117 -0
  779. package/docs/reference/choropleth.md +148 -0
  780. package/docs/reference/cohort.md +149 -0
  781. package/docs/reference/column.md +275 -0
  782. package/docs/reference/combo.md +219 -0
  783. package/docs/reference/creative.md +147 -0
  784. package/docs/reference/diagram.md +191 -0
  785. package/docs/reference/dimswitch.md +1395 -0
  786. package/docs/reference/dot.md +117 -0
  787. package/docs/reference/fixtures.md +1088 -0
  788. package/docs/reference/funnel.md +121 -0
  789. package/docs/reference/gantt.md +132 -0
  790. package/docs/reference/grid.md +302 -0
  791. package/docs/reference/heatmap.md +127 -0
  792. package/docs/reference/histogram.md +77 -0
  793. package/docs/reference/kpi.md +115 -0
  794. package/docs/reference/likert.md +113 -0
  795. package/docs/reference/line.md +436 -0
  796. package/docs/reference/mekko.md +114 -0
  797. package/docs/reference/options.md +313 -0
  798. package/docs/reference/pareto.md +102 -0
  799. package/docs/reference/pie.md +114 -0
  800. package/docs/reference/pvm.md +114 -0
  801. package/docs/reference/pyramid.md +99 -0
  802. package/docs/reference/react.md +703 -0
  803. package/docs/reference/reading.md +28 -0
  804. package/docs/reference/sankey.md +110 -0
  805. package/docs/reference/scatter.md +211 -0
  806. package/docs/reference/slope.md +126 -0
  807. package/docs/reference/sparkline.md +74 -0
  808. package/docs/reference/status.md +107 -0
  809. package/docs/reference/table.md +673 -0
  810. package/docs/reference/theme.md +361 -0
  811. package/docs/reference/tilemap.md +121 -0
  812. package/docs/reference/treemap.md +86 -0
  813. package/docs/reference/variance.md +126 -0
  814. package/docs/reference/waffle.md +106 -0
  815. package/docs/reference/waterfall.md +164 -0
  816. package/llms.txt +57 -0
  817. package/package.json +437 -4
@@ -0,0 +1,1754 @@
1
+ import {
2
+ liftOrFallback,
3
+ missesSize,
4
+ tightSpacingWarning
5
+ } from "./chunk-BVWU6GOB.js";
6
+ import {
7
+ chartTheme
8
+ } from "./chunk-SXGTRZFN.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-IZ35GMGB.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-NYEY6W5R.js";
47
+ import {
48
+ rowDrivenHeight
49
+ } from "./chunk-COYPDRJK.js";
50
+ import {
51
+ structureCount
52
+ } from "./chunk-B2EBEXIS.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-QNHZXFRA.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-A3ULWR5N.js";
87
+ import {
88
+ qualifierFont,
89
+ tableInk,
90
+ tableRuleInk
91
+ } from "./chunk-Z2MGTKDR.js";
92
+ import {
93
+ DEFAULT_EMPTY_MESSAGE,
94
+ hasNoDataRows
95
+ } from "./chunk-F77BNDAT.js";
96
+ import {
97
+ CARD_CLASS_WIDTH,
98
+ VERIFY_ADVICE,
99
+ heightOmitted,
100
+ rowSizing
101
+ } from "./chunk-GQPESFAF.js";
102
+ import {
103
+ authoredNotes,
104
+ composedTextRole,
105
+ createOccupiedIndex,
106
+ cutWithTitle,
107
+ distinctCut,
108
+ fitText,
109
+ frameTextOptions,
110
+ groundTextWarnings,
111
+ legendOff,
112
+ legendRequired,
113
+ solveFrame
114
+ } from "./chunk-2JAWQ7VV.js";
115
+ import {
116
+ copyFrame,
117
+ disclosureNote,
118
+ footerPlans
119
+ } from "./chunk-YTSSXSZR.js";
120
+ import {
121
+ AUTOMATIC_FORMAT,
122
+ MAGNITUDE_DIVISOR,
123
+ MAGNITUDE_GROUP,
124
+ MAGNITUDE_LABEL,
125
+ effectiveScale,
126
+ formatWithSpec,
127
+ parseFormatExample,
128
+ specUnitKind,
129
+ unitOfSpec
130
+ } from "./chunk-ASAON7G4.js";
131
+ import {
132
+ currentSmallValues,
133
+ formatExactNumber,
134
+ nonzeroDecimals,
135
+ roundHalfUp,
136
+ roundsToZero,
137
+ zeroLifts
138
+ } from "./chunk-YQ2B3YVF.js";
139
+ import {
140
+ canvasMargin,
141
+ colorblindRoles,
142
+ markRolePaint,
143
+ panelTypeClass,
144
+ resolveSemanticPaletteTheme,
145
+ resolveSurface,
146
+ semanticPalettePaint,
147
+ signedFillPaint,
148
+ strokeToken,
149
+ tableEmphasis,
150
+ textScaleOf,
151
+ typeWidthClass
152
+ } from "./chunk-II7652VA.js";
153
+ import {
154
+ TARGET_SIZE,
155
+ accessibleTitle,
156
+ resolveSize
157
+ } from "./chunk-SGD3ZHID.js";
158
+ import {
159
+ maxOf,
160
+ minOf,
161
+ pushAll
162
+ } from "./chunk-WYJEOMNY.js";
163
+ import {
164
+ WIDTH_SAFETY,
165
+ defaultMeasurer,
166
+ ellipsize
167
+ } from "./chunk-TXINIAFL.js";
168
+
169
+ // src/core/charts/table/encodings/inCellBar.ts
170
+ var TEXT_GAP = 8, BAR_HEIGHT = 10;
171
+ function emitInCellBar(context, metrics) {
172
+ let value = context.cell.raw;
173
+ if (context.cell.state !== "value" || typeof value != "number" || value === 0 || metrics.maxAbs <= 0)
174
+ return [];
175
+ let width = Math.max(0, metrics.contentBox.w - metrics.textReserve - TEXT_GAP) * Math.min(1, Math.abs(value) / metrics.maxAbs);
176
+ if (width <= 0) return [];
177
+ 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);
178
+ return [
179
+ {
180
+ t: "rect",
181
+ id: context.nodeId("bar"),
182
+ rect: {
183
+ x: metrics.contentBox.x,
184
+ y: metrics.contentBox.y + (metrics.contentBox.h - height) / 2,
185
+ w: width,
186
+ h: height
187
+ },
188
+ fill,
189
+ owner: context.owner,
190
+ part: "tableBar"
191
+ }
192
+ ];
193
+ }
194
+
195
+ // src/core/charts/table/encodings/sparkline.ts
196
+ function sparklineSourceValues(row, sourceColumns) {
197
+ return sourceColumns.map((sourceId) => {
198
+ let source = row.cells[sourceId];
199
+ return source?.state === "value" && typeof source.raw == "number" ? source.raw : null;
200
+ });
201
+ }
202
+ function tableSparklineDomain(rows, sourceColumns, shape) {
203
+ return sparklineDomain(
204
+ rows.filter((row) => row.role !== "section").map((row) => sparklineSourceValues(row, sourceColumns)),
205
+ shape
206
+ );
207
+ }
208
+ function sparklineDomains(columns, rows) {
209
+ let domains = /* @__PURE__ */ new Map();
210
+ for (let column of columns)
211
+ column.kind !== "encoding" || column.encoding?.type !== "sparkline" || domains.set(column.id, tableSparklineDomain(rows, column.encoding.sourceColumns, column.encoding.kind ?? "line"));
212
+ return domains;
213
+ }
214
+ function emitSparkline(context, values, metrics) {
215
+ if (!values.some((value) => value !== null)) {
216
+ let font2 = { family: context.theme.type.family, ...context.theme.type.label }, mark = context.theme.table?.glyphs?.missing ?? "\u2014";
217
+ return [
218
+ {
219
+ t: "text",
220
+ typeRole: "label",
221
+ id: context.nodeId("sparkEmpty"),
222
+ x: context.box.x + context.box.w / 2,
223
+ y: context.box.y + (context.box.h - context.measure(mark, font2).height) / 2,
224
+ lines: [mark],
225
+ align: "middle",
226
+ font: font2,
227
+ ink: { token: "inkMuted" },
228
+ owner: context.owner,
229
+ part: "tableSparkEmpty"
230
+ }
231
+ ];
232
+ }
233
+ 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({
234
+ box: context.box,
235
+ values,
236
+ shape: kind,
237
+ domain: metrics.domain,
238
+ style: TABLE_SPARK_STYLE,
239
+ lastText,
240
+ font,
241
+ measure: context.measure
242
+ });
243
+ return emitSparklineMarks({
244
+ plot,
245
+ shape: kind,
246
+ theme: context.theme,
247
+ palette: context.palette,
248
+ style: TABLE_SPARK_STYLE,
249
+ nodeId: context.nodeId,
250
+ owner: context.owner,
251
+ partPrefix: "table"
252
+ }).map((node) => node.t === "text" ? { ...node, typeRole: "label" } : node);
253
+ }
254
+
255
+ // src/core/charts/table/fitFormats.ts
256
+ var NEXT_MAGNITUDE = {
257
+ none: "k",
258
+ k: "m",
259
+ m: "bn",
260
+ bn: "t",
261
+ t: void 0
262
+ }, FIT_DIGITS = 2;
263
+ function keptDigits(value, magnitude, decimals) {
264
+ return roundHalfUp(Math.abs(value) / MAGNITUDE_DIVISOR[magnitude], decimals).replace(".", "").replace(/^0+/, "").length;
265
+ }
266
+ function keepsDigits(figures, spec, next) {
267
+ return figures.every((value) => {
268
+ let kept = keptDigits(value, next.magnitude, next.decimals);
269
+ return kept === 0 && spec.automatic || kept >= Math.min(FIT_DIGITS, keptDigits(value, spec.magnitude, spec.decimals));
270
+ });
271
+ }
272
+ function floorDecimals(figures, spec, magnitude, from = 0) {
273
+ let decimals = from;
274
+ for (; decimals < 6 && !keepsDigits(figures, spec, { magnitude, decimals }); ) decimals++;
275
+ return decimals;
276
+ }
277
+ function shorterSpec(spec, figures) {
278
+ let maxAbs = figures === void 0 ? 1 / 0 : Math.max(0, maxOf(figures));
279
+ if (figures ??= [], spec.decimals > 0) {
280
+ 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) };
281
+ return keepsDigits(figures, spec, next2) ? next2 : void 0;
282
+ }
283
+ if (specUnitKind(spec) !== "number" || !/^(?:|\p{Sc}|[A-Z]{3})$/u.test(spec.suffix.trim())) return;
284
+ let magnitude = NEXT_MAGNITUDE[spec.magnitude];
285
+ if (magnitude === void 0 || maxAbs / MAGNITUDE_DIVISOR[magnitude] < 1) return;
286
+ let next = { ...spec, magnitude, decimals: 1, rollMagnitude: void 0 };
287
+ if (maxAbs === 1 / 0) return next;
288
+ let rolled = { ...next, ...effectiveScale(maxAbs, next) };
289
+ rolled.decimals = floorDecimals(figures, spec, rolled.magnitude, rolled.decimals);
290
+ 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;
291
+ return widest(step) >= widest(spec) ? void 0 : step;
292
+ }
293
+ function exampleOf(spec) {
294
+ 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}`;
295
+ return spec.negative === "parens" ? `(${body})` : body;
296
+ }
297
+ function withRowFormats(rows, formats) {
298
+ return rows.map((row) => {
299
+ let next = formats.get(row.id), children = row.children === void 0 ? void 0 : withRowFormats(row.children, formats);
300
+ return next === void 0 && children === row.children ? row : {
301
+ ...row,
302
+ ...next === void 0 ? {} : { format: next.format },
303
+ ...next?.unitAffix === void 0 ? {} : { unitAffix: next.unitAffix },
304
+ ...children === void 0 ? {} : { children }
305
+ };
306
+ });
307
+ }
308
+ function withCellFormats(rows, formats) {
309
+ return rows.map((row) => {
310
+ let next = formats.get(row.id), children = row.children === void 0 ? void 0 : withCellFormats(row.children, formats);
311
+ if (next === void 0 && children === void 0) return row;
312
+ let cells = next === void 0 ? row.cells : { ...row.cells };
313
+ for (let [columnId, format] of next ?? []) {
314
+ let cell = row.cells[columnId];
315
+ cells[columnId] = typeof cell == "number" ? { v: cell, format } : { ...cell, format };
316
+ }
317
+ return { ...row, ...cells === void 0 ? {} : { cells }, ...children === void 0 ? {} : { children } };
318
+ });
319
+ }
320
+ function rowExample(row, decimal) {
321
+ if (row === void 0) return;
322
+ if (row.format !== void 0) return row.format;
323
+ let calc = row.calc;
324
+ return calc !== void 0 && "op" in calc && (calc.op === "share" || calc.op === "percentDelta") ? `1${decimal}2%` : void 0;
325
+ }
326
+ function authoredRows(rows, into = /* @__PURE__ */ new Map()) {
327
+ for (let row of rows)
328
+ into.set(row.id, row), row.children && authoredRows(row.children, into);
329
+ return into;
330
+ }
331
+ function fitTableFormats(data, options, resolved, columns, ctx) {
332
+ 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();
333
+ for (let round = 0; round < 8; round++) {
334
+ 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) => {
335
+ value !== 0 && map.set(id, [...map.get(id) ?? [], Math.abs(value)]);
336
+ };
337
+ for (let column of columns(table)) {
338
+ if (column.width === void 0 || column.kind !== "value" && column.kind !== "computed") continue;
339
+ let room = column.width - 2 * ctx.padX, authoredColumn = authoredColumns.get(column.id);
340
+ for (let row of table.rows) {
341
+ if (row.role === "section") continue;
342
+ let parent = row.inline === !0 && row.parentId !== void 0 ? resolvedById.get(row.parentId) : void 0;
343
+ if (row.inline === !0 && (parent === void 0 || ctx.lineFont === void 0)) continue;
344
+ let cell = row.cells[column.id];
345
+ if (cell === void 0 || cell.state !== "value" || typeof cell.raw != "number") continue;
346
+ 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;
347
+ if (cell.format !== void 0) {
348
+ overflows && cellOverflow.push({ rowId: row.id, columnId: column.id, format: cell.format, max: Math.abs(cell.raw) });
349
+ continue;
350
+ }
351
+ figure(rowFigures, row.id, cell.raw), figure(columnFigures, column.id, cell.raw);
352
+ 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);
353
+ rowFormatted && fits && rowPrinting.add(row.id), overflows && (rowFormatted ? fits : authoredColumn?.fitFormat !== !1) && (rowFormatted ? rowOverflow.add(row.id) : columnOverflow.add(column.id));
354
+ }
355
+ }
356
+ let rowFormattedColumn = (columnId) => authoredColumns.get(columnId)?.format !== void 0 ? !1 : table.rows.some((row) => {
357
+ let authored = rowsById.get(row.id);
358
+ return authored?.format !== void 0 && authored.calc === void 0 && row.inline !== !0 && typeof row.cells[columnId]?.raw == "number";
359
+ }), rowFormats = /* @__PURE__ */ new Map();
360
+ for (let rowId of rowOverflow) {
361
+ if (exhausted.has(`row:${rowId}`)) continue;
362
+ 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) ?? []);
363
+ if (next === void 0) {
364
+ exhausted.add(`row:${rowId}`);
365
+ continue;
366
+ }
367
+ let before = unitOfSpec(spec), after = unitOfSpec(next);
368
+ rowFormats.set(rowId, {
369
+ format: exampleOf(next),
370
+ // The label names the unit the cells now read in.
371
+ ...row.unitAffix !== void 0 && before !== null && after !== null && row.unitAffix === before && before !== after ? { unitAffix: after } : {}
372
+ });
373
+ }
374
+ 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();
375
+ for (let [rowId, next] of rowFormats) {
376
+ let row = resolvedById.get(rowId);
377
+ if (row === void 0) continue;
378
+ let spec = parseFormatExample(next.format), key = unitOf(row, spec);
379
+ caps.set(key, Math.min(caps.get(key) ?? 1 / 0, spec.decimals));
380
+ }
381
+ for (let rowId of rowPrinting) {
382
+ if (exhausted.has(`row:${rowId}`)) continue;
383
+ let row = resolvedById.get(rowId), shortened = rowFormats.get(rowId), example = shortened?.format ?? rowExample(rowsById.get(rowId), decimal);
384
+ if (row === void 0 || example === void 0) continue;
385
+ let spec = parseFormatExample(example), cap = caps.get(unitOf(row, spec));
386
+ if (cap === void 0 || spec.decimals <= cap || cap === 3 && spec.thousandsSep === "") continue;
387
+ let decimals = floorDecimals(rowFigures.get(rowId) ?? [], spec, spec.magnitude, cap);
388
+ decimals >= spec.decimals || rowFormats.set(rowId, { ...shortened, format: exampleOf({ ...spec, decimals }) });
389
+ }
390
+ let columnFormats = /* @__PURE__ */ new Map();
391
+ for (let columnId of columnOverflow) {
392
+ if (exhausted.has(`col:${columnId}`)) continue;
393
+ if (rowFormattedColumn(columnId)) {
394
+ exhausted.add(`col:${columnId}`);
395
+ continue;
396
+ }
397
+ 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) ?? []);
398
+ if (next === void 0) {
399
+ exhausted.add(`col:${columnId}`);
400
+ continue;
401
+ }
402
+ columnFormats.set(columnId, exampleOf(next));
403
+ }
404
+ let cellFormats = /* @__PURE__ */ new Map();
405
+ for (let { rowId, columnId, format, max } of cellOverflow) {
406
+ let key = tableCellNodeId("cell", rowId, columnId);
407
+ if (exhausted.has(key)) continue;
408
+ let next = shorterSpec(parseFormatExample(format), [max]);
409
+ if (next === void 0) {
410
+ exhausted.add(key);
411
+ continue;
412
+ }
413
+ cellFormats.set(rowId, (cellFormats.get(rowId) ?? /* @__PURE__ */ new Map()).set(columnId, exampleOf(next)));
414
+ }
415
+ if (rowFormats.size === 0 && columnFormats.size === 0 && cellFormats.size === 0) break;
416
+ for (let rowId of rowFormats.keys()) fittedRows.add(rowId);
417
+ for (let columnId of columnFormats.keys()) fittedColumns.add(columnId);
418
+ for (let [rowId, formats] of cellFormats) for (let columnId of formats.keys()) fittedCells.add(`${rowId}\0${columnId}`);
419
+ let rows = rowFormats.size === 0 ? current.rows : withRowFormats(current.rows, rowFormats);
420
+ current = {
421
+ ...current,
422
+ columns: current.columns.map((column) => columnFormats.has(column.id) ? { ...column, format: columnFormats.get(column.id) } : column),
423
+ rows: cellFormats.size === 0 ? rows : withCellFormats(rows, cellFormats)
424
+ }, fitted = resolveTable(current, unlifted, data), result = fitted;
425
+ }
426
+ if (fitted === void 0) return;
427
+ {
428
+ 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();
429
+ for (let [id, authored] of rowsById) {
430
+ let row = resolvedById.get(id), example = rowExample(authored, decimal);
431
+ if (row === void 0 || example === void 0 || authored.calc !== void 0 || authored.fitFormat === !1) continue;
432
+ let spec = parseFormatExample(example), key = familyKey(row, spec);
433
+ families.set(key, [...families.get(key) ?? [], { id, spec }]);
434
+ }
435
+ let unified = /* @__PURE__ */ new Map();
436
+ for (let members of families.values()) {
437
+ if (!members.some((member) => fittedRows.has(member.id))) continue;
438
+ let least = minOf(members.map((member) => member.spec.decimals));
439
+ for (let member of members) {
440
+ if (member.spec.decimals <= least || least === 3 && member.spec.thousandsSep === "") continue;
441
+ 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);
442
+ decimals < member.spec.decimals && unified.set(member.id, { format: exampleOf({ ...member.spec, decimals }) });
443
+ }
444
+ }
445
+ if (unified.size > 0) {
446
+ for (let id of unified.keys()) fittedRows.add(id);
447
+ current = { ...current, rows: withRowFormats(current.rows, unified) }, fitted = resolveTable(current, unlifted, data), result = fitted;
448
+ }
449
+ }
450
+ let lifts = zeroFigureFormats(current, fitted.table, fittedRows, fittedColumns, fittedCells, decimal, options, data);
451
+ 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) };
452
+ }
453
+ function formatsFittedWarning(changes) {
454
+ if (changes.length === 0) return;
455
+ 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("; ");
456
+ return {
457
+ code: "table-formats-fitted",
458
+ severity: "info",
459
+ message: `fitFormats shortened ${changes.length} format${changes.length === 1 ? "" : "s"} to fit authored widths: ${listed}${changes.length > 6 ? `; and ${changes.length - 6} more` : ""}`,
460
+ detail: { changes },
461
+ suggest: "Widen the column, or set fitFormat: false on the row or column to keep its format as authored."
462
+ };
463
+ }
464
+ function formatChanges(before, after, decimal) {
465
+ let changes = [], rowsBefore = authoredRows(before.rows), rowsAfter = authoredRows(after.rows);
466
+ for (let [id, row] of rowsAfter) {
467
+ let from = rowExample(rowsBefore.get(id), decimal), to = rowExample(row, decimal);
468
+ from !== to && to !== void 0 && changes.push({ row: id, ...from === void 0 ? {} : { from }, to });
469
+ }
470
+ let columnsBefore = new Map(before.columns.map((column) => [column.id, column]));
471
+ for (let column of after.columns) {
472
+ let from = columnsBefore.get(column.id)?.format, to = column.format;
473
+ from !== to && to !== void 0 && changes.push({ column: column.id, ...from === void 0 ? {} : { from }, to });
474
+ }
475
+ for (let [id, row] of rowsAfter)
476
+ for (let [columnId, cell] of Object.entries(row.cells ?? {})) {
477
+ 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;
478
+ to !== void 0 && from !== to && changes.push({ row: id, column: columnId, ...from === void 0 ? {} : { from }, to });
479
+ }
480
+ return changes;
481
+ }
482
+ function zeroFigureFormats(data, table, fittedRows, fittedColumns, fittedCells, decimal, options, source) {
483
+ let lifts = /* @__PURE__ */ new Map();
484
+ if (fittedRows.size === 0 && fittedColumns.size === 0 && fittedCells.size === 0) return lifts;
485
+ let rowsById = authoredRows(data.rows), sourceRows = authoredRows(source.rows), automatic = options.format === void 0 && options.unit === void 0 && options.magnitude !== "million" && options.magnitude !== "thousand";
486
+ for (let column of data.columns) {
487
+ if (column.kind !== "value") continue;
488
+ let columnFormat = column.format, automaticColumn = automatic && source.columns.find((entry) => entry.id === column.id)?.format === void 0;
489
+ for (let row of table.rows) {
490
+ 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;
491
+ if (raw === void 0 || raw === 0 || authoredRow.calc !== void 0) continue;
492
+ 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);
493
+ if (example === void 0) continue;
494
+ let sourceRow = sourceRows.get(row.id);
495
+ if (ownFitted === void 0 && (rowFormatted ? automatic && (sourceRow?.format === void 0 || sourceRow[AUTOMATIC_FORMAT] === !0) : automaticColumn)) continue;
496
+ let spec = parseFormatExample(example), scaled = raw / MAGNITUDE_DIVISOR[spec.magnitude];
497
+ if (roundsToZero(scaled, spec.decimals)) {
498
+ if (ownFitted !== void 0 || row.inline === !0) {
499
+ if (options[ZERO_LIFT] !== void 0) continue;
500
+ zeroLifts.count++;
501
+ }
502
+ lifts.set(row.id, (lifts.get(row.id) ?? /* @__PURE__ */ new Map()).set(column.id, exampleOf({ ...spec, decimals: nonzeroDecimals(scaled, spec.decimals) })));
503
+ }
504
+ }
505
+ }
506
+ return lifts;
507
+ }
508
+
509
+ // src/core/charts/table/layout.ts
510
+ 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;
511
+ function cellRole(kind, text) {
512
+ return cellHoldsNumber(kind, text) ? {} : { role: "category" };
513
+ }
514
+ 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;
515
+ function cutCount(geometry) {
516
+ return geometry.scene.filter((node) => node.t === "text" && node.id.startsWith("cell:") && node.title !== void 0).length;
517
+ }
518
+ function layoutTable(authoredData, options = {}, resolved = resolveTable(authoredData, options)) {
519
+ return liftOrFallback(
520
+ (mode) => {
521
+ if (mode === "full") return layoutTableLadder(authoredData, options, resolved);
522
+ let step = { ...options, [ZERO_LIFT]: mode };
523
+ return layoutTableLadder(authoredData, step, resolveTable(authoredData, step));
524
+ },
525
+ (lifted, plain) => costsWidth(lifted, plain, options),
526
+ resolved.lifted,
527
+ (bound, plain) => missesFrame(bound, options) && !missesFrame(plain, options)
528
+ );
529
+ }
530
+ function missesFrame(geometry, options) {
531
+ let open = options[TARGET_SIZE]?.fixed;
532
+ 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);
533
+ }
534
+ function costsWidth(lifted, plain, options) {
535
+ let misses = (geometry) => missesFrame(geometry, options);
536
+ if (misses(plain)) return !1;
537
+ if (misses(lifted) || cutCount(lifted) > cutCount(plain)) return !0;
538
+ 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));
539
+ return lifted.warnings.some((warning) => stepped.has(warning.code) && !before.has(warning.code));
540
+ }
541
+ function themeGroupPad(theme) {
542
+ let pad = theme.table?.groupPad;
543
+ return pad?.top === void 0 && pad?.bottom === void 0 ? void 0 : { top: pad?.top ?? GROUP_PAD_TOP, bottom: pad?.bottom ?? GROUP_PAD_BOTTOM };
544
+ }
545
+ var groupAirAboveLeast = (pad, ruleSpace) => pad.top + ruleSpace + pad.bottom > 9;
546
+ function hasHeadAir(options) {
547
+ let theme = chartTheme(options), group = themeGroupPad(theme);
548
+ 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")));
549
+ }
550
+ function layoutTableLadder(authoredData, options, resolved) {
551
+ 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) => {
552
+ let compact = drawn.sizing === void 0 ? void 0 : compactTable(authoredData, options, full, margin, Math.min(pad, 3), 2, resolved, !0, formatFits);
553
+ return compact?.sizing && !compact.refused && (drawn.sizing = {
554
+ ...drawn.sizing,
555
+ minWidth: Math.min(drawn.sizing.minWidth, compact.sizing.minWidth),
556
+ minHeight: fixedHeight ? Math.min(drawn.sizing.minHeight, compact.sizing.minHeight) : drawn.sizing.minHeight
557
+ }), withWidthRepair(drawn);
558
+ };
559
+ if (options.belowMinimum === "refuse" || !full.sizing) return full;
560
+ if (fits(full)) {
561
+ fullSizingOnly && (full = layoutTableOnce(authoredData, base, resolved, !1, formatFits));
562
+ 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;
563
+ return open?.width === !1 ? drawn : withFloor(drawn);
564
+ }
565
+ if (widthFits(full) && fixedHeight && hasHeadAir(options)) {
566
+ let lean = once({ ...base, [HEAD_AIR_MIN]: !0 });
567
+ if (lean.sizing !== void 0 && fits(lean))
568
+ 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;
569
+ }
570
+ if (widthFits(full)) return withWidthRepair(compactTable(authoredData, options, full, margin, Math.min(pad, 6), void 0, resolved, sizingOnly, formatFits));
571
+ 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 });
572
+ if (narrowest.sizing !== void 0 && !widthFits(narrowest)) return withWidthRepair(compactTable(authoredData, options, full, margin, Math.min(pad, 3), 2, resolved, sizingOnly, formatFits));
573
+ let last = full, tried = new Set(gutterHelps ? [] : [`${pad}`]);
574
+ for (let step of [{ pad }, { pad: Math.min(pad, 6) }, { pad: Math.min(pad, 3) }, { pad: Math.min(pad, 3), heads: 2 }]) {
575
+ let key = `${step.pad}${step.heads === void 0 ? "" : `:${step.heads}`}`;
576
+ if (!tried.has(key) && (tried.add(key), last = step.heads === void 0 ? rung(step) : narrowest, last.sizing === void 0 || widthFits(last) && heightFits(last)))
577
+ 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;
578
+ }
579
+ return withWidthRepair(compactTable(authoredData, options, full, margin, Math.min(pad, 3), 2, resolved, sizingOnly, formatFits));
580
+ }
581
+ function layoutTableCard(data, options = {}) {
582
+ return memoLayout(data, options, () => cardHeightFloor(layoutTableCard, data, options, classFloor(layoutTable, data, options, layoutTable(data, options))));
583
+ }
584
+ var layouts = /* @__PURE__ */ new WeakMap(), functionIds = /* @__PURE__ */ new WeakMap(), nextFunctionId = 0;
585
+ function memoLayout(data, options, layout) {
586
+ if (typeof options.theme == "string") return layout();
587
+ let key = layoutKey(data, options), byKey = layouts.get(data);
588
+ return (!byKey || byKey.size >= 32) && layouts.set(data, byKey = /* @__PURE__ */ new Map()), byKey.has(key) || byKey.set(key, layout()), deepCopy(byKey.get(key));
589
+ }
590
+ function layoutKey(data, options) {
591
+ let symbols = Object.getOwnPropertySymbols(options).map((symbol) => [symbol.description, options[symbol]]);
592
+ return JSON.stringify([data, options, symbols, currentSmallValues()], (_key, value) => typeof value != "function" ? value : (functionIds.has(value) || functionIds.set(value, nextFunctionId++), `function ${functionIds.get(value)}`));
593
+ }
594
+ function deepCopy(value, copies = /* @__PURE__ */ new Map()) {
595
+ if (value === null || typeof value != "object") return value;
596
+ if (copies.has(value)) return copies.get(value);
597
+ if (Array.isArray(value)) {
598
+ let copy2 = [];
599
+ copies.set(value, copy2);
600
+ for (let entry of value) copy2.push(deepCopy(entry, copies));
601
+ return copy2;
602
+ }
603
+ if (value instanceof Map) {
604
+ let copy2 = /* @__PURE__ */ new Map();
605
+ copies.set(value, copy2);
606
+ for (let [key, entry] of value) copy2.set(key, deepCopy(entry, copies));
607
+ return copy2;
608
+ }
609
+ if (value instanceof Set) {
610
+ let copy2 = /* @__PURE__ */ new Set();
611
+ copies.set(value, copy2);
612
+ for (let entry of value) copy2.add(deepCopy(entry, copies));
613
+ return copy2;
614
+ }
615
+ if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) return value;
616
+ let copy = footerPlans.has(value) ? copyFrame(value) : {};
617
+ copies.set(value, copy);
618
+ for (let key of Reflect.ownKeys(value)) copy[key] = deepCopy(value[key], copies);
619
+ return copy;
620
+ }
621
+ function classFloor(layout, data, options, geometry) {
622
+ if (geometry.refused || !geometry.sizing || panelTypeClass(options) !== void 0) return geometry;
623
+ let sizing = geometry.sizing;
624
+ if (sizing.minWidth >= geometry.size.width || typeWidthClass(sizing.minWidth) === typeWidthClass(geometry.size.width)) return geometry;
625
+ let height = Math.max(geometry.size.height, sizing.minHeight), byKey = classFloors.get(data);
626
+ (!byKey || byKey.size >= 32) && classFloors.set(data, byKey = /* @__PURE__ */ new Map());
627
+ let key = layoutKey(data, { ...options, size: [sizing.minWidth, typeWidthClass(geometry.size.width), height] }), floor = byKey.get(key);
628
+ if (floor === void 0) {
629
+ floor = sizing.minWidth;
630
+ for (let pass = 0; pass < 3 && typeWidthClass(floor) !== typeWidthClass(geometry.size.width); pass++) {
631
+ let probe = layout(data, { ...options, size: { width: floor, height }, [SIZING_ONLY]: !0, [REGULAR_SPACING]: !0 });
632
+ if (probe.refused || !probe.sizing || probe.sizing.minWidth >= floor) break;
633
+ floor = probe.sizing.minWidth;
634
+ }
635
+ byKey.set(key, floor);
636
+ }
637
+ return floor !== sizing.minWidth && (geometry.sizing = { ...sizing, minWidth: floor }), geometry;
638
+ }
639
+ var classFloors = /* @__PURE__ */ new WeakMap(), cardHeights = /* @__PURE__ */ new WeakMap();
640
+ function cardHeightFloor(layout, data, options, geometry) {
641
+ let width = geometry.size.width;
642
+ if (!(options[TARGET_SIZE]?.fixed?.height === !1) || geometry.refused || !geometry.sizing || width >= CARD_CLASS_WIDTH || panelTypeClass(options) !== void 0) return geometry;
643
+ let step = width < 400 ? 400 : CARD_CLASS_WIDTH, byKey = cardHeights.get(data);
644
+ (!byKey || byKey.size >= 32) && cardHeights.set(data, byKey = /* @__PURE__ */ new Map());
645
+ let key = layoutKey(data, { ...options, size: step });
646
+ if (!byKey.has(key)) {
647
+ let wider = layout(data, { ...options, size: { width: step } });
648
+ byKey.set(key, wider.refused || !wider.sizing ? void 0 : wider.sizing.naturalHeight);
649
+ }
650
+ let floor = byKey.get(key);
651
+ return floor !== void 0 && floor > geometry.sizing.naturalHeight && (geometry.sizing = { ...geometry.sizing, naturalHeight: floor }), geometry;
652
+ }
653
+ function compactTable(authoredData, options, full, margin, cellPadX2, heads, resolved, sizingOnly, formatFits) {
654
+ let compactOptions = {
655
+ ...options,
656
+ density: isCohortDensity(options.density ?? "regular") ? options.density : "compact",
657
+ margin,
658
+ // Tighter than the full table, never wider: a dense table already pads 3 or 5 px.
659
+ cellPadX: cellPadX2,
660
+ labelIndent: { base: 8 + (options.outlineMarks === !0 ? INDENT_BASE : 0), step: 8 },
661
+ // A fixed height never grows (docs/manual.md, "Fixed height"): only an omitted height turns automatic.
662
+ size: heightOmitted(options.size) ? { width: full.size.width } : { width: full.size.width, height: full.size.height },
663
+ [COMPACT_RETRY]: full.size.height,
664
+ ...heads === void 0 ? {} : { [HEAD_LINES]: heads }
665
+ }, 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;
666
+ if (!options[REGULAR_SPACING] && compact.sizing && (missesWidth || missesHeight) && reachable) {
667
+ 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);
668
+ compact = layoutTableOnce(authoredData, lastOptions = {
669
+ ...compactOptions,
670
+ [TIGHT_SPACING]: { columns: missesWidth, rows: missesHeight },
671
+ ...missesWidth ? {
672
+ cellPadX: Math.min(cellPadX2, TIGHT_PAD),
673
+ labelIndent: { base: TIGHT_PAD + (options.outlineMarks === !0 ? INDENT_BASE : 0), step: TIGHT_PAD * 2 }
674
+ } : {},
675
+ margin: {
676
+ ...missesHeight ? { top: TIGHT_PAD * 2, bottom: TIGHT_PAD * 2 } : {},
677
+ ...margin,
678
+ ...missesWidth ? { left: Math.min(margin.left ?? CARD_GUTTER, TIGHT_PAD * 2), right: Math.min(margin.right ?? CARD_GUTTER, TIGHT_PAD * 2) } : {}
679
+ }
680
+ }, resolved, sizingOnly, formatFits), compact.warnings.push(tightWarning);
681
+ }
682
+ if (missesHeight && compact.sizing && compact.size.height + 0.5 < compact.sizing.minHeight && resolved.table.columns.some((col) => col.subLabel !== void 0)) {
683
+ let warnings = compact.warnings;
684
+ compact = layoutTableOnce(authoredData, { ...lastOptions, [SUB_LINES]: 1 }, resolved, sizingOnly, formatFits);
685
+ for (let warning of warnings) warning.code === "table-tight-spacing" && !compact.warnings.includes(warning) && compact.warnings.push(warning);
686
+ }
687
+ 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;
688
+ }
689
+ function layoutTableOnce(authoredData, options, initialResolved, sizingOnly, formatFits) {
690
+ 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(
691
+ chartTheme(options),
692
+ options.palette,
693
+ warnings
694
+ ), 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);
695
+ if (options.fitFormats === !0) {
696
+ let padX = options.cellPadX ?? cellPadX(visibleColumns(resolved.table).length), fitKey = `${options.density ?? "regular"}:${padX}`, fitted = formatFits.get(fitKey);
697
+ if (!formatFits.has(fitKey)) {
698
+ 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));
699
+ fitted = fitTableFormats(data, options, resolved, (table2) => visibleColumns(table2), {
700
+ measure,
701
+ padX,
702
+ cellFont: (cell) => {
703
+ let row = rowById2.get(cell.rowId);
704
+ 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);
705
+ },
706
+ figures: (col, text) => cellDrawsTabular(theme, col.kind, text),
707
+ lineFont: (parent, line, text, tabular) => changeLineFitFont(theme, fitLadder, parent.step, line.polarity !== void 0, text, measure, tabular),
708
+ ...options.locale?.decimal === void 0 ? {} : { decimal: options.locale.decimal }
709
+ }), formatFits.set(fitKey, fitted);
710
+ }
711
+ if (fitted !== void 0) {
712
+ let warningsAfter = warnings.splice(resolved.warnings.length);
713
+ warnings.length = 0, pushAll(warnings, fitted.resolved.warnings), pushAll(warnings, warningsAfter);
714
+ let fittedNote = formatsFittedWarning(fitted.changes);
715
+ fittedNote !== void 0 && warnings.push(fittedNote), data = fitted.data, resolved = fitted.resolved;
716
+ }
717
+ }
718
+ 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 = [];
719
+ for (let col of cols) {
720
+ if (col.band !== !0) continue;
721
+ let previous = bandedColumnRuns[bandedColumnRuns.length - 1];
722
+ 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] });
723
+ }
724
+ let spacerBefore = /* @__PURE__ */ new Map();
725
+ for (let group of table.columnGroups) {
726
+ if (group.spacer === void 0 || group.spacer <= 0) continue;
727
+ let first = cols.find((col) => group.columnIds.includes(col.id));
728
+ first === void 0 || first.id === cols[0]?.id || spacerBefore.set(first.id, tight ? Math.min(group.spacer, TIGHT_PAD * 2) : group.spacer);
729
+ }
730
+ 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") };
731
+ options.figures === !1 && figures && warnings.push({
732
+ code: "figures-need-heat",
733
+ severity: "warn",
734
+ message: "figures: false needs a heat column, and this table draws none, so it prints its figures",
735
+ field: ["options", "figures"],
736
+ suggest: "Remove figures: false, or give a column a heat lane in options.encodings."
737
+ });
738
+ 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);
739
+ keyless && legendOff(warnings, "table", [...heatEntries, ...arrowShapes].map((entry) => entry.label));
740
+ let keyEntries = keyless ? [] : heatEntries, arrowEntries = keyless ? [] : arrowShapes, authored = authoredNotes(options), frameInput = {
741
+ size,
742
+ margin: { ...canvasMargin(theme, size.width), ...options.margin },
743
+ ...frameTextOptions(options),
744
+ // uniform money unit hoisted out of every cell → the frame slot
745
+ // (solveFrame prepends 'in' itself)
746
+ unit: table.unit ?? options.unit,
747
+ // rows/cols, not table.rows/table.columns: this surface is static, so a
748
+ // marker inside a collapsed row or a hidden column is unreachable here
749
+ // and its footnote would point at nothing
750
+ footnotes: [...tableFootnotes(table, rows, cols), ...authored, ...options[ENGINE_NOTES] ?? []],
751
+ // Nothing in a table points at a note: no head or cell carries a
752
+ // mark, so a "1)" before the note is a number the reader cannot follow
753
+ // (the same rule as for the engine's own notes). The author's
754
+ // notes stay notes and print without a number.
755
+ numberedFootnotes: authored,
756
+ unreferencedNotes: authored.map((_, i) => i + 1),
757
+ // A table's notes read in the tertiary ink where the theme names one.
758
+ footnoteInk: "inkMeta",
759
+ // The notes and the source keep the cell air in from both edges, as on React, also at canvas margin 0.
760
+ footerInset: cellPadX2,
761
+ ...keyEntries.length + arrowEntries.length > 0 ? {
762
+ legend: {
763
+ 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"),
764
+ items: [
765
+ ...keyEntries.map((entry) => ({ id: entry.id, label: entry.label, paint: entry.fill, key: "box", stroke: { token: "grid" } })),
766
+ ...arrowEntries.map((entry) => ({ id: entry.id, label: entry.label, paint: { token: "ink" }, key: "glyph", glyph: entry.glyph }))
767
+ ]
768
+ },
769
+ legendFont: "footnote"
770
+ } : {},
771
+ theme,
772
+ measure
773
+ }, 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));
774
+ tightRows && (ladder.pad = () => 1, ladder.totalPad = 1, ladder.rowHeight !== void 0 && (ladder.rowHeight = ladder.lineBox(ladder.label) + 2));
775
+ let { lineBox, pad: levelPad } = ladder, widthPlan = tableWidths(table, theme, measure, options, {
776
+ columns: cols,
777
+ rows,
778
+ widthRows,
779
+ fullRows,
780
+ available: plot.w,
781
+ spacerTotal,
782
+ headLines: options[HEAD_LINES],
783
+ subLines: options[SUB_LINES]
784
+ });
785
+ 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);
786
+ 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";
787
+ function rowHeight(row) {
788
+ if (row.role === "total" && row.kind !== "result" && row.kind !== "driver")
789
+ return ladder.totalPad * 2 + lineBox(fonts.total.size) + 2 * ruleSpace;
790
+ if (row.role === "section") {
791
+ if (tightRows || options[COMPACT_RETRY] !== void 0) return sectionNatural();
792
+ let space = theme.table?.section?.spaceBefore ?? lineBox(ladder.label);
793
+ return sectionNatural() + Math.round(row.id === rows[0]?.id ? Math.min(space, lineBox(ladder.label) / 4) : space);
794
+ }
795
+ let pad = levelPad(row.step, row.hasChildren);
796
+ 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)));
797
+ }
798
+ function sectionNatural() {
799
+ return levelPad(1, !1) * 2 + ladder.sectionBox(fonts.section.size) + sectionRuleSpace;
800
+ }
801
+ function lineHoldsValue(line, colId) {
802
+ let cell = line.cells[colId];
803
+ return cell !== void 0 && cell.state === "value" && cell.displayed !== "";
804
+ }
805
+ let labelColumnId = cols.find((col) => col.kind === "rowLabel")?.id;
806
+ function labelNoteOf(row) {
807
+ if (!(labelColumnId === void 0 || row.role === "section"))
808
+ return row.cells[labelColumnId]?.note;
809
+ }
810
+ let inlineBlocks = /* @__PURE__ */ new Map();
811
+ function inlineBlock(row) {
812
+ let cached = inlineBlocks.get(row);
813
+ if (cached !== void 0) return cached;
814
+ 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();
815
+ for (let col of cols) {
816
+ if (col.noteLine !== !0 || col.kind === "rowLabel" || row.cells[col.id]?.note === void 0) continue;
817
+ let slot = base + lines.length;
818
+ for (let [index, line] of lines.entries())
819
+ if (!lineHoldsValue(line, col.id)) {
820
+ slot = base + index;
821
+ break;
822
+ }
823
+ noteSlots.set(col.id, slot), stacked = Math.max(stacked, slot + 1);
824
+ }
825
+ let block = {
826
+ lines,
827
+ ...note === void 0 ? {} : { note },
828
+ box,
829
+ noteSlots,
830
+ extra: stacked === 0 ? 0 : ladder.inlineGap + stacked * box
831
+ };
832
+ return inlineBlocks.set(row, block), block;
833
+ }
834
+ let inlineFont2 = (level, signed) => inlineFont(theme, ladder, level, signed), sumOf = (map) => [...map.values()].reduce((a, b) => a + b, spacerTotal);
835
+ pushAll(warnings, widthPlan.warnings);
836
+ function sizingProbe(sizing2, marks2) {
837
+ return {
838
+ type: "table",
839
+ size,
840
+ sizing: sizing2,
841
+ plot,
842
+ scene: [],
843
+ labels: [],
844
+ axes: [],
845
+ annotations: [],
846
+ frame: frame.frame,
847
+ marks: marks2,
848
+ derived: { table, computedCells: resolved.computedCells },
849
+ a11y: { title: "", desc: "", counts: [] },
850
+ warnings,
851
+ debug: { occupied: [], decisions: [] }
852
+ };
853
+ }
854
+ if (sizingOnly && options[TARGET_SIZE]?.fixed.height === !1 && !heightOmitted(options.size))
855
+ return sizingProbe(tableSizing(size, plot, plot.y, totalW, minimumW), {
856
+ table: { x: gridX, y: gridY, w: totalW, h: 0 },
857
+ columns: cols.map((col) => ({ id: col.id, x: gridX, w: widths.get(col.id) })),
858
+ rows: [],
859
+ headerBand: { x: gridX, y: gridY, w: totalW, h: 0 }
860
+ });
861
+ 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(
862
+ columnHeaderText(col),
863
+ fonts.header,
864
+ headRoom(col),
865
+ 1 / 0,
866
+ measure,
867
+ { target: options.target, typeRole: "axis" }
868
+ )])), subFits = new Map(cols.flatMap((col) => col.subLabel === void 0 ? [] : [[col.id, fitText(
869
+ col.subLabel,
870
+ fonts.sub,
871
+ headRoom(col),
872
+ !col.label && col.kind === "rowLabel" ? 1 : options[SUB_LINES] ?? 1 / 0,
873
+ measure,
874
+ { target: options.target, typeRole: "axis" }
875
+ )]])), 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;
876
+ for (let col of cols) {
877
+ x += spacerBefore.get(col.id) ?? 0;
878
+ let w = Math.round(widths.get(col.id));
879
+ colX.set(col.id, { x, w }), x += w;
880
+ }
881
+ 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 ?? ""]);
882
+ for (let row of rows) {
883
+ let sectionCol = row.role === "section" ? cols.find((col) => col.kind === "rowLabel") : void 0, sectionCell = sectionCol === void 0 ? void 0 : row.cells[sectionCol.id];
884
+ if (sectionCol !== void 0 && sectionCell?.displayed) {
885
+ 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;
886
+ if (measure(text, font).width > room) {
887
+ let wrap = fitText(text, font, Math.max(room, 20), 2, measure, { target: options.target, typeRole: "label" });
888
+ 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));
889
+ }
890
+ }
891
+ for (let col of cols) {
892
+ let rowLabel = col.kind === "rowLabel" && row.role !== "section";
893
+ if (col.kind !== "text" && !rowLabel) continue;
894
+ let cell = row.cells[col.id];
895
+ if (!cell || !cell.displayed) continue;
896
+ 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(`
897
+ `);
898
+ if (textW <= room - affix && !authoredBreak) continue;
899
+ 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) => {
900
+ let head = Math.max(0, own - slack);
901
+ head > 0 && labelHead.set(row.id, head), head > 0 && rowExtra.set(row.id, Math.max(rowExtra.get(row.id) ?? 0, head));
902
+ };
903
+ if (ownLine && (affixBelow.add(row.id), textW <= maxW)) {
904
+ wrappedLines.set(tableCellKey(row.id, col.id), [cell.displayed]), setHead(affixHead);
905
+ continue;
906
+ }
907
+ 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;
908
+ 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);
909
+ let grow = Math.ceil((wrap.lines.length - 1) * font.size * 1.2);
910
+ rowLabel ? setHead(grow + affixHead) : grow > 0 && rowExtra.set(row.id, Math.max(rowExtra.get(row.id) ?? 0, grow));
911
+ }
912
+ }
913
+ let rowY = /* @__PURE__ */ new Map(), y = gridY + headerH;
914
+ for (let [index, row] of rows.entries()) {
915
+ index > 0 && row.spacer !== void 0 && (y += Math.round(row.spacer));
916
+ let h = rowHeight(row) + (rowExtra.get(row.id) ?? 0);
917
+ rowY.set(row.id, { y, h }), y += h;
918
+ }
919
+ let tableH = y - gridY;
920
+ {
921
+ let callerH = options[COMPACT_RETRY], grow = rowDrivenHeight({
922
+ options: callerH === void 0 || !heightOmitted(options.size) ? options : {},
923
+ width: size.width,
924
+ height: size.height,
925
+ chromeH: size.height - plot.h,
926
+ rowsH: y - plot.y + 4,
927
+ ...callerH === void 0 ? {} : { ceiling: callerH }
928
+ });
929
+ if (grow !== void 0) return layoutTableOnce(authoredData, { ...options, size: { width: size.width, height: grow } }, initialResolved, sizingOnly, formatFits);
930
+ }
931
+ let targetSize = options[TARGET_SIZE];
932
+ if (!sizingOnly && targetSize?.fixed.height === !1 && size.width === targetSize.sizePx.width && size.height === targetSize.sizePx.height) {
933
+ let height = tableSizing(size, plot, y, totalW, 0).naturalHeight;
934
+ if (height !== size.height) {
935
+ let nextSize = { width: size.width, height }, nextOccupied = createOccupiedIndex({ x: 0, y: 0, w: size.width, h: height }), nextFrame = solveFrame({ ...frameInput, size: nextSize }, nextOccupied);
936
+ 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));
937
+ }
938
+ }
939
+ y > plot.y + plot.h && warnings.push({
940
+ code: "table-overflow",
941
+ severity: "error",
942
+ message: `${rows.length} rows exceed the plot height at density '${density}' \u2014 use 'compact', fewer rows, or a taller size`
943
+ });
944
+ let wrapFits = !1;
945
+ if (widthPlan.wouldWrap.length > 0 && size.width - plot.w + sumOf(sizingMinimums) > size.width)
946
+ if (options[VERIFY_ADVICE]) {
947
+ 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) };
948
+ wrapFits = !missesFrame(layoutTable(wrapped, options), options);
949
+ } else
950
+ wrapFits = widthPlan.wrapMinimumWidth === void 0 || widthPlan.wrapMinimumWidth <= plot.w;
951
+ let sizing = {
952
+ ...tableSizing(size, plot, y, totalW, minimumW),
953
+ ...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.` } : {}
954
+ };
955
+ 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 } });
956
+ let numericStats = /* @__PURE__ */ new Map();
957
+ for (let col of cols) {
958
+ if (col.kind !== "value" && col.kind !== "computed") continue;
959
+ let values = [], textReserve = 0;
960
+ for (let row of rows) {
961
+ let cell = row.cells[col.id];
962
+ 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));
963
+ }
964
+ let signed = col.kind === "computed" && !!col.polarity || (col.format ? parseFormatExample(col.format).signed : !1);
965
+ numericStats.set(col.id, {
966
+ min: values.length > 0 ? minOf(values) : 0,
967
+ max: values.length > 0 ? maxOf(values) : 0,
968
+ maxAbs: values.length > 0 ? maxOf(values.map((value) => Math.abs(value))) : 0,
969
+ textReserve,
970
+ signed
971
+ });
972
+ }
973
+ let sparkDomains = sparklineDomains(cols, rows);
974
+ if (hasGroupHeads) {
975
+ let headingFrom = -1 / 0, headingEnd = -1 / 0;
976
+ for (let [groupIndex, g] of table.columnGroups.entries()) {
977
+ if (spans[groupIndex].span === 0 || g.heading === !1) continue;
978
+ 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);
979
+ headingFrom = first.x, headingEnd = centred ? cx + labelW / 2 : startX + labelW, centred ? note === void 0 ? nodes.push({
980
+ t: "text",
981
+ typeRole: "axis",
982
+ id: `group:${g.id}`,
983
+ x: cx,
984
+ y: labelY,
985
+ lines: [label],
986
+ align: "middle",
987
+ font: fonts.group,
988
+ ink: tableInk("head"),
989
+ owner: {},
990
+ part: "tableGroupHeader"
991
+ }) : (nodes.push({
992
+ t: "text",
993
+ typeRole: "axis",
994
+ id: `group:${g.id}`,
995
+ x: startX,
996
+ y: labelY,
997
+ lines: [label],
998
+ align: "start",
999
+ font: fonts.group,
1000
+ ink: tableInk("head"),
1001
+ owner: {},
1002
+ part: "tableGroupHeader"
1003
+ }), nodes.push({
1004
+ t: "text",
1005
+ typeRole: "footnote",
1006
+ id: `group-note:${g.id}`,
1007
+ x: startX + trackedW,
1008
+ y: labelY,
1009
+ lines: [note],
1010
+ align: "start",
1011
+ font: noteFont,
1012
+ ink: tableInk("secondary"),
1013
+ owner: {},
1014
+ part: "tableGroupHeader"
1015
+ })) : (nodes.push({
1016
+ t: "text",
1017
+ typeRole: "axis",
1018
+ id: `group:${g.id}`,
1019
+ x: startX,
1020
+ y: labelY,
1021
+ lines: [label],
1022
+ align: "start",
1023
+ font: fonts.group,
1024
+ ink: tableInk("head"),
1025
+ owner: {},
1026
+ part: "tableGroupHeader"
1027
+ }), note !== void 0 && nodes.push({
1028
+ t: "text",
1029
+ typeRole: "footnote",
1030
+ id: `group-note:${g.id}`,
1031
+ x: startX + trackedW,
1032
+ y: labelY,
1033
+ lines: [note],
1034
+ align: "start",
1035
+ font: noteFont,
1036
+ ink: tableInk("secondary"),
1037
+ owner: {},
1038
+ part: "tableGroupHeader"
1039
+ })), nodes.push({
1040
+ t: "line",
1041
+ id: `group-rule:${g.id}`,
1042
+ x1: spanRule ? spanStart : centred ? Math.round(cx - labelW / 2) : startX,
1043
+ y1: bracketY,
1044
+ // A heading wider than its block runs on, but the rule stops at the block's last column.
1045
+ x2: spanRule ? spanEnd : Math.round(centred ? cx + labelW / 2 : startX + labelW),
1046
+ y2: bracketY,
1047
+ stroke: tableRuleInk(),
1048
+ width: rowRuleWidth,
1049
+ owner: {},
1050
+ part: "tableGroupRule"
1051
+ });
1052
+ }
1053
+ }
1054
+ let headerRuleY = gridY + headerH - 1 + CRISP, headerSubY = headerRuleY - headPadBottom - headerSubH - fonts.header.size * 1.2 + fonts.header.size * 1.2;
1055
+ for (let col of cols) {
1056
+ if (!col.label && col.kind === "rowLabel") continue;
1057
+ 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);
1058
+ nodes.push({
1059
+ t: "text",
1060
+ typeRole: "axis",
1061
+ id: `header:${col.id}`,
1062
+ x: tx,
1063
+ y: headerSubY - headerFits.get(col.id).h,
1064
+ lines: headerFits.get(col.id).lines,
1065
+ ...headerFits.get(col.id).title ? { title: label } : {},
1066
+ align,
1067
+ font: fonts.header,
1068
+ ink: tableInk("head"),
1069
+ owner: { colId: col.id },
1070
+ part: "tableHeader"
1071
+ }), col.subLabel !== void 0 && nodes.push({
1072
+ t: "text",
1073
+ typeRole: "axis",
1074
+ id: `header-sub:${col.id}`,
1075
+ x: tx,
1076
+ y: headerSubY,
1077
+ lines: subFits.get(col.id).lines,
1078
+ ...subFits.get(col.id).title ? { title: col.subLabel } : {},
1079
+ align,
1080
+ font: fonts.sub,
1081
+ ink: tableInk("subLabel"),
1082
+ owner: { colId: col.id },
1083
+ part: "tableHeaderSub"
1084
+ });
1085
+ }
1086
+ nodes.push({
1087
+ t: "line",
1088
+ id: "rule:header",
1089
+ x1: rowX,
1090
+ y1: headerRuleY,
1091
+ x2: rowX + rowW,
1092
+ y2: headerRuleY,
1093
+ // `table.headRule: 'ink'` closes the head on the text ink.
1094
+ stroke: { token: theme.table?.headRule === "ink" ? "ink" : "rule" },
1095
+ width: theme.table?.ruleWidths?.head ?? strokeToken(theme, "hair"),
1096
+ owner: {},
1097
+ part: "tableHeaderRule"
1098
+ });
1099
+ let bodyBottom = rowY.size > 0 ? maxOf([...rowY.values()].map((r) => r.y + r.h)) : gridY + headerH, spacerGaps = [];
1100
+ rows.forEach((row, index) => {
1101
+ if (index === 0 || row.spacer === void 0) return;
1102
+ let previous = rowY.get(rows[index - 1].id);
1103
+ spacerGaps.push({ from: previous.y + previous.h, to: rowY.get(row.id).y });
1104
+ });
1105
+ let blockDivider = (id, columnId, fromY = gridY) => {
1106
+ let edge = colX.get(columnId)?.x;
1107
+ edge === void 0 || edge <= gridX || dividerAt(id, Math.round(edge) + CRISP, fromY);
1108
+ };
1109
+ function dividerAt(id, x2, fromY) {
1110
+ if (nodes.some((node) => node.t === "line" && node.x1 === x2 && node.part === "tableGroupDivider")) return;
1111
+ let segments = [], start = fromY;
1112
+ for (let gap of spacerGaps)
1113
+ gap.from <= start || (segments.push([start, Math.round(gap.from) + CRISP]), start = Math.round(gap.to));
1114
+ segments.push([start, Math.round(bodyBottom) + CRISP]), segments.forEach(([y1, y2], index) => nodes.push({
1115
+ t: "line",
1116
+ id: index === 0 ? id : `${id}:${index}`,
1117
+ x1: x2,
1118
+ y1,
1119
+ x2,
1120
+ y2,
1121
+ stroke: tableRuleInk(),
1122
+ width: rowRuleWidth,
1123
+ owner: {},
1124
+ part: "tableGroupDivider"
1125
+ }));
1126
+ }
1127
+ if (hasGroups)
1128
+ for (let [groupIndex, g] of table.columnGroups.entries()) {
1129
+ if (groupIndex === 0 || spans[groupIndex].span === 0 || g.spacer !== void 0 && g.spacer > 0) continue;
1130
+ let firstVisible = g.columnIds.find((columnId) => colX.has(columnId));
1131
+ firstVisible !== void 0 && blockDivider(`rule:group-divider:${g.id}`, firstVisible);
1132
+ }
1133
+ for (let run of bandedColumnRuns)
1134
+ blockDivider(`rule:band-divider:${run.columnIds[0]}`, run.columnIds[0], gridY + headerGroupH);
1135
+ let closeBlock = (id, lastId, fromY) => {
1136
+ let index = cols.findIndex((col) => col.id === lastId), next = cols[index + 1];
1137
+ if (next !== void 0) {
1138
+ let nextGroup = table.columnGroups.find((group) => group.columnIds.includes(next.id));
1139
+ nextGroup !== void 0 && (nextGroup.spacer ?? 0) > 0 && nextGroup.columnIds.find((columnId) => colX.has(columnId)) === next.id || blockDivider(id, next.id, fromY);
1140
+ return;
1141
+ }
1142
+ if (options.rowExtent !== "frame") return;
1143
+ let last = colX.get(lastId);
1144
+ dividerAt(id, Math.round(last.x + last.w) - 1 + CRISP, fromY);
1145
+ };
1146
+ for (let group of table.columnGroups) {
1147
+ if (group.band !== !0) continue;
1148
+ let visible = group.columnIds.filter((columnId) => colX.has(columnId));
1149
+ visible.length > 0 && closeBlock(`rule:band-close:${group.id}`, visible[visible.length - 1], gridY);
1150
+ }
1151
+ for (let run of bandedColumnRuns)
1152
+ closeBlock(`rule:band-close:${run.columnIds[run.columnIds.length - 1]}`, run.columnIds[run.columnIds.length - 1], gridY + headerGroupH);
1153
+ let bandPaint = semanticPalettePaint(theme, options.palette, "neutral", 1 - surface.bandTint), totalGroundPaint = semanticPalettePaint(
1154
+ theme,
1155
+ options.palette,
1156
+ "neutral",
1157
+ 1 - Math.min(1, surface.bandTint * 2)
1158
+ ), strongColumnBandPaint = {
1159
+ token: "neutral",
1160
+ theme: { kind: "mix", from: { token: "ink" }, to: totalGroundPaint, weight: surface.bandTint }
1161
+ }, grounds = rowGrounds(table), columnBandFills = /* @__PURE__ */ new Map(), rowWashes = /* @__PURE__ */ new Map(), bandedGroups = table.columnGroups.filter((g) => g.band === !0), bandRect = (g) => {
1162
+ let visible = g.columnIds.filter((columnId) => colX.has(columnId));
1163
+ if (visible.length === 0) return;
1164
+ let first = colX.get(visible[0]), last = colX.get(visible[visible.length - 1]);
1165
+ return { x: first.x, w: last.x + last.w - first.x };
1166
+ }, 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) => {
1167
+ let top = row;
1168
+ for (; top.parentId !== void 0 && rowById.has(top.parentId); ) top = rowById.get(top.parentId);
1169
+ return top;
1170
+ }, 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];
1171
+ rows.forEach((row, ri) => {
1172
+ 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;
1173
+ 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"));
1174
+ let customGround = authoredGround(row, isTotal);
1175
+ 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)) {
1176
+ let part = isTotal ? "tableTotalGround" : ground === "emphasis" ? "tableGroupGround" : "tableGroupBand";
1177
+ nodes.push({
1178
+ t: "rect",
1179
+ id: `${isTotal ? "totalground" : ground === "emphasis" ? "groupground" : "groupband"}:${row.id}`,
1180
+ rect: blockRuled.has(row.id) ? { x: rowX, y: ry + 1, w: rowW, h: rh - 1 } : { x: rowX, y: ry, w: rowW, h: rh },
1181
+ fill: isTotal ? totalGroundPaint : bandPaint,
1182
+ owner: { rowId: row.id },
1183
+ part
1184
+ });
1185
+ }
1186
+ for (let g of [...bandedGroups, ...bandedColumnRuns]) {
1187
+ let band = bandRect(g);
1188
+ if (band !== void 0) {
1189
+ for (let id of g.columnIds) columnBandFills.set(`${row.id}\0${id}`, ground === "emphasis" ? strongColumnBandPaint : totalGroundPaint);
1190
+ nodes.push({
1191
+ t: "rect",
1192
+ id: `columnband:${"id" in g ? g.id : g.columnIds[0]}:${row.id}`,
1193
+ rect: { x: band.x, y: ry, w: band.w, h: rh },
1194
+ fill: ground === "emphasis" ? strongColumnBandPaint : totalGroundPaint,
1195
+ owner: { rowId: row.id },
1196
+ part: "tableColumnBand"
1197
+ });
1198
+ }
1199
+ }
1200
+ let rowWash;
1201
+ if (options.anchorWash && row.step === 0 && row.hasChildren && row.defaultExpanded && (rowWash = semanticPalettePaint(theme, options.palette, "neutral", surface.anchorTint), nodes.push({
1202
+ t: "rect",
1203
+ id: `anchorwash:${row.id}`,
1204
+ rect: { x: rowX, y: ry, w: rowW, h: rh },
1205
+ fill: rowWash,
1206
+ owner: { rowId: row.id },
1207
+ part: "tableAnchorTint"
1208
+ })), row.highlightTone) {
1209
+ let tone = row.highlightTone, edgePaint = tone === "highlight" ? semanticPalettePaint(theme, options.palette, "focus") : { token: tone };
1210
+ rowWash = tone === "highlight" ? semanticPalettePaint(theme, options.palette, "focus", surface.rowTint) : { ...markRolePaint(tone, !0), tint: surface.rowTint }, nodes.push({
1211
+ t: "rect",
1212
+ id: `rowtint:${row.id}`,
1213
+ rect: { x: rowX, y: ry, w: rowW, h: rh },
1214
+ fill: rowWash,
1215
+ owner: { rowId: row.id },
1216
+ part: "tableRowTint"
1217
+ }), nodes.push({
1218
+ t: "rect",
1219
+ id: `rowedge:${row.id}`,
1220
+ rect: { x: rowX, y: ry, w: 3, h: rh },
1221
+ fill: edgePaint,
1222
+ owner: { rowId: row.id },
1223
+ part: "tableRowEdge"
1224
+ });
1225
+ }
1226
+ rowWash !== void 0 && rowWashes.set(row.id, rowWash);
1227
+ for (let col of cols) {
1228
+ let cell = row.cells[col.id];
1229
+ if (!cell) continue;
1230
+ let { x: cx, w } = colX.get(col.id);
1231
+ if (col.kind === "encoding") {
1232
+ pushAll(
1233
+ nodes,
1234
+ encodingSparklineNodes(col, row, { x: cx, y: ry, w, h: rh }, theme, options.palette, measure, sparkDomains.get(col.id), options.locale?.language)
1235
+ );
1236
+ continue;
1237
+ }
1238
+ if ((isSection || row.kind === "member" && expandedIds.has(row.id)) && col.kind !== "rowLabel") continue;
1239
+ let drop = isSection ? Math.max(0, rh - sectionNatural() - (rowExtra.get(row.id) ?? 0)) : 0;
1240
+ emitCell(cell, row, col.id, cx, w, ry + drop, rh - drop, isTotal, isSection);
1241
+ }
1242
+ let isLast = row.id === lastRow?.id, next = rows[ri + 1], spacedNext = next?.spacer !== void 0;
1243
+ if (closers.has(row.id)) {
1244
+ let finalRule = theme.table?.finalRule ?? "double";
1245
+ 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"));
1246
+ } else if (next?.kind !== "result") {
1247
+ if (spacedNext && next.role === "total")
1248
+ 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"));
1249
+ else if (!(spacedNext && !isTotal))
1250
+ if (isTotal && next)
1251
+ nodes.push(rule(`rule:total:${row.id}`, ry + rh, { token: "rule" }, strokeToken(theme, "rule"), "tableTotalRule"));
1252
+ else if (isLast) {
1253
+ let close = isTotal ? "rule" : theme.table?.closeRule ?? "rule";
1254
+ close !== "none" && nodes.push(rule("rule:close", ry + rh, close === "grid" ? tableRuleInk() : { token: close }, close === "grid" ? rowRuleWidth : strokeToken(theme, "rule"), "tableCloseRule"));
1255
+ } 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")));
1256
+ }
1257
+ let ruleRefused = isLast && theme.table?.closeRule === "none" || next?.kind === "result" && theme.table?.resultRule === "none";
1258
+ if (isSection && heavySectionRule && !ruleRefused) {
1259
+ let atY = Math.round(ry + rh) + ruleSpace - sectionRuleSpace / 2;
1260
+ 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" });
1261
+ }
1262
+ });
1263
+ function rule(id, atY, stroke, width, part) {
1264
+ let yCrisp = Math.round(atY) + CRISP;
1265
+ return { t: "line", id, x1: rowX, y1: yCrisp, x2: rowX + rowW, y2: yCrisp, stroke, width, owner: {}, part };
1266
+ }
1267
+ function usesTotalFace(kind) {
1268
+ return kind === void 0 ? !0 : kind === "subtotal" || kind === "result" || kind === "driver" ? !1 : kind !== "member" && kind !== "measure" || theme.table?.weights?.figures?.[kind] === void 0;
1269
+ }
1270
+ function affixRoom(row, font) {
1271
+ 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);
1272
+ }
1273
+ function noteStatusCut(col, row, shown, full) {
1274
+ let cuts = statusCuts.get(col.id);
1275
+ cuts || statusCuts.set(col.id, cuts = /* @__PURE__ */ new Map());
1276
+ let key = `${shown}\0${full}`, cut = cuts.get(key) ?? { shown, full, rows: [] };
1277
+ cuts.set(key, cut), shown === "" && !cut.rows.includes(row.label) && cut.rows.push(row.label);
1278
+ }
1279
+ function emitStatusMark(cell, row, col, cx, w, ry, rh) {
1280
+ let owner = { rowId: row.id, colId: col.id }, square = statusSquare(fonts.body.size), side = Math.min(square.side, Math.max(0, w - 2));
1281
+ nodes.push({
1282
+ t: "rect",
1283
+ id: tableCellNodeId("chip", row.id, col.id),
1284
+ rect: { x: Math.round(cx + (w - side) / 2), y: Math.round(ry + (rh - side) / 2), w: side, h: side },
1285
+ fill: statusSquarePaint(cell.tone),
1286
+ owner,
1287
+ part: "tableChip",
1288
+ title: cell.displayed,
1289
+ display: { state: cell.displayed }
1290
+ }), noteStatusCut(col, row, "", cell.displayed);
1291
+ }
1292
+ function statusFit(col, label, font, room, trackRoom) {
1293
+ let key = `${col.id}\0${room}\0${trackRoom}`, fits = statusFits.get(key);
1294
+ if (fits === void 0) {
1295
+ let labels = [...new Set(widthRows.flatMap((row) => {
1296
+ let cell = row.cells[col.id];
1297
+ return cell?.kind === "status" && cell.state === "value" ? [cell.displayed] : [];
1298
+ }))];
1299
+ fits = new Map(labels.map((text) => {
1300
+ 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 };
1301
+ return [text, cut && cut.text !== text && cut.text.slice(text.startsWith("\u2026") ? 1 : 0).startsWith("\u2026") ? null : cut];
1302
+ }));
1303
+ let keeper = /* @__PURE__ */ new Map();
1304
+ for (let [text, fit2] of fits) {
1305
+ let kept = fit2?.title === void 0 ? void 0 : keeper.get(fit2.text);
1306
+ fit2?.title !== void 0 && (kept === void 0 || text.length < kept.length) && keeper.set(fit2.text, text);
1307
+ }
1308
+ for (let [text, fit2] of fits) fit2?.title !== void 0 && keeper.get(fit2.text) !== text && fits.set(text, null);
1309
+ statusFits.set(key, fits);
1310
+ }
1311
+ let fit = fits.get(label);
1312
+ return fit === void 0 ? fitStatusLabel(label, font, room, trackRoom, measure) : fit;
1313
+ }
1314
+ function authoredGround(row, isTotal) {
1315
+ let css = row.kind === "subtotal" ? theme.table?.grounds?.subtotal : isTotal ? theme.table?.grounds?.total : void 0;
1316
+ return css === void 0 || transparentCss(css) ? void 0 : css;
1317
+ }
1318
+ function groundInk(ground, ink, tone) {
1319
+ if (ground === void 0 || "theme" in ink && ink.theme?.kind === "ground-text") return ink;
1320
+ let paint = onTableGround(ink, ground, tone), key = JSON.stringify(paint), known = groundTexts.get(key);
1321
+ return known !== void 0 ? known : (groundTexts.set(key, paint), paint);
1322
+ }
1323
+ function toneInk(ground, tone) {
1324
+ return groundInk(ground, toneTextPaint(theme, tone, options.palette), tone);
1325
+ }
1326
+ function emitCell(cell, row, colId, cx, w, ry, rh, isTotal, isSection) {
1327
+ let rowId = row.id, col = cols.find((c) => c.id === colId), font = cellFont(cell), owner = { rowId, colId };
1328
+ 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" });
1329
+ 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;
1330
+ toneFill !== void 0 && nodes.push({ t: "rect", id: tableCellNodeId("toneground", rowId, colId), rect: tintBox, fill: toneFill, owner, part: "tableToneGround" });
1331
+ 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 });
1332
+ if (figureCell && cell.bar !== void 0 && cell.bar > 0) {
1333
+ let top = (inline.extra + head > 0 ? blockTop : ry + (rh - ruleSpace - valueBox) / 2) + 2;
1334
+ 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" });
1335
+ }
1336
+ 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;
1337
+ if (cell.kind === "status" && cell.state === "value" && col.statusMark === "square") {
1338
+ 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);
1339
+ if (fit === null) return emitStatusMark(cell, row, col, cx, w, ry, rh);
1340
+ let { text: label, title } = fit;
1341
+ title !== void 0 && noteStatusCut(col, row, label, title);
1342
+ let groupW = square.side + square.gap + measure(label, fonts.body).width, markX = Math.round(cx + (w - groupW) / 2);
1343
+ nodes.push({
1344
+ t: "rect",
1345
+ id: tableCellNodeId("chip", rowId, colId),
1346
+ rect: { x: markX, y: Math.round(ry + (rh - square.side) / 2), w: square.side, h: square.side },
1347
+ fill: statusSquarePaint(cell.tone),
1348
+ owner,
1349
+ part: "tableChip"
1350
+ }), nodes.push({
1351
+ t: "text",
1352
+ typeRole: "label",
1353
+ id: tableCellNodeId("cell", rowId, colId),
1354
+ x: markX + square.side + square.gap,
1355
+ y: ry + (rh - fonts.body.size * 1.2) / 2,
1356
+ lines: [label],
1357
+ align: "start",
1358
+ font: fonts.body,
1359
+ ink: groundInk(textGround, { token: "ink" }),
1360
+ owner,
1361
+ part: "tableCell",
1362
+ role: "category",
1363
+ display: { state: cell.displayed },
1364
+ ...title === void 0 ? {} : { title }
1365
+ });
1366
+ return;
1367
+ }
1368
+ if (cell.kind === "status" && cell.state === "value") {
1369
+ let fit = statusFit(col, cell.displayed, fonts.chip, w - 2 * cellPadX2 - 2 * CHIP_PAD_X, w - 2 * CHIP_PAD_X);
1370
+ if (fit === null) return emitStatusMark(cell, row, col, cx, w, ry, rh);
1371
+ let { text: label, title } = fit;
1372
+ title !== void 0 && noteStatusCut(col, row, label, title);
1373
+ 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);
1374
+ nodes.push({
1375
+ t: "rect",
1376
+ id: tableCellNodeId("chip", rowId, colId),
1377
+ rect: { x: chipX, y: chipY, w: chipW, h: chipH },
1378
+ fill: chip.fill,
1379
+ // A status preset's chips are square; everywhere else they keep the
1380
+ // theme's chip radius.
1381
+ radius: language.squareChips ? 0 : surface.chipRadius,
1382
+ owner,
1383
+ part: "tableChip"
1384
+ }), nodes.push({
1385
+ t: "text",
1386
+ typeRole: "label",
1387
+ id: tableCellNodeId("cell", rowId, colId),
1388
+ x: chipX + chipW / 2,
1389
+ y: chipY + (chipH - fonts.chip.size * 1.2) / 2,
1390
+ lines: [label],
1391
+ align: "middle",
1392
+ font: fonts.chip,
1393
+ ink: chip.ink,
1394
+ owner,
1395
+ part: "tableCell",
1396
+ role: "category",
1397
+ display: { state: cell.displayed },
1398
+ ...title === void 0 ? {} : { title }
1399
+ });
1400
+ return;
1401
+ }
1402
+ 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);
1403
+ if (parentRow && options.outlineMarks === !0 && row.foldable !== !1) {
1404
+ 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;
1405
+ 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({
1406
+ t: "path",
1407
+ id: `mark:${rowId}`,
1408
+ 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`,
1409
+ stroke: boxed ? { token: "ink" } : tableInk("toggle"),
1410
+ width: strokeToken(theme, "mark"),
1411
+ lineCap: "round",
1412
+ owner,
1413
+ part: "tableOutlineMark"
1414
+ });
1415
+ }
1416
+ 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(
1417
+ cell,
1418
+ col.kind,
1419
+ isSection,
1420
+ font,
1421
+ maxW,
1422
+ wrappedCell,
1423
+ cutTitles.get(tableCellKey(rowId, colId)),
1424
+ measure,
1425
+ theme.table?.section?.case
1426
+ ), lines = wrappedCell ?? [text], sectionLabel = isSection && col.kind === "rowLabel";
1427
+ if (sectionLabel && align !== "start") {
1428
+ let groupW = measure(lines[lines.length - 1] ?? text, font).width / WIDTH_SAFETY + lineAffix + badgeReserve, start = contentX + indent;
1429
+ tx = align === "end" ? contentX + contentW - groupW : start + (contentX + contentW - start - groupW) / 2;
1430
+ }
1431
+ 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 = {
1432
+ cell,
1433
+ box: { x: cx, y: ry, w, h: rh },
1434
+ theme,
1435
+ ...options.palette === void 0 ? {} : { palette: options.palette },
1436
+ ...cell.tone === "neutral" || enc?.type !== "arrow" ? {} : { toneInk: toneInk(textGround, cell.tone) },
1437
+ measure,
1438
+ nodeId: (suffix) => tableCellNodeId(suffix, rowId, colId),
1439
+ owner
1440
+ }, stats = numericStats.get(colId), encodingInk, ownGround = hasPolarityBadge(cell, col), lane = heatLanes.get(colId);
1441
+ if ((col.kind === "value" || col.kind === "computed") && enc?.type === "heat" && lane) {
1442
+ let heat = emitHeat({ ...context, box: tintBox }, lane, enc), heatGround = heat.nodes.find((node) => node.t === "rect")?.fill;
1443
+ 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 });
1444
+ } else (col.kind === "value" || col.kind === "computed") && enc?.type === "inCellBar" && stats ? nodes.push(
1445
+ ...emitInCellBar(context, {
1446
+ contentBox: { x: contentX, y: ry, w: contentW, h: rh },
1447
+ maxAbs: stats.maxAbs,
1448
+ textReserve: stats.textReserve
1449
+ })
1450
+ ) : 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 }));
1451
+ if (ownGround) {
1452
+ let badgeH = chipHeight(rh, font.size), tw = measure(text, figureFont(font, cellDrawsTabular(theme, col.kind, text))).width;
1453
+ nodes.push({
1454
+ t: "rect",
1455
+ id: tableCellNodeId("badge", rowId, colId),
1456
+ rect: {
1457
+ x: Math.round(cx + w - cellPadX2 - tw - 6),
1458
+ y: Math.round(textTop + (font.size * 1.2 - badgeH) / 2),
1459
+ w: Math.round(tw + 12),
1460
+ h: badgeH
1461
+ },
1462
+ fill: chipPaints(theme, cell.tone, options.palette).fill,
1463
+ radius: surface.chipRadius,
1464
+ owner,
1465
+ part: "tableBadge"
1466
+ }), tx = cx + w - cellPadX2;
1467
+ }
1468
+ 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;
1469
+ if (cell.kind === "rowLabel" && row.operator !== void 0 && operatorSlot > 0 && nodes.push({
1470
+ t: "text",
1471
+ id: `operator:${rowId}`,
1472
+ x: tx - operatorSlot,
1473
+ y: textTop,
1474
+ lines: [row.operator],
1475
+ align: "start",
1476
+ font,
1477
+ ink: groundInk(textGround, tableInk("operator")),
1478
+ owner,
1479
+ part: "tableOperator",
1480
+ typeRole: "label",
1481
+ role: "category"
1482
+ }), printsFigure && nodes.push({
1483
+ t: "text",
1484
+ typeRole: "label",
1485
+ id: tableCellNodeId("cell", rowId, colId),
1486
+ x: tx,
1487
+ y: textTop,
1488
+ lines,
1489
+ ...cutTitle !== void 0 ? { title: cutTitle } : {},
1490
+ align: drawnAlign,
1491
+ font: drawnFont,
1492
+ ink,
1493
+ owner,
1494
+ part: "tableCell",
1495
+ ...cellRole(col.kind, lines.join(" ")),
1496
+ ...cell.displayed === "" ? {} : {
1497
+ display: cell.state === "value" ? { value: cell.displayed } : { state: cell.displayed }
1498
+ }
1499
+ }), inline.lines.length > 0 && (col.kind === "rowLabel" || col.kind === "value" || col.kind === "computed")) {
1500
+ let base = inline.note === void 0 ? 0 : 1, lineY = blockTop + valueBox + head + ladder.inlineGap + base * inline.box;
1501
+ for (let [index, line] of inline.lines.entries()) {
1502
+ 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;
1503
+ if (lineY += inline.box, inline.noteSlots.get(colId) === base + index || !printed) continue;
1504
+ let toned = col.kind !== "rowLabel" && lineCell?.state === "value" && lineCell.tone !== "neutral";
1505
+ nodes.push({
1506
+ t: "text",
1507
+ typeRole: "label",
1508
+ id: tableCellNodeId("cellline", rowId, colId, line.id),
1509
+ x: col.kind === "rowLabel" ? contentX + indent + INLINE_LABEL_INDENT : cx + w - cellPadX2,
1510
+ y: y2,
1511
+ lines: [printed],
1512
+ align: col.kind === "rowLabel" ? "start" : "end",
1513
+ font: lineFont,
1514
+ 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")),
1515
+ owner,
1516
+ part: "tableCellLine",
1517
+ ...col.kind === "rowLabel" ? { role: "category" } : cellRole(col.kind, printed),
1518
+ ...lineCell === void 0 || lineCell.displayed === "" || col.kind === "rowLabel" ? {} : { display: lineCell.state === "value" ? { value: lineCell.displayed } : { state: lineCell.displayed } }
1519
+ });
1520
+ }
1521
+ }
1522
+ if (affixWidth > 0 && nodes.push({
1523
+ t: "text",
1524
+ typeRole: "label",
1525
+ id: `unit:${rowId}`,
1526
+ // Measured in the face the label is drawn in: a bolder label measured in the body face ran
1527
+ // into its unit ("marginof product sales"). Under the label, the unit starts its own line.
1528
+ x: affixBelow.has(rowId) ? tx : tx + measure(lines[lines.length - 1] ?? text, drawnFont).width + Math.max(theme.table?.qualifier?.gap ?? 4, measure(" ", affixFont).width),
1529
+ // baseline lock: the affix shares the label's baseline exactly
1530
+ 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,
1531
+ lines: [row.unitAffix],
1532
+ align: "start",
1533
+ font: affixFont,
1534
+ ink: groundInk(textGround, tableInk(row.kind === "driver" ? "driver" : "qualifier")),
1535
+ owner,
1536
+ part: "tableRowUnit",
1537
+ // A hoisted scale letter is a number's tail and takes the figures;
1538
+ // an authored unit is a phrase ("$ per order") and reads as prose,
1539
+ // which is the composed-role rule.
1540
+ role: composedTextRole(row.unitAffix, "caption")
1541
+ }), badge !== void 0) {
1542
+ 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));
1543
+ nodes.push({
1544
+ t: "rect",
1545
+ id: `sectionbadge:${rowId}`,
1546
+ rect: { x: chipX, y: chipY, w: badgeW, h: chipH },
1547
+ fill: chip.fill,
1548
+ radius: language.squareChips ? 0 : surface.chipRadius,
1549
+ owner,
1550
+ part: "tableSectionBadge"
1551
+ }), nodes.push({
1552
+ t: "text",
1553
+ typeRole: "label",
1554
+ id: `sectionbadge-text:${rowId}`,
1555
+ x: chipX + badgeW / 2,
1556
+ y: chipY + (chipH - fonts.chip.size * 1.2) / 2,
1557
+ lines: [badge.text],
1558
+ align: "middle",
1559
+ font: fonts.chip,
1560
+ ink: chip.ink,
1561
+ owner,
1562
+ part: "tableSectionBadge",
1563
+ role: "category",
1564
+ display: { state: badge.text }
1565
+ });
1566
+ }
1567
+ if (parentRow && !expanded && align === "start") {
1568
+ let noun = table.levelNouns?.[cell.level + 1], count = childCount.get(rowId) ?? 0;
1569
+ if (noun !== void 0 && count > 0) {
1570
+ 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;
1571
+ hint !== void 0 && nodes.push({
1572
+ t: "text",
1573
+ typeRole: "label",
1574
+ id: `hint:${rowId}`,
1575
+ x: hintX,
1576
+ y: textTop + (lines.length - 1) * font.size * 1.2 + (font.size - fonts.hint.size) * NOTE_BASELINE_LOCK,
1577
+ lines: [hint.text],
1578
+ ...hint.title === void 0 ? {} : { title: hint.title },
1579
+ align: "start",
1580
+ font: fonts.hint,
1581
+ ink: groundInk(textGround, tableInk("secondary")),
1582
+ owner,
1583
+ part: "tableCollapsedHint",
1584
+ role: "category"
1585
+ });
1586
+ }
1587
+ }
1588
+ let noteSlot = inline.noteSlots.get(colId);
1589
+ if (cell.note && noteSlot !== void 0) {
1590
+ let noteFont = inlineFont2(row.step, !1);
1591
+ nodes.push({
1592
+ t: "text",
1593
+ typeRole: "footnote",
1594
+ id: tableCellNodeId("note", rowId, colId),
1595
+ x: align === "end" ? cx + w - cellPadX2 : align === "middle" ? cx + w / 2 : contentX + indent,
1596
+ y: blockTop + valueBox + head + ladder.inlineGap + noteSlot * inline.box + (inline.box - noteFont.size * 1.2) / 2,
1597
+ lines: [cell.note],
1598
+ align,
1599
+ font: noteFont,
1600
+ ink: groundInk(textGround, tableInk("secondary")),
1601
+ owner,
1602
+ part: "tableCellNote"
1603
+ });
1604
+ } else if (cell.note && col.kind === "rowLabel" && inline.note !== void 0) {
1605
+ let noteFont = inlineFont2(row.step, !1);
1606
+ nodes.push({
1607
+ t: "text",
1608
+ typeRole: "footnote",
1609
+ id: tableCellNodeId("note", rowId, colId),
1610
+ x: contentX + indent,
1611
+ y: blockTop + valueBox + head + ladder.inlineGap + (inline.box - noteFont.size * 1.2) / 2,
1612
+ lines: [cell.note],
1613
+ align: "start",
1614
+ font: noteFont,
1615
+ ink: groundInk(textGround, tableInk("secondary")),
1616
+ owner,
1617
+ part: "tableCellNote"
1618
+ });
1619
+ } else if (cell.note) {
1620
+ 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;
1621
+ nodes.push({
1622
+ t: "text",
1623
+ typeRole: "footnote",
1624
+ id: tableCellNodeId("note", rowId, colId),
1625
+ x: noteX,
1626
+ y: noteY,
1627
+ lines: [cell.note],
1628
+ align: align === "end" ? "end" : "start",
1629
+ font: fonts.note,
1630
+ ink: groundInk(textGround, tableInk("secondary")),
1631
+ owner,
1632
+ part: "tableCellNote"
1633
+ });
1634
+ }
1635
+ }
1636
+ occupied.claim({ x: rowX, y: gridY, w: rowW, h: headerH }, "mark", {}, "tableHeader");
1637
+ for (let row of rows) {
1638
+ let { y: ry, h: rh } = rowY.get(row.id);
1639
+ occupied.claim({ x: rowX, y: ry, w: rowW, h: rh }, "mark", { rowId: row.id }, "tableRow");
1640
+ }
1641
+ for (let col of cols) {
1642
+ let { x: cx, w } = colX.get(col.id);
1643
+ occupied.claim({ x: cx, y: gridY, w, h: tableH }, "mark", { colId: col.id }, "tableColumn");
1644
+ }
1645
+ let marks = {
1646
+ table: { x: gridX, y: gridY, w: tableW, h: tableH },
1647
+ headerBand: { x: gridX, y: gridY, w: tableW, h: headerH },
1648
+ columns: cols.map((c) => ({ id: c.id, ...colX.get(c.id) })),
1649
+ rows: rows.map((r) => ({ id: r.id, ...rowY.get(r.id) }))
1650
+ }, paintWarningRules = [];
1651
+ if (groundTexts.size > 0) {
1652
+ let texts = options.colorblindSafe === !0 ? colorblindRoles([...groundTexts.values()]).value : [...groundTexts.values()];
1653
+ paintWarningRules.push({ kind: "table-ground-text", texts, before: warnings.length }), pushAll(warnings, groundTextWarnings(theme, texts));
1654
+ }
1655
+ let scene = nodes;
1656
+ if (options.colorblindSafe === !0) {
1657
+ let swap = colorblindRoles(nodes);
1658
+ scene = swap.value, swap.swapped === 0 && warnings.push({
1659
+ code: "table-colorblind-safe-unused",
1660
+ severity: "error",
1661
+ 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",
1662
+ suggest: "drop colorblindSafe; options.palette names a colorblind-safe categorical ramp",
1663
+ field: ["options", "colorblindSafe"],
1664
+ fix: [{ op: "remove", path: "/options/colorblindSafe" }]
1665
+ });
1666
+ }
1667
+ let cutNotes = cols.flatMap((col) => {
1668
+ let cuts = statusCuts.get(col.id), entry = ({ shown, full, rows: named }) => `${shown !== "" ? shown : named.join(", ")} = ${full}`;
1669
+ return cuts ? [disclosureNote(`${col.label}: ${[...cuts.values()].map(entry).join("; ")}`)] : [];
1670
+ }).filter((note) => !(options[ENGINE_NOTES] ?? []).includes(note));
1671
+ return cutNotes.length > 0 ? layoutTableOnce(authoredData, { ...options, [ENGINE_NOTES]: [...options[ENGINE_NOTES] ?? [], ...cutNotes] }, initialResolved, sizingOnly, formatFits) : {
1672
+ type: "table",
1673
+ size,
1674
+ sizing,
1675
+ plot,
1676
+ scene,
1677
+ labels: [],
1678
+ axes: [],
1679
+ annotations: [],
1680
+ frame: frame.frame,
1681
+ marks,
1682
+ derived: { table, computedCells: resolved.computedCells },
1683
+ a11y: {
1684
+ title: accessibleTitle(options.title, "Table"),
1685
+ counts: [structureCount("rows", dataRows.length), structureCount("columns", cols.length)],
1686
+ desc: `Table with ${dataRows.length} rows and ${cols.length} columns`
1687
+ },
1688
+ warnings,
1689
+ ...paintWarningRules.length > 0 ? { paintWarningRules } : {},
1690
+ debug: { occupied: occupied.snapshot(), decisions: [] }
1691
+ };
1692
+ }
1693
+ function tableSizing(size, plot, bottom, totalW, minimumW) {
1694
+ return rowSizing("table", size, {
1695
+ chromeH: size.height - plot.h,
1696
+ minimumRowsH: bottom - plot.y + 4,
1697
+ naturalRowsH: bottom - plot.y + 4,
1698
+ minWidth: size.width - plot.w + minimumW,
1699
+ naturalWidth: size.width - plot.w + totalW
1700
+ });
1701
+ }
1702
+ function fitStatusLabel(label, font, room, trackRoom, measure) {
1703
+ let width = measure(label, font).width;
1704
+ if (width <= room) return { text: label };
1705
+ if (room < HEADING_CUT_MIN) return width <= trackRoom ? { text: label } : null;
1706
+ let cut = cutWithTitle(label, font, room, measure);
1707
+ return cut.text === "\u2026" || cut.text === "" ? null : cut;
1708
+ }
1709
+ function cellText(cell, kind, isSection, font, maxW, wrapped, wrappedTitle, measure, sectionCase) {
1710
+ let text = isSection && sectionCase !== "asis" ? sectionText(cell.displayed) : cell.displayed;
1711
+ 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 };
1712
+ }
1713
+ function sectionText(s) {
1714
+ return s.toUpperCase();
1715
+ }
1716
+ function encodingSparklineNodes(col, row, box, theme, palette, measure, domain, language) {
1717
+ if (row.role === "section" || col.encoding?.type !== "sparkline") return [];
1718
+ let values = sparklineSourceValues(row, col.encoding.sourceColumns), last = lastObservedIndex(values), lastSource = last === void 0 ? void 0 : col.encoding.sourceColumns[last];
1719
+ return emitSparkline(
1720
+ {
1721
+ cell: row.cells[col.id],
1722
+ box,
1723
+ theme,
1724
+ ...palette === void 0 ? {} : { palette },
1725
+ measure,
1726
+ nodeId: (suffix) => tableCellNodeId(suffix, row.id, col.id),
1727
+ owner: { rowId: row.id, colId: col.id }
1728
+ },
1729
+ values,
1730
+ {
1731
+ kind: col.encoding.kind ?? "line",
1732
+ domain: domain ?? tableSparklineDomain([row], col.encoding.sourceColumns, col.encoding.kind ?? "line"),
1733
+ lastText: lastSource === void 0 ? void 0 : row.cells[lastSource]?.displayed,
1734
+ language
1735
+ }
1736
+ );
1737
+ }
1738
+ function transparentCss(css) {
1739
+ return css.trim().toLowerCase() === "transparent";
1740
+ }
1741
+
1742
+ export {
1743
+ sparklineSourceValues,
1744
+ sparklineDomains,
1745
+ emitSparkline,
1746
+ fitTableFormats,
1747
+ formatsFittedWarning,
1748
+ REGULAR_SPACING,
1749
+ layoutTable,
1750
+ layoutTableCard,
1751
+ memoLayout,
1752
+ classFloor,
1753
+ cardHeightFloor
1754
+ };