scip-query 0.21.0 → 0.22.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 (496) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/dist/augment-vue-worker.js +1 -1
  3. package/dist/by-kind-4IYG2SKW.js +2 -0
  4. package/dist/call-graph-WQNXMNNN.js +2 -0
  5. package/dist/{chunk-AQDWTCDC.js → chunk-25GWKRUZ.js} +2 -2
  6. package/dist/chunk-2BTJALUS.js +454 -0
  7. package/dist/chunk-2KVU55CW.js +11 -0
  8. package/dist/{chunk-BBWPOMGU.js → chunk-2OXVP5U5.js} +2 -2
  9. package/dist/{chunk-D5W4UZY5.js → chunk-2RE5OCHZ.js} +2 -2
  10. package/dist/{chunk-2I3RSUWX.js → chunk-2XCGSDIT.js} +2 -2
  11. package/dist/{chunk-V7LQZTTZ.js → chunk-2YC7YNKT.js} +2 -2
  12. package/dist/chunk-3QXC54FQ.js +3 -0
  13. package/dist/{chunk-32A42O5B.js → chunk-3TJY6M3B.js} +2 -2
  14. package/dist/chunk-42W3LFUK.js +13 -0
  15. package/dist/chunk-44T4DUAA.js +2 -0
  16. package/dist/chunk-4GAQ6FI4.js +43 -0
  17. package/dist/{chunk-4S4DF62J.js → chunk-4HE7MVWD.js} +2 -2
  18. package/dist/{chunk-TGWNNMPF.js → chunk-4TQU4TX2.js} +2 -2
  19. package/dist/{chunk-SKUMCCC5.js → chunk-56NQAEPJ.js} +2 -2
  20. package/dist/chunk-57N6LN2A.js +3 -0
  21. package/dist/{chunk-LPGDO2XA.js → chunk-5H5WTJSD.js} +2 -2
  22. package/dist/{chunk-EA4SH4U5.js → chunk-5YRQIE2B.js} +2 -2
  23. package/dist/{chunk-O2RM7E7L.js → chunk-5ZMBRQFC.js} +4 -4
  24. package/dist/{chunk-ICHBVITH.js → chunk-6HRZQLOI.js} +2 -2
  25. package/dist/{chunk-WULAPQUD.js → chunk-6NC3YSPY.js} +2 -2
  26. package/dist/{chunk-IDPLC3FI.js → chunk-6VEFRPTD.js} +2 -2
  27. package/dist/{chunk-IOKWFRFQ.js → chunk-7C26EKLZ.js} +2 -2
  28. package/dist/{chunk-S3RTPPLQ.js → chunk-7IQXARSQ.js} +2 -2
  29. package/dist/chunk-7JYHQAH2.js +22 -0
  30. package/dist/chunk-7KSO2OAP.js +2 -0
  31. package/dist/{chunk-2ZBMOQGG.js → chunk-7U2YQSDE.js} +2 -2
  32. package/dist/{chunk-EKZRF57O.js → chunk-7XA3OM44.js} +2 -2
  33. package/dist/{chunk-4EXFZP6H.js → chunk-7XZGZBSQ.js} +2 -2
  34. package/dist/chunk-7YQOCABQ.js +2 -0
  35. package/dist/chunk-A77SCPW2.js +3 -0
  36. package/dist/chunk-AK3PYTIK.js +5 -0
  37. package/dist/chunk-AMIMMNA4.js +11 -0
  38. package/dist/{chunk-MOBF2GH6.js → chunk-AQ2PORIO.js} +2 -2
  39. package/dist/{chunk-YUFWLWIC.js → chunk-ARVO6TTW.js} +2 -2
  40. package/dist/chunk-AUY5BL74.js +2 -0
  41. package/dist/{chunk-RGCJ4646.js → chunk-AYPDH2LU.js} +2 -2
  42. package/dist/{chunk-73Z33VFI.js → chunk-AZS7YPCB.js} +2 -2
  43. package/dist/{chunk-SYUNTKO2.js → chunk-BDGTPN27.js} +2 -2
  44. package/dist/{chunk-BATIVRU2.js → chunk-BDHFVH2M.js} +2 -2
  45. package/dist/chunk-BECZLYNU.js +8 -0
  46. package/dist/chunk-BJT7LSPK.js +3 -0
  47. package/dist/{chunk-6SWA6B24.js → chunk-BTVKZGWT.js} +2 -2
  48. package/dist/{chunk-QD7IFBCR.js → chunk-BUTEIZKP.js} +2 -2
  49. package/dist/{chunk-UZFCZ7SJ.js → chunk-BVFYEEBH.js} +2 -2
  50. package/dist/{chunk-ICUQONOG.js → chunk-BWVQP3LB.js} +2 -2
  51. package/dist/chunk-BYDAFMSR.js +57 -0
  52. package/dist/{chunk-BHE44MHT.js → chunk-C76O5MDS.js} +2 -2
  53. package/dist/chunk-C7IJMOFP.js +134 -0
  54. package/dist/{chunk-CN2WGM7D.js → chunk-CBBHFNLX.js} +2 -2
  55. package/dist/{chunk-COTMS5KM.js → chunk-CKRWA452.js} +2 -2
  56. package/dist/{chunk-ANWGXPPN.js → chunk-CLG6DWVS.js} +2 -2
  57. package/dist/chunk-D2MVJSP4.js +21 -0
  58. package/dist/chunk-D35XIZGN.js +2 -0
  59. package/dist/{chunk-U7DR7MJD.js → chunk-DEAB5TGT.js} +2 -2
  60. package/dist/{chunk-6GJAP4OE.js → chunk-DJAO2OZJ.js} +2 -2
  61. package/dist/chunk-DKM723YF.js +79 -0
  62. package/dist/{chunk-4IIMPWMR.js → chunk-DPWKKNKI.js} +2 -2
  63. package/dist/chunk-E44IVWIJ.js +367 -0
  64. package/dist/chunk-EDMB6SSO.js +7 -0
  65. package/dist/{chunk-KWARB5FZ.js → chunk-EELG7D3Q.js} +2 -2
  66. package/dist/chunk-EELPBR7E.js +3 -0
  67. package/dist/chunk-EETGXQY7.js +3 -0
  68. package/dist/chunk-ENWQWA2R.js +2 -0
  69. package/dist/{chunk-HUZNZ3H2.js → chunk-ERCYGVAM.js} +2 -2
  70. package/dist/{chunk-WSG3DK5H.js → chunk-EWWY2ZFL.js} +2 -2
  71. package/dist/chunk-F24G5NBE.js +3 -0
  72. package/dist/{chunk-XRXCANFQ.js → chunk-F24QUEQP.js} +2 -2
  73. package/dist/{chunk-KFK7GF5C.js → chunk-FBCVASUG.js} +2 -2
  74. package/dist/{chunk-35IW3P4H.js → chunk-FELGD32K.js} +2 -2
  75. package/dist/{chunk-UNORWZIJ.js → chunk-FFJQZG6J.js} +5 -5
  76. package/dist/{chunk-5SE323LF.js → chunk-FGNCOQUX.js} +2 -2
  77. package/dist/chunk-FKGQOTKD.js +2 -0
  78. package/dist/chunk-GDRJB3SB.js +3 -0
  79. package/dist/chunk-GH5YSGZL.js +5 -0
  80. package/dist/{chunk-X7PJJYKX.js → chunk-GIQ6CSL4.js} +2 -2
  81. package/dist/{chunk-2RP27XLR.js → chunk-GPGRZJ3R.js} +2 -2
  82. package/dist/{chunk-IYV2YBHM.js → chunk-GQIDEID3.js} +2 -2
  83. package/dist/chunk-GRX7JOXQ.js +2 -0
  84. package/dist/{chunk-H46QMB7E.js → chunk-GVOMSPGL.js} +2 -2
  85. package/dist/{chunk-KTRGJLY7.js → chunk-GY7CCCEZ.js} +2 -2
  86. package/dist/{chunk-VNKYRJKN.js → chunk-H7CG6LOE.js} +2 -2
  87. package/dist/chunk-HCVJR2V4.js +3 -0
  88. package/dist/chunk-HG722PO7.js +3 -0
  89. package/dist/{chunk-LHTT5C3Z.js → chunk-HISEUIL2.js} +2 -2
  90. package/dist/{chunk-K5MZYZV7.js → chunk-HXOU4XNH.js} +2 -2
  91. package/dist/chunk-I6UTXNHU.js +6 -0
  92. package/dist/{chunk-I7PFL5P3.js → chunk-IJMD6BRI.js} +2 -2
  93. package/dist/{chunk-XXJ7WL3F.js → chunk-IKVNEGTW.js} +2 -2
  94. package/dist/chunk-IMKZEXZG.js +2 -0
  95. package/dist/chunk-ISIQLPJ2.js +61 -0
  96. package/dist/{chunk-DEUGHURX.js → chunk-ISWFRGJ6.js} +2 -2
  97. package/dist/chunk-IW5XQG5G.js +2 -0
  98. package/dist/chunk-IXESDH3J.js +2 -0
  99. package/dist/{chunk-FGB567HK.js → chunk-JAT6C3VX.js} +2 -2
  100. package/dist/{chunk-7TWP3MCP.js → chunk-JFQBRL3J.js} +2 -2
  101. package/dist/{chunk-Q7HB7BFJ.js → chunk-JHH5SCZ3.js} +2 -2
  102. package/dist/{chunk-ZHSARYVS.js → chunk-JJ62MTQH.js} +2 -2
  103. package/dist/chunk-JT6XX7QY.js +8 -0
  104. package/dist/{chunk-5H7IWVXJ.js → chunk-JUN5DOAK.js} +2 -2
  105. package/dist/{chunk-DOPCR5BY.js → chunk-K3XFWJI2.js} +2 -2
  106. package/dist/{chunk-Y4XQ7LES.js → chunk-KFOYCQAJ.js} +1 -1
  107. package/dist/{chunk-N5C65OFK.js → chunk-KFVSJX25.js} +2 -2
  108. package/dist/chunk-KK7GPALL.js +28 -0
  109. package/dist/{chunk-DHKBIOXF.js → chunk-KQHJEU6V.js} +2 -2
  110. package/dist/{chunk-WB6LGCFB.js → chunk-KZYID5KV.js} +2 -2
  111. package/dist/{chunk-KW6B5OL4.js → chunk-LO5JSW2C.js} +2 -2
  112. package/dist/{chunk-ZW44MCJM.js → chunk-LRI5OMPE.js} +2 -2
  113. package/dist/{chunk-HG5YI7PV.js → chunk-LXQUF2RP.js} +2 -2
  114. package/dist/{chunk-TM5XEDDR.js → chunk-MHIEP7EG.js} +2 -2
  115. package/dist/{chunk-FHV7NMFU.js → chunk-MSR2QRUE.js} +2 -2
  116. package/dist/chunk-N7FP5H5U.js +57 -0
  117. package/dist/{chunk-3653GTR7.js → chunk-NEIQPFBI.js} +2 -2
  118. package/dist/chunk-NK3JMP22.js +2 -0
  119. package/dist/{chunk-7IOAZRVL.js → chunk-NRBNAECH.js} +2 -2
  120. package/dist/{chunk-HGKEAP7F.js → chunk-NVSZNESQ.js} +2 -2
  121. package/dist/{chunk-R2MOKIVO.js → chunk-OJNK5ALA.js} +2 -2
  122. package/dist/{chunk-RFWAUHVW.js → chunk-OPSAW5DT.js} +2 -2
  123. package/dist/chunk-OTSPRVNW.js +2 -0
  124. package/dist/chunk-OXYAWIEA.js +2 -0
  125. package/dist/chunk-OZETODHH.js +2 -0
  126. package/dist/chunk-PBUH2P5S.js +3 -0
  127. package/dist/{chunk-QBANU5BQ.js → chunk-PIFTZEEM.js} +2 -2
  128. package/dist/{chunk-CKDOY6JA.js → chunk-PLJUQFQN.js} +2 -2
  129. package/dist/{chunk-JVZNWJBH.js → chunk-PLYUVM4F.js} +2 -2
  130. package/dist/chunk-PXXYQK55.js +2 -0
  131. package/dist/{chunk-WZQFY5S7.js → chunk-Q55NF3ZG.js} +2 -2
  132. package/dist/{chunk-OVPS2ILI.js → chunk-Q5TA4OY4.js} +2 -2
  133. package/dist/{chunk-OUB4J26T.js → chunk-Q6T2CAJL.js} +2 -2
  134. package/dist/chunk-Q7GBK5T7.js +81 -0
  135. package/dist/chunk-QKT4UI2Y.js +2 -0
  136. package/dist/{chunk-PIZY2GX6.js → chunk-QLBSG7U5.js} +2 -2
  137. package/dist/chunk-QWKHW6VZ.js +2 -0
  138. package/dist/{chunk-E7BJXRNV.js → chunk-R6M456QG.js} +2 -2
  139. package/dist/{chunk-MJNV7OCG.js → chunk-RDULNRSJ.js} +2 -2
  140. package/dist/{chunk-SSSJO4RG.js → chunk-RHHCLWQ6.js} +2 -2
  141. package/dist/chunk-RNKPYYYE.js +4 -0
  142. package/dist/{chunk-IXJ26KJJ.js → chunk-RPL3ARU7.js} +2 -2
  143. package/dist/{chunk-3EX7DNBC.js → chunk-RYOYJMGF.js} +2 -2
  144. package/dist/chunk-SB25YMEQ.js +2 -0
  145. package/dist/chunk-SV2LEFVM.js +2 -0
  146. package/dist/{chunk-ZBNL3QCY.js → chunk-SVHTMVA4.js} +3 -3
  147. package/dist/{chunk-6IEVHGWG.js → chunk-SWK4XPUS.js} +2 -2
  148. package/dist/chunk-T6QD2ZQB.js +43 -0
  149. package/dist/{chunk-VETXXOYU.js → chunk-TAYD3AE7.js} +2 -2
  150. package/dist/chunk-TD7VKJ2Y.js +117 -0
  151. package/dist/{chunk-UQ7XPRWU.js → chunk-TH6IC56G.js} +2 -2
  152. package/dist/{chunk-XVDMJMES.js → chunk-TKDNDQA7.js} +2 -2
  153. package/dist/{chunk-CSDDOUA4.js → chunk-TNG2FYS5.js} +2 -2
  154. package/dist/chunk-TQZV7KV4.js +2 -0
  155. package/dist/{chunk-AJVMVE7X.js → chunk-TUQIPUDS.js} +2 -2
  156. package/dist/chunk-TUSPIVZ3.js +4 -0
  157. package/dist/{chunk-ORBKAUCH.js → chunk-U2N2KE7A.js} +2 -2
  158. package/dist/{chunk-3PII3JI5.js → chunk-UAQ4T73O.js} +2 -2
  159. package/dist/{chunk-OFY4HTMI.js → chunk-UDY7MIAW.js} +2 -2
  160. package/dist/{chunk-WKPZCQLI.js → chunk-URSGGIZX.js} +2 -2
  161. package/dist/{chunk-UL4VJUMD.js → chunk-UT7TADJX.js} +2 -2
  162. package/dist/chunk-V4NG5OMS.js +554 -0
  163. package/dist/{chunk-2H4IAJHO.js → chunk-VMWUV6WB.js} +2 -2
  164. package/dist/{chunk-46JLFIGA.js → chunk-VTCIYFEK.js} +2 -2
  165. package/dist/chunk-VU6LIWHT.js +2 -0
  166. package/dist/chunk-VUSKPCUB.js +2 -0
  167. package/dist/{chunk-URMZLV2N.js → chunk-VXJJTQYE.js} +2 -2
  168. package/dist/{chunk-IPAL6DP2.js → chunk-VZ7NXSHV.js} +2 -2
  169. package/dist/{chunk-FUG6RPYY.js → chunk-WHADK6OS.js} +2 -2
  170. package/dist/chunk-WN3TCGJ4.js +2 -0
  171. package/dist/{chunk-B7ECWJAZ.js → chunk-WOOAY3PA.js} +2 -2
  172. package/dist/chunk-WRQXLNYE.js +9 -0
  173. package/dist/chunk-WSLEJSFR.js +2 -0
  174. package/dist/chunk-WYZIHUPZ.js +16 -0
  175. package/dist/{chunk-ZYREOING.js → chunk-XE33FV5W.js} +2 -2
  176. package/dist/chunk-XFMVKFSF.js +2 -0
  177. package/dist/{chunk-BBEDPVPB.js → chunk-XGGBK66W.js} +2 -2
  178. package/dist/{chunk-OFUBXBYX.js → chunk-XJX6LGHL.js} +2 -2
  179. package/dist/{chunk-Z3GCK3PD.js → chunk-XN22RGSR.js} +2 -2
  180. package/dist/{chunk-HWLCBKFE.js → chunk-XSWYJCAK.js} +2 -2
  181. package/dist/{chunk-IGKKTHJR.js → chunk-XU75YQN4.js} +2 -2
  182. package/dist/{chunk-E4EJBGDZ.js → chunk-Y2VM4CJC.js} +2 -2
  183. package/dist/{chunk-U7LRSQG6.js → chunk-Y334QQU5.js} +2 -2
  184. package/dist/{chunk-APLKXICZ.js → chunk-YAGYMBEX.js} +2 -2
  185. package/dist/{chunk-XITQLISP.js → chunk-YIHNPKWD.js} +2 -2
  186. package/dist/chunk-YXPUP5G2.js +11 -0
  187. package/dist/{chunk-6BJ7SOY7.js → chunk-Z2AWCTN6.js} +2 -2
  188. package/dist/{chunk-PHSPBQM6.js → chunk-Z2PZVKPR.js} +2 -2
  189. package/dist/{chunk-QXR5QPSF.js → chunk-ZAZGGSM3.js} +2 -2
  190. package/dist/{chunk-5236NQV3.js → chunk-ZGW4HLPD.js} +2 -2
  191. package/dist/chunk-ZOXKSQQB.js +2 -0
  192. package/dist/{chunk-BD6CV7PN.js → chunk-ZPASRBLF.js} +2 -2
  193. package/dist/{chunk-DMUGTKMD.js → chunk-ZYM4HOFA.js} +2 -2
  194. package/dist/{chunk-4ILHWBYF.js → chunk-ZZ3Z7D56.js} +2 -2
  195. package/dist/cli-main.js +4 -4
  196. package/dist/{code-CczEvHui.d.ts → code-B17qEMbt.d.ts} +1 -1
  197. package/dist/code-EQJFDT6I.js +2 -0
  198. package/dist/code-result-json-7UWIWBOO.js +2 -0
  199. package/dist/command-descriptors-ORNTVNYV.js +342 -0
  200. package/dist/{config-types-Cm-VSEBb.d.ts → config-types-B9B60MiR.d.ts} +10 -0
  201. package/dist/dataflow-6VL54GX5.js +2 -0
  202. package/dist/{db-LKJXAlNS.d.ts → db-BwIVAYNB.d.ts} +1 -1
  203. package/dist/dependence-slice-DT2NUHD2.js +2 -0
  204. package/dist/deps-DB7H5IKC.js +2 -0
  205. package/dist/direct-navigation-O3LUAYWQ.js +3 -0
  206. package/dist/entry-map-6K62RV3D.js +2 -0
  207. package/dist/files-MSLD7MO6.js +2 -0
  208. package/dist/{graph-evidence-CbUPCSKV.d.ts → graph-evidence-Bjyky2V4.d.ts} +1 -1
  209. package/dist/{health-Wl5G_LRt.d.ts → health-CPp2Jf1Z.d.ts} +1 -1
  210. package/dist/hierarchy-IVBXAKFA.js +2 -0
  211. package/dist/imports-FRAVZ3Y2.js +2 -0
  212. package/dist/index.d.ts +2 -2
  213. package/dist/index.js +1 -1
  214. package/dist/members-KJOJDYGO.js +2 -0
  215. package/dist/methods-2AYABBT3.js +2 -0
  216. package/dist/output-continuation-command-JHMPH6NC.js +3 -0
  217. package/dist/{output-pagination-VAWOGX4R.js → output-pagination-3OFL2MJV.js} +2 -2
  218. package/dist/project-reindex-HYO4WD7Z.js +3 -0
  219. package/dist/queries/affected.d.ts +2 -2
  220. package/dist/queries/affected.js +1 -1
  221. package/dist/queries/anchors.d.ts +2 -2
  222. package/dist/queries/anchors.js +1 -1
  223. package/dist/queries/architecture.d.ts +2 -2
  224. package/dist/queries/architecture.js +1 -1
  225. package/dist/queries/bottlenecks.d.ts +2 -2
  226. package/dist/queries/bottlenecks.js +1 -1
  227. package/dist/queries/by-kind.d.ts +2 -2
  228. package/dist/queries/by-kind.js +1 -1
  229. package/dist/queries/call-graph.d.ts +2 -2
  230. package/dist/queries/call-graph.js +1 -1
  231. package/dist/queries/change-surface.d.ts +2 -2
  232. package/dist/queries/change-surface.js +1 -1
  233. package/dist/queries/cleanup-plan.d.ts +2 -2
  234. package/dist/queries/cleanup-plan.js +1 -1
  235. package/dist/queries/co-change.d.ts +2 -2
  236. package/dist/queries/co-change.js +1 -1
  237. package/dist/queries/code.d.ts +3 -3
  238. package/dist/queries/code.js +1 -1
  239. package/dist/queries/complexity-hotspots.d.ts +2 -2
  240. package/dist/queries/complexity-hotspots.js +1 -1
  241. package/dist/queries/complexity.d.ts +13 -2
  242. package/dist/queries/complexity.js +1 -1
  243. package/dist/queries/context.d.ts +2 -2
  244. package/dist/queries/context.js +1 -1
  245. package/dist/queries/convergence.d.ts +2 -2
  246. package/dist/queries/convergence.js +1 -1
  247. package/dist/queries/coupling.d.ts +2 -2
  248. package/dist/queries/coupling.js +1 -1
  249. package/dist/queries/cycles.d.ts +2 -2
  250. package/dist/queries/cycles.js +1 -1
  251. package/dist/queries/dataflow.d.ts +2 -2
  252. package/dist/queries/dataflow.js +1 -1
  253. package/dist/queries/dead.d.ts +2 -2
  254. package/dist/queries/dead.js +1 -1
  255. package/dist/queries/decorative-checkers.d.ts +2 -2
  256. package/dist/queries/decorative-checkers.js +1 -1
  257. package/dist/queries/deep-chains.d.ts +2 -2
  258. package/dist/queries/deep-chains.js +1 -1
  259. package/dist/queries/dependence-slice.d.ts +3 -3
  260. package/dist/queries/dependence-slice.js +1 -1
  261. package/dist/queries/dependency-depth.d.ts +2 -2
  262. package/dist/queries/dependency-depth.js +1 -1
  263. package/dist/queries/deps.d.ts +2 -2
  264. package/dist/queries/deps.js +1 -1
  265. package/dist/queries/diff-impact.d.ts +2 -2
  266. package/dist/queries/diff-impact.js +1 -1
  267. package/dist/queries/doc-drift.d.ts +2 -2
  268. package/dist/queries/doc-drift.js +1 -1
  269. package/dist/queries/drift.d.ts +2 -2
  270. package/dist/queries/drift.js +1 -1
  271. package/dist/queries/duplicate-bodies.d.ts +2 -2
  272. package/dist/queries/duplicate-bodies.js +1 -1
  273. package/dist/queries/entry-map.d.ts +2 -2
  274. package/dist/queries/entry-map.js +1 -1
  275. package/dist/queries/evidence.d.ts +3 -3
  276. package/dist/queries/evidence.js +1 -1
  277. package/dist/queries/extract-candidates.d.ts +2 -2
  278. package/dist/queries/extract-candidates.js +1 -1
  279. package/dist/queries/fan.d.ts +2 -2
  280. package/dist/queries/fan.js +1 -1
  281. package/dist/queries/files.d.ts +2 -2
  282. package/dist/queries/files.js +1 -1
  283. package/dist/queries/health.d.ts +3 -3
  284. package/dist/queries/health.js +1 -1
  285. package/dist/queries/hierarchy.d.ts +2 -2
  286. package/dist/queries/hierarchy.js +1 -1
  287. package/dist/queries/hotspots.d.ts +2 -2
  288. package/dist/queries/hotspots.js +1 -1
  289. package/dist/queries/imports.d.ts +2 -2
  290. package/dist/queries/imports.js +1 -1
  291. package/dist/queries/incomplete-migration.d.ts +2 -2
  292. package/dist/queries/incomplete-migration.js +1 -1
  293. package/dist/queries/index.d.ts +5 -5
  294. package/dist/queries/index.js +1 -1
  295. package/dist/queries/isolated.d.ts +2 -2
  296. package/dist/queries/isolated.js +1 -1
  297. package/dist/queries/locality-candidates.d.ts +2 -2
  298. package/dist/queries/locality-candidates.js +1 -1
  299. package/dist/queries/members.d.ts +2 -2
  300. package/dist/queries/members.js +1 -1
  301. package/dist/queries/methods.d.ts +2 -2
  302. package/dist/queries/methods.js +1 -1
  303. package/dist/queries/not-implemented.d.ts +2 -2
  304. package/dist/queries/not-implemented.js +1 -1
  305. package/dist/queries/outline.d.ts +2 -2
  306. package/dist/queries/outline.js +1 -1
  307. package/dist/queries/passthrough-candidates.d.ts +2 -2
  308. package/dist/queries/passthrough-candidates.js +1 -1
  309. package/dist/queries/plan-context.d.ts +2 -2
  310. package/dist/queries/plan-context.js +1 -1
  311. package/dist/queries/react-component-duplicates.d.ts +2 -2
  312. package/dist/queries/react-component-duplicates.js +1 -1
  313. package/dist/queries/react-hook-candidates.d.ts +2 -2
  314. package/dist/queries/react-hook-candidates.js +1 -1
  315. package/dist/queries/react-large-component-pressure.d.ts +2 -2
  316. package/dist/queries/react-large-component-pressure.js +1 -1
  317. package/dist/queries/recent-duplicates.d.ts +2 -2
  318. package/dist/queries/recent-duplicates.js +1 -1
  319. package/dist/queries/redundant-reexports.d.ts +2 -2
  320. package/dist/queries/redundant-reexports.js +1 -1
  321. package/dist/queries/reference-neighborhood.d.ts +2 -2
  322. package/dist/queries/reference-neighborhood.js +1 -1
  323. package/dist/queries/reference-reachability.d.ts +2 -2
  324. package/dist/queries/reference-reachability.js +1 -1
  325. package/dist/queries/refs.d.ts +2 -2
  326. package/dist/queries/refs.js +1 -1
  327. package/dist/queries/self-audit.d.ts +2 -2
  328. package/dist/queries/self-audit.js +1 -1
  329. package/dist/queries/similar-chains.d.ts +2 -2
  330. package/dist/queries/similar-chains.js +1 -1
  331. package/dist/queries/similar-files.d.ts +2 -2
  332. package/dist/queries/similar-files.js +1 -1
  333. package/dist/queries/similar-signatures.d.ts +2 -2
  334. package/dist/queries/similar-signatures.js +1 -1
  335. package/dist/queries/similar.d.ts +2 -2
  336. package/dist/queries/similar.js +1 -1
  337. package/dist/queries/slice.d.ts +2 -2
  338. package/dist/queries/slice.js +1 -1
  339. package/dist/queries/source-inspection.d.ts +4 -4
  340. package/dist/queries/source-inspection.js +1 -1
  341. package/dist/queries/source-search.d.ts +2 -2
  342. package/dist/queries/source-search.js +1 -1
  343. package/dist/queries/stale-abstractions.d.ts +2 -2
  344. package/dist/queries/stale-abstractions.js +1 -1
  345. package/dist/queries/stats.d.ts +2 -2
  346. package/dist/queries/surface.d.ts +2 -2
  347. package/dist/queries/surface.js +1 -1
  348. package/dist/queries/symbols.d.ts +2 -2
  349. package/dist/queries/symbols.js +1 -1
  350. package/dist/queries/system-map.d.ts +2 -2
  351. package/dist/queries/system-map.js +1 -1
  352. package/dist/queries/system.d.ts +2 -2
  353. package/dist/queries/system.js +1 -1
  354. package/dist/queries/test-quality.d.ts +2 -2
  355. package/dist/queries/test-quality.js +1 -1
  356. package/dist/queries/trace.d.ts +2 -2
  357. package/dist/queries/trace.js +1 -1
  358. package/dist/queries/twin-ab.d.ts +2 -2
  359. package/dist/queries/twin-ab.js +1 -1
  360. package/dist/queries/twin-drift.d.ts +2 -2
  361. package/dist/queries/twin-drift.js +1 -1
  362. package/dist/queries/unused-imports.d.ts +2 -2
  363. package/dist/queries/unused-imports.js +1 -1
  364. package/dist/queries/unused-params.d.ts +2 -2
  365. package/dist/queries/unused-params.js +1 -1
  366. package/dist/queries/value-flow.d.ts +3 -3
  367. package/dist/queries/value-flow.js +1 -1
  368. package/dist/queries/vue-component-duplicates.d.ts +2 -2
  369. package/dist/queries/vue-component-duplicates.js +1 -1
  370. package/dist/queries/vue-composable-candidates.d.ts +2 -2
  371. package/dist/queries/vue-composable-candidates.js +1 -1
  372. package/dist/queries/vue-large-view-pressure.d.ts +2 -2
  373. package/dist/queries/vue-large-view-pressure.js +1 -1
  374. package/dist/queries/wrapper-candidates.d.ts +2 -2
  375. package/dist/queries/wrapper-candidates.js +1 -1
  376. package/dist/query-service-fastpath.js +5 -5
  377. package/dist/query-service-server.js +2 -2
  378. package/dist/refs-ARMA6XUJ.js +2 -0
  379. package/dist/refs-pagination-VUGIWN6U.js +2 -0
  380. package/dist/reindex-worker.js +125 -66
  381. package/dist/reindex.d.ts +5 -3
  382. package/dist/reindex.js +135 -76
  383. package/dist/runtime.d.ts +5 -5
  384. package/dist/runtime.js +4 -4
  385. package/dist/rust-semantic-session-server.js +1 -1
  386. package/dist/rust-semantic-session-worker.js +1 -1
  387. package/dist/rust-semantic-worker.js +1 -1
  388. package/dist/{scip-cli-CppzF5MK.d.ts → scip-cli-H-n59izO.d.ts} +1 -1
  389. package/dist/slice-YOB5YFAM.js +2 -0
  390. package/dist/surface-VY5EFWTW.js +2 -0
  391. package/dist/symbol-resolution-DGQN4XIV.js +2 -0
  392. package/dist/system-2KQ3QD2P.js +2 -0
  393. package/dist/trace-HTIPTXAE.js +2 -0
  394. package/dist/typescript-mailbox-worker.js +1 -1
  395. package/dist/value-flow-5FV3VQI7.js +2 -0
  396. package/dist/watch-server.js +3 -3
  397. package/docs/CLI_JSON_OUTPUT.md +2 -2
  398. package/docs/COMMAND_REFERENCE.md +2 -2
  399. package/docs/schemas/project-config.schema.json +11 -1
  400. package/package.json +6 -5
  401. package/skills/scip-explore/SKILL.md +73 -3
  402. package/skills/scip-explore/agents/openai.yaml +3 -3
  403. package/skills/scip-explore/references/delegated-exploration.md +51 -0
  404. package/skills/scip-explore/references/external-evidence.md +72 -0
  405. package/skills/scip-explore/references/information-model.md +51 -0
  406. package/skills/scip-explore/scripts/capture-evidence.mjs +666 -0
  407. package/skills/scip-query/SKILL.md +22 -1
  408. package/dist/by-kind-CI3O6PQG.js +0 -2
  409. package/dist/call-graph-6QTUTXH7.js +0 -2
  410. package/dist/chunk-2COFMIVK.js +0 -60
  411. package/dist/chunk-35ELD3RM.js +0 -2
  412. package/dist/chunk-3FQ3KMCD.js +0 -2
  413. package/dist/chunk-3VLJ2DCA.js +0 -2
  414. package/dist/chunk-4DCKBY6T.js +0 -5
  415. package/dist/chunk-4N6QSEMZ.js +0 -10
  416. package/dist/chunk-4OE2JO6I.js +0 -2
  417. package/dist/chunk-4UUCUASK.js +0 -554
  418. package/dist/chunk-54EOGFBR.js +0 -2
  419. package/dist/chunk-5IZTXSOL.js +0 -117
  420. package/dist/chunk-5ZJH6DDE.js +0 -2
  421. package/dist/chunk-63MBA7EG.js +0 -3
  422. package/dist/chunk-6T7H2AFY.js +0 -3
  423. package/dist/chunk-7COHFNJK.js +0 -38
  424. package/dist/chunk-7HU2IJ2T.js +0 -3
  425. package/dist/chunk-7PPYXENX.js +0 -2
  426. package/dist/chunk-AA7K3XLM.js +0 -21
  427. package/dist/chunk-AUP6YI5M.js +0 -2
  428. package/dist/chunk-CA5RE6H7.js +0 -2
  429. package/dist/chunk-CT5SI2I4.js +0 -2
  430. package/dist/chunk-D5EKVZPI.js +0 -2
  431. package/dist/chunk-DMQ7ZKJG.js +0 -81
  432. package/dist/chunk-ELNRLMC5.js +0 -29
  433. package/dist/chunk-F7WQ337U.js +0 -308
  434. package/dist/chunk-FEQIQ26E.js +0 -2
  435. package/dist/chunk-FN6EJM6Q.js +0 -2
  436. package/dist/chunk-FTSQNONX.js +0 -2
  437. package/dist/chunk-G2F6T5BV.js +0 -2
  438. package/dist/chunk-G6OGPXJW.js +0 -9
  439. package/dist/chunk-GFLTPNWV.js +0 -3
  440. package/dist/chunk-GTDP2SKQ.js +0 -2
  441. package/dist/chunk-HEOMG7IM.js +0 -8
  442. package/dist/chunk-I3U2FN2T.js +0 -13
  443. package/dist/chunk-IUJ3ZFEE.js +0 -7
  444. package/dist/chunk-LXLD46LH.js +0 -21
  445. package/dist/chunk-MEI3PTUK.js +0 -2
  446. package/dist/chunk-MO226P4Q.js +0 -4
  447. package/dist/chunk-MYUKI5VN.js +0 -4
  448. package/dist/chunk-OIRWZIYL.js +0 -38
  449. package/dist/chunk-OIVZ7PW6.js +0 -438
  450. package/dist/chunk-PNISDVYC.js +0 -3
  451. package/dist/chunk-PQOL42AW.js +0 -2
  452. package/dist/chunk-PUVZNFVY.js +0 -11
  453. package/dist/chunk-PZEI2TVL.js +0 -4
  454. package/dist/chunk-Q2J2VZZT.js +0 -2
  455. package/dist/chunk-QDCCHMVZ.js +0 -2
  456. package/dist/chunk-QLQBZOJH.js +0 -3
  457. package/dist/chunk-S73HBCGI.js +0 -11
  458. package/dist/chunk-SDPA5DKN.js +0 -210
  459. package/dist/chunk-SEUJVWT2.js +0 -3
  460. package/dist/chunk-SF7X6QNW.js +0 -2
  461. package/dist/chunk-SWFAFA4G.js +0 -49
  462. package/dist/chunk-T6FRID7Y.js +0 -3
  463. package/dist/chunk-TNOHGHZQ.js +0 -2
  464. package/dist/chunk-U2GPTA5U.js +0 -3
  465. package/dist/chunk-URTX2BEA.js +0 -6
  466. package/dist/chunk-VGRUM7JI.js +0 -3
  467. package/dist/chunk-VWLIOEEF.js +0 -11
  468. package/dist/chunk-WK4FD4PG.js +0 -2
  469. package/dist/chunk-X434XZAI.js +0 -2
  470. package/dist/chunk-YIEFEPG6.js +0 -16
  471. package/dist/chunk-YRVERHJR.js +0 -49
  472. package/dist/chunk-ZD3Z54IW.js +0 -2
  473. package/dist/chunk-ZDVDSDFG.js +0 -4
  474. package/dist/code-EQL6ZBLH.js +0 -2
  475. package/dist/code-result-json-6E4J6LGZ.js +0 -2
  476. package/dist/command-descriptors-QH3G2OVD.js +0 -346
  477. package/dist/dataflow-2BLMUZBP.js +0 -2
  478. package/dist/dependence-slice-MGAJDZXB.js +0 -2
  479. package/dist/deps-GQMUYVKW.js +0 -2
  480. package/dist/direct-navigation-6RUJKLAV.js +0 -3
  481. package/dist/entry-map-V2NQP5JU.js +0 -2
  482. package/dist/files-VM53I4IU.js +0 -2
  483. package/dist/hierarchy-D553WRSZ.js +0 -2
  484. package/dist/imports-DOZAJWLW.js +0 -2
  485. package/dist/members-HE67475K.js +0 -2
  486. package/dist/methods-K5JK4PPH.js +0 -2
  487. package/dist/output-continuation-command-LKBUTNRL.js +0 -3
  488. package/dist/project-reindex-4ARU6QCM.js +0 -3
  489. package/dist/refs-NBHKL4UQ.js +0 -2
  490. package/dist/refs-pagination-BBVTIHMH.js +0 -2
  491. package/dist/slice-U6S6LBSB.js +0 -2
  492. package/dist/surface-C7SS5CDQ.js +0 -2
  493. package/dist/symbol-resolution-3FVEKDTJ.js +0 -2
  494. package/dist/system-6K2NOO5C.js +0 -2
  495. package/dist/trace-II5K2TMH.js +0 -2
  496. package/dist/value-flow-MKFUUE5B.js +0 -2
@@ -1,21 +0,0 @@
1
- import{a as Pe}from"./chunk-3TNRNKAT.js";import{b as be,c as yt}from"./chunk-7KCZELVM.js";import{a as Ro}from"./chunk-Z3GCK3PD.js";import{a as Dt,b as _t,c as Io,d as gt,e as Sn,f as He,g as vn,h as xn}from"./chunk-PZEI2TVL.js";import{b as wo,c as No,d as Bt}from"./chunk-ZBNL3QCY.js";import{a as gn,b as vo,c as Eo,d as Lo,h as bn,i as Co}from"./chunk-SWFAFA4G.js";import{a as rt}from"./chunk-3EX7DNBC.js";import{b as At}from"./chunk-OUB4J26T.js";import{a as je,d as kt,e as xo,f as $t,n as hn}from"./chunk-2I3RSUWX.js";import{b as yn}from"./chunk-VGRUM7JI.js";import{u as yo,v as ho}from"./chunk-SF7X6QNW.js";import{D as ae,F as Pt,G as ue,H as Fe,J as fn,N as Ge,O as go,V as le,W as So,aa as it,p as Ft,r as Ce,y as mn}from"./chunk-SDPA5DKN.js";import{b as po,f as mo,g as fo}from"./chunk-VWLIOEEF.js";import{b as bo,c as pe,h as ve}from"./chunk-DRENNWRG.js";import{A as Xe,c as co,f as uo}from"./chunk-4DCKBY6T.js";import{createHash as Gc}from"crypto";var kr=[{id:"general-interprocedural-value-flow",families:["dataflow"],capability:"Whole-program definition-use flow through arbitrary calls and returns is unavailable.",consequence:"Missing dataflow edges cannot establish that a value never crosses an unmodeled call.",recoverWith:["value-flow","dependence-slice","inspect","code"]},{id:"heap-aliasing",families:["dataflow","state"],capability:"Heap points-to and cross-instance alias analysis are unavailable.",consequence:"Missing field or state edges cannot establish that two references never reach the same object.",recoverWith:["value-flow","dependence-slice","inspect","code"]},{id:"exceptional-flow",families:["execution","dataflow","temporal"],capability:"Interprocedural exception propagation and finally completion flow are unavailable.",consequence:"Normal-path reachability and ordering do not establish behavior after a throw or rejection.",recoverWith:["dependence-slice","inspect","code"]},{id:"reflection",families:["execution","runtime","identity","dependencies"],capability:"Reflective lookup, dynamic loading, and name-computed invocation are unavailable without exact evidence.",consequence:"Missing static edges cannot establish that a construct is unreachable through reflection.",recoverWith:["search","inspect","code"]},{id:"generated-dispatch",families:["execution","runtime","identity"],capability:"Dispatch tables or names created only by generated or unavailable source are unavailable.",consequence:"Missing dispatch edges cannot establish that no generated consumer exists.",recoverWith:["search","inspect","code"]},{id:"unsupported-framework-adapters",families:["runtime","dataflow","state","temporal"],capability:"Framework runtime crossings without a registered source adapter are unavailable.",consequence:"Missing boundary edges cannot establish that no producer, consumer, state effect, or ordering exists.",recoverWith:["search","inspect","code"]}];function $r(e){let t=new Set(e);return kr.filter(n=>n.families.some(o=>t.has(o)))}function Mo(e){return $r(e).map(t=>`[${t.id}] ${t.capability} ${t.consequence} Recover selected paths with: ${t.recoverWith.map(n=>`scip-query ${n}`).join(", ")}.`)}var Dr=["incoming","outgoing","both"];function te(e,t,n,o={}){return{family:e,subtype:t,...o.match?{match:o.match}:{},directions:Dr,evidenceStrengths:o.strengths??["exact","derived","mixed"],supportCeiling:o.supportCeiling??"partial",establishes:n,nonClaims:o.nonClaims??[],recoverWith:o.recoverWith??["inspect","code"]}}var _r=["predicate-consequence","predicate-alternative","predicate-fallthrough","predicate-case","predicate-default","predicate-return","predicate-throw","loop-iteration","loop-exit","exception-handler","finally-cleanup","handler-return","handler-throw"],Br=["captured-value-to-state","constant-to-state","expression-to-state","property-to-state","return-to-state","value-to-state"],Or=["await-completion-before","awaits-completion","inside-lock-scope","lexical-successor"],Gr=[{id:"indexed-program-identity",label:"SCIP/compiler identity and source ownership",requirements:["indexed-graph"],relations:[te("execution","call","The source construct may call the resolved target.",{strengths:["exact","derived","candidate","mixed"],nonClaims:["Static may-call reachability does not prove that an invocation occurred at runtime."],recoverWith:["call-graph","inspect","code"]}),te("execution","result-callback","The referenced callable can produce the result consumed by this path.",{nonClaims:["A callback relationship does not prove invocation order or runtime selection."],recoverWith:["call-graph","inspect","code"]}),te("contract","uses-contract-symbol","The source construct refers to the identified contract symbol.",{supportCeiling:"exact",nonClaims:["Contract identity does not prove runtime invocation or behavioral conformance."],recoverWith:["hierarchy","inspect","code"]}),te("identity","references","The occurrence resolves to the identified compiler-owned symbol.",{supportCeiling:"exact",nonClaims:["A reference does not establish execution or value transfer."],recoverWith:["refs","trace","inspect"]}),te("ownership","contains","The owner contains the identified program construct.",{supportCeiling:"exact",nonClaims:["Structural containment does not establish runtime lifetime or sharing scope."],recoverWith:["outline","inspect"]}),te("ownership","contains-","The owner contains the identified program construct.",{match:"prefix",supportCeiling:"exact",nonClaims:["Structural containment does not establish runtime lifetime or sharing scope."],recoverWith:["outline","inspect"]}),te("ownership","owns-","The owner owns the identified source or runtime observation.",{match:"prefix",supportCeiling:"exact",nonClaims:["Observation ownership does not establish singleton lifetime or exclusive ownership."],recoverWith:["inspect","code"]}),te("dependencies","imports","The source file or module statically imports the indexed target.",{nonClaims:["An import does not establish that imported code executes."],recoverWith:["imports","deps","code"]}),te("dependencies","imports-external","The source region statically imports an external package.",{nonClaims:["An external import does not establish which package behavior executes."],recoverWith:["imports","code"]})]},{id:"runtime-boundary-join",label:"source-grounded runtime-boundary joins",requirements:["indexed-graph","source-facts"],relations:[te("runtime","runtime-handoff","A producer and consumer share a source-grounded runtime rendezvous.",{strengths:["exact","derived","candidate","mixed"],nonClaims:["A candidate or unresolved join does not prove a runtime handoff."],recoverWith:["evidence","inspect","code"]}),te("runtime","discriminator-dispatch","A serialized discriminator selects the reported consumer.",{strengths:["exact","derived","mixed"],nonClaims:["The dispatch edge does not prove delivery, retry, or successful handling."],recoverWith:["evidence","inspect","code"]}),te("dataflow","serialized-discriminator-transfer","The producer serializes the discriminator consumed by dispatch.",{strengths:["exact","derived","mixed"],nonClaims:["This edge does not establish the flow of every payload field."],recoverWith:["value-flow","inspect","code"]}),te("temporal","enqueue-before-consume","The reported enqueue precedes a possible consume through the queue.",{strengths:["exact","derived","mixed"],nonClaims:["Queue order does not establish delivery time, uniqueness, retry count, or durability."],recoverWith:["evidence","inspect","code"]})]},{id:"parser-control-dependence",label:"parser-proved intraprocedural control dependence",requirements:["indexed-graph","source-facts"],relations:[..._r.map(e=>te("execution",e,"The outcome is control-dependent on the reported predicate or handler.",{strengths:["exact"],nonClaims:["Local control dependence does not establish that the containing function executes."],recoverWith:["dependence-slice","inspect","code"]})),te("execution","returns","The selected construct contains the reported return terminal.",{strengths:["exact"],nonClaims:["A local return terminal does not establish that the containing callable executes."],recoverWith:["inspect","code"]}),te("execution","throws","The selected construct contains the reported throw terminal.",{strengths:["exact"],nonClaims:["A local throw terminal does not establish propagation, handling, or callable execution."],recoverWith:["inspect","code"]})]},{id:"bounded-static-value-flow",label:"compiler callsites and bounded static value evaluation",requirements:["indexed-graph","source-facts"],relations:["argument-to-parameter","constant-to-parameter","property-to-parameter","return-to-parameter","return-to-call-result"].map(e=>te("dataflow",e,"The reported value may reach the target through the evidenced callsite transfer.",{strengths:["exact","derived","mixed"],nonClaims:["This provider does not establish general local definition-use, alias, field, or heap flow."],recoverWith:["value-flow","dependence-slice","inspect","code"]}))},{id:"typescript-local-dependence",label:"TypeScript compiler identities, control-flow graph, and reaching definitions",requirements:["typescript-semantic"],relations:[te("dataflow","definition-to-use","The definition reaches the reported read on a feasible local control-flow path.",{strengths:["exact"],nonClaims:["Local reaching definitions do not establish heap aliasing, exceptional flow, or the runtime order of closure invocation."],recoverWith:["value-flow","dependence-slice","inspect","code"]}),te("dataflow","value-to-definition","The reported right-hand-side read supplies the assigned local definition.",{strengths:["exact"],nonClaims:["A local assignment edge does not establish field or heap points-to flow."],recoverWith:["value-flow","dependence-slice","inspect","code"]}),te("dataflow","closure-capture","The nested callable reads the reported binding from an enclosing callable.",{strengths:["candidate"],supportCeiling:"candidate",nonClaims:["Closure capture does not establish whether or when the nested callable executes."],recoverWith:["call-graph","inspect","code"]}),te("dataflow","field-definition-to-use","The reported same-owner field definition can reach the field read.",{strengths:["exact","candidate"],nonClaims:["Field-name identity does not establish whole-program heap aliasing or cross-instance flow."],recoverWith:["value-flow","dependence-slice","inspect","code"]}),te("execution","control-dependence","Execution of the reported statement depends on the outcome of the predicate.",{strengths:["exact"],nonClaims:["Intraprocedural control dependence does not establish that the containing callable executes."],recoverWith:["dependence-slice","inspect","code"]})]},{id:"parser-state-temporal",label:"parser-proved local state and temporal facts",requirements:["indexed-graph","source-facts"],relations:[...Br.map(e=>te("dataflow",e,"The reported source value is assigned into the identified state resource.",{strengths:["exact"],nonClaims:["The edge does not establish alias, heap, or later read flow."],recoverWith:["value-flow","inspect","code"]})),...["writes-resource","deletes-resource","reads-resource","enqueues-resource","consumes-resource"].map(e=>te("state",e,"The reported construct performs the named operation on the identified resource.",{strengths:["exact"],nonClaims:["A state operation does not establish transactionality, durability, or exclusive ownership."],recoverWith:["evidence","inspect","code"]})),...Or.map(e=>te("temporal",e,"The reported source constructs have the named local ordering relationship.",{strengths:["exact"],nonClaims:["Local source order does not establish cross-process happens-before or durable completion."],recoverWith:["evidence","inspect","code"]}))]}];function To(e,t){let n=Gr.flatMap(o=>o.relations.filter(r=>r.family===e&&(r.match==="prefix"?t.startsWith(r.subtype):t===r.subtype)).map(r=>({provider:o,relation:r})));if(n.length>1)throw new Error(`Ambiguous graph relation provider for ${e}/${t}: ${n.map(o=>o.provider.id).join(", ")}`);return n[0]??null}var Ke=["execution","runtime","dataflow","state","temporal","contract","identity","ownership","dependencies"];function at(e){return e.includes("symbol-anchor")?0:e.includes("literal-owner")?1:e.some(t=>t.startsWith("boundary-import:"))?2:e.includes("reference-owner")?3:4}function Fo(e,t){return at(e.origins)-at(t.origins)||e.depth-t.depth||e.startLine-t.startLine||e.shortName.localeCompare(t.shortName)}var Po=new WeakMap,Ao=new WeakMap,ko=new WeakMap,$o=new WeakMap,Do=new WeakMap;function _o(e,t){let n=Ao.get(e);n||(n=new Map,Ao.set(e,n));let o=n.get(t);if(o)return o;let r=ae(e,t)?.rootNode;if(!r)return n.set(t,[]),[];let a=new Set;_e(r,d=>{if(d.type!=="call_expression")return;let c=d.childForFieldName("function")??d.namedChild(0),u=/^([A-Za-z_$][\w$]*(?:\.Service)?)\.of$/u.exec(c?.text.replace(/\s+/gu,"")??"");u&&a.add(u[1])});let i=Ge(e,t).filter(d=>!!d.sourcePath),s=new Set;for(let d of a){let c=/^([A-Za-z_$][\w$]*)\.Service$/u.exec(d);if(c){for(let u of i)u.localName===c[1]&&s.add(u.sourcePath);continue}if(d==="Service"){le(e,t).some(u=>u.leaf==="Service")&&s.add(t);for(let u of i)(u.localName??u.importedName)==="Service"&&s.add(u.sourcePath)}}let l=In([...s]).sort();return n.set(t,l),l}function En(e,t,n={}){let r=fn(e,t)?.filter(p=>!n.ranges||n.ranges.some(m=>p.line>=m.startLine&&p.line<=m.endLine));if(!r)return{targets:[],unresolvedCallsites:0};let a=Ge(e,t).filter(p=>!!p.sourcePath),i=oa(Ft(e,t)??""),s=ae(e,t)?.rootNode??null,l=s?Kr(s):Bo(),d=new Map,c=$t(e),u=[],f=0;for(let p of r){if(!p.memberAccess)continue;let m=kt(t,c.get(p.calleeLeaf)??[]);if(n.excludeIndexedTargets!==!1&&xo(e,t,m,!0,p.calleeQualifier))continue;let h=p.calleeQualifier,y=ta(e,t,p,a);if(y){u.push(y);continue}let L=jr(e,t,p,a,qr(l,p.calleeQualifier,p.line));if(L.length>0){u.push(...L);continue}let x=zr(e,t,p);if(x.length>0){u.push(...x);continue}let S=h?i.get(h)??h:null,F=(S?In(a.filter(I=>(I.localName??I.importedName)===S).map(I=>I.sourcePath)):[]).flatMap(I=>{let E=d.get(I);return E||(E=Fe(e,I)??[],d.set(I,E)),E.filter(N=>N.name===p.calleeLeaf).map(N=>({file:I,callable:N}))});if(F.length!==1){f+=1;continue}let P=F[0];u.push({calleeLeaf:p.calleeLeaf,line:p.line,sourceFile:t,targetFile:P.file,targetStartLine:P.callable.startLine,targetEndLine:P.callable.endLine,resolution:"direct-import-receiver",strength:"candidate"})}return{targets:u,unresolvedCallsites:f}}function jr(e,t,n,o,r){let a=n.calleeQualifier;if(!a||!/^[A-Za-z_$][\w$]*$/u.test(a))return[];if(r.size!==1)return[];let i=[...r][0],s=In(o.filter(c=>c.localName===i||c.importedName===i).map(c=>c.sourcePath));if(s.length!==1)return[];let l=s[0],d=Vr(e,l,n.calleeLeaf);return d.map(c=>({calleeLeaf:c.name,line:n.line,sourceFile:t,targetFile:c.file,targetStartLine:c.startLine,targetEndLine:c.endLine,serviceFile:l,resolutionAlternativeCount:d.length,resolution:"imported-service-object-member",strength:"candidate"}))}function Bo(){return{declarations:new Map,callbacks:[]}}function Kr(e){let t=Bo();return _e(e,n=>{if(n.type==="variable_declarator"){let l=n.childForFieldName("name")??n.namedChild(0),d=n.childForFieldName("value")??n.namedChild(1);if(l?.type!=="identifier"||!d)return;let c=new Set;if(_e(d,u=>{if(u.type!=="member_expression")return;let f=u.childForFieldName("object")??u.namedChild(0),p=u.childForFieldName("property")??u.namedChild(1);f?.type==="identifier"&&p?.text==="Service"&&c.add(f.text)}),c.size===1){let u=t.declarations.get(l.text)??[];u.push({line:n.startPosition.row,alias:[...c][0]}),t.declarations.set(l.text,u)}return}if(!["arrow_function","function_expression","generator_function"].includes(n.type))return;let o=n.childForFieldName("parameters")??n.childForFieldName("parameter");if(!o)return;let r=n.parent;for(;r&&r.type!=="call_expression";)r=r.parent;if(!r)return;let a=r.childForFieldName("function")??r.namedChild(0),i=/^([A-Za-z_$][\w$]*)\.Service\.use$/u.exec(a?.text??"");if(!i)return;let s=new Set;_e(o,l=>{l.type==="identifier"&&s.add(l.text)}),s.size!==0&&t.callbacks.push({startLine:n.startPosition.row,endLine:n.endPosition.row,receivers:s,alias:i[1]})}),t}function qr(e,t,n){if(!t||!/^[A-Za-z_$][\w$]*$/u.test(t))return new Set;let o=new Set((e.declarations.get(t)??[]).filter(r=>r.line<=n).map(r=>r.alias));for(let r of e.callbacks)r.startLine<=n&&r.endLine>=n&&r.receivers.has(t)&&o.add(r.alias);return o}function zr(e,t,n){let o=n.calleeQualifier;if(!o||!/^[A-Za-z_$][\w$]*$/u.test(o))return[];let r=ae(e,t)?.rootNode;if(!r)return[];let a=Ur(e,t,r,n.line,n.calleeLeaf,o),i=a?Hr(a,o):null;if(!i)return[];if(!Wr(i))return[];let s=(Fe(e,t)??[]).filter(p=>p.startLine<=i.startPosition.row&&p.endLine>=i.endPosition.row).sort((p,m)=>p.endLine-p.startLine-(m.endLine-m.startLine))[0];if(!s)return[];let l=le(e,t).filter(p=>p.isFunctionLike&&p.leaf===s.name);if(l.length!==1)return[];let d=l[0],c=$o.get(e);c||(c=new Map,$o.set(e,c));let u=`${d.symbol}\0${n.calleeLeaf}`,f=c.get(u);if(!f){let p=[];for(let m of hn(e,d)){let h=ae(e,m.file)?.rootNode;if(!h)continue;let y=h.descendantsOfType("call_expression").filter(S=>S.startPosition.row>m.line||S.endPosition.row<m.line?!1:(S.childForFieldName("function")??S.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<[^<>]*>$/u,"").match(/[A-Za-z_$][\w$]*$/u)?.[0]===d.leaf);if(y.length!==1)continue;let x=y[0].childForFieldName("arguments")?.namedChildren.find(S=>Ze(S).type==="object");if(x)for(let S of Ze(x).namedChildren){if(S.type==="shorthand_property_identifier"&&S.text===n.calleeLeaf){p.push(...Ot(e,m.file,n.calleeLeaf,S,S));continue}if(S.type!=="pair")continue;let T=S.childForFieldName("key")??S.namedChild(0),F=S.childForFieldName("value")??S.namedChild(1);Gt(T?.text)!==n.calleeLeaf||!F||p.push(...Ot(e,m.file,n.calleeLeaf,F,S))}}f=p.filter((m,h,y)=>y.findIndex(L=>L.file===m.file&&L.startLine===m.startLine&&L.endLine===m.endLine&&L.name===m.name)===h),c.set(u,f)}return f.map(p=>({calleeLeaf:p.name,line:n.line,sourceFile:t,targetFile:p.file,targetStartLine:p.startLine,targetEndLine:p.endLine,resolutionAlternativeCount:f.length,resolution:"factory-callback-member",strength:f.length===1?"exact":"candidate"}))}function Ur(e,t,n,o,r,a){let i=ko.get(e);i||(i=new Map,ko.set(e,i));let s=i.get(t);if(!s){s=new Map;for(let l of n.descendantsOfType("call_expression")){let d=l.childForFieldName("function")??l.namedChild(0),c=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(d?.text.replace(/\s+/gu,"")??"");if(c)for(let u=l.startPosition.row;u<=l.endPosition.row;u+=1){let f=`${u}\0${c[1]}\0${c[2]}`,p=s.get(f);(!p||l.endIndex-l.startIndex<p.endIndex-p.startIndex)&&s.set(f,l)}}i.set(t,s)}return s.get(`${o}\0${a}\0${r}`)??null}function Wr(e){return e.descendantsOfType("return_statement").some(t=>{let n=t.childForFieldName("argument")??t.namedChild(0);return!!(n&&Ze(n).type==="object")})}function Hr(e,t){let n=e.parent;for(;n;){if(/(?:function|method|lambda)/u.test(n.type)||n.type==="arrow_function"){let o=n.childForFieldName("parameters")??n.childForFieldName("parameter"),r=!1;if(o&&_e(o,a=>{a.type==="identifier"&&a.text===t&&(r=!0)}),r)return n}n=n.parent}return null}function Ot(e,t,n,o,r){if(o.type==="identifier")return(Fe(e,t)??[]).filter(l=>l.name===o.text).map(l=>({...l,file:t}));let a=Ln(e,t,o.text);if(a.length>0)return a;if(!Cn(o))return[];let s=(Fe(e,t)??[]).filter(l=>l.startLine>=r.startPosition.row&&l.endLine<=r.endPosition.row&&(l.name===n||l.name.startsWith("source@"))).sort((l,d)=>l.endLine-l.startLine-(d.endLine-d.startLine))[0];return[s?{...s,file:t}:{name:n,file:t,startLine:r.startPosition.row,endLine:r.endPosition.row}]}function Vr(e,t,n){let o=Do.get(e);o||(o=new Map,Do.set(e,o));let r=`${t}\0${n}`,a=o.get(r);if(a)return a;let i=Xr(e,t).flatMap(s=>Yr(e,s,t,n));return o.set(r,i),i}function Yr(e,t,n,o){let r=ae(e,t)?.rootNode,a=Fe(e,t)??[];if(!r)return[];let i=Zr(e,t,n);if(i.size===0)return[];let s=new Set,l=[],d=[],c=[];return _e(r,f=>{if(Qr(f,i)){if(f.type==="pair"){let p=f.childForFieldName("key")??f.namedChild(0),m=f.childForFieldName("value")??f.namedChild(1);if(Gt(p?.text)!==o||!m)return;if(m.type==="identifier")s.add(m.text);else if(Cn(m))l.push({name:o,startLine:f.startPosition.row,endLine:f.endPosition.row});else{let h=Jr(e,t,m.text),y=Ln(e,t,m.text);if(h.length>0)c.push(...h);else if(y.length>0)c.push(...y);else{let L=ea(f);L&&d.push(L)}}return}f.type==="shorthand_property_identifier"&&f.text===o&&s.add(o)}}),[...a.filter(f=>s.has(f.name)).map(f=>({...f,file:t})),...l.map(f=>({...f,file:t})),...d.map(f=>({...f,file:t})),...c].filter((f,p,m)=>m.findIndex(h=>h.file===f.file&&h.name===f.name&&h.startLine===f.startLine&&h.endLine===f.endLine)===p)}function Qr(e,t){let n=e,o=null;for(;n;){if(n.type==="object"&&(o=n),n.type==="call_expression"){if(!o)return!1;let r=n.childForFieldName("function")??n.namedChild(0);return r?t.has(r.text.replace(/\.of$/u,""))&&r.text.endsWith(".of"):!1}n=n.parent}return!1}function Xr(e,t){let n=Po.get(e);n||(n=new Map,Po.set(e,n));let o=n.get(t);if(o)return o;let r=new Set([t]),a=le(e,t).filter(s=>s.leaf==="Service"&&s.isTypeLike);for(let s of a)for(let l of hn(e,s))r.add(l.file);let i=[...r].sort();return n.set(t,i),i}function Zr(e,t,n){let o=new Set;Xe(t,n)&&o.add("Service");for(let r of Ge(e,t)){if(!r.sourcePath||!Xe(r.sourcePath,n))continue;if(r.kind==="namespace"&&r.localName){o.add(`${r.localName}.Service`);continue}(r.importedName==="default"?r.localName:r.importedName)==="Service"?o.add(r.localName??r.importedName):r.localName&&r.importedName!=="default"&&o.add(`${r.localName}.Service`)}return o}function Ln(e,t,n){let o=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n.replace(/\s+/gu,""));if(!o)return[];let r=ae(e,t)?.rootNode;if(!r)return[];let a=Oo(r,o[1]),i=a?Go(a):null;if(!i)return[];let s=i.childForFieldName("function")??i.namedChild(0),l=s?jo(e,t,s.text):[];if(l.length!==1)return[];let d=l[0],c=ae(e,d.relativePath)?.rootNode;if(!c)return[];let u=mn(c,d.startLine,d.endLine);if(!u)return[];let f=[];for(let p of u.descendantsOfType("return_statement")){let m=p.childForFieldName("argument")??p.namedChild(0);if(!m)continue;let h=Ze(m);if(h.type==="object")for(let y of h.namedChildren){if(y.type==="shorthand_property_identifier"&&y.text===o[2]){for(let S of Fe(e,d.relativePath)??[])S.name===o[2]&&f.push({...S,file:d.relativePath});continue}if(y.type!=="pair")continue;let L=y.childForFieldName("key")??y.namedChild(0),x=y.childForFieldName("value")??y.namedChild(1);if(!(Gt(L?.text)!==o[2]||!x))if(x.type==="identifier")for(let S of Fe(e,d.relativePath)??[])S.name===x.text&&f.push({...S,file:d.relativePath});else Cn(x)&&f.push({name:o[2],startLine:y.startPosition.row,endLine:y.endPosition.row,file:d.relativePath})}}return f.filter((p,m,h)=>h.findIndex(y=>y.file===p.file&&y.name===p.name&&y.startLine===p.startLine&&y.endLine===p.endLine)===m)}function Jr(e,t,n){let o=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n.replace(/\s+/gu,""));if(!o)return[];let r=ae(e,t)?.rootNode;if(!r)return[];let a=Oo(r,o[1]),i=a?Go(a):null,s=i?.childForFieldName("function")??i?.namedChild(0),l=s?jo(e,t,s.text):[];if(l.length!==1||!i)return[];let d=l[0],c=ae(e,d.relativePath)?.rootNode;if(!c)return[];let u=mn(c,d.startLine,d.endLine);if(!u)return[];let f=new Set,p=u.childForFieldName("parameters")??u.childForFieldName("parameter");if(p&&_e(p,I=>{I.type==="identifier"&&f.add(I.text)}),f.size===0)return[];let m=Ln(e,t,n);if(m.length===0)return[];let h=(Fe(e,d.relativePath)??[]).filter(I=>I.startLine>=d.startLine&&I.endLine<=d.endLine),y=(fn(e,d.relativePath)??[]).filter(I=>I.line>=d.startLine&&I.line<=d.endLine),L=new Set,x=m.map(I=>({name:I.name,startLine:I.startLine,endLine:I.endLine})),S=new Set;for(;x.length>0&&S.size<32;){let I=x.shift(),E=`${I.name}\0${I.startLine}\0${I.endLine}`;if(!S.has(E)){S.add(E);for(let N of y.filter(b=>b.line>=I.startLine&&b.line<=I.endLine)){if(N.memberAccess&&N.calleeQualifier&&f.has(N.calleeQualifier)){L.add(N.calleeLeaf);continue}if(N.memberAccess)continue;let b=h.filter($=>$.name===N.calleeLeaf);b.length===1&&x.push(b[0])}}}if(L.size===0)return[];let F=i.childForFieldName("arguments")?.namedChildren.find(I=>Ze(I).type==="object");if(!F)return[];let P=[];for(let I of Ze(F).namedChildren){if(I.type==="shorthand_property_identifier"&&L.has(I.text)){P.push(...Ot(e,t,I.text,I,I));continue}if(I.type!=="pair")continue;let E=I.childForFieldName("key")??I.namedChild(0),N=I.childForFieldName("value")??I.namedChild(1),b=Gt(E?.text);!b||!L.has(b)||!N||P.push(...Ot(e,t,b,N,I))}return P.filter((I,E,N)=>N.findIndex(b=>b.file===I.file&&b.name===I.name&&b.startLine===I.startLine&&b.endLine===I.endLine)===E)}function Oo(e,t){for(let n of e.descendantsOfType("variable_declarator"))if((n.childForFieldName("name")??n.namedChild(0))?.text===t)return n.childForFieldName("value")??n.namedChild(1);return null}function Go(e){return e.type==="call_expression"?e:e.descendantsOfType("call_expression")[0]??null}function jo(e,t,n){let o=n.replace(/\s+/gu,"").replace(/<[^<>]*>$/u,""),r=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(o);if(r){let u=Ge(e,t).filter(m=>m.localName===r[1]&&m.sourcePath);if(u.length!==1||!u[0].sourcePath)return[];let f=u[0].sourcePath,p=rt(e,f,r[2]).filter(m=>m.isFunctionLike);return p.length>0?p:(Fe(e,f)??[]).filter(m=>m.name===r[2]).map(m=>({...m,relativePath:f}))}if(!/^[A-Za-z_$][\w$]*$/u.test(o))return[];let a=le(e,t).filter(u=>u.leaf===o&&u.isFunctionLike);if(a.length>0)return a;let i=(Fe(e,t)??[]).filter(u=>u.name===o).map(u=>({...u,relativePath:t}));if(i.length>0)return i;let s=Ge(e,t).filter(u=>u.localName===o&&u.sourcePath&&u.kind!=="namespace");if(s.length!==1||!s[0].sourcePath)return[];let l=s[0].sourcePath,d=s[0].importedName==="default"?o:s[0].importedName,c=rt(e,l,d).filter(u=>u.isFunctionLike);return c.length>0?c:(Fe(e,l)??[]).filter(u=>u.name===d).map(u=>({...u,relativePath:l}))}function Cn(e){return["arrow_function","function_expression","generator_function"].includes(e.type)||e.descendantsOfType(["arrow_function","function_expression","generator_function"]).length>0}function ea(e){let t=e.parent;for(;t;){if(t.type==="variable_declarator"){let n=t.childForFieldName("name")??t.namedChild(0);if(n?.type==="identifier")return{name:n.text,startLine:t.startPosition.row,endLine:t.endPosition.row}}t=t.parent}return null}function Gt(e){return e?e.replace(/^(?:['"])(.*)(?:['"])$/u,"$1"):null}function ta(e,t,n,o){let r=/^this\.([A-Za-z_$][\w$]*)$/u.exec(n.calleeQualifier??"");if(!r)return null;let a=ae(e,t)?.rootNode;if(!a)return null;let i=na(a,n.line);if(!i)return null;let s=new Set;if(_e(i,h=>{if(h.type!=="assignment_expression")return;let y=h.childForFieldName("left")??h.namedChild(0),L=h.childForFieldName("right")??h.namedChild(h.namedChildCount-1);if(y?.text.replace(/\s+/gu,"")!==`this.${r[1]}`||!L)return;let x=Ze(L);if(x.type!=="new_expression")return;let T=(x.childForFieldName("constructor")??x.namedChild(0))?.text.match(/[A-Za-z_$][\w$]*$/u)?.[0];T&&s.add(T)}),s.size!==1)return null;let l=[...s][0],d=o.filter(h=>h.localName===l);if(d.length!==1)return null;let c=d[0].importedName==="default"?l:d[0].importedName,u=d[0].importedName==="default"?rt(e,d[0].sourcePath,l):[],f=u.length===1?u[0].leaf:c,p=le(e,d[0].sourcePath).filter(h=>h.isFunctionLike&&h.leaf===n.calleeLeaf&&bo(h.symbol)===f);if(p.length!==1)return null;let m=p[0];return{calleeLeaf:n.calleeLeaf,line:n.line,sourceFile:t,targetFile:m.relativePath,targetStartLine:m.startLine,targetEndLine:m.endLine,targetSymbol:m.symbol,resolution:"constructed-member-receiver",strength:"exact"}}function na(e,t){let n=[];return _e(e,o=>{["class","class_declaration","class_definition"].includes(o.type)&&o.startPosition.row<=t&&o.endPosition.row>=t&&n.push(o)}),n.sort((o,r)=>o.endPosition.row-o.startPosition.row-(r.endPosition.row-r.startPosition.row))[0]??null}function Ze(e){let t=e;for(;["parenthesized_expression","as_expression","type_assertion","satisfies_expression"].includes(t.type)&&t.namedChildCount===1;)t=t.namedChild(0);return t}function _e(e,t){t(e);for(let n of e.namedChildren)_e(n,t)}function oa(e){let t=new Map,n=/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*([A-Za-z_$][\w$]*)\s*;/gu;for(let o of e.matchAll(n)){let r=o[1],a=o[2];r&&a&&t.set(r,a)}return t}function In(e){let t=[];for(let n of e)t.some(o=>Xe(o,n))||t.push(n);return t}import{existsSync as ra}from"fs";import{SymbolRole as aa}from"@c4312/scip";import{deserializeSCIP as ia}from"@c4312/scip";function Ko(e,t){return ia(uo(e,{inputKind:t,maxBytes:co}))}var wn=new WeakMap;function jt(e,t,n,o){let r=ue(e,t),a=(r?.callSites??[]).filter(p=>p.line>=n&&p.line<=o);if(!r||a.length===0)return{available:!!r,targets:[],resolvedCallsites:0,unresolvedCallsites:0};let i=Rn(e);if(!i)return{available:!1,targets:[],resolvedCallsites:0,unresolvedCallsites:a.length};let s=(i.byFile.get(t)??[]).filter(p=>p.sourceLine>=n&&p.sourceLine<=o).map(p=>({...p,calleeLeaf:p.definition.leaf})),l=qo(a.map(p=>({line:p.line,leaf:p.calleeLeaf}))),d=qo(s.map(p=>({line:p.sourceLine,leaf:p.calleeLeaf}))),c=new Set([...l].flatMap(([p,m])=>d.get(p)===m?[p]:[])),u=s.filter(p=>c.has(Uo(p.sourceLine,p.calleeLeaf))),f=[...c].reduce((p,m)=>p+(l.get(m)??0),0);return{available:!0,targets:u,resolvedCallsites:f,unresolvedCallsites:Math.max(0,a.length-f)}}function Nn(e,t,n,o){let r=Rn(e);return r?{available:!0,targets:(r.byFile.get(t)??[]).filter(a=>a.sourceLine>=n&&a.sourceLine<=o)}:{available:!1,targets:[]}}function zo(e,t,n,o){let r=Rn(e);return r?{available:!0,targets:(r.byFile.get(t)??[]).filter(a=>a.sourceLine>=n&&a.sourceLine<=o&&Kt(e,a.definition)).map(a=>({...a,calleeLeaf:a.definition.leaf}))}:{available:!1,targets:[]}}function Rn(e){if(wn.has(e))return wn.get(e)??null;let t=sa(e);return wn.set(e,t),t}function sa(e){if(!e.generation.indexPath||!ra(e.generation.indexPath))return null;try{let t=So(e),n=new Map(t.map(a=>[a.symbol,a])),o=Ko(e.generation.indexPath,"SCIP source-range call-target index"),r=new Map;for(let a of o.documents??[]){let i=a.relativePath;if(!i||e.isIgnored(i))continue;let s=[];for(let l of a.occurrences??[]){if(!l.symbol||(l.symbolRoles&aa.Definition)!==0)continue;let d=n.get(l.symbol),c=l.range?.[0];!d||!Number.isInteger(c)||s.push({sourceLine:c,definition:d})}r.set(i,s)}return{byFile:r}}catch{return null}}function Kt(e,t){if(!t.isFunctionLike)return!1;let n=ue(e,t.relativePath);return!n||n.callables.some(o=>o.name===t.leaf&&o.startLine===t.startLine&&o.endLine===t.endLine)?!0:la(t)}function la(e){let t=e.documentation;if(!t)return!1;let n=e.leaf.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`\\bfunction\\s+${n}\\s*(?:<[^>]*>)?\\s*\\(`,"u").test(t)||new RegExp(`\\b(?:const|let|var)\\s+${n}\\s*:\\s*(?:<[^>]*>\\s*)?\\([^\\n]*\\)\\s*=>`,"u").test(t)}function qo(e){let t=new Map;for(let n of e){let o=Uo(n.line,n.leaf);t.set(o,(t.get(o)??0)+1)}return t}function Uo(e,t){return`${e}\0${t}`}var ca=16,da=4,ua=3e3,pa=800,ma=new Set(["assignment","const_declaration","const_item","field_declaration","lexical_declaration","local_declaration_statement","local_variable_declaration","static_item","variable_declaration"]);function Xo(e,t,n={}){let o=n.maxSteps??ca;if(!Number.isSafeInteger(o)||o<=0)throw new RangeError(`maxSteps must be a positive safe integer; received ${o}`);let r=new Map(t.nodes.map(v=>[v.id,v])),a=va(n.focusLocations??[]),i=new Set,s=new Map(t.edges.map(v=>[v.id,v])),l=qe(t.paths.flatMap(v=>v.nodeIds)),d=qe(t.anchors.filter(v=>v.status==="matched").flatMap(v=>v.nodeIds)),c=t.nodes.filter(v=>v.disposition==="emitted"&&v.attributes.upstreamCausalPath===!0).sort((v,V)=>Number(V.attributes.upstreamCausalDistance??0)-Number(v.attributes.upstreamCausalDistance??0)||v.id.localeCompare(V.id)).map(v=>v.id),u=new Set(c),f=Math.max(0,o-d.length),m=fa(t,d,a,f).slice(0,f),h=new Set(m),y=new Set(m),L=new Set([...l,...c,...d]),x=t.edges.filter(v=>v.disposition==="emitted"&&v.kind!=="structural-membership"),S=t.edges.filter(v=>v.disposition!=="excluded"&&v.disposition!=="unsupported"&&v.kind!=="structural-membership"),T=new Set([...t.paths.flatMap(v=>v.edgeIds),...x.filter(v=>u.has(v.fromNodeId)&&u.has(v.toNodeId)).map(v=>v.id)]),F=t.paths.some(v=>v.edgeIds.length>0),P=new Set(d);for(let v of m)P.add(v);for(let v of t.paths){let V=v.nodeIds[0],W=s.get(v.edgeIds[0]??""),ge=v.nodeIds[1];V&&ge&&W?.fromNodeId===V&&W.toNodeId===ge&&P.add(V)}if(t.paths.every(v=>v.nodeIds.length===0))for(let v of t.anchors)for(let V of v.nodeIds)P.add(V);let I=Ia(d,S,r,da),E=qe(x.filter(v=>v.kind==="call"&&d.includes(v.fromNodeId)).map(v=>v.toNodeId)),N=new Set(qe([...I,...F?[]:E]));for(let v of N)P.add(v);let b=qe(x.flatMap(v=>L.has(v.fromNodeId)||L.has(v.toNodeId)?[v.fromNodeId,v.toNodeId]:[])),$=t.nodes.filter(v=>v.disposition==="emitted"&&v.kind!=="structural-region"&&x.some(V=>V.fromNodeId===v.id||V.toNodeId===v.id)).map(v=>v.id),z=qe([...c,...l,...d,...m,...N,...b,...$]).filter(v=>r.has(v)),q=[];for(let v of z)F&&!L.has(v)&&!h.has(v)&&!N.has(v)||q.length>=o&&!L.has(v)||q.push(v);let C=new Set(q),w=new Map(q.map(v=>[v,Na(v)])),O=new Set([...l,...c]),se=new Set(t.anchors.flatMap(v=>v.nodeIds)),re=q.map((v,V)=>{let W=r.get(v),ge=Sa(W,a);for(let We of ge)i.add(st(W.location.file,We));return{id:w.get(v),nodeId:v,order:V,role:se.has(v)?"anchor":O.has(v)?"connector":"junction",kind:W.kind,label:W.label,location:W.location,behavior:ga(e,W,se.has(v),[...new Set([...ge,...ba(e,W,S,r,T,P)])],ge,P.has(W.id)&&(ge.length===0||se.has(W.id)),N.has(W.id),y.has(W.id)&&ge.length===0)}}),ye=new Map;for(let v of t.paths)for(let V=0;V<v.edgeIds.length;V+=1){let W=s.get(v.edgeIds[V]),ge=v.nodeIds[V],We=v.nodeIds[V+1];!W||!ge||!We||ye.set(W.id,W.fromNodeId===ge&&W.toNodeId===We?"forward":"reverse")}let oe=S.filter(v=>C.has(v.fromNodeId)&&C.has(v.toNodeId)).sort((v,V)=>wa(v,V,t)).map((v,V)=>({id:Ra(v.id),edgeId:v.id,order:V,kind:v.kind,fromStepId:w.get(v.fromNodeId),toStepId:w.get(v.toNodeId),directed:!0,pathTraversal:ye.get(v.id)??"adjacent",evidence:v.evidence})),Ae=new Map(oe.map(v=>[v.edgeId,v.id])),ke=t.paths.map(v=>({id:v.id,status:v.status,stepIds:v.nodeIds.flatMap(V=>{let W=w.get(V);return W?[W]:[]}),transitionIds:v.edgeIds.flatMap(V=>{let W=Ae.get(V);return W?[W]:[]})})),mt=re.flatMap(v=>v.location?[`${v.location.file}:${v.location.line+1}`]:[]),cn=t.anchors.some(v=>v.status==="ambiguous"),$e=ke.some(v=>v.status==="connected"||v.status==="candidate"),fe=ke.some(v=>v.status==="partial");return{status:re.length===0?"unavailable":cn?"ambiguous":$e&&!fe?"connected":fe?"partial":"connected",steps:re,transitions:oe,paths:ke,coverage:{candidateNodes:z.length,returnedNodes:q.length,omittedNodeIds:z.filter(v=>!C.has(v)),returnedTransitions:oe.length,withheldStatements:re.reduce((v,V)=>v+(V.behavior?.coverage.omittedStatements??0),0),requestedFocusLocations:a,matchedFocusLocations:a.filter(v=>i.has(st(v.file,v.line))),unmatchedFocusLocations:a.filter(v=>!i.has(st(v.file,v.line)))},behaviorCommand:Qo(mt,"behavior"),exactSourceCommand:Qo(mt,"source")}}function fa(e,t,n,o){if(o<=0||n.length===0)return[];let r=new Set(t),a=new Set(n.map(i=>st(i.file,i.line)));return qe(e.edges.filter(i=>i.disposition!=="excluded"&&i.disposition!=="unsupported"&&["call","runtime-boundary"].includes(i.kind)&&r.has(i.fromNodeId)&&i.evidence.some(s=>!["candidate","unknown"].includes(s.strength)&&s.location&&a.has(st(s.location.file,s.location.line)))).sort((i,s)=>{let l=i.evidence.find(c=>c.location)?.location,d=s.evidence.find(c=>c.location)?.location;return(l?.file??"").localeCompare(d?.file??"")||(l?.line??Number.MAX_SAFE_INTEGER)-(d?.line??Number.MAX_SAFE_INTEGER)||i.id.localeCompare(s.id)}).map(i=>i.toNodeId)).slice(0,o)}function ga(e,t,n,o,r,a,i,s){if(!t.location||!["symbol","source-construct","runtime-boundary-participant"].includes(t.kind))return null;let l=t.location.endLine??t.location.line,d=Ce(e,t.location.file),c=o.length>0?o:[t.location.line],u=t.kind==="runtime-boundary-participant"?gt(e,t.location.file,0,Math.max(0,d.length-1),[t.location.line]):gt(e,t.location.file,t.location.line,l,c),f=o.filter(N=>N>=u.startLine&&N<=u.endLine),p=Dt(e,t.location.file,u.startLine,u.endLine,f),m=p??(f.length>0?Dt(e,t.location.file,u.startLine,u.endLine,f,{requireSavings:!1}):null),h=f.length>0?xa(e,t,u.startLine,u.endLine,f,m,a):null,y=d.slice(u.startLine,u.endLine+1).join(`
2
- `).length,L=He(e,t.location.file,u.startLine,u.endLine),x=d.slice(u.startLine,u.endLine+1).some((N,b)=>N.length>pa&&(L.get(u.startLine+b)??[]).some($=>["binding","branch","loop","call","return","throw","mutation"].includes($))),S=N=>ya(e,t,u.startLine,u.endLine,r.filter(b=>b>=u.startLine&&b<=u.endLine),N),T=(i||t.kind==="runtime-boundary-participant"||t.anchorIds.length>0)&&y<=ua,F=n&&(f.length===0||T);if(p&&(s||F))return S(Wo(p));if(!s&&!F&&h&&!x&&!T&&h.renderedCharacters<(m?.outlineCharacters??y))return S(h);if(p)return S(Wo(p));let P=d.slice(u.startLine,u.endLine+1),I=P.join(`
3
- `),E=He(e,t.location.file,u.startLine,u.endLine);return S({kind:"source",constructKind:"source construct",signature:P.find(N=>N.trim().length>0)?.trim()??t.label,lines:P.map((N,b)=>({line:u.startLine+b,endLine:u.startLine+b,depth:0,signals:E.get(u.startLine+b)??[],text:N,copied:!0})),coverage:{sourceStatements:P.length,representedStatements:P.length,copiedStatements:P.length,omittedStatements:0},rawCharacters:I.length,renderedCharacters:I.length})}function ya(e,t,n,o,r,a){if(!t.location)return a;let i=Nn(e,t.location.file,n,o);if(!i.available)return a;let s=He(e,t.location.file,n,o),l=Ce(e,t.location.file),d=new Set(r);for(let x of r){let S=qt(l[x]??"");if(!S)continue;let T=je(e,t.location.file,S).find(F=>F>x&&F<=o);T!==void 0&&d.add(T)}let c=[...new Map(i.targets.flatMap(x=>{let S=x.definition,T=S.relativePath===t.location.file&&S.startLine<=o&&S.endLine>=n;if(S.isTypeLike||T)return[];let F=Kt(e,S),P=r.length>0&&F&&s.get(x.sourceLine)?.includes("return"),I=F&&d.has(x.sourceLine);return F&&!P&&!I?[]:[[S.symbol,{definition:S,kind:P?"return-value-transformer":I?"focused-causal-target":"compiler-referenced-declaration"}]]})).values()].sort((x,S)=>x.definition.relativePath.localeCompare(S.definition.relativePath)||x.definition.startLine-S.definition.startLine||x.definition.symbol.localeCompare(S.definition.symbol)),u=[],f=c.filter(({kind:x})=>x!=="compiler-referenced-declaration").map(({definition:x})=>({owner:x,depth:1})),p=new Set,m=new Set(c.map(({definition:x})=>x.symbol));for(;f.length>0;){let x=f.shift();if(!x||p.has(x.owner.symbol))continue;p.add(x.owner.symbol);let{owner:S,depth:T}=x,F=Nn(e,S.relativePath,S.startLine,S.endLine);if(!F.available)continue;let P=He(e,S.relativePath,S.startLine,S.endLine),I=Ce(e,S.relativePath);for(let E of F.targets){let N=E.definition,b=N.relativePath===S.relativePath&&N.startLine<=S.endLine&&N.endLine>=S.startLine;if(N.isTypeLike||b)continue;let $=Kt(e,N),z=qt(I[E.sourceLine]??""),q=$&&z!==null&&je(e,S.relativePath,z).some(w=>w>E.sourceLine&&w<=S.endLine&&(P.get(w)??[]).some(O=>["branch","return","throw"].includes(O))),C=$&&((P.get(E.sourceLine)??[]).some(w=>["branch","return","throw"].includes(w))||q);$&&!C||(m.has(N.symbol)||(m.add(N.symbol),u.push({definition:N,kind:$?"focused-causal-target":"compiler-referenced-declaration"})),$&&T<2&&f.push({owner:N,depth:T+1}))}}let h=[...new Map([...c,...u].map(x=>[x.definition.symbol,x])).values()].sort((x,S)=>x.definition.relativePath.localeCompare(S.definition.relativePath)||x.definition.startLine-S.definition.startLine||x.definition.symbol.localeCompare(S.definition.symbol)),y=[],L=[];for(let{definition:x,kind:S}of h){let T=S==="compiler-referenced-declaration"?ha(e,x.relativePath,x.startLine,x.endLine):{startLine:x.startLine,endLine:x.endLine},F=Ce(e,x.relativePath).slice(T.startLine,T.endLine+1).join(`
4
- `),P=S==="compiler-referenced-declaration"?null:Dt(e,x.relativePath,x.startLine,x.endLine,[]),I=P?[P.signature,...P.lines.map(z=>`${z.line+1}${z.signals.length>0?`[${z.signals.join(",")}]`:""} ${z.text}`)].join(" | "):null,E=I&&I.length<F.length?I:F,N={symbol:x.symbol,label:x.leaf,file:x.relativePath,line:T.startLine,endLine:T.endLine},b=S==="compiler-referenced-declaration"?1e3:8e3,$=S==="compiler-referenced-declaration"?12:120;if(E.length>b||T.endLine-T.startLine>$){L.push({...N,reason:"source-too-large"});continue}y.push({kind:S,...N,text:E})}return{...a,...y.length===0?{}:{supportingDeclarations:y},...L.length===0?{}:{omittedSupportingDeclarations:L}}}function ha(e,t,n,o){let r=ae(e,t);if(!r)return{startLine:n,endLine:o};let a=[];Zo(r.rootNode,s=>{ma.has(s.type)&&s.startPosition.row<=n&&s.endPosition.row>=o&&a.push(s)});let i=a.sort((s,l)=>s.endPosition.row-s.startPosition.row-(l.endPosition.row-l.startPosition.row)||s.endIndex-s.startIndex-(l.endIndex-l.startIndex))[0];return i?{startLine:i.startPosition.row,endLine:i.endPosition.row}:{startLine:n,endLine:o}}function Zo(e,t){t(e);for(let n of e.namedChildren)Zo(n,t)}function Wo(e){return{kind:"outline",constructKind:e.constructKind,signature:e.signature,lines:e.lines,coverage:e.coverage,rawCharacters:e.rawCharacters,renderedCharacters:e.outlineCharacters}}function ba(e,t,n,o,r,a){if(!t.location||!["symbol","source-construct","runtime-boundary-participant"].includes(t.kind))return[];let i=new Set,s=new Set(ue(e,t.location.file)?.callSites.map(l=>l.line)??[]);if(t.kind==="runtime-boundary-participant"&&i.add(t.location.line),a.has(t.id))for(let l of bn(e,{files:[t.location.file]}))l.source.startLine>=t.location.line&&l.source.startLine<=(t.location.endLine??t.location.line)&&i.add(l.source.startLine);for(let l of n){if(l.fromNodeId!==t.id&&l.toNodeId!==t.id)continue;let d=o.get(l.fromNodeId===t.id?l.toNodeId:l.fromNodeId),c=a.has(t.id)&&["call","reference","runtime-boundary"].includes(l.kind)&&l.fromNodeId===t.id,u=(d?.anchorIds.length??0)>0;if(!r.has(l.id)&&!c&&!u)continue;let f=l.evidence.flatMap(L=>L.location?.file===t.location.file?[L.location.line]:[]),p=f.filter(L=>s.has(L));for(let L of p.length>0?p:f)i.add(L);let m=d?.attributes.leaf;if(typeof m!="string"||m.length===0)continue;let h=je(e,t.location.file,m).filter(L=>L>=t.location.line&&L<=(t.location.endLine??t.location.line)),y=h.find(L=>s.has(L))??h[0];y!==void 0&&i.add(y)}return[...i].sort((l,d)=>l-d)}function Sa(e,t){if(!e.location)return[];let n=e.location.endLine??e.location.line;return t.filter(o=>o.file===e.location.file&&o.line>=e.location.line&&o.line<=n).map(o=>o.line)}function va(e){let t=new Map;for(let n of e){if(!n.file||!Number.isSafeInteger(n.line)||n.line<0)throw new RangeError(`Behavior focus locations require a repository file and non-negative line; received ${JSON.stringify(n)}.`);t.set(st(n.file,n.line),{file:n.file,line:n.line})}return[...t.values()].sort((n,o)=>n.file.localeCompare(o.file)||n.line-o.line)}function st(e,t){return`${e}\0${t}`}function xa(e,t,n,o,r,a,i){if(!t.location)return null;let s=Ce(e,t.location.file),l=He(e,t.location.file,n,o),d=[...l].filter(([,C])=>C.length>0).map(([C])=>C).sort((C,w)=>C-w),c=r.map(C=>(l.get(C)??[]).length>0?C:d.find(w=>w>C&&w-C<=8)??C),u=new Set([...r,...c]),f=i?Sn(e,t.location.file,n,o,{minimumBodyLines:0}):null,p=a?[...new Map(c.flatMap(C=>a.lines.filter(w=>w.text.length<=500&&w.signals.some(O=>["branch","loop","catch","finally"].includes(O))&&C>=w.line&&C<=w.endLine).sort((w,O)=>w.endLine-w.line-(O.endLine-O.line)||w.line-O.line).slice(0,2).map(w=>[`${w.line}\0${w.endLine}`,w]))).values()]:_t(e,t.location.file,n,o,c);for(let C of f?.lines??[])u.add(C.line);for(let C of p)u.add(C.line);for(let[C,w]of l)w.includes("call")&&w.includes("shape")&&u.add(C);let m=[];for(let C of c){let w=qt(s[C]??"");if(!w)continue;let O=je(e,t.location.file,w).filter(oe=>oe>C&&oe<=o),se=O[0];se!==void 0&&u.add(se);let re=O.find(oe=>(l.get(oe)??[]).some(Ae=>Ae==="branch"||Ae==="loop"));if(re===void 0)continue;u.add(re);let ye=(a?.lines??[]).find(oe=>oe.line===re)??{line:re,endLine:Math.min(o,re+40),depth:0,signals:l.get(re)??[],text:(s[re]??"").trim(),copied:!0},U=a?.lines??s.slice(ye.line,ye.endLine+1).map((oe,Ae)=>{let ke=ye.line+Ae;return{line:ke,endLine:ke,depth:0,signals:l.get(ke)??[],text:oe.trim(),copied:!0}});m.push({focusLine:C,governingUse:re,lines:U.filter(oe=>oe.line>=ye.line&&oe.line<=ye.endLine&&oe.text.length<=500&&oe.signals.some(Ae=>["binding","branch","call","mutation"].includes(Ae)))})}for(let C of m.sort((w,O)=>O.governingUse-O.focusLine-(w.governingUse-w.focusLine)||w.focusLine-O.focusLine).slice(0,2))for(let w of C.lines.slice(0,14))u.add(w.line);let h=new Set(["binding","branch","loop","call","return","throw","mutation"]);for(let C of p)for(let w of a?.lines??[])w.line<C.line||w.line>C.endLine||w.signals.some(O=>h.has(O))&&u.add(w.line);let y=s.slice(n,o+1).flatMap((C,w)=>{let O=qt(C);return O?[{name:O,line:n+w}]:[]}),L=!0;for(;L;){L=!1;for(let C of y)if([...u].some(O=>La(s[O]??"",C.name))){u.has(C.line)||(u.add(C.line),L=!0);for(let O of je(e,t.location.file,C.name))O<n||O>o||u.has(O)||(l.get(O)??[]).some(se=>h.has(se))&&(u.add(O),L=!0)}}for(let C of a?.lines??[])if(C.signals.some(w=>["branch","loop","catch","finally"].includes(w))&&u.has(C.line))for(let w of a?.lines??[])w.line<C.line||w.line>C.endLine||w.signals.some(O=>h.has(O))&&u.add(w.line);let x=ue(e,t.location.file),S=new Set(x?.callSites.map(C=>C.line)??[]),T=l,F=new Map([...a?.lines??[],...p].filter(C=>C.signals.some(w=>["branch","loop","catch","finally"].includes(w))).map(C=>[C.line,C])),P=new Map((a?.lines??[]).filter(C=>C.text.length<=500&&C.signals.includes("shape")&&(C.signals.includes("call")||C.signals.includes("mutation")||C.signals.includes("return"))).sort((C,w)=>C.endLine-C.line-(w.endLine-w.line)||C.line-w.line).map(C=>[C.line,C])),I=new Map((f?.lines??[]).map(C=>[C.line,C.signals.filter(w=>w!=="lifecycle")])),E=[...u].filter(C=>C>=n&&C<=o).sort((C,w)=>C-w).map(C=>{let w=F.get(C)??P.get(C);return{line:C,endLine:w?.endLine??C,depth:w?.depth??0,signals:Ea([...T.get(C)??[],...a?.lines.filter(O=>C>=O.line&&C<=O.endLine).flatMap(O=>O.signals)??[],...I.get(C)??[],...r.includes(C)?["anchor"]:[],...S.has(C)?["call"]:[]]),text:w?.text??(s[C]??"").trim(),copied:w?.copied??!0}}).filter(C=>C.text.length>0);if(E.length===0)return null;let N=f?.candidateLines??Sn(e,t.location.file,n,o,{minimumBodyLines:0})?.candidateLines??0,b=Math.max(a?.coverage.sourceStatements??0,N,E.length),$=a?.signature??(s[n]??t.label).trim(),z=$.length+E.reduce((C,w)=>C+w.text.length+w.signals.join(",").length+12,0),q=s.slice(n,o+1).join(`
5
- `).length;return{kind:"connector-slice",constructKind:a?.constructKind??"source construct",signature:$,lines:E,coverage:{sourceStatements:b,representedStatements:E.length,copiedStatements:E.length,omittedStatements:Math.max(0,b-E.length)},rawCharacters:q,renderedCharacters:z}}function Ea(e){let t=["anchor","signature","binding","branch","loop","call","await","return","throw","mutation","shape","spread","catch","finally"],n=new Set(e);return t.filter(o=>n.has(o))}function qt(e){return/\b(?:const|let|var)\s+([\p{L}_$][\p{L}\p{N}_$]*)\s*(?:=|\bof\b|\bin\b)/u.exec(e)?.[1]??null}function La(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`(?:^|[^\\p{L}\\p{N}_$])${n}(?:$|[^\\p{L}\\p{N}_$])`,"u").test(e)}function Ca(e,t,n){return qe(e.flatMap(o=>{let r=n.get(o),a=t.filter(i=>i.kind==="call"&&i.toNodeId===o).map(i=>({edge:i,node:n.get(i.fromNodeId)})).filter(i=>i.node!==void 0&&["symbol","source-construct","runtime-boundary-participant"].includes(i.node.kind)&&i.node.location!==null).sort((i,s)=>{let l=Ho(s.edge)-Ho(i.edge);if(l!==0)return l;let d=Vo(i.node,r)?0:1,c=Vo(s.node,r)?0:1,u=(i.node.location?.endLine??i.node.location?.line??0)-(i.node.location?.line??0),f=(s.node.location?.endLine??s.node.location?.line??0)-(s.node.location?.line??0);return d-c||u-f||i.node.label.localeCompare(s.node.label)});return a[0]?[a[0].node.id]:[]}))}function Ho(e){let t={exact:4,mixed:3,derived:2,candidate:1,unknown:0};return Math.max(0,...e.evidence.map(n=>t[n.strength]))}function Vo(e,t){return!e.location||!t?.location?!1:Yo(e.location.file)===Yo(t.location.file)}function Yo(e){return e.split("/").filter(Boolean).slice(0,2).join("/")}function Ia(e,t,n,o){let r=new Set(e),a=new Set,i=[],s=qe(e);for(let l=0;l<o&&s.length>0;l+=1){let d=s.filter(u=>!a.has(u));for(let u of d)a.add(u);let c=Ca(d,t,n);s=[];for(let u of c)!r.has(u)&&!i.includes(u)&&i.push(u),a.has(u)||s.push(u)}return i}function wa(e,t,n){let o=new Map(n.paths.flatMap(r=>r.edgeIds).map((r,a)=>[r,a]));return(o.get(e.id)??Number.MAX_SAFE_INTEGER)-(o.get(t.id)??Number.MAX_SAFE_INTEGER)||e.id.localeCompare(t.id)}function Na(e){return`step:${e}`}function Ra(e){return`transition:${e}`}function Qo(e,t){return e.length===0?null:`scip-query inspect ${e.map(n=>`--at ${Ma(n)}`).join(" ")} --view ${t}`}function Ma(e){return`'${e.replace(/'/gu,`'"'"'`)}'`}function qe(e){return[...new Set(e)]}var Ta=6;function Jo(e,t,n){return`${e}\0${t}\0${n??t}`}function oi(e,t,n,o={}){let r=o.limit??Ta;if(!Number.isSafeInteger(r)||r<=0)throw new RangeError(`next-anchor limit must be a positive safe integer; received ${r}`);let a=o.sourceAllowed??(()=>!0),i=new Map(t.nodes.map(E=>[E.id,E])),s=new Set(n.steps.map(E=>E.nodeId)),l=new Set(n.steps.flatMap(E=>{let N=Mn(i.get(E.nodeId));return N?[N]:[]})),d=new Set;for(let E of n.steps)for(let N of E.behavior?.supportingDeclarations??[])l.add(N.symbol),d.add(Jo(N.file,N.line,N.endLine));let c=E=>E.symbol!==null&&l.has(E.symbol)||d.has(Jo(E.file,E.line,E.endLine)),u=new Map(n.steps.flatMap(E=>{if(!E.location)return[];let N=Mn(i.get(E.nodeId));if(!N)return[];let b=le(e,E.location.file).find($=>$.symbol===N);return b?[[E.id,b]]:[]})),f=new Bt(e).calleeMap([...u.values()],{additive:!1,semantic:!0}),p=[],m=new Set,h=new Set,y=0,L=0,x=0,S=0,T=0,F=0,P=0,I=0;for(let E of n.steps){if(!E.location||!E.behavior)continue;let N=Fa(E,{db:e,topology:t,nodeById:i,returnedNodeIds:s,sourceAllowed:a,alternativeAlreadyReturned:c});p.push(...N.candidates),F+=N.upstreamCandidates,I+=N.runtimeCandidates,P+=N.resultCandidates;let b=Pa(E,{db:e,topology:t,nodeById:i,returnedNodeIds:s,sourceAllowed:a,alternativeAlreadyReturned:c},m);p.push(...b);let $=Aa(E,{db:e,topology:t,nodeById:i,returnedNodeIds:s,sourceAllowed:a,alternativeAlreadyReturned:c},{evidencedCallsiteKeys:m,consideredCandidateKeys:h,calleeMap:f,stepDefinition:u.get(E.id)});p.push(...$.candidates),y+=$.scannedBehaviorSteps,L+=$.visibleCallsites,x+=$.identityCandidateCallsites,S+=$.ambiguousCallsites,T+=$.unresolvedCallsites}return ka(e,p,n.steps,r,{scannedBehaviorSteps:y,visibleCallsites:L,graphEvidencedCallsites:m.size,identityCandidateCallsites:x,ambiguousCallsites:S,unresolvedCallsites:T,upstreamCandidates:F,resultCandidates:P,runtimeCandidates:I},o.selectionTerms)}function Fa(e,t){let n=[],o=0,r=0,a=0;if(!e.location||!e.behavior)return{candidates:n,upstreamCandidates:o,resultCandidates:r,runtimeCandidates:a};let i=t.topology.edges.filter(l=>["call","runtime-boundary"].includes(l.kind)&&(l.fromNodeId===e.nodeId||l.toNodeId===e.nodeId)&&l.disposition!=="excluded"&&l.disposition!=="unsupported");for(let l of i){let d=l.toNodeId===e.nodeId,c=d?l.fromNodeId:l.toNodeId;if(t.returnedNodeIds.has(c))continue;let u=t.nodeById.get(c);if(!u?.location||!t.sourceAllowed(u.location.file))continue;let f=l.kind==="call"?Tn(t.db,u):kn(u);if(!f||t.alternativeAlreadyReturned(f))continue;let p=Fn(l,u.location.file)??u.location,m=Ce(t.db,p.file)[p.line]?.trim(),h=d?"upstream":"downstream",y=l.kind==="runtime-boundary"?d?"runtime-producer":"runtime-consumer":d?"caller":"callee",L=Pn(l.evidence),x=bt(u);n.push({anchor:{id:lt(e.id,p.line,u.id),status:L,source:"graph-relation",direction:h,causalRole:y,relationKind:l.kind,fromStepId:e.id,fromLabel:e.label,callsite:{file:p.file,line:p.line,endLine:p.endLine??p.line,text:m||`${u.label} \u2192 ${e.label}`,signals:["call"],calleeLeaf:x},alternatives:[f],alternativeCount:1,evidence:l.evidence}}),d&&(o+=1),l.kind==="runtime-boundary"&&(a+=1)}let s=t.topology.edges.filter(l=>l.kind==="reference"&&l.fromNodeId===e.nodeId&&l.disposition!=="excluded"&&l.disposition!=="unsupported"&&!t.returnedNodeIds.has(l.toNodeId));for(let l of s){let d=t.nodeById.get(l.toNodeId);if(!d?.location||!t.sourceAllowed(d.location.file))continue;let c=Tn(t.db,d);if(!c||t.alternativeAlreadyReturned(c))continue;let u=bt(d),f=Fn(l,e.location.file)?.line,p=e.behavior.lines.find(y=>(f===void 0||f>=y.line&&f<=y.endLine)&&y.text.includes(u));if(!p)continue;let m=ri(p.signals),h=Pn(l.evidence);n.push({anchor:{id:lt(e.id,p.line,d.id),status:h,source:"graph-relation",direction:"downstream",causalRole:m,relationKind:"reference",fromStepId:e.id,fromLabel:e.label,callsite:{file:e.location.file,line:p.line,endLine:p.endLine,text:p.text,signals:p.signals,calleeLeaf:u},alternatives:[c],alternativeCount:1,evidence:l.evidence}}),m==="result-callback"&&(r+=1)}return{candidates:n,upstreamCandidates:o,resultCandidates:r,runtimeCandidates:a}}function Pa(e,t,n){let o=[];if(!e.location)return o;let r=jt(t.db,e.location.file,e.location.line,e.location.endLine??e.location.line),a=Ce(t.db,e.location.file),i=He(t.db,e.location.file,e.location.line,e.location.endLine??e.location.line);for(let s of r.targets){if(!t.sourceAllowed(s.definition.relativePath))continue;let l=zt(e.location.file,s.sourceLine,s.calleeLeaf);if(n.has(l))continue;n.add(l);let d=Da(i.get(s.sourceLine)),c={symbol:s.definition.symbol,label:s.definition.leaf,file:s.definition.relativePath,line:s.definition.startLine,endLine:s.definition.endLine};t.alternativeAlreadyReturned(c)||o.push({anchor:{id:lt(e.id,s.sourceLine,s.definition.symbol),status:"exact",source:"graph-call",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:e.id,fromLabel:e.label,callsite:{file:e.location.file,line:s.sourceLine,endLine:s.sourceLine,text:a[s.sourceLine]?.trim()||`${s.calleeLeaf}()`,signals:d,calleeLeaf:s.calleeLeaf},alternatives:[c],alternativeCount:1,evidence:[{method:"scip-occurrence-callsite",strength:"exact",identity:s.definition.symbol,location:{file:e.location.file,line:s.sourceLine}}]}})}return o}function Aa(e,t,n){let o={candidates:[],scannedBehaviorSteps:0,visibleCallsites:0,identityCandidateCallsites:0,ambiguousCallsites:0,unresolvedCallsites:0};if(!e.location||!e.behavior)return o;let r=e.behavior.lines.filter(m=>m.signals.includes("call"));if(r.length===0)return o;let a=[],i=0,s=0,l=0,d=(ue(t.db,e.location.file)?.callSites??[]).filter(m=>r.some(h=>m.line>=h.line&&m.line<=h.endLine)),c=t.topology.edges.filter(m=>m.kind==="call"&&m.fromNodeId===e.nodeId&&m.disposition!=="excluded"&&m.disposition!=="unsupported"),u=new Map;for(let m of c){let h=t.nodeById.get(m.toNodeId);if(!h)continue;let y=bt(h);u.set(y,(u.get(y)??0)+1)}let f=_a(t.db,n.stepDefinition?n.calleeMap.get(n.stepDefinition.symbolId)??[]:[]),p=Ba(f);for(let m of f){if(!t.sourceAllowed(m.alternative.file)||t.alternativeAlreadyReturned(m.alternative))continue;let h=yt(m.alternative.label),y=ti(d,r,h,m.row.callsiteLine,p.get(h)===1);if(!y)continue;let L=ht(r,y.line,h);if(!L)continue;let x=zt(e.location.file,y.line,h);if(n.evidencedCallsiteKeys.has(x))continue;n.evidencedCallsiteKeys.add(x);let S=si(m.row.source);a.push({anchor:{id:lt(e.id,y.line,m.alternative.symbol??m.alternative.file),status:S,source:"graph-call",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:e.id,fromLabel:e.label,callsite:{file:e.location.file,line:L.line,endLine:L.endLine,text:L.text,signals:L.signals,calleeLeaf:h},alternatives:[m.alternative],alternativeCount:1,evidence:[{method:m.row.source,strength:S,identity:m.row.symbol,location:{file:e.location.file,line:y.line}}]}})}for(let m of c){if(t.returnedNodeIds.has(m.toNodeId))continue;let h=t.nodeById.get(m.toNodeId);if(!h?.location||!t.sourceAllowed(h.location.file))continue;let y=bt(h),L=m.evidence.find(I=>{let E=I.location;return E!==null&&E.file===e.location?.file&&E.line>=0})?.location?.line,x=ti(d,r,y,L,u.get(y)===1);if(!x)continue;let S=ht(r,x.line,y);if(!S)continue;let T=zt(e.location.file,x.line,y);if(n.evidencedCallsiteKeys.has(T))continue;n.evidencedCallsiteKeys.add(T);let F=kn(h);if(!F||t.alternativeAlreadyReturned(F))continue;let P=Pn(m.evidence);a.push({anchor:{id:lt(e.id,x.line,h.id),status:P,source:"graph-call",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:e.id,fromLabel:e.label,callsite:{file:e.location.file,line:S.line,endLine:S.endLine,text:S.text,signals:S.signals,calleeLeaf:y},alternatives:[F],alternativeCount:1,evidence:m.evidence}})}for(let m of d){let h=zt(e.location.file,m.line,m.calleeLeaf);if(n.evidencedCallsiteKeys.has(h))continue;let y=ht(r,m.line,m.calleeLeaf);if(!y)continue;let L=kt(e.location.file,$t(t.db).get(m.calleeLeaf)??[]).flatMap(F=>le(t.db,F.file).filter(P=>P.symbol===F.symbol&&P.isFunctionLike)).filter(F=>t.sourceAllowed(F.relativePath)&&!t.alternativeAlreadyReturned({symbol:F.symbol,label:F.leaf,file:F.relativePath,line:F.startLine,endLine:F.endLine})),x=An(L.map(F=>({symbol:F.symbol,label:F.leaf??m.calleeLeaf,file:F.relativePath,line:F.startLine,endLine:F.endLine})));if(x.length===0){l+=1;continue}let S=`${e.id}\0${m.line}\0${m.calleeLeaf}`;if(n.consideredCandidateKeys.has(S))continue;n.consideredCandidateKeys.add(S);let T=x.length>1;T?s+=1:i+=1,a.push({anchor:{id:lt(e.id,m.line,m.calleeLeaf),status:T?"ambiguous":"candidate",source:"leaf-identity-candidate",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:e.id,fromLabel:e.label,callsite:{file:e.location.file,line:y.line,endLine:y.endLine,text:y.text,signals:y.signals,calleeLeaf:m.calleeLeaf},alternatives:x.slice(0,3),alternativeCount:x.length,evidence:[]}})}return{candidates:a,scannedBehaviorSteps:1,visibleCallsites:d.length,identityCandidateCallsites:i,ambiguousCallsites:s,unresolvedCallsites:l}}function ii(e,t,n){let o=new Map(t.nodes.map(r=>[r.id,r]));for(let r of n.steps)if(!(!r.behavior||!r.location))for(let a of t.edges){if(a.kind!=="reference"||a.fromNodeId!==r.nodeId||a.disposition==="excluded"||a.disposition==="unsupported")continue;let i=o.get(a.toNodeId);if(!i?.location||!Tn(e,i))continue;let s=bt(i),l=Fn(a,r.location.file)?.line,d=r.behavior.lines.find(c=>(l===void 0||l>=c.line&&l<=c.endLine)&&c.text.includes(s));!d||ri(d.signals)!=="result-callback"||a.semantics?.some(({family:c,subtype:u})=>c==="control"&&u==="result-callback")||(a.semantics=[...a.semantics??[],{family:"control",subtype:"result-callback",attributes:{evidenceRole:"result-producing-callable-reference"}}])}}function ri(e){return e.includes("call")&&e.some(t=>["return","mutation","shape","spread","binding"].includes(t))?"result-callback":"callable-reference"}function ka(e,t,n,o,r,a=[]){let i=Oa(t).sort(ai),s=i.filter(m=>$a(e,m)).slice(0,o),l=new Set(s.map(m=>m.anchor.id)),d=i.filter(m=>!l.has(m.anchor.id)),c=s.map(m=>m.anchor),u=d.map(m=>m.anchor),f=An(c.flatMap(m=>m.alternativeCount===1?m.alternatives:[])),p=An(u.flatMap(m=>m.alternativeCount===1?m.alternatives:[]));return{anchors:c,withheldAnchors:u,candidateAnchors:i.length,omittedAnchors:Math.max(0,i.length-c.length),...r,inspectCommand:f.length===0?null:`scip-query inspect ${f.map(ni).join(" ")} --view behavior`,remainingInspectCommands:ja(p,8).map(m=>`scip-query inspect ${m.map(ni).join(" ")} --view behavior`)}}function ai(e,t){let n=e.anchor.alternatives[0],o=t.anchor.alternatives[0];return Ut(e.anchor.status)-Ut(t.anchor.status)||(e.anchor.direction??"").localeCompare(t.anchor.direction??"")||(e.anchor.relationKind??"").localeCompare(t.anchor.relationKind??"")||(e.anchor.causalRole??"").localeCompare(t.anchor.causalRole??"")||e.anchor.fromStepId.localeCompare(t.anchor.fromStepId)||e.anchor.callsite.file.localeCompare(t.anchor.callsite.file)||e.anchor.callsite.line-t.anchor.callsite.line||(n?.file??"").localeCompare(o?.file??"")||(n?.line??0)-(o?.line??0)||e.anchor.id.localeCompare(t.anchor.id)}function $a(e,t){if(t.anchor.alternativeCount!==1)return!0;let n=t.anchor.alternatives[0],o=n.endLine??n.line;return Ce(e,n.file).slice(n.line,o+1).join(`
6
- `).length<=2e4}function Da(e){return e?.includes("call")?[...e]:["call",...e??[]]}function _a(e,t){let n=new Map;for(let o of t){let r=le(e,o.file).find(s=>s.symbol===o.symbol&&s.isFunctionLike);if(!r)continue;let a={symbol:r.symbol,label:r.leaf,file:r.relativePath,line:r.startLine,endLine:r.endLine},i=n.get(r.symbol);!i||ei(o.source)>ei(i.row.source)?n.set(r.symbol,{row:{...o,...o.callsiteLine===void 0&&i?.row.callsiteLine!==void 0?{callsiteLine:i.row.callsiteLine}:{}},alternative:a}):i.row.callsiteLine===void 0&&o.callsiteLine!==void 0&&n.set(r.symbol,{...i,row:{...i.row,callsiteLine:o.callsiteLine}})}return[...n.values()]}function Ba(e){let t=new Map;for(let n of e){let o=yt(n.alternative.label);t.set(o,(t.get(o)??0)+1)}return t}function si(e){return e==="semantic-callee"||e==="scip-chunk"?"exact":"derived"}function ei(e){return si(e)==="exact"?2:1}function ht(e,t,n){return e.find(o=>t>=o.line&&t<=o.endLine&&o.text.includes(n))??e.find(o=>t>=o.line&&t<=o.endLine)??null}function ti(e,t,n,o,r){if(o!==void 0)return e.find(i=>i.line===o&&i.calleeLeaf===n&&ht(t,i.line,n)!==null)??null;let a=e.filter(i=>i.calleeLeaf===n&&ht(t,i.line,i.calleeLeaf)!==null);return r&&a.length===1?a[0]:null}function bt(e){let t=e.attributes.leaf;if(typeof t=="string"&&t.length>0)return yt(t);let n=e.label.slice(e.label.lastIndexOf(":")+1);return yt(n)}function Mn(e){if(e?.kind!=="symbol"||!e.id.startsWith("symbol:"))return null;try{return decodeURIComponent(e.id.slice(7))}catch{return null}}function kn(e){return e.location?{symbol:Mn(e),label:e.label,file:e.location.file,line:e.location.line,endLine:e.location.endLine??null}:null}function Tn(e,t){let n=kn(t);return n?.symbol&&le(e,n.file).some(r=>r.symbol===n.symbol&&r.isFunctionLike)?n:null}function Fn(e,t){return e.evidence.find(n=>n.location?.file===t)?.location??e.evidence.find(n=>n.location!==null)?.location??null}function Pn(e){let t={exact:5,derived:4,mixed:3,candidate:2,unknown:1};return e.reduce((n,o)=>t[o.strength]>t[n]?o.strength:n,"unknown")}function Oa(e){let t=new Map;for(let n of e){let r=n.anchor.alternatives[0]?.symbol??`${n.anchor.callsite.file}:${n.anchor.callsite.line}:${n.anchor.callsite.calleeLeaf}`,a=t.get(r);(!a||Ga(n,a)<0)&&t.set(r,n)}return[...t.values()]}function Ga(e,t){return Ut(e.anchor.status)-Ut(t.anchor.status)||e.anchor.alternativeCount-t.anchor.alternativeCount||ai(e,t)}function Ut(e){return{exact:0,derived:1,mixed:2,candidate:3,unknown:4,ambiguous:5}[e]}function An(e){let t=new Map;for(let n of e)t.set(n.symbol??`${n.file}:${n.line}`,n);return[...t.values()].sort((n,o)=>n.file.localeCompare(o.file)||n.line-o.line||n.label.localeCompare(o.label))}function ni(e){return`--at ${Ka(`${e.file}:${e.line+1}`)}`}function ja(e,t){let n=[];for(let o=0;o<e.length;o+=t)n.push(e.slice(o,o+t));return n}function Ka(e){return`'${e.replaceAll("'","'\\''")}'`}function zt(e,t,n){return`${e}\0${t}\0${n}`}function lt(e,t,n){return["next-anchor",e,String(t),n].map(encodeURIComponent).join(":")}var li=["call","contract-symbol","import","reference","runtime-boundary"],qa={call:[{family:"control",subtype:"call"}],"contract-symbol":[{family:"contract",subtype:"uses-contract-symbol"}],import:[{family:"identity",subtype:"imports"}],reference:[{family:"identity",subtype:"references"}]},za={"structural-membership":[{family:"identity",subtype:"contains"}],"boundary-observation":[{family:"identity",subtype:"owns-runtime-observation"}],"external-import":[{family:"identity",subtype:"imports-external"}]};function ci(e){if(e.kind!=="runtime-boundary")return di(qa[e.kind]);let t=e.fromBoundaryParticipant?.protocol??e.toBoundaryParticipant?.protocol,n={crossesRuntimeBoundary:!0,...t?{protocol:t}:{},...e.runtimeBoundaryKey?{runtimeKey:e.runtimeBoundaryKey}:{}},o=[{family:"control",subtype:"runtime-handoff",context:n}];return e.evidence==="runtime-boundary:carrier.discriminator"&&(o.push({family:"control",subtype:"discriminator-dispatch",context:{...n},attributes:{joinRule:"carrier.discriminator",...e.fromBoundaryParticipant?.action?{producerAction:e.fromBoundaryParticipant.action}:{},...e.toBoundaryParticipant?.action?{consumerAction:e.toBoundaryParticipant.action}:{}}}),o.push({family:"data",subtype:"serialized-discriminator-transfer",context:{...n},attributes:{joinRule:"carrier.discriminator"}})),e.evidence==="runtime-boundary:queue.address"&&e.fromBoundaryParticipant?.action==="queue.send"&&e.toBoundaryParticipant?.action==="queue.consume"&&o.push({family:"temporal",subtype:"enqueue-before-consume",context:{...n},attributes:{producerAction:e.fromBoundaryParticipant.action,consumerAction:e.toBoundaryParticipant.action,retryPolicy:"unknown"}}),o}function Wt(e){return di(za[e])}function di(e){return e.map(t=>({...t,...t.context?{context:{...t.context}}:{},...t.attributes?{attributes:{...t.attributes}}:{}}))}import{join as ys}from"path";import{createRequire as Ua}from"module";import{resolve as vt}from"path";var Wa=Ua(import.meta.url),St;function pi(e,t,n){let o=Ha();if(!o)return $n("The TypeScript compiler runtime is unavailable.");let r=Va(o,e,t),a=r.getSourceFile(vt(t))??r.getSourceFile(t);if(!a)return $n(`The TypeScript compiler did not materialize ${t}.`);let i={ts:o,sourceFile:a,checker:r.getTypeChecker(),points:new Map,edges:new Map,unsupported:new Set,nextCfgId:0},s=Qa(o,a,n);if(s.length===0)return $n("No function-like construct intersects the selected source range.");let l=new Map(s.map(u=>[u,Xa(a,u)])),d=s.map(u=>Ja(i,u,Za(o,u,l),l.get(u)));for(let u of d)es(i,u),is(i,u),ss(i,u);cs(i,d);let c=[...i.unsupported].sort();return{points:[...i.points.values()].map(({node:u,...f})=>f).sort(gs),edges:[...i.edges.values()].sort((u,f)=>u.id.localeCompare(f.id)),coverage:{status:c.length===0?"complete":"partial",basis:"typescript-compiler-cfg-reaching-definitions",unsupported:c}}}function Ha(){if(St!==void 0)return St;try{St=Wa("typescript")}catch{St=ho()?.ts??null}return St}function Va(e,t,n){let o=vt(n),r={target:e.ScriptTarget.ESNext,module:e.ModuleKind.NodeNext,moduleResolution:e.ModuleResolutionKind.NodeNext,skipLibCheck:!0,noResolve:!0},a=e.createSourceFile(o,t,r.target,!0,Ya(e,o)),i=e.createCompilerHost(r,!0),s=i.getSourceFile.bind(i),l=i.readFile.bind(i),d=i.fileExists.bind(i);return i.getSourceFile=(c,u,f,p)=>vt(c)===o?a:s(c,u,f,p),i.readFile=c=>vt(c)===o?t:l(c),i.fileExists=c=>vt(c)===o||d(c),e.createProgram([o],r,i)}function Ya(e,t){return/\.tsx$/iu.test(t)?e.ScriptKind.TSX:/\.[cm]?js$/iu.test(t)?e.ScriptKind.JS:/\.jsx$/iu.test(t)?e.ScriptKind.JSX:e.ScriptKind.TS}function Qa(e,t,n){let o=[],r=a=>{if(mi(e,a)){let i=t.getLineAndCharacterOfPosition(a.getStart(t)).line,s=t.getLineAndCharacterOfPosition(a.getEnd()).line;(!n||i<=n.endLine&&s>=n.startLine)&&o.push(a)}a.forEachChild(r)};return t.forEachChild(r),o.sort((a,i)=>a.getStart(t)-i.getStart(t))}function mi(e,t){return e.isFunctionLike(t)&&"body"in t&&t.body!==void 0}function Xa(e,t){return`callable:${encodeURIComponent(e.fileName)}:${t.getStart(e)}:${t.getEnd()}`}function Za(e,t,n){for(let o=t.parent;o;o=o.parent)if(mi(e,o)&&n.has(o))return n.get(o);return null}function Ja(e,t,n,o){let r=new Map,a=me(e,r,"exit",null),i=t.body,s=a.id;if(i&&e.ts.isBlock(i))s=Dn(e,r,[...i.statements],a.id,{breakTarget:null,continueTarget:null});else if(i){let d=me(e,r,"statement",i);ie(r,d.id,a.id),s=d.id}let l=me(e,r,"entry",t);return ie(r,l.id,s),{id:o,node:t,parentId:n,cfg:r,entryId:l.id,exitId:a.id}}function Dn(e,t,n,o,r){let a=o;for(let i=n.length-1;i>=0;i-=1)a=Je(e,t,n[i],a,r);return a}function Je(e,t,n,o,r){let a=e.ts;if(a.isBlock(n))return Dn(e,t,[...n.statements],o,r);if(a.isIfStatement(n)){let s=me(e,t,"predicate",n.expression),l=Je(e,t,n.thenStatement,o,r),d=n.elseStatement?Je(e,t,n.elseStatement,o,r):o;return ie(t,s.id,l),ie(t,s.id,d),s.id}if(a.isWhileStatement(n)){let s=me(e,t,"predicate",n.expression),l=Je(e,t,n.statement,s.id,{breakTarget:o,continueTarget:s.id});return ie(t,s.id,l),ie(t,s.id,o),s.id}if(a.isDoStatement(n)){let s=me(e,t,"predicate",n.expression),l=Je(e,t,n.statement,s.id,{breakTarget:o,continueTarget:s.id});return ie(t,s.id,l),ie(t,s.id,o),l}if(a.isForStatement(n)){let s=me(e,t,"predicate",n.condition??n),l=n.incrementor?me(e,t,"statement",n.incrementor):null;l&&ie(t,l.id,s.id);let d=l?.id??s.id,c=Je(e,t,n.statement,d,{breakTarget:o,continueTarget:d});if(ie(t,s.id,c),n.condition&&ie(t,s.id,o),!n.initializer)return s.id;let u=me(e,t,"statement",n.initializer);return ie(t,u.id,s.id),u.id}if(a.isForInStatement(n)||a.isForOfStatement(n)){e.unsupported.add("for-in/for-of iterator assignment is conservatively represented without iterable element flow.");let s=me(e,t,"predicate",n.expression),l=me(e,t,"statement",n.initializer),d=Je(e,t,n.statement,s.id,{breakTarget:o,continueTarget:s.id});return ie(t,s.id,l.id),ie(t,s.id,o),ie(t,l.id,d),s.id}if(a.isSwitchStatement(n)){e.unsupported.add("switch fallthrough is represented conservatively; discriminant-to-case value refinement is unsupported.");let s=me(e,t,"predicate",n.expression),l=o,d=[];for(let c=n.caseBlock.clauses.length-1;c>=0;c-=1){let u=n.caseBlock.clauses[c];l=Dn(e,t,[...u.statements],l,{...r,breakTarget:o}),d.push(l)}for(let c of d)ie(t,s.id,c);return ie(t,s.id,o),s.id}if(a.isReturnStatement(n)||a.isThrowStatement(n)){let s=me(e,t,"statement",n),l=[...t.values()].find(d=>d.kind==="exit");return ie(t,s.id,l.id),s.id}if(a.isBreakStatement(n)){let s=me(e,t,"statement",n);return r.breakTarget||e.unsupported.add("A break statement could not be attached to a structured target."),ie(t,s.id,r.breakTarget??o),s.id}if(a.isContinueStatement(n)){let s=me(e,t,"statement",n);return r.continueTarget||e.unsupported.add("A continue statement could not be attached to a structured target."),ie(t,s.id,r.continueTarget??o),s.id}if(a.isTryStatement(n)){e.unsupported.add("Exceptional control-flow and finally completion are not included in the local compiler CFG.");let s=me(e,t,"statement",n);return s.invalidatesAllDefinitions=!0,ie(t,s.id,o),s.id}let i=me(e,t,"statement",n);return ie(t,i.id,o),i.id}function me(e,t,n,o){let r={id:`cfg:${e.nextCfgId++}`,kind:n,ast:o,successors:new Set,predecessors:new Set,definitions:[],uses:[],displayPoint:null,invalidatesAllDefinitions:!1};return t.set(r.id,r),r}function ie(e,t,n){e.get(t).successors.add(n),e.get(n).predecessors.add(t)}function es(e,t){let n=t.cfg.get(t.entryId);for(let o of t.node.parameters){let r=et(e,o.name);if(!r){e.unsupported.add("Destructured parameter definition-use is not implemented.");continue}n.definitions.push({point:tt(e,r.node,"parameter-definition",r.symbolKey,r.name,t.id),rhsUseIds:[]})}for(let o of t.cfg.values())!o.ast||o.kind==="entry"||o.kind==="exit"||(o.kind==="predicate"&&(o.displayPoint=tt(e,o.ast,"predicate",null,"predicate",t.id)),ts(e,t,o,o.ast),!o.displayPoint&&o.definitions.length===0&&o.uses.length===0&&(o.displayPoint=tt(e,o.ast,"statement",null,us(e,o.ast),t.id)))}function ts(e,t,n,o){let r=e.ts;if(r.isTryStatement(o))return;let a=i=>{if(!(i!==o&&r.isFunctionLike(i))){if(r.isVariableDeclaration(i)){let s=i.initializer?Ht(e,t.id,i.initializer,n):[];n.uses.push(...s);let l=et(e,i.name);l?n.definitions.push({point:tt(e,l.node,"definition",l.symbolKey,l.name,t.id),rhsUseIds:s.map(d=>d.point.id)}):(n.invalidatesAllDefinitions=!0,e.unsupported.add("Destructured variable reaching definitions are not implemented."));return}if(r.isBinaryExpression(i)&&yi(r,i.operatorToken.kind)){let s=Ht(e,t.id,i.right,n);i.operatorToken.kind!==r.SyntaxKind.EqualsToken&&s.push(...Ht(e,t.id,i.left,n)),n.uses.push(...s);let l=et(e,i.left);l?n.definitions.push({point:tt(e,l.node,"definition",l.symbolKey,l.name,t.id),rhsUseIds:s.map(d=>d.point.id)}):(n.invalidatesAllDefinitions=!0,e.unsupported.add("Dynamic or destructured assignment targets are not included in reaching definitions."));return}if((r.isPrefixUnaryExpression(i)||r.isPostfixUnaryExpression(i))&&(i.operator===r.SyntaxKind.PlusPlusToken||i.operator===r.SyntaxKind.MinusMinusToken)){let s=Ht(e,t.id,i.operand,n);n.uses.push(...s);let l=et(e,i.operand);l&&n.definitions.push({point:tt(e,l.node,"definition",l.symbolKey,l.name,t.id),rhsUseIds:s.map(d=>d.point.id)});return}if(!(r.isFunctionDeclaration(i)||r.isClassDeclaration(i)||r.isInterfaceDeclaration(i))){if(fi(e,i)){let s=gi(e,t.id,i);s&&n.uses.push(s),r.isPropertyAccessExpression(i)&&a(i.expression);return}i.forEachChild(a)}}};a(o),n.uses=hi(n.uses)}function Ht(e,t,n,o){let r=[],a=i=>{if(!e.ts.isFunctionLike(i)){if(e.ts.isBinaryExpression(i)&&yi(e.ts,i.operatorToken.kind)){o.invalidatesAllDefinitions=!0,e.unsupported.add("Nested assignment expressions are not included in ordered local definition-use flow."),i.operatorToken.kind!==e.ts.SyntaxKind.EqualsToken&&a(i.left),a(i.right);return}if(fi(e,i)){let s=gi(e,t,i);s&&r.push(s),e.ts.isPropertyAccessExpression(i)&&a(i.expression);return}i.forEachChild(a)}};return a(n),hi(r)}function fi(e,t){if(e.ts.isPropertyAccessExpression(t))return!0;if(!e.ts.isIdentifier(t))return!1;let n=t.parent;return!(e.ts.isPropertyAccessExpression(n)&&n.name===t||"name"in n&&n.name===t&&ns(e.ts,n)||e.ts.isPropertyAssignment(n)&&n.name===t||e.ts.isBindingElement(n)&&n.propertyName===t||e.ts.isLabeledStatement(n)||e.ts.isBreakOrContinueStatement(n)||os(e.ts,t))}function ns(e,t){return e.isVariableDeclaration(t)||e.isParameter(t)||e.isFunctionDeclaration(t)||e.isFunctionExpression(t)||e.isClassDeclaration(t)||e.isMethodDeclaration(t)||e.isPropertyDeclaration(t)||e.isInterfaceDeclaration(t)||e.isTypeAliasDeclaration(t)||e.isImportSpecifier(t)||e.isImportClause(t)||e.isNamespaceImport(t)}function os(e,t){for(let n=t.parent;n;n=n.parent){if(e.isExpression(n)||e.isStatement(n)||e.isSourceFile(n))return!1;if(e.isTypeNode(n))return!0}return!1}function gi(e,t,n){let o=et(e,n);return o?{point:tt(e,o.node,"use",o.symbolKey,o.name,t),property:e.ts.isPropertyAccessExpression(n)}:null}function et(e,t){let n=e.ts;if(n.isIdentifier(t)){let o=ui(e,t);return o?{node:t,symbolKey:o,name:t.text}:null}if(n.isPropertyAccessExpression(t)){let o=ui(e,t.name);return o?{node:t,symbolKey:o,name:t.getText(e.sourceFile)}:null}return n.isParenthesizedExpression(t)||n.isAsExpression(t)||n.isTypeAssertionExpression(t)||n.isNonNullExpression(t)?et(e,t.expression):((n.isArrayLiteralExpression(t)||n.isObjectLiteralExpression(t))&&e.unsupported.add("Heap aggregate identity and destructured assignment are not included in local points-to flow."),null)}function ui(e,t){let n=e.checker.getSymbolAtLocation(t);if(!n)return null;if((n.flags&e.ts.SymbolFlags.Alias)!==0)try{n=e.checker.getAliasedSymbol(n)}catch{}let o=n.valueDeclaration??n.declarations?.[0];return o?`symbol:${encodeURIComponent(o.getSourceFile().fileName)}:${o.getStart()}:${n.getName()}`:`symbol:${n.getName()}`}function tt(e,t,n,o,r,a){let i=t.getStart(e.sourceFile),s=t.getEnd(),l=e.sourceFile.getLineAndCharacterOfPosition(i),d=`flow-point:${encodeURIComponent(e.sourceFile.fileName)}:${i}:${s}:${n}:${encodeURIComponent(o??r)}`,c=e.points.get(d);if(c)return c;let u={id:d,kind:n,name:r,symbolKey:o,callableId:a,start:i,end:s,line:l.line,column:l.character,node:t};return e.points.set(d,u),u}function is(e,t){let n=[...t.cfg.values()].flatMap(l=>l.definitions),o=new Map(n.map(l=>[l.point.id,l])),r=rs(n),a=new Map,i=new Map;for(let l of t.cfg.values())a.set(l.id,new Set),i.set(l.id,new Set);let s=!0;for(;s;){s=!1;for(let l of t.cfg.values()){let d=ms([...l.predecessors].map(f=>i.get(f))),c=new Set(d);l.invalidatesAllDefinitions&&c.clear();let u=as(l.definitions);for(let f of u){for(let p of r.get(f.point.symbolKey)??[])c.delete(p.point.id);c.add(f.point.id)}_n(a.get(l.id),d)||(a.set(l.id,d),s=!0),_n(i.get(l.id),c)||(i.set(l.id,c),s=!0)}}for(let l of t.cfg.values()){let d=a.get(l.id);for(let c of l.uses){let u=l.definitions.filter(p=>p.point.symbolKey===c.point.symbolKey&&p.point.start<c.point.start&&!p.rhsUseIds.includes(c.point.id)).sort((p,m)=>m.point.start-p.point.start)[0],f=u?[u.point.id]:d;for(let p of f){let m=o.get(p);m.point.symbolKey===c.point.symbolKey&&xt(e,"reaching-definition",m.point.id,c.point.id,"exact","A CFG path reaches this use without an intervening definition.")}}for(let c of l.definitions)for(let u of c.rhsUseIds)xt(e,"value-source",u,c.point.id,"exact","This right-hand-side use supplies the new definition.")}}function rs(e){let t=new Map;for(let n of e){if(!n.point.symbolKey)continue;let o=t.get(n.point.symbolKey)??[];o.push(n),t.set(n.point.symbolKey,o)}return t}function as(e){let t=new Map;for(let n of e)n.point.symbolKey&&t.set(n.point.symbolKey,n);return[...t.values()]}function ss(e,t){let n=ls(t);for(let o of t.cfg.values()){if(o.successors.size<2||!o.displayPoint)continue;let r=n.get(o.id);for(let a of o.successors)for(let i of n.get(a)??[]){if(r.has(i)||i===t.exitId)continue;let s=t.cfg.get(i),l=[...s.definitions.map(d=>d.point),...s.uses.map(d=>d.point),...s.displayPoint?[s.displayPoint]:[]];for(let d of ps(l))xt(e,"control-dependence",o.displayPoint.id,d.id,"exact","The target postdominates a branch successor but does not postdominate the predicate.")}}}function ls(e){let t=[...e.cfg.keys()],n=new Set(t),o=new Map;for(let a of t)o.set(a,a===e.exitId?new Set([a]):new Set(n));let r=!0;for(;r;){r=!1;for(let a of e.cfg.values()){if(a.id===e.exitId)continue;let i=[...a.successors].map(l=>o.get(l)),s=new Set([a.id,...fs(i)]);_n(o.get(a.id),s)||(o.set(a.id,s),r=!0)}}return o}function cs(e,t){let n=new Map(t.map(i=>[i.id,i.parentId])),o=t.flatMap(i=>[...i.cfg.values()].flatMap(s=>s.definitions.map(l=>l.point))),r=new Map;for(let i of o){if(!i.symbolKey)continue;let s=r.get(i.symbolKey)??[];s.push(i),r.set(i.symbolKey,s)}let a=new Set([...e.edges.values()].filter(i=>i.kind==="reaching-definition").map(i=>i.toPointId));for(let i of t)for(let s of[...i.cfg.values()].flatMap(l=>l.uses)){if(!s.point.symbolKey||a.has(s.point.id))continue;let l=r.get(s.point.symbolKey)??[];for(let d of l)ds(d.callableId,s.point.callableId,n)?xt(e,"closure-capture",d.id,s.point.id,"candidate","Compiler identity proves the captured binding, but invocation order can select among outer definitions."):s.property&&xt(e,"field-definition-to-use",d.id,s.point.id,"candidate","Compiler identity matches the field; cross-callable receiver and execution order remain unresolved.")}[...e.edges.values()].some(i=>i.kind==="closure-capture")&&e.unsupported.add("Closure capture identity is known, but invocation order and intervening writes remain candidate flow."),[...e.edges.values()].some(i=>i.kind==="field-definition-to-use")&&e.unsupported.add("Cross-callable field flow lacks receiver points-to and invocation-order analysis.")}function ds(e,t,n){for(let o=n.get(t)??null;o;o=n.get(o)??null)if(o===e)return!0;return!1}function xt(e,t,n,o,r,a){let i=`local-flow-edge:${t}:${encodeURIComponent(n)}:${encodeURIComponent(o)}`;e.edges.set(i,{id:i,kind:t,fromPointId:n,toPointId:o,strength:r,reason:a})}function yi(e,t){return t>=e.SyntaxKind.FirstAssignment&&t<=e.SyntaxKind.LastAssignment}function us(e,t){let n=t.getText(e.sourceFile).replace(/\s+/gu," ").trim();return n.length>80?`${n.slice(0,77)}...`:n||e.ts.SyntaxKind[t.kind]||"statement"}function hi(e){return[...new Map(e.map(t=>[t.point.id,t])).values()]}function ps(e){return[...new Map(e.map(t=>[t.id,t])).values()]}function ms(e){return new Set(e.flatMap(t=>[...t]))}function fs(e){return e.length===0?new Set:new Set([...e[0]].filter(t=>e.slice(1).every(n=>n.has(t))))}function _n(e,t){return e.size===t.size&&[...e].every(n=>t.has(n))}function gs(e,t){return e.start-t.start||e.kind.localeCompare(t.kind)||e.id.localeCompare(t.id)}function $n(e){return{points:[],edges:[],coverage:{status:"unsupported",basis:"typescript-compiler-cfg-reaching-definitions",unsupported:[e]}}}var hs=po("typescript-local-flow",{clearGroups:["whole-project","source-file","semantic-provider"]});function Bn(e,t,n,o){if(!yo(t))return null;let r=`${t}\0${n}\0${o}`;return hs.get(e,r,()=>{let a=Ft(e,t);return a?pi(a,ys(e.config.projectRoot,t),{startLine:n,endLine:o}):{points:[],edges:[],coverage:{status:"unsupported",basis:"typescript-compiler-cfg-reaching-definitions",unsupported:[`Current source is unavailable for ${t}.`]}}})}function bs(e,t=new Map){let n=new Map,o=new Map,r=[];for(let a of e.transfers){if(!e.caller)continue;let i=Vt(e.caller,a.callerPosition),s=Vt(e.callee,a.calleePosition);Et(n,i),Et(n,s),Gn(o,e.caller,i),Gn(o,e.callee,s);let l=Se("edge","data-transfer",a.proof.file,String(a.proof.startLine),String(a.callerPosition),String(a.calleePosition));o.set(l,{id:l,kind:"data-transfer",fromNodeId:i.id,toNodeId:s.id,directed:!0,disposition:"folded",semantics:[{family:"data",subtype:"argument-to-parameter",attributes:{argumentText:a.argumentText,callerPosition:a.callerPosition,calleePosition:a.calleePosition}}],evidence:[{method:"compiler-callsite-direct-parameter-transfer",strength:"exact",identity:`${e.caller.symbol}:${a.callerPosition} -> ${e.callee.symbol}:${a.calleePosition}`,location:{file:a.proof.file,line:a.proof.startLine,endLine:a.proof.endLine}}]})}return e.unknown.forEach((a,i)=>{let s=Vt(e.callee,a.calleePosition);Et(n,s),Gn(o,e.callee,s);let l=t.get(a.calleePosition);if(l&&Ms(l)){Rs(o,n,e,a.calleePosition,a.argumentText,l);return}let d=ws(e,a.calleePosition,a.argumentText);Et(n,d);let c=Se("edge","data-transfer-unsupported",a.proof.file,String(a.proof.startLine),String(a.calleePosition),String(i));o.set(c,{id:c,kind:"data-transfer",fromNodeId:d.id,toNodeId:s.id,directed:!0,disposition:"unsupported",semantics:[{family:"data",subtype:"argument-to-parameter",attributes:{argumentText:a.argumentText,calleePosition:a.calleePosition}}],evidence:[{method:"compiler-callsite-argument-expression",strength:"exact",identity:a.argumentText,location:{file:a.proof.file,line:a.proof.startLine,endLine:a.proof.endLine}}]}),r.push({id:Se("frontier","data-transfer",c),kind:"data-transfer",direction:"unresolved",fromNodeIds:[d.id],edgeIds:[c],memberNodeIds:[s.id],memberCount:1,disposition:"unsupported",reason:l?.derivation.rule??a.reason,expansion:null})}),{nodes:[...n.values()],edges:[...o.values()],frontiers:r,blindSpots:[]}}function Si(e,t,n=[]){let o=vi(),r=new Map,a=new Set;for(let i of t){if(i.kind!=="call"||!i.fromSymbol||!i.toSymbol||i.line===null)continue;let s=Is(r,e,i.toFile,i.toSymbol);if(!s)continue;let l=Eo(e,s),d=l.sites.filter(h=>h.file===i.fromFile&&h.startLine<=i.line&&h.endLine>=i.line&&h.caller?.symbol===i.fromSymbol);if(d.length!==1){let h=l.unresolved.find(y=>y.file===i.fromFile&&y.line===i.line);h&&o.blindSpots.push(`Parameter flow unresolved at ${i.fromFile}:${i.line+1}: ${h.reason}.`);continue}let c=d[0],u=`${c.file}\0${c.callNode.startIndex}\0${c.callNode.endIndex}\0${s.symbol}`;if(a.has(u))continue;a.add(u);let f=Lo(e,c),p=ae(e,c.file)?.rootNode,m=new Map;if(p)for(let h of f.unknown){let y=vo({db:e,file:c.file,root:p},c.arguments[h.calleePosition]);y&&m.set(h.calleePosition,y)}bi(o,bs(f,m)),f.caller&&Ls(c.callNode)&&Cs(o,f,c.callNode)}for(let i of n){if(!i.location||!["source-construct","symbol"].includes(i.kind))continue;let s=i.location.endLine??i.location.line,l=Bn(e,i.location.file,i.location.line,s);if(l){bi(o,Ss(i,l.points,l.edges));for(let d of l.coverage.unsupported)o.blindSpots.push(`TypeScript local flow is partial for ${i.location.file}:${i.location.line+1}-${s+1}: ${d} Recover with: scip-query inspect --at '${i.location.file}:${i.location.line+1}-${s+1}' --view behavior.`)}}return o.blindSpots=[...new Set(o.blindSpots)].sort(),o}function Ss(e,t,n){let o=vi(),r=new Map,a=new Map,i=new Map,s=e.location.file;for(let l of t){let d=vs(e,s,l);i.set(l.id,d.id),r.set(d.id,d),xs(a,e,d)}for(let l of n){let d=i.get(l.fromPointId),c=i.get(l.toPointId);if(!d||!c)continue;let u=Es(l),f=Se("edge","typescript-local-flow",s,l.id);a.set(f,{id:f,kind:l.kind==="control-dependence"?"control-dependence":"data-transfer",fromNodeId:d,toNodeId:c,directed:!0,disposition:"folded",semantics:[u],evidence:[{method:"typescript-compiler-cfg-reaching-definitions",strength:l.strength,identity:l.reason,location:r.get(d)?.location??e.location}]})}return o.nodes=[...r.values()],o.edges=[...a.values()],o}function vs(e,t,n){return{id:Se("local-flow-point",t,String(n.start),String(n.end),n.kind,n.symbolKey??n.name),kind:n.kind==="parameter-definition"||n.kind==="definition"?"local-definition":n.kind==="use"?"local-use":n.kind==="predicate"?"control-predicate":"local-statement",label:n.name,disposition:"folded",location:{file:t,line:n.line,endLine:n.line},anchorIds:[],attributes:{ownerNodeId:e.id,pointKind:n.kind,callableId:n.callableId,symbolKey:n.symbolKey,column:n.column}}}function xs(e,t,n){let o=Se("edge","local-flow-owner",t.id,n.id);e.has(o)||e.set(o,{id:o,kind:"local-flow-owner",fromNodeId:t.id,toNodeId:n.id,directed:!0,disposition:"folded",semantics:[{family:"identity",subtype:"contains"}],evidence:[{method:"typescript-compiler-local-flow-owner",strength:"exact",identity:t.id,location:n.location}]})}function Es(e){switch(e.kind){case"reaching-definition":return{family:"data",subtype:"definition-to-use"};case"value-source":return{family:"data",subtype:"value-to-definition"};case"closure-capture":return{family:"data",subtype:"closure-capture"};case"field-definition-to-use":return{family:"data",subtype:"field-definition-to-use"};case"control-dependence":return{family:"control",subtype:"control-dependence"}}}function Ls(e){let t=e;for(;t.parent&&["await_expression","yield_expression","parenthesized_expression","as_expression","type_assertion"].includes(t.parent.type);)t=t.parent;return t.parent!==null&&t.parent.type!=="expression_statement"}function Cs(e,t,n){if(!t.caller)return;let o={id:Se("call-result",t.call.file,String(n.startIndex),String(n.endIndex),t.callee.symbol),kind:"call-result",label:`result of ${t.callee.leaf}`,disposition:"folded",location:{file:t.call.file,line:t.call.startLine,endLine:t.call.endLine},anchorIds:[],attributes:{calleeSymbol:t.callee.symbol,callerSymbol:t.caller.symbol}},r=Se("edge","return-to-call-result",t.callee.symbol,o.id),a=Se("edge","call-result-owner",t.caller.symbol,o.id);e.nodes.push(o),e.edges.push({id:r,kind:"data-transfer",fromNodeId:jn(t.callee.symbol),toNodeId:o.id,directed:!0,disposition:"folded",semantics:[{family:"data",subtype:"return-to-call-result"}],evidence:[{method:"compiler-callsite-used-result",strength:"exact",identity:`${t.callee.symbol} -> ${t.caller.symbol}`,location:o.location}]},{id:a,kind:"call-result-owner",fromNodeId:jn(t.caller.symbol),toNodeId:o.id,directed:!0,disposition:"folded",semantics:[{family:"identity",subtype:"contains-call-result"}],evidence:[{method:"compiler-call-result-owner",strength:"exact",identity:t.caller.symbol,location:o.location}]})}function vi(){return{nodes:[],edges:[],frontiers:[],blindSpots:[]}}function bi(e,t){On(e.nodes,t.nodes),On(e.edges,t.edges),On(e.frontiers,t.frontiers),e.blindSpots.push(...t.blindSpots)}function On(e,t){let n=new Set(e.map(o=>o.id));for(let o of t)n.has(o.id)||(n.add(o.id),e.push(o))}function Is(e,t,n,o){let r=`${n}\0${o}`,a=e.get(r);if(a!==void 0)return a;let i=le(t,n).find(s=>s.symbol===o)??null;return e.set(r,i),i}function Vt(e,t){return{id:Ps(e.symbol,t),kind:"parameter",label:`${e.leaf} parameter ${t}`,disposition:"folded",location:{file:e.relativePath,line:e.startLine,endLine:e.endLine},anchorIds:[],attributes:{ownerSymbol:e.symbol,position:t}}}function ws(e,t,n){return{id:Se("argument-expression",e.call.file,String(e.call.startLine),String(e.call.endLine),String(t)),kind:"argument-expression",label:n,disposition:"unsupported",location:{file:e.call.file,line:e.call.startLine,endLine:e.call.endLine},anchorIds:[],attributes:{calleeSymbol:e.callee.symbol,position:t}}}function Ns(e,t,n){return{id:Se("static-value",e.call.file,String(e.call.startLine),String(e.call.endLine),String(t)),kind:"static-value",label:n.value,disposition:"folded",location:{file:e.call.file,line:e.call.startLine,endLine:e.call.endLine},anchorIds:[],attributes:{value:n.value,precision:n.precision,evidence:n.evidence,termKind:n.term.kind,derivationRule:n.derivation.rule}}}function Rs(e,t,n,o,r,a){let i=Ns(n,o,a),s=Vt(n.callee,o);Et(t,i);let l=Se("edge","static-value-transfer",n.call.file,String(n.call.startLine),String(o));e.set(l,{id:l,kind:"data-transfer",fromNodeId:i.id,toNodeId:s.id,directed:!0,disposition:"folded",semantics:[{family:"data",subtype:Ts(a),attributes:{argumentText:r,calleePosition:o,value:a.value,precision:a.precision,derivationRule:a.derivation.rule}}],evidence:Fs(a,n)})}function Ms(e){return e.derivation.kind!=="heuristic"&&e.precision!=="symbolic"&&e.precision!=="unknown"}function Ts(e){return e.derivation.rule==="bounded-call-return"?"return-to-parameter":e.derivation.rule==="member-constant"||e.term.kind==="property"?"property-to-parameter":"constant-to-parameter"}function Fs(e,t){return(e.derivation.sourceSpans.length>0?e.derivation.sourceSpans:[t.call]).map(o=>({method:`static-value:${e.derivation.rule}`,strength:e.derivation.kind==="direct"?"exact":"derived",identity:e.derivation.inputFactIds.join(",")||e.value,location:{file:o.file,line:o.startLine,endLine:o.endLine}}))}function Et(e,t){e.has(t.id)||e.set(t.id,t)}function Gn(e,t,n){let o=Se("edge","parameter-owner",t.symbol,n.id);e.has(o)||e.set(o,{id:o,kind:"parameter-owner",fromNodeId:jn(t.symbol),toNodeId:n.id,directed:!0,disposition:"folded",semantics:[{family:"identity",subtype:"contains"}],evidence:[{method:"compiler-parameter-owner",strength:"exact",identity:t.symbol,location:{file:t.relativePath,line:t.startLine,endLine:t.endLine}}]})}function Ps(e,t){return Se("parameter",e,String(t))}function jn(e){return Se("symbol",e)}function Se(...e){return e.map(t=>encodeURIComponent(t)).join(":")}function xi(e,t){let n=new Map,o=new Map,r=new Map,a=new Set;for(let i of t){if(!i.location||!["source-construct","symbol"].includes(i.kind))continue;let s=i.location.endLine??i.location.line,l=Io(e,i.location.file,i.location.line,s);if(!l){a.add(`Control dependence unavailable for ${i.location.file}:${i.location.line+1}-${s+1}: no supported syntax tree or covering construct.`);continue}for(let d of l.facts){let c=Kn(i,d.controller),u=Kn(i,d.outcome);n.set(c.id,c),n.set(u.id,u),As(o,i,c);let f=nt("edge","control-dependence",c.id,u.id,d.subtype);o.set(f,{id:f,kind:"control-dependence",fromNodeId:c.id,toNodeId:u.id,directed:!0,disposition:"folded",semantics:[{family:"control",subtype:d.subtype,attributes:{...d.attributes}}],evidence:[{method:"parser-control-dependence",strength:"exact",identity:`${i.location.file}:${d.controller.startLine+1}-${d.outcome.startLine+1}`,location:{file:i.location.file,line:d.controller.startLine,endLine:d.controller.endLine}}]})}for(let d of l.terminals){let c=Kn(i,d);n.set(c.id,c);let u=d.label.startsWith("throw")||d.label.startsWith("raise")?"throw":"return",f=nt("edge","control-terminal",i.id,c.id,u);o.set(f,{id:f,kind:"control-terminal",fromNodeId:i.id,toNodeId:c.id,directed:!0,disposition:"folded",semantics:[{family:"control",subtype:u==="throw"?"throws":"returns"}],evidence:[{method:"parser-terminal-statement",strength:"exact",identity:d.label,location:{file:i.location.file,line:d.startLine,endLine:d.endLine}}]})}for(let d of l.unsupported){let c=nt("control-unsupported",i.location.file,String(d.startLine),String(d.endLine),d.reason);n.set(c,{id:c,kind:"control-unsupported",label:d.reason,disposition:"unsupported",location:{file:i.location.file,line:d.startLine,endLine:d.endLine},anchorIds:[],attributes:{ownerNodeId:i.id}});let u=nt("edge","control-unsupported",i.id,c);o.set(u,{id:u,kind:"control-dependence",fromNodeId:i.id,toNodeId:c,directed:!0,disposition:"unsupported",semantics:[{family:"control",subtype:"unresolved-control-construct"}],evidence:[{method:"parser-control-construct",strength:"exact",identity:d.reason,location:{file:i.location.file,line:d.startLine,endLine:d.endLine}}]});let f=nt("frontier","control-dependence",c);r.set(f,{id:f,kind:"control-dependence",direction:"unresolved",fromNodeIds:[i.id],edgeIds:[u],memberNodeIds:[c],memberCount:1,disposition:"unsupported",reason:d.reason,expansion:null})}}return{nodes:[...n.values()],edges:[...o.values()],frontiers:[...r.values()],blindSpots:[...a].sort()}}function Kn(e,t){let n=e.location.file;return{id:nt(`control-${t.kind}`,n,String(t.startLine),String(t.endLine),t.label),kind:`control-${t.kind}`,label:t.label,disposition:"folded",location:{file:n,line:t.startLine,endLine:t.endLine},anchorIds:[],attributes:{ownerNodeId:e.id,constructKind:t.kind,implicit:t.implicit}}}function As(e,t,n){let o=nt("edge","control-owner",t.id,n.id);e.has(o)||e.set(o,{id:o,kind:"control-owner",fromNodeId:t.id,toNodeId:n.id,directed:!0,disposition:"folded",semantics:[{family:"identity",subtype:"contains-control"}],evidence:[{method:"parser-control-owner",strength:"exact",identity:t.id,location:t.location}]})}function nt(...e){return e.map(t=>encodeURIComponent(t)).join(":")}var Yt=new Set(["arrow_function","constructor_declaration","function_declaration","function_definition","function_expression","generator_function","generator_function_declaration","function_item","lambda","lambda_expression","method","method_declaration","method_definition"]),Ct=new Set(["block","body","compound_statement","declaration_list","statement_block"]),ks=new Set(["assignment","assignment_expression","augmented_assignment_expression"]),zn=new Set(["update_expression"]),Ii=new Set(["array_access","element_access_expression","subscript_expression"]),wi=new Set(["attribute","field_access","field_expression","member_access_expression","member_expression","selector_expression"]),$s=new Set(["false","null","null_literal","number","number_literal","string","string_literal","template_string","true"]),Ds=new Set(["call_expression","method_invocation","object_creation_expression"]),_s=new Set(["comment","else_clause","formal_parameters","parameters","type_parameters"]);function Ni(e,t,n,o){let r=ae(e,t);if(!r)return null;let a=Us(r.rootNode,n,o);if(!a)return null;let i=[],s=[],l=[];return ot(a,d=>{if(ks.has(d.type)||zn.has(d.type)||Mi(d)){let c=Bs(d);c?i.push(c):l.push({family:"state",startLine:d.startPosition.row,endLine:d.endPosition.row,reason:`Mutation target ${Be(d.text)} could not be resolved to an exact source resource.`})}}),ot(a,d=>{if(!Ct.has(d.type))return;let c=qs(d);for(let u=0;u<c.length-1;u+=1)s.push({from:Lt(c[u]),to:Lt(c[u+1]),subtype:"lexical-successor",synchronizationScope:null,attributes:{sameScope:!0,executionConditional:!0}});for(let u=0;u<c.length;u+=1){let f=c[u],p=Hs(f).filter(m=>m.type==="await_expression");for(let m of p){let h=It("event",`await ${Be(m.text.replace(/^await\s+/u,""))}`,m);s.push({from:Lt(f),to:h,subtype:"awaits-completion",synchronizationScope:null,attributes:{completionRequired:!0}});let y=c[u+1];y&&s.push({from:h,to:Lt(y),subtype:"await-completion-before",synchronizationScope:null,attributes:{continuationOnly:!0}})}}}),ot(a,d=>{if(d.type!=="synchronized_statement")return;let c=d.childForFieldName("object")??d.childForFieldName("condition")??d.namedChildren.find(h=>!Ct.has(h.type)),u=d.childForFieldName("body")??d.namedChildren.find(h=>Ct.has(h.type));if(!c||!u){l.push({family:"temporal",startLine:d.startPosition.row,endLine:d.endPosition.row,reason:"Synchronized scope has no structurally resolved monitor or body."});return}let f=Be(c.text).replace(/^\(|\)$/gu,""),p=It("lock",f,c),m=Ws(u).filter(h=>h.parent!==null&&Ti(h));for(let h of zs(m))s.push({from:p,to:Lt(h),subtype:"inside-lock-scope",synchronizationScope:f,attributes:{syntaxNative:!0}})}),{mutations:i,temporal:s,unsupported:l}}function Bs(e){let t=Mi(e),n=e.childForFieldName("left")??e.childForFieldName("argument")??(t?e.namedChildren.at(-1)??null:e.namedChildren[0]??null);if(!n)return null;let o=Os(n);if(!o)return null;let r=t?"delete":zn.has(e.type)||!Ks(e,n).startsWith("=")?"update":"assign",a=t||zn.has(e.type)?null:e.childForFieldName("right");return{event:It("event",Be(e.text),e),resource:{kind:"resource",label:o.name,startLine:n.startPosition.row,endLine:n.endPosition.row},operation:r,durabilityClass:"in-memory",recordIdentity:o.recordIdentity,value:a?It("value",Be(a.text),a):null,dataSubtype:a?Gs(a,e):null}}function Os(e){if(Ii.has(e.type)){let t=e.childForFieldName("object")??e.childForFieldName("array")??e.namedChildren[0]??null,n=e.childForFieldName("index")??e.childForFieldName("subscript")??e.namedChildren[1]??null;return!t||!n?null:{name:`${Be(t.text)}[]`,recordIdentity:Be(n.text)}}return wi.has(e.type)?{name:Be(e.text),recordIdentity:null}:/^(?:identifier|property_identifier|field_identifier)$/u.test(e.type)?{name:Be(e.text),recordIdentity:null}:null}function Gs(e,t){return $s.has(e.type)||/(?:integer|float|decimal|boolean|character)_literal$/u.test(e.type)?"constant-to-state":Ds.has(e.type)?"return-to-state":wi.has(e.type)||Ii.has(e.type)?"property-to-state":/identifier$/u.test(e.type)?js(e.text,t)?"captured-value-to-state":"value-to-state":"expression-to-state"}function js(e,t){let n=qn(t.parent);if(!n||Ei(n,e))return!1;let o=qn(n.parent);for(;o;){if(Ei(o,e))return!0;o=qn(o.parent)}return!1}function qn(e){let t=e;for(;t;){if(Yt.has(t.type))return t;t=t.parent}return null}function Ei(e,t){let n=e.childForFieldName("parameters")??e.namedChildren.find(a=>["formal_parameters","parameters"].includes(a.type));if(n&&Li(n,t))return!0;let o=e.childForFieldName("body")??e.namedChildren.find(a=>Ct.has(a.type));if(!o)return!1;let r=!1;return Ri(o,e,a=>{if(r||!/(?:declarator|declaration|parameter)$/u.test(a.type))return;let i=a.childForFieldName("name")??a.childForFieldName("pattern")??a.namedChildren[0];i&&Li(i,t)&&(r=!0)}),r}function Li(e,t){let n=!1;return ot(e,o=>{/identifier$/u.test(o.type)&&o.text===t&&(n=!0)}),n}function Ri(e,t,n){n(e);for(let o of e.namedChildren)o!==t&&Yt.has(o.type)||Ri(o,t,n)}function Ks(e,t){let n=e.childForFieldName("right"),o=Math.max(0,t.endIndex-e.startIndex),r=n?Math.max(o,n.startIndex-e.startIndex):e.text.length;return e.text.slice(o,r).trim()}function Mi(e){return(e.type==="delete_expression"||e.type==="unary_expression")&&/^delete\b/u.test(e.text.trim())}function qs(e){return e.namedChildren.filter(t=>Ti(t))}function Ti(e){return _s.has(e.type)||Ct.has(e.type)?!1:/(?:statement|declaration)$/u.test(e.type)||e.type==="expression_statement"||e.type==="local_variable_declaration"}function zs(e){let t=new Set(e);return e.filter(n=>{let o=n.parent;for(;o;){if(t.has(o))return!1;o=o.parent}return!0})}function Lt(e){return It("event",Be(e.text),e)}function It(e,t,n){return{kind:e,label:t,startLine:n.startPosition.row,endLine:n.endPosition.row}}function Us(e,t,n){let o=[];return ot(e,a=>{a.startPosition.row<=t&&a.endPosition.row>=n&&o.push(a)}),o.filter(a=>Yt.has(a.type)).sort(Ci)[0]??o.sort(Ci)[0]??null}function Ci(e,t){return e.endIndex-e.startIndex-(t.endIndex-t.startIndex)||e.startIndex-t.startIndex}function Ws(e){let t=[];return ot(e,n=>t.push(n)),t}function Hs(e){let t=[],n=o=>{t.push(o);for(let r of o.namedChildren)r!==e&&Yt.has(r.type)||n(r)};return n(e),t}function ot(e,t){t(e);for(let n of e.namedChildren)ot(n,t)}function Be(e){return e.trim().replace(/\s+/gu," ")}function Ai(e,t,n=[]){let o=new Map,r=new Map,a=new Map,i=new Set;for(let s of t){if(!s.location||!["source-construct","symbol"].includes(s.kind))continue;let l=s.location.endLine??s.location.line,d=Ni(e,s.location.file,s.location.line,l);if(!d){i.add(`State and temporal analysis unavailable for ${s.location.file}:${s.location.line+1}-${l+1}: no supported syntax tree or covering construct.`);continue}for(let c of d.mutations){let u=Xt(s,c.event),f=Js(s,c.resource,c.durabilityClass);if(o.set(u.id,u),o.set(f.id,f),Zt(r,s,u,"contains-state-effect"),Jt(r,{kind:"state-resource",from:u,to:f,semantics:[{family:"state",subtype:c.operation==="delete"?"deletes-resource":"writes-resource",attributes:{operation:c.operation,durabilityClass:c.durabilityClass,resource:c.resource.label,recordIdentity:c.recordIdentity,transactionMembership:"unknown"}}],method:"parser-state-mutation",identity:c.event.label}),c.value&&c.dataSubtype){let p=Xt(s,c.value);o.set(p.id,p),Jt(r,{kind:"data-to-state",from:p,to:f,semantics:[{family:"data",subtype:c.dataSubtype,attributes:{operation:c.operation,resource:c.resource.label,recordIdentity:c.recordIdentity,value:c.value.label}}],method:"parser-assignment-value",identity:`${c.value.label} -> ${c.resource.label}`})}}for(let c of d.temporal){let u=Xt(s,c.from),f=Xt(s,c.to);o.set(u.id,u),o.set(f.id,f),Zt(r,s,u,c.from.kind==="lock"?"contains-lock-scope":"contains-event"),Zt(r,s,f,"contains-event"),Jt(r,{kind:"temporal-order",from:u,to:f,semantics:[{family:"temporal",subtype:c.subtype,context:c.synchronizationScope?{synchronizationScope:c.synchronizationScope}:void 0,attributes:{...c.attributes}}],method:c.subtype==="inside-lock-scope"?"parser-synchronized-scope":"parser-program-order",identity:`${c.from.label} -> ${c.to.label}`})}for(let c of d.unsupported){let u=ze(`${c.family}-unsupported`,s.location.file,String(c.startLine),String(c.endLine),c.reason);o.set(u,{id:u,kind:`${c.family}-unsupported`,label:c.reason,disposition:"unsupported",location:{file:s.location.file,line:c.startLine,endLine:c.endLine},anchorIds:[],attributes:{ownerNodeId:s.id}});let f=ze("edge",`${c.family}-unsupported`,s.id,u);r.set(f,{id:f,kind:`${c.family}-unsupported`,fromNodeId:s.id,toNodeId:u,directed:!0,disposition:"unsupported",semantics:[{family:c.family,subtype:`unresolved-${c.family}-construct`}],evidence:[{method:`parser-${c.family}-construct`,strength:"exact",identity:c.reason,location:{file:s.location.file,line:c.startLine,endLine:c.endLine}}]});let p=ze("frontier",c.family,u);a.set(p,{id:p,kind:c.family,direction:"unresolved",fromNodeIds:[s.id],edgeIds:[f],memberNodeIds:[u],memberCount:1,disposition:"unsupported",reason:c.reason,expansion:null})}}for(let s of t.filter(l=>l.kind==="runtime-boundary-participant")){let l=Qt(s,"protocol"),d=Qt(s,"action"),c=Qt(s,"address")??s.label;!l||!d||!Pi(l,d)||Fi(o,r,s,{observationId:s.id,action:d,strength:"exact",file:s.location?.file??"",line:s.location?.line??0,address:c,protocol:l,role:Qt(s,"role")??void 0,resolution:"locally-linked"})}for(let s of n){if(!s.protocol||!Pi(s.protocol,s.action))continue;let l=Xs(t,s.file,s.line,s.ownerShortName??null);if(!l){i.add(`State observation ${s.observationId} at ${s.file}:${s.line+1} has no materialized owner node.`);continue}Fi(o,r,l,s)}return{nodes:[...o.values()],edges:[...r.values()],frontiers:[...a.values()],blindSpots:[...i].sort()}}function Fi(e,t,n,o){let r=Ys(o),i={id:ze("runtime-state-event",o.observationId),kind:"runtime-state-event",label:`${o.action} ${r}`,disposition:"folded",location:{file:o.file,line:o.line},anchorIds:[],attributes:{action:o.action,protocol:o.protocol??null,modality:o.modality??null,resolution:o.resolution??null}},s=o.protocol==="database"?"external-durable-intent":"external",l={id:ze("runtime-state-resource",o.protocol??"unknown",r),kind:"runtime-state-resource",label:r,disposition:"folded",location:{file:o.file,line:o.line},anchorIds:[],attributes:{protocol:o.protocol??null,durabilityClass:s}};e.set(i.id,i),e.set(l.id,l),Zt(t,n,i,"contains-runtime-state-effect");let d=Vs(o.action);Jt(t,{kind:"runtime-state-resource",from:i,to:l,semantics:[{family:"state",subtype:d,context:{crossesRuntimeBoundary:!0,protocol:o.protocol},attributes:{operation:o.action,durabilityClass:s,resource:r,recordIdentity:Qs(o),modality:o.modality??null,resolution:o.resolution??null,transactionMembership:"unknown",commitState:o.protocol==="database"?"unknown":null}}],method:`runtime-boundary-${o.strength}`,identity:o.observationId})}function Vs(e){return e==="database.read"?"reads-resource":e==="queue.send"?"enqueues-resource":e==="queue.consume"?"consumes-resource":"writes-resource"}function Ys(e){return(e.keyParts?.find(n=>["address","resource"].includes(n.name))?.value??e.address)||e.observationId}function Qs(e){return e.keyParts?.find(n=>/^(?:id|key|record)$/u.test(n.name))?.value??null}function Pi(e,t){return e==="database"&&["database.read","database.write"].includes(t)||e==="queue"&&["queue.consume","queue.send"].includes(t)}function Qt(e,t){let n=e.attributes[t];return typeof n=="string"?n:null}function Xs(e,t,n,o){let r=e.filter(i=>i.location?.file===t&&["source-construct","symbol"].includes(i.kind)),a=r.filter(i=>i.location.line<=n&&(i.location.endLine??i.location.line)>=n).sort(Zs)[0];if(a)return a;if(o){let i=r.find(s=>s.label===o||s.label.endsWith(`.${o}`)||s.label.includes(o));if(i)return i}return r.length===1?r[0]:null}function Zs(e,t){let n=(e.location?.endLine??e.location?.line??0)-(e.location?.line??0),o=(t.location?.endLine??t.location?.line??0)-(t.location?.line??0);return n-o}function Xt(e,t){let n=e.location.file;return{id:ze(`program-${t.kind}`,n,String(t.startLine),String(t.endLine),t.label),kind:`program-${t.kind}`,label:t.label,disposition:"folded",location:{file:n,line:t.startLine,endLine:t.endLine},anchorIds:[],attributes:{ownerNodeId:e.id,constructKind:t.kind}}}function Js(e,t,n){let o=e.location.file;return{id:ze("program-resource",o,e.id,t.label,n),kind:"program-resource",label:t.label,disposition:"folded",location:{file:o,line:t.startLine,endLine:t.endLine},anchorIds:[],attributes:{ownerNodeId:e.id,durabilityClass:n}}}function Zt(e,t,n,o){let r=ze("edge","program-owner",t.id,n.id,o);e.has(r)||e.set(r,{id:r,kind:"program-owner",fromNodeId:t.id,toNodeId:n.id,directed:!0,disposition:"folded",semantics:[{family:"identity",subtype:o}],evidence:[{method:"parser-program-owner",strength:"exact",identity:t.id,location:n.location}]})}function Jt(e,t){let n=ze("edge",t.kind,t.from.id,t.to.id,t.semantics[0].subtype);e.set(n,{id:n,kind:t.kind,fromNodeId:t.from.id,toNodeId:t.to.id,directed:!0,disposition:"folded",semantics:t.semantics,evidence:[{method:t.method,strength:"exact",identity:t.identity,location:t.from.location}]})}function ze(...e){return e.map(t=>encodeURIComponent(t)).join(":")}var el=new Set(["control","data","state","temporal"]),en=new Set(["contains-control","contains-event","contains-lock-scope","contains-state-effect","contains-runtime-state-effect","contains","owns-parameter","owns-runtime-observation"]),_i=new Set(["discriminator-dispatch","result-callback","returns","runtime-handoff","throws"]);function Bi(e,t={}){let n=new Map(e.nodes.map(E=>[E.id,E])),o=sl(e.nodes,t.focusLocations),r=ll(e.edges,t.focusLocations),a=cl(e.edges,r),i=new Set(e.paths.flatMap(E=>E.edgeIds)),s=Ue(e.anchors.filter(E=>E.status==="matched").flatMap(E=>E.nodeIds)),d=e.edges.filter(Di).filter(E=>tl(E,o,r,i)),c=d.filter(E=>rl(E,o,r,a,n,i)),u=ki(s,c,"forward"),f=il(u,c),p=ki(f,c,"backward"),m=new Set([...u].filter(E=>p.has(E)));for(let E of s)m.add(E);let h=new Set(c.filter(E=>m.has(E.fromNodeId)&&m.has(E.toNodeId)).map(E=>E.id)),y=new Set(m),L=new Set(h);nl(d,y,L,o,r);let x=e.frontiers.filter(E=>ul(E,y)),S=Ue(x.filter(E=>E.disposition==="unsupported").map(E=>E.id)),T=Ue(e.edges.filter(E=>!Di(E)&&Gi(E)&&dl(E,y)).map(E=>E.id)),F=Ue(x.map(E=>E.id)),P=[];s.length===0&&P.push("No matched anchor node starts the corridor."),f.length===0&&P.push("No proved mechanical outcome is reachable from a matched anchor."),S.length>0&&P.push(`${S.length} unsupported frontier(s) touch the protected corridor.`),T.length>0&&P.push(`${T.length} candidate or unknown edge(s) touch the protected corridor.`);let I=P.length===0?"complete":"incomplete";return{schemaVersion:1,status:I,startNodeIds:s,outcomeNodeIds:f,baseNodeIds:Ue([...m]),baseEdgeIds:Ue([...h]),nodeIds:Ue([...y]),edgeIds:Ue([...L]),accountedFrontierIds:F,unresolvedFrontierIds:S,unresolvedEdgeIds:T,coverage:{protectedNodes:y.size,protectedEdges:L.size,baseNodes:m.size,baseEdges:h.size,accountedFrontiers:F.length,unresolvedFrontiers:S.length,unresolvedEdges:T.length},explanation:I==="complete"?"Every proved anchor-to-outcome path is closed over its material causal facts within reported coverage.":P.join(" ")}}function tl(e,t,n,o){return t===null||e.disposition==="emitted"||o.has(e.id)||n?.has(e.id)===!0?!0:(e.semantics??[]).some(r=>{if(r.family==="identity"&&en.has(r.subtype))return t.has(e.toNodeId);if(r.family==="contract")return t.has(e.fromNodeId)&&t.has(e.toNodeId);if(r.family==="state")return t.has(e.fromNodeId);if(r.family==="data"||r.family==="temporal")return t.has(e.fromNodeId)||t.has(e.toNodeId);if(r.family==="control"){if(ji(r))return t.has(e.fromNodeId);if(["returns","throws"].includes(r.subtype))return t.has(e.toNodeId);if(r.subtype==="completion-callback")return t.has(e.fromNodeId)||t.has(e.toNodeId)}return!1})}function nl(e,t,n,o,r){let a=!0;for(;a;){a=!1;for(let i of e)ol(i,t,o,r)&&(n.has(i.id)||(n.add(i.id),a=!0),t.has(i.fromNodeId)||(t.add(i.fromNodeId),a=!0),t.has(i.toNodeId)||(t.add(i.toNodeId),a=!0))}}function ol(e,t,n,o){let r=t.has(e.fromNodeId),a=t.has(e.toNodeId);return!r&&!a?!1:(e.semantics??[]).some(i=>i.family==="identity"?en.has(i.subtype)&&(a||n===null||n.has(e.toNodeId)):i.family==="contract"?!0:i.family==="state"?r&&(n===null||n.has(e.fromNodeId)):i.family==="temporal"?i.subtype==="lexical-successor"?r&&a:!0:i.family==="data"?a&&(r||n===null||n.has(e.fromNodeId)||o?.has(e.id)===!0):i.family==="control"?Oi(i)||["returns","throws"].includes(i.subtype)&&!a&&n!==null&&!n.has(e.toNodeId)?!1:_i.has(i.subtype)||ji(i)||i.subtype==="completion-callback":!1)}function il(e,t){let n=new Set,o=new Map,r=new Map;for(let a of t)!e.has(a.fromNodeId)||!e.has(a.toNodeId)||(o.set(a.fromNodeId,(o.get(a.fromNodeId)??0)+1),r.set(a.toNodeId,(r.get(a.toNodeId)??0)+1),(a.semantics??[]).some(i=>i.family==="state"||i.family==="control"&&_i.has(i.subtype))&&n.add(a.toNodeId));for(let a of e)(r.get(a)??0)>0&&(o.get(a)??0)===0&&n.add(a);return Ue([...n])}function ki(e,t,n){let o=new Map;for(let i of t){let s=n==="forward"?i.fromNodeId:i.toNodeId,l=n==="forward"?i.toNodeId:i.fromNodeId,d=o.get(s)??[];d.push(l),o.set(s,d)}let r=new Set(e),a=[...e];for(;a.length>0;){let i=a.shift();for(let s of o.get(i)??[])r.has(s)||(r.add(s),a.push(s))}return r}function rl(e,t,n,o,r,a){return(e.semantics??[]).some(i=>e.disposition==="emitted"||a.has(e.id)?!0:i.family==="identity"&&en.has(i.subtype)?t===null||t.has(e.toNodeId)||o?.has(e.toNodeId)===!0:!el.has(i.family)||Oi(i)?!1:i.family==="control"&&["returns","throws"].includes(i.subtype)&&t!==null?t.has(e.toNodeId):t===null?!0:i.family==="state"?t.has(e.fromNodeId):i.family==="data"?t.has(e.fromNodeId)||t.has(e.toNodeId)||n?.has(e.id)===!0:i.family==="temporal"?i.subtype==="lexical-successor"?t.has(e.fromNodeId)&&t.has(e.toNodeId):t.has(e.fromNodeId)||t.has(e.toNodeId):i.family==="control"?al(e,r)&&(t.has(e.fromNodeId)||t.has(e.toNodeId)):!1)}function Oi(e){return e.family==="control"&&["call","discriminator-dispatch","result-callback","runtime-handoff"].includes(e.subtype)}function al(e,t){let n=t.get(e.fromNodeId),o=t.get(e.toNodeId);if(!n||!o)return!1;let r=$i(n,"ownerNodeId")??(n.kind==="symbol"?n.id:null),a=$i(o,"ownerNodeId")??(o.kind==="symbol"?o.id:null);return r!==null&&r===a}function sl(e,t){if(!t)return null;let n=new Map;for(let o of t){let r=n.get(o.file)??[];r.push(o.line),n.set(o.file,r)}return new Set(e.filter(o=>{if(!o.location||o.kind==="parameter")return!1;let r=n.get(o.location.file)??[],a=o.location.endLine??o.location.line;return r.some(i=>i>=o.location.line&&i<=a)}).map(o=>o.id))}function ll(e,t){if(!t)return null;let n=new Map;for(let o of t){let r=n.get(o.file)??[];r.push(o.line),n.set(o.file,r)}return new Set(e.filter(o=>o.evidence.some(r=>{if(!r.location)return!1;let a=n.get(r.location.file)??[],i=r.location.endLine??r.location.line;return a.some(s=>s>=r.location.line&&s<=i)})).map(o=>o.id))}function cl(e,t){return t===null?null:new Set(e.filter(n=>t.has(n.id)).flatMap(n=>[n.fromNodeId,n.toNodeId]))}function $i(e,t){let n=e.attributes[t];return typeof n=="string"?n:null}function Di(e){return e.disposition==="excluded"||e.disposition==="unsupported"||!Gi(e)?!1:e.evidence.some(t=>t.strength==="exact"||t.strength==="derived")}function Gi(e){return(e.semantics??[]).some(t=>t.family!=="identity"||en.has(t.subtype))}function ji(e){return e.subtype.startsWith("predicate-")||e.subtype.startsWith("loop-")||e.subtype.startsWith("exception-")||e.subtype.startsWith("finally-")||e.subtype.startsWith("handler-")}function dl(e,t){return t.has(e.fromNodeId)||t.has(e.toNodeId)}function ul(e,t){return[...e.fromNodeIds,...e.memberNodeIds].some(n=>t.has(n))}function Ue(e){return[...new Set(e)].sort()}import{createHash as pl}from"crypto";var tn=["identity","contract","control","data","state","temporal"],ml=new Set(tn);function on(e){let t=dt(e.anchors,"anchor"),n=dt(e.nodes,"node"),o=dt(e.edges,"edge"),r=dt(e.paths??[],"path"),a=dt(e.frontiers??[],"frontier"),i=new Set(t.map(p=>p.id)),s=new Set(n.map(p=>p.id)),l=new Set(o.map(p=>p.id)),d=e.routeCatalog?{...e.routeCatalog,routes:dt(e.routeCatalog.routes,"route"),selectedRouteIds:xe(e.routeCatalog.selectedRouteIds)}:void 0;for(let p of t)Ie(`anchor ${p.id}`,[...p.nodeIds,...p.candidateNodeIds],s,"node");for(let p of n)Ie(`node ${p.id}`,p.anchorIds,i,"anchor");for(let p of o){if(Ie(`edge ${p.id}`,[p.fromNodeId,p.toNodeId],s,"node"),p.evidence.length===0)throw new Error(`Exploration edge ${p.id} has no evidence source.`);yl(p)}for(let p of r)Ie(`path ${p.id}`,[p.fromAnchorId,p.toAnchorId],i,"anchor"),Ie(`path ${p.id}`,p.nodeIds,s,"node"),Ie(`path ${p.id}`,p.edgeIds,l,"edge");for(let p of a)if(Ie(`frontier ${p.id}`,p.fromNodeIds,s,"node"),Ie(`frontier ${p.id}`,p.edgeIds,l,"edge"),Ie(`frontier ${p.id}`,p.memberNodeIds,s,"node"),p.memberCount!==p.memberNodeIds.length)throw new Error(`Exploration frontier ${p.id} reports ${p.memberCount} member(s) but identifies ${p.memberNodeIds.length}.`);for(let p of d?.routes??[])Ie(`route ${p.id}`,p.nodeIds,s,"node"),Ie(`route ${p.id}`,p.edgeIds,l,"edge"),Ie(`route ${p.id}`,[p.anchorNodeId,p.endpointNodeId],s,"node");d&&Ie("route catalog selection",d.selectedRouteIds,new Set(d.routes.map(p=>p.id)),"route");let c=xe(e.incompleteReasons??[]),u=c.length===0?"accounted":"incomplete",f=t.reduce((p,m)=>p+m.omittedCandidates,0);return{schemaVersion:1,anchors:t,nodes:n,edges:o,paths:r,frontiers:a,coverage:{status:u,scope:e.scope,nodes:Qi(n),edges:Qi(o),matchedAnchors:t.filter(p=>p.status==="matched").length,ambiguousAnchors:t.filter(p=>p.status==="ambiguous").length,missingAnchors:t.filter(p=>p.status==="missing").length,omittedCandidates:f,frontierGroups:a.length,programEdges:gl(o),blindSpots:xe(e.blindSpots??[]),explanation:u==="accounted"?"Every node and edge discovered within the declared query scope is emitted, folded with recoverable identity, explicitly excluded, or reported unsupported.":`The declared query scope is not fully accounted for: ${c.join("; ")}`},completion:Sl(u,r,e.scope),...d?{routeCatalog:d}:{}}}function fl(e){return e.flatMap(t=>hl(t.semantics??[]).map(n=>({id:bl(t.id,n),sourceEdgeId:t.id,sourceKind:t.kind,fromNodeId:t.fromNodeId,toNodeId:t.toNodeId,directed:!0,disposition:t.disposition,evidence:[...t.evidence],family:n.family,subtype:n.subtype,...n.context?{context:{...n.context}}:{},...n.attributes?{attributes:{...n.attributes}}:{}}))).sort((t,n)=>t.id.localeCompare(n.id))}function gl(e){let t=fl(e),n=new Set(t.map(i=>i.sourceEdgeId)),o=new Map(tn.map(i=>[i,new Set])),r=new Map(tn.map(i=>[i,new Set])),a=new Map(tn.map(i=>[i,0]));for(let i of t)o.get(i.family).add(i.sourceEdgeId),r.get(i.family).add(i.subtype),a.set(i.family,a.get(i.family)+1);return{sourceEdges:e.length,mappedSourceEdges:n.size,projectedEdges:t.length,unmappedSourceEdges:e.length-n.size,unsupportedSourceEdges:e.filter(i=>i.disposition==="unsupported").length,unmappedKinds:xe(e.filter(i=>!n.has(i.id)).map(i=>i.kind)),families:{identity:ct("identity",o,a,r),contract:ct("contract",o,a,r),control:ct("control",o,a,r),data:ct("data",o,a,r),state:ct("state",o,a,r),temporal:ct("temporal",o,a,r)}}}function ct(e,t,n,o){return{sourceEdges:t.get(e)?.size??0,projectedEdges:n.get(e)??0,subtypes:[...o.get(e)??[]].sort()}}function yl(e){let t=new Set;for(let n of e.semantics??[]){if(!ml.has(n.family))throw new Error(`Exploration edge ${e.id} has unknown program edge family: ${n.family}.`);if(n.subtype.trim().length===0)throw new Error(`Exploration edge ${e.id} has an empty program edge subtype.`);let o=Un(n);if(t.has(o))throw new Error(`Exploration edge ${e.id} repeats program edge semantic ${o}.`);t.add(o)}}function hl(e){return[...e].sort((t,n)=>Un(t).localeCompare(Un(n)))}function Un(e){return`${e.family}:${e.subtype}`}function bl(e,t){return`program:${encodeURIComponent(e)}:${t.family}:${encodeURIComponent(t.subtype)}`}function Sl(e,t,n){return e==="incomplete"||t.some(o=>o.status!=="connected")?{status:"coverage-incomplete",scope:n,explanation:"The declared graph query has an ambiguous, missing, candidate-only, or disconnected anchor relationship."}:t.length>0?{status:"connector-complete",scope:n,explanation:"Every requested anchor pair has a selected path supported by proved repository relationships."}:{status:"frontier-accounted",scope:n,explanation:"Every discovered direction in the declared graph query is emitted or represented by an exact frontier."}}function Xi(e,t={}){let n=t.maxSelectedNodes??24;if(!Number.isSafeInteger(n)||n<=0)throw new RangeError(`maxSelectedNodes must be a positive safe integer; received ${n}`);let o=new Set(e.anchors.flatMap(b=>[...b.nodeIds,...b.candidateNodeIds])),r=[],a=e.anchors.filter(b=>b.status!=="missing"&&b.nodeIds.length+b.candidateNodeIds.length>0);for(let b=0;b<a.length;b+=1)for(let $=b+1;$<a.length;$+=1){let z=a[b],q=a[$],C=Wi(e,z,q,!1),O=C??Wi(e,z,q,!0);O?(O.nodeIds.forEach(se=>o.add(se)),r.push({id:nn("path",z.id,q.id),fromAnchorId:z.id,toAnchorId:q.id,status:!C||z.status==="ambiguous"||q.status==="ambiguous"?"candidate":"connected",nodeIds:O.nodeIds,edgeIds:O.edgeIds})):r.push({id:nn("path",z.id,q.id),fromAnchorId:z.id,toAnchorId:q.id,status:"partial",nodeIds:[],edgeIds:[]})}let i=xe(t.routeIds??[]),s=vl(e,i),l=new Set(s.routes.map(b=>b.id)),d=i.filter(b=>!l.has(b));if(d.length>0)throw new Error(`Unknown exploration route id(s): ${d.join(", ")}`);let u=s.routes.filter(b=>i.includes(b.id)).map(b=>({anchorNodeId:b.anchorNodeId,endpointNodeId:b.endpointNodeId,endpointKind:b.endpointKind,endpointPriority:2,nodeIds:[...b.nodeIds].reverse(),edgeIds:[...b.edgeIds].reverse()}));for(let b of u)b.nodeIds.forEach($=>o.add($));let f=r.length===0||r.some(b=>b.edgeIds.length>0);f&&Vi(e,o,n);let p=Yi(e,o),m=new Set(t.expandedFrontierIds??[]),h=new Set(p.map(b=>b.id)),y=[...m].filter(b=>!h.has(b)).sort();if(y.length>0)throw new Error(`Unknown exploration frontier id(s): ${y.join(", ")}`);for(let b of p)m.has(b.id)&&b.memberNodeIds.forEach($=>o.add($));f&&Vi(e,o,n);let L=new Map(u.map(b=>[b.endpointNodeId,b.endpointKind])),x=new Set(u.flatMap(b=>b.nodeIds)),S=new Map;for(let b of u)for(let $=0;$<b.nodeIds.length;$+=1){let z=b.nodeIds[$],q=$;S.set(z,Math.max(S.get(z)??0,q))}let T=e.nodes.map(b=>{let $=L.get(b.id),z=x.has(b.id)?{upstreamCausalPath:!0,upstreamCausalDistance:S.get(b.id)??0,...$?{upstreamCausalEndpoint:$}:{}}:{};return{...b,attributes:{...b.attributes,...z},disposition:b.disposition==="excluded"||b.disposition==="unsupported"?b.disposition:o.has(b.id)?"emitted":"folded"}}),F=new Set([...r.flatMap(b=>b.edgeIds),...u.flatMap(b=>b.edgeIds)]),P=e.edges.map(b=>({...b,disposition:b.disposition==="excluded"||b.disposition==="unsupported"?b.disposition:F.has(b.id)||o.has(b.fromNodeId)&&o.has(b.toNodeId)?"emitted":"folded"})),I=on({anchors:e.anchors,nodes:T,edges:P,paths:r,frontiers:[...e.frontiers.filter(b=>b.disposition!=="folded"),...Yi({...e,nodes:T,edges:P},o)],scope:e.coverage.scope,blindSpots:e.coverage.blindSpots,incompleteReasons:e.coverage.status==="incomplete"?[e.coverage.explanation]:[],routeCatalog:s}),E=new Set(I.frontiers.flatMap(b=>b.edgeIds)),N=I.edges.filter(b=>b.disposition==="folded"&&!E.has(b.id)).map(b=>b.id);if(N.length>0)throw new Error(`Folded exploration edge(s) are not frontier-accounted: ${N.sort().join(", ")}`);return I}var Ki=10;function vl(e,t=[]){let n=new Map(e.nodes.map(y=>[y.id,y])),o=new Map(e.edges.map(y=>[y.id,y])),r=new Map;for(let y of e.edges){if(!xl(y))continue;let L=r.get(y.toNodeId)??[];L.push(y),r.set(y.toNodeId,L)}for(let y of r.values())y.sort((L,x)=>Number(wt(x))-Number(wt(L))||Ui(x)-Ui(L)||L.fromNodeId.localeCompare(x.fromNodeId)||L.id.localeCompare(x.id));let a=xe(e.anchors.filter(y=>y.status==="matched").flatMap(y=>y.nodeIds)),i=new Map,s=new Set,l=(y,L,x)=>{let S=L.nodeIds[L.nodeIds.length-1],T=n.get(S),F=n.get(y);if(!T?.location||!F)return;let P=[...L.nodeIds].reverse(),I=[...L.edgeIds].reverse(),E=new Set(P),N=I.flatMap(C=>{let w=o.get(C);return w?[w]:[]}),b=e.edges.filter(C=>C.disposition!=="excluded"&&C.disposition!=="unsupported"&&(E.has(C.fromNodeId)||E.has(C.toNodeId))),$={id:nn("route",y,S,x,...I),status:"proved",anchorNodeId:y,anchorLabel:F.label,endpointNodeId:S,endpointLabel:T.label,endpointLocation:{...T.location},endpointKind:x,nodeIds:P,edgeIds:I,evidenceStrengths:xe(N.flatMap(C=>C.evidence.map(w=>w.strength))),spineEdgeFamilies:qi(N,!0),relatedEdgeFamilies:qi(b,!1),crossesRuntimeBoundary:N.some(wt)},z=`${y}\0${S}\0${x}`,q=i.get(z);(!q||zi($,q)<0)&&i.set(z,$)};for(let y of a){n.get(y)?.attributes.publicEntry===!0&&l(y,{nodeIds:[y],edgeIds:[]},"public-entry");let L=[{nodeIds:[y],edgeIds:[]}],x=new Map([[y,0]]);for(let S=0;S<L.length;S+=1){let T=L[S],F=T.nodeIds[T.nodeIds.length-1];T.edgeIds.length>0&&n.get(F)?.location&&n.get(F)?.attributes.publicEntry===!0&&l(y,T,"public-entry");let P=r.get(F)??[];if(T.edgeIds.length>=Ki){P.some(I=>!T.nodeIds.includes(I.fromNodeId))&&s.add(y);continue}for(let I of P){if(T.nodeIds.includes(I.fromNodeId))continue;let E=T.edgeIds.length+1,N=x.get(I.fromNodeId);if(N!==void 0&&N<=E)continue;let b={nodeIds:[...T.nodeIds,I.fromNodeId],edgeIds:[...T.edgeIds,I.id]};if(x.set(I.fromNodeId,E),wt(I)&&n.get(I.fromNodeId)?.location){l(y,b,"runtime-boundary");continue}L.push(b)}}}let d=[...i.values()].sort(zi),c=new Set(d.map(y=>y.id)),u=xe(t.filter(y=>c.has(y))),f=xe(d.map(y=>y.anchorNodeId)),p=a.filter(y=>!f.includes(y)),m=[...s].sort(),h=e.coverage.status==="accounted"&&m.length===0?"accounted":"incomplete";return{schemaVersion:1,routes:d,selectedRouteIds:u,coverage:{status:h,scope:"Distinct proved public-entry and runtime-boundary endpoints reachable upstream in the supplied topology.",enumeration:"one-shortest-proved-path-per-endpoint",maximumDepth:Ki,anchorNodeIds:a,anchorsWithRoutes:f,anchorsWithoutRoutes:p,depthLimitedAnchorNodeIds:m,routeCount:d.length,explanation:h==="accounted"?"Every distinct proved upstream public/runtime endpoint in the supplied topology has one stable shortest route.":"Route enumeration is incomplete because the supplied topology has incomplete coverage or a traversal reached the route-depth bound."}}}function qi(e,t){let n=e.flatMap(o=>o.semantics?.map(r=>r.family)??[]);return t&&e.length>0&&n.length===0&&n.push("control"),xe(n)}function zi(e,t){return e.anchorNodeId.localeCompare(t.anchorNodeId)||e.edgeIds.length-t.edgeIds.length||e.endpointKind.localeCompare(t.endpointKind)||e.endpointNodeId.localeCompare(t.endpointNodeId)||e.id.localeCompare(t.id)}function xl(e){return e.disposition!=="excluded"&&e.disposition!=="unsupported"&&El(e)&&e.evidence.some(t=>["exact","derived","mixed"].includes(t.strength))}function El(e){return wt(e)||e.kind==="boundary-observation"||e.kind==="call"||e.kind==="compiler:call"}function wt(e){return e.kind==="runtime-boundary"||e.kind.startsWith("runtime:")}function Ui(e){let t={exact:5,derived:4,mixed:3,candidate:1,unknown:0};return Math.max(0,...e.evidence.map(n=>t[n.strength]))}function Wi(e,t,n,o){return Hi(e,t,n,o)??Hi(e,n,t,o)}function Hi(e,t,n,o){let r=[...t.nodeIds,...t.candidateNodeIds].sort(),a=new Set([...n.nodeIds,...n.candidateNodeIds]);if(r.some(c=>a.has(c)))return{nodeIds:[r.find(u=>a.has(u))],edgeIds:[]};let i=new Set(e.nodes.filter(c=>c.kind==="structural-region").map(c=>c.id)),s=new Map;for(let c of e.edges)c.disposition==="excluded"||c.disposition==="unsupported"||c.kind==="structural-membership"||i.has(c.fromNodeId)||i.has(c.toNodeId)||c.evidence.every(f=>["candidate","unknown"].includes(f.strength))&&!o||Ll(s,c.fromNodeId,c.toNodeId,c.id);for(let c of s.values())c.sort((u,f)=>u.nodeId.localeCompare(f.nodeId)||u.edgeId.localeCompare(f.edgeId));let l=r.map(c=>({nodeId:c,nodeIds:[c],edgeIds:[]})),d=new Set(r);for(let c=0;c<l.length;c+=1){let u=l[c];for(let f of s.get(u.nodeId)??[]){if(d.has(f.nodeId))continue;let p={nodeId:f.nodeId,nodeIds:[...u.nodeIds,f.nodeId],edgeIds:[...u.edgeIds,f.edgeId]};if(a.has(f.nodeId))return p;d.add(f.nodeId),l.push(p)}}return null}function Ll(e,t,n,o){let r=e.get(t)??[];r.push({nodeId:n,edgeId:o}),e.set(t,r)}function Cl(e,t,n){let o=new Map;for(let s of e.edges){let l=o.get(s.fromNodeId)??{incoming:0,outgoing:0},d=o.get(s.toNodeId)??{incoming:0,outgoing:0};l.outgoing+=1,d.incoming+=1,o.set(s.fromNodeId,l),o.set(s.toNodeId,d)}let r=new Set,a=new Map;for(let s of e.edges){let l=t.has(s.fromNodeId),d=t.has(s.toNodeId);if(l===d)continue;let c=l?s.toNodeId:s.fromNodeId,u=l?s.fromNodeId:s.toNodeId,f=e.nodes.find(h=>h.id===c);if(f?.kind==="structural-region")continue;let p=a.get(c)??new Set;p.add(u),a.set(c,p),(/(?:runtime-boundary|external)/u.test(s.kind)||f&&/(?:frontier|external)/u.test(f.kind))&&r.add(c)}let i=[...a].filter(([s,l])=>{if(r.has(s))return!0;let d=o.get(s)??{incoming:0,outgoing:0};return(d.incoming>1||d.outgoing>1)&&l.size>1}).sort(([s,l],[d,c])=>Number(r.has(d))-Number(r.has(s))||c.size-l.size||s.localeCompare(d)).map(([s])=>s);for(let s of i){if(t.size>=n)break;t.add(s)}}function Vi(e,t,n){let o=-1;for(;t.size!==o&&t.size<n;)o=t.size,Cl(e,t,n)}function Yi(e,t){let n=new Set(e.nodes.filter(i=>!t.has(i.id)&&i.disposition!=="excluded"&&i.disposition!=="unsupported").map(i=>i.id)),o=new Map;for(let i of e.edges){if(!n.has(i.fromNodeId)||!n.has(i.toNodeId))continue;let s=o.get(i.fromNodeId)??new Set,l=o.get(i.toNodeId)??new Set;s.add(i.toNodeId),l.add(i.fromNodeId),o.set(i.fromNodeId,s),o.set(i.toNodeId,l)}let r=[],a=new Set;for(let i of[...n].sort()){if(a.has(i))continue;let s=[],l=[i];a.add(i);for(let d=0;d<l.length;d+=1){let c=l[d];s.push(c);for(let u of[...o.get(c)??[]].sort())a.has(u)||(a.add(u),l.push(u))}r.push(s.sort())}return r.map(i=>{let s=new Set(i),l=e.edges.filter(m=>s.has(m.fromNodeId)||s.has(m.toNodeId)),d=l.filter(m=>s.has(m.fromNodeId)!==s.has(m.toNodeId)),c=xe(d.map(m=>s.has(m.fromNodeId)?m.toNodeId:m.fromNodeId)),u=new Set(d.map(m=>s.has(m.toNodeId)?"outgoing":"incoming")),f=xe(l.map(m=>m.id)),p=xe(d.map(m=>m.kind));return{id:nn("frontier",...i,...f),kind:p.join("+")||"disconnected",direction:u.size===1?[...u][0]:"undirected",fromNodeIds:c,edgeIds:f,memberNodeIds:i,memberCount:i.length,disposition:"folded",reason:d.length>0?"Connected evidence is folded beyond the first edge leaving the selected connector graph.":"Discovered evidence is disconnected from every selected anchor connector under the declared relation scope.",expansion:null}})}function nn(e,...t){let n=pl("sha256").update(t.join("\0")).digest("hex").slice(0,16);return`${e}:${n}`}function dt(e,t){let n=[...e].sort((o,r)=>o.id.localeCompare(r.id));for(let o=1;o<n.length;o+=1)if(n[o-1].id===n[o].id)throw new Error(`Duplicate exploration ${t} id: ${n[o].id}`);return n}function Ie(e,t,n,o){let r=xe(t.filter(a=>!n.has(a)));if(r.length>0)throw new Error(`Exploration ${e} references missing ${o}(s): ${r.join(", ")}`)}function Qi(e){return{total:e.length,emitted:e.filter(t=>t.disposition==="emitted").length,folded:e.filter(t=>t.disposition==="folded").length,excluded:e.filter(t=>t.disposition==="excluded").length,unsupported:e.filter(t=>t.disposition==="unsupported").length}}function xe(e){return[...new Set(e)].sort()}var Il=5,wl=12,Nl=8,Rl=3,Zi=8,Ml=6,Tl=12,Ji=12,Fl=12,Pl=2,Al=new Set(["branch","loop","call","await","return","throw","mutation","catch","finally"]),kl=9e3,er=li,tr=new WeakMap;function ur(e,t){return $l(e,t,"topology")}function $l(e,t,n){let o=be(t.searches??[]),r=be(t.symbols??[]),a=be(t.relations&&t.relations.length>0?t.relations:er),i=a.filter(g=>!er.includes(g));if(i.length>0)throw new Error(`Unsupported system-map relation kind(s): ${i.join(", ")}`);let s=new Set(a),l=t.evidenceFloor??"derived";if(l!=="exact"&&l!=="derived")throw new Error(`Unsupported system-map evidence floor: ${l}`);let d=be(t.sourceScopes&&t.sourceScopes.length>0?t.sourceScopes:["production"]),c=["production","test","fixture","example","generated","script","unknown"],u=d.filter(g=>!c.includes(g));if(u.length>0)throw new Error(`Unsupported system-map source scope(s): ${u.join(", ")}`);let f=new Set(d),p=g=>f.has(gn(g));if(o.length===0&&r.length===0)throw new Error("system-map requires at least one --search or --symbol anchor.");let m=t.maxDepth??Il;if(!Number.isSafeInteger(m)||m<0)throw new RangeError(`maxDepth must be a non-negative safe integer; received ${m}`);let h=t.maxTopologyCharacters??kl;if(!Number.isSafeInteger(h)||h<=0)throw new RangeError(`maxTopologyCharacters must be a positive safe integer; received ${h}`);let y=new Bt(e),{fileGraph:L,reverseFileGraph:x,workspaces:S,runtimeBoundaries:T}=wc(e,y),F=new Map((T?.observations??[]).map(g=>[g.id,g])),P=new Set((T?.observations??[]).map(g=>`${g.source.file}\0${g.source.startLine}`)),I=new Set,E=new Map,N=new Map,b=new Map,$=new Map,z=[],q=new Map,C=new Map,w=[],O=0,se=0,re=0,ye=0,U=0,oe=0,Ae=new Set,ke=new Map,mt=new Map,cn=g=>{let k=mt.get(g);if(k)return k;let B=En(e,g,{excludeIndexedTargets:!1});return mt.set(g,B),B},$e=(g,k,B,Q,A=!1)=>{let R=N.get(g);if(R)return R.depth=Math.min(R.depth,k),R.primary||=Q,R.promoteBoundaryImports||=A,R.origins.add(B),R;let _={file:g,depth:k,primary:Q,promoteBoundaryImports:A,origins:new Set([B]),processed:!1};return N.set(g,_),_},fe=(g,k,B,Q,A="none",R=!1)=>{let _=b.get(g.symbol);if(_)return _.depth=Math.min(_.depth,k),_.origins.add(B),Q&&_.anchorQueries.add(Q),_.referenceScope=Ic(_.referenceScope,A),$e(g.relativePath,k,B,!0,R),_;let j={definition:g,depth:k,origins:new Set([B]),anchorQueries:new Set(Q?[Q]:[]),referenceScope:A,processed:!1};return b.set(g.symbol,j),$e(g.relativePath,k,B,!0,R),j},v=(g,k,B,Q,A=!1,R=!0)=>{let _=Oe(g),j=$.get(_);if(j)return j.depth=Math.min(j.depth,k),j.origins.add(B),Q&&j.anchorQueries.add(Q),j.reverseCallExpansion||=A,j.traversalEligible||=R,$e(g.file,k,B,j.traversalEligible,!0),j;let D={...g,depth:k,origins:new Set([B]),anchorQueries:new Set(Q?[Q]:[]),reverseCallExpansion:A,traversalEligible:R};return $.set(_,D),$e(g.file,k,B,R,!0),D},V=(g,k,B)=>{$e(g.source.file,k,B,!0,!0),g.owner.file!==g.source.file&&$e(g.owner.file,k,`${B}:owner`,!0,!0);let Q=le(e,g.owner.file),A=g.owner.symbol?Ve(e,y,g.owner.symbol).matches.find(j=>j.relativePath===g.owner.file):null,R=(A&&!ve(A.symbol)?A:null)??it(Q,g.source.startLine);if(R&&!ve(R.symbol))return fe(R,k,B,void 0,"none",!0),R.symbol;g.owner.name&&v({file:g.owner.file,name:g.owner.name,startLine:g.owner.startLine,endLine:g.owner.endLine},k,`${B}:source-owner`,void 0,!0);let _=y.definitionsForFile(g.source.file).filter(j=>!!j.leaf&&je(e,g.source.file,j.leaf).some(D=>D>=g.source.startLine&&D<=g.source.endLine));if(_.length===1){let j=_[0];fe(j,k,`${B}:handler-identifier`,void 0,"none",!0),we(q,{kind:"runtime-boundary",evidence:"runtime-boundary:handler-identifier",fromFile:g.source.file,fromSymbol:null,toFile:j.relativePath,toSymbol:j.symbol,fromBoundaryParticipant:ut(g),line:g.source.startLine,strength:"derived"})}return null};for(let g of o){let k=lc(e,y,g,P),B=k.filter(_=>mc(_,p)),Q=!t.fullLiteralTraversal&&(k.length>wl||B.length>Nl),A=Q?[]:k,R=new Set((Q?[]:t.fullLiteralTraversal?B:[...B].sort(cc).slice(0,Rl)).map(ar));Q&&(se+=1,re+=k.length);for(let _ of A){let j=R.has(ar(_)),D=j&&!_.ownerSymbol&&_.ownerStartLine!==null&&_.ownerEndLine!==null;if($e(_.relativePath,0,`${j?"literal-anchor":"literal-match"}:${g}`,D,D),D&&v({file:_.relativePath,name:_.ownerShortName??`${_.relativePath}:${_.ownerStartLine+1}`,startLine:_.ownerStartLine,endLine:_.ownerEndLine},0,`literal-source-owner:${g}`,g,!0),j&&_.ownerSymbol){let K=Ve(e,y,_.ownerSymbol).matches[0];K&&!ve(K.symbol)&&fe(K,0,"literal-owner",g,"all",!0)}z.push({query:g,file:_.relativePath,line:_.line,ownerSymbol:_.ownerSymbol,ownerShortName:_.ownerShortName,ownerStartLine:_.ownerStartLine,ownerEndLine:_.ownerEndLine,sourceLine:_.sourceLine.trim(),matchKind:_.matchKind,traversalSeed:j})}w.push({kind:"literal",query:g,status:k.length>0?"matched":"missing",matchedRegionIds:[],matchingLines:k.length,seedMatchingLines:Q?0:R.size,matchOnlyLines:k.length-R.size,eligibleSeedMatchingLines:B.length,materializedMatchingLines:A.length,withheldMatchingLines:Q?k.length:0,literalTraversal:Q?"withheld-broad":"materialized",representativeMatches:Q?fc(g,k):void 0,narrowingCommands:Q?yc(g,k):void 0,exhaustiveTraversalCommand:Q||R.size<B.length?`scip-query system-map --search ${ne(g)} --full-literal-traversal`:void 0,seedRegionIds:[],matchOnlyRegionIds:[]})}for(let g of r){let k=Ve(e,y,g);O+=k.omitted;let B=dc(e,g),Q=k.matches.filter(D=>!ve(D.symbol)),A=B!==null&&Q.length===0;A&&v(B,0,"source-construct-anchor",g,!0);let R=A?Q:k.matches;for(let D of R)fe(D,0,"symbol-anchor",g,"all",!0);let _=A?uc(B):null,j=A?1:k.total;w.push({kind:"symbol",query:g,status:j===0?"missing":j===1?"matched":"ambiguous",matchedRegionIds:[],symbolCandidates:[..._?[_]:[],...R.map(xc)],totalSymbolCandidates:j,omittedSymbolCandidates:k.omitted})}for(let g=0;g<m;g+=1){if(s.has("call")){let A=[...$.values()].filter(R=>R.traversalEligible&&R.reverseCallExpansion&&R.depth<=g&&!Ae.has(Oe(R)));for(let R of A){Ae.add(Oe(R));let _=ue(e,R.file);if((_?.callables??[]).filter(K=>K.name===R.name&&K.startLine<=R.endLine&&K.endLine>=R.startLine).length===1){let K=(_?.callSites??[]).filter(Y=>Y.calleeLeaf===R.name&&!Y.memberAccess);for(let Y of K){let ee=g+1,H=it(le(e,R.file),Y.line),J=null,ce=null;if(H&&!ve(H.symbol)){if(H.relativePath===R.file&&H.startLine<=R.endLine&&H.endLine>=R.startLine)continue;fe(H,ee,"reverse-local-call-owner",void 0,"forward-regions",!0),J=H.symbol}else{let M=Wn(e,R.file,Y.line);M&&Oe(M)!==Oe(R)&&(ce=v(M,ee,"reverse-local-call-source-owner",void 0,!0))}!J&&!ce||we(q,{kind:"call",evidence:"ast-callsite",fromFile:R.file,fromSymbol:J,toFile:R.file,toSymbol:null,fromSourceConstruct:ce?Ee(ce):void 0,toSourceConstruct:Ee(R),line:Y.line,strength:"derived"})}}let D=new Set([...x.get(R.file)??[],...ke.get(Oe(R))??[],..._o(e,R.file).flatMap(K=>[...x.get(K)??[]])]);for(let K of D){if(!p(K))continue;let ee=cn(K).targets.filter(H=>H.targetFile===R.file&&H.targetStartLine<=R.endLine&&H.targetEndLine>=R.startLine);for(let H of ee){let J=g+1,ce=it(le(e,K),H.line),M=null,X=null;if(ce&&!ve(ce.symbol))fe(ce,J,"reverse-member-call-owner",void 0,"cross-workspace-or-forward",!0),M=ce.symbol;else{let G=Wn(e,K,H.line);G&&(X=v(G,J,"reverse-member-call-source-owner",void 0,!0))}!M&&!X||we(q,{kind:"call",evidence:"ast-service-member-callsite",fromFile:K,fromSymbol:M,toFile:R.file,toSymbol:null,fromSourceConstruct:X?Ee(X):void 0,toSourceConstruct:Ee(R),line:H.line,strength:H.strength==="exact"?"exact":"derived"})}}}}let k=[...b.values()].filter(A=>!A.processed&&A.depth<=g),B=s.has("call")?y.calleeMap(k.map(A=>A.definition),{additive:!1,semantic:!1}):new Map;for(let A of k){A.processed=!0;let R=A.definition;if(A.referenceScope!=="none"&&(s.has("call")||s.has("reference")||s.has("contract-symbol"))){let _=bc(e,y,R).filter(D=>p(D.file)&&Cc(A,D.file,N,S)),j=new Set(_.flatMap(D=>{if(!(s.has("call")&&ue(e,D.file)?.callSites.some(ee=>ee.line===D.line&&nr(e,D.file,ee,R))===!0)||!D.enclosingSymbol)return[];let Y=Ve(e,y,D.enclosingSymbol).matches[0];return Y&&!ve(Y.symbol)?[{owner:Y,site:D}]:[]}).sort((D,K)=>{let Y=Ne(R.relativePath,S).relativeDir,ee=Ne(D.owner.relativePath,S).relativeDir===Y,H=Ne(K.owner.relativePath,S).relativeDir===Y,J=or(e,D.owner),ce=or(e,K.owner),M=D.owner.endLine-D.owner.startLine,X=K.owner.endLine-K.owner.startLine;return Number(H)-Number(ee)||ce-J||M-X||D.owner.symbol.localeCompare(K.owner.symbol)}).filter((D,K,Y)=>Y.findIndex(ee=>ee.owner.symbol===D.owner.symbol)===K).reduce((D,K)=>{if(D.length>=Pl)return D;let Y=Ne(K.owner.relativePath,S).relativeDir;return D.some(ee=>ee.workspace===Y)||D.push({symbol:K.owner.symbol,workspace:Y}),D},[]).map(D=>D.symbol));for(let D of _){let K=g+1;$e(D.file,K,`reference:${pe(R.symbol)}`,!0);let Y=s.has("call")&&ue(e,D.file)?.callSites.some(J=>J.line===D.line&&nr(e,D.file,J,R))===!0,ee=null,H=null;if(D.enclosingSymbol){let J=Ve(e,y,D.enclosingSymbol).matches[0];J&&!ve(J.symbol)&&(fe(J,K,"reference-owner",void 0,Y&&j.has(J.symbol)?A.referenceScope:"none"),ee=J.symbol)}if(!ee&&D.line!==null){let J=Wn(e,D.file,D.line);J&&(H=v(J,K,"reference-source-owner",void 0,Y))}s.has("reference")&&we(q,{kind:"reference",evidence:"indexed-or-source-reference",fromFile:D.file,fromSymbol:ee,toFile:R.relativePath,toSymbol:R.symbol,fromSourceConstruct:H?Ee(H):void 0,line:D.line,strength:"mixed"}),Y&&we(q,{kind:"call",evidence:"ast-callsite",fromFile:D.file,fromSymbol:ee,toFile:R.relativePath,toSymbol:R.symbol,fromSourceConstruct:H?Ee(H):void 0,line:D.line,strength:"derived"}),s.has("contract-symbol")&&Ne(D.file,S).relativeDir!==Ne(R.relativePath,S).relativeDir&&we(q,{kind:"contract-symbol",evidence:"compiler-cross-workspace-symbol",fromFile:D.file,fromSymbol:ee,toFile:R.relativePath,toSymbol:R.symbol,fromSourceConstruct:H?Ee(H):void 0,line:D.line,strength:"exact"})}}for(let _ of B.get(R.symbolId)??[]){let j=Ve(e,y,_.symbol).matches.find(K=>K.relativePath===_.file);if(!j||!p(j.relativePath))continue;if(!(j.relativePath===R.relativePath||(L.get(R.relativePath)??new Set).has(j.relativePath))){ye+=1;continue}fe(j,g+1,`call:${pe(R.symbol)}`,void 0,"none",!0),we(q,{kind:"call",evidence:_.source,fromFile:R.relativePath,fromSymbol:R.symbol,toFile:j.relativePath,toSymbol:j.symbol,line:null,strength:tc(_.source)})}}let Q=[...N.values()].filter(A=>!A.processed&&A.primary&&A.depth<=g);for(let A of Q){A.processed=!0;let R=[...$.values()].filter(M=>M.traversalEligible&&M.file===A.file&&M.depth<=g),_=[...b.values()].filter(M=>M.definition.relativePath===A.file&&M.depth<=g).map(M=>{let X=vn(e,A.file,M.definition.startLine);return{startLine:X?.startLine??M.definition.startLine,endLine:X?.endLine??M.definition.endLine}}),j=M=>[...b.values()].filter(X=>X.definition.relativePath===A.file&&X.definition.startLine<=M&&X.definition.endLine>=M).sort((X,G)=>X.definition.endLine-X.definition.startLine-(G.definition.endLine-G.definition.startLine)||X.definition.startLine-G.definition.startLine)[0],D=[...F.values()].filter(M=>M.source.file===A.file&&E.has(M.id)),K=[...R.map(M=>({startLine:M.startLine,endLine:M.endLine})),...D.map(M=>({...rn(e,M)}))],Y=[..._,...K],ee=(ue(e,A.file)?.callSites??[]).filter(M=>Y.some(X=>M.line>=X.startLine&&M.line<=X.endLine)),H=new Set;if(s.has("call"))for(let M of Y){let X=jt(e,A.file,M.startLine,M.endLine);for(let G of X.targets){if(!p(G.definition.relativePath))continue;let de=j(G.sourceLine),De=R.find(Te=>Te.startLine<=G.sourceLine&&Te.endLine>=G.sourceLine),Le=D.find(Te=>{let he=rn(e,Te);return he.startLine<=G.sourceLine&&he.endLine>=G.sourceLine});fe(G.definition,g+1,`scip-occurrence-call:${A.file}:${G.sourceLine+1}`,void 0,"none",!0),we(q,{kind:"call",evidence:"scip-occurrence-callsite",fromFile:A.file,fromSymbol:de?.definition.symbol??null,toFile:G.definition.relativePath,toSymbol:G.definition.symbol,fromBoundaryParticipant:Le?ut(Le):void 0,fromSourceConstruct:De?Ee(De):void 0,line:G.sourceLine,strength:"exact"}),H.add(`${G.sourceLine}\0${G.calleeLeaf}`)}}if(s.has("reference"))for(let M of Y){let X=zo(e,A.file,M.startLine,M.endLine);for(let G of X.targets){if(!p(G.definition.relativePath)||H.has(`${G.sourceLine}\0${G.calleeLeaf}`))continue;let de=j(G.sourceLine);if(de?.definition.symbol===G.definition.symbol)continue;let De=R.find(Te=>Te.startLine<=G.sourceLine&&Te.endLine>=G.sourceLine),Le=D.find(Te=>{let he=rn(e,Te);return he.startLine<=G.sourceLine&&he.endLine>=G.sourceLine});fe(G.definition,g+1,`scip-occurrence-reference:${A.file}:${G.sourceLine+1}`,void 0,"none",!0),we(q,{kind:"reference",evidence:"scip-occurrence-reference",fromFile:A.file,fromSymbol:de?.definition.symbol??null,toFile:G.definition.relativePath,toSymbol:G.definition.symbol,fromBoundaryParticipant:Le?ut(Le):void 0,fromSourceConstruct:De?Ee(De):void 0,line:G.sourceLine,strength:"exact"})}}let J=s.has("call")?En(e,A.file,{ranges:Y,excludeIndexedTargets:!1}):{targets:[],unresolvedCallsites:0};oe+=J.unresolvedCallsites;let ce=J.targets.filter(M=>!H.has(`${M.line}\0${M.calleeLeaf}`));U+=ce.filter(M=>M.strength!=="exact"&&(M.resolution!=="imported-service-object-member"||(M.resolutionAlternativeCount??0)>1)).length;for(let M of ce){let X=(M.resolutionAlternativeCount??1)===1,G=M.targetSymbol?le(e,M.targetFile).find(he=>he.symbol===M.targetSymbol):void 0,de=G?null:v({file:M.targetFile,name:M.calleeLeaf,startLine:M.targetStartLine,endLine:M.targetEndLine},g+1,`member-call:${A.file}`,void 0,M.resolution==="imported-service-object-member"&&X,X);if(de&&M.serviceFile){let he=Oe(de),ft=ke.get(he)??new Set;for(let Ar of x.get(M.serviceFile)??[])ft.add(Ar);ke.set(he,ft)}G&&fe(G,g+1,`member-call:${A.file}`,void 0,"none",!0);let De=R.find(he=>he.startLine<=M.line&&he.endLine>=M.line),Le=j(M.line),Te=D.find(he=>{let ft=rn(e,he);return ft.startLine<=M.line&&ft.endLine>=M.line});we(q,{kind:"call",evidence:M.resolution==="constructed-member-receiver"?"ast-constructed-member-callsite":M.resolution==="factory-callback-member"?"ast-factory-callback-callsite":M.resolution==="imported-service-object-member"?"ast-service-member-callsite":"ast-member-import-candidate",fromFile:A.file,fromSymbol:Le?.definition.symbol??null,toFile:M.targetFile,toSymbol:G?.symbol??null,fromBoundaryParticipant:Te?ut(Te):void 0,fromSourceConstruct:De?Ee(De):void 0,toSourceConstruct:de?Ee(de):void 0,line:M.line,strength:M.resolution==="imported-service-object-member"?(M.resolutionAlternativeCount??0)===1?"derived":"candidate":M.strength??"candidate"})}for(let M of s.has("import")||s.has("call")?Sc(e,A.file):[]){if(!M.fromFile){if(s.has("import")){let G=C.get(M.shortName)??{name:M.shortName,fromFiles:new Set};G.fromFiles.add(A.file),C.set(M.shortName,G)}continue}if(!p(M.fromFile))continue;if(s.has("import")&&($e(M.fromFile,g+1,`import:${A.file}`,!1),we(q,{kind:"import",evidence:"indexed-or-source-import",fromFile:A.file,fromSymbol:null,toFile:M.fromFile,toSymbol:M.symbol,line:null,strength:"mixed"})),s.has("call")&&ee.length>0){let G=(M.source==="compiler"?Ve(e,y,M.symbol).matches:rt(e,M.fromFile,M.importedName)).filter(de=>!ve(de.symbol));for(let de of G){let De=ee.filter(Le=>Le.calleeLeaf===M.localName).map(Le=>Le.line);if(De.length!==0){fe(de,g+1,`source-call:${A.file}`,void 0,"none",!0);for(let Le of De)we(q,{kind:"call",evidence:"ast-callsite",fromFile:A.file,fromSymbol:null,toFile:de.relativePath,toSymbol:de.symbol,line:Le,strength:"derived"})}}}if(!A.promoteBoundaryImports||!Ec(A.file,M.fromFile,S))continue;let X=Ve(e,y,M.symbol);for(let G of X.matches)if(Lc(G.relativePath,M.fromFile,S)&&!ve(G.symbol)){let de=Ne(A.file,S).relativeDir!==Ne(G.relativePath,S).relativeDir;fe(G,g+1,`boundary-import:${A.file}`,void 0,de?"cross-workspace-or-forward":"forward-regions")}}}for(let A of s.has("runtime-boundary")?T?.links??[]:[]){if(A.strength==="candidate"||l==="exact"&&A.strength!=="exact"||I.has(A.id))continue;let R=F.get(A.from),_=F.get(A.to);if(!R||!_||!p(R.source.file)||!p(_.source.file))continue;let j=cr(R,g,E,b,$),D=cr(_,g,E,b,$);if(j===null&&D===null)continue;let K=g+1,Y=V(R,j??K,`runtime-boundary:${A.joinRule}`),ee=V(_,D??K,`runtime-boundary:${A.joinRule}`),H=Y?null:lr($,R),J=ee?null:lr($,_);E.set(R.id,j??K),E.set(_.id,D??K),we(q,{kind:"runtime-boundary",evidence:`runtime-boundary:${A.joinRule}`,fromFile:R.source.file,fromSymbol:Y,toFile:_.source.file,toSymbol:ee,fromBoundaryParticipant:ut(R),toBoundaryParticipant:ut(_),fromSourceConstruct:H?Ee(H):void 0,toSourceConstruct:J?Ee(J):void 0,runtimeBoundaryKey:A.matchedKeyParts.map(ce=>`${ce.name}=${ce.value}`).join(" "),line:R.source.startLine,strength:A.strength}),I.add(A.id)}}let W=new Map;for(let g of N.keys())W.set(g,Nt(g,S));let ge=[...q.values()].filter(g=>W.has(g.fromFile)&&W.has(g.toFile)).map(g=>({...g,fromRegionId:W.get(g.fromFile).id,toRegionId:W.get(g.toFile).id})).sort(gr),We=kc(ge),Rt=new Set(t.expand??[]),Qe=Tc(N,b,z,ge,We,W,Rt),Jn=new Set([...N.values()].filter(g=>[...g.origins].some(k=>k.startsWith("literal-anchor:")||k==="literal-owner"||k==="symbol-anchor")).map(g=>W.get(g.file).id)),eo=rc(Qe),Er=new Set(Qe.map(g=>g.id)),Lr=[...Rt].filter(g=>!Er.has(g)).sort();for(let g of w)if(g.matchedRegionIds=Dc(g,z,b,W),g.kind==="literal"){let k=z.filter(B=>B.query===g.query);g.seedRegionIds=Z(k.filter(B=>B.traversalSeed).map(B=>W.get(B.file).id)),g.matchOnlyRegionIds=Z(k.filter(B=>!B.traversalSeed).map(B=>W.get(B.file).id))}let to=[...b.values()].filter(g=>!g.processed).length,no=[...N.values()].filter(g=>g.primary&&!g.processed).length,oo=[...N.values()].filter(g=>!g.primary&&!g.processed).length,io=[...b.values()].filter(g=>g.processed),Mt=(T?.frontiers??[]).flatMap(g=>{let k=F.get(g.observationId);return!k&&g.source&&g.action&&g.strength?!s.has("runtime-boundary")||!p(g.source.file)||l==="exact"||!N.has(g.source.file)?[]:[{observationId:g.observationId,action:g.action,strength:g.strength,file:g.source.file,line:g.source.startLine,ownerShortName:g.ownerShortName??null,address:g.address??g.missingKeyParts.join(", "),reason:g.reason}]:!s.has("runtime-boundary")||!k||!p(k.source.file)||l==="exact"&&k.strength!=="exact"||!N.has(k.source.file)?[]:[{observationId:k.id,action:k.action,strength:k.strength,file:k.source.file,line:k.source.startLine,ownerShortName:k.owner.name,address:fr(k),reason:g.reason,protocol:k.protocol,role:k.role,modality:k.modality,resolution:k.resolution,sourceScope:k.sourceScope,keyParts:k.keyParts.map(B=>({name:B.name,value:B.value,evidence:B.evidence}))}]}).sort((g,k)=>g.file.localeCompare(k.file)||g.line-k.line),dn=(T?.links??[]).filter(g=>{if(!s.has("runtime-boundary")||l==="exact"&&g.strength!=="exact")return!1;let k=F.get(g.from),B=F.get(g.to);return!!(k&&B&&p(k.source.file)&&p(B.source.file)&&(N.has(k.source.file)||N.has(B.source.file)))}),Cr=dn.filter(g=>g.strength==="exact").length,Ir=dn.filter(g=>g.strength==="derived").length,wr=dn.filter(g=>g.strength==="candidate").length,Nr=T?.links.filter(g=>g.strength==="exact").length??0,Rr=T?.links.filter(g=>g.strength==="derived").length??0,Mr=T?.links.filter(g=>g.strength==="candidate").length??0,un=$c(C,W),pn=O===0?"accounted":"incomplete",ro=[...se>0?[`${se} broad literal anchor(s) withheld ${re} exact match(es) before graph traversal; representative identities and scoped search commands preserve recovery without treating every textual occurrence as relevant.`]:[],`Literal matches outside the included source scopes (${d.join(", ")}) remain visible as match-only evidence and do not seed traversal.`,T?"Built-in runtime-boundary extractors traverse direct and replayably derived links; heuristic candidates, unsupported frameworks, reflection, generated names, and dependency wiring not recoverable from compiler occurrences or constructor assignments remain disclosed frontiers.":"Runtime-boundary evidence is unavailable for this index; run scip-query reindex with this build to extract supported HTTP, event, registry, and persistence observations.","Reverse references do not recursively expand from discovered callers or callees.","Member calls use compiler occurrences, exact constructor-assigned fields, bounded unique service providers, direct factory-return members, and compiler-resolved object-literal callbacks when available. Ambiguous providers remain candidate frontiers; callback values routed through mutation, reflection, or unsupported dependency containers remain unrepresented.","Literal traversal is bounded to the smallest parser-delimited source construct; parser gaps may reduce an owner to one source line and leave its continuation untraversed.","Schema consumers stay within forward-flow regions; cross-workspace contracts may discover consumers in other workspaces. Add an explicit symbol anchor to widen either scope.",`Traversal stops after depth ${m}; nonzero frontier counts identify evidence that was discovered but not traversed.`,"Region labels are structural path groupings, not inferred runtime or architectural boundaries."],Me=Vl({db:e,anchors:w,regions:Qe,symbolStates:b,sourceConstructStates:$,literalHits:z,relations:ge,externalBoundaries:un,boundaryFrontiers:Mt,regionForFile:W,closureStatus:pn,omittedSymbolCandidates:O,maxDepth:m,requestedRelationKinds:a,evidenceFloor:l,includedSourceScopes:d,blindSpots:ro,topologyFrontiers:t.topologyFrontiers??[],routeIds:t.routeIds??[],expandedRegionIds:[...Rt],maxTopologyCharacters:h,fullLiteralTraversal:t.fullLiteralTraversal??!1});if(n==="topology")return Me;let ao=(t.behaviorFocusLocations?.length??0)>0?new Set([...Me.anchors.flatMap(g=>g.nodeIds),...Me.paths.flatMap(g=>g.nodeIds)]).size:void 0,Tt=Xo(e,Me,{focusLocations:t.behaviorFocusLocations,...ao?{maxSteps:ao}:{}});ii(e,Me,Tt);let Tr=Dl(e,Me,Tt,t.behaviorFocusLocations??[]);Me.corridor=Bi(Me,{focusLocations:Tr});let so=oi(e,Me,Tt,{sourceAllowed:p,selectionTerms:t.selectionTerms}),lo=Jl(Me),Fr=oc(o,r,m,a,l,d,t.fullLiteralTraversal??!1,h,Qe,We,Jn,Rt,lo),Pr=nc(o,r,m,Qe.filter(g=>lo.has(g.id)),Jn,a,l,d,t.fullLiteralTraversal??!1,h);return{anchors:w,regions:Qe,regionRelations:We,externalBoundaries:un,boundaryFrontiers:Mt,unmatchedExpansions:Lr,expansion:Pr,drilldown:eo,presentation:Fr,topology:Me,behavior:Tt,nextAnchors:so,closure:{status:pn,emitted:{regions:Qe.length,relations:ge.length,runtimeLinks:I.size},withheld:{symbols:to,files:no+oo,regions:Me.nodes.filter(g=>g.kind==="structural-region"&&g.disposition==="folded").length,drillAnchors:(eo?.omittedAnchors??0)+so.omittedAnchors,literalMatches:re},ambiguous:{anchors:w.filter(g=>g.status==="ambiguous").length,omittedSymbolCandidates:O},external:un.length,unresolved:Mt.length,explanation:pn==="accounted"?"Every fact reached under the declared anchors, relations, depth, evidence floor, source scopes, and installed analyzers is accounted for as emitted, withheld, ambiguous, external, or unresolved.":"Some ambiguous symbol candidates were not identified, so the declared query is not fully accounted for."},coverage:{explicitAnchorCount:w.length,requestedRelationKinds:a,evidenceFloor:l,includedSourceScopes:d,matchedAnchorCount:w.filter(g=>g.status!=="missing").length,literalSearchesComplete:!0,broadLiteralAnchors:se,withheldLiteralMatches:re,symbolCandidateSetsComplete:O===0,omittedSymbolCandidates:O,maxTraversalDepth:m,frontierSymbols:to,frontierFiles:no,supportFilesNotTraversed:oo,filteredUnverifiedCallEdges:ye,memberCallCandidateEdges:U,unresolvedMemberCallsites:oe,runtimeBoundaryEvidenceAvailable:T!==null,runtimeBoundaryObservations:T?.observations.length??0,runtimeBoundaryExactLinks:Cr,runtimeBoundaryDerivedLinks:Ir,runtimeBoundaryCandidateLinks:wr,repositoryRuntimeBoundaryExactLinks:Nr,repositoryRuntimeBoundaryDerivedLinks:Rr,repositoryRuntimeBoundaryCandidateLinks:Mr,runtimeBoundaryTraversedLinks:I.size,runtimeBoundaryFrontiers:Mt.length,referenceExpansionEligibleSymbols:io.filter(g=>g.referenceScope!=="none").length,referenceExpansionSkippedSymbols:io.filter(g=>g.referenceScope==="none").length,dynamicDispatchRepresented:T?.links.some(g=>g.joinRule==="carrier.discriminator"&&I.has(g.id))??!1,runtimeGeneratedLinksRepresented:T!==null,regionBoundariesAreStructural:!0,relationFamilies:{"literal-anchor":{evidence:"exact-source",scope:"all indexed documents for each explicit literal",completeWithinScope:!0},reference:{evidence:"compiler-graph",scope:"all cross-file indexed/source-attributed sites for explicit anchors and promoted non-module boundary symbols",completeWithinScope:!0},call:{evidence:"mixed",scope:"static callees plus exact SCIP call occurrences in traversed source ranges, exact constructor-assigned member receivers, and uniquely attributed direct-import member candidates",completeWithinScope:!0},"contract-symbol":{evidence:"compiler-graph",scope:"compiler-resolved symbol identities referenced across inferred workspace boundaries",completeWithinScope:!0},import:{evidence:"compiler-graph",scope:"all indexed or source-resolved imports of traversed primary files",completeWithinScope:!0},"runtime-boundary":{evidence:"exact-source",scope:"direct and mechanically derived links produced by grounded runtime adapters and factorized relation groups",completeWithinScope:!0}},blindSpots:ro}}}function Dl(e,t,n,o){let r=new Map,a=l=>{r.set(`${l.file}\0${l.line}`,l)};for(let l of o)a(l);let i=new Set(t.anchors.filter(l=>l.status==="matched").flatMap(l=>l.nodeIds));for(let l of n.steps)if(!(!l.location||!i.has(l.nodeId)||(l.behavior?.rawCharacters??1/0)>3e3))for(let d of l.behavior?.lines??[])d.signals.some(c=>Al.has(c))&&a({file:l.location.file,line:d.line,endLine:d.endLine});let s=t.edges.filter(l=>l.disposition==="emitted").flatMap(l=>l.evidence.flatMap(d=>d.location?[d.location]:[]));for(let l of s){a(l);let d=t.nodes.filter(u=>u.location?.file===l.file&&["symbol","source-construct","runtime-boundary-participant"].includes(u.kind)&&u.location.line<=l.line&&(u.location.endLine??u.location.line)>=l.line).sort((u,f)=>(u.location.endLine??u.location.line)-u.location.line-((f.location.endLine??f.location.line)-f.location.line)||u.id.localeCompare(f.id))[0];if(!d?.location)continue;let c=_t(e,l.file,d.location.line,d.location.endLine??d.location.line,[l.line]);for(let u of c)a({file:l.file,line:u.line,endLine:u.endLine})}return[...r.values()].sort((l,d)=>l.file.localeCompare(d.file)||l.line-d.line)}function _l(e){if(e.ownerStartLine===null||e.ownerStartLine===void 0)throw new Error(`Literal hit ${e.file}:${e.line+1} has no source-owner start line.`);if(e.ownerEndLine===null||e.ownerEndLine===void 0)throw new Error(`Literal hit ${e.file}:${e.line+1} has no source-owner end line.`);return{file:e.file,name:e.ownerShortName??`${e.file}:${e.ownerStartLine+1}`,startLine:e.ownerStartLine,endLine:e.ownerEndLine}}function Oe(e){return`${e.file}\0${e.startLine}\0${e.endLine}\0${e.name}`}function Ee(e){return{file:e.file,name:e.name,startLine:e.startLine,endLine:e.endLine}}function nr(e,t,n,o){if(n.calleeLeaf===o.leaf)return!0;let r=go(e,t,n.calleeLeaf);return r!==null&&r.importedName===o.leaf&&r.sourcePath!==null&&Xe(r.sourcePath,o.relativePath)}function an(e,t){let n=Pt(ue(e,t.file)?.callables??[],t.startLine);if(n&&n.endLine>=t.endLine)return{file:t.file,name:/^source@\d+$/u.test(n.name)&&!/^source@\d+$/u.test(t.name)?t.name:n.name,startLine:n.startLine,endLine:n.endLine};let o=mr(e,t.file,t.startLine);return o&&o.endLine>=t.endLine?{file:t.file,name:o.name,startLine:o.startLine,endLine:o.endLine}:Ee(t)}function pt(e){return Re("source-construct",e.file,String(e.startLine),String(e.endLine),e.name)}function sn(e,t){let n=wo(e,t.symbol,t.relativePath),o=new Set(["package-surface-file","transitive-package-surface"]),r=n.filter(i=>!o.has(i)||Ro(e,t)),a=r.some(i=>!o.has(i));return{evidence:r,priority:a||No(e,t.symbol,t.relativePath)?2:1}}function or(e,t){let n=sn(e,t);return n.evidence.length>0?n.priority:0}function Bl(e,t){let n=le(e,t.file),o=n.filter(r=>r.startLine<=t.startLine&&r.endLine>=t.startLine).sort((r,a)=>r.endLine-r.startLine-(a.endLine-a.startLine)||r.startLine-a.startLine);for(let r of o){let a=sn(e,r);if(a.evidence.length>0)return a}for(let r of Ol(e,t.file,t.startLine)){let a=n.filter(i=>i.leaf===r.name).sort((i,s)=>Math.abs(i.startLine-r.startLine)-Math.abs(s.startLine-r.startLine)||i.symbol.localeCompare(s.symbol));for(let i of a){let s=sn(e,i);if(s.evidence.length>0)return s}return{evidence:[],priority:0}}return{evidence:[],priority:0}}function Ol(e,t,n){let o=ae(e,t)?.rootNode;if(!o||o.startPosition.row>n||o.endPosition.row<n)return[];let r=[],a=Yn(o,n);for(;a;){if(a.type==="variable_declarator"||a.type==="function_declaration"||a.type==="generator_function_declaration"||a.type==="class_declaration"){let i=a.childForFieldName("name")??a.namedChild(0);(i?.type==="identifier"||i?.type==="type_identifier")&&r.push({name:i.text,startLine:a.startPosition.row})}a=a.parent}return r}function Gl(e){return[...new Map([...e.sourceConstructStates.values()].map(t=>an(e.db,t)).map(t=>[Oe(t),t])).values()].sort((t,n)=>t.file.localeCompare(n.file)||t.startLine-n.startLine||t.endLine-n.endLine)}function jl(e,t){return e.anchors.map((n,o)=>{let r=Re("anchor",String(o),n.kind,n.query),a=[...e.symbolStates.values()].filter(c=>c.anchorQueries.has(n.query)).flatMap(c=>{if(!ve(c.definition.symbol))return[Ye(c.definition.symbol)];let u=t.filter(f=>f.file===c.definition.relativePath).map(f=>pt(f));return u.length>0?u:[Ye(c.definition.symbol)]}),i=[...e.sourceConstructStates.values()].filter(c=>c.anchorQueries.has(n.query)).map(c=>pt(an(e.db,c))),s=e.literalHits.filter(c=>c.query===n.query&&c.traversalSeed===!0&&c.ownerSymbol&&e.symbolStates.has(c.ownerSymbol)).map(c=>Ye(c.ownerSymbol)),l=e.literalHits.filter(c=>c.query===n.query&&c.traversalSeed===!0&&!c.ownerSymbol&&c.ownerStartLine!==null&&c.ownerStartLine!==void 0&&c.ownerEndLine!==null&&c.ownerEndLine!==void 0).map(c=>pt(an(e.db,_l(c)))),d=Z(n.kind==="symbol"?[...a,...i]:s.length+l.length>0?[...s,...l]:n.seedRegionIds??[]);return{id:r,kind:n.kind,query:n.query,status:n.status,nodeIds:n.status==="ambiguous"?[]:d,candidateNodeIds:n.status==="ambiguous"?d:[],omittedCandidates:n.omittedSymbolCandidates??0}})}function Kl(e){let t=new Map;for(let n of e)for(let o of[...n.nodeIds,...n.candidateNodeIds]){let r=t.get(o)??[];r.push(n.id),t.set(o,r)}return t}function ql(e,t,n){let o=e.relations.flatMap(i=>[i.fromBoundaryParticipant,i.toBoundaryParticipant].flatMap(s=>s?.ownerName?[s]:[])),r=e.regions.map(i=>({id:i.id,kind:"structural-region",label:i.label,disposition:"folded",location:null,anchorIds:Z(n.get(i.id)??[]),attributes:{workspace:i.workspace,structuralPath:i.structuralPath,minimumDepth:i.minDepth,files:i.fileCount,symbols:i.symbolCount,expanded:i.expanded}}));for(let i of e.symbolStates.values()){let s=e.regionForFile.get(i.definition.relativePath)?.id;if(!s)throw new Error(`System-map symbol ${i.definition.symbol} has no structural region.`);let l=Ye(i.definition.symbol),d=sn(e.db,i.definition);r.push({id:l,kind:"symbol",label:pe(i.definition.symbol),disposition:(n.get(l)?.length??0)>0?"emitted":"folded",location:{file:i.definition.relativePath,line:i.definition.startLine,endLine:i.definition.endLine},anchorIds:Z(n.get(l)??[]),attributes:{regionId:s,depth:i.depth,leaf:i.definition.leaf??pe(i.definition.symbol),referenceScope:i.referenceScope,...d.evidence.length>0?{publicEntry:!0,publicEntryPriority:d.priority,publicEntryEvidence:d.evidence.join(",")}:{}}})}for(let i of t){let s=e.regionForFile.get(i.file)?.id;if(!s)throw new Error(`Source construct ${i.name} has no structural region.`);let l=pt(i),c=o.find(f=>f.file===i.file&&f.line>=i.startLine&&f.line<=i.endLine)?.ownerName??i.name,u=Bl(e.db,i);r.push({id:l,kind:"source-construct",label:c,disposition:(n.get(l)?.length??0)>0?"emitted":"folded",location:{file:i.file,line:i.startLine,endLine:i.endLine},anchorIds:Z(n.get(l)??[]),attributes:{regionId:s,leaf:c,sourceOwned:!0,...u.evidence.length>0?{publicEntry:!0,publicEntryPriority:u.priority,publicEntryEvidence:u.evidence.join(",")}:{}}})}let a=new Map;for(let i of e.relations)i.fromBoundaryParticipant&&a.set(i.fromBoundaryParticipant.observationId,i.fromBoundaryParticipant),i.toBoundaryParticipant&&a.set(i.toBoundaryParticipant.observationId,i.toBoundaryParticipant);for(let i of[...a.values()].sort((s,l)=>s.observationId.localeCompare(l.observationId))){let s=e.regionForFile.get(i.file)?.id;if(!s)throw new Error(`Runtime-boundary participant ${i.observationId} has no structural region.`);r.push({id:Qn(i.observationId),kind:"runtime-boundary-participant",label:i.address||i.ownerName||`${i.role} ${i.action}`,disposition:"folded",location:{file:i.file,line:i.line,endLine:i.endLine},anchorIds:[],attributes:{regionId:s,action:i.action,protocol:i.protocol,role:i.role,...i.address?{address:i.address}:{},ownerSymbol:i.ownerSymbol}})}return r}function zl(e,t,n,o,r,a,i,s,l,d=!1){let c=o?Ye(o):null;if(c&&t.has(c)&&!ve(o))return c;let u=r?Qn(r.observationId):null;if(d&&u&&t.has(u))return u;let f=a?pt(an(e,a)):null;if(f&&t.has(f))return f;if(u&&t.has(u))return u;let p=l===null?null:(n.get(s)??[]).filter(m=>m.startLine<=l&&m.endLine>=l).sort((m,h)=>m.endLine-m.startLine-(h.endLine-h.startLine)||m.startLine-h.startLine)[0]??null;return p?pt(p):c&&t.has(c)?c:i}function Ul(e,t,n){let o=new Set(t.map(d=>d.id)),r=Pe(n,d=>d.file),a=(d,c,u,f,p,m,h=!1)=>zl(e.db,o,r,d,c,u,f,p,m,h),i=[];for(let d of e.symbolStates.values()){let c=e.regionForFile.get(d.definition.relativePath)?.id;if(!c)continue;let u=Ye(d.definition.symbol);i.push({id:Re("edge","structural-membership",c,u),kind:"structural-membership",fromNodeId:c,toNodeId:u,directed:!0,disposition:"folded",semantics:Wt("structural-membership"),evidence:[{method:"indexed-definition-file",strength:"exact",identity:d.definition.symbol,location:{file:d.definition.relativePath,line:d.definition.startLine,endLine:d.definition.endLine}}]})}let s=Pe(e.relations,d=>`${a(d.fromSymbol,d.fromBoundaryParticipant,d.fromSourceConstruct,d.fromRegionId,d.fromFile,d.line,d.kind==="runtime-boundary")}\0${a(d.toSymbol,d.toBoundaryParticipant,d.toSourceConstruct,d.toRegionId,d.toFile,null)}\0${d.kind}`),l=new Set;for(let d of s.values()){let c=d[0],u=a(c.fromSymbol,c.fromBoundaryParticipant,c.fromSourceConstruct,c.fromRegionId,c.fromFile,c.line,c.kind==="runtime-boundary"),f=a(c.toSymbol,c.toBoundaryParticipant,c.toSourceConstruct,c.toRegionId,c.toFile,null);if(c.kind==="runtime-boundary"&&c.fromBoundaryParticipant){let m=Qn(c.fromBoundaryParticipant.observationId),h=a(c.fromSymbol,void 0,c.fromSourceConstruct,c.fromRegionId,c.fromFile,c.line);h!==m&&!l.has(m)&&(l.add(m),i.push({id:Re("edge","boundary-observation",h,m),kind:"boundary-observation",fromNodeId:h,toNodeId:m,directed:!0,disposition:"folded",semantics:Wt("boundary-observation"),evidence:[{method:"runtime-boundary-observation-owner",strength:c.strength??"unknown",identity:c.fromBoundaryParticipant.observationId,location:{file:c.fromBoundaryParticipant.file,line:c.fromBoundaryParticipant.line,endLine:c.fromBoundaryParticipant.endLine}}]}))}(u===f?t.find(m=>m.id===u):null)?.kind!=="structural-region"&&i.push({id:Re("edge",c.kind,u,f),kind:c.kind,fromNodeId:u,toNodeId:f,directed:!0,disposition:"folded",semantics:ci(c),evidence:ec(d.map(m=>({method:m.evidence,strength:m.strength??"unknown",identity:m.kind==="runtime-boundary"&&m.runtimeBoundaryKey?m.runtimeBoundaryKey:`${m.fromSymbol??m.fromFile} -> ${m.toSymbol??m.toFile}`,location:m.line===null?null:{file:m.fromFile,line:m.line}})))})}return i}function Wl(e,t,n){for(let r of e.externalBoundaries){let a=Re("external",r.kind,r.name),i=Z(r.fromRegionIds);t.push({id:a,kind:r.kind,label:r.name,disposition:"folded",location:null,anchorIds:[],attributes:{}});for(let s of i)n.push({id:Re("edge",r.kind,s,a),kind:r.kind,fromNodeId:s,toNodeId:a,directed:!0,disposition:"folded",semantics:Wt("external-import"),evidence:[{method:"indexed-or-source-import",strength:"mixed",identity:`${s} -> ${r.name}`,location:null}]})}let o=[];return e.boundaryFrontiers.forEach((r,a)=>{let i=e.regionForFile.get(r.file)?.id;if(!i)throw new Error(`Runtime-boundary frontier ${r.observationId} has no system-map region.`);let s=Re("unsupported","runtime-boundary",r.observationId,String(a)),l=Re("edge","runtime-boundary-frontier",i,s);t.push({id:s,kind:"runtime-boundary-frontier",label:r.address,disposition:"unsupported",location:{file:r.file,line:r.line},anchorIds:[],attributes:{action:r.action,strength:r.strength,owner:r.ownerShortName}}),n.push({id:l,kind:"runtime-boundary-frontier",fromNodeId:i,toNodeId:s,directed:!0,disposition:"unsupported",evidence:[{method:"runtime-boundary-extractor",strength:r.strength,identity:r.observationId,location:{file:r.file,line:r.line}}]}),o.push({id:Re("frontier","runtime-boundary",r.observationId,String(a)),kind:"runtime-boundary",direction:"unresolved",fromNodeIds:[i],edgeIds:[l],memberNodeIds:[s],memberCount:1,disposition:"unsupported",reason:r.reason,expansion:null})}),o}function Hl(e,t){let n=t.topologyFrontiers.some(m=>m==="frontier:program-facts"),o=Xi(e,{expandedFrontierIds:t.topologyFrontiers.filter(m=>m!=="frontier:program-facts"),routeIds:t.routeIds}),r=o.nodes.filter(m=>m.disposition==="emitted"||o.anchors.some(h=>h.status==="matched"&&h.nodeIds.includes(m.id))),a=t.relations.filter(m=>r.some(h=>Yl(m,h))),i=t.boundaryFrontiers.filter(m=>r.some(h=>Ql(m,h))),s=Si(t.db,a,r),l=xi(t.db,r),d=Ai(t.db,r,i),c=[...s.nodes,...l.nodes,...d.nodes].map(m=>n&&m.disposition==="folded"?{...m,disposition:"emitted"}:m),u=[...s.edges,...l.edges,...d.edges].map(m=>n&&m.disposition==="folded"?{...m,disposition:"emitted"}:m),f=n?null:Xl(r,c,u),p=on({anchors:o.anchors,nodes:[...o.nodes,...c],edges:[...o.edges,...u],paths:o.paths,frontiers:[...o.frontiers,...s.frontiers,...l.frontiers,...d.frontiers,...f?[f]:[]],scope:o.coverage.scope,blindSpots:[...o.coverage.blindSpots,...s.blindSpots,...l.blindSpots,...d.blindSpots],incompleteReasons:o.coverage.status==="incomplete"?[o.coverage.explanation]:[],...o.routeCatalog?{routeCatalog:o.routeCatalog}:{}});p.completion=o.completion;for(let m of p.frontiers)m.disposition==="folded"&&(m.id.startsWith("frontier:program-facts:")||(m.expansion=Zl(t,m.id)));return p}function Vl(e){let t=Gl(e),n=jl(e,t),o=ql(e,t,Kl(n)),r=Ul(e,o,t),a=Wl(e,o,r);return Hl(on({anchors:n,nodes:o,edges:r,paths:[],frontiers:a,scope:`explicit anchors; relations ${e.requestedRelationKinds.join(", ")}; depth ${e.maxDepth}; evidence floor ${e.evidenceFloor}; source scopes ${e.includedSourceScopes.join(", ")}`,blindSpots:[...e.blindSpots],incompleteReasons:e.closureStatus==="incomplete"?[`${e.omittedSymbolCandidates} ambiguous symbol candidate(s) were omitted`]:[]}),e)}function Yl(e,t){if(e.fromSymbol&&t.id===Ye(e.fromSymbol)||e.toSymbol&&t.id===Ye(e.toSymbol))return!0;if(!t.location)return!1;let n=t.location.endLine??t.location.line;return t.location.file===e.fromFile&&e.line!==null&&e.line>=t.location.line&&e.line<=n||t.location.file===e.toFile}function Ql(e,t){if(!t.location||t.location.file!==e.file)return!1;let n=t.location.endLine??t.location.line;return e.line>=t.location.line&&e.line<=n||t.label===e.ownerShortName||typeof e.ownerShortName=="string"&&t.label.includes(e.ownerShortName)}function Xl(e,t,n){let o=Z(t.filter(a=>a.disposition==="folded").map(a=>a.id)),r=Z(n.filter(a=>a.disposition==="folded").map(a=>a.id));return o.length===0&&r.length===0?null:{id:Re("frontier","program-facts"),kind:"program-facts",direction:"outgoing",fromNodeIds:Z(e.map(a=>a.id)),edgeIds:r,memberNodeIds:o,memberCount:o.length,disposition:"folded",reason:"Control, data, state, and temporal facts are folded beneath the selected high-level owners.",expansion:null}}function Zl(e,t){return`scip-query system-map ${[...e.anchors.flatMap(o=>o.kind==="literal"?[`--search ${ne(o.query)}`]:[`--symbol ${ne(o.query)}`]),`--depth ${e.maxDepth}`,...e.requestedRelationKinds.map(o=>`--relation ${ne(o)}`),`--evidence-floor ${ne(e.evidenceFloor)}`,...e.includedSourceScopes.map(o=>`--source-scope ${ne(o)}`),...e.fullLiteralTraversal?["--full-literal-traversal"]:[],`--topology-characters ${e.maxTopologyCharacters}`,...e.expandedRegionIds.map(o=>`--expand ${ne(o)}`),...e.topologyFrontiers.map(o=>`--frontier ${ne(o)}`),...e.routeIds.map(o=>`--route ${ne(o)}`),`--frontier ${ne(t)}`].join(" ")}`}function Jl(e){let t=new Set;for(let n of e.nodes){if(n.disposition!=="emitted")continue;n.kind==="structural-region"&&t.add(n.id);let o=n.attributes.regionId;typeof o=="string"&&t.add(o)}return t}function ec(e){let t=new Map;for(let n of e){let o=n.location?`${n.location.file}:${n.location.line}`:"";t.set(`${n.method}\0${n.strength}\0${n.identity??""}\0${o}`,n)}return[...t.values()].sort((n,o)=>n.method.localeCompare(o.method)||(n.identity??"").localeCompare(o.identity??"")||(n.location?.file??"").localeCompare(o.location?.file??"")||(n.location?.line??0)-(o.location?.line??0))}function Re(...e){return e.map(t=>encodeURIComponent(t)).join(":")}function Ye(e){return Re("symbol",e)}function tc(e){return e==="semantic-callee"||e==="scip-chunk"?"exact":"derived"}function nc(e,t,n,o,r,a,i,s,l,d){let c=[...o].sort((h,y)=>pr(h,y,r)),f=c.slice(0,Ji).map(h=>h.id),p=c.slice(Ji).map(h=>h.id),m=[...e.map(h=>`--search ${ne(h)}`),...t.map(h=>`--symbol ${ne(h)}`),`--depth ${n}`,...a.map(h=>`--relation ${ne(h)}`),`--evidence-floor ${ne(i)}`,...s.map(h=>`--source-scope ${ne(h)}`),...l?["--full-literal-traversal"]:[],`--topology-characters ${d}`,...f.map(h=>`--expand ${ne(h)}`)];return{command:f.length===0?null:`scip-query system-map ${m.join(" ")}`,regionCount:f.length,regionIds:f,candidateRegionCount:o.length,omittedRegionIds:p}}function oc(e,t,n,o,r,a,i,s,l,d,c,u,f){let p=[...l].sort((b,$)=>pr(b,$,c)).filter(b=>!f||f.has(b.id)||u.has(b.id)),m=d.length>0?Math.floor(s*.4):0,h=s-m,y=new Set,L=0;for(let b of p){let $=ir(b);!u.has(b.id)&&y.size>0&&L+$>h||(y.add(b.id),L+=$)}let x=d.filter(b=>y.has(b.fromRegionId)&&y.has(b.toRegionId)).sort(ic),S=[];for(let b of x){let $=rr(b);S.length>0&&L+$>s||(S.push(ln(b)),L+=$)}let T=l.filter(b=>!y.has(b.id)).map(b=>b.id).sort(),F=new Set(S),P=d.filter(b=>!F.has(ln(b))).length,I=l.reduce((b,$)=>b+ir($),0)+d.reduce((b,$)=>b+rr($),0),E=p.every(b=>y.has(b.id))&&S.length===x.length,N=[...e.map(b=>`--search ${ne(b)}`),...t.map(b=>`--symbol ${ne(b)}`),`--depth ${n}`,...o.map(b=>`--relation ${ne(b)}`),`--evidence-floor ${ne(r)}`,...a.map(b=>`--source-scope ${ne(b)}`),...i?["--full-literal-traversal"]:[],`--topology-characters ${Math.max(s,I)}`];return{maxCharacters:s,estimatedCharacters:L,totalEstimatedCharacters:I,regionIds:[...y],omittedRegionIds:T,relationKeys:S,omittedRelations:P,complete:E,expansionCommand:E?null:`scip-query system-map ${N.join(" ")}`}}function ir(e){return 120+e.id.length+e.anchorQueries.join(",").length+e.relationKinds.join(",").length+e.notableSymbols.slice(0,2).reduce((t,n)=>t+n.shortName.length+n.file.length,0)}function rr(e){return 70+e.fromRegionId.length+e.toRegionId.length+e.kinds.join(",").length+e.evidence.join(",").length}function ic(e,t){let n=o=>o.kinds.includes("runtime-boundary")?0:o.kinds.includes("contract-symbol")?1:2;return n(e)-n(t)||t.relationCount-e.relationCount||ln(e).localeCompare(ln(t))}function ln(e){return`${e.fromRegionId}\0${e.toRegionId}`}function pr(e,t,n){let o=s=>n.has(s.id)?0:1,r=s=>s.sourceFileCount===0?1:0,a=s=>s.symbolCount+s.literalHitCount>0?0:1,i=s=>[...s.incomingRegionIds,...s.outgoingRegionIds].filter(l=>n.has(l)).length;return o(e)-o(t)||a(e)-a(t)||r(e)-r(t)||e.minDepth-t.minDepth||i(t)-i(e)||t.literalHitCount-e.literalHitCount||e.testFileCount-t.testFileCount||e.label.localeCompare(t.label)}function rc(e){let t=[],n=new Set;for(let r of e.filter(a=>a.expanded)){for(let l of r.symbols)l.origins.includes("symbol-anchor")&&n.add(l.file);let a=Pe(r.symbols,l=>l.file),i=Pe(r.literalHits,l=>l.file),s=[...r.files].sort((l,d)=>sc(l,d,a,i));for(let l of s){let d=(a.get(l.file)??[]).sort(Fo)[0];if(d){t.push({kind:"symbol",regionId:r.id,file:d.file,line:d.startLine,endLine:d.endLine,label:d.shortName});continue}let c=(i.get(l.file)??[]).sort(yr)[0];c&&t.push({kind:"literal",regionId:r.id,file:c.file,line:c.line,endLine:null,label:c.ownerShortName??c.query})}}let o=ac(t,n);return{command:o.length===0?null:`scip-query inspect ${o.map(r=>`--at ${ne(`${r.file}:${r.line+1}`)}`).join(" ")} --view behavior`,definitionCommand:null,candidateAnchors:t.length,selectedAnchors:o.length,omittedAnchors:t.length-o.length,anchors:o}}function ac(e,t){let n=[...Pe(e,i=>i.regionId).values()],o=[],r=new Set,a=Math.min(Fl,24);for(let i of e)if(!(!t.has(i.file)||r.has(i.file))&&(o.push(i),r.add(i.file),o.length===a))return o;for(let i=0;o.length<a;i+=1){let s=!1;for(let l of n){let d=l[i];if(d&&(s=!0,!r.has(d.file)&&(o.push(d),r.add(d.file),o.length===a)))break}if(!s)break}return o}function sc(e,t,n,o){let r=s=>s.kind==="test"?2:s.kind==="barrel"?1:0,a=s=>(o.get(s.file)??[]).some(l=>l.traversalSeed)?0:1,i=s=>{let l=n.get(s.file)??[];return Math.min(5,...l.map(d=>at(d.origins)))};return r(e)-r(t)||a(e)-a(t)||i(e)-i(t)||e.depth-t.depth||e.file.localeCompare(t.file)}function ne(e){return`'${e.replaceAll("'","'\\''")}'`}function lc(e,t,n,o){let r=[];for(let a of mo(e,{includeIgnored:!1})){let i=Ce(e,a);if(i.length===0)continue;let s=[];for(let c=0;c<i.length;c+=1){let u=i[c]??"";u.includes(n)&&s.push({line:c,sourceLine:u})}if(s.length===0)continue;let l=t.definitionsForFile(a),d=ue(e,a)?.callables??[];for(let{line:c,sourceLine:u}of s){let f=it(l,c),p=Pt(d,c),m=f&&!ve(f.symbol)?f:null,h=m?.startLine??p?.startLine??f?.startLine??c,y=m?.endLine??p?.endLine??f?.endLine??c,L=xn(e,a,c,h,y),x=o.has(`${a}\0${c}`),S=!!(m?.isFunctionLike||p);r.push({relativePath:a,line:c,sourceLine:u,ownerSymbol:m?.symbol??null,ownerShortName:m?pe(m.symbol):p?.name??(f?pe(f.symbol):null),ownerStartLine:L.startLine,ownerEndLine:L.endLine,matchKind:pc(u,n),seedPriority:x?0:S?1:2})}}return r}function cc(e,t){let n={"exact-value":0,boundary:1,embedded:2};return e.seedPriority-t.seedPriority||n[e.matchKind]-n[t.matchKind]||e.relativePath.localeCompare(t.relativePath)||e.line-t.line}function ar(e){return`${e.relativePath}\0${e.line}`}function Wn(e,t,n){let r=Pt(ue(e,t)?.callables??[],n)??mr(e,t,n);if(!r)return null;let a=xn(e,t,n,r.startLine,r.endLine);return{file:t,name:r.name,startLine:a.startLine,endLine:a.endLine}}function mr(e,t,n){let o=ae(e,t)?.rootNode;if(!o||o.startPosition.row>n||o.endPosition.row<n)return null;let r=Yn(o,n);for(;r;){if(r.type==="variable_declarator"){let i=r.childForFieldName("name")??r.namedChild(0),s=r.childForFieldName("value")??r.namedChild(1);if(i?.type==="identifier"&&s&&Hn(s,n))return{name:i.text,startLine:r.startPosition.row,endLine:r.endPosition.row}}if(r.type==="pair"){let i=r.childForFieldName("key")??r.namedChild(0),s=r.childForFieldName("value")??r.namedChild(1),l=i?.text.replace(/^(?:['"])(.*)(?:['"])$/u,"$1");if(l&&s&&/^[A-Za-z_$][\w$]*$/u.test(l)&&Hn(s,n))return{name:l,startLine:r.startPosition.row,endLine:r.endPosition.row}}r=r.parent}let a=vn(e,t,n);return a?{name:`source@${n+1}`,startLine:a.startLine,endLine:a.endLine}:null}function Hn(e,t){return["arrow_function","function_expression","generator_function","generator_function_declaration"].includes(e.type)&&e.startPosition.row<=t&&e.endPosition.row>=t?!0:e.namedChildren.some(n=>n.startPosition.row<=t&&n.endPosition.row>=t&&Hn(n,t))}function Yn(e,t){let n=e.namedChildren.filter(o=>o.startPosition.row<=t&&o.endPosition.row>=t).sort((o,r)=>o.endIndex-o.startIndex-(r.endIndex-r.startIndex)||o.startPosition.row-r.startPosition.row)[0];return n?Yn(n,t):e}function dc(e,t){let n=t.match(/^(.+):(\d+)(?:-(\d+))?$/u);if(!n)return null;let o=fo(e,n[1],{allowMultiple:!1})[0]?.relativePath;if(!o)return null;let r=Math.max(0,Number.parseInt(n[2],10)-1),a=n[3]?Math.max(r,Number.parseInt(n[3],10)-1):r,i=(ue(e,o)?.callables??[]).filter(s=>s.startLine<=r&&s.endLine>=a).sort((s,l)=>s.endLine-s.startLine-(l.endLine-l.startLine)||s.startLine-l.startLine)[0];return i?{file:o,name:i.name,startLine:i.startLine,endLine:i.endLine}:null}function uc(e){return{symbol:`source-construct:${e.file}:${e.startLine}:${e.endLine}:${e.name}`,shortName:e.name,relativePath:e.file,startLine:e.startLine,endLine:e.endLine}}function pc(e,t){let n=/[\p{L}\p{N}_$]/u,o=e.indexOf(t);for(;o>=0;){let r=e[o-1]??"",a=e[o+t.length]??"";if((r==="'"||r==='"'||r==="`")&&a===r)return"exact-value";if(!n.test(r)&&!n.test(a))return"boundary";o=e.indexOf(t,o+Math.max(1,t.length))}return"embedded"}function Vn(e){return At(e)==="test"?!1:!/(?:^|[/._-])(?:fixtures?|mocks?|previews?|demos?|examples?|stories)(?:[/._-]|$)/iu.test(e)}function mc(e,t){return e.matchKind!=="embedded"&&t(e.relativePath)&&(gn(e.relativePath)!=="production"||Vn(e.relativePath))}function fc(e,t){let n=[...t].sort(gc),o=[],r=new Set;for(let a of n)if(!r.has(a.relativePath)&&(o.push(a),r.add(a.relativePath),o.length>=Zi))break;for(let a of n){if(o.length>=Zi)break;o.includes(a)||o.push(a)}return o.map(a=>({query:e,file:a.relativePath,line:a.line,ownerSymbol:a.ownerSymbol,ownerShortName:a.ownerShortName,ownerStartLine:a.ownerStartLine,ownerEndLine:a.ownerEndLine,sourceLine:a.sourceLine.trim(),matchKind:a.matchKind,traversalSeed:!1}))}function gc(e,t){let n={"exact-value":0,boundary:1,embedded:2};return n[e.matchKind]-n[t.matchKind]||+(t.ownerSymbol!==null)-+(e.ownerSymbol!==null)||+!Vn(e.relativePath)-+!Vn(t.relativePath)||e.relativePath.localeCompare(t.relativePath)||e.line-t.line}function yc(e,t){let n=new Map;for(let o of t){let r=hc(o.relativePath);n.set(r,(n.get(r)??0)+1)}return[...n].sort(([o,r],[a,i])=>i-r||o.localeCompare(a)).slice(0,Ml).map(([o])=>`scip-query search ${ne(e)} --scope ${ne(o)}`)}function hc(e){let t=e.split("/").filter(Boolean);if(t.length<=1)return e;let n=t.slice(0,-1),o=n.lastIndexOf("src");return o>=0?n.slice(0,Math.min(n.length,o+3)).join("/"):n.slice(0,Math.min(n.length,3)).join("/")}function bc(e,t,n){let o=t.callerFileMap([n],{semantic:!1}).get(n.symbolId)??new Set,r=[];for(let a of[...o].sort()){let i=Ge(e,a).filter(c=>c.importedName===n.leaf&&c.sourcePath!==null&&Xe(c.sourcePath,n.relativePath)),s=new Set;if(i.length>0)for(let c of i)s.add(c.localName??c.importedName);else n.leaf&&s.add(n.leaf);let l=[...new Set([...s].flatMap(c=>je(e,a,c)))].sort((c,u)=>c-u);if(l.length===0){r.push({file:a,line:null,enclosingSymbol:null});continue}let d=t.definitionsForFile(a);for(let c of l)r.push({file:a,line:c,enclosingSymbol:it(d,c)?.symbol??null})}return r}function Sc(e,t){let n=e.all(`SELECT DISTINCT gs.symbol, def_d.relative_path AS from_file
7
- FROM mentions m
8
- JOIN chunks c ON m.chunk_id = c.id
9
- JOIN documents imp_d ON c.document_id = imp_d.id
10
- JOIN global_symbols gs ON m.symbol_id = gs.id
11
- LEFT JOIN (
12
- SELECT m2.symbol_id, c2.document_id
13
- FROM mentions m2
14
- JOIN chunks c2 ON m2.chunk_id = c2.id
15
- WHERE m2.role = 1
16
- GROUP BY m2.symbol_id
17
- ) sym_def ON sym_def.symbol_id = gs.id
18
- LEFT JOIN documents def_d ON sym_def.document_id = def_d.id
19
- WHERE imp_d.relative_path = ? AND m.role = 2
20
- ORDER BY def_d.relative_path, gs.symbol`,t);return n.length>0?n.map(o=>({symbol:o.symbol,shortName:pe(o.symbol),importedName:sr(pe(o.symbol)),localName:sr(pe(o.symbol)),fromFile:o.from_file,source:"compiler"})):Ge(e,t).map(o=>{let r=vc(o.importedName,o.localName,o.kind),a=o.localName??o.importedName,i=o.importedName==="default"?a:o.importedName;return{symbol:r,shortName:r,importedName:i,localName:a,fromFile:o.sourcePath,source:"parsed-source"}})}function sr(e){return e.slice(e.lastIndexOf(":")+1).replace(/\(\)$/u,"")||e}function vc(e,t,n){return n==="namespace"&&e==="*"&&t?`* as ${t}`:n==="default"&&t?`default as ${t}`:n==="side-effect"?"(side effect import)":t&&t!==e?`${e} as ${t}`:e}function Ve(e,t,n){let o=yn(e,n);if(!o.match)return{matches:[],total:0,omitted:0};let r=[o.match,...o.candidates.map(i=>yn(e,i.symbol).match)].filter(i=>i!==null),a=new Map;for(let i of r){let s=t.definitionsForFile(i.relativePath).find(l=>l.symbol===i.symbol);s&&a.set(s.symbol,s)}return{matches:[...a.values()],total:o.total,omitted:Math.max(0,o.total-a.size)}}function xc(e){return{symbol:e.symbol,shortName:pe(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine}}function we(e,t){let n=[t.kind,t.fromFile,t.fromSymbol??"",t.toFile,t.toSymbol??"",t.fromBoundaryParticipant?.observationId??"",t.toBoundaryParticipant?.observationId??"",t.fromSourceConstruct?Oe(t.fromSourceConstruct):"",t.toSourceConstruct?Oe(t.toSourceConstruct):"",t.runtimeBoundaryKey??"",t.line??""].join("\0");e.set(n,t)}function ut(e){return{observationId:e.id,action:e.action,protocol:e.protocol,role:e.role,address:fr(e),file:e.source.file,line:e.source.startLine,endLine:e.source.endLine,ownerName:e.owner.name,ownerSymbol:e.owner.symbol}}function rn(e,t){let n=Ce(e,t.source.file);return gt(e,t.source.file,0,Math.max(0,n.length-1),[t.source.startLine])}function lr(e,t){let n=[...e.values()];for(let o of[t.owner,t.source]){let r=n.filter(a=>a.file===o.file&&a.startLine<=o.startLine&&a.endLine>=o.startLine).sort((a,i)=>a.endLine-a.startLine-(i.endLine-i.startLine)||a.startLine-i.startLine)[0];if(r)return r}return null}function cr(e,t,n,o,r){let a=[],i=n.get(e.id);i!==void 0&&i<=t&&a.push(i);for(let s of o.values()){if(s.depth>t)continue;let l=s.definition;dr(l,e)&&a.push(s.depth)}for(let s of r.values())s.depth>t||dr(s,e)&&a.push(s.depth);return a.length>0?Math.min(...a):null}function dr(e,t){let n=e.relativePath??e.file;return[t.owner,t.source].some(o=>n===o.file&&e.startLine<=o.startLine&&e.endLine>=o.startLine)}function Qn(e){return Re("runtime-boundary-participant",e)}function Ec(e,t,n){let o=Ne(e,n),r=Ne(t,n);return o.relativeDir!==r.relativeDir?!0:/(?:^|\/)(?:contracts?|schemas?|db\/schema)(?:\/|$)/u.test(t)}function Lc(e,t,n){return Nt(e,n).id===Nt(t,n).id}function Cc(e,t,n,o){if(e.referenceScope==="all")return!0;let r=Nt(t,o).id;return[...n.values()].some(i=>i.promoteBoundaryImports&&Nt(i.file,o).id===r)?!0:e.referenceScope!=="cross-workspace-or-forward"?!1:Ne(t,o).relativeDir!==Ne(e.definition.relativePath,o).relativeDir}function Ic(e,t){let n={none:0,"forward-regions":1,"cross-workspace-or-forward":2,all:3};return n[e]>=n[t]?e:t}function wc(e,t){let n=tr.get(e);if(n)return n;let o=t.fileDependencyGraph(),r={fileGraph:o,reverseFileGraph:Nc(o),workspaces:Rc(t.sourceFiles()),runtimeBoundaries:Co(e)};return tr.set(e,r),r}function Nc(e){let t=new Map;for(let[n,o]of e)for(let r of o){let a=t.get(r)??new Set;a.add(n),t.set(r,a)}return t}function Ne(e,t){return t.find(n=>e===n.relativeDir||e.startsWith(`${n.relativeDir}/`))??{name:"root",relativeDir:""}}function Rc(e){let t=new Set(["apps","packages","services","crates","libs","tools"]),n=new Map;for(let o of e){let r=o.split("/").filter(Boolean);if(r.length<3||!t.has(r[0]))continue;let a=`${r[0]}/${r[1]}`;n.set(a,{name:r[1],relativeDir:a})}return[...n.values()].sort((o,r)=>r.relativeDir.length-o.relativeDir.length)}function Nt(e,t){let n=Ne(e,t),r=(n.relativeDir?e.slice(n.relativeDir.length+1):e).split("/").filter(Boolean);r[0]==="src"&&r.shift();let a=Mc(r);return{id:`region:${n.relativeDir||"root"}:${a}`,label:`${n.name}:${a}`,workspace:n.name,structuralPath:a}}function Mc(e){if(e.length<=1)return"root";let t=e[0],n=e[1];return["components","features","modules"].includes(t)?`${t}/${n}`:t==="db"?`${t}/${n}`:["contracts","routes","services"].includes(t)?t:t==="tests"||t==="__tests__"?"tests":t}function Tc(e,t,n,o,r,a,i){let s=Pe([...e.values()],p=>a.get(p.file).id),l=Pe([...t.values()],p=>a.get(p.definition.relativePath).id),d=Pe(n,p=>a.get(p.file).id),c=new Map;for(let p of o)for(let m of new Set([p.fromRegionId,p.toRegionId])){let h=c.get(m)??[];h.push(p),c.set(m,h)}let u=Pe(r,p=>p.toRegionId),f=Pe(r,p=>p.fromRegionId);return[...s.entries()].map(([p,m])=>{let h=a.get(m[0].file),y=l.get(p)??[],L=d.get(p)??[],x=c.get(p)??[],S=i.has(p),T=y.map(Ac).sort(_c).slice(0,Tl),F=m.filter(P=>At(P.file)==="test").length;return{id:p,label:h.label,workspace:h.workspace,structuralPath:h.structuralPath,minDepth:Math.min(...m.map(P=>P.depth)),fileCount:m.length,sourceFileCount:m.length-F,testFileCount:F,symbolCount:y.length,literalHitCount:L.length,anchorQueries:Z([...L.map(P=>P.query),...y.flatMap(P=>[...P.anchorQueries])]),relationKinds:Z(x.map(P=>P.kind)),incomingRegionIds:Z((u.get(p)??[]).map(P=>P.fromRegionId)),outgoingRegionIds:Z((f.get(p)??[]).map(P=>P.toRegionId)),memberCallCandidateRelationCount:x.filter(P=>P.evidence==="ast-member-import-candidate").length,notableSymbols:T,omittedNotableSymbols:Math.max(0,y.length-T.length),expanded:S,files:S?m.map(Fc).sort(Bc):[],symbols:S?y.map(Pc).sort(Oc):[],literalHits:S?[...L].sort(yr):[],relations:S?[...x].sort(gr):[]}}).sort((p,m)=>p.minDepth-m.minDepth||p.label.localeCompare(m.label))}function Fc(e){return{file:e.file,kind:At(e.file),depth:e.depth,origins:Z([...e.origins])}}function Pc(e){return{symbol:e.definition.symbol,shortName:pe(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,depth:e.depth,origins:Z([...e.origins]),anchorQueries:Z([...e.anchorQueries]),referenceExpansion:e.referenceScope!=="none",referenceScope:e.referenceScope}}function Ac(e){return{shortName:pe(e.definition.symbol),file:e.definition.relativePath,origins:Z([...e.origins])}}function kc(e){return[...Pe(e.filter(n=>n.fromRegionId!==n.toRegionId),n=>`${n.fromRegionId}\0${n.toRegionId}`).values()].map(n=>({fromRegionId:n[0].fromRegionId,toRegionId:n[0].toRegionId,kinds:Z(n.map(o=>o.kind)),relationCount:n.length,fromFiles:Z(n.map(o=>o.fromFile)),toFiles:Z(n.map(o=>o.toFile)),fromSymbols:Z(n.flatMap(o=>o.fromSymbol?[pe(o.fromSymbol)]:[])),toSymbols:Z(n.flatMap(o=>o.toSymbol?[pe(o.toSymbol)]:[])),evidence:Z(n.map(o=>o.evidence)),strengths:Z(n.map(o=>o.strength??"unknown"))})).sort((n,o)=>n.fromRegionId.localeCompare(o.fromRegionId)||n.toRegionId.localeCompare(o.toRegionId))}function $c(e,t){return[...e.values()].map(n=>({kind:"external-import",name:n.name,fromRegionIds:Z([...n.fromFiles].flatMap(o=>{let r=t.get(o);return r?[r.id]:[]})),fromFiles:Z([...n.fromFiles])})).sort((n,o)=>n.name.localeCompare(o.name))}function Dc(e,t,n,o){let r=e.kind==="literal"?t.filter(a=>a.query===e.query).map(a=>a.file):[...n.values()].filter(a=>a.anchorQueries.has(e.query)).map(a=>a.definition.relativePath);return Z(r.map(a=>o.get(a)?.id).filter(a=>!!a))}function fr(e){return e.keyParts.map(t=>`${t.name}=${t.value}`).join(" ")}function Z(e){return[...new Set(e)].sort()}function gr(e,t){return e.fromRegionId.localeCompare(t.fromRegionId)||e.toRegionId.localeCompare(t.toRegionId)||e.kind.localeCompare(t.kind)||e.fromFile.localeCompare(t.fromFile)||e.toFile.localeCompare(t.toFile)||(e.line??-1)-(t.line??-1)}function _c(e,t){return at(e.origins)-at(t.origins)||e.shortName.localeCompare(t.shortName)}function Bc(e,t){return e.depth-t.depth||e.file.localeCompare(t.file)}function Oc(e,t){return e.depth-t.depth||e.file.localeCompare(t.file)||e.symbol.localeCompare(t.symbol)}function yr(e,t){return e.file.localeCompare(t.file)||e.line-t.line||e.query.localeCompare(t.query)}var jc={causal:["execution","runtime","dataflow","state","temporal"],structure:["contract","identity","ownership","dependencies"],complete:Ke},Kc=2,qc=48,hr=64,zc=5e4;function fp(e,t,n={}){let o=be([...t.symbols??[],...t.locations??[]]),r=be(t.searches??[]);if(o.length===0&&r.length===0)throw new Error("evidence requires at least one positional symbol, --symbol, --at, or --search selector.");let a=n.view??"causal",i=Uc(n.families,a),s=n.direction??"both",l=be(n.subtypes??[]),d=n.connecting??!1,c=n.inventoryOnly??!1,u=be(n.foldIds??[]),f=n.maxDepth??Kc,p=n.maxEdges??qc;if(!Number.isSafeInteger(f)||f<0)throw new RangeError(`Evidence depth must be a non-negative safe integer; received ${f}.`);if(!Number.isSafeInteger(p)||p<=0)throw new RangeError(`Evidence max edges must be a positive safe integer; received ${p}.`);if(!["incoming","outgoing","both"].includes(s))throw new Error(`Unsupported graph evidence direction: ${s}.`);if(c&&u.length>0)throw new Error("Evidence fold materialization cannot be combined with --inventory-only.");let m=ur(e,{symbols:o,searches:r,maxDepth:f,maxTopologyCharacters:zc,relations:Wc(i)}),h=new Map(m.nodes.map(U=>[U.id,U])),y=m.edges.filter(U=>U.disposition==="emitted"||U.disposition==="folded").flatMap(U=>Hc(U,h)),L=y.filter(U=>i.includes(U.family)).filter(U=>l.length===0||l.includes(U.subtype)),x=new Set(m.anchors.flatMap(U=>U.nodeIds));if(d&&x.size<2)throw new Error("Connecting evidence requires at least two resolved root nodes.");let S=new Set(L.map(U=>U.id)),T=Xn(y,x,"incoming").filter(U=>S.has(U.id)),F=Xn(y,x,"outgoing").filter(U=>S.has(U.id)),P=Xn(y,x,"both").filter(U=>S.has(U.id)),I=Zc(i,l,T,F,P),E=s==="incoming"?T:s==="outgoing"?F:P,N=d?rd(E,[...x],s):E,b=sd(N,x,s),$=[...N].sort((U,oe)=>ld(U,oe,b)),z=Jc($,p),q=td(z,u),C=c?[]:u.length>0?$.filter(U=>q.has(U.id)):$,w=u.length>0?C:C.slice(0,p),O=u.length>0||c?[]:z,se=Math.max(0,C.length-w.length),re=m.frontiers.filter(U=>U.disposition==="unsupported").length,ye=m.coverage.status==="incomplete"?"incomplete":se>0?"bounded":"accounted";return{kind:"graph",view:n.families&&n.families.length>0?"custom":a,families:i,selection:{direction:s,subtypes:l,connecting:d,inventoryOnly:c,foldIds:u},targets:m.anchors.map(U=>({kind:U.kind,query:U.query,status:U.status,nodeIds:[...U.nodeIds],omittedCandidates:U.omittedCandidates})),inventory:I,edges:w,folds:O,coverage:{status:ye,topologyStatus:m.coverage.status,scope:m.coverage.scope,maxDepth:f,maxEdges:p,matchedEdges:$.length,eligibleEdges:C.length,returnedEdges:w.length,omittedEdges:se,frontierGroups:m.frontiers.length,unsupportedFrontiers:re,blindSpots:be([...m.coverage.blindSpots,...Mo(i)]),explanation:c?`${$.length} relationship(s) match the explicit projection; only exact inventory counts were requested.`:u.length>0?`Every relationship in ${u.length} explicitly selected recoverable fold(s) was emitted.`:ye==="accounted"?"Every selected relationship in the bounded topology was emitted.":ye==="bounded"?`${se} selected relationship(s) were withheld by the explicit edge budget.`:m.coverage.explanation}}}function Uc(e,t){let n=e&&e.length>0?e:jc[t],o=n.filter(r=>!Ke.includes(r));if(o.length>0)throw new Error(`Unsupported graph evidence family: ${o.join(", ")}.`);return be(n)}function Wc(e){return["call","contract-symbol","import","reference","runtime-boundary"]}function Hc(e,t){let n=t.get(e.fromNodeId),o=t.get(e.toNodeId);return!n||!o?[]:(e.semantics??[]).flatMap((r,a)=>{let i=Yc(r);if(!i)return[];let s=To(i,r.subtype);if(!s)throw new Error(`No graph relation provider contract is registered for ${i}/${r.subtype}.`);let l=Xc(e);return s.relation.evidenceStrengths.includes(l)?[{id:`${e.id}:${a}:${i}`,family:i,semanticFamily:r.family,subtype:r.subtype,from:br(n),to:br(o),sourceKind:e.kind,providerId:s.provider.id,supportCeiling:s.relation.supportCeiling,establishes:s.relation.establishes,nonClaims:[...s.relation.nonClaims],recoverWith:[...s.relation.recoverWith],evidenceStrength:l,evidenceMethods:be(e.evidence.map(d=>d.method)),evidenceConstituents:Vc(e.evidence),context:r.context?{...r.context}:null,attributes:r.attributes?{...r.attributes}:null}]:[]})}function Vc(e){let t=new Map;for(let n of e)t.set(`${n.method}\0${n.strength}`,n);return[...t.values()].map(({method:n,strength:o})=>({method:n,strength:o}))}function Yc(e){switch(e.family){case"control":return e.context?.crossesRuntimeBoundary===!0||e.subtype==="runtime-handoff"?"runtime":"execution";case"data":return"dataflow";case"state":return"state";case"temporal":return"temporal";case"contract":return"contract";case"identity":return e.subtype.startsWith("contains")||e.subtype.startsWith("owns-")?"ownership":e.subtype.startsWith("import")?"dependencies":"identity"}}function br(e){let t=Qc(e);return{id:e.id,kind:e.kind,label:t?pe(t):e.label,symbol:t,location:e.location?{...e.location}:null}}function Qc(e){return e.kind!=="symbol"||!e.id.startsWith("symbol:")?null:decodeURIComponent(e.id.slice(7))}function Xc(e){let t=be(e.evidence.map(n=>n.strength));return t.length===1?t[0]:t.includes("exact")&&t.every(n=>n==="exact"||n==="derived")?"mixed":t.includes("candidate")?"candidate":t.includes("unknown")||t.length===0?"unknown":"mixed"}function Xn(e,t,n){let o=Zn(e,n),r=new Map,a=new Map,i=[...t].sort();for(let s of i)a.set(s,0);for(let s=0;s<i.length;s+=1){let l=i[s],d=a.get(l);for(let c of o.get(l)??[])r.set(c.edge.id,c.edge),!a.has(c.next)&&(a.set(c.next,d+1),i.push(c.next))}return[...r.values()]}function Zn(e,t){let n=new Map,o=(r,a,i)=>{let s=n.get(r)??[];s.push({edge:i,next:a}),n.set(r,s)};for(let r of e)t!=="incoming"&&o(r.from.id,r.to.id,r),t!=="outgoing"&&o(r.to.id,r.from.id,r);for(let r of n.values())r.sort((a,i)=>a.edge.id.localeCompare(i.edge.id)||a.next.localeCompare(i.next));return n}function Zc(e,t,n,o,r){let a=new Set;for(let c of[...n,...o,...r])a.add(`${c.family}\0${c.subtype}`);if(t.length>0)for(let c of e)for(let u of t)a.add(`${c}\0${u}`);let i=c=>{let u=new Map;for(let f of c){let p=`${f.family}\0${f.subtype}`;u.set(p,(u.get(p)??0)+1)}return u},s=i(n),l=i(o),d=i(r);return[...a].map(c=>{let[u,f]=c.split("\0");return{family:u,subtype:f,incoming:s.get(c)??0,outgoing:l.get(c)??0,both:d.get(c)??0}}).sort((c,u)=>Ke.indexOf(c.family)-Ke.indexOf(u.family)||c.subtype.localeCompare(u.subtype))}function Jc(e,t){let n=e.slice(t),o=new Map;for(let i of n){let s=ed(i),l=`${i.family}\0${s}`,d=o.get(l)??[];d.push(i),o.set(l,d)}let r=new Map(e.map((i,s)=>[i.id,s+1])),a=[];for(let[i,s]of[...o].sort(([l],[d])=>l.localeCompare(d))){let[l,d]=i.split("\0"),c=[...s].sort((u,f)=>u.id.localeCompare(f.id));for(let u=0;u<c.length;u+=hr){let f=c.slice(u,u+hr),p=f.map(L=>L.id),m=be(f.map(L=>L.subtype)).sort(),h=m.length===1?m[0]:"mixed",y=[...new Set(f.flatMap(L=>[L.from.id,L.to.id]))].sort();a.push({id:id(l,m.join("\0"),p),mode:nd(f),family:l,subtype:h,subtypes:m,region:d,edgeCount:p.length,edgeIds:p,nodeIds:y,minimumMaxEdges:Math.max(...p.map(L=>r.get(L)??e.length))})}}return a.sort((i,s)=>Ke.indexOf(i.family)-Ke.indexOf(s.family)||(i.region??"").localeCompare(s.region??"")||i.id.localeCompare(s.id))}function ed(e){let t=e.from.location?.file??`kind:${e.from.kind}`,n=e.to.location?.file??`kind:${e.to.kind}`;return t===n?t:`${t} -> ${n}`}function td(e,t){if(t.length===0)return new Set;let n=new Map(e.map(r=>[r.id,r])),o=t.filter(r=>!n.has(r));if(o.length>0){let r=e.map(a=>a.id).sort();throw new Error(`Unknown evidence fold ${o.join(", ")} for this projection. Available folds: ${r.join(", ")||"(none)"}.`)}return new Set(t.flatMap(r=>n.get(r).edgeIds))}function nd(e){let t=new Map,n=new Map,o=new Set;for(let a of e){o.add(a.from.id),o.add(a.to.id);let i=t.get(a.from.id)??new Set;i.add(a.to.id),t.set(a.from.id,i);let s=n.get(a.to.id)??new Set;s.add(a.from.id),n.set(a.to.id,s)}return od(o,t)?"scc":[...o].every(a=>(n.get(a)?.size??0)<=1&&(t.get(a)?.size??0)<=1)?"linear":"topology"}function od(e,t){let n=new Set,o=new Set,r=a=>{if(n.has(a))return!0;if(o.has(a))return!1;n.add(a);for(let i of t.get(a)??[])if(r(i))return!0;return n.delete(a),o.add(a),!1};return[...e].some(r)}function id(e,t,n){return`fold:${Gc("sha256").update([e,t,...n].join("\0")).digest("hex").slice(0,16)}`}function rd(e,t,n){let o=new Map,r=[...new Set(t)].sort();for(let a=0;a<r.length;a+=1)for(let i=a+1;i<r.length;i+=1)for(let s of ad(e,r[a],r[i],n))o.set(s.id,s);return[...o.values()]}function ad(e,t,n,o){let r=Zn(e,o),a=new Map([[t,0]]),i=new Map,s=[t];for(let d=0;d<s.length;d+=1){let c=s[d],u=a.get(c);if(c!==n)for(let f of r.get(c)??[])a.has(f.next)||(a.set(f.next,u+1),i.set(f.next,{node:c,edge:f.edge}),s.push(f.next))}if(!a.has(n))return[];let l=[];for(let d=n;d!==t;){let c=i.get(d);if(!c)return[];l.push(c.edge),d=c.node}return l.reverse()}function sd(e,t,n){let o=Zn(e,n),r=new Map,a=[...t];for(let i of t)r.set(i,0);for(let i=0;i<a.length;i+=1){let s=a[i],l=r.get(s);for(let{next:d}of o.get(s)??[])r.has(d)||(r.set(d,l+1),a.push(d))}return r}function ld(e,t,n){return Sr(e,n)-Sr(t,n)||vr(e)-vr(t)||xr(e.evidenceStrength)-xr(t.evidenceStrength)||Ke.indexOf(e.family)-Ke.indexOf(t.family)||e.from.label.localeCompare(t.from.label)||e.to.label.localeCompare(t.to.label)||e.subtype.localeCompare(t.subtype)||e.id.localeCompare(t.id)}function Sr(e,t){return Math.min(t.get(e.from.id)??Number.MAX_SAFE_INTEGER,t.get(e.to.id)??Number.MAX_SAFE_INTEGER)}function vr(e){let t=[e.from,e.to].filter(n=>n.kind==="structural-region").length;return t===2?2:t}function xr(e){switch(e){case"exact":return 0;case"mixed":return 1;case"derived":return 2;case"candidate":return 3;case"unknown":return 4}}export{fp as a};
21
- //# sourceMappingURL=chunk-LXLD46LH.js.map
@@ -1,2 +0,0 @@
1
- import{a as z,e as Q,n as R,p as P}from"./chunk-AUP6YI5M.js";import{a as B,b as L,d as w}from"./chunk-DOPCR5BY.js";import{a as d,f as S,g as q,h as p}from"./chunk-H5EXS3HM.js";import{C as G,Q as U,R as W,Y as J,a as D,g as V,ga as Y,h as O,ia as H,ka as K,n as F}from"./chunk-4DCKBY6T.js";import{existsSync as we}from"fs";import{randomUUID as Ke}from"crypto";import{isAbsolute as Qe,join as Re,relative as Xe,resolve as Ze}from"path";var f=1,m=2,de="./node_modules/scip-query/docs/schemas/project-config.schema.json";function X(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch(c){return{kind:"malformed",reason:`invalid JSON: ${c instanceof Error?c.message:String(c)}`}}if(!d(t))return{kind:"malformed",reason:"project config must be a JSON object"};let n=t.schemaVersion;if(n!==void 0&&!Number.isInteger(n))return{kind:"malformed",reason:"schemaVersion must be an integer"};let r=n===void 0?f:n;if(r!==f&&r!==m)return{kind:"unsupported",schemaVersion:r,direction:r<f?"older":"future"};let s=t.$schema;if(s!==void 0&&(typeof s!="string"||s.trim()===""))return{kind:"malformed",reason:"$schema must be a non-empty string when present"};let i=Z(t),a=r!==m||typeof t.$schema!="string";return r===f?{kind:"legacy",sourceVersion:f,config:i,needsMigration:a}:{kind:"supported",sourceVersion:m,config:i,needsMigration:a}}function Z(e){let t=e,{$schema:n,schemaVersion:r,...s}=t;return{$schema:typeof n=="string"&&n.trim()!==""?n:de,schemaVersion:m,...s}}import{createHash as ue}from"crypto";var I=1,ee=2,te=1,E=1,A="sha256";function qe(e,t,n){if(!p(e)||!S(t))throw new Error("Observation identity requires a bounded projection name and positive projection version.");return{schemaVersion:te,canonicalizationVersion:E,hashAlgorithm:A,projection:{name:e,version:t},digest:ue(A).update(pe(e,t,n)).digest("hex")}}function pe(e,t,n){return`{"canonicalizationVersion":${E},"projection":${JSON.stringify(e)},"projectionVersion":${t},"value":${JSON.stringify(n)}}`}function le(e){if(!d(e))return{kind:"malformed",reason:"observation receipt must be an object"};let t=e.schemaVersion;if(!Number.isInteger(t))return{kind:"malformed",reason:"observation receipt schemaVersion must be an integer"};if(t===I)return me(e)?{kind:"legacy",schemaVersion:I,receipt:e}:{kind:"malformed",reason:"observation receipt v1 fields are malformed or contradictory"};if(t===ee)return ge(e)?{kind:"supported",schemaVersion:ee,receipt:e}:{kind:"malformed",reason:"observation receipt v2 facts are malformed or contradictory"};let n=t;return{kind:"unsupported",schemaVersion:n,direction:n<I?"older":"future"}}function ne(e){let t=le(e);return t.kind==="legacy"||t.kind==="supported"}function fe(e,t){return e.schemaVersion===t.schemaVersion&&e.canonicalizationVersion===t.canonicalizationVersion&&e.hashAlgorithm===t.hashAlgorithm&&e.projection.name===t.projection.name&&e.projection.version===t.projection.version}function me(e){if(!d(e))return!1;let t=e.index,n=e.worktree;return ie(e.observedAt)&&p(e.projectIdentity)&&Oe(e.authorityKind)&&(t===void 0||d(t)&&p(t.generationIdentity)&&(t.source==="immutable"||t.source==="legacy")&&(t.alignment==="not-certified"||t.alignment==="leased"))&&(n===void 0||d(n)&&p(n.identity)&&typeof n.clean=="boolean"&&(n.headCommit===void 0||p(n.headCommit))&&(n.treeOid===void 0||p(n.treeOid)))&&xe(e.authorityKind,t,n)}function ge(e){if(!d(e))return!1;let t=e.facts,n=e.observedSources,r=e.stabilityProofs;if(!ie(e.observedAt)||!d(t)||!Array.isArray(n)||n.length===0||!n.every(ye)||!j(n,o=>o.kind)||!Array.isArray(r)||!r.every(be)||!j(r,o=>o.source)||r.some(o=>!n.some(u=>u.kind===o.source))||!r.every(o=>Ce(o,t))||["collaborationDomain","repositoryLineage","workspaceInstance","wholeContent"].some(o=>t[o]!==void 0&&!l(t[o])))return!1;let i=t.relevantInputs;if(i!==void 0&&(!Array.isArray(i)||!i.every(he)||!j(i,o=>`${o.subject}\0${o.identity.projection.name}`)))return!1;let a=t.index;if(a!==void 0&&(!d(a)||!l(a.generation)||a.inputs!==void 0&&!l(a.inputs)||a.source!=="immutable"&&a.source!=="legacy"))return!1;let c=e.diagnostics;return(c===void 0||d(c)&&(c.clean===void 0||typeof c.clean=="boolean")&&(c.headCommit===void 0||p(c.headCommit))&&(c.treeOid===void 0||p(c.treeOid)))&&ve(t,n)}function l(e){return!d(e)||!d(e.projection)?!1:e.schemaVersion===te&&e.canonicalizationVersion===E&&e.hashAlgorithm===A&&p(e.projection.name)&&S(e.projection.version)&&q(e.digest)}function he(e){return d(e)&&p(e.subject)&&l(e.identity)}function ye(e){return d(e)&&re(e.kind)&&(e.identity===void 0||l(e.identity))}function be(e){return d(e)&&re(e.source)&&(e.kind==="immutable"||e.kind==="fixed-snapshot"||e.kind==="bracketed"||e.kind==="not-established"||e.kind==="invalidated")}function ve(e,t){let n=e.index,r=t.find(o=>o.kind==="index-generation");if(r){if(!d(n)||!l(n.generation)||r.identity&&!k(r.identity,n.generation))return!1}else if(n!==void 0)return!1;let s=e.workspaceInstance,i=t.find(o=>o.kind==="live-workspace");if(i?.identity&&(!l(s)||!k(i.identity,s)))return!1;let a=e.wholeContent,c=t.find(o=>o.kind==="repository-snapshot");return!(c?.identity&&(!l(a)||!k(c.identity,a)))}function Ce(e,t){return e.kind==="not-established"||e.kind==="invalidated"?!0:e.source==="index-generation"?e.kind==="immutable"&&d(t.index)&&t.index.source==="immutable":e.source==="repository-snapshot"?e.kind==="fixed-snapshot":e.source==="live-workspace"?e.kind==="bracketed":!1}function k(e,t){return fe(e,t)&&e.digest===t.digest}function xe(e,t,n){return e==="index-worktree"?t!==void 0&&n!==void 0:e==="index-only"?t!==void 0&&n===void 0:e==="worktree-only"?t===void 0&&n!==void 0:e==="process-local"&&t===void 0&&n===void 0}function Oe(e){return e==="index-worktree"||e==="index-only"||e==="worktree-only"||e==="process-local"}function re(e){return e==="index-generation"||e==="repository-snapshot"||e==="live-workspace"||e==="process"}function ie(e){return typeof e=="string"&&!Number.isNaN(Date.parse(e))}function j(e,t){return new Set(e.map(t)).size===e.length}function Ue(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.kind==="automated-adjudication"&&t.policyVersion===1&&(t.decidedBy==="agent"||t.decidedBy==="human")&&L.includes(t.reasonCode)&&Array.isArray(t.evidence)&&t.evidence.length>0&&t.evidence.every(Se)&&(t.observation===void 0||ne(t.observation))&&!!t.invalidateOn&&typeof t.invalidateOn=="object"&&typeof t.invalidateOn.targetContentChange=="boolean"&&typeof t.invalidateOn.detectorMajorChange=="boolean"}function Se(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return(t.kind==="source"||t.kind==="config"||t.kind==="test"||t.kind==="graph")&&typeof t.referent=="string"&&t.referent.trim()!==""&&typeof t.claim=="string"&&t.claim.trim()!==""&&(t.contentHash===void 0||/^[a-f0-9]{64}$/u.test(t.contentHash))&&(t.generation===void 0||typeof t.generation=="string"&&t.generation.length>0)}var h=".scipquery.json",Pe=2e3,oe=5e3,se=oe,Ie=15*6e4,ae={enabled:!0,windowMs:15*6e4,maxRebuilds:2,maxEstimatedWriteBytes:1024*1024*1024},ke={enabled:!1,debounceMs:Pe,cooldownMs:se,gitPollMs:2e3,idleTimeoutMs:Ie,autoRefresh:!0,ignore:[],resourceBudget:ae};var rt=new Set(B);function it(e){let t=Re(e,h);if(!we(t))return{};let n;try{n=V(t,{maxBytes:D,inputKind:"scip-query project config"})}catch(r){let s=r instanceof Error?r.message:String(r);throw new Error(`unable to read ${h} at ${t}: ${s}`,{cause:r})}return je(X(n),t,"read").config}function ot(e){return{...ke,...e.watch,cooldownMs:Math.max(oe,e.watch?.cooldownMs??se),resourceBudget:{...ae,...e.watch?.resourceBudget}}}function je(e,t,n){if(e.kind==="legacy"||e.kind==="supported")return e;if(e.kind==="malformed"){let s=n==="read"?`invalid ${h} at ${t}: ${e.reason}`:`Cannot update ${t}: the latest project config is ${e.reason}.`;throw new Error(`${s} The file was left untouched.`)}let r=n==="read"?`invalid ${h} at ${t}`:`Cannot update ${t}: the latest project config is invalid`;throw new Error(`${r} (unsupported ${e.direction} schemaVersion ${e.schemaVersion}; this scip-query reads legacy v${f} and current v${m}). Upgrade scip-query before retrying; the file was left untouched.`)}import{existsSync as y,lstatSync as Ae}from"fs";import{resolve as Ee}from"path";function Ct(e,t,n,r={}){let s=new Date().toISOString();if(!y(n.dbPath))return{state:"missing",checkedAt:s,metaPath:n.metaPath,reason:"No SQLite index database exists.",remedy:"Run: scip-query reindex"};if(!y(n.metaPath))return{state:"unknown",checkedAt:s,metaPath:n.metaPath,reason:"No reindex metadata file exists next to the SQLite index.",remedy:"Run: scip-query reindex"};try{let i=w(O(n.metaPath,"reindex metadata"));if(i.kind==="unsupported")return{state:"unknown",checkedAt:s,metaPath:n.metaPath,reason:`Reindex metadata version ${i.version} is unsupported by this scip-query build.`,remedy:"Upgrade scip-query or run: scip-query reindex"};if(i.kind==="malformed")return{state:"unknown",checkedAt:s,metaPath:n.metaPath,reason:`Could not decode reindex metadata: ${i.reason}`,remedy:"Run: scip-query reindex"};let a=i.metadata,c=t.languages??z(e),o=a.fingerprint,u=n.cacheDir&&r.gitContext&&P(r.gitContext,n.cacheDir,o)?o:void 0,g=n.cacheDir&&r.gitContext&&u&&Me(u,c,t)&&Ne(e,u,t)?r.gitObservation?.context===r.gitContext?r.gitContext:U(r.gitContext):void 0,ce=r.gitObservation&&r.gitObservation.context===r.gitContext?r.gitObservation.projectFileInventorySequence:void 0,_=g?.clean&&W(e,void 0,{cachedInventoryAfterSequence:ce})?g:void 0,b=n.cacheDir&&_&&u&&P(_,n.cacheDir,u)?u:_e(e,c,t),M=[...a.indexedLanguages??[]].sort(),v=i.capabilities.publishableGeneration&&JSON.stringify(a.fingerprint)===JSON.stringify(b)&&JSON.stringify(M)===JSON.stringify(b.languages),C=R(n.dbPath,n.metaPath),N=C.state==="invalid"||C.state==="drifted",x=v?Q(n.dbPath,b,M):void 0,T=x?.state==="incomplete",$=v&&!N&&!T;return{state:$?"fresh":"stale",checkedAt:s,metaPath:n.metaPath,updatedAt:a.updatedAt,lastRefresh:a.lastRefresh,reason:N?`SQLite generation requires repair: ${C.reason}`:T?`SQLite generation is missing ${x.missingDocumentCount} indexed source document(s): ${x.missingPaths.join(", ")}`:v?"Index metadata fingerprint matches current source files.":"Index metadata fingerprint differs from current source files.",remedy:$?void 0:"Run: scip-query reindex"}}catch(i){return{state:"unknown",checkedAt:s,metaPath:n.metaPath,reason:`Could not read reindex metadata: ${i instanceof Error?i.message:String(i)}`,remedy:"Run: scip-query reindex"}}}function xt(e){let t=new Date().toISOString();if(!y(e.dbPath))return{state:"missing",checkedAt:t,metaPath:e.metaPath,reason:"No SQLite index database exists.",remedy:"Run: scip-query reindex"};if(!y(e.metaPath))return{state:"unknown",checkedAt:t,metaPath:e.metaPath,reason:"No reindex metadata file exists next to the SQLite index.",remedy:"Run: scip-query reindex"};try{let n=w(O(e.metaPath,"reindex metadata"));if(n.kind==="unsupported")return{state:"unknown",checkedAt:t,metaPath:e.metaPath,reason:`Reindex metadata version ${n.version} is unsupported by this scip-query build.`,remedy:"Upgrade scip-query or run: scip-query reindex"};if(n.kind==="malformed")return{state:"unknown",checkedAt:t,metaPath:e.metaPath,reason:`Could not decode reindex metadata: ${n.reason}`,remedy:"Run: scip-query reindex"};let r=n.metadata,s=[...r.indexedLanguages??[]].sort(),i=F(r.fingerprint),a=[...i?.languages??[]].sort(),c=n.capabilities.publishableGeneration&&i!==null&&JSON.stringify(s)===JSON.stringify(a),o=R(e.dbPath,e.metaPath),u=o.state==="invalid"||o.state==="drifted",g=c&&!u;return{state:g?"fresh":"stale",checkedAt:t,metaPath:e.metaPath,updatedAt:r.updatedAt,lastRefresh:r.lastRefresh,reason:u?`SQLite generation requires repair: ${o.reason}`:c?"Watcher accepted the newly published index generation with no later changes pending.":"Published index metadata is not a complete queryable generation.",remedy:g?void 0:"Run: scip-query reindex"}}catch(n){return{state:"unknown",checkedAt:t,metaPath:e.metaPath,reason:`Could not read reindex metadata: ${n instanceof Error?n.message:String(n)}`,remedy:"Run: scip-query reindex"}}}function _e(e,t,n){return H(e,t,{pnpmWorkspaces:n.indexer?.typescript?.pnpmWorkspaces,typescriptProjectMode:n.indexer?.typescript?.projectMode,typescriptProjects:n.indexer?.typescript?.projects,clojureConfigPath:n.indexer?.clojure?.configPath})}function Me(e,t,n){let r=Te(t,n);return e.version===r.version&&JSON.stringify([...e.languages].sort())===JSON.stringify(r.languages)&&e.pnpmWorkspaces===r.pnpmWorkspaces&&e.typescriptProjectMode===r.typescriptProjectMode&&JSON.stringify([...e.typescriptProjects].sort())===JSON.stringify(r.typescriptProjects)&&e.clojureConfigPath===r.clojureConfigPath}function Ne(e,t,n){if(!(t.languages.includes("typescript")||!!t.clojureConfigPath))return!0;let s=Y(e);if(t.clojureConfigPath){let i=G(t.clojureConfigPath);if(!s.includes(i))return!1;try{if(!Ae(Ee(e,i)).isFile())return!1}catch{return!1}}return!t.languages.includes("typescript")||J(e,n.indexer?.typescript?.projectMode,n.indexer?.typescript?.projects??[],s)}function Te(e,t){return K(e,{pnpmWorkspaces:t.indexer?.typescript?.pnpmWorkspaces,typescriptProjectMode:t.indexer?.typescript?.projectMode,typescriptProjects:t.indexer?.typescript?.projects,clojureConfigPath:t.indexer?.clojure?.configPath})}export{ee as a,qe as b,Ue as c,it as d,ot as e,Ct as f,xt as g};
2
- //# sourceMappingURL=chunk-MEI3PTUK.js.map