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,2511 @@
1
+ import {
2
+ MARKER_MAX_CATS,
3
+ bandHatch,
4
+ emitForecastDividers,
5
+ fillShadingKinds,
6
+ fillShadings,
7
+ markerPath,
8
+ pathFor,
9
+ placeForecastHeaders,
10
+ planLineStyle,
11
+ regroundOnShadings,
12
+ screenEdges,
13
+ seatValuesOnGround,
14
+ shadesFills,
15
+ withoutEvents
16
+ } from "./chunk-2ND7ZITT.js";
17
+ import {
18
+ unitConflict,
19
+ unitConflictRefusal
20
+ } from "./chunk-WZGJSQKN.js";
21
+ import {
22
+ preparePolyline
23
+ } from "./chunk-ADKCLH3Z.js";
24
+ import {
25
+ FORCE_CATEGORY_RANKS,
26
+ STAIRCASE,
27
+ STAIRCASE_MAX_PAD,
28
+ categoryNotesDiffer,
29
+ categoryRanksLint,
30
+ chartString as chartString2,
31
+ nextStaircase,
32
+ rankNotes,
33
+ runStaircase,
34
+ seatStaircase,
35
+ staircaseDirection,
36
+ staircaseOn,
37
+ staircaseRoom,
38
+ staircaseState,
39
+ withCategoryRanks
40
+ } from "./chunk-QO6HEXIZ.js";
41
+ import {
42
+ ANOMALY_FLAG_GAP,
43
+ ANOMALY_FLAG_H,
44
+ anomalyA11y,
45
+ anomalyCorridor,
46
+ anomalyLegendItems,
47
+ anomalyModel,
48
+ anomalyReceipt,
49
+ anomalyRuleLines,
50
+ anomalyRuleReserve,
51
+ columnCorridorPaint,
52
+ lineAnomalyFurniture,
53
+ refuseAnomalySpec,
54
+ seatFlaggedValues
55
+ } from "./chunk-NQDVMUHX.js";
56
+ import {
57
+ applyCategoryViewport,
58
+ liveWindowOptions,
59
+ viewportMeanSpan
60
+ } from "./chunk-BWTX7LUG.js";
61
+ import {
62
+ stackSegmentCandidates
63
+ } from "./chunk-XJP5DKIL.js";
64
+ import {
65
+ REFERENCE_MARKER_R,
66
+ rankValueLabels,
67
+ referenceCasing,
68
+ referenceMarkerKey,
69
+ referenceMarkerPaint,
70
+ referenceTickGeometry,
71
+ withBandValueNotes
72
+ } from "./chunk-KSJVENRU.js";
73
+ import {
74
+ cellFields,
75
+ normalizeCategorySeries
76
+ } from "./chunk-S4QSJAGY.js";
77
+ import {
78
+ haloOverRules,
79
+ linesSize,
80
+ raiseOverRules,
81
+ valueRowCrowded,
82
+ valueShareLines,
83
+ warnShareParts
84
+ } from "./chunk-27QADBDV.js";
85
+ import {
86
+ roundingUnavailable,
87
+ sumConsistentShares
88
+ } from "./chunk-24BHMKDD.js";
89
+ import {
90
+ averageMarkerLine,
91
+ averageMarkerScope,
92
+ averageOfUnaddedSums,
93
+ onePartDrawn,
94
+ sk,
95
+ stackParts,
96
+ warnIncompleteStacks
97
+ } from "./chunk-M4EUXOLU.js";
98
+ import {
99
+ valueLineExtent
100
+ } from "./chunk-QPWRHDLZ.js";
101
+ import {
102
+ isIncomplete
103
+ } from "./chunk-5LGSRWFC.js";
104
+ import {
105
+ emitEventLane,
106
+ percentLevels,
107
+ runAnnotatePass,
108
+ settleEventLane
109
+ } from "./chunk-KZS46KDY.js";
110
+ import {
111
+ stepDownFont
112
+ } from "./chunk-ZQF34VPS.js";
113
+ import {
114
+ breakUnsupported,
115
+ chartPalette,
116
+ chartTheme
117
+ } from "./chunk-3QWZAEW5.js";
118
+ import {
119
+ NO_STACK_MEAN,
120
+ NO_STACK_TOTAL,
121
+ stackAdds
122
+ } from "./chunk-6KWIQ5KF.js";
123
+ import {
124
+ categoryTargetFields,
125
+ spliceAnnotationNodes
126
+ } from "./chunk-CDZHNLO6.js";
127
+ import {
128
+ BAND_PAD,
129
+ VALUE_LINE_RESERVE,
130
+ hiddenValueLineReserve,
131
+ namedLineText
132
+ } from "./chunk-HZI56ASJ.js";
133
+ import {
134
+ structureCount
135
+ } from "./chunk-LFX7W4B7.js";
136
+ import {
137
+ emptyIdRecord
138
+ } from "./chunk-LINZPU5D.js";
139
+ import {
140
+ CATEGORY_ROW_FROM_END,
141
+ CATEGORY_ROW_VERTICAL,
142
+ MONTH_START,
143
+ ROTATED_NAME_AIR,
144
+ applyAxisBounds,
145
+ bandScale,
146
+ bandSizing,
147
+ calendarLike,
148
+ categoryLineAlign,
149
+ categoryRowTop,
150
+ hangingLabelReserve,
151
+ isDateNumericTickSequence,
152
+ layoutValueAxis,
153
+ linearScale,
154
+ longDayMonths,
155
+ measureValueAxisWidth,
156
+ niceDomain,
157
+ noteName,
158
+ planCategoryRow,
159
+ plotFloorRows,
160
+ rotatedClaimRect,
161
+ rotatedLeftOverhang,
162
+ sweepHide,
163
+ tickFormatter,
164
+ verticalNameRect,
165
+ yearRowRequests
166
+ } from "./chunk-RL3NUWMY.js";
167
+ import {
168
+ AREA_FILL_PART,
169
+ DEFER_DENSITY_NOTES,
170
+ DENSITY_LAYOUT_OPTIONS,
171
+ DENSITY_VALUES,
172
+ LAST_RESORT_PENALTY,
173
+ PARTIAL_KEY,
174
+ POINTED_NOTES,
175
+ PRIORITY,
176
+ authoredFootnoteCount,
177
+ authoredNotes,
178
+ categoryLabelsAndMarks,
179
+ composedTextRole,
180
+ createOccupiedIndex,
181
+ defaultAnnotationId,
182
+ frameTextOptions,
183
+ labelsToNodes,
184
+ normalizeLegendOption,
185
+ noteCap,
186
+ noteLine,
187
+ partialAxisWords,
188
+ partialFootnotes,
189
+ partialIds,
190
+ partialKeyForced,
191
+ partialLegendKeys,
192
+ partialPattern,
193
+ plotHeightAfter,
194
+ rectContains,
195
+ rectSeriesAdjacentWarnings,
196
+ rectsOverlap,
197
+ round2,
198
+ saysToDate,
199
+ scenarioLegendKeys,
200
+ sideAwayFrom,
201
+ solveFrame,
202
+ solveLabels,
203
+ textCarriesUnit,
204
+ toDateFits,
205
+ toDateLabel,
206
+ toDateRoom,
207
+ withAuthoredFootnotes,
208
+ withCategoryNoteNames
209
+ } from "./chunk-SS42FJVN.js";
210
+ import {
211
+ copyFrame,
212
+ disclosureNote,
213
+ disclosuresShown,
214
+ knownPartsLead,
215
+ rankKeyShown,
216
+ recordFreedChrome,
217
+ wrapFootnote
218
+ } from "./chunk-BPKXEMRE.js";
219
+ import {
220
+ formatStatWithSpec,
221
+ formatterFromExample,
222
+ memoFormatterFromExample,
223
+ percentRasterFormatter,
224
+ sameUnit,
225
+ seriesRasterFormatter
226
+ } from "./chunk-RGZGLKFB.js";
227
+ import {
228
+ autoDecimals,
229
+ chartString,
230
+ formatAutomaticNumber,
231
+ formatAutomaticPercent,
232
+ formatShare,
233
+ withLocaleStrings
234
+ } from "./chunk-53OYF4ZT.js";
235
+ import {
236
+ canvasMargin,
237
+ dashToken,
238
+ effectiveFill,
239
+ emphasisWeight,
240
+ labelsOffKeepsNames,
241
+ markOutlineOff,
242
+ markRolePaint,
243
+ markRoleToken,
244
+ mutedMarkPaint,
245
+ namesOnly,
246
+ paintColor,
247
+ panelTypeClass,
248
+ recedingSeriesId,
249
+ secondaryFont,
250
+ segmentSeparationStroke,
251
+ seriesPaint,
252
+ seriesTextPaint,
253
+ strokeToken,
254
+ textScaleOf,
255
+ withSegmentSeams
256
+ } from "./chunk-CWDHCSL2.js";
257
+ import {
258
+ curvePathFromSegments,
259
+ drawnStroke,
260
+ monotoneSegments,
261
+ splitCurveSegmentsAtX
262
+ } from "./chunk-WLZ54FWG.js";
263
+ import {
264
+ NormalizeError,
265
+ accessibleTitle,
266
+ normalizeScenario,
267
+ resolveHighlight,
268
+ resolveSize,
269
+ resolveSubtitle,
270
+ scaleTextPx
271
+ } from "./chunk-SGD3ZHID.js";
272
+ import {
273
+ maxOf,
274
+ minOf,
275
+ pushAll
276
+ } from "./chunk-WYJEOMNY.js";
277
+ import {
278
+ defaultMeasurer,
279
+ wrapText
280
+ } from "./chunk-AG2CJ4JY.js";
281
+
282
+ // src/core/charts/combo/axisTitles.ts
283
+ var ROW_GAP = 18, SWATCH_BOX = 10, SWATCH_LINE = 14, SWATCH_GAP = 5, TITLE_GAP = 4, TITLE_TOP = 4;
284
+ function planComboAxisTitles(input) {
285
+ let result = { height: 0, requests: [], paints: /* @__PURE__ */ new Map(), swatches: /* @__PURE__ */ new Map(), warnings: [] }, titles = ["primary", "secondary"].flatMap((side) => {
286
+ let text = input.active[side] ? input.titles?.[side] : void 0;
287
+ if (!text?.trim()) return [];
288
+ let series = input.series.filter((item) => item.axis === side);
289
+ return [{ side, unique: series.length === 1 ? series[0] : void 0, text }];
290
+ }), maxWidth = Math.max(1, (input.frame.w - (titles.length > 1 ? 12 : 0)) / Math.max(1, titles.length)), height = input.measure("0", input.font).height, swatchRoom = (unique) => {
291
+ let swatch = unique && input.swatchOf ? input.swatchOf(unique) : void 0;
292
+ return swatch ? (swatch.kind === "box" ? SWATCH_BOX : SWATCH_LINE) + SWATCH_GAP : 0;
293
+ }, rowWidths = titles.map(({ unique, text }) => swatchRoom(unique) + input.measure(text, input.font).width), inRow = input.row === !0 && titles.length > 1 && rowWidths.reduce((sum, w) => sum + w, 0) + ROW_GAP * (titles.length - 1) <= input.frame.w, rowX = input.frame.x;
294
+ for (let { side, unique, text } of titles) {
295
+ let id = `axis:${side}:title`, swatch = unique && input.swatchOf ? input.swatchOf(unique) : void 0, offset = swatch ? (swatch.kind === "box" ? SWATCH_BOX : SWATCH_LINE) + SWATCH_GAP : 0;
296
+ swatch && result.swatches.set(id, { ...swatch, offset });
297
+ let lines = inRow ? [text] : wrapFootnote(text, input.font, Math.max(1, maxWidth - offset), input.measure), width = Math.max(...lines.map((line) => input.measure(line, input.font).width)), x = inRow ? rowX + offset : side === "primary" ? input.frame.x + offset : input.frame.x + input.frame.w - width;
298
+ rowX += offset + width + ROW_GAP;
299
+ let titleHeight = height * lines.length, owner = unique ? { seriesId: unique.id } : {};
300
+ result.height = Math.max(result.height, titleHeight + TITLE_GAP + Math.max(0, input.tickHalf - input.below)), result.requests.push({
301
+ id,
302
+ kind: "axisTitle",
303
+ owner,
304
+ text,
305
+ lines,
306
+ typeRole: input.typeRole ?? "axis",
307
+ font: input.font,
308
+ fontStep: input.font,
309
+ // A title with a swatch is the key of its series: its name outranks a value it touches.
310
+ priority: swatch ? PRIORITY.grandTotal + PRIORITY.highlightBonus : PRIORITY.grandTotal,
311
+ candidates: [{
312
+ slot: "above",
313
+ penalty: 0,
314
+ rect: { x, y: input.frame.y + TITLE_TOP, w: width, h: titleHeight }
315
+ }]
316
+ }), result.paints.set(id, swatch || input.swatchOf && !unique ? { token: "inkMuted" } : unique ? input.paintOf(unique) : { token: "ink" });
317
+ }
318
+ return result;
319
+ }
320
+ var PRIMARY_AXIS_TITLE_ID = "axis:primary:title";
321
+ function anchorComboAxisTitles(titles, columns, frame) {
322
+ return titles.requests.map((request) => {
323
+ let candidate = request.candidates[0], { w } = candidate.rect, offset = titles.swatches.get(request.id)?.offset ?? 0, x = request.id === PRIMARY_AXIS_TITLE_ID ? columns.left === void 0 ? void 0 : columns.left + offset : offset > 0 && columns.rightStart !== void 0 ? columns.rightStart + offset : columns.right === void 0 ? void 0 : columns.right - w;
324
+ if (x === void 0) return request;
325
+ let anchored = { ...candidate, rect: { ...candidate.rect, x: Math.max(frame.x + offset, Math.min(x, frame.x + frame.w - w)) } };
326
+ return { ...request, candidates: [anchored, ...request.candidates.slice(1)] };
327
+ });
328
+ }
329
+ function comboAxisTitleSwatches(theme, labels, titles, occupied) {
330
+ let nodes = [];
331
+ for (let label of labels) {
332
+ let swatch = titles.swatches.get(label.id);
333
+ if (!swatch || label.hidden) continue;
334
+ let x = label.rect.x - swatch.offset, cy = label.rect.y + label.rect.h / Math.max(1, label.lines.length) / 2, owner = label.owner;
335
+ if (swatch.kind === "box") {
336
+ let rect = { x, y: cy - SWATCH_BOX / 2, w: SWATCH_BOX, h: SWATCH_BOX };
337
+ nodes.push({ t: "rect", id: `${label.id}:swatch`, rect, fill: swatch.paint, owner, part: "axisTitleSwatch" }), occupied.claim(rect, "axis", {}, "axisTitle");
338
+ } else
339
+ nodes.push({ t: "line", id: `${label.id}:swatch`, x1: x, y1: cy, x2: x + SWATCH_LINE, y2: cy, stroke: swatch.paint, width: swatch.width ?? strokeToken(theme, "data"), ...swatch.dash ? { dash: swatch.dash, lineCap: swatch.lineCap } : {}, owner, part: "axisTitleSwatch" }), swatch.hollow && nodes.push({
340
+ t: "line",
341
+ id: `${label.id}:swatch:inner`,
342
+ x1: x,
343
+ y1: cy,
344
+ x2: x + SWATCH_LINE,
345
+ y2: cy,
346
+ stroke: { token: "background" },
347
+ width: strokeToken(theme, "hair"),
348
+ ...swatch.dash ? { dash: swatch.dash, lineCap: swatch.lineCap } : {},
349
+ owner,
350
+ part: "axisTitleSwatch"
351
+ }), nodes.push({ t: "circle", id: `${label.id}:swatch:dot`, cx: x + SWATCH_LINE / 2, cy, r: 2.5, fill: swatch.hollow ? { token: "background" } : swatch.paint, ...swatch.hollow ? { stroke: swatch.paint, strokeWidth: strokeToken(theme, "mark") } : {}, owner, part: "axisTitleSwatch" }), occupied.claim({ x, y: cy - 3, w: SWATCH_LINE, h: 6 }, "axis", {}, "axisTitle");
352
+ }
353
+ return nodes;
354
+ }
355
+ function applyComboAxisTitlePaint(labels, titles) {
356
+ for (let label of labels) {
357
+ let paint = titles.paints.get(label.id);
358
+ paint && (label.ink = paint);
359
+ }
360
+ }
361
+
362
+ // src/core/charts/combo/endpoints.ts
363
+ function comboValueLabels(options, anatomy = !1, categoryCount = 1 / 0) {
364
+ return options.valueLabels ?? (anatomy ? categoryCount <= ANATOMY_ALL_MAX_CATEGORIES ? "all" : "ends" : "last");
365
+ }
366
+ var ANATOMY_ALL_MAX_CATEGORIES = 8;
367
+ function prepareComboEndpointTexts(series, textOf, engine) {
368
+ let first = /* @__PURE__ */ new Map(), last = /* @__PURE__ */ new Map(), add = (target, item, ci) => {
369
+ let authoredOnly = !(target === first ? typeof engine.first == "function" ? engine.first(item) : engine.first : engine.last), value = item.vals[ci];
370
+ if (authoredOnly && typeof value.labelOverride != "string") return;
371
+ let composed = textOf(item, ci), text = typeof value.labelOverride == "string" ? value.labelOverride.replace(/\$\{value\}/g, composed) : composed;
372
+ (text || value.labelOverride === !1) && target.set(item.id, { text, ci, suppressed: value.labelOverride === !1 });
373
+ };
374
+ for (let item of series) {
375
+ let firstCi = item.vals.findIndex((value) => value.v !== null);
376
+ if (firstCi < 0) continue;
377
+ let lastCi = firstCi;
378
+ for (let ci = firstCi + 1; ci < item.vals.length; ci++) item.vals[ci].v !== null && (lastCi = ci);
379
+ add(last, item, lastCi), firstCi !== lastCi && add(first, item, firstCi);
380
+ }
381
+ return { first, last };
382
+ }
383
+ var ENDPOINT_MAX_GAP = 20, INSIDE_ENDPOINT_IDS = /* @__PURE__ */ Symbol("insideEndpointIds"), SIDE_GAP = 5;
384
+ function insideEndpointGutters(input) {
385
+ if (!input.ids) return { first: 0, last: 0 };
386
+ let selected = (ends) => new Map([...ends].filter(([id, end]) => input.ids.has(`point:${id}:${input.cats[end.ci].id}`))), room = endpointGutters({
387
+ first: selected(input.first),
388
+ last: selected(input.last),
389
+ count: input.cats.length,
390
+ width: input.width,
391
+ adjacent: { first: !1, last: !1 },
392
+ font: input.font,
393
+ measure: input.measure,
394
+ markerR: input.markerR
395
+ });
396
+ return room.first + room.last > input.width / 2 ? { first: 0, last: 0 } : room;
397
+ }
398
+ function endpointGutters(input) {
399
+ let side = (texts, fromEnd, width) => {
400
+ let gutter = 0;
401
+ for (let end of texts.values()) {
402
+ if (end.suppressed) continue;
403
+ let reach = input.markerR + SIDE_GAP + input.measure(end.text || "0", input.font).width, k = (0.55 + (fromEnd ? input.count - 1 - end.ci : end.ci)) / (input.count + 0.1), needed = (reach - k * width) / (1 - k);
404
+ needed > 0 && (gutter = Math.max(gutter, Math.ceil(needed) + 1));
405
+ }
406
+ return Math.min(gutter, Math.floor(input.width / 4));
407
+ }, gutters = { first: 0, last: 0 };
408
+ for (let round = 0; round < 64; round++) {
409
+ let first = input.adjacent.first ? 0 : side(input.first, !1, input.width - gutters.last), last = input.adjacent.last ? 0 : side(input.last, !0, input.width - first);
410
+ if (first === gutters.first && last === gutters.last) break;
411
+ gutters = { first, last };
412
+ }
413
+ return gutters;
414
+ }
415
+ function unusedEndpointGutters(gutters, solved, plot) {
416
+ let shown = solved.placed.filter((label) => label.kind === "point" && !label.hidden), first = shown.some((label) => label.rect.x < plot.x - 0.5) ? gutters.first : 0, last = shown.some((label) => label.rect.x + label.rect.w > plot.x + plot.w + 0.5) ? gutters.last : 0;
417
+ return first === gutters.first && last === gutters.last ? void 0 : { first, last };
418
+ }
419
+ function flagDroppedEndpointLabels(solved) {
420
+ for (let warning of solved.warnings)
421
+ warning.code !== "label-hidden" || !warning.message.startsWith("label 'point:") || (warning.severity = "warn", warning.message += `; nothing within ${ENDPOINT_MAX_GAP}px of its point is free`);
422
+ }
423
+ var STROKE_CLEAR = 2;
424
+ function clearOfStrokes(candidates, strokes) {
425
+ return candidates.filter(({ rect }) => !strokes.some((stroke) => stroke.hits(rect, STROKE_CLEAR)));
426
+ }
427
+ function clearLift(rect, strokes, max) {
428
+ let at = (dy) => clearOfStrokes([{ slot: "probe", rect: { ...rect, y: rect.y - dy }, penalty: 0 }], strokes).length > 0;
429
+ if (!at(0)) {
430
+ for (let dy = 1; dy <= max; dy++) if (at(dy)) return dy;
431
+ }
432
+ }
433
+ function nearerOwnLine(candidates, own, others) {
434
+ return others.length === 0 ? candidates.slice() : candidates.filter(({ rect }) => {
435
+ let gap = 1 / 0;
436
+ for (let line of own) gap = Math.min(gap, line.distance(rect));
437
+ return !others.some((line) => line.closerThan(rect, gap));
438
+ });
439
+ }
440
+ function withinOneFill(candidates, fills) {
441
+ let crosses = (candidate) => crossesFill(candidate, fills);
442
+ return [...candidates.filter((candidate) => !crosses(candidate)), ...candidates.filter(crosses)];
443
+ }
444
+ function crossesFill(candidate, fills) {
445
+ return candidate.overColumns === !0 && fills.some((fill) => rectsOverlap(fill, candidate.rect) && !rectContains(fill, candidate.rect, 1));
446
+ }
447
+ var firstSlots = {
448
+ aboveCenter: "aboveCenter",
449
+ aboveLifted: "aboveLifted",
450
+ belowCenter: "belowCenter",
451
+ right: "left",
452
+ rightShiftedUp: "leftShiftedUp",
453
+ rightShiftedDown: "leftShiftedDown",
454
+ rightNudgedUp: "leftNudgedUp",
455
+ rightNudgedDown: "leftNudgedDown",
456
+ rightClear: "leftClear",
457
+ rightPastColumn: "leftPastColumn",
458
+ rightPastColumnUp: "leftPastColumnUp",
459
+ rightPastColumnDown: "leftPastColumnDown",
460
+ rightPastColumnClear: "leftPastColumnClear",
461
+ rightPastColumnShiftedUp: "leftPastColumnShiftedUp",
462
+ rightPastColumnShiftedDown: "leftPastColumnShiftedDown",
463
+ belowEndDeep: "belowStartDeep",
464
+ aboveEnd: "aboveStart",
465
+ belowEnd: "belowStart",
466
+ aboveEndLeft: "aboveStartRight",
467
+ belowEndLeft: "belowStartRight",
468
+ outsideRight: "outsideLeft"
469
+ }, ON_COLUMN_ORDER = ["aboveEnd", "belowEnd", "right", "aboveEndLeft", "belowEndLeft", "rightShiftedUp", "rightShiftedDown"], FIRST_END_BELOW_TOTALS = /* @__PURE__ */ Symbol("firstEndBelowTotals"), ANATOMY_ABOVE_GAP = 5;
470
+ function markerGap(rect, point, r) {
471
+ let nx = Math.max(rect.x, Math.min(point.x, rect.x + rect.w)), ny = Math.max(rect.y, Math.min(point.y, rect.y + rect.h));
472
+ return Math.max(0, Math.hypot(nx - point.x, ny - point.y) - r);
473
+ }
474
+ function atThePoint(candidates, point, r, h, bounds) {
475
+ return candidates.flatMap((candidate) => {
476
+ let { rect } = candidate;
477
+ if (rect.x < bounds.x0 - 0.5 || rect.x + rect.w > bounds.x1 + 0.5) return [];
478
+ let gap = markerGap(rect, point, r);
479
+ return gap > ENDPOINT_MAX_GAP + (candidate.leaderVertical ? h + 4 : 0) ? [] : gap <= h || candidate.leaderFrom ? [candidate] : [{ ...candidate, leaderFrom: { x: point.x + (rect.x + rect.w / 2 < point.x ? -r : r), y: point.y } }];
480
+ });
481
+ }
482
+ function seatsAtThePoint(candidates, point, r, h, bounds, w) {
483
+ let wide = { ...bounds, x0: bounds.x0 - w, x1: bounds.x1 + w };
484
+ return candidates.flatMap((c) => atThePoint([c], point, r, h, c.slot.includes("PastColumn") ? wide : bounds));
485
+ }
486
+ var TICK_AIR = 4;
487
+ function leavesPlot(candidate, bounds) {
488
+ return candidate.slot.includes("PastColumn") && (candidate.rect.x < bounds.x0 - 0.5 || candidate.rect.x + candidate.rect.w > bounds.x1 + 0.5);
489
+ }
490
+ function rankedSeats(seats, strokes, fills) {
491
+ return withinOneFill(clearOfStrokes(seats, strokes), fills);
492
+ }
493
+ function comboEndpointRequest(input) {
494
+ let { s, last, lastCat, text, measure, MARKER_R, hasColumns, band, adjacentAxisActive, highlights, anatomy } = input, labelFont = anatomy ? { ...input.labelFont } : input.labelFont, tsize = measure(text || "0", labelFont), w = tsize.width, h = tsize.height, beside = last.x + MARKER_R + SIDE_GAP, right = { slot: "right", rect: { x: beside, y: last.y - h / 2, w, h }, penalty: 0 }, rightUp = { slot: "rightShiftedUp", rect: { x: beside, y: last.y - h / 2 - h - 3, w, h }, penalty: 1 }, rightDown = { slot: "rightShiftedDown", rect: { x: beside, y: last.y + h / 2 + 3, w, h }, penalty: 1 }, rightNudgedDown = { slot: "rightNudgedDown", rect: { x: beside, y: last.y - h / 2 + 3, w, h }, penalty: 0.5 }, rightNudgedUp = { slot: "rightNudgedUp", rect: { x: beside, y: last.y - h / 2 - 3, w, h }, penalty: 0.5 }, edgeAir = 3, clearY = Math.min(Math.max(last.y - h / 2, (input.bounds.y0 ?? -1 / 0) + edgeAir), (input.bounds.y1 ?? 1 / 0) - h - edgeAir), rightClear = Math.abs(clearY - (last.y - h / 2)) > 3 && Math.abs(clearY - (last.y - h / 2)) < h ? [{ slot: "rightClear", rect: { x: beside, y: clearY, w, h }, penalty: 0.75 }] : [], ownColumnEdge = Math.max(-1 / 0, maxOf(input.fills.filter((fill) => fill.x <= last.x && last.x <= fill.x + fill.w).map((fill) => fill.x + fill.w))), past = ownColumnEdge + edgeAir, rightPast = s.kind === "line" && input.sharesOnColumns !== !0 && hasColumns && Number.isFinite(ownColumnEdge) && past > beside && past - beside < w ? [
495
+ { slot: "rightPastColumn", rect: { x: past, y: last.y - h / 2, w, h }, penalty: 0.6 },
496
+ { slot: "rightPastColumnUp", rect: { x: past, y: last.y - h / 2 - 3, w, h }, penalty: 0.7 },
497
+ { slot: "rightPastColumnDown", rect: { x: past, y: last.y - h / 2 + 3, w, h }, penalty: 0.7 },
498
+ ...rightClear.map((seat) => ({ ...seat, slot: "rightPastColumnClear", rect: { ...seat.rect, x: past }, penalty: 0.8 })),
499
+ { slot: "rightPastColumnShiftedUp", rect: { x: past, y: last.y - h / 2 - h - 3, w, h }, penalty: 1.1 },
500
+ { slot: "rightPastColumnShiftedDown", rect: { x: past, y: last.y + h / 2 + 3, w, h }, penalty: 1.1 }
501
+ ] : [], aboveEnd = { slot: "aboveEnd", rect: { x: last.x - w + 2, y: last.y - h - MARKER_R - 4, w, h }, penalty: 2 }, belowEnd = { slot: "belowEnd", rect: { x: last.x - w + 2, y: last.y + MARKER_R + 4, w, h }, penalty: 2 }, belowEndDeep = { slot: "belowEndDeep", rect: { x: last.x - w + 2, y: last.y + MARKER_R + 4 + h / 2, w, h }, penalty: 2 }, aboveEndLeft = { slot: "aboveEndLeft", rect: { x: last.x - MARKER_R - 12 - w, y: last.y - h - MARKER_R - 4, w, h }, penalty: 3 }, belowEndLeft = { slot: "belowEndLeft", rect: { x: last.x - MARKER_R - 12 - w, y: last.y + MARKER_R + 4, w, h }, penalty: 3 }, outsideRight = {
502
+ slot: "outsideRight",
503
+ rect: { x: (hasColumns ? band.position(last.ci) + band.bandwidth : last.x) + 8, y: last.y - h / 2, w, h },
504
+ penalty: 4,
505
+ leaderFrom: { x: last.x + MARKER_R, y: last.y }
506
+ }, clearsColumns = s.kind === "line" && input.sharesOnColumns !== !0, centredX = clearsColumns ? Math.max(input.bounds.x0, Math.min(last.x - w / 2, input.bounds.x1 - w)) : last.x - w / 2, aboveCenter = { slot: "aboveCenter", rect: { x: centredX, y: last.y - h - (anatomy ? ANATOMY_ABOVE_GAP : MARKER_R + 4), w, h }, penalty: 0 }, aboveRaised = { ...aboveCenter, slot: "aboveRaised", rect: { ...aboveCenter.rect, y: aboveCenter.rect.y - 4 }, penalty: 0.5, ...anatomy ? { needsBacking: !0 } : {} }, lift = anatomy ? clearLift(aboveCenter.rect, input.strokes, h) : void 0, aboveLifted = lift === void 0 ? [] : [{ ...aboveCenter, slot: "aboveLifted", rect: { ...aboveCenter.rect, y: aboveCenter.rect.y - lift } }], belowCenter = { slot: "belowCenter", rect: { x: centredX, y: last.y + MARKER_R + 4, w, h }, penalty: 1 }, belowLowered = { ...belowCenter, slot: "belowLowered", rect: { ...belowCenter.rect, y: belowCenter.rect.y + 4 }, penalty: 1.5 }, pastXs = [0, 2, 4, 6].map((k) => last.x - w / 2 + (last.x - w / 2 > centredX ? -k : k)).filter((x) => Math.abs(x - centredX) > 0.5 && (x - centredX) * (last.x - w / 2 - centredX) > 0), centredPast = clearsColumns && hasColumns ? pastXs.flatMap((x, k) => [
507
+ { ...belowCenter, slot: `belowPastColumn${k || ""}`, rect: { ...belowCenter.rect, x } },
508
+ { ...aboveCenter, slot: `abovePastColumn${k || ""}`, rect: { ...aboveCenter.rect, x } }
509
+ ]) : [], ordered = anatomy ? [aboveCenter, ...aboveLifted, aboveEnd, belowCenter, belowEnd, aboveEndLeft, belowEndLeft, right, rightUp, rightDown].map((c) => ({ ...c, needsBacking: !0 })) : s.kind === "area" ? [belowEnd, belowEndDeep, belowEndLeft, belowCenter, right, rightDown, aboveEnd, aboveEndLeft, rightUp, outsideRight] : adjacentAxisActive ? [aboveEnd, belowEnd, aboveEndLeft, belowEndLeft, right, rightNudgedUp, rightNudgedDown, ...rightClear, ...rightPast, rightUp, rightDown, outsideRight] : [right, rightNudgedUp, rightNudgedDown, ...rightClear, ...rightPast, rightUp, rightDown, aboveEnd, belowEnd, aboveEndLeft, belowEndLeft, outsideRight], mirrored = input.first ? ordered.map((candidate) => ({
510
+ ...candidate,
511
+ slot: firstSlots[candidate.slot],
512
+ rect: { ...candidate.rect, x: 2 * last.x - candidate.rect.x - candidate.rect.w },
513
+ ...candidate.leaderFrom ? { leaderFrom: { ...candidate.leaderFrom, x: 2 * last.x - candidate.leaderFrom.x } } : {}
514
+ })) : ordered, onColumn = hasColumns && (!anatomy || input.allowOnColumn) && (!clearsColumns || input.allowOnColumn) ? [
515
+ ...ON_COLUMN_ORDER.flatMap((slot) => mirrored.filter((c) => c.slot === (input.first ? firstSlots[slot] : slot))),
516
+ // Centred on the point, the seat most likely to lie wholly on its column.
517
+ aboveCenter,
518
+ aboveRaised,
519
+ belowCenter,
520
+ belowLowered
521
+ ].map((c) => ({ ...c, slot: `${c.slot}OnColumn`, penalty: c.penalty + 10, needsBacking: !0, overColumns: !0 })).filter((c) => !(input.segmentSeats ?? []).some((seat) => rectsOverlap(seat, c.rect, 2))) : [], bandX = band.position(last.ci), ownColumn = input.fills.some((fill) => fill.x < bandX + band.bandwidth - 0.5 && fill.x + fill.w > bandX + 0.5), partialFirst = !input.first && !anatomy && clearsColumns && ownColumn && lastCat.partial === !0 ? [{ ...belowCenter, penalty: 0 }, { ...belowLowered, penalty: 0.5 }] : [], aboveColumns = [], totalOnLeader = !1;
522
+ if (clearsColumns && hasColumns) {
523
+ let x = Math.max(input.bounds.x0, Math.min(last.x - w / 2, input.bounds.x1 - w)), across = (rect) => rect.x < x + w + 2 && rect.x + rect.w > x - 2, crossed = input.fills.filter(across);
524
+ if (totalOnLeader = last.ci === 0 && (input.totalSeats ?? []).some((seat) => seat.x < last.x && seat.x + seat.w > last.x && seat.y < last.y), crossed.length > 0) {
525
+ let top = Math.min(minOf(crossed.map((fill) => fill.y)), minOf((input.totalSeats ?? []).filter(across).map((seat) => seat.y)));
526
+ for (let step = 0; step < 3; step++) for (let raise of [0, 4]) aboveColumns.push({
527
+ slot: `aboveColumn${step}${raise ? "Raised" : ""}`,
528
+ rect: { x, y: top - h - 4 - step * (h + 4) - raise, w, h },
529
+ penalty: (totalOnLeader ? LAST_RESORT_PENALTY : 0) + 5 + step + raise / 8,
530
+ // A point under the label's own span still gets its leader, straight down to it.
531
+ leaderFrom: { x: last.x, y: last.y },
532
+ leaderVertical: !0
533
+ });
534
+ }
535
+ }
536
+ return {
537
+ id: `point:${s.id}:${lastCat.id}`,
538
+ kind: "point",
539
+ owner: { seriesId: s.id, categoryId: lastCat.id },
540
+ text,
541
+ lines: [text],
542
+ typeRole: "label",
543
+ font: labelFont,
544
+ ...anatomy ? { fontStep: labelFont } : {},
545
+ // A line's end value seats before an area's, which has its fill to sit on.
546
+ priority: s.vals[last.ci].priority ?? (input.first && input.firstBelowTotals ? PRIORITY.endpoint : PRIORITY.reference) + (s.kind === "area" ? 0 : 0.5) + (highlights.has(s.id) ? PRIORITY.highlightBonus : 0),
547
+ redundant: s.vals[last.ci].labelOverride === !1,
548
+ // A Pareto's first share repeats its first bar: without a seat beside the total it drops as density.
549
+ ...input.first && input.firstBelowTotals && s.vals[last.ci].labelOverride === void 0 ? { quietWhenCrowded: !0 } : {},
550
+ // A line end's leader keeps its end clear of later labels.
551
+ // Over a running column the hollow marker is the mark the value names, so the nearest-mark
552
+ // rule measures from its edge: the line's own last segment beside the seat is no rival.
553
+ ...s.kind === "area" ? {} : { anchor: partialFirst.length > 0 ? { x: last.x - MARKER_R, y: last.y - MARKER_R, w: 2 * MARKER_R, h: 2 * MARKER_R } : { x: last.x, y: last.y } },
554
+ // A value lifted over the columns hangs on a long leader: no column total sits on it, and it
555
+ // crosses none (a total on the leader stacks two numbers on one vertical).
556
+ ...aboveColumns.length > 0 ? { leaderClear: !0 } : {},
557
+ candidates: rankedSeats(seatsAtThePoint([...partialFirst, ...mirrored, ...clearsColumns ? [aboveCenter, aboveRaised, ...partialFirst.length > 0 ? [] : [belowCenter, belowLowered]] : [], ...totalOnLeader ? [] : aboveColumns, ...onColumn, ...centredPast, ...totalOnLeader ? aboveColumns : []], last, MARKER_R, h, input.bounds, w), input.strokes, input.fills).filter((candidate) => !(input.totalSeats ?? []).some((seat) => rectsOverlap(seat, candidate.rect, 2))).filter((candidate) => !clearsColumns || candidate.overColumns || !input.fills.some((fill) => rectsOverlap(fill, candidate.rect, 2)) && (input.bounds.y0 === void 0 || candidate.rect.y >= input.bounds.y0) && (input.bounds.y1 === void 0 || candidate.rect.y + candidate.rect.h <= input.bounds.y1)).filter((candidate) => !clearsColumns || !candidate.overColumns || input.bounds.y1 === void 0 || candidate.rect.y + candidate.rect.h <= input.bounds.y1).map((candidate) => ({ ...candidate, outsidePlot: !clearsColumns && /^(right|left|outsideRight|outsideLeft)/.test(candidate.slot) })).filter((candidate) => !(leavesPlot(candidate, input.bounds) && candidate.slot.includes("Shifted"))).map((candidate, i, all) => [candidate, leavesPlot(candidate, input.bounds) ? all.length + i : i]).sort((a, b) => a[1] - b[1]).map(([candidate]) => leavesPlot(candidate, input.bounds) ? { ...candidate, penalty: candidate.penalty + LAST_RESORT_PENALTY, tickAir: TICK_AIR } : candidate)
558
+ };
559
+ }
560
+
561
+ // src/core/charts/combo/domain.ts
562
+ function resolveComboEnv(options, warnings) {
563
+ breakUnsupported("combo", options, warnings);
564
+ let theme = chartTheme(options), paletteRamp = chartPalette(theme, options.palette, warnings);
565
+ return {
566
+ theme,
567
+ palette: paletteRamp ? options.palette : void 0,
568
+ size: resolveSize(options.size),
569
+ byExample: memoFormatterFromExample(),
570
+ measure: options.measure ?? defaultMeasurer,
571
+ highlights: new Set(resolveHighlight(options.highlight)),
572
+ density: options.labelDensity ?? "smart"
573
+ };
574
+ }
575
+ function normalizeComboData(data) {
576
+ let { cats, series } = normalizeCategorySeries("combo", data, (s, cells) => ({
577
+ id: s.id,
578
+ label: s.label ?? s.id,
579
+ role: s.role ?? "data",
580
+ kind: s.kind ?? "column",
581
+ axis: s.axis ?? "primary",
582
+ scenario: normalizeScenario(s.scenario, `series[${s.id}].scenario`),
583
+ colorRole: s.colorRole,
584
+ fill: s.fill,
585
+ format: s.format,
586
+ unit: s.unit,
587
+ lineStyle: s.lineStyle,
588
+ marker: s.marker,
589
+ smooth: s.smooth,
590
+ interpolateGaps: s.interpolateGaps ?? !1,
591
+ vals: cells.map((cell, ci) => cellFields(cell, `series[${s.id}].values[${ci}]`))
592
+ }));
593
+ return { cats, seriesNorm: series };
594
+ }
595
+ function comboAxisGate(options, seriesNorm, columns, lines, warnings) {
596
+ let secOpt = options.secondaryAxis, rulerRequested = secOpt?.ruler, acknowledged = secOpt?.acknowledge === !0, ruler;
597
+ rulerRequested && acknowledged ? (acknowledged = !1, warnings.push({
598
+ code: "combo-ruler-conflict",
599
+ severity: "error",
600
+ message: "secondaryAxis.acknowledge (an independent second scale) and secondaryAxis.ruler (a relabelling of the primary scale) contradict each other \u2014 both refused",
601
+ suggest: "choose one: acknowledge for genuinely independent units, ruler for a share of a total"
602
+ })) : rulerRequested && (!Number.isFinite(rulerRequested.total) || rulerRequested.total <= 0 ? warnings.push({
603
+ code: "combo-ruler-total-invalid",
604
+ severity: "error",
605
+ message: `secondaryAxis.ruler.total must be positive and finite (got ${String(rulerRequested.total)}) \u2014 ruler not drawn`,
606
+ suggest: "pass the grand total the percentages refer to"
607
+ }) : ruler = { total: rulerRequested.total, intervals: Math.max(1, Math.round(rulerRequested.ticks ?? 5)) });
608
+ for (let s of columns)
609
+ s.axis === "secondary" && (s.axis = "primary", warnings.push({
610
+ code: "dual-axis",
611
+ severity: "warn",
612
+ message: `column series '${s.id}' cannot use the secondary axis \u2014 treated as primary`,
613
+ owner: { seriesId: s.id }
614
+ }));
615
+ let secondaryRequested = lines.filter((s) => s.axis === "secondary"), secondaryActive = !1;
616
+ if (secondaryRequested.length > 0)
617
+ if (acknowledged)
618
+ secondaryActive = !0, warnings.push({
619
+ code: "dual-axis",
620
+ severity: "warn",
621
+ message: `secondary axis in use \u2014 dual-axis charts invite misreading; ${secOpt?.domain ? "the secondary scale follows its authored domain" : "tick rows are synced to the primary axis"}`
622
+ });
623
+ else {
624
+ for (let s of secondaryRequested) s.axis = "primary";
625
+ let ids = secondaryRequested.map((s) => `'${s.id}'`).join(", ");
626
+ warnings.push({
627
+ code: "dual-axis",
628
+ severity: "error",
629
+ message: `series ${ids} ${secondaryRequested.length === 1 ? "requests" : "request"} the secondary axis without options.secondaryAxis.acknowledge \u2014 a dual-axis chart is refused unless acknowledged`,
630
+ suggest: `for genuinely independent units, set options.secondaryAxis = { acknowledge: true }; for a share of a total, remove axis: 'secondary' from ${ids} and set options.secondaryAxis.ruler`,
631
+ field: ["data", "series", seriesNorm.indexOf(secondaryRequested[0]), "axis"]
632
+ });
633
+ }
634
+ return { secOpt, ruler, secondaryRequested, secondaryActive };
635
+ }
636
+ function comboDrawsSecondaryAxis(data, options) {
637
+ let series = (data.series ?? []).filter((s) => (s.role ?? "data") !== "reference").map((s) => ({ ...s, kind: s.kind ?? "column" }));
638
+ return comboAxisGate(options, series, series.filter((s) => s.kind === "column"), series.filter((s) => s.kind !== "column"), []).secondaryActive;
639
+ }
640
+ function primaryLinesUnlabelled(options, lines, secondaryActive) {
641
+ let onPrimary = lines.some((s) => !(secondaryActive && s.axis === "secondary")), pointsOff = typeof options.labels == "object" && options.labels?.point === !1;
642
+ return onPrimary && (pointsOff || comboValueLabels(options) !== "all");
643
+ }
644
+ function comboUnitConflicts(options, seriesNorm, dataSeries, secondaryActive, warnings) {
645
+ let scales = [
646
+ { series: dataSeries.filter((s) => !secondaryActive || s.axis !== "secondary"), unit: options.unit, name: "the primary axis", secondary: !1 },
647
+ { series: secondaryActive ? dataSeries.filter((s) => s.axis === "secondary") : [], unit: void 0, name: "the secondary axis", secondary: !0 }
648
+ ];
649
+ for (let scale of scales) {
650
+ let conflict = unitConflict(scale.series, scale.unit);
651
+ if (!conflict) continue;
652
+ let s = scale.series[conflict.index];
653
+ warnings.push(unitConflictRefusal(conflict, s.id, seriesNorm.indexOf(s), scale.name, s.kind === "column" || scale.secondary ? `give the ${scale.secondary ? "secondary" : "column"} series one unit, or show the measure in its own chart` : `move series '${s.id}' to the secondary axis (axis: 'secondary', secondaryAxis: { acknowledge: true }) and title it in axisTitles.secondary`, scale.unit));
654
+ }
655
+ }
656
+ function ladderStepUp(raw) {
657
+ if (!(raw > 0) || !Number.isFinite(raw)) return 1;
658
+ let base = Math.pow(10, Math.floor(Math.log10(raw)));
659
+ for (let m of [1, 2, 2.5, 3, 5, 10])
660
+ if (m * base >= raw - base * 1e-9) return m * base;
661
+ return 10 * base;
662
+ }
663
+ function roundTick(v) {
664
+ return Number(v.toFixed(10));
665
+ }
666
+ function primaryLineMean(plans, secondaryActive) {
667
+ let sum = 0, n = 0;
668
+ for (let p of plans)
669
+ if (!(secondaryActive && p.s.axis === "secondary"))
670
+ for (let val of p.s.vals)
671
+ val.v !== null && (sum += val.v, n++);
672
+ return n > 0 ? sum / n : void 0;
673
+ }
674
+ function comboStacks(cats, columnSeries) {
675
+ let stackTotals = emptyIdRecord(), posTop = [], negBot = [], anyByCat = [], lo = 0, hi = 0;
676
+ return cats.forEach((c, ci) => {
677
+ let p = 0, n = 0;
678
+ for (let s of columnSeries) {
679
+ let v = s.vals[ci].v;
680
+ v !== null && (v >= 0 ? p += v : n += v);
681
+ }
682
+ posTop[ci] = p, negBot[ci] = n, anyByCat[ci] = columnSeries.some((s) => s.vals[ci].v !== null), columnSeries.length > 0 && (stackTotals[c.id] = p + n), lo = Math.min(lo, n), hi = Math.max(hi, p);
683
+ }), { stackTotals, posTop, negBot, anyByCat, lo, hi };
684
+ }
685
+ function axisValueLines(annotations, axis) {
686
+ return valueLineExtent(annotations, axis);
687
+ }
688
+ function primaryDomain(options, gate, extent, fmt, warnings) {
689
+ let { lo, hi, dataHi } = extent, { ruler } = gate, va = options.valueAxis ?? {}, lo2 = lo < 0 ? lo * 1.08 : 0, hi2 = hi > 0 ? hi * 1.08 : 0;
690
+ lo2 === 0 && hi2 === 0 && (hi2 = 1);
691
+ let [dLo, dHi] = niceDomain(lo2, hi2, 5, { dataExtent: [lo, hi], maxWasteFraction: 0.15 });
692
+ [dLo, dHi] = applyAxisBounds([dLo, dHi], [Math.min(lo, 0), Math.max(hi, 0)], va, warnings), ruler && (dLo = Math.min(0, lo), dHi = Math.max(ruler.total, hi), dataHi > ruler.total && warnings.push({
693
+ code: "combo-ruler-total-exceeded",
694
+ severity: "warn",
695
+ message: `plotted values reach ${fmt(dataHi)}, above the declared ruler total ${fmt(ruler.total)} \u2014 the percent ladder continues past 100%`,
696
+ suggest: "pass the true grand total as secondaryAxis.ruler.total"
697
+ }));
698
+ let pticks = linearScale([dLo, dHi], [0, 1]).ticks(5);
699
+ return pticks.length < 2 && (pticks = [dLo, dHi]), ruler && (pticks = Array.from(
700
+ { length: ruler.intervals + 1 },
701
+ (_, i) => roundTick(dLo + (dHi - dLo) * i / ruler.intervals)
702
+ )), { dLo, dHi, pticks };
703
+ }
704
+ function rightAxis(options, gate, raw, primary, secondarySpec, fixed) {
705
+ let { secOpt, ruler, secondaryActive, secondaryRequested } = gate, { pticks } = primary, nTicks = pticks.length, lang = options.locale?.language, secondaryDomain, secStep = 1;
706
+ if (secondaryActive && secOpt?.domain) {
707
+ let lo = Math.min(secOpt.domain[0], raw.lo), hi = Math.max(secOpt.domain[1], raw.hi), even = (hi - lo) / (nTicks - 1) || 1;
708
+ secStep = ladderSteps(even / 2, even * 2, PRIMARY_MANTISSAS).filter((step) => Math.abs((hi - lo) / step - Math.round((hi - lo) / step)) < 1e-9).reduce((best, step) => {
709
+ if (best === void 0) return step;
710
+ let off = Math.abs((hi - lo) / step - (nTicks - 1)), bestOff = Math.abs((hi - lo) / best - (nTicks - 1));
711
+ return off < bestOff - 1e-9 || Math.abs(off - bestOff) <= 1e-9 && step < best ? step : best;
712
+ }, void 0) ?? even, secondaryDomain = [roundTick(lo), roundTick(hi)];
713
+ } else if (secondaryActive && fixed !== void 0)
714
+ secStep = fixed.step, secondaryDomain = [roundTick(fixed.start), roundTick(fixed.start + fixed.step * (nTicks - 1))];
715
+ else if (secondaryActive) {
716
+ let step2 = ladderStepUp((raw.hi - raw.lo) / (nTicks - 1) || 1), s0 = Math.floor(raw.lo / step2 + 1e-9) * step2;
717
+ for (let i = 0; i < 12 && s0 + step2 * (nTicks - 1) < raw.hi - step2 * 1e-9; i++)
718
+ step2 = ladderStepUp(step2 * 1.2), s0 = Math.floor(raw.lo / step2 + 1e-9) * step2;
719
+ secStep = step2, secondaryDomain = [roundTick(s0), roundTick(s0 + step2 * (nTicks - 1))];
720
+ }
721
+ let secFmtSrc = secondaryRequested.find((s) => s.format)?.format, secAxisFmtSrc = secondaryActive ? secOpt?.format : void 0, secondaryAllPct = !secAxisFmtSrc && !secFmtSrc && secondaryRequested.length > 0 && secondaryRequested.every((s) => s.unit === "%" || s.vals.every((val) => val.v === null || val.isPct)) && secondaryRequested.some((s) => s.unit === "%" || s.vals.some((val) => val.isPct));
722
+ if (secondaryDomain) {
723
+ let rows = Math.round((secondaryDomain[1] - secondaryDomain[0]) / secStep), secTickValues = Array.from({ length: rows + 1 }, (_, i) => roundTick(secondaryDomain[0] + secStep * i)), pctDecimals = secondaryAllPct ? Math.max(0, ...secTickValues.map((tv) => {
724
+ for (let d = 0; d <= 3; d++)
725
+ if (Math.abs(tv - Number(tv.toFixed(d))) < 1e-9) return d;
726
+ return 3;
727
+ })) : 0, secTickFmt = secAxisFmtSrc ? formatterFromExample(secAxisFmtSrc, options.locale?.language) : secFmtSrc ? formatterFromExample(secFmtSrc, options.locale?.language) : secondaryAllPct ? (tv) => formatAutomaticPercent(tv, pctDecimals, !1, lang) : tickFormatter(secondarySpec.spec, secTickValues);
728
+ return secOpt?.show === !1 ? { secFmtSrc, secondaryDomain, rightTicks: [] } : { secFmtSrc, secondaryDomain, rightTicks: secTickValues.map((tv) => ({ at: tv, text: secTickFmt(tv) })) };
729
+ }
730
+ if (ruler) {
731
+ let pct = pticks.map((t) => roundTick(t / ruler.total * 100)), decimals = pct.some((p) => Math.abs(p - Math.round(p)) > 1e-9) ? 1 : 0;
732
+ return { secFmtSrc, secondaryDomain, rightTicks: pct.map((p) => ({ at: p, text: formatAutomaticPercent(p, decimals, !1, lang) })) };
733
+ }
734
+ return { secFmtSrc, secondaryDomain, rightTicks: [] };
735
+ }
736
+ var PRIMARY_MANTISSAS = [1, 2, 2.5, 5], SECONDARY_MANTISSAS = [1, 1.5, 2, 2.5, 3, 4, 5, 6, 8], LINE_CLEARANCE = 0.03;
737
+ function ladderSteps(lo, hi, mantissas) {
738
+ let out = [];
739
+ for (let exp = Math.floor(Math.log10(lo)) - 1; exp <= Math.ceil(Math.log10(hi)) + 1; exp++)
740
+ for (let m of mantissas) {
741
+ let step = roundTick(m * Math.pow(10, exp));
742
+ step >= lo - 1e-9 && step <= hi + 1e-9 && out.push(step);
743
+ }
744
+ return out;
745
+ }
746
+ function dualAxisScales(input) {
747
+ let { columnTops, primaryHi, lines, secondaryHi } = input;
748
+ if (input.columnBottoms.some((v) => v < 0) || lines.some((row) => row.some((v) => v !== null && v < 0)) || !(primaryHi > 0) || !(secondaryHi > 0)) return;
749
+ let half = input.bandFraction / 2, best;
750
+ for (let n2 of [3, 4, 5, 6])
751
+ for (let p2 of ladderSteps(primaryHi / n2, primaryHi * 3 / n2, PRIMARY_MANTISSAS))
752
+ for (let s2 of ladderSteps(secondaryHi * 1.01 / n2, secondaryHi * 1.6 / n2, SECONDARY_MANTISSAS)) {
753
+ let colAt = (ci) => (columnTops[ci] ?? 0) / (n2 * p2), lineAt = (v) => v / (n2 * s2);
754
+ if (!lines.every((row) => row.every((v, ci) => {
755
+ if (v === null) return !0;
756
+ if (lineAt(v) - colAt(ci) < (input.clearance ?? LINE_CLEARANCE)) return !1;
757
+ for (let next of [ci - 1, ci + 1]) {
758
+ let w = row[next];
759
+ if (w == null) continue;
760
+ if (lineAt(v) + (lineAt(w) - lineAt(v)) * half - colAt(ci) < (input.clearance ?? LINE_CLEARANCE)) return !1;
761
+ }
762
+ return !0;
763
+ }))) continue;
764
+ let fill = maxOf(columnTops) / (n2 * p2), lineFill = secondaryHi / (n2 * s2);
765
+ (!best || fill > best.fill + 1e-9 || Math.abs(fill - best.fill) <= 1e-9 && (lineFill > best.lineFill + 1e-9 || Math.abs(lineFill - best.lineFill) <= 1e-9 && n2 < best.n)) && (best = { n: n2, p: p2, s: s2, fill, lineFill });
766
+ }
767
+ if (!best) return;
768
+ let { n, p, s } = best;
769
+ return { pticks: Array.from({ length: n + 1 }, (_, i) => roundTick(i * p)), secondaryStep: s };
770
+ }
771
+ function zeroAlignedAxes(primary, secondary) {
772
+ let { pticks } = primary, n = pticks.length, zero = pticks.findIndex((t) => Math.abs(t) < 1e-9), p = n > 1 ? pticks[1] - pticks[0] : 0;
773
+ if (zero < 0 || !(p > 0) || pticks.some((t, i) => Math.abs(t - pticks[0] - i * p) > p * 1e-6)) return;
774
+ let range = secondary.hi - secondary.lo;
775
+ if (!(range > 0)) return;
776
+ let best;
777
+ for (let step2 of ladderSteps(range / (n + 1), range * 4 / Math.max(1, n - 1), [1, 2, 2.5, 5])) {
778
+ let below2 = Math.max(zero, Math.ceil(-secondary.lo / step2 - 1e-9)), above2 = Math.max(n - 1 - zero, Math.ceil(secondary.hi / step2 - 1e-9));
779
+ (!best || below2 + above2 < best.below + best.above) && (best = { below: below2, above: above2, step: step2 });
780
+ }
781
+ if (!best) return;
782
+ let { below, above, step } = best, ticks = Array.from({ length: below + above + 1 }, (_, i) => roundTick((i - below) * p));
783
+ return {
784
+ primary: { dLo: Math.min(primary.dLo, ticks[0]), dHi: Math.max(primary.dHi, ticks[ticks.length - 1]), pticks: ticks },
785
+ secondary: { step, start: roundTick(-below * step) }
786
+ };
787
+ }
788
+ function dualAxisAnatomy(options, secondaryActive, theme) {
789
+ let pinned = options.secondaryAxis?.domain !== void 0;
790
+ return !secondaryActive || pinned ? !1 : options.dualAxis?.anatomy ?? theme?.valueAxis?.dualAxis === !0;
791
+ }
792
+ function averageMarkerMean(options, cats, columns, lines, warnings, adds) {
793
+ let scope = averageMarkerScope(options.averageMarker);
794
+ if (scope === void 0) return;
795
+ let lineIds = scope === "all" ? [] : scope.filter((id) => lines.some((s) => s.id === id));
796
+ lineIds.length > 0 && warnings.push({
797
+ code: "average-marker-scope",
798
+ severity: "warn",
799
+ message: `averageMarker on a combo averages its column stacks; the line${lineIds.length === 1 ? "" : "s"} ${lineIds.map((id) => `'${id}'`).join(", ")} ${lineIds.length === 1 ? "is" : "are"} left out`,
800
+ suggest: "scope the marker to column series; a valueLine annotation draws a line at any value"
801
+ });
802
+ let selected = columns.filter((s) => scope === "all" || scope.includes(s.id));
803
+ if (averageOfUnaddedSums(adds(selected), warnings)) return;
804
+ let stacks = cats.flatMap((_, ci) => {
805
+ let values = selected.flatMap((s) => s.vals[ci]?.v == null ? [] : [s.vals[ci].v]);
806
+ return values.length > 0 ? [values.reduce((sum, v) => sum + v, 0)] : [];
807
+ });
808
+ if (stacks.length === 0) {
809
+ warnings.push({ code: "average-marker-empty", severity: "warn", message: "averageMarker scope has no plotted values; marker omitted" });
810
+ return;
811
+ }
812
+ return stacks.reduce((sum, v) => sum + v, 0) / stacks.length;
813
+ }
814
+ function comboAnomalyModel(spec, cats, lines, secondary, primary, pctFmt, locale, warnings, strings) {
815
+ let lineSeries = lines.filter((s) => s.kind === "line");
816
+ if (lineSeries.length !== 1)
817
+ throw new NormalizeError(
818
+ "anomaly-single-series",
819
+ "options.anomaly",
820
+ `anomaly on a combo judges its one line series; got ${lineSeries.length} \u2014 a robust score across two different measures is meaningless`,
821
+ "give exactly one series kind 'line', or chart the measure on its own line chart"
822
+ );
823
+ refuseAnomalySpec(spec);
824
+ let series = lineSeries[0], onSecondary = series.axis === "secondary" && secondary !== primary, raster = onSecondary ? secondary : primary, isPct = series.vals.some((val) => val.isPct), fmt = isPct ? pctFmt : raster.fmt, statFmt = isPct ? (v) => formatAutomaticPercent(v, 2, !1, locale) : (v) => formatStatWithSpec(v, raster.spec), present = cats.flatMap((c, ci) => {
825
+ let value = series.vals[ci]?.v;
826
+ return value == null || !Number.isFinite(value) ? [] : [{ categoryId: c.id, value }];
827
+ });
828
+ return { ...anomalyModel(spec, present, fmt, statFmt, locale, warnings, strings), seriesId: series.id, statFmt, onSecondary };
829
+ }
830
+ var TOTALS_AXIS = /* @__PURE__ */ Symbol("boardplot.comboTotalsAxis"), SECONDARY_FULL_DOMAIN = /* @__PURE__ */ Symbol("boardplot.secondaryFullDomain"), LINE_BAND_CLEARANCE = /* @__PURE__ */ Symbol("boardplot.lineBandClearance");
831
+ function secondaryPrimaryRange(options, secondary, fallback) {
832
+ let mapped = options[SECONDARY_FULL_DOMAIN], authored = options.secondaryAxis?.domain;
833
+ if (!mapped || !authored) return [fallback[0], fallback[fallback.length - 1]];
834
+ let scale = linearScale(authored, [mapped[0], mapped[1]]);
835
+ return [scale(secondary[0]), scale(secondary[1])];
836
+ }
837
+ var OPEN_BAND_MIN_STEP = 40;
838
+ function comboBandFraction(options, count) {
839
+ return options.bandFraction !== void 0 ? options.bandFraction : options[FIRST_END_BELOW_TOTALS] === !0 ? 0.7 : (resolveSize(options.size, options.target).width - 64) / Math.max(1, count) >= OPEN_BAND_MIN_STEP ? 0.55 : 0.7;
840
+ }
841
+ function resolveComboDomain(data, options, warnings, theme) {
842
+ let { cats, seriesNorm } = normalizeComboData(data), dataSeries = seriesNorm.filter((s) => s.role !== "reference"), refs = seriesNorm.filter((s) => s.role === "reference");
843
+ if (dataSeries.length === 0)
844
+ throw new NormalizeError("empty-data", "series", "combo requires at least one data-role series");
845
+ let columns = dataSeries.filter((s) => s.kind === "column"), lines = dataSeries.filter((s) => s.kind !== "column"), chartInterpolation = options.interpolate ?? "linear", gate = comboAxisGate(options, seriesNorm, columns, lines, warnings), { secondaryActive } = gate;
846
+ comboUnitConflicts(options, seriesNorm, dataSeries, secondaryActive, warnings);
847
+ let rasterFor = (axis) => {
848
+ let group = seriesNorm.filter((s) => (s.axis ?? "primary") === axis), units = new Set(group.map((s) => s.unit)), shared2 = units.size === 1 ? [...units][0] : void 0;
849
+ return seriesRasterFormatter(
850
+ axis === "primary" ? options.format : void 0,
851
+ group.flatMap((s) => s.vals.filter((val) => !val.isPct).map((val) => val.v)),
852
+ options.locale?.language,
853
+ axis === "primary" ? options.unit ?? shared2 : shared2,
854
+ options.target,
855
+ axis === "primary" ? options.defaultFormat : void 0,
856
+ columns.length > 1
857
+ );
858
+ }, valueSpec = rasterFor("primary"), fmt = valueSpec.fmt, secondarySpec = secondaryActive ? rasterFor("secondary") : valueSpec, pctFmt = percentRasterFormatter(seriesNorm.flatMap((s) => s.vals.filter((val) => val.isPct).map((val) => val.v)), options.locale?.language), sourceMean = options.viewDomain || options.window ? columns.length > 0 && cats.length > 0 ? columns.reduce((sum, series) => sum + series.vals.reduce((n, value) => n + (value.v ?? 0), 0), 0) / cats.length : primaryLineMean(lines.map((s) => ({ s, pts: [] })), secondaryActive) : void 0, addsOver = (series) => stackAdds(series.map((s) => ({ label: s.label, unit: s.unit, pctCells: s.vals.some((val) => val.isPct) })), options.unit, void 0), columnsAdd = addsOver(columns), averageMean = averageMarkerMean(options, cats, columns, lines, warnings, addsOver), anomalyRun = options.anomaly ? comboAnomalyModel(options.anomaly, cats, lines, secondarySpec, valueSpec, pctFmt, options.locale?.language, warnings, options.strings) : void 0, population = applyCategoryViewport({
859
+ domain: options.viewDomain,
860
+ window: options.window,
861
+ categories: cats,
862
+ series: seriesNorm,
863
+ plotted: [],
864
+ basis: [],
865
+ targets: [],
866
+ annotations: options.annotations
867
+ }), meanSpan = viewportMeanSpan(population), shown = population ? population.annotations : options.annotations, marker = averageMean === void 0 ? void 0 : { ...averageMarkerLine(shown ?? [], averageMean, (v) => formatStatWithSpec(v, valueSpec.spec), meanSpan(), options.strings?.average), side: "right" }, averageMarkerId = marker?.id, annotations = marker ? [...shown ?? [], marker] : shown, effective = population ? liveWindowOptions({ ...options, annotations }, population.sampling) : marker ? { ...options, annotations } : options, { stackTotals, posTop, negBot, anyByCat, lo: stackLo, hi: stackHi } = comboStacks(cats, columns), incompleteCats = new Set(cats.filter((_, ci) => anyByCat[ci] && columns.some((s) => s.vals[ci].v === null)).map((c) => c.id));
868
+ columnsAdd && warnIncompleteStacks(
869
+ "stacked",
870
+ cats,
871
+ incompleteCats,
872
+ options.labels !== !1 && options.labels?.grandTotal !== !1,
873
+ !1,
874
+ "columns",
875
+ warnings,
876
+ disclosuresShown(options)
877
+ );
878
+ let shareTexts = /* @__PURE__ */ new Map(), roundingAdjustments = [];
879
+ options.rounding !== "nearest" && columns.length > 1 && cats.forEach((c, ci) => {
880
+ if (!anyByCat[ci] || negBot[ci] < 0 || !(posTop[ci] > 0) || incompleteCats.has(c.id) || columns.some((s) => s.vals[ci].isPct)) return;
881
+ let shares = columns.map((s) => s.vals[ci].v / posTop[ci] * 100), rounded = sumConsistentShares(shares, options.locale?.language);
882
+ rounded?.warning ? warnings.push(roundingUnavailable(c.label ?? c.id, rounded.warning)) : rounded && columns.forEach((s, si) => {
883
+ shareTexts.set(`${c.id}\0${s.id}`, rounded.texts[si]), rounded.moved[si] && roundingAdjustments.push({
884
+ whole: c.label ?? c.id,
885
+ part: s.label,
886
+ share: Math.round(shares[si] * 1e4) / 1e4,
887
+ nearest: formatShare(shares[si], options.locale?.language),
888
+ printed: rounded.texts[si]
889
+ });
890
+ });
891
+ });
892
+ let lo = stackLo, hi = stackHi, sLoRaw = 0, sHiRaw = 0;
893
+ for (let s of [...lines, ...refs]) {
894
+ let secondary = s.axis === "secondary" && secondaryActive && s.role !== "reference";
895
+ for (let val of s.vals)
896
+ val.v !== null && (secondary ? (sLoRaw = Math.min(sLoRaw, val.v), sHiRaw = Math.max(sHiRaw, val.v)) : (lo = Math.min(lo, val.v), hi = Math.max(hi, val.v)));
897
+ }
898
+ secondaryActive && sLoRaw === 0 && sHiRaw === 0 && (sHiRaw = 1);
899
+ let dataHi = hi, primaryLine = axisValueLines(effective.annotations, "primary");
900
+ primaryLine && (lo = Math.min(lo, primaryLine.lo), hi = Math.max(hi, primaryLine.hi));
901
+ let secondaryLine = secondaryActive ? axisValueLines(effective.annotations, "secondary") : null;
902
+ if (secondaryLine && (sLoRaw = Math.min(sLoRaw, secondaryLine.lo), sHiRaw = Math.max(sHiRaw, secondaryLine.hi)), options[SECONDARY_FULL_DOMAIN]) {
903
+ let mapped = secondaryPrimaryRange(options, [sLoRaw, sHiRaw], [lo, hi]);
904
+ lo = Math.min(lo, mapped[0]), hi = Math.max(hi, mapped[1]);
905
+ }
906
+ let primary = primaryDomain(effective, gate, { lo, hi, dataHi }, fmt, warnings), anatomyRequested = dualAxisAnatomy(options, secondaryActive, theme), pinnedBy = [options.valueAxis?.min !== void 0 ? "valueAxis.min" : "", options.valueAxis?.max !== void 0 ? "valueAxis.max" : ""].filter(Boolean), negative = lo < 0 || sLoRaw < 0, anatomy = anatomyRequested && pinnedBy.length === 0 && !negative;
907
+ anatomyRequested && !anatomy && warnings.push({
908
+ code: "dual-axis-anatomy-off",
909
+ severity: "info",
910
+ message: pinnedBy.length > 0 ? `dual-axis anatomy not drawn: ${pinnedBy.join(" and ")} pin the primary scale the anatomy chooses` : "dual-axis anatomy not drawn: a negative value keeps a scale from starting at zero",
911
+ suggest: pinnedBy.length > 0 ? `drop ${pinnedBy.join(" and ")} to let the anatomy choose both scales` : "the plain dual axis is drawn"
912
+ });
913
+ let bandEligible = secondaryActive && columns.length > 0 && !gate.secOpt?.domain && pinnedBy.length === 0 && !negative && options.dualAxis?.anatomy !== !1, defaultPrimary = primary, lineBandScaleInput = bandEligible ? {
914
+ columnTops: posTop,
915
+ columnBottoms: negBot,
916
+ primaryHi: hi,
917
+ lines: lines.filter((s) => s.axis === "secondary").map((s) => s.vals.map((val) => val.v)),
918
+ secondaryHi: sHiRaw,
919
+ bandFraction: comboBandFraction(options, cats.length),
920
+ clearance: options[LINE_BAND_CLEARANCE]
921
+ } : void 0, shared = lineBandScaleInput ? dualAxisScales(lineBandScaleInput) : void 0;
922
+ shared && (primary = { dLo: 0, dHi: shared.pticks[shared.pticks.length - 1], pticks: shared.pticks });
923
+ let aligned = secondaryActive && !shared && !gate.secOpt?.domain && pinnedBy.length === 0 && negative ? zeroAlignedAxes(primary, { lo: sLoRaw, hi: sHiRaw }) : void 0;
924
+ aligned && (primary = aligned.primary);
925
+ let right = rightAxis(
926
+ effective,
927
+ gate,
928
+ { lo: sLoRaw, hi: sHiRaw },
929
+ primary,
930
+ secondarySpec,
931
+ shared ? { step: shared.secondaryStep, start: 0 } : aligned?.secondary
932
+ ), fmtSecondary = secondarySpec.fmt, beforeCorridor = warnings.slice(), anomalyFor = (left, rightDomain, out) => {
933
+ let extent = anomalyRun?.onSecondary ? rightDomain : [left.dLo, left.dHi];
934
+ return anomalyRun && extent && {
935
+ model: anomalyRun.anomaly,
936
+ seriesId: anomalyRun.seriesId,
937
+ statFmt: anomalyRun.statFmt,
938
+ ...anomalyCorridor(anomalyRun.anomaly, anomalyRun.values, extent[0], extent[1], anomalyRun.statFmt, out, options.strings)
939
+ };
940
+ }, ticksFromLabels = anatomy && shared !== void 0 && columns.length > 0 && anomalyRun === void 0 && comboValueLabels(options, !0, cats.length) === "all" && options.labels !== !1 && (options.labels === void 0 || options.labels.grandTotal !== !1) && options[TOTALS_AXIS] !== !0 && options.valueAxis?.show === void 0 && options.secondaryAxis?.show === void 0, resolved = {
941
+ anomaly: anomalyFor(primary, right.secondaryDomain, warnings),
942
+ options: effective,
943
+ cats,
944
+ data: dataSeries,
945
+ columns,
946
+ lines,
947
+ refs,
948
+ secondaryActive,
949
+ secondaryTicksHidden: secondaryActive && (options.secondaryAxis?.show === !1 || ticksFromLabels),
950
+ ticksFromLabels,
951
+ anatomy,
952
+ lineBand: shared !== void 0,
953
+ // Column totals already state the scale. An explicit axis still wins, and the axis comes
954
+ // back when a total found no seat (TOTALS_AXIS): then the totals no longer state it.
955
+ showPrimaryAxis: options.valueAxis?.show ?? (ticksFromLabels ? !1 : secondaryActive || options.labels === !1 || options[TOTALS_AXIS] === !0 || (columns.length > 0 && columnsAdd && (options.labels === void 0 || options.labels.grandTotal !== !1) ? !1 : primaryLinesUnlabelled(options, lines, secondaryActive))),
956
+ interpolationFor: (series) => series.smooth === !0 ? "monotone" : series.smooth === !1 ? "linear" : chartInterpolation,
957
+ fmt,
958
+ valueSpec: valueSpec.spec,
959
+ pctFmt,
960
+ // A secondary '%' series prints its '%' like the right axis does.
961
+ scaleFmtOf: (s) => s.axis === "secondary" && secondaryActive ? s.unit === "%" ? secondarySpec.fmtPercent : fmtSecondary : fmt,
962
+ explicitFormatOf: (s, value) => value.format ?? s.format ?? (s.axis === "secondary" && secondaryActive ? void 0 : options.format),
963
+ // Fallback is the SECONDARY scale group's raster, not the primary fmt: the
964
+ // right axis is a different unit, and integer revenue must not strip the
965
+ // decimal off a 48.3-units marker display (the per-scale raster).
966
+ secFmt: right.secFmtSrc ? formatterFromExample(right.secFmtSrc, options.locale?.language) : fmtSecondary,
967
+ sourceMean,
968
+ meanSpan,
969
+ averageMarkerId,
970
+ stackTotals,
971
+ shareTexts,
972
+ roundingAdjustments,
973
+ incompleteCats,
974
+ columnsAdd,
975
+ posTop,
976
+ negBot,
977
+ anyByCat,
978
+ ...primary,
979
+ secondaryDomain: right.secondaryDomain,
980
+ rightTicks: ticksFromLabels ? [] : right.rightTicks
981
+ };
982
+ return lineBandScaleInput && (resolved.withLineBandClearance = (clearance) => {
983
+ let next = dualAxisScales({ ...lineBandScaleInput, clearance });
984
+ if (shared?.secondaryStep === next?.secondaryStep && shared?.pticks.length === next?.pticks.length && !shared?.pticks.some((tick, i) => tick !== next.pticks[i])) return;
985
+ let left = next ? { dLo: 0, dHi: next.pticks[next.pticks.length - 1], pticks: next.pticks } : defaultPrimary, right2 = rightAxis(
986
+ effective,
987
+ gate,
988
+ { lo: sLoRaw, hi: sHiRaw },
989
+ left,
990
+ secondarySpec,
991
+ next ? { step: next.secondaryStep, start: 0 } : void 0
992
+ ), nextWarnings = [...beforeCorridor], axes = next || !resolved.ticksFromLabels ? {} : {
993
+ ticksFromLabels: !1,
994
+ showPrimaryAxis: !0,
995
+ secondaryTicksHidden: options.secondaryAxis?.show === !1
996
+ };
997
+ return { domain: {
998
+ ...resolved,
999
+ ...left,
1000
+ ...axes,
1001
+ lineBand: next !== void 0,
1002
+ secondaryDomain: right2.secondaryDomain,
1003
+ rightTicks: next && resolved.ticksFromLabels ? [] : right2.rightTicks,
1004
+ anomaly: anomalyFor(left, right2.secondaryDomain, nextWarnings)
1005
+ }, warnings: nextWarnings };
1006
+ }), resolved;
1007
+ }
1008
+
1009
+ // src/core/charts/combo/plot.ts
1010
+ var RIGHT_TICK_GAP = 8, GROWTH_GAP = 12, GROWTH_NOTE_BELOW = 600, GROWTH_ONE_LINE_SHARE = 0.2;
1011
+ function growthItems(domain, lang) {
1012
+ let { cats, columns, lines, stackTotals, anyByCat } = domain, items = [], label = (ci) => cats[ci].label ?? cats[ci].id, growth = (values, name) => {
1013
+ let at = values.flatMap((v, ci) => v !== null && cats[ci].partial !== !0 ? [ci] : []);
1014
+ if (at.length < 2) return;
1015
+ let a = at[0], b = at[at.length - 1], first = values[a], last = values[b];
1016
+ if (!(first > 0)) return;
1017
+ let span = a === 0 && b === cats.length - 1 ? "" : `${label(a)}\u2013${label(b)}`, head = name.split(",")[0].trim();
1018
+ return { text: formatAutomaticPercent((last / first - 1) * 100, 0, !0, lang), name: [name, span].filter(Boolean).join(", "), short: [head, span].filter(Boolean).join(", "), last };
1019
+ }, line = lines.find((s) => s.axis === "secondary" && s.kind === "line"), lineGrowth = line && growth(line.vals.map((val) => val.v), line.label);
1020
+ line && lineGrowth && items.push({ seriesId: line.id, ...lineGrowth, axis: "secondary", ink: "ink" });
1021
+ let columnGrowth = columns.length > 0 ? growth(cats.map((c, ci) => anyByCat[ci] ? stackTotals[c.id] : null), columns.length === 1 ? columns[0].label : "") : void 0;
1022
+ return columnGrowth && items.push({ seriesId: columns[0].id, ...columnGrowth, axis: "primary", ink: "inkMuted" }), items;
1023
+ }
1024
+ function growthStatements(env, domain) {
1025
+ let { options } = domain, { theme, measure, size } = env, valueFont = { ...{ family: theme.type.family, ...theme.type.label }, weight: emphasisWeight(theme) }, nameFont = valueFont, items = domain.anatomy && options.dualAxis?.growth ? growthItems(domain, options.locale?.language) : [], oneLineW = items.length > 0 ? GROWTH_GAP + maxOf(items.map((item) => measure(growthLine(item), valueFont).width)) : 0, oneLine = items.length > 0 && oneLineW <= size.width * GROWTH_ONE_LINE_SHARE, reserve = items.length === 0 ? 0 : oneLine ? oneLineW : GROWTH_GAP + maxOf(items.flatMap((item) => {
1026
+ let name = item.short;
1027
+ return [measure(item.text, valueFont).width, name ? measure(name, nameFont).width : 0];
1028
+ })), inNote = items.length > 0 && size.width < GROWTH_NOTE_BELOW;
1029
+ if (!inNote) return { items, valueFont, nameFont, reserve, inNote, oneLine };
1030
+ let { cats } = domain, period = items.every((item) => !item.name.includes("\u2013")) && cats.length > 1 ? `, ${cats[0].label ?? cats[0].id}\u2013${cats[cats.length - 1].label ?? cats[cats.length - 1].id}` : "", note = `${items.map((item) => `${item.name} ${item.text}`.trim()).join(", ")}${period}.`;
1031
+ return { items, valueFont, nameFont, reserve, inNote, oneLine, note };
1032
+ }
1033
+ function growthLine(item) {
1034
+ return item.short ? `${item.text} ${item.short}` : item.text;
1035
+ }
1036
+ var STACK_RAMP = [1, 45 / 26, 70 / 26, 100 / 26];
1037
+ function stackTint(tint, count, index) {
1038
+ let fromTop = count - 1 - Math.max(0, index);
1039
+ if (fromTop <= 0) return tint;
1040
+ let alpha = Math.min(1, (1 - tint) * STACK_RAMP[Math.min(fromTop, STACK_RAMP.length - 1)]);
1041
+ return Math.round((1 - alpha) * 100) / 100;
1042
+ }
1043
+ function inkLeadLine(env, s, li) {
1044
+ return env.theme.marks?.comboLine === "ink" && li === 0 && s.kind === "line" && !s.fill && !s.colorRole && !env.highlights.has(s.id) && !env.palette && s.scenario !== "PY";
1045
+ }
1046
+ function comboLineMarkers(env, domain, s) {
1047
+ let shape = s.marker ?? (s.kind === "line" ? "circle" : "none"), anatomyDots = domain.anatomy && s.marker === void 0 && s.kind === "line" && s.axis === "secondary", themeDrops = !anatomyDots && s.marker === void 0 && (env.theme.marks?.lineMarkers === "none" || domain.cats.length > MARKER_MAX_CATS);
1048
+ return { shape, anatomyDots, full: shape !== "none" && !themeDrops };
1049
+ }
1050
+ function comboPaints(env, domain) {
1051
+ let { theme, palette, highlights } = env, { columns, cats } = domain, css = (p) => paintColor(theme, p), columnTint = theme.marks?.comboColumnTint, tinted = (s, scenario) => {
1052
+ if (columnTint === void 0 || palette || s.fill || s.colorRole || scenario === "PY") return;
1053
+ if (scenario === "PL" || scenario === "FC") return { token: "focus" };
1054
+ if (columns.length === 1) return { token: "focus", tint: columnTint };
1055
+ let amount = stackTint(columnTint, columns.length, columns.indexOf(s));
1056
+ return amount > 0 ? { token: "focus", tint: amount } : { token: "focus" };
1057
+ }, receding = recedingSeriesId([...columns, ...domain.lines], highlights), column = (s, colIdx) => {
1058
+ if (s.fill) return { css: s.fill };
1059
+ if (s.colorRole) return markRolePaint(s.colorRole, !0);
1060
+ if (s.id === receding) return mutedMarkPaint();
1061
+ let themed = tinted(s, s.scenario);
1062
+ return themed || (columns.length === 1 ? seriesPaint(colIdx, palette, s.scenario) : seriesPaint(colIdx, palette));
1063
+ }, derived = domain.options[HIGHLIGHT_KEY] !== void 0, cell = (s, val, cat, colIdx) => {
1064
+ if (val.fill) return { css: val.fill };
1065
+ if (highlights.has(cat.id) || highlights.has(s.id)) return derived ? seriesPaint(0, palette) : { token: "focus" };
1066
+ if (derived && !val.scenario && !s.fill && !s.colorRole) return { token: "rest" };
1067
+ if (val.scenario) {
1068
+ let themed = tinted(s, val.scenario);
1069
+ return themed || (columns.length === 1 ? seriesPaint(colIdx, palette, val.scenario) : column(s, colIdx));
1070
+ }
1071
+ return column(s, colIdx);
1072
+ }, pattern = (s, val, cat) => partialPattern(cat, scenarioPattern(s, val)), inside = (s, val, cat, colIdx) => effectiveFill(css(cell(s, val, cat, colIdx)), pattern(s, val, cat), theme), top = (ci, above) => {
1073
+ for (let k = columns.length - 1; k >= 0; k--) {
1074
+ let s = columns[k], val = s.vals[ci];
1075
+ if (val.v !== null && (above ? val.v > 0 : val.v < 0))
1076
+ return { insideFill: inside(s, val, cats[ci], k), insidePaint: cell(s, val, cats[ci], k), insidePattern: pattern(s, val, cats[ci]) };
1077
+ }
1078
+ return { insideFill: paintColor(theme, { token: "neutralMark" }), insidePaint: { token: "neutralMark" } };
1079
+ }, tickHighlight = (domain.options.referenceStyle ?? "tick") === "tick" && domain.options.referenceTick?.color === "highlight", planStyle = (s) => s.kind === "line" ? planLineStyle(s.scenario, theme) : void 0, lineHollow = (s) => planStyle(s) !== void 0;
1080
+ return { edge: (fill, pattern2) => {
1081
+ if (pattern2 || "tint" in fill && fill.tint !== void 0) return {};
1082
+ let outline = segmentSeparationStroke(fill, theme.color.background, theme);
1083
+ return {
1084
+ ...outline ? { stroke: outline.stroke, width: outline.strokeWidth } : {},
1085
+ separation: { fillStep: !0, fill, backing: { token: "background" } }
1086
+ };
1087
+ }, css, column, cell, pattern, inside, top, line: (s, li) => {
1088
+ if (s.fill) return { css: s.fill };
1089
+ if (s.colorRole) return markRolePaint(s.colorRole);
1090
+ if (highlights.has(s.id)) return { token: "focus" };
1091
+ if (s.id === receding) return mutedMarkPaint();
1092
+ let plan = planStyle(s);
1093
+ return plan ? { token: plan.ink } : s.scenario === "PY" ? mutedMarkPaint() : inkLeadLine(env, s, li) ? { token: "markInk" } : palette ? seriesPaint(li, palette) : seriesPaint(columns.length + li);
1094
+ }, lineHollow, lineWidth: (s) => highlights.has(s.id) ? strokeToken(theme, "focus") : planStyle(s)?.width ?? strokeToken(theme, "data"), dash: (s) => {
1095
+ if (s.scenario === "FC") return dashToken(theme, "reference");
1096
+ if (s.lineStyle === "dashed") return dashToken(theme, "reference");
1097
+ if (s.lineStyle === "dotted") return dashToken(theme, "dotted");
1098
+ if (s.scenario === "PL" && !lineHollow(s)) return dashToken(theme, "reference");
1099
+ }, ref: (s) => tickHighlight ? { token: "highlight" } : s.fill ? { css: s.fill } : s.colorRole ? { token: markRoleToken(s.colorRole) } : { token: "ink" } };
1100
+ }
1101
+ function scenarioPattern(s, val) {
1102
+ let sc = val.scenario ?? s.scenario;
1103
+ return sc === "FC" ? "hatch45" : sc === "PL" ? "outline" : void 0;
1104
+ }
1105
+ var HIGHLIGHT_KEY = /* @__PURE__ */ Symbol("highlightKey");
1106
+ function comboLegend(env, domain, paints) {
1107
+ let { theme } = env, { options, columns, lines, refs, cats } = domain, highlightKey = options[HIGHLIGHT_KEY], keyMarker = (s) => {
1108
+ let { shape, full } = comboLineMarkers(env, domain, s);
1109
+ return s.kind === "line" && full && shape !== "none" ? { marker: { shape, ...paints.lineHollow(s) ? { hollow: !0 } : {} } } : {};
1110
+ };
1111
+ if (highlightKey && columns.length > 0)
1112
+ return {
1113
+ options: highlightKey.legend,
1114
+ items: [
1115
+ ...columns.flatMap((s, i) => cats.flatMap((cat, ci) => s.vals[ci].v === null ? [] : [{
1116
+ id: `key:${s.id}:${cat.id}`,
1117
+ label: (Array.isArray(options.highlight) ? options.highlight : [options.highlight]).includes(cat.id) ? highlightKey.highlighted : highlightKey.rest,
1118
+ paint: paints.cell(s, s.vals[ci], cat, i),
1119
+ ...paints.edge(paints.cell(s, s.vals[ci], cat, i), paints.pattern(s, s.vals[ci], cat))
1120
+ }])),
1121
+ ...highlightKey.line === void 0 ? [] : lines.flatMap((s, i) => s.kind !== "line" || s.vals.every((val) => val.v === null) ? [] : [{
1122
+ id: s.id,
1123
+ label: highlightKey.line,
1124
+ paint: paints.line(s, i),
1125
+ key: "line",
1126
+ width: paints.lineWidth(s, i),
1127
+ ...keyMarker(s),
1128
+ ...paints.dash(s) ? { dash: paints.dash(s) } : {}
1129
+ }])
1130
+ ]
1131
+ };
1132
+ let anomalyKeys = domain.anomaly ? anomalyLegendItems(theme, domain.anomaly.model, domain.anomaly.corridorShown, domain.anomaly.statFmt, columnCorridorPaint(options.colorblindSafe), options.strings, options.locale?.language) : [], referenceDrawn = panelTypeClass(options) === void 0 && refs.some((s) => s.vals.some((val) => val.v !== null)), position = (anomalyKeys.length > 0 || referenceDrawn) && options.legend === void 0 ? "top" : options.legend;
1133
+ if (!position || position === "none" || position === "auto") return;
1134
+ let legendOpts = normalizeLegendOption(position), columnItems = columns.map((s, i) => ({
1135
+ id: s.id,
1136
+ label: s.label,
1137
+ paint: paints.column(s, i),
1138
+ pattern: s.scenario === "FC" ? "hatch45" : s.scenario === "PL" ? "outline" : void 0,
1139
+ ...paints.edge(paints.column(s, i), scenarioPattern(s, {}))
1140
+ })), painted = columns.flatMap((s) => s.vals.flatMap((val) => val.v === null || val.v === 0 ? [] : [scenarioPattern(s, val)])), partialHatchPainted = columns.some(
1141
+ (s) => s.vals.some((val, ci) => val.v !== null && val.v !== 0 && paints.pattern(s, val, cats[ci]) !== scenarioPattern(s, val))
1142
+ ), axisKeyed = axisKeyedSeries(domain), undrawn = new Set([...columns, ...lines, ...refs].filter((s) => s.vals.every((val) => val.v === null)).map((s) => s.id)), items = [
1143
+ ...columnItems,
1144
+ ...lines.map((s, i) => ({
1145
+ id: s.id,
1146
+ label: s.label,
1147
+ paint: paints.line(s, i),
1148
+ key: s.kind === "line" ? "line" : "box",
1149
+ ...s.kind === "line" ? { width: paints.lineWidth(s, i) } : {},
1150
+ ...keyMarker(s),
1151
+ ...paints.lineHollow(s) ? { hollow: !0, width: paints.lineWidth(s, i) } : {},
1152
+ ...s.kind === "line" && paints.dash(s) ? { dash: paints.dash(s), lineCap: paints.dash(s)?.join(",") === dashToken(theme, "dotted").join(",") ? "round" : "butt" } : {}
1153
+ })),
1154
+ ...refs.map((s) => ({
1155
+ id: s.id,
1156
+ label: s.label,
1157
+ paint: paints.ref(s),
1158
+ key: "line",
1159
+ ...options.referenceStyle === "line" ? { dash: dashToken(theme, "dotted"), lineCap: "round", width: strokeToken(theme, "rule") } : { width: options.referenceTick?.width ?? strokeToken(theme, "rule") },
1160
+ ...options.referenceStyle === "marker" ? referenceMarkerKey(theme, paints.ref(s)) : {}
1161
+ })),
1162
+ ...scenarioLegendKeys({ markPatterns: painted, keyPatterns: columnItems.map((item) => item.pattern), paint: { token: "neutralMark" }, strings: options.strings }),
1163
+ ...partialLegendKeys(partialHatchPainted && !partialNamedOnTotals(env, domain), options.strings, cats),
1164
+ // A line that turns dashed at its forecast cells keys that dash, 5 on 3 as marks.ts draws it.
1165
+ ...lines.some((s) => s.scenario !== "FC" && s.vals.some((val) => val.v !== null && val.scenario === "FC")) ? [{ id: "__scenarioFCLine", label: options.strings.forecast, paint: { token: "neutralMark" }, key: "line", width: strokeToken(theme, "data"), dash: dashToken(theme, "reference") }] : [],
1166
+ ...anomalyKeys
1167
+ ].filter((item) => !axisKeyed.has(item.id) && !undrawn.has(item.id)), fcLine = items.find((item) => item.id === "__scenarioFCLine"), fcBox = items.find((item) => item.id === "__scenarioFC");
1168
+ if (fcLine && fcBox && (items = items.flatMap((item) => item === fcLine ? [] : item === fcBox ? [{ ...fcBox, withLine: { paint: fcLine.paint, dash: fcLine.dash, width: fcLine.width, lineCap: fcLine.lineCap } }] : [item])), items.length !== 0) {
1169
+ if (legendOpts.order) {
1170
+ let oi = (id) => {
1171
+ let k = legendOpts.order.indexOf(id);
1172
+ return k === -1 ? Number.MAX_SAFE_INTEGER : k;
1173
+ };
1174
+ items = [...items].sort((a, b) => oi(a.id) - oi(b.id));
1175
+ }
1176
+ return { options: legendOpts, items };
1177
+ }
1178
+ }
1179
+ function axisKeyedSeries(domain) {
1180
+ let keyed = /* @__PURE__ */ new Set(), highlightKeyed = domain.options[HIGHLIGHT_KEY] !== void 0;
1181
+ if (!domain.secondaryActive || kindSetting(domain, "axisTitle") === !1) return keyed;
1182
+ let active = { primary: domain.showPrimaryAxis || domain.ticksFromLabels === !0, secondary: domain.rightTicks.length > 0 || domain.secondaryTicksHidden };
1183
+ for (let side of ["primary", "secondary"]) {
1184
+ if (!active[side] || !domain.options.axisTitles?.[side]) continue;
1185
+ let series = domain.data.filter((s) => s.axis === side);
1186
+ series.length === 1 && !(highlightKeyed && series[0].kind === "column") && keyed.add(series[0].id);
1187
+ }
1188
+ return keyed;
1189
+ }
1190
+ function comboFrameMargins(env, domain) {
1191
+ let { theme, size, measure } = env, { options, dLo, dHi, fmt, secondaryActive } = domain, leftAxisReserve = domain.showPrimaryAxis ? measureValueAxisWidth([dLo, dHi], fmt, theme, measure, 5, domain.valueSpec) : 0, margin = { ...canvasMargin(theme, size.width), ...options.margin }, axisFont = { family: theme.type.family, ...theme.type.axis }, categoryWidth = Math.max(0, maxOf(domain.cats.map((c) => measure(c.label ?? c.id, axisFont).width))) + 4;
1192
+ if (domain.cats.length > 0 && categoryWidth > (size.width - margin.left - margin.right - leftAxisReserve) / domain.cats.length) {
1193
+ let gutter = measure("0", axisFont).height;
1194
+ options.margin?.left === void 0 && (margin.left = Math.min(margin.left, gutter)), options.margin?.right === void 0 && (margin.right = Math.min(margin.right, gutter));
1195
+ }
1196
+ let leftLineLabelW = Math.max(
1197
+ 0,
1198
+ maxOf((options.annotations ?? []).flatMap(
1199
+ (a) => a.kind === "valueLine" && a.side === "left" && typeof a.label == "string" && a.label && (a.axis !== "secondary" || secondaryActive && a.value !== "mean" && a.value !== void 0) ? [measure(a.label, { family: theme.type.family, ...theme.type.label }).width] : []
1200
+ ))
1201
+ );
1202
+ return margin.left += leftLineLabelW > 0 ? Math.max(0, leftLineLabelW + 4 - leftAxisReserve) : 0, { margin, leftAxisReserve };
1203
+ }
1204
+ function refitComboFrame(env, before, domain, framed) {
1205
+ let next = comboFrameMargins(env, domain);
1206
+ if (!(["left", "right", "top", "bottom"].some((side) => next.margin[side] !== framed.margin[side]) || before.anomaly?.corridorNote !== domain.anomaly?.corridorNote || before.anomaly?.corridorShown.low !== domain.anomaly?.corridorShown.low || before.anomaly?.corridorShown.high !== domain.anomaly?.corridorShown.high || before.rightTicks.length > 0 != domain.rightTicks.length > 0))
1207
+ return { ...framed, ...next };
1208
+ }
1209
+ function solveComboFrame(env, domain, paints, warnings, eventKey) {
1210
+ let { theme, size, measure } = env, { options } = domain;
1211
+ domain.anomaly && options.legend === "none" && warnings.push({
1212
+ code: "legend-suppressed-encoding",
1213
+ severity: "warn",
1214
+ message: "legend: 'none' suppressed the only key naming this exhibit's encodings (the anomaly corridor and flag marker) \u2014 the reader is left to infer them",
1215
+ suggest: "drop legend: 'none', or drop anomaly"
1216
+ });
1217
+ let { margin, leftAxisReserve } = comboFrameMargins(env, domain), claims = createOccupiedIndex({ x: 0, y: 0, w: size.width, h: size.height }), legend = comboLegend(env, domain, paints), growthNote = growthStatements(env, domain).note, frameOptions = options[CATEGORY_ROW_FROM_END] === !1 ? options : withCategoryNoteNames(options, domain.cats);
1218
+ return { frame: solveFrame(
1219
+ {
1220
+ size,
1221
+ margin,
1222
+ ...frameTextOptions(frameOptions),
1223
+ // The subtitle names the unit only when every plotted series is in it ("in $m" beside a series in k).
1224
+ ...options.unit && domain.data.some((s) => s.unit !== void 0 && !sameUnit(s.unit, options.unit)) ? { subtitle: resolveSubtitle(options.subtitle), unit: void 0 } : {},
1225
+ footnotes: [
1226
+ ...partialFootnotes(domain.cats, options.strings, legend?.items.some((item) => item.id === "__partial") || partialNamedOnTotals(env, domain)),
1227
+ ...authoredNotes(frameOptions),
1228
+ ...noteLine(knownPartsLead(options), domain.columnsAdd ? domain.cats.flatMap((c, ci) => {
1229
+ if (!domain.incompleteCats.has(c.id)) return [];
1230
+ let missing = domain.columns.filter((s) => s.vals[ci].v === null).map((s) => s.label);
1231
+ return [`${c.label ?? c.id} ${options.strings.without} ${missing.join(` ${options.strings.and} `)}`];
1232
+ }) : [], options.notes?.maxListed === void 0 ? void 0 : options),
1233
+ // The anomaly rule, stated on the exhibit (column prints it over the plot).
1234
+ ...domain.anomaly ? [disclosureNote(`${domain.anomaly.model.rule}${domain.anomaly.corridorNote}`)] : [],
1235
+ // The growth statements on a card, where the column beside the plot would cost it the width.
1236
+ ...growthNote === void 0 ? [] : [growthNote],
1237
+ // Two scales without tick columns: the note says each series reads on its own.
1238
+ ...domain.secondaryActive && domain.ticksFromLabels === !0 ? [disclosureNote(chartString2(options, "comboOwnScale"))] : []
1239
+ ],
1240
+ legend,
1241
+ ...eventKey ? { eventKey } : {},
1242
+ theme,
1243
+ measure
1244
+ },
1245
+ claims
1246
+ ), claims, leftAxisReserve, margin };
1247
+ }
1248
+ function contentOf(domain, kind, dflt) {
1249
+ let s = kindSetting(domain, kind);
1250
+ return s === !1 ? null : Array.isArray(s) ? s : dflt;
1251
+ }
1252
+ function toDateOnTotals(env, domain) {
1253
+ let ids = /* @__PURE__ */ new Set();
1254
+ if (partialKeyForced(domain.options)) return ids;
1255
+ let toDateWords = domain.options.strings?.toDate ?? chartString2(domain.options, "toDate");
1256
+ if (!toDateFits(toDateWords, env.theme, env.measure, env.size.width / Math.max(1, domain.cats.length))) return ids;
1257
+ let segments = domain.columns.length > 1 && contentOf(domain, "segment", ["absolute"]) !== null;
1258
+ return domain.columns.length === 0 || !domain.columnsAdd || segments || domain.anatomy || !contentOf(domain, "grandTotal", ["absolute"])?.includes("absolute") || domain.cats.forEach((c, ci) => {
1259
+ if (c.partial !== !0 || !domain.anyByCat[ci] || saysToDate(c.label ?? c.id, toDateWords)) return;
1260
+ let populated = domain.columns.filter((column) => column.vals[ci].v !== null), override = populated.length === 1 ? populated[0].vals[ci].labelOverride : void 0;
1261
+ override === !1 || typeof override == "string" && override.trim() === "" || ids.add(c.id);
1262
+ }), ids;
1263
+ }
1264
+ function partialNamedOnTotals(env, domain) {
1265
+ let named = toDateOnTotals(env, domain), drawn = (ci) => domain.anyByCat[ci] || domain.lines.some((s) => s.vals[ci].v !== null);
1266
+ return named.size > 0 && domain.cats.every((c, ci) => c.partial !== !0 || !drawn(ci) || named.has(c.id));
1267
+ }
1268
+ function kindSetting(domain, kind) {
1269
+ let l = domain.options.labels;
1270
+ if (l === !1) return kind === "axisTitle" || kind === "category" && labelsOffKeepsNames(domain.options);
1271
+ let v = l?.[kind];
1272
+ return v === void 0 ? !0 : v;
1273
+ }
1274
+ function composeLines(domain, content, value, catLabel, serLabel, serFmt) {
1275
+ let { abs, isPct, share } = value, explicit = value.format ? formatterFromExample(value.format, domain.options.locale?.language) : void 0, parts = [];
1276
+ for (let c of content)
1277
+ c === "absolute" && abs !== null ? parts.push([c, explicit ? explicit(abs) : isPct ? domain.pctFmt(abs) : serFmt(abs)]) : c === "percent" && abs !== null && isPct ? parts.push([c, explicit ? explicit(abs) : domain.pctFmt(abs)]) : c === "percent" && share !== void 0 && share !== null ? parts.push([c, value.shareText ?? formatShare(share, domain.options.locale?.language)]) : c === "category" && catLabel ? parts.push([c, catLabel]) : c === "series" && serLabel && parts.push([c, serLabel]);
1278
+ return valueShareLines(parts);
1279
+ }
1280
+ function composeText(...args) {
1281
+ return composeLines(...args).join(" ");
1282
+ }
1283
+ function comboPlotArea(env, domain, paints, framed, gutterOverride, warnings) {
1284
+ let { theme, measure, highlights, size } = env, { frame, leftAxisReserve } = framed, { options, cats, columns, lines, showPrimaryAxis, rightTicks } = domain, rightAxisActive = rightTicks.length > 0, 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, gtContent = columns.length > 0 && domain.columnsAdd ? contentOf(domain, "grandTotal", ["absolute"]) : null, tallest = Math.max(0, maxOf(domain.posTop)), estPlotH = frame.plot.h - 8 - 4 * gtH, totalsAirInScale = domain.dHi > domain.dLo && tallest > 0 && (domain.dHi - tallest) / (domain.dHi - domain.dLo) * estPlotH >= gtH + 6 + 4 && frame.plot.w / Math.max(1, cats.length) * 0.6 >= Math.max(0, maxOf(cats.map((c) => measure(composeText(
1285
+ domain,
1286
+ gtContent ?? ["absolute"],
1287
+ { abs: domain.stackTotals[c.id] ?? 0, isPct: !1, format: domain.options.format },
1288
+ c.label ?? c.id,
1289
+ "",
1290
+ domain.fmt
1291
+ ), strongFont).width))) + 8, totalsRow = gtContent && !(domain.anatomy && columns.length === 1) && !totalsAirInScale ? gtH + 6 : 0, columnTitlePaint = (paint) => "tint" in paint && paint.tint !== void 0 ? { token: "ink" } : paint, titles = { ...domain.options.axisTitles };
1292
+ if (domain.secondaryActive) for (let side of ["primary", "secondary"]) {
1293
+ let group = domain.data.filter((s) => s.axis === side), units = new Set(group.map((s) => s.unit).filter(Boolean)), unit = side === "primary" ? options.unit ?? (units.size === 1 ? [...units][0] : void 0) : units.size === 1 ? [...units][0] : void 0;
1294
+ unit && !textCarriesUnit(titles[side] ?? "", unit) && (titles[side] = titles[side] ? `${titles[side]}, ${unit}` : unit);
1295
+ }
1296
+ let axisTitles = planComboAxisTitles({
1297
+ series: domain.data,
1298
+ titles,
1299
+ active: {
1300
+ primary: (showPrimaryAxis || domain.ticksFromLabels === !0) && kindSetting(domain, "axisTitle") !== !1,
1301
+ secondary: (rightAxisActive || domain.secondaryTicksHidden) && kindSetting(domain, "axisTitle") !== !1
1302
+ },
1303
+ // The anatomy titles its axes in the axis face at 500, as line,
1304
+ // column and bar do; the plain dual axis keeps the label face.
1305
+ frame: frame.plot,
1306
+ font: domain.anatomy ? secondaryFont(theme) : labelFont,
1307
+ ...domain.anatomy ? { typeRole: "secondary" } : {},
1308
+ measure,
1309
+ below: totalsRow,
1310
+ tickHalf: domain.ticksFromLabels ? 0 : measure("0", tickFont).height / 2,
1311
+ // With no tick column to stand over, the titles key their series in one row from the left.
1312
+ ...domain.ticksFromLabels ? { row: !0 } : {},
1313
+ paintOf: (s) => s.kind === "column" ? highlights.has(s.id) ? { token: "focus" } : columnTitlePaint(paints.column(s, columns.indexOf(s))) : paints.line(s, lines.indexOf(s)),
1314
+ ...domain.anatomy || axisKeyedSeries(domain).size > 0 ? {
1315
+ swatchOf: (s) => !domain.anatomy && !axisKeyedSeries(domain).has(s.id) ? void 0 : s.kind === "line" ? {
1316
+ kind: "line",
1317
+ paint: paints.line(s, lines.indexOf(s)),
1318
+ width: paints.lineWidth(s, lines.indexOf(s)),
1319
+ dash: paints.dash(s),
1320
+ lineCap: paints.dash(s)?.join(",") === dashToken(theme, "dotted").join(",") ? "round" : "butt",
1321
+ ...paints.lineHollow(s) ? { hollow: !0 } : {}
1322
+ } : { kind: "box", paint: s.kind === "column" && highlights.has(s.id) ? { token: "focus" } : s.kind === "column" ? paints.column(s, columns.indexOf(s)) : paints.line(s, lines.indexOf(s)) }
1323
+ } : {}
1324
+ });
1325
+ pushAll(warnings, axisTitles.warnings);
1326
+ let hasCagr = (domain.options.annotations ?? []).some((a) => a.kind === "cagr"), forecast = comboForecastBoundaries(domain), forecastRow = forecast.length > 0 ? measure(options.strings.forecastHeader, secondaryFont(theme)).height + 8 : 0, stair = staircaseOn(options.categoryLabels, options) && columns.length > 0 && kindSetting(domain, "category") !== !1 && cats.length > 1, cagrRoom = Math.max(16, 39 - axisTitles.height), topPad = 8 + axisTitles.height + forecastRow + totalsRow + (hasCagr ? cagrRoom : 0) + (stair ? staircaseState(options).pad : 0);
1327
+ hasCagr && cagrRoom < 30 && recordFreedChrome(frame.frame, "cagr-headroom", 30 - cagrRoom);
1328
+ let pointContent = contentOf(domain, "point", ["absolute"]), valueLabels = comboValueLabels(options, domain.anatomy, domain.cats.length), texts = prepareComboEndpointTexts(
1329
+ lines,
1330
+ (series, ci) => {
1331
+ let value = series.vals[ci];
1332
+ return composeText(
1333
+ domain,
1334
+ pointContent ?? ["absolute"],
1335
+ { abs: value.v, isPct: value.isPct, format: domain.explicitFormatOf(series, value) },
1336
+ cats[ci].label ?? cats[ci].id,
1337
+ series.label,
1338
+ series.format ? env.byExample(series.format) : domain.scaleFmtOf(series)
1339
+ );
1340
+ },
1341
+ {
1342
+ first: (s) => pointContent !== null && (["ends", "extremes", "all"].includes(valueLabels) || options.valueLabels === void 0 && domain.secondaryActive && s.axis === "secondary"),
1343
+ last: pointContent !== null && valueLabels !== "none"
1344
+ }
1345
+ ), rightAxisReserve = rightAxisActive ? Math.max(maxOf(rightTicks.map((tick) => measure(tick.text, secondaryFont(theme)).width)), 1) + 10 : 0, growthPlan = growthStatements(env, domain), growthList = growthPlan.inNote ? [] : growthPlan.items, { valueFont: growthValueFont, nameFont: growthNameFont } = growthPlan, growthReserve = growthList.length > 0 ? growthPlan.reserve : 0, axisW = showPrimaryAxis ? Math.max(10, frame.plot.w - leftAxisReserve) : frame.plot.w, sharesOnColumns = domain.options[FIRST_END_BELOW_TOTALS] === !0, gutters = gutterOverride ?? endpointGutters({
1346
+ // A combo line end stays inside the plot; Pareto's share curve keeps its gutter.
1347
+ first: new Map([...texts.first].filter(([id]) => sharesOnColumns || lines.find((s) => s.id === id)?.kind !== "line")),
1348
+ last: new Map([...texts.last].filter(([id]) => sharesOnColumns || lines.find((s) => s.id === id)?.kind !== "line")),
1349
+ count: cats.length,
1350
+ font: labelFont,
1351
+ measure,
1352
+ markerR: 2.75,
1353
+ width: axisW - rightAxisReserve - growthReserve,
1354
+ adjacent: { first: showPrimaryAxis, last: rightAxisActive }
1355
+ }), anomalyReserve = domain.anomaly ? anomalyRuleReserve(anomalyRuleLines(theme, domain.anomaly.model, domain.anomaly.corridorShown, domain.anomaly.statFmt, { token: "warn" }, options.strings), labelFont, measure) : 0, valueLineFont = { ...labelFont, weight: emphasisWeight(theme) }, rightLineLabels = (domain.options.annotations ?? []).filter((a) => a.kind !== "event").flatMap((annotation, index) => {
1356
+ if (annotation.kind !== "valueLine" || annotation.label === !1 || (annotation.side ?? "right") !== "right") return [];
1357
+ let value = typeof annotation.value == "number" ? annotation.value : domain.columnsAdd ? domain.sourceMean ?? (columns.length > 0 && cats.length > 0 ? cats.reduce((sum, _, ci) => sum + domain.posTop[ci] + domain.negBot[ci], 0) / cats.length : primaryLineMean(domain.lines.map((s) => ({ s, pts: [] })), domain.secondaryActive)) : void 0;
1358
+ if (value === void 0) return [];
1359
+ let example = annotation.format ?? domain.options.format, fmt = example ? formatterFromExample(example, domain.options.locale?.language) : (v) => formatAutomaticNumber(v, { locale: domain.options.locale?.language, decimals: autoDecimals(v), signed: !1 }), span = domain.meanSpan({ from: annotation.from, to: annotation.to }), text = typeof annotation.label == "string" ? namedLineText(annotation.label, fmt(value), value, annotation.id ?? "") : `${options.strings.average} ${fmt(value)}${span ? ` (${span})` : ""}`;
1360
+ return [{
1361
+ id: defaultAnnotationId(annotation, index),
1362
+ text,
1363
+ width: measure(text, valueLineFont).width + 8,
1364
+ mean: annotation.value === "mean" || annotation.value === void 0 || annotation.id === domain.averageMarkerId
1365
+ }];
1366
+ }), lineBudget = Math.max(0, axisW - rightAxisReserve - growthReserve - anomalyReserve - gutters.first - gutters.last) / 2, valueLineRows = /* @__PURE__ */ new Map(), rowY = frame.plot.y + axisTitles.height + forecastRow + 8;
1367
+ for (let line of rightLineLabels.filter((line2) => line2.mean && line2.width > lineBudget)) {
1368
+ let lines2 = wrapText(line.text, valueLineFont, frame.plot.w, Math.max(1, line.text.length), measure).lines, h = measure("0", valueLineFont).height * lines2.length;
1369
+ valueLineRows.set(line.id, { x: frame.plot.x, y: rowY, w: frame.plot.w, h }), rowY += h + 8, topPad += h + 8;
1370
+ }
1371
+ let lineLabelReserve = options[VALUE_LINE_RESERVE] ?? 0, rightReserve = rightAxisReserve + Math.max(gutters.last + growthReserve + anomalyReserve, lineLabelReserve), plotX0 = frame.plot.x + (showPrimaryAxis ? leftAxisReserve : 0) + gutters.first, plotW0 = Math.max(10, axisW - rightReserve - gutters.first), endpointWidth = plotW0, insideIds = options[INSIDE_ENDPOINT_IDS], inside = insideEndpointGutters({
1372
+ ids: insideIds,
1373
+ first: texts.first,
1374
+ last: texts.last,
1375
+ cats,
1376
+ width: endpointWidth,
1377
+ font: labelFont,
1378
+ measure,
1379
+ markerR: 2.75
1380
+ }), bandFraction = comboBandFraction(domain.options, cats.length), bandFor = (x0, w) => bandScale(cats.length, [x0 + inside.first, x0 + w - inside.last], { paddingInner: 1 - bandFraction, paddingOuter: (1 - bandFraction) / 2 + 0.05 });
1381
+ if (stair) {
1382
+ let direction = staircaseDirection(domain.posTop), room = staircaseRoom({
1383
+ names: cats.map((c) => c.label ?? c.id),
1384
+ font: tickFont,
1385
+ measure,
1386
+ direction,
1387
+ edge: direction === "right" ? plotX0 + plotW0 : plotX0,
1388
+ width: plotW0,
1389
+ centers: (r) => {
1390
+ let b = bandFor(direction === "right" ? plotX0 : plotX0 + r, plotW0 - r);
1391
+ return cats.map((_, ci) => b.center(ci));
1392
+ }
1393
+ });
1394
+ direction === "left" && (plotX0 += room), plotW0 -= room;
1395
+ }
1396
+ let band = bandFor(plotX0, plotW0), categoryNames = cats.map((category) => category.label ?? category.id), periodRow = cats.some((category) => category.calendar) || isDateNumericTickSequence(categoryNames) || calendarLike(categoryNames) || categoryNames.every((label) => /^[MWT]\d+$/i.test(label)), planRow = (b, ticked2) => {
1397
+ let row = categoryLabelsAndMarks(cats, { count: authoredFootnoteCount(options), warnings }, partialAxisWords(options.strings, options, frame.legend?.items.some((item) => item.id === "__partial") || partialNamedOnTotals(env, domain)));
1398
+ return ticked2?.name(row), withCategoryRanks(planCategoryRow({
1399
+ rotate: !cats.every((c) => MONTH_START.exec((c.label ?? c.id).trim())?.[0] === (c.label ?? c.id).trim()),
1400
+ target: options.target,
1401
+ textScale: textScaleOf(options),
1402
+ ...row,
1403
+ // A ranked row (pareto) is not a timeline: its dates are not a calendar tick row.
1404
+ ...options[CATEGORY_ROW_FROM_END] === !1 ? { dates: void 0 } : { reference: { x: frame.plot.x, width: frame.plot.w } },
1405
+ strideFromEnd: periodRow && options[CATEGORY_ROW_FROM_END] !== !1,
1406
+ rotate90: options[CATEGORY_ROW_VERTICAL] === !0,
1407
+ centers: cats.map((_, ci) => b.center(ci)),
1408
+ step: b.step,
1409
+ fonts: [tickFont, { ...tickFont, size: tickFont.size - scaleTextPx(1, textScaleOf(options)) }, { family: theme.type.family, ...theme.type.footnote }],
1410
+ secondary: secondaryFont(theme),
1411
+ periods: periodRow,
1412
+ padding: 4,
1413
+ measure,
1414
+ plotHeight: frame.plot.h,
1415
+ // A name the rotated row cuts takes the next note number after the author's.
1416
+ // A cut name takes a note mark only where its note prints.
1417
+ // Without the rank key, nominal names keep one name per column (rotate, then ellipsis).
1418
+ // Under notes.show 'ranks' alone a cut name takes no mark, since its note does not print.
1419
+ ...disclosuresShown(options) ? { cutMarkFrom: authoredFootnoteCount(options) + 1 } : rankKeyShown(options) ? {} : { everyName: !0 },
1420
+ ...ticked2?.plan
1421
+ }), measure, cats.map((c) => c.label ?? c.id), options[FORCE_CATEGORY_RANKS] === !0, rankKeyShown(options));
1422
+ }, catPlan = planRow(band), ticked = options[CATEGORY_ROW_FROM_END] === !1 ? void 0 : longDayMonths(cats, catPlan.stride, options.locale?.language);
1423
+ ticked && (catPlan = planRow(band, ticked));
1424
+ let catOverhang = stair ? 0 : rotatedLeftOverhang(catPlan, cats.map((_, ci) => band.center(ci)), 4);
1425
+ catOverhang > 0 && (plotX0 += catOverhang, plotW0 -= catOverhang, band = bandFor(plotX0, plotW0), catPlan = planRow(band, ticked));
1426
+ let showCatTickRow = kindSetting(domain, "category") !== !1 && cats.length > 0 && !stair;
1427
+ showCatTickRow && (pushAll(warnings, catPlan.warnings), catPlan.step === "ranks" && warnings.push(categoryRanksLint(cats.map((c) => c.label ?? c.id), band.step)));
1428
+ let catBandH = showCatTickRow ? catPlan.rowHeight + 8 : 0, hangingRoom = showCatTickRow && domain.options.labels !== !1 ? Math.max(measure("0", labelFont).height, gtH) + 4 : 0, lowest = Math.min(0, minOf(domain.negBot)), hangingEnd = Math.min(0, minOf(domain.negBot.map((bottom, ci) => domain.posTop[ci] <= 0 ? bottom : 0))), rawBandPad = options[BAND_PAD] ?? 0, baseTopPad = topPad, plotH0NoBand = frame.plot.h - catBandH - baseTopPad, hangingReserveNoBand = hangingLabelReserve(plotH0NoBand, [domain.dLo, domain.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;
1429
+ for (; bandPad > 0 && frame.plot.h - catBandH - (baseTopPad + bandPad) - hangingLabelReserve(frame.plot.h - catBandH - (baseTopPad + bandPad), [domain.dLo, domain.dHi], hangingEnd, hangingRoom) < minRawH; )
1430
+ bandPad--;
1431
+ topPad = baseTopPad + bandPad;
1432
+ let plotH0 = frame.plot.h - catBandH - topPad, hangingReserve = hangingLabelReserve(plotH0, [domain.dLo, domain.dHi], hangingEnd, hangingRoom), plot = {
1433
+ x: frame.plot.x + gutters.first,
1434
+ y: frame.plot.y + topPad,
1435
+ w: Math.max(10, frame.plot.w - gutters.first),
1436
+ h: plotHeightAfter(frame, size.height, plotH0 - hangingReserve)
1437
+ }, minPlot = plotFloorRows(options) * measure("0", labelFont).height + 8;
1438
+ frame.frame.plotMinHeight = Math.max(frame.frame.plotMinHeight ?? 0, size.height + (frame.deficit ?? 0) + minPlot - (plotH0NoBand - hangingReserveNoBand)), showPrimaryAxis && (plot.x += leftAxisReserve, plot.w = Math.max(10, plot.w - leftAxisReserve)), plot.w = Math.max(10, plot.w - rightReserve);
1439
+ let { dLo, dHi, pticks, secondaryDomain } = domain, secondaryRange = secondaryDomain ? secondaryPrimaryRange(options, secondaryDomain, pticks) : void 0, endpointAir = columns.length === 0 || !(dHi > dLo) || sharesOnColumns ? 0 : Math.max(
1440
+ 0,
1441
+ maxOf([...texts.first, ...texts.last].flatMap(([id, end]) => {
1442
+ let series = lines.find((s) => s.id === id);
1443
+ if (series?.kind !== "line" || end.suppressed) return [];
1444
+ let raw = series.vals[end.ci].v ?? dLo, lower = secondaryRange?.[0] ?? pticks[0], upper = secondaryRange?.[1] ?? pticks[pticks.length - 1], plotted = series.axis === "secondary" && secondaryDomain && secondaryDomain[1] > secondaryDomain[0] ? lower + (raw - secondaryDomain[0]) / (secondaryDomain[1] - secondaryDomain[0]) * (upper - lower) : raw, value = Math.max(plotted, domain.posTop[end.ci]), share = Math.max(0, Math.min(1, (dHi - value) / (dHi - dLo))), room = measure(end.text, labelFont).height + 2.75 + 4;
1445
+ return share < 1 ? [Math.ceil((room - share * plot.h) / (1 - share))] : [];
1446
+ }))
1447
+ ), y = linearScale([dLo, dHi], [plot.y + plot.h, plot.y + Math.min(endpointAir, plot.h / 3)]), dateNumericTicks = catPlan.dateNumeric || isDateNumericTickSequence(cats.map((c) => c.label ?? c.id));
1448
+ return {
1449
+ frame,
1450
+ leftAxisReserve,
1451
+ rightAxisReserve,
1452
+ axisTitles,
1453
+ topPad,
1454
+ tickFont,
1455
+ labelFont,
1456
+ strongFont,
1457
+ gtH,
1458
+ valueLineRows,
1459
+ first: texts.first,
1460
+ last: texts.last,
1461
+ gutters,
1462
+ endpointWidth,
1463
+ band,
1464
+ catPlan,
1465
+ dateNumericTicks,
1466
+ // A date row stays at the plot's bottom band; prose reads under the
1467
+ // lowest column and the value or total hanging under it.
1468
+ catRowY: dateNumericTicks ? plot.y + plot.h + hangingReserve : categoryRowTop(y, lowest, hangingEnd, hangingRoom),
1469
+ showCatTickRow,
1470
+ catBandH,
1471
+ plot,
1472
+ // The names may rise to the frame top, under the axis titles.
1473
+ ...stair ? { stairTop: frame.plot.y + axisTitles.height } : {},
1474
+ rightTickX: plot.x + plot.w + RIGHT_TICK_GAP,
1475
+ anomalyLabelX: plot.x + plot.w + rightAxisReserve + gutters.last + growthReserve + 4,
1476
+ y,
1477
+ y0: y(0),
1478
+ y2: secondaryDomain ? linearScale(secondaryDomain, [y(secondaryRange[0]), y(secondaryRange[1])]) : y,
1479
+ ...growthList.length > 0 ? {
1480
+ growth: {
1481
+ x: plot.x + plot.w + rightAxisReserve + GROWTH_GAP - 2,
1482
+ valueFont: growthValueFont,
1483
+ nameFont: growthNameFont,
1484
+ oneLine: growthPlan.oneLine,
1485
+ // Each statement takes its series' text twin: the line's ink, or the single column's.
1486
+ items: growthList.map((item) => {
1487
+ let line = lines.find((s) => s.id === item.seriesId), paint = line ? paints.line(line, lines.indexOf(line)) : columns.length === 1 ? paints.column(columns[0], 0) : void 0;
1488
+ return paint ? { ...item, textPaint: seriesTextPaint(paint) } : item;
1489
+ })
1490
+ }
1491
+ } : {},
1492
+ forecast,
1493
+ forecastHeaderY: plot.y - totalsRow - forecastRow
1494
+ };
1495
+ }
1496
+ function comboForecastBoundaries(domain) {
1497
+ let starts = /* @__PURE__ */ new Map();
1498
+ for (let s of domain.data) {
1499
+ if (s.scenario === "FC") continue;
1500
+ let start = s.vals.findIndex((val) => val.v !== null && val.scenario === "FC");
1501
+ if (start > 0 && s.vals.slice(0, start).some((val) => val.v !== null)) {
1502
+ let actual = start - 1;
1503
+ if (s.kind === "line" || s.kind === "area") for (; actual > 0 && s.vals[actual].v === null; ) actual--;
1504
+ starts.set(`${actual}:${start}`, { categoryIndex: start, lastActualIndex: actual });
1505
+ }
1506
+ }
1507
+ let transitions = [...starts.values()].sort((a, b) => a.categoryIndex + a.lastActualIndex - b.categoryIndex - b.lastActualIndex), usedIds = new Set(domain.cats.map((category) => category.id));
1508
+ return transitions.map(({ categoryIndex, lastActualIndex }) => {
1509
+ let categoryId = domain.cats[categoryIndex].id, id = categoryId;
1510
+ if (transitions.filter((item) => item.categoryIndex === categoryIndex).length > 1) {
1511
+ for (id = `${categoryId}:from:${lastActualIndex}`; usedIds.has(id); ) id += ":2";
1512
+ usedIds.add(id);
1513
+ }
1514
+ return { categoryIndex, categoryId, id, lastActualIndex, labelled: !1, divided: !1 };
1515
+ });
1516
+ }
1517
+
1518
+ // src/core/charts/combo/labels.ts
1519
+ function comboStrokes(geometry) {
1520
+ return geometry.plans.flatMap((plan) => plan.runs.filter((run) => run.length > 1).map((run) => drawnStroke(run, plan.interpolation)));
1521
+ }
1522
+ var STROKE_CLEAR2 = 1.5 + 2, SHIFTED_TOTAL_GAP = 6, ABOVE_POINT_GAP = 5, SLIVER_MIN_H = 8;
1523
+ function segmentLabels(env, domain, area, geometry, paints, requests, warnings) {
1524
+ if (domain.columns.length < 2) return;
1525
+ let content = contentOf(domain, "segment", ["absolute"]);
1526
+ if (!content) return;
1527
+ let totalValueAlone = domain.columnsAdd && contentOf(domain, "grandTotal", ["absolute"])?.join() === "absolute", { labelFont, band, y0 } = area, shareAsked = content.includes("percent"), mixedSigns = [], unavailable = [], shareBasis = domain.cats.map((c, ci) => {
1528
+ if (!shareAsked || !domain.anyByCat[ci]) return 0;
1529
+ let name = c.label ?? c.id;
1530
+ if (domain.negBot[ci] < 0) mixedSigns.push(name);
1531
+ else if (domain.posTop[ci] <= 0 || isIncomplete(domain.columns.map((s) => s.vals[ci].v))) unavailable.push(name);
1532
+ else return domain.posTop[ci];
1533
+ return 0;
1534
+ });
1535
+ warnShareParts(warnings, mixedSigns, unavailable);
1536
+ let tooWide = !1, first = requests.length;
1537
+ for (let { s, si, ci, v, rect } of geometry.segments) {
1538
+ let c = domain.cats[ci], val = s.vals[ci], serFmt = s.format ? env.byExample(s.format) : domain.scaleFmtOf(s), share = shareBasis[ci] > 0 ? v / shareBasis[ci] * 100 : null, lines = composeLines(domain, content, { abs: v, isPct: val.isPct, share, shareText: domain.shareTexts.get(`${c.id}\0${s.id}`), format: val.format ?? s.format ?? domain.options.format }, c.label ?? c.id, s.label, serFmt), text = lines.join(" "), single = v !== 0 && onePartDrawn(domain.columns.map((column) => column.vals[ci].v)), printed = val.isPct || share !== null ? content : content.filter((part) => part !== "percent");
1539
+ if (typeof val.labelOverride == "string" && (text = val.labelOverride.replace(/\$\{value\}/g, text), lines = [text]), !text && val.labelOverride !== !1) continue;
1540
+ let tsize = linesSize(lines, labelFont, env.measure), fits = tsize.height + 2 <= rect.h && tsize.width + 4 <= band.bandwidth, sliver = env.density !== "full" && rect.h < SLIVER_MIN_H, hl = env.highlights.has(c.id) || env.highlights.has(s.id), priority = val.priority ?? PRIORITY.interior + Math.min(99, Math.abs(v)) + (hl ? PRIORITY.highlightBonus : 0);
1541
+ typeof val.labelOverride != "string" && val.labelOverride !== !1 && !sliver && !single && env.density !== "full" && tsize.width > rect.w && (tooWide = !0), requests.push({
1542
+ id: `segment:${s.id}:${c.id}`,
1543
+ kind: "segment",
1544
+ ...namesOnly(printed, val.labelOverride),
1545
+ // A label that prints more than the value (a name, a share) keeps its seat. An authored text
1546
+ // yields only to a total that carries it: one that prints the value alone, for this column's cell.
1547
+ ...single && printed.length === 1 && printed[0] === "absolute" && (typeof val.labelOverride != "string" || totalValueAlone && totalColumn(domain, ci) === s) ? { printedIn: `grandTotal:${c.id}` } : {},
1548
+ owner: { seriesId: s.id, categoryId: c.id },
1549
+ text,
1550
+ lines,
1551
+ ...lines.length > 1 ? { align: "middle" } : {},
1552
+ typeRole: "label",
1553
+ font: labelFont,
1554
+ priority,
1555
+ redundant: val.labelOverride === !1 || sliver,
1556
+ // A value prints inside its own segment or nowhere. Beside the column
1557
+ // the value would stand in the gap between two stacks, as near the next
1558
+ // one, with no leader at that distance. A value its segment cannot hold
1559
+ // is named in the note line (layout.ts), and so is a value that fits its
1560
+ // segment but loses its seat to another label.
1561
+ ...val.labelOverride !== !1 ? { noteText: `${s.label} ${text} (${noteName(c)})` } : {},
1562
+ candidates: insideSeats(stackSegmentCandidates(rect, tsize, fits, paints.inside(s, val, c, si), { baselineY: y0 }), rect, tsize.height).map((candidate) => ({ ...candidate, insidePaint: paints.cell(s, val, c, si), insidePattern: paints.pattern(s, val, c) }))
1563
+ });
1564
+ }
1565
+ if (tooWide) for (let request of requests.slice(first)) {
1566
+ let ci = domain.cats.findIndex((c) => c.id === request.owner.categoryId);
1567
+ typeof domain.columns.find((column) => column.id === request.owner.seriesId)?.vals[ci]?.labelOverride != "string" && (request.redundant = !0);
1568
+ }
1569
+ }
1570
+ var SEGMENT_EDGE_AIR = 3;
1571
+ function insideSeats(candidates, rect, labelH) {
1572
+ let inside = candidates.filter((candidate) => candidate.slot.startsWith("inside")), centre = inside.find((candidate) => candidate.slot === "insideCenter");
1573
+ if (!centre) return inside;
1574
+ let edges = [
1575
+ { ...centre, slot: "insideUpper", rect: { ...centre.rect, y: rect.y + SEGMENT_EDGE_AIR }, penalty: centre.penalty + 1 },
1576
+ { ...centre, slot: "insideLower", rect: { ...centre.rect, y: rect.y + rect.h - labelH - SEGMENT_EDGE_AIR }, penalty: centre.penalty + 1.5 }
1577
+ ].filter((seat) => Math.abs(seat.rect.y - centre.rect.y) >= 1 && seat.rect.y >= rect.y && seat.rect.y + labelH <= rect.y + rect.h);
1578
+ return [...inside, ...edges];
1579
+ }
1580
+ function totalColumn(domain, ci) {
1581
+ let populated = domain.columns.filter((column) => column.vals[ci].v !== null), drawn = populated.filter((column) => column.vals[ci].v !== 0);
1582
+ return populated.length === 1 ? populated[0] : drawn.length === 1 ? drawn[0] : void 0;
1583
+ }
1584
+ function grandTotalLabels(env, domain, area, paints, requests, lineYs, strokes = []) {
1585
+ let gtContent = domain.columns.length > 0 && domain.columnsAdd ? contentOf(domain, "grandTotal", ["absolute"]) : null;
1586
+ if (!gtContent) return;
1587
+ let { posTop, negBot } = domain, { y, band, strongFont } = area, authored = /* @__PURE__ */ new Set(), bare = /* @__PURE__ */ new Set(), linked = new Map(requests.flatMap((req) => req.printedIn ? [[req.printedIn, req.id]] : [])), valueAlone = gtContent.join() === "absolute", backLink = (id, words) => !words && valueAlone && linked.has(id) ? { printedIn: linked.get(id) } : {}, crossesRules = domain.averageMarkerId !== void 0 || (domain.options.annotations ?? []).some((annotation) => annotation.kind === "valueLine"), texts = domain.cats.map((c, ci) => {
1588
+ if (!domain.anyByCat[ci]) return null;
1589
+ let single = totalColumn(domain, ci), cell = single?.vals[ci], composed = composeText(domain, gtContent, { abs: domain.stackTotals[c.id], isPct: cell?.isPct ?? !1, format: cell?.format ?? single?.format ?? domain.options.format }, c.label ?? c.id, "", domain.fmt), override = cell?.labelOverride;
1590
+ return override === !1 ? null : (typeof override == "string" && authored.add(c.id), namesOnly(cell?.isPct ? gtContent : gtContent.filter((part) => part !== "percent"), override).printsFor && bare.add(c.id), (typeof override == "string" ? override.replace(/\$\{value\}/g, composed) : composed) || null);
1591
+ }), anatomyFont = domain.anatomy && domain.columns.length === 1 ? { ...strongFont } : void 0, insideFont = anatomyFont && texts.every((text) => text === null || env.measure(text, anatomyFont).width + 4 <= band.bandwidth) ? anatomyFont : void 0, toDateIds = insideFont ? /* @__PURE__ */ new Set() : toDateOnTotals(env, domain), toDate = domain.options.strings?.toDate ?? chartString(domain.options, "toDate"), wordsAt = (ci, text, font) => {
1592
+ let id = domain.cats[ci].id, words = toDateIds.has(id) ? toDate : !insideFont && domain.columnsAdd && domain.incompleteCats.has(id) && disclosuresShown(domain.options) ? domain.options.strings.incomplete : void 0;
1593
+ return words ? toDateLabel(text, font, words, env.theme, env.measure) : void 0;
1594
+ }, outerSeat = (font) => (text, ci) => {
1595
+ if (text === null) return null;
1596
+ let size = wordsAt(ci, text, font)?.size ?? env.measure(text, font), above = posTop[ci] > 0 || negBot[ci] === 0, edgeY = y(above ? posTop[ci] : negBot[ci]);
1597
+ return { x: band.center(ci) - size.width / 2, y: above ? edgeY - size.height - 4 : edgeY + 4, w: size.width, h: size.height };
1598
+ }, rowFont = !insideFont && valueRowCrowded(texts.map(outerSeat(strongFont))) ? stepDownFont(env.theme, strongFont, "label", domain.options.target, textScaleOf(domain.options)) : void 0, outerFont = rowFont ?? strongFont, thinned = !insideFont && domain.columns.length > 1 && valueRowCrowded(texts.map(outerSeat(outerFont))), shiftedTop = (ci) => {
1599
+ let above = posTop[ci] > 0 || negBot[ci] === 0, h = env.measure(texts[ci], outerFont).height;
1600
+ return above ? y(posTop[ci]) - 2 * h - 8 : y(negBot[ci]) + h + 8;
1601
+ }, apart = (ci) => [ci - 1, ci + 1].every((n) => {
1602
+ let other = texts[n];
1603
+ if (other == null) return !0;
1604
+ let own = env.measure(texts[ci], outerFont);
1605
+ return Math.abs(shiftedTop(n) - shiftedTop(ci)) >= own.height ? !0 : Math.abs(band.center(n) - band.center(ci)) - (env.measure(other, outerFont).width + own.width) / 2 >= SHIFTED_TOTAL_GAP;
1606
+ }), shiftedClear = (seat, ci) => strokes.length > 0 && apart(ci) && strokes.every((stroke) => !stroke.hits(seat.rect, STROKE_CLEAR2)) ? { ...seat, pad: 0 } : seat;
1607
+ domain.cats.forEach((c, ci) => {
1608
+ let text = texts[ci];
1609
+ if (text == null) return;
1610
+ let words = wordsAt(ci, text, outerFont), tsize = words?.size ?? env.measure(text, insideFont ?? outerFont), above = posTop[ci] > 0 || negBot[ci] === 0, edgeY = y(above ? posTop[ci] : negBot[ci]), cx = band.center(ci), at = (slot, ry, penalty) => ({ slot, rect: { x: Math.max(area.plot.x, Math.min(cx - tsize.width / 2, area.plot.x + area.plot.w - tsize.width)), y: ry, w: tsize.width, h: tsize.height }, penalty }), insideDepth = tsize.width + 4 > band.bandwidth ? 0 : (() => {
1611
+ let top = [...domain.columns].reverse().find((s) => {
1612
+ let v = s.vals[ci].v;
1613
+ return v !== null && (above ? v > 0 : v < 0);
1614
+ });
1615
+ return top === void 0 ? 0 : Math.abs(y(top.vals[ci].v) - y(0));
1616
+ })(), inside = (dy, slot) => insideDepth >= tsize.height + dy ? { ...at(slot, above ? edgeY + dy : edgeY - tsize.height - dy, 2), ...paints.top(ci, above) } : void 0, named = { noteText: `${domain.columns.length === 1 ? noteName(domain.columns[0]) : chartString(domain.options, "total")} ${text}${words ? ` ${words.lines[1]}` : ""} (${noteName(c)})` };
1617
+ if (insideFont && above && edgeY + 4 + tsize.height <= y(0)) {
1618
+ requests.push({
1619
+ id: `grandTotal:${c.id}`,
1620
+ ...named,
1621
+ kind: "grandTotal",
1622
+ ...authored.has(c.id) ? { keepWhenDense: !0 } : {},
1623
+ ...bare.has(c.id) ? { printsFor: [] } : {},
1624
+ ...backLink(`grandTotal:${c.id}`, void 0),
1625
+ owner: { categoryId: c.id },
1626
+ text,
1627
+ lines: [text],
1628
+ typeRole: "label",
1629
+ font: insideFont,
1630
+ fontStep: insideFont,
1631
+ priority: PRIORITY.grandTotal + (env.highlights.has(c.id) ? PRIORITY.highlightBonus : 0),
1632
+ candidates: [{ ...at("insideTop", edgeY + 4, 0), ...paints.top(ci, !0) }]
1633
+ });
1634
+ return;
1635
+ }
1636
+ requests.push({
1637
+ id: `grandTotal:${c.id}`,
1638
+ ...named,
1639
+ kind: "grandTotal",
1640
+ ...authored.has(c.id) ? { keepWhenDense: !0 } : {},
1641
+ ...bare.has(c.id) ? { printsFor: [] } : {},
1642
+ ...backLink(`grandTotal:${c.id}`, words),
1643
+ owner: { categoryId: c.id },
1644
+ text,
1645
+ lines: words?.lines ?? [text],
1646
+ ...words?.request,
1647
+ typeRole: "label",
1648
+ font: outerFont,
1649
+ ...rowFont ? { fontStep: rowFont } : {},
1650
+ ...thinned && ci % 2 !== (domain.cats.length - 1) % 2 && !env.highlights.has(c.id) ? { redundant: !0, suppressedAs: "density", owed: !0 } : {},
1651
+ priority: PRIORITY.grandTotal + (env.highlights.has(c.id) ? PRIORITY.highlightBonus : 0),
1652
+ candidates: nearestOwnMarkFirst(
1653
+ [
1654
+ // An average marker across this seat does not move the total: it
1655
+ // crosses the rule on a halo, as on column.
1656
+ { ...at(above ? "aboveStack" : "belowStack", above ? edgeY - tsize.height - 4 : edgeY + 4, 0), ...crossesRules ? { overRules: !0 } : {} },
1657
+ { ...shiftedClear(at(above ? "aboveStackShifted" : "belowStackShifted", above ? edgeY - 2 * tsize.height - 8 : edgeY + tsize.height + 8, 1), ci), ...crossesRules ? { overRules: !0 } : {} },
1658
+ // Type steps: a line that rises from this column's top runs right of its centre;
1659
+ // the total then stands left of the line's start, level with its usual seat (pareto at 320: '120').
1660
+ // Only the first column (left of any other the total would stand over its neighbour), and only
1661
+ // one too narrow to hold its total inside.
1662
+ ...ci === 0 && tsize.width + 4 > band.bandwidth && strokes.length > 0 && above && cx - LEFT_SEAT_AIR - tsize.width >= LEFT_SEAT_MIN_X ? [{ slot: "aboveStackLeft", rect: { x: cx - LEFT_SEAT_AIR - tsize.width, y: edgeY - tsize.height - 4, w: tsize.width, h: tsize.height }, penalty: 2 }] : []
1663
+ ],
1664
+ edgeY,
1665
+ lineYs(ci),
1666
+ inside(8, "insideEnd"),
1667
+ domain.columns.length > 1,
1668
+ // Last of all, one step further in: a line marker just inside the column top blocks the inside end by a fraction of a pixel.
1669
+ inside(12, "insideEndLowered")
1670
+ )
1671
+ });
1672
+ });
1673
+ }
1674
+ var LEFT_SEAT_AIR = 6, LEFT_SEAT_MIN_X = 8;
1675
+ function referenceLabels(env, domain, area, requests) {
1676
+ let content = contentOf(domain, "tick", ["absolute", "series"]);
1677
+ if (!content) return;
1678
+ let { band, y, tickFont } = area, marker = domain.options.referenceStyle === "marker";
1679
+ for (let s of domain.refs) domain.cats.forEach((c, ci) => {
1680
+ let val = s.vals[ci];
1681
+ if (val.v === null) return;
1682
+ let text = composeText(domain, content, { abs: val.v, isPct: val.isPct, format: val.format ?? s.format ?? domain.options.format }, c.label ?? c.id, s.label, s.format ? formatterFromExample(s.format, domain.options.locale?.language) : domain.fmt), { width: w, height: h } = env.measure(text, tickFont), ry = y(val.v), seat = (slot, x, top, penalty) => ({ slot, rect: { x, y: top, w, h }, penalty }), cx = band.center(ci), right = band.position(ci) + band.bandwidth + 5;
1683
+ requests.push({
1684
+ id: `tick:${s.id}:${c.id}`,
1685
+ kind: "tick",
1686
+ owner: { seriesId: s.id, categoryId: c.id },
1687
+ text,
1688
+ lines: [text],
1689
+ typeRole: "label",
1690
+ font: tickFont,
1691
+ priority: PRIORITY.reference,
1692
+ candidates: [
1693
+ ...marker ? [seat("rightOfMarker", cx + REFERENCE_MARKER_R + 4, ry - h / 2, 0), seat("leftOfMarker", cx - REFERENCE_MARKER_R - 4 - w, ry - h / 2, 0.5)] : [],
1694
+ seat("rightOfTick", right, ry - h / 2, 1),
1695
+ seat("rightOfTickAbove", right, ry - h - 4, 2),
1696
+ seat("rightOfTickBelow", right, ry + 4, 3),
1697
+ seat("leftOfTick", band.position(ci) - 7 - w, ry - h / 2, 4),
1698
+ // Where the gaps are taken, on the column above or below its tick, on a halo.
1699
+ { ...seat("aboveTickOnColumn", cx - w / 2, ry - h - 3, 5), overColumns: !0, needsBacking: !0 },
1700
+ { ...seat("belowTickOnColumn", cx - w / 2, ry + 3, 6), overColumns: !0, needsBacking: !0 }
1701
+ ]
1702
+ });
1703
+ });
1704
+ }
1705
+ function nearestOwnMarkFirst(outer, edgeY, lineYs, inside, tieIsOwn, insideLast) {
1706
+ let own = (c) => {
1707
+ let cy = c.rect.y + c.rect.h / 2;
1708
+ return lineYs.every((ly) => tieIsOwn && Math.abs(ly - edgeY) < 0.5 || Math.abs(cy - ly) > Math.abs(cy - edgeY));
1709
+ };
1710
+ return [
1711
+ ...outer.filter(own),
1712
+ ...inside ? [inside] : [],
1713
+ ...outer.filter((c) => !own(c)).map((c) => ({ ...c, lastResort: !0 })),
1714
+ ...insideLast ? [insideLast] : []
1715
+ ].map((c, penalty) => ({ ...c, penalty }));
1716
+ }
1717
+ function categoryLabels(domain, area, requests) {
1718
+ let { catPlan, band, gtH, dateNumericTicks } = area, rotated = catPlan.rotation !== 0;
1719
+ domain.cats.forEach((c, ci) => {
1720
+ let info = catPlan.infos[ci], at = (slot, ry, penalty) => ({ slot, rect: { x: catPlan.x(ci), y: ry, w: info.w, h: info.h }, penalty });
1721
+ requests.push({
1722
+ id: `category:${c.id}`,
1723
+ kind: "category",
1724
+ owner: { categoryId: c.id },
1725
+ text: c.label ?? c.id,
1726
+ lines: info.lines,
1727
+ ...categoryLineAlign(catPlan, ci),
1728
+ ...info.title !== void 0 ? { title: info.title } : {},
1729
+ typeRole: catPlan.typeRole,
1730
+ font: catPlan.font,
1731
+ priority: PRIORITY.endpoint,
1732
+ // A stride-hidden date label is the row's decision (one info lint), not a loss.
1733
+ redundant: !catPlan.keep[ci],
1734
+ ...rotated ? { rotate: catPlan.rotation === 90 ? -90 : -45 } : {},
1735
+ 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(8, info.h * Math.SQRT1_2 / 2 + ROTATED_NAME_AIR), info.h), penalty: 0 }] : [
1736
+ at("below", area.catRowY + 6, 0),
1737
+ // A date/numeric tick row is ONE row, never the stagger tier.
1738
+ ...dateNumericTicks ? [] : [at("belowShifted", area.catRowY + 6 + gtH + 4, 1)]
1739
+ ]
1740
+ });
1741
+ }), pushAll(requests, yearRowRequests(catPlan, area.catRowY + 6));
1742
+ }
1743
+ function linePointLabels(env, domain, area, geometry, requests, strokes, fills) {
1744
+ let { labelFont, frame } = area, labelH = env.measure("0", labelFont).height, mode = comboValueLabels(domain.options, domain.anatomy, domain.cats.length), content = mode === "all" || mode === "extremes" ? contentOf(domain, "point", ["absolute"]) : null, flaggedContent = contentOf(domain, "point", ["absolute"]), anomaly = domain.anomaly, flaggedAt = (s, ci) => anomaly?.seriesId === s.id && anomaly.model.flagByCategory.has(domain.cats[ci].id), strokesOf = new Map(geometry.plans.map((plan) => [plan.s.id, plan.runs.filter((run) => run.length > 0).map((run) => drawnStroke(run, plan.interpolation))])), queriesOf = new Map([...strokesOf.values()].flat().map((stroke) => [stroke, preparePolyline(stroke)]));
1745
+ for (let { s, pts } of geometry.plans) {
1746
+ let own = strokesOf.get(s.id), others = [...strokesOf].flatMap(([id, runs]) => id === s.id ? [] : runs), ownQueries = own.map((stroke) => queriesOf.get(stroke)), otherQueries = others.map((stroke) => queriesOf.get(stroke)), values = pts.map((point) => s.vals[point.ci].v), [min, max] = [minOf(values), maxOf(values)];
1747
+ for (let point of pts) {
1748
+ if (area.first.get(s.id)?.ci === point.ci || area.last.get(s.id)?.ci === point.ci) continue;
1749
+ let cell = s.vals[point.ci], override = cell.labelOverride, extreme = cell.v === min || cell.v === max, flagged = flaggedContent !== null && override === void 0 && flaggedAt(s, point.ci), engine = content !== null && override === void 0 && (mode === "all" || extreme) || flagged;
1750
+ if (typeof override != "string" && !engine) continue;
1751
+ let category = domain.cats[point.ci], serFmt = s.format ? env.byExample(s.format) : domain.scaleFmtOf(s), text = typeof override == "string" ? override.replace(/\$\{value\}/g, composeText(domain, ["absolute"], { abs: cell.v ?? 0, isPct: cell.isPct, format: domain.explicitFormatOf(s, cell) }, category.label ?? category.id, s.label, serFmt)) : composeText(domain, content ?? flaggedContent, { abs: cell.v, isPct: cell.isPct, format: domain.explicitFormatOf(s, cell) }, category.label ?? category.id, s.label, serFmt);
1752
+ if (!text) continue;
1753
+ let size = env.measure(text, labelFont), below = sideAwayFrom(point, others) === "below", centeredX = Math.max(frame.plot.x, Math.min(point.x - size.width / 2, frame.plot.x + frame.plot.w - size.width)), aboveY = point.y - labelH - ABOVE_POINT_GAP, lift = domain.anatomy ? clearLift({ x: centeredX, y: aboveY, w: size.width, h: labelH }, strokes, labelH) : void 0, free = [
1754
+ { slot: "above", y: aboveY, penalty: below ? 1 : 0 },
1755
+ ...lift ? [{ slot: "aboveLifted", y: aboveY - lift, penalty: (below ? 1 : 0) + 0.25 }] : [],
1756
+ { slot: "below", y: point.y + 5, penalty: below ? 0 : 1 },
1757
+ { slot: "leftRaised", x: point.x - 2.75 - 5 - size.width, y: point.y - labelH / 2 - 8, penalty: 1.5 },
1758
+ { slot: "rightRaised", x: point.x + 2.75 + 5, y: point.y - labelH / 2 - 8, penalty: 1.5 },
1759
+ { slot: "aboveShifted", y: point.y - 2 * labelH - 9, penalty: 2 }
1760
+ ].sort((a, b) => a.penalty - b.penalty).flatMap(({ slot, x = centeredX, y, penalty }) => x >= frame.plot.x && x + size.width <= frame.plot.x + frame.plot.w && y >= frame.plot.y && y + labelH <= frame.plot.y + frame.plot.h ? [{ slot, rect: { x, y, w: size.width, h: labelH }, penalty }] : []), clear = nearerOwnLine(clearOfStrokes(free, strokes), ownQueries, otherQueries), slots = domain.columns.length > 0 ? [...clear, ...clear.map((candidate) => ({ ...candidate, slot: `${candidate.slot}OnColumn`, penalty: candidate.penalty + 10, needsBacking: !0, overColumns: !0 }))] : clear;
1761
+ requests.push({
1762
+ id: `point:${s.id}:${category.id}`,
1763
+ kind: "point",
1764
+ role: composedTextRole(text),
1765
+ owner: { seriesId: s.id, categoryId: category.id },
1766
+ text,
1767
+ lines: [text],
1768
+ typeRole: "label",
1769
+ font: labelFont,
1770
+ priority: cell.priority ?? (engine && extreme ? PRIORITY.extreme : PRIORITY.interior) + (env.highlights.has(s.id) || env.highlights.has(category.id) ? PRIORITY.highlightBonus : 0),
1771
+ candidates: withinOneFill(slots, fills)
1772
+ });
1773
+ }
1774
+ }
1775
+ }
1776
+ function growthLabels(env, area, requests) {
1777
+ let growth = area.growth;
1778
+ if (!growth) return;
1779
+ let valueH = env.measure("0", growth.valueFont).height, nameH = env.measure("0", growth.nameFont).height, blockH = growth.oneLine ? valueH : valueH + 2 + nameH, placed = growth.items.map((item) => ({ item, y: (item.axis === "secondary" ? area.y2 : area.y)(item.last) - valueH / 2 })).sort((a, b) => a.y - b.y), floor = -1 / 0;
1780
+ for (let entry of placed)
1781
+ entry.y = Math.max(entry.y, floor), floor = entry.y + blockH + 4;
1782
+ for (let { item, y } of placed) {
1783
+ let text = growth.oneLine ? growthLine(item) : item.text, valueW = env.measure(text, growth.valueFont).width;
1784
+ requests.push({
1785
+ // A figure with its name is prose; the figure alone a value.
1786
+ id: `growth:${item.seriesId}`,
1787
+ kind: "annotation",
1788
+ role: growth.oneLine ? composedTextRole(text) : "value",
1789
+ owner: { seriesId: item.seriesId },
1790
+ text,
1791
+ lines: [text],
1792
+ typeRole: "label",
1793
+ font: growth.valueFont,
1794
+ fontStep: growth.valueFont,
1795
+ priority: PRIORITY.grandTotal,
1796
+ candidates: [{ slot: "growth", rect: { x: growth.x, y, w: valueW, h: valueH }, penalty: 0 }]
1797
+ });
1798
+ let name = item.textPaint ? item.short : item.name;
1799
+ if (growth.oneLine || !name) continue;
1800
+ let nameW = env.measure(name, growth.nameFont).width;
1801
+ requests.push({
1802
+ id: `growth:${item.seriesId}:name`,
1803
+ kind: "annotation",
1804
+ owner: { seriesId: item.seriesId },
1805
+ text: name,
1806
+ lines: [name],
1807
+ typeRole: "label",
1808
+ font: growth.nameFont,
1809
+ fontStep: growth.nameFont,
1810
+ priority: PRIORITY.grandTotal,
1811
+ candidates: [{ slot: "growthName", rect: { x: growth.x, y: y + valueH + 2, w: nameW, h: nameH }, penalty: 0 }]
1812
+ });
1813
+ }
1814
+ }
1815
+ function applyGrowthInk(labels, area) {
1816
+ let items = area.growth?.items ?? [], twinOf = new Map(items.flatMap((item) => item.textPaint ? [[item.seriesId, item.textPaint]] : [])), inkOf = new Map(items.map((item) => [`growth:${item.seriesId}`, item.ink]));
1817
+ for (let label of labels) {
1818
+ if (!label.id.startsWith("growth:")) continue;
1819
+ let twin = label.owner?.seriesId !== void 0 ? twinOf.get(label.owner.seriesId) : void 0;
1820
+ label.ink = twin ?? { token: inkOf.get(label.id) ?? "inkMuted" };
1821
+ }
1822
+ }
1823
+ function planComboLabels(env, domain, area, geometry, paints, warnings) {
1824
+ let { frame, labelFont, band } = area, rightAxisActive = domain.rightTicks.length > 0, requests = anchorComboAxisTitles(area.axisTitles, {
1825
+ left: Number.isFinite(geometry.leftTickX) ? geometry.leftTickX : void 0,
1826
+ right: rightAxisActive ? area.rightTickX + area.rightAxisReserve - 10 : void 0,
1827
+ rightStart: rightAxisActive ? area.rightTickX : void 0
1828
+ }, frame.plot);
1829
+ segmentLabels(env, domain, area, geometry, paints, requests, warnings);
1830
+ let strokes = comboStrokes(geometry).map(preparePolyline), lineYsByCat;
1831
+ grandTotalLabels(env, domain, area, paints, requests, (ci) => {
1832
+ if (!lineYsByCat) {
1833
+ lineYsByCat = domain.cats.map(() => []);
1834
+ for (let plan of geometry.plans) for (let point of plan.pts) lineYsByCat[point.ci].push(point.y);
1835
+ }
1836
+ return lineYsByCat[ci];
1837
+ }, strokes);
1838
+ let fills = geometry.segments.map((segment) => segment.rect), segmentSeats = requests.flatMap((r) => r.kind === "segment" && !r.redundant && r.candidates[0]?.slot === "insideCenter" ? [r.candidates[0].rect] : []), totalSeats = requests.flatMap((r) => r.kind === "grandTotal" && !r.redundant && r.candidates[0] ? [r.candidates[0].rect] : []);
1839
+ for (let { s, pts } of geometry.plans)
1840
+ for (let endpoint of [
1841
+ { point: pts[pts.length - 1], end: area.last.get(s.id), first: !1 },
1842
+ { point: pts[0], end: area.first.get(s.id), first: !0 }
1843
+ ])
1844
+ endpoint.end !== void 0 && requests.push(comboEndpointRequest({
1845
+ s,
1846
+ last: endpoint.point,
1847
+ lastCat: domain.cats[endpoint.point.ci],
1848
+ text: endpoint.end.text,
1849
+ labelFont,
1850
+ measure: env.measure,
1851
+ MARKER_R: 2.75,
1852
+ hasColumns: domain.columns.length > 0,
1853
+ band,
1854
+ adjacentAxisActive: endpoint.first ? domain.showPrimaryAxis : rightAxisActive,
1855
+ highlights: env.highlights,
1856
+ first: endpoint.first,
1857
+ firstBelowTotals: domain.options[FIRST_END_BELOW_TOTALS] === !0,
1858
+ sharesOnColumns: domain.options[FIRST_END_BELOW_TOTALS] === !0,
1859
+ allowOnColumn: !domain.lineBand,
1860
+ bounds: s.kind === "line" && domain.options[FIRST_END_BELOW_TOTALS] !== !0 ? { x0: area.plot.x, x1: area.plot.x + area.plot.w, y0: area.plot.y, y1: area.plot.y + area.plot.h } : { x0: frame.plot.x, x1: frame.plot.x + frame.plot.w },
1861
+ strokes,
1862
+ fills,
1863
+ segmentSeats,
1864
+ totalSeats,
1865
+ anatomy: domain.anatomy
1866
+ }));
1867
+ return linePointLabels(env, domain, area, geometry, requests, strokes, fills), seatValuesOnGround(requests, geometry.areaGrounds, 2, (ground) => paints.css(ground.paint), !shadesFills(domain.options.annotations ?? []), ["point", "grandTotal"]), referenceLabels(env, domain, area, requests), growthLabels(env, area, requests), area.showCatTickRow && categoryLabels(domain, area, requests), rankValueLabels(
1868
+ requests,
1869
+ (request) => request.kind === "grandTotal" && request.owner.categoryId !== void 0 ? domain.stackTotals[request.owner.categoryId] : void 0,
1870
+ env.density,
1871
+ domain.options.labelPlacements,
1872
+ { categories: domain.cats.length, last: domain.options.mode === "compact" ? domain.cats.at(-1)?.id : void 0, pitch: band.step, orientation: "vertical", measure: env.measure }
1873
+ ), requests;
1874
+ }
1875
+
1876
+ // src/core/charts/combo/marks.ts
1877
+ function comboAxes(ctx) {
1878
+ let { env, domain, area, g } = ctx, { plot, y, y0 } = area, tickFont = secondaryFont(env.theme), { nodes, claims } = g, primaryDrawn;
1879
+ if (domain.showPrimaryAxis) {
1880
+ let axisResult = layoutValueAxis(
1881
+ { scale: y, plot, orient: "y", gridlines: domain.options.valueAxis?.gridlines ?? domain.anatomy, format: domain.fmt, formatSpec: domain.valueSpec, theme: env.theme, measure: env.measure, ticks: domain.pticks },
1882
+ claims
1883
+ );
1884
+ pushAll(nodes, axisResult.nodes), g.axes.push(axisResult.axis), primaryDrawn = new Set(axisResult.axis.ticks.flatMap((t) => typeof t.at == "number" ? [t.at] : [])), g.leftTickX = minOf(axisResult.nodes.map((node) => node.t === "text" ? node.x : 1 / 0));
1885
+ }
1886
+ if (domain.rightTicks.length > 0) {
1887
+ let axis2 = { axis: "y", ticks: [] }, replacing = domain.secondaryDomain ? (domain.options.annotations ?? []).filter((a) => a.kind !== "event").flatMap((a, n) => a.kind === "valueLine" && a.axis === "secondary" && (a.side ?? "right") === "right" && typeof a.value == "number" && typeof a.label == "string" ? [{ id: defaultAnnotationId(a, n), value: a.value, text: a.label }] : []) : [], synced = domain.rightTicks.length === domain.pticks.length && domain.rightTicks.every(({ at }, i) => Math.abs((domain.secondaryDomain ? area.y2(at) : y(domain.pticks[i])) - y(domain.pticks[i])) < 0.5), lockstep = primaryDrawn !== void 0 && synced, keep = lockstep ? domain.rightTicks.map((_, i) => primaryDrawn.has(domain.pticks[i])) : sweepHide(domain.rightTicks.map(({ at, text }, i) => {
1888
+ let h = env.measure(text, tickFont).height;
1889
+ return { start: (domain.secondaryDomain ? area.y2(at) : y(domain.pticks[i])) - h / 2, size: h, priority: i === 0 || i === domain.rightTicks.length - 1 ? 1 : 0 };
1890
+ }), 4);
1891
+ if (!lockstep) {
1892
+ if (domain.secondaryDomain && !domain.options.secondaryAxis?.domain && domain.showPrimaryAxis)
1893
+ keep = domain.rightTicks.map(({ at }) => g.axes[0].ticks.some((tick) => Math.abs(tick.pos - area.y2(at)) < 0.01));
1894
+ else if (!domain.options.secondaryAxis || !domain.options.secondaryAxis.domain)
1895
+ for (let stride = 1; stride <= keep.length; stride++) {
1896
+ let selected = keep.map((_, i) => i % stride === 0), rows = domain.rightTicks.filter((_, i) => selected[i]).map(({ at, text }, i) => {
1897
+ let pos = domain.secondaryDomain ? area.y2(at) : y(domain.pticks[i * stride]), h = env.measure(text, tickFont).height;
1898
+ return { start: pos - h / 2, size: h, priority: 0 };
1899
+ });
1900
+ if (sweepHide(rows, 4).every(Boolean)) {
1901
+ keep = selected;
1902
+ break;
1903
+ }
1904
+ }
1905
+ }
1906
+ domain.rightTicks.forEach(({ at: tv, text }, i) => {
1907
+ if (!keep[i]) return;
1908
+ let pos = domain.secondaryDomain ? area.y2(tv) : y(domain.pticks[i]), tsize = env.measure(text, tickFont), rect = { x: area.rightTickX, y: pos - tsize.height / 2, w: tsize.width, h: tsize.height }, labelId = `axis:y2:tick:${i}`;
1909
+ nodes.push({ t: "text", id: labelId, x: rect.x, y: rect.y, lines: [text], align: "start", typeRole: "secondary", font: tickFont, ink: { token: "inkMuted" }, owner: {}, part: "tick" });
1910
+ let by = replacing.find((r) => r.text === text && Math.abs(r.value - tv) < 1e-9);
1911
+ by ? (claims.claim(rect, "annotation", { annotationId: by.id }), g.yieldingTicks.push({ labelId, annotationId: by.id, rect })) : claims.claim(rect, "axis", {}), axis2.ticks.push({ at: tv, pos, labelId });
1912
+ }), g.axes.push(axis2);
1913
+ }
1914
+ nodes.push({ t: "line", id: "axis:baseline", x1: plot.x, y1: y0, x2: plot.x + plot.w, y2: y0, stroke: { token: "axis" }, width: strokeToken(env.theme, "rule"), owner: {}, part: "baseline" }), claims.claim({ x: plot.x, y: y0 - 0.5, w: plot.w, h: 1 }, "axis", {});
1915
+ }
1916
+ function columnMarks(ctx) {
1917
+ let { env, domain, area, paints, g } = ctx, { cats, columns, refs } = domain, { band, y } = area, { nodes, claims } = g;
1918
+ if (columns.length > 0) {
1919
+ cats.forEach((c, ci) => {
1920
+ let bx = band.position(ci), bw = band.bandwidth, pos = 0, neg = 0, segs = [];
1921
+ columns.forEach((s, si) => {
1922
+ let val = s.vals[ci], v = val.v;
1923
+ if (v === null) return;
1924
+ let v0 = v >= 0 ? pos : neg, v1 = v0 + v;
1925
+ if (v >= 0 ? pos = v1 : neg = v1, g.segEdges.set(sk(s.id, c.id), { v0, v1, v }), v === 0) return;
1926
+ let rect = { x: bx, y: y(Math.max(v0, v1)), w: bw, h: Math.max(Math.abs(y(v0) - y(v1)), 0.5) }, nodeId = `mark:${s.id}:${c.id}`, cellFill = paints.cell(s, val, c, si), cellPat = paints.pattern(s, val, c), washed = "tint" in cellFill && cellFill.tint !== void 0, cellSep = cellPat || washed || markOutlineOff(cellFill, env.theme) ? void 0 : segmentSeparationStroke(cellFill, env.theme.color.background, env.theme);
1927
+ nodes.push({
1928
+ t: "rect",
1929
+ id: nodeId,
1930
+ rect,
1931
+ fill: cellFill,
1932
+ pattern: cellPat,
1933
+ ...cellSep ?? {},
1934
+ ...washed ? {} : { separation: { fillStep: !0, fill: cellFill, backing: { token: "background" }, pattern: cellPat } },
1935
+ owner: { seriesId: s.id, categoryId: c.id },
1936
+ part: "segment",
1937
+ display: { value: val.format ?? s.format ?? domain.options.format ? env.byExample(val.format ?? s.format ?? domain.options.format)(v) : val.isPct ? domain.pctFmt(v) : domain.fmt(v) }
1938
+ }), claims.claim(rect, "mark", { seriesId: s.id, categoryId: c.id }, "segment"), segs.push({ seriesId: s.id, rect, nodeId }), g.segments.push({ s, si, ci, v, rect });
1939
+ });
1940
+ let stackTop = y(pos), stackBot = y(neg);
1941
+ g.marks.columns.push({ categoryId: c.id, rect: { x: bx, y: stackTop, w: bw, h: Math.max(stackBot - stackTop, 0.5) }, segments: segs });
1942
+ });
1943
+ let { plot, y0 } = area;
1944
+ nodes.push({ t: "line", id: "axis:baseline:over", x1: plot.x, y1: y0, x2: plot.x + plot.w, y2: y0, stroke: { token: "axis" }, width: strokeToken(env.theme, "rule"), owner: {}, part: "baseline" });
1945
+ }
1946
+ let style = domain.options.referenceStyle ?? "tick";
1947
+ for (let s of refs)
1948
+ cats.forEach((c, ci) => {
1949
+ let v = s.vals[ci].v;
1950
+ if (v === null) return;
1951
+ let ry = y(v), bx = band.position(ci), bw = band.bandwidth, owner = { seriesId: s.id, categoryId: c.id }, id = `ref:${s.id}:${c.id}`, display = { value: s.vals[ci].format ?? s.format ?? domain.options.format ? formatterFromExample(s.vals[ci].format ?? s.format ?? domain.options.format, domain.options.locale?.language)(v) : s.vals[ci].isPct ? domain.pctFmt(v) : domain.fmt(v) };
1952
+ if (style === "marker") {
1953
+ let cx = band.center(ci);
1954
+ nodes.push({ t: "circle", id, cx, cy: ry, ...referenceMarkerPaint(env.theme, paints.ref(s)), owner, part: "referenceMarker", display });
1955
+ let mr = REFERENCE_MARKER_R + 1;
1956
+ claims.claim({ x: cx - mr, y: ry - mr, w: mr * 2, h: mr * 2 }, "mark", owner);
1957
+ return;
1958
+ }
1959
+ let tick = referenceTickGeometry("vertical", bx, ry, -2, bw + 2), tickWidth = style === "line" ? strokeToken(env.theme, "rule") : domain.options.referenceTick?.width ?? strokeToken(env.theme, "rule");
1960
+ nodes.push(referenceCasing(id, tick.line, tickWidth, owner)), nodes.push({
1961
+ t: "line",
1962
+ id,
1963
+ ...tick.line,
1964
+ stroke: paints.ref(s),
1965
+ width: tickWidth,
1966
+ ...style === "line" ? { dash: dashToken(env.theme, "dotted"), lineCap: "round" } : {},
1967
+ owner,
1968
+ part: style === "line" ? "referenceLine" : "referenceTick",
1969
+ display
1970
+ }), claims.claim(tick.claim, "mark", owner, style === "line" ? "referenceLine" : void 0);
1971
+ });
1972
+ }
1973
+ function pathFor2(points, interpolation, curve = []) {
1974
+ return interpolation === "monotone" ? curvePathFromSegments(curve) : pathFor(points, interpolation);
1975
+ }
1976
+ function linePlans(domain, area) {
1977
+ let { cats, secondaryActive } = domain;
1978
+ return domain.lines.map((s, li) => {
1979
+ let yFor = s.axis === "secondary" && secondaryActive ? area.y2 : area.y, pts = [], runs = [], run = [];
1980
+ cats.forEach((_c, ci) => {
1981
+ let v = s.vals[ci].v;
1982
+ if (v === null) {
1983
+ !s.interpolateGaps && run.length > 0 && (runs.push(run), run = []);
1984
+ return;
1985
+ }
1986
+ let p = { ci, x: area.band.center(ci), y: yFor(v) };
1987
+ pts.push(p), run.push(p);
1988
+ }), run.length > 0 && runs.push(run);
1989
+ let interpolation = domain.interpolationFor(s), drawableRuns = s.interpolateGaps ? [pts] : runs;
1990
+ return {
1991
+ s,
1992
+ li,
1993
+ interpolation,
1994
+ pts,
1995
+ runs: drawableRuns,
1996
+ curveRuns: interpolation === "monotone" ? drawableRuns.map((drawableRun) => monotoneSegments(drawableRun)) : []
1997
+ };
1998
+ }).filter((p) => p.pts.length > 0);
1999
+ }
2000
+ function areaMarks(ctx, plans) {
2001
+ let { domain, area, paints, g } = ctx, areaIds = /* @__PURE__ */ new Map();
2002
+ for (let plan of plans) {
2003
+ if (plan.s.kind !== "area") continue;
2004
+ let y0 = plan.s.axis === "secondary" && domain.secondaryActive ? area.y2(0) : area.y0, d = plan.runs.filter((r) => r.length > 0).map((r, runIndex) => {
2005
+ let top = pathFor2(r, plan.interpolation, plan.curveRuns[runIndex]), first = r[0], last = r[r.length - 1];
2006
+ return `${top}L${round2(last.x)} ${round2(y0)}L${round2(first.x)} ${round2(y0)}Z`;
2007
+ }).join(""), areaNodeId = `mark:area:${plan.s.id}`;
2008
+ g.nodes.push({ t: "path", id: areaNodeId, d, fill: paints.line(plan.s, plan.li), owner: { seriesId: plan.s.id }, part: "area" });
2009
+ for (let r of plan.runs)
2010
+ r.length > 1 && g.areaGrounds.push({ seriesId: plan.s.id, ...screenEdges(drawnStroke(r, plan.interpolation), [{ x: r[0].x, y: y0 }, { x: r[r.length - 1].x, y: y0 }]), paint: paints.line(plan.s, plan.li) });
2011
+ for (let r of plan.runs)
2012
+ for (let i = 0; i + 1 < r.length; i++) {
2013
+ let a = r[i], b = r[i + 1], top = Math.min(a.y, b.y, y0), bot = Math.max(a.y, b.y, y0), half = (b.x - a.x) / 2;
2014
+ for (let [x, ci] of [[a.x, a.ci], [a.x + half, b.ci]])
2015
+ g.claims.claim({ x, y: top, w: half, h: Math.max(bot - top, 3) }, "mark", { seriesId: plan.s.id, categoryId: domain.cats[ci].id }, AREA_FILL_PART);
2016
+ }
2017
+ areaIds.set(plan, areaNodeId);
2018
+ }
2019
+ return areaIds;
2020
+ }
2021
+ function claimLine(claims, plan, catId) {
2022
+ let { s, runs, interpolation } = plan;
2023
+ for (let r of runs)
2024
+ for (let i = 0; i + 1 < r.length; i++) {
2025
+ let a = r[i], b = r[i + 1], owner = { seriesId: s.id, categoryId: catId(a.ci) };
2026
+ if (interpolation === "monotone") {
2027
+ claims.claim({ x: a.x, y: Math.min(a.y, b.y) - 1.5, w: b.x - a.x, h: Math.abs(b.y - a.y) + 3 }, "mark", owner);
2028
+ continue;
2029
+ }
2030
+ let claimPoints = interpolation === "linear" ? [a, b] : [a, interpolation === "step-after" ? { ci: a.ci, x: b.x, y: a.y } : { ci: a.ci, x: a.x, y: b.y }, b];
2031
+ for (let pair = 0; pair + 1 < claimPoints.length; pair++) {
2032
+ let from = claimPoints[pair], to = claimPoints[pair + 1], slices = 6;
2033
+ for (let k = 0; k < slices; k++) {
2034
+ let t0 = k / slices, t1 = (k + 1) / slices, sy0 = from.y + (to.y - from.y) * t0, sy1 = from.y + (to.y - from.y) * t1;
2035
+ claims.claim(
2036
+ {
2037
+ x: Math.min(from.x + (to.x - from.x) * t0, from.x + (to.x - from.x) * t1),
2038
+ y: Math.min(sy0, sy1) - 1.5,
2039
+ w: Math.max(Math.abs((to.x - from.x) * 1 / slices), 1),
2040
+ h: Math.abs(sy1 - sy0) + 3
2041
+ },
2042
+ "mark",
2043
+ owner
2044
+ );
2045
+ }
2046
+ }
2047
+ }
2048
+ }
2049
+ var ANATOMY_DOT_R = 3;
2050
+ function latestPointRing(theme, g, s, point, cats) {
2051
+ if (point === void 0) return;
2052
+ let owner = { seriesId: s.id, categoryId: cats[point.ci].id };
2053
+ g.nodes.push({ t: "circle", id: `latest-ring:${s.id}`, cx: point.x, cy: point.y, r: 4.5, fill: { token: "background" }, stroke: { token: "highlight" }, strokeWidth: strokeToken(theme, "mark"), owner, part: "marker" }), g.nodes.push({ t: "circle", id: `latest-dot:${s.id}`, cx: point.x, cy: point.y, r: 2, fill: { token: "markInk" }, owner, part: "marker" }), g.claims.claim({ x: point.x - 4.5, y: point.y - 4.5, w: 9, h: 9 }, "mark", owner);
2054
+ }
2055
+ function ringedSeries(plans) {
2056
+ let lines = plans.filter((p) => p.s.kind === "line");
2057
+ return (lines.find((p) => p.s.scenario === void 0 || p.s.scenario === "AC") ?? lines[0])?.s.id;
2058
+ }
2059
+ function lineMark(ctx, plan, areaNodeId, ringed) {
2060
+ let { env, domain, paints, g } = ctx, { s, li, pts, runs, interpolation } = plan, { cats } = domain, paint = paints.line(s, li), solidRuns = [], forecastRuns = [];
2061
+ for (let [runIndex, run] of runs.entries()) {
2062
+ let solidCurve = plan.curveRuns[runIndex] ?? [], forecastCurve = [], fcStart = s.scenario === "FC" ? 0 : run.findIndex((point) => s.vals[point.ci].scenario === "FC");
2063
+ fcStart === -1 ? solidRuns.push({ points: run, curve: solidCurve }) : fcStart === 0 ? forecastRuns.push({ points: run, curve: solidCurve }) : (interpolation === "monotone" && ([solidCurve, forecastCurve] = splitCurveSegmentsAtX(solidCurve, run[fcStart - 1].x)), solidRuns.push({ points: run.slice(0, fcStart), curve: solidCurve }), forecastRuns.push({ points: run.slice(fcStart - 1), curve: forecastCurve }));
2064
+ }
2065
+ let drawable = (list) => list.filter((run) => interpolation === "monotone" ? run.curve.length > 0 : run.points.length > 1).map((run) => pathFor2(run.points, interpolation, run.curve)).join(""), d = drawable(solidRuns), fcD = drawable(forecastRuns), nodeId = `mark:line:${s.id}`, fcNodeId = `mark:line:${s.id}:fc`, inkLead = inkLeadLine(env, s, li), lineWidth = paints.lineWidth(s, li), casingWidth = strokeToken(env.theme, "casing"), emitLine = (path, id, forecast) => {
2066
+ if (!path) return;
2067
+ g.nodes.push({ t: "path", id: forecast ? `casing:line:${s.id}:fc` : `casing:line:${s.id}`, d: path, stroke: { token: "background" }, width: casingWidth, owner: { seriesId: s.id }, part: "lineCasing", ...domain.columns.length > 0 ? { overFills: !0 } : {} });
2068
+ let dash = forecast ? dashToken(env.theme, "reference") : paints.dash(s);
2069
+ g.nodes.push({ t: "path", id, d: path, stroke: paint, width: lineWidth, dash, lineCap: dash?.join(",") === dashToken(env.theme, "dotted").join(",") ? "round" : "butt", owner: { seriesId: s.id }, part: "line" }), paints.lineHollow(s) && g.nodes.push({
2070
+ t: "path",
2071
+ id: `${id}:inner`,
2072
+ d: path,
2073
+ stroke: { token: "background" },
2074
+ width: strokeToken(env.theme, "hair"),
2075
+ dash,
2076
+ lineCap: dash?.join(",") === dashToken(env.theme, "dotted").join(",") ? "round" : "butt",
2077
+ owner: { seriesId: s.id },
2078
+ part: "lineInterior"
2079
+ });
2080
+ };
2081
+ emitLine(d, nodeId, !1), emitLine(fcD, fcNodeId, !0), claimLine(g.claims, plan, (ci) => cats[ci].id);
2082
+ let { shape: markerShape, anatomyDots, full } = comboLineMarkers(env, domain, s), markPoints = [];
2083
+ for (let p of pts) {
2084
+ let c = cats[p.ci], markerNodeId;
2085
+ if (markerShape !== "none" && (full || c.partial === !0)) {
2086
+ markerNodeId = `marker:${s.id}:${c.id}`;
2087
+ let hollow = c.partial === !0 || paints.lineHollow(s), markerFill = hollow ? { token: "background" } : paint, owner = { seriesId: s.id, categoryId: c.id }, value = s.vals[p.ci], example = domain.explicitFormatOf(s, value), display = { value: example ? env.byExample(example)(value.v) : value.isPct ? domain.pctFmt(value.v) : domain.scaleFmtOf(s)(value.v) };
2088
+ g.nodes.push(anatomyDots && !hollow ? { t: "circle", id: markerNodeId, cx: p.x, cy: p.y, r: ANATOMY_DOT_R, fill: markerFill, stroke: { token: "background" }, strokeWidth: strokeToken(env.theme, "mark"), owner, part: "marker", display } : markerShape === "square" ? { t: "rect", id: markerNodeId, rect: { x: p.x - 2.75, y: p.y - 2.75, w: 2.75 * 2, h: 2.75 * 2 }, fill: markerFill, ...hollow ? { stroke: paint, strokeWidth: strokeToken(env.theme, "mark") } : {}, owner, part: "marker", display } : markerShape === "triangle" || markerShape === "diamond" ? { t: "path", id: markerNodeId, d: markerPath(markerShape, p), fill: markerFill, ...hollow ? { stroke: paint, width: strokeToken(env.theme, "mark") } : {}, owner, part: "marker", display } : { t: "circle", id: markerNodeId, cx: p.x, cy: p.y, r: 2.75, fill: markerFill, stroke: hollow ? paint : { token: "background" }, strokeWidth: strokeToken(env.theme, "mark"), owner, part: "marker", display });
2089
+ let claimR = markerShape === "triangle" || markerShape === "diamond" ? 4 + (hollow ? strokeToken(env.theme, "mark") / 2 : 0) : 2.75 + 1;
2090
+ g.claims.claim({ x: p.x - claimR, y: p.y - claimR, w: claimR * 2, h: claimR * 2 }, "mark", { seriesId: s.id, categoryId: c.id });
2091
+ }
2092
+ markPoints.push({ categoryId: c.id, x: p.x, y: p.y, markerNodeId });
2093
+ }
2094
+ let latest = domain.options.latestPoint;
2095
+ (latest === void 0 ? inkLead : latest === "ring" && s.id === ringed) && latestPointRing(env.theme, g, s, pts.filter((p) => {
2096
+ let scenario = s.vals[p.ci].scenario ?? s.scenario;
2097
+ return scenario !== "FC" && scenario !== "PL";
2098
+ }).pop(), cats), g.marks.lines.push({
2099
+ seriesId: s.id,
2100
+ kind: s.kind === "area" ? "area" : "line",
2101
+ axis: s.axis === "secondary" && domain.secondaryActive ? "secondary" : "primary",
2102
+ nodeId: d ? nodeId : fcNodeId,
2103
+ ...fcD ? { fcNodeId } : {},
2104
+ areaNodeId,
2105
+ points: markPoints
2106
+ });
2107
+ }
2108
+ function layoutComboMarks(env, domain, area, paints) {
2109
+ let g = {
2110
+ nodes: [],
2111
+ claims: createOccupiedIndex({ x: 0, y: 0, w: env.size.width, h: env.size.height }),
2112
+ axes: [],
2113
+ leftTickX: 1 / 0,
2114
+ marks: { columns: [], lines: [] },
2115
+ segEdges: /* @__PURE__ */ new Map(),
2116
+ yieldingTicks: [],
2117
+ areaGrounds: [],
2118
+ segments: [],
2119
+ plans: [],
2120
+ meanValue: void 0
2121
+ }, ctx = { env, domain, area, paints, g };
2122
+ comboAxes(ctx);
2123
+ let columnStart = g.nodes.length;
2124
+ columnMarks(ctx), g.plans = linePlans(domain, area);
2125
+ let areaStart = g.nodes.length, areaIds = areaMarks(ctx, g.plans);
2126
+ g.nodes.splice(columnStart, 0, ...g.nodes.splice(areaStart));
2127
+ let ringed = domain.options.latestPoint === "ring" ? ringedSeries(g.plans) : void 0;
2128
+ for (let plan of g.plans) lineMark(ctx, plan, areaIds.get(plan), ringed);
2129
+ let { cats, columns, posTop, negBot } = domain;
2130
+ return g.meanValue = domain.columnsAdd ? domain.sourceMean ?? (columns.length > 0 && cats.length > 0 ? cats.reduce((a, _, ci) => a + posTop[ci] + negBot[ci], 0) / cats.length : primaryLineMean(g.plans, domain.secondaryActive)) : void 0, (domain.options.annotations ?? []).forEach((ann, n) => {
2131
+ if (ann.kind !== "valueLine") return;
2132
+ let annId = ann.id ?? `valueLine-${n + 1}`, v = ann.value === "mean" || ann.value === void 0 ? g.meanValue : ann.value;
2133
+ if (v === void 0) return;
2134
+ let ry = ann.axis === "secondary" && domain.secondaryDomain ? area.y2(v) : area.y(v);
2135
+ g.claims.claim(
2136
+ { x: area.plot.x, y: ry - 1, w: area.plot.w, h: 2 },
2137
+ "annotation",
2138
+ { annotationId: annId },
2139
+ "referenceLine"
2140
+ );
2141
+ }), g;
2142
+ }
2143
+
2144
+ // src/core/charts/combo/layout.ts
2145
+ function comboAnomalyMarks(env, domain, anomaly, area, geometry) {
2146
+ let line = geometry.marks.lines.find((mark) => mark.seriesId === anomaly.seriesId), onSecondary = line?.axis === "secondary", series = domain.lines.find((s) => s.id === anomaly.seriesId);
2147
+ return lineAnomalyFurniture(env.theme, {
2148
+ strings: domain.options.strings,
2149
+ anomaly: anomaly.model,
2150
+ corridorShown: anomaly.corridorShown,
2151
+ statFmt: anomaly.statFmt,
2152
+ fmt: domain.scaleFmtOf(series),
2153
+ corridorPaint: columnCorridorPaint(domain.options.colorblindSafe),
2154
+ plot: area.plot,
2155
+ y: onSecondary ? area.y2 : area.y,
2156
+ labelX: area.anomalyLabelX,
2157
+ seriesId: anomaly.seriesId,
2158
+ points: line?.points ?? [],
2159
+ font: area.labelFont,
2160
+ measure: env.measure,
2161
+ nodes: geometry.nodes,
2162
+ claims: geometry.claims
2163
+ });
2164
+ }
2165
+ function annotateCombo(env, domain, area, geometry, occupied, solveCtx, labelRequests) {
2166
+ let { cats, columns, secondaryActive, secondaryDomain } = domain, secondarySeries = domain.lines.filter((series) => series.axis === "secondary"), { band, y, y0, y2, plot } = area, catIndex = new Map(cats.map((c, i) => [c.id, i])), lineById = new Map(domain.lines.map((s) => [s.id, s])), resolveAnchor = (ref) => {
2167
+ let norm = typeof ref == "string" ? { categoryId: ref, edge: "total" } : ref;
2168
+ if (!("categoryId" in norm)) return null;
2169
+ let ci = catIndex.get(norm.categoryId);
2170
+ if (ci === void 0) return null;
2171
+ let c = cats[ci];
2172
+ if (norm.seriesId) {
2173
+ let owner = { categoryId: c.id, seriesId: norm.seriesId }, named = [...columns, ...domain.lines, ...domain.refs].find((s) => s.id === norm.seriesId), series = { format: named?.format, ...named && columns.length + domain.lines.length > 1 ? { series: { id: named.id, label: named.label } } : {} }, reference = domain.refs.find((s) => s.id === norm.seriesId);
2174
+ if (reference && geometry.nodes.some((node) => node.id === `ref:${reference.id}:${c.id}`)) {
2175
+ let v = reference.vals[ci].v;
2176
+ return v === null ? null : { x: band.center(ci), y: y(v), value: v, date: c.date, label: c.label, owner, ...series };
2177
+ }
2178
+ let ls = lineById.get(norm.seriesId);
2179
+ if (ls) {
2180
+ let v = ls.vals[ci].v;
2181
+ if (v === null) return null;
2182
+ let yFor = ls.axis === "secondary" && secondaryActive ? y2 : y;
2183
+ return { x: band.center(ci), y: norm.edge === "start" ? y0 : yFor(v), value: v, date: c.date, label: c.label, owner, lineAnchored: !0, ...series };
2184
+ }
2185
+ let e = geometry.segEdges.get(sk(norm.seriesId, c.id));
2186
+ if (!e) return null;
2187
+ let edge = norm.edge ?? "end", yy = y(edge === "start" ? e.v0 : edge === "end" ? e.v1 : Math.max(e.v0, e.v1));
2188
+ return { x: band.center(ci), y: yy, value: e.v, date: c.date, label: c.label, owner, ...series };
2189
+ }
2190
+ if (columns.length === 0) return null;
2191
+ let topPlotted = domain.posTop[ci] > 0 ? domain.posTop[ci] : domain.negBot[ci];
2192
+ return { x: band.center(ci), y: norm.edge === "start" ? y0 : y(topPlotted), value: domain.stackTotals[c.id], format: columns.length === 1 ? columns[0].format : void 0, ...domain.columnsAdd ? {} : { noValue: NO_STACK_TOTAL }, date: c.date, label: c.label, owner: { categoryId: c.id } };
2193
+ }, lift = area.topPad - area.axisTitles.height - 8, annPlot = { x: plot.x, y: plot.y - lift, w: plot.w, h: plot.h + lift }, ceilingRects = [
2194
+ ...area.axisTitles.height > 0 ? [{ x: area.frame.plot.x, y: area.frame.plot.y, w: area.frame.plot.w, h: area.axisTitles.height }] : [],
2195
+ ...area.valueLineRows.values()
2196
+ ];
2197
+ return runAnnotatePass({
2198
+ target: domain.options.target,
2199
+ // The growth bracket seats its label on its run.
2200
+ cagrLabelOnArm: !0,
2201
+ // Events belong to the event lane.
2202
+ annotations: withoutEvents(domain.options.annotations ?? []),
2203
+ resolve: resolveAnchor,
2204
+ defaultSpan: cats.length >= 2 && columns.length > 0 ? { from: cats[0].id, to: cats[cats.length - 1].id } : void 0,
2205
+ occupied,
2206
+ plot: annPlot,
2207
+ bandCeiling: area.frame.plot.y,
2208
+ ceilingRects,
2209
+ valueLineRows: area.valueLineRows,
2210
+ theme: env.theme,
2211
+ measure: env.measure,
2212
+ format: domain.options.format,
2213
+ locale: domain.options.locale?.language,
2214
+ strings: domain.options.strings,
2215
+ valueLinePercentLevels: domain.options.unit === "%" || percentLevels([...columns, ...domain.lines.filter((series) => series.axis === "primary")]),
2216
+ secondaryPercentLevels: !!domain.options.secondaryAxis?.ruler || secondarySeries.length > 0 && secondarySeries.every((series) => series.unit === "%" || percentLevels([series])),
2217
+ secondaryFormat: secondarySeries.every((series) => series.format === secondarySeries[0]?.format) ? secondarySeries[0]?.format : void 0,
2218
+ solveCtx,
2219
+ labelRequests,
2220
+ yScale: y,
2221
+ ...secondaryDomain ? { ySecondaryScale: y2 } : {},
2222
+ meanValue: geometry.meanValue,
2223
+ ...domain.columnsAdd ? {} : { meanMissing: NO_STACK_MEAN },
2224
+ meanSpan: domain.meanSpan,
2225
+ partialCategories: partialIds(cats),
2226
+ // Category bands for the band annotation, as on column.
2227
+ ...categoryTargetFields(cats.map((c) => c.id), plot, (i) => band.center(i), "x")
2228
+ });
2229
+ }
2230
+ function assembleComboGeometry(input) {
2231
+ let { env, domain, area, geometry, solved, annotated, warnings, lane } = input, { cats, columns, lines, refs, fmt, stackTotals, secondaryDomain } = domain, { frame, catPlan, band, plot, showCatTickRow, strongFont, labelFont, tickFont } = area, catFont = catPlan.font, allLabels = [...solved.placed, ...annotated.labels], nodes = [...frame.nodes, ...geometry.nodes];
2232
+ spliceAnnotationNodes(nodes, annotated.nodes);
2233
+ let lastFill = nodes.reduce((at, node, i) => node.part === "area" ? i : at, -1);
2234
+ if (lastFill >= 0) {
2235
+ let outlines = geometry.areaGrounds.map((ground, k) => ({ id: `${ground.seriesId}:${k}`, seriesId: ground.seriesId, top: [...ground.top], bottom: [...ground.bottom], paint: ground.paint, forecast: !1 })), shaded = fillShadings(nodes, outlines, fillShadingKinds(withoutEvents(domain.options.annotations ?? [])), area.plot, strokeToken(env.theme, "rule"), bandHatch(env.theme, domain.options.hatchStrength)), gap = strokeToken(env.theme, "rule"), gaps = geometry.marks.columns.filter((column) => column.segments.length > 0).map(({ categoryId, rect }) => ({
2236
+ t: "rect",
2237
+ id: `columnGap:${categoryId}`,
2238
+ rect: { x: rect.x - gap, y: rect.y - gap, w: rect.w + 2 * gap, h: rect.h + 2 * gap },
2239
+ fill: { token: "background" },
2240
+ owner: {},
2241
+ part: "columnGap"
2242
+ }));
2243
+ nodes.splice(lastFill + 1, 0, ...shaded.nodes, ...gaps), regroundOnShadings(allLabels, shaded.grounds);
2244
+ }
2245
+ let bandLabelIds = new Set(annotated.placed.filter((ann) => ann.kind === "band").map((ann) => ann.labelId));
2246
+ pushAll(nodes, labelsToNodes(
2247
+ env.theme,
2248
+ allLabels,
2249
+ (l) => l.id.startsWith("forecast:") ? secondaryFont(env.theme) : bandLabelIds.has(l.id) || l.id.startsWith("tick:") ? tickFont : l.kind === "grandTotal" || l.kind === "total" ? strongFont : l.kind === "category" ? area.stairTop !== void 0 ? tickFont : catFont : l.kind === "annotation" || l.kind === "valueLine" ? { ...labelFont, weight: emphasisWeight(env.theme) } : labelFont,
2250
+ nodes
2251
+ )), lane && pushAll(nodes, lane.nodes);
2252
+ let axes = [
2253
+ {
2254
+ axis: "x",
2255
+ baselineNodeId: "axis:baseline",
2256
+ ticks: cats.map((c, i) => ({ at: c.id, pos: band.center(i), labelId: showCatTickRow || area.stairTop !== void 0 ? `category:${c.id}` : void 0 }))
2257
+ },
2258
+ ...geometry.axes
2259
+ ], partsDesc = [
2260
+ columns.length > 0 ? chartString2(domain.options, "stackedColumnSeriesDesc", { v1: columns.length, v2: columns.map((s) => s.label).join(", ") }) : "",
2261
+ lines.length > 0 ? chartString2(domain.options, "lineAreaSeriesDesc", { v1: lines.length, v2: lines.map((s) => s.label).join(", ") }) : "",
2262
+ refs.length > 0 ? chartString2(domain.options, "referenceSeriesCount", { v1: refs.length }) : ""
2263
+ ].filter(Boolean).join(chartString2(domain.options, "plusClause")), totalsAdd = columns.length > 0 && domain.columnsAdd, a11yDesc = chartString2(domain.options, "comboDescStart", { v1: cats.length, v2: partsDesc }) + (domain.secondaryActive ? chartString2(domain.options, "secondaryAxisDesc") : "") + (totalsAdd ? chartString2(domain.options, "columnTotalsSentence", { v1: cats.map((c) => `${c.label ?? c.id} ${fmt(stackTotals[c.id])}`).join(", ") }) : ".") + anomalyA11y({ options: domain.options, anomaly: domain.anomaly, fmt: domain.anomaly ? domain.scaleFmtOf(domain.lines.find((s) => s.id === domain.anomaly.seriesId)) : fmt, cats }), paintWarningRules = [];
2264
+ pushAll(warnings, rectSeriesAdjacentWarnings(nodes, input.paints.css, "vertical", env.highlights, env.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 }));
2265
+ let catTickMaxLines = catPlan.maxLines, clearance = domain.options[LINE_BAND_CLEARANCE];
2266
+ return {
2267
+ type: "combo",
2268
+ ...clearance === void 0 ? {} : { [DENSITY_LAYOUT_OPTIONS]: { [LINE_BAND_CLEARANCE]: clearance } },
2269
+ size: env.size,
2270
+ // Bands stretch to the frame, so the layout reports the width its
2271
+ // categories actually want and a host can shrink the canvas to it.
2272
+ sizing: bandSizing("combo", env.size, plot.w, band.step),
2273
+ plot,
2274
+ ...annotated.bandNeed > 0 ? { [BAND_PAD]: annotated.bandNeed } : {},
2275
+ scene: withSegmentSeams(nodes, env.theme),
2276
+ labels: lane ? [...allLabels, ...lane.labels] : allLabels,
2277
+ axes,
2278
+ annotations: lane ? [...annotated.placed, ...lane.placed] : annotated.placed,
2279
+ legend: frame.legend,
2280
+ frame: frame.frame,
2281
+ marks: geometry.marks,
2282
+ derived: {
2283
+ stackTotals: totalsAdd ? stackTotals : {},
2284
+ stackParts: totalsAdd ? stackParts(stackTotals, cats, columns, (si, ci) => columns[si].vals[ci].v) : {},
2285
+ ...domain.roundingAdjustments.length > 0 && contentOf(domain, "segment", ["absolute"])?.includes("percent") ? { roundingAdjustments: domain.roundingAdjustments } : {},
2286
+ ...domain.anomaly ? { anomaly: anomalyReceipt(domain.anomaly.model) } : {},
2287
+ ...secondaryDomain ? { secondaryDomain } : {},
2288
+ ...showCatTickRow ? {
2289
+ tickBand: {
2290
+ reserved: area.catBandH,
2291
+ measuredLines: catTickMaxLines,
2292
+ lineHeight: catFont.size * 1.2,
2293
+ extra: catPlan.rowHeight - catTickMaxLines * catFont.size * 1.2,
2294
+ dateNumeric: area.dateNumericTicks,
2295
+ position: "below"
2296
+ }
2297
+ } : {}
2298
+ },
2299
+ a11y: {
2300
+ title: accessibleTitle(domain.options.title, chartString2(domain.options, "comboTitle", { v1: domain.data.map((s) => s.label).join(", "), v2: cats.length })),
2301
+ counts: [
2302
+ ...domain.anomaly?.model?.counts ?? [],
2303
+ structureCount("categories", cats.length, void 0, domain.options),
2304
+ ...columns.length ? [structureCount("series", columns.length, chartString2(domain.options, "stackedColumnSeriesCount", { v1: columns.length }))] : [],
2305
+ ...lines.length ? [structureCount("series", lines.length, chartString2(domain.options, "lineAreaSeriesCount", { v1: lines.length }))] : [],
2306
+ ...refs.length ? [structureCount("reference-series", refs.length, chartString2(domain.options, "referenceSeriesCount", { v1: refs.length }))] : []
2307
+ ],
2308
+ desc: a11yDesc
2309
+ },
2310
+ warnings,
2311
+ paintWarningRules,
2312
+ debug: {
2313
+ occupied: input.occupied.snapshot(),
2314
+ decisions: [...solved.decisions, ...annotated.decisions]
2315
+ }
2316
+ };
2317
+ }
2318
+ function commitClaims(occupied, phase) {
2319
+ for (let c of phase.snapshot()) occupied.claim(c.rect, c.kind, c.owner, c.part);
2320
+ phase.tickColumns && (occupied.tickColumns = phase.tickColumns);
2321
+ }
2322
+ var CATEGORY_NOTED = /* @__PURE__ */ Symbol("categoryNoted"), UNPRINTED = /* @__PURE__ */ Symbol("unprintedValues");
2323
+ function layoutCombo(data, options = {}, gutterOverride) {
2324
+ let geo = withBandValueNotes(data, withLocaleStrings(options), (next) => {
2325
+ let cur = next, geometry = layoutComboPass(data, cur, gutterOverride);
2326
+ for (let step = 0; step < 2; step++) {
2327
+ let bandNeed = Math.ceil(geometry[BAND_PAD] ?? 0);
2328
+ if (bandNeed <= 0) break;
2329
+ let prevBandPad = cur[BAND_PAD] ?? 0;
2330
+ cur = { ...cur, [BAND_PAD]: prevBandPad + bandNeed }, geometry = layoutComboPass(data, cur, gutterOverride);
2331
+ }
2332
+ return delete geometry[BAND_PAD], geometry;
2333
+ });
2334
+ return Object.assign(geo, { [DEFER_DENSITY_NOTES]: !0 });
2335
+ }
2336
+ function sameMarkArea(a, b) {
2337
+ return ["x", "y", "w", "h"].every((key) => a.plot[key] === b.plot[key]) && a.rightTickX === b.rightTickX && a.band.range.every((value, i) => value === b.band.range[i]) && a.band.bandwidth === b.band.bandwidth && a.band.step === b.band.step && a.y.domain.every((value, i) => value === b.y.domain[i]) && a.y.range.every((value, i) => value === b.y.range[i]) && a.y2.domain.every((value, i) => value === b.y2.domain[i]) && a.y2.range.every((value, i) => value === b.y2.range[i]);
2338
+ }
2339
+ function layoutComboPass(data, options = {}, gutterOverride, noteMarks) {
2340
+ let warnings = [], env = resolveComboEnv(options, warnings), domain = resolveComboDomain(data, options, warnings, env.theme), paints = comboPaints(env, domain);
2341
+ return layoutComboFramePass(data, options, gutterOverride, env, domain, paints, warnings, void 0, noteMarks);
2342
+ }
2343
+ function layoutComboFramePass(data, options, gutterOverride, env, domain, paints, domainWarnings, frameSeed, noteMarks) {
2344
+ let warnings = [...domainWarnings], { size } = env, hasEvents = domain.options.annotations?.some((annotation) => annotation.kind === "event"), solve = (key, out) => {
2345
+ if (hasEvents) return solveComboFrame(env, domain, paints, out, key);
2346
+ let retained = frameSeed && refitComboFrame(env, frameSeed.domain, domain, frameSeed.framed);
2347
+ if (retained)
2348
+ frameSeed = { ...frameSeed, domain, framed: retained };
2349
+ else {
2350
+ let frameWarnings = [];
2351
+ frameSeed = { domain, framed: solveComboFrame(env, domain, paints, frameWarnings, key), warnings: frameWarnings };
2352
+ }
2353
+ pushAll(out, frameSeed.warnings);
2354
+ let framed = frameSeed.framed;
2355
+ return { ...framed, frame: { ...framed.frame, frame: copyFrame(framed.frame.frame) } };
2356
+ }, settle = () => settleEventLane({
2357
+ annotations: domain.options.annotations ?? [],
2358
+ categories: domain.cats,
2359
+ events: options.events,
2360
+ language: options.locale?.language,
2361
+ inline: !1,
2362
+ footnotesOff: options.footnotesOff,
2363
+ theme: env.theme,
2364
+ measure: env.measure,
2365
+ size,
2366
+ compact: options.mode === "compact",
2367
+ solve,
2368
+ area: (framed, w) => comboPlotArea(env, domain, paints, framed, gutterOverride, w),
2369
+ axis: (area2) => ({ x: (ci) => area2.band.center(ci), step: area2.band.step, plot: area2.plot }),
2370
+ warnings
2371
+ }), settled = settle(), area = settled.area;
2372
+ if (options[LINE_BAND_CLEARANCE] === void 0) {
2373
+ let scaleH = area.y(domain.dLo) - area.y(domain.dHi), mode = comboValueLabels(options, domain.anatomy, domain.cats.length), interiorValues = mode === "all" || mode === "extremes" || domain.anomaly !== void 0, clearance = domain.anatomy && domain.columns.length === 1 && !domain.anomaly && domain.cats.every((c) => env.measure(domain.fmt(domain.stackTotals[c.id] ?? 0), area.labelFont).width + 4 <= area.band.bandwidth) ? 2.75 + 8 : area.gtH + (interiorValues ? env.measure("0", area.labelFont).height + 14 : 8) + (domain.anomaly ? ANOMALY_FLAG_GAP + ANOMALY_FLAG_H : 0);
2374
+ if (scaleH > 0 && domain.secondaryActive && domain.columns.length > 0) {
2375
+ let measured = clearance / scaleH, next = domain.withLineBandClearance?.(measured);
2376
+ options = { ...options, [LINE_BAND_CLEARANCE]: measured }, next && (domain = next.domain, domainWarnings = next.warnings, warnings.length = 0, pushAll(warnings, domainWarnings)), domain.options = { ...domain.options, [LINE_BAND_CLEARANCE]: measured }, next && (settled = settle(), area = settled.area);
2377
+ }
2378
+ }
2379
+ let occupied = createOccupiedIndex({ x: 0, y: 0, w: size.width, h: size.height });
2380
+ commitClaims(occupied, settled.framed.claims);
2381
+ let categoryNotes = area.showCatTickRow ? area.catPlan.step === "ranks" ? rankNotes(domain.cats.map((c) => c.label ?? c.id), domain.options) : area.catPlan.cutNotes : [], noted = options[CATEGORY_NOTED] === !0, printed = options[POINTED_NOTES] ?? [];
2382
+ if (categoryNotes.length > 0 && !noted) {
2383
+ let current = authoredNotes(options), authored = options.authoredFootnotes ?? current;
2384
+ return layoutComboPass(data, { ...withAuthoredFootnotes(options, [...current, ...categoryNotes], authored), [CATEGORY_NOTED]: !0, [POINTED_NOTES]: categoryNotes, ...area.catPlan.step === "ranks" ? { [FORCE_CATEGORY_RANKS]: !0 } : {} }, gutterOverride);
2385
+ }
2386
+ if (noted && categoryNotesDiffer(categoryNotes, printed) && options[FORCE_CATEGORY_RANKS] !== !0) {
2387
+ let keyed = rankNotes(domain.cats.map((c) => c.label ?? c.id), domain.options), current = authoredNotes(options).filter((note) => !printed.includes(note)), authored = options.authoredFootnotes ?? current;
2388
+ return layoutComboPass(data, { ...withAuthoredFootnotes(options, [...current, ...keyed], authored), [POINTED_NOTES]: keyed, [FORCE_CATEGORY_RANKS]: !0 }, gutterOverride);
2389
+ }
2390
+ let marks = noteMarks && sameMarkArea(noteMarks.area, area) ? {
2391
+ ...noteMarks.geometry,
2392
+ // The note retry normalizes fresh series. Paint decisions can use
2393
+ // series identity, so retained positions must refer to those series.
2394
+ segments: noteMarks.geometry.segments.map((segment) => ({ ...segment, s: domain.columns[segment.si] })),
2395
+ plans: noteMarks.geometry.plans.map((plan) => ({ ...plan, s: domain.lines[plan.li] }))
2396
+ } : layoutComboMarks(env, domain, area, paints), geometry = { ...marks, nodes: [...marks.nodes] };
2397
+ domain.anomaly && (geometry.claims = createOccupiedIndex({ x: 0, y: 0, w: size.width, h: size.height }), commitClaims(geometry.claims, marks.claims));
2398
+ let anomalyMarks = domain.anomaly ? comboAnomalyMarks(env, domain, domain.anomaly, area, geometry) : void 0;
2399
+ commitClaims(occupied, geometry.claims);
2400
+ let requests = planComboLabels(env, domain, area, geometry, paints, warnings), stair = area.stairTop === void 0 ? void 0 : seatStaircase({
2401
+ categories: domain.cats,
2402
+ band: area.band,
2403
+ top: area.stairTop,
2404
+ left: area.plot.x,
2405
+ right: area.plot.x + area.plot.w,
2406
+ floor: area.y0,
2407
+ above: domain.options.labels !== !1 ? area.gtH + 4 : 0,
2408
+ font: area.tickFont,
2409
+ measure: env.measure,
2410
+ tops: domain.posTop,
2411
+ options,
2412
+ cap: STAIRCASE_MAX_PAD * area.frame.plot.h,
2413
+ occupied,
2414
+ requests
2415
+ }), centre = (ci) => area.band.center(ci), dividerTop = area.forecastHeaderY + env.measure(options.strings.forecastHeader, secondaryFont(env.theme)).height + 8, divided = { ...area.plot, y: dividerTop, h: area.plot.y + area.plot.h - dividerTop };
2416
+ placeForecastHeaders(area.forecast, centre, divided, area.forecastHeaderY, secondaryFont(env.theme), env.measure, requests, occupied, options.strings.forecastHeader, "band"), emitForecastDividers(env.theme, area.forecast, centre, divided, geometry.nodes, "band"), anomalyMarks && seatFlaggedValues(requests, domain.anomaly.seriesId, anomalyMarks, geometry.segments.map((segment) => segment.rect));
2417
+ let densityValues = options[DENSITY_VALUES];
2418
+ for (let request of requests) densityValues?.has(request.id) && ["point", "grandTotal"].includes(request.kind) && (request.redundant = !0, request.suppressedAs = "density");
2419
+ let solveCtx = {
2420
+ focus: options.focus,
2421
+ density: env.density,
2422
+ pins: options.labelPlacements ?? {},
2423
+ measure: env.measure,
2424
+ plot: area.plot,
2425
+ canvas: { x: 0, y: 0, w: size.width, h: size.height },
2426
+ darkInk: env.theme.color.ink,
2427
+ lightInk: env.theme.color.inkInverse,
2428
+ labelPad: 2,
2429
+ // A line or area value reads as its own point's (label/ownership.ts).
2430
+ pointOwnership: {
2431
+ points: geometry.plans.flatMap((plan) => plan.pts.map((p) => ({ seriesId: plan.s.id, categoryId: domain.cats[p.ci].id, x: p.x, y: p.y }))),
2432
+ categoryX: new Map(domain.cats.map((c, ci) => [c.id, area.band.center(ci)]))
2433
+ }
2434
+ }, annotatedFirst = (domain.options.annotations ?? []).some((annotation) => annotation.kind === "valueLine") ? annotateCombo(env, domain, area, geometry, occupied, solveCtx, requests) : void 0, chartIds = new Set(requests.map((request) => request.id)), solved = annotatedFirst ? { placed: annotatedFirst.labels.filter((label) => chartIds.has(label.id)), decisions: annotatedFirst.decisions.filter((decision) => chartIds.has(decision.labelId)), warnings: [] } : solveLabels(requests, occupied, solveCtx);
2435
+ annotatedFirst && (annotatedFirst.labels = annotatedFirst.labels.filter((label) => !chartIds.has(label.id)), annotatedFirst.decisions = annotatedFirst.decisions.filter((decision) => !chartIds.has(decision.labelId)));
2436
+ let staircase = runStaircase(env.theme, options.categoryLabels, options, stair, solved.placed, occupied, geometry.nodes, warnings), nextStair = nextStaircase(options, staircase);
2437
+ if (nextStair) return layoutComboPass(data, { ...options, [STAIRCASE]: nextStair }, gutterOverride);
2438
+ let toDate = toDateOnTotals(env, domain);
2439
+ if (toDate.size > 0 && (!toDateFits(options.strings?.toDate ?? chartString2(options, "toDate"), env.theme, env.measure, toDateRoom(area.band.bandwidth)) || solved.placed.some((l) => l.kind === "grandTotal" && l.hidden !== void 0 && toDate.has(l.owner.categoryId ?? ""))))
2440
+ return layoutComboPass(data, { ...options, [PARTIAL_KEY]: !0 }, gutterOverride);
2441
+ if (!domain.showPrimaryAxis && domain.options.valueAxis?.show === void 0 && solved.placed.some((l) => (l.kind === "grandTotal" || domain.ticksFromLabels === !0 && l.kind === "point") && l.hidden !== void 0 && l.hidden !== "redundant"))
2442
+ return layoutComboPass(data, { ...options, [TOTALS_AXIS]: !0 }, gutterOverride);
2443
+ if (!options[FIRST_END_BELOW_TOTALS] && options[INSIDE_ENDPOINT_IDS] === void 0) {
2444
+ let ends = new Set([...area.first, ...area.last].map(([id, end]) => `point:${id}:${domain.cats[end.ci].id}`)), pastPlot = (label) => label.hidden === void 0 && String(label.slot).includes("PastColumn") && (label.rect.x < area.plot.x - 0.5 || label.rect.x + label.rect.w > area.plot.x + area.plot.w + 0.5), missing = solved.placed.filter((label) => ends.has(label.id) && (label.hidden === "collision" || pastPlot(label))).map((label) => label.id);
2445
+ if (missing.length) {
2446
+ let ids = new Set(missing), room = insideEndpointGutters({
2447
+ ids,
2448
+ first: area.first,
2449
+ last: area.last,
2450
+ cats: domain.cats,
2451
+ width: area.endpointWidth,
2452
+ font: area.labelFont,
2453
+ measure: env.measure,
2454
+ markerR: 2.75
2455
+ });
2456
+ if (options = { ...options, [INSIDE_ENDPOINT_IDS]: ids }, domain.options = { ...domain.options, [INSIDE_ENDPOINT_IDS]: ids }, room.first > 0 || room.last > 0) return layoutComboFramePass(data, options, gutterOverride, env, domain, paints, domainWarnings, frameSeed);
2457
+ }
2458
+ }
2459
+ let gutters = gutterOverride ? void 0 : unusedEndpointGutters(area.gutters, solved, area.plot);
2460
+ if (gutters) return layoutComboPass(data, domain.options, gutters);
2461
+ let catIndex = (l) => domain.cats.findIndex((c) => c.id === l.owner.categoryId), segmentOwed = (l) => l.id.startsWith("segment:") && l.hidden !== void 0 && l.noteText !== void 0 && l.printedIn === void 0, unprinted = solved.placed.filter((l) => l.id.startsWith("tick:") && l.hidden !== void 0 && l.hidden !== "redundant" || segmentOwed(l));
2462
+ if (unprinted.length > 0 && options.footnotesOff !== !0) {
2463
+ let catLabel = (id) => domain.cats.find((c) => c.id === id)?.label ?? id, prior = options[UNPRINTED] ?? { named: /* @__PURE__ */ new Map(), runs: 0 }, named = new Map(prior.named);
2464
+ for (let l of unprinted) named.has(l.id) || named.set(l.id, [catIndex(l), l.noteText ?? `${l.text} (${catLabel(l.owner.categoryId)})`]);
2465
+ if (named.size > prior.named.size && prior.runs < 3) {
2466
+ let current = authoredNotes(options).filter((line) => !line.startsWith(options.strings.valuesNotBesideMarks)), valueCount = solved.placed.filter((l) => l.id.startsWith("tick:") || l.id.startsWith("segment:")).length, note = noteLine(options.strings.valuesNotBesideMarks, [...named.values()].sort((a, b) => a[0] - b[0]).map(([, item]) => item), options, valueCount), authored = options.authoredFootnotes ?? current;
2467
+ return layoutComboPass(data, { ...withAuthoredFootnotes(options, [...current, ...note], authored), [UNPRINTED]: { named, runs: prior.runs + 1 } }, gutterOverride, { area, geometry: marks });
2468
+ }
2469
+ let inNote = new Set(unprinted.filter((l) => prior.named.has(l.id)).map((l) => `label '${l.id}'`));
2470
+ solved.warnings = solved.warnings.filter((w) => !(w.code === "label-hidden" && [...inNote].some((key) => w.message.startsWith(key))));
2471
+ }
2472
+ let notedIds = options[UNPRINTED]?.named, countedIds = notedIds ? new Set([...notedIds].sort((a, b) => a[1][0] - b[1][0]).slice(noteCap(options, notedIds.size)).map(([id]) => id)) : void 0;
2473
+ for (let label of solved.placed) notedIds?.has(label.id) && (label.hidden === void 0 && (label.hidden = "note"), label.noted = !0, countedIds?.has(label.id) && (label.noteCounted = !0));
2474
+ flagDroppedEndpointLabels(solved);
2475
+ for (let label of solved.placed) label.id.startsWith("tick:") && !label.hidden && (label.ink = { token: "inkMuted" });
2476
+ let crossed = haloOverRules(solved.placed, occupied, /* @__PURE__ */ new Set(["referenceLine", "valueLine"]));
2477
+ applyComboAxisTitlePaint(solved.placed, area.axisTitles), geometry.nodes.push(...comboAxisTitleSwatches(env.theme, solved.placed, area.axisTitles, occupied)), applyGrowthInk(solved.placed, area), pushAll(warnings, solved.warnings);
2478
+ let annotated = annotatedFirst ?? annotateCombo(env, domain, area, geometry, occupied, solveCtx);
2479
+ for (let id of haloOverRules(solved.placed, occupied, /* @__PURE__ */ new Set(["referenceLine", "valueLine"]))) crossed.add(id);
2480
+ if (!(VALUE_LINE_RESERVE in options)) {
2481
+ let reserve = hiddenValueLineReserve(annotated.labels.filter((l) => l.slots.includes("insideStart")), (text) => env.measure(text, { ...area.labelFont, weight: emphasisWeight(env.theme) }).width, size.width);
2482
+ if (reserve > 0) return layoutComboPass(data, { ...options, [VALUE_LINE_RESERVE]: reserve }, gutterOverride);
2483
+ }
2484
+ pushAll(warnings, annotated.warnings);
2485
+ for (let tick of geometry.yieldingTicks) {
2486
+ let label = annotated.labels.find((l) => l.id === `valueLine:${tick.annotationId}` && !l.hidden);
2487
+ if (!(!label || !rectsOverlap(label.rect, tick.rect))) {
2488
+ geometry.nodes = geometry.nodes.filter((node) => node.id !== tick.labelId);
2489
+ for (let axis of geometry.axes) for (let t of axis.ticks) t.labelId === tick.labelId && delete t.labelId;
2490
+ }
2491
+ }
2492
+ let lane = settled.lane ? emitEventLane(env.theme, {
2493
+ ...settled.lane,
2494
+ axis: { x: (ci) => area.band.center(ci), step: area.band.step, plot: area.plot },
2495
+ mode: "stop",
2496
+ baseline: area.plot.y + area.plot.h,
2497
+ occupied,
2498
+ solveCtx
2499
+ }) : void 0;
2500
+ lane && pushAll(warnings, lane.warnings);
2501
+ let assembled = assembleComboGeometry({ env, domain, area, paints, geometry, solved, annotated, occupied, warnings, lane });
2502
+ return assembled.scene = raiseOverRules(assembled.scene, crossed), assembled;
2503
+ }
2504
+
2505
+ export {
2506
+ FIRST_END_BELOW_TOTALS,
2507
+ comboDrawsSecondaryAxis,
2508
+ SECONDARY_FULL_DOMAIN,
2509
+ HIGHLIGHT_KEY,
2510
+ layoutCombo
2511
+ };