boardplot 0.57.0 → 0.58.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 (494) hide show
  1. package/CHANGELOG.md +298 -0
  2. package/README.md +48 -14
  3. package/dist/{DiagnosticDetails-JFBBXOT2.js → DiagnosticDetails-VGSL4NJK.js} +1 -1
  4. package/dist/{ReaderBox-GCIITQCX.js → ReaderBox-MHMXIDAJ.js} +8 -7
  5. package/dist/{annotateEngine-JMZI6QEG.js → annotateEngine-753KQBNN.js} +2 -1
  6. package/dist/build-identity.json +3 -3
  7. package/dist/{chunk-5WSIH4SR.js → chunk-2CQBBN7M.js} +4 -4
  8. package/dist/{chunk-Q7VPTN5X.js → chunk-2ETK5TSA.js} +4 -4
  9. package/dist/{chunk-NO7GRVUU.js → chunk-2ETSI2EL.js} +8 -8
  10. package/dist/{chunk-4RN4OM6I.js → chunk-2GRXHWRH.js} +3 -3
  11. package/dist/{chunk-QFIRPOXR.js → chunk-2HII2B6S.js} +3 -3
  12. package/dist/{chunk-K6Y4HBK7.js → chunk-2LC2H3ZM.js} +1000 -904
  13. package/dist/{chunk-KF3ZHLHQ.js → chunk-2NX7EO7H.js} +5 -5
  14. package/dist/{chunk-D5G67OER.js → chunk-2QI2PK2O.js} +1 -1
  15. package/dist/{chunk-AFA32LHN.js → chunk-2VKQQLP7.js} +62 -36
  16. package/dist/chunk-3DOVXJ6K.js +602 -0
  17. package/dist/{chunk-XJUZC53Y.js → chunk-3E6NLODZ.js} +1 -1
  18. package/dist/{chunk-D5RAVZ5C.js → chunk-3HA4IJTO.js} +9 -8
  19. package/dist/{chunk-OTGNVAI4.js → chunk-3HPPTQEW.js} +4 -4
  20. package/dist/{chunk-TGR6PRKG.js → chunk-3KT2647F.js} +4 -2
  21. package/dist/{chunk-UBXIGE2P.js → chunk-3MFVJMP6.js} +2 -2
  22. package/dist/{chunk-JKXJWCJ5.js → chunk-3P3FKPFN.js} +116 -54
  23. package/dist/{chunk-JMOBA5ES.js → chunk-3XAJSMYD.js} +2 -2
  24. package/dist/{chunk-I65OLJ2X.js → chunk-42QKUSHJ.js} +13 -3
  25. package/dist/{chunk-Y5IKCXQR.js → chunk-44JU3VOT.js} +5 -5
  26. package/dist/{chunk-YBYV56FS.js → chunk-44K75CYE.js} +3 -3
  27. package/dist/{chunk-WKWCNS6K.js → chunk-4FNM4D57.js} +5 -5
  28. package/dist/{chunk-UD6U4EF5.js → chunk-4ROZ4TFL.js} +1 -1
  29. package/dist/{chunk-LO3AGGE3.js → chunk-4VV3KUFT.js} +5 -5
  30. package/dist/{chunk-6ZN2XJFI.js → chunk-54YO56IK.js} +1 -1
  31. package/dist/{chunk-JMGB444D.js → chunk-5ACFYNA4.js} +8 -4
  32. package/dist/{chunk-SHAAMKN7.js → chunk-5JEU6MWC.js} +18 -18
  33. package/dist/{chunk-I7KDPCC7.js → chunk-5JIB4VJA.js} +18 -10
  34. package/dist/{chunk-C5SQEYTQ.js → chunk-5OP3E2ZD.js} +153 -65
  35. package/dist/{chunk-BDCKHLUB.js → chunk-5SLBD4BT.js} +72 -304
  36. package/dist/{chunk-2BHLRHF2.js → chunk-5SVGTQTW.js} +4 -4
  37. package/dist/chunk-5U567TYU.js +23 -0
  38. package/dist/{chunk-BFDPY7JM.js → chunk-5ZLF4S7X.js} +11 -6
  39. package/dist/{chunk-73O6AOAA.js → chunk-5ZMTQATF.js} +241 -140
  40. package/dist/{chunk-5JTRCSBN.js → chunk-62BDQTO6.js} +2 -2
  41. package/dist/chunk-64K3V4VN.js +25 -0
  42. package/dist/{chunk-BM2A3IGQ.js → chunk-67YJJJIB.js} +1 -1
  43. package/dist/{chunk-TDDSWNGD.js → chunk-6DJNFT2K.js} +30 -28
  44. package/dist/{chunk-JYAZPMSA.js → chunk-6IUK6PAH.js} +7 -6
  45. package/dist/{chunk-W5SVS4B6.js → chunk-6JFQCVNN.js} +4 -4
  46. package/dist/{chunk-H2POQ4LB.js → chunk-6XPV6M3Q.js} +4 -4
  47. package/dist/{chunk-XFCBH3TI.js → chunk-6ZDSEITW.js} +3 -3
  48. package/dist/{chunk-LFX5BERN.js → chunk-72HVDLMT.js} +46 -32
  49. package/dist/chunk-75NU5RLX.js +24 -0
  50. package/dist/chunk-76GPN6AT.js +72 -0
  51. package/dist/{chunk-EFKFZNQC.js → chunk-7CAYRPJV.js} +34 -20
  52. package/dist/{chunk-EWR6WVOV.js → chunk-7GWWBHVQ.js} +6 -6
  53. package/dist/{chunk-H6EJ63QN.js → chunk-7NYUFMLJ.js} +143 -82
  54. package/dist/{chunk-D2B3KP35.js → chunk-7VWXXBTC.js} +4 -0
  55. package/dist/chunk-A65B23JK.js +113 -0
  56. package/dist/{chunk-XNV7VOIT.js → chunk-A7R6FUS6.js} +4 -4
  57. package/dist/{chunk-KIXNHDXS.js → chunk-AEVGUOPB.js} +5 -5
  58. package/dist/{chunk-IXM6BAM4.js → chunk-AHIK2N72.js} +1 -1
  59. package/dist/{chunk-I3DLERI7.js → chunk-AICO24HJ.js} +5 -2
  60. package/dist/{chunk-LSKCKGCF.js → chunk-AJGSCVVW.js} +2 -2
  61. package/dist/{chunk-RSCRIWAH.js → chunk-AL62JJTB.js} +10 -3
  62. package/dist/{chunk-CT4RFZO4.js → chunk-AN2V2LC4.js} +37 -22
  63. package/dist/{chunk-T5MBORBK.js → chunk-AOFUA5XP.js} +1 -1
  64. package/dist/{chunk-7FAO4ICF.js → chunk-BCMEGJRX.js} +2 -2
  65. package/dist/{chunk-H3EWFSWI.js → chunk-BDIKWR45.js} +43 -29
  66. package/dist/{chunk-DJBMA4FW.js → chunk-BG6AIWAK.js} +4 -6
  67. package/dist/{chunk-6XU5XGYV.js → chunk-BOT6W3VB.js} +5 -5
  68. package/dist/{chunk-DRHQG44U.js → chunk-BQBD6Q5J.js} +6 -2
  69. package/dist/{chunk-6LQKU6YN.js → chunk-BZ67BJBH.js} +11 -10
  70. package/dist/{chunk-2AJWRVZ2.js → chunk-C47POAC5.js} +1 -1
  71. package/dist/{chunk-FJKFYQ5I.js → chunk-C5OBPO4Z.js} +36 -28
  72. package/dist/{chunk-Y7Q3VEYC.js → chunk-CCAAI56H.js} +30 -10
  73. package/dist/{chunk-T3WCDDIL.js → chunk-CDUR3KWV.js} +2 -2
  74. package/dist/{chunk-WE5WVQE4.js → chunk-CMPHT2LS.js} +3 -3
  75. package/dist/{chunk-FHA3KMFC.js → chunk-CQBPNE7Z.js} +5 -1
  76. package/dist/{chunk-JSA3ESEJ.js → chunk-CR5FP5SF.js} +1 -1
  77. package/dist/{chunk-JHWDTV4K.js → chunk-D2TQX7UJ.js} +2 -2
  78. package/dist/{chunk-5TUDYKNL.js → chunk-DEANHDXU.js} +42 -29
  79. package/dist/{chunk-GHFTKVJN.js → chunk-DHGE46UK.js} +1 -1
  80. package/dist/{chunk-ZSYU6LIH.js → chunk-DIHX6NUB.js} +5 -5
  81. package/dist/{chunk-W7Q6PLT4.js → chunk-DILQ34NW.js} +37 -37
  82. package/dist/{chunk-IZRTNCJQ.js → chunk-DJKRYJP7.js} +5 -5
  83. package/dist/{chunk-43PCSBVQ.js → chunk-DKLC6QLF.js} +634 -8
  84. package/dist/{chunk-I6QGYRY4.js → chunk-DNHTMCUP.js} +2 -2
  85. package/dist/{chunk-26WNBTWB.js → chunk-DORE2RHL.js} +5 -5
  86. package/dist/{chunk-WZB6R2ZX.js → chunk-DZYTXZNS.js} +11 -3
  87. package/dist/chunk-E262NRFP.js +39 -0
  88. package/dist/{chunk-O4D27FKH.js → chunk-E5YF236N.js} +4 -1
  89. package/dist/{chunk-5H4HFRDO.js → chunk-EBUK7HJP.js} +5 -5
  90. package/dist/{chunk-YGPLUENN.js → chunk-ECBHC272.js} +132 -83
  91. package/dist/{chunk-KLQKHA3T.js → chunk-EFW43JQJ.js} +5 -5
  92. package/dist/{chunk-VM5CQ7CG.js → chunk-EHRRHSPV.js} +2 -2
  93. package/dist/{chunk-PYGEIPPH.js → chunk-EILNJQMN.js} +32 -12
  94. package/dist/{chunk-KGS5Z7SL.js → chunk-ERDKMZ7O.js} +2 -2
  95. package/dist/{chunk-AFGQXMKT.js → chunk-ETRAPN5G.js} +143 -62
  96. package/dist/{chunk-USFIDSTO.js → chunk-ETUKDEGL.js} +18 -11
  97. package/dist/chunk-F2ET5ZTT.js +49 -0
  98. package/dist/{chunk-HVX2E26J.js → chunk-F3XOBFS4.js} +9 -8
  99. package/dist/{chunk-I4NUYVP5.js → chunk-FB6X7QHA.js} +1 -1
  100. package/dist/{chunk-LW4ZQGVL.js → chunk-FGW54I23.js} +7 -8
  101. package/dist/{chunk-UCIAHSJK.js → chunk-FP5B5XIL.js} +7 -3
  102. package/dist/{chunk-QRZESG66.js → chunk-FRHQGA5Q.js} +64 -239
  103. package/dist/{chunk-YTEJYLU7.js → chunk-FRR7BJ3B.js} +2 -2
  104. package/dist/{chunk-DPUCT567.js → chunk-FVWHEM2N.js} +7 -5
  105. package/dist/{chunk-54HEIM2A.js → chunk-FWSMENKH.js} +2 -2
  106. package/dist/{chunk-F4JAGDPD.js → chunk-FWTUGNSF.js} +8 -8
  107. package/dist/{chunk-HB3TH7GY.js → chunk-FZKDZQ6U.js} +10 -6
  108. package/dist/{chunk-6EE6XEMA.js → chunk-G4FF6G3I.js} +25 -16
  109. package/dist/{chunk-72OJBDRB.js → chunk-GB6BZSTL.js} +52 -41
  110. package/dist/{chunk-QLWUFEKR.js → chunk-GCIHRRDJ.js} +8 -8
  111. package/dist/{chunk-MTCDGSYW.js → chunk-GHCU6OSE.js} +2 -2
  112. package/dist/chunk-GO66OCN7.js +24 -0
  113. package/dist/chunk-GOFS336W.js +24 -0
  114. package/dist/{chunk-JMXNXLAC.js → chunk-GQYT7G4F.js} +2 -2
  115. package/dist/{chunk-TWRFVW3J.js → chunk-GUTLXO7Q.js} +138 -89
  116. package/dist/{chunk-RRPTQGRU.js → chunk-H3VICNTN.js} +1 -1
  117. package/dist/{chunk-GC4WOLV3.js → chunk-HAG3K6PQ.js} +14 -2
  118. package/dist/{chunk-7P7D6WXR.js → chunk-HBQHSZ6S.js} +3 -3
  119. package/dist/{chunk-ZV3SNRJI.js → chunk-HTQGJQZN.js} +4 -2
  120. package/dist/{chunk-VY67Q6CJ.js → chunk-HUQRO6VF.js} +36 -33
  121. package/dist/{chunk-WSKZZ2ZB.js → chunk-I5VDW2XZ.js} +538 -503
  122. package/dist/{chunk-TMXRTYGT.js → chunk-I5VNHDPR.js} +3 -2
  123. package/dist/{chunk-M74H7QYD.js → chunk-IDXYHDQY.js} +1 -1
  124. package/dist/{chunk-IPWUBZ4P.js → chunk-IIWZJ5ZM.js} +1 -1
  125. package/dist/{chunk-HC6WHTBX.js → chunk-IPBOREIY.js} +1 -1
  126. package/dist/chunk-IU335UO7.js +27 -0
  127. package/dist/{chunk-WDAZ2MT4.js → chunk-IVDTP6SV.js} +4 -4
  128. package/dist/{chunk-BDGLMWPO.js → chunk-IXOBDDMW.js} +11 -2
  129. package/dist/{chunk-PSYPB22T.js → chunk-J4QRB6DQ.js} +5 -5
  130. package/dist/{chunk-CEMXGMQN.js → chunk-JCMGKQVS.js} +3 -3
  131. package/dist/{chunk-XR7VOF2V.js → chunk-JM7UTLF3.js} +25 -13
  132. package/dist/{chunk-VY2NPB2Q.js → chunk-JNDWRV34.js} +4 -4
  133. package/dist/{chunk-SHCW2TCA.js → chunk-JSRQTDZZ.js} +25 -23
  134. package/dist/{chunk-XYUXB5VK.js → chunk-JT3UTEWZ.js} +3 -3
  135. package/dist/{chunk-BO5EJBLH.js → chunk-JUYRDZSV.js} +63 -43
  136. package/dist/{chunk-I5ZADE2U.js → chunk-JVGL2SCN.js} +1 -1
  137. package/dist/{chunk-A6XCVOC5.js → chunk-JY4LTPOV.js} +1 -1
  138. package/dist/chunk-K7XPTQBJ.js +267 -0
  139. package/dist/{chunk-JIH52I36.js → chunk-KGBUXMFP.js} +119 -85
  140. package/dist/{chunk-2KCK63DD.js → chunk-KIE5V3DA.js} +2 -2
  141. package/dist/{chunk-A33MFWHW.js → chunk-KU4PCG4W.js} +2 -2
  142. package/dist/{chunk-MQ5EKWIG.js → chunk-KVBLTAO7.js} +5 -5
  143. package/dist/{chunk-XCROSJ2Z.js → chunk-KW4JXWHO.js} +1 -1
  144. package/dist/{chunk-BY5JGQFZ.js → chunk-KWIP5YRA.js} +4 -4
  145. package/dist/{chunk-JRRSKCGG.js → chunk-LG6M2JTH.js} +3 -3
  146. package/dist/{chunk-KUMJI5B6.js → chunk-LIE2WSB4.js} +17 -14
  147. package/dist/{chunk-KAAB2DIV.js → chunk-LJDATBPB.js} +6 -6
  148. package/dist/{chunk-EHNGPUTO.js → chunk-LMMS675D.js} +5 -5
  149. package/dist/{chunk-ANNQJWDX.js → chunk-LPKGZ664.js} +285 -34
  150. package/dist/{chunk-ZTSJ7NY6.js → chunk-LPMSGO7L.js} +3 -3
  151. package/dist/chunk-LQWINE7K.js +211 -0
  152. package/dist/{chunk-RHBQ2Q5H.js → chunk-MKMMQDIY.js} +60 -43
  153. package/dist/{chunk-RMVCKO6N.js → chunk-MQ4IEDM5.js} +458 -136
  154. package/dist/{chunk-J22ETKDJ.js → chunk-MRM4KJ2O.js} +2 -2
  155. package/dist/{chunk-Z2BDTZDT.js → chunk-MX2OZHIT.js} +97 -39
  156. package/dist/{chunk-IFURKTOL.js → chunk-MXUPMGRY.js} +2 -2
  157. package/dist/{chunk-IUVJVMKS.js → chunk-NHU26HQ7.js} +55 -32
  158. package/dist/{chunk-6KHRMK3I.js → chunk-NQVJ4FPY.js} +158 -75
  159. package/dist/chunk-NZ7FX3AE.js +65 -0
  160. package/dist/{chunk-L2XRUG4P.js → chunk-OALBVELJ.js} +5 -5
  161. package/dist/{chunk-3DUGZ7ML.js → chunk-OGZ4UPYK.js} +46 -31
  162. package/dist/{chunk-7MYJUJZV.js → chunk-OMNB27GM.js} +4 -4
  163. package/dist/{chunk-GS5UG6QD.js → chunk-OO63YP35.js} +1 -1
  164. package/dist/{chunk-RHVP62HI.js → chunk-OPYDTW5Q.js} +5 -5
  165. package/dist/{chunk-4U2WSW6F.js → chunk-OSJN7KDS.js} +65 -36
  166. package/dist/{chunk-EY4OA4OF.js → chunk-OSJXIW6I.js} +370 -785
  167. package/dist/{chunk-NRYERHEI.js → chunk-OVVE42P4.js} +5 -5
  168. package/dist/{chunk-Z257SH5U.js → chunk-OZA7HA6L.js} +1 -1
  169. package/dist/{chunk-WJQX7HBH.js → chunk-OZLKEBCD.js} +2 -2
  170. package/dist/{chunk-DYSEZVIJ.js → chunk-P6DEFCMQ.js} +2 -2
  171. package/dist/{chunk-CIDOL4FO.js → chunk-PDTIQL3B.js} +5 -5
  172. package/dist/{chunk-TQ5HHNM3.js → chunk-PJ5BYZPN.js} +2 -2
  173. package/dist/{chunk-EHQLLZCQ.js → chunk-PK7Z7WRJ.js} +59 -34
  174. package/dist/{chunk-KJLH5EHD.js → chunk-PL6NWB5U.js} +175 -110
  175. package/dist/chunk-PMT75APP.js +94 -0
  176. package/dist/{chunk-KQ2WZ6BY.js → chunk-PP6A4X55.js} +1 -1
  177. package/dist/{chunk-O7Y6RJ4D.js → chunk-PPCH3PLO.js} +11 -11
  178. package/dist/{chunk-IRXTNSZL.js → chunk-PPE6S7WU.js} +40 -22
  179. package/dist/{chunk-VT7PBGL2.js → chunk-PT7KSIEO.js} +23 -36
  180. package/dist/{chunk-GADI2DU7.js → chunk-QAUGRVRU.js} +121 -23
  181. package/dist/{chunk-2X6XY4K4.js → chunk-QMFWZG2P.js} +39 -19
  182. package/dist/{chunk-YB6QGOCO.js → chunk-QZGGCE45.js} +2 -2
  183. package/dist/{chunk-5P4MXWKP.js → chunk-R2RJQ3BM.js} +4 -4
  184. package/dist/{chunk-FAFUMSPR.js → chunk-R7HBIQ63.js} +83 -51
  185. package/dist/{chunk-76UL4CT4.js → chunk-RBNDZLYS.js} +27 -22
  186. package/dist/{chunk-XN7JDII2.js → chunk-RCSY4CT4.js} +230 -107
  187. package/dist/{chunk-OAT6FWKL.js → chunk-RHQRPJHS.js} +5 -5
  188. package/dist/chunk-RI6XQKWJ.js +26 -0
  189. package/dist/{chunk-FX5VZK5F.js → chunk-RJICOOB3.js} +14 -8
  190. package/dist/{chunk-NINK4G7U.js → chunk-RLAVNCQJ.js} +2 -2
  191. package/dist/{chunk-FERP4WS3.js → chunk-ROPPWJQB.js} +11 -10
  192. package/dist/{chunk-SSZB3VXG.js → chunk-SELOV32X.js} +102 -47
  193. package/dist/{chunk-EEBMK6T6.js → chunk-SQI4NWTQ.js} +8 -8
  194. package/dist/{chunk-2WTD3GCR.js → chunk-SRJ74CMG.js} +2 -2
  195. package/dist/{chunk-LSR3SBJ4.js → chunk-STWOURLG.js} +234 -136
  196. package/dist/{chunk-BQIADGJB.js → chunk-SWMFXSVW.js} +5 -5
  197. package/dist/{chunk-5HTGSB6Y.js → chunk-SZ5VGWDY.js} +3 -3
  198. package/dist/{chunk-EDBUVDRI.js → chunk-T26G23RS.js} +359 -86
  199. package/dist/chunk-T7GPIJ4L.js +89 -0
  200. package/dist/{chunk-LGMV7ZV4.js → chunk-TAEB3RU6.js} +5 -5
  201. package/dist/{chunk-YFI5PN5O.js → chunk-TBDIMTRD.js} +34 -11
  202. package/dist/{chunk-HDSHS2QZ.js → chunk-TFFPEWNP.js} +70 -47
  203. package/dist/{chunk-YO5UKKCQ.js → chunk-TMEUK2WS.js} +6 -2
  204. package/dist/{chunk-X5OVVMZX.js → chunk-TVOMGNFQ.js} +1 -1
  205. package/dist/{chunk-JARJP576.js → chunk-TX5FSNAU.js} +435 -29
  206. package/dist/{chunk-LUZ7HXBT.js → chunk-U52PNFPX.js} +1 -1
  207. package/dist/chunk-U74AWJ3X.js +24 -0
  208. package/dist/chunk-UC7LBW7N.js +26 -0
  209. package/dist/{chunk-V3UE3TB7.js → chunk-UCKUAKYQ.js} +2 -2
  210. package/dist/{chunk-62JZL6FW.js → chunk-UCYL3YA7.js} +56 -42
  211. package/dist/{chunk-AKJO6N4K.js → chunk-UD2GI3CS.js} +11 -4
  212. package/dist/{chunk-MOQFYJ3F.js → chunk-ULQIC76A.js} +5 -5
  213. package/dist/{chunk-HFFKN7PA.js → chunk-UY34DDUM.js} +3 -3
  214. package/dist/{chunk-2I76VFMZ.js → chunk-UYMFLWM6.js} +49 -37
  215. package/dist/{chunk-3LNVEE5Z.js → chunk-V7FV66KL.js} +1 -1
  216. package/dist/{chunk-UP4JSNDR.js → chunk-V7NUJEJE.js} +1 -1
  217. package/dist/{chunk-53OEKS4L.js → chunk-VESSIKBG.js} +6 -3
  218. package/dist/{chunk-HGPFEG2L.js → chunk-VRFJAF3R.js} +5 -5
  219. package/dist/chunk-VS2R3OGN.js +34 -0
  220. package/dist/{chunk-EEL2N4Y6.js → chunk-VS5B4J2D.js} +5 -5
  221. package/dist/{chunk-G5BUGYIL.js → chunk-W4R6SGU3.js} +192 -113
  222. package/dist/{chunk-JKOEHRGV.js → chunk-WDLWWEHZ.js} +1 -1
  223. package/dist/{chunk-IW3YUMPI.js → chunk-WFBN2HXR.js} +2 -2
  224. package/dist/{chunk-YCUNFAEE.js → chunk-WJS6SAWA.js} +238 -127
  225. package/dist/{chunk-VFLMBA2M.js → chunk-WQYNKF33.js} +19 -18
  226. package/dist/{chunk-QNLESRH6.js → chunk-WUP6C4ZD.js} +2 -2
  227. package/dist/{chunk-4JNHF6JW.js → chunk-X24WAHHV.js} +84 -40
  228. package/dist/{chunk-GKQLKUMF.js → chunk-X3UCQPVV.js} +41 -32
  229. package/dist/{chunk-TXMS7QUJ.js → chunk-X46PSAJ7.js} +6 -6
  230. package/dist/{chunk-M2OQK2FO.js → chunk-XD5XB22R.js} +2 -2
  231. package/dist/{chunk-AOIZJ7GR.js → chunk-XDIAQEYK.js} +6 -6
  232. package/dist/{chunk-7EQU2TUN.js → chunk-XFPNYHX3.js} +84 -53
  233. package/dist/{chunk-NCCDEUHD.js → chunk-XIBVAKCO.js} +1 -1
  234. package/dist/{chunk-SD6ENKTO.js → chunk-XMX4PCFL.js} +3 -3
  235. package/dist/{chunk-2HD5RY2U.js → chunk-XRRG4MBM.js} +3 -3
  236. package/dist/{chunk-Y5WHM2Q5.js → chunk-XTFO6D4L.js} +1 -1
  237. package/dist/chunk-XWRI3N5O.js +70 -0
  238. package/dist/{chunk-IVQT2E3Y.js → chunk-XXPLPSOE.js} +13 -13
  239. package/dist/{chunk-YNHPPZ7S.js → chunk-XZXZNI7A.js} +1 -1
  240. package/dist/{chunk-QZMLSK43.js → chunk-YEJZ2OYS.js} +294 -145
  241. package/dist/{chunk-GAFEN3H7.js → chunk-Z3WQXVFV.js} +2 -2
  242. package/dist/{chunk-D3PQAVFW.js → chunk-Z6DUNKFU.js} +152 -29
  243. package/dist/{chunk-FF7MV4D4.js → chunk-Z6H5ED2I.js} +1 -1
  244. package/dist/{chunk-CV3NC75L.js → chunk-ZBOOMLHD.js} +1 -1
  245. package/dist/{chunk-ZDD3MJ2H.js → chunk-ZDJ7C64T.js} +1 -1
  246. package/dist/{chunk-OKM5LYYP.js → chunk-ZGZLEUKM.js} +5 -5
  247. package/dist/{chunk-QHPJ5ZKS.js → chunk-ZHRGX225.js} +5 -5
  248. package/dist/{chunk-QYOZ46ZQ.js → chunk-ZIVCPXXL.js} +467 -650
  249. package/dist/{chunk-V62B23VC.js → chunk-ZNRSYS76.js} +8 -2
  250. package/dist/{chunk-UFZXZJJG.js → chunk-ZSLTSCTI.js} +5 -5
  251. package/dist/{chunk-NIDH22DI.js → chunk-ZSYFQSPF.js} +12 -2
  252. package/dist/cli/index.js +8 -3
  253. package/dist/{core-UNX4ZV4M.js → core-43GLGBOY.js} +5 -1
  254. package/dist/{core-T3OSZOVV.js → core-5GI3ERXO.js} +3 -1
  255. package/dist/{core-AMWCZTOT.js → core-5L7TMK7I.js} +5 -1
  256. package/dist/{core-5S5CJHBG.js → core-7TO4OVY5.js} +2 -1
  257. package/dist/{core-BJZEJ63L.js → core-BJVENHFQ.js} +3 -1
  258. package/dist/{core-A7HXVSKB.js → core-BX4MFWKC.js} +2 -1
  259. package/dist/{core-4PW4MXWR.js → core-C3KXTOIZ.js} +4 -1
  260. package/dist/{core-SKMHEA4Y.js → core-C5Y6BFLL.js} +3 -1
  261. package/dist/{core-FTQBESDS.js → core-CLUSJ2SK.js} +3 -1
  262. package/dist/{core-QM34237W.js → core-E3IN2VVH.js} +2 -1
  263. package/dist/{core-4M4RY7MX.js → core-FD67NQOV.js} +3 -1
  264. package/dist/{core-WXZJ7V7S.js → core-FDKMLRAK.js} +4 -1
  265. package/dist/{core-L3UR75IJ.js → core-FL6Z3VVX.js} +4 -1
  266. package/dist/{core-XKXDXALI.js → core-JC7JUFPY.js} +6 -1
  267. package/dist/{core-WP73P4CW.js → core-JF33TADA.js} +5 -1
  268. package/dist/{core-DMDAXVMY.js → core-JH32ZAKM.js} +2 -1
  269. package/dist/{core-GS4DXDDG.js → core-JYYZPPQV.js} +4 -1
  270. package/dist/{core-N2JEWJ7D.js → core-KJTKCV4U.js} +2 -1
  271. package/dist/{core-7XKNJM7Y.js → core-LCQPE5Y6.js} +5 -1
  272. package/dist/{core-ZACFV6XR.js → core-LHVGWE54.js} +5 -1
  273. package/dist/{core-VT35VDVS.js → core-OVSNBOCE.js} +6 -1
  274. package/dist/{core-AVA4XLQ2.js → core-PPEC236B.js} +2 -1
  275. package/dist/{core-QFAVWFI3.js → core-QTJZDK5H.js} +2 -1
  276. package/dist/{core-VWYXK2R3.js → core-R3YZCOUZ.js} +4 -1
  277. package/dist/{core-OFPPRHYY.js → core-RIBW5XU4.js} +3 -1
  278. package/dist/{core-MAW4S3KA.js → core-RJFILBWL.js} +5 -1
  279. package/dist/{core-FCSA74RT.js → core-RWSXEKTE.js} +3 -1
  280. package/dist/{core-WPEYRK6Y.js → core-SOPPZLEH.js} +4 -1
  281. package/dist/{core-EMSJRGSE.js → core-TBUZCXLX.js} +2 -1
  282. package/dist/{core-OBPTBKX6.js → core-TZ5QLTAX.js} +2 -1
  283. package/dist/{core-JDZDBTID.js → core-U7E5W4MY.js} +2 -1
  284. package/dist/{core-ZSERZGK6.js → core-UBNVSL44.js} +3 -1
  285. package/dist/{core-WNT6ZMRO.js → core-UDRD4WIU.js} +2 -1
  286. package/dist/{core-VRVL6LIM.js → core-UVJZ4HY2.js} +3 -1
  287. package/dist/{core-7TTM4KRP.js → core-X7WWYQH4.js} +3 -1
  288. package/dist/{core-D2OIGYC7.js → core-XP56X47I.js} +4 -1
  289. package/dist/{core-CCB3IXGD.js → core-XQG54CYG.js} +3 -1
  290. package/dist/{dataTable-7IO546LM.js → dataTable-U7W4I6IF.js} +7 -2
  291. package/dist/{engine-US3N6UCH.js → engine-O5V26MGR.js} +23 -18
  292. package/dist/fixtures.js +2 -1
  293. package/dist/flags-BVLSAXT3.js +10 -0
  294. package/dist/{fontTables-ZPZQ6IR3.js → fontTables-JUW7ZTQY.js} +3 -1
  295. package/dist/geo/dach.js +1 -1
  296. package/dist/geo/de-states.js +1 -1
  297. package/dist/geo/eu27.js +1 -1
  298. package/dist/geo/europe.js +1 -1
  299. package/dist/geo/index.js +2 -2
  300. package/dist/geo/us-states.js +1 -1
  301. package/dist/geo/world.js +1 -1
  302. package/dist/index.js +27 -20
  303. package/dist/{main-2UWKGUHR.js → main-35GS47XC.js} +50 -119
  304. package/dist/mcp/server.js +121 -118
  305. package/dist/react/bar.js +5 -1
  306. package/dist/react/bartable.js +3 -1
  307. package/dist/react/box.js +3 -1
  308. package/dist/react/bullet.js +4 -1
  309. package/dist/react/butterfly.js +5 -1
  310. package/dist/react/choropleth.js +3 -1
  311. package/dist/react/cohort.js +3 -1
  312. package/dist/react/column.js +5 -1
  313. package/dist/react/combo.js +5 -1
  314. package/dist/react/creative.js +4 -1
  315. package/dist/react/diagram.js +3 -1
  316. package/dist/react/dimswitch.js +6 -1
  317. package/dist/react/dot.js +4 -1
  318. package/dist/react/export.js +29 -18
  319. package/dist/react/funnel.js +4 -1
  320. package/dist/react/gantt.js +3 -1
  321. package/dist/react/grid.js +6 -1
  322. package/dist/react/heatmap.js +3 -1
  323. package/dist/react/histogram.js +6 -1
  324. package/dist/react/index.js +92 -85
  325. package/dist/react/kpi.js +4 -1
  326. package/dist/react/likert.js +6 -1
  327. package/dist/react/line.js +4 -1
  328. package/dist/react/mekko.js +5 -1
  329. package/dist/react/pareto.js +6 -1
  330. package/dist/react/pie.js +4 -1
  331. package/dist/react/prepare.js +35 -22
  332. package/dist/react/pvm.js +6 -1
  333. package/dist/react/pyramid.js +5 -1
  334. package/dist/react/sankey.js +3 -1
  335. package/dist/react/scatter.js +3 -1
  336. package/dist/react/slope.js +4 -1
  337. package/dist/react/sparkline.js +4 -1
  338. package/dist/react/spec.js +17 -13
  339. package/dist/react/status.js +3 -1
  340. package/dist/react/story.js +3 -2
  341. package/dist/react/table.js +4 -1
  342. package/dist/react/theme.js +5 -3
  343. package/dist/react/tilemap.js +3 -1
  344. package/dist/react/treemap.js +3 -1
  345. package/dist/react/variance.js +5 -1
  346. package/dist/react/waffle.js +3 -1
  347. package/dist/react/waterfall.js +5 -1
  348. package/dist/{resvg-VB7S5HRF.js → resvg-ZYEZTSUO.js} +3 -1
  349. package/dist/rows.js +2 -2
  350. package/dist/{rowsModule-DYDVHBAX.js → rowsModule-H2S6WW4D.js} +1 -1
  351. package/dist/{schema-YDZCGL56.js → schema-2R32F6AW.js} +1 -3
  352. package/dist/{schema-A2XUZUCV.js → schema-2TPGJGVR.js} +1 -3
  353. package/dist/{schema-MD22QYZU.js → schema-47BG2TZA.js} +1 -3
  354. package/dist/{schema-HEB6ZDI5.js → schema-56MOEOVR.js} +1 -3
  355. package/dist/{schema-K4V4PYBO.js → schema-5MSR4LNN.js} +1 -3
  356. package/dist/{schema-NOBNFD2F.js → schema-5RIYEWE6.js} +1 -3
  357. package/dist/{schema-PHIHMDVB.js → schema-A26ZNGTZ.js} +1 -3
  358. package/dist/{schema-OXO2XY4Y.js → schema-ALBF6V7Y.js} +1 -3
  359. package/dist/{schema-F2Q6MH7W.js → schema-BA6WP5YZ.js} +1 -3
  360. package/dist/{schema-G5KSSI5W.js → schema-CBL2SMVR.js} +1 -3
  361. package/dist/{schema-WFGDVBJK.js → schema-CWKGLDSR.js} +1 -3
  362. package/dist/{schema-DHMMGDTI.js → schema-DBIQFL56.js} +1 -3
  363. package/dist/{schema-626QXX4G.js → schema-DL7V6NN2.js} +1 -3
  364. package/dist/{schema-FC6J6KZC.js → schema-DUVJMFKQ.js} +1 -3
  365. package/dist/{schema-LGLQBRC4.js → schema-ECJERHKF.js} +1 -2
  366. package/dist/{schema-4JRNXEZF.js → schema-EDSEKZDJ.js} +1 -3
  367. package/dist/{schema-I44IDRGD.js → schema-ESR6ZIK4.js} +1 -3
  368. package/dist/{schema-FSYDLMGD.js → schema-F7TWGLRZ.js} +1 -3
  369. package/dist/{schema-JCU6LTYD.js → schema-FGB6IGZM.js} +1 -3
  370. package/dist/{schema-MGETMQYC.js → schema-FKGGTM4Z.js} +1 -2
  371. package/dist/{schema-6PL46VXZ.js → schema-FU2AFIEE.js} +1 -3
  372. package/dist/{schema-XIHAKX3B.js → schema-JNJFCYBM.js} +1 -1
  373. package/dist/{schema-6V5K3J2V.js → schema-JYZ4RF6S.js} +1 -3
  374. package/dist/{schema-GXOG4MXL.js → schema-K7F6TEDK.js} +1 -2
  375. package/dist/{schema-NMIYKGHE.js → schema-KAK6DZX4.js} +1 -3
  376. package/dist/{schema-XRSORYBI.js → schema-MOKWIGF7.js} +1 -3
  377. package/dist/{schema-3KMU5737.js → schema-MQT6BMNK.js} +1 -3
  378. package/dist/{schema-JJWORI7D.js → schema-MR3BPPQR.js} +1 -3
  379. package/dist/{schema-IFTIMTS3.js → schema-OPXZYIW7.js} +1 -3
  380. package/dist/{schema-UXWKA3PI.js → schema-PV7JGX5H.js} +1 -3
  381. package/dist/{schema-CNJ4Y6CT.js → schema-PWPQF5RC.js} +1 -3
  382. package/dist/{schema-WBOPCTPC.js → schema-PYQEUC5P.js} +1 -3
  383. package/dist/{schema-J4HCSD5C.js → schema-QPIC5MAG.js} +6 -2
  384. package/dist/{schema-IUY7VYHJ.js → schema-R42VXFIS.js} +1 -3
  385. package/dist/{schema-WX2RS4OU.js → schema-TVUJNEX7.js} +1 -3
  386. package/dist/{schema-FGE5YK3S.js → schema-Y4TI2T3T.js} +1 -3
  387. package/dist/{schema-MQB6CE5V.js → schema-ZU2EU2VP.js} +1 -3
  388. package/dist/{specValidation-XGELWQUU.js → specValidation-2NHJT7TQ.js} +3 -1
  389. package/dist/theme.js +4 -3
  390. package/dist/{themeShapeRules-PW4BQHKL.js → themeShapeRules-G7UZX6GJ.js} +1 -1
  391. package/dist/types/core/annotate.d.ts +27 -2
  392. package/dist/types/core/annotateArms.d.ts +3 -1
  393. package/dist/types/core/annotateTargets.d.ts +4 -0
  394. package/dist/types/core/annotationOrigin.d.ts +13 -0
  395. package/dist/types/core/axis.d.ts +2 -2
  396. package/dist/types/core/charts/band/stacks.d.ts +7 -1
  397. package/dist/types/core/charts/column/model.d.ts +13 -0
  398. package/dist/types/core/charts/combo/layout.d.ts +7 -0
  399. package/dist/types/core/charts/gantt/calendar.d.ts +4 -0
  400. package/dist/types/core/charts/grid/normalize.d.ts +5 -0
  401. package/dist/types/core/charts/grid/schema.d.ts +2 -2
  402. package/dist/types/core/charts/pareto/layout.d.ts +2 -0
  403. package/dist/types/core/charts/pvm/types.d.ts +1 -0
  404. package/dist/types/core/charts/scatter/clamp.d.ts +2 -1
  405. package/dist/types/core/charts/scatter/model.d.ts +5 -0
  406. package/dist/types/core/charts/scatter/valueLines.d.ts +3 -1
  407. package/dist/types/core/charts/table/resolve.d.ts +8 -3
  408. package/dist/types/core/charts/table/view.d.ts +24 -1
  409. package/dist/types/core/claims/browser.d.ts +2 -0
  410. package/dist/types/core/claims/ids.d.ts +38 -0
  411. package/dist/types/core/deferred.d.ts +1 -0
  412. package/dist/types/core/doc/diagnostics.d.ts +3 -2
  413. package/dist/types/core/formatSpec.d.ts +33 -14
  414. package/dist/types/core/frame.d.ts +25 -58
  415. package/dist/types/core/frameText.d.ts +203 -0
  416. package/dist/types/core/geometry.d.ts +2 -0
  417. package/dist/types/core/label/categoryRow.d.ts +19 -2
  418. package/dist/types/core/label/solver.d.ts +23 -2
  419. package/dist/types/core/normalize/shared.d.ts +12 -2
  420. package/dist/types/core/notes.d.ts +15 -2
  421. package/dist/types/core/reading.d.ts +12 -1
  422. package/dist/types/core/request.d.ts +1 -1
  423. package/dist/types/core/schema/capability.d.ts +12 -0
  424. package/dist/types/core/seriesIdentity.d.ts +4 -1
  425. package/dist/types/core/sizing.d.ts +32 -1
  426. package/dist/types/core/structureCounts.d.ts +3 -1
  427. package/dist/types/core/theme.d.ts +33 -4
  428. package/dist/types/core/themeRules.d.ts +2 -0
  429. package/dist/types/core/types/annotations.d.ts +74 -4
  430. package/dist/types/core/types/options.d.ts +35 -3
  431. package/dist/types/core/types/scene.d.ts +30 -2
  432. package/dist/types/core/types/table.d.ts +6 -0
  433. package/dist/types/core/types/theme.d.ts +23 -0
  434. package/dist/types/react/TableChart.d.ts +5 -0
  435. package/dist/validate.js +13 -6
  436. package/docs/TELEMETRY.md +2 -2
  437. package/docs/manual.md +252 -62
  438. package/docs/reference/bar.md +12 -4
  439. package/docs/reference/bartable.md +2 -2
  440. package/docs/reference/box.md +8 -4
  441. package/docs/reference/bullet.md +9 -5
  442. package/docs/reference/butterfly.md +10 -5
  443. package/docs/reference/choropleth.md +3 -5
  444. package/docs/reference/cohort.md +1 -1
  445. package/docs/reference/column.md +18 -4
  446. package/docs/reference/combo.md +10 -5
  447. package/docs/reference/creative.md +3 -7
  448. package/docs/reference/diagram.md +1 -1
  449. package/docs/reference/dimswitch.md +23 -88
  450. package/docs/reference/dot.md +9 -5
  451. package/docs/reference/fixtures.md +37 -1
  452. package/docs/reference/funnel.md +9 -5
  453. package/docs/reference/gantt.md +8 -15
  454. package/docs/reference/grid.md +5 -2
  455. package/docs/reference/heatmap.md +10 -6
  456. package/docs/reference/kpi.md +1 -1
  457. package/docs/reference/likert.md +9 -4
  458. package/docs/reference/line.md +18 -5
  459. package/docs/reference/mekko.md +10 -5
  460. package/docs/reference/options.md +17 -13
  461. package/docs/reference/pareto.md +8 -4
  462. package/docs/reference/pie.md +9 -5
  463. package/docs/reference/pvm.md +9 -5
  464. package/docs/reference/pyramid.md +8 -4
  465. package/docs/reference/react.md +5 -5
  466. package/docs/reference/sankey.md +2 -2
  467. package/docs/reference/scatter.md +8 -4
  468. package/docs/reference/slope.md +9 -5
  469. package/docs/reference/sparkline.md +1 -1
  470. package/docs/reference/status.md +1 -1
  471. package/docs/reference/table.md +33 -114
  472. package/docs/reference/theme.md +12 -4
  473. package/docs/reference/tilemap.md +2 -4
  474. package/docs/reference/treemap.md +1 -1
  475. package/docs/reference/variance.md +12 -6
  476. package/docs/reference/waffle.md +1 -1
  477. package/docs/reference/warnings.md +1077 -0
  478. package/docs/reference/waterfall.md +16 -4
  479. package/docs/use-cases.md +25 -13
  480. package/llms.txt +19 -6
  481. package/package.json +18 -3
  482. package/dist/chunk-5RHP7YTL.js +0 -24
  483. package/dist/chunk-6VU2XI3W.js +0 -89
  484. package/dist/chunk-6WJOHZPW.js +0 -26
  485. package/dist/chunk-FL3FQ2YA.js +0 -27
  486. package/dist/chunk-G5CELEUR.js +0 -26
  487. package/dist/chunk-M4SPKUZE.js +0 -7
  488. package/dist/chunk-OF7FMGH5.js +0 -24
  489. package/dist/chunk-S2TSXUYP.js +0 -24
  490. package/dist/chunk-TKERVBJ3.js +0 -23
  491. package/dist/chunk-VMGTNB6H.js +0 -25
  492. package/dist/chunk-WZL4EEBS.js +0 -11
  493. package/dist/chunk-YJGFT63R.js +0 -27
  494. package/dist/chunk-ZNX5J7D7.js +0 -47
