scip-query 0.22.0 → 0.24.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 (470) hide show
  1. package/CHANGELOG.md +500 -0
  2. package/README.md +13 -0
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/by-kind-H3P6BR5G.js +2 -0
  5. package/dist/call-graph-VTG2CUOQ.js +2 -0
  6. package/dist/call-graph-evidence-BociKRpF.d.ts +19 -0
  7. package/dist/chunk-2BMSSRBH.js +2 -0
  8. package/dist/{chunk-TAYD3AE7.js → chunk-2GJSD5GY.js} +2 -2
  9. package/dist/{chunk-TUQIPUDS.js → chunk-2M2LSIMY.js} +3 -3
  10. package/dist/{chunk-GIQ6CSL4.js → chunk-2N6WBNDC.js} +2 -2
  11. package/dist/{chunk-JHH5SCZ3.js → chunk-2OOY75BW.js} +2 -2
  12. package/dist/{chunk-EELPBR7E.js → chunk-2USA3S3P.js} +2 -2
  13. package/dist/chunk-2VAHDDLM.js +133 -0
  14. package/dist/chunk-2XWIUW5Z.js +455 -0
  15. package/dist/{chunk-57N6LN2A.js → chunk-3AF4TUFK.js} +2 -2
  16. package/dist/chunk-3D4BOXW6.js +20 -0
  17. package/dist/{chunk-FFJQZG6J.js → chunk-3LO4FST5.js} +2 -2
  18. package/dist/{chunk-HXOU4XNH.js → chunk-3WTY4LP2.js} +2 -2
  19. package/dist/{chunk-DPWKKNKI.js → chunk-3Z5AMSK6.js} +2 -2
  20. package/dist/{chunk-F24G5NBE.js → chunk-44IETFOU.js} +2 -2
  21. package/dist/chunk-4FR6GQIT.js +2 -0
  22. package/dist/chunk-4KBTHJLP.js +2 -0
  23. package/dist/chunk-5BIKR67W.js +2 -0
  24. package/dist/{chunk-DJAO2OZJ.js → chunk-5PROPLHI.js} +2 -2
  25. package/dist/chunk-5V7EPTII.js +2 -0
  26. package/dist/{chunk-VZ7NXSHV.js → chunk-62LPZCBQ.js} +2 -2
  27. package/dist/{chunk-LXQUF2RP.js → chunk-64O2JHQA.js} +2 -2
  28. package/dist/chunk-6D4F5VWG.js +10 -0
  29. package/dist/{chunk-NEIQPFBI.js → chunk-6ERFBC3X.js} +2 -2
  30. package/dist/{chunk-4HE7MVWD.js → chunk-6ILKOOGH.js} +2 -2
  31. package/dist/chunk-6MFXCMZC.js +2 -0
  32. package/dist/chunk-6O7FACKB.js +2 -0
  33. package/dist/{chunk-R6M456QG.js → chunk-6TS3KOXR.js} +2 -2
  34. package/dist/{chunk-7U2YQSDE.js → chunk-76QOU4PK.js} +2 -2
  35. package/dist/{chunk-25GWKRUZ.js → chunk-7DUI77BN.js} +2 -2
  36. package/dist/chunk-7F45LJKI.js +2 -0
  37. package/dist/{chunk-DEAB5TGT.js → chunk-7F7T6DCR.js} +2 -2
  38. package/dist/chunk-7H6VHWWJ.js +2 -0
  39. package/dist/chunk-7HXT6YLU.js +5 -0
  40. package/dist/{chunk-KZYID5KV.js → chunk-7R4V5ES6.js} +4 -4
  41. package/dist/chunk-7RIRIADH.js +7 -0
  42. package/dist/chunk-7ZLWLOGT.js +2 -0
  43. package/dist/{chunk-WHADK6OS.js → chunk-A4WEAK35.js} +2 -2
  44. package/dist/chunk-AADQLOQ4.js +38 -0
  45. package/dist/{chunk-XFMVKFSF.js → chunk-AN76MGUE.js} +2 -2
  46. package/dist/chunk-ANLNLY66.js +2 -0
  47. package/dist/chunk-ATXPTSEI.js +81 -0
  48. package/dist/{chunk-EELG7D3Q.js → chunk-AX7IDVFT.js} +2 -2
  49. package/dist/chunk-B3PYOSCX.js +2 -0
  50. package/dist/chunk-B7MPDEAK.js +3 -0
  51. package/dist/chunk-BBB5FBX4.js +2 -0
  52. package/dist/{chunk-Y2VM4CJC.js → chunk-BHKK5RJY.js} +2 -2
  53. package/dist/chunk-BJWFVAA5.js +2 -0
  54. package/dist/chunk-BKVWUP7Y.js +2 -0
  55. package/dist/{chunk-7XA3OM44.js → chunk-BKZYTLGE.js} +2 -2
  56. package/dist/chunk-BL6DCHQP.js +2 -0
  57. package/dist/chunk-BOW7SSQH.js +43 -0
  58. package/dist/{chunk-KQHJEU6V.js → chunk-C4RHHCKL.js} +2 -2
  59. package/dist/chunk-C7C6AKAT.js +117 -0
  60. package/dist/chunk-CD6M6LS2.js +16 -0
  61. package/dist/chunk-CFE6PSG6.js +2 -0
  62. package/dist/{chunk-GPGRZJ3R.js → chunk-CFNIGQMT.js} +2 -2
  63. package/dist/{chunk-K3XFWJI2.js → chunk-CKBUBRYD.js} +2 -2
  64. package/dist/chunk-CZW5MZ5B.js +2 -0
  65. package/dist/chunk-DBBZ63ZX.js +2 -0
  66. package/dist/chunk-DBN7DMJB.js +18 -0
  67. package/dist/{chunk-CKRWA452.js → chunk-DUULLZHZ.js} +2 -2
  68. package/dist/{chunk-6HRZQLOI.js → chunk-DV5Y5NOS.js} +2 -2
  69. package/dist/chunk-DZOIKCTM.js +3 -0
  70. package/dist/chunk-E4PKTOL3.js +2 -0
  71. package/dist/{chunk-GVOMSPGL.js → chunk-E65ELFKU.js} +2 -2
  72. package/dist/{chunk-VXJJTQYE.js → chunk-E7QR35ST.js} +2 -2
  73. package/dist/{chunk-2RE5OCHZ.js → chunk-EFSXAINW.js} +2 -2
  74. package/dist/{chunk-GY7CCCEZ.js → chunk-EHVEIEQN.js} +2 -2
  75. package/dist/{chunk-BVFYEEBH.js → chunk-EHYDXE3Z.js} +2 -2
  76. package/dist/{chunk-HISEUIL2.js → chunk-EP63Y6LD.js} +2 -2
  77. package/dist/chunk-EPX6NQN6.js +4 -0
  78. package/dist/chunk-ETC674NS.js +5 -0
  79. package/dist/{chunk-5H5WTJSD.js → chunk-F5GSBHC6.js} +2 -2
  80. package/dist/chunk-FH3DGXC6.js +2 -0
  81. package/dist/{chunk-2XCGSDIT.js → chunk-FI7VGOR4.js} +2 -2
  82. package/dist/chunk-FJF6VO2P.js +2 -0
  83. package/dist/{chunk-FELGD32K.js → chunk-FLMTCX5R.js} +2 -2
  84. package/dist/chunk-FVFDOIM3.js +2 -0
  85. package/dist/{chunk-AQ2PORIO.js → chunk-G2HU5WRN.js} +2 -2
  86. package/dist/{chunk-7YQOCABQ.js → chunk-G4ALYS4J.js} +2 -2
  87. package/dist/{chunk-SWK4XPUS.js → chunk-G56I7K4W.js} +2 -2
  88. package/dist/{chunk-JFQBRL3J.js → chunk-GC4DG2V5.js} +2 -2
  89. package/dist/chunk-GG45PK4S.js +4 -0
  90. package/dist/{chunk-XN22RGSR.js → chunk-GHNPACNP.js} +2 -2
  91. package/dist/{chunk-XU75YQN4.js → chunk-GINH3YQU.js} +2 -2
  92. package/dist/chunk-GTZZVLKJ.js +2 -0
  93. package/dist/chunk-GXXW5ZHH.js +2 -0
  94. package/dist/{chunk-RNKPYYYE.js → chunk-HAXXKRTD.js} +2 -2
  95. package/dist/chunk-HEZWBAZY.js +2 -0
  96. package/dist/chunk-HMEWLMML.js +2 -0
  97. package/dist/{chunk-2KVU55CW.js → chunk-HOBOVYPO.js} +2 -2
  98. package/dist/{chunk-2YC7YNKT.js → chunk-HRFQ6GW5.js} +2 -2
  99. package/dist/{chunk-RYOYJMGF.js → chunk-HX4X7KG3.js} +2 -2
  100. package/dist/{chunk-AZS7YPCB.js → chunk-HYT2R7LX.js} +2 -2
  101. package/dist/chunk-IKQVBVQL.js +40 -0
  102. package/dist/chunk-J6GLBBRK.js +4 -0
  103. package/dist/{chunk-TNG2FYS5.js → chunk-J7A4PWFX.js} +2 -2
  104. package/dist/chunk-JCSAZ35V.js +2 -0
  105. package/dist/{chunk-EWWY2ZFL.js → chunk-JDU2IV3A.js} +2 -2
  106. package/dist/{chunk-SB25YMEQ.js → chunk-JFMEXGFE.js} +2 -2
  107. package/dist/chunk-JFMI5SGB.js +4 -0
  108. package/dist/chunk-JJP37RGX.js +57 -0
  109. package/dist/chunk-JZ2A7LDM.js +5 -0
  110. package/dist/chunk-KNLQGXVH.js +80 -0
  111. package/dist/chunk-KVQCECPR.js +2 -0
  112. package/dist/{chunk-F24QUEQP.js → chunk-KXXORBZ2.js} +2 -2
  113. package/dist/{chunk-IKVNEGTW.js → chunk-L5KYH6U3.js} +2 -2
  114. package/dist/chunk-L6XHYJPZ.js +21 -0
  115. package/dist/chunk-L7KTFEAV.js +43 -0
  116. package/dist/{chunk-UAQ4T73O.js → chunk-LDXHR5EL.js} +2 -2
  117. package/dist/chunk-LEECKFCJ.js +2 -0
  118. package/dist/{chunk-LO5JSW2C.js → chunk-MHGDSBFX.js} +2 -2
  119. package/dist/{chunk-JUN5DOAK.js → chunk-MLQVVDG3.js} +2 -2
  120. package/dist/chunk-MOKUWRHO.js +3 -0
  121. package/dist/{chunk-44T4DUAA.js → chunk-MPYAPMNE.js} +2 -2
  122. package/dist/{chunk-ARVO6TTW.js → chunk-MV6SPXCR.js} +2 -2
  123. package/dist/{chunk-NRBNAECH.js → chunk-MWN53KRN.js} +2 -2
  124. package/dist/{chunk-TH6IC56G.js → chunk-MZPXPSUJ.js} +2 -2
  125. package/dist/{chunk-FBCVASUG.js → chunk-N55KIE46.js} +2 -2
  126. package/dist/{chunk-VMWUV6WB.js → chunk-NB4D3BNM.js} +2 -2
  127. package/dist/{chunk-JAT6C3VX.js → chunk-NGKBOT6G.js} +2 -2
  128. package/dist/{chunk-Q6T2CAJL.js → chunk-NJGKXKQF.js} +2 -2
  129. package/dist/chunk-NJQISBL4.js +8 -0
  130. package/dist/chunk-NJT3ZEKY.js +16 -0
  131. package/dist/{chunk-KFVSJX25.js → chunk-NKMKZP6A.js} +2 -2
  132. package/dist/chunk-NODFZ6ED.js +2 -0
  133. package/dist/{chunk-ERCYGVAM.js → chunk-NSM5IEVW.js} +2 -2
  134. package/dist/{chunk-YAGYMBEX.js → chunk-NTGUVNR2.js} +2 -2
  135. package/dist/{chunk-N7FP5H5U.js → chunk-NU3KFF2O.js} +8 -8
  136. package/dist/chunk-NWLVNU66.js +557 -0
  137. package/dist/{chunk-Q55NF3ZG.js → chunk-NYKZMCRC.js} +2 -2
  138. package/dist/{chunk-I6UTXNHU.js → chunk-O6BUXZEH.js} +2 -2
  139. package/dist/chunk-ODPDP7A4.js +3 -0
  140. package/dist/{chunk-ZAZGGSM3.js → chunk-OHIV323X.js} +2 -2
  141. package/dist/chunk-OIAPEKMT.js +3 -0
  142. package/dist/chunk-OIOC5EHF.js +3 -0
  143. package/dist/{chunk-YIHNPKWD.js → chunk-ONPPQM4G.js} +2 -2
  144. package/dist/{chunk-RHHCLWQ6.js → chunk-OUHEZBYI.js} +2 -2
  145. package/dist/{chunk-MSR2QRUE.js → chunk-OVGYW7UD.js} +2 -2
  146. package/dist/{chunk-OPSAW5DT.js → chunk-OYKU4B3Y.js} +2 -2
  147. package/dist/{chunk-5YRQIE2B.js → chunk-POBJ6FR2.js} +2 -2
  148. package/dist/{chunk-ZGW4HLPD.js → chunk-PSZPMMWN.js} +2 -2
  149. package/dist/chunk-PXTRBKRK.js +3 -0
  150. package/dist/{chunk-U2N2KE7A.js → chunk-Q5JRIHT3.js} +2 -2
  151. package/dist/{chunk-GRX7JOXQ.js → chunk-Q7ATHARX.js} +2 -2
  152. package/dist/{chunk-5ZMBRQFC.js → chunk-Q7CSKIDM.js} +2 -2
  153. package/dist/{chunk-HG722PO7.js → chunk-QBQE7ZJ5.js} +2 -2
  154. package/dist/{chunk-Z2PZVKPR.js → chunk-QH22UIXP.js} +2 -2
  155. package/dist/chunk-QXCKQTKR.js +60 -0
  156. package/dist/chunk-RBAD4GJ2.js +13 -0
  157. package/dist/chunk-RMDPFPNW.js +2 -0
  158. package/dist/chunk-ROPJDEJZ.js +4 -0
  159. package/dist/{chunk-56NQAEPJ.js → chunk-RVZC6TJE.js} +2 -2
  160. package/dist/{chunk-XJX6LGHL.js → chunk-S4QZBKSR.js} +2 -2
  161. package/dist/chunk-SCPMZ73U.js +2 -0
  162. package/dist/{chunk-7IQXARSQ.js → chunk-SIAP5RGI.js} +2 -2
  163. package/dist/{chunk-4TQU4TX2.js → chunk-SIX4RFR3.js} +2 -2
  164. package/dist/{chunk-AYPDH2LU.js → chunk-SKKXTABJ.js} +2 -2
  165. package/dist/{chunk-ZYM4HOFA.js → chunk-SSRFUQBD.js} +2 -2
  166. package/dist/chunk-SYVJEEUJ.js +3 -0
  167. package/dist/chunk-T3CZAZSI.js +8 -0
  168. package/dist/chunk-T3I6NHBH.js +2 -0
  169. package/dist/{chunk-GDRJB3SB.js → chunk-T6DWDI5E.js} +2 -2
  170. package/dist/chunk-T6HRIROJ.js +7 -0
  171. package/dist/{chunk-OTSPRVNW.js → chunk-TAA7HXHE.js} +2 -2
  172. package/dist/{chunk-IJMD6BRI.js → chunk-TJ2JQYT3.js} +2 -2
  173. package/dist/chunk-TULNMD5T.js +368 -0
  174. package/dist/chunk-U2FPY5XA.js +3 -0
  175. package/dist/chunk-U3SXIMII.js +38 -0
  176. package/dist/{chunk-ENWQWA2R.js → chunk-U6KCHXJ4.js} +2 -2
  177. package/dist/chunk-UH3XSKS5.js +9 -0
  178. package/dist/{chunk-UDY7MIAW.js → chunk-UIFUZVCC.js} +2 -2
  179. package/dist/{chunk-BDGTPN27.js → chunk-UXKURIVI.js} +2 -2
  180. package/dist/{chunk-FGNCOQUX.js → chunk-V2RBODHL.js} +2 -2
  181. package/dist/chunk-VBKUWB6N.js +2 -0
  182. package/dist/{chunk-PIFTZEEM.js → chunk-VBV6ALJE.js} +2 -2
  183. package/dist/{chunk-2OXVP5U5.js → chunk-VDGFWCQV.js} +2 -2
  184. package/dist/chunk-VDSDOEWF.js +2 -0
  185. package/dist/{chunk-C76O5MDS.js → chunk-VZPWVCLN.js} +2 -2
  186. package/dist/chunk-WDSFQDPN.js +2 -0
  187. package/dist/{chunk-BTVKZGWT.js → chunk-WFA35BGR.js} +2 -2
  188. package/dist/{chunk-H7CG6LOE.js → chunk-WLMP3OCW.js} +2 -2
  189. package/dist/{chunk-WOOAY3PA.js → chunk-WSA52GOR.js} +2 -2
  190. package/dist/chunk-WYPL7GF7.js +2 -0
  191. package/dist/{chunk-RDULNRSJ.js → chunk-X3YVZAKZ.js} +2 -2
  192. package/dist/chunk-X6OGVFIT.js +2 -0
  193. package/dist/{chunk-ISWFRGJ6.js → chunk-XKXTR6ZI.js} +2 -2
  194. package/dist/chunk-Y5DFAW5W.js +4 -0
  195. package/dist/chunk-YSYPDRD5.js +3 -0
  196. package/dist/chunk-ZFVPWH62.js +5 -0
  197. package/dist/chunk-ZGIHTH27.js +2 -0
  198. package/dist/{chunk-QKT4UI2Y.js → chunk-ZGIQN2SX.js} +2 -2
  199. package/dist/chunk-ZHG4WAHR.js +12 -0
  200. package/dist/{chunk-CLG6DWVS.js → chunk-ZKB2XUEN.js} +2 -2
  201. package/dist/chunk-ZLMXIQLC.js +21 -0
  202. package/dist/chunk-ZMCQIHI4.js +2 -0
  203. package/dist/cli-main.js +2 -2
  204. package/dist/code-TAVIKWJI.js +2 -0
  205. package/dist/code-result-json-5FEFQCAQ.js +2 -0
  206. package/dist/command-descriptors-7BKH53Y3.js +343 -0
  207. package/dist/dataflow-GFBTVDH3.js +2 -0
  208. package/dist/dependence-slice-GWGQCODG.js +2 -0
  209. package/dist/deps-4QHVDPYA.js +2 -0
  210. package/dist/direct-navigation-4UBC6HNW.js +3 -0
  211. package/dist/entry-map-QCTF4RVY.js +2 -0
  212. package/dist/files-M2UBF5HJ.js +2 -0
  213. package/dist/frontend-profile-roles-D7eCum8P.d.ts +10 -0
  214. package/dist/{health-CPp2Jf1Z.d.ts → health-BI2a9WPy.d.ts} +60 -2
  215. package/dist/hierarchy-2UIHRLW4.js +2 -0
  216. package/dist/imports-WIE3YZOB.js +2 -0
  217. package/dist/index.d.ts +1 -1
  218. package/dist/index.js +1 -1
  219. package/dist/members-YKD636DA.js +2 -0
  220. package/dist/methods-VDF4IMYG.js +2 -0
  221. package/dist/output-continuation-command-4UMDOOLO.js +3 -0
  222. package/dist/output-pagination-2GME6OPY.js +19 -0
  223. package/dist/postinstall.js +1 -1
  224. package/dist/project-reindex-XEQTRCV5.js +3 -0
  225. package/dist/queries/affected.js +1 -1
  226. package/dist/queries/anchors.d.ts +1 -1
  227. package/dist/queries/anchors.js +1 -1
  228. package/dist/queries/architecture.js +1 -1
  229. package/dist/queries/bottlenecks.js +1 -1
  230. package/dist/queries/by-kind.js +1 -1
  231. package/dist/queries/call-graph.d.ts +2 -0
  232. package/dist/queries/call-graph.js +1 -1
  233. package/dist/queries/change-surface.js +1 -1
  234. package/dist/queries/cleanup-plan.js +1 -1
  235. package/dist/queries/co-change.d.ts +20 -2
  236. package/dist/queries/co-change.js +1 -1
  237. package/dist/queries/code.js +1 -1
  238. package/dist/queries/complexity-hotspots.js +1 -1
  239. package/dist/queries/complexity.js +1 -1
  240. package/dist/queries/context.js +1 -1
  241. package/dist/queries/convergence.js +1 -1
  242. package/dist/queries/coupling.js +1 -1
  243. package/dist/queries/cycles.js +1 -1
  244. package/dist/queries/dataflow.js +1 -1
  245. package/dist/queries/dead.d.ts +2 -0
  246. package/dist/queries/dead.js +1 -1
  247. package/dist/queries/decorative-checkers.js +1 -1
  248. package/dist/queries/deep-chains.js +1 -1
  249. package/dist/queries/dependence-slice.js +1 -1
  250. package/dist/queries/dependency-depth.js +1 -1
  251. package/dist/queries/deps.js +1 -1
  252. package/dist/queries/diff-impact.d.ts +9 -0
  253. package/dist/queries/diff-impact.js +1 -1
  254. package/dist/queries/doc-drift.js +1 -1
  255. package/dist/queries/drift.js +1 -1
  256. package/dist/queries/duplicate-bodies.d.ts +28 -1
  257. package/dist/queries/duplicate-bodies.js +1 -1
  258. package/dist/queries/entry-map.d.ts +1 -1
  259. package/dist/queries/entry-map.js +1 -1
  260. package/dist/queries/evidence.js +1 -1
  261. package/dist/queries/extract-candidates.d.ts +50 -23
  262. package/dist/queries/extract-candidates.js +1 -1
  263. package/dist/queries/fan.js +1 -1
  264. package/dist/queries/files.js +1 -1
  265. package/dist/queries/health.d.ts +1 -1
  266. package/dist/queries/health.js +1 -1
  267. package/dist/queries/hierarchy.js +1 -1
  268. package/dist/queries/hotspots.js +1 -1
  269. package/dist/queries/imports.js +1 -1
  270. package/dist/queries/incomplete-migration.js +1 -1
  271. package/dist/queries/index.d.ts +4 -3
  272. package/dist/queries/index.js +1 -1
  273. package/dist/queries/isolated.js +1 -1
  274. package/dist/queries/locality-candidates.js +1 -1
  275. package/dist/queries/members.js +1 -1
  276. package/dist/queries/methods.js +1 -1
  277. package/dist/queries/not-implemented.js +1 -1
  278. package/dist/queries/outline.js +1 -1
  279. package/dist/queries/passthrough-candidates.d.ts +9 -1
  280. package/dist/queries/passthrough-candidates.js +1 -1
  281. package/dist/queries/plan-context.js +1 -1
  282. package/dist/queries/react-component-duplicates.d.ts +19 -3
  283. package/dist/queries/react-component-duplicates.js +1 -1
  284. package/dist/queries/react-hook-candidates.d.ts +22 -3
  285. package/dist/queries/react-hook-candidates.js +1 -1
  286. package/dist/queries/react-large-component-pressure.d.ts +17 -3
  287. package/dist/queries/react-large-component-pressure.js +1 -1
  288. package/dist/queries/recent-duplicates.js +1 -1
  289. package/dist/queries/redundant-reexports.js +1 -1
  290. package/dist/queries/reference-neighborhood.js +1 -1
  291. package/dist/queries/reference-reachability.js +1 -1
  292. package/dist/queries/refs.js +1 -1
  293. package/dist/queries/self-audit.d.ts +7 -1
  294. package/dist/queries/self-audit.js +1 -1
  295. package/dist/queries/similar-chains.js +1 -1
  296. package/dist/queries/similar-files.js +1 -1
  297. package/dist/queries/similar-signatures.js +1 -1
  298. package/dist/queries/similar.js +1 -1
  299. package/dist/queries/slice.js +1 -1
  300. package/dist/queries/source-inspection.js +1 -1
  301. package/dist/queries/source-search.js +1 -1
  302. package/dist/queries/stale-abstractions.js +1 -1
  303. package/dist/queries/surface.js +1 -1
  304. package/dist/queries/symbols.js +1 -1
  305. package/dist/queries/system-map.d.ts +1 -1
  306. package/dist/queries/system-map.js +1 -1
  307. package/dist/queries/system.js +1 -1
  308. package/dist/queries/test-quality.js +1 -1
  309. package/dist/queries/trace.js +1 -1
  310. package/dist/queries/twin-ab.js +1 -1
  311. package/dist/queries/twin-drift.d.ts +22 -6
  312. package/dist/queries/twin-drift.js +1 -1
  313. package/dist/queries/unused-imports.js +1 -1
  314. package/dist/queries/unused-params.js +1 -1
  315. package/dist/queries/value-flow.js +1 -1
  316. package/dist/queries/vue-component-duplicates.js +1 -1
  317. package/dist/queries/vue-composable-candidates.js +1 -1
  318. package/dist/queries/vue-large-view-pressure.js +1 -1
  319. package/dist/queries/wrapper-candidates.d.ts +16 -1
  320. package/dist/queries/wrapper-candidates.js +1 -1
  321. package/dist/query-service-fastpath.js +5 -5
  322. package/dist/query-service-server.js +3 -3
  323. package/dist/refs-JNK5CLM7.js +2 -0
  324. package/dist/refs-pagination-6BLRYGMV.js +2 -0
  325. package/dist/reindex-worker.js +25 -25
  326. package/dist/reindex.d.ts +3 -2
  327. package/dist/reindex.js +35 -35
  328. package/dist/runtime.d.ts +34 -2
  329. package/dist/runtime.js +4 -4
  330. package/dist/rust-semantic-session-server.js +1 -1
  331. package/dist/rust-semantic-session-worker.js +1 -1
  332. package/dist/rust-semantic-worker.js +1 -1
  333. package/dist/{scip-cli-H-n59izO.d.ts → scip-cli-DOerTq-R.d.ts} +42 -4
  334. package/dist/slice-PHPVNCWX.js +2 -0
  335. package/dist/surface-MQX5MPIV.js +2 -0
  336. package/dist/symbol-resolution-DBLVXLBC.js +2 -0
  337. package/dist/system-JOPKV4OG.js +2 -0
  338. package/dist/trace-I2P2YFH4.js +2 -0
  339. package/dist/typescript-mailbox-worker.js +1 -1
  340. package/dist/value-flow-JJVMF7NP.js +2 -0
  341. package/dist/watch-server.js +3 -3
  342. package/docs/COMMAND_REFERENCE.md +2 -2
  343. package/docs/DETECTOR_GUIDE.md +51 -12
  344. package/docs/accuracy-audit-checklist.md +36 -13
  345. package/docs/locality-analyzer-design.md +9 -9
  346. package/package.json +2 -2
  347. package/skills/conductor/SKILL.md +110 -0
  348. package/skills/conductor/agents/openai.yaml +4 -0
  349. package/skills/principal-maintainability-review/SKILL.md +273 -0
  350. package/skills/principal-maintainability-review/agents/openai.yaml +4 -0
  351. package/skills/scip-calibrate/SKILL.md +102 -0
  352. package/skills/scip-calibrate/agents/openai.yaml +4 -0
  353. package/skills/scip-claim-audit/SKILL.md +113 -0
  354. package/skills/scip-claim-audit/agents/openai.yaml +4 -0
  355. package/skills/scip-probe-reachability/SKILL.md +93 -0
  356. package/skills/scip-probe-reachability/agents/openai.yaml +4 -0
  357. package/skills/scip-root-cause/SKILL.md +160 -0
  358. package/skills/scip-root-cause/agents/openai.yaml +4 -0
  359. package/skills/scip-system-compression/SKILL.md +252 -0
  360. package/skills/scip-system-compression/agents/openai.yaml +4 -0
  361. package/skills/scip-system-compression/references/compression-atlas.md +116 -0
  362. package/skills/scip-system-compression/references/compression-patterns.md +87 -0
  363. package/skills/scip-twin-drift/SKILL.md +109 -0
  364. package/skills/scip-twin-drift/agents/openai.yaml +4 -0
  365. package/dist/by-kind-4IYG2SKW.js +0 -2
  366. package/dist/call-graph-WQNXMNNN.js +0 -2
  367. package/dist/call-graph-evidence-lZa2dwQA.d.ts +0 -11
  368. package/dist/chunk-2BTJALUS.js +0 -454
  369. package/dist/chunk-3QXC54FQ.js +0 -3
  370. package/dist/chunk-3TJY6M3B.js +0 -7
  371. package/dist/chunk-42W3LFUK.js +0 -13
  372. package/dist/chunk-4GAQ6FI4.js +0 -43
  373. package/dist/chunk-6NC3YSPY.js +0 -38
  374. package/dist/chunk-6VEFRPTD.js +0 -5
  375. package/dist/chunk-7C26EKLZ.js +0 -4
  376. package/dist/chunk-7JYHQAH2.js +0 -22
  377. package/dist/chunk-7KSO2OAP.js +0 -2
  378. package/dist/chunk-7XZGZBSQ.js +0 -2
  379. package/dist/chunk-A77SCPW2.js +0 -3
  380. package/dist/chunk-AK3PYTIK.js +0 -5
  381. package/dist/chunk-AMIMMNA4.js +0 -11
  382. package/dist/chunk-AUY5BL74.js +0 -2
  383. package/dist/chunk-BDHFVH2M.js +0 -18
  384. package/dist/chunk-BECZLYNU.js +0 -8
  385. package/dist/chunk-BUTEIZKP.js +0 -10
  386. package/dist/chunk-BWVQP3LB.js +0 -38
  387. package/dist/chunk-BYDAFMSR.js +0 -57
  388. package/dist/chunk-BZYSGZRK.js +0 -2
  389. package/dist/chunk-C7IJMOFP.js +0 -134
  390. package/dist/chunk-CBBHFNLX.js +0 -2
  391. package/dist/chunk-D2MVJSP4.js +0 -21
  392. package/dist/chunk-D35XIZGN.js +0 -2
  393. package/dist/chunk-DKM723YF.js +0 -79
  394. package/dist/chunk-DRENNWRG.js +0 -2
  395. package/dist/chunk-E44IVWIJ.js +0 -367
  396. package/dist/chunk-EDMB6SSO.js +0 -7
  397. package/dist/chunk-EETGXQY7.js +0 -3
  398. package/dist/chunk-FKGQOTKD.js +0 -2
  399. package/dist/chunk-GH5YSGZL.js +0 -5
  400. package/dist/chunk-GQIDEID3.js +0 -2
  401. package/dist/chunk-HCVJR2V4.js +0 -3
  402. package/dist/chunk-IMKZEXZG.js +0 -2
  403. package/dist/chunk-ISIQLPJ2.js +0 -61
  404. package/dist/chunk-IXESDH3J.js +0 -2
  405. package/dist/chunk-JJ62MTQH.js +0 -40
  406. package/dist/chunk-JT6XX7QY.js +0 -8
  407. package/dist/chunk-KFOYCQAJ.js +0 -9
  408. package/dist/chunk-LRI5OMPE.js +0 -2
  409. package/dist/chunk-MHIEP7EG.js +0 -4
  410. package/dist/chunk-NK3JMP22.js +0 -2
  411. package/dist/chunk-NVSZNESQ.js +0 -2
  412. package/dist/chunk-OJNK5ALA.js +0 -2
  413. package/dist/chunk-OXYAWIEA.js +0 -2
  414. package/dist/chunk-OZETODHH.js +0 -2
  415. package/dist/chunk-PBUH2P5S.js +0 -3
  416. package/dist/chunk-PLJUQFQN.js +0 -2
  417. package/dist/chunk-PLYUVM4F.js +0 -2
  418. package/dist/chunk-PXXYQK55.js +0 -2
  419. package/dist/chunk-Q5TA4OY4.js +0 -20
  420. package/dist/chunk-Q7GBK5T7.js +0 -81
  421. package/dist/chunk-QLBSG7U5.js +0 -3
  422. package/dist/chunk-QWKHW6VZ.js +0 -2
  423. package/dist/chunk-RPL3ARU7.js +0 -16
  424. package/dist/chunk-SVHTMVA4.js +0 -4
  425. package/dist/chunk-T6QD2ZQB.js +0 -43
  426. package/dist/chunk-TD7VKJ2Y.js +0 -117
  427. package/dist/chunk-TKDNDQA7.js +0 -3
  428. package/dist/chunk-TQZV7KV4.js +0 -2
  429. package/dist/chunk-TUSPIVZ3.js +0 -4
  430. package/dist/chunk-URSGGIZX.js +0 -2
  431. package/dist/chunk-UT7TADJX.js +0 -2
  432. package/dist/chunk-V4NG5OMS.js +0 -554
  433. package/dist/chunk-VTCIYFEK.js +0 -2
  434. package/dist/chunk-VU6LIWHT.js +0 -2
  435. package/dist/chunk-VUSKPCUB.js +0 -2
  436. package/dist/chunk-WN3TCGJ4.js +0 -2
  437. package/dist/chunk-WSLEJSFR.js +0 -2
  438. package/dist/chunk-WYZIHUPZ.js +0 -16
  439. package/dist/chunk-XE33FV5W.js +0 -2
  440. package/dist/chunk-XGGBK66W.js +0 -4
  441. package/dist/chunk-XSWYJCAK.js +0 -2
  442. package/dist/chunk-Y334QQU5.js +0 -3
  443. package/dist/chunk-Z2AWCTN6.js +0 -2
  444. package/dist/chunk-ZOXKSQQB.js +0 -2
  445. package/dist/chunk-ZPASRBLF.js +0 -2
  446. package/dist/chunk-ZZ3Z7D56.js +0 -2
  447. package/dist/code-EQJFDT6I.js +0 -2
  448. package/dist/code-result-json-7UWIWBOO.js +0 -2
  449. package/dist/command-descriptors-ORNTVNYV.js +0 -342
  450. package/dist/dataflow-6VL54GX5.js +0 -2
  451. package/dist/dependence-slice-DT2NUHD2.js +0 -2
  452. package/dist/deps-DB7H5IKC.js +0 -2
  453. package/dist/direct-navigation-O3LUAYWQ.js +0 -3
  454. package/dist/entry-map-6K62RV3D.js +0 -2
  455. package/dist/files-MSLD7MO6.js +0 -2
  456. package/dist/hierarchy-IVBXAKFA.js +0 -2
  457. package/dist/imports-FRAVZ3Y2.js +0 -2
  458. package/dist/members-KJOJDYGO.js +0 -2
  459. package/dist/methods-2AYABBT3.js +0 -2
  460. package/dist/output-continuation-command-JHMPH6NC.js +0 -3
  461. package/dist/output-pagination-3OFL2MJV.js +0 -19
  462. package/dist/project-reindex-HYO4WD7Z.js +0 -3
  463. package/dist/refs-ARMA6XUJ.js +0 -2
  464. package/dist/refs-pagination-VUGIWN6U.js +0 -2
  465. package/dist/slice-YOB5YFAM.js +0 -2
  466. package/dist/surface-VY5EFWTW.js +0 -2
  467. package/dist/symbol-resolution-DGQN4XIV.js +0 -2
  468. package/dist/system-2KQ3QD2P.js +0 -2
  469. package/dist/trace-HTIPTXAE.js +0 -2
  470. package/dist/value-flow-5FV3VQI7.js +0 -2
