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
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  COMPACT_OMITTED_NOTES,
3
3
  LIVE_NOTE_SHOW,
4
+ NOTES_ASKED,
4
5
  allQuiet,
5
6
  chartNotes,
6
7
  copyNote,
@@ -16,6 +17,7 @@ import {
16
17
  isQuiet,
17
18
  keepNoteMeta,
18
19
  liveFooterExtra,
20
+ notesPanelLabel,
19
21
  notesPointer,
20
22
  recordFreedChrome,
21
23
  shownNoteKinds,
@@ -23,19 +25,22 @@ import {
23
25
  staticFrame,
24
26
  valueNote,
25
27
  wrapFootnote
26
- } from "./chunk-WZB6R2ZX.js";
28
+ } from "./chunk-DZYTXZNS.js";
27
29
  import {
28
30
  ENGINE_REV
29
- } from "./chunk-J22ETKDJ.js";
31
+ } from "./chunk-MRM4KJ2O.js";
30
32
  import {
31
33
  dateNames
32
34
  } from "./chunk-QBR6IKIX.js";
35
+ import {
36
+ defaultAnnotationId
37
+ } from "./chunk-F2ET5ZTT.js";
33
38
  import {
34
39
  parseFormatExample,
35
40
  parseISODate,
36
41
  unitOfSpec,
37
42
  utcDate
38
- } from "./chunk-D3PQAVFW.js";
43
+ } from "./chunk-Z6DUNKFU.js";
39
44
  import {
40
45
  chartString,
41
46
  chartStrings,
@@ -54,7 +59,10 @@ import {
54
59
  WIDE_CANVAS_MIN_WIDTH,
55
60
  arrowHeadPath,
56
61
  arrowShaftEnd,
62
+ boxGap,
57
63
  bulletBandPaints,
64
+ classStepWidth,
65
+ createOccupiedIndex,
58
66
  decideFillEdges,
59
67
  effectiveFill,
60
68
  emphasisWeight,
@@ -68,6 +76,7 @@ import {
68
76
  hatchPatternId,
69
77
  hatchStrokeWidthFor,
70
78
  hatchTile,
79
+ inflate,
71
80
  isHatchPattern,
72
81
  labelPlate,
73
82
  leaderPath,
@@ -77,6 +86,8 @@ import {
77
86
  paintTokenColor,
78
87
  panelTypeClass,
79
88
  pieRamp,
89
+ rectContains,
90
+ rectsOverlap,
80
91
  referenceCasings,
81
92
  repaintSeparation,
82
93
  resolvePalette,
@@ -84,6 +95,7 @@ import {
84
95
  resolveTheme,
85
96
  secondaryFont,
86
97
  secondaryType,
98
+ segmentHitsRect,
87
99
  seriesTextAlone,
88
100
  smallestTitleSize,
89
101
  solidMutedPlan,
@@ -91,8 +103,9 @@ import {
91
103
  strokeToken,
92
104
  textScaleOf,
93
105
  textSizeOf,
106
+ unionRect,
94
107
  visibleTintAmount
95
- } from "./chunk-JARJP576.js";
108
+ } from "./chunk-TX5FSNAU.js";
96
109
  import {
97
110
  COLOR_FIX,
98
111
  FILL_SEPARATION_FLOOR,
@@ -106,7 +119,10 @@ import {
106
119
  parseColor,
107
120
  pickInk,
108
121
  readsAsLoss
109
- } from "./chunk-DRHQG44U.js";
122
+ } from "./chunk-BQBD6Q5J.js";
123
+ import {
124
+ fmtPathNumber
125
+ } from "./chunk-6IUK6PAH.js";
110
126
  import {
111
127
  DEFAULT_TARGET,
112
128
  NormalizeError,
@@ -116,17 +132,16 @@ import {
116
132
  scaleTextAtFloor,
117
133
  targetFloorsPx,
118
134
  targetTypeSizesPx
119
- } from "./chunk-FX5VZK5F.js";
120
- import {
121
- maxOf,
122
- minOf,
123
- pushAll
124
- } from "./chunk-WYJEOMNY.js";
135
+ } from "./chunk-RJICOOB3.js";
125
136
  import {
126
137
  ellipsize,
127
138
  hasAuthoredTypeSize,
128
139
  wrapText
129
140
  } from "./chunk-UIHGGWES.js";
141
+ import {
142
+ maxOf,
143
+ pushAll
144
+ } from "./chunk-WYJEOMNY.js";
130
145
  import {
131
146
  boldMeasurer,
132
147
  boldRuns,
@@ -136,184 +151,22 @@ import {
136
151
  splitBoldLines
137
152
  } from "./chunk-SRUV7AT6.js";
138
153
 
139
- // src/core/geometry.ts
140
- function rectsOverlap(a, b, pad = 0) {
141
- return !(a.x + a.w + pad <= b.x || b.x + b.w + pad <= a.x || a.y + a.h + pad <= b.y || b.y + b.h + pad <= a.y);
142
- }
143
- function rectContains(outer, inner, pad = 0) {
144
- return inner.x >= outer.x + pad && inner.y >= outer.y + pad && inner.x + inner.w <= outer.x + outer.w - pad && inner.y + inner.h <= outer.y + outer.h - pad;
145
- }
146
- function polylineYAt(line, x) {
147
- if (x <= line[0].x) return line[0].y;
148
- for (let i = 1; i < line.length; i++) {
149
- let a = line[i - 1], b = line[i];
150
- if (x <= b.x) return b.x === a.x ? b.y : a.y + (b.y - a.y) * (x - a.x) / (b.x - a.x);
151
- }
152
- return line[line.length - 1].y;
153
- }
154
- function pointRectDistance(p, rect) {
155
- return Math.hypot(Math.max(rect.x - p.x, 0, p.x - rect.x - rect.w), Math.max(rect.y - p.y, 0, p.y - rect.y - rect.h));
156
- }
157
- function pointSegmentDistance(x, y, a, dx, dy, squared) {
158
- let t = dx === 0 && dy === 0 ? 0 : Math.max(0, Math.min(1, ((x - a.x) * dx + (y - a.y) * dy) / squared));
159
- return Math.hypot(x - a.x - t * dx, y - a.y - t * dy);
160
- }
161
- function rectLineDistance(rect, line) {
162
- if (line.length === 1) return pointRectDistance(line[0], rect);
163
- let right = rect.x + rect.w, bottom = rect.y + rect.h, best = 1 / 0, previousDistance = 1 / 0;
164
- for (let i = 1; i < line.length; i++) {
165
- let a = line[i - 1], b = line[i], dx = b.x - a.x, dy = b.y - a.y, squared = dx * dx + dy * dy, minX = Math.min(a.x, b.x), maxX = Math.max(a.x, b.x), minY = Math.min(a.y, b.y), maxY = Math.max(a.y, b.y), scale = Math.max(
166
- 1,
167
- Math.abs(rect.x),
168
- Math.abs(rect.y),
169
- Math.abs(right),
170
- Math.abs(bottom),
171
- Math.abs(a.x),
172
- Math.abs(a.y),
173
- Math.abs(b.x),
174
- Math.abs(b.y)
175
- ), error = scale <= 2 ** 40 && (dx === 0 || Math.abs(dx) >= 2 ** -256) && (dy === 0 || Math.abs(dy) >= 2 ** -256) ? 64 * Number.EPSILON * scale : 1 / 0;
176
- if (!(rect.w >= 0 && rect.h >= 0 && (maxX < rect.x - error || minX > right + error || maxY < rect.y - error || minY > bottom + error)) && segmentHitsRect(a, b, rect)) return 0;
177
- i === 1 && (previousDistance = pointRectDistance(a, rect));
178
- let nextDistance = pointRectDistance(b, rect);
179
- best = Math.min(best, previousDistance, nextDistance);
180
- let limit = best + error, leftGap = Math.max(0, minX - rect.x, rect.x - maxX), rightGap = Math.max(0, minX - right, right - maxX), topGap = Math.max(0, minY - rect.y, rect.y - maxY), bottomGap = Math.max(0, minY - bottom, bottom - maxY);
181
- best = Math.min(
182
- best,
183
- leftGap > limit || topGap > limit ? 1 / 0 : pointSegmentDistance(rect.x, rect.y, a, dx, dy, squared),
184
- rightGap > limit || topGap > limit ? 1 / 0 : pointSegmentDistance(right, rect.y, a, dx, dy, squared),
185
- leftGap > limit || bottomGap > limit ? 1 / 0 : pointSegmentDistance(rect.x, bottom, a, dx, dy, squared),
186
- rightGap > limit || bottomGap > limit ? 1 / 0 : pointSegmentDistance(right, bottom, a, dx, dy, squared)
187
- ), previousDistance = nextDistance;
188
- }
189
- return best;
190
- }
191
- function sideAwayFrom(point, others) {
192
- let above = 1 / 0, below = 1 / 0, any = !1;
193
- for (let line of others) {
194
- if (line.length === 0 || point.x < line[0].x || point.x > line[line.length - 1].x) continue;
195
- any = !0;
196
- let y = polylineYAt(line, point.x);
197
- y < point.y ? above = Math.min(above, point.y - y) : y > point.y && (below = Math.min(below, y - point.y));
198
- }
199
- return any ? below > above ? "below" : "above" : void 0;
200
- }
201
- function segmentHitsRect(a, b, rect, pad = 0) {
202
- let x0 = rect.x - pad, y0 = rect.y - pad, x1 = rect.x + rect.w + pad, y1 = rect.y + rect.h + pad, dx = b.x - a.x, dy = b.y - a.y, t0 = 0, t1 = 1;
203
- for (let side = 0; side < 4; side++) {
204
- let p = side === 0 ? -dx : side === 1 ? dx : side === 2 ? -dy : dy, q = side === 0 ? a.x - x0 : side === 1 ? x1 - a.x : side === 2 ? a.y - y0 : y1 - a.y;
205
- if (p === 0) {
206
- if (q < 0) return !1;
207
- continue;
208
- }
209
- let t = q / p;
210
- if (p < 0 ? t0 = Math.max(t0, t) : t1 = Math.min(t1, t), t0 > t1) return !1;
211
- }
212
- return !0;
213
- }
214
- function rectHitsConvexPolygon(rect, polygon, pad = 0) {
215
- let x0 = rect.x - pad, y0 = rect.y - pad, x1 = rect.x + rect.w + pad, y1 = rect.y + rect.h + pad, corners = [{ x: x0, y: y0 }, { x: x1, y: y0 }, { x: x1, y: y1 }, { x: x0, y: y1 }], axes = [{ x: 1, y: 0 }, { x: 0, y: 1 }];
216
- return polygon.forEach((p, i) => {
217
- let q = polygon[(i + 1) % polygon.length];
218
- (p.x !== q.x || p.y !== q.y) && axes.push({ x: q.y - p.y, y: p.x - q.x });
219
- }), axes.every((axis) => {
220
- let a = corners.map((p) => p.x * axis.x + p.y * axis.y), b = polygon.map((p) => p.x * axis.x + p.y * axis.y);
221
- return Math.max(...a) > minOf(b) && maxOf(b) > Math.min(...a);
222
- });
223
- }
224
- function prepareConvexPolygon(polygon) {
225
- let axes = [[1, 0], [0, 1], ...polygon.map((p, i) => {
226
- let q = polygon[(i + 1) % polygon.length];
227
- return [q.y - p.y, p.x - q.x];
228
- })], projected = [];
229
- for (let [x, y] of axes) {
230
- if (!x && !y) continue;
231
- let min = 1 / 0, max = -1 / 0;
232
- for (let point of polygon) {
233
- let value = point.x * x + point.y * y;
234
- min = Math.min(min, value), max = Math.max(max, value);
235
- }
236
- projected.push([x, y, min, max]);
237
- }
238
- return (rect, pad) => {
239
- let x0 = rect.x - pad, y0 = rect.y - pad, x1 = rect.x + rect.w + pad, y1 = rect.y + rect.h + pad;
240
- return projected.every(([x, y, min, max]) => {
241
- let a = x0 * x + y0 * y, b = x1 * x + y0 * y, c = x1 * x + y1 * y, d = x0 * x + y1 * y;
242
- return Math.max(a, b, c, d) > min && max > Math.min(a, b, c, d);
243
- });
244
- };
245
- }
246
- var deltaGap = (labelHeight) => Math.round(labelHeight);
247
- function boxGap(a, b) {
248
- return Math.hypot(Math.max(0, b.x - (a.x + a.w), a.x - (b.x + b.w)), Math.max(0, b.y - (a.y + a.h), a.y - (b.y + b.h)));
249
- }
250
- function rectCenter(r) {
251
- return { x: r.x + r.w / 2, y: r.y + r.h / 2 };
252
- }
253
- function inflate(r, by) {
254
- return { x: r.x - by, y: r.y - by, w: r.w + 2 * by, h: r.h + 2 * by };
255
- }
256
- function boundsOf(rects) {
257
- if (rects.length === 0) return { x: 0, y: 0, w: 0, h: 0 };
258
- let x0 = 1 / 0, y0 = 1 / 0, x1 = -1 / 0, y1 = -1 / 0;
259
- for (let r of rects)
260
- x0 = Math.min(x0, r.x), y0 = Math.min(y0, r.y), x1 = Math.max(x1, r.x + r.w), y1 = Math.max(y1, r.y + r.h);
261
- return { x: x0, y: y0, w: x1 - x0, h: y1 - y0 };
262
- }
263
- function unionRect(a, b) {
264
- let x = Math.min(a.x, b.x), y = Math.min(a.y, b.y);
265
- return {
266
- x,
267
- y,
268
- w: Math.max(a.x + a.w, b.x + b.w) - x,
269
- h: Math.max(a.y + a.h, b.y + b.h) - y
270
- };
271
- }
272
- function clamp(v, lo, hi) {
273
- return v < lo ? lo : v > hi ? hi : v;
274
- }
275
- function round2(v) {
276
- return Math.round(v * 100) / 100;
154
+ // src/core/claims/ids.ts
155
+ function claimId(prefix, ...parts) {
156
+ return [prefix, ...parts.map((part) => String(part).replace(/[\\:]/g, "\\$&"))].join(":");
277
157
  }
278
- function cleanFloat(v, scale = v) {
279
- let decimals = 14 - Math.floor(Math.log10(Math.abs(scale)));
280
- if (decimals < 0 || decimals > 100) return v;
281
- let cleaned = Number(v.toFixed(decimals)) + 0;
282
- return Math.abs(cleaned - v) > 4 * Number.EPSILON * Math.abs(scale) ? v : cleaned;
158
+ var HOST_CLAIMS = /* @__PURE__ */ Symbol("boardplot.hostClaims");
159
+ function requestClaims(request, options) {
160
+ let host = options[HOST_CLAIMS];
161
+ return host ? host(request) : request.claimIds;
283
162
  }
284
- function cleanSum(terms) {
285
- let scale = 0;
286
- for (let t of terms) scale += Math.abs(t);
287
- return cleanFloat(terms.reduce((a, b) => a + b, 0), scale);
163
+ var UNPRINTED_CLAIMS = /* @__PURE__ */ Symbol("boardplot.unprintedClaims");
164
+ function unprintedClaims(geometry) {
165
+ return geometry[UNPRINTED_CLAIMS] ?? [];
288
166
  }
289
- function cleanDiff(a, b) {
290
- return cleanFloat(a - b, Math.max(Math.abs(a), Math.abs(b)));
167
+ function withUnprintedClaims(geometry, ids) {
168
+ return ids.length === 0 ? geometry : { ...geometry, [UNPRINTED_CLAIMS]: [...unprintedClaims(geometry), ...ids] };
291
169
  }
292
- function strokeBoxPad(width, dx, dy) {
293
- let r = width / 2, length = Math.hypot(dx, dy);
294
- return length === 0 ? { x: r, y: r } : { x: r * Math.abs(dy) / length, y: r * Math.abs(dx) / length };
295
- }
296
- function rowLabelX(laneX, laneW, labelW, align) {
297
- return align === "right" ? laneX + laneW - labelW : align === "center" ? laneX + (laneW - labelW) / 2 : laneX;
298
- }
299
-
300
- // src/core/types/annotations.ts
301
- function defaultAnnotationId(annotation, index) {
302
- return annotation.id ?? `${annotation.kind}-${index + 1}`;
303
- }
304
- var ANNOTATION_KIND_PURPOSES = {
305
- diff: "Draws a level-difference arrow between two anchors and computes either percent change or their signed value difference.",
306
- cagr: "Draws a growth arrow between two anchored points and computes the compound annual growth rate from their values and ISO-date span.",
307
- bracket: "Draws a bracket over an inclusive span of steps and prints the sum of their values, after an optional label.",
308
- delta: "Computes the signed difference between an anchored value and another anchor or literal, then places a collision-managed label at the first anchor.",
309
- abs: "Reads the anchored data value and places its formatted absolute value in a collision-managed label.",
310
- note: "Places authored text at an anchored data element through collision avoidance, with an optional icon or status chip.",
311
- callout: "Places authored free text at an anchored data element, routing a leader when displaced and honoring the preferred side.",
312
- valueLine: "Draws a reference line at an authored value or an engine-computed mean, with optional tolerance shading and attainment fill between the line and resolved actuals.",
313
- indicator100: "Maps 100 through the chart's value scale and draws a side tick with a 100% label.",
314
- band: "Draws an inclusive category span as a shaded band or bracket, or a value-axis plan corridor, tolerance band or attainment fill, with a collision-managed label.",
315
- event: "Places a dated event in the lane above the plot as a block with a pole to the data, or, when it does not fit, as a numbered marker with an entry in the event key below the plot; periods draw a thin bar."
316
- };
317
170
 
318
171
  // src/core/adjacentSeries.ts
319
172
  var ORDERED_STEP_FLOOR = 3, orderedRung = (sample, theme) => {
@@ -597,85 +450,6 @@ function numericVariant(role, theme) {
597
450
  return theme.type.numeric === "proportional" ? "proportional-nums" : "tabular-nums";
598
451
  }
599
452
 
600
- // src/core/label/occupied.ts
601
- var CELL = 16;
602
- function cellRange(rect, pad, range) {
603
- let x0 = Math.floor((rect.x - pad) / CELL), x1 = Math.floor((rect.x + rect.w + pad) / CELL), y0 = Math.floor((rect.y - pad) / CELL), y1 = Math.floor((rect.y + rect.h + pad) / CELL);
604
- if (x0 <= x1 && y0 <= y1 && (x1 - x0 + 1) * (y1 - y0 + 1) <= 256 && Math.max(-x0, x1, -y0, y1) < 32768)
605
- return range[0] = x0, range[1] = x1, range[2] = y0, range[3] = y1, range;
606
- }
607
- function createOccupiedIndex(_plot) {
608
- let rects = [], scratchRange = [0, 0, 0, 0], released = /* @__PURE__ */ new Set(), cells = /* @__PURE__ */ new Map(), wide = [], polygonTests = [], hit = (index, rect, pad) => {
609
- let claim = rects[index];
610
- return rectsOverlap(claim.rect, rect, pad) && (claim.polygon === void 0 || (polygonTests[index] ??= prepareConvexPolygon(claim.polygon))(rect, pad));
611
- }, seen = [], stamp = 0, visiting = !1, visitNear = (rect, pad, visit) => {
612
- if (visiting) throw new Error("occupied index: a query ran inside another query's callback");
613
- visiting = !0;
614
- try {
615
- return visitClaims(rect, pad, visit);
616
- } finally {
617
- visiting = !1;
618
- }
619
- }, visitClaims = (rect, pad, visit) => {
620
- let range = cellRange(rect, pad, scratchRange);
621
- if (range === void 0) {
622
- for (let i = 0; i < rects.length; i++) if (visit(i)) return !0;
623
- return !1;
624
- }
625
- let [x0, x1, y0, y1] = range;
626
- stamp++;
627
- for (let w = 0; w < wide.length; w++) if (visit(wide[w])) return !0;
628
- for (let x = x0; x <= x1; x++)
629
- for (let y = y0; y <= y1; y++) {
630
- let cell = cells.get(x * 65536 + y);
631
- if (cell !== void 0)
632
- for (let c = 0; c < cell.length; c++) {
633
- let i = cell[c];
634
- if (seen[i] !== stamp && (seen[i] = stamp, visit(i)))
635
- return !0;
636
- }
637
- }
638
- return !1;
639
- };
640
- return {
641
- claim(rect, kind, owner, part, polygon) {
642
- let claimed = part === void 0 ? { rect: { ...rect }, kind, owner } : { rect: { ...rect }, kind, owner, part };
643
- polygon !== void 0 && (claimed.polygon = polygon.map((point) => ({ ...point })));
644
- let index = rects.push(claimed) - 1, range = cellRange(rect, 0, scratchRange);
645
- if (range === void 0) wide.push(index);
646
- else {
647
- let [x0, x1, y0, y1] = range;
648
- for (let x = x0; x <= x1; x++) for (let y = y0; y <= y1; y++) {
649
- let key = x * 65536 + y, cell = cells.get(key);
650
- cell === void 0 ? cells.set(key, [index]) : cell.push(index);
651
- }
652
- }
653
- },
654
- hits(rect, pad = 0, skip) {
655
- return visitNear(rect, pad, (i) => !skip?.(rects[i]) && hit(i, rect, pad));
656
- },
657
- some(rect, pad, test) {
658
- return visitNear(rect, pad, (i) => hit(i, rect, pad) && test(rects[i]));
659
- },
660
- hitsWhich(rect, pad = 0, skip) {
661
- let found = [];
662
- return visitNear(rect, pad, (i) => (!skip?.(rects[i]) && hit(i, rect, pad) && found.push(i), !1)), found.sort((a, b) => a - b).map((i) => rects[i]);
663
- },
664
- snapshot() {
665
- let copy = (entry) => ({ ...entry, rect: { ...entry.rect } });
666
- if (released.size === 0) return rects.map(copy);
667
- let kept = [];
668
- return rects.forEach((entry, index) => {
669
- released.has(index) || kept.push(copy(entry));
670
- }), kept;
671
- },
672
- release(claim) {
673
- let index = rects.indexOf(claim);
674
- index < 0 || (released.add(index), claim.rect = { x: -1e9, y: -1e9, w: 0, h: 0 }, claim.polygon = void 0);
675
- }
676
- };
677
- }
678
-
679
453
  // src/core/label/ownership.ts
680
454
  function circleGap(rect, m) {
681
455
  let dx = Math.max(rect.x - m.cx, 0, m.cx - rect.x - rect.w), dy = Math.max(rect.y - m.cy, 0, m.cy - rect.y - rect.h);
@@ -793,9 +567,12 @@ function labelCtx(theme, size, options, rest) {
793
567
  focus: options.focus,
794
568
  density: options.labelDensity ?? "smart",
795
569
  pins: options.labelPlacements ?? {},
570
+ labelOffsets: options.labelOffsets,
796
571
  canvas: { x: 0, y: 0, w: size.width, h: size.height },
797
572
  darkInk: theme.color.ink,
798
573
  lightInk: theme.color.inkInverse,
574
+ // A host chart names the claims of this delegate's labels (claims/ids.ts).
575
+ ...HOST_CLAIMS in options ? { [HOST_CLAIMS]: options[HOST_CLAIMS] } : {},
799
576
  ...rest
800
577
  };
801
578
  }
@@ -805,8 +582,24 @@ function dropsFromRow(row, index) {
805
582
  return row.mode === "none" ? !(row.keepEnds && (index === 0 || index === last)) : (last - index) % 2 !== 0;
806
583
  }
807
584
  function solveLabels(requests, occupied, ctx) {
585
+ if (ctx.labelOffsets && !ctx.naturalSeats && Object.keys(ctx.labelOffsets).length > 0) {
586
+ let probe = createOccupiedIndex(ctx.plot);
587
+ probe.tickColumns = occupied.tickColumns;
588
+ for (let claim of occupied.snapshot()) probe.claim(claim.rect, claim.kind, claim.owner, claim.part, claim.polygon);
589
+ let natural = solveLabels(requests, probe, { ...ctx, labelOffsets: void 0 });
590
+ ctx = { ...ctx, naturalSeats: new Map(natural.placed.flatMap((label) => label.hidden ? [] : [[label.id, label.rect]])) };
591
+ }
808
592
  if (!ctx.valueRows?.length) return solveLabelPass(requests, occupied, ctx);
809
- let initial = occupied.snapshot(), pinned = new Set(requests.filter((req) => req.pinnedSlot ?? ctx.pins[req.id]).map((req) => req.id)), rows = ctx.valueRows.map((row) => ({ ...row, eligible: [], mode: "all", reason: "" })), dropped = /* @__PURE__ */ new Set();
593
+ let initial = occupied.snapshot(), pinned = new Set(requests.filter((req) => req.pinnedSlot ?? ctx.pins[req.id]).map((req) => req.id)), held = new Set(requests.filter((req) => pinned.has(req.id) || ctx.density === "minimal" && req.keepWhenDense).map((req) => req.id)), rows = ctx.valueRows.map((row) => ({ ...row, eligible: [], mode: row.from ?? "all", reason: "" })), dropped = /* @__PURE__ */ new Set();
594
+ for (let row of rows) if (row.mode !== "all") {
595
+ let byId = new Map(requests.map((req) => [req.id, req]));
596
+ row.eligible = row.ids.filter((id) => {
597
+ let req = byId.get(id);
598
+ return req && !(req.redundant && req.suppressedAs !== "density");
599
+ }), row.reason = `computed row ${row.mode === "alternate" ? "uses alternate values from the end" : "omitted"}; the full row needs a wider plot`, row.eligible.forEach((id, index) => {
600
+ !held.has(id) && dropsFromRow(row, index) && dropped.add(id);
601
+ });
602
+ }
810
603
  if (rows.length === 1 && pinned.size === 0 && ctx.density !== "minimal" && !ctx.seriesUniform && !requests.some((req) => req.printedIn)) {
811
604
  let row = rows[0], byId = new Map(requests.map((req) => [req.id, req]));
812
605
  if (byId.size === requests.length && new Set(row.ids).size === row.ids.length)
@@ -835,7 +628,7 @@ function solveLabels(requests, occupied, ctx) {
835
628
  }));
836
629
  let failed = row.eligible.filter((id) => !dropped.has(id) && byId.get(id)?.hidden);
837
630
  row.eligible.length < 2 || failed.length === 0 || (row.mode = row.mode === "all" && row.alternate ? "alternate" : "none", row.reason = `computed row ${row.mode === "alternate" ? "uses alternate values from the end" : "omitted"}; unplaced: ${failed.join(", ")}`, row.eligible.forEach((id, index) => {
838
- pinned.has(id) || (dropsFromRow(row, index) ? dropped.add(id) : dropped.delete(id));
631
+ held.has(id) || (dropsFromRow(row, index) ? dropped.add(id) : dropped.delete(id));
839
632
  }), retry = !0);
840
633
  }
841
634
  if (retry) continue;
@@ -854,8 +647,8 @@ function anyHit(occupied, rect, pad, test) {
854
647
  return occupied.some ? occupied.some(rect, pad, test) : occupied.hitsWhich(rect, pad).some(test);
855
648
  }
856
649
  function solveLabelPass(requests, occupied, ctx) {
857
- let placed = [], decisions = [], warnings = [], hiddenWarningByLabel = /* @__PURE__ */ new Map(), printedIn = new Map(requests.flatMap((req) => req.printedIn ? [[req.id, req.printedIn]] : [])), pad = ctx.labelPad ?? 2, darkInk = ctx.darkInk ?? "#111827", lightInk = ctx.lightInk ?? "#ffffff", pinOf = (r) => r.pinnedSlot ?? ctx.pins[r.id], ownership = ctx.pointOwnership ? pointOwnership(ctx.pointOwnership) : void 0, owned = ownership ? withOwnedSeats(requests, ownership, pinOf) : requests, ownedPoint = (req) => req.kind === "point" && ownership?.pointOf(req.owner.seriesId, req.owner.categoryId) !== void 0, ownershipLimited = new Set(owned.flatMap((req, i) => req !== requests[i] ? [req.id] : [])), order = [...owned].sort(labelOrder(pinOf, ctx.focus)), leaderRuns = [], keepOffLeader = (label, req) => {
858
- req.leaderAvoidsLabels && label.leader && leaderRuns.push(...leaderPieces(label.leader.d, 64));
650
+ let placed = [], decisions = [], warnings = [], hiddenWarningByLabel = /* @__PURE__ */ new Map(), printedIn = new Map(requests.flatMap((req) => req.printedIn ? [[req.id, req.printedIn]] : [])), pad = ctx.labelPad ?? 2, darkInk = ctx.darkInk ?? "#111827", lightInk = ctx.lightInk ?? "#ffffff", pinOf = (r) => r.pinnedSlot ?? ctx.pins[r.id], ownership = ctx.pointOwnership ? pointOwnership(ctx.pointOwnership) : void 0, owned = ownership ? withOwnedSeats(requests, ownership, pinOf) : requests, ownedPoint = (req) => req.kind === "point" && ownership?.pointOf(req.owner.seriesId, req.owner.categoryId) !== void 0, ownershipLimited = new Set(owned.flatMap((req, i) => req !== requests[i] ? [req.id] : [])), order = [...owned].sort(labelOrder(pinOf, ctx.focus)), leaderRuns = [], moved = [], ownRooms = /* @__PURE__ */ new Map(), keepOffLeader = (label, req) => {
651
+ req.leaderAvoidsLabels && label.leader && !moved.includes(label.id) && leaderRuns.push(...leaderPieces(label.leader.d, 64));
859
652
  }, onLeader = (rect, padding) => leaderRuns.some(([a, b]) => segmentHitsRect(a, b, rect, padding));
860
653
  for (let queued of order) {
861
654
  let runClear = (from, to) => occupied.hitsWhich({ x: from.x - 0.5, y: Math.min(from.y, to) + 0.5, w: 1, h: Math.max(0, Math.abs(to - from.y) - 1) }, 0).every((o) => o.kind !== "mark" || isOwnMark(o.owner, queued.owner, queued.kind, o.part)), req = withLiftLeaders(queued, ownedPoint(queued), runClear), slots = req.candidates.map((c) => c.slot), first = req.candidates[0], markValue = isMarkValue(req), naturals = naturalSeats(req), withinMarkBand = (cand) => {
@@ -869,20 +662,46 @@ function solveLabelPass(requests, occupied, ctx) {
869
662
  }, selfAnn = req.owner.annotationId, blocks = /* @__PURE__ */ new Map(), crowdsSeriesValue = (cand) => cand.insideFill === void 0 ? crowdsSeries(cand.rect) : req.kind === "segment" && crowdsSeries(cand.rect, !0), marksTouch = (a, b) => {
870
663
  let [left, right] = a.x <= b.x ? [a, b] : [b, a], x = (left.x + left.w + right.x) / 2, y = (Math.max(a.y, b.y) + Math.min(a.y + a.h, b.y + b.h)) / 2;
871
664
  return anyHit(occupied, { x: x - 0.5, y: y - 0.5, w: 1, h: 1 }, 0, (o) => o.kind === "mark");
872
- }, outsideSegment = (touching) => req.kind === "segment" && !touching, crowdsTotal = (rect) => TOTAL_KINDS.has(req.kind) && anyHit(occupied, rect, SERIES_VALUE_GAP, (o) => o.kind === "label" && o.part === TOTAL_PART && o.owner.seriesId === req.owner.seriesId && o.owner.categoryId !== void 0 && o.owner.categoryId !== req.owner.categoryId && Math.min(o.rect.y + o.rect.h, rect.y + rect.h) - Math.max(o.rect.y, rect.y) >= rect.h / Math.max(1, req.lines.length) / 2 - 0.1), crowdsSeries = (rect, touching = !1) => crowdsTotal(rect) || (req.kind === "point" || req.kind === "segment") && (req.owner.seriesId !== void 0 || req.valueRow === !0 || outsideSegment(touching)) && occupied.hitsWhich(rect, SERIES_VALUE_GAP).some((o) => o.kind === "label" && (outsideSegment(touching) || o.owner.seriesId === req.owner.seriesId) && o.owner.categoryId !== void 0 && o.owner.categoryId !== req.owner.categoryId && Math.min(o.rect.y + o.rect.h, rect.y + rect.h) > Math.max(o.rect.y, rect.y) && (!touching || marksTouch(rect, o.rect))), inTickColumn = (rect, air = 0) => ["point", "segment", "total", "grandTotal"].includes(req.kind) && (occupied.tickColumns?.some((column) => rectsOverlap(column, rect, air)) ?? !1), blockAt = (index, padding) => {
873
- let key = `${index}:${padding}`, cached = blocks.get(key);
874
- if (cached) return cached;
875
- let { rect, overColumns, overRules, overLegend } = req.candidates[index], value = "free";
876
- if (!withinMarkBand(req.candidates[index]) || ctx.canvas && !rectContains(ctx.canvas, rect, 0))
665
+ }, outsideSegment = (touching) => req.kind === "segment" && !touching, crowdsTotal = (rect) => TOTAL_KINDS.has(req.kind) && anyHit(occupied, rect, SERIES_VALUE_GAP, (o) => o.kind === "label" && o.part === TOTAL_PART && o.owner.seriesId === req.owner.seriesId && o.owner.categoryId !== void 0 && o.owner.categoryId !== req.owner.categoryId && Math.min(o.rect.y + o.rect.h, rect.y + rect.h) - Math.max(o.rect.y, rect.y) >= rect.h / Math.max(1, req.lines.length) / 2 - 0.1), crowdsSeries = (rect, touching = !1) => crowdsTotal(rect) || (req.kind === "point" || req.kind === "segment") && (req.owner.seriesId !== void 0 || req.valueRow === !0 || outsideSegment(touching)) && occupied.hitsWhich(rect, SERIES_VALUE_GAP).some((o) => o.kind === "label" && (outsideSegment(touching) || o.owner.seriesId === req.owner.seriesId) && o.owner.categoryId !== void 0 && o.owner.categoryId !== req.owner.categoryId && Math.min(o.rect.y + o.rect.h, rect.y + rect.h) > Math.max(o.rect.y, rect.y) && (!touching || marksTouch(rect, o.rect))), inTickColumn = (rect, air = 0) => ["point", "segment", "total", "grandTotal"].includes(req.kind) && (occupied.tickColumns?.some((column) => rectsOverlap(column, rect, air)) ?? !1), blockOf = (cand, padding, isMoved = !1) => {
666
+ let { rect, overColumns, overRules, overLegend } = cand, value = "free";
667
+ if (!isMoved && !withinMarkBand(cand) || ctx.canvas && !rectContains(ctx.canvas, rect, 0))
877
668
  value = "hard";
878
669
  else {
879
670
  let sawLabel = !1;
880
- anyHit(occupied, rect, padding, (o) => o.kind === "annotation" && selfAnn && o.owner.annotationId === selfAnn || overRules && (o.part === "referenceLine" || o.part === CROSSABLE_RULE_PART) || req.candidates[index].overValueLines && isValueLine(o) || overLegend && o.kind === "legend" || o.kind === "mark" && (isOwnMark(o.owner, req.owner, req.kind, o.part) || overColumns && isColumnPart(o.part) && rectContains(o.rect, rect, 0)) || o.kind === "mark" && o.part === AREA_FILL_PART && req.candidates[index].onFill?.seriesId === o.owner.seriesId || req.ownStrokeClear && o.kind === "mark" && (o.part === void 0 || o.part === AREA_FILL_PART) && !o.polygon && o.owner.seriesId === req.owner.seriesId && !rectsOverlap(o.rect, rect) || o.kind === "mark" && req.owner.seriesId !== void 0 && o.owner.seriesId === req.owner.seriesId && req.candidates[index].slot.startsWith("inside") && (req.candidates[index].slot.startsWith("insideBand") || !rectsOverlap(o.rect, rect, 0)) || o.kind === "mark" && o.part === AREA_FILL_PART && (req.candidates[index].slot.startsWith("insideBand") || req.candidates[index].insideFill !== void 0) ? !1 : o.kind === "label" ? (sawLabel = !0, !1) : !0) ? value = "hard" : sawLabel && (value = "label"), value !== "hard" && inTickColumn(rect, req.candidates[index].tickAir) && (value = "hard");
881
- let tickAir = req.candidates[index].tickAir;
882
- value !== "hard" && tickAir && anyHit(occupied, rect, tickAir, (o) => o.kind === "axis" && o.rect.w > 2 && o.rect.h > 2) && (value = "hard"), value === "free" && onLeader(rect, padding) && (value = "label"), value === "free" && pinOf(req) !== req.candidates[index].slot && crowdsSeriesValue(req.candidates[index]) && (value = "label");
671
+ anyHit(occupied, rect, padding, (o) => o.kind === "annotation" && selfAnn && o.owner.annotationId === selfAnn && (!isMoved || o.part === "bracketLabel" || !rectsOverlap(o.rect, rect, 0)) || overRules && (o.part === "referenceLine" || o.part === CROSSABLE_RULE_PART) || cand.overValueLines && isValueLine(o) || overLegend && o.kind === "legend" || o.kind === "mark" && (isOwnMark(o.owner, req.owner, req.kind, o.part) && (!cand.keepOffLines || o.part === void 0 || isColumnPart(o.part)) || overColumns && isColumnPart(o.part) && rectContains(o.rect, rect, 0)) || o.kind === "mark" && o.part === AREA_FILL_PART && cand.onFill?.seriesId === o.owner.seriesId || req.ownStrokeClear && o.kind === "mark" && (o.part === void 0 || o.part === AREA_FILL_PART) && !o.polygon && o.owner.seriesId === req.owner.seriesId && !rectsOverlap(o.rect, rect) || o.kind === "mark" && req.owner.seriesId !== void 0 && o.owner.seriesId === req.owner.seriesId && cand.slot.startsWith("inside") && (cand.slot.startsWith("insideBand") || !rectsOverlap(o.rect, rect, 0)) || o.kind === "mark" && o.part === AREA_FILL_PART && (cand.slot.startsWith("insideBand") || cand.insideFill !== void 0) ? !1 : o.kind === "label" ? (sawLabel = !0, !1) : !0) ? value = "hard" : sawLabel && (value = "label"), value !== "hard" && inTickColumn(rect, cand.tickAir) && (value = "hard");
672
+ let tickAir = cand.tickAir;
673
+ if (value !== "hard" && tickAir && anyHit(occupied, rect, tickAir, (o) => o.kind === "axis" && o.rect.w > 2 && o.rect.h > 2) && (value = "hard"), value === "free" && onLeader(rect, padding) && (value = "label"), value === "free" && isMoved && ctx.naturalSeats)
674
+ for (let [id, seat] of ctx.naturalSeats) id !== req.id && rectsOverlap(seat, rect, padding) && (value = "label");
675
+ value === "free" && pinOf(req) !== cand.slot && crowdsSeriesValue(cand) && (value = "label");
883
676
  }
677
+ return value;
678
+ }, blockAt = (index, padding) => {
679
+ let key = `${index}:${padding}`, cached = blocks.get(key);
680
+ if (cached) return cached;
681
+ let value = blockOf(req.candidates[index], padding);
884
682
  return blocks.set(key, value), value;
885
- }, pinnableSlots = () => req.candidates.flatMap((c, i) => blockAt(i, 0) === "hard" ? [] : [c.slot]), base = {
683
+ }, offset = ctx.labelOffsets?.[req.id], ownBar = (cand) => {
684
+ if (!MOVED_VALUE_KINDS.has(req.kind)) return;
685
+ let best;
686
+ for (let o of occupied.hitsWhich(cand.rect, OWN_BAR_REACH))
687
+ o.kind !== "mark" || !isColumnPart(o.part) || !isOwnMark(o.owner, req.owner, req.kind, o.part) || (!best || boxGap(o.rect, cand.rect) < boxGap(best.rect, cand.rect)) && (best = o);
688
+ return best?.rect;
689
+ }, movedSeat = (cand, move) => {
690
+ let rect = { ...cand.rect, x: cand.rect.x + (move.x ?? 0), y: cand.rect.y + (move.y ?? 0) }, bar = ownBar(cand);
691
+ bar && (cand.insideFill !== void 0 || cand.onFill) && rectContains(bar, rect, 0) && !rectContains(bar, rect, INSIDE_PAD) && rect.w <= bar.w - 2 * INSIDE_PAD && rect.h <= bar.h - 2 * INSIDE_PAD && (rect = { ...rect, x: Math.min(Math.max(rect.x, bar.x + INSIDE_PAD), bar.x + bar.w - INSIDE_PAD - rect.w), y: Math.min(Math.max(rect.y, bar.y + INSIDE_PAD), bar.y + bar.h - INSIDE_PAD - rect.h) });
692
+ let ownMarks = occupied.hitsWhich(rect, 0).filter((o) => o.kind === "mark" && isOwnMark(o.owner, req.owner, req.kind, o.part)), seat = { ...cand, rect };
693
+ if (cand.insideFill !== void 0 || cand.onFill ? ownMarks.some((o) => rectContains(o.rect, rect, 0)) || (delete seat.insideFill, delete seat.insidePaint, delete seat.insideMatrix, delete seat.insidePattern, delete seat.onFill, seat.needsBacking = !0) : ownMarks.length > 0 && (seat.needsBacking = !0), !seat.leaderFrom && !req.noLeader && Math.hypot(move.x ?? 0, move.y ?? 0) >= MOVED_LEADER_MIN && !ownMarks.some((o) => rectContains(o.rect, rect, 0)))
694
+ if (bar) {
695
+ let run = movedValueRun(bar, rect);
696
+ run === "beside" ? seat.besideBar = !0 : run !== "over" && (seat.leaderFrom = run.from, seat.leaderTo = run.to);
697
+ } else
698
+ seat.leaderFrom = req.anchor ? nearestPointOf(anchorBox(req.anchor), rect) : req.movedLeaderFrom ?? movedLeaderStart(cand.rect, move), seat.leaderVertical = !0;
699
+ return seat;
700
+ }, moveIsFree = (seat, padding) => !seat.besideBar && blockOf(seat, padding, !0) === "free", settled = (cand, padding) => {
701
+ if (!offset) return cand;
702
+ let seat = movedSeat(cand, offset);
703
+ return moveIsFree(seat, padding) ? (moved.push(req.id), seat) : (warnings.push(offsetBlockedWarning(req, seat, occupied, padding, selfAnn, ctx)), cand);
704
+ }, pinnableSlots = () => req.candidates.flatMap((c, i) => blockAt(i, 0) === "hard" ? [] : [c.slot]), claimIds = requestClaims(req, ctx), base = {
886
705
  id: req.id,
887
706
  kind: req.kind,
888
707
  typeRole: labelTypeRole(req),
@@ -892,7 +711,7 @@ function solveLabelPass(requests, occupied, ctx) {
892
711
  slots,
893
712
  pinned: !1,
894
713
  priority: req.priority,
895
- ...req.claimId ? { claimId: req.claimId, claimText: req.claimText } : {},
714
+ ...claimIds?.length ? { claimIds, claimText: req.claimText } : {},
896
715
  ...req.noteText ? { noteText: req.noteText } : {},
897
716
  ...req.printsFor ? { printsFor: req.printsFor } : {},
898
717
  ...req.owed ? { owed: !0 } : {},
@@ -927,6 +746,7 @@ function solveLabelPass(requests, occupied, ctx) {
927
746
  severity: req.priority >= REQUIRED_VALUE_PRIORITY ? "warn" : "info",
928
747
  message: `label '${req.id}' with text '${req.text}' (priority ${req.priority}, owner ${formatOwner(req.owner)}) was hidden: ${decisionReason}`,
929
748
  owner: req.owner,
749
+ detail: { labelId: req.id },
930
750
  suggest: slots.length === 0 ? "increase chart size or provide a placement candidate" : pinnable.length > 0 ? `increase chart size, or pin '${req.id}' to a slot a pin can actually take (${pinnable.join(", ")})` + (pinnable.length < slots.length ? " \u2014 the other candidates are blocked by marks, annotations or the canvas edge, which pinning cannot move" : "") : `increase chart size or lower label density \u2014 every candidate slot (${slots.join(", ")}) is blocked by marks, annotations or the canvas edge, which pinning cannot move`
931
751
  }), hiddenWarningByLabel.set(req.id, warnings[warnings.length - 1]);
932
752
  }
@@ -957,8 +777,8 @@ function solveLabelPass(requests, occupied, ctx) {
957
777
  suggest: slots.join(", ")
958
778
  });
959
779
  else if (blockAt(index, 0) === "free" && (req.leaderClear !== "includingPins" || !leaderFor(req.candidates[index]) || !leaderPieces(leaderFor(req.candidates[index]).d).some(([a, b]) => occupied.hitsWhich(pieceBox(a, b), 0).some((o) => o.kind === "label" && segmentHitsRect(a, b, o.rect))))) {
960
- let cand = req.candidates[index], label = finalize(base, req, cand, !0, darkInk, lightInk);
961
- if (placed.push(label), occupied.claim(cand.rect, "label", req.owner, TOTAL_KINDS.has(req.kind) ? TOTAL_PART : void 0), req.leaderClear === "includingPins" && label.leader) for (let [a, b] of leaderPieces(label.leader.d)) occupied.claim(pieceBox(a, b), "label", req.owner);
780
+ let cand = settled(req.candidates[index], 0), label = finalize(base, req, cand, !0, darkInk, lightInk);
781
+ if (placed.push(label), occupied.claim(cand.rect, "label", req.owner, TOTAL_KINDS.has(req.kind) ? TOTAL_PART : void 0), req.leaderClear === "includingPins" && label.leader && !moved.includes(req.id)) for (let [a, b] of leaderPieces(label.leader.d)) occupied.claim(pieceBox(a, b), "label", req.owner);
962
782
  keepOffLeader(label, req), decisions.push({
963
783
  labelId: req.id,
964
784
  strategy: "candidatesOccupied",
@@ -984,7 +804,7 @@ function solveLabelPass(requests, occupied, ctx) {
984
804
  continue;
985
805
  }
986
806
  let note = (reason) => refusedPin === void 0 ? reason : `pin '${refusedPin}' blocked; ${reason}`, tried = [], done = !1, crossesLabel = (leader) => !!(req.leaderClear || req.leaderAvoidsLabels) && leader !== void 0 && leaderPieces(leader.d, req.leaderAvoidsLabels ? 64 : 8).some(([a, b]) => occupied.hitsWhich(pieceBox(a, b), 0).some((o) => (o.kind === "label" || req.leaderClearsAxis && o.kind === "axis") && segmentHitsRect(a, b, o.rect))), claimLeader = (label) => {
987
- if (req.leaderClear && label.leader) for (let [a, b] of leaderPieces(label.leader.d)) occupied.claim(pieceBox(a, b), "label", req.owner);
807
+ if (req.leaderClear && label.leader && !moved.includes(req.id)) for (let [a, b] of leaderPieces(label.leader.d)) occupied.claim(pieceBox(a, b), "label", req.owner);
988
808
  keepOffLeader(label, req);
989
809
  }, crowds = (cand) => req.labelGap !== void 0 && anyHit(occupied, cand.rect, req.labelGap, (o) => o.kind === "label" && !sameOwner(o.owner, req.owner)), indices = req.candidates.map((_, i) => i), crowded = indices.map((i) => crowds(req.candidates[i])), order2 = req.labelGap === void 0 ? indices : [...indices].sort((a, b) => req.candidates[a].penalty - req.candidates[b].penalty || Number(crowded[a]) - Number(crowded[b]) || a - b), ambiguous = [], place = (cand, reason, leader) => {
990
810
  let label = finalize(base, req, cand, !1, darkInk, lightInk);
@@ -1001,13 +821,13 @@ function solveLabelPass(requests, occupied, ctx) {
1001
821
  cand.onFill || ambiguous.push(cand);
1002
822
  continue;
1003
823
  }
1004
- place(cand, tried.length === 1 ? "first candidate free" : `candidate ${tried.length} free`), done = !0;
824
+ place(settled(cand, cand.pad ?? req.pad ?? pad), tried.length === 1 ? "first candidate free" : `candidate ${tried.length} free`), done = !0;
1005
825
  break;
1006
826
  }
1007
827
  }
1008
828
  if (!done) {
1009
829
  if (crossing && req.leaderAvoidsLabels) {
1010
- place(crossing, "every free seat draws its leader across a label"), warnings.push({
830
+ place(settled(crossing, crossing.pad ?? req.pad ?? pad), "every free seat draws its leader across a label"), warnings.push({
1011
831
  code: "label-leader-crossing",
1012
832
  severity: "warn",
1013
833
  message: `label '${req.id}': every free seat draws its leader across a label`,
@@ -1019,24 +839,45 @@ function solveLabelPass(requests, occupied, ctx) {
1019
839
  if (req.anchor && !req.noLeader && ambiguous.length > 0) {
1020
840
  let box = anchorBox(req.anchor), anchorFor = (rect) => ({ x: Math.max(box.x, Math.min(rect.x + rect.w / 2, box.x + box.w)), y: Math.max(box.y, Math.min(rect.y + rect.h / 2, box.y + box.h)) }), led = ambiguous.find((cand) => anchorLeader(cand.rect, anchorFor(cand.rect)) && !leaderExceedsLimit(req, { ...cand, leaderFrom: anchorFor(cand.rect) }) && !crossesLabel(anchorLeader(cand.rect, anchorFor(cand.rect))));
1021
841
  if (led) {
1022
- let leader = anchorLeader(led.rect, anchorFor(led.rect));
1023
- place(led, "nearer another mark: leader from its anchor", leader);
1024
- let [x, y] = leader.d.trim().split(/[\s,A-Za-z]+/).filter(Boolean).slice(-2).map(Number), reach = LEADER_GUTTER_RATIO * led.rect.h;
1025
- occupied.claim({ x: x - reach, y: y - reach, w: 2 * reach, h: 2 * reach }, "label", req.owner);
1026
- } else place(ambiguous[0], "nearer another mark; too close to its anchor for a leader");
842
+ let seat = settled(led, led.pad ?? req.pad ?? pad), leader = anchorLeader(seat.rect, anchorFor(seat.rect)) ?? anchorLeader(led.rect, anchorFor(led.rect));
843
+ place(seat, "nearer another mark: leader from its anchor", leader);
844
+ let [x, y] = leader.d.trim().split(/[\s,A-Za-z]+/).filter(Boolean).slice(-2).map(Number), reach = LEADER_GUTTER_RATIO * led.rect.h, room = { x: x - reach, y: y - reach, w: 2 * reach, h: 2 * reach };
845
+ occupied.claim(room, "label", req.owner), moved.includes(req.id) && ownRooms.set(req.id, room);
846
+ } else place(settled(ambiguous[0], ambiguous[0].pad ?? req.pad ?? pad), "nearer another mark; too close to its anchor for a leader");
1027
847
  continue;
1028
848
  }
1029
849
  {
1030
- let across = req.candidates.findIndex((cand) => (!req.noLeader || !cand.leaderFrom && (!req.anchor || !nearerOtherMark(req, cand, occupied, ctx.pointOwnership !== void 0))) && withinMarkBand(cand) && !cand.insideFill && !leaderExceedsLimit(req, cand) && !crossesLabel(leaderFor(cand)) && (!ctx.canvas || rectContains(ctx.canvas, cand.rect, 0)) && !onLeader(cand.rect, req.pad ?? pad) && !crowdsSeriesValue(cand) && !inTickColumn(cand.rect) && !anyHit(occupied, cand.rect, req.pad ?? pad, (o) => !(o.part === "trendLine" || o.part === "zeroLine" || req.protect === !0 && o.part === "referenceLine" || o.kind === "mark" && isOwnMark(o.owner, req.owner, req.kind, o.part))));
850
+ let across = req.candidates.findIndex((cand) => !cand.keepOffLines && (!req.noLeader || !cand.leaderFrom && (!req.anchor || !nearerOtherMark(req, cand, occupied, ctx.pointOwnership !== void 0))) && withinMarkBand(cand) && !cand.insideFill && !leaderExceedsLimit(req, cand) && !crossesLabel(leaderFor(cand)) && (!ctx.canvas || rectContains(ctx.canvas, cand.rect, 0)) && !onLeader(cand.rect, req.pad ?? pad) && !crowdsSeriesValue(cand) && !inTickColumn(cand.rect) && !anyHit(occupied, cand.rect, req.pad ?? pad, (o) => !(o.part === "trendLine" || o.part === "zeroLine" || req.protect === !0 && o.part === "referenceLine" || o.kind === "mark" && isOwnMark(o.owner, req.owner, req.kind, o.part))));
1031
851
  if (across >= 0) {
1032
- let cand = req.candidates[across], label = finalize(base, req, cand, !1, darkInk, lightInk);
852
+ let cand = settled(req.candidates[across], req.pad ?? pad), label = finalize(base, req, cand, !1, darkInk, lightInk);
1033
853
  label.halo = !0, placed.push(label), occupied.claim(cand.rect, "label", req.owner, TOTAL_KINDS.has(req.kind) ? TOTAL_PART : void 0), claimLeader(label), decisions.push({ labelId: req.id, strategy: "candidatesOccupied", tried, chose: cand.slot, reason: note(req.protect ? "highlighted value crosses a reference line" : "label crosses a trend or zero line") });
1034
854
  continue;
1035
855
  }
1036
856
  }
857
+ if (offset && first && !(req.noLeader && first.leaderFrom)) {
858
+ let seat = movedSeat(first, offset);
859
+ if (moveIsFree(seat, first.pad ?? req.pad ?? pad)) {
860
+ moved.push(req.id), place(seat, "every seat is taken; the moved first seat is free");
861
+ continue;
862
+ }
863
+ }
1037
864
  hide("collision", note(ownershipLimited.has(req.id) && req.candidates.length === 0 ? "no seat reads as its own point's value" : `all ${req.candidates.length} candidates collide${req.maxLeaderLength === void 0 ? "" : " or exceed the leader limit"}`));
1038
865
  }
1039
866
  }
867
+ for (let id of moved) {
868
+ let label = placed.find((entry) => entry.id === id);
869
+ if (!label?.leader) continue;
870
+ let pieces = leaderPieces(label.leader.d);
871
+ if (pieces.some(([a, b]) => occupied.hitsWhich(pieceBox(a, b), 0).some((o) => o.kind === "label" && !sameRect(o.rect, label.rect) && !(ownRooms.has(id) && sameRect(o.rect, ownRooms.get(id))) && segmentHitsRect(a, b, o.rect))))
872
+ delete label.leader, warnings.push({
873
+ code: "label-offset-blocked",
874
+ severity: "warn",
875
+ message: `labelOffsets moves label '${id}' so that its leader would cross text, so the label draws no leader`,
876
+ owner: label.owner,
877
+ suggest: "Use a smaller or another offset."
878
+ });
879
+ else for (let [a, b] of pieces) occupied.claim(pieceBox(a, b), "label", label.owner);
880
+ }
1040
881
  if (ctx.seriesUniform) {
1041
882
  let kinds = new Set(ctx.seriesUniform.kinds), maxShare = ctx.seriesUniform.maxHiddenShare ?? 0.25, groups = /* @__PURE__ */ new Map();
1042
883
  for (let label of placed) {
@@ -1162,15 +1003,56 @@ function withOwnedSeats(requests, model, pinOf) {
1162
1003
  return changed ? { ...req, candidates: [...kept.filter((cand) => !last(cand)), ...led, ...kept.filter(last)], ...led.length > 0 && !req.leaderClear ? { leaderClear: !0 } : {} } : req;
1163
1004
  });
1164
1005
  }
1006
+ function nearestPointOf(rect, other) {
1007
+ let nearest = (low, size, otherLow, otherSize) => {
1008
+ let from = Math.max(low, otherLow), to = Math.min(low + size, otherLow + otherSize);
1009
+ return from <= to ? (from + to) / 2 : otherLow > low ? low + size : low;
1010
+ };
1011
+ return { x: nearest(rect.x, rect.w, other.x, other.w), y: nearest(rect.y, rect.h, other.y, other.h) };
1012
+ }
1013
+ function sameRect(a, b) {
1014
+ return a.x === b.x && a.y === b.y && a.w === b.w && a.h === b.h;
1015
+ }
1016
+ var MOVED_LEADER_MIN = 12, MOVED_VALUE_KINDS = /* @__PURE__ */ new Set(["point", "segment", "total", "grandTotal"]), OWN_BAR_REACH = 8, INSIDE_PAD = 4, MOVED_LEADER_MIN_SLOPE = 0.5;
1017
+ function movedValueRun(bar, rect) {
1018
+ let gutter = LEADER_GUTTER_RATIO * rect.h, above = rect.y + rect.h / 2 < bar.y + bar.h / 2, to = { x: rect.x + rect.w / 2, y: above ? rect.y + rect.h + gutter : rect.y - gutter }, from = { x: Math.min(Math.max(to.x, bar.x), bar.x + bar.w), y: Math.min(Math.max(to.y, bar.y), bar.y + bar.h) }, dx = Math.abs(to.x - from.x), dy = Math.abs(to.y - from.y);
1019
+ return dy >= MOVED_LEADER_MIN_SLOPE * dx && Math.hypot(dx, dy) >= LEADER_MIN_DRAWN_RATIO * rect.h ? { from, to } : dx === 0 && dy < rect.h ? "over" : "beside";
1020
+ }
1021
+ function offsetBlockedWarning(req, seat, occupied, padding, selfAnn, ctx) {
1022
+ let leave = "so the label stays where the chart placed it", what, suggest = "Use a smaller or another offset, or give the chart more room.";
1023
+ if (ctx.canvas && !rectContains(ctx.canvas, seat.rect, 0) || ctx.plot && !rectsOverlap(ctx.plot, seat.rect, 0))
1024
+ what = `would move label '${req.id}' off the chart`, suggest = "Use a smaller offset.";
1025
+ else if (seat.besideBar)
1026
+ what = `would set value '${req.id}' beside its bar, where it reads as a neighbour's value`, suggest = "Move it further up or down, so its leader can reach its bar.";
1027
+ else {
1028
+ let hits = occupied.hitsWhich(seat.rect, padding).filter((o) => !(o.kind === "annotation" && selfAnn && o.owner.annotationId === selfAnn && (o.part === "bracketLabel" || !rectsOverlap(o.rect, seat.rect, 0))) && !(o.kind === "mark" && isOwnMark(o.owner, req.owner, req.kind, o.part))), other = [...ctx.naturalSeats ?? []].find(([id, rect]) => id !== req.id && rectsOverlap(rect, seat.rect, padding))?.[0];
1029
+ what = `would move label '${req.id}' onto ${plainBlockers(hits, other)}`;
1030
+ }
1031
+ return { code: "label-offset-blocked", severity: "warn", message: `labelOffsets ${what}, ${leave}`, owner: req.owner, suggest };
1032
+ }
1033
+ function plainBlockers(hits, otherLabel) {
1034
+ let parts = [], add = (text) => {
1035
+ parts.includes(text) || parts.push(text);
1036
+ };
1037
+ for (let o of hits) {
1038
+ let of = Object.keys(o.owner).length > 0 ? ` of ${formatOwner(o.owner)}` : "";
1039
+ o.kind === "label" ? add(`the label${of}`) : o.kind === "mark" ? add(`the mark${of}`) : o.kind === "annotation" ? add(`the annotation${o.owner.annotationId ? ` '${o.owner.annotationId}'` : ""}`) : o.kind === "axis" ? add("the axis labels") : o.kind === "legend" ? add("the legend") : o.kind === "frame" ? add("the title or the notes") : add(`the ${o.kind}${of}`);
1040
+ }
1041
+ return otherLabel !== void 0 && add(`the place of label '${otherLabel}'`), parts.length > 0 ? parts.join("; ") : "the space around another label";
1042
+ }
1043
+ function movedLeaderStart(seat, move) {
1044
+ let edge = (low, size, by = 0) => by > 0 ? low : by < 0 ? low + size : low + size / 2;
1045
+ return { x: edge(seat.x, seat.w, move.x), y: edge(seat.y, seat.h, move.y) };
1046
+ }
1165
1047
  var LED_FROM_R = 3;
1166
- function describeBlockers(hits, req, selfAnn) {
1048
+ function describeBlockers(hits, req, selfAnn, none = "the canvas edge") {
1167
1049
  let parts = [];
1168
1050
  for (let o of hits) {
1169
1051
  if (o.kind === "annotation" && selfAnn && o.owner.annotationId === selfAnn || o.kind === "mark" && isOwnMark(o.owner, req.owner, req.kind, o.part)) continue;
1170
1052
  let label = `${o.kind}${o.part ? ` '${o.part}'` : ""} of ${formatOwner(o.owner)}`;
1171
1053
  parts.includes(label) || parts.push(label);
1172
1054
  }
1173
- return parts.length > 0 ? parts.join("; ") : "the canvas edge";
1055
+ return parts.length > 0 ? parts.join("; ") : none;
1174
1056
  }
1175
1057
  function sameOwner(a, b) {
1176
1058
  return ["seriesId", "categoryId", "segmentId", "pointId", "annotationId"].every((key) => a[key] === b[key]);
@@ -1219,6 +1101,7 @@ function leaderHeightOf(cand) {
1219
1101
  function leaderAt(cand, lineHeight) {
1220
1102
  let from = cand.leaderFrom;
1221
1103
  if (!from) return;
1104
+ if (cand.leaderTo) return { d: leaderPath(from, cand.leaderTo, 1 / 0), curved: !1 };
1222
1105
  let minimum = LEADER_MIN_DRAWN_RATIO * lineHeight, approachesFromLeft = from.x <= cand.rect.x, toEdge = leaderTerminus(cand.rect, from, lineHeight), dx = toEdge.x - from.x, dy = toEdge.y - from.y;
1223
1106
  if (approachesFromLeft ? dx <= 0 : dx >= 0) return cand.leaderVertical ? verticalLeader(cand.rect, from) : void 0;
1224
1107
  if (Math.hypot(dx, dy) < minimum) return;
@@ -1268,20 +1151,69 @@ function finalize(base, _req, cand, pinned, darkInk, lightInk) {
1268
1151
  return label;
1269
1152
  }
1270
1153
 
1154
+ // src/core/annotationArrow.ts
1155
+ var ARROW_STANDARD = { head: 8, headWidth: 7, tipGap: 6, tailGap: 4, minShaft: 24 };
1156
+ function arrowLook(theme, compact) {
1157
+ let spec = theme.marks?.arrow;
1158
+ if (spec?.style === "compact") {
1159
+ let stroke2 = strokeToken(theme, "rule");
1160
+ return {
1161
+ standard: !1,
1162
+ stroke: stroke2,
1163
+ depth: compact.size * Math.abs(Math.cos(Math.PI * 0.85)),
1164
+ half: compact.size * Math.abs(Math.sin(Math.PI * 0.85)),
1165
+ shaftEnd: arrowShaftEnd(compact.size, stroke2),
1166
+ tipGap: compact.tipGap ?? 0,
1167
+ tailGap: compact.tailGap ?? 0,
1168
+ minShaft: 0,
1169
+ head: (tip, angle) => arrowHeadPath(tip, angle, compact.size)
1170
+ };
1171
+ }
1172
+ let stroke = spec?.stroke ?? strokeToken(theme, "rule"), depth = spec?.head ?? ARROW_STANDARD.head, half = (spec?.headWidth ?? ARROW_STANDARD.headWidth) / 2;
1173
+ return {
1174
+ standard: !0,
1175
+ stroke,
1176
+ depth,
1177
+ half,
1178
+ // Depth at which the head is as wide as the shaft, plus half a pixel.
1179
+ shaftEnd: Math.min(depth, stroke / 2 * (depth / half) + 0.5),
1180
+ tipGap: spec?.tipGap ?? ARROW_STANDARD.tipGap,
1181
+ tailGap: spec?.tailGap ?? ARROW_STANDARD.tailGap,
1182
+ minShaft: spec?.minShaft ?? ARROW_STANDARD.minShaft,
1183
+ head: (tip, angle) => {
1184
+ let ux = Math.cos(angle), uy = Math.sin(angle), bx = tip.x - ux * depth, by = tip.y - uy * depth;
1185
+ return `M${fmtPathNumber(tip.x)} ${fmtPathNumber(tip.y)}L${fmtPathNumber(bx - uy * half)} ${fmtPathNumber(by + ux * half)}L${fmtPathNumber(bx + uy * half)} ${fmtPathNumber(by - ux * half)}Z`;
1186
+ }
1187
+ };
1188
+ }
1189
+
1271
1190
  // src/core/annotateCallout.ts
1272
- var CALLOUT_ARROW_REACH = 22, ARROW_HEAD = 4, TIP_GAP = 4, TAIL_GAP = 3;
1273
- function arrowSeats(anchor, w, h, lineH, prefer) {
1274
- let y = anchor.y - lineH / 2, vertical = prefer === "above" || prefer === "below";
1275
- return [
1276
- { slot: "arrowRight", rect: { x: anchor.x + CALLOUT_ARROW_REACH, y, w, h }, penalty: vertical ? 0.5 : prefer === "left" ? -2.5 : -3 },
1277
- { slot: "arrowLeft", rect: { x: anchor.x - CALLOUT_ARROW_REACH - w, y, w, h }, penalty: vertical ? 0.6 : prefer === "left" ? -3 : -2.5 }
1191
+ var COMPACT_REACH = 22, COMPACT = { size: 4, tipGap: 4, tailGap: 3 };
1192
+ function calloutArrowLook(theme) {
1193
+ return arrowLook(theme, COMPACT);
1194
+ }
1195
+ function calloutArrowReach(look, edge) {
1196
+ return look.standard ? edge + look.tipGap + look.depth + look.minShaft + look.tailGap : COMPACT_REACH;
1197
+ }
1198
+ function arrowSeats(anchor, w, h, lineH, prefer, reach, standard, valueBox) {
1199
+ let y = anchor.y - lineH / 2, vertical = prefer === "above" || prefer === "below", side = [
1200
+ { slot: "arrowRight", rect: { x: anchor.x + reach, y, w, h }, penalty: vertical ? 0.5 : prefer === "left" ? -2.5 : -3 },
1201
+ { slot: "arrowLeft", rect: { x: anchor.x - reach - w, y, w, h }, penalty: vertical ? 0.6 : prefer === "left" ? -3 : -2.5 }
1278
1202
  ];
1203
+ if (!standard) return side;
1204
+ let top = Math.min(anchor.y, valueBox?.y ?? anchor.y), bottom = Math.max(anchor.y, valueBox ? valueBox.y + valueBox.h : anchor.y);
1205
+ return [
1206
+ ...side,
1207
+ { slot: "arrowAbove", rect: { x: anchor.x - w / 2, y: top - reach - h, w, h }, penalty: prefer === "above" ? -3 : prefer === "below" ? 0.8 : 0.7 },
1208
+ { slot: "arrowBelow", rect: { x: anchor.x - w / 2, y: bottom + reach, w, h }, penalty: prefer === "below" ? -3 : prefer === "above" ? 0.8 : 0.75 }
1209
+ ].sort((a, b) => a.penalty - b.penalty);
1279
1210
  }
1280
- function tail(rect, anchor) {
1211
+ function tail(rect, anchor, gap) {
1281
1212
  let y = Math.min(Math.max(anchor.y, rect.y), rect.y + rect.h);
1282
- return anchor.x < rect.x ? { x: rect.x - TAIL_GAP, y } : anchor.x > rect.x + rect.w ? { x: rect.x + rect.w + TAIL_GAP, y } : { x: anchor.x, y: anchor.y < rect.y ? rect.y - TAIL_GAP : rect.y + rect.h + TAIL_GAP };
1213
+ return anchor.x < rect.x ? { x: rect.x - gap, y } : anchor.x > rect.x + rect.w ? { x: rect.x + rect.w + gap, y } : { x: anchor.x, y: anchor.y < rect.y ? rect.y - gap : rect.y + rect.h + gap };
1283
1214
  }
1284
- function finishCalloutHeads(theme, labels, plans, nodes, occupied) {
1215
+ function finishCalloutHeads(theme, labels, plans, nodes, occupied, warnings) {
1216
+ let look = calloutArrowLook(theme);
1285
1217
  for (let label of labels) {
1286
1218
  let plan = plans.get(label.id);
1287
1219
  if (!plan) continue;
@@ -1290,15 +1222,23 @@ function finishCalloutHeads(theme, labels, plans, nodes, occupied) {
1290
1222
  continue;
1291
1223
  }
1292
1224
  if (label.font = plan.font, plan.headline && (label.headLines = plan.headlineLines ?? 1, label.headWeight = plan.headlineWeight), !plan.arrow) continue;
1293
- let { anchor, owner } = plan.arrow, from = tail(label.rect, anchor), length = Math.hypot(anchor.x - from.x, anchor.y - from.y);
1294
- if (length <= TIP_GAP + ARROW_HEAD) {
1295
- plan.arrow.nodeIds.splice(0);
1225
+ let { owner, valueBox } = plan.arrow, { anchor, edge } = plan.arrow, from = tail(label.rect, anchor, look.tailGap);
1226
+ look.standard && valueBox && segmentHitsRect(from, anchor, valueBox) && (anchor = { x: Math.min(Math.max(from.x, valueBox.x), valueBox.x + valueBox.w), y: Math.min(Math.max(from.y, valueBox.y), valueBox.y + valueBox.h) }, edge = 0);
1227
+ let length = Math.hypot(anchor.x - from.x, anchor.y - from.y), tipGap = look.standard ? edge + look.tipGap : look.tipGap;
1228
+ if (look.standard ? length - tipGap - look.depth < look.minShaft - 0.5 : length <= look.tipGap + COMPACT.size) {
1229
+ plan.arrow.nodeIds.splice(0), look.standard && warnings.push({
1230
+ code: "callout-arrow-no-room",
1231
+ severity: "warn",
1232
+ owner,
1233
+ message: `callout '${owner.annotationId}': its text found no seat far enough from its point for an arrow of ${look.minShaft} px, so it is drawn without the arrow`,
1234
+ suggest: "Give the callout a preferSide with free room, or leave arrow out."
1235
+ });
1296
1236
  continue;
1297
1237
  }
1298
- let ux = (anchor.x - from.x) / length, uy = (anchor.y - from.y) / length, tip = { x: anchor.x - ux * TIP_GAP, y: anchor.y - uy * TIP_GAP }, shaft = arrowShaftEnd(ARROW_HEAD, strokeToken(theme, "rule")), end = { x: tip.x - ux * shaft, y: tip.y - uy * shaft }, [shaftId, headId] = plan.arrow.nodeIds;
1238
+ let ux = (anchor.x - from.x) / length, uy = (anchor.y - from.y) / length, tip = { x: anchor.x - ux * tipGap, y: anchor.y - uy * tipGap }, shaft = look.shaftEnd, end = { x: tip.x - ux * shaft, y: tip.y - uy * shaft }, [shaftId, headId] = plan.arrow.nodeIds;
1299
1239
  delete label.leader, nodes.push(
1300
- { t: "path", id: shaftId, d: `M${from.x} ${from.y}L${end.x} ${end.y}`, stroke: { token: "ink" }, width: strokeToken(theme, "rule"), owner, part: "calloutArrow" },
1301
- { t: "path", id: headId, d: arrowHeadPath(tip, Math.atan2(uy, ux), ARROW_HEAD), fill: { token: "ink" }, owner, part: "calloutArrow" }
1240
+ { t: "path", id: shaftId, d: `M${from.x} ${from.y}L${end.x} ${end.y}`, stroke: { token: "ink" }, width: look.stroke, owner, part: "calloutArrow" },
1241
+ { t: "path", id: headId, d: look.head(tip, Math.atan2(uy, ux)), fill: { token: "ink" }, owner, part: "calloutArrow" }
1302
1242
  ), occupied.claim(
1303
1243
  { x: Math.min(from.x, tip.x) - 0.5, y: Math.min(from.y, tip.y) - 0.5, w: Math.abs(tip.x - from.x) + 1, h: Math.abs(tip.y - from.y) + 1 },
1304
1244
  "annotation",
@@ -1483,6 +1423,7 @@ function labelsToNodes(theme, labels, fontOf, marks) {
1483
1423
  }
1484
1424
 
1485
1425
  // src/core/repaintGeometry.ts
1426
+ var withoutPointer = ({ field: _field, fix: _fix, ...warning }) => warning;
1486
1427
  function repaintGeometry(geometry, theme, options) {
1487
1428
  let scene = repaintScene(geometry.scene, theme, sceneThemeBindings(geometry)), warnings = geometry.paintWarningRules?.length ? refreshPaintWarnings(geometry.warnings, geometry.paintWarningRules.map((rule) => rule.kind === "mark-lost-on-band" ? { ...rule, pairs: marksOnBands(scene) } : rule), theme) : [...geometry.warnings];
1488
1429
  if (options?.palette && warnings.some((warning) => warning.code === "unknown-palette")) {
@@ -1496,13 +1437,17 @@ function repaintGeometry(geometry, theme, options) {
1496
1437
  for (let panel of [...panels].reverse()) {
1497
1438
  let chart = panel.chart;
1498
1439
  if (!chart || chart.warningOffset === void 0) continue;
1499
- let child = repaintGeometry(chart.geometry, chart.theme ? resolveTheme(chart.theme) : theme, chart.options);
1440
+ let child = repaintGeometry(chart.geometry, chart.theme ? resolveTheme(chart.theme) : theme, chart.options), passedOn = new Map(chart.geometry.warnings.flatMap((warning, index) => {
1441
+ let forwarded = warnings[chart.warningOffset + index];
1442
+ return forwarded?.code === warning.code && forwarded.detail?.panelId === panel.id && forwarded.message === `[${panel.id}] ${warning.message}` ? [[warning, forwarded]] : [];
1443
+ }));
1500
1444
  warnings.splice(
1501
1445
  chart.warningOffset,
1502
1446
  chart.geometry.warnings.length,
1503
- ...child.warnings.map((warning) => ({
1504
- ...warning,
1447
+ ...child.warnings.map((warning) => passedOn.get(warning) ?? {
1448
+ ...withoutPointer(warning),
1505
1449
  message: `[${panel.id}] ${warning.message}`,
1450
+ detail: { ...warning.detail, panelId: panel.id },
1506
1451
  ...chart.warningOwnerPrefix === void 0 ? {} : {
1507
1452
  owner: warning.owner ? {
1508
1453
  ...warning.owner,
@@ -1510,7 +1455,7 @@ function repaintGeometry(geometry, theme, options) {
1510
1455
  ...warning.owner.valueLineId === void 0 ? {} : { valueLineId: chart.warningOwnerPrefix + warning.owner.valueLineId }
1511
1456
  } : void 0
1512
1457
  }
1513
- }))
1458
+ })
1514
1459
  );
1515
1460
  }
1516
1461
  }
@@ -1951,7 +1896,7 @@ function renderNodeInner(node, theme, formatter, tf, interaction, idScope, rootF
1951
1896
  }
1952
1897
 
1953
1898
  // src/core/aspect.ts
1954
- var furnitureBudget = (width) => width < 720 ? 0.5 : 0.4, ASPECT_LADDER = [
1899
+ var furnitureBudget = (width) => classStepWidth(width) < 720 ? 0.5 : 0.4, ASPECT_LADDER = [
1955
1900
  { name: "strip", ratio: 4.5 },
1956
1901
  { name: "band", ratio: 3.6 },
1957
1902
  { name: "wide", ratio: 2.84 },
@@ -2142,7 +2087,7 @@ function collectSeriesIdentities(layout, data, options) {
2142
2087
  }
2143
2088
  function textNames(node, name) {
2144
2089
  if (node.t !== "text" || !name.trim()) return !1;
2145
- let escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2090
+ let escaped = name.trim().replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\s+/g, "\\s+");
2146
2091
  return new RegExp(`(?<![\\p{L}\\p{N}_])${escaped}(?![\\p{L}\\p{N}_])`, "iu").test(node.lines.join(" "));
2147
2092
  }
2148
2093
  function nameIsDrawn(geometry, name, id) {
@@ -2294,7 +2239,7 @@ function readableLabelDestination(geo) {
2294
2239
  let hostId = prefix + label.printedIn, host = labels.get(hostId), node = nodes.get(host?.nodeId ?? `label:${hostId}`) ?? nodes.get(hostId), printed = node ? printedText.get(node.id) : "";
2295
2240
  if (node && (containsText(printed, words(host?.text ?? text)) || containsText(printed, normalized))) return `label:${hostId}`;
2296
2241
  }
2297
- let named = kind === "series" || kind === "category" || kind === "restSeries" || kind === "source", numeric = ["point", "segment", "total", "grandTotal", "insidePie", "outsidePie", "growth"].includes(kind ?? "") && label?.role !== "category" && label?.printsFor?.length !== 0, own = ownerKey(owner), scoped = (node) => !prefix || node.id.startsWith(prefix) || node.origin?.panels.some((panel) => prefix.startsWith(`${panel}/`)), sameOwner2 = (node) => Object.keys(owner).length > 0 && nodeOwners.get(node.id) === own, sameQuantity = (node) => !numeric || textRole(node) === "value" && (painted.get(node.id)?.kind === kind || label?.claimId !== void 0 && painted.get(node.id)?.claimId === label.claimId || owner.rowId !== void 0 && owner.colId !== void 0), match = (exact.get(normalized) ?? []).find((node) => scoped(node) && (sameOwner2(node) && sameQuantity(node) || named && !["value", "axis"].includes(textRole(node))));
2242
+ let named = kind === "series" || kind === "category" || kind === "restSeries" || kind === "source", numeric = ["point", "segment", "total", "grandTotal", "insidePie", "outsidePie", "growth"].includes(kind ?? "") && label?.role !== "category" && label?.printsFor?.length !== 0, own = ownerKey(owner), scoped = (node) => !prefix || node.id.startsWith(prefix) || node.origin?.panels.some((panel) => prefix.startsWith(`${panel}/`)), sameOwner2 = (node) => Object.keys(owner).length > 0 && nodeOwners.get(node.id) === own, sameQuantity = (node) => !numeric || textRole(node) === "value" && (painted.get(node.id)?.kind === kind || label?.claimIds?.some((id2) => painted.get(node.id)?.claimIds?.includes(id2)) || owner.rowId !== void 0 && owner.colId !== void 0), match = (exact.get(normalized) ?? []).find((node) => scoped(node) && (sameOwner2(node) && sameQuantity(node) || named && !["value", "axis"].includes(textRole(node))));
2298
2243
  if (match) return `scene:${match.id}`;
2299
2244
  let shared = Object.keys(owner).length ? owners.get(own)?.find((node) => scoped(node) && containsText(printedText.get(node.id), normalized) && (sameOwner2(node) ? named : !0)) : void 0;
2300
2245
  if (shared) return `scene:${shared.id}`;
@@ -2307,9 +2252,9 @@ function readableLabelDestination(geo) {
2307
2252
  return note ? `scene:${note.id}` : void 0;
2308
2253
  };
2309
2254
  }
2310
- function omissionScope(geo, options, id, data) {
2255
+ function omissionScope(geo, options, id, data, type) {
2311
2256
  let panel = geo.marks.panels?.find((panel2) => id.startsWith(`${panel2.id}/`) && panel2.chart), sourcePanel = data?.panels?.find((source) => source.id === panel?.id);
2312
- return panel?.chart ? omissionScope(panel.chart.geometry, panel.chart.options, id.slice(panel.id.length + 1), sourcePanel?.data) : { geometry: geo, options, id, data };
2257
+ return panel?.chart ? omissionScope(panel.chart.geometry, panel.chart.options, id.slice(panel.id.length + 1), sourcePanel?.data, sourcePanel?.type) : { geometry: geo, options, id, data, ...type ? { type } : {} };
2313
2258
  }
2314
2259
  function intentionalOmission(geo, options, data, omission, labelFor) {
2315
2260
  let scope = omissionScope(geo, options, omission.labelId, data), settings = typeof scope.options?.labels == "object" && scope.options.labels !== null ? scope.options.labels : void 0;
@@ -2410,8 +2355,18 @@ function partialPattern(category, pattern, outlined = !1) {
2410
2355
  return pattern ?? (category?.partial === !0 && !outlined ? "hatch45" : void 0);
2411
2356
  }
2412
2357
  function partialFootnotes(categories, strings, keyed = !1) {
2413
- let labels = categories.filter((category) => category.partial === !0).map((category) => (category.label ?? category.id).replace(/\s*\n\s*/g, " "));
2414
- return labels.length === 0 || keyed ? [] : [disclosureNote(`${labels.join(", ")} ${strings?.toDate ?? localeStrings().toDate}`)];
2358
+ let names = partialNames(categories, strings);
2359
+ return names === void 0 || keyed ? [] : [disclosureNote(names)];
2360
+ }
2361
+ function partialNames(categories, strings) {
2362
+ let toDate = strings?.toDate ?? localeStrings().toDate, labels = categories.filter((c) => c.partial === !0).map((c) => (c.label ?? c.id).replace(/\s*\n\s*/g, " "));
2363
+ if (labels.length === 0) return;
2364
+ let parts = [], run = [], close = () => {
2365
+ run.length > 0 && parts.push(`${run.join(", ")} ${toDate}`.trim()), run = [];
2366
+ };
2367
+ for (let label of labels)
2368
+ saysToDate(label, toDate) ? (close(), parts.push(label)) : run.push(label);
2369
+ return close(), parts.join(", ");
2415
2370
  }
2416
2371
  function partialAxisWords(strings, options, keyed = !1) {
2417
2372
  return keyed || disclosuresShown(options) ? void 0 : strings?.toDate ?? localeStrings().toDate;
@@ -2424,7 +2379,7 @@ function partialIds(categories) {
2424
2379
  return new Set(categories.filter((category) => category.partial === !0).map((category) => category.id));
2425
2380
  }
2426
2381
  function partialLegendKeys(painted, strings, categories = []) {
2427
- let labels = categories.filter((c) => c.partial).map((c) => (c.label ?? c.id).replace(/\s*\n\s*/g, " ")), label = labels.length > 0 ? `${labels.join(", ")} ${strings?.toDate ?? localeStrings().toDate}` : strings?.partial ?? localeStrings().partial;
2382
+ let label = partialNames(categories, strings) ?? strings?.partial ?? localeStrings().partial;
2428
2383
  return painted ? [{ id: "__partial", label, paint: { token: "markInk" }, pattern: "hatch45" }] : [];
2429
2384
  }
2430
2385
  var PARTIAL_KEY = /* @__PURE__ */ Symbol("boardplot.partialKey");
@@ -2495,9 +2450,6 @@ function categoryLabelsAndMarks(categories, refs, toDate) {
2495
2450
  };
2496
2451
  }
2497
2452
 
2498
- // src/core/types/sizing.ts
2499
- var HEIGHT_STRUCTURE = /* @__PURE__ */ Symbol("heightStructure"), VALUE_SELECTION = /* @__PURE__ */ Symbol("valueSelection");
2500
-
2501
2453
  // src/core/strings/frame.ts
2502
2454
  var EN = {
2503
2455
  // reader-facing wording linked only by its consumers.
@@ -2515,12 +2467,181 @@ var EN = {
2515
2467
  listedInNotes: "Vollst\xE4ndiger Text steht in der Anmerkungsliste"
2516
2468
  }, { chartString: chartString2, localeStrings: localeStrings2 } = chartStrings(EN, DE);
2517
2469
 
2470
+ // src/core/frameText.ts
2471
+ var HIDDEN_LABEL_LEAD = "Not labelled on the chart";
2472
+ function frameText(input) {
2473
+ let { footFont, measure, footWidth: footW, policy } = input, footMeasure = input.source && hasBold(input.source) || input.footnotes.some((note) => hasBold(note.text)) ? boldMeasurer(measure, input.boldWeight) : measure, warnings = [], marked = [], countable = !1, fullStatic = policy.pinned, placement = fullStatic ? "frame" : input.notes?.placement ?? defaultNotePlacement(input.target), budget = fullStatic ? 1 / 0 : input.notes?.maxLines ?? defaultNoteLines(input.target, input.width), shown = new Set(input.notes?.show ?? ["note"]), pointerOn = !fullStatic && !input.footnotesOff && input.notes?.pointer !== !1, metas = /* @__PURE__ */ new Map();
2474
+ for (let note of input.footnotes) metas.set(note.text, note.meta);
2475
+ let mark = (text, meta) => (metas.set(text, meta), marked.push({ text, meta }), text), entries = [];
2476
+ {
2477
+ let notes = input.footnotes.map((note) => note.text), numbered = input.numberedFootnotes ?? notes, unreferencedNotes = new Set(input.unreferencedNotes ?? []), next = 0, referenced = !1, unmarked = [];
2478
+ for (let f of notes) {
2479
+ let numberedHere = next < numbered.length && numbered[next] === f && !f.startsWith(`${HIDDEN_LABEL_LEAD}:`), numberedDisclosure = numberedHere && (input.numberedDisclosures?.includes(next + 1) ?? !1), marker = numberedHere && !unreferencedNotes.has(next + 1) ? `${footnoteMark(next + 1)} ` : "";
2480
+ marker && (referenced = !0), numberedHere && marker === "" && unmarked.push(next + 1), numberedHere && (next += 1);
2481
+ let meta = numberedHere ? void 0 : metas.get(f);
2482
+ if (fullStatic && meta?.list && (countable = !0), meta?.list) {
2483
+ let fitted = fittedNote(meta.list, (text) => wrapFootnote(markBold(text), footFont, footW, footMeasure).length <= 2);
2484
+ f = meta.short ? mark(f, { kind: "disclosure", short: fitted, values: meta.values, list: meta.list }) : mark(fitted, { kind: "disclosure", values: meta.values, list: meta.list });
2485
+ }
2486
+ let kind = numberedDisclosure ? "disclosure" : numberedHere ? "note" : meta?.kind ?? "method", fittedShort = metas.get(f)?.short ?? meta?.short, short = fittedShort && (kind !== "disclosure" || input.notes?.maxListed !== void 0 || footMeasure(markBold(fittedShort), footFont).width < footMeasure(markBold(f), footFont).width) ? fittedShort : void 0, storedMeta = meta ? { ...meta, ...metas.get(f), ...meta.ranks ? { ranks: !0 } : {} } : void 0;
2487
+ entries.push(keepNoteMeta({ kind, text: f, ...short ? { short } : {}, drawn: `${marker}${kind === "disclosure" || kind === "method" && !fullStatic ? short ?? f : f}`, ...marker ? { ref: next } : {}, ...meta?.ranks ? { ranks: !0 } : {} }, storedMeta));
2488
+ }
2489
+ !input.footnotesOff && unmarked.length > 0 && referenced && warnings.push({
2490
+ code: "footnote-unreferenced",
2491
+ severity: "info",
2492
+ message: `${unmarked.length === 1 ? "note" : "notes"} ${unmarked.join(", ")} ${unmarked.length === 1 ? "has" : "have"} no category or cell pointing at ${unmarked.length === 1 ? "it" : "them"} (footnote: n), so ${unmarked.length === 1 ? "it prints" : "they print"} without a number`,
2493
+ suggest: "set footnote: n on the category or cell the note explains, or keep it as a note about the whole exhibit"
2494
+ });
2495
+ }
2496
+ let rank = { note: 0, disclosure: 1, method: 2, source: 3, credit: 4 };
2497
+ entries.sort((a, b) => rank[a.kind] - rank[b.kind]);
2498
+ let credit = input.credit, creditInFrame = credit !== void 0 && (credit.required || fullStatic), sourceText = input.source ? sourceLine(input.source, input.strings?.source ?? localeStrings2().source) : void 0, sourceOff = sourceText !== void 0 && !fullStatic && input.compactSourceLines === 0;
2499
+ sourceOff && warnings.push({ code: "footnotes-off", severity: "info", message: `compact frame has no room for the source line: ${sourceText}` });
2500
+ let pointed = new Set(input.pointedNotes ?? []), kept = entries.filter((entry) => entry.kind === "disclosure" ? (input.notesShowAuthored === !0 || !policy.live || entry.ref !== void 0 || entry.ranks === !0) && (shown.has("disclosure") || entry.ranks === !0 && shown.has("ranks")) : !input.footnotesOff && pointed.has(entry.text)), candidates = input.footnotesOff || placement === "list" ? [] : entries.filter((entry) => !kept.includes(entry) && shown.has(entry.kind) && !isQuiet(entry)), infoPanel = policy.live && placement === "info", infoCount = (hidden) => allQuiet(hidden) && !(credit && !creditInFrame) ? 0 : hidden.length, listed = (k2) => infoPanel ? infoCount(entries.filter((entry) => !kept.includes(entry) && !candidates.slice(0, k2).includes(entry))) + (credit && !creditInFrame ? 1 : 0) : entries.filter((entry) => shown.has(entry.kind) && !kept.includes(entry) && !isQuiet(entry)).length - k2 + (credit && !creditInFrame ? 1 : 0), pointerAt = (k2) => {
2501
+ let hidden = listed(k2);
2502
+ return pointerOn && hidden > 0 ? notesPointer(hidden, input.strings) : void 0;
2503
+ }, sourcePara = (k2) => {
2504
+ let pointer = pointerAt(k2), source = sourceOff ? void 0 : sourceText;
2505
+ return source === void 0 ? pointer : pointer === void 0 ? source : `${source}${/[.!?]$/.test(source) ? "" : "."} ${pointer}`;
2506
+ }, sourceLines = (text) => {
2507
+ let fitted = !fullStatic && input.compactSourceLines === 1 ? fitText(markBold(text), footFont, footW, 1, footMeasure) : void 0;
2508
+ return fitted ? { lines: fitted.lines, ...fitted.title ? { title: fitted.title } : {} } : { lines: wrapFootnote(markBold(text), footFont, footW, footMeasure) };
2509
+ }, noteLines = candidates.map((entry) => wrapFootnote(markBold(entry.drawn), footFont, footW, footMeasure)), usedAt = (k2) => {
2510
+ let para = sourcePara(k2);
2511
+ return noteLines.slice(0, k2).reduce((sum, lines) => sum + lines.length, 0) + (para ? sourceLines(para).lines.length : 0);
2512
+ }, k = candidates.length;
2513
+ for (; k > 0 && !(usedAt(k) <= budget); k--) ;
2514
+ let visible = /* @__PURE__ */ new Set([...candidates.slice(0, k), ...kept]), sourceBlock = sourcePara(k);
2515
+ if (policy.live && !fullStatic && input.notes?.pointer === !1 && !input.footnotesOff && placement !== "list") {
2516
+ let left = candidates.filter((entry) => entry.kind === "note" && (infoPanel || !visible.has(entry))).length;
2517
+ left > 0 && warnings.push({
2518
+ code: "notes-left-out",
2519
+ severity: "warn",
2520
+ message: `${left} author ${left === 1 ? "note is" : "notes are"} not shown: ${infoPanel ? "under notes.placement 'info'" : `the line budget of ${budget} lines leaves ${left === 1 ? "it" : "them"} out of the footer, and`} notes.pointer: false hides the notes list`,
2521
+ suggest: infoPanel ? `Remove notes.pointer: false, so the notes button lists ${left === 1 ? "it" : "them"}.` : `Set notes.maxLines to ${usedAt(candidates.length)} to print ${left === 1 ? "it" : "them"}, or remove notes.pointer: false, so "+N notes" lists ${left === 1 ? "it" : "them"}.`,
2522
+ field: ["options", "notes", "pointer"],
2523
+ fix: [{ op: "remove", path: "/options/notes/pointer" }]
2524
+ });
2525
+ }
2526
+ if (input.footnotesOff) {
2527
+ let leftOff = entries.filter((entry) => !kept.includes(entry)).map((entry) => entry.text);
2528
+ leftOff.length && warnings.push({ code: "footnotes-off", severity: "info", message: `footnotes: false left these notes off: ${leftOff.join(" | ")}` });
2529
+ }
2530
+ let unprinted = entries.filter((entry) => !visible.has(entry)).map((entry) => entry.text), noteList = [
2531
+ ...entries.map((entry) => keepNoteMeta({ kind: entry.kind, text: entry.text, ...entry.short ? { short: entry.short } : {}, inFrame: visible.has(entry), ...entry.ref ? { ref: entry.ref } : {} }, engineNoteMeta(entry))),
2532
+ ...input.source ? [{ kind: "source", text: input.source, inFrame: !sourceOff }] : [],
2533
+ ...credit ? [{ kind: "credit", text: credit.text, short: credit.short, ...credit.links.length ? { links: credit.links.map((link) => ({ ...link })) } : {}, inFrame: creditInFrame }] : []
2534
+ ].map((entry, i) => keepNoteMeta({ n: i + 1, ...entry }, engineNoteMeta(entry))), printed = entries.filter((entry) => visible.has(entry)).map((entry) => {
2535
+ let at = candidates.indexOf(entry);
2536
+ return { entry, lines: at >= 0 ? noteLines[at] : wrapFootnote(markBold(entry.drawn), footFont, footW, footMeasure) };
2537
+ });
2538
+ return {
2539
+ ...input.title ? { title: input.title } : {},
2540
+ ...input.subtitle ? { subtitle: subtitleText(input.subtitle, input.unit) } : {},
2541
+ placement,
2542
+ footMeasure,
2543
+ entries,
2544
+ printed,
2545
+ sourceText,
2546
+ sourceOff,
2547
+ sourceBlock,
2548
+ pointer: pointerAt(k),
2549
+ sourceLines,
2550
+ creditInFrame,
2551
+ pointerOn,
2552
+ noteList,
2553
+ unprinted,
2554
+ warnings,
2555
+ countable,
2556
+ marked
2557
+ };
2558
+ }
2559
+ var listText = (lead, items) => `${lead}: ${items.join(", ").replace(/\.$/, "")}.`;
2560
+ function fittedNote(list, fits) {
2561
+ let at = (k) => listedNoteText(list, k), low = 0, high = Math.min(list.items.length, noteCap(list.options, list.items.length));
2562
+ if (fits(at(high))) return at(high);
2563
+ for (; high - low > 1; ) {
2564
+ let mid = low + high >> 1;
2565
+ fits(at(mid)) ? low = mid : high = mid;
2566
+ }
2567
+ return at(low);
2568
+ }
2569
+ function listedNoteText({ lead, items, total, options }, k) {
2570
+ let n = items.length;
2571
+ return k === 0 ? listText(lead, [total !== void 0 && total >= n ? countedValuesText(n, total, options) : moreListedText(n, options, !0)]) : listText(lead, k < n ? [...items.slice(0, k), moreListedText(n - k, options)] : items);
2572
+ }
2573
+ var DEFAULT_NOTE_LIMIT = 8;
2574
+ function noteCap(options, count = 0) {
2575
+ let max = options?.notes?.maxListed, cap = max === "all" ? 1 / 0 : typeof max == "number" && max >= 0 ? Math.floor(max) : DEFAULT_NOTE_LIMIT;
2576
+ return cap && count === cap + 1 ? count : cap;
2577
+ }
2578
+ function moreListedText(count, options, alone = !1) {
2579
+ return alone ? chartString2(options, "countedItems", { count }) : (options?.strings?.moreListed ?? "and {count} more").replace("{count}", String(count));
2580
+ }
2581
+ function countedValuesText(count, total, options) {
2582
+ return chartString2(options, "countedValues", { count, total });
2583
+ }
2584
+ function cappedItems(items, options, total) {
2585
+ let cap = noteCap(options, items.length);
2586
+ return items.length <= cap ? [...items] : cap === 0 && total !== void 0 && total >= items.length ? [countedValuesText(items.length, total, options)] : [...items.slice(0, cap), moreListedText(items.length - cap, options, cap === 0)];
2587
+ }
2588
+ var UNIT_SIGNS = [
2589
+ [/\b(?:EUR|euros?)\b/gi, "\u20AC"],
2590
+ [/\bUSD\b/gi, "$"],
2591
+ [/\bGBP\b/gi, "\xA3"],
2592
+ [/\bJPY\b/gi, "\xA5"],
2593
+ [/\b(?:percent(?:ages?)?|per\s+cent|pct)\b/gi, "%"]
2594
+ ];
2595
+ function unitWordsAsSigns(text) {
2596
+ return UNIT_SIGNS.reduce((out, [code, sign]) => out.replace(code, sign), text);
2597
+ }
2598
+ function measureNamesUnit(unit, measure) {
2599
+ measure = unitWordsAsSigns(plainText(measure));
2600
+ let escaped = unitWordsAsSigns(unit.trim()).replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\s+/g, "\\s+");
2601
+ return escaped.length > 0 && new RegExp(`(?<![\\p{L}\\p{N}_])${escaped}(?![\\p{L}\\p{N}_])`, "iu").test(measure);
2602
+ }
2603
+ function subtitleUnitClause(unit, measure) {
2604
+ let normalized = unit.trim().toLowerCase();
2605
+ return normalized === "x" || normalized === "\xD7" || normalized === "ratio" ? /\bper\b/i.test(measure) ? "" : /\bratio\b/i.test(measure) ? " (\xD7)" : " ratio (\xD7)" : measureNamesUnit(unit, measure) ? "" : ` in ${unit}`;
2606
+ }
2607
+ function frameRendersUnit(input) {
2608
+ return !!(input.subtitle && input.unit && (measureNamesUnit(input.unit, input.subtitle.measure) || subtitleUnitClause(input.unit, input.subtitle.measure).length > 0));
2609
+ }
2610
+ function unitPrinted(input) {
2611
+ return !!(input.unitShown && input.unit) || frameRendersUnit(input);
2612
+ }
2613
+ function subtitleLine(sub) {
2614
+ return [sub.company, sub.measure, sub.period, sub.scenarios?.length ? formatScenarios(sub.scenarios) : void 0].filter(Boolean).join(" \xB7 ");
2615
+ }
2616
+ function measureUnitTail(measure, unit) {
2617
+ let at = measure.lastIndexOf(", ");
2618
+ if (at <= 0) return "";
2619
+ let tail2 = measure.slice(at + 2);
2620
+ return /^(%|in\s|per\s|[$€£¥]|(?:EUR|USD|CHF|GBP|JPY|US\$)(?![\p{L}])|index\b|score\b|share of\b|# )/iu.test(plainText(tail2)) || unit !== void 0 && unit.trim() !== "" && plainText(tail2).trim().toLowerCase() === unit.trim().toLowerCase() ? measure.slice(at + 1) : "";
2621
+ }
2622
+ function subtitleText(authored, unit) {
2623
+ let sub = hasBold(authored.measure) || hasBold(authored.company ?? "") || hasBold(authored.period ?? "") ? {
2624
+ ...authored,
2625
+ measure: markBold(authored.measure),
2626
+ ...authored.company ? { company: markBold(authored.company) } : {},
2627
+ ...authored.period ? { period: markBold(authored.period) } : {}
2628
+ } : authored, trailing = "";
2629
+ frameRendersUnit({ subtitle: authored, unit }) && (trailing += subtitleUnitClause(unit, sub.measure)), sub.period && (trailing += ` \xB7 ${sub.period}`), sub.scenarios && sub.scenarios.length > 0 && (trailing += ` \xB7 ${formatScenarios(sub.scenarios)}`);
2630
+ let segments = [];
2631
+ sub.company && segments.push({ text: `${sub.company} \xB7 `, bold: !1 });
2632
+ let unitTail = measureUnitTail(sub.measure, unit), lone = !sub.company && !unitTail && !trailing;
2633
+ return segments.push({ text: sub.measure.slice(0, sub.measure.length - unitTail.length), bold: !lone }), (unitTail || trailing) && segments.push({ text: unitTail + trailing, bold: !1 }), { sub, segments };
2634
+ }
2635
+
2636
+ // src/core/types/sizing.ts
2637
+ var HEIGHT_STRUCTURE = /* @__PURE__ */ Symbol("heightStructure"), VALUE_SELECTION = /* @__PURE__ */ Symbol("valueSelection");
2638
+
2518
2639
  // src/core/frame.ts
2519
2640
  function legendRequired(option, warnings, chartType, theme, reason = "the mapped range and no-data encoding must remain explicit") {
2520
2641
  let position = theme?.legend?.required ?? "top";
2521
2642
  return option === "none" ? (warnings.push({
2522
2643
  code: `${chartType}-legend-required`,
2523
- severity: "info",
2644
+ severity: "warn",
2524
2645
  message: `${chartType} legend cannot be hidden because ${reason}`
2525
2646
  }), { position }) : normalizeLegendOption(option, { position });
2526
2647
  }
@@ -2576,6 +2697,7 @@ function frameTextOptions(options) {
2576
2697
  ...options[LIVE_NOTE_SHOW] ? { [LIVE_NOTE_SHOW]: options[LIVE_NOTE_SHOW] } : {},
2577
2698
  strings: options.strings,
2578
2699
  ...options.notes !== void 0 || shownNoteKinds(options) !== void 0 ? { notes: { ...options.notes, show: shownNoteKinds(options) } } : {},
2700
+ ...options.notes?.show !== void 0 && options[NOTES_ASKED] !== !0 ? { notesShowAuthored: !0 } : {},
2579
2701
  footnotes: options.footnotes === !1 ? [] : options.footnotes,
2580
2702
  ...options.footnotesOff === !0 || options.footnotes === !1 ? { footnotesOff: !0 } : {},
2581
2703
  numberedFootnotes: options.authoredFootnotes ?? authoredNotes(options),
@@ -2593,7 +2715,7 @@ function htmlFooterHeight(input, parts, sourceText, font, width, lineH, measure)
2593
2715
  let height = (text) => wrapFootnote(markBold(text), font, width, measure).length * lineH, total = 0;
2594
2716
  for (let note of parts.shown)
2595
2717
  total += height(`${note.ref ? `${footnoteMark(note.ref)} ` : ""}${note.kind === "method" || note.kind === "disclosure" ? note.short ?? note.text : note.text}`);
2596
- let credit = parts.credit && `${chartString2(input, "mapCredit")}: ${parts.credit.text}`, label = parts.panel.length === 0 ? void 0 : parts.info ? `${chartString(input, "notesAndSources")} (${parts.panel.length})` : notesPointer(parts.panel.length, input.strings), items = [
2718
+ let credit = parts.credit && `${chartString2(input, "mapCredit")}: ${parts.credit.text}`, label = parts.panel.length === 0 ? void 0 : parts.info ? notesPanelLabel(parts.panel.length, chartString(input, "notesAndSources")) : notesPointer(parts.panel.length, input.strings), items = [
2597
2719
  ...parts.source && sourceText ? [{ w: measure(markBold(sourceText), font).width, text: sourceText }] : [],
2598
2720
  ...credit && parts.info ? [{ w: measure(credit, font).width, text: credit }] : [],
2599
2721
  ...label ? [{ w: Math.max(NOTE_HIT_PX, measure(label, font).width), h: Math.max(NOTE_HIT_PX, lineH) }] : []
@@ -2822,21 +2944,6 @@ function shiftLegendKeyY(node, dy) {
2822
2944
  }
2823
2945
  }
2824
2946
  }
2825
- function measureNamesUnit(unit, measure) {
2826
- measure = plainText(measure);
2827
- let escaped = unit.trim().replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\s+/g, "\\s+");
2828
- return escaped.length > 0 && new RegExp(`(?<![\\p{L}\\p{N}_])${escaped}(?![\\p{L}\\p{N}_])`, "iu").test(measure);
2829
- }
2830
- function subtitleUnitClause(unit, measure) {
2831
- let normalized = unit.trim().toLowerCase();
2832
- return normalized === "x" || normalized === "\xD7" || normalized === "ratio" ? /\bper\b/i.test(measure) ? "" : /\bratio\b/i.test(measure) ? " (\xD7)" : " ratio (\xD7)" : measureNamesUnit(unit, measure) ? "" : ` in ${unit}`;
2833
- }
2834
- function frameRendersUnit(input) {
2835
- return !!(input.subtitle && input.unit && (measureNamesUnit(input.unit, input.subtitle.measure) || subtitleUnitClause(input.unit, input.subtitle.measure).length > 0));
2836
- }
2837
- function unitPrinted(input) {
2838
- return !!(input.unitShown && input.unit) || frameRendersUnit(input);
2839
- }
2840
2947
  function unitNotShownLints(options, geo) {
2841
2948
  if (!unitMissing(options, geo)) return [];
2842
2949
  let unit = options.unit.trim();
@@ -2884,20 +2991,6 @@ function noteLine(lead, items, options, total) {
2884
2991
  options?.notes?.maxListed === void 0 && options ? { lead, items, total, options } : void 0
2885
2992
  )];
2886
2993
  }
2887
- var listText = (lead, items) => `${lead}: ${items.join(", ").replace(/\.$/, "")}.`;
2888
- function fittedNote(list, fits) {
2889
- let at = (k) => listedNoteText(list, k), low = 0, high = Math.min(list.items.length, noteCap(list.options, list.items.length));
2890
- if (fits(at(high))) return at(high);
2891
- for (; high - low > 1; ) {
2892
- let mid = low + high >> 1;
2893
- fits(at(mid)) ? low = mid : high = mid;
2894
- }
2895
- return at(low);
2896
- }
2897
- function listedNoteText({ lead, items, total, options }, k) {
2898
- let n = items.length;
2899
- return k === 0 ? listText(lead, [total !== void 0 && total >= n ? countedValuesText(n, total, options) : moreListedText(n, options, !0)]) : listText(lead, k < n ? [...items.slice(0, k), moreListedText(n - k, options)] : items);
2900
- }
2901
2994
  function namedInDrawnNote(list, drawn) {
2902
2995
  let flat = (text) => text.replace(/\s+/g, ""), target = flat(drawn);
2903
2996
  for (let k = Math.min(list.items.length, noteCap(list.options, list.items.length)); k >= 0; k--) if (flat(listedNoteText(list, k)) === target) return k;
@@ -2905,22 +2998,6 @@ function namedInDrawnNote(list, drawn) {
2905
2998
  function valueNoteLine(lead, items, options, total) {
2906
2999
  return noteLine(lead, items, options, total).map((line) => valueNote(line, items));
2907
3000
  }
2908
- var DEFAULT_NOTE_LIMIT = 8;
2909
- function noteCap(options, count = 0) {
2910
- let max = options?.notes?.maxListed, cap = max === "all" ? 1 / 0 : typeof max == "number" && max >= 0 ? Math.floor(max) : DEFAULT_NOTE_LIMIT;
2911
- return cap && count === cap + 1 ? count : cap;
2912
- }
2913
- function moreListedText(count, options, alone = !1) {
2914
- return alone ? chartString2(options, "countedItems", { count }) : (options?.strings?.moreListed ?? "and {count} more").replace("{count}", String(count));
2915
- }
2916
- function countedValuesText(count, total, options) {
2917
- return chartString2(options, "countedValues", { count, total });
2918
- }
2919
- function cappedItems(items, options, total) {
2920
- let cap = noteCap(options, items.length);
2921
- return items.length <= cap ? [...items] : cap === 0 && total !== void 0 && total >= items.length ? [countedValuesText(items.length, total, options)] : [...items.slice(0, cap), moreListedText(items.length - cap, options, cap === 0)];
2922
- }
2923
- var HIDDEN_LABEL_LEAD = "Not labelled on the chart";
2924
3001
  function withCutLabelNotes(data, options, layout) {
2925
3002
  let first = layout(options);
2926
3003
  if (first.refused) return first;
@@ -3151,7 +3228,13 @@ function hiddenNoteWith(options, extras) {
3151
3228
  let own = options, items = new Map(own[NOTE_ITEMS]);
3152
3229
  for (let { id, text } of extras) items.set(id, { text });
3153
3230
  let plan = planNote(items, own[NOTE_CONTEXT] ?? { data: void 0 }, own);
3154
- return { footnotes: authoredNotes(own).filter((note) => note !== own[NOTE_LINE]), line: plan.line ? [plan.line] : [], ids: new Set(items.keys()), counted: plan.counted };
3231
+ return {
3232
+ footnotes: authoredNotes(own).filter((note) => note !== own[NOTE_LINE]),
3233
+ line: plan.line ? [plan.line] : [],
3234
+ ids: new Set(items.keys()),
3235
+ counted: plan.counted,
3236
+ marks: { strings: own.strings, [NOTE_ITEMS]: items, [NOTE_LINE]: plan.line, [NOTE_COUNTED]: plan.counted }
3237
+ };
3155
3238
  }
3156
3239
  function markNotedLabels(geo, noted, from) {
3157
3240
  let ids = new Set(geo.frame.footnoteNodeIds ?? []), notes = [
@@ -3174,12 +3257,24 @@ function markNotedLabels(geo, noted, from) {
3174
3257
  gone.size > 0 && (geo.scene = geo.scene.filter((node) => !gone.has(node.id)));
3175
3258
  }
3176
3259
  function unitMissing(options, geo) {
3260
+ return unitUnprinted(options, {
3261
+ type: geo.type,
3262
+ derived: geo.derived,
3263
+ refused: geo.warnings.some((w) => w.severity === "error"),
3264
+ *texts() {
3265
+ yield geo.scene.flatMap((node) => node.t === "text" && node.id.startsWith("frame:subtitle") ? node.lines : []).join(" ");
3266
+ for (let node of geo.scene) node.t === "text" && (yield node.lines.join(" "));
3267
+ }
3268
+ });
3269
+ }
3270
+ function unitUnprinted(options, drawn) {
3177
3271
  let unit = typeof options?.unit == "string" ? options.unit.trim() : "";
3178
- if (!unit || options?.unitShown === !0 || geo.warnings.some((w) => w.severity === "error") || geo.type === "variance" && options?.variant === "relative" || printsOnlyShares(geo.type, options, geo.derived)) return !1;
3272
+ if (!unit || options?.unitShown === !0 || drawn.refused || drawn.type === "variance" && options?.variant === "relative" || drawn.type === "table" && drawn.derived?.table?.columnUnits || printsOnlyShares(drawn.type, options, drawn.derived)) return !1;
3179
3273
  let subtitle = resolveSubtitle(options?.subtitle);
3180
3274
  if (subtitle && subtitleUnitClause(unit, subtitle.measure) === "" || !squeezeUnit(unit)) return !1;
3181
- let subtitleText = geo.scene.flatMap((node) => node.t === "text" && node.id.startsWith("frame:subtitle") ? node.lines : []).join(" "), carriesUnit = geo.type === "cohort" ? textCarriesCohortUnit : textCarriesUnit;
3182
- return !carriesUnit(subtitleText, unit) && !geo.scene.some((node) => node.t === "text" && carriesUnit(node.lines.join(" "), unit));
3275
+ let carriesUnit = drawn.type === "cohort" ? textCarriesCohortUnit : textCarriesUnit;
3276
+ for (let text of drawn.texts()) if (carriesUnit(text, unit)) return !1;
3277
+ return !0;
3183
3278
  }
3184
3279
  var PERCENT_UNIT = /^(?:%|percent|per\s*cent|pct|percentage)(?!\p{L})/iu, isPercentUnit = (unit) => PERCENT_UNIT.test(unit.trim());
3185
3280
  function columnSegmentsPrintAbsolute(options) {
@@ -3213,8 +3308,8 @@ function shareUnitLints(options, geo) {
3213
3308
  let unit = typeof options?.unit == "string" ? options.unit.trim() : "";
3214
3309
  if (!unit || PERCENT_UNIT.test(unit) || !printsOnlyShares(geo.type, options, geo.derived)) return [];
3215
3310
  if (geo.warnings.some((w) => w.severity === "error")) return [];
3216
- let measure = resolveSubtitle(options?.subtitle)?.measure ?? "", subtitleText = geo.scene.flatMap((node) => node.t === "text" && node.id.startsWith("frame:subtitle") ? node.lines : []).join(" ");
3217
- if (!measure || !textCarriesUnit(subtitleText, unit)) return [];
3311
+ let measure = resolveSubtitle(options?.subtitle)?.measure ?? "", subtitleText2 = geo.scene.flatMap((node) => node.t === "text" && node.id.startsWith("frame:subtitle") ? node.lines : []).join(" ");
3312
+ if (!measure || !textCarriesUnit(subtitleText2, unit)) return [];
3218
3313
  let escaped = unit.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\s+/g, "\\s+"), clause = new RegExp(`(?:\\bin|,|\\()\\s*${escaped}\\s*\\)?\\s*$`, "iu");
3219
3314
  if (!clause.test(measure)) return [];
3220
3315
  let kept = measure.replace(clause, "").trim(), path = typeof options?.subtitle == "string" ? "/options/subtitle" : "/options/subtitle/measure";
@@ -3227,19 +3322,13 @@ function shareUnitLints(options, geo) {
3227
3322
  ...kept ? { fix: [{ op: "replace", path, value: kept }] } : {}
3228
3323
  }];
3229
3324
  }
3230
- var UNIT_SIGNS = [
3231
- [/\b(?:EUR|euros?)\b/gi, "\u20AC"],
3232
- [/\bUSD\b/gi, "$"],
3233
- [/\bGBP\b/gi, "\xA3"],
3234
- [/\bJPY\b/gi, "\xA5"],
3235
- [/\b(?:percent|pct)\b/gi, "%"]
3236
- ], signedUnit = (text) => squeezeUnit(UNIT_SIGNS.reduce((out, [code, sign]) => out.replace(code, sign), text));
3325
+ var signedUnit = (text) => squeezeUnit(unitWordsAsSigns(text));
3237
3326
  function textCarriesUnit(text, unit) {
3238
3327
  let needle = signedUnit(unit);
3239
3328
  if (needle === "") return !1;
3240
3329
  if (needle.replace(/[^\p{L}]/gu, "").length > 2) return signedUnit(text).includes(needle);
3241
3330
  let between = String.raw`[\d\s.,'’+\-−]*`, pattern = [...needle].map((char) => char.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join(between);
3242
- return new RegExp(String.raw`(?<!\p{L})${pattern}(?!\p{L})`, "iu").test(UNIT_SIGNS.reduce((out, [code, sign]) => out.replace(code, sign), text));
3331
+ return new RegExp(String.raw`(?<!\p{L})${pattern}(?!\p{L})`, "iu").test(unitWordsAsSigns(text));
3243
3332
  }
3244
3333
  function textCarriesCohortUnit(text, unit) {
3245
3334
  let words2 = /\b(?:percentages?|per\s+cent|prozent)\b/gi;
@@ -3251,28 +3340,8 @@ function stringsIn(value) {
3251
3340
  function squeezeUnit(text) {
3252
3341
  return text.replace(/[\d\s.,'’+\-−]/g, "").toLowerCase();
3253
3342
  }
3254
- function subtitleLine(sub) {
3255
- return [sub.company, sub.measure, sub.period, sub.scenarios?.length ? formatScenarios(sub.scenarios) : void 0].filter(Boolean).join(" \xB7 ");
3256
- }
3257
- function measureUnitTail(measure, unit) {
3258
- let at = measure.lastIndexOf(", ");
3259
- if (at <= 0) return "";
3260
- let tail2 = measure.slice(at + 2);
3261
- return /^(%|in\s|per\s|[$€£¥]|(?:EUR|USD|CHF|GBP|JPY|US\$)(?![\p{L}])|index\b|score\b|share of\b|# )/iu.test(plainText(tail2)) || unit !== void 0 && unit.trim() !== "" && plainText(tail2).trim().toLowerCase() === unit.trim().toLowerCase() ? measure.slice(at + 1) : "";
3262
- }
3263
- function measureSubtitle(input, x, y, id, nextId, contentW) {
3264
- let authored = input.subtitle, sub = hasBold(authored.measure) || hasBold(authored.company ?? "") || hasBold(authored.period ?? "") ? {
3265
- ...authored,
3266
- measure: markBold(authored.measure),
3267
- ...authored.company ? { company: markBold(authored.company) } : {},
3268
- ...authored.period ? { period: markBold(authored.period) } : {}
3269
- } : authored, font = { family: input.theme.type.family, ...input.theme.type.subtitle }, boldFont = { ...font, weight: emphasisWeight(input.theme) }, trailing = "";
3270
- frameRendersUnit(input) && (trailing += subtitleUnitClause(input.unit, sub.measure)), sub.period && (trailing += ` \xB7 ${sub.period}`), sub.scenarios && sub.scenarios.length > 0 && (trailing += ` \xB7 ${formatScenarios(sub.scenarios)}`);
3271
- let segments = [];
3272
- sub.company && segments.push({ text: `${sub.company} \xB7 `, bold: !1 });
3273
- let unitTail = measureUnitTail(sub.measure, input.unit), lone = !sub.company && !unitTail && !trailing;
3274
- segments.push({ text: sub.measure.slice(0, sub.measure.length - unitTail.length), bold: !lone }), (unitTail || trailing) && segments.push({ text: unitTail + trailing, bold: !1 });
3275
- let lineH = font.size * (font.lineHeight ?? 1.3), runs = subtitleRuns(segments.map((seg) => ({
3343
+ function measureSubtitle(input, composed, x, y, id, nextId, contentW) {
3344
+ let { sub, segments } = composed, font = { family: input.theme.type.family, ...input.theme.type.subtitle }, boldFont = { ...font, weight: emphasisWeight(input.theme) }, lineH = font.size * (font.lineHeight ?? 1.3), runs = subtitleRuns(segments.map((seg) => ({
3276
3345
  text: seg.text.replace(/^ /, "\xA0").replace(/ $/, "\xA0"),
3277
3346
  ...seg.bold ? { weight: boldFont.weight } : {}
3278
3347
  })), boldFont.weight, font.weight), width = runsWidth(runs, font, boldFont, input.measure), maxLines = 1 / 0, scenarios = sub.scenarios && sub.scenarios.length > 0 ? formatScenarios(sub.scenarios) : void 0;
@@ -3441,7 +3510,30 @@ function solveFrame(input, occupied) {
3441
3510
  gapFootnoteSource: 0,
3442
3511
  gapLegend: 8
3443
3512
  }
3444
- ) : spaceTokens(theme, size.width), nodes = [], frame = {}, warnings = [], contentX = margin.left, contentW = size.width - margin.left - margin.right, headerW = size.width - margin.left - Math.min(margin.right, Math.max(0, tokens.margin.right)), topY = margin.top, bottomY = size.height - margin.bottom, seq = 0, nid = (part) => `frame:${part}:${seq++}`, bottomBlocks = [], drawBottomLegend, withFamily = (f) => ({ family: theme.type.family, ...f }), bottomKey = input.legend?.options.position === "bottom" && ((input.legend.items.length ?? 0) > 0 || (input.eventKey?.legend?.length ?? 0) > 0), footGap = bottomKey ? tokens.gapKeyFootnote : tokens.gapAxisFootnote;
3513
+ ) : spaceTokens(theme, size.width), nodes = [], frame = {}, warnings = [], contentX = margin.left, contentW = size.width - margin.left - margin.right, headerW = size.width - margin.left - Math.min(margin.right, Math.max(0, tokens.margin.right)), topY = margin.top, bottomY = size.height - margin.bottom, seq = 0, nid = (part) => `frame:${part}:${seq++}`, bottomBlocks = [], drawBottomLegend, withFamily = (f) => ({ family: theme.type.family, ...f }), bottomKey = input.legend?.options.position === "bottom" && ((input.legend.items.length ?? 0) > 0 || (input.eventKey?.legend?.length ?? 0) > 0), footGap = bottomKey ? tokens.gapKeyFootnote : tokens.gapAxisFootnote, footFont = withFamily(footerType(theme.type.footnote, input.target, input.textScale)), footInset = Math.max(0, Math.min(input.footerInset ?? 0, (contentW - 1) / 2)), footW = contentW - 2 * footInset, text = frameText({
3514
+ target: input.target,
3515
+ title: input.title || void 0,
3516
+ subtitle: input.subtitle,
3517
+ unit: input.unit,
3518
+ source: input.source,
3519
+ credit: input.credit,
3520
+ notes: input.notes,
3521
+ notesShowAuthored: input.notesShowAuthored,
3522
+ strings: input.strings,
3523
+ footnotes: (input.footnotes ?? []).map((note) => ({ text: note, meta: engineNoteMeta(note) })),
3524
+ footnotesOff: input.footnotesOff,
3525
+ numberedFootnotes: input.numberedFootnotes,
3526
+ unreferencedNotes: input.unreferencedNotes,
3527
+ numberedDisclosures: input.numberedDisclosures,
3528
+ pointedNotes: input.pointedNotes,
3529
+ compactSourceLines: input[COMPACT_SOURCE_LINES],
3530
+ width: size.width,
3531
+ footWidth: footW,
3532
+ footFont,
3533
+ boldWeight: emphasisWeight(theme),
3534
+ measure,
3535
+ policy: { pinned: staticFrame.pinned, live: staticFrame.live }
3536
+ });
3445
3537
  if (input.title) {
3446
3538
  let titleFont = theme.type.title, compactSize = input.mode === "compact" ? input.compactTitleSize ?? titleFont.size : titleFont.size, baseFont = withFamily(titleFont), fitOptions = {
3447
3539
  target: input.target,
@@ -3477,61 +3569,17 @@ function solveFrame(input, occupied) {
3477
3569
  occupied.claim({ x: contentX, y: topY, w: headerW, h }, "frame", {}), frame.titleNodeId = id, frame.titleLines = lines.length, topY += h + tokens.gapTitleSubtitle;
3478
3570
  }
3479
3571
  if (input.subtitle) {
3480
- let subtitle = measureSubtitle(input, contentX, topY, nid("subtitle"), () => nid("subtitle"), headerW);
3572
+ let subtitle = measureSubtitle(input, text.subtitle, contentX, topY, nid("subtitle"), () => nid("subtitle"), headerW);
3481
3573
  nodes.push(...subtitle.nodes), occupied.claim(subtitle.rect, "frame", {}), frame.subtitleNodeId = subtitle.nodes[0].id, topY += subtitle.rect.h + tokens.gapSubtitlePlot;
3482
3574
  } else input.title && (topY += input.cardGaps ? 8 : tokens.gapSubtitlePlot - tokens.gapTitleSubtitle);
3483
- !input.cardGaps && (input.subtitle || input.title) && theme.space.gap?.subtitlePlot === void 0 && size.width < WIDE_CANVAS_MIN_WIDTH && recordFreedChrome(frame, "header-gap", REFERENCE_SUBTITLE_PLOT_GAP - tokens.gapSubtitlePlot);
3484
- let footFont = withFamily(footerType(theme.type.footnote, input.target, input.textScale)), footMeasure = input.source && hasBold(input.source) || input.footnotes?.some(hasBold) ? boldMeasurer(measure, emphasisWeight(theme)) : measure, liveFooterH = 0, footLineH = footFont.size * (footFont.lineHeight ?? 1.3), footInset = Math.max(0, Math.min(input.footerInset ?? 0, (contentW - 1) / 2)), footX = contentX + footInset, footW = contentW - 2 * footInset, fullStatic = staticFrame.pinned, placement = fullStatic ? "frame" : input.notes?.placement ?? defaultNotePlacement(input.target), hitRoom = (y) => placement === "info" ? Math.min(y, size.height - NOTE_HIT_PX) : y, budget = fullStatic ? 1 / 0 : input.notes?.maxLines ?? defaultNoteLines(input.target, size.width), shown = new Set(input.notes?.show ?? ["note"]), pointerOn = !fullStatic && !input.footnotesOff && input.notes?.pointer !== !1, entries = [];
3485
- {
3486
- let notes = input.footnotes ?? [], numbered = input.numberedFootnotes ?? notes, unreferencedNotes = new Set(input.unreferencedNotes ?? []), next = 0, referenced = !1, unmarked = [];
3487
- for (let f of notes) {
3488
- let numberedHere = next < numbered.length && numbered[next] === f && !f.startsWith(`${HIDDEN_LABEL_LEAD}:`), numberedDisclosure = numberedHere && (input.numberedDisclosures?.includes(next + 1) ?? !1), marker = numberedHere && !unreferencedNotes.has(next + 1) ? `${footnoteMark(next + 1)} ` : "";
3489
- marker && (referenced = !0), numberedHere && marker === "" && unmarked.push(next + 1), numberedHere && (next += 1);
3490
- let meta = numberedHere ? void 0 : engineNoteMeta(f);
3491
- if (fullStatic && meta?.list && (staticFrame.countable = !0), meta?.list) {
3492
- let fitted = fittedNote(meta.list, (text) => wrapFootnote(markBold(text), footFont, footW, footMeasure).length <= 2);
3493
- f = meta.short ? engineNote(f, "disclosure", fitted, meta.values, meta.list) : engineNote(fitted, "disclosure", void 0, meta.values, meta.list);
3494
- }
3495
- let kind = numberedDisclosure ? "disclosure" : numberedHere ? "note" : meta?.kind ?? "method", fittedShort = engineNoteMeta(f)?.short ?? meta?.short, short = fittedShort && (kind !== "disclosure" || input.notes?.maxListed !== void 0 || footMeasure(markBold(fittedShort), footFont).width < footMeasure(markBold(f), footFont).width) ? fittedShort : void 0, storedMeta = meta ? { ...meta, ...engineNoteMeta(f), ...meta.ranks ? { ranks: !0 } : {} } : void 0;
3496
- entries.push(keepNoteMeta({ kind, text: f, ...short ? { short } : {}, drawn: `${marker}${kind === "disclosure" || kind === "method" && !fullStatic ? short ?? f : f}`, ...marker ? { ref: next } : {}, ...meta?.ranks ? { ranks: !0 } : {} }, storedMeta));
3497
- }
3498
- !input.footnotesOff && unmarked.length > 0 && referenced && warnings.push({
3499
- code: "footnote-unreferenced",
3500
- severity: "info",
3501
- message: `${unmarked.length === 1 ? "note" : "notes"} ${unmarked.join(", ")} ${unmarked.length === 1 ? "has" : "have"} no category or cell pointing at ${unmarked.length === 1 ? "it" : "them"} (footnote: n), so ${unmarked.length === 1 ? "it prints" : "they print"} without a number`,
3502
- suggest: "set footnote: n on the category or cell the note explains, or keep it as a note about the whole exhibit"
3503
- });
3504
- }
3505
- let rank = { note: 0, disclosure: 1, method: 2, source: 3, credit: 4 };
3506
- entries.sort((a, b) => rank[a.kind] - rank[b.kind]);
3507
- let credit = input.credit, creditInFrame = credit !== void 0 && (credit.required || fullStatic), sourceText = input.source ? sourceLine(input.source, input.strings?.source ?? localeStrings2().source) : void 0, sourceOff = sourceText !== void 0 && !fullStatic && input[COMPACT_SOURCE_LINES] === 0;
3508
- sourceOff && (frame.source = input.source, warnings.push({ code: "footnotes-off", severity: "info", message: `compact frame has no room for the source line: ${sourceText}` }));
3509
- let pointed = new Set(input.pointedNotes ?? []), kept = entries.filter((entry) => entry.kind === "disclosure" ? shown.has("disclosure") || entry.ranks === !0 && shown.has("ranks") : !input.footnotesOff && pointed.has(entry.text)), candidates = input.footnotesOff || placement === "list" ? [] : entries.filter((entry) => !kept.includes(entry) && shown.has(entry.kind) && !isQuiet(entry)), infoPanel = staticFrame.live && placement === "info", infoCount = (hidden) => allQuiet(hidden) && !(credit && !creditInFrame) ? 0 : hidden.length, listed = (k2) => infoPanel ? infoCount(entries.filter((entry) => !kept.includes(entry) && !candidates.slice(0, k2).includes(entry))) + (credit && !creditInFrame ? 1 : 0) : entries.filter((entry) => shown.has(entry.kind) && !kept.includes(entry) && !isQuiet(entry)).length - k2 + (credit && !creditInFrame ? 1 : 0), sourcePara = (k2) => {
3510
- let hidden = listed(k2), pointer = pointerOn && hidden > 0 ? notesPointer(hidden, input.strings) : void 0, source = sourceOff ? void 0 : sourceText;
3511
- return source === void 0 ? pointer : pointer === void 0 ? source : `${source}${/[.!?]$/.test(source) ? "" : "."} ${pointer}`;
3512
- }, sourceFit = (text) => !fullStatic && input[COMPACT_SOURCE_LINES] === 1 ? fitText(markBold(text), footFont, footW, 1, footMeasure) : void 0, sourceLines = (text) => sourceFit(text)?.lines ?? wrapFootnote(markBold(text), footFont, footW, footMeasure), noteLines = candidates.map((entry) => wrapFootnote(markBold(entry.drawn), footFont, footW, footMeasure)), k = candidates.length;
3513
- for (; k > 0; k--) {
3514
- let para = sourcePara(k);
3515
- if (noteLines.slice(0, k).reduce((sum, lines) => sum + lines.length, 0) + (para ? sourceLines(para).length : 0) <= budget) break;
3516
- }
3517
- let visible = /* @__PURE__ */ new Set([...candidates.slice(0, k), ...kept]), sourceBlock = sourcePara(k);
3518
- if (input.footnotesOff) {
3519
- let leftOff = entries.filter((entry) => !kept.includes(entry)).map((entry) => entry.text);
3520
- leftOff.length && warnings.push({ code: "footnotes-off", severity: "info", message: `footnotes: false left these notes off: ${leftOff.join(" | ")}` });
3521
- }
3522
- let unprinted = entries.filter((entry) => !visible.has(entry)).map((entry) => entry.text);
3523
- unprinted.length > 0 && (frame.notes = unprinted);
3524
- let noteList = [
3525
- ...entries.map((entry) => keepNoteMeta({ kind: entry.kind, text: entry.text, ...entry.short ? { short: entry.short } : {}, inFrame: visible.has(entry), ...entry.ref ? { ref: entry.ref } : {} }, engineNoteMeta(entry))),
3526
- ...input.source ? [{ kind: "source", text: input.source, inFrame: !sourceOff }] : [],
3527
- ...credit ? [{ kind: "credit", text: credit.text, short: credit.short, ...credit.links.length ? { links: credit.links.map((link) => ({ ...link })) } : {}, inFrame: creditInFrame }] : []
3528
- ].map((entry, i) => keepNoteMeta({ n: i + 1, ...entry }, engineNoteMeta(entry)));
3529
- noteList.length > 0 && (frame.noteList = noteList), frame.notePlacement = placement;
3575
+ !input.cardGaps && (input.subtitle || input.title) && theme.space.gap?.subtitlePlot === void 0 && classStepWidth(size.width) < WIDE_CANVAS_MIN_WIDTH && recordFreedChrome(frame, "header-gap", REFERENCE_SUBTITLE_PLOT_GAP - tokens.gapSubtitlePlot);
3576
+ let liveFooterH = 0, footLineH = footFont.size * (footFont.lineHeight ?? 1.3), footX = contentX + footInset, fullStatic = staticFrame.pinned;
3577
+ for (let { text: note, meta } of text.marked) engineNote(note, meta.kind, meta.short, meta.values, meta.list ?? null);
3578
+ text.countable && (staticFrame.countable = !0);
3579
+ let { placement, footMeasure, sourceText, sourceOff, sourceBlock, noteList } = text, hitRoom = (y) => placement === "info" ? Math.min(y, size.height - NOTE_HIT_PX) : y, credit = input.credit, creditInFrame = text.creditInFrame, pointerOn = text.pointerOn;
3580
+ pushAll(warnings, text.warnings), sourceOff && (frame.source = input.source), text.unprinted.length > 0 && (frame.notes = text.unprinted), noteList.length > 0 && (frame.noteList = noteList), frame.notePlacement = placement;
3530
3581
  let footParts = [
3531
- ...entries.filter((entry) => visible.has(entry)).map((entry) => {
3532
- let at = candidates.indexOf(entry);
3533
- return { text: entry.drawn, kind: "footnote", lines: at >= 0 ? noteLines[at] : wrapFootnote(markBold(entry.drawn), footFont, footW, footMeasure) };
3534
- }),
3582
+ ...text.printed.map(({ entry, lines }) => ({ text: entry.drawn, kind: "footnote", lines })),
3535
3583
  ...sourceBlock ? [{ text: sourceBlock, kind: "source" }] : [],
3536
3584
  ...credit && creditInFrame ? [{ text: `${chartString2(input, "mapCredit")}: ${credit.text}`, kind: "credit" }] : []
3537
3585
  ], footLines = 0, omitted = Array.from({ length: input[COMPACT_OMITTED_NOTES] ?? 0 }, () => ({ n: 0, kind: "note", text: "", inFrame: !1 })), liveParts = (pointer) => footerParts([...noteList, ...omitted], placement, input[LIVE_NOTE_SHOW] ?? input.notes?.show, pointer), liveHeight = (parts) => Math.max(0, htmlFooterHeight(input, parts, sourceText, footFont, contentW, footLineH, footMeasure) - (placement === "info" ? margin.bottom : 0)), withPointer = staticFrame.live && !fullStatic ? liveParts(pointerOn) : void 0;
@@ -3542,7 +3590,7 @@ function solveFrame(input, occupied) {
3542
3590
  if (footParts.length > 0 || liveFooterH > 0) {
3543
3591
  frame.footnoteNodeIds = [];
3544
3592
  for (let i = footParts.length - 1; i >= 0; i--) {
3545
- let p = footParts[i], fitted = p.kind === "source" ? sourceFit(p.text) : void 0, lines = p.lines ?? (p.kind === "source" ? sourceLines(p.text) : wrapFootnote(p.kind === "credit" ? p.text : markBold(p.text), footFont, footW, footMeasure));
3593
+ let p = footParts[i], fitted = p.kind === "source" ? text.sourceLines(p.text) : void 0, lines = p.lines ?? fitted?.lines ?? wrapFootnote(p.kind === "credit" ? p.text : markBold(p.text), footFont, footW, footMeasure);
3546
3594
  bottomY -= footLineH * lines.length, footLines += lines.length;
3547
3595
  let id = nid(p.kind);
3548
3596
  nodes.push({
@@ -3564,7 +3612,7 @@ function solveFrame(input, occupied) {
3564
3612
  gap: i > 0 && (p.kind === "source" || p.kind === "credit" && footParts[i - 1].kind === "footnote") ? tokens.gapFootnoteSource : 0
3565
3613
  }), p.kind === "credit" ? (frame.creditNodeId = id, i > 0 && footParts[i - 1].kind === "footnote" && (bottomY -= tokens.gapFootnoteSource)) : p.kind === "source" ? (frame.sourceNodeId = id, i > 0 && (bottomY -= tokens.gapFootnoteSource)) : frame.footnoteNodeIds.unshift(id);
3566
3614
  }
3567
- liveFooterH > size.height - margin.bottom - bottomY + 0.01 && (liveFooterExtra.set(frame, liveFooterH - (size.height - margin.bottom - bottomY) + (footParts.length === 0 ? input.eventKey ? KEY_NOTE_GAP : footGap : 0)), bottomY = size.height - margin.bottom - liveFooterH), bottomY = hitRoom(bottomY), frame.footerRect = { x: contentX, y: bottomY, w: contentW, h: size.height - margin.bottom - bottomY }, bottomY -= input.eventKey ? KEY_NOTE_GAP : footGap, recordFreedChrome(frame, "footer-text", footLines * (withFamily(theme.type.footnote).size - footFont.size) * (footFont.lineHeight ?? 1.3)), !input.cardGaps && !input.eventKey && bottomKey && theme.space.gap?.axisFootnote === void 0 && size.width < WIDE_CANVAS_MIN_WIDTH && recordFreedChrome(frame, "key-footer-gap", REFERENCE_FOOTER_GAP - tokens.gapKeyFootnote);
3615
+ liveFooterH > size.height - margin.bottom - bottomY + 0.01 && (liveFooterExtra.set(frame, liveFooterH - (size.height - margin.bottom - bottomY) + (footParts.length === 0 ? input.eventKey ? KEY_NOTE_GAP : footGap : 0)), bottomY = size.height - margin.bottom - liveFooterH), bottomY = hitRoom(bottomY), frame.footerRect = { x: contentX, y: bottomY, w: contentW, h: size.height - margin.bottom - bottomY }, bottomY -= input.eventKey ? KEY_NOTE_GAP : footGap, recordFreedChrome(frame, "footer-text", footLines * (withFamily(theme.type.footnote).size - footFont.size) * (footFont.lineHeight ?? 1.3)), !input.cardGaps && !input.eventKey && bottomKey && theme.space.gap?.axisFootnote === void 0 && classStepWidth(size.width) < WIDE_CANVAS_MIN_WIDTH && recordFreedChrome(frame, "key-footer-gap", REFERENCE_FOOTER_GAP - tokens.gapKeyFootnote);
3568
3616
  }
3569
3617
  if (footerPlans.set(frame, fullStatic ? { ...input, fullStaticFooter: !0 } : input), credit?.required && frame.creditNodeId === void 0 && warnings.push({ code: "credit-hidden", severity: "warn", message: `the map credit the licence requires is not drawn: ${credit.text}`, suggest: "Keep the credit visible under the chart, linked on a web page." }), input.eventKey) {
3570
3618
  let key = input.eventKey.layout(contentX, contentW);
@@ -3574,10 +3622,10 @@ function solveFrame(input, occupied) {
3574
3622
  if (legendInput && legendInput.items.length > 0) {
3575
3623
  let { options } = legendInput, { items } = dedupeLegendKeys(legendInput.items, (item) => identityAppearance(item, theme));
3576
3624
  pushAll(warnings, identityCollisionWarnings(items, theme));
3577
- let footKey = input.legendFont === "footnote" || input.legendFont === "compact" && theme.type.footnote.size <= secondaryType(theme).size, keyCap = footKey ? 1 / 0 : scaleTextAtFloor(targetTypeSizesPx(input.target ?? DEFAULT_TARGET, "S").axis, input.textScale ?? 1, targetFloorsPx(input.target ?? DEFAULT_TARGET).secondary), keyRole = footKey ? theme.type.footnote : secondaryType(theme), font = withFamily(!hasAuthoredTypeSize(keyRole) && keyRole.size > keyCap ? { ...keyRole, size: keyCap } : keyRole), lineH = Math.max(SWATCH, font.size * (font.lineHeight ?? 1.2)), typeRole = footKey ? "footnote" : "secondary", sideWanted = options.position === "right" || options.position === "left", labelBudget = sideWanted ? contentW * 0.45 : contentW, ringH = (it) => it.key === "sizes" ? Math.max(it.ringRow ?? 0, Math.ceil(2 * Math.max(0.5, ...it.radii ?? []))) : 0, maxKeyW = maxOf(items.map((it) => keyWidth(it, Math.max(lineH, ringH(it))))), valueFont = { ...font, weight: emphasisWeight(theme) }, wrapKeys = (budget2) => new Map(items.map((it) => [it, wrapFootnote(
3625
+ let footKey = input.legendFont === "footnote" || input.legendFont === "compact" && theme.type.footnote.size <= secondaryType(theme).size, keyCap = footKey ? 1 / 0 : scaleTextAtFloor(targetTypeSizesPx(input.target ?? DEFAULT_TARGET, "S").axis, input.textScale ?? 1, targetFloorsPx(input.target ?? DEFAULT_TARGET).secondary), keyRole = footKey ? theme.type.footnote : secondaryType(theme), font = withFamily(!hasAuthoredTypeSize(keyRole) && keyRole.size > keyCap ? { ...keyRole, size: keyCap } : keyRole), lineH = Math.max(SWATCH, font.size * (font.lineHeight ?? 1.2)), typeRole = footKey ? "footnote" : "secondary", sideWanted = options.position === "right" || options.position === "left", labelBudget = sideWanted ? contentW * 0.45 : contentW, ringH = (it) => it.key === "sizes" ? Math.max(it.ringRow ?? 0, Math.ceil(2 * Math.max(0.5, ...it.radii ?? []))) : 0, maxKeyW = maxOf(items.map((it) => keyWidth(it, Math.max(lineH, ringH(it))))), valueFont = { ...font, weight: emphasisWeight(theme) }, wrapKeys = (budget) => new Map(items.map((it) => [it, wrapFootnote(
3578
3626
  it.label,
3579
3627
  font,
3580
- Math.max(1, budget2 - maxKeyW - SWATCH_GAP2 - (it.value ? SWATCH_GAP2 + measure(it.value, valueFont).width : 0)),
3628
+ Math.max(1, budget - maxKeyW - SWATCH_GAP2 - (it.value ? SWATCH_GAP2 + measure(it.value, valueFont).width : 0)),
3581
3629
  measure
3582
3630
  )])), wrappedKeys = wrapKeys(labelBudget), keyTextH = (it) => Math.max(1, wrappedKeys.get(it).length) * lineH, textWOf = (it) => Math.max(0, ...wrappedKeys.get(it).map((line) => measure(line, font).width)), itemTextW = (it) => textWOf(it) + (it.value ? SWATCH_GAP2 + measure(it.value, valueFont).width : 0), valueNode = (it, lbId, x, y) => ({
3583
3631
  t: "text",
@@ -3593,11 +3641,11 @@ function solveFrame(input, occupied) {
3593
3641
  part: "legendValue"
3594
3642
  }), keyNodes = (it, id, x, y, height2) => legendKeyNodes(theme, it, id, x, y, height2, font).map((node) => node.t === "text" ? { ...node, typeRole } : node), capMidBelowTop = font.size * TEXT_ASCENT2 - (measure.capHeight?.(font) ?? font.size * 0.72) / 2, keyTopAt = (textTop, height2) => textTop + capMidBelowTop - height2 / 2, onLabelLine = (keys, textTop) => keys.map((node) => node.t === "text" && node.part === "swatch" ? { ...node, y: textTop } : node), sideKeyW = maxOf(items.map((it) => keyWidth(it, Math.max(lineH, ringH(it))))), sideLegendW = sideKeyW + SWATCH_GAP2 + maxOf(items.map(itemTextW));
3595
3643
  if (sideWanted && !input.sideKeyFixed) {
3596
- let columnH = items.reduce((h, it) => h + Math.max(keyTextH(it), ringH(it)) + 4, -4), plotW = size.width - margin.right - margin.left - sideLegendW - 16 - Math.max(0, input.plotInset?.left ?? 0), widthShort = plotW < SIDE_KEY_PLOT_SHARE * size.width;
3644
+ let columnH = items.reduce((h, it) => h + Math.max(keyTextH(it), ringH(it)) + 4, -4), plotW = size.width - margin.right - margin.left - sideLegendW - 16 - Math.max(0, input.plotInset?.left ?? 0), shareShort = plotW < SIDE_KEY_PLOT_SHARE * size.width, widthShort = shareShort || input.sideKeyGivesWay === !0;
3597
3645
  (widthShort || columnH > bottomY - topY) && (warnings.push({
3598
3646
  code: "legend-side-fallback",
3599
3647
  severity: "warn",
3600
- message: widthShort ? `the key stays in the row above the plot: a column beside it would leave the plot ${Math.round(Math.max(0, plotW))} px, under ${Math.round(SIDE_KEY_PLOT_SHARE * 100)}% of the ${Math.round(size.width)} px width` : `the key stays in the row above the plot: its ${Math.round(columnH)} px column is taller than the ${Math.round(Math.max(0, bottomY - topY))} px beside the plot`,
3648
+ message: shareShort ? `the key stays in the row above the plot: a column beside it would leave the plot ${Math.round(Math.max(0, plotW))} px, under ${Math.round(SIDE_KEY_PLOT_SHARE * 100)}% of the ${Math.round(size.width)} px width` : widthShort ? `the key stays in the row above the plot: with a column beside it the chart does not fit the ${Math.round(size.width)} px width` : `the key stays in the row above the plot: its ${Math.round(columnH)} px column is taller than the ${Math.round(Math.max(0, bottomY - topY))} px beside the plot`,
3601
3649
  suggest: widthShort ? "Give the chart more width, or shorten the series names, to keep the key beside the plot." : "Give the chart more height, or show fewer series, to keep the key beside the plot.",
3602
3650
  field: ["options", "legend"]
3603
3651
  }), options = { ...options, position: "top" }, wrappedKeys = wrapKeys(contentW));
@@ -3627,8 +3675,8 @@ function solveFrame(input, occupied) {
3627
3675
  message: `the key stands beside the plot and takes ${Math.round(legendW + 16)} px of its width; 'top' keeps the plot full width`
3628
3676
  });
3629
3677
  } else {
3630
- let keyH = lineH, titles = /* @__PURE__ */ new Map(), plainRowH = Math.max(tokens.legendRowH, lineH, maxOf(items.map(ringH))) + (input.cardGaps ? 4 : 0), budget2 = input[LEGEND_HEIGHT], available = budget2?.height === "auto" ? size.height * furnitureBudget(size.width) - (size.height - bottomY + topY) - tokens.gapLegend : budget2?.height ?? 1 / 0, fullBlockH;
3631
- if (Number.isFinite(available) && available >= plainRowH && items.every((it) => budget2?.names.get(it.id) === it.label && it.key !== "heading" && ringH(it) <= keyH)) {
3678
+ let keyH = lineH, titles = /* @__PURE__ */ new Map(), plainRowH = Math.max(tokens.legendRowH, lineH, maxOf(items.map(ringH))) + (input.cardGaps ? 4 : 0), budget = input[LEGEND_HEIGHT], available = budget?.height === "auto" ? size.height * furnitureBudget(size.width) - (size.height - bottomY + topY) - tokens.gapLegend : budget?.height ?? 1 / 0, fullBlockH;
3679
+ if (Number.isFinite(available) && available >= plainRowH && items.every((it) => budget?.names.get(it.id) === it.label && it.key !== "heading" && ringH(it) <= keyH)) {
3632
3680
  let widths = items.map((it) => keyWidth(it, keyH) + SWATCH_GAP2 + itemTextW(it));
3633
3681
  if (fullBlockH = (1 + keyRowStarts(widths, items.map(() => !1), contentW).filter(Boolean).length) * (Math.max(tokens.legendRowH, maxOf(items.map(keyTextH))) + (input.cardGaps ? 4 : 0)) - (input.cardGaps ? 4 : 0), fullBlockH > available) {
3634
3682
  let perRow = Math.ceil(items.length / Math.floor(available / plainRowH)), entryWidth = (contentW - ITEM_GAP * (perRow - 1)) / perRow, fitted = items.map((it) => fitText(
@@ -3639,10 +3687,10 @@ function solveFrame(input, occupied) {
3639
3687
  measure,
3640
3688
  { target: input.target, typeRole }
3641
3689
  )), texts = fitted.map((fit) => fit.lines.join("")), seen = /* @__PURE__ */ new Map();
3642
- texts.every((text, i) => {
3643
- if (!text || text === "\u2026" || seen.has(text) && seen.get(text) !== items[i].label) return !1;
3644
- seen.set(text, items[i].label);
3645
- let stem = text.endsWith("\u2026") ? text.slice(0, -1) : void 0;
3690
+ texts.every((text2, i) => {
3691
+ if (!text2 || text2 === "\u2026" || seen.has(text2) && seen.get(text2) !== items[i].label) return !1;
3692
+ seen.set(text2, items[i].label);
3693
+ let stem = text2.endsWith("\u2026") ? text2.slice(0, -1) : void 0;
3646
3694
  return stem === void 0 || !texts.some((other, j) => j !== i && items[j].label !== items[i].label && other.startsWith(stem));
3647
3695
  }) && items.forEach((it, i) => {
3648
3696
  wrappedKeys.set(it, fitted[i].lines), fitted[i].title && titles.set(it, it.label);
@@ -3992,26 +4040,6 @@ function datePatternFromExample(example, language) {
3992
4040
  }
3993
4041
 
3994
4042
  export {
3995
- rectsOverlap,
3996
- rectContains,
3997
- polylineYAt,
3998
- rectLineDistance,
3999
- sideAwayFrom,
4000
- segmentHitsRect,
4001
- rectHitsConvexPolygon,
4002
- deltaGap,
4003
- boxGap,
4004
- rectCenter,
4005
- inflate,
4006
- boundsOf,
4007
- unionRect,
4008
- clamp,
4009
- round2,
4010
- cleanFloat,
4011
- cleanSum,
4012
- cleanDiff,
4013
- strokeBoxPad,
4014
- rowLabelX,
4015
4043
  chartString2 as chartString,
4016
4044
  localeStrings2 as localeStrings,
4017
4045
  furnitureBudget,
@@ -4061,7 +4089,11 @@ export {
4061
4089
  cutLabels,
4062
4090
  labelOmissions,
4063
4091
  reportLabelOmissions,
4064
- createOccupiedIndex,
4092
+ claimId,
4093
+ HOST_CLAIMS,
4094
+ requestClaims,
4095
+ unprintedClaims,
4096
+ withUnprintedClaims,
4065
4097
  nearestIsOwn,
4066
4098
  leaderCrosses,
4067
4099
  inkBox,
@@ -4095,10 +4127,22 @@ export {
4095
4127
  markedLabel,
4096
4128
  footnoteSuffix,
4097
4129
  categoryLabelsAndMarks,
4098
- defaultAnnotationId,
4099
- ANNOTATION_KIND_PURPOSES,
4130
+ HIDDEN_LABEL_LEAD,
4131
+ frameText,
4132
+ fittedNote,
4133
+ DEFAULT_NOTE_LIMIT,
4134
+ noteCap,
4135
+ moreListedText,
4136
+ cappedItems,
4137
+ subtitleUnitClause,
4138
+ frameRendersUnit,
4139
+ unitPrinted,
4140
+ subtitleLine,
4100
4141
  HEIGHT_STRUCTURE,
4101
4142
  assertEmbeddedImage,
4143
+ arrowLook,
4144
+ calloutArrowLook,
4145
+ calloutArrowReach,
4102
4146
  arrowSeats,
4103
4147
  finishCalloutHeads,
4104
4148
  anchorValueBox,
@@ -4136,19 +4180,10 @@ export {
4136
4180
  settledAutoHeight,
4137
4181
  fixedPlotChrome,
4138
4182
  plotHeightAfter,
4139
- subtitleUnitClause,
4140
- frameRendersUnit,
4141
- unitPrinted,
4142
4183
  unitNotShownLints,
4143
4184
  unitInFormatLints,
4144
4185
  noteLine,
4145
- fittedNote,
4146
4186
  valueNoteLine,
4147
- DEFAULT_NOTE_LIMIT,
4148
- noteCap,
4149
- moreListedText,
4150
- cappedItems,
4151
- HIDDEN_LABEL_LEAD,
4152
4187
  withCutLabelNotes,
4153
4188
  finishCutLabelNotes,
4154
4189
  DEFER_DENSITY_NOTES,
@@ -4168,6 +4203,7 @@ export {
4168
4203
  hiddenNoteWith,
4169
4204
  markNotedLabels,
4170
4205
  unitMissing,
4206
+ unitUnprinted,
4171
4207
  isPercentUnit,
4172
4208
  columnSegmentsPrintAbsolute,
4173
4209
  shareUnitOptions,
@@ -4175,7 +4211,6 @@ export {
4175
4211
  textCarriesUnit,
4176
4212
  textCarriesCohortUnit,
4177
4213
  stringsIn,
4178
- subtitleLine,
4179
4214
  solveFrame,
4180
4215
  readDateFormat,
4181
4216
  formatDate,