boardplot 0.0.0-stage → 0.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (818) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE.md +180 -0
  4. package/README.md +208 -2
  5. package/THIRD_PARTY_NOTICES.md +1110 -0
  6. package/dist/DiagnosticDetails-UNYNYCAH.js +69 -0
  7. package/dist/ReaderBox-VOJSJ66R.js +137 -0
  8. package/dist/annotateEngine-DLMFJZ67.js +30 -0
  9. package/dist/build-identity.json +6 -0
  10. package/dist/chunk-24BHMKDD.js +83 -0
  11. package/dist/chunk-263SZKIL.js +8 -0
  12. package/dist/chunk-27QADBDV.js +211 -0
  13. package/dist/chunk-2CVH5E57.js +128 -0
  14. package/dist/chunk-2DOR5SS6.js +446 -0
  15. package/dist/chunk-2EQE4E3I.js +22 -0
  16. package/dist/chunk-2FNNAPCI.js +24 -0
  17. package/dist/chunk-2L2Q53EP.js +251 -0
  18. package/dist/chunk-2LMCD3ZR.js +6 -0
  19. package/dist/chunk-2ND7ZITT.js +3069 -0
  20. package/dist/chunk-2QT5ZUHO.js +2937 -0
  21. package/dist/chunk-2RSG7JYI.js +24 -0
  22. package/dist/chunk-2V6CLH33.js +1392 -0
  23. package/dist/chunk-2VWJ5BGO.js +566 -0
  24. package/dist/chunk-2WNYRWHG.js +51 -0
  25. package/dist/chunk-323YZWYJ.js +548 -0
  26. package/dist/chunk-33PB4V6K.js +382 -0
  27. package/dist/chunk-33PLBIMA.js +176 -0
  28. package/dist/chunk-3A2IEBCN.js +195 -0
  29. package/dist/chunk-3D3D3D23.js +25 -0
  30. package/dist/chunk-3EZRM4YM.js +92 -0
  31. package/dist/chunk-3H2W76TB.js +2353 -0
  32. package/dist/chunk-3JEQGGVD.js +19 -0
  33. package/dist/chunk-3QWZAEW5.js +26 -0
  34. package/dist/chunk-3SIRPKMP.js +12 -0
  35. package/dist/chunk-3SQCCESO.js +1592 -0
  36. package/dist/chunk-3XHJHQWU.js +42 -0
  37. package/dist/chunk-4G2O2ZPJ.js +83 -0
  38. package/dist/chunk-4JLBVIGW.js +24 -0
  39. package/dist/chunk-4RRNJLCM.js +746 -0
  40. package/dist/chunk-4UVW5WU6.js +76 -0
  41. package/dist/chunk-4X66BTP5.js +344 -0
  42. package/dist/chunk-53OYF4ZT.js +687 -0
  43. package/dist/chunk-57ZGVAU3.js +179 -0
  44. package/dist/chunk-5HECRVXJ.js +62 -0
  45. package/dist/chunk-5LGSRWFC.js +63 -0
  46. package/dist/chunk-5LYXD6ME.js +1112 -0
  47. package/dist/chunk-66RFKRGO.js +28 -0
  48. package/dist/chunk-6KWIQ5KF.js +18 -0
  49. package/dist/chunk-6OCR6ITN.js +72 -0
  50. package/dist/chunk-6RBTTCQD.js +802 -0
  51. package/dist/chunk-6Y7EXYLR.js +563 -0
  52. package/dist/chunk-7CTKTIPF.js +613 -0
  53. package/dist/chunk-7EVIIADO.js +185 -0
  54. package/dist/chunk-7X2ZYVAX.js +89 -0
  55. package/dist/chunk-7X65ZQN4.js +38 -0
  56. package/dist/chunk-A4QZXLXF.js +7 -0
  57. package/dist/chunk-A6CQPJWR.js +49 -0
  58. package/dist/chunk-A7IEVBYI.js +35 -0
  59. package/dist/chunk-ACXX2JNL.js +6 -0
  60. package/dist/chunk-ADKCLH3Z.js +98 -0
  61. package/dist/chunk-ADWSGPH5.js +23 -0
  62. package/dist/chunk-AG2CJ4JY.js +203 -0
  63. package/dist/chunk-AHQ4L3BE.js +30 -0
  64. package/dist/chunk-AOQ6VF5H.js +6 -0
  65. package/dist/chunk-AQROQDLR.js +3303 -0
  66. package/dist/chunk-AWTG3RFF.js +85 -0
  67. package/dist/chunk-B54RN2FD.js +692 -0
  68. package/dist/chunk-B67K6OWJ.js +48 -0
  69. package/dist/chunk-B6GFKYBZ.js +40 -0
  70. package/dist/chunk-BBL3R5YZ.js +186 -0
  71. package/dist/chunk-BBRBCMNR.js +28 -0
  72. package/dist/chunk-BIDIGDGH.js +6 -0
  73. package/dist/chunk-BLFWUMTD.js +12 -0
  74. package/dist/chunk-BM6SFFWF.js +6 -0
  75. package/dist/chunk-BMRD6MAH.js +24 -0
  76. package/dist/chunk-BPKXEMRE.js +197 -0
  77. package/dist/chunk-BUPLB3EX.js +129 -0
  78. package/dist/chunk-BW5VLBSZ.js +15 -0
  79. package/dist/chunk-BWGRWGVA.js +295 -0
  80. package/dist/chunk-BWLOXQDV.js +131 -0
  81. package/dist/chunk-BWTX7LUG.js +203 -0
  82. package/dist/chunk-C54QLNE4.js +69 -0
  83. package/dist/chunk-CAQ5P4VN.js +296 -0
  84. package/dist/chunk-CCCEBIUZ.js +296 -0
  85. package/dist/chunk-CDZHNLO6.js +42 -0
  86. package/dist/chunk-CJGSJKPO.js +25 -0
  87. package/dist/chunk-CN7JRHST.js +25 -0
  88. package/dist/chunk-CNX7EGSU.js +266 -0
  89. package/dist/chunk-COYOTQC2.js +75 -0
  90. package/dist/chunk-CRNMNZJD.js +1161 -0
  91. package/dist/chunk-CUVUDK4O.js +68 -0
  92. package/dist/chunk-CWDHCSL2.js +2919 -0
  93. package/dist/chunk-CYOJZ3GQ.js +631 -0
  94. package/dist/chunk-D4SOADBD.js +19 -0
  95. package/dist/chunk-D7SHZDA3.js +1808 -0
  96. package/dist/chunk-DAVHGK27.js +657 -0
  97. package/dist/chunk-DCCJRLAJ.js +422 -0
  98. package/dist/chunk-DCTCUZ5L.js +51 -0
  99. package/dist/chunk-DDCB7ZA5.js +2511 -0
  100. package/dist/chunk-DDI2W4TR.js +149 -0
  101. package/dist/chunk-DIHUGBZO.js +61 -0
  102. package/dist/chunk-DJHIQWSG.js +25 -0
  103. package/dist/chunk-DO5OZJAO.js +302 -0
  104. package/dist/chunk-DOFYKPTC.js +18 -0
  105. package/dist/chunk-DRTA6JG5.js +160 -0
  106. package/dist/chunk-DRW6KGBK.js +1062 -0
  107. package/dist/chunk-DU4A5AOY.js +1156 -0
  108. package/dist/chunk-DYS7EIXY.js +294 -0
  109. package/dist/chunk-E4IQ6M4S.js +24 -0
  110. package/dist/chunk-EFUWFB64.js +24 -0
  111. package/dist/chunk-EHBB2Z4D.js +290 -0
  112. package/dist/chunk-EHVESNLV.js +30 -0
  113. package/dist/chunk-EJPVVGD7.js +67 -0
  114. package/dist/chunk-EKQK5D6G.js +14 -0
  115. package/dist/chunk-EUADDXAV.js +30 -0
  116. package/dist/chunk-F6CNPC4L.js +47 -0
  117. package/dist/chunk-FBAYZSFC.js +2806 -0
  118. package/dist/chunk-FBB4BWKN.js +30 -0
  119. package/dist/chunk-FF23FYQD.js +1269 -0
  120. package/dist/chunk-FG6EDGMI.js +53 -0
  121. package/dist/chunk-FHA3KMFC.js +43 -0
  122. package/dist/chunk-FIANWJXX.js +19 -0
  123. package/dist/chunk-FIWNDOMO.js +6 -0
  124. package/dist/chunk-FV3VF36K.js +2721 -0
  125. package/dist/chunk-G5FMTRG5.js +37 -0
  126. package/dist/chunk-GCBOHVDZ.js +229 -0
  127. package/dist/chunk-GDOW2KNP.js +19 -0
  128. package/dist/chunk-GTG3IGLF.js +2674 -0
  129. package/dist/chunk-GZTNTHSW.js +21 -0
  130. package/dist/chunk-H4H4O62O.js +46 -0
  131. package/dist/chunk-H5G7T35P.js +24 -0
  132. package/dist/chunk-H63XQ3OO.js +942 -0
  133. package/dist/chunk-H67RTX46.js +43 -0
  134. package/dist/chunk-HA4IPWMM.js +841 -0
  135. package/dist/chunk-HKYTOJLV.js +33 -0
  136. package/dist/chunk-HOAH5XBR.js +542 -0
  137. package/dist/chunk-HTYFQHRC.js +24 -0
  138. package/dist/chunk-HYY5V2KL.js +19 -0
  139. package/dist/chunk-HZI56ASJ.js +79 -0
  140. package/dist/chunk-I6VAWNNU.js +24 -0
  141. package/dist/chunk-IBXXZVG7.js +80 -0
  142. package/dist/chunk-IDDA5INB.js +60 -0
  143. package/dist/chunk-IK4BHOPZ.js +33 -0
  144. package/dist/chunk-IL5T7I2A.js +27 -0
  145. package/dist/chunk-ILSXT6KT.js +24 -0
  146. package/dist/chunk-IV2UXZXX.js +16 -0
  147. package/dist/chunk-IYEFEBRN.js +41 -0
  148. package/dist/chunk-IYMI7YI4.js +829 -0
  149. package/dist/chunk-J6I2YFJH.js +58 -0
  150. package/dist/chunk-JFBEAUJ6.js +24 -0
  151. package/dist/chunk-JR7Y5ONB.js +27 -0
  152. package/dist/chunk-JSEYUJUQ.js +836 -0
  153. package/dist/chunk-JYBT2JNY.js +61 -0
  154. package/dist/chunk-K3HSQPSM.js +24 -0
  155. package/dist/chunk-KAXJFL7N.js +43 -0
  156. package/dist/chunk-KDMKHR5A.js +32 -0
  157. package/dist/chunk-KKWZWP67.js +24 -0
  158. package/dist/chunk-KOJ5QETJ.js +8 -0
  159. package/dist/chunk-KPKXJYQH.js +19 -0
  160. package/dist/chunk-KSJVENRU.js +113 -0
  161. package/dist/chunk-KZJOV4QW.js +33 -0
  162. package/dist/chunk-KZS46KDY.js +58 -0
  163. package/dist/chunk-L3JWM7FR.js +50 -0
  164. package/dist/chunk-L4S6UFTL.js +26 -0
  165. package/dist/chunk-L6DJ4ZY5.js +2008 -0
  166. package/dist/chunk-L7RHB734.js +23 -0
  167. package/dist/chunk-LCWJS34U.js +38 -0
  168. package/dist/chunk-LFTAMH7I.js +24 -0
  169. package/dist/chunk-LFX7W4B7.js +113 -0
  170. package/dist/chunk-LINZPU5D.js +8 -0
  171. package/dist/chunk-LIWLBLCT.js +83 -0
  172. package/dist/chunk-LNKY5Z2X.js +23 -0
  173. package/dist/chunk-LS7HVBI7.js +24 -0
  174. package/dist/chunk-M4EUXOLU.js +170 -0
  175. package/dist/chunk-M4SPKUZE.js +7 -0
  176. package/dist/chunk-M4YLED7M.js +17 -0
  177. package/dist/chunk-MBKZYJRC.js +1424 -0
  178. package/dist/chunk-MCYM3RNF.js +227 -0
  179. package/dist/chunk-MF6IVSBJ.js +48 -0
  180. package/dist/chunk-MIAPBQCA.js +24 -0
  181. package/dist/chunk-MJZHFH5R.js +1075 -0
  182. package/dist/chunk-MQFCG4KS.js +1467 -0
  183. package/dist/chunk-MVV6RQMG.js +128 -0
  184. package/dist/chunk-MYMT5KJL.js +1182 -0
  185. package/dist/chunk-MZL6LGKO.js +587 -0
  186. package/dist/chunk-N23YFPPI.js +47 -0
  187. package/dist/chunk-N3G2FYDL.js +300 -0
  188. package/dist/chunk-N3TPMXS3.js +161 -0
  189. package/dist/chunk-N73IBH55.js +58 -0
  190. package/dist/chunk-N7J7CZS6.js +43 -0
  191. package/dist/chunk-NCB3YLHF.js +28 -0
  192. package/dist/chunk-NHQGRKEA.js +63 -0
  193. package/dist/chunk-NKIYLFXZ.js +2774 -0
  194. package/dist/chunk-NOSDEJ3K.js +25934 -0
  195. package/dist/chunk-NQDVMUHX.js +433 -0
  196. package/dist/chunk-NSSNYY6Y.js +58 -0
  197. package/dist/chunk-NY5NUFDZ.js +117 -0
  198. package/dist/chunk-O3S2KNIW.js +25 -0
  199. package/dist/chunk-O3VN6BTL.js +24 -0
  200. package/dist/chunk-ONZLC47B.js +88 -0
  201. package/dist/chunk-OQEBOVUO.js +30 -0
  202. package/dist/chunk-OUEGGWH7.js +24 -0
  203. package/dist/chunk-OURX73UJ.js +728 -0
  204. package/dist/chunk-P25VEGGX.js +24 -0
  205. package/dist/chunk-P26Z62UV.js +24 -0
  206. package/dist/chunk-P5RNWMZC.js +2984 -0
  207. package/dist/chunk-P6KZIZDV.js +987 -0
  208. package/dist/chunk-PEUSKIFV.js +168 -0
  209. package/dist/chunk-PFVTYFSL.js +24 -0
  210. package/dist/chunk-PWROWDZS.js +137 -0
  211. package/dist/chunk-Q3CV2JJ2.js +3650 -0
  212. package/dist/chunk-QBR6IKIX.js +50 -0
  213. package/dist/chunk-QGCEHR6S.js +13 -0
  214. package/dist/chunk-QHRE2M6V.js +26 -0
  215. package/dist/chunk-QKL7IY42.js +38 -0
  216. package/dist/chunk-QO6HEXIZ.js +272 -0
  217. package/dist/chunk-QOIVXZUF.js +24 -0
  218. package/dist/chunk-QPWRHDLZ.js +17 -0
  219. package/dist/chunk-QSXK6PJL.js +19 -0
  220. package/dist/chunk-QTZVVZ2A.js +54 -0
  221. package/dist/chunk-QWXWVPNE.js +18 -0
  222. package/dist/chunk-QY5ZKUWY.js +383 -0
  223. package/dist/chunk-QZAT46PP.js +95 -0
  224. package/dist/chunk-RA66JA3D.js +24 -0
  225. package/dist/chunk-REOPXBUR.js +600 -0
  226. package/dist/chunk-RGZGLKFB.js +648 -0
  227. package/dist/chunk-RL3NUWMY.js +3378 -0
  228. package/dist/chunk-RNOJSEES.js +16 -0
  229. package/dist/chunk-ROXO4R3J.js +16 -0
  230. package/dist/chunk-RPIW5T55.js +40 -0
  231. package/dist/chunk-RQ5DNYLG.js +10 -0
  232. package/dist/chunk-RZNYW7UP.js +133 -0
  233. package/dist/chunk-S32YYDIB.js +420 -0
  234. package/dist/chunk-S4QSJAGY.js +44 -0
  235. package/dist/chunk-S6UX7KB6.js +335 -0
  236. package/dist/chunk-SDSONLMZ.js +2546 -0
  237. package/dist/chunk-SGD3ZHID.js +250 -0
  238. package/dist/chunk-SKRSCTT5.js +28 -0
  239. package/dist/chunk-SMCDXUIO.js +24 -0
  240. package/dist/chunk-SPTPFY4S.js +528 -0
  241. package/dist/chunk-SREWFAAJ.js +90 -0
  242. package/dist/chunk-SS42FJVN.js +3875 -0
  243. package/dist/chunk-SVZDXFPX.js +891 -0
  244. package/dist/chunk-SZPTTNW7.js +16 -0
  245. package/dist/chunk-T3IGJARD.js +22 -0
  246. package/dist/chunk-TA3TFKYZ.js +86 -0
  247. package/dist/chunk-TBGUEF3M.js +939 -0
  248. package/dist/chunk-TGK6KUGN.js +331 -0
  249. package/dist/chunk-TJSND556.js +1783 -0
  250. package/dist/chunk-TKOJZQAJ.js +24 -0
  251. package/dist/chunk-TM4OC53S.js +97 -0
  252. package/dist/chunk-TNEHPP3H.js +18 -0
  253. package/dist/chunk-TWOREVKJ.js +1760 -0
  254. package/dist/chunk-TXS3U77A.js +60 -0
  255. package/dist/chunk-UB6ODJHO.js +134 -0
  256. package/dist/chunk-UBZXQIDR.js +24 -0
  257. package/dist/chunk-ULTSSIOU.js +38 -0
  258. package/dist/chunk-UMDEWWXT.js +33 -0
  259. package/dist/chunk-V6O6KVOA.js +347 -0
  260. package/dist/chunk-VABRPZVC.js +43 -0
  261. package/dist/chunk-VDAKTZQP.js +18 -0
  262. package/dist/chunk-VDAZPGR2.js +79 -0
  263. package/dist/chunk-VERLFNWR.js +25 -0
  264. package/dist/chunk-VH2UUU7K.js +24 -0
  265. package/dist/chunk-VJ3FCGQF.js +12 -0
  266. package/dist/chunk-VK5ZDV67.js +47 -0
  267. package/dist/chunk-VKQNDOAI.js +40 -0
  268. package/dist/chunk-VTEV3WVF.js +690 -0
  269. package/dist/chunk-VXZFQKBJ.js +21 -0
  270. package/dist/chunk-WI5ITCOH.js +22 -0
  271. package/dist/chunk-WLZ54FWG.js +120 -0
  272. package/dist/chunk-WYJEOMNY.js +31 -0
  273. package/dist/chunk-WZGJSQKN.js +29 -0
  274. package/dist/chunk-WZL4EEBS.js +11 -0
  275. package/dist/chunk-X4YNDLVA.js +54 -0
  276. package/dist/chunk-X6SUFTD7.js +17 -0
  277. package/dist/chunk-XB4KZ6WO.js +81 -0
  278. package/dist/chunk-XJI6SWFS.js +569 -0
  279. package/dist/chunk-XJP5DKIL.js +29 -0
  280. package/dist/chunk-XN4ARQ2W.js +47 -0
  281. package/dist/chunk-XN7MQO45.js +359 -0
  282. package/dist/chunk-XQCQZBGX.js +100 -0
  283. package/dist/chunk-XXOHXA3A.js +69 -0
  284. package/dist/chunk-XZOHR765.js +127 -0
  285. package/dist/chunk-YCNLQYTC.js +133 -0
  286. package/dist/chunk-YCRGWQBS.js +526 -0
  287. package/dist/chunk-YF2PYLC4.js +210 -0
  288. package/dist/chunk-YG5GUELW.js +935 -0
  289. package/dist/chunk-YS6KMYM4.js +91 -0
  290. package/dist/chunk-YWP7XFKD.js +12 -0
  291. package/dist/chunk-Z2MGTKDR.js +20 -0
  292. package/dist/chunk-Z6CL7AR6.js +24 -0
  293. package/dist/chunk-Z7X3RGGA.js +22 -0
  294. package/dist/chunk-ZF43WRG3.js +29 -0
  295. package/dist/chunk-ZMF7WEGG.js +60 -0
  296. package/dist/chunk-ZNHFLJSY.js +375 -0
  297. package/dist/chunk-ZQ4VFQID.js +76 -0
  298. package/dist/chunk-ZQF34VPS.js +72 -0
  299. package/dist/chunk-ZU425HNM.js +24 -0
  300. package/dist/chunk-ZZU5R5UU.js +24 -0
  301. package/dist/cli/index.js +9 -0
  302. package/dist/core-3VCCUFVX.js +32 -0
  303. package/dist/core-4BZQQSHS.js +33 -0
  304. package/dist/core-4VT4MHNB.js +38 -0
  305. package/dist/core-5535KXRD.js +40 -0
  306. package/dist/core-5HQBPCHL.js +35 -0
  307. package/dist/core-6RYHWUJO.js +35 -0
  308. package/dist/core-7BZJCIXN.js +35 -0
  309. package/dist/core-AJTVU6X7.js +37 -0
  310. package/dist/core-C6YUSTZI.js +57 -0
  311. package/dist/core-EEB7HTCL.js +33 -0
  312. package/dist/core-EFMVDWNH.js +38 -0
  313. package/dist/core-ETAGQBZO.js +34 -0
  314. package/dist/core-FVR3WZEC.js +36 -0
  315. package/dist/core-GCTFVYMH.js +29 -0
  316. package/dist/core-GES44OTS.js +33 -0
  317. package/dist/core-GGQREDSI.js +47 -0
  318. package/dist/core-HRYOV6QD.js +38 -0
  319. package/dist/core-IKD3EE3S.js +38 -0
  320. package/dist/core-JM4R426L.js +32 -0
  321. package/dist/core-KKQS3WI2.js +40 -0
  322. package/dist/core-LA6XDYG7.js +40 -0
  323. package/dist/core-MJ7JWQT5.js +37 -0
  324. package/dist/core-MLROKJ2M.js +53 -0
  325. package/dist/core-MR52YBRX.js +31 -0
  326. package/dist/core-NP4VHWXL.js +29 -0
  327. package/dist/core-NQLNZDX5.js +41 -0
  328. package/dist/core-NSIJEKLI.js +44 -0
  329. package/dist/core-OJUQLIQ5.js +35 -0
  330. package/dist/core-PB3VUQSS.js +32 -0
  331. package/dist/core-Q6VLFFYC.js +56 -0
  332. package/dist/core-QY7AVIKZ.js +51 -0
  333. package/dist/core-SBQMHWTA.js +52 -0
  334. package/dist/core-UHECQHJ2.js +38 -0
  335. package/dist/core-V5FV4NWL.js +56 -0
  336. package/dist/core-WGM4XUN3.js +58 -0
  337. package/dist/core-WUQVFARS.js +34 -0
  338. package/dist/core-Z2F3IGSR.js +42 -0
  339. package/dist/dataTable-3CPPIHB3.js +58 -0
  340. package/dist/engine-FXFBCWHB.js +961 -0
  341. package/dist/fixtures.d.ts +1 -0
  342. package/dist/fixtures.js +41 -0
  343. package/dist/fontTables-WYCZNRE7.js +18 -0
  344. package/dist/fonts.d.ts +1 -0
  345. package/dist/fonts.js +19 -0
  346. package/dist/geo/dach.d.ts +1 -0
  347. package/dist/geo/dach.js +14 -0
  348. package/dist/geo/de-states.d.ts +1 -0
  349. package/dist/geo/de-states.js +14 -0
  350. package/dist/geo/eu27.d.ts +1 -0
  351. package/dist/geo/eu27.js +14 -0
  352. package/dist/geo/europe.d.ts +1 -0
  353. package/dist/geo/europe.js +14 -0
  354. package/dist/geo/index.d.ts +1 -0
  355. package/dist/geo/index.js +41 -0
  356. package/dist/geo/us-states.d.ts +1 -0
  357. package/dist/geo/us-states.js +14 -0
  358. package/dist/geo/world.d.ts +1 -0
  359. package/dist/geo/world.js +14 -0
  360. package/dist/index.d.ts +1 -0
  361. package/dist/index.js +364 -0
  362. package/dist/main-YLKBTHJP.js +569 -0
  363. package/dist/mcp/server.js +1025 -0
  364. package/dist/module-SVEW5ZUE.js +137233 -0
  365. package/dist/react/bar.d.ts +1 -0
  366. package/dist/react/bar.js +81 -0
  367. package/dist/react/bartable.d.ts +1 -0
  368. package/dist/react/bartable.js +70 -0
  369. package/dist/react/box.d.ts +1 -0
  370. package/dist/react/box.js +65 -0
  371. package/dist/react/bullet.d.ts +1 -0
  372. package/dist/react/bullet.js +72 -0
  373. package/dist/react/butterfly.d.ts +1 -0
  374. package/dist/react/butterfly.js +66 -0
  375. package/dist/react/choropleth.d.ts +1 -0
  376. package/dist/react/choropleth.js +67 -0
  377. package/dist/react/cohort.d.ts +1 -0
  378. package/dist/react/cohort.js +70 -0
  379. package/dist/react/column.d.ts +1 -0
  380. package/dist/react/column.js +86 -0
  381. package/dist/react/combo.d.ts +1 -0
  382. package/dist/react/combo.js +86 -0
  383. package/dist/react/creative.d.ts +1 -0
  384. package/dist/react/creative.js +61 -0
  385. package/dist/react/diagram.d.ts +1 -0
  386. package/dist/react/diagram.js +60 -0
  387. package/dist/react/dimswitch.d.ts +1 -0
  388. package/dist/react/dimswitch.js +72 -0
  389. package/dist/react/dot.d.ts +1 -0
  390. package/dist/react/dot.js +70 -0
  391. package/dist/react/export.d.ts +1 -0
  392. package/dist/react/export.js +658 -0
  393. package/dist/react/funnel.d.ts +1 -0
  394. package/dist/react/funnel.js +63 -0
  395. package/dist/react/gantt.d.ts +1 -0
  396. package/dist/react/gantt.js +62 -0
  397. package/dist/react/grid.d.ts +1 -0
  398. package/dist/react/grid.js +67 -0
  399. package/dist/react/heatmap.d.ts +1 -0
  400. package/dist/react/heatmap.js +68 -0
  401. package/dist/react/histogram.d.ts +1 -0
  402. package/dist/react/histogram.js +86 -0
  403. package/dist/react/index.d.ts +1 -0
  404. package/dist/react/index.js +504 -0
  405. package/dist/react/kpi.d.ts +1 -0
  406. package/dist/react/kpi.js +67 -0
  407. package/dist/react/likert.d.ts +1 -0
  408. package/dist/react/likert.js +83 -0
  409. package/dist/react/line.d.ts +1 -0
  410. package/dist/react/line.js +81 -0
  411. package/dist/react/mekko.d.ts +1 -0
  412. package/dist/react/mekko.js +71 -0
  413. package/dist/react/pareto.d.ts +1 -0
  414. package/dist/react/pareto.js +90 -0
  415. package/dist/react/pie.d.ts +1 -0
  416. package/dist/react/pie.js +64 -0
  417. package/dist/react/prepare.d.ts +1 -0
  418. package/dist/react/prepare.js +278 -0
  419. package/dist/react/pvm.d.ts +1 -0
  420. package/dist/react/pvm.js +68 -0
  421. package/dist/react/pyramid.d.ts +1 -0
  422. package/dist/react/pyramid.js +67 -0
  423. package/dist/react/sankey.d.ts +1 -0
  424. package/dist/react/sankey.js +59 -0
  425. package/dist/react/scatter.d.ts +1 -0
  426. package/dist/react/scatter.js +63 -0
  427. package/dist/react/slope.d.ts +1 -0
  428. package/dist/react/slope.js +64 -0
  429. package/dist/react/sparkline.d.ts +1 -0
  430. package/dist/react/sparkline.js +59 -0
  431. package/dist/react/spec.d.ts +1 -0
  432. package/dist/react/spec.js +379 -0
  433. package/dist/react/status.d.ts +1 -0
  434. package/dist/react/status.js +64 -0
  435. package/dist/react/story.d.ts +1 -0
  436. package/dist/react/story.js +140 -0
  437. package/dist/react/table.d.ts +1 -0
  438. package/dist/react/table.js +69 -0
  439. package/dist/react/theme.d.ts +1 -0
  440. package/dist/react/theme.js +53 -0
  441. package/dist/react/tilemap.d.ts +1 -0
  442. package/dist/react/tilemap.js +66 -0
  443. package/dist/react/treemap.d.ts +1 -0
  444. package/dist/react/treemap.js +61 -0
  445. package/dist/react/variance.d.ts +1 -0
  446. package/dist/react/variance.js +65 -0
  447. package/dist/react/waffle.d.ts +1 -0
  448. package/dist/react/waffle.js +62 -0
  449. package/dist/react/waterfall.d.ts +1 -0
  450. package/dist/react/waterfall.js +68 -0
  451. package/dist/resvg-ZOVDIZTV.js +23 -0
  452. package/dist/rows.d.ts +1 -0
  453. package/dist/rows.js +23 -0
  454. package/dist/rowsModule-YVLAROIP.js +27 -0
  455. package/dist/schema-2K6C3U24.js +23 -0
  456. package/dist/schema-2KIHLTYI.js +23 -0
  457. package/dist/schema-4HY2MWZC.js +30 -0
  458. package/dist/schema-4S5CXHAO.js +24 -0
  459. package/dist/schema-5BKQV56C.js +27 -0
  460. package/dist/schema-5HA5DSYN.js +24 -0
  461. package/dist/schema-5NKJPSBD.js +23 -0
  462. package/dist/schema-65FOKNHK.js +43 -0
  463. package/dist/schema-6OHZWHUI.js +23 -0
  464. package/dist/schema-6RYJS2GM.js +24 -0
  465. package/dist/schema-6W4M3WJ4.js +23 -0
  466. package/dist/schema-7TLSFG6M.js +24 -0
  467. package/dist/schema-AMFRKUFS.js +27 -0
  468. package/dist/schema-B7CZPPB4.js +28 -0
  469. package/dist/schema-BNRNHGHQ.js +26 -0
  470. package/dist/schema-E4MRCGPZ.js +24 -0
  471. package/dist/schema-F3WYTR65.js +26 -0
  472. package/dist/schema-FA6XIHTW.js +23 -0
  473. package/dist/schema-GZNOW4LX.js +23 -0
  474. package/dist/schema-HEIDGCSL.js +23 -0
  475. package/dist/schema-JB2H6KPA.js +23 -0
  476. package/dist/schema-MPXZNWV3.js +23 -0
  477. package/dist/schema-NHNQK6XO.js +23 -0
  478. package/dist/schema-NN6UPDPW.js +23 -0
  479. package/dist/schema-O4YNAGIY.js +23 -0
  480. package/dist/schema-O7AKK232.js +29 -0
  481. package/dist/schema-OJCML6LV.js +24 -0
  482. package/dist/schema-ORTRMYI6.js +24 -0
  483. package/dist/schema-PJ6P52BC.js +23 -0
  484. package/dist/schema-RTWES6NR.js +24 -0
  485. package/dist/schema-S36SRYGO.js +24 -0
  486. package/dist/schema-S3TCLTYD.js +23 -0
  487. package/dist/schema-SWWMOLOR.js +54 -0
  488. package/dist/schema-WOSEZNKG.js +26 -0
  489. package/dist/schema-Y6KBWUUR.js +23 -0
  490. package/dist/schema-YQYTLKSW.js +23 -0
  491. package/dist/schema-ZUUUY3QS.js +33 -0
  492. package/dist/specValidation-VNWIKLHH.js +49 -0
  493. package/dist/theme.d.ts +1 -0
  494. package/dist/theme.js +24 -0
  495. package/dist/themeShapeRules-2D3KWSPQ.js +11 -0
  496. package/dist/types/core/a11y/accessibility.d.ts +43 -0
  497. package/dist/types/core/a11y/recordsShared.d.ts +44 -0
  498. package/dist/types/core/a11y/structuralRecords.d.ts +6 -0
  499. package/dist/types/core/a11y/types.d.ts +116 -0
  500. package/dist/types/core/annotate.d.ts +300 -0
  501. package/dist/types/core/annotateArms.d.ts +37 -0
  502. package/dist/types/core/annotateFields.d.ts +30 -0
  503. package/dist/types/core/annotateGapBracket.d.ts +66 -0
  504. package/dist/types/core/annotateLinks.d.ts +47 -0
  505. package/dist/types/core/annotateTargets.d.ts +90 -0
  506. package/dist/types/core/axis.d.ts +179 -0
  507. package/dist/types/core/bandSelect.d.ts +10 -0
  508. package/dist/types/core/bands.d.ts +14 -0
  509. package/dist/types/core/calendarLabels.d.ts +101 -0
  510. package/dist/types/core/charts/band/stacks.d.ts +155 -0
  511. package/dist/types/core/charts/bar/fixtures.d.ts +9 -0
  512. package/dist/types/core/charts/bar/layout.d.ts +95 -0
  513. package/dist/types/core/charts/bartable/fixtures.d.ts +4 -0
  514. package/dist/types/core/charts/bartable/types.d.ts +192 -0
  515. package/dist/types/core/charts/box/fixtures.d.ts +12 -0
  516. package/dist/types/core/charts/box/types.d.ts +110 -0
  517. package/dist/types/core/charts/bullet/fixtures.d.ts +11 -0
  518. package/dist/types/core/charts/butterfly/fixtures.d.ts +9 -0
  519. package/dist/types/core/charts/choropleth/fixtures.d.ts +3 -0
  520. package/dist/types/core/charts/choropleth/overlayTypes.d.ts +68 -0
  521. package/dist/types/core/charts/choropleth/types.d.ts +117 -0
  522. package/dist/types/core/charts/cohort/fixtures.d.ts +12 -0
  523. package/dist/types/core/charts/cohort/types.d.ts +165 -0
  524. package/dist/types/core/charts/column/anomaly.d.ts +204 -0
  525. package/dist/types/core/charts/column/fixtures.d.ts +12 -0
  526. package/dist/types/core/charts/column/layout.d.ts +116 -0
  527. package/dist/types/core/charts/column/model.d.ts +295 -0
  528. package/dist/types/core/charts/column/types.d.ts +56 -0
  529. package/dist/types/core/charts/combo/endpoints.d.ts +165 -0
  530. package/dist/types/core/charts/combo/fixtures.d.ts +12 -0
  531. package/dist/types/core/charts/combo/layout.d.ts +48 -0
  532. package/dist/types/core/charts/creative/fixtures.d.ts +4 -0
  533. package/dist/types/core/charts/creative/types.d.ts +73 -0
  534. package/dist/types/core/charts/diagram/fixtures.d.ts +3 -0
  535. package/dist/types/core/charts/dimswitch/compile.d.ts +20 -0
  536. package/dist/types/core/charts/dimswitch/fixtures.d.ts +3 -0
  537. package/dist/types/core/charts/dimswitch/types.d.ts +152 -0
  538. package/dist/types/core/charts/dot/fixtures.d.ts +11 -0
  539. package/dist/types/core/charts/funnel/fixtures.d.ts +11 -0
  540. package/dist/types/core/charts/gantt/fixtures.d.ts +9 -0
  541. package/dist/types/core/charts/gantt/layout.d.ts +63 -0
  542. package/dist/types/core/charts/grid/fixtures.d.ts +3 -0
  543. package/dist/types/core/charts/grid/metricStack.d.ts +108 -0
  544. package/dist/types/core/charts/grid/metricStackSchema.d.ts +74 -0
  545. package/dist/types/core/charts/grid/normalize.d.ts +99 -0
  546. package/dist/types/core/charts/grid/schema.d.ts +168 -0
  547. package/dist/types/core/charts/heatmap/fixtures.d.ts +11 -0
  548. package/dist/types/core/charts/histogram/fixtures.d.ts +15 -0
  549. package/dist/types/core/charts/histogram/types.d.ts +98 -0
  550. package/dist/types/core/charts/kpi/fixtures.d.ts +9 -0
  551. package/dist/types/core/charts/likert/fixtures.d.ts +11 -0
  552. package/dist/types/core/charts/likert/layout.d.ts +111 -0
  553. package/dist/types/core/charts/line/fixtures.d.ts +16 -0
  554. package/dist/types/core/charts/line/types.d.ts +6 -0
  555. package/dist/types/core/charts/mekko/fixtures.d.ts +13 -0
  556. package/dist/types/core/charts/pareto/fixtures.d.ts +5 -0
  557. package/dist/types/core/charts/pareto/layout.d.ts +68 -0
  558. package/dist/types/core/charts/pie/fixtures.d.ts +14 -0
  559. package/dist/types/core/charts/pvm/fixtures.d.ts +13 -0
  560. package/dist/types/core/charts/pvm/types.d.ts +118 -0
  561. package/dist/types/core/charts/pyramid/fixtures.d.ts +4 -0
  562. package/dist/types/core/charts/pyramid/types.d.ts +92 -0
  563. package/dist/types/core/charts/sankey/fixtures.d.ts +4 -0
  564. package/dist/types/core/charts/sankey/types.d.ts +116 -0
  565. package/dist/types/core/charts/scatter/fixtures.d.ts +12 -0
  566. package/dist/types/core/charts/scatter/types.d.ts +58 -0
  567. package/dist/types/core/charts/slope/fixtures.d.ts +13 -0
  568. package/dist/types/core/charts/sparkline/fixtures.d.ts +9 -0
  569. package/dist/types/core/charts/status/fixtures.d.ts +8 -0
  570. package/dist/types/core/charts/status/layout.d.ts +71 -0
  571. package/dist/types/core/charts/table/fitFormats.d.ts +67 -0
  572. package/dist/types/core/charts/table/fixtures.d.ts +7 -0
  573. package/dist/types/core/charts/table/resolve.d.ts +72 -0
  574. package/dist/types/core/charts/table/view.d.ts +156 -0
  575. package/dist/types/core/charts/tilemap/fixtures.d.ts +3 -0
  576. package/dist/types/core/charts/tilemap/types.d.ts +94 -0
  577. package/dist/types/core/charts/treemap/fixtures.d.ts +4 -0
  578. package/dist/types/core/charts/treemap/types.d.ts +78 -0
  579. package/dist/types/core/charts/variance/fixtures.d.ts +12 -0
  580. package/dist/types/core/charts/waffle/fixtures.d.ts +5 -0
  581. package/dist/types/core/charts/waffle/types.d.ts +117 -0
  582. package/dist/types/core/charts/waterfall/fixtures.d.ts +9 -0
  583. package/dist/types/core/claims/browser.d.ts +49 -0
  584. package/dist/types/core/claims/manifest.d.ts +22 -0
  585. package/dist/types/core/dateFormat.d.ts +39 -0
  586. package/dist/types/core/deferred.d.ts +121 -0
  587. package/dist/types/core/diagnostics/describe.d.ts +149 -0
  588. package/dist/types/core/diagnostics/jsonPatch.d.ts +36 -0
  589. package/dist/types/core/doc/bareChart.d.ts +2 -0
  590. package/dist/types/core/doc/diagnostics.d.ts +124 -0
  591. package/dist/types/core/doc/docExpand.d.ts +39 -0
  592. package/dist/types/core/doc/document.d.ts +43 -0
  593. package/dist/types/core/doc/ownedDocumentCopy.d.ts +5 -0
  594. package/dist/types/core/doc/specError.d.ts +6 -0
  595. package/dist/types/core/emptyData.d.ts +27 -0
  596. package/dist/types/core/eventLane.d.ts +208 -0
  597. package/dist/types/core/fontMetrics/index.d.ts +47 -0
  598. package/dist/types/core/fontMetrics/injected.d.ts +40 -0
  599. package/dist/types/core/fontMetrics/tableDocument.d.ts +73 -0
  600. package/dist/types/core/fontMetrics/tables.generated.d.ts +17 -0
  601. package/dist/types/core/footer.d.ts +59 -0
  602. package/dist/types/core/format.d.ts +149 -0
  603. package/dist/types/core/formatPrecision.d.ts +136 -0
  604. package/dist/types/core/formatSpec.d.ts +304 -0
  605. package/dist/types/core/frame.d.ts +583 -0
  606. package/dist/types/core/geo/packs/all.d.ts +7 -0
  607. package/dist/types/core/geo/packs/dach.d.ts +16 -0
  608. package/dist/types/core/geo/packs/de-states.d.ts +16 -0
  609. package/dist/types/core/geo/packs/eu27.d.ts +16 -0
  610. package/dist/types/core/geo/packs/europe.d.ts +16 -0
  611. package/dist/types/core/geo/packs/index.d.ts +22 -0
  612. package/dist/types/core/geo/packs/registry.d.ts +37 -0
  613. package/dist/types/core/geo/packs/us-states.d.ts +16 -0
  614. package/dist/types/core/geo/packs/world.d.ts +16 -0
  615. package/dist/types/core/geo/tiles/eu27.generated.d.ts +412 -0
  616. package/dist/types/core/geo/tiles/europe.generated.d.ts +842 -0
  617. package/dist/types/core/geo/tiles/index.d.ts +8 -0
  618. package/dist/types/core/geo/tiles/types.d.ts +36 -0
  619. package/dist/types/core/geo/tiles/us-states.generated.d.ts +952 -0
  620. package/dist/types/core/geo/tiles/world.generated.d.ts +968 -0
  621. package/dist/types/core/geo/types.d.ts +146 -0
  622. package/dist/types/core/geometry.d.ts +102 -0
  623. package/dist/types/core/grid/sharedScale.d.ts +82 -0
  624. package/dist/types/core/icons.d.ts +227 -0
  625. package/dist/types/core/inputError.d.ts +14 -0
  626. package/dist/types/core/isoDate.d.ts +2 -0
  627. package/dist/types/core/isoTime.d.ts +7 -0
  628. package/dist/types/core/label/categoryRow.d.ts +332 -0
  629. package/dist/types/core/label/occupied.d.ts +41 -0
  630. package/dist/types/core/label/ownership.d.ts +83 -0
  631. package/dist/types/core/label/solver.d.ts +384 -0
  632. package/dist/types/core/label/tickRow.d.ts +78 -0
  633. package/dist/types/core/live/types.d.ts +50 -0
  634. package/dist/types/core/normalize/shared.d.ts +56 -0
  635. package/dist/types/core/notes.d.ts +174 -0
  636. package/dist/types/core/othersShade.d.ts +9 -0
  637. package/dist/types/core/periodYears.d.ts +9 -0
  638. package/dist/types/core/polyline.d.ts +11 -0
  639. package/dist/types/core/rangeRules.d.ts +19 -0
  640. package/dist/types/core/ratioTier.d.ts +120 -0
  641. package/dist/types/core/readerStrings.d.ts +13 -0
  642. package/dist/types/core/reading.d.ts +120 -0
  643. package/dist/types/core/registry.d.ts +178 -0
  644. package/dist/types/core/repaintGeometry.d.ts +19 -0
  645. package/dist/types/core/request.d.ts +124 -0
  646. package/dist/types/core/rows.d.ts +47 -0
  647. package/dist/types/core/scale.d.ts +106 -0
  648. package/dist/types/core/schema/capability.d.ts +229 -0
  649. package/dist/types/core/schema/namedColumns.d.ts +45 -0
  650. package/dist/types/core/schema/reference.d.ts +31 -0
  651. package/dist/types/core/schema/refusals.d.ts +45 -0
  652. package/dist/types/core/schema/unknownKeys.d.ts +45 -0
  653. package/dist/types/core/seriesIdentity.d.ts +120 -0
  654. package/dist/types/core/shareRounding.d.ts +49 -0
  655. package/dist/types/core/sizing.d.ts +330 -0
  656. package/dist/types/core/staticFooter.d.ts +6 -0
  657. package/dist/types/core/story.d.ts +41 -0
  658. package/dist/types/core/structureCounts.d.ts +10 -0
  659. package/dist/types/core/svg/renderSvg.d.ts +51 -0
  660. package/dist/types/core/target.d.ts +89 -0
  661. package/dist/types/core/text.d.ts +113 -0
  662. package/dist/types/core/theme.d.ts +478 -0
  663. package/dist/types/core/themeFields.d.ts +11 -0
  664. package/dist/types/core/themeRules.d.ts +111 -0
  665. package/dist/types/core/themeShape.d.ts +87 -0
  666. package/dist/types/core/themeValidate.d.ts +15 -0
  667. package/dist/types/core/timeAxis.d.ts +106 -0
  668. package/dist/types/core/types/annotations.d.ts +227 -0
  669. package/dist/types/core/types/cell.d.ts +82 -0
  670. package/dist/types/core/types/data.d.ts +314 -0
  671. package/dist/types/core/types/diagram.d.ts +234 -0
  672. package/dist/types/core/types/index.d.ts +8 -0
  673. package/dist/types/core/types/options.d.ts +1583 -0
  674. package/dist/types/core/types/scene.d.ts +990 -0
  675. package/dist/types/core/types/sizing.d.ts +51 -0
  676. package/dist/types/core/types/table.d.ts +873 -0
  677. package/dist/types/core/types/theme.d.ts +806 -0
  678. package/dist/types/core/zoom.d.ts +106 -0
  679. package/dist/types/fixtures/index.d.ts +40 -0
  680. package/dist/types/fixtures/registry.d.ts +15 -0
  681. package/dist/types/fonts.d.ts +10 -0
  682. package/dist/types/index.d.ts +70 -0
  683. package/dist/types/react/BoardplotTheme.d.ts +9 -0
  684. package/dist/types/react/DimSwitchChart.d.ts +36 -0
  685. package/dist/types/react/ScaleGroup.d.ts +31 -0
  686. package/dist/types/react/SceneRenderer.d.ts +23 -0
  687. package/dist/types/react/SizePlaceholder.d.ts +51 -0
  688. package/dist/types/react/StoryFrame.d.ts +42 -0
  689. package/dist/types/react/TableChart.d.ts +220 -0
  690. package/dist/types/react/a11ySurface.d.ts +20 -0
  691. package/dist/types/react/barrelCharts.d.ts +1023 -0
  692. package/dist/types/react/charts/bar.d.ts +28 -0
  693. package/dist/types/react/charts/bartable.d.ts +27 -0
  694. package/dist/types/react/charts/box.d.ts +27 -0
  695. package/dist/types/react/charts/bullet.d.ts +28 -0
  696. package/dist/types/react/charts/butterfly.d.ts +28 -0
  697. package/dist/types/react/charts/choropleth.d.ts +27 -0
  698. package/dist/types/react/charts/cohort.d.ts +52 -0
  699. package/dist/types/react/charts/column.d.ts +27 -0
  700. package/dist/types/react/charts/combo.d.ts +7 -0
  701. package/dist/types/react/charts/creative.d.ts +27 -0
  702. package/dist/types/react/charts/diagram.d.ts +162 -0
  703. package/dist/types/react/charts/dimswitch.d.ts +6 -0
  704. package/dist/types/react/charts/dot.d.ts +28 -0
  705. package/dist/types/react/charts/funnel.d.ts +28 -0
  706. package/dist/types/react/charts/gantt.d.ts +28 -0
  707. package/dist/types/react/charts/grid.d.ts +29 -0
  708. package/dist/types/react/charts/heatmap.d.ts +28 -0
  709. package/dist/types/react/charts/histogram.d.ts +27 -0
  710. package/dist/types/react/charts/kpi.d.ts +28 -0
  711. package/dist/types/react/charts/likert.d.ts +27 -0
  712. package/dist/types/react/charts/line.d.ts +28 -0
  713. package/dist/types/react/charts/mekko.d.ts +28 -0
  714. package/dist/types/react/charts/pareto.d.ts +28 -0
  715. package/dist/types/react/charts/pie.d.ts +28 -0
  716. package/dist/types/react/charts/pvm.d.ts +27 -0
  717. package/dist/types/react/charts/pyramid.d.ts +27 -0
  718. package/dist/types/react/charts/sankey.d.ts +27 -0
  719. package/dist/types/react/charts/scatter.d.ts +28 -0
  720. package/dist/types/react/charts/slope.d.ts +28 -0
  721. package/dist/types/react/charts/sparkline.d.ts +28 -0
  722. package/dist/types/react/charts/status.d.ts +27 -0
  723. package/dist/types/react/charts/table.d.ts +6 -0
  724. package/dist/types/react/charts/tilemap.d.ts +27 -0
  725. package/dist/types/react/charts/treemap.d.ts +27 -0
  726. package/dist/types/react/charts/variance.d.ts +28 -0
  727. package/dist/types/react/charts/waffle.d.ts +28 -0
  728. package/dist/types/react/charts/waterfall.d.ts +28 -0
  729. package/dist/types/react/createChartComponent.d.ts +135 -0
  730. package/dist/types/react/export/clipboard.d.ts +8 -0
  731. package/dist/types/react/export/csv.d.ts +2 -0
  732. package/dist/types/react/export/frame.d.ts +35 -0
  733. package/dist/types/react/export/index.d.ts +7 -0
  734. package/dist/types/react/export/png.d.ts +14 -0
  735. package/dist/types/react/export/svg.d.ts +5 -0
  736. package/dist/types/react/export/types.d.ts +69 -0
  737. package/dist/types/react/export/useExport.d.ts +17 -0
  738. package/dist/types/react/exportLink.d.ts +49 -0
  739. package/dist/types/react/footerFrame.d.ts +25 -0
  740. package/dist/types/react/hover/dataTable.d.ts +13 -0
  741. package/dist/types/react/hover/engine.d.ts +210 -0
  742. package/dist/types/react/hover/keyboard.d.ts +44 -0
  743. package/dist/types/react/hover/labelCard.d.ts +170 -0
  744. package/dist/types/react/hover/placement.d.ts +49 -0
  745. package/dist/types/react/index.d.ts +16 -0
  746. package/dist/types/react/parseChartSpec.d.ts +16 -0
  747. package/dist/types/react/prepare.d.ts +32 -0
  748. package/dist/types/react/prepared.d.ts +53 -0
  749. package/dist/types/react/preparedTable.d.ts +15 -0
  750. package/dist/types/react/rowsInput.d.ts +55 -0
  751. package/dist/types/react/rowsModule.d.ts +18 -0
  752. package/dist/types/react/rowsStore.d.ts +50 -0
  753. package/dist/types/react/scale-group.d.ts +2 -0
  754. package/dist/types/react/scaleGroupContext.d.ts +22 -0
  755. package/dist/types/react/scenePaint.d.ts +10 -0
  756. package/dist/types/react/scrollState.d.ts +26 -0
  757. package/dist/types/react/spec.d.ts +82 -0
  758. package/dist/types/react/specValidation.d.ts +45 -0
  759. package/dist/types/react/story.d.ts +15 -0
  760. package/dist/types/react/theme.d.ts +9 -0
  761. package/dist/types/react/themeContext.d.ts +44 -0
  762. package/dist/types/react/useChartLayout.d.ts +22 -0
  763. package/dist/types/react/useContainerSize.d.ts +57 -0
  764. package/dist/types/react/useHover.d.ts +100 -0
  765. package/dist/types/react/useZoom.d.ts +50 -0
  766. package/dist/types/rows.d.ts +63 -0
  767. package/dist/types/tableLooks.d.ts +6 -0
  768. package/dist/types/theme.d.ts +3 -0
  769. package/dist/types/validate.d.ts +3 -0
  770. package/dist/validate.d.ts +1 -0
  771. package/dist/validate.js +223 -0
  772. package/docs/FONTS.md +68 -0
  773. package/docs/TELEMETRY.md +94 -0
  774. package/docs/manual.md +850 -0
  775. package/docs/reference/bar.md +222 -0
  776. package/docs/reference/bartable.md +143 -0
  777. package/docs/reference/box.md +93 -0
  778. package/docs/reference/bullet.md +118 -0
  779. package/docs/reference/butterfly.md +117 -0
  780. package/docs/reference/choropleth.md +148 -0
  781. package/docs/reference/cohort.md +149 -0
  782. package/docs/reference/column.md +275 -0
  783. package/docs/reference/combo.md +219 -0
  784. package/docs/reference/creative.md +147 -0
  785. package/docs/reference/diagram.md +191 -0
  786. package/docs/reference/dimswitch.md +1395 -0
  787. package/docs/reference/dot.md +117 -0
  788. package/docs/reference/fixtures.md +1089 -0
  789. package/docs/reference/funnel.md +121 -0
  790. package/docs/reference/gantt.md +138 -0
  791. package/docs/reference/grid.md +302 -0
  792. package/docs/reference/heatmap.md +127 -0
  793. package/docs/reference/histogram.md +77 -0
  794. package/docs/reference/kpi.md +115 -0
  795. package/docs/reference/likert.md +113 -0
  796. package/docs/reference/line.md +436 -0
  797. package/docs/reference/mekko.md +114 -0
  798. package/docs/reference/options.md +313 -0
  799. package/docs/reference/pareto.md +102 -0
  800. package/docs/reference/pie.md +114 -0
  801. package/docs/reference/pvm.md +114 -0
  802. package/docs/reference/pyramid.md +99 -0
  803. package/docs/reference/react.md +706 -0
  804. package/docs/reference/reading.md +28 -0
  805. package/docs/reference/sankey.md +110 -0
  806. package/docs/reference/scatter.md +211 -0
  807. package/docs/reference/slope.md +126 -0
  808. package/docs/reference/sparkline.md +74 -0
  809. package/docs/reference/status.md +107 -0
  810. package/docs/reference/table.md +673 -0
  811. package/docs/reference/theme.md +361 -0
  812. package/docs/reference/tilemap.md +121 -0
  813. package/docs/reference/treemap.md +86 -0
  814. package/docs/reference/variance.md +126 -0
  815. package/docs/reference/waffle.md +106 -0
  816. package/docs/reference/waterfall.md +164 -0
  817. package/llms.txt +57 -0
  818. package/package.json +437 -4
