boardplot 0.56.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 (552) hide show
  1. package/CHANGELOG.md +408 -0
  2. package/README.md +49 -15
  3. package/dist/{DiagnosticDetails-JFBBXOT2.js → DiagnosticDetails-VGSL4NJK.js} +1 -1
  4. package/dist/{ReaderBox-GLCKYXBU.js → ReaderBox-MHMXIDAJ.js} +8 -7
  5. package/dist/{annotateEngine-QVNAE3EH.js → annotateEngine-753KQBNN.js} +2 -1
  6. package/dist/build-identity.json +3 -3
  7. package/dist/{chunk-HZUAEMN5.js → chunk-2CQBBN7M.js} +4 -4
  8. package/dist/{chunk-K3VZ5QJK.js → chunk-2ETK5TSA.js} +4 -4
  9. package/dist/{chunk-HHXIVFAU.js → chunk-2ETSI2EL.js} +11 -9
  10. package/dist/{chunk-ECBUFKCP.js → chunk-2GRXHWRH.js} +3 -3
  11. package/dist/{chunk-ZVM5TFGR.js → chunk-2HII2B6S.js} +6 -2
  12. package/dist/{chunk-WBETBGSC.js → chunk-2LC2H3ZM.js} +1003 -907
  13. package/dist/chunk-2NX7EO7H.js +23 -0
  14. package/dist/{chunk-52WNCUIN.js → chunk-2QI2PK2O.js} +1 -1
  15. package/dist/{chunk-QWCLWFKC.js → chunk-2VKQQLP7.js} +180 -58
  16. package/dist/chunk-3DOVXJ6K.js +602 -0
  17. package/dist/{chunk-CAJ54IEP.js → chunk-3E6NLODZ.js} +1 -1
  18. package/dist/{chunk-MOS6WFWM.js → chunk-3HA4IJTO.js} +9 -9
  19. package/dist/{chunk-JCIXYOND.js → chunk-3HPPTQEW.js} +4 -4
  20. package/dist/{chunk-7VVHTOE7.js → chunk-3KT2647F.js} +4 -2
  21. package/dist/{chunk-O6ZTIDWB.js → chunk-3MFVJMP6.js} +3 -2
  22. package/dist/{chunk-KQCKK3LD.js → chunk-3P3FKPFN.js} +170 -73
  23. package/dist/{chunk-WI5VOSQX.js → chunk-3XAJSMYD.js} +2 -2
  24. package/dist/{chunk-CPGASWNN.js → chunk-42QKUSHJ.js} +13 -3
  25. package/dist/{chunk-QB5HV4IY.js → chunk-44JU3VOT.js} +7 -8
  26. package/dist/{chunk-BYCJ6TKI.js → chunk-44K75CYE.js} +3 -3
  27. package/dist/{chunk-MS7O3KDJ.js → chunk-4FNM4D57.js} +6 -6
  28. package/dist/{chunk-BVYIKLQ5.js → chunk-4ROZ4TFL.js} +1 -1
  29. package/dist/{chunk-3V62N3Z7.js → chunk-4VV3KUFT.js} +7 -8
  30. package/dist/{chunk-MAFPVR4G.js → chunk-54YO56IK.js} +10 -5
  31. package/dist/{chunk-JMGB444D.js → chunk-5ACFYNA4.js} +8 -4
  32. package/dist/{chunk-6AMN7IKJ.js → chunk-5JEU6MWC.js} +49 -28
  33. package/dist/{chunk-NCLRZQR6.js → chunk-5JIB4VJA.js} +18 -10
  34. package/dist/{chunk-SXD3OYAR.js → chunk-5OP3E2ZD.js} +205 -96
  35. package/dist/{chunk-SS4YGK3E.js → chunk-5SLBD4BT.js} +72 -304
  36. package/dist/{chunk-XMP2DNLI.js → chunk-5SVGTQTW.js} +4 -4
  37. package/dist/chunk-5U567TYU.js +23 -0
  38. package/dist/chunk-5ZLF4S7X.js +40 -0
  39. package/dist/{chunk-T2YDWT54.js → chunk-5ZMTQATF.js} +261 -147
  40. package/dist/{chunk-WXJ5MHLH.js → chunk-62BDQTO6.js} +2 -2
  41. package/dist/chunk-64K3V4VN.js +25 -0
  42. package/dist/{chunk-BK6P6KMW.js → chunk-67YJJJIB.js} +1 -1
  43. package/dist/{chunk-32LLDRPI.js → chunk-6DJNFT2K.js} +42 -32
  44. package/dist/{chunk-JYAZPMSA.js → chunk-6IUK6PAH.js} +7 -6
  45. package/dist/{chunk-7STMIK2X.js → chunk-6JFQCVNN.js} +4 -4
  46. package/dist/chunk-6JXBLQJ2.js +32 -0
  47. package/dist/{chunk-5TWY3ZIC.js → chunk-6XPV6M3Q.js} +5 -5
  48. package/dist/{chunk-MPO5TVGF.js → chunk-6ZDSEITW.js} +3 -3
  49. package/dist/{chunk-75WIUG2W.js → chunk-72HVDLMT.js} +172 -78
  50. package/dist/chunk-75NU5RLX.js +24 -0
  51. package/dist/chunk-76GPN6AT.js +72 -0
  52. package/dist/chunk-7BQK2UDV.js +13 -0
  53. package/dist/{chunk-CF4NMRN7.js → chunk-7CAYRPJV.js} +45 -25
  54. package/dist/{chunk-U3A6FMSI.js → chunk-7GWWBHVQ.js} +7 -7
  55. package/dist/{chunk-CHAS5A5B.js → chunk-7NYUFMLJ.js} +149 -86
  56. package/dist/{chunk-D2B3KP35.js → chunk-7VWXXBTC.js} +4 -0
  57. package/dist/chunk-A65B23JK.js +113 -0
  58. package/dist/{chunk-4KMZAK6J.js → chunk-A7R6FUS6.js} +4 -4
  59. package/dist/{chunk-E2ZUBP4Q.js → chunk-AEVGUOPB.js} +7 -8
  60. package/dist/chunk-AHIK2N72.js +53 -0
  61. package/dist/{chunk-KLB2QC24.js → chunk-AICO24HJ.js} +5 -2
  62. package/dist/{chunk-7KSUMFBK.js → chunk-AJGSCVVW.js} +5 -1
  63. package/dist/{chunk-RSCRIWAH.js → chunk-AL62JJTB.js} +10 -3
  64. package/dist/{chunk-E7V3OHQQ.js → chunk-AN2V2LC4.js} +37 -22
  65. package/dist/{chunk-JIEVDGAF.js → chunk-AOFUA5XP.js} +1 -1
  66. package/dist/chunk-B5A7X2BA.js +44 -0
  67. package/dist/{chunk-2HTYGMMG.js → chunk-BCMEGJRX.js} +2 -2
  68. package/dist/{chunk-KD5GOR2K.js → chunk-BDIKWR45.js} +124 -69
  69. package/dist/{chunk-FNRPQIQE.js → chunk-BG6AIWAK.js} +4 -6
  70. package/dist/{chunk-ZMPH2OC4.js → chunk-BOT6W3VB.js} +7 -8
  71. package/dist/{chunk-DRHQG44U.js → chunk-BQBD6Q5J.js} +6 -2
  72. package/dist/{chunk-2DOEZ5QY.js → chunk-BZ67BJBH.js} +11 -10
  73. package/dist/{chunk-UBCVBBJJ.js → chunk-C47POAC5.js} +4 -3
  74. package/dist/{chunk-O7REHICC.js → chunk-C5OBPO4Z.js} +36 -28
  75. package/dist/{chunk-IGNBQT23.js → chunk-CCAAI56H.js} +121 -10
  76. package/dist/{chunk-RPIKNMZA.js → chunk-CDUR3KWV.js} +7 -2
  77. package/dist/{chunk-MZACASZY.js → chunk-CMPHT2LS.js} +14 -2
  78. package/dist/{chunk-FHA3KMFC.js → chunk-CQBPNE7Z.js} +5 -1
  79. package/dist/{chunk-IVRYF7QA.js → chunk-CR5FP5SF.js} +1 -1
  80. package/dist/{chunk-DD6RVD3S.js → chunk-D2TQX7UJ.js} +5 -1
  81. package/dist/{chunk-VVXKFU72.js → chunk-DEANHDXU.js} +62 -41
  82. package/dist/{chunk-GM3EGUYW.js → chunk-DHGE46UK.js} +1 -1
  83. package/dist/{chunk-UZTQUPTB.js → chunk-DIHX6NUB.js} +5 -5
  84. package/dist/{chunk-MD6DCQMA.js → chunk-DILQ34NW.js} +37 -37
  85. package/dist/{chunk-YMTXTQCN.js → chunk-DJKRYJP7.js} +6 -6
  86. package/dist/{chunk-JCAGVAB3.js → chunk-DKLC6QLF.js} +1200 -21
  87. package/dist/{chunk-SRAV6FPB.js → chunk-DNHTMCUP.js} +3 -3
  88. package/dist/{chunk-CKGSGRP7.js → chunk-DORE2RHL.js} +21 -5
  89. package/dist/{chunk-SMHZXHHD.js → chunk-DZYTXZNS.js} +15 -5
  90. package/dist/chunk-E262NRFP.js +39 -0
  91. package/dist/{chunk-V5JQQMFQ.js → chunk-E5YF236N.js} +4 -1
  92. package/dist/{chunk-IGJ2G5C6.js → chunk-EBUK7HJP.js} +6 -6
  93. package/dist/{chunk-ZL6IHMOW.js → chunk-ECBHC272.js} +198 -119
  94. package/dist/{chunk-SA46CNMS.js → chunk-ED7GLWTF.js} +4 -1
  95. package/dist/chunk-EFW43JQJ.js +24 -0
  96. package/dist/{chunk-5P2TTHBZ.js → chunk-EHRRHSPV.js} +2 -2
  97. package/dist/{chunk-JXBZIJCG.js → chunk-EILNJQMN.js} +32 -12
  98. package/dist/{chunk-GELSK76Y.js → chunk-ERDKMZ7O.js} +3 -3
  99. package/dist/{chunk-T2CYNDYU.js → chunk-ETRAPN5G.js} +366 -130
  100. package/dist/{chunk-JEUL777U.js → chunk-ETUKDEGL.js} +21 -12
  101. package/dist/chunk-F2ET5ZTT.js +49 -0
  102. package/dist/{chunk-2YO4WRJN.js → chunk-F3XOBFS4.js} +40 -29
  103. package/dist/{chunk-SPSGUFTI.js → chunk-FB6X7QHA.js} +1 -1
  104. package/dist/{chunk-5PPQIF4D.js → chunk-FGW54I23.js} +7 -8
  105. package/dist/{chunk-JTC5SEAQ.js → chunk-FP5B5XIL.js} +7 -3
  106. package/dist/{chunk-RJGCYGC3.js → chunk-FRHQGA5Q.js} +86 -250
  107. package/dist/{chunk-YZZLIYPA.js → chunk-FRR7BJ3B.js} +5 -1
  108. package/dist/{chunk-4DZFR52I.js → chunk-FVWHEM2N.js} +7 -5
  109. package/dist/{chunk-YPYD6OJ3.js → chunk-FWSMENKH.js} +2 -2
  110. package/dist/{chunk-YYJORENB.js → chunk-FWTUGNSF.js} +8 -8
  111. package/dist/{chunk-GIHH6VC2.js → chunk-FZKDZQ6U.js} +10 -6
  112. package/dist/{chunk-S7NRL66K.js → chunk-G4FF6G3I.js} +26 -17
  113. package/dist/{chunk-PQLAZEQV.js → chunk-GB6BZSTL.js} +248 -92
  114. package/dist/chunk-GCIHRRDJ.js +24 -0
  115. package/dist/{chunk-X3KCQEYZ.js → chunk-GHCU6OSE.js} +9 -1
  116. package/dist/chunk-GKDUIDU6.js +138 -0
  117. package/dist/chunk-GO66OCN7.js +24 -0
  118. package/dist/chunk-GOFS336W.js +24 -0
  119. package/dist/{chunk-AGDDH6XY.js → chunk-GQYT7G4F.js} +5 -1
  120. package/dist/{chunk-WN3HEU3P.js → chunk-GUTLXO7Q.js} +140 -89
  121. package/dist/chunk-H3VICNTN.js +47 -0
  122. package/dist/{chunk-GC4WOLV3.js → chunk-HAG3K6PQ.js} +14 -2
  123. package/dist/{chunk-CB4CERXZ.js → chunk-HBQHSZ6S.js} +11 -2
  124. package/dist/chunk-HTQGJQZN.js +124 -0
  125. package/dist/{chunk-F77TMAUY.js → chunk-HUQRO6VF.js} +39 -36
  126. package/dist/{chunk-4KQHKPB3.js → chunk-I5VDW2XZ.js} +543 -509
  127. package/dist/{chunk-43GGVT7W.js → chunk-I5VNHDPR.js} +11 -4
  128. package/dist/{chunk-4LTN7SND.js → chunk-IDXYHDQY.js} +1 -1
  129. package/dist/{chunk-Y54LU4CU.js → chunk-IIWZJ5ZM.js} +1 -1
  130. package/dist/{chunk-FMDNJ6PC.js → chunk-IPBOREIY.js} +2 -2
  131. package/dist/chunk-IU335UO7.js +27 -0
  132. package/dist/{chunk-JVZTKQFS.js → chunk-IVDTP6SV.js} +9 -5
  133. package/dist/{chunk-BDGLMWPO.js → chunk-IXOBDDMW.js} +11 -2
  134. package/dist/{chunk-EIL3KHAL.js → chunk-J4QRB6DQ.js} +5 -5
  135. package/dist/{chunk-3465633G.js → chunk-JCMGKQVS.js} +3 -3
  136. package/dist/{chunk-YK2KWNTU.js → chunk-JM7UTLF3.js} +28 -14
  137. package/dist/{chunk-CXETOLPX.js → chunk-JNDWRV34.js} +4 -4
  138. package/dist/{chunk-DLUNQHFO.js → chunk-JSRQTDZZ.js} +26 -24
  139. package/dist/{chunk-WTQAG2OT.js → chunk-JT3UTEWZ.js} +8 -3
  140. package/dist/{chunk-GQT2SY2S.js → chunk-JUYRDZSV.js} +291 -151
  141. package/dist/{chunk-LKMFMNQX.js → chunk-JVGL2SCN.js} +1 -1
  142. package/dist/{chunk-4JC3SE4G.js → chunk-JY4LTPOV.js} +1 -1
  143. package/dist/chunk-K7XPTQBJ.js +267 -0
  144. package/dist/{chunk-P4SMC4BY.js → chunk-KGBUXMFP.js} +120 -86
  145. package/dist/{chunk-XC5IRUEL.js → chunk-KIE5V3DA.js} +2 -2
  146. package/dist/{chunk-RT66UTLJ.js → chunk-KU4PCG4W.js} +2 -2
  147. package/dist/{chunk-VPL3JYC6.js → chunk-KVBLTAO7.js} +52 -10
  148. package/dist/{chunk-XCROSJ2Z.js → chunk-KW4JXWHO.js} +1 -1
  149. package/dist/{chunk-PJBEJR2U.js → chunk-KWIP5YRA.js} +24 -7
  150. package/dist/{chunk-JYBT2JNY.js → chunk-LE3LSEUL.js} +27 -2
  151. package/dist/{chunk-R2IKOLBK.js → chunk-LG6M2JTH.js} +3 -3
  152. package/dist/{chunk-DF3XEFQ7.js → chunk-LIE2WSB4.js} +21 -18
  153. package/dist/{chunk-Z55DXFWS.js → chunk-LJDATBPB.js} +26 -16
  154. package/dist/{chunk-KLIZXSBK.js → chunk-LMMS675D.js} +10 -9
  155. package/dist/{chunk-MRAP2UVV.js → chunk-LPKGZ664.js} +286 -35
  156. package/dist/{chunk-JFFREZGT.js → chunk-LPMSGO7L.js} +6 -2
  157. package/dist/chunk-LQWINE7K.js +211 -0
  158. package/dist/{chunk-6MJUW5R5.js → chunk-MKMMQDIY.js} +139 -71
  159. package/dist/{chunk-F5BYLT3M.js → chunk-MQ4IEDM5.js} +462 -138
  160. package/dist/{chunk-QGFKSDQO.js → chunk-MRM4KJ2O.js} +2 -2
  161. package/dist/{chunk-ETMHDCEH.js → chunk-MX2OZHIT.js} +102 -42
  162. package/dist/{chunk-6EYTD777.js → chunk-MXUPMGRY.js} +2 -2
  163. package/dist/{chunk-2FKEF2AC.js → chunk-NHU26HQ7.js} +58 -35
  164. package/dist/{chunk-KBJMLXNW.js → chunk-NQVJ4FPY.js} +161 -78
  165. package/dist/chunk-NZ7FX3AE.js +65 -0
  166. package/dist/chunk-OALBVELJ.js +23 -0
  167. package/dist/{chunk-5S3JQ5AT.js → chunk-OGZ4UPYK.js} +183 -137
  168. package/dist/{chunk-6WHWXCHJ.js → chunk-OMNB27GM.js} +7 -3
  169. package/dist/{chunk-EGGDPDYJ.js → chunk-OO63YP35.js} +1 -1
  170. package/dist/{chunk-ZYQYX66L.js → chunk-OPYDTW5Q.js} +6 -6
  171. package/dist/{chunk-A2GAWGVJ.js → chunk-OSJN7KDS.js} +68 -39
  172. package/dist/{chunk-RMC4OONA.js → chunk-OSJXIW6I.js} +1030 -1123
  173. package/dist/{chunk-X23SZHV5.js → chunk-OVVE42P4.js} +6 -6
  174. package/dist/{chunk-CCJP6QZO.js → chunk-OZA7HA6L.js} +1 -1
  175. package/dist/chunk-OZLKEBCD.js +54 -0
  176. package/dist/{chunk-TE4M52AA.js → chunk-P6DEFCMQ.js} +18 -2
  177. package/dist/{chunk-AMR4SUAN.js → chunk-PDTIQL3B.js} +6 -6
  178. package/dist/{chunk-BIVL764T.js → chunk-PJ5BYZPN.js} +2 -2
  179. package/dist/{chunk-BISJK67O.js → chunk-PK7Z7WRJ.js} +98 -46
  180. package/dist/{chunk-7VMEM3LN.js → chunk-PL6NWB5U.js} +178 -113
  181. package/dist/chunk-PMT75APP.js +94 -0
  182. package/dist/chunk-PP6A4X55.js +11 -0
  183. package/dist/{chunk-I7H5DU34.js → chunk-PPCH3PLO.js} +25 -13
  184. package/dist/{chunk-BIGQKCU7.js → chunk-PPE6S7WU.js} +42 -24
  185. package/dist/{chunk-2NSQIPAA.js → chunk-PT7KSIEO.js} +23 -36
  186. package/dist/{chunk-KZJ5VM6E.js → chunk-PZ3TQFSY.js} +15 -1
  187. package/dist/{chunk-ZJFJ2IKQ.js → chunk-QAUGRVRU.js} +122 -23
  188. package/dist/{chunk-BTDGWHGJ.js → chunk-QMFWZG2P.js} +39 -19
  189. package/dist/{chunk-L6YVK6VC.js → chunk-QZGGCE45.js} +2 -2
  190. package/dist/{chunk-67QSW5RW.js → chunk-R2RJQ3BM.js} +4 -4
  191. package/dist/{chunk-ZY72LSQK.js → chunk-R7HBIQ63.js} +102 -61
  192. package/dist/{chunk-4JHMCXOB.js → chunk-RBNDZLYS.js} +77 -36
  193. package/dist/chunk-RCSY4CT4.js +2170 -0
  194. package/dist/{chunk-NGA7ICG4.js → chunk-RDJ3ZU6O.js} +16 -13
  195. package/dist/{chunk-2NN676RI.js → chunk-RHQRPJHS.js} +7 -8
  196. package/dist/chunk-RI6XQKWJ.js +26 -0
  197. package/dist/{chunk-YOOHNQ3L.js → chunk-RJICOOB3.js} +18 -8
  198. package/dist/{chunk-5DTCOOLU.js → chunk-RLAVNCQJ.js} +2 -2
  199. package/dist/{chunk-CYKXROFG.js → chunk-ROPPWJQB.js} +23 -12
  200. package/dist/{chunk-54ROMBU7.js → chunk-SELOV32X.js} +105 -50
  201. package/dist/{chunk-TUW5IYGA.js → chunk-SQI4NWTQ.js} +9 -9
  202. package/dist/{chunk-ZEYBI47P.js → chunk-SRJ74CMG.js} +11 -3
  203. package/dist/{chunk-NHC2ADGI.js → chunk-STWOURLG.js} +253 -144
  204. package/dist/chunk-SWMFXSVW.js +23 -0
  205. package/dist/chunk-SXAZDIGM.js +84 -0
  206. package/dist/{chunk-EMFUZKYK.js → chunk-SZ5VGWDY.js} +3 -3
  207. package/dist/{chunk-R5MEBBAA.js → chunk-T26G23RS.js} +442 -119
  208. package/dist/{chunk-QHRE2M6V.js → chunk-T2L5H2WW.js} +4 -3
  209. package/dist/chunk-T7GPIJ4L.js +89 -0
  210. package/dist/{chunk-MJPXHCBW.js → chunk-TAEB3RU6.js} +5 -5
  211. package/dist/{chunk-V7F4F6JA.js → chunk-TBDIMTRD.js} +37 -16
  212. package/dist/{chunk-63Y3ROZ7.js → chunk-TFFPEWNP.js} +102 -64
  213. package/dist/{chunk-EZZ533MH.js → chunk-TMEUK2WS.js} +6 -2
  214. package/dist/{chunk-37PKNVLS.js → chunk-TVOMGNFQ.js} +1 -1
  215. package/dist/{chunk-HJRNBKIT.js → chunk-TX5FSNAU.js} +436 -30
  216. package/dist/{chunk-V634AXDM.js → chunk-U52PNFPX.js} +1 -1
  217. package/dist/{chunk-QLANK3VN.js → chunk-U74AWJ3X.js} +6 -6
  218. package/dist/chunk-UC7LBW7N.js +26 -0
  219. package/dist/{chunk-PZ46S2SY.js → chunk-UCKUAKYQ.js} +2 -2
  220. package/dist/{chunk-KF7HD3EH.js → chunk-UCYL3YA7.js} +77 -55
  221. package/dist/{chunk-HOU2MZHC.js → chunk-UD2GI3CS.js} +11 -4
  222. package/dist/{chunk-SNQ7D5R7.js → chunk-UIHGGWES.js} +51 -11
  223. package/dist/{chunk-LGNJCPFP.js → chunk-ULQIC76A.js} +10 -13
  224. package/dist/{chunk-KTHFHD6C.js → chunk-UY34DDUM.js} +11 -6
  225. package/dist/{chunk-6QDMRPXI.js → chunk-UYMFLWM6.js} +215 -258
  226. package/dist/{chunk-KDSYZLF6.js → chunk-V5IFI3FV.js} +8 -1
  227. package/dist/{chunk-JTFKRDDA.js → chunk-V7FV66KL.js} +1 -1
  228. package/dist/{chunk-27OIGDRK.js → chunk-V7NUJEJE.js} +1 -1
  229. package/dist/{chunk-CCDXK5NA.js → chunk-VESSIKBG.js} +8 -3
  230. package/dist/{chunk-QSMGZOT5.js → chunk-VRFJAF3R.js} +7 -8
  231. package/dist/chunk-VS2R3OGN.js +34 -0
  232. package/dist/{chunk-RLMC5CUP.js → chunk-VS5B4J2D.js} +7 -8
  233. package/dist/{chunk-7M2GK7XQ.js → chunk-W4R6SGU3.js} +252 -121
  234. package/dist/{chunk-JKOEHRGV.js → chunk-WDLWWEHZ.js} +1 -1
  235. package/dist/{chunk-7DAH2E4T.js → chunk-WFBN2HXR.js} +2 -2
  236. package/dist/{chunk-DLDDRXAI.js → chunk-WJS6SAWA.js} +296 -145
  237. package/dist/{chunk-WWGPTEQB.js → chunk-WQYNKF33.js} +73 -22
  238. package/dist/{chunk-64LJDGJH.js → chunk-WUP6C4ZD.js} +4 -2
  239. package/dist/{chunk-F2EVCJ4U.js → chunk-X24WAHHV.js} +87 -43
  240. package/dist/{chunk-OJ5CQV7H.js → chunk-X3UCQPVV.js} +209 -96
  241. package/dist/{chunk-7FKY6YWU.js → chunk-X46PSAJ7.js} +6 -6
  242. package/dist/{chunk-H3IBJQ5A.js → chunk-XD5XB22R.js} +2 -2
  243. package/dist/chunk-XDIAQEYK.js +28 -0
  244. package/dist/{chunk-7PPMT5EJ.js → chunk-XFPNYHX3.js} +372 -105
  245. package/dist/{chunk-FCECYJVA.js → chunk-XIBVAKCO.js} +1 -1
  246. package/dist/{chunk-OG2YUVBW.js → chunk-XMX4PCFL.js} +8 -3
  247. package/dist/{chunk-2NRHD2G7.js → chunk-XRRG4MBM.js} +12 -4
  248. package/dist/{chunk-FNMH5WEY.js → chunk-XTFO6D4L.js} +1 -1
  249. package/dist/chunk-XWRI3N5O.js +70 -0
  250. package/dist/{chunk-ZKJ5L35C.js → chunk-XXPLPSOE.js} +36 -25
  251. package/dist/{chunk-XQMYQ4TN.js → chunk-XZXZNI7A.js} +1 -1
  252. package/dist/{chunk-E555EDOQ.js → chunk-YEJZ2OYS.js} +490 -182
  253. package/dist/chunk-YGZEG3JV.js +123 -0
  254. package/dist/{chunk-F6OLHND5.js → chunk-Z3WQXVFV.js} +2 -2
  255. package/dist/{chunk-FFJGC2DX.js → chunk-Z6DUNKFU.js} +173 -40
  256. package/dist/{chunk-N5HN5QGH.js → chunk-Z6H5ED2I.js} +1 -1
  257. package/dist/{chunk-7Q37C6GZ.js → chunk-ZBOOMLHD.js} +1 -1
  258. package/dist/{chunk-MOK3ZS6P.js → chunk-ZDJ7C64T.js} +1 -1
  259. package/dist/{chunk-GLQ3KCTY.js → chunk-ZGZLEUKM.js} +7 -8
  260. package/dist/{chunk-YHD2FZFP.js → chunk-ZHRGX225.js} +6 -6
  261. package/dist/{chunk-76Q7E3TM.js → chunk-ZIVCPXXL.js} +510 -646
  262. package/dist/{chunk-BSATR6ZO.js → chunk-ZNRSYS76.js} +21 -3
  263. package/dist/{chunk-DMAMWUYY.js → chunk-ZSLTSCTI.js} +5 -5
  264. package/dist/{chunk-IGVAWAOK.js → chunk-ZSYFQSPF.js} +43 -9
  265. package/dist/cli/index.js +8 -3
  266. package/dist/{core-7Y5BZZON.js → core-43GLGBOY.js} +8 -1
  267. package/dist/{core-7S3XMW5O.js → core-5GI3ERXO.js} +4 -1
  268. package/dist/{core-K3JX5WPM.js → core-5L7TMK7I.js} +6 -1
  269. package/dist/{core-LB5M7XL4.js → core-7TO4OVY5.js} +6 -1
  270. package/dist/{core-ILPXXC2Z.js → core-BJVENHFQ.js} +7 -1
  271. package/dist/{core-JDFUZFRH.js → core-BX4MFWKC.js} +6 -1
  272. package/dist/{core-XW7UJFJZ.js → core-C3KXTOIZ.js} +7 -1
  273. package/dist/{core-WJNK7F2J.js → core-C5Y6BFLL.js} +7 -1
  274. package/dist/{core-WZ4CHVYL.js → core-CLUSJ2SK.js} +5 -1
  275. package/dist/{core-TCSW24N6.js → core-E3IN2VVH.js} +5 -1
  276. package/dist/{core-MU4ALRR7.js → core-FD67NQOV.js} +6 -1
  277. package/dist/{core-YMXYUGF5.js → core-FDKMLRAK.js} +5 -1
  278. package/dist/{core-VKZSQFRG.js → core-FL6Z3VVX.js} +5 -1
  279. package/dist/{core-5UF44NDI.js → core-JC7JUFPY.js} +8 -1
  280. package/dist/{core-RR2CAZC5.js → core-JF33TADA.js} +8 -1
  281. package/dist/{core-4RR6VSXM.js → core-JH32ZAKM.js} +4 -1
  282. package/dist/{core-G3LXHW73.js → core-JYYZPPQV.js} +7 -1
  283. package/dist/{core-4HFVG4CP.js → core-KJTKCV4U.js} +4 -1
  284. package/dist/{core-GSILPKUR.js → core-LCQPE5Y6.js} +8 -1
  285. package/dist/{core-GLOZY6Z7.js → core-LHVGWE54.js} +6 -1
  286. package/dist/{core-J2JD5ODO.js → core-OVSNBOCE.js} +9 -1
  287. package/dist/{core-BLHEJ5OK.js → core-PPEC236B.js} +5 -1
  288. package/dist/{core-ZLSQHZ3I.js → core-QTJZDK5H.js} +5 -1
  289. package/dist/{core-TKZZZ6UW.js → core-R3YZCOUZ.js} +7 -1
  290. package/dist/{core-HTD5RHE7.js → core-RIBW5XU4.js} +7 -1
  291. package/dist/{core-AR2T32Y3.js → core-RJFILBWL.js} +8 -1
  292. package/dist/{core-A5AKUB7H.js → core-RWSXEKTE.js} +4 -1
  293. package/dist/{core-DD62MWEW.js → core-SOPPZLEH.js} +5 -1
  294. package/dist/{core-HDNWVLJW.js → core-TBUZCXLX.js} +5 -1
  295. package/dist/{core-BOG33BFD.js → core-TZ5QLTAX.js} +5 -1
  296. package/dist/{core-H5HO2CED.js → core-U7E5W4MY.js} +3 -1
  297. package/dist/{core-QPSAYRFT.js → core-UBNVSL44.js} +7 -1
  298. package/dist/{core-E2XOSHPR.js → core-UDRD4WIU.js} +6 -1
  299. package/dist/{core-DFZMOO7E.js → core-UVJZ4HY2.js} +7 -1
  300. package/dist/{core-LGJZUP6H.js → core-X7WWYQH4.js} +8 -1
  301. package/dist/{core-BBNY2BX4.js → core-XP56X47I.js} +5 -1
  302. package/dist/{core-3KLQSYWB.js → core-XQG54CYG.js} +6 -1
  303. package/dist/{dataTable-CNDRVGA5.js → dataTable-U7W4I6IF.js} +15 -2
  304. package/dist/{engine-FVEIM3WV.js → engine-O5V26MGR.js} +32 -19
  305. package/dist/fixtures.js +4 -1
  306. package/dist/flags-BVLSAXT3.js +10 -0
  307. package/dist/{fontTables-ZPZQ6IR3.js → fontTables-JUW7ZTQY.js} +3 -1
  308. package/dist/fonts.js +1 -1
  309. package/dist/geo/dach.js +1 -1
  310. package/dist/geo/de-states.js +1 -1
  311. package/dist/geo/eu27.js +1 -1
  312. package/dist/geo/europe.js +1 -1
  313. package/dist/geo/index.js +2 -2
  314. package/dist/geo/us-states.js +1 -1
  315. package/dist/geo/world.js +1 -1
  316. package/dist/index.js +41 -22
  317. package/dist/{main-THU6VIVU.js → main-35GS47XC.js} +68 -123
  318. package/dist/mcp/server.js +131 -118
  319. package/dist/react/bar.js +10 -1
  320. package/dist/react/bartable.js +10 -1
  321. package/dist/react/box.js +8 -1
  322. package/dist/react/bullet.js +10 -1
  323. package/dist/react/butterfly.js +10 -1
  324. package/dist/react/choropleth.js +10 -1
  325. package/dist/react/cohort.js +11 -1
  326. package/dist/react/column.js +10 -1
  327. package/dist/react/combo.js +10 -1
  328. package/dist/react/creative.js +11 -1
  329. package/dist/react/diagram.js +10 -1
  330. package/dist/react/dimswitch.js +11 -1
  331. package/dist/react/dot.js +9 -1
  332. package/dist/react/export.js +36 -18
  333. package/dist/react/funnel.js +9 -1
  334. package/dist/react/gantt.js +9 -1
  335. package/dist/react/grid.js +10 -1
  336. package/dist/react/heatmap.js +9 -1
  337. package/dist/react/histogram.js +11 -1
  338. package/dist/react/index.js +101 -85
  339. package/dist/react/kpi.js +10 -1
  340. package/dist/react/likert.js +11 -1
  341. package/dist/react/line.js +9 -1
  342. package/dist/react/mekko.js +10 -1
  343. package/dist/react/pareto.js +11 -1
  344. package/dist/react/pie.js +9 -1
  345. package/dist/react/prepare.js +49 -21
  346. package/dist/react/pvm.js +12 -1
  347. package/dist/react/pyramid.js +10 -1
  348. package/dist/react/sankey.js +10 -1
  349. package/dist/react/scatter.js +8 -1
  350. package/dist/react/slope.js +10 -1
  351. package/dist/react/sparkline.js +10 -1
  352. package/dist/react/spec.js +24 -14
  353. package/dist/react/status.js +9 -1
  354. package/dist/react/story.js +5 -2
  355. package/dist/react/table.js +9 -1
  356. package/dist/react/theme.js +10 -3
  357. package/dist/react/tilemap.js +9 -1
  358. package/dist/react/treemap.js +9 -1
  359. package/dist/react/variance.js +10 -1
  360. package/dist/react/waffle.js +9 -1
  361. package/dist/react/waterfall.js +11 -1
  362. package/dist/{resvg-VB7S5HRF.js → resvg-ZYEZTSUO.js} +3 -1
  363. package/dist/rows.js +3 -2
  364. package/dist/{rowsModule-LI6KOS46.js → rowsModule-H2S6WW4D.js} +2 -1
  365. package/dist/{schema-CGQID64D.js → schema-2R32F6AW.js} +1 -1
  366. package/dist/{schema-H2EC4GAQ.js → schema-2TPGJGVR.js} +1 -1
  367. package/dist/{schema-THXXFY6I.js → schema-47BG2TZA.js} +1 -3
  368. package/dist/{schema-AMT7P7KB.js → schema-56MOEOVR.js} +1 -1
  369. package/dist/{schema-GNTKL5DN.js → schema-5MSR4LNN.js} +1 -1
  370. package/dist/{schema-5ZTGVQAJ.js → schema-5RIYEWE6.js} +1 -1
  371. package/dist/{schema-LOQ3AFC7.js → schema-A26ZNGTZ.js} +1 -3
  372. package/dist/{schema-MMVPMJEF.js → schema-ALBF6V7Y.js} +1 -3
  373. package/dist/{schema-BKUFZLLI.js → schema-BA6WP5YZ.js} +1 -1
  374. package/dist/{schema-PQZWO3BP.js → schema-CBL2SMVR.js} +1 -3
  375. package/dist/{schema-BBTXTWYI.js → schema-CWKGLDSR.js} +1 -3
  376. package/dist/{schema-5KDEQBBT.js → schema-DBIQFL56.js} +1 -1
  377. package/dist/{schema-KPEPBGAX.js → schema-DL7V6NN2.js} +1 -1
  378. package/dist/{schema-PL3EU6EQ.js → schema-DUVJMFKQ.js} +4 -2
  379. package/dist/{schema-L5U4OROI.js → schema-ECJERHKF.js} +2 -1
  380. package/dist/{schema-YLE4XXQQ.js → schema-EDSEKZDJ.js} +1 -1
  381. package/dist/{schema-HH5HOORE.js → schema-ESR6ZIK4.js} +1 -3
  382. package/dist/{schema-5DUTAVO7.js → schema-F7TWGLRZ.js} +1 -3
  383. package/dist/{schema-B2GCEYXD.js → schema-FGB6IGZM.js} +1 -3
  384. package/dist/{schema-7NSV542V.js → schema-FKGGTM4Z.js} +2 -1
  385. package/dist/{schema-72EEMYS3.js → schema-FU2AFIEE.js} +1 -1
  386. package/dist/{schema-QORUB6EK.js → schema-JNJFCYBM.js} +18 -1
  387. package/dist/{schema-JH57NFXJ.js → schema-JYZ4RF6S.js} +2 -1
  388. package/dist/{schema-25INXAMY.js → schema-K7F6TEDK.js} +1 -2
  389. package/dist/{schema-OU35XA3Z.js → schema-KAK6DZX4.js} +1 -1
  390. package/dist/{schema-R5Y6NVBH.js → schema-MOKWIGF7.js} +1 -1
  391. package/dist/{schema-ZQSIR5UC.js → schema-MQT6BMNK.js} +1 -3
  392. package/dist/{schema-FDFQKIO5.js → schema-MR3BPPQR.js} +1 -1
  393. package/dist/{schema-VYECMPON.js → schema-OPXZYIW7.js} +1 -3
  394. package/dist/{schema-ZEVJMFLV.js → schema-PV7JGX5H.js} +1 -1
  395. package/dist/{schema-QPOBZUAR.js → schema-PWPQF5RC.js} +1 -1
  396. package/dist/{schema-GN6GAIU5.js → schema-PYQEUC5P.js} +1 -3
  397. package/dist/{schema-M5JBHQIV.js → schema-QPIC5MAG.js} +9 -2
  398. package/dist/{schema-QCIE6M2P.js → schema-R42VXFIS.js} +1 -1
  399. package/dist/{schema-J7TNCZIP.js → schema-TVUJNEX7.js} +1 -1
  400. package/dist/{schema-AXRDF6ND.js → schema-Y4TI2T3T.js} +1 -1
  401. package/dist/{schema-ZG6ZKFRZ.js → schema-ZU2EU2VP.js} +1 -1
  402. package/dist/{specValidation-VHLGDEME.js → specValidation-2NHJT7TQ.js} +4 -1
  403. package/dist/theme.js +7 -2
  404. package/dist/{themeShapeRules-PW4BQHKL.js → themeShapeRules-G7UZX6GJ.js} +1 -1
  405. package/dist/types/core/annotate.d.ts +27 -2
  406. package/dist/types/core/annotateArms.d.ts +3 -1
  407. package/dist/types/core/annotateTargets.d.ts +4 -0
  408. package/dist/types/core/annotationOrigin.d.ts +13 -0
  409. package/dist/types/core/axis.d.ts +2 -2
  410. package/dist/types/core/charts/band/stacks.d.ts +7 -1
  411. package/dist/types/core/charts/bartable/types.d.ts +14 -1
  412. package/dist/types/core/charts/box/types.d.ts +3 -1
  413. package/dist/types/core/charts/choropleth/layout.d.ts +1 -5
  414. package/dist/types/core/charts/choropleth/types.d.ts +19 -0
  415. package/dist/types/core/charts/cohort/types.d.ts +16 -3
  416. package/dist/types/core/charts/column/model.d.ts +13 -0
  417. package/dist/types/core/charts/combo/layout.d.ts +7 -0
  418. package/dist/types/core/charts/creative/types.d.ts +21 -0
  419. package/dist/types/core/charts/dimswitch/compile.d.ts +15 -2
  420. package/dist/types/core/charts/dimswitch/types.d.ts +24 -1
  421. package/dist/types/core/charts/gantt/calendar.d.ts +24 -0
  422. package/dist/types/core/charts/gantt/columns.d.ts +56 -0
  423. package/dist/types/core/charts/gantt/layout.d.ts +8 -2
  424. package/dist/types/core/charts/gantt/model.d.ts +296 -0
  425. package/dist/types/core/charts/grid/metricStack.d.ts +9 -0
  426. package/dist/types/core/charts/grid/metricStackSchema.d.ts +13 -0
  427. package/dist/types/core/charts/grid/normalize.d.ts +5 -0
  428. package/dist/types/core/charts/grid/schema.d.ts +2 -2
  429. package/dist/types/core/charts/histogram/types.d.ts +8 -0
  430. package/dist/types/core/charts/likert/layout.d.ts +10 -8
  431. package/dist/types/core/charts/pareto/layout.d.ts +2 -0
  432. package/dist/types/core/charts/pvm/types.d.ts +10 -1
  433. package/dist/types/core/charts/pyramid/types.d.ts +3 -1
  434. package/dist/types/core/charts/sankey/types.d.ts +5 -1
  435. package/dist/types/core/charts/scatter/clamp.d.ts +2 -1
  436. package/dist/types/core/charts/scatter/model.d.ts +5 -0
  437. package/dist/types/core/charts/scatter/valueLines.d.ts +3 -1
  438. package/dist/types/core/charts/status/layout.d.ts +3 -0
  439. package/dist/types/core/charts/table/resolve.d.ts +22 -3
  440. package/dist/types/core/charts/table/view.d.ts +24 -1
  441. package/dist/types/core/claims/browser.d.ts +2 -0
  442. package/dist/types/core/claims/ids.d.ts +38 -0
  443. package/dist/types/core/deferred.d.ts +1 -0
  444. package/dist/types/core/doc/diagnostics.d.ts +3 -2
  445. package/dist/types/core/footer.d.ts +2 -0
  446. package/dist/types/core/formatSpec.d.ts +43 -14
  447. package/dist/types/core/frame.d.ts +26 -59
  448. package/dist/types/core/frameText.d.ts +203 -0
  449. package/dist/types/core/geo/types.d.ts +2 -0
  450. package/dist/types/core/geometry.d.ts +3 -1
  451. package/dist/types/core/label/categoryRow.d.ts +19 -2
  452. package/dist/types/core/label/solver.d.ts +23 -2
  453. package/dist/types/core/normalize/shared.d.ts +14 -2
  454. package/dist/types/core/notes.d.ts +15 -2
  455. package/dist/types/core/reading.d.ts +12 -1
  456. package/dist/types/core/registry.d.ts +4 -5
  457. package/dist/types/core/request.d.ts +7 -1
  458. package/dist/types/core/schema/capability.d.ts +32 -7
  459. package/dist/types/core/schema/generatedColumns.d.ts +168 -0
  460. package/dist/types/core/seriesIdentity.d.ts +4 -1
  461. package/dist/types/core/sizing.d.ts +32 -1
  462. package/dist/types/core/structureCounts.d.ts +3 -1
  463. package/dist/types/core/text.d.ts +16 -0
  464. package/dist/types/core/theme.d.ts +33 -4
  465. package/dist/types/core/themeGeometry.d.ts +9 -0
  466. package/dist/types/core/themeRules.d.ts +2 -0
  467. package/dist/types/core/timeAxis.d.ts +6 -1
  468. package/dist/types/core/types/annotations.d.ts +74 -4
  469. package/dist/types/core/types/diagram.d.ts +7 -0
  470. package/dist/types/core/types/options.d.ts +118 -15
  471. package/dist/types/core/types/scene.d.ts +30 -2
  472. package/dist/types/core/types/table.d.ts +27 -3
  473. package/dist/types/core/types/theme.d.ts +23 -0
  474. package/dist/types/index.d.ts +2 -0
  475. package/dist/types/react/TableChart.d.ts +5 -0
  476. package/dist/types/react/barrelCharts.d.ts +16 -5
  477. package/dist/types/react/charts/butterfly.d.ts +2 -2
  478. package/dist/types/react/charts/dot.d.ts +7 -1
  479. package/dist/types/react/charts/pareto.d.ts +4 -1
  480. package/dist/types/react/charts/variance.d.ts +3 -1
  481. package/dist/types/react/hover/labelCard.d.ts +11 -2
  482. package/dist/types/react/prepare.d.ts +7 -1
  483. package/dist/types/theme.d.ts +2 -0
  484. package/dist/validate.js +23 -6
  485. package/docs/TELEMETRY.md +2 -2
  486. package/docs/manual.md +283 -65
  487. package/docs/reference/bar.md +15 -4
  488. package/docs/reference/bartable.md +17 -2
  489. package/docs/reference/box.md +15 -4
  490. package/docs/reference/bullet.md +21 -6
  491. package/docs/reference/butterfly.md +17 -6
  492. package/docs/reference/choropleth.md +16 -5
  493. package/docs/reference/cohort.md +25 -5
  494. package/docs/reference/column.md +19 -4
  495. package/docs/reference/combo.md +11 -5
  496. package/docs/reference/creative.md +17 -8
  497. package/docs/reference/diagram.md +6 -1
  498. package/docs/reference/dimswitch.md +71 -118
  499. package/docs/reference/dot.md +16 -7
  500. package/docs/reference/fixtures.md +94 -1
  501. package/docs/reference/funnel.md +14 -5
  502. package/docs/reference/gantt.md +17 -16
  503. package/docs/reference/grid.md +13 -3
  504. package/docs/reference/heatmap.md +16 -6
  505. package/docs/reference/histogram.md +2 -2
  506. package/docs/reference/kpi.md +5 -1
  507. package/docs/reference/likert.md +17 -4
  508. package/docs/reference/line.md +18 -5
  509. package/docs/reference/mekko.md +10 -5
  510. package/docs/reference/options.md +20 -15
  511. package/docs/reference/pareto.md +9 -5
  512. package/docs/reference/pie.md +9 -5
  513. package/docs/reference/pvm.md +16 -6
  514. package/docs/reference/pyramid.md +14 -4
  515. package/docs/reference/react.md +6 -7
  516. package/docs/reference/sankey.md +7 -3
  517. package/docs/reference/scatter.md +8 -4
  518. package/docs/reference/slope.md +15 -5
  519. package/docs/reference/sparkline.md +1 -1
  520. package/docs/reference/status.md +7 -1
  521. package/docs/reference/table.md +41 -110
  522. package/docs/reference/theme.md +12 -4
  523. package/docs/reference/tilemap.md +2 -4
  524. package/docs/reference/treemap.md +1 -1
  525. package/docs/reference/variance.md +12 -6
  526. package/docs/reference/waffle.md +1 -1
  527. package/docs/reference/warnings.md +1077 -0
  528. package/docs/reference/waterfall.md +20 -5
  529. package/docs/use-cases.md +25 -13
  530. package/llms.txt +19 -6
  531. package/package.json +18 -3
  532. package/dist/chunk-6364WO5D.js +0 -47
  533. package/dist/chunk-DQ7YMQVX.js +0 -26
  534. package/dist/chunk-EBB4PYBN.js +0 -24
  535. package/dist/chunk-FG5L2LUK.js +0 -89
  536. package/dist/chunk-IFQN4GKK.js +0 -1852
  537. package/dist/chunk-IRXVV65V.js +0 -24
  538. package/dist/chunk-JGFHNAHS.js +0 -22
  539. package/dist/chunk-JHWYG7V5.js +0 -24
  540. package/dist/chunk-M4SPKUZE.js +0 -7
  541. package/dist/chunk-O36WX56O.js +0 -13
  542. package/dist/chunk-QJWLNP64.js +0 -24
  543. package/dist/chunk-QZIHKQRH.js +0 -26
  544. package/dist/chunk-SE7MJ2LQ.js +0 -24
  545. package/dist/chunk-TXBO2LWM.js +0 -25
  546. package/dist/chunk-UPTXFTKH.js +0 -25
  547. package/dist/chunk-UREXN6WG.js +0 -25
  548. package/dist/chunk-UZLR25BW.js +0 -24
  549. package/dist/chunk-WIVFIVFZ.js +0 -27
  550. package/dist/chunk-WZL4EEBS.js +0 -11
  551. package/dist/chunk-XHRUXZD7.js +0 -28
  552. package/dist/chunk-ZWNRLIFT.js +0 -24
