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,2919 @@
1
+ import {
2
+ FILL_SEPARATION_FLOOR,
3
+ MARK_CONTRAST_FLOOR,
4
+ PALETTE_CVD_FLOOR,
5
+ PALETTE_NORMAL_FLOOR,
6
+ PALETTE_TRITAN_FLOOR,
7
+ TEXT_CONTRAST_FLOOR,
8
+ apcaContrast,
9
+ compositeColor,
10
+ contrastRatio,
11
+ literalColor,
12
+ mixColors,
13
+ oklabLightness,
14
+ onFillInks,
15
+ palettePerceptualDistance,
16
+ parseColor,
17
+ pickOnFillInk,
18
+ registerDeferredLoader,
19
+ relativeLuminance,
20
+ requireDeferred,
21
+ swatchApart,
22
+ tint
23
+ } from "./chunk-HA4IPWMM.js";
24
+ import {
25
+ fmtPathNumber
26
+ } from "./chunk-WLZ54FWG.js";
27
+ import {
28
+ DEFAULT_TARGET,
29
+ NormalizeError,
30
+ TEXT_SCALE_RANGE,
31
+ TEXT_SIZE_RANGE,
32
+ scaleTextAtFloor,
33
+ scaleTextPx,
34
+ targetFloorsPx,
35
+ targetTypeSizesPx,
36
+ textSizeScale
37
+ } from "./chunk-SGD3ZHID.js";
38
+ import {
39
+ AUTHORED_TYPE_SIZE,
40
+ hasAuthoredTypeSize,
41
+ measureText
42
+ } from "./chunk-AG2CJ4JY.js";
43
+
44
+ // src/core/svgPath.ts
45
+ function isHatchPattern(pattern) {
46
+ return pattern === "hatch45" || pattern === "crosshatch" || pattern === "horizontal" || pattern === "vertical";
47
+ }
48
+ function linePath(points) {
49
+ return points.length === 0 ? "" : points.map((p, i) => `${i === 0 ? "M" : "L"}${fmtPathNumber(p.x)} ${fmtPathNumber(p.y)}`).join("");
50
+ }
51
+ function leaderPath(from, to, straightThreshold = 8) {
52
+ let dx = to.x - from.x, dy = to.y - from.y;
53
+ if (Math.abs(dx) <= straightThreshold || Math.abs(dy) <= straightThreshold)
54
+ return `M${fmtPathNumber(from.x)} ${fmtPathNumber(from.y)}L${fmtPathNumber(to.x)} ${fmtPathNumber(to.y)}`;
55
+ let mx = from.x + dx / 2;
56
+ return `M${fmtPathNumber(from.x)} ${fmtPathNumber(from.y)}C${fmtPathNumber(mx)} ${fmtPathNumber(from.y)} ${fmtPathNumber(mx)} ${fmtPathNumber(to.y)} ${fmtPathNumber(to.x)} ${fmtPathNumber(to.y)}`;
57
+ }
58
+ function ribbonPath(x1, top1, bottom1, x2, top2, bottom2, edges = !1, curved = !0) {
59
+ let mx = fmtPathNumber((x1 + x2) / 2), to = (ya, xb, yb) => curved ? `C${mx} ${fmtPathNumber(ya)} ${mx} ${fmtPathNumber(yb)} ${fmtPathNumber(xb)} ${fmtPathNumber(yb)}` : `L${fmtPathNumber(xb)} ${fmtPathNumber(yb)}`, top = `M${fmtPathNumber(x1)} ${fmtPathNumber(top1)}${to(top1, x2, top2)}`;
60
+ return edges ? `${top}M${fmtPathNumber(x1)} ${fmtPathNumber(bottom1)}${to(bottom1, x2, bottom2)}` : `${top}L${fmtPathNumber(x2)} ${fmtPathNumber(bottom2)}${to(bottom2, x1, bottom1)}Z`;
61
+ }
62
+ function arrowHeadDepth(size = 6) {
63
+ return size * Math.abs(Math.cos(Math.PI * 0.85));
64
+ }
65
+ function arrowShaftEnd(size = 6, strokeWidth = GRAMMAR_STROKE.rule) {
66
+ let depth = arrowHeadDepth(size), halfBase = size * Math.abs(Math.sin(Math.PI * 0.85)), flush = strokeWidth / 2 * (depth / halfBase);
67
+ return Math.min(depth, flush + 0.5);
68
+ }
69
+ function arrowHeadPath(tip, angleRad, size = 6) {
70
+ let a1 = angleRad + Math.PI * 0.85, a2 = angleRad - Math.PI * 0.85, p1 = { x: tip.x + Math.cos(a1) * size, y: tip.y + Math.sin(a1) * size }, p2 = { x: tip.x + Math.cos(a2) * size, y: tip.y + Math.sin(a2) * size };
71
+ return `M${fmtPathNumber(tip.x)} ${fmtPathNumber(tip.y)}L${fmtPathNumber(p1.x)} ${fmtPathNumber(p1.y)}L${fmtPathNumber(p2.x)} ${fmtPathNumber(p2.y)}Z`;
72
+ }
73
+ function hatchPatternId(stroke, background, angle = 45, gap = 5, strokeWidth = 1.4) {
74
+ let clean = (s) => s.replace(/[^a-z0-9]/gi, ""), num = (n) => clean(String(n).replace(".", "p"));
75
+ return `bp-hatch-${clean(stroke)}-${clean(background)}-${angle}-${num(gap)}-${num(strokeWidth)}`;
76
+ }
77
+ function hatchTile(gap, strokeWidth, pattern = "hatch45") {
78
+ let t = Math.round(gap * Math.SQRT2 * 50) / 50, c = (v) => String(Math.round(v * 1e3) / 1e3), h = t / 2, e = t * 1.5, diagonal = `M0 ${c(t)}L${c(t)} 0M${c(-h)} ${c(h)}L${c(h)} ${c(-h)}M${c(h)} ${c(e)}L${c(e)} ${c(h)}`, d = pattern === "horizontal" ? `M0 ${c(h)}H${c(t)}` : pattern === "vertical" ? `M${c(h)} 0V${c(t)}` : pattern === "crosshatch" ? `${diagonal}M0 0L${c(t)} ${c(t)}` : diagonal;
79
+ return {
80
+ size: t,
81
+ d,
82
+ strokeWidth
83
+ };
84
+ }
85
+ function harveyWedgePath(cx, cy, r, q) {
86
+ let f = q / 4, a = 2 * Math.PI * f, ex = cx + r * Math.sin(a), ey = cy - r * Math.cos(a), large = f > 0.5 ? 1 : 0;
87
+ return `M${fmtPathNumber(cx)} ${fmtPathNumber(cy)}L${fmtPathNumber(cx)} ${fmtPathNumber(cy - r)}A${fmtPathNumber(r)} ${fmtPathNumber(r)} 0 ${large} 1 ${fmtPathNumber(ex)} ${fmtPathNumber(ey)}Z`;
88
+ }
89
+ var POINTER_TRANSPARENT_PARTS = /* @__PURE__ */ new Set(["shadingOverFill", "bandEdge"]);
90
+
91
+ // src/core/colorRecipes.ts
92
+ var SEQUENTIAL_FLOOR = 0.15;
93
+ function sequentialShare(value, min, max) {
94
+ return max <= min ? max > 0 ? 0.5 : 0 : min <= 0 ? max > 0 ? value / max : 0 : SEQUENTIAL_FLOOR + (1 - SEQUENTIAL_FLOOR) * (value - min) / (max - min);
95
+ }
96
+ var BAND_STROKE_CONTRAST_FLOOR = 3.1, CONTEXT_STROKE_SEPARATION_FLOOR = 1.3;
97
+ function clearsLineBand(theme, paint) {
98
+ let css = paintColor(theme, paint);
99
+ return contrastRatio(css, theme.color.background) >= BAND_STROKE_CONTRAST_FLOOR && contrastRatio(css, theme.color.others) >= BAND_STROKE_CONTRAST_FLOOR;
100
+ }
101
+ var lineBandContrast = (theme, css) => Math.min(contrastRatio(css, theme.color.background), contrastRatio(css, theme.color.others));
102
+ function lineBandPaint(theme, paint, seriesId) {
103
+ let clearsBandContrast = (paint2) => clearsLineBand(theme, paint2);
104
+ if (clearsBandContrast(paint)) return paint;
105
+ let fallbackToken = "token" in paint ? paint.token : "inkMuted";
106
+ for (let step = 1; step <= 200; step++) {
107
+ let inkShare = step / 200, candidate = mixedPaint(paint, { token: "markInk" }, 1 - inkShare, fallbackToken);
108
+ if (clearsBandContrast(candidate)) return candidate;
109
+ }
110
+ throw new NormalizeError(
111
+ "line-band-contrast-exhausted",
112
+ "annotations",
113
+ `series '${seriesId}' cannot reach ${BAND_STROKE_CONTRAST_FLOOR.toFixed(1)}:1 against the page and band`,
114
+ "use a stronger ink token or lighter band"
115
+ );
116
+ }
117
+ function lineBandAuthoredWarnings(theme, base, seriesId, authoredSource, authoredPaint) {
118
+ if (clearsLineBand(theme, base)) return [];
119
+ let start = paintColor(theme, base), authored = authoredPaint ? `${paintColor(theme, authoredPaint)}, faded to ${start}` : start, drawn = paintColor(theme, lineBandPaint(theme, base, seriesId));
120
+ return [{
121
+ code: "line-band-authored-contrast",
122
+ severity: "warn",
123
+ message: `series '${seriesId}' has the authored ${authoredSource} colour ${authored}, which reaches ${lineBandContrast(theme, start).toFixed(2)}:1 against the page and band; it is drawn as ${drawn} (${lineBandContrast(theme, drawn).toFixed(2)}:1, floor ${BAND_STROKE_CONTRAST_FLOOR.toFixed(1)}:1)`,
124
+ suggest: "choose a darker colour or a lighter band"
125
+ }];
126
+ }
127
+ var contextPaintAtShare = (inkShare) => inkShare === 0 ? { token: "neutralLight" } : mixedPaint({ token: "neutralLight" }, { token: "markInk" }, 1 - inkShare, "neutralLight");
128
+ function lineContextPaint(theme, rank, contextRungCount, seriesId) {
129
+ let paintCss = (paint) => paintColor(theme, paint), clearsBandContrast = (paint) => clearsLineBand(theme, paint), minimumSafeShare;
130
+ for (let step = 0; step <= 200; step++) {
131
+ let share = step / 200, candidate = contextPaintAtShare(share);
132
+ if (clearsBandContrast(candidate)) {
133
+ minimumSafeShare = share;
134
+ break;
135
+ }
136
+ }
137
+ if (minimumSafeShare === void 0)
138
+ throw new NormalizeError(
139
+ "line-band-contrast-exhausted",
140
+ "annotations",
141
+ `series '${seriesId}' cannot reach ${BAND_STROKE_CONTRAST_FLOOR.toFixed(1)}:1 against the page and band`,
142
+ "use a stronger ink token or lighter band"
143
+ );
144
+ let basePaint = contextPaintAtShare(minimumSafeShare), availableContrast = contrastRatio(paintCss(basePaint), paintCss({ token: "markInk" })), rungSeparation = Math.pow(availableContrast, 1 / Math.max(1, contextRungCount));
145
+ if (rungSeparation < CONTEXT_STROKE_SEPARATION_FLOOR)
146
+ throw new NormalizeError(
147
+ "line-band-hierarchy-exhausted",
148
+ "annotations",
149
+ `${contextRungCount} context levels leave ${rungSeparation.toFixed(2)}:1 between strokes after band contrast`,
150
+ `use fewer series, a lighter band, or ${CONTEXT_STROKE_SEPARATION_FLOOR.toFixed(1)}:1 per level`
151
+ );
152
+ let targetFromBase = Math.pow(rungSeparation, rank), separatedShare;
153
+ for (let step = Math.ceil(minimumSafeShare * 200); step <= 200; step++) {
154
+ let share = step / 200;
155
+ if (contrastRatio(paintCss(basePaint), paintCss(contextPaintAtShare(share))) >= targetFromBase) {
156
+ separatedShare = share;
157
+ break;
158
+ }
159
+ }
160
+ if (separatedShare === void 0)
161
+ throw new NormalizeError(
162
+ "line-band-hierarchy-exhausted",
163
+ "annotations",
164
+ `series '${seriesId}' cannot separate context levels after band contrast`,
165
+ "use fewer context series or a lighter band"
166
+ );
167
+ return contextPaintAtShare(separatedShare);
168
+ }
169
+ function lineApartPaint(theme, share, top, apartFrom, darker) {
170
+ darker && darker.pairs.every(([a, b]) => palettePerceptualDistance(paintColor(theme, contextPaintAtShare(a)), paintColor(theme, contextPaintAtShare(b))) >= PALETTE_NORMAL_FLOOR) && (share = darker.share);
171
+ let others = apartFrom.map((paint) => paintColor(theme, paint)), step = Math.round(share * 100);
172
+ for (; step < Math.round(top * 100) && others.some((other) => palettePerceptualDistance(paintColor(theme, contextPaintAtShare(step / 100)), other) < PALETTE_NORMAL_FLOOR); ) step++;
173
+ return contextPaintAtShare(step / 100);
174
+ }
175
+ function lineForecastPaint(paint, theme, crossesBand) {
176
+ for (let share = 0.8; share < 1; share += 0.025) {
177
+ let candidate = mixedPaint(paint, { token: "background" }, share, "token" in paint ? paint.token : "neutral");
178
+ if (contrastRatio(paintColor(theme, candidate), theme.color.background) >= 3 && (!crossesBand || clearsLineBand(theme, candidate))) return candidate;
179
+ }
180
+ return contrastRatio(paintColor(theme, paint), theme.color.background) >= 3 ? paint : lineBandPaint(theme, paint, "forecast");
181
+ }
182
+ function paintAmount(target, baseCss, background) {
183
+ let lo = 0, hi = 1;
184
+ for (let i = 0; i < 40; i++) {
185
+ let mid = (lo + hi) / 2;
186
+ contrastRatio(tint(baseCss, mid, background), background) > target ? lo = mid : hi = mid;
187
+ }
188
+ let amount = (lo + hi) / 2;
189
+ for (; amount > 0 && contrastRatio(tint(baseCss, amount, background), background) < target; ) amount = Math.max(0, amount - 1 / 512);
190
+ return amount;
191
+ }
192
+ function fanPaintStep(centrePaint, baseCss, background, amount) {
193
+ return { paint: "css" in centrePaint ? mixedPaint(centrePaint, { token: "background" }, 1 - amount, "highlight") : { ...centrePaint, tint: amount }, css: tint(baseCss, amount, background) };
194
+ }
195
+ function preferredFanPaints(centrePaint, baseCss, background, showBounds) {
196
+ let amounts = [0.82, 0.65];
197
+ if (showBounds) {
198
+ let innerContrast = contrastRatio(tint(baseCss, amounts[1], background), background), centreContrast = contrastRatio(baseCss, background);
199
+ amounts.push(paintAmount(Math.sqrt(innerContrast * centreContrast), baseCss, background));
200
+ }
201
+ let ladder = amounts.map((amount) => fanPaintStep(centrePaint, baseCss, background, amount)), colors = [background, ...ladder.map((step) => step.css), baseCss];
202
+ return colors.slice(1).every((color, index) => contrastRatio(colors[index], color) >= 1.2) ? ladder : void 0;
203
+ }
204
+ function fanPaintSteps(theme, centrePaint, bandCount, showBounds, seriesId, deEmphasized) {
205
+ let baseCss = paintColor(theme, centrePaint), background = theme.color.background, cBase = contrastRatio(baseCss, background), capacity = 0;
206
+ for (let acc = 1.2; acc <= cBase + 1e-9; acc *= 1.2) capacity++;
207
+ let needed = bandCount + 1 + (showBounds ? 1 : 0), rungs = Math.max(needed, Math.min(5, capacity));
208
+ if (capacity < needed) throw new NormalizeError(
209
+ "fan-tint-exhausted",
210
+ "fan.bands",
211
+ `series '${seriesId}' (${baseCss}) has ${cBase.toFixed(2)}:1 contrast on '${theme.name}': ${capacity} distinguishable washes at ${1.2.toFixed(2)}:1; ${bandCount} bands plus centre${showBounds ? " and bounds" : ""} need ${needed}`,
212
+ `use fewer bands${showBounds ? ", disable showBounds to save one rung" : ""}${deEmphasized ? `, highlight '${seriesId}'` : ""}, or a darker fill; the current washes cannot be distinguished`
213
+ );
214
+ let preferred = bandCount === 2 ? preferredFanPaints(centrePaint, baseCss, background, showBounds) : void 0;
215
+ if (preferred) return preferred;
216
+ let fanLadder = [];
217
+ for (let i = 1; i <= bandCount + (showBounds ? 1 : 0); i++) {
218
+ let amount = paintAmount(Math.pow(cBase, i / rungs), baseCss, background);
219
+ fanLadder.push(fanPaintStep(centrePaint, baseCss, background, amount));
220
+ }
221
+ return fanLadder;
222
+ }
223
+ function bulletBandPaints(theme, count, poor, good, warnings = [], light = !1) {
224
+ let key = JSON.stringify([
225
+ count,
226
+ light,
227
+ poor,
228
+ good,
229
+ paintColor(theme, poor),
230
+ paintColor(theme, good),
231
+ paintColor(theme, { token: "background" }),
232
+ paintColor(theme, { token: "markInk" })
233
+ ]), ladder = bulletLadders.get(key);
234
+ if (!ladder) {
235
+ let own2 = [];
236
+ ladder = { paints: bulletLadder(theme, count, poor, good, own2, light), warnings: own2 }, bulletLadders.size >= 256 && bulletLadders.clear(), bulletLadders.set(key, ladder);
237
+ }
238
+ for (let warning of ladder.warnings) warnings.push({ ...warning });
239
+ return [...ladder.paints];
240
+ }
241
+ var bulletLadders = /* @__PURE__ */ new Map();
242
+ function bulletLadder(theme, count, poor, good, warnings, light) {
243
+ let BAND_STEP = (light ? 0.06 : PALETTE_NORMAL_FLOOR / 100) + 5e-3, lightness = (paint) => oklabLightness(paintColor(theme, paint)) ?? 0, needed = BAND_STEP * Math.max(0, count - 1), ink = { token: "markInk" }, ladderEnd = (from, to) => {
244
+ let lastL2 = lightness(to);
245
+ if (count <= 1 || Math.abs(lightness(from) - lastL2) >= needed) return from;
246
+ let low = 0, high = 1, reach = lightness(mixedPaint(from, ink, 0)) - lastL2;
247
+ if (Math.abs(reach) < needed) return from;
248
+ for (let step = 0; step < 20; step++) {
249
+ let weight = (low + high) / 2;
250
+ Math.abs(lightness(mixedPaint(from, ink, 1 - weight)) - lastL2) >= needed ? high = weight : low = weight;
251
+ }
252
+ return mixedPaint(from, ink, 1 - high);
253
+ }, inkCss = paintColor(theme, ink), page = { token: "background" }, pageL = lightness(page), toPage = (paint, weight) => weight === 0 ? paint : mixedPaint(paint, page, 1 - weight), clears = (weight) => contrastRatio(inkCss, paintColor(theme, ladderEnd(toPage(poor, weight), toPage(good, weight)))) >= MARK_CONTRAST_FLOOR;
254
+ if (light && count > 1) {
255
+ if (Math.abs(lightness(good) - pageL) > 0.06) {
256
+ let low = 0, high = 1;
257
+ for (let step = 0; step < 16; step++) {
258
+ let weight = (low + high) / 2;
259
+ Math.abs(lightness(toPage(good, weight)) - pageL) >= 0.06 ? low = weight : high = weight;
260
+ }
261
+ good = toPage(good, low);
262
+ }
263
+ let far = ladderEnd(poor, good), goodL = lightness(good);
264
+ if (Math.abs(lightness(far) - goodL) > needed) {
265
+ let low = 0, high = 1;
266
+ for (let step = 0; step < 20; step++) {
267
+ let weight = (low + high) / 2;
268
+ Math.abs(lightness(mixedPaint(far, good, weight)) - goodL) >= needed ? high = weight : low = weight;
269
+ }
270
+ poor = mixedPaint(far, good, high);
271
+ } else poor = far;
272
+ } else if (count > 1 && !clears(0) && Math.abs(lightness(good) - pageL) > 0.06) {
273
+ let low = 0, high = 1;
274
+ for (let step = 0; step < 16; step++) {
275
+ let weight = (low + high) / 2;
276
+ Math.abs(lightness(toPage(good, weight)) - pageL) >= 0.06 ? low = weight : high = weight;
277
+ }
278
+ let most = low;
279
+ if (clears(most)) {
280
+ low = 0, high = most;
281
+ for (let step = 0; step < 16; step++) {
282
+ let weight = (low + high) / 2;
283
+ clears(weight) ? high = weight : low = weight;
284
+ }
285
+ poor = toPage(poor, high), good = toPage(good, high);
286
+ }
287
+ }
288
+ let lastL = lightness(good), dark = ladderEnd(poor, good), firstL = lightness(dark), span = lastL - firstL;
289
+ return count > 1 && Math.abs(span) < 0.06 * (count - 1) && warnings.push({
290
+ code: "band-lightness-insufficient",
291
+ severity: "warn",
292
+ message: `${count} bands cannot keep a 0.06 lightness step and separate the measure within the theme's neutral range; authored bands and colors remain`
293
+ }), Array.from({ length: count }, (_, index) => {
294
+ if (count > 1 && index === 0) return dark;
295
+ if (count > 1 && index === count - 1) return good;
296
+ let fraction = count === 1 ? 0.5 : index / (count - 1);
297
+ if (Math.abs(span) < 0.06 * Math.max(1, count - 1)) return mixedPaint(dark, good, 1 - fraction);
298
+ let target = firstL + span * fraction, low = 0, high = 1;
299
+ for (let step = 0; step < 16; step++) {
300
+ let weight = (low + high) / 2;
301
+ (lightness(mixedPaint(dark, good, 1 - weight)) - target) * Math.sign(span) < 0 ? low = weight : high = weight;
302
+ }
303
+ return mixedPaint(dark, good, 1 - (low + high) / 2);
304
+ });
305
+ }
306
+ function segmentApartPaints(theme, plain, others) {
307
+ let totalCss = paintColor(theme, { token: "total" }), apart = (paint) => contrastRatio(paintColor(theme, paint), totalCss) >= 2, result = [...plain], base = plain.find(apart);
308
+ if (!base) return result;
309
+ let tints = [0.6, 0.35];
310
+ for (let index = 0; index < result.length; index++) {
311
+ if (apart(result[index])) continue;
312
+ let used = [...others, ...result].map((other) => paintColor(theme, other)), weight = tints.find((w) => {
313
+ let candidate = mixedPaint(base, { token: "background" }, w), css = paintColor(theme, candidate);
314
+ return apart(candidate) && used.every((other) => contrastRatio(css, other) >= 1.3);
315
+ });
316
+ weight !== void 0 && (result[index] = mixedPaint(base, { token: "background" }, weight, "neutral"));
317
+ }
318
+ return result;
319
+ }
320
+ function bumpStoryPaints(theme, count) {
321
+ let css = (paint) => paintColor(theme, paint), focus = { token: "focus" }, pool = theme.color.series.map((_, index) => seriesPaint(index)), second = [{ token: "markInk" }, ...pool].find((paint) => palettePerceptualDistance(css(paint), css(focus)) >= PALETTE_NORMAL_FLOOR) ?? focus, result = [focus, second], grey = css({ token: "neutralLight" });
322
+ for (; result.length < count; ) {
323
+ let used = result.map(css), unused = pool.filter((paint) => !used.includes(css(paint)));
324
+ result.push(unused.find((paint) => [...used, grey].every((other) => palettePerceptualDistance(css(paint), other) >= PALETTE_NORMAL_FLOOR)) ?? unused[0] ?? focus);
325
+ }
326
+ return result.slice(0, count);
327
+ }
328
+ function adaptivePaintColor(theme, source) {
329
+ switch (source.kind) {
330
+ case "bump-story":
331
+ return paintColor(theme, bumpStoryPaints(theme, source.count)[source.index]);
332
+ case "segment-apart":
333
+ return paintColor(theme, segmentApartPaints(theme, source.plain, source.others)[source.index]);
334
+ case "line-apart":
335
+ return paintColor(theme, lineApartPaint(theme, source.share, source.top, source.apartFrom, source.darker));
336
+ case "line-band":
337
+ return paintColor(theme, lineBandPaint(theme, source.base, source.seriesId));
338
+ case "line-context":
339
+ return paintColor(theme, lineContextPaint(theme, source.rank, source.rungCount, source.seriesId));
340
+ case "line-forecast":
341
+ return paintColor(theme, lineForecastPaint(source.base, theme, source.crossesBand));
342
+ case "fan-step":
343
+ return paintColor(theme, fanPaintSteps(theme, source.base, source.bandCount, source.showBounds, source.seriesId, source.deEmphasized)[source.index].paint);
344
+ case "bullet-band":
345
+ return paintColor(theme, bulletBandPaints(theme, source.count, source.poor, source.good, [], source.light === !0)[source.index]);
346
+ }
347
+ }
348
+
349
+ // src/core/markVisibility.ts
350
+ function markVisibilityFloor(background) {
351
+ return contrastRatio(background, "#FFFFFF") > contrastRatio(background, "#000000") ? 3 : 1.4;
352
+ }
353
+ var CANDIDATES = ["inkMuted", "axis", "ink", "inkInverse"];
354
+ function fillEdgesOff(theme) {
355
+ return theme.marks?.contrastEdge !== !0;
356
+ }
357
+ function labelPlate(rect) {
358
+ return { x: rect.x - 3, y: rect.y - 1, w: rect.w + 6, h: rect.h + 2 };
359
+ }
360
+ var LABEL_PLATE_RADIUS = 2;
361
+ function haloHatchedInsideLabels(nodes, labels) {
362
+ let rects = nodes.filter((node) => node.t === "rect").reverse();
363
+ if (rects.some((node) => isHatchPattern(node.pattern)))
364
+ for (let label of labels) {
365
+ if (label.hidden || label.backing) continue;
366
+ let x = label.rect.x + label.rect.w / 2, y = label.rect.y + label.rect.h / 2, host = rects.find((node) => {
367
+ let left = node.rect.x + (node.tx ?? 0), top = node.rect.y + (node.ty ?? 0);
368
+ return x >= left && x <= left + node.rect.w && y >= top && y <= top + node.rect.h;
369
+ });
370
+ isHatchPattern(host?.pattern) && (label.plate = !0, label.halo = !1, "token" in label.ink && (label.ink.token === "ink" || label.ink.token === "inkInverse" || label.ink.theme?.kind === "contrast-ink") && (label.ink = { token: "ink" }));
371
+ }
372
+ }
373
+ function separationStroke(fillCss, backingCss, theme, surface = !1) {
374
+ let onPage = surface || contrastRatio(backingCss, theme.color.background) === 1;
375
+ if (onPage && fillEdgesOff(theme)) return;
376
+ let floor = onPage ? markVisibilityFloor(theme.color.background) : MARK_CONTRAST_FLOOR;
377
+ if (!(contrastRatio(fillCss, backingCss) >= floor))
378
+ for (let token of CANDIDATES) {
379
+ let css = theme.color[token];
380
+ if (contrastRatio(css, fillCss) >= floor && contrastRatio(css, backingCss) >= floor)
381
+ return { stroke: { token }, strokeWidth: theme.pattern.outlineStrokeWidth };
382
+ }
383
+ }
384
+ function segmentSeparationStroke(fill, backingCss, theme) {
385
+ if (fillEdgesOff(theme)) return;
386
+ let fillCss = paintColor(theme, fill);
387
+ if (!parseColor(fillCss)) return separationStroke(fillCss, backingCss, theme);
388
+ let floor = markVisibilityFloor(theme.color.background);
389
+ if (contrastRatio(fillCss, backingCss) >= floor) return;
390
+ let luminance = (css) => relativeLuminance(parseColor(css)), token = luminance(theme.color.ink) < luminance(theme.color.inkInverse) ? "ink" : "inkInverse";
391
+ for (let step = 1; step < 100; step++) {
392
+ let stroke = mixedPaint(fill, { token }, 1 - step / 100), css = paintColor(theme, stroke);
393
+ if (luminance(css) < luminance(fillCss) && contrastRatio(css, fillCss) >= floor && contrastRatio(css, backingCss) >= floor)
394
+ return { stroke, strokeWidth: theme.pattern.outlineStrokeWidth };
395
+ }
396
+ return separationStroke(fillCss, backingCss, theme);
397
+ }
398
+ function ruleEdge(fill, grounds, theme) {
399
+ let background = theme.color.background;
400
+ if (contrastRatio(background, "#FFFFFF") > contrastRatio(background, "#000000")) return;
401
+ let fillCss = paintColor(theme, fill);
402
+ if (!parseColor(fillCss)) return;
403
+ let clears = (css) => grounds.every((ground) => contrastRatio(css, ground) >= MARK_CONTRAST_FLOOR);
404
+ if (clears(fillCss)) return;
405
+ if ("theme" in fill && fill.theme?.kind === "stack-ramp" && clears(paintTokenColor(theme, "neutral")))
406
+ return { stroke: { token: "neutral" }, strokeWidth: strokeToken(theme, "hair") };
407
+ let luminance = (css) => relativeLuminance(parseColor(css)), token = luminance(theme.color.ink) < luminance(theme.color.inkInverse) ? "ink" : "inkInverse", role = "token" in fill ? fill.token : void 0;
408
+ for (let step = 1; step <= 100; step++) {
409
+ let stroke = mixedPaint(fill, { token }, 1 - step / 100, role);
410
+ if (clears(paintColor(theme, stroke))) return { stroke, strokeWidth: strokeToken(theme, "rule") };
411
+ }
412
+ }
413
+ function ruleStroke(rule, part, theme, strict) {
414
+ if (markOutlineOff(rule.fill, theme) || sliceOutlineOff(part, theme)) return rule.fallback;
415
+ let fill = paintColor(theme, rule.fill), backing = (rule.alternateBackings ?? []).reduce((nearest, paint) => {
416
+ let candidate = paintColor(theme, paint);
417
+ return contrastRatio(fill, candidate) < contrastRatio(fill, nearest) ? candidate : nearest;
418
+ }, paintColor(theme, rule.backing)), base = rule.fillStep ? segmentSeparationStroke(rule.fill, backing, theme) : separationStroke(fill, backing, theme, rule.surface === !0), onPage = rule.fillStep === !0 || rule.surface === !0 || contrastRatio(backing, theme.color.background) === 1;
419
+ if (!strict || theme.marks?.contrastEdge !== !0 || !onPage || markVisibilityFloor(theme.color.background) === MARK_CONTRAST_FLOOR) return base ?? rule.fallback;
420
+ let grounds = [theme.color.background, backing, ...(rule.grounds ?? []).map((paint) => paintColor(theme, paint))];
421
+ return base && grounds.every((ground) => contrastRatio(paintColor(theme, base.stroke), ground) >= MARK_CONTRAST_FLOOR) ? base : ruleEdge(rule.fill, grounds, theme) ?? rule.fallback;
422
+ }
423
+ function autoInk(ink) {
424
+ return "token" in ink && (ink.token === "ink" || ink.token === "inkInverse" || ink.theme?.kind === "contrast-ink");
425
+ }
426
+ function haloOverpaintedInsideLabels(nodes, labels, theme) {
427
+ let ownerKey = (owner) => `${owner?.seriesId ?? ""}|${owner?.categoryId ?? ""}|${owner?.segmentId ?? ""}`, painted = [];
428
+ for (let node of nodes)
429
+ node.t === "rect" && String(node.id).startsWith("mark:") && painted.push({
430
+ x: node.rect.x + (node.tx ?? 0),
431
+ y: node.rect.y + (node.ty ?? 0),
432
+ w: node.rect.w,
433
+ h: node.rect.h,
434
+ owner: ownerKey(node.owner),
435
+ fill: node.fill,
436
+ ...isHatchPattern(node.pattern) || node.pattern === "outline" ? { pattern: node.pattern } : {}
437
+ });
438
+ let marked = 0;
439
+ for (let label of labels) {
440
+ if (label.hidden || label.halo || label.backing || label.leader || !String(label.slot).startsWith("inside")) continue;
441
+ let cx = label.rect.x + label.rect.w / 2, cy = label.rect.y + label.rect.h / 2, topmost;
442
+ for (let mark of painted)
443
+ cx >= mark.x && cx <= mark.x + mark.w && cy >= mark.y && cy <= mark.y + mark.h && (topmost = mark);
444
+ if (topmost === void 0) continue;
445
+ let ownHost = ownerKey(label.owner);
446
+ if (painted.some((mark) => mark.owner === ownHost) && topmost.owner !== ownHost) {
447
+ let r = label.rect, covered = r.x >= topmost.x && r.y >= topmost.y && r.x + r.w <= topmost.x + topmost.w && r.y + r.h <= topmost.y + topmost.h;
448
+ if (autoInk(label.ink) && topmost.pattern === void 0 && covered)
449
+ label.ink = contrastInkPaint(topmost.fill);
450
+ else if (label.halo = !0, autoInk(label.ink)) {
451
+ let background = theme.color.background;
452
+ label.ink = { token: contrastRatio(theme.color.inkInverse, background) > contrastRatio(theme.color.ink, background) ? "inkInverse" : "ink" };
453
+ }
454
+ marked++;
455
+ }
456
+ }
457
+ return marked;
458
+ }
459
+ function labelsOnFills(geometry) {
460
+ let rects = geometry.scene.filter((node) => node.t === "rect" && String(node.id).startsWith("mark:"));
461
+ if (rects.length === 0) return;
462
+ let texts = new Map(geometry.scene.flatMap((node) => node.t === "text" ? [[node.id, node]] : []));
463
+ for (let label of geometry.labels) {
464
+ if (label.hidden || !label.nodeId || label.backing) continue;
465
+ let text = texts.get(label.nodeId);
466
+ if (!text?.halo) continue;
467
+ let { x, y, w, h } = label.rect;
468
+ if (geometry.debug?.occupied.some((claim) => claim.part === "referenceLine" && x < claim.rect.x + claim.rect.w && x + w > claim.rect.x && y < claim.rect.y + claim.rect.h && y + h > claim.rect.y)) continue;
469
+ let host;
470
+ for (let rect of rects) {
471
+ let left = rect.rect.x + (rect.tx ?? 0), top = rect.rect.y + (rect.ty ?? 0);
472
+ x + w / 2 >= left && x + w / 2 <= left + rect.rect.w && y + h / 2 >= top && y + h / 2 <= top + rect.rect.h && (host = x >= left - 0.5 && x + w <= left + rect.rect.w + 0.5 && y >= top - 0.5 && y + h <= top + rect.rect.h + 0.5 ? rect : void 0);
473
+ }
474
+ if (!host || host.pattern || !autoInk(text.ink)) continue;
475
+ let ink = contrastInkPaint(host.fill);
476
+ text.halo = !1, text.ink = ink, label.halo = !1, label.ink = ink;
477
+ }
478
+ }
479
+ function emphasisInk(theme, ground = { token: "background" }) {
480
+ let recipe = { kind: "emphasis-ink", ground };
481
+ return { token: paintColor(theme, { token: "ink", theme: recipe }) === theme.color.ink ? "ink" : "focus", theme: recipe };
482
+ }
483
+ var FILL_PARTS = /* @__PURE__ */ new Set(["segment", "bar", "area", "fanBand", "phaseFill", "gapFill"]);
484
+ function casingUnderFills(scene) {
485
+ let firstFill = scene.findIndex((node) => FILL_PARTS.has(node.part));
486
+ if (firstFill < 0) return scene;
487
+ let moved = scene.filter((node, index) => node.part === "lineCasing" && !(node.t === "path" && node.overFills) && index > firstFill);
488
+ if (moved.length === 0) return scene;
489
+ let rest = scene.filter((node) => !moved.includes(node));
490
+ return [...rest.slice(0, firstFill), ...moved, ...rest.slice(firstFill)];
491
+ }
492
+ function markOutlineOff(fill, theme) {
493
+ let { marks } = theme;
494
+ return "token" in fill && (marks?.restOutline === !1 && fill.token === "rest" || marks?.othersOutline === !1 && fill.token === "othersMark");
495
+ }
496
+ var isOthersFill = (fill) => "token" in fill && fill.token === "othersMark";
497
+ function othersSeparation(fill, theme) {
498
+ if (!(!isOthersFill(fill) || markOutlineOff(fill, theme)))
499
+ return separationStroke(paintColor(theme, fill), theme.color.background, theme);
500
+ }
501
+ function sliceOutlineOff(part, theme) {
502
+ return theme.marks?.sliceOutline === !1 && part === "slice";
503
+ }
504
+ function repaintSeparation(node, theme) {
505
+ if (node.t !== "rect" && node.t !== "path") return node;
506
+ let rule = node.separation;
507
+ if (!rule || rule.pattern) return node;
508
+ let stroke = ruleStroke(rule, node.part, theme, rule.strict === !0), oldWidth = node.t === "path" ? node.width : node.strokeWidth;
509
+ if (JSON.stringify(node.stroke) === JSON.stringify(stroke?.stroke) && oldWidth === stroke?.strokeWidth) return node;
510
+ let result = { ...node };
511
+ return delete result.stroke, result.t === "path" ? delete result.width : delete result.strokeWidth, stroke && (result.stroke = stroke.stroke, result.t === "path" ? result.width = stroke.strokeWidth : result.strokeWidth = stroke.strokeWidth), result;
512
+ }
513
+ var VALUE_LABEL_KINDS = /* @__PURE__ */ new Set(["point", "segment", "insidePie", "outsidePie"]), TOTAL_LABEL_KINDS = /* @__PURE__ */ new Set(["total", "grandTotal"]);
514
+ function namesOnly(content, override) {
515
+ return typeof override == "string" && !override.includes("${value}") || content != null && !content.some((part) => part === "absolute" || part === "percent") ? { printsFor: [] } : {};
516
+ }
517
+ var markKey = (owner) => `${owner?.seriesId ?? ""}|${owner?.categoryId ?? ""}|${owner?.segmentId ?? ""}`, separated = (node) => (node.t === "rect" || node.t === "path") && node.separation !== void 0, KEY_PARTS = /* @__PURE__ */ new Set(["swatch", "labelSwatch"]);
518
+ function fillEdges(geometry, theme) {
519
+ let drawn = new Set(geometry.labels.filter((label) => !label.hidden).map((label) => label.id)), footnoteIds = new Set(geometry.frame?.footnoteNodeIds ?? []), squeeze = (text) => text.replace(/\s+/g, ""), footnotes = squeeze(geometry.scene.flatMap((node) => node.t === "text" && footnoteIds.has(node.id) ? [node.lines.join(" ")] : []).join(" ")), inFootnote = (text) => text !== void 0 && text !== "" && footnotes.includes(squeeze(text)), noteNames = (label) => label.noted === !0 && label.noteCounted !== !0 && ([...footnoteIds].some((id) => label.noteLocation?.includes(`(${id})`) === !0) || inFootnote(label.noteText)), shows = (label) => !label.hidden || label.printedIn !== void 0 && drawn.has(label.printedIn) || noteNames(label), printed = new Set(geometry.labels.filter((label) => VALUE_LABEL_KINDS.has(label.kind) && shows(label)).flatMap((label) => (label.printsFor ?? [label.owner]).map(markKey))), totals = new Set(geometry.labels.filter((label) => TOTAL_LABEL_KINDS.has(label.kind) && shows(label) && label.printsFor?.length !== 0 && label.owner.seriesId === void 0 && label.owner.categoryId !== void 0).map((label) => label.owner.categoryId)), own2 = (node) => separated(node) && node.tx === void 0 && node.ty === void 0 && !KEY_PARTS.has(node.part), marksIn = /* @__PURE__ */ new Map();
520
+ for (let node of geometry.scene) {
521
+ let category = node.owner.categoryId;
522
+ own2(node) && category !== void 0 && marksIn.set(category, (marksIn.get(category) ?? 0) + 1);
523
+ }
524
+ let segments = geometry.scene.filter((node) => node.t === "rect" && node.part === "segment" && node.tx === void 0 && node.ty === void 0), rule = strokeToken(theme, "rule");
525
+ geometry.scene = geometry.scene.map((node) => {
526
+ if (!own2(node)) return node;
527
+ let category = node.owner.categoryId, isPrinted = node.separation.printed === !0 || printed.has(markKey(node.owner)) || inFootnote(node.separation.notedAs) || category !== void 0 && totals.has(category) && marksIn.get(category) === 1, bounds = node.t === "rect" && node.part === "segment" ? stackBounds(node, segments, rule) : void 0;
528
+ return !isPrinted && !bounds ? node : { ...node, separation: { ...node.separation, ...isPrinted ? { printed: !0 } : {}, ...bounds ? { bounds } : {} } };
529
+ }), geometry.scene = decideFillEdges(geometry.scene, () => theme, !1);
530
+ let isSeam = (node) => node.t === "line" && node.part === "segmentSeam", lifted = geometry.scene.filter((node) => node.t === "rect" && node.part === "segment" && node.tx === void 0 && node.ty === void 0 && node.separation !== void 0 && !node.separation.pattern && !node.separation.empty && !node.separation.printed && Math.min(node.rect.w, node.rect.h) <= 2 * rule);
531
+ if (lifted.length > 0 && geometry.scene.some(isSeam)) {
532
+ let rest = geometry.scene.filter((node) => !lifted.includes(node)), at = rest.length - [...rest].reverse().findIndex(isSeam);
533
+ geometry.scene = [...rest.slice(0, at), ...lifted, ...rest.slice(at)];
534
+ }
535
+ }
536
+ function marksOnBands(scene) {
537
+ let bands = scene.filter((node) => node.t === "rect" && node.part === "band" && node.owner.annotationId !== void 0 && node.fill !== void 0);
538
+ if (bands.length === 0) return [];
539
+ let crosses = (a, b) => a.x < b.x + b.w && b.x < a.x + a.w && a.y < b.y + b.h && b.y < a.y + a.h, pairs = /* @__PURE__ */ new Map();
540
+ for (let node of scene) {
541
+ if (node.t !== "rect" || !node.separation || node.tx !== void 0 || node.ty !== void 0) continue;
542
+ let name = node.owner.seriesId ?? node.owner.categoryId;
543
+ if (name === void 0) continue;
544
+ let { fill, stroke, strokeWidth, pattern, hatchGround, hatch, hatchEdge } = node, paints = { fill, stroke, strokeWidth, pattern, hatchGround, hatch, hatchEdge };
545
+ for (let band of bands) {
546
+ let key = JSON.stringify([name, paints, band.fill]);
547
+ !pairs.has(key) && crosses(band.rect, node.rect) && pairs.set(key, { name, owner: node.owner, ...paints, band: band.fill });
548
+ }
549
+ }
550
+ return [...pairs.values()];
551
+ }
552
+ function stackBounds(node, segments, seam) {
553
+ let near = (a, b) => Math.abs(a - b) < 0.01, { x, y, w, h } = node.rect, covers = (from, to, oFrom, oTo) => oFrom <= from + 0.01 && oTo >= to - 0.01, find = (test) => segments.find((o) => o !== node && test(o.rect)), vertical = [find((o) => near(o.y + o.h, y) && covers(x, x + w, o.x, o.x + o.w)), find((o) => near(o.y, y + h) && covers(x, x + w, o.x, o.x + o.w))];
554
+ if (vertical[0] && vertical[1] && h > 2 * seam) return vertical.map((o) => o.fill);
555
+ let horizontal = [find((o) => near(o.x + o.w, x) && covers(y, y + h, o.y, o.y + o.h)), find((o) => near(o.x, x + w) && covers(y, y + h, o.y, o.y + o.h))];
556
+ if (horizontal[0] && horizontal[1] && w > 2 * seam) return horizontal.map((o) => o.fill);
557
+ }
558
+ function decideFillEdges(scene, themeOf, translated) {
559
+ let joins = (node) => separated(node) && !node.separation.pattern && !node.separation.empty && (translated || node.tx === void 0 && node.ty === void 0), groupOf = (node) => `${JSON.stringify(node.separation.fill)}|${node.tx ?? 0},${node.ty ?? 0}`, needs = (node) => {
560
+ let rule = node.separation, theme = themeOf(node);
561
+ if (rule.printed) return !1;
562
+ let page = theme.color.background;
563
+ return rule.bounds?.every((paint) => contrastRatio(paintColor(theme, paint), page) >= MARK_CONTRAST_FLOOR) ? !1 : JSON.stringify(ruleStroke(rule, node.part, theme, !0)) !== JSON.stringify(ruleStroke(rule, node.part, theme, !1));
564
+ }, groups = /* @__PURE__ */ new Map();
565
+ for (let node of scene) {
566
+ if (!joins(node) || KEY_PARTS.has(node.part)) continue;
567
+ let key = groupOf(node);
568
+ groups.get(key) !== !0 && groups.set(key, needs(node));
569
+ }
570
+ return scene.map((node) => {
571
+ if (!joins(node)) return node;
572
+ let want = groups.get(groupOf(node)) === !0;
573
+ if (node.separation.strict === !0 === want) return node;
574
+ let separation = { ...node.separation };
575
+ return want ? separation.strict = !0 : delete separation.strict, repaintSeparation({ ...node, separation }, themeOf(node));
576
+ });
577
+ }
578
+ function withSegmentSeams(nodes, theme, oneBlock) {
579
+ let segments = nodes.filter((node) => node.t === "rect" && node.part === "segment" && node.rect.w > 0 && node.rect.h > 0), seams = [], near = (a, b) => Math.abs(a - b) < 0.01, seam = (a, x1, y1, x2, y2) => seams.push({
580
+ t: "line",
581
+ id: `seam:${a.id}:${seams.length}`,
582
+ x1,
583
+ y1,
584
+ x2,
585
+ y2,
586
+ stroke: { token: "background" },
587
+ width: strokeToken(theme, "seam"),
588
+ owner: a.owner,
589
+ part: "segmentSeam",
590
+ ...a.tx ? { tx: a.tx } : {},
591
+ ...a.ty ? { ty: a.ty } : {}
592
+ }), order = new Map(nodes.map((node, index) => [node, index])), underlaps = /* @__PURE__ */ new Map(), bucket = (v) => Math.floor(v / 0.01), bottoms = /* @__PURE__ */ new Map(), lefts = /* @__PURE__ */ new Map(), unbucketed = [];
593
+ oneBlock || segments.forEach((b, i) => {
594
+ for (let [map, v] of [[bottoms, b.rect.y + b.rect.h], [lefts, b.rect.x]]) {
595
+ let key = bucket(v);
596
+ if (!Number.isSafeInteger(key)) {
597
+ unbucketed.push(i);
598
+ continue;
599
+ }
600
+ let list = map.get(key);
601
+ list ? list.push(i) : map.set(key, [i]);
602
+ }
603
+ });
604
+ let partners = (a) => {
605
+ if (oneBlock) return segments;
606
+ let found = new Set(unbucketed);
607
+ for (let [map, v] of [[bottoms, a.rect.y], [lefts, a.rect.x + a.rect.w]]) {
608
+ let key = bucket(v);
609
+ if (!Number.isSafeInteger(key - 2) || !Number.isSafeInteger(key + 2)) return segments;
610
+ for (let k = key - 2; k <= key + 2; k++) for (let i of map.get(k) ?? []) found.add(i);
611
+ }
612
+ return [...found].sort((p, q) => p - q).map((i) => segments[i]);
613
+ };
614
+ for (let a of segments) for (let b of partners(a)) {
615
+ if (a === b || (a.tx ?? 0) !== (b.tx ?? 0) || (a.ty ?? 0) !== (b.ty ?? 0)) continue;
616
+ if (oneBlock?.(a.owner, b.owner)) {
617
+ let [first, second] = order.get(a) < order.get(b) ? [a, b] : [b, a];
618
+ near(first.rect.x + first.rect.w, second.rect.x) ? underlaps.set(first, { ...first, rect: { ...first.rect, w: first.rect.w + Math.min(1, second.rect.w) } }) : near(second.rect.x + second.rect.w, first.rect.x) && underlaps.set(first, { ...first, rect: { ...first.rect, x: first.rect.x - Math.min(1, second.rect.w), w: first.rect.w + Math.min(1, second.rect.w) } });
619
+ continue;
620
+ }
621
+ let { x, y, w, h } = a.rect, o = b.rect;
622
+ if (near(y, o.y + o.h)) {
623
+ let from = Math.max(x, o.x), to = Math.min(x + w, o.x + o.w);
624
+ to - from > 0.01 && seam(a, from, y, to, y);
625
+ }
626
+ if (near(x + w, o.x)) {
627
+ let from = Math.max(y, o.y), to = Math.min(y + h, o.y + o.h);
628
+ to - from > 0.01 && seam(a, x + w, from, x + w, to);
629
+ }
630
+ }
631
+ let drawn = underlaps.size ? nodes.map((node) => underlaps.get(node) ?? node) : nodes;
632
+ if (seams.length === 0) return drawn;
633
+ let last = nodes.lastIndexOf(segments.at(-1));
634
+ return [...drawn.slice(0, last + 1), ...seams, ...drawn.slice(last + 1)];
635
+ }
636
+ var ANNOTATION_DRAWING_PARTS = /* @__PURE__ */ new Set(["arm", "arrowHead", "bracket", "diffArrow", "leader", "indicator100"]);
637
+ function withoutOrphanAnnotationMarks(geometry) {
638
+ let shown = /* @__PURE__ */ new Set(), hidden = /* @__PURE__ */ new Set();
639
+ for (let label of geometry.labels) {
640
+ let id = label.owner.annotationId;
641
+ id !== void 0 && (label.hidden ? hidden : shown).add(id);
642
+ }
643
+ let orphans = [...hidden].filter((id) => !shown.has(id));
644
+ if (orphans.length === 0) return;
645
+ let drop = new Set(orphans);
646
+ geometry.scene = geometry.scene.filter((node) => !(node.owner.annotationId !== void 0 && drop.has(node.owner.annotationId) && ANNOTATION_DRAWING_PARTS.has(node.part)));
647
+ }
648
+ var REFERENCE_LABEL_CLEARANCE = 3, TEXT_TOUCH_PX = 1;
649
+ function referenceLineClearance(geometry) {
650
+ let scene = geometry.scene, boxes = scene.flatMap((node) => node.t === "rect" && node.part === "referenceCasing" && node.tx === void 0 && node.ty === void 0 ? [node.rect] : []), out = [];
651
+ scene.forEach((node) => {
652
+ if (node.t !== "line" || node.part !== "valueLine" || node.tx !== void 0 || node.ty !== void 0) {
653
+ out.push(node);
654
+ return;
655
+ }
656
+ let horizontal = Math.abs(node.y1 - node.y2) < 1e-6;
657
+ if (!horizontal && Math.abs(node.x1 - node.x2) >= 1e-6) {
658
+ out.push(node);
659
+ return;
660
+ }
661
+ let at = horizontal ? node.y1 : node.x1, [from, to] = horizontal ? [Math.min(node.x1, node.x2), Math.max(node.x1, node.x2)] : [Math.min(node.y1, node.y2), Math.max(node.y1, node.y2)], half = node.width / 2, pad = 1, cuts = [];
662
+ for (let r of boxes) {
663
+ let [across0, across1, along0, along1] = horizontal ? [r.y, r.y + r.h, r.x, r.x + r.w] : [r.x, r.x + r.w, r.y, r.y + r.h];
664
+ across0 - pad >= at + half || across1 + pad <= at - half || along1 + pad <= from || along0 - pad >= to || cuts.push([along0 - pad, along1 + pad]);
665
+ }
666
+ cuts.sort((a, b) => a[0] - b[0]);
667
+ let runs = [], start = from;
668
+ for (let [c0, c1] of cuts)
669
+ c0 > start && runs.push([start, Math.min(c0, to)]), start = Math.max(start, c1);
670
+ start < to && runs.push([start, to]);
671
+ let drawn = runs.filter(([a, b]) => b - a >= 1), point = (along) => horizontal ? `${fmt(along)} ${fmt(at)}` : `${fmt(at)} ${fmt(along)}`;
672
+ if (cuts.length === 0 || drawn.length === 0) {
673
+ out.push(node);
674
+ return;
675
+ }
676
+ let { x1: _x1, y1: _y1, x2: _x2, y2: _y2, t: _t, ...rest } = node;
677
+ out.push({ ...rest, t: "path", d: drawn.map(([a, b]) => `M${point(a)}L${point(b)}`).join("") });
678
+ }), geometry.scene = linesOverFills(linesBehindText(out), (node) => node.tx === void 0 && node.ty === void 0);
679
+ }
680
+ var DATA_MARK_LINE_PARTS = /* @__PURE__ */ new Set([
681
+ "line",
682
+ "lineCasing",
683
+ "areaSeparator",
684
+ "slope",
685
+ "spark",
686
+ "ridge",
687
+ "track",
688
+ "forecastHatch",
689
+ "noDataHatch",
690
+ "highlightRing",
691
+ "segmentSeam",
692
+ "boxMedian",
693
+ "boxWhisker",
694
+ "boxWhiskerCap",
695
+ "stem",
696
+ "rail",
697
+ "rangeRail",
698
+ "rangeCap",
699
+ "target",
700
+ "tie",
701
+ "metric",
702
+ "kpiAttainmentTick",
703
+ "tick",
704
+ "treemapGroup",
705
+ "waffleGroupRule",
706
+ "waffleSubtotal",
707
+ "rowTint",
708
+ "swatch",
709
+ "legendKey",
710
+ "legendTick",
711
+ "axisTitleSwatch",
712
+ "sizeKeyTick",
713
+ "diagramIcon",
714
+ "ganttRule"
715
+ ]), behindText = (node) => (node.t === "line" || node.t === "path" && node.stroke !== void 0 && node.fill === void 0) && !DATA_MARK_LINE_PARTS.has(node.part), FRAME_TEXT_PARTS = /* @__PURE__ */ new Set(["title", "subtitle", "source", "footnote", "note", "footer", "credit"]), GLYPH_TOP = 0.14, GLYPH_BOTTOM = 1.09, TEXT_ASCENT = 0.88;
716
+ function textBreaksLine(scene, x0, x1, top, size) {
717
+ let box = { x0, x1, y0: top + size * GLYPH_TOP, y1: top + size * GLYPH_BOTTOM, ax: x0, ay: top, cos: 1, sin: 0 };
718
+ return scene.some((node) => {
719
+ if (!behindText(node)) return !1;
720
+ let half = (node.t === "line" ? node.width : node.width ?? 1) / 2, dx = node.tx ?? 0, dy = node.ty ?? 0;
721
+ return (straightSegments(node) ?? []).some(([x12, y1, x2, y2]) => segmentInBox([x12 + dx, y1 + dy], [x2 + dx, y2 + dy], box, half + TEXT_TOUCH_PX) !== void 0);
722
+ });
723
+ }
724
+ function glyphBoxes(scene, near) {
725
+ let boxes = [];
726
+ for (let node of scene) {
727
+ if (node.t !== "text" || node.backing || FRAME_TEXT_PARTS.has(node.part)) continue;
728
+ let font = node.font, lineH = font.size * (font.lineHeight ?? 1.2), dx = node.tx ?? 0, dy = node.ty ?? 0, angle = (node.rotate ?? 0) * Math.PI / 180;
729
+ node.lines.forEach((text, index) => {
730
+ if (!text.trim()) return;
731
+ let top = node.y + index * lineH;
732
+ if (angle === 0 && !near(top + font.size * GLYPH_TOP + dy, top + font.size * GLYPH_BOTTOM + dy)) return;
733
+ let width = measureText(text, font).width + (font.letterSpacing ?? 0) * Math.max(0, [...text].length - 1), x0 = node.align === "start" ? node.x : node.align === "end" ? node.x - width : node.x - width / 2;
734
+ boxes.push({
735
+ x0: x0 + dx,
736
+ x1: x0 + width + dx,
737
+ y0: top + font.size * GLYPH_TOP + dy,
738
+ y1: top + font.size * GLYPH_BOTTOM + dy,
739
+ ax: node.x + dx,
740
+ ay: node.y + font.size * TEXT_ASCENT + dy,
741
+ cos: Math.cos(-angle),
742
+ sin: Math.sin(-angle)
743
+ });
744
+ });
745
+ }
746
+ return boxes;
747
+ }
748
+ function segmentInBox(a, b, box, grow) {
749
+ let into = ([x, y]) => box.sin === 0 ? [x, y] : [box.ax + (x - box.ax) * box.cos - (y - box.ay) * box.sin, box.ay + (x - box.ax) * box.sin + (y - box.ay) * box.cos], [x0, y0] = into(a), [x1, y1] = into(b), dx = x1 - x0, dy = y1 - y0, t0 = 0, t1 = 1;
750
+ for (let [p, q] of [[-dx, x0 - (box.x0 - grow)], [dx, box.x1 + grow - x0], [-dy, y0 - (box.y0 - grow)], [dy, box.y1 + grow - y0]]) {
751
+ if (Math.abs(p) < 1e-9) {
752
+ if (q < 0) return;
753
+ continue;
754
+ }
755
+ let r = q / p;
756
+ if (p < 0) {
757
+ if (r > t1) return;
758
+ t0 = Math.max(t0, r);
759
+ } else {
760
+ if (r < t0) return;
761
+ t1 = Math.min(t1, r);
762
+ }
763
+ }
764
+ return t1 - t0 > 1e-6 ? [t0, t1] : void 0;
765
+ }
766
+ function straightSegments(node) {
767
+ if (node.t === "line") return [[node.x1, node.y1, node.x2, node.y2]];
768
+ if (node.t !== "path" || !/^(?:\s*(?:[ML]\s*-?[\d.]+[ ,]\s*-?[\d.]+|[HV]\s*-?[\d.]+))+\s*$/.test(node.d)) return;
769
+ let segments = [], x = 0, y = 0;
770
+ for (let m of node.d.matchAll(/([MLHV])\s*(-?[\d.]+)(?:[ ,]\s*(-?[\d.]+))?/g)) {
771
+ let cmd = m[1], a = Number(m[2]), [nx, ny] = cmd === "H" ? [a, y] : cmd === "V" ? [x, a] : [a, Number(m[3])];
772
+ cmd !== "M" && segments.push([x, y, nx, ny]), x = nx, y = ny;
773
+ }
774
+ return segments;
775
+ }
776
+ function linesBehindText(scene) {
777
+ let reach = [];
778
+ for (let node of scene) {
779
+ if (!behindText(node)) continue;
780
+ let half = (node.t === "line" ? node.width : node.width ?? 1) / 2;
781
+ for (let [, y1, , y2] of straightSegments(node) ?? []) reach.push([Math.min(y1, y2) + (node.ty ?? 0) - half - TEXT_TOUCH_PX, Math.max(y1, y2) + (node.ty ?? 0) + half + TEXT_TOUCH_PX]);
782
+ }
783
+ if (reach.length === 0) return scene;
784
+ let boxes = glyphBoxes(scene, (y0, y1) => reach.some(([a, b]) => a <= y1 && b >= y0));
785
+ return boxes.length === 0 ? scene : scene.map((node) => {
786
+ if (!behindText(node)) return node;
787
+ let segments = straightSegments(node);
788
+ if (!segments) return node;
789
+ let half = (node.t === "line" ? node.width : node.width ?? 1) / 2, dx = node.tx ?? 0, dy = node.ty ?? 0, crossed = !1, runs = segments.flatMap(([x1, y1, x2, y2]) => {
790
+ let a = [x1 + dx, y1 + dy], b = [x2 + dx, y2 + dy], cuts = [];
791
+ for (let box of boxes) {
792
+ if (!segmentInBox(a, b, box, half + TEXT_TOUCH_PX)) continue;
793
+ let cut = segmentInBox(a, b, box, half + REFERENCE_LABEL_CLEARANCE);
794
+ cut && cuts.push(cut);
795
+ }
796
+ if (cuts.length === 0) return [[x1, y1, x2, y2]];
797
+ crossed = !0, cuts.sort((p, q) => p[0] - q[0]);
798
+ let length = Math.hypot(x2 - x1, y2 - y1), kept = [], start = 0;
799
+ for (let [c0, c1] of cuts)
800
+ c0 > start && kept.push([start, c0]), start = Math.max(start, c1);
801
+ return start < 1 && kept.push([start, 1]), kept.filter(([t0, t1]) => (t1 - t0) * length >= 1).map(([t0, t1]) => [x1 + (x2 - x1) * t0, y1 + (y2 - y1) * t0, x1 + (x2 - x1) * t1, y1 + (y2 - y1) * t1]);
802
+ });
803
+ if (!crossed || runs.length === 0) return node;
804
+ let d = runs.map(([x1, y1, x2, y2]) => `M${fmt(x1)} ${fmt(y1)}L${fmt(x2)} ${fmt(y2)}`).join("");
805
+ if (node.t === "path") return { ...node, d };
806
+ let { x1: _x1, y1: _y1, x2: _x2, y2: _y2, t: _t, width, ...rest } = node;
807
+ return { ...rest, t: "path", width, d };
808
+ });
809
+ }
810
+ function referenceCasings(scene, own2 = () => !0) {
811
+ let lines = new Set(scene.filter((node) => node.part === "valueLine").map((node) => node.id));
812
+ return scene.filter((node) => node.part !== "referenceCasing" || !own2(node) || !lines.has(node.id.replace(/:casing:\d+$/, "")));
813
+ }
814
+ function crossableFill(node) {
815
+ return node.t === "rect" && String(node.id).startsWith("mark:") && node.fill !== void 0 && node.pattern === void 0;
816
+ }
817
+ var KEEP_INK_OVER_FILLS = /* @__PURE__ */ new Set(["grid", "gridline", "barBreak", "referenceTick", "referenceLine"]);
818
+ function linesOverFills(scene, own2) {
819
+ if (!scene.some(crossableFill)) return scene;
820
+ let out = [];
821
+ return scene.forEach((node, index) => {
822
+ if (out.push(node), !own2(node) || !behindText(node) || KEEP_INK_OVER_FILLS.has(node.part) || node.stroke === void 0 || "token" in node.stroke && node.stroke.theme?.kind === "line-on-fill") return;
823
+ let segments = straightSegments(node);
824
+ if (!segments || segments.length === 0) return;
825
+ let [ox, oy, ex, ey] = segments[0], length = Math.hypot(ex - ox, ey - oy);
826
+ if (length < 1e-6) return;
827
+ let dx = (ex - ox) / length, dy = (ey - oy) / length, along = (x, y) => (x - ox) * dx + (y - oy) * dy, off = (x, y) => Math.abs((x - ox) * dy - (y - oy) * dx);
828
+ if (segments.some(([x1, y1, x2, y2]) => off(x1, y1) > 0.01 || off(x2, y2) > 0.01)) return;
829
+ let runs = segments.map(([x1, y1, x2, y2]) => [Math.min(along(x1, y1), along(x2, y2)), Math.max(along(x1, y1), along(x2, y2))]), covers = [], lineWidth = node.t === "line" ? node.width : node.width ?? 1;
830
+ if (scene.slice(0, index).forEach((fill, fillIndex) => {
831
+ if (!crossableFill(fill) || fill.tx !== node.tx || fill.ty !== node.ty || fill.rect.w * Math.abs(dy) + fill.rect.h * Math.abs(dx) <= 3 * lineWidth) return;
832
+ let box = { x0: fill.rect.x, y0: fill.rect.y, x1: fill.rect.x + fill.rect.w, y1: fill.rect.y + fill.rect.h, ax: 0, ay: 0, cos: 1, sin: 0 }, inner = { ...box, x0: box.x0 + 0.01, y0: box.y0 + 0.01, x1: box.x1 - 0.01, y1: box.y1 - 0.01 }, far = runs.reduce((m, [, b]) => Math.max(m, b), 0), hit = segmentInBox([ox, oy], [ox + dx * far, oy + dy * far], inner, 0);
833
+ hit && (hit[1] - hit[0]) * far >= 0.5 && covers.push({ lo: hit[0] * far, hi: hit[1] * far, index: fillIndex });
834
+ }), covers.length === 0) return;
835
+ let pieces = [];
836
+ for (let [a, b] of runs) {
837
+ let cuts = [.../* @__PURE__ */ new Set([a, b, ...covers.flatMap(({ lo, hi }) => [lo, hi]).filter((v) => v > a && v < b)])].sort((p, q) => p - q);
838
+ for (let i = 1; i < cuts.length; i++) {
839
+ let mid = (cuts[i - 1] + cuts[i]) / 2, top = covers.filter(({ lo, hi }) => lo <= mid && hi >= mid).reduce((m, { index: f }) => m === void 0 || f > m ? f : m, void 0), last = pieces[pieces.length - 1];
840
+ last && Math.abs(last.b - cuts[i - 1]) < 1e-9 && last.fill === top ? last.b = cuts[i] : pieces.push({ a: cuts[i - 1], b: cuts[i], ...top === void 0 ? {} : { fill: top } });
841
+ }
842
+ }
843
+ if (!pieces.some((piece) => piece.fill !== void 0)) return;
844
+ let dash = node.dash && node.dash.length > 0 && node.dash.some((v) => v > 0) ? node.dash.length % 2 ? [...node.dash, ...node.dash] : node.dash : void 0, period = dash ? dash.reduce((m, v) => m + v, 0) : 0, strokes = (a, b) => {
845
+ if (!dash) return b - a > 0.05 ? [[a, b]] : [];
846
+ let result = [];
847
+ for (let start = Math.floor(a / period) * period; start < b; start += period) {
848
+ let at = start;
849
+ for (let i = 0; i < dash.length; i += 2) {
850
+ let lo = Math.max(a, at), hi = Math.min(b, at + dash[i]);
851
+ hi - lo > 0.05 && result.push([lo, hi]), at += dash[i] + dash[i + 1];
852
+ }
853
+ }
854
+ return result;
855
+ }, point = (v) => `${fmt(ox + dx * v)} ${fmt(oy + dy * v)}`, pathOf = (stretches) => stretches.map(([a, b]) => `M${point(a)}L${point(b)}`).join(""), groups = /* @__PURE__ */ new Map();
856
+ for (let piece of pieces) groups.set(piece.fill, [...groups.get(piece.fill) ?? [], ...strokes(piece.a, piece.b)]);
857
+ let width = node.t === "line" ? node.width : node.width ?? 1, { x1: _x1, y1: _y1, x2: _x2, y2: _y2, d: _d, t: _t, ...rest } = node, { dash: _dash, ...undashed } = rest, base = { ...dash !== void 0 && dash.every((value, i) => i % 2 === 1 || value <= dash[0]) ? rest : undashed, width, ...dash ? { lineCap: node.lineCap ?? "butt" } : {} };
858
+ out.pop();
859
+ let page = groups.get(void 0) ?? [], n = 0;
860
+ page.length > 0 && out.push({ ...base, t: "path", d: pathOf(page) });
861
+ for (let [fill, stretches] of groups) {
862
+ if (fill === void 0 || stretches.length === 0) continue;
863
+ let fillPaint = scene[fill].fill, stroke = { token: "token" in node.stroke ? node.stroke.token : "ink", theme: { kind: "line-on-fill", base: node.stroke, fill: fillPaint } }, id = page.length === 0 && n === 0 ? node.id : `${node.id}:over:${n}`;
864
+ n++, out.push({ ...base, id, t: "path", d: pathOf(stretches), stroke });
865
+ }
866
+ }), out;
867
+ }
868
+ function fmt(n) {
869
+ return String(Math.round(n * 100) / 100);
870
+ }
871
+
872
+ // src/core/typeFloors.ts
873
+ var READER_LABEL_MIN_PX = 9;
874
+ function readerFloorPx(target, role = "label", textScale = 1) {
875
+ return targetFloorsPx(target, textScale)[role];
876
+ }
877
+ var TABLE_HEAD_PARTS = /* @__PURE__ */ new Set(["tableHeader", "tableHeaderSub", "tableGroupHeader"]);
878
+ function tableHeadFloorPx(target, textScale = 1) {
879
+ textScale = Math.max(1, textScale);
880
+ let footerFree = target === "report" || target === "slide" ? scaleTextPx(12, textScale) : 0;
881
+ return Math.max(targetFloorsPx(target, textScale).footnote, footerFree, targetFloorsPx(target, textScale).label - scaleTextPx(2, textScale));
882
+ }
883
+ function textSizeOf(options) {
884
+ let value = options?.textSize;
885
+ if (value !== void 0) {
886
+ if (typeof value != "number" || !(value >= TEXT_SIZE_RANGE.min && value <= TEXT_SIZE_RANGE.max))
887
+ throw new NormalizeError("invalid-text-size", "options.textSize", "textSize must be a number from 6 to 32 (px)", "use 13 for the sizes of a wide report chart");
888
+ if (options.textScale !== void 0)
889
+ throw new NormalizeError("text-size-and-scale", "options.textSize", "textSize and textScale cannot be used together", "keep one: textSize for equal text across charts, textScale to scale the width-class sizes");
890
+ return value;
891
+ }
892
+ }
893
+ function textScaleOf(options) {
894
+ let size = textSizeOf(options);
895
+ if (size !== void 0) return textSizeScale(options.target ?? DEFAULT_TARGET, size);
896
+ let value = options?.textScale;
897
+ if (value === void 0) return 1;
898
+ if (typeof value != "number" || !(value >= TEXT_SCALE_RANGE.min && value <= TEXT_SCALE_RANGE.max))
899
+ throw new NormalizeError("invalid-text-scale", "options.textScale", `textScale must be a number from ${TEXT_SCALE_RANGE.min} to ${TEXT_SCALE_RANGE.max}`, "use 1 for the target sizes, 1.25 for text 25 % larger");
900
+ return value;
901
+ }
902
+ var KPI_VALUE_SIZE = /* @__PURE__ */ Symbol("kpiValueSize"), KPI_HOST_TEXT = /* @__PURE__ */ Symbol("kpiHostText");
903
+
904
+ // src/core/pieRamp.ts
905
+ var PAGE_FLOOR = 1.4, ramps = /* @__PURE__ */ new Map();
906
+ function pieRamp(base, background, count, apartFrom, quietest = !1, pageFloor = !0) {
907
+ let key = `${base}|${background}|${count}|${apartFrom ?? ""}|${quietest}|${pageFloor}`, ramp = ramps.get(key);
908
+ return ramp || ramps.set(key, ramp = computePieRamp(base, background, count, apartFrom, quietest, pageFloor)), { tints: [...ramp.tints], distinguishableCount: ramp.distinguishableCount };
909
+ }
910
+ function computePieRamp(base, background, count, apartFrom, quietest = !1, pageFloor = !0) {
911
+ let maxTint = 0.82;
912
+ for (; pageFloor && maxTint > 0 && contrastRatio(tint(base, maxTint, background), background) < PAGE_FLOOR; ) maxTint = Math.max(0, maxTint - 0.01);
913
+ let othersContrast = apartFrom === void 0 ? 0 : contrastRatio(apartFrom, background);
914
+ quietest && contrastRatio(base, background) <= othersContrast && (quietest = !1);
915
+ let apart = (t) => {
916
+ if (apartFrom === void 0) return !0;
917
+ let color = tint(base, t, background);
918
+ return swatchApart(color, apartFrom) && (!quietest || contrastRatio(color, background) > othersContrast);
919
+ };
920
+ if (apartFrom !== void 0)
921
+ for (; maxTint > 0 && !apart(maxTint); ) maxTint = Math.max(0, maxTint - 0.01);
922
+ let tints = [0];
923
+ for (; tints.length < count; ) {
924
+ let prev = tints[tints.length - 1], next = null;
925
+ for (let t = prev + 0.01; t <= maxTint + 1e-9; t += 0.01) {
926
+ let previousColor = tint(base, prev, background), candidateColor = tint(base, t, background), previousL = oklabLightness(previousColor), candidateL = oklabLightness(candidateColor);
927
+ if (previousL !== null && candidateL !== null && apart(t) && Math.abs(candidateL - previousL) >= 0.1 && contrastRatio(previousColor, candidateColor) >= 1.25) {
928
+ next = t;
929
+ break;
930
+ }
931
+ }
932
+ if (next === null) break;
933
+ tints.push(next);
934
+ }
935
+ let distinguishableCount = tints.length;
936
+ if (distinguishableCount < count) {
937
+ tints.length = 0;
938
+ for (let i = 0; i < count; i++)
939
+ tints.push(count === 1 ? 0 : maxTint * (i / (count - 1)));
940
+ if (!tints.every((t) => apart(t))) {
941
+ let allowed = [];
942
+ for (let t = 0.01; t <= maxTint + 1e-9; t += 0.01) apart(t) && allowed.push(t);
943
+ if (allowed.length >= count - 1)
944
+ for (let i = 1; i < count; i++) tints[i] = allowed[Math.round(i * (allowed.length - 1) / (count - 1))];
945
+ }
946
+ }
947
+ return { tints, distinguishableCount };
948
+ }
949
+ function quietestTintCap(base, background, others, max) {
950
+ let othersContrast = contrastRatio(others, background);
951
+ for (let t = max; t > 0; t = Math.max(0, t - 0.01)) {
952
+ let color = tint(base, t, background);
953
+ if (swatchApart(color, others) && contrastRatio(color, background) > othersContrast) return t;
954
+ }
955
+ return 0;
956
+ }
957
+
958
+ // src/core/themeFamilies/boardroom.json
959
+ var boardroom_default = {
960
+ name: "boardroom",
961
+ scheme: "light",
962
+ color: {
963
+ good: "#0C7B4C",
964
+ goodFill: "#0FA063",
965
+ bad: "#C13743",
966
+ badFill: "#E0524E",
967
+ neutral: "#5E6C7B",
968
+ neutralLight: "#CFD9E2",
969
+ highlight: "#1D4ED8",
970
+ total: "#12395E",
971
+ others: "#E3EDF5",
972
+ othersMark: "#CEDAE3",
973
+ ink: "#0D2A43",
974
+ inkInverse: "#FFFFFF",
975
+ inkMuted: "#4E6070",
976
+ axis: "#0D2A43",
977
+ grid: "#E9EEF3",
978
+ leader: "#97A6B4",
979
+ background: "#FFFFFF",
980
+ stack: [
981
+ "#12395E",
982
+ "#5E99C5",
983
+ "#B4C6D8"
984
+ ],
985
+ series: [
986
+ "#12395E",
987
+ "#5E99C5",
988
+ "#B58629",
989
+ "#72767C",
990
+ "#6F69CC",
991
+ "#587000",
992
+ "#229B72",
993
+ "#335B83"
994
+ ],
995
+ seriesOverflow: "repeatLast",
996
+ palettes: {
997
+ atlantic: [
998
+ "#075A8E",
999
+ "#55BEF7",
1000
+ "#2AB1A9",
1001
+ "#838CDA",
1002
+ "#1F8567",
1003
+ "#9259AC"
1004
+ ]
1005
+ },
1006
+ status: {
1007
+ advanced: "#566C90",
1008
+ open: "#C4D4E8",
1009
+ lost: "#E0524E",
1010
+ pending: "#92A7C2",
1011
+ won: "#1D4ED8",
1012
+ "gantt-workstream": "#12395E",
1013
+ "gantt-detail": "#AFBCC8",
1014
+ "gantt-special": "#1D4ED8",
1015
+ "gantt-cadence": "#12395E"
1016
+ },
1017
+ colorblind: {
1018
+ good: "#4980E2",
1019
+ bad: "#E16D08",
1020
+ badFill: "#A0431A"
1021
+ },
1022
+ warn: "#896600",
1023
+ warnFill: "#F5A800"
1024
+ },
1025
+ scenario: {
1026
+ AC: "solid",
1027
+ PY: "solidLight",
1028
+ PL: "outline",
1029
+ FC: "hatch45"
1030
+ },
1031
+ pattern: {
1032
+ hatchAngle: 45,
1033
+ hatchColor: "segment",
1034
+ hatchGap: 6,
1035
+ hatchStrokeWidth: 0.75,
1036
+ outlineStrokeWidth: 1.5
1037
+ },
1038
+ type: {
1039
+ family: "'Helvetica Neue', Helvetica, Arial, Roboto, sans-serif",
1040
+ title: {
1041
+ size: 18,
1042
+ weight: 700,
1043
+ lineHeight: 1.25
1044
+ },
1045
+ subtitle: {
1046
+ size: 12,
1047
+ weight: 400,
1048
+ lineHeight: 1.3
1049
+ },
1050
+ label: {
1051
+ size: 11.5,
1052
+ weight: 400,
1053
+ lineHeight: 1.2
1054
+ },
1055
+ axis: {
1056
+ size: 10.5,
1057
+ weight: 400,
1058
+ lineHeight: 1.2
1059
+ },
1060
+ footnote: {
1061
+ size: 9,
1062
+ weight: 400,
1063
+ lineHeight: 1.3
1064
+ },
1065
+ micro: {
1066
+ size: 9,
1067
+ weight: 400,
1068
+ lineHeight: 1.2
1069
+ },
1070
+ scale: {
1071
+ S: {
1072
+ title: 15,
1073
+ subtitle: 10.5,
1074
+ label: 10,
1075
+ axis: 9.5,
1076
+ footnote: 8.5,
1077
+ micro: 9
1078
+ },
1079
+ L: {
1080
+ title: 22,
1081
+ subtitle: 14,
1082
+ label: 13,
1083
+ axis: 12,
1084
+ footnote: 10.5,
1085
+ micro: 9.5
1086
+ }
1087
+ }
1088
+ },
1089
+ space: {
1090
+ tierGap: 5,
1091
+ facetGap: 28,
1092
+ labelPad: 5
1093
+ },
1094
+ surface: {
1095
+ chipTint: 0.9,
1096
+ rowTint: 0.94,
1097
+ elapsedTint: 0.95,
1098
+ anchorTint: 0.97,
1099
+ chipRadius: 2,
1100
+ panelShadow: "0 1px 2px rgba(13,42,67,0.10), 0 6px 20px rgba(13,42,67,0.07)"
1101
+ }
1102
+ };
1103
+
1104
+ // src/core/themeFamilies/capital.json
1105
+ var capital_default = {
1106
+ name: "capital",
1107
+ scheme: "light",
1108
+ color: {
1109
+ good: "#0B7845",
1110
+ goodFill: "#0E9A58",
1111
+ bad: "#B83E44",
1112
+ badFill: "#D6484F",
1113
+ neutral: "#7A7067",
1114
+ neutralMark: "#958E87",
1115
+ neutralLight: "#D8D1C7",
1116
+ highlight: "#2470C6",
1117
+ total: "#2E346F",
1118
+ others: "#EFEAE0",
1119
+ othersMark: "#D8D4D0",
1120
+ ink: "#21264E",
1121
+ inkInverse: "#FFFFFF",
1122
+ inkMuted: "#6B5C52",
1123
+ axis: "#21264E",
1124
+ grid: "#EAE5DA",
1125
+ leader: "#A59C90",
1126
+ background: "#FDFBF4",
1127
+ series: [
1128
+ "#2E346F",
1129
+ "#C48404",
1130
+ "#1F7761",
1131
+ "#905111",
1132
+ "#8692A2"
1133
+ ],
1134
+ seriesOverflow: "repeatLast",
1135
+ palettes: {
1136
+ atlantic: [
1137
+ "#075A8E",
1138
+ "#55BEF7",
1139
+ "#2AB1A9",
1140
+ "#838CDA",
1141
+ "#208668",
1142
+ "#9259AC"
1143
+ ],
1144
+ capital: [
1145
+ "#2E346F",
1146
+ "#C48404",
1147
+ "#1F7761",
1148
+ "#905111",
1149
+ "#8692A2"
1150
+ ]
1151
+ },
1152
+ status: {
1153
+ advanced: "#7A7067",
1154
+ open: "#D8D1C7",
1155
+ lost: "#D6484F",
1156
+ pending: "#A8A099",
1157
+ won: "#2E346F",
1158
+ "gantt-workstream": "#2E346F",
1159
+ "gantt-detail": "#C4BBB0",
1160
+ "gantt-special": "#2470C6",
1161
+ "gantt-cadence": "#2E346F"
1162
+ },
1163
+ colorblind: {
1164
+ good: "#7187F9",
1165
+ bad: "#E16D08",
1166
+ badFill: "#A0431A"
1167
+ },
1168
+ warn: "#866400",
1169
+ warnFill: "#F5A800"
1170
+ },
1171
+ scenario: {
1172
+ AC: "solid",
1173
+ PY: "solidLight",
1174
+ PL: "outline",
1175
+ FC: "hatch45"
1176
+ },
1177
+ pattern: {
1178
+ hatchAngle: 45,
1179
+ hatchColor: "segment",
1180
+ hatchGap: 6,
1181
+ hatchStrokeWidth: 0.75,
1182
+ outlineStrokeWidth: 1.5
1183
+ },
1184
+ type: {
1185
+ family: "Inter, 'Helvetica Neue', Helvetica, Arial, sans-serif",
1186
+ title: {
1187
+ size: 18,
1188
+ weight: 700,
1189
+ lineHeight: 1.25
1190
+ },
1191
+ subtitle: {
1192
+ size: 12,
1193
+ weight: 400,
1194
+ lineHeight: 1.3
1195
+ },
1196
+ label: {
1197
+ size: 11.5,
1198
+ weight: 400,
1199
+ lineHeight: 1.2
1200
+ },
1201
+ axis: {
1202
+ size: 10.5,
1203
+ weight: 400,
1204
+ lineHeight: 1.2
1205
+ },
1206
+ footnote: {
1207
+ size: 9,
1208
+ weight: 400,
1209
+ lineHeight: 1.3
1210
+ },
1211
+ micro: {
1212
+ size: 9,
1213
+ weight: 400,
1214
+ lineHeight: 1.2
1215
+ },
1216
+ scale: {
1217
+ S: {
1218
+ title: 15,
1219
+ subtitle: 10.5,
1220
+ label: 10,
1221
+ axis: 9.5,
1222
+ footnote: 8.5,
1223
+ micro: 9
1224
+ },
1225
+ L: {
1226
+ title: 22,
1227
+ subtitle: 14,
1228
+ label: 13,
1229
+ axis: 12,
1230
+ footnote: 10.5,
1231
+ micro: 9.5
1232
+ }
1233
+ }
1234
+ },
1235
+ space: {
1236
+ tierGap: 5,
1237
+ facetGap: 28,
1238
+ labelPad: 5
1239
+ },
1240
+ surface: {
1241
+ chipTint: 0.9,
1242
+ rowTint: 0.94,
1243
+ elapsedTint: 0.95,
1244
+ anchorTint: 0.97,
1245
+ chipRadius: 2,
1246
+ panelShadow: "0 1px 0 rgba(33,38,78,0.10), 0 10px 28px rgba(33,38,78,0.08)"
1247
+ }
1248
+ };
1249
+
1250
+ // src/core/themeFamilies/studio.json
1251
+ var studio_default = {
1252
+ name: "studio",
1253
+ scheme: "light",
1254
+ color: {
1255
+ good: "#0B7A49",
1256
+ goodFill: "#1DB06A",
1257
+ bad: "#C0373F",
1258
+ badFill: "#E2564A",
1259
+ neutral: "#75807A",
1260
+ neutralMark: "#8F928E",
1261
+ neutralLight: "#D4DAD2",
1262
+ highlight: "#0F7F67",
1263
+ total: "#24564E",
1264
+ others: "#F1ECE1",
1265
+ othersMark: "#DCD7CD",
1266
+ ink: "#33302B",
1267
+ inkInverse: "#FFFFFF",
1268
+ inkMuted: "#6E675D",
1269
+ axis: "#33302B",
1270
+ grid: "#EDE8DD",
1271
+ leader: "#A89F90",
1272
+ background: "#FFFEFB",
1273
+ series: [
1274
+ "#24564E",
1275
+ "#C68610",
1276
+ "#C1553F",
1277
+ "#609E93",
1278
+ "#7B82C7",
1279
+ "#84538F"
1280
+ ],
1281
+ seriesOverflow: "repeatLast",
1282
+ palettes: {
1283
+ atlantic: [
1284
+ "#075A8E",
1285
+ "#55BEF7",
1286
+ "#2AB1A9",
1287
+ "#838CDA",
1288
+ "#208668",
1289
+ "#9259AC"
1290
+ ]
1291
+ },
1292
+ status: {
1293
+ advanced: "#75807A",
1294
+ open: "#D4DAD2",
1295
+ lost: "#E2564A",
1296
+ pending: "#A8AFA5",
1297
+ won: "#0F7F67",
1298
+ "gantt-workstream": "#24564E",
1299
+ "gantt-detail": "#B5BCB2",
1300
+ "gantt-special": "#0F7F67",
1301
+ "gantt-cadence": "#24564E"
1302
+ },
1303
+ colorblind: {
1304
+ good: "#467DDE",
1305
+ bad: "#E16D08",
1306
+ badFill: "#A0431A"
1307
+ },
1308
+ warn: "#896600",
1309
+ warnFill: "#F5A800"
1310
+ },
1311
+ scenario: {
1312
+ AC: "solid",
1313
+ PY: "solidLight",
1314
+ PL: "outline",
1315
+ FC: "hatch45"
1316
+ },
1317
+ pattern: {
1318
+ hatchAngle: 45,
1319
+ hatchColor: "segment",
1320
+ hatchGap: 6,
1321
+ hatchStrokeWidth: 0.75,
1322
+ outlineStrokeWidth: 1.5
1323
+ },
1324
+ type: {
1325
+ family: "'Helvetica Neue', Helvetica, Arial, sans-serif",
1326
+ title: {
1327
+ size: 18,
1328
+ weight: 700,
1329
+ lineHeight: 1.25
1330
+ },
1331
+ subtitle: {
1332
+ size: 12,
1333
+ weight: 400,
1334
+ lineHeight: 1.3
1335
+ },
1336
+ label: {
1337
+ size: 11.5,
1338
+ weight: 400,
1339
+ lineHeight: 1.2
1340
+ },
1341
+ axis: {
1342
+ size: 10.5,
1343
+ weight: 400,
1344
+ lineHeight: 1.2
1345
+ },
1346
+ footnote: {
1347
+ size: 9,
1348
+ weight: 400,
1349
+ lineHeight: 1.3
1350
+ },
1351
+ micro: {
1352
+ size: 9,
1353
+ weight: 400,
1354
+ lineHeight: 1.2
1355
+ },
1356
+ scale: {
1357
+ S: {
1358
+ title: 15,
1359
+ subtitle: 10.5,
1360
+ label: 10,
1361
+ axis: 9.5,
1362
+ footnote: 8.5,
1363
+ micro: 9
1364
+ },
1365
+ L: {
1366
+ title: 22,
1367
+ subtitle: 14,
1368
+ label: 13,
1369
+ axis: 12,
1370
+ footnote: 10.5,
1371
+ micro: 9.5
1372
+ }
1373
+ }
1374
+ },
1375
+ space: {
1376
+ tierGap: 5,
1377
+ facetGap: 30,
1378
+ labelPad: 6
1379
+ },
1380
+ surface: {
1381
+ chipTint: 0.9,
1382
+ rowTint: 0.94,
1383
+ elapsedTint: 0.95,
1384
+ anchorTint: 0.97,
1385
+ chipRadius: 3,
1386
+ panelShadow: "0 10px 24px rgba(51,48,43,0.07), 0 2px 6px rgba(51,48,43,0.05)"
1387
+ }
1388
+ };
1389
+
1390
+ // src/core/themeFamilies/glass.json
1391
+ var glass_default = {
1392
+ name: "glass",
1393
+ scheme: "dark",
1394
+ color: {
1395
+ good: "#2FC96E",
1396
+ bad: "#F0655C",
1397
+ neutral: "#97A5C4",
1398
+ neutralLight: "#4C5975",
1399
+ highlight: "#AE69C3",
1400
+ total: "#5B6DEC",
1401
+ others: "#232C44",
1402
+ othersMark: "#30394F",
1403
+ ink: "#E8EDF8",
1404
+ inkInverse: "#0B1020",
1405
+ inkMuted: "#A6B1CB",
1406
+ axis: "#9FABC6",
1407
+ grid: "#202B44",
1408
+ leader: "#6B7896",
1409
+ background: "#0F1626",
1410
+ series: [
1411
+ "#4E8BE6",
1412
+ "#35CDB3",
1413
+ "#C6A4FF",
1414
+ "#B5F5C8",
1415
+ "#E9558F",
1416
+ "#387008",
1417
+ "#F0A018",
1418
+ "#885080"
1419
+ ],
1420
+ seriesOverflow: "repeatLast",
1421
+ palettes: {
1422
+ glass: [
1423
+ "#4E8BE6",
1424
+ "#35CDB3",
1425
+ "#C6A4FF",
1426
+ "#B5F5C8",
1427
+ "#E9558F"
1428
+ ]
1429
+ },
1430
+ status: {
1431
+ advanced: "#8E9BBA",
1432
+ open: "#4A5775",
1433
+ lost: "#F0655C",
1434
+ pending: "#6F7F8E",
1435
+ won: "#AE69C3",
1436
+ "gantt-workstream": "#4E8BE6",
1437
+ "gantt-detail": "#556280",
1438
+ "gantt-special": "#AE69C3",
1439
+ "gantt-cadence": "#4E8BE6"
1440
+ },
1441
+ colorblind: {
1442
+ good: "#5097FF",
1443
+ bad: "#C79A32",
1444
+ badFill: "#C8641E"
1445
+ },
1446
+ warn: "#EFC53F",
1447
+ warnFill: "#EFC53F"
1448
+ },
1449
+ scenario: {
1450
+ AC: "solid",
1451
+ PY: "solidLight",
1452
+ PL: "outline",
1453
+ FC: "hatch45"
1454
+ },
1455
+ pattern: {
1456
+ hatchAngle: 45,
1457
+ hatchColor: "segment",
1458
+ hatchGap: 6,
1459
+ hatchStrokeWidth: 0.75,
1460
+ outlineStrokeWidth: 1.5
1461
+ },
1462
+ type: {
1463
+ family: "Inter, 'Helvetica Neue', Helvetica, Arial, sans-serif",
1464
+ title: {
1465
+ size: 18,
1466
+ weight: 700,
1467
+ lineHeight: 1.25
1468
+ },
1469
+ subtitle: {
1470
+ size: 12,
1471
+ weight: 400,
1472
+ lineHeight: 1.3
1473
+ },
1474
+ label: {
1475
+ size: 11.5,
1476
+ weight: 400,
1477
+ lineHeight: 1.2
1478
+ },
1479
+ axis: {
1480
+ size: 10.5,
1481
+ weight: 400,
1482
+ lineHeight: 1.2
1483
+ },
1484
+ footnote: {
1485
+ size: 9,
1486
+ weight: 400,
1487
+ lineHeight: 1.3
1488
+ },
1489
+ micro: {
1490
+ size: 9,
1491
+ weight: 400,
1492
+ lineHeight: 1.2
1493
+ },
1494
+ scale: {
1495
+ S: {
1496
+ title: 15,
1497
+ subtitle: 10.5,
1498
+ label: 10,
1499
+ axis: 9.5,
1500
+ footnote: 8.5,
1501
+ micro: 9
1502
+ },
1503
+ L: {
1504
+ title: 22,
1505
+ subtitle: 14,
1506
+ label: 13,
1507
+ axis: 12,
1508
+ footnote: 10.5,
1509
+ micro: 9.5
1510
+ }
1511
+ }
1512
+ },
1513
+ space: {
1514
+ tierGap: 5,
1515
+ facetGap: 28,
1516
+ labelPad: 5
1517
+ },
1518
+ surface: {
1519
+ chipTint: 0.88,
1520
+ rowTint: 0.94,
1521
+ elapsedTint: 0.95,
1522
+ anchorTint: 0.97,
1523
+ chipRadius: 4,
1524
+ panelShadow: "inset 0 1px 0 rgba(255,255,255,0.18), inset 0 0 0 0.5px rgba(255,255,255,0.05), 0 8px 32px rgba(0,0,0,0.25)"
1525
+ }
1526
+ };
1527
+
1528
+ // src/core/themeStore.ts
1529
+ var adopted = /* @__PURE__ */ new Map();
1530
+ function adoptTheme(theme) {
1531
+ for (adopted.delete(theme.name), adopted.set(theme.name, theme); adopted.size > 64; ) adopted.delete(adopted.keys().next().value);
1532
+ }
1533
+ function adoptedTheme(name) {
1534
+ let theme = adopted.get(name);
1535
+ return theme && adoptTheme(theme), theme;
1536
+ }
1537
+
1538
+ // src/core/themeColors.ts
1539
+ var resolved = /* @__PURE__ */ new WeakMap();
1540
+ function themeColors(theme) {
1541
+ let color = resolveColors(theme.color), table = theme.table && resolveColors(theme.table);
1542
+ return color === theme.color && table === theme.table ? theme : { ...theme, color, ...table ? { table } : {} };
1543
+ }
1544
+ function resolveColors(value) {
1545
+ if (typeof value == "string")
1546
+ return /^(?:oklch|hsla?|rgba?|var)\(/i.test(value.trim()) ? literalColor(value) ?? value : value;
1547
+ if (!value || typeof value != "object") return value;
1548
+ let known = resolved.get(value);
1549
+ if (known) return known;
1550
+ let result = value;
1551
+ for (let [key, child] of Object.entries(value)) {
1552
+ let next = resolveColors(child);
1553
+ next !== child && (result === value && (result = Array.isArray(value) ? [...value] : { ...value }), result[key] = next);
1554
+ }
1555
+ return Object.isFrozen(value) && resolved.set(value, result), result;
1556
+ }
1557
+
1558
+ // src/core/theme.ts
1559
+ registerDeferredLoader("theme-rules", () => import("./themeShapeRules-2D3KWSPQ.js"));
1560
+ var ATLANTIC_SERIES = ["#075A8E", "#55BEF7", "#2AB1A9", "#838CDA", "#208668", "#9259AC"], ATLANTIC_DARK_SERIES = ["#087397", "#55BEFB", "#25AAA2", "#828BD9", "#1E9240", "#A054C4"], NOTATION_DARK_SERIES = ["#606060", "#858585", "#ACACAC", "#D5D5D5", "#FFFFFF"], DARK_WARN = "#F2C14E", LIGHT_WARN_FILL = "#F5A800", LIGHT_CB_BAD_FILL = "#A0431A";
1561
+ function canonicalType(family) {
1562
+ return {
1563
+ family,
1564
+ title: { family, size: 18, weight: 700, lineHeight: 1.25 },
1565
+ subtitle: { family, size: 12, weight: 400, lineHeight: 1.3 },
1566
+ label: { family, size: 11.5, weight: 400, lineHeight: 1.2 },
1567
+ axis: { family, size: 10.5, weight: 400, lineHeight: 1.2 },
1568
+ footnote: { family, size: 9, weight: 400, lineHeight: 1.3 },
1569
+ micro: { family, size: 9, weight: 400, lineHeight: 1.2 },
1570
+ scale: {
1571
+ S: { title: 15, subtitle: 10.5, label: 10, axis: 9.5, footnote: 8.5, micro: 9 },
1572
+ L: { title: 22, subtitle: 14, label: 13, axis: 12, footnote: 10.5, micro: 9.5 }
1573
+ }
1574
+ };
1575
+ }
1576
+ function typeWidthClass(width) {
1577
+ return width >= WIDE_CANVAS_MIN_WIDTH ? "L" : width >= 720 ? "M" : "S";
1578
+ }
1579
+ function smallestTitleSize(theme) {
1580
+ let { title, scale } = theme.type;
1581
+ return Math.min(title.size, scale?.S?.title ?? title.size, scale?.L?.title ?? title.size);
1582
+ }
1583
+ var TYPE_ROLE_NAMES = ["title", "subtitle", "label", "axis", "footnote", "micro", "secondary"];
1584
+ function panelTypeClass(options) {
1585
+ let value = options?.typeClass;
1586
+ return value === "S" || value === "M" || value === "L" ? value : void 0;
1587
+ }
1588
+ function labelsOffKeepsNames(options) {
1589
+ return panelTypeClass(options) === void 0;
1590
+ }
1591
+ function microType(theme) {
1592
+ let micro = theme.type.micro ?? {
1593
+ size: Math.max(READER_LABEL_MIN_PX, theme.type.footnote.size - 1),
1594
+ weight: 400,
1595
+ lineHeight: 1.2
1596
+ };
1597
+ return micro.family ? micro : { ...micro, family: theme.type.family };
1598
+ }
1599
+ function secondaryType(theme) {
1600
+ let { axis, secondary } = theme.type;
1601
+ return secondary ? hasAuthoredTypeSize(secondary) ? secondary : { ...secondary, size: Math.min(secondary.size, axis.size) } : axis;
1602
+ }
1603
+ function secondaryFont(theme) {
1604
+ return { family: theme.type.family, ...secondaryType(theme) };
1605
+ }
1606
+ function themeForWidth(theme, widthOrClass) {
1607
+ let cls = typeof widthOrClass == "number" ? typeWidthClass(widthOrClass) : widthOrClass, column = cls === "M" ? void 0 : theme.type.scale?.[cls], roles = {};
1608
+ for (let role of TYPE_ROLE_NAMES) {
1609
+ let base = role === "micro" ? microType(theme) : role === "secondary" ? theme.type.secondary : theme.type[role];
1610
+ if (!base) continue;
1611
+ let step = column?.[role], sized = step !== void 0 && step !== base.size ? { ...base, size: step } : base;
1612
+ roles[role] = sized.family ? sized : { ...sized, family: theme.type.family };
1613
+ }
1614
+ return {
1615
+ ...theme,
1616
+ type: {
1617
+ family: theme.type.family,
1618
+ title: roles.title,
1619
+ subtitle: roles.subtitle,
1620
+ label: roles.label,
1621
+ axis: roles.axis,
1622
+ footnote: roles.footnote,
1623
+ micro: roles.micro,
1624
+ ...roles.secondary ? { secondary: roles.secondary } : {},
1625
+ ...theme.type.numeric ? { numeric: theme.type.numeric } : {},
1626
+ ...theme.type.emphasis ? { emphasis: theme.type.emphasis } : {}
1627
+ }
1628
+ };
1629
+ }
1630
+ function tableFamily(colors = {}) {
1631
+ return {
1632
+ head: { weight: 600, tracking: 0 },
1633
+ section: { weight: 500, lineHeight: 14 / 11, tracking: 0.14, ink: "ink" },
1634
+ headPad: { top: 10, bottom: 8 },
1635
+ groupPad: { top: 8, bottom: 4 },
1636
+ ruleWidths: { head: 1, row: 1 },
1637
+ weights: { emphasis: 600 },
1638
+ mark: "bare",
1639
+ endRule: "none",
1640
+ fixedType: !0,
1641
+ noPrevious: "missing",
1642
+ ofWhich: "ink",
1643
+ glyphs: { missing: "\u2013", suppressed: "\u2013" },
1644
+ groupGround: "none",
1645
+ grounds: { total: "transparent" },
1646
+ blockRule: "rule",
1647
+ ...colors.secondary === void 0 ? {} : { inks: { secondary: colors.secondary } },
1648
+ ...colors.ruleInk === void 0 ? {} : { ruleInk: colors.ruleInk },
1649
+ ...colors.barFill === void 0 ? {} : { bar: { fill: colors.barFill } }
1650
+ };
1651
+ }
1652
+ var GRAMMAR_STROKE = Object.freeze({ seam: 0.5, hair: 0.75, rule: 1, mark: 1.5, data: 2, focus: 2.5, casing: 5 }), GRAMMAR_DASH = Object.freeze({ reference: Object.freeze([4, 3]), dotted: Object.freeze([1, 3]) }), WEIGHT_REGULAR = 400, WEIGHT_EMPHASIS = 700;
1653
+ function strokeToken(theme, role) {
1654
+ return theme.stroke?.[role] ?? GRAMMAR_STROKE[role];
1655
+ }
1656
+ function dashToken(theme, role) {
1657
+ return [...theme.dash?.[role] ?? GRAMMAR_DASH[role]];
1658
+ }
1659
+ function gridDash(theme) {
1660
+ let style = theme.valueAxis?.gridDash;
1661
+ return style === "dotted" ? { dash: dashToken(theme, "dotted") } : style === "dashed" ? { dash: dashToken(theme, "reference") } : {};
1662
+ }
1663
+ function emphasisWeight(theme) {
1664
+ return theme.type.emphasis?.weight ?? WEIGHT_EMPHASIS;
1665
+ }
1666
+ function emphasisLabelTheme(theme) {
1667
+ return { ...theme, type: { ...theme.type, label: { ...theme.type.label, weight: emphasisWeight(theme) } } };
1668
+ }
1669
+ function tableEmphasis(theme) {
1670
+ return theme.table?.weights?.emphasis ?? emphasisWeight(theme);
1671
+ }
1672
+ function tableInkColor(theme, role) {
1673
+ if (role === "rule") return theme.table?.ruleInk ?? mixColors(theme.color.ink, theme.color.background, 0.25);
1674
+ let ink = theme.table?.inks?.[role];
1675
+ return ink !== void 0 ? ink : role === "secondary" ? theme.color.inkMuted : SECONDARY_TABLE_ROLES.has(role) ? tableInkColor(theme, "secondary") : theme.color.ink;
1676
+ }
1677
+ var SECONDARY_TABLE_ROLES = /* @__PURE__ */ new Set(["qualifier", "operator", "driver", "toggle"]);
1678
+ function headingWeight(theme) {
1679
+ return Math.min(600, emphasisWeight(theme));
1680
+ }
1681
+ var standardTheme = {
1682
+ name: "standard",
1683
+ table: tableFamily(),
1684
+ color: {
1685
+ good: "#0FA060",
1686
+ bad: "#E2564A",
1687
+ neutral: "#79828C",
1688
+ neutralLight: "#CFD7DD",
1689
+ highlight: "#10529E",
1690
+ total: "#10529E",
1691
+ others: "#EDF0F3",
1692
+ // An Others mark has no outline by default, so it steps past the page floor (1.43:1);
1693
+ // the ground uses of color.others keep the quieter step.
1694
+ othersMark: "#D4D8DC",
1695
+ ink: "#0E1A26",
1696
+ inkInverse: "#FFFFFF",
1697
+ inkMuted: "#5C6B7A",
1698
+ axis: "#0E1A26",
1699
+ grid: "#E9EDF1",
1700
+ leader: "#9AA6B1",
1701
+ background: "#FFFFFF",
1702
+ series: [...ATLANTIC_SERIES, "#680000", "#B85800"],
1703
+ // Navy, mid and a light step about 1.75:1 on the page (dark ink reads 9.9:1 on it).
1704
+ stack: ["#075A8E", "#4C95C8", "#A9C6DC"],
1705
+ seriesOverflow: "repeatLast",
1706
+ palettes: { atlantic: [...ATLANTIC_SERIES] },
1707
+ status: {
1708
+ advanced: "#79828C",
1709
+ open: "#CFD7DD",
1710
+ lost: "#E2564A",
1711
+ pending: "#9CA5AD",
1712
+ won: "#10529E",
1713
+ "gantt-workstream": "#477EAF",
1714
+ "gantt-detail": "#AEB7BE",
1715
+ "gantt-special": "#10529E",
1716
+ "gantt-cadence": "#477EAF"
1717
+ },
1718
+ colorblind: { good: "#457FE0", bad: "#A48228", badFill: LIGHT_CB_BAD_FILL },
1719
+ warn: "#8F6A00",
1720
+ warnFill: LIGHT_WARN_FILL
1721
+ },
1722
+ scenario: { AC: "solid", PY: "solidLight", PL: "outline", FC: "hatch45" },
1723
+ pattern: { hatchAngle: 45, hatchColor: "segment", hatchGap: 6, hatchStrokeWidth: 0.75, outlineStrokeWidth: 1.5 },
1724
+ // The canonical type scale.
1725
+ type: canonicalType("'Helvetica Neue', Helvetica, Arial, sans-serif"),
1726
+ space: { tierGap: 5, facetGap: 28, labelPad: 5 },
1727
+ surface: { chipTint: 0.9, rowTint: 0.94, elapsedTint: 0.95, anchorTint: 0.97, chipRadius: 2 }
1728
+ }, standardDarkTheme = {
1729
+ ...standardTheme,
1730
+ name: "standard-dark",
1731
+ table: tableFamily({ secondary: "#9EC3E2", ruleInk: "#344B60", barFill: "#22384D" }),
1732
+ color: {
1733
+ ...standardTheme.color,
1734
+ neutral: "#A9B5C0",
1735
+ neutralLight: "#667583",
1736
+ highlight: "#67A9EA",
1737
+ total: "#67A9EA",
1738
+ others: "#263542",
1739
+ // An Others mark has no outline by default, so it steps past the page floor (1.58:1);
1740
+ // the ground uses of color.others keep the quieter navy.
1741
+ othersMark: "#2F3D4A",
1742
+ ink: "#F4F7FA",
1743
+ inkInverse: "#0E1A26",
1744
+ inkMuted: "#AAB7C4",
1745
+ axis: "#DCE4EB",
1746
+ grid: "#2A3947",
1747
+ leader: "#758596",
1748
+ background: "#0E1A26",
1749
+ series: [...ATLANTIC_DARK_SERIES, "#F8C030", "#60E8A8"],
1750
+ // Strongest first, kept apart from the focus (#67A9EA); the quietest step sits
1751
+ // about 1.77:1 on the navy page (the light ink reads 9.2:1 on it).
1752
+ stack: ["#C2DCF5", "#4F7DA6", "#2A4560"],
1753
+ palettes: { atlantic: [...ATLANTIC_DARK_SERIES] },
1754
+ // The light presets' rust bad fill, hatched, sits 6.5 OKLab from a cell
1755
+ // with no status on the navy page; this page keeps colorblind.bad as fill.
1756
+ colorblind: { good: standardTheme.color.colorblind.good, bad: standardTheme.color.colorblind.bad },
1757
+ warn: DARK_WARN,
1758
+ warnFill: DARK_WARN,
1759
+ status: {
1760
+ ...standardTheme.color.status,
1761
+ advanced: "#A9B5C0",
1762
+ open: "#667583",
1763
+ pending: "#7C8995",
1764
+ won: "#67A9EA",
1765
+ "gantt-workstream": "#4D8EC5",
1766
+ "gantt-detail": "#667583",
1767
+ "gantt-special": "#67A9EA",
1768
+ "gantt-cadence": "#4D8EC5"
1769
+ }
1770
+ }
1771
+ }, notationTheme = {
1772
+ name: "notation",
1773
+ table: tableFamily(),
1774
+ color: {
1775
+ // Tone text reaches 4.5:1 on the page and on its chip;
1776
+ // the signed fills keep the brighter pair.
1777
+ good: "#0C7B4A",
1778
+ goodFill: "#0FA060",
1779
+ bad: "#C13743",
1780
+ badFill: "#E2564A",
1781
+ neutral: "#818181",
1782
+ // The marks that paint in the neutral (a scatter's neutral group, a
1783
+ // butterfly's first side) sit 12 OKLab from the first series #6D6D6D;
1784
+ // the neutral itself stays the band and ladder ground.
1785
+ neutralMark: "#939393",
1786
+ neutralLight: "#D9D9D9",
1787
+ // The notation preset highlights with one signal colour. A grey accent would sit one step from
1788
+ // the neutral (#808080 against #818181), so a highlighted effect, a
1789
+ // butterfly's second side and an info state would read as the neutral.
1790
+ highlight: "#2A6CBA",
1791
+ total: "#404040",
1792
+ others: "#EFEFEF",
1793
+ // An Others mark has no outline by default, so it steps past the page floor (1.43:1);
1794
+ // the ground uses of color.others keep the quieter grey.
1795
+ othersMark: "#D8D8D8",
1796
+ ink: "#1A1A1A",
1797
+ inkInverse: "#FFFFFF",
1798
+ inkMuted: "#595959",
1799
+ axis: "#1A1A1A",
1800
+ grid: "#E6E6E6",
1801
+ leader: "#A0A0A0",
1802
+ background: "#FFFFFF",
1803
+ // Five greys is the most that keep 3:1 as marks and 12 OKLab apart (0.54,
1804
+ // 0.29, 0.66, 0.41, 0.15 lightness); the six pale greys before sat 5 apart.
1805
+ series: ["#6D6D6D", "#2A2A2A", "#939393", "#4A4A4A", "#0C0C0C"],
1806
+ seriesOverflow: "repeatLast",
1807
+ status: {
1808
+ advanced: "#818181",
1809
+ open: "#D5D5D5",
1810
+ lost: "#E2564A",
1811
+ pending: "#A4A4A4",
1812
+ won: "#404040",
1813
+ "gantt-workstream": "#818181",
1814
+ "gantt-detail": "#B5B5B5",
1815
+ "gantt-special": "#404040",
1816
+ "gantt-cadence": "#6F6F6F"
1817
+ },
1818
+ // Colorblind-safe pair: a blue apart from the signal
1819
+ // accent and an orange apart from the amber warn under protan and deutan
1820
+ // vision, both mid-tone so ink furniture and the page read against them.
1821
+ colorblind: { good: "#5588FB", bad: "#E16D08", badFill: LIGHT_CB_BAD_FILL },
1822
+ warn: "#896600",
1823
+ warnFill: LIGHT_WARN_FILL
1824
+ },
1825
+ scenario: { AC: "solid", PY: "solidLight", PL: "outline", FC: "hatch45" },
1826
+ pattern: { hatchAngle: 45, hatchColor: "segment", hatchGap: 6, hatchStrokeWidth: 0.75, outlineStrokeWidth: 1.5 },
1827
+ // The canonical type scale, with regular body text. Notation identity
1828
+ // lives in the grey ramp, notation, and rhythm tokens below, not in a
1829
+ // private type scale.
1830
+ type: canonicalType("Arial, 'Helvetica Neue', sans-serif"),
1831
+ space: { tierGap: 4, facetGap: 24, labelPad: 4 },
1832
+ surface: { chipTint: 0.9, rowTint: 0.94, elapsedTint: 0.95, anchorTint: 0.97, chipRadius: 0 }
1833
+ }, notationDarkTheme = {
1834
+ ...notationTheme,
1835
+ name: "notation-dark",
1836
+ color: {
1837
+ ...notationTheme.color,
1838
+ // On the near-black page the bright tones read as text at 5:1 or more;
1839
+ // the fills are notation's own.
1840
+ good: "#0FA060",
1841
+ bad: "#E2564A",
1842
+ neutral: "#D5D5D5",
1843
+ neutralMark: "#D5D5D5",
1844
+ // Below the series greys, so a bartable range and a receded mark stay
1845
+ // apart from every series.
1846
+ neutralLight: "#3A3A3A",
1847
+ // The light-side signal colour, lifted for the dark page.
1848
+ highlight: "#64A9F3",
1849
+ total: "#ACACAC",
1850
+ others: "#303030",
1851
+ // The light preset's Others mark is a light grey: the dark page's Others mark is `others` (1.52:1).
1852
+ othersMark: void 0,
1853
+ ink: "#F2F2F2",
1854
+ inkInverse: "#080808",
1855
+ inkMuted: "#AFAFAF",
1856
+ axis: "#E5E5E5",
1857
+ grid: "#333333",
1858
+ leader: "#777777",
1859
+ background: "#080808",
1860
+ series: [...NOTATION_DARK_SERIES],
1861
+ warn: DARK_WARN,
1862
+ warnFill: DARK_WARN,
1863
+ status: {
1864
+ ...notationTheme.color.status,
1865
+ advanced: "#D5D5D5",
1866
+ open: "#858585",
1867
+ pending: "#5E5E5E",
1868
+ // Apart from the neutral #D5D5D5 a maturity key shows beside it.
1869
+ won: "#FFFFFF",
1870
+ "gantt-workstream": "#ACACAC",
1871
+ "gantt-detail": "#858585",
1872
+ "gantt-special": "#F2F2F2",
1873
+ "gantt-cadence": "#D5D5D5"
1874
+ },
1875
+ colorblind: { good: "#417CE4", bad: "#A48228" }
1876
+ }
1877
+ }, roadshowFamilyThemes = Object.freeze({
1878
+ boardroom: { ...boardroom_default, table: tableFamily({ secondary: "#305B86", ruleInk: "#C3D3E3", barFill: "#D6E3F0" }) },
1879
+ capital: { ...capital_default, table: tableFamily() },
1880
+ studio: { ...studio_default, table: tableFamily() },
1881
+ glass: { ...glass_default, table: tableFamily() }
1882
+ }), glassTheme = roadshowFamilyThemes.glass, themes = Object.assign(/* @__PURE__ */ Object.create(null), {
1883
+ boardroom: roadshowFamilyThemes.boardroom,
1884
+ capital: roadshowFamilyThemes.capital,
1885
+ studio: roadshowFamilyThemes.studio,
1886
+ glass: roadshowFamilyThemes.glass,
1887
+ standard: standardTheme,
1888
+ "standard-dark": standardDarkTheme,
1889
+ notation: notationTheme,
1890
+ "notation-dark": notationDarkTheme
1891
+ }), PRESET_NAMES = /* @__PURE__ */ new Set(/* @__PURE__ */ Object.keys(themes));
1892
+ function registerTheme(theme) {
1893
+ if (PRESET_NAMES.has(theme.name))
1894
+ throw new NormalizeError("theme-name-reserved", "theme.name", `'${theme.name}' is a built-in preset`);
1895
+ themes[theme.name] = theme, registrations++;
1896
+ }
1897
+ var registrations = 0, themeRegistrations = () => registrations, ownThemes = /* @__PURE__ */ new WeakSet(), normalizedThemes = /* @__PURE__ */ new WeakMap(), libraryPatches = /* @__PURE__ */ new WeakSet();
1898
+ function libraryPatch(patch, authored) {
1899
+ return (Object.keys(authored).length === 0 || ownThemes.has(authored)) && libraryPatches.add(patch), patch;
1900
+ }
1901
+ var deepFrozen = /* @__PURE__ */ new WeakSet();
1902
+ function deepFreeze(value) {
1903
+ if (value === null || typeof value != "object" || deepFrozen.has(value)) return value;
1904
+ Object.isFrozen(value) || Object.freeze(value);
1905
+ for (let key of Reflect.ownKeys(value)) {
1906
+ let descriptor = Object.getOwnPropertyDescriptor(value, key);
1907
+ descriptor && "value" in descriptor && deepFreeze(descriptor.value);
1908
+ }
1909
+ return deepFrozen.add(value), value;
1910
+ }
1911
+ function own(theme) {
1912
+ if (ownThemes.has(theme)) return theme;
1913
+ let known = normalizedThemes.get(theme);
1914
+ if (known) return known;
1915
+ let normalized = themeColors(theme);
1916
+ return normalized !== theme && (deepFreeze(theme), normalizedThemes.set(theme, normalized)), ownThemes.add(normalized), deepFreeze(normalized);
1917
+ }
1918
+ function typeForTarget(base, target) {
1919
+ let sizes = targetTypeSizesPx(target, "M"), roles = Object.fromEntries(TYPE_ROLE_NAMES.map((role) => [role, {
1920
+ ...role === "micro" ? base.micro ?? { family: base.family, weight: 400, lineHeight: 1.2 } : role === "secondary" ? base.secondary ?? base.axis : base[role],
1921
+ size: sizes[role]
1922
+ }]));
1923
+ return { ...base, ...roles, scale: { S: targetTypeSizesPx(target, "S"), L: targetTypeSizesPx(target, "L") } };
1924
+ }
1925
+ var targetThemes = /* @__PURE__ */ new WeakMap();
1926
+ function resolveTargetTheme(ref, target, textScale = 1, textSize) {
1927
+ let theme = targetTheme(ref, target);
1928
+ if (typeof ref == "object" && ref.overrides && ownThemes.has(ref.overrides)) return theme;
1929
+ if (textSize !== void 0) {
1930
+ let pinned = pinnedTheme(theme);
1931
+ return scaledTextTheme(pinned, textSize / pinned.type.label.size, target);
1932
+ }
1933
+ return textScale === 1 ? theme : scaledTextTheme(theme, textScale, target);
1934
+ }
1935
+ var pinnedThemes = /* @__PURE__ */ new WeakMap();
1936
+ function pinnedTheme(theme) {
1937
+ let pinned = pinnedThemes.get(theme);
1938
+ if (!pinned) {
1939
+ let middle = Object.fromEntries(TYPE_ROLE_NAMES.flatMap((role) => {
1940
+ let spec = role === "micro" ? microType(theme) : role === "secondary" ? theme.type.secondary : theme.type[role];
1941
+ return spec ? [[role, spec.size]] : [];
1942
+ }));
1943
+ pinned = own({ ...theme, type: { ...theme.type, scale: { S: { ...middle }, L: { ...middle } } } }), pinnedThemes.set(theme, pinned);
1944
+ }
1945
+ return pinned;
1946
+ }
1947
+ var scaledThemes = /* @__PURE__ */ new WeakMap();
1948
+ function scaledTextTheme(theme, textScale, target) {
1949
+ let byScale = scaledThemes.get(theme);
1950
+ byScale || (byScale = /* @__PURE__ */ new Map(), scaledThemes.set(theme, byScale));
1951
+ let known = byScale.get(`${target}:${textScale}`);
1952
+ if (known) return known;
1953
+ let floors = targetFloorsPx(target), px = (size, floor) => scaleTextAtFloor(size, textScale, floor), type = theme.type, roles = Object.fromEntries(TYPE_ROLE_NAMES.flatMap((role) => {
1954
+ let spec = role === "micro" ? microType(theme) : type[role];
1955
+ return spec ? [[role, { ...spec, size: px(spec.size, floors[role]) }]] : [];
1956
+ })), step = (column) => column && Object.fromEntries(Object.entries(column).map(([role, size]) => [role, px(size, floors[role])])), table = theme.table, face = (value, floor) => value?.size === void 0 ? value : { ...value, size: px(value.size, floor) }, scaled = own({
1957
+ ...theme,
1958
+ type: {
1959
+ ...type,
1960
+ ...roles,
1961
+ ...type.scale ? { scale: { ...type.scale.S ? { S: step(type.scale.S) } : {}, ...type.scale.L ? { L: step(type.scale.L) } : {} } } : {},
1962
+ ...type.eyebrow ? { eyebrow: face(type.eyebrow, floors.micro) } : {}
1963
+ },
1964
+ ...table ? { table: {
1965
+ ...table,
1966
+ ...table.head ? { head: face(table.head, tableHeadFloorPx(target)) } : {},
1967
+ ...table.section ? { section: face(table.section, floors.label) } : {}
1968
+ } } : {}
1969
+ });
1970
+ return byScale.set(`${target}:${textScale}`, scaled), scaled;
1971
+ }
1972
+ function targetTheme(ref, target) {
1973
+ let preset = typeof ref == "string" ? ref : ref?.preset ?? "boardroom";
1974
+ if (!PRESET_NAMES.has(preset) || typeof ref == "object" && ref.overrides && ownThemes.has(ref.overrides))
1975
+ return resolveTheme(ref);
1976
+ let base = resolveTheme(preset), byTarget = targetThemes.get(base);
1977
+ byTarget || (byTarget = /* @__PURE__ */ new Map(), targetThemes.set(base, byTarget));
1978
+ let sized = byTarget.get(target);
1979
+ return sized || (sized = own({ ...base, type: typeForTarget(base.type, target) }), byTarget.set(target, sized)), typeof ref == "object" && ref.overrides ? validatedOverride(sized, ref.overrides, preset) : sized;
1980
+ }
1981
+ var REMOVED_NAMES = /* @__PURE__ */ Symbol("removedNames");
1982
+ function removedNameWarnings(options) {
1983
+ let warnings = [], ref = options?.theme;
1984
+ if (ref !== null && typeof ref == "object" && ownThemes.has(ref.overrides ?? {})) return warnings;
1985
+ let preset = typeof ref == "string" ? ref : ref !== null && typeof ref == "object" ? ref.preset : void 0, base = typeof preset == "string" ? Object.hasOwn(themes, preset) ? themes[preset] : adoptedTheme(preset) : void 0, change = ref && typeof ref == "object" ? ref.overrides?.table?.weights?.change : void 0;
1986
+ if (change !== void 0 || base?.table?.weights?.change !== void 0) {
1987
+ let authored = change !== void 0 && base?.table?.weights?.change === void 0;
1988
+ warnings.push({
1989
+ code: "option-deprecated",
1990
+ severity: "warn",
1991
+ message: "table.weights.change is ignored and is refused from the next release.",
1992
+ ...authored ? {
1993
+ suggest: "Remove theme.overrides.table.weights.change.",
1994
+ field: ["options", "theme", "overrides", "table", "weights", "change"],
1995
+ fix: [{ op: "remove", path: "/options/theme/overrides/table/weights/change" }]
1996
+ } : {
1997
+ suggest: `Remove table.weights.change from the '${preset}' theme definition and authored overrides.`,
1998
+ field: ["options", "theme"]
1999
+ }
2000
+ });
2001
+ }
2002
+ return warnings;
2003
+ }
2004
+ function resolveTheme(ref) {
2005
+ if (!ref) return own(roadshowFamilyThemes.boardroom);
2006
+ let presetName = typeof ref == "string" ? ref : ref.preset, base = Object.hasOwn(themes, presetName) ? themes[presetName] : adoptedTheme(presetName);
2007
+ if (!base) {
2008
+ if (typeof ref == "object" && ref.overrides && !requireDeferred("theme-rules").checkThemeShape(ref.overrides).length) return own(ref.overrides);
2009
+ throw new NormalizeError(
2010
+ "unknown-theme",
2011
+ "options.theme",
2012
+ `unknown theme '${String(presetName)}'`,
2013
+ Object.keys(themes).join(", ")
2014
+ );
2015
+ }
2016
+ return typeof ref == "string" || !ref.overrides ? own(base) : validatedOverride(base, ref.overrides, presetName);
2017
+ }
2018
+ var mergedThemes = /* @__PURE__ */ new WeakMap();
2019
+ function memoizedMerge(base, overrides, resolve) {
2020
+ let byOverrides = mergedThemes.get(base);
2021
+ byOverrides || (byOverrides = /* @__PURE__ */ new WeakMap(), mergedThemes.set(base, byOverrides));
2022
+ let known = byOverrides.get(overrides);
2023
+ if (known) return known;
2024
+ let resolved2 = resolve();
2025
+ return byOverrides.set(overrides, resolved2), resolved2;
2026
+ }
2027
+ function validatedOverride(base, overrides, presetName) {
2028
+ return memoizedMerge(base, overrides, () => checkedOverride(base, overrides, presetName));
2029
+ }
2030
+ function authoredSizesHold(base, overrides) {
2031
+ let type = overrides.type;
2032
+ if (typeof type != "object" || type === null) return overrides;
2033
+ let steps = {}, roles = {};
2034
+ for (let role of TYPE_ROLE_NAMES)
2035
+ typeof type[role]?.size == "number" && (roles[role] = { ...type[role], [AUTHORED_TYPE_SIZE]: !0 });
2036
+ for (let column of ["S", "L"])
2037
+ for (let role of TYPE_ROLE_NAMES) {
2038
+ let size = type[role]?.size;
2039
+ typeof size == "number" && base.type.scale?.[column]?.[role] !== void 0 && ((steps[column] ??= {})[role] = size);
2040
+ }
2041
+ return Object.keys(roles).length > 0 ? { ...overrides, type: { ...type, ...roles, scale: mergeDeep(steps, type.scale) } } : overrides;
2042
+ }
2043
+ function familyFollows(base, overrides) {
2044
+ let type = overrides.type;
2045
+ if (typeof type?.family != "string" || type.family === base.type.family) return overrides;
2046
+ let roles = {};
2047
+ for (let role of TYPE_ROLE_NAMES)
2048
+ base.type[role]?.family === base.type.family && typeof type[role]?.family != "string" && (roles[role] = { ...type[role], family: type.family });
2049
+ return { ...overrides, type: { ...type, ...roles } };
2050
+ }
2051
+ function checkedOverride(base, overrides, presetName) {
2052
+ if (ownThemes.has(overrides) || libraryPatches.has(overrides)) return own(mergeDeep(base, overrides));
2053
+ let series = overrides.color?.series, authored = Array.isArray(series) ? series.filter((value) => typeof value == "string") : [];
2054
+ if (Array.isArray(series) && authored.length === series.length && series.length > 0 && series.length < 3) {
2055
+ let ramp = [...authored], used = new Set(authored.map((value) => JSON.stringify(parseColor(value))));
2056
+ for (let value of base.color.series) {
2057
+ let key = JSON.stringify(parseColor(value));
2058
+ if (!used.has(key) && (ramp.push(value), used.add(key), ramp.length >= base.color.series.length))
2059
+ break;
2060
+ }
2061
+ overrides = { ...overrides, color: { ...overrides.color, series: ramp } };
2062
+ }
2063
+ let merged = mergeDeep(base, familyFollows(base, authoredSizesHold(base, overrides))), rules = requireDeferred("theme-rules"), issues = rules.checkThemeShape(merged);
2064
+ if (issues.length > 0) {
2065
+ let repair = rules.unknownThemeKeyRepair(issues, "/options/theme/overrides");
2066
+ throw new NormalizeError(
2067
+ "invalid-theme-override",
2068
+ "options.theme.overrides",
2069
+ `overrides on preset '${presetName}' produce a structurally invalid theme \u2014 ${issues.join("; ")}`,
2070
+ repair?.suggest ?? "keep each token within its declared type and bounds",
2071
+ repair?.fix
2072
+ );
2073
+ }
2074
+ let blocking = rules.semanticErasureWarnings(base).length > 0 ? [] : rules.semanticErasureWarnings(merged);
2075
+ if (blocking.length > 0)
2076
+ throw new NormalizeError(
2077
+ "invalid-theme-override",
2078
+ "options.theme.overrides",
2079
+ `overrides on preset '${presetName}' erase a judgment token \u2014 ${blocking.map((b) => `${b.code}: ${b.message}`).join("; ")}`,
2080
+ blocking.find((b) => b.suggest)?.suggest
2081
+ );
2082
+ return own(merged);
2083
+ }
2084
+ var UNSAFE_MERGE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
2085
+ function mergeDeep(base, patch) {
2086
+ if (patch == null) return base;
2087
+ if (Array.isArray(patch) || typeof patch != "object") return patch;
2088
+ let out = { ...base };
2089
+ AUTHORED_TYPE_SIZE in patch && (out[AUTHORED_TYPE_SIZE] = !0);
2090
+ for (let [k, v] of Object.entries(patch)) {
2091
+ if (UNSAFE_MERGE_KEYS.has(k)) continue;
2092
+ let bv = base?.[k];
2093
+ out[k] = mergeDeep(bv, v);
2094
+ }
2095
+ return out;
2096
+ }
2097
+ function hatchPaint(fill, theme, ground, look) {
2098
+ let stripe = fullHatchPaint(fill, theme, ground, look?.stacked), grounded = "theme" in stripe && stripe.theme?.kind === "hatch-stripe" && stripe.theme.strength !== void 0;
2099
+ return !look || look.strength >= 100 || grounded ? stripe : {
2100
+ token: "token" in stripe ? stripe.token : "background",
2101
+ theme: { kind: "hatch-fade", stripe, ground: ground ?? { token: "background" }, strength: look.strength, cue: look.cue }
2102
+ };
2103
+ }
2104
+ function fullHatchPaint(fill, theme, ground, stacked) {
2105
+ if (theme.pattern.hatchColor === "ink") return { token: "ink" };
2106
+ if ("css" in fill) return fill;
2107
+ if (ground && "theme" in ground && ground.theme?.kind === "hatch-ground") {
2108
+ let { peers, strength, apart } = ground.theme;
2109
+ return { token: fill.token, theme: {
2110
+ kind: "hatch-stripe",
2111
+ base: fill,
2112
+ grounded: !0,
2113
+ ...peers ? { peers } : {},
2114
+ ...strength !== void 0 ? { strength } : {},
2115
+ ...apart ? { apart } : {}
2116
+ } };
2117
+ }
2118
+ let color = paintColor(theme, fill), step = stacked && greyStepped(theme, color);
2119
+ return contrastRatio(color, theme.color.background) >= MARK_CONTRAST_FLOOR && !step ? fill : { token: fill.token, theme: { kind: "hatch-stripe", base: fill, ...step ? { stacked } : {} } };
2120
+ }
2121
+ var HATCH_STRENGTH_DEFAULT = { second: 60, sole: 100 }, HATCH_SECOND_CUE_FLOOR = 2, HATCH_MAX_FADE = 0.65, HATCH_MAX_SPREAD = 1.5;
2122
+ function hatchGapFactor(look) {
2123
+ return look?.cue === "second" ? 1 + HATCH_MAX_SPREAD * (1 - look.strength / 100) : 1;
2124
+ }
2125
+ function hatchRuleCoverage(theme) {
2126
+ return Math.min(1, theme.pattern.hatchStrokeWidth / theme.pattern.hatchGap);
2127
+ }
2128
+ function hatchStrokeWidthFor(theme, look) {
2129
+ return theme.pattern.hatchStrokeWidth * (look?.cue === "second" ? 0.7 : 1);
2130
+ }
2131
+ function hatchFadeColor(stripe, ground, strength, cue) {
2132
+ let floor = cue === "sole" ? MARK_CONTRAST_FLOOR + 0.12 : HATCH_SECOND_CUE_FLOOR;
2133
+ for (let step = Math.round(HATCH_MAX_FADE * (1 - strength / 100) * 100); step > 0; step--) {
2134
+ let faded = mixColors(ground, stripe, step / 100);
2135
+ if (contrastRatio(faded, ground) >= floor) return faded;
2136
+ }
2137
+ return stripe;
2138
+ }
2139
+ function stampHatchLook(nodes, strength) {
2140
+ let hatched = (node) => (node.t === "rect" || node.t === "path") && isHatchPattern(node.pattern), second = (node) => node.t === "path" && node.part === "area", marks = nodes.filter((node) => hatched(node) && !node.hatch && node.id.startsWith("mark:")), keyCue = marks.length > 0 && marks.every((node) => second(node)) ? "second" : "sole";
2141
+ return nodes.map((node) => {
2142
+ if (!hatched(node) || node.hatch) return node;
2143
+ let cue = node.id.startsWith("mark:") ? second(node) ? "second" : "sole" : keyCue;
2144
+ return { ...node, hatch: { strength: strength ?? HATCH_STRENGTH_DEFAULT[cue], cue } };
2145
+ });
2146
+ }
2147
+ function surfaceFloorPaint(base, surfaces) {
2148
+ return { token: "css" in base ? "background" : base.token, theme: { kind: "surface-floor", base, surfaces } };
2149
+ }
2150
+ function ribbonPaint(base) {
2151
+ return { token: "css" in base ? "background" : base.token, theme: { kind: "ribbon", base } };
2152
+ }
2153
+ function ribbonColor(theme, source) {
2154
+ let page = theme.color.background, base = compositeColor(paintColor(theme, source.base), page), rgb = parseColor(base);
2155
+ if (!rgb) return base;
2156
+ let hex = (value) => Math.round(value).toString(16).padStart(2, "0"), translucent = (alpha) => `#${hex(rgb.r)}${hex(rgb.g)}${hex(rgb.b)}${hex(alpha)}`, start = Math.round(resolveSurface(theme).ribbonAlpha * 255);
2157
+ if (darkPage(theme)) return translucent(start);
2158
+ for (let alpha = start; alpha < 255; alpha++)
2159
+ if (contrastRatio(mixColors(base, page, alpha / 255), page) >= markVisibilityFloor(page)) return translucent(alpha);
2160
+ return base;
2161
+ }
2162
+ function surfaceFloorColor(theme, base, surfaces) {
2163
+ let grounds = [theme.color.background, ...surfaces], floor = markVisibilityFloor(theme.color.background) + 0.05, markInk = paintTokenColor(theme, "markInk");
2164
+ for (let step = 0; step <= 50; step++) {
2165
+ let fill = step === 0 ? base : mixColors(markInk, base, step / 50);
2166
+ if (grounds.every((ground) => contrastRatio(fill, ground) >= floor)) return fill;
2167
+ }
2168
+ return markInk;
2169
+ }
2170
+ var HATCH_GROUND_SHARE = 0.5;
2171
+ function hatchGroundPaint(fill, peers, grounding) {
2172
+ return { token: "css" in fill ? "background" : fill.token, theme: { kind: "hatch-ground", base: fill, ...peers ? { peers: [...peers] } : {}, ...grounding } };
2173
+ }
2174
+ function joinHatchPeers(nodes) {
2175
+ let grounded = (node) => node.t === "rect" && node.hatchGround !== void 0 && "theme" in node.hatchGround && node.hatchGround.theme?.kind === "hatch-ground", peers = /* @__PURE__ */ new Map();
2176
+ for (let node of nodes) grounded(node) && peers.set(JSON.stringify(node.fill), node.fill);
2177
+ if (peers.size < 2) return nodes;
2178
+ let list = [...peers.values()];
2179
+ return nodes.map((node) => grounded(node) ? { ...node, hatchGround: hatchGroundPaint(node.fill, list) } : node);
2180
+ }
2181
+ function groundedHatchColors(theme, fill, authored = !1, peers, grounding) {
2182
+ if (!peers || peers.length < 2) {
2183
+ let soloKey = `${fill}|${authored}||${grounding?.strength ?? ""}|${grounding?.apart ?? ""}`, soloCache = GROUNDED_HATCHES.get(theme);
2184
+ soloCache || GROUNDED_HATCHES.set(theme, soloCache = /* @__PURE__ */ new Map());
2185
+ let soloHit = soloCache.get(soloKey);
2186
+ if (soloHit) return soloHit;
2187
+ let solved = soloGroundedHatch(theme, fill, authored, void 0, grounding);
2188
+ return soloCache.set(soloKey, solved), solved;
2189
+ }
2190
+ let key = `${fill}|${authored}|${peers.map((peer) => `${peer.color}${peer.authored ? "*" : ""}`).join(",")}|${grounding?.strength ?? ""}|${grounding?.apart ?? ""}`, cache = GROUNDED_HATCHES.get(theme);
2191
+ cache || GROUNDED_HATCHES.set(theme, cache = /* @__PURE__ */ new Map());
2192
+ let hit = cache.get(key);
2193
+ if (hit) return hit;
2194
+ let page = theme.color.background, order = [...peers].sort((a, b) => contrastRatio(b.color, page) - contrastRatio(a.color, page)), drawn = [], own2 = soloGroundedHatch(theme, fill, authored, void 0, grounding);
2195
+ for (let peer of order) {
2196
+ let solved = soloGroundedHatch(theme, peer.color, peer.authored, (stripe) => drawn.every((other) => !swatchesApart(peer.color, other.key) || swatchesApart(stripe, other.stripe)), grounding);
2197
+ drawn.push({ key: peer.color, stripe: solved.stripe }), peer.color === fill && peer.authored === authored && (own2 = solved);
2198
+ }
2199
+ return cache.set(key, own2), own2;
2200
+ }
2201
+ function hatchPeers(theme, peers) {
2202
+ return peers?.map((peer) => ({ color: paintColor(theme, peer), authored: "css" in peer }));
2203
+ }
2204
+ function hatchGrounding(theme, source) {
2205
+ return source.strength === void 0 ? void 0 : { strength: source.strength, ...source.apart ? { apart: paintColor(theme, source.apart) } : {} };
2206
+ }
2207
+ var GROUNDED_HATCH_DEFAULT = 60, GROUNDED_STRONG_TARGET = 4.5, GROUNDED_HATCHES = /* @__PURE__ */ new WeakMap();
2208
+ function swatchesApart(a, b) {
2209
+ return palettePerceptualDistance(a, b, "normal") >= PALETTE_NORMAL_FLOOR && Math.min(palettePerceptualDistance(a, b, "protan"), palettePerceptualDistance(a, b, "deutan")) >= PALETTE_CVD_FLOOR && palettePerceptualDistance(a, b, "tritan") >= PALETTE_TRITAN_FLOOR;
2210
+ }
2211
+ function soloGroundedHatch(theme, fill, authored, allowed = () => !0, grounding) {
2212
+ let strength = grounding?.strength ?? GROUNDED_HATCH_DEFAULT, solved = solveGroundedHatch(theme, fill, authored, allowed, MARK_CONTRAST_FLOOR + 0.12);
2213
+ if (strength > GROUNDED_HATCH_DEFAULT) {
2214
+ if (theme.pattern.hatchColor === "ink" || authored) return solved;
2215
+ let target = MARK_CONTRAST_FLOOR + 0.12 + (strength - GROUNDED_HATCH_DEFAULT) / (100 - GROUNDED_HATCH_DEFAULT) * (GROUNDED_STRONG_TARGET - MARK_CONTRAST_FLOOR - 0.12), markInk = paintTokenColor(theme, "markInk");
2216
+ for (let deepen = 1; deepen <= 100; deepen++) {
2217
+ let stripe = mixColors(markInk, solved.stripe, deepen / 100);
2218
+ if (!allowed(stripe)) break;
2219
+ if (contrastRatio(stripe, solved.ground) >= target) return { stripe, ground: solved.ground };
2220
+ }
2221
+ return solved;
2222
+ }
2223
+ if (strength === GROUNDED_HATCH_DEFAULT) return solved;
2224
+ let coverage = hatchRuleCoverage(theme), seen = (stripe) => mixColors(stripe, solved.ground, coverage), apart = grounding?.apart, floor = apart === void 0 ? 0 : Math.min(PALETTE_NORMAL_FLOOR, palettePerceptualDistance(seen(solved.stripe), apart));
2225
+ for (let step = Math.round(HATCH_MAX_FADE * (1 - strength / GROUNDED_HATCH_DEFAULT) * 100); step > 0; step--) {
2226
+ let stripe = mixColors(solved.ground, solved.stripe, step / 100);
2227
+ if (apart === void 0 || palettePerceptualDistance(seen(stripe), apart) >= floor) return { stripe, ground: solved.ground };
2228
+ }
2229
+ return solved;
2230
+ }
2231
+ function solveGroundedHatch(theme, fill, authored, allowed, stripeTarget) {
2232
+ let page = theme.color.background, floor = markVisibilityFloor(page), cellTarget = floor === 3 ? 1 : floor + 0.12, coverage = hatchRuleCoverage(theme), fixed = theme.pattern.hatchColor === "ink" ? theme.color.ink : authored ? fill : void 0, start = fixed ?? fill, markInk = paintTokenColor(theme, "markInk"), lightestGround = (stripe) => {
2233
+ for (let step = HATCH_GROUND_SHARE * 50; step > 0; step--) {
2234
+ let ground = mixColors(fill, page, step / 50);
2235
+ if (contrastRatio(stripe, ground) >= stripeTarget) return ground;
2236
+ }
2237
+ return page;
2238
+ }, last = start;
2239
+ for (let deepen = 0; deepen <= 100; deepen++) {
2240
+ let stripe = deepen === 0 ? start : mixColors(markInk, start, deepen / 100);
2241
+ if (deepen > 0 && !allowed(stripe)) return { stripe: last, ground: lightestGround(last) };
2242
+ last = stripe;
2243
+ for (let step = HATCH_GROUND_SHARE * 50; step >= 0; step--) {
2244
+ let ground = mixColors(fill, page, step / 50);
2245
+ if (!(contrastRatio(stripe, ground) < stripeTarget)) {
2246
+ if (contrastRatio(mixColors(stripe, ground, coverage), page) >= cellTarget) return { stripe, ground };
2247
+ break;
2248
+ }
2249
+ }
2250
+ if (fixed !== void 0) return { stripe, ground: page };
2251
+ }
2252
+ return { stripe: markInk, ground: page };
2253
+ }
2254
+ var GREY_HATCH_STEP = 2 * PALETTE_NORMAL_FLOOR, isGrey = (color) => {
2255
+ let rgb = parseColor(color);
2256
+ return rgb !== null && rgb.r === rgb.g && rgb.g === rgb.b;
2257
+ };
2258
+ function greyStepped(theme, fill) {
2259
+ return isGrey(fill) && theme.color.series.every(isGrey) && contrastRatio(fill, theme.color.background) >= MARK_CONTRAST_FLOOR;
2260
+ }
2261
+ function hatchStripeColor(theme, fill, stacked) {
2262
+ let background = theme.color.background;
2263
+ if (!parseColor(fill)) return fill;
2264
+ let ink = paintTokenColor(theme, "markInk"), deepen = (from, done) => {
2265
+ if (done(from)) return from;
2266
+ for (let weight = 0.02; weight < 1; weight += 0.02) {
2267
+ let stripe = mixColors(ink, from, weight);
2268
+ if (done(stripe)) return stripe;
2269
+ }
2270
+ return ink;
2271
+ }, onPage = (stripe) => contrastRatio(stripe, background) >= MARK_CONTRAST_FLOOR;
2272
+ if (!stacked || !greyStepped(theme, fill)) return deepen(fill, onPage);
2273
+ let floorGrey = deepen(background, onPage);
2274
+ return deepen(fill, (grey) => palettePerceptualDistance(grey, floorGrey, "normal") >= GREY_HATCH_STEP);
2275
+ }
2276
+ function separatedWashPaint(token, amount) {
2277
+ return { token, theme: { kind: "visible-tint", base: { token }, amount, floor: FILL_SEPARATION_FLOOR } };
2278
+ }
2279
+ var PLAN_MUTED_PAINT = { token: "inkMuted", tint: 0.65 };
2280
+ function solidMutedPlan(theme) {
2281
+ return theme.scenario.PL === "solidMuted";
2282
+ }
2283
+ function effectiveFill(fill, pattern, theme) {
2284
+ if (pattern === "outline")
2285
+ return solidMutedPlan(theme) ? mixColors(theme.color.inkMuted, theme.color.background, 1 - PLAN_MUTED_PAINT.tint) : theme.color.background;
2286
+ if (pattern === "hatch45" || pattern === "crosshatch" || pattern === "horizontal" || pattern === "vertical") {
2287
+ let coverage = hatchRuleCoverage(theme);
2288
+ return mixColors(theme.pattern.hatchColor === "ink" ? theme.color.ink : hatchStripeColor(theme, fill), theme.color.background, coverage);
2289
+ }
2290
+ return fill;
2291
+ }
2292
+ var WARN_FALLBACK = "#8F6A00";
2293
+ function warnColor(theme) {
2294
+ return theme.color.warn ?? WARN_FALLBACK;
2295
+ }
2296
+ function resolveSurface(theme) {
2297
+ let surface = theme.surface;
2298
+ return {
2299
+ chipTint: surface?.chipTint ?? 0.9,
2300
+ rowTint: surface?.rowTint ?? 0.94,
2301
+ elapsedTint: surface?.elapsedTint ?? 0.95,
2302
+ anchorTint: surface?.anchorTint ?? 0.97,
2303
+ bandTint: surface?.bandTint ?? 0.06,
2304
+ gapTint: surface?.gapTint ?? (darkPage(theme) ? 0.65 : 0.82),
2305
+ ribbonAlpha: surface?.ribbonAlpha ?? 0.35,
2306
+ ribbonSheetAlpha: surface?.ribbonSheetAlpha ?? 0.18,
2307
+ chipRadius: surface?.chipRadius ?? 2
2308
+ };
2309
+ }
2310
+ var WIDE_CANVAS_MIN_WIDTH = 1080, SPACE_CANVAS_WIDE = { top: 24, right: 32, bottom: 20, left: 32 }, CANVAS_MARGIN_STEPS = [
2311
+ { minWidth: 840, margin: { top: 20, right: 28, bottom: 10, left: 28 } },
2312
+ { minWidth: 600, margin: { top: 20, right: 24, bottom: 10, left: 24 } },
2313
+ { minWidth: 0, margin: { top: 16, right: 16, bottom: 10, left: 16 } }
2314
+ ];
2315
+ function defaultCanvasMargin(width) {
2316
+ if (width >= WIDE_CANVAS_MIN_WIDTH) return SPACE_CANVAS_WIDE;
2317
+ for (let step of CANVAS_MARGIN_STEPS) if (width >= step.minWidth) return step.margin;
2318
+ return CANVAS_MARGIN_STEPS[CANVAS_MARGIN_STEPS.length - 1].margin;
2319
+ }
2320
+ function spaceTokens(theme, width) {
2321
+ let wide = width >= WIDE_CANVAS_MIN_WIDTH, canvas = theme.space.canvas, gap = theme.space.gap;
2322
+ return {
2323
+ margin: { ...defaultCanvasMargin(width), ...wide ? canvas?.wide : canvas?.base },
2324
+ gapTitleSubtitle: gap?.titleSubtitle ?? 4,
2325
+ // 8 below W-L: the first plot element sits about 16-18 px under the last
2326
+ // header baseline; 12 would leave charts about 5 px lower.
2327
+ gapSubtitlePlot: (wide ? gap?.subtitlePlotWide : gap?.subtitlePlot) ?? (wide ? 14 : 8),
2328
+ gapAxisFootnote: (wide ? gap?.axisFootnoteWide : gap?.axisFootnote) ?? (wide ? 14 : 12),
2329
+ // A key row under the plot sits 10 px over the footer below W-L (key
2330
+ // baseline to source baseline 25.6-25.9 px). An authored axisFootnote gap still sets both.
2331
+ gapKeyFootnote: (wide ? gap?.axisFootnoteWide : gap?.axisFootnote) ?? (wide ? 14 : 10),
2332
+ gapFootnoteSource: gap?.footnoteSource ?? 4,
2333
+ gapLegend: gap?.legend ?? 8,
2334
+ legendRowH: theme.space.legendRowH ?? 18
2335
+ };
2336
+ }
2337
+ function canvasMargin(theme, width) {
2338
+ return spaceTokens(theme, width).margin;
2339
+ }
2340
+ function seriesColor(theme, index, ramp) {
2341
+ let r = ramp && ramp.length > 0 ? ramp : theme.color.series;
2342
+ return r[seriesColorIndex(theme, index, r)];
2343
+ }
2344
+ function seriesColorIndex(theme, index, ramp) {
2345
+ let length = ramp && ramp.length > 0 ? ramp.length : theme.color.series.length;
2346
+ return index < length ? index : theme.color.seriesOverflow === "cycle" ? index % length : length - 1;
2347
+ }
2348
+ function rampSlots(theme, own2, palette, repeats, stacked = !1) {
2349
+ let ramp = theme.color.palettes?.[palette ?? ""], key = (css) => {
2350
+ let rgb = parseColor(css);
2351
+ return rgb ? `${rgb.r},${rgb.g},${rgb.b}` : css.trim().toUpperCase();
2352
+ }, taken = new Set(own2.flatMap((paint) => paint ? [key(paintColor(theme, paint))] : [])), length = (ramp && ramp.length > 0 ? ramp : theme.color.series).length, authored = stacked ? own2.flatMap((paint) => paint ? [paintColor(theme, paint)] : []) : [], near = (slot) => authored.some((css) => !swatchesApart(css, seriesColor(theme, slot, ramp))), next = 0, repeated = [], slots = own2.map((paint, index) => {
2353
+ if (paint) return index;
2354
+ let slot = Math.max(index, next), apart = Array.from({ length: Math.max(0, length - slot) }, (_, k) => slot + k).find((step) => !taken.has(key(seriesColor(theme, step, ramp))) && !near(step));
2355
+ for (apart !== void 0 && (slot = apart); slot < length && taken.has(key(seriesColor(theme, slot, ramp))); ) slot += 1;
2356
+ return slot >= length && (slot = Array.from({ length }, (_, step) => step).find((step) => !taken.has(key(seriesColor(theme, step, ramp)))) ?? Math.max(index, next)), next = slot + 1, taken.has(key(seriesColor(theme, slot, ramp))) && repeated.push(index), taken.add(key(seriesColor(theme, slot, ramp))), slot;
2357
+ });
2358
+ if (repeats && repeated.length > 0) {
2359
+ let groups = /* @__PURE__ */ new Map();
2360
+ for (let index of repeated) {
2361
+ let color = key(seriesColor(theme, slots[index], ramp));
2362
+ groups.has(color) || groups.set(color, slots.flatMap((slot, i) => key(own2[i] ? paintColor(theme, own2[i]) : seriesColor(theme, slot, ramp)) === color ? [i] : []));
2363
+ }
2364
+ let names = [...groups.values()].map((group) => group.map((index) => `'${repeats.labels[index] ?? index}'`).join(" and ")).join("; ");
2365
+ repeats.warnings.push({
2366
+ code: "series-colour-repeated",
2367
+ severity: "warn",
2368
+ message: `${own2.length} series share a ramp of ${length} colours. These series share a colour: ${names}.`,
2369
+ suggest: "group the tail into an 'Other' series when the values add, use small multiples, or set distinct colorRole values or fills; series-N needs a distinct step in color.series"
2370
+ });
2371
+ }
2372
+ return slots;
2373
+ }
2374
+ var OPTIONAL_ROLE_FALLBACK = { focus: "highlight", spark: "neutralMark", neutralMark: "neutral", goodFill: "good", badFill: "bad", warnFill: "warn", inkMeta: "inkMuted", rest: "neutralLight", othersMark: "others", markInk: "ink", heatTop: "markInk", heatTopInk: "inkInverse", rule: "axis", reference: "axis" };
2375
+ function resolvedPaintToken(theme, token) {
2376
+ let fallback = OPTIONAL_ROLE_FALLBACK[token];
2377
+ return fallback && theme.color[token] === void 0 ? resolvedPaintToken(theme, fallback) : token.startsWith("status-") && theme.color.status[token.slice(7)] === void 0 ? resolvedPaintToken(theme, "neutralMark") : token;
2378
+ }
2379
+ function paintTokenColor(theme, token) {
2380
+ token = resolvedPaintToken(theme, token);
2381
+ let color = theme.color;
2382
+ if (token === "case-1" || token === "case-2") return (color.casePair ?? [color.neutralLight, color.series[0]])[token === "case-1" ? 0 : 1];
2383
+ if (token === "warn") return color.warn ?? WARN_FALLBACK;
2384
+ if (token.startsWith("series-"))
2385
+ return seriesColor(theme, Math.max(0, Number(token.slice(7)) - 1));
2386
+ if (token.startsWith("status-"))
2387
+ return color.status[token.slice(7)];
2388
+ let direct = color[token];
2389
+ return typeof direct == "string" ? direct : color.ink;
2390
+ }
2391
+ function scenarioSeriesColor(theme, index, ramp, scenario, deEmphasizePy = !0, surfaceFade = !1) {
2392
+ let base = seriesColor(theme, index, ramp), background = theme.color.background, floor = markVisibilityFloor(background), target = scenario === "FC" ? floor + 0.12 : floor, visibilityContrast = (candidate) => {
2393
+ if (scenario !== "FC") return contrastRatio(candidate, background);
2394
+ let rendered = effectiveFill(candidate, "hatch45", theme), edge = theme.pattern.hatchColor === "ink" ? theme.color.ink : hatchStripeColor(theme, candidate);
2395
+ return Math.max(contrastRatio(rendered, background), Math.min(contrastRatio(edge, rendered), contrastRatio(edge, background)));
2396
+ };
2397
+ if (surfaceFade) {
2398
+ let fadeTarget = contrastRatio("#000000", background) >= contrastRatio("#000000", theme.color.ink) ? background : theme.color.ink, low = tint(base, 0.45, fadeTarget);
2399
+ for (let amount = 0.45; amount > 0.05 && contrastRatio(low, background) < 3; )
2400
+ low = tint(base, amount -= 0.01, fadeTarget);
2401
+ return low;
2402
+ }
2403
+ if (scenario === "PY" && deEmphasizePy) {
2404
+ let light = mixColors(base, background, 0.45);
2405
+ if (visibilityContrast(light) >= floor) return light;
2406
+ for (let lightWeight = 0.99; lightWeight >= 0; lightWeight -= 0.01) {
2407
+ let candidate = mixColors(light, base, lightWeight);
2408
+ if (visibilityContrast(candidate) >= floor) return candidate;
2409
+ }
2410
+ return base;
2411
+ }
2412
+ if (visibilityContrast(base) >= target) return base;
2413
+ let lightnessPole = floor === 3 ? "#FFFFFF" : "#000000";
2414
+ for (let baseWeight = 0.99; baseWeight >= 0; baseWeight -= 0.01) {
2415
+ let candidate = mixColors(base, lightnessPole, baseWeight);
2416
+ if (visibilityContrast(candidate) >= target) return candidate;
2417
+ }
2418
+ return base;
2419
+ }
2420
+ function brighterPole(theme, base) {
2421
+ let { background, ink } = theme.color;
2422
+ if ((oklabLightness(background) ?? 0) >= (oklabLightness(ink) ?? 0)) return background;
2423
+ let heatTop = theme.color.heatTop ?? theme.color.markInk;
2424
+ return heatTop === void 0 ? ink : base === void 0 || (oklabLightness(heatTop) ?? 0) > (oklabLightness(base) ?? 0) ? heatTop : background;
2425
+ }
2426
+ var SERIES_TEXT_COLORS = /* @__PURE__ */ new WeakMap(), WALKED_COLORS = /* @__PURE__ */ new WeakMap();
2427
+ function sameRecipe(a, b) {
2428
+ if (a === b) return !0;
2429
+ if (typeof a != "object" || typeof b != "object" || a === null || b === null) return !1;
2430
+ let keys = Object.keys(a);
2431
+ return keys.length === Object.keys(b).length && keys.every((key) => sameRecipe(a[key], b[key]));
2432
+ }
2433
+ function themePaintSourceColor(theme, source) {
2434
+ if (source.kind !== "ground-text") return sourceColor(theme, source);
2435
+ let cache = WALKED_COLORS.get(theme);
2436
+ cache || WALKED_COLORS.set(theme, cache = /* @__PURE__ */ new WeakMap());
2437
+ let recipe = JSON.stringify(source), known = cache.get(source);
2438
+ if (known !== void 0 && known.recipe === recipe) return known.color;
2439
+ let color = sourceColor(theme, source);
2440
+ return cache.set(source, { recipe, color }), color;
2441
+ }
2442
+ function sourceColor(theme, source) {
2443
+ if (source.kind === "series-text") {
2444
+ let cache = SERIES_TEXT_COLORS.get(theme), known = cache?.get(source);
2445
+ if (known !== void 0) return known;
2446
+ cache || SERIES_TEXT_COLORS.set(theme, cache = /* @__PURE__ */ new WeakMap());
2447
+ let resolved2 = (color) => (cache.set(source, color), color), base = paintColor(theme, source.base), grounds = [theme.color.background, ...(source.surfaces ?? []).map((surface) => paintColor(theme, surface))], clears = (color) => grounds.every((ground) => contrastRatio(color, ground) >= TEXT_CONTRAST_FLOOR);
2448
+ if (clears(base)) return resolved2(base);
2449
+ let pole = darkPage(theme) ? "#FFFFFF" : "#000000";
2450
+ for (let step = 1; step <= 100; step++) {
2451
+ let candidate = mixColors(base, pole, 1 - step / 100);
2452
+ if (clears(candidate)) return resolved2(candidate);
2453
+ }
2454
+ return resolved2(pole);
2455
+ }
2456
+ if (source.kind === "colorblind") return colorblindColor(theme, source.role);
2457
+ if (source.kind === "pie-ramp" || source.kind === "visible-tint") {
2458
+ let base = paintColor(theme, source.base), amount = source.kind === "pie-ramp" ? pieRamp(base, theme.color.background, source.count, source.withOthers ? paintTokenColor(theme, "othersMark") : void 0, source.othersShade !== "apart", theme.marks?.contrastEdge !== !0).tints[source.index] ?? 0.82 : visibleTintAmount(theme, source), washed = amount ? tint(base, amount, theme.color.background) : base;
2459
+ return source.kind === "visible-tint" && source.darkApartFrom && darkPage(theme) ? washApart(theme, base, amount, source.darkApartFrom) : source.kind === "visible-tint" && source.darkMatchLight && darkPage(theme) ? washLikeLight(theme, base, amount) : source.kind === "visible-tint" && source.apart !== void 0 && typeof source.amount == "number" && amount < source.amount ? apartStep(theme, base, washed, source.apart) : washed;
2460
+ }
2461
+ if (source.kind === "brighter-pole") return brighterPole(theme);
2462
+ if (source.kind === "table-ground") return cellGroundColor(theme, source.ground);
2463
+ if (source.kind === "ground-text") {
2464
+ let ground = compositeColor(paintColor(theme, source.ground), theme.color.background), near = paintColor(theme, source.near);
2465
+ return farGround(theme, source.ground) === void 0 && contrastRatio(near, ground) >= TEXT_CONTRAST_FLOOR ? near : (source.far === void 0 ? void 0 : seriesTextAlone(paintColor(theme, source.far), ground)) ?? pickOnFillInk(ground, theme.color.ink, theme.color.inkInverse, onFillInks(theme.color));
2466
+ }
2467
+ if (source.kind === "page-side-ground") {
2468
+ let color = compositeColor(paintColor(theme, source.ground), theme.color.background);
2469
+ return parseColor(color) === null || farGround(theme, source.ground) !== void 0 ? theme.color.background : color;
2470
+ }
2471
+ if (source.kind === "table-ink") return tableInkColor(theme, source.role);
2472
+ if (source.kind === "focus-apart") {
2473
+ let focus = paintTokenColor(theme, "focus");
2474
+ return source.apartFrom.every((paint) => swatchApart(focus, paintColor(theme, paint))) ? focus : theme.color.ink;
2475
+ }
2476
+ if (source.kind === "line-on-fill") {
2477
+ let fill = paintColor(theme, source.fill), base = paintColor(theme, source.base);
2478
+ return contrastRatio(base, fill) >= contrastRatio(theme.color.inkInverse, fill) ? base : theme.color.inkInverse;
2479
+ }
2480
+ if (source.kind === "emphasis-ink") {
2481
+ let focus = theme.color.focus;
2482
+ return focus !== void 0 && contrastRatio(focus, paintColor(theme, source.ground)) >= 4.5 ? focus : theme.color.ink;
2483
+ }
2484
+ if (source.kind === "hatch-stripe") {
2485
+ let fill = paintColor(theme, source.base);
2486
+ return source.grounded ? groundedHatchColors(theme, fill, "css" in source.base, hatchPeers(theme, source.peers), hatchGrounding(theme, source)).stripe : hatchStripeColor(theme, fill, source.stacked);
2487
+ }
2488
+ if (source.kind === "ribbon") return ribbonColor(theme, source);
2489
+ if (source.kind === "surface-floor")
2490
+ return surfaceFloorColor(theme, paintColor(theme, source.base), source.surfaces.map((paint) => paintColor(theme, paint)));
2491
+ if (source.kind === "hatch-ground")
2492
+ return groundedHatchColors(theme, paintColor(theme, source.base), "css" in source.base, hatchPeers(theme, source.peers), hatchGrounding(theme, source)).ground;
2493
+ if (source.kind === "hatch-fade")
2494
+ return hatchFadeColor(paintColor(theme, source.stripe), paintColor(theme, source.ground), source.strength, source.cue);
2495
+ if (source.kind === "stack-ramp") return stackRampColor(theme, source);
2496
+ if (source.kind === "stack-apart") return stackApartColor(theme, source);
2497
+ if (source.kind === "ordered-ramp") {
2498
+ let weakest = visibleTintAmount(theme, { kind: "visible-tint", base: { token: "markInk" }, amount: 0.9, floor: MARK_CONTRAST_FLOOR });
2499
+ if (source.withOthers) {
2500
+ let ink = paintTokenColor(theme, "markInk"), others = paintTokenColor(theme, "othersMark");
2501
+ if (contrastRatio(ink, theme.color.background) > contrastRatio(others, theme.color.background)) {
2502
+ let cap = quietestTintCap(ink, theme.color.background, others, weakest);
2503
+ cap > 0 && (weakest = cap);
2504
+ }
2505
+ }
2506
+ let amount = source.count > 1 ? weakest * (1 - source.index / (source.count - 1)) : 0;
2507
+ return tint(paintTokenColor(theme, "markInk"), amount, theme.color.background);
2508
+ }
2509
+ if (source.kind === "mix") {
2510
+ let from = paintColor(theme, source.from);
2511
+ if (!("theme" in source.to) || source.to.theme?.kind !== "brighter-pole") {
2512
+ let to2 = paintColor(theme, source.to);
2513
+ if (source.pageFloor === void 0 || theme.marks?.contrastEdge === !0) return mixColors(from, to2, source.weight);
2514
+ for (let weight2 = source.weight; weight2 < 1; weight2 = Number((weight2 + 0.01).toFixed(2))) {
2515
+ let mixed = mixColors(from, to2, weight2);
2516
+ if (contrastRatio(mixed, theme.color.background) >= source.pageFloor) return mixed;
2517
+ }
2518
+ return from;
2519
+ }
2520
+ let to = brighterPole(theme, from);
2521
+ if (to !== theme.color.background) return mixColors(from, to, source.weight);
2522
+ let weight = stageWashWeight(theme, source.from, source.weight);
2523
+ return weight === "ink" ? mixColors(from, theme.color.ink, source.weight) : mixColors(from, to, weight);
2524
+ }
2525
+ if (source.kind === "contrast-ink") {
2526
+ let fill = compositeColor(paintColor(theme, source.fill), theme.color.background), ground = source.pattern ? effectiveFill(fill, source.pattern, theme) : fill, ink = pickOnFillInk(ground, theme.color.ink, theme.color.inkInverse, onFillInks(theme.color));
2527
+ if (!source.also?.length) return ink;
2528
+ let grounds = [ground, ...source.also.map((paint) => compositeColor(paintColor(theme, paint), theme.color.background))], worst = (candidate) => Math.min(...grounds.map((color) => contrastRatio(color, candidate)));
2529
+ return [ink, theme.color.ink, theme.color.inkInverse, ...onFillInks(theme.color)].reduce((best, candidate) => worst(candidate) > worst(best) ? candidate : best);
2530
+ }
2531
+ if (source.kind !== "series") return adaptivePaintColor(theme, source);
2532
+ let ramp = source.palette === void 0 ? void 0 : theme.color.palettes?.[source.palette];
2533
+ return source.scenario === void 0 ? seriesColor(theme, source.index, ramp) : scenarioSeriesColor(
2534
+ theme,
2535
+ source.index,
2536
+ ramp,
2537
+ source.scenario,
2538
+ source.deEmphasizePy ?? !0,
2539
+ source.surfaceFade ?? !1
2540
+ );
2541
+ }
2542
+ var darkPage = (theme) => contrastRatio(theme.color.background, "#FFFFFF") > contrastRatio(theme.color.background, "#000000");
2543
+ function washLikeLight(theme, base, amount) {
2544
+ let background = theme.color.background, target = apcaContrast(tint(base, amount, "#FFFFFF"), "#FFFFFF"), last = tint(base, amount, background);
2545
+ for (let a = amount; a > 0; a = Number((a - 0.01).toFixed(2))) {
2546
+ let washed = tint(base, a, background);
2547
+ if (contrastRatio(washed, theme.color.ink) < 4.5) return last;
2548
+ if (apcaContrast(washed, background) >= target) return washed;
2549
+ last = washed;
2550
+ }
2551
+ return last;
2552
+ }
2553
+ function washApart(theme, base, amount, apart) {
2554
+ let others = [apart.paint].flat().map((paint) => paintColor(theme, paint));
2555
+ for (let a = amount; a > 0; a = Number((a - 0.01).toFixed(2))) {
2556
+ let step = tint(base, a, theme.color.background);
2557
+ if (others.every((other) => palettePerceptualDistance(step, other) >= apart.distance)) return step;
2558
+ }
2559
+ return base;
2560
+ }
2561
+ function apartStep(theme, base, washed, apart) {
2562
+ if (contrastRatio(washed, base) >= apart) return washed;
2563
+ for (let amount = 0.01; amount < 1; amount += 0.01) {
2564
+ let step = tint(base, amount, theme.color.ink);
2565
+ if (contrastRatio(step, base) >= apart) return step;
2566
+ }
2567
+ return theme.color.ink;
2568
+ }
2569
+ function visibleTintAmount(theme, source) {
2570
+ let base = paintColor(theme, source.base), background = theme.color.background, floor = source.floor === "mark" ? markVisibilityFloor(background) : source.floor, amount = source.amount === "surface-anchor" ? resolveSurface(theme).anchorTint : source.amount === "surface-gap" ? resolveSurface(theme).gapTint : source.amount;
2571
+ for (let a = amount; a > 0; a = source.roundStep ? Math.max(0, Number((a - 0.01).toFixed(2))) : a - 0.01)
2572
+ if (contrastRatio(tint(base, Math.max(0, a), background), background) >= floor) return Math.max(0, a);
2573
+ return 0;
2574
+ }
2575
+ var STAGE_SHADE_MAX = 0.6;
2576
+ function stageWashWeight(theme, base, weight) {
2577
+ let reach = visibleTintAmount(theme, { kind: "visible-tint", base, amount: STAGE_SHADE_MAX, floor: "mark" });
2578
+ if (reach >= STAGE_SHADE_MAX) return weight;
2579
+ if (reach >= STAGE_SHADE_MAX / 2) return 1 - (1 - weight) * (reach / STAGE_SHADE_MAX);
2580
+ let background = theme.color.background;
2581
+ return contrastRatio(paintColor(theme, base), background) >= markVisibilityFloor(background) ? "ink" : weight;
2582
+ }
2583
+ function mixedPaint(from, to, weight, token = "neutral") {
2584
+ return {
2585
+ token,
2586
+ theme: { kind: "mix", from, to, weight }
2587
+ };
2588
+ }
2589
+ function seriesTextPaint(base, surfaces) {
2590
+ return { token: "ink", theme: { kind: "series-text", base, ...surfaces ? { surfaces } : {} } };
2591
+ }
2592
+ function groundTextPaint(near, ground, far) {
2593
+ return { token: "css" in near ? "ink" : near.token, theme: { kind: "ground-text", near, ground, ...far === void 0 ? {} : { far } } };
2594
+ }
2595
+ function farGround(theme, ground) {
2596
+ let color = compositeColor(paintColor(theme, ground), theme.color.background);
2597
+ if (parseColor(color) === null) return;
2598
+ let light = (value) => contrastRatio(value, "#000000") >= contrastRatio(value, "#FFFFFF");
2599
+ return light(color) !== light(theme.color.background) || contrastRatio(theme.color.ink, color) < TEXT_CONTRAST_FLOOR ? color : void 0;
2600
+ }
2601
+ function seriesTextAlone(base, ground) {
2602
+ if (contrastRatio(base, ground) >= TEXT_CONTRAST_FLOOR) return base;
2603
+ let pole = contrastRatio(ground, "#FFFFFF") > contrastRatio(ground, "#000000") ? "#FFFFFF" : "#000000";
2604
+ for (let step = 1; step < 100; step++) {
2605
+ let candidate = mixColors(base, pole, 1 - step / 100);
2606
+ if (contrastRatio(candidate, ground) >= TEXT_CONTRAST_FLOOR) return candidate;
2607
+ }
2608
+ }
2609
+ function contrastInkPaint(fill, pattern) {
2610
+ return {
2611
+ token: "ink",
2612
+ theme: {
2613
+ kind: "contrast-ink",
2614
+ fill,
2615
+ ...pattern ? { pattern } : {}
2616
+ }
2617
+ };
2618
+ }
2619
+ function seriesPaint(index, palette, scenario, deEmphasizePy = !0, surfaceFade = !1) {
2620
+ let source = { kind: "series", index };
2621
+ return palette !== void 0 && (source.palette = palette), scenario !== void 0 && (source.scenario = scenario), deEmphasizePy || (source.deEmphasizePy = !1), surfaceFade && (source.surfaceFade = !0), {
2622
+ token: `series-${index + 1}`,
2623
+ theme: source
2624
+ };
2625
+ }
2626
+ function recedingSeriesId(series, highlights) {
2627
+ if (!series.some((s) => !s.fill && (s.colorRole === "highlight" || !s.colorRole && highlights.has(s.id)))) return;
2628
+ let plain = series.filter((s) => !s.fill && !s.colorRole && !highlights.has(s.id));
2629
+ return plain.length === 1 ? plain[0].id : void 0;
2630
+ }
2631
+ function orderedRampPaint(index, count, withOthers = !1) {
2632
+ return { token: "markInk", theme: { kind: "ordered-ramp", index, count, ...withOthers ? { withOthers: !0 } : {} } };
2633
+ }
2634
+ function stackRampPaint(index, count, slot) {
2635
+ return { token: `series-${slot + 1}`, theme: { kind: "stack-ramp", index, count, slot } };
2636
+ }
2637
+ function stackApartPaint(own2, index, slot, palette) {
2638
+ return { token: `series-${slot + 1}`, theme: { kind: "stack-apart", own: own2.map((paint) => paint ?? null), index, ...palette !== void 0 ? { palette } : {} } };
2639
+ }
2640
+ var STACK_APART = /* @__PURE__ */ new WeakMap();
2641
+ function stackApartColor(theme, source) {
2642
+ let cache = STACK_APART.get(theme) ?? /* @__PURE__ */ new Map();
2643
+ STACK_APART.set(theme, cache);
2644
+ let key = JSON.stringify([source.own, source.palette]), slots = cache.get(key) ?? rampSlots(theme, source.own.map((paint) => paint ?? void 0), source.palette, void 0, !0);
2645
+ return cache.set(key, slots), seriesColor(theme, slots[source.index], source.palette === void 0 ? void 0 : theme.color.palettes?.[source.palette]);
2646
+ }
2647
+ function stackRampColor(theme, source) {
2648
+ let ramp = theme.color.stack;
2649
+ if (!ramp || ramp.length < 2) return seriesColor(theme, source.slot);
2650
+ if (source.count <= ramp.length) return ramp[source.index];
2651
+ let at = source.index / (source.count - 1) * (ramp.length - 1), low = Math.min(ramp.length - 2, Math.floor(at)), share = at - low;
2652
+ return share < 1e-9 ? ramp[low] : mixColors(ramp[low + 1], ramp[low], share);
2653
+ }
2654
+ function mutedMarkPaint() {
2655
+ return { token: "neutralMark", theme: { kind: "visible-tint", base: { token: "neutralMark" }, amount: 0.6, floor: MARK_CONTRAST_FLOOR } };
2656
+ }
2657
+ function colorblindPaint(role, fill = !1) {
2658
+ return { token: role, theme: { kind: "colorblind", role: fill ? `${role}Fill` : role } };
2659
+ }
2660
+ function colorblindColor(theme, role) {
2661
+ let pair = theme.color.colorblind;
2662
+ return pair[role] ?? pair[role === "goodFill" ? "good" : role === "badFill" ? "bad" : role];
2663
+ }
2664
+ function colorblindRoles(value) {
2665
+ let swapped = 0, walk = (entry) => {
2666
+ if (Array.isArray(entry)) return entry.map(walk);
2667
+ if (entry === null || typeof entry != "object") return entry;
2668
+ let out = {};
2669
+ for (let [key, item] of Object.entries(entry)) out[key] = walk(item);
2670
+ let token = out.token;
2671
+ return out.theme !== void 0 || token !== "good" && token !== "bad" && token !== "goodFill" && token !== "badFill" ? out : (swapped++, { ...out, ...colorblindPaint(token.startsWith("good") ? "good" : "bad", token.endsWith("Fill")) });
2672
+ };
2673
+ return { value: walk(value), swapped };
2674
+ }
2675
+ function colorblindTheme(theme) {
2676
+ let pair = theme.color.colorblind;
2677
+ return { ...theme, color: { ...theme.color, good: pair.good, bad: pair.bad, goodFill: colorblindColor(theme, "goodFill"), badFill: colorblindColor(theme, "badFill") } };
2678
+ }
2679
+ function paintColor(theme, paint) {
2680
+ if ("css" in paint) return paint.css;
2681
+ let base = paint.theme === void 0 ? paintTokenColor(theme, paint.token) : themePaintSourceColor(theme, paint.theme);
2682
+ return paint.tint ? tint(base, paint.tint, theme.color.background) : base;
2683
+ }
2684
+ function resolvePalette(theme, name, warn) {
2685
+ if (!name) return;
2686
+ let ramp = theme.color.palettes?.[name];
2687
+ if (!ramp) {
2688
+ warn?.(
2689
+ "unknown-palette",
2690
+ `palette '${name}' is not defined in theme '${theme.name}' \u2014 using the default series ramp` + (theme.color.palettes ? ` (available: ${Object.keys(theme.color.palettes).join(", ")})` : "")
2691
+ );
2692
+ return;
2693
+ }
2694
+ return ramp;
2695
+ }
2696
+ function resolveSemanticPaletteTheme(theme, name, warnings) {
2697
+ if (name === void 0) return theme;
2698
+ let ramp = resolvePalette(theme, name, (code, message) => {
2699
+ warnings.push({ code, severity: "warn", message });
2700
+ });
2701
+ if (!ramp) return theme;
2702
+ let primary = seriesColor(theme, 0, ramp), secondary = seriesColor(theme, 1, ramp);
2703
+ return {
2704
+ ...theme,
2705
+ color: {
2706
+ ...theme.color,
2707
+ neutral: primary,
2708
+ neutralLight: secondary,
2709
+ highlight: secondary,
2710
+ // What `options.highlight` selects follows the palette, as the highlight does.
2711
+ focus: secondary,
2712
+ // The spark line follows the palette's first rank, as the neutral does.
2713
+ spark: primary,
2714
+ total: primary
2715
+ }
2716
+ };
2717
+ }
2718
+ function focusColor(theme) {
2719
+ return theme.color.focus ?? theme.color.highlight;
2720
+ }
2721
+ var TONE_FILL_TWINS = { good: "goodFill", bad: "badFill", warn: "warnFill" };
2722
+ function markRolePaint(role, fill = !1) {
2723
+ return { token: role === "highlight" ? "focus" : fill && Object.hasOwn(TONE_FILL_TWINS, role) ? TONE_FILL_TWINS[role] : markRoleToken(role) };
2724
+ }
2725
+ function colorRolePaints(series, fill = !0) {
2726
+ let byRole = /* @__PURE__ */ new Map();
2727
+ for (let s of series)
2728
+ s.fill || !s.colorRole || byRole.set(s.colorRole, [...byRole.get(s.colorRole) ?? [], s.id]);
2729
+ let paints = /* @__PURE__ */ new Map();
2730
+ for (let [role, ids] of byRole) {
2731
+ let base = markRolePaint(role, fill);
2732
+ ids.forEach((id, index) => paints.set(id, ids.length === 1 ? base : { token: "token" in base ? base.token : "series-1", theme: { kind: "pie-ramp", base, index, count: ids.length } }));
2733
+ }
2734
+ return paints;
2735
+ }
2736
+ function markRoleToken(role) {
2737
+ return role === "neutral" ? "neutralMark" : role === "others" ? "othersMark" : role;
2738
+ }
2739
+ function signedFillPaint(tone) {
2740
+ return { token: tone === "good" ? "goodFill" : "badFill" };
2741
+ }
2742
+ function unsetRolesAsFallback(paint, themes2) {
2743
+ let unset = /* @__PURE__ */ new Map(), isUnset = (role) => themes2.every((theme) => theme.color[role] === void 0);
2744
+ for (let [role, fallback] of Object.entries(OPTIONAL_ROLE_FALLBACK)) {
2745
+ if (!isUnset(role)) continue;
2746
+ let target = fallback;
2747
+ for (; target in OPTIONAL_ROLE_FALLBACK && isUnset(target); ) target = OPTIONAL_ROLE_FALLBACK[target];
2748
+ unset.set(role, target);
2749
+ }
2750
+ if (unset.size === 0) return paint;
2751
+ let json = JSON.stringify(paint);
2752
+ if (![...unset.keys()].some((role) => json.includes(`"${role}"`))) return paint;
2753
+ let walk = (value) => {
2754
+ if (Array.isArray(value)) return value.map(walk);
2755
+ if (value === null || typeof value != "object") return value;
2756
+ let out = {};
2757
+ for (let [key, entry] of Object.entries(value))
2758
+ out[key] = key === "token" && typeof entry == "string" && unset.has(entry) ? unset.get(entry) : walk(entry);
2759
+ return out;
2760
+ };
2761
+ return walk(paint);
2762
+ }
2763
+ function semanticPalettePaint(theme, name, token, tintAmount) {
2764
+ if (token === "sequential") {
2765
+ let paint = seriesPaint(0, name !== void 0 && theme.color.palettes?.[name] !== void 0 ? name : void 0);
2766
+ return tintAmount === void 0 ? paint : { ...paint, tint: tintAmount };
2767
+ }
2768
+ return name === void 0 || theme.color.palettes?.[name] === void 0 ? tintAmount === void 0 ? { token } : { token, tint: tintAmount } : token === "others" ? tintAmount === void 0 ? { token } : { token, tint: tintAmount } : {
2769
+ ...seriesPaint(token === "neutral" || token === "neutralMark" || token === "spark" || token === "total" ? 0 : 1, name),
2770
+ ...tintAmount === void 0 ? {} : { tint: tintAmount }
2771
+ };
2772
+ }
2773
+ function cellGrounds(theme) {
2774
+ let { background } = theme.color, table = theme.table, wash = (color, weight) => mixColors(color, background, weight);
2775
+ return {
2776
+ good: table?.grounds?.good ?? wash(theme.color.goodFill ?? theme.color.good, 0.12),
2777
+ goodStrong: table?.grounds?.goodStrong ?? wash(theme.color.goodFill ?? theme.color.good, 0.24),
2778
+ warn: table?.grounds?.warn ?? wash(theme.color.warnFill ?? warnColor(theme), 0.18),
2779
+ bad: table?.grounds?.bad ?? wash(theme.color.badFill ?? theme.color.bad, 0.18),
2780
+ bar: table?.bar?.fill ?? wash(theme.color.ink, 0.085),
2781
+ barMuted: table?.bar?.muted ?? wash(theme.color.inkMuted, 0.05)
2782
+ };
2783
+ }
2784
+ function cellGroundColor(theme, role) {
2785
+ let color = cellGrounds(theme)[role], alpha = /^rgba\([^)]*,\s*([0-9.]+)\s*\)$/i.exec(color.trim())?.[1];
2786
+ return alpha === void 0 ? color : mixColors(color, theme.color.background, Number(alpha));
2787
+ }
2788
+
2789
+ export {
2790
+ isHatchPattern,
2791
+ linePath,
2792
+ leaderPath,
2793
+ ribbonPath,
2794
+ arrowShaftEnd,
2795
+ arrowHeadPath,
2796
+ hatchPatternId,
2797
+ hatchTile,
2798
+ harveyWedgePath,
2799
+ POINTER_TRANSPARENT_PARTS,
2800
+ sequentialShare,
2801
+ lineBandAuthoredWarnings,
2802
+ fanPaintSteps,
2803
+ bulletBandPaints,
2804
+ bumpStoryPaints,
2805
+ fillEdgesOff,
2806
+ labelPlate,
2807
+ LABEL_PLATE_RADIUS,
2808
+ haloHatchedInsideLabels,
2809
+ separationStroke,
2810
+ segmentSeparationStroke,
2811
+ haloOverpaintedInsideLabels,
2812
+ labelsOnFills,
2813
+ emphasisInk,
2814
+ casingUnderFills,
2815
+ markOutlineOff,
2816
+ isOthersFill,
2817
+ othersSeparation,
2818
+ sliceOutlineOff,
2819
+ repaintSeparation,
2820
+ namesOnly,
2821
+ fillEdges,
2822
+ marksOnBands,
2823
+ decideFillEdges,
2824
+ withSegmentSeams,
2825
+ withoutOrphanAnnotationMarks,
2826
+ REFERENCE_LABEL_CLEARANCE,
2827
+ referenceLineClearance,
2828
+ textBreaksLine,
2829
+ referenceCasings,
2830
+ readerFloorPx,
2831
+ TABLE_HEAD_PARTS,
2832
+ tableHeadFloorPx,
2833
+ textSizeOf,
2834
+ textScaleOf,
2835
+ KPI_VALUE_SIZE,
2836
+ KPI_HOST_TEXT,
2837
+ pieRamp,
2838
+ adoptTheme,
2839
+ themeColors,
2840
+ typeWidthClass,
2841
+ smallestTitleSize,
2842
+ panelTypeClass,
2843
+ labelsOffKeepsNames,
2844
+ microType,
2845
+ secondaryType,
2846
+ secondaryFont,
2847
+ themeForWidth,
2848
+ GRAMMAR_STROKE,
2849
+ WEIGHT_REGULAR,
2850
+ WEIGHT_EMPHASIS,
2851
+ strokeToken,
2852
+ dashToken,
2853
+ gridDash,
2854
+ emphasisWeight,
2855
+ emphasisLabelTheme,
2856
+ tableEmphasis,
2857
+ tableInkColor,
2858
+ headingWeight,
2859
+ themes,
2860
+ registerTheme,
2861
+ themeRegistrations,
2862
+ libraryPatch,
2863
+ typeForTarget,
2864
+ resolveTargetTheme,
2865
+ REMOVED_NAMES,
2866
+ removedNameWarnings,
2867
+ resolveTheme,
2868
+ hatchPaint,
2869
+ HATCH_STRENGTH_DEFAULT,
2870
+ hatchGapFactor,
2871
+ hatchStrokeWidthFor,
2872
+ stampHatchLook,
2873
+ surfaceFloorPaint,
2874
+ ribbonPaint,
2875
+ hatchGroundPaint,
2876
+ joinHatchPeers,
2877
+ separatedWashPaint,
2878
+ PLAN_MUTED_PAINT,
2879
+ solidMutedPlan,
2880
+ effectiveFill,
2881
+ warnColor,
2882
+ resolveSurface,
2883
+ WIDE_CANVAS_MIN_WIDTH,
2884
+ spaceTokens,
2885
+ canvasMargin,
2886
+ seriesColorIndex,
2887
+ rampSlots,
2888
+ resolvedPaintToken,
2889
+ paintTokenColor,
2890
+ sameRecipe,
2891
+ visibleTintAmount,
2892
+ STAGE_SHADE_MAX,
2893
+ mixedPaint,
2894
+ seriesTextPaint,
2895
+ groundTextPaint,
2896
+ farGround,
2897
+ seriesTextAlone,
2898
+ contrastInkPaint,
2899
+ seriesPaint,
2900
+ recedingSeriesId,
2901
+ orderedRampPaint,
2902
+ stackRampPaint,
2903
+ stackApartPaint,
2904
+ mutedMarkPaint,
2905
+ colorblindPaint,
2906
+ colorblindRoles,
2907
+ colorblindTheme,
2908
+ paintColor,
2909
+ resolvePalette,
2910
+ resolveSemanticPaletteTheme,
2911
+ focusColor,
2912
+ markRolePaint,
2913
+ colorRolePaints,
2914
+ markRoleToken,
2915
+ signedFillPaint,
2916
+ unsetRolesAsFallback,
2917
+ semanticPalettePaint,
2918
+ cellGrounds
2919
+ };