boardplot 0.58.1 → 0.59.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 (415) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/dist/{ReaderBox-WVOT7VVJ.js → ReaderBox-4PNFZO56.js} +4 -4
  3. package/dist/{annotateEngine-57L26X77.js → annotateEngine-DL4KRQ6B.js} +1 -1
  4. package/dist/build-identity.json +3 -3
  5. package/dist/{chunk-54YO56IK.js → chunk-25JXYOSX.js} +1 -1
  6. package/dist/{chunk-HF4BCPIV.js → chunk-266ENWFM.js} +3 -3
  7. package/dist/{chunk-FRR7BJ3B.js → chunk-2E2MK4XM.js} +2 -2
  8. package/dist/{chunk-2DS4MT7T.js → chunk-2GVW5WDD.js} +3 -3
  9. package/dist/{chunk-4ROZ4TFL.js → chunk-2HRDOBPS.js} +1 -1
  10. package/dist/chunk-2Q7IAWON.js +18 -0
  11. package/dist/{chunk-PVGJM2HP.js → chunk-33SPSKTP.js} +4 -4
  12. package/dist/{chunk-Z6DUNKFU.js → chunk-3JG764MI.js} +688 -140
  13. package/dist/{chunk-OZLKEBCD.js → chunk-3V7Y7CHI.js} +1 -1
  14. package/dist/{chunk-3BMPYY26.js → chunk-3WC2TA6C.js} +4 -4
  15. package/dist/{chunk-T7PRG6AO.js → chunk-3WFJDXZO.js} +3 -3
  16. package/dist/{chunk-5KAYLRRP.js → chunk-3ZR7ZE64.js} +2 -2
  17. package/dist/{chunk-WW4KLAVO.js → chunk-4DLIXTDH.js} +5 -5
  18. package/dist/{chunk-OQUH7I5T.js → chunk-4EEK4AMC.js} +2 -2
  19. package/dist/{chunk-RLH2CQCD.js → chunk-4LCQO46F.js} +144 -55
  20. package/dist/{chunk-SHYS52VO.js → chunk-4NIIQFDA.js} +147 -104
  21. package/dist/{chunk-ED7GLWTF.js → chunk-4PKUS5MG.js} +2 -1
  22. package/dist/{chunk-645BGVPP.js → chunk-4WH2YGO6.js} +3 -3
  23. package/dist/{chunk-MXUPMGRY.js → chunk-4YKS2JDE.js} +3 -3
  24. package/dist/{chunk-LYAT62UT.js → chunk-4YZQY3AA.js} +1 -1
  25. package/dist/{chunk-VJULLJLN.js → chunk-56CDMSE5.js} +2 -2
  26. package/dist/{chunk-SBKM6XFS.js → chunk-5AXWSGS7.js} +3 -3
  27. package/dist/{chunk-XZXZNI7A.js → chunk-5HOIOQK3.js} +1 -1
  28. package/dist/{chunk-ERDKMZ7O.js → chunk-5OV7VOGV.js} +2 -2
  29. package/dist/{chunk-AICO24HJ.js → chunk-5QMM354E.js} +6 -5
  30. package/dist/{chunk-USMKNNOU.js → chunk-5UXK5BAA.js} +37 -38
  31. package/dist/{chunk-ZB3JIL3L.js → chunk-5YULK4DY.js} +6 -10
  32. package/dist/{chunk-63JUV7NR.js → chunk-5ZE7SHRM.js} +3 -3
  33. package/dist/{chunk-SCAYWQZK.js → chunk-67744WKZ.js} +1 -1
  34. package/dist/{chunk-IFUAPFL5.js → chunk-6CZGFTGK.js} +51 -47
  35. package/dist/{chunk-7YZZCQT3.js → chunk-6IIYLDSQ.js} +3 -3
  36. package/dist/{chunk-JBAVMO56.js → chunk-6TH5NVKS.js} +19 -14
  37. package/dist/{chunk-I5VNHDPR.js → chunk-6TZDPQDE.js} +2 -2
  38. package/dist/{chunk-TMEUK2WS.js → chunk-77L6QGIG.js} +1 -1
  39. package/dist/{chunk-OS7C2KMQ.js → chunk-7IONS4Z7.js} +3 -3
  40. package/dist/{chunk-ETUKDEGL.js → chunk-7QUWM5W6.js} +6 -6
  41. package/dist/{chunk-KI7VCHNZ.js → chunk-7SIZGM5S.js} +78 -53
  42. package/dist/{chunk-G7BCLYL4.js → chunk-7TZIPGFH.js} +8 -6
  43. package/dist/{chunk-76GPN6AT.js → chunk-7UUSHA7H.js} +1 -1
  44. package/dist/{chunk-OZA7HA6L.js → chunk-7UZUXPFM.js} +1 -1
  45. package/dist/{chunk-4DK67I3B.js → chunk-7YJSSPQX.js} +31 -28
  46. package/dist/{chunk-TBZT5WUT.js → chunk-7ZXIHEZS.js} +4 -4
  47. package/dist/{chunk-IMUMPKXF.js → chunk-A3SOYL6F.js} +3 -3
  48. package/dist/{chunk-P3NMDPDP.js → chunk-ADLKZEML.js} +31 -64
  49. package/dist/{chunk-SKPOXLG5.js → chunk-AFQZBCME.js} +4 -4
  50. package/dist/{chunk-TVOMGNFQ.js → chunk-AGR4VJ2Y.js} +1 -1
  51. package/dist/{chunk-2HII2B6S.js → chunk-AH2L44TR.js} +3 -3
  52. package/dist/{chunk-WFBN2HXR.js → chunk-AIPOSNVG.js} +1 -1
  53. package/dist/{chunk-4OJF6DXL.js → chunk-AUSZDYGE.js} +9 -7
  54. package/dist/{chunk-2SWSUNA4.js → chunk-AVYRC2T3.js} +50 -28
  55. package/dist/{chunk-NSMYIUBZ.js → chunk-B5FT4YAX.js} +1 -1
  56. package/dist/{chunk-H3VICNTN.js → chunk-B7UWG6XJ.js} +1 -1
  57. package/dist/{chunk-X3QUASBR.js → chunk-BJJYNTVJ.js} +1 -1
  58. package/dist/{chunk-WKXLJNHW.js → chunk-BOUZKVIY.js} +17 -19
  59. package/dist/{chunk-WUP6C4ZD.js → chunk-BXZNLMMH.js} +1 -1
  60. package/dist/{chunk-OMNB27GM.js → chunk-C26Z5AEW.js} +3 -3
  61. package/dist/{chunk-VC62V7CX.js → chunk-CV5KCQD3.js} +72 -79
  62. package/dist/{chunk-RPGEB3Z5.js → chunk-CX7WUNMO.js} +22 -18
  63. package/dist/{chunk-YJUBX3QF.js → chunk-DANKUHCX.js} +41 -40
  64. package/dist/{chunk-IDXYHDQY.js → chunk-DBKMJWPO.js} +1 -1
  65. package/dist/{chunk-6ALORYH7.js → chunk-DEJ27Y2P.js} +138 -91
  66. package/dist/{chunk-HTQGJQZN.js → chunk-DITI57ZB.js} +1 -1
  67. package/dist/{chunk-IXU5C3YY.js → chunk-DO7MMF4C.js} +86 -43
  68. package/dist/{chunk-I52OMC5B.js → chunk-DUDVHQD6.js} +7 -7
  69. package/dist/{chunk-4TUU3UGY.js → chunk-DXLWMK24.js} +3 -3
  70. package/dist/{chunk-MALSSEXO.js → chunk-DYD7W3Y6.js} +20 -21
  71. package/dist/{chunk-P5RCP4NK.js → chunk-DZBT7AWJ.js} +2 -2
  72. package/dist/{chunk-YLRAAJYV.js → chunk-E4KHHC46.js} +16 -16
  73. package/dist/{chunk-KUWIRCYJ.js → chunk-E62SXDRT.js} +2 -2
  74. package/dist/{chunk-WOICFLOJ.js → chunk-EADD6NNQ.js} +73 -79
  75. package/dist/{chunk-CMPHT2LS.js → chunk-EH23CIC5.js} +4 -4
  76. package/dist/{chunk-HM4AJ5U4.js → chunk-EJA5EANI.js} +47 -26
  77. package/dist/{chunk-NFGV5OAR.js → chunk-EWGFOEJB.js} +126 -65
  78. package/dist/{chunk-Y6E4JU3U.js → chunk-EWMPUCIG.js} +37 -37
  79. package/dist/{chunk-GB3RZYTK.js → chunk-EZ5KUBYF.js} +38 -27
  80. package/dist/{chunk-M5LPP2GQ.js → chunk-F2N5BUBK.js} +12 -13
  81. package/dist/{chunk-VJ7VBB6S.js → chunk-F7QCIJAY.js} +1 -1
  82. package/dist/{chunk-C4SQU2PB.js → chunk-FB36HSY2.js} +4 -4
  83. package/dist/{chunk-F3XOBFS4.js → chunk-FBIMTKYK.js} +3 -10
  84. package/dist/{chunk-XSC4IXXC.js → chunk-FMVXXKSW.js} +3 -3
  85. package/dist/{chunk-3ESWPMDW.js → chunk-FP3ORYCG.js} +22 -21
  86. package/dist/{chunk-P6DEFCMQ.js → chunk-FWPPZB4G.js} +2 -2
  87. package/dist/{chunk-MSYTF3DZ.js → chunk-FYFXOLWI.js} +116 -89
  88. package/dist/{chunk-SH4UGK5U.js → chunk-GDE2JINW.js} +11 -11
  89. package/dist/{chunk-WDJSDJLV.js → chunk-GEEHXLFQ.js} +7 -6
  90. package/dist/{chunk-EDW5HQND.js → chunk-GGFT6IIM.js} +3 -3
  91. package/dist/{chunk-UBYDY4B7.js → chunk-GIJM4MP4.js} +5 -5
  92. package/dist/{chunk-UY34DDUM.js → chunk-GNK7RTO4.js} +3 -3
  93. package/dist/{chunk-CFESVCZR.js → chunk-GSHRYDJM.js} +1 -1
  94. package/dist/{chunk-3M2F7KSS.js → chunk-GWDKUKOJ.js} +96 -321
  95. package/dist/{chunk-XMX4PCFL.js → chunk-GZYMHC44.js} +2 -2
  96. package/dist/{chunk-OUR5ZHCB.js → chunk-HBKZC5BH.js} +2 -2
  97. package/dist/{chunk-23FT7RLN.js → chunk-HC4UW7MB.js} +4 -4
  98. package/dist/{chunk-AMBQ6SWU.js → chunk-HFDU2E7C.js} +27 -21
  99. package/dist/{chunk-ZG4BMJRL.js → chunk-HW67YGJC.js} +1 -1
  100. package/dist/{chunk-FJNZ7NWD.js → chunk-I65BCUVH.js} +3 -3
  101. package/dist/{chunk-VTY6YHQZ.js → chunk-ICERP2YF.js} +3 -3
  102. package/dist/{chunk-G7CXJPEN.js → chunk-ICJUN47O.js} +2 -2
  103. package/dist/{chunk-H4EDDGGX.js → chunk-ID5PE4KM.js} +3 -3
  104. package/dist/{chunk-BQ7SN7AW.js → chunk-IDJVUZAA.js} +3 -3
  105. package/dist/{chunk-O3LT4TAI.js → chunk-IQRRT32Q.js} +2 -2
  106. package/dist/{chunk-WGJIYFVQ.js → chunk-ISMFUWOP.js} +3 -3
  107. package/dist/{chunk-6AVUTZ6W.js → chunk-IX2SLULO.js} +3 -3
  108. package/dist/{chunk-Q2I3QLE3.js → chunk-IXZI4SN4.js} +116 -46
  109. package/dist/chunk-J6LGZPKI.js +89 -0
  110. package/dist/{chunk-CCAAI56H.js → chunk-JF743NNC.js} +7 -0
  111. package/dist/{chunk-YGWPOYDE.js → chunk-JIB74SQS.js} +6 -6
  112. package/dist/{chunk-ZIVCPXXL.js → chunk-JOX252XQ.js} +5 -5
  113. package/dist/{chunk-V7JFT7NQ.js → chunk-JRM22ULA.js} +54 -45
  114. package/dist/{chunk-XSEETONJ.js → chunk-JYSS5ZZF.js} +5 -5
  115. package/dist/{chunk-WLH5IBFY.js → chunk-KRIYGX3N.js} +3 -3
  116. package/dist/{chunk-XRRG4MBM.js → chunk-KWMQNKGX.js} +2 -2
  117. package/dist/{chunk-6YBNVI5I.js → chunk-LADFOYH7.js} +40 -27
  118. package/dist/{chunk-VKNQOSGW.js → chunk-LC4KDLUE.js} +3 -3
  119. package/dist/{chunk-ITEJQHXE.js → chunk-LLECS747.js} +4 -4
  120. package/dist/{chunk-JYSFAH7C.js → chunk-LM4GVVPM.js} +16 -10
  121. package/dist/{chunk-EHRRHSPV.js → chunk-LPLRXEOT.js} +55 -19
  122. package/dist/{chunk-ZBCCJPGW.js → chunk-M2FF4IPF.js} +16 -7
  123. package/dist/{chunk-4JGBCBDZ.js → chunk-MF6XGFHB.js} +1 -1
  124. package/dist/{chunk-BHLNSJG7.js → chunk-MOBRWYUQ.js} +2 -2
  125. package/dist/{chunk-CDUR3KWV.js → chunk-MOPY5REE.js} +2 -2
  126. package/dist/{chunk-MGXHFRQK.js → chunk-MTOBNHAU.js} +2 -2
  127. package/dist/{chunk-DORE2RHL.js → chunk-MYBBZNYN.js} +2 -2
  128. package/dist/{chunk-V7NUJEJE.js → chunk-MZCJ22O4.js} +1 -1
  129. package/dist/{chunk-W2QILXAL.js → chunk-NIL6TYAN.js} +4 -4
  130. package/dist/{chunk-YW35KSXR.js → chunk-NPDF7HEH.js} +2 -2
  131. package/dist/{chunk-SH4FLUAD.js → chunk-NUASZPS7.js} +1 -1
  132. package/dist/{chunk-Z62TJQO5.js → chunk-NWUEA42V.js} +3 -3
  133. package/dist/{chunk-UOOXWGBU.js → chunk-NZGQLR4X.js} +8 -8
  134. package/dist/{chunk-RQKDEJFQ.js → chunk-O32L5FK2.js} +3 -3
  135. package/dist/{chunk-OUNYHYJL.js → chunk-O623CYPA.js} +3 -3
  136. package/dist/{chunk-OELB7MTE.js → chunk-OJR5GPCN.js} +3 -3
  137. package/dist/{chunk-C47POAC5.js → chunk-OL6HVC6K.js} +1 -1
  138. package/dist/{chunk-6NGKQNTB.js → chunk-OM5MAJST.js} +68 -57
  139. package/dist/{chunk-AAQWFTDM.js → chunk-OTOASFG4.js} +92 -35
  140. package/dist/{chunk-6JTCFPAD.js → chunk-P3N74SZ5.js} +3 -3
  141. package/dist/{chunk-CKEFAD4R.js → chunk-PHQGGR5O.js} +3 -3
  142. package/dist/{chunk-DUOGEFLG.js → chunk-POHML4N4.js} +107 -50
  143. package/dist/{chunk-KVBLTAO7.js → chunk-PP23D6QV.js} +4 -5
  144. package/dist/{chunk-F2ET5ZTT.js → chunk-PPOUKS24.js} +0 -1
  145. package/dist/{chunk-V7FV66KL.js → chunk-PRVX4PAO.js} +1 -1
  146. package/dist/{chunk-JY4LTPOV.js → chunk-PSUSHJFV.js} +1 -1
  147. package/dist/{chunk-AJGSCVVW.js → chunk-PZZAVTLQ.js} +2 -2
  148. package/dist/{chunk-R5SGE2NS.js → chunk-QDFX2KAP.js} +2 -2
  149. package/dist/{chunk-XC32OSCD.js → chunk-QKDDGDRF.js} +10 -10
  150. package/dist/{chunk-U6QZOMYC.js → chunk-QM6IW5BL.js} +3 -3
  151. package/dist/chunk-QMQZC2KW.js +408 -0
  152. package/dist/{chunk-42QKUSHJ.js → chunk-QXHFELIA.js} +1 -1
  153. package/dist/{chunk-JNDWRV34.js → chunk-R2RLERPT.js} +1 -1
  154. package/dist/{chunk-E5YF236N.js → chunk-R4MVXUAG.js} +1 -1
  155. package/dist/{chunk-XZOFKLTD.js → chunk-REIIGIJG.js} +3 -3
  156. package/dist/{chunk-4M3UADCM.js → chunk-RF2REMRV.js} +6 -6
  157. package/dist/{chunk-3MFVJMP6.js → chunk-RF6ZHX5F.js} +1 -1
  158. package/dist/{chunk-TKH655ON.js → chunk-RLX6VODQ.js} +9 -2
  159. package/dist/{chunk-KWIP5YRA.js → chunk-RPS7G77V.js} +3 -3
  160. package/dist/{chunk-MVR7YKBF.js → chunk-RSDGBNXP.js} +5 -5
  161. package/dist/{chunk-QFNWGSCT.js → chunk-RYYB7REV.js} +3 -3
  162. package/dist/{chunk-LPMSGO7L.js → chunk-SBYKLBDV.js} +3 -3
  163. package/dist/{chunk-JT3UTEWZ.js → chunk-SDAVHADX.js} +2 -2
  164. package/dist/{chunk-AQ2PQ7FK.js → chunk-SE6LBMRJ.js} +137 -62
  165. package/dist/{chunk-3OSQ32GN.js → chunk-SFRMBCVY.js} +3 -3
  166. package/dist/{chunk-AGJ2QL4A.js → chunk-SNJ3FZXC.js} +14 -12
  167. package/dist/{chunk-USSG6TJV.js → chunk-SXCFMPNM.js} +3 -3
  168. package/dist/{chunk-SGDWLXUC.js → chunk-SY7JC3PH.js} +1 -1
  169. package/dist/{chunk-QATOOZMH.js → chunk-T4CFY4YT.js} +4 -4
  170. package/dist/{chunk-5SVGTQTW.js → chunk-TASEX7VA.js} +1 -1
  171. package/dist/{chunk-BVIJCUWW.js → chunk-TCWJQIVQ.js} +123 -71
  172. package/dist/{chunk-VACZGW5R.js → chunk-TEZWFQB7.js} +7 -7
  173. package/dist/{chunk-GHCU6OSE.js → chunk-TLKRYDH3.js} +2 -2
  174. package/dist/{chunk-MB5EX2YG.js → chunk-TMVERETB.js} +23 -332
  175. package/dist/{chunk-LOXZSTIM.js → chunk-TQFBLSZJ.js} +44 -27
  176. package/dist/{chunk-NT3HCXQC.js → chunk-U4WG46QP.js} +117 -43
  177. package/dist/{chunk-LJDATBPB.js → chunk-U75MMLNQ.js} +3 -6
  178. package/dist/{chunk-R3VSWOTI.js → chunk-UFGJNSSL.js} +1 -1
  179. package/dist/{chunk-FB6X7QHA.js → chunk-UGHJHJKY.js} +1 -1
  180. package/dist/{chunk-LXH4RPY4.js → chunk-UI2MKLON.js} +1 -1
  181. package/dist/{chunk-3E6NLODZ.js → chunk-UKEI7JDA.js} +1 -1
  182. package/dist/{chunk-6JFQCVNN.js → chunk-USATDW6O.js} +1 -1
  183. package/dist/{chunk-CQBPNE7Z.js → chunk-UTWLJ6AZ.js} +6 -5
  184. package/dist/{chunk-NQPJWQTW.js → chunk-UV77Y7QK.js} +11 -5
  185. package/dist/{chunk-PMT75APP.js → chunk-UXJXA4NP.js} +1 -1
  186. package/dist/{chunk-3RXUA6VY.js → chunk-UZDQFUHO.js} +3 -3
  187. package/dist/{chunk-AKZOQGF3.js → chunk-V3XYFLOZ.js} +3 -3
  188. package/dist/{chunk-OQQMDSCC.js → chunk-VGOZOBNB.js} +1 -1
  189. package/dist/{chunk-K7XPTQBJ.js → chunk-VHZ4MXJO.js} +1 -1
  190. package/dist/{chunk-EBWMTQ4U.js → chunk-VLMKGQ33.js} +13 -13
  191. package/dist/{chunk-34PKJZRY.js → chunk-VMLVZW4F.js} +39 -36
  192. package/dist/{chunk-65U6ZBZZ.js → chunk-VT6PDWUA.js} +78 -78
  193. package/dist/{chunk-GQYT7G4F.js → chunk-VTUSC24F.js} +2 -2
  194. package/dist/{chunk-33EBLJVZ.js → chunk-VVWTD4XP.js} +9 -9
  195. package/dist/{chunk-5CYLT6FJ.js → chunk-VZVPN7NT.js} +3 -3
  196. package/dist/{chunk-Z3WQXVFV.js → chunk-W4ZLMK6Z.js} +1 -1
  197. package/dist/{chunk-35ZJUZUO.js → chunk-W6NEWQZU.js} +20 -18
  198. package/dist/{chunk-DZYTXZNS.js → chunk-WD5NJHZG.js} +2 -2
  199. package/dist/{chunk-P7UOOMXE.js → chunk-WTH3KQDM.js} +2 -2
  200. package/dist/{chunk-CSMVKG2C.js → chunk-WTWM4RK6.js} +1 -1
  201. package/dist/{chunk-W6XSIBLR.js → chunk-WZNO3LUF.js} +3 -3
  202. package/dist/{chunk-QQMESIDA.js → chunk-X3AMBFGF.js} +3 -3
  203. package/dist/{chunk-DHGE46UK.js → chunk-X725AGYP.js} +1 -1
  204. package/dist/{chunk-TX5FSNAU.js → chunk-XAH4EWJT.js} +1 -1
  205. package/dist/{chunk-4DMRIL5K.js → chunk-XETSLYFD.js} +3 -3
  206. package/dist/{chunk-6V3A3MTG.js → chunk-XFDNAR4S.js} +16 -27
  207. package/dist/{chunk-WMQ57FOP.js → chunk-XGTSZ7NC.js} +3 -3
  208. package/dist/{chunk-HAG3K6PQ.js → chunk-XHEG2BG6.js} +1 -1
  209. package/dist/{chunk-D2TQX7UJ.js → chunk-XLX3TUFO.js} +2 -2
  210. package/dist/{chunk-XLLWIHN2.js → chunk-XMII3G47.js} +3 -3
  211. package/dist/{chunk-BSZOQJXB.js → chunk-XRPZJDAK.js} +101 -72
  212. package/dist/{chunk-IPBOREIY.js → chunk-XUEX5WTR.js} +1 -1
  213. package/dist/{chunk-HO4ILCW7.js → chunk-XUGEYHOQ.js} +2 -2
  214. package/dist/{chunk-OO63YP35.js → chunk-XVFUJRRC.js} +1 -1
  215. package/dist/{chunk-IVDTP6SV.js → chunk-XWGAANY4.js} +3 -3
  216. package/dist/{chunk-IPZJCBWD.js → chunk-XWUHUTXX.js} +24 -18
  217. package/dist/{chunk-WNTUBGBB.js → chunk-XXYV5UEM.js} +50 -49
  218. package/dist/{chunk-7GRR72MY.js → chunk-XZBX6LIC.js} +20 -12
  219. package/dist/{chunk-ZDJ7C64T.js → chunk-Y4BJ7D5F.js} +1 -1
  220. package/dist/{chunk-KW4JXWHO.js → chunk-YDYZWCUQ.js} +1 -1
  221. package/dist/{chunk-ZCHKIR7C.js → chunk-YJN54OZS.js} +52 -41
  222. package/dist/{chunk-X46PSAJ7.js → chunk-YJXIHVNK.js} +2 -2
  223. package/dist/{chunk-UCKUAKYQ.js → chunk-YKYK6C7F.js} +1 -1
  224. package/dist/{chunk-GNMB72V7.js → chunk-YM4MVABU.js} +56 -24
  225. package/dist/{chunk-GOFS336W.js → chunk-YM7MO7WI.js} +1 -1
  226. package/dist/{chunk-PNYWBY4K.js → chunk-YOUYJHW3.js} +3 -3
  227. package/dist/{chunk-OTWIW2L3.js → chunk-YPELB4Q7.js} +3 -3
  228. package/dist/{chunk-5I4RPBNE.js → chunk-YRCIG4IO.js} +8 -7
  229. package/dist/{chunk-FPFRLRQO.js → chunk-ZIQR2CNM.js} +7 -7
  230. package/dist/{chunk-H7BCNS5J.js → chunk-ZK22I3NF.js} +3 -3
  231. package/dist/{chunk-A6N24NGW.js → chunk-ZNA4JHHG.js} +2 -2
  232. package/dist/{chunk-VESSIKBG.js → chunk-ZOQRX5V7.js} +4 -4
  233. package/dist/{chunk-FVWHEM2N.js → chunk-ZPQ3VOAE.js} +1 -1
  234. package/dist/{chunk-NZ7FX3AE.js → chunk-ZQ5ILQ5A.js} +1 -1
  235. package/dist/cli/index.js +1 -1
  236. package/dist/{core-LSYX4UQQ.js → core-2PT7IROA.js} +2 -1
  237. package/dist/{core-YN2VVGUL.js → core-34YTH4KN.js} +1 -1
  238. package/dist/{core-7YDNMUU3.js → core-4ZEVWU43.js} +1 -1
  239. package/dist/{core-743ZXTWK.js → core-64EHPUVV.js} +1 -1
  240. package/dist/{core-ZETBHLSV.js → core-6KO5AEUH.js} +1 -1
  241. package/dist/{core-2GWH3ED7.js → core-7WLD237S.js} +1 -1
  242. package/dist/{core-AC5AKSCM.js → core-A2MERE3C.js} +1 -1
  243. package/dist/{core-O5S2NETE.js → core-AVNB2Q3G.js} +2 -1
  244. package/dist/{core-XUNZB6BM.js → core-B7KOBTRL.js} +1 -1
  245. package/dist/{core-HIONDJGC.js → core-BOOD7ZUQ.js} +1 -1
  246. package/dist/{core-3LCSHMKN.js → core-BOU34T23.js} +1 -1
  247. package/dist/{core-VYHQ5JY6.js → core-BQ2I77OF.js} +2 -1
  248. package/dist/{core-HMBMMF5Z.js → core-BSEXRZD6.js} +1 -1
  249. package/dist/{core-Q2Y3JEWL.js → core-CXEEM26F.js} +1 -1
  250. package/dist/{core-7OAGK7ZJ.js → core-EHMPBG6Q.js} +1 -1
  251. package/dist/{core-BEK6EPVF.js → core-FXC4TB2K.js} +1 -1
  252. package/dist/{core-MIERUUUT.js → core-HMS72VO6.js} +1 -1
  253. package/dist/{core-EGTJOQK7.js → core-I2GPMB2B.js} +1 -1
  254. package/dist/{core-XJZWD43V.js → core-IQC6H4A7.js} +1 -1
  255. package/dist/{core-RTBPKALG.js → core-IYEFTP6C.js} +1 -1
  256. package/dist/{core-3XGQBHJI.js → core-J2QTOU4D.js} +1 -1
  257. package/dist/{core-AEALAFRA.js → core-JJLIPTEW.js} +1 -1
  258. package/dist/{core-5CRTPVYA.js → core-LCP44UYI.js} +1 -2
  259. package/dist/{core-BRBJ3LPF.js → core-MBNVENCZ.js} +1 -1
  260. package/dist/{core-VBMWBPKM.js → core-MVIK7FAJ.js} +2 -1
  261. package/dist/{core-TIIPSEK3.js → core-N4OKPNXQ.js} +1 -1
  262. package/dist/{core-FE4THVV3.js → core-Q4IILTGO.js} +1 -1
  263. package/dist/{core-4N6WH3IF.js → core-QCPDOQEJ.js} +2 -1
  264. package/dist/{core-AAPPZSSZ.js → core-RVTF336C.js} +1 -1
  265. package/dist/{core-5K4HRIHX.js → core-VGMMKEU4.js} +1 -1
  266. package/dist/{core-3NQ5TXOJ.js → core-VUVJOMUC.js} +1 -1
  267. package/dist/{core-T7CKLMT2.js → core-VWISBHXE.js} +1 -1
  268. package/dist/{core-YKDDPMWW.js → core-W3UBWZR3.js} +1 -1
  269. package/dist/{core-FEBNVNVE.js → core-XYQRB5WF.js} +1 -1
  270. package/dist/{core-YP4MNIMV.js → core-Y6DJHIYT.js} +1 -1
  271. package/dist/{core-NTOOJZRA.js → core-YHWVJULU.js} +1 -1
  272. package/dist/{core-VLXOQ5CK.js → core-YJXOVNIE.js} +1 -1
  273. package/dist/{dataTable-FEQZSDUZ.js → dataTable-3ZK3ZEZP.js} +3 -2
  274. package/dist/{engine-SCQVNSAM.js → engine-FSWLRWZR.js} +19 -17
  275. package/dist/fixtures.js +1 -1
  276. package/dist/index.js +14 -13
  277. package/dist/{main-7UKLXCIL.js → main-NYMXWJGJ.js} +6 -5
  278. package/dist/mcp/server.js +11 -10
  279. package/dist/react/bar.js +1 -1
  280. package/dist/react/bartable.js +1 -1
  281. package/dist/react/box.js +1 -1
  282. package/dist/react/bullet.js +1 -1
  283. package/dist/react/butterfly.js +1 -1
  284. package/dist/react/choropleth.js +1 -1
  285. package/dist/react/cohort.js +2 -1
  286. package/dist/react/column.js +1 -1
  287. package/dist/react/combo.js +1 -1
  288. package/dist/react/creative.js +1 -1
  289. package/dist/react/diagram.js +1 -1
  290. package/dist/react/dimswitch.js +1 -1
  291. package/dist/react/dot.js +1 -1
  292. package/dist/react/export.js +24 -19
  293. package/dist/react/funnel.js +1 -1
  294. package/dist/react/gantt.js +1 -1
  295. package/dist/react/grid.js +1 -1
  296. package/dist/react/heatmap.js +2 -1
  297. package/dist/react/histogram.js +1 -1
  298. package/dist/react/index.js +84 -83
  299. package/dist/react/kpi.js +1 -1
  300. package/dist/react/likert.js +1 -1
  301. package/dist/react/line.js +2 -1
  302. package/dist/react/mekko.js +1 -1
  303. package/dist/react/pareto.js +1 -1
  304. package/dist/react/pie.js +1 -1
  305. package/dist/react/prepare.js +22 -20
  306. package/dist/react/pvm.js +1 -1
  307. package/dist/react/pyramid.js +1 -1
  308. package/dist/react/sankey.js +1 -1
  309. package/dist/react/scatter.js +2 -1
  310. package/dist/react/slope.js +1 -1
  311. package/dist/react/sparkline.js +1 -1
  312. package/dist/react/spec.js +10 -10
  313. package/dist/react/status.js +2 -1
  314. package/dist/react/story.js +3 -3
  315. package/dist/react/table.js +1 -1
  316. package/dist/react/theme.js +3 -3
  317. package/dist/react/tilemap.js +1 -1
  318. package/dist/react/treemap.js +1 -1
  319. package/dist/react/variance.js +1 -1
  320. package/dist/react/waffle.js +1 -1
  321. package/dist/react/waterfall.js +1 -1
  322. package/dist/{rowsModule-WJH4QNXZ.js → rowsModule-43LCK2Q7.js} +1 -1
  323. package/dist/{schema-MQT6BMNK.js → schema-2ACHQTR3.js} +1 -1
  324. package/dist/{schema-WZOSDDDJ.js → schema-3LRC5TOZ.js} +1 -1
  325. package/dist/{schema-F7TWGLRZ.js → schema-4HGZZNUL.js} +1 -1
  326. package/dist/{schema-PWPQF5RC.js → schema-4YIYGGOJ.js} +1 -1
  327. package/dist/{schema-ECJERHKF.js → schema-5OLQ54J5.js} +1 -1
  328. package/dist/{schema-CWKGLDSR.js → schema-5SVPR3EU.js} +1 -1
  329. package/dist/{schema-BA6WP5YZ.js → schema-A4U4RDKJ.js} +1 -1
  330. package/dist/{schema-JYZ4RF6S.js → schema-AM2KS6ZC.js} +1 -1
  331. package/dist/{schema-PYQEUC5P.js → schema-C25ECGJL.js} +1 -1
  332. package/dist/{schema-56MOEOVR.js → schema-CBLNGK2F.js} +1 -1
  333. package/dist/{schema-ESR6ZIK4.js → schema-D3ELHESU.js} +1 -1
  334. package/dist/{schema-5MSR4LNN.js → schema-FBIEOKO2.js} +1 -1
  335. package/dist/{schema-DUVJMFKQ.js → schema-FPDLOIA6.js} +1 -1
  336. package/dist/{schema-ALBF6V7Y.js → schema-FQWENOJY.js} +1 -1
  337. package/dist/{schema-DBIQFL56.js → schema-GTLGAPCU.js} +1 -1
  338. package/dist/{schema-Q5DACE4I.js → schema-GUDG343K.js} +2 -2
  339. package/dist/{schema-47BG2TZA.js → schema-GYTWCCNA.js} +1 -1
  340. package/dist/{schema-DL7V6NN2.js → schema-GYVYJEL3.js} +1 -1
  341. package/dist/{schema-ZU2EU2VP.js → schema-HAMPGUH3.js} +1 -1
  342. package/dist/{schema-TVUJNEX7.js → schema-IYBZPCM4.js} +1 -1
  343. package/dist/{schema-2TPGJGVR.js → schema-IYLRZNFB.js} +1 -1
  344. package/dist/{schema-KAK6DZX4.js → schema-KBV2JB2A.js} +1 -1
  345. package/dist/{schema-PV7JGX5H.js → schema-KWCIIIGP.js} +1 -1
  346. package/dist/{schema-Y4TI2T3T.js → schema-LDF6HORS.js} +1 -1
  347. package/dist/{schema-FKGGTM4Z.js → schema-LGYHJPXU.js} +1 -1
  348. package/dist/{schema-CBL2SMVR.js → schema-LX4EXDTI.js} +1 -1
  349. package/dist/{schema-2R32F6AW.js → schema-NNNG7CWG.js} +1 -1
  350. package/dist/{schema-OPXZYIW7.js → schema-P2JYSV32.js} +1 -1
  351. package/dist/{schema-FGB6IGZM.js → schema-PAKZIYQF.js} +1 -1
  352. package/dist/{schema-R42VXFIS.js → schema-SQ2GYLMI.js} +1 -1
  353. package/dist/{schema-KCJ6WTGV.js → schema-SUDJBIHX.js} +1 -1
  354. package/dist/{schema-MR3BPPQR.js → schema-TRPPZCIR.js} +1 -1
  355. package/dist/{schema-JIAQE7WO.js → schema-UNYDUIL5.js} +1 -1
  356. package/dist/{schema-5RIYEWE6.js → schema-VH4AW62Z.js} +1 -1
  357. package/dist/{schema-EDSEKZDJ.js → schema-WDKBCN3V.js} +1 -1
  358. package/dist/{schema-MOKWIGF7.js → schema-YCKUQ3FF.js} +1 -1
  359. package/dist/{schema-K7F6TEDK.js → schema-YVBUY7NH.js} +1 -1
  360. package/dist/{specValidation-DC4TVHWD.js → specValidation-FKHSTMMR.js} +1 -1
  361. package/dist/theme.js +2 -2
  362. package/dist/types/core/a11y/recordsShared.d.ts +15 -4
  363. package/dist/types/core/a11y/types.d.ts +0 -3
  364. package/dist/types/core/annotate.d.ts +17 -1
  365. package/dist/types/core/annotateTargets.d.ts +8 -0
  366. package/dist/types/core/charts/band/stacks.d.ts +4 -3
  367. package/dist/types/core/charts/bar/layout.d.ts +3 -1
  368. package/dist/types/core/charts/bartable/types.d.ts +3 -0
  369. package/dist/types/core/charts/box/types.d.ts +5 -0
  370. package/dist/types/core/charts/column/anomaly.d.ts +12 -5
  371. package/dist/types/core/charts/column/model.d.ts +4 -0
  372. package/dist/types/core/charts/combo/endpoints.d.ts +11 -1
  373. package/dist/types/core/charts/combo/layout.d.ts +7 -1
  374. package/dist/types/core/charts/dimswitch/compile.d.ts +20 -3
  375. package/dist/types/core/charts/grid/metricStack.d.ts +2 -4
  376. package/dist/types/core/charts/histogram/types.d.ts +3 -0
  377. package/dist/types/core/charts/likert/layout.d.ts +5 -2
  378. package/dist/types/core/charts/logAxis.d.ts +0 -5
  379. package/dist/types/core/charts/scatter/logAxis.d.ts +1 -1
  380. package/dist/types/core/charts/scatter/model.d.ts +10 -1
  381. package/dist/types/core/charts/scatter/trend.d.ts +19 -0
  382. package/dist/types/core/charts/table/view.d.ts +7 -0
  383. package/dist/types/core/charts/waffle/types.d.ts +8 -0
  384. package/dist/types/core/formatPrecision.d.ts +24 -0
  385. package/dist/types/core/formatSpec.d.ts +213 -61
  386. package/dist/types/core/label/solver.d.ts +3 -1
  387. package/dist/types/core/numberRule.d.ts +109 -0
  388. package/dist/types/core/numberSets.d.ts +43 -0
  389. package/dist/types/core/shownMarks.d.ts +16 -0
  390. package/dist/types/core/types/options.d.ts +8 -8
  391. package/dist/types/core/types/scene.d.ts +24 -0
  392. package/dist/types/core/types/table.d.ts +0 -13
  393. package/dist/types/react/TableChart.d.ts +9 -7
  394. package/dist/types/react/hover/engine.d.ts +6 -4
  395. package/dist/types/react/hover/labelCard.d.ts +4 -3
  396. package/dist/validate.js +5 -4
  397. package/docs/manual.md +15 -7
  398. package/docs/reference/bartable.md +2 -2
  399. package/docs/reference/cohort.md +1 -1
  400. package/docs/reference/column.md +1 -1
  401. package/docs/reference/dimswitch.md +2 -3
  402. package/docs/reference/fixtures.md +1 -1
  403. package/docs/reference/grid.md +13 -7
  404. package/docs/reference/heatmap.md +1 -1
  405. package/docs/reference/line.md +2 -2
  406. package/docs/reference/options.md +3 -3
  407. package/docs/reference/react.md +1 -1
  408. package/docs/reference/table.md +5 -8
  409. package/docs/reference/warnings.md +0 -1
  410. package/package.json +1 -1
  411. package/dist/chunk-2IRMGCYE.js +0 -125
  412. package/dist/chunk-WVCDISZP.js +0 -89
  413. package/dist/types/core/charts/table/fitFormats.d.ts +0 -67
  414. package/dist/types/core/charts/table/resolve.d.ts +0 -84
  415. package/dist/types/core/format.d.ts +0 -156
@@ -6,13 +6,14 @@ import {
6
6
  belowPrecision,
7
7
  chartString,
8
8
  checkedDecimals,
9
- currencyWholeNumbers,
10
9
  currentSmallValues,
11
- distinctDecimalLift,
12
10
  formatPercent,
13
11
  fractionFormat,
14
12
  groupInteger,
13
+ isAuthoredExample,
14
+ isMagnitudeLetter,
15
15
  isPercentagePointUnit,
16
+ isUnitStandIn,
16
17
  magnitudeSuffix,
17
18
  nonFiniteGlyph,
18
19
  nonzeroDecimals,
@@ -28,10 +29,15 @@ import {
28
29
  splitNumberMarks,
29
30
  underflowScientificText,
30
31
  withNumberMarks,
32
+ withSmallValues,
33
+ withUnitStandIns,
31
34
  withoutLeadingZero,
32
35
  wordLanguage,
33
36
  zeroLifts
34
- } from "./chunk-MSYTF3DZ.js";
37
+ } from "./chunk-FYFXOLWI.js";
38
+ import {
39
+ toJsonPointer
40
+ } from "./chunk-ZQ4VFQID.js";
35
41
  import {
36
42
  NormalizeError
37
43
  } from "./chunk-RJICOOB3.js";
@@ -40,6 +46,182 @@ import {
40
46
  minOf
41
47
  } from "./chunk-WYJEOMNY.js";
42
48
 
49
+ // src/core/numberRule.ts
50
+ var DEFAULT_FACE = { prefix: "", suffix: "", signed: !1, decimal: ".", group: ",", minus: "\u2212" }, WORDS = {
51
+ en: { 0: "", 3: "k", 6: "M", 9: "B", 12: "T" },
52
+ de: { 0: "", 3: " Tsd.", 6: " Mio.", 9: " Mrd.", 12: " Bio." },
53
+ fr: { 0: "", 3: "k", 6: "M", 9: " Md", 12: " Bn" }
54
+ }, SUPERSCRIPT = { "-": "\u207B", 0: "\u2070", 1: "\xB9", 2: "\xB2", 3: "\xB3", 4: "\u2074", 5: "\u2075", 6: "\u2076", 7: "\u2077", 8: "\u2078", 9: "\u2079" }, SMALL_DECIMALS = 4, P_VALUE_DECIMALS2 = 3, baseLanguage = (language) => language.toLowerCase().split(/[-_]/)[0];
55
+ function wordsOf(language) {
56
+ return WORDS[baseLanguage(language)] ?? WORDS.en;
57
+ }
58
+ var opensThousand = (language) => baseLanguage(language) !== "de", clean = (y) => Number(Math.abs(y).toPrecision(12));
59
+ function carried(y) {
60
+ let [m = "", e = "0"] = String(clean(y)).split("e");
61
+ return Math.max(0, (m.split(".")[1] ?? "").length - Number(e));
62
+ }
63
+ var MAX_PRINTED_DECIMALS = 100;
64
+ function round(abs, decimals) {
65
+ let d = Math.min(decimals, MAX_PRINTED_DECIMALS), s = String(abs);
66
+ return /e/i.test(s) ? abs.toFixed(d) : (Math.round(+`${s}e${d}`) / 10 ** d).toFixed(d);
67
+ }
68
+ var minOf2 = (xs) => xs.reduce((m, x) => x < m ? x : m, 1 / 0), maxOf2 = (xs) => xs.reduce((m, x) => x > m ? x : m, -1 / 0), groupDigits = (int, mark) => int.replace(/\B(?=(\d{3})+(?!\d))/g, mark), digits2 = (y) => Math.max(0, 1 - Math.floor(Math.log10(y))), digits3 = (y) => Math.max(0, 2 - Math.floor(Math.log10(y)));
69
+ function placeValues(values, set, cellThreshold) {
70
+ let thousand = opensThousand(set.language), pct = set.kind === "percent" || set.kind === "share", abs = values.map(Math.abs), largest = abs.reduce((m, a) => a > m ? a : m, 0), useWords = set.words ?? (!pct && !set.unitText && largest >= (cellThreshold ? 1e5 : 1e4)), scaleOf = (a) => set.scale ?? (useWords ? a >= 1e12 ? 12 : a >= 1e9 ? 9 : a >= 1e6 ? 6 : a >= 1e3 && thousand ? 3 : 0 : 0), groups = [], byAbs = /* @__PURE__ */ new Map(), rest = values.map((_, i) => i).filter((i) => values[i] !== 0).sort((a, b) => abs[b] - abs[a]);
71
+ for (; rest.length; ) {
72
+ let top = rest[0], s = scaleOf(abs[top]), y = (i) => clean(abs[i] / 10 ** s), ytop = y(top), band = rest.filter((i) => y(i) >= ytop / 10), first = groups.length === 0 && set.kind !== "share" && !set.change, d = first ? digits3(ytop) : digits2(minOf2(band.map(y)));
73
+ if (first) {
74
+ let power = 10 ** Math.floor(Math.log10(ytop));
75
+ d = Math.min(d, maxOf2(band.filter((i) => y(i) >= power).map((i) => carried(y(i)))));
76
+ }
77
+ let scaled = band.map((i) => values[i] / 10 ** s), spread = maxOf2(scaled) - minOf2(scaled);
78
+ spread > 0 && !set.change && (d = Math.max(d, digits2(spread))), d = Math.min(d, Math.max(2, digits3(ytop))), d = Math.min(d, maxOf2(band.map((i) => carried(y(i)))));
79
+ let group = { scale: s, decimals: d }, joins = (i) => digits2(y(i)) <= d || carried(y(i)) <= d, members = rest.filter((i) => i === top || joins(i));
80
+ for (let i of members) byAbs.set(abs[i], group);
81
+ let taken = new Set(members);
82
+ rest = rest.filter((i) => !taken.has(i)), groups.push(group);
83
+ }
84
+ return { words: useWords, groups, byAbs, scaleOf };
85
+ }
86
+ var builtSets = /* @__PURE__ */ new Map(), builtValues = 0, MAX_BUILT_VALUES = 2e5, hashFloat = new Float64Array(1), hashWords = new Uint32Array(hashFloat.buffer);
87
+ function valuesKey(values) {
88
+ let a = 2166136261, b = 2654435769;
89
+ for (let value of values)
90
+ hashFloat[0] = value, a = Math.imul(Math.imul(a ^ hashWords[0], 16777619) ^ hashWords[1], 16777619), b = Math.imul(Math.imul(b ^ hashWords[1], 1540483477) ^ hashWords[0], 1540483477), b ^= b >>> 15;
91
+ return `${values.length}:${(a >>> 0).toString(36)}:${(b >>> 0).toString(36)}`;
92
+ }
93
+ function sameValues(stored, values) {
94
+ if (stored.length !== values.length) return !1;
95
+ for (let index = 0; index < stored.length; index++) {
96
+ let a = stored[index], b = values[index];
97
+ if (a !== b && !(a !== a && b !== b)) return !1;
98
+ }
99
+ return !0;
100
+ }
101
+ function numberRuleSet(values, set) {
102
+ let key = `${set.kind}|${set.unitText ? 1 : 0}|${set.cell ? 1 : 0}|${set.words ?? ""}|${set.scale ?? ""}|${set.language}|${set.small ?? ""}|${set.change ? 1 : 0}|${valuesKey(values)}`, known = builtSets.get(key);
103
+ if (known && sameValues(known.values, values)) return known.built;
104
+ let built = buildRuleSet(values, set);
105
+ return builtValues + values.length > MAX_BUILT_VALUES && (builtSets.clear(), builtValues = 0), builtSets.set(key, { values: values.slice(), built }), builtValues += values.length + 1, built;
106
+ }
107
+ function buildRuleSet(values, set) {
108
+ let finite = values.filter((v) => Number.isFinite(v)), { words, groups, byAbs, scaleOf } = placeValues(finite, set, set.cell), lateGroups = /* @__PURE__ */ new Map();
109
+ return ruleSetFrom(set, finite, words, groups, (value) => {
110
+ let a = Math.abs(value);
111
+ if (a === 0) return { scale: 0, decimals: 0 };
112
+ let own = byAbs.get(a) ?? lateGroups.get(a);
113
+ if (own) return own;
114
+ let s = scaleOf(a), y = clean(a / 10 ** s), found = groups.find((g) => g.scale === s && (digits2(y) <= g.decimals || carried(y) <= g.decimals));
115
+ return found || (found = placeValues([value], { ...set, words }, set.cell).groups[0]), lateGroups.set(a, found), found;
116
+ });
117
+ }
118
+ function roundedAt(value, { scale, decimals }) {
119
+ return value === 0 || !Number.isFinite(value) ? value : Math.sign(value) * Number(round(clean(value / 10 ** scale), decimals)) * 10 ** scale;
120
+ }
121
+ function ruleSetFrom(set, values, words, groups, groupOf) {
122
+ let wordTable = wordsOf(set.language), smallText = (value, group, face) => {
123
+ let beyond = group.decimals > MAX_PRINTED_DECIMALS;
124
+ if (!set.small && !beyond || value === 0) return;
125
+ let a = Math.abs(value);
126
+ if (set.small === "p-value" && value > 0 && value <= 1) {
127
+ let r = round(clean(a), P_VALUE_DECIMALS2), digits = Number(r) === 0 ? `<${face.decimal}${"0".repeat(P_VALUE_DECIMALS2 - 1)}1` : r.replace(/^0(?=\.)/, "").replace(".", face.decimal);
128
+ return `${face.prefix}${digits}${face.suffix}`;
129
+ }
130
+ if (group.decimals <= SMALL_DECIMALS) return;
131
+ if (set.small === "bound" || set.small === "zero" || set.small === "p-value") {
132
+ let decimals = smallDecimals();
133
+ if (roundedAt(value, { scale: group.scale, decimals }) !== 0) return (value < 0 ? face.minus : face.signed ? "+" : "") + core(value, face, decimals);
134
+ let zero = `${face.prefix}0${decimals > 0 ? face.decimal + "0".repeat(decimals) : ""}${face.suffix}`;
135
+ if (set.small === "zero") return zero;
136
+ let step = decimals > 0 ? `0${face.decimal}${"0".repeat(decimals - 1)}1` : "1";
137
+ return value > 0 ? `<${face.signed ? "+" : ""}${face.prefix}${step}${face.suffix}` : `>${face.minus}${face.prefix}${step}${face.suffix}`;
138
+ }
139
+ let unscaled = (power) => power < -300 ? a * 1e300 / 10 ** (power + 300) : a / 10 ** power, exponent = Math.floor(Math.log10(a)), mantissa = Number(round(clean(unscaled(exponent)), 1));
140
+ mantissa >= 10 && (mantissa = Number(round(clean(unscaled(++exponent)), 1)));
141
+ let sci = `${mantissa.toFixed(1).replace(".", face.decimal)}\xA0\xD7\xA010${String(exponent).replace(/[-\d]/g, (c) => SUPERSCRIPT[c])}`;
142
+ return `${value < 0 ? face.minus : face.signed ? "+" : ""}${face.prefix}${sci}${face.suffix}`;
143
+ }, smallDecimals = () => Math.min(groups[0]?.decimals ?? 0, SMALL_DECIMALS), core = (value, face, atDecimals) => {
144
+ if (value === 0) return `${face.prefix}0${face.suffix}`;
145
+ let { scale, decimals: own } = groupOf(value), decimals = atDecimals ?? own, [int = "0", fraction] = round(clean(value / 10 ** scale), decimals).split("."), digits = groupDigits(int, face.group) + (fraction ? face.decimal + fraction : "");
146
+ return `${face.prefix}${digits}${face.bare ? "" : wordTable[scale] ?? ""}${face.suffix}`;
147
+ }, texts = /* @__PURE__ */ new Map(), text = (value, face = DEFAULT_FACE) => {
148
+ let byValue = texts.get(face);
149
+ byValue || texts.set(face, byValue = /* @__PURE__ */ new Map());
150
+ let printed = byValue.get(value);
151
+ return printed === void 0 && (printed = smallText(value, groupOf(value), face) ?? (value < 0 ? face.minus : face.signed && value > 0 ? "+" : "") + core(value, face), byValue.set(value, printed)), printed;
152
+ }, roundedValues;
153
+ return { set, values, words, groups, groupOf, core, text, rounded: (value) => {
154
+ if (value === 0 || !Number.isFinite(value)) return value;
155
+ let known = (roundedValues ??= /* @__PURE__ */ new Map()).get(value);
156
+ if (known === void 0) {
157
+ let { scale, decimals } = groupOf(value), asBound = set.small === "bound" || set.small === "p-value" && !(value > 0 && value <= 1), small = (asBound || set.small === "zero") && decimals > SMALL_DECIMALS ? roundedAt(value, { scale, decimals: smallDecimals() }) : void 0;
158
+ known = small === void 0 || small === 0 && asBound ? roundedAt(value, { scale, decimals }) : small, roundedValues.set(value, known);
159
+ }
160
+ return known;
161
+ } };
162
+ }
163
+ function tickScale(of, largest) {
164
+ if (of.set.scale !== void 0) return of.set.scale;
165
+ if (!of.words) return 0;
166
+ let a = Math.abs(largest);
167
+ return a >= 1e12 ? 12 : a >= 1e9 ? 9 : a >= 1e6 ? 6 : a >= 1e3 && opensThousand(of.set.language) ? 3 : 0;
168
+ }
169
+ function fixedRuleSet(of, group) {
170
+ let byGroup = fixedSets.get(of);
171
+ byGroup || fixedSets.set(of, byGroup = /* @__PURE__ */ new Map());
172
+ let key = `${group.scale}|${group.decimals}`, known = byGroup.get(key);
173
+ if (known) return known;
174
+ let zero = { scale: 0, decimals: 0 }, only = { scale: group.scale, decimals: group.decimals }, fixed = ruleSetFrom({ ...of.set, small: void 0 }, [], of.words, [only], (value) => value === 0 ? zero : only);
175
+ return byGroup.set(key, fixed), fixed;
176
+ }
177
+ var fixedSets = /* @__PURE__ */ new WeakMap();
178
+
179
+ // src/core/numberSets.ts
180
+ var CURRENCY_CODES = new Set(Intl.supportedValuesOf("currency"));
181
+ function isUnitText(unit) {
182
+ if (unit === void 0) return !1;
183
+ let text = unit.trim();
184
+ if (text === "" || text === "%" || text === "pp") return !1;
185
+ let sign = /^(\p{Lu}{0,3})\p{Sc}$/u.exec(text);
186
+ return sign ? isMagnitudeLetter(sign[1]) : !CURRENCY_CODES.has(text);
187
+ }
188
+ function isPercentUnit(unit) {
189
+ let text = unit?.trim();
190
+ return text === "%" || text === "pp";
191
+ }
192
+ function numberSetOf(locale, declared = {}) {
193
+ let { language, small } = splitNumberMarks(locale ?? "en");
194
+ return {
195
+ kind: declared.kind ?? (isPercentUnit(declared.unit) ? "percent" : "number"),
196
+ unitText: isUnitText(declared.unit),
197
+ cell: declared.cell ?? !1,
198
+ ...declared.words !== void 0 ? { words: declared.words } : {},
199
+ ...declared.scale !== void 0 ? { scale: declared.scale } : {},
200
+ ...declared.change ? { change: !0 } : {},
201
+ language,
202
+ ...small ? { small } : {}
203
+ };
204
+ }
205
+ function finiteValues(values) {
206
+ let out = [];
207
+ for (let value of values) typeof value == "number" && Number.isFinite(value) && out.push(value);
208
+ return out;
209
+ }
210
+ function ruleSetOf(values, locale, declared = {}) {
211
+ return numberRuleSet(finiteValues(values), numberSetOf(locale, declared));
212
+ }
213
+ function printFace(locale, prefix = "", suffix = "", signed = !1, group) {
214
+ let marks = splitNumberMarks(locale ?? "en").marks, thousands = group ?? marks?.thousands ?? ",";
215
+ return { prefix, suffix, signed, decimal: marks?.decimal ?? ".", group: thousands === " " ? "\xA0" : thousands, minus: "\u2212" };
216
+ }
217
+ function ruleFormatter(values, locale, declared = {}, prefix = "", suffix = "") {
218
+ let rule = ruleSetOf(values, locale, declared), plain = printFace(locale, prefix, suffix, !1), signedFace = printFace(locale, prefix, suffix, !0);
219
+ return (value, signed = !1) => rule.text(value, signed ? signedFace : plain);
220
+ }
221
+ function statisticSet(values, of) {
222
+ return numberRuleSet(finiteValues(values), { ...of.set, words: of.words });
223
+ }
224
+
43
225
  // src/core/unitJoin.ts
44
226
  var SYMBOL_UNIT = /^([$€£¥])?\s*(k|m|mm|mn|bn|%|x|×)?$/i, SIGN_WORD = /^([$€£¥])\s*(\p{L}.*)$/u, signAfter = /* @__PURE__ */ new Map();
45
227
  function currencyAfter(locale) {
@@ -66,7 +248,50 @@ function withUnit(text, unit, deduplicatePercent = !1, locale) {
66
248
  }
67
249
 
68
250
  // src/core/formatSpec.ts
69
- var AUTOMATIC_FORMAT = /* @__PURE__ */ Symbol("automatic-format"), MAGNITUDE_GROUP = /* @__PURE__ */ Symbol("magnitude-group"), MAGNITUDE_FIGURES = /* @__PURE__ */ Symbol("magnitude-figures"), LABEL_ONLY_ROW = /* @__PURE__ */ Symbol("label-only-row"), WORD_END = String.raw`(?![\p{L}\p{N}]|-\p{L})`, MAGNITUDE_SUFFIXES = [
251
+ var AUTOMATIC_FORMAT = /* @__PURE__ */ Symbol("automatic-format"), MAGNITUDE_GROUP = /* @__PURE__ */ Symbol("magnitude-group"), MAGNITUDE_FIGURES = /* @__PURE__ */ Symbol("magnitude-figures"), PERIOD_FIGURES = /* @__PURE__ */ Symbol("period-figures"), ENGINE_SCALE = /* @__PURE__ */ Symbol("engine-scale"), LABEL_ONLY_ROW = /* @__PURE__ */ Symbol("label-only-row"), RULE_SET = /* @__PURE__ */ Symbol("rule-set"), SCALE_MAGNITUDE = { 0: "none", 3: "k", 6: "m", 9: "bn", 12: "t" };
252
+ function ruleSpec(rule, locale, prefix = "", suffix = "") {
253
+ let first = rule.groups[0] ?? { scale: 0, decimals: 0 };
254
+ return { ...defaultFormatSpec(locale), prefix, suffix, magnitude: SCALE_MAGNITUDE[first.scale], decimals: first.decimals, rollMagnitude: !1, [RULE_SET]: rule };
255
+ }
256
+ function defaultSetSpec(values, locale, unit, declared = {}) {
257
+ return ruleSpec(numberRuleSet(finiteValues(values), numberSetOf(locale, { unit, ...declared })), locale);
258
+ }
259
+ function statisticFormatter(values, of) {
260
+ let rule = of[RULE_SET];
261
+ if (!rule) return (value) => formatStatWithSpec(value, of);
262
+ let spec = { ...of, [RULE_SET]: statisticSet(values, rule) };
263
+ return (value) => formatWithSpec(value, spec);
264
+ }
265
+ function joinedChangeSpec(levels, changes) {
266
+ let rule = levels[RULE_SET];
267
+ if (rule)
268
+ return { ...levels, signed: !0, [RULE_SET]: numberRuleSet([...rule.values, ...finiteValues(changes)], rule.set) };
269
+ }
270
+ function percentChangeSpec(values, locale, suffix = "", kind = "percent") {
271
+ return { ...ruleSpec(numberRuleSet(finiteValues(values), numberSetOf(locale, { kind, change: !0 })), locale, "", suffix), signed: !0 };
272
+ }
273
+ function ruleStatistics(spec, level) {
274
+ if (spec[RULE_SET])
275
+ return { level, set: (values) => statisticFormatter(values, spec) };
276
+ }
277
+ function withoutRuleSet(spec) {
278
+ if (!spec[RULE_SET]) return spec;
279
+ let { [RULE_SET]: _rule, ...plain } = spec;
280
+ return plain;
281
+ }
282
+ var ruleFaces = /* @__PURE__ */ new Map(), facesBySpec = /* @__PURE__ */ new WeakMap();
283
+ function ruleFace(spec) {
284
+ let own = facesBySpec.get(spec);
285
+ if (own) return own;
286
+ let key = `${spec.locale ?? ""}\0${spec.prefix}\0${spec.suffix}\0${spec.signed ? 1 : 0}${spec.thousandsSep === "" ? 0 : 1}${spec.magnitudeInAffix ? 1 : 0}`, face = ruleFaces.get(key);
287
+ return face || (ruleFaces.size >= 1024 && ruleFaces.clear(), ruleFaces.set(key, face = { ...printFace(spec.locale, spec.prefix, spec.suffix, spec.signed, spec.thousandsSep === "" ? "" : void 0), bare: spec.magnitudeInAffix === !0 })), facesBySpec.set(spec, face), face;
288
+ }
289
+ function ruleText(value, spec, rule, face = ruleFace(spec)) {
290
+ if (value == null || !Number.isFinite(value)) return formatWithSpecUncached(value, withoutRuleSet(spec));
291
+ let plain = Object.is(value, -0) ? 0 : value;
292
+ return spec.glyphs || spec.negative !== "minus" ? signedText(rule.core(plain, face), plain < 0, plain === 0, spec) : rule.text(plain, face);
293
+ }
294
+ var WORD_END = String.raw`(?![\p{L}\p{N}]|-\p{L})`, MAGNITUDE_SUFFIXES = [
70
295
  { re: new RegExp(String.raw`^(?:trillions?|billionen)${WORD_END}`, "iu"), key: "t" },
71
296
  { re: new RegExp(String.raw`^(?:billions?|milliard(?:en?|s)?)${WORD_END}`, "iu"), key: "bn" },
72
297
  { re: new RegExp(String.raw`^(?:thousands?|tausend)${WORD_END}`, "iu"), key: "k" },
@@ -247,7 +472,7 @@ function spreadsheetExample(code) {
247
472
  }
248
473
  function isCurrency(text) {
249
474
  let trimmed = text.trim();
250
- return /^\p{Sc}$/u.test(trimmed) || CURRENCY_CODES.has(trimmed.toUpperCase());
475
+ return /^\p{Sc}$/u.test(trimmed) || CURRENCY_CODES2.has(trimmed.toUpperCase());
251
476
  }
252
477
  function currencyAffixMagnitude(text) {
253
478
  if (!/[A-Za-z]/.test(text)) return;
@@ -255,18 +480,24 @@ function currencyAffixMagnitude(text) {
255
480
  if (!/^[\p{Sc}\p{L}. ]+$/u.test(trimmed)) return;
256
481
  let magnitude = unitMagnitude(trimmed);
257
482
  if (magnitude)
258
- return /\p{Sc}/u.test(trimmed) || CURRENCY_CODES.has(trimmed.slice(0, 3).toUpperCase()) || CURRENCY_CODES.has(trimmed.slice(-3).toUpperCase()) ? magnitude : void 0;
483
+ return /\p{Sc}/u.test(trimmed) || CURRENCY_CODES2.has(trimmed.slice(0, 3).toUpperCase()) || CURRENCY_CODES2.has(trimmed.slice(-3).toUpperCase()) ? magnitude : void 0;
259
484
  }
260
485
  function unitOnlyExample(text) {
261
486
  if (/[0-9]/.test(text)) return;
262
487
  let unit = text.trim();
263
488
  if (/^(?:%|pp|x|×)$/.test(unit)) return `1.2${unit}`;
264
489
  if (/^\p{Sc}$/u.test(unit)) return `${unit}1,234`;
265
- if (CURRENCY_CODES.has(unit.toUpperCase())) return `1.2 ${unit}`;
490
+ if (CURRENCY_CODES2.has(unit.toUpperCase())) return `1.2 ${unit}`;
266
491
  if (!currencyAffixMagnitude(unit)) return;
267
492
  let symbol = /^\p{Sc}/u.exec(unit)?.[0];
268
493
  return symbol ? `${symbol}1.2${unit.slice(symbol.length)}` : /\p{Sc}$/u.test(unit) ? `1.2${unit}` : `1.2 ${unit}`;
269
494
  }
495
+ function withChartFormats(options, run) {
496
+ return withSmallValues(options?.smallValues, () => withUnitStandIns(options, run));
497
+ }
498
+ function isExactExample(example) {
499
+ return unitOnlyExample(String(example)) === void 0 && !isUnitStandIn(example) && isAuthoredExample(example);
500
+ }
270
501
  function formatExampleText(example) {
271
502
  if (isSpreadsheetCode(example)) {
272
503
  let translated = spreadsheetExample(example);
@@ -374,8 +605,32 @@ function treeNumbers(node, into = [], seen = /* @__PURE__ */ new Set()) {
374
605
  }
375
606
  return into;
376
607
  }
608
+ function writtenExamples(data, options) {
609
+ let wrote = /* @__PURE__ */ new Set(), collect = (example, owner) => (owner[AUTOMATIC_FORMAT] !== !0 && wrote.add(example), example);
610
+ return mapExamples(data, collect), mapExamples(options, collect), new Set([...wrote].flatMap((example) => {
611
+ try {
612
+ return [example, differenceExample(example)];
613
+ } catch {
614
+ return [example];
615
+ }
616
+ }));
617
+ }
618
+ var UNIT_FORMATS = /* @__PURE__ */ Symbol("unit-formats");
619
+ function withAuthoredUnits(options) {
620
+ let formats = options[UNIT_FORMATS];
621
+ if (!formats?.length) return options;
622
+ let restore = (node, path, format) => {
623
+ if (path.length === 0) return node === format.example ? format.unit : node;
624
+ if (node === null || typeof node != "object") return node;
625
+ let [key, ...rest] = path, child = node[key], next = restore(child, rest, format);
626
+ if (next === child) return node;
627
+ let copy = Array.isArray(node) ? [...node] : { ...node };
628
+ return copy[key] = next, copy;
629
+ };
630
+ return formats.reduce((current, format) => restore(current, format.path, format), options);
631
+ }
377
632
  function readFormatExamples(data, options) {
378
- let warnings = [], warned = /* @__PURE__ */ new Set(), allNumbers, numbersOf = (owner) => {
633
+ let warnings = [], unitFormats = [], warned = /* @__PURE__ */ new Set(), written = /* @__PURE__ */ new Set(), wrote = /* @__PURE__ */ new Set(), byAuthor = (example, owner) => (owner[AUTOMATIC_FORMAT] !== !0 && wrote.add(example), example), allNumbers, numbersOf2 = (owner) => {
379
634
  let own = normalizedSeriesNumbers(owner);
380
635
  if (own) return own;
381
636
  let table = data;
@@ -399,19 +654,35 @@ function readFormatExamples(data, options) {
399
654
  })), translated.example;
400
655
  let standIn = unitOnlyExample(example);
401
656
  if (!standIn) return example;
402
- let numbers2 = numbersOf(owner);
403
- if (!numbers2?.length) return standIn;
657
+ let wroteStandIn = (written2) => (field[0] === "options" && unitFormats.push({ path: field.slice(1), unit: example, example: written2 }), wroteStandInText(written2)), numbers2 = numbersOf2(owner);
658
+ if (!numbers2?.length) return wroteStandIn(standIn);
404
659
  let spec = parseFormatExample(standIn), smallest = 1 / 0;
405
660
  for (let value of numbers2) {
406
661
  let scaled = Math.abs(value / MAGNITUDE_DIVISOR[spec.magnitude]);
407
662
  scaled > 0 && scaled < smallest && (smallest = scaled);
408
663
  }
409
664
  let figures = smallest < 1 ? Math.min(20, 1 - Math.floor(Math.log10(smallest))) : 0, decimals = Math.max(rasterDecimals(numbers2, spec), figures), body = numericBody(standIn), whole = spec.thousandsSep ? "1,234" : decimals === 3 ? "0" : "1";
410
- return standIn.slice(0, body.index) + whole + (decimals ? `.${"5".repeat(decimals)}` : "") + standIn.slice(body.index + body.text.trimEnd().length);
411
- }, examples = /* @__PURE__ */ new Set(), collect = (example) => (decimalExample(example) !== void 0 && examples.add(example), example), originalData = data, originalOptions = options, plain = { value: !0 }, rewriteAndCollect = (example, owner, field) => collect(rewrite(example, owner, field));
412
- if (data = mapExamples(data, rewriteAndCollect, void 0, "format", ["data"], plain), options = mapExamples(options, rewriteAndCollect, void 0, "format", ["options"], plain), (!plain.value || data !== originalData || options !== originalOptions) && (examples.clear(), mapExamples(data, collect), mapExamples(options, collect)), examples.size === 0) return { data, options, warnings };
665
+ return wroteStandIn(standIn.slice(0, body.index) + whole + (decimals ? `.${"5".repeat(decimals)}` : "") + standIn.slice(body.index + body.text.trimEnd().length));
666
+ }, wroteStandInText = (standIn) => (written.add(standIn), standIn), examples = /* @__PURE__ */ new Set(), collect = (example) => (decimalExample(example) !== void 0 && examples.add(example), example), originalData = data, originalOptions = options, plain = { value: !0 }, rewriteAndCollect = (example, owner, field) => collect(byAuthor(rewrite(example, owner, field), owner));
667
+ if (data = mapExamples(data, rewriteAndCollect, void 0, "format", ["data"], plain), options = mapExamples(options, rewriteAndCollect, void 0, "format", ["options"], plain), !plain.value || data !== originalData || options !== originalOptions) {
668
+ examples.clear(), wrote.clear();
669
+ let recollect = (example, owner) => collect(byAuthor(example, owner));
670
+ mapExamples(data, recollect), mapExamples(options, recollect);
671
+ }
672
+ let standIns = (change2) => new Set([...written].flatMap((example) => [change2(example), differenceExample(change2(example))])), authored = (change2) => new Set([...wrote].flatMap((example) => {
673
+ let read = change2(example);
674
+ try {
675
+ return [read, differenceExample(read)];
676
+ } catch {
677
+ return [read];
678
+ }
679
+ }));
680
+ if (examples.size === 0) return { data, options, warnings, standIns: standIns((example) => example), authored: authored((example) => example), unitFormats };
413
681
  let numbers = treeNumbers(data), readings = new Map([...examples].map((example) => [example, exampleReading(example, numbers)])), change = (example) => readings.get(example)?.decimals ?? example;
414
682
  return {
683
+ standIns: standIns(change),
684
+ authored: authored(change),
685
+ unitFormats: unitFormats.map((format) => ({ ...format, example: change(format.example) })),
415
686
  data: mapExamples(data, change),
416
687
  options: mapExamples(options, change),
417
688
  warnings: [...warnings, ...[...readings].flatMap(([example, { lost }]) => lost === void 0 ? [] : [{
@@ -501,23 +772,17 @@ var MAGNITUDE_PREVIOUS = { k: "none", m: "k", bn: "m", t: "bn" }, MAGNITUDE_NEXT
501
772
  bn: "t",
502
773
  t: null
503
774
  };
504
- function printsWholeInSet(value, spec, decimals) {
505
- return !!spec.setScale && Number(roundHalfUp(Math.abs(value) / MAGNITUDE_DIVISOR[spec.magnitude], decimals)) >= 1e3;
506
- }
507
775
  function effectiveScale(value, spec) {
776
+ let rule = spec[RULE_SET];
777
+ if (rule) {
778
+ let group = rule.groupOf(value);
779
+ return { magnitude: SCALE_MAGNITUDE[group.scale], decimals: group.decimals };
780
+ }
508
781
  let magnitude = spec.magnitude, currencyWhole = spec.currencyWhole && magnitude === "none" && Math.abs(value) >= 1e3, checked = checkedDecimals(spec.decimals), baseDecimals = currencyWhole ? 0 : checked, decimals = baseDecimals;
509
782
  if (magnitude === "none")
510
- return spec.wholeCounts && Number.isInteger(value) ? { magnitude, decimals: 0 } : { magnitude, decimals: spec.wholeFrom && Number(roundHalfUp(Math.abs(value), decimals)) >= spec.wholeFrom ? 0 : decimals };
511
- if (spec.autoMagnitude) {
512
- for (; magnitude !== "none" && Math.abs(value) < MAGNITUDE_DIVISOR[magnitude]; ) magnitude = MAGNITUDE_PREVIOUS[magnitude];
513
- for (; magnitude !== spec.magnitude; ) {
514
- let scaled = value / MAGNITUDE_DIVISOR[magnitude], own = Math.max(spec.stepDecimals ?? 0, neededDecimals(scaled, Math.max(decimals, 2)));
515
- if (Number(roundHalfUp(Math.abs(scaled), own)) < 1e3) return { magnitude, decimals: own };
516
- magnitude = magnitude === "none" ? "k" : MAGNITUDE_NEXT[magnitude];
517
- }
518
- }
783
+ return { magnitude, decimals: spec.wholeFrom && Number(roundHalfUp(Math.abs(value), decimals)) >= spec.wholeFrom ? 0 : decimals };
519
784
  if (spec.rollMagnitude === !1)
520
- return printsWholeInSet(value, spec, decimals) ? { magnitude, decimals: 0 } : spec.nonzero && !spec.automatic ? { magnitude, decimals: nonzeroDecimals(value / MAGNITUDE_DIVISOR[magnitude], decimals) } : { magnitude, decimals };
785
+ return spec.nonzero && !spec.automatic ? { magnitude, decimals: nonzeroDecimals(value / MAGNITUDE_DIVISOR[magnitude], decimals) } : { magnitude, decimals };
521
786
  if (spec.lockMagnitude) return { magnitude, decimals: magnitude === "k" ? 0 : decimals };
522
787
  for (; ; ) {
523
788
  let scaled = Math.abs(value) / MAGNITUDE_DIVISOR[magnitude];
@@ -621,10 +886,26 @@ function boundSpecTexts() {
621
886
  sharedTexts.clear(), specTexts = 0, textGeneration++;
622
887
  }
623
888
  }
889
+ var engineNumbers = !1;
890
+ function asEngineNumbers(print) {
891
+ let outer = engineNumbers;
892
+ engineNumbers = !0;
893
+ try {
894
+ return print();
895
+ } finally {
896
+ engineNumbers = outer;
897
+ }
898
+ }
624
899
  function formatWithSpec(value, spec) {
625
- return value == null || !Number.isFinite(value) || Object.is(value, -0) ? formatWithSpecUncached(value, spec) : (boundSpecTexts(), formatPlannedNumber(value, spec, textPlan(spec).texts));
900
+ let rule = spec[RULE_SET];
901
+ return rule ? ruleText(value, spec, rule) : (engineNumbers && spec.exact && (spec = engineNumberSpec(spec)), value == null || !Number.isFinite(value) || Object.is(value, -0) ? formatWithSpecUncached(value, spec) : (boundSpecTexts(), formatPlannedNumber(value, spec, textPlan(spec).texts)));
626
902
  }
627
903
  function compileNumberFormat(spec) {
904
+ let rule = spec[RULE_SET];
905
+ if (rule) {
906
+ let face = ruleFace(spec);
907
+ return (value) => ruleText(value, spec, rule, face);
908
+ }
628
909
  let plan;
629
910
  return (value) => value == null || !Number.isFinite(value) || Object.is(value, -0) ? formatWithSpecUncached(value, spec) : (boundSpecTexts(), (plan === void 0 || plan.generation !== textGeneration || plan.small !== currentSmallValues()) && (plan = textPlan(spec)), formatPlannedNumber(value, spec, plan.texts));
630
911
  }
@@ -678,7 +959,12 @@ function formatWithSpecUncached(value, spec) {
678
959
  let core = `${spec.prefix}${num}${spec.suffix}`;
679
960
  return signedText(core, negative, isZero, spec);
680
961
  }
962
+ function printsBound(text) {
963
+ return /^[$€£¥]?[<>]/.test(text.trim());
964
+ }
681
965
  function roundedNumber(value, spec) {
966
+ let rule = spec[RULE_SET];
967
+ if (rule) return rule.rounded(value);
682
968
  if (spec.exponent && Number.isFinite(value)) return exampleScientific(value, spec).value;
683
969
  let { magnitude, decimals } = effectiveScale(value, spec), divisor = MAGNITUDE_DIVISOR[magnitude], scaled = value / divisor;
684
970
  if (spec.automatic && scaled === 0 && value !== 0) return Number(value.toPrecision(1));
@@ -692,11 +978,35 @@ function localized(spec, locale) {
692
978
  return locale ? { ...spec, locale } : spec;
693
979
  }
694
980
  function exampleSpec(example, locale, unit, values) {
981
+ return specOfExample(example, isExactExample(example), locale, unit, values);
982
+ }
983
+ function specOfExample(example, exact, locale, unit, values) {
695
984
  let spec = localized(parseFormatExample(example, !0), locale);
696
- if (spec.nonzero = !0, spec.magnitude !== "none" && unitMagnitude(unit) === spec.magnitude && (spec.rollMagnitude = !1), values && shareAuthoredScale(spec, [...values]), spec.prefix.endsWith("#") || spec.exponent) return spec;
985
+ if (!exact && values && (unitOnlyExample(String(example)) !== void 0 || isUnitStandIn(example))) return unitOnlySpec(spec, unit, values);
986
+ if (exact) {
987
+ let before = { ...spec };
988
+ before.magnitude !== "none" && unitMagnitude(unit) === before.magnitude && (before.rollMagnitude = !1), values && shareAuthoredScale(before, [...values]), exactly(spec), spec[ENGINE_SCALE] = { magnitude: before.magnitude, decimals: before.decimals, rollMagnitude: before.rollMagnitude, from: { magnitude: spec.magnitude, decimals: spec.decimals } };
989
+ } else
990
+ spec.nonzero = !0, spec.magnitude !== "none" && unitMagnitude(unit) === spec.magnitude && (spec.rollMagnitude = !1), values && shareAuthoredScale(spec, [...values]);
991
+ if (spec.prefix.endsWith("#") || spec.exponent) return spec;
697
992
  let body = numericBody(formatExampleText(String(example)))?.text ?? "", integer = spec.decimals > 0 ? body.slice(0, body.lastIndexOf(spec.decimalSep)) : body;
698
993
  return spec.thousandsSep === "" && integer.replace(/\D/g, "").length < 4 && (spec.thousandsSep = spec.decimalSep === "," ? "." : ","), spec;
699
994
  }
995
+ var RULE_SCALE = { none: 0, k: 3, m: 6, bn: 9, t: 12 };
996
+ function unitOnlySpec(spec, unit, values) {
997
+ let stated = spec.magnitude === "none" ? void 0 : RULE_SCALE[spec.magnitude], affix = (spec.prefix + spec.suffix).trim(), declared = {
998
+ unit: isUnitText(unit) ? unit : affix,
999
+ kind: isPercentUnit(affix) || isPercentUnit(unit) ? "percent" : "number",
1000
+ ...stated === void 0 ? {} : { scale: stated }
1001
+ }, rule = numberRuleSet(finiteValues(values), numberSetOf(spec.locale, declared));
1002
+ return stated === void 0 ? ruleSpec(rule, spec.locale, spec.prefix, spec.suffix) : { ...ruleSpec(rule, spec.locale, spec.prefix, magnitudeText(spec, spec.magnitude) + spec.suffix), magnitudeInAffix: !0 };
1003
+ }
1004
+ function exactly(spec) {
1005
+ return spec.exact = !0, spec.magnitude !== "none" && (spec.rollMagnitude = !1), spec;
1006
+ }
1007
+ function exactExampleSpec(example, locale) {
1008
+ return isExactExample(example) ? exactly(localized(parseFormatExample(example, !0), locale)) : void 0;
1009
+ }
700
1010
  function shareFormatExample(options, series = []) {
701
1011
  if (options.shareLabels?.format) return formatExampleText(options.shareLabels.format);
702
1012
  let percent = (example) => example !== void 0 && parseFormatExample(example).suffix.includes("%"), own = series[0]?.format;
@@ -706,9 +1016,18 @@ function formatterFromExample(example, locale, unit, values) {
706
1016
  let spec = exampleSpec(example, locale, unit, values);
707
1017
  return (value) => formatWithSpec(value, spec);
708
1018
  }
1019
+ function engineNumberSpec(spec) {
1020
+ if (!spec.exact) return spec;
1021
+ let before = spec[ENGINE_SCALE], own = { ...spec, exact: void 0, nonzero: !0, rollMagnitude: before?.rollMagnitude };
1022
+ return before && spec.magnitude === before.from.magnitude && (own.magnitude = before.magnitude), before && spec.decimals === before.from.decimals && (own.decimals = before.decimals), own;
1023
+ }
1024
+ function engineFormatterFromExample(example, locale, unit, values) {
1025
+ let spec = engineNumberSpec(exampleSpec(example, locale, unit, values));
1026
+ return (value) => formatWithSpec(value, spec);
1027
+ }
709
1028
  function formatNonzeroWithSpec(value, spec) {
710
- if (spec.automatic || spec.nonzero && spec.magnitude !== "none") return formatWithSpec(value, spec);
711
- let scaled = value / MAGNITUDE_DIVISOR[spec.autoMagnitude ? effectiveScale(value, spec).magnitude : spec.magnitude], lifted = nonzeroDecimals(scaled, spec.decimals);
1029
+ if (engineNumbers && spec.exact && (spec = engineNumberSpec(spec)), spec.automatic || spec.exact || spec.nonzero && spec.magnitude !== "none") return formatWithSpec(value, spec);
1030
+ let scaled = value / MAGNITUDE_DIVISOR[spec.magnitude], lifted = nonzeroDecimals(scaled, spec.decimals);
712
1031
  return formatWithSpec(value, { ...spec, decimals: roundsToZero(scaled, lifted) ? spec.decimals : lifted });
713
1032
  }
714
1033
  function signedFormatterFromExample(example, locale, unit, values) {
@@ -724,7 +1043,8 @@ function levelFormatterFromExample(example, locale, unit, values) {
724
1043
  return (value) => formatWithSpec(value, level);
725
1044
  }
726
1045
  function differenceExample(example) {
727
- return example = formatExampleText(example), specUnitKind(parseFormatExample(example)) === "percent" ? example.replace(/%/g, "pp") : example;
1046
+ let text = formatExampleText(example), percent = specUnitKind(parseFormatExample(text)) === "percent";
1047
+ return text !== example && unitOnlyExample(example) !== void 0 ? percent ? "pp" : example : percent ? text.replace(/%/g, "pp") : text;
728
1048
  }
729
1049
  function decimalCap(scaled, authored = 0) {
730
1050
  let max = 0;
@@ -747,22 +1067,33 @@ function rasterDecimals(values, spec) {
747
1067
  for (let value of values) {
748
1068
  if (value == null || !Number.isFinite(value)) continue;
749
1069
  let scaled = value / divisor;
750
- spec.magnitude !== "none" && Math.abs(scaled) >= 1e3 || spec.autoMagnitude && Math.abs(scaled) < 1 || shown.push(scaled);
1070
+ spec.magnitude !== "none" && Math.abs(scaled) >= 1e3 || shown.push(scaled);
751
1071
  }
752
1072
  if (shown.length === 0) return spec.decimals;
753
1073
  let cap = spec.automatic ? Math.min(AUTO_MAX_DECIMALS, decimalCap(shown, spec.decimals)) : decimalCap(shown, spec.decimals), largest = maxOf(shown.map(Math.abs)), scale = largest > 0 && largest < 1 ? largest : 1;
754
1074
  return shown.reduce((max, scaled) => {
755
- let needed = neededDecimals(scaled, cap, scale, spec.decimals), owed = spec.autoMagnitude ? Math.max(spec.decimals, 1) : spec.decimals;
756
- return Math.max(max, Math.abs(scaled) >= 100 ? Math.min(owed, needed) : needed);
1075
+ let needed = neededDecimals(scaled, cap, scale, spec.decimals);
1076
+ return Math.max(max, Math.abs(scaled) >= 100 ? Math.min(spec.decimals, needed) : needed);
757
1077
  }, 0);
758
1078
  }
759
1079
  function formatStatWithSpec(value, spec) {
1080
+ let rule = spec[RULE_SET];
1081
+ if (rule) return ruleText(value, spec, statisticSet([value], rule));
760
1082
  if (spec.exponent) return formatWithSpec(value, spec);
761
- let own = { ...spec, wholeFrom: void 0 }, scaled = value / MAGNITUDE_DIVISOR[effectiveScale(value, own).magnitude];
762
- return formatWithSpec(value, { ...own, decimals: Math.max(spec.decimals, neededDecimals(scaled, spec.decimals + 1)) });
1083
+ let own = { ...engineNumberSpec(spec), wholeFrom: void 0 }, scaled = value / MAGNITUDE_DIVISOR[effectiveScale(value, own).magnitude];
1084
+ return formatWithSpec(value, { ...own, decimals: Math.max(own.decimals, neededDecimals(scaled, own.decimals + 1)) });
763
1085
  }
764
1086
  function trendRateFormatter(example, locale, unit, signed = !1) {
765
- let spec = example ? exampleSpec(example, locale) : defaultFormatSpec(locale), face = {
1087
+ if (!example) {
1088
+ let points = isPercentUnit(unit);
1089
+ return (rate) => withUnit(
1090
+ formatWithSpec(rate, { ...defaultSetSpec([rate], locale, points ? void 0 : unit, points ? { kind: "percent" } : {}), suffix: points ? "pp" : "", signed }),
1091
+ points ? void 0 : unit,
1092
+ !1,
1093
+ locale
1094
+ );
1095
+ }
1096
+ let spec = exampleSpec(example, locale), face = {
766
1097
  ...spec,
767
1098
  automatic: !1,
768
1099
  signed,
@@ -815,66 +1146,284 @@ function percentRasterFormatter(values, locale) {
815
1146
  value == null || !Number.isFinite(value) || (decimals = Math.max(decimals, neededDecimals(value)));
816
1147
  return (value) => formatPercent(value, Math.max(decimals, smallRateDecimals(value)), !1, locale, !0);
817
1148
  }
818
- function unscaledFormatLint(options, data, geo, records) {
819
- let places = formatPlaces(data), chart = typeof options?.format == "string" ? options.format : void 0, zeros = /* @__PURE__ */ new Map();
820
- if (places.length > 0 || chart !== void 0)
821
- for (let record of records?.() ?? []) {
822
- if (!printsZero(record)) continue;
823
- let place = places.find((at) => at.authored === record.value.format && at.owns(record.target.owner));
824
- place === void 0 && record.value.format !== chart || zeros.set(place, [...zeros.get(place) ?? [], record]);
1149
+ function unscaledFormatLint(options, data, geo, records, context = {}) {
1150
+ return withUnitStandIns(options, () => {
1151
+ let chart = typeof options?.format == "string" ? options.format : void 0, places = formatPlaces(data, chart, options?.axisFormat), exact = /* @__PURE__ */ new Map();
1152
+ for (let place of places) {
1153
+ let read = exactPlace(place);
1154
+ read && exact.set(place, read);
825
1155
  }
826
- return [...chartFormatLint(options, data, geo, zeros.get(void 0) ?? []), ...places.flatMap((place) => placeZeroWarning(place, zeros.get(place) ?? []))];
1156
+ let zeroDrawn, drawsZero = () => zeroDrawn ??= context.zeroDrawn?.() ?? (geo !== void 0 && drawsZeroNumber(geo.scene)), scene = geo?.scene ?? context.scene, suspect = !1;
1157
+ for (let [place, read] of exact)
1158
+ if (mayHide(read.spec, place.sets) || mayHide(read.spec, [place.stated ?? [], place.loose ?? [], place.totals ?? []], !0) || place.computed && scene !== void 0 && oneCellText(scene, place.computed.colId)) {
1159
+ suspect = !0;
1160
+ break;
1161
+ }
1162
+ let judging = exact.size > 0 && (suspect || drawsZero() || scene !== void 0 && drawsZeroLine(scene)), held = places.length > 0 && (judging || drawsZero()) ? records?.() ?? void 0 : void 0, locale = withNumberMarks({ locale: options?.locale }).locale.language, unit = typeof options?.unit == "string" ? options.unit : void 0, stated = /* @__PURE__ */ new Map(), zeros = /* @__PURE__ */ new Map(), state = (place, entry) => {
1163
+ entry && stated.set(place, [...stated.get(place) ?? [], entry]);
1164
+ };
1165
+ if (held)
1166
+ for (let record of held) {
1167
+ let owner = record.target.owner, place = places.find((at) => printsThrough(at, exact.get(at), owner, record.value));
1168
+ if (place !== void 0 && (exact.has(place) ? judging && state(place, statedEntry(place, record.value, owner, locale)) : drawsZero() && printsZero(record) && zeros.set(place, [...zeros.get(place) ?? [], record])), !!judging)
1169
+ for (let field of record.fields ?? []) {
1170
+ if (field.value.kind !== "number" || field.value.format === void 0) continue;
1171
+ let at = places.find((candidate) => exact.has(candidate) && printsThrough(candidate, exact.get(candidate), owner, field.value));
1172
+ at && state(at, statedEntry(at, field.value, owner, locale, !0));
1173
+ }
1174
+ }
1175
+ else if (judging)
1176
+ for (let [place, read] of exact) stated.set(place, dataEntries(place, read, locale));
1177
+ if (judging) for (let [place, read] of exact) for (let entry of statedOutside(place, read, locale)) state(place, entry);
1178
+ let warn = (place) => {
1179
+ let read = exact.get(place);
1180
+ return read ? exactFormatWarning(place, read, stated.get(place) ?? [], locale, unit, context.verify) : placeZeroWarning(place, zeros.get(place) ?? []);
1181
+ }, chartPlace = places.find((place) => place.kind === "chart"), chartRead = chartPlace && exact.get(chartPlace);
1182
+ return [
1183
+ ...chartFormatLint(options, data, geo, chartPlace && !chartRead ? zeros.get(chartPlace) ?? [] : [], chartRead ? () => warn(chartPlace) : void 0),
1184
+ ...places.flatMap((place) => place.kind === "chart" ? [] : warn(place))
1185
+ ];
1186
+ });
827
1187
  }
828
1188
  function drawsZeroNumber(scene) {
829
1189
  return scene.some((node) => node.t === "text" && ((node.id.split("/").pop() ?? "").startsWith("label:") || node.part === "tableCell" && node.role !== "category") && (node.lines.join(" ").match(/\d[\d.,]*/g) ?? []).some((token) => !/[1-9]/.test(token)));
830
1190
  }
1191
+ function drawsZeroLine(scene) {
1192
+ return scene.some((node) => node.t === "text" && node.part === "tableCellLine" && (node.lines.join(" ").match(/\d[\d.,]*/g) ?? []).some((token) => !/[1-9]/.test(token)));
1193
+ }
831
1194
  var cellOf = (entry) => typeof entry == "object" && entry !== null && "categoryId" in entry && "value" in entry ? entry.value : entry, ownFormat = (entry) => {
832
1195
  let cell = cellOf(entry);
833
1196
  return typeof cell == "object" && cell !== null ? cell.format : void 0;
834
- }, numberIn = (entry) => {
835
- if (ownFormat(entry) !== void 0) return [];
836
- let cell = cellOf(entry), value = typeof cell == "number" ? cell : cell?.number ?? cell?.v;
1197
+ }, numberOfCell = (cell) => {
1198
+ let value = typeof cell == "number" ? cell : cell?.number ?? cell?.v;
837
1199
  return typeof value == "number" && Number.isFinite(value) ? [value] : [];
838
- }, printsZero = ({ value }) => value.state === "value" && typeof value.raw == "number" && Number.isFinite(value.raw) && value.raw !== 0 && value.displayed !== void 0 && /\d/.test(value.displayed) && !/[1-9]/.test(value.displayed);
839
- function formatPlaces(data) {
840
- let own = data, places = [[], [], [], []], add = (rank, authored, numbers, path, owns) => {
841
- typeof authored == "string" && places[rank].push({ authored, numbers, path, owns });
842
- }, categories = Array.isArray(own?.categories) ? own.categories : [], categoryAt = (entry, j) => {
1200
+ }, numberIn = (entry) => ownFormat(entry) !== void 0 ? [] : numberOfCell(cellOf(entry)), cellParts = (entry) => {
1201
+ let cell = cellOf(entry);
1202
+ return { cell, format: typeof cell == "object" && cell !== null ? cell.format : void 0, number: numberOfCell(cell) };
1203
+ }, printsZero = ({ value }) => value.state === "value" && typeof value.raw == "number" && Number.isFinite(value.raw) && value.raw !== 0 && value.displayed !== void 0 && zeroText(value.displayed), zeroText = (text) => /\d/.test(text) && !/[1-9]/.test(text);
1204
+ function formatPlaces(data, chart, axes) {
1205
+ let own = data, places = [[], [], [], [], []], add = (rank, kind, authored, sets, path, owns, more = {}) => {
1206
+ typeof authored == "string" && places[rank].push({ authored, kind, sets, path, owns, ...more });
1207
+ }, chartSets = [], categories = Array.isArray(own?.categories) ? own.categories : [], categoryAt = (entry, j) => {
843
1208
  let category = categories[j];
844
1209
  return typeof entry == "object" && entry !== null && "categoryId" in entry ? entry.categoryId : typeof category == "object" && category !== null ? category.id : category;
845
1210
  };
846
1211
  (Array.isArray(own?.series) ? own.series : []).forEach((series, i) => {
847
- let values = Array.isArray(series?.values) ? series.values : [];
848
- values.forEach((entry, j) => add(
849
- 0,
850
- ownFormat(entry),
851
- [],
852
- ["data", "series", i, "values", j, ...cellOf(entry) === entry ? [] : ["value"], "format"],
853
- (owner) => owner.seriesId === series.id && owner.categoryId === categoryAt(entry, j)
854
- )), add(2, series?.format, values.flatMap(numberIn), ["data", "series", i, "format"], (owner) => owner.seriesId === series?.id);
1212
+ let values = Array.isArray(series?.values) ? series.values : [], numbers = [];
1213
+ values.forEach((entry, j) => {
1214
+ let { cell, format, number } = cellParts(entry);
1215
+ format === void 0 ? numbers.push(...number) : add(
1216
+ 0,
1217
+ "cell",
1218
+ format,
1219
+ [number],
1220
+ ["data", "series", i, "values", j, ...cell === entry ? [] : ["value"], "format"],
1221
+ (owner) => (owner.seriesId === series.id || owner.seriesId === void 0 && own.series.length === 1) && owner.categoryId === categoryAt(entry, j)
1222
+ );
1223
+ }), add(2, "series", series?.format, [numbers], ["data", "series", i, "format"], (owner) => owner.seriesId === series?.id || owner.seriesId === void 0 && own.series.length === 1), typeof series?.format != "string" && chartSets.push(numbers);
855
1224
  });
856
- let walk = (list, path) => (Array.isArray(list) ? list : []).forEach((row, i) => {
857
- for (let [colId, cell] of Object.entries(row?.cells ?? {}))
858
- add(0, ownFormat(cell), [], [...path, i, "cells", colId, "format"], (owner) => owner.rowId === row.id && owner.colId === colId);
859
- add(1, row?.format, Object.values(row?.cells ?? {}).flatMap(numberIn), [...path, i, "format"], (owner) => owner.rowId === row?.id), walk(row?.children, [...path, i, "children"]);
1225
+ let columns = Array.isArray(own?.columns) ? own.columns : [], columnFormat = new Set(columns.filter((column) => !Array.isArray(column?.values) && typeof column?.format == "string").map((column) => column.id)), byColumn = /* @__PURE__ */ new Map(), chartByColumn = /* @__PURE__ */ new Map(), listOf = (lists, id) => {
1226
+ let list = lists.get(id);
1227
+ return list === void 0 && lists.set(id, list = []), list;
1228
+ }, bulletRows = !1, walk = (list, path) => (Array.isArray(list) ? list : []).forEach((row, i) => {
1229
+ let rowNumbers = [], chartRow = [], bullet = row?.cells === void 0 && row !== null && typeof row == "object" && ("value" in row || "target" in row);
1230
+ bullet && (bulletRows = !0);
1231
+ let ownsRow = (owner) => owner.rowId === row?.id || bullet && owner.rowId === void 0 && owner.categoryId === row?.id;
1232
+ if (bullet) {
1233
+ let { format, number } = cellParts(row.value);
1234
+ format !== void 0 ? add(0, "cell", format, [number], [...path, i, "value", "format"], ownsRow) : (typeof row.format == "string" ? rowNumbers : chartRow).push(...number);
1235
+ }
1236
+ for (let [colId, entry] of Object.entries(row?.cells ?? {})) {
1237
+ let { format, number } = cellParts(entry);
1238
+ if (format !== void 0) {
1239
+ add(0, "cell", format, [number], [...path, i, "cells", colId, "format"], (owner) => owner.rowId === row.id && owner.colId === colId);
1240
+ continue;
1241
+ }
1242
+ typeof row?.format == "string" ? rowNumbers.push(...number) : columnFormat.has(colId) ? listOf(byColumn, colId).push(...number) : (chartRow.push(...number), listOf(chartByColumn, colId).push(...number));
1243
+ }
1244
+ add(1, "row", row?.format, [rowNumbers], [...path, i, "format"], ownsRow), chartRow.length && chartSets.push(chartRow), walk(row?.children, [...path, i, "children"]);
860
1245
  });
861
- return walk(own?.rows, ["data", "rows"]), (Array.isArray(own?.columns) ? own.columns : []).forEach((column, i) => add(
1246
+ walk(own?.rows, ["data", "rows"]), chartSets.push(...chartByColumn.values()), columns.forEach((column, i) => add(
862
1247
  3,
1248
+ "column",
863
1249
  column?.format,
864
- Array.isArray(column?.values) ? column.values.flatMap(numberIn) : [],
1250
+ [Array.isArray(column?.values) ? column.values.flatMap(numberIn) : byColumn.get(column?.id) ?? []],
865
1251
  ["data", "columns", i, "format"],
866
- (owner) => owner.colId === column?.id
867
- )), places.flat();
1252
+ (owner) => owner.colId === column?.id,
1253
+ column?.kind === "computed" ? { computed: { colId: column.id } } : {}
1254
+ )), (Array.isArray(own?.measures) ? own.measures : []).forEach((measure, i) => add(
1255
+ 2,
1256
+ "series",
1257
+ measure?.format,
1258
+ [],
1259
+ ["data", "measures", i, "format"],
1260
+ (owner) => measure?.id !== void 0 && measureOfRow(owner.rowId) === measure.id,
1261
+ { zeroOnly: !0 }
1262
+ ));
1263
+ let statusChart = [];
1264
+ (Array.isArray(own?.cells) ? own.cells : []).forEach((cell, i) => {
1265
+ let { format, number } = cellParts(cell?.value);
1266
+ format !== void 0 ? add(0, "cell", format, [], ["data", "cells", i, "value", "format"], () => !1, { stated: number, zeroOnly: !0 }) : statusChart.push(...number);
1267
+ });
1268
+ let points = Array.isArray(own?.points) ? own.points : void 0, coordinates = (axis) => (points ?? []).flatMap((point) => numberOfCell(point?.[axis])), extent = (values) => values.length ? [values.reduce((a, b) => Math.min(a, b)), values.reduce((a, b) => Math.max(a, b))] : [];
1269
+ if (points) for (let axis of ["x", "y"])
1270
+ add(2, "axis", axes?.[axis], [], ["options", "axisFormat", axis], () => !1, { stated: extent(coordinates(axis)), zeroOnly: !0 });
1271
+ typeof own?.format == "string" && !Array.isArray(own?.series) && add(2, "series", own.format, [[...numberOfCell(own.value), ...numberOfCell(own.delta?.vs), ...Array.isArray(own.spark?.values) ? own.spark.values.flatMap(numberOfCell) : []]], ["data", "format"], () => !0), Array.isArray(own?.values) && chartSets.push(own.values.flatMap(numberIn));
1272
+ let isTotal = (item) => typeof item == "object" && item !== null && ["total", "subtotal"].includes(String(item.type)), totals = Array.isArray(own?.items) ? own.items.filter(isTotal).flatMap((item) => numberIn(item?.value)) : [];
1273
+ Array.isArray(own?.items) && chartSets.push(own.items.filter((item) => !isTotal(item)).flatMap((item) => numberIn(item?.value)));
1274
+ let regions = Array.isArray(own?.regions) ? own.regions : typeof own?.regions == "object" && own.regions !== null ? Object.values(own.regions) : [];
1275
+ if (regions.length && chartSets.push(regions.flatMap((region) => numberIn(typeof region == "object" && region !== null && "value" in region ? region.value : region))), chart !== void 0) {
1276
+ let place = { authored: chart, kind: "chart", sets: chartSets, path: ["options", "format"], owns: () => !0 };
1277
+ points ? Object.assign(place, { zeroOnly: !0, loose: [...coordinates("x"), ...coordinates("y")] }) : statusChart.length ? Object.assign(place, { stated: statusChart, zeroOnly: !0 }) : chartSets.some((set) => set.length) || (place.loose = numbersOf(data)), totals.length && (place.totals = totals), bulletRows && (place.zeroOnly = !0), places[4].push(place);
1278
+ }
1279
+ return places.flat();
1280
+ }
1281
+ function measureOfRow(rowId) {
1282
+ if (!(typeof rowId != "string" || !rowId.startsWith("[")))
1283
+ try {
1284
+ return JSON.parse(rowId.slice(0, rowId.lastIndexOf("]") + 1))[2];
1285
+ } catch {
1286
+ return;
1287
+ }
1288
+ }
1289
+ function numbersOf(node, depth = 0) {
1290
+ return typeof node == "number" ? Number.isFinite(node) ? [node] : [] : node === null || typeof node != "object" || depth > 6 ? [] : Object.values(node).flatMap((value) => numbersOf(value, depth + 1));
1291
+ }
1292
+ function exactPlace(place) {
1293
+ if (!(unitOnlyExample(place.authored) !== void 0 || isUnitStandIn(place.authored)))
1294
+ try {
1295
+ let text = formatExampleText(place.authored), format = exampleReading(text, place.sets.flat()).decimals ?? text, spec = parseFormatExample(format, !0);
1296
+ return spec.ordinal || spec.exponent ? void 0 : { format, spec };
1297
+ } catch {
1298
+ return;
1299
+ }
1300
+ }
1301
+ function printsThrough(place, read, owner, value) {
1302
+ if (!place.owns(owner)) return !1;
1303
+ let format = value.format;
1304
+ return format === place.authored ? !0 : read !== void 0 && (place.computed ? value.derived !== void 0 : format === read.format || format !== void 0 && changeFaces(read.format).has(format));
1305
+ }
1306
+ var faces = /* @__PURE__ */ new Map();
1307
+ function changeFaces(format) {
1308
+ let found = faces.get(format);
1309
+ if (found === void 0) {
1310
+ let difference = format;
1311
+ try {
1312
+ difference = differenceExample(format);
1313
+ } catch {
1314
+ }
1315
+ let signed = (example) => example.startsWith("+") ? example : `+${example}`;
1316
+ found = new Set([difference, signed(difference), signed(format)].filter((face) => face !== format)), faces.set(format, found);
1317
+ }
1318
+ return found;
1319
+ }
1320
+ function mayHide(spec, sets, zeroOnly = !1) {
1321
+ let figures = spec.significantDigits, step = MAGNITUDE_DIVISOR[spec.magnitude] / 10 ** spec.decimals;
1322
+ for (let set of sets) {
1323
+ let low = 1 / 0, high = -1 / 0;
1324
+ for (let value of set) {
1325
+ if (figures === void 0 && value !== 0 && Math.abs(value) < step * 0.5000001) return !0;
1326
+ value < low && (low = value), value > high && (high = value);
1327
+ }
1328
+ if (!zeroOnly && high > low && (figures === void 0 ? high - low < step * 1.0000001 : Number(low.toPrecision(figures)) === Number(high.toPrecision(figures)))) return !0;
1329
+ }
1330
+ return !1;
1331
+ }
1332
+ function oneCellText(scene, colId) {
1333
+ let text, cells = 0;
1334
+ for (let node of scene) {
1335
+ if (node.t !== "text" || node.part !== "tableCell" || node.owner?.colId !== colId) continue;
1336
+ let line = node.lines.join(" ");
1337
+ if (text !== void 0 && line !== text) return !1;
1338
+ text = line, cells++;
1339
+ }
1340
+ return cells > 1;
1341
+ }
1342
+ function statedEntry(place, value, owner, locale, field = !1) {
1343
+ if (value.state !== "value" || value.kind !== "number" || typeof value.raw != "number" || !Number.isFinite(value.raw)) return;
1344
+ let text = value.displayed ?? (value.format !== void 0 ? formatWithSpec(value.raw, exampleSpec(value.format, locale, value.unit)) : void 0);
1345
+ return text === void 0 ? void 0 : { raw: value.raw, text, sets: field || value.derived !== void 0 ? [] : setsOf(place, owner) };
868
1346
  }
869
- function placeZeroWarning({ authored, numbers, path }, zeroed) {
1347
+ function setsOf(place, owner) {
1348
+ return place.kind === "cell" || place.zeroOnly ? [] : place.kind !== "chart" ? [place.kind] : owner.rowId !== void 0 || owner.colId !== void 0 ? [...owner.rowId !== void 0 ? [`row:${String(owner.rowId)}`] : [], ...owner.colId !== void 0 ? [`column:${String(owner.colId)}`] : []] : [`series:${String(owner.seriesId ?? "")}`];
1349
+ }
1350
+ function dataEntries(place, read, locale) {
1351
+ let spec = specOfExample(read.format, !0, locale);
1352
+ return [
1353
+ ...place.sets.flatMap((set, i) => set.map((raw) => ({ raw, text: formatWithSpec(raw, spec), sets: place.kind === "cell" || place.zeroOnly ? [] : [`${place.kind === "chart" ? "series" : place.kind}:${i}`] }))),
1354
+ ...(place.totals ?? []).map((raw) => ({ raw, text: formatWithSpec(raw, spec), sets: [] }))
1355
+ ];
1356
+ }
1357
+ function statedOutside(place, read, locale) {
1358
+ if (!place.stated?.length) return [];
1359
+ let spec = specOfExample(read.format, !0, locale);
1360
+ return place.stated.map((raw) => ({ raw, text: formatWithSpec(raw, spec), sets: [] }));
1361
+ }
1362
+ var SET_NAMES = { series: "a series", row: "a table row", column: "a table column" }, hidesSet = (set) => set.length > 1 && new Set(set.map((entry) => entry.text)).size === 1 && new Set(set.map((entry) => Number(entry.raw.toPrecision(12)))).size > 1;
1363
+ function exactFormatWarning(place, read, stated, locale, unit, verify) {
1364
+ let zeroed = stated.find((entry) => entry.raw !== 0 && zeroText(entry.text)), bySet = /* @__PURE__ */ new Map();
1365
+ for (let entry of stated) for (let key of entry.sets) bySet.set(key, [...bySet.get(key) ?? [], entry]);
1366
+ let hidden = zeroed ? void 0 : [...bySet].find(([, set]) => hidesSet(set));
1367
+ if (!zeroed && !hidden) return [];
1368
+ let pointer = toJsonPointer(place.path), patch = examplePatch(
1369
+ read,
1370
+ stated,
1371
+ [...bySet.values()],
1372
+ locale,
1373
+ unit,
1374
+ (example) => verify === void 0 || verify([{ op: "replace", path: pointer, value: example }], place.path)
1375
+ ), shown = zeroed ? `prints the nonzero value ${Number(zeroed.raw.toPrecision(12))} as ${zeroed.text}` : `prints the different values of ${SET_NAMES[hidden[0].split(":")[0]]} as one text, ${hidden[1][0].text}`, doubled = place.kind === "chart" && read.spec.magnitude !== "none" && unitMagnitude(unit) === read.spec.magnitude;
1376
+ return [{
1377
+ code: "format-hides-values",
1378
+ severity: "warn",
1379
+ message: doubled ? `options.unit '${unit}' says the values are already in its scale, and format '${read.format}' divides them by that scale again: it ${shown}` : `format '${read.format}' ${shown}`,
1380
+ suggest: patch === void 0 ? "remove the format to let the engine pick the precision: no example of the same style shows every value on this chart" : doubled ? `drop the scale from the format, such as '${patch}', and keep options.unit` : `set a format such as '${patch}', or remove the format to let the engine pick the precision`,
1381
+ field: place.path,
1382
+ ...patch === void 0 ? {} : { fix: [{ op: "replace", path: pointer, value: patch }] }
1383
+ }];
1384
+ }
1385
+ function examplePatch(read, stated, sets, locale, unit, proves) {
1386
+ let nonzero = stated.filter((entry) => entry.raw !== 0).map((entry) => entry.raw), apart = sets.filter((set) => new Set(set.map((entry) => Number(entry.raw.toPrecision(12)))).size > 1).map((set) => set.map((entry) => entry.raw)), shows = (example) => {
1387
+ let spec;
1388
+ try {
1389
+ spec = specOfExample(example, !0, locale, unit);
1390
+ } catch {
1391
+ return !1;
1392
+ }
1393
+ return nonzero.every((value) => !zeroText(formatWithSpec(value, spec))) && apart.every((set) => new Set(set.map((value) => formatWithSpec(value, spec))).size > 1);
1394
+ }, largest = nonzero.reduce((most, value) => Math.max(most, Math.abs(value)), 0);
1395
+ for (let example of patchExamples(read.format, read.spec, largest)) if (shows(example) && proves(example)) return example;
1396
+ }
1397
+ var SCALES_DOWN = ["t", "bn", "m", "k", "none"], MAX_PATCH_FIGURES = 15;
1398
+ function* patchExamples(format, spec, largest) {
1399
+ if (spec.significantDigits !== void 0) {
1400
+ let figures = /@+/.exec(format);
1401
+ if (!figures) return;
1402
+ for (let count = spec.significantDigits + 1; count <= MAX_PATCH_FIGURES; count++) yield format.slice(0, figures.index) + "@".repeat(count) + format.slice(figures.index + figures[0].length);
1403
+ return;
1404
+ }
1405
+ let found = numericBody(format);
1406
+ if (!found) return;
1407
+ let body = found.text.trimEnd(), before = format.slice(0, found.index), after = format.slice(found.index + body.length), word = spec.magnitudeWord !== void 0 && after.startsWith(spec.magnitudeWord.text) ? spec.magnitudeWord.text : void 0, below = spec.magnitude === "none" ? [] : spec.magnitudeInAffix ? ["none"] : word === void 0 ? [] : SCALES_DOWN.slice(SCALES_DOWN.indexOf(spec.magnitude) + 1), fit = largest >= MAGNITUDE_DIVISOR[spec.magnitude] ? spec.magnitude : below.find((scale) => largest >= MAGNITUDE_DIVISOR[scale]) ?? below.at(-1) ?? spec.magnitude, plain = { ...spec, locale: void 0 }, at = (scale, digits) => scale === spec.magnitude ? before + digits + after : spec.magnitudeInAffix ? affixWithoutScale(before) + digits + affixWithoutScale(after) : before + digits + (scale === "none" ? "" : magnitudeText(plain, scale, digits)) + after.slice(word.length);
1408
+ for (let scale of fit === spec.magnitude ? [fit] : [fit, spec.magnitude])
1409
+ for (let decimals = spec.decimals; decimals <= 20; decimals++)
1410
+ decimals === spec.decimals && scale === spec.magnitude || (yield at(scale, decimals === spec.decimals ? body : finerBody(spec, decimals)));
1411
+ }
1412
+ function finerBody(spec, decimals) {
1413
+ return formatWithSpec(
1414
+ (spec.thousandsSep ? 1234 : decimals === 3 ? 0 : 1) + 0.123456789,
1415
+ { ...spec, decimals, signed: !1, prefix: "", suffix: "", magnitude: "none", magnitudeWord: void 0, locale: void 0, exact: void 0, significantDigits: void 0 }
1416
+ );
1417
+ }
1418
+ function placeZeroWarning({ authored, sets, path }, zeroed) {
870
1419
  if (zeroed.length === 0) return [];
871
1420
  let format, spec;
872
1421
  try {
873
- format = formatExampleText(authored), format = exampleReading(format, numbers).decimals ?? format, spec = parseFormatExample(format);
1422
+ format = formatExampleText(authored), format = exampleReading(format, sets.flat()).decimals ?? format, spec = parseFormatExample(format);
874
1423
  } catch {
875
1424
  return [];
876
1425
  }
877
- let finer = finerShowing(format, spec, zeroed.map((record) => record.value.raw)), pointer = `/${path.map((part) => String(part).replace(/~/g, "~0").replace(/\//g, "~1")).join("/")}`;
1426
+ let finer = finerShowing(format, spec, zeroed.map((record) => record.value.raw)), pointer = toJsonPointer(path);
878
1427
  return [{
879
1428
  code: "format-hides-values",
880
1429
  severity: "warn",
@@ -898,12 +1447,9 @@ function finerShowing(format, spec, values) {
898
1447
  }
899
1448
  function finerExample(format, spec, found, decimals) {
900
1449
  let body = found.text.trimEnd();
901
- return format.slice(0, found.index) + formatWithSpec(
902
- (spec.thousandsSep ? 1234 : decimals === 3 ? 0 : 1) + 0.123456789,
903
- { ...spec, decimals, signed: !1, prefix: "", suffix: "", magnitude: "none", magnitudeWord: void 0, locale: void 0 }
904
- ) + format.slice(found.index + body.length);
1450
+ return format.slice(0, found.index) + finerBody(spec, decimals) + format.slice(found.index + body.length);
905
1451
  }
906
- function chartFormatLint(options, data, geo, zeroRecords) {
1452
+ function chartFormatLint(options, data, geo, zeroRecords, exactWarning) {
907
1453
  let authored = typeof options?.format == "string" ? options.format : void 0, own = data, numbers = [
908
1454
  ...Array.isArray(own?.series) ? own.series.filter((series) => typeof series?.format != "string") : [],
909
1455
  ...Array.isArray(own?.values) ? [own] : [],
@@ -918,6 +1464,8 @@ function chartFormatLint(options, data, geo, zeroRecords) {
918
1464
  field: ["options", "unit"]
919
1465
  }];
920
1466
  if (!authored) return [];
1467
+ let hides = exactWarning?.() ?? [];
1468
+ if (hides.length > 0) return hides;
921
1469
  let format, spec;
922
1470
  try {
923
1471
  format = formatExampleText(authored), format = exampleReading(format, numbers.flat()).decimals ?? format, spec = parseFormatExample(format);
@@ -925,8 +1473,8 @@ function chartFormatLint(options, data, geo, zeroRecords) {
925
1473
  return [];
926
1474
  }
927
1475
  if (spec.ordinal || spec.exponent) return [];
928
- let body = numericBody(format), figures = spec.significantDigits, checked = options?.variant !== "bump" && !spec.suffix.includes("%") && figures === void 0, zeroed = zeroRecords.map((record) => record.value.raw), locale = withNumberMarks({ locale: options?.locale }).locale.language, shared = spec.magnitude !== "none" && figures === void 0 ? seriesRasterFormatter(format, numbers.flat(), locale, unit) : void 0, raised = checked && shared !== void 0 && shared.spec.decimals > spec.decimals, smallest = numbers.flat().reduce((small, v) => v !== 0 && (small === 0 || Math.abs(v) < Math.abs(small)) ? v : small, 0), distinct = (row) => new Set(row.map((v) => Number(v.toPrecision(12)))).size, hidden = (row) => distinct(row) > 1 && new Set(row.map((v) => formatWithSpec(v, spec))).size === 1;
929
- if ((checked && numbers.some(hidden) || raised || zeroed.length > 0) && body) {
1476
+ let body = numericBody(format), figures = spec.significantDigits, checked = options?.variant !== "bump" && !spec.suffix.includes("%") && figures === void 0, zeroed = zeroRecords.map((record) => record.value.raw), locale = withNumberMarks({ locale: options?.locale }).locale.language, shared = exactWarning === void 0 && spec.magnitude !== "none" && figures === void 0 ? seriesRasterFormatter(format, numbers.flat(), locale, unit) : void 0, raised = checked && shared !== void 0 && shared.spec.decimals > spec.decimals, smallest = numbers.flat().reduce((small, v) => v !== 0 && (small === 0 || Math.abs(v) < Math.abs(small)) ? v : small, 0), distinct = (row) => new Set(row.map((v) => Number(v.toPrecision(12)))).size, hidden = (row) => distinct(row) > 1 && new Set(row.map((v) => formatWithSpec(v, spec))).size === 1, hidesRow = checked && exactWarning === void 0 && numbers.some(hidden);
1477
+ if (exactWarning === void 0 && (hidesRow || raised || zeroed.length > 0) && body) {
930
1478
  let finerAt = (decimals2) => finerExample(format, spec, body, decimals2), shows = (example) => {
931
1479
  let finerSpec = parseFormatExample(example), print = (v) => formatWithSpec(v, finerSpec);
932
1480
  return zeroed.every((v) => print(v) !== print(0)) && numbers.every((row) => !hidden(row) || new Set(row.map(print)).size >= distinct(row));
@@ -973,7 +1521,7 @@ function drawnNumberTexts(geo) {
973
1521
  ...geo.scene.flatMap((node) => node.t === "text" && (node.id.includes(":tick:") || node.part === "tableCell" && node.role !== "category") ? [node.lines.join(" ")] : [])
974
1522
  ];
975
1523
  }
976
- var MAGNITUDE_UNIT = /^\W*(?:([a-z]{3})(\W*))?(k|mm?|mn|bn?|tn|tsd|mio|mrd|bio|thousands?|tausend|millions?|millionen|billions?|billionen|trillions?|milliard(?:en?|s)?)\W*(?:([a-z]{3})\W*)?$/i, CURRENCY_CODES = new Set(Intl.supportedValuesOf("currency")), SCALED_NOUN_UNIT = /^(?!.*\bper\b)(k|mm?|mn|bn?|tn|tsd|mio|mrd|bio|thousands?|tausend|millions?|millionen|billions?|billionen|trillions?|milliard(?:en?|s)?)\.?\s+\p{L}+(?:\s+\p{L}+)*$/iu, scaleOfWord = (word) => {
1524
+ var MAGNITUDE_UNIT = /^\W*(?:([a-z]{3})(\W*))?(k|mm?|mn|bn?|tn|tsd|mio|mrd|bio|thousands?|tausend|millions?|millionen|billions?|billionen|trillions?|milliard(?:en?|s)?)\W*(?:([a-z]{3})\W*)?$/i, CURRENCY_CODES2 = new Set(Intl.supportedValuesOf("currency")), SCALED_NOUN_UNIT = /^(?!.*\bper\b)(k|mm?|mn|bn?|tn|tsd|mio|mrd|bio|thousands?|tausend|millions?|millionen|billions?|billionen|trillions?|milliard(?:en?|s)?)\.?\s+\p{L}+(?:\s+\p{L}+)*$/iu, scaleOfWord = (word) => {
977
1525
  let letter = MAGNITUDE_WORD_LETTER[word.toLowerCase()] ?? word.toLowerCase();
978
1526
  return letter === "k" ? "k" : letter === "b" ? "bn" : letter === "t" ? "t" : "m";
979
1527
  };
@@ -981,73 +1529,48 @@ function unitMagnitude(unit) {
981
1529
  let word = SCALED_NOUN_UNIT.exec(unit?.trim() ?? "")?.[1];
982
1530
  if (word !== void 0 && word !== "m" && word !== "mm") return scaleOfWord(word);
983
1531
  let match = MAGNITUDE_UNIT.exec(unit ?? "");
984
- if (!(!match || match[1] && !match[2] && !CURRENCY_CODES.has(match[1].toUpperCase())) && !(match[4] && (match[1] || !CURRENCY_CODES.has(match[4].toUpperCase()))))
1532
+ if (!(!match || match[1] && !match[2] && !CURRENCY_CODES2.has(match[1].toUpperCase())) && !(match[4] && (match[1] || !CURRENCY_CODES2.has(match[4].toUpperCase()))))
985
1533
  return scaleOfWord(match[3]);
986
1534
  }
987
- function setMagnitude(values, example, unit, target) {
988
- if (example || target === void 0 || unitMagnitude(unit)) return;
989
- let min = 1 / 0, max = 0;
990
- for (let value of values)
991
- value == null || !Number.isFinite(value) || value === 0 || (min = Math.min(min, Math.abs(value)), max = Math.max(max, Math.abs(value)));
992
- if (max < 1e6) return;
993
- let reaches = (magnitude) => {
994
- let below = min / MAGNITUDE_DIVISOR[MAGNITUDE_PREVIOUS[magnitude]];
995
- return min >= MAGNITUDE_DIVISOR[magnitude] || Number(roundHalfUp(below, neededDecimals(below, 2))) >= 1e3;
996
- }, step = ["bn", "m", "k"].find(reaches);
997
- return step && Math.round(max / MAGNITUDE_DIVISOR[step]) < 1e4 ? { magnitude: step, whole: step !== (max >= 1e9 ? "bn" : "m") } : void 0;
998
- }
999
- function seriesRasterFormatter(example, values, locale, unit, target, defaultExample, shared = !1, setScale) {
1000
- let raster = [...values], unitScale = unitMagnitude(unit), spec = example ? exampleSpec(example, locale, unit, raster) : defaultExample ? localized(parseFormatExample(defaultExample, !0), locale) : defaultFormatSpec(locale);
1001
- example || (spec.automatic = !0);
1002
- let unscaledSpec = { ...spec }, autoMagnitude = !1;
1003
- if (!example && target !== void 0 && spec.magnitude === "none" && !unitScale) {
1004
- let max = raster.reduce((largest, value) => value != null && Number.isFinite(value) ? Math.max(largest, Math.abs(value)) : largest, 0);
1005
- if (setScale || max >= 1e6) {
1006
- setScale?.whole && (spec.setScale = !0), spec.magnitude = setScale?.magnitude ?? (max >= 1e9 ? "bn" : "m"), spec.rollMagnitude = !1, spec.autoMagnitude = !0, autoMagnitude = !0;
1007
- let stepDecimals = 0;
1008
- for (let value of raster) {
1009
- if (value == null || !Number.isFinite(value) || Math.abs(value) >= MAGNITUDE_DIVISOR[spec.magnitude]) continue;
1010
- let own = spec.magnitude;
1011
- for (; own !== "none" && Math.abs(value) < MAGNITUDE_DIVISOR[own]; ) own = MAGNITUDE_PREVIOUS[own];
1012
- let scaled = value / MAGNITUDE_DIVISOR[own];
1013
- stepDecimals = Math.max(stepDecimals, nonzeroDecimals(scaled, neededDecimals(scaled, 2)));
1014
- }
1015
- stepDecimals > 0 && (spec.stepDecimals = stepDecimals);
1016
- }
1017
- }
1018
- if (!example && !defaultExample && unitScale && (spec.wholeFrom = 100), !example) {
1019
- if ((!defaultExample || autoMagnitude) && (spec.decimals = rasterDecimals(raster, spec)), autoMagnitude) {
1020
- let scaled = raster.filter((value) => value != null && Number.isFinite(value) && Math.abs(value) >= MAGNITUDE_DIVISOR[spec.magnitude] && !printsWholeInSet(value, spec, spec.decimals));
1021
- spec.decimals += distinctDecimalLift(scaled.map((value) => ({ value, format: (extra) => formatWithSpec(value, { ...spec, decimals: spec.decimals + extra }) })));
1022
- }
1023
- currencyWholeNumbers(unit, target) && (spec.currencyWhole = !0), spec.wholeFrom && spec.decimals > 0 && raster.some((value) => value != null && Math.abs(value) >= spec.wholeFrom) && (spec.wholeCounts = !0);
1024
- }
1025
- let face = example ? formatWithSpec : formatNonzeroWithSpec, fmt = (value) => face(value, spec), signedSpec = { ...spec, signed: !0 }, fmtSigned = (value) => face(value, signedSpec), percentSpec = { ...spec.rollMagnitude === !1 ? { ...unscaledSpec, decimals: rasterDecimals(raster, unscaledSpec) } : spec, suffix: "%", wholeFrom: void 0, currencyWhole: void 0 }, fmtPercent = example ? fmt : (value) => face(value, percentSpec), byExample = memoFormatterFromExample(locale), seriesSpecs = /* @__PURE__ */ new WeakMap(), ownPrecision = (series, base) => {
1026
- if (example || defaultExample || autoMagnitude || shared) return base;
1027
- let made = seriesSpecs.get(series);
1028
- if (!made) {
1029
- let numbers = normalizedSeriesNumbers(series), decimals = numbers ? rasterDecimals(numbers, { ...base, decimals: unscaledSpec.decimals }) : base.decimals;
1030
- made = decimals === base.decimals ? base : { ...base, decimals }, seriesSpecs.set(series, made);
1031
- }
1032
- return made;
1033
- }, plainSpec = (series) => {
1034
- let wholeFrom = !defaultExample && unitMagnitude(series.unit) ? 100 : void 0, currencyWhole = currencyWholeNumbers(series.unit, target), unscaled = autoMagnitude && unitMagnitude(series.unit) !== void 0, base = example || series.unit === void 0 || wholeFrom === spec.wholeFrom && currencyWhole === !!spec.currencyWhole && !unscaled ? spec : { ...unscaled ? { ...spec, magnitude: "none", autoMagnitude: void 0, rollMagnitude: void 0 } : spec, wholeFrom, currencyWhole };
1035
- return ownPrecision(series, base);
1036
- }, specForSeries = (series) => series.format ? exampleSpec(series.format, locale, series.unit ?? unit, normalizedSeriesNumbers(series)) : plainSpec(series), seriesFormatters = /* @__PURE__ */ new WeakMap(), forSeries = (series, cellFormat) => {
1535
+ function seriesRasterFormatter(example, values, locale, unit, cell = !1) {
1536
+ let raster = [...values];
1537
+ if (!example) return ruleRasterFormatter(raster, locale, unit, cell);
1538
+ let spec = exampleSpec(example, locale, unit, raster), fmt = (value) => formatWithSpec(value, spec), signedSpec = { ...spec, signed: !0 }, fmtSigned = (value) => formatWithSpec(value, signedSpec), byExample = memoFormatterFromExample(locale), specForSeries = (series) => series.format ? exampleSpec(series.format, locale, series.unit ?? unit, normalizedSeriesNumbers(series)) : spec, seriesFormatters = /* @__PURE__ */ new WeakMap(), forSeries = (series, cellFormat) => {
1539
+ if (cellFormat) return byExample(cellFormat, series.unit ?? unit);
1540
+ if (!series.format) return fmt;
1541
+ let formatter = seriesFormatters.get(series);
1542
+ return formatter || (formatter = formatterFromExample(series.format, locale, series.unit ?? unit, normalizedSeriesNumbers(series)), seriesFormatters.set(series, formatter)), formatter;
1543
+ };
1544
+ return { spec, fmt, fmtSigned, fmtPercent: fmt, percentSpec: spec, forSeries, specForSeries, roundsToZeroAt: (value, series = {}, cellFormat) => {
1545
+ let formatter = forSeries(series, cellFormat);
1546
+ return formatter(value) === formatter(0);
1547
+ } };
1548
+ }
1549
+ function ruleRasterFormatter(raster, locale, unit, cell) {
1550
+ let values = finiteValues(raster), asCell = cell ? { cell: !0 } : {}, spec = ruleSpec(numberRuleSet(values, numberSetOf(locale, { unit, ...asCell })), locale), fmt = (value) => formatWithSpec(value, spec), signedSpec = { ...spec, signed: !0 }, fmtSigned = (value) => formatWithSpec(value, signedSpec), percent, percentOf = () => percent ??= ruleSpec(numberRuleSet(values, numberSetOf(locale, { kind: "percent", ...asCell })), locale, "", "%"), fmtPercent = (value) => formatWithSpec(value, percentOf()), byExample = memoFormatterFromExample(locale), seriesSpecs = /* @__PURE__ */ new WeakMap(), specForSeries = (series) => {
1551
+ if (series.format) return exampleSpec(series.format, locale, series.unit ?? unit, normalizedSeriesNumbers(series));
1552
+ if (series.unit === void 0 || series.unit === unit) return spec;
1553
+ let own = seriesSpecs.get(series);
1554
+ return own || (own = defaultSetSpec(normalizedSeriesNumbers(series) ?? values, locale, series.unit, asCell), seriesSpecs.set(series, own)), own;
1555
+ }, seriesFormatters = /* @__PURE__ */ new WeakMap(), forSeries = (series, cellFormat) => {
1037
1556
  if (cellFormat) return byExample(cellFormat, series.unit ?? unit);
1038
1557
  let formatter = seriesFormatters.get(series);
1039
1558
  if (formatter) return formatter;
1040
- if (series.format)
1041
- return formatter = formatterFromExample(series.format, locale, series.unit ?? unit, normalizedSeriesNumbers(series)), seriesFormatters.set(series, formatter), formatter;
1042
- let own = plainSpec(series);
1043
- return formatter = own === spec ? fmt : (value) => face(value, own), seriesFormatters.set(series, formatter), formatter;
1559
+ if (series.format) formatter = formatterFromExample(series.format, locale, series.unit ?? unit, normalizedSeriesNumbers(series));
1560
+ else {
1561
+ let own = specForSeries(series);
1562
+ formatter = own === spec ? fmt : (value) => formatWithSpec(value, own);
1563
+ }
1564
+ return seriesFormatters.set(series, formatter), formatter;
1044
1565
  };
1045
- return { spec, fmt, fmtSigned, fmtPercent, percentSpec: example ? spec : percentSpec, forSeries, specForSeries, roundsToZeroAt: (value, series = {}, cellFormat) => {
1046
- if (example || cellFormat || series.format) {
1566
+ return { spec, fmt, fmtSigned, fmtPercent, get percentSpec() {
1567
+ return percentOf();
1568
+ }, forSeries, specForSeries, roundsToZeroAt: (value, series = {}, cellFormat) => {
1569
+ if (cellFormat || series.format) {
1047
1570
  let formatter = forSeries(series, cellFormat);
1048
1571
  return formatter(value) === formatter(0);
1049
1572
  }
1050
- return roundsToZero(value / MAGNITUDE_DIVISOR[spec.magnitude], ownPrecision(series, spec).decimals);
1573
+ return roundedNumber(value, specForSeries(series)) === 0;
1051
1574
  } };
1052
1575
  }
1053
1576
  function normalizedSeriesNumbers(series) {
@@ -1087,14 +1610,35 @@ function parseISODate(s) {
1087
1610
  }
1088
1611
 
1089
1612
  export {
1613
+ roundedAt,
1614
+ tickScale,
1615
+ fixedRuleSet,
1616
+ isUnitText,
1617
+ isPercentUnit,
1618
+ ruleSetOf,
1619
+ printFace,
1620
+ ruleFormatter,
1621
+ statisticSet,
1090
1622
  withUnit,
1091
1623
  AUTOMATIC_FORMAT,
1092
1624
  MAGNITUDE_GROUP,
1093
1625
  MAGNITUDE_FIGURES,
1626
+ PERIOD_FIGURES,
1094
1627
  LABEL_ONLY_ROW,
1628
+ RULE_SET,
1629
+ defaultSetSpec,
1630
+ statisticFormatter,
1631
+ joinedChangeSpec,
1632
+ percentChangeSpec,
1633
+ ruleStatistics,
1095
1634
  parseFormatExample,
1635
+ withChartFormats,
1636
+ isExactExample,
1096
1637
  formatExampleText,
1097
1638
  formatExampleProblem,
1639
+ writtenExamples,
1640
+ UNIT_FORMATS,
1641
+ withAuthoredUnits,
1098
1642
  readFormatExamples,
1099
1643
  MAGNITUDE_DIVISOR,
1100
1644
  MAGNITUDE_LABEL,
@@ -1105,14 +1649,19 @@ export {
1105
1649
  nonAdditiveSpec,
1106
1650
  nonAdditiveFormat,
1107
1651
  effectiveScale,
1652
+ asEngineNumbers,
1108
1653
  formatWithSpec,
1109
1654
  compileNumberFormat,
1655
+ printsBound,
1110
1656
  roundedNumber,
1111
1657
  withChartMarks,
1112
1658
  localized,
1113
1659
  exampleSpec,
1660
+ exactExampleSpec,
1114
1661
  shareFormatExample,
1115
1662
  formatterFromExample,
1663
+ engineNumberSpec,
1664
+ engineFormatterFromExample,
1116
1665
  formatNonzeroWithSpec,
1117
1666
  signedFormatterFromExample,
1118
1667
  levelFormatSpec,
@@ -1120,15 +1669,14 @@ export {
1120
1669
  differenceExample,
1121
1670
  decimalCap,
1122
1671
  neededDecimals,
1123
- rasterDecimals,
1124
1672
  formatStatWithSpec,
1125
1673
  trendRateFormatter,
1126
1674
  defaultFormatSpec,
1127
1675
  percentRasterFormatter,
1128
1676
  unscaledFormatLint,
1129
1677
  drawsZeroNumber,
1678
+ zeroText,
1130
1679
  unitMagnitude,
1131
- setMagnitude,
1132
1680
  seriesRasterFormatter,
1133
1681
  normalizedSeriesNumbers,
1134
1682
  memoFormatterFromExample,