boardplot 0.61.0 → 0.62.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 (397) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +2 -2
  3. package/dist/{ReaderBox-75LYQMSA.js → ReaderBox-5QFALZHR.js} +5 -5
  4. package/dist/{annotateEngine-CL6ZSRGG.js → annotateEngine-ONWZYNEM.js} +1 -1
  5. package/dist/build-identity.json +3 -3
  6. package/dist/{chunk-CWP5ZYVQ.js → chunk-23YYVMWH.js} +1 -1
  7. package/dist/{chunk-MNPNLXSI.js → chunk-2MK5437T.js} +7 -7
  8. package/dist/{chunk-V3YQQDR4.js → chunk-2P5KBQLT.js} +4 -4
  9. package/dist/{chunk-WVYC6MR6.js → chunk-2VUEIEUO.js} +2 -2
  10. package/dist/{chunk-TASEX7VA.js → chunk-2YXO645A.js} +1 -1
  11. package/dist/{chunk-36KGPRMX.js → chunk-35JGEMCK.js} +35 -28
  12. package/dist/{chunk-VITZVVCD.js → chunk-3DXOZRRW.js} +3 -3
  13. package/dist/{chunk-RV6JDD6S.js → chunk-3H72EFNC.js} +4 -4
  14. package/dist/{chunk-RDJ3ZU6O.js → chunk-3KYSWAEH.js} +13 -8
  15. package/dist/{chunk-WQPMBAG2.js → chunk-3QJVBKRX.js} +37 -37
  16. package/dist/{chunk-T2DGSOAH.js → chunk-3YSLEJPV.js} +1 -1
  17. package/dist/{chunk-DBKMJWPO.js → chunk-3Z4I6LNK.js} +1 -1
  18. package/dist/{chunk-OYCEFOIW.js → chunk-476R7YF4.js} +16 -16
  19. package/dist/{chunk-P3CZFAFA.js → chunk-47IEMR6C.js} +22 -18
  20. package/dist/{chunk-757IKZZU.js → chunk-4HZKH4HS.js} +2 -2
  21. package/dist/{chunk-BKUTKQMT.js → chunk-4NGKSJBX.js} +72 -22
  22. package/dist/{chunk-ZT5Q6BRT.js → chunk-4SK4IGMK.js} +3 -3
  23. package/dist/{chunk-QK2OFTEB.js → chunk-4TTNLFTJ.js} +1 -1
  24. package/dist/{chunk-RD24ORGR.js → chunk-4XDWZJUX.js} +2 -1
  25. package/dist/{chunk-TS472T4D.js → chunk-5FG24HFB.js} +4 -4
  26. package/dist/{chunk-2X6672YL.js → chunk-5J2PQ5EZ.js} +4 -4
  27. package/dist/{chunk-IXCDKCYE.js → chunk-5LUHGXXE.js} +1 -1
  28. package/dist/{chunk-FYFXOLWI.js → chunk-5OUURZ2T.js} +70 -58
  29. package/dist/{chunk-OLEUVUH3.js → chunk-64D7CHCE.js} +4 -4
  30. package/dist/{chunk-WOTRCVA5.js → chunk-6LYMOF2S.js} +3 -3
  31. package/dist/{chunk-6R6LM337.js → chunk-6MXRNA4Z.js} +17 -17
  32. package/dist/{chunk-3GL23VOF.js → chunk-6OM5IYNK.js} +65 -10
  33. package/dist/{chunk-JTCXK7AG.js → chunk-6PR23T2O.js} +1 -1
  34. package/dist/{chunk-VGOZOBNB.js → chunk-6QQPQ2TX.js} +1 -1
  35. package/dist/{chunk-BQBD6Q5J.js → chunk-6RRK3VFP.js} +1 -1
  36. package/dist/{chunk-YM7MO7WI.js → chunk-6WEJGZVQ.js} +1 -1
  37. package/dist/{chunk-SJORKHHL.js → chunk-6XDX3MIU.js} +5 -5
  38. package/dist/{chunk-Y7O3T4DF.js → chunk-75OLP5KB.js} +32 -32
  39. package/dist/{chunk-UIHGGWES.js → chunk-77LQEREO.js} +1 -1
  40. package/dist/{chunk-PRVX4PAO.js → chunk-7JSGG67J.js} +1 -1
  41. package/dist/{chunk-57XHIICM.js → chunk-7NUNEVOU.js} +14 -9
  42. package/dist/{chunk-7ZPHJOG6.js → chunk-7OT6CVQT.js} +1 -1
  43. package/dist/{chunk-EU45YU5W.js → chunk-7R43Y35G.js} +1 -1
  44. package/dist/{chunk-HTLEHU5D.js → chunk-7RAF2HJA.js} +2 -2
  45. package/dist/{chunk-5JZQXMXU.js → chunk-7S57SH2K.js} +9 -9
  46. package/dist/{chunk-HS4DLZ6H.js → chunk-7ZYGEPY2.js} +52 -28
  47. package/dist/{chunk-2KGF6AIK.js → chunk-ABUJPENV.js} +53 -42
  48. package/dist/{chunk-EV3GY7Y3.js → chunk-ADVFTNDL.js} +4 -4
  49. package/dist/{chunk-NNOKYAFB.js → chunk-AFONROHX.js} +2 -2
  50. package/dist/{chunk-MYYDNK72.js → chunk-AO73FLJT.js} +4 -4
  51. package/dist/{chunk-L6OMA45Q.js → chunk-AU2TQN6F.js} +3 -3
  52. package/dist/{chunk-NJKUODK3.js → chunk-BFHAYXUU.js} +2 -2
  53. package/dist/{chunk-6U4J3T2G.js → chunk-BFJKH4AX.js} +1 -1
  54. package/dist/{chunk-3JG764MI.js → chunk-BHO5H4AF.js} +43 -15
  55. package/dist/{chunk-E7FWHKCI.js → chunk-BKZF27CE.js} +2 -2
  56. package/dist/{chunk-VFXGAEUO.js → chunk-BR2ADMLU.js} +1 -1
  57. package/dist/{chunk-OP7K5NSS.js → chunk-BZUHBKMK.js} +4 -4
  58. package/dist/{chunk-RTSSUQ25.js → chunk-C2X6NYMY.js} +1 -1
  59. package/dist/{chunk-R3IPQHWC.js → chunk-C3ULVZI7.js} +2 -2
  60. package/dist/{chunk-ESZIJ5Z6.js → chunk-CFT6W2QY.js} +3 -3
  61. package/dist/{chunk-2BF6HZV7.js → chunk-CPBJII5T.js} +5 -5
  62. package/dist/{chunk-B62SEOJC.js → chunk-CTRPRU4Y.js} +16 -13
  63. package/dist/{chunk-7D65YEEY.js → chunk-CWBM7MXM.js} +3 -3
  64. package/dist/{chunk-OIMT2SSN.js → chunk-CZZXZFYL.js} +2 -2
  65. package/dist/{chunk-7SSN5ECA.js → chunk-D2I2BUR6.js} +1 -1
  66. package/dist/{chunk-ASRICUAD.js → chunk-DCFK2BUL.js} +2 -2
  67. package/dist/{chunk-JXHTZVSV.js → chunk-DVQR5SFL.js} +2 -2
  68. package/dist/{chunk-6JOLPUTW.js → chunk-DWEVPNNE.js} +2 -2
  69. package/dist/{chunk-NCKINI7K.js → chunk-DYG4XMCC.js} +5 -5
  70. package/dist/{chunk-ZMZNMVPR.js → chunk-E46KFVP5.js} +11 -11
  71. package/dist/{chunk-DITI57ZB.js → chunk-EKKRDPVW.js} +1 -1
  72. package/dist/{chunk-PH274WAF.js → chunk-ELFF5YO7.js} +8 -8
  73. package/dist/{chunk-YO7LCXKN.js → chunk-EPRJX5BI.js} +2 -2
  74. package/dist/{chunk-OGD23BIK.js → chunk-EPS7N5ZS.js} +5 -2
  75. package/dist/{chunk-MM2ADIPB.js → chunk-ERIMFXE3.js} +1 -1
  76. package/dist/{chunk-IKTAVMF2.js → chunk-ESS7GAO5.js} +15 -15
  77. package/dist/{chunk-TIVUSWGT.js → chunk-EW77WN7V.js} +2 -2
  78. package/dist/{chunk-56PPEORW.js → chunk-F2IGRFYM.js} +23 -23
  79. package/dist/{chunk-XGJZRPHC.js → chunk-F7LDXGWD.js} +11 -11
  80. package/dist/{chunk-JZK6ZPUM.js → chunk-FC6H5ATA.js} +2 -2
  81. package/dist/{chunk-FTIQ6TI2.js → chunk-FI5VGWUQ.js} +2 -2
  82. package/dist/{chunk-YSKLERPF.js → chunk-FPF73SCJ.js} +18 -15
  83. package/dist/{chunk-JEAUVQTV.js → chunk-FSRAPSO7.js} +25 -25
  84. package/dist/{chunk-JLJ4QRAE.js → chunk-FXKGNJYB.js} +17 -17
  85. package/dist/{chunk-25JXYOSX.js → chunk-FXQH2QJN.js} +1 -1
  86. package/dist/{chunk-EL5E6O3K.js → chunk-GA7CIH6N.js} +23 -18
  87. package/dist/{chunk-KTFUYWN2.js → chunk-GCOFMXFJ.js} +5 -5
  88. package/dist/{chunk-OQKVFWAO.js → chunk-GGWYJNHH.js} +4 -4
  89. package/dist/{chunk-352V2W5P.js → chunk-GNSAYVND.js} +2 -2
  90. package/dist/{chunk-UFKLGMYZ.js → chunk-H7K3RXBQ.js} +1 -1
  91. package/dist/{chunk-EAMZDY55.js → chunk-HCAPGTEA.js} +1 -1
  92. package/dist/{chunk-2T22INLD.js → chunk-HUU76QHF.js} +1 -1
  93. package/dist/{chunk-CVUHCNQO.js → chunk-HV6OKHM6.js} +1 -1
  94. package/dist/{chunk-SSVOJXFR.js → chunk-HYBGISXA.js} +3 -3
  95. package/dist/{chunk-EWG3PCYJ.js → chunk-I37SEVQ4.js} +104 -68
  96. package/dist/{chunk-B76O5YXI.js → chunk-I3UJHKCS.js} +3 -3
  97. package/dist/{chunk-IIKM6NXU.js → chunk-I56NIVFF.js} +4 -4
  98. package/dist/{chunk-5DH5ACTO.js → chunk-IDMGFWB7.js} +132 -114
  99. package/dist/{chunk-YDYZWCUQ.js → chunk-IHZNRJEV.js} +1 -1
  100. package/dist/{chunk-RT4V47U6.js → chunk-IMKHDTEQ.js} +1 -1
  101. package/dist/{chunk-LEPXK7RN.js → chunk-ISNWAYX2.js} +3 -3
  102. package/dist/{chunk-G3CVCW5K.js → chunk-ITPXKZXT.js} +82 -79
  103. package/dist/{chunk-L5RZFP5B.js → chunk-J233F6JA.js} +3 -3
  104. package/dist/{chunk-EQDLZGZO.js → chunk-J6WWK4VC.js} +1 -1
  105. package/dist/{chunk-NJVXE2DU.js → chunk-J77EYTIA.js} +2 -2
  106. package/dist/{chunk-YZW4VLSO.js → chunk-JCZ64D4G.js} +4 -4
  107. package/dist/{chunk-VE6P436Y.js → chunk-JEC6YG2C.js} +34 -20
  108. package/dist/{chunk-GRMAYSIG.js → chunk-JV3S3OCN.js} +19 -18
  109. package/dist/{chunk-F2IHSUPI.js → chunk-K2ZDFPYP.js} +5 -5
  110. package/dist/{chunk-RXC3XU62.js → chunk-K3METEEY.js} +131 -30
  111. package/dist/{chunk-JLZFXNUE.js → chunk-K464WFSQ.js} +4 -4
  112. package/dist/{chunk-CYMSES53.js → chunk-KDRI3KHH.js} +7 -2
  113. package/dist/{chunk-QSMKLDAO.js → chunk-KK7UXU2E.js} +3 -3
  114. package/dist/{chunk-LLHCEZV2.js → chunk-KNTNUQNS.js} +8 -8
  115. package/dist/{chunk-QZAT46PP.js → chunk-KRSI6U6L.js} +1 -0
  116. package/dist/{chunk-T6XSXJDQ.js → chunk-KU5WGRQJ.js} +26 -26
  117. package/dist/{chunk-KY5MSTME.js → chunk-KWBG3P7W.js} +4 -4
  118. package/dist/{chunk-U2YWY6FH.js → chunk-KWKJYMXJ.js} +3 -3
  119. package/dist/{chunk-THKVAXTQ.js → chunk-KWTVCTWS.js} +246 -83
  120. package/dist/{chunk-7ZHM37LQ.js → chunk-KZ7ECRPL.js} +3 -3
  121. package/dist/{chunk-HUCUNGHB.js → chunk-L46NAICE.js} +5 -5
  122. package/dist/{chunk-64577PGJ.js → chunk-L4VGGSB3.js} +4 -4
  123. package/dist/{chunk-YXHSM7QL.js → chunk-L6T7FXEM.js} +6 -6
  124. package/dist/{chunk-XMI7SCPX.js → chunk-LE6QYQRU.js} +2 -2
  125. package/dist/{chunk-WDLWWEHZ.js → chunk-LIMLKOX7.js} +1 -1
  126. package/dist/{chunk-H5YDEIY2.js → chunk-LK5V7U6C.js} +5 -5
  127. package/dist/{chunk-533SNVDD.js → chunk-LNBYRD5Q.js} +4 -4
  128. package/dist/{chunk-USK77VAZ.js → chunk-LTEGXWSU.js} +4 -4
  129. package/dist/{chunk-TB734IYI.js → chunk-LUIHCUMB.js} +4 -4
  130. package/dist/{chunk-TL5ICZT2.js → chunk-MAA5IGGT.js} +2 -2
  131. package/dist/{chunk-MNVMTW7K.js → chunk-MDGVRYXX.js} +18 -18
  132. package/dist/{chunk-M2LYZUQA.js → chunk-MEIDC7ZF.js} +4 -4
  133. package/dist/{chunk-XTECBM5K.js → chunk-MTJZT6F2.js} +5 -5
  134. package/dist/{chunk-P3TOPI3M.js → chunk-MUYU6KTM.js} +1 -1
  135. package/dist/{chunk-F2WMTUWC.js → chunk-MVA2JWM4.js} +2 -2
  136. package/dist/{chunk-EIQTUVJT.js → chunk-MYDVNJAA.js} +1 -1
  137. package/dist/{chunk-I3GRAQHO.js → chunk-NFEVGJJ6.js} +13 -13
  138. package/dist/{chunk-JUTMQGKU.js → chunk-NFSG2WBI.js} +4 -4
  139. package/dist/{chunk-UERGJOG4.js → chunk-NFYF7P6H.js} +36 -28
  140. package/dist/{chunk-E6IN6QDF.js → chunk-NL2K3CZM.js} +5 -5
  141. package/dist/{chunk-VJAZFGBY.js → chunk-NTONEZH5.js} +20 -20
  142. package/dist/{chunk-QER2YJHC.js → chunk-NTSJ2RXB.js} +4 -4
  143. package/dist/{chunk-OIPBVU7G.js → chunk-NVPORMKX.js} +15 -15
  144. package/dist/{chunk-PGKGK43I.js → chunk-NXA2CNVU.js} +16 -10
  145. package/dist/{chunk-R2RLERPT.js → chunk-NYROTVGH.js} +1 -1
  146. package/dist/{chunk-IKH3DWS2.js → chunk-NZHIXLKM.js} +19 -17
  147. package/dist/{chunk-5ZGCGIHG.js → chunk-OCANU74G.js} +3 -3
  148. package/dist/{chunk-EM33NXGZ.js → chunk-OF4VHET3.js} +4 -4
  149. package/dist/{chunk-UXJXA4NP.js → chunk-OJLXBFI3.js} +1 -1
  150. package/dist/{chunk-BJ5GI5ZB.js → chunk-OLXZXEKQ.js} +1 -1
  151. package/dist/{chunk-FKRL2ZB2.js → chunk-OQGSYQLE.js} +1 -1
  152. package/dist/{chunk-A4UL5GIM.js → chunk-OQQGM2TM.js} +1 -1
  153. package/dist/{chunk-EOPDGMDS.js → chunk-OQRTTGYP.js} +22 -1
  154. package/dist/{chunk-35RSAHLK.js → chunk-OQTD4GN4.js} +1 -1
  155. package/dist/{chunk-UXAON5DO.js → chunk-OXWIBDJP.js} +2 -2
  156. package/dist/{chunk-F7QCIJAY.js → chunk-OYDZO5BR.js} +1 -1
  157. package/dist/{chunk-OR7KKODW.js → chunk-PDUF6EII.js} +9 -9
  158. package/dist/{chunk-XLP6U3FG.js → chunk-PHRQAWK4.js} +2 -2
  159. package/dist/{chunk-FY3VV7TF.js → chunk-PM5D5KYQ.js} +67 -30
  160. package/dist/{chunk-TI5PPS3L.js → chunk-Q5BD6PMX.js} +19 -19
  161. package/dist/{chunk-LMDU5MNF.js → chunk-QEEE2WH5.js} +4 -4
  162. package/dist/{chunk-OUSYBIGE.js → chunk-QMGCL5FR.js} +4 -4
  163. package/dist/{chunk-M4IIJ24E.js → chunk-QMZPQU65.js} +2 -2
  164. package/dist/{chunk-7VWXXBTC.js → chunk-QSNEZ4UR.js} +1 -1
  165. package/dist/{chunk-LT7IY2L3.js → chunk-QSWLPQCW.js} +27 -23
  166. package/dist/{chunk-FBUAKQAI.js → chunk-R55LS2W2.js} +24 -24
  167. package/dist/{chunk-TWMVAPG2.js → chunk-RDXJAEZ4.js} +4 -4
  168. package/dist/{chunk-VR3HLYAT.js → chunk-RDZNRSAB.js} +2 -2
  169. package/dist/{chunk-K2RZKPQ2.js → chunk-RFUSBITY.js} +1 -1
  170. package/dist/{chunk-NSQBT4CM.js → chunk-RIGQU57Y.js} +7 -7
  171. package/dist/{chunk-YBMYW7LD.js → chunk-RNA5GO3B.js} +2 -2
  172. package/dist/{chunk-LH5URXDJ.js → chunk-RODV3OHP.js} +294 -180
  173. package/dist/{chunk-EKYVRXTE.js → chunk-RPK657TE.js} +16 -2
  174. package/dist/{chunk-KJF7SLOA.js → chunk-SAVO62PW.js} +1 -1
  175. package/dist/{chunk-JE54IO26.js → chunk-SB2DHY53.js} +18 -18
  176. package/dist/{chunk-NHQKHMIS.js → chunk-SBHPRHKB.js} +4 -4
  177. package/dist/{chunk-JIVNJBXI.js → chunk-SBPFCQNK.js} +4 -4
  178. package/dist/{chunk-GSR6UO7H.js → chunk-SFPHP3CC.js} +2 -2
  179. package/dist/{chunk-GCZHZVNX.js → chunk-SIZW5V4G.js} +16 -12
  180. package/dist/{chunk-S7AHPU2N.js → chunk-SJ5KVLTG.js} +1 -1
  181. package/dist/{chunk-4ORV4RGE.js → chunk-SJZLWRRY.js} +8 -8
  182. package/dist/{chunk-RMBWY5JE.js → chunk-SOAB4G33.js} +4 -4
  183. package/dist/{chunk-LPLRXEOT.js → chunk-ST2IQX7U.js} +57 -17
  184. package/dist/{chunk-6U7VIQLV.js → chunk-T33R2CM3.js} +7 -7
  185. package/dist/{chunk-3553PK6F.js → chunk-T4ZE7AIX.js} +2 -2
  186. package/dist/{chunk-NWJ4DXAZ.js → chunk-TCQ733WC.js} +15 -15
  187. package/dist/{chunk-X4NDN6PQ.js → chunk-TGTKAIDU.js} +15 -10
  188. package/dist/{chunk-W2QJDTAR.js → chunk-U4PDXI67.js} +4 -4
  189. package/dist/{chunk-5EU5DLA3.js → chunk-UGTYYTPP.js} +2 -2
  190. package/dist/{chunk-PCHV6KYJ.js → chunk-UL3RNOYB.js} +3 -3
  191. package/dist/{chunk-6QUQEN75.js → chunk-UOTZH4TG.js} +2 -2
  192. package/dist/{chunk-LHQFDRQV.js → chunk-UQSH52UJ.js} +4 -4
  193. package/dist/{chunk-SGTSTGIP.js → chunk-UWT66OAR.js} +1 -1
  194. package/dist/{chunk-GNB4JQTB.js → chunk-V4NJTLJP.js} +12 -12
  195. package/dist/{chunk-SY7JC3PH.js → chunk-V4YJRZHE.js} +1 -1
  196. package/dist/{chunk-YUEJZBME.js → chunk-V5Y3CXSU.js} +4 -4
  197. package/dist/{chunk-H26UA4UM.js → chunk-VZFPQMYN.js} +9 -9
  198. package/dist/{chunk-ULXSTWJF.js → chunk-W35C2SL3.js} +2 -2
  199. package/dist/{chunk-TFYVBPGR.js → chunk-W6ZCXWOK.js} +1 -1
  200. package/dist/{chunk-P2QIWGFU.js → chunk-WDP7IDGF.js} +13 -13
  201. package/dist/{chunk-RZQU5DHD.js → chunk-WDQJ2DRZ.js} +14 -14
  202. package/dist/{chunk-DOVEWKJ6.js → chunk-WKBW4JFU.js} +1 -1
  203. package/dist/{chunk-OLAPTOUH.js → chunk-WM65Q3AL.js} +1 -1
  204. package/dist/{chunk-55BVHNZQ.js → chunk-WO6ZJCAO.js} +4 -4
  205. package/dist/chunk-WSRGEK5T.js +89 -0
  206. package/dist/{chunk-MBRVSKFJ.js → chunk-WXGBSBHQ.js} +13 -12
  207. package/dist/{chunk-7JM235F7.js → chunk-WXOSGKMS.js} +8 -8
  208. package/dist/{chunk-V4XTBNZD.js → chunk-XBASXPUJ.js} +2 -2
  209. package/dist/{chunk-BVE5LPOA.js → chunk-XDDFM3BH.js} +6 -6
  210. package/dist/{chunk-7WC2N4QZ.js → chunk-XJOCPL6R.js} +2 -2
  211. package/dist/{chunk-24O6BRKD.js → chunk-XJSI7ZO2.js} +1 -1
  212. package/dist/{chunk-4ZIFMZO4.js → chunk-XKGZWQF7.js} +3 -3
  213. package/dist/{chunk-WY7FHINS.js → chunk-XLHURGH3.js} +5 -5
  214. package/dist/{chunk-UGH3CLTZ.js → chunk-XWQDNJ36.js} +4 -4
  215. package/dist/{chunk-QJPI55S5.js → chunk-YBQ4F27M.js} +4 -4
  216. package/dist/{chunk-WK6LQCUT.js → chunk-YDT6QZZK.js} +9 -9
  217. package/dist/{chunk-YRWJBS6C.js → chunk-YE6B7P6Q.js} +1 -1
  218. package/dist/{chunk-WSHSR3B2.js → chunk-YERTQ576.js} +4 -4
  219. package/dist/{chunk-GEQSZ5RE.js → chunk-YF4DIQJR.js} +3 -3
  220. package/dist/{chunk-LFL4KMKF.js → chunk-YHLKL4R5.js} +3 -3
  221. package/dist/{chunk-I4A4MY3S.js → chunk-YHSY6CVM.js} +4 -4
  222. package/dist/{chunk-XC53YNZG.js → chunk-YJGZ3AOW.js} +2 -2
  223. package/dist/{chunk-F37PADCM.js → chunk-YKK25QM4.js} +4 -4
  224. package/dist/{chunk-YUJK6ZYO.js → chunk-YMBJHKTY.js} +2 -2
  225. package/dist/{chunk-EV7AATQM.js → chunk-YTFU2B5K.js} +2 -2
  226. package/dist/{chunk-GZ6MPJKY.js → chunk-YUIITZCO.js} +3 -3
  227. package/dist/{chunk-XHEG2BG6.js → chunk-Z3VCVPYX.js} +1 -1
  228. package/dist/{chunk-FNDDKZ4Z.js → chunk-ZB4WVG7Q.js} +1 -1
  229. package/dist/{chunk-JG35YUYX.js → chunk-ZCB5MLPW.js} +3 -3
  230. package/dist/{chunk-BF6KECQD.js → chunk-ZDQ2EWWH.js} +32 -28
  231. package/dist/{chunk-LL7ZU6BT.js → chunk-ZG46HLGN.js} +108 -81
  232. package/dist/chunk-ZGL2P56Z.js +11 -0
  233. package/dist/{chunk-WBIMWGV7.js → chunk-ZIAPNZ6R.js} +4 -4
  234. package/dist/{chunk-Z2WGJH2P.js → chunk-ZLIVUVIV.js} +28 -16
  235. package/dist/{chunk-32FGSRR3.js → chunk-ZMCTTTR2.js} +4 -4
  236. package/dist/{chunk-LTYDEWKW.js → chunk-ZYJZ624V.js} +5 -5
  237. package/dist/cli/index.js +2 -2
  238. package/dist/{core-NL6TMYOZ.js → core-2DRDBSL7.js} +2 -1
  239. package/dist/{core-CTI37JP5.js → core-2VAPYQDA.js} +2 -1
  240. package/dist/{core-XINQIYQ6.js → core-3JGHUUZZ.js} +2 -1
  241. package/dist/{core-LCX7EK3Y.js → core-3KMBTZ32.js} +2 -1
  242. package/dist/{core-EQP4ERQK.js → core-4HEB3CRT.js} +2 -1
  243. package/dist/{core-3H2PZVYN.js → core-4WT74WGL.js} +2 -1
  244. package/dist/{core-UPPUXBWO.js → core-4ZUNKYYC.js} +2 -1
  245. package/dist/{core-4SX63YE4.js → core-5VCTJDQM.js} +2 -1
  246. package/dist/{core-NPCHUGTV.js → core-AJANHLTB.js} +2 -1
  247. package/dist/{core-OO22DXBW.js → core-AL3TDBHQ.js} +5 -1
  248. package/dist/{core-76KPBWTL.js → core-ATBNPTR5.js} +2 -1
  249. package/dist/{core-QACGDEDF.js → core-BIEUVBZK.js} +2 -1
  250. package/dist/{core-RZ5ZDSQL.js → core-C2CCLPE5.js} +2 -1
  251. package/dist/{core-BEBRTX5W.js → core-C3VC6YEV.js} +2 -1
  252. package/dist/{core-LSN2YKO4.js → core-DCWAUTD4.js} +2 -1
  253. package/dist/{core-7LODBY2T.js → core-GYDBZC7Q.js} +2 -1
  254. package/dist/{core-SERUDXVA.js → core-H3RRJPQK.js} +2 -1
  255. package/dist/{core-GGKGWGHO.js → core-HAMHEP3M.js} +2 -1
  256. package/dist/{core-FZJOKAFE.js → core-HRBOWCHO.js} +2 -1
  257. package/dist/{core-ZYLCLTFQ.js → core-IHG5XK6Q.js} +2 -1
  258. package/dist/{core-2SCAWP7F.js → core-JNA7L23P.js} +2 -1
  259. package/dist/{core-UOATHRZG.js → core-JTHVZEC4.js} +2 -1
  260. package/dist/{core-2ZRSLX2J.js → core-JXCXTDYK.js} +2 -1
  261. package/dist/{core-DZVYQFBX.js → core-LL2O5PBD.js} +2 -1
  262. package/dist/{core-S56FGRAT.js → core-NNHCWP3B.js} +2 -1
  263. package/dist/{core-E6Q3H52Q.js → core-OM3DGO6B.js} +2 -1
  264. package/dist/{core-7PNZRGK7.js → core-QH3H6ZPI.js} +2 -1
  265. package/dist/{core-V55HGH7X.js → core-QKDNA6KJ.js} +2 -1
  266. package/dist/{core-2IWCOLCX.js → core-R6OE3ORL.js} +2 -1
  267. package/dist/{core-Y3WI32MB.js → core-RZI7LRK3.js} +2 -1
  268. package/dist/{core-J7ZHSASB.js → core-SXBMOZ3W.js} +2 -1
  269. package/dist/{core-W5WF7FHA.js → core-TXADFQ3I.js} +2 -1
  270. package/dist/{core-UYTRLCZY.js → core-UOB4JKCT.js} +2 -1
  271. package/dist/{core-7RSXZIVD.js → core-WIV43MFA.js} +2 -1
  272. package/dist/{core-B7TS5HK6.js → core-XDPELH2B.js} +2 -1
  273. package/dist/{core-DICZFWV4.js → core-YKHQUOAW.js} +2 -1
  274. package/dist/{core-ZFXHFRWI.js → core-ZXGKAECT.js} +2 -1
  275. package/dist/{dataTable-72HO6PCW.js → dataTable-JBVSQNJX.js} +3 -2
  276. package/dist/{engine-UCMXMWGA.js → engine-QUEIPS7M.js} +26 -13
  277. package/dist/fixtures.js +2 -1
  278. package/dist/fonts.js +4 -4
  279. package/dist/index.js +21 -20
  280. package/dist/{main-NS5NPNQ7.js → main-V264O3WR.js} +8 -7
  281. package/dist/mcp/server.js +14 -13
  282. package/dist/react/bar.js +3 -1
  283. package/dist/react/bartable.js +3 -1
  284. package/dist/react/box.js +3 -1
  285. package/dist/react/bullet.js +3 -1
  286. package/dist/react/butterfly.js +3 -1
  287. package/dist/react/choropleth.js +3 -1
  288. package/dist/react/cohort.js +3 -1
  289. package/dist/react/column.js +3 -1
  290. package/dist/react/combo.js +3 -1
  291. package/dist/react/creative.js +3 -1
  292. package/dist/react/diagram.js +3 -1
  293. package/dist/react/dimswitch.js +2 -1
  294. package/dist/react/dot.js +3 -1
  295. package/dist/react/export.js +19 -18
  296. package/dist/react/funnel.js +3 -1
  297. package/dist/react/gantt.js +3 -1
  298. package/dist/react/grid.js +5 -1
  299. package/dist/react/heatmap.js +3 -1
  300. package/dist/react/histogram.js +3 -1
  301. package/dist/react/index.js +86 -84
  302. package/dist/react/kpi.js +3 -1
  303. package/dist/react/likert.js +3 -1
  304. package/dist/react/line.js +3 -1
  305. package/dist/react/mekko.js +3 -1
  306. package/dist/react/pareto.js +3 -1
  307. package/dist/react/pie.js +3 -1
  308. package/dist/react/prepare.js +23 -21
  309. package/dist/react/pvm.js +3 -1
  310. package/dist/react/pyramid.js +3 -1
  311. package/dist/react/sankey.js +3 -1
  312. package/dist/react/scatter.js +3 -1
  313. package/dist/react/slope.js +3 -1
  314. package/dist/react/sparkline.js +3 -1
  315. package/dist/react/spec.js +12 -10
  316. package/dist/react/status.js +3 -1
  317. package/dist/react/story.js +4 -3
  318. package/dist/react/table.js +2 -1
  319. package/dist/react/theme.js +4 -3
  320. package/dist/react/tilemap.js +3 -1
  321. package/dist/react/treemap.js +3 -1
  322. package/dist/react/variance.js +3 -1
  323. package/dist/react/waffle.js +3 -1
  324. package/dist/react/waterfall.js +3 -1
  325. package/dist/{resvg-ZYEZTSUO.js → resvg-M5HJ3ME3.js} +1 -1
  326. package/dist/{rowsModule-QGCXTE6X.js → rowsModule-6UL4SSUC.js} +1 -1
  327. package/dist/{schema-CWOPBOK4.js → schema-3FSG2YXY.js} +1 -1
  328. package/dist/{schema-4SRLAXUP.js → schema-5PQPGEZQ.js} +1 -1
  329. package/dist/{schema-GAUZZRA4.js → schema-6LUORZNN.js} +1 -1
  330. package/dist/{schema-AGKSRVXN.js → schema-6MDHX2E7.js} +1 -1
  331. package/dist/{schema-UEZQN4WK.js → schema-7HXHGBUN.js} +1 -1
  332. package/dist/{schema-G6KGEQRD.js → schema-ACOD4XKI.js} +1 -1
  333. package/dist/{schema-C3PYINCY.js → schema-B3I7XBP3.js} +1 -1
  334. package/dist/{schema-MCA4J2BP.js → schema-CCOTGURZ.js} +1 -1
  335. package/dist/{schema-FSX7WR7M.js → schema-E5O7M5KM.js} +1 -1
  336. package/dist/{schema-RRZXOF5G.js → schema-EWATAK6Z.js} +1 -1
  337. package/dist/{schema-2BFNQ5GW.js → schema-FEBMLOZG.js} +1 -1
  338. package/dist/{schema-WWWWEQAR.js → schema-FL57LIU2.js} +1 -1
  339. package/dist/{schema-YUMFWHIE.js → schema-FTRAVEX3.js} +2 -1
  340. package/dist/{schema-E2WWDYU5.js → schema-GSKCG2WP.js} +1 -1
  341. package/dist/{schema-6WNG4LCV.js → schema-HVDY6QXK.js} +1 -1
  342. package/dist/{schema-3IXLM7X4.js → schema-I267TVQ4.js} +1 -1
  343. package/dist/{schema-6PLNMFVY.js → schema-IG2WGTQO.js} +1 -1
  344. package/dist/{schema-ZFUX3UIO.js → schema-ITZQDKSE.js} +1 -1
  345. package/dist/{schema-JKZBRZSI.js → schema-LCOGZNQF.js} +1 -1
  346. package/dist/{schema-7WNRP7FW.js → schema-MC3CQNPR.js} +1 -1
  347. package/dist/{schema-AMIFJ2JX.js → schema-MP2QNFCN.js} +1 -1
  348. package/dist/{schema-FOBGNU5I.js → schema-NYCMLGOW.js} +1 -1
  349. package/dist/{schema-ENLWEZOI.js → schema-OML7XS7J.js} +1 -1
  350. package/dist/{schema-7XQMEJII.js → schema-QAAVXXYR.js} +1 -1
  351. package/dist/{schema-XQSP5QAX.js → schema-QPYFXSEQ.js} +1 -1
  352. package/dist/{schema-JJIXQIBN.js → schema-RJBIXN5U.js} +1 -1
  353. package/dist/{schema-MM7JPYI7.js → schema-RW47HWVO.js} +1 -1
  354. package/dist/{schema-PVUWOLUB.js → schema-S7Q4YR7R.js} +1 -1
  355. package/dist/{schema-OIY565PO.js → schema-SWVWMZY3.js} +1 -1
  356. package/dist/{schema-EAYC5DVH.js → schema-T3RSFE2V.js} +1 -1
  357. package/dist/{schema-O5HGNE3W.js → schema-T4CGWZLB.js} +4 -2
  358. package/dist/{schema-2XGHH7PU.js → schema-TXYKZ5NT.js} +1 -1
  359. package/dist/{schema-ZBIIPJAI.js → schema-U6CZI6XG.js} +1 -1
  360. package/dist/{schema-BK2TU6XT.js → schema-XE4WY64H.js} +1 -1
  361. package/dist/{schema-ETH6WXZU.js → schema-YDWVXQPK.js} +1 -1
  362. package/dist/{schema-GQPXSWIR.js → schema-YPGXVI22.js} +1 -1
  363. package/dist/{schema-GFRB4BJW.js → schema-ZMOIP2BK.js} +1 -1
  364. package/dist/{specValidation-5AI56FM3.js → specValidation-6LVTTHZI.js} +2 -1
  365. package/dist/theme.js +3 -3
  366. package/dist/{themeShapeRules-GGBYWZY7.js → themeShapeRules-NDEXKFC7.js} +1 -1
  367. package/dist/types/core/charts/bar/layout.d.ts +1 -1
  368. package/dist/types/core/charts/column/model.d.ts +3 -1
  369. package/dist/types/core/charts/grid/metricStack.d.ts +35 -3
  370. package/dist/types/core/charts/grid/metricStackSchema.d.ts +8 -0
  371. package/dist/types/core/charts/grid/schema.d.ts +5 -0
  372. package/dist/types/core/charts/scatter/layout.d.ts +18 -1
  373. package/dist/types/core/charts/scatter/marks.d.ts +94 -0
  374. package/dist/types/core/charts/scatter/zones.d.ts +52 -0
  375. package/dist/types/core/fontMetrics/index.d.ts +3 -1
  376. package/dist/types/core/fontMetrics/injected.d.ts +1 -0
  377. package/dist/types/core/frame.d.ts +7 -2
  378. package/dist/types/core/label/occupied.d.ts +1 -1
  379. package/dist/types/core/registry.d.ts +2 -0
  380. package/dist/types/core/request.d.ts +7 -0
  381. package/dist/types/core/sizing.d.ts +9 -0
  382. package/dist/types/core/themeGeometry.d.ts +184 -0
  383. package/dist/types/core/types/options.d.ts +6 -0
  384. package/dist/types/core/types/scene.d.ts +11 -0
  385. package/dist/types/core/types/theme.d.ts +11 -0
  386. package/dist/types/react/hover/placement.d.ts +11 -0
  387. package/dist/types/react/prepare.d.ts +2 -1
  388. package/dist/types/react/useHover.d.ts +1 -0
  389. package/dist/validate.js +8 -6
  390. package/docs/manual.md +4 -2
  391. package/docs/reference/fixtures.md +3 -0
  392. package/docs/reference/grid.md +23 -10
  393. package/docs/reference/options.md +3 -0
  394. package/docs/reference/react.md +2 -0
  395. package/docs/reference/theme.md +4 -1
  396. package/package.json +1 -1
  397. package/dist/chunk-BOQQARLT.js +0 -89