@@ -6,35 +6,38 @@ import {
6
6
  } from "./chunk-OQQMDSCC.js";
7
7
  import {
8
8
  compileIcon
9
- } from "./chunk-H3IBJQ5A.js";
9
+ } from "./chunk-XD5XB22R.js";
10
10
  import {
11
11
  yearSpan,
12
12
  yearSpanFromLabels
13
- } from "./chunk-JTFKRDDA.js";
13
+ } from "./chunk-V7FV66KL.js";
14
14
  import {
15
15
  SHARES_OF_ONE_WHOLE_FIX,
16
16
  valuelessFix
17
- } from "./chunk-JMGB444D.js";
17
+ } from "./chunk-5ACFYNA4.js";
18
18
  import {
19
19
  isCategoryAlongY,
20
20
  valueLineHasTargetExtras
21
21
  } from "./chunk-CDZHNLO6.js";
22
22
  import {
23
+ BRACKET_TICK,
23
24
  indicator100LabelRect,
24
25
  lineLabelGutterLines,
25
26
  namedLineText,
26
27
  pruneOrphanAnnotationArms
27
- } from "./chunk-V5JQQMFQ.js";
28
+ } from "./chunk-E5YF236N.js";
28
29
  import {
29
30
  parseTimeText
30
31
  } from "./chunk-GDOW2KNP.js";