@@ -5,14 +5,14 @@ import {
5
5
  loadResvg,
6
6
  rasterFamily,
7
7
  rasterizeWithResvg
8
- } from "./chunk-D2B3KP35.js";
8
+ } from "./chunk-7VWXXBTC.js";
9
9
  import {
10
10
  crc32,
11
11
  withPhysicalSize
12
- } from "./chunk-T5MBORBK.js";
12
+ } from "./chunk-AOFUA5XP.js";
13
13
  import {
14
14
  themeFieldReference
15
- } from "./chunk-JIH52I36.js";
15
+ } from "./chunk-KGBUXMFP.js";
16
16
  import {
17
17
  createMetricTablesMeasurer,
18
18
  measurableFamilies
@@ -22,22 +22,22 @@ import {
22
22
  } from "./chunk-TA3TFKYZ.js";
23
23
  import {
24
24
  getFixtures
25
- } from "./chunk-43PCSBVQ.js";
25
+ } from "./chunk-DKLC6QLF.js";
26
26
  import {
27
27
  gridFormOf
28
- } from "./chunk-QZMLSK43.js";
28
+ } from "./chunk-YEJZ2OYS.js";
29
29
  import {
30
30
  spaceDocLints
31
- } from "./chunk-I7KDPCC7.js";
31
+ } from "./chunk-5JIB4VJA.js";
32
32
  import {
33
33
  comboDrawsSecondaryAxis
34
- } from "./chunk-KJLH5EHD.js";
34
+ } from "./chunk-PL6NWB5U.js";
35
35
  import {
36
36
  lineLabelModes
37
- } from "./chunk-H6EJ63QN.js";
37
+ } from "./chunk-7NYUFMLJ.js";
38
38
  import {
39
39
  resolveSharedScale
40
- } from "./chunk-OTGNVAI4.js";
40
+ } from "./chunk-3HPPTQEW.js";
41
41
  import {
42
42
  getTilePack
43
43
  } from "./chunk-T2L5H2WW.js";
@@ -51,7 +51,7 @@ import {
51
51
  isThemeObject,
52
52
  parseDocumentInput,
53
53
  rootContextErrors
54
- } from "./chunk-CT4RFZO4.js";
54
+ } from "./chunk-AN2V2LC4.js";
55
55
  import {
56
56
  completeChartDiagnostic,
57
57
  completeDiagnostic,
@@ -59,49 +59,49 @@ import {
59
59
  gridPanelOptionTargets,
60
60
  unsupportedSuggestion,
61
61
  validateChartInput
62
- } from "./chunk-GADI2DU7.js";
62
+ } from "./chunk-QAUGRVRU.js";
63
63
  import {
64
64
  baseOptionsSchema,
65
65
  renderTargetSchema
66
- } from "./chunk-QYOZ46ZQ.js";
66
+ } from "./chunk-ZIVCPXXL.js";
67
67
  import {
68
68
  InputError,
69
69
  adaptRows,
70
70
  assertSpecObject,
71
71
  rewriteRowsDiagnostics
72
- } from "./chunk-6EE6XEMA.js";
72
+ } from "./chunk-G4FF6G3I.js";
73
73
  import {
74
74
  isBareChart
75
75
  } from "./chunk-YWP7XFKD.js";
76
76
  import {
77
77
  CLAIM_KIND_GROUPS,
78
78
  claimsForChart
79
- } from "./chunk-TWRFVW3J.js";
79
+ } from "./chunk-GUTLXO7Q.js";
80
80
  import {
81
81
  interactionRecords,
82
82
  interactionValueText
83
- } from "./chunk-3DUGZ7ML.js";
83
+ } from "./chunk-OGZ4UPYK.js";
84
84
  import {
85
85
  layoutResolvedRequest,
86
86
  measureLayout,
87
87
  resolveChartRequest
88
- } from "./chunk-EDBUVDRI.js";
88
+ } from "./chunk-T26G23RS.js";
89
89
  import {
90
90
  drawnRequest
91
91
  } from "./chunk-INHDHZNP.js";
92
92
  import {
93
93
  ownedDocumentCopy
94
- } from "./chunk-LUZ7HXBT.js";
94
+ } from "./chunk-U52PNFPX.js";
95
95
  import {
96
96
  DEFAULT_REST_MIN,
97
97
  DEFAULT_TOP_N
98
- } from "./chunk-W5SVS4B6.js";
98
+ } from "./chunk-6JFQCVNN.js";
99
99
  import {
100
100
  statedInPercent
101
- } from "./chunk-JMGB444D.js";
101
+ } from "./chunk-5ACFYNA4.js";
102
102
  import {
103
103
  STRUCTURE_COUNT_KINDS
104
- } from "./chunk-XCROSJ2Z.js";
104
+ } from "./chunk-KW4JXWHO.js";
105
105
  import {
106
106
  asRecord,
107
107
  categoriesOf,
@@ -122,7 +122,7 @@ import {
122
122
  } from "./chunk-MCYM3RNF.js";
123
123
  import {
124
124
  WORDING_KEYS
125
- } from "./chunk-V62B23VC.js";
125
+ } from "./chunk-ZNRSYS76.js";
126
126
  import {
127
127
  CROWDED_NAMES,
128
128
  VERIFY_ADVICE,
@@ -137,14 +137,12 @@ import {
137
137
  listCharts,
138
138
  requireGeometry,
139
139
  typeDocLints,
140
- unsupported,
141
- verifiedSizeRepair
142
- } from "./chunk-AFGQXMKT.js";
140
+ unsupported
141
+ } from "./chunk-ETRAPN5G.js";
143
142
  import {
144
143
  chartRefusals
145
- } from "./chunk-V3UE3TB7.js";
144
+ } from "./chunk-UCKUAKYQ.js";
146
145
  import {
147
- ANNOTATION_KIND_PURPOSES,
148
146
  ASPECT_CAPS,
149
147
  ASPECT_LADDER,
150
148
  LADDER_TOLERANCE,
@@ -169,40 +167,46 @@ import {
169
167
  textNames,
170
168
  unitInFormatLints,
171
169
  unitNotShownLints
172
- } from "./chunk-WSKZZ2ZB.js";
170
+ } from "./chunk-I5VDW2XZ.js";
173
171
  import {
174
172
  chartNotes
175
- } from "./chunk-WZB6R2ZX.js";
173
+ } from "./chunk-DZYTXZNS.js";
176
174
  import {
177
175
  ENGINE_REV,
178
176
  version
179
- } from "./chunk-J22ETKDJ.js";
177
+ } from "./chunk-MRM4KJ2O.js";
180
178
  import {
179
+ ANNOTATION_KIND_PURPOSES
180
+ } from "./chunk-F2ET5ZTT.js";
181
+ import {
182
+ drawsZeroNumber,
181
183
  formatExampleProblem,
182
184
  parseFormatExample,
183
185
  unscaledFormatLint
184
- } from "./chunk-D3PQAVFW.js";
186
+ } from "./chunk-Z6DUNKFU.js";
185
187
  import {
186
188
  resolveTheme,
187
189
  resolvedPaintToken,
188
190
  seriesColorIndex,
189
191
  themes
190
- } from "./chunk-JARJP576.js";
192
+ } from "./chunk-TX5FSNAU.js";
191
193
  import {
192
194
  ignoreChartSettings
193
- } from "./chunk-Y7Q3VEYC.js";
195
+ } from "./chunk-CCAAI56H.js";
194
196
  import {
197
+ MUTED_TABLE_INKS,
195
198
  validateTheme
196
- } from "./chunk-DRHQG44U.js";
199
+ } from "./chunk-BQBD6Q5J.js";
197
200
  import {
198
201
  themeShape
199
- } from "./chunk-JYAZPMSA.js";
202
+ } from "./chunk-6IUK6PAH.js";
200
203
  import {
204
+ IGNORED_ON,
201
205
  IGNORED_OPTION_KEYS,
202
206
  LEGEND_DRAWS,
203
207
  schemaRefusedKeys,
204
208
  valueAxisRefusal
205
- } from "./chunk-NIDH22DI.js";
209
+ } from "./chunk-ZSYFQSPF.js";
206
210
  import {
207
211
  patchApplies,
208
212
  readJsonPointer,
@@ -214,12 +218,7 @@ import {
214
218
  normalizeSeriesValues,
215
219
  resolveSize,
216
220
  toLayoutPx
217
- } from "./chunk-FX5VZK5F.js";
218
- import {
219
- maxOf,
220
- minOf,
221
- pushAll
222
- } from "./chunk-WYJEOMNY.js";
221
+ } from "./chunk-RJICOOB3.js";
223
222
  import {
224
223
  compareText
225
224
  } from "./chunk-UIHGGWES.js";
@@ -227,6 +226,11 @@ import {
227
226
  familiesOf,
228
227
  resolveFace
229
228
  } from "./chunk-QZAT46PP.js";
229
+ import {
230
+ maxOf,
231
+ minOf,
232
+ pushAll
233
+ } from "./chunk-WYJEOMNY.js";
230
234
  import {
231
235
  plainText
232
236
  } from "./chunk-SRUV7AT6.js";
@@ -449,454 +453,94 @@ function sha256(input) {
449
453
  return digest(bytes);
450
454
  }
451
455
 
452
- // src/cli/spec.ts
453
- import { readFileSync as readFileSync2, realpathSync } from "fs";
454
- import { resolve as resolve3 } from "path";
455
- import { isatty } from "tty";
456
- import { isDeepStrictEqual } from "util";
456
+ // src/core/catalog.ts
457
+ import * as z from "zod";
457
458
 