@@ -18,29 +18,29 @@ import {
18
18
  quietLandPaint,
19
19
  renderGeoOverlays,
20
20
  reserveGeoOverlayGlyphs
21
- } from "./chunk-F2IHSUPI.js";
21
+ } from "./chunk-K2ZDFPYP.js";
22
22
  import {
23
23
  geoOptionRefusals
24
24
  } from "./chunk-V5IFI3FV.js";
25
25
  import {
26
26
  PLOT_W_FLOOR_DEMOTED
27
- } from "./chunk-PCHV6KYJ.js";
27
+ } from "./chunk-UL3RNOYB.js";
28
28
  import {
29
29
  prepareOutlineDistance
30
- } from "./chunk-24O6BRKD.js";
30
+ } from "./chunk-XJSI7ZO2.js";
31
31
  import {
32
32
  stepDownFont
33
- } from "./chunk-352V2W5P.js";
33
+ } from "./chunk-GNSAYVND.js";
34
34
  import {
35
35
  chartTheme
36
- } from "./chunk-YRWJBS6C.js";
36
+ } from "./chunk-YE6B7P6Q.js";
37
37
  import {
38
38
  fitsRoom,
39
39
  widthsThatFit
40
- } from "./chunk-RTSSUQ25.js";
40
+ } from "./chunk-C2X6NYMY.js";
41
41
  import {
42
42
  structureCount
43
- } from "./chunk-YDYZWCUQ.js";
43
+ } from "./chunk-IHZNRJEV.js";
44
44
  import {
45
45
  geoRegionIdIndex,
46
46
  nearestRegionId,
@@ -53,12 +53,15 @@ import {
53
53
  generatedIdWarnings
54
54
  } from "./chunk-SXAZDIGM.js";
55
55
  import {
56
+ MAP_WIDTH_BOUND,
56
57
  chartSizing,
57
58
  heightOmitted,
59
+ requestMemo,
58
60
  resolveSizing,
59
61
  rowDrivenHeight,
60
- tickFormatter
61
- } from "./chunk-FY3VV7TF.js";
62
+ tickFormatter,
63
+ withPlanInputs
64
+ } from "./chunk-PM5D5KYQ.js";
62
65
  import {
63
66
  PRIORITY,
64
67
  SIDE_KEY_PLOT_SHARE,
@@ -72,15 +75,15 @@ import {
72
75
  solveFrame,
73
76
  solveLabels,
74
77
  unitPrinted
75
- } from "./chunk-Z2WGJH2P.js";
78
+ } from "./chunk-ZLIVUVIV.js";
76
79
  import {
77
80
  disclosureNote
78
- } from "./chunk-B76O5YXI.js";
81
+ } from "./chunk-I3UJHKCS.js";
79
82
  import {
80
83
  defaultSetSpec,
81
84
  formatterFromExample,
82
85
  ruleFormatter
83
- } from "./chunk-3JG764MI.js";
86
+ } from "./chunk-BHO5H4AF.js";
84
87
  import {
85
88
  boxGap,
86
89
  canvasMargin,
@@ -97,7 +100,7 @@ import {
97
100
  round2,
98
101
  strokeToken,
99
102
  textScaleOf
100
- } from "./chunk-BKUTKQMT.js";
103
+ } from "./chunk-4NGKSJBX.js";
101
104
  import {
102
105
  NormalizeError,
103
106
  TARGET_SIZE,
@@ -105,11 +108,14 @@ import {
105
108
  resolveSize,
106
109
  resolveSubtitle
107
110
  } from "./chunk-RJICOOB3.js";
111
+ import {
112
+ hasCompleteTableWidths
113
+ } from "./chunk-3KYSWAEH.js";
108
114
  import {
109
115
  compareText,
110
116
  defaultMeasurer,
111
117
  wrapText
112
- } from "./chunk-UIHGGWES.js";
118
+ } from "./chunk-77LQEREO.js";
113
119
  import {
114
120
  maxOf,
115
121
  pushAll
@@ -194,11 +200,64 @@ function decodeGeoPack(pack) {
194
200
  })), decoded = { pack, regions, boundaries };
195
201
  return decodedPackCache.set(pack, decoded), decoded;
196
202
  }
197
- function fitDecodedGeoPack(decoded, frame, reuse) {
198
- let [minX, minY, maxX, maxY] = decoded.pack.bounds, sx = frame.w / (maxX - minX), sy = frame.h / (maxY - minY), scale = sx < sy ? sx : sy, offsetX = frame.x + (frame.w - (maxX - minX) * scale) / 2 - minX * scale, offsetY = frame.y + (frame.h - (maxY - minY) * scale) / 2 - minY * scale, points = reuse !== void 0 && reuse.pack === decoded.pack && reuse.scale === scale && reuse.offsetX === offsetX && reuse.offsetY === offsetY ? reuse : void 0, fitPoint = (point) => [
203
+ var extrema = /* @__PURE__ */ new WeakMap();
204
+ function geoPolygonExtrema(polygons) {
205
+ let cached = extrema.get(polygons);
206
+ if (cached) return cached;
207
+ let minX = 1 / 0, minY = 1 / 0, maxX = -1 / 0, maxY = -1 / 0, samples = [];
208
+ for (let polygon of polygons) for (let ring of polygon) for (let point of ring) {
209
+ let [x, y] = point;
210
+ samples.length || samples.push(point, point, point, point), x < minX && (samples[0] = point), x > maxX && (samples[1] = point), y < minY && (samples[2] = point), y > maxY && (samples[3] = point), minX = Math.min(minX, x), minY = Math.min(minY, y), maxX = Math.max(maxX, x), maxY = Math.max(maxY, y);
211
+ }
212
+ let result = { bounds: [minX, minY, maxX, maxY], samples };
213
+ return extrema.set(polygons, result), result;
214
+ }
215
+ var projectedKeys = /* @__PURE__ */ new WeakMap();
216
+ function projectedRegionKey(polygons) {
217
+ return projectedKeys.get(polygons) ?? polygons;
218
+ }
219
+ function outlineCache(decoded) {
220
+ return requestMemo(decoded, "geo:outlines", () => {
221
+ let points = 0;
222
+ for (let region of decoded.regions)
223
+ for (let polygon of region.polygons) for (let ring of polygon) points += ring.length;
224
+ for (let boundary of decoded.boundaries) for (let line of boundary.lines) points += line.length;
225
+ return { frames: [], keys: /* @__PURE__ */ new Map(), capacity: Math.max(1, Math.min(12, Math.floor(3e5 / Math.max(1, points)))) };
226
+ });
227
+ }
228
+ function projectOutlines(decoded, scale, offsetX, offsetY) {
229
+ let cache = outlineCache(decoded), frames = cache.frames;
230
+ for (let i = 0; i < frames.length; i++) {
231
+ let fit2 = frames[i];
232
+ if (fit2.scale === scale && fit2.offsetX === offsetX && fit2.offsetY === offsetY)
233
+ return i && (frames.splice(i, 1), frames.unshift(fit2)), fit2;
234
+ }
235
+ let fitPoint = (point) => [
199
236
  point[0] * scale + offsetX,
200
237
  point[1] * scale + offsetY
201
- ];
238
+ ], transform = [scale, offsetX, offsetY].map((n) => Object.is(n, -0) ? "-0" : String(n)).join(","), keys = cache.keys.get(transform);
239
+ keys || (keys = decoded.regions.map(() => ({})), cache.keys.size >= 4 * cache.capacity && cache.keys.delete(cache.keys.keys().next().value), cache.keys.set(transform, keys));
240
+ let regions = decoded.regions.map((region, index) => {
241
+ let projected = region.polygons.map((polygon) => polygon.map((ring) => ring.map(fitPoint)));
242
+ if (projectedKeys.set(projected, keys[index]), scale > 0 && Number.isFinite(scale) && Number.isFinite(offsetX) && Number.isFinite(offsetY)) {
243
+ let source = geoPolygonExtrema(region.polygons);
244
+ if (source.samples.length) {
245
+ let [minX, minY, maxX, maxY] = source.bounds;
246
+ extrema.set(projected, { bounds: [
247
+ minX * scale + offsetX,
248
+ minY * scale + offsetY,
249
+ maxX * scale + offsetX,
250
+ maxY * scale + offsetY
251
+ ], samples: source.samples.map(fitPoint) });
252
+ } else
253
+ extrema.set(projected, source);
254
+ }
255
+ return projected;
256
+ }), boundaries = decoded.boundaries.map((boundary) => boundary.lines.map((line) => line.map(fitPoint))), fit = { scale, offsetX, offsetY, regions, boundaries };
257
+ return frames.length === cache.capacity && frames.pop(), frames.unshift(fit), fit;
258
+ }
259
+ function fitGeoPack(pack, frame) {
260
+ let decoded = decodeGeoPack(pack), [minX, minY, maxX, maxY] = decoded.pack.bounds, sx = frame.w / (maxX - minX), sy = frame.h / (maxY - minY), scale = sx < sy ? sx : sy, offsetX = frame.x + (frame.w - (maxX - minX) * scale) / 2 - minX * scale, offsetY = frame.y + (frame.h - (maxY - minY) * scale) / 2 - minY * scale, points = projectOutlines(decoded, scale, offsetX, offsetY);
202
261
  return {
203
262
  pack: decoded.pack,
204
263
  frame,
@@ -208,7 +267,7 @@ function fitDecodedGeoPack(decoded, frame, reuse) {
208
267
  regions: decoded.regions.map((region, index) => ({
209
268
  id: region.id,
210
269
  aliases: region.aliases,
211
- polygons: points?.regions[index].polygons ?? region.polygons.map((polygon) => polygon.map((ring) => ring.map(fitPoint))),
270
+ polygons: points.regions[index],
212
271
  anchor: {
213
272
  ...region.anchor,
214
273
  x: region.anchor.x * scale + offsetX,
@@ -228,21 +287,21 @@ function fitDecodedGeoPack(decoded, frame, reuse) {
228
287
  boundaries: decoded.boundaries.map((boundary, index) => ({
229
288
  id: boundary.id,
230
289
  geometryClass: boundary.geometryClass,
231
- lines: points?.boundaries[index].lines ?? boundary.lines.map((line) => line.map(fitPoint))
290
+ lines: points.boundaries[index]
232
291
  }))
233
292
  };
234
293
  }
235
- var lastFit;
236
- function fitGeoPack(pack, frame) {
237
- return lastFit = fitDecodedGeoPack(decodeGeoPack(pack), frame, lastFit);
238
- }
239
294
 
240
295
  // src/core/charts/choropleth/smallMembers.ts
296
+ var ringAreas = /* @__PURE__ */ new WeakMap();
241
297
  function ringArea(ring) {
242
- return Math.abs(ring.reduce((sum, point, index) => {
298
+ let known = ringAreas.get(ring);
299
+ if (known !== void 0) return known;
300
+ let area = Math.abs(ring.reduce((sum, point, index) => {
243
301
  let next = ring[(index + 1) % ring.length];
244
302
  return sum + point[0] * next[1] - next[0] * point[1];
245
303
  }, 0)) / 2;
304
+ return ringAreas.set(ring, area), area;
246
305
  }
247
306
  function smallRegionIds(pack, eligible, explicit, options) {
248
307
  let threshold = options.smallRegionArea ?? (options.labels === "all" ? 0 : 1e-3);
@@ -260,6 +319,9 @@ function layoutMapKeys(input) {
260
319
  function mapKeysSize(input) {
261
320
  return mapKeys({ ...input, dryRun: !0 }).dry;
262
321
  }
322
+ function mapMemberColumnWidth(input) {
323
+ return mapKeysOnce({ ...input, dryRun: "memberColumn" }).dry.w;
324
+ }
263
325
  function mapKeys(input) {
264
326
  try {
265
327
  return mapKeysOnce(input);
@@ -290,7 +352,9 @@ function mapKeysOnce(input) {
290
352
  smallW: members.length ? Math.max(width(smallTitle, heading), columns * columnW - columnGap) : 0,
291
353
  smallH: members.length ? headerH + Math.min(rows2, members.length) * rowH : 0
292
354
  };
293
- }, columnRows = (keyH2) => Math.floor((plot.h - keyH2 - BLOCK_GAP - headerH) / rowH), oneColumnW = members.length ? Math.max(width(smallTitle, heading), columnW - columnGap) : 0, labelDrop = classes && !ranges ? TICK_BELOW + 3 : 3, fitKey = (keyW2) => {
355
+ }, columnRows = (keyH2) => Math.floor((plot.h - keyH2 - BLOCK_GAP - headerH) / rowH), oneColumnW = members.length ? Math.max(width(smallTitle, heading), columnW - columnGap) : 0;
356
+ if (input.dryRun === "memberColumn") return { dry: { w: oneColumnW, h: 0 } };
357
+ let labelDrop = classes && !ranges ? TICK_BELOW + 3 : 3, fitKey = (keyW2) => {
294
358
  let at2 = (value) => {
295
359
  if (!classes) return max === min ? 0 : (value - min) / (max - min) * keyW2;
296
360
  let index = Math.min(edges.length - 2, Math.max(0, edges.slice(1).filter((edge) => value >= edge).length)), span = edges[index + 1] - edges[index];
@@ -582,34 +646,33 @@ function valueTable(input) {
582
646
  }
583
647
 
584
648
  // src/core/charts/choropleth/outsideLabels.ts
649
+ var fittedGuards = /* @__PURE__ */ new WeakMap();
585
650
  function outsideLabelGuard(regions) {
651
+ let key = regions[0]?.polygons, previous = key && fittedGuards.get(key);
652
+ if (previous && previous.regions.length === regions.length && regions.every((region, i) => {
653
+ let old = previous.regions[i];
654
+ return old.id === region.id && old.polygons === region.polygons && Object.is(old.marker?.radius, region.marker?.radius) && Object.is(old.marker?.x ?? old.anchor.x, region.marker?.x ?? region.anchor.x) && Object.is(old.marker?.y ?? old.anchor.y, region.marker?.y ?? region.anchor.y);
655
+ })) return previous.guard;
656
+ let guard = makeGuard(regions);
657
+ return key && fittedGuards.set(key, { regions, guard }), guard;
658
+ }
659
+ function makeGuard(regions) {
586
660
  let boundsScale = 1, shapes = regions.map((region) => {
587
- let pointCount = 0, minX = 1 / 0, minY = 1 / 0, maxX = -1 / 0, maxY = -1 / 0, polygons = [], rings = [], samples = [];
588
- for (let polygon of region.polygons) {
589
- let fitted = [];
590
- for (let ring of polygon) {
591
- let points = [];
592
- for (let [x2, y2] of ring) {
593
- let point = { x: x2, y: y2 };
594
- pointCount === 0 && samples.push(point, point, point, point), x2 < minX && (samples[0] = point), x2 > maxX && (samples[1] = point), y2 < minY && (samples[2] = point), y2 > maxY && (samples[3] = point), pointCount++, minX = Math.min(minX, x2), minY = Math.min(minY, y2), maxX = Math.max(maxX, x2), maxY = Math.max(maxY, y2), points.push(point);
595
- }
596
- fitted.push(points), rings.push(points);
597
- }
598
- polygons.push(fitted);
599
- }
600
- let outlineDistance, marker = region.marker ?? { x: region.anchor.x, y: region.anchor.y, radius: 2.5 }, x = pointCount ? minX : marker.x - marker.radius, y = pointCount ? minY : marker.y - marker.radius, bounds = {
661
+ let polygons = region.polygons, { bounds: [minX, minY, maxX, maxY], samples } = geoPolygonExtrema(polygons), rings, outlineDistance, marker = region.marker ?? { x: region.anchor.x, y: region.anchor.y, radius: 2.5 }, x = samples.length ? minX : marker.x - marker.radius, y = samples.length ? minY : marker.y - marker.radius, bounds = {
601
662
  x,
602
663
  y,
603
- w: pointCount ? maxX - x : 2 * marker.radius,
604
- h: pointCount ? maxY - y : 2 * marker.radius
664
+ w: samples.length ? maxX - x : 2 * marker.radius,
665
+ h: samples.length ? maxY - y : 2 * marker.radius
605
666
  }, right = x + bounds.w, bottom = y + bounds.h;
606
667
  return boundsScale = Math.max(boundsScale, Math.abs(x), Math.abs(y), Math.abs(right), Math.abs(bottom), Math.abs(bounds.w), Math.abs(bounds.h)), {
607
668
  id: region.id,
608
669
  polygons,
609
- rings,
610
670
  samples,
671
+ get rings() {
672
+ return rings ??= polygons.flat();
673
+ },
611
674
  get outlineDistance() {
612
- return outlineDistance ??= prepareOutlineDistance(rings);
675
+ return outlineDistance ??= prepareOutlineDistance(this.rings.map((ring) => ring.map(([x2, y2]) => ({ x: x2, y: y2 }))));
613
676
  },
614
677
  marker,
615
678
  bounds,
@@ -631,8 +694,8 @@ function outsideLabelGuard(regions) {
631
694
  }, distance = (shape, rect, ownDistance) => shape.polygons.length ? contains(shape, { x: rect.x, y: rect.y }) ? 0 : shape.outlineDistance(rect, ownDistance) : Math.max(0, rectLineDistance(rect, [shape.marker]) - shape.marker.radius), upperDistance = (shape, rect) => {
632
695
  if (!shape.polygons.length) return distance(shape, rect);
633
696
  let best = 1 / 0, gapX = 1 / 0, gapY = 1 / 0;
634
- for (let point of shape.samples) {
635
- let dx = Math.max(rect.x - point.x, 0, point.x - rect.x - rect.w), dy = Math.max(rect.y - point.y, 0, point.y - rect.y - rect.h), squared = dx * dx + dy * dy;
697
+ for (let [x, y] of shape.samples) {
698
+ let dx = Math.max(rect.x - x, 0, x - rect.x - rect.w), dy = Math.max(rect.y - y, 0, y - rect.y - rect.h), squared = dx * dx + dy * dy;
636
699
  squared < best && (best = squared, gapX = dx, gapY = dy);
637
700
  }
638
701
  return Math.hypot(gapX, gapY);
@@ -640,9 +703,9 @@ function outsideLabelGuard(regions) {
640
703
  if (!shape.polygons.length) return rectLineDistance({ x: shape.marker.x, y: shape.marker.y, w: 0, h: 0 }, [from, to]) < shape.marker.radius;
641
704
  let dx = to.x - from.x, dy = to.y - from.y, cuts = [0, 1];
642
705
  for (let ring of shape.rings) for (let i = 1; i < ring.length; i++) {
643
- let a = ring[i - 1], b = ring[i], ex = b.x - a.x, ey = b.y - a.y, cross = dx * ey - dy * ex;
706
+ let a = ring[i - 1], b = ring[i], ex = b[0] - a[0], ey = b[1] - a[1], cross = dx * ey - dy * ex;
644
707
  if (cross === 0) continue;
645
- let t = ((a.x - from.x) * ey - (a.y - from.y) * ex) / cross, u = ((a.x - from.x) * dy - (a.y - from.y) * dx) / cross;
708
+ let t = ((a[0] - from.x) * ey - (a[1] - from.y) * ex) / cross, u = ((a[0] - from.x) * dy - (a[1] - from.y) * dx) / cross;
646
709
  t > 0 && t < 1 && u >= 0 && u <= 1 && cuts.push(t);
647
710
  }
648
711
  cuts.sort((a, b) => a - b);
@@ -693,14 +756,14 @@ function outsideLabelGuard(regions) {
693
756
  break;
694
757
  }
695
758
  }
696
- return own.queries.set(key, { x: rect.x, y: rect.y, w: rect.w, h: rect.h, fromX, fromY, toX, toY, fits }), fits;
759
+ return own.queries.size >= 256 && !own.queries.has(key) && own.queries.clear(), own.queries.set(key, { x: rect.x, y: rect.y, w: rect.w, h: rect.h, fromX, fromY, toX, toY, fits }), fits;
697
760
  };
698
761
  }
699
762
  function inRing(point, ring) {
700
763
  let inside = !1;
701
764
  for (let i = 0, j = ring.length - 1; i < ring.length; j = i++) {
702
765
  let a = ring[i], b = ring[j];
703
- a.y > point.y != b.y > point.y && point.x < a.x + (point.y - a.y) * (b.x - a.x) / (b.y - a.y) && (inside = !inside);
766
+ a[1] > point.y != b[1] > point.y && point.x < a[0] + (point.y - a[1]) * (b[0] - a[0]) / (b[1] - a[1]) && (inside = !inside);
704
767
  }
705
768
  return inside;
706
769
  }
@@ -732,6 +795,13 @@ function packWithRowNames(pack, overrides, index) {
732
795
  return renamedPacks.set(overrides, renamed), renamed;
733
796
  }
734
797
  function layoutChoropleth(data, options = {}) {
798
+ return withPlanInputs(() => {
799
+ let geometry = selectMapWidth(data, options);
800
+ return geometry.debug && (finishSelectedMap.get(geometry.debug)?.(), finishSelectedMap.delete(geometry.debug)), geometry;
801
+ });
802
+ }
803
+ var finishSelectedMap = /* @__PURE__ */ new WeakMap();
804
+ function selectMapWidth(data, options) {
735
805
  if (options.columnOverrides === void 0) return layoutMapPass(data, options);
736
806
  let pinned = options[TARGET_SIZE]?.fixed.height ?? !heightOmitted(options.size), drawn = widthsThatFit(options, (next) => layoutMapPass(data, next), pinned), { label, ...valueTrack } = options.columnOverrides.value ?? {};
737
807
  if (label === void 0 || fitsRoom(drawn, pinned)) return drawn;
@@ -890,7 +960,10 @@ function layoutMapPass(data, options, listed, pass = 0, passes = /* @__PURE__ */
890
960
  solveCtx,
891
961
  // One list title at every width, for small regions and dropped labels alike.
892
962
  smallTitle: chartString(options, "hiddenMapLabels")
893
- }, position = named ? legendOptions.position : "auto", widthFloor = PLOT_W_FLOOR_DEMOTED * size.width;
963
+ }, widthBound = options[MAP_WIDTH_BOUND];
964
+ if (widthBound?.width === size.width && !pinnedHeight && !data.overlays?.length && plot0.w >= 200 && (measure === defaultMeasurer || hasCompleteTableWidths(measure)) && (!named || legendOptions.position !== "left" && legendOptions.position !== "right") && mapMemberColumnWidth({ ...keyBase, smallIds: new Set(valuesById.keys()), plot: plot0, position: "top" }) <= plot0.w)
965
+ throw widthBound;
966
+ let position = named ? legendOptions.position : "auto", widthFloor = PLOT_W_FLOOR_DEMOTED * size.width;
894
967
  if (!named && !table && pinnedHeight && plot0.w >= WIDE_SLOT * plot0.h) try {
895
968
  let decide = { ...keyBase, smallIds: new Set([...baseSmallIds].filter((id) => valuesById.has(id))) }, mapWidthFor = (w, h) => Math.min(w - 2 * MAP_PAD, (Math.min(h, sideCapH) - 2 * yPad) / packAspect), rowH = mapKeysSize({ ...decide, position, plot: plot0 }).h, columnW = mapKeysSize({ ...decide, position: "right", plot: plot0 }).w;
896
969
  plot0.w - columnW - MAP_GAP >= widthFloor && mapWidthFor(plot0.w - columnW - MAP_GAP, plot0.h) > KEY_BESIDE_GAIN * mapWidthFor(plot0.w, plot0.h - rowH - MAP_GAP) && (position = "right");
@@ -990,18 +1063,49 @@ function layoutMapPass(data, options, listed, pass = 0, passes = /* @__PURE__ */
990
1063
  message: options.columnVisibility?.value === !1 ? "the lookup prints no values, so the map colours are the only print of them" : "a hidden lookup row leaves its map code without a name or a printed value",
991
1064
  suggest: "Keep the column or the rows, or name the regions in the text around the map."
992
1065
  });
993
- let valueDisplay = (text) => options.format !== void 0 ? { value: text, shows: { value: text } } : { value: text }, valueTexts = new Map(regionValues ? [...valuesById].flatMap(([id, value]) => value === null ? [] : [[id, fmt(value)]]) : []), plot = frameResult.plot, laneSpan = !tableDrawn && small.position !== "right" && small.position !== "left" && small.blocks.x + small.blocks.w <= plot.x + plot.w - LEADER_GUTTER ? { y: plot.y, h: mapArea.y + mapArea.h - plot.y } : { y: mapArea.y, h: mapArea.h }, keyArea = { x: small.blocks.x - MAP_GAP, y: small.blocks.y - MAP_GAP, w: small.blocks.w + 2 * MAP_GAP, h: small.blocks.h + 2 * MAP_GAP }, underKey = (candidate) => candidate.fitted.regions.some((region) => region.polygons.some((polygon) => polygon.some((ring) => ring.some(([x, y]) => pointInRect(x, y, keyArea)))) || region.marker !== void 0 && pointInRect(region.marker.x, region.marker.y, keyArea)), reserved = mapArea.y - plot.y, prepared;
994
- if (small.position === "top" && reserved > 0)
1066
+ let valueDisplay = (text) => options.format !== void 0 ? { value: text, shows: { value: text } } : { value: text }, valueTexts = new Map(regionValues ? [...valuesById].flatMap(([id, value]) => value === null ? [] : [[id, fmt(value)]]) : []), plot = frameResult.plot, laneSpan = !tableDrawn && small.position !== "right" && small.position !== "left" && small.blocks.x + small.blocks.w <= plot.x + plot.w - LEADER_GUTTER ? { y: plot.y, h: mapArea.y + mapArea.h - plot.y } : { y: mapArea.y, h: mapArea.h }, keyArea = { x: small.blocks.x - MAP_GAP, y: small.blocks.y - MAP_GAP, w: small.blocks.w + 2 * MAP_GAP, h: small.blocks.h + 2 * MAP_GAP }, padding = mapLabels.eligibleIds.size ? void 0 : compactPadding, prepare = (rect, fills2) => prepareMapLayout(
1067
+ pack,
1068
+ rect,
1069
+ laneSpan,
1070
+ occupied,
1071
+ valuesById,
1072
+ mapLabels,
1073
+ visibleMarkerIds,
1074
+ theme,
1075
+ measure,
1076
+ mapCtx,
1077
+ valueTexts,
1078
+ padding,
1079
+ withTable,
1080
+ fills2
1081
+ ), reserved = mapArea.y - plot.y, prepared;
1082
+ if (small.position === "top" && reserved > 0) {
1083
+ let gutters = possibleLeaderGutters(pack, mapArea.w, mapLabels.leaderIds, theme, measure, valueTexts), witness;
995
1084
  for (let share of [0, 0.25, 0.5, 0.75]) {
996
- let top = plot.y + share * reserved, rect = { ...mapArea, y: top, h: mapArea.y + mapArea.h - top }, padding = mapLabels.eligibleIds.size ? void 0 : compactPadding;
997
- if (certainlyUnderKey(pack, rect, padding, keyArea, measure, theme)) continue;
998
- let candidate = prepareMapLayout(pack, rect, laneSpan, occupied, valuesById, mapLabels, visibleMarkerIds, theme, measure, mapCtx, valueTexts, padding, withTable);
999
- if (!underKey(candidate)) {
1085
+ let top = plot.y + share * reserved, rect = { ...mapArea, y: top, h: mapArea.y + mapArea.h - top }, overlap = /* @__PURE__ */ new Map(), underKey = (gutter) => {
1086
+ let hit = overlap.get(gutter);
1087
+ if (hit === void 0) {
1088
+ let point = pointUnderKey(pack, rect, padding, keyArea, gutter, witness);
1089
+ hit = point !== void 0, point && (witness = point), overlap.set(gutter, hit);
1090
+ }
1091
+ return hit;
1092
+ };
1093
+ if (gutters?.every(underKey)) continue;
1094
+ let trial = prepare(rect);
1095
+ if (gutters) {
1096
+ if (underKey(trial.gutter)) continue;
1097
+ prepared = trial.draw();
1098
+ } else {
1099
+ let candidate = trial.draw();
1100
+ if (candidate.fitted.regions.some((region) => region.polygons.some((polygon) => polygon.some((ring) => ring.some(([x, y]) => pointInRect(x, y, keyArea)))) || region.marker !== void 0 && pointInRect(region.marker.x, region.marker.y, keyArea))) continue;
1000
1101
  prepared = candidate;
1001
- break;
1002
1102
  }
1103
+ break;
1003
1104
  }
1004
- let { labelLayout, mapFrame, fitted, leaderLanes, outsideFits } = prepared ?? prepareMapLayout(pack, mapArea, laneSpan, occupied, valuesById, mapLabels, visibleMarkerIds, theme, measure, mapCtx, valueTexts, mapLabels.eligibleIds.size ? void 0 : compactPadding, withTable), grow = rowDrivenHeight({ options, width: size.width, height: size.height, chromeH: 0, rowsH: naturalHeight });
1105
+ }
1106
+ let fills = !prepared && !overlays.length && !statesById.size && mapLabels.eligibleIds.size && (measure === defaultMeasurer || hasCompleteTableWidths(measure)) && pack.regions.every((region) => region.polygons.length && valuesById.get(region.id) != null) ? new Map(pack.regions.map((region) => [region.id, scale.paint(valuesById.get(region.id))])) : void 0, { labelLayout, mapFrame, fitted, leaderLanes, outsideFits, drawnLabels } = prepared ?? prepare(mapArea, fills).draw();
1107
+ drawnLabels && (occupied = drawnLabels.occupied);
1108
+ let grow = rowDrivenHeight({ options, width: size.width, height: size.height, chromeH: 0, rowsH: naturalHeight });
1005
1109
  if (grow !== void 0) return layoutMapPass(data, { ...options, size: { width: size.width, height: grow } }, listed, pass, passes, omittedOverlays);
1006
1110
  let glyphDiscs = [], nextOmitted = new Set(omittedOverlays), heightReady = options[TARGET_SIZE]?.fixed.height !== !1 || size.height >= naturalHeight - 2;
1007
1111
  if (overlays.forEach((overlay, index) => {
@@ -1017,7 +1121,7 @@ function layoutMapPass(data, options, listed, pass = 0, passes = /* @__PURE__ */
1017
1121
  undrawnUnlisted += 1;
1018
1122
  continue;
1019
1123
  }
1020
- let d, fill = state ? { token: "inkMuted" } : noData ? { token: "background" } : unlisted ? landPaint : scale.paint(value);
1124
+ let d, fill = state ? { token: "inkMuted" } : noData ? { token: "background" } : unlisted ? landPaint : fills?.get(region.id) ?? scale.paint(value);
1021
1125
  (unlisted ? landNodes : nodes).push({
1022
1126
  t: "path",
1023
1127
  id: pathNodeId,
@@ -1039,7 +1143,7 @@ function layoutMapPass(data, options, listed, pass = 0, passes = /* @__PURE__ */
1039
1143
  part: "region",
1040
1144
  ...state ? { pattern: geoStatePattern(state) } : {},
1041
1145
  display: state ? { state: geoStateLabel(state, options) } : unlisted ? { state: chartString(options, "notInData") } : noData ? { state: chartString(options, "valueMissing") } : valueDisplay(fmt(value))
1042
- }), regionVisible && claimRegionMark(region, occupied);
1146
+ }), !drawnLabels && regionVisible && claimRegionMark(region, occupied);
1043
1147
  let hatchNodeId;
1044
1148
  if (noData) {
1045
1149
  let segments = regionVisible ? hatchSegments(region, regionStroke) : [];
@@ -1062,7 +1166,7 @@ function layoutMapPass(data, options, listed, pass = 0, passes = /* @__PURE__ */
1062
1166
  value,
1063
1167
  state: state ?? (unlisted ? "not-in-data" : noData ? "no-data" : "value"),
1064
1168
  fill
1065
- }), mapLabels.eligibleIds.has(region.id) && labelPlans.push(labelPlanForRegion(
1169
+ }), !drawnLabels && mapLabels.eligibleIds.has(region.id) && labelPlans.push(labelPlanForRegion(
1066
1170
  region,
1067
1171
  leaderLanes.get(region.id),
1068
1172
  theme,
@@ -1090,7 +1194,7 @@ function layoutMapPass(data, options, listed, pass = 0, passes = /* @__PURE__ */
1090
1194
  dash: dashToken(theme, "reference"),
1091
1195
  owner: {},
1092
1196
  part: "disputedBoundary"
1093
- }), claimBoundaryMark(boundary, occupied), marks.boundaries.push({
1197
+ }), drawnLabels || claimBoundaryMark(boundary, occupied), marks.boundaries.push({
1094
1198
  id: boundary.id,
1095
1199
  pathNodeId,
1096
1200
  geometryClass: boundary.geometryClass,
@@ -1098,12 +1202,12 @@ function layoutMapPass(data, options, listed, pass = 0, passes = /* @__PURE__ */
1098
1202
  dash: dashToken(theme, "reference")
1099
1203
  });
1100
1204
  }
1101
- claimLeaderAnchors(fitted.regions, labelLayout.leaderIds, occupied), reserveGeoOverlayGlyphs(
1205
+ drawnLabels || claimLeaderAnchors(fitted.regions, labelLayout.leaderIds, occupied), reserveGeoOverlayGlyphs(
1102
1206
  overlays,
1103
1207
  (overlay, index) => resolveChoroplethOverlayAnchor(overlay, index, fitted, idIndex, pack),
1104
1208
  occupied
1105
1209
  );
1106
- let solved = solveRegionLabels(labelPlans, occupied, mapCtx, outsideFits);
1210
+ let solved = drawnLabels?.solved ?? solveRegionLabels(labelPlans, occupied, mapCtx, outsideFits);
1107
1211
  if (tableDrawn) for (let label of solved.placed) {
1108
1212
  let id = label.owner.categoryId;
1109
1213
  label.hidden && ["code", "value"].every((part) => tableDrawn.placed.some(
@@ -1111,9 +1215,6 @@ function layoutMapPass(data, options, listed, pass = 0, passes = /* @__PURE__ */
1111
1215
  )) && (label.hidden = "redundant");
1112
1216
  }
1113
1217
  let movable = (label) => !table && pass < LISTED_PASSES && label.owner.categoryId !== void 0 && !smallIds.has(label.owner.categoryId), lost = solved.placed.filter((label) => movable(label) && label.hidden).map((label) => label.owner.categoryId), far = solved.placed.filter((label) => movable(label) && !label.hidden && label.leader !== void 0 && pathLength(label.leader.d) > Math.max(LISTED_LEADER_FRACTION * mapFrame.w, CALLOUT_MAX_LEADER)).map((label) => label.owner.categoryId);
1114
- pushAll(nodes, small.nodes), pushAll(nodes, tableDrawn?.nodes ?? []);
1115
- for (let node of labelsToNodes(theme, solved.placed, (label) => solved.fontByLabel.get(label.id)))
1116
- node.t === "path" && node.part === "leader" && (nodes.push({ ...node, id: `${node.id}:casing`, stroke: { token: "background" }, width: strokeToken(theme, "rule") + 2 * strokeToken(theme, "hair"), part: "leaderCasing" }), node.stroke = { token: "ink" }), nodes.push(node);
1117
1218
  pushAll(warnings, solved.warnings), pushAll(warnings, tableDrawn?.warnings ?? []);
1118
1219
  let overlayResult = renderGeoOverlays({
1119
1220
  options,
@@ -1134,7 +1235,7 @@ function layoutMapPass(data, options, listed, pass = 0, passes = /* @__PURE__ */
1134
1235
  measure,
1135
1236
  ignoredBaseParts: /* @__PURE__ */ new Set(["region", "noDataHatch"])
1136
1237
  });
1137
- pushAll(nodes, overlayResult.nodes), pushAll(warnings, overlayResult.warnings), overlayResult.marks.length && (marks.overlays = overlayResult.marks);
1238
+ pushAll(warnings, overlayResult.warnings), overlayResult.marks.length && (marks.overlays = overlayResult.marks);
1138
1239
  let noDataCount = marks.regions.filter((mark) => mark.value === null).length + undrawnUnlisted, missingCount = marks.regions.filter((mark) => mark.state === "no-data").length, drawnUnlistedCount = marks.regions.filter((mark) => mark.state === "not-in-data").length, unlistedCount = drawnUnlistedCount + undrawnUnlisted, geometry = {
1139
1240
  type: "choropleth",
1140
1241
  size,
@@ -1188,13 +1289,17 @@ function layoutMapPass(data, options, listed, pass = 0, passes = /* @__PURE__ */
1188
1289
  },
1189
1290
  warnings,
1190
1291
  debug: {
1191
- occupied: visibleOccupiedSnapshot(
1192
- occupied.snapshot(),
1193
- [...solved.placed, ...small.placed, ...tableDrawn?.placed ?? [], ...overlayResult.labels]
1194
- ),
1292
+ occupied: [],
1195
1293
  decisions: [...solved.decisions, ...small.decisions, ...tableDrawn?.decisions ?? [], ...overlayResult.decisions]
1196
1294
  }
1197
- }, hidden = (result) => result.labels.filter((label) => label.hidden).length;
1295
+ }, debug = geometry.debug;
1296
+ finishSelectedMap.set(debug, () => {
1297
+ pushAll(nodes, small.nodes), pushAll(nodes, tableDrawn?.nodes ?? []);
1298
+ for (let node of labelsToNodes(theme, solved.placed, (label) => solved.fontByLabel.get(label.id)))
1299
+ node.t === "path" && node.part === "leader" && (nodes.push({ ...node, id: `${node.id}:casing`, stroke: { token: "background" }, width: strokeToken(theme, "rule") + 2 * strokeToken(theme, "hair"), part: "leaderCasing" }), node.stroke = { token: "ink" }), nodes.push(node);
1300
+ pushAll(nodes, overlayResult.nodes), debug.occupied = visibleOccupiedSnapshot(occupied.snapshot(), geometry.labels);
1301
+ });
1302
+ let hidden = (result) => result.labels.filter((label) => label.hidden).length;
1198
1303
  if ((geometry.sizing?.minHeight ?? 0) > size.height + 1) return geometry;
1199
1304
  for (let move of [[...lost, ...far], lost, lost.length ? [...labelPolicy.eligibleIds] : []]) {
1200
1305
  if (!move.length) continue;
@@ -1208,12 +1313,12 @@ function layoutMapPass(data, options, listed, pass = 0, passes = /* @__PURE__ */
1208
1313
  }
1209
1314
  return geometry;
1210
1315
  }
1211
- function prepareMapLayout(pack, plot, laneSpan, occupied, valuesById, labelPolicy, visibleMarkerIds, theme, measure, solveCtx, valueTexts, padding, withTable) {
1316
+ function prepareMapLayout(pack, plot, laneSpan, occupied, valuesById, labelPolicy, visibleMarkerIds, theme, measure, solveCtx, valueTexts, padding, withTable, fills) {
1212
1317
  let fits = /* @__PURE__ */ new Map(), fitMap = (frame) => {
1213
1318
  let key = `${frame.x},${frame.y},${frame.w},${frame.h}`, prepared = fits.get(key);
1214
1319
  if (!prepared) {
1215
- let fitted2 = fitGeoPack(pack, frame), guard;
1216
- prepared = { fitted: fitted2, outsideFits: (id, rect, from, to) => (guard ??= outsideLabelGuard(fitted2.regions.filter((region) => region.polygons.length > 0 || visibleMarkerIds.has(region.id))))(id, rect, from, to) }, fits.set(key, prepared);
1320
+ let fitted = fitGeoPack(pack, frame), guard;
1321
+ prepared = { fitted, outsideFits: (id, rect, from, to) => (guard ??= outsideLabelGuard(fitted.regions.filter((region) => region.polygons.length > 0 || visibleMarkerIds.has(region.id))))(id, rect, from, to) }, fits.set(key, prepared);
1217
1322
  }
1218
1323
  return prepared;
1219
1324
  }, labelLayout = labelPolicy.eligibleIds.size > 0 ? resolveRegionLabelLayout(
@@ -1231,16 +1336,21 @@ function prepareMapLayout(pack, plot, laneSpan, occupied, valuesById, labelPolic
1231
1336
  solveCtx,
1232
1337
  valueTexts,
1233
1338
  fitMap,
1234
- withTable
1235
- ) : { gutter: 0, leaderIds: /* @__PURE__ */ new Set() }, mapFrame = choroplethMapFrame(plot, labelLayout.gutter, pack.id, padding), mapFit = fitMap(mapFrame), { fitted, outsideFits } = mapFit, leaderLanes = buildLeaderLanes(
1236
- mapFit,
1237
- labelLayout.leaderIds,
1238
- { ...plot, ...laneSpan },
1239
- theme,
1240
- measure,
1241
- valueTexts
1242
- );
1243
- return { labelLayout, mapFrame, fitted, leaderLanes, outsideFits };
1339
+ withTable,
1340
+ fills
1341
+ ) : { gutter: 0, leaderIds: /* @__PURE__ */ new Set() };
1342
+ function draw() {
1343
+ let mapFrame = choroplethMapFrame(plot, labelLayout.gutter, pack.id, padding), mapFit = fitMap(mapFrame), { fitted, outsideFits } = mapFit, leaderLanes = buildLeaderLanes(
1344
+ mapFit,
1345
+ labelLayout.leaderIds,
1346
+ { ...plot, ...laneSpan },
1347
+ theme,
1348
+ measure,
1349
+ valueTexts
1350
+ );
1351
+ return { labelLayout, mapFrame, fitted, leaderLanes, outsideFits, drawnLabels: mapFit.drawnLabels };
1352
+ }
1353
+ return { gutter: labelLayout.gutter, draw };
1244
1354
  }
1245
1355
  function resolveChoroplethOverlayAnchor(overlay, index, fitted, idIndex, pack) {
1246
1356
  if ("lon" in overlay.at) {
@@ -1295,7 +1405,9 @@ function solveRegionLabels(plans, occupied, ctx, outsideFits, reads) {
1295
1405
  decisions: [],
1296
1406
  warnings: [],
1297
1407
  fontByLabel: /* @__PURE__ */ new Map()
1298
- }, solveCtx = { ...ctx, pins: {} }, unresolved = [];
1408
+ }, record = reads ? (result2, next) => {
1409
+ next.placed[0] && result2.placed.push(next.placed[0]);
1410
+ } : appendRegionSolve, solveCtx = { ...ctx, pins: {} }, unresolved = [];
1299
1411
  for (let plan of ordered) {
1300
1412
  let requestedPin = pinOf(plan);
1301
1413
  if (requestedPin) {
@@ -1308,7 +1420,7 @@ function solveRegionLabels(plans, occupied, ctx, outsideFits, reads) {
1308
1420
  backed ? withoutRegionMarks(occupied) : occupied,
1309
1421
  backed ? { ...solveCtx, labelPad: 4 } : solveCtx
1310
1422
  );
1311
- appendRegionSolve(result, pinned, pinnedVariant.font, plan), claimLabelBacking(pinned.placed[0], occupied), claimSolvedLeader(pinned.placed[0], plan.region, occupied);
1423
+ record(result, pinned, pinnedVariant.font, plan), claimLabelBacking(pinned.placed[0], occupied), claimSolvedLeader(pinned.placed[0], plan.region, occupied);
1312
1424
  continue;
1313
1425
  }
1314
1426
  result.warnings.push({
@@ -1327,7 +1439,7 @@ function solveRegionLabels(plans, occupied, ctx, outsideFits, reads) {
1327
1439
  backed ? { ...solveCtx, labelPad: 4 } : solveCtx
1328
1440
  );
1329
1441
  if (fallback = next, tried.push(...next.decisions[0]?.tried ?? []), !next.placed[0]?.hidden) {
1330
- appendRegionSolve(result, next, variant.font, plan, tried), claimLabelBacking(next.placed[0], occupied), placed = !0;
1442
+ record(result, next, variant.font, plan, tried), claimLabelBacking(next.placed[0], occupied), placed = !0;
1331
1443
  break;
1332
1444
  }
1333
1445
  }
@@ -1355,8 +1467,9 @@ function solveRegionLabels(plans, occupied, ctx, outsideFits, reads) {
1355
1467
  let inlineCount = result.placed.length, calloutLabels = () => {
1356
1468
  if (!labelOccupied) {
1357
1469
  labelOccupied = createOccupiedIndex(ctx.canvas ?? ctx.plot);
1358
- let claims = calloutPass && result.placed.length === inlineCount ? calloutPass.claims : occupied.snapshot();
1359
- for (let claim of claims) (claim.kind === "label" || claim.part === "regionLeader") && labelOccupied.claim(claim.rect, claim.kind, claim.owner, claim.part, claim.polygon);
1470
+ let isLabelOrLeader = (claim) => claim.kind === "label" || claim.part === "regionLeader", claims = calloutPass && result.placed.length === inlineCount ? calloutPass.claims.filter(isLabelOrLeader) : occupied.snapshot(isLabelOrLeader);
1471
+ for (let claim of claims)
1472
+ labelOccupied.claim(claim.rect, claim.kind, claim.owner, claim.part, claim.polygon);
1360
1473
  }
1361
1474
  return labelOccupied;
1362
1475
  }, solvedLeaders = [];
@@ -1380,7 +1493,7 @@ function solveRegionLabels(plans, occupied, ctx, outsideFits, reads) {
1380
1493
  if (calloutPass?.calls.push({ id: item.plan.region.id, text: callout.request.text, font: { ...callout.font }, candidates, hatchBlocked: search.hatchBlocked }), candidates.length > 0) {
1381
1494
  let next2 = solveLabels([{ ...callout.request, candidates }], occupied, solveCtx), placed2 = next2.placed[0];
1382
1495
  if (item.tried.push(...next2.decisions[0]?.tried ?? []), placed2 && !placed2.hidden) {
1383
- appendRegionSolve(result, next2, callout.font, item.plan, item.tried);
1496
+ record(result, next2, callout.font, item.plan, item.tried);
1384
1497
  let from = [item.plan.region.anchor.x, item.plan.region.anchor.y], to = calloutTerminus(from, placed2.rect);
1385
1498
  placed2.leader = { d: polylinePath([from, to]), curved: !1 }, claimLeaderRoute([from, to], occupied, item.plan.region.id);
1386
1499
  continue;
@@ -1389,15 +1502,15 @@ function solveRegionLabels(plans, occupied, ctx, outsideFits, reads) {
1389
1502
  }
1390
1503
  let leaderVariant = item.plan.variants.find((variant) => variant.leader);
1391
1504
  if (!leaderVariant) {
1392
- appendRegionSolve(result, item.fallback, item.plan.variants.at(-1).font, item.plan, item.tried);
1505
+ record(result, item.fallback, item.plan.variants.at(-1).font, item.plan, item.tried);
1393
1506
  continue;
1394
1507
  }
1395
1508
  let next = solveLabels([leaderVariant.request], occupied, solveCtx), tried = [...item.tried, ...next.decisions[0]?.tried ?? []];
1396
- appendRegionSolve(result, next, leaderVariant.font, item.plan, tried);
1509
+ record(result, next, leaderVariant.font, item.plan, tried);
1397
1510
  let placed = next.placed[0];
1398
1511
  placed && !placed.hidden && placed.leader && (claimLabelBacking(placed, occupied), solvedLeaders.push({ placed, region: item.plan.region }));
1399
1512
  }
1400
- return calloutPass && calloutPasses.set(outsideFits, calloutPass), routeAndClaimLeaders(solvedLeaders, result.placed, ctx.plot, occupied, outsideFits), result;
1513
+ return calloutPass && calloutPasses.set(outsideFits, calloutPass), reads || routeAndClaimLeaders(solvedLeaders, result.placed, ctx.plot, occupied, outsideFits), result;
1401
1514
  }
1402
1515
  function withoutRegionMarks(occupied) {
1403
1516
  let regionMark = (claim) => claim.kind === "mark" && (claim.part === "region" || claim.part === "noDataHatch");
@@ -1598,14 +1711,49 @@ function resolveRegionLabelPolicy(pack, valuesById, explicitIds, option, request
1598
1711
  topN
1599
1712
  };
1600
1713
  }
1601
- function resolveRegionLabelLayout(pack, plot, lanePlot, frameClaims, valuesById, labelIds, leaderEligibleIds, inlineMarkerIds, visibleMarkerIds, theme, measure, solveCtx, valueTexts, fitMap, withTable) {
1714
+ var leaderLayouts = /* @__PURE__ */ new WeakMap();
1715
+ function leaderLayoutCache(pack, measure) {
1716
+ let geometry = requestMemo(pack, "choropleth:leader-geometry", () => JSON.stringify([
1717
+ pack.id,
1718
+ pack.bounds,
1719
+ pack.regions.map((r) => [r.id, r.microState, !r.polygons.length, !!r.marker]),
1720
+ decodeGeoPack(pack).regions.map((r) => [r.id, r.microState, r.anchor, r.marker])
1721
+ ])), entry = leaderLayouts.get(pack);
1722
+ entry?.geometry !== geometry && leaderLayouts.set(pack, entry = { geometry, byMeasure: /* @__PURE__ */ new WeakMap() });
1723
+ let layouts = entry.byMeasure.get(measure);
1724
+ return layouts || entry.byMeasure.set(measure, layouts = /* @__PURE__ */ new Map()), layouts;
1725
+ }
1726
+ function resolveRegionLabelLayout(pack, plot, lanePlot, frameClaims, valuesById, labelIds, leaderEligibleIds, inlineMarkerIds, visibleMarkerIds, theme, measure, solveCtx, valueTexts, fitMap, withTable, fills) {
1602
1727
  let gutter = 0, leaderIds = new Set(
1603
1728
  pack.regions.filter(
1604
1729
  (region) => region.marker && region.polygons.length === 0 && leaderEligibleIds.has(region.id) && (pack.id !== "world" || region.microState)
1605
1730
  ).map((region) => region.id)
1606
1731
  );
1607
1732
  if (leaderIds.size > 0 && (gutter = measuredLeaderGutter(decodeGeoPack(pack).regions, leaderIds, plot, theme, measure, valueTexts)), !pack.regions.some((region) => labelIds.has(region.id) && leaderEligibleIds.has(region.id) && !leaderIds.has(region.id) && (pack.id !== "world" || region.microState))) return { gutter, leaderIds };
1608
- let ranks = valueRanks(valuesById);
1733
+ let cache = (measure === defaultMeasurer || hasCompleteTableWidths(measure)) && !solveCtx.focus && !solveCtx.labelOffsets && !Object.keys(solveCtx.pins).length && !Object.getOwnPropertySymbols(solveCtx).length ? leaderLayoutCache(pack, measure) : void 0, key = cache && JSON.stringify([
1734
+ plot,
1735
+ lanePlot,
1736
+ solveCtx.plot,
1737
+ solveCtx.canvas,
1738
+ solveCtx.density,
1739
+ solveCtx.labelPad,
1740
+ frameClaims,
1741
+ geoLabelFont(theme),
1742
+ emphasisWeight(theme),
1743
+ strokeToken(theme, "hair"),
1744
+ [...valuesById],
1745
+ [...valueTexts],
1746
+ [...labelIds],
1747
+ [...leaderEligibleIds],
1748
+ [...inlineMarkerIds],
1749
+ [...visibleMarkerIds],
1750
+ withTable && [...withTable.emphasis]
1751
+ ]), previous = key && cache?.get(key);
1752
+ if (previous) return previous;
1753
+ let finish = () => {
1754
+ let result = { gutter, leaderIds };
1755
+ return cache && key && (cache.size >= 96 && cache.delete(cache.keys().next().value), cache.set(key, result)), result;
1756
+ }, ranks = valueRanks(valuesById);
1609
1757
  for (let iteration = 0; iteration <= pack.regions.length; iteration++) {
1610
1758
  let mapFrame = choroplethMapFrame(plot, gutter, pack.id), mapFit = fitMap(mapFrame), { fitted, outsideFits } = mapFit, lanes = buildLeaderLanes(mapFit, leaderIds, lanePlot, theme, measure, valueTexts), probeOccupied = createOccupiedIndex(solveCtx.canvas ?? plot);
1611
1759
  for (let claim of frameClaims)
@@ -1620,13 +1768,13 @@ function resolveRegionLabelLayout(pack, plot, lanePlot, frameClaims, valuesById,
1620
1768
  }
1621
1769
  for (let boundary of fitted.boundaries) claimBoundaryMark(boundary, probeOccupied);
1622
1770
  claimLeaderAnchors(fitted.regions, leaderIds, probeOccupied);
1623
- let plans = fitted.regions.filter((region) => labelIds.has(region.id)).map(
1771
+ let drawHere = fills && cache && !leaderIds.size && labelIds.size === leaderEligibleIds.size && [...labelIds].every((id) => leaderEligibleIds.has(id)) && !frameClaims.some((claim) => "polygon" in claim), plans = fitted.regions.filter((region) => labelIds.has(region.id)).map(
1624
1772
  (region) => labelPlanForRegion(
1625
1773
  region,
1626
1774
  lanes.get(region.id),
1627
1775
  theme,
1628
1776
  measure,
1629
- { token: "background" },
1777
+ drawHere ? fills.get(region.id) : { token: "background" },
1630
1778
  inlineMarkerIds.has(region.id),
1631
1779
  valueTexts,
1632
1780
  ranks.get(region.id) ?? ranks.size,
@@ -1636,17 +1784,18 @@ function resolveRegionLabelLayout(pack, plot, lanePlot, frameClaims, valuesById,
1636
1784
  withTable !== void 0,
1637
1785
  hatchedIds.has(region.id)
1638
1786
  )
1639
- ), solved = solveRegionLabels(plans, probeOccupied, solveCtx, outsideFits, (id) => leaderEligibleIds.has(id) && !leaderIds.has(id)), regionsById = new Map(fitted.regions.map((region) => [region.id, region])), hiddenIds = solved.placed.flatMap((label) => {
1787
+ ), solved = solveRegionLabels(plans, probeOccupied, solveCtx, outsideFits, drawHere ? void 0 : (id) => leaderEligibleIds.has(id) && !leaderIds.has(id)), regionsById = new Map(fitted.regions.map((region) => [region.id, region])), hiddenIds = solved.placed.flatMap((label) => {
1640
1788
  let id = label.owner.categoryId, region = id ? regionsById.get(id) : void 0;
1641
1789
  return label.hidden === "collision" && id && region && leaderEligibleIds.has(id) && (pack.id !== "world" || region.microState) ? [id] : [];
1642
1790
  }), candidateLanes = buildLeaderLanes(mapFit, /* @__PURE__ */ new Set([...leaderIds, ...hiddenIds]), lanePlot, theme, measure, valueTexts), safeIds = hiddenIds.filter((id) => {
1643
1791
  let region = regionsById.get(id), rect = candidateLanes.get(id).rect, from = [region.anchor.x, region.anchor.y];
1644
1792
  return outsideFits(id, rect, from, leaderTarget(from, rect));
1645
1793
  }), nextLeaderIds = /* @__PURE__ */ new Set([...leaderIds, ...safeIds]);
1646
- if (nextLeaderIds.size === leaderIds.size) return { gutter, leaderIds };
1794
+ if (nextLeaderIds.size === leaderIds.size)
1795
+ return drawHere && (mapFit.drawnLabels = { solved, occupied: probeOccupied }), finish();
1647
1796
  leaderIds = nextLeaderIds, gutter = measuredLeaderGutter(fitted.regions, leaderIds, plot, theme, measure, valueTexts);
1648
1797
  }
1649
- return { gutter, leaderIds };
1798
+ return finish();
1650
1799
  }
1651
1800
  function claimLeaderAnchors(regions, leaderIds, occupied) {
1652
1801
  for (let region of regions)
@@ -1681,55 +1830,33 @@ function subtractRect(rect, cut) {
1681
1830
  let pieces = [];
1682
1831
  return rect.y < y1 && pieces.push({ x: rect.x, y: rect.y, w: rect.w, h: y1 - rect.y }), y2 < rect.y + rect.h && pieces.push({ x: rect.x, y: y2, w: rect.w, h: rect.y + rect.h - y2 }), rect.x < x1 && pieces.push({ x: rect.x, y: y1, w: x1 - rect.x, h: y2 - y1 }), x2 < rect.x + rect.w && pieces.push({ x: x2, y: y1, w: rect.x + rect.w - x2, h: y2 - y1 }), pieces;
1683
1832
  }
1684
- function certainlyUnderKey(pack, rect, padding, keyArea, measure, theme) {
1685
- let font = geoLabelFont(theme);
1686
- if (measure !== defaultMeasurer || !Number.isFinite(font.size) || !(font.letterSpacing === void 0 || Number.isFinite(font.letterSpacing))) return !1;
1687
- let [minX, minY, maxX, maxY] = pack.bounds, bw = maxX - minX, bh = maxY - minY, xPad = padding ?? MAP_PAD, yPad = padding ?? (pack.id === "us-states" ? US_MAP_PAD_Y : MAP_PAD);
1688
- if (![rect.x, rect.y, rect.w, rect.h, xPad, yPad, keyArea.x, keyArea.y, keyArea.w, keyArea.h, bw, bh, minX, minY].every(Number.isFinite) || !(bw > 0) || !(bh > 0) || !(rect.w >= 0)) return !1;
1689
- let gMax = Math.min(LEADER_GUTTER, rect.w * LEADER_GUTTER_SHARE), fh = Math.max(10, rect.h - yPad * 2), fits = [0, gMax, rect.w - xPad * 2 - 10, rect.w - xPad * 2 - bw * fh / bh].filter((g) => g >= 0 && g <= gMax).map((g) => {
1690
- let fw = Math.max(10, rect.w - xPad * 2 - g), sx = fw / bw, sy = fh / bh, scale = sx < sy ? sx : sy;
1691
- return { scale, x: rect.x + xPad + (fw - bw * scale) / 2 - minX * scale, y: rect.y + yPad + (fh - bh * scale) / 2 - minY * scale, fw };
1692
- }), magnitude = Math.max(
1693
- Math.abs(keyArea.x),
1694
- Math.abs(keyArea.y),
1695
- Math.abs(keyArea.x + keyArea.w),
1696
- Math.abs(keyArea.y + keyArea.h),
1697
- Math.abs(rect.x) + xPad,
1698
- Math.abs(rect.y) + yPad,
1699
- rect.w,
1700
- fh
1701
- );
1702
- for (let fit of fits)
1703
- magnitude = Math.max(
1704
- magnitude,
1705
- fit.fw,
1706
- Math.abs(fit.x),
1707
- Math.abs(fit.y),
1708
- Math.abs(minX * fit.scale),
1709
- Math.abs(maxX * fit.scale),
1710
- Math.abs(minY * fit.scale),
1711
- Math.abs(maxY * fit.scale)
1712
- );
1713
- if (!(magnitude <= 2 ** 40)) return !1;
1714
- let margin = 16 * Number.EPSILON * magnitude, inner = { x: keyArea.x + margin, y: keyArea.y + margin, w: keyArea.w - 2 * margin, h: keyArea.h - 2 * margin };
1715
- if (!(inner.w >= 0 && inner.h >= 0)) return !1;
1716
- let inside = (px, py) => {
1717
- for (let fit of fits) if (!pointInRect(px * fit.scale + fit.x, py * fit.scale + fit.y, inner)) return !1;
1718
- return !0;
1719
- };
1833
+ function possibleLeaderGutters(pack, width, ids, theme, measure, valueTexts) {
1834
+ if (measure !== defaultMeasurer && !hasCompleteTableWidths(measure)) return;
1835
+ let [minX, minY, maxX, maxY] = pack.bounds;
1836
+ if (!(maxX > minX && maxY > minY)) return;
1837
+ let font = geoLabelFont(theme), gutters = /* @__PURE__ */ new Set([0]);
1720
1838
  for (let region of decodeGeoPack(pack).regions) {
1721
- if (region.marker !== void 0 && inside(region.marker.x, region.marker.y)) return !0;
1722
- let [x0, y0, x1, y1] = boundsOfPolygons(region.polygons), apart = !1;
1723
- for (let fit of fits)
1724
- if (x1 * fit.scale + fit.x < inner.x || x0 * fit.scale + fit.x > inner.x + inner.w || y1 * fit.scale + fit.y < inner.y || y0 * fit.scale + fit.y > inner.y + inner.h) {
1725
- apart = !0;
1726
- break;
1727
- }
1728
- if (!apart) {
1729
- for (let polygon of region.polygons) for (let ring of polygon) for (let [px, py] of ring) if (inside(px, py)) return !0;
1839
+ if (!ids.has(region.id)) continue;
1840
+ let text = regionLabelText(region, font, measure, valueTexts);
1841
+ gutters.add(leaderGutterForWidth(width, measure(text, font).width));
1842
+ }
1843
+ return [...gutters].sort((a, b) => a - b);
1844
+ }
1845
+ function pointUnderKey(pack, rect, padding, keyArea, gutter, witness) {
1846
+ let [minX, minY, maxX, maxY] = pack.bounds, bw = maxX - minX, bh = maxY - minY, regions = decodeGeoPack(pack).regions, frame = choroplethMapFrame(rect, gutter, pack.id, padding), sx = frame.w / bw, sy = frame.h / bh, scale = sx < sy ? sx : sy, ox = frame.x + (frame.w - bw * scale) / 2 - minX * scale, oy = frame.y + (frame.h - bh * scale) / 2 - minY * scale;
1847
+ if (witness && pointInRect(witness[0] * scale + ox, witness[1] * scale + oy, keyArea)) return witness;
1848
+ for (let region of regions) {
1849
+ if (region.marker && pointInRect(region.marker.x * scale + ox, region.marker.y * scale + oy, keyArea))
1850
+ return [region.marker.x, region.marker.y];
1851
+ let [x0, y0, x1, y1] = boundsOfPolygons(region.polygons);
1852
+ if (!(x1 * scale + ox < keyArea.x || x0 * scale + ox > keyArea.x + keyArea.w || y1 * scale + oy < keyArea.y || y0 * scale + oy > keyArea.y + keyArea.h)) {
1853
+ for (let polygon of region.polygons) for (let ring of polygon) for (let point of ring)
1854
+ if (pointInRect(point[0] * scale + ox, point[1] * scale + oy, keyArea)) return point;
1730
1855
  }
1731
1856
  }
1732
- return !1;
1857
+ }
1858
+ function leaderGutterForWidth(plotWidth, labelWidth) {
1859
+ return Math.min(LEADER_GUTTER, plotWidth * LEADER_GUTTER_SHARE, Math.max(28, labelWidth + 24));
1733
1860
  }
1734
1861
  function choroplethMapFrame(plot, gutter, packId, padding) {
1735
1862
  let xPad = padding ?? MAP_PAD, yPad = padding ?? (packId === "us-states" ? US_MAP_PAD_Y : MAP_PAD);
@@ -1745,7 +1872,7 @@ function measuredLeaderGutter(regions, leaderIds, plot, theme, measure, valueTex
1745
1872
  (largest, region) => Math.max(largest, measure(regionLabelText(region, compactFont, measure, valueTexts), compactFont).width),
1746
1873
  0
1747
1874
  );
1748
- return Math.min(LEADER_GUTTER, plot.w * LEADER_GUTTER_SHARE, Math.max(28, maxWidth + 24));
1875
+ return leaderGutterForWidth(plot.w, maxWidth);
1749
1876
  }
1750
1877
  function buildLeaderLanes(prepared, leaderIds, plot, theme, measure, valueTexts) {
1751
1878
  let { regions } = prepared.fitted, compactFont = geoLabelFont(theme), h = compactFont.size * (compactFont.lineHeight ?? 1.2), ordered = regions.filter((region) => leaderIds.has(region.id)).sort((a, b) => a.anchor.y - b.anchor.y || compareText(a.id, b.id));
@@ -1993,10 +2120,10 @@ function regionLabelRequest(region, text, font, priority, candidates, value) {
1993
2120
  candidates
1994
2121
  };
1995
2122
  }
1996
- var regionPaths = /* @__PURE__ */ new WeakMap(), regionStrips = /* @__PURE__ */ new WeakMap(), regionHatches = /* @__PURE__ */ new WeakMap(), regionAreas = /* @__PURE__ */ new WeakMap(), regionBounds = /* @__PURE__ */ new WeakMap();
2123
+ var regionPaths = /* @__PURE__ */ new WeakMap(), regionStrips = /* @__PURE__ */ new WeakMap(), regionHatches = /* @__PURE__ */ new WeakMap(), regionAreas = /* @__PURE__ */ new WeakMap();
1997
2124
  function polygonsPath(polygons) {
1998
- let d = regionPaths.get(polygons);
1999
- return d === void 0 && regionPaths.set(polygons, d = polygonsPathOf(polygons)), d;
2125
+ let key = projectedRegionKey(polygons), d = regionPaths.get(key);
2126
+ return d === void 0 && regionPaths.set(key, d = polygonsPathOf(polygons)), d;
2000
2127
  }
2001
2128
  function polygonsPathOf(polygons) {
2002
2129
  let path = "";
@@ -2075,32 +2202,27 @@ function segmentsPath(segments) {
2075
2202
  return segments.map((segment) => `M${coord(segment.a)}L${coord(segment.b)}`).join("");
2076
2203
  }
2077
2204
  function claimPolygonFill(polygons, occupied, regionId) {
2078
- let strips = regionStrips.get(polygons);
2079
- strips || regionStrips.set(polygons, strips = polygonFillStrips(polygons));
2205
+ let key = projectedRegionKey(polygons), strips = regionStrips.get(key);
2206
+ strips || regionStrips.set(key, strips = polygonFillStrips(polygons));
2080
2207
  let owner = { categoryId: regionId };
2081
2208
  for (let strip of strips) occupied.claim(strip, "mark", owner, "region");
2082
2209
  }
2083
2210
  function polygonFillStrips(polygons) {
2084
2211
  let strips = [];
2085
2212
  for (let polygon of polygons) {
2086
- let bounds = boundsOfPolygons([polygon]), firstY = Math.floor(bounds[1] / CLAIM_STEP) * CLAIM_STEP + CLAIM_STEP / 2, rows = [];
2087
- for (let y = firstY; y <= bounds[3]; y += CLAIM_STEP) rows.push(y);
2088
- let crossing = rows.map(() => []);
2213
+ let crossings = /* @__PURE__ */ new Map();
2089
2214
  for (let ring of polygon)
2090
2215
  for (let i = 1; i < ring.length; i++) {
2091
- let a = ring[i - 1], b = ring[i], low = Math.min(a[1], b[1]), high = Math.max(a[1], b[1]);
2092
- if (!(low < high)) continue;
2093
- let lo = Math.max(0, Math.min(rows.length, Math.ceil((low - firstY) / CLAIM_STEP))) || 0;
2094
- for (; lo > 0 && rows[lo - 1] >= low; ) lo--;
2095
- for (; lo < rows.length && rows[lo] < low; ) lo++;
2096
- for (let row = lo; row < rows.length && rows[row] < high; row++) crossing[row].push(a, b);
2097
- }
2098
- for (let row = 0; row < rows.length; row++) {
2099
- let y = rows[row], edges = crossing[row], intersections = [];
2100
- for (let i = 0; i < edges.length; i += 2) {
2101
- let a = edges[i], b = edges[i + 1], t = (y - a[1]) / (b[1] - a[1]);
2102
- intersections.push(a[0] + t * (b[0] - a[0]));
2216
+ let a = ring[i - 1], b = ring[i], low = Math.min(a[1], b[1]), high = Math.max(a[1], b[1]), y = Math.floor(low / CLAIM_STEP) * CLAIM_STEP + CLAIM_STEP / 2;
2217
+ for (y < low && (y += CLAIM_STEP); y < high; y += CLAIM_STEP) {
2218
+ let row = crossings.get(y);
2219
+ row || crossings.set(y, row = []);
2220
+ let t = (y - a[1]) / (b[1] - a[1]);
2221
+ row.push(a[0] + t * (b[0] - a[0]));
2222
+ }
2103
2223
  }
2224
+ for (let y of [...crossings.keys()].sort((a, b) => a - b)) {
2225
+ let intersections = crossings.get(y);
2104
2226
  intersections.sort((a, b) => a - b);
2105
2227
  for (let i = 0; i + 1 < intersections.length; i += 2) {
2106
2228
  let x1 = intersections[i], x2 = intersections[i + 1];
@@ -2247,15 +2369,7 @@ function segmentMeetsRect(ax, ay, bx, by, x0, y0, x1, y1) {
2247
2369
  return !0;
2248
2370
  }
2249
2371
  function boundsOfPolygons(polygons) {
2250
- let known = regionBounds.get(polygons);
2251
- if (known !== void 0) return known;
2252
- let minX = 1 / 0, minY = 1 / 0, maxX = -1 / 0, maxY = -1 / 0;
2253
- for (let polygon of polygons)
2254
- for (let ring of polygon)
2255
- for (let point of ring)
2256
- minX = Math.min(minX, point[0]), minY = Math.min(minY, point[1]), maxX = Math.max(maxX, point[0]), maxY = Math.max(maxY, point[1]);
2257
- let bounds = [minX, minY, maxX, maxY];
2258
- return regionBounds.set(polygons, bounds), bounds;
2372
+ return geoPolygonExtrema(polygons).bounds;
2259
2373
  }
2260
2374
  function pointInRect(x, y, rect) {
2261
2375
  return x >= rect.x && x <= rect.x + rect.w && y >= rect.y && y <= rect.y + rect.h;
@@ -2270,7 +2384,7 @@ function valueRanks(valuesById) {
2270
2384
  return new Map([...valuesById].flatMap(([id, value]) => value === null ? [] : [{ id, value }]).sort((a, b) => Math.abs(b.value) - Math.abs(a.value) || compareText(a.id, b.id)).map(({ id }, index) => [id, index]));
2271
2385
  }
2272
2386
  function polygonsArea(polygons) {
2273
- let known = regionAreas.get(polygons);
2387
+ let key = projectedRegionKey(polygons), known = regionAreas.get(key);
2274
2388
  if (known !== void 0) return known;
2275
2389
  let area = polygons.reduce((total, polygon) => total + polygon.reduce((sum, ring, index) => {
2276
2390
  let twice = 0;
@@ -2280,7 +2394,7 @@ function polygonsArea(polygons) {
2280
2394
  }
2281
2395
  return sum + (index === 0 ? 1 : -1) * Math.abs(twice) / 2;
2282
2396
  }, 0), 0);
2283
- return regionAreas.set(polygons, area), area;
2397
+ return regionAreas.set(key, area), area;
2284
2398
  }
2285
2399
  function calloutTerminus(from, rect) {
2286
2400
  let x = rect.x - 2, y = rect.y - 2;