codebaseiq 0.1.0 → 0.2.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 (422) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/augment-vue-worker.js +1 -1
  3. package/dist/{chunk-DQMDCD24.js → chunk-27PHVDKL.js} +2 -2
  4. package/dist/{chunk-ZMI2JSX2.js → chunk-2DMVFAY7.js} +2 -2
  5. package/dist/{chunk-5PUWMSDU.js → chunk-2E6BTWER.js} +2 -2
  6. package/dist/{chunk-YESXMKX3.js → chunk-2F5ERMNI.js} +2 -2
  7. package/dist/chunk-2VKB5CMA.js +60 -0
  8. package/dist/{chunk-NNJ2KZZG.js → chunk-327YK6TB.js} +4 -4
  9. package/dist/chunk-347TXATM.js +2 -0
  10. package/dist/{chunk-VEXUL62T.js → chunk-35YYZD3D.js} +2 -2
  11. package/dist/chunk-36WRYYTE.js +3 -0
  12. package/dist/chunk-37TKC6MB.js +2 -0
  13. package/dist/{chunk-FAJQ7LWY.js → chunk-3AC56WAR.js} +2 -2
  14. package/dist/{chunk-JE3WZ6II.js → chunk-3NUZVLR7.js} +2 -2
  15. package/dist/{chunk-UZGZB3VB.js → chunk-3XFJUWJE.js} +2 -2
  16. package/dist/{chunk-OVTS4DKB.js → chunk-4AOOSCZ7.js} +2 -2
  17. package/dist/{chunk-LU3BMVH2.js → chunk-4IFISPQW.js} +2 -2
  18. package/dist/chunk-4NHWNAWQ.js +11 -0
  19. package/dist/chunk-4O52YNKL.js +5 -0
  20. package/dist/{chunk-HPJRBHVT.js → chunk-54K6556S.js} +2 -2
  21. package/dist/{chunk-HRWGYWRJ.js → chunk-57GCCPLS.js} +2 -2
  22. package/dist/{chunk-J77SU6VA.js → chunk-57KEZDPT.js} +2 -2
  23. package/dist/{chunk-OFBE4NGP.js → chunk-57KFVPVZ.js} +2 -2
  24. package/dist/{chunk-WOQBZPIF.js → chunk-5BDK6QC3.js} +2 -2
  25. package/dist/{chunk-7MGU3HPH.js → chunk-5IO2APSS.js} +2 -2
  26. package/dist/chunk-5NJPH3QZ.js +61 -0
  27. package/dist/{chunk-GW6Z3WGY.js → chunk-5WXOEJ4G.js} +2 -2
  28. package/dist/chunk-5XEVXVTK.js +3 -0
  29. package/dist/{chunk-RR7SX44N.js → chunk-6OVNYYY4.js} +2 -2
  30. package/dist/{chunk-ZV3JV5G5.js → chunk-6SDEQTVY.js} +2 -2
  31. package/dist/{chunk-EF2R3WNQ.js → chunk-6URCE5QY.js} +2 -2
  32. package/dist/{chunk-UCD3H3UZ.js → chunk-6ZV5EDUT.js} +2 -2
  33. package/dist/{chunk-C6SBF2WH.js → chunk-77GHPR2R.js} +2 -2
  34. package/dist/{chunk-YVCIMIOC.js → chunk-7R64XY4Y.js} +2 -2
  35. package/dist/{chunk-VXYS3FZD.js → chunk-7Z7HCZ7J.js} +2 -2
  36. package/dist/{chunk-CO5R3UNA.js → chunk-A67HT5FR.js} +2 -2
  37. package/dist/{chunk-UDS562V4.js → chunk-A7XQT7MH.js} +2 -2
  38. package/dist/{chunk-RDBI2RXU.js → chunk-ACZDU5GK.js} +2 -2
  39. package/dist/{chunk-FETNQCFO.js → chunk-AM5SUGHF.js} +2 -2
  40. package/dist/{chunk-NNOKTMZT.js → chunk-B2E3HZ2A.js} +2 -2
  41. package/dist/{chunk-CVYSU6BX.js → chunk-BH5CE4LN.js} +2 -2
  42. package/dist/chunk-BLKYYQ7C.js +543 -0
  43. package/dist/{chunk-4WKDMDEW.js → chunk-BX2U3QQV.js} +2 -2
  44. package/dist/{chunk-ZKX2FRS6.js → chunk-CANBLFVQ.js} +2 -2
  45. package/dist/{chunk-SMRBZ6EC.js → chunk-CCRZLRWJ.js} +2 -2
  46. package/dist/chunk-CDWSLAPN.js +21 -0
  47. package/dist/chunk-CIVYHK7U.js +22 -0
  48. package/dist/{chunk-L57ZKWVG.js → chunk-CMXW7MFV.js} +2 -2
  49. package/dist/{chunk-T3DGWPXM.js → chunk-CSZOQ7YO.js} +2 -2
  50. package/dist/{chunk-ZZXSWSN6.js → chunk-CWMHWD56.js} +2 -2
  51. package/dist/{chunk-6NW7MU72.js → chunk-CZEIHYMP.js} +2 -2
  52. package/dist/{chunk-DO6WQD2T.js → chunk-D62CTZX6.js} +2 -2
  53. package/dist/{chunk-XWUOUWYI.js → chunk-DFPAZXLU.js} +2 -2
  54. package/dist/{chunk-MOVBWNIP.js → chunk-DKJXK3HA.js} +2 -2
  55. package/dist/{chunk-XMQ23E27.js → chunk-DLC6JDN7.js} +2 -2
  56. package/dist/chunk-DUKHVPU5.js +4 -0
  57. package/dist/{chunk-ID63777H.js → chunk-DVYG3JTA.js} +2 -2
  58. package/dist/{chunk-NE6IU5ZD.js → chunk-EFFMFK7C.js} +2 -2
  59. package/dist/{chunk-I2T2LLK2.js → chunk-EM5UHLAM.js} +2 -2
  60. package/dist/chunk-EN4AHLL3.js +3 -0
  61. package/dist/chunk-EXMVF3JR.js +3 -0
  62. package/dist/{chunk-SWHMHUKF.js → chunk-FEBLLMTL.js} +2 -2
  63. package/dist/chunk-FIXYHQ3W.js +3 -0
  64. package/dist/{chunk-RKEJ6VTF.js → chunk-FLLXYUOL.js} +2 -2
  65. package/dist/{chunk-KWVHSKHK.js → chunk-FPDL2TUB.js} +2 -2
  66. package/dist/chunk-FQA3KIFX.js +17 -0
  67. package/dist/chunk-FWY2PRIF.js +3 -0
  68. package/dist/chunk-FY5V4V4F.js +2 -0
  69. package/dist/chunk-G2XUZCF2.js +88 -0
  70. package/dist/{chunk-QHRNXP3C.js → chunk-GXVDTHFC.js} +2 -2
  71. package/dist/{chunk-6MUIJMVL.js → chunk-H3CKAL6P.js} +2 -2
  72. package/dist/chunk-H5QXP63L.js +2 -0
  73. package/dist/{chunk-VUIYB2V3.js → chunk-HBQGKMM3.js} +2 -2
  74. package/dist/{chunk-PYAB5SM6.js → chunk-HBXZAGY6.js} +2 -2
  75. package/dist/{chunk-NNO6A2PO.js → chunk-HCMQZPEO.js} +2 -2
  76. package/dist/{chunk-Q65CQ4XL.js → chunk-HHBBGWES.js} +2 -2
  77. package/dist/{chunk-GTXSJDCO.js → chunk-HIEXRDJF.js} +2 -2
  78. package/dist/{chunk-4FC325IF.js → chunk-HYKSLTAR.js} +2 -2
  79. package/dist/{chunk-XLQ3GLWZ.js → chunk-I2KP4AGR.js} +2 -2
  80. package/dist/chunk-I5FCDTK2.js +2 -0
  81. package/dist/{chunk-QKPLA6IC.js → chunk-I645ZF75.js} +2 -2
  82. package/dist/{chunk-FDGD5AB5.js → chunk-IBM3F2BJ.js} +2 -2
  83. package/dist/{chunk-Q72QSKXC.js → chunk-IEL6Q5W3.js} +38 -38
  84. package/dist/{chunk-NCZUNH3E.js → chunk-IGQQUENU.js} +12 -12
  85. package/dist/chunk-IGYAZPRX.js +4 -0
  86. package/dist/chunk-IOVPAZWP.js +3 -0
  87. package/dist/{chunk-OL6KJP3N.js → chunk-IVJJNVSX.js} +2 -2
  88. package/dist/{chunk-AKB7V7TV.js → chunk-IWAMYGPN.js} +2 -2
  89. package/dist/chunk-IYBIBMPF.js +90 -0
  90. package/dist/{chunk-IOP6FWIM.js → chunk-J24VICI5.js} +2 -2
  91. package/dist/{chunk-C7QOQX32.js → chunk-JN5LIBT3.js} +2 -2
  92. package/dist/{chunk-O6QTXQPJ.js → chunk-JOALNFY3.js} +2 -2
  93. package/dist/{chunk-GCHRX4YW.js → chunk-JUO3Z644.js} +2 -2
  94. package/dist/{chunk-BJ6SQAEN.js → chunk-JXHLB7TP.js} +2 -2
  95. package/dist/{chunk-IJ4HMYBE.js → chunk-JYX5UZSZ.js} +2 -2
  96. package/dist/chunk-K2O7SBAU.js +2 -0
  97. package/dist/{chunk-OLF4MA5W.js → chunk-K5G7SPAG.js} +2 -2
  98. package/dist/{chunk-YSNONTJ2.js → chunk-KDYQQJ6X.js} +2 -2
  99. package/dist/{chunk-7NVGT435.js → chunk-KM4QRWI5.js} +2 -2
  100. package/dist/{chunk-HKQUXIFO.js → chunk-KNV5VFDV.js} +2 -2
  101. package/dist/chunk-L3YSDLNB.js +2 -0
  102. package/dist/{chunk-EZNMUY67.js → chunk-LAGDJXFY.js} +2 -2
  103. package/dist/{chunk-ENCCHKM6.js → chunk-LY2NB5XR.js} +4 -4
  104. package/dist/chunk-M4EVGA5S.js +14 -0
  105. package/dist/chunk-M7LAIM77.js +127 -0
  106. package/dist/{chunk-BVAJLC5A.js → chunk-MRGTCMDK.js} +2 -2
  107. package/dist/{chunk-OZYRSMSH.js → chunk-MT5W4DUG.js} +2 -2
  108. package/dist/{chunk-VE5AVNMP.js → chunk-MTMF4N7F.js} +2 -2
  109. package/dist/chunk-N3Q3AWGW.js +545 -0
  110. package/dist/{chunk-TXXOEMZJ.js → chunk-NDGTJHQN.js} +2 -2
  111. package/dist/chunk-NIO346UL.js +2 -0
  112. package/dist/chunk-NJA4MMBD.js +2 -0
  113. package/dist/{chunk-7FND7D7N.js → chunk-NK76RSB6.js} +2 -2
  114. package/dist/{chunk-H3LGFZVK.js → chunk-NTRW52UR.js} +2 -2
  115. package/dist/{chunk-JOIRNPPY.js → chunk-OJFLPVBP.js} +2 -2
  116. package/dist/{chunk-KMITESMT.js → chunk-OMBRP7BB.js} +2 -2
  117. package/dist/{chunk-UP3BUZR5.js → chunk-OVKZM2XI.js} +2 -2
  118. package/dist/{chunk-MVB3DAEY.js → chunk-PARCKE3Q.js} +2 -2
  119. package/dist/{chunk-CAUCPUOF.js → chunk-PFPHS4NO.js} +2 -2
  120. package/dist/chunk-PHPQ24UG.js +22 -0
  121. package/dist/chunk-PLZXWZHY.js +77 -0
  122. package/dist/{chunk-34WBMAYK.js → chunk-PNVZIJ57.js} +2 -2
  123. package/dist/{chunk-SYDJMPES.js → chunk-QKVTWODE.js} +2 -2
  124. package/dist/{chunk-FW53T7EB.js → chunk-QLTFXVUI.js} +2 -2
  125. package/dist/{chunk-PBI2LFKH.js → chunk-QMGWSEPL.js} +2 -2
  126. package/dist/{chunk-CQP3THUZ.js → chunk-QVHZB75Z.js} +2 -2
  127. package/dist/{chunk-6BQ3DSPK.js → chunk-QVWDQTMG.js} +2 -2
  128. package/dist/{chunk-ST7V3SKN.js → chunk-RCPZOPV6.js} +2 -2
  129. package/dist/chunk-RJWAB4VR.js +345 -0
  130. package/dist/chunk-RRPK327J.js +20 -0
  131. package/dist/chunk-RVYLJDXC.js +21 -0
  132. package/dist/chunk-RWKEXCHU.js +3 -0
  133. package/dist/{chunk-L4NRUAGJ.js → chunk-S5SKXCND.js} +2 -2
  134. package/dist/{chunk-RBAS5ZHI.js → chunk-S64NCE2Z.js} +2 -2
  135. package/dist/{chunk-WMPRTGH2.js → chunk-SF34QLK2.js} +2 -2
  136. package/dist/{chunk-ANFVSJWQ.js → chunk-SJZQ2PTZ.js} +2 -2
  137. package/dist/{chunk-4XTAUQFD.js → chunk-SRY26ITJ.js} +2 -2
  138. package/dist/chunk-SV2LEFVM.js +2 -0
  139. package/dist/{chunk-7XAN6GKB.js → chunk-T3YFIJ5P.js} +2 -2
  140. package/dist/chunk-T55YPJGB.js +3 -0
  141. package/dist/chunk-TAJ6UGCO.js +21 -0
  142. package/dist/{chunk-PIOMTC27.js → chunk-TUTSO7UZ.js} +2 -2
  143. package/dist/{chunk-FQKZWM4L.js → chunk-U24M5RQM.js} +5 -5
  144. package/dist/{chunk-XME3HPXZ.js → chunk-U2XX3BT4.js} +2 -2
  145. package/dist/{chunk-SZD2KF7Q.js → chunk-UWB5WMC2.js} +2 -2
  146. package/dist/{chunk-6CS3UQTN.js → chunk-VCL7FK3E.js} +2 -2
  147. package/dist/{chunk-N3IQCBCF.js → chunk-VCWAJPXQ.js} +2 -2
  148. package/dist/{chunk-LZYFLFEH.js → chunk-VG55NFXF.js} +2 -2
  149. package/dist/{chunk-PTAWHLVJ.js → chunk-VLTUX4IF.js} +2 -2
  150. package/dist/{chunk-JEJLSICM.js → chunk-VVCBMH5O.js} +2 -2
  151. package/dist/{chunk-JSOYNVWH.js → chunk-VYZQZ4ZN.js} +2 -2
  152. package/dist/chunk-W3FK73MD.js +8 -0
  153. package/dist/{chunk-UNBY47BC.js → chunk-W6C6QTXJ.js} +2 -2
  154. package/dist/chunk-WH5SYOMD.js +2 -0
  155. package/dist/chunk-WJOQC4P7.js +7 -0
  156. package/dist/chunk-WO47BIPY.js +3 -0
  157. package/dist/chunk-WOOTEWQT.js +239 -0
  158. package/dist/{chunk-UBGWN7I4.js → chunk-X5I2BQGX.js} +2 -2
  159. package/dist/{chunk-PX4RYAAK.js → chunk-XNUWRTYM.js} +2 -2
  160. package/dist/{chunk-ICFDQHAM.js → chunk-XUJM6474.js} +2 -2
  161. package/dist/chunk-XYLV727H.js +21 -0
  162. package/dist/{chunk-TRRC4ZJ7.js → chunk-YFQPWKHR.js} +2 -2
  163. package/dist/{chunk-NEDP5RFQ.js → chunk-YIOQJ45A.js} +2 -2
  164. package/dist/{chunk-Y6KHROC3.js → chunk-YXJ4IAHH.js} +2 -2
  165. package/dist/chunk-YYFV32WR.js +3 -0
  166. package/dist/{chunk-BH5F2Q4O.js → chunk-ZB3V5QM7.js} +2 -2
  167. package/dist/chunk-ZJZQ7Q2Q.js +3 -0
  168. package/dist/{chunk-EMNIHCRB.js → chunk-ZNQCR656.js} +2 -2
  169. package/dist/{chunk-TIIC3ZE7.js → chunk-ZOEDRCR4.js} +2 -2
  170. package/dist/cli-context-TSADTXLB.js +2 -0
  171. package/dist/cli-context-XEPPF4RX.js +3 -0
  172. package/dist/cli-program-KJGQEM72.js +7 -0
  173. package/dist/cli.js +1 -1
  174. package/dist/{code-DlqpBDd0.d.ts → code-CDe-mIjx.d.ts} +1 -1
  175. package/dist/code-viewer-YGDON6SY.js +12 -0
  176. package/dist/code-viewer-ZCTHXQ5C.js +11 -0
  177. package/dist/command-descriptors-5VAB2MZX.js +335 -0
  178. package/dist/command-descriptors-EAHKIRAG.js +337 -0
  179. package/dist/{config-types-BNoC96J3.d.ts → config-types-D6X5S68_.d.ts} +50 -0
  180. package/dist/{db-D7sauVFH.d.ts → db-DmRNdCtm.d.ts} +1 -1
  181. package/dist/direct-navigation-B3SGOOBW.js +2 -0
  182. package/dist/direct-navigation-ZL362KXF.js +3 -0
  183. package/dist/{graph-evidence-BIFqyisO.d.ts → graph-evidence-Bs54NWws.d.ts} +1 -1
  184. package/dist/{health-DJaZXg8I.d.ts → health-BnzbSLCE.d.ts} +1 -1
  185. package/dist/index.d.ts +2 -2
  186. package/dist/index.js +1 -1
  187. package/dist/invocation-command-descriptors-CSUGUHTT.js +2 -0
  188. package/dist/invocation-command-descriptors-PPVZOIE5.js +3 -0
  189. package/dist/output-continuation-command-FTVVBVSN.js +2 -0
  190. package/dist/output-continuation-command-ITPRC3YV.js +3 -0
  191. package/dist/project-reindex-7HZSLLLY.js +3 -0
  192. package/dist/project-reindex-NGM3DYBN.js +2 -0
  193. package/dist/queries/affected.d.ts +2 -2
  194. package/dist/queries/affected.js +1 -1
  195. package/dist/queries/anchors.d.ts +2 -2
  196. package/dist/queries/anchors.js +1 -1
  197. package/dist/queries/architecture.d.ts +2 -2
  198. package/dist/queries/architecture.js +1 -1
  199. package/dist/queries/bottlenecks.d.ts +2 -2
  200. package/dist/queries/bottlenecks.js +1 -1
  201. package/dist/queries/by-kind.d.ts +2 -2
  202. package/dist/queries/by-kind.js +1 -1
  203. package/dist/queries/call-graph.d.ts +2 -2
  204. package/dist/queries/call-graph.js +1 -1
  205. package/dist/queries/change-surface.d.ts +2 -2
  206. package/dist/queries/change-surface.js +1 -1
  207. package/dist/queries/cleanup-plan.d.ts +2 -2
  208. package/dist/queries/cleanup-plan.js +1 -1
  209. package/dist/queries/co-change.d.ts +2 -2
  210. package/dist/queries/co-change.js +1 -1
  211. package/dist/queries/code.d.ts +3 -3
  212. package/dist/queries/code.js +1 -1
  213. package/dist/queries/complexity-hotspots.d.ts +2 -2
  214. package/dist/queries/complexity-hotspots.js +1 -1
  215. package/dist/queries/complexity.d.ts +2 -2
  216. package/dist/queries/complexity.js +1 -1
  217. package/dist/queries/context.d.ts +2 -2
  218. package/dist/queries/context.js +1 -1
  219. package/dist/queries/convergence.d.ts +2 -2
  220. package/dist/queries/convergence.js +1 -1
  221. package/dist/queries/coupling.d.ts +2 -2
  222. package/dist/queries/coupling.js +1 -1
  223. package/dist/queries/cycles.d.ts +2 -2
  224. package/dist/queries/cycles.js +1 -1
  225. package/dist/queries/dataflow.d.ts +2 -2
  226. package/dist/queries/dataflow.js +1 -1
  227. package/dist/queries/dead.d.ts +2 -2
  228. package/dist/queries/dead.js +1 -1
  229. package/dist/queries/decorative-checkers.d.ts +2 -2
  230. package/dist/queries/decorative-checkers.js +1 -1
  231. package/dist/queries/deep-chains.d.ts +2 -2
  232. package/dist/queries/deep-chains.js +1 -1
  233. package/dist/queries/dependence-slice.d.ts +3 -3
  234. package/dist/queries/dependence-slice.js +1 -1
  235. package/dist/queries/dependency-depth.d.ts +2 -2
  236. package/dist/queries/dependency-depth.js +1 -1
  237. package/dist/queries/deps.d.ts +2 -2
  238. package/dist/queries/deps.js +1 -1
  239. package/dist/queries/diff-impact.d.ts +2 -2
  240. package/dist/queries/diff-impact.js +1 -1
  241. package/dist/queries/doc-drift.d.ts +2 -2
  242. package/dist/queries/doc-drift.js +1 -1
  243. package/dist/queries/drift.d.ts +2 -2
  244. package/dist/queries/drift.js +1 -1
  245. package/dist/queries/duplicate-bodies.d.ts +2 -2
  246. package/dist/queries/duplicate-bodies.js +1 -1
  247. package/dist/queries/entry-map.d.ts +2 -2
  248. package/dist/queries/entry-map.js +1 -1
  249. package/dist/queries/evidence.d.ts +3 -3
  250. package/dist/queries/evidence.js +1 -1
  251. package/dist/queries/extract-candidates.d.ts +2 -2
  252. package/dist/queries/extract-candidates.js +1 -1
  253. package/dist/queries/fan.d.ts +2 -2
  254. package/dist/queries/fan.js +1 -1
  255. package/dist/queries/files.d.ts +2 -2
  256. package/dist/queries/files.js +1 -1
  257. package/dist/queries/health.d.ts +3 -3
  258. package/dist/queries/health.js +1 -1
  259. package/dist/queries/hierarchy.d.ts +2 -2
  260. package/dist/queries/hierarchy.js +1 -1
  261. package/dist/queries/hotspots.d.ts +2 -2
  262. package/dist/queries/hotspots.js +1 -1
  263. package/dist/queries/imports.d.ts +2 -2
  264. package/dist/queries/imports.js +1 -1
  265. package/dist/queries/incomplete-migration.d.ts +2 -2
  266. package/dist/queries/incomplete-migration.js +1 -1
  267. package/dist/queries/index.d.ts +5 -5
  268. package/dist/queries/index.js +1 -1
  269. package/dist/queries/isolated.d.ts +2 -2
  270. package/dist/queries/isolated.js +1 -1
  271. package/dist/queries/locality-candidates.d.ts +2 -2
  272. package/dist/queries/locality-candidates.js +1 -1
  273. package/dist/queries/members.d.ts +2 -2
  274. package/dist/queries/members.js +1 -1
  275. package/dist/queries/methods.d.ts +2 -2
  276. package/dist/queries/methods.js +1 -1
  277. package/dist/queries/not-implemented.d.ts +2 -2
  278. package/dist/queries/not-implemented.js +1 -1
  279. package/dist/queries/outline.d.ts +2 -2
  280. package/dist/queries/outline.js +1 -1
  281. package/dist/queries/passthrough-candidates.d.ts +2 -2
  282. package/dist/queries/passthrough-candidates.js +1 -1
  283. package/dist/queries/plan-context.d.ts +2 -2
  284. package/dist/queries/plan-context.js +1 -1
  285. package/dist/queries/react-component-duplicates.d.ts +2 -2
  286. package/dist/queries/react-component-duplicates.js +1 -1
  287. package/dist/queries/react-hook-candidates.d.ts +2 -2
  288. package/dist/queries/react-hook-candidates.js +1 -1
  289. package/dist/queries/react-large-component-pressure.d.ts +2 -2
  290. package/dist/queries/react-large-component-pressure.js +1 -1
  291. package/dist/queries/recent-duplicates.d.ts +2 -2
  292. package/dist/queries/recent-duplicates.js +1 -1
  293. package/dist/queries/redundant-reexports.d.ts +2 -2
  294. package/dist/queries/redundant-reexports.js +1 -1
  295. package/dist/queries/reference-neighborhood.d.ts +2 -2
  296. package/dist/queries/reference-neighborhood.js +1 -1
  297. package/dist/queries/reference-reachability.d.ts +2 -2
  298. package/dist/queries/reference-reachability.js +1 -1
  299. package/dist/queries/refs.d.ts +2 -2
  300. package/dist/queries/refs.js +1 -1
  301. package/dist/queries/self-audit.d.ts +2 -2
  302. package/dist/queries/self-audit.js +1 -1
  303. package/dist/queries/similar-chains.d.ts +2 -2
  304. package/dist/queries/similar-chains.js +1 -1
  305. package/dist/queries/similar-files.d.ts +2 -2
  306. package/dist/queries/similar-files.js +1 -1
  307. package/dist/queries/similar-signatures.d.ts +2 -2
  308. package/dist/queries/similar-signatures.js +1 -1
  309. package/dist/queries/similar.d.ts +2 -2
  310. package/dist/queries/similar.js +1 -1
  311. package/dist/queries/slice.d.ts +2 -2
  312. package/dist/queries/slice.js +1 -1
  313. package/dist/queries/source-inspection.d.ts +4 -4
  314. package/dist/queries/source-inspection.js +1 -1
  315. package/dist/queries/source-search.d.ts +2 -2
  316. package/dist/queries/source-search.js +1 -1
  317. package/dist/queries/stale-abstractions.d.ts +2 -2
  318. package/dist/queries/stale-abstractions.js +1 -1
  319. package/dist/queries/stats.d.ts +2 -2
  320. package/dist/queries/surface.d.ts +2 -2
  321. package/dist/queries/surface.js +1 -1
  322. package/dist/queries/symbols.d.ts +2 -2
  323. package/dist/queries/symbols.js +1 -1
  324. package/dist/queries/system-map.d.ts +2 -2
  325. package/dist/queries/system-map.js +1 -1
  326. package/dist/queries/system.d.ts +2 -2
  327. package/dist/queries/system.js +1 -1
  328. package/dist/queries/test-quality.d.ts +2 -2
  329. package/dist/queries/test-quality.js +1 -1
  330. package/dist/queries/trace.d.ts +2 -2
  331. package/dist/queries/trace.js +1 -1
  332. package/dist/queries/twin-ab.d.ts +2 -2
  333. package/dist/queries/twin-ab.js +1 -1
  334. package/dist/queries/twin-drift.d.ts +2 -2
  335. package/dist/queries/twin-drift.js +1 -1
  336. package/dist/queries/unused-imports.d.ts +2 -2
  337. package/dist/queries/unused-imports.js +1 -1
  338. package/dist/queries/unused-params.d.ts +2 -2
  339. package/dist/queries/unused-params.js +1 -1
  340. package/dist/queries/value-flow.d.ts +3 -3
  341. package/dist/queries/value-flow.js +1 -1
  342. package/dist/queries/vue-component-duplicates.d.ts +2 -2
  343. package/dist/queries/vue-component-duplicates.js +1 -1
  344. package/dist/queries/vue-composable-candidates.d.ts +2 -2
  345. package/dist/queries/vue-composable-candidates.js +1 -1
  346. package/dist/queries/vue-large-view-pressure.d.ts +2 -2
  347. package/dist/queries/vue-large-view-pressure.js +1 -1
  348. package/dist/queries/wrapper-candidates.d.ts +2 -2
  349. package/dist/queries/wrapper-candidates.js +1 -1
  350. package/dist/reindex-worker.js +1 -1
  351. package/dist/reindex.d.ts +3 -3
  352. package/dist/reindex.js +31 -31
  353. package/dist/runtime.d.ts +24 -4
  354. package/dist/runtime.js +3 -3
  355. package/dist/rust-semantic-session-server.js +1 -1
  356. package/dist/rust-semantic-session-worker.js +1 -1
  357. package/dist/rust-semantic-worker.js +1 -1
  358. package/dist/{scip-cli-B7N3haxa.d.ts → scip-cli-BRFKkHQn.d.ts} +1 -1
  359. package/dist/sentinel-ensure-command-KYYULCFU.js +2 -0
  360. package/dist/sentinel-ensure-command-RIZA3RY7.js +3 -0
  361. package/dist/sentinel-hook.js +39 -0
  362. package/dist/sentinel-worker.js +16 -0
  363. package/dist/typescript-mailbox-worker.js +1 -1
  364. package/dist/watch-server.js +6 -6
  365. package/docs/COMMAND_REFERENCE.md +5 -3
  366. package/docs/schemas/project-config.schema.json +159 -0
  367. package/package.json +9 -5
  368. package/skills/codebaseiq/SKILL.md +1 -1
  369. package/skills/concrete-plan/SKILL.md +1 -1
  370. package/ui/view/api.js +450 -0
  371. package/ui/view/app.js +394 -0
  372. package/ui/view/builder.js +323 -0
  373. package/ui/view/file-panel.js +170 -0
  374. package/ui/view/focus.js +379 -0
  375. package/ui/view/index.html +54 -0
  376. package/ui/view/map.js +424 -0
  377. package/ui/view/styles.css +1125 -0
  378. package/dist/chunk-2X7V4HS4.js +0 -88
  379. package/dist/chunk-3IER7Q6H.js +0 -12
  380. package/dist/chunk-3JSXXYTZ.js +0 -345
  381. package/dist/chunk-476NR5B7.js +0 -2
  382. package/dist/chunk-5VKBFZZU.js +0 -3
  383. package/dist/chunk-ADTBPVUZ.js +0 -21
  384. package/dist/chunk-BFFZDZQV.js +0 -2
  385. package/dist/chunk-BMYOV5GP.js +0 -77
  386. package/dist/chunk-C74PPYLA.js +0 -3
  387. package/dist/chunk-CWONGW6P.js +0 -3
  388. package/dist/chunk-DDZ7VHWV.js +0 -20
  389. package/dist/chunk-DR2LURYU.js +0 -3
  390. package/dist/chunk-ECQBG7PW.js +0 -564
  391. package/dist/chunk-FM5BPL4V.js +0 -60
  392. package/dist/chunk-G6XFR4ZL.js +0 -4
  393. package/dist/chunk-GTIYTDRE.js +0 -562
  394. package/dist/chunk-HOA5YGOH.js +0 -3
  395. package/dist/chunk-KUW32IRO.js +0 -2
  396. package/dist/chunk-LTA3BRZX.js +0 -2
  397. package/dist/chunk-NAUD7LCA.js +0 -2
  398. package/dist/chunk-OGTFJ3XD.js +0 -2
  399. package/dist/chunk-Q5ELPRKQ.js +0 -2
  400. package/dist/chunk-QCN62RTF.js +0 -3
  401. package/dist/chunk-QW7EP6WI.js +0 -21
  402. package/dist/chunk-RU65DDUP.js +0 -215
  403. package/dist/chunk-SELM5MER.js +0 -2
  404. package/dist/chunk-SNNWPCN7.js +0 -4
  405. package/dist/chunk-TFZB6XTM.js +0 -239
  406. package/dist/chunk-UXM43C7T.js +0 -3
  407. package/dist/chunk-VFY6Y2H6.js +0 -61
  408. package/dist/chunk-WE5RZHZ7.js +0 -5
  409. package/dist/chunk-Z54RD7VL.js +0 -3
  410. package/dist/cli-context-3SNLDYBM.js +0 -3
  411. package/dist/cli-context-T3B7W6GG.js +0 -2
  412. package/dist/cli-program-YNOXO72B.js +0 -7
  413. package/dist/command-descriptors-6AOUKWW7.js +0 -346
  414. package/dist/command-descriptors-ZFKJSRUP.js +0 -344
  415. package/dist/direct-navigation-DP4LVMRX.js +0 -3
  416. package/dist/direct-navigation-FLUS3BT6.js +0 -2
  417. package/dist/invocation-command-descriptors-QT2JMY5J.js +0 -3
  418. package/dist/invocation-command-descriptors-YN4QJEAX.js +0 -2
  419. package/dist/output-continuation-command-2V2SL4TD.js +0 -2
  420. package/dist/output-continuation-command-65J5IP3O.js +0 -3
  421. package/dist/project-reindex-5JOKXAXT.js +0 -2
  422. package/dist/project-reindex-UQBIKO4M.js +0 -3