31
32
  import {
32
33
  PRIORITY,
33
34
  anchorValueBox,
35
+ arrowLook,
34
36
  arrowSeats,
37
+ calloutArrowLook,
38
+ calloutArrowReach,
35
39
  composedTextRole,
36
40
  computedTextRole,
37
- defaultAnnotationId,
38
41
  finishCalloutHeads,
39
42
  formatDate,
40
43
  leaderCrossesLabel,
@@ -42,15 +45,17 @@ import {
42
45
  leaderHeightOf,
43
46
  leaderTerminus,
44
47
  leadersOffAnchorValues,
45
- rectsOverlap,
46
48
  solveLabels,
47
- unionRect,
48
49
  valueEdgeToward
49
- } from "./chunk-4KQHKPB3.js";
50
+ } from "./chunk-I5VDW2XZ.js";
50
51
  import {
51
52
  recordPartNeed,
52
53
  wrapFootnote
53
- } from "./chunk-SMHZXHHD.js";
54
+ } from "./chunk-DZYTXZNS.js";
55
+ import {
56
+ annotationRef,
57
+ defaultAnnotationId
58
+ } from "./chunk-F2ET5ZTT.js";
54
59
  import {
55
60
  differenceExample,
56
61
  exampleSpec,
@@ -63,7 +68,7 @@ import {
63
68
  roundedNumber,
64
69
  specUnitKind,
65
70
  withChartMarks
66
- } from "./chunk-FFJGC2DX.js";
71
+ } from "./chunk-Z6DUNKFU.js";
67
72
  import {
68
73
  PERCENTAGE_POINTS,
69
74
  autoDecimals,
@@ -77,32 +82,35 @@ import {
77
82
  typicalDecimals
78
83
  } from "./chunk-MSYTF3DZ.js";
79
84
  import {
80
- arrowHeadPath,
81
- arrowShaftEnd,
82
85
  colorblindPaint,
83
86
  dashToken,
84
87
  emphasisWeight,
88
+ inflate,
85
89
  leaderPath,
86
90
  microType,
87
91
  ovalPath,
92
+ rectContains,
93
+ rectsOverlap,
94
+ segmentSpanInRect,
88
95
  signedFillPaint,
89
96
  strokeToken,
90
- typeWidthClass
91
- } from "./chunk-HJRNBKIT.js";
97
+ typeWidthClass,
98
+ unionRect
99
+ } from "./chunk-TX5FSNAU.js";
92
100
  import {
93
101
  publishDeferred
94
- } from "./chunk-DRHQG44U.js";
102
+ } from "./chunk-BQBD6Q5J.js";
95
103
  import {
96
104
  NormalizeError
97
- } from "./chunk-YOOHNQ3L.js";
105
+ } from "./chunk-RJICOOB3.js";
106
+ import {
107
+ wrapText
108
+ } from "./chunk-UIHGGWES.js";
98
109
  import {
99
110
  maxOf,
100
111
  minOf,
101
112
  pushAll
102
113
  } from "./chunk-WYJEOMNY.js";
103
- import {
104
- wrapText
105
- } from "./chunk-SNQ7D5R7.js";
106
114
 
107
115
  // src/core/strings/annotate.ts
108
116
  var EN = {
@@ -118,7 +126,7 @@ var EN = {
118
126
  }, { chartString: chartString2 } = chartStrings(EN, DE);
119
127
 
120
128
  // src/core/annotateArms.ts
121
- var ARM_CLEARANCE = 10, ARM_STEP = 8, MAX_LIFTS = 40, ARM_ARROW = 5, ARM_START_GAP = 12, ARM_END_GAP = 12, ARM_END_GAP_ON_ARM = 4, ON_ARM_CLEARANCE = 3, ON_ARM_TOP = 41, MIN_LEG = 16, INSET_ARM = 22, INSET_GAP = 6, INSET_MIN_LEG = 4, INSET_TIP_GAP = 4, STRAIGHT_ARROW_HEAD = 10, STRAIGHT_ARROW_PROBE = 4, OVAL_RX = 0.72, OVAL_RY = 1;
129
+ var ARM_CLEARANCE = 10, ARM_STEP = 8, MAX_LIFTS = 40, ARM_ARROW = 5, armLook = (theme) => arrowLook(theme, { size: ARM_ARROW }), ARM_START_GAP = 12, LEVEL_POINT_R = 3, ARM_END_GAP = 12, ARM_END_GAP_ON_ARM = 4, ON_ARM_CLEARANCE = 3, ON_ARM_TOP = 41, MIN_LEG = 16, INSET_ARM = 22, INSET_GAP = 6, INSET_MIN_LEG = 4, INSET_TIP_GAP = 4, STRAIGHT_ARROW_HEAD = 10, STRAIGHT_ARROW_PROBE = 4, OVAL_RX = 0.72, OVAL_RY = 1;
122
130
  function ownAnchorMark(occupiedOwner, occupiedKind, occupiedPart, anchorOwner) {
123
131
  let sameCategory = anchorOwner.categoryId !== void 0 && occupiedOwner.categoryId === anchorOwner.categoryId;
124
132
  return occupiedKind === "mark" && sameCategory && (anchorOwner.seriesId === void 0 && occupiedOwner.seriesId === void 0 || (occupiedPart === "segment" || occupiedPart === "bar") && (anchorOwner.seriesId === void 0 || occupiedOwner.seriesId === anchorOwner.seriesId));
@@ -136,8 +144,13 @@ function claimSegment(occupied, annId, x0, y0, x1, y1, part) {
136
144
  part
137
145
  );
138
146
  }
139
- function claimArrowHead(occupied, annId, x, y) {
140
- occupied.claim({ x: x - 5, y: y - 5, w: 10, h: 10 }, "annotation", { annotationId: annId }, "arrowHead");
147
+ function claimArrowHead(occupied, annId, x, y, look, angle) {
148
+ if (!look.standard) {
149
+ occupied.claim({ x: x - 5, y: y - 5, w: 10, h: 10 }, "annotation", { annotationId: annId }, "arrowHead");
150
+ return;
151
+ }
152
+ let ux = Math.cos(angle), uy = Math.sin(angle), bx = x - ux * look.depth, by = y - uy * look.depth, xs = [x, bx - uy * look.half, bx + uy * look.half], ys = [y, by + ux * look.half, by - ux * look.half], x0 = Math.min(...xs), y0 = Math.min(...ys);
153
+ occupied.claim({ x: x0 - 1, y: y0 - 1, w: Math.max(...xs) - x0 + 2, h: Math.max(...ys) - y0 + 2 }, "annotation", { annotationId: annId }, "arrowHead");
141
154
  }
142
155
  function claimSlantedLine(occupied, annId, p, q) {
143
156
  let length = Math.hypot(q.x - p.x, q.y - p.y) || 1, nx = (q.y - p.y) / length * 3, ny = (p.x - q.x) / length * 3;
@@ -186,7 +199,7 @@ function legRuns(occupied, x, top, bottom, anchor) {
186
199
  from > y && runs.push([y, Math.min(from, bottom)]), y = Math.max(y, to);
187
200
  return y < bottom && runs.push([y, bottom]), runs;
188
201
  }
189
- function pushCagrPlacement(pass, annId, text, computed, font, candidates, nodeIds, derivation) {
202
+ function pushCagrPlacement(pass, annId, text, computed, font, candidates, nodeIds, derivation, kind = "cagr") {
190
203
  pass.labelRequests.push({
191
204
  id: `annotation:${annId}`,
192
205
  kind: "annotation",
@@ -200,64 +213,64 @@ function pushCagrPlacement(pass, annId, text, computed, font, candidates, nodeId
200
213
  candidates
201
214
  }), pass.placed.push({
202
215
  id: annId,
203
- kind: "cagr",
216
+ kind,
204
217
  computedText: computed,
205
218
  nodeIds,
206
219
  labelId: `annotation:${annId}`,
207
220
  ...derivation ? { derivation } : {}
208
221
  });
209
222
  }
210
- function drawLiftedCagrArm(pass, a, b, text, annId, computed, derivation) {
223
+ function drawLiftedCagrArm(pass, a, b, text, annId, computed, derivation, kind = "cagr") {
211
224
  let { input, nodes, nid } = pass, { font, tsize } = measureArmLabel(input, text), buriedA = buried(input.occupied, a), buriedB = buried(input.occupied, b), outward = a.x <= b.x ? 1 : -1;
212
225
  buriedA && (a = { ...a, x: besideLabels(input, a, -outward) }), buriedB && (b = { ...b, x: besideLabels(input, b, outward) });
213
- let leftAnchor = a.x <= b.x ? a : b, rightAnchor = a.x <= b.x ? b : a, spanX0 = leftAnchor.x, spanX1 = rightAnchor.x, startY = laneTop(input.occupied, input.plot.y, spanX0, leftAnchor.y, leftAnchor.owner, input.laneCeiling), endY = laneTop(input.occupied, input.plot.y, spanX1, rightAnchor.y, rightAnchor.owner, input.laneCeiling), direction = a.x <= b.x ? 1 : -1, fromY = direction === 1 ? startY : endY, toY = direction === 1 ? endY : startY, onArm = input.cagrLabelOnArm === !0, endGap = onArm ? ARM_END_GAP_ON_ARM : ARM_END_GAP, endpointCeiling = Math.min(startY, endY) - ARM_CLEARANCE - 8, labelX = (spanX0 + spanX1) / 2 - tsize.width / 2, labelAt = (y) => onArm ? { x: labelX, y: y - tsize.height / 2, w: tsize.width, h: tsize.height } : { x: labelX, y: y - 4 - tsize.height, w: tsize.width, h: tsize.height }, armFloor = onArm ? Math.max(input.plot.y + tsize.height / 2 + 2, (input.bandCeiling ?? input.plot.y) + ON_ARM_TOP) : input.plot.y + tsize.height + 6, armY = Math.max(endpointCeiling, armFloor), bandOvershoot = 0;
226
+ let leftAnchor = a.x <= b.x ? a : b, rightAnchor = a.x <= b.x ? b : a, spanX0 = leftAnchor.x, spanX1 = rightAnchor.x, startY = laneTop(input.occupied, input.plot.y, spanX0, leftAnchor.y, leftAnchor.owner, input.laneCeiling), endY = laneTop(input.occupied, input.plot.y, spanX1, rightAnchor.y, rightAnchor.owner, input.laneCeiling), direction = a.x <= b.x ? 1 : -1, fromY = direction === 1 ? startY : endY, toY = direction === 1 ? endY : startY, onArm = input.cagrLabelOnArm === !0 || kind !== "cagr", endGap = onArm ? ARM_END_GAP_ON_ARM : ARM_END_GAP, endpointCeiling = Math.min(startY, endY) - ARM_CLEARANCE - 8, labelX = (spanX0 + spanX1) / 2 - tsize.width / 2, labelAt = (y) => onArm ? { x: labelX, y: y - tsize.height / 2, w: tsize.width, h: tsize.height } : { x: labelX, y: y - 4 - tsize.height, w: tsize.width, h: tsize.height }, armFloor = onArm ? Math.max(input.plot.y + tsize.height / 2 + 2, (input.bandCeiling ?? input.plot.y) + ON_ARM_TOP) : input.plot.y + tsize.height + 6, armY = Math.max(endpointCeiling, armFloor), bandOvershoot = 0;
214
227
  for (let i = 0; i < MAX_LIFTS; i++) {
215
228
  let armRect = { x: spanX0, y: armY - 3, w: spanX1 - spanX0, h: 6 }, labelRect = labelAt(armY), blocked = input.occupied.hits(armRect, 2) || input.occupied.hits(labelRect, 2);
216
229
  if (armY <= endpointCeiling && !blocked) break;
217
230
  blocked && bandOvershoot === 0 && labelRect.y < input.plot.y && (bandOvershoot = input.plot.y - labelRect.y), armY -= ARM_STEP;
218
231
  }
219
232
  bandOvershoot > 0 && labelAt(armY).y < input.plot.y && pass.addLegDeficit(bandOvershoot);
220
- let stubs = a.lineAnchored && b.lineAnchored && (!a.series && !b.series || buriedA || buriedB);
233
+ let stubs = a.lineAnchored && b.lineAnchored && (!a.series && !b.series || buriedA || buriedB), look = armLook(input.theme);
221
234
  if (!stubs) {
222
- let legFloor = Math.min(fromY - ARM_START_GAP, toY - endGap - arrowShaftEnd(ARM_ARROW, strokeToken(input.theme, "rule"))) - MIN_LEG;
235
+ let legFloor = Math.min(fromY - ARM_START_GAP, toY - endGap - look.shaftEnd) - MIN_LEG;
223
236
  if (armY > legFloor) {
224
237
  let candidate = Math.max(legFloor, armFloor), candidateArm = { x: spanX0, y: candidate - 3, w: spanX1 - spanX0, h: 6 }, candidateLabel = labelAt(candidate);
225
- candidate < armY && candidate <= endpointCeiling && !input.occupied.hits(candidateArm, 2) && !input.occupied.hits(candidateLabel, 2) && (armY = candidate), armY > legFloor && pass.addLegDeficit(armY - legFloor);
238
+ candidate < armY && candidate <= endpointCeiling && !input.occupied.hits(candidateArm, 2) && !input.occupied.hits(candidateLabel, 2) && (armY = candidate), armY > legFloor && pass.addLegDeficit((kind === "cagr" ? armY : Math.max(armY, armFloor)) - legFloor);
226
239
  }
227
240
  }
228
241
  let pathId = nid("arm"), headId = nid("arrowHead");
229
242
  if (stubs) {
230
- let armEnd = b.x - direction * arrowShaftEnd(ARM_ARROW, strokeToken(input.theme, "rule"));
243
+ let armEnd = b.x - direction * look.shaftEnd;
231
244
  nodes.push({
232
245
  t: "path",
233
246
  id: pathId,
234
247
  d: `M${a.x} ${armY + 10}L${a.x} ${armY}L${armEnd} ${armY}`,
235
248
  stroke: { token: "ink" },
236
- width: strokeToken(input.theme, "rule"),
249
+ width: look.stroke,
237
250
  owner: { annotationId: annId },
238
251
  part: "arm"
239
252
  }), nodes.push({
240
253
  t: "path",
241
254
  id: headId,
242
- d: arrowHeadPath({ x: b.x, y: armY }, direction === 1 ? 0 : Math.PI, ARM_ARROW),
255
+ d: look.head({ x: b.x, y: armY }, direction === 1 ? 0 : Math.PI),
243
256
  fill: { token: "ink" },
244
257
  owner: { annotationId: annId },
245
258
  part: "arrowHead"
246
- }), claimSegment(input.occupied, annId, a.x, armY + 10, a.x, armY, "leg"), claimSegment(input.occupied, annId, a.x, armY, armEnd, armY, "arm"), claimArrowHead(input.occupied, annId, b.x, armY);
259
+ }), claimSegment(input.occupied, annId, a.x, armY + 10, a.x, armY, "leg"), claimSegment(input.occupied, annId, a.x, armY, armEnd, armY, "arm"), claimArrowHead(input.occupied, annId, b.x, armY, look, direction === 1 ? 0 : Math.PI);
247
260
  } else {
248
- let reach = (anchor) => anchor.y - (anchor.lineAnchored ? 6 : 4), legStartY = buriedA ? reach(a) : fromY - ARM_START_GAP, tipY = buriedB ? reach(b) : toY - endGap, legEndY = tipY - arrowShaftEnd(ARM_ARROW, strokeToken(input.theme, "rule")), up = legRuns(input.occupied, a.x, armY, legStartY, a).reverse().map(([top, bottom]) => `M${a.x} ${bottom}L${a.x} ${top}`).join(""), down = legRuns(input.occupied, b.x, armY, legEndY, b).map(([top, bottom], index) => `${index === 0 ? "" : `M${b.x} ${top}`}L${b.x} ${bottom}`).join("");
261
+ let reach = (anchor) => anchor.y - (anchor.lineAnchored ? 6 : 4), legStartY = buriedA ? reach(a) : fromY - ARM_START_GAP, tipY = buriedB ? reach(b) : toY - endGap, legEndY = tipY - look.shaftEnd, up = legRuns(input.occupied, a.x, armY, legStartY, a).reverse().map(([top, bottom]) => `M${a.x} ${bottom}L${a.x} ${top}`).join(""), down = legRuns(input.occupied, b.x, armY, legEndY, b).map(([top, bottom], index) => `${index === 0 ? "" : `M${b.x} ${top}`}L${b.x} ${bottom}`).join("");
249
262
  if (nodes.push({
250
263
  t: "path",
251
264
  id: pathId,
252
265
  d: `${up}L${b.x} ${armY}${down}`,
253
266
  stroke: { token: "ink" },
254
- width: strokeToken(input.theme, "rule"),
267
+ width: look.stroke,
255
268
  owner: { annotationId: annId },
256
269
  part: "arm"
257
270
  }), nodes.push({
258
271
  t: "path",
259
272
  id: headId,
260
- d: arrowHeadPath({ x: b.x, y: tipY }, Math.PI / 2, ARM_ARROW),
273
+ d: look.head({ x: b.x, y: tipY }, Math.PI / 2),
261
274
  fill: { token: "ink" },
262
275
  owner: { annotationId: annId },
263
276
  part: "arrowHead"
@@ -265,13 +278,18 @@ function drawLiftedCagrArm(pass, a, b, text, annId, computed, derivation) {
265
278
  let seat0 = labelX - ON_ARM_CLEARANCE, seat1 = labelX + tsize.width + ON_ARM_CLEARANCE;
266
279
  seat0 > Math.min(a.x, b.x) && claimSegment(input.occupied, annId, Math.min(a.x, b.x), armY, seat0, armY, "arm"), seat1 < Math.max(a.x, b.x) && claimSegment(input.occupied, annId, seat1, armY, Math.max(a.x, b.x), armY, "arm");
267
280
  } else claimSegment(input.occupied, annId, a.x, armY, b.x, armY, "arm");
268
- claimSegment(input.occupied, annId, b.x, armY, b.x, legEndY, "leg"), onArm ? input.occupied.claim({ x: b.x - 3, y: tipY - 5, w: 6, h: 5 }, "annotation", { annotationId: annId }, "arrowHead") : claimArrowHead(input.occupied, annId, b.x, tipY);
281
+ claimSegment(input.occupied, annId, b.x, armY, b.x, legEndY, "leg"), onArm ? input.occupied.claim(
282
+ look.standard ? { x: b.x - look.half, y: tipY - look.depth, w: look.half * 2, h: look.depth } : { x: b.x - 3, y: tipY - 5, w: 6, h: 5 },
283
+ "annotation",
284
+ { annotationId: annId },
285
+ "arrowHead"
286
+ ) : claimArrowHead(input.occupied, annId, b.x, tipY, look, Math.PI / 2);
269
287
  }
270
288
  pushCagrPlacement(pass, annId, text, computed, font, [
271
289
  ...onArm && !stubs ? [{ slot: "onArm", rect: labelAt(armY), penalty: 0 }] : [],
272
290
  { slot: "aboveArm", rect: { x: labelX, y: armY - 4 - tsize.height, w: tsize.width, h: tsize.height }, penalty: onArm ? 1 : 0 },
273
291
  { slot: "belowArm", rect: { x: labelX, y: armY + 4, w: tsize.width, h: tsize.height }, penalty: onArm ? 2 : 1 }
274
- ], [pathId, headId], derivation);
292
+ ], [pathId, headId], derivation, kind);
275
293
  }
276
294
  function drawStraightCagrArrow(pass, a, b, text, annId, computed, derivation) {
277
295
  let { input, nodes, nid } = pass, horizontal = input.valueAxis === "horizontal", giveWay = (reason) => (pass.warn?.("cagr-arrow-no-room", `cagr '${annId}': ${reason}, so it draws as a bracket`, "keep shape 'arrow' for a span with room over its marks, or leave it out for the bracket"), !1);
@@ -291,9 +309,9 @@ function drawStraightCagrArrow(pass, a, b, text, annId, computed, derivation) {
291
309
  }
292
310
  if (!route)
293
311
  return pass.addLegDeficit(ry * 2), giveWay("no straight line clears the marks");
294
- let [p, q] = route;
295
- if (Math.hypot(q.x - p.x, q.y - p.y) / 2 < rx + STRAIGHT_ARROW_HEAD) return giveWay("the span is too short for the oval");
296
- let width2 = strokeToken(input.theme, "rule"), angle = Math.atan2(q.y - p.y, q.x - p.x), shaftEnd = arrowShaftEnd(STRAIGHT_ARROW_HEAD, width2), centre = middle(p, q), owner = { annotationId: annId }, lineId = nid("arm"), headId = nid("arrowHead"), ovalId = nid("oval");
312
+ let [p, q] = route, look = arrowLook(input.theme, { size: STRAIGHT_ARROW_HEAD });
313
+ if (Math.hypot(q.x - p.x, q.y - p.y) / 2 < rx + (look.standard ? look.depth + look.minShaft / 2 : STRAIGHT_ARROW_HEAD)) return giveWay("the span is too short for the oval");
314
+ let width2 = look.stroke, angle = Math.atan2(q.y - p.y, q.x - p.x), shaftEnd = look.shaftEnd, centre = middle(p, q), owner = { annotationId: annId }, lineId = nid("arm"), headId = nid("arrowHead"), ovalId = nid("oval");
297
315
  return nodes.push({
298
316
  t: "line",
299
317
  id: lineId,
@@ -305,7 +323,7 @@ function drawStraightCagrArrow(pass, a, b, text, annId, computed, derivation) {
305
323
  width: width2,
306
324
  owner,
307
325
  part: "arm"
308
- }), nodes.push({ t: "path", id: headId, d: arrowHeadPath(q, angle, STRAIGHT_ARROW_HEAD), fill: { token: "ink" }, owner, part: "arrowHead" }), nodes.push({ t: "path", id: ovalId, d: ovalPath(centre, rx, ry), fill: { token: "background" }, stroke: { token: "ink" }, width: width2, owner, part: "oval" }), claimSlantedLine(input.occupied, annId, p, q), claimArrowHead(input.occupied, annId, q.x, q.y), input.occupied.claim(ovalRect(centre), "annotation", owner, "oval"), pushCagrPlacement(pass, annId, text, computed, font, [
326
+ }), nodes.push({ t: "path", id: headId, d: look.head(q, angle), fill: { token: "ink" }, owner, part: "arrowHead" }), nodes.push({ t: "path", id: ovalId, d: ovalPath(centre, rx, ry), fill: { token: "background" }, stroke: { token: "ink" }, width: width2, owner, part: "oval" }), claimSlantedLine(input.occupied, annId, p, q), claimArrowHead(input.occupied, annId, q.x, q.y, look, angle), input.occupied.claim(ovalRect(centre), "annotation", owner, "oval"), pushCagrPlacement(pass, annId, text, computed, font, [
309
327
  { slot: "onArm", rect: { x: centre.x - tsize.width / 2, y: centre.y - tsize.height / 2, w: tsize.width, h: tsize.height }, penalty: 0, overRules: !0 }
310
328
  ], [lineId, headId, ovalId], derivation), !0;
311
329
  }
@@ -355,28 +373,28 @@ function drawShiftedCagrArm(pass, a, b, text, annId, computed, derivation, parts
355
373
  if (armX >= endpointFloor && !input.occupied.hits(armRect, 2) && (inset || !input.occupied.hits(labelRect, 2))) break;
356
374
  armX += ARM_STEP;
357
375
  }
358
- let legFloor = Math.max(fromX + startGap, toX + endGap + arrowShaftEnd(ARM_ARROW, strokeToken(input.theme, "rule"))) + (inset ? INSET_MIN_LEG : MIN_LEG);
376
+ let look = armLook(input.theme), legFloor = Math.max(fromX + startGap, toX + endGap + look.shaftEnd) + (inset ? INSET_MIN_LEG : MIN_LEG);
359
377
  if (armX < legFloor) {
360
378
  let candidate = Math.min(legFloor, plotRight - 3), candidateArm = { x: candidate - 3, y: spanY0, w: 6, h: Math.max(spanY1 - spanY0, 1) }, labelAt = (x) => ({ x, y: (spanY0 + spanY1) / 2 - tsize.height / 2, w: tsize.width, h: tsize.height }), labelFree = (rect) => rect.x >= input.plot.x && rect.x + rect.w <= plotRight && !input.occupied.hits(rect, 2);
361
379
  candidate > armX && candidate >= endpointFloor && !input.occupied.hits(candidateArm, 2) && (labelFree(labelAt(candidate + 4)) || labelFree(labelAt(candidate - 4 - tsize.width))) && (armX = candidate), armX < legFloor && pass.addLegDeficit(legFloor - armX);
362
380
  }
363
- let pathId = nid("arm"), headId = nid("arrowHead"), legEndX = toX + endGap + arrowShaftEnd(ARM_ARROW, strokeToken(input.theme, "rule")), d = `M${fromX + startGap} ${a.y}L${armX} ${a.y}L${armX} ${b.y}L${legEndX} ${b.y}`;
381
+ let pathId = nid("arm"), headId = nid("arrowHead"), legEndX = toX + endGap + look.shaftEnd, d = `M${fromX + startGap} ${a.y}L${armX} ${a.y}L${armX} ${b.y}L${legEndX} ${b.y}`;
364
382
  nodes.push({
365
383
  t: "path",
366
384
  id: pathId,
367
385
  d,
368
386
  stroke: { token: "ink" },
369
- width: strokeToken(input.theme, "rule"),
387
+ width: look.stroke,
370
388
  owner: { annotationId: annId },
371
389
  part: "arm"
372
390
  }), nodes.push({
373
391
  t: "path",
374
392
  id: headId,
375
- d: arrowHeadPath({ x: toX + endGap, y: b.y }, Math.PI, ARM_ARROW),
393
+ d: look.head({ x: toX + endGap, y: b.y }, Math.PI),
376
394
  fill: { token: "ink" },
377
395
  owner: { annotationId: annId },
378
396
  part: "arrowHead"
379
- }), claimSegment(input.occupied, annId, fromX + startGap, a.y, armX, a.y, "leg"), claimSegment(input.occupied, annId, armX, a.y, armX, b.y, "arm"), claimSegment(input.occupied, annId, armX, b.y, legEndX, b.y, "leg"), claimArrowHead(input.occupied, annId, toX + endGap, b.y);
397
+ }), claimSegment(input.occupied, annId, fromX + startGap, a.y, armX, a.y, "leg"), claimSegment(input.occupied, annId, armX, a.y, armX, b.y, "arm"), claimSegment(input.occupied, annId, armX, b.y, legEndX, b.y, "leg"), claimArrowHead(input.occupied, annId, toX + endGap, b.y, look, Math.PI);
380
398
  let midY = (spanY0 + spanY1) / 2;
381
399
  if (inset) {
382
400
  pushInsetCagrPlacement(pass, annId, text, computed, font, armX, midY, parts, [pathId, headId], derivation, [spanY0, spanY1]);
@@ -400,16 +418,16 @@ function drawVerticalLevelDiff(pass, a, b, text, annId, computed, derivation) {
400
418
  (anchor) => anchor.lineAnchored && Math.abs(sx - anchor.x) < 0.5 && claim.kind === "mark" && !claim.polygon && claim.owner.seriesId === anchor.owner.seriesId && anchor.x >= claim.rect.x - 2 && anchor.x <= claim.rect.x + claim.rect.w + 2 && anchor.y >= claim.rect.y - 2 && anchor.y <= claim.rect.y + claim.rect.h + 2
401
419
  )), x = candidatesX.find(stripFree) ?? (a.x + b.x) / 2, lineId = nid("diffLine");
402
420
  pushGuide(pass, "leader0", annId, { x: a.x, y: y0 }, { x, y: y0 }), pushGuide(pass, "leader1", annId, { x: b.x, y: y1 }, { x, y: y1 });
403
- let headTipY = y1 + (y1 > y0 ? -1 : 1), shaftEndY = headTipY + (y1 > y0 ? -1 : 1) * -arrowShaftEnd(ARM_ARROW, strokeToken(input.theme, "rule"));
421
+ let look = armLook(input.theme), onPoint = look.standard && b.lineAnchored && Math.abs(x - b.x) < 0.5, headTipY = y1 + (y1 > y0 ? -1 : 1) * (onPoint ? (b.markerRadius ?? LEVEL_POINT_R) + look.tipGap : 1), shaftEndY = headTipY - (y1 > y0 ? 1 : -1) * look.shaftEnd;
404
422
  nodes.push({
405
423
  t: "line",
406
424
  id: lineId,
407
425
  x1: x,
408
- y1: y0,
426
+ y1: y0 + (look.standard && a.lineAnchored && Math.abs(x - a.x) < 0.5 ? (y1 > y0 ? 1 : -1) * ((a.markerRadius ?? LEVEL_POINT_R) + look.tipGap) : 0),
409
427
  x2: x,
410
428
  y2: shaftEndY,
411
429
  stroke: { token: "ink" },
412
- width: strokeToken(input.theme, "rule"),
430
+ width: look.stroke,
413
431
  owner: { annotationId: annId },
414
432
  part: "diffArrow"
415
433
  });
@@ -417,7 +435,7 @@ function drawVerticalLevelDiff(pass, a, b, text, annId, computed, derivation) {
417
435
  nodes.push({
418
436
  t: "path",
419
437
  id: headId,
420
- d: arrowHeadPath({ x, y: headTipY }, angle, ARM_ARROW),
438
+ d: look.head({ x, y: headTipY }, angle),
421
439
  fill: { token: "ink" },
422
440
  owner: { annotationId: annId },
423
441
  part: "arrowHead"
@@ -498,16 +516,16 @@ function drawHorizontalLevelDiff(pass, a, b, text, annId, computed, derivation)
498
516
  2
499
517
  ).every((claim) => claim.part === "referenceLine"), y = candidatesY.find(stripFree) ?? (a.y + b.y) / 2, lineId = nid("diffLine");
500
518
  pushGuide(pass, "leader0", annId, { x: x0, y: a.y }, { x: x0, y }), pushGuide(pass, "leader1", annId, { x: x1, y: b.y }, { x: x1, y });
501
- let headTipX = x1 + (x1 > x0 ? -1 : 1), shaftEndX = headTipX + (x1 > x0 ? -1 : 1) * -arrowShaftEnd(ARM_ARROW, strokeToken(input.theme, "rule"));
519
+ let look = armLook(input.theme), onPoint = look.standard && b.lineAnchored && Math.abs(y - b.y) < 0.5, headTipX = x1 + (x1 > x0 ? -1 : 1) * (onPoint ? (b.markerRadius ?? LEVEL_POINT_R) + look.tipGap : 1), shaftEndX = headTipX - (x1 > x0 ? 1 : -1) * look.shaftEnd;
502
520
  nodes.push({
503
521
  t: "line",
504
522
  id: lineId,
505
- x1: x0,
523
+ x1: x0 + (look.standard && a.lineAnchored && Math.abs(y - a.y) < 0.5 ? (x1 > x0 ? 1 : -1) * ((a.markerRadius ?? LEVEL_POINT_R) + look.tipGap) : 0),
506
524
  y1: y,
507
525
  x2: shaftEndX,
508
526
  y2: y,
509
527
  stroke: { token: "ink" },
510
- width: strokeToken(input.theme, "rule"),
528
+ width: look.stroke,
511
529
  owner: { annotationId: annId },
512
530
  part: "diffArrow"
513
531
  });
@@ -515,7 +533,7 @@ function drawHorizontalLevelDiff(pass, a, b, text, annId, computed, derivation)
515
533
  nodes.push({
516
534
  t: "path",
517
535
  id: headId,
518
- d: arrowHeadPath({ x: headTipX, y }, angle, ARM_ARROW),
536
+ d: look.head({ x: headTipX, y }, angle),
519
537
  fill: { token: "ink" },
520
538
  owner: { annotationId: annId },
521
539
  part: "arrowHead"
@@ -558,35 +576,37 @@ function drawInsetBarGap(pass, a, b, text, annId, computed, parts, derivation) {
558
576
  if (a.value < 0 || b.value < 0 || Math.abs(a.x - b.x) < 1) return !1;
559
577
  let [short, long] = a.x < b.x ? [a, b] : [b, a], longBar = anchorBar(input.occupied, long), shortBar = anchorBar(input.occupied, short);
560
578
  if (!longBar || !shortBar) return !1;
561
- let y = short.y, dropFrom = long.y < y ? longBar.y + longBar.h : longBar.y, dropStrip = { x: long.x - 1, y: Math.min(dropFrom, y) + 1, w: 2, h: Math.max(Math.abs(y - dropFrom) - 2, 0) };
562
- if (dropStrip.h > 0 && input.occupied.hitsWhich(dropStrip, 0).some((claim) => claim.kind === "mark" && claim.owner.seriesId !== short.owner.seriesId)) return !1;
563
- let rule = strokeToken(input.theme, "rule"), tipX = short.x + INSET_TIP_GAP, regular = { family: input.theme.type.family, ...input.theme.type.label }, font = { ...regular, weight: emphasisWeight(input.theme) }, runs = [{ text: `${parts.lead}\xA0` }, { text: parts.value, weight: font.weight }], w = input.measure(`${parts.lead}\xA0`, regular).width + input.measure(parts.value, font).width, h = input.measure(text, font).height;
564
- if (long.x - tipX < w + 4 * ARM_ARROW) return !1;
579
+ let y = short.y, dropFrom = long.y < y ? longBar.y + longBar.h : longBar.y, dropStrip = { x: long.x - 1, y: Math.min(dropFrom, y) + 1, w: 2, h: Math.max(Math.abs(y - dropFrom) - 2, 0) }, own = (owner) => [short, long].some((end) => owner.categoryId === end.owner.categoryId && owner.seriesId === end.owner.seriesId);
580
+ if (dropStrip.h > 0 && input.occupied.hitsWhich(dropStrip, 0).some((claim) => claim.kind === "mark" && (parts ? claim.owner.seriesId !== short.owner.seriesId : !own(claim.owner)))) return !1;
581
+ let look = armLook(input.theme), atEnd = (end, bar) => Math.abs(end.x - (bar.x + bar.w)) < 1;
582
+ if (!parts && (!atEnd(short, shortBar) || !atEnd(long, longBar))) return !1;
583
+ let shortValue = parts ? void 0 : anchorValueBox(input.occupied, { x: short.x, y: short.y - 1, w: 0, h: 2 }, short.owner, 24), shortEdge = shortValue && shortValue.x >= short.x - 2 ? shortValue.x + shortValue.w : short.x, towardLong = !parts && b === long, shortX = shortEdge + (look.standard && !parts ? look.tipGap : INSET_TIP_GAP), tipX = towardLong ? long.x - 1 : shortX, tailX = towardLong ? shortX : long.x, regular = { family: input.theme.type.family, ...input.theme.type.label }, font = { ...regular, weight: emphasisWeight(input.theme) }, runs = parts ? [{ text: `${parts.lead}\xA0` }, { text: parts.value, weight: font.weight }] : [{ text, weight: font.weight }], w = parts ? input.measure(`${parts.lead}\xA0`, regular).width + input.measure(parts.value, font).width : input.measure(text, font).width, h = input.measure(text, font).height;
584
+ if (long.x - shortX < w + (look.standard ? 2 * look.depth + 8 : 4 * ARM_ARROW) || !parts && input.occupied.hitsWhich({ x: shortX, y: y - 4, w: long.x - shortX, h: 8 }, 0).some((claim) => claim.kind === "mark" || claim.kind === "annotation" && claim.owner.annotationId !== annId)) return !1;
565
585
  pushGuide(pass, "leader0", annId, { x: long.x, y: dropFrom }, { x: long.x, y });
566
- let lineId = nid("diffLine");
586
+ let lineId = nid("diffLine"), direction = Math.sign(tipX - tailX);
567
587
  nodes.push({
568
588
  t: "line",
569
589
  id: lineId,
570
- x1: long.x,
590
+ x1: tailX,
571
591
  y1: y,
572
- x2: tipX + arrowShaftEnd(ARM_ARROW, rule),
592
+ x2: tipX - direction * look.shaftEnd,
573
593
  y2: y,
574
594
  stroke: { token: "ink" },
575
- width: rule,
595
+ width: look.stroke,
576
596
  owner: { annotationId: annId },
577
597
  part: "diffArrow"
578
598
  });
579
- let headId = nid("arrowHead");
599
+ let headId = nid("arrowHead"), angle = direction > 0 ? 0 : Math.PI;
580
600
  nodes.push({
581
601
  t: "path",
582
602
  id: headId,
583
- d: arrowHeadPath({ x: tipX, y }, Math.PI, ARM_ARROW),
603
+ d: look.head({ x: tipX, y }, angle),
584
604
  fill: { token: "ink" },
585
605
  owner: { annotationId: annId },
586
606
  part: "arrowHead"
587
607
  });
588
- let seat = { x: (tipX + long.x) / 2 - w / 2, y: y - h / 2, w, h };
589
- return input.occupied.claim({ x: tipX, y: y - 2, w: Math.max(seat.x - 2 - tipX, 0), h: 4 }, "annotation", { annotationId: annId }), input.occupied.claim({ x: seat.x + seat.w + 2, y: y - 2, w: Math.max(long.x - seat.x - seat.w - 2, 0), h: 4 }, "annotation", { annotationId: annId }), claimArrowHead(input.occupied, annId, tipX, y), labelRequests.push({
608
+ let [left, right] = [Math.min(tipX, tailX), Math.max(tipX, tailX)], seat = { x: (left + right) / 2 - w / 2, y: y - h / 2, w, h };
609
+ return input.occupied.claim({ x: left, y: y - 2, w: Math.max(seat.x - 2 - left, 0), h: 4 }, "annotation", { annotationId: annId }), input.occupied.claim({ x: seat.x + seat.w + 2, y: y - 2, w: Math.max(right - seat.x - seat.w - 2, 0), h: 4 }, "annotation", { annotationId: annId }), claimArrowHead(input.occupied, annId, tipX, y, look, angle), labelRequests.push({
590
610
  id: `annotation:${annId}`,
591
611
  kind: "annotation",
592
612
  role: computedTextRole(text, computed),
@@ -606,12 +626,15 @@ function drawInsetBarGap(pass, a, b, text, annId, computed, parts, derivation) {
606
626
  id: annId,
607
627
  kind: "diff",
608
628
  computedText: computed,
609
- tone: parts.value.startsWith("\u2212") || parts.value.startsWith("-") ? "bad" : "neutral",
629
+ tone: (parts?.value ?? computed).startsWith("\u2212") || (parts?.value ?? computed).startsWith("-") ? "bad" : "neutral",
610
630
  nodeIds: [lineId, headId],
611
631
  labelId: `annotation:${annId}`,
612
632
  ...derivation ? { derivation } : {}
613
633
  }), !0;
614
634
  }
635
+ function drawSpanBracket(pass, a, b, text, annId, kind, computed, derivation) {
636
+ drawLiftedCagrArm(pass, a, b, text, annId, computed, derivation, kind);
637
+ }
615
638
  function drawCagrArm(pass, a, b, text, annId, computed, derivation, parts, shape) {
616
639
  if (pass.input.comparisonLayout) {
617
640
  shape === "arrow" && pass.warn?.("cagr-arrow-no-room", `cagr '${annId}': this chart lays out its comparisons itself, so it keeps its own form`), pass.input.comparisonLayout.draw(pass, a, b, text, annId, "cagr", computed, derivation);
@@ -625,13 +648,13 @@ function drawCagrArm(pass, a, b, text, annId, computed, derivation, parts, shape
625
648
  drawLiftedCagrArm(pass, a, b, text, annId, computed, derivation);
626
649
  }
627
650
  }
628
- function drawDiffArm(pass, a, b, text, annId, computed, derivation, parts) {
651
+ function drawDiffArm(pass, a, b, text, annId, computed, derivation, parts, placement) {
629
652
  if (pass.input.comparisonLayout) {
630
653
  pass.input.comparisonLayout.draw(pass, a, b, text, annId, "diff", computed, derivation);
631
654
  return;
632
655
  }
633
656
  if (pass.input.valueAxis === "horizontal") {
634
- if (parts && drawInsetBarGap(pass, a, b, text, annId, computed, parts, derivation)) return;
657
+ if ((parts || placement !== "label") && drawInsetBarGap(pass, a, b, text, annId, computed, parts, derivation)) return;
635
658
  drawHorizontalLevelDiff(pass, a, b, text, annId, computed, derivation);
636
659
  return;
637
660
  }
@@ -817,6 +840,22 @@ function resolveSpan(ctx, from, to) {
817
840
  let start = ctx.input.resolveCategoryBand(from), end = ctx.input.resolveCategoryBand(to);
818
841
  return !start || !end ? (pushWarn(ctx.warnings, ctx.id, "bad-anchor", `band '${ctx.id}': unresolvable category span`), null) : categorySpanRect(start, end, plot);
819
842
  }
843
+ function corridorEdgeRects(ann, input) {
844
+ if (ann.style !== "corridor" || scenarioPaint(ann.scenario).pattern !== "outline") return [];
845
+ let mapper = valueMapper(input), bounds = finitePair(ann.low, ann.high);
846
+ if (!mapper || !bounds) return [];
847
+ let plot = input.bandPlot ?? input.plot, span = plot;
848
+ if (ann.from !== void 0 || ann.to !== void 0) {
849
+ if (ann.from === void 0 || ann.to === void 0) return [];
850
+ let from = input.resolveCategoryBand?.(ann.from), to = input.resolveCategoryBand?.(ann.to);
851
+ if (!from || !to) return [];
852
+ span = categorySpanRect(from, to, plot);
853
+ }
854
+ let rect = valueBandRect(span, bounds.low, bounds.high, mapper, plot);
855
+ if (!rect) return [];
856
+ let width2 = strokeToken(input.theme, "hair");
857
+ return mapper.axis === "y" ? [rect.y, rect.y + rect.h].map((y) => ({ x: rect.x, y: y - width2 / 2, w: rect.w, h: width2 })) : [rect.x, rect.x + rect.w].map((x) => ({ x: x - width2 / 2, y: rect.y, w: width2, h: rect.h }));
858
+ }
820
859
  function placeCorridorOrTolerance(ctx, ann, role) {
821
860
  let mapper = valueMapper(ctx.input);
822
861
  if (!mapper) {
@@ -1192,7 +1231,7 @@ function placeEraShade(ctx, ann, rect) {
1192
1231
  ctx.placed.push({ id: ctx.id, kind: "band", computedText: text, nodeIds: [bandId], labelId });
1193
1232
  }
1194
1233
  function placeEraBracket(ctx, ann, rect, bandPlot) {
1195
- let text = ann.label ?? "", labelId = ann.label ? `annotation:${ctx.id}` : void 0, font = { family: ctx.input.theme.type.family, ...ctx.input.theme.type.axis }, size = ctx.input.measure(text || "X", font), bracketY = bandPlot.y - ctx.input.plot.y >= size.height + 12 ? bandPlot.y - 7 : bandPlot.y + size.height + 6, left = rect.x, right = rect.x + rect.w, arrowInset = Math.min(5, rect.w / 2), bracketIds = [], lineId = ctx.nid("bracket");
1234
+ let text = ann.label ?? "", labelId = ann.label ? `annotation:${ctx.id}` : void 0, font = { family: ctx.input.theme.type.family, ...ctx.input.theme.type.axis }, size = ctx.input.measure(text || "X", font), bracketY = bandPlot.y - ctx.input.plot.y >= size.height + 12 ? bandPlot.y - 7 : bandPlot.y + size.height + 6, left = rect.x, right = rect.x + rect.w, look = arrowLook(ctx.input.theme, { size: 5 }), arrowInset = Math.min(look.standard ? look.shaftEnd : 5, rect.w / 2), bracketIds = [], lineId = ctx.nid("bracket");
1196
1235
  bracketIds.push(lineId), ctx.nodes.push({
1197
1236
  t: "line",
1198
1237
  id: lineId,
@@ -1201,7 +1240,7 @@ function placeEraBracket(ctx, ann, rect, bandPlot) {
1201
1240
  x2: right - arrowInset,
1202
1241
  y2: bracketY,
1203
1242
  stroke: { token: "ink" },
1204
- width: strokeToken(ctx.input.theme, "rule"),
1243
+ width: look.stroke,
1205
1244
  owner: { annotationId: ctx.id },
1206
1245
  part: "bandBracket"
1207
1246
  });
@@ -1213,7 +1252,7 @@ function placeEraBracket(ctx, ann, rect, bandPlot) {
1213
1252
  bracketIds.push(headId), ctx.nodes.push({
1214
1253
  t: "path",
1215
1254
  id: headId,
1216
- d: arrowHeadPath({ x, y: bracketY }, angle, 5),
1255
+ d: look.head({ x, y: bracketY }, angle),
1217
1256
  fill: { token: "ink" },
1218
1257
  owner: { annotationId: ctx.id },
1219
1258
  part: "bandArrowHead"
@@ -1352,6 +1391,132 @@ function buildExtendedEraBandCandidates(plan, input, forHeadroomEstimate = !1) {
1352
1391
  return out;
1353
1392
  }
1354
1393
 
1394
+ // src/core/annotateDrawing.ts
1395
+ var DRAWING_ARROW_HEAD = 6, POINT_MARKER_R = 3, CUT_CLEARANCE = 2, CLAIM_HALF = 1, MIN_STRETCH = 4, TEXT_GAP = 8, BOX_BAND_PAD = 2;
1396
+ function resolveDrawingPoint(input, point) {
1397
+ if (typeof point != "object" || point === null || !("value" in point)) {
1398
+ let found = input.resolve(point);
1399
+ return found ? { x: found.x, y: found.y, mark: found.lineAnchored ? found.markerRadius ?? POINT_MARKER_R : 0 } : { error: "unresolvable anchor" };
1400
+ }
1401
+ let mapper = valueMapper(input);
1402
+ if (!mapper) return { error: `this chart has no value scale, so it has no place for value ${point.value}` };
1403
+ let mapped = mapper.scale(point.value), plot = input.bandPlot ?? input.plot, [low, high] = mapper.axis === "y" ? [plot.y, plot.y + plot.h] : [plot.x, plot.x + plot.w];
1404
+ if (!Number.isFinite(mapped) || mapped < low - 0.5 || mapped > high + 0.5) return { error: `value ${point.value} lies outside the plot; a drawing does not extend the axis` };
1405
+ let category = categoryPosition(input, point.categoryId);
1406
+ if (category === void 0) return { error: "unresolvable category" };
1407
+ let band = categorySpan(input, point.categoryId);
1408
+ return { ...mapper.axis === "y" ? { x: category, y: mapped } : { x: mapped, y: category }, ...band ? { band } : {} };
1409
+ }
1410
+ function categorySpan(input, categoryId) {
1411
+ let band = (input.resolveCategoryBand ?? input.drawingCategoryBand)?.(categoryId);
1412
+ if (band)
1413
+ return isCategoryAlongY(band) ? [band.y, band.y + band.h] : [band.x, band.x + band.w];
1414
+ }
1415
+ function boxCorners(input, from, to) {
1416
+ if ("error" in from || "error" in to || !from.band && !to.band) return [from, to];
1417
+ let alongX = valueMapper(input)?.axis === "y", reach = (point) => {
1418
+ let at = alongX ? point.x : point.y;
1419
+ return point.band ? [point.band[0] - BOX_BAND_PAD, point.band[1] + BOX_BAND_PAD] : [at, at];
1420
+ }, [a, b] = [reach(from), reach(to)], low = Math.min(a[0], b[0]), high = Math.max(a[1], b[1]);
1421
+ return alongX ? [{ x: low, y: from.y }, { x: high, y: to.y }] : [{ x: from.x, y: low }, { x: to.x, y: high }];
1422
+ }
1423
+ function categoryPosition(input, categoryId) {
1424
+ let axis = valueMapper(input).axis;
1425
+ if (input.resolveCategoryBand) {
1426
+ let band = input.resolveCategoryBand(categoryId);
1427
+ return band ? isCategoryAlongY(band) ? band.y + band.h / 2 : band.x + band.w / 2 : void 0;
1428
+ }
1429
+ let found = input.resolve(categoryId);
1430
+ return found ? axis === "y" ? found.x : found.y : void 0;
1431
+ }
1432
+ function drawingFailure(kind, from, to) {
1433
+ if ("error" in from) return `from: ${from.error}`;
1434
+ if ("error" in to) return `to: ${to.error}`;
1435
+ let dx = Math.abs(to.x - from.x), dy = Math.abs(to.y - from.y);
1436
+ if (kind === "box" ? dx < 1 || dy < 1 : Math.hypot(dx, dy) < 1) return kind === "box" ? "from and to must differ in both directions to make a box" : "from and to are one point";
1437
+ }
1438
+ function textSeats(at, size) {
1439
+ let seat = (slot, x, y, penalty) => ({ slot, rect: { x, y, w: size.w, h: size.h }, penalty, overColumns: !0, needsBacking: !0 }), { w, h } = size;
1440
+ return [
1441
+ seat("at", at.x - w / 2, at.y - h / 2, 0),
1442
+ seat("above", at.x - w / 2, at.y - h - TEXT_GAP, 1),
1443
+ seat("below", at.x - w / 2, at.y + TEXT_GAP, 2),
1444
+ seat("right", at.x + TEXT_GAP, at.y - h / 2, 3),
1445
+ seat("left", at.x - w - TEXT_GAP, at.y - h / 2, 4)
1446
+ ];
1447
+ }
1448
+ function claimStroke(occupied, a, b, id) {
1449
+ let dx = b.x - a.x, dy = b.y - a.y, box = { x: Math.min(a.x, b.x) - CLAIM_HALF, y: Math.min(a.y, b.y) - CLAIM_HALF, w: Math.abs(dx) + 2 * CLAIM_HALF, h: Math.abs(dy) + 2 * CLAIM_HALF };
1450
+ if (Math.abs(dx) < 0.5 || Math.abs(dy) < 0.5) {
1451
+ occupied.claim(box, "annotation", { annotationId: id }, "drawing");
1452
+ return;
1453
+ }
1454
+ let length = Math.hypot(dx, dy), nx = -dy / length * CLAIM_HALF, ny = dx / length * CLAIM_HALF;
1455
+ occupied.claim(box, "annotation", { annotationId: id }, "drawing", [
1456
+ { x: a.x + nx, y: a.y + ny },
1457
+ { x: b.x + nx, y: b.y + ny },
1458
+ { x: b.x - nx, y: b.y - ny },
1459
+ { x: a.x - nx, y: a.y - ny }
1460
+ ]);
1461
+ }
1462
+ function drawDrawing(ann, id, from, to, theme, occupied, nodes, nid, cuts, toMark, short) {
1463
+ let look = ann.kind === "arrow" ? arrowLook(theme, { size: DRAWING_ARROW_HEAD }) : void 0, width2 = look?.stroke ?? strokeToken(theme, "rule"), owner = { annotationId: id }, paint = { stroke: { token: "ink" }, width: width2, owner, part: "drawing", ...ann.dashed ? { dash: dashToken(theme, "reference") } : {} }, run = (a, b) => {
1464
+ let nodeId = nid("drawing");
1465
+ return nodes.push({ t: "line", id: nodeId, x1: a.x, y1: a.y, x2: b.x, y2: b.y, ...paint }), nodeId;
1466
+ };
1467
+ if (ann.kind === "box") {
1468
+ let [left, right] = [Math.min(from.x, to.x), Math.max(from.x, to.x)], [top, bottom] = [Math.min(from.y, to.y), Math.max(from.y, to.y)], cap = width2 / 2;
1469
+ return [
1470
+ [{ x: left - cap, y: top }, { x: right + cap, y: top }],
1471
+ [{ x: right, y: top }, { x: right, y: bottom }],
1472
+ [{ x: right + cap, y: bottom }, { x: left - cap, y: bottom }],
1473
+ [{ x: left, y: bottom }, { x: left, y: top }]
1474
+ ].map(([a, b]) => (claimStroke(occupied, a, b, id), run(a, b)));
1475
+ }
1476
+ if (!look)
1477
+ return claimStroke(occupied, from, to, id), [run(from, to)];
1478
+ let full = Math.hypot(to.x - from.x, to.y - from.y), ux = (to.x - from.x) / full, uy = (to.y - from.y) / full, pull = look.standard && toMark !== void 0 ? Math.min(toMark + look.tipGap, full / 2) : 0, tip = { x: to.x - ux * pull, y: to.y - uy * pull }, length = full - pull;
1479
+ if (look.standard && length - look.depth < look.minShaft && (short?.(Math.max(0, length - look.depth), look.minShaft, length - look.depth < 1), length - look.depth < 1))
1480
+ return [];
1481
+ claimStroke(occupied, from, tip, id);
1482
+ let shaft = Math.min(look.shaftEnd, length), shaftId = run(from, { x: tip.x - ux * shaft, y: tip.y - uy * shaft }), headId = nid("drawingHead");
1483
+ return nodes.push({ t: "path", id: headId, d: look.head(tip, Math.atan2(uy, ux)), fill: { token: "ink" }, owner, part: "drawing" }), cuts.set(shaftId, { headId, tip }), [shaftId, headId];
1484
+ }
1485
+ function stretchesClearOfText(occupied, a, b) {
1486
+ let box = { x: Math.min(a.x, b.x), y: Math.min(a.y, b.y), w: Math.abs(a.x - b.x), h: Math.abs(a.y - b.y) }, spans = occupied.hitsWhich(box, CUT_CLEARANCE).filter((claim) => claim.kind === "label").flatMap((claim) => {
1487
+ let span = segmentSpanInRect(a, b, claim.rect, CUT_CLEARANCE);
1488
+ return span ? [span] : [];
1489
+ }).sort((u, v) => u[0] - v[0]);
1490
+ if (spans.length === 0) return;
1491
+ let length = Math.hypot(b.x - a.x, b.y - a.y), at = (t) => ({ x: a.x + (b.x - a.x) * t, y: a.y + (b.y - a.y) * t }), stretches = [], from = 0;
1492
+ for (let [t0, t1] of spans)
1493
+ t0 > from && (t0 - from) * length >= MIN_STRETCH && stretches.push([at(from), at(t0)]), from = Math.max(from, t1);
1494
+ return from < 1 && (1 - from) * length >= MIN_STRETCH && stretches.push([at(from), b]), stretches;
1495
+ }
1496
+ function cutDrawingsAroundText(nodes, placed, occupied, warnings, cuts) {
1497
+ let warned = /* @__PURE__ */ new Set();
1498
+ for (let i = nodes.length - 1; i >= 0; i--) {
1499
+ let node = nodes[i];
1500
+ if (node.t !== "line" || node.part !== "drawing") continue;
1501
+ let a = { x: node.x1, y: node.y1 }, b = { x: node.x2, y: node.y2 }, stretches = stretchesClearOfText(occupied, a, b), arrow = cuts.get(node.id), headOnText = arrow !== void 0 && stretchesClearOfText(occupied, b, arrow.tip) !== void 0;
1502
+ if (!stretches && !headOnText) continue;
1503
+ let id = node.owner.annotationId, record = placed.find((entry) => entry.id === id), pieces = (stretches ?? [[a, b]]).map(([p, q], n) => ({ ...node, id: n === 0 ? node.id : `${node.id}:${n}`, x1: p.x, y1: p.y, x2: q.x, y2: q.y })), after = nodes.splice(i + 1);
1504
+ nodes.length = i, nodes.push(...pieces, ...after), record && (record.nodeIds = record.nodeIds.filter((nodeId) => nodeId !== node.id).concat(pieces.map((piece) => piece.id)));
1505
+ let lastReachesEnd = stretches === void 0 || stretches.at(-1)?.[1] === b;
1506
+ if (arrow && (headOnText || !lastReachesEnd)) {
1507
+ let headAt = nodes.findIndex((entry) => entry.id === arrow.headId);
1508
+ headAt >= 0 && nodes.splice(headAt, 1), record && (record.nodeIds = record.nodeIds.filter((nodeId) => nodeId !== arrow.headId));
1509
+ }
1510
+ warned.has(id) || (warned.add(id), warnings.push({
1511
+ code: "draw-crosses-text",
1512
+ severity: "warn",
1513
+ message: `${record?.kind ?? "drawing"} '${id}' would cross text, so it breaks around the label there`,
1514
+ owner: { annotationId: id },
1515
+ suggest: "Move the drawing to other points, or move the label with labelOffsets."
1516
+ }));
1517
+ }
1518
+ }
1519
+
1355
1520
  // src/core/annotate.ts
1356
1521
  function anchorRefLabel(ref) {
1357
1522
  if (typeof ref == "string") return ref;
@@ -1402,7 +1567,7 @@ function runAnnotatePass(input) {
1402
1567
  return input.annotations.forEach((ann, n) => {
1403
1568
  let id = defaultAnnotationId(ann, n);
1404
1569
  anchorErrors.length = 0;
1405
- let warningStart = warnings.length, secondaryLine = ann.kind === "valueLine" && ann.axis === "secondary", valuesNotShares = sharesOnly && ann.kind !== "valueLine", referenceFormat = secondaryLine ? input.secondaryFormat : valuesNotShares ? void 0 : input.format, anchorFormat = "at" in ann && ann.at !== void 0 ? input.resolve(ann.at)?.format : ann.kind === "diff" ? input.resolve(ann.to)?.format ?? input.resolve(ann.from)?.format : ann.kind === "valueLine" ? secondaryLine ? input.secondaryFormat : seriesMeanFormat(input, ann) : void 0, example = ann.format ?? anchorFormat, own = example === void 0 ? void 0 : exampleSpec(example, locale), signed = own ? { ...exampleSpec(ann.format ?? differenceExample(example), locale), signed: !0 } : void 0, referencePercent = ann.kind === "valueLine" ? (secondaryLine ? input.secondaryPercentLevels : input.valueLinePercentLevels) ?? percent : percent, referenceUnit = ann.kind === "valueLine" ? input.valueLineUnit : void 0, baseRun = referenceUnit ? { ...run, fmt: referenceFormat ? (v) => formatWithSpec(v, { ...exampleSpec(referenceFormat, locale), prefix: "", suffix: referenceUnit }) : plain(referenceUnit, !1) } : ann.kind === "valueLine" && !referenceFormat && (secondaryLine || referencePercent !== percent) ? { ...run, fmt: plain(referencePercent ? "%" : "", !1) } : valuesNotShares ? { ...run, fmt: valueFmt, statFmt: valueFmt, fmtSigned: plain(input.percentLevels === !0 ? PERCENTAGE_POINTS : "", !0), printsZero: (v) => roundsToZero(v, autoDecimals(v)) } : run, fmtRun = own ? {
1570
+ let warningStart = warnings.length, secondaryLine = ann.kind === "valueLine" && ann.axis === "secondary", valuesNotShares = sharesOnly && ann.kind !== "valueLine", referenceFormat = secondaryLine ? input.secondaryFormat : valuesNotShares ? void 0 : input.format, anchorFormat = ann.kind === "text" || ann.kind === "line" || ann.kind === "arrow" || ann.kind === "box" ? void 0 : "at" in ann && ann.at !== void 0 ? input.resolve(ann.at)?.format : ann.kind === "diff" ? input.resolve(ann.to)?.format ?? input.resolve(ann.from)?.format : ann.kind === "valueLine" ? secondaryLine ? input.secondaryFormat : seriesMeanFormat(input, ann) : void 0, example = ann.format ?? anchorFormat, own = example === void 0 ? void 0 : exampleSpec(example, locale), signed = own ? { ...exampleSpec(ann.format ?? differenceExample(example), locale), signed: !0 } : void 0, referencePercent = ann.kind === "valueLine" ? (secondaryLine ? input.secondaryPercentLevels : input.valueLinePercentLevels) ?? percent : percent, referenceUnit = ann.kind === "valueLine" ? input.valueLineUnit : void 0, baseRun = referenceUnit ? { ...run, fmt: referenceFormat ? (v) => formatWithSpec(v, { ...exampleSpec(referenceFormat, locale), prefix: "", suffix: referenceUnit }) : plain(referenceUnit, !1) } : ann.kind === "valueLine" && !referenceFormat && (secondaryLine || referencePercent !== percent) ? { ...run, fmt: plain(referencePercent ? "%" : "", !1) } : valuesNotShares ? { ...run, fmt: valueFmt, statFmt: valueFmt, fmtSigned: plain(input.percentLevels === !0 ? PERCENTAGE_POINTS : "", !0), printsZero: (v) => roundsToZero(v, autoDecimals(v)) } : run, fmtRun = own ? {
1406
1571
  ...baseRun,
1407
1572
  fmt: referenceUnit ? (v) => formatWithSpec(v, { ...own, prefix: "", suffix: referenceUnit }) : formatterFromExample(example, input.locale),
1408
1573
  fmtSigned: (v) => formatWithSpec(v, signed),
@@ -1423,7 +1588,7 @@ function runAnnotatePass(input) {
1423
1588
  run.legDeficit = Math.max(run.legDeficit, pixels);
1424
1589
  }
1425
1590
  };
1426
- if (scope.warn = (code, message, suggest) => warn(scope, code, message, suggest), placeAnnotation(scope, ann), anchorErrors.length) for (let warning of warnings.slice(warningStart))
1591
+ if (scope.warn = (code, message, suggest) => warn(scope, code, message, suggest), placeAnnotation(scope, ann, run), anchorErrors.length) for (let warning of warnings.slice(warningStart))
1427
1592
  warning.code === "bad-anchor" && (warning.message += `: ${[...new Set(anchorErrors)].join("; ")}`);
1428
1593
  }), finishAnnotatePass(input, run, nodes, placed, labelRequests, warnings);
1429
1594
  }
@@ -1432,7 +1597,7 @@ function seriesMeanFormat(input, ann) {
1432
1597
  let mean = input.meanValueFor?.({ seriesId: ann.seriesId, from: ann.from, to: ann.to });
1433
1598
  return mean && !("error" in mean) ? mean.format : void 0;
1434
1599
  }
1435
- function placeAnnotation(s, ann) {
1600
+ function placeAnnotation(s, ann, run) {
1436
1601
  switch (ann.kind) {
1437
1602
  case "cagr":
1438
1603
  return placeCagr(s, ann);
@@ -1456,6 +1621,12 @@ function placeAnnotation(s, ann) {
1456
1621
  return;
1457
1622
  case "event":
1458
1623
  return;
1624
+ case "text":
1625
+ return placeDrawingText(s, ann);
1626
+ case "line":
1627
+ case "arrow":
1628
+ case "box":
1629
+ return placeDrawing(s, ann, run);
1459
1630
  }
1460
1631
  }
1461
1632
  function partialAnchors(s, ...anchors) {
@@ -1567,14 +1738,13 @@ function spanLead(s, a, b, periodOn, colon = !1) {
1567
1738
  let names = [...new Set([a.series?.label, b.series?.label].filter((name) => name !== void 0))], named = names.length === 2 ? chartString2({ locale: s.input.locale, strings: s.input.strings }, "seriesSpan", { v1: names[0], v2: names[1] }) : names[0] ?? "", period = periodOn && a.label && b.label && a.label !== b.label ? `${a.label}\u2013${b.label}` : "", lead = [named, period].filter(Boolean).join(" ");
1568
1739
  return lead && (period || colon) ? `${lead}:` : lead;
1569
1740
  }
1570
- var BRACKET_TICK = 5;
1571
1741
  function placeBracket(s, ann) {
1572
1742
  let { input, id } = s;
1573
1743
  if (!input.resolveSpan) return warn(s, "unsupported", `bracket '${id}': this chart has no steps to add up`);
1574
1744
  if (typeof ann.from != "string" || typeof ann.to != "string" || !ann.from || !ann.to) return warn(s, "bad-anchor", `bracket '${id}': from and to are step ids (non-empty strings)`);
1575
1745
  let span = input.resolveSpan(ann.from, ann.to);
1576
1746
  if ("error" in span) return warn(s, span.code, `bracket '${id}': ${span.error}`);
1577
- let sumText = s.run.fmtSigned(span.sum), composed = ann.label ? `${ann.label} ${sumText}` : sumText, label = authored(s, "bracket", composed, ann.text, sumText), lineId = s.nid("bracket"), { left, right, y } = span;
1747
+ let sumText = s.run.fmtSigned(span.sum), composed = ann.label ? `${ann.label} ${sumText}` : sumText, label = authored(s, "bracket", composed, ann.text, sumText), lineId = s.nid("bracket"), { left, right } = span, font = { family: input.theme.type.family, ...input.theme.type.label }, size = input.measure(label.text, font), labelRectAt = (top) => ({ x: (left + right - size.width) / 2, y: top - 3 - size.height, w: size.width, h: size.height }), runRectAt = (top) => ({ x: left - 1, y: top - 1, w: right - left + 2, h: BRACKET_TICK + 2 }), seat = unionRect(labelRectAt(span.spanY), runRectAt(span.spanY)), canvas = input.solveCtx.canvas, y = input.occupied.hits(seat, 2) || canvas && !rectContains(canvas, seat, 0) ? span.y : span.spanY;
1578
1748
  s.nodes.push({
1579
1749
  t: "path",
1580
1750
  id: lineId,
@@ -1583,9 +1753,9 @@ function placeBracket(s, ann) {
1583
1753
  width: strokeToken(input.theme, "rule"),
1584
1754
  owner: { annotationId: id },
1585
1755
  part: "bracket"
1586
- }), input.occupied.claim({ x: left - 1, y: y - 1, w: right - left + 2, h: BRACKET_TICK + 2 }, "annotation", { annotationId: id }, "bracket");
1587
- let font = { family: input.theme.type.family, ...input.theme.type.label }, size = input.measure(label.text, font);
1588
- s.labelRequests.push({
1756
+ }), input.occupied.claim(runRectAt(y), "annotation", { annotationId: id }, "bracket");
1757
+ let labelRect = labelRectAt(y);
1758
+ input.occupied.hits(labelRect, 2, (claim) => claim.owner.annotationId === id) || input.occupied.claim(labelRect, "annotation", { annotationId: id }, "bracketLabel"), s.labelRequests.push({
1589
1759
  id: `annotation:${id}`,
1590
1760
  kind: "annotation",
1591
1761
  role: computedTextRole(label.text, label.computed),
@@ -1595,7 +1765,7 @@ function placeBracket(s, ann) {
1595
1765
  typeRole: "label",
1596
1766
  font,
1597
1767
  priority: ann.priority ?? PRIORITY.valueLine,
1598
- candidates: [{ slot: "aboveBracket", rect: { x: (left + right - size.width) / 2, y: y - 3 - size.height, w: size.width, h: size.height }, penalty: 0 }]
1768
+ candidates: [{ slot: "aboveBracket", rect: labelRect, penalty: 0 }]
1599
1769
  }), s.placed.push({
1600
1770
  id,
1601
1771
  kind: "bracket",
@@ -1616,14 +1786,14 @@ function placeDiff(s, ann) {
1616
1786
  if (valueless(s, "diff", [a, b])) return;
1617
1787
  warnPartialComparison(s, "diff", partialAnchors(s, a, b));
1618
1788
  let mode = ann.mode ?? "relative";
1619
- if (mode !== "relative" && mode !== "reversed" && mode !== "absolute")
1789
+ if (mode !== "relative" && mode !== "reversed" && mode !== "absolute" && mode !== "both")
1620
1790
  return warn(
1621
1791
  s,
1622
1792
  "diff-mode-unimplemented",
1623
1793
  `diff '${id}': mode '${String(mode)}' is not implemented \u2014 nothing is drawn`,
1624
- mode === "pctOf100" ? "use mode:'absolute' for the raw difference, or author the shares as data if the reader needs points of 100%" : "use 'relative', 'absolute' or 'reversed'"
1794
+ mode === "pctOf100" ? "use mode:'absolute' for the raw difference, or author the shares as data if the reader needs points of 100%" : "use 'relative', 'absolute', 'reversed' or 'both'"
1625
1795
  );
1626
- let computed, derivation;
1796
+ let computed, pctText = "", derivation;
1627
1797
  if (mode === "relative" || mode === "reversed") {
1628
1798
  let [base, tip] = mode === "reversed" ? [b, a] : [a, b];
1629
1799
  if (base.value === 0) return warn(s, "ref-zero", `diff '${id}': zero base`);
@@ -1642,8 +1812,10 @@ function placeDiff(s, ann) {
1642
1812
  `diff '${id}': percent change off a negative base (${base.value}) is measured against its magnitude, so the sign follows the direction of the change`,
1643
1813
  "use mode:'absolute' if the reader needs the raw difference instead of a ratio to a negative reference"
1644
1814
  );
1645
- } else
1646
- computed = s.run.fmtSigned(b.value - a.value), derivation = {
1815
+ } else {
1816
+ if (mode === "both" && a.value === 0) return warn(s, "ref-zero", `diff '${id}': mode 'both' needs a nonzero 'from'`);
1817
+ let pct = mode === "both" ? (b.value - a.value) / Math.abs(a.value) * 100 : 0;
1818
+ pctText = mode === "both" ? formatAutomaticPercent(pct, typicalDecimals([pct]), !0, input.locale) : "", computed = s.run.fmtSigned(b.value - a.value) + (mode === "both" ? ` (${pctText})` : ""), derivation = {
1647
1819
  basis: "derived",
1648
1820
  op: "annotation-diff-absolute@1",
1649
1821
  inputs: [
@@ -1652,12 +1824,14 @@ function placeDiff(s, ann) {
1652
1824
  ],
1653
1825
  raw: b.value - a.value
1654
1826
  };
1827
+ }
1655
1828
  if (gapPlacement(s, ann, a, b)) {
1656
- let text = mode !== "absolute" ? computed : gapNumber(s, ann, a, b, b.value - a.value, computed), [tail, head] = mode === "reversed" ? [b, a] : [a, b];
1829
+ let value = mode === "relative" || mode === "reversed" ? computed : gapNumber(s, ann, a, b, b.value - a.value, s.run.fmtSigned(b.value - a.value)), text = mode === "both" ? `${value} (${pctText})` : value, [tail, head] = mode === "reversed" ? [b, a] : [a, b];
1657
1830
  return drawGapBracket(s, ann, tail, head, authored(s, "diff", text, ann.text, text), derivation);
1658
1831
  }
1659
1832
  let lead = input.comparisonLayout?.namesSpan ? spanLead(s, a, b, !0, !0) : "", gapWord = input.barInset && !lead && ann.text === void 0 && a.owner.categoryId !== void 0 && a.owner.categoryId === b.owner.categoryId && a.owner.seriesId !== b.owner.seriesId ? input.barInset.gapWord : "", label = gapWord ? { text: `${gapWord}\xA0${computed}`, computed } : authored(s, "diff", lead ? `${lead} ${computed}` : computed, ann.text, computed);
1660
- drawDiffArm(s, a, b, label.text, id, label.computed, derivation, gapWord ? { lead: gapWord, value: computed } : void 0);
1833
+ if (input.spanBracket?.(ann)) return drawSpanBracket(s, a, b, label.text, id, "diff", label.computed, derivation);
1834
+ drawDiffArm(s, a, b, label.text, id, label.computed, derivation, gapWord ? { lead: gapWord, value: computed } : void 0, ann.placement);
1661
1835
  }
1662
1836
  function placeNote(s, ann) {
1663
1837
  let found = s.input.resolve(ann.at);
@@ -1671,14 +1845,16 @@ function placeNote(s, ann) {
1671
1845
  owner: { annotationId: s.id },
1672
1846
  suggest: "keep it, as the number stands at the mark, or drop ${value} from the text to set the wording yourself"
1673
1847
  }), repeats && !text && !glyph) return;
1674
- let headline = ann.kind === "callout" && ann.headline !== void 0 ? ann.headline.replace(/\$\{value\}/g, value) : void 0, placedGlyph = glyph ? planCalloutGlyph(s, at, glyph, text) : void 0, lines = headline === void 0 ? text : `${headline}
1675
- ${text}`;
1848
+ let headline = ann.kind === "callout" && ann.headline !== void 0 ? ann.headline.replace(/\$\{value\}/g, value) : void 0;
1849
+ !text.trim() && headline === void 0 && !glyph && warn(s, "annotation-empty", `${ann.kind} '${s.id}': its text is empty, so it prints no words; any arrow or leader stays`);
1850
+ let placedGlyph = glyph ? planCalloutGlyph(s, at, glyph, text) : void 0, lines = headline === void 0 ? text : `${headline}
1851
+ ${text}`, printsValue = !repeats && [ann.text, ann.kind === "callout" ? ann.headline : void 0].some((part) => part?.includes("${value}"));
1676
1852
  calloutLabel(s, ann, at, lines, ann.kind, void 0, lines, {
1677
1853
  basis: "authored",
1678
1854
  op: `annotation-${ann.kind}@1`,
1679
1855
  inputs: [{ ref: `at:${anchorRefLabel(ann.at)}`, value: at.noValue === void 0 ? at.value : null, state: "anchor" }],
1680
1856
  raw: null
1681
- }, placedGlyph);
1857
+ }, placedGlyph, printsValue ? found.owner : void 0);
1682
1858
  }
1683
1859
  function placeDelta(s, ann) {
1684
1860
  let { input, id } = s, at = input.resolve(ann.at);
@@ -1687,19 +1863,27 @@ function placeDelta(s, ann) {
1687
1863
  if (vsValue === null) return warn(s, "bad-anchor", `delta '${id}': unresolvable vs`);
1688
1864
  if (valueless(s, "delta", [at, vsAnchor])) return;
1689
1865
  warnPartialComparison(s, "delta", partialAnchors(s, at, vsAnchor));
1690
- let atValue = vsAnchor ? at.comparisonValue ?? at.value : at.value, d = atValue - vsValue, computed = s.run.fmtSigned(d), tone = s.run.printsZero(d) ? void 0 : d > 0 ? "good" : "bad", acrossRows = input.deltaAcrossRows === !0 && vsAnchor !== null && vsAnchor.owner.categoryId !== void 0 && vsAnchor.owner.categoryId !== at.owner.categoryId, derivation = {
1866
+ let atValue = vsAnchor ? at.comparisonValue ?? at.value : at.value, d = atValue - vsValue, mode = ann.mode ?? "absolute";
1867
+ if (mode !== "absolute" && vsValue === 0) return warn(s, "ref-zero", `delta '${id}': mode '${mode}' needs a nonzero vs`);
1868
+ let pct = d / Math.abs(vsValue) * 100, pctText = ann.format && mode === "relative" ? s.run.fmtSigned(pct) : formatAutomaticPercent(pct, typicalDecimals([pct]), !0, input.locale), computed = mode === "relative" ? pctText : mode === "both" ? `${s.run.fmtSigned(d)} (${pctText})` : s.run.fmtSigned(d), tone = s.run.printsZero(d) ? void 0 : d > 0 ? "good" : "bad", acrossRows = input.deltaAcrossRows === !0 && vsAnchor !== null && vsAnchor.owner.categoryId !== void 0 && vsAnchor.owner.categoryId !== at.owner.categoryId, vsRef = typeof ann.vs == "number" ? "vs:literal" : `vs:${anchorRefLabel(ann.vs)}`, derivation = mode === "relative" ? {
1869
+ basis: "derived",
1870
+ op: "annotation-diff-relative@1",
1871
+ inputs: [{ ref: `base:${vsRef.slice(3)}`, value: vsValue }, { ref: `tip:${anchorRefLabel(ann.at)}`, value: atValue }],
1872
+ raw: pct
1873
+ } : {
1691
1874
  basis: "derived",
1692
1875
  op: "annotation-delta@1",
1693
- inputs: [
1694
- { ref: `at:${anchorRefLabel(ann.at)}`, value: atValue },
1695
- { ref: typeof ann.vs == "number" ? "vs:literal" : `vs:${anchorRefLabel(ann.vs)}`, value: vsValue }
1696
- ],
1876
+ inputs: [{ ref: `at:${anchorRefLabel(ann.at)}`, value: atValue }, { ref: vsRef, value: vsValue }],
1697
1877
  raw: d
1698
1878
  };
1699
1879
  if (gapPlacement(s, ann, at, vsAnchor)) {
1700
- let text = gapNumber(s, ann, vsAnchor, at, d, computed);
1880
+ let value = mode === "relative" ? computed : gapNumber(s, ann, vsAnchor, at, d, s.run.fmtSigned(d)), text = mode === "both" ? `${value} (${pctText})` : value;
1701
1881
  return drawGapBracket(s, ann, vsAnchor, at, authored(s, "delta", text, ann.text, text), derivation);
1702
1882
  }
1883
+ if (vsAnchor && input.spanBracket?.(ann)) {
1884
+ let label2 = authored(s, "delta", computed, ann.text, computed);
1885
+ return drawSpanBracket(s, comparisonAnchor(vsAnchor) ?? vsAnchor, comparisonAnchor(at) ?? at, label2.text, id, "delta", label2.computed, derivation);
1886
+ }
1703
1887
  let label = authored(s, "delta", acrossRows && vsAnchor.label ? `${computed} vs ${vsAnchor.label}` : computed, ann.text, computed), seat = acrossRows ? { ...at, x: (at.x + vsAnchor.x) / 2 } : at;
1704
1888
  calloutLabel(s, ann, seat, label.text, "delta", tone, label.computed, derivation);
1705
1889
  }
@@ -1741,13 +1925,13 @@ function placeAbs(s, ann) {
1741
1925
  let at = s.input.resolve(ann.at);
1742
1926
  if (!at) return warn(s, "bad-anchor", `abs '${s.id}': unresolvable anchor`);
1743
1927
  if (valueless(s, "abs", [at])) return;
1744
- let computed = s.run.fmt(at.value), label = authored(s, "abs", computed, ann.text);
1928
+ let computed = ann.format === void 0 && at.markValueText !== void 0 ? at.markValueText : s.run.fmt(at.value), label = authored(s, "abs", computed, ann.text);
1745
1929
  calloutLabel(s, ann, at, label.text, "abs", void 0, label.computed, {
1746
1930
  basis: "observed",
1747
1931
  op: "annotation-abs@1",
1748
1932
  inputs: [{ ref: `at:${anchorRefLabel(ann.at)}`, value: at.value, state: "anchor" }],
1749
1933
  raw: at.value
1750
- });
1934
+ }, void 0, label.text === label.computed ? at.owner : void 0);
1751
1935
  }
1752
1936
  function valueLineMean(s, ann) {
1753
1937
  let { input, id } = s, onSecondary = ann.axis === "secondary";
@@ -1826,8 +2010,12 @@ function valueAxisTickColumn(occupied, plotX) {
1826
2010
  return right > left ? [left, right] : void 0;
1827
2011
  }
1828
2012
  var LINE_LABEL_GAP = 3, LINE_SEAT_STEP = 16, LINE_SEAT_MAX = 96, LINE_LABEL_AIR = 12;
2013
+ function alongLine(start, end, fromStart = !1) {
2014
+ let steps = Math.min(LINE_SEAT_MAX, Math.ceil((end - start) / LINE_SEAT_STEP));
2015
+ return steps > 1 ? Array.from({ length: steps - 1 }, (_, i) => fromStart ? start + (i + 1) * (end - start) / steps : end - (i + 1) * (end - start) / steps) : [];
2016
+ }
1829
2017
  function rightLineSeats(input, text, font, size, y, rightSeat) {
1830
- let { plot } = input, above = y - size.height - LINE_LABEL_GAP, below = y + LINE_LABEL_GAP, seat = (slot, x, top, penalty) => ({ slot, rect: { x, y: top, w: size.width, h: size.height }, penalty }), end = plot.x + plot.w - size.width, start = plot.x + 4, steps = Math.min(LINE_SEAT_MAX, Math.ceil((end - start) / LINE_SEAT_STEP)), along = steps > 1 ? Array.from({ length: steps - 1 }, (_, i) => end - (i + 1) * (end - start) / steps) : [], lines = lineLabelGutterLines(text, (t) => input.measure(t, font).width), wrappedW = Math.max(...lines.map((line) => input.measure(line, font).width)), wrappedH = size.height * lines.length;
2018
+ let { plot } = input, above = y - size.height - LINE_LABEL_GAP, below = y + LINE_LABEL_GAP, seat = (slot, x, top, penalty) => ({ slot, rect: { x, y: top, w: size.width, h: size.height }, penalty }), end = plot.x + plot.w - size.width, start = plot.x + 4, along = alongLine(start, end), lines = lineLabelGutterLines(text, (t) => input.measure(t, font).width), wrappedW = Math.max(...lines.map((line) => input.measure(line, font).width)), wrappedH = size.height * lines.length;
1831
2019
  return [
1832
2020
  // One penalty for every seat on the line: the order below is the
1833
2021
  // preference, and a seat that crowds another owner's label
@@ -1843,10 +2031,14 @@ function rightLineSeats(input, text, font, size, y, rightSeat) {
1843
2031
  ...lines.length > 1 ? [{ slot: "lineEndWrapped", rect: { x: rightSeat, y: y - wrappedH / 2, w: wrappedW, h: wrappedH }, penalty: 103, lines }] : []
1844
2032
  ];
1845
2033
  }
2034
+ function repeatsEndValue(input, v, valueText, y, size) {
2035
+ let right = input.plot.x + input.plot.w, near = (rect) => rect.x + rect.w >= right - 2 * size.width && rect.x <= right + size.width && Math.abs(rect.y + rect.h / 2 - y) <= 2 * size.height, sameValue = (owner) => owner.categoryId !== void 0 && input.resolve({ categoryId: owner.categoryId, ...owner.seriesId === void 0 ? {} : { seriesId: owner.seriesId } })?.value === v;
2036
+ return (input.printedLabels ?? []).find((label) => label.kind === "point" && label.hidden === void 0 && label.text === valueText && near(label.rect) && sameValue(label.owner))?.rect;
2037
+ }
1846
2038
  function valueLineLabel(s, ann, v, y, axis) {
1847
- let { input, id } = s, span = input.meanSpan?.({ from: ann.from, to: ann.to }), isMean = ann.value === "mean" || ann.value === void 0, valueText = (isMean ? s.run.statFmt : s.run.fmt)(v), labelText = ann.label === !1 ? "" : ann.label !== void 0 ? namedLineText(ann.label, valueText, v, id) : isMean ? `${input.strings?.average ?? localeStrings(input.locale).average} ${valueText}${span ? ` (${span})` : ""}` : valueText;
2039
+ let { input, id } = s, span = input.meanSpan?.({ from: ann.from, to: ann.to }), isMean = ann.value === "mean" || ann.value === void 0, valueText = (isMean ? s.run.statFmt : s.run.fmt)(v), font = { family: input.theme.type.family, ...input.theme.type.label }, endValue = typeof ann.label == "string" && !ann.label.includes("${value}") && axis === "y" && (ann.side ?? "right") === "right" ? repeatsEndValue(input, v, valueText, y, input.measure(`${ann.label} ${valueText}`, font)) : void 0, nameOnly = endValue !== void 0, labelText = ann.label === !1 || input.valueLineLabels === !1 ? "" : typeof ann.label == "string" && nameOnly ? ann.label : ann.label !== void 0 ? namedLineText(ann.label, valueText, v, id) : isMean ? `${input.strings?.average ?? localeStrings(input.locale).average} ${valueText}${span ? ` (${span})` : ""}` : valueText;
1848
2040
  if (!labelText) return labelText;
1849
- let font = { family: input.theme.type.family, ...input.theme.type.label }, row = input.valueLineRows?.get(id);
2041
+ let row = input.valueLineRows?.get(id);
1850
2042
  if (row) {
1851
2043
  let rowFont = { ...font, weight: emphasisWeight(input.theme) }, lines = wrapText(labelText, rowFont, row.w, Math.max(1, labelText.length), input.measure).lines;
1852
2044
  return s.labelRequests.push({
@@ -1884,7 +2076,10 @@ function valueLineLabel(s, ann, v, y, axis) {
1884
2076
  },
1885
2077
  penalty: 1
1886
2078
  }
1887
- ] : side === "right" ? rightLineSeats(input, labelText, font, size, y, rightSeat) : [
2079
+ ] : side === "right" ? [
2080
+ ...endValue ? [{ slot: "beforeEndValue", rect: { x: endValue.x - 4 - size.width, y: y - size.height - LINE_LABEL_GAP, w: size.width, h: size.height }, penalty: -1 }] : [],
2081
+ ...rightLineSeats(input, labelText, font, size, y, rightSeat)
2082
+ ] : [
1888
2083
  // Inside the plot the centred slot would sit on the label's own
1889
2084
  // dashed line (the solver ignores the annotation's own claims), so
1890
2085
  // a relocated left label takes the slots above and below the line.
@@ -1894,7 +2089,12 @@ function valueLineLabel(s, ann, v, y, axis) {
1894
2089
  ...x !== marginX ? [{ slot: "lineEndMargin", rect: { x: marginX, y: y - size.height / 2, w: size.width, h: size.height }, penalty: 3 }] : [],
1895
2090
  // A left label whose start is taken by the data steps to the line's right end, above or below it.
1896
2091
  { slot: "insideEnd", rect: { x: input.plot.x + input.plot.w - size.width, y: y - size.height - LINE_LABEL_GAP, w: size.width, h: size.height }, penalty: 4 },
1897
- { slot: "insideEndLow", rect: { x: input.plot.x + input.plot.w - size.width, y: y + LINE_LABEL_GAP, w: size.width, h: size.height }, penalty: 5 }
2092
+ { slot: "insideEndLow", rect: { x: input.plot.x + input.plot.w - size.width, y: y + LINE_LABEL_GAP, w: size.width, h: size.height }, penalty: 5 },
2093
+ // Both ends taken: even steps along the line from left to right, as a right label has them.
2094
+ ...alongLine(input.plot.x + 4, input.plot.x + input.plot.w - size.width, !0).flatMap((at, i) => [
2095
+ { slot: `insideAlong${i + 1}`, rect: { x: at, y: y - size.height - LINE_LABEL_GAP, w: size.width, h: size.height }, penalty: 6 },
2096
+ { slot: `insideAlong${i + 1}Low`, rect: { x: at, y: y + LINE_LABEL_GAP, w: size.width, h: size.height }, penalty: 6 }
2097
+ ])
1898
2098
  ], tight = axis === "x" ? [] : candidates.flatMap((c) => Math.abs(c.rect.y + c.rect.h - (y - LINE_LABEL_GAP)) < 1e-6 || Math.abs(c.rect.y - (y + LINE_LABEL_GAP)) < 1e-6 ? [{ ...c, slot: `${c.slot}Tight`, rect: { ...c.rect, y: c.rect.y + (c.rect.y > y ? -1 : 1) }, penalty: c.penalty + 10 }] : []);
1899
2099
  return s.labelRequests.push({
1900
2100
  id: `valueLine:${id}`,
@@ -1936,7 +2136,7 @@ function placeValueLine(s, ann) {
1936
2136
  id,
1937
2137
  kind: "valueLine",
1938
2138
  computedText: labelText || "",
1939
- valueText: (meanLine ? s.run.statFmt : s.run.fmt)(v),
2139
+ valueText: (id === input.averageMarker?.id ? input.averageMarker.fmt : meanLine ? s.run.statFmt : s.run.fmt)(v),
1940
2140
  nodeIds: [lineId],
1941
2141
  labelId: labelText ? `valueLine:${id}` : void 0,
1942
2142
  // A mean is MEASURED over the plotted series (the observations are the
@@ -2005,13 +2205,105 @@ function placeIndicator100(s, ann) {
2005
2205
  derivation: { basis: "authored", op: "annotation-indicator100@1", inputs: [{ ref: "reference", value: 100, state: "constant" }], raw: 100 }
2006
2206
  });
2007
2207
  }
2008
- function calloutLabel(s, ann, anchor, text, kind, tone, computed = text, derivation, glyph) {
2208
+ function placeDrawingText(s, ann) {
2209
+ let { input, id } = s, at = resolveDrawingPoint(input, ann.at);
2210
+ if ("error" in at) return warn(s, "bad-anchor", `text '${id}': ${at.error}`);
2211
+ let font = { family: input.theme.type.family, ...input.theme.type.label }, lines = ann.text.split(`
2212
+ `), lineH = input.measure("X", font).height, size = { w: Math.max(0, ...lines.map((line) => input.measure(line, font).width)), h: lineH * lines.length };
2213
+ s.labelRequests.push({
2214
+ id: `annotation:${id}`,
2215
+ kind: "annotation",
2216
+ role: "note",
2217
+ owner: { annotationId: id },
2218
+ text: ann.text,
2219
+ lines,
2220
+ typeRole: "label",
2221
+ font,
2222
+ priority: ann.priority ?? PRIORITY.extreme,
2223
+ noLeader: !0,
2224
+ candidates: textSeats(at, size)
2225
+ }), s.placed.push({ id, kind: "text", computedText: ann.text, tone: "neutral", nodeIds: [], labelId: `annotation:${id}` });
2226
+ }
2227
+ function placeDrawing(s, ann, run) {
2228
+ let { input, id } = s;
2229
+ if (ann.kind !== "box" && (isTextEnd(ann.from) || isTextEnd(ann.to))) {
2230
+ let end = (point, field) => {
2231
+ if (!isTextEnd(point)) {
2232
+ let at = resolveDrawingPoint(input, point);
2233
+ return "error" in at ? `${field}: ${at.error}` : at;
2234
+ }
2235
+ let texts = input.annotations.flatMap((annotation, index) => annotation.kind === "text" ? [defaultAnnotationId(annotation, index)] : []);
2236
+ return texts.includes(point.annotationId) ? { textId: point.annotationId } : `${field}: annotationId '${point.annotationId}' names no text annotation${texts.length ? `; text ids: ${texts.join(", ")}` : ""}`;
2237
+ }, from2 = end(ann.from, "from"), to2 = end(ann.to, "to");
2238
+ if (typeof from2 == "string" || typeof to2 == "string") return warn(s, "bad-anchor", `${ann.kind} '${id}': ${typeof from2 == "string" ? from2 : to2}`);
2239
+ let record = { id, kind: ann.kind, computedText: "", tone: "neutral", nodeIds: [] };
2240
+ s.placed.push(record), (run.textDrawings ??= []).push({ ann, id, from: from2, to: to2, nid: s.nid, record });
2241
+ return;
2242
+ }
2243
+ let ends = [resolveDrawingPoint(input, ann.from), resolveDrawingPoint(input, ann.to)], [from, to] = ann.kind === "box" ? boxCorners(input, ...ends) : ends, failure = drawingFailure(ann.kind, from, to);
2244
+ if (failure !== void 0) return warn(s, "bad-anchor", `${ann.kind} '${id}': ${failure}`);
2245
+ run.drawings ??= /* @__PURE__ */ new Map();
2246
+ let nodeIds = drawDrawing(
2247
+ ann,
2248
+ id,
2249
+ from,
2250
+ to,
2251
+ input.theme,
2252
+ input.occupied,
2253
+ s.nodes,
2254
+ s.nid,
2255
+ run.drawings,
2256
+ ann.kind === "box" ? void 0 : to.mark,
2257
+ shortArrow(s.warnings, id)
2258
+ );
2259
+ s.placed.push({ id, kind: ann.kind, computedText: "", tone: "neutral", nodeIds });
2260
+ }
2261
+ function isTextEnd(point) {
2262
+ return typeof point == "object" && point !== null && "annotationId" in point;
2263
+ }
2264
+ var TEXT_END_GAP = 3;
2265
+ function shortArrow(warnings, id) {
2266
+ return (shaft, minimum, dropped) => warnings.push({
2267
+ code: "arrow-short",
2268
+ severity: "warn",
2269
+ owner: { annotationId: id },
2270
+ message: dropped ? `arrow '${id}': its ends lie too close together for a head and a shaft, so it is not drawn` : `arrow '${id}': its shaft is ${Math.round(shaft)} px, under the ${minimum} px an arrow needs to read as one`,
2271
+ suggest: "Move the arrow's start farther from its end, or draw a line."
2272
+ });
2273
+ }
2274
+ function drawFromText(input, run, drawing, labels, nodes, warnings) {
2275
+ let fail = (why) => {
2276
+ warnings.push({ code: "bad-anchor", severity: "warn", message: `${drawing.ann.kind} '${drawing.id}': ${why}, so it is not drawn`, owner: { annotationId: drawing.id } });
2277
+ }, look = drawing.ann.kind === "arrow" ? arrowLook(input.theme, { size: 0 }) : void 0, gap = look?.standard ? look.tailGap : TEXT_END_GAP, seatOf = (end) => {
2278
+ if (!("textId" in end)) return;
2279
+ let label = labels.find((entry) => entry.id === `annotation:${end.textId}`);
2280
+ return label && !label.hidden ? inflate(label.rect, gap) : null;
2281
+ }, fromSeat = seatOf(drawing.from), toSeat = seatOf(drawing.to);
2282
+ if (fromSeat === null || toSeat === null) return fail(`text '${"textId" in drawing.from && fromSeat === null ? drawing.from.textId : drawing.to.textId}' has no place on the chart`);
2283
+ let centre = (end, seat) => seat ? { x: seat.x + seat.w / 2, y: seat.y + seat.h / 2 } : end, nearest = (seat, toward) => ({ x: Math.min(Math.max(toward.x, seat.x), seat.x + seat.w), y: Math.min(Math.max(toward.y, seat.y), seat.y + seat.h) }), aimFrom = centre(drawing.from, fromSeat), aimTo = centre(drawing.to, toSeat), from = fromSeat ? nearest(fromSeat, aimTo) : aimFrom, to = toSeat ? nearest(toSeat, aimFrom) : aimTo;
2284
+ if (fromSeat && rectContains(fromSeat, { ...to, w: 0, h: 0 }) || toSeat && rectContains(toSeat, { ...from, w: 0, h: 0 }) || Math.hypot(to.x - from.x, to.y - from.y) < 1) return fail("its other end lies on the text");
2285
+ run.drawings ??= /* @__PURE__ */ new Map(), drawing.record.nodeIds = drawDrawing(
2286
+ drawing.ann,
2287
+ drawing.id,
2288
+ from,
2289
+ to,
2290
+ input.theme,
2291
+ input.occupied,
2292
+ nodes,
2293
+ drawing.nid,
2294
+ run.drawings,
2295
+ toSeat ? void 0 : drawing.to.mark,
2296
+ shortArrow(warnings, drawing.id)
2297
+ );
2298
+ }
2299
+ var CALLOUT_MARKER_R = 3, VALUE_BOX_REACH = 24;
2300
+ function calloutLabel(s, ann, anchor, text, kind, tone, computed = text, derivation, glyph, valueOwner) {
2009
2301
  let { input, id: annId } = s, at = calloutAttachment(anchor, kind, glyph), head = kind === "callout" ? ann : {}, base = { family: input.theme.type.family, ...input.theme.type.label }, font = head.arrow === !0 && !glyph || head.headline !== void 0 ? { ...base, weight: input.plainLabelWeight ?? base.weight } : base, rowWidth = input.gridCallouts?.rows.get(annId)?.w ?? input.gridCallouts?.widths?.get(annId), headSourceLines = head.headline?.split(`
2010
2302
  `).length ?? 0, headlineLines = 0, lines = text.split(`
2011
2303
  `).flatMap((line, i) => {
2012
2304
  let face = i < headSourceLines ? { ...font, weight: emphasisWeight(input.theme) } : font, wrapped = rowWidth === void 0 ? [line] : wrapText(line, face, Math.max(1, rowWidth - (glyph ? glyph.radius * 2 + 7 : 0)), Math.max(1, line.length), input.measure).lines;
2013
2305
  return i < headSourceLines && (headlineLines += wrapped.length), wrapped;
2014
- }), w = Math.max(...lines.map((line, i) => input.measure(line, i < headlineLines ? { ...font, weight: emphasisWeight(input.theme) } : font).width)), lineH = input.measure("X", font).height, h = lineH * lines.length, gap = glyph ? glyph.radius + 7 : 8, prefer = ann.preferSide, markBox = kind === "callout" || kind === "note" ? at.printed?.box ?? at.markBox : void 0, box = markBox ?? { x: at.x, y: at.y, w: 0, h: 0 }, [left, top, right, bottom] = [box.x, box.y, box.x + box.w, box.y + box.h], sideY = (kind === "callout" || kind === "note") && !at.printed && at.markBox ? top + box.h / 2 : at.y, round = markBox !== void 0 && !at.printed, edgeToward = (r) => {
2306
+ }), w = Math.max(0, ...lines.map((line, i) => input.measure(line, i < headlineLines ? { ...font, weight: emphasisWeight(input.theme) } : font).width)), lineH = input.measure("X", font).height, h = lineH * lines.length, gap = glyph ? glyph.radius + 7 : 8, prefer = ann.preferSide, markBox = kind === "callout" || kind === "note" ? at.printed?.box ?? at.markBox : void 0, box = markBox ?? { x: at.x, y: at.y, w: 0, h: 0 }, [left, top, right, bottom] = [box.x, box.y, box.x + box.w, box.y + box.h], sideY = (kind === "callout" || kind === "note") && !at.printed && at.markBox ? top + box.h / 2 : at.y, round = markBox !== void 0 && !at.printed, edgeToward = (r) => {
2015
2307
  if (round) {
2016
2308
  let [cx, cy, rad] = [left + box.w / 2, top + box.h / 2, box.w / 2], tx = r.x >= cx ? r.x : r.x + r.w, ty = r.y + r.h / 2, len = Math.hypot(tx - cx, ty - cy) || 1;
2017
2309
  return { x: cx + (tx - cx) / len * rad, y: cy + (ty - cy) / len * rad };
@@ -2038,7 +2330,18 @@ function calloutLabel(s, ann, anchor, text, kind, tone, computed = text, derivat
2038
2330
  return glyph.placements.set(slot, { groupRect, labelRect, chipCenter, anchor: anchor2 }), { slot, rect: groupRect, penalty, leaderLengthBound: Math.abs(chipCenter.x - anchor2.x) + Math.abs(chipCenter.y - anchor2.y) };
2039
2331
  }
2040
2332
  return { slot, rect: labelRect, penalty, ...leader ? { leaderFrom: edgeToward(labelRect) } : {} };
2041
- }, all = [
2333
+ }, stackMembers = kind === "callout" || kind === "note" || kind === "delta" ? input.annotations.filter((other) => ["callout", "note", "delta"].includes(other.kind) && "at" in other && other.at !== void 0 && samePoint(other.at)) : [], sharing = stackMembers.length, columnTop = input.calloutColumnStack === !0 && !glyph && head.arrow !== !0 && w > 0 && !anchor.lineAnchored && box.w === 0 && sharing > 0, stackSeats = [], stackBase, otherNotes = [];
2334
+ if (columnTop) {
2335
+ let stackW = Math.max(w, ...stackMembers.map((other) => "text" in other && typeof other.text == "string" ? input.measure(other.text, font).width : 0)), aboveRect = { x: at.x - stackW / 2, y: top - h - gap, w: stackW, h }, ticks = input.occupied.hitsWhich(aboveRect, 0).filter((claim) => claim.kind === "mark"), value = input.printedLabels?.find((label) => label.kind === "point" && label.hidden === void 0 && label.owner.categoryId === anchor.owner.categoryId && label.owner.seriesId === anchor.owner.seriesId && label.rect.y < top), base2 = Math.min(top - gap, ...ticks.map((claim) => claim.rect.y - 4), ...value ? [value.rect.y - 4] : []);
2336
+ sharing === 1 && (stackBase = base2), otherNotes = input.annotations.flatMap((other) => {
2337
+ if (other === ann || other.kind !== "callout" && other.kind !== "note" || typeof other.text != "string") return [];
2338
+ let x = input.resolve(other.at)?.x;
2339
+ return x === void 0 ? [] : [{ x, w: input.measure(other.text, font).width }];
2340
+ });
2341
+ let place = Math.max(0, stackMembers.indexOf(ann));
2342
+ for (let k = 0; k < sharing; k++) stackSeats.push(mk(`aboveStack${k}`, at.x - w / 2, base2 - h - k * (h + 4), 0.1 * (1 + Math.abs(k - place))));
2343
+ }
2344
+ let all = [
2042
2345
  mk(
2043
2346
  "above",
2044
2347
  glyph ? at.x + gap : at.x - w / 2,
@@ -2057,6 +2360,9 @@ function calloutLabel(s, ann, anchor, text, kind, tone, computed = text, derivat
2057
2360
  prefer === "below" ? -1 : 3,
2058
2361
  glyph !== void 0
2059
2362
  ),
2363
+ // A column's seat above, stacked: over a plan tick across the column's end, and over the other notes
2364
+ // on the same column (a delta, then its callout), straight above it with no leader.
2365
+ ...stackSeats,
2060
2366
  // over or under the first point of a late-starting line, the
2061
2367
  // note may also end at the point, where its own line has not started. The centred seat
2062
2368
  // lost to the line's first climb, and the note moved to the side its author did not ask for.
@@ -2122,7 +2428,7 @@ function calloutLabel(s, ann, anchor, text, kind, tone, computed = text, derivat
2122
2428
  let rect = { x, y, w: ww, h: hh }, from = value ? valueEdgeToward(value, rect) : edgeToward(rect), candidate = { slot, rect, penalty: extra + penalty, lines: wrapped, ...leader ? { leaderFrom: from, leaderLineHeight: lineH } : {} }, drawn = leader ? leaderFor(candidate) : void 0;
2123
2429
  drawn && leaderCrossesLabel(drawn.d, input.occupied) || (leader && /^(above|below)/.test(slot) && !drawn && (candidate.penalty += 1e3), wrappedSeats.push(candidate));
2124
2430
  };
2125
- seat("aboveWrap", cx, wTop - hh - gap, prefer === "above" ? -1 : 0), seat("rightWrapAt", wRight + gap * 2, sideY - hh / 2, prefer === "right" ? -1 : 1, !0), seat("leftWrapAt", wLeft - ww - gap * 2, sideY - hh / 2, prefer === "left" ? -1 : 2, !0), seat("belowWrap", cx, wBottom + gap, prefer === "below" ? -1 : 3), seat("aboveLeftWrap", Math.max(input.plot.x, wLeft - ww - gap * 2), wTop - hh - gap, 3.1, !0), seat("aboveRightWrap", Math.min(wRight + gap * 2, input.plot.x + input.plot.w - ww), wTop - hh - gap, 3.2, !0), seat("belowLeftWrap", Math.max(input.plot.x, wLeft - ww - gap * 2), wBottom + gap, 3.3, !0), seat("belowRightWrap", Math.min(wRight + gap * 2, input.plot.x + input.plot.w - ww), wBottom + gap, 3.4, !0);
2431
+ seat("aboveWrap", cx, wTop - hh - gap, prefer === "above" ? -1 : 0), stackBase !== void 0 && !otherNotes.some((other) => Math.abs(other.x - at.x) < (ww + other.w) / 2 + gap) && seat("aboveStackWrap", at.x - ww / 2, stackBase - hh, -50 - (wrapped.length - 2) * 20), seat("rightWrapAt", wRight + gap * 2, sideY - hh / 2, prefer === "right" ? -1 : 1, !0), seat("leftWrapAt", wLeft - ww - gap * 2, sideY - hh / 2, prefer === "left" ? -1 : 2, !0), seat("belowWrap", cx, wBottom + gap, prefer === "below" ? -1 : 3), seat("aboveLeftWrap", Math.max(input.plot.x, wLeft - ww - gap * 2), wTop - hh - gap, 3.1, !0), seat("aboveRightWrap", Math.min(wRight + gap * 2, input.plot.x + input.plot.w - ww), wTop - hh - gap, 3.2, !0), seat("belowLeftWrap", Math.max(input.plot.x, wLeft - ww - gap * 2), wBottom + gap, 3.3, !0), seat("belowRightWrap", Math.min(wRight + gap * 2, input.plot.x + input.plot.w - ww), wBottom + gap, 3.4, !0);
2126
2432
  }
2127
2433
  all.push(...wrappedSeats.sort((a, b) => a.penalty - b.penalty));
2128
2434
  }
@@ -2140,8 +2446,12 @@ function calloutLabel(s, ann, anchor, text, kind, tone, computed = text, derivat
2140
2446
  let [a, b] = ends, run = { x: Math.min(a.x, b.x), y: Math.min(a.y, b.y), w: Math.abs(a.x - b.x), h: Math.abs(a.y - b.y) };
2141
2447
  return !input.occupied.hitsWhich(run).some((claim) => claim.kind === "label");
2142
2448
  }));
2143
- let arrow = head.arrow === !0 && !glyph ? { anchor: { x: at.x, y: at.y }, nodeIds: [s.nid("arrow"), s.nid("arrowHead")], owner: { annotationId: annId } } : void 0;
2144
- if (arrow && (all = [...arrowSeats(arrow.anchor, w, h, lineH, prefer), ...all]), (arrow || head.headline !== void 0) && s.run.calloutHeads.set(`annotation:${annId}`, { font, headline: head.headline !== void 0, headlineLines, headlineWeight: emphasisWeight(input.theme), ...arrow ? { arrow } : {} }), input.gridCallouts && (kind === "callout" || kind === "note")) {
2449
+ let arrow = head.arrow === !0 && !glyph ? { anchor: { x: at.x, y: at.y }, edge: at.lineAnchored ? at.markerRadius ?? CALLOUT_MARKER_R : 0, nodeIds: [s.nid("arrow"), s.nid("arrowHead")], owner: { annotationId: annId } } : void 0;
2450
+ if (arrow) {
2451
+ let look = calloutArrowLook(input.theme), valueBox = look.standard ? anchorValueBox(input.occupied, { x: at.x, y: at.y, w: 0, h: 0 }, at.owner, VALUE_BOX_REACH) : void 0;
2452
+ valueBox && (arrow.valueBox = valueBox), all = [...arrowSeats(arrow.anchor, w, h, lineH, prefer, calloutArrowReach(look, arrow.edge), look.standard, valueBox), ...all];
2453
+ }
2454
+ if ((arrow || head.headline !== void 0) && s.run.calloutHeads.set(`annotation:${annId}`, { font, headline: head.headline !== void 0, headlineLines, headlineWeight: emphasisWeight(input.theme), ...arrow ? { arrow } : {} }), input.gridCallouts && (kind === "callout" || kind === "note")) {
2145
2455
  let { rows, bounds, grid, sideLimit } = input.gridCallouts, row = rows.get(annId);
2146
2456
  row ? all = [{ ...mk(
2147
2457
  row.y >= grid.y + grid.h ? "belowRow" : "aboveRow",
@@ -2170,7 +2480,9 @@ function calloutLabel(s, ann, anchor, text, kind, tone, computed = text, derivat
2170
2480
  ...(kind === "callout" || kind === "note") && input.calloutLeaderClear ? { leaderClear: !0 } : {},
2171
2481
  // On a grid, a seat nearer another row's cell than its own is
2172
2482
  // ambiguous, and takes a leader from its cell if nothing else is free.
2173
- ...gridRow?.end !== void 0 ? { anchor: box } : {}
2483
+ ...gridRow?.end !== void 0 ? { anchor: box } : {},
2484
+ // A labelOffsets move leads back to the mark itself, not to the edge of the seat it left.
2485
+ movedLeaderFrom: { x: at.x, y: at.y }
2174
2486
  }), glyph && s.run.calloutGlyphPlans.set(`annotation:${annId}`, glyph), s.placed.push({
2175
2487
  id: annId,
2176
2488
  kind,
@@ -2178,7 +2490,8 @@ function calloutLabel(s, ann, anchor, text, kind, tone, computed = text, derivat
2178
2490
  tone: tone ?? "neutral",
2179
2491
  nodeIds: glyph?.nodeIds ?? arrow?.nodeIds ?? [],
2180
2492
  labelId: `annotation:${annId}`,
2181
- ...derivation ? { derivation } : {}
2493
+ ...derivation ? { derivation } : {},
2494
+ ...valueOwner ? { valueOwner } : {}
2182
2495
  });
2183
2496
  }
2184
2497
  function calloutGlyphOf(s, annotation) {
@@ -2236,32 +2549,35 @@ function finishAnnotatePass(input, run, nodes, placed, labelRequests, warnings)
2236
2549
  if (!glyph) continue;
2237
2550
  let placement = glyph.placements.get(String(label.slot));
2238
2551
  if (!placement) continue;
2239
- if (label.rect = placement.labelRect, label.hidden) {
2552
+ let dx = label.rect.x - placement.groupRect.x, dy = label.rect.y - placement.groupRect.y, labelRect = dx === 0 && dy === 0 ? placement.labelRect : { ...placement.labelRect, x: placement.labelRect.x + dx, y: placement.labelRect.y + dy }, chipCenter = dx === 0 && dy === 0 ? placement.chipCenter : { x: placement.chipCenter.x + dx, y: placement.chipCenter.y + dy };
2553
+ if (label.rect = labelRect, label.hidden) {
2240
2554
  glyph.nodeIds.splice(0);
2241
2555
  continue;
2242
2556
  }
2243
2557
  label.leader = calloutGlyphLeader(
2244
- placement.chipCenter,
2558
+ chipCenter,
2245
2559
  placement.anchor,
2246
2560
  glyph.radius
2247
2561
  );
2248
- let glyphNodes = calloutGlyphNodes(glyph, placement.chipCenter, input.theme);
2562
+ let glyphNodes = calloutGlyphNodes(glyph, chipCenter, input.theme);
2249
2563
  nodes.push(...glyphNodes);
2250
2564
  let chipRect = {
2251
- x: placement.chipCenter.x - glyph.radius,
2252
- y: placement.chipCenter.y - glyph.radius,
2565
+ x: chipCenter.x - glyph.radius,
2566
+ y: chipCenter.y - glyph.radius,
2253
2567
  w: glyph.radius * 2,
2254
2568
  h: glyph.radius * 2
2255
2569
  };
2256
2570
  input.occupied.claim(chipRect, "annotation", glyph.owner, "calloutGlyph");
2257
2571
  }
2258
- finishCalloutHeads(input.theme, solved.placed, run.calloutHeads, nodes, input.occupied);
2572
+ finishCalloutHeads(input.theme, solved.placed, run.calloutHeads, nodes, input.occupied, warnings);
2259
2573
  let leaderAnchors = /* @__PURE__ */ new Map();
2260
2574
  input.annotations.forEach((annotation, index) => {
2261
2575
  if (annotation.kind !== "callout" && annotation.kind !== "note" && annotation.kind !== "abs" && annotation.kind !== "delta") return;
2262
2576
  let id = `annotation:${defaultAnnotationId(annotation, index)}`, owner = run.calloutGlyphPlans.has(id) ? void 0 : input.resolve(annotation.at)?.owner;
2263
2577
  owner && leaderAnchors.set(id, owner);
2264
- }), leaderAnchors.size > 0 && leadersOffAnchorValues(solved.placed, leaderAnchors, input.occupied), trimAnnotationGuides(nodes, input.occupied), pruneOrphanAnnotationArms(nodes, placed, solved.placed);
2578
+ }), leaderAnchors.size > 0 && leadersOffAnchorValues(solved.placed, leaderAnchors, input.occupied), trimAnnotationGuides(nodes, input.occupied);
2579
+ for (let drawing of run.textDrawings ?? []) drawFromText(input, run, drawing, solved.placed, nodes, warnings);
2580
+ run.drawings && cutDrawingsAroundText(nodes, placed, input.occupied, warnings, run.drawings), pruneOrphanAnnotationArms(nodes, placed, solved.placed);
2265
2581
  for (let annotation of placed)
2266
2582
  annotation.derivation || (annotation.derivation = {
2267
2583
  basis: "authored",
@@ -2300,7 +2616,7 @@ function settleEraBands(input, run, requests) {
2300
2616
  return { solved: solveLabels(requests, input.occupied, input.solveCtx), bandNeed: 0 };
2301
2617
  for (let plan of run.eraBands) {
2302
2618
  let req = requests.find((r) => r.id === plan.labelId);
2303
- req && (req.candidates = buildExtendedEraBandCandidates(plan, input, !1));
2619
+ req && (req.candidates = buildExtendedEraBandCandidates(plan, input, !1), plan.style === "shade" && (req.pinnedSlot ?? input.solveCtx.pins[plan.labelId]) === void 0 && req.candidates.sort((a, b) => +!rectContains(input.plot, a.rect) - +!rectContains(input.plot, b.rect)));
2304
2620
  }
2305
2621
  let solved = solveLabels(requests, input.occupied, input.solveCtx), stillHidden = run.eraBands.filter((plan) => solved.placed.find((l) => l.id === plan.labelId)?.hidden);
2306
2622
  if (stillHidden.length === 0)
@@ -2443,7 +2759,7 @@ function resolveEvents(input) {
2443
2759
  }, groups = new Map((input.events?.groups ?? []).map((g, i) => [g.id, { ...g, glyph: g.glyph ?? GLYPHS[i % GLYPHS.length] }])), paintOf = (tone) => tone === "neutral" ? { token: "inkMuted" } : input.colorblindSafe ? colorblindPaint(tone) : { token: tone }, out = [];
2444
2760
  return input.annotations.forEach((annotation, index) => {
2445
2761
  if (annotation.kind !== "event") return;
2446
- let ann = annotation, id = defaultAnnotationId(ann, index), warn2 = (code, message, suggest) => warnings.push({ code, severity: "warn", message, owner: { annotationId: id }, ...suggest ? { suggest } : {} }), pos, date, when, period;
2762
+ let ann = annotation, id = defaultAnnotationId(ann, index), ref = annotationRef(annotation, index, `options.annotations[${index}]`), warn2 = (code, message, suggest) => warnings.push({ code, severity: "warn", message, owner: { annotationId: id }, ...suggest ? { suggest } : {} }), pos, date, when, period;
2447
2763
  if (ann.date !== void 0 && input.scale) {
2448
2764
  let scale = input.scale, x = scale.read(ann.date, `options.annotations[${index}].date`, !1);
2449
2765
  if (x < scale.lo || x > scale.hi) {
@@ -2458,17 +2774,21 @@ function resolveEvents(input) {
2458
2774
  if (!dated)
2459
2775
  throw new NormalizeError(
2460
2776
  "event-date-unresolvable",
2461
- `options.annotations[${index}].date`,
2777
+ `${ref.name}.date`,
2462
2778
  `event '${id}' has a date, but not every category carries an ISO date to place it by`,
2463
- "give each category an ISO 'date', or anchor the event to a category with 'at'"
2779
+ "give each category an ISO 'date', or anchor the event to a category with 'at'",
2780
+ void 0,
2781
+ ref.segments.length ? [...ref.segments, "date"] : []
2464
2782
  );
2465
2783
  let parsed = parseISODate(ann.date);
2466
2784
  if (!parsed && parseTimeText(ann.date))
2467
2785
  throw new NormalizeError(
2468
2786
  "event-time-needs-x-axis",
2469
- `options.annotations[${index}].date`,
2787
+ `${ref.name}.date`,
2470
2788
  `event '${id}' gives a time of day, and the categories are days, so the time has no place`,
2471
- "give the day only (yyyy-mm-dd), or draw the readings on a continuous axis: data.x with options.xAxis: { type: 'time' }"
2789
+ "give the day only (yyyy-mm-dd), or draw the readings on a continuous axis: data.x with options.xAxis: { type: 'time' }",
2790
+ void 0,
2791
+ ref.segments.length ? [...ref.segments, "date"] : []
2472
2792
  );
2473
2793
  let at = parsed ? posOfDay(dayOf(parsed)) : null;
2474
2794
  if (at === null) {
@@ -2640,9 +2960,9 @@ function xAt(axis, pos, count) {
2640
2960
  let ci = Math.min(count - 1, Math.max(0, Math.floor(pos))), x = axis.continuous ? axis.x(pos) : axis.x(ci) + (pos - ci - 0.5) * axis.step;
2641
2961
  return Math.min(axis.plot.x + axis.plot.w, Math.max(axis.plot.x, x));
2642
2962
  }
2643
- var TEXT_GAP = 4, GUTTER = 14, ROW_GAP = 6, TRACK = 6;
2963
+ var TEXT_GAP2 = 4, GUTTER = 14, ROW_GAP = 6, TRACK = 6;
2644
2964
  function extent(p, x) {
2645
- return p.side === "right" ? [x - 1, x + TEXT_GAP + p.block.w] : [x - TEXT_GAP - p.block.w, x + 1];
2965
+ return p.side === "right" ? [x - 1, x + TEXT_GAP2 + p.block.w] : [x - TEXT_GAP2 - p.block.w, x + 1];
2646
2966
  }
2647
2967
  function planLane(events, axis, count, rows, bounds, f, measure, noKey = !1) {
2648
2968
  let maxW = Math.min(230, axis.plot.w / 3.6), placed = [], keyed = [], inline = [], poleAt = /* @__PURE__ */ new Set(), order = [...events].sort((a, b) => b.priority - a.priority || byTime(a, b)), clashes = (others, { block, row, side }) => {
@@ -2746,10 +3066,12 @@ function settleEventLane(input) {
2746
3066
  return fullBand !== void 0 && recordPartNeed(framed.frame.frame, Math.ceil((s.size.height - fullBand) / (1 - KEY_BAND_FLOOR) - 1e-6)), { framed: shifted, area: s.area(shifted, s.warnings), lane: { plan, top } };
2747
3067
  }
2748
3068
  function emitEventLane(theme, input) {
2749
- let { plan, top, axis, occupied } = input, f = plan.fonts, laneBottom = top + plan.height, rowTop = (row) => top + (plan.rows - 1 - row) * (plan.rowH + ROW_GAP), tracksTop = top + plan.rows * (plan.rowH + ROW_GAP), stripY = tracksTop + (plan.tracks ? plan.tracks * TRACK + 2 : 0) + f.ringR + 1, stopAt = (x) => {
2750
- if (input.mode === "through") return laneBottom;
2751
- let hits = occupied.hitsWhich({ x: x - 1, y: laneBottom, w: 2, h: Math.max(0, input.baseline - laneBottom) }).filter((o) => o.kind === "mark" || o.kind === "label");
2752
- return Math.min(input.baseline, minOf(hits.map((o) => o.rect.y))) - 3;
3069
+ let { plan, top, axis, occupied } = input, f = plan.fonts, laneBottom = top + plan.height, rowTop = (row) => top + (plan.rows - 1 - row) * (plan.rowH + ROW_GAP), tracksTop = top + plan.rows * (plan.rowH + ROW_GAP), stripY = tracksTop + (plan.tracks ? plan.tracks * TRACK + 2 : 0) + f.ringR + 1, poleRuns = (x, y1) => {
3070
+ if (input.mode === "through") return laneBottom > y1 ? [[y1, laneBottom]] : [];
3071
+ let hits = occupied.hitsWhich({ x: x - 1, y: laneBottom, w: 2, h: Math.max(0, input.baseline - laneBottom) }).filter((o) => o.kind === "mark" || o.kind === "label"), seriesName = (o) => o.kind === "label" && o.owner.seriesId !== void 0 && o.owner.categoryId === void 0 && o.owner.annotationId === void 0, end = Math.min(input.baseline, minOf(hits.filter((o) => !seriesName(o)).map((o) => o.rect.y))) - 3, runs = [], from = y1;
3072
+ for (let name of hits.filter((o) => seriesName(o) && o.rect.y < end).sort((a, b) => a.rect.y - b.rect.y))
3073
+ name.rect.y - 3 > from && runs.push([from, name.rect.y - 3]), from = Math.max(from, name.rect.y + name.rect.h + 3);
3074
+ return end > from && runs.push([from, end]), runs;
2753
3075
  }, requests = [], fixed = (id, evId, text2, lines, font, rect, slot, role = "note") => requests.push({ id, kind: "annotation", owner: { annotationId: evId }, text: text2, lines, typeRole: font === f.num ? "micro" : font === f.title ? "axis" : "footnote", font, priority: PRIORITY.valueLine, pad: 0, candidates: [{ slot, rect, penalty: 0 }], role });
2754
3076
  for (let p of plan.placed) {
2755
3077
  let slot = `lane-${p.row}-${p.side}`;
@@ -2780,7 +3102,7 @@ function emitEventLane(theme, input) {
2780
3102
  [0.28, 0.5, 0.72].forEach((fraction, row) => {
2781
3103
  let y = axis.plot.y + axis.plot.h * fraction - block.h / 2;
2782
3104
  for (let side of ["right", "left"]) {
2783
- let rect = { x: side === "right" ? x + TEXT_GAP : x - TEXT_GAP - block.w, y, w: block.w, h: block.h };
3105
+ let rect = { x: side === "right" ? x + TEXT_GAP2 : x - TEXT_GAP2 - block.w, y, w: block.w, h: block.h };
2784
3106
  rect.x >= axis.plot.x && rect.x + rect.w <= axis.plot.x + axis.plot.w && candidates.push({ slot: `inline-${side}-${row}`, rect, penalty: row + (side === "left" ? 0.5 : 0), needsBacking: !0 });
2785
3107
  }
2786
3108
  }), requests.push({
@@ -2805,8 +3127,10 @@ function emitEventLane(theme, input) {
2805
3127
  }, own = (evId, node, back = !1) => {
2806
3128
  (back ? behind : nodes).push(node), nodeIds.set(evId, [...nodeIds.get(evId) ?? [], node.id]);
2807
3129
  }, pole = (ev, x, y1) => {
2808
- let owner = { annotationId: ev.id }, y2 = stopAt(x);
2809
- y2 > y1 && (own(ev.id, { t: "line", id: `ann:${ev.id}:pole`, x1: x, y1, x2: x, y2, stroke: { token: "leader" }, width: strokeToken(theme, "rule"), owner, part: "eventPole" }), occupied.claim({ x: x - 1, y: y1, w: 2, h: y2 - y1 }, "annotation", owner, "eventPole")), input.mode === "through" && input.baseline > laneBottom && own(ev.id, { t: "line", id: `ann:${ev.id}:rule`, x1: x, y1: laneBottom, x2: x, y2: input.baseline, stroke: { token: "leader" }, width: strokeToken(theme, "rule"), dash: dashToken(theme, "dotted"), lineCap: "round", owner, part: "eventRule" }, !0);
3130
+ let owner = { annotationId: ev.id };
3131
+ poleRuns(x, y1).forEach(([from, to], k) => {
3132
+ own(ev.id, { t: "line", id: `ann:${ev.id}:pole${k === 0 ? "" : `:${k + 1}`}`, x1: x, y1: from, x2: x, y2: to, stroke: { token: "leader" }, width: strokeToken(theme, "rule"), owner, part: "eventPole" }), occupied.claim({ x: x - 1, y: from, w: 2, h: to - from }, "annotation", owner, "eventPole");
3133
+ }), input.mode === "through" && input.baseline > laneBottom && own(ev.id, { t: "line", id: `ann:${ev.id}:rule`, x1: x, y1: laneBottom, x2: x, y2: input.baseline, stroke: { token: "leader" }, width: strokeToken(theme, "rule"), dash: dashToken(theme, "dotted"), lineCap: "round", owner, part: "eventRule" }, !0);
2810
3134
  }, text = (evId, id, line, halo) => {
2811
3135
  let owner = { annotationId: evId }, gs = line.glyph ? 11 * f.glyphS : 0;
2812
3136
  line.glyph && own(evId, eventGlyphNode(line.glyph.glyph, line.rect.x + 3.6 * f.glyphS, line.rect.y + line.font.size * (EVENT_TEXT_ASCENT - 0.35), f.glyphS, line.glyph.paint, `ann:${evId}:glyph`, owner, "eventGlyph"));
@@ -2892,7 +3216,7 @@ function emitEventLane(theme, input) {
2892
3216
  return { nodes, behind, labels: solved.placed, placed, warnings: solved.warnings };
2893
3217
  }
2894
3218
  function blockLines(block, pole, top, side, f) {
2895
- let x = side === "right" ? pole + TEXT_GAP : pole - TEXT_GAP, align = side === "right" ? "start" : "end", rect = (y2, w, h) => ({ x: side === "right" ? x : x - w, y: y2, w, h }), ev = block.ev, out = [], y = top;
3219
+ let x = side === "right" ? pole + TEXT_GAP2 : pole - TEXT_GAP2, align = side === "right" ? "start" : "end", rect = (y2, w, h) => ({ x: side === "right" ? x : x - w, y: y2, w, h }), ev = block.ev, out = [], y = top;
2896
3220
  if (block.headerW > 0) {
2897
3221
  let header = headerRuns(ev).map((r) => r.text).join("");
2898
3222
  out.push({ id: `event:${ev.id}:header`, text: header, lines: [header], font: f.note, ink: { token: "inkMuted" }, x, align, rect: rect(y, block.headerW, f.noteLH), header: ev, ...ev.glyph ? { glyph: ev } : {} }), y += f.noteLH;
@@ -2905,7 +3229,7 @@ function valueAnnotationLabels(labels, annotations) {
2905
3229
  return (Array.isArray(annotations) ? annotations : []).flatMap((item, i) => (item?.kind === "callout" || item?.kind === "note") && `${item.text}${item.headline}`.includes("${value}") ? labels.filter((label) => label.kind === "annotation" && !label.hidden && label.owner.annotationId === defaultAnnotationId(item, i)).map((label) => [label, typeof item.at == "string" ? { categoryId: item.at } : item.at ?? {}]) : []);
2906
3230
  }
2907
3231
  function linkAnnotateEngine() {
2908
- publishDeferred("annotate", { runAnnotatePass, settleEventLane, emitEventLane, drawCagrArm, drawHorizontalLevelDiff, valueAnnotationLabels });
3232
+ publishDeferred("annotate", { runAnnotatePass, settleEventLane, emitEventLane, drawCagrArm, drawHorizontalLevelDiff, valueAnnotationLabels, corridorEdgeRects });
2909
3233
  }
2910
3234
  linkAnnotateEngine();
2911
3235