@@ -0,0 +1,2674 @@
1
+ import {
2
+ addRatioTierRequests,
3
+ finalizeRatioTier,
4
+ prepareRatioTier,
5
+ ratioTierA11y,
6
+ ratioTierCanRender,
7
+ ratioTierMetrics,
8
+ ratioTierSpacingWarnings
9
+ } from "./chunk-4X66BTP5.js";
10
+ import {
11
+ FORCE_CATEGORY_RANKS,
12
+ STAIRCASE_MAX_PAD,
13
+ categoryNotesDiffer,
14
+ categoryRanksLint,
15
+ rankNotes,
16
+ runStaircase,
17
+ seatStaircase,
18
+ settleStaircase,
19
+ staircaseDirection,
20
+ staircaseOn,
21
+ staircaseRoom,
22
+ staircaseState,
23
+ withCategoryRanks
24
+ } from "./chunk-QO6HEXIZ.js";
25
+ import {
26
+ ANOMALY_FLAG_GAP,
27
+ ANOMALY_FLAG_H,
28
+ anomalyCorridor,
29
+ anomalyLegendItems,
30
+ anomalyReceipt,
31
+ anomalyRuleLines,
32
+ anomalyRuleReserve,
33
+ chartString as chartString2,
34
+ columnAnomalyModel,
35
+ columnCorridorPaint,
36
+ drawAnomalyRules,
37
+ emitAnomalyFlag,
38
+ refuseColumnEncodings
39
+ } from "./chunk-NQDVMUHX.js";
40
+ import {
41
+ DEFAULT_OTHERS_SHADE
42
+ } from "./chunk-RQ5DNYLG.js";
43
+ import {
44
+ applyCategoryViewport,
45
+ liveWindowOptions,
46
+ viewportMeanSpan
47
+ } from "./chunk-BWTX7LUG.js";
48
+ import {
49
+ chosenValueIndices,
50
+ emitBarMark,
51
+ groupedOffsets,
52
+ pickedValues,
53
+ rangeWhisker,
54
+ signColorOverrides,
55
+ signPaint,
56
+ stackConnectors,
57
+ totalLabelCandidates,
58
+ withValueLabelDefaults
59
+ } from "./chunk-CAQ5P4VN.js";
60
+ import {
61
+ axisBreakHeightOrderWarning,
62
+ axisBreakInvalid,
63
+ breakStyleRefusal,
64
+ stackBreakReversesOrder
65
+ } from "./chunk-LIWLBLCT.js";
66
+ import {
67
+ REFERENCE_MARKER_R,
68
+ breakAxisScale,
69
+ rankValueLabels,
70
+ referenceCasing,
71
+ referenceMarkerKey,
72
+ referenceMarkerPaint,
73
+ referenceTickGeometry,
74
+ withBandValueNotes
75
+ } from "./chunk-KSJVENRU.js";
76
+ import {
77
+ restValueHiding,
78
+ restValuesHidden
79
+ } from "./chunk-EKQK5D6G.js";
80
+ import {
81
+ cellFields,
82
+ normalizeCategorySeries
83
+ } from "./chunk-S4QSJAGY.js";
84
+ import {
85
+ resolveCellRange
86
+ } from "./chunk-VDAZPGR2.js";
87
+ import {
88
+ STACK_ROOM,
89
+ bandValueLabelUniformity,
90
+ compactValueLabelFont,
91
+ digitSeat,
92
+ digitSeatEdge,
93
+ fitsInside,
94
+ groupedValueLabelPolicy,
95
+ haloOverRules,
96
+ keepValuesWithoutAxis,
97
+ linesSize,
98
+ raiseOverRules,
99
+ segmentLabelCandidates,
100
+ segmentTooShort,
101
+ valueRowCrowded,
102
+ valueShareLines,
103
+ warnShareParts,
104
+ warnSliverLabels
105
+ } from "./chunk-27QADBDV.js";
106
+ import {
107
+ roundingUnavailable,
108
+ sumConsistentShares
109
+ } from "./chunk-24BHMKDD.js";
110
+ import {
111
+ accumulateStack,
112
+ averageMarkerLine,
113
+ averageOfUnaddedSums,
114
+ averageOfWholeShares,
115
+ compositionBasis,
116
+ grandTotalRequested,
117
+ mixedSignsWarning,
118
+ netLineName,
119
+ onePartDrawn,
120
+ overfullShareSum,
121
+ overfullWarning,
122
+ plottedMean,
123
+ printsValue,
124
+ sk,
125
+ sortSegments,
126
+ stackParts,
127
+ stackTotalFormatter,
128
+ warnIncompleteStacks
129
+ } from "./chunk-M4EUXOLU.js";
130
+ import {
131
+ valueLineExtent
132
+ } from "./chunk-QPWRHDLZ.js";
133
+ import {
134
+ isIncomplete,
135
+ warnShareRoundingDrift
136
+ } from "./chunk-5LGSRWFC.js";
137
+ import {
138
+ emitEventLane,
139
+ percentCellsOnly,
140
+ percentLevels,
141
+ runAnnotatePass,
142
+ settleEventLane
143
+ } from "./chunk-KZS46KDY.js";
144
+ import {
145
+ stepDownFont
146
+ } from "./chunk-ZQF34VPS.js";
147
+ import {
148
+ chartPalette
149
+ } from "./chunk-3QWZAEW5.js";
150
+ import {
151
+ restLabel,
152
+ restSum,
153
+ topNCut
154
+ } from "./chunk-KDMKHR5A.js";
155
+ import {
156
+ yearSpan,
157
+ yearSpanFromLabels
158
+ } from "./chunk-L3JWM7FR.js";
159
+ import {
160
+ NO_STACK_MEAN,
161
+ NO_STACK_TOTAL,
162
+ stackAdds
163
+ } from "./chunk-6KWIQ5KF.js";
164
+ import {
165
+ categoryTargetFields,
166
+ spliceAnnotationNodes
167
+ } from "./chunk-CDZHNLO6.js";
168
+ import {
169
+ BAND_PAD,
170
+ VALUE_LINE_RESERVE,
171
+ hiddenValueLineReserve
172
+ } from "./chunk-HZI56ASJ.js";
173
+ import {
174
+ structureCount
175
+ } from "./chunk-LFX7W4B7.js";
176
+ import {
177
+ emptyIdRecord
178
+ } from "./chunk-LINZPU5D.js";
179
+ import {
180
+ DIGIT_SEAT,
181
+ PLOT_FLOOR_PX,
182
+ ROTATED_NAME_AIR,
183
+ applyAxisBounds,
184
+ applyValueAxisTitleInk,
185
+ axisTitleAllowed,
186
+ bandScale,
187
+ brokenLinearScale,
188
+ categoryBreakGlyph,
189
+ categoryLineAlign,
190
+ categoryRowTop,
191
+ hangingLabelReserve,
192
+ invalidLinearBreakReason,
193
+ layoutValueAxis,
194
+ linearScale,
195
+ longDayMonths,
196
+ measureValueAxisWidth,
197
+ niceDomain,
198
+ noteName,
199
+ planCategoryRow,
200
+ planValueAxisTitle,
201
+ plotFloorRows,
202
+ plotFloorShare,
203
+ rotatedClaimRect,
204
+ rotatedLeftOverhang,
205
+ seatRoom,
206
+ valueAxisTitleBand,
207
+ valueAxisTitleRequest,
208
+ valueAxisTitleText,
209
+ valueAxisUnit,
210
+ verticalNameRect,
211
+ yearRowRequests
212
+ } from "./chunk-RL3NUWMY.js";
213
+ import {
214
+ PARTIAL_KEY,
215
+ POINTED_NOTES,
216
+ PRIORITY,
217
+ SERIES_VALUE_GAP,
218
+ TEXT_ASCENT,
219
+ authoredFootnoteCount,
220
+ authoredNotes,
221
+ categoryLabelsAndMarks,
222
+ composedTextRole,
223
+ createOccupiedIndex,
224
+ dataOrder,
225
+ fitText,
226
+ fixedPlotChrome,
227
+ frameTextOptions,
228
+ labelCtx,
229
+ labelsToNodes,
230
+ leaderTerminus,
231
+ lineBox,
232
+ normalizeLegendOption,
233
+ noteLine,
234
+ othersShadeUnavailableWarnings,
235
+ partialAxisWords,
236
+ partialFootnotes,
237
+ partialIds,
238
+ partialKeyForced,
239
+ partialLegendKeys,
240
+ partialPattern,
241
+ plotChromeFloor,
242
+ plotHeightAfter,
243
+ rectSeriesAdjacentWarnings,
244
+ saysToDate,
245
+ scenarioLegendKeys,
246
+ segmentHitsRect,
247
+ solveFrame,
248
+ solveLabels,
249
+ toDateFits,
250
+ toDateFont,
251
+ toDateLabel,
252
+ toDateRoom
253
+ } from "./chunk-SS42FJVN.js";
254
+ import {
255
+ disclosuresShown,
256
+ knownPartsLead,
257
+ rankKeyShown,
258
+ recordFreedChrome
259
+ } from "./chunk-BPKXEMRE.js";
260
+ import {
261
+ formatStatWithSpec,
262
+ formatWithSpec,
263
+ formatterFromExample,
264
+ parseFormatExample,
265
+ roundedNumber,
266
+ seriesRasterFormatter,
267
+ withChartMarks
268
+ } from "./chunk-RGZGLKFB.js";
269
+ import {
270
+ NOT_AVAILABLE,
271
+ NOT_MEANINGFUL,
272
+ cagr,
273
+ chartString,
274
+ currentSmallValues,
275
+ formatAuthoredPercent,
276
+ formatAutomaticPercent,
277
+ formatShare,
278
+ localeStrings,
279
+ notApplicableGlyph,
280
+ numberRange,
281
+ shareSetFormatter,
282
+ stringFields,
283
+ withLocaleStrings
284
+ } from "./chunk-53OYF4ZT.js";
285
+ import {
286
+ REFERENCE_LABEL_CLEARANCE,
287
+ canvasMargin,
288
+ colorRolePaints,
289
+ colorblindPaint,
290
+ contrastInkPaint,
291
+ dashToken,
292
+ effectiveFill,
293
+ emphasisWeight,
294
+ hatchGroundPaint,
295
+ headingWeight,
296
+ joinHatchPeers,
297
+ labelsOffKeepsNames,
298
+ linePath,
299
+ markRolePaint,
300
+ markRoleToken,
301
+ mutedMarkPaint,
302
+ namesOnly,
303
+ orderedRampPaint,
304
+ paintColor,
305
+ panelTypeClass,
306
+ rampSlots,
307
+ recedingSeriesId,
308
+ resolveSurface,
309
+ resolveTheme,
310
+ ribbonPath,
311
+ secondaryFont,
312
+ seriesPaint,
313
+ stackApartPaint,
314
+ stackRampPaint,
315
+ strokeToken,
316
+ textBreaksLine,
317
+ textScaleOf,
318
+ themeForWidth,
319
+ withSegmentSeams
320
+ } from "./chunk-CWDHCSL2.js";
321
+ import {
322
+ DEFAULT_TARGET,
323
+ NormalizeError,
324
+ accessibleTitle,
325
+ normalizeScenario,
326
+ resolveHighlight,
327
+ resolveSize,
328
+ scaleTextPx
329
+ } from "./chunk-SGD3ZHID.js";
330
+ import {
331
+ maxOf,
332
+ minOf,
333
+ pushAll
334
+ } from "./chunk-WYJEOMNY.js";
335
+ import {
336
+ defaultMeasurer
337
+ } from "./chunk-AG2CJ4JY.js";
338
+
339
+ // src/core/charts/column/model.ts
340
+ var PANEL_KEYED = /* @__PURE__ */ Symbol.for("boardplot.panelKeyed"), TICK_LABEL_RESERVE = /* @__PURE__ */ Symbol("tickLabelReserve"), PY_TICK_LEAD = 12;
341
+
342
+ // src/core/charts/column/domain.ts
343
+ function resolveColumnEnv(options, warnings) {
344
+ let size = resolveSize(options.size), theme = themeForWidth(resolveTheme(options.theme), panelTypeClass(options) ?? size.width), paletteRamp = chartPalette(theme, options.palette, warnings);
345
+ return {
346
+ options,
347
+ theme,
348
+ palette: paletteRamp ? options.palette : void 0,
349
+ size,
350
+ measure: options.measure ?? defaultMeasurer,
351
+ pctFmt: options.shareLabels?.format ? formatterFromExample(options.shareLabels.format, options.locale?.language) : (p) => formatShare(p, options.locale?.language),
352
+ authoredPctFmt: (p) => formatAuthoredPercent(p, options.locale?.language),
353
+ highlights: new Set(resolveHighlight(options.highlight)),
354
+ density: options.labelDensity ?? "smart"
355
+ };
356
+ }
357
+ function kindSetting(options, kind) {
358
+ let l = options.labels;
359
+ if (l === !1) return kind === "category" && labelsOffKeepsNames(options);
360
+ let v = l?.[kind];
361
+ return v === void 0 ? !0 : v;
362
+ }
363
+ function pyTickKeyed(domain, legend) {
364
+ let ref = domain.pyRef;
365
+ return !ref || kindSetting(domain.options, "tick") !== !0 ? !1 : legend?.items.some((item) => item.id === ref.id) === !0 || domain.options[PANEL_KEYED] === !0;
366
+ }
367
+ function contentOf(options, kind, dflt) {
368
+ let s = kindSetting(options, kind);
369
+ return s === !1 ? null : Array.isArray(s) ? s : dflt;
370
+ }
371
+ function toDateOnValues(domain) {
372
+ let ids = /* @__PURE__ */ new Set(), { options, cats, dataSeries, variant } = domain;
373
+ if (partialKeyForced(options) || !cats.some((c) => c.partial === !0)) return ids;
374
+ let words = options.strings?.toDate ?? chartString(options, "toDate");
375
+ if (!toDateFits(words, domain.theme, domain.measure, domain.size.width / Math.max(1, cats.length))) return ids;
376
+ let grouped = variant === "grouped", segments = dataSeries.length > 1 && contentOf(options, "segment", ["absolute"]) !== null, content = grouped ? contentOf(options, "point", ["absolute"]) : domain.gtContent;
377
+ if (dataSeries.length === 0 || variant === "stacked100" || (grouped ? dataSeries.length > 1 : segments) || !content?.includes("absolute")) return ids;
378
+ let only = dataSeries[0], picked = grouped && options.valueLabels !== void 0 ? chosenValueIndices(options.valueLabels, cats.map((_, ci) => only.vals[ci]?.v ?? null)) : void 0;
379
+ return cats.forEach((c, ci) => {
380
+ if (c.partial !== !0 || saysToDate(c.label ?? c.id, words) || domain.mixedSignCats.has(c.id) || (grouped ? only.vals[ci]?.v === null || only.vals[ci]?.v === void 0 : !domain.stacks[ci].hasValue) || (grouped ? only.vals[ci].v < 0 : !(domain.posTopP[ci] > 0 || domain.negBotP[ci] === 0)) || picked && !picked.has(ci) && typeof only.vals[ci]?.labelOverride != "string") return;
381
+ let populated = dataSeries.filter((s) => s.vals[ci]?.v !== null && s.vals[ci]?.v !== void 0), override = populated.length === 1 ? populated[0].vals[ci].labelOverride : void 0;
382
+ override === !1 || typeof override == "string" && override.trim() === "" || ids.add(c.id);
383
+ }), ids;
384
+ }
385
+ function partialNamedOnValues(domain) {
386
+ let named = toDateOnValues(domain);
387
+ return named.size > 0 && domain.cats.every((c, ci) => c.partial !== !0 || named.has(c.id) || (domain.variant === "grouped" ? domain.dataSeries.every((s) => s.vals[ci]?.v === null || s.vals[ci]?.v === void 0) : !domain.stacks[ci].hasValue));
388
+ }
389
+ function normalizeColumnData(data, warnings) {
390
+ let { cats, series } = normalizeCategorySeries("column", data, (s, cells, cats2) => ({
391
+ id: s.id,
392
+ label: s.label ?? s.id,
393
+ role: s.role ?? "data",
394
+ scenario: normalizeScenario(s.scenario, `series[${s.id}].scenario`),
395
+ direction: s.direction ?? "higherIsBetter",
396
+ colorRole: s.colorRole,
397
+ fill: s.fill,
398
+ format: s.format,
399
+ unit: s.unit,
400
+ vals: cells.map((cell, ci) => ({
401
+ ...cellFields(cell, `series[${s.id}].values[${ci}]`),
402
+ range: resolveCellRange(cell, `series[${s.id}].values[${ci}]`, warnings, { seriesId: s.id, categoryId: cats2[ci]?.id })
403
+ }))
404
+ }));
405
+ return { cats, seriesNorm: series };
406
+ }
407
+ function orderColumnCategories(options, categories, seriesNorm, series, warnings) {
408
+ let cats = categories, dataSeries = series, anomalySpec = options.anomaly;
409
+ dataSeries = sortSegments(dataSeries, options.sort?.segments, (s) => s.vals.reduce((a, x) => a + (x.v ?? 0), 0));
410
+ let catTotal = (ci) => dataSeries.reduce((a, s) => a + (s.vals[ci].v ?? 0), 0), applyOrder = (order) => {
411
+ cats = order.map((i) => cats[i]);
412
+ for (let s of seriesNorm) s.vals = order.map((i) => s.vals[i]);
413
+ }, catSort = options.sort?.categories;
414
+ if (catSort && catSort !== "sheet") {
415
+ let order = cats.map((_, i) => i);
416
+ if (catSort === "reverse") order.reverse();
417
+ else {
418
+ let dir = catSort === "asc" ? 1 : -1;
419
+ order.sort((a, b) => (catTotal(a) - catTotal(b)) * dir || a - b);
420
+ }
421
+ applyOrder(order);
422
+ }
423
+ let othersId = null, topN = anomalySpec ? void 0 : options.topN;
424
+ if (anomalySpec && options.topN && options.topN.n > 0 && cats.length > options.topN.n && warnings.push({
425
+ code: "anomaly-topn-ignored",
426
+ severity: "warn",
427
+ message: `topN ignored: an anomaly rule is computed over every period, and an aggregated '${options.topN.restLabel ?? options.strings?.others ?? "Others"}' bucket has no score`,
428
+ suggest: "drop options.topN, or drop options.anomaly and rank instead of flag"
429
+ }), topN && topN.n > 0 && cats.length > topN.n) {
430
+ let { kept: keptIdx, dropped: dropIdx } = topNCut(cats.map((_, i) => Math.abs(catTotal(i))), topN.n);
431
+ if (topN.rest === !1 || dropIdx.length === 0)
432
+ applyOrder(keptIdx);
433
+ else {
434
+ for (seriesNorm.some((series2) => dropIdx.some((i) => series2.vals[i].range)) && warnings.push({
435
+ code: "range-topn-omitted",
436
+ severity: "warn",
437
+ message: "topN Others aggregates values but not ranges; dropped-item ranges were omitted",
438
+ suggest: "set topN.rest to false or pre-aggregate a defensible range upstream"
439
+ }), othersId = "others"; cats.some((c) => c.id === othersId); ) othersId = `_${othersId}`;
440
+ let othersVals = seriesNorm.map((s) => restSum(dropIdx.map((i) => s.vals[i].v)));
441
+ applyOrder(keptIdx), cats = [...cats, { id: othersId, label: restLabel(topN, options.strings, dropIdx.length) }], seriesNorm.forEach((s, k) => {
442
+ s.vals = [...s.vals, { v: othersVals[k], isPct: !1 }];
443
+ });
444
+ }
445
+ }
446
+ return { cats, dataSeries, othersId };
447
+ }
448
+ function columnScenarios(options, variant, cats, dataSeries, refSeries, warnings) {
449
+ let stackedLike = variant !== "grouped", refStyle = options.referenceStyle ?? "tick", labelGateOpen = (kind) => options.labels !== !1 && options.labels?.[kind] !== !1, pyReferences = refSeries.filter((series) => series.scenario === "PY"), integrable = variant === "stacked" && refStyle === "tick" && options.grandTotalLabels !== !1 && labelGateOpen("grandTotal") && labelGateOpen("annotation") && labelGateOpen("tick"), pyRef = integrable && pyReferences.length === 1 ? pyReferences[0] : void 0;
450
+ integrable && pyReferences.length > 1 && warnings.push({
451
+ code: "integrated-variance-reference-ambiguous",
452
+ severity: "warn",
453
+ message: "integrated stacked variance needs exactly one PY reference; multiple PY references keep the legacy ticks without growth labels",
454
+ suggest: "Keep one PY reference series or use an explicit scaled variance tier."
455
+ });
456
+ let uniformScenario = /* @__PURE__ */ new Map();
457
+ return stackedLike && dataSeries.length > 1 && cats.forEach((cat, ci) => {
458
+ let scenarios = dataSeries.filter((s) => s.vals[ci].v !== null).map((s) => s.vals[ci].scenario ?? s.scenario), scenario = scenarios[0];
459
+ scenario !== void 0 && scenarios.every((candidate) => candidate === scenario) && uniformScenario.set(cat.id, scenario);
460
+ }), variant === "stacked100" && dataSeries.length === 1 && warnings.push({
461
+ code: "stacked100-single-series",
462
+ severity: "warn",
463
+ message: "a 100% composition of a single series is always 100% \u2014 use variant:'stacked' or 'grouped' to show the level"
464
+ }), { pyRef, uniformScenario };
465
+ }
466
+ function columnLines(options, stackedLike, dataSeries, warnings, basesGiven = !1) {
467
+ let connectorsOn = options.connectors !== void 0 && options.connectors !== !1;
468
+ connectorsOn && !stackedLike && warnings.push({
469
+ code: "connectors-ignored",
470
+ severity: "warn",
471
+ message: "connectors apply only to stacked and stacked100 column charts; ignored for grouped"
472
+ });
473
+ let connectorDashed = typeof options.connectors == "object" && options.connectors.style === "dashed", connectorScope = typeof options.connectors == "object" ? options.connectors.scope ?? "all" : "all", connectorSeries = connectorScope === "all" ? null : new Set(connectorScope), netLineRequested = options.netLine !== void 0 && options.netLine !== !1, netLineSeriesId = typeof options.netLine == "object" ? options.netLine.seriesId : void 0, netLineSteps = typeof options.netLine == "object" ? options.netLine.connectors ?? !0 : !0, netLineSeries = netLineSeriesId ? dataSeries.find((series) => series.id === netLineSeriesId) : void 0, netLineOn = netLineRequested && stackedLike;
474
+ if (netLineOn && options.variant === "stacked100" && !netLineSeriesId && !basesGiven && (netLineOn = !1, warnings.push({
475
+ code: "net-line-ignored",
476
+ severity: "warn",
477
+ message: "netLine on stacked100 marks the 100% edge every column reaches; ignored",
478
+ suggest: "remove netLine, or name the series whose share boundary it traces with netLine.seriesId",
479
+ field: ["options", "netLine"],
480
+ fix: [{ op: "remove", path: "/options/netLine" }]
481
+ })), netLineRequested && !stackedLike && warnings.push({
482
+ code: "net-line-ignored",
483
+ severity: "warn",
484
+ message: "netLine applies only to stacked and stacked100 column charts; ignored for grouped"
485
+ }), options.shareLabels !== void 0 && !stackedLike && warnings.push({
486
+ code: "share-labels-ignored",
487
+ severity: "warn",
488
+ message: "shareLabels applies only to stacked and stacked100 column charts, whose columns are wholes; ignored for grouped",
489
+ suggest: "use variant 'stacked' to print each segment's share of its column"
490
+ }), options.seriesLabels !== void 0 && !stackedLike && warnings.push({
491
+ code: "series-labels-ignored",
492
+ severity: "warn",
493
+ message: "seriesLabels applies only to stacked and stacked100 column charts; ignored for grouped",
494
+ suggest: "use a legend to name grouped series"
495
+ }), netLineOn && netLineSeriesId && !netLineSeries && (netLineOn = !1, warnings.push({
496
+ code: "net-line-series-missing",
497
+ severity: "warn",
498
+ message: `netLine seriesId '${netLineSeriesId}' is not a plotted data series; net line omitted`,
499
+ owner: { seriesId: netLineSeriesId }
500
+ })), netLineOn) {
501
+ let values = dataSeries.flatMap(
502
+ (series) => series.vals.flatMap((value) => value.v === null ? [] : [value.v])
503
+ ), hasPositive = values.some((value) => value > 0), hasNegative = values.some((value) => value < 0), outermost = netLineSeries ? dataSeries.at(-1)?.id === netLineSeries.id : hasPositive !== hasNegative;
504
+ hasPositive !== hasNegative && outermost && warnings.push({
505
+ code: "netline-redundant",
506
+ severity: "warn",
507
+ message: "netLine traces the visible outer edge of a single-signed stack and adds no information",
508
+ ...netLineSeries ? { owner: { seriesId: netLineSeries.id } } : {},
509
+ suggest: "Pick an inner boundary series with netLine.seriesId, or drop netLine."
510
+ });
511
+ }
512
+ return { connectorsOn, connectorDashed, connectorSeries, netLineOn, netLineSeries, netLineSteps };
513
+ }
514
+ function weightedTotal(cats, dataSeries, warnings) {
515
+ let ti = cats.findIndex((c) => c.role === "total");
516
+ if (ti < 0 || dataSeries.some((s) => s.vals[ti].v !== null)) return;
517
+ let total = cats[ti], name = (c) => c.label ?? c.id, groups = cats.flatMap((_, ci) => ci === ti ? [] : [ci]), base = (ci) => cats[ci].total100;
518
+ if (groups.length === 0 || groups.some((ci) => !(base(ci) > 0))) {
519
+ warnings.push({
520
+ code: "total-not-computed",
521
+ severity: "warn",
522
+ message: `the total column '${name(total)}' has no values, and not every other column carries a total100 base to weight it by`,
523
+ suggest: "give each group its respondent base in categories[].total100, or author the total values"
524
+ });
525
+ return;
526
+ }
527
+ let n = groups.reduce((a, ci) => a + base(ci), 0), values = emptyIdRecord();
528
+ for (let s of dataSeries) {
529
+ let missing = groups.filter((ci) => s.vals[ci].v === null);
530
+ if (missing.length > 0) {
531
+ warnings.push({
532
+ code: "total-not-computed",
533
+ severity: "warn",
534
+ message: `'${name(total)}' has no value for '${s.label}': no observation in ${missing.map((ci) => `'${name(cats[ci])}'`).join(", ")}`,
535
+ owner: { seriesId: s.id, categoryId: total.id },
536
+ suggest: "author the missing group values, or the total value itself"
537
+ });
538
+ continue;
539
+ }
540
+ let share = (ci) => s.vals[ci].isPct ? s.vals[ci].v : s.vals[ci].v / base(ci) * 100, v = groups.reduce((a, ci) => a + base(ci) * share(ci), 0) / n;
541
+ s.vals[ti] = { ...s.vals[ti], v, isPct: !0 }, values[s.id] = v;
542
+ }
543
+ if (Object.keys(values).length !== 0)
544
+ return cats[ti] = { ...total, total100: n }, warnings.push({
545
+ code: "total-weighted",
546
+ severity: "info",
547
+ message: `'${name(total)}' is the base-weighted share of all ${n} in ${groups.length} columns, not the mean of their shares`
548
+ }), { categoryId: total.id, total100: n, values };
549
+ }
550
+ var RIBBON_CROWDED = 6;
551
+ function columnRibbons(options, variant, stackedLike, dataSeries, warnings) {
552
+ if (!(options.ribbons !== void 0 && options.ribbons !== !1)) return { ribbonsOn: !1, ribbonRank: !1 };
553
+ if (!stackedLike)
554
+ return warnings.push({
555
+ code: "ribbons-ignored",
556
+ severity: "warn",
557
+ message: "ribbons apply only to stacked and stacked100 column charts; ignored for grouped",
558
+ suggest: "use variant 'stacked'"
559
+ }), { ribbonsOn: !1, ribbonRank: !1 };
560
+ let order = (typeof options.ribbons == "object" ? options.ribbons.order : void 0) ?? (variant === "stacked100" ? "sheet" : "rank");
561
+ return order === "rank" && dataSeries.length > RIBBON_CROWDED && warnings.push({
562
+ code: "ribbon-crowded",
563
+ severity: "warn",
564
+ message: `${dataSeries.length} series draw ribbons; above ${RIBBON_CROWDED} their crossings become hard to follow`,
565
+ suggest: `keep the ${RIBBON_CROWDED} largest series and fold the rest into one Others series upstream, or drop ribbons`
566
+ }), { ribbonsOn: !0, ribbonRank: order === "rank" };
567
+ }
568
+ function columnBasis(variant, cats, dataSeries, warnings, ranked = !1) {
569
+ let nmCats100 = /* @__PURE__ */ new Set(), naCats100 = /* @__PURE__ */ new Set(), mixedSignCats = /* @__PURE__ */ new Set(), basisByCat = cats.map((c, ci) => {
570
+ if (variant === "grouped") return 0;
571
+ let { basis, nm, na } = compositionBasis(dataSeries.map((s) => s.vals[ci]), c.total100);
572
+ return nm ? ((variant === "stacked100" ? nmCats100 : mixedSignCats).add(c.id), 0) : basis <= 0 && (variant === "stacked" || !na) ? 0 : basis <= 0 ? (naCats100.add(c.id), warnings.push({
573
+ code: "percent-basis-nonpositive",
574
+ severity: "warn",
575
+ message: `category '${c.id}': non-positive 100% basis \u2014 nothing to compose, category marked n/a`,
576
+ owner: { categoryId: c.id }
577
+ }), 0) : basis;
578
+ });
579
+ nmCats100.size > 0 && warnings.push(mixedSignsWarning([...nmCats100], cats.length));
580
+ let overfull = variant !== "stacked100" ? [] : cats.flatMap((c, ci) => {
581
+ if (nmCats100.has(c.id) || naCats100.has(c.id)) return [];
582
+ let sum = overfullShareSum(dataSeries.map((s) => s.vals[ci]), basisByCat[ci]);
583
+ return sum === void 0 ? [] : [{ id: c.id, sum }];
584
+ });
585
+ for (let row of overfull) nmCats100.add(row.id);
586
+ overfull.length > 0 && warnings.push(overfullWarning(overfull, nmCats100.size + naCats100.size === cats.length, "give every part as a share of the same whole, or use variant 'grouped' for shares that overlap, such as answers to a multi-select question"));
587
+ let plottedOf = (s, ci) => {
588
+ let val = s.vals[ci];
589
+ if (val.v === null) return null;
590
+ if (variant !== "stacked100") return val.v;
591
+ if (nmCats100.has(cats[ci].id)) return 0;
592
+ if (val.isPct) return val.v;
593
+ let b = basisByCat[ci];
594
+ return b > 0 ? val.v / b * 100 : 0;
595
+ }, rangeOf = (s, ci) => {
596
+ let val = s.vals[ci];
597
+ if (!val.range) return;
598
+ if (variant !== "stacked100" || val.isPct) return val.range;
599
+ let basis = basisByCat[ci];
600
+ if (basis <= 0) return;
601
+ let scale = (value) => value / basis * 100;
602
+ return {
603
+ low: scale(val.range.low),
604
+ high: scale(val.range.high),
605
+ ...val.range.mid === void 0 ? {} : { mid: scale(val.range.mid) }
606
+ };
607
+ }, absOf = (s, ci) => {
608
+ let val = s.vals[ci];
609
+ if (val.v === null) return null;
610
+ if (!val.isPct || variant !== "stacked100") return val.v;
611
+ let b = basisByCat[ci];
612
+ return b > 0 ? val.v * b / 100 : null;
613
+ }, stacks = cats.map(
614
+ (_, ci) => accumulateStack(dataSeries.map((series) => plottedOf(series, ci)), ranked)
615
+ ), stackTotals = emptyIdRecord();
616
+ cats.forEach((c, ci) => {
617
+ stackTotals[c.id] = dataSeries.reduce((a, s) => a + (absOf(s, ci) ?? 0), 0);
618
+ });
619
+ let percents;
620
+ variant === "stacked100" && (percents = emptyIdRecord(), cats.forEach((c, ci) => {
621
+ let row = emptyIdRecord();
622
+ for (let s of dataSeries) {
623
+ let p = plottedOf(s, ci);
624
+ p !== null && (row[s.id] = p);
625
+ }
626
+ percents[c.id] = row;
627
+ }));
628
+ let emptyCats = new Set(variant === "grouped" ? [] : cats.filter((_, ci) => dataSeries.every((s) => s.vals[ci].v === null)).map((c) => c.id)), incompleteCats = new Set(variant === "grouped" ? [] : cats.filter((c, ci) => !emptyCats.has(c.id) && isIncomplete(dataSeries.map((s) => s.vals[ci].v))).map((c) => c.id));
629
+ return { nmCats100, naCats100, mixedSignCats, incompleteCats, emptyCats, plottedOf, rangeOf, absOf, shareOf: (s, ci) => {
630
+ let c = cats[ci];
631
+ if (basisByCat[ci] <= 0 || incompleteCats.has(c.id) && c.total100 === void 0) return null;
632
+ if (variant === "stacked100") return plottedOf(s, ci);
633
+ let val = s.vals[ci];
634
+ return val.v === null || val.isPct ? null : val.v / basisByCat[ci] * 100;
635
+ }, stacks, stackTotals, percents };
636
+ }
637
+ function integratedVarianceValues(pyRef, cats, dataSeries, stackTotals, stacks, roundedForDisplay, warnings, locale) {
638
+ let growthSpec = parseFormatExample("88.8%"), growthFormatter = formatterFromExample("88.8%", locale), integratedDirection = dataSeries.every(
639
+ (series) => series.direction === "lowerIsBetter"
640
+ ) ? "lowerIsBetter" : "higherIsBetter", pyGrowth = /* @__PURE__ */ new Map(), partial = cats.filter((category, ci) => category.partial === !0 && stacks[ci].hasValue && pyRef.vals[ci].v !== null);
641
+ return partial.length > 0 && warnings.push({
642
+ code: "partial-period-comparison",
643
+ severity: "warn",
644
+ message: `the growth against '${pyRef.label}' of ${partial.map((c) => `'${c.label ?? c.id}'`).join(", ")} compares a partial period as if it were complete`,
645
+ owner: { seriesId: pyRef.id },
646
+ suggest: "give the reference the same partial span (month to date against the same days last year), or say in the title that the period is still running"
647
+ }), cats.forEach((category, ci) => {
648
+ let reference = pyRef.vals[ci].v;
649
+ if (!stacks[ci].hasValue || reference === null) return;
650
+ let current = stackTotals[category.id], displayedCurrent = roundedForDisplay(current), displayedReference = roundedForDisplay(reference), growthPct = displayedReference > 0 && reference > 0 ? (current / reference - 1) * 100 : null, displayedGrowthPct = growthPct === null ? null : roundedNumber(growthPct, growthSpec), tone = growthPct === null || growthPct === 0 ? "neutral" : growthPct > 0 == (integratedDirection === "higherIsBetter") ? "good" : "bad", text = growthPct === null || displayedGrowthPct === null ? "n.m." : `${growthPct > 0 ? "+" : growthPct < 0 ? "\u2212" : ""}${growthFormatter(Math.abs(displayedGrowthPct))}`;
651
+ if (pyGrowth.set(category.id, {
652
+ categoryId: category.id,
653
+ referenceSeriesId: pyRef.id,
654
+ current,
655
+ reference,
656
+ displayedCurrent,
657
+ displayedReference,
658
+ growthPct,
659
+ displayedGrowthPct,
660
+ tone,
661
+ text
662
+ }), displayedReference <= 0 && warnings.push({
663
+ code: "ref-nonpositive",
664
+ severity: "warn",
665
+ message: `category '${category.id}': displayed PY reference ${displayedReference} \u2264 0 \u2014 growth suppressed and marked n.m.`,
666
+ owner: { categoryId: category.id, seriesId: pyRef.id }
667
+ }), displayedGrowthPct !== null && displayedReference > 0) {
668
+ let fromPrintedTotals = roundedNumber(
669
+ (displayedCurrent / displayedReference - 1) * 100,
670
+ growthSpec
671
+ );
672
+ fromPrintedTotals !== displayedGrowthPct && warnings.push({
673
+ code: "integrated-growth-rounding-gap",
674
+ severity: "info",
675
+ message: `category '${category.id}': growth ${growthFormatter(displayedGrowthPct)} is computed from the unrounded totals; dividing the printed ${displayedCurrent} by the printed ${displayedReference} gives ${growthFormatter(fromPrintedTotals)}`,
676
+ owner: { categoryId: category.id, seriesId: pyRef.id }
677
+ });
678
+ }
679
+ }), pyGrowth;
680
+ }
681
+ function columnValueDomain(va, variant, cats, dataSeries, refSeries, plottedOf, rangeOf, stacks, lineExtent, warnings) {
682
+ let stackedLike = variant !== "grouped", rendered = [], posTopP = [], negBotP = [], lo = Math.min(0, lineExtent?.lo ?? 0), hi = Math.max(0, lineExtent?.hi ?? 0);
683
+ if (cats.forEach((_, ci) => {
684
+ let stack = stacks[ci], p = stackedLike ? stack.positive : 0, n = stackedLike ? stack.negative : 0;
685
+ for (let si = 0; si < dataSeries.length; si++) {
686
+ let s = dataSeries[si], v = plottedOf(s, ci);
687
+ if (v === null) continue;
688
+ let start = stackedLike ? stack.segments[si].start : 0, range = rangeOf(s, ci);
689
+ rendered.push(stackedLike ? stack.segments[si].end : v), range && (lo = Math.min(lo, start + range.low, start + range.high), hi = Math.max(hi, start + range.low, start + range.high), rendered.push(start + range.low, start + range.high), range.mid !== void 0 && rendered.push(start + range.mid)), stackedLike || (p = Math.max(p, v), n = Math.min(n, v));
690
+ }
691
+ posTopP[ci] = p, negBotP[ci] = n, lo = Math.min(lo, n), hi = Math.max(hi, p);
692
+ }), variant !== "stacked100")
693
+ for (let s of refSeries)
694
+ cats.forEach((_, ci) => {
695
+ let v = plottedOf(s, ci);
696
+ v !== null && (rendered.push(v), lo = Math.min(lo, v), hi = Math.max(hi, v));
697
+ });
698
+ else
699
+ refSeries.some((s) => s.vals.some((val) => val.v !== null)) && warnings.push({
700
+ code: "reference-unsupported-stacked100",
701
+ severity: "warn",
702
+ message: "reference series omitted: a 100% axis shows composition, not level \u2014 show plan/PY targets on the absolute companion chart"
703
+ });
704
+ let dLo, dHi;
705
+ if (variant === "stacked100")
706
+ dLo = Math.min(0, lo), dHi = Math.max(100, hi);
707
+ else {
708
+ let lo2 = lo < 0 ? lo * 1.08 : 0, hi2 = hi > 0 ? hi * 1.08 : 0;
709
+ lo2 === 0 && hi2 === 0 && (hi2 = 1), [dLo, dHi] = niceDomain(lo2, hi2, 5, {
710
+ dataExtent: [lo, hi],
711
+ maxWasteFraction: 0.15
712
+ });
713
+ }
714
+ [dLo, dHi] = applyAxisBounds([dLo, dHi], [Math.min(lo, 0), Math.max(hi, 0)], va, warnings);
715
+ let step = va.tickStep;
716
+ if (step !== void 0 && step > 0) {
717
+ let from = Math.floor(dLo / step + 1e-9), to = Math.ceil(dHi / step - 1e-9);
718
+ if (to - from >= 1 && to - from <= 20) {
719
+ let stepTicks = Array.from({ length: to - from + 1 }, (_, i) => Number(((from + i) * step).toFixed(10)));
720
+ return { posTopP, negBotP, dLo: stepTicks[0], dHi: stepTicks.at(-1), stepTicks, rendered };
721
+ }
722
+ warnings.push({
723
+ code: "tick-step-ignored",
724
+ severity: "warn",
725
+ message: `valueAxis.tickStep ${step} would draw ${to - from} intervals over the value domain; the nice ticks are drawn instead`,
726
+ suggest: "pick a step that gives 1 to 20 intervals"
727
+ });
728
+ }
729
+ return { posTopP, negBotP, dLo, dHi, rendered };
730
+ }
731
+ function columnAxisBreak(options, anomaly, renderedBreakValues, meanValue, averageMark, corridorShown, dLo, dHi, warnings) {
732
+ let va = options.valueAxis ?? {}, drawnBy = /* @__PURE__ */ new Map(), add = (value, cause) => {
733
+ renderedBreakValues.push(value), drawnBy.has(value) || drawnBy.set(value, cause);
734
+ };
735
+ for (let annotation of options.annotations ?? [])
736
+ if (annotation.kind === "valueLine") {
737
+ let value = annotation.value === void 0 || annotation.value === "mean" ? meanValue : annotation.value;
738
+ value !== void 0 && add(value, typeof annotation.value == "number" ? "the valueLine annotation" : "the valueLine annotation (its default value is the mean)");
739
+ } else annotation.kind === "indicator100" && add(100, "the indicator100 annotation");
740
+ if (averageMark !== void 0 && add(averageMark, "options.averageMarker"), corridorShown.low && anomaly?.corridor?.low != null && add(anomaly.corridor.low, "the options.anomaly corridor"), corridorShown.high && anomaly?.corridor?.high != null && add(anomaly.corridor.high, "the options.anomaly corridor"), va.break && anomaly)
741
+ warnings.push({
742
+ code: "anomaly-axis-break-ignored",
743
+ severity: "warn",
744
+ message: "valueAxis.break dropped: a deviation corridor cannot be read across a broken value axis",
745
+ suggest: "drop valueAxis.break, or drop options.anomaly and keep the break"
746
+ });
747
+ else if (va.break) {
748
+ let reason = breakStyleRefusal(va.break) ?? invalidLinearBreakReason([dLo, dHi], va.break, renderedBreakValues, (value) => drawnBy.get(value));
749
+ if (reason) warnings.push(axisBreakInvalid("column", reason));
750
+ else return { from: va.break.from, to: va.break.to };
751
+ }
752
+ }
753
+ function columnAnnotationList(options, variant, averageMark, statFmt, span) {
754
+ let annList = options.annotations ?? [];
755
+ if (averageMark !== void 0) {
756
+ let side = options[VALUE_LINE_RESERVE] ? "right" : "left";
757
+ annList = [...annList, { ...averageMarkerLine(annList, averageMark, statFmt, span, options.strings?.average), side }];
758
+ }
759
+ return variant === "stacked100" && kindSetting(options, "percentIndicator") !== !1 && options.valueAxis?.show !== !0 && !annList.some((a) => a.kind === "indicator100") && (annList = [
760
+ ...annList,
761
+ { kind: "indicator100", side: "right", id: "indicator100-auto", priority: PRIORITY.endpoint }
762
+ ]), annList;
763
+ }
764
+ function resolveColumnDomain(data, options, warnings) {
765
+ let env = resolveColumnEnv(options, warnings), normalized = normalizeColumnData(data, warnings), { seriesNorm } = normalized, variant = options.valueAxis?.percent ? "stacked100" : options.variant ?? "grouped", valueSpec = rasterFormatter(options.format, seriesNorm.map((s) => [s.id, s.vals.map((val) => val.v), s.vals.map((val) => val.range ? [val.range.low, val.range.high, val.range.mid] : null)]), options.locale?.language, options.unit, options.target, variant !== "grouped"), fmt = valueSpec.fmt, statFmt = (v) => formatStatWithSpec(v, valueSpec.spec), plotted = seriesNorm.filter((s) => s.role !== "reference"), refSeries = seriesNorm.filter((s) => s.role === "reference");
766
+ if (plotted.length === 0)
767
+ throw new NormalizeError("empty-data", "series", "column requires at least one data-role series");
768
+ let signColor = options.signColor === !0;
769
+ refuseColumnEncodings(variant, signColor, options.anomaly, plotted);
770
+ let pctLevels = percentLevels(plotted), { cats, dataSeries, othersId } = orderColumnCategories(options, normalized.cats, seriesNorm, plotted, warnings), stackedLike = variant !== "grouped", { pyRef, uniformScenario } = columnScenarios(options, variant, cats, dataSeries, refSeries, warnings), lines = columnLines(options, stackedLike, dataSeries, warnings, cats.some((cat) => cat.total100 !== void 0)), va = options.valueAxis ?? {}, viewportOn = options.window !== void 0 || options.viewDomain !== void 0;
771
+ viewportOn && refuseUnorderedViewport(options, othersId);
772
+ let ribbons = columnRibbons(options, variant, stackedLike, dataSeries, warnings), computedTotal = variant === "stacked100" ? weightedTotal(cats, dataSeries, warnings) : void 0, ranked = ribbons.ribbonsOn && ribbons.ribbonRank, source = columnBasis(variant, cats, dataSeries, viewportOn ? [] : warnings, ranked), anomaly, anomalyValues = [];
773
+ options.anomaly && ({ anomaly, values: anomalyValues } = columnAnomalyModel(options.anomaly, cats, dataSeries[0], source.absOf, fmt, statFmt, options.locale?.language, warnings, options.strings));
774
+ let addsOver = (series) => !stackedLike || stackAdds(series.map((s) => ({ label: s.label, unit: s.unit, pctCells: s.vals.some((val) => val.isPct) })), options.unit, options.sharesOfOneWhole), partsAdd = addsOver(dataSeries), meanValue = partsAdd ? plottedMean("all", stackedLike, cats.length, dataSeries, (series, _, ci) => source.plottedOf(series, ci)) : void 0, averageMarkerScope = typeof options.averageMarker == "object" ? options.averageMarker.scope : "all", averageMarkerRequested = options.averageMarker !== void 0 && options.averageMarker !== !1 && !averageOfWholeShares(variant, averageMarkerScope, warnings) && !averageOfUnaddedSums(addsOver(averageMarkerScope === "all" ? dataSeries : dataSeries.filter((s) => averageMarkerScope.includes(s.id))), warnings), averageMark = averageMarkerRequested ? plottedMean(averageMarkerScope, stackedLike, cats.length, dataSeries, (series, _, ci) => source.plottedOf(series, ci)) : void 0;
775
+ averageMarkerRequested && averageMark === void 0 && warnings.push({
776
+ code: "average-marker-empty",
777
+ severity: "warn",
778
+ message: "averageMarker scope has no plotted values; marker omitted"
779
+ });
780
+ let population = viewportOn ? applyCategoryViewport({
781
+ domain: options.viewDomain,
782
+ window: options.window,
783
+ categories: cats,
784
+ series: seriesNorm,
785
+ plotted: [],
786
+ basis: [],
787
+ targets: [],
788
+ annotations: options.annotations
789
+ }) : void 0;
790
+ population && (options = liveWindowOptions({ ...options, annotations: population.annotations }, population.sampling));
791
+ let meanSpan = viewportMeanSpan(population), basis = population ? columnBasis(variant, cats, dataSeries, warnings, ranked) : source, pyGrowth = pyRef ? integratedVarianceValues(pyRef, cats, dataSeries, basis.stackTotals, basis.stacks, (value) => roundedNumber(value, valueSpec.spec), warnings, options.locale?.language) : /* @__PURE__ */ new Map(), lineExtent = valueLineExtent(options.annotations), { rendered, ...extent } = columnValueDomain(va, variant, cats, dataSeries, refSeries, basis.plottedOf, basis.rangeOf, basis.stacks, lineExtent, warnings), corridor = anomalyCorridor(anomaly, anomalyValues, extent.dLo, extent.dHi, statFmt, warnings, options.strings), grandTotalsRequested = grandTotalRequested(options.grandTotalLabels, variant, warnings, partsAdd), gtContent = grandTotalsRequested ? contentOf(options, "grandTotal", ["absolute"]) : null;
792
+ options.grandTotalLabels === !0 && options.labels === !1 && grandTotalsRequested && warnings.push({
793
+ code: "grand-total-labels-off",
794
+ severity: "warn",
795
+ message: "grandTotalLabels is true, but labels: false turns the grand totals off. Use a labels setting that leaves grand totals on: omit labels, or set labels to an object that does not set grandTotal to false.",
796
+ suggest: "Omit labels, or set labels.grandTotal to true and turn other label kinds off by name."
797
+ });
798
+ let sharesOn = variant === "stacked100" && contentOf(options, "segment", ["percent"])?.includes("percent") === !0;
799
+ warnIncompleteStacks(variant, cats, basis.incompleteCats, gtContent !== null, sharesOn, "columns", warnings, disclosuresShown(options));
800
+ let shareSet = shareSetFormatter(cats.flatMap((_, ci) => dataSeries.flatMap((s) => s.vals[ci].isPct ? [] : basis.shareOf(s, ci) ?? [])), options.locale?.language), wholes = sharesOn ? cats.flatMap((c, ci) => basis.nmCats100.has(c.id) || basis.naCats100.has(c.id) || basis.incompleteCats.has(c.id) || c.total100 !== void 0 || dataSeries.some((s) => s.vals[ci].isPct) ? [] : [{ c, parts: dataSeries.flatMap((s) => {
801
+ let share = basis.plottedOf(s, ci);
802
+ return share === null ? [] : [{ s, share }];
803
+ }) }]) : [], shareTexts = /* @__PURE__ */ new Map(), roundingAdjustments = [];
804
+ if (options.rounding !== "nearest") {
805
+ let spec = options.shareLabels?.format ? parseFormatExample(options.shareLabels.format) : void 0;
806
+ for (let { c, parts } of wholes) {
807
+ let rounded = sumConsistentShares(parts.map((part) => part.share), options.locale?.language, spec && withChartMarks(spec, options.locale?.language), shareSet.decimals);
808
+ rounded?.warning ? warnings.push(roundingUnavailable(c.label ?? c.id, rounded.warning)) : rounded && parts.forEach((part, index) => {
809
+ shareTexts.set(shareKey(c.id, part.s.id), rounded.texts[index]), rounded.moved[index] && roundingAdjustments.push({
810
+ whole: c.label ?? c.id,
811
+ part: part.s.label,
812
+ share: Math.round(part.share * 1e4) / 1e4,
813
+ nearest: spec ? formatWithSpec(part.share, withChartMarks(spec, options.locale?.language)) : shareSet.format(part.share),
814
+ printed: rounded.texts[index]
815
+ });
816
+ });
817
+ }
818
+ } else sharesOn && warnShareRoundingDrift(warnings, wholes.map(({ c, parts }) => ({ name: c.label ?? c.id, shares: parts.map((part) => part.share), decimals: shareSet.decimals })));
819
+ let activeBreak = columnAxisBreak(options, anomaly, rendered, meanValue, averageMark, corridor.corridorShown, extent.dLo, extent.dHi, warnings), { stepTicks, ...span } = extent, checked = activeBreak, stepAcross = !stepTicks || !checked || stepTicks.filter((v) => v < checked.from).length >= 2 && stepTicks.filter((v) => v > checked.to).length >= 2;
820
+ if (!stepAcross) {
821
+ warnings.push({
822
+ code: "tick-step-ignored",
823
+ severity: "warn",
824
+ message: `valueAxis.tickStep ${va.tickStep} leaves one side of the axis break with only its end tick; the break's own ticks are drawn instead`,
825
+ suggest: "pick a smaller tickStep, or drop the axis break",
826
+ field: ["options", "valueAxis", "tickStep"]
827
+ });
828
+ let { tickStep: _rejected, ...nice } = va, { rendered: niceRendered, ...niceExtent } = columnValueDomain(nice, variant, cats, dataSeries, refSeries, basis.plottedOf, basis.rangeOf, basis.stacks, lineExtent, []);
829
+ ({ stepTicks, ...span } = niceExtent);
830
+ let checks = [];
831
+ activeBreak = columnAxisBreak(options, anomaly, niceRendered, meanValue, averageMark, corridor.corridorShown, span.dLo, span.dHi, checks), warnings.push(...checks.map((warning) => warning.code === "axis-break-invalid" ? { ...warning, severity: "warn", message: `${warning.message}; the chart is drawn without the break` } : warning));
832
+ }
833
+ return {
834
+ // The shares print at the chart's one precision ("9%" beside "50%"), unless shareLabels.format sets one.
835
+ ...env,
836
+ ...options.shareLabels?.format ? {} : { pctFmt: shareSet.format },
837
+ shareTexts,
838
+ roundingAdjustments,
839
+ options,
840
+ cats,
841
+ seriesNorm,
842
+ dataSeries,
843
+ refSeries,
844
+ othersId,
845
+ valueSpec,
846
+ fmt,
847
+ totalFmt: stackTotalFormatter(variant, valueSpec.spec, fmt),
848
+ statFmt,
849
+ variant,
850
+ refStyle: options.referenceStyle ?? "tick",
851
+ signColor,
852
+ pyRef,
853
+ pyGrowth,
854
+ uniformScenario,
855
+ pctLevels,
856
+ ...lines,
857
+ ...ribbons,
858
+ computedTotal,
859
+ va,
860
+ ...basis,
861
+ anomaly,
862
+ ...span,
863
+ ...stepTicks && stepAcross ? { stepTicks } : {},
864
+ meanValue,
865
+ averageMark,
866
+ meanSpan,
867
+ ...corridor,
868
+ activeBreak,
869
+ gtContent,
870
+ partsAdd,
871
+ ...partsAdd ? {} : { meanMissing: NO_STACK_MEAN },
872
+ annList: columnAnnotationList(options, variant, averageMark, !options.format && (variant === "stacked100" || options.unit === "%" || pctLevels) ? (v) => formatStatWithSpec(v, { ...valueSpec.spec, suffix: "%" }) : statFmt, meanSpan()),
873
+ seriesCagr: stackedLike ? seriesCagrs(options, cats, dataSeries, basis.absOf, warnings) : /* @__PURE__ */ new Map()
874
+ };
875
+ }
876
+ function seriesCagrs(options, cats, dataSeries, absOf, warnings) {
877
+ let out = /* @__PURE__ */ new Map(), asked = options.seriesLabels?.cagr;
878
+ if (!asked) return out;
879
+ let span = asked === !0 ? {} : asked, warn = (code, message, suggest) => warnings.push({ code, severity: "warn", message, suggest }), fi = span.from === void 0 ? 0 : cats.findIndex((c) => c.id === span.from), ti = span.to === void 0 ? cats.length - 1 : cats.findIndex((c) => c.id === span.to);
880
+ if (fi < 0 || ti < 0)
881
+ return warn("series-cagr-no-span", `seriesLabels.cagr names a category that is not in the data: '${fi < 0 ? span.from : span.to}'; no series CAGR is printed`, "use category ids for from and to"), out;
882
+ let from = cats[fi], to = cats[ti], years = yearSpan(from.date, to.date) ?? yearSpanFromLabels(from.label, to.label);
883
+ if (from.partial || to.partial || years === null || years <= 0)
884
+ return warn(
885
+ "series-cagr-no-span",
886
+ `seriesLabels.cagr from '${from.label ?? from.id}' to '${to.label ?? to.id}' ${from.partial || to.partial ? "ends on a partial period" : "spans no measured years"}; no series CAGR is printed`,
887
+ "give the categories ISO dates or year-bearing labels, and anchor the span on complete periods"
888
+ ), out;
889
+ let spec = typeof span == "object" && span.format !== void 0 ? withChartMarks({ ...parseFormatExample(span.format), signed: !0 }, options.locale?.language) : void 0, only = options.seriesLabels?.only === void 0 ? void 0 : new Set(options.seriesLabels.only);
890
+ for (let s of dataSeries) {
891
+ if (only && !only.has(s.id)) continue;
892
+ let a = absOf(s, fi), b = absOf(s, ti), rate = a === null || b === null ? null : cagr(a, b, years);
893
+ if (rate === null) {
894
+ warn("series-cagr-undefined", `'${s.label}' has no CAGR from '${from.label ?? from.id}' to '${to.label ?? to.id}': a missing value, a start at or below zero or a negative end; its name prints alone`, "label the growth of this series in the text, or leave it out of seriesLabels.only");
895
+ continue;
896
+ }
897
+ let period = fi !== 0 || ti !== cats.length - 1 ? ` ${from.label ?? from.id}\u2013${to.label ?? to.id}:` : "", text = `${s.label}${period} ${spec ? formatWithSpec(rate, spec) : formatAutomaticPercent(rate, 1, !0, options.locale?.language)} p.a.`, ref = (end, category) => `${end}:categoryId=${category.id}/seriesId=${s.id}`;
898
+ out.set(s.id, {
899
+ text,
900
+ placed: {
901
+ id: `seriesCagr:${s.id}`,
902
+ kind: "cagr",
903
+ computedText: text,
904
+ nodeIds: [],
905
+ labelId: `seriesEdge:${s.id}`,
906
+ derivation: {
907
+ basis: "derived",
908
+ op: "annotation-cagr@1",
909
+ inputs: [
910
+ { ref: ref("from", from), value: a },
911
+ { ref: ref("to", to), value: b },
912
+ { ref: "years", value: years, state: `${from.date ?? from.label ?? from.id} \u2192 ${to.date ?? to.label ?? to.id}` }
913
+ ],
914
+ raw: rate
915
+ }
916
+ }
917
+ });
918
+ }
919
+ return out;
920
+ }
921
+ function refuseUnorderedViewport(options, othersId) {
922
+ let sorted = options.sort?.categories !== void 0 && options.sort.categories !== "sheet";
923
+ if (!sorted && othersId === null && !options.topN) return;
924
+ let field = options.window !== void 0 ? "options.window" : "options.viewDomain";
925
+ throw new NormalizeError(
926
+ "viewport-unordered",
927
+ field,
928
+ `${field.slice(8)} keeps a span of periods in their own order; ${sorted ? `sort.categories '${options.sort.categories}'` : "topN"} reorders or folds the categories`,
929
+ `drop ${sorted ? "sort.categories" : "topN"}, or drop ${field.slice(8)}`
930
+ );
931
+ }
932
+ var rasterFormatters = /* @__PURE__ */ new Map();
933
+ function remembered(format) {
934
+ let texts = /* @__PURE__ */ new Map();
935
+ return (value) => {
936
+ let text = texts.get(value);
937
+ return text === void 0 && texts.set(value, text = format(value)), text;
938
+ };
939
+ }
940
+ function rasterFormatter(example, seriesValues, locale, unit, target, shared) {
941
+ let key = JSON.stringify([example, locale, unit, target, currentSmallValues(), seriesValues, shared]), known = rasterFormatters.get(key);
942
+ if (known) return known;
943
+ let made = seriesRasterFormatter(example, seriesValues.flatMap(([, values]) => values), locale, unit, target, void 0, shared), bySeries = /* @__PURE__ */ new Map(), formatter = {
944
+ ...made,
945
+ fmt: remembered(made.fmt),
946
+ fmtSigned: remembered(made.fmtSigned),
947
+ fmtPercent: remembered(made.fmtPercent),
948
+ forSeries: (series, cellFormat) => {
949
+ let seriesKey = JSON.stringify([series.id, series.format, series.unit, cellFormat]), format = bySeries.get(seriesKey);
950
+ return format || bySeries.set(seriesKey, format = remembered(made.forSeries(series, cellFormat))), format;
951
+ }
952
+ };
953
+ return rasterFormatters.size >= 64 && rasterFormatters.clear(), rasterFormatters.set(key, formatter), formatter;
954
+ }
955
+ var RIGHT_EDGE_GAP = 8;
956
+ function edgeNameFont(labelFont, domain) {
957
+ return domain.variant === "stacked100" ? { ...labelFont, weight: headingWeight(domain.theme) } : labelFont;
958
+ }
959
+ function rightEdgeSeriesLabels(domain) {
960
+ return edgePlan(domain).names;
961
+ }
962
+ function edgeNamesReplaceKey(domain) {
963
+ return edgePlan(domain).replaceKey;
964
+ }
965
+ var KEY_EDGE_SERIES = /* @__PURE__ */ Symbol("keyEdgeSeries"), edgePlans = /* @__PURE__ */ new WeakMap();
966
+ function edgePlan(domain) {
967
+ let plan = edgePlans.get(domain);
968
+ return plan || edgePlans.set(domain, plan = planEdgeNames(domain)), plan;
969
+ }
970
+ function planEdgeNames(domain) {
971
+ let { options } = domain, authored = options.seriesLabels;
972
+ if (authored === void 0 || domain.variant === "grouped") return { names: [], replaceKey: !1 };
973
+ let only = authored.only === void 0 ? void 0 : new Set(authored.only), names = domain.dataSeries.filter((series) => only === void 0 || only.has(series.id)).map((series) => ({ id: series.id, label: domain.seriesCagr.get(series.id)?.text ?? series.label }));
974
+ if (!(options.legend !== void 0 && options.legend !== "none" && panelTypeClass(options) === void 0 && options[KEY_EDGE_SERIES] !== !0) || names.length === 0 || names.length < domain.dataSeries.length) return { names, replaceKey: !1 };
975
+ let { theme, measure, size } = domain, labelFont = edgeNameFont({ family: theme.type.family, ...theme.type.label }, domain), gutter = maxOf(names.map((series) => measure(series.label, labelFont).width)) + RIGHT_EDGE_GAP, margin = { ...canvasMargin(theme, size.width), ...options.margin }, axis = domain.va.show ? measureValueAxisWidth([domain.dLo, domain.dHi], domain.fmt, theme, measure, 5, domain.valueSpec.spec, domain.stepTicks) : 0, step = (size.width - margin.left - margin.right - axis) / Math.max(1, domain.cats.length);
976
+ return gutter <= step ? { names, replaceKey: !0 } : { names: [], replaceKey: !1 };
977
+ }
978
+ function shareKey(categoryId, seriesId) {
979
+ return `${categoryId}\0${seriesId}`;
980
+ }
981
+ function shareTextOf(domain, categoryId, seriesId, pct, authored) {
982
+ return authored ? domain.authoredPctFmt(pct) : domain.shareTexts.get(shareKey(categoryId, seriesId)) ?? domain.pctFmt(pct);
983
+ }
984
+
985
+ // src/core/charts/column/marks.ts
986
+ function segmentHatchGround(part, pattern, fill) {
987
+ if (!(part !== "segment" && part !== "bar" || pattern !== "hatch45"))
988
+ return hatchGroundPaint(fill);
989
+ }
990
+ function columnRibbons2(domain, paints, area, nodes) {
991
+ let { cats, dataSeries, stacks, theme } = domain, { band, y } = area, surface = resolveSurface(theme), opacity = domain.ribbonRank ? surface.ribbonAlpha : surface.ribbonSheetAlpha, fills = [], edges = [], out = [];
992
+ for (let ci = 0; ci < cats.length - 1; ci++) {
993
+ let left = cats[ci], right = cats[ci + 1];
994
+ if (left.breakAfter || left.gapAfter !== void 0 && left.gapAfter !== !1 && left.gapAfter !== 0 || right.role === "total") continue;
995
+ let x1 = band.position(ci) + band.bandwidth, x2 = band.position(ci + 1);
996
+ dataSeries.forEach((s, si) => {
997
+ let a = stacks[ci].segments[si], b = stacks[ci + 1].segments[si];
998
+ if (!a || !b || a.value === 0 || b.value === 0 || Math.sign(a.value) !== Math.sign(b.value)) return;
999
+ let top1 = y(Math.max(a.start, a.end)), bottom1 = y(Math.min(a.start, a.end)), top2 = y(Math.max(b.start, b.end)), bottom2 = y(Math.min(b.start, b.end)), owner = { seriesId: s.id, categoryId: left.id }, id = `ribbon:${left.id}:${right.id}:${s.id}`;
1000
+ fills.push({
1001
+ t: "path",
1002
+ id,
1003
+ d: ribbonPath(x1, top1, bottom1, x2, top2, bottom2, !1, domain.ribbonRank),
1004
+ fill: paints.cell(s, s.vals[ci], left, si),
1005
+ opacity,
1006
+ owner,
1007
+ part: "ribbon"
1008
+ }), edges.push({
1009
+ t: "path",
1010
+ id: `${id}:edge`,
1011
+ d: ribbonPath(x1, top1, bottom1, x2, top2, bottom2, !0, domain.ribbonRank),
1012
+ stroke: { token: "background" },
1013
+ width: strokeToken(theme, "hair"),
1014
+ owner,
1015
+ part: "ribbonEdge"
1016
+ }), out.push({ seriesId: s.id, from: left.id, to: right.id, left: { x: x1, top: top1, bottom: bottom1 }, right: { x: x2, top: top2, bottom: bottom2 }, nodeId: id });
1017
+ });
1018
+ }
1019
+ return pushAll(nodes, fills), pushAll(nodes, edges), out;
1020
+ }
1021
+ function flagMarkerAt(domain, paints, area, rect, value, insidePaint, insidePattern) {
1022
+ let { plot } = area.frame, insideFill = effectiveFill(paints.css(insidePaint), insidePattern, domain.theme), up = value >= 0, base = up ? rect.y - ANOMALY_FLAG_GAP : rect.y + rect.h + ANOMALY_FLAG_GAP, tip = up ? base - ANOMALY_FLAG_H : base + ANOMALY_FLAG_H, outside = !0;
1023
+ return (up ? tip < plot.y : tip > plot.y + plot.h) && (outside = !1, base = up ? rect.y + ANOMALY_FLAG_GAP + ANOMALY_FLAG_H : rect.y + rect.h - ANOMALY_FLAG_GAP - ANOMALY_FLAG_H, tip = up ? rect.y + ANOMALY_FLAG_GAP : rect.y + rect.h - ANOMALY_FLAG_GAP), {
1024
+ cx: rect.x + rect.w / 2,
1025
+ base,
1026
+ tip,
1027
+ up,
1028
+ outside,
1029
+ value,
1030
+ insideFill,
1031
+ insidePaint,
1032
+ ...insidePattern ? { insidePattern } : {}
1033
+ };
1034
+ }
1035
+ function columnBars(domain, paints, area, marks, nodes, claims) {
1036
+ let { cats, dataSeries, variant, plottedOf, rangeOf, absOf, valueSpec, anomaly, stacks } = domain, { band, y, y0 } = area, rangeMarks = [], rangeNodes = [], bars = [], subCenters = /* @__PURE__ */ new Map(), segEdges = /* @__PURE__ */ new Map(), flagMarkers = /* @__PURE__ */ new Map(), emit = (input) => emitBarMark({ axis: "y", theme: domain.theme, scale: y, activeBreak: domain.activeBreak, css: paints.css }, nodes, claims, input), queueRangeWhisker = (seriesId, categoryId, cx, markWidth, range, offset = 0) => {
1037
+ let whisker = rangeWhisker(domain.theme, { seriesId, categoryId, axis: "y", center: cx, markSize: markWidth, range, offset, scale: y, activeBreak: domain.activeBreak, fmt: domain.fmt });
1038
+ rangeNodes.push(...whisker.nodes);
1039
+ for (let claim of whisker.claims) claims.claim(claim.rect, claim.kind, claim.owner, claim.part);
1040
+ rangeMarks.push(whisker.mark);
1041
+ }, groupSlots = groupedOffsets(band.bandwidth, dataSeries.length);
1042
+ return cats.forEach((c, ci) => {
1043
+ let bx = band.position(ci), bw = band.bandwidth, stack = stacks[ci], segs = [];
1044
+ if (dataSeries.forEach((s, si) => {
1045
+ let val = s.vals[ci], owner = { seriesId: s.id, categoryId: c.id }, nodeId = `mark:${s.id}:${c.id}`;
1046
+ if (variant === "grouped") {
1047
+ let v2 = plottedOf(s, ci), group = groupSlots[si], subW = group.size, x = bx + group.offset;
1048
+ if (subCenters.set(sk(s.id, c.id), x + subW / 2), v2 === null) return;
1049
+ let yv = y(v2), rect2 = { x, y: Math.min(yv, y0), w: subW, h: Math.max(Math.abs(yv - y0), 0.5) }, fill = paints.cell(s, val, c, si), pattern = paints.pattern(s, val, c);
1050
+ emit({
1051
+ nodeId,
1052
+ rect: rect2,
1053
+ start: 0,
1054
+ end: v2,
1055
+ fill,
1056
+ pattern,
1057
+ outline: paints.outline(c),
1058
+ owner,
1059
+ part: "bar",
1060
+ displayValue: valueSpec.forSeries(s, s.vals[ci]?.format)(absOf(s, ci)),
1061
+ ...anomaly?.flagByCategory.has(c.id) ? { displayState: "flagged" } : {}
1062
+ }), marks.bars.push({ seriesId: s.id, categoryId: c.id, rect: rect2, nodeId });
1063
+ let flagHere = anomaly?.flagByCategory.get(c.id);
1064
+ flagHere && flagMarkers.set(c.id, flagMarkerAt(domain, paints, area, rect2, flagHere.value, fill, pattern));
1065
+ let range2 = rangeOf(s, ci);
1066
+ range2 && queueRangeWhisker(s.id, c.id, x + subW / 2, subW, range2), bars.push({ s, si, c, ci, v: v2, rect: rect2 });
1067
+ return;
1068
+ }
1069
+ let segment = stack.segments[si];
1070
+ if (!segment) return;
1071
+ let { value: v, start: v0, end: v1 } = segment;
1072
+ segEdges.set(sk(s.id, c.id), { v0, v1, v });
1073
+ let range = rangeOf(s, ci);
1074
+ if (range && queueRangeWhisker(s.id, c.id, bx + bw / 2, bw, range, v0), v === 0) {
1075
+ typeof val.labelOverride == "string" && bars.push({ s, si, c, ci, v, rect: { x: bx, y: y(v0), w: bw, h: 0 } });
1076
+ return;
1077
+ }
1078
+ let rect = { x: bx, y: y(Math.max(v0, v1)), w: bw, h: Math.max(Math.abs(y(v0) - y(v1)), 0.5) };
1079
+ emit({
1080
+ nodeId,
1081
+ rect,
1082
+ start: v0,
1083
+ end: v1,
1084
+ fill: paints.cell(s, val, c, si),
1085
+ pattern: paints.pattern(s, val, c),
1086
+ outline: paints.outline(c),
1087
+ owner,
1088
+ part: "segment",
1089
+ displayValue: variant === "stacked100" ? shareTextOf(domain, c.id, s.id, v, val.isPct) : valueSpec.forSeries(s, s.vals[ci]?.format)(absOf(s, ci))
1090
+ }), segs.push({ seriesId: s.id, rect, nodeId }), bars.push({ s, si, c, ci, v, rect });
1091
+ }), variant === "grouped") return;
1092
+ let stackTop = y(stack.positive), stackBot = y(stack.negative);
1093
+ marks.bars.push({
1094
+ categoryId: c.id,
1095
+ rect: { x: bx, y: stackTop, w: bw, h: Math.max(stackBot - stackTop, 0.5) },
1096
+ segments: segs
1097
+ });
1098
+ }), { rangeMarks, rangeNodes, bars, subCenters, segEdges, flagMarkers };
1099
+ }
1100
+ function anomalyFurniture(domain, paints, area, flagMarkers, nodes, claims) {
1101
+ let { theme, measure, cats, corridorShown, statFmt } = domain, anomaly = domain.anomaly, { plot, y } = area;
1102
+ drawAnomalyRules(theme, {
1103
+ rules: anomalyRuleLines(theme, anomaly, corridorShown, statFmt, paints.corridor, domain.options.strings),
1104
+ statFmt,
1105
+ plot,
1106
+ y,
1107
+ labelX: plot.x + plot.w + 4,
1108
+ font: { family: theme.type.family, ...theme.type.label },
1109
+ measure,
1110
+ nodes,
1111
+ claims
1112
+ });
1113
+ let anomalyMarks = [], flagSeries = domain.dataSeries[0];
1114
+ return cats.forEach((c) => {
1115
+ let flag = anomaly.flagByCategory.get(c.id), geom = flagMarkers.get(c.id);
1116
+ if (!flag || !geom) return;
1117
+ let nodeId = `mark:${flagSeries.id}:${c.id}`, markerPaint = geom.outside ? paints.corridor : contrastInkPaint(geom.insidePaint, geom.insidePattern), markerNodeId = emitAnomalyFlag(nodes, claims, geom, markerPaint, { seriesId: flagSeries.id, categoryId: c.id }, domain.fmt(flag.value));
1118
+ anomalyMarks.push({
1119
+ categoryId: c.id,
1120
+ nodeId,
1121
+ markerNodeId,
1122
+ labelId: `point:${flagSeries.id}:${c.id}`,
1123
+ score: flag.score
1124
+ });
1125
+ }), anomalyMarks;
1126
+ }
1127
+ function referenceMarks(domain, paints, area, refTickYs, nodes, claims) {
1128
+ let { theme, measure, cats, refSeries, variant, plottedOf, refStyle, pyRef, pyGrowth, valueSpec } = domain, { band, y } = area, referenceTicks = [];
1129
+ if (variant === "stacked100")
1130
+ return cats.forEach((c, ci) => {
1131
+ let glyph = domain.nmCats100.has(c.id) ? NOT_MEANINGFUL : domain.naCats100.has(c.id) ? notApplicableGlyph(domain.options.strings) : null;
1132
+ if (!glyph) return;
1133
+ let font = { family: theme.type.family, ...theme.type.label }, size = measure(glyph, font), cx = band.center(ci), rect = { x: cx - size.width / 2, y: area.y0 - size.height - 6, w: size.width, h: size.height };
1134
+ nodes.push({
1135
+ t: "text",
1136
+ id: `nm:${c.id}`,
1137
+ x: cx,
1138
+ y: rect.y,
1139
+ lines: [glyph],
1140
+ align: "middle",
1141
+ typeRole: "label",
1142
+ font,
1143
+ ink: { token: "inkMuted" },
1144
+ owner: { categoryId: c.id },
1145
+ part: "nmMarker",
1146
+ display: { state: domain.nmCats100.has(c.id) ? NOT_MEANINGFUL : NOT_AVAILABLE }
1147
+ }), claims.claim(rect, "label", { categoryId: c.id });
1148
+ }), referenceTicks;
1149
+ let tickLabels = contentOf(domain.options, "tick", ["absolute", "series"]) !== null, outside = outsideTickReach(domain, band, 0) !== void 0;
1150
+ for (let s of refSeries)
1151
+ cats.forEach((c, ci) => {
1152
+ let v = plottedOf(s, ci);
1153
+ if (v === null) return;
1154
+ let ry = y(v);
1155
+ refStyle !== "marker" && refTickYs.set(c.id, [...refTickYs.get(c.id) ?? [], ry]);
1156
+ let bx = band.position(ci), bw = band.bandwidth, cx = band.center(ci), owner = { seriesId: s.id, categoryId: c.id }, nodeId = `ref:${s.id}:${c.id}`, integrated = pyRef?.id === s.id && pyGrowth.has(c.id), reach = outsideTickReach(domain, band, ci) ?? 8, out = integrated || outside && reach >= 4, tickGeometry = referenceTickGeometry("vertical", bx, ry, out ? bw : -2, bw + (integrated ? 8 : out ? reach : 2));
1157
+ refStyle === "marker" ? nodes.push({
1158
+ t: "circle",
1159
+ id: nodeId,
1160
+ cx: bx + bw / 2,
1161
+ cy: ry,
1162
+ ...referenceMarkerPaint(theme, paints.ref(s)),
1163
+ owner,
1164
+ part: "referenceMarker",
1165
+ display: { value: valueSpec.forSeries(s, s.vals[ci]?.format)(v) }
1166
+ }) : (nodes.push(referenceCasing(nodeId, tickGeometry.line, strokeToken(theme, "rule"), owner)), nodes.push({
1167
+ t: "line",
1168
+ id: nodeId,
1169
+ ...tickGeometry.line,
1170
+ // Plan ticks are quiet furniture: hairline in the axis token.
1171
+ // Explicit series fill/colorRole still wins; 'line' keeps its ink.
1172
+ stroke: paints.refStroke(s),
1173
+ width: strokeToken(theme, "rule"),
1174
+ ...refStyle === "line" ? { dash: dashToken(theme, "dotted"), lineCap: "round" } : {},
1175
+ owner,
1176
+ part: refStyle === "tick" ? "referenceTick" : "referenceLine",
1177
+ display: { value: valueSpec.forSeries(s, s.vals[ci]?.format)(v) }
1178
+ }));
1179
+ let claimRect = integrated ? tickGeometry.claim : refStyle === "marker" ? { x: bx + bw / 2 - REFERENCE_MARKER_R - 1, y: ry - REFERENCE_MARKER_R - 1, w: 2 * REFERENCE_MARKER_R + 2, h: 2 * REFERENCE_MARKER_R + 2 } : tickGeometry.claim;
1180
+ integrated ? claims.claim(claimRect, "mark", owner, "referenceTick") : claims.claim(claimRect, "mark", owner, refStyle === "line" ? "referenceLine" : void 0);
1181
+ let labelId = integrated && tickLabels ? `tick:${s.id}:${c.id}` : void 0;
1182
+ referenceTicks.push({
1183
+ seriesId: s.id,
1184
+ categoryId: c.id,
1185
+ rect: claimRect,
1186
+ nodeId,
1187
+ ...integrated ? { anchor: { x: cx, y: ry }, value: v } : {},
1188
+ ...labelId ? { labelId } : {}
1189
+ });
1190
+ });
1191
+ return referenceTicks;
1192
+ }
1193
+ function netLineMarks(domain, area, nodes, claims) {
1194
+ let { cats, dataSeries, stacks, netLineSeries, netLineSteps, posTopP, negBotP } = domain, { band, y } = area, defaultEdge = posTopP.some((value) => value > 0) ? posTopP : negBotP, edgeValues = cats.map((_, ci) => {
1195
+ if (!netLineSeries) return defaultEdge[ci];
1196
+ let stack = stacks[ci];
1197
+ for (let si = 0; si < dataSeries.length; si++) {
1198
+ let series = dataSeries[si], segment = stack.segments[si];
1199
+ if (!segment) {
1200
+ if (series.id === netLineSeries.id) return;
1201
+ continue;
1202
+ }
1203
+ if (series.id === netLineSeries.id) return segment.end;
1204
+ }
1205
+ }), claimOwner = { annotationId: "netLine" }, line = (id, x1, y1, x2, y2, owner, claim) => {
1206
+ nodes.push({ t: "line", id, x1, y1, x2, y2, stroke: { token: "markInk" }, width: strokeToken(domain.theme, "rule"), owner, part: "netLine" }), claims.claim(claim, "mark", claimOwner, "netLine");
1207
+ };
1208
+ edgeValues.forEach((value, ci) => {
1209
+ if (value === void 0) return;
1210
+ let yy = y(value), x1 = band.position(ci), x2 = x1 + band.bandwidth, owner = {
1211
+ ...netLineSeries ? { seriesId: netLineSeries.id } : {},
1212
+ categoryId: cats[ci].id
1213
+ };
1214
+ line(`netLine:${cats[ci].id}:edge`, x1, yy, x2, yy, owner, { x: x1, y: yy - 0.7, w: Math.max(x2 - x1, 1), h: 1.4 });
1215
+ let next = edgeValues[ci + 1];
1216
+ if (!netLineSteps || next === void 0 || cats[ci].breakAfter) return;
1217
+ let nextY = y(next), nextX = band.position(ci + 1), middleX = (x2 + nextX) / 2, pair = `netLine:${cats[ci].id}:${cats[ci + 1].id}`;
1218
+ line(`${pair}:connector-from`, x2, yy, middleX, yy, owner, { x: x2, y: yy - 0.7, w: Math.max(middleX - x2, 1), h: 1.4 }), line(`${pair}:step`, middleX, yy, middleX, nextY, owner, { x: middleX - 0.7, y: Math.min(yy, nextY), w: 1.4, h: Math.max(Math.abs(nextY - yy), 1) }), line(`${pair}:connector-to`, middleX, nextY, nextX, nextY, owner, { x: middleX, y: nextY - 0.7, w: Math.max(nextX - middleX, 1), h: 1.4 });
1219
+ });
1220
+ let last = edgeValues.length - 1;
1221
+ for (; last >= 0 && edgeValues[last] === void 0; ) last--;
1222
+ return last >= 0 ? { x: band.position(last) + band.bandwidth, y: y(edgeValues[last]) } : void 0;
1223
+ }
1224
+ function netInsideStack(domain, ci) {
1225
+ let c = domain.cats[ci];
1226
+ return domain.variant === "stacked" && domain.gtContent !== null && domain.mixedSignCats.has(c.id) && domain.stacks[ci].hasValue && !domain.incompleteCats.has(c.id) && !domain.pyGrowth.has(c.id);
1227
+ }
1228
+ function netTotalTicks(domain, area, nodes, claims, tickYs) {
1229
+ let { cats, stackTotals } = domain, { band, y } = area;
1230
+ cats.forEach((c, ci) => {
1231
+ if (!netInsideStack(domain, ci)) return;
1232
+ let yy = y(stackTotals[c.id]), x1 = band.position(ci) - 2, x2 = band.position(ci) + band.bandwidth + NET_TICK_REACH, owner = { categoryId: c.id, seriesId: "__netTotal" };
1233
+ nodes.push({ t: "line", id: `netTotal:${c.id}`, x1, y1: yy, x2, y2: yy, stroke: { token: "markInk" }, width: strokeToken(domain.theme, "rule"), owner, part: "netTotal" }), claims.claim({ x: x1, y: yy - 0.7, w: x2 - x1, h: 1.4 }, "mark", owner, "netTotal"), tickYs.set(c.id, [...tickYs.get(c.id) ?? [], yy]);
1234
+ });
1235
+ }
1236
+ var NET_TICK_REACH = 6;
1237
+ function highlightBands(domain, area) {
1238
+ if (domain.dataSeries.length < 2) return [];
1239
+ let { band, plot } = area;
1240
+ return domain.cats.flatMap((c, ci) => {
1241
+ if (!domain.highlights.has(c.id)) return [];
1242
+ let pad = (band.step - band.bandwidth) / 2;
1243
+ return [{
1244
+ t: "rect",
1245
+ id: `highlightBand:${c.id}`,
1246
+ rect: { x: band.position(ci) - pad, y: plot.y, w: band.bandwidth + 2 * pad, h: plot.h },
1247
+ fill: { token: "focus", tint: 0.88 },
1248
+ owner: { categoryId: c.id },
1249
+ part: "highlightBand"
1250
+ }];
1251
+ });
1252
+ }
1253
+ function layoutColumnMarks(domain, paints, area) {
1254
+ let { theme, size, va, anomaly } = domain, { frame, plot, y, y0 } = area, claims = createOccupiedIndex({ x: 0, y: 0, w: size.width, h: size.height }), nodes = [...frame.nodes, ...highlightBands(domain, area)], axes = [];
1255
+ if (area.ruleH > 0 && claims.claim(
1256
+ { x: frame.plot.x, y: frame.plot.y, w: frame.plot.w, h: area.ruleH },
1257
+ "annotation",
1258
+ { annotationId: "anomaly:rule" }
1259
+ ), va.show) {
1260
+ let axisResult = layoutValueAxis(
1261
+ {
1262
+ scale: breakAxisScale(y, domain.stepTicks),
1263
+ plot,
1264
+ orient: "y",
1265
+ // A 100% stack names its shares on the segments; the axis needs only
1266
+ // its ends and the half (0, 50, 100%), not a tick every 20%.
1267
+ ...domain.variant === "stacked100" && domain.dLo === 0 && Math.abs(domain.dHi - 100) < 1e-6 ? { tickCount: 2 } : {},
1268
+ ...domain.stepTicks && !domain.activeBreak ? { ticks: domain.stepTicks } : {},
1269
+ gridlines: va.gridlines ?? !1,
1270
+ format: area.axisFmt,
1271
+ ...area.axisSpec ? { formatSpec: area.axisSpec } : {},
1272
+ theme,
1273
+ measure: domain.measure
1274
+ },
1275
+ claims
1276
+ );
1277
+ nodes.push(...axisResult.nodes), axes.push(axisResult.axis);
1278
+ }
1279
+ let baseline = (id, x1, x2) => ({
1280
+ t: "line",
1281
+ id,
1282
+ x1,
1283
+ y1: y0,
1284
+ x2,
1285
+ y2: y0,
1286
+ stroke: { token: "axis" },
1287
+ width: strokeToken(theme, "rule"),
1288
+ owner: {},
1289
+ part: "baseline"
1290
+ });
1291
+ nodes.push(baseline("axis:baseline", Math.max(0.6, plot.x), Math.min(size.width - 0.6, plot.x + plot.w))), claims.claim({ x: plot.x, y: y0 - 0.5, w: plot.w, h: 1 }, "axis", {});
1292
+ let ribbons = domain.ribbonsOn ? columnRibbons2(domain, paints, area, nodes) : [];
1293
+ domain.connectorsOn && domain.variant !== "grouped" && stackConnectors({ ...domain, axis: "y", scale: area.y, band: area.band }, nodes, claims);
1294
+ let marks = { bars: [], referenceTicks: [], ...ribbons.length > 0 ? { ribbons } : {} }, { rangeNodes, ...bars } = columnBars(domain, paints, area, marks, nodes, claims);
1295
+ if (rangeNodes.length > 0 && (pushAll(nodes, rangeNodes), marks.ranges = bars.rangeMarks), nodes.push(baseline("axis:baseline:over", plot.x, plot.x + plot.w)), domain.cats.forEach((c, ci) => {
1296
+ if (c.role !== "total" || ci === 0) return;
1297
+ let { band } = area, x = (band.position(ci - 1) + band.bandwidth + band.position(ci)) / 2;
1298
+ nodes.push({ t: "line", id: `totalDivider:${c.id}`, x1: x, y1: plot.y, x2: x, y2: y0, stroke: { token: "leader" }, width: strokeToken(theme, "rule"), owner: { categoryId: c.id }, part: "totalDivider" }), claims.claim({ x: x - 1, y: plot.y, w: 2, h: y0 - plot.y }, "axis", { categoryId: c.id }, "totalDivider");
1299
+ }), domain.cats.forEach((c, ci) => {
1300
+ if (!c.breakAfter || ci === domain.cats.length - 1) return;
1301
+ let { band } = area, glyph = categoryBreakGlyph(theme, { x: (band.position(ci) + band.bandwidth + band.position(ci + 1)) / 2, y: y0 }, "x", `axis:x:categoryBreak:${c.id}`);
1302
+ nodes.push(...glyph.nodes), claims.claim(glyph.rect, "axis", {}, "categoryBreak");
1303
+ }), anomaly) {
1304
+ let anomalyMarks = anomalyFurniture(domain, paints, area, bars.flagMarkers, nodes, claims);
1305
+ anomalyMarks.length > 0 && (marks.anomaly = anomalyMarks);
1306
+ }
1307
+ let refTickYs = /* @__PURE__ */ new Map();
1308
+ marks.referenceTicks = referenceMarks(domain, paints, area, refTickYs, nodes, claims);
1309
+ let netLineEnd = domain.netLineOn ? netLineMarks(domain, area, nodes, claims) : void 0;
1310
+ return domain.netLineOn || netTotalTicks(domain, area, nodes, claims, refTickYs), domain.annList.forEach((ann, n) => {
1311
+ if (ann.kind !== "valueLine") return;
1312
+ let annId = ann.id ?? `valueLine-${n + 1}`, v = ann.value === "mean" || ann.value === void 0 ? domain.meanValue : ann.value;
1313
+ v !== void 0 && claims.claim({ x: plot.x, y: y(v) - 1, w: plot.w, h: 2 }, "annotation", {
1314
+ annotationId: annId
1315
+ }, "referenceLine");
1316
+ }), { nodes, claims, axes, marks, ...bars, refTickYs, netLineEnd };
1317
+ }
1318
+ function outsideTickReach(domain, band, ci) {
1319
+ if (domain.variant !== "stacked" || domain.refStyle !== "tick" || contentOf(domain.options, "segment", ["absolute"]) === null) return;
1320
+ let bx = band.position(ci);
1321
+ return Math.min(8, (ci + 1 < domain.cats.length ? band.position(ci + 1) : bx + band.step) - bx - band.bandwidth - 2);
1322
+ }
1323
+
1324
+ // src/core/charts/column/labels.ts
1325
+ function composeLines(domain, content, abs, pct, catLabel, serLabel, authoredPct, valueFmt, ids) {
1326
+ let parts = [];
1327
+ for (let c of content)
1328
+ c === "absolute" && abs !== null ? parts.push([c, valueFmt(abs)]) : c === "percent" && pct !== null ? parts.push([c, ids ? shareTextOf(domain, ids.categoryId, ids.seriesId, pct, authoredPct) : authoredPct ? domain.authoredPctFmt(pct) : domain.pctFmt(pct)]) : c === "category" && catLabel ? parts.push([c, catLabel]) : c === "series" && serLabel && parts.push([c, serLabel]);
1329
+ return valueShareLines(parts);
1330
+ }
1331
+ function composeText(...args) {
1332
+ return composeLines(...args).join(" ");
1333
+ }
1334
+ function emptyCategoryMarkers(domain, area, requests) {
1335
+ if (domain.variant === "grouped") return;
1336
+ let { band, tickFont } = area, na = notApplicableGlyph(domain.options.strings);
1337
+ domain.cats.forEach((c, ci) => {
1338
+ if (!domain.emptyCats.has(c.id) || domain.naCats100.has(c.id)) return;
1339
+ let size = domain.measure(na, tickFont);
1340
+ requests.push({
1341
+ id: `na:${c.id}`,
1342
+ kind: "segment",
1343
+ role: "value",
1344
+ owner: { categoryId: c.id },
1345
+ text: na,
1346
+ lines: [na],
1347
+ typeRole: "label",
1348
+ font: tickFont,
1349
+ priority: PRIORITY.endpoint,
1350
+ candidates: [{ slot: "aboveBaseline", rect: { x: band.center(ci) - size.width / 2, y: area.y0 - size.height - 6, w: size.width, h: size.height }, penalty: 0 }]
1351
+ });
1352
+ });
1353
+ }
1354
+ function seatsOrBox(seats, rect, tsize, suppressed) {
1355
+ return seats.length > 0 || !suppressed ? seats : [{ slot: "insideCenter", rect: { x: rect.x + rect.w / 2 - tsize.width / 2, y: rect.y + rect.h / 2 - tsize.height / 2, w: tsize.width, h: tsize.height }, penalty: 0 }];
1356
+ }
1357
+ function valueLines(domain, place, content, pct) {
1358
+ let { s, c, ci } = place, val = s.vals[ci], valueFmt = val.isPct && !val.format && !s.format ? domain.valueSpec.fmtPercent : domain.valueSpec.forSeries(s, val.format), lines = composeLines(domain, content, domain.absOf(s, ci), pct, c.label ?? c.id, s.label, pct !== null && val.isPct, valueFmt, { categoryId: c.id, seriesId: s.id }), text = lines.join(" ");
1359
+ return typeof val.labelOverride == "string" && (text = val.labelOverride.replace(/\$\{value\}/g, text), lines = [text]), !text && val.labelOverride !== !1 ? null : { text, lines };
1360
+ }
1361
+ function cellValueText(domain, s, ci) {
1362
+ let val = s.vals[ci], abs = domain.absOf(s, ci);
1363
+ if (abs === null) return null;
1364
+ let text = (val.isPct && !val.format && !s.format ? domain.valueSpec.fmtPercent : domain.valueSpec.forSeries(s, val.format))(abs);
1365
+ return typeof val.labelOverride == "string" ? val.labelOverride.replace(/\$\{value\}/g, text) : text;
1366
+ }
1367
+ function pointRequests(domain, paints, area, scene, requests, warnings) {
1368
+ let { options, measure, highlights, cats, dataSeries, anomaly, rangeOf } = domain, { labelFont, band, y } = area, content = contentOf(options, "point", ["absolute"]);
1369
+ content?.includes("percent") && warnings.push({
1370
+ code: "label-part-unavailable",
1371
+ severity: "warn",
1372
+ message: "grouped columns are not parts of a whole, so the value labels print no percent part",
1373
+ suggest: "use variant 'stacked' or 'stacked100' to print each column's share, or drop 'percent' from labels.point"
1374
+ });
1375
+ let pendingPoints = [], mode = options.valueLabels, chosen = mode === void 0 ? void 0 : new Map(dataSeries.map((s) => [s.id, chosenValueIndices(mode, cats.map((_, ci) => s.vals[ci]?.v ?? null))]));
1376
+ for (let place of content ? scene.bars : []) {
1377
+ let { s, c, ci, v } = place;
1378
+ if (chosen && !chosen.get(s.id)?.has(ci) && typeof s.vals[ci]?.labelOverride != "string" && anomaly?.flagByCategory.has(c.id) !== !0) continue;
1379
+ let text = valueLines(domain, place, content, null)?.text ?? null;
1380
+ if (text === null) continue;
1381
+ let endpoint = ci === 0 || ci === cats.length - 1, hl = highlights.has(c.id) || highlights.has(s.id), flagged = anomaly?.flagByCategory.has(c.id) === !0, priority = s.vals[ci].priority ?? (flagged ? PRIORITY.extreme + PRIORITY.highlightBonus : (endpoint ? PRIORITY.endpoint : PRIORITY.interior + Math.min(99, Math.abs(v))) + (hl ? PRIORITY.highlightBonus : 0));
1382
+ pendingPoints.push({ place, text, priority, protect: hl || flagged, hl });
1383
+ }
1384
+ let compactLabelFont = compactValueLabelFont(labelFont, domain.theme.type.footnote, domain.options.target, textScaleOf(domain.options)), groupSlots = groupedOffsets(band.bandwidth, dataSeries.length), normalSizes = pendingPoints.map((point) => measure(point.text || "0", labelFont)), groupedPolicy = groupedValueLabelPolicy(
1385
+ "vertical",
1386
+ groupSlots[0]?.size ?? band.bandwidth,
1387
+ dataSeries.length,
1388
+ normalSizes,
1389
+ labelFont.size,
1390
+ compactLabelFont.size
1391
+ ), crowded = valueRowCrowded(pendingPoints.map(({ place }, i) => {
1392
+ let size = normalSizes[i], above = place.v >= 0;
1393
+ return { x: place.rect.x + place.rect.w / 2 - size.width / 2, y: above ? place.rect.y - size.height - 4 : place.rect.y + place.rect.h + 4, w: size.width, h: size.height };
1394
+ })), steppedForGap = !groupedPolicy.compact && crowded && compactLabelFont.size < labelFont.size, pointFont = groupedPolicy.compact || steppedForGap ? compactLabelFont : labelFont;
1395
+ (groupedPolicy.compact || steppedForGap) && warnings.push({
1396
+ code: "value-labels-font-stepped",
1397
+ severity: "info",
1398
+ message: steppedForGap ? `value labels use the ${pointFont.size}px step: at ${labelFont.size}px neighbouring values stand closer than 6px` : `value labels use the ${pointFont.size}px step: at ${labelFont.size}px some are wider than their ${Math.round(pendingPoints[0]?.place.rect.w ?? 0)}px columns`
1399
+ }), groupedPolicy.firstSeriesOnly && content && warnings.push({
1400
+ code: "value-labels-first-series-only",
1401
+ severity: "info",
1402
+ message: `columns are ${(groupSlots[0]?.size ?? 0).toFixed(1)}px thick, thinner than a value label; only '${dataSeries[0].label ?? dataSeries[0].id}' carries value labels${highlights.size > 0 ? ", plus the highlighted values where they fit" : ""}`,
1403
+ suggest: "give the chart more width, or fewer categories, to label every series"
1404
+ });
1405
+ let lastRanged = [...pendingPoints].reverse().find(({ place }) => rangeOf(place.s, place.ci) !== void 0);
1406
+ if (lastRanged) {
1407
+ let { s, c, ci, rect } = lastRanged.place, range = rangeOf(s, ci), fmt = domain.valueSpec.forSeries(s), text = numberRange(fmt(Math.min(range.low, range.high)), fmt(Math.max(range.low, range.high))), size = measure(text, labelFont), cx = rect.x + rect.w / 2, capY = y(Math.max(range.low, range.high));
1408
+ requests.push({
1409
+ id: `range:${s.id}:${c.id}`,
1410
+ kind: "annotation",
1411
+ role: "value",
1412
+ owner: { seriesId: s.id, categoryId: c.id },
1413
+ text,
1414
+ lines: [text],
1415
+ typeRole: "label",
1416
+ font: labelFont,
1417
+ priority: PRIORITY.valueLine,
1418
+ candidates: [
1419
+ { slot: "rightOfCap", rect: { x: cx + 8, y: capY - size.height / 2, w: size.width, h: size.height }, penalty: 0 },
1420
+ { slot: "leftOfCap", rect: { x: cx - 8 - size.width, y: capY - size.height / 2, w: size.width, h: size.height }, penalty: 1 },
1421
+ { slot: "aboveCap", rect: { x: cx - size.width / 2, y: capY - size.height - 3, w: size.width, h: size.height }, penalty: 2 }
1422
+ ]
1423
+ });
1424
+ }
1425
+ let toDateIds = toDateOnValues(domain), toDate = options.strings?.toDate ?? chartString(options, "toDate"), clampX = (r) => ({ ...r, x: Math.max(area.plot.x, Math.min(r.x, area.plot.x + area.plot.w - r.w)) }), boldFont = { ...pointFont, weight: emphasisWeight(domain.theme) }, seated = pendingPoints.map((point) => {
1426
+ let { s, c, ci, v, rect } = point.place, words = toDateIds.has(c.id) ? toDateLabel(point.text, point.hl ? boldFont : pointFont, toDate, domain.theme, measure) : void 0, tsize = words?.size ?? measure(point.text || "0", point.hl ? boldFont : pointFont), flag = scene.flagMarkers.get(c.id), outset = flag && flag.outside ? ANOMALY_FLAG_GAP + ANOMALY_FLAG_H : 0, natural = rangeOf(s, ci) ? void 0 : pointCandidates(rect, tsize, v < 0, "", y, void 0, outset)[0].rect;
1427
+ return { ...point, words, tsize, outset, natural: natural && clampX(natural) };
1428
+ }), rows = valueSeatRows(seated.map(({ natural, place }) => natural && { rect: natural, negative: place.v < 0 }), scene.bars.map(({ rect }) => rect));
1429
+ for (let [index, { place, text, priority, protect, hl, words, tsize, outset }] of seated.entries()) {
1430
+ let { s, si, c, ci, v, rect } = place;
1431
+ if (groupedPolicy.firstSeriesOnly && si !== 0 && !protect) continue;
1432
+ let val = s.vals[ci], insidePaint = paints.cell(s, val, c, si), insidePattern = paints.pattern(s, val, c);
1433
+ requests.push({
1434
+ id: `point:${s.id}:${c.id}`,
1435
+ kind: "point",
1436
+ owner: { seriesId: s.id, categoryId: c.id },
1437
+ text,
1438
+ lines: words?.lines ?? [text],
1439
+ ...words?.request,
1440
+ typeRole: "label",
1441
+ font: pointFont,
1442
+ priority,
1443
+ // Equal priorities seat left to right, not in id order ('s10' before 's9'), so a stagger alternates rows.
1444
+ order: ci,
1445
+ ...protect ? { protect } : {},
1446
+ ...hl ? { emphasis: !0 } : {},
1447
+ // Columns that touch (a histogram's bins) leave no air between them: a
1448
+ // count as wide as its column sits edge to edge over it.
1449
+ ...(options.bandFraction ?? 0) >= 1 ? { pad: 0 } : {},
1450
+ redundant: val.labelOverride === !1,
1451
+ ...typeof val.labelOverride == "string" ? { keepWhenDense: !0 } : {},
1452
+ // A point label prints no percent part (label-part-unavailable).
1453
+ ...namesOnly(content.filter((part) => part !== "percent"), val.labelOverride),
1454
+ candidates: pointCandidates(rect, tsize, v < 0, paints.inside(s, val, c, si), y, rangeOf(s, ci), outset, rows[index]).map((candidate) => ({ ...candidate, rect: clampX(candidate.rect), insidePaint, insidePattern }))
1455
+ });
1456
+ }
1457
+ return pointFont;
1458
+ }
1459
+ function planColumnValueLabels(domain, paints, area, scene, requests, warnings, noted = { items: /* @__PURE__ */ new Map(), slivers: /* @__PURE__ */ new Set() }, digits) {
1460
+ if (domain.variant === "grouped") return pointRequests(domain, paints, area, scene, requests, warnings);
1461
+ let { options, measure, highlights } = domain, { labelFont } = area, stacked100 = domain.variant === "stacked100", segment = contentOf(options, "segment", stacked100 ? ["percent"] : ["absolute"]), shares = options.shareLabels, only = shares?.only === void 0 ? void 0 : new Set(shares.only), base = segment && shares && !segment.includes("absolute") ? ["absolute", ...segment] : segment, contentAt = (categoryId) => !base || !shares ? base : !only || only.has(categoryId) ? base.includes("percent") ? base : [...base, "percent"] : base.filter((part) => part !== "percent"), pass = (stepped2) => {
1462
+ let slivers2 = [], tooWide2 = [], pending2 = [], sliverOrder = [], seats = [], noShare2 = /* @__PURE__ */ new Set(), items = /* @__PURE__ */ new Map(), sliverIds = /* @__PURE__ */ new Set(), out = [], anyShare2 = !1;
1463
+ for (let place of segment ? scene.bars : []) {
1464
+ let { s, si, c, ci, v, rect } = place, val = s.vals[ci], content = contentAt(c.id), shareAsked = content.includes("percent");
1465
+ anyShare2 ||= shareAsked;
1466
+ let share = shareAsked ? domain.shareOf(s, ci) : null;
1467
+ shareAsked && share === null && !stacked100 && !domain.mixedSignCats.has(c.id) && val.v !== null && noShare2.add(c.label ?? c.id);
1468
+ let composed = valueLines(domain, place, content, share);
1469
+ if (composed === null) continue;
1470
+ let { text, lines } = composed, font = c.role === "total" ? { ...labelFont, weight: emphasisWeight(domain.theme) } : stepped2 ?? labelFont, tsize = linesSize(lines, font, measure), sliver = !(v === 0 && typeof val.labelOverride == "string") && segmentTooShort(domain.density, rect.h, tsize.height, options.labelPlacements?.[`segment:${s.id}:${c.id}`], STACK_ROOM), hl = highlights.has(c.id) || highlights.has(s.id), restHidden = val.labelOverride === void 0 && !hl && restValuesHidden(options, s.colorRole), owedHere = val.labelOverride !== !1 && !restHidden, printed = share === null ? content.filter((part) => part !== "percent") : content, onePart = !stacked100 && (printsValue(val.labelOverride) ? domain.gtContent?.join() === "absolute" : typeof val.labelOverride != "string" && printed.length === 1 && printed[0] === "absolute") && v !== 0 && onePartDrawn(domain.dataSeries.map((x) => x.vals[ci].v)), inTotal = onePart && domain.gtContent != null;
1471
+ sliver && !hl && owedHere && !inTotal && (slivers2.push(`${s.label} in ${c.label ?? c.id}`), sliverOrder.push(`segment:${s.id}:${c.id}`));
1472
+ let note = `${s.label} ${text} (${noteName(c)})`;
1473
+ owedHere && items.set(`segment:${s.id}:${c.id}`, note), sliver && !hl && owedHere && domain.density !== "minimal" && sliverIds.add(`segment:${s.id}:${c.id}`);
1474
+ let priority = val.priority ?? PRIORITY.interior + Math.min(99, Math.abs(v)) + (hl ? PRIORITY.highlightBonus : 0), leader = domain.density === "full" || v === 0 && typeof val.labelOverride == "string";
1475
+ !leader && !inTotal && !only?.has(c.id) && typeof val.labelOverride != "string" && val.labelOverride !== !1 && !restHidden && !(sliver && !hl) && !fitsInside({ ...rect, h: 1 / 0 }, tsize, 0) && tooWide2.push(c.label ?? c.id), pending2.push({ id: `segment:${s.id}:${c.id}`, owed: owedHere && domain.density !== "minimal", authored: typeof val.labelOverride == "string" });
1476
+ let request = {
1477
+ id: `segment:${s.id}:${c.id}`,
1478
+ kind: "segment",
1479
+ owner: { seriesId: s.id, categoryId: c.id },
1480
+ ...onePart ? { printedIn: `grandTotal:${c.id}` } : {},
1481
+ ...namesOnly(printed, val.labelOverride),
1482
+ text,
1483
+ lines,
1484
+ ...lines.length > 1 ? { align: "middle" } : {},
1485
+ typeRole: "label",
1486
+ font,
1487
+ ...stepped2 && c.role !== "total" ? { fontStep: stepped2 } : {},
1488
+ priority,
1489
+ ...hl ? { protect: hl } : {},
1490
+ // The sliver gate passes the highlighted value, which the solver drops last.
1491
+ redundant: val.labelOverride === !1 || sliver && !hl,
1492
+ ...restHidden ? restValueHiding(note) : {},
1493
+ candidates: seatsOrBox(segmentLabelCandidates(
1494
+ "vertical",
1495
+ rect,
1496
+ tsize,
1497
+ paints.inside(s, val, c, si),
1498
+ { baseline: area.y0, leaderObstacles: scene.refTickYs.get(c.id), insidePaint: paints.cell(s, val, c, si), insidePattern: paints.pattern(s, val, c), insideOnly: !leader }
1499
+ ), rect, tsize, val.labelOverride === !1 || sliver && !hl)
1500
+ }, pinnedDigits = options.labelPlacements?.[request.id] === "insideDigits", seat = (pinnedDigits || digits && sliver && !hl && owedHere && !inTotal && domain.density !== "minimal") && lines.length === 1 ? digitSeat(rect, text, tsize, measure.capHeight?.(font), font.size, digitSeatEdge(domain.theme, paints.pattern(s, val, c))) : void 0, seatCandidate = seat && {
1501
+ slot: "insideDigits",
1502
+ rect: seat,
1503
+ penalty: 0,
1504
+ pad: 0,
1505
+ insideFill: paints.inside(s, val, c, si),
1506
+ insidePaint: paints.cell(s, val, c, si),
1507
+ insidePattern: paints.pattern(s, val, c)
1508
+ };
1509
+ pinnedDigits ? out.push(seatCandidate ? { ...request, candidates: [...request.candidates, seatCandidate] } : request) : (out.push(request), seatCandidate && seats.push({ ...request, redundant: !1, candidates: [seatCandidate] }));
1510
+ }
1511
+ return { slivers: slivers2, sliverOrder, seats, tooWide: tooWide2, pending: pending2, noShare: noShare2, items, sliverIds, out, anyShare: anyShare2 };
1512
+ }, stepped, done = pass();
1513
+ for (; done.tooWide.length > 0; ) {
1514
+ let next = stepDownFont(domain.theme, stepped ?? labelFont, "label", options.target, textScaleOf(options));
1515
+ if (!next) break;
1516
+ stepped = next, done = pass(stepped);
1517
+ }
1518
+ let { slivers, tooWide, pending, noShare, anyShare } = done;
1519
+ for (let [id, note] of done.items) noted.items.set(id, note);
1520
+ for (let id of done.sliverIds) noted.slivers.add(id);
1521
+ if (pushAll(requests, done.out), tooWide.length > 0) {
1522
+ let hidden = new Set(pending.filter((entry) => !entry.authored).map((entry) => entry.id));
1523
+ for (let request of requests) hidden.has(request.id) && (request.redundant = !0);
1524
+ for (let entry of pending) hidden.has(entry.id) && entry.owed && noted.slivers.add(entry.id);
1525
+ warnings.push({
1526
+ code: "segment-labels-hidden",
1527
+ severity: "info",
1528
+ message: `segment values are not printed: some are wider than their column (${[...new Set(tooWide)].slice(0, 5).join(", ")})`,
1529
+ suggest: "widen the chart, use a shorter number format, or set labelDensity 'full' to print them outside on leaders"
1530
+ });
1531
+ }
1532
+ return digits && tooWide.length === 0 && done.seats.length > 0 ? (digits.requests.push(...done.seats), digits.slivers = done.sliverOrder.map((id, i) => [id, slivers[i]]), digits.warningAt = warnings.length) : warnSliverLabels(warnings, slivers), warnShareParts(warnings, anyShare && !stacked100 ? domain.cats.filter((c) => domain.mixedSignCats.has(c.id) && contentAt(c.id)?.includes("percent")).map((c) => c.label ?? c.id) : [], [...noShare]), labelFont;
1533
+ }
1534
+ function anomalyRuleRequest(domain, area, requests, warnings) {
1535
+ let { anomaly } = domain, { tickFont, frame, plot } = area;
1536
+ if (!anomaly) return;
1537
+ if (!area.ruleOn) {
1538
+ warnings.push({
1539
+ code: "label-hidden",
1540
+ severity: "warn",
1541
+ // The label id is spelled into the message on purpose, so
1542
+ // that `label '<id>'` can be parsed out of every warning carrying this code.
1543
+ message: "label 'anomaly:rule' was suppressed by labels.valueLine while its corridor and flag markers still render \u2014 the reader is shown a threshold with no stated rule",
1544
+ owner: { annotationId: "anomaly:rule" },
1545
+ suggest: "enable labels.valueLine so the corridor explains itself, or drop options.anomaly"
1546
+ });
1547
+ return;
1548
+ }
1549
+ let wrapped = area.ruleWrap, ruleLines = wrapped.lines;
1550
+ wrapped.title !== void 0 && warnings.push({
1551
+ code: "anomaly-rule-truncated",
1552
+ severity: "warn",
1553
+ message: `the anomaly rule sentence does not fit the plot width and was cut: "${area.ruleText}"`,
1554
+ owner: { annotationId: "anomaly:rule" },
1555
+ suggest: "use a wider size, or shorten it with anomaly.label"
1556
+ });
1557
+ let width = Math.max(...ruleLines.map((line) => domain.measure(line, tickFont).width)), height = ruleLines.length * tickFont.size * 1.2, at = (yy) => ({ x: frame.plot.x + 2, y: yy, w: width, h: height });
1558
+ requests.push({
1559
+ id: "anomaly:rule",
1560
+ kind: "tick",
1561
+ // Same annotation id as the reserve claim, so the solver treats that
1562
+ // claim as this label's own instead of as a collision.
1563
+ owner: { annotationId: "anomaly:rule" },
1564
+ text: anomaly.rule,
1565
+ lines: ruleLines,
1566
+ ...wrapped.title !== void 0 ? { title: wrapped.title } : {},
1567
+ typeRole: "footnote",
1568
+ font: tickFont,
1569
+ priority: PRIORITY.valueLine,
1570
+ candidates: [
1571
+ // The band reserved for it above the plot. Everything after this is a
1572
+ // fallback for the case where authored furniture took the band.
1573
+ { slot: "ruleBand", rect: at(frame.plot.y + 2), penalty: 0 },
1574
+ { slot: "plotTop", rect: at(plot.y + 2), penalty: 1 },
1575
+ { slot: "plotBottom", rect: at(plot.y + plot.h - height - 2), penalty: 2 }
1576
+ ]
1577
+ });
1578
+ }
1579
+ function categoryRequests(domain, area, requests) {
1580
+ let { cats, anomaly } = domain, { catPlan, band } = area, dateTicks = catPlan.dateNumeric, categoryLabelGap = anomaly ? 4 : 6, catX = catPlan.x, keep = catPlan.keep, rotated = catPlan.rotation !== 0, rowY = area.catRowY + categoryLabelGap;
1581
+ cats.forEach((c, ci) => {
1582
+ let info = catPlan.infos[ci], bold = !rotated && (c.role === "total" || domain.highlights.has(c.id)), boldFont = { ...catPlan.font, weight: emphasisWeight(domain.theme) }, w = bold ? Math.max(info.w, ...info.lines.map((line) => domain.measure(line, boldFont).width)) : info.w, at = (yy) => ({ x: catX(ci) - (w - info.w) / 2, y: yy, w, h: info.h }), below = { slot: "below", rect: at(rowY), penalty: 0 }, belowShifted = { slot: "belowShifted", rect: at(rowY + area.gtH + 4), penalty: 1 };
1583
+ requests.push({
1584
+ id: `category:${c.id}`,
1585
+ kind: "category",
1586
+ owner: { categoryId: c.id },
1587
+ text: c.label ?? c.id,
1588
+ lines: info.lines,
1589
+ ...categoryLineAlign(catPlan, ci),
1590
+ ...info.title !== void 0 ? { title: info.title } : {},
1591
+ typeRole: catPlan.typeRole,
1592
+ font: c.role === "total" ? boldFont : catPlan.font,
1593
+ priority: PRIORITY.endpoint,
1594
+ // A stride-hidden date label is the row's decision (one info lint), not a loss.
1595
+ redundant: !keep[ci],
1596
+ ...rotated ? { rotate: catPlan.rotation === 90 ? -90 : -45 } : {},
1597
+ candidates: catPlan.rotation === 90 ? [{ slot: "below", rect: verticalNameRect(band.center(ci), area.catRowY, info.w, catPlan.font), penalty: 0 }] : rotated ? [{ slot: "below", rect: rotatedClaimRect(band.center(ci), area.catRowY + Math.max(categoryLabelGap + 2, info.h * Math.SQRT1_2 / 2 + ROTATED_NAME_AIR), info.h), penalty: 0 }] : dateTicks ? [below] : [below, belowShifted]
1598
+ });
1599
+ }), pushAll(requests, yearRowRequests(catPlan, rowY));
1600
+ }
1601
+ function stackTotalText(domain, ci, format = domain.totalFmt) {
1602
+ let c = domain.cats[ci];
1603
+ if (!domain.gtContent || !domain.stacks[ci].hasValue) return null;
1604
+ let stacked100 = domain.variant === "stacked100";
1605
+ if (domain.nmCats100.has(c.id) || domain.naCats100.has(c.id) || stacked100 && domain.incompleteCats.has(c.id)) return null;
1606
+ let text = composeText(domain, domain.gtContent, domain.stackTotals[c.id], stacked100 ? domain.posTopP[ci] : null, c.label ?? c.id, "", !1, format);
1607
+ if (!text) return null;
1608
+ let net = !domain.netLineOn && netInsideStack(domain, ci);
1609
+ return { text: net ? `${domain.options.strings.net} ${text}` : text, net };
1610
+ }
1611
+ function partialWords(domain, ci) {
1612
+ return domain.variant === "stacked" && domain.incompleteCats.has(domain.cats[ci].id) && disclosuresShown(domain.options) ? domain.options.strings.incomplete : void 0;
1613
+ }
1614
+ function planColumnLabels(domain, area, scene, requests, warnings) {
1615
+ let { measure, highlights, cats, gtContent, stackTotals, variant, posTopP, negBotP, pyRef, pyGrowth, totalFmt } = domain, { strongFont, tickFont, band, y } = area, growthPoints = [], growthOn = kindSetting(domain.options, "growth") !== !1, box = (x, yy, size) => ({ x, y: yy, w: size.width, h: size.height });
1616
+ emptyCategoryMarkers(domain, area, requests);
1617
+ let totalAt = (ci, format = totalFmt) => stackTotalText(domain, ci, format), fullTotals = cats.map((_, ci) => totalAt(ci)), spec = domain.valueSpec.spec, maxTotal = maxOf(cats.map((c) => Math.abs(stackTotals[c.id]))), compactTotals = domain.options.mode === "compact" && variant === "stacked" && spec.magnitude === "none" && !spec.suffix.includes("%") && maxTotal >= 1e3 && fullTotals.some((total) => total && measure(total.text, strongFont).width + 6 > band.step), compactFormat = (value) => Math.abs(value) < 1e3 ? totalFmt(value) : formatWithSpec(value, {
1618
+ ...spec,
1619
+ magnitude: Math.abs(value) >= 1e9 ? "bn" : Math.abs(value) >= 1e6 ? "m" : "k",
1620
+ decimals: 1,
1621
+ significantDigits: void 0
1622
+ }), linked = new Map(requests.flatMap((req) => req.printedIn ? [[req.printedIn, req.id]] : [])), authoredPart = (ci) => {
1623
+ let id = linked.get(`grandTotal:${cats[ci].id}`), series = id && domain.dataSeries.find((s) => id === `segment:${s.id}:${cats[ci].id}`);
1624
+ return series && printsValue(series.vals[ci].labelOverride) ? requests.find((req) => req.id === id)?.text : void 0;
1625
+ }, totals = (compactTotals ? cats.map((_, ci) => totalAt(ci, compactFormat)) : fullTotals).map((total, ci) => {
1626
+ let text = total && !total.net ? authoredPart(ci) : void 0;
1627
+ return text ? { ...total, text } : total;
1628
+ }), toDateIds = toDateOnValues(domain), toDate = domain.options.strings?.toDate ?? chartString(domain.options, "toDate"), wordsAt = (ci, text, font) => {
1629
+ let words = toDateIds.has(cats[ci].id) ? toDate : partialWords(domain, ci);
1630
+ return words ? toDateLabel(text, font, words, domain.theme, measure) : void 0;
1631
+ }, seats = (font) => totals.map((total, ci) => {
1632
+ if (!total || total.net) return null;
1633
+ let size = wordsAt(ci, total.text, font)?.size ?? measure(total.text, font), above = posTopP[ci] > 0 || negBotP[ci] === 0, edgeY = y(above ? posTopP[ci] : negBotP[ci]);
1634
+ return { x: band.center(ci) - size.width / 2, y: above ? edgeY - size.height - 4 : edgeY + 4, w: size.width, h: size.height };
1635
+ }), rowFont = valueRowCrowded(seats(strongFont)) ? stepDownFont(domain.theme, strongFont, "label", domain.options.target, textScaleOf(domain.options)) : void 0, totalFont = rowFont ?? strongFont, thinned = domain.dataSeries.length > 1 && valueRowCrowded(seats(totalFont)), valueAlone = gtContent?.join() === "absolute";
1636
+ cats.forEach((c, ci) => {
1637
+ let total = totals[ci];
1638
+ if (!total) return;
1639
+ let { text, net } = total, words = net ? void 0 : wordsAt(ci, text, totalFont), tsize = words?.size ?? measure(text, net ? strongFont : totalFont), above = posTopP[ci] > 0 || negBotP[ci] === 0, cx = band.center(ci), netY = y(stackTotals[c.id]), netX = band.position(ci) + band.bandwidth + NET_TICK_REACH + 3, totalCandidates = net ? [
1640
+ { slot: "rightOfNet", rect: box(netX, netY - tsize.height / 2, tsize), penalty: 0 },
1641
+ { slot: "rightOfNetAbove", rect: box(netX, netY - tsize.height - 2, tsize), penalty: 1 },
1642
+ { slot: "rightOfNetBelow", rect: box(netX, netY + 2, tsize), penalty: 2 },
1643
+ // Dense columns leave no room beside the tick: the net then stands over its column, as a total does.
1644
+ { slot: "aboveNet", rect: box(cx - tsize.width / 2, y(posTopP[ci]) - tsize.height - 4, tsize), penalty: 3 }
1645
+ ] : totalLabelCandidates("vertical", { x: cx, y: y(above ? posTopP[ci] : negBotP[ci]) }, tsize, above ? "positive" : "negative").slice(0, 1).map((candidate) => ({ ...candidate, overRules: !0, rect: { ...candidate.rect, x: Math.max(area.plot.x, Math.min(candidate.rect.x, area.plot.x + area.plot.w - candidate.rect.w)) } })).flatMap((candidate) => {
1646
+ if (!thinned || !above) return [candidate];
1647
+ let { x, w } = candidate.rect, clear = Math.min(...[ci - 1, ci + 1].filter((n) => n >= 0 && n < cats.length && band.position(n) < x + w + 2 && band.position(n) + band.bandwidth > x - 2).map((n) => y(posTopP[n]) - tsize.height - 4));
1648
+ return clear < candidate.rect.y - 0.5 ? [candidate, { ...candidate, slot: "aboveNeighbours", rect: { ...candidate.rect, y: clear }, penalty: candidate.penalty + 1, reach: 4 * lineBox(totalFont) + 8 }] : [candidate];
1649
+ }), skipped = thinned && !net && ci % 2 !== (cats.length - 1) % 2 && !highlights.has(c.id);
1650
+ requests.push({
1651
+ id: `grandTotal:${c.id}`,
1652
+ kind: "grandTotal",
1653
+ ...namesOnly(variant === "stacked100" ? gtContent : gtContent?.filter((part) => part !== "percent"), void 0),
1654
+ ...net ? { role: "category" } : {},
1655
+ ...skipped ? { redundant: !0, suppressedAs: "density", owed: !0 } : {},
1656
+ ...!net && !words && valueAlone && linked.has(`grandTotal:${c.id}`) ? { printedIn: linked.get(`grandTotal:${c.id}`) } : {},
1657
+ owner: { categoryId: c.id },
1658
+ text,
1659
+ lines: words?.lines ?? [text],
1660
+ ...words?.request,
1661
+ // the note names a total by its one series, else as the stack's total ("Total 60 (Jan)"); a Net names itself.
1662
+ ...net ? {} : { noteText: `${domain.dataSeries.length === 1 ? noteName(domain.dataSeries[0]) : chartString(domain.options, "total")} ${compactTotals ? fullTotals[ci].text : text}${words ? ` ${words.lines[1]}` : ""} (${noteName(c)})` },
1663
+ typeRole: "label",
1664
+ font: net ? strongFont : totalFont,
1665
+ ...rowFont && !net ? { fontStep: rowFont } : {},
1666
+ priority: PRIORITY.grandTotal + (highlights.has(c.id) ? PRIORITY.highlightBonus : 0),
1667
+ // A highlighted stack's total keeps the full ink under labels.ink 'muted'.
1668
+ ...highlights.has(c.id) ? { emphasis: !0 } : {},
1669
+ candidates: totalCandidates
1670
+ });
1671
+ let integrated = growthOn ? pyGrowth.get(c.id) : void 0;
1672
+ if (!integrated) return;
1673
+ let annotationId = `integratedVariance:${integrated.referenceSeriesId}:${c.id}`, growthLabelId = `annotation:${annotationId}`, growthSize = measure(integrated.text, strongFont), yy = totalCandidates[0].rect.y, growthAt = box(cx - growthSize.width / 2, above ? yy - growthSize.height - 4 : yy + tsize.height + 4, growthSize);
1674
+ requests.push({
1675
+ id: growthLabelId,
1676
+ kind: "annotation",
1677
+ role: composedTextRole(integrated.text, "note"),
1678
+ owner: { annotationId, categoryId: c.id },
1679
+ text: integrated.text,
1680
+ lines: [integrated.text],
1681
+ typeRole: "label",
1682
+ font: strongFont,
1683
+ priority: PRIORITY.total,
1684
+ candidates: [{ slot: above ? "aboveTotal" : "belowTotal", rect: growthAt, penalty: 0 }]
1685
+ }), growthPoints.push({
1686
+ ...integrated,
1687
+ x: cx,
1688
+ tickY: y(integrated.reference),
1689
+ totalLabelId: `grandTotal:${c.id}`,
1690
+ growthLabelId,
1691
+ referenceLabelId: `tick:${integrated.referenceSeriesId}:${c.id}`,
1692
+ tickNodeId: `ref:${integrated.referenceSeriesId}:${c.id}`
1693
+ });
1694
+ }), anomalyRuleRequest(domain, area, requests, warnings);
1695
+ let tickContent = contentOf(domain.options, "tick", ["absolute", "series"]), pyKeyed = pyTickKeyed(domain, area.frame.legend);
1696
+ for (let s of tickContent && domain.variant !== "stacked100" ? domain.refSeries : []) cats.forEach((c, ci) => {
1697
+ let v = domain.plottedOf(s, ci);
1698
+ if (v === null) return;
1699
+ let integrated = pyRef?.id === s.id && pyGrowth.has(c.id), ry = y(v), bx = band.position(ci), text = composeText(domain, integrated && pyKeyed ? ["absolute"] : tickContent, v, null, c.label ?? c.id, s.label, !1, domain.valueSpec.forSeries(s)), size = measure(text, tickFont), reach = outsideTickReach(domain, band, ci), primaryX = bx + band.bandwidth + (integrated ? PY_TICK_LEAD : reach !== void 0 && reach >= 4 ? reach + 3 : 5);
1700
+ requests.push({
1701
+ id: `tick:${s.id}:${c.id}`,
1702
+ kind: "tick",
1703
+ owner: { seriesId: s.id, categoryId: c.id },
1704
+ text,
1705
+ lines: [text],
1706
+ typeRole: "label",
1707
+ font: tickFont,
1708
+ // A plain reference value takes the seat the column values leave.
1709
+ priority: integrated ? PRIORITY.valueLine : PRIORITY.interior - 1,
1710
+ candidates: [
1711
+ // A dot sits mid-column: its value goes beside the dot first, clear of its ring.
1712
+ ...domain.refStyle === "marker" ? [
1713
+ { slot: "rightOfMarker", rect: box(band.center(ci) + REFERENCE_MARKER_R + 4, ry - size.height / 2, size), penalty: 0 },
1714
+ { slot: "leftOfMarker", rect: box(band.center(ci) - REFERENCE_MARKER_R - 4 - size.width, ry - size.height / 2, size), penalty: 0.5 }
1715
+ ] : [],
1716
+ { slot: "rightOfTick", rect: box(primaryX, ry - size.height / 2, size), penalty: 1 },
1717
+ { slot: "rightOfTickAbove", rect: box(primaryX, ry - size.height - 4, size), penalty: 2 },
1718
+ { slot: "rightOfTickBelow", rect: box(primaryX, ry + 4, size), penalty: 3 },
1719
+ { slot: "leftOfTick", rect: box(bx - 12 - size.width, ry - size.height / 2, size), penalty: 4 }
1720
+ ]
1721
+ });
1722
+ });
1723
+ let end = scene.netLineEnd;
1724
+ if (end) {
1725
+ let text = netLineName(domain.dataSeries, domain.netLineSeries, domain.stacks, domain.options.strings), size = measure(text, strongFont);
1726
+ requests.push({
1727
+ id: "netLine",
1728
+ kind: "valueLine",
1729
+ role: "category",
1730
+ owner: { annotationId: "netLine" },
1731
+ text,
1732
+ lines: [text],
1733
+ typeRole: "label",
1734
+ font: strongFont,
1735
+ priority: PRIORITY.valueLine,
1736
+ candidates: [
1737
+ { slot: "right", rect: box(end.x + 4, end.y - size.height / 2, size), penalty: 0 },
1738
+ { slot: "above", rect: box(end.x - size.width, end.y - size.height - 4, size), penalty: 1 }
1739
+ ]
1740
+ });
1741
+ }
1742
+ return rightEdgeSeriesRequests(domain, area, requests), extremeNameRequest(domain, area, scene, requests), area.showCatRow && categoryRequests(domain, area, requests), rankValueLabels(requests, (request) => {
1743
+ let ci = cats.findIndex((c) => c.id === request.owner.categoryId);
1744
+ if (!(ci < 0))
1745
+ return request.kind === "grandTotal" ? stackTotals[cats[ci].id] : domain.dataSeries.find((s) => s.id === request.owner.seriesId)?.vals[ci]?.v;
1746
+ }, domain.density, domain.options.labelPlacements, {
1747
+ categories: cats.length,
1748
+ last: domain.options.mode === "compact" ? cats.at(-1)?.id : void 0,
1749
+ pitch: band.step / (variant === "grouped" ? domain.dataSeries.length : 1),
1750
+ orientation: "vertical",
1751
+ measure
1752
+ }), growthPoints;
1753
+ }
1754
+ function extremeNameRequest(domain, area, scene, requests) {
1755
+ if (domain.options.labels === !1 || !area.showCatRow || area.catPlan.dateNumeric || area.catPlan.keep.every(Boolean)) return;
1756
+ let extreme = scene.bars.reduce((best, place) => !best || Math.abs(place.v) > Math.abs(best.v) ? place : best, void 0);
1757
+ if (!extreme || area.catPlan.keep[extreme.ci]) return;
1758
+ let { c, s, v, rect } = extreme, text = domain.variant === "grouped" && contentOf(domain.options, "point", ["absolute"]) !== null ? c.label ?? c.id : `${c.label ?? c.id} ${domain.valueSpec.forSeries(s)(v)}`, font = { ...area.labelFont, weight: emphasisWeight(domain.theme) }, size = domain.measure(text, font), cx = rect.x + rect.w / 2, endY = v < 0 ? rect.y + rect.h + 4 : rect.y - size.height - 4, box = (x, y) => ({ x, y, w: size.width, h: size.height });
1759
+ requests.push({
1760
+ id: `extreme:${s.id}:${c.id}`,
1761
+ kind: "annotation",
1762
+ role: composedTextRole(text, "note"),
1763
+ owner: { seriesId: s.id, categoryId: c.id },
1764
+ text,
1765
+ lines: [text],
1766
+ typeRole: "label",
1767
+ font,
1768
+ priority: PRIORITY.valueLine,
1769
+ candidates: [
1770
+ { slot: "atEnd", rect: box(cx - size.width / 2, endY), penalty: 0 },
1771
+ { slot: "atEndRight", rect: box(rect.x + rect.w + 4, v < 0 ? rect.y + rect.h - size.height : rect.y), penalty: 1 },
1772
+ { slot: "atEndLeft", rect: box(rect.x - 4 - size.width, v < 0 ? rect.y + rect.h - size.height : rect.y), penalty: 2 }
1773
+ ]
1774
+ });
1775
+ }
1776
+ function rightEdgeSeriesRequests(domain, area, requests) {
1777
+ let named = rightEdgeSeriesLabels(domain);
1778
+ if (named.length === 0) return;
1779
+ let { measure, cats, stacks, dataSeries } = domain, { band, y } = area, labelFont = edgeNameFont(area.labelFont, domain), left = domain.options.seriesLabels?.at === "left-edge", edge = left ? 0 : cats.length - 1, stack = stacks[edge];
1780
+ if (!(stack === void 0 || !stack.hasValue))
1781
+ for (let series of named) {
1782
+ let seriesIndex = dataSeries.findIndex((candidate) => candidate.id === series.id), segment = seriesIndex < 0 ? null : stack.segments[seriesIndex];
1783
+ if (!segment) continue;
1784
+ let size = measure(series.label, labelFont), middle = y((segment.start + segment.end) / 2), x = left ? band.position(edge) - RIGHT_EDGE_GAP - size.width : band.position(edge) + band.bandwidth + RIGHT_EDGE_GAP;
1785
+ requests.push({
1786
+ id: `seriesEdge:${series.id}`,
1787
+ kind: "series",
1788
+ owner: { seriesId: series.id, categoryId: cats[edge].id },
1789
+ text: series.label,
1790
+ lines: [series.label],
1791
+ typeRole: "label",
1792
+ font: labelFont,
1793
+ priority: PRIORITY.endpoint,
1794
+ candidates: [
1795
+ { slot: left ? "leftOfStack" : "rightOfStack", rect: { x, y: middle - size.height / 2, w: size.width, h: size.height }, penalty: 0 }
1796
+ ]
1797
+ });
1798
+ }
1799
+ }
1800
+ var SEAT_PAD = 2;
1801
+ function valueSeatRows(naturals, bars) {
1802
+ let spans = (a, b, gap = SEAT_PAD) => b.x < a.x + a.w + gap && a.x < b.x + b.w + gap, step = (rect) => rect.h + 4, first = naturals.map((seat) => {
1803
+ if (!seat) return;
1804
+ let { rect, negative } = seat, edge = negative ? Math.max(rect.y, maxOf(bars.filter((bar) => spans(rect, bar) && bar.y + bar.h + SEAT_PAD > rect.y && bar.y < rect.y).map((bar) => bar.y + bar.h + SEAT_PAD + 0.5))) : Math.min(rect.y + rect.h, minOf(bars.filter((bar) => spans(rect, bar) && bar.y - SEAT_PAD < rect.y + rect.h && bar.y + bar.h > rect.y + rect.h).map((bar) => bar.y - SEAT_PAD - 0.5))) - rect.h, lift = Math.abs(edge - rect.y);
1805
+ return { ...rect, y: edge, lifted: lift > 1e-6 && lift <= step(rect) ? edge : void 0 };
1806
+ });
1807
+ return naturals.map((seat, i) => {
1808
+ let row1 = first[i];
1809
+ if (!seat || !row1) return;
1810
+ let stagger = seat.negative ? row1.y + step(row1) : row1.y - step(row1);
1811
+ for (let [j, other] of first.entries())
1812
+ j === i || !other || naturals[j].negative !== seat.negative || !spans(row1, other, SERIES_VALUE_GAP) || (stagger = seat.negative ? Math.max(stagger, other.y + other.h + SEAT_PAD + 0.5) : Math.min(stagger, other.y - SEAT_PAD - 0.5 - row1.h));
1813
+ return { ...row1.lifted === void 0 ? {} : { lifted: row1.lifted }, stagger };
1814
+ });
1815
+ }
1816
+ function pointCandidates(rect, tsize, negative, insideFill, y, range, outset = 0, rows) {
1817
+ let cx = rect.x + rect.w / 2, markTop = rect.y, markBot = rect.y + rect.h, beside = range ? [
1818
+ { slot: "besideWhiskerRight", rect: { x: cx + 9, y: negative ? markBot + 3 : markTop - tsize.height - 3, w: tsize.width, h: tsize.height }, penalty: 0 },
1819
+ { slot: "besideWhiskerLeft", rect: { x: cx - 9 - tsize.width, y: negative ? markBot + 3 : markTop - tsize.height - 3, w: tsize.width, h: tsize.height }, penalty: 0.5 }
1820
+ ] : [], yTop = (range ? Math.min(markTop, y(range.low), y(range.high)) : markTop) - outset, yBot = (range ? Math.max(markBot, y(range.low), y(range.high)) : markBot) + outset, w = tsize.width, h = tsize.height, inside = tsize.width <= rect.w && tsize.height + 4 <= rect.h;
1821
+ return negative ? [
1822
+ ...beside,
1823
+ { slot: "outsideBottom", rect: { x: cx - w / 2, y: yBot + 4, w, h }, penalty: 0, overRules: !0 },
1824
+ ...rows?.lifted === void 0 ? [] : [{ slot: "outsideBottomLifted", rect: { x: cx - w / 2, y: rows.lifted, w, h }, penalty: 0.5 }],
1825
+ {
1826
+ slot: "outsideBottomShifted",
1827
+ rect: { x: cx - w / 2, y: rows?.stagger ?? yBot + h + 8, w, h },
1828
+ penalty: 1
1829
+ },
1830
+ ...inside ? [{ slot: "insideEnd", rect: { x: cx - w / 2, y: markBot - h - 2, w, h }, penalty: 2, insideFill }] : []
1831
+ ] : [
1832
+ ...beside,
1833
+ // A reference line across this seat (an average marker) does not move
1834
+ // the value: it crosses the line on a halo, level with its neighbours.
1835
+ { slot: "outsideTop", rect: { x: cx - w / 2, y: yTop - h - 4, w, h }, penalty: 0, overRules: !0 },
1836
+ ...rows?.lifted === void 0 ? [] : [{ slot: "outsideTopLifted", rect: { x: cx - w / 2, y: rows.lifted, w, h }, penalty: 0.5 }],
1837
+ {
1838
+ slot: "outsideTopShifted",
1839
+ rect: { x: cx - w / 2, y: rows?.stagger ?? yTop - 2 * h - 8, w, h },
1840
+ penalty: 1
1841
+ },
1842
+ ...inside ? [{ slot: "insideEnd", rect: { x: cx - w / 2, y: markTop + 2, w, h }, penalty: 2, insideFill }] : []
1843
+ ];
1844
+ }
1845
+
1846
+ // src/core/charts/column/paints.ts
1847
+ function signWord(s, positive, strings) {
1848
+ return positive === (s.direction !== "lowerIsBetter") ? strings?.better ?? localeStrings().better : strings?.worse ?? localeStrings().worse;
1849
+ }
1850
+ function seriesPattern(s) {
1851
+ return s.scenario === "FC" ? "hatch45" : s.scenario === "PL" ? "outline" : void 0;
1852
+ }
1853
+ function columnPaints(domain, warnings) {
1854
+ let { options, theme, palette, highlights, cats, dataSeries, variant, plottedOf, othersId, signColor, uniformScenario } = domain, resolved = /* @__PURE__ */ new Map(), paintCss = (paint) => {
1855
+ let key = JSON.stringify(paint), css = resolved.get(key);
1856
+ return css === void 0 && resolved.set(key, css = paintColor(theme, paint)), css;
1857
+ }, authored = domain.seriesNorm.filter((s) => dataSeries.includes(s)), roles = colorRolePaints(authored), ownPaints = authored.map((s) => s.fill ? { css: s.fill } : s.colorRole ? roles.get(s.id) : highlights.has(s.id) ? { token: "focus" } : void 0), authoredSlots = rampSlots(theme, ownPaints, palette, { labels: authored.map((s) => s.label), warnings }), stackOwn = (variant === "stacked" || variant === "stacked100") && ownPaints.some(Boolean) ? ownPaints : void 0, quietRest = !!options.seriesRamp && (options.othersShade ?? DEFAULT_OTHERS_SHADE) === "quietest" && authored.some((s) => s.colorRole === "others" && !s.fill);
1858
+ quietRest && warnings.push(...othersShadeUnavailableWarnings(theme, { token: "markInk" }));
1859
+ let slotOf = new Map(authored.map((s, i) => [s.id, authoredSlots[i] ?? i])), receding = recedingSeriesId(dataSeries, highlights), slots = dataSeries.map((s, i) => slotOf.get(s.id) ?? i), marked = authored.some((s) => s.colorRole !== void 0 || highlights.has(s.id) || s.id === receding), stackPlain = (variant === "stacked" || variant === "stacked100") && palette === void 0 && !marked ? authored.filter((s) => !s.fill) : [], actuals = dataSeries.filter((x) => x.scenario === void 0 || x.scenario === "AC"), plans = dataSeries.filter((x) => x.scenario === "PL"), planPartner = new Map(plans.flatMap((plan, k) => actuals[k] ? [[plan.id, actuals[k]]] : [])), seriesIdentityPaint = (s, dataIdx, scenario = s.scenario) => {
1860
+ if (s.fill) return { css: s.fill };
1861
+ if (s.colorRole) return roles.get(s.id) ?? markRolePaint(s.colorRole, !0);
1862
+ if (highlights.has(s.id)) return markRolePaint("focus", !0);
1863
+ if (options.seriesRamp) return orderedRampPaint(authored.length - 1 - authored.indexOf(s), authored.length, quietRest);
1864
+ if (s.id === receding) return mutedMarkPaint();
1865
+ let partner = planPartner.get(s.id);
1866
+ if (partner) return seriesIdentityPaint(partner, dataSeries.indexOf(partner), scenario);
1867
+ let slot = slots[dataIdx] ?? dataIdx;
1868
+ return dataSeries.length === 1 ? seriesPaint(slot, palette, scenario, !0) : stackPlain.length > 1 && stackPlain.includes(s) ? stackRampPaint(stackPlain.indexOf(s), stackPlain.length, slot) : stackOwn && authored.includes(s) ? stackApartPaint(stackOwn, authored.indexOf(s), slot, palette) : seriesPaint(slot, palette);
1869
+ }, restRecedes = dataSeries.length === 1 && cats.some((c, ci) => highlights.has(c.id) && (plottedOf(dataSeries[0], ci) ?? 0) !== 0), seriesBasePaint = (s, dataIdx) => restRecedes && !s.fill && !s.colorRole && !s.scenario ? { token: "rest" } : seriesIdentityPaint(s, dataIdx), cellPaint = (s, val, cat, dataIdx) => val.fill ? { css: val.fill } : othersId !== null && cat.id === othersId ? { token: "othersMark" } : highlights.has(s.id) || highlights.has(cat.id) && dataSeries.length === 1 ? s.fill ? { css: s.fill } : s.colorRole ? roles.get(s.id) ?? markRolePaint(s.colorRole, !0) : markRolePaint("focus", !0) : signColor ? signPaint(s, val.v, options.colorblindSafe) : uniformScenario.has(cat.id) ? seriesIdentityPaint(s, dataIdx, val.scenario ?? s.scenario) : val.scenario ? seriesIdentityPaint(s, dataIdx, val.scenario) : seriesBasePaint(s, dataIdx), scenarioPattern = (s, val, cat) => {
1870
+ let sc = val.scenario ?? s.scenario;
1871
+ if (uniformScenario.get(cat.id) !== "PL")
1872
+ return sc === "FC" ? "hatch45" : sc === "PL" ? "outline" : void 0;
1873
+ }, cellOutline = (cat) => uniformScenario.get(cat.id) === "PL", cellPattern = (s, val, cat) => partialPattern(cat, scenarioPattern(s, val, cat), cellOutline(cat));
1874
+ signColor && signColorOverrides(cats, dataSeries, highlights, othersId, (s, ci) => s.vals[ci], warnings);
1875
+ let paintedCells = [];
1876
+ for (let s of dataSeries)
1877
+ cats.forEach((c, ci) => {
1878
+ let v = plottedOf(s, ci);
1879
+ v !== null && (variant !== "grouped" && v === 0 || paintedCells.push({ s, val: s.vals[ci], c }));
1880
+ });
1881
+ let refPaintOf = (s) => s.fill ? { css: s.fill } : s.colorRole ? { token: markRoleToken(s.colorRole) } : { token: "ink" };
1882
+ return {
1883
+ css: paintCss,
1884
+ cell: cellPaint,
1885
+ pattern: cellPattern,
1886
+ outline: cellOutline,
1887
+ // what the viewer SEES: outline reads as background, hatch as a
1888
+ // mostly-background blend — auto-ink must contrast against that
1889
+ inside: (s, val, cat, dataIdx) => effectiveFill(paintCss(cellPaint(s, val, cat, dataIdx)), cellPattern(s, val, cat), theme),
1890
+ corridor: columnCorridorPaint(options.colorblindSafe),
1891
+ ref: refPaintOf,
1892
+ refStroke: (s) => domain.refStyle === "tick" && !s.fill && !s.colorRole ? { token: "axis" } : refPaintOf(s),
1893
+ identity: seriesIdentityPaint,
1894
+ base: seriesBasePaint,
1895
+ cellPatterns: paintedCells.map(({ s, val, c }) => scenarioPattern(s, val, c)),
1896
+ partialHatch: paintedCells.some(({ s, val, c }) => cellPattern(s, val, c) !== scenarioPattern(s, val, c))
1897
+ };
1898
+ }
1899
+
1900
+ // src/core/charts/column/plot.ts
1901
+ var TILED_BANDS = /* @__PURE__ */ Symbol("tiledBands"), SEGMENT_NOTE = /* @__PURE__ */ Symbol("segmentNote"), CATEGORY_NOTES = /* @__PURE__ */ Symbol("categoryNotes"), CAGR_PAD = /* @__PURE__ */ Symbol("cagrPad");
1902
+ function uniformCellLook(domain, paints, s, i) {
1903
+ let looks = domain.cats.flatMap((c, ci) => {
1904
+ let v = domain.plottedOf(s, ci);
1905
+ return v === null || domain.variant !== "grouped" && v === 0 ? [] : [{ paint: paints.cell(s, s.vals[ci], c, i), pattern: paints.pattern(s, s.vals[ci], c) }];
1906
+ }), first = looks[0];
1907
+ if (!first || looks.some((look) => look.pattern !== first.pattern || paints.css(look.paint) !== paints.css(first.paint))) return {};
1908
+ let hatchGround = segmentHatchGround(domain.variant === "grouped" ? "bar" : "segment", first.pattern, first.paint);
1909
+ return { paint: first.paint, pattern: first.pattern, ...hatchGround ? { hatchGround } : {} };
1910
+ }
1911
+ function columnLegendItems(domain, paints) {
1912
+ let { dataSeries, refSeries, variant, refStyle, anomaly, corridorShown, statFmt } = domain, legendUsesSeriesIdentity = domain.uniformScenario.size > 0, seriesItems = domain.signColor ? dataSeries.flatMap((s) => [
1913
+ {
1914
+ id: `${s.id}:above`,
1915
+ label: stringFields(domain.options.strings.aboveZero, { series: s.label, meaning: signWord(s, !0, domain.options.strings) }),
1916
+ paint: signPaint(s, 1, domain.options.colorblindSafe)
1917
+ },
1918
+ {
1919
+ id: `${s.id}:below`,
1920
+ label: stringFields(domain.options.strings.belowZero, { series: s.label, meaning: signWord(s, !1, domain.options.strings) }),
1921
+ paint: signPaint(s, -1, domain.options.colorblindSafe)
1922
+ }
1923
+ ].filter((_, index) => s.vals.some((v) => v.v !== null && (index === 0 ? v.v > 0 : v.v < 0)))) : dataSeries.map((s, i) => ({
1924
+ id: s.id,
1925
+ label: s.label,
1926
+ paint: legendUsesSeriesIdentity ? paints.identity(s, i) : paints.base(s, i),
1927
+ pattern: legendUsesSeriesIdentity ? void 0 : seriesPattern(s),
1928
+ // A series whose every drawn column looks the same is keyed in that look, hatch included.
1929
+ ...uniformCellLook(domain, paints, s, i)
1930
+ })), edgeNamed = edgeNamesReplaceKey(domain) ? new Set(rightEdgeSeriesLabels(domain).map((series) => series.id)) : void 0, keyedSeries = edgeNamed ? seriesItems.filter((item) => !edgeNamed.has(item.id)) : seriesItems;
1931
+ return [
1932
+ ...keyedSeries,
1933
+ // The scenario the CELLS carry, when no series key already carries it.
1934
+ // `keyPatterns` reads the items just built rather than re-deriving them,
1935
+ // so the two can never disagree about what the legend already says.
1936
+ // suppressed refs (stacked100) must not appear in the legend either —
1937
+ // a swatch for an unrendered mark is a lying legend
1938
+ ...variant === "stacked100" ? [] : refSeries.map((s) => ({
1939
+ id: s.id,
1940
+ label: referenceKeyLabel(domain, s),
1941
+ paint: refStyle === "marker" ? paints.ref(s) : paints.refStroke(s),
1942
+ key: "line",
1943
+ ...refStyle === "line" ? { dash: dashToken(domain.theme, "dotted"), lineCap: "round", width: strokeToken(domain.theme, "rule") } : { width: strokeToken(domain.theme, "rule") },
1944
+ ...refStyle === "marker" ? referenceMarkerKey(domain.theme, paints.ref(s)) : {}
1945
+ })),
1946
+ ...scenarioLegendKeys({
1947
+ markPatterns: paints.cellPatterns,
1948
+ keyPatterns: keyedSeries.map((item) => item.pattern),
1949
+ paint: { token: "neutralMark" },
1950
+ strings: domain.options.strings
1951
+ }),
1952
+ ...partialLegendKeys(paints.partialHatch && !partialNamedOnValues(domain), domain.options.strings, domain.cats),
1953
+ // The flag marker and the corridor rule carry the anomaly verdict, so the
1954
+ // legend keys them, not only the fill. Key glyphs mirror the actual mark
1955
+ // encoding, so these are drawn as a marker and a dashed line, in the same
1956
+ // paint the furniture uses.
1957
+ ...anomalyLegendItems(domain.theme, anomaly, corridorShown, statFmt, paints.corridor, domain.options.strings, domain.options.locale?.language),
1958
+ // An interval whisker is keyed in its shape.
1959
+ ...rangeDrawn(domain) ? [{ id: "__range", label: domain.options.strings.range, paint: { token: "ink" }, key: "whisker", width: strokeToken(domain.theme, "rule") }] : []
1960
+ ];
1961
+ }
1962
+ var PANEL_GROUP_FRACTION = 0.72, PANEL_GROUP_BAR = 76, COLUMN_FRACTION_MAX = 0.7;
1963
+ function columnBandFraction(plotW, count) {
1964
+ let pitch = plotW / Math.max(1, count);
1965
+ return 0.56 - 0.06 * Math.min(1, Math.max(0, (pitch - 64) / 154));
1966
+ }
1967
+ function referenceKeyLabel(domain, s) {
1968
+ return s.scenario === "PY" && s.label.trim() === "PY" ? chartString2(domain.options, "priorYearKey") : s.label;
1969
+ }
1970
+ function rangeDrawn(domain) {
1971
+ return panelTypeClass(domain.options) === void 0 && domain.dataSeries.some((s) => domain.cats.some((_, ci) => domain.rangeOf(s, ci) !== void 0));
1972
+ }
1973
+ function columnLegend(domain, paints, warnings) {
1974
+ let { options, signColor, anomaly } = domain, referenceDrawn = domain.variant !== "stacked100" && panelTypeClass(options) === void 0 && domain.refSeries.some((s) => s.vals.some((val) => val.v !== null)), legendForcedByEncoding = signColor || anomaly !== void 0 || referenceDrawn || rangeDrawn(domain);
1975
+ legendForcedByEncoding && options.legend === "none" && warnings.push({
1976
+ code: "legend-suppressed-encoding",
1977
+ severity: "warn",
1978
+ message: `legend: 'none' suppressed the only key naming this exhibit's encodings (${[signColor ? "sign colour" : "", anomaly ? "the anomaly corridor and flag marker" : "", referenceDrawn ? "the reference mark" : ""].filter(Boolean).join(", ")}) \u2014 the reader is left to infer them`,
1979
+ suggest: "drop legend: 'none', or drop signColor/anomaly/the reference series"
1980
+ });
1981
+ let effectiveLegend = options.legend === void 0 && legendForcedByEncoding ? "top" : options.legend;
1982
+ if (!effectiveLegend || effectiveLegend === "none" || effectiveLegend === "auto") return;
1983
+ let legendOpts = normalizeLegendOption(effectiveLegend), items = columnLegendItems(domain, paints);
1984
+ if (!(items.length === 0 && edgeNamesReplaceKey(domain))) {
1985
+ if (legendOpts.order) {
1986
+ let oi = (id) => {
1987
+ let k = legendOpts.order.indexOf(id);
1988
+ return k === -1 ? Number.MAX_SAFE_INTEGER : k;
1989
+ };
1990
+ items = [...items].sort((a, b) => oi(a.id) - oi(b.id));
1991
+ }
1992
+ return { options: legendOpts, items };
1993
+ }
1994
+ }
1995
+ function bandKeyRow(domain, paints, eventKey) {
1996
+ if (!eventKey?.legend?.length) return;
1997
+ let single = domain.dataSeries.length === 1 ? domain.dataSeries[0].id : void 0, items = columnLegendItems(domain, paints).filter((item) => item.id !== single);
1998
+ return { options: { position: "top" }, items };
1999
+ }
2000
+ function solveColumnFrame(domain, paints, warnings, eventKey) {
2001
+ let { options, theme, size, measure, anomaly, corridorShown, statFmt, netLineOn, netLineSeries, variant } = domain, claims = createOccupiedIndex({ x: 0, y: 0, w: size.width, h: size.height }), decorationFont = { family: theme.type.family, ...theme.type.label, weight: emphasisWeight(theme) }, anomalyRuleLabelWidth = anomaly?.usable ? anomalyRuleReserve(anomalyRuleLines(theme, anomaly, corridorShown, statFmt, { token: "warn" }, options.strings), { family: theme.type.family, ...theme.type.label }, measure) : 0, decorationRight = Math.max(
2002
+ netLineOn ? measure(netLineName(domain.dataSeries, netLineSeries, domain.stacks, options.strings), decorationFont).width + 12 : 0,
2003
+ anomalyRuleLabelWidth
2004
+ ), tokenMargin = canvasMargin(theme, size.width), edgeNamesRight = options.seriesLabels?.at !== "left-edge" && rightEdgeSeriesLabels(domain).length > 0, margin = {
2005
+ ...tokenMargin,
2006
+ right: Math.max(variant === "stacked100" && !edgeNamesRight ? 56 : tokenMargin.right, decorationRight),
2007
+ bottom: ratioTierCanRender(options.ratioTier, domain.cats, domain.seriesNorm) ? 3 : tokenMargin.bottom,
2008
+ ...options.margin
2009
+ }, axisFont = { family: theme.type.family, ...theme.type.axis }, axisReserve = domain.va.show ? measureValueAxisWidth([domain.dLo, domain.dHi], domain.fmt, theme, measure, 5, domain.valueSpec.spec) : 0, categoryWidth = Math.max(0, maxOf(domain.cats.map((c) => measure(c.label ?? c.id, axisFont).width))) + 4;
2010
+ if (domain.cats.length > 0 && categoryWidth > (size.width - margin.left - margin.right - axisReserve) / domain.cats.length) {
2011
+ let gutter = measure("0", axisFont).height;
2012
+ options.margin?.left === void 0 && (margin.left = Math.min(margin.left, gutter)), options.margin?.right === void 0 && (margin.right = Math.max(decorationRight, Math.min(margin.right, gutter)));
2013
+ }
2014
+ margin.right = Math.max(
2015
+ margin.right,
2016
+ options[VALUE_LINE_RESERVE] ?? 0,
2017
+ options[TICK_LABEL_RESERVE] ?? 0
2018
+ );
2019
+ let legend = columnLegend(domain, paints, warnings) ?? bandKeyRow(domain, paints, eventKey);
2020
+ return { frame: solveFrame(
2021
+ {
2022
+ size,
2023
+ margin,
2024
+ ...frameTextOptions(options),
2025
+ footnotes: [
2026
+ ...partialFootnotes(domain.cats, options.strings, legend?.items.some((item) => item.id === "__partial") || partialNamedOnValues(domain)),
2027
+ ...authoredNotes(options),
2028
+ // Above 8 values the note counts them against all drawn values.
2029
+ ...noteLine(
2030
+ options.strings.valuesNotOnColumns,
2031
+ options[SEGMENT_NOTE] ?? [],
2032
+ options,
2033
+ domain.dataSeries.reduce((sum, series) => sum + series.vals.filter((cell) => cell.v !== null).length, 0)
2034
+ ),
2035
+ ...options[CATEGORY_NOTES] ?? [],
2036
+ ...partialTotalsNote(domain, options)
2037
+ ],
2038
+ legend,
2039
+ ...eventKey ? { eventKey } : {},
2040
+ theme,
2041
+ measure
2042
+ },
2043
+ claims
2044
+ ), claims };
2045
+ }
2046
+ function partialTotalsNote(domain, options) {
2047
+ return domain.variant !== "stacked" || domain.gtContent === null ? [] : noteLine(knownPartsLead(domain.options), domain.cats.flatMap((c, ci) => {
2048
+ if (!domain.incompleteCats.has(c.id)) return [];
2049
+ let missing = domain.dataSeries.filter((s) => s.vals[ci].v === null).map((s) => s.label);
2050
+ return [`${c.label ?? c.id} ${domain.options.strings.without} ${missing.join(` ${domain.options.strings.and} `)}`];
2051
+ }), options);
2052
+ }
2053
+ var RIBBON_COLUMN = 0.04;
2054
+ function widestSegmentValue(domain) {
2055
+ let { dataSeries, cats, variant, theme, measure } = domain, font = { family: theme.type.family, ...theme.type.label }, widest = 0;
2056
+ for (let s of dataSeries)
2057
+ cats.forEach((_, ci) => {
2058
+ let val = s.vals[ci], v = domain.plottedOf(s, ci);
2059
+ if (v === null) return;
2060
+ let text = variant === "stacked100" ? shareTextOf(domain, cats[ci].id, s.id, v, val.isPct) : domain.valueSpec.forSeries(s, val.format)(domain.absOf(s, ci));
2061
+ widest = Math.max(widest, measure(text, font).width);
2062
+ });
2063
+ return widest;
2064
+ }
2065
+ function columnBand(domain, frame, valueAxisReserve, tickFont, warnings, stair) {
2066
+ let { options, theme, measure, cats, va } = domain, plotX0 = frame.plot.x + (va.show ? valueAxisReserve : 0), plotW0 = va.show ? Math.max(10, frame.plot.w - valueAxisReserve) : frame.plot.w, narrow = domain.ribbonsOn && domain.ribbonRank, ribbonColumn = narrow ? Math.min(0.15, Math.max(RIBBON_COLUMN, (widestSegmentValue(domain) + 8) / plotW0)) : 0, ribbonFraction = ribbonColumn * (cats.length - 1) / (1 - 2 * ribbonColumn), grouped = domain.variant === "grouped" && domain.dataSeries.length > 1, panelGroup = options.bandFraction === void 0 && !narrow && grouped && panelTypeClass(options) !== void 0, bandFraction = panelGroup ? PANEL_GROUP_FRACTION : options.bandFraction ?? (narrow ? Math.min(0.7, Math.max(ribbonColumn, ribbonFraction)) : domain.pyRef ? pyTickKeyed(domain, frame.legend) ? 0.5 : 0.42 : grouped ? COLUMN_FRACTION_MAX : columnBandFraction(plotW0, cats.length)), bandFor = (x0, w) => bandScale(cats.length, [x0, x0 + w], {
2067
+ paddingInner: 1 - bandFraction,
2068
+ // Histogram bins tile the number line: the plot ends at the outer bin edges.
2069
+ paddingOuter: narrow ? bandFraction / 2 : options[TILED_BANDS] === !0 ? (1 - bandFraction) / 2 : (1 - bandFraction) / 2 + 0.05,
2070
+ gapAfter: cats.map((c, ci) => {
2071
+ let authored = c.gapAfter === !0 ? 0.5 : typeof c.gapAfter == "number" ? Math.max(0, c.gapAfter) : 0, gap = cats[ci + 1]?.role === "total" ? Math.max(authored, 0.5) : authored;
2072
+ return c.breakAfter ? Math.max(gap, 0.5) : gap;
2073
+ })
2074
+ }), edgeNames = rightEdgeSeriesLabels(domain), edgeLeft = options.seriesLabels?.at === "left-edge", edgeNeed = edgeNames.length === 0 ? 0 : maxOf(edgeNames.map((series) => measure(series.label, edgeNameFont({ family: theme.type.family, ...theme.type.label }, domain)).width)) + RIGHT_EDGE_GAP, edgeGiven = 0, edgePad = (x0, w) => {
2075
+ let band2 = bandFor(x0, w);
2076
+ return edgeLeft ? band2.position(0) - x0 : x0 + w - (band2.position(cats.length - 1) + band2.bandwidth);
2077
+ }, giveEdgeRoom = () => {
2078
+ if (edgeNeed === 0 || edgeGiven > 0 && edgeGiven + edgePad(plotX0, plotW0) >= edgeNeed) return;
2079
+ let room = edgeNeed - edgeGiven;
2080
+ for (let pass = 0; pass < 4; pass++) {
2081
+ let x0 = edgeLeft ? plotX0 + room : plotX0;
2082
+ room = Math.max(0, Math.ceil(edgeNeed - edgeGiven - edgePad(x0, Math.max(10, plotW0 - room)) + 1));
2083
+ }
2084
+ room = Math.min(plotW0 - 10, room), edgeLeft && (plotX0 += Math.max(0, room)), plotW0 = Math.max(10, plotW0 - room), edgeGiven += Math.max(0, room);
2085
+ };
2086
+ if (giveEdgeRoom(), stair) {
2087
+ let direction = staircaseDirection(domain.posTopP), room = staircaseRoom({
2088
+ names: cats.map((c) => c.label ?? c.id),
2089
+ font: tickFont,
2090
+ measure,
2091
+ direction,
2092
+ edge: direction === "right" ? frame.plot.x + frame.plot.w : plotX0,
2093
+ width: plotW0,
2094
+ centers: (r) => {
2095
+ let b = bandFor(direction === "right" ? plotX0 : plotX0 + r, plotW0 - r);
2096
+ return cats.map((_, ci) => b.center(ci));
2097
+ }
2098
+ });
2099
+ direction === "left" && (plotX0 += room), plotW0 -= room;
2100
+ }
2101
+ let fitColumnWidth = () => {
2102
+ if (options.bandFraction === void 0 && !narrow && !domain.pyRef && !grouped) {
2103
+ let strong = { family: theme.type.family, ...theme.type.label, weight: emphasisWeight(theme) }, widestTotal = Math.max(0, maxOf(cats.map((_, ci) => {
2104
+ let total = stackTotalText(domain, ci), words = partialWords(domain, ci);
2105
+ return total && !total.net ? Math.max(measure(total.text, strong).width, words ? measure(words, toDateFont(theme)).width : 0) : 0;
2106
+ }))), need = Math.max(widestSegmentValue(domain) + 10, widestTotal + 8);
2107
+ for (let pass = 0; pass < 3; pass++) {
2108
+ let width = bandFor(plotX0, plotW0).bandwidth;
2109
+ if (width >= need - 0.01 || bandFraction >= COLUMN_FRACTION_MAX) break;
2110
+ bandFraction = Math.min(COLUMN_FRACTION_MAX, bandFraction * need / width);
2111
+ }
2112
+ }
2113
+ if (domain.variant === "stacked100" && options.bandFraction === void 0 && !narrow && panelTypeClass(options) === void 0)
2114
+ for (let pass = 0; pass < 3; pass++) {
2115
+ let width = bandFor(plotX0, plotW0).bandwidth;
2116
+ if (width <= STACKED100_COLUMN_MAX + 0.01) break;
2117
+ bandFraction *= STACKED100_COLUMN_MAX / width;
2118
+ }
2119
+ if (panelGroup) {
2120
+ let n = domain.dataSeries.length, cap = PANEL_GROUP_BAR * n + 4 * (n - 1);
2121
+ for (let pass = 0; pass < 3; pass++) {
2122
+ let width = bandFor(plotX0, plotW0).bandwidth;
2123
+ if (width <= cap + 0.01) break;
2124
+ bandFraction *= cap / width;
2125
+ }
2126
+ }
2127
+ };
2128
+ fitColumnWidth();
2129
+ let pyRef = domain.pyRef;
2130
+ if (pyRef && options.bandFraction === void 0 && !narrow && pyTickKeyed(domain, frame.legend)) {
2131
+ let format = domain.valueSpec.forSeries(pyRef), widest = Math.max(0, maxOf(cats.map((_, ci) => {
2132
+ let v = domain.plottedOf(pyRef, ci);
2133
+ return v === null ? 0 : measure(format(v), tickFont).width;
2134
+ }))), need = PY_TICK_LEAD + widest + 4;
2135
+ for (let pass = 0; pass < 3; pass++) {
2136
+ let probe = bandFor(plotX0, plotW0);
2137
+ if (probe.step - probe.bandwidth >= need - 0.01) break;
2138
+ bandFraction = Math.max(0.3, 1 - need / probe.step);
2139
+ }
2140
+ }
2141
+ for (let pass = 0; pass < 3; pass++) {
2142
+ let before = plotW0;
2143
+ if (giveEdgeRoom(), plotW0 === before) break;
2144
+ fitColumnWidth();
2145
+ }
2146
+ let band = bandFor(plotX0, plotW0), planRow = (b, ticked2) => {
2147
+ let row = categoryLabelsAndMarks(cats, { count: authoredFootnoteCount(options), warnings }, partialAxisWords(options.strings, options, frame.legend?.items.some((item) => item.id === "__partial") || partialNamedOnValues(domain)));
2148
+ return ticked2?.name(row), withCategoryRanks(planCategoryRow({
2149
+ target: options.target,
2150
+ textScale: textScaleOf(options),
2151
+ ...row,
2152
+ centers: cats.map((_, ci) => b.center(ci)),
2153
+ step: b.step,
2154
+ fonts: [tickFont, { ...tickFont, size: tickFont.size - scaleTextPx(1, textScaleOf(options)) }, { family: theme.type.family, ...theme.type.footnote }],
2155
+ secondary: secondaryFont(theme),
2156
+ periods: cats.length > 0 && cats.every((c) => c.date !== void 0),
2157
+ padding: 4,
2158
+ measure,
2159
+ plotHeight: frame.plot.h,
2160
+ reference: { x: frame.plot.x, width: frame.plot.w },
2161
+ // A cut name takes a note mark only where its note prints.
2162
+ // Without the rank key, nominal names keep one name per column (rotate, then ellipsis).
2163
+ // Under notes.show 'ranks' alone a cut name takes no mark, since its note does not print.
2164
+ ...disclosuresShown(options) ? { cutMarkFrom: authoredFootnoteCount(options) + 1 } : rankKeyShown(options) ? {} : { everyName: !0 },
2165
+ ...ticked2?.plan
2166
+ }), measure, cats.map((c) => c.label ?? c.id), options[FORCE_CATEGORY_RANKS] === !0, rankKeyShown(options));
2167
+ }, catPlan = planRow(band), ticked = longDayMonths(cats, catPlan.stride, options.locale?.language);
2168
+ ticked && (catPlan = planRow(band, ticked));
2169
+ let catOverhang = stair ? 0 : rotatedLeftOverhang(catPlan, cats.map((_, ci) => band.center(ci)), 4);
2170
+ return catOverhang > 0 && (plotX0 += catOverhang, plotW0 -= catOverhang, band = bandFor(plotX0, plotW0), catPlan = planRow(band, ticked)), { band, catPlan };
2171
+ }
2172
+ var CAGR_ON_ARM_ROOM = 26, STACKED100_COLUMN_MAX = 110, CAGR_ON_ARM_MIN = 16;
2173
+ function columnPlotArea(domain, frame, warnings) {
2174
+ let { options, theme, size, measure, variant, va, fmt, valueSpec, cats, dLo, dHi } = domain, percentAxis = variant !== "stacked100" && percentCellsOnly(domain.dataSeries), axisFmt = variant === "stacked100" ? (v) => formatAutomaticPercent(v, 0, !1, options.locale?.language) : percentAxis ? valueSpec.fmtPercent : fmt, axisSpec = variant === "stacked100" ? void 0 : percentAxis ? valueSpec.percentSpec : valueSpec.spec, valueAxisReserve = va.show ? measureValueAxisWidth([dLo, dHi], axisFmt, theme, measure, 5, axisSpec) : 0, ratioTierPrepared = prepareRatioTier(
2175
+ options.ratioTier,
2176
+ cats,
2177
+ domain.seriesNorm,
2178
+ theme,
2179
+ measure,
2180
+ Math.max(10, frame.plot.w - valueAxisReserve),
2181
+ void 0,
2182
+ options.target,
2183
+ notApplicableGlyph(options.strings),
2184
+ options.locale?.language
2185
+ );
2186
+ pushAll(warnings, ratioTierPrepared.warnings);
2187
+ let tier = ratioTierPrepared.tier, tickFont = { family: theme.type.family, ...theme.type.axis }, labelFont = { family: theme.type.family, ...theme.type.label }, strongFont = { family: theme.type.family, ...theme.type.label, weight: emphasisWeight(theme) }, gtH = measure("0", strongFont).height, partialH = (ci) => {
2188
+ let words = partialWords(domain, ci);
2189
+ return words ? measure(words, toDateFont(theme)).height : 0;
2190
+ }, hasCagr = (options.annotations ?? []).some((a) => a.kind === "cagr"), integratedGrowthH = domain.pyRef && kindSetting(options, "growth") !== !1 ? measure("+88.8%", strongFont).height + 4 : 0, ruleOn = domain.anomaly !== void 0 && kindSetting(options, "valueLine") !== !1, ruleText = ruleOn ? `${domain.anomaly.rule}${domain.corridorNote}` : "", ruleWrap = ruleOn ? fitText(ruleText, tickFont, Math.max(80, frame.plot.w - 8), 4, measure, { target: options.target, textScale: textScaleOf(options), typeRole: "footnote" }) : void 0, ruleH = ruleWrap ? ruleWrap.lines.length * tickFont.size * 1.2 + 6 : 0, axisTitle = va.show && axisTitleAllowed(options.labels) ? planValueAxisTitle(valueAxisTitleText(
2191
+ theme,
2192
+ options.axisTitles?.primary,
2193
+ options,
2194
+ valueAxisUnit(options.unit, domain.dataSeries, variant === "stacked100")
2195
+ ), theme, measure, frame.plot.w) : void 0, stair = staircaseOn(options.categoryLabels, options) && kindSetting(options, "category") !== !1 && cats.length > 1, { band, catPlan } = columnBand(domain, frame, valueAxisReserve, tickFont, warnings, stair), showCatRow = kindSetting(options, "category") !== !1 && cats.length > 0 && !stair;
2196
+ showCatRow && pushAll(warnings, catPlan.warnings), showCatRow && catPlan.step === "ranks" && warnings.push(categoryRanksLint(cats.map((c) => c.label ?? c.id), band.step));
2197
+ let tickReserve = showCatRow ? catPlan.rowHeight + 8 : 0, catBandH = tier ? 6 + catPlan.rowHeight + ratioTierMetrics.categoryCaptionGap - theme.space.tierGap : tickReserve, ratioTierHeight = tier?.reserveHeight ?? 0, lowest = Math.min(0, minOf(domain.negBotP)), pointsHang = variant === "grouped" && (kindSetting(options, "point") !== !1 || domain.anomaly !== void 0), hangingEnd = Math.min(0, minOf(cats.map((_, ci) => pointsHang || domain.gtContent && domain.posTopP[ci] <= 0 ? domain.negBotP[ci] : 0))), hangingRoom = showCatRow && options.labels !== !1 ? Math.max(measure("0", labelFont).height, gtH) + 4 + (domain.anomaly ? ANOMALY_FLAG_GAP + ANOMALY_FLAG_H : 0) : 0, axisTitleH = valueAxisTitleBand(axisTitle, theme, measure), cagrRoom = Math.max(CAGR_ON_ARM_MIN, CAGR_ON_ARM_ROOM - axisTitleH - ruleH - integratedGrowthH);
2198
+ hasCagr && cagrRoom < 30 && recordFreedChrome(frame.frame, "cagr-headroom", 30 - cagrRoom);
2199
+ let cagrPad = options[CAGR_PAD] ?? 0;
2200
+ hasCagr && cagrPad > 0 && recordFreedChrome(frame.frame, "cagr-pad", cagrPad);
2201
+ let growthAndCagr = integratedGrowthH + (hasCagr ? cagrRoom + cagrPad : 0), unrowedH = frame.plot.h - catBandH - ratioTierHeight - 8 - axisTitleH - growthAndCagr - ruleH, unrowedPlotH = unrowedH - hangingLabelReserve(unrowedH, [dLo, dHi], hangingEnd, hangingRoom), headerRows = (domain.gtContent ? domain.activeBreak ? gtH + 6 : Math.max(0, maxOf(domain.posTopP.map((top, ci) => top > 0 ? seatRoom(top, [dLo, dHi], gtH + partialH(ci) + 4, unrowedPlotH) : 0))) : 0) + growthAndCagr, axisTitleBand = valueAxisTitleBand(axisTitle, theme, measure, headerRows), rawBandPad = options[BAND_PAD] ?? 0, baseTopPad = 8 + axisTitleBand + headerRows + ruleH + (stair ? staircaseState(options).pad : 0), plotH0NoBand = frame.plot.h - catBandH - ratioTierHeight - baseTopPad, hangingReserveNoBand = hangingLabelReserve(plotH0NoBand, [dLo, dHi], hangingEnd, hangingRoom), minRawH = Math.max(10, options.mode === "compact" ? 80 : 0), bandPad = rawBandPad > 0 ? Math.max(0, Math.min(rawBandPad, Math.floor(plotH0NoBand - hangingReserveNoBand - minRawH))) : 0;
2202
+ for (; bandPad > 0 && frame.plot.h - catBandH - ratioTierHeight - (baseTopPad + bandPad) - hangingLabelReserve(frame.plot.h - catBandH - ratioTierHeight - (baseTopPad + bandPad), [dLo, dHi], hangingEnd, hangingRoom) < minRawH; )
2203
+ bandPad--;
2204
+ let topPad = baseTopPad + bandPad, plotH0 = frame.plot.h - catBandH - ratioTierHeight - topPad, hangingReserve = hangingLabelReserve(plotH0, [dLo, dHi], hangingEnd, hangingRoom);
2205
+ if (!stair && options.categoryLabels !== "staircase" && ["fit", "wrap", "font-down", "stride"].includes(catPlan.step) && !options.annotations?.some((annotation) => annotation.kind === "cagr" || annotation.kind === "event") && ![CAGR_PAD, VALUE_LINE_RESERVE, TICK_LABEL_RESERVE, BAND_PAD].some((marker) => marker in options)) {
2206
+ fixedPlotChrome(frame);
2207
+ let chrome = plotChromeFloor.get(frame.frame);
2208
+ if (chrome !== void 0) {
2209
+ let q = hangingEnd < 0 && hangingRoom > 0 && dHi > dLo ? (hangingEnd - dLo) / (dHi - dLo) : 0, room = hangingEnd < 0 ? hangingRoom : 0, bare = chrome + catBandH + ratioTierHeight + 8 + valueAxisTitleBand(axisTitle, theme, measure) + growthAndCagr + ruleH, unrowed = [[1, -bare], [1 / (1 - q), -(bare + room) / (1 - q)]], headers = [[0, growthAndCagr], [0, axisTitle ? measure("0", tickFont).height / 2 : 0]];
2210
+ if (domain.gtContent && domain.activeBreak) headers.push([0, growthAndCagr + gtH + 6]);
2211
+ else if (domain.gtContent) for (let top of domain.posTopP) {
2212
+ let free = (dHi - top) / (dHi - dLo);
2213
+ if (top > 0 && free >= 0 && free < 1)
2214
+ for (let [a, b] of unrowed) headers.push([-free * a / (1 - free), growthAndCagr + (gtH + 4 - free * b) / (1 - free)]);
2215
+ }
2216
+ let base = chrome + catBandH + ratioTierHeight + 8 + (axisTitle?.height ?? 0) + ruleH, plots = headers.flatMap(([a, b]) => [[1 - a, -base - b], [(1 - a) / (1 - q), (-base - b - room) / (1 - q)]]), height = maxOf(plots.flatMap(([a, b]) => [(PLOT_FLOOR_PX[options.target ?? DEFAULT_TARGET] - b) / a, -b / (a - plotFloorShare(size.width, options))])), plotAtFloor = minOf(plots.map(([a, b]) => a * height + b));
2217
+ q >= 0 && q < 1 && Number.isFinite(height) && Math.min(...unrowed.map(([a, b]) => a * height + b)) >= 0 ? fixedPlotChrome(frame, height - plotAtFloor - chrome) : plotChromeFloor.delete(frame.frame);
2218
+ }
2219
+ }
2220
+ let plot = {
2221
+ x: frame.plot.x,
2222
+ y: frame.plot.y + topPad,
2223
+ w: frame.plot.w,
2224
+ h: plotHeightAfter(frame, size.height, plotH0 - hangingReserve)
2225
+ }, minPlot = plotFloorRows(options) * measure("0", labelFont).height + 8;
2226
+ frame.frame.plotMinHeight = Math.max(frame.frame.plotMinHeight ?? 0, size.height + (frame.deficit ?? 0) + minPlot - (plotH0NoBand - hangingReserveNoBand)), va.show && (plot.x += valueAxisReserve, plot.w = Math.max(10, plot.w - valueAxisReserve));
2227
+ let y = domain.activeBreak ? brokenLinearScale([dLo, dHi], [plot.y + plot.h, plot.y], domain.activeBreak) : linearScale([dLo, dHi], [plot.y + plot.h, plot.y]);
2228
+ return {
2229
+ frame,
2230
+ axisFmt,
2231
+ axisSpec,
2232
+ tier,
2233
+ tickFont,
2234
+ labelFont,
2235
+ strongFont,
2236
+ gtH,
2237
+ ruleOn,
2238
+ ruleText,
2239
+ ruleWrap,
2240
+ ruleH,
2241
+ axisTitle,
2242
+ axisTitleBand,
2243
+ topPad,
2244
+ band,
2245
+ catPlan,
2246
+ showCatRow,
2247
+ tickReserve,
2248
+ catBandH: catBandH + hangingReserve,
2249
+ // The names may rise to the frame top, under the rule and the axis title.
2250
+ ...stair ? { stairTop: frame.plot.y + ruleH + (axisTitle ? axisTitle.height + 8 : 0) } : {},
2251
+ // A date row stays at the plot's bottom band; prose reads under the
2252
+ // lowest column and the value hanging under it.
2253
+ catRowY: catPlan.dateNumeric ? plot.y + plot.h + hangingReserve : categoryRowTop(y, lowest, hangingEnd, hangingRoom),
2254
+ plot,
2255
+ y,
2256
+ y0: y(0)
2257
+ };
2258
+ }
2259
+
2260
+ // src/core/charts/column/layout.ts
2261
+ function clearStraightLeaders(labels, theme) {
2262
+ let visible = labels.filter((label) => !label.hidden), pad = REFERENCE_LABEL_CLEARANCE + strokeToken(theme, "rule") / 2 + 0.01;
2263
+ for (let label of visible) {
2264
+ if (!label.leader || label.leader.curved) continue;
2265
+ let match = /^M(-?[\d.]+) (-?[\d.]+)L(-?[\d.]+) (-?[\d.]+)$/.exec(label.leader.d);
2266
+ if (!match) continue;
2267
+ let [x, y, x2, y2] = match.slice(1).map(Number), dx = x2 - x, dy = y2 - y, cuts = [];
2268
+ for (let other of visible) {
2269
+ let r = other.rect, from2 = 0, to = 1;
2270
+ for (let [at, step, low, high] of [[x, dx, r.x - pad, r.x + r.w + pad], [y, dy, r.y - pad, r.y + r.h + pad]])
2271
+ if (step === 0)
2272
+ (at < low || at > high) && (from2 = 1, to = 0);
2273
+ else {
2274
+ let a = (low - at) / step, b = (high - at) / step;
2275
+ from2 = Math.max(from2, Math.min(a, b)), to = Math.min(to, Math.max(a, b));
2276
+ }
2277
+ from2 < to && cuts.push([from2, to]);
2278
+ }
2279
+ if (!cuts.length) continue;
2280
+ let from = { x, y }, clear = [leaderTerminus(label.rect, { x: label.rect.x - 1, y }), leaderTerminus(label.rect, { x: label.rect.x + label.rect.w + 1, y })].flatMap((end) => [[from, { x: end.x, y }, end], [from, { x, y: end.y }, end]]).sort((a, b) => Math.abs(a[2].x - x) + Math.abs(a[2].y - y) - Math.abs(b[2].x - x) - Math.abs(b[2].y - y)).find((points) => points.slice(1).every((b, i) => visible.every((other) => !segmentHitsRect(points[i], b, other.rect, pad))));
2281
+ if (clear) {
2282
+ label.leader = { d: linePath(clear), curved: !1 };
2283
+ continue;
2284
+ }
2285
+ cuts.sort((a, b) => a[0] - b[0]);
2286
+ let runs = [], start = 0;
2287
+ for (let [from2, to] of cuts)
2288
+ from2 > start && runs.push([start, from2]), start = Math.max(start, to);
2289
+ start < 1 && runs.push([start, 1]);
2290
+ let point = (t) => ({ x: x + t * dx, y: y + t * dy }), d = runs.map(([from2, to]) => linePath([point(from2), point(to)])).join("");
2291
+ label.leader = d ? { d, curved: !1 } : void 0;
2292
+ }
2293
+ }
2294
+ function annotateColumn(domain, area, scene, occupied, solveCtx, printedLabels) {
2295
+ let { cats, dataSeries, variant, plottedOf, absOf, posTopP, negBotP, stackTotals } = domain, { plot, band, y, y0, topPad } = area, catIndex = new Map(cats.map((c, i) => [c.id, i])), resolveAnchor = (ref) => {
2296
+ let norm = typeof ref == "string" ? { categoryId: ref, edge: "total" } : ref;
2297
+ if (!("categoryId" in norm)) return null;
2298
+ let ci = catIndex.get(norm.categoryId);
2299
+ if (ci === void 0) return null;
2300
+ let c = cats[ci], edge = norm.edge ?? (norm.seriesId ? "end" : "total");
2301
+ if (norm.seriesId) {
2302
+ let reference = domain.refSeries.find((s2) => s2.id === norm.seriesId), tick = scene.marks.referenceTicks.find((m) => m.seriesId === norm.seriesId && m.categoryId === c.id);
2303
+ if (reference && tick) {
2304
+ let v = plottedOf(reference, ci);
2305
+ return v === null ? null : {
2306
+ x: tick.anchor?.x ?? band.center(ci),
2307
+ y: tick.anchor?.y ?? y(v),
2308
+ value: v,
2309
+ format: reference.format,
2310
+ pointValueText: domain.valueSpec.forSeries(reference, reference.vals[ci]?.format)(v),
2311
+ date: c.date,
2312
+ label: c.label,
2313
+ owner: { categoryId: c.id, seriesId: reference.id }
2314
+ };
2315
+ }
2316
+ let s = dataSeries.find((x) => x.id === norm.seriesId);
2317
+ if (!s) return null;
2318
+ let owner = { categoryId: c.id, seriesId: s.id }, series = { format: s.format, ...dataSeries.length > 1 ? { series: { id: s.id, label: s.label } } : {} };
2319
+ if (variant === "grouped") {
2320
+ let v = plottedOf(s, ci);
2321
+ return v === null ? null : {
2322
+ x: scene.subCenters.get(sk(s.id, c.id)) ?? band.center(ci),
2323
+ y: edge === "start" ? y0 : y(v),
2324
+ value: v,
2325
+ pointValueText: domain.valueSpec.forSeries(s, s.vals[ci]?.format)(v),
2326
+ date: c.date,
2327
+ label: c.label ?? c.id,
2328
+ owner,
2329
+ ...series
2330
+ };
2331
+ }
2332
+ let e = scene.segEdges.get(sk(s.id, c.id));
2333
+ if (!e) return null;
2334
+ let yy = y(edge === "start" ? e.v0 : edge === "end" ? e.v1 : Math.max(e.v0, e.v1)), value = absOf(s, ci) ?? e.v;
2335
+ return {
2336
+ x: band.center(ci),
2337
+ y: yy,
2338
+ value,
2339
+ pointValueText: domain.valueSpec.forSeries(s, s.vals[ci]?.format)(value),
2340
+ date: c.date,
2341
+ label: c.label ?? c.id,
2342
+ owner,
2343
+ ...series
2344
+ };
2345
+ }
2346
+ if (variant === "grouped" && dataSeries.length > 1) {
2347
+ let anchorSeries = dataSeries.find((x) => domain.highlights.has(x.id)) ?? dataSeries[0];
2348
+ return resolveAnchor({ categoryId: c.id, seriesId: anchorSeries.id, ...edge === "start" ? { edge } : {} });
2349
+ }
2350
+ let topPlotted = posTopP[ci] > 0 ? posTopP[ci] : negBotP[ci];
2351
+ return {
2352
+ x: band.center(ci),
2353
+ y: edge === "start" ? y0 : y(topPlotted),
2354
+ value: stackTotals[c.id],
2355
+ pointValueText: domain.totalFmt(stackTotals[c.id]),
2356
+ format: dataSeries.length === 1 ? dataSeries[0].format : void 0,
2357
+ ...totalsAdd(domain) ? {} : { noValue: NO_STACK_TOTAL },
2358
+ date: c.date,
2359
+ label: c.label ?? c.id,
2360
+ owner: { categoryId: c.id }
2361
+ };
2362
+ }, annPlot = {
2363
+ x: plot.x,
2364
+ y: plot.y - (topPad - 8 - area.axisTitleBand),
2365
+ w: plot.w,
2366
+ h: plot.h + (topPad - 8 - area.axisTitleBand)
2367
+ }, ceilingRects = [];
2368
+ return area.ruleH > 0 && ceilingRects.push({ x: area.frame.plot.x, y: area.frame.plot.y + 2, w: area.frame.plot.w, h: area.ruleH }), area.axisTitle && domain.va.show && ceilingRects.push({ x: area.frame.plot.x, y: area.frame.plot.y + area.ruleH + 4, w: area.axisTitle.width, h: area.axisTitle.height }), runAnnotatePass({
2369
+ target: domain.options.target,
2370
+ // The growth bracket seats its label on its run.
2371
+ cagrLabelOnArm: !0,
2372
+ // Events belong to the event lane.
2373
+ annotations: domain.annList.filter((annotation) => annotation.kind !== "event"),
2374
+ resolve: resolveAnchor,
2375
+ printedLabels,
2376
+ defaultSpan: cats.length >= 2 ? { from: cats[0].id, to: cats[cats.length - 1].id } : void 0,
2377
+ occupied,
2378
+ plot: annPlot,
2379
+ bandCeiling: area.frame.plot.y,
2380
+ ceilingRects,
2381
+ theme: domain.theme,
2382
+ measure: domain.measure,
2383
+ format: domain.options.format,
2384
+ locale: domain.options.locale?.language,
2385
+ strings: domain.options.strings,
2386
+ percentLevels: percentLevels(dataSeries),
2387
+ valueLinePercentLevels: domain.variant === "stacked100" || domain.options.unit === "%" || domain.pctLevels,
2388
+ solveCtx,
2389
+ yScale: y,
2390
+ meanValue: domain.meanValue,
2391
+ ...domain.meanMissing ? { meanMissing: domain.meanMissing } : {},
2392
+ meanSpan: domain.meanSpan,
2393
+ ...categoryTargetFields(cats.map((c) => c.id), plot, (i) => band.center(i), "x"),
2394
+ partialCategories: partialIds(cats)
2395
+ });
2396
+ }
2397
+ function totalsAdd(domain) {
2398
+ return domain.dataSeries.length === 1 || domain.variant !== "grouped" && domain.partsAdd;
2399
+ }
2400
+ function columnA11yDesc(domain, area, rangeMarks, points) {
2401
+ let { cats, dataSeries, refSeries, variant, fmt, totalFmt, stackTotals, anomaly } = domain, labelOf = (id) => cats.find((category) => category.id === id)?.label ?? id, oneValueText = (ci) => dataSeries.length === 1 && variant !== "stacked100" ? cellValueText(domain, dataSeries[0], ci) : null, variantName = variant === "grouped" ? chartString2(domain.options, "clustered") : variant === "stacked100" ? chartString2(domain.options, "stacked100") : chartString2(domain.options, "stackedLower");
2402
+ return chartString2(domain.options, "columnDescStart", { v1: variantName, v2: cats.length, v3: dataSeries.length }) + (refSeries.length ? chartString2(domain.options, "referenceSeriesClause", { v1: refSeries.length }) : "") + (totalsAdd(domain) ? chartString2(domain.options, "totalsSentence", { v1: cats.map((c, ci) => `${c.label ?? c.id} ${domain.stacks[ci].hasValue ? oneValueText(ci) ?? totalFmt(stackTotals[c.id]) : NOT_AVAILABLE}`).join(", ") }) : ".") + (points.length ? chartString2(domain.options, "growthVersus", { v1: domain.pyRef.label, v2: points.map((point) => `${labelOf(point.categoryId)} ${point.text}`).join(", ") }) : "") + (rangeMarks.length ? chartString2(domain.options, "rangesClause", { v1: rangeMarks.map((range) => chartString2(domain.options, "namedRange", { v1: range.categoryId, v2: fmt(range.low), v3: fmt(range.high) })).join(", ") }) : "") + (anomaly ? chartString2(domain.options, "anomalyDesc", { v1: anomaly.rule, v2: domain.corridorNote }) + (anomaly.flags.length === 0 ? chartString2(domain.options, "noFlaggedPeriod") : chartString2(domain.options, "flaggedSentence", { v1: anomaly.flags.map((flag) => `${labelOf(flag.categoryId)} ${fmt(flag.value)}`).join(", ") })) : "") + ratioTierA11y(area.tier);
2403
+ }
2404
+ function seatDigits(digits, solved, occupied, ctx, warnings, rules, noted, lines) {
2405
+ let seated = /* @__PURE__ */ new Set(), clear = digits.requests.filter((request) => {
2406
+ let { rect } = request.candidates[0], font = request.fontStep ?? request.font, top = rect.y + rect.h - font.size * TEXT_ASCENT;
2407
+ return !textBreaksLine(lines, rect.x, rect.x + rect.w, top, font.size);
2408
+ });
2409
+ if (clear.length > 0) {
2410
+ let late = solveLabels(clear, occupied, ctx);
2411
+ for (let label of late.placed) {
2412
+ let at = label.hidden === void 0 ? solved.placed.findIndex((other) => other.id === label.id) : -1;
2413
+ if (at < 0) continue;
2414
+ let seat = { [DIGIT_SEAT]: { noted: noted(label.id), lineH: solved.placed[at].rect.h } };
2415
+ solved.placed[at] = { ...label, ...seat };
2416
+ let decision = late.decisions.find((entry) => entry.labelId === label.id), old = solved.decisions.findIndex((entry) => entry.labelId === label.id);
2417
+ decision && old >= 0 && (solved.decisions[old] = decision), seated.add(label.id);
2418
+ }
2419
+ }
2420
+ let names = [];
2421
+ for (let [id, name] of digits.slivers) seated.has(id) || names.push(name);
2422
+ let warning = [];
2423
+ warnSliverLabels(warning, names), warnings.splice(digits.warningAt, 0, ...warning);
2424
+ for (let rule of rules) rule.before += warning.length;
2425
+ }
2426
+ function assembleColumnGeometry(domain, area, scene, solved, annotated, tierState, pointFont, points, ratioTierResult, occupied, warnings, paintWarningRules, lane) {
2427
+ let { cats, dataSeries, anomaly, stackTotals, percents } = domain, { tickFont, strongFont, labelFont, band, catPlan, showCatRow } = area, { nodes, axes } = scene, allLabels = [...solved.placed, ...annotated.labels], printedTotals = totalsAdd(domain) ? Object.fromEntries(cats.flatMap((c, ci) => domain.stacks[ci].hasValue ? [[c.id, stackTotals[c.id]]] : [])) : {}, integratedAnnotations = points.map((point) => ({
2428
+ id: `integratedVariance:${point.referenceSeriesId}:${point.categoryId}`,
2429
+ kind: "diff",
2430
+ computedText: point.text,
2431
+ tone: point.tone,
2432
+ nodeIds: [],
2433
+ labelId: point.growthLabelId,
2434
+ // The integrated growth figure is percentDelta over the two totals the
2435
+ // panel already plots. Both are on the point; only the string was
2436
+ // reaching the manifest.
2437
+ derivation: {
2438
+ basis: "derived",
2439
+ op: "annotation-diff-relative@1",
2440
+ inputs: [
2441
+ { ref: `${point.referenceSeriesId}:${point.categoryId}`, value: point.reference },
2442
+ { ref: `current:${point.categoryId}`, value: point.current }
2443
+ ],
2444
+ raw: point.growthPct
2445
+ }
2446
+ }));
2447
+ spliceAnnotationNodes(nodes, annotated.nodes);
2448
+ let totalIds = new Set(domain.cats.filter((c) => c.role === "total").map((c) => c.id)), bandLabelIds = new Set(
2449
+ annotated.placed.filter((ann) => ann.kind === "band").map((ann) => ann.labelId)
2450
+ );
2451
+ if (allLabels.some((label) => !label.hidden && label.leader))
2452
+ for (let label of allLabels) (label.kind === "grandTotal" || label.kind === "total") && (label.halo = !0);
2453
+ clearStraightLeaders(allLabels, domain.theme);
2454
+ for (let label of allLabels)
2455
+ (label.kind === "point" || label.kind === "category") && label.owner.annotationId === void 0 && (domain.highlights.has(label.owner.categoryId ?? "") || domain.highlights.has(label.owner.seriesId ?? "")) && (label.emphasis = !0);
2456
+ let labelNodes = labelsToNodes(
2457
+ domain.theme,
2458
+ allLabels,
2459
+ (l) => tierState?.fontByLabelId.get(l.id) ?? // A total column (categories[].role 'total') prints its head and values bold.
2460
+ (totalIds.has(l.owner.categoryId ?? "") && (l.kind === "segment" || l.kind === "category") ? { ...l.kind === "category" ? catPlan.font : strongFont, weight: emphasisWeight(domain.theme) } : void 0) ?? (bandLabelIds.has(l.id) ? tickFont : l.kind === "grandTotal" || l.kind === "total" ? strongFont : l.kind === "category" ? area.stairTop !== void 0 ? tickFont : catPlan.font : l.kind === "tick" ? tickFont : l.kind === "annotation" || l.kind === "valueLine" ? { ...labelFont, weight: emphasisWeight(domain.theme) } : l.kind === "point" ? pointFont : labelFont),
2461
+ nodes
2462
+ );
2463
+ return pushAll(nodes, labelNodes.filter((node) => node.part === "leader")), pushAll(nodes, labelNodes.filter((node) => node.part !== "leader")), lane && pushAll(nodes, lane.nodes), axes.unshift({
2464
+ axis: "x",
2465
+ baselineNodeId: "axis:baseline",
2466
+ ticks: cats.map((c, i) => ({
2467
+ at: c.id,
2468
+ pos: band.center(i),
2469
+ labelId: showCatRow || area.stairTop !== void 0 ? `category:${c.id}` : void 0
2470
+ }))
2471
+ }), {
2472
+ type: "column",
2473
+ size: domain.size,
2474
+ plot: area.plot,
2475
+ scene: withSegmentSeams(joinHatchPeers(nodes), domain.theme),
2476
+ labels: lane ? [...allLabels, ...lane.labels] : allLabels,
2477
+ axes,
2478
+ annotations: [
2479
+ ...integratedAnnotations,
2480
+ ...annotated.placed,
2481
+ ...lane?.placed ?? [],
2482
+ // Series CAGR records, for the names that were laid out.
2483
+ ...[...domain.seriesCagr.values()].map((entry) => entry.placed).filter((placed) => allLabels.some((label) => label.id === placed.labelId))
2484
+ ],
2485
+ legend: area.frame.legend,
2486
+ frame: area.frame.frame,
2487
+ marks: scene.marks,
2488
+ derived: {
2489
+ stackTotals: printedTotals,
2490
+ stackParts: stackParts(printedTotals, cats, dataSeries, (si, ci) => domain.absOf(dataSeries[si], ci)),
2491
+ ...percents ? { percents } : {},
2492
+ ...domain.roundingAdjustments.length > 0 ? { roundingAdjustments: domain.roundingAdjustments } : {},
2493
+ ...domain.computedTotal ? { computedTotal: domain.computedTotal } : {},
2494
+ ...ratioTierResult ? { ratioTier: ratioTierResult.geometry } : {},
2495
+ ...showCatRow ? {
2496
+ tickBand: {
2497
+ reserved: area.tickReserve,
2498
+ measuredLines: catPlan.maxLines,
2499
+ lineHeight: catPlan.font.size * 1.2,
2500
+ // Rotated rows reserve more than lines × line height; the receipt names it.
2501
+ extra: catPlan.rowHeight - catPlan.maxLines * catPlan.font.size * 1.2,
2502
+ dateNumeric: catPlan.dateNumeric,
2503
+ position: "below"
2504
+ }
2505
+ } : {},
2506
+ ...points.length ? { integratedVariance: points } : {},
2507
+ ...anomaly ? { anomaly: anomalyReceipt(anomaly) } : {}
2508
+ },
2509
+ a11y: {
2510
+ title: accessibleTitle(domain.options.title, chartString2(domain.options, "columnTitle", { v1: dataSeries.map((s) => s.label).join(", "), v2: cats.length })),
2511
+ counts: [...domain.anomaly?.counts ?? [], structureCount("categories", domain.cats.length, void 0, domain.options), structureCount("series", domain.dataSeries.length, void 0, domain.options), ...domain.refSeries.length ? [structureCount("reference-series", domain.refSeries.length, chartString2(domain.options, "referenceSeriesCount", { v1: domain.refSeries.length }))] : []],
2512
+ desc: columnA11yDesc(domain, area, scene.rangeMarks, points)
2513
+ },
2514
+ warnings,
2515
+ paintWarningRules,
2516
+ debug: {
2517
+ occupied: occupied.snapshot(),
2518
+ decisions: [...solved.decisions, ...annotated.decisions]
2519
+ }
2520
+ };
2521
+ }
2522
+ function layoutColumn(data, options = {}, keepEachValue = !1) {
2523
+ let resolved = withValueLabelDefaults(ribbonDefaults(withLocaleStrings(options)), "column", options.valueAxis?.percent ? "stacked100" : options.variant), geometry = withBandValueNotes(data, resolved, (next) => layoutColumnWithNotes(data, next, keepEachValue)), keyed = new Set(geometry.legend?.items.map((item) => item.id)), lost = geometry.labels.some((label) => label.hidden && label.id.startsWith("seriesEdge:") && !keyed.has(label.owner.seriesId)), keyAsked = resolved.legend !== void 0 && resolved.legend !== "none";
2524
+ if (!lost || !keyAsked || resolved[KEY_EDGE_SERIES]) return geometry;
2525
+ let again = { ...resolved, [KEY_EDGE_SERIES]: !0 };
2526
+ return withBandValueNotes(data, again, (next) => layoutColumnWithNotes(data, next, keepEachValue));
2527
+ }
2528
+ function ribbonDefaults(options) {
2529
+ return !(options.variant === "stacked" || options.variant === "stacked100" || !!options.valueAxis?.percent) || !options.ribbons || options.seriesLabels !== void 0 ? options : { ...options, seriesLabels: { at: "right-edge" } };
2530
+ }
2531
+ function layoutColumnWithNotes(data, options, keepEachValue) {
2532
+ let named = /* @__PURE__ */ new Map(), pass, minimumChrome = 1 / 0, run = (next) => {
2533
+ pass = layoutColumnPass(data, next, keepEachValue);
2534
+ let settled = settleStaircase(next, (o) => (pass = layoutColumnPass(data, o, keepEachValue)).staircase, pass.staircase);
2535
+ return minimumChrome = Math.min(minimumChrome, plotChromeFloor.get(pass.geometry.frame) ?? NaN), settled;
2536
+ }, settleBandHeadroom = (next) => {
2537
+ let bandPad = next[BAND_PAD] ?? 0;
2538
+ for (let round = 0; round < 2 && pass.bandNeed > 0; round++)
2539
+ bandPad += Math.ceil(pass.bandNeed), next = run({ ...next, [BAND_PAD]: bandPad });
2540
+ return next;
2541
+ };
2542
+ options = run(options);
2543
+ for (let round = 0, pad = 0; round < 3 && pass.legDeficit > 0.5; round++)
2544
+ pad += Math.ceil(pass.legDeficit) + 2, options = run({ ...options, [CAGR_PAD]: pad });
2545
+ if (pass.valueLineReserve > 0 && (options = run({ ...options, [VALUE_LINE_RESERVE]: pass.valueLineReserve })), pass.tickReserve > 0 && !(TICK_LABEL_RESERVE in options)) {
2546
+ let before = pass, hiddenTicks = (p) => p.geometry.labels.filter((label) => label.kind === "tick" && label.hidden !== void 0).length, reserved = run({ ...options, [TICK_LABEL_RESERVE]: pass.tickReserve });
2547
+ hiddenTicks(pass) < hiddenTicks(before) ? options = reserved : pass = before;
2548
+ }
2549
+ if (panelTypeClass(options) !== void 0)
2550
+ return settleBandHeadroom(options), pass.geometry;
2551
+ let current = options;
2552
+ pass.categoryNotes.length > 0 && (current = run({ ...options, [CATEGORY_NOTES]: pass.categoryNotes, [POINTED_NOTES]: pass.categoryNotes }));
2553
+ let owed = data.series.reduce((count, series) => count + series.values.length, 0), unnamed = () => [...pass.unprinted.keys()].some((id) => !named.has(id)), nameUnprinted = (next) => {
2554
+ for (let round = 0; round <= owed && unnamed(); round++) {
2555
+ let byData = dataOrder(data, pass.geometry.labels);
2556
+ named = new Map([...named, ...pass.unprinted].sort(([a], [b]) => byData(a, b))), next = run({ ...next, [SEGMENT_NOTE]: [...named.values()] });
2557
+ }
2558
+ return next;
2559
+ }, last = nameUnprinted(current);
2560
+ pass.categoryNotes.length > 0 && (last = run({ ...last, [CATEGORY_NOTES]: pass.categoryNotes, [POINTED_NOTES]: pass.categoryNotes }));
2561
+ let printed = last[CATEGORY_NOTES];
2562
+ if (printed && categoryNotesDiffer(pass.planNotes, printed)) {
2563
+ let keyed = pass.rankKey();
2564
+ last = run({ ...last, [CATEGORY_NOTES]: keyed, [POINTED_NOTES]: keyed, [FORCE_CATEGORY_RANKS]: !0 });
2565
+ }
2566
+ last = settleBandHeadroom(last), unnamed() && settleBandHeadroom(nameUnprinted(last));
2567
+ for (let label of pass.geometry.labels) named.has(label.id) && label.hidden && (label.noted = !0);
2568
+ let items = new Map(pass.geometry.labels.filter((label) => named.has(label.id) && label.hidden && label.printsFor?.length !== 0).map((label) => [`${label.owner.seriesId}|${label.owner.categoryId}`, named.get(label.id)]));
2569
+ return pass.geometry.scene = pass.geometry.scene.map((node) => {
2570
+ let item = (node.t === "rect" || node.t === "path") && node.separation ? items.get(`${node.owner.seriesId}|${node.owner.categoryId}`) : void 0;
2571
+ return item !== void 0 && (node.t === "rect" || node.t === "path") && node.separation ? { ...node, separation: { ...node.separation, notedAs: item } } : node;
2572
+ }), Number.isFinite(minimumChrome) ? plotChromeFloor.set(pass.geometry.frame, minimumChrome) : plotChromeFloor.delete(pass.geometry.frame), pass.geometry;
2573
+ }
2574
+ function layoutColumnPass(data, options, keepEachValue) {
2575
+ let warnings = [], domain = resolveColumnDomain(data, options, warnings), paints = columnPaints(domain, warnings), { size, theme } = domain, areaWarningsAt = 0, settled = settleEventLane({
2576
+ annotations: domain.annList,
2577
+ categories: domain.cats,
2578
+ events: options.events,
2579
+ language: options.locale?.language,
2580
+ colorblindSafe: options.colorblindSafe,
2581
+ inline: !1,
2582
+ footnotesOff: options.footnotesOff,
2583
+ theme,
2584
+ measure: domain.measure,
2585
+ size,
2586
+ compact: options.mode === "compact",
2587
+ solve: (key, w) => solveColumnFrame(domain, paints, w, key),
2588
+ area: (framed2, w) => (areaWarningsAt = w.length, columnPlotArea(domain, framed2.frame, w)),
2589
+ axis: (area2) => ({ x: (ci) => area2.band.center(ci), step: area2.band.step, plot: area2.plot }),
2590
+ warnings
2591
+ }), framed = settled.framed, occupied = framed.claims, area = settled.area;
2592
+ domain.activeBreak && domain.variant !== "grouped" && stackBreakReversesOrder(area.y, domain.stacks) && (domain.activeBreak = void 0, delete framed.frame.frame.plotMinHeight, plotChromeFloor.delete(framed.frame.frame), warnings.length = areaWarningsAt, area = columnPlotArea(domain, framed.frame, warnings), warnings.push(axisBreakHeightOrderWarning()));
2593
+ let scene = layoutColumnMarks(domain, paints, area);
2594
+ for (let c of scene.claims.snapshot()) occupied.claim(c.rect, c.kind, c.owner, c.part);
2595
+ scene.claims.tickColumns && (occupied.tickColumns = scene.claims.tickColumns);
2596
+ let requests = area.axisTitle && domain.va.show ? [valueAxisTitleRequest(area.axisTitle, { x: area.frame.plot.x, y: area.frame.plot.y + area.ruleH + 4 }, "start", "axis:y:title")] : [], tierState = area.tier ? addRatioTierRequests(area.tier, requests, {
2597
+ plot: area.plot,
2598
+ categoryBandHeight: area.catBandH,
2599
+ categoryCenter: (categoryId) => area.band.center(domain.cats.findIndex((cat) => cat.id === categoryId)),
2600
+ theme,
2601
+ measure: domain.measure
2602
+ }) : void 0, stair = area.stairTop === void 0 ? void 0 : seatStaircase({
2603
+ categories: domain.cats,
2604
+ band: area.band,
2605
+ top: area.stairTop,
2606
+ left: area.plot.x,
2607
+ right: area.plot.x + area.plot.w,
2608
+ floor: area.y0,
2609
+ above: options.labels !== !1 ? area.gtH + 4 : 0,
2610
+ font: area.tickFont,
2611
+ measure: domain.measure,
2612
+ tops: domain.posTopP,
2613
+ options,
2614
+ cap: STAIRCASE_MAX_PAD * area.frame.plot.h,
2615
+ occupied,
2616
+ requests
2617
+ }), noted = { items: /* @__PURE__ */ new Map(), slivers: /* @__PURE__ */ new Set() }, digits = { requests: [], slivers: [], warningAt: 0 }, pointFont = planColumnValueLabels(domain, paints, area, scene, requests, warnings, noted, digits), paintWarningRules = [];
2618
+ pushAll(warnings, rectSeriesAdjacentWarnings(scene.nodes, paints.css, "vertical", domain.highlights, theme, { rules: paintWarningRules, before: warnings.filter((warning) => !["pie-ramp-crowded", "likert-ramp-invisible", "band-lightness-insufficient", "series-adjacent-similar", "highlight-reads-as-loss"].includes(warning.code)).length }));
2619
+ let growthPoints = planColumnLabels(domain, area, scene, requests, warnings), solveCtx = labelCtx(theme, size, options, {
2620
+ density: domain.density,
2621
+ measure: domain.measure,
2622
+ plot: area.plot,
2623
+ labelPad: 2,
2624
+ // A histogram keeps each fitting count, even when other bins need a note.
2625
+ // values valueLabels picks are no scatter; each one that cannot sit goes to the note alone.
2626
+ seriesUniform: keepEachValue || pickedValues(domain.options) ? void 0 : bandValueLabelUniformity()
2627
+ }), solved = solveLabels(keepValuesWithoutAxis(requests, domain.density, domain.va.show === !0), occupied, solveCtx), toDate = toDateOnValues(domain);
2628
+ if (toDate.size > 0 && (!toDateFits(domain.options.strings?.toDate ?? chartString2(domain.options, "toDate"), theme, domain.measure, toDateRoom(area.band.bandwidth)) || solved.placed.some((l) => (l.kind === "grandTotal" || l.kind === "point") && l.hidden !== void 0 && toDate.has(l.owner.categoryId ?? ""))))
2629
+ return layoutColumnPass(data, { ...options, [PARTIAL_KEY]: !0 }, keepEachValue);
2630
+ let staircase = runStaircase(theme, options.categoryLabels, options, stair, solved.placed, occupied, scene.nodes, warnings);
2631
+ applyValueAxisTitleInk(solved.placed);
2632
+ let crossed = haloOverRules(solved.placed, occupied, /* @__PURE__ */ new Set(["referenceLine", "valueLine"]));
2633
+ pushAll(warnings, solved.warnings);
2634
+ for (let point of growthPoints) {
2635
+ let growthLabel = solved.placed.find((label) => label.id === point.growthLabelId);
2636
+ growthLabel && !growthLabel.hidden && (growthLabel.ink = point.tone === "neutral" ? { token: "inkMuted" } : options.colorblindSafe ? colorblindPaint(point.tone) : { token: point.tone });
2637
+ }
2638
+ for (let label of solved.placed) label.id.startsWith("tick:") && !label.hidden && (label.ink = { token: "inkMuted" });
2639
+ for (let label of solved.placed) label.id.startsWith("seriesEdge:") && (label.font = edgeNameFont(label.font ?? area.labelFont, domain));
2640
+ let ratioTierResult = tierState ? finalizeRatioTier(tierState, solved.placed, occupied, theme, domain.measure) : void 0;
2641
+ ratioTierResult && pushAll(scene.nodes, ratioTierResult.nodes), pushAll(warnings, ratioTierSpacingWarnings(area.tier, solved.placed));
2642
+ let annotated = annotateColumn(domain, area, scene, occupied, solveCtx, solved.placed);
2643
+ pushAll(warnings, annotated.warnings);
2644
+ let lane = settled.lane ? emitEventLane(theme, {
2645
+ ...settled.lane,
2646
+ axis: { x: (ci) => area.band.center(ci), step: area.band.step, plot: area.plot },
2647
+ mode: "stop",
2648
+ baseline: area.plot.y + area.plot.h,
2649
+ occupied,
2650
+ solveCtx
2651
+ }) : void 0;
2652
+ lane && pushAll(warnings, lane.warnings);
2653
+ let pointedAt = new Set((options.annotations ?? []).flatMap((a) => (a.kind === "callout" || a.kind === "note") && typeof a.at == "object" && "categoryId" in a.at && a.at.seriesId ? [`segment:${a.at.seriesId}:${a.at.categoryId}`] : [])), inPanel = panelTypeClass(options) !== void 0;
2654
+ seatDigits(
2655
+ digits,
2656
+ solved,
2657
+ occupied,
2658
+ solveCtx,
2659
+ warnings,
2660
+ paintWarningRules,
2661
+ (id) => !inPanel && !pointedAt.has(id),
2662
+ [...scene.nodes, ...annotated.nodes, ...lane?.nodes ?? []]
2663
+ );
2664
+ let unprinted = new Map([...noted.items].filter(([id]) => !pointedAt.has(id) && // The note names what is not drawn: a sliver a pin placed is drawn, and so is one whose total prints its value.
2665
+ solved.placed.some((label) => label.id === id && (label.hidden === "collision" || label.hidden !== void 0 && label.printedIn === void 0 && noted.slivers.has(id))))), geometry = assembleColumnGeometry(domain, area, scene, solved, annotated, tierState, pointFont, growthPoints, ratioTierResult, occupied, warnings, paintWarningRules, lane);
2666
+ geometry.scene = raiseOverRules(geometry.scene, crossed);
2667
+ let planNotes = area.showCatRow ? area.catPlan.step === "ranks" ? rankNotes(domain.cats.map((c) => c.label ?? c.id), domain.options) : area.catPlan.cutNotes : [], categoryNotes = options[CATEGORY_NOTES] ? [] : planNotes, valueLineReserve = hiddenValueLineReserve(geometry.labels, (text) => domain.measure(text, { ...area.labelFont, weight: emphasisWeight(domain.theme) }).width, size.width), lastCategory = domain.cats.at(-1), lastTick = domain.pyRef && lastCategory ? geometry.labels.find((label) => label.id === `tick:${domain.pyRef.id}:${lastCategory.id}` && (label.hidden === "collision" || label.hidden === "note")) : void 0, lastBar = lastTick && lastCategory ? area.band.position(domain.cats.length - 1) + area.band.bandwidth : 0, tickReserve = lastTick ? Math.max(0, Math.ceil(lastBar + PY_TICK_LEAD + domain.measure(lastTick.text, area.tickFont).width + 2 - size.width)) : 0;
2668
+ return { geometry, unprinted, categoryNotes, planNotes, rankKey: () => rankNotes(domain.cats.map((c) => c.label ?? c.id), domain.options), legDeficit: annotated.legDeficit, bandNeed: annotated.bandNeed, valueLineReserve, tickReserve: tickReserve <= size.width / 3 ? tickReserve : 0, ...staircase ? { staircase } : {} };
2669
+ }
2670
+
2671
+ export {
2672
+ TILED_BANDS,
2673
+ layoutColumn
2674
+ };