458
- // src/core/lint/honesty.ts
459
- var ISO_PERIOD = /^\d{4}-(?:\d{2}(?:-\d{2})?|Q[1-4]|W\d{2})$/;
460
- function cellAt(series, categoryId, index) {
461
- let values = Array.isArray(series.values) ? series.values : [], isKeyed = (entry) => entry !== null && typeof entry == "object" && "categoryId" in entry;
462
- if (!values.some(isKeyed)) return cellNumber(values[index]);
463
- let keyed = values.find((entry) => isKeyed(entry) && entry.categoryId === categoryId);
464
- return keyed === void 0 ? null : cellNumber(keyed.value);
459
+ // src/core/schema/reference.ts
460
+ function object(value) {
461
+ return value !== null && typeof value == "object" && !Array.isArray(value) ? value : void 0;
465
462
  }
466
- var PARTIAL_PERIOD = /\b(?:YTD|H1|Q1\s*[\u2013\u2014-]\s*3)\b/i, FULL_PERIOD = /\b(?:FY(?:\s*(?:20)?\d{2})?|20\d{2})\b/i, BASIS_CHANGE = /\b(?:restated|pro\s+forma|adjusted|rebased)\b/i;
467
- function runHonestyLints(charts) {
468
- let warnings = [];
469
- for (let chart of charts) {
470
- let labels = comparisonLabels(chart), hasPartial = labels.some((label) => PARTIAL_PERIOD.test(label)), hasFull = labels.some((label) => !PARTIAL_PERIOD.test(label) && FULL_PERIOD.test(label));
471
- hasPartial && hasFull && !hasAuthoredFootnote(chart) && warnings.push(
472
- warning(
473
- chart,
474
- "partial-period-pairing",
475
- "warn",
476
- "partial period compared to full period - footnote the basis or align periods",
477
- "add an explanatory footnote or compare like-for-like periods"
478
- )
479
- );
480
- }
481
- for (let chart of charts) {
482
- if (hasAuthoredFootnote(chart)) continue;
483
- let changed = seriesOf(chart).filter((series) => BASIS_CHANGE.test(labelOf(series) ?? ""));
484
- changed.length > 0 && warnings.push(
485
- warning(
486
- chart,
487
- "basis-change",
488
- "warn",
489
- `series '${changed.map((series) => labelOf(series)).join("', '")}' changes the comparison basis without a footnote`,
490
- "footnote what was restated, pro forma, adjusted, or rebased",
491
- changed.length === 1 && typeof changed[0].id == "string" ? { seriesId: changed[0].id } : void 0
492
- )
493
- );
494
- }
495
- for (let chart of charts) {
496
- let options = chart.options ?? {};
497
- if (chart.type !== "column" && chart.type !== "bar" || options.variant !== "stacked" && options.variant !== "stacked100")
498
- continue;
499
- let unitOf = (series) => typeof series.unit == "string" ? series.unit : typeof options.unit == "string" ? options.unit : "", stacked = seriesOf(chart).filter((series) => series.role !== "reference");
500
- if (options.sharesOfOneWhole === !0) {
501
- let over = categoriesOf(chart).filter((category, index) => stacked.reduce((sum, series) => sum + (cellAt(series, category.id, index) ?? 0), 0) > 100.5);
502
- over.length > 0 && warnings.push(
503
- warning(
504
- chart,
505
- "non-additive-stack",
506
- "warn",
507
- `series declared sharesOfOneWhole add to more than 100 in '${over.map((category) => labelOf(category)).join("', '")}' - shares of one whole cannot`,
508
- "check the shares, or remove sharesOfOneWhole if they are shares of different wholes",
509
- over.length === 1 && typeof over[0].id == "string" ? { categoryId: over[0].id } : void 0
510
- )
511
- );
512
- continue;
513
- }
514
- let offending = stacked.filter((series) => statedInPercent(
515
- labelOf(series) ?? "",
516
- unitOf(series),
517
- cellsOfSeries(series).some((cell) => cell !== null && typeof cell == "object" && "pct" in cell)
518
- ));
519
- offending.length !== 0 && warnings.push(
520
- warning(
521
- chart,
522
- "non-additive-stack",
523
- "warn",
524
- `non-additive series '${offending.map((series) => labelOf(series)).join("', '")}' is stacked - percentages do not stack unless they are shares of one whole (options.sharesOfOneWhole)`,
525
- "use grouped columns/bars or a line instead, or set sharesOfOneWhole: true when every series is a share of the same whole",
526
- offending.length === 1 && typeof offending[0].id == "string" ? { seriesId: offending[0].id } : void 0
527
- )
528
- );
463
+ function resolve2(schema, root, refs = /* @__PURE__ */ new Set()) {
464
+ if (typeof schema.$ref != "string") return schema;
465
+ if (refs.has(schema.$ref)) return { ...schema, $ref: void 0 };
466
+ if (!schema.$ref.startsWith("#/")) throw new Error(`Unsupported schema reference: ${schema.$ref}`);
467
+ let target = root;
468
+ for (let key of schema.$ref.slice(2).split("/"))
469
+ target = object(target)?.[key.replaceAll("~1", "/").replaceAll("~0", "~")];
470
+ if (!object(target)) throw new Error(`Missing schema reference: ${schema.$ref}`);
471
+ return { ...resolve2(object(target), root, /* @__PURE__ */ new Set([...refs, schema.$ref])), ...schema, $ref: void 0 };
472
+ }
473
+ function alternatives(schema) {
474
+ return ["anyOf", "oneOf", "allOf"].flatMap((key) => {
475
+ let branches = schema[key];
476
+ return Array.isArray(branches) ? branches.map(object).filter((branch) => branch !== void 0) : [];
477
+ });
478
+ }
479
+ function allowed(schema, root, refs = /* @__PURE__ */ new Set()) {
480
+ if (typeof schema.$ref == "string") {
481
+ if (refs.has(schema.$ref)) return;
482
+ refs = /* @__PURE__ */ new Set([...refs, schema.$ref]);
529
483
  }
530
- for (let chart of charts) {
531
- let counts = /* @__PURE__ */ new Map(), datesByLabel = /* @__PURE__ */ new Map(), categories = categoriesOf(chart), data = asRecord(chart.data), periods = chart.type === "grid" && asRecord(chart.options).stack && Array.isArray(data.measures) ? records(data.periods) : [];
532
- for (let [index, category] of categories.entries()) {
533
- let period = periods.find((p) => {
534
- let from = categories.findIndex((c) => c.id === p.from), to = categories.findIndex((c) => c.id === p.to);
535
- return from >= 0 && index >= from && index <= to;
536
- }), label = period ? `${String(period.label)} / ${labelOf(category)}` : labelOf(category);
537
- if (label !== null && label.trim() !== "") {
538
- counts.set(label, (counts.get(label) ?? 0) + 1);
539
- let date = typeof category.date == "string" ? category.date : typeof category.id == "string" && ISO_PERIOD.test(category.id) ? category.id : void 0, dates = datesByLabel.get(label) ?? [];
540
- dates.push(date), datesByLabel.set(label, dates);
541
- }
542
- }
543
- let duplicates = [...counts].filter(([label, count]) => {
544
- if (count < 2) return !1;
545
- let dates = datesByLabel.get(label);
546
- return !(dates.every((date) => date !== void 0) && new Set(dates).size === dates.length);
547
- }).map(([label]) => label);
548
- duplicates.length > 0 && warnings.push(
549
- warning(
550
- chart,
551
- "duplicate-category-labels",
552
- "warn",
553
- `duplicate category label${duplicates.length === 1 ? "" : "s"}: ${duplicates.join(", ")}`,
554
- "use unique category labels and check for copy-paste artifacts"
555
- )
556
- );
484
+ let field = resolve2(schema, root);
485
+ if (Array.isArray(field.enum)) return { values: field.enum, exhaustive: !0 };
486
+ if (Object.hasOwn(field, "const")) return { values: [field.const], exhaustive: !0 };
487
+ if (field.allOf) return;
488
+ let branches = alternatives(field).filter((branch) => !branch["x-boardplot-retiring"]).map((branch) => allowed(branch, root, refs)), values = [...new Set(branches.flatMap((branch) => branch?.values ?? []))];
489
+ return values.length ? { values, exhaustive: branches.every((branch) => branch?.exhaustive) } : void 0;
490
+ }
491
+ function fieldType(schema, root, refs = /* @__PURE__ */ new Set()) {
492
+ if (typeof schema.$ref == "string") {
493
+ if (refs.has(schema.$ref)) return "recursive";
494
+ refs = /* @__PURE__ */ new Set([...refs, schema.$ref]);
557
495
  }
558
- for (let chart of charts) {
559
- let offending = formatValuePairs(chart).find(
560
- // A format the schema refused already has its finding; it judges nothing here.
561
- ({ format, value }) => Math.abs(value) >= 1e3 && !formatExampleProblem(format) && parseFormatExample(format).decimals >= 3 && parseFormatExample(format).significantDigits === void 0
562
- );
563
- offending && warnings.push(
564
- warning(
565
- chart,
566
- "spurious-precision",
567
- "warn",
568
- `format example '${offending.format}' shows at least 3 decimals for values at or above 1000`,
569
- "round large values to a decision-useful precision"
570
- )
571
- );
496
+ let field = resolve2(schema, root);
497
+ if (object(field.not) && !Object.keys(object(field.not)).length) return "never";
498
+ if (typeof field.const == "boolean") return String(field.const);
499
+ if (Array.isArray(field.type)) return field.type.join(" | ");
500
+ if (typeof field.type == "string") return field.type;
501
+ if (Object.hasOwn(field, "const")) return field.const === null ? "null" : typeof field.const;
502
+ let branches = alternatives(field);
503
+ return branches.length ? [...new Set(branches.map((branch) => fieldType(branch, root, refs)))].join(field.allOf ? " & " : " | ") : "unknown";
504
+ }
505
+ function defaultAt(defaults, path) {
506
+ let value = defaults;
507
+ for (let key of path) {
508
+ let record = object(value);
509
+ if (!record || !Object.hasOwn(record, key)) return;
510
+ value = record[key];
572
511
  }
573
- return warnings;
512
+ return value;
574
513
  }
575
- function comparisonLabels(chart) {
576
- return chart.type === "table" ? records(chart.data?.columns).map(labelOf).filter((label) => label !== null) : seriesOf(chart).map(labelOf).filter((label) => label !== null);
577
- }
578
-
579
- // src/core/lint/partner.ts
580
- function runPartnerLints(charts) {
581
- let warnings = [];
582
- for (let chart of charts) {
583
- if (!chart.requireMessageTitle || chart.type === "kpi") continue;
584
- let title = chartOptions(chart).title;
585
- title !== !1 && (typeof title != "string" || title.trim() === "" || isGenericTitle(title, [chart.type, chart.authoredType, chart.typeTitle])) && warnings.push(
586
- warning(
587
- chart,
588
- "missing-message-title",
589
- "warn",
590
- "consulting titles carry the message; this title is missing or generic",
591
- "state the decision-relevant takeaway in options.title"
592
- )
593
- );
594
- }
595
- for (let chart of charts) {
596
- let options = chartOptions(chart);
597
- if (!(chart.type === "line" && options.variant !== "bump" || chart.type === "column" && (options.variant === void 0 || options.variant === "grouped"))) continue;
598
- let series = seriesOf(chart).filter((item) => item.role !== "reference");
599
- series.length > 6 && warnings.push(
600
- warning(
601
- chart,
602
- "series-overload",
603
- "warn",
604
- `${series.length} data series exceed the 6-series readability limit`,
605
- "show the top series or facet the comparison"
606
- )
607
- );
608
- }
609
- for (let chart of charts) {
610
- if (chart.type !== "column") continue;
611
- let options = chartOptions(chart), labels = isRecord(options.labels) ? options.labels : {}, valueAxis = isRecord(options.valueAxis) ? options.valueAxis : {}, series = seriesOf(chart), pyReferences = series.filter(
612
- (item) => item.role === "reference" && typeof item.scenario == "string" && item.scenario.toUpperCase() === "PY"
613
- );
614
- if (!(options.variant === "stacked" && valueAxis.percent !== !0 && (options.referenceStyle === void 0 || options.referenceStyle === "tick") && options.grandTotalLabels !== !1 && options.labels !== !1 && labels.grandTotal !== !1 && labels.annotation !== !1 && labels.tick !== !1 && pyReferences.length === 1)) continue;
615
- let periods = categoriesOf(chart).length, components = series.filter((item) => item.role !== "reference").length;
616
- periods <= 6 && components <= 4 || warnings.push(
617
- warning(
618
- chart,
619
- "integrated-stacked-variance-overload",
620
- "info",
621
- `integrated stacked variance has ${periods} periods and ${components} components; the readable maximum is 6 periods and 4 components`,
622
- "reduce periods/components or use the explicit dual-tier relative-variance grid"
623
- )
624
- );
625
- }
626
- for (let chart of charts) {
627
- if (chart.type !== "pie") continue;
628
- let categories = categoriesOf(chart), options = chartOptions(chart), topN = typeof options.topN == "object" && options.topN !== null ? options.topN : { n: 5, rest: !0 }, n = typeof topN.n == "number" && topN.n > 0 ? Math.floor(topN.n) : null, effectiveCount = categories.length, isOthers = (s) => /^others?$/i.test((s ?? "").trim()), hasOthers = categories.some(
629
- (category) => isOthers(labelOf(category)) || typeof category.id == "string" && isOthers(category.id)
630
- );
631
- n !== null && categories.length > n && (effectiveCount = topN.rest === !1 ? n : n + 1, topN.rest !== !1 && (hasOthers = !0)), effectiveCount > 6 && !hasOthers && warnings.push(
632
- warning(
633
- chart,
634
- "pie-too-many-slices",
635
- "warn",
636
- `${effectiveCount} pie slices without an 'Others' slice exceed the 6-slice readability limit`,
637
- "aggregate small slices into 'Others' or switch to a bar chart"
638
- )
639
- );
640
- }
641
- for (let chart of charts) {
642
- let options = chartOptions(chart), legend = options.legend;
643
- if (chart.type === "pie" || legend === "auto" || !legendEnabled(legend)) continue;
644
- let series = seriesOf(chart);
645
- if (series.length === 1 && !(chart.type === "line" && lineDirectlyNamesSeries(options, series[0], categoriesOf(chart), 1))) {
646
- warnings.push(
647
- warning(
648
- chart,
649
- "legend-redundant",
650
- "warn",
651
- "a forced legend repeats the only series",
652
- "turn the legend off and label the series directly",
653
- typeof series[0].id == "string" ? { seriesId: series[0].id } : void 0
654
- )
655
- );
656
- continue;
657
- }
658
- let dataSeries = series.filter((item) => item.role !== "reference"), categories = categoriesOf(chart);
659
- chart.type === "line" && dataSeries.length === series.length && dataSeries.length > 0 && dataSeries.every((item) => lineDirectlyNamesSeries(options, item, categories, dataSeries.length)) && warnings.push(
660
- { ...warning(
661
- chart,
662
- "legend-redundant",
663
- "info",
664
- `options.legend repeats series names requested by ${options.seriesLabels !== void 0 ? "options.seriesLabels" : "options.labels (or its default)"}`,
665
- "remove options.legend to use the direct names without the repeated key"
666
- ), fix: [{ op: "remove", path: `${chart.path ?? ""}/options/legend` }] }
667
- );
668
- }
669
- if (!charts.some(hasFormatOrUnit)) {
670
- let chart = charts.find((candidate) => numericDataValues(candidate).some((value) => Math.abs(value) >= 1e3));
671
- chart && warnings.push(
672
- warning(
673
- chart,
674
- "unlabeled-units",
675
- "warn",
676
- "values at or above 1000 have no format or unit anywhere in the document; readers must not guess magnitudes",
677
- "declare options.unit or a format-by-example"
678
- )
679
- );
680
- }
681
- for (let chart of charts) {
682
- if (!["column", "bar", "combo", "line", "dot", "scatter"].includes(chart.type)) continue;
683
- let options = chartOptions(chart), scatterGroups = chart.type === "scatter" ? scatterGroupIdentities(chart.data, chart.geometry, chart.geometryPrefix) : void 0;
684
- if (chart.geometry) {
685
- let geometry = chart.geometry, prefix = chart.geometryPrefix ?? "", drawn2 = scatterGroups ? scatterGroups.map((group) => ({ ...group })) : seriesOf(chart).filter((s) => geometry.scene.some((node2) => node2.t !== "text" && node2.part !== "swatch" && (node2.owner.seriesId === prefix + s.id || node2.owner.seriesId === s.id && node2.id.startsWith(prefix)))), unnamed = drawn2.filter((s) => {
686
- let group = scatterGroups?.find((group2) => group2.id === s.id);
687
- return group ? !scatterGroupNameIsDrawn(geometry, group, prefix) : !nameIsDrawn(geometry, labelOf(s) ?? "", prefix + s.id);
688
- });
689
- (drawn2.length > 1 && unnamed.length > 0 || unnamed.some((s) => s.role === "reference")) && warnings.push(warning(
690
- chart,
691
- "series-unexplained",
692
- "warn",
693
- `Drawn series ${unnamed.map((s) => labelOf(s)).join(", ")} have no visible name`,
694
- "set options.legend to top, or show a direct label for each series"
695
- ));
696
- continue;
697
- }
698
- if (legendEnabled(options.legend) || legendEnabled(chart.parentLegend) || drawsRequiredKey(chart) || options.variant === "tornado") continue;
699
- let series = scatterGroups ? scatterGroups.map((group) => ({ ...group })) : seriesOf(chart), categories = categoriesOf(chart), dataSeries = series.filter((s) => s.role !== "reference").filter((s) => chart.type !== "line" || lineSeriesRenders(options, s, categories)), refSeries = series.filter((s) => s.role === "reference").filter((s) => chart.type !== "line" || effectiveLineValues(options, s, categories).filter((v) => v !== null).length >= 2), rawSubtitle = JSON.stringify(options.subtitle ?? ""), canonicalScenario = (v) => {
700
- if (typeof v != "string") return null;
701
- let u = v.toUpperCase();
702
- return u === "FCST" ? "FC" : u === "BUD" ? "PL" : u;
703
- }, scenarioIdentified = (s) => {
704
- let code = canonicalScenario(s.scenario);
705
- return code === null ? !1 : code === "FC" || code === "PL" ? !0 : new RegExp(`\\b${code}\\b`).test(rawSubtitle);
706
- }, endpointLabeled = (s) => {
707
- if (chart.type === "line") {
708
- let names2 = lineLabelModes(options, lineVariantOf(options), dataSeries.length).series;
709
- return names2 === "key" || names2 === "none" && dataSeries.length >= 2 && (options.legend === void 0 || options.legend === "auto") || lineDirectlyNamesSeries(options, s, categories, dataSeries.length);
710
- }
711
- if (chart.type === "combo")
712
- return (s.kind === "line" || s.kind === "area") && kindKeepsSeriesNames(options, "point", !1);
713
- if (chart.type === "column" && (options.variant === "stacked" || options.variant === "stacked100")) {
714
- let seriesLabels = options.seriesLabels;
715
- return seriesLabels === void 0 ? !1 : !Array.isArray(seriesLabels.only) || seriesLabels.only.includes(s.id);
716
- }
717
- return !1;
718
- }, scenarioCount = /* @__PURE__ */ new Map();
719
- for (let s of dataSeries) scenarioCount.set(canonicalScenario(s.scenario), (scenarioCount.get(canonicalScenario(s.scenario)) ?? 0) + 1);
720
- let identified = (s) => endpointLabeled(s) || scenarioIdentified(s) && scenarioCount.get(canonicalScenario(s.scenario)) === 1, unidentifiedData = dataSeries.filter((s) => !identified(s)), unexplainedRefs = refSeries.filter((s) => !scenarioIdentified(s)), ambiguousData = unidentifiedData.length >= 2 ? unidentifiedData : [];
721
- if (ambiguousData.length === 0 && unexplainedRefs.length === 0) continue;
722
- let subject = ambiguousData.length ? `${ambiguousData.length} series${unexplainedRefs.length ? " and a reference marker" : ""} are visually distinguished but never identified` : "a reference marker is drawn as a bare stroke with nothing naming it", isGridPanel = chart.displayName.includes("/");
723
- warnings.push(
724
- warning(
725
- chart,
726
- "series-unexplained",
727
- "warn",
728
- `${subject} \u2014 no legend, no direct labels`,
729
- isGridPanel ? "enable legend on the grid options (one exhibit-level legend) or on this panel, or show direct series names" : "enable options.legend, or show direct series names"
730
- )
731
- );
732
- }
733
- for (let chart of charts) {
734
- let scenarios = scenarioCodes(chart);
735
- if (chart.geometry) {
736
- let names2 = { AC: "actual", PY: "prior year", PL: "plan", FC: "forecast" }, geometry = chart.geometry, missing = [...scenarios].filter((code) => nameIsDrawn(geometry, code) || nameIsDrawn(geometry, names2[code] ?? code) || geometry.scene.some((node2) => (node2.part === "subtitle" || node2.part === "footnote") && (textNames(node2, code) || textNames(node2, names2[code] ?? code))) ? !1 : !seriesOf(chart).some((series) => {
737
- let scenario = typeof series.scenario == "string" ? series.scenario.toUpperCase() : "";
738
- if (scenario !== code && scenario !== (code === "PL" ? "BUD" : "FCST")) return !1;
739
- let ids = [series.id, `${chart.geometryPrefix ?? ""}${series.id}`];
740
- return geometry.scene.some((node2) => node2.part === "legendLabel" && ids.includes(node2.owner.seriesId) && textNames(node2, labelOf(series) ?? "")) && geometry.scene.some((node2) => node2.part === "swatch" && ids.includes(node2.owner.seriesId));
741
- }));
742
- missing.length > 0 && warnings.push(warning(
743
- chart,
744
- "scenario-unexplained",
745
- "info",
746
- `${missing.join("/")} scenario styling has no visible explanation`,
747
- "name the scenario in the key, subtitle or footnote"
748
- ));
749
- continue;
750
- }
751
- let legendOff = !legendEnabled(chartOptions(chart).legend) && !legendEnabled(chart.parentLegend) && !drawsRequiredKey(chart), subtitle = JSON.stringify(chartOptions(chart).subtitle ?? ""), subtitleExplains = scenarios.size > 0 && [...scenarios].every((code) => subtitle.includes(code));
752
- scenarios.size > 0 && legendOff && !subtitleExplains && !hasAuthoredFootnote(chart) && warnings.push(
753
- warning(
754
- chart,
755
- "scenario-unexplained",
756
- "info",
757
- `${[...scenarios].sort().join("/")} scenario styling is used with no legend or explanatory footnote`,
758
- "enable the legend or explain the scenario abbreviation in a footnote"
759
- )
760
- );
761
- }
762
- return warnings;
763
- }
764
- function drawsRequiredKey(chart) {
765
- return chart.displayName.includes("/") ? chart.parentLegend === "none" : chart.type === "waterfall" || chart.type === "variance" && chartOptions(chart).variant === "integrated";
766
- }
767
- function kindKeepsSeriesNames(options, kind, namesByDefault = !0) {
768
- let labels = options.labels;
769
- if (labels === !1) return !1;
770
- if (typeof labels != "object" || labels === null) return namesByDefault;
771
- let value = labels[kind];
772
- return value === !1 ? !1 : Array.isArray(value) ? value.includes("series") : namesByDefault;
773
- }
774
- function lineVariantOf(options) {
775
- let variant = (isRecord(options.valueAxis) ? options.valueAxis : {}).percent === !0 ? "stacked100-area" : options.variant;
776
- return variant === "area" || variant === "stacked-area" || variant === "stacked100-area" || variant === "bump" ? variant : "line";
777
- }
778
- function lineDirectlyNamesSeries(options, series, categories, count) {
779
- if (!effectiveLineValues(options, series, categories).some((value) => value !== null)) return !1;
780
- let modes = lineLabelModes(options, lineVariantOf(options), count);
781
- return (modes.series === "end" || modes.series === "inline") && (modes.only === void 0 || modes.only.has(series.id)) ? !0 : modes.values !== "none" && kindKeepsSeriesNames(options, "point", !1);
782
- }
783
- function lineSeriesRenders(options, series, categories) {
784
- let variant = (isRecord(options.valueAxis) ? options.valueAxis : {}).percent === !0 ? "stacked100-area" : options.variant ?? "line";
785
- return variant === "stacked-area" || variant === "stacked100-area" ? categories.length >= 2 : effectiveLineValues(options, series, categories).some((value) => value !== null);
786
- }
787
- function effectiveLineValues(options, series, categories) {
788
- let entries = Array.isArray(series.values) ? series.values : [], pointKeyed = entries.length > 0 && entries.every((entry) => isRecord(entry) && "categoryId" in entry), values = categories.map((category, index) => {
789
- let entry = pointKeyed ? entries.find((candidate) => isRecord(candidate) && candidate.categoryId === category.id) : entries[index];
790
- return cellNumber(isRecord(entry) && "value" in entry ? entry.value : entry);
791
- }), rebase = options.rebase100;
792
- if (rebase === void 0 || rebase === !1) return values;
793
- let at = isRecord(rebase) && typeof rebase.at == "string" ? rebase.at : categories[0]?.id, baseIndex = categories.findIndex((category) => category.id === at);
794
- if (baseIndex < 0) return values;
795
- let base = values[baseIndex] ?? null;
796
- return base === null || base <= 0 ? values.map(() => null) : values;
797
- }
798
- function isGenericTitle(title, typeNames) {
799
- let normalized = title.trim().toLowerCase();
800
- return /^(?:chart|figure|untitled)\b/.test(normalized) ? !0 : typeNames.some((typeName) => {
801
- if (!typeName) return !1;
802
- let exact = typeName.trim().toLowerCase();
803
- if (normalized === exact) return !0;
804
- let escapedType = exact.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
805
- return new RegExp(
806
- `^${escapedType}(?:(?:\\s+(?:chart|plot|figure|card|\\d+))|(?:\\s*\\([^)]*\\))|(?:\\s*/\\s*[a-z0-9 /()-]+))?$`,
807
- "i"
808
- ).test(normalized);
809
- });
810
- }
811
-
812
- // src/core/catalog.ts
813
- import * as z from "zod";
814
-
815
- // src/core/schema/reference.ts
816
- function object(value) {
817
- return value !== null && typeof value == "object" && !Array.isArray(value) ? value : void 0;
818
- }
819
- function resolve2(schema, root, refs = /* @__PURE__ */ new Set()) {
820
- if (typeof schema.$ref != "string") return schema;
821
- if (refs.has(schema.$ref)) return { ...schema, $ref: void 0 };
822
- if (!schema.$ref.startsWith("#/")) throw new Error(`Unsupported schema reference: ${schema.$ref}`);
823
- let target = root;
824
- for (let key of schema.$ref.slice(2).split("/"))
825
- target = object(target)?.[key.replaceAll("~1", "/").replaceAll("~0", "~")];
826
- if (!object(target)) throw new Error(`Missing schema reference: ${schema.$ref}`);
827
- return { ...resolve2(object(target), root, /* @__PURE__ */ new Set([...refs, schema.$ref])), ...schema, $ref: void 0 };
828
- }
829
- function alternatives(schema) {
830
- return ["anyOf", "oneOf", "allOf"].flatMap((key) => {
831
- let branches = schema[key];
832
- return Array.isArray(branches) ? branches.map(object).filter((branch) => branch !== void 0) : [];
833
- });
834
- }
835
- function allowed(schema, root, refs = /* @__PURE__ */ new Set()) {
836
- if (typeof schema.$ref == "string") {
837
- if (refs.has(schema.$ref)) return;
838
- refs = /* @__PURE__ */ new Set([...refs, schema.$ref]);
839
- }
840
- let field = resolve2(schema, root);
841
- if (Array.isArray(field.enum)) return { values: field.enum, exhaustive: !0 };
842
- if (Object.hasOwn(field, "const")) return { values: [field.const], exhaustive: !0 };
843
- if (field.allOf) return;
844
- let branches = alternatives(field).filter((branch) => !branch["x-boardplot-retiring"]).map((branch) => allowed(branch, root, refs)), values = [...new Set(branches.flatMap((branch) => branch?.values ?? []))];
845
- return values.length ? { values, exhaustive: branches.every((branch) => branch?.exhaustive) } : void 0;
846
- }
847
- function fieldType(schema, root, refs = /* @__PURE__ */ new Set()) {
848
- if (typeof schema.$ref == "string") {
849
- if (refs.has(schema.$ref)) return "recursive";
850
- refs = /* @__PURE__ */ new Set([...refs, schema.$ref]);
851
- }
852
- let field = resolve2(schema, root);
853
- if (object(field.not) && !Object.keys(object(field.not)).length) return "never";
854
- if (typeof field.const == "boolean") return String(field.const);
855
- if (Array.isArray(field.type)) return field.type.join(" | ");
856
- if (typeof field.type == "string") return field.type;
857
- if (Object.hasOwn(field, "const")) return field.const === null ? "null" : typeof field.const;
858
- let branches = alternatives(field);
859
- return branches.length ? [...new Set(branches.map((branch) => fieldType(branch, root, refs)))].join(field.allOf ? " & " : " | ") : "unknown";
860
- }
861
- function defaultAt(defaults, path) {
862
- let value = defaults;
863
- for (let key of path) {
864
- let record = object(value);
865
- if (!record || !Object.hasOwn(record, key)) return;
866
- value = record[key];
867
- }
868
- return value;
869
- }
870
- function schemaReference(schema, defaults) {
871
- let fields2 = [], missing = /* @__PURE__ */ new Set(), visit2 = (input, path, refs, branch) => {
872
- if (typeof input.$ref == "string") {
873
- if (refs.has(input.$ref)) return;
874
- refs = /* @__PURE__ */ new Set([...refs, input.$ref]);
875
- }
876
- let node2 = resolve2(input, schema), properties = object(node2.properties) ?? {};
877
- for (let [key, raw] of Object.entries(properties)) {
878
- if (!object(raw)) continue;
879
- let child = resolve2(object(raw), schema), parts = [...path, key], description = typeof child.description == "string" ? child.description.trim() : "";
880
- description || missing.add(parts.join("."));
881
- let value = Object.hasOwn(child, "default") ? child.default : defaultAt(defaults, parts), dependsOn = Array.isArray(child["x-boardplot-defaultDependsOn"]) ? child["x-boardplot-defaultDependsOn"].map(String) : void 0, items = child.type === "array" ? object(child.items) : void 0, itemValues = items ? allowed(items, schema) : void 0, values = allowed(object(raw), schema) ?? itemValues;
882
- fields2.push({
883
- path: parts.join("."),
884
- type: itemValues && items ? `${fieldType(items, schema)}[]` : fieldType(object(raw), schema),
885
- required: Array.isArray(node2.required) && node2.required.includes(key),
886
- description,
887
- ...values ? { values: values.values, valuesExhaustive: values.exhaustive } : {},
888
- ...value !== void 0 ? { default: value } : dependsOn ? { defaultDependsOn: dependsOn } : {},
889
- ...Object.hasOwn(child, "default") ? { defaultInSchema: !0 } : {},
890
- ...branch ? { branch } : {}
891
- }), visit2(object(raw), parts, refs, branch);
892
- }
893
- let choices = alternatives(node2), objectUnion = !node2.allOf && choices.filter((choice) => object(resolve2(choice, schema).properties)).length > 1;
894
- choices.forEach((choice, index) => visit2(choice, path, refs, objectUnion ? [branch, `${path.join(".")} branch ${index + 1}`].filter(Boolean).join("; ") : branch)), object(node2.items) && visit2(object(node2.items), [...path.slice(0, -1), `${path.at(-1) ?? ""}[]`], refs, branch), Array.isArray(node2.prefixItems) && node2.prefixItems.forEach((item, index) => {
895
- object(item) && visit2(object(item), [...path.slice(0, -1), `${path.at(-1) ?? ""}[${index}]`], refs, branch);
896
- }), object(node2.additionalProperties) && visit2(object(node2.additionalProperties), [...path, "*"], refs, branch);
897
- };
898
- if (visit2(schema, [], /* @__PURE__ */ new Set()), missing.size) throw new Error(`Schema fields need descriptions: ${[...missing].join(", ")}`);
899
- return fields2;
514
+ function schemaReference(schema, defaults) {
515
+ let fields2 = [], missing = /* @__PURE__ */ new Set(), visit2 = (input, path, refs, branch) => {
516
+ if (typeof input.$ref == "string") {
517
+ if (refs.has(input.$ref)) return;
518
+ refs = /* @__PURE__ */ new Set([...refs, input.$ref]);
519
+ }
520
+ let node2 = resolve2(input, schema), properties = object(node2.properties) ?? {};
521
+ for (let [key, raw] of Object.entries(properties)) {
522
+ if (!object(raw)) continue;
523
+ let child = resolve2(object(raw), schema), parts = [...path, key], description = typeof child.description == "string" ? child.description.trim() : "";
524
+ description || missing.add(parts.join("."));
525
+ let value = Object.hasOwn(child, "default") ? child.default : defaultAt(defaults, parts), dependsOn = Array.isArray(child["x-boardplot-defaultDependsOn"]) ? child["x-boardplot-defaultDependsOn"].map(String) : void 0, items = child.type === "array" ? object(child.items) : void 0, itemValues = items ? allowed(items, schema) : void 0, values = allowed(object(raw), schema) ?? itemValues;
526
+ fields2.push({
527
+ path: parts.join("."),
528
+ type: itemValues && items ? `${fieldType(items, schema)}[]` : fieldType(object(raw), schema),
529
+ required: Array.isArray(node2.required) && node2.required.includes(key),
530
+ description,
531
+ ...values ? { values: values.values, valuesExhaustive: values.exhaustive } : {},
532
+ ...value !== void 0 ? { default: value } : dependsOn ? { defaultDependsOn: dependsOn } : {},
533
+ ...Object.hasOwn(child, "default") ? { defaultInSchema: !0 } : {},
534
+ ...branch ? { branch } : {}
535
+ }), visit2(object(raw), parts, refs, branch);
536
+ }
537
+ let choices = alternatives(node2), objectUnion = !node2.allOf && choices.filter((choice) => object(resolve2(choice, schema).properties)).length > 1;
538
+ choices.forEach((choice, index) => visit2(choice, path, refs, objectUnion ? [branch, `${path.join(".")} branch ${index + 1}`].filter(Boolean).join("; ") : branch)), object(node2.items) && visit2(object(node2.items), [...path.slice(0, -1), `${path.at(-1) ?? ""}[]`], refs, branch), Array.isArray(node2.prefixItems) && node2.prefixItems.forEach((item, index) => {
539
+ object(item) && visit2(object(item), [...path.slice(0, -1), `${path.at(-1) ?? ""}[${index}]`], refs, branch);
540
+ }), object(node2.additionalProperties) && visit2(object(node2.additionalProperties), [...path, "*"], refs, branch);
541
+ };
542
+ if (visit2(schema, [], /* @__PURE__ */ new Set()), missing.size) throw new Error(`Schema fields need descriptions: ${[...missing].join(", ")}`);
543
+ return fields2;
900
544
  }
901
545
 
902
546
  // src/core/catalog.ts
@@ -1194,137 +838,509 @@ function buildCatalog() {
1194
838
  };
1195
839
  }
1196
840
 
1197
- // src/core/lint/design.ts
1198
- var DOCS = {
1199
- "design-bar-sort": "docs/reference/bar.md#design-bar-sort",
1200
- "design-bar-many": "docs/reference/bar.md#design-bar-many",
1201
- "design-line-direct-labels": "docs/reference/line.md#design-line-direct-labels",
1202
- "design-line-label-points": "docs/reference/line.md#design-line-label-points",
1203
- "design-waterfall-closing-total": "docs/reference/waterfall.md#design-waterfall-closing-total",
1204
- "design-waterfall-horizontal": "docs/reference/waterfall.md#design-waterfall-horizontal"
1205
- }, ADVICE_PER_RENDER = 3, BARS_MAX = 15, BARS_KEPT = 10, LABELLED_POINTS_MAX = 12, LINES_MAX = 6, ORDERED_NAME = /\d|\b(?:jan(?:uary)?|feb(?:ruary)?|mar(?:ch)?|apr(?:il)?|may|june?|july?|aug(?:ust)?|sep(?:t(?:ember)?)?|oct(?:ober)?|nov(?:ember)?|dec(?:ember)?|mon(?:day)?|tue(?:sday)?|wed(?:nesday)?|thu(?:rsday)?|fri(?:day)?|sat(?:urday)?|sun(?:day)?|very|strongly|somewhat|low|medium|mid|high|small|large|first|second|third|last|before|after|early|late|stage|phase|step)\b/i, PINNED_NAME = /^(?:total|others?|rest|average|avg|all|overall)\b/i;
1206
- function runDesignLints(charts) {
1207
- let found = [];
1208
- for (let chart of charts)
1209
- !chart.requireMessageTitle || !chart.geometry || (chart.type === "bar" ? found.push(...barAdvice(chart)) : chart.type === "line" ? found.push(...lineAdvice(chart)) : chart.type === "waterfall" && found.push(...waterfallAdvice(chart)));
1210
- return found.slice(0, ADVICE_PER_RENDER);
1211
- }
1212
- function advice(chart, code, field, suggest, fix, drawn2) {
1213
- let base = chart.path;
1214
- return {
1215
- code,
1216
- severity: "advice",
1217
- message: `chart '${chart.displayName}'${drawn2 ? ` (${drawn2})` : ""}: ${designRuleText(code)}`,
1218
- suggest,
1219
- docs: DOCS[code],
1220
- ...base === void 0 ? {} : {
1221
- path: `${base}${field}`,
1222
- fix: fix.map((operation) => ({ ...operation, path: `${base}${operation.path}` }))
841
+ // src/core/lint/design.ts
842
+ var designCodes = [
843
+ "design-bar-sort",
844
+ "design-bar-many",
845
+ "design-line-direct-labels",
846
+ "design-line-label-points",
847
+ "design-waterfall-closing-total",
848
+ "design-waterfall-horizontal"
849
+ ], DOCS = {
850
+ "design-bar-sort": "docs/reference/bar.md#design-bar-sort",
851
+ "design-bar-many": "docs/reference/bar.md#design-bar-many",
852
+ "design-line-direct-labels": "docs/reference/line.md#design-line-direct-labels",
853
+ "design-line-label-points": "docs/reference/line.md#design-line-label-points",
854
+ "design-waterfall-closing-total": "docs/reference/waterfall.md#design-waterfall-closing-total",
855
+ "design-waterfall-horizontal": "docs/reference/waterfall.md#design-waterfall-horizontal"
856
+ }, ADVICE_PER_RENDER = 3, BARS_MAX = 15, BARS_KEPT = 10, LABELLED_POINTS_MAX = 12, LINES_MAX = 6, ORDERED_NAME = /\d|\b(?:jan(?:uary)?|feb(?:ruary)?|mar(?:ch)?|apr(?:il)?|may|june?|july?|aug(?:ust)?|sep(?:t(?:ember)?)?|oct(?:ober)?|nov(?:ember)?|dec(?:ember)?|mon(?:day)?|tue(?:sday)?|wed(?:nesday)?|thu(?:rsday)?|fri(?:day)?|sat(?:urday)?|sun(?:day)?|very|strongly|somewhat|low|medium|mid|high|small|large|first|second|third|last|before|after|early|late|stage|phase|step)\b/i, PINNED_NAME = /^(?:total|others?|rest|average|avg|all|overall)\b/i;
857
+ function runDesignLints(charts) {
858
+ let found = [];
859
+ for (let chart of charts)
860
+ !chart.requireMessageTitle || !chart.geometry || (chart.type === "bar" ? found.push(...barAdvice(chart)) : chart.type === "line" ? found.push(...lineAdvice(chart)) : chart.type === "waterfall" && found.push(...waterfallAdvice(chart)));
861
+ return found.slice(0, ADVICE_PER_RENDER);
862
+ }
863
+ function advice(chart, code, field, suggest, fix, drawn2) {
864
+ let base = chart.path;
865
+ return {
866
+ code,
867
+ severity: "advice",
868
+ message: `chart '${chart.displayName}'${drawn2 ? ` (${drawn2})` : ""}: ${designRuleText(code)}`,
869
+ suggest,
870
+ docs: DOCS[code],
871
+ ...base === void 0 ? {} : {
872
+ path: `${base}${field}`,
873
+ fix: fix.map((operation) => ({ ...operation, path: `${base}${operation.path}` }))
874
+ }
875
+ };
876
+ }
877
+ function valuesInOrder(series, categories) {
878
+ let entries = Array.isArray(series.values) ? series.values : [], keyed = entries.length > 0 && entries.every((entry) => isRecord(entry) && "categoryId" in entry);
879
+ return categories.map((category, index) => {
880
+ let entry = keyed ? entries.find((candidate) => isRecord(candidate) && candidate.categoryId === category.id) : entries[index];
881
+ return cellNumber(isRecord(entry) && "categoryId" in entry ? entry.value : entry);
882
+ });
883
+ }
884
+ function largestFirst(values) {
885
+ return values.every((value, index) => index === 0 || value <= values[index - 1]);
886
+ }
887
+ function rankable(categories) {
888
+ return categories.every((category) => {
889
+ let name = labelOf(category) ?? "";
890
+ return category.date === void 0 && !category.gapAfter && !category.breakAfter && !ORDERED_NAME.test(name) && !PINNED_NAME.test(name.trim());
891
+ });
892
+ }
893
+ function drawnBars(chart) {
894
+ let ids = /* @__PURE__ */ new Set();
895
+ for (let node2 of chart.geometry?.scene ?? [])
896
+ node2.t === "rect" && node2.part === "bar" && node2.owner.categoryId && ids.add(node2.owner.categoryId);
897
+ return ids.size || void 0;
898
+ }
899
+ function barAdvice(chart) {
900
+ let options = chartOptions(chart), variant = options.variant ?? "grouped";
901
+ if (variant === "tornado" || variant === "football-field") return [];
902
+ let categories = categoriesOf(chart), found = [], dataSeries = seriesOf(chart).filter((series) => series.role !== "reference");
903
+ if (!rankable(categories)) return [];
904
+ if (variant === "grouped" && options.sort === void 0 && options.topN === void 0 && dataSeries.length === 1 && categories.length >= 5 && categories.length <= BARS_MAX) {
905
+ let values = valuesInOrder(dataSeries[0], categories);
906
+ values.every((value) => value !== null) && !largestFirst(values) && found.push(advice(
907
+ chart,
908
+ "design-bar-sort",
909
+ "/options/sort",
910
+ "set options.sort.categories to desc",
911
+ [{ op: "replace", path: "/options/sort", value: { categories: "desc" } }]
912
+ ));
913
+ }
914
+ let topN = isRecord(options.topN) && typeof options.topN.n == "number" ? options.topN : void 0, cut = topN && categories.length > topN.n ? topN.n + (topN.rest === !1 ? 0 : 1) : categories.length, drawn2 = drawnBars(chart) ?? cut;
915
+ if (drawn2 > BARS_MAX) {
916
+ let fix = isRecord(options.topN) ? [{ op: "replace", path: "/options/topN/n", value: BARS_KEPT }] : [{ op: "replace", path: "/options/topN", value: { n: BARS_KEPT, rest: !0 } }];
917
+ found.push(advice(chart, "design-bar-many", "/options/topN", `keep the top ${BARS_KEPT} with options.topN and fold the rest into Others`, fix, `${drawn2} bars drawn`));
918
+ }
919
+ return found;
920
+ }
921
+ function legendPosition(legend) {
922
+ return isRecord(legend) ? legend.position : legend;
923
+ }
924
+ function between(count, low, high) {
925
+ return count >= low && count <= high;
926
+ }
927
+ function drawnLines(chart) {
928
+ let ids = /* @__PURE__ */ new Set();
929
+ for (let node2 of chart.geometry?.scene ?? [])
930
+ node2.t === "path" && node2.part === "line" && node2.owner.seriesId && ids.add(node2.owner.seriesId);
931
+ return ids.size || void 0;
932
+ }
933
+ function drawnPeriods(chart, options) {
934
+ let live = chart.geometry?.derived?.liveWindow;
935
+ if (Array.isArray(live?.displayedCategoryIds)) return live.displayedCategoryIds.length;
936
+ let categories = categoriesOf(chart), zoom = isRecord(options.viewDomain) && Array.isArray(options.viewDomain.x) ? options.viewDomain.x : void 0;
937
+ if (zoom) {
938
+ let [from, to] = zoom.map((id) => categories.findIndex((category) => category.id === id));
939
+ if (from !== void 0 && to !== void 0 && from >= 0 && to >= 0) return Math.abs(to - from) + 1;
940
+ }
941
+ return categories.length;
942
+ }
943
+ function lineAdvice(chart) {
944
+ let options = chartOptions(chart), found = [], series = seriesOf(chart), dataSeries = series.filter((item) => item.role !== "reference"), plainLines = (options.variant ?? "line") === "line" && options.fan === void 0 && dataSeries.length === series.length && between(drawnLines(chart) ?? dataSeries.length, 2, LINES_MAX) && dataSeries.every((item) => item.scenario === void 0 || String(item.scenario).toUpperCase().startsWith("AC")), position = legendPosition(options.legend), namedOnLines = options.seriesLabels !== "key" && options.seriesLabels !== "none";
945
+ plainLines && (position === "top" || position === "bottom") && !namedOnLines && chart.drawsWith?.({ legend: "none", seriesLabels: "end" }, "design-line-direct-labels") !== !1 && found.push(advice(chart, "design-line-direct-labels", "/options/legend", "set options.legend to none and options.seriesLabels to end", [
946
+ { op: "replace", path: "/options/legend", value: "none" },
947
+ { op: "replace", path: "/options/seriesLabels", value: "end" }
948
+ ]));
949
+ let periods = drawnPeriods(chart, options);
950
+ return options.valueLabels === "all" && periods > LABELLED_POINTS_MAX && found.push(advice(
951
+ chart,
952
+ "design-line-label-points",
953
+ "/options/valueLabels",
954
+ "remove options.valueLabels for the default, or set it to last or ends",
955
+ [{ op: "remove", path: "/options/valueLabels" }],
956
+ `${periods} periods drawn`
957
+ )), found;
958
+ }
959
+ function waterfallAdvice(chart) {
960
+ let options = chartOptions(chart), items = records(isRecord(chart.data) ? chart.data.items : void 0), found = [], last = items.at(-1);
961
+ if (items.length >= 2 && last && last.type !== "total" && last.type !== "subtotal") {
962
+ let ids = new Set(items.map((item) => item.id)), id = "total";
963
+ for (let suffix = 2; ids.has(id); suffix++) id = `total-${suffix}`;
964
+ found.push(advice(
965
+ chart,
966
+ "design-waterfall-closing-total",
967
+ "/data/items",
968
+ "add a last item with type total (with rows, a last row whose type is total); Boardplot sums the steps",
969
+ [{ op: "add", path: "/data/items/-", value: { id, label: "Total", type: "total" } }]
970
+ ));
971
+ }
972
+ return options.variant !== "horizontal" && chart.geometry.warnings.some((warning2) => CROWDED_NAMES.has(warning2.code)) && chart.drawsWith?.({ variant: "horizontal" }, "design-waterfall-horizontal") !== !1 && found.push(advice(
973
+ chart,
974
+ "design-waterfall-horizontal",
975
+ "/options/variant",
976
+ "set options.variant to horizontal; the names then read in a column left of the bars",
977
+ [{ op: "replace", path: "/options/variant", value: "horizontal" }]
978
+ )), found;
979
+ }
980
+
981
+ // src/cli/spec.ts
982
+ import { readFileSync as readFileSync2, realpathSync } from "fs";
983
+ import { resolve as resolve3 } from "path";
984
+ import { isatty } from "tty";
985
+ import { isDeepStrictEqual } from "util";
986
+
987
+ // src/core/lint/honesty.ts
988
+ var ISO_PERIOD = /^\d{4}-(?:\d{2}(?:-\d{2})?|Q[1-4]|W\d{2})$/;
989
+ function cellAt(series, categoryId, index) {
990
+ let values = Array.isArray(series.values) ? series.values : [], isKeyed = (entry) => entry !== null && typeof entry == "object" && "categoryId" in entry;
991
+ if (!values.some(isKeyed)) return cellNumber(values[index]);
992
+ let keyed = values.find((entry) => isKeyed(entry) && entry.categoryId === categoryId);
993
+ return keyed === void 0 ? null : cellNumber(keyed.value);
994
+ }
995
+ var PARTIAL_PERIOD = /\b(?:YTD|H1|Q1\s*[\u2013\u2014-]\s*3)\b/i, FULL_PERIOD = /\b(?:FY(?:\s*(?:20)?\d{2})?|20\d{2})\b/i, BASIS_CHANGE = /\b(?:restated|pro\s+forma|adjusted|rebased)\b/i;
996
+ function runHonestyLints(charts) {
997
+ let warnings = [];
998
+ for (let chart of charts) {
999
+ let labels = comparisonLabels(chart), hasPartial = labels.some((label) => PARTIAL_PERIOD.test(label)), hasFull = labels.some((label) => !PARTIAL_PERIOD.test(label) && FULL_PERIOD.test(label));
1000
+ hasPartial && hasFull && !hasAuthoredFootnote(chart) && warnings.push(
1001
+ warning(
1002
+ chart,
1003
+ "partial-period-pairing",
1004
+ "warn",
1005
+ "partial period compared to full period - footnote the basis or align periods",
1006
+ "add an explanatory footnote or compare like-for-like periods"
1007
+ )
1008
+ );
1009
+ }
1010
+ for (let chart of charts) {
1011
+ if (hasAuthoredFootnote(chart)) continue;
1012
+ let changed = seriesOf(chart).filter((series) => BASIS_CHANGE.test(labelOf(series) ?? ""));
1013
+ changed.length > 0 && warnings.push(
1014
+ warning(
1015
+ chart,
1016
+ "basis-change",
1017
+ "warn",
1018
+ `series '${changed.map((series) => labelOf(series)).join("', '")}' changes the comparison basis without a footnote`,
1019
+ "footnote what was restated, pro forma, adjusted, or rebased",
1020
+ changed.length === 1 && typeof changed[0].id == "string" ? { seriesId: changed[0].id } : void 0
1021
+ )
1022
+ );
1023
+ }
1024
+ for (let chart of charts) {
1025
+ let options = chart.options ?? {};
1026
+ if (chart.type !== "column" && chart.type !== "bar" || options.variant !== "stacked" && options.variant !== "stacked100")
1027
+ continue;
1028
+ let unitOf = (series) => typeof series.unit == "string" ? series.unit : typeof options.unit == "string" ? options.unit : "", stacked = seriesOf(chart).filter((series) => series.role !== "reference");
1029
+ if (options.sharesOfOneWhole === !0) {
1030
+ let over = categoriesOf(chart).filter((category, index) => stacked.reduce((sum, series) => sum + (cellAt(series, category.id, index) ?? 0), 0) > 100.5);
1031
+ over.length > 0 && warnings.push(
1032
+ warning(
1033
+ chart,
1034
+ "non-additive-stack",
1035
+ "warn",
1036
+ `series declared sharesOfOneWhole add to more than 100 in '${over.map((category) => labelOf(category)).join("', '")}' - shares of one whole cannot`,
1037
+ "check the shares, or remove sharesOfOneWhole if they are shares of different wholes",
1038
+ over.length === 1 && typeof over[0].id == "string" ? { categoryId: over[0].id } : void 0
1039
+ )
1040
+ );
1041
+ continue;
1042
+ }
1043
+ let offending = stacked.filter((series) => statedInPercent(
1044
+ labelOf(series) ?? "",
1045
+ unitOf(series),
1046
+ cellsOfSeries(series).some((cell) => cell !== null && typeof cell == "object" && "pct" in cell)
1047
+ ));
1048
+ if (offending.length === 0) continue;
1049
+ let dataKind = asRecord(chart.data).valueKind, pctCells = (series) => cellsOfSeries(series).some((cell) => cell !== null && typeof cell == "object" && "pct" in cell), fraction = (series) => (series.valueKind ?? dataKind) === "fraction", sumsIn = (scale) => categoriesOf(chart).map((category, index) => stacked.reduce((sum, series) => {
1050
+ let cell = cellAt(series, category.id, index);
1051
+ return sum === null || cell === null ? null : sum + cell * scale(series);
1052
+ }, 0)), addsTo100 = (sums) => sums.length > 0 && sums.every((sum) => sum !== null && Math.abs(sum - 100) <= 0.5 * stacked.length), weights = options.variant === "stacked100" && !stacked.some((series) => pctCells(series) || fraction(series));
1053
+ addsTo100(sumsIn((series) => fraction(series) ? 100 : 1)) || weights && addsTo100(sumsIn(() => 100)) || warnings.push(
1054
+ warning(
1055
+ chart,
1056
+ "non-additive-stack",
1057
+ "warn",
1058
+ `non-additive series '${offending.map((series) => labelOf(series)).join("', '")}' is stacked - percentages do not stack unless they are shares of one whole (options.sharesOfOneWhole)`,
1059
+ "use grouped columns/bars or a line instead, or set sharesOfOneWhole: true when every series is a share of the same whole",
1060
+ offending.length === 1 && typeof offending[0].id == "string" ? { seriesId: offending[0].id } : void 0
1061
+ )
1062
+ );
1063
+ }
1064
+ for (let chart of charts) {
1065
+ let counts = /* @__PURE__ */ new Map(), datesByLabel = /* @__PURE__ */ new Map(), categories = categoriesOf(chart), data = asRecord(chart.data), periods = chart.type === "grid" && asRecord(chart.options).stack && Array.isArray(data.measures) ? records(data.periods) : [];
1066
+ for (let [index, category] of categories.entries()) {
1067
+ let period = periods.find((p) => {
1068
+ let from = categories.findIndex((c) => c.id === p.from), to = categories.findIndex((c) => c.id === p.to);
1069
+ return from >= 0 && index >= from && index <= to;
1070
+ }), label = period ? `${String(period.label)} / ${labelOf(category)}` : labelOf(category);
1071
+ if (label !== null && label.trim() !== "") {
1072
+ counts.set(label, (counts.get(label) ?? 0) + 1);
1073
+ let date = typeof category.date == "string" ? category.date : typeof category.id == "string" && ISO_PERIOD.test(category.id) ? category.id : void 0, dates = datesByLabel.get(label) ?? [];
1074
+ dates.push(date), datesByLabel.set(label, dates);
1075
+ }
1076
+ }
1077
+ let duplicates = [...counts].filter(([label, count]) => {
1078
+ if (count < 2) return !1;
1079
+ let dates = datesByLabel.get(label);
1080
+ return !(dates.every((date) => date !== void 0) && new Set(dates).size === dates.length);
1081
+ }).map(([label]) => label);
1082
+ duplicates.length > 0 && warnings.push(
1083
+ warning(
1084
+ chart,
1085
+ "duplicate-category-labels",
1086
+ "warn",
1087
+ `duplicate category label${duplicates.length === 1 ? "" : "s"}: ${duplicates.join(", ")}`,
1088
+ "use unique category labels and check for copy-paste artifacts"
1089
+ )
1090
+ );
1091
+ }
1092
+ for (let chart of charts) {
1093
+ let offending = formatValuePairs(chart).find(
1094
+ // A format the schema refused already has its finding; it judges nothing here.
1095
+ ({ format, value }) => Math.abs(value) >= 1e3 && !formatExampleProblem(format) && parseFormatExample(format).decimals >= 3 && parseFormatExample(format).significantDigits === void 0
1096
+ );
1097
+ offending && warnings.push(
1098
+ warning(
1099
+ chart,
1100
+ "spurious-precision",
1101
+ "warn",
1102
+ `format example '${offending.format}' shows at least 3 decimals for values at or above 1000`,
1103
+ "round large values to a decision-useful precision"
1104
+ )
1105
+ );
1106
+ }
1107
+ return warnings;
1108
+ }
1109
+ function comparisonLabels(chart) {
1110
+ return chart.type === "table" ? records(chart.data?.columns).map(labelOf).filter((label) => label !== null) : seriesOf(chart).map(labelOf).filter((label) => label !== null);
1111
+ }
1112
+
1113
+ // src/core/lint/partner.ts
1114
+ function runPartnerLints(charts) {
1115
+ let warnings = [];
1116
+ for (let chart of charts) {
1117
+ if (!chart.requireMessageTitle || chart.type === "kpi") continue;
1118
+ let title = chartOptions(chart).title;
1119
+ title !== !1 && (typeof title != "string" || title.trim() === "" || isGenericTitle(title, [chart.type, chart.authoredType, chart.typeTitle])) && warnings.push(
1120
+ warning(
1121
+ chart,
1122
+ "missing-message-title",
1123
+ "advice",
1124
+ "consulting titles carry the message; this title is missing or generic",
1125
+ "state the decision-relevant takeaway in options.title"
1126
+ )
1127
+ );
1128
+ }
1129
+ for (let chart of charts) {
1130
+ let options = chartOptions(chart);
1131
+ if (!(chart.type === "line" && options.variant !== "bump" || chart.type === "column" && (options.variant === void 0 || options.variant === "grouped"))) continue;
1132
+ let series = seriesOf(chart).filter((item) => item.role !== "reference");
1133
+ series.length > 6 && warnings.push(
1134
+ warning(
1135
+ chart,
1136
+ "series-overload",
1137
+ "advice",
1138
+ `${series.length} data series exceed the 6-series readability limit`,
1139
+ "show the top series or facet the comparison"
1140
+ )
1141
+ );
1142
+ }
1143
+ for (let chart of charts) {
1144
+ if (chart.type !== "column") continue;
1145
+ let options = chartOptions(chart), labels = isRecord(options.labels) ? options.labels : {}, valueAxis = isRecord(options.valueAxis) ? options.valueAxis : {}, series = seriesOf(chart), pyReferences = series.filter(
1146
+ (item) => item.role === "reference" && typeof item.scenario == "string" && item.scenario.toUpperCase() === "PY"
1147
+ );
1148
+ if (!(options.variant === "stacked" && valueAxis.percent !== !0 && (options.referenceStyle === void 0 || options.referenceStyle === "tick") && options.grandTotalLabels !== !1 && options.labels !== !1 && labels.grandTotal !== !1 && labels.annotation !== !1 && labels.tick !== !1 && pyReferences.length === 1)) continue;
1149
+ let periods = categoriesOf(chart).length, components = series.filter((item) => item.role !== "reference").length;
1150
+ periods <= 6 && components <= 4 || warnings.push(
1151
+ warning(
1152
+ chart,
1153
+ "integrated-stacked-variance-overload",
1154
+ "info",
1155
+ `integrated stacked variance has ${periods} periods and ${components} components; the readable maximum is 6 periods and 4 components`,
1156
+ "reduce periods/components or use the explicit dual-tier relative-variance grid"
1157
+ )
1158
+ );
1159
+ }
1160
+ for (let chart of charts) {
1161
+ if (chart.type !== "pie") continue;
1162
+ let categories = categoriesOf(chart), options = chartOptions(chart), topN = typeof options.topN == "object" && options.topN !== null ? options.topN : { n: 5, rest: !0 }, n = typeof topN.n == "number" && topN.n > 0 ? Math.floor(topN.n) : null, effectiveCount = categories.length, isOthers = (s) => /^others?$/i.test((s ?? "").trim()), hasOthers = categories.some(
1163
+ (category) => isOthers(labelOf(category)) || typeof category.id == "string" && isOthers(category.id)
1164
+ );
1165
+ n !== null && categories.length > n && (effectiveCount = topN.rest === !1 ? n : n + 1, topN.rest !== !1 && (hasOthers = !0)), effectiveCount > 6 && !hasOthers && warnings.push(
1166
+ warning(
1167
+ chart,
1168
+ "pie-too-many-slices",
1169
+ "advice",
1170
+ `${effectiveCount} pie slices without an 'Others' slice exceed the 6-slice readability limit`,
1171
+ "aggregate small slices into 'Others' or switch to a bar chart"
1172
+ )
1173
+ );
1174
+ }
1175
+ for (let chart of charts) {
1176
+ let options = chartOptions(chart), legend = options.legend;
1177
+ if (chart.type === "pie" || legend === "auto" || !legendEnabled(legend)) continue;
1178
+ let series = seriesOf(chart);
1179
+ if (series.length === 1 && !(chart.type === "line" && lineDirectlyNamesSeries(options, series[0], categoriesOf(chart), 1))) {
1180
+ warnings.push(
1181
+ warning(
1182
+ chart,
1183
+ "legend-redundant",
1184
+ "advice",
1185
+ "a forced legend repeats the only series",
1186
+ "turn the legend off and label the series directly",
1187
+ typeof series[0].id == "string" ? { seriesId: series[0].id } : void 0
1188
+ )
1189
+ );
1190
+ continue;
1223
1191
  }
1224
- };
1225
- }
1226
- function valuesInOrder(series, categories) {
1227
- let entries = Array.isArray(series.values) ? series.values : [], keyed = entries.length > 0 && entries.every((entry) => isRecord(entry) && "categoryId" in entry);
1228
- return categories.map((category, index) => {
1229
- let entry = keyed ? entries.find((candidate) => isRecord(candidate) && candidate.categoryId === category.id) : entries[index];
1230
- return cellNumber(isRecord(entry) && "categoryId" in entry ? entry.value : entry);
1231
- });
1232
- }
1233
- function largestFirst(values) {
1234
- return values.every((value, index) => index === 0 || value <= values[index - 1]);
1235
- }
1236
- function rankable(categories) {
1237
- return categories.every((category) => {
1238
- let name = labelOf(category) ?? "";
1239
- return category.date === void 0 && !category.gapAfter && !category.breakAfter && !ORDERED_NAME.test(name) && !PINNED_NAME.test(name.trim());
1240
- });
1241
- }
1242
- function drawnBars(chart) {
1243
- let ids = /* @__PURE__ */ new Set();
1244
- for (let node2 of chart.geometry?.scene ?? [])
1245
- node2.t === "rect" && node2.part === "bar" && node2.owner.categoryId && ids.add(node2.owner.categoryId);
1246
- return ids.size || void 0;
1247
- }
1248
- function barAdvice(chart) {
1249
- let options = chartOptions(chart), variant = options.variant ?? "grouped";
1250
- if (variant === "tornado" || variant === "football-field") return [];
1251
- let categories = categoriesOf(chart), found = [], dataSeries = seriesOf(chart).filter((series) => series.role !== "reference");
1252
- if (!rankable(categories)) return [];
1253
- if (variant === "grouped" && options.sort === void 0 && options.topN === void 0 && dataSeries.length === 1 && categories.length >= 5 && categories.length <= BARS_MAX) {
1254
- let values = valuesInOrder(dataSeries[0], categories);
1255
- values.every((value) => value !== null) && !largestFirst(values) && found.push(advice(
1256
- chart,
1257
- "design-bar-sort",
1258
- "/options/sort",
1259
- "set options.sort.categories to desc",
1260
- [{ op: "replace", path: "/options/sort", value: { categories: "desc" } }]
1261
- ));
1192
+ let dataSeries = series.filter((item) => item.role !== "reference"), categories = categoriesOf(chart);
1193
+ chart.type === "line" && dataSeries.length === series.length && dataSeries.length > 0 && dataSeries.every((item) => lineDirectlyNamesSeries(options, item, categories, dataSeries.length)) && warnings.push(
1194
+ { ...warning(
1195
+ chart,
1196
+ "legend-redundant",
1197
+ "advice",
1198
+ `options.legend repeats series names requested by ${options.seriesLabels !== void 0 ? "options.seriesLabels" : "options.labels (or its default)"}`,
1199
+ "remove options.legend to use the direct names without the repeated key"
1200
+ ), fix: [{ op: "remove", path: `${chart.path ?? ""}/options/legend` }] }
1201
+ );
1262
1202
  }
1263
- let topN = isRecord(options.topN) && typeof options.topN.n == "number" ? options.topN : void 0, cut = topN && categories.length > topN.n ? topN.n + (topN.rest === !1 ? 0 : 1) : categories.length, drawn2 = drawnBars(chart) ?? cut;
1264
- if (drawn2 > BARS_MAX) {
1265
- let fix = isRecord(options.topN) ? [{ op: "replace", path: "/options/topN/n", value: BARS_KEPT }] : [{ op: "replace", path: "/options/topN", value: { n: BARS_KEPT, rest: !0 } }];
1266
- found.push(advice(chart, "design-bar-many", "/options/topN", `keep the top ${BARS_KEPT} with options.topN and fold the rest into Others`, fix, `${drawn2} bars drawn`));
1203
+ if (!charts.some(hasFormatOrUnit)) {
1204
+ let chart = charts.find((candidate) => numericDataValues(candidate).some((value) => Math.abs(value) >= 1e3));
1205
+ chart && warnings.push(
1206
+ warning(
1207
+ chart,
1208
+ "unlabeled-units",
1209
+ "warn",
1210
+ "values at or above 1000 have no format or unit anywhere in the document; readers must not guess magnitudes",
1211
+ "declare options.unit or a format-by-example"
1212
+ )
1213
+ );
1267
1214
  }
1268
- return found;
1215
+ for (let chart of charts) {
1216
+ if (!["column", "bar", "combo", "line", "dot", "scatter"].includes(chart.type)) continue;
1217
+ let options = chartOptions(chart), scatterGroups = chart.type === "scatter" ? scatterGroupIdentities(chart.data, chart.geometry, chart.geometryPrefix) : void 0;
1218
+ if (chart.geometry) {
1219
+ let geometry = chart.geometry, prefix = chart.geometryPrefix ?? "", drawn2 = scatterGroups ? scatterGroups.map((group) => ({ ...group })) : seriesOf(chart).filter((s) => geometry.scene.some((node2) => node2.t !== "text" && node2.part !== "swatch" && (node2.owner.seriesId === prefix + s.id || node2.owner.seriesId === s.id && node2.id.startsWith(prefix)))), unnamed = drawn2.filter((s) => {
1220
+ let group = scatterGroups?.find((group2) => group2.id === s.id);
1221
+ return group ? !scatterGroupNameIsDrawn(geometry, group, prefix) : !nameIsDrawn(geometry, labelOf(s) ?? "", prefix + s.id);
1222
+ });
1223
+ (drawn2.length > 1 && unnamed.length > 0 || unnamed.some((s) => s.role === "reference")) && warnings.push(warning(
1224
+ chart,
1225
+ "series-unexplained",
1226
+ "warn",
1227
+ `Drawn series ${unnamed.map((s) => labelOf(s)).join(", ")} have no visible name`,
1228
+ "set options.legend to top, or show a direct label for each series"
1229
+ ));
1230
+ continue;
1231
+ }
1232
+ if (legendEnabled(options.legend) || legendEnabled(chart.parentLegend) || drawsRequiredKey(chart) || options.variant === "tornado") continue;
1233
+ let series = scatterGroups ? scatterGroups.map((group) => ({ ...group })) : seriesOf(chart), categories = categoriesOf(chart), dataSeries = series.filter((s) => s.role !== "reference").filter((s) => chart.type !== "line" || lineSeriesRenders(options, s, categories)), refSeries = series.filter((s) => s.role === "reference").filter((s) => chart.type !== "line" || effectiveLineValues(options, s, categories).filter((v) => v !== null).length >= 2), rawSubtitle = JSON.stringify(options.subtitle ?? ""), canonicalScenario = (v) => {
1234
+ if (typeof v != "string") return null;
1235
+ let u = v.toUpperCase();
1236
+ return u === "FCST" ? "FC" : u === "BUD" ? "PL" : u;
1237
+ }, scenarioIdentified = (s) => {
1238
+ let code = canonicalScenario(s.scenario);
1239
+ return code === null ? !1 : code === "FC" || code === "PL" ? !0 : new RegExp(`\\b${code}\\b`).test(rawSubtitle);
1240
+ }, endpointLabeled = (s) => {
1241
+ if (chart.type === "line") {
1242
+ let names2 = lineLabelModes(options, lineVariantOf(options), dataSeries.length).series;
1243
+ return names2 === "key" || names2 === "none" && dataSeries.length >= 2 && (options.legend === void 0 || options.legend === "auto") || lineDirectlyNamesSeries(options, s, categories, dataSeries.length);
1244
+ }
1245
+ if (chart.type === "combo")
1246
+ return (s.kind === "line" || s.kind === "area") && kindKeepsSeriesNames(options, "point", !1);
1247
+ if (chart.type === "column" && (options.variant === "stacked" || options.variant === "stacked100")) {
1248
+ let seriesLabels = options.seriesLabels;
1249
+ return seriesLabels === void 0 ? !1 : !Array.isArray(seriesLabels.only) || seriesLabels.only.includes(s.id);
1250
+ }
1251
+ return !1;
1252
+ }, scenarioCount = /* @__PURE__ */ new Map();
1253
+ for (let s of dataSeries) scenarioCount.set(canonicalScenario(s.scenario), (scenarioCount.get(canonicalScenario(s.scenario)) ?? 0) + 1);
1254
+ let identified = (s) => endpointLabeled(s) || scenarioIdentified(s) && scenarioCount.get(canonicalScenario(s.scenario)) === 1, unidentifiedData = dataSeries.filter((s) => !identified(s)), unexplainedRefs = refSeries.filter((s) => !scenarioIdentified(s)), ambiguousData = unidentifiedData.length >= 2 ? unidentifiedData : [];
1255
+ if (ambiguousData.length === 0 && unexplainedRefs.length === 0) continue;
1256
+ let subject = ambiguousData.length ? `${ambiguousData.length} series${unexplainedRefs.length ? " and a reference marker" : ""} are visually distinguished but never identified` : "a reference marker is drawn as a bare stroke with nothing naming it", isGridPanel = chart.displayName.includes("/");
1257
+ warnings.push(
1258
+ warning(
1259
+ chart,
1260
+ "series-unexplained",
1261
+ "warn",
1262
+ `${subject} \u2014 no legend, no direct labels`,
1263
+ isGridPanel ? "enable legend on the grid options (one exhibit-level legend) or on this panel, or show direct series names" : "enable options.legend, or show direct series names"
1264
+ )
1265
+ );
1266
+ }
1267
+ for (let chart of charts) {
1268
+ let scenarios = scenarioCodes(chart);
1269
+ if (chart.geometry) {
1270
+ let names2 = { AC: "actual", PY: "prior year", PL: "plan", FC: "forecast" }, geometry = chart.geometry, missing = [...scenarios].filter((code) => nameIsDrawn(geometry, code) || nameIsDrawn(geometry, names2[code] ?? code) || geometry.scene.some((node2) => (node2.part === "subtitle" || node2.part === "footnote") && (textNames(node2, code) || textNames(node2, names2[code] ?? code))) ? !1 : !seriesOf(chart).some((series) => {
1271
+ let scenario = typeof series.scenario == "string" ? series.scenario.toUpperCase() : "";
1272
+ if (scenario !== code && scenario !== (code === "PL" ? "BUD" : "FCST")) return !1;
1273
+ let ids = [series.id, `${chart.geometryPrefix ?? ""}${series.id}`];
1274
+ return geometry.scene.some((node2) => node2.part === "legendLabel" && ids.includes(node2.owner.seriesId) && textNames(node2, labelOf(series) ?? "")) && geometry.scene.some((node2) => node2.part === "swatch" && ids.includes(node2.owner.seriesId));
1275
+ }));
1276
+ missing.length > 0 && warnings.push(warning(
1277
+ chart,
1278
+ "scenario-unexplained",
1279
+ "info",
1280
+ `${missing.join("/")} scenario styling has no visible explanation`,
1281
+ "name the scenario in the key, subtitle or footnote"
1282
+ ));
1283
+ continue;
1284
+ }
1285
+ let legendOff = !legendEnabled(chartOptions(chart).legend) && !legendEnabled(chart.parentLegend) && !drawsRequiredKey(chart), subtitle = JSON.stringify(chartOptions(chart).subtitle ?? ""), subtitleExplains = scenarios.size > 0 && [...scenarios].every((code) => subtitle.includes(code));
1286
+ scenarios.size > 0 && legendOff && !subtitleExplains && !hasAuthoredFootnote(chart) && warnings.push(
1287
+ warning(
1288
+ chart,
1289
+ "scenario-unexplained",
1290
+ "info",
1291
+ `${[...scenarios].sort().join("/")} scenario styling is used with no legend or explanatory footnote`,
1292
+ "enable the legend or explain the scenario abbreviation in a footnote"
1293
+ )
1294
+ );
1295
+ }
1296
+ return warnings;
1269
1297
  }
1270
- function legendPosition(legend) {
1271
- return isRecord(legend) ? legend.position : legend;
1298
+ function drawsRequiredKey(chart) {
1299
+ return chart.displayName.includes("/") ? chart.parentLegend === "none" : chart.type === "waterfall" || chart.type === "variance" && chartOptions(chart).variant === "integrated";
1272
1300
  }
1273
- function between(count, low, high) {
1274
- return count >= low && count <= high;
1301
+ function kindKeepsSeriesNames(options, kind, namesByDefault = !0) {
1302
+ let labels = options.labels;
1303
+ if (labels === !1) return !1;
1304
+ if (typeof labels != "object" || labels === null) return namesByDefault;
1305
+ let value = labels[kind];
1306
+ return value === !1 ? !1 : Array.isArray(value) ? value.includes("series") : namesByDefault;
1275
1307
  }
1276
- function drawnLines(chart) {
1277
- let ids = /* @__PURE__ */ new Set();
1278
- for (let node2 of chart.geometry?.scene ?? [])
1279
- node2.t === "path" && node2.part === "line" && node2.owner.seriesId && ids.add(node2.owner.seriesId);
1280
- return ids.size || void 0;
1308
+ function lineVariantOf(options) {
1309
+ let variant = (isRecord(options.valueAxis) ? options.valueAxis : {}).percent === !0 ? "stacked100-area" : options.variant;
1310
+ return variant === "area" || variant === "stacked-area" || variant === "stacked100-area" || variant === "bump" ? variant : "line";
1281
1311
  }
1282
- function drawnPeriods(chart, options) {
1283
- let live = chart.geometry?.derived?.liveWindow;
1284
- if (Array.isArray(live?.displayedCategoryIds)) return live.displayedCategoryIds.length;
1285
- let categories = categoriesOf(chart), zoom = isRecord(options.viewDomain) && Array.isArray(options.viewDomain.x) ? options.viewDomain.x : void 0;
1286
- if (zoom) {
1287
- let [from, to] = zoom.map((id) => categories.findIndex((category) => category.id === id));
1288
- if (from !== void 0 && to !== void 0 && from >= 0 && to >= 0) return Math.abs(to - from) + 1;
1289
- }
1290
- return categories.length;
1312
+ function lineDirectlyNamesSeries(options, series, categories, count) {
1313
+ if (!effectiveLineValues(options, series, categories).some((value) => value !== null)) return !1;
1314
+ let modes = lineLabelModes(options, lineVariantOf(options), count);
1315
+ return (modes.series === "end" || modes.series === "inline") && (modes.only === void 0 || modes.only.has(series.id)) ? !0 : modes.values !== "none" && kindKeepsSeriesNames(options, "point", !1);
1291
1316
  }
1292
- function lineAdvice(chart) {
1293
- let options = chartOptions(chart), found = [], series = seriesOf(chart), dataSeries = series.filter((item) => item.role !== "reference"), plainLines = (options.variant ?? "line") === "line" && options.fan === void 0 && dataSeries.length === series.length && between(drawnLines(chart) ?? dataSeries.length, 2, LINES_MAX) && dataSeries.every((item) => item.scenario === void 0 || String(item.scenario).toUpperCase().startsWith("AC")), position = legendPosition(options.legend), namedOnLines = options.seriesLabels !== "key" && options.seriesLabels !== "none";
1294
- plainLines && (position === "top" || position === "bottom") && !namedOnLines && chart.drawsWith?.({ legend: "none", seriesLabels: "end" }) !== !1 && found.push(advice(chart, "design-line-direct-labels", "/options/legend", "set options.legend to none and options.seriesLabels to end", [
1295
- { op: "replace", path: "/options/legend", value: "none" },
1296
- { op: "replace", path: "/options/seriesLabels", value: "end" }
1297
- ]));
1298
- let periods = drawnPeriods(chart, options);
1299
- return options.valueLabels === "all" && periods > LABELLED_POINTS_MAX && found.push(advice(
1300
- chart,
1301
- "design-line-label-points",
1302
- "/options/valueLabels",
1303
- "remove options.valueLabels for the default, or set it to last or ends",
1304
- [{ op: "remove", path: "/options/valueLabels" }],
1305
- `${periods} periods drawn`
1306
- )), found;
1317
+ function lineSeriesRenders(options, series, categories) {
1318
+ let variant = (isRecord(options.valueAxis) ? options.valueAxis : {}).percent === !0 ? "stacked100-area" : options.variant ?? "line";
1319
+ return variant === "stacked-area" || variant === "stacked100-area" ? categories.length >= 2 : effectiveLineValues(options, series, categories).some((value) => value !== null);
1307
1320
  }
1308
- function waterfallAdvice(chart) {
1309
- let options = chartOptions(chart), items = records(isRecord(chart.data) ? chart.data.items : void 0), found = [], last = items.at(-1);
1310
- if (items.length >= 2 && last && last.type !== "total" && last.type !== "subtotal") {
1311
- let ids = new Set(items.map((item) => item.id)), id = "total";
1312
- for (let suffix = 2; ids.has(id); suffix++) id = `total-${suffix}`;
1313
- found.push(advice(
1314
- chart,
1315
- "design-waterfall-closing-total",
1316
- "/data/items",
1317
- "add a last item with type total (with rows, a last row whose type is total); Boardplot sums the steps",
1318
- [{ op: "add", path: "/data/items/-", value: { id, label: "Total", type: "total" } }]
1319
- ));
1320
- }
1321
- return options.variant !== "horizontal" && chart.geometry.warnings.some((warning2) => CROWDED_NAMES.has(warning2.code)) && chart.drawsWith?.({ variant: "horizontal" }) !== !1 && found.push(advice(
1322
- chart,
1323
- "design-waterfall-horizontal",
1324
- "/options/variant",
1325
- "set options.variant to horizontal; the names then read in a column left of the bars",
1326
- [{ op: "replace", path: "/options/variant", value: "horizontal" }]
1327
- )), found;
1321
+ function effectiveLineValues(options, series, categories) {
1322
+ let entries = Array.isArray(series.values) ? series.values : [], pointKeyed = entries.length > 0 && entries.every((entry) => isRecord(entry) && "categoryId" in entry), values = categories.map((category, index) => {
1323
+ let entry = pointKeyed ? entries.find((candidate) => isRecord(candidate) && candidate.categoryId === category.id) : entries[index];
1324
+ return cellNumber(isRecord(entry) && "value" in entry ? entry.value : entry);
1325
+ }), rebase = options.rebase100;
1326
+ if (rebase === void 0 || rebase === !1) return values;
1327
+ let at = isRecord(rebase) && typeof rebase.at == "string" ? rebase.at : categories[0]?.id, baseIndex = categories.findIndex((category) => category.id === at);
1328
+ if (baseIndex < 0) return values;
1329
+ let base = values[baseIndex] ?? null;
1330
+ return base === null || base <= 0 ? values.map(() => null) : values;
1331
+ }
1332
+ function isGenericTitle(title, typeNames) {
1333
+ let normalized = title.trim().toLowerCase();
1334
+ return /^(?:chart|figure|untitled)\b/.test(normalized) ? !0 : typeNames.some((typeName) => {
1335
+ if (!typeName) return !1;
1336
+ let exact = typeName.trim().toLowerCase();
1337
+ if (normalized === exact) return !0;
1338
+ let escapedType = exact.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1339
+ return new RegExp(
1340
+ `^${escapedType}(?:(?:\\s+(?:chart|plot|figure|card|\\d+))|(?:\\s*\\([^)]*\\))|(?:\\s*/\\s*[a-z0-9 /()-]+))?$`,
1341
+ "i"
1342
+ ).test(normalized);
1343
+ });
1328
1344
  }
1329
1345
 
1330
1346
  // src/core/lint/index.ts
@@ -1455,7 +1471,7 @@ function aspectDocLints(type, options, geo, verify) {
1455
1471
  if (!cls) return [];
1456
1472
  if (contentSized(type, options, geo.sizing?.fit)) return [];
1457
1473
  if (hostSlot(options)) return [];
1458
- let warnings = [], { width, height } = geo.size, canvas = `${width}x${height}`, ratio = width / height, rowDriven = cls === "row-driven" || cls === "matrix" || type === "bullet", fixedRows = (type === "bar" || type === "likert") && resolveTheme(options?.theme).space.barRow !== void 0, flatCapRatio = cls === "strip" ? ASPECT_CAPS.flatAbsolute : ASPECT_CAPS.flatNonStrip, flatMinHeight = Math.round(width / flatCapRatio), tallMaxHeight = Math.round(width / ASPECT_CAPS.tall), minHeight = geo.sizing?.minHeight ?? 0, unverified = "Call measure for a verified size, widen the chart, or leave the height out.", steps = legalSteps(cls).map((step) => Math.round(width / step.ratio)), candidates2 = (keeps) => [...new Set(steps)].filter((h) => h !== height && h >= minHeight && keeps(h)).sort((a, b) => Math.abs(a - height) - Math.abs(b - height) || a - b), patch = (keeps) => {
1474
+ let warnings = [], { width, height } = geo.size, canvas = `${width}x${height}`, ratio = width / height, rowDriven = cls === "row-driven" || cls === "matrix" || type === "bullet", flatCapRatio = cls === "strip" ? ASPECT_CAPS.flatAbsolute : ASPECT_CAPS.flatNonStrip, flatMinHeight = Math.round(width / flatCapRatio), tallMaxHeight = Math.round(width / ASPECT_CAPS.tall), minHeight = geo.sizing?.minHeight ?? 0, unverified = "Call measure for a verified size, widen the chart, or leave the height out.", steps = legalSteps(cls).map((step) => Math.round(width / step.ratio)), candidates2 = (keeps) => [...new Set(steps)].filter((h) => h !== height && h >= minHeight && keeps(h)).sort((a, b) => Math.abs(a - height) - Math.abs(b - height) || a - b), patch = (keeps) => {
1459
1475
  let verified = verify?.(width, candidates2(keeps));
1460
1476
  return verified === void 0 ? void 0 : { height: verified, fix: [{ op: "replace", path: "/options/size", value: { width, height: verified } }] };
1461
1477
  }, automaticTall = height > tallMaxHeight && heightOmitted(options?.size);
@@ -1480,25 +1496,16 @@ function aspectDocLints(type, options, geo, verify) {
1480
1496
  ...lowered ? { fix: lowered.fix } : {}
1481
1497
  });
1482
1498
  }
1483
- if (onLadderStep(geo.size) === null && !automaticTall && !heightOmitted(options?.size)) {
1484
- let nearest = nearestLadderStep(geo.size);
1485
- if (rowDriven)
1486
- warnings.push({
1487
- code: "height-off-ladder:row-driven",
1488
- severity: "info",
1489
- message: `'${type}' canvas ${canvas} is off the standard height steps. ${fixedRows ? "The theme fixes the row pitch, and the authored height only adds space under the rows" : type === "table" ? "A table takes its height from its rows, and the authored height only adds space under them" : "This type takes its natural height from its rows, and the authored height stretches them to fill the canvas"}, so this is an observation only. The nearest step is ${nearest.name} at ${width}x${nearest.height}.`
1490
- });
1491
- else {
1492
- let snapped = patch(() => !0);
1493
- warnings.push({
1494
- code: "height-off-ladder",
1495
- severity: "warn",
1496
- message: `'${type}' canvas ${canvas} is off the standard height steps for width ${width}. The nearest step is ${nearest.name} at ${width}x${nearest.height}.`,
1497
- suggest: snapped ? `Use height ${snapped.height}px at width ${width}.` : unverified,
1498
- field: ["options", "size"],
1499
- ...snapped ? { fix: snapped.fix } : {}
1500
- });
1501
- }
1499
+ if (!rowDriven && onLadderStep(geo.size) === null && !automaticTall && !heightOmitted(options?.size)) {
1500
+ let nearest = nearestLadderStep(geo.size), snapped = patch(() => !0);
1501
+ warnings.push({
1502
+ code: "height-off-ladder",
1503
+ severity: "advice",
1504
+ message: `Canvas ${canvas} is off the standard height steps; the nearest is ${width}x${nearest.height}.`,
1505
+ suggest: snapped ? `Use height ${snapped.height}px.` : unverified,
1506
+ field: ["options", "size"],
1507
+ ...snapped ? { fix: snapped.fix } : {}
1508
+ });
1502
1509
  }
1503
1510
  let cartesian = cls === "standard-cartesian" || cls === "wide-time", plotW = Math.round(geo.plot.w), plotH = Math.round(geo.plot.h);
1504
1511
  if (cartesian && width >= PLOT_MIN.appliesFromWidth && (plotH < PLOT_MIN.cartesianH || plotW < PLOT_MIN.cartesianW)) {
@@ -1573,6 +1580,215 @@ function lineIntegrityDocLints(type, options, geometry) {
1573
1580
  }), findings;
1574
1581
  }
1575
1582
 
1583
+ // src/core/reading.ts
1584
+ function operationWords(op) {
1585
+ return op.replace(/@\d+$/, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").split(/[-_\s]+/).filter(Boolean).map((word) => word.toLowerCase()).join(" ");
1586
+ }
1587
+ function isDerivation(kind) {
1588
+ return CLAIM_KIND_GROUPS.derivations.includes(kind);
1589
+ }
1590
+ function reportableNumber(record) {
1591
+ return record.state === "value" && typeof record.raw == "number" && Number.isFinite(record.raw) ? record.raw : null;
1592
+ }
1593
+ function explainClaims(claims) {
1594
+ let derivations = claims.filter((claim) => isDerivation(claim.kind)).length, observed = claims.filter((claim) => claim.kind === "observed").length, authored = claims.filter((claim) => claim.kind === "authored").length, states = [...new Set(claims.map((claim) => claim.output.state))].sort(), summary = [
1595
+ `${claims.length} claim ${claims.length === 1 ? "record" : "records"} for this chart: ${derivations} engine ${derivations === 1 ? "derivation" : "derivations"} and ${claims.length - derivations} that ${claims.length - derivations === 1 ? "promises" : "promise"} no arithmetic.`
1596
+ ];
1597
+ if (claims.length - derivations > 0) {
1598
+ let parts = [];
1599
+ observed > 0 && parts.push(`${observed} ${observed === 1 ? "was" : "were"} measured from the source sample`), authored > 0 && parts.push(`${authored} came from the document`), parts.length > 0 && summary.push(`Of the records without arithmetic, ${parts.join(" and ")}.`);
1600
+ }
1601
+ return states.some((state) => state !== "value") && summary.push(`Claim states in this chart: ${states.join(", ")}.`), {
1602
+ total: claims.length,
1603
+ derivations,
1604
+ nonDerivations: claims.length - derivations,
1605
+ observed,
1606
+ authored,
1607
+ states,
1608
+ summary
1609
+ };
1610
+ }
1611
+ function derivedNumbers(claims) {
1612
+ return claims.filter((claim) => isDerivation(claim.kind)).map((claim) => ({
1613
+ claimId: claim.id,
1614
+ ...claim.id.startsWith("stack:") ? { inputs: claim.inputs.map((input) => ({ ...input })) } : {},
1615
+ op: claim.op,
1616
+ operation: operationWords(claim.op),
1617
+ displayed: claim.output.displayed || "Not displayed",
1618
+ ...claim.description ? { description: claim.description } : {},
1619
+ visible: claim.output.displayed.length > 0,
1620
+ ...claim.noteLocation ? { noteLocation: claim.noteLocation } : {},
1621
+ ...claim.drawn === !1 ? { drawn: !1 } : {},
1622
+ value: reportableNumber(claim.output),
1623
+ state: claim.output.state
1624
+ }));
1625
+ }
1626
+ var VALUE_NOTE_LIMIT = 10;
1627
+ function valuesSummary(records2, unavailableNote) {
1628
+ if (records2 === null) {
1629
+ let note = unavailableNote ?? "No interaction record adapter covers this chart type.";
1630
+ return {
1631
+ source: "unavailable",
1632
+ note,
1633
+ total: 0,
1634
+ numbers: 0,
1635
+ byState: {},
1636
+ byKind: {},
1637
+ suppressed: [],
1638
+ withoutNumber: [],
1639
+ summary: [`${note} No per-value description is reported.`]
1640
+ };
1641
+ }
1642
+ let byState = {}, byKind = {}, suppressed = [], withoutNumber = [], numbers = 0;
1643
+ for (let record of records2) {
1644
+ let { state, kind } = record.value;
1645
+ byState[state] = (byState[state] ?? 0) + 1, byKind[kind] = (byKind[kind] ?? 0) + 1, kind === "number" && state === "value" && (numbers += 1);
1646
+ let note = { recordId: record.id, label: record.label, state, reason: record.value.reason ?? null };
1647
+ state === "suppressed" ? suppressed.length < VALUE_NOTE_LIMIT && suppressed.push(note) : state !== "value" && withoutNumber.length < VALUE_NOTE_LIMIT && withoutNumber.push(note);
1648
+ }
1649
+ let textOrDate = (byKind.text ?? 0) + (byKind.date ?? 0), summary = [
1650
+ `The records describe ${records2.length} ${records2.length === 1 ? "value" : "values"}, ${numbers} of them a plain number${textOrDate > 0 ? ` and ${textOrDate} text or date` : ""}.`
1651
+ ], withheld = byState.suppressed ?? 0;
1652
+ withheld > 0 && summary.push(
1653
+ `${withheld} ${withheld === 1 ? "value is" : "values are"} withheld, so no raw number is reported for them.`
1654
+ );
1655
+ let other = Object.entries(byState).filter(([state]) => state !== "value" && state !== "suppressed"), otherCount = other.reduce((sum, [, count]) => sum + count, 0);
1656
+ return otherCount > 0 && summary.push(
1657
+ `${otherCount} ${otherCount === 1 ? "value is" : "values are"} neither present nor withheld: ${other.map(([state]) => state).sort().join(", ")}.`
1658
+ ), { source: "interaction-records", total: records2.length, numbers, byState, byKind, suppressed, withoutNumber, summary };
1659
+ }
1660
+ function chartRecords(input) {
1661
+ try {
1662
+ return {
1663
+ records: interactionRecords({
1664
+ request: input.request,
1665
+ geometry: input.geometry,
1666
+ scope: input.request.scope,
1667
+ claims: input.claims
1668
+ // An event of the event lane or a value line is an annotation, not a value the chart plots.
1669
+ }).filter((record) => record.target.owner.annotationId === void 0)
1670
+ };
1671
+ } catch (error) {
1672
+ return {
1673
+ records: null,
1674
+ note: `No interaction record adapter covers this chart type: ${error instanceof Error ? error.message : String(error)}`
1675
+ };
1676
+ }
1677
+ }
1678
+ function unrequestedLabelOmissions(input, records2, omissions) {
1679
+ let named = new Set(omissions.map((item) => item.labelId)), destinationOf = readableLabelDestination(input.geometry), add = (labelId, text, reason, owner = {}, kind, printedText = text) => {
1680
+ named.has(labelId) || (named.add(labelId), !destinationOf(labelId, printedText, owner, kind, text) && omissions.push({ labelId, text, reason, destination: "reading.omissions" }));
1681
+ }, valueKey = (owner) => JSON.stringify([owner.seriesId, owner.categoryId, owner.pointId]), buildContext = (prefix) => {
1682
+ let scope = omissionScope(input.geometry, input.request.options, `${prefix}point`, input.request.data), data = scope.type && scope.data !== void 0 ? resolveChartRequest({ type: scope.type, data: scope.data, options: scope.options, fontMetrics: input.request.fontMetrics }).data : scope.data ?? {}, labels = scope.geometry.labels, categories = (Array.isArray(data.categories) ? data.categories : []).map(normalizeCategory), seriesById = new Map((Array.isArray(data.series) ? data.series : []).filter((series) => series.values !== void 0).map((series, index) => [series.id, { ...series, values: normalizeSeriesValues(series, categories, index) }])), options = scope.options ?? {}, geometry = scope.geometry, order = geometry.type === "bar" ? geometry.derived.order : void 0, visibleCategories = new Set(order ?? geometry.axes.flatMap((axis) => axis.ticks.filter((tick) => tick.labelId && /(?:^|[:/])category:/.test(tick.labelId)).map((tick) => String(tick.at)))), defaultPieCut = geometry.type === "pie" && categories.length - DEFAULT_TOP_N.n >= DEFAULT_REST_MIN, topN = options.topN ?? (defaultPieCut ? DEFAULT_TOP_N : void 0), topNCut = typeof topN?.n == "number" && topN.n > 0 && (categories.length > topN.n || typeof topN.threshold == "number" && topN.threshold > 0) && !options.window && !options.viewDomain;
1683
+ return {
1684
+ categories,
1685
+ seriesById,
1686
+ geometry,
1687
+ data,
1688
+ options,
1689
+ visibleCategories,
1690
+ topNCut,
1691
+ plottedPoints: new Set((geometry.type === "scatter" ? geometry.marks.points ?? [] : []).map((point) => point.id)),
1692
+ capApplied: geometry.type === "scatter" && geometry.warnings.some((warning2) => warning2.code === "labels-auto-off"),
1693
+ requestedValues: new Set(labels.filter((label) => ["point", "segment", "insidePie", "outsidePie"].includes(label.kind)).map((label) => valueKey(label.owner))),
1694
+ // A drawn annotation that prints its mark's value: that value is labelled, a scatter point's name is not.
1695
+ annotatedValues: new Set(geometry.annotations.filter((placed) => placed.valueOwner && labels.some((label) => label.id === placed.labelId && !label.hidden)).map((placed) => valueKey(placed.valueOwner))),
1696
+ drawnSeries: new Set(labels.filter((label) => label.kind === "series" && !label.hidden).map((label) => label.owner.seriesId)),
1697
+ drawnCategories: new Set(labels.filter((label) => label.kind === "category" && !label.hidden).map((label) => label.owner.categoryId)),
1698
+ keptCategories: new Set(visibleCategories.size ? visibleCategories : labels.map((label) => label.owner.categoryId))
1699
+ };
1700
+ }, contexts = /* @__PURE__ */ new Map();
1701
+ for (let record of records2) {
1702
+ let prefix = record.target.panel ? `${record.target.panel}/` : "", context = contexts.get(prefix);
1703
+ context || (context = buildContext(prefix), contexts.set(prefix, context));
1704
+ let { categories, seriesById, options } = context, settings = options.labels, disabled = (kind) => {
1705
+ let setting = typeof settings == "object" && settings !== null ? settings[kind] : void 0;
1706
+ return settings === !1 || setting === !1 || Array.isArray(setting) && setting.length === 0;
1707
+ }, owner = record.target.owner;
1708
+ if (context.geometry.type === "scatter" && owner.pointId !== void 0 && !context.plottedPoints.has(owner.pointId) || (options.window || options.viewDomain) && owner.categoryId !== void 0 && context.visibleCategories.size && !context.visibleCategories.has(owner.categoryId)) continue;
1709
+ context.keptCategories.add(owner.categoryId);
1710
+ let series = owner.seriesId === void 0 ? void 0 : seriesById.get(owner.seriesId), categoryIndex = categories.findIndex((category) => category.id === owner.categoryId), cell = series?.values[categoryIndex], cellLabel = typeof cell == "object" && cell !== null && "label" in cell ? cell.label : void 0, only = typeof options.seriesLabels == "object" && options.seriesLabels !== null ? options.seriesLabels.only : void 0, excludedSeries = only !== void 0 && owner.seriesId !== void 0 && !only.includes(owner.seriesId), excludedValues = excludedSeries && context.geometry.type === "line", openBin = context.geometry.derived?.binning, hasValueRequest = context.requestedValues.has(valueKey(owner)) || context.geometry.type === "histogram" && openBin?.openAbove !== void 0 && owner.categoryId === JSON.stringify(["bin", openBin.edges.at(-2), openBin.edges.at(-1)]), valueKind = context.geometry.type !== "line" && typeof options.variant == "string" && options.variant.startsWith("stacked") ? "segment" : "point", selectiveValues = typeof options.valueLabels == "string" && options.valueLabels !== "all";
1711
+ if (!hasValueRequest && !context.annotatedValues.has(valueKey(owner)) && owner.categoryId !== void 0 && record.value.state === "value" && (disabled(valueKind) || cellLabel === !1 || excludedValues || selectiveValues)) {
1712
+ let reason = cellLabel === !1 ? "cell-label-disabled" : excludedValues ? "seriesLabels.only" : disabled(valueKind) ? "disabled" : `valueLabels:${options.valueLabels}`, value = typeof cellLabel == "string" ? cellLabel : interactionValueText(record.value, input.request.locale?.language);
1713
+ add(`${prefix}${valueKind}:${owner.seriesId ?? ""}:${owner.categoryId}`, `${record.label} ${value}`, reason, owner, valueKind, value);
1714
+ }
1715
+ context.geometry.type === "scatter" && owner.pointId !== void 0 && !hasValueRequest && (disabled("point") || context.capApplied) && add(`${prefix}point:${owner.pointId}`, record.label, disabled("point") ? "disabled" : "maxPointLabels", owner, "category");
1716
+ let seriesSetting = typeof settings == "object" && settings !== null ? settings.series : void 0;
1717
+ if (owner.seriesId !== void 0 && record.seriesLabel !== void 0 && (disabled("series") || options.seriesLabels === "none" || excludedSeries || Array.isArray(seriesSetting) && !seriesSetting.includes("series")) && !context.drawnSeries.has(owner.seriesId) && add(`${prefix}series:${owner.seriesId}`, record.seriesLabel, disabled("series") ? "disabled" : "seriesLabels", { seriesId: owner.seriesId }, "series"), disabled("category") && owner.categoryId !== void 0 && record.categoryLabel !== void 0 && !context.drawnCategories.has(owner.categoryId) && add(`${prefix}category:${owner.categoryId}`, record.categoryLabel, "disabled", { categoryId: owner.categoryId }, "category"), context.topNCut && owner.categoryId !== void 0 && !categories.some((category) => category.id === owner.categoryId)) for (let member of record.members ?? []) {
1718
+ let category = categories.find((category2) => category2.id === member.categoryId);
1719
+ category && add(`${prefix}category:${category.id}`, category.label ?? category.id, "topN", { categoryId: category.id }, "category");
1720
+ }
1721
+ }
1722
+ for (let [prefix, context] of contexts) if (context.topNCut && (context.geometry.type === "dot" || context.geometry.type === "variance" || context.options.topN?.rest === !1))
1723
+ for (let category of context.categories) context.keptCategories.has(category.id) || add(`${prefix}category:${category.id}`, category.label ?? category.id, "topN", { categoryId: category.id }, "category");
1724
+ for (let [prefix, context] of contexts) {
1725
+ let { options, geometry } = context, settings = typeof options.labels == "object" && options.labels !== null ? options.labels : void 0;
1726
+ if (options.grandTotalLabels === !1 || options.labels === !1 || settings?.grandTotal === !1) {
1727
+ let totals = geometry.derived.stackTotals ?? geometry.derived.totals ?? {};
1728
+ if (["column", "bar", "combo"].includes(geometry.type)) for (let [id, raw] of Object.entries(totals)) {
1729
+ if (!Number.isFinite(raw) || geometry.labels.some((label) => label.id === `grandTotal:${id}`)) continue;
1730
+ let category = context.categories.find((category2) => category2.id === id), value = interactionValueText({
1731
+ kind: "number",
1732
+ state: "value",
1733
+ raw,
1734
+ derived: "number",
1735
+ ...typeof options.unit == "string" ? { unit: options.unit } : {},
1736
+ ...typeof options.format == "string" ? { format: options.format } : {}
1737
+ }, input.request.locale?.language);
1738
+ add(`${prefix}grandTotal:${id}`, `${category?.label ?? id} ${value}`, "disabled", { categoryId: id }, "grandTotal", value);
1739
+ }
1740
+ }
1741
+ if (geometry.type === "sparkline") {
1742
+ let names2 = context.data.labels;
1743
+ if (options.endLabels === "none" && names2?.length) for (let [end, index] of [["first", 0], ["last", names2.length - 1]])
1744
+ add(`${prefix}spark:label:${end}`, names2[index], "endLabels:none", {}, "category");
1745
+ if (options.valueLabel === "none") {
1746
+ let last = records2.filter((record) => (record.target.panel ? `${record.target.panel}/` : "") === prefix && record.value.state === "value").at(-1);
1747
+ if (last) {
1748
+ let value = interactionValueText(last.value, input.request.locale?.language);
1749
+ add(`${prefix}spark:last`, `${last.label} ${value}`, "valueLabel:none", last.target.owner, "point", value);
1750
+ }
1751
+ }
1752
+ }
1753
+ }
1754
+ }
1755
+ function chartReading(input) {
1756
+ let { records: records2, note } = input.records ?? chartRecords(input), title = input.request.options.title, byData = dataOrder(input.request.data, input.geometry.labels), omissions = labelOmissions(input.geometry, input.request.options, input.request.data);
1757
+ unrequestedLabelOmissions(input, records2 ?? [], omissions);
1758
+ let dropped = input.geometry.labels.filter((label) => label.hidden !== void 0).sort((a, b) => byData(a.id, b.id)), labelsDroppedBy = {};
1759
+ for (let label of dropped) {
1760
+ let reason = label.noted ? "note" : label.hidden;
1761
+ labelsDroppedBy[reason] = (labelsDroppedBy[reason] ?? 0) + 1;
1762
+ }
1763
+ let series = [...new Set((records2 ?? []).flatMap((record) => record.seriesLabel === void 0 ? [] : [record.seriesLabel]))], rounding = input.geometry.derived?.roundingAdjustments, source = input.geometry.frame.source, fittedSource = input.geometry.scene.find((node2) => node2.id === input.geometry.frame.sourceNodeId && node2.t === "text"), sourceDrawn = source && (fittedSource?.t === "text" && fittedSource.opacity !== 0 && fittedSource.lines.join(" ").replace(/\s+/g, " ").trim() === plainText(source).replace(/\s+/g, " ").trim() || readableLabelDestination(input.geometry)("frame:source", source, {}, "source"));
1764
+ return {
1765
+ name: input.name,
1766
+ // A column that stepped to bars reads as the bar chart that was drawn.
1767
+ type: drawnRequest({ type: input.type }, input.geometry).type,
1768
+ counts: (input.geometry.a11y.counts ?? []).map((count) => ({ ...count })),
1769
+ title: typeof title == "string" && title.trim() !== "" ? title : null,
1770
+ size: { width: input.geometry.size.width, height: input.geometry.size.height },
1771
+ mode: input.geometry.mode ?? "full",
1772
+ titleLines: input.geometry.frame.titleLines ?? 0,
1773
+ series,
1774
+ labelsPlaced: input.geometry.labels.length - dropped.length,
1775
+ labelsTruncated: cutLabels(input.geometry),
1776
+ labelsDropped: dropped.length,
1777
+ labelsDroppedBy,
1778
+ omissions: [
1779
+ ...omissions.sort((a, b) => byData(a.labelId, b.labelId)),
1780
+ ...input.geometry.derived.omissions ?? [],
1781
+ ...source && !sourceDrawn ? [{ labelId: "frame:source", text: source, reason: fittedSource ? "truncated" : "not-drawn", destination: "frame.source" }] : []
1782
+ ],
1783
+ derived: derivedNumbers(input.claims),
1784
+ ...input.geometry.derived.metricStack ? { metricStack: { readouts: input.geometry.derived.metricStack.readouts } } : {},
1785
+ claims: explainClaims(input.claims),
1786
+ values: valuesSummary(records2, note),
1787
+ notes: chartNotes(input.geometry),
1788
+ ...rounding ? { rounding: rounding.map((adjustment) => ({ ...adjustment })) } : {}
1789
+ };
1790
+ }
1791
+
1576
1792
  // src/cli/size.ts
1577
1793
  function enumArgument(name, value, allowed2, warnings, parent = []) {
1578
1794
  let converted = caseInsensitiveValue(value, allowed2);
@@ -1780,7 +1996,7 @@ function geometryThemeUsage(geometry, theme) {
1780
1996
  role(token.replace(/^status-/, "status.")), token = resolvedPaintToken(theme, token);
1781
1997
  let series2 = /^series-(\d+)$/.exec(token);
1782
1998
  role(series2 ? `series[${seriesColorIndex(theme, Number(series2[1]) - 1)}]` : token.replace(/^status-/, "status."));
1783
- }, visit2 = (value) => {
1999
+ }, visit2 = (value, grounded = !1) => {
1784
2000
  if (!value || typeof value != "object" || visited.has(value)) return;
1785
2001
  visited.add(value);
1786
2002
  let object2 = value;
@@ -1790,8 +2006,12 @@ function geometryThemeUsage(geometry, theme) {
1790
2006
  let palette = typeof object2.palette == "string" ? object2.palette : void 0, ramp = palette === void 0 ? void 0 : theme.color.palettes?.[palette], index = seriesColorIndex(theme, object2.index, ramp);
1791
2007
  roles.add(ramp?.length ? `palettes.${palette}[${index}]` : `series[${index}]`), object2.scenario && roles.add(`scenario.${object2.scenario}`);
1792
2008
  }
1793
- object2.kind === "colorblind" && typeof object2.role == "string" && roles.add(`colorblind.${object2.role}`);
1794
- for (let child of Object.values(object2)) visit2(child);
2009
+ if (object2.kind === "colorblind" && typeof object2.role == "string" && roles.add(`colorblind.${object2.role}`), object2.kind === "table-ink" && typeof object2.role == "string" && !grounded) {
2010
+ roles.add(`table.inks.${object2.role}`);
2011
+ let inks = theme.table?.inks;
2012
+ MUTED_TABLE_INKS.has(object2.role) && inks?.[object2.role] === void 0 && roles.add("table.inks.secondary");
2013
+ }
2014
+ for (let child of Object.values(object2)) visit2(child, grounded || object2.kind === "ground-text");
1795
2015
  }, bindings = sceneThemeBindings(geometry);
1796
2016
  for (let node2 of geometry.scene)
1797
2017
  bindings.some((binding) => node2.id.startsWith(binding.prefix)) || (visited = /* @__PURE__ */ new WeakSet(), seriesId = node2.owner?.seriesId, "fill" in node2 && visit2(node2.fill), "stroke" in node2 && visit2(node2.stroke), node2.t === "text" && visit2(node2.ink), node2.t === "rect" && visit2(node2.hatchGround));
@@ -1896,7 +2116,7 @@ function hiddenLabelId(label) {
1896
2116
  function collapseLabelHiddenWarnings(geo, warnings) {
1897
2117
  let passthrough = [], groups = /* @__PURE__ */ new Map(), labelsById = new Map(geo.labels.map((label) => [label.id, label]));
1898
2118
  for (let warning2 of warnings) {
1899
- let id = warning2.code === "label-hidden" ? /^label '([^']+)'/.exec(warning2.message)?.[1] : void 0, label = id ? labelsById.get(id) : void 0;
2119
+ let id = warning2.code === "label-hidden" ? warning2.detail?.labelId : void 0, label = typeof id == "string" ? labelsById.get(id) : void 0;
1900
2120
  if (!label) {
1901
2121
  passthrough.push(warning2);
1902
2122
  continue;
@@ -1916,19 +2136,36 @@ function collapseLabelHiddenWarnings(geo, warnings) {
1916
2136
  }
1917
2137
  return passthrough;
1918
2138
  }
1919
- function panelUnitLints(data, geo, base = ["data"]) {
1920
- let panels = geo.type === "grid" ? geo.marks?.panels ?? [] : [], authored = isRecord(data) && Array.isArray(data.panels) ? data.panels : void 0, owns = (nodeId, panelId) => nodeId.startsWith(`${panelId}/`) || nodeId.includes(`panel:${panelId}:`);
1921
- return panels.flatMap((panel) => {
2139
+ function panelUnitLints(data, geo, records2, base = ["data"]) {
2140
+ let panels = geo.type === "grid" ? geo.marks?.panels ?? [] : [], authored = isRecord(data) && Array.isArray(data.panels) ? data.panels : void 0, owns = (nodeId, panelId) => nodeId.startsWith(`${panelId}/`) || nodeId.includes(`panel:${panelId}:`), formatsAt = (spec, own, name, held) => unscaledFormatLint(spec.options, spec.data, void 0, held).map((warning2) => ({
2141
+ ...warning2,
2142
+ message: `[${name}] ${warning2.message}`,
2143
+ field: [...own, ...warning2.field ?? []],
2144
+ ...warning2.fix ? { fix: warning2.fix.map((op) => ({ ...op, path: `/${own.join("/")}${op.path}` })) } : {}
2145
+ })), template = isRecord(data) && isRecord(data.template) && isRecord(data.template.data) && !("bySlice" in data.template.data) ? data.template : void 0, made = new Set(panels.filter((panel) => !authored?.some((item) => isRecord(item) && item.id === panel.id)).map((panel) => panel.id)), templateRecords = () => (records2() ?? []).filter((record) => made.has(record.target.panel ?? ""));
2146
+ return [...template ? formatsAt(template, [...base, "template"], "template", templateRecords) : [], ...panels.flatMap((panel) => {
1922
2147
  if (!panel.chart) return [];
1923
2148
  let index = authored?.findIndex((item) => isRecord(item) && item.id === panel.id) ?? -1, own = index >= 0 ? [...base, "panels", index] : [...base, "template"], child = panel.chart.geometry, scene = geo.scene.filter((node2) => owns(node2.id, panel.id) || !panels.some((other) => owns(node2.id, other.id)));
1924
2149
  return [
1925
2150
  ...unitNotShownLints(panel.chart.options, { type: child.type, scene, warnings: child.warnings }).map((warning2) => ({ ...warning2, message: `[${panel.id}] ${warning2.message}`, field: [...own, "options", "unit"] })),
1926
2151
  ...unitInFormatLints(panel.chart.options, own).map((warning2) => ({ ...warning2, message: `[${panel.id}] ${warning2.message}` })),
1927
- ...panelUnitLints(index >= 0 ? authored[index].data : void 0, child, [...own, "data"])
2152
+ // A panel's own formats: the panel's options and data, by their path in the grid.
2153
+ ...index >= 0 ? formatsAt(authored[index], own, panel.id, () => inPanel(records2(), panel.id)) : [],
2154
+ ...panelUnitLints(index >= 0 ? authored[index].data : void 0, child, () => inPanel(records2(), panel.id), [...own, "data"])
1928
2155
  ];
2156
+ })];
2157
+ }
2158
+ function inPanel(records2, panel) {
2159
+ return (records2 ?? []).flatMap((record) => {
2160
+ let scope = record.target.panel;
2161
+ if (scope === panel) {
2162
+ let { panel: _, ...target } = record.target;
2163
+ return [{ ...record, target }];
2164
+ }
2165
+ return scope?.startsWith(`${panel}/`) ? [{ ...record, target: { ...record.target, panel: scope.slice(panel.length + 1) } }] : [];
1929
2166
  });
1930
2167
  }
1931
- function normLints(type, options, geo, data, verify) {
2168
+ function normLints(type, options, geo, records2, data, verify) {
1932
2169
  let found = [...aspectDocLints(type, options, geo, verify)];
1933
2170
  pushAll(geo.warnings, found);
1934
2171
  let rest = [
@@ -1938,8 +2175,9 @@ function normLints(type, options, geo, data, verify) {
1938
2175
  ...unitNotShownLints(options, geo),
1939
2176
  ...shareUnitLints(options, geo),
1940
2177
  ...unitInFormatLints(options),
1941
- ...unscaledFormatLint(options, data, geo),
1942
- ...panelUnitLints(data, geo)
2178
+ // A grid's own format reads no panel's records.
2179
+ ...unscaledFormatLint(options, data, geo, () => (records2() ?? []).filter((record) => record.target.panel === void 0)),
2180
+ ...panelUnitLints(data, geo, records2)
1943
2181
  ];
1944
2182
  return pushAll(geo.warnings, rest), geo.warnings;
1945
2183
  }
@@ -1986,7 +2224,7 @@ function judged(chart, { validated, request }, geo, envelope, reportWarnings, wr
1986
2224
  suggest: "Correct the value the message names."
1987
2225
  }), null;
1988
2226
  }
1989
- let warnings = normLints(def.type, options, geo, validated.data, verify), refusals = chartRefusals(warnings);
2227
+ let held, records2 = () => held ??= chartRecords({ type: def.type, request, geometry: geo, claims }), warnings = normLints(def.type, options, geo, () => drawsZeroNumber(geo.scene) ? records2().records : null, validated.data, verify), refusals = chartRefusals(warnings);
1990
2228
  reportWarnings && pushAll(envelope.warnings, collapseLabelHiddenWarnings(geo, warnings.filter((warning2) => warning2.severity !== "error")));
1991
2229
  for (let refusal2 of refusals)
1992
2230
  envelope.errors.push({
@@ -1997,7 +2235,7 @@ function judged(chart, { validated, request }, geo, envelope, reportWarnings, wr
1997
2235
  ...refusal2.field ? { field: refusal2.field, displayPath: `charts[${chart.name}].${refusal2.field.join(".")}` } : {},
1998
2236
  ...refusal2.fix ? { fix: refusal2.fix } : {}
1999
2237
  });
2000
- return refusals.length ? null : { def, geo, options, claims, request, svg, fontFamily: theme.type.family, warnings };
2238
+ return refusals.length ? null : { def, geo, options, claims, request, svg, fontFamily: theme.type.family, warnings, records: records2 };
2001
2239
  }
2002
2240
  var SIZE_CODES = /* @__PURE__ */ new Set([...SIZE_PATCH_CODES, "size-below-floor"]);
2003
2241
  function drawsWithout(doc, chart, size, target, codes2) {
@@ -2015,24 +2253,6 @@ function heightVerifier(doc, chart, target) {
2015
2253
  return drew.has(key) || drew.set(key, drawsWithout(doc, chart, { width, height }, target, SIZE_CODES)), drew.get(key);
2016
2254
  });
2017
2255
  }
2018
- function verifySizeAdvice(doc, chart, findings, target) {
2019
- for (let finding of findings) {
2020
- let operation = finding.fix?.find((op) => op.op !== "test" && op.path.endsWith("/options/size"));
2021
- if (!operation || !("value" in operation)) continue;
2022
- let value = operation.value, repair = verifiedSizeRepair(value, (size) => drawsWithout(
2023
- doc,
2024
- chart,
2025
- { ...value, ...size },
2026
- target,
2027
- /* @__PURE__ */ new Set([finding.code, "plot-under-floor", "size-below-floor"])
2028
- ));
2029
- if (repair.size) {
2030
- (repair.size.width !== value.width || repair.size.height !== value.height) && (operation.value = { ...value, ...repair.size }, finding.code === "plot-under-floor" ? (finding.message = finding.message.replace(/the chart needs \d+ px/, `the chart needs ${repair.size.height} px`), finding.suggest = `Give the chart ${repair.size.height} px of height, or leave the height out so the chart takes it.`) : (finding.expected = { ...finding.expected, minimum: operation.value }, finding.message = `The chart needs at least ${repair.size.width} \xD7 ${repair.size.height}${value.unit ?? "px"}.`));
2031
- continue;
2032
- }
2033
- delete finding.fix, finding.suggest = `No size could be verified within ${repair.limit.width} \xD7 ${repair.limit.height}${value.unit ?? "px"}. Reduce the content or change the chart settings.`, finding.expected = { condition: finding.suggest };
2034
- }
2035
- }
2036
2256
  function completing(doc, chart, envelope, work) {
2037
2257
  let errors = envelope.errors.length, warnings = envelope.warnings.length;
2038
2258
  try {
@@ -2057,8 +2277,8 @@ function measureChart(doc, chart, envelope, target) {
2057
2277
  return completing(doc, chart, envelope, () => {
2058
2278
  let resolved = resolveRequest(doc, chart, envelope, target);
2059
2279
  if (!resolved) return null;
2060
- let request = { ...resolved.request, options: { ...resolved.request.options, [VERIFY_ADVICE]: !0 } }, layout = layoutResolvedRequest(request), measured = measureLayout(request, layout), floorWarnings = measured.warnings.filter((warning2) => warning2.code === "plot-under-floor");
2061
- if (verifySizeAdvice(doc, chart, [...measured.refused?.warnings ?? [], ...floorWarnings], target), pushAll(envelope.warnings, measured.warnings.filter((warning2) => warning2.severity !== "error")), layout.refused) return { ...measured, target: resolved.request.target };
2280
+ let request = { ...resolved.request, options: { ...resolved.request.options, [VERIFY_ADVICE]: !0 } }, layout = layoutResolvedRequest(request), measured = measureLayout(request, layout);
2281
+ if (pushAll(envelope.warnings, measured.warnings.filter((warning2) => warning2.severity !== "error")), layout.refused) return { ...measured, target: resolved.request.target };
2062
2282
  let judgedChart = judged(chart, resolved, layout, envelope, !1, {}, heightVerifier(doc, chart, target));
2063
2283
  return judgedChart ? (pushAll(envelope.warnings, judgedChart.warnings.filter((warning2) => warning2.severity !== "error" && warning2.code !== "plot-under-floor" && SIZE_PATCH_CODES.has(warning2.code))), { ...measured, target: resolved.request.target }) : null;
2064
2284
  });
@@ -2107,6 +2327,66 @@ var readingCountsSchema = {
2107
2327
  spanText: { type: "string" },
2108
2328
  claims: { type: "array", items: { type: "object" }, description: "Each claim has op, inputs (ref, value), and output (raw, state, displayed)." }
2109
2329
  } } } }
2330
+ }, readingSchema = {
2331
+ type: "object",
2332
+ properties: {
2333
+ name: { type: "string", description: "Chart identity and output file name." },
2334
+ type: { type: "string", description: "Canonical chart type." },
2335
+ title: { type: ["string", "null"], description: "Authored title, or null when absent or hidden." },
2336
+ size: { type: "object", properties: { width: { type: "number" }, height: { type: "number" } }, description: "Drawn size in layout pixels." },
2337
+ mode: { type: "string", enum: ["full", "compact"] },
2338
+ titleLines: { type: "integer", description: "Number of drawn title lines, zero without a title." },
2339
+ series: { type: "array", items: { type: "string" }, description: "Series labels in record order." },
2340
+ counts: readingCountsSchema,
2341
+ labelsPlaced: { type: "integer", description: "Number of labels drawn." },
2342
+ labelsTruncated: {
2343
+ type: "array",
2344
+ description: "Labels whose displayed text is shorter than the authored text.",
2345
+ items: { type: "object", properties: { labelId: { type: "string" }, text: { type: "string" }, displayed: { type: "string" } } }
2346
+ },
2347
+ labelsDropped: { type: "integer", description: "Number of labels omitted by layout. Inspect omissions for their meaning and destination." },
2348
+ labelsDroppedBy: { type: "object", additionalProperties: { type: "integer" }, description: "Dropped-label counts by reason. Redundant labels repeat information already shown." },
2349
+ omissions: {
2350
+ type: "array",
2351
+ description: "Hidden text and values, with the reason and any alternate destination.",
2352
+ items: { type: "object", properties: { labelId: { type: "string" }, text: { type: "string" }, reason: { type: "string" }, destination: { type: "string" } } }
2353
+ },
2354
+ derived: {
2355
+ type: "array",
2356
+ description: "Computed values with operation, state, displayed text and visibility. Missing or withheld values have value null.",
2357
+ items: { type: "object", properties: {
2358
+ claimId: { type: "string" },
2359
+ op: { type: "string" },
2360
+ operation: { type: "string" },
2361
+ value: { type: ["number", "null"] },
2362
+ state: { type: "string" },
2363
+ displayed: { type: "string" },
2364
+ description: { type: "string" },
2365
+ visible: { type: "boolean" },
2366
+ drawn: { type: "boolean" },
2367
+ noteLocation: { type: "string" },
2368
+ inputs: { type: "array", items: { type: "object" } }
2369
+ } }
2370
+ },
2371
+ claims: { type: "object", description: "Counts of derived, observed and authored claims, with states and a text summary." },
2372
+ values: { type: "object", description: "Value counts by state and kind, including suppressed and unavailable values, with a text summary." },
2373
+ metricStack: readingMetricStackSchema,
2374
+ data: { type: "object", description: "With rows or rowsFile: row count, source, unused columns, suppressed cells and SHA-256 of file bytes or canonical inline JSON." },
2375
+ notes: {
2376
+ type: "array",
2377
+ description: "Notes in display order. inFrame says whether the chart prints the note. short is the one-line form for a method note or credit.",
2378
+ items: { type: "object", properties: {
2379
+ n: { type: "number" },
2380
+ kind: { type: "string", enum: ["source", "credit", "note", "method", "disclosure"] },
2381
+ text: { type: "string" },
2382
+ short: { type: "string" },
2383
+ ref: { type: "number" },
2384
+ inFrame: { type: "boolean" },
2385
+ links: { type: "array", items: { type: "object", properties: { text: { type: "string" }, href: { type: "string" } } } }
2386
+ } }
2387
+ },
2388
+ rounding: { type: "array", items: { type: "object" }, description: "For sum-consistent Mekko or pie shares: each adjusted share with whole, part, nearest rounding and printed value." }
2389
+ }
2110
2390
  };
2111
2391
 
2112
2392
  // src/core/discovery.ts
@@ -2118,7 +2398,7 @@ var BARE_NAME_FIELD = {
2118
2398
  description: `Bare chart file name: ${NAME_RULE}. Valid names stay unchanged. Other strings become safe names and warn name-slugified with a fix. Empty results are refused. Document names stay unchanged. Taken names get -2 and keep existing files.`
2119
2399
  }, LANE_TYPES = ["column", "combo", "line"], GAP_BRACKET_FIELDS = {
2120
2400
  placement: {
2121
- meaning: "auto | label | bracket, default auto. With both ends on two different series at the last category, bracket draws the gap bracket in the right margin: an open ring on each end point, a dashed guide from each ring to the margin, a bracket with an arrowhead toward the measured end, and the gap as a large number beside it; the end values sit just over and under their guides. auto draws the bracket where gapFill washes the same two series and the label elsewhere. label keeps the label at the anchor. bracket on other anchors, or on stacked variants (stacked-area, stacked100-area), warns gap-bracket-unavailable and keeps the label.",
2401
+ meaning: "auto | label | bracket, default auto. With both ends on two different series at the last category, bracket draws the gap bracket in the right margin: an open ring on each end point, a dashed guide from each ring to the margin, a bracket with an arrowhead toward the measured end, and the gap as a large number beside it; the end values sit just over and under their guides. auto draws the bracket where gapFill washes the same two series and the label elsewhere. label keeps the label at the anchor. On a bar chart a diff between two categories of one series rides in the shorter bar's row under auto: an arrow from the longer bar's end to the to end, with the number in a break of the shaft; label keeps the arrow off the rows with the number beside it. bracket on other anchors, or on stacked variants (stacked-area, stacked100-area), warns gap-bracket-unavailable and keeps the label.",
2122
2402
  types: ["line"]
2123
2403
  },
2124
2404
  caption: {
@@ -2126,8 +2406,8 @@ var BARE_NAME_FIELD = {
2126
2406
  types: ["line"]
2127
2407
  }
2128
2408
  }, ANNOTATION_OPTIONAL = {
2129
- diff: { mode: "relative | absolute | reversed, default relative. relative prints the percent change from 'from' to 'to', reversed the change from 'to' to 'from', absolute the value difference.", ...GAP_BRACKET_FIELDS },
2130
- delta: GAP_BRACKET_FIELDS,
2409
+ diff: { mode: "relative | absolute | reversed | both, default relative. relative prints the percent change from 'from' to 'to', reversed the change from 'to' to 'from', absolute the value difference, both the value difference with the percent change beside it.", ...GAP_BRACKET_FIELDS },
2410
+ delta: { mode: "absolute | relative | both, default absolute. absolute prints at minus vs, relative the percent change from vs to at, both the two as '+149 (+36%)'. relative and both need a nonzero vs.", ...GAP_BRACKET_FIELDS },
2131
2411
  cagr: {
2132
2412
  suffix: "string, default 'p.a.'. Text after the rate.",
2133
2413
  period: "boolean. Print the period before the rate from the anchors' category labels, '2014\u20132019: +5.8% p.a.'. Default true when the chart carries two or more CAGRs, so nested brackets are told apart by their text, false otherwise. An arrow's ends show its span, so an arrow prints the rate alone unless period is true.",
@@ -2136,7 +2416,7 @@ var BARE_NAME_FIELD = {
2136
2416
  callout: {
2137
2417
  preferSide: "left | right | above | below. Side the solver tries first; the label keeps a leader when it moves.",
2138
2418
  headline: 'string. A bold first line over the text, which then prints in plain type; ${value} in it prints the anchored value from the data. Example: "headline": "${value}", "text": "Peak in handheld-loom demand" prints 153 in bold over the words.',
2139
- arrow: 'boolean, default false. A thin arrow from the text to the anchored point; the first line sits level with the point, right or left of it, where there is room. Not with icon or status. Example: "arrow": true.'
2419
+ arrow: 'boolean, default false. An arrow from the text to the anchored point, in the arrow standard of theme marks.arrow: the text stands far enough out for a 24 px shaft, level with the point right or left of it, or over or under it, where there is room. With no such seat it draws without the arrow and warns callout-arrow-no-room. Not with icon or status. Example: "arrow": true.'
2140
2420
  },
2141
2421
  valueLine: {
2142
2422
  value: "number | 'mean', default mean. A number draws the line there; mean has the engine compute it.",
@@ -2154,6 +2434,9 @@ var BARE_NAME_FIELD = {
2154
2434
  },
2155
2435
  attainment: { meaning: "boolean | { seriesId, direction }. Shades each category between its actual and the line.", types: ["bar", "bullet", "column", "line"] }
2156
2436
  },
2437
+ line: { dashed: "boolean, default false. Draws the line in the dash of a reference line." },
2438
+ arrow: { dashed: "boolean, default false. Draws the shaft in the dash of a reference line." },
2439
+ box: { dashed: "boolean, default false. Draws the edges in the dash of a reference line." },
2157
2440
  bracket: { label: 'string. Name printed before the sum, "Commercial +81". Without it the bracket prints the sum alone.' },
2158
2441
  indicator100: { side: "left | right, default left. Side of the plot the 100% mark sits on." },
2159
2442
  event: {
@@ -2174,12 +2457,13 @@ function optionalFields(kind, type) {
2174
2457
  typeof field == "string" ? fields2[name] = field : field.types.includes(type) && (fields2[name] = field.meaning);
2175
2458
  return fields2;
2176
2459
  }
2460
+ var DRAWING_POINT_NOTE = "A point is an anchor or { categoryId, value } with value in axis units. A value outside the plot, a chart with no value scale or an anchor that does not resolve warns bad-anchor and draws nothing; the axis does not grow.";
2177
2461
  function describeAnnotation(kind, type) {
2178
2462
  let anchors = [], requiredFields = [], notes = [];
2179
2463
  switch (kind) {
2180
2464
  case "diff":
2181
2465
  case "cagr":
2182
- anchors = ["from", "to"].map((field) => ({ field, type: "AnchorRef", required: kind === "diff" })), notes = kind === "diff" ? ["Mode defaults to relative. Relative and reversed changes need a nonzero base; negative bases use its absolute magnitude and emit a warning. Absolute mode reports the raw value difference. A hidden label removes its arm."] : ['Omitted endpoints span the first to the last category, or the first to the last total on a waterfall. Resolved endpoints need a positive date interval from ISO dates or year-bearing labels and a positive start value; an end of zero reads -100%, and a start at or below zero or a negative end omits the rate and warns cagr-undefined. On a continuous time axis the years are the exact span between the two readings. An anchor on one series of several (seriesId, or a line category, which reads the first drawn series) names that series in the label, "Product B +10.1% p.a.", and the arm runs from that series\' segment or point. In text, ${value} prints the rate with its suffix, so "CAGR 2014\u20132019: ${value}" keeps the computed number.'];
2466
+ anchors = ["from", "to"].map((field) => ({ field, type: "AnchorRef", required: kind === "diff" })), notes = kind === "diff" ? ["Mode defaults to relative. Relative and reversed changes need a nonzero base; negative bases use its absolute magnitude and emit a warning. Absolute mode reports the raw value difference. A hidden label removes its arm."] : ['Omitted endpoints span the first to the last category, or the first to the last total on a waterfall. Resolved endpoints need a positive date interval from ISO dates or year-bearing labels and a positive start value; an end of zero reads -100%, and a start at or below zero or a negative end omits the rate and warns cagr-undefined. On a continuous time axis the years are the exact span between the two readings. An anchor on one series of several (seriesId, or a category of an unstacked line, which reads the first drawn series; on a stack a category reads the stack total) names that series in the label, "Product B +10.1% p.a.", and the arm runs from that series\' segment or point. In text, ${value} prints the rate with its suffix, so "CAGR 2014\u20132019: ${value}" keeps the computed number.'];
2183
2467
  break;
2184
2468
  case "delta":
2185
2469
  anchors = [{ field: "at", type: "AnchorRef", required: !0 }, { field: "vs", type: "AnchorRef | number", required: !0 }];
@@ -2206,6 +2490,16 @@ function describeAnnotation(kind, type) {
2206
2490
  case "indicator100":
2207
2491
  notes = ["No anchor is required. The chart needs a value scale that can represent 100."];
2208
2492
  break;
2493
+ case "text":
2494
+ anchors = [{ field: "at", type: "AnchorRef | { categoryId, value }", required: !0 }], requiredFields = ["text"], notes = [DRAWING_POINT_NOTE, "The text prints as written, ${value} included. It takes id and priority, and no other field."];
2495
+ break;
2496
+ case "line":
2497
+ case "arrow":
2498
+ anchors = ["from", "to"].map((field) => ({ field, type: "AnchorRef | { categoryId, value } | { annotationId }", required: !0 })), notes = [DRAWING_POINT_NOTE, `An end { annotationId } names a text annotation: the ${kind} starts or ends at the nearest edge of that text, at every size, and is not drawn when the text is not. A { categoryId, value } end stands on the category's centre. A stretch that would cross text is cut and warns draw-crosses-text. It takes dashed and id, and no other field.`];
2499
+ break;
2500
+ case "box":
2501
+ anchors = ["from", "to"].map((field) => ({ field, type: "AnchorRef | { categoryId, value }", required: !0 })), notes = [DRAWING_POINT_NOTE, "from and to are opposite corners, the box has no fill, and text inside it stays free. A { categoryId, value } corner spans that category's whole band, so the box wraps whole bars, values and markers; from and to on one category wrap that category. A stretch that would cross text is cut and warns draw-crosses-text. It takes dashed and id, and no other field."];
2502
+ break;
2209
2503
  }
2210
2504
  return kind === "diff" && type === "line" && notes.push("Diff labels precede point and end labels. Same-category arms attach there; anchored strokes do not displace them."), kind === "diff" && type === "dot" && notes.push("The arm follows the horizontal value axis and clears the connector."), ["diff", "cagr", "delta", "abs", "note", "callout"].includes(kind) && ["line", "bar", "column", "combo"].includes(type) && notes.push(`Drawn reference series accept anchors.${type === "line" ? " Bad anchors report the cause and valid ids." : ""}`), {
2211
2505
  kind,
@@ -2268,15 +2562,13 @@ function compactFields(all) {
2268
2562
  return rows;
2269
2563
  }
2270
2564
  function fieldLines(fields2, withRequired = !1) {
2271
- let lines = {}, first = /* @__PURE__ */ new Map(), grouped = /* @__PURE__ */ new Map();
2565
+ let lines = {}, grouped = /* @__PURE__ */ new Map();
2272
2566
  for (let row of compactFields(fields2)) {
2273
2567
  let { branch, ...facts } = row.field, tag = branch?.match(/branch (\d+)/g)?.map((value) => value.slice(7)).join("/"), key = JSON.stringify([facts.path, facts.type, facts.required, facts.values, facts.valuesExhaustive, facts.default, row.type, row.meaning]), earlier = grouped.get(key);
2274
2568
  earlier && tag ? earlier.field.branch += `|${tag}` : grouped.set(key, { ...row, field: { ...facts, ...tag ? { branch: tag } : {} } });
2275
2569
  }
2276
2570
  for (let row of grouped.values()) {
2277
- let earlier = first.get(row.meaning), reference = earlier && earlier !== row.field.path ? `See ${earlier}.` : void 0, meaning = reference && reference.length < row.meaning.length ? reference : row.meaning;
2278
- earlier || first.set(row.meaning, row.field.path);
2279
- let literal2 = !row.type && row.field.type === "string" && !!row.field.values?.length && row.field.values.length <= 3 && row.field.valuesExhaustive !== !1, line = fieldLine(literal2 ? { ...row.field, values: void 0 } : row.field, meaning, {
2571
+ let literal2 = !row.type && row.field.type === "string" && !!row.field.values?.length && row.field.values.length <= 3 && row.field.valuesExhaustive !== !1, line = fieldLine(literal2 ? { ...row.field, values: void 0 } : row.field, row.meaning, {
2280
2572
  required: withRequired && row.field.required,
2281
2573
  ...literal2 ? { type: row.field.values.map((value) => JSON.stringify(value)).join(" | ") } : row.type ? { type: row.type } : {}
2282
2574
  }).replace(/\. $/, ""), fact = row.field.branch ? `branch ${row.field.branch}: ${line}` : line;
@@ -2285,17 +2577,21 @@ function fieldLines(fields2, withRequired = !1) {
2285
2577
  return lines;
2286
2578
  }
2287
2579
  function fieldRows(fields2, withRequired = !1) {
2288
- return mergeAlternatives(fields2).map((field) => ({
2289
- path: field.path,
2290
- ...field.branch ? { branch: field.branch } : {},
2291
- type: field.type,
2292
- ...withRequired && field.required ? { required: !0 } : {},
2293
- ...field.values ? { values: field.values } : {},
2294
- ...field.values && field.valuesExhaustive === !1 ? { valuesOpen: !0 } : {},
2295
- ...Object.hasOwn(field, "default") ? { default: field.default } : {},
2296
- ...field.defaultDependsOn ? { defaultDependsOn: field.defaultDependsOn } : {},
2297
- description: field.description
2298
- }));
2580
+ let rows = /* @__PURE__ */ new Map();
2581
+ for (let field of mergeAlternatives(fields2)) {
2582
+ let row = {
2583
+ path: field.path,
2584
+ type: field.type,
2585
+ ...withRequired && field.required ? { required: !0 } : {},
2586
+ ...field.values ? { values: field.values } : {},
2587
+ ...field.values && field.valuesExhaustive === !1 ? { valuesOpen: !0 } : {},
2588
+ ...Object.hasOwn(field, "default") ? { default: field.default } : {},
2589
+ ...field.defaultDependsOn ? { defaultDependsOn: field.defaultDependsOn } : {},
2590
+ description: field.description
2591
+ }, key = JSON.stringify(row), existing = rows.get(key);
2592
+ existing ? field.branch ? existing.branch && (existing.branch += ` | ${field.branch}`) : delete existing.branch : rows.set(key, { ...row, ...field.branch ? { branch: field.branch } : {} });
2593
+ }
2594
+ return [...rows.values()];
2299
2595
  }
2300
2596
  var COMPACT_FIXTURES = 5;
2301
2597
  function typeOptions(type) {
@@ -2304,17 +2600,18 @@ function typeOptions(type) {
2304
2600
  let all = optionFields(type), firstByPath = /* @__PURE__ */ new Map();
2305
2601
  for (let field of all) firstByPath.has(field.path) || firstByPath.set(field.path, field);
2306
2602
  let contract = (field) => fieldLine(field, firstClause(field.description)), own = all.filter((field) => {
2307
- let shared = base.get(field.path);
2308
- return shared ? field.path === "annotations" || field.path.startsWith("annotations[") ? !1 : field.type !== "never" && !shared.some((candidate) => contract(field) === contract(candidate)) : !0;
2603
+ let shared2 = base.get(field.path);
2604
+ return shared2 ? field.path === "annotations" || field.path.startsWith("annotations[") ? !1 : field.type !== "never" && !shared2.some((candidate) => contract(field) === contract(candidate)) : !0;
2309
2605
  }), advertised = [...base.values()].map((fields2) => fields2[0]).filter((field) => (!/[.[]/.test(field.path) || /^valueAxis\.\w+$/.test(field.path)) && field.type !== "never" && !isReserved(field)), refused = (path) => {
2310
2606
  let here = firstByPath.get(path);
2311
2607
  return !here || here.type === "never";
2312
2608
  }, notAccepted = advertised.filter((field) => refused(field.path) && !(field.path.startsWith("valueAxis.") && refused("valueAxis"))).map((field) => field.path), refusedOwn = [...firstByPath.values()].filter((field) => field.type === "never" && !base.has(field.path) && !/[.[]/.test(field.path)), ignored = [
2313
2609
  ...schemaRefusedKeys(type).options.filter((key) => IGNORED_OPTION_KEYS.has(key) || key === "legend"),
2314
2610
  ...["show", "gridlines"].filter((key) => valueAxisRefusal(type, key) !== void 0).map((key) => `valueAxis.${key}`),
2315
- ...Object.hasOwn(LEGEND_DRAWS, type) ? ["legend: 'none'", "legend: 'auto'"] : []
2316
- ];
2317
- return { own, notAccepted: [...notAccepted, ...refusedOwn.map((field) => field.path)].filter((path) => !ignored.includes(path)), ignored };
2611
+ ...Object.hasOwn(LEGEND_DRAWS, type) ? ["legend: 'none'", "legend: 'auto'"] : [],
2612
+ ...Object.keys(IGNORED_ON).filter((path) => IGNORED_ON[path].types.includes(type))
2613
+ ], ownPaths = new Set(own.map((field) => field.path)), shared = advertised.filter((field) => !/[.[]/.test(field.path) && !refused(field.path) && !ownPaths.has(field.path) && !ignored.includes(field.path)).map((field) => field.path);
2614
+ return { own, shared, notAccepted: [...notAccepted, ...refusedOwn.map((field) => field.path)].filter((path) => !ignored.includes(path)), ignored };
2318
2615
  }
2319
2616
  function fields(schema, defaults) {
2320
2617
  return schemaReference(z2.toJSONSchema(schema, { io: "input" }), defaults);
@@ -2322,11 +2619,11 @@ function fields(schema, defaults) {
2322
2619
  function describeType(type, detail = "compact") {
2323
2620
  let definition = getChartDefinition(type);
2324
2621
  if (!definition) throw new Error(`unknown chart type '${type}'`);
2325
- let full = detail === "full", { own, notAccepted, ignored } = typeOptions(definition.type), dataFields = fields(definition.dataSchema), fixtures2 = getFixtures(definition.type), shown = full ? fixtures2 : fixtures2.filter((fixture) => fixture.kind === "example").slice(0, COMPACT_FIXTURES), sizing = definition.sizing, example = definition.discovery?.example, ids = chartIds(definition.type);
2622
+ let full = detail === "full", { own, shared, notAccepted, ignored } = typeOptions(definition.type), dataFields = fields(definition.dataSchema), fixtures2 = getFixtures(definition.type), shown = full ? fixtures2 : fixtures2.filter((fixture) => fixture.kind === "example").slice(0, COMPACT_FIXTURES), sizing = definition.sizing, example = definition.discovery?.example, ids = chartIds(definition.type), data = full ? fieldRows(dataFields, !0) : fieldLines(dataFields, !0), options = full ? fieldRows(own, !0) : fieldLines(own, !0), usesCell = !full && [dataFields, own].some((fields2) => compactFields(fields2).some((row) => row.type !== void 0)), usesAnchor = definition.annotationKinds.some((kind) => describeAnnotation(kind, definition.type).anchors.length > 0), { metricStack, ...reading } = readingSchema.properties;
2326
2623
  return {
2327
2624
  type: definition.type,
2328
2625
  summary: full ? definition.summary : shortSummaryFor(definition.type, definition.summary),
2329
- ...full ? { reading: { counts: readingCountsSchema, ...definition.type === "grid" ? { metricStack: readingMetricStackSchema } : {} } } : {},
2626
+ ...full ? { reading: { ...reading, ...definition.type === "grid" ? { metricStack } : {} } } : {},
2330
2627
  useCases: useCasesFor(definition.type, detail),
2331
2628
  ...designCardFor(definition.type) ? { design: full ? structuredClone(designCardFor(definition.type)) : compactDesignCard(definition.type) } : {},
2332
2629
  ...ids.length ? { ids } : {},
@@ -2334,11 +2631,13 @@ function describeType(type, detail = "compact") {
2334
2631
  ...full && definition.discovery?.notFor ? { notFor: definition.discovery.notFor } : {},
2335
2632
  ...full && definition.discovery?.densities ? { densities: structuredClone(definition.discovery.densities) } : {},
2336
2633
  example: example ? { type: definition.type, ...structuredClone(example) } : null,
2337
- data: full ? fieldRows(dataFields, !0) : fieldLines(dataFields, !0),
2338
- options: full ? fieldRows(own, !0) : fieldLines(own, !0),
2339
- sharedOptions: "plus boardplot_list sharedOptions, which a path here replaces. \u2026 ends a cut row: describe its path for the rest",
2634
+ data,
2635
+ options,
2636
+ ...usesCell ? { cell: CELL_CONTRACT } : {},
2637
+ ...usesAnchor ? { anchor: ANCHOR_FORM } : {},
2638
+ sharedOptions: `${shared.length ? `Additional shared options: ${shared.join(", ")}. ` : ""}Use path for one field, for example {"type":"${definition.type}","path":"options.title"}.${full ? "" : " Rows ending in \u2026 are shortened."}`,
2340
2639
  ...notAccepted.length ? { notAccepted } : {},
2341
- ...full && ignored.length ? { ignored } : {},
2640
+ ...ignored.length ? { ignored } : {},
2342
2641
  sizing: {
2343
2642
  minWidth: sizing.minWidth,
2344
2643
  minHeight: sizing.minHeight,
@@ -2381,7 +2680,9 @@ function describeField(type, path) {
2381
2680
  let matches = (half === "data" ? fields(definition.dataSchema) : optionFields(definition.type)).filter((field) => pathKey(field.path) === key || pathKey(field.path).startsWith(`${key}.`));
2382
2681
  if (!matches.length) continue;
2383
2682
  let named = matches.find((field) => pathKey(field.path) === key)?.path ?? key, refused = matches.find((field) => field.type === "never" && pathKey(field.path) === key);
2384
- return refused ? { type: definition.type, part: half, path: named, refused: refused.description } : { type: definition.type, part: half, path: named, fields: fieldRows(matches, half === "data") };
2683
+ if (refused) return { type: definition.type, part: half, path: named, refused: refused.description };
2684
+ let ignored = half === "options" && Object.entries(IGNORED_ON).find(([at, { types }]) => types.includes(definition.type) && (key === at || key.startsWith(`${at}.`)));
2685
+ return ignored ? { type: definition.type, part: half, path: named, refused: `Ignored on '${definition.type}' with an option-ignored warning: ${ignored[1].does}` } : { type: definition.type, part: half, path: named, fields: fieldRows(matches, half === "data") };
2385
2686
  }
2386
2687
  return !part && key === "name" ? { type: definition.type, part: "spec", path: "name", fields: [{ ...BARE_NAME_FIELD }] } : null;
2387
2688
  }
@@ -2413,8 +2714,8 @@ var THEME_ERRORS = {
2413
2714
  "invalid-theme-override": "overrides produce a structurally invalid theme",
2414
2715
  "theme-name-reserved": "a full theme object uses a preset name",
2415
2716
  "unparseable-color": "a colour is unsupported; use hex, rgb(), hsl(), oklch() or var() with a literal fallback",
2416
- "contrast-ink": "ink on background is below 4.5:1",
2417
- "contrast-ink-muted": "inkMuted on background is below 3:1",
2717
+ "contrast-ink": "ink, or a table ink that stands for it, on background is below 4.5:1",
2718
+ "contrast-ink-muted": "inkMuted, or a muted table ink, on background is below 3:1",
2418
2719
  "contrast-inside-label": "a label inside a fill is below its contrast floor",
2419
2720
  "semantic-equals-background": "good, bad or highlight equals the background",
2420
2721
  "good-bad-similar": "good and bad are nearly identical",
@@ -2584,212 +2885,6 @@ function fixtures(input, perPage = FIXTURES_PER_PAGE) {
2584
2885
  import { closeSync, constants, lstatSync, mkdirSync, openSync, readdirSync, statSync as statSync3, writeFileSync as writeFileSync2 } from "fs";
2585
2886
  import { basename, dirname, extname as extname2, isAbsolute as isAbsolute2, join as join2, resolve as resolve4 } from "path";
2586
2887
 
2587
- // src/core/reading.ts
2588
- function operationWords(op) {
2589
- return op.replace(/@\d+$/, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").split(/[-_\s]+/).filter(Boolean).map((word) => word.toLowerCase()).join(" ");
2590
- }
2591
- function isDerivation(kind) {
2592
- return CLAIM_KIND_GROUPS.derivations.includes(kind);
2593
- }
2594
- function reportableNumber(record) {
2595
- return record.state === "value" && typeof record.raw == "number" && Number.isFinite(record.raw) ? record.raw : null;
2596
- }
2597
- function explainClaims(claims) {
2598
- let derivations = claims.filter((claim) => isDerivation(claim.kind)).length, observed = claims.filter((claim) => claim.kind === "observed").length, authored = claims.filter((claim) => claim.kind === "authored").length, states = [...new Set(claims.map((claim) => claim.output.state))].sort(), summary = [
2599
- `${claims.length} claim ${claims.length === 1 ? "record" : "records"} for this chart: ${derivations} engine ${derivations === 1 ? "derivation" : "derivations"} and ${claims.length - derivations} that ${claims.length - derivations === 1 ? "promises" : "promise"} no arithmetic.`
2600
- ];
2601
- if (claims.length - derivations > 0) {
2602
- let parts = [];
2603
- observed > 0 && parts.push(`${observed} ${observed === 1 ? "was" : "were"} measured from the source sample`), authored > 0 && parts.push(`${authored} came from the document`), parts.length > 0 && summary.push(`Of the records without arithmetic, ${parts.join(" and ")}.`);
2604
- }
2605
- return states.some((state) => state !== "value") && summary.push(`Claim states in this chart: ${states.join(", ")}.`), {
2606
- total: claims.length,
2607
- derivations,
2608
- nonDerivations: claims.length - derivations,
2609
- observed,
2610
- authored,
2611
- states,
2612
- summary
2613
- };
2614
- }
2615
- function derivedNumbers(claims) {
2616
- return claims.filter((claim) => isDerivation(claim.kind)).map((claim) => ({
2617
- claimId: claim.id,
2618
- ...claim.id.startsWith("stack:") ? { inputs: claim.inputs.map((input) => ({ ...input })) } : {},
2619
- op: claim.op,
2620
- operation: operationWords(claim.op),
2621
- displayed: claim.output.displayed || "Not displayed",
2622
- visible: claim.output.displayed.length > 0,
2623
- ...claim.noteLocation ? { noteLocation: claim.noteLocation } : {},
2624
- ...claim.drawn === !1 ? { drawn: !1 } : {},
2625
- value: reportableNumber(claim.output),
2626
- state: claim.output.state
2627
- }));
2628
- }
2629
- var VALUE_NOTE_LIMIT = 10;
2630
- function valuesSummary(records2, unavailableNote) {
2631
- if (records2 === null) {
2632
- let note = unavailableNote ?? "No interaction record adapter covers this chart type.";
2633
- return {
2634
- source: "unavailable",
2635
- note,
2636
- total: 0,
2637
- numbers: 0,
2638
- byState: {},
2639
- byKind: {},
2640
- suppressed: [],
2641
- withoutNumber: [],
2642
- summary: [`${note} No per-value description is reported.`]
2643
- };
2644
- }
2645
- let byState = {}, byKind = {}, suppressed = [], withoutNumber = [], numbers = 0;
2646
- for (let record of records2) {
2647
- let { state, kind } = record.value;
2648
- byState[state] = (byState[state] ?? 0) + 1, byKind[kind] = (byKind[kind] ?? 0) + 1, kind === "number" && state === "value" && (numbers += 1);
2649
- let note = { recordId: record.id, label: record.label, state, reason: record.value.reason ?? null };
2650
- state === "suppressed" ? suppressed.length < VALUE_NOTE_LIMIT && suppressed.push(note) : state !== "value" && withoutNumber.length < VALUE_NOTE_LIMIT && withoutNumber.push(note);
2651
- }
2652
- let textOrDate = (byKind.text ?? 0) + (byKind.date ?? 0), summary = [
2653
- `The records describe ${records2.length} ${records2.length === 1 ? "value" : "values"}, ${numbers} of them a plain number${textOrDate > 0 ? ` and ${textOrDate} text or date` : ""}.`
2654
- ], withheld = byState.suppressed ?? 0;
2655
- withheld > 0 && summary.push(
2656
- `${withheld} ${withheld === 1 ? "value is" : "values are"} withheld, so no raw number is reported for them.`
2657
- );
2658
- let other = Object.entries(byState).filter(([state]) => state !== "value" && state !== "suppressed"), otherCount = other.reduce((sum, [, count]) => sum + count, 0);
2659
- return otherCount > 0 && summary.push(
2660
- `${otherCount} ${otherCount === 1 ? "value is" : "values are"} neither present nor withheld: ${other.map(([state]) => state).sort().join(", ")}.`
2661
- ), { source: "interaction-records", total: records2.length, numbers, byState, byKind, suppressed, withoutNumber, summary };
2662
- }
2663
- function recordsFor(input) {
2664
- try {
2665
- return {
2666
- records: interactionRecords({
2667
- request: input.request,
2668
- geometry: input.geometry,
2669
- scope: input.request.scope,
2670
- claims: input.claims
2671
- // An event of the event lane or a value line is an annotation, not a value the chart plots.
2672
- }).filter((record) => record.target.owner.annotationId === void 0)
2673
- };
2674
- } catch (error) {
2675
- return {
2676
- records: null,
2677
- note: `No interaction record adapter covers this chart type: ${error instanceof Error ? error.message : String(error)}`
2678
- };
2679
- }
2680
- }
2681
- function unrequestedLabelOmissions(input, records2, omissions) {
2682
- let named = new Set(omissions.map((item) => item.labelId)), destinationOf = readableLabelDestination(input.geometry), add = (labelId, text, reason, owner = {}, kind, printedText = text) => {
2683
- named.has(labelId) || (named.add(labelId), !destinationOf(labelId, printedText, owner, kind, text) && omissions.push({ labelId, text, reason, destination: "reading.omissions" }));
2684
- }, valueKey = (owner) => JSON.stringify([owner.seriesId, owner.categoryId, owner.pointId]), buildContext = (prefix) => {
2685
- let scope = omissionScope(input.geometry, input.request.options, `${prefix}point`, input.request.data), data = scope.data ?? {}, labels = scope.geometry.labels, categories = (Array.isArray(data.categories) ? data.categories : []).map(normalizeCategory), seriesById = new Map((Array.isArray(data.series) ? data.series : []).filter((series) => series.values !== void 0).map((series, index) => [series.id, { ...series, values: normalizeSeriesValues(series, categories, index) }])), options = scope.options ?? {}, geometry = scope.geometry, order = geometry.type === "bar" ? geometry.derived.order : void 0, visibleCategories = new Set(order ?? geometry.axes.flatMap((axis) => axis.ticks.filter((tick) => tick.labelId && /(?:^|[:/])category:/.test(tick.labelId)).map((tick) => String(tick.at)))), defaultPieCut = geometry.type === "pie" && categories.length - DEFAULT_TOP_N.n >= DEFAULT_REST_MIN, topN = options.topN ?? (defaultPieCut ? DEFAULT_TOP_N : void 0), topNCut = typeof topN?.n == "number" && topN.n > 0 && (categories.length > topN.n || typeof topN.threshold == "number" && topN.threshold > 0) && !options.window && !options.viewDomain;
2686
- return {
2687
- categories,
2688
- seriesById,
2689
- geometry,
2690
- data,
2691
- options,
2692
- visibleCategories,
2693
- topNCut,
2694
- plottedPoints: new Set((geometry.type === "scatter" ? geometry.marks.points ?? [] : []).map((point) => point.id)),
2695
- capApplied: geometry.type === "scatter" && geometry.warnings.some((warning2) => warning2.code === "labels-auto-off"),
2696
- requestedValues: new Set(labels.filter((label) => ["point", "segment", "insidePie", "outsidePie"].includes(label.kind)).map((label) => valueKey(label.owner))),
2697
- drawnSeries: new Set(labels.filter((label) => label.kind === "series" && !label.hidden).map((label) => label.owner.seriesId)),
2698
- drawnCategories: new Set(labels.filter((label) => label.kind === "category" && !label.hidden).map((label) => label.owner.categoryId)),
2699
- keptCategories: new Set(visibleCategories.size ? visibleCategories : labels.map((label) => label.owner.categoryId))
2700
- };
2701
- }, contexts = /* @__PURE__ */ new Map();
2702
- for (let record of records2) {
2703
- let prefix = record.target.panel ? `${record.target.panel}/` : "", context = contexts.get(prefix);
2704
- context || (context = buildContext(prefix), contexts.set(prefix, context));
2705
- let { categories, seriesById, options } = context, settings = options.labels, disabled = (kind) => {
2706
- let setting = typeof settings == "object" && settings !== null ? settings[kind] : void 0;
2707
- return settings === !1 || setting === !1 || Array.isArray(setting) && setting.length === 0;
2708
- }, owner = record.target.owner;
2709
- if (context.geometry.type === "scatter" && owner.pointId !== void 0 && !context.plottedPoints.has(owner.pointId) || (options.window || options.viewDomain) && owner.categoryId !== void 0 && context.visibleCategories.size && !context.visibleCategories.has(owner.categoryId)) continue;
2710
- context.keptCategories.add(owner.categoryId);
2711
- let series = owner.seriesId === void 0 ? void 0 : seriesById.get(owner.seriesId), categoryIndex = categories.findIndex((category) => category.id === owner.categoryId), cell = series?.values[categoryIndex], cellLabel = typeof cell == "object" && cell !== null && "label" in cell ? cell.label : void 0, only = typeof options.seriesLabels == "object" && options.seriesLabels !== null ? options.seriesLabels.only : void 0, excludedSeries = only !== void 0 && owner.seriesId !== void 0 && !only.includes(owner.seriesId), excludedValues = excludedSeries && context.geometry.type === "line", openBin = context.geometry.derived?.binning, hasValueRequest = context.requestedValues.has(valueKey(owner)) || context.geometry.type === "histogram" && openBin?.openAbove !== void 0 && owner.categoryId === JSON.stringify(["bin", openBin.edges.at(-2), openBin.edges.at(-1)]), valueKind = context.geometry.type !== "line" && typeof options.variant == "string" && options.variant.startsWith("stacked") ? "segment" : "point", selectiveValues = typeof options.valueLabels == "string" && options.valueLabels !== "all";
2712
- if (!hasValueRequest && owner.categoryId !== void 0 && record.value.state === "value" && (disabled(valueKind) || cellLabel === !1 || excludedValues || selectiveValues)) {
2713
- let reason = cellLabel === !1 ? "cell-label-disabled" : excludedValues ? "seriesLabels.only" : disabled(valueKind) ? "disabled" : `valueLabels:${options.valueLabels}`, value = typeof cellLabel == "string" ? cellLabel : interactionValueText(record.value, input.request.locale?.language);
2714
- add(`${prefix}${valueKind}:${owner.seriesId ?? ""}:${owner.categoryId}`, `${record.label} ${value}`, reason, owner, valueKind, value);
2715
- }
2716
- context.geometry.type === "scatter" && owner.pointId !== void 0 && !hasValueRequest && (disabled("point") || context.capApplied) && add(`${prefix}point:${owner.pointId}`, record.label, disabled("point") ? "disabled" : "maxPointLabels", owner, "category");
2717
- let seriesSetting = typeof settings == "object" && settings !== null ? settings.series : void 0;
2718
- if (owner.seriesId !== void 0 && record.seriesLabel !== void 0 && (disabled("series") || options.seriesLabels === "none" || excludedSeries || Array.isArray(seriesSetting) && !seriesSetting.includes("series")) && !context.drawnSeries.has(owner.seriesId) && add(`${prefix}series:${owner.seriesId}`, record.seriesLabel, disabled("series") ? "disabled" : "seriesLabels", { seriesId: owner.seriesId }, "series"), disabled("category") && owner.categoryId !== void 0 && record.categoryLabel !== void 0 && !context.drawnCategories.has(owner.categoryId) && add(`${prefix}category:${owner.categoryId}`, record.categoryLabel, "disabled", { categoryId: owner.categoryId }, "category"), context.topNCut && owner.categoryId !== void 0 && !categories.some((category) => category.id === owner.categoryId)) for (let member of record.members ?? []) {
2719
- let category = categories.find((category2) => category2.id === member.categoryId);
2720
- category && add(`${prefix}category:${category.id}`, category.label ?? category.id, "topN", { categoryId: category.id }, "category");
2721
- }
2722
- }
2723
- for (let [prefix, context] of contexts) if (context.topNCut && (context.geometry.type === "dot" || context.geometry.type === "variance" || context.options.topN?.rest === !1))
2724
- for (let category of context.categories) context.keptCategories.has(category.id) || add(`${prefix}category:${category.id}`, category.label ?? category.id, "topN", { categoryId: category.id }, "category");
2725
- for (let [prefix, context] of contexts) {
2726
- let { options, geometry } = context, settings = typeof options.labels == "object" && options.labels !== null ? options.labels : void 0;
2727
- if (options.grandTotalLabels === !1 || options.labels === !1 || settings?.grandTotal === !1) {
2728
- let totals = geometry.derived.stackTotals ?? geometry.derived.totals ?? {};
2729
- if (["column", "bar", "combo"].includes(geometry.type)) for (let [id, raw] of Object.entries(totals)) {
2730
- if (!Number.isFinite(raw) || geometry.labels.some((label) => label.id === `grandTotal:${id}`)) continue;
2731
- let category = context.categories.find((category2) => category2.id === id), value = interactionValueText({
2732
- kind: "number",
2733
- state: "value",
2734
- raw,
2735
- derived: "number",
2736
- ...typeof options.unit == "string" ? { unit: options.unit } : {},
2737
- ...typeof options.format == "string" ? { format: options.format } : {}
2738
- }, input.request.locale?.language);
2739
- add(`${prefix}grandTotal:${id}`, `${category?.label ?? id} ${value}`, "disabled", { categoryId: id }, "grandTotal", value);
2740
- }
2741
- }
2742
- if (geometry.type === "sparkline") {
2743
- let names2 = context.data.labels;
2744
- if (options.endLabels === "none" && names2?.length) for (let [end, index] of [["first", 0], ["last", names2.length - 1]])
2745
- add(`${prefix}spark:label:${end}`, names2[index], "endLabels:none", {}, "category");
2746
- if (options.valueLabel === "none") {
2747
- let last = records2.filter((record) => (record.target.panel ? `${record.target.panel}/` : "") === prefix && record.value.state === "value").at(-1);
2748
- if (last) {
2749
- let value = interactionValueText(last.value, input.request.locale?.language);
2750
- add(`${prefix}spark:last`, `${last.label} ${value}`, "valueLabel:none", last.target.owner, "point", value);
2751
- }
2752
- }
2753
- }
2754
- }
2755
- }
2756
- function chartReading(input) {
2757
- let { records: records2, note } = recordsFor(input), title = input.request.options.title, byData = dataOrder(input.request.data, input.geometry.labels), omissions = labelOmissions(input.geometry, input.request.options, input.request.data);
2758
- unrequestedLabelOmissions(input, records2 ?? [], omissions);
2759
- let dropped = input.geometry.labels.filter((label) => label.hidden !== void 0).sort((a, b) => byData(a.id, b.id)), labelsDroppedBy = {};
2760
- for (let label of dropped) {
2761
- let reason = label.noted ? "note" : label.hidden;
2762
- labelsDroppedBy[reason] = (labelsDroppedBy[reason] ?? 0) + 1;
2763
- }
2764
- let series = [...new Set((records2 ?? []).flatMap((record) => record.seriesLabel === void 0 ? [] : [record.seriesLabel]))], rounding = input.geometry.derived?.roundingAdjustments, source = input.geometry.frame.source, fittedSource = input.geometry.scene.find((node2) => node2.id === input.geometry.frame.sourceNodeId && node2.t === "text"), sourceDrawn = source && (fittedSource?.t === "text" && fittedSource.opacity !== 0 && fittedSource.lines.join(" ").replace(/\s+/g, " ").trim() === plainText(source).replace(/\s+/g, " ").trim() || readableLabelDestination(input.geometry)("frame:source", source, {}, "source"));
2765
- return {
2766
- name: input.name,
2767
- // A column that stepped to bars reads as the bar chart that was drawn.
2768
- type: drawnRequest({ type: input.type }, input.geometry).type,
2769
- counts: (input.geometry.a11y.counts ?? []).map((count) => ({ ...count })),
2770
- title: typeof title == "string" && title.trim() !== "" ? title : null,
2771
- size: { width: input.geometry.size.width, height: input.geometry.size.height },
2772
- mode: input.geometry.mode ?? "full",
2773
- titleLines: input.geometry.frame.titleLines ?? 0,
2774
- series,
2775
- labelsPlaced: input.geometry.labels.length - dropped.length,
2776
- labelsTruncated: cutLabels(input.geometry),
2777
- labelsDropped: dropped.length,
2778
- labelsDroppedBy,
2779
- omissions: [
2780
- ...omissions.sort((a, b) => byData(a.labelId, b.labelId)),
2781
- ...input.geometry.derived.omissions ?? [],
2782
- ...source && !sourceDrawn ? [{ labelId: "frame:source", text: source, reason: fittedSource ? "truncated" : "not-drawn", destination: "frame.source" }] : []
2783
- ],
2784
- derived: derivedNumbers(input.claims),
2785
- ...input.geometry.derived.metricStack ? { metricStack: { readouts: input.geometry.derived.metricStack.readouts } } : {},
2786
- claims: explainClaims(input.claims),
2787
- values: valuesSummary(records2, note),
2788
- notes: chartNotes(input.geometry),
2789
- ...rounding ? { rounding: rounding.map((adjustment) => ({ ...adjustment })) } : {}
2790
- };
2791
- }
2792
-
2793
2888
  // src/cli/raster.ts
2794
2889
  import { spawnSync } from "child_process";
2795
2890
  import { existsSync, mkdtempSync, readFileSync as readFileSync3, rmSync, writeFileSync } from "fs";
@@ -3224,7 +3319,7 @@ function renderWithTables(input) {
3224
3319
  idScope,
3225
3320
  ...options.background === "transparent" ? { background: !1 } : {}
3226
3321
  }, options.target), drawnCodes = new Set(envelope.warnings.slice(before).map((warning2) => warning2.code));
3227
- drawn2 && laid.push({ name: chart.name, chart: drawn2, drawsWith: (changed) => drawsWithOptions(doc, sized, changed, drawnCodes, options.target) });
3322
+ drawn2 && laid.push({ name: chart.name, chart: drawn2, drawsWith: (changed, code) => input.adviceRead?.(code) !== !1 && drawsWithOptions(doc, sized, changed, drawnCodes, options.target) });
3228
3323
  }
3229
3324
  addDocumentLints(doc, envelope, laid);
3230
3325
  let sent = (findings) => keepSizeUnit(attributeSizeOverride(
@@ -3266,12 +3361,13 @@ function renderWithTables(input) {
3266
3361
  type: drawing.chart.def.type,
3267
3362
  request: drawing.chart.request,
3268
3363
  geometry: drawing.chart.geo,
3269
- claims: drawing.chart.claims
3364
+ claims: drawing.chart.claims,
3365
+ records: drawing.chart.records()
3270
3366
  }),
3271
3367
  ...rows.data ? { data: rows.data } : {}
3272
3368
  }
3273
3369
  } : {}
3274
- })), images = drawings.flatMap((drawing) => drawing.png ? [drawing.png] : []), body = charts.length === 1 && bare ? { ...charts[0], warnings } : { charts: charts.map((chart, index) => ({ name: drawings[index].name, ...chart })), warnings }, fontTables = fontTablesSummary(activeFontTables());
3370
+ })), images = out && input.return?.length === 0 ? [] : drawings.flatMap((drawing) => drawing.png ? [drawing.png] : []), body = charts.length === 1 && bare ? { ...charts[0], warnings } : { charts: charts.map((chart, index) => ({ name: drawings[index].name, ...chart })), warnings }, fontTables = fontTablesSummary(activeFontTables());
3275
3371
  return ok({ errors: [], ...body, ...outputs ? { outputs } : {}, ...fontTables ? { fontTables } : {} }, images);
3276
3372
  }
3277
3373
  function writeOutputs(out, drawings, format, asFile, warnings, overwrite) {
@@ -3721,7 +3817,7 @@ function names(value, pattern, field) {
3721
3817
  if (!Array.isArray(list2) || !list2.every((entry) => typeof entry == "string" && pattern.test(entry)))
3722
3818
  throw new InputError("invalid-argument", `${field} takes names as Boardplot spells them (${pattern}), not text`, {
3723
3819
  path: `/${field}`,
3724
- suggest: `Pass only ${field === "codes" ? "warning and error codes such as label-dropped" : "option key names such as valueAxis"}.`
3820
+ suggest: `Pass only ${field === "codes" ? "warning and error codes such as label-hidden" : "option key names such as valueAxis"}.`
3725
3821
  });
3726
3822
  return [...new Set(list2)].sort();
3727
3823
  }
@@ -3797,11 +3893,11 @@ export {
3797
3893
  requestedFontTables,
3798
3894
  fontTablesSummary,
3799
3895
  sha256,
3896
+ designCodes,
3800
3897
  TARGETS,
3801
3898
  readSpecFile,
3802
3899
  list,
3803
- readingCountsSchema,
3804
- readingMetricStackSchema,
3900
+ readingSchema,
3805
3901
  describe,
3806
3902
  fixtures,
3807
3903
  render,