@@ -1,4 +1,4 @@
1
- import{a as Vt,b as Ht}from"./chunk-7MGU3HPH.js";import{A as rn,D,E as on,F as U,P as ne,Q as A,T as Te,V as ke,Y as $e,Z as an,a as pe,aa as W,ba as X,c as Qt,ea as ie,ga as C,i as Jt,j as Yt,k as Pe,na as oe,oa as Ae,p as L,u as tn,v as nn,z as Be}from"./chunk-RU65DDUP.js";import{a as Wt,d as Kt}from"./chunk-QW7EP6WI.js";import{a as $,b as Ee,e as Le,f as en,i as z}from"./chunk-3IER7Q6H.js";import{b as fe,c as re,d as M,f as lt,g as ct,h as sn}from"./chunk-DRENNWRG.js";import{b as zt,e as S,h as Ut}from"./chunk-RDBI2RXU.js";import{i as Z}from"./chunk-R2NOK63J.js";import{a as jt}from"./chunk-EF2R3WNQ.js";import{A as Xt,B as te,h as Ot,n as qt,o as Gt,z as Zt}from"./chunk-WE5RZHZ7.js";import{join as De}from"path";var Za=6,Xa=5e3,Sr="watch.lock",br="watch-state.json",vr="watch-activity.json",xr="watch-refresh-requests";function Qa(e){return{lockPath:De(e,Sr),statePath:De(e,br),activityPath:De(e,vr),refreshRequestsPath:De(e,xr)}}function Ja(e){try{return Rr(JSON.parse(Ot(e,"watch service state")))}catch{return null}}function Rr(e){if(!e||typeof e!="object")return null;let t=e;if(t.version!==1||typeof t.protocolVersion!="number"||typeof t.pid!="number"||!Number.isInteger(t.pid)||t.pid<=0||typeof t.projectRoot!="string"||t.worktreeId!==void 0&&(typeof t.worktreeId!="string"||t.worktreeId.length===0)||typeof t.cliVersion!="string"||!E(t.startedAt)||!E(t.heartbeatAt)||!E(t.lastActivityAt)||!Ir(t.watcher)||t.idleDeadlineAt!==void 0&&!E(t.idleDeadlineAt))return null;if(t.processIdentity!==void 0){let n=jt(t.processIdentity);if(!n||n.pid!==t.pid)return null;t.processIdentity=n}return t.indexGeneration!==void 0&&!/^[a-f0-9]{64}$/.test(t.indexGeneration)||t.lastError!==void 0&&!wr(t.lastError)||t.lastRefresh!==void 0&&!Nr(t.lastRefresh)||t.reindexActivity!==void 0&&!Cr(t.reindexActivity)||t.refreshRequests!==void 0&&!_r(t.refreshRequests)||t.typescriptSemantic!==void 0&&!Er(t.typescriptSemantic)||t.typescriptIndex!==void 0&&!Pr(t.typescriptIndex)||t.queryLane!==void 0&&!Lr(t.queryLane)?null:t}function E(e){return zt(e)}function Ir(e){if(!e||typeof e!="object"||!("state"in e))return!1;let t=e;switch(t.state){case"idle":return!0;case"waiting":return B(t.changedFiles)&&B(t.reindexAt);case"indexing":return B(t.startedAt);case"cooldown":return B(t.until)&&typeof t.dirty=="boolean";case"budget-paused":return B(t.until)&&typeof t.dirty=="boolean"&&typeof t.reason=="string"&&S(t.rebuilt)&&S(t.estimatedWriteBytes);case"draining":return B(t.startedAt)&&typeof t.reason=="string";default:return!1}}function wr(e){if(!e||typeof e!="object")return!1;let t=e;return E(t.at)&&typeof t.message=="string"}function Nr(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.trigger?.kind=="string"&&typeof t.result=="string"&&E(t.startedAt)&&E(t.completedAt)&&B(t.durationMs)}function Cr(e){if(!e||typeof e!="object")return!1;let t=e;return t.confidence!==void 0&&t.confidence!=="complete"&&t.confidence!=="partial"&&t.confidence!=="unavailable"||t.recordsRead!==void 0&&!S(t.recordsRead)||t.invalidRecords!==void 0&&!S(t.invalidRecords)||t.skippedRecords!==void 0&&!S(t.skippedRecords)||t.readErrors!==void 0&&!S(t.readErrors)||t.ignoredPartialTailBytes!==void 0&&!S(t.ignoredPartialTailBytes)||!E(t.windowStartedAt)||!E(t.windowEndedAt)||!S(t.runs)||!S(t.rebuilt)||!S(t.reused)||!S(t.failed)||!S(t.suppressed)||!B(t.estimatedLogicalOutputBytes)||t.estimatedWriteBytes!==void 0&&!S(t.estimatedWriteBytes)||t.reflinkedBytes!==void 0&&!S(t.reflinkedBytes)||t.fallbackCopiedBytes!==void 0&&!S(t.fallbackCopiedBytes)||t.oldestRebuildAt!==void 0&&!E(t.oldestRebuildAt)||t.oldestWriteAt!==void 0&&!E(t.oldestWriteAt)||t.languageAttribution!==void 0&&t.languageAttribution!=="complete"&&t.languageAttribution!=="partial"&&t.languageAttribution!=="unavailable"||t.attributedRuns!==void 0&&!S(t.attributedRuns)||t.unattributedRuns!==void 0&&!S(t.unattributedRuns)||t.invalidLanguageDetails!==void 0&&!S(t.invalidLanguageDetails)||t.estimatedLogicalOutputBytes<0||!t.byTrigger||typeof t.byTrigger!="object"||Array.isArray(t.byTrigger)||t.byLanguage!==void 0&&!Fr(t.byLanguage)?!1:Object.values(t.byTrigger).every(n=>n===void 0||S(n))}function Fr(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;for(let[t,n]of Object.entries(e)){if(!Wt.includes(t)||!n||typeof n!="object")return!1;let r=n;if(!S(r.runs)||!S(r.rebuilt)||!S(r.reused)||!S(r.producedOutputBytes)||!Ut(r.durationMs)||r.rebuilt+r.reused!==r.runs)return!1}return!0}function _r(e){if(!e||typeof e!="object")return!1;let t=e;return S(t.pending)&&S(t.claimed)&&S(t.completed)&&S(t.expired)&&S(t.invalid)&&(t.oldestPendingAt===void 0||E(t.oldestPendingAt))}function Er(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.protocolVersion=="number"&&(t.state==="idle"||t.state==="ready"||t.state==="unavailable"||t.state==="error")&&B(t.requests)&&B(t.sessionsCreated)&&B(t.sessionsReused)&&B(t.sessionsRefreshed)&&B(t.sessionsReplaced)&&B(t.projectsCreated)&&(t.lastRequestAt===void 0||E(t.lastRequestAt))&&(t.lastError===void 0||typeof t.lastError=="string")&&(t.busyUntil===void 0||E(t.busyUntil))&&(t.mailbox===void 0||ln(t.mailbox))}function Pr(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.protocolVersion=="number"&&(t.state==="idle"||t.state==="ready"||t.state==="unavailable"||t.state==="error")&&S(t.requests)&&S(t.sessionsCreated)&&S(t.sessionsReplaced)&&S(t.initializations)&&S(t.programUpdates)&&S(t.documentsEmitted)&&S(t.documentsRemoved)&&(t.lastRequestAt===void 0||E(t.lastRequestAt))&&(t.lastDurationMs===void 0||B(t.lastDurationMs)&&t.lastDurationMs>=0)&&(t.lastError===void 0||typeof t.lastError=="string")&&(t.busyUntil===void 0||E(t.busyUntil))&&(t.mailbox===void 0||ln(t.mailbox))}function Lr(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.protocolVersion=="number"&&typeof t.socketPath=="string"&&t.socketPath.length>0&&S(t.requests)&&(t.lastRequestAt===void 0||E(t.lastRequestAt))&&(t.lastError===void 0||typeof t.lastError=="string")}function ln(e){if(!e||typeof e!="object")return!1;let t=e;return S(t.pending)&&S(t.inflight)&&S(t.responses)&&S(t.deadLetters)&&S(t.invalid)&&S(t.totalItems)&&B(t.totalBytes)&&t.totalBytes>=0&&t.totalItems===t.pending+t.inflight+t.responses+t.deadLetters&&(t.oldestPendingAt===void 0||E(t.oldestPendingAt))}function B(e){return typeof e=="number"&&Number.isFinite(e)}import{spawn as Br}from"child_process";import{platform as cn}from"os";import{performance as un}from"perf_hooks";var is={probe:1e4,git:3e4,analysis:18e4,install:3e5,indexer:6e5},ye=class extends Error{constructor(n,r,i,o={}){super(i,o.cause===void 0?void 0:{cause:o.cause});this.kind=n;this.label=r;this.name="BoundedProcessError",this.timedOut=o.timedOut??!1,this.reaped=o.reaped??!1,this.stdout=o.stdout??"",this.stderr=o.stderr??"",this.stdoutTruncated=o.stdoutTruncated??!1,this.stderrTruncated=o.stderrTruncated??!1}kind;label;timedOut;reaped;stdout;stderr;stdoutTruncated;stderrTruncated};function me(e,t){if(!Number.isFinite(e)||e<=0)throw new TypeError(`${t} must be a positive finite number.`)}function dn(e,t,n,r){let i=Math.max(0,r-n);i>0&&e.push(t.subarray(0,i))}function pn(e,t,n){let r=Buffer.concat([...e,t]);e.length=0,e.push(r.subarray(Math.max(0,r.length-n)))}function os(e){me(e.timeoutMs,"timeoutMs"),me(e.maxStdoutBytes,"maxStdoutBytes"),me(e.maxStderrBytes,"maxStderrBytes");let t=e.terminationGraceMs??1e3;me(t,"terminationGraceMs");let n=e.terminationForceMs??t;return me(n,"terminationForceMs"),new Promise((r,i)=>{let o=un.now(),a;try{let y=cn()!=="win32";a=Br(e.command,[...e.args??[]],{cwd:e.cwd,env:e.env,detached:y?!0:e.detached,stdio:["pipe","pipe","pipe"],windowsHide:!0})}catch(y){i(new ye("spawn",e.label,`${e.label} could not start.`,{cause:y,reaped:!0}));return}let s=[],l=[],c=0,u=0,d=!1,p=!1,f=null,m=!1,g=cn()!=="win32",b=a.pid===void 0?null:Vt(a.pid,g),h=()=>{clearTimeout(x),e.signal?.removeEventListener("abort",w)},v=y=>{if(m||!f)return;m=!0,h();let R=Buffer.concat(s).toString("utf8"),I=Buffer.concat(l).toString("utf8"),_=y.reaped||!y.detail?"":` Process-tree cleanup failed: ${y.detail}`;i(new ye(f.kind,e.label,`${f.message}${_}`,{timedOut:f.timedOut,reaped:y.reaped,stdout:R,stderr:I,stdoutTruncated:d,stderrTruncated:p}))},F=y=>{if(!(f||m)){if(f=y,!b){v({reaped:a.pid===void 0,reason:a.pid===void 0?"terminated":"identity-unavailable"});return}Ht(b,{gracefulMs:t,forceMs:n}).then(v,R=>{v({reaped:!1,reason:"signal-failed",detail:R instanceof Error?R.message:String(R)})})}},x=setTimeout(()=>{F({kind:"timeout",timedOut:!0,message:`${e.label} timed out after ${e.timeoutMs}ms.`})},e.timeoutMs);x.unref();let w=()=>{F({kind:"aborted",timedOut:!1,message:`${e.label} was cancelled.`})};e.signal?.addEventListener("abort",w,{once:!0}),e.signal?.aborted&&w(),a.stdout.on("data",y=>{let R=Buffer.isBuffer(y)?y:Buffer.from(y);e.outputLimitBehavior==="truncate-tail"?pn(s,R,e.maxStdoutBytes):dn(s,R,c,e.maxStdoutBytes),c+=R.length,c>e.maxStdoutBytes&&(d=!0,e.outputLimitBehavior!=="truncate-tail"&&F({kind:"stdout-limit",timedOut:!1,message:`${e.label} exceeded stdout limit (${e.maxStdoutBytes} bytes).`}))}),a.stderr.on("data",y=>{let R=Buffer.isBuffer(y)?y:Buffer.from(y);e.outputLimitBehavior==="truncate-tail"?pn(l,R,e.maxStderrBytes):dn(l,R,u,e.maxStderrBytes),u+=R.length,u>e.maxStderrBytes&&(p=!0,e.outputLimitBehavior!=="truncate-tail"&&F({kind:"stderr-limit",timedOut:!1,message:`${e.label} exceeded stderr limit (${e.maxStderrBytes} bytes).`}))}),a.on("error",y=>{if(!m&&!f){if(a.pid===void 0){h(),m=!0,i(new ye("spawn",e.label,`${e.label} could not start: ${y.message}`,{cause:y,reaped:!0}));return}F({kind:"spawn",timedOut:!1,message:`${e.label} failed after start: ${y.message}`})}}),a.on("close",(y,R)=>{if(m||f)return;m=!0,h();let I=Buffer.concat(s).toString("utf8"),_=Buffer.concat(l).toString("utf8");r({status:y,signal:R,stdout:I,stderr:_,timedOut:!1,durationMs:un.now()-o,stdoutTruncated:d,stderrTruncated:p})}),e.input===void 0?a.stdin.end():a.stdin.end(e.input)})}var fn=Yt({kind:"file-dependency-graph",invalidation:Pe("file-dependency-graph"),serialize:e=>JSON.stringify(e),deserialize:Or}),Tr=$("file-dep-graph",{clearGroups:["whole-project"]});function Me(e,t,n={}){let r=n.scipEdges??"all-references",i=n.sourceEdges??"imports-only",o=Ar(t,r,i);return Tr.get(e,o,()=>{let a=new Set(Le(e,{includeIgnored:!1})),s=Qt(e),l=0,c=0,u=null,d=!1,p=0,f=0;return Z("file-dep-graph.product",()=>{if(s){let h=fn.read(e,o,s);if(h){d=!0;let v=Mr(h);return l=h.sourceFileCount,c=h.sourceEdgeCount,p=h.scipEdgeCount,f=v.size,u=h.sourceDependencyFingerprint,v}}let m=Z("file-dep-graph.source-imports",()=>{let h=kr(e,a,t,i);return l=h.files.length,c=h.edges.length,u=h.fingerprint,h},()=>({scope:t??null,sourceEdges:i,files:l,edges:c})),g=new Map,b=(h,v)=>qr(e,g,a,h,v);Z("file-dep-graph.scip-edges",()=>{for(let h of Hr(e,t,r))p+=1,b(h.from_file,h.to_file)},()=>({scope:t??null,edges:p}));for(let h of m.edges)b(h.fromFile,h.toFile);return f=g.size,s&&fn.write(e,o,s,{sourceDependencyFingerprint:m.fingerprint,sourceFileCount:m.files.length,sourceEdgeCount:m.edges.length,scipEdgeCount:p,graph:Dr(g)}),g},()=>({scope:t??null,available:s!==null,hit:d,files:l,sourceEdges:c,sourceEdgeMode:i,scipEdges:p,graphFiles:f,sourceDependencyFingerprint:u}))})}function kr(e,t,n,r){let i=[],o=[];for(let a of t)if(!(n&&!a.includes(n))){i.push(a);for(let s of A(e,a))s.sourcePath&&o.push({fromFile:a,toFile:s.sourcePath});if(r==="imports-and-reexports")for(let s of ne(e,a))s.sourcePath&&o.push({fromFile:a,toFile:s.sourcePath})}return{files:i,edges:o,fingerprint:$r(i,o)}}function $r(e,t){let n=t.map(r=>`${r.fromFile}\0${r.toFile}`).sort();return pe(JSON.stringify({files:e,edges:n}))}function Ar(e,t,n){return`edge-mode-v3:${t}:${n}:${e??"<all>"}`}function Dr(e){return[...e].map(([t,n])=>[t,[...n]])}function Mr(e){return new Map(e.graph.map(([t,n])=>[t,new Set(n)]))}function Or(e){let t=JSON.parse(e);return jr(t)?t:null}function jr(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.sourceDependencyFingerprint=="string"&&typeof t.sourceFileCount=="number"&&typeof t.sourceEdgeCount=="number"&&typeof t.scipEdgeCount=="number"&&Array.isArray(t.graph)&&t.graph.every(Vr)}function Vr(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&Array.isArray(e[1])&&e[1].every(t=>typeof t=="string")}function Hr(e,t,n){let r=t?"AND d1.relative_path LIKE ?":"",i=t?[`%${t}%`]:[],o=n==="imports-only"?"AND m.role = 2":"AND m.role != 1";return e.all(`SELECT DISTINCT
1
+ import{a as Vt,b as Ht}from"./chunk-5IO2APSS.js";import{B as W,C as X,F as ie,H as C,O as oe,P as Ae,e as U,o as ne,p as A,s as Te,u as ke,x as $e,y as sn}from"./chunk-M7LAIM77.js";import{c as z}from"./chunk-FWY2PRIF.js";import{b as fe,c as re,d as M,f as lt,g as ct,h as ln}from"./chunk-DRENNWRG.js";import{G as D,J as an,a as pe,c as Jt,i as Yt,j as en,k as Pe,l as L,q as nn,r as rn,y as Be,z as on}from"./chunk-IYBIBMPF.js";import{a as Wt,d as Kt}from"./chunk-XYLV727H.js";import{a as $,b as Ee,e as Le,f as tn}from"./chunk-4NHWNAWQ.js";import{a as Zt}from"./chunk-2VKB5CMA.js";import{b as zt,e as b,h as Ut}from"./chunk-ACZDU5GK.js";import{i as Z}from"./chunk-R2NOK63J.js";import{a as jt}from"./chunk-6URCE5QY.js";import{A as Qt,B as te,h as Ot,n as qt,o as Gt,z as Xt}from"./chunk-4O52YNKL.js";import{join as De}from"path";var Xa=6,Qa=5e3,Sr="watch.lock",vr="watch-state.json",xr="watch-activity.json",Rr="watch-refresh-requests";function Ja(e){return{lockPath:De(e,Sr),statePath:De(e,vr),activityPath:De(e,xr),refreshRequestsPath:De(e,Rr)}}function Ya(e){try{return Ir(JSON.parse(Ot(e,"watch service state")))}catch{return null}}function Ir(e){if(!e||typeof e!="object")return null;let t=e;if(t.version!==1||typeof t.protocolVersion!="number"||typeof t.pid!="number"||!Number.isInteger(t.pid)||t.pid<=0||typeof t.projectRoot!="string"||t.worktreeId!==void 0&&(typeof t.worktreeId!="string"||t.worktreeId.length===0)||typeof t.cliVersion!="string"||!E(t.startedAt)||!E(t.heartbeatAt)||!E(t.lastActivityAt)||!wr(t.watcher)||t.idleDeadlineAt!==void 0&&!E(t.idleDeadlineAt))return null;if(t.processIdentity!==void 0){let n=jt(t.processIdentity);if(!n||n.pid!==t.pid)return null;t.processIdentity=n}return t.indexGeneration!==void 0&&!/^[a-f0-9]{64}$/.test(t.indexGeneration)||t.lastError!==void 0&&!Nr(t.lastError)||t.lastRefresh!==void 0&&!Cr(t.lastRefresh)||t.reindexActivity!==void 0&&!Fr(t.reindexActivity)||t.refreshRequests!==void 0&&!Er(t.refreshRequests)||t.typescriptSemantic!==void 0&&!Pr(t.typescriptSemantic)||t.typescriptIndex!==void 0&&!Lr(t.typescriptIndex)||t.queryLane!==void 0&&!Br(t.queryLane)?null:t}function E(e){return zt(e)}function wr(e){if(!e||typeof e!="object"||!("state"in e))return!1;let t=e;switch(t.state){case"idle":return!0;case"waiting":return B(t.changedFiles)&&B(t.reindexAt);case"indexing":return B(t.startedAt);case"cooldown":return B(t.until)&&typeof t.dirty=="boolean";case"budget-paused":return B(t.until)&&typeof t.dirty=="boolean"&&typeof t.reason=="string"&&b(t.rebuilt)&&b(t.estimatedWriteBytes);case"draining":return B(t.startedAt)&&typeof t.reason=="string";default:return!1}}function Nr(e){if(!e||typeof e!="object")return!1;let t=e;return E(t.at)&&typeof t.message=="string"}function Cr(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.trigger?.kind=="string"&&typeof t.result=="string"&&E(t.startedAt)&&E(t.completedAt)&&B(t.durationMs)}function Fr(e){if(!e||typeof e!="object")return!1;let t=e;return t.confidence!==void 0&&t.confidence!=="complete"&&t.confidence!=="partial"&&t.confidence!=="unavailable"||t.recordsRead!==void 0&&!b(t.recordsRead)||t.invalidRecords!==void 0&&!b(t.invalidRecords)||t.skippedRecords!==void 0&&!b(t.skippedRecords)||t.readErrors!==void 0&&!b(t.readErrors)||t.ignoredPartialTailBytes!==void 0&&!b(t.ignoredPartialTailBytes)||!E(t.windowStartedAt)||!E(t.windowEndedAt)||!b(t.runs)||!b(t.rebuilt)||!b(t.reused)||!b(t.failed)||!b(t.suppressed)||!B(t.estimatedLogicalOutputBytes)||t.estimatedWriteBytes!==void 0&&!b(t.estimatedWriteBytes)||t.reflinkedBytes!==void 0&&!b(t.reflinkedBytes)||t.fallbackCopiedBytes!==void 0&&!b(t.fallbackCopiedBytes)||t.oldestRebuildAt!==void 0&&!E(t.oldestRebuildAt)||t.oldestWriteAt!==void 0&&!E(t.oldestWriteAt)||t.languageAttribution!==void 0&&t.languageAttribution!=="complete"&&t.languageAttribution!=="partial"&&t.languageAttribution!=="unavailable"||t.attributedRuns!==void 0&&!b(t.attributedRuns)||t.unattributedRuns!==void 0&&!b(t.unattributedRuns)||t.invalidLanguageDetails!==void 0&&!b(t.invalidLanguageDetails)||t.estimatedLogicalOutputBytes<0||!t.byTrigger||typeof t.byTrigger!="object"||Array.isArray(t.byTrigger)||t.byLanguage!==void 0&&!_r(t.byLanguage)?!1:Object.values(t.byTrigger).every(n=>n===void 0||b(n))}function _r(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;for(let[t,n]of Object.entries(e)){if(!Wt.includes(t)||!n||typeof n!="object")return!1;let r=n;if(!b(r.runs)||!b(r.rebuilt)||!b(r.reused)||!b(r.producedOutputBytes)||!Ut(r.durationMs)||r.rebuilt+r.reused!==r.runs)return!1}return!0}function Er(e){if(!e||typeof e!="object")return!1;let t=e;return b(t.pending)&&b(t.claimed)&&b(t.completed)&&b(t.expired)&&b(t.invalid)&&(t.oldestPendingAt===void 0||E(t.oldestPendingAt))}function Pr(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.protocolVersion=="number"&&(t.state==="idle"||t.state==="ready"||t.state==="unavailable"||t.state==="error")&&B(t.requests)&&B(t.sessionsCreated)&&B(t.sessionsReused)&&B(t.sessionsRefreshed)&&B(t.sessionsReplaced)&&B(t.projectsCreated)&&(t.lastRequestAt===void 0||E(t.lastRequestAt))&&(t.lastError===void 0||typeof t.lastError=="string")&&(t.busyUntil===void 0||E(t.busyUntil))&&(t.mailbox===void 0||cn(t.mailbox))}function Lr(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.protocolVersion=="number"&&(t.state==="idle"||t.state==="ready"||t.state==="unavailable"||t.state==="error")&&b(t.requests)&&b(t.sessionsCreated)&&b(t.sessionsReplaced)&&b(t.initializations)&&b(t.programUpdates)&&b(t.documentsEmitted)&&b(t.documentsRemoved)&&(t.lastRequestAt===void 0||E(t.lastRequestAt))&&(t.lastDurationMs===void 0||B(t.lastDurationMs)&&t.lastDurationMs>=0)&&(t.lastError===void 0||typeof t.lastError=="string")&&(t.busyUntil===void 0||E(t.busyUntil))&&(t.mailbox===void 0||cn(t.mailbox))}function Br(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.protocolVersion=="number"&&typeof t.socketPath=="string"&&t.socketPath.length>0&&b(t.requests)&&(t.lastRequestAt===void 0||E(t.lastRequestAt))&&(t.lastError===void 0||typeof t.lastError=="string")}function cn(e){if(!e||typeof e!="object")return!1;let t=e;return b(t.pending)&&b(t.inflight)&&b(t.responses)&&b(t.deadLetters)&&b(t.invalid)&&b(t.totalItems)&&B(t.totalBytes)&&t.totalBytes>=0&&t.totalItems===t.pending+t.inflight+t.responses+t.deadLetters&&(t.oldestPendingAt===void 0||E(t.oldestPendingAt))}function B(e){return typeof e=="number"&&Number.isFinite(e)}import{spawn as Tr}from"child_process";import{platform as un}from"os";import{performance as dn}from"perf_hooks";var os={probe:1e4,git:3e4,analysis:18e4,install:3e5,indexer:6e5},ye=class extends Error{constructor(n,r,i,o={}){super(i,o.cause===void 0?void 0:{cause:o.cause});this.kind=n;this.label=r;this.name="BoundedProcessError",this.timedOut=o.timedOut??!1,this.reaped=o.reaped??!1,this.stdout=o.stdout??"",this.stderr=o.stderr??"",this.stdoutTruncated=o.stdoutTruncated??!1,this.stderrTruncated=o.stderrTruncated??!1}kind;label;timedOut;reaped;stdout;stderr;stdoutTruncated;stderrTruncated};function me(e,t){if(!Number.isFinite(e)||e<=0)throw new TypeError(`${t} must be a positive finite number.`)}function pn(e,t,n,r){let i=Math.max(0,r-n);i>0&&e.push(t.subarray(0,i))}function fn(e,t,n){let r=Buffer.concat([...e,t]);e.length=0,e.push(r.subarray(Math.max(0,r.length-n)))}function as(e){me(e.timeoutMs,"timeoutMs"),me(e.maxStdoutBytes,"maxStdoutBytes"),me(e.maxStderrBytes,"maxStderrBytes");let t=e.terminationGraceMs??1e3;me(t,"terminationGraceMs");let n=e.terminationForceMs??t;return me(n,"terminationForceMs"),new Promise((r,i)=>{let o=dn.now(),a;try{let y=un()!=="win32";a=Tr(e.command,[...e.args??[]],{cwd:e.cwd,env:e.env,detached:y?!0:e.detached,stdio:["pipe","pipe","pipe"],windowsHide:!0})}catch(y){i(new ye("spawn",e.label,`${e.label} could not start.`,{cause:y,reaped:!0}));return}let s=[],l=[],c=0,u=0,d=!1,p=!1,f=null,m=!1,g=un()!=="win32",S=a.pid===void 0?null:Vt(a.pid,g),h=()=>{clearTimeout(x),e.signal?.removeEventListener("abort",w)},v=y=>{if(m||!f)return;m=!0,h();let R=Buffer.concat(s).toString("utf8"),I=Buffer.concat(l).toString("utf8"),_=y.reaped||!y.detail?"":` Process-tree cleanup failed: ${y.detail}`;i(new ye(f.kind,e.label,`${f.message}${_}`,{timedOut:f.timedOut,reaped:y.reaped,stdout:R,stderr:I,stdoutTruncated:d,stderrTruncated:p}))},F=y=>{if(!(f||m)){if(f=y,!S){v({reaped:a.pid===void 0,reason:a.pid===void 0?"terminated":"identity-unavailable"});return}Ht(S,{gracefulMs:t,forceMs:n}).then(v,R=>{v({reaped:!1,reason:"signal-failed",detail:R instanceof Error?R.message:String(R)})})}},x=setTimeout(()=>{F({kind:"timeout",timedOut:!0,message:`${e.label} timed out after ${e.timeoutMs}ms.`})},e.timeoutMs);x.unref();let w=()=>{F({kind:"aborted",timedOut:!1,message:`${e.label} was cancelled.`})};e.signal?.addEventListener("abort",w,{once:!0}),e.signal?.aborted&&w(),a.stdout.on("data",y=>{let R=Buffer.isBuffer(y)?y:Buffer.from(y);e.outputLimitBehavior==="truncate-tail"?fn(s,R,e.maxStdoutBytes):pn(s,R,c,e.maxStdoutBytes),c+=R.length,c>e.maxStdoutBytes&&(d=!0,e.outputLimitBehavior!=="truncate-tail"&&F({kind:"stdout-limit",timedOut:!1,message:`${e.label} exceeded stdout limit (${e.maxStdoutBytes} bytes).`}))}),a.stderr.on("data",y=>{let R=Buffer.isBuffer(y)?y:Buffer.from(y);e.outputLimitBehavior==="truncate-tail"?fn(l,R,e.maxStderrBytes):pn(l,R,u,e.maxStderrBytes),u+=R.length,u>e.maxStderrBytes&&(p=!0,e.outputLimitBehavior!=="truncate-tail"&&F({kind:"stderr-limit",timedOut:!1,message:`${e.label} exceeded stderr limit (${e.maxStderrBytes} bytes).`}))}),a.on("error",y=>{if(!m&&!f){if(a.pid===void 0){h(),m=!0,i(new ye("spawn",e.label,`${e.label} could not start: ${y.message}`,{cause:y,reaped:!0}));return}F({kind:"spawn",timedOut:!1,message:`${e.label} failed after start: ${y.message}`})}}),a.on("close",(y,R)=>{if(m||f)return;m=!0,h();let I=Buffer.concat(s).toString("utf8"),_=Buffer.concat(l).toString("utf8");r({status:y,signal:R,stdout:I,stderr:_,timedOut:!1,durationMs:dn.now()-o,stdoutTruncated:d,stderrTruncated:p})}),e.input===void 0?a.stdin.end():a.stdin.end(e.input)})}var mn=en({kind:"file-dependency-graph",invalidation:Pe("file-dependency-graph"),serialize:e=>JSON.stringify(e),deserialize:jr}),kr=$("file-dep-graph",{clearGroups:["whole-project"]});function Me(e,t,n={}){let r=n.scipEdges??"all-references",i=n.sourceEdges??"imports-only",o=Dr(t,r,i);return kr.get(e,o,()=>{let a=new Set(Le(e,{includeIgnored:!1})),s=Jt(e),l=0,c=0,u=null,d=!1,p=0,f=0;return Z("file-dep-graph.product",()=>{if(s){let h=mn.read(e,o,s);if(h){d=!0;let v=Or(h);return l=h.sourceFileCount,c=h.sourceEdgeCount,p=h.scipEdgeCount,f=v.size,u=h.sourceDependencyFingerprint,v}}let m=Z("file-dep-graph.source-imports",()=>{let h=$r(e,a,t,i);return l=h.files.length,c=h.edges.length,u=h.fingerprint,h},()=>({scope:t??null,sourceEdges:i,files:l,edges:c})),g=new Map,S=(h,v)=>Gr(e,g,a,h,v);Z("file-dep-graph.scip-edges",()=>{for(let h of qr(e,t,r))p+=1,S(h.from_file,h.to_file)},()=>({scope:t??null,edges:p}));for(let h of m.edges)S(h.fromFile,h.toFile);return f=g.size,s&&mn.write(e,o,s,{sourceDependencyFingerprint:m.fingerprint,sourceFileCount:m.files.length,sourceEdgeCount:m.edges.length,scipEdgeCount:p,graph:Mr(g)}),g},()=>({scope:t??null,available:s!==null,hit:d,files:l,sourceEdges:c,sourceEdgeMode:i,scipEdges:p,graphFiles:f,sourceDependencyFingerprint:u}))})}function $r(e,t,n,r){let i=[],o=[];for(let a of t)if(!(n&&!a.includes(n))){i.push(a);for(let s of A(e,a))s.sourcePath&&o.push({fromFile:a,toFile:s.sourcePath});if(r==="imports-and-reexports")for(let s of ne(e,a))s.sourcePath&&o.push({fromFile:a,toFile:s.sourcePath})}return{files:i,edges:o,fingerprint:Ar(i,o)}}function Ar(e,t){let n=t.map(r=>`${r.fromFile}\0${r.toFile}`).sort();return pe(JSON.stringify({files:e,edges:n}))}function Dr(e,t,n){return`edge-mode-v3:${t}:${n}:${e??"<all>"}`}function Mr(e){return[...e].map(([t,n])=>[t,[...n]])}function Or(e){return new Map(e.graph.map(([t,n])=>[t,new Set(n)]))}function jr(e){let t=JSON.parse(e);return Vr(t)?t:null}function Vr(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.sourceDependencyFingerprint=="string"&&typeof t.sourceFileCount=="number"&&typeof t.sourceEdgeCount=="number"&&typeof t.scipEdgeCount=="number"&&Array.isArray(t.graph)&&t.graph.every(Hr)}function Hr(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&Array.isArray(e[1])&&e[1].every(t=>typeof t=="string")}function qr(e,t,n){let r=t?"AND d1.relative_path LIKE ?":"",i=t?[`%${t}%`]:[],o=n==="imports-only"?"AND m.role = 2":"AND m.role != 1";return e.all(`SELECT DISTINCT
2
2
  d1.relative_path AS from_file,
3
3
  d2.relative_path AS to_file
4
4
  FROM mentions m
@@ -16,8 +16,8 @@ import{a as Vt,b as Ht}from"./chunk-7MGU3HPH.js";import{A as rn,D,E as on,F as U
16
16
  WHERE d1.id != d2.id
17
17
  ${o}
18
18
  ${e.pathExclusionsFor("d1","d2")}
19
- ${r}`,...i)}function qr(e,t,n,r,i){if(r===i||e.isIgnored(r)||e.isIgnored(i)||!n.has(i))return;let o=t.get(r);o||(o=new Set,t.set(r,o)),o.add(i)}function je(e){let t=Oe(e.projectFiles),n=new Set(t),r=new Map(e.snapshot.files.map(d=>[d.path,d])),i=e.snapshot.files.filter(d=>{let p=qt(d.path,["typescript"]);return p==="config"||p==="ambient"}).map(d=>d.path),o=Oe([...t,...i]),a=o.find(d=>!r.has(d)),s=new Set(e.snapshot.files.map(d=>d.path)).size!==e.snapshot.files.length,l=!a&&o.some(d=>mn(r.get(d))),c=pe(JSON.stringify({pnpmWorkspaces:e.snapshot.pnpmWorkspaces,typescriptProjectMode:e.snapshot.typescriptProjectMode,typescriptProjects:Oe(e.snapshot.typescriptProjects),membership:t})),u=new Map;return{identityFor(d,p){if(!n.has(d))return ae("target-outside-project");if(s)return ae("duplicate-input-path");if(a)return ae("missing-input-fingerprint");if(l)return ae("unreadable-input");let f=[],m,g;if(e.graph===null)f.push("dependency-graph-unavailable"),g="whole-project",m=o;else{let v=zr(d,e.graph,u);if(v.find(x=>!r.has(x)))return ae("missing-input-fingerprint");if(m=Oe([...v,...i]),m.some(x=>mn(r.get(x))))return ae("unreadable-input");g="dependency-closure"}let b=m.map(v=>Ur(r.get(v)));return{version:1,key:pe(JSON.stringify({version:1,engineIdentity:e.engineIdentity,schemaVersion:p,projectIdentity:c,inputs:b})),mode:g,inputFiles:m,reasons:f}}}}function Gr(e,t){let n=new Set,r=[e];for(let i=0;i<r.length;i+=1){let o=r[i];if(!(o===void 0||n.has(o))){n.add(o);for(let a of[...t.get(o)??[]].sort())n.has(a)||r.push(a)}}return[...n].sort()}function zr(e,t,n){let r=n.get(e);if(r)return r;let i=Gr(e,t);return n.set(e,i),i}function Ur(e){return{path:e.path,size:e.size,hash:e.hash}}function mn(e){return e.size<0||e.hash==="unreadable"}function ae(e){return{version:1,key:null,mode:"unkeyed",inputFiles:[],reasons:[e]}}function Oe(e){return[...new Set(e)].sort()}var Wr=Ee("typescript-semantic-identity-context",{clearGroups:["whole-project"]});function ut(e,t,n){let r=Wr.get(e,()=>Kr(e));if(!r)return null;let i=`${n}\0${t}`,o=r.identities.get(i);if(o)return o;let a=r.builder.identityFor(t,n);return r.identities.set(i,a),a}function ge(e){return Le(e,{includeIgnored:!1}).filter(Te).sort()}function Kr(e){try{if(!e.generation.metadataRaw)return null;let t=Kt(e.generation.metadataRaw);if(t.kind!=="legacy"&&t.kind!=="supported"||!t.capabilities.usableForEvidenceCache)return null;let n=Gt(t.metadata.fingerprint);return n?{builder:je({projectFiles:ge(e),snapshot:n,graph:Me(e),engineIdentity:ke()}),identities:new Map}:null}catch{return null}}var dt="typescript-reference-fragment-v3-incomplete-scan",Ve=Jt({kind:"typescript-reference-fragments",invalidation:Pe("typescript-reference-fragments"),serialize:e=>JSON.stringify(e),deserialize:Xr});function ks(e,t,n,r=e){let i=ge(e),o=je({projectFiles:i,snapshot:t,graph:Me(e),engineIdentity:ke()}),a=[...n].map(([s,l])=>({relativePath:s,contentHash:o.identityFor(s,dt).key,value:[...l]}));if(a.some(s=>s.contentHash===null))throw new Error("TypeScript reference fragment identity is unavailable for an affected document.");return Ve.writeBatch(r,a.map(s=>({...s,contentHash:s.contentHash}))),a.length}function $s(e,t,n,r){let i=t.filter(a=>Te(a.relativePath));if(i.length===0)return he("no TypeScript definitions");let o=he("shadow did not run");return Z("typescript.reference-fragments.shadow",()=>{try{let a=r(i[0].relativePath);if(!a.availability().available||!a.referenceFragmentsForFiles)return o=he("TypeScript reference fragment provider is unavailable"),o;let s=ge(e),l=new Set(s),c=a.referenceFragmentsForFiles(s),u=s.filter(m=>!c.has(m));if(u.length>0)return o=he(`TypeScript reference lookup was incomplete for ${u.length} file(s)`),o;let d=$e(i,c),p=an(i,Zr(n,l),d);if(!p.passed)return o={state:"failing",files:s.length,keyedFiles:0,writtenFiles:0,...p},o;let f=[];for(let m of s){let g=ut(e,m,dt);g?.key&&f.push({relativePath:m,contentHash:g.key,value:c.get(m)??[]})}return Ve.writeBatch(e,f),o={state:"passing",files:s.length,keyedFiles:f.length,writtenFiles:f.length,...p},o}catch(a){return o=he(a instanceof Error?a.message:String(a)),o}},()=>({...o}))}function Zr(e,t){return new Map([...e].map(([n,r])=>[n,r.filter(i=>t.has(i.file))]))}function As(e,t,n){if(t.length===0)return{references:new Map,files:0,cacheHits:0,cacheMisses:0,computedFiles:0};let r="fallback",i=0,o=0,a=0,s=0;return Z("typescript.reference-fragments.materialize",()=>{try{let l=ge(e);i=l.length;let c=new Map,u=new Map,d=[];for(let m of l){let g=ut(e,m,dt);if(!g?.key)return null;c.set(m,g.key);let b=Ve.read(e,m,g.key);b===null?(a+=1,d.push(m)):(o+=1,u.set(m,b))}if(a===0)return r="hit",{references:$e(t,u),files:i,cacheHits:o,cacheMisses:a,computedFiles:s};let p=n(t[0].relativePath);if(!p.availability().available||!p.referenceFragmentsForFiles)return null;let f=p.referenceFragmentsForFiles(d);if(d.some(m=>!f.has(m)))return null;s=f.size,Ve.writeBatch(e,d.map(m=>({relativePath:m,contentHash:c.get(m),value:f.get(m)??[]})));for(let[m,g]of f)u.set(m,g);return r="computed",{references:$e(t,u),files:i,cacheHits:o,cacheMisses:a,computedFiles:s}}catch{return null}},()=>({state:r,files:i,cacheHits:o,cacheMisses:a,computedFiles:s}))}function he(e){return{state:"unavailable",files:0,keyedFiles:0,writtenFiles:0,expectedCount:0,actualCount:0,missing:[],extra:[],reason:e}}function Xr(e){try{let t=JSON.parse(e);return!Array.isArray(t)||!t.every(Qr)?null:t}catch{return null}}function Qr(e){if(!e||typeof e!="object")return!1;let t=e,n=t.location;return typeof t.targetSymbol=="string"&&!!n&&typeof n.file=="string"&&typeof n.line=="number"&&typeof n.column=="number"}var Jr=$("symbol-resolution",{clearGroups:[]});function Us(e,t){return Yr(e,t).match}function Yr(e,t){return Jr.get(e,t,()=>{let n=hn(e,t.trim()).filter(a=>!e.isIgnored(a.relative_path));if(n.length>0)return se(e,n);let r=si(e,t);if(r&&!e.isIgnored(r.relative_path))return se(e,[r]);let i=ei(e,t);if(i.length>0)return se(e,i);let o=ti(e,t);return o.length>0?se(e,o):oi(e,t)})}function ei(e,t){let n=t.trim().replace(/\(\)$/u,""),r=n.lastIndexOf(":");if(r<=0||r===n.length-1||n.startsWith("local:"))return[];let i=n.slice(r+1);if(!/^[\p{L}_$][\p{L}\p{N}_$]*$/u.test(i))return[];let o=[`/${i}().`,`/${i}.`,`/${i}#`,`#${i}().`,`#${i}.`,`/${i}/`],a=`gs.display_name = ? OR ${o.map(()=>"instr(gs.symbol, ?) > 0").join(" OR ")}`,s=[i,...o],l=W(e,{where:a,params:s,orderBy:"d.relative_path, der.start_line",limit:200}),c=l.length>0?[]:X(e,{where:a,params:s,orderBy:"d.relative_path, start_line",limit:200}),u=ie(l,c).filter(d=>!e.isIgnored(d.relative_path)).filter(d=>re(d.symbol).replace(/\(\)$/u,"")===n);return[...new Map(u.map(d=>[`${d.symbol}\0${d.relative_path}`,d])).values()]}function ti(e,t){let n=He(t),r=pt(n);if(!r)return[];let i=`%${r.path}%`,o=r.leaf;return ni(e,i,o,n)}function ni(e,t,n,r){let i=ie([],[...ri(e,t,n),...ii(e,t,n)]).filter(o=>!e.isIgnored(o.relative_path)).filter(o=>le(o,r)>1);return i.sort((o,a)=>le(a,r)-le(o,r)||o.end_line-o.start_line-(a.end_line-a.start_line)||o.start_line-a.start_line||o.symbol.localeCompare(a.symbol)),i}function ri(e,t,n){return W(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[t,n,`%/${n}.%`]})}function ii(e,t,n){return X(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[t,n,`%/${n}.%`]})}function oi(e,t){let n=He(t),r=fi(t),i=di(e,r),o=mi(i,t,n).filter(s=>!e.isIgnored(s.relative_path));if(o.length>0)return se(e,o);let a=[];for(let s of i){if(e.isIgnored(s.relative_path))continue;let l=pi(s,t,n,r);l<=0||a.push({row:s,score:l})}return a.sort((s,l)=>l.score-s.score||s.row.end_line-s.row.start_line-(l.row.end_line-l.row.start_line)||s.row.relative_path.localeCompare(l.row.relative_path)||s.row.symbol.localeCompare(l.row.symbol)),se(e,a.map(s=>s.row))}function se(e,t){let n=t.map(i=>Ae(e,i)),r=n[0]??null;return{match:r,candidates:r?ai(n,r):[],total:n.length}}function ai(e,t){let n=new Set([`${t.symbolId}:${t.relativePath}:${t.startLine}`]),r=[];for(let i of e){let o=`${i.symbolId}:${i.relativePath}:${i.startLine}`;if(!n.has(o)&&(n.add(o),r.push({symbol:i.symbol,shortName:re(i.symbol),relativePath:i.relativePath,startLine:i.startLine}),r.length>=5))break}return r}function si(e,t){let n=t.match(/^(.+):(\d+)(?:-(\d+))?$/);if(!n)return;let[,r,i,o]=n,a=en(e,r,{allowMultiple:!1})[0]?.relativePath;if(!a)return;let s=Math.max(0,parseInt(i,10)-1),l=o?Math.max(s,parseInt(o,10)-1):s;return li(e,a,s,l)??ci(e,a,s,l)}function li(e,t,n,r){return W(e,{where:"d.relative_path = ? AND der.start_line <= ? AND der.end_line >= ?",params:[t,n,r],orderBy:"(der.end_line - der.start_line) ASC",limit:1})[0]}function ci(e,t,n,r){return X(e,{where:"d.relative_path = ? AND c.start_line <= ? AND c.end_line >= ?",params:[t,n,r],orderBy:"(MAX(c.end_line) - MIN(c.start_line)) ASC",limit:1})[0]}function Ws(e,t){let n=hn(e,t).find(r=>!e.isIgnored(r.relative_path));return n?Ae(e,n):null}function hn(e,t){let n=W(e,{where:"gs.symbol = ?",params:[t],orderBy:"d.relative_path, der.start_line"}),r=n.length>0?[]:X(e,{where:"gs.symbol = ?",params:[t],orderBy:"d.relative_path, start_line"});return ie(n,r)}function Se(e,t){if("symbol"in t&&"relativePath"in t)return t;let n=ui(e,t.symbolId)[0];return n?Ae(e,n):null}function ui(e,t){let n=W(e,{where:"gs.id = ?",params:[t],orderBy:"der.start_line, der.end_line"}),r=X(e,{where:"gs.id = ?",params:[t],orderBy:"start_line, end_line"});return ie(n,r)}function di(e,t){let n=t.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),r=t.flatMap(s=>{let l=`%${s}%`;return[l,l,l]}),i=n.join(`
20
- AND `),o=W(e,{where:i,params:r,limit:200}),a=X(e,{where:i,params:r,limit:200});return ie(o,a)}function pi(e,t,n,r){let i=t.trim(),o=n,a=o.replace(/\(\)$/,""),s=t.toLowerCase(),l=n.toLowerCase(),c=l.replace(/\(\)$/,""),u=e.symbol,d=re(e.symbol),p=M(e.symbol),f=e.display_name??"",m=e.symbol.toLowerCase(),g=d.toLowerCase(),b=p.toLowerCase(),h=f.toLowerCase(),v=e.relative_path.toLowerCase(),F=/[/:.]/.test(n),x=pt(n),w=x?.leaf.toLowerCase(),y=0;return(u===i||u===o)&&(y+=1150),(d===i||d===o)&&(y+=1100),f===a&&(y+=1180),p===a&&(y+=1160),(`${p}()`===i||`${p}()`===o)&&(y+=955),(m===s||m===l)&&(y+=1e3),(g===s||g===l)&&(y+=950),(v===s||v===l)&&(y+=925),(v.endsWith(`/${l}`)||v.endsWith(`/${s}`))&&(y+=875),h===c&&(y+=850),b===c&&(y+=825),(`${b}()`===s||`${b}()`===l)&&(y+=820),(g.endsWith(`:${l}`)||g.endsWith(`:${c}`)||g.endsWith(`:${c}()`))&&(y+=800),m.includes(l)&&(y+=120),g.includes(l)&&(y+=140),v.includes(l)&&(y+=140),h.includes(l)&&(y+=110),r.every(R=>{let I=R.toLowerCase();return m.includes(I)||g.includes(I)||v.includes(I)||h.includes(I)})&&(y+=100+r.length*15),x&&v.includes(x.path.toLowerCase())&&(y+=360,w&&(b===w||`${b}()`===w||`${b}()`==`${w}()`)&&(y+=700),lt(e.symbol)&&(y+=180)),ct(e.symbol)&&b===c&&(y+=60),!F&&sn(e.symbol)&&(y-=160),y-=Math.min(50,Math.max(0,e.end_line-e.start_line)),y}function pt(e){let t=e.trim().replace(/\\/g,"/"),n=t.lastIndexOf("/");if(n<=0||n===t.length-1)return null;let r=t.slice(n+1).replace(/\(\)$/,"");return!r||r.includes(".")?null:{path:t.slice(0,n),leaf:r}}function He(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function fi(e){let t=He(e),n=t.split(/[^A-Za-z0-9_]+/).map(r=>r.trim()).filter(r=>r.length>0);return n.length>0?[...new Set(n)]:[t]}function mi(e,t,n){let r=t.trim(),i=e.filter(s=>{let l=re(s.symbol),c=M(s.symbol),u=(s.display_name??"").trim();return s.symbol===r||l===r||l===n||c===r||c===n||`${c}()`===r||u===r||u===n||`${u}()`===r||le(s,n)>1||s.relative_path===r});if(i.length===0)return[];let o=n.replace(/\(\)$/u,""),a=i.filter(s=>M(s.symbol)===o);if(a.length>0){a.sort((l,c)=>yn(l,c,n));let s=a.filter(l=>ct(l.symbol));return s.length>0?s:a}return i.sort((s,l)=>yn(s,l,n)),i}function yn(e,t,n){return le(t,n)-le(e,n)||e.end_line-e.start_line-(t.end_line-t.start_line)||e.relative_path.localeCompare(t.relative_path)||e.symbol.localeCompare(t.symbol)}function le(e,t){let n=pt(t);if(!n)return 0;let r=e.relative_path.toLowerCase(),i=M(e.symbol).toLowerCase(),o=n.path.toLowerCase(),a=n.leaf.toLowerCase();return r.includes(o)?i!==a?1:lt(e.symbol)?fe(e.symbol)===null?5:4:fe(e.symbol)===null?3:2:0}function Ks(e,t,n=5){let r=gn(t);if(!r)return[];let i=W(e,{where:"1 = 1",orderBy:"d.relative_path, der.start_line",limit:5e3}),o=new Map;for(let a of i){if(e.isIgnored(a.relative_path))continue;let s=re(a.symbol),l=M(a.symbol),c=a.display_name??l,u=[s,l,c].filter(f=>f.trim().length>0),d=Math.min(...u.map(f=>yi(gn(f),r))),p=o.get(s);(!p||d<p.distance)&&o.set(s,{shortName:s,distance:d})}return[...o.values()].sort((a,s)=>a.distance-s.distance||a.shortName.localeCompare(s.shortName)).slice(0,n).map(a=>a.shortName)}function gn(e){return He(e).toLowerCase().replace(/[^a-z0-9_]+/g,"")}function yi(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let n=Array.from({length:t.length+1},(r,i)=>i);for(let r=0;r<e.length;r++){let i=[r+1];for(let o=0;o<t.length;o++){let a=e[r]===t[o]?0:1;i[o+1]=Math.min(i[o]+1,n[o+1]+1,n[o]+a)}n=i}return n[t.length]}function rl(e,t){let n=Sn(e);return n?t.filter(r=>Sn(r.file)===n):t}function il(e,t,n,r,i){let o=n.find(a=>a.file===t);if(o)return o;if(r){let a=i?.match(/^[A-Za-z_$][\w$]*/u)?.[0];if(!a)return null;let s=A(e,t),l=new Set(s.filter(p=>p.localName===a||p.importedName===a).map(p=>p.sourcePath).filter(p=>!!p));for(let p of n)for(let f of l)if(te(f,p.file))return p;let c=gi(L(e,t)??"",a);if(c.size===0)return null;let u=new Set(s.filter(p=>c.has(p.localName??p.importedName)).map(p=>p.sourcePath).filter(p=>!!p)),d=n.filter(p=>c.has(fe(p.symbol)??"")&&[...u].some(f=>te(f,p.file)));return d.length===1?d[0]:null}return n.length===1?n[0]:null}function gi(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),r=new Set,i=[new RegExp(`\\b${n}\\s*:\\s*([A-Za-z_$][\\w$]*)`,"gu"),new RegExp(`\\b${n}\\s*=\\s*(?:new\\s+)?([A-Za-z_$][\\w$]*)\\s*\\(`,"gu")];for(let o of i)for(let a of e.matchAll(o))r.add(a[1]);return r.size===1?r:new Set}function Sn(e){let t=Be(e);return t?t==="typescript"||t==="tsx"||t==="javascript"?"javascript-family":t:null}var hi=Ee("global-leaf-index",{clearGroups:["whole-project"]});function ft(e){return hi.get(e,()=>{let t=e.all(`SELECT gs.id, gs.symbol,
19
+ ${r}`,...i)}function Gr(e,t,n,r,i){if(r===i||e.isIgnored(r)||e.isIgnored(i)||!n.has(i))return;let o=t.get(r);o||(o=new Set,t.set(r,o)),o.add(i)}function je(e){let t=Oe(e.projectFiles),n=new Set(t),r=new Map(e.snapshot.files.map(d=>[d.path,d])),i=e.snapshot.files.filter(d=>{let p=qt(d.path,["typescript"]);return p==="config"||p==="ambient"}).map(d=>d.path),o=Oe([...t,...i]),a=o.find(d=>!r.has(d)),s=new Set(e.snapshot.files.map(d=>d.path)).size!==e.snapshot.files.length,l=!a&&o.some(d=>yn(r.get(d))),c=pe(JSON.stringify({pnpmWorkspaces:e.snapshot.pnpmWorkspaces,typescriptProjectMode:e.snapshot.typescriptProjectMode,typescriptProjects:Oe(e.snapshot.typescriptProjects),membership:t})),u=new Map;return{identityFor(d,p){if(!n.has(d))return ae("target-outside-project");if(s)return ae("duplicate-input-path");if(a)return ae("missing-input-fingerprint");if(l)return ae("unreadable-input");let f=[],m,g;if(e.graph===null)f.push("dependency-graph-unavailable"),g="whole-project",m=o;else{let v=Ur(d,e.graph,u);if(v.find(x=>!r.has(x)))return ae("missing-input-fingerprint");if(m=Oe([...v,...i]),m.some(x=>yn(r.get(x))))return ae("unreadable-input");g="dependency-closure"}let S=m.map(v=>Wr(r.get(v)));return{version:1,key:pe(JSON.stringify({version:1,engineIdentity:e.engineIdentity,schemaVersion:p,projectIdentity:c,inputs:S})),mode:g,inputFiles:m,reasons:f}}}}function zr(e,t){let n=new Set,r=[e];for(let i=0;i<r.length;i+=1){let o=r[i];if(!(o===void 0||n.has(o))){n.add(o);for(let a of[...t.get(o)??[]].sort())n.has(a)||r.push(a)}}return[...n].sort()}function Ur(e,t,n){let r=n.get(e);if(r)return r;let i=zr(e,t);return n.set(e,i),i}function Wr(e){return{path:e.path,size:e.size,hash:e.hash}}function yn(e){return e.size<0||e.hash==="unreadable"}function ae(e){return{version:1,key:null,mode:"unkeyed",inputFiles:[],reasons:[e]}}function Oe(e){return[...new Set(e)].sort()}var Kr=Ee("typescript-semantic-identity-context",{clearGroups:["whole-project"]});function ut(e,t,n){let r=Kr.get(e,()=>Zr(e));if(!r)return null;let i=`${n}\0${t}`,o=r.identities.get(i);if(o)return o;let a=r.builder.identityFor(t,n);return r.identities.set(i,a),a}function ge(e){return Le(e,{includeIgnored:!1}).filter(Te).sort()}function Zr(e){try{if(!e.generation.metadataRaw)return null;let t=Kt(e.generation.metadataRaw);if(t.kind!=="legacy"&&t.kind!=="supported"||!t.capabilities.usableForEvidenceCache)return null;let n=Gt(t.metadata.fingerprint);return n?{builder:je({projectFiles:ge(e),snapshot:n,graph:Me(e),engineIdentity:ke()}),identities:new Map}:null}catch{return null}}var dt="typescript-reference-fragment-v3-incomplete-scan",Ve=Yt({kind:"typescript-reference-fragments",invalidation:Pe("typescript-reference-fragments"),serialize:e=>JSON.stringify(e),deserialize:Qr});function $s(e,t,n,r=e){let i=ge(e),o=je({projectFiles:i,snapshot:t,graph:Me(e),engineIdentity:ke()}),a=[...n].map(([s,l])=>({relativePath:s,contentHash:o.identityFor(s,dt).key,value:[...l]}));if(a.some(s=>s.contentHash===null))throw new Error("TypeScript reference fragment identity is unavailable for an affected document.");return Ve.writeBatch(r,a.map(s=>({...s,contentHash:s.contentHash}))),a.length}function As(e,t,n,r){let i=t.filter(a=>Te(a.relativePath));if(i.length===0)return he("no TypeScript definitions");let o=he("shadow did not run");return Z("typescript.reference-fragments.shadow",()=>{try{let a=r(i[0].relativePath);if(!a.availability().available||!a.referenceFragmentsForFiles)return o=he("TypeScript reference fragment provider is unavailable"),o;let s=ge(e),l=new Set(s),c=a.referenceFragmentsForFiles(s),u=s.filter(m=>!c.has(m));if(u.length>0)return o=he(`TypeScript reference lookup was incomplete for ${u.length} file(s)`),o;let d=$e(i,c),p=sn(i,Xr(n,l),d);if(!p.passed)return o={state:"failing",files:s.length,keyedFiles:0,writtenFiles:0,...p},o;let f=[];for(let m of s){let g=ut(e,m,dt);g?.key&&f.push({relativePath:m,contentHash:g.key,value:c.get(m)??[]})}return Ve.writeBatch(e,f),o={state:"passing",files:s.length,keyedFiles:f.length,writtenFiles:f.length,...p},o}catch(a){return o=he(a instanceof Error?a.message:String(a)),o}},()=>({...o}))}function Xr(e,t){return new Map([...e].map(([n,r])=>[n,r.filter(i=>t.has(i.file))]))}function Ds(e,t,n){if(t.length===0)return{references:new Map,files:0,cacheHits:0,cacheMisses:0,computedFiles:0};let r="fallback",i=0,o=0,a=0,s=0;return Z("typescript.reference-fragments.materialize",()=>{try{let l=ge(e);i=l.length;let c=new Map,u=new Map,d=[];for(let m of l){let g=ut(e,m,dt);if(!g?.key)return null;c.set(m,g.key);let S=Ve.read(e,m,g.key);S===null?(a+=1,d.push(m)):(o+=1,u.set(m,S))}if(a===0)return r="hit",{references:$e(t,u),files:i,cacheHits:o,cacheMisses:a,computedFiles:s};let p=n(t[0].relativePath);if(!p.availability().available||!p.referenceFragmentsForFiles)return null;let f=p.referenceFragmentsForFiles(d);if(d.some(m=>!f.has(m)))return null;s=f.size,Ve.writeBatch(e,d.map(m=>({relativePath:m,contentHash:c.get(m),value:f.get(m)??[]})));for(let[m,g]of f)u.set(m,g);return r="computed",{references:$e(t,u),files:i,cacheHits:o,cacheMisses:a,computedFiles:s}}catch{return null}},()=>({state:r,files:i,cacheHits:o,cacheMisses:a,computedFiles:s}))}function he(e){return{state:"unavailable",files:0,keyedFiles:0,writtenFiles:0,expectedCount:0,actualCount:0,missing:[],extra:[],reason:e}}function Qr(e){try{let t=JSON.parse(e);return!Array.isArray(t)||!t.every(Jr)?null:t}catch{return null}}function Jr(e){if(!e||typeof e!="object")return!1;let t=e,n=t.location;return typeof t.targetSymbol=="string"&&!!n&&typeof n.file=="string"&&typeof n.line=="number"&&typeof n.column=="number"}var Yr=$("symbol-resolution",{clearGroups:[]});function Ws(e,t){return ei(e,t).match}function ei(e,t){return Yr.get(e,t,()=>{let n=bn(e,t.trim()).filter(a=>!e.isIgnored(a.relative_path));if(n.length>0)return se(e,n);let r=li(e,t);if(r&&!e.isIgnored(r.relative_path))return se(e,[r]);let i=ti(e,t);if(i.length>0)return se(e,i);let o=ni(e,t);return o.length>0?se(e,o):ai(e,t)})}function ti(e,t){let n=t.trim().replace(/\(\)$/u,""),r=n.lastIndexOf(":");if(r<=0||r===n.length-1||n.startsWith("local:"))return[];let i=n.slice(r+1);if(!/^[\p{L}_$][\p{L}\p{N}_$]*$/u.test(i))return[];let o=[`/${i}().`,`/${i}.`,`/${i}#`,`#${i}().`,`#${i}.`,`/${i}/`],a=`gs.display_name = ? OR ${o.map(()=>"instr(gs.symbol, ?) > 0").join(" OR ")}`,s=[i,...o],l=W(e,{where:a,params:s,orderBy:"d.relative_path, der.start_line",limit:200}),c=l.length>0?[]:X(e,{where:a,params:s,orderBy:"d.relative_path, start_line",limit:200}),u=ie(l,c).filter(d=>!e.isIgnored(d.relative_path)).filter(d=>re(d.symbol).replace(/\(\)$/u,"")===n);return[...new Map(u.map(d=>[`${d.symbol}\0${d.relative_path}`,d])).values()]}function ni(e,t){let n=He(t),r=pt(n);if(!r)return[];let i=`%${r.path}%`,o=r.leaf;return ri(e,i,o,n)}function ri(e,t,n,r){let i=ie([],[...ii(e,t,n),...oi(e,t,n)]).filter(o=>!e.isIgnored(o.relative_path)).filter(o=>le(o,r)>1);return i.sort((o,a)=>le(a,r)-le(o,r)||o.end_line-o.start_line-(a.end_line-a.start_line)||o.start_line-a.start_line||o.symbol.localeCompare(a.symbol)),i}function ii(e,t,n){return W(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[t,n,`%/${n}.%`]})}function oi(e,t,n){return X(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[t,n,`%/${n}.%`]})}function ai(e,t){let n=He(t),r=mi(t),i=pi(e,r),o=yi(i,t,n).filter(s=>!e.isIgnored(s.relative_path));if(o.length>0)return se(e,o);let a=[];for(let s of i){if(e.isIgnored(s.relative_path))continue;let l=fi(s,t,n,r);l<=0||a.push({row:s,score:l})}return a.sort((s,l)=>l.score-s.score||s.row.end_line-s.row.start_line-(l.row.end_line-l.row.start_line)||s.row.relative_path.localeCompare(l.row.relative_path)||s.row.symbol.localeCompare(l.row.symbol)),se(e,a.map(s=>s.row))}function se(e,t){let n=t.map(i=>Ae(e,i)),r=n[0]??null;return{match:r,candidates:r?si(n,r):[],total:n.length}}function si(e,t){let n=new Set([`${t.symbolId}:${t.relativePath}:${t.startLine}`]),r=[];for(let i of e){let o=`${i.symbolId}:${i.relativePath}:${i.startLine}`;if(!n.has(o)&&(n.add(o),r.push({symbol:i.symbol,shortName:re(i.symbol),relativePath:i.relativePath,startLine:i.startLine}),r.length>=5))break}return r}function li(e,t){let n=t.match(/^(.+):(\d+)(?:-(\d+))?$/);if(!n)return;let[,r,i,o]=n,a=tn(e,r,{allowMultiple:!1})[0]?.relativePath;if(!a)return;let s=Math.max(0,parseInt(i,10)-1),l=o?Math.max(s,parseInt(o,10)-1):s;return ci(e,a,s,l)??ui(e,a,s,l)}function ci(e,t,n,r){return W(e,{where:"d.relative_path = ? AND der.start_line <= ? AND der.end_line >= ?",params:[t,n,r],orderBy:"(der.end_line - der.start_line) ASC",limit:1})[0]}function ui(e,t,n,r){return X(e,{where:"d.relative_path = ? AND c.start_line <= ? AND c.end_line >= ?",params:[t,n,r],orderBy:"(MAX(c.end_line) - MIN(c.start_line)) ASC",limit:1})[0]}function Ks(e,t){let n=bn(e,t).find(r=>!e.isIgnored(r.relative_path));return n?Ae(e,n):null}function bn(e,t){let n=W(e,{where:"gs.symbol = ?",params:[t],orderBy:"d.relative_path, der.start_line"}),r=n.length>0?[]:X(e,{where:"gs.symbol = ?",params:[t],orderBy:"d.relative_path, start_line"});return ie(n,r)}function be(e,t){if("symbol"in t&&"relativePath"in t)return t;let n=di(e,t.symbolId)[0];return n?Ae(e,n):null}function di(e,t){let n=W(e,{where:"gs.id = ?",params:[t],orderBy:"der.start_line, der.end_line"}),r=X(e,{where:"gs.id = ?",params:[t],orderBy:"start_line, end_line"});return ie(n,r)}function pi(e,t){let n=t.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),r=t.flatMap(s=>{let l=`%${s}%`;return[l,l,l]}),i=n.join(`
20
+ AND `),o=W(e,{where:i,params:r,limit:200}),a=X(e,{where:i,params:r,limit:200});return ie(o,a)}function fi(e,t,n,r){let i=t.trim(),o=n,a=o.replace(/\(\)$/,""),s=t.toLowerCase(),l=n.toLowerCase(),c=l.replace(/\(\)$/,""),u=e.symbol,d=re(e.symbol),p=M(e.symbol),f=e.display_name??"",m=e.symbol.toLowerCase(),g=d.toLowerCase(),S=p.toLowerCase(),h=f.toLowerCase(),v=e.relative_path.toLowerCase(),F=/[/:.]/.test(n),x=pt(n),w=x?.leaf.toLowerCase(),y=0;return(u===i||u===o)&&(y+=1150),(d===i||d===o)&&(y+=1100),f===a&&(y+=1180),p===a&&(y+=1160),(`${p}()`===i||`${p}()`===o)&&(y+=955),(m===s||m===l)&&(y+=1e3),(g===s||g===l)&&(y+=950),(v===s||v===l)&&(y+=925),(v.endsWith(`/${l}`)||v.endsWith(`/${s}`))&&(y+=875),h===c&&(y+=850),S===c&&(y+=825),(`${S}()`===s||`${S}()`===l)&&(y+=820),(g.endsWith(`:${l}`)||g.endsWith(`:${c}`)||g.endsWith(`:${c}()`))&&(y+=800),m.includes(l)&&(y+=120),g.includes(l)&&(y+=140),v.includes(l)&&(y+=140),h.includes(l)&&(y+=110),r.every(R=>{let I=R.toLowerCase();return m.includes(I)||g.includes(I)||v.includes(I)||h.includes(I)})&&(y+=100+r.length*15),x&&v.includes(x.path.toLowerCase())&&(y+=360,w&&(S===w||`${S}()`===w||`${S}()`==`${w}()`)&&(y+=700),lt(e.symbol)&&(y+=180)),ct(e.symbol)&&S===c&&(y+=60),!F&&ln(e.symbol)&&(y-=160),y-=Math.min(50,Math.max(0,e.end_line-e.start_line)),y}function pt(e){let t=e.trim().replace(/\\/g,"/"),n=t.lastIndexOf("/");if(n<=0||n===t.length-1)return null;let r=t.slice(n+1).replace(/\(\)$/,"");return!r||r.includes(".")?null:{path:t.slice(0,n),leaf:r}}function He(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function mi(e){let t=He(e),n=t.split(/[^A-Za-z0-9_]+/).map(r=>r.trim()).filter(r=>r.length>0);return n.length>0?[...new Set(n)]:[t]}function yi(e,t,n){let r=t.trim(),i=e.filter(s=>{let l=re(s.symbol),c=M(s.symbol),u=(s.display_name??"").trim();return s.symbol===r||l===r||l===n||c===r||c===n||`${c}()`===r||u===r||u===n||`${u}()`===r||le(s,n)>1||s.relative_path===r});if(i.length===0)return[];let o=n.replace(/\(\)$/u,""),a=i.filter(s=>M(s.symbol)===o);if(a.length>0){a.sort((l,c)=>gn(l,c,n));let s=a.filter(l=>ct(l.symbol));return s.length>0?s:a}return i.sort((s,l)=>gn(s,l,n)),i}function gn(e,t,n){return le(t,n)-le(e,n)||e.end_line-e.start_line-(t.end_line-t.start_line)||e.relative_path.localeCompare(t.relative_path)||e.symbol.localeCompare(t.symbol)}function le(e,t){let n=pt(t);if(!n)return 0;let r=e.relative_path.toLowerCase(),i=M(e.symbol).toLowerCase(),o=n.path.toLowerCase(),a=n.leaf.toLowerCase();return r.includes(o)?i!==a?1:lt(e.symbol)?fe(e.symbol)===null?5:4:fe(e.symbol)===null?3:2:0}function Zs(e,t,n=5){let r=hn(t);if(!r)return[];let i=W(e,{where:"1 = 1",orderBy:"d.relative_path, der.start_line",limit:5e3}),o=new Map;for(let a of i){if(e.isIgnored(a.relative_path))continue;let s=re(a.symbol),l=M(a.symbol),c=a.display_name??l,u=[s,l,c].filter(f=>f.trim().length>0),d=Math.min(...u.map(f=>gi(hn(f),r))),p=o.get(s);(!p||d<p.distance)&&o.set(s,{shortName:s,distance:d})}return[...o.values()].sort((a,s)=>a.distance-s.distance||a.shortName.localeCompare(s.shortName)).slice(0,n).map(a=>a.shortName)}function hn(e){return He(e).toLowerCase().replace(/[^a-z0-9_]+/g,"")}function gi(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let n=Array.from({length:t.length+1},(r,i)=>i);for(let r=0;r<e.length;r++){let i=[r+1];for(let o=0;o<t.length;o++){let a=e[r]===t[o]?0:1;i[o+1]=Math.min(i[o]+1,n[o+1]+1,n[o]+a)}n=i}return n[t.length]}function il(e,t){let n=Sn(e);return n?t.filter(r=>Sn(r.file)===n):t}function ol(e,t,n,r,i){let o=n.find(a=>a.file===t);if(o)return o;if(r){let a=i?.match(/^[A-Za-z_$][\w$]*/u)?.[0];if(!a)return null;let s=A(e,t),l=new Set(s.filter(p=>p.localName===a||p.importedName===a).map(p=>p.sourcePath).filter(p=>!!p));for(let p of n)for(let f of l)if(te(f,p.file))return p;let c=hi(L(e,t)??"",a);if(c.size===0)return null;let u=new Set(s.filter(p=>c.has(p.localName??p.importedName)).map(p=>p.sourcePath).filter(p=>!!p)),d=n.filter(p=>c.has(fe(p.symbol)??"")&&[...u].some(f=>te(f,p.file)));return d.length===1?d[0]:null}return n.length===1?n[0]:null}function hi(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),r=new Set,i=[new RegExp(`\\b${n}\\s*:\\s*([A-Za-z_$][\\w$]*)`,"gu"),new RegExp(`\\b${n}\\s*=\\s*(?:new\\s+)?([A-Za-z_$][\\w$]*)\\s*\\(`,"gu")];for(let o of i)for(let a of e.matchAll(o))r.add(a[1]);return r.size===1?r:new Set}function Sn(e){let t=Be(e);return t?t==="typescript"||t==="tsx"||t==="javascript"?"javascript-family":t:null}var bi=Ee("global-leaf-index",{clearGroups:["whole-project"]});function ft(e){return bi.get(e,()=>{let t=e.all(`SELECT gs.id, gs.symbol,
21
21
  COALESCE(der_doc.relative_path, mention_doc.relative_path) AS relative_path
22
22
  FROM global_symbols gs
23
23
  LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
@@ -31,7 +31,7 @@ import{a as Vt,b as Ht}from"./chunk-7MGU3HPH.js";import{A as rn,D,E as on,F as U
31
31
  GROUP BY m.symbol_id
32
32
  ) mention_doc ON mention_doc.symbol_id = gs.id
33
33
  WHERE 1 = 1
34
- ${e.symbolNoiseFor("gs")}`),n=new Map;for(let r of t){if(!r.relative_path||e.isIgnored(r.relative_path))continue;let i=M(r.symbol);if(!i)continue;let o=n.get(i);o||(o=[],n.set(i,o)),o.some(a=>a.symbolId===r.id)||o.push({symbol:r.symbol,symbolId:r.id,file:r.relative_path})}return n})}function qe(e,t,n,r={}){if(!n)return[];let i=L(e,t);return i?i.indexOf(n)===-1?[]:(mt(e,t).get(n)??[]).filter(a=>!Si(a,r)):[]}function Si(e,t){return typeof t.excludeStartLine=="number"&&typeof t.excludeEndLine=="number"&&e>=t.excludeStartLine&&e<=t.excludeEndLine}var bi=$("file-identifiers",{clearGroups:["whole-project","source-file"]});function bn(e,t){let n=U(e,t);return n?n.fileIdentifiers:bi.get(e,t,()=>new Set(mt(e,t).keys()))}var vi=$("file-ident-lines",{clearGroups:["whole-project","source-file"]});function mt(e,t){let n=U(e,t);return n?n.identifierLineMap:vi.get(e,t,()=>Ri(e,t))}var xi=$("file-idents-by-line",{clearGroups:["whole-project","source-file"]});function ul(e,t){let n=U(e,t);return n?n.identifiersByLine:xi.get(e,t,()=>{let r=mt(e,t),i=0;for(let a of r.values()){let s=a[a.length-1];s!==void 0&&s>i&&(i=s)}let o=new Array(i+1);for(let a=0;a<=i;a+=1)o[a]=new Set;for(let[a,s]of r)for(let l of s)o[l].add(a);return o})}function Ri(e,t){let n=new Map,r=(s,l)=>{let c=n.get(s);if(!c){n.set(s,[l]);return}c[c.length-1]!==l&&c.push(l)},i=L(e,t);if(!i)return n;let o=nn(i).split(/\r?\n/),a=/\b([A-Za-z_$][\w$]*)\b/g;for(let s=0;s<o.length;s+=1){let l=o[s]??"";for(let c of l.matchAll(a))c[1]&&r(c[1],s)}return n}var vn=/[A-Za-z_$][A-Za-z0-9_$]*/g,xn=/^[A-Za-z_$][A-Za-z0-9_$]*$/,Ii=512;function yt(e){let t=[],n=!1;for(let r of e)r&&(n=!0,xn.test(r)||t.push(r));return{candidateNames:e,hasUsableCandidate:n,nonIdentifierNames:t}}function Rn(e,t){let n=wi(t)?t:yt(t);if(n.candidateNames.size===0||!n.hasUsableCandidate)return!0;if(n.candidateNames.size<=Ii){for(let i of n.candidateNames)if(i){if(xn.test(i)){if(Ni(i).test(e))return!0;continue}if(e.includes(i))return!0}return!1}vn.lastIndex=0;let r;for(;(r=vn.exec(e))!==null;)if(n.candidateNames.has(r[0]))return!0;for(let i of n.nonIdentifierNames)if(e.includes(i))return!0;return!1}function wi(e){return"candidateNames"in e}function Ni(e){return new RegExp(`(?<![A-Za-z_$0-9])${tn(e)}(?![A-Za-z_$0-9])`)}var Ci=$("source-import-paths-by-local-name",{clearGroups:["whole-project","source-file"]});function wn(e,t){let n=Zt(t);return Ci.get(e,n,()=>Fi(e,n))}function Fi(e,t){let n=new Map;for(let r of A(e,t)){if(!r.sourcePath)continue;let i=r.localName??r.importedName;if(i&&In(n,i,r.sourcePath),r.kind==="namespace")for(let o of r.usedMembers)In(n,o,r.sourcePath)}return n}function In(e,t,n){let r=e.get(t);r||(r=new Set,e.set(t,r)),r.add(n)}function gt(e,t,n){let r=ft(e).get(n);if(!r||r.length===0)return[];if(r.length===1)return[be(r[0])];let i=r.filter(l=>l.file===t);if(i.length>0)return i.map(be);let o=wn(e,t),a=o.get(n);if(a)for(let l of a){let c=r.filter(u=>te(l,u.file));if(c.length>0)return c.map(be)}let s=new Set;for(let l of o.values())for(let c of l)s.add(c);for(let l of s){let c=r.filter(u=>te(l,u.file));if(c.length>0&&c.length===r.length)return c.map(be)}return[]}function _l(e,t,n){let r=gt(e,t,n);if(r.length>0)return r;let i=ft(e).get(n);return!i||i.length===0?[]:i.map(be)}function Nn(e,t,n={}){let r=_i(e,t);if(!r)return[];let i=Se(e,t);if(n.semantic!==!1&&n.semanticEvidence){let a=n.semanticEvidence.references(e,{...i,leaf:r.identifier,parentTypeName:null,isFunctionLike:!1,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null});if(a.length>0){let s=new Map;for(let l of a){let c=s.get(l.file)??[];c.push(l.line),s.set(l.file,c)}return Ge(e,s)}}let o=new Map;for(let a of z(e)){let s=Ei(e,r,a);s.length>0&&o.set(a,s)}return Ge(e,o)}function _i(e,t){let n=Se(e,t);if(!n)return null;let r=M(n.symbol);return r?{symbolId:n.symbolId,relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,identifier:r}:null}function Ei(e,t,n){let r=L(e,n);return!r||r.indexOf(t.identifier)===-1?[]:n!==t.relativePath&&!gt(e,n,t.identifier).some(o=>o.symbolId===t.symbolId)?[]:qe(e,n,t.identifier,n===t.relativePath?{excludeStartLine:t.startLine,excludeEndLine:t.endLine}:{})}function El(e,t,n={}){let r=new Map;for(let l of t){if(!l.leaf)continue;let c=r.get(l.leaf)??[];c.push(l),r.set(l.leaf,c)}if(r.size===0)return new Map;let i=new Set(t.map(l=>l.symbolId)),o=new Set(r.keys()),a=yt(o),s=new Map;for(let l of z(e)){if(n.skipPath?.(l)||!Rn(L(e,l),a))continue;let c=bn(e,l);if(c.size!==0){for(let u of c)if(r.has(u))for(let d of gt(e,l,u)){if(!i.has(d.symbolId)||l===d.relativePath)continue;let p=s.get(d.symbolId);p||(p=new Set,s.set(d.symbolId,p)),p.add(l)}}}return s}function be(e){return{symbolId:e.symbolId,symbol:e.symbol,relativePath:e.file}}function Ge(e,t){let n=[],r=new Set;for(let[i,o]of t){let a=C(e,i);for(let s of o){let l=oe(a,s),c=`${i}|${s}|${l?.symbol??""}`;r.has(c)||(r.add(c),n.push({file:i,line:s,enclosingSymbol:l?.symbol??null}))}}return n}function Ll(e,t){return ze(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT
34
+ ${e.symbolNoiseFor("gs")}`),n=new Map;for(let r of t){if(!r.relative_path||e.isIgnored(r.relative_path))continue;let i=M(r.symbol);if(!i)continue;let o=n.get(i);o||(o=[],n.set(i,o)),o.some(a=>a.symbolId===r.id)||o.push({symbol:r.symbol,symbolId:r.id,file:r.relative_path})}return n})}function qe(e,t,n,r={}){if(!n)return[];let i=L(e,t);return i?i.indexOf(n)===-1?[]:(mt(e,t).get(n)??[]).filter(a=>!Si(a,r)):[]}function Si(e,t){return typeof t.excludeStartLine=="number"&&typeof t.excludeEndLine=="number"&&e>=t.excludeStartLine&&e<=t.excludeEndLine}var vi=$("file-identifiers",{clearGroups:["whole-project","source-file"]});function vn(e,t){let n=U(e,t);return n?n.fileIdentifiers:vi.get(e,t,()=>new Set(mt(e,t).keys()))}var xi=$("file-ident-lines",{clearGroups:["whole-project","source-file"]});function mt(e,t){let n=U(e,t);return n?n.identifierLineMap:xi.get(e,t,()=>Ii(e,t))}var Ri=$("file-idents-by-line",{clearGroups:["whole-project","source-file"]});function dl(e,t){let n=U(e,t);return n?n.identifiersByLine:Ri.get(e,t,()=>{let r=mt(e,t),i=0;for(let a of r.values()){let s=a[a.length-1];s!==void 0&&s>i&&(i=s)}let o=new Array(i+1);for(let a=0;a<=i;a+=1)o[a]=new Set;for(let[a,s]of r)for(let l of s)o[l].add(a);return o})}function Ii(e,t){let n=new Map,r=(s,l)=>{let c=n.get(s);if(!c){n.set(s,[l]);return}c[c.length-1]!==l&&c.push(l)},i=L(e,t);if(!i)return n;let o=rn(i).split(/\r?\n/),a=/\b([A-Za-z_$][\w$]*)\b/g;for(let s=0;s<o.length;s+=1){let l=o[s]??"";for(let c of l.matchAll(a))c[1]&&r(c[1],s)}return n}var xn=/[A-Za-z_$][A-Za-z0-9_$]*/g,Rn=/^[A-Za-z_$][A-Za-z0-9_$]*$/,wi=512;function yt(e){let t=[],n=!1;for(let r of e)r&&(n=!0,Rn.test(r)||t.push(r));return{candidateNames:e,hasUsableCandidate:n,nonIdentifierNames:t}}function In(e,t){let n=Ni(t)?t:yt(t);if(n.candidateNames.size===0||!n.hasUsableCandidate)return!0;if(n.candidateNames.size<=wi){for(let i of n.candidateNames)if(i){if(Rn.test(i)){if(Ci(i).test(e))return!0;continue}if(e.includes(i))return!0}return!1}xn.lastIndex=0;let r;for(;(r=xn.exec(e))!==null;)if(n.candidateNames.has(r[0]))return!0;for(let i of n.nonIdentifierNames)if(e.includes(i))return!0;return!1}function Ni(e){return"candidateNames"in e}function Ci(e){return new RegExp(`(?<![A-Za-z_$0-9])${nn(e)}(?![A-Za-z_$0-9])`)}var Fi=$("source-import-paths-by-local-name",{clearGroups:["whole-project","source-file"]});function Nn(e,t){let n=Xt(t);return Fi.get(e,n,()=>_i(e,n))}function _i(e,t){let n=new Map;for(let r of A(e,t)){if(!r.sourcePath)continue;let i=r.localName??r.importedName;if(i&&wn(n,i,r.sourcePath),r.kind==="namespace")for(let o of r.usedMembers)wn(n,o,r.sourcePath)}return n}function wn(e,t,n){let r=e.get(t);r||(r=new Set,e.set(t,r)),r.add(n)}function gt(e,t,n){let r=ft(e).get(n);if(!r||r.length===0)return[];if(r.length===1)return[Se(r[0])];let i=r.filter(l=>l.file===t);if(i.length>0)return i.map(Se);let o=Nn(e,t),a=o.get(n);if(a)for(let l of a){let c=r.filter(u=>te(l,u.file));if(c.length>0)return c.map(Se)}let s=new Set;for(let l of o.values())for(let c of l)s.add(c);for(let l of s){let c=r.filter(u=>te(l,u.file));if(c.length>0&&c.length===r.length)return c.map(Se)}return[]}function El(e,t,n){let r=gt(e,t,n);if(r.length>0)return r;let i=ft(e).get(n);return!i||i.length===0?[]:i.map(Se)}function Cn(e,t,n={}){let r=Ei(e,t);if(!r)return[];let i=be(e,t);if(n.semantic!==!1&&n.semanticEvidence){let a=n.semanticEvidence.references(e,{...i,leaf:r.identifier,parentTypeName:null,isFunctionLike:!1,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null});if(a.length>0){let s=new Map;for(let l of a){let c=s.get(l.file)??[];c.push(l.line),s.set(l.file,c)}return Ge(e,s)}}let o=new Map;for(let a of z(e)){let s=Pi(e,r,a);s.length>0&&o.set(a,s)}return Ge(e,o)}function Ei(e,t){let n=be(e,t);if(!n)return null;let r=M(n.symbol);return r?{symbolId:n.symbolId,relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,identifier:r}:null}function Pi(e,t,n){let r=L(e,n);return!r||r.indexOf(t.identifier)===-1?[]:n!==t.relativePath&&!gt(e,n,t.identifier).some(o=>o.symbolId===t.symbolId)?[]:qe(e,n,t.identifier,n===t.relativePath?{excludeStartLine:t.startLine,excludeEndLine:t.endLine}:{})}function Pl(e,t,n={}){let r=new Map;for(let l of t){if(!l.leaf)continue;let c=r.get(l.leaf)??[];c.push(l),r.set(l.leaf,c)}if(r.size===0)return new Map;let i=new Set(t.map(l=>l.symbolId)),o=new Set(r.keys()),a=yt(o),s=new Map;for(let l of z(e)){if(n.skipPath?.(l)||!In(L(e,l),a))continue;let c=vn(e,l);if(c.size!==0){for(let u of c)if(r.has(u))for(let d of gt(e,l,u)){if(!i.has(d.symbolId)||l===d.relativePath)continue;let p=s.get(d.symbolId);p||(p=new Set,s.set(d.symbolId,p)),p.add(l)}}}return s}function Se(e){return{symbolId:e.symbolId,symbol:e.symbol,relativePath:e.file}}function Ge(e,t){let n=[],r=new Set;for(let[i,o]of t){let a=C(e,i);for(let s of o){let l=oe(a,s),c=`${i}|${s}|${l?.symbol??""}`;r.has(c)||(r.add(c),n.push({file:i,line:s,enclosingSymbol:l?.symbol??null}))}}return n}function Bl(e,t){return ze(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT
35
35
  m.symbol_id,
36
36
  d.relative_path,
37
37
  COUNT(*) AS ref_count
@@ -41,16 +41,16 @@ import{a as Vt,b as Ht}from"./chunk-7MGU3HPH.js";import{A as rn,D,E as on,F as U
41
41
  WHERE m.role != 1
42
42
  ${r}
43
43
  ${e.pathExclusionsFor("d")}
44
- GROUP BY m.symbol_id, d.relative_path`,...n??[])})}function Bl(e,t){return ze(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id, d.relative_path
44
+ GROUP BY m.symbol_id, d.relative_path`,...n??[])})}function Tl(e,t){return ze(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id, d.relative_path
45
45
  FROM mentions m
46
46
  JOIN chunks c ON m.chunk_id = c.id
47
47
  JOIN documents d ON c.document_id = d.id
48
48
  WHERE m.role != 1
49
49
  ${r}
50
- ${e.pathExclusionsFor("d")}`,...n??[])}).filter(n=>n.symbol_id!==null)}function Tl(e,t){return ze(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id
50
+ ${e.pathExclusionsFor("d")}`,...n??[])}).filter(n=>n.symbol_id!==null)}function kl(e,t){return ze(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id
51
51
  FROM mentions m
52
52
  WHERE m.role != 1
53
- ${r}`,...n??[])}).filter(n=>n.symbol_id!==null)}function Cn(e,t){return ze(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id, d.relative_path, c.document_id,
53
+ ${r}`,...n??[])}).filter(n=>n.symbol_id!==null)}function Fn(e,t){return ze(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id, d.relative_path, c.document_id,
54
54
  c.start_line AS chunk_start, c.end_line AS chunk_end
55
55
  FROM mentions m
56
56
  JOIN chunks c ON m.chunk_id = c.id
@@ -58,16 +58,16 @@ import{a as Vt,b as Ht}from"./chunk-7MGU3HPH.js";import{A as rn,D,E as on,F as U
58
58
  WHERE m.role != 1
59
59
  ${r}
60
60
  ${e.pathExclusionsFor("d")}
61
- ORDER BY d.relative_path, c.start_line`,...n??[])})}function ze(e,t,n){if(!t)return n();if(t.length===0)return[];let r=[];for(let i=0;i<t.length;i+=750)r.push(...n(t.slice(i,i+750)));return r}function Pi(e,t){return Li(e,[t]).get(t.symbolId)??[]}function Li(e,t){let n=t.map(o=>({symbolId:o.symbolId,prelude:Ai(e,o)})).filter(o=>o.prelude!==null),r=Ti(e,n.map(o=>o.symbolId)),i=new Map;for(let{symbolId:o,prelude:a}of n){let s=Bi(e,r.get(o)??new Map,a.match,a.identifier);i.set(o,Ge(e,s))}return i}function jl(e,t,n={}){return ht(e,t,n).map(r=>({file:r.file,line:r.line,enclosingSymbol:r.enclosingSymbol}))}function ht(e,t,n={}){let r=Nn(e,t,{semantic:n.semantic,semanticEvidence:n.semanticEvidence}),i=r.length>0?Fn(r,"source-attribution"):Fn(Pi(e,t),"scip-reference-chunk");return n.includeIgnored===!0?i:i.filter(o=>!e.isIgnored(o.file))}function Fn(e,t){return e.map(n=>({...n,provenance:t}))}function Bi(e,t,n,r){let i=new Map;for(let[o,a]of t)i.set(o,ki(e,o,a,n,r));return i}function Ti(e,t){let n=new Map;for(let r of Cn(e,t)){if(e.isIgnored(r.relative_path))continue;let i=n.get(r.symbol_id);i||(i=new Map,n.set(r.symbol_id,i));let o=i.get(r.relative_path);o||(o=[],i.set(r.relative_path,o)),o.push({start_line:r.chunk_start,end_line:r.chunk_end})}return n}function ki(e,t,n,r,i){let o=t===r.relativePath?{excludeStartLine:r.startLine,excludeEndLine:r.endLine}:{},a=i?qe(e,t,i,o):[];return n.flatMap(s=>$i(a,s))}function $i(e,t){let n=e.filter(r=>r>=t.start_line&&r<=t.end_line);return n.length>0?n:[t.start_line]}function Ai(e,t){let n=Se(e,t);return n?{match:n,identifier:M(n.symbol)||null}:null}function _n(e){let t=Xt(e);return Di(t)?"test":Mi(t)?"worker":Oi(t)?"entry":ji(t)?"barrel":"source"}function Di(e){return!!(/\.(?:test|spec)\.[a-z0-9]+$/i.test(e)||/(?:^|\/)(?:_)?test_[^/]+$/i.test(e)||/(?:^|\/)spec_[^/]+$/i.test(e)||/(?:^|\/)[^/]+_test\.[a-z0-9]+$/i.test(e)||/(?:^|\/)[^/]+_tests\.rs$/i.test(e)||/(?:^|\/)tests\.rs$/i.test(e)||/(?:^|\/)[^/]+_spec\.[a-z0-9]+$/i.test(e)||/(?:^|\/)__tests__\//i.test(e)||/(?:^|\/)test\//i.test(e)||/(?:^|\/)tests\//i.test(e)||/(?:^|\/)__fixtures__\//i.test(e)||/(?:^|\/)__mocks__\//i.test(e)||/(?:^|\/)test-support\//i.test(e)||/(?:^|\/)test-utils\//i.test(e)||/(?:^|\/)testing\//i.test(e))}function Mi(e){return/(?:^|\/)[^/]*worker\.(?:ts|tsx|js|mjs|cjs|rs|py|go)$/.test(e)}function Oi(e){let t=e.split("/"),n=t[t.length-1]??e;return n==="cli.ts"||n==="cli.js"||n==="postinstall.ts"||n==="postinstall.js"||n==="main.ts"||n==="main.js"||n==="main.rs"||n==="main.go"||n==="main.py"||n==="build.rs"||n==="lib.rs"||/\bsrc\/bin\/[^/]+\.rs$/.test(e)||/(?:^|\/)examples\/[^/]+\.rs$/.test(e)||/(?:^|\/)tests\/[^/]+\.rs$/.test(e)||/(?:^|\/)benches\/[^/]+\.rs$/.test(e)?!0:n==="index.ts"||n==="index.js"?/(?:^|\/)(?:apps|services)\/[^/]+\/src\/index\.(?:ts|js)$/.test(e)?!0:t.length<=2:!1}function ji(e){return e==="index.ts"||e==="index.js"||e.endsWith("/index.ts")||e.endsWith("/index.js")||e.endsWith("/mod.rs")||e.endsWith("/__init__.py")}var Vi=4;function Q(e,t,n,r={}){return En(e,t,n,r.maxReexportDepth??Vi,0,new Set)}function En(e,t,n,r,i,o){let a=`${t}\0${n}`;if(o.has(a)||i>r)return[];o.add(a);let s=C(e,t).filter(l=>l.leaf===n);return s.length>0?s:ne(e,t).flatMap(l=>l.sourcePath?l.kind==="named"&&!l.names.includes(n)?[]:En(e,l.sourcePath,n,r,i+1,new Set(o)):[])}import{createHash as mr}from"crypto";import{createHash as ao}from"crypto";var Ue=8;function ce(e,t,n){return Rt(Pn(e,t,vt(n),0,new Set))}function xt(e,t,n){return St(e,t,n,0,new Set)}function Pn(e,t,n,r,i){if(r>Ue)return[];let o=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n);return o?Ln(e,t,o[1],o[2],r,i):/^[A-Za-z_$][\w$]*$/u.test(n)?Bn(e,t,n,r,i):[]}function Ln(e,t,n,r,i,o){let a=[];for(let s of St(e,t,n,i+1,new Set(o))){let l=Ui(s.initializer);for(let c of l.namedChildren){if(c.type==="pair"){let u=c.childForFieldName("key")??c.namedChild(0);if(Wi(u)!==r)continue;let d=c.childForFieldName("value")??c.namedChild(1);d&&a.push(...Pn(e,s.definition.relativePath,vt(d.text),i+1,new Set(o)));continue}if(/(?:method|function)/u.test(c.type)){if((c.childForFieldName("name")??c.namedChild(0))?.text!==r)continue;let d=Gi(e,s.definition.relativePath,r,c);a.push(...d.length>0?d:[Hi(s.definition,r,c)]);continue}if(c.type==="spread_element"){let u=c.namedChild(0);if(!u)continue;for(let d of St(e,s.definition.relativePath,vt(u.text),i+1,new Set(o)))a.push(...Ln(e,d.definition.relativePath,d.definition.leaf,r,i+1,new Set(o)))}}}return Rt(a)}function Hi(e,t,n){return{documentId:e.documentId,symbolId:-1,symbol:`source-callable:${e.relativePath}:${n.startPosition.row}:${t}`,relativePath:e.relativePath,startLine:n.startPosition.row,startChar:n.startPosition.column,endLine:n.endPosition.row,endChar:n.endPosition.column,leaf:t,parentTypeName:e.leaf,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:e.symbol}}function St(e,t,n,r,i){return r>Ue||!/^[A-Za-z_$][\w$]*$/u.test(n)?[]:Bn(e,t,n,r,i).flatMap(o=>{let a=D(e,o.relativePath)?.rootNode,s=a?zi(a,o.leaf):null;return s?[{definition:o,initializer:s}]:[]})}function Bn(e,t,n,r,i){if(r>Ue)return[];let o=`${t}\0${n}`;if(i.has(o))return[];i.add(o);let a=C(e,t).filter(c=>c.leaf===n);if(a.length>0)return a;let s=qi(e,t,n);if(s.length>0)return s;let l=A(e,t).find(c=>c.localName===n&&c.sourcePath);if(l?.sourcePath){let c=l.kind==="namespace"||l.importedName==="default"?n:l.importedName;return bt(e,l.sourcePath,c,r+1,new Set(i))}return bt(e,t,n,r+1,new Set(i))}function qi(e,t,n){let r=e.get("SELECT id FROM documents WHERE relative_path = ?",t)?.id;return r===void 0?[]:(U(e,t)?.callables??[]).filter(i=>i.name===n).map(i=>({documentId:r,symbolId:-1,symbol:`source-callable:${t}:${i.startLine}:${n}`,relativePath:t,startLine:i.startLine,startChar:0,endLine:i.endLine,endChar:0,leaf:n,parentTypeName:null,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null}))}function bt(e,t,n,r,i){if(r>Ue)return[];let o=C(e,t).filter(a=>a.leaf===n);return o.length>0?o:Rt(ne(e,t).flatMap(a=>a.sourcePath?a.kind==="named"&&!a.names.includes(n)?[]:bt(e,a.sourcePath,n,r+1,new Set(i)):[]))}function Gi(e,t,n,r){return C(e,t).filter(i=>i.leaf===n&&i.startLine<=r.startPosition.row&&i.endLine>=r.endPosition.row)}function zi(e,t){let n=null;return Tn(e,r=>{n||r.type!=="variable_declarator"||(r.childForFieldName("name")??r.namedChild(0))?.text.trim()!==t||(n=r.childForFieldName("value")??r.namedChild(1))}),n}function Ui(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function Wi(e){return e?.text.replace(/^['"`]|['"`]$/gu,"")??null}function vt(e){return e.replace(/\s+/gu,"").replace(/^\.\.\./u,"")}function Rt(e){return[...new Map(e.map(t=>[t.symbol,t])).values()]}function Tn(e,t){t(e);for(let n of e.namedChildren)Tn(n,t)}function We(e){let t=e.replaceAll("\\","/");return _n(t)==="test"?/(?:^|\/)__fixtures__\//iu.test(t)?"fixture":"test":/(?:^|\/)(?:fixtures?|testdata)\//iu.test(t)?"fixture":/(?:^|\/)(?:examples?|demos?|previews?)\//iu.test(t)?"example":/(?:^|\/)(?:generated|dist|build|coverage)\//iu.test(t)||/\.generated\./iu.test(t)?"generated":/^(?:scripts?|tools?)\//iu.test(t)?"script":"production"}var Ki=8;function V(e,t){return t?ue(e,t,0,new Set):null}function ue(e,t,n,r){if(n>Ki)return q(t,"value-evaluation-depth");let i=$n(t),o=eo(i);if(o)return to(e.file,i,o.term,o.value,o.precision);if(i.type==="binary_expression"&&/\+/u.test(i.text)){let l=i.namedChildren.map(c=>ue(e,c,n+1,new Set(r)));if(l.length>=2&&l.every(c=>c!==null)){let c={kind:"concat",parts:l.map(d=>d.term)},u=l.map(d=>d.value).join("");return no(e.file,i,c,u,l.some(d=>d.precision!=="literal")?"constrained-pattern":"literal",l)}}let a=i.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(a))return Ji(e,a,i,n,r);let s=ro(i);return s?Yi(e,s.base,s.properties,i,n,r):i.type==="call_expression"||i.type==="call"?Zi(e,i,n,r):q(i,`unsupported-expression:${i.type}`)}function Zi(e,t,n,r){let o=(t.childForFieldName("function")??t.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<.*>$/u,"")??"",a=Xi(e,o);if(a.length!==1)return q(t,a.length===0?"call-target-unresolved":"call-target-ambiguous");let s=a[0],l=`${s.relativePath}\0${s.symbol}`;if(r.has(l))return q(t,"call-return-cycle");let c=D(e.db,s.relativePath)?.rootNode;if(!c)return q(t,"call-target-unparsed");let u=oo(c,s.startLine,s.endLine);if(!u)return q(t,"call-target-syntax-unavailable");let d=Qi(u);if(!d)return q(t,"call-return-not-single-expression");let p=new Set(r);p.add(l);let f=ue({db:e.db,file:s.relativePath,root:c},d,n+1,p);return f?Ke(t,"bounded-call-return",f,s.symbol):q(t,"call-return-unresolved")}function Xi(e,t){if(/^[A-Za-z_$][\w$]*$/u.test(t)){let i=C(e.db,e.file).filter(a=>a.isFunctionLike&&a.leaf===t);if(i.length>0)return i;let o=A(e.db,e.file).find(a=>a.localName===t&&a.sourcePath&&a.kind!=="namespace");return o?.sourcePath?Q(e.db,o.sourcePath,o.importedName==="default"?t:o.importedName).filter(a=>a.isFunctionLike):[]}let n=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(t);if(!n)return[];let r=A(e.db,e.file).find(i=>i.kind==="namespace"&&i.localName===n[1]&&i.sourcePath);return r?.sourcePath?Q(e.db,r.sourcePath,n[2]).filter(i=>i.isFunctionLike):[]}function Qi(e){let t=e.childForFieldName("body");if(e.type==="arrow_function"&&t&&t.type!=="statement_block")return t;let n=[];return kn(t??e,t??e,n),n.length!==1?null:n[0].childForFieldName("argument")??n[0].namedChild(0)}function kn(e,t,n){if(!(t!==e&&(/(?:function|method|lambda)/u.test(t.type)||t.type==="arrow_function"))){if(t.type==="return_statement"){n.push(t);return}for(let r of t.namedChildren)kn(e,r,n)}}function Ji(e,t,n,r,i){let o=`${e.file}\0${t}`;if(i.has(o))return q(n,"value-cycle");i.add(o);let a=It(e.root,t);if(a){let m=ue(e,a,r+1,i);return m?Ke(n,"local-constant",m):q(n,"non-foldable-local")}let s=A(e.db,e.file).find(m=>m.localName===t&&m.sourcePath);if(!s?.sourcePath)return j(n,t,"unresolved-identifier");if(s.kind==="namespace")return j(n,t,"namespace-import-requires-property");let l=s.importedName==="default"?t:s.importedName,c=Q(e.db,s.sourcePath,l);if(c.length!==1)return j(n,t,c.length===0?"import-definition-missing":"import-definition-ambiguous");let u=c[0],d=D(e.db,u.relativePath)?.rootNode;if(!d)return j(n,u.symbol,"import-definition-unparsed");let p=It(d,u.leaf);if(!p)return j(n,u.symbol,"import-definition-non-value");let f=ue({db:e.db,file:u.relativePath,root:d},p,r+1,i);return f?Ke(n,"imported-constant",f,u.symbol):j(n,u.symbol,"import-value-unresolved")}function Yi(e,t,n,r,i,o){let a=A(e.db,e.file).find(f=>f.localName===t&&f.sourcePath),s=e.file,l=t,c;if(a?.sourcePath){a.kind==="namespace"?(l=n[0]??"",n=n.slice(1)):l=a.importedName==="default"?t:a.importedName;let f=Q(e.db,a.sourcePath,l);if(f.length!==1)return j(r,`${t}.${n.join(".")}`,f.length===0?"member-definition-missing":"member-definition-ambiguous");s=f[0].relativePath,l=f[0].leaf,c=f[0].symbol}let u=s===e.file?e.root:D(e.db,s)?.rootNode;if(!u)return j(r,c??t,"member-definition-unparsed");let d=It(u,l);if(!d)return j(r,c??t,"member-base-non-value");for(let f of n){let m=$n(d);if(d=io(m,f),!d)return j(r,c??`${t}.${n.join(".")}`,`member-property-missing:${f}`)}let p=ue({db:e.db,file:s,root:u},d,i+1,o);return p?Ke(r,"member-constant",p,c):j(r,c??t,"member-value-unresolved")}function eo(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);if(n!=="`"||!r.includes("${"))return{term:{kind:"literal",value:r},value:r,precision:"literal"};let i=[],o=0,a=/\$\{([^}]*)\}/gu;for(let s of r.matchAll(a)){let l=s.index??0;l>o&&i.push({kind:"literal",value:r.slice(o,l)}),i.push({kind:"unknown",reason:`template-hole:${s[1]?.trim()||"expression"}`}),o=l+s[0].length}return o<r.length&&i.push({kind:"literal",value:r.slice(o)}),{term:{kind:"pattern",language:"template",value:r.replace(a,"{}")},value:r.replace(a,"{}"),precision:"constrained-pattern"}}function to(e,t,n,r,i){return{value:r,evidence:"literal",term:n,precision:i,derivation:Ze("direct-literal","direct",e,t)}}function no(e,t,n,r,i,o){return{value:r,evidence:"constant",term:n,precision:i,derivation:{...Ze("constant-concatenation","mechanically-derived",e,t),inputFactIds:o.flatMap(a=>a.derivation.inputFactIds),sourceSpans:o.flatMap(a=>a.derivation.sourceSpans)}}}function Ke(e,t,n,r){return n.evidence==="expression"?{...n,derivation:{kind:"heuristic",rule:t,ruleVersion:"1",inputFactIds:[...n.derivation.inputFactIds,...r?[r]:[]],sourceSpans:n.derivation.sourceSpans}}:{...n,evidence:"constant",derivation:{kind:"mechanically-derived",rule:t,ruleVersion:"1",inputFactIds:[...n.derivation.inputFactIds,...r?[r]:[]],sourceSpans:n.derivation.sourceSpans}}}function j(e,t,n){return{value:e.text.trim(),evidence:"expression",term:{kind:"symbol",symbol:t},precision:"symbolic",derivation:Ze(n,"heuristic","",e)}}function q(e,t){return{value:e.text.trim(),evidence:"expression",term:{kind:"unknown",reason:t},precision:"unknown",derivation:Ze(t,"heuristic","",e)}}function Ze(e,t,n,r){return{kind:t,rule:e,ruleVersion:"1",inputFactIds:[],sourceSpans:n?[{file:n,startLine:r.startPosition.row,endLine:r.endPosition.row}]:[]}}function ro(e){let t=e.text.replace(/\s+/gu,"");if(!/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/u.test(t))return null;let[n,...r]=t.split(".");return n?{base:n,properties:r}:null}function It(e,t){let n=null;return wt(e,r=>{if(n||r.type!=="variable_declarator"||(r.childForFieldName("name")??r.namedChild(0))?.text.trim()!==t)return;let o=r.parent;!o||o.type!=="lexical_declaration"||!/^\s*(?:export\s+)?const\b/u.test(o.text)||(n=r.childForFieldName("value")??r.namedChild(1))}),n}function io(e,t){for(let n of e.namedChildren)if(!(n.type!=="pair"||(n.childForFieldName("key")??n.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")!==t))return n.childForFieldName("value")??n.namedChild(1);return null}function $n(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function oo(e,t,n){let r=null;return wt(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function wt(e,t){t(e);for(let n of e.namedChildren)wt(n,t)}var On=new Set(["delete","get","head","options","patch","post","put"]),so=/(?:^|\.)(?:app|router|server)$/u,lo=new Set(["findFirst","findMany","findUnique","from","get","select"]),co=new Set(["create","delete","insert","remove","update","upsert"]),uo=new Set(["execute","query","raw"]),Ft=[yo(),mo(),po(),go(),So(),bo(),xo()],Ct=new Set(["exec","execFile","execFileSync","execSync","fork","spawn","spawnSync"]);function po(){return{id:"builtin.node-child-process",supports:e=>/(?:from\s*|require\s*\(\s*)['"](?:node:)?child_process['"]/u.test(e)&&/\b(?:exec|execFile|execFileSync|execSync|fork|spawn|spawnSync)\s*\(/u.test(e),extract:e=>{let t=fo(e.source),n=[];return H(e.root,r=>{if(r.type!=="call_expression")return;let i=Re(r);if(!i)return;let o=t.direct.get(i),a=/^(.*?)\.([A-Za-z_$][\w$]*)$/u.exec(i),s=a&&t.namespaces.has(a[1])?a[2]:null,l=o??s;if(!l||!Ct.has(l))return;let c=J(r),u=O(c[0],e)??{value:c[0]?.text.trim()||"<missing>",evidence:"expression"},d=["exec","execFile","execFileSync","execSync"].includes(l)?"process.exec":"process.spawn";n.push(T(e,r,"builtin.node-child-process",d,[{name:"operation",value:l,evidence:"literal"},{name:"executable",...u}],"exact","node-child-process-import"))}),n}}}function fo(e){let t=new Map,n=new Set,r=String.raw`['"](?:node:)?child_process['"]`,i=new RegExp(String.raw`\bimport\s*\{([^}]*)\}\s*from\s*${r}`,"gu");for(let l of e.matchAll(i))for(let c of(l[1]??"").split(",")){let u=/^\s*([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?\s*$/u.exec(c);u&&Ct.has(u[1])&&t.set(u[2]??u[1],u[1])}let o=new RegExp(String.raw`\b(?:const|let)\s*\{([^}]*)\}\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let l of e.matchAll(o))for(let c of(l[1]??"").split(",")){let u=/^\s*([A-Za-z_$][\w$]*)(?:\s*:\s*([A-Za-z_$][\w$]*))?\s*$/u.exec(c);u&&Ct.has(u[1])&&t.set(u[2]??u[1],u[1])}let a=new RegExp(String.raw`\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*${r}`,"gu");for(let l of e.matchAll(a))n.add(l[1]);let s=new RegExp(String.raw`\b(?:const|let)\s+([A-Za-z_$][\w$]*)\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let l of e.matchAll(s))n.add(l[1]);return{direct:t,namespaces:n}}function k(e,t){let n=D(e,t)?.rootNode;if(!n)return null;let r=L(e,t),i=C(e,t),o=U(e,t)?.callables??[];return{db:e,file:t,source:r,root:n,constants:Fo(n),ownerAt:a=>{let s=i.filter(c=>c.startLine<=a&&c.endLine>=a).sort((c,u)=>c.endLine-c.startLine-(u.endLine-u.startLine)||c.startLine-u.startLine)[0];if(s)return{file:t,symbol:s.symbol,name:s.leaf,startLine:s.startLine,endLine:s.endLine};let l=o.filter(c=>c.startLine<=a&&c.endLine>=a).sort((c,u)=>c.endLine-c.startLine-(u.endLine-u.startLine)||c.startLine-u.startLine)[0];return{file:t,symbol:null,name:l?.name??null,startLine:l?.startLine??a,endLine:l?.endLine??a}}}}function mo(){return{id:"builtin.effect-httpapi",supports:e=>ve(e,"HttpApiEndpoint").size>0||ve(e,"HttpApiBuilder").size>0,extract:e=>{let t=[],n=ve(e.source,"HttpApiEndpoint"),r=ve(e.source,"HttpApiGroup"),i=ve(e.source,"HttpApiBuilder");return H(e.root,o=>{if(o.type!=="call_expression")return;let a=jn(o);if(!a)return;let s=J(o);if(n.has(a.receiver)&&On.has(a.member)){let g=O(s[0],e),b=O(s[1],e),h=Dn(o,r,"make",0,e);if(!g||!b||!h)return;let v=a.member.toUpperCase();t.push(T(e,o,"builtin.effect-httpapi","http.handle",[{name:"method",value:v,evidence:"literal"},{name:"path",...b}],G([{name:"path",...b}]),"effect-httpapi-endpoint-declaration")),t.push(T(e,o,"builtin.effect-httpapi","framework.declare",Nt(h,g),G(Nt(h,g)),"effect-httpapi-operation-declaration"));return}if(!["handle","handleRaw"].includes(a.member))return;let l=Dn(o,i,"group",1,e),c=O(s[0],e),u=s[1];if(!l||!c||!u)return;let d=Nt(l,c),p=ce(e.db,e.file,u.text),f=T(e,o,"builtin.effect-httpapi","framework.handle",d,p.length===1?G(d):"candidate","effect-httpapi-handler-registration"),m=p[0];p.length===1&&m&&(f.owner={file:m.relativePath,symbol:m.symbol,name:m.leaf,startLine:m.startLine,endLine:m.endLine}),t.push(f)}),t}}}function Nt(e,t){return[{name:"adapter",value:"effect-httpapi",evidence:"literal"},{name:"group",...e},{name:"operation",...t}]}function ve(e,t){let n=new Set,r=/\bimport\s*\{([\s\S]*?)\}\s*from\s*['"]([^'"]+)['"]/gu;for(let o of e.matchAll(r)){let a=o[2]??"";if(An(a))for(let s of(o[1]??"").split(",")){let l=s.trim().replace(/^type\s+/u,""),c=/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/u.exec(l);c?.[1]===t&&n.add(c[2]??c[1])}}let i=/\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*['"]([^'"]+)['"]/gu;for(let o of e.matchAll(i)){let a=o[2]??"";a.endsWith(`/${t}`)&&An(a)&&n.add(o[1])}return n}function An(e){return e==="effect/unstable/httpapi"||e==="@effect/platform"||e.startsWith("@effect/platform/HttpApi")}function Dn(e,t,n,r,i){let o=e.parent;for(;o;){if(o.type==="call_expression"){let a=Mn(o,t,n,r,i);if(a)return a;let s=o.childForFieldName("function")??o.namedChild(0),l=null;if(s&&H(s,c=>{!l&&c.type==="call_expression"&&(l=Mn(c,t,n,r,i))}),l)return l}o=o.parent}return null}function Mn(e,t,n,r,i){let o=jn(e);return!o||o.member!==n||!t.has(o.receiver)?null:O(J(e)[r],i)}function jn(e){let t=e.childForFieldName("function")??e.namedChild(0);if(!t||!["member_expression","subscript_expression"].includes(t.type))return null;let n=t.childForFieldName("object")??t.namedChild(0),r=t.childForFieldName("property")??t.childForFieldName("index")??t.namedChild(1);return!n||!r?null:{receiver:n.text.replace(/\s+/gu,""),member:r.text.replace(/^['"`]|['"`]$/gu,"")}}function yo(){return{id:"builtin.http",supports:e=>/\bfetch\s*\(|\baxios\b|\b(?:app|router|server)\s*\.\s*(?:get|post|put|patch|delete|options|head)\s*\(/u.test(e)||xe(e,["axios"])||/\b(?:FastAPI|Flask|APIRouter|axum|Router::new)\b/u.test(e),extract:e=>{let t=[];return H(e.root,n=>{if(n.type==="decorator"){let p=/^@[^\s(]+\.(get|post|put|patch|delete|options|head)\s*\(\s*(['"`])([^'"`]+)\2/iu.exec(n.text.trim());if(!p||!xe(e.source,["fastapi","flask"]))return;t.push(T(e,n,"builtin.http","http.handle",[{name:"method",value:p[1].toUpperCase(),evidence:"literal"},{name:"path",value:p[3],evidence:"literal"}],"exact","framework-decorator"));return}if(n.type!=="call_expression")return;let r=Re(n);if(!r)return;let i=r.split(".").at(-1)?.toLowerCase()??"",o=r.includes(".")?r.slice(0,r.lastIndexOf(".")):"",a=J(n);if(i==="route"&&xe(e.source,["axum"])){let p=O(a[0],e),f=/^\s*(get|post|put|patch|delete|options|head)\s*\(/iu.exec(a[1]?.text??"")?.[1];if(!p||!f)return;t.push(T(e,n,"builtin.http","http.handle",[{name:"method",value:f.toUpperCase(),evidence:"literal"},{name:"path",...p}],G([{name:"path",...p}]),"framework-adapter"));return}if(r==="fetch"||r.endsWith(".fetch")){let p=O(a[0],e);if(!p)return;let m=/\bmethod\s*:\s*['"`]([A-Za-z]+)['"`]/u.exec(a[1]?.text??"")?.[1]?.toUpperCase()??(a[1]?null:"GET"),g=[...m?[{name:"method",value:m,evidence:"literal"}]:[],{name:"path",...p}];t.push(T(e,n,"builtin.http","http.request",g,m?G(g):"candidate","call-expression"));return}if(!On.has(i))return;let s=O(a[0],e);if(!s)return;let l=i.toUpperCase();if(so.test(o)&&xe(e.source,["express","fastify","hono","koa-router","@koa/router"])){t.push(T(e,n,"builtin.http","http.handle",[{name:"method",value:l,evidence:"literal"},{name:"path",...s}],G([{name:"path",...s}]),"framework-adapter"));return}let u=wo(e.source,["axios"]),d=o.split(".")[0]??"";u.has(d)&&t.push(T(e,n,"builtin.http","http.request",[{name:"method",value:l,evidence:"literal"},{name:"path",...s}],G([{name:"path",...s}]),"client-adapter"))}),t}}}function go(){return{id:"builtin.capability-registry",supports:e=>/\b(?:execute|handler|invoke|run)\s*(?:[:(])/u.test(e)||/['"`][^'"`\n]{0,256}\b[A-Za-z_$][\w$-]*\s*\(/u.test(e),extract:e=>{let t=[],n=new Set;return H(e.root,r=>{if(r.type==="pair"){let o=r.childForFieldName("key")??r.namedChild(0),a=r.childForFieldName("value")??r.namedChild(1),s=o?.text.replace(/^['"`]|['"`]$/gu,"");if(s!=="name"&&s!=="id")return;let l=Vn(a,e),c=Eo(r);if(!l||l.evidence!=="literal"||!c)return;let u=`handle\0${l.value}\0${c.startPosition.row}`;if(n.has(u))return;n.add(u),t.push(T(e,c,"builtin.capability-registry","registry.handle",[{name:"key",...l}],"exact","capability-descriptor"));return}if(!["string","string_literal","template_string"].includes(r.type))return;let i=r.text.replace(/^['"`]|['"`]$/gu,"");for(let o of i.matchAll(/\b([A-Za-z_$][\w$-]*)\s*\(/gu)){let a=o[1];if(!ho(i,a,o.index))continue;let s=`reference\0${a}\0${r.startPosition.row}`;n.has(s)||(n.add(s),t.push(T(e,r,"builtin.capability-registry","registry.reference",[{name:"key",value:a,evidence:"literal"}],"exact","capability-instruction-reference")))}}),t}}}function ho(e,t,n){if(t.includes("_")||t.includes("-"))return!0;let r=e.slice(Math.max(0,n-64),n);return/\b(?:use|call|invoke|run|via|with|read|stop)(?:\s+the)?(?:\s+(?:tool|capability|command))?\s*$/iu.test(r)}function So(){return{id:"builtin.registry",supports:e=>/(?:Handlers?|Registry|Routes?)\b/iu.test(e),extract:e=>{let t=[];return H(e.root,n=>{if(n.type==="pair"){let o=_o(n);if(!o)return;let a=n.childForFieldName("key")??n.namedChild(0),s=n.childForFieldName("value")??n.namedChild(1),l=Vn(a,e);if(!l||!s||!Hn(s))return;let c=_t(s)?"exact":"candidate";t.push(T(e,n,"builtin.registry","registry.handle",[{name:"registry",value:o,evidence:"identifier"},{name:"key",...l}],G([{name:"key",...l}],c),"object-member"));return}if(n.type!=="call_expression")return;let r=n.childForFieldName("function")??n.namedChild(0);if(!r)return;let i=/^([A-Za-z_$][\w$]*)\s*\[\s*(['"`])([^'"`]+)\2\s*\]$/u.exec(r.text.trim());i&&t.push(T(e,n,"builtin.registry","registry.dispatch",[{name:"registry",value:i[1],evidence:"identifier"},{name:"key",value:i[3],evidence:"literal"}],"exact","indexed-access-call"))}),t}}}function bo(){return{id:"builtin.persistence",supports:e=>/\b(?:db|database|prisma|drizzle|[A-Za-z_$][\w$]*(?:Repository|Repo))\b[^;]{0,1024}?\.\s*(?:findFirst|findMany|findUnique|from|get|select|create|delete|insert|remove|update|upsert|execute|query|raw|transaction)(?:\s*<[^()]{1,512}>)?\s*\(/iu.test(e),extract:e=>{let t=[],n=Lo(e.root);return H(e.root,r=>{if(r.type!=="call_expression")return;let i=Re(r);if(!i)return;let o=i.split("."),a=o.at(-1)??"",s=J(r),l=s[0]?.text??"",c=Po(a,l);if(!c)return;let u=qn(o,n);if(!u)return;let d=vo(s[0],e)??Bo(l),p=To(u,o,a,d);if(!p)return;let f=a==="insert"?"persistence-insert":c==="database.read"&&/\bFOR\s+UPDATE\s+SKIP\s+LOCKED\b/iu.test(l)?"persistence-skip-locked-claim":"persistence-adapter";t.push(T(e,r,"builtin.persistence",c,[{name:"resource",...p}],G([{name:"resource",...p}]),f))}),t}}}function vo(e,t){if(!e)return null;let n=e.text.replace(/\s+/gu,"");return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/u.test(n)?{value:n.split(".").at(-1),evidence:"identifier",term:{kind:"symbol",symbol:n}}:O(e,t)}function xo(){return{id:"builtin.queue",supports:e=>xe(e,["amqplib","bullmq","kafkajs","@aws-sdk/client-sqs","rabbitmq"])&&/\.(?:sendToQueue|consume|send|subscribe)\s*\(/u.test(e),extract:e=>{let t=[];return H(e.root,n=>{if(n.type!=="call_expression")return;let r=Re(n);if(!r)return;let i=r.split(".").at(-1)??"",o=J(n),a=i==="sendToQueue"||i==="send"?"queue.send":i==="consume"||i==="subscribe"?"queue.consume":null;if(!a)return;let s=i==="send"||i==="subscribe"?No(o[0],"topic",e):O(o[0],e);s&&t.push(T(e,n,"builtin.queue",a,[{name:"address",...s}],G([{name:"address",...s}]),"framework-adapter"))}),t}}}function T(e,t,n,r,i,o,a){let s=e.ownerAt(t.startPosition.row),l=JSON.stringify({extractor:n,action:r,file:e.file,line:t.startPosition.row,keyParts:i});return{id:`boundary:${ao("sha256").update(l).digest("hex").slice(0,16)}`,extractor:n,action:r,owner:s,source:{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},keyParts:i,evidence:a,strength:o,protocol:r.split(".")[0]??r,role:Ro(r),executionDomain:Io(e.file),derivation:{kind:o==="candidate"?"heuristic":o==="derived"?"mechanically-derived":"direct",rule:a,ruleVersion:"1",inputFactIds:i.flatMap(c=>c.derivation?.inputFactIds??[]),sourceSpans:[{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},...i.flatMap(c=>c.derivation?.sourceSpans??[])]},valuePrecision:i.some(c=>c.evidence==="expression")?"unknown":i.some(c=>c.evidence==="identifier")?"symbolic":"literal",modality:"may",resolution:"unresolved",sourceScope:We(e.file)}}function Ro(e){let t=e.split(".").at(-1)??e;return["handle","subscribe","consume","read"].includes(t)?"consumer":["request","publish","send","write","dispatch","reference","invoke","spawn","exec"].includes(t)?"producer":"observe"}function Io(e){let t=e.replaceAll("\\","/"),n=/^(apps|services|packages)\/([^/]+)/u.exec(t);return n?`${n[1]}/${n[2]}`:null}function xe(e,t){return t.some(n=>{let r=n.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`(?:\\bfrom\\s+${r}\\b|\\buse\\s+${r}\\b|(?:\\bfrom\\s*|\\brequire\\s*\\(\\s*)['"]${r}(?:[/']|"))`,"u").test(e)})}function wo(e,t){let n=new Set;for(let r of t){let i=r.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),o=new RegExp(`(?:import\\s+([A-Za-z_$][\\w$]*)[^;]*?\\sfrom\\s*|(?:const|let)\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*require\\s*\\(\\s*)['"]${i}(?:[/']|")`,"gu");for(let a of e.matchAll(o)){let s=a[1]??a[2];s&&n.add(s)}}return n}function Xe(e,t,n,r,i,o,a){return T(e,t,n,r,i,o,a)}function Re(e){return(e.childForFieldName("function")??e.namedChild(0))?.text.replace(/\s+/gu,"")??null}function J(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function O(e,t){let n=V(t,e);return n?{value:n.value,evidence:n.evidence,term:n.term,derivation:n.derivation}:null}function No(e,t,n){if(!e)return null;let r=e.namedChildren.find(o=>o.type!=="pair"?!1:(o.childForFieldName("key")??o.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")===t),i=r?.childForFieldName("value")??r?.namedChild(1);return O(i,n)}function Vn(e,t){if(!e)return null;let n=O(e,t);if(n?.evidence==="literal"||n?.evidence==="constant")return n;let r=e.text.trim();return/^[A-Za-z_$][\w$]*$/u.test(r)?{value:r,evidence:"identifier",term:{kind:"symbol",symbol:r}}:n}function G(e,t="exact"){return t==="candidate"||e.some(n=>n.evidence==="expression")?"candidate":t==="derived"||e.some(n=>n.evidence==="constant")?"derived":"exact"}function Co(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);return n==="`"&&r.includes("${")?null:r}function Fo(e){let t=new Map;return H(e,n=>{if(n.type!=="variable_declarator")return;let r=n.childForFieldName("name")??n.namedChild(0),i=n.childForFieldName("value")??n.namedChild(1);if(!r||!i||!/^[A-Za-z_$][\w$]*$/u.test(r.text))return;let o=Co(i);o!==null&&t.set(r.text,o)}),t}function _o(e){let t=e.parent,n=t?.parent??null;for(;n&&["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(n.type);)n=n.parent;if(!t||!n||n.type!=="variable_declarator")return null;let i=(n.childForFieldName("name")??n.namedChild(0))?.text??"";return/(?:handlers?|registry|routes?)$/iu.test(i)?i:null}function _t(e){return/(?:function|lambda|method)/u.test(e.type)||e.type==="arrow_function"}function Hn(e){return _t(e)||e.type==="member_expression"?!0:e.type==="identifier"&&/(?:command|controller|dispatch|handle|handler)/iu.test(e.text)}function Eo(e){let t=e.parent;for(;t&&t.type!=="variable_declarator";){if(["object","object_literal","dictionary"].includes(t.type))for(let n of t.namedChildren){if(n.type==="pair"){let i=n.childForFieldName("key")??n.namedChild(0),o=n.childForFieldName("value")??n.namedChild(1),a=i?.text.replace(/^['"`]|['"`]$/gu,"");if(a&&["execute","handler","invoke","run"].includes(a)&&o&&Hn(o))return t}let r=n.childForFieldName("name")??n.namedChild(0);if(r&&["execute","handler","invoke","run"].includes(r.text.replace(/^['"`]|['"`]$/gu,""))&&/(?:function|method)/u.test(n.type))return t}t=t.parent}return null}function qn(e,t=new Set){let n=e.slice(0,-1).map(r=>r.replace(/\([^)]*\)/gu,""));return n.some(r=>/^(?:prisma|drizzle)$/iu.test(r))?"orm":n.some(r=>/(?:Repository|Repo)$/u.test(r))?"repository":n.some(r=>/^(?:db|database)$/iu.test(r)||t.has(r))?"database":null}function Po(e,t){if(lo.has(e))return"database.read";if(co.has(e))return"database.write";if(!uo.has(e))return null;let n=/\b(SELECT|INSERT|UPDATE|DELETE)\b/iu.exec(t)?.[1]?.toUpperCase();return n==="SELECT"?"database.read":n?"database.write":null}function Lo(e){let t=new Set;return H(e,n=>{if(n.type!=="call_expression")return;let r=Re(n);if(!r)return;let i=r.split(".");if(!(i.at(-1)!=="transaction"||!qn(i)))for(let o of J(n)){if(!_t(o))continue;let s=(o.childForFieldName("parameters")??o.namedChildren.find(c=>/parameters/u.test(c.type)))?.namedChildren[0],l=s?Gn(s):null;l&&t.add(l)}}),t}function Gn(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?Gn(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function Bo(e){let t=zn(e);return t?{value:t,evidence:"identifier",term:{kind:"symbol",symbol:t}}:null}function To(e,t,n,r){if(e==="orm"&&t.length>=3)return{value:t.at(-2).replace(/\([^)]*\)/gu,""),evidence:"identifier"};if(e==="repository"){let o=t.at(-2)?.replace(/(?:Repository|Repo)$/u,"");return o?{value:o,evidence:"identifier"}:null}if(!r)return null;if(n==="from"||n==="insert")return r;let i=zn(r.value);return i?{value:i,evidence:r.evidence}:null}function zn(e){return/\b(?:from|into|update|table)\s+(?:\$\{\s*)?['"`]?([A-Za-z_$][\w$.-]*)/iu.exec(e)?.[1]??null}function H(e,t){t(e);for(let n of e.namedChildren)H(n,t)}var ko=$("resolved-call-syntax",{clearGroups:[]}),$o=$("resolved-call-sites",{clearGroups:[]});function Ie(e,t){return $o.get(e,t.symbolId,()=>Ao(e,t))}function Ao(e,t){let n=[],r=[],i=new Set,o=new Set;for(let a of ht(e,t,{semantic:!1})){i.add(a.file);let s=ko.get(e,a.file,()=>Do(e,a.file));if(!s){r.push({callee:t,file:a.file,line:a.line,reason:"ast-unavailable",candidates:0,referenceProvenance:a.provenance});continue}let l=(s.byLeaf.get(t.leaf)??[]).filter(({callNode:d})=>d.startPosition.row<=a.line&&d.endPosition.row>=a.line);if(l.length!==1){r.push({callee:t,file:a.file,line:a.line,reason:l.length===0?"call-not-found":"ambiguous-call",candidates:l.length,referenceProvenance:a.provenance});continue}let c=l[0],u=`${a.file}\0${c.callNode.startIndex}\0${c.callNode.endIndex}`;o.has(u)||(o.add(u),n.push({callee:t,caller:oe(C(e,a.file),c.callNode.startPosition.row),file:a.file,line:a.line,startLine:c.callNode.startPosition.row,endLine:c.callNode.endPosition.row,targetText:c.targetNode.text,callNode:c.callNode,targetNode:c.targetNode,arguments:c.arguments,referenceProvenance:a.provenance}))}return{sites:n,unresolved:r,filesVisited:i.size}}function Do(e,t){let n=D(e,t)?.rootNode;if(!n)return null;let r=new Map;return Un(n,i=>{if(i.type!=="call_expression"&&i.type!=="call")return;let o=i.childForFieldName("function")??i.namedChild(0);if(!o)return;let a=on(o);if(!a)return;let s=i.childForFieldName("arguments")??i.namedChildren.find(u=>u.type==="arguments"),l={callNode:i,targetNode:o,arguments:s?.namedChildren??[]},c=r.get(a);c?c.push(l):r.set(a,[l])}),{byLeaf:r}}function Un(e,t){t(e);for(let n of e.namedChildren)Un(n,t)}var Mo=$("call-parameter-value-flow",{clearGroups:[]});function we(e,t){let n=`${t.callee.symbolId}\0${t.file}\0${t.callNode.startIndex}\0${t.callNode.endIndex}`;return Mo.get(e,n,()=>Oo(e,t))}function Ne(e,t){let n=new Set(t);return[...new Set(e.transfers.flatMap(r=>n.has(r.calleePosition)?[r.callerPosition]:[]))].sort((r,i)=>r-i)}function Oo(e,t){let n={file:t.file,startLine:t.startLine,endLine:t.endLine};if(!t.caller)return{callee:t.callee,caller:null,call:n,transfers:[],unknown:t.arguments.map((l,c)=>({calleePosition:c,argumentText:l.text.trim(),reason:"caller-unavailable",proof:n}))};let r=D(e,t.caller.relativePath)?.rootNode,i=r?jo(r,t.caller.startLine,t.caller.endLine):null;if(!i)return{callee:t.callee,caller:t.caller,call:n,transfers:[],unknown:t.arguments.map((l,c)=>({calleePosition:c,argumentText:l.text.trim(),reason:"caller-syntax-unavailable",proof:n}))};let o=Vo(i),a=[],s=[];return t.arguments.forEach((l,c)=>{let u=l.text.trim(),d=o.indexOf(u);d>=0?a.push({calleePosition:c,callerPosition:d,argumentText:u,proof:n}):s.push({calleePosition:c,argumentText:u,reason:"argument-not-direct-parameter",proof:n})}),{callee:t.callee,caller:t.caller,call:n,transfers:a,unknown:s}}function jo(e,t,n){let r=null;return Kn(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function Vo(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(Wn)??[]}function Wn(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?Wn(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function Kn(e,t){t(e);for(let n of e.namedChildren)Kn(n,t)}var Ho=8,qo=8;function Xn(e,t){let n=[],r=Go(e,n),i=r.summaries,o=zo(e,t,i,n),a=Uo(e,t,n);return{observations:ra([...o.observations,...a]),bodySummaries:i.size,discriminatorSummaries:o.summaries,filesInspected:r.filesInspected,errors:n}}function Go(e,t){let n=new Map,r=[],i=z(e);for(let o of i){let a=L(e,o);if(!/\bJSON\.stringify\s*\(/u.test(a)||!/\bbody\s*:/u.test(a))continue;let s=k(e,o);if(s)for(let[l,c]of Wo(s)){let u={definition:l,parameterIndexes:c,depth:0,proofSpans:[{file:o,startLine:l.startLine,endLine:l.endLine}]};n.set(l.symbol,u),r.push(u)}}for(;r.length>0;){let o=r.shift();if(!(o.depth>=Ho))try{for(let a of Ie(e,o.definition).sites){if(!k(e,a.file))continue;let l=a.caller;if(!l)continue;let c=Ne(we(e,a),o.parameterIndexes);if(c.length===0)continue;let u={definition:l,parameterIndexes:rr(c),depth:o.depth+1,proofSpans:[...o.proofSpans,{file:a.file,startLine:a.startLine,endLine:a.endLine}]};Qo(n,u)&&r.push(n.get(l.symbol))}}catch(a){t.push(`builtin.carrier body summary failed for ${o.definition.relativePath}: ${Bt(a)}`)}}return{summaries:n,filesInspected:i.length}}function zo(e,t,n,r){let i=new Map,o=[],a=[];for(let s of t){if(s.action!=="http.request"||s.strength==="candidate"||s.sourceScope!=="production")continue;let l=Qn(s);if(!l)continue;let c=k(e,s.source.file);if(!c)continue;let u=er(c.root,s.source.startLine),d=u.find(v=>v.startPosition.row===s.source.startLine)??u[0];if(!d)continue;let p=Lt(d);if(!p)continue;let f=ce(e,s.source.file,p.text);if(f.length!==1)continue;let m=n.get(f[0].symbol);if(!m)continue;let g=s.owner.symbol?C(e,s.owner.file).find(v=>v.symbol===s.owner.symbol):null;if(!g)continue;let b=Jo(c,g),h=Je(d);for(let v of m.parameterIndexes){let F=ea(c,h[v]);if(F)for(let x of ta(F)){let w=tr(x),y=nr(x);if(!w||!y)continue;let R=b.indexOf(y.text.trim());if(R>=0){let _={definition:g,carrier:l,field:w,parameterIndex:R,depth:0,proofObservationIds:[s.id],proofSpans:[s.source,{file:s.source.file,startLine:x.startPosition.row,endLine:x.endPosition.row}]},P=Zn(_);i.has(P)||(i.set(P,_),o.push(_));continue}let I=V(c,y);!I||I.evidence==="expression"||a.push(Pt(c,x,"carrier.publish",l,w,I.value,[s.id]))}}}for(;o.length>0;){let s=o.shift();if(!(s.depth>=qo))try{for(let l of Ie(e,s.definition).sites){let c=k(e,l.file);if(!c)continue;let u=l.callNode,d=Je(u)[s.parameterIndex];if(!d)continue;let p=V(c,d);p&&p.evidence!=="expression"&&a.push(Pt(c,u,"carrier.publish",s.carrier,s.field,p.value,s.proofObservationIds));let f=l.caller;if(!f)continue;let m=we(e,l).transfers.find(h=>h.calleePosition===s.parameterIndex)?.callerPosition;if(m===void 0)continue;let g={...s,definition:f,parameterIndex:m,depth:s.depth+1,proofSpans:[...s.proofSpans,{file:l.file,startLine:l.startLine,endLine:l.endLine}]},b=Zn(g);i.has(b)||(i.set(b,g),o.push(g))}}catch(l){r.push(`builtin.carrier discriminator summary failed for ${s.definition.relativePath}: ${Bt(l)}`)}}return{observations:a,summaries:i.size}}function Uo(e,t,n){let r=[],i=t.filter(o=>o.action==="registry.handle"&&o.strength!=="candidate"&&o.sourceScope==="production");for(let o of t){if(o.action!=="http.handle"||o.strength==="candidate"||o.sourceScope!=="production")continue;let a=Qn(o);if(!a)continue;let s=k(e,o.source.file);if(!s)continue;let l=er(s.root,o.source.startLine)[0];if(l)for(let c of Je(l).slice(1)){let u=ce(e,o.source.file,c.text);for(let d of u)try{let p=k(e,d.relativePath);if(!p)continue;let f=Qe(p.root,d.startLine,d.endLine);if(!f)continue;K(f,m=>{if(m.type!=="call_expression")return;let g=Lt(m);if(!g)return;let b=/^([A-Za-z_$][\w$]*)\s*\[\s*([A-Za-z_$][\w$]*)\s*\]$/u.exec(g.text.trim());if(!b)return;let h=b[1],v=b[2],F=Zo(e,p,d,v);if(!F)return;let x=Xo(e,d.relativePath,h);for(let w of i){let y=w.keyParts.find(P=>P.name==="registry")?.value,R=w.keyParts.find(P=>P.name==="key")?.value;if(!y||!R||!x.some(P=>P.file===w.source.file&&P.binding===y))continue;let I=k(e,w.source.file),_=I?Yo(I.root,w.source.startLine):null;!I||!_||r.push(Pt(I,_,"carrier.consume",a,F,R,[o.id,w.id]))}})}catch(p){n.push(`builtin.carrier consumer analysis failed for ${d.relativePath}: ${Bt(p)}`)}}}return r}function Wo(e){let t=C(e.db,e.file),n=new Map;return K(e.root,r=>{if(r.type!=="pair"||tr(r)?.toLowerCase()!=="body")return;let i=nr(r);if(!i||!/\bJSON\.stringify\s*\(/u.test(i.text))return;let o=oe(t,r.startPosition.row),a=Ko(r);if(!o||!a)return;let s=Jn(a),l=new Set;na(i,s,l);let c=n.get(o.symbol)??new Set;s.forEach((u,d)=>{u&&l.has(u)&&c.add(d)}),c.size>0&&n.set(o.symbol,c)}),t.flatMap(r=>{let i=n.get(r.symbol);return i?[[r,[...i].sort((o,a)=>o-a)]]:[]})}function Ko(e){let t=e.parent;for(;t;){if(/(?:function|method|lambda)/u.test(t.type)||t.type==="arrow_function")return t;t=t.parent}return null}function Zo(e,t,n,r){let i=Qe(t.root,n.startLine,n.endLine);if(!i)return null;let o=new RegExp(`\\.body\\??\\.${Et(r)}\\b`,"u");if(o.test(i.text))return r;let a=null;if(K(i,u=>{if(a||u.type!=="variable_declarator")return;let d=u.childForFieldName("name")??u.namedChild(0),p=u.childForFieldName("value")??u.namedChild(1);!d||!p||!new RegExp(`(?:^|[,{}])\\s*${Et(r)}\\s*(?:[,}]|$)`,"u").test(d.text)||p.type==="call_expression"&&(a=Lt(p)?.text??null)}),!a)return null;let s=ce(e,n.relativePath,a);if(s.length!==1)return null;let l=k(e,s[0].relativePath),c=l?Qe(l.root,s[0].startLine,s[0].endLine):null;return c&&o.test(c.text)&&new RegExp(`\\b${Et(r)}\\s*[,}]`,"u").test(c.text)?r:null}function Xo(e,t,n){let r=[];for(let i of xt(e,t,n)){let o=Ce(i.initializer);if(o.type==="call_expression")for(let a of Je(o)){let s=a.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(s))for(let l of xt(e,i.definition.relativePath,s))r.push({file:l.definition.relativePath,binding:l.definition.leaf})}}return[...new Map(r.map(i=>[`${i.file}\0${i.binding}`,i])).values()]}function Pt(e,t,n,r,i,o,a){let l=Xe(e,t,"builtin.carrier",n,[{name:"carrier",value:r,evidence:"constant",term:{kind:"literal",value:r}},{name:"field",value:i,evidence:"literal",term:{kind:"literal",value:i}},{name:"value",value:o,evidence:"constant",term:{kind:"literal",value:o}}],"derived","http-body-registry-discriminator");return l.derivation={kind:"mechanically-derived",rule:"http-body-registry-discriminator",ruleVersion:"1",inputFactIds:[...a],sourceSpans:[l.source]},l}function Qn(e){let t=e.keyParts.find(r=>r.name==="method"&&r.evidence!=="expression")?.value,n=e.keyParts.find(r=>r.name==="path"&&r.evidence!=="expression")?.value;return t&&n?`${t.toUpperCase()} ${n}`:null}function Qo(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=rr([...n.parameterIndexes,...t.parameterIndexes]);return r.length===n.parameterIndexes.length&&t.depth>=n.depth?!1:(e.set(t.definition.symbol,{...n,parameterIndexes:r,depth:Math.min(n.depth,t.depth),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0)}function Zn(e){return`${e.definition.symbol}\0${e.carrier}\0${e.field}\0${e.parameterIndex}`}function Jo(e,t){let n=Qe(e.root,t.startLine,t.endLine);return n?Jn(n):[]}function Jn(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(Yn)??[]}function Yn(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?Yn(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function Qe(e,t,n){let r=null;return K(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function Yo(e,t){let n=null;return K(e,r=>{r.startPosition.row>t||r.endPosition.row<t||(!n||r.endIndex-r.startIndex<n.endIndex-n.startIndex)&&(n=r)}),n}function er(e,t){let n=[];return K(e,r=>{r.type==="call_expression"&&r.startPosition.row<=t&&r.endPosition.row>=t&&n.push(r)}),n.sort((r,i)=>r.endIndex-r.startIndex-(i.endIndex-i.startIndex))}function Lt(e){return e.childForFieldName("function")??e.namedChild(0)}function Je(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function ea(e,t){if(!t)return null;let n=t.text.trim();if(!/^[A-Za-z_$][\w$]*$/u.test(n))return Ce(t);let r=null;return K(e.root,i=>{r||i.type!=="variable_declarator"||(i.childForFieldName("name")??i.namedChild(0))?.text.trim()!==n||(r=i.childForFieldName("value")??i.namedChild(1))}),Ce(r||t)}function ta(e){let t=Ce(e);return t.type==="object"?t.namedChildren.filter(n=>n.type==="pair"||n.type==="shorthand_property_identifier"):[]}function tr(e){return e.type==="shorthand_property_identifier"?e.text:(e.childForFieldName("key")??e.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")??null}function nr(e){return e.type==="shorthand_property_identifier"?e:e.childForFieldName("value")??e.namedChild(1)}function Ce(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function na(e,t,n){let r=new Set(e.text.match(/[A-Za-z_$][\w$]*/gu)??[]);for(let i of t)i&&r.has(i)&&n.add(i)}function rr(e){return[...new Set(e)].sort((t,n)=>t-n)}function ra(e){return[...new Map(e.map(t=>[t.id,t])).values()]}function Et(e){return e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}function Bt(e){return e instanceof Error?e.message:String(e)}function K(e,t){t(e);for(let n of e.namedChildren)K(n,t)}import{createHash as ia}from"crypto";function ir(e,t){let n=new Map;for(let o of t){if(o.action!=="http.handle"||o.sourceScope!=="production")continue;let a=n.get(o.source.file)??[];a.push(o),n.set(o.source.file,a)}let r=[],i=oa(e);for(let o of i.mounts)for(let a of o.targetFiles)for(let s of n.get(a)??[]){let l=s.keyParts.find(p=>p.name==="path");if(!l||l.evidence==="expression")continue;let c=sa(o.prefix.value,l.value),u=s.keyParts.map(p=>p.name==="path"?{name:"path",value:c,evidence:"constant",term:{kind:"concat",parts:[o.prefix.term??{kind:"literal",value:o.prefix.value},l.term??{kind:"literal",value:l.value}]},derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[s.id],sourceSpans:[s.source,{file:o.file,startLine:o.line,endLine:o.line},...o.prefix.derivation?.sourceSpans??[],...l.derivation?.sourceSpans??[]]}}:p),d=`${s.id}\0${o.file}\0${o.line}\0${c}`;r.push({...s,id:`boundary:${ia("sha256").update(d).digest("hex").slice(0,16)}`,keyParts:u,strength:"derived",evidence:"framework-mount-composition",derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[s.id],sourceSpans:[s.source,{file:o.file,startLine:o.line,endLine:o.line}]},resolution:"unresolved"}),s.strength="candidate",s.resolution="unresolved"}return{observations:r,filesInspected:i.filesInspected,mounts:i.mounts.length}}function oa(e){let t=[],n=z(e);for(let r of n){let i=L(e,r);if(!la(i))continue;let o=k(e,r);o&&or(o.root,a=>{if(a.type!=="call_expression")return;let s=a.childForFieldName("function")??a.namedChild(0);if(!s||!/\.use$/u.test(s.text.replace(/\s+/gu,"")))return;let l=ca(a);if(l.length<2)return;let c=V(o,l[0]);if(!c||c.evidence==="expression")return;let u=aa(e,r,l[1]);u.length!==0&&t.push({file:r,line:a.startPosition.row,prefix:{value:c.value,evidence:c.evidence,term:c.term,derivation:c.derivation},targetFiles:u})})}return{mounts:t,filesInspected:n.length}}function aa(e,t,n){let r=n.text.replace(/\s+/gu,""),i=/^([A-Za-z_$][\w$]*)/u.exec(r)?.[1];if(!i)return[];let o=A(e,t).find(l=>l.localName===i&&l.sourcePath);if(!o?.sourcePath)return[t];if(o.kind==="namespace")return[o.sourcePath];let a=o.importedName==="default"?i:o.importedName,s=Q(e,o.sourcePath,a);return[...new Set(s.map(l=>l.relativePath))]}function sa(e,t){let n=e==="/"?"":e.replace(/\/+$/u,""),r=t.startsWith("/")?t:`/${t}`;return`${n}${r}`||"/"}function la(e){return/(?:\bfrom\s*|\brequire\s*\(\s*)['"](?:express|fastify|hono|koa-router|@koa\/router)(?:[/']|")/u.test(e)}function ca(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function or(e,t){t(e);for(let n of e.namedChildren)or(n,t)}import{createHash as ua}from"crypto";var Tt=new Set(["DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT"]),da=8;function lr(e,t){let n=new Map,r=[],i=[],o=new Set,a=[],s=[];for(let l of t){if(l.action!=="http.request"||!l.owner.symbol||l.evidence!=="call-expression"&&l.evidence!=="client-adapter")continue;let c=C(e,l.owner.file).find(f=>f.symbol===l.owner.symbol);if(!c)continue;let u=k(e,c.relativePath);if(!u)continue;let d=ar(u,c),p={definition:c,...d,constantMethods:l.keyParts.flatMap(f=>f.name==="method"&&f.evidence!=="expression"&&Tt.has(f.value.toUpperCase())?[f.value.toUpperCase()]:[]),depth:0,proofObservationIds:[l.id],proofSpans:[l.source]};sr(n,p)&&r.push(n.get(c.symbol))}for(;r.length>0;){let l=r.shift();if(!(l.depth>=da))try{let c=Ie(e,l.definition);s.push(...c.unresolved.map(u=>pa(l,u)));for(let u of c.sites){let d=k(e,u.file);if(!d)continue;o.add(u.file);let p=u.callNode,f=ma(l,p,d);f&&i.push(f);let m=u.caller;if(!m)continue;let g=ar(d,m),b=ya(e,l,u),h={definition:m,pathParameterIndexes:Ye([...g.pathParameterIndexes,...b.pathParameterIndexes]),methodParameterIndexes:Ye([...g.methodParameterIndexes,...b.methodParameterIndexes]),constantMethods:de([...l.constantMethods,...g.constantMethods]),depth:l.depth+1,proofObservationIds:de([...l.proofObservationIds,...f?[f.id]:[]]),proofSpans:[...l.proofSpans,{file:u.file,startLine:u.startLine,endLine:u.endLine}]};sr(n,h)&&r.push(n.get(m.symbol))}}catch(c){a.push(`builtin.http-summary failed for ${l.definition.relativePath}:${l.definition.startLine+1}: ${c instanceof Error?c.message:String(c)}`)}}return{observations:i,frontiers:fa(s),summaries:n.size,filesInspected:o.size,errors:a}}function pa(e,t){let n=de([...e.pathParameterIndexes.length>0?["path"]:[],...e.methodParameterIndexes.length>0&&e.constantMethods.length!==1?["method"]:[]]),r=e.constantMethods.length===1?e.constantMethods[0]:"?",i=`${e.definition.symbol}\0${t.file}\0${t.line}\0${t.reason}`;return{observationId:`frontier:${ua("sha256").update(i).digest("hex").slice(0,16)}`,kind:"call-resolution",action:"http.request",strength:"candidate",source:{file:t.file,startLine:t.line,endLine:t.line},ownerShortName:null,address:`method=${r??"?"} path=?`,reason:`Compiler identity found a reference to ${e.definition.leaf}, but exact call recovery stopped with ${t.reason} (${t.candidates} syntax candidate(s)); HTTP value propagation did not cross this site.`,missingKeyParts:n.length>0?n:["call"],sourceScope:We(t.file)}}function fa(e){return[...new Map(e.map(t=>[t.observationId,t])).values()].sort((t,n)=>t.observationId.localeCompare(n.observationId))}function ma(e,t,n){let r=ur(t),i=e.pathParameterIndexes.flatMap(d=>{let p=V(n,r[d]);return p&&p.evidence!=="expression"&&ba(p.value)?[{index:d,value:p}]:[]}),o=e.methodParameterIndexes.flatMap(d=>{let p=V(n,r[d]),f=p?.value.toUpperCase();return p&&f&&p.evidence!=="expression"&&Tt.has(f)?[{index:d,value:{...p,value:f}}]:[]}),a=de([...e.constantMethods,...o.map(d=>d.value.value)]);if(i.length!==1||a.length!==1)return null;let s=i[0].value,l=o.find(d=>d.value.value===a[0])?.value,c=[{name:"method",value:a[0],evidence:l?"constant":"literal",term:l?.term??{kind:"literal",value:a[0]},derivation:l?.derivation},{name:"path",value:s.value,evidence:"constant",term:s.term,derivation:s.derivation}],u=Xe(n,t,"builtin.http-summary","http.request",c,"derived","compiler-resolved-http-summary");return u.derivation={kind:"mechanically-derived",rule:"compiler-resolved-http-summary",ruleVersion:"1",inputFactIds:e.proofObservationIds,sourceSpans:[...e.proofSpans,u.source]},u}function ar(e,t){let n=Sa(e.root,t.startLine,t.endLine);if(!n)return{pathParameterIndexes:[],methodParameterIndexes:[],constantMethods:[]};let r=ha(n),i=new Set,o=new Set,a=new Set;return kt(n,s=>{if(s.type==="call_expression"&&((s.childForFieldName("function")??s.namedChild(0))?.text.replace(/\s+/gu,"").split(".").at(-1)??"")==="fetch"){let f=ur(s);Fe(f[0],r,i);let m=ga(f[1],"method");if(m){Fe(m,r,o);let g=V(e,m),b=g?.value.toUpperCase();b&&g?.evidence!=="expression"&&Tt.has(b)&&a.add(b)}else Fe(f[1],r,o)}if(s.type!=="pair")return;let l=s.childForFieldName("key")??s.namedChild(0),c=s.childForFieldName("value")??s.namedChild(1),u=l?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase();(u==="url"||u==="path"||u==="endpoint")&&Fe(c,r,i),(u==="init"||u==="requestinit"||u==="options")&&Fe(c,r,o)}),{pathParameterIndexes:r.flatMap((s,l)=>s&&i.has(s)?[l]:[]),methodParameterIndexes:r.flatMap((s,l)=>s&&o.has(s)?[l]:[]),constantMethods:[...a].sort()}}function ya(e,t,n){let r=we(e,n);return{pathParameterIndexes:Ne(r,t.pathParameterIndexes),methodParameterIndexes:Ne(r,t.methodParameterIndexes)}}function sr(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=Ye([...n.pathParameterIndexes,...t.pathParameterIndexes]),i=Ye([...n.methodParameterIndexes,...t.methodParameterIndexes]),o=de([...n.constantMethods,...t.constantMethods]);return r.length!==n.pathParameterIndexes.length||i.length!==n.methodParameterIndexes.length||o.length!==n.constantMethods.length||t.depth<n.depth?(e.set(t.definition.symbol,{...n,pathParameterIndexes:r,methodParameterIndexes:i,constantMethods:o,depth:Math.min(n.depth,t.depth),proofObservationIds:de([...n.proofObservationIds,...t.proofObservationIds]),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0):!1}function ga(e,t){if(!e)return null;for(let n of e.namedChildren)if(!(n.type!=="pair"||(n.childForFieldName("key")??n.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase()!==t))return n.childForFieldName("value")??n.namedChild(1);return null}function Fe(e,t,n){if(!e)return;let r=new Set(e.text.match(/[A-Za-z_$][\w$]*/gu)??[]);for(let i of t)i&&r.has(i)&&n.add(i)}function ha(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(cr)??[]}function cr(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?cr(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function Sa(e,t,n){let r=null;return kt(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function ur(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function ba(e){return e.startsWith("/")||/^https?:\/\//iu.test(e)}function Ye(e){return[...new Set(e)].sort((t,n)=>t-n)}function de(e){return[...new Set(e)].sort()}function kt(e,t){t(e);for(let n of e.namedChildren)kt(n,t)}import{createHash as va}from"crypto";function fr(e){let t=dr(e.filter(r=>r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim")),n=dr(e.filter(r=>r.action==="database.write"&&r.evidence==="persistence-insert"));return e.flatMap(r=>r.action==="database.write"&&r.evidence==="persistence-insert"?$t(r).flatMap(i=>{let o=t.get(i)?.[0];return o?[pr(r,o,i,"queue.send")]:[]}):r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim"?$t(r).flatMap(i=>{let o=n.get(i)?.[0];return o?[pr(r,o,i,"queue.consume")]:[]}):[])}function dr(e){let t=new Map;for(let n of e)for(let r of $t(n)){let i=t.get(r);i?i.push(n):t.set(r,[n])}for(let n of t.values())n.sort((r,i)=>r.id.localeCompare(i.id));return t}function $t(e){return e.keyParts.filter(t=>t.name==="resource").map(t=>t.value)}function pr(e,t,n,r){let i=`database:${n}`,o=r==="queue.send"?"database-queue-insert":"database-queue-skip-locked-claim",a=[e.id,r,i,o].join("\0");return{...e,id:`boundary:${va("sha256").update(a).digest("hex").slice(0,16)}`,extractor:"builtin.database-queue",action:r,keyParts:[{name:"address",value:i,evidence:"identifier",term:{kind:"symbol",symbol:n},derivation:{kind:"mechanically-derived",rule:"database-work-queue.resource",ruleVersion:"1",inputFactIds:[e.id,t.id],sourceSpans:[e.source,t.source]}}],evidence:o,strength:"derived",protocol:"queue",role:r==="queue.send"?"producer":"consumer",derivation:{kind:"mechanically-derived",rule:"database-work-queue.insert-skip-locked",ruleVersion:"1",inputFactIds:[e.id,t.id],sourceSpans:[e.source,t.source]},valuePrecision:"symbolic",resolution:"unresolved"}}var At="runtime-boundaries-v15",nt=[{id:"http.method-path",protocol:"http",producerActions:["http.request"],consumerActions:["http.handle"],keyNames:["method","path"],traversable:!0},{id:"registry.identity-key",protocol:"registry",producerActions:["registry.dispatch"],consumerActions:["registry.handle"],keyNames:["registry","key"],traversable:!0},{id:"registry.capability-key",protocol:"registry",producerActions:["registry.reference"],consumerActions:["registry.handle"],keyNames:["key"],traversable:!0,requireUniqueConsumer:!0},{id:"queue.address",protocol:"queue",producerActions:["queue.send"],consumerActions:["queue.consume"],keyNames:["address"],traversable:!0},{id:"carrier.discriminator",protocol:"carrier",producerActions:["carrier.publish"],consumerActions:["carrier.consume"],keyNames:["carrier","field","value"],traversable:!0},{id:"resource.identity",protocol:"database",producerActions:["database.write"],consumerActions:["database.read"],keyNames:["resource"],traversable:!1},{id:"framework.effect-httpapi-operation",protocol:"framework",producerActions:[],consumerActions:["framework.handle"],declarationActions:["framework.declare"],keyNames:["adapter","group","operation"],traversable:!0,linkFrom:"declaration",requireUniquePair:!0}],xa=64;function Ra(e,t={}){let n=z(e),r=new Set(n),i=new Set((t.affectedFiles??[]).map(Ca)),o=t.previousGraph?.fileCoverage,a=i.size>0&&t.previousGraph?.extractorVersion===At&&o!==void 0&&o.length===t.previousGraph.coverage.filesScanned,s=a?o.filter(N=>r.has(N.file)&&!i.has(N.file)):[],l=new Set(s.flatMap(N=>N.observationIds)),c=a?t.previousGraph.observations.filter(N=>l.has(N.id)&&r.has(N.source.file)):[],u=a?n.filter(N=>i.has(N)):n,d=[],p=o?.reduce((N,st)=>N+st.observationIds.length,0)??0,f=performance.now(),m=Ia(e,u);Y(d,"direct-extraction",f,u.length,m.observations.length,{filesVisited:u.length,filesReused:s.length,factsReused:c.length,factsInvalidated:Math.max(0,p-c.length)});let g=[...s,...m.fileCoverage].sort((N,st)=>N.file.localeCompare(st.file)),b=Na(g),h=g.flatMap(N=>N.extractionErrors),v=_e([...c,...m.observations]),F=_e([...v,...fr(v)]);f=performance.now();let x=lr(e,F);Y(d,"http-summary",f,F.length,x.observations.length,{filesVisited:x.filesInspected}),b.set("builtin.wrapper",{id:"builtin.wrapper",applicableFiles:x.filesInspected,observations:x.observations.length,errors:x.errors.length}),h.push(...x.errors);let w=_e([...F,...x.observations]);f=performance.now();let y=ir(e,w);Y(d,"http-mount",f,w.length,y.observations.length,{filesVisited:y.filesInspected});let R=_e([...w,...y.observations]);f=performance.now();let I=Xn(e,R);Y(d,"carrier",f,R.length,I.observations.length,{filesVisited:I.filesInspected}),b.set("builtin.carrier",{id:"builtin.carrier",applicableFiles:I.bodySummaries,observations:I.observations.length,errors:I.errors.length}),h.push(...I.errors);let _=_e([...R,...I.observations]);f=performance.now();let P=Fa(_);Y(d,"relations",f,_.length,P.length),f=performance.now();let Dt=Ea(_,P);Y(d,"links",f,P.length,Dt.length),Pa(_,P),f=performance.now();let Mt=Ta([...La(_,P),...x.frontiers]);return Y(d,"frontiers",f,_.length,Mt.length),{schemaVersion:2,extractorVersion:At,observations:_,relationGroups:P,links:Dt,frontiers:Mt,coverage:{filesScanned:n.length,filesWithAst:g.filter(N=>N.hasAst).length,filesWithoutAst:g.filter(N=>!N.hasAst).length,...a?{filesReused:s.length}:{},extractors:[...b.values()],extractionErrors:h,phases:d},fileCoverage:g}}function Y(e,t,n,r,i,o={}){e.push({id:t,durationMs:Math.max(0,performance.now()-n),inputFacts:r,outputFacts:i,...o})}function Ia(e,t){let n=[],r=[];for(let i of t){let o=L(e,i),a=Ft.filter(c=>c.supports(o)),s=a.length>0?k(e,i):null,l={file:i,hasAst:s!==null||wa(i,o),observationIds:[],extractors:[],extractionErrors:[]};if(s)for(let c of a){let u={id:c.id,applicableFiles:1,observations:0,errors:0};try{let d=c.extract(s);u.observations=d.length,n.push(...d),l.observationIds.push(...d.map(p=>p.id))}catch(d){u.errors=1,l.extractionErrors.push(`${c.id} failed for ${i}: ${d instanceof Error?d.message:String(d)}`)}l.extractors.push(u)}r.push(l)}return{observations:n,fileCoverage:r}}function wa(e,t){return t?rn(e)?/<script\b/iu.test(t):Be(e)!==null:!1}function Na(e){let t=new Map(Ft.map(n=>[n.id,{id:n.id,applicableFiles:0,observations:0,errors:0}]));for(let n of e)for(let r of n.extractors){let i=t.get(r.id);i&&(i.applicableFiles+=r.applicableFiles,i.observations+=r.observations,i.errors+=r.errors)}return t}function Ca(e){return e.replaceAll("\\","/").replace(/^\.\//u,"")}function Fa(e){let t=new Map;for(let n of nt){let r=new Set([...n.producerActions,...n.consumerActions,...n.declarationActions??[]]);for(let i of e){if(!r.has(i.action)||i.strength==="candidate")continue;let o=ka(i,n.keyNames);if(!o)continue;let a=o.map(d=>`${d.name}=${gr(d.name,d.value)}`).join("\0"),s=i.sourceScope==="production"?"production":i.sourceScope,l=`${n.id}\0${s}\0${a}`,c=`boundary-group:${mr("sha256").update(l).digest("hex").slice(0,16)}`,u=t.get(c)??{id:c,protocol:n.protocol,joinRule:n.id,normalizedKey:a,keyParts:o,producerIds:[],consumerIds:[],declarationIds:[],derivation:{kind:"mechanically-derived",rule:n.id,ruleVersion:"2",inputFactIds:[],sourceSpans:[]}};n.producerActions.includes(i.action)&&u.producerIds.push(i.id),n.consumerActions.includes(i.action)&&u.consumerIds.push(i.id),n.declarationActions?.includes(i.action)&&u.declarationIds.push(i.id),u.derivation.inputFactIds.push(i.id),u.derivation.sourceSpans.push(i.source),t.set(c,u)}}return[...t.values()].map(_a).sort(Aa)}function _a(e){return{...e,producerIds:et(e.producerIds),consumerIds:et(e.consumerIds),declarationIds:et(e.declarationIds),derivation:{...e.derivation,inputFactIds:et(e.derivation.inputFactIds),sourceSpans:[...new Map(e.derivation.sourceSpans.map(t=>[`${t.file}:${t.startLine}:${t.endLine}`,t])).values()]}}}function Ea(e,t){let n=new Map(e.map(i=>[i.id,i])),r=new Map;for(let i of t){let o=nt.find(s=>s.id===i.joinRule);if(!o?.traversable)continue;let a=o.linkFrom==="declaration"?i.declarationIds:i.producerIds;if(!(a.length===0||i.consumerIds.length===0)&&!(o.requireUniquePair&&(a.length!==1||i.consumerIds.length!==1))&&!(o.requireUniqueConsumer&&i.consumerIds.length!==1)&&!(a.length*i.consumerIds.length>xa))for(let s of a)for(let l of i.consumerIds){let c=n.get(s),u=n.get(l);if(!c||!u||$a(c,u))continue;let d=c.strength==="derived"||u.strength==="derived"?"derived":"exact",p=`${i.joinRule}\0${s}\0${l}`,f={id:`boundary-link:${mr("sha256").update(p).digest("hex").slice(0,16)}`,from:s,to:l,joinRule:i.joinRule,matchedKeyParts:i.keyParts,strength:d,derivation:{kind:"mechanically-derived",rule:i.joinRule,ruleVersion:"2",inputFactIds:[s,l],sourceSpans:[c.source,u.source]}};r.set(f.id,f)}}return[...r.values()].sort(Da)}function Pa(e,t){let n=new Set(t.filter(yr).flatMap(tt)),r=new Set(t.filter(Ba).flatMap(tt));for(let i of e)i.resolution=n.has(i.id)?"locally-linked":r.has(i.id)?"ambiguous":"unresolved"}function La(e,t){let n=new Set(e.filter(o=>o.strength!=="candidate").map(o=>`${o.action}\0${o.source.file}\0${o.source.startLine}\0${o.source.endLine}`)),r=new Set(t.flatMap(tt)),i=new Set(t.filter(yr).flatMap(tt));return e.filter(o=>o.sourceScope==="production").filter(o=>o.strength!=="candidate"||!n.has(`${o.action}\0${o.source.file}\0${o.source.startLine}\0${o.source.endLine}`)).filter(o=>!i.has(o.id)).map(o=>{let a=o.keyParts.filter(l=>l.evidence==="expression"||l.value.length===0).map(l=>l.name),s=a.length>0?`${o.extractor} observed ${o.action}, but ${a.join(", ")} remained symbolic or unknown.`:o.resolution==="ambiguous"?`${o.extractor} established the address for ${o.action}, but more than one indexed peer has the same runtime key.`:r.has(o.id)?`${o.extractor} established the address for ${o.action}, but the indexed production scope contains no counterpart role in that relation group.`:`${o.extractor} observed ${o.action}, but no supported factorization rule could establish its addressed relation.`;return{observationId:o.id,reason:s,missingKeyParts:a,sourceScope:o.sourceScope}}).sort((o,a)=>o.observationId.localeCompare(a.observationId))}function tt(e){return[...e.producerIds,...e.consumerIds,...e.declarationIds]}function yr(e){let t=nt.find(r=>r.id===e.joinRule);if(!t)return!1;let n=t.linkFrom==="declaration"?e.declarationIds:e.producerIds;return n.length===0||e.consumerIds.length===0?!1:!t.requireUniquePair||n.length===1&&e.consumerIds.length===1}function Ba(e){let t=nt.find(r=>r.id===e.joinRule);if(!t?.requireUniquePair)return!1;let n=t.linkFrom==="declaration"?e.declarationIds:e.producerIds;return n.length>0&&e.consumerIds.length>0&&(n.length!==1||e.consumerIds.length!==1)}function Ta(e){return[...new Map(e.map(t=>[t.observationId,t])).values()].sort((t,n)=>t.observationId.localeCompare(n.observationId))}function ka(e,t){let n=[];for(let r of t){let i=e.keyParts.find(o=>o.name===r);if(!i||i.evidence==="expression"||i.value.length===0)return null;n.push({...i,value:gr(r,i.value)})}return n}function gr(e,t){if(e==="method")return t.toUpperCase();if(e!=="path")return t;let n=t.startsWith("/")?t:`/${t}`;return n.length>1?n.replace(/\/+$/u,""):n}function $a(e,t){return e.source.file===t.source.file&&e.source.startLine===t.source.startLine}function _e(e){return[...new Map(e.map(t=>[t.id,t])).values()].sort((t,n)=>t.source.file.localeCompare(n.source.file)||t.source.startLine-n.source.startLine||t.action.localeCompare(n.action))}function et(e){return[...new Set(e)].sort()}function Aa(e,t){return e.joinRule.localeCompare(t.joinRule)||e.normalizedKey.localeCompare(t.normalizedKey)}function Da(e,t){return e.joinRule.localeCompare(t.joinRule)||e.from.localeCompare(t.from)||e.to.localeCompare(t.to)}import Ma from"better-sqlite3";var it="codebaseiq_runtime_boundaries",ee="codebaseiq_runtime_observations",ot="codebaseiq_runtime_relation_groups",at="codebaseiq_runtime_relation_participants";function Oa(e,t){let n=new Ma(e);try{n.exec(`
61
+ ORDER BY d.relative_path, c.start_line`,...n??[])})}function ze(e,t,n){if(!t)return n();if(t.length===0)return[];let r=[];for(let i=0;i<t.length;i+=750)r.push(...n(t.slice(i,i+750)));return r}function Li(e,t){return Bi(e,[t]).get(t.symbolId)??[]}function Bi(e,t){let n=t.map(o=>({symbolId:o.symbolId,prelude:Di(e,o)})).filter(o=>o.prelude!==null),r=ki(e,n.map(o=>o.symbolId)),i=new Map;for(let{symbolId:o,prelude:a}of n){let s=Ti(e,r.get(o)??new Map,a.match,a.identifier);i.set(o,Ge(e,s))}return i}function Vl(e,t,n={}){return ht(e,t,n).map(r=>({file:r.file,line:r.line,enclosingSymbol:r.enclosingSymbol}))}function ht(e,t,n={}){let r=Cn(e,t,{semantic:n.semantic,semanticEvidence:n.semanticEvidence}),i=r.length>0?_n(r,"source-attribution"):_n(Li(e,t),"scip-reference-chunk");return n.includeIgnored===!0?i:i.filter(o=>!e.isIgnored(o.file))}function _n(e,t){return e.map(n=>({...n,provenance:t}))}function Ti(e,t,n,r){let i=new Map;for(let[o,a]of t)i.set(o,$i(e,o,a,n,r));return i}function ki(e,t){let n=new Map;for(let r of Fn(e,t)){if(e.isIgnored(r.relative_path))continue;let i=n.get(r.symbol_id);i||(i=new Map,n.set(r.symbol_id,i));let o=i.get(r.relative_path);o||(o=[],i.set(r.relative_path,o)),o.push({start_line:r.chunk_start,end_line:r.chunk_end})}return n}function $i(e,t,n,r,i){let o=t===r.relativePath?{excludeStartLine:r.startLine,excludeEndLine:r.endLine}:{},a=i?qe(e,t,i,o):[];return n.flatMap(s=>Ai(a,s))}function Ai(e,t){let n=e.filter(r=>r>=t.start_line&&r<=t.end_line);return n.length>0?n:[t.start_line]}function Di(e,t){let n=be(e,t);return n?{match:n,identifier:M(n.symbol)||null}:null}function En(e){let t=Qt(e);return Mi(t)?"test":Oi(t)?"worker":ji(t)?"entry":Vi(t)?"barrel":"source"}function Mi(e){return!!(/\.(?:test|spec)\.[a-z0-9]+$/i.test(e)||/(?:^|\/)(?:_)?test_[^/]+$/i.test(e)||/(?:^|\/)spec_[^/]+$/i.test(e)||/(?:^|\/)[^/]+_test\.[a-z0-9]+$/i.test(e)||/(?:^|\/)[^/]+_tests\.rs$/i.test(e)||/(?:^|\/)tests\.rs$/i.test(e)||/(?:^|\/)[^/]+_spec\.[a-z0-9]+$/i.test(e)||/(?:^|\/)__tests__\//i.test(e)||/(?:^|\/)test\//i.test(e)||/(?:^|\/)tests\//i.test(e)||/(?:^|\/)__fixtures__\//i.test(e)||/(?:^|\/)__mocks__\//i.test(e)||/(?:^|\/)test-support\//i.test(e)||/(?:^|\/)test-utils\//i.test(e)||/(?:^|\/)testing\//i.test(e))}function Oi(e){return/(?:^|\/)[^/]*worker\.(?:ts|tsx|js|mjs|cjs|rs|py|go)$/.test(e)}function ji(e){let t=e.split("/"),n=t[t.length-1]??e;return n==="cli.ts"||n==="cli.js"||n==="postinstall.ts"||n==="postinstall.js"||n==="main.ts"||n==="main.js"||n==="main.rs"||n==="main.go"||n==="main.py"||n==="build.rs"||n==="lib.rs"||/\bsrc\/bin\/[^/]+\.rs$/.test(e)||/(?:^|\/)examples\/[^/]+\.rs$/.test(e)||/(?:^|\/)tests\/[^/]+\.rs$/.test(e)||/(?:^|\/)benches\/[^/]+\.rs$/.test(e)?!0:n==="index.ts"||n==="index.js"?/(?:^|\/)(?:apps|services)\/[^/]+\/src\/index\.(?:ts|js)$/.test(e)?!0:t.length<=2:!1}function Vi(e){return e==="index.ts"||e==="index.js"||e.endsWith("/index.ts")||e.endsWith("/index.js")||e.endsWith("/mod.rs")||e.endsWith("/__init__.py")}function Ue(e){let t=e.replaceAll("\\","/");return En(t)==="test"?/(?:^|\/)__fixtures__\//iu.test(t)?"fixture":"test":/(?:^|\/)(?:fixtures?|testdata)\//iu.test(t)?"fixture":/(?:^|\/)(?:examples?|demos?|previews?)\//iu.test(t)?"example":/(?:^|\/)(?:generated|dist|build|coverage)\//iu.test(t)||/\.generated\./iu.test(t)?"generated":/^(?:scripts?|tools?)\//iu.test(t)?"script":"production"}var Hi=4;function Q(e,t,n,r={}){return Pn(e,t,n,r.maxReexportDepth??Hi,0,new Set)}function Pn(e,t,n,r,i,o){let a=`${t}\0${n}`;if(o.has(a)||i>r)return[];o.add(a);let s=C(e,t).filter(l=>l.leaf===n);return s.length>0?s:ne(e,t).flatMap(l=>l.sourcePath?l.kind==="named"&&!l.names.includes(n)?[]:Pn(e,l.sourcePath,n,r,i+1,new Set(o)):[])}import{createHash as yr}from"crypto";import{createHash as so}from"crypto";var We=8;function ce(e,t,n){return Rt(Ln(e,t,vt(n),0,new Set))}function xt(e,t,n){return bt(e,t,n,0,new Set)}function Ln(e,t,n,r,i){if(r>We)return[];let o=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n);return o?Bn(e,t,o[1],o[2],r,i):/^[A-Za-z_$][\w$]*$/u.test(n)?Tn(e,t,n,r,i):[]}function Bn(e,t,n,r,i,o){let a=[];for(let s of bt(e,t,n,i+1,new Set(o))){let l=Wi(s.initializer);for(let c of l.namedChildren){if(c.type==="pair"){let u=c.childForFieldName("key")??c.namedChild(0);if(Ki(u)!==r)continue;let d=c.childForFieldName("value")??c.namedChild(1);d&&a.push(...Ln(e,s.definition.relativePath,vt(d.text),i+1,new Set(o)));continue}if(/(?:method|function)/u.test(c.type)){if((c.childForFieldName("name")??c.namedChild(0))?.text!==r)continue;let d=zi(e,s.definition.relativePath,r,c);a.push(...d.length>0?d:[qi(s.definition,r,c)]);continue}if(c.type==="spread_element"){let u=c.namedChild(0);if(!u)continue;for(let d of bt(e,s.definition.relativePath,vt(u.text),i+1,new Set(o)))a.push(...Bn(e,d.definition.relativePath,d.definition.leaf,r,i+1,new Set(o)))}}}return Rt(a)}function qi(e,t,n){return{documentId:e.documentId,symbolId:-1,symbol:`source-callable:${e.relativePath}:${n.startPosition.row}:${t}`,relativePath:e.relativePath,startLine:n.startPosition.row,startChar:n.startPosition.column,endLine:n.endPosition.row,endChar:n.endPosition.column,leaf:t,parentTypeName:e.leaf,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:e.symbol}}function bt(e,t,n,r,i){return r>We||!/^[A-Za-z_$][\w$]*$/u.test(n)?[]:Tn(e,t,n,r,i).flatMap(o=>{let a=D(e,o.relativePath)?.rootNode,s=a?Ui(a,o.leaf):null;return s?[{definition:o,initializer:s}]:[]})}function Tn(e,t,n,r,i){if(r>We)return[];let o=`${t}\0${n}`;if(i.has(o))return[];i.add(o);let a=C(e,t).filter(c=>c.leaf===n);if(a.length>0)return a;let s=Gi(e,t,n);if(s.length>0)return s;let l=A(e,t).find(c=>c.localName===n&&c.sourcePath);if(l?.sourcePath){let c=l.kind==="namespace"||l.importedName==="default"?n:l.importedName;return St(e,l.sourcePath,c,r+1,new Set(i))}return St(e,t,n,r+1,new Set(i))}function Gi(e,t,n){let r=e.get("SELECT id FROM documents WHERE relative_path = ?",t)?.id;return r===void 0?[]:(U(e,t)?.callables??[]).filter(i=>i.name===n).map(i=>({documentId:r,symbolId:-1,symbol:`source-callable:${t}:${i.startLine}:${n}`,relativePath:t,startLine:i.startLine,startChar:0,endLine:i.endLine,endChar:0,leaf:n,parentTypeName:null,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null}))}function St(e,t,n,r,i){if(r>We)return[];let o=C(e,t).filter(a=>a.leaf===n);return o.length>0?o:Rt(ne(e,t).flatMap(a=>a.sourcePath?a.kind==="named"&&!a.names.includes(n)?[]:St(e,a.sourcePath,n,r+1,new Set(i)):[]))}function zi(e,t,n,r){return C(e,t).filter(i=>i.leaf===n&&i.startLine<=r.startPosition.row&&i.endLine>=r.endPosition.row)}function Ui(e,t){let n=null;return kn(e,r=>{n||r.type!=="variable_declarator"||(r.childForFieldName("name")??r.namedChild(0))?.text.trim()!==t||(n=r.childForFieldName("value")??r.namedChild(1))}),n}function Wi(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function Ki(e){return e?.text.replace(/^['"`]|['"`]$/gu,"")??null}function vt(e){return e.replace(/\s+/gu,"").replace(/^\.\.\./u,"")}function Rt(e){return[...new Map(e.map(t=>[t.symbol,t])).values()]}function kn(e,t){t(e);for(let n of e.namedChildren)kn(n,t)}var Zi=8;function V(e,t){return t?ue(e,t,0,new Set):null}function ue(e,t,n,r){if(n>Zi)return q(t,"value-evaluation-depth");let i=An(t),o=to(i);if(o)return no(e.file,i,o.term,o.value,o.precision);if(i.type==="binary_expression"&&/\+/u.test(i.text)){let l=i.namedChildren.map(c=>ue(e,c,n+1,new Set(r)));if(l.length>=2&&l.every(c=>c!==null)){let c={kind:"concat",parts:l.map(d=>d.term)},u=l.map(d=>d.value).join("");return ro(e.file,i,c,u,l.some(d=>d.precision!=="literal")?"constrained-pattern":"literal",l)}}let a=i.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(a))return Yi(e,a,i,n,r);let s=io(i);return s?eo(e,s.base,s.properties,i,n,r):i.type==="call_expression"||i.type==="call"?Xi(e,i,n,r):q(i,`unsupported-expression:${i.type}`)}function Xi(e,t,n,r){let o=(t.childForFieldName("function")??t.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<.*>$/u,"")??"",a=Qi(e,o);if(a.length!==1)return q(t,a.length===0?"call-target-unresolved":"call-target-ambiguous");let s=a[0],l=`${s.relativePath}\0${s.symbol}`;if(r.has(l))return q(t,"call-return-cycle");let c=D(e.db,s.relativePath)?.rootNode;if(!c)return q(t,"call-target-unparsed");let u=ao(c,s.startLine,s.endLine);if(!u)return q(t,"call-target-syntax-unavailable");let d=Ji(u);if(!d)return q(t,"call-return-not-single-expression");let p=new Set(r);p.add(l);let f=ue({db:e.db,file:s.relativePath,root:c},d,n+1,p);return f?Ke(t,"bounded-call-return",f,s.symbol):q(t,"call-return-unresolved")}function Qi(e,t){if(/^[A-Za-z_$][\w$]*$/u.test(t)){let i=C(e.db,e.file).filter(a=>a.isFunctionLike&&a.leaf===t);if(i.length>0)return i;let o=A(e.db,e.file).find(a=>a.localName===t&&a.sourcePath&&a.kind!=="namespace");return o?.sourcePath?Q(e.db,o.sourcePath,o.importedName==="default"?t:o.importedName).filter(a=>a.isFunctionLike):[]}let n=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(t);if(!n)return[];let r=A(e.db,e.file).find(i=>i.kind==="namespace"&&i.localName===n[1]&&i.sourcePath);return r?.sourcePath?Q(e.db,r.sourcePath,n[2]).filter(i=>i.isFunctionLike):[]}function Ji(e){let t=e.childForFieldName("body");if(e.type==="arrow_function"&&t&&t.type!=="statement_block")return t;let n=[];return $n(t??e,t??e,n),n.length!==1?null:n[0].childForFieldName("argument")??n[0].namedChild(0)}function $n(e,t,n){if(!(t!==e&&(/(?:function|method|lambda)/u.test(t.type)||t.type==="arrow_function"))){if(t.type==="return_statement"){n.push(t);return}for(let r of t.namedChildren)$n(e,r,n)}}function Yi(e,t,n,r,i){let o=`${e.file}\0${t}`;if(i.has(o))return q(n,"value-cycle");i.add(o);let a=It(e.root,t);if(a){let m=ue(e,a,r+1,i);return m?Ke(n,"local-constant",m):q(n,"non-foldable-local")}let s=A(e.db,e.file).find(m=>m.localName===t&&m.sourcePath);if(!s?.sourcePath)return j(n,t,"unresolved-identifier");if(s.kind==="namespace")return j(n,t,"namespace-import-requires-property");let l=s.importedName==="default"?t:s.importedName,c=Q(e.db,s.sourcePath,l);if(c.length!==1)return j(n,t,c.length===0?"import-definition-missing":"import-definition-ambiguous");let u=c[0],d=D(e.db,u.relativePath)?.rootNode;if(!d)return j(n,u.symbol,"import-definition-unparsed");let p=It(d,u.leaf);if(!p)return j(n,u.symbol,"import-definition-non-value");let f=ue({db:e.db,file:u.relativePath,root:d},p,r+1,i);return f?Ke(n,"imported-constant",f,u.symbol):j(n,u.symbol,"import-value-unresolved")}function eo(e,t,n,r,i,o){let a=A(e.db,e.file).find(f=>f.localName===t&&f.sourcePath),s=e.file,l=t,c;if(a?.sourcePath){a.kind==="namespace"?(l=n[0]??"",n=n.slice(1)):l=a.importedName==="default"?t:a.importedName;let f=Q(e.db,a.sourcePath,l);if(f.length!==1)return j(r,`${t}.${n.join(".")}`,f.length===0?"member-definition-missing":"member-definition-ambiguous");s=f[0].relativePath,l=f[0].leaf,c=f[0].symbol}let u=s===e.file?e.root:D(e.db,s)?.rootNode;if(!u)return j(r,c??t,"member-definition-unparsed");let d=It(u,l);if(!d)return j(r,c??t,"member-base-non-value");for(let f of n){let m=An(d);if(d=oo(m,f),!d)return j(r,c??`${t}.${n.join(".")}`,`member-property-missing:${f}`)}let p=ue({db:e.db,file:s,root:u},d,i+1,o);return p?Ke(r,"member-constant",p,c):j(r,c??t,"member-value-unresolved")}function to(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);if(n!=="`"||!r.includes("${"))return{term:{kind:"literal",value:r},value:r,precision:"literal"};let i=[],o=0,a=/\$\{([^}]*)\}/gu;for(let s of r.matchAll(a)){let l=s.index??0;l>o&&i.push({kind:"literal",value:r.slice(o,l)}),i.push({kind:"unknown",reason:`template-hole:${s[1]?.trim()||"expression"}`}),o=l+s[0].length}return o<r.length&&i.push({kind:"literal",value:r.slice(o)}),{term:{kind:"pattern",language:"template",value:r.replace(a,"{}")},value:r.replace(a,"{}"),precision:"constrained-pattern"}}function no(e,t,n,r,i){return{value:r,evidence:"literal",term:n,precision:i,derivation:Ze("direct-literal","direct",e,t)}}function ro(e,t,n,r,i,o){return{value:r,evidence:"constant",term:n,precision:i,derivation:{...Ze("constant-concatenation","mechanically-derived",e,t),inputFactIds:o.flatMap(a=>a.derivation.inputFactIds),sourceSpans:o.flatMap(a=>a.derivation.sourceSpans)}}}function Ke(e,t,n,r){return n.evidence==="expression"?{...n,derivation:{kind:"heuristic",rule:t,ruleVersion:"1",inputFactIds:[...n.derivation.inputFactIds,...r?[r]:[]],sourceSpans:n.derivation.sourceSpans}}:{...n,evidence:"constant",derivation:{kind:"mechanically-derived",rule:t,ruleVersion:"1",inputFactIds:[...n.derivation.inputFactIds,...r?[r]:[]],sourceSpans:n.derivation.sourceSpans}}}function j(e,t,n){return{value:e.text.trim(),evidence:"expression",term:{kind:"symbol",symbol:t},precision:"symbolic",derivation:Ze(n,"heuristic","",e)}}function q(e,t){return{value:e.text.trim(),evidence:"expression",term:{kind:"unknown",reason:t},precision:"unknown",derivation:Ze(t,"heuristic","",e)}}function Ze(e,t,n,r){return{kind:t,rule:e,ruleVersion:"1",inputFactIds:[],sourceSpans:n?[{file:n,startLine:r.startPosition.row,endLine:r.endPosition.row}]:[]}}function io(e){let t=e.text.replace(/\s+/gu,"");if(!/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/u.test(t))return null;let[n,...r]=t.split(".");return n?{base:n,properties:r}:null}function It(e,t){let n=null;return wt(e,r=>{if(n||r.type!=="variable_declarator"||(r.childForFieldName("name")??r.namedChild(0))?.text.trim()!==t)return;let o=r.parent;!o||o.type!=="lexical_declaration"||!/^\s*(?:export\s+)?const\b/u.test(o.text)||(n=r.childForFieldName("value")??r.namedChild(1))}),n}function oo(e,t){for(let n of e.namedChildren)if(!(n.type!=="pair"||(n.childForFieldName("key")??n.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")!==t))return n.childForFieldName("value")??n.namedChild(1);return null}function An(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function ao(e,t,n){let r=null;return wt(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function wt(e,t){t(e);for(let n of e.namedChildren)wt(n,t)}var jn=new Set(["delete","get","head","options","patch","post","put"]),lo=/(?:^|\.)(?:app|router|server)$/u,co=new Set(["findFirst","findMany","findUnique","from","get","select"]),uo=new Set(["create","delete","insert","remove","update","upsert"]),po=new Set(["execute","query","raw"]),Ft=[go(),yo(),fo(),ho(),So(),vo(),Ro()],Ct=new Set(["exec","execFile","execFileSync","execSync","fork","spawn","spawnSync"]);function fo(){return{id:"builtin.node-child-process",supports:e=>/(?:from\s*|require\s*\(\s*)['"](?:node:)?child_process['"]/u.test(e)&&/\b(?:exec|execFile|execFileSync|execSync|fork|spawn|spawnSync)\s*\(/u.test(e),extract:e=>{let t=mo(e.source),n=[];return H(e.root,r=>{if(r.type!=="call_expression")return;let i=Re(r);if(!i)return;let o=t.direct.get(i),a=/^(.*?)\.([A-Za-z_$][\w$]*)$/u.exec(i),s=a&&t.namespaces.has(a[1])?a[2]:null,l=o??s;if(!l||!Ct.has(l))return;let c=J(r),u=O(c[0],e)??{value:c[0]?.text.trim()||"<missing>",evidence:"expression"},d=["exec","execFile","execFileSync","execSync"].includes(l)?"process.exec":"process.spawn";n.push(T(e,r,"builtin.node-child-process",d,[{name:"operation",value:l,evidence:"literal"},{name:"executable",...u}],"exact","node-child-process-import"))}),n}}}function mo(e){let t=new Map,n=new Set,r=String.raw`['"](?:node:)?child_process['"]`,i=new RegExp(String.raw`\bimport\s*\{([^}]*)\}\s*from\s*${r}`,"gu");for(let l of e.matchAll(i))for(let c of(l[1]??"").split(",")){let u=/^\s*([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?\s*$/u.exec(c);u&&Ct.has(u[1])&&t.set(u[2]??u[1],u[1])}let o=new RegExp(String.raw`\b(?:const|let)\s*\{([^}]*)\}\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let l of e.matchAll(o))for(let c of(l[1]??"").split(",")){let u=/^\s*([A-Za-z_$][\w$]*)(?:\s*:\s*([A-Za-z_$][\w$]*))?\s*$/u.exec(c);u&&Ct.has(u[1])&&t.set(u[2]??u[1],u[1])}let a=new RegExp(String.raw`\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*${r}`,"gu");for(let l of e.matchAll(a))n.add(l[1]);let s=new RegExp(String.raw`\b(?:const|let)\s+([A-Za-z_$][\w$]*)\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let l of e.matchAll(s))n.add(l[1]);return{direct:t,namespaces:n}}function k(e,t){let n=D(e,t)?.rootNode;if(!n)return null;let r=L(e,t),i=C(e,t),o=U(e,t)?.callables??[];return{db:e,file:t,source:r,root:n,constants:_o(n),ownerAt:a=>{let s=i.filter(c=>c.startLine<=a&&c.endLine>=a).sort((c,u)=>c.endLine-c.startLine-(u.endLine-u.startLine)||c.startLine-u.startLine)[0];if(s)return{file:t,symbol:s.symbol,name:s.leaf,startLine:s.startLine,endLine:s.endLine};let l=o.filter(c=>c.startLine<=a&&c.endLine>=a).sort((c,u)=>c.endLine-c.startLine-(u.endLine-u.startLine)||c.startLine-u.startLine)[0];return{file:t,symbol:null,name:l?.name??null,startLine:l?.startLine??a,endLine:l?.endLine??a}}}}function yo(){return{id:"builtin.effect-httpapi",supports:e=>ve(e,"HttpApiEndpoint").size>0||ve(e,"HttpApiBuilder").size>0,extract:e=>{let t=[],n=ve(e.source,"HttpApiEndpoint"),r=ve(e.source,"HttpApiGroup"),i=ve(e.source,"HttpApiBuilder");return H(e.root,o=>{if(o.type!=="call_expression")return;let a=Vn(o);if(!a)return;let s=J(o);if(n.has(a.receiver)&&jn.has(a.member)){let g=O(s[0],e),S=O(s[1],e),h=Mn(o,r,"make",0,e);if(!g||!S||!h)return;let v=a.member.toUpperCase();t.push(T(e,o,"builtin.effect-httpapi","http.handle",[{name:"method",value:v,evidence:"literal"},{name:"path",...S}],G([{name:"path",...S}]),"effect-httpapi-endpoint-declaration")),t.push(T(e,o,"builtin.effect-httpapi","framework.declare",Nt(h,g),G(Nt(h,g)),"effect-httpapi-operation-declaration"));return}if(!["handle","handleRaw"].includes(a.member))return;let l=Mn(o,i,"group",1,e),c=O(s[0],e),u=s[1];if(!l||!c||!u)return;let d=Nt(l,c),p=ce(e.db,e.file,u.text),f=T(e,o,"builtin.effect-httpapi","framework.handle",d,p.length===1?G(d):"candidate","effect-httpapi-handler-registration"),m=p[0];p.length===1&&m&&(f.owner={file:m.relativePath,symbol:m.symbol,name:m.leaf,startLine:m.startLine,endLine:m.endLine}),t.push(f)}),t}}}function Nt(e,t){return[{name:"adapter",value:"effect-httpapi",evidence:"literal"},{name:"group",...e},{name:"operation",...t}]}function ve(e,t){let n=new Set,r=/\bimport\s*\{([\s\S]*?)\}\s*from\s*['"]([^'"]+)['"]/gu;for(let o of e.matchAll(r)){let a=o[2]??"";if(Dn(a))for(let s of(o[1]??"").split(",")){let l=s.trim().replace(/^type\s+/u,""),c=/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/u.exec(l);c?.[1]===t&&n.add(c[2]??c[1])}}let i=/\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*['"]([^'"]+)['"]/gu;for(let o of e.matchAll(i)){let a=o[2]??"";a.endsWith(`/${t}`)&&Dn(a)&&n.add(o[1])}return n}function Dn(e){return e==="effect/unstable/httpapi"||e==="@effect/platform"||e.startsWith("@effect/platform/HttpApi")}function Mn(e,t,n,r,i){let o=e.parent;for(;o;){if(o.type==="call_expression"){let a=On(o,t,n,r,i);if(a)return a;let s=o.childForFieldName("function")??o.namedChild(0),l=null;if(s&&H(s,c=>{!l&&c.type==="call_expression"&&(l=On(c,t,n,r,i))}),l)return l}o=o.parent}return null}function On(e,t,n,r,i){let o=Vn(e);return!o||o.member!==n||!t.has(o.receiver)?null:O(J(e)[r],i)}function Vn(e){let t=e.childForFieldName("function")??e.namedChild(0);if(!t||!["member_expression","subscript_expression"].includes(t.type))return null;let n=t.childForFieldName("object")??t.namedChild(0),r=t.childForFieldName("property")??t.childForFieldName("index")??t.namedChild(1);return!n||!r?null:{receiver:n.text.replace(/\s+/gu,""),member:r.text.replace(/^['"`]|['"`]$/gu,"")}}function go(){return{id:"builtin.http",supports:e=>/\bfetch\s*\(|\baxios\b|\b(?:app|router|server)\s*\.\s*(?:get|post|put|patch|delete|options|head)\s*\(/u.test(e)||xe(e,["axios"])||/\b(?:FastAPI|Flask|APIRouter|axum|Router::new)\b/u.test(e),extract:e=>{let t=[];return H(e.root,n=>{if(n.type==="decorator"){let p=/^@[^\s(]+\.(get|post|put|patch|delete|options|head)\s*\(\s*(['"`])([^'"`]+)\2/iu.exec(n.text.trim());if(!p||!xe(e.source,["fastapi","flask"]))return;t.push(T(e,n,"builtin.http","http.handle",[{name:"method",value:p[1].toUpperCase(),evidence:"literal"},{name:"path",value:p[3],evidence:"literal"}],"exact","framework-decorator"));return}if(n.type!=="call_expression")return;let r=Re(n);if(!r)return;let i=r.split(".").at(-1)?.toLowerCase()??"",o=r.includes(".")?r.slice(0,r.lastIndexOf(".")):"",a=J(n);if(i==="route"&&xe(e.source,["axum"])){let p=O(a[0],e),f=/^\s*(get|post|put|patch|delete|options|head)\s*\(/iu.exec(a[1]?.text??"")?.[1];if(!p||!f)return;t.push(T(e,n,"builtin.http","http.handle",[{name:"method",value:f.toUpperCase(),evidence:"literal"},{name:"path",...p}],G([{name:"path",...p}]),"framework-adapter"));return}if(r==="fetch"||r.endsWith(".fetch")){let p=O(a[0],e);if(!p)return;let m=/\bmethod\s*:\s*['"`]([A-Za-z]+)['"`]/u.exec(a[1]?.text??"")?.[1]?.toUpperCase()??(a[1]?null:"GET"),g=[...m?[{name:"method",value:m,evidence:"literal"}]:[],{name:"path",...p}];t.push(T(e,n,"builtin.http","http.request",g,m?G(g):"candidate","call-expression"));return}if(!jn.has(i))return;let s=O(a[0],e);if(!s)return;let l=i.toUpperCase();if(lo.test(o)&&xe(e.source,["express","fastify","hono","koa-router","@koa/router"])){t.push(T(e,n,"builtin.http","http.handle",[{name:"method",value:l,evidence:"literal"},{name:"path",...s}],G([{name:"path",...s}]),"framework-adapter"));return}let u=No(e.source,["axios"]),d=o.split(".")[0]??"";u.has(d)&&t.push(T(e,n,"builtin.http","http.request",[{name:"method",value:l,evidence:"literal"},{name:"path",...s}],G([{name:"path",...s}]),"client-adapter"))}),t}}}function ho(){return{id:"builtin.capability-registry",supports:e=>/\b(?:execute|handler|invoke|run)\s*(?:[:(])/u.test(e)||/['"`][^'"`\n]{0,256}\b[A-Za-z_$][\w$-]*\s*\(/u.test(e),extract:e=>{let t=[],n=new Set;return H(e.root,r=>{if(r.type==="pair"){let o=r.childForFieldName("key")??r.namedChild(0),a=r.childForFieldName("value")??r.namedChild(1),s=o?.text.replace(/^['"`]|['"`]$/gu,"");if(s!=="name"&&s!=="id")return;let l=Hn(a,e),c=Po(r);if(!l||l.evidence!=="literal"||!c)return;let u=`handle\0${l.value}\0${c.startPosition.row}`;if(n.has(u))return;n.add(u),t.push(T(e,c,"builtin.capability-registry","registry.handle",[{name:"key",...l}],"exact","capability-descriptor"));return}if(!["string","string_literal","template_string"].includes(r.type))return;let i=r.text.replace(/^['"`]|['"`]$/gu,"");for(let o of i.matchAll(/\b([A-Za-z_$][\w$-]*)\s*\(/gu)){let a=o[1];if(!bo(i,a,o.index))continue;let s=`reference\0${a}\0${r.startPosition.row}`;n.has(s)||(n.add(s),t.push(T(e,r,"builtin.capability-registry","registry.reference",[{name:"key",value:a,evidence:"literal"}],"exact","capability-instruction-reference")))}}),t}}}function bo(e,t,n){if(t.includes("_")||t.includes("-"))return!0;let r=e.slice(Math.max(0,n-64),n);return/\b(?:use|call|invoke|run|via|with|read|stop)(?:\s+the)?(?:\s+(?:tool|capability|command))?\s*$/iu.test(r)}function So(){return{id:"builtin.registry",supports:e=>/(?:Handlers?|Registry|Routes?)\b/iu.test(e),extract:e=>{let t=[];return H(e.root,n=>{if(n.type==="pair"){let o=Eo(n);if(!o)return;let a=n.childForFieldName("key")??n.namedChild(0),s=n.childForFieldName("value")??n.namedChild(1),l=Hn(a,e);if(!l||!s||!qn(s))return;let c=_t(s)?"exact":"candidate";t.push(T(e,n,"builtin.registry","registry.handle",[{name:"registry",value:o,evidence:"identifier"},{name:"key",...l}],G([{name:"key",...l}],c),"object-member"));return}if(n.type!=="call_expression")return;let r=n.childForFieldName("function")??n.namedChild(0);if(!r)return;let i=/^([A-Za-z_$][\w$]*)\s*\[\s*(['"`])([^'"`]+)\2\s*\]$/u.exec(r.text.trim());i&&t.push(T(e,n,"builtin.registry","registry.dispatch",[{name:"registry",value:i[1],evidence:"identifier"},{name:"key",value:i[3],evidence:"literal"}],"exact","indexed-access-call"))}),t}}}function vo(){return{id:"builtin.persistence",supports:e=>/\b(?:db|database|prisma|drizzle|[A-Za-z_$][\w$]*(?:Repository|Repo))\b[^;]{0,1024}?\.\s*(?:findFirst|findMany|findUnique|from|get|select|create|delete|insert|remove|update|upsert|execute|query|raw|transaction)(?:\s*<[^()]{1,512}>)?\s*\(/iu.test(e),extract:e=>{let t=[],n=Bo(e.root);return H(e.root,r=>{if(r.type!=="call_expression")return;let i=Re(r);if(!i)return;let o=i.split("."),a=o.at(-1)??"",s=J(r),l=s[0]?.text??"",c=Lo(a,l);if(!c)return;let u=Gn(o,n);if(!u)return;let d=xo(s[0],e)??To(l),p=ko(u,o,a,d);if(!p)return;let f=a==="insert"?"persistence-insert":c==="database.read"&&/\bFOR\s+UPDATE\s+SKIP\s+LOCKED\b/iu.test(l)?"persistence-skip-locked-claim":"persistence-adapter";t.push(T(e,r,"builtin.persistence",c,[{name:"resource",...p}],G([{name:"resource",...p}]),f))}),t}}}function xo(e,t){if(!e)return null;let n=e.text.replace(/\s+/gu,"");return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/u.test(n)?{value:n.split(".").at(-1),evidence:"identifier",term:{kind:"symbol",symbol:n}}:O(e,t)}function Ro(){return{id:"builtin.queue",supports:e=>xe(e,["amqplib","bullmq","kafkajs","@aws-sdk/client-sqs","rabbitmq"])&&/\.(?:sendToQueue|consume|send|subscribe)\s*\(/u.test(e),extract:e=>{let t=[];return H(e.root,n=>{if(n.type!=="call_expression")return;let r=Re(n);if(!r)return;let i=r.split(".").at(-1)??"",o=J(n),a=i==="sendToQueue"||i==="send"?"queue.send":i==="consume"||i==="subscribe"?"queue.consume":null;if(!a)return;let s=i==="send"||i==="subscribe"?Co(o[0],"topic",e):O(o[0],e);s&&t.push(T(e,n,"builtin.queue",a,[{name:"address",...s}],G([{name:"address",...s}]),"framework-adapter"))}),t}}}function T(e,t,n,r,i,o,a){let s=e.ownerAt(t.startPosition.row),l=JSON.stringify({extractor:n,action:r,file:e.file,line:t.startPosition.row,keyParts:i});return{id:`boundary:${so("sha256").update(l).digest("hex").slice(0,16)}`,extractor:n,action:r,owner:s,source:{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},keyParts:i,evidence:a,strength:o,protocol:r.split(".")[0]??r,role:Io(r),executionDomain:wo(e.file),derivation:{kind:o==="candidate"?"heuristic":o==="derived"?"mechanically-derived":"direct",rule:a,ruleVersion:"1",inputFactIds:i.flatMap(c=>c.derivation?.inputFactIds??[]),sourceSpans:[{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},...i.flatMap(c=>c.derivation?.sourceSpans??[])]},valuePrecision:i.some(c=>c.evidence==="expression")?"unknown":i.some(c=>c.evidence==="identifier")?"symbolic":"literal",modality:"may",resolution:"unresolved",sourceScope:Ue(e.file)}}function Io(e){let t=e.split(".").at(-1)??e;return["handle","subscribe","consume","read"].includes(t)?"consumer":["request","publish","send","write","dispatch","reference","invoke","spawn","exec"].includes(t)?"producer":"observe"}function wo(e){let t=e.replaceAll("\\","/"),n=/^(apps|services|packages)\/([^/]+)/u.exec(t);return n?`${n[1]}/${n[2]}`:null}function xe(e,t){return t.some(n=>{let r=n.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`(?:\\bfrom\\s+${r}\\b|\\buse\\s+${r}\\b|(?:\\bfrom\\s*|\\brequire\\s*\\(\\s*)['"]${r}(?:[/']|"))`,"u").test(e)})}function No(e,t){let n=new Set;for(let r of t){let i=r.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),o=new RegExp(`(?:import\\s+([A-Za-z_$][\\w$]*)[^;]*?\\sfrom\\s*|(?:const|let)\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*require\\s*\\(\\s*)['"]${i}(?:[/']|")`,"gu");for(let a of e.matchAll(o)){let s=a[1]??a[2];s&&n.add(s)}}return n}function Xe(e,t,n,r,i,o,a){return T(e,t,n,r,i,o,a)}function Re(e){return(e.childForFieldName("function")??e.namedChild(0))?.text.replace(/\s+/gu,"")??null}function J(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function O(e,t){let n=V(t,e);return n?{value:n.value,evidence:n.evidence,term:n.term,derivation:n.derivation}:null}function Co(e,t,n){if(!e)return null;let r=e.namedChildren.find(o=>o.type!=="pair"?!1:(o.childForFieldName("key")??o.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")===t),i=r?.childForFieldName("value")??r?.namedChild(1);return O(i,n)}function Hn(e,t){if(!e)return null;let n=O(e,t);if(n?.evidence==="literal"||n?.evidence==="constant")return n;let r=e.text.trim();return/^[A-Za-z_$][\w$]*$/u.test(r)?{value:r,evidence:"identifier",term:{kind:"symbol",symbol:r}}:n}function G(e,t="exact"){return t==="candidate"||e.some(n=>n.evidence==="expression")?"candidate":t==="derived"||e.some(n=>n.evidence==="constant")?"derived":"exact"}function Fo(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);return n==="`"&&r.includes("${")?null:r}function _o(e){let t=new Map;return H(e,n=>{if(n.type!=="variable_declarator")return;let r=n.childForFieldName("name")??n.namedChild(0),i=n.childForFieldName("value")??n.namedChild(1);if(!r||!i||!/^[A-Za-z_$][\w$]*$/u.test(r.text))return;let o=Fo(i);o!==null&&t.set(r.text,o)}),t}function Eo(e){let t=e.parent,n=t?.parent??null;for(;n&&["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(n.type);)n=n.parent;if(!t||!n||n.type!=="variable_declarator")return null;let i=(n.childForFieldName("name")??n.namedChild(0))?.text??"";return/(?:handlers?|registry|routes?)$/iu.test(i)?i:null}function _t(e){return/(?:function|lambda|method)/u.test(e.type)||e.type==="arrow_function"}function qn(e){return _t(e)||e.type==="member_expression"?!0:e.type==="identifier"&&/(?:command|controller|dispatch|handle|handler)/iu.test(e.text)}function Po(e){let t=e.parent;for(;t&&t.type!=="variable_declarator";){if(["object","object_literal","dictionary"].includes(t.type))for(let n of t.namedChildren){if(n.type==="pair"){let i=n.childForFieldName("key")??n.namedChild(0),o=n.childForFieldName("value")??n.namedChild(1),a=i?.text.replace(/^['"`]|['"`]$/gu,"");if(a&&["execute","handler","invoke","run"].includes(a)&&o&&qn(o))return t}let r=n.childForFieldName("name")??n.namedChild(0);if(r&&["execute","handler","invoke","run"].includes(r.text.replace(/^['"`]|['"`]$/gu,""))&&/(?:function|method)/u.test(n.type))return t}t=t.parent}return null}function Gn(e,t=new Set){let n=e.slice(0,-1).map(r=>r.replace(/\([^)]*\)/gu,""));return n.some(r=>/^(?:prisma|drizzle)$/iu.test(r))?"orm":n.some(r=>/(?:Repository|Repo)$/u.test(r))?"repository":n.some(r=>/^(?:db|database)$/iu.test(r)||t.has(r))?"database":null}function Lo(e,t){if(co.has(e))return"database.read";if(uo.has(e))return"database.write";if(!po.has(e))return null;let n=/\b(SELECT|INSERT|UPDATE|DELETE)\b/iu.exec(t)?.[1]?.toUpperCase();return n==="SELECT"?"database.read":n?"database.write":null}function Bo(e){let t=new Set;return H(e,n=>{if(n.type!=="call_expression")return;let r=Re(n);if(!r)return;let i=r.split(".");if(!(i.at(-1)!=="transaction"||!Gn(i)))for(let o of J(n)){if(!_t(o))continue;let s=(o.childForFieldName("parameters")??o.namedChildren.find(c=>/parameters/u.test(c.type)))?.namedChildren[0],l=s?zn(s):null;l&&t.add(l)}}),t}function zn(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?zn(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function To(e){let t=Un(e);return t?{value:t,evidence:"identifier",term:{kind:"symbol",symbol:t}}:null}function ko(e,t,n,r){if(e==="orm"&&t.length>=3)return{value:t.at(-2).replace(/\([^)]*\)/gu,""),evidence:"identifier"};if(e==="repository"){let o=t.at(-2)?.replace(/(?:Repository|Repo)$/u,"");return o?{value:o,evidence:"identifier"}:null}if(!r)return null;if(n==="from"||n==="insert")return r;let i=Un(r.value);return i?{value:i,evidence:r.evidence}:null}function Un(e){return/\b(?:from|into|update|table)\s+(?:\$\{\s*)?['"`]?([A-Za-z_$][\w$.-]*)/iu.exec(e)?.[1]??null}function H(e,t){t(e);for(let n of e.namedChildren)H(n,t)}var $o=$("resolved-call-syntax",{clearGroups:[]}),Ao=$("resolved-call-sites",{clearGroups:[]});function Ie(e,t){return Ao.get(e,t.symbolId,()=>Do(e,t))}function Do(e,t){let n=[],r=[],i=new Set,o=new Set;for(let a of ht(e,t,{semantic:!1})){i.add(a.file);let s=$o.get(e,a.file,()=>Mo(e,a.file));if(!s){r.push({callee:t,file:a.file,line:a.line,reason:"ast-unavailable",candidates:0,referenceProvenance:a.provenance});continue}let l=(s.byLeaf.get(t.leaf)??[]).filter(({callNode:d})=>d.startPosition.row<=a.line&&d.endPosition.row>=a.line);if(l.length!==1){r.push({callee:t,file:a.file,line:a.line,reason:l.length===0?"call-not-found":"ambiguous-call",candidates:l.length,referenceProvenance:a.provenance});continue}let c=l[0],u=`${a.file}\0${c.callNode.startIndex}\0${c.callNode.endIndex}`;o.has(u)||(o.add(u),n.push({callee:t,caller:oe(C(e,a.file),c.callNode.startPosition.row),file:a.file,line:a.line,startLine:c.callNode.startPosition.row,endLine:c.callNode.endPosition.row,targetText:c.targetNode.text,callNode:c.callNode,targetNode:c.targetNode,arguments:c.arguments,referenceProvenance:a.provenance}))}return{sites:n,unresolved:r,filesVisited:i.size}}function Mo(e,t){let n=D(e,t)?.rootNode;if(!n)return null;let r=new Map;return Wn(n,i=>{if(i.type!=="call_expression"&&i.type!=="call")return;let o=i.childForFieldName("function")??i.namedChild(0);if(!o)return;let a=an(o);if(!a)return;let s=i.childForFieldName("arguments")??i.namedChildren.find(u=>u.type==="arguments"),l={callNode:i,targetNode:o,arguments:s?.namedChildren??[]},c=r.get(a);c?c.push(l):r.set(a,[l])}),{byLeaf:r}}function Wn(e,t){t(e);for(let n of e.namedChildren)Wn(n,t)}var Oo=$("call-parameter-value-flow",{clearGroups:[]});function we(e,t){let n=`${t.callee.symbolId}\0${t.file}\0${t.callNode.startIndex}\0${t.callNode.endIndex}`;return Oo.get(e,n,()=>jo(e,t))}function Ne(e,t){let n=new Set(t);return[...new Set(e.transfers.flatMap(r=>n.has(r.calleePosition)?[r.callerPosition]:[]))].sort((r,i)=>r-i)}function jo(e,t){let n={file:t.file,startLine:t.startLine,endLine:t.endLine};if(!t.caller)return{callee:t.callee,caller:null,call:n,transfers:[],unknown:t.arguments.map((l,c)=>({calleePosition:c,argumentText:l.text.trim(),reason:"caller-unavailable",proof:n}))};let r=D(e,t.caller.relativePath)?.rootNode,i=r?Vo(r,t.caller.startLine,t.caller.endLine):null;if(!i)return{callee:t.callee,caller:t.caller,call:n,transfers:[],unknown:t.arguments.map((l,c)=>({calleePosition:c,argumentText:l.text.trim(),reason:"caller-syntax-unavailable",proof:n}))};let o=Ho(i),a=[],s=[];return t.arguments.forEach((l,c)=>{let u=l.text.trim(),d=o.indexOf(u);d>=0?a.push({calleePosition:c,callerPosition:d,argumentText:u,proof:n}):s.push({calleePosition:c,argumentText:u,reason:"argument-not-direct-parameter",proof:n})}),{callee:t.callee,caller:t.caller,call:n,transfers:a,unknown:s}}function Vo(e,t,n){let r=null;return Zn(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function Ho(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(Kn)??[]}function Kn(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?Kn(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function Zn(e,t){t(e);for(let n of e.namedChildren)Zn(n,t)}var qo=8,Go=8;function Qn(e,t){let n=[],r=zo(e,n),i=r.summaries,o=Uo(e,t,i,n),a=Wo(e,t,n);return{observations:ia([...o.observations,...a]),bodySummaries:i.size,discriminatorSummaries:o.summaries,filesInspected:r.filesInspected,errors:n}}function zo(e,t){let n=new Map,r=[],i=z(e);for(let o of i){let a=L(e,o);if(!/\bJSON\.stringify\s*\(/u.test(a)||!/\bbody\s*:/u.test(a))continue;let s=k(e,o);if(s)for(let[l,c]of Ko(s)){let u={definition:l,parameterIndexes:c,depth:0,proofSpans:[{file:o,startLine:l.startLine,endLine:l.endLine}]};n.set(l.symbol,u),r.push(u)}}for(;r.length>0;){let o=r.shift();if(!(o.depth>=qo))try{for(let a of Ie(e,o.definition).sites){if(!k(e,a.file))continue;let l=a.caller;if(!l)continue;let c=Ne(we(e,a),o.parameterIndexes);if(c.length===0)continue;let u={definition:l,parameterIndexes:ir(c),depth:o.depth+1,proofSpans:[...o.proofSpans,{file:a.file,startLine:a.startLine,endLine:a.endLine}]};Jo(n,u)&&r.push(n.get(l.symbol))}}catch(a){t.push(`builtin.carrier body summary failed for ${o.definition.relativePath}: ${Bt(a)}`)}}return{summaries:n,filesInspected:i.length}}function Uo(e,t,n,r){let i=new Map,o=[],a=[];for(let s of t){if(s.action!=="http.request"||s.strength==="candidate"||s.sourceScope!=="production")continue;let l=Jn(s);if(!l)continue;let c=k(e,s.source.file);if(!c)continue;let u=tr(c.root,s.source.startLine),d=u.find(v=>v.startPosition.row===s.source.startLine)??u[0];if(!d)continue;let p=Lt(d);if(!p)continue;let f=ce(e,s.source.file,p.text);if(f.length!==1)continue;let m=n.get(f[0].symbol);if(!m)continue;let g=s.owner.symbol?C(e,s.owner.file).find(v=>v.symbol===s.owner.symbol):null;if(!g)continue;let S=Yo(c,g),h=Je(d);for(let v of m.parameterIndexes){let F=ta(c,h[v]);if(F)for(let x of na(F)){let w=nr(x),y=rr(x);if(!w||!y)continue;let R=S.indexOf(y.text.trim());if(R>=0){let _={definition:g,carrier:l,field:w,parameterIndex:R,depth:0,proofObservationIds:[s.id],proofSpans:[s.source,{file:s.source.file,startLine:x.startPosition.row,endLine:x.endPosition.row}]},P=Xn(_);i.has(P)||(i.set(P,_),o.push(_));continue}let I=V(c,y);!I||I.evidence==="expression"||a.push(Pt(c,x,"carrier.publish",l,w,I.value,[s.id]))}}}for(;o.length>0;){let s=o.shift();if(!(s.depth>=Go))try{for(let l of Ie(e,s.definition).sites){let c=k(e,l.file);if(!c)continue;let u=l.callNode,d=Je(u)[s.parameterIndex];if(!d)continue;let p=V(c,d);p&&p.evidence!=="expression"&&a.push(Pt(c,u,"carrier.publish",s.carrier,s.field,p.value,s.proofObservationIds));let f=l.caller;if(!f)continue;let m=we(e,l).transfers.find(h=>h.calleePosition===s.parameterIndex)?.callerPosition;if(m===void 0)continue;let g={...s,definition:f,parameterIndex:m,depth:s.depth+1,proofSpans:[...s.proofSpans,{file:l.file,startLine:l.startLine,endLine:l.endLine}]},S=Xn(g);i.has(S)||(i.set(S,g),o.push(g))}}catch(l){r.push(`builtin.carrier discriminator summary failed for ${s.definition.relativePath}: ${Bt(l)}`)}}return{observations:a,summaries:i.size}}function Wo(e,t,n){let r=[],i=t.filter(o=>o.action==="registry.handle"&&o.strength!=="candidate"&&o.sourceScope==="production");for(let o of t){if(o.action!=="http.handle"||o.strength==="candidate"||o.sourceScope!=="production")continue;let a=Jn(o);if(!a)continue;let s=k(e,o.source.file);if(!s)continue;let l=tr(s.root,o.source.startLine)[0];if(l)for(let c of Je(l).slice(1)){let u=ce(e,o.source.file,c.text);for(let d of u)try{let p=k(e,d.relativePath);if(!p)continue;let f=Qe(p.root,d.startLine,d.endLine);if(!f)continue;K(f,m=>{if(m.type!=="call_expression")return;let g=Lt(m);if(!g)return;let S=/^([A-Za-z_$][\w$]*)\s*\[\s*([A-Za-z_$][\w$]*)\s*\]$/u.exec(g.text.trim());if(!S)return;let h=S[1],v=S[2],F=Xo(e,p,d,v);if(!F)return;let x=Qo(e,d.relativePath,h);for(let w of i){let y=w.keyParts.find(P=>P.name==="registry")?.value,R=w.keyParts.find(P=>P.name==="key")?.value;if(!y||!R||!x.some(P=>P.file===w.source.file&&P.binding===y))continue;let I=k(e,w.source.file),_=I?ea(I.root,w.source.startLine):null;!I||!_||r.push(Pt(I,_,"carrier.consume",a,F,R,[o.id,w.id]))}})}catch(p){n.push(`builtin.carrier consumer analysis failed for ${d.relativePath}: ${Bt(p)}`)}}}return r}function Ko(e){let t=C(e.db,e.file),n=new Map;return K(e.root,r=>{if(r.type!=="pair"||nr(r)?.toLowerCase()!=="body")return;let i=rr(r);if(!i||!/\bJSON\.stringify\s*\(/u.test(i.text))return;let o=oe(t,r.startPosition.row),a=Zo(r);if(!o||!a)return;let s=Yn(a),l=new Set;ra(i,s,l);let c=n.get(o.symbol)??new Set;s.forEach((u,d)=>{u&&l.has(u)&&c.add(d)}),c.size>0&&n.set(o.symbol,c)}),t.flatMap(r=>{let i=n.get(r.symbol);return i?[[r,[...i].sort((o,a)=>o-a)]]:[]})}function Zo(e){let t=e.parent;for(;t;){if(/(?:function|method|lambda)/u.test(t.type)||t.type==="arrow_function")return t;t=t.parent}return null}function Xo(e,t,n,r){let i=Qe(t.root,n.startLine,n.endLine);if(!i)return null;let o=new RegExp(`\\.body\\??\\.${Et(r)}\\b`,"u");if(o.test(i.text))return r;let a=null;if(K(i,u=>{if(a||u.type!=="variable_declarator")return;let d=u.childForFieldName("name")??u.namedChild(0),p=u.childForFieldName("value")??u.namedChild(1);!d||!p||!new RegExp(`(?:^|[,{}])\\s*${Et(r)}\\s*(?:[,}]|$)`,"u").test(d.text)||p.type==="call_expression"&&(a=Lt(p)?.text??null)}),!a)return null;let s=ce(e,n.relativePath,a);if(s.length!==1)return null;let l=k(e,s[0].relativePath),c=l?Qe(l.root,s[0].startLine,s[0].endLine):null;return c&&o.test(c.text)&&new RegExp(`\\b${Et(r)}\\s*[,}]`,"u").test(c.text)?r:null}function Qo(e,t,n){let r=[];for(let i of xt(e,t,n)){let o=Ce(i.initializer);if(o.type==="call_expression")for(let a of Je(o)){let s=a.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(s))for(let l of xt(e,i.definition.relativePath,s))r.push({file:l.definition.relativePath,binding:l.definition.leaf})}}return[...new Map(r.map(i=>[`${i.file}\0${i.binding}`,i])).values()]}function Pt(e,t,n,r,i,o,a){let l=Xe(e,t,"builtin.carrier",n,[{name:"carrier",value:r,evidence:"constant",term:{kind:"literal",value:r}},{name:"field",value:i,evidence:"literal",term:{kind:"literal",value:i}},{name:"value",value:o,evidence:"constant",term:{kind:"literal",value:o}}],"derived","http-body-registry-discriminator");return l.derivation={kind:"mechanically-derived",rule:"http-body-registry-discriminator",ruleVersion:"1",inputFactIds:[...a],sourceSpans:[l.source]},l}function Jn(e){let t=e.keyParts.find(r=>r.name==="method"&&r.evidence!=="expression")?.value,n=e.keyParts.find(r=>r.name==="path"&&r.evidence!=="expression")?.value;return t&&n?`${t.toUpperCase()} ${n}`:null}function Jo(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=ir([...n.parameterIndexes,...t.parameterIndexes]);return r.length===n.parameterIndexes.length&&t.depth>=n.depth?!1:(e.set(t.definition.symbol,{...n,parameterIndexes:r,depth:Math.min(n.depth,t.depth),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0)}function Xn(e){return`${e.definition.symbol}\0${e.carrier}\0${e.field}\0${e.parameterIndex}`}function Yo(e,t){let n=Qe(e.root,t.startLine,t.endLine);return n?Yn(n):[]}function Yn(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(er)??[]}function er(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?er(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function Qe(e,t,n){let r=null;return K(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function ea(e,t){let n=null;return K(e,r=>{r.startPosition.row>t||r.endPosition.row<t||(!n||r.endIndex-r.startIndex<n.endIndex-n.startIndex)&&(n=r)}),n}function tr(e,t){let n=[];return K(e,r=>{r.type==="call_expression"&&r.startPosition.row<=t&&r.endPosition.row>=t&&n.push(r)}),n.sort((r,i)=>r.endIndex-r.startIndex-(i.endIndex-i.startIndex))}function Lt(e){return e.childForFieldName("function")??e.namedChild(0)}function Je(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function ta(e,t){if(!t)return null;let n=t.text.trim();if(!/^[A-Za-z_$][\w$]*$/u.test(n))return Ce(t);let r=null;return K(e.root,i=>{r||i.type!=="variable_declarator"||(i.childForFieldName("name")??i.namedChild(0))?.text.trim()!==n||(r=i.childForFieldName("value")??i.namedChild(1))}),Ce(r||t)}function na(e){let t=Ce(e);return t.type==="object"?t.namedChildren.filter(n=>n.type==="pair"||n.type==="shorthand_property_identifier"):[]}function nr(e){return e.type==="shorthand_property_identifier"?e.text:(e.childForFieldName("key")??e.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")??null}function rr(e){return e.type==="shorthand_property_identifier"?e:e.childForFieldName("value")??e.namedChild(1)}function Ce(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function ra(e,t,n){let r=new Set(e.text.match(/[A-Za-z_$][\w$]*/gu)??[]);for(let i of t)i&&r.has(i)&&n.add(i)}function ir(e){return[...new Set(e)].sort((t,n)=>t-n)}function ia(e){return[...new Map(e.map(t=>[t.id,t])).values()]}function Et(e){return e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}function Bt(e){return e instanceof Error?e.message:String(e)}function K(e,t){t(e);for(let n of e.namedChildren)K(n,t)}import{createHash as oa}from"crypto";function or(e,t){let n=new Map;for(let o of t){if(o.action!=="http.handle"||o.sourceScope!=="production")continue;let a=n.get(o.source.file)??[];a.push(o),n.set(o.source.file,a)}let r=[],i=aa(e);for(let o of i.mounts)for(let a of o.targetFiles)for(let s of n.get(a)??[]){let l=s.keyParts.find(p=>p.name==="path");if(!l||l.evidence==="expression")continue;let c=la(o.prefix.value,l.value),u=s.keyParts.map(p=>p.name==="path"?{name:"path",value:c,evidence:"constant",term:{kind:"concat",parts:[o.prefix.term??{kind:"literal",value:o.prefix.value},l.term??{kind:"literal",value:l.value}]},derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[s.id],sourceSpans:[s.source,{file:o.file,startLine:o.line,endLine:o.line},...o.prefix.derivation?.sourceSpans??[],...l.derivation?.sourceSpans??[]]}}:p),d=`${s.id}\0${o.file}\0${o.line}\0${c}`;r.push({...s,id:`boundary:${oa("sha256").update(d).digest("hex").slice(0,16)}`,keyParts:u,strength:"derived",evidence:"framework-mount-composition",derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[s.id],sourceSpans:[s.source,{file:o.file,startLine:o.line,endLine:o.line}]},resolution:"unresolved"}),s.strength="candidate",s.resolution="unresolved"}return{observations:r,filesInspected:i.filesInspected,mounts:i.mounts.length}}function aa(e){let t=[],n=z(e);for(let r of n){let i=L(e,r);if(!ca(i))continue;let o=k(e,r);o&&ar(o.root,a=>{if(a.type!=="call_expression")return;let s=a.childForFieldName("function")??a.namedChild(0);if(!s||!/\.use$/u.test(s.text.replace(/\s+/gu,"")))return;let l=ua(a);if(l.length<2)return;let c=V(o,l[0]);if(!c||c.evidence==="expression")return;let u=sa(e,r,l[1]);u.length!==0&&t.push({file:r,line:a.startPosition.row,prefix:{value:c.value,evidence:c.evidence,term:c.term,derivation:c.derivation},targetFiles:u})})}return{mounts:t,filesInspected:n.length}}function sa(e,t,n){let r=n.text.replace(/\s+/gu,""),i=/^([A-Za-z_$][\w$]*)/u.exec(r)?.[1];if(!i)return[];let o=A(e,t).find(l=>l.localName===i&&l.sourcePath);if(!o?.sourcePath)return[t];if(o.kind==="namespace")return[o.sourcePath];let a=o.importedName==="default"?i:o.importedName,s=Q(e,o.sourcePath,a);return[...new Set(s.map(l=>l.relativePath))]}function la(e,t){let n=e==="/"?"":e.replace(/\/+$/u,""),r=t.startsWith("/")?t:`/${t}`;return`${n}${r}`||"/"}function ca(e){return/(?:\bfrom\s*|\brequire\s*\(\s*)['"](?:express|fastify|hono|koa-router|@koa\/router)(?:[/']|")/u.test(e)}function ua(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function ar(e,t){t(e);for(let n of e.namedChildren)ar(n,t)}import{createHash as da}from"crypto";var Tt=new Set(["DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT"]),pa=8;function cr(e,t){let n=new Map,r=[],i=[],o=new Set,a=[],s=[];for(let l of t){if(l.action!=="http.request"||!l.owner.symbol||l.evidence!=="call-expression"&&l.evidence!=="client-adapter")continue;let c=C(e,l.owner.file).find(f=>f.symbol===l.owner.symbol);if(!c)continue;let u=k(e,c.relativePath);if(!u)continue;let d=sr(u,c),p={definition:c,...d,constantMethods:l.keyParts.flatMap(f=>f.name==="method"&&f.evidence!=="expression"&&Tt.has(f.value.toUpperCase())?[f.value.toUpperCase()]:[]),depth:0,proofObservationIds:[l.id],proofSpans:[l.source]};lr(n,p)&&r.push(n.get(c.symbol))}for(;r.length>0;){let l=r.shift();if(!(l.depth>=pa))try{let c=Ie(e,l.definition);s.push(...c.unresolved.map(u=>fa(l,u)));for(let u of c.sites){let d=k(e,u.file);if(!d)continue;o.add(u.file);let p=u.callNode,f=ya(l,p,d);f&&i.push(f);let m=u.caller;if(!m)continue;let g=sr(d,m),S=ga(e,l,u),h={definition:m,pathParameterIndexes:Ye([...g.pathParameterIndexes,...S.pathParameterIndexes]),methodParameterIndexes:Ye([...g.methodParameterIndexes,...S.methodParameterIndexes]),constantMethods:de([...l.constantMethods,...g.constantMethods]),depth:l.depth+1,proofObservationIds:de([...l.proofObservationIds,...f?[f.id]:[]]),proofSpans:[...l.proofSpans,{file:u.file,startLine:u.startLine,endLine:u.endLine}]};lr(n,h)&&r.push(n.get(m.symbol))}}catch(c){a.push(`builtin.http-summary failed for ${l.definition.relativePath}:${l.definition.startLine+1}: ${c instanceof Error?c.message:String(c)}`)}}return{observations:i,frontiers:ma(s),summaries:n.size,filesInspected:o.size,errors:a}}function fa(e,t){let n=de([...e.pathParameterIndexes.length>0?["path"]:[],...e.methodParameterIndexes.length>0&&e.constantMethods.length!==1?["method"]:[]]),r=e.constantMethods.length===1?e.constantMethods[0]:"?",i=`${e.definition.symbol}\0${t.file}\0${t.line}\0${t.reason}`;return{observationId:`frontier:${da("sha256").update(i).digest("hex").slice(0,16)}`,kind:"call-resolution",action:"http.request",strength:"candidate",source:{file:t.file,startLine:t.line,endLine:t.line},ownerShortName:null,address:`method=${r??"?"} path=?`,reason:`Compiler identity found a reference to ${e.definition.leaf}, but exact call recovery stopped with ${t.reason} (${t.candidates} syntax candidate(s)); HTTP value propagation did not cross this site.`,missingKeyParts:n.length>0?n:["call"],sourceScope:Ue(t.file)}}function ma(e){return[...new Map(e.map(t=>[t.observationId,t])).values()].sort((t,n)=>t.observationId.localeCompare(n.observationId))}function ya(e,t,n){let r=dr(t),i=e.pathParameterIndexes.flatMap(d=>{let p=V(n,r[d]);return p&&p.evidence!=="expression"&&va(p.value)?[{index:d,value:p}]:[]}),o=e.methodParameterIndexes.flatMap(d=>{let p=V(n,r[d]),f=p?.value.toUpperCase();return p&&f&&p.evidence!=="expression"&&Tt.has(f)?[{index:d,value:{...p,value:f}}]:[]}),a=de([...e.constantMethods,...o.map(d=>d.value.value)]);if(i.length!==1||a.length!==1)return null;let s=i[0].value,l=o.find(d=>d.value.value===a[0])?.value,c=[{name:"method",value:a[0],evidence:l?"constant":"literal",term:l?.term??{kind:"literal",value:a[0]},derivation:l?.derivation},{name:"path",value:s.value,evidence:"constant",term:s.term,derivation:s.derivation}],u=Xe(n,t,"builtin.http-summary","http.request",c,"derived","compiler-resolved-http-summary");return u.derivation={kind:"mechanically-derived",rule:"compiler-resolved-http-summary",ruleVersion:"1",inputFactIds:e.proofObservationIds,sourceSpans:[...e.proofSpans,u.source]},u}function sr(e,t){let n=Sa(e.root,t.startLine,t.endLine);if(!n)return{pathParameterIndexes:[],methodParameterIndexes:[],constantMethods:[]};let r=ba(n),i=new Set,o=new Set,a=new Set;return kt(n,s=>{if(s.type==="call_expression"&&((s.childForFieldName("function")??s.namedChild(0))?.text.replace(/\s+/gu,"").split(".").at(-1)??"")==="fetch"){let f=dr(s);Fe(f[0],r,i);let m=ha(f[1],"method");if(m){Fe(m,r,o);let g=V(e,m),S=g?.value.toUpperCase();S&&g?.evidence!=="expression"&&Tt.has(S)&&a.add(S)}else Fe(f[1],r,o)}if(s.type!=="pair")return;let l=s.childForFieldName("key")??s.namedChild(0),c=s.childForFieldName("value")??s.namedChild(1),u=l?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase();(u==="url"||u==="path"||u==="endpoint")&&Fe(c,r,i),(u==="init"||u==="requestinit"||u==="options")&&Fe(c,r,o)}),{pathParameterIndexes:r.flatMap((s,l)=>s&&i.has(s)?[l]:[]),methodParameterIndexes:r.flatMap((s,l)=>s&&o.has(s)?[l]:[]),constantMethods:[...a].sort()}}function ga(e,t,n){let r=we(e,n);return{pathParameterIndexes:Ne(r,t.pathParameterIndexes),methodParameterIndexes:Ne(r,t.methodParameterIndexes)}}function lr(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=Ye([...n.pathParameterIndexes,...t.pathParameterIndexes]),i=Ye([...n.methodParameterIndexes,...t.methodParameterIndexes]),o=de([...n.constantMethods,...t.constantMethods]);return r.length!==n.pathParameterIndexes.length||i.length!==n.methodParameterIndexes.length||o.length!==n.constantMethods.length||t.depth<n.depth?(e.set(t.definition.symbol,{...n,pathParameterIndexes:r,methodParameterIndexes:i,constantMethods:o,depth:Math.min(n.depth,t.depth),proofObservationIds:de([...n.proofObservationIds,...t.proofObservationIds]),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0):!1}function ha(e,t){if(!e)return null;for(let n of e.namedChildren)if(!(n.type!=="pair"||(n.childForFieldName("key")??n.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase()!==t))return n.childForFieldName("value")??n.namedChild(1);return null}function Fe(e,t,n){if(!e)return;let r=new Set(e.text.match(/[A-Za-z_$][\w$]*/gu)??[]);for(let i of t)i&&r.has(i)&&n.add(i)}function ba(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(ur)??[]}function ur(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?ur(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function Sa(e,t,n){let r=null;return kt(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function dr(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function va(e){return e.startsWith("/")||/^https?:\/\//iu.test(e)}function Ye(e){return[...new Set(e)].sort((t,n)=>t-n)}function de(e){return[...new Set(e)].sort()}function kt(e,t){t(e);for(let n of e.namedChildren)kt(n,t)}import{createHash as xa}from"crypto";function mr(e){let t=pr(e.filter(r=>r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim")),n=pr(e.filter(r=>r.action==="database.write"&&r.evidence==="persistence-insert"));return e.flatMap(r=>r.action==="database.write"&&r.evidence==="persistence-insert"?$t(r).flatMap(i=>{let o=t.get(i)?.[0];return o?[fr(r,o,i,"queue.send")]:[]}):r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim"?$t(r).flatMap(i=>{let o=n.get(i)?.[0];return o?[fr(r,o,i,"queue.consume")]:[]}):[])}function pr(e){let t=new Map;for(let n of e)for(let r of $t(n)){let i=t.get(r);i?i.push(n):t.set(r,[n])}for(let n of t.values())n.sort((r,i)=>r.id.localeCompare(i.id));return t}function $t(e){return e.keyParts.filter(t=>t.name==="resource").map(t=>t.value)}function fr(e,t,n,r){let i=`database:${n}`,o=r==="queue.send"?"database-queue-insert":"database-queue-skip-locked-claim",a=[e.id,r,i,o].join("\0");return{...e,id:`boundary:${xa("sha256").update(a).digest("hex").slice(0,16)}`,extractor:"builtin.database-queue",action:r,keyParts:[{name:"address",value:i,evidence:"identifier",term:{kind:"symbol",symbol:n},derivation:{kind:"mechanically-derived",rule:"database-work-queue.resource",ruleVersion:"1",inputFactIds:[e.id,t.id],sourceSpans:[e.source,t.source]}}],evidence:o,strength:"derived",protocol:"queue",role:r==="queue.send"?"producer":"consumer",derivation:{kind:"mechanically-derived",rule:"database-work-queue.insert-skip-locked",ruleVersion:"1",inputFactIds:[e.id,t.id],sourceSpans:[e.source,t.source]},valuePrecision:"symbolic",resolution:"unresolved"}}var At="runtime-boundaries-v15",nt=[{id:"http.method-path",protocol:"http",producerActions:["http.request"],consumerActions:["http.handle"],keyNames:["method","path"],traversable:!0},{id:"registry.identity-key",protocol:"registry",producerActions:["registry.dispatch"],consumerActions:["registry.handle"],keyNames:["registry","key"],traversable:!0},{id:"registry.capability-key",protocol:"registry",producerActions:["registry.reference"],consumerActions:["registry.handle"],keyNames:["key"],traversable:!0,requireUniqueConsumer:!0},{id:"queue.address",protocol:"queue",producerActions:["queue.send"],consumerActions:["queue.consume"],keyNames:["address"],traversable:!0},{id:"carrier.discriminator",protocol:"carrier",producerActions:["carrier.publish"],consumerActions:["carrier.consume"],keyNames:["carrier","field","value"],traversable:!0},{id:"resource.identity",protocol:"database",producerActions:["database.write"],consumerActions:["database.read"],keyNames:["resource"],traversable:!1},{id:"framework.effect-httpapi-operation",protocol:"framework",producerActions:[],consumerActions:["framework.handle"],declarationActions:["framework.declare"],keyNames:["adapter","group","operation"],traversable:!0,linkFrom:"declaration",requireUniquePair:!0}],Ra=64;function Ia(e,t={}){let n=z(e),r=new Set(n),i=new Set((t.affectedFiles??[]).map(Fa)),o=t.previousGraph?.fileCoverage,a=i.size>0&&t.previousGraph?.extractorVersion===At&&o!==void 0&&o.length===t.previousGraph.coverage.filesScanned,s=a?o.filter(N=>r.has(N.file)&&!i.has(N.file)):[],l=new Set(s.flatMap(N=>N.observationIds)),c=a?t.previousGraph.observations.filter(N=>l.has(N.id)&&r.has(N.source.file)):[],u=a?n.filter(N=>i.has(N)):n,d=[],p=o?.reduce((N,st)=>N+st.observationIds.length,0)??0,f=performance.now(),m=wa(e,u);Y(d,"direct-extraction",f,u.length,m.observations.length,{filesVisited:u.length,filesReused:s.length,factsReused:c.length,factsInvalidated:Math.max(0,p-c.length)});let g=[...s,...m.fileCoverage].sort((N,st)=>N.file.localeCompare(st.file)),S=Ca(g),h=g.flatMap(N=>N.extractionErrors),v=_e([...c,...m.observations]),F=_e([...v,...mr(v)]);f=performance.now();let x=cr(e,F);Y(d,"http-summary",f,F.length,x.observations.length,{filesVisited:x.filesInspected}),S.set("builtin.wrapper",{id:"builtin.wrapper",applicableFiles:x.filesInspected,observations:x.observations.length,errors:x.errors.length}),h.push(...x.errors);let w=_e([...F,...x.observations]);f=performance.now();let y=or(e,w);Y(d,"http-mount",f,w.length,y.observations.length,{filesVisited:y.filesInspected});let R=_e([...w,...y.observations]);f=performance.now();let I=Qn(e,R);Y(d,"carrier",f,R.length,I.observations.length,{filesVisited:I.filesInspected}),S.set("builtin.carrier",{id:"builtin.carrier",applicableFiles:I.bodySummaries,observations:I.observations.length,errors:I.errors.length}),h.push(...I.errors);let _=_e([...R,...I.observations]);f=performance.now();let P=_a(_);Y(d,"relations",f,_.length,P.length),f=performance.now();let Dt=Pa(_,P);Y(d,"links",f,P.length,Dt.length),La(_,P),f=performance.now();let Mt=ka([...Ba(_,P),...x.frontiers]);return Y(d,"frontiers",f,_.length,Mt.length),{schemaVersion:2,extractorVersion:At,observations:_,relationGroups:P,links:Dt,frontiers:Mt,coverage:{filesScanned:n.length,filesWithAst:g.filter(N=>N.hasAst).length,filesWithoutAst:g.filter(N=>!N.hasAst).length,...a?{filesReused:s.length}:{},extractors:[...S.values()],extractionErrors:h,phases:d},fileCoverage:g}}function Y(e,t,n,r,i,o={}){e.push({id:t,durationMs:Math.max(0,performance.now()-n),inputFacts:r,outputFacts:i,...o})}function wa(e,t){let n=[],r=[];for(let i of t){let o=L(e,i),a=Ft.filter(c=>c.supports(o)),s=a.length>0?k(e,i):null,l={file:i,hasAst:s!==null||Na(i,o),observationIds:[],extractors:[],extractionErrors:[]};if(s)for(let c of a){let u={id:c.id,applicableFiles:1,observations:0,errors:0};try{let d=c.extract(s);u.observations=d.length,n.push(...d),l.observationIds.push(...d.map(p=>p.id))}catch(d){u.errors=1,l.extractionErrors.push(`${c.id} failed for ${i}: ${d instanceof Error?d.message:String(d)}`)}l.extractors.push(u)}r.push(l)}return{observations:n,fileCoverage:r}}function Na(e,t){return t?on(e)?/<script\b/iu.test(t):Be(e)!==null:!1}function Ca(e){let t=new Map(Ft.map(n=>[n.id,{id:n.id,applicableFiles:0,observations:0,errors:0}]));for(let n of e)for(let r of n.extractors){let i=t.get(r.id);i&&(i.applicableFiles+=r.applicableFiles,i.observations+=r.observations,i.errors+=r.errors)}return t}function Fa(e){return e.replaceAll("\\","/").replace(/^\.\//u,"")}function _a(e){let t=new Map;for(let n of nt){let r=new Set([...n.producerActions,...n.consumerActions,...n.declarationActions??[]]);for(let i of e){if(!r.has(i.action)||i.strength==="candidate")continue;let o=$a(i,n.keyNames);if(!o)continue;let a=o.map(d=>`${d.name}=${hr(d.name,d.value)}`).join("\0"),s=i.sourceScope==="production"?"production":i.sourceScope,l=`${n.id}\0${s}\0${a}`,c=`boundary-group:${yr("sha256").update(l).digest("hex").slice(0,16)}`,u=t.get(c)??{id:c,protocol:n.protocol,joinRule:n.id,normalizedKey:a,keyParts:o,producerIds:[],consumerIds:[],declarationIds:[],derivation:{kind:"mechanically-derived",rule:n.id,ruleVersion:"2",inputFactIds:[],sourceSpans:[]}};n.producerActions.includes(i.action)&&u.producerIds.push(i.id),n.consumerActions.includes(i.action)&&u.consumerIds.push(i.id),n.declarationActions?.includes(i.action)&&u.declarationIds.push(i.id),u.derivation.inputFactIds.push(i.id),u.derivation.sourceSpans.push(i.source),t.set(c,u)}}return[...t.values()].map(Ea).sort(Da)}function Ea(e){return{...e,producerIds:et(e.producerIds),consumerIds:et(e.consumerIds),declarationIds:et(e.declarationIds),derivation:{...e.derivation,inputFactIds:et(e.derivation.inputFactIds),sourceSpans:[...new Map(e.derivation.sourceSpans.map(t=>[`${t.file}:${t.startLine}:${t.endLine}`,t])).values()]}}}function Pa(e,t){let n=new Map(e.map(i=>[i.id,i])),r=new Map;for(let i of t){let o=nt.find(s=>s.id===i.joinRule);if(!o?.traversable)continue;let a=o.linkFrom==="declaration"?i.declarationIds:i.producerIds;if(!(a.length===0||i.consumerIds.length===0)&&!(o.requireUniquePair&&(a.length!==1||i.consumerIds.length!==1))&&!(o.requireUniqueConsumer&&i.consumerIds.length!==1)&&!(a.length*i.consumerIds.length>Ra))for(let s of a)for(let l of i.consumerIds){let c=n.get(s),u=n.get(l);if(!c||!u||Aa(c,u))continue;let d=c.strength==="derived"||u.strength==="derived"?"derived":"exact",p=`${i.joinRule}\0${s}\0${l}`,f={id:`boundary-link:${yr("sha256").update(p).digest("hex").slice(0,16)}`,from:s,to:l,joinRule:i.joinRule,matchedKeyParts:i.keyParts,strength:d,derivation:{kind:"mechanically-derived",rule:i.joinRule,ruleVersion:"2",inputFactIds:[s,l],sourceSpans:[c.source,u.source]}};r.set(f.id,f)}}return[...r.values()].sort(Ma)}function La(e,t){let n=new Set(t.filter(gr).flatMap(tt)),r=new Set(t.filter(Ta).flatMap(tt));for(let i of e)i.resolution=n.has(i.id)?"locally-linked":r.has(i.id)?"ambiguous":"unresolved"}function Ba(e,t){let n=new Set(e.filter(o=>o.strength!=="candidate").map(o=>`${o.action}\0${o.source.file}\0${o.source.startLine}\0${o.source.endLine}`)),r=new Set(t.flatMap(tt)),i=new Set(t.filter(gr).flatMap(tt));return e.filter(o=>o.sourceScope==="production").filter(o=>o.strength!=="candidate"||!n.has(`${o.action}\0${o.source.file}\0${o.source.startLine}\0${o.source.endLine}`)).filter(o=>!i.has(o.id)).map(o=>{let a=o.keyParts.filter(l=>l.evidence==="expression"||l.value.length===0).map(l=>l.name),s=a.length>0?`${o.extractor} observed ${o.action}, but ${a.join(", ")} remained symbolic or unknown.`:o.resolution==="ambiguous"?`${o.extractor} established the address for ${o.action}, but more than one indexed peer has the same runtime key.`:r.has(o.id)?`${o.extractor} established the address for ${o.action}, but the indexed production scope contains no counterpart role in that relation group.`:`${o.extractor} observed ${o.action}, but no supported factorization rule could establish its addressed relation.`;return{observationId:o.id,reason:s,missingKeyParts:a,sourceScope:o.sourceScope}}).sort((o,a)=>o.observationId.localeCompare(a.observationId))}function tt(e){return[...e.producerIds,...e.consumerIds,...e.declarationIds]}function gr(e){let t=nt.find(r=>r.id===e.joinRule);if(!t)return!1;let n=t.linkFrom==="declaration"?e.declarationIds:e.producerIds;return n.length===0||e.consumerIds.length===0?!1:!t.requireUniquePair||n.length===1&&e.consumerIds.length===1}function Ta(e){let t=nt.find(r=>r.id===e.joinRule);if(!t?.requireUniquePair)return!1;let n=t.linkFrom==="declaration"?e.declarationIds:e.producerIds;return n.length>0&&e.consumerIds.length>0&&(n.length!==1||e.consumerIds.length!==1)}function ka(e){return[...new Map(e.map(t=>[t.observationId,t])).values()].sort((t,n)=>t.observationId.localeCompare(n.observationId))}function $a(e,t){let n=[];for(let r of t){let i=e.keyParts.find(o=>o.name===r);if(!i||i.evidence==="expression"||i.value.length===0)return null;n.push({...i,value:hr(r,i.value)})}return n}function hr(e,t){if(e==="method")return t.toUpperCase();if(e!=="path")return t;let n=t.startsWith("/")?t:`/${t}`;return n.length>1?n.replace(/\/+$/u,""):n}function Aa(e,t){return e.source.file===t.source.file&&e.source.startLine===t.source.startLine}function _e(e){return[...new Map(e.map(t=>[t.id,t])).values()].sort((t,n)=>t.source.file.localeCompare(n.source.file)||t.source.startLine-n.source.startLine||t.action.localeCompare(n.action))}function et(e){return[...new Set(e)].sort()}function Da(e,t){return e.joinRule.localeCompare(t.joinRule)||e.normalizedKey.localeCompare(t.normalizedKey)}function Ma(e,t){return e.joinRule.localeCompare(t.joinRule)||e.from.localeCompare(t.from)||e.to.localeCompare(t.to)}import Oa from"better-sqlite3";var it="codebaseiq_runtime_boundaries",ee="codebaseiq_runtime_observations",ot="codebaseiq_runtime_relation_groups",at="codebaseiq_runtime_relation_participants";function ja(e,t){let n=new Oa(Zt(e));try{n.exec(`
62
62
  CREATE TABLE IF NOT EXISTS ${it} (
63
63
  singleton INTEGER PRIMARY KEY CHECK (singleton = 1),
64
64
  schema_version INTEGER NOT NULL,
65
65
  extractor_version TEXT NOT NULL,
66
66
  payload TEXT NOT NULL
67
67
  )
68
- `),Va(n),n.transaction(()=>{n.prepare(`INSERT OR REPLACE INTO ${it} (singleton, schema_version, extractor_version, payload) VALUES (1, ?, ?, ?)`).run(t.schemaVersion,t.extractorVersion,JSON.stringify(t)),n.prepare(`DELETE FROM ${ee}`).run(),n.prepare(`DELETE FROM ${at}`).run(),n.prepare(`DELETE FROM ${ot}`).run();let r=n.prepare(`INSERT INTO ${ee}
68
+ `),Ha(n),n.transaction(()=>{n.prepare(`INSERT OR REPLACE INTO ${it} (singleton, schema_version, extractor_version, payload) VALUES (1, ?, ?, ?)`).run(t.schemaVersion,t.extractorVersion,JSON.stringify(t)),n.prepare(`DELETE FROM ${ee}`).run(),n.prepare(`DELETE FROM ${at}`).run(),n.prepare(`DELETE FROM ${ot}`).run();let r=n.prepare(`INSERT INTO ${ee}
69
69
  (id, protocol, action, role, strength, source_scope, resolution, file, start_line, end_line, owner_symbol, payload)
70
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);for(let a of t.observations)r.run(a.id,a.protocol,a.action,a.role,a.strength,a.sourceScope,a.resolution,a.source.file,a.source.startLine,a.source.endLine,a.owner.symbol,JSON.stringify(a));let i=n.prepare(`INSERT INTO ${ot} (id, protocol, join_rule, normalized_key, payload) VALUES (?, ?, ?, ?, ?)`),o=n.prepare(`INSERT INTO ${at} (group_id, observation_id, participant_role) VALUES (?, ?, ?)`);for(let a of t.relationGroups){i.run(a.id,a.protocol,a.joinRule,a.normalizedKey,JSON.stringify(a));for(let s of a.producerIds)o.run(a.id,s,"producer");for(let s of a.consumerIds)o.run(a.id,s,"consumer");for(let s of a.declarationIds)o.run(a.id,s,"declaration")}})()}finally{n.close()}}function ja(e,t={}){if(!Ha(e,ee))return hr(e)?.observations??[];let n=[],r=[];return rt(n,r,"protocol",t.protocols),rt(n,r,"action",t.actions),rt(n,r,"source_scope",t.sourceScopes),rt(n,r,"file",t.files),e.all(`SELECT payload FROM ${ee}${n.length>0?` WHERE ${n.join(" AND ")}`:""} ORDER BY file, start_line, id`,...r).flatMap(o=>qa(o.payload))}function Va(e){e.exec(`
70
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);for(let a of t.observations)r.run(a.id,a.protocol,a.action,a.role,a.strength,a.sourceScope,a.resolution,a.source.file,a.source.startLine,a.source.endLine,a.owner.symbol,JSON.stringify(a));let i=n.prepare(`INSERT INTO ${ot} (id, protocol, join_rule, normalized_key, payload) VALUES (?, ?, ?, ?, ?)`),o=n.prepare(`INSERT INTO ${at} (group_id, observation_id, participant_role) VALUES (?, ?, ?)`);for(let a of t.relationGroups){i.run(a.id,a.protocol,a.joinRule,a.normalizedKey,JSON.stringify(a));for(let s of a.producerIds)o.run(a.id,s,"producer");for(let s of a.consumerIds)o.run(a.id,s,"consumer");for(let s of a.declarationIds)o.run(a.id,s,"declaration")}})()}finally{n.close()}}function Va(e,t={}){if(!qa(e,ee))return br(e)?.observations??[];let n=[],r=[];return rt(n,r,"protocol",t.protocols),rt(n,r,"action",t.actions),rt(n,r,"source_scope",t.sourceScopes),rt(n,r,"file",t.files),e.all(`SELECT payload FROM ${ee}${n.length>0?` WHERE ${n.join(" AND ")}`:""} ORDER BY file, start_line, id`,...r).flatMap(o=>Ga(o.payload))}function Ha(e){e.exec(`
71
71
  CREATE TABLE IF NOT EXISTS ${ee} (
72
72
  id TEXT PRIMARY KEY,
73
73
  protocol TEXT NOT NULL,
@@ -105,5 +105,5 @@ import{a as Vt,b as Ht}from"./chunk-7MGU3HPH.js";import{A as rn,D,E as on,F as U
105
105
  );
106
106
  CREATE INDEX IF NOT EXISTS idx_runtime_participants_observation
107
107
  ON ${at}(observation_id, participant_role);
108
- `)}function Ha(e,t){return!!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",t)}function rt(e,t,n,r){!r||r.length===0||(e.push(`${n} IN (${r.map(()=>"?").join(", ")})`),t.push(...r))}function qa(e){try{return[JSON.parse(e)]}catch{return[]}}function hr(e){if(!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",it))return null;let n=e.get(`SELECT schema_version, payload FROM ${it} WHERE singleton = 1`);if(!n||n.schema_version!==2)return null;try{let r=JSON.parse(n.payload);return r.schemaVersion===2&&Array.isArray(r.observations)&&Array.isArray(r.relationGroups)&&Array.isArray(r.links)?r:null}catch{return null}}export{is as a,ye as b,os as c,Me as d,je as e,ut as f,ks as g,$s as h,As as i,_n as j,We as k,Q as l,V as m,qe as n,mt as o,ul as p,Us as q,Yr as r,Ws as s,Ks as t,Ll as u,Bl as v,Tl as w,Cn as x,rl as y,il as z,ft as A,yt as B,Rn as C,wn as D,gt as E,_l as F,_i as G,Ei as H,El as I,Pi as J,Li as K,jl as L,ht as M,Ie as N,we as O,At as P,Ra as Q,Oa as R,ja as S,hr as T,Za as U,Xa as V,Sr as W,Qa as X,Ja as Y,E as Z};
109
- //# sourceMappingURL=chunk-NCZUNH3E.js.map
108
+ `)}function qa(e,t){return!!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",t)}function rt(e,t,n,r){!r||r.length===0||(e.push(`${n} IN (${r.map(()=>"?").join(", ")})`),t.push(...r))}function Ga(e){try{return[JSON.parse(e)]}catch{return[]}}function br(e){if(!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",it))return null;let n=e.get(`SELECT schema_version, payload FROM ${it} WHERE singleton = 1`);if(!n||n.schema_version!==2)return null;try{let r=JSON.parse(n.payload);return r.schemaVersion===2&&Array.isArray(r.observations)&&Array.isArray(r.relationGroups)&&Array.isArray(r.links)?r:null}catch{return null}}export{os as a,ye as b,as as c,Me as d,je as e,ut as f,$s as g,As as h,Ds as i,En as j,Ue as k,Q as l,V as m,qe as n,mt as o,dl as p,Ws as q,ei as r,Ks as s,Zs as t,Bl as u,Tl as v,kl as w,Fn as x,il as y,ol as z,ft as A,yt as B,In as C,Nn as D,gt as E,El as F,Ei as G,Pi as H,Pl as I,Li as J,Bi as K,Vl as L,ht as M,Ie as N,we as O,At as P,Ia as Q,ja as R,Va as S,br as T,Xa as U,Qa as V,Sr as W,Ja as X,Ya as Y,E as Z};
109
+ //# sourceMappingURL=chunk-IGQQUENU.js.map