@@ -1,21 +0,0 @@
1
- import{a as ye}from"./chunk-3TNRNKAT.js";import{b as ne,c as Xe}from"./chunk-7KCZELVM.js";import{a as Jn}from"./chunk-XN22RGSR.js";import{a as yt,b as ht,c as Yn,d as Ye,e as Yt,f as Me,g as Xt,h as Zt}from"./chunk-RNKPYYYE.js";import{b as Xn,c as Zn,d as bt}from"./chunk-SVHTMVA4.js";import{a as Wt,b as Un,c as Hn,d as Vn,h as Qt,i as Qn}from"./chunk-BYDAFMSR.js";import{a as je}from"./chunk-RYOYJMGF.js";import{b as mt}from"./chunk-FELGD32K.js";import{a as Ee,d as ft,e as Wn,f as gt,n as Vt}from"./chunk-2XCGSDIT.js";import{b as Ht}from"./chunk-EELPBR7E.js";import{b as jn,c as Kn}from"./chunk-TQZV7KV4.js";import{A as pt,B as J,C as ge,E as Ut,I as xe,K as Gn,R as X,S as zn,Y as Ge,h as dt,k as le,q as ut,s as zt,x as Y}from"./chunk-C7IJMOFP.js";import{a as Bn,b as On}from"./chunk-YXPUP5G2.js";import{b as qn,c as ee,h as re}from"./chunk-DRENNWRG.js";import{c as _n}from"./chunk-IW5XQG5G.js";import{D as Pe,c as $n,f as Dn}from"./chunk-AK3PYTIK.js";import{createHash as mc}from"crypto";var Xr=[{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 Zr(e){let t=new Set(e);return Xr.filter(n=>n.families.some(o=>t.has(o)))}function eo(e){return Zr(e).map(t=>`[${t.id}] ${t.capability} ${t.consequence} Recover selected paths with: ${t.recoverWith.map(n=>`scip-query ${n}`).join(", ")}.`)}var Jr=["incoming","outgoing","both"];function W(e,t,n,o={}){return{family:e,subtype:t,...o.match?{match:o.match}:{},directions:Jr,evidenceStrengths:o.strengths??["exact","derived","mixed"],supportCeiling:o.supportCeiling??"partial",establishes:n,nonClaims:o.nonClaims??[],recoverWith:o.recoverWith??["inspect","code"]}}var ei=["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"],ti=["captured-value-to-state","constant-to-state","expression-to-state","property-to-state","return-to-state","value-to-state"],ni=["await-completion-before","awaits-completion","inside-lock-scope","lexical-successor"],oi=[{id:"indexed-program-identity",label:"SCIP/compiler identity and source ownership",requirements:["indexed-graph"],relations:[W("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"]}),W("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"]}),W("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"]}),W("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"]}),W("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"]}),W("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"]}),W("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"]}),W("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"]}),W("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:[W("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"]}),W("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"]}),W("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"]}),W("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:[...ei.map(e=>W("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"]})),W("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"]}),W("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=>W("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:[W("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"]}),W("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"]}),W("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"]}),W("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"]}),W("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:[...ti.map(e=>W("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=>W("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"]})),...ni.map(e=>W("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=oi.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 Ce=["execution","runtime","dataflow","state","temporal","contract","identity","ownership","dependencies"];function Ke(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 no(e,t){return Ke(e.origins)-Ke(t.origins)||e.depth-t.depth||e.startLine-t.startLine||e.shortName.localeCompare(t.shortName)}var oo=new WeakMap,ro=new WeakMap,io=new WeakMap,ao=new WeakMap,so=new WeakMap;function lo(e,t){let n=ro.get(e);n||(n=new Map,ro.set(e,n));let o=n.get(t);if(o)return o;let r=Y(e,t)?.rootNode;if(!r)return n.set(t,[]),[];let a=new Set;he(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=xe(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"){X(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=nn([...s]).sort();return n.set(t,l),l}function Jt(e,t,n={}){let r=Ut(e,t)?.filter(m=>!n.ranges||n.ranges.some(p=>m.line>=p.startLine&&m.line<=p.endLine));if(!r)return{targets:[],unresolvedCallsites:0};let a=xe(e,t).filter(m=>!!m.sourcePath),i=vi(dt(e,t)??""),s=Y(e,t)?.rootNode??null,l=s?ii(s):co(),d=new Map,c=gt(e),u=[],f=0;for(let m of r){if(!m.memberAccess)continue;let p=ft(t,c.get(m.calleeLeaf)??[]);if(n.excludeIndexedTargets!==!1&&Wn(e,t,p,!0,m.calleeQualifier))continue;let g=m.calleeQualifier,b=bi(e,t,m,a);if(b){u.push(b);continue}let C=ri(e,t,m,a,ai(l,m.calleeQualifier,m.line));if(C.length>0){u.push(...C);continue}let S=si(e,t,m);if(S.length>0){u.push(...S);continue}let v=g?i.get(g)??g:null,y=(v?nn(a.filter(L=>(L.localName??L.importedName)===v).map(L=>L.sourcePath)):[]).flatMap(L=>{let x=d.get(L);return x||(x=ge(e,L)??[],d.set(L,x)),x.filter(M=>M.name===m.calleeLeaf).map(M=>({file:L,callable:M}))});if(y.length!==1){f+=1;continue}let N=y[0];u.push({calleeLeaf:m.calleeLeaf,line:m.line,sourceFile:t,targetFile:N.file,targetStartLine:N.callable.startLine,targetEndLine:N.callable.endLine,resolution:"direct-import-receiver",strength:"candidate"})}return{targets:u,unresolvedCallsites:f}}function ri(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=nn(o.filter(c=>c.localName===i||c.importedName===i).map(c=>c.sourcePath));if(s.length!==1)return[];let l=s[0],d=ui(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 co(){return{declarations:new Map,callbacks:[]}}function ii(e){let t=co();return he(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(he(d,u=>{if(u.type!=="member_expression")return;let f=u.childForFieldName("object")??u.namedChild(0),m=u.childForFieldName("property")??u.namedChild(1);f?.type==="identifier"&&m?.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;he(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 ai(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 si(e,t,n){let o=n.calleeQualifier;if(!o||!/^[A-Za-z_$][\w$]*$/u.test(o))return[];let r=Y(e,t)?.rootNode;if(!r)return[];let a=li(e,t,r,n.line,n.calleeLeaf,o),i=a?di(a,o):null;if(!i)return[];if(!ci(i))return[];let s=(ge(e,t)??[]).filter(m=>m.startLine<=i.startPosition.row&&m.endLine>=i.endPosition.row).sort((m,p)=>m.endLine-m.startLine-(p.endLine-p.startLine))[0];if(!s)return[];let l=X(e,t).filter(m=>m.isFunctionLike&&m.leaf===s.name);if(l.length!==1)return[];let d=l[0],c=ao.get(e);c||(c=new Map,ao.set(e,c));let u=`${d.symbol}\0${n.calleeLeaf}`,f=c.get(u);if(!f){let m=[];for(let p of Vt(e,d)){let g=Y(e,p.file)?.rootNode;if(!g)continue;let b=ut(g,"call_expression").filter(v=>v.startPosition.row>p.line||v.endPosition.row<p.line?!1:(v.childForFieldName("function")??v.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<[^<>]*>$/u,"").match(/[A-Za-z_$][\w$]*$/u)?.[0]===d.leaf);if(b.length!==1)continue;let S=b[0].childForFieldName("arguments")?.namedChildren.find(v=>Ae(v).type==="object");if(S)for(let v of Ae(S).namedChildren){if(v.type==="shorthand_property_identifier"&&v.text===n.calleeLeaf){m.push(...St(e,p.file,n.calleeLeaf,v,v));continue}if(v.type!=="pair")continue;let R=v.childForFieldName("key")??v.namedChild(0),y=v.childForFieldName("value")??v.namedChild(1);vt(R?.text)!==n.calleeLeaf||!y||m.push(...St(e,p.file,n.calleeLeaf,y,v))}}f=m.filter((p,g,b)=>b.findIndex(C=>C.file===p.file&&C.startLine===p.startLine&&C.endLine===p.endLine&&C.name===p.name)===g),c.set(u,f)}return f.map(m=>({calleeLeaf:m.name,line:n.line,sourceFile:t,targetFile:m.file,targetStartLine:m.startLine,targetEndLine:m.endLine,resolutionAlternativeCount:f.length,resolution:"factory-callback-member",strength:f.length===1?"exact":"candidate"}))}function li(e,t,n,o,r,a){let i=io.get(e);i||(i=new Map,io.set(e,i));let s=i.get(t);if(!s){s=new Map;for(let l of ut(n,"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]}`,m=s.get(f);(!m||l.endIndex-l.startIndex<m.endIndex-m.startIndex)&&s.set(f,l)}}i.set(t,s)}return s.get(`${o}\0${a}\0${r}`)??null}function ci(e){return e.descendantsOfType("return_statement").some(t=>{let n=t.childForFieldName("argument")??t.namedChild(0);return!!(n&&Ae(n).type==="object")})}function di(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&&he(o,a=>{a.type==="identifier"&&a.text===t&&(r=!0)}),r)return n}n=n.parent}return null}function St(e,t,n,o,r){if(o.type==="identifier")return(ge(e,t)??[]).filter(l=>l.name===o.text).map(l=>({...l,file:t}));let a=en(e,t,o.text);if(a.length>0)return a;if(!tn(o))return[];let s=(ge(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 ui(e,t,n){let o=so.get(e);o||(o=new Map,so.set(e,o));let r=`${t}\0${n}`,a=o.get(r);if(a)return a;let i=fi(e,t).flatMap(s=>pi(e,s,t,n));return o.set(r,i),i}function pi(e,t,n,o){let r=Y(e,t)?.rootNode,a=ge(e,t)??[];if(!r)return[];let i=gi(e,t,n);if(i.size===0)return[];let s=new Set,l=[],d=[],c=[];return he(r,f=>{if(mi(f,i)){if(f.type==="pair"){let m=f.childForFieldName("key")??f.namedChild(0),p=f.childForFieldName("value")??f.namedChild(1);if(vt(m?.text)!==o||!p)return;if(p.type==="identifier")s.add(p.text);else if(tn(p))l.push({name:o,startLine:f.startPosition.row,endLine:f.endPosition.row});else{let g=yi(e,t,p.text),b=en(e,t,p.text);if(g.length>0)c.push(...g);else if(b.length>0)c.push(...b);else{let C=hi(f);C&&d.push(C)}}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,m,p)=>p.findIndex(g=>g.file===f.file&&g.name===f.name&&g.startLine===f.startLine&&g.endLine===f.endLine)===m)}function mi(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 fi(e,t){let n=oo.get(e);n||(n=new Map,oo.set(e,n));let o=n.get(t);if(o)return o;let r=new Set([t]),a=X(e,t).filter(s=>s.leaf==="Service"&&s.isTypeLike);for(let s of a)for(let l of Vt(e,s))r.add(l.file);let i=[...r].sort();return n.set(t,i),i}function gi(e,t,n){let o=new Set;Pe(t,n)&&o.add("Service");for(let r of xe(e,t)){if(!r.sourcePath||!Pe(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 en(e,t,n){let o=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n.replace(/\s+/gu,""));if(!o)return[];let r=Y(e,t)?.rootNode;if(!r)return[];let a=uo(r,o[1]),i=a?po(a):null;if(!i)return[];let s=i.childForFieldName("function")??i.namedChild(0),l=s?mo(e,t,s.text):[];if(l.length!==1)return[];let d=l[0],c=Y(e,d.relativePath)?.rootNode;if(!c)return[];let u=zt(c,d.startLine,d.endLine);if(!u)return[];let f=[];for(let m of u.descendantsOfType("return_statement")){let p=m.childForFieldName("argument")??m.namedChild(0);if(!p)continue;let g=Ae(p);if(g.type==="object")for(let b of g.namedChildren){if(b.type==="shorthand_property_identifier"&&b.text===o[2]){for(let v of ge(e,d.relativePath)??[])v.name===o[2]&&f.push({...v,file:d.relativePath});continue}if(b.type!=="pair")continue;let C=b.childForFieldName("key")??b.namedChild(0),S=b.childForFieldName("value")??b.namedChild(1);if(!(vt(C?.text)!==o[2]||!S))if(S.type==="identifier")for(let v of ge(e,d.relativePath)??[])v.name===S.text&&f.push({...v,file:d.relativePath});else tn(S)&&f.push({name:o[2],startLine:b.startPosition.row,endLine:b.endPosition.row,file:d.relativePath})}}return f.filter((m,p,g)=>g.findIndex(b=>b.file===m.file&&b.name===m.name&&b.startLine===m.startLine&&b.endLine===m.endLine)===p)}function yi(e,t,n){let o=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n.replace(/\s+/gu,""));if(!o)return[];let r=Y(e,t)?.rootNode;if(!r)return[];let a=uo(r,o[1]),i=a?po(a):null,s=i?.childForFieldName("function")??i?.namedChild(0),l=s?mo(e,t,s.text):[];if(l.length!==1||!i)return[];let d=l[0],c=Y(e,d.relativePath)?.rootNode;if(!c)return[];let u=zt(c,d.startLine,d.endLine);if(!u)return[];let f=new Set,m=u.childForFieldName("parameters")??u.childForFieldName("parameter");if(m&&he(m,L=>{L.type==="identifier"&&f.add(L.text)}),f.size===0)return[];let p=en(e,t,n);if(p.length===0)return[];let g=(ge(e,d.relativePath)??[]).filter(L=>L.startLine>=d.startLine&&L.endLine<=d.endLine),b=(Ut(e,d.relativePath)??[]).filter(L=>L.line>=d.startLine&&L.line<=d.endLine),C=new Set,S=p.map(L=>({name:L.name,startLine:L.startLine,endLine:L.endLine})),v=new Set;for(;S.length>0&&v.size<32;){let L=S.shift(),x=`${L.name}\0${L.startLine}\0${L.endLine}`;if(!v.has(x)){v.add(x);for(let M of b.filter(h=>h.line>=L.startLine&&h.line<=L.endLine)){if(M.memberAccess&&M.calleeQualifier&&f.has(M.calleeQualifier)){C.add(M.calleeLeaf);continue}if(M.memberAccess)continue;let h=g.filter(P=>P.name===M.calleeLeaf);h.length===1&&S.push(h[0])}}}if(C.size===0)return[];let y=i.childForFieldName("arguments")?.namedChildren.find(L=>Ae(L).type==="object");if(!y)return[];let N=[];for(let L of Ae(y).namedChildren){if(L.type==="shorthand_property_identifier"&&C.has(L.text)){N.push(...St(e,t,L.text,L,L));continue}if(L.type!=="pair")continue;let x=L.childForFieldName("key")??L.namedChild(0),M=L.childForFieldName("value")??L.namedChild(1),h=vt(x?.text);!h||!C.has(h)||!M||N.push(...St(e,t,h,M,L))}return N.filter((L,x,M)=>M.findIndex(h=>h.file===L.file&&h.name===L.name&&h.startLine===L.startLine&&h.endLine===L.endLine)===x)}function uo(e,t){for(let n of ut(e,"variable_declarator"))if((n.childForFieldName("name")??n.namedChild(0))?.text===t)return n.childForFieldName("value")??n.namedChild(1);return null}function po(e){return e.type==="call_expression"?e:e.descendantsOfType("call_expression")[0]??null}function mo(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=xe(e,t).filter(p=>p.localName===r[1]&&p.sourcePath);if(u.length!==1||!u[0].sourcePath)return[];let f=u[0].sourcePath,m=je(e,f,r[2]).filter(p=>p.isFunctionLike);return m.length>0?m:(ge(e,f)??[]).filter(p=>p.name===r[2]).map(p=>({...p,relativePath:f}))}if(!/^[A-Za-z_$][\w$]*$/u.test(o))return[];let a=X(e,t).filter(u=>u.leaf===o&&u.isFunctionLike);if(a.length>0)return a;let i=(ge(e,t)??[]).filter(u=>u.name===o).map(u=>({...u,relativePath:t}));if(i.length>0)return i;let s=xe(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=je(e,l,d).filter(u=>u.isFunctionLike);return c.length>0?c:(ge(e,l)??[]).filter(u=>u.name===d).map(u=>({...u,relativePath:l}))}function tn(e){return["arrow_function","function_expression","generator_function"].includes(e.type)||e.descendantsOfType(["arrow_function","function_expression","generator_function"]).length>0}function hi(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 vt(e){return e?e.replace(/^(?:['"])(.*)(?:['"])$/u,"$1"):null}function bi(e,t,n,o){let r=/^this\.([A-Za-z_$][\w$]*)$/u.exec(n.calleeQualifier??"");if(!r)return null;let a=Y(e,t)?.rootNode;if(!a)return null;let i=Si(a,n.line);if(!i)return null;let s=new Set;if(he(i,g=>{if(g.type!=="assignment_expression")return;let b=g.childForFieldName("left")??g.namedChild(0),C=g.childForFieldName("right")??g.namedChild(g.namedChildCount-1);if(b?.text.replace(/\s+/gu,"")!==`this.${r[1]}`||!C)return;let S=Ae(C);if(S.type!=="new_expression")return;let R=(S.childForFieldName("constructor")??S.namedChild(0))?.text.match(/[A-Za-z_$][\w$]*$/u)?.[0];R&&s.add(R)}),s.size!==1)return null;let l=[...s][0],d=o.filter(g=>g.localName===l);if(d.length!==1)return null;let c=d[0].importedName==="default"?l:d[0].importedName,u=d[0].importedName==="default"?je(e,d[0].sourcePath,l):[],f=u.length===1?u[0].leaf:c,m=X(e,d[0].sourcePath).filter(g=>g.isFunctionLike&&g.leaf===n.calleeLeaf&&qn(g.symbol)===f);if(m.length!==1)return null;let p=m[0];return{calleeLeaf:n.calleeLeaf,line:n.line,sourceFile:t,targetFile:p.relativePath,targetStartLine:p.startLine,targetEndLine:p.endLine,targetSymbol:p.symbol,resolution:"constructed-member-receiver",strength:"exact"}}function Si(e,t){let n=[];return he(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 Ae(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 he(e,t){t(e);for(let n of e.namedChildren)he(n,t)}function vi(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 nn(e){let t=[];for(let n of e)t.some(o=>Pe(o,n))||t.push(n);return t}import{existsSync as Ei}from"fs";import{SymbolRole as Ci}from"@c4312/scip";import{deserializeSCIP as xi}from"@c4312/scip";function fo(e,t){return xi(Dn(e,{inputKind:t,maxBytes:$n}))}var on=new WeakMap;function xt(e,t,n,o){let r=J(e,t),a=(r?.callSites??[]).filter(m=>m.line>=n&&m.line<=o);if(!r||a.length===0)return{available:!!r,targets:[],resolvedCallsites:0,unresolvedCallsites:0};let i=an(e);if(!i)return{available:!1,targets:[],resolvedCallsites:0,unresolvedCallsites:a.length};let s=(i.byFile.get(t)??[]).filter(m=>m.sourceLine>=n&&m.sourceLine<=o).map(m=>({...m,calleeLeaf:m.definition.leaf})),l=go(a.map(m=>({line:m.line,leaf:m.calleeLeaf}))),d=go(s.map(m=>({line:m.sourceLine,leaf:m.calleeLeaf}))),c=new Set([...l].flatMap(([m,p])=>d.get(m)===p?[m]:[])),u=s.filter(m=>c.has(ho(m.sourceLine,m.calleeLeaf))),f=[...c].reduce((m,p)=>m+(l.get(p)??0),0);return{available:!0,targets:u,resolvedCallsites:f,unresolvedCallsites:Math.max(0,a.length-f)}}function rn(e,t,n,o){let r=an(e);return r?{available:!0,targets:(r.byFile.get(t)??[]).filter(a=>a.sourceLine>=n&&a.sourceLine<=o)}:{available:!1,targets:[]}}function yo(e,t,n,o){let r=an(e);return r?{available:!0,targets:(r.byFile.get(t)??[]).filter(a=>a.sourceLine>=n&&a.sourceLine<=o&&Et(e,a.definition)).map(a=>({...a,calleeLeaf:a.definition.leaf}))}:{available:!1,targets:[]}}function an(e){if(on.has(e))return on.get(e)??null;let t=Li(e);return on.set(e,t),t}function Li(e){if(!e.generation.indexPath||!Ei(e.generation.indexPath))return null;try{let t=zn(e),n=new Map(t.map(a=>[a.symbol,a])),o=fo(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&Ci.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 Et(e,t){if(!t.isFunctionLike)return!1;let n=J(e,t.relativePath);return!n||n.callables.some(o=>o.name===t.leaf&&o.startLine===t.startLine&&o.endLine===t.endLine)?!0:Ii(t)}function Ii(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 go(e){let t=new Map;for(let n of e){let o=ho(n.line,n.leaf);t.set(o,(t.get(o)??0)+1)}return t}function ho(e,t){return`${e}\0${t}`}var wi=16,Ni=4,Mi=3e3,Ri=800,Ti=new Set(["assignment","const_declaration","const_item","field_declaration","lexical_declaration","local_declaration_statement","local_variable_declaration","static_item","variable_declaration"]);function Co(e,t,n={}){let o=n.maxSteps??wi;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(E=>[E.id,E])),a=_i(n.focusLocations??[]),i=new Set,s=new Map(t.edges.map(E=>[E.id,E])),l=Le(t.paths.flatMap(E=>E.nodeIds)),d=Le(t.anchors.filter(E=>E.status==="matched").flatMap(E=>E.nodeIds)),c=t.nodes.filter(E=>E.disposition==="emitted"&&E.attributes.upstreamCausalPath===!0).sort((E,k)=>Number(k.attributes.upstreamCausalDistance??0)-Number(E.attributes.upstreamCausalDistance??0)||E.id.localeCompare(k.id)).map(E=>E.id),u=new Set(c),f=Math.max(0,o-d.length),p=Fi(t,d,a,f).slice(0,f),g=new Set(p),b=new Set(p),C=new Set([...l,...c,...d]),S=t.edges.filter(E=>E.disposition==="emitted"&&E.kind!=="structural-membership"),v=t.edges.filter(E=>E.disposition!=="excluded"&&E.disposition!=="unsupported"&&E.kind!=="structural-membership"),R=new Set([...t.paths.flatMap(E=>E.edgeIds),...S.filter(E=>u.has(E.fromNodeId)&&u.has(E.toNodeId)).map(E=>E.id)]),y=t.paths.some(E=>E.edgeIds.length>0),N=new Set(d);for(let E of p)N.add(E);for(let E of t.paths){let k=E.nodeIds[0],G=s.get(E.edgeIds[0]??""),H=E.nodeIds[1];k&&H&&G?.fromNodeId===k&&G.toNodeId===H&&N.add(k)}if(t.paths.every(E=>E.nodeIds.length===0))for(let E of t.anchors)for(let k of E.nodeIds)N.add(k);let L=Ki(d,v,r,Ni),x=Le(S.filter(E=>E.kind==="call"&&d.includes(E.fromNodeId)).map(E=>E.toNodeId)),M=new Set(Le([...L,...y?[]:x]));for(let E of M)N.add(E);let h=Le(S.flatMap(E=>C.has(E.fromNodeId)||C.has(E.toNodeId)?[E.fromNodeId,E.toNodeId]:[])),P=t.nodes.filter(E=>E.disposition==="emitted"&&E.kind!=="structural-region"&&S.some(k=>k.fromNodeId===E.id||k.toNodeId===E.id)).map(E=>E.id),D=Le([...c,...l,...d,...p,...M,...h,...P]).filter(E=>r.has(E)),O=[];for(let E of D)y&&!C.has(E)&&!g.has(E)&&!M.has(E)||O.length>=o&&!C.has(E)||O.push(E);let w=new Set(O),T=new Map(O.map(E=>[E,zi(E)])),I=new Set([...l,...c]),_=new Set(t.anchors.flatMap(E=>E.nodeIds)),A=O.map((E,k)=>{let G=r.get(E),H=Di(G,a);for(let me of H)i.add(qe(G.location.file,me));return{id:T.get(E),nodeId:E,order:k,role:_.has(E)?"anchor":I.has(E)?"connector":"junction",kind:G.kind,label:G.label,location:G.location,behavior:Pi(e,G,_.has(E),[...new Set([...H,...$i(e,G,v,r,R,N)])],H,N.has(G.id)&&(H.length===0||_.has(G.id)),M.has(G.id),b.has(G.id)&&H.length===0)}}),j=new Map;for(let E of t.paths)for(let k=0;k<E.edgeIds.length;k+=1){let G=s.get(E.edgeIds[k]),H=E.nodeIds[k],me=E.nodeIds[k+1];!G||!H||!me||j.set(G.id,G.fromNodeId===H&&G.toNodeId===me?"forward":"reverse")}let B=v.filter(E=>w.has(E.fromNodeId)&&w.has(E.toNodeId)).sort((E,k)=>qi(E,k,t)).map((E,k)=>({id:Ui(E.id),edgeId:E.id,order:k,kind:E.kind,fromStepId:T.get(E.fromNodeId),toStepId:T.get(E.toNodeId),directed:!0,pathTraversal:j.get(E.id)??"adjacent",evidence:E.evidence})),U=new Map(B.map(E=>[E.edgeId,E.id])),q=t.paths.map(E=>({id:E.id,status:E.status,stepIds:E.nodeIds.flatMap(k=>{let G=T.get(k);return G?[G]:[]}),transitionIds:E.edgeIds.flatMap(k=>{let G=U.get(k);return G?[G]:[]})})),se=A.flatMap(E=>E.location?[`${E.location.file}:${E.location.line+1}`]:[]),Ne=t.anchors.some(E=>E.status==="ambiguous"),Oe=q.some(E=>E.status==="connected"||E.status==="candidate"),ve=q.some(E=>E.status==="partial");return{status:A.length===0?"unavailable":Ne?"ambiguous":Oe&&!ve?"connected":ve?"partial":"connected",steps:A,transitions:B,paths:q,coverage:{candidateNodes:D.length,returnedNodes:O.length,omittedNodeIds:D.filter(E=>!w.has(E)),returnedTransitions:B.length,withheldStatements:A.reduce((E,k)=>E+(k.behavior?.coverage.omittedStatements??0),0),requestedFocusLocations:a,matchedFocusLocations:a.filter(E=>i.has(qe(E.file,E.line))),unmatchedFocusLocations:a.filter(E=>!i.has(qe(E.file,E.line)))},behaviorCommand:Eo(se,"behavior"),exactSourceCommand:Eo(se,"source")}}function Fi(e,t,n,o){if(o<=0||n.length===0)return[];let r=new Set(t),a=new Set(n.map(i=>qe(i.file,i.line)));return Le(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(qe(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 Pi(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=le(e,t.location.file),c=o.length>0?o:[t.location.line],u=t.kind==="runtime-boundary-participant"?Ye(e,t.location.file,0,Math.max(0,d.length-1),[t.location.line]):Ye(e,t.location.file,t.location.line,l,c),f=o.filter(M=>M>=u.startLine&&M<=u.endLine),m=yt(e,t.location.file,u.startLine,u.endLine,f),p=m??(f.length>0?yt(e,t.location.file,u.startLine,u.endLine,f,{requireSavings:!1}):null),g=f.length>0?Bi(e,t,u.startLine,u.endLine,f,p,a):null,b=d.slice(u.startLine,u.endLine+1).join(`
2
- `).length,C=Me(e,t.location.file,u.startLine,u.endLine),S=d.slice(u.startLine,u.endLine+1).some((M,h)=>M.length>Ri&&(C.get(u.startLine+h)??[]).some(P=>["binding","branch","loop","call","return","throw","mutation"].includes(P))),v=M=>Ai(e,t,u.startLine,u.endLine,r.filter(h=>h>=u.startLine&&h<=u.endLine),M),R=(i||t.kind==="runtime-boundary-participant"||t.anchorIds.length>0)&&b<=Mi,y=n&&(f.length===0||R);if(m&&(s||y))return v(bo(m));if(!s&&!y&&g&&!S&&!R&&g.renderedCharacters<(p?.outlineCharacters??b))return v(g);if(m)return v(bo(m));let N=d.slice(u.startLine,u.endLine+1),L=N.join(`
3
- `),x=Me(e,t.location.file,u.startLine,u.endLine);return v({kind:"source",constructKind:"source construct",signature:N.find(M=>M.trim().length>0)?.trim()??t.label,lines:N.map((M,h)=>({line:u.startLine+h,endLine:u.startLine+h,depth:0,signals:x.get(u.startLine+h)??[],text:M,copied:!0})),coverage:{sourceStatements:N.length,representedStatements:N.length,copiedStatements:N.length,omittedStatements:0},rawCharacters:L.length,renderedCharacters:L.length})}function Ai(e,t,n,o,r,a){if(!t.location)return a;let i=rn(e,t.location.file,n,o);if(!i.available)return a;let s=Me(e,t.location.file,n,o),l=le(e,t.location.file),d=new Set(r);for(let S of r){let v=Ct(l[S]??"");if(!v)continue;let R=Ee(e,t.location.file,v).find(y=>y>S&&y<=o);R!==void 0&&d.add(R)}let c=[...new Map(i.targets.flatMap(S=>{let v=S.definition,R=v.relativePath===t.location.file&&v.startLine<=o&&v.endLine>=n;if(v.isTypeLike||R)return[];let y=Et(e,v),N=r.length>0&&y&&s.get(S.sourceLine)?.includes("return"),L=y&&d.has(S.sourceLine);return y&&!N&&!L?[]:[[v.symbol,{definition:v,kind:N?"return-value-transformer":L?"focused-causal-target":"compiler-referenced-declaration"}]]})).values()].sort((S,v)=>S.definition.relativePath.localeCompare(v.definition.relativePath)||S.definition.startLine-v.definition.startLine||S.definition.symbol.localeCompare(v.definition.symbol)),u=[],f=c.filter(({kind:S})=>S!=="compiler-referenced-declaration").map(({definition:S})=>({owner:S,depth:1})),m=new Set,p=new Set(c.map(({definition:S})=>S.symbol));for(;f.length>0;){let S=f.shift();if(!S||m.has(S.owner.symbol))continue;m.add(S.owner.symbol);let{owner:v,depth:R}=S,y=rn(e,v.relativePath,v.startLine,v.endLine);if(!y.available)continue;let N=Me(e,v.relativePath,v.startLine,v.endLine),L=le(e,v.relativePath);for(let x of y.targets){let M=x.definition,h=M.relativePath===v.relativePath&&M.startLine<=v.endLine&&M.endLine>=v.startLine;if(M.isTypeLike||h)continue;let P=Et(e,M),D=Ct(L[x.sourceLine]??""),O=P&&D!==null&&Ee(e,v.relativePath,D).some(T=>T>x.sourceLine&&T<=v.endLine&&(N.get(T)??[]).some(I=>["branch","return","throw"].includes(I))),w=P&&((N.get(x.sourceLine)??[]).some(T=>["branch","return","throw"].includes(T))||O);P&&!w||(p.has(M.symbol)||(p.add(M.symbol),u.push({definition:M,kind:P?"focused-causal-target":"compiler-referenced-declaration"})),P&&R<2&&f.push({owner:M,depth:R+1}))}}let g=[...new Map([...c,...u].map(S=>[S.definition.symbol,S])).values()].sort((S,v)=>S.definition.relativePath.localeCompare(v.definition.relativePath)||S.definition.startLine-v.definition.startLine||S.definition.symbol.localeCompare(v.definition.symbol)),b=[],C=[];for(let{definition:S,kind:v}of g){let R=v==="compiler-referenced-declaration"?ki(e,S.relativePath,S.startLine,S.endLine):{startLine:S.startLine,endLine:S.endLine},y=le(e,S.relativePath).slice(R.startLine,R.endLine+1).join(`
4
- `),N=v==="compiler-referenced-declaration"?null:yt(e,S.relativePath,S.startLine,S.endLine,[]),L=N?[N.signature,...N.lines.map(D=>`${D.line+1}${D.signals.length>0?`[${D.signals.join(",")}]`:""} ${D.text}`)].join(" | "):null,x=L&&L.length<y.length?L:y,M={symbol:S.symbol,label:S.leaf,file:S.relativePath,line:R.startLine,endLine:R.endLine},h=v==="compiler-referenced-declaration"?1e3:8e3,P=v==="compiler-referenced-declaration"?12:120;if(x.length>h||R.endLine-R.startLine>P){C.push({...M,reason:"source-too-large"});continue}b.push({kind:v,...M,text:x})}return{...a,...b.length===0?{}:{supportingDeclarations:b},...C.length===0?{}:{omittedSupportingDeclarations:C}}}function ki(e,t,n,o){let r=Y(e,t);if(!r)return{startLine:n,endLine:o};let a=[];Lo(r.rootNode,s=>{Ti.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 Lo(e,t){t(e);for(let n of e.namedChildren)Lo(n,t)}function bo(e){return{kind:"outline",constructKind:e.constructKind,signature:e.signature,lines:e.lines,coverage:e.coverage,rawCharacters:e.rawCharacters,renderedCharacters:e.outlineCharacters}}function $i(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(J(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 Qt(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(C=>C.location?.file===t.location.file?[C.location.line]:[]),m=f.filter(C=>s.has(C));for(let C of m.length>0?m:f)i.add(C);let p=d?.attributes.leaf;if(typeof p!="string"||p.length===0)continue;let g=Ee(e,t.location.file,p).filter(C=>C>=t.location.line&&C<=(t.location.endLine??t.location.line)),b=g.find(C=>s.has(C))??g[0];b!==void 0&&i.add(b)}return[...i].sort((l,d)=>l-d)}function Di(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 _i(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(qe(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 qe(e,t){return`${e}\0${t}`}function Bi(e,t,n,o,r,a,i){if(!t.location)return null;let s=le(e,t.location.file),l=Me(e,t.location.file,n,o),d=[...l].filter(([,w])=>w.length>0).map(([w])=>w).sort((w,T)=>w-T),c=r.map(w=>(l.get(w)??[]).length>0?w:d.find(T=>T>w&&T-w<=8)??w),u=new Set([...r,...c]),f=i?Yt(e,t.location.file,n,o,{minimumBodyLines:0}):null,m=a?[...new Map(c.flatMap(w=>a.lines.filter(T=>T.text.length<=500&&T.signals.some(I=>["branch","loop","catch","finally"].includes(I))&&w>=T.line&&w<=T.endLine).sort((T,I)=>T.endLine-T.line-(I.endLine-I.line)||T.line-I.line).slice(0,2).map(T=>[`${T.line}\0${T.endLine}`,T]))).values()]:ht(e,t.location.file,n,o,c);for(let w of f?.lines??[])u.add(w.line);for(let w of m)u.add(w.line);for(let[w,T]of l)T.includes("call")&&T.includes("shape")&&u.add(w);let p=[];for(let w of c){let T=Ct(s[w]??"");if(!T)continue;let I=Ee(e,t.location.file,T).filter(B=>B>w&&B<=o),_=I[0];_!==void 0&&u.add(_);let A=I.find(B=>(l.get(B)??[]).some(U=>U==="branch"||U==="loop"));if(A===void 0)continue;u.add(A);let j=(a?.lines??[]).find(B=>B.line===A)??{line:A,endLine:Math.min(o,A+40),depth:0,signals:l.get(A)??[],text:(s[A]??"").trim(),copied:!0},$=a?.lines??s.slice(j.line,j.endLine+1).map((B,U)=>{let q=j.line+U;return{line:q,endLine:q,depth:0,signals:l.get(q)??[],text:B.trim(),copied:!0}});p.push({focusLine:w,governingUse:A,lines:$.filter(B=>B.line>=j.line&&B.line<=j.endLine&&B.text.length<=500&&B.signals.some(U=>["binding","branch","call","mutation"].includes(U)))})}for(let w of p.sort((T,I)=>I.governingUse-I.focusLine-(T.governingUse-T.focusLine)||T.focusLine-I.focusLine).slice(0,2))for(let T of w.lines.slice(0,14))u.add(T.line);let g=new Set(["binding","branch","loop","call","return","throw","mutation"]);for(let w of m)for(let T of a?.lines??[])T.line<w.line||T.line>w.endLine||T.signals.some(I=>g.has(I))&&u.add(T.line);let b=s.slice(n,o+1).flatMap((w,T)=>{let I=Ct(w);return I?[{name:I,line:n+T}]:[]}),C=!0;for(;C;){C=!1;for(let w of b)if([...u].some(I=>Gi(s[I]??"",w.name))){u.has(w.line)||(u.add(w.line),C=!0);for(let I of Ee(e,t.location.file,w.name))I<n||I>o||u.has(I)||(l.get(I)??[]).some(_=>g.has(_))&&(u.add(I),C=!0)}}for(let w of a?.lines??[])if(w.signals.some(T=>["branch","loop","catch","finally"].includes(T))&&u.has(w.line))for(let T of a?.lines??[])T.line<w.line||T.line>w.endLine||T.signals.some(I=>g.has(I))&&u.add(T.line);let S=J(e,t.location.file),v=new Set(S?.callSites.map(w=>w.line)??[]),R=l,y=new Map([...a?.lines??[],...m].filter(w=>w.signals.some(T=>["branch","loop","catch","finally"].includes(T))).map(w=>[w.line,w])),N=new Map((a?.lines??[]).filter(w=>w.text.length<=500&&w.signals.includes("shape")&&(w.signals.includes("call")||w.signals.includes("mutation")||w.signals.includes("return"))).sort((w,T)=>w.endLine-w.line-(T.endLine-T.line)||w.line-T.line).map(w=>[w.line,w])),L=new Map((f?.lines??[]).map(w=>[w.line,w.signals.filter(T=>T!=="lifecycle")])),x=[...u].filter(w=>w>=n&&w<=o).sort((w,T)=>w-T).map(w=>{let T=y.get(w)??N.get(w);return{line:w,endLine:T?.endLine??w,depth:T?.depth??0,signals:Oi([...R.get(w)??[],...a?.lines.filter(I=>w>=I.line&&w<=I.endLine).flatMap(I=>I.signals)??[],...L.get(w)??[],...r.includes(w)?["anchor"]:[],...v.has(w)?["call"]:[]]),text:T?.text??(s[w]??"").trim(),copied:T?.copied??!0}}).filter(w=>w.text.length>0);if(x.length===0)return null;let M=f?.candidateLines??Yt(e,t.location.file,n,o,{minimumBodyLines:0})?.candidateLines??0,h=Math.max(a?.coverage.sourceStatements??0,M,x.length),P=a?.signature??(s[n]??t.label).trim(),D=P.length+x.reduce((w,T)=>w+T.text.length+T.signals.join(",").length+12,0),O=s.slice(n,o+1).join(`
5
- `).length;return{kind:"connector-slice",constructKind:a?.constructKind??"source construct",signature:P,lines:x,coverage:{sourceStatements:h,representedStatements:x.length,copiedStatements:x.length,omittedStatements:Math.max(0,h-x.length)},rawCharacters:O,renderedCharacters:D}}function Oi(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 Ct(e){return/\b(?:const|let|var)\s+([\p{L}_$][\p{L}\p{N}_$]*)\s*(?:=|\bof\b|\bin\b)/u.exec(e)?.[1]??null}function Gi(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`(?:^|[^\\p{L}\\p{N}_$])${n}(?:$|[^\\p{L}\\p{N}_$])`,"u").test(e)}function ji(e,t,n){return Le(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=So(s.edge)-So(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 So(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:xo(e.location.file)===xo(t.location.file)}function xo(e){return e.split("/").filter(Boolean).slice(0,2).join("/")}function Ki(e,t,n,o){let r=new Set(e),a=new Set,i=[],s=Le(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=ji(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 qi(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 zi(e){return`step:${e}`}function Ui(e){return`transition:${e}`}function Eo(e,t){return e.length===0?null:`scip-query inspect ${e.map(n=>`--at ${Wi(n)}`).join(" ")} --view ${t}`}function Wi(e){return`'${e.replace(/'/gu,`'"'"'`)}'`}function Le(e){return[...new Set(e)]}var Hi=6;function Io(e,t,n){return`${e}\0${t}\0${n??t}`}function Ro(e,t,n,o={}){let r=o.limit??Hi;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(x=>[x.id,x])),s=new Set(n.steps.map(x=>x.nodeId)),l=new Set(n.steps.flatMap(x=>{let M=sn(i.get(x.nodeId));return M?[M]:[]})),d=new Set;for(let x of n.steps)for(let M of x.behavior?.supportingDeclarations??[])l.add(M.symbol),d.add(Io(M.file,M.line,M.endLine));let c=x=>x.symbol!==null&&l.has(x.symbol)||d.has(Io(x.file,x.line,x.endLine)),u=new Map(n.steps.flatMap(x=>{if(!x.location)return[];let M=sn(i.get(x.nodeId));if(!M)return[];let h=X(e,x.location.file).find(P=>P.symbol===M);return h?[[x.id,h]]:[]})),f=new bt(e).calleeMap([...u.values()],{additive:!1,semantic:!0}),m=[],p=new Set,g=new Set,b=0,C=0,S=0,v=0,R=0,y=0,N=0,L=0;for(let x of n.steps){if(!x.location||!x.behavior)continue;let M=Vi(x,{db:e,topology:t,nodeById:i,returnedNodeIds:s,sourceAllowed:a,alternativeAlreadyReturned:c});m.push(...M.candidates),y+=M.upstreamCandidates,L+=M.runtimeCandidates,N+=M.resultCandidates;let h=Qi(x,{db:e,topology:t,nodeById:i,returnedNodeIds:s,sourceAllowed:a,alternativeAlreadyReturned:c},p);m.push(...h);let P=Yi(x,{db:e,topology:t,nodeById:i,returnedNodeIds:s,sourceAllowed:a,alternativeAlreadyReturned:c},{evidencedCallsiteKeys:p,consideredCandidateKeys:g,calleeMap:f,stepDefinition:u.get(x.id)});m.push(...P.candidates),b+=P.scannedBehaviorSteps,C+=P.visibleCallsites,S+=P.identityCandidateCallsites,v+=P.ambiguousCallsites,R+=P.unresolvedCallsites}return Xi(e,m,n.steps,r,{scannedBehaviorSteps:b,visibleCallsites:C,graphEvidencedCallsites:p.size,identityCandidateCallsites:S,ambiguousCallsites:v,unresolvedCallsites:R,upstreamCandidates:y,resultCandidates:N,runtimeCandidates:L},o.selectionTerms)}function Vi(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"?ln(t.db,u):pn(u);if(!f||t.alternativeAlreadyReturned(f))continue;let m=cn(l,u.location.file)??u.location,p=le(t.db,m.file)[m.line]?.trim(),g=d?"upstream":"downstream",b=l.kind==="runtime-boundary"?d?"runtime-producer":"runtime-consumer":d?"caller":"callee",C=dn(l.evidence),S=Je(u);n.push({anchor:{id:ze(e.id,m.line,u.id),status:C,source:"graph-relation",direction:g,causalRole:b,relationKind:l.kind,fromStepId:e.id,fromLabel:e.label,callsite:{file:m.file,line:m.line,endLine:m.endLine??m.line,text:p||`${u.label} \u2192 ${e.label}`,signals:["call"],calleeLeaf:S},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=ln(t.db,d);if(!c||t.alternativeAlreadyReturned(c))continue;let u=Je(d),f=cn(l,e.location.file)?.line,m=e.behavior.lines.find(b=>(f===void 0||f>=b.line&&f<=b.endLine)&&b.text.includes(u));if(!m)continue;let p=Fo(m.signals),g=dn(l.evidence);n.push({anchor:{id:ze(e.id,m.line,d.id),status:g,source:"graph-relation",direction:"downstream",causalRole:p,relationKind:"reference",fromStepId:e.id,fromLabel:e.label,callsite:{file:e.location.file,line:m.line,endLine:m.endLine,text:m.text,signals:m.signals,calleeLeaf:u},alternatives:[c],alternativeCount:1,evidence:l.evidence}}),p==="result-callback"&&(r+=1)}return{candidates:n,upstreamCandidates:o,resultCandidates:r,runtimeCandidates:a}}function Qi(e,t,n){let o=[];if(!e.location)return o;let r=xt(t.db,e.location.file,e.location.line,e.location.endLine??e.location.line),a=le(t.db,e.location.file),i=Me(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=Lt(e.location.file,s.sourceLine,s.calleeLeaf);if(n.has(l))continue;n.add(l);let d=Ji(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:ze(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 Yi(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(p=>p.signals.includes("call"));if(r.length===0)return o;let a=[],i=0,s=0,l=0,d=(J(t.db,e.location.file)?.callSites??[]).filter(p=>r.some(g=>p.line>=g.line&&p.line<=g.endLine)),c=t.topology.edges.filter(p=>p.kind==="call"&&p.fromNodeId===e.nodeId&&p.disposition!=="excluded"&&p.disposition!=="unsupported"),u=new Map;for(let p of c){let g=t.nodeById.get(p.toNodeId);if(!g)continue;let b=Je(g);u.set(b,(u.get(b)??0)+1)}let f=ea(t.db,n.stepDefinition?n.calleeMap.get(n.stepDefinition.symbolId)??[]:[]),m=ta(f);for(let p of f){if(!t.sourceAllowed(p.alternative.file)||t.alternativeAlreadyReturned(p.alternative))continue;let g=Xe(p.alternative.label),b=No(d,r,g,p.row.callsiteLine,m.get(g)===1);if(!b)continue;let C=Ze(r,b.line,g);if(!C)continue;let S=Lt(e.location.file,b.line,g);if(n.evidencedCallsiteKeys.has(S))continue;n.evidencedCallsiteKeys.add(S);let v=Ao(p.row.source);a.push({anchor:{id:ze(e.id,b.line,p.alternative.symbol??p.alternative.file),status:v,source:"graph-call",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:e.id,fromLabel:e.label,callsite:{file:e.location.file,line:C.line,endLine:C.endLine,text:C.text,signals:C.signals,calleeLeaf:g},alternatives:[p.alternative],alternativeCount:1,evidence:[{method:p.row.source,strength:v,identity:p.row.symbol,location:{file:e.location.file,line:b.line}}]}})}for(let p of c){if(t.returnedNodeIds.has(p.toNodeId))continue;let g=t.nodeById.get(p.toNodeId);if(!g?.location||!t.sourceAllowed(g.location.file))continue;let b=Je(g),C=p.evidence.find(L=>{let x=L.location;return x!==null&&x.file===e.location?.file&&x.line>=0})?.location?.line,S=No(d,r,b,C,u.get(b)===1);if(!S)continue;let v=Ze(r,S.line,b);if(!v)continue;let R=Lt(e.location.file,S.line,b);if(n.evidencedCallsiteKeys.has(R))continue;n.evidencedCallsiteKeys.add(R);let y=pn(g);if(!y||t.alternativeAlreadyReturned(y))continue;let N=dn(p.evidence);a.push({anchor:{id:ze(e.id,S.line,g.id),status:N,source:"graph-call",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:e.id,fromLabel:e.label,callsite:{file:e.location.file,line:v.line,endLine:v.endLine,text:v.text,signals:v.signals,calleeLeaf:b},alternatives:[y],alternativeCount:1,evidence:p.evidence}})}for(let p of d){let g=Lt(e.location.file,p.line,p.calleeLeaf);if(n.evidencedCallsiteKeys.has(g))continue;let b=Ze(r,p.line,p.calleeLeaf);if(!b)continue;let C=ft(e.location.file,gt(t.db).get(p.calleeLeaf)??[]).flatMap(y=>X(t.db,y.file).filter(N=>N.symbol===y.symbol&&N.isFunctionLike)).filter(y=>t.sourceAllowed(y.relativePath)&&!t.alternativeAlreadyReturned({symbol:y.symbol,label:y.leaf,file:y.relativePath,line:y.startLine,endLine:y.endLine})),S=un(C.map(y=>({symbol:y.symbol,label:y.leaf??p.calleeLeaf,file:y.relativePath,line:y.startLine,endLine:y.endLine})));if(S.length===0){l+=1;continue}let v=`${e.id}\0${p.line}\0${p.calleeLeaf}`;if(n.consideredCandidateKeys.has(v))continue;n.consideredCandidateKeys.add(v);let R=S.length>1;R?s+=1:i+=1,a.push({anchor:{id:ze(e.id,p.line,p.calleeLeaf),status:R?"ambiguous":"candidate",source:"leaf-identity-candidate",direction:"downstream",causalRole:"callee",relationKind:"call",fromStepId:e.id,fromLabel:e.label,callsite:{file:e.location.file,line:b.line,endLine:b.endLine,text:b.text,signals:b.signals,calleeLeaf:p.calleeLeaf},alternatives:S.slice(0,3),alternativeCount:S.length,evidence:[]}})}return{candidates:a,scannedBehaviorSteps:1,visibleCallsites:d.length,identityCandidateCallsites:i,ambiguousCallsites:s,unresolvedCallsites:l}}function To(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||!ln(e,i))continue;let s=Je(i),l=cn(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||Fo(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 Fo(e){return e.includes("call")&&e.some(t=>["return","mutation","shape","spread","binding"].includes(t))?"result-callback":"callable-reference"}function Xi(e,t,n,o,r,a=[]){let i=na(t).sort(Po),s=i.filter(p=>Zi(e,p)).slice(0,o),l=new Set(s.map(p=>p.anchor.id)),d=i.filter(p=>!l.has(p.anchor.id)),c=s.map(p=>p.anchor),u=d.map(p=>p.anchor),f=un(c.flatMap(p=>p.alternativeCount===1?p.alternatives:[])),m=un(u.flatMap(p=>p.alternativeCount===1?p.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(Mo).join(" ")} --view behavior`,remainingInspectCommands:ra(m,8).map(p=>`scip-query inspect ${p.map(Mo).join(" ")} --view behavior`)}}function Po(e,t){let n=e.anchor.alternatives[0],o=t.anchor.alternatives[0];return It(e.anchor.status)-It(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 Zi(e,t){if(t.anchor.alternativeCount!==1)return!0;let n=t.anchor.alternatives[0],o=n.endLine??n.line;return le(e,n.file).slice(n.line,o+1).join(`
6
- `).length<=2e4}function Ji(e){return e?.includes("call")?[...e]:["call",...e??[]]}function ea(e,t){let n=new Map;for(let o of t){let r=X(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||wo(o.source)>wo(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 ta(e){let t=new Map;for(let n of e){let o=Xe(n.alternative.label);t.set(o,(t.get(o)??0)+1)}return t}function Ao(e){return e==="semantic-callee"||e==="scip-chunk"?"exact":"derived"}function wo(e){return Ao(e)==="exact"?2:1}function Ze(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 No(e,t,n,o,r){if(o!==void 0)return e.find(i=>i.line===o&&i.calleeLeaf===n&&Ze(t,i.line,n)!==null)??null;let a=e.filter(i=>i.calleeLeaf===n&&Ze(t,i.line,i.calleeLeaf)!==null);return r&&a.length===1?a[0]:null}function Je(e){let t=e.attributes.leaf;if(typeof t=="string"&&t.length>0)return Xe(t);let n=e.label.slice(e.label.lastIndexOf(":")+1);return Xe(n)}function sn(e){if(e?.kind!=="symbol"||!e.id.startsWith("symbol:"))return null;try{return decodeURIComponent(e.id.slice(7))}catch{return null}}function pn(e){return e.location?{symbol:sn(e),label:e.label,file:e.location.file,line:e.location.line,endLine:e.location.endLine??null}:null}function ln(e,t){let n=pn(t);return n?.symbol&&X(e,n.file).some(r=>r.symbol===n.symbol&&r.isFunctionLike)?n:null}function cn(e,t){return e.evidence.find(n=>n.location?.file===t)?.location??e.evidence.find(n=>n.location!==null)?.location??null}function dn(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 na(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||oa(n,a)<0)&&t.set(r,n)}return[...t.values()]}function oa(e,t){return It(e.anchor.status)-It(t.anchor.status)||e.anchor.alternativeCount-t.anchor.alternativeCount||Po(e,t)}function It(e){return{exact:0,derived:1,mixed:2,candidate:3,unknown:4,ambiguous:5}[e]}function un(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 Mo(e){return`--at ${ia(`${e.file}:${e.line+1}`)}`}function ra(e,t){let n=[];for(let o=0;o<e.length;o+=t)n.push(e.slice(o,o+t));return n}function ia(e){return`'${e.replaceAll("'","'\\''")}'`}function Lt(e,t,n){return`${e}\0${t}\0${n}`}function ze(e,t,n){return["next-anchor",e,String(t),n].map(encodeURIComponent).join(":")}var ko=["call","contract-symbol","import","reference","runtime-boundary"],aa={call:[{family:"control",subtype:"call"}],"contract-symbol":[{family:"contract",subtype:"uses-contract-symbol"}],import:[{family:"identity",subtype:"imports"}],reference:[{family:"identity",subtype:"references"}]},sa={"structural-membership":[{family:"identity",subtype:"contains"}],"boundary-observation":[{family:"identity",subtype:"owns-runtime-observation"}],"external-import":[{family:"identity",subtype:"imports-external"}]};function $o(e){if(e.kind!=="runtime-boundary")return Do(aa[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 Do(sa[e])}function Do(e){return e.map(t=>({...t,...t.context?{context:{...t.context}}:{},...t.attributes?{attributes:{...t.attributes}}:{}}))}import{join as Aa}from"path";import{createRequire as la}from"module";import{resolve as tt}from"path";var ca=la(import.meta.url),et;function Bo(e,t,n){let o=da();if(!o)return mn("The TypeScript compiler runtime is unavailable.");let r=ua(o,e,t),a=r.getSourceFile(tt(t))??r.getSourceFile(t);if(!a)return mn(`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=ma(o,a,n);if(s.length===0)return mn("No function-like construct intersects the selected source range.");let l=new Map(s.map(u=>[u,fa(a,u)])),d=s.map(u=>ya(i,u,ga(o,u,l),l.get(u)));for(let u of d)ha(i,u),xa(i,u),La(i,u);wa(i,d);let c=[...i.unsupported].sort();return{points:[...i.points.values()].map(({node:u,...f})=>f).sort(Pa),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 da(){if(et!==void 0)return et;try{et=ca("typescript")}catch{et=Kn()?.ts??null}return et}function ua(e,t,n){let o=tt(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,pa(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,m)=>tt(c)===o?a:s(c,u,f,m),i.readFile=c=>tt(c)===o?t:l(c),i.fileExists=c=>tt(c)===o||d(c),e.createProgram([o],r,i)}function pa(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 ma(e,t,n){let o=[],r=a=>{if(Oo(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 Oo(e,t){return e.isFunctionLike(t)&&"body"in t&&t.body!==void 0}function fa(e,t){return`callable:${encodeURIComponent(e.fileName)}:${t.getStart(e)}:${t.getEnd()}`}function ga(e,t,n){for(let o=t.parent;o;o=o.parent)if(Oo(e,o)&&n.has(o))return n.get(o);return null}function ya(e,t,n,o){let r=new Map,a=te(e,r,"exit",null),i=t.body,s=a.id;if(i&&e.ts.isBlock(i))s=fn(e,r,[...i.statements],a.id,{breakTarget:null,continueTarget:null});else if(i){let d=te(e,r,"statement",i);Q(r,d.id,a.id),s=d.id}let l=te(e,r,"entry",t);return Q(r,l.id,s),{id:o,node:t,parentId:n,cfg:r,entryId:l.id,exitId:a.id}}function fn(e,t,n,o,r){let a=o;for(let i=n.length-1;i>=0;i-=1)a=ke(e,t,n[i],a,r);return a}function ke(e,t,n,o,r){let a=e.ts;if(a.isBlock(n))return fn(e,t,[...n.statements],o,r);if(a.isIfStatement(n)){let s=te(e,t,"predicate",n.expression),l=ke(e,t,n.thenStatement,o,r),d=n.elseStatement?ke(e,t,n.elseStatement,o,r):o;return Q(t,s.id,l),Q(t,s.id,d),s.id}if(a.isWhileStatement(n)){let s=te(e,t,"predicate",n.expression),l=ke(e,t,n.statement,s.id,{breakTarget:o,continueTarget:s.id});return Q(t,s.id,l),Q(t,s.id,o),s.id}if(a.isDoStatement(n)){let s=te(e,t,"predicate",n.expression),l=ke(e,t,n.statement,s.id,{breakTarget:o,continueTarget:s.id});return Q(t,s.id,l),Q(t,s.id,o),l}if(a.isForStatement(n)){let s=te(e,t,"predicate",n.condition??n),l=n.incrementor?te(e,t,"statement",n.incrementor):null;l&&Q(t,l.id,s.id);let d=l?.id??s.id,c=ke(e,t,n.statement,d,{breakTarget:o,continueTarget:d});if(Q(t,s.id,c),n.condition&&Q(t,s.id,o),!n.initializer)return s.id;let u=te(e,t,"statement",n.initializer);return Q(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=te(e,t,"predicate",n.expression),l=te(e,t,"statement",n.initializer),d=ke(e,t,n.statement,s.id,{breakTarget:o,continueTarget:s.id});return Q(t,s.id,l.id),Q(t,s.id,o),Q(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=te(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=fn(e,t,[...u.statements],l,{...r,breakTarget:o}),d.push(l)}for(let c of d)Q(t,s.id,c);return Q(t,s.id,o),s.id}if(a.isReturnStatement(n)||a.isThrowStatement(n)){let s=te(e,t,"statement",n),l=[...t.values()].find(d=>d.kind==="exit");return Q(t,s.id,l.id),s.id}if(a.isBreakStatement(n)){let s=te(e,t,"statement",n);return r.breakTarget||e.unsupported.add("A break statement could not be attached to a structured target."),Q(t,s.id,r.breakTarget??o),s.id}if(a.isContinueStatement(n)){let s=te(e,t,"statement",n);return r.continueTarget||e.unsupported.add("A continue statement could not be attached to a structured target."),Q(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=te(e,t,"statement",n);return s.invalidatesAllDefinitions=!0,Q(t,s.id,o),s.id}let i=te(e,t,"statement",n);return Q(t,i.id,o),i.id}function te(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 Q(e,t,n){e.get(t).successors.add(n),e.get(n).predecessors.add(t)}function ha(e,t){let n=t.cfg.get(t.entryId);for(let o of t.node.parameters){let r=$e(e,o.name);if(!r){e.unsupported.add("Destructured parameter definition-use is not implemented.");continue}n.definitions.push({point:De(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=De(e,o.ast,"predicate",null,"predicate",t.id)),ba(e,t,o,o.ast),!o.displayPoint&&o.definitions.length===0&&o.uses.length===0&&(o.displayPoint=De(e,o.ast,"statement",null,Ma(e,o.ast),t.id)))}function ba(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?Nt(e,t.id,i.initializer,n):[];n.uses.push(...s);let l=$e(e,i.name);l?n.definitions.push({point:De(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)&&Ko(r,i.operatorToken.kind)){let s=Nt(e,t.id,i.right,n);i.operatorToken.kind!==r.SyntaxKind.EqualsToken&&s.push(...Nt(e,t.id,i.left,n)),n.uses.push(...s);let l=$e(e,i.left);l?n.definitions.push({point:De(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=Nt(e,t.id,i.operand,n);n.uses.push(...s);let l=$e(e,i.operand);l&&n.definitions.push({point:De(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(Go(e,i)){let s=jo(e,t.id,i);s&&n.uses.push(s),r.isPropertyAccessExpression(i)&&a(i.expression);return}i.forEachChild(a)}}};a(o),n.uses=qo(n.uses)}function Nt(e,t,n,o){let r=[],a=i=>{if(!e.ts.isFunctionLike(i)){if(e.ts.isBinaryExpression(i)&&Ko(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(Go(e,i)){let s=jo(e,t,i);s&&r.push(s),e.ts.isPropertyAccessExpression(i)&&a(i.expression);return}i.forEachChild(a)}};return a(n),qo(r)}function Go(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&&Sa(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)||va(e.ts,t))}function Sa(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 va(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 jo(e,t,n){let o=$e(e,n);return o?{point:De(e,o.node,"use",o.symbolKey,o.name,t),property:e.ts.isPropertyAccessExpression(n)}:null}function $e(e,t){let n=e.ts;if(n.isIdentifier(t)){let o=_o(e,t);return o?{node:t,symbolKey:o,name:t.text}:null}if(n.isPropertyAccessExpression(t)){let o=_o(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)?$e(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 _o(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 De(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 xa(e,t){let n=[...t.cfg.values()].flatMap(l=>l.definitions),o=new Map(n.map(l=>[l.point.id,l])),r=Ea(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=Ta([...l.predecessors].map(f=>i.get(f))),c=new Set(d);l.invalidatesAllDefinitions&&c.clear();let u=Ca(l.definitions);for(let f of u){for(let m of r.get(f.point.symbolKey)??[])c.delete(m.point.id);c.add(f.point.id)}gn(a.get(l.id),d)||(a.set(l.id,d),s=!0),gn(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(m=>m.point.symbolKey===c.point.symbolKey&&m.point.start<c.point.start&&!m.rhsUseIds.includes(c.point.id)).sort((m,p)=>p.point.start-m.point.start)[0],f=u?[u.point.id]:d;for(let m of f){let p=o.get(m);p.point.symbolKey===c.point.symbolKey&&nt(e,"reaching-definition",p.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)nt(e,"value-source",u,c.point.id,"exact","This right-hand-side use supplies the new definition.")}}function Ea(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 Ca(e){let t=new Map;for(let n of e)n.point.symbolKey&&t.set(n.point.symbolKey,n);return[...t.values()]}function La(e,t){let n=Ia(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 Ra(l))nt(e,"control-dependence",o.displayPoint.id,d.id,"exact","The target postdominates a branch successor but does not postdominate the predicate.")}}}function Ia(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,...Fa(i)]);gn(o.get(a.id),s)||(o.set(a.id,s),r=!0)}}return o}function wa(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)Na(d.callableId,s.point.callableId,n)?nt(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&&nt(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 Na(e,t,n){for(let o=n.get(t)??null;o;o=n.get(o)??null)if(o===e)return!0;return!1}function nt(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 Ko(e,t){return t>=e.SyntaxKind.FirstAssignment&&t<=e.SyntaxKind.LastAssignment}function Ma(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 qo(e){return[...new Map(e.map(t=>[t.point.id,t])).values()]}function Ra(e){return[...new Map(e.map(t=>[t.id,t])).values()]}function Ta(e){return new Set(e.flatMap(t=>[...t]))}function Fa(e){return e.length===0?new Set:new Set([...e[0]].filter(t=>e.slice(1).every(n=>n.has(t))))}function gn(e,t){return e.size===t.size&&[...e].every(n=>t.has(n))}function Pa(e,t){return e.start-t.start||e.kind.localeCompare(t.kind)||e.id.localeCompare(t.id)}function mn(e){return{points:[],edges:[],coverage:{status:"unsupported",basis:"typescript-compiler-cfg-reaching-definitions",unsupported:[e]}}}var ka=_n("typescript-local-flow",{clearGroups:["whole-project","source-file","semantic-provider"]});function yn(e,t,n,o){if(!jn(t))return null;let r=`${t}\0${n}\0${o}`;return ka.get(e,r,()=>{let a=dt(e,t);return a?Bo(a,Aa(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 $a(e,t=new Map){let n=new Map,o=new Map,r=[];for(let a of e.transfers){if(!e.caller)continue;let i=Mt(e.caller,a.callerPosition),s=Mt(e.callee,a.calleePosition);ot(n,i),ot(n,s),bn(o,e.caller,i),bn(o,e.callee,s);let l=oe("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=Mt(e.callee,a.calleePosition);ot(n,s),bn(o,e.callee,s);let l=t.get(a.calleePosition);if(l&&Wa(l)){Ua(o,n,e,a.calleePosition,a.argumentText,l);return}let d=qa(e,a.calleePosition,a.argumentText);ot(n,d);let c=oe("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:oe("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 Uo(e,t,n=[]){let o=Wo(),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=Ka(r,e,i.toFile,i.toSymbol);if(!s)continue;let l=Hn(e,s),d=l.sites.filter(g=>g.file===i.fromFile&&g.startLine<=i.line&&g.endLine>=i.line&&g.caller?.symbol===i.fromSymbol);if(d.length!==1){let g=l.unresolved.find(b=>b.file===i.fromFile&&b.line===i.line);g&&o.blindSpots.push(`Parameter flow unresolved at ${i.fromFile}:${i.line+1}: ${g.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=Vn(e,c),m=Y(e,c.file)?.rootNode,p=new Map;if(m)for(let g of f.unknown){let b=Un({db:e,file:c.file,root:m},c.arguments[g.calleePosition]);b&&p.set(g.calleePosition,b)}zo(o,$a(f,p)),f.caller&&Ga(c.callNode)&&ja(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=yn(e,i.location.file,i.location.line,s);if(l){zo(o,Da(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 Da(e,t,n){let o=Wo(),r=new Map,a=new Map,i=new Map,s=e.location.file;for(let l of t){let d=_a(e,s,l);i.set(l.id,d.id),r.set(d.id,d),Ba(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=Oa(l),f=oe("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 _a(e,t,n){return{id:oe("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 Ba(e,t,n){let o=oe("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 Oa(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 Ga(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 ja(e,t,n){if(!t.caller)return;let o={id:oe("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=oe("edge","return-to-call-result",t.callee.symbol,o.id),a=oe("edge","call-result-owner",t.caller.symbol,o.id);e.nodes.push(o),e.edges.push({id:r,kind:"data-transfer",fromNodeId:Sn(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:Sn(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 Wo(){return{nodes:[],edges:[],frontiers:[],blindSpots:[]}}function zo(e,t){hn(e.nodes,t.nodes),hn(e.edges,t.edges),hn(e.frontiers,t.frontiers),e.blindSpots.push(...t.blindSpots)}function hn(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 Ka(e,t,n,o){let r=`${n}\0${o}`,a=e.get(r);if(a!==void 0)return a;let i=X(t,n).find(s=>s.symbol===o)??null;return e.set(r,i),i}function Mt(e,t){return{id:Qa(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 qa(e,t,n){return{id:oe("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 za(e,t,n){return{id:oe("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 Ua(e,t,n,o,r,a){let i=za(n,o,a),s=Mt(n.callee,o);ot(t,i);let l=oe("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:Ha(a),attributes:{argumentText:r,calleePosition:o,value:a.value,precision:a.precision,derivationRule:a.derivation.rule}}],evidence:Va(a,n)})}function Wa(e){return e.derivation.kind!=="heuristic"&&e.precision!=="symbolic"&&e.precision!=="unknown"}function Ha(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 Va(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 ot(e,t){e.has(t.id)||e.set(t.id,t)}function bn(e,t,n){let o=oe("edge","parameter-owner",t.symbol,n.id);e.has(o)||e.set(o,{id:o,kind:"parameter-owner",fromNodeId:Sn(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 Qa(e,t){return oe("parameter",e,String(t))}function Sn(e){return oe("symbol",e)}function oe(...e){return e.map(t=>encodeURIComponent(t)).join(":")}function Ho(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=Yn(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=vn(i,d.controller),u=vn(i,d.outcome);n.set(c.id,c),n.set(u.id,u),Ya(o,i,c);let f=_e("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=vn(i,d);n.set(c.id,c);let u=d.label.startsWith("throw")||d.label.startsWith("raise")?"throw":"return",f=_e("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=_e("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=_e("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=_e("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 vn(e,t){let n=e.location.file;return{id:_e(`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 Ya(e,t,n){let o=_e("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 _e(...e){return e.map(t=>encodeURIComponent(t)).join(":")}var Rt=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"]),it=new Set(["block","body","compound_statement","declaration_list","statement_block"]),Xa=new Set(["assignment","assignment_expression","augmented_assignment_expression"]),En=new Set(["update_expression"]),Xo=new Set(["array_access","element_access_expression","subscript_expression"]),Zo=new Set(["attribute","field_access","field_expression","member_access_expression","member_expression","selector_expression"]),Za=new Set(["false","null","null_literal","number","number_literal","string","string_literal","template_string","true"]),Ja=new Set(["call_expression","method_invocation","object_creation_expression"]),es=new Set(["comment","else_clause","formal_parameters","parameters","type_parameters"]);function Jo(e,t,n,o){let r=Y(e,t);if(!r)return null;let a=ls(r.rootNode,n,o);if(!a)return null;let i=[],s=[],l=[];return Be(a,d=>{if(Xa.has(d.type)||En.has(d.type)||tr(d)){let c=ts(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.`})}}),Be(a,d=>{if(!it.has(d.type))return;let c=as(d);for(let u=0;u<c.length-1;u+=1)s.push({from:rt(c[u]),to:rt(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],m=ds(f).filter(p=>p.type==="await_expression");for(let p of m){let g=at("event",`await ${be(p.text.replace(/^await\s+/u,""))}`,p);s.push({from:rt(f),to:g,subtype:"awaits-completion",synchronizationScope:null,attributes:{completionRequired:!0}});let b=c[u+1];b&&s.push({from:g,to:rt(b),subtype:"await-completion-before",synchronizationScope:null,attributes:{continuationOnly:!0}})}}}),Be(a,d=>{if(d.type!=="synchronized_statement")return;let c=d.childForFieldName("object")??d.childForFieldName("condition")??d.namedChildren.find(g=>!it.has(g.type)),u=d.childForFieldName("body")??d.namedChildren.find(g=>it.has(g.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,""),m=at("lock",f,c),p=cs(u).filter(g=>g.parent!==null&&nr(g));for(let g of ss(p))s.push({from:m,to:rt(g),subtype:"inside-lock-scope",synchronizationScope:f,attributes:{syntaxNative:!0}})}),{mutations:i,temporal:s,unsupported:l}}function ts(e){let t=tr(e),n=e.childForFieldName("left")??e.childForFieldName("argument")??(t?e.namedChildren.at(-1)??null:e.namedChildren[0]??null);if(!n)return null;let o=ns(n);if(!o)return null;let r=t?"delete":En.has(e.type)||!is(e,n).startsWith("=")?"update":"assign",a=t||En.has(e.type)?null:e.childForFieldName("right");return{event:at("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?at("value",be(a.text),a):null,dataSubtype:a?os(a,e):null}}function ns(e){if(Xo.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 Zo.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 os(e,t){return Za.has(e.type)||/(?:integer|float|decimal|boolean|character)_literal$/u.test(e.type)?"constant-to-state":Ja.has(e.type)?"return-to-state":Zo.has(e.type)||Xo.has(e.type)?"property-to-state":/identifier$/u.test(e.type)?rs(e.text,t)?"captured-value-to-state":"value-to-state":"expression-to-state"}function rs(e,t){let n=xn(t.parent);if(!n||Vo(n,e))return!1;let o=xn(n.parent);for(;o;){if(Vo(o,e))return!0;o=xn(o.parent)}return!1}function xn(e){let t=e;for(;t;){if(Rt.has(t.type))return t;t=t.parent}return null}function Vo(e,t){let n=e.childForFieldName("parameters")??e.namedChildren.find(a=>["formal_parameters","parameters"].includes(a.type));if(n&&Qo(n,t))return!0;let o=e.childForFieldName("body")??e.namedChildren.find(a=>it.has(a.type));if(!o)return!1;let r=!1;return er(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&&Qo(i,t)&&(r=!0)}),r}function Qo(e,t){let n=!1;return Be(e,o=>{/identifier$/u.test(o.type)&&o.text===t&&(n=!0)}),n}function er(e,t,n){n(e);for(let o of e.namedChildren)o!==t&&Rt.has(o.type)||er(o,t,n)}function is(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 tr(e){return(e.type==="delete_expression"||e.type==="unary_expression")&&/^delete\b/u.test(e.text.trim())}function as(e){return e.namedChildren.filter(t=>nr(t))}function nr(e){return es.has(e.type)||it.has(e.type)?!1:/(?:statement|declaration)$/u.test(e.type)||e.type==="expression_statement"||e.type==="local_variable_declaration"}function ss(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 rt(e){return at("event",be(e.text),e)}function at(e,t,n){return{kind:e,label:t,startLine:n.startPosition.row,endLine:n.endPosition.row}}function ls(e,t,n){let o=[];return Be(e,a=>{a.startPosition.row<=t&&a.endPosition.row>=n&&o.push(a)}),o.filter(a=>Rt.has(a.type)).sort(Yo)[0]??o.sort(Yo)[0]??null}function Yo(e,t){return e.endIndex-e.startIndex-(t.endIndex-t.startIndex)||e.startIndex-t.startIndex}function cs(e){let t=[];return Be(e,n=>t.push(n)),t}function ds(e){let t=[],n=o=>{t.push(o);for(let r of o.namedChildren)r!==e&&Rt.has(r.type)||n(r)};return n(e),t}function Be(e,t){t(e);for(let n of e.namedChildren)Be(n,t)}function be(e){return e.trim().replace(/\s+/gu," ")}function ir(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=Jo(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=Ft(s,c.event),f=ys(s,c.resource,c.durabilityClass);if(o.set(u.id,u),o.set(f.id,f),Pt(r,s,u,"contains-state-effect"),At(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 m=Ft(s,c.value);o.set(m.id,m),At(r,{kind:"data-to-state",from:m,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=Ft(s,c.from),f=Ft(s,c.to);o.set(u.id,u),o.set(f.id,f),Pt(r,s,u,c.from.kind==="lock"?"contains-lock-scope":"contains-event"),Pt(r,s,f,"contains-event"),At(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=Ie(`${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=Ie("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 m=Ie("frontier",c.family,u);a.set(m,{id:m,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=Tt(s,"protocol"),d=Tt(s,"action"),c=Tt(s,"address")??s.label;!l||!d||!rr(l,d)||or(o,r,s,{observationId:s.id,action:d,strength:"exact",file:s.location?.file??"",line:s.location?.line??0,address:c,protocol:l,role:Tt(s,"role")??void 0,resolution:"locally-linked"})}for(let s of n){if(!s.protocol||!rr(s.protocol,s.action))continue;let l=fs(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}or(o,r,l,s)}return{nodes:[...o.values()],edges:[...r.values()],frontiers:[...a.values()],blindSpots:[...i].sort()}}function or(e,t,n,o){let r=ps(o),i={id:Ie("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:Ie("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),Pt(t,n,i,"contains-runtime-state-effect");let d=us(o.action);At(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:ms(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 us(e){return e==="database.read"?"reads-resource":e==="queue.send"?"enqueues-resource":e==="queue.consume"?"consumes-resource":"writes-resource"}function ps(e){return(e.keyParts?.find(n=>["address","resource"].includes(n.name))?.value??e.address)||e.observationId}function ms(e){return e.keyParts?.find(n=>/^(?:id|key|record)$/u.test(n.name))?.value??null}function rr(e,t){return e==="database"&&["database.read","database.write"].includes(t)||e==="queue"&&["queue.consume","queue.send"].includes(t)}function Tt(e,t){let n=e.attributes[t];return typeof n=="string"?n:null}function fs(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(gs)[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 gs(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 Ft(e,t){let n=e.location.file;return{id:Ie(`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 ys(e,t,n){let o=e.location.file;return{id:Ie("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 Pt(e,t,n,o){let r=Ie("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 At(e,t){let n=Ie("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 Ie(...e){return e.map(t=>encodeURIComponent(t)).join(":")}var hs=new Set(["control","data","state","temporal"]),kt=new Set(["contains-control","contains-event","contains-lock-scope","contains-state-effect","contains-runtime-state-effect","contains","owns-parameter","owns-runtime-observation"]),cr=new Set(["discriminator-dispatch","result-callback","returns","runtime-handoff","throws"]);function dr(e,t={}){let n=new Map(e.nodes.map(x=>[x.id,x])),o=Ls(e.nodes,t.focusLocations),r=Is(e.edges,t.focusLocations),a=ws(e.edges,r),i=new Set(e.paths.flatMap(x=>x.edgeIds)),s=we(e.anchors.filter(x=>x.status==="matched").flatMap(x=>x.nodeIds)),d=e.edges.filter(lr).filter(x=>bs(x,o,r,i)),c=d.filter(x=>Es(x,o,r,a,n,i)),u=ar(s,c,"forward"),f=xs(u,c),m=ar(f,c,"backward"),p=new Set([...u].filter(x=>m.has(x)));for(let x of s)p.add(x);let g=new Set(c.filter(x=>p.has(x.fromNodeId)&&p.has(x.toNodeId)).map(x=>x.id)),b=new Set(p),C=new Set(g);Ss(d,b,C,o,r);let S=e.frontiers.filter(x=>Ms(x,b)),v=we(S.filter(x=>x.disposition==="unsupported").map(x=>x.id)),R=we(e.edges.filter(x=>!lr(x)&&pr(x)&&Ns(x,b)).map(x=>x.id)),y=we(S.map(x=>x.id)),N=[];s.length===0&&N.push("No matched anchor node starts the corridor."),f.length===0&&N.push("No proved mechanical outcome is reachable from a matched anchor."),v.length>0&&N.push(`${v.length} unsupported frontier(s) touch the protected corridor.`),R.length>0&&N.push(`${R.length} candidate or unknown edge(s) touch the protected corridor.`);let L=N.length===0?"complete":"incomplete";return{schemaVersion:1,status:L,startNodeIds:s,outcomeNodeIds:f,baseNodeIds:we([...p]),baseEdgeIds:we([...g]),nodeIds:we([...b]),edgeIds:we([...C]),accountedFrontierIds:y,unresolvedFrontierIds:v,unresolvedEdgeIds:R,coverage:{protectedNodes:b.size,protectedEdges:C.size,baseNodes:p.size,baseEdges:g.size,accountedFrontiers:y.length,unresolvedFrontiers:v.length,unresolvedEdges:R.length},explanation:L==="complete"?"Every proved anchor-to-outcome path is closed over its material causal facts within reported coverage.":N.join(" ")}}function bs(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"&&kt.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(mr(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 Ss(e,t,n,o,r){let a=!0;for(;a;){a=!1;for(let i of e)vs(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 vs(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"?kt.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"?ur(i)||["returns","throws"].includes(i.subtype)&&!a&&n!==null&&!n.has(e.toNodeId)?!1:cr.has(i.subtype)||mr(i)||i.subtype==="completion-callback":!1)}function xs(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"&&cr.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 we([...n])}function ar(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 Es(e,t,n,o,r,a){return(e.semantics??[]).some(i=>e.disposition==="emitted"||a.has(e.id)?!0:i.family==="identity"&&kt.has(i.subtype)?t===null||t.has(e.toNodeId)||o?.has(e.toNodeId)===!0:!hs.has(i.family)||ur(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"?Cs(e,r)&&(t.has(e.fromNodeId)||t.has(e.toNodeId)):!1)}function ur(e){return e.family==="control"&&["call","discriminator-dispatch","result-callback","runtime-handoff"].includes(e.subtype)}function Cs(e,t){let n=t.get(e.fromNodeId),o=t.get(e.toNodeId);if(!n||!o)return!1;let r=sr(n,"ownerNodeId")??(n.kind==="symbol"?n.id:null),a=sr(o,"ownerNodeId")??(o.kind==="symbol"?o.id:null);return r!==null&&r===a}function Ls(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 Is(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 ws(e,t){return t===null?null:new Set(e.filter(n=>t.has(n.id)).flatMap(n=>[n.fromNodeId,n.toNodeId]))}function sr(e,t){let n=e.attributes[t];return typeof n=="string"?n:null}function lr(e){return e.disposition==="excluded"||e.disposition==="unsupported"||!pr(e)?!1:e.evidence.some(t=>t.strength==="exact"||t.strength==="derived")}function pr(e){return(e.semantics??[]).some(t=>t.family!=="identity"||kt.has(t.subtype))}function mr(e){return e.subtype.startsWith("predicate-")||e.subtype.startsWith("loop-")||e.subtype.startsWith("exception-")||e.subtype.startsWith("finally-")||e.subtype.startsWith("handler-")}function Ns(e,t){return t.has(e.fromNodeId)||t.has(e.toNodeId)}function Ms(e,t){return[...e.fromNodeIds,...e.memberNodeIds].some(n=>t.has(n))}function we(e){return[...new Set(e)].sort()}import{createHash as Rs}from"crypto";var $t=["identity","contract","control","data","state","temporal"],Ts=new Set($t);function _t(e){let t=We(e.anchors,"anchor"),n=We(e.nodes,"node"),o=We(e.edges,"edge"),r=We(e.paths??[],"path"),a=We(e.frontiers??[],"frontier"),i=new Set(t.map(m=>m.id)),s=new Set(n.map(m=>m.id)),l=new Set(o.map(m=>m.id)),d=e.routeCatalog?{...e.routeCatalog,routes:We(e.routeCatalog.routes,"route"),selectedRouteIds:ie(e.routeCatalog.selectedRouteIds)}:void 0;for(let m of t)ce(`anchor ${m.id}`,[...m.nodeIds,...m.candidateNodeIds],s,"node");for(let m of n)ce(`node ${m.id}`,m.anchorIds,i,"anchor");for(let m of o){if(ce(`edge ${m.id}`,[m.fromNodeId,m.toNodeId],s,"node"),m.evidence.length===0)throw new Error(`Exploration edge ${m.id} has no evidence source.`);As(m)}for(let m of r)ce(`path ${m.id}`,[m.fromAnchorId,m.toAnchorId],i,"anchor"),ce(`path ${m.id}`,m.nodeIds,s,"node"),ce(`path ${m.id}`,m.edgeIds,l,"edge");for(let m of a)if(ce(`frontier ${m.id}`,m.fromNodeIds,s,"node"),ce(`frontier ${m.id}`,m.edgeIds,l,"edge"),ce(`frontier ${m.id}`,m.memberNodeIds,s,"node"),m.memberCount!==m.memberNodeIds.length)throw new Error(`Exploration frontier ${m.id} reports ${m.memberCount} member(s) but identifies ${m.memberNodeIds.length}.`);for(let m of d?.routes??[])ce(`route ${m.id}`,m.nodeIds,s,"node"),ce(`route ${m.id}`,m.edgeIds,l,"edge"),ce(`route ${m.id}`,[m.anchorNodeId,m.endpointNodeId],s,"node");d&&ce("route catalog selection",d.selectedRouteIds,new Set(d.routes.map(m=>m.id)),"route");let c=ie(e.incompleteReasons??[]),u=c.length===0?"accounted":"incomplete",f=t.reduce((m,p)=>m+p.omittedCandidates,0);return{schemaVersion:1,anchors:t,nodes:n,edges:o,paths:r,frontiers:a,coverage:{status:u,scope:e.scope,nodes:Er(n),edges:Er(o),matchedAnchors:t.filter(m=>m.status==="matched").length,ambiguousAnchors:t.filter(m=>m.status==="ambiguous").length,missingAnchors:t.filter(m=>m.status==="missing").length,omittedCandidates:f,frontierGroups:a.length,programEdges:Ps(o),blindSpots:ie(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:Ds(u,r,e.scope),...d?{routeCatalog:d}:{}}}function Fs(e){return e.flatMap(t=>ks(t.semantics??[]).map(n=>({id:$s(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 Ps(e){let t=Fs(e),n=new Set(t.map(i=>i.sourceEdgeId)),o=new Map($t.map(i=>[i,new Set])),r=new Map($t.map(i=>[i,new Set])),a=new Map($t.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:ie(e.filter(i=>!n.has(i.id)).map(i=>i.kind)),families:{identity:Ue("identity",o,a,r),contract:Ue("contract",o,a,r),control:Ue("control",o,a,r),data:Ue("data",o,a,r),state:Ue("state",o,a,r),temporal:Ue("temporal",o,a,r)}}}function Ue(e,t,n,o){return{sourceEdges:t.get(e)?.size??0,projectedEdges:n.get(e)??0,subtypes:[...o.get(e)??[]].sort()}}function As(e){let t=new Set;for(let n of e.semantics??[]){if(!Ts.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=Cn(n);if(t.has(o))throw new Error(`Exploration edge ${e.id} repeats program edge semantic ${o}.`);t.add(o)}}function ks(e){return[...e].sort((t,n)=>Cn(t).localeCompare(Cn(n)))}function Cn(e){return`${e.family}:${e.subtype}`}function $s(e,t){return`program:${encodeURIComponent(e)}:${t.family}:${encodeURIComponent(t.subtype)}`}function Ds(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 Cr(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(h=>[...h.nodeIds,...h.candidateNodeIds])),r=[],a=e.anchors.filter(h=>h.status!=="missing"&&h.nodeIds.length+h.candidateNodeIds.length>0);for(let h=0;h<a.length;h+=1)for(let P=h+1;P<a.length;P+=1){let D=a[h],O=a[P],w=br(e,D,O,!1),I=w??br(e,D,O,!0);I?(I.nodeIds.forEach(_=>o.add(_)),r.push({id:Dt("path",D.id,O.id),fromAnchorId:D.id,toAnchorId:O.id,status:!w||D.status==="ambiguous"||O.status==="ambiguous"?"candidate":"connected",nodeIds:I.nodeIds,edgeIds:I.edgeIds})):r.push({id:Dt("path",D.id,O.id),fromAnchorId:D.id,toAnchorId:O.id,status:"partial",nodeIds:[],edgeIds:[]})}let i=ie(t.routeIds??[]),s=_s(e,i),l=new Set(s.routes.map(h=>h.id)),d=i.filter(h=>!l.has(h));if(d.length>0)throw new Error(`Unknown exploration route id(s): ${d.join(", ")}`);let u=s.routes.filter(h=>i.includes(h.id)).map(h=>({anchorNodeId:h.anchorNodeId,endpointNodeId:h.endpointNodeId,endpointKind:h.endpointKind,endpointPriority:2,nodeIds:[...h.nodeIds].reverse(),edgeIds:[...h.edgeIds].reverse()}));for(let h of u)h.nodeIds.forEach(P=>o.add(P));let f=r.length===0||r.some(h=>h.edgeIds.length>0);f&&vr(e,o,n);let m=xr(e,o),p=new Set(t.expandedFrontierIds??[]),g=new Set(m.map(h=>h.id)),b=[...p].filter(h=>!g.has(h)).sort();if(b.length>0)throw new Error(`Unknown exploration frontier id(s): ${b.join(", ")}`);for(let h of m)p.has(h.id)&&h.memberNodeIds.forEach(P=>o.add(P));f&&vr(e,o,n);let C=new Map(u.map(h=>[h.endpointNodeId,h.endpointKind])),S=new Set(u.flatMap(h=>h.nodeIds)),v=new Map;for(let h of u)for(let P=0;P<h.nodeIds.length;P+=1){let D=h.nodeIds[P],O=P;v.set(D,Math.max(v.get(D)??0,O))}let R=e.nodes.map(h=>{let P=C.get(h.id),D=S.has(h.id)?{upstreamCausalPath:!0,upstreamCausalDistance:v.get(h.id)??0,...P?{upstreamCausalEndpoint:P}:{}}:{};return{...h,attributes:{...h.attributes,...D},disposition:h.disposition==="excluded"||h.disposition==="unsupported"?h.disposition:o.has(h.id)?"emitted":"folded"}}),y=new Set([...r.flatMap(h=>h.edgeIds),...u.flatMap(h=>h.edgeIds)]),N=e.edges.map(h=>({...h,disposition:h.disposition==="excluded"||h.disposition==="unsupported"?h.disposition:y.has(h.id)||o.has(h.fromNodeId)&&o.has(h.toNodeId)?"emitted":"folded"})),L=_t({anchors:e.anchors,nodes:R,edges:N,paths:r,frontiers:[...e.frontiers.filter(h=>h.disposition!=="folded"),...xr({...e,nodes:R,edges:N},o)],scope:e.coverage.scope,blindSpots:e.coverage.blindSpots,incompleteReasons:e.coverage.status==="incomplete"?[e.coverage.explanation]:[],routeCatalog:s}),x=new Set(L.frontiers.flatMap(h=>h.edgeIds)),M=L.edges.filter(h=>h.disposition==="folded"&&!x.has(h.id)).map(h=>h.id);if(M.length>0)throw new Error(`Folded exploration edge(s) are not frontier-accounted: ${M.sort().join(", ")}`);return L}var fr=10;function _s(e,t=[]){let n=new Map(e.nodes.map(b=>[b.id,b])),o=new Map(e.edges.map(b=>[b.id,b])),r=new Map;for(let b of e.edges){if(!Bs(b))continue;let C=r.get(b.toNodeId)??[];C.push(b),r.set(b.toNodeId,C)}for(let b of r.values())b.sort((C,S)=>Number(st(S))-Number(st(C))||hr(S)-hr(C)||C.fromNodeId.localeCompare(S.fromNodeId)||C.id.localeCompare(S.id));let a=ie(e.anchors.filter(b=>b.status==="matched").flatMap(b=>b.nodeIds)),i=new Map,s=new Set,l=(b,C,S)=>{let v=C.nodeIds[C.nodeIds.length-1],R=n.get(v),y=n.get(b);if(!R?.location||!y)return;let N=[...C.nodeIds].reverse(),L=[...C.edgeIds].reverse(),x=new Set(N),M=L.flatMap(w=>{let T=o.get(w);return T?[T]:[]}),h=e.edges.filter(w=>w.disposition!=="excluded"&&w.disposition!=="unsupported"&&(x.has(w.fromNodeId)||x.has(w.toNodeId))),P={id:Dt("route",b,v,S,...L),status:"proved",anchorNodeId:b,anchorLabel:y.label,endpointNodeId:v,endpointLabel:R.label,endpointLocation:{...R.location},endpointKind:S,nodeIds:N,edgeIds:L,evidenceStrengths:ie(M.flatMap(w=>w.evidence.map(T=>T.strength))),spineEdgeFamilies:gr(M,!0),relatedEdgeFamilies:gr(h,!1),crossesRuntimeBoundary:M.some(st)},D=`${b}\0${v}\0${S}`,O=i.get(D);(!O||yr(P,O)<0)&&i.set(D,P)};for(let b of a){n.get(b)?.attributes.publicEntry===!0&&l(b,{nodeIds:[b],edgeIds:[]},"public-entry");let C=[{nodeIds:[b],edgeIds:[]}],S=new Map([[b,0]]);for(let v=0;v<C.length;v+=1){let R=C[v],y=R.nodeIds[R.nodeIds.length-1];R.edgeIds.length>0&&n.get(y)?.location&&n.get(y)?.attributes.publicEntry===!0&&l(b,R,"public-entry");let N=r.get(y)??[];if(R.edgeIds.length>=fr){N.some(L=>!R.nodeIds.includes(L.fromNodeId))&&s.add(b);continue}for(let L of N){if(R.nodeIds.includes(L.fromNodeId))continue;let x=R.edgeIds.length+1,M=S.get(L.fromNodeId);if(M!==void 0&&M<=x)continue;let h={nodeIds:[...R.nodeIds,L.fromNodeId],edgeIds:[...R.edgeIds,L.id]};if(S.set(L.fromNodeId,x),st(L)&&n.get(L.fromNodeId)?.location){l(b,h,"runtime-boundary");continue}C.push(h)}}}let d=[...i.values()].sort(yr),c=new Set(d.map(b=>b.id)),u=ie(t.filter(b=>c.has(b))),f=ie(d.map(b=>b.anchorNodeId)),m=a.filter(b=>!f.includes(b)),p=[...s].sort(),g=e.coverage.status==="accounted"&&p.length===0?"accounted":"incomplete";return{schemaVersion:1,routes:d,selectedRouteIds:u,coverage:{status:g,scope:"Distinct proved public-entry and runtime-boundary endpoints reachable upstream in the supplied topology.",enumeration:"one-shortest-proved-path-per-endpoint",maximumDepth:fr,anchorNodeIds:a,anchorsWithRoutes:f,anchorsWithoutRoutes:m,depthLimitedAnchorNodeIds:p,routeCount:d.length,explanation:g==="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 gr(e,t){let n=e.flatMap(o=>o.semantics?.map(r=>r.family)??[]);return t&&e.length>0&&n.length===0&&n.push("control"),ie(n)}function yr(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 Bs(e){return e.disposition!=="excluded"&&e.disposition!=="unsupported"&&Os(e)&&e.evidence.some(t=>["exact","derived","mixed"].includes(t.strength))}function Os(e){return st(e)||e.kind==="boundary-observation"||e.kind==="call"||e.kind==="compiler:call"}function st(e){return e.kind==="runtime-boundary"||e.kind.startsWith("runtime:")}function hr(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 br(e,t,n,o){return Sr(e,t,n,o)??Sr(e,n,t,o)}function Sr(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||Gs(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 m={nodeId:f.nodeId,nodeIds:[...u.nodeIds,f.nodeId],edgeIds:[...u.edgeIds,f.edgeId]};if(a.has(f.nodeId))return m;d.add(f.nodeId),l.push(m)}}return null}function Gs(e,t,n,o){let r=e.get(t)??[];r.push({nodeId:n,edgeId:o}),e.set(t,r)}function js(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(g=>g.id===c);if(f?.kind==="structural-region")continue;let m=a.get(c)??new Set;m.add(u),a.set(c,m),(/(?: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 vr(e,t,n){let o=-1;for(;t.size!==o&&t.size<n;)o=t.size,js(e,t,n)}function xr(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(p=>s.has(p.fromNodeId)||s.has(p.toNodeId)),d=l.filter(p=>s.has(p.fromNodeId)!==s.has(p.toNodeId)),c=ie(d.map(p=>s.has(p.fromNodeId)?p.toNodeId:p.fromNodeId)),u=new Set(d.map(p=>s.has(p.toNodeId)?"outgoing":"incoming")),f=ie(l.map(p=>p.id)),m=ie(d.map(p=>p.kind));return{id:Dt("frontier",...i,...f),kind:m.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 Dt(e,...t){let n=Rs("sha256").update(t.join("\0")).digest("hex").slice(0,16);return`${e}:${n}`}function We(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 ce(e,t,n,o){let r=ie(t.filter(a=>!n.has(a)));if(r.length>0)throw new Error(`Exploration ${e} references missing ${o}(s): ${r.join(", ")}`)}function Er(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 ie(e){return[...new Set(e)].sort()}var Ks=5,qs=12,zs=8,Us=3,Lr=8,Ws=6,Hs=12,Ir=12,Vs=12,Qs=2,Ys=new Set(["branch","loop","call","await","return","throw","mutation","catch","finally"]),Xs=9e3,wr=ko,Nr=new WeakMap;function _r(e,t){return ll(e,t,"topology")}function Zs(e,t,n,o,r,a=!1){let i=e.get(t);if(i)return i.depth=Math.min(i.depth,n),i.primary||=r,i.promoteBoundaryImports||=a,i.origins.add(o),i;let s={file:t,depth:n,primary:r,promoteBoundaryImports:a,origins:new Set([o]),processed:!1};return e.set(t,s),s}function Js(e,t,n,o,r,a,i="none",s=!1){let l=e.get(n.symbol);if(l)return l.depth=Math.min(l.depth,o),l.origins.add(r),a&&l.anchorQueries.add(a),l.referenceScope=Zl(l.referenceScope,i),t(n.relativePath,o,r,!0,s),l;let d={definition:n,depth:o,origins:new Set([r]),anchorQueries:new Set(a?[a]:[]),referenceScope:i,processed:!1};return e.set(n.symbol,d),t(n.relativePath,o,r,!0,s),d}function el(e,t,n,o,r,a,i=!1,s=!0){let l=Se(n),d=e.get(l);if(d)return d.depth=Math.min(d.depth,o),d.origins.add(r),a&&d.anchorQueries.add(a),d.reverseCallExpansion||=i,d.traversalEligible||=s,t(n.file,o,r,d.traversalEligible,!0),d;let c={...n,depth:o,origins:new Set([r]),anchorQueries:new Set(a?[a]:[]),reverseCallExpansion:i,traversalEligible:s};return e.set(l,c),t(n.file,o,r,s,!0),c}function tl(e){let{db:t,index:n,pendingRelations:o,addFile:r,addSymbol:a,addSourceConstruct:i,observation:s,depth:l,origin:d}=e;r(s.source.file,l,d,!0,!0),s.owner.file!==s.source.file&&r(s.owner.file,l,`${d}:owner`,!0,!0);let c=X(t,s.owner.file),u=s.owner.symbol?Te(t,n,s.owner.symbol).matches.find(p=>p.relativePath===s.owner.file):null,f=(u&&!re(u.symbol)?u:null)??Ge(c,s.source.startLine);if(f&&!re(f.symbol))return a(f,l,d,void 0,"none",!0),f.symbol;s.owner.name&&i({file:s.owner.file,name:s.owner.name,startLine:s.owner.startLine,endLine:s.owner.endLine},l,`${d}:source-owner`,void 0,!0);let m=e.index.definitionsForFile(s.source.file).filter(p=>!!p.leaf&&Ee(t,s.source.file,p.leaf).some(g=>g>=s.source.startLine&&g<=s.source.endLine));if(m.length===1){let p=m[0];a(p,l,`${d}:handler-identifier`,void 0,"none",!0),pe(o,{kind:"runtime-boundary",evidence:"runtime-boundary:handler-identifier",fromFile:s.source.file,fromSymbol:null,toFile:p.relativePath,toSymbol:p.symbol,fromBoundaryParticipant:Ve(s),line:s.source.startLine,strength:"derived"})}return null}function nl(e){let t=0,n=0,o=0;for(let r of e.searches){let a=$l(e.db,e.index,r,e.boundaryObservationLocations),i=a.filter(c=>Gl(c,e.sourceAllowed)),s=!e.opts.fullLiteralTraversal&&(a.length>qs||i.length>zs),l=s?[]:a,d=new Set((s?[]:e.opts.fullLiteralTraversal?i:[...i].sort(Dl).slice(0,Us)).map(Pr));s&&(n+=1,o+=a.length);for(let c of l){let u=d.has(Pr(c)),f=u&&!c.ownerSymbol&&c.ownerStartLine!==null&&c.ownerEndLine!==null;if(e.addFile(c.relativePath,0,`${u?"literal-anchor":"literal-match"}:${r}`,f,f),f&&e.addSourceConstruct({file:c.relativePath,name:c.ownerShortName??`${c.relativePath}:${c.ownerStartLine+1}`,startLine:c.ownerStartLine,endLine:c.ownerEndLine},0,`literal-source-owner:${r}`,r,!0),u&&c.ownerSymbol){let m=Te(e.db,e.index,c.ownerSymbol).matches[0];m&&!re(m.symbol)&&e.addSymbol(m,0,"literal-owner",r,"all",!0)}e.literalHits.push({query:r,file:c.relativePath,line:c.line,ownerSymbol:c.ownerSymbol,ownerShortName:c.ownerShortName,ownerStartLine:c.ownerStartLine,ownerEndLine:c.ownerEndLine,sourceLine:c.sourceLine.trim(),matchKind:c.matchKind,traversalSeed:u})}e.anchors.push({kind:"literal",query:r,status:a.length>0?"matched":"missing",matchedRegionIds:[],matchingLines:a.length,seedMatchingLines:s?0:d.size,matchOnlyLines:a.length-d.size,eligibleSeedMatchingLines:i.length,materializedMatchingLines:l.length,withheldMatchingLines:s?a.length:0,literalTraversal:s?"withheld-broad":"materialized",representativeMatches:s?jl(r,a):void 0,narrowingCommands:s?ql(r,a):void 0,exhaustiveTraversalCommand:s||d.size<i.length?`scip-query system-map --search ${V(r)} --full-literal-traversal`:void 0,seedRegionIds:[],matchOnlyRegionIds:[]})}for(let r of e.symbolQueries){let a=Te(e.db,e.index,r);t+=a.omitted;let i=_l(e.db,r),s=a.matches.filter(f=>!re(f.symbol)),l=i!==null&&s.length===0;l&&e.addSourceConstruct(i,0,"source-construct-anchor",r,!0);let d=l?s:a.matches;for(let f of d)e.addSymbol(f,0,"symbol-anchor",r,"all",!0);let c=l?Bl(i):null,u=l?1:a.total;e.anchors.push({kind:"symbol",query:r,status:u===0?"missing":u===1?"matched":"ambiguous",matchedRegionIds:[],symbolCandidates:[...c?[c]:[],...d.map(Vl)],totalSymbolCandidates:u,omittedSymbolCandidates:a.omitted})}return{omittedSymbolCandidates:t,broadLiteralAnchors:n,withheldLiteralMatches:o}}function ol(e){let{db:t,opts:n,mode:o,searches:r,symbolQueries:a,maxDepth:i,maxTopologyCharacters:s,requestedRelationKinds:l,evidenceFloor:d,includedSourceScopes:c,workspaces:u,runtimeBoundaries:f,boundaryObservations:m,representedBoundaryLinkIds:p,files:g,symbols:b,sourceConstructs:C,literalHits:S,pendingRelations:v,externalImports:R,anchors:y,omittedSymbolCandidates:N,broadLiteralAnchors:L,withheldLiteralMatches:x,filteredUnverifiedCallEdges:M,memberCallCandidateEdges:h,unresolvedMemberCallsites:P,sourceAllowed:D}=e,O=new Set(l),w=new Map;for(let F of g.keys())w.set(F,lt(F,u));let T=[...v.values()].filter(F=>w.has(F.fromFile)&&w.has(F.toFile)).map(F=>({...F,fromRegionId:w.get(F.fromFile).id,toRegionId:w.get(F.toFile).id})).sort(jr),I=sc(T),_=new Set(n.expand??[]),A=oc(g,b,S,T,I,w,_),j=new Set([...g.values()].filter(F=>[...F.origins].some(K=>K.startsWith("literal-anchor:")||K==="literal-owner"||K==="symbol-anchor")).map(F=>w.get(F.file).id)),$=Pl(A),B=new Set(A.map(F=>F.id)),U=[..._].filter(F=>!B.has(F)).sort();for(let F of y)if(F.matchedRegionIds=cc(F,S,b,w),F.kind==="literal"){let K=S.filter(Z=>Z.query===F.query);F.seedRegionIds=z(K.filter(Z=>Z.traversalSeed).map(Z=>w.get(Z.file).id)),F.matchOnlyRegionIds=z(K.filter(Z=>!Z.traversalSeed).map(Z=>w.get(Z.file).id))}let q=[...b.values()].filter(F=>!F.processed).length,se=[...g.values()].filter(F=>F.primary&&!F.processed).length,Ne=[...g.values()].filter(F=>!F.primary&&!F.processed).length,Oe=[...b.values()].filter(F=>F.processed),ve=(f?.frontiers??[]).flatMap(F=>{let K=m.get(F.observationId);return!K&&F.source&&F.action&&F.strength?!O.has("runtime-boundary")||!D(F.source.file)||d==="exact"||!g.has(F.source.file)?[]:[{observationId:F.observationId,action:F.action,strength:F.strength,file:F.source.file,line:F.source.startLine,ownerShortName:F.ownerShortName??null,address:F.address??F.missingKeyParts.join(", "),reason:F.reason}]:!O.has("runtime-boundary")||!K||!D(K.source.file)||d==="exact"&&K.strength!=="exact"||!g.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:Gr(K),reason:F.reason,protocol:K.protocol,role:K.role,modality:K.modality,resolution:K.resolution,sourceScope:K.sourceScope,keyParts:K.keyParts.map(Z=>({name:Z.name,value:Z.value,evidence:Z.evidence}))}]}).sort((F,K)=>F.file.localeCompare(K.file)||F.line-K.line),E=(f?.links??[]).filter(F=>{if(!O.has("runtime-boundary")||d==="exact"&&F.strength!=="exact")return!1;let K=m.get(F.from),Z=m.get(F.to);return!!(K&&Z&&D(K.source.file)&&D(Z.source.file)&&(g.has(K.source.file)||g.has(Z.source.file)))}),k=E.filter(F=>F.strength==="exact").length,G=E.filter(F=>F.strength==="derived").length,H=E.filter(F=>F.strength==="candidate").length,me=f?.links.filter(F=>F.strength==="exact").length??0,Fe=f?.links.filter(F=>F.strength==="derived").length??0,Qe=f?.links.filter(F=>F.strength==="candidate").length??0,Kt=lc(R,w),qt=N===0?"accounted":"incomplete",Fn=[...L>0?[`${L} broad literal anchor(s) withheld ${x} 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 (${c.join(", ")}) remain visible as match-only evidence and do not seed traversal.`,f?"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 ${i}; nonzero frontier counts identify evidence that was discovered but not traversed.`,"Region labels are structural path groupings, not inferred runtime or architectural boundaries."],fe=xl({db:t,anchors:y,regions:A,symbolStates:b,sourceConstructStates:C,literalHits:S,relations:T,externalBoundaries:Kt,boundaryFrontiers:ve,regionForFile:w,closureStatus:qt,omittedSymbolCandidates:N,maxDepth:i,requestedRelationKinds:l,evidenceFloor:d,includedSourceScopes:c,blindSpots:Fn,topologyFrontiers:n.topologyFrontiers??[],routeIds:n.routeIds??[],expandedRegionIds:[..._],maxTopologyCharacters:s,fullLiteralTraversal:n.fullLiteralTraversal??!1});if(o==="topology")return fe;let Pn=(n.behaviorFocusLocations?.length??0)>0?new Set([...fe.anchors.flatMap(F=>F.nodeIds),...fe.paths.flatMap(F=>F.nodeIds)]).size:void 0,ct=Co(t,fe,{focusLocations:n.behaviorFocusLocations,...Pn?{maxSteps:Pn}:{}});To(t,fe,ct);let Vr=cl(t,fe,ct,n.behaviorFocusLocations??[]);fe.corridor=dr(fe,{focusLocations:Vr});let An=Ro(t,fe,ct,{sourceAllowed:D,selectionTerms:n.selectionTerms}),kn=wl(fe),Qr=Tl(r,a,i,l,d,c,n.fullLiteralTraversal??!1,s,A,I,j,_,kn),Yr=Rl(r,a,i,A.filter(F=>kn.has(F.id)),j,l,d,c,n.fullLiteralTraversal??!1,s);return{anchors:y,regions:A,regionRelations:I,externalBoundaries:Kt,boundaryFrontiers:ve,unmatchedExpansions:U,expansion:Yr,drilldown:$,presentation:Qr,topology:fe,behavior:ct,nextAnchors:An,closure:{status:qt,emitted:{regions:A.length,relations:T.length,runtimeLinks:p.size},withheld:{symbols:q,files:se+Ne,regions:fe.nodes.filter(F=>F.kind==="structural-region"&&F.disposition==="folded").length,drillAnchors:($?.omittedAnchors??0)+An.omittedAnchors,literalMatches:x},ambiguous:{anchors:y.filter(F=>F.status==="ambiguous").length,omittedSymbolCandidates:N},external:Kt.length,unresolved:ve.length,explanation:qt==="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:y.length,requestedRelationKinds:l,evidenceFloor:d,includedSourceScopes:c,matchedAnchorCount:y.filter(F=>F.status!=="missing").length,literalSearchesComplete:!0,broadLiteralAnchors:L,withheldLiteralMatches:x,symbolCandidateSetsComplete:N===0,omittedSymbolCandidates:N,maxTraversalDepth:i,frontierSymbols:q,frontierFiles:se,supportFilesNotTraversed:Ne,filteredUnverifiedCallEdges:M,memberCallCandidateEdges:h,unresolvedMemberCallsites:P,runtimeBoundaryEvidenceAvailable:f!==null,runtimeBoundaryObservations:f?.observations.length??0,runtimeBoundaryExactLinks:k,runtimeBoundaryDerivedLinks:G,runtimeBoundaryCandidateLinks:H,repositoryRuntimeBoundaryExactLinks:me,repositoryRuntimeBoundaryDerivedLinks:Fe,repositoryRuntimeBoundaryCandidateLinks:Qe,runtimeBoundaryTraversedLinks:p.size,runtimeBoundaryFrontiers:ve.length,referenceExpansionEligibleSymbols:Oe.filter(F=>F.referenceScope!=="none").length,referenceExpansionSkippedSymbols:Oe.filter(F=>F.referenceScope==="none").length,dynamicDispatchRepresented:f?.links.some(F=>F.joinRule==="carrier.discriminator"&&p.has(F.id))??!1,runtimeGeneratedLinksRepresented:f!==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:Fn}}}function rl(e,t){let{db:n,relationPolicy:o,sourceConstructs:r,reverseExpandedSourceConstructs:a,pendingRelations:i,reverseFileGraph:s,serviceCallerFilesBySourceConstruct:l,sourceAllowed:d,memberCallTargetsForWholeFile:c,addSymbol:u,addSourceConstruct:f}=e;if(o.has("call")){let m=[...r.values()].filter(p=>p.traversalEligible&&p.reverseCallExpansion&&p.depth<=t&&!a.has(Se(p)));for(let p of m){a.add(Se(p));let g=J(n,p.file);if((g?.callables??[]).filter(S=>S.name===p.name&&S.startLine<=p.endLine&&S.endLine>=p.startLine).length===1){let S=(g?.callSites??[]).filter(v=>v.calleeLeaf===p.name&&!v.memberAccess);for(let v of S){let R=t+1,y=Ge(X(n,p.file),v.line),N=null,L=null;if(y&&!re(y.symbol)){if(y.relativePath===p.file&&y.startLine<=p.endLine&&y.endLine>=p.startLine)continue;u(y,R,"reverse-local-call-owner",void 0,"forward-regions",!0),N=y.symbol}else{let x=Ln(n,p.file,v.line);x&&Se(x)!==Se(p)&&(L=f(x,R,"reverse-local-call-source-owner",void 0,!0))}!N&&!L||pe(i,{kind:"call",evidence:"ast-callsite",fromFile:p.file,fromSymbol:N,toFile:p.file,toSymbol:null,fromSourceConstruct:L?ae(L):void 0,toSourceConstruct:ae(p),line:v.line,strength:"derived"})}}let C=new Set([...s.get(p.file)??[],...l.get(Se(p))??[],...lo(n,p.file).flatMap(S=>[...s.get(S)??[]])]);for(let S of C){if(!d(S))continue;let R=c(S).targets.filter(y=>y.targetFile===p.file&&y.targetStartLine<=p.endLine&&y.targetEndLine>=p.startLine);for(let y of R){let N=t+1,L=Ge(X(n,S),y.line),x=null,M=null;if(L&&!re(L.symbol))u(L,N,"reverse-member-call-owner",void 0,"cross-workspace-or-forward",!0),x=L.symbol;else{let h=Ln(n,S,y.line);h&&(M=f(h,N,"reverse-member-call-source-owner",void 0,!0))}!x&&!M||pe(i,{kind:"call",evidence:"ast-service-member-callsite",fromFile:S,fromSymbol:x,toFile:p.file,toSymbol:null,fromSourceConstruct:M?ae(M):void 0,toSourceConstruct:ae(p),line:y.line,strength:y.strength==="exact"?"exact":"derived"})}}}}}function il(e,t){let{db:n,index:o,relationPolicy:r,symbols:a,sourceAllowed:i,files:s,workspaces:l,addFile:d,addSymbol:c,addSourceConstruct:u,pendingRelations:f,fileGraph:m,traversalMetrics:p}=e,g=[...a.values()].filter(C=>!C.processed&&C.depth<=t),b=r.has("call")?o.calleeMap(g.map(C=>C.definition),{additive:!1,semantic:!1}):new Map;for(let C of g){C.processed=!0;let S=C.definition;if(C.referenceScope!=="none"&&(r.has("call")||r.has("reference")||r.has("contract-symbol"))){let v=Ul(n,o,S).filter(y=>i(y.file)&&Xl(C,y.file,s,l)),R=new Set(v.flatMap(y=>{if(!(r.has("call")&&J(n,y.file)?.callSites.some(x=>x.line===y.line&&Mr(n,y.file,x,S))===!0)||!y.enclosingSymbol)return[];let L=Te(n,o,y.enclosingSymbol).matches[0];return L&&!re(L.symbol)?[{owner:L,site:y}]:[]}).sort((y,N)=>{let L=de(S.relativePath,l).relativeDir,x=de(y.owner.relativePath,l).relativeDir===L,M=de(N.owner.relativePath,l).relativeDir===L,h=Rr(n,y.owner),P=Rr(n,N.owner),D=y.owner.endLine-y.owner.startLine,O=N.owner.endLine-N.owner.startLine;return Number(M)-Number(x)||P-h||D-O||y.owner.symbol.localeCompare(N.owner.symbol)}).filter((y,N,L)=>L.findIndex(x=>x.owner.symbol===y.owner.symbol)===N).reduce((y,N)=>{if(y.length>=Qs)return y;let L=de(N.owner.relativePath,l).relativeDir;return y.some(x=>x.workspace===L)||y.push({symbol:N.owner.symbol,workspace:L}),y},[]).map(y=>y.symbol));for(let y of v){let N=t+1;d(y.file,N,`reference:${ee(S.symbol)}`,!0);let L=r.has("call")&&J(n,y.file)?.callSites.some(h=>h.line===y.line&&Mr(n,y.file,h,S))===!0,x=null,M=null;if(y.enclosingSymbol){let h=Te(n,o,y.enclosingSymbol).matches[0];h&&!re(h.symbol)&&(c(h,N,"reference-owner",void 0,L&&R.has(h.symbol)?C.referenceScope:"none"),x=h.symbol)}if(!x&&y.line!==null){let h=Ln(n,y.file,y.line);h&&(M=u(h,N,"reference-source-owner",void 0,L))}r.has("reference")&&pe(f,{kind:"reference",evidence:"indexed-or-source-reference",fromFile:y.file,fromSymbol:x,toFile:S.relativePath,toSymbol:S.symbol,fromSourceConstruct:M?ae(M):void 0,line:y.line,strength:"mixed"}),L&&pe(f,{kind:"call",evidence:"ast-callsite",fromFile:y.file,fromSymbol:x,toFile:S.relativePath,toSymbol:S.symbol,fromSourceConstruct:M?ae(M):void 0,line:y.line,strength:"derived"}),r.has("contract-symbol")&&de(y.file,l).relativeDir!==de(S.relativePath,l).relativeDir&&pe(f,{kind:"contract-symbol",evidence:"compiler-cross-workspace-symbol",fromFile:y.file,fromSymbol:x,toFile:S.relativePath,toSymbol:S.symbol,fromSourceConstruct:M?ae(M):void 0,line:y.line,strength:"exact"})}}for(let v of b.get(S.symbolId)??[]){let R=Te(n,o,v.symbol).matches.find(N=>N.relativePath===v.file);if(!R||!i(R.relativePath))continue;if(!(R.relativePath===S.relativePath||(m.get(S.relativePath)??new Set).has(R.relativePath))){p.filteredUnverifiedCallEdges+=1;continue}c(R,t+1,`call:${ee(S.symbol)}`,void 0,"none",!0),pe(f,{kind:"call",evidence:v.source,fromFile:S.relativePath,fromSymbol:S.symbol,toFile:R.relativePath,toSymbol:R.symbol,line:null,strength:Ml(v.source)})}}}function al(e,t){let{db:n,index:o,relationPolicy:r,files:a,sourceConstructs:i,symbols:s,boundaryObservations:l,boundaryObservationDepths:d,sourceAllowed:c,addSymbol:u,pendingRelations:f,traversalMetrics:m,addSourceConstruct:p,serviceCallerFilesBySourceConstruct:g,reverseFileGraph:b,externalImports:C,addFile:S,workspaces:v}=e,R=[...a.values()].filter(y=>!y.processed&&y.primary&&y.depth<=t);for(let y of R){y.processed=!0;let N=[...i.values()].filter(I=>I.traversalEligible&&I.file===y.file&&I.depth<=t),L=[...s.values()].filter(I=>I.definition.relativePath===y.file&&I.depth<=t).map(I=>{let _=Xt(n,y.file,I.definition.startLine);return{startLine:_?.startLine??I.definition.startLine,endLine:_?.endLine??I.definition.endLine}}),x=I=>[...s.values()].filter(_=>_.definition.relativePath===y.file&&_.definition.startLine<=I&&_.definition.endLine>=I).sort((_,A)=>_.definition.endLine-_.definition.startLine-(A.definition.endLine-A.definition.startLine)||_.definition.startLine-A.definition.startLine)[0],M=[...l.values()].filter(I=>I.source.file===y.file&&d.has(I.id)),h=[...N.map(I=>({startLine:I.startLine,endLine:I.endLine})),...M.map(I=>({...Bt(n,I)}))],P=[...L,...h],D=(J(n,y.file)?.callSites??[]).filter(I=>P.some(_=>I.line>=_.startLine&&I.line<=_.endLine)),O=new Set;if(r.has("call"))for(let I of P){let _=xt(n,y.file,I.startLine,I.endLine);for(let A of _.targets){if(!c(A.definition.relativePath))continue;let j=x(A.sourceLine),$=N.find(U=>U.startLine<=A.sourceLine&&U.endLine>=A.sourceLine),B=M.find(U=>{let q=Bt(n,U);return q.startLine<=A.sourceLine&&q.endLine>=A.sourceLine});u(A.definition,t+1,`scip-occurrence-call:${y.file}:${A.sourceLine+1}`,void 0,"none",!0),pe(f,{kind:"call",evidence:"scip-occurrence-callsite",fromFile:y.file,fromSymbol:j?.definition.symbol??null,toFile:A.definition.relativePath,toSymbol:A.definition.symbol,fromBoundaryParticipant:B?Ve(B):void 0,fromSourceConstruct:$?ae($):void 0,line:A.sourceLine,strength:"exact"}),O.add(`${A.sourceLine}\0${A.calleeLeaf}`)}}if(r.has("reference"))for(let I of P){let _=yo(n,y.file,I.startLine,I.endLine);for(let A of _.targets){if(!c(A.definition.relativePath)||O.has(`${A.sourceLine}\0${A.calleeLeaf}`))continue;let j=x(A.sourceLine);if(j?.definition.symbol===A.definition.symbol)continue;let $=N.find(U=>U.startLine<=A.sourceLine&&U.endLine>=A.sourceLine),B=M.find(U=>{let q=Bt(n,U);return q.startLine<=A.sourceLine&&q.endLine>=A.sourceLine});u(A.definition,t+1,`scip-occurrence-reference:${y.file}:${A.sourceLine+1}`,void 0,"none",!0),pe(f,{kind:"reference",evidence:"scip-occurrence-reference",fromFile:y.file,fromSymbol:j?.definition.symbol??null,toFile:A.definition.relativePath,toSymbol:A.definition.symbol,fromBoundaryParticipant:B?Ve(B):void 0,fromSourceConstruct:$?ae($):void 0,line:A.sourceLine,strength:"exact"})}}let w=r.has("call")?Jt(n,y.file,{ranges:P,excludeIndexedTargets:!1}):{targets:[],unresolvedCallsites:0};m.unresolvedMemberCallsites+=w.unresolvedCallsites;let T=w.targets.filter(I=>!O.has(`${I.line}\0${I.calleeLeaf}`));m.memberCallCandidateEdges+=T.filter(I=>I.strength!=="exact"&&(I.resolution!=="imported-service-object-member"||(I.resolutionAlternativeCount??0)>1)).length;for(let I of T){let _=(I.resolutionAlternativeCount??1)===1,A=I.targetSymbol?X(n,I.targetFile).find(q=>q.symbol===I.targetSymbol):void 0,j=A?null:p({file:I.targetFile,name:I.calleeLeaf,startLine:I.targetStartLine,endLine:I.targetEndLine},t+1,`member-call:${y.file}`,void 0,I.resolution==="imported-service-object-member"&&_,_);if(j&&I.serviceFile){let q=Se(j),se=g.get(q)??new Set;for(let Ne of b.get(I.serviceFile)??[])se.add(Ne);g.set(q,se)}A&&u(A,t+1,`member-call:${y.file}`,void 0,"none",!0);let $=N.find(q=>q.startLine<=I.line&&q.endLine>=I.line),B=x(I.line),U=M.find(q=>{let se=Bt(n,q);return se.startLine<=I.line&&se.endLine>=I.line});pe(f,{kind:"call",evidence:I.resolution==="constructed-member-receiver"?"ast-constructed-member-callsite":I.resolution==="factory-callback-member"?"ast-factory-callback-callsite":I.resolution==="imported-service-object-member"?"ast-service-member-callsite":"ast-member-import-candidate",fromFile:y.file,fromSymbol:B?.definition.symbol??null,toFile:I.targetFile,toSymbol:A?.symbol??null,fromBoundaryParticipant:U?Ve(U):void 0,fromSourceConstruct:$?ae($):void 0,toSourceConstruct:j?ae(j):void 0,line:I.line,strength:I.resolution==="imported-service-object-member"?(I.resolutionAlternativeCount??0)===1?"derived":"candidate":I.strength??"candidate"})}for(let I of r.has("import")||r.has("call")?Wl(n,y.file):[]){if(!I.fromFile){if(r.has("import")){let A=C.get(I.shortName)??{name:I.shortName,fromFiles:new Set};A.fromFiles.add(y.file),C.set(I.shortName,A)}continue}if(!c(I.fromFile))continue;if(r.has("import")&&(S(I.fromFile,t+1,`import:${y.file}`,!1),pe(f,{kind:"import",evidence:"indexed-or-source-import",fromFile:y.file,fromSymbol:null,toFile:I.fromFile,toSymbol:I.symbol,line:null,strength:"mixed"})),r.has("call")&&D.length>0){let A=(I.source==="compiler"?Te(n,o,I.symbol).matches:je(n,I.fromFile,I.importedName)).filter(j=>!re(j.symbol));for(let j of A){let $=D.filter(B=>B.calleeLeaf===I.localName).map(B=>B.line);if($.length!==0){u(j,t+1,`source-call:${y.file}`,void 0,"none",!0);for(let B of $)pe(f,{kind:"call",evidence:"ast-callsite",fromFile:y.file,fromSymbol:null,toFile:j.relativePath,toSymbol:j.symbol,line:B,strength:"derived"})}}}if(!y.promoteBoundaryImports||!Ql(y.file,I.fromFile,v))continue;let _=Te(n,o,I.symbol);for(let A of _.matches)if(Yl(A.relativePath,I.fromFile,v)&&!re(A.symbol)){let j=de(y.file,v).relativeDir!==de(A.relativePath,v).relativeDir;u(A,t+1,`boundary-import:${y.file}`,void 0,j?"cross-workspace-or-forward":"forward-regions")}}}}function sl(e,t){let{relationPolicy:n,runtimeBoundaries:o,evidenceFloor:r,representedBoundaryLinkIds:a,boundaryObservations:i,sourceAllowed:s,boundaryObservationDepths:l,symbols:d,sourceConstructs:c,addBoundaryObservation:u,pendingRelations:f}=e;for(let m of n.has("runtime-boundary")?o?.links??[]:[]){if(m.strength==="candidate"||r==="exact"&&m.strength!=="exact"||a.has(m.id))continue;let p=i.get(m.from),g=i.get(m.to);if(!p||!g||!s(p.source.file)||!s(g.source.file))continue;let b=$r(p,t,l,d,c),C=$r(g,t,l,d,c);if(b===null&&C===null)continue;let S=t+1,v=u(p,b??S,`runtime-boundary:${m.joinRule}`),R=u(g,C??S,`runtime-boundary:${m.joinRule}`),y=v?null:kr(c,p),N=R?null:kr(c,g);l.set(p.id,b??S),l.set(g.id,C??S),pe(f,{kind:"runtime-boundary",evidence:`runtime-boundary:${m.joinRule}`,fromFile:p.source.file,fromSymbol:v,toFile:g.source.file,toSymbol:R,fromBoundaryParticipant:Ve(p),toBoundaryParticipant:Ve(g),fromSourceConstruct:y?ae(y):void 0,toSourceConstruct:N?ae(N):void 0,runtimeBoundaryKey:m.matchedKeyParts.map(L=>`${L.name}=${L.value}`).join(" "),line:p.source.startLine,strength:m.strength}),a.add(m.id)}}function ll(e,t,n){let o=ne(t.searches??[]),r=ne(t.symbols??[]),a=ne(t.relations&&t.relations.length>0?t.relations:wr),i=a.filter(k=>!wr.includes(k));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=ne(t.sourceScopes&&t.sourceScopes.length>0?t.sourceScopes:["production"]),c=["production","test","fixture","example","generated","script","unknown"],u=d.filter(k=>!c.includes(k));if(u.length>0)throw new Error(`Unsupported system-map source scope(s): ${u.join(", ")}`);let f=new Set(d),m=k=>f.has(Wt(k));if(o.length===0&&r.length===0)throw new Error("system-map requires at least one --search or --symbol anchor.");let p=t.maxDepth??Ks;if(!Number.isSafeInteger(p)||p<0)throw new RangeError(`maxDepth must be a non-negative safe integer; received ${p}`);let g=t.maxTopologyCharacters??Xs;if(!Number.isSafeInteger(g)||g<=0)throw new RangeError(`maxTopologyCharacters must be a positive safe integer; received ${g}`);let b=new bt(e),{fileGraph:C,reverseFileGraph:S,workspaces:v,runtimeBoundaries:R}=Jl(e,b),y=new Map((R?.observations??[]).map(k=>[k.id,k])),N=new Set((R?.observations??[]).map(k=>`${k.source.file}\0${k.source.startLine}`)),L=new Set,x=new Map,M=new Map,h=new Map,P=new Map,D=[],O=new Map,w=new Map,T=[],I={filteredUnverifiedCallEdges:0,memberCallCandidateEdges:0,unresolvedMemberCallsites:0},_=new Set,A=new Map,j=new Map,$=k=>{let G=j.get(k);if(G)return G;let H=Jt(e,k,{excludeIndexedTargets:!1});return j.set(k,H),H},B=(k,G,H,me,Fe=!1)=>Zs(M,k,G,H,me,Fe),U=(k,G,H,me,Fe="none",Qe=!1)=>Js(h,B,k,G,H,me,Fe,Qe),q=(k,G,H,me,Fe=!1,Qe=!0)=>el(P,B,k,G,H,me,Fe,Qe),se=(k,G,H)=>tl({db:e,index:b,pendingRelations:O,addFile:B,addSymbol:U,addSourceConstruct:q,observation:k,depth:G,origin:H}),{omittedSymbolCandidates:Ne,broadLiteralAnchors:Oe,withheldLiteralMatches:ve}=nl({db:e,index:b,searches:o,symbolQueries:r,opts:t,boundaryObservationLocations:N,sourceAllowed:m,addFile:B,addSymbol:U,addSourceConstruct:q,literalHits:D,anchors:T}),E={db:e,index:b,relationPolicy:s,evidenceFloor:l,sourceAllowed:m,fileGraph:C,reverseFileGraph:S,workspaces:v,runtimeBoundaries:R,boundaryObservations:y,boundaryObservationDepths:x,representedBoundaryLinkIds:L,files:M,symbols:h,sourceConstructs:P,pendingRelations:O,externalImports:w,reverseExpandedSourceConstructs:_,serviceCallerFilesBySourceConstruct:A,traversalMetrics:I,memberCallTargetsForWholeFile:$,addFile:B,addSymbol:U,addSourceConstruct:q,addBoundaryObservation:se};for(let k=0;k<p;k+=1)rl(E,k),il(E,k),al(E,k),sl(E,k);return ol({db:e,opts:t,mode:n,searches:o,symbolQueries:r,maxDepth:p,maxTopologyCharacters:g,requestedRelationKinds:a,evidenceFloor:l,includedSourceScopes:d,workspaces:v,runtimeBoundaries:R,boundaryObservations:y,representedBoundaryLinkIds:L,files:M,symbols:h,sourceConstructs:P,literalHits:D,pendingRelations:O,externalImports:w,anchors:T,omittedSymbolCandidates:Ne,broadLiteralAnchors:Oe,withheldLiteralMatches:ve,filteredUnverifiedCallEdges:I.filteredUnverifiedCallEdges,memberCallCandidateEdges:I.memberCallCandidateEdges,unresolvedMemberCallsites:I.unresolvedMemberCallsites,sourceAllowed:m})}function cl(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=>Ys.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=ht(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 dl(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 Se(e){return`${e.file}\0${e.startLine}\0${e.endLine}\0${e.name}`}function ae(e){return{file:e.file,name:e.name,startLine:e.startLine,endLine:e.endLine}}function Mr(e,t,n,o){if(n.calleeLeaf===o.leaf)return!0;let r=Gn(e,t,n.calleeLeaf);return r!==null&&r.importedName===o.leaf&&r.sourcePath!==null&&Pe(r.sourcePath,o.relativePath)}function Ot(e,t){let n=pt(J(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=Or(e,t.file,t.startLine);return o&&o.endLine>=t.endLine?{file:t.file,name:o.name,startLine:o.startLine,endLine:o.endLine}:ae(t)}function He(e){return ue("source-construct",e.file,String(e.startLine),String(e.endLine),e.name)}function Gt(e,t){let n=Xn(e,t.symbol,t.relativePath),o=new Set(["package-surface-file","transitive-package-surface"]),r=n.filter(i=>!o.has(i)||Jn(e,t)),a=r.some(i=>!o.has(i));return{evidence:r,priority:a||Zn(e,t.symbol,t.relativePath)?2:1}}function Rr(e,t){let n=Gt(e,t);return n.evidence.length>0?n.priority:0}function ul(e,t){let n=X(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=Gt(e,r);if(a.evidence.length>0)return a}for(let r of pl(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=Gt(e,i);if(s.evidence.length>0)return s}return{evidence:[],priority:0}}return{evidence:[],priority:0}}function pl(e,t,n){let o=Y(e,t)?.rootNode;if(!o||o.startPosition.row>n||o.endPosition.row<n)return[];let r=[],a=Nn(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 ml(e){return[...new Map([...e.sourceConstructStates.values()].map(t=>Ot(e.db,t)).map(t=>[Se(t),t])).values()].sort((t,n)=>t.file.localeCompare(n.file)||t.startLine-n.startLine||t.endLine-n.endLine)}function fl(e,t){return e.anchors.map((n,o)=>{let r=ue("anchor",String(o),n.kind,n.query),a=[...e.symbolStates.values()].filter(c=>c.anchorQueries.has(n.query)).flatMap(c=>{if(!re(c.definition.symbol))return[Re(c.definition.symbol)];let u=t.filter(f=>f.file===c.definition.relativePath).map(f=>He(f));return u.length>0?u:[Re(c.definition.symbol)]}),i=[...e.sourceConstructStates.values()].filter(c=>c.anchorQueries.has(n.query)).map(c=>He(Ot(e.db,c))),s=e.literalHits.filter(c=>c.query===n.query&&c.traversalSeed===!0&&c.ownerSymbol&&e.symbolStates.has(c.ownerSymbol)).map(c=>Re(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=>He(Ot(e.db,dl(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 gl(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 yl(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=Re(i.definition.symbol),d=Gt(e.db,i.definition);r.push({id:l,kind:"symbol",label:ee(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??ee(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=He(i),c=o.find(f=>f.file===i.file&&f.line>=i.startLine&&f.line<=i.endLine)?.ownerName??i.name,u=ul(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:Mn(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 hl(e,t,n,o,r,a,i,s,l,d=!1){let c=o?Re(o):null;if(c&&t.has(c)&&!re(o))return c;let u=r?Mn(r.observationId):null;if(d&&u&&t.has(u))return u;let f=a?He(Ot(e,a)):null;if(f&&t.has(f))return f;if(u&&t.has(u))return u;let m=l===null?null:(n.get(s)??[]).filter(p=>p.startLine<=l&&p.endLine>=l).sort((p,g)=>p.endLine-p.startLine-(g.endLine-g.startLine)||p.startLine-g.startLine)[0]??null;return m?He(m):c&&t.has(c)?c:i}function bl(e,t,n){let o=new Set(t.map(d=>d.id)),r=ye(n,d=>d.file),a=(d,c,u,f,m,p,g=!1)=>hl(e.db,o,r,d,c,u,f,m,p,g),i=[];for(let d of e.symbolStates.values()){let c=e.regionForFile.get(d.definition.relativePath)?.id;if(!c)continue;let u=Re(d.definition.symbol);i.push({id:ue("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=ye(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 p=Mn(c.fromBoundaryParticipant.observationId),g=a(c.fromSymbol,void 0,c.fromSourceConstruct,c.fromRegionId,c.fromFile,c.line);g!==p&&!l.has(p)&&(l.add(p),i.push({id:ue("edge","boundary-observation",g,p),kind:"boundary-observation",fromNodeId:g,toNodeId:p,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(p=>p.id===u):null)?.kind!=="structural-region"&&i.push({id:ue("edge",c.kind,u,f),kind:c.kind,fromNodeId:u,toNodeId:f,directed:!0,disposition:"folded",semantics:$o(c),evidence:Nl(d.map(p=>({method:p.evidence,strength:p.strength??"unknown",identity:p.kind==="runtime-boundary"&&p.runtimeBoundaryKey?p.runtimeBoundaryKey:`${p.fromSymbol??p.fromFile} -> ${p.toSymbol??p.toFile}`,location:p.line===null?null:{file:p.fromFile,line:p.line}})))})}return i}function Sl(e,t,n){for(let r of e.externalBoundaries){let a=ue("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:ue("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=ue("unsupported","runtime-boundary",r.observationId,String(a)),l=ue("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:ue("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 vl(e,t){let n=t.topologyFrontiers.some(p=>p==="frontier:program-facts"),o=Cr(e,{expandedFrontierIds:t.topologyFrontiers.filter(p=>p!=="frontier:program-facts"),routeIds:t.routeIds}),r=o.nodes.filter(p=>p.disposition==="emitted"||o.anchors.some(g=>g.status==="matched"&&g.nodeIds.includes(p.id))),a=t.relations.filter(p=>r.some(g=>El(p,g))),i=t.boundaryFrontiers.filter(p=>r.some(g=>Cl(p,g))),s=Uo(t.db,a,r),l=Ho(t.db,r),d=ir(t.db,r,i),c=[...s.nodes,...l.nodes,...d.nodes].map(p=>n&&p.disposition==="folded"?{...p,disposition:"emitted"}:p),u=[...s.edges,...l.edges,...d.edges].map(p=>n&&p.disposition==="folded"?{...p,disposition:"emitted"}:p),f=n?null:Ll(r,c,u),m=_t({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}:{}});m.completion=o.completion;for(let p of m.frontiers)p.disposition==="folded"&&(p.id.startsWith("frontier:program-facts:")||(p.expansion=Il(t,p.id)));return m}function xl(e){let t=ml(e),n=fl(e,t),o=yl(e,t,gl(n)),r=bl(e,o,t),a=Sl(e,o,r);return vl(_t({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 El(e,t){if(e.fromSymbol&&t.id===Re(e.fromSymbol)||e.toSymbol&&t.id===Re(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 Cl(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 Ll(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:ue("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 Il(e,t){return`scip-query system-map ${[...e.anchors.flatMap(o=>o.kind==="literal"?[`--search ${V(o.query)}`]:[`--symbol ${V(o.query)}`]),`--depth ${e.maxDepth}`,...e.requestedRelationKinds.map(o=>`--relation ${V(o)}`),`--evidence-floor ${V(e.evidenceFloor)}`,...e.includedSourceScopes.map(o=>`--source-scope ${V(o)}`),...e.fullLiteralTraversal?["--full-literal-traversal"]:[],`--topology-characters ${e.maxTopologyCharacters}`,...e.expandedRegionIds.map(o=>`--expand ${V(o)}`),...e.topologyFrontiers.map(o=>`--frontier ${V(o)}`),...e.routeIds.map(o=>`--route ${V(o)}`),`--frontier ${V(t)}`].join(" ")}`}function wl(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 Nl(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 ue(...e){return e.map(t=>encodeURIComponent(t)).join(":")}function Re(e){return ue("symbol",e)}function Ml(e){return e==="semantic-callee"||e==="scip-chunk"?"exact":"derived"}function Rl(e,t,n,o,r,a,i,s,l,d){let c=[...o].sort((g,b)=>Br(g,b,r)),f=c.slice(0,Ir).map(g=>g.id),m=c.slice(Ir).map(g=>g.id),p=[...e.map(g=>`--search ${V(g)}`),...t.map(g=>`--symbol ${V(g)}`),`--depth ${n}`,...a.map(g=>`--relation ${V(g)}`),`--evidence-floor ${V(i)}`,...s.map(g=>`--source-scope ${V(g)}`),...l?["--full-literal-traversal"]:[],`--topology-characters ${d}`,...f.map(g=>`--expand ${V(g)}`)];return{command:f.length===0?null:`scip-query system-map ${p.join(" ")}`,regionCount:f.length,regionIds:f,candidateRegionCount:o.length,omittedRegionIds:m}}function Tl(e,t,n,o,r,a,i,s,l,d,c,u,f){let m=[...l].sort((h,P)=>Br(h,P,c)).filter(h=>!f||f.has(h.id)||u.has(h.id)),p=d.length>0?Math.floor(s*.4):0,g=s-p,b=new Set,C=0;for(let h of m){let P=Tr(h);!u.has(h.id)&&b.size>0&&C+P>g||(b.add(h.id),C+=P)}let S=d.filter(h=>b.has(h.fromRegionId)&&b.has(h.toRegionId)).sort(Fl),v=[];for(let h of S){let P=Fr(h);v.length>0&&C+P>s||(v.push(jt(h)),C+=P)}let R=l.filter(h=>!b.has(h.id)).map(h=>h.id).sort(),y=new Set(v),N=d.filter(h=>!y.has(jt(h))).length,L=l.reduce((h,P)=>h+Tr(P),0)+d.reduce((h,P)=>h+Fr(P),0),x=m.every(h=>b.has(h.id))&&v.length===S.length,M=[...e.map(h=>`--search ${V(h)}`),...t.map(h=>`--symbol ${V(h)}`),`--depth ${n}`,...o.map(h=>`--relation ${V(h)}`),`--evidence-floor ${V(r)}`,...a.map(h=>`--source-scope ${V(h)}`),...i?["--full-literal-traversal"]:[],`--topology-characters ${Math.max(s,L)}`];return{maxCharacters:s,estimatedCharacters:C,totalEstimatedCharacters:L,regionIds:[...b],omittedRegionIds:R,relationKeys:v,omittedRelations:N,complete:x,expansionCommand:x?null:`scip-query system-map ${M.join(" ")}`}}function Tr(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 Fr(e){return 70+e.fromRegionId.length+e.toRegionId.length+e.kinds.join(",").length+e.evidence.join(",").length}function Fl(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||jt(e).localeCompare(jt(t))}function jt(e){return`${e.fromRegionId}\0${e.toRegionId}`}function Br(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 Pl(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=ye(r.symbols,l=>l.file),i=ye(r.literalHits,l=>l.file),s=[...r.files].sort((l,d)=>kl(l,d,a,i));for(let l of s){let d=(a.get(l.file)??[]).sort(no)[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(Kr)[0];c&&t.push({kind:"literal",regionId:r.id,file:c.file,line:c.line,endLine:null,label:c.ownerShortName??c.query})}}let o=Al(t,n);return{command:o.length===0?null:`scip-query inspect ${o.map(r=>`--at ${V(`${r.file}:${r.line+1}`)}`).join(" ")} --view behavior`,definitionCommand:null,candidateAnchors:t.length,selectedAnchors:o.length,omittedAnchors:t.length-o.length,anchors:o}}function Al(e,t){let n=[...ye(e,i=>i.regionId).values()],o=[],r=new Set,a=Math.min(Vs,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 kl(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=>Ke(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 V(e){return`'${e.replaceAll("'","'\\''")}'`}function $l(e,t,n,o){let r=[];for(let a of Bn(e,{includeIgnored:!1})){let i=le(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=J(e,a)?.callables??[];for(let{line:c,sourceLine:u}of s){let f=Ge(l,c),m=pt(d,c),p=f&&!re(f.symbol)?f:null,g=p?.startLine??m?.startLine??f?.startLine??c,b=p?.endLine??m?.endLine??f?.endLine??c,C=Zt(e,a,c,g,b),S=o.has(`${a}\0${c}`),v=!!(p?.isFunctionLike||m);r.push({relativePath:a,line:c,sourceLine:u,ownerSymbol:p?.symbol??null,ownerShortName:p?ee(p.symbol):m?.name??(f?ee(f.symbol):null),ownerStartLine:C.startLine,ownerEndLine:C.endLine,matchKind:Ol(u,n),seedPriority:S?0:v?1:2})}}return r}function Dl(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 Pr(e){return`${e.relativePath}\0${e.line}`}function Ln(e,t,n){let r=pt(J(e,t)?.callables??[],n)??Or(e,t,n);if(!r)return null;let a=Zt(e,t,n,r.startLine,r.endLine);return{file:t,name:r.name,startLine:a.startLine,endLine:a.endLine}}function Or(e,t,n){let o=Y(e,t)?.rootNode;if(!o||o.startPosition.row>n||o.endPosition.row<n)return null;let r=Nn(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&&In(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)&&In(s,n))return{name:l,startLine:r.startPosition.row,endLine:r.endPosition.row}}r=r.parent}let a=Xt(e,t,n);return a?{name:`source@${n+1}`,startLine:a.startLine,endLine:a.endLine}:null}function In(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&&In(n,t))}function Nn(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?Nn(n,t):e}function _l(e,t){let n=t.match(/^(.+):(\d+)(?:-(\d+))?$/u);if(!n)return null;let o=On(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=(J(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 Bl(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 Ol(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 wn(e){return mt(e)==="test"?!1:!/(?:^|[/._-])(?:fixtures?|mocks?|previews?|demos?|examples?|stories)(?:[/._-]|$)/iu.test(e)}function Gl(e,t){return e.matchKind!=="embedded"&&t(e.relativePath)&&(Wt(e.relativePath)!=="production"||wn(e.relativePath))}function jl(e,t){let n=[...t].sort(Kl),o=[],r=new Set;for(let a of n)if(!r.has(a.relativePath)&&(o.push(a),r.add(a.relativePath),o.length>=Lr))break;for(let a of n){if(o.length>=Lr)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 Kl(e,t){let n={"exact-value":0,boundary:1,embedded:2};return n[e.matchKind]-n[t.matchKind]||+(t.ownerSymbol!==null)-+(e.ownerSymbol!==null)||+!wn(e.relativePath)-+!wn(t.relativePath)||e.relativePath.localeCompare(t.relativePath)||e.line-t.line}function ql(e,t){let n=new Map;for(let o of t){let r=zl(o.relativePath);n.set(r,(n.get(r)??0)+1)}return[...n].sort(([o,r],[a,i])=>i-r||o.localeCompare(a)).slice(0,Ws).map(([o])=>`scip-query search ${V(e)} --scope ${V(o)}`)}function zl(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 Ul(e,t,n){let o=t.callerFileMap([n],{semantic:!1}).get(n.symbolId)??new Set,r=[];for(let a of[...o].sort()){let i=xe(e,a).filter(c=>c.importedName===n.leaf&&c.sourcePath!==null&&Pe(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=>Ee(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:Ge(d,c)?.symbol??null})}return r}function Wl(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:ee(o.symbol),importedName:Ar(ee(o.symbol)),localName:Ar(ee(o.symbol)),fromFile:o.from_file,source:"compiler"})):xe(e,t).map(o=>{let r=Hl(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 Ar(e){return e.slice(e.lastIndexOf(":")+1).replace(/\(\)$/u,"")||e}function Hl(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 Te(e,t,n){let o=Ht(e,n);if(!o.match)return{matches:[],total:0,omitted:0};let r=[o.match,...o.candidates.map(i=>Ht(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 Vl(e){return{symbol:e.symbol,shortName:ee(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine}}function pe(e,t){let n=[t.kind,t.fromFile,t.fromSymbol??"",t.toFile,t.toSymbol??"",t.fromBoundaryParticipant?.observationId??"",t.toBoundaryParticipant?.observationId??"",t.fromSourceConstruct?Se(t.fromSourceConstruct):"",t.toSourceConstruct?Se(t.toSourceConstruct):"",t.runtimeBoundaryKey??"",t.line??""].join("\0");e.set(n,t)}function Ve(e){return{observationId:e.id,action:e.action,protocol:e.protocol,role:e.role,address:Gr(e),file:e.source.file,line:e.source.startLine,endLine:e.source.endLine,ownerName:e.owner.name,ownerSymbol:e.owner.symbol}}function Bt(e,t){let n=le(e,t.source.file);return Ye(e,t.source.file,0,Math.max(0,n.length-1),[t.source.startLine])}function kr(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 $r(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 Mn(e){return ue("runtime-boundary-participant",e)}function Ql(e,t,n){let o=de(e,n),r=de(t,n);return o.relativeDir!==r.relativeDir?!0:/(?:^|\/)(?:contracts?|schemas?|db\/schema)(?:\/|$)/u.test(t)}function Yl(e,t,n){return lt(e,n).id===lt(t,n).id}function Xl(e,t,n,o){if(e.referenceScope==="all")return!0;let r=lt(t,o).id;return[...n.values()].some(i=>i.promoteBoundaryImports&&lt(i.file,o).id===r)?!0:e.referenceScope!=="cross-workspace-or-forward"?!1:de(t,o).relativeDir!==de(e.definition.relativePath,o).relativeDir}function Zl(e,t){let n={none:0,"forward-regions":1,"cross-workspace-or-forward":2,all:3};return n[e]>=n[t]?e:t}function Jl(e,t){let n=Nr.get(e);if(n)return n;let o=t.fileDependencyGraph(),r={fileGraph:o,reverseFileGraph:ec(o),workspaces:tc(t.sourceFiles()),runtimeBoundaries:Qn(e)};return Nr.set(e,r),r}function ec(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 de(e,t){return t.find(n=>e===n.relativeDir||e.startsWith(`${n.relativeDir}/`))??{name:"root",relativeDir:""}}function tc(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 lt(e,t){let n=de(e,t),r=(n.relativeDir?e.slice(n.relativeDir.length+1):e).split("/").filter(Boolean);r[0]==="src"&&r.shift();let a=nc(r);return{id:`region:${n.relativeDir||"root"}:${a}`,label:`${n.name}:${a}`,workspace:n.name,structuralPath:a}}function nc(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 oc(e,t,n,o,r,a,i){let s=ye([...e.values()],m=>a.get(m.file).id),l=ye([...t.values()],m=>a.get(m.definition.relativePath).id),d=ye(n,m=>a.get(m.file).id),c=new Map;for(let m of o)for(let p of new Set([m.fromRegionId,m.toRegionId])){let g=c.get(p)??[];g.push(m),c.set(p,g)}let u=ye(r,m=>m.toRegionId),f=ye(r,m=>m.fromRegionId);return[...s.entries()].map(([m,p])=>{let g=a.get(p[0].file),b=l.get(m)??[],C=d.get(m)??[],S=c.get(m)??[],v=i.has(m),R=b.map(ac).sort(dc).slice(0,Hs),y=p.filter(N=>mt(N.file)==="test").length;return{id:m,label:g.label,workspace:g.workspace,structuralPath:g.structuralPath,minDepth:Math.min(...p.map(N=>N.depth)),fileCount:p.length,sourceFileCount:p.length-y,testFileCount:y,symbolCount:b.length,literalHitCount:C.length,anchorQueries:z([...C.map(N=>N.query),...b.flatMap(N=>[...N.anchorQueries])]),relationKinds:z(S.map(N=>N.kind)),incomingRegionIds:z((u.get(m)??[]).map(N=>N.fromRegionId)),outgoingRegionIds:z((f.get(m)??[]).map(N=>N.toRegionId)),memberCallCandidateRelationCount:S.filter(N=>N.evidence==="ast-member-import-candidate").length,notableSymbols:R,omittedNotableSymbols:Math.max(0,b.length-R.length),expanded:v,files:v?p.map(rc).sort(uc):[],symbols:v?b.map(ic).sort(pc):[],literalHits:v?[...C].sort(Kr):[],relations:v?[...S].sort(jr):[]}}).sort((m,p)=>m.minDepth-p.minDepth||m.label.localeCompare(p.label))}function rc(e){return{file:e.file,kind:mt(e.file),depth:e.depth,origins:z([...e.origins])}}function ic(e){return{symbol:e.definition.symbol,shortName:ee(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:ee(e.definition.symbol),file:e.definition.relativePath,origins:z([...e.origins])}}function sc(e){return[...ye(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?[ee(o.fromSymbol)]:[])),toSymbols:z(n.flatMap(o=>o.toSymbol?[ee(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 lc(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 cc(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 Gr(e){return e.keyParts.map(t=>`${t.name}=${t.value}`).join(" ")}function z(e){return[...new Set(e)].sort()}function jr(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 dc(e,t){return Ke(e.origins)-Ke(t.origins)||e.shortName.localeCompare(t.shortName)}function uc(e,t){return e.depth-t.depth||e.file.localeCompare(t.file)}function pc(e,t){return e.depth-t.depth||e.file.localeCompare(t.file)||e.symbol.localeCompare(t.symbol)}function Kr(e,t){return e.file.localeCompare(t.file)||e.line-t.line||e.query.localeCompare(t.query)}var fc={causal:["execution","runtime","dataflow","state","temporal"],structure:["contract","identity","ownership","dependencies"],complete:Ce},gc=2,yc=48,qr=64,hc=5e4;function ju(e,t,n={}){let o=ne([...t.symbols??[],...t.locations??[]]),r=ne(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=bc(n.families,a),s=n.direction??"both",l=ne(n.subtypes??[]),d=n.connecting??!1,c=n.inventoryOnly??!1,u=ne(n.foldIds??[]),f=n.maxDepth??gc,m=n.maxEdges??yc;if(!Number.isSafeInteger(f)||f<0)throw new RangeError(`Evidence depth must be a non-negative safe integer; received ${f}.`);if(!Number.isSafeInteger(m)||m<=0)throw new RangeError(`Evidence max edges must be a positive safe integer; received ${m}.`);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 p=_r(e,{symbols:o,searches:r,maxDepth:f,maxTopologyCharacters:hc,relations:Sc(i)}),g=new Map(p.nodes.map($=>[$.id,$])),b=p.edges.filter($=>$.disposition==="emitted"||$.disposition==="folded").flatMap($=>vc($,g)),C=b.filter($=>i.includes($.family)).filter($=>l.length===0||l.includes($.subtype)),S=new Set(p.anchors.flatMap($=>$.nodeIds));if(d&&S.size<2)throw new Error("Connecting evidence requires at least two resolved root nodes.");let v=new Set(C.map($=>$.id)),R=Rn(b,S,"incoming").filter($=>v.has($.id)),y=Rn(b,S,"outgoing").filter($=>v.has($.id)),N=Rn(b,S,"both").filter($=>v.has($.id)),L=Ic(i,l,R,y,N),x=s==="incoming"?R:s==="outgoing"?y:N,M=d?Pc(x,[...S],s):x,h=kc(M,S,s),P=[...M].sort(($,B)=>$c($,B,h)),D=wc(P,m),O=Mc(D,u),w=c?[]:u.length>0?P.filter($=>O.has($.id)):P,T=u.length>0?w:w.slice(0,m),I=u.length>0||c?[]:D,_=Math.max(0,w.length-T.length),A=p.frontiers.filter($=>$.disposition==="unsupported").length,j=p.coverage.status==="incomplete"?"incomplete":_>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:p.anchors.map($=>({kind:$.kind,query:$.query,status:$.status,nodeIds:[...$.nodeIds],omittedCandidates:$.omittedCandidates})),inventory:L,edges:T,folds:I,coverage:{status:j,topologyStatus:p.coverage.status,scope:p.coverage.scope,maxDepth:f,maxEdges:m,matchedEdges:P.length,eligibleEdges:w.length,returnedEdges:T.length,omittedEdges:_,frontierGroups:p.frontiers.length,unsupportedFrontiers:A,blindSpots:ne([...p.coverage.blindSpots,...eo(i)]),explanation:c?`${P.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.`:j==="accounted"?"Every selected relationship in the bounded topology was emitted.":j==="bounded"?`${_} selected relationship(s) were withheld by the explicit edge budget.`:p.coverage.explanation}}}function bc(e,t){let n=e&&e.length>0?e:fc[t],o=n.filter(r=>!Ce.includes(r));if(o.length>0)throw new Error(`Unsupported graph evidence family: ${o.join(", ")}.`);return ne(n)}function Sc(e){return["call","contract-symbol","import","reference","runtime-boundary"]}function vc(e,t){let n=t.get(e.fromNodeId),o=t.get(e.toNodeId);return!n||!o?[]:(e.semantics??[]).flatMap((r,a)=>{let i=Ec(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=Lc(e);return s.relation.evidenceStrengths.includes(l)?[{id:`${e.id}:${a}:${i}`,family:i,semanticFamily:r.family,subtype:r.subtype,from:zr(n),to:zr(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:ne(e.evidence.map(d=>d.method)),evidenceConstituents:xc(e.evidence),context:r.context?{...r.context}:null,attributes:r.attributes?{...r.attributes}:null}]:[]})}function xc(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 Ec(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 zr(e){let t=Cc(e);return{id:e.id,kind:e.kind,label:t?ee(t):e.label,symbol:t,location:e.location?{...e.location}:null}}function Cc(e){return e.kind!=="symbol"||!e.id.startsWith("symbol:")?null:decodeURIComponent(e.id.slice(7))}function Lc(e){let t=ne(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 Rn(e,t,n){let o=Tn(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 Tn(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 Ic(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 m=`${f.family}\0${f.subtype}`;u.set(m,(u.get(m)??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)=>Ce.indexOf(c.family)-Ce.indexOf(u.family)||c.subtype.localeCompare(u.subtype))}function wc(e,t){let n=e.slice(t),o=new Map;for(let i of n){let s=Nc(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+=qr){let f=c.slice(u,u+qr),m=f.map(C=>C.id),p=ne(f.map(C=>C.subtype)).sort(),g=p.length===1?p[0]:"mixed",b=[...new Set(f.flatMap(C=>[C.from.id,C.to.id]))].sort();a.push({id:Fc(l,p.join("\0"),m),mode:Rc(f),family:l,subtype:g,subtypes:p,region:d,edgeCount:m.length,edgeIds:m,nodeIds:b,minimumMaxEdges:Math.max(...m.map(C=>r.get(C)??e.length))})}}return a.sort((i,s)=>Ce.indexOf(i.family)-Ce.indexOf(s.family)||(i.region??"").localeCompare(s.region??"")||i.id.localeCompare(s.id))}function Nc(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 Mc(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 Rc(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 Tc(o,t)?"scc":[...o].every(a=>(n.get(a)?.size??0)<=1&&(t.get(a)?.size??0)<=1)?"linear":"topology"}function Tc(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 Fc(e,t,n){return`fold:${mc("sha256").update([e,t,...n].join("\0")).digest("hex").slice(0,16)}`}function Pc(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 Ac(e,r[a],r[i],n))o.set(s.id,s);return[...o.values()]}function Ac(e,t,n,o){let r=Tn(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 kc(e,t,n){let o=Tn(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 $c(e,t,n){return Ur(e,n)-Ur(t,n)||Wr(e)-Wr(t)||Hr(e.evidenceStrength)-Hr(t.evidenceStrength)||Ce.indexOf(e.family)-Ce.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 Ur(e,t){return Math.min(t.get(e.from.id)??Number.MAX_SAFE_INTEGER,t.get(e.to.id)??Number.MAX_SAFE_INTEGER)}function Wr(e){let t=[e.from,e.to].filter(n=>n.kind==="structural-region").length;return t===2?2:t}function Hr(e){switch(e){case"exact":return 0;case"mixed":return 1;case"derived":return 2;case"candidate":return 3;case"unknown":return 4}}export{ju as a};
21
- //# sourceMappingURL=chunk-D2MVJSP4.js.map
@@ -1,2 +0,0 @@
1
- import{c as y}from"./chunk-PLYUVM4F.js";import{b as h,e as b}from"./chunk-5H5WTJSD.js";import{d as u,e as i,g as c}from"./chunk-TD7VKJ2Y.js";import{m}from"./chunk-42W3LFUK.js";import{z as l}from"./chunk-7JYHQAH2.js";import{basename as f}from"path";function g(t,o){let n=o.className,e=h(t,n);return e.match?e.total>1?{kind:"ambiguous",query:n,total:e.total,candidates:[p(e.match),...e.candidates]}:{kind:"matched",query:n,owner:L(e.match),methods:M(t,e.match)}:{kind:"missing",query:n,suggestions:b(t,n,5)}}function j(t,o){let n=g(t,{className:o});if(n.kind==="missing")throw new Error(`No class definition matched '${o}'.`);if(n.kind==="ambiguous"){let e=n.candidates.map(s=>`${s.relativePath}:${s.startLine+1}`).join(", ");throw new Error(`Class '${o}' is ambiguous across ${n.total} definitions (${e}). Qualify it with a path or exact SCIP symbol identity.`)}return n.methods}function M(t,o){let n=i(o.symbol),s=new y(t).definitionsForFile(o.relativePath).filter(r=>c(r.symbol)),a=s.filter(r=>r.parentTypeName===n||r.symbol.includes(n)),d=(a.length>0?a:S(f(o.relativePath))===n?s.filter(r=>r.symbol.includes("<invalid-global-code>")):[]).map(r=>({startLine:r.startLine,endLine:r.endLine,name:i(r.symbol)}));return l(o.relativePath)!=="clojure"?d:R(d,w(t,o))}function p(t){return{symbol:t.symbol,shortName:u(t.symbol),relativePath:t.relativePath,startLine:t.startLine}}function L(t){return{...p(t),endLine:t.endLine}}function S(t){return t.replace(/\.[^.]+$/,"")}function w(t,o){let n=i(o.symbol);return n?(m(t,o.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===n).map(e=>({startLine:e.startLine,endLine:e.endLine,name:e.memberName})):[]}function R(t,o){let n=new Map;for(let e of[...t,...o])n.set(`${e.name}:${e.startLine}:${e.endLine}`,e);return[...n.values()].sort((e,s)=>e.startLine-s.startLine||e.endLine-s.endLine)}export{g as a,j as b};
2
- //# sourceMappingURL=chunk-D35XIZGN.js.map