@hawkeyexl/manni 4.16.0 → 4.17.1

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 (230) hide show
  1. package/README.md +1 -1
  2. package/dist/{batch-L5W4JS7A.js → batch-SAW4E46C.js} +14 -14
  3. package/dist/{build-GNZUVDZX.js → build-F6S3W77I.js} +15 -14
  4. package/dist/{calibrate-2LYIDN6U.js → calibrate-3DW2VV7F.js} +15 -15
  5. package/dist/{capture-OEDMFU5Z.js → capture-PKEYY2VO.js} +14 -14
  6. package/dist/{check-JR2TYL2Y.js → check-7PUIHLFM.js} +15 -15
  7. package/dist/{check-NLLFHNWG.js → check-EZN7YNVF.js} +14 -15
  8. package/dist/{check-Z5VGDSDT.js → check-LRX2YFDF.js} +13 -14
  9. package/dist/check-NW7GHSX6.js +47 -0
  10. package/dist/{cli-THEU2QG2.js → chunk-245W2Q7C.js} +133 -365
  11. package/dist/chunk-245W2Q7C.js.map +1 -0
  12. package/dist/{chunk-LEOQO3S6.js → chunk-2A5OIZHT.js} +7 -7
  13. package/dist/{chunk-FU3OCYYH.js → chunk-2LCJNH73.js} +2 -2
  14. package/dist/{chunk-7UC55CAU.js → chunk-2TLNAGVJ.js} +187 -159
  15. package/dist/chunk-2TLNAGVJ.js.map +1 -0
  16. package/dist/{chunk-6ANTGYNT.js → chunk-3446DW4W.js} +2 -2
  17. package/dist/{chunk-7GB3KEEM.js → chunk-3UYSONT4.js} +7 -453
  18. package/dist/chunk-3UYSONT4.js.map +1 -0
  19. package/dist/{chunk-NFJGIBES.js → chunk-4GGADKTU.js} +82 -238
  20. package/dist/chunk-4GGADKTU.js.map +1 -0
  21. package/dist/{chunk-YF6IZXAC.js → chunk-5QOTR53S.js} +7 -7
  22. package/dist/{chunk-2XRET3ZG.js → chunk-5VNFO2RT.js} +12 -38
  23. package/dist/chunk-5VNFO2RT.js.map +1 -0
  24. package/dist/{chunk-6YFEV7CM.js → chunk-64EDFJ5S.js} +5 -5
  25. package/dist/chunk-6J2ED4ED.js +545 -0
  26. package/dist/chunk-6J2ED4ED.js.map +1 -0
  27. package/dist/{chunk-2AUULNIJ.js → chunk-ABAFKOQF.js} +3 -3
  28. package/dist/{chunk-3GLDB7MZ.js → chunk-AIZBZYQM.js} +1311 -18
  29. package/dist/chunk-AIZBZYQM.js.map +1 -0
  30. package/dist/{chunk-GQQ2AX63.js → chunk-B5R5BWMY.js} +14 -429
  31. package/dist/chunk-B5R5BWMY.js.map +1 -0
  32. package/dist/{chunk-ZT5NUSZA.js → chunk-D3AO2PMV.js} +9 -9
  33. package/dist/{chunk-EZCJPF72.js → chunk-DSJTYRI5.js} +3 -3
  34. package/dist/{chunk-OJ7FEM2G.js → chunk-DU6CXY5R.js} +47 -10
  35. package/dist/chunk-DU6CXY5R.js.map +1 -0
  36. package/dist/{chunk-WD33LE5A.js → chunk-FAS3SRQB.js} +927 -99
  37. package/dist/chunk-FAS3SRQB.js.map +1 -0
  38. package/dist/{chunk-DTG6S2UG.js → chunk-FEURGKJC.js} +2 -2
  39. package/dist/{chunk-EA5KKIFG.js → chunk-FPPHEHPZ.js} +3 -3
  40. package/dist/chunk-HEVYEI6O.js +1338 -0
  41. package/dist/chunk-HEVYEI6O.js.map +1 -0
  42. package/dist/{chunk-5OOQ3HQ3.js → chunk-IGE6CIKZ.js} +11 -2
  43. package/dist/chunk-IGE6CIKZ.js.map +1 -0
  44. package/dist/{chunk-WT3AATHC.js → chunk-JK56UPNQ.js} +252 -425
  45. package/dist/chunk-JK56UPNQ.js.map +1 -0
  46. package/dist/{chunk-B3XXCDYW.js → chunk-KAWS7H4C.js} +2385 -2061
  47. package/dist/chunk-KAWS7H4C.js.map +1 -0
  48. package/dist/{chunk-O6YTTBSN.js → chunk-KB4MNUKC.js} +2 -2
  49. package/dist/{chunk-GR6QQ7GM.js → chunk-KCNBM42T.js} +4 -4
  50. package/dist/chunk-KUXAHHDE.js +314 -0
  51. package/dist/chunk-KUXAHHDE.js.map +1 -0
  52. package/dist/{chunk-EOSQENQF.js → chunk-LDIUA4ZG.js} +2 -2
  53. package/dist/{chunk-L3YGGYBG.js → chunk-M6DNOHJO.js} +3 -3
  54. package/dist/{chunk-4L3JBAW4.js → chunk-MBLVLQWI.js} +2 -2
  55. package/dist/{chunk-4HEEXPVX.js → chunk-MDXDTO7E.js} +6 -6
  56. package/dist/{chunk-WDENIUC7.js → chunk-MDZXRHIJ.js} +1 -1
  57. package/dist/chunk-MDZXRHIJ.js.map +1 -0
  58. package/dist/{chunk-IGRXQC3H.js → chunk-N25KDXOV.js} +2 -2
  59. package/dist/{chunk-DW22KCLN.js → chunk-NPZWOPOH.js} +3 -3
  60. package/dist/chunk-OZL5M764.js +443 -0
  61. package/dist/chunk-OZL5M764.js.map +1 -0
  62. package/dist/{chunk-NDBISART.js → chunk-PS4Y7EPP.js} +3 -3
  63. package/dist/{chunk-F4GXZMEO.js → chunk-Q7E43SXN.js} +12 -7
  64. package/dist/{chunk-F4GXZMEO.js.map → chunk-Q7E43SXN.js.map} +1 -1
  65. package/dist/{chunk-63GILHR5.js → chunk-QIKCIREY.js} +4 -4
  66. package/dist/{chunk-ZJZQPOJO.js → chunk-QIWSEKA6.js} +2 -2
  67. package/dist/{chunk-F6B2TNXU.js → chunk-TNYIXIYV.js} +6 -6
  68. package/dist/{chunk-CSLJMML4.js → chunk-TUMR35B3.js} +4 -4
  69. package/dist/{chunk-DSTRT6YD.js → chunk-U5NSIZRS.js} +3 -3
  70. package/dist/chunk-UP6NBQ62.js +2 -0
  71. package/dist/{chunk-BMYCLTFK.js → chunk-VRMQSP7O.js} +3 -3
  72. package/dist/{chunk-IM67NRUW.js → chunk-W7IEP7IG.js} +2 -2
  73. package/dist/{chunk-5PO2BWZF.js → chunk-W7XOMNYC.js} +2 -2
  74. package/dist/{chunk-6NTNLKNQ.js → chunk-WBXVQW57.js} +6 -5
  75. package/dist/{chunk-6NTNLKNQ.js.map → chunk-WBXVQW57.js.map} +1 -1
  76. package/dist/{chunk-PBZZUNDV.js → chunk-WP5EKWTU.js} +7 -7
  77. package/dist/chunk-WRSWZEVU.js +580 -0
  78. package/dist/chunk-WRSWZEVU.js.map +1 -0
  79. package/dist/{chunk-LPBVWUKS.js → chunk-WZSL7KF2.js} +2 -2
  80. package/dist/{chunk-GC47NBGO.js → chunk-XCEEJEVA.js} +4 -4
  81. package/dist/{chunk-4LLYPDNG.js → chunk-XPGK4ECA.js} +7 -7
  82. package/dist/{chunk-AWAXAJ6R.js → chunk-XRWQQHBR.js} +2 -2
  83. package/dist/{chunk-D4ANAOY7.js → chunk-XWUIFSWK.js} +20 -6
  84. package/dist/chunk-XWUIFSWK.js.map +1 -0
  85. package/dist/{chunk-IL62WATF.js → chunk-YJHHXM5B.js} +2 -2
  86. package/dist/{chunk-NH6B6DDI.js → chunk-ZEYNLKOH.js} +4 -4
  87. package/dist/{chunk-PHNAQ4QX.js → chunk-ZIXU7A4C.js} +21 -21
  88. package/dist/{cli-LZW6Z33F.js → cli-5ZQXVWWC.js} +18 -19
  89. package/dist/{cli-LZW6Z33F.js.map → cli-5ZQXVWWC.js.map} +1 -1
  90. package/dist/{cli-5QTSTGTX.js → cli-D5WYQVUF.js} +18 -18
  91. package/dist/{cli-4Y2XY52B.js → cli-FCGGNZ5C.js} +2 -2
  92. package/dist/{cli-DBMPGGOV.js → cli-FNX4LXMI.js} +37 -37
  93. package/dist/{cli-KAUXC7EZ.js → cli-LQRHK23G.js} +9 -9
  94. package/dist/{cli-RWRYV5FB.js → cli-LRKBCQRS.js} +9 -9
  95. package/dist/{cli-2EKRURBU.js → cli-NJC3H3CW.js} +15 -15
  96. package/dist/{cli-2SDBEUER.js → cli-OHKWCJIJ.js} +21 -21
  97. package/dist/{cli-BXUZ3KEQ.js → cli-RKYIZ6KU.js} +634 -36
  98. package/dist/cli-RKYIZ6KU.js.map +1 -0
  99. package/dist/cli-TJDQ5GUW.js +379 -0
  100. package/dist/cli-TJDQ5GUW.js.map +1 -0
  101. package/dist/{cli-TZ2OHF3H.js → cli-VC3BXCVR.js} +19 -19
  102. package/dist/cli.js +14 -14
  103. package/dist/docmeta.js +8 -8
  104. package/dist/{github-UR6LMUMW.js → github-6PV2JTZ7.js} +13 -14
  105. package/dist/github-7ZT4KYQU.js +35 -0
  106. package/dist/graph/runtime.d.ts +633 -217
  107. package/dist/graph/runtime.js +1001 -370
  108. package/dist/graph/runtime.js.map +1 -1
  109. package/dist/index.d.ts +2617 -1945
  110. package/dist/index.js +108 -64
  111. package/dist/index.js.map +1 -1
  112. package/dist/{json-QTYN2JQB.js → json-VWXLDTXR.js} +13 -14
  113. package/dist/{labels-UM2AFR5S.js → labels-ZJK27RL3.js} +12 -13
  114. package/dist/{labels-UM2AFR5S.js.map → labels-ZJK27RL3.js.map} +1 -1
  115. package/dist/{lint-LOFNZZPR.js → lint-5OERIERT.js} +13 -13
  116. package/dist/{list-GU7S6KEX.js → list-MANBRF7Z.js} +13 -14
  117. package/dist/{list-EPMHOU7T.js → list-SEEANTU6.js} +15 -15
  118. package/dist/{page-25CN3AFY.js → page-O4M65KMJ.js} +13 -14
  119. package/dist/{prepare-5GYMBF4P.js → prepare-3WULLZER.js} +13 -13
  120. package/dist/{pretty-QW6OSYRS.js → pretty-5FRBLTXU.js} +13 -14
  121. package/dist/{pretty-52Z74O6F.js → pretty-D3M366JD.js} +14 -15
  122. package/dist/{reporters-WT53GD4P.js → reporters-4WWZRHKI.js} +4 -4
  123. package/dist/{reporters-FSXJ42EB.js → reporters-6TEJDXXO.js} +4 -4
  124. package/dist/{reporters-3FXX2W4X.js → reporters-GDCZ5P7C.js} +12 -12
  125. package/dist/{run-H7XJMUWK.js → run-TZDLG6EN.js} +16 -16
  126. package/dist/sarif-PUZAMEFQ.js +36 -0
  127. package/dist/{sarif-C427U3NA.js → sarif-SSSPOUCK.js} +11 -11
  128. package/dist/site/rehype.d.ts +33 -0
  129. package/dist/site/rehype.js +49 -0
  130. package/dist/site/rehype.js.map +1 -0
  131. package/dist/{term-VG65JRNR.js → term-DHWMUL5N.js} +18 -19
  132. package/dist/{term-VG65JRNR.js.map → term-DHWMUL5N.js.map} +1 -1
  133. package/dist/{types-VMOT7RAL.js → types-7N7ETP3W.js} +2 -2
  134. package/dist/{validate-K36F54UB.js → validate-4AW7KIIY.js} +5 -5
  135. package/package.json +10 -1
  136. package/plugin/manni/.claude-plugin/plugin.json +1 -1
  137. package/shapes/graph/shapes-1.2.0.ttl +1161 -0
  138. package/dist/check-LVO4HZ3F.js +0 -36
  139. package/dist/chunk-2XRET3ZG.js.map +0 -1
  140. package/dist/chunk-3GLDB7MZ.js.map +0 -1
  141. package/dist/chunk-3WZQ2FR3.js +0 -236
  142. package/dist/chunk-3WZQ2FR3.js.map +0 -1
  143. package/dist/chunk-5OOQ3HQ3.js.map +0 -1
  144. package/dist/chunk-7GB3KEEM.js.map +0 -1
  145. package/dist/chunk-7UC55CAU.js.map +0 -1
  146. package/dist/chunk-B3XXCDYW.js.map +0 -1
  147. package/dist/chunk-D4ANAOY7.js.map +0 -1
  148. package/dist/chunk-GQQ2AX63.js.map +0 -1
  149. package/dist/chunk-IKEWBMCN.js +0 -98
  150. package/dist/chunk-IKEWBMCN.js.map +0 -1
  151. package/dist/chunk-NFJGIBES.js.map +0 -1
  152. package/dist/chunk-OJ7FEM2G.js.map +0 -1
  153. package/dist/chunk-WD33LE5A.js.map +0 -1
  154. package/dist/chunk-WDENIUC7.js.map +0 -1
  155. package/dist/chunk-WT3AATHC.js.map +0 -1
  156. package/dist/chunk-YUTVAMWW.js +0 -2
  157. package/dist/cli-BXUZ3KEQ.js.map +0 -1
  158. package/dist/cli-THEU2QG2.js.map +0 -1
  159. package/dist/github-ICZ5UDGX.js +0 -36
  160. package/dist/sarif-UVAFWZKS.js +0 -37
  161. /package/dist/{batch-L5W4JS7A.js.map → batch-SAW4E46C.js.map} +0 -0
  162. /package/dist/{build-GNZUVDZX.js.map → build-F6S3W77I.js.map} +0 -0
  163. /package/dist/{calibrate-2LYIDN6U.js.map → calibrate-3DW2VV7F.js.map} +0 -0
  164. /package/dist/{capture-OEDMFU5Z.js.map → capture-PKEYY2VO.js.map} +0 -0
  165. /package/dist/{check-JR2TYL2Y.js.map → check-7PUIHLFM.js.map} +0 -0
  166. /package/dist/{check-LVO4HZ3F.js.map → check-EZN7YNVF.js.map} +0 -0
  167. /package/dist/{check-NLLFHNWG.js.map → check-LRX2YFDF.js.map} +0 -0
  168. /package/dist/{check-Z5VGDSDT.js.map → check-NW7GHSX6.js.map} +0 -0
  169. /package/dist/{chunk-LEOQO3S6.js.map → chunk-2A5OIZHT.js.map} +0 -0
  170. /package/dist/{chunk-FU3OCYYH.js.map → chunk-2LCJNH73.js.map} +0 -0
  171. /package/dist/{chunk-6ANTGYNT.js.map → chunk-3446DW4W.js.map} +0 -0
  172. /package/dist/{chunk-YF6IZXAC.js.map → chunk-5QOTR53S.js.map} +0 -0
  173. /package/dist/{chunk-6YFEV7CM.js.map → chunk-64EDFJ5S.js.map} +0 -0
  174. /package/dist/{chunk-2AUULNIJ.js.map → chunk-ABAFKOQF.js.map} +0 -0
  175. /package/dist/{chunk-ZT5NUSZA.js.map → chunk-D3AO2PMV.js.map} +0 -0
  176. /package/dist/{chunk-EZCJPF72.js.map → chunk-DSJTYRI5.js.map} +0 -0
  177. /package/dist/{chunk-DTG6S2UG.js.map → chunk-FEURGKJC.js.map} +0 -0
  178. /package/dist/{chunk-EA5KKIFG.js.map → chunk-FPPHEHPZ.js.map} +0 -0
  179. /package/dist/{chunk-O6YTTBSN.js.map → chunk-KB4MNUKC.js.map} +0 -0
  180. /package/dist/{chunk-GR6QQ7GM.js.map → chunk-KCNBM42T.js.map} +0 -0
  181. /package/dist/{chunk-EOSQENQF.js.map → chunk-LDIUA4ZG.js.map} +0 -0
  182. /package/dist/{chunk-L3YGGYBG.js.map → chunk-M6DNOHJO.js.map} +0 -0
  183. /package/dist/{chunk-4L3JBAW4.js.map → chunk-MBLVLQWI.js.map} +0 -0
  184. /package/dist/{chunk-4HEEXPVX.js.map → chunk-MDXDTO7E.js.map} +0 -0
  185. /package/dist/{chunk-IGRXQC3H.js.map → chunk-N25KDXOV.js.map} +0 -0
  186. /package/dist/{chunk-DW22KCLN.js.map → chunk-NPZWOPOH.js.map} +0 -0
  187. /package/dist/{chunk-NDBISART.js.map → chunk-PS4Y7EPP.js.map} +0 -0
  188. /package/dist/{chunk-63GILHR5.js.map → chunk-QIKCIREY.js.map} +0 -0
  189. /package/dist/{chunk-ZJZQPOJO.js.map → chunk-QIWSEKA6.js.map} +0 -0
  190. /package/dist/{chunk-F6B2TNXU.js.map → chunk-TNYIXIYV.js.map} +0 -0
  191. /package/dist/{chunk-CSLJMML4.js.map → chunk-TUMR35B3.js.map} +0 -0
  192. /package/dist/{chunk-DSTRT6YD.js.map → chunk-U5NSIZRS.js.map} +0 -0
  193. /package/dist/{chunk-YUTVAMWW.js.map → chunk-UP6NBQ62.js.map} +0 -0
  194. /package/dist/{chunk-BMYCLTFK.js.map → chunk-VRMQSP7O.js.map} +0 -0
  195. /package/dist/{chunk-IM67NRUW.js.map → chunk-W7IEP7IG.js.map} +0 -0
  196. /package/dist/{chunk-5PO2BWZF.js.map → chunk-W7XOMNYC.js.map} +0 -0
  197. /package/dist/{chunk-PBZZUNDV.js.map → chunk-WP5EKWTU.js.map} +0 -0
  198. /package/dist/{chunk-LPBVWUKS.js.map → chunk-WZSL7KF2.js.map} +0 -0
  199. /package/dist/{chunk-GC47NBGO.js.map → chunk-XCEEJEVA.js.map} +0 -0
  200. /package/dist/{chunk-4LLYPDNG.js.map → chunk-XPGK4ECA.js.map} +0 -0
  201. /package/dist/{chunk-AWAXAJ6R.js.map → chunk-XRWQQHBR.js.map} +0 -0
  202. /package/dist/{chunk-IL62WATF.js.map → chunk-YJHHXM5B.js.map} +0 -0
  203. /package/dist/{chunk-NH6B6DDI.js.map → chunk-ZEYNLKOH.js.map} +0 -0
  204. /package/dist/{chunk-PHNAQ4QX.js.map → chunk-ZIXU7A4C.js.map} +0 -0
  205. /package/dist/{cli-5QTSTGTX.js.map → cli-D5WYQVUF.js.map} +0 -0
  206. /package/dist/{cli-4Y2XY52B.js.map → cli-FCGGNZ5C.js.map} +0 -0
  207. /package/dist/{cli-DBMPGGOV.js.map → cli-FNX4LXMI.js.map} +0 -0
  208. /package/dist/{cli-KAUXC7EZ.js.map → cli-LQRHK23G.js.map} +0 -0
  209. /package/dist/{cli-RWRYV5FB.js.map → cli-LRKBCQRS.js.map} +0 -0
  210. /package/dist/{cli-2EKRURBU.js.map → cli-NJC3H3CW.js.map} +0 -0
  211. /package/dist/{cli-2SDBEUER.js.map → cli-OHKWCJIJ.js.map} +0 -0
  212. /package/dist/{cli-TZ2OHF3H.js.map → cli-VC3BXCVR.js.map} +0 -0
  213. /package/dist/{github-ICZ5UDGX.js.map → github-6PV2JTZ7.js.map} +0 -0
  214. /package/dist/{github-UR6LMUMW.js.map → github-7ZT4KYQU.js.map} +0 -0
  215. /package/dist/{json-QTYN2JQB.js.map → json-VWXLDTXR.js.map} +0 -0
  216. /package/dist/{lint-LOFNZZPR.js.map → lint-5OERIERT.js.map} +0 -0
  217. /package/dist/{list-EPMHOU7T.js.map → list-MANBRF7Z.js.map} +0 -0
  218. /package/dist/{list-GU7S6KEX.js.map → list-SEEANTU6.js.map} +0 -0
  219. /package/dist/{page-25CN3AFY.js.map → page-O4M65KMJ.js.map} +0 -0
  220. /package/dist/{prepare-5GYMBF4P.js.map → prepare-3WULLZER.js.map} +0 -0
  221. /package/dist/{pretty-52Z74O6F.js.map → pretty-5FRBLTXU.js.map} +0 -0
  222. /package/dist/{pretty-QW6OSYRS.js.map → pretty-D3M366JD.js.map} +0 -0
  223. /package/dist/{reporters-3FXX2W4X.js.map → reporters-4WWZRHKI.js.map} +0 -0
  224. /package/dist/{reporters-FSXJ42EB.js.map → reporters-6TEJDXXO.js.map} +0 -0
  225. /package/dist/{reporters-WT53GD4P.js.map → reporters-GDCZ5P7C.js.map} +0 -0
  226. /package/dist/{run-H7XJMUWK.js.map → run-TZDLG6EN.js.map} +0 -0
  227. /package/dist/{sarif-C427U3NA.js.map → sarif-PUZAMEFQ.js.map} +0 -0
  228. /package/dist/{sarif-UVAFWZKS.js.map → sarif-SSSPOUCK.js.map} +0 -0
  229. /package/dist/{types-VMOT7RAL.js.map → types-7N7ETP3W.js.map} +0 -0
  230. /package/dist/{validate-K36F54UB.js.map → validate-4AW7KIIY.js.map} +0 -0
@@ -0,0 +1,580 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ SiteError,
4
+ resolveAnnotateSite
5
+ } from "./chunk-245W2Q7C.js";
6
+ import {
7
+ parseChunkRows,
8
+ parseChunksManifest,
9
+ range
10
+ } from "./chunk-HEVYEI6O.js";
11
+ import {
12
+ documentBase,
13
+ formatOf,
14
+ loadRunConfig
15
+ } from "./chunk-4GGADKTU.js";
16
+ import {
17
+ bodyLineOf
18
+ } from "./chunk-AIZBZYQM.js";
19
+ import {
20
+ integrityOf,
21
+ locateFrontmatter
22
+ } from "./chunk-FAS3SRQB.js";
23
+ import {
24
+ notice,
25
+ warn
26
+ } from "./chunk-HX44GB4Z.js";
27
+ import {
28
+ errorMessage
29
+ } from "./chunk-G3T47CFV.js";
30
+
31
+ // src/site/commands/annotate.ts
32
+ import { existsSync, readdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
33
+ import { basename, dirname, extname, join, relative, resolve as resolve2 } from "node:path";
34
+
35
+ // src/site/core/annotate.ts
36
+ import { resolve } from "node:path";
37
+ import { parse } from "parse5";
38
+ import remarkGfm from "remark-gfm";
39
+ import remarkParse from "remark-parse";
40
+ import { toString as mdastToString } from "mdast-util-to-string";
41
+ import { unified } from "unified";
42
+ var STAMP = "data-manni-src";
43
+ var ISLAND_ID = "manni-provenance";
44
+ var TEXT_BLOCKS = /* @__PURE__ */ new Set(["p", "h1", "h2", "h3", "h4", "h5", "h6", "li", "pre", "blockquote", "tr", "dt", "dd", "figcaption"]);
45
+ var NO_TEXT = /* @__PURE__ */ new Set(["script", "style", "template", "head"]);
46
+ var MIN_PART = 12;
47
+ function children(node) {
48
+ return "childNodes" in node ? node.childNodes : [];
49
+ }
50
+ function isElement(node) {
51
+ return "tagName" in node;
52
+ }
53
+ function attr(el, name) {
54
+ return el.attrs.find((a) => a.name === name)?.value;
55
+ }
56
+ function textOf(node) {
57
+ if (node.nodeName === "#text") return "value" in node ? node.value : "";
58
+ if (isElement(node) && NO_TEXT.has(node.tagName)) return "";
59
+ return children(node).map(textOf).join("");
60
+ }
61
+ function parseStamp(value, base) {
62
+ const m = /^(.*):(\d+)-(\d+)$/.exec(value);
63
+ if (m?.[1] === void 0 || m[2] === void 0 || m[3] === void 0) return void 0;
64
+ return { file: resolve(base, m[1]), start: Number(m[2]), end: Number(m[3]) };
65
+ }
66
+ function walk(root) {
67
+ const all = [];
68
+ const parent = /* @__PURE__ */ new Map();
69
+ const visit = (node, up) => {
70
+ let next = up;
71
+ if (isElement(node)) {
72
+ all.push(node);
73
+ if (up !== void 0) parent.set(node, up);
74
+ next = node;
75
+ }
76
+ if (isElement(node) && node.tagName === "template") return;
77
+ for (const c of children(node)) visit(c, next);
78
+ };
79
+ visit(root, void 0);
80
+ return { all, parent };
81
+ }
82
+ function comparable(text) {
83
+ return text.replace(/[‘’]/g, "'").replace(/[“”]/g, '"').replace(/—/g, "---").replace(/–/g, "--").replace(/…/g, "...").replace(/\s+/g, "");
84
+ }
85
+ var processor = unified().use(remarkParse).use(remarkGfm);
86
+ var TABLE_ROW = /^\s*\|.*\|\s*$/;
87
+ var TABLE_DELIMITER = /^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)*\|?\s*$/;
88
+ function renderedText(lines) {
89
+ const source = lines.filter((l) => !(TABLE_DELIMITER.test(l) && l.includes("-") && l.includes("|"))).map((l) => TABLE_ROW.test(l) ? l.replace(/\|/g, " ") : l).join("\n");
90
+ return comparable(mdastToString(processor.parse(source), { includeHtml: false }));
91
+ }
92
+ var strings = (value) => Array.isArray(value) ? value.filter((v) => typeof v === "string") : typeof value === "string" ? [value] : [];
93
+ function tools(value) {
94
+ if (!Array.isArray(value)) return [];
95
+ const out = [];
96
+ for (const entry of value) {
97
+ const tool = typeof entry === "object" && entry !== null ? entry["tool"] : void 0;
98
+ if (typeof tool === "string" && !out.includes(tool)) out.push(tool);
99
+ }
100
+ return out;
101
+ }
102
+ function pageRecords(rows) {
103
+ return [...rows].map((r) => ({ r, span: range(r.lines) ?? { start: 0, end: 0 } })).sort((a, b) => a.span.start - b.span.start || b.span.end - a.span.end || (a.r.id < b.r.id ? -1 : a.r.id > b.r.id ? 1 : 0)).map((x) => x.r.provenance);
104
+ }
105
+ function pinsOf(rows) {
106
+ const seen = /* @__PURE__ */ new Set();
107
+ const out = [];
108
+ for (const record of pageRecords(rows)) {
109
+ for (const item of record.pins.items) {
110
+ const key = JSON.stringify(item);
111
+ if (seen.has(key)) continue;
112
+ seen.add(key);
113
+ out.push(item);
114
+ }
115
+ }
116
+ return out;
117
+ }
118
+ function statementsOf(rows) {
119
+ const seen = /* @__PURE__ */ new Set();
120
+ const out = [];
121
+ for (const record of pageRecords(rows)) {
122
+ for (const s of record.statements) {
123
+ const key = JSON.stringify(s);
124
+ if (seen.has(key)) continue;
125
+ seen.add(key);
126
+ out.push(s);
127
+ }
128
+ }
129
+ return out.sort((a, b) => (range(a.lines)?.start ?? 0) - (range(b.lines)?.start ?? 0));
130
+ }
131
+ function joinPage(input) {
132
+ const { html } = input;
133
+ const doc = parse(html, { sourceCodeLocationInfo: true });
134
+ const { all, parent } = walk(doc);
135
+ const stamps = /* @__PURE__ */ new Map();
136
+ for (const el of all) {
137
+ const value = attr(el, STAMP);
138
+ const stamp = value === void 0 ? void 0 : parseStamp(value, input.stampBase);
139
+ if (stamp !== void 0 && stamp.file === input.file) stamps.set(el, stamp);
140
+ }
141
+ const main = all.find((e) => e.tagName === "main");
142
+ const body = all.find((e) => e.tagName === "body");
143
+ const scope = main ?? body;
144
+ const inScope = (el) => {
145
+ for (let at2 = el; at2 !== void 0; at2 = parent.get(at2)) if (at2 === scope) return true;
146
+ return scope === void 0;
147
+ };
148
+ const textual = all.filter((e) => TEXT_BLOCKS.has(e.tagName) && inScope(e));
149
+ const nested = /* @__PURE__ */ new Set();
150
+ for (const el of textual) for (let up = parent.get(el); up !== void 0; up = parent.get(up)) nested.add(up);
151
+ const blocks = textual.filter((e) => !nested.has(e)).map((el) => ({ el, text: comparable(textOf(el)) }));
152
+ const byLines = (start, end) => {
153
+ const hit = [...stamps].filter(([, s]) => s.start <= end && s.end >= start).map(([el]) => el);
154
+ const outer = /* @__PURE__ */ new Set();
155
+ for (const el of hit) for (let up = parent.get(el); up !== void 0; up = parent.get(up)) outer.add(up);
156
+ return hit.filter((el) => !outer.has(el));
157
+ };
158
+ const byText = (text) => {
159
+ if (text === "") return "no-block";
160
+ const holding = blocks.filter((b) => b.text.includes(text));
161
+ if (holding.length === 1) return holding.map((b) => b.el);
162
+ if (holding.length > 1) return "repeated-text";
163
+ const runs = [];
164
+ let run = [];
165
+ for (const b of blocks) {
166
+ if (b.text.length >= MIN_PART && text.includes(b.text)) run.push(b.el);
167
+ else if (run.length > 0) {
168
+ runs.push(run);
169
+ run = [];
170
+ }
171
+ }
172
+ if (run.length > 0) runs.push(run);
173
+ if (runs.length === 1) return runs[0] ?? "no-block";
174
+ return runs.length === 0 ? "no-block" : "repeated-text";
175
+ };
176
+ const rows = input.rows.flatMap((r) => {
177
+ const span = range(r.lines);
178
+ return span === void 0 ? [] : [{ id: r.id, ...span, section: r.id.includes("#"), metadata: r.metadata }];
179
+ });
180
+ const docId = rows.find((r) => !r.section)?.id ?? input.rows[0]?.id.split("#")[0] ?? "";
181
+ const toFile = (line) => line + input.bodyLine - 1;
182
+ const nodeAt = (line) => {
183
+ const holding = rows.filter((r) => r.start <= line && r.end >= line);
184
+ holding.sort((a, b) => b.start - a.start || a.end - b.end);
185
+ return holding[0]?.id ?? docId;
186
+ };
187
+ const marks = /* @__PURE__ */ new Map();
188
+ const marksOf = (el) => {
189
+ let m = marks.get(el);
190
+ if (m === void 0) {
191
+ m = { pins: [], drifted: false };
192
+ marks.set(el, m);
193
+ }
194
+ return m;
195
+ };
196
+ const result = {
197
+ html,
198
+ pins: { total: 0, placed: 0 },
199
+ statements: { total: 0, placed: 0 },
200
+ unplaced: [],
201
+ drifted: { blocks: 0, ids: [] },
202
+ verified: 0
203
+ };
204
+ const unplaced = (kind, reason, id) => {
205
+ const entry = result.unplaced.find((u) => u.kind === kind && u.reason === reason);
206
+ if (entry === void 0) result.unplaced.push({ kind, ids: [id], reason });
207
+ else entry.ids.push(id);
208
+ };
209
+ const errorIds = /* @__PURE__ */ new Map();
210
+ for (const [i, pin] of pinsOf(input.rows).entries()) {
211
+ result.pins.total += 1;
212
+ const claim = range(pin.claim);
213
+ const id = pin.id ?? `#${String(i + 1)}`;
214
+ if (claim === void 0) {
215
+ unplaced("pin", "no-block", id);
216
+ continue;
217
+ }
218
+ let placed = byLines(toFile(claim.start), toFile(claim.end));
219
+ if (placed.length === 0) {
220
+ const found = byText(input.claimText(claim.start, claim.end));
221
+ if (typeof found === "string") {
222
+ unplaced("pin", found, id);
223
+ continue;
224
+ }
225
+ placed = found;
226
+ }
227
+ result.pins.placed += 1;
228
+ const error = pin.findings.some((f) => f.severity === "error");
229
+ for (const el of placed) {
230
+ const m = marksOf(el);
231
+ m.node ??= nodeAt(claim.start);
232
+ if (!m.pins.includes(id)) m.pins.push(id);
233
+ if (error) {
234
+ m.drifted = true;
235
+ const ids = errorIds.get(el) ?? [];
236
+ ids.push(id);
237
+ errorIds.set(el, ids);
238
+ }
239
+ }
240
+ }
241
+ const blocksIn = /* @__PURE__ */ new Map();
242
+ for (const statement of statementsOf(input.rows)) {
243
+ result.statements.total += 1;
244
+ const span = range(statement.lines);
245
+ const heading = span && rows.find((r) => r.section && r.start >= span.start && r.start <= span.end);
246
+ let node;
247
+ if (heading) node = heading.id;
248
+ else {
249
+ const owner = rows.filter((r) => r.section && span !== void 0 && r.start <= span.start).sort((a, b) => b.start - a.start)[0];
250
+ const key = owner?.id ?? `${docId}#`;
251
+ const n = (blocksIn.get(key) ?? 0) + 1;
252
+ blocksIn.set(key, n);
253
+ node = `${key}.${String(n)}`;
254
+ }
255
+ const placed = span === void 0 ? [] : byLines(toFile(span.start), toFile(span.end));
256
+ if (placed.length === 0) {
257
+ unplaced("statement", "no-block", statement.lines);
258
+ continue;
259
+ }
260
+ result.statements.placed += 1;
261
+ const lastVerified = statement.data["last-verified"];
262
+ const by = tools(statement.data["verified-by"]);
263
+ const appliesTo = heading ? strings(heading.metadata["applies-to"]) : [];
264
+ for (const el of placed) {
265
+ const m = marksOf(el);
266
+ m.node ??= node;
267
+ if (typeof lastVerified === "string") m.verified = lastVerified;
268
+ if (by.length > 0) m.verifiedBy = by.join(" ");
269
+ m.statement = statement.status;
270
+ if (appliesTo.length > 0) m.appliesTo = appliesTo.join(" ");
271
+ }
272
+ }
273
+ const edits = [];
274
+ for (const el of all) {
275
+ const at2 = el.sourceCodeLocation?.attrs;
276
+ if (at2 === void 0) continue;
277
+ for (const a of el.attrs) {
278
+ const loc = at2[a.name];
279
+ if (!a.name.startsWith("data-manni-") || loc === void 0) continue;
280
+ let start = loc.startOffset;
281
+ while (start > 0 && /\s/.test(html[start - 1] ?? "")) start -= 1;
282
+ edits.push({ start, end: loc.endOffset, text: "" });
283
+ }
284
+ if (el.tagName === "script" && attr(el, "id") === ISLAND_ID) {
285
+ const loc = el.sourceCodeLocation;
286
+ if (loc?.startTag !== void 0 && loc.endTag !== void 0) {
287
+ const end = html[loc.endTag.endOffset] === "\n" ? loc.endTag.endOffset + 1 : loc.endTag.endOffset;
288
+ edits.push({ start: loc.startTag.startOffset, end, text: "" });
289
+ }
290
+ }
291
+ }
292
+ for (const [el, m] of marks) {
293
+ const pairs = [
294
+ ["node", m.node],
295
+ ["pins", m.pins.length > 0 ? m.pins.join(" ") : void 0],
296
+ ["state", m.pins.length > 0 ? m.drifted ? "drifted" : "current" : void 0],
297
+ ["verified", m.verified],
298
+ ["verified-by", m.verifiedBy],
299
+ ["statement", m.statement],
300
+ ["applies-to", m.appliesTo]
301
+ ];
302
+ insertAttrs(el, pairs, html, edits);
303
+ if (m.drifted) {
304
+ result.drifted.blocks += 1;
305
+ for (const id of errorIds.get(el) ?? []) if (!result.drifted.ids.includes(id)) result.drifted.ids.push(id);
306
+ }
307
+ if (m.statement !== void 0 && (m.verified !== void 0 || m.verifiedBy !== void 0)) result.verified += 1;
308
+ }
309
+ const records = pageRecords(input.rows);
310
+ const first = records[0];
311
+ const page = scope ?? body;
312
+ if (page !== void 0) {
313
+ insertAttrs(
314
+ page,
315
+ [
316
+ ["commit", input.commit ?? void 0],
317
+ ["last-verified", first?.dates.lastVerified ?? void 0]
318
+ ],
319
+ html,
320
+ edits
321
+ );
322
+ }
323
+ const island = {
324
+ page: first?.page ?? "",
325
+ commit: input.commit,
326
+ worktree: first?.worktree ?? null,
327
+ dates: first?.dates ?? null,
328
+ records
329
+ };
330
+ const json = JSON.stringify(island).replace(/</g, "\\u003c");
331
+ const closeBody = body?.sourceCodeLocation?.endTag?.startOffset;
332
+ const at = closeBody ?? html.length;
333
+ edits.push({ start: at, end: at, text: `<script type="application/json" id="${ISLAND_ID}">${json}</script>
334
+ ` });
335
+ result.html = applyEdits(html, edits);
336
+ return result;
337
+ }
338
+ var escapeAttr = (value) => value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
339
+ function insertAttrs(el, pairs, html, edits) {
340
+ const tag = el.sourceCodeLocation?.startTag;
341
+ if (tag === void 0) return;
342
+ const text = pairs.filter((p) => p[1] !== void 0).map(([name, value]) => ` data-manni-${name}="${escapeAttr(value)}"`).join("");
343
+ if (text === "") return;
344
+ const at = html[tag.endOffset - 2] === "/" ? tag.endOffset - 2 : tag.endOffset - 1;
345
+ edits.push({ start: at, end: at, text });
346
+ }
347
+ function applyEdits(html, edits) {
348
+ const sorted = [...edits].sort((a, b) => b.start - a.start || b.end - a.end);
349
+ let out = html;
350
+ for (const e of sorted) out = out.slice(0, e.start) + e.text + out.slice(e.end);
351
+ return out;
352
+ }
353
+ function stripStamps(html) {
354
+ if (!html.includes(STAMP)) return html;
355
+ const doc = parse(html, { sourceCodeLocationInfo: true });
356
+ const edits = [];
357
+ for (const el of walk(doc).all) {
358
+ const loc = el.sourceCodeLocation?.attrs?.[STAMP];
359
+ if (loc === void 0) continue;
360
+ let start = loc.startOffset;
361
+ while (start > 0 && /\s/.test(html[start - 1] ?? "")) start -= 1;
362
+ edits.push({ start, end: loc.endOffset, text: "" });
363
+ }
364
+ return applyEdits(html, edits);
365
+ }
366
+ function stampedFiles(html) {
367
+ const out = /* @__PURE__ */ new Set();
368
+ for (const m of html.matchAll(/data-manni-src="([^"]*):\d+-\d+"/g)) if (m[1] !== void 0) out.add(m[1]);
369
+ return out;
370
+ }
371
+
372
+ // src/site/commands/annotate.ts
373
+ var ANNOTATE_FORMATS = ["pretty", "json"];
374
+ var slash = (path) => path.split("\\").join("/");
375
+ function isDirectory(path) {
376
+ try {
377
+ return statSync(path).isDirectory();
378
+ } catch {
379
+ return false;
380
+ }
381
+ }
382
+ function htmlFiles(dir) {
383
+ return readdirSync(dir, { recursive: true, withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".html")).map((e) => join(e.parentPath, e.name)).sort();
384
+ }
385
+ function routeOf(layout, siteDir, page) {
386
+ const rel = slash(relative(resolve2(siteDir, layout.content), page));
387
+ if (rel.startsWith("../") || rel === "..") return void 0;
388
+ const parts = rel.slice(0, rel.length - extname(rel).length).split("/");
389
+ const index = parts.at(-1) === "index";
390
+ if (index) parts.pop();
391
+ const path = parts.join("/");
392
+ const file = path === "" ? "index.html" : layout.route === "dir" || index ? `${path}/index.html` : `${path}.html`;
393
+ return `${layout.prefix ?? ""}${file}`;
394
+ }
395
+ function readArtifact(path, label, shown) {
396
+ if (!existsSync(path)) throw new SiteError(`${label} does not exist; run manni graph publish.`);
397
+ let manifest;
398
+ try {
399
+ manifest = parseChunksManifest(readFileSync(path, "utf8"));
400
+ } catch {
401
+ throw new SiteError(`${label} is not a chunk manifest; run manni graph publish.`);
402
+ }
403
+ const stale = new SiteError(`${label} was built from another graph; run manni graph publish.`);
404
+ const graphFile = resolve2(dirname(path), manifest.graphFile);
405
+ if (existsSync(graphFile) && integrityOf(readFileSync(graphFile)) !== manifest.graph) throw stale;
406
+ const rows = [];
407
+ for (const language of Object.values(manifest.languages)) {
408
+ const file = resolve2(dirname(path), language.file);
409
+ if (!existsSync(file)) throw new SiteError(`${shown(file)} does not exist; run manni graph publish.`);
410
+ try {
411
+ rows.push(...parseChunkRows(readFileSync(file, "utf8")));
412
+ } catch (e) {
413
+ throw new SiteError(`${shown(file)}: ${errorMessage(e)} Run manni graph publish.`);
414
+ }
415
+ }
416
+ if (rows.some((r) => r.graph !== manifest.graph)) throw stale;
417
+ return { manifest, rows };
418
+ }
419
+ function claimTexts(page, label) {
420
+ let content;
421
+ try {
422
+ content = readFileSync(page, "utf8");
423
+ } catch (e) {
424
+ warn(`${label} could not be read, so its pins are placed by line alone: ${errorMessage(e)}.`);
425
+ return { bodyLine: 1, text: () => "" };
426
+ }
427
+ const format = formatOf(page);
428
+ const bodyLine = format === "html" || format === "xml" ? 1 : bodyLineOf(content, locateFrontmatter(content)?.closeEnd ?? 0);
429
+ const lines = content.split(/\r?\n/);
430
+ return {
431
+ bodyLine,
432
+ text: (start, end) => {
433
+ const from = Math.max(0, start + bodyLine - 2);
434
+ const to = Math.min(lines.length, end + bodyLine - 1);
435
+ return to <= from ? "" : renderedText(lines.slice(from, to));
436
+ }
437
+ };
438
+ }
439
+ function runAnnotate(opts) {
440
+ const { cwd } = opts;
441
+ const shown = (path) => slash(relative(cwd, path)) || ".";
442
+ const site = resolveAnnotateSite(opts);
443
+ const configured = site.config.out;
444
+ const out = opts.out !== void 0 ? resolve2(cwd, opts.out) : resolve2(site.dir, configured ?? site.layout?.out ?? ".");
445
+ const outLabel = shown(out);
446
+ if (!isDirectory(out)) {
447
+ const server = site.framework === "Nextra" || site.framework === "Fumadocs";
448
+ if (server && opts.out === void 0 && configured === void 0) {
449
+ throw new SiteError(
450
+ `${outLabel} does not exist. ${site.framework ?? ""} writes static pages only with output: "export" in next.config.`
451
+ );
452
+ }
453
+ throw new SiteError(`no built site at ${outLabel}. Run manni site build first, or pass --out.`);
454
+ }
455
+ let graph;
456
+ try {
457
+ graph = loadRunConfig(opts.configPath === void 0 ? {} : { configPath: opts.configPath }, cwd);
458
+ } catch (e) {
459
+ throw new SiteError(errorMessage(e));
460
+ }
461
+ const chunks = opts.chunks !== void 0 ? resolve2(cwd, opts.chunks) : join(dirname(resolve2(cwd, graph.out)), "chunks.json");
462
+ const label = shown(chunks);
463
+ const { manifest, rows } = readArtifact(chunks, label, shown);
464
+ notice(`${site.framework === null ? "" : `${site.framework} in ${site.where}. `}Annotating ${outLabel} from ${label}.`);
465
+ if (manifest.commit === null) notice(`${basename(chunks)} carries no commit, so pages get no data-manni-commit.`);
466
+ const files = htmlFiles(out);
467
+ const stampedBy = /* @__PURE__ */ new Map();
468
+ for (const file of files) {
469
+ for (const source of stampedFiles(readFileSync(file, "utf8"))) {
470
+ const abs = resolve2(site.dir, source);
471
+ stampedBy.set(abs, [...stampedBy.get(abs) ?? [], file]);
472
+ }
473
+ }
474
+ if (stampedBy.size === 0 && site.layout?.unified === true) {
475
+ warn(
476
+ `${outLabel} carries no line stamps, so blocks are placed by text alone. Add @hawkeyexl/manni/site/rehype to the framework's rehype plugins.`
477
+ );
478
+ }
479
+ const byPage = /* @__PURE__ */ new Map();
480
+ for (const row of rows) byPage.set(row.page, [...byPage.get(row.page) ?? [], row]);
481
+ const base = documentBase(graph, {}, cwd);
482
+ const report = {
483
+ out: outLabel,
484
+ pages: 0,
485
+ pins: { total: 0, placed: 0 },
486
+ statements: { total: 0, placed: 0 },
487
+ verified: 0,
488
+ notes: []
489
+ };
490
+ const joined = /* @__PURE__ */ new Set();
491
+ for (const page of [...byPage.keys()].sort()) {
492
+ const pageRows = byPage.get(page) ?? [];
493
+ const source = resolve2(base, page);
494
+ const route = site.layout === null ? void 0 : routeOf(site.layout, site.dir, source);
495
+ const routed = route === void 0 ? void 0 : join(out, route);
496
+ const stamped = stampedBy.get(source) ?? [];
497
+ const html = stamped.length === 1 ? stamped[0] : stamped.length > 1 ? stamped.find((f) => f === routed) ?? stamped[0] : routed !== void 0 && existsSync(routed) ? routed : void 0;
498
+ const texts = claimTexts(source, shown(source));
499
+ const result = joinPage({
500
+ html: html === void 0 ? "" : readFileSync(html, "utf8"),
501
+ file: source,
502
+ stampBase: site.dir,
503
+ bodyLine: texts.bodyLine,
504
+ claimText: texts.text,
505
+ rows: pageRows,
506
+ commit: manifest.commit
507
+ });
508
+ report.pins.total += result.pins.total;
509
+ report.statements.total += result.statements.total;
510
+ if (html === void 0) {
511
+ const expected = routed === void 0 ? void 0 : shown(routed);
512
+ const all = result.unplaced;
513
+ const ids = (kind) => all.filter((u) => u.kind === kind).flatMap((u) => u.ids);
514
+ for (const kind of ["pin", "statement"]) {
515
+ if (ids(kind).length > 0) report.notes.push({ kind, page, ids: ids(kind), reason: "no-page", ...expected === void 0 ? {} : { expected } });
516
+ }
517
+ continue;
518
+ }
519
+ if (joined.has(html)) continue;
520
+ joined.add(html);
521
+ writeFileSync(html, result.html, "utf8");
522
+ const at = slash(relative(out, html));
523
+ report.pages += 1;
524
+ report.pins.placed += result.pins.placed;
525
+ report.statements.placed += result.statements.placed;
526
+ report.verified += result.verified;
527
+ if (result.drifted.blocks > 0) report.notes.push({ kind: "drifted", page: at, ids: result.drifted.ids, blocks: result.drifted.blocks });
528
+ for (const u of result.unplaced) report.notes.push({ kind: u.kind, page: at, ids: u.ids, reason: u.reason });
529
+ }
530
+ for (const file of files) {
531
+ if (joined.has(file)) continue;
532
+ const text = readFileSync(file, "utf8");
533
+ const clean = stripStamps(text);
534
+ if (clean !== text) writeFileSync(file, clean, "utf8");
535
+ }
536
+ return report;
537
+ }
538
+ var plural = (n, one, many) => `${String(n)} ${n === 1 ? one : many}`;
539
+ function renderAnnotate(report, format) {
540
+ if (format === "json") {
541
+ const unplaced = report.notes.flatMap(
542
+ (n) => n.kind === "drifted" ? [] : [{ page: n.page, kind: n.kind, ids: n.ids, reason: n.reason }]
543
+ );
544
+ const drifted = report.notes.flatMap((n) => n.kind === "drifted" ? [{ page: n.page, ids: n.ids }] : []);
545
+ return JSON.stringify(
546
+ { out: report.out, pages: report.pages, pins: report.pins, statements: report.statements, unplaced, drifted },
547
+ null,
548
+ 2
549
+ );
550
+ }
551
+ const { pins } = report;
552
+ const lines = [
553
+ `${report.out}: ${plural(report.pages, "page", "pages")} annotated. ${String(pins.placed)} of ${String(pins.total)} pins placed, ${String(pins.total - pins.placed)} listed on their page only. ${plural(report.verified, "block carries", "blocks carry")} a verification.`
554
+ ];
555
+ let lastMissing = "";
556
+ for (const n of report.notes) {
557
+ const ids = n.ids.join(", ");
558
+ const its = n.ids.length === 1 ? "its" : "their";
559
+ if (n.kind === "drifted") {
560
+ lines.push(` ${n.page}: ${plural(n.blocks, "block", "blocks")} drifted, because a source changed: ${ids}.`);
561
+ } else if (n.reason === "no-page") {
562
+ if (n.page === lastMissing) continue;
563
+ lastMissing = n.page;
564
+ lines.push(` ${n.page}: no built page ${n.expected === void 0 ? `in ${report.out}` : `at ${n.expected}`}.`);
565
+ } else if (n.kind === "statement") {
566
+ lines.push(` ${n.page}: ${plural(n.ids.length, "statement", "statements")} not placed, because no block holds lines ${ids}.`);
567
+ } else {
568
+ const why = n.reason === "repeated-text" ? `${its} text appears twice` : `no block holds ${its} text`;
569
+ lines.push(` ${n.page}: ${plural(n.ids.length, "pin", "pins")} not placed, because ${why}: ${ids}.`);
570
+ }
571
+ }
572
+ return lines.join("\n");
573
+ }
574
+
575
+ export {
576
+ ANNOTATE_FORMATS,
577
+ runAnnotate,
578
+ renderAnnotate
579
+ };
580
+ //# sourceMappingURL=chunk-WRSWZEVU.js.map