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,5 +1,5 @@
1
- import{a as R,b as _,c as Te,d as Fe,e as $,f as Le,k as ie,l as oe,m as Oe,o as Ge}from"./chunk-ZKX2FRS6.js";import{a as W}from"./chunk-NNOKTMZT.js";import{a as De}from"./chunk-ADTBPVUZ.js";import{f as ke,i as se,r as qe,t as je}from"./chunk-BMYOV5GP.js";import{d as Ne,e as Ce}from"./chunk-CWONGW6P.js";import{d as ae}from"./chunk-3LCDIREB.js";import{E as Ae,H as S,L as Ee,P as Be,Q as F,R as re,i as Ie,k as Me,o as Re,q as d,s as we,t as Pe,v as G,x as ve}from"./chunk-NNJ2KZZG.js";function Mt(t,e){return t.reason instanceof Error?t.reason:new Error(e)}function ir(t,e){if(t?.aborted)throw Mt(t,e)}import{join as Rt}from"path";var wt=t=>{if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t.pid;return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?{pid:e}:null};function dr(t,e={}){return z(Rt(t,"gc.lock"),e)}function z(t,e={}){let n=e.waitMs??0,r=e.pollMs??10,i=e.now??$,o=i()+n;do{let s=Pt(t);if(s)return vt(s);let a=o-i();if(a<=0)return null;At(Math.min(r,a))}while(i()<=o);return null}function Pt(t){let e=Le(t,{kind:"generic",parseLegacy:wt});return e.kind==="acquired"?e.lock:null}function vt(t){return{release:()=>{t.release()}}}function At(t){let e=new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));Atomics.wait(e,0,0,t)}function _e(t,e,n={}){ie(t,$e(e,n),{durability:"visibility",runtime:n.runtime})}function pr(t,e,n={}){return ie(t,$e(e,n),{durability:"durable",runtime:n.runtime})}function $e(t,e){let n=JSON.stringify(t,null,e.spacing);return e.trailingNewline?`${n}
1
+ import{a as R,b as _,c as Te,d as Fe,e as $,f as Le,k as ie,l as oe,m as Oe,o as Ge}from"./chunk-CANBLFVQ.js";import{a as W}from"./chunk-B2E3HZ2A.js";import{a as De}from"./chunk-RVYLJDXC.js";import{h as ke,k as se,t as qe,v as je}from"./chunk-PLZXWZHY.js";import{d as Ne,e as Ce}from"./chunk-IOVPAZWP.js";import{d as ae}from"./chunk-3LCDIREB.js";import{E as Ae,H as S,L as Ee,P as Be,Q as F,R as re,i as Ie,k as Me,o as Re,q as d,s as we,t as Pe,v as G,x as ve}from"./chunk-327YK6TB.js";function Mt(t,e){return t.reason instanceof Error?t.reason:new Error(e)}function ir(t,e){if(t?.aborted)throw Mt(t,e)}import{join as Rt}from"path";var wt=t=>{if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t.pid;return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?{pid:e}:null};function dr(t,e={}){return z(Rt(t,"gc.lock"),e)}function z(t,e={}){let n=e.waitMs??0,r=e.pollMs??10,i=e.now??$,o=i()+n;do{let s=Pt(t);if(s)return vt(s);let a=o-i();if(a<=0)return null;At(Math.min(r,a))}while(i()<=o);return null}function Pt(t){let e=Le(t,{kind:"generic",parseLegacy:wt});return e.kind==="acquired"?e.lock:null}function vt(t){return{release:()=>{t.release()}}}function At(t){let e=new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));Atomics.wait(e,0,0,t)}function _e(t,e,n={}){ie(t,$e(e,n),{durability:"visibility",runtime:n.runtime})}function pr(t,e,n={}){return ie(t,$e(e,n),{durability:"durable",runtime:n.runtime})}function $e(t,e){let n=JSON.stringify(t,null,e.spacing);return e.trailingNewline?`${n}
2
2
  `:n}import{execFileSync as ze}from"child_process";import{createHash as Et}from"crypto";import{existsSync as J,statSync as Tt}from"fs";import{createRequire as Ft}from"module";import{platform as Lt}from"os";import{dirname as We,join as L}from"path";var Bt=Ft(import.meta.url),Rr={language:"rust",indexerBinary:"rust-analyzer",installUrl:"https://github.com/rust-lang/rust-analyzer"};function ce(t){return[t.indexerBinary,...t.binaryAliases??[]]}function kt(t){let e=ce(t);return e.length===1?e[0]:e.join(" or ")}function de(t){for(let e of ce(t)){let n=Ge(e);if(n)return n}return qt(t)}function wr(t){return de(t)!==null||Dt(t)}function Dt(t){return Je(t)!==null}function qt(t){let e=Je(t);if(!e)return null;let r=JSON.parse(S(e,"indexer package manifest")).bin;if(!r)return null;if(typeof r=="string")return L(We(e),r);for(let i of ce(t)){let o=r[i];if(o)return L(We(e),o)}return null}function Je(t){if(!t.bundledNpmPackage)return null;try{return Bt.resolve(`${t.bundledNpmPackage}/package.json`)}catch{return null}}function jt(t,e){for(let n of t.projectLocalBinaries??[]){let r=L(e,n);if(J(r))return r}return null}function Nt(t,e){for(let n of t.projectLocalBinaries??[]){let r=L(e,n);if(J(r))return He(e,n,r)}return null}function Pr(t,e){let n=Ct(t,e);if(!n||n.canonicalPath!==e.canonicalPath||n.sha256!==e.sha256||n.size!==e.size||n.mtimeMs!==e.mtimeMs||n.device!==e.device||n.inode!==e.inode||n.executable!==e.executable)throw new Error(`refusing changed project-local indexer ${e.relativePath}; review the current file and rerun with --trust-project-tools`)}function Ct(t,e){try{return He(t,e.relativePath,e.configuredPath)}catch{return null}}function He(t,e,n){let r={maxBytes:268435456,inputKind:"project-local indexer"},i=Ne(t,e,r),o=Ce(t,e,r),s=Tt(i.absolutePath);return{configuredPath:n,canonicalPath:i.absolutePath,relativePath:e,sha256:Et("sha256").update(o).digest("hex"),size:i.size,mtimeMs:i.mtimeMs,device:i.device,inode:i.inode,executable:(s.mode&73)!==0}}function Ot(t,e,n={}){return(n.trustProjectTools?Nt(t,e)?.canonicalPath:null)??de(t)}function vr(t,e=process.env,n=t.indexerBinary){if(t.indexerBinary!=="scip-dotnet"||le(n,e))return e;let r=Ue(n,e);return r?{...e,DOTNET_ROOT:r}:e}function Ar(t,e,n={}){let r=kt(t),i=e?Ot(t,e,n):de(t);if(!i)return{language:t.language,binaryLabel:r,installed:!1,runnable:!1,resolvedBinary:null,installUrl:t.installUrl,...e&&jt(t,e)?{note:"project-local indexer available only with --trust-project-tools"}:{}};if(t.indexerBinary!=="scip-dotnet")return{language:t.language,binaryLabel:r,installed:!0,runnable:!0,resolvedBinary:i};let o=Gt(i);return{language:t.language,binaryLabel:r,installed:!0,runnable:o.runnable,resolvedBinary:i,installUrl:t.installUrl,note:o.note}}function Gt(t){if(le(t,process.env))return{runnable:!0};let e=Ue(t,process.env);if(e)return{runnable:!0,note:`using .NET 9 runtime from ${e}`};let n=Ve(process.env);return{runnable:!1,note:n.length>0?`.NET 9 runtime still unavailable after checking ${n.join(", ")}`:"binary is present, but scip-dotnet still needs a .NET 9 runtime"}}function Ue(t,e){for(let n of Ve(e))if(le(t,{...e,DOTNET_ROOT:n}))return n;return null}function Ve(t){let e=[],n=t.DOTNET_ROOT;if(n&&J(n)&&e.push(n),Lt()==="darwin"&&Oe("brew"))try{let r=ze("brew",["--prefix","dotnet@9"],{stdio:"pipe",windowsHide:!0,env:t,timeout:1e4,killSignal:"SIGKILL"}).toString().trim(),i=L(r,"libexec");J(i)&&!e.includes(i)&&e.push(i)}catch{}return e}function le(t,e){try{return ze(t,["--version"],{stdio:"pipe",windowsHide:!0,env:e,timeout:1e4,killSignal:"SIGKILL"}),!0}catch{return!1}}var _t=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"];function H(t){let e=t.toLowerCase();return _t.some(n=>e.endsWith(n))}function V(t){let e=U(t.projectFiles),n=new Set(e),r=new Map(t.snapshot.files.map(c=>[c.path,c])),i=t.snapshot.files.filter(c=>{let m=Ie(c.path,["typescript"]);return m==="config"||m==="ambient"}).map(c=>c.path),o=U([...e,...i]),s=o.find(c=>!r.has(c)),a=new Set(t.snapshot.files.map(c=>c.path)).size!==t.snapshot.files.length,l=!s&&o.some(c=>Qe(r.get(c))),p=se(JSON.stringify({pnpmWorkspaces:t.snapshot.pnpmWorkspaces,typescriptProjectMode:t.snapshot.typescriptProjectMode,typescriptProjects:U(t.snapshot.typescriptProjects),membership:e})),u=new Map;return{identityFor(c,m){if(!n.has(c))return w("target-outside-project");if(a)return w("duplicate-input-path");if(s)return w("missing-input-fingerprint");if(l)return w("unreadable-input");let g=[],f,I;if(t.graph===null)g.push("dependency-graph-unavailable"),I="whole-project",f=o;else{let O=Wt(c,t.graph,u);if(O.find(ne=>!r.has(ne)))return w("missing-input-fingerprint");if(f=U([...O,...i]),f.some(ne=>Qe(r.get(ne))))return w("unreadable-input");I="dependency-closure"}let C=f.map(O=>zt(r.get(O)));return{version:1,key:se(JSON.stringify({version:1,engineIdentity:t.engineIdentity,schemaVersion:m,projectIdentity:p,inputs:C})),mode:I,inputFiles:f,reasons:g}}}}function $t(t,e){let n=new Set,r=[t];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 s of[...e.get(o)??[]].sort())n.has(s)||r.push(s)}}return[...n].sort()}function Wt(t,e,n){let r=n.get(t);if(r)return r;let i=$t(t,e);return n.set(t,i),i}function zt(t){return{path:t.path,size:t.size,hash:t.hash}}function Qe(t){return t.size<0||t.hash==="unreadable"}function w(t){return{version:1,key:null,mode:"unkeyed",inputFiles:[],reasons:[t]}}function U(t){return[...new Set(t)].sort()}import{createRequire as Jt}from"module";var Ke=Jt(import.meta.url),B,Q;function Ht(){if(B!==void 0)return B;try{B=Ke("ts-morph")}catch{B=null}return B}function K(){if(Q)return Q;let t=Ht();if(!t)return"ts-morph:unavailable";let e="unknown";try{e=Ke("ts-morph/package.json").version??"unknown"}catch{}return Q=`ts-morph:${e}:typescript:${t.ts.version}`,Q}function Dr(t,e){return e.map(n=>({tsconfigPath:n,project:new t.Project({tsConfigFilePath:n,skipFileDependencyResolution:!0})}))}function qr(t,e,n){return{language:"typescript",availability:()=>({available:!1,reason:t,tsconfigPath:e,tsconfigPaths:n}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}var Ut=ke("typescript-semantic-identity-context",{clearGroups:["whole-project"]});function ue(t,e,n){let r=Ut.get(t,()=>Vt(t));if(!r)return null;let i=`${n}\0${e}`,o=r.identities.get(i);if(o)return o;let s=r.builder.identityFor(e,n);return r.identities.set(i,s),s}function k(t){return De(t,{includeIgnored:!1}).filter(H).sort()}function Vt(t){try{if(!t.generation.metadataRaw)return null;let e=G(t.generation.metadataRaw);if(e.kind!=="legacy"&&e.kind!=="supported"||!e.capabilities.usableForEvidenceCache)return null;let n=Me(e.metadata.fingerprint);return n?{builder:V({projectFiles:k(t),snapshot:n,graph:W(t),engineIdentity:K()}),identities:new Map}:null}catch{return null}}function X(t,e){let n=new Map(t.map(i=>[i.symbol,i])),r=new Map(t.map(i=>[i.symbolId,[]]));for(let i of e.values())for(let o of i){let s=n.get(o.targetSymbol);s&&r.get(s.symbolId).push(o.location)}for(let[i,o]of r)r.set(i,Qt(o));return r}function Ze(t,e,n){let r=Ye(t,e),i=Ye(t,n),o=[...r].filter(c=>!i.has(c)).sort(),s=[...i].filter(c=>!r.has(c)).sort(),a=Xe(t,e),l=Xe(t,n),p=[...a].filter(c=>!l.has(c)).sort(),u=[...l].filter(c=>!a.has(c)).sort();return{passed:o.length===0&&s.length===0,expectedCount:r.size,actualCount:i.size,missing:o,extra:s,callerFiles:{passed:p.length===0&&u.length===0,expectedCount:a.size,actualCount:l.size,missing:p,extra:u}}}function Xe(t,e){let n=new Set;for(let r of t)for(let i of e.get(r.symbolId)??[])i.file!==r.relativePath&&n.add(`${r.symbol}\0${i.file}`);return n}function Hr(t,e,n){let r=new Set(n),i=new Map(n.map(o=>[o,[]]));for(let o of t)for(let s of e.get(o.symbolId)??[])r.has(s.file)&&i.get(s.file).push({targetSymbol:o.symbol,location:s});for(let[o,s]of i)i.set(o,Kt(s));return i}function Ye(t,e){let n=new Set;for(let r of t)for(let i of e.get(r.symbolId)??[])n.add(`${r.symbol}\0${i.file}\0${i.line}\0${i.column}`);return n}function Qt(t){let e=new Map;for(let n of t)e.set(`${n.file}\0${n.line}\0${n.column}`,n);return[...e.values()].sort(et)}function Kt(t){let e=new Map;for(let n of t){let{location:r}=n;e.set(`${n.targetSymbol}\0${r.file}\0${r.line}\0${r.column}`,n)}return[...e.values()].sort((n,r)=>n.targetSymbol.localeCompare(r.targetSymbol)||et(n.location,r.location))}function et(t,e){return t.file.localeCompare(e.file)||t.line-e.line||t.column-e.column}var pe="typescript-reference-fragment-v3-incomplete-scan",Y=qe({kind:"typescript-reference-fragments",invalidation:je("typescript-reference-fragments"),serialize:t=>JSON.stringify(t),deserialize:Yt});function ni(t,e,n,r=t){let i=k(t),o=V({projectFiles:i,snapshot:e,graph:W(t),engineIdentity:K()}),s=[...n].map(([a,l])=>({relativePath:a,contentHash:o.identityFor(a,pe).key,value:[...l]}));if(s.some(a=>a.contentHash===null))throw new Error("TypeScript reference fragment identity is unavailable for an affected document.");return Y.writeBatch(r,s.map(a=>({...a,contentHash:a.contentHash}))),s.length}function ri(t,e,n,r){let i=e.filter(s=>H(s.relativePath));if(i.length===0)return D("no TypeScript definitions");let o=D("shadow did not run");return ae("typescript.reference-fragments.shadow",()=>{try{let s=r(i[0].relativePath);if(!s.availability().available||!s.referenceFragmentsForFiles)return o=D("TypeScript reference fragment provider is unavailable"),o;let a=k(t),l=new Set(a),p=s.referenceFragmentsForFiles(a),u=a.filter(f=>!p.has(f));if(u.length>0)return o=D(`TypeScript reference lookup was incomplete for ${u.length} file(s)`),o;let c=X(i,p),m=Ze(i,Xt(n,l),c);if(!m.passed)return o={state:"failing",files:a.length,keyedFiles:0,writtenFiles:0,...m},o;let g=[];for(let f of a){let I=ue(t,f,pe);I?.key&&g.push({relativePath:f,contentHash:I.key,value:p.get(f)??[]})}return Y.writeBatch(t,g),o={state:"passing",files:a.length,keyedFiles:g.length,writtenFiles:g.length,...m},o}catch(s){return o=D(s instanceof Error?s.message:String(s)),o}},()=>({...o}))}function Xt(t,e){return new Map([...t].map(([n,r])=>[n,r.filter(i=>e.has(i.file))]))}function ii(t,e,n){if(e.length===0)return{references:new Map,files:0,cacheHits:0,cacheMisses:0,computedFiles:0};let r="fallback",i=0,o=0,s=0,a=0;return ae("typescript.reference-fragments.materialize",()=>{try{let l=k(t);i=l.length;let p=new Map,u=new Map,c=[];for(let f of l){let I=ue(t,f,pe);if(!I?.key)return null;p.set(f,I.key);let C=Y.read(t,f,I.key);C===null?(s+=1,c.push(f)):(o+=1,u.set(f,C))}if(s===0)return r="hit",{references:X(e,u),files:i,cacheHits:o,cacheMisses:s,computedFiles:a};let m=n(e[0].relativePath);if(!m.availability().available||!m.referenceFragmentsForFiles)return null;let g=m.referenceFragmentsForFiles(c);if(c.some(f=>!g.has(f)))return null;a=g.size,Y.writeBatch(t,c.map(f=>({relativePath:f,contentHash:p.get(f),value:g.get(f)??[]})));for(let[f,I]of g)u.set(f,I);return r="computed",{references:X(e,u),files:i,cacheHits:o,cacheMisses:s,computedFiles:a}}catch{return null}},()=>({state:r,files:i,cacheHits:o,cacheMisses:s,computedFiles:a}))}function D(t){return{state:"unavailable",files:0,keyedFiles:0,writtenFiles:0,expectedCount:0,actualCount:0,missing:[],extra:[],reason:t}}function Yt(t){try{let e=JSON.parse(t);return!Array.isArray(e)||!e.every(Zt)?null:e}catch{return null}}function Zt(t){if(!t||typeof t!="object")return!1;let e=t,n=e.location;return typeof e.targetSymbol=="string"&&!!n&&typeof n.file=="string"&&typeof n.line=="number"&&typeof n.column=="number"}import{createHash as en,randomUUID as tn}from"crypto";import{existsSync as P,mkdirSync as nn,readdirSync as rn,rmSync as nt,statSync as rt}from"fs";import{basename as on,dirname as Z,join as x}from"path";var sn=1,an=1,cn=".codebaseiq-generations",dn="manifest.json",it="readers",ln="gc.lock",un=128,q=new Map,ot={pid:process.pid,now:()=>new Date,randomToken:()=>tn(),isProcessAlive:Fe,readProcessIdentity:Te,resolveImmutableGeneration:ct};function v(t){return x(Z(t),cn)}function st(t){return x(v(t),ln)}function gi(t,e=ot){let n=z(st(t.dbPath),{waitMs:5e3});if(!n)throw new Error("SQLite generation retention is busy; retry opening the index.");let r;try{let o=ge(t.dbPath);if(!o||!at(t.dbPath,o.currentGeneration))return{generation:gn(t),release(){}};let s=e.randomToken();if(!/^[A-Za-z0-9._-]+$/.test(s))throw new Error("SQLite generation reader token is unsafe.");let a=x(v(t.dbPath),it);nn(a,{recursive:!0});let l=x(a,`${e.pid}-${s}.json`),p=e.readProcessIdentity(e.pid);_e(l,{version:1,token:s,generationIdentity:o.currentGeneration,pid:e.pid,...p?{processIdentity:p}:{},acquiredAt:e.now().toISOString()},{spacing:2,trailingNewline:!0});let u=!1;r={identity:o.currentGeneration,required:o.artifactSet==="immutable-v1",release(){u||(u=!0,nt(l,{force:!0}))}}}finally{n.release()}let i;try{i=e.resolveImmutableGeneration(t,r.identity)}catch(o){throw r.release(),o}if(i?.source==="immutable"&&i.identity===r.identity)return{generation:i,release:r.release};if(r.release(),r.required)throw new Error(`Published SQLite generation ${r.identity} is missing or invalid.`);return pn(t,r.identity)}function pn(t,e){let n=z(st(t.dbPath),{waitMs:5e3});if(!n)throw new Error("SQLite generation retention is busy; retry opening the index.");try{let r=ge(t.dbPath);if(r?.currentGeneration!==e)throw new Error("SQLite index publication changed while opening a legacy generation.");if(P(x(Z(t.dbPath),"index.lock")))throw new Error("Legacy SQLite publication is in progress; retry after the reindex lock is released.");return{generation:dt(t,r.currentGeneration),release(){}}}finally{n.release()}}function bi(t,e,n=ot,r={}){let i=x(v(t),it);if(!P(i))return{protectedGenerations:new Set,activeLeases:0,staleLeasesRemoved:0,malformedLeases:0};let o=new Set,s=0,a=0,l=0;for(let p of rn(i,{withFileTypes:!0})){if(!p.isFile()||!p.name.endsWith(".json"))continue;let u=x(i,p.name),c;try{c=fn(JSON.parse(S(u,"SQLite generation reader lease")))}catch{c=null}if(!c){l+=1;for(let m of e)o.add(m);continue}if(!mn(c,n)){r.removeStale!==!1&&(nt(u,{force:!0}),a+=1);continue}s+=1,o.add(c.generationIdentity)}return{protectedGenerations:o,activeLeases:s,staleLeasesRemoved:a,malformedLeases:l}}function fn(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t,n=e.processIdentity===void 0?null:R(e.processIdentity);return e.version!==1||typeof e.token!="string"||e.token.trim()===""||typeof e.generationIdentity!="string"||!/^[a-f0-9]{64}$/.test(e.generationIdentity)||typeof e.pid!="number"||!Number.isSafeInteger(e.pid)||e.pid<=0||typeof e.acquiredAt!="string"||!Number.isFinite(Date.parse(e.acquiredAt))||e.processIdentity!==void 0&&(!n||n.pid!==e.pid)?null:{version:1,token:e.token,generationIdentity:e.generationIdentity,pid:e.pid,...n?{processIdentity:n}:{},acquiredAt:e.acquiredAt}}function mn(t,e){if(!e.isProcessAlive(t.pid))return!1;if(!t.processIdentity)return!0;let n=e.readProcessIdentity(t.pid);return n===null||_(t.processIdentity,n)}function ge(t){try{let e=JSON.parse(S(x(v(t),"state.json"),"SQLite generation state"));return xn(e)?e:null}catch{return null}}function at(t,e){return yn(v(t),e)}function yn(t,e){try{let n=JSON.parse(S(x(t,e,dn),"SQLite generation manifest"));return Sn(n,e)?n:null}catch{return null}}function gn(t){let e=ge(t.dbPath);if(e){let n=ct(t,e.currentGeneration);if(n)return n;if(e.artifactSet==="immutable-v1")throw new Error(`Published SQLite generation ${e.currentGeneration} is missing or invalid.`)}if(P(x(Z(t.dbPath),"index.lock")))throw new Error("Legacy SQLite publication is in progress; retry after the reindex lock is released.");return dt(t,e?.currentGeneration)}function bn(t){return ve(G(t))??t}function ct(t,e){try{let n=x(v(t.dbPath),e),r=at(t.dbPath,e);if(!r)return null;let i=fe(n,r.database),o=r.index?fe(n,r.index):void 0,s=r.metadata?fe(n,r.metadata):void 0;return!me(i,r.database)||r.index&&(!o||!me(o,r.index))||r.metadata&&(!s||!me(s,r.metadata))?null:{identity:e,databasePath:i,...o?{indexPath:o}:{},...s?{metadataPath:s,metadataRaw:S(s,"reindex metadata")}:{},source:"immutable"}}catch{return null}}function dt(t,e){let n=lt(t.dbPath),r=x(Z(t.dbPath),"meta.json"),i=P(r)?S(r,"reindex metadata"):void 0,o=P(t.indexPath)?t.indexPath:void 0;return{identity:e??hn(t.dbPath,i),databasePath:t.dbPath,...o?{indexPath:o}:{},...i===void 0?{}:{metadataPath:r,metadataRaw:i},source:"legacy",databaseFileIdentity:n}}function hn(t,e){let n=en("sha256").update("sqlite-generation-legacy-v1\0");return e!==void 0&&n.update(bn(e)),n.update(`\0${lt(t)}`),n.digest("hex")}function lt(t){let e=rt(t);return`${e.dev}:${e.ino}:${e.size}:${e.mtimeMs}`}function fe(t,e){if(on(e.file)!==e.file||e.file==="."||e.file==="..")throw new Error("SQLite generation manifest contains an unsafe artifact path");return x(t,e.file)}function me(t,e){if(!P(t))return!1;let n=tt(t);if(!n||n.size!==e.size)return!1;let r=`${t}\0${e.sha256}\0${n.identity}`;if(q.has(r))return!0;let i=Ee(t,{inputKind:"immutable SQLite generation artifact",maxBytes:e.size}),o=tt(t);if(!o||o.identity!==n.identity||i!==e.sha256)return!1;for(q.set(r,!0);q.size>un;){let s=q.keys().next().value;if(s===void 0)break;q.delete(s)}return!0}function tt(t){let e=rt(t,{bigint:!0});return e.isFile()?{identity:`${e.dev}:${e.ino}:${e.size}:${e.mtimeNs}:${e.ctimeNs}`,size:Number(e.size)}:null}function Sn(t,e){return t.version===an&&t.identity===e&&ye(t.database)&&(t.index===void 0||ye(t.index))&&(t.metadata===void 0||ye(t.metadata))}function ye(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.file=="string"&&!!e.file&&Number.isSafeInteger(e.size)&&(e.size??-1)>=0&&typeof e.sha256=="string"&&/^[a-f0-9]{64}$/.test(e.sha256)}function xn(t){return t.version===sn&&typeof t.currentGeneration=="string"&&!!t.currentGeneration&&typeof t.publishedAt=="string"&&Number.isFinite(Date.parse(t.publishedAt))&&(t.artifactSet===void 0||t.artifactSet==="immutable-v1")&&In(t.stableMirrors)&&Mn(t.previousGeneration)&&Rn(t.publication)}function In(t){if(t===void 0)return!0;if(!t||typeof t!="object")return!1;let e=t;return typeof e.databaseFileIdentity=="string"&&!!e.databaseFileIdentity&&(e.indexFileIdentity===void 0||typeof e.indexFileIdentity=="string"&&!!e.indexFileIdentity)}function Mn(t){if(t===void 0)return!0;if(!t||typeof t!="object")return!1;let e=t;return typeof e.generationIdentity=="string"&&!!e.generationIdentity&&typeof e.databasePath=="string"&&!!e.databasePath&&(e.metadataPath===void 0||typeof e.metadataPath=="string"&&!!e.metadataPath)}function Rn(t){if(t===void 0)return!0;if(!t||typeof t!="object")return!1;let e=t,n=[e.converterDurationMs,e.affectedDocumentCount,e.changedDocumentCount,e.producerDurationMs,e.materializationDurationMs,e.patchDurationMs].filter(r=>r!==void 0);return(e.mode==="incremental"||e.mode==="full")&&e.validation==="passed"&&e.converterDurationMs!==void 0&&n.every(r=>typeof r=="number"&&Number.isFinite(r)&&r>=0)&&(e.scipCompanion===void 0||e.scipCompanion==="current"||e.scipCompanion==="deferred")&&(e.typescriptOverlayGeneration===void 0||typeof e.typescriptOverlayGeneration=="string"&&!!e.typescriptOverlayGeneration)&&(e.scipCompanion!=="deferred"||!!e.typescriptOverlayGeneration)&&(e.fallbackReason===void 0||typeof e.fallbackReason=="string")}import{createHash as wn,randomUUID as yt}from"crypto";import{existsSync as T,lstatSync as N,readdirSync as E,renameSync as gt,rmSync as M}from"fs";import{basename as be,dirname as Pn,join as y}from"path";function ee(t){return Array.isArray(t)?`[${t.map(ee).join(",")}]`:t&&typeof t=="object"?`{${Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>`${JSON.stringify(e)}:${ee(n)}`).join(",")}}`:JSON.stringify(t)}var vn=1,An=Object.freeze({maxItems:1024,maxBytes:512*1024*1024,maxItemBytes:64*1024*1024,maxBatch:16,claimLeaseMs:5*6e4,responseRetentionMs:10*6e4,deadLetterRetentionMs:1440*6e4,temporaryRetentionMs:6e4,cleanupBatch:64}),A=class extends Error{constructor(n,r,i,o){let s=n==="item-too-large"?`request is ${o} bytes; per-item limit is ${i.maxItemBytes}`:n==="item-capacity"?`mailbox has ${r.totalItems} retained items; limit is ${i.maxItems}`:n==="byte-capacity"?`mailbox retains ${r.totalBytes} bytes and the request adds ${o}; limit is ${i.maxBytes}`:"another writer held the admission coordinator through the bounded wait";super(`Mailbox backpressure: ${s}. Retry after the service drains or expires retained work.`);this.code=n;this.status=r;this.limits=i;this.attemptedBytes=o;this.name="MailboxBackpressureError"}code;status;limits;attemptedBytes},En=".owner.json",Tn={isProcessAlive:()=>!0,readProcessIdentity:()=>null};function Ti(t){return{rootDir:t,pendingDir:y(t,"pending"),inflightDir:y(t,"inflight"),responseDir:y(t,"responses"),deadLetterDir:y(t,"dead-letter"),legacyRequestDir:y(t,"requests")}}function Fn(t={}){let e={...An,...t};for(let[n,r]of Object.entries(e))if(!Number.isFinite(r)||r<=0||!Number.isInteger(r))throw new Error(`Mailbox limit ${n} must be a positive integer.`);return e}function bt(t){let e=[t.pendingDir,t.inflightDir,t.responseDir,t.deadLetterDir,t.legacyRequestDir].map(n=>Be(n));return re(...e)}function Fi(t,e){return wn("sha256").update(ee({namespace:t,payload:e})).digest("hex")}function Ln(t){if(!/^[a-f0-9]{64}$/.test(t))throw new Error("Mailbox operation keys must be lowercase SHA-256 identities.");return`op-${t}`}function Li(t,e,n={}){let r=Fn(n.limits),i=n.nowMs??Date.now(),o=bt(t);return On(e),kn(t,r,n.admissionLockTimeoutMs??2e3,n.monotonicNow??$,()=>{Bn(t,i,r);let s=y(t.pendingDir,`${e.id}.json`),a=y(t.responseDir,`${e.id}.json`),l=ut(t,e.id);if(l){let m=pt(l,e.operationKey,e.id);return{disposition:"duplicate",requestId:e.id,responsePath:a,authoritativeDeadlineAtMs:m.deadlineAtMs??e.deadlineAtMs}}let p=`${JSON.stringify(e)}
3
3
  `,u=Buffer.byteLength(p),c=ht(t);if(u>r.maxItemBytes)throw new A("item-too-large",c,r,u);if(c.totalItems+1>r.maxItems)throw new A("item-capacity",c,r,u);if(c.totalBytes+u>r.maxBytes)throw new A("byte-capacity",c,r,u);n.onBeforePublish?.();try{let m=oe(s,p,{durability:"durable"}),g=re(o,m.directorySync);return{disposition:"accepted",requestId:e.id,responsePath:a,authoritativeDeadlineAtMs:e.deadlineAtMs,achievedDurability:g==="synced"?"directory-durable":"file-flushed",directorySync:g}}catch(m){if(m.code!=="EEXIST")throw m;let g=ut(t,e.id);if(!g)throw m;let f=pt(g,e.operationKey,e.id);return{disposition:"duplicate",requestId:e.id,responsePath:a,authoritativeDeadlineAtMs:f.deadlineAtMs??e.deadlineAtMs}}})}function Bn(t,e,n,r=Tn){let i={reclaimed:0,completedClaimsRemoved:0,responsesRemoved:0,deadLettersRemoved:0,temporaryFilesRemoved:0},o=n.cleanupBatch;for(let s of Se(t.inflightDir)){if(o<=0)break;let a=y(t.responseDir,`${s.requestId}.json`);if(T(a)){M(s.path,{force:!0}),i.completedClaimsRemoved++,o--;continue}if(s.claimExpiresAtMs>e||Nn(t,s.ownerId,r)!=="dead")continue;let l=y(t.pendingDir,s.originalFile);try{gt(s.path,l),i.reclaimed++}catch(p){if(p.code!=="EEXIST")throw p;M(s.path,{force:!0})}F(Pn(s.path)),F(t.pendingDir),o--}o=ft(t.responseDir,o,(s,a)=>a+n.responseRetentionMs,e,()=>{i.responsesRemoved++}),o=ft(t.deadLetterDir,o,(s,a)=>a+n.deadLetterRetentionMs,e,()=>{i.deadLettersRemoved++});for(let s of[t.pendingDir,t.inflightDir,t.responseDir,t.deadLetterDir,t.legacyRequestDir]){if(o<=0)break;for(let a of St(s)){if(o<=0)break;be(a).includes(".tmp-")&&(N(a).mtimeMs+n.temporaryRetentionMs>e||(M(a,{force:!0}),i.temporaryFilesRemoved++,o--))}}return Gn(t.inflightDir),i}function ht(t){bt(t);let e=[...j(t.pendingDir).map(l=>({path:l,pending:!0})),...j(t.legacyRequestDir).map(l=>({path:l,pending:!0}))],n=Se(t.inflightDir).map(l=>({path:l.path,pending:!1})),r=j(t.responseDir).map(l=>({path:l,pending:!1})),i=j(t.deadLetterDir).map(l=>({path:l,pending:!1})),o=[...e,...n,...r,...i],s=0,a;for(let l of e){let p=xe(l.path);if(!p){s++;continue}let u=p.enqueuedAtMs??N(l.path).mtimeMs;a=a===void 0?u:Math.min(a,u)}return{pending:e.length,inflight:n.length,responses:r.length,deadLetters:i.length,invalid:s,totalItems:o.length,totalBytes:o.reduce((l,p)=>l+_n(p.path),0),...a===void 0?{}:{oldestPendingAt:new Date(a).toISOString()}}}function kn(t,e,n,r,i){let o=y(t.rootDir,".admission.lock"),s=`${process.pid}-${yt()}`,a=r()+Math.max(0,n);for(;!Dn(t.rootDir,o,s);){if(qn(o),r()>=a)throw new A("admission-busy",ht(t),e,0);Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,5)}try{return i()}finally{try{he(o).ownerToken===s&&(M(o,{recursive:!0,force:!0}),F(t.rootDir))}catch{}}}function Dn(t,e,n){let r=`${JSON.stringify({ownerToken:n,pid:process.pid,acquiredAtMs:Date.now()})}
4
4
  `;try{return oe(e,r,{durability:"durable"}),!0}catch(i){if(i.code==="EEXIST")return!1;try{he(e).ownerToken===n&&(M(e,{force:!0}),F(t))}catch{}throw i}}function qn(t){let e=null;try{let r=he(t);typeof r.ownerToken=="string"&&Number.isSafeInteger(r.pid)&&Number(r.pid)>0&&(e=Number(r.pid))}catch{}if(e===null||jn(e))return;let n=`${t}.stale-${yt()}`;try{gt(t,n)}catch(r){let i=r.code;if(i==="ENOENT"||i==="EEXIST")return;throw r}M(n,{recursive:!0,force:!0})}function he(t){try{return JSON.parse(S(t,"mailbox lock record"))}catch(e){if(e.code!=="EISDIR"&&!(e instanceof Ae&&e.reason==="not-regular"))throw e;return JSON.parse(S(y(t,"owner.json"),"mailbox lock owner record"))}}function jn(t){try{return process.kill(t,0),!0}catch(e){let n=e.code;return n==="EPERM"||n!=="ESRCH"}}function Nn(t,e,n){let r=Cn(y(t.inflightDir,xt(e),En));if(!r)return"unknown";if(!n.isProcessAlive(r.pid))return"dead";if(!r.processIdentity)return"live";let i=n.readProcessIdentity(r.pid);return i?_(r.processIdentity,i)?"live":"dead":"unknown"}function Cn(t){try{let e=JSON.parse(S(t,"mailbox owner record"));if(e.version!==1||typeof e.ownerId!="string"||!e.ownerId||typeof e.pid!="number"||!Number.isSafeInteger(e.pid)||e.pid<=0)return null;let n=e.processIdentity===void 0?null:R(e.processIdentity);return e.processIdentity!==void 0&&(!n||n.pid!==e.pid)?null:{version:1,ownerId:e.ownerId,pid:e.pid,...n?{processIdentity:n}:{}}}catch{return null}}function ut(t,e){for(let n of[y(t.pendingDir,`${e}.json`),y(t.legacyRequestDir,`${e}.json`),y(t.responseDir,`${e}.json`)])if(T(n))return n;for(let n of Se(t.inflightDir))if(n.requestId===e)return n.path;return null}function pt(t,e,n){let r=xe(t);if(!r||r.operationKey!==e)throw new Error(`Mailbox operation ${n} conflicts with an existing retained record.`);return r}function On(t){if(t.mailboxVersion!==vn||t.id!==Ln(t.operationKey)||!t.clientId.trim()||!Number.isFinite(t.enqueuedAtMs)||!Number.isFinite(t.deadlineAtMs)||t.deadlineAtMs<t.enqueuedAtMs)throw new Error("Mailbox request has an invalid lifecycle identity.")}function Se(t){if(!T(t))return[];let e=[];for(let n of E(t,{withFileTypes:!0})){if(!n.isDirectory())continue;let r=mt(n.name);if(r===null)continue;let i=y(t,n.name);for(let o of E(i,{withFileTypes:!0})){if(!o.isFile()||!o.name.endsWith(".claim"))continue;let s=/^(.*)\.(\d+)\.claim$/.exec(o.name);if(!s)continue;let a=mt(s[1]),l=Number(s[2]);if(a===null||be(a)!==a||!a.endsWith(".json")||!Number.isSafeInteger(l))continue;let p=y(i,o.name),u=xe(p)??{id:be(a,".json")},c=N(p);e.push({requestId:u.id,ownerId:r,path:p,originalFile:a,claimedAtMs:c.mtimeMs,claimExpiresAtMs:l,byteLength:c.size,...u.operationKey?{operationKey:u.operationKey}:{},...u.clientId?{clientId:u.clientId}:{},...u.enqueuedAtMs===void 0?{}:{enqueuedAtMs:u.enqueuedAtMs},...u.deadlineAtMs===void 0?{}:{deadlineAtMs:u.deadlineAtMs},legacy:u.operationKey===void 0})}}return e.sort((n,r)=>n.claimedAtMs-r.claimedAtMs||n.path.localeCompare(r.path))}function xe(t){try{let e=JSON.parse(S(t,"mailbox record"));return typeof e.id!="string"||!e.id?null:{id:e.id,...typeof e.operationKey=="string"?{operationKey:e.operationKey}:{},...typeof e.clientId=="string"?{clientId:e.clientId}:{},...typeof e.enqueuedAtMs=="number"?{enqueuedAtMs:e.enqueuedAtMs}:{},...typeof e.deadlineAtMs=="number"?{deadlineAtMs:e.deadlineAtMs}:{}}}catch{return null}}function ft(t,e,n,r,i){for(let o of j(t)){if(e<=0)break;let s=N(o);n(o,s.mtimeMs)>r||(M(o,{force:!0}),i(),e--)}return e}function j(t){return T(t)?E(t,{withFileTypes:!0}).filter(e=>e.isFile()).map(e=>y(t,e.name)).sort():[]}function St(t){if(!T(t))return[];let e=[];for(let n of E(t,{withFileTypes:!0})){let r=y(t,n.name);n.isFile()?e.push(r):n.isDirectory()&&e.push(...St(r))}return e.sort()}function Gn(t){if(T(t))for(let e of E(t,{withFileTypes:!0})){if(!e.isDirectory())continue;let n=y(t,e.name);E(n).some(r=>r.endsWith(".claim"))||M(n,{recursive:!0,force:!0})}}function _n(t){try{return N(t).size}catch{return 0}}function xt(t){return Buffer.from(t,"utf8").toString("base64url")}function mt(t){try{let e=Buffer.from(t,"base64url").toString("utf8");return xt(e)===t?e:null}catch{return null}}import{join as te}from"path";var $n="watch.lock",Wn="watch-state.json",zn="watch-activity.json",Jn="watch-refresh-requests";function Ci(t){return{lockPath:te(t,$n),statePath:te(t,Wn),activityPath:te(t,zn),refreshRequestsPath:te(t,Jn)}}function Oi(t){try{return Hn(JSON.parse(S(t,"watch service state")))}catch{return null}}function Hn(t){if(!t||typeof t!="object")return null;let e=t;if(e.version!==1||typeof e.protocolVersion!="number"||typeof e.pid!="number"||!Number.isInteger(e.pid)||e.pid<=0||typeof e.projectRoot!="string"||e.worktreeId!==void 0&&(typeof e.worktreeId!="string"||e.worktreeId.length===0)||typeof e.cliVersion!="string"||!b(e.startedAt)||!b(e.heartbeatAt)||!b(e.lastActivityAt)||!Un(e.watcher)||e.idleDeadlineAt!==void 0&&!b(e.idleDeadlineAt))return null;if(e.processIdentity!==void 0){let n=R(e.processIdentity);if(!n||n.pid!==e.pid)return null;e.processIdentity=n}return e.indexGeneration!==void 0&&!/^[a-f0-9]{64}$/.test(e.indexGeneration)||e.lastError!==void 0&&!Vn(e.lastError)||e.lastRefresh!==void 0&&!Qn(e.lastRefresh)||e.reindexActivity!==void 0&&!Kn(e.reindexActivity)||e.refreshRequests!==void 0&&!Yn(e.refreshRequests)||e.typescriptSemantic!==void 0&&!Zn(e.typescriptSemantic)||e.typescriptIndex!==void 0&&!er(e.typescriptIndex)||e.queryLane!==void 0&&!tr(e.queryLane)?null:e}function b(t){return Re(t)}function Un(t){if(!t||typeof t!="object"||!("state"in t))return!1;let e=t;switch(e.state){case"idle":return!0;case"waiting":return h(e.changedFiles)&&h(e.reindexAt);case"indexing":return h(e.startedAt);case"cooldown":return h(e.until)&&typeof e.dirty=="boolean";case"budget-paused":return h(e.until)&&typeof e.dirty=="boolean"&&typeof e.reason=="string"&&d(e.rebuilt)&&d(e.estimatedWriteBytes);case"draining":return h(e.startedAt)&&typeof e.reason=="string";default:return!1}}function Vn(t){if(!t||typeof t!="object")return!1;let e=t;return b(e.at)&&typeof e.message=="string"}function Qn(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.trigger?.kind=="string"&&typeof e.result=="string"&&b(e.startedAt)&&b(e.completedAt)&&h(e.durationMs)}function Kn(t){if(!t||typeof t!="object")return!1;let e=t;return e.confidence!==void 0&&e.confidence!=="complete"&&e.confidence!=="partial"&&e.confidence!=="unavailable"||e.recordsRead!==void 0&&!d(e.recordsRead)||e.invalidRecords!==void 0&&!d(e.invalidRecords)||e.skippedRecords!==void 0&&!d(e.skippedRecords)||e.readErrors!==void 0&&!d(e.readErrors)||e.ignoredPartialTailBytes!==void 0&&!d(e.ignoredPartialTailBytes)||!b(e.windowStartedAt)||!b(e.windowEndedAt)||!d(e.runs)||!d(e.rebuilt)||!d(e.reused)||!d(e.failed)||!d(e.suppressed)||!h(e.estimatedLogicalOutputBytes)||e.estimatedWriteBytes!==void 0&&!d(e.estimatedWriteBytes)||e.reflinkedBytes!==void 0&&!d(e.reflinkedBytes)||e.fallbackCopiedBytes!==void 0&&!d(e.fallbackCopiedBytes)||e.oldestRebuildAt!==void 0&&!b(e.oldestRebuildAt)||e.oldestWriteAt!==void 0&&!b(e.oldestWriteAt)||e.languageAttribution!==void 0&&e.languageAttribution!=="complete"&&e.languageAttribution!=="partial"&&e.languageAttribution!=="unavailable"||e.attributedRuns!==void 0&&!d(e.attributedRuns)||e.unattributedRuns!==void 0&&!d(e.unattributedRuns)||e.invalidLanguageDetails!==void 0&&!d(e.invalidLanguageDetails)||e.estimatedLogicalOutputBytes<0||!e.byTrigger||typeof e.byTrigger!="object"||Array.isArray(e.byTrigger)||e.byLanguage!==void 0&&!Xn(e.byLanguage)?!1:Object.values(e.byTrigger).every(n=>n===void 0||d(n))}function Xn(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;for(let[e,n]of Object.entries(t)){if(!Pe.includes(e)||!n||typeof n!="object")return!1;let r=n;if(!d(r.runs)||!d(r.rebuilt)||!d(r.reused)||!d(r.producedOutputBytes)||!we(r.durationMs)||r.rebuilt+r.reused!==r.runs)return!1}return!0}function Yn(t){if(!t||typeof t!="object")return!1;let e=t;return d(e.pending)&&d(e.claimed)&&d(e.completed)&&d(e.expired)&&d(e.invalid)&&(e.oldestPendingAt===void 0||b(e.oldestPendingAt))}function Zn(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.protocolVersion=="number"&&(e.state==="idle"||e.state==="ready"||e.state==="unavailable"||e.state==="error")&&h(e.requests)&&h(e.sessionsCreated)&&h(e.sessionsReused)&&h(e.sessionsRefreshed)&&h(e.sessionsReplaced)&&h(e.projectsCreated)&&(e.lastRequestAt===void 0||b(e.lastRequestAt))&&(e.lastError===void 0||typeof e.lastError=="string")&&(e.busyUntil===void 0||b(e.busyUntil))&&(e.mailbox===void 0||It(e.mailbox))}function er(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.protocolVersion=="number"&&(e.state==="idle"||e.state==="ready"||e.state==="unavailable"||e.state==="error")&&d(e.requests)&&d(e.sessionsCreated)&&d(e.sessionsReplaced)&&d(e.initializations)&&d(e.programUpdates)&&d(e.documentsEmitted)&&d(e.documentsRemoved)&&(e.lastRequestAt===void 0||b(e.lastRequestAt))&&(e.lastDurationMs===void 0||h(e.lastDurationMs)&&e.lastDurationMs>=0)&&(e.lastError===void 0||typeof e.lastError=="string")&&(e.busyUntil===void 0||b(e.busyUntil))&&(e.mailbox===void 0||It(e.mailbox))}function tr(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.protocolVersion=="number"&&typeof e.socketPath=="string"&&e.socketPath.length>0&&d(e.requests)&&(e.lastRequestAt===void 0||b(e.lastRequestAt))&&(e.lastError===void 0||typeof e.lastError=="string")}function It(t){if(!t||typeof t!="object")return!1;let e=t;return d(e.pending)&&d(e.inflight)&&d(e.responses)&&d(e.deadLetters)&&d(e.invalid)&&d(e.totalItems)&&h(e.totalBytes)&&e.totalBytes>=0&&e.totalItems===e.pending+e.inflight+e.responses+e.deadLetters&&(e.oldestPendingAt===void 0||b(e.oldestPendingAt))}function h(t){return typeof t=="number"&&Number.isFinite(t)}export{Mt as a,ir as b,dr as c,z as d,_e as e,pr as f,sn as g,an as h,cn as i,dn as j,v as k,st as l,gi as m,bi as n,ge as o,at as p,yn as q,gn as r,bn as s,lt as t,Rr as u,kt as v,de as w,wr as x,jt as y,Nt as z,Pr as A,vr as B,Ar as C,ee as D,vn as E,Ti as F,Fi as G,Ln as H,Li as I,Ci as J,Oi as K,_t as L,H as M,Ht as N,Dr as O,qr as P,Hr as Q,V as R,ue as S,ni as T,ri as U,ii as V};
5
- //# sourceMappingURL=chunk-UCD3H3UZ.js.map
5
+ //# sourceMappingURL=chunk-6ZV5EDUT.js.map
@@ -1,4 +1,4 @@
1
- import{a as L}from"./chunk-DGXRDLV5.js";import{c as M}from"./chunk-OL6KJP3N.js";import{c as w}from"./chunk-7FND7D7N.js";import{a as I}from"./chunk-JOIRNPPY.js";import{f as E}from"./chunk-6CS3UQTN.js";import{f as x}from"./chunk-J77SU6VA.js";import{d as f}from"./chunk-SGX43S2L.js";import{d as C}from"./chunk-FETNQCFO.js";import{f as h}from"./chunk-O6QTXQPJ.js";var H=new Set(f());function U(e,t){return P(e,t).rows}function P(e,t){let{scope:l,minLoc:o=10,limit:s=30,scanLimit:a}=t??{},c=new w(e),r=t?.semantic!==!1,u=B(r,new Set,new Set);return{rows:L({candidates:()=>c.productionCallableDefinitions({scope:l,minLoc:o,requireFunctionLikeSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof a=="number"&&a>0}),scanLimit:a,filterCandidate:R,profile:{name:"complexity-hotspots"},prepare:n=>{let i=z(e,n);(r?E(e):null)?.materializeReferences(n,{prefetchCallees:!0});let m=x(e,n,{semantic:r,semanticEvidence:I}),y=c.calleeEvidenceMap(n,{semantic:r}),g=new Set([...m.incompleteSymbolIds,...y.incompleteSymbolIds]),v=new Set([...m.unavailableSymbolIds,...y.unavailableSymbolIds]);u=B(r,g,v);let D=new Map(n.map(p=>[p.symbolId,p]));return{callerMap:new Map([...m.rows].map(([p,F])=>[p,new Set(F.filter(d=>d.file!==D.get(p)?.relativePath).map(d=>d.file))])),calleeMap:y.rows,incompleteSymbolIds:g,unavailableSymbolIds:v,languageByFile:i,clojureCallableIds:k(e,n,i),branchEstimates:M(e,n)}},evaluate:(n,i)=>i.incompleteSymbolIds.has(n.symbolId)||i.unavailableSymbolIds.has(n.symbolId)?null:j(n,i,o),orderResults:(n,i)=>i.score-n.score||i.loc-n.loc,limit:s}),coverage:u}}function B(e,t,l){let o=new Set([...t,...l]).size,s=e?t.size>0&&l.size>0?"incomplete-and-unavailable":t.size>0?"incomplete":l.size>0?"unavailable":"complete":"disabled";return{semanticEvidence:{enabled:e,status:s,incompleteSymbolCount:t.size,unavailableSymbolCount:l.size,excludedSymbolCount:o}}}function R(e){return e.symbol.startsWith("rust-analyzer ")?typeof e.kind=="number"&&H.has(e.kind):!0}function j(e,t,l){if(t.languageByFile.get(e.relativePath)==="clojure"&&!t.clojureCallableIds.has(e.symbolId))return null;let o=e.endLine-e.startLine+1;if(o<l)return null;let s=t.callerMap.get(e.symbolId)?.size??0,a=t.calleeMap.get(e.symbolId)??[],c=new Set,r=new Set;for(let b of a){let m=`${b.symbol}|${b.file}`;c.add(m),b.file!==e.relativePath&&r.add(m)}let u=r.size,S=c.size,n=t.branchEstimates.get(e.symbolId)??{branches:0,estimateBasis:"regex-fallback"},i=n.branches+1;return{symbol:e.symbol,shortName:C(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:o,fanIn:s,fanOut:u,calleeCount:S,branches:n.branches,estimateBasis:n.estimateBasis,score:Math.round(o/50*(s/5)*Math.max(u/5,1)*Math.max(i/5,1)*100)/100}}function z(e,t){let l=[...new Set(t.map(a=>a.relativePath))];if(l.length===0)return new Map;let o=l.map(()=>"?").join(", "),s=e.all(`SELECT relative_path, language
1
+ import{a as L}from"./chunk-DGXRDLV5.js";import{c as M}from"./chunk-IVJJNVSX.js";import{c as w}from"./chunk-NK76RSB6.js";import{a as I}from"./chunk-OJFLPVBP.js";import{f as E}from"./chunk-VCL7FK3E.js";import{f as x}from"./chunk-57KEZDPT.js";import{d as f}from"./chunk-SGX43S2L.js";import{d as C}from"./chunk-AM5SUGHF.js";import{f as h}from"./chunk-JOALNFY3.js";var H=new Set(f());function U(e,t){return P(e,t).rows}function P(e,t){let{scope:l,minLoc:o=10,limit:s=30,scanLimit:a}=t??{},c=new w(e),r=t?.semantic!==!1,u=B(r,new Set,new Set);return{rows:L({candidates:()=>c.productionCallableDefinitions({scope:l,minLoc:o,requireFunctionLikeSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof a=="number"&&a>0}),scanLimit:a,filterCandidate:R,profile:{name:"complexity-hotspots"},prepare:n=>{let i=z(e,n);(r?E(e):null)?.materializeReferences(n,{prefetchCallees:!0});let m=x(e,n,{semantic:r,semanticEvidence:I}),y=c.calleeEvidenceMap(n,{semantic:r}),g=new Set([...m.incompleteSymbolIds,...y.incompleteSymbolIds]),v=new Set([...m.unavailableSymbolIds,...y.unavailableSymbolIds]);u=B(r,g,v);let D=new Map(n.map(p=>[p.symbolId,p]));return{callerMap:new Map([...m.rows].map(([p,F])=>[p,new Set(F.filter(d=>d.file!==D.get(p)?.relativePath).map(d=>d.file))])),calleeMap:y.rows,incompleteSymbolIds:g,unavailableSymbolIds:v,languageByFile:i,clojureCallableIds:k(e,n,i),branchEstimates:M(e,n)}},evaluate:(n,i)=>i.incompleteSymbolIds.has(n.symbolId)||i.unavailableSymbolIds.has(n.symbolId)?null:j(n,i,o),orderResults:(n,i)=>i.score-n.score||i.loc-n.loc,limit:s}),coverage:u}}function B(e,t,l){let o=new Set([...t,...l]).size,s=e?t.size>0&&l.size>0?"incomplete-and-unavailable":t.size>0?"incomplete":l.size>0?"unavailable":"complete":"disabled";return{semanticEvidence:{enabled:e,status:s,incompleteSymbolCount:t.size,unavailableSymbolCount:l.size,excludedSymbolCount:o}}}function R(e){return e.symbol.startsWith("rust-analyzer ")?typeof e.kind=="number"&&H.has(e.kind):!0}function j(e,t,l){if(t.languageByFile.get(e.relativePath)==="clojure"&&!t.clojureCallableIds.has(e.symbolId))return null;let o=e.endLine-e.startLine+1;if(o<l)return null;let s=t.callerMap.get(e.symbolId)?.size??0,a=t.calleeMap.get(e.symbolId)??[],c=new Set,r=new Set;for(let b of a){let m=`${b.symbol}|${b.file}`;c.add(m),b.file!==e.relativePath&&r.add(m)}let u=r.size,S=c.size,n=t.branchEstimates.get(e.symbolId)??{branches:0,estimateBasis:"regex-fallback"},i=n.branches+1;return{symbol:e.symbol,shortName:C(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:o,fanIn:s,fanOut:u,calleeCount:S,branches:n.branches,estimateBasis:n.estimateBasis,score:Math.round(o/50*(s/5)*Math.max(u/5,1)*Math.max(i/5,1)*100)/100}}function z(e,t){let l=[...new Set(t.map(a=>a.relativePath))];if(l.length===0)return new Map;let o=l.map(()=>"?").join(", "),s=e.all(`SELECT relative_path, language
2
2
  FROM documents
3
3
  WHERE relative_path IN (${o})`,...l);return new Map(s.map(a=>[a.relative_path,a.language?.toLowerCase()??null]))}function k(e,t,l){let o=new Set,s=new Map;for(let a of t){if(l.get(a.relativePath)!=="clojure")continue;let c=s.get(a.relativePath);c||(c=new Set((h(e,a.relativePath)?.callables??[]).map(r=>`${r.name}:${r.startLine}`)),s.set(a.relativePath,c)),c.has(`${a.leaf}:${a.startLine}`)&&o.add(a.symbolId)}return o}export{U as a,P as b};
4
- //# sourceMappingURL=chunk-C6SBF2WH.js.map
4
+ //# sourceMappingURL=chunk-77GHPR2R.js.map
@@ -1,4 +1,4 @@
1
- import{e as V,f as X,m as A,o as H,p as Y,q as Q}from"./chunk-ZKX2FRS6.js";import{D as L,E as $,F as U,H as K,o as z,q as _,s as b,t as N}from"./chunk-NNJ2KZZG.js";import{spawn as Se}from"child_process";import{platform as Z}from"os";import{performance as ee}from"perf_hooks";var St={probe:1e4,git:3e4,analysis:18e4,install:3e5,indexer:6e5},v=class extends Error{constructor(n,i,s,a={}){super(s,a.cause===void 0?void 0:{cause:a.cause});this.kind=n;this.label=i;this.name="BoundedProcessError",this.timedOut=a.timedOut??!1,this.reaped=a.reaped??!1,this.stdout=a.stdout??"",this.stderr=a.stderr??"",this.stdoutTruncated=a.stdoutTruncated??!1,this.stderrTruncated=a.stderrTruncated??!1}kind;label;timedOut;reaped;stdout;stderr;stdoutTruncated;stderrTruncated};function h(e,t){if(!Number.isFinite(e)||e<=0)throw new TypeError(`${t} must be a positive finite number.`)}function te(e,t,n,i){let s=Math.max(0,i-n);s>0&&e.push(t.subarray(0,s))}function ne(e,t,n){let i=Buffer.concat([...e,t]);e.length=0,e.push(i.subarray(Math.max(0,i.length-n)))}function Lt(e){h(e.timeoutMs,"timeoutMs"),h(e.maxStdoutBytes,"maxStdoutBytes"),h(e.maxStderrBytes,"maxStderrBytes");let t=e.terminationGraceMs??1e3;h(t,"terminationGraceMs");let n=e.terminationForceMs??t;return h(n,"terminationForceMs"),new Promise((i,s)=>{let a=ee.now(),r;try{let c=Z()!=="win32";r=Se(e.command,[...e.args??[]],{cwd:e.cwd,env:e.env,detached:c?!0:e.detached,stdio:["pipe","pipe","pipe"],windowsHide:!0})}catch(c){s(new v("spawn",e.label,`${e.label} could not start.`,{cause:c,reaped:!0}));return}let u=[],d=[],o=0,g=0,l=!1,m=!1,p=null,y=!1,x=Z()!=="win32",G=r.pid===void 0?null:Y(r.pid,x),O=()=>{clearTimeout(q),e.signal?.removeEventListener("abort",E)},P=c=>{if(y||!p)return;y=!0,O();let f=Buffer.concat(u).toString("utf8"),I=Buffer.concat(d).toString("utf8"),M=c.reaped||!c.detail?"":` Process-tree cleanup failed: ${c.detail}`;s(new v(p.kind,e.label,`${p.message}${M}`,{timedOut:p.timedOut,reaped:c.reaped,stdout:f,stderr:I,stdoutTruncated:l,stderrTruncated:m}))},R=c=>{if(!(p||y)){if(p=c,!G){P({reaped:r.pid===void 0,reason:r.pid===void 0?"terminated":"identity-unavailable"});return}Q(G,{gracefulMs:t,forceMs:n}).then(P,f=>{P({reaped:!1,reason:"signal-failed",detail:f instanceof Error?f.message:String(f)})})}},q=setTimeout(()=>{R({kind:"timeout",timedOut:!0,message:`${e.label} timed out after ${e.timeoutMs}ms.`})},e.timeoutMs);q.unref();let E=()=>{R({kind:"aborted",timedOut:!1,message:`${e.label} was cancelled.`})};e.signal?.addEventListener("abort",E,{once:!0}),e.signal?.aborted&&E(),r.stdout.on("data",c=>{let f=Buffer.isBuffer(c)?c:Buffer.from(c);e.outputLimitBehavior==="truncate-tail"?ne(u,f,e.maxStdoutBytes):te(u,f,o,e.maxStdoutBytes),o+=f.length,o>e.maxStdoutBytes&&(l=!0,e.outputLimitBehavior!=="truncate-tail"&&R({kind:"stdout-limit",timedOut:!1,message:`${e.label} exceeded stdout limit (${e.maxStdoutBytes} bytes).`}))}),r.stderr.on("data",c=>{let f=Buffer.isBuffer(c)?c:Buffer.from(c);e.outputLimitBehavior==="truncate-tail"?ne(d,f,e.maxStderrBytes):te(d,f,g,e.maxStderrBytes),g+=f.length,g>e.maxStderrBytes&&(m=!0,e.outputLimitBehavior!=="truncate-tail"&&R({kind:"stderr-limit",timedOut:!1,message:`${e.label} exceeded stderr limit (${e.maxStderrBytes} bytes).`}))}),r.on("error",c=>{if(!y&&!p){if(r.pid===void 0){O(),y=!0,s(new v("spawn",e.label,`${e.label} could not start: ${c.message}`,{cause:c,reaped:!0}));return}R({kind:"spawn",timedOut:!1,message:`${e.label} failed after start: ${c.message}`})}}),r.on("close",(c,f)=>{if(y||p)return;y=!0,O();let I=Buffer.concat(u).toString("utf8"),M=Buffer.concat(d).toString("utf8");i({status:c,signal:f,stdout:I,stderr:M,timedOut:!1,durationMs:ee.now()-a,stdoutTruncated:l,stderrTruncated:m})}),e.input===void 0?r.stdin.end():r.stdin.end(e.input)})}import{execFileSync as ie}from"child_process";import{createRequire as Le}from"module";import{existsSync as Ae}from"fs";import{platform as B,arch as re}from"os";var S="v0.8.1",D="https://github.com/sourcegraph/scip",w=`github.com/sourcegraph/scip/cmd/scip@${S}`,se=Le(import.meta.url),ae="CODEBASEIQ_SCIP_BIN";function we(e){if(e.isOnPath("scip"))return{source:"path",path:"scip"};let t=e.env[ae];if(t&&e.fileExists(t))return{source:"env",path:t};if(e.platform==="win32"){let n=e.resolveSidecar(e.arch);if(n&&e.fileExists(n))return{source:"sidecar",path:n}}return null}function Te(e){for(let t of e==="arm64"?["arm64","x64"]:[e])try{return se.resolve(`codebaseiq-windows/scip-win32-${t}.exe`)}catch{}return null}function J(e=process.env){let t=we({platform:B(),arch:re(),env:e,isOnPath:A,fileExists:Ae,resolveSidecar:Te});return t?.source==="path"?H("scip")??t.path:t?.path??null}function Et(){return J()!==null}function ke(){let e=J();if(!e)return null;try{return ie(e,["--version"],{stdio:"pipe",windowsHide:!0,timeout:1e4,killSignal:"SIGKILL"}).toString().trim()}catch{return null}}function Oe(){let e=B(),t=re(),n,i,s;switch(e){case"darwin":n="darwin",s="tar.gz";break;case"linux":n="linux",s="tar.gz";break;default:return null}switch(t){case"arm64":i="arm64";break;case"x64":i="amd64";break;default:return null}let a=`scip-${n}-${i}.${s}`;return{url:`${D}/releases/download/${S}/${a}`,filename:a}}function It(){let e=Oe();if(console.log("\nThe `scip` CLI is required but not found on PATH.\n"),B()==="darwin"||B()==="linux")console.log("Install the reviewed version with Go:"),console.log(` go install ${w}
1
+ import{e as V,f as X,m as A,o as H,p as Y,q as Q}from"./chunk-CANBLFVQ.js";import{D as L,E as $,F as U,H as K,o as z,q as _,s as b,t as N}from"./chunk-327YK6TB.js";import{spawn as Se}from"child_process";import{platform as Z}from"os";import{performance as ee}from"perf_hooks";var St={probe:1e4,git:3e4,analysis:18e4,install:3e5,indexer:6e5},v=class extends Error{constructor(n,i,s,a={}){super(s,a.cause===void 0?void 0:{cause:a.cause});this.kind=n;this.label=i;this.name="BoundedProcessError",this.timedOut=a.timedOut??!1,this.reaped=a.reaped??!1,this.stdout=a.stdout??"",this.stderr=a.stderr??"",this.stdoutTruncated=a.stdoutTruncated??!1,this.stderrTruncated=a.stderrTruncated??!1}kind;label;timedOut;reaped;stdout;stderr;stdoutTruncated;stderrTruncated};function h(e,t){if(!Number.isFinite(e)||e<=0)throw new TypeError(`${t} must be a positive finite number.`)}function te(e,t,n,i){let s=Math.max(0,i-n);s>0&&e.push(t.subarray(0,s))}function ne(e,t,n){let i=Buffer.concat([...e,t]);e.length=0,e.push(i.subarray(Math.max(0,i.length-n)))}function Lt(e){h(e.timeoutMs,"timeoutMs"),h(e.maxStdoutBytes,"maxStdoutBytes"),h(e.maxStderrBytes,"maxStderrBytes");let t=e.terminationGraceMs??1e3;h(t,"terminationGraceMs");let n=e.terminationForceMs??t;return h(n,"terminationForceMs"),new Promise((i,s)=>{let a=ee.now(),r;try{let c=Z()!=="win32";r=Se(e.command,[...e.args??[]],{cwd:e.cwd,env:e.env,detached:c?!0:e.detached,stdio:["pipe","pipe","pipe"],windowsHide:!0})}catch(c){s(new v("spawn",e.label,`${e.label} could not start.`,{cause:c,reaped:!0}));return}let u=[],d=[],o=0,g=0,l=!1,m=!1,p=null,y=!1,x=Z()!=="win32",G=r.pid===void 0?null:Y(r.pid,x),O=()=>{clearTimeout(q),e.signal?.removeEventListener("abort",E)},P=c=>{if(y||!p)return;y=!0,O();let f=Buffer.concat(u).toString("utf8"),I=Buffer.concat(d).toString("utf8"),M=c.reaped||!c.detail?"":` Process-tree cleanup failed: ${c.detail}`;s(new v(p.kind,e.label,`${p.message}${M}`,{timedOut:p.timedOut,reaped:c.reaped,stdout:f,stderr:I,stdoutTruncated:l,stderrTruncated:m}))},R=c=>{if(!(p||y)){if(p=c,!G){P({reaped:r.pid===void 0,reason:r.pid===void 0?"terminated":"identity-unavailable"});return}Q(G,{gracefulMs:t,forceMs:n}).then(P,f=>{P({reaped:!1,reason:"signal-failed",detail:f instanceof Error?f.message:String(f)})})}},q=setTimeout(()=>{R({kind:"timeout",timedOut:!0,message:`${e.label} timed out after ${e.timeoutMs}ms.`})},e.timeoutMs);q.unref();let E=()=>{R({kind:"aborted",timedOut:!1,message:`${e.label} was cancelled.`})};e.signal?.addEventListener("abort",E,{once:!0}),e.signal?.aborted&&E(),r.stdout.on("data",c=>{let f=Buffer.isBuffer(c)?c:Buffer.from(c);e.outputLimitBehavior==="truncate-tail"?ne(u,f,e.maxStdoutBytes):te(u,f,o,e.maxStdoutBytes),o+=f.length,o>e.maxStdoutBytes&&(l=!0,e.outputLimitBehavior!=="truncate-tail"&&R({kind:"stdout-limit",timedOut:!1,message:`${e.label} exceeded stdout limit (${e.maxStdoutBytes} bytes).`}))}),r.stderr.on("data",c=>{let f=Buffer.isBuffer(c)?c:Buffer.from(c);e.outputLimitBehavior==="truncate-tail"?ne(d,f,e.maxStderrBytes):te(d,f,g,e.maxStderrBytes),g+=f.length,g>e.maxStderrBytes&&(m=!0,e.outputLimitBehavior!=="truncate-tail"&&R({kind:"stderr-limit",timedOut:!1,message:`${e.label} exceeded stderr limit (${e.maxStderrBytes} bytes).`}))}),r.on("error",c=>{if(!y&&!p){if(r.pid===void 0){O(),y=!0,s(new v("spawn",e.label,`${e.label} could not start: ${c.message}`,{cause:c,reaped:!0}));return}R({kind:"spawn",timedOut:!1,message:`${e.label} failed after start: ${c.message}`})}}),r.on("close",(c,f)=>{if(y||p)return;y=!0,O();let I=Buffer.concat(u).toString("utf8"),M=Buffer.concat(d).toString("utf8");i({status:c,signal:f,stdout:I,stderr:M,timedOut:!1,durationMs:ee.now()-a,stdoutTruncated:l,stderrTruncated:m})}),e.input===void 0?r.stdin.end():r.stdin.end(e.input)})}import{execFileSync as ie}from"child_process";import{createRequire as Le}from"module";import{existsSync as Ae}from"fs";import{platform as B,arch as re}from"os";var S="v0.8.1",D="https://github.com/sourcegraph/scip",w=`github.com/sourcegraph/scip/cmd/scip@${S}`,se=Le(import.meta.url),ae="CODEBASEIQ_SCIP_BIN";function we(e){if(e.isOnPath("scip"))return{source:"path",path:"scip"};let t=e.env[ae];if(t&&e.fileExists(t))return{source:"env",path:t};if(e.platform==="win32"){let n=e.resolveSidecar(e.arch);if(n&&e.fileExists(n))return{source:"sidecar",path:n}}return null}function Te(e){for(let t of e==="arm64"?["arm64","x64"]:[e])try{return se.resolve(`codebaseiq-windows/scip-win32-${t}.exe`)}catch{}return null}function J(e=process.env){let t=we({platform:B(),arch:re(),env:e,isOnPath:A,fileExists:Ae,resolveSidecar:Te});return t?.source==="path"?H("scip")??t.path:t?.path??null}function Et(){return J()!==null}function ke(){let e=J();if(!e)return null;try{return ie(e,["--version"],{stdio:"pipe",windowsHide:!0,timeout:1e4,killSignal:"SIGKILL"}).toString().trim()}catch{return null}}function Oe(){let e=B(),t=re(),n,i,s;switch(e){case"darwin":n="darwin",s="tar.gz";break;case"linux":n="linux",s="tar.gz";break;default:return null}switch(t){case"arm64":i="arm64";break;case"x64":i="amd64";break;default:return null}let a=`scip-${n}-${i}.${s}`;return{url:`${D}/releases/download/${S}/${a}`,filename:a}}function It(){let e=Oe();if(console.log("\nThe `scip` CLI is required but not found on PATH.\n"),B()==="darwin"||B()==="linux")console.log("Install the reviewed version with Go:"),console.log(` go install ${w}
2
2
  `),console.log("Or download that exact release manually:");else if(B()==="win32"){let t=Pe();console.log("On Windows the scip binary ships via the npm sidecar package codebaseiq-windows,"),console.log("installed automatically with codebaseiq. If it is missing:"),console.log(` npm install -g ${t}`),console.log(`Or set ${ae} to a local scip.exe path.
3
3
  `),console.log("Upstream release page:")}else console.log("Download from:");console.log(e?` ${e.url}
4
4
  `:` ${D}/releases/tag/${S}
@@ -9,4 +9,4 @@ import{e as V,f as X,m as A,o as H,p as Y,q as Q}from"./chunk-ZKX2FRS6.js";impor
9
9
  `)||(e=e.slice(0,Math.max(0,e.lastIndexOf(`
10
10
  `)+1))),e.split(`
11
11
  `).filter(t=>t.length>0)}export{St as a,v as b,Lt as c,J as d,Et as e,ke as f,It as g,Mt as h,T as i,fe as j,Jt as k,nt as l,Qt as m,Zt as n,en as o};
12
- //# sourceMappingURL=chunk-YVCIMIOC.js.map
12
+ //# sourceMappingURL=chunk-7R64XY4Y.js.map
@@ -1,4 +1,4 @@
1
- import{a as b,b as y,c as m}from"./chunk-SGX43S2L.js";import{b as f,d as g,f as d,u as p}from"./chunk-FETNQCFO.js";import{a as c}from"./chunk-ADTBPVUZ.js";import{SymbolInformation_Kind as o}from"@c4312/scip";var _=500;function K(n){let s=parseInt(n,10);if(!isNaN(s))return s;let t=n.toLowerCase(),e=y.get(t);if(e!==void 0)return e;for(let[i,l]of b)if(l.toLowerCase().includes(t))return i;return null}function v(n,s,t={}){let{scope:e,limit:i=100}=t,l=K(s);return l===null?[]:h(n,e).map(r=>({row:r,resolvedKind:k(r)})).filter(r=>r.resolvedKind===l).slice(0,i).map(({row:r,resolvedKind:a})=>({symbol:r.symbol,shortName:g(r.symbol),kind:a,kindName:m(a),relativePath:r.relative_path,startLine:r.start_line,endLine:r.end_line}))}function T(n,s={}){let t=I(n,s.scope);for(let e of S(n,s.scope)){let i=k(e);i===null||i===0||t.set(i,(t.get(i)??0)+1)}return[...t.entries()].sort((e,i)=>i[1]-e[1]||e[0]-i[0]).map(([e,i])=>({kind:e,kindName:m(e),count:i}))}function h(n,s){return p(n,{scope:s}).map(R)}function I(n,s){let t=new Map;for(let e of N(c(n,{scope:s,includeIgnored:!1}))){let i=e.map(()=>"?").join(", "),l=n.all(`SELECT gs.kind AS kind, COUNT(*) AS count
1
+ import{a as b,b as y,c as m}from"./chunk-SGX43S2L.js";import{b as f,d as g,f as d,u as p}from"./chunk-AM5SUGHF.js";import{a as c}from"./chunk-RVYLJDXC.js";import{SymbolInformation_Kind as o}from"@c4312/scip";var _=500;function K(n){let s=parseInt(n,10);if(!isNaN(s))return s;let t=n.toLowerCase(),e=y.get(t);if(e!==void 0)return e;for(let[i,l]of b)if(l.toLowerCase().includes(t))return i;return null}function v(n,s,t={}){let{scope:e,limit:i=100}=t,l=K(s);return l===null?[]:h(n,e).map(r=>({row:r,resolvedKind:k(r)})).filter(r=>r.resolvedKind===l).slice(0,i).map(({row:r,resolvedKind:a})=>({symbol:r.symbol,shortName:g(r.symbol),kind:a,kindName:m(a),relativePath:r.relative_path,startLine:r.start_line,endLine:r.end_line}))}function T(n,s={}){let t=I(n,s.scope);for(let e of S(n,s.scope)){let i=k(e);i===null||i===0||t.set(i,(t.get(i)??0)+1)}return[...t.entries()].sort((e,i)=>i[1]-e[1]||e[0]-i[0]).map(([e,i])=>({kind:e,kindName:m(e),count:i}))}function h(n,s){return p(n,{scope:s}).map(R)}function I(n,s){let t=new Map;for(let e of N(c(n,{scope:s,includeIgnored:!1}))){let i=e.map(()=>"?").join(", "),l=n.all(`SELECT gs.kind AS kind, COUNT(*) AS count
2
2
  FROM defn_enclosing_ranges der
3
3
  JOIN global_symbols gs ON der.symbol_id = gs.id
4
4
  JOIN documents d ON der.document_id = d.id
@@ -20,4 +20,4 @@ import{a as b,b as y,c as m}from"./chunk-SGX43S2L.js";import{b as f,d as g,f as
20
20
  ${n.symbolNoiseFor("gs")}
21
21
  AND d.relative_path IN (${i})
22
22
  ORDER BY d.relative_path, der.start_line, der.end_line, gs.symbol`,...e))}return t}function N(n){let s=[];for(let t=0;t<n.length;t+=_)s.push(n.slice(t,t+_));return s}function R(n){return{symbol:n.symbol,kind:n.kind,documentation:n.documentation,enclosing_symbol:n.enclosingSymbol,relative_path:n.relativePath,start_line:n.startLine,end_line:n.endLine}}function k(n){return n.kind!==null&&n.kind!==0?D(n.kind,n.symbol,n.documentation):C(n.symbol,n.documentation,n.enclosing_symbol)}function D(n,s,t){let e=(t??"").toLowerCase();if(d(s)==="type"){if(e.includes("type "))return o.TypeAlias;if(e.includes("interface "))return o.Interface;if(e.includes("struct "))return o.Struct;if(e.includes("trait "))return o.Trait;if(e.includes("class "))return o.Class}return n}function C(n,s,t){let e=f(n);if("kind"in e)return null;let i=e.descriptors,l=i[i.length-2]??null,u=d(n),r=(s??"").toLowerCase();return u==="type"?r.includes("type ")?o.TypeAlias:r.includes("interface ")?o.Interface:r.includes("struct ")?o.Struct:r.includes("trait ")?o.Trait:r.includes("class ")?o.Class:o.Class:u==="method"?l?.suffix==="type"?o.Method:o.Function:u==="namespace"?o.Module:u!=="term"?null:r.includes("async def ")||r.includes("def ")?o.Function:(t?d(t):l?.suffix??null)==="type"?o.Field:o.Variable}export{v as a,T as b};
23
- //# sourceMappingURL=chunk-VXYS3FZD.js.map
23
+ //# sourceMappingURL=chunk-7Z7HCZ7J.js.map
@@ -1,2 +1,2 @@
1
- import{a as c}from"./chunk-NNOKTMZT.js";function j(e,s={}){let{minSimilarity:t=.5,limit:n=15,scope:i,minChainLength:r=3,maxChainLength:l=8}=s,a=c(e,i),o=y(a,r,l);if(o.length===0)return[];let f=d(o);return f.length<2?[]:S(x(f,t,n),n)}function d(e){let s=m(e),t=[];for(let n of e){let i=n.filter(r=>!s.has(r));i.length>=2&&t.push({original:n,filtered:i})}return t}function m(e){let{nodeFreq:s,tailFreq:t}=p(e),n=e.length*.9,i=e.length*.8,r=new Set;for(let[a,o]of s)o>n&&r.add(a);for(let[a,o]of t)o>i&&r.add(a);let l=["index.ts","index.js","cli.ts","main.ts","health.ts","health.js"];for(let a of s.keys()){let o=a.split("/").pop()??"";l.includes(o)&&r.add(a)}return r}function p(e){let s=new Map,t=new Map;for(let n of e){let i=new Set;for(let r of n)i.has(r)||(s.set(r,(s.get(r)??0)+1),i.add(r));for(let r=Math.max(0,n.length-2);r<n.length;r++)t.set(n[r],(t.get(n[r])??0)+1)}return{nodeFreq:s,tailFreq:t}}function x(e,s,t){let n=[];for(let i=0;i<e.length;i++){for(let r=i+1;r<e.length;r++){let l=b(e[i],e[r],s);l&&n.push(l)}if(n.length>t*10)break}return n.sort((i,r)=>Math.abs(r.similarity-i.similarity)>.01?r.similarity-i.similarity:i.divergencePoints.length-r.divergencePoints.length),n}function b(e,s,t){if(!C(e.filtered,s.filtered))return null;let{distance:n,ops:i}=A(e.filtered,s.filtered),r=Math.max(e.filtered.length,s.filtered.length);if(r===0)return null;let l=1-n/r;if(l<t||n===0)return null;let a=i.filter(f=>f.type==="substitute").map(f=>({index:f.indexA,nodeA:e.filtered[f.indexA],nodeB:s.filtered[f.indexB]}));return a.length===0||i.filter(f=>f.type==="match").length<2?null:{chainA:e.original,chainB:s.original,similarity:l,editDistance:n,divergencePoints:a,commonPrefix:F(e.original,s.original),commonSuffix:B(e.original,s.original)}}function C(e,s){let t=new Set(e);return s.some(n=>t.has(n))}function S(e,s){let t=[];for(let n of e)if(t.some(r=>h(n.chainA,r.chainA)&&h(n.chainB,r.chainB))||t.push(n),t.length>=s)break;return t}function y(e,s,t){let n=[];for(let r of e.keys()){if(n.length>=500)break;g(e,r,[r],new Set([r]),s,t,n,500)}return n}function g(e,s,t,n,i,r,l,a){if(l.length>=a)return;if(t.length>=r){t.length>=i&&l.push([...t]);return}let o=e.get(s);if(!o||o.size===0){t.length>=i&&l.push([...t]);return}let f=!1;for(let u of o)if(!n.has(u)&&(n.add(u),t.push(u),g(e,u,t,n,i,r,l,a),t.pop(),n.delete(u),f=!0,l.length>=a))return;!f&&t.length>=i&&l.push([...t])}function A(e,s){let t=e.length,n=s.length,i=Array.from({length:t+1},()=>Array(n+1).fill(0));for(let o=0;o<=t;o++)i[o][0]=o;for(let o=0;o<=n;o++)i[0][o]=o;for(let o=1;o<=t;o++)for(let f=1;f<=n;f++)e[o-1]===s[f-1]?i[o][f]=i[o-1][f-1]:i[o][f]=1+Math.min(i[o-1][f],i[o][f-1],i[o-1][f-1]);let r=[],l=t,a=n;for(;l>0||a>0;)l>0&&a>0&&e[l-1]===s[a-1]?(r.unshift({type:"match",indexA:l-1,indexB:a-1}),l--,a--):l>0&&a>0&&i[l][a]===i[l-1][a-1]+1?(r.unshift({type:"substitute",indexA:l-1,indexB:a-1}),l--,a--):a>0&&i[l][a]===i[l][a-1]+1?(r.unshift({type:"insert",indexA:l,indexB:a-1}),a--):(r.unshift({type:"delete",indexA:l-1,indexB:a}),l--);return{distance:i[t][n],ops:r}}function F(e,s){let t=[];for(let n=0;n<Math.min(e.length,s.length)&&e[n]===s[n];n++)t.push(e[n]);return t}function B(e,s){let t=[],n=e.length-1,i=s.length-1;for(;n>=0&&i>=0&&e[n]===s[i];)t.unshift(e[n]),n--,i--;return t}function h(e,s){if(e.length>s.length)return!1;let t=s.join("\u2192"),n=e.join("\u2192");return t.includes(n)}export{j as a};
2
- //# sourceMappingURL=chunk-CO5R3UNA.js.map
1
+ import{a as c}from"./chunk-B2E3HZ2A.js";function j(e,s={}){let{minSimilarity:t=.5,limit:n=15,scope:i,minChainLength:r=3,maxChainLength:l=8}=s,a=c(e,i),o=y(a,r,l);if(o.length===0)return[];let f=d(o);return f.length<2?[]:S(x(f,t,n),n)}function d(e){let s=m(e),t=[];for(let n of e){let i=n.filter(r=>!s.has(r));i.length>=2&&t.push({original:n,filtered:i})}return t}function m(e){let{nodeFreq:s,tailFreq:t}=p(e),n=e.length*.9,i=e.length*.8,r=new Set;for(let[a,o]of s)o>n&&r.add(a);for(let[a,o]of t)o>i&&r.add(a);let l=["index.ts","index.js","cli.ts","main.ts","health.ts","health.js"];for(let a of s.keys()){let o=a.split("/").pop()??"";l.includes(o)&&r.add(a)}return r}function p(e){let s=new Map,t=new Map;for(let n of e){let i=new Set;for(let r of n)i.has(r)||(s.set(r,(s.get(r)??0)+1),i.add(r));for(let r=Math.max(0,n.length-2);r<n.length;r++)t.set(n[r],(t.get(n[r])??0)+1)}return{nodeFreq:s,tailFreq:t}}function x(e,s,t){let n=[];for(let i=0;i<e.length;i++){for(let r=i+1;r<e.length;r++){let l=b(e[i],e[r],s);l&&n.push(l)}if(n.length>t*10)break}return n.sort((i,r)=>Math.abs(r.similarity-i.similarity)>.01?r.similarity-i.similarity:i.divergencePoints.length-r.divergencePoints.length),n}function b(e,s,t){if(!C(e.filtered,s.filtered))return null;let{distance:n,ops:i}=A(e.filtered,s.filtered),r=Math.max(e.filtered.length,s.filtered.length);if(r===0)return null;let l=1-n/r;if(l<t||n===0)return null;let a=i.filter(f=>f.type==="substitute").map(f=>({index:f.indexA,nodeA:e.filtered[f.indexA],nodeB:s.filtered[f.indexB]}));return a.length===0||i.filter(f=>f.type==="match").length<2?null:{chainA:e.original,chainB:s.original,similarity:l,editDistance:n,divergencePoints:a,commonPrefix:F(e.original,s.original),commonSuffix:B(e.original,s.original)}}function C(e,s){let t=new Set(e);return s.some(n=>t.has(n))}function S(e,s){let t=[];for(let n of e)if(t.some(r=>h(n.chainA,r.chainA)&&h(n.chainB,r.chainB))||t.push(n),t.length>=s)break;return t}function y(e,s,t){let n=[];for(let r of e.keys()){if(n.length>=500)break;g(e,r,[r],new Set([r]),s,t,n,500)}return n}function g(e,s,t,n,i,r,l,a){if(l.length>=a)return;if(t.length>=r){t.length>=i&&l.push([...t]);return}let o=e.get(s);if(!o||o.size===0){t.length>=i&&l.push([...t]);return}let f=!1;for(let u of o)if(!n.has(u)&&(n.add(u),t.push(u),g(e,u,t,n,i,r,l,a),t.pop(),n.delete(u),f=!0,l.length>=a))return;!f&&t.length>=i&&l.push([...t])}function A(e,s){let t=e.length,n=s.length,i=Array.from({length:t+1},()=>Array(n+1).fill(0));for(let o=0;o<=t;o++)i[o][0]=o;for(let o=0;o<=n;o++)i[0][o]=o;for(let o=1;o<=t;o++)for(let f=1;f<=n;f++)e[o-1]===s[f-1]?i[o][f]=i[o-1][f-1]:i[o][f]=1+Math.min(i[o-1][f],i[o][f-1],i[o-1][f-1]);let r=[],l=t,a=n;for(;l>0||a>0;)l>0&&a>0&&e[l-1]===s[a-1]?(r.unshift({type:"match",indexA:l-1,indexB:a-1}),l--,a--):l>0&&a>0&&i[l][a]===i[l-1][a-1]+1?(r.unshift({type:"substitute",indexA:l-1,indexB:a-1}),l--,a--):a>0&&i[l][a]===i[l][a-1]+1?(r.unshift({type:"insert",indexA:l,indexB:a-1}),a--):(r.unshift({type:"delete",indexA:l-1,indexB:a}),l--);return{distance:i[t][n],ops:r}}function F(e,s){let t=[];for(let n=0;n<Math.min(e.length,s.length)&&e[n]===s[n];n++)t.push(e[n]);return t}function B(e,s){let t=[],n=e.length-1,i=s.length-1;for(;n>=0&&i>=0&&e[n]===s[i];)t.unshift(e[n]),n--,i--;return t}function h(e,s){if(e.length>s.length)return!1;let t=s.join("\u2192"),n=e.join("\u2192");return t.includes(n)}export{j as a};
2
+ //# sourceMappingURL=chunk-A67HT5FR.js.map
@@ -1,5 +1,5 @@
1
- import{a as te,b as N,e as V,f as j,g as B,h as re,i as se}from"./chunk-NMTSZXCL.js";import{b as _}from"./chunk-B75HZHUP.js";import{c as q}from"./chunk-7FND7D7N.js";import{a as ie}from"./chunk-JOIRNPPY.js";import{b as ne}from"./chunk-J77SU6VA.js";import{a as D}from"./chunk-UZGZB3VB.js";import{d as v,e as K,h as $}from"./chunk-FETNQCFO.js";import{a as E}from"./chunk-O6QTXQPJ.js";import{a as Y}from"./chunk-ADTBPVUZ.js";import{f as z,j as J,r as Q,t as ee,u as U,v as H}from"./chunk-BMYOV5GP.js";import{a as A,d as y}from"./chunk-3LCDIREB.js";function Ie(e,n,t={}){let{minSimilarity:i=.4,limit:r=20}=t,s=()=>Ge(e,n,{minSimilarity:i,limit:r,scanLimit:t.scanLimit,candidateMode:t.sourceCandidateMode??"full"}),a=Be(e,n,{semantic:t.semantic!==!1});if(a.kind==="not-callable")return[];if(a.kind==="callee-evidence-unusable")return s();let o=a.target;if(!$(o.symbol))return[];if(o.callees.size===0)return s();let c=we(e,o,i,{scanLimit:t.scanLimit,semantic:t.semantic!==!1});return c.length>0?c.slice(0,r):s()}function Tn(e,n,t,i={}){let r=D(e,n),s=D(e,t);if(!r||!s)return null;let a=Ie(e,r.symbol,{minSimilarity:0,limit:Number.POSITIVE_INFINITY,semantic:i.semantic,scanLimit:i.scanLimit}).find(m=>m.symbolB===s.symbol||m.symbolA===s.symbol);if(!a)return null;let o=r.endLine-r.startLine+1,c=s.endLine-s.startLine+1;return{symbolA:{symbol:r.symbol,shortName:v(r.symbol),file:r.relativePath,loc:o},symbolB:{symbol:s.symbol,shortName:v(s.symbol),file:s.relativePath,loc:c},similarity:a.similarity,similarityBasis:a.similarityBasis??"callees",sharedEvidence:a.sharedCallees,uniqueToA:a.uniqueToA,uniqueToB:a.uniqueToB,evidenceClass:a.evidenceClass,actionTier:a.actionTier,recommendation:a.recommendation,consolidationStrategy:ve(a)}}function ve(e){let n=e.similarityBasis==="source-tokens"?"source-token":"tracked callee";return e.sharedCallees.length===0?`No shared ${n} evidence survived similar's weighting. Inspect the source before attempting consolidation.`:e.uniqueToA.length===0&&e.uniqueToB.length===0?`The functions have identical ${n} evidence under similar's weighting. Verify signatures, guards, and return values before consolidating.`:e.uniqueToA.length===0?`A's ${n} evidence is a subset of B's. B may subsume part of A's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToB.length===0?`B's ${n} evidence is a subset of A's. A may subsume part of B's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToA.length<=2&&e.uniqueToB.length<=2?`Create a shared helper around the ${e.sharedCallees.length} shared ${n}(s). Pass the ${e.uniqueToA.length+e.uniqueToB.length} divergent point(s) as parameters or callbacks.`:`Extract the ${e.sharedCallees.length} shared ${n}(s) into a common helper. Keep each function's unique logic outside that helper (${e.uniqueToA.length} item(s) in A, ${e.uniqueToB.length} in B).`}function we(e,n,t,i){let r=G(e).calleeIndex({minCallees:3,scanLimit:i.scanLimit,semantic:i.semantic}),s=_e(n,r.corpus),a=Pe(s,r),o=Te(s,r),c=j(o),m=B(s.callees,o),g=[];for(let f of a){if(f.callees.size<3)continue;let l=B(f.callees,o),u=ce(s,f,o,{minSimilarity:t,requireSignificantShared:1,requireSharedCount:0,medianIdf:c,magnitudeA:m,magnitudeB:l});u&&g.push(u)}return g.sort((f,l)=>l.similarity-f.similarity),g}function Te(e,n){let t=new Map(n.docFreq);for(let i of e.callees)t.set(i,(t.get(i)??0)+1);return V(t,n.corpus.length+1)}function ce(e,n,t,i){let r=Le(e,n,t,i);if(!Re(r,i))return null;let{similarity:s,significantShared:a,trivialShared:o}=r,c=a.length>0?a:o,m=pe(c,"callees");return{symbolA:e.symbol,shortNameA:v(e.symbol),fileA:e.file,symbolB:n.symbol,shortNameB:v(n.symbol),fileB:n.file,similarity:s,similarityBasis:"callees",sharedCallees:c.map(v),uniqueToA:[...N(e.callees,n.callees)].map(v),uniqueToB:[...N(n.callees,e.callees)].map(v),...m}}function Me(e,n,t,i){let r=i.magnitudeA??B(e.callees,t),s=i.magnitudeB??B(n.callees,t),a=0,o=0,c=0,m=i.medianIdf??j(t);for(let l of e.callees){if(!n.callees.has(l))continue;let u=t.get(l)??0;a+=u*u,c+=1,u>=m&&(o+=1)}if(c===0)return!1;let g=r*s;return(g>0?a/g:0)<i.minSimilarity?!1:o>=i.requireSignificantShared||c>=i.requireSharedCount}function Le(e,n,t,i){return i.magnitudeA===void 0||i.magnitudeB===void 0?re(e.callees,n.callees,t,{medianIdf:i.medianIdf}):se(e.callees,n.callees,t,{medianIdf:i.medianIdf,magnitudeA:i.magnitudeA,magnitudeB:i.magnitudeB})}function Re(e,n){if(e.similarity<n.minSimilarity)return!1;let t=e.significantShared.length+e.trivialShared.length;return e.significantShared.length>=n.requireSignificantShared||t>=n.requireSharedCount}function Mn(e,n={}){let{minSimilarity:t=.5,limit:i=20,scope:r,minCallees:s=4,crossFileOnly:a=!1,scanLimit:o}=n,c=n.semantic!==!1,m=A(),g=0,f=0,l=0,u=0,d=0,p=0,b=0;return y("similar.all",()=>{let h=G(e).calleeIndex({minCallees:s,scope:r,scanLimit:o,semantic:c}),S=h.corpus;g=S.length;let F=n.focusFiles,I=[],P=0;return y("similar.all.pair-scan",()=>{for(let k=0;k<S.length;k+=1){let x=S[k],M=F?.has(x.file)??!1,w=h.weightedMagnitudes[k],T=new Set;for(let O of x.callees){let L=h.candidateIndexesByCallee.get(O);if(L)for(let R of L)R<=k||F&&!M&&!F.has(S[R].file)||T.add(R)}m&&(l+=T.size,T.size>0&&(f+=1));for(let O of T){let L=S[O];if(a&&x.file===L.file){m&&(d+=1);continue}if(ue(x,L)){m&&(p+=1);continue}m&&(u+=1);let R=ce(x,L,h.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:h.medianIdf,magnitudeA:w,magnitudeB:h.weightedMagnitudes[O]});R&&(Ae(I,R,i,P),m&&(b+=1),P+=1)}}},()=>({corpusSize:g,candidateSets:f,candidatePairs:l,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:b,topResults:I.length})),y("similar.all.sort-project",()=>(I.sort((k,x)=>x.result.similarity-k.result.similarity||k.order-x.order),I.map(k=>k.result)),()=>({topResults:I.length}))},()=>({minSimilarity:t,limit:i,scope:r,minCallees:s,crossFileOnly:a,scanLimit:o,semantic:c,corpusSize:g,candidateSets:f,candidatePairs:l,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:b}))}function Ln(e,n={}){let{minSimilarity:t=.5,scope:i,minCallees:r=4,crossFileOnly:s=!1,scanLimit:a}=n,o=n.semantic!==!1,c=A(),m=0,g=0,f=0,l=0,u=0,d=0,p=0;return y("similar.all-count",()=>{let C=G(e).calleeIndex({minCallees:r,scope:i,scanLimit:a,semantic:o}),h=C.corpus;m=h.length;let S=n.focusFiles;return y("similar.all-count.pair-scan",()=>{for(let F=0;F<h.length;F+=1){let I=h[F],P=S?.has(I.file)??!1,k=C.weightedMagnitudes[F],x=new Set;for(let M of I.callees){let w=C.candidateIndexesByCallee.get(M);if(w)for(let T of w)T<=F||S&&!P&&!S.has(h[T].file)||x.add(T)}c&&(f+=x.size,x.size>0&&(g+=1));for(let M of x){let w=h[M];if(s&&I.file===w.file){c&&(u+=1);continue}if(ue(I,w)){c&&(d+=1);continue}c&&(l+=1),Me(I,w,C.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:C.medianIdf,magnitudeA:k,magnitudeB:C.weightedMagnitudes[M]})&&(p+=1)}}},()=>({corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:l,crossFileSkips:u,signatureSkips:d,insertedResults:p})),p},()=>({minSimilarity:t,scope:i,minCallees:r,crossFileOnly:s,scanLimit:a,semantic:o,corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:l,crossFileSkips:u,signatureSkips:d,insertedResults:p}))}function ue(e,n){if(e.paramCount<0||n.paramCount<0)return!1;let t=Math.abs(e.paramCount-n.paramCount),i=Math.max(2,Math.ceil(Math.max(e.paramCount,n.paramCount)*.5));return t>i}var me=Q({kind:"source-fingerprints",invalidation:ee("source-fingerprints"),serialize:cn,deserialize:ln});function Ae(e,n,t,i){if(t<=0)return;if(e.length<t){e.push({result:n,order:i});return}let r=0;for(let a=1;a<e.length;a+=1){let o=e[a],c=e[r];(o.result.similarity<c.result.similarity||o.result.similarity===c.result.similarity&&o.order>c.order)&&(r=a)}let s=e[r];n.similarity<=s.result.similarity||(e[r]={result:n,order:i})}var Ee=["ScipDatabase#all","ScipDatabase#get","ScipDatabase#prepare","ScipDatabase#pathExclusionsFor","ScipDatabase#isIgnored","ScipDatabase#symbolNoiseFor","PerDbValue#get","PerDbValue#has",":storage:db:ScipDatabase:all",":storage:db:ScipDatabase:get",":storage:db:ScipDatabase:prepare",":storage:db:ScipDatabase:pathExclusionsFor",":storage:db:ScipDatabase:isIgnored",":storage:db:ScipDatabase:symbolNoiseFor",":storage:per-db-cache:PerDbValue:get",":storage:per-db-cache:PerDbValue:has"];function Be(e,n,t){let i=D(e,n);if(!i)return{kind:"not-callable"};if(!$(i.symbol))return{kind:"not-callable"};let r=new q(e),s=ne(e,i,{semantic:t.semantic,semanticEvidence:ie});return s.semanticIncomplete||s.semanticUnavailable?{kind:"callee-evidence-unusable"}:{kind:"resolved",target:{symbol:i.symbol,file:i.relativePath,callees:ge(s.rows.map(a=>a.symbol)),paramCount:r.callableSignature(i)?.paramCount??-1}}}var ze=z("callee-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),De=z("callee-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function de(e,n){let{minCallees:t,scope:i,excludeSymbol:r,scanLimit:s}=n,a=n.semantic!==!1,o=ze.get(e,()=>new Map),c=`${t}|${i??""}|${s??""}|${a}`,m=!0,g=0,f=0;return y("similar.callee-fingerprints.resolve",()=>{let l=o.get(c);if(m=l!==void 0,l||(l=Oe(e,{minCallees:t,scope:i,scanLimit:s,semantic:a}),o.set(c,l)),g=l.length,r===void 0)return l;let u=l.filter(d=>d.symbol!==r);return f=l.length-u.length,u},()=>({minCallees:t,scope:i,scanLimit:s,semantic:a,cacheHit:m,corpusSize:g,excludeSymbol:r!==void 0,excludedSymbols:f}))}function qe(e,n){let{minCallees:t,scope:i,scanLimit:r}=n,s=n.semantic!==!1,a=De.get(e,()=>new Map),o=`${t}|${i??""}|${r??""}|${s}`,c=!0,m=0,g=0,f=0;return y("similar.callee-index.resolve",()=>{let l=a.get(o);return c=l!==void 0,l||(l=Ne(de(e,{minCallees:t,scope:i,scanLimit:r,semantic:s})),a.set(o,l)),m=l.corpus.length,g=l.docFreq.size,f=l.candidateIndexesByCallee.size,l},()=>({minCallees:t,scope:i,scanLimit:r,semantic:s,cacheHit:c,corpusSize:m,indexedCallees:g,candidateBuckets:f}))}function G(e){return{calleeCorpus:n=>de(e,n),calleeIndex:n=>qe(e,n),sourceCorpus:(n={})=>Ce(e,n),sourceIndex:(n={})=>le(e,n),sourceCandidates:(n,t)=>(t.candidateMode??"full")==="target-pruned"?Qe(e,n,{minSimilarity:t.minSimilarity,scanLimit:t.scanLimit}):Ye(n,le(e,{scanLimit:t.scanLimit}))}}function Ne(e){let n=A(),t=0,i=y("similar.callee-index.doc-frequency",()=>{let l=new Map;for(let u of e)for(let d of u.callees)l.set(d,(l.get(d)??0)+1);return t=l.size,l},()=>({corpusSize:e.length,uniqueCallees:t})),r=Math.max(8,Math.ceil(Math.sqrt(e.length))),s=y("similar.callee-index.idf-weights",()=>V(i,e.length),()=>({corpusSize:e.length,uniqueCallees:i.size})),a=y("similar.callee-index.weighted-magnitudes",()=>e.map(l=>B(l.callees,s)),()=>({corpusSize:e.length})),o=0,c=0,m=0,g=y("similar.callee-index.candidate-buckets",()=>{let l=new Map;for(let u=0;u<e.length;u+=1){let d=e[u];for(let p of d.callees){if((i.get(p)??0)>r){n&&(c+=1);continue}let b=l.get(p);b||(b=[],l.set(p,b)),b.push(u),n&&(o+=1)}}return n&&(m=l.size),l},()=>({corpusSize:e.length,buckets:m,candidateRefs:o,ubiquitousSkips:c,ubiquityThreshold:r})),f=y("similar.callee-index.median-idf",()=>j(s),()=>({uniqueCallees:s.size}));return{corpus:e,candidateIndexesByCallee:g,docFreq:i,idfWeights:s,weightedMagnitudes:a,medianIdf:f,ubiquityThreshold:r}}function Pe(e,n){let t=new Map;for(let i of e.callees)for(let r of n.candidateIndexesByCallee.get(i)??[]){let s=n.corpus[r];s.symbol!==e.symbol&&t.set(s.symbol,s)}return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Oe(e,n){let{minCallees:t,scope:i,scanLimit:r,semantic:s}=n,a=A(),o=new q(e),c=0,m=y("similar.callee-fingerprints.candidates",()=>{let p=_(o.productionCallableDefinitions({scope:i,minLoc:5,sortByLocDesc:typeof r=="number"&&r>0}),r);return c=p.length,p},()=>({scope:i,scanLimit:r,candidateCount:c})),g=0,f=y("similar.callee-fingerprints.callee-map",()=>{let p=o.calleeEvidenceMap(m,{semantic:s});if(a)for(let b of p.rows.values())g+=b.length;return p},()=>({candidateCount:c,semantic:s,calleeEdges:g})),l=0,u=0,d=0;return y("similar.callee-fingerprints.shape",()=>{let b=m.filter(S=>!f.incompleteSymbolIds.has(S.symbolId)&&!f.unavailableSymbolIds.has(S.symbolId)).map(S=>({symbol:S.symbol,file:S.relativePath,callees:ge((f.rows.get(S.symbolId)??[]).map(F=>F.symbol)),paramCount:o.callableSignature(S)?.paramCount??-1})),C=$e(b);a&&(d=C.filter((S,F)=>S.callees.size!==b[F].callees.size).length);let h=C.filter(S=>S.callees.size>=t);return l=h.length,a&&(u=h.reduce((S,F)=>S+F.callees.size,0)),h},()=>({candidateCount:c,fingerprintCount:l,retainedCalleeCount:u,minCallees:t,siblingSaturatedFingerprints:d}))}var fe=5;function $e(e){let n=new Map;for(let t of e){let i=n.get(t.file);i||(i=new Map,n.set(t.file,i));for(let r of t.callees)i.set(r,(i.get(r)??0)+1)}return e.map(t=>{let i=n.get(t.file);if(!i)return t;let r=[...t.callees].filter(a=>(i.get(a)??0)>=fe);if(r.length===0)return t;let s=new Set(t.callees);for(let a of r)s.delete(a);return{...t,callees:s}})}function _e(e,n){let t=new Map;for(let s of n)if(!(s.file!==e.file||s.symbol===e.symbol))for(let a of s.callees)t.set(a,(t.get(a)??0)+1);let i=[...e.callees].filter(s=>(t.get(s)??0)+1>=fe);if(i.length===0)return e;let r=new Set(e.callees);for(let s of i)r.delete(s);return{...e,callees:r}}function ge(e){return new Set([...e].filter(n=>!je(n)))}function je(e){return Ee.some(n=>e.includes(n))}function Ge(e,n,t){let i=Ve(e,n);if(!i||i.tokens.size<3)return[];let r=t.minSimilarity>=.5?t.minSimilarity:.3,s=[],a=t.candidateMode??"full",o=0,c=0,m=0,g=0;return y("similar.source-shape",()=>{let l=G(e).sourceCandidates(i,{minSimilarity:r,scanLimit:t.scanLimit,candidateMode:a});o=l.length;for(let u of l){if(u.symbol===i.symbol||u.tokens.size<3)continue;c+=1;let d=te(i.tokens,u.tokens);if(d.size<2){m+=1;continue}let p=new Set([...i.tokens,...u.tokens]),b=p.size>0?d.size/p.size:0;if(b<r){g+=1;continue}s.push({symbolA:i.symbol,shortNameA:v(i.symbol),fileA:i.file,symbolB:u.symbol,shortNameB:v(u.symbol),fileB:u.file,similarity:b,similarityBasis:"source-tokens",sharedCallees:[...d].sort(),uniqueToA:[...N(i.tokens,u.tokens)].sort(),uniqueToB:[...N(u.tokens,i.tokens)].sort(),...pe([...d],"source-tokens")})}return s.sort((u,d)=>d.similarity-u.similarity||u.shortNameB.localeCompare(d.shortNameB)),s.slice(0,t.limit)},()=>({symbol:i.symbol,file:i.file,targetTokens:i.tokens.size,candidateMode:a,candidates:o,comparedPairs:c,sharedSkips:m,similaritySkips:g,results:s.length}))}function pe(e,n){let t=e.flatMap(W),i=e.flatMap(b=>ae(b,n)),r=Z(t,be),s=Z(t,Se),a=Z(i,X),o=[...new Set(i.filter(oe))],c=e.filter(b=>{let C=ae(b,n);return C.some(h=>X.has(h))&&C.some(oe)}).length,m=[];r.length>0&&m.push(`access/query scaffolding: ${r.slice(0,5).join(", ")}`),s.length>0&&m.push(`framework/generic scaffolding: ${s.slice(0,5).join(", ")}`),a.length>0&&m.push(`domain behavior verbs: ${a.slice(0,5).join(", ")}`),a.length>0&&o.length>0&&m.push(`domain-specific terms: ${o.slice(0,5).join(", ")}`);let g=n==="source-tokens"&&t.length>0&&t.every(b=>ye.has(b));g&&m.push("shared source tokens are generic scaffolding");let f=a.length>0&&o.length>0,l=r.length+s.length>0,u=n==="callees"&&f&&e.length>=4&&o.length>=4&&c>=2,d=u?"domain-behavior":f?l?"mixed":"domain-behavior":r.length>0?"access-query-scaffolding":s.length>0||g?"framework-scaffolding":"structural-overlap";d==="structural-overlap"&&e.length>0&&m.push(`shared ${n} overlap has no recognized domain or scaffolding category`);let p=d==="domain-behavior"&&(e.length>=3||u)?"direct":"signal";return{evidenceClass:d,actionTier:p,evidenceClassReasons:m,recommendation:Ue(d,p)}}function Ue(e,n){return n==="direct"?"Shared domain behavior looks concrete; review for an extract/reuse opportunity.":e==="mixed"?"Shared evidence mixes domain behavior with scaffolding; review semantics before extracting anything.":e==="access-query-scaffolding"?"Shared evidence is mostly access/query scaffolding; compare product semantics before reusing code.":e==="structural-overlap"?"Shared structure has no domain or scaffolding classification; inspect names and behavior before reusing code.":"Shared evidence is mostly framework or generic scaffolding; treat as a contextual signal."}function Z(e,n){return[...new Set(e.filter(t=>n.has(t)))]}function W(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1)}function ae(e,n){if(n==="source-tokens")return W(e);let t=K(e);return W(t.length>0?t:He(e))}function He(e){return e.replace(/[()`]/g," ").replace(/\.[a-z][a-z0-9]+(?=\s|$)/gi," ").split(/[:/\\\s]+/).map(i=>i.trim()).filter(i=>/[A-Za-z]/.test(i)).at(-1)?.replace(/\.$/,"")??e}function oe(e){return e.length>3&&!X.has(e)&&!be.has(e)&&!Se.has(e)&&!ye.has(e)&&!Ke.has(e)}var X=new Set(["archive","assign","book","cancel","create","delete","ensure","export","import","notify","persist","publish","restore","schedule","send","set","submit","sync","update","upload","validate","write"]),be=new Set(["access","auth","authorize","cache","context","db","find","get","guard","list","permission","permissions","prisma","query","request","response","role","route","session","sql","where"]),Se=new Set(["bytes","computed","crypto","describe","effect","expect","fetch","filter","hex","hook","json","map","mounted","on","promise","random","react","reduce","ref","render","state","test","token","trim","uuid","vue","watch"]),ye=new Set(["bytes","crypto","data","false","get","hex","id","key","map","name","num","random","result","secret","set","string","to","token","true","type","value"]),Ke=new Set(["best","backend","conflict","database","effect","effects","error","errors","frontend","found","helpers","javascript","module","modules","scip","shared","source","typescript","utils","with","workflow","workflows"]);function Ve(e,n){let t=D(e,n);if(!t||!$(t.symbol))return null;let i=Ze(e,t);return i?{symbol:t.symbol,file:t.relativePath,tokens:i}:null}function Ze(e,n){let t=K(n.symbol),i=sn(e,n.relativePath,n.startLine,n.endLine,t),r=ke(i,t);return r.size>0?r:null}var We=z("source-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),Xe=z("source-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function he(e){return`${e.scanLimit??""}`}function Ce(e,n={}){let t=We.get(e,()=>new Map),i=he(n),r=t.get(i);return r||(r=rn(e,n),t.set(i,r)),r}function le(e,n={}){let t=Xe.get(e,()=>new Map),i=he(n),r=t.get(i);return r||(r=Je(Ce(e,n)),t.set(i,r)),r}function Je(e){let n=new Map;for(let r of e)for(let s of r.tokens)n.set(s,(n.get(s)??0)+1);let t=Math.max(8,Math.ceil(Math.sqrt(e.length))),i=new Map;for(let r of e)for(let s of r.tokens){if((n.get(s)??0)>t)continue;let a=i.get(s);a||(a=[],i.set(s,a)),a.push(r)}return{corpus:e,candidateByToken:i,docFreq:n,ubiquityThreshold:t}}function Ye(e,n){let t=new Map;for(let i of e.tokens)for(let r of n.candidateByToken.get(i)??[])r.symbol!==e.symbol&&t.set(r.symbol,r);return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Qe(e,n,t){let i=A(),r=new q(e),s=en(n.tokens.size,t.minSimilarity),a=0,o=0,c=0,m=y("similar.source-shape.target-files",()=>{let d=[...n.tokens],p=[];for(let b of Y(e,{includeIgnored:!1})){a+=1;let C=U(e,b);C&&(o+=1,nn(C,d,s)&&p.push(b))}return c=p.length,p},()=>({symbol:n.symbol,targetTokens:n.tokens.size,requiredSharedTokens:s,scannedFiles:a,readableFiles:o,candidateFiles:c})),g=0,f=y("similar.source-shape.target-definitions",()=>{let d=_(r.productionCallableDefinitions({files:m,sortByLocDesc:typeof t.scanLimit=="number"&&t.scanLimit>0}),t.scanLimit);return g=d.length,d},()=>({symbol:n.symbol,candidateFiles:c,scanLimit:t.scanLimit,definitionCount:g})),l=0;return y("similar.source-shape.target-fingerprints",()=>{let d=Fe(e,f);return i&&(l=d.length),d},()=>({symbol:n.symbol,definitionCount:g,fingerprintCount:l})).filter(d=>d.symbol!==n.symbol)}function en(e,n){return Math.max(2,Math.ceil(e*n))}function nn(e,n,t){if(n.length<t)return!1;let i=e.toLowerCase(),r=0;for(let s of n)if(tn(i,s)&&(r+=1,r>=t))return!0;return!1}function tn(e,n){return n==="num"?/\b\d+\b/.test(e):e.includes(n)}function rn(e,n={}){let t=new q(e),{scanLimit:i}=n,r=_(t.productionCallableDefinitions({sortByLocDesc:typeof i=="number"&&i>0}),i);return Fe(e,r)}function Fe(e,n){let t=new Map;for(let r of n){let s=t.get(r.relativePath)??[];s.push(r),t.set(r.relativePath,s)}let i=new Map;for(let[r,s]of t){let a=U(e,r);if(!a)continue;let o=J(e,r,a),c=on(e,r,o),m=!1,g=null;for(let f of s){let l=an(f),u=c.get(l),d=u?new Set(u.tokens):null;d||(g??=H(e,r),d=ke(xe(g,f.startLine,f.endLine,f.leaf),f.leaf),c.set(l,{key:l,symbol:f.symbol,startLine:f.startLine,endLine:f.endLine,leaf:f.leaf,tokens:[...d].sort()}),m=!0),d.size>0&&i.set(f.symbol,{symbol:f.symbol,file:f.relativePath,tokens:d})}m&&un(e,r,o,c)}return n.map(r=>i.get(r.symbol)).filter(r=>!!r)}function sn(e,n,t,i,r){let s=H(e,n);return s.length===0?"":xe(s,t,i,r)}function xe(e,n,t,i){if(t>=n&&t-n<=12)return e.slice(n,t+1).join(`
1
+ import{a as te,b as N,e as V,f as j,g as B,h as re,i as se}from"./chunk-NMTSZXCL.js";import{b as _}from"./chunk-B75HZHUP.js";import{c as q}from"./chunk-NK76RSB6.js";import{a as ie}from"./chunk-OJFLPVBP.js";import{b as ne}from"./chunk-57KEZDPT.js";import{a as D}from"./chunk-3XFJUWJE.js";import{d as v,e as K,h as $}from"./chunk-AM5SUGHF.js";import{a as E}from"./chunk-JOALNFY3.js";import{a as Y}from"./chunk-RVYLJDXC.js";import{h as z,l as J,t as Q,v as ee,w as U,x as H}from"./chunk-PLZXWZHY.js";import{a as A,d as y}from"./chunk-3LCDIREB.js";function Ie(e,n,t={}){let{minSimilarity:i=.4,limit:r=20}=t,s=()=>Ge(e,n,{minSimilarity:i,limit:r,scanLimit:t.scanLimit,candidateMode:t.sourceCandidateMode??"full"}),a=Be(e,n,{semantic:t.semantic!==!1});if(a.kind==="not-callable")return[];if(a.kind==="callee-evidence-unusable")return s();let o=a.target;if(!$(o.symbol))return[];if(o.callees.size===0)return s();let c=we(e,o,i,{scanLimit:t.scanLimit,semantic:t.semantic!==!1});return c.length>0?c.slice(0,r):s()}function Tn(e,n,t,i={}){let r=D(e,n),s=D(e,t);if(!r||!s)return null;let a=Ie(e,r.symbol,{minSimilarity:0,limit:Number.POSITIVE_INFINITY,semantic:i.semantic,scanLimit:i.scanLimit}).find(m=>m.symbolB===s.symbol||m.symbolA===s.symbol);if(!a)return null;let o=r.endLine-r.startLine+1,c=s.endLine-s.startLine+1;return{symbolA:{symbol:r.symbol,shortName:v(r.symbol),file:r.relativePath,loc:o},symbolB:{symbol:s.symbol,shortName:v(s.symbol),file:s.relativePath,loc:c},similarity:a.similarity,similarityBasis:a.similarityBasis??"callees",sharedEvidence:a.sharedCallees,uniqueToA:a.uniqueToA,uniqueToB:a.uniqueToB,evidenceClass:a.evidenceClass,actionTier:a.actionTier,recommendation:a.recommendation,consolidationStrategy:ve(a)}}function ve(e){let n=e.similarityBasis==="source-tokens"?"source-token":"tracked callee";return e.sharedCallees.length===0?`No shared ${n} evidence survived similar's weighting. Inspect the source before attempting consolidation.`:e.uniqueToA.length===0&&e.uniqueToB.length===0?`The functions have identical ${n} evidence under similar's weighting. Verify signatures, guards, and return values before consolidating.`:e.uniqueToA.length===0?`A's ${n} evidence is a subset of B's. B may subsume part of A's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToB.length===0?`B's ${n} evidence is a subset of A's. A may subsume part of B's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToA.length<=2&&e.uniqueToB.length<=2?`Create a shared helper around the ${e.sharedCallees.length} shared ${n}(s). Pass the ${e.uniqueToA.length+e.uniqueToB.length} divergent point(s) as parameters or callbacks.`:`Extract the ${e.sharedCallees.length} shared ${n}(s) into a common helper. Keep each function's unique logic outside that helper (${e.uniqueToA.length} item(s) in A, ${e.uniqueToB.length} in B).`}function we(e,n,t,i){let r=G(e).calleeIndex({minCallees:3,scanLimit:i.scanLimit,semantic:i.semantic}),s=_e(n,r.corpus),a=Pe(s,r),o=Te(s,r),c=j(o),m=B(s.callees,o),g=[];for(let f of a){if(f.callees.size<3)continue;let l=B(f.callees,o),u=ce(s,f,o,{minSimilarity:t,requireSignificantShared:1,requireSharedCount:0,medianIdf:c,magnitudeA:m,magnitudeB:l});u&&g.push(u)}return g.sort((f,l)=>l.similarity-f.similarity),g}function Te(e,n){let t=new Map(n.docFreq);for(let i of e.callees)t.set(i,(t.get(i)??0)+1);return V(t,n.corpus.length+1)}function ce(e,n,t,i){let r=Le(e,n,t,i);if(!Re(r,i))return null;let{similarity:s,significantShared:a,trivialShared:o}=r,c=a.length>0?a:o,m=pe(c,"callees");return{symbolA:e.symbol,shortNameA:v(e.symbol),fileA:e.file,symbolB:n.symbol,shortNameB:v(n.symbol),fileB:n.file,similarity:s,similarityBasis:"callees",sharedCallees:c.map(v),uniqueToA:[...N(e.callees,n.callees)].map(v),uniqueToB:[...N(n.callees,e.callees)].map(v),...m}}function Me(e,n,t,i){let r=i.magnitudeA??B(e.callees,t),s=i.magnitudeB??B(n.callees,t),a=0,o=0,c=0,m=i.medianIdf??j(t);for(let l of e.callees){if(!n.callees.has(l))continue;let u=t.get(l)??0;a+=u*u,c+=1,u>=m&&(o+=1)}if(c===0)return!1;let g=r*s;return(g>0?a/g:0)<i.minSimilarity?!1:o>=i.requireSignificantShared||c>=i.requireSharedCount}function Le(e,n,t,i){return i.magnitudeA===void 0||i.magnitudeB===void 0?re(e.callees,n.callees,t,{medianIdf:i.medianIdf}):se(e.callees,n.callees,t,{medianIdf:i.medianIdf,magnitudeA:i.magnitudeA,magnitudeB:i.magnitudeB})}function Re(e,n){if(e.similarity<n.minSimilarity)return!1;let t=e.significantShared.length+e.trivialShared.length;return e.significantShared.length>=n.requireSignificantShared||t>=n.requireSharedCount}function Mn(e,n={}){let{minSimilarity:t=.5,limit:i=20,scope:r,minCallees:s=4,crossFileOnly:a=!1,scanLimit:o}=n,c=n.semantic!==!1,m=A(),g=0,f=0,l=0,u=0,d=0,p=0,b=0;return y("similar.all",()=>{let h=G(e).calleeIndex({minCallees:s,scope:r,scanLimit:o,semantic:c}),S=h.corpus;g=S.length;let F=n.focusFiles,I=[],P=0;return y("similar.all.pair-scan",()=>{for(let k=0;k<S.length;k+=1){let x=S[k],M=F?.has(x.file)??!1,w=h.weightedMagnitudes[k],T=new Set;for(let O of x.callees){let L=h.candidateIndexesByCallee.get(O);if(L)for(let R of L)R<=k||F&&!M&&!F.has(S[R].file)||T.add(R)}m&&(l+=T.size,T.size>0&&(f+=1));for(let O of T){let L=S[O];if(a&&x.file===L.file){m&&(d+=1);continue}if(ue(x,L)){m&&(p+=1);continue}m&&(u+=1);let R=ce(x,L,h.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:h.medianIdf,magnitudeA:w,magnitudeB:h.weightedMagnitudes[O]});R&&(Ae(I,R,i,P),m&&(b+=1),P+=1)}}},()=>({corpusSize:g,candidateSets:f,candidatePairs:l,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:b,topResults:I.length})),y("similar.all.sort-project",()=>(I.sort((k,x)=>x.result.similarity-k.result.similarity||k.order-x.order),I.map(k=>k.result)),()=>({topResults:I.length}))},()=>({minSimilarity:t,limit:i,scope:r,minCallees:s,crossFileOnly:a,scanLimit:o,semantic:c,corpusSize:g,candidateSets:f,candidatePairs:l,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:b}))}function Ln(e,n={}){let{minSimilarity:t=.5,scope:i,minCallees:r=4,crossFileOnly:s=!1,scanLimit:a}=n,o=n.semantic!==!1,c=A(),m=0,g=0,f=0,l=0,u=0,d=0,p=0;return y("similar.all-count",()=>{let C=G(e).calleeIndex({minCallees:r,scope:i,scanLimit:a,semantic:o}),h=C.corpus;m=h.length;let S=n.focusFiles;return y("similar.all-count.pair-scan",()=>{for(let F=0;F<h.length;F+=1){let I=h[F],P=S?.has(I.file)??!1,k=C.weightedMagnitudes[F],x=new Set;for(let M of I.callees){let w=C.candidateIndexesByCallee.get(M);if(w)for(let T of w)T<=F||S&&!P&&!S.has(h[T].file)||x.add(T)}c&&(f+=x.size,x.size>0&&(g+=1));for(let M of x){let w=h[M];if(s&&I.file===w.file){c&&(u+=1);continue}if(ue(I,w)){c&&(d+=1);continue}c&&(l+=1),Me(I,w,C.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:C.medianIdf,magnitudeA:k,magnitudeB:C.weightedMagnitudes[M]})&&(p+=1)}}},()=>({corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:l,crossFileSkips:u,signatureSkips:d,insertedResults:p})),p},()=>({minSimilarity:t,scope:i,minCallees:r,crossFileOnly:s,scanLimit:a,semantic:o,corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:l,crossFileSkips:u,signatureSkips:d,insertedResults:p}))}function ue(e,n){if(e.paramCount<0||n.paramCount<0)return!1;let t=Math.abs(e.paramCount-n.paramCount),i=Math.max(2,Math.ceil(Math.max(e.paramCount,n.paramCount)*.5));return t>i}var me=Q({kind:"source-fingerprints",invalidation:ee("source-fingerprints"),serialize:cn,deserialize:ln});function Ae(e,n,t,i){if(t<=0)return;if(e.length<t){e.push({result:n,order:i});return}let r=0;for(let a=1;a<e.length;a+=1){let o=e[a],c=e[r];(o.result.similarity<c.result.similarity||o.result.similarity===c.result.similarity&&o.order>c.order)&&(r=a)}let s=e[r];n.similarity<=s.result.similarity||(e[r]={result:n,order:i})}var Ee=["ScipDatabase#all","ScipDatabase#get","ScipDatabase#prepare","ScipDatabase#pathExclusionsFor","ScipDatabase#isIgnored","ScipDatabase#symbolNoiseFor","PerDbValue#get","PerDbValue#has",":storage:db:ScipDatabase:all",":storage:db:ScipDatabase:get",":storage:db:ScipDatabase:prepare",":storage:db:ScipDatabase:pathExclusionsFor",":storage:db:ScipDatabase:isIgnored",":storage:db:ScipDatabase:symbolNoiseFor",":storage:per-db-cache:PerDbValue:get",":storage:per-db-cache:PerDbValue:has"];function Be(e,n,t){let i=D(e,n);if(!i)return{kind:"not-callable"};if(!$(i.symbol))return{kind:"not-callable"};let r=new q(e),s=ne(e,i,{semantic:t.semantic,semanticEvidence:ie});return s.semanticIncomplete||s.semanticUnavailable?{kind:"callee-evidence-unusable"}:{kind:"resolved",target:{symbol:i.symbol,file:i.relativePath,callees:ge(s.rows.map(a=>a.symbol)),paramCount:r.callableSignature(i)?.paramCount??-1}}}var ze=z("callee-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),De=z("callee-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function de(e,n){let{minCallees:t,scope:i,excludeSymbol:r,scanLimit:s}=n,a=n.semantic!==!1,o=ze.get(e,()=>new Map),c=`${t}|${i??""}|${s??""}|${a}`,m=!0,g=0,f=0;return y("similar.callee-fingerprints.resolve",()=>{let l=o.get(c);if(m=l!==void 0,l||(l=Oe(e,{minCallees:t,scope:i,scanLimit:s,semantic:a}),o.set(c,l)),g=l.length,r===void 0)return l;let u=l.filter(d=>d.symbol!==r);return f=l.length-u.length,u},()=>({minCallees:t,scope:i,scanLimit:s,semantic:a,cacheHit:m,corpusSize:g,excludeSymbol:r!==void 0,excludedSymbols:f}))}function qe(e,n){let{minCallees:t,scope:i,scanLimit:r}=n,s=n.semantic!==!1,a=De.get(e,()=>new Map),o=`${t}|${i??""}|${r??""}|${s}`,c=!0,m=0,g=0,f=0;return y("similar.callee-index.resolve",()=>{let l=a.get(o);return c=l!==void 0,l||(l=Ne(de(e,{minCallees:t,scope:i,scanLimit:r,semantic:s})),a.set(o,l)),m=l.corpus.length,g=l.docFreq.size,f=l.candidateIndexesByCallee.size,l},()=>({minCallees:t,scope:i,scanLimit:r,semantic:s,cacheHit:c,corpusSize:m,indexedCallees:g,candidateBuckets:f}))}function G(e){return{calleeCorpus:n=>de(e,n),calleeIndex:n=>qe(e,n),sourceCorpus:(n={})=>Ce(e,n),sourceIndex:(n={})=>le(e,n),sourceCandidates:(n,t)=>(t.candidateMode??"full")==="target-pruned"?Qe(e,n,{minSimilarity:t.minSimilarity,scanLimit:t.scanLimit}):Ye(n,le(e,{scanLimit:t.scanLimit}))}}function Ne(e){let n=A(),t=0,i=y("similar.callee-index.doc-frequency",()=>{let l=new Map;for(let u of e)for(let d of u.callees)l.set(d,(l.get(d)??0)+1);return t=l.size,l},()=>({corpusSize:e.length,uniqueCallees:t})),r=Math.max(8,Math.ceil(Math.sqrt(e.length))),s=y("similar.callee-index.idf-weights",()=>V(i,e.length),()=>({corpusSize:e.length,uniqueCallees:i.size})),a=y("similar.callee-index.weighted-magnitudes",()=>e.map(l=>B(l.callees,s)),()=>({corpusSize:e.length})),o=0,c=0,m=0,g=y("similar.callee-index.candidate-buckets",()=>{let l=new Map;for(let u=0;u<e.length;u+=1){let d=e[u];for(let p of d.callees){if((i.get(p)??0)>r){n&&(c+=1);continue}let b=l.get(p);b||(b=[],l.set(p,b)),b.push(u),n&&(o+=1)}}return n&&(m=l.size),l},()=>({corpusSize:e.length,buckets:m,candidateRefs:o,ubiquitousSkips:c,ubiquityThreshold:r})),f=y("similar.callee-index.median-idf",()=>j(s),()=>({uniqueCallees:s.size}));return{corpus:e,candidateIndexesByCallee:g,docFreq:i,idfWeights:s,weightedMagnitudes:a,medianIdf:f,ubiquityThreshold:r}}function Pe(e,n){let t=new Map;for(let i of e.callees)for(let r of n.candidateIndexesByCallee.get(i)??[]){let s=n.corpus[r];s.symbol!==e.symbol&&t.set(s.symbol,s)}return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Oe(e,n){let{minCallees:t,scope:i,scanLimit:r,semantic:s}=n,a=A(),o=new q(e),c=0,m=y("similar.callee-fingerprints.candidates",()=>{let p=_(o.productionCallableDefinitions({scope:i,minLoc:5,sortByLocDesc:typeof r=="number"&&r>0}),r);return c=p.length,p},()=>({scope:i,scanLimit:r,candidateCount:c})),g=0,f=y("similar.callee-fingerprints.callee-map",()=>{let p=o.calleeEvidenceMap(m,{semantic:s});if(a)for(let b of p.rows.values())g+=b.length;return p},()=>({candidateCount:c,semantic:s,calleeEdges:g})),l=0,u=0,d=0;return y("similar.callee-fingerprints.shape",()=>{let b=m.filter(S=>!f.incompleteSymbolIds.has(S.symbolId)&&!f.unavailableSymbolIds.has(S.symbolId)).map(S=>({symbol:S.symbol,file:S.relativePath,callees:ge((f.rows.get(S.symbolId)??[]).map(F=>F.symbol)),paramCount:o.callableSignature(S)?.paramCount??-1})),C=$e(b);a&&(d=C.filter((S,F)=>S.callees.size!==b[F].callees.size).length);let h=C.filter(S=>S.callees.size>=t);return l=h.length,a&&(u=h.reduce((S,F)=>S+F.callees.size,0)),h},()=>({candidateCount:c,fingerprintCount:l,retainedCalleeCount:u,minCallees:t,siblingSaturatedFingerprints:d}))}var fe=5;function $e(e){let n=new Map;for(let t of e){let i=n.get(t.file);i||(i=new Map,n.set(t.file,i));for(let r of t.callees)i.set(r,(i.get(r)??0)+1)}return e.map(t=>{let i=n.get(t.file);if(!i)return t;let r=[...t.callees].filter(a=>(i.get(a)??0)>=fe);if(r.length===0)return t;let s=new Set(t.callees);for(let a of r)s.delete(a);return{...t,callees:s}})}function _e(e,n){let t=new Map;for(let s of n)if(!(s.file!==e.file||s.symbol===e.symbol))for(let a of s.callees)t.set(a,(t.get(a)??0)+1);let i=[...e.callees].filter(s=>(t.get(s)??0)+1>=fe);if(i.length===0)return e;let r=new Set(e.callees);for(let s of i)r.delete(s);return{...e,callees:r}}function ge(e){return new Set([...e].filter(n=>!je(n)))}function je(e){return Ee.some(n=>e.includes(n))}function Ge(e,n,t){let i=Ve(e,n);if(!i||i.tokens.size<3)return[];let r=t.minSimilarity>=.5?t.minSimilarity:.3,s=[],a=t.candidateMode??"full",o=0,c=0,m=0,g=0;return y("similar.source-shape",()=>{let l=G(e).sourceCandidates(i,{minSimilarity:r,scanLimit:t.scanLimit,candidateMode:a});o=l.length;for(let u of l){if(u.symbol===i.symbol||u.tokens.size<3)continue;c+=1;let d=te(i.tokens,u.tokens);if(d.size<2){m+=1;continue}let p=new Set([...i.tokens,...u.tokens]),b=p.size>0?d.size/p.size:0;if(b<r){g+=1;continue}s.push({symbolA:i.symbol,shortNameA:v(i.symbol),fileA:i.file,symbolB:u.symbol,shortNameB:v(u.symbol),fileB:u.file,similarity:b,similarityBasis:"source-tokens",sharedCallees:[...d].sort(),uniqueToA:[...N(i.tokens,u.tokens)].sort(),uniqueToB:[...N(u.tokens,i.tokens)].sort(),...pe([...d],"source-tokens")})}return s.sort((u,d)=>d.similarity-u.similarity||u.shortNameB.localeCompare(d.shortNameB)),s.slice(0,t.limit)},()=>({symbol:i.symbol,file:i.file,targetTokens:i.tokens.size,candidateMode:a,candidates:o,comparedPairs:c,sharedSkips:m,similaritySkips:g,results:s.length}))}function pe(e,n){let t=e.flatMap(W),i=e.flatMap(b=>ae(b,n)),r=Z(t,be),s=Z(t,Se),a=Z(i,X),o=[...new Set(i.filter(oe))],c=e.filter(b=>{let C=ae(b,n);return C.some(h=>X.has(h))&&C.some(oe)}).length,m=[];r.length>0&&m.push(`access/query scaffolding: ${r.slice(0,5).join(", ")}`),s.length>0&&m.push(`framework/generic scaffolding: ${s.slice(0,5).join(", ")}`),a.length>0&&m.push(`domain behavior verbs: ${a.slice(0,5).join(", ")}`),a.length>0&&o.length>0&&m.push(`domain-specific terms: ${o.slice(0,5).join(", ")}`);let g=n==="source-tokens"&&t.length>0&&t.every(b=>ye.has(b));g&&m.push("shared source tokens are generic scaffolding");let f=a.length>0&&o.length>0,l=r.length+s.length>0,u=n==="callees"&&f&&e.length>=4&&o.length>=4&&c>=2,d=u?"domain-behavior":f?l?"mixed":"domain-behavior":r.length>0?"access-query-scaffolding":s.length>0||g?"framework-scaffolding":"structural-overlap";d==="structural-overlap"&&e.length>0&&m.push(`shared ${n} overlap has no recognized domain or scaffolding category`);let p=d==="domain-behavior"&&(e.length>=3||u)?"direct":"signal";return{evidenceClass:d,actionTier:p,evidenceClassReasons:m,recommendation:Ue(d,p)}}function Ue(e,n){return n==="direct"?"Shared domain behavior looks concrete; review for an extract/reuse opportunity.":e==="mixed"?"Shared evidence mixes domain behavior with scaffolding; review semantics before extracting anything.":e==="access-query-scaffolding"?"Shared evidence is mostly access/query scaffolding; compare product semantics before reusing code.":e==="structural-overlap"?"Shared structure has no domain or scaffolding classification; inspect names and behavior before reusing code.":"Shared evidence is mostly framework or generic scaffolding; treat as a contextual signal."}function Z(e,n){return[...new Set(e.filter(t=>n.has(t)))]}function W(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1)}function ae(e,n){if(n==="source-tokens")return W(e);let t=K(e);return W(t.length>0?t:He(e))}function He(e){return e.replace(/[()`]/g," ").replace(/\.[a-z][a-z0-9]+(?=\s|$)/gi," ").split(/[:/\\\s]+/).map(i=>i.trim()).filter(i=>/[A-Za-z]/.test(i)).at(-1)?.replace(/\.$/,"")??e}function oe(e){return e.length>3&&!X.has(e)&&!be.has(e)&&!Se.has(e)&&!ye.has(e)&&!Ke.has(e)}var X=new Set(["archive","assign","book","cancel","create","delete","ensure","export","import","notify","persist","publish","restore","schedule","send","set","submit","sync","update","upload","validate","write"]),be=new Set(["access","auth","authorize","cache","context","db","find","get","guard","list","permission","permissions","prisma","query","request","response","role","route","session","sql","where"]),Se=new Set(["bytes","computed","crypto","describe","effect","expect","fetch","filter","hex","hook","json","map","mounted","on","promise","random","react","reduce","ref","render","state","test","token","trim","uuid","vue","watch"]),ye=new Set(["bytes","crypto","data","false","get","hex","id","key","map","name","num","random","result","secret","set","string","to","token","true","type","value"]),Ke=new Set(["best","backend","conflict","database","effect","effects","error","errors","frontend","found","helpers","javascript","module","modules","scip","shared","source","typescript","utils","with","workflow","workflows"]);function Ve(e,n){let t=D(e,n);if(!t||!$(t.symbol))return null;let i=Ze(e,t);return i?{symbol:t.symbol,file:t.relativePath,tokens:i}:null}function Ze(e,n){let t=K(n.symbol),i=sn(e,n.relativePath,n.startLine,n.endLine,t),r=ke(i,t);return r.size>0?r:null}var We=z("source-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),Xe=z("source-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function he(e){return`${e.scanLimit??""}`}function Ce(e,n={}){let t=We.get(e,()=>new Map),i=he(n),r=t.get(i);return r||(r=rn(e,n),t.set(i,r)),r}function le(e,n={}){let t=Xe.get(e,()=>new Map),i=he(n),r=t.get(i);return r||(r=Je(Ce(e,n)),t.set(i,r)),r}function Je(e){let n=new Map;for(let r of e)for(let s of r.tokens)n.set(s,(n.get(s)??0)+1);let t=Math.max(8,Math.ceil(Math.sqrt(e.length))),i=new Map;for(let r of e)for(let s of r.tokens){if((n.get(s)??0)>t)continue;let a=i.get(s);a||(a=[],i.set(s,a)),a.push(r)}return{corpus:e,candidateByToken:i,docFreq:n,ubiquityThreshold:t}}function Ye(e,n){let t=new Map;for(let i of e.tokens)for(let r of n.candidateByToken.get(i)??[])r.symbol!==e.symbol&&t.set(r.symbol,r);return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Qe(e,n,t){let i=A(),r=new q(e),s=en(n.tokens.size,t.minSimilarity),a=0,o=0,c=0,m=y("similar.source-shape.target-files",()=>{let d=[...n.tokens],p=[];for(let b of Y(e,{includeIgnored:!1})){a+=1;let C=U(e,b);C&&(o+=1,nn(C,d,s)&&p.push(b))}return c=p.length,p},()=>({symbol:n.symbol,targetTokens:n.tokens.size,requiredSharedTokens:s,scannedFiles:a,readableFiles:o,candidateFiles:c})),g=0,f=y("similar.source-shape.target-definitions",()=>{let d=_(r.productionCallableDefinitions({files:m,sortByLocDesc:typeof t.scanLimit=="number"&&t.scanLimit>0}),t.scanLimit);return g=d.length,d},()=>({symbol:n.symbol,candidateFiles:c,scanLimit:t.scanLimit,definitionCount:g})),l=0;return y("similar.source-shape.target-fingerprints",()=>{let d=Fe(e,f);return i&&(l=d.length),d},()=>({symbol:n.symbol,definitionCount:g,fingerprintCount:l})).filter(d=>d.symbol!==n.symbol)}function en(e,n){return Math.max(2,Math.ceil(e*n))}function nn(e,n,t){if(n.length<t)return!1;let i=e.toLowerCase(),r=0;for(let s of n)if(tn(i,s)&&(r+=1,r>=t))return!0;return!1}function tn(e,n){return n==="num"?/\b\d+\b/.test(e):e.includes(n)}function rn(e,n={}){let t=new q(e),{scanLimit:i}=n,r=_(t.productionCallableDefinitions({sortByLocDesc:typeof i=="number"&&i>0}),i);return Fe(e,r)}function Fe(e,n){let t=new Map;for(let r of n){let s=t.get(r.relativePath)??[];s.push(r),t.set(r.relativePath,s)}let i=new Map;for(let[r,s]of t){let a=U(e,r);if(!a)continue;let o=J(e,r,a),c=on(e,r,o),m=!1,g=null;for(let f of s){let l=an(f),u=c.get(l),d=u?new Set(u.tokens):null;d||(g??=H(e,r),d=ke(xe(g,f.startLine,f.endLine,f.leaf),f.leaf),c.set(l,{key:l,symbol:f.symbol,startLine:f.startLine,endLine:f.endLine,leaf:f.leaf,tokens:[...d].sort()}),m=!0),d.size>0&&i.set(f.symbol,{symbol:f.symbol,file:f.relativePath,tokens:d})}m&&un(e,r,o,c)}return n.map(r=>i.get(r.symbol)).filter(r=>!!r)}function sn(e,n,t,i,r){let s=H(e,n);return s.length===0?"":xe(s,t,i,r)}function xe(e,n,t,i){if(t>=n&&t-n<=12)return e.slice(n,t+1).join(`
2
2
  `);let r=[new RegExp(`\\bdef\\s+${E(i)}\\b`),new RegExp(`\\bfun\\s+${E(i)}\\b`),new RegExp(`\\bfn\\s+${E(i)}\\b`),new RegExp(`\\bfunction\\s+${E(i)}\\b`),new RegExp(`\\b${E(i)}\\s*\\(`)],s=e.findIndex(a=>r.some(o=>o.test(a)));if(s>=0){let a=s;for(let o=s+1;o<e.length&&o<=s+8;o++){let c=e[o]??"";if(o>s&&dn(c)||(a=o,c.trim()===""&&o>s+1))break}return e.slice(s,a+1).join(`
3
3
  `)}return e.slice(n,Math.min(e.length,n+8)).join(`
4
4
  `)}function an(e){return`${e.symbol}\0${e.startLine}\0${e.endLine}\0${e.leaf}`}function on(e,n,t){return me.read(e,n,t)??new Map}function ln(e){try{let n=JSON.parse(e);if(!Array.isArray(n.entries))return null;let t=new Map;for(let i of n.entries){if(!i||typeof i.key!="string"||typeof i.symbol!="string"||typeof i.startLine!="number"||typeof i.endLine!="number"||typeof i.leaf!="string"||!Array.isArray(i.tokens)||!i.tokens.every(r=>typeof r=="string"))return null;t.set(i.key,i)}return t}catch{return null}}function cn(e){let n={entries:[...e.values()].sort((t,i)=>t.key.localeCompare(i.key))};return JSON.stringify(n)}function un(e,n,t,i){me.write(e,n,t,new Map(i))}function ke(e,n){if(!e)return new Set;let t=new Set(["public","private","protected","final","static","class","def","fun","fn","function","return","string","bool","boolean","void","unit","self","this","new","const","let","var","end","pub"]),i=mn(n),s=e.replace(/["'`]/g," ").replace(/\b\d+\b/g," NUM ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9_]+/g," ").replace(/_/g," ").toLowerCase().split(/\s+/).map(a=>a.trim()).filter(a=>a.length>1).filter(a=>!t.has(a)).filter(a=>!i.has(a));return new Set(s)}function mn(e){return new Set(e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(n=>n.toLowerCase()).filter(n=>n.length>1))}function dn(e){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(e)}export{Ie as a,Tn as b,Te as c,ce as d,Mn as e,Ln as f,Ae as g,de as h,qe as i,G as j,Ne as k,Pe as l,fe as m,$e as n,ge as o,pe as p};
5
- //# sourceMappingURL=chunk-UDS562V4.js.map
5
+ //# sourceMappingURL=chunk-A7XQT7MH.js.map
@@ -1,4 +1,4 @@
1
- import{a as P,b as k,c as le,d as B}from"./chunk-EF2R3WNQ.js";import{e as ae,g as de,h as F,s as L,t as $,u as ue,v as w,w as f,x as b}from"./chunk-WE5RZHZ7.js";function me(e){try{return process.kill(e,0),!0}catch(r){return typeof r=="object"&&r!==null&&"code"in r&&r.code==="EPERM"}}import{randomUUID as _e}from"crypto";import{closeSync as Ce,fsyncSync as qe,linkSync as $e,mkdirSync as je,openSync as Je,statSync as We,unlinkSync as Ke,writeSync as Ue}from"fs";import{dirname as U}from"path";var J="codebaseiq-process-lock",W=1,O=Object.freeze({wallNow:()=>Date.now(),isProcessAlive:me,readProcessIdentity:le,randomToken:()=>_e(),makeDirectory:e=>je(e,{recursive:!0}),openFile:(e,r,t)=>Je(e,r,t),writeFile:(e,r,t,n)=>Ue(e,r,t,n),syncFile:e=>qe(e),closeFile:e=>Ce(e),linkFile:(e,r)=>$e(e,r),readFile:e=>F(e,"process lock record"),statFile:e=>{let r=We(e);return{dev:r.dev,ino:r.ino,size:r.size,mtimeMs:r.mtimeMs}},removeFile:e=>Ke(e)});function $r(e,r){let t=r.runtime??O;t.makeDirectory(U(e));let n;for(let i=0;i<2;i+=1)try{return{kind:"acquired",lock:fe(e,r,t),...n?{reclaimed:n}:{}}}catch(o){if(o.code!=="EEXIST")throw o;let s=R(e,{parseLegacy:r.parseLegacy,runtime:t});if(i===0&&Xe(e,s,{creationGraceMs:r.creationGraceMs,parseLegacy:r.parseLegacy,runtime:t})){n=s;continue}return{kind:"contended",observation:s}}return{kind:"contended",observation:R(e,{parseLegacy:r.parseLegacy,runtime:t})}}function R(e,r={}){let t=r.runtime??O,n,i;try{n=t.statFile(e),i=t.readFile(e)}catch(a){return a.code==="ENOENT"?{state:"missing"}:{state:"malformed"}}let o;try{o=JSON.parse(i)}catch{return{state:"malformed",raw:i,identity:n}}let s=ze(o);if(s)return{state:"valid",raw:i,identity:n,record:s,owner:He(s),parsed:o};let c=r.parseLegacy?.(o)??null;return c?{state:"legacy",raw:i,identity:n,owner:c,parsed:o}:{state:"malformed",raw:i,identity:n,parsed:o}}function ze(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let r=e;if(r.protocol!==J||r.version!==W||typeof r.kind!="string"||r.kind.trim()===""||typeof r.pid!="number"||!Number.isSafeInteger(r.pid)||r.pid<=0||typeof r.token!="string"||r.token.trim()===""||typeof r.startedAt!="string"||!Number.isFinite(Date.parse(r.startedAt))||r.detail!==void 0&&(typeof r.detail!="object"||r.detail===null||Array.isArray(r.detail)))return null;let t=r.processIdentity===void 0?null:P(r.processIdentity);return r.processIdentity!==void 0&&(!t||t.pid!==r.pid)?null:{protocol:J,version:W,kind:r.kind,pid:r.pid,token:r.token,...t?{processIdentity:t}:{},startedAt:r.startedAt,...r.detail?{detail:r.detail}:{}}}function Xe(e,r,t={}){let n=t.runtime??O;if(!K(r,n))return!1;let i=Ve(`${e}.reclaim`,n);if(!i)return!1;try{let o=R(e,{parseLegacy:t.parseLegacy,runtime:n});return!pe(r,o)||!K(o,n)?!1:z(e,n)}finally{i.release()}}function fe(e,r,t){let n=r.pid??process.pid,i=t.randomToken(),o=r.processIdentity===void 0?t.readProcessIdentity(n):r.processIdentity,s={protocol:J,version:W,kind:r.kind,pid:n,token:i,...o?{processIdentity:o}:{},startedAt:new Date(t.wallNow()).toISOString(),...r.detail?{detail:r.detail}:{}},c=`${e}.${i}.candidate`,a=t.openFile(c,"wx",384),d;try{L(a,Buffer.from(`${JSON.stringify(s)}
1
+ import{a as P,b as k,c as le,d as B}from"./chunk-6URCE5QY.js";import{e as ae,g as de,h as F,s as L,t as $,u as ue,v as w,w as f,x as b}from"./chunk-4O52YNKL.js";function me(e){try{return process.kill(e,0),!0}catch(r){return typeof r=="object"&&r!==null&&"code"in r&&r.code==="EPERM"}}import{randomUUID as _e}from"crypto";import{closeSync as Ce,fsyncSync as qe,linkSync as $e,mkdirSync as je,openSync as Je,statSync as We,unlinkSync as Ke,writeSync as Ue}from"fs";import{dirname as U}from"path";var J="codebaseiq-process-lock",W=1,O=Object.freeze({wallNow:()=>Date.now(),isProcessAlive:me,readProcessIdentity:le,randomToken:()=>_e(),makeDirectory:e=>je(e,{recursive:!0}),openFile:(e,r,t)=>Je(e,r,t),writeFile:(e,r,t,n)=>Ue(e,r,t,n),syncFile:e=>qe(e),closeFile:e=>Ce(e),linkFile:(e,r)=>$e(e,r),readFile:e=>F(e,"process lock record"),statFile:e=>{let r=We(e);return{dev:r.dev,ino:r.ino,size:r.size,mtimeMs:r.mtimeMs}},removeFile:e=>Ke(e)});function $r(e,r){let t=r.runtime??O;t.makeDirectory(U(e));let n;for(let i=0;i<2;i+=1)try{return{kind:"acquired",lock:fe(e,r,t),...n?{reclaimed:n}:{}}}catch(o){if(o.code!=="EEXIST")throw o;let s=R(e,{parseLegacy:r.parseLegacy,runtime:t});if(i===0&&Xe(e,s,{creationGraceMs:r.creationGraceMs,parseLegacy:r.parseLegacy,runtime:t})){n=s;continue}return{kind:"contended",observation:s}}return{kind:"contended",observation:R(e,{parseLegacy:r.parseLegacy,runtime:t})}}function R(e,r={}){let t=r.runtime??O,n,i;try{n=t.statFile(e),i=t.readFile(e)}catch(a){return a.code==="ENOENT"?{state:"missing"}:{state:"malformed"}}let o;try{o=JSON.parse(i)}catch{return{state:"malformed",raw:i,identity:n}}let s=ze(o);if(s)return{state:"valid",raw:i,identity:n,record:s,owner:He(s),parsed:o};let c=r.parseLegacy?.(o)??null;return c?{state:"legacy",raw:i,identity:n,owner:c,parsed:o}:{state:"malformed",raw:i,identity:n,parsed:o}}function ze(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let r=e;if(r.protocol!==J||r.version!==W||typeof r.kind!="string"||r.kind.trim()===""||typeof r.pid!="number"||!Number.isSafeInteger(r.pid)||r.pid<=0||typeof r.token!="string"||r.token.trim()===""||typeof r.startedAt!="string"||!Number.isFinite(Date.parse(r.startedAt))||r.detail!==void 0&&(typeof r.detail!="object"||r.detail===null||Array.isArray(r.detail)))return null;let t=r.processIdentity===void 0?null:P(r.processIdentity);return r.processIdentity!==void 0&&(!t||t.pid!==r.pid)?null:{protocol:J,version:W,kind:r.kind,pid:r.pid,token:r.token,...t?{processIdentity:t}:{},startedAt:r.startedAt,...r.detail?{detail:r.detail}:{}}}function Xe(e,r,t={}){let n=t.runtime??O;if(!K(r,n))return!1;let i=Ve(`${e}.reclaim`,n);if(!i)return!1;try{let o=R(e,{parseLegacy:t.parseLegacy,runtime:n});return!pe(r,o)||!K(o,n)?!1:z(e,n)}finally{i.release()}}function fe(e,r,t){let n=r.pid??process.pid,i=t.randomToken(),o=r.processIdentity===void 0?t.readProcessIdentity(n):r.processIdentity,s={protocol:J,version:W,kind:r.kind,pid:n,token:i,...o?{processIdentity:o}:{},startedAt:new Date(t.wallNow()).toISOString(),...r.detail?{detail:r.detail}:{}},c=`${e}.${i}.candidate`,a=t.openFile(c,"wx",384),d;try{L(a,Buffer.from(`${JSON.stringify(s)}
2
2
  `),t,"process lock"),t.syncFile(a)}catch(y){d=y}try{t.closeFile(a)}catch(y){d??=y}if(d!==void 0)throw j(c,t),d;try{t.linkFile(c,e)}catch(y){throw j(c,t),y}j(c,t);try{be(U(e),t)}catch(y){throw ye(e,s,t),y}let l=!1;return{path:e,record:s,release:()=>l?!1:(l=!0,ye(e,s,t))}}function ye(e,r,t=O){let n=R(e,{runtime:t});return n.state!=="valid"||!n.record||n.record.pid!==r.pid||n.record.token!==r.token||r.processIdentity&&(!n.record.processIdentity||!k(r.processIdentity,n.record.processIdentity))?!1:z(e,t)}function Ve(e,r){for(let t=0;t<2;t+=1)try{return fe(e,{kind:"reclaim-guard",runtime:r},r)}catch(n){if(n.code!=="EEXIST")return null;let i=R(e,{runtime:r});if(t>0||!K(i,r))return null;let o=R(e,{runtime:r});if(!pe(i,o)||!z(e,r))return null}return null}function K(e,r){if(e.state==="missing")return!1;if(e.owner){if(!r.isProcessAlive(e.owner.pid))return!0;if(!e.owner.processIdentity)return!1;let t=r.readProcessIdentity(e.owner.pid);return t!==null&&!k(e.owner.processIdentity,t)}return!1}function pe(e,r){return e.state===r.state&&e.raw===r.raw&&e.identity!==void 0&&r.identity!==void 0&&e.identity.dev===r.identity.dev&&e.identity.ino===r.identity.ino&&e.identity.size===r.identity.size&&e.identity.mtimeMs===r.identity.mtimeMs}function He(e){return{pid:e.pid,...e.processIdentity?{processIdentity:e.processIdentity}:{}}}function be(e,r){let t;try{t=r.openFile(e,"r")}catch(n){if($(n,process.platform))return;throw n}try{r.syncFile(t)}catch(n){if(!$(n,process.platform))throw n}finally{r.closeFile(t)}}function z(e,r){try{return r.removeFile(e),be(U(e),r),!0}catch{return!1}}function j(e,r){try{r.removeFile(e)}catch{}}import{randomUUID as sr}from"crypto";import{closeSync as cr,existsSync as ar,fsyncSync as dr,linkSync as lr,mkdirSync as ur,openSync as mr,renameSync as yr,unlinkSync as fr,writeSync as pr}from"fs";import{dirname as we}from"path";var Ye=Object.freeze(["EPERM","EACCES","EBUSY"]),Ge=Object.freeze([10,20,40,80,160,320,640,1e3,1e3,1e3]);function Qe(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)}var X=Object.freeze({platform:process.platform,sleep:Qe});function Ze(e,r){if(r!=="win32")return!1;let t=e?.code;return typeof t=="string"&&Ye.includes(t)}function ge(e,r={}){let t=r.runtime??X,n=r.delaysMs??Ge;for(let i of n)try{return e()}catch(o){if(!Ze(o,t.platform))throw o;t.sleep(i)}return e()}import{chmodSync as er,constants as rr,copyFileSync as tr}from"fs";import{dirname as nr}from"path";var xe=Object.freeze({...ue,copyFile:(e,r)=>tr(e,r,rr.COPYFILE_FICLONE),chmodFile:(e,r)=>er(e,r)});function ir(e,r,t={}){let n=t.runtime??xe,i=nr(r),o=w(i,n);if(n.copyFile(e,r),n.platform==="win32")or(r,t.mode,n);else{t.mode!==void 0&&n.chmodFile(r,t.mode);let s=n.openFile(r,"r");try{n.syncFile(s)}finally{n.closeFile(s)}}return b(o,f(i,n))}function or(e,r,t){let n=!1,i;try{i=t.openFile(e,"r+")}catch(o){let s=o.code;if(s!=="EACCES"&&s!=="EPERM")throw o;t.chmodFile(e,384),n=!0,i=t.openFile(e,"r+")}try{t.syncFile(i)}finally{t.closeFile(i)}r!==void 0?t.chmodFile(e,r):n&&t.chmodFile(e,292)}var Me=Object.freeze({platform:process.platform,randomToken:()=>sr(),pathExists:e=>ar(e),makeDirectory:e=>ur(e,{recursive:!0}),openFile:(e,r,t)=>mr(e,r,t),writeFile:(e,r,t,n)=>pr(e,r,t,n),syncFile:e=>dr(e),closeFile:e=>cr(e),renameFile:(e,r)=>yr(e,r),linkFile:(e,r)=>lr(e,r),removeFile:e=>fr(e)});function V(e,r,t={}){let n=t.durability??"visibility",i=t.runtime??Me,o=we(e),s=n==="durable"?w(o,i):(i.makeDirectory(o),"not-requested"),c=`${e}.tmp-${i.randomToken()}`,a=typeof r=="string"?Buffer.from(r):r,d,l=!1;try{d=i.openFile(c,"wx",t.mode??384),l=!0,L(d,a,i,"atomic file"),n==="durable"&&i.syncFile(d),i.closeFile(d),d=void 0,ge(()=>i.renameFile(c,e),{runtime:{platform:i.platform,sleep:i.sleep??X.sleep}}),l=!1;let y=n==="durable"?b(s,f(o,i)):"not-requested";return Fe(n,y)}finally{if(d!==void 0)try{i.closeFile(d)}catch{}if(l)try{i.removeFile(c)}catch{}}}function N(e,r,t={}){let n=t.durability??"visibility",i=t.runtime??Me;if(!i.linkFile)throw new Error("Exclusive atomic file publication requires hard-link support.");let o=we(e),s=n==="durable"?w(o,i):(i.makeDirectory(o),"not-requested"),c=`${e}.tmp-${i.randomToken()}`,a=typeof r=="string"?Buffer.from(r):r,d,l=!1;try{d=i.openFile(c,"wx",t.mode??384),l=!0,L(d,a,i,"exclusive atomic file"),n==="durable"&&i.syncFile(d),i.closeFile(d),d=void 0,i.linkFile(c,e);let y=n==="durable"?f(o,i):"not-requested";i.removeFile(c),l=!1;let u=n==="durable"?b(s,y,f(o,i)):"not-requested";return Fe(n,u)}finally{if(d!==void 0)try{i.closeFile(d)}catch{}if(l)try{i.removeFile(c)}catch{}}}function Fe(e,r){return{requestedDurability:e,achievedDurability:e==="visibility"?"visibility":r==="synced"?"directory-durable":"file-flushed",directorySync:r}}function nt(e,r,t={}){V(e,he(r,t),{durability:"visibility",runtime:t.runtime})}function H(e,r,t={}){return V(e,he(r,t),{durability:"durable",runtime:t.runtime})}function he(e,r){let t=JSON.stringify(e,null,r.spacing);return r.trailingNewline?`${t}
3
3
  `:t}import{createHash as Y,randomUUID as Ae}from"crypto";import{existsSync as M,lstatSync as D,readdirSync as I,renameSync as G,rmSync as g}from"fs";import{basename as A,dirname as Q,join as m}from"path";function T(e){return Array.isArray(e)?`[${e.map(T).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).sort(([r],[t])=>r.localeCompare(t)).map(([r,t])=>`${JSON.stringify(r)}:${T(t)}`).join(",")}}`:JSON.stringify(e)}var Z=1,br=Object.freeze({maxItems:1024,maxBytes:512*1024*1024,maxItemBytes:64*1024*1024,maxBatch:16,claimLeaseMs:5*6e4,responseRetentionMs:10*6e4,deadLetterRetentionMs:1440*6e4,temporaryRetentionMs:6e4,cleanupBatch:64}),x=class extends Error{constructor(t,n,i,o){let s=t==="item-too-large"?`request is ${o} bytes; per-item limit is ${i.maxItemBytes}`:t==="item-capacity"?`mailbox has ${n.totalItems} retained items; limit is ${i.maxItems}`:t==="byte-capacity"?`mailbox retains ${n.totalBytes} bytes and the request adds ${o}; limit is ${i.maxBytes}`:"another writer held the admission coordinator through the bounded wait";super(`Mailbox backpressure: ${s}. Retry after the service drains or expires retained work.`);this.code=t;this.status=n;this.limits=i;this.attemptedBytes=o;this.name="MailboxBackpressureError"}code;status;limits;attemptedBytes},Ee=".owner.json",ee={isProcessAlive:()=>!0,readProcessIdentity:()=>null};function pt(e){return{rootDir:e,pendingDir:m(e,"pending"),inflightDir:m(e,"inflight"),responseDir:m(e,"responses"),deadLetterDir:m(e,"dead-letter"),legacyRequestDir:m(e,"requests")}}function S(e={}){let r={...br,...e};for(let[t,n]of Object.entries(r))if(!Number.isFinite(n)||n<=0||!Number.isInteger(n))throw new Error(`Mailbox limit ${t} must be a positive integer.`);return r}function C(e){let r=[e.pendingDir,e.inflightDir,e.responseDir,e.deadLetterDir,e.legacyRequestDir].map(t=>w(t));return b(...r)}function bt(e,r){return Y("sha256").update(T({namespace:e,payload:r})).digest("hex")}function gr(e){if(!/^[a-f0-9]{64}$/.test(e))throw new Error("Mailbox operation keys must be lowercase SHA-256 identities.");return`op-${e}`}function gt(e,r,t={}){let n=S(t.limits),i=t.nowMs??Date.now(),o=C(e);return Sr(r),te(e,n,t.admissionLockTimeoutMs??2e3,t.monotonicNow??B,()=>{re(e,i,n);let s=m(e.pendingDir,`${r.id}.json`),c=m(e.responseDir,`${r.id}.json`),a=Ie(e,r.id);if(a){let u=ke(a,r.operationKey,r.id);return{disposition:"duplicate",requestId:r.id,responsePath:c,authoritativeDeadlineAtMs:u.deadlineAtMs??r.deadlineAtMs}}let d=`${JSON.stringify(r)}
4
4
  `,l=Buffer.byteLength(d),y=q(e);if(l>n.maxItemBytes)throw new x("item-too-large",y,n,l);if(y.totalItems+1>n.maxItems)throw new x("item-capacity",y,n,l);if(y.totalBytes+l>n.maxBytes)throw new x("byte-capacity",y,n,l);t.onBeforePublish?.();try{let u=N(s,d,{durability:"durable"}),p=b(o,u.directorySync);return{disposition:"accepted",requestId:r.id,responsePath:c,authoritativeDeadlineAtMs:r.deadlineAtMs,achievedDurability:p==="synced"?"directory-durable":"file-flushed",directorySync:p}}catch(u){if(u.code!=="EEXIST")throw u;let p=Ie(e,r.id);if(!p)throw u;let v=ke(p,r.operationKey,r.id);return{disposition:"duplicate",requestId:r.id,responsePath:c,authoritativeDeadlineAtMs:v.deadlineAtMs??r.deadlineAtMs}}})}function xr(e,r){if(!r.ownerId.trim())throw new Error("Mailbox claim owner identity is required.");if(r.owner&&(!Number.isSafeInteger(r.owner.pid)||r.owner.pid<=0||r.owner.processIdentity!==void 0&&r.owner.processIdentity.pid!==r.owner.pid))throw new Error("Mailbox claim process identity is invalid.");let t=r.nowMs??Date.now(),n=S(r.limits),i=C(e);try{return te(e,n,2e3,r.monotonicNow??B,()=>wr(e,r.ownerId,t,n,r.liveness??ee,r.owner??{pid:process.pid},i,r.onClaimStage))}catch(o){if(o instanceof x&&o.code==="admission-busy")return[];throw o}}function xt(e,r){return!Se(e.pendingDir)&&!Se(e.legacyRequestDir)?[]:xr(e,r)}function wr(e,r,t,n,i,o,s,c){re(e,t,n,i);let a=m(e.inflightDir,_(r)),d=[...Re(e.pendingDir,!1),...Re(e.legacyRequestDir,!0)].sort((u,p)=>u.orderAtMs-p.orderAtMs||u.header.id.localeCompare(p.header.id)||u.path.localeCompare(p.path)),l=s;d.length>0&&(l=b(l,w(a)),c?.("after-owner-directory-durable"),Rr(a,r,o),c?.("after-owner-record-published"));let y=[];for(let u of d){if(y.length>=n.maxBatch)break;let p=m(e.responseDir,`${u.header.id}.json`);if(M(p)){g(u.path,{force:!0});continue}let v=Math.max(t+n.claimLeaseMs,(u.header.deadlineAtMs??t)+5e3),Be=`${_(u.originalFile)}.${v}.claim`,oe=m(a,Be);try{G(u.path,oe)}catch(se){let ce=se.code;if(ce==="ENOENT"||ce==="EEXIST")continue;throw se}c?.("after-claim-renamed");let Oe=f(Q(u.path));c?.("after-source-directory-synced");let Ne=f(a);c?.("after-destination-directory-synced");let Te=b(l,Oe,Ne);y.push({requestId:u.header.id,ownerId:r,path:oe,originalFile:u.originalFile,claimedAtMs:t,claimExpiresAtMs:v,byteLength:u.byteLength,...u.header.operationKey?{operationKey:u.header.operationKey}:{},...u.header.clientId?{clientId:u.header.clientId}:{},...u.header.enqueuedAtMs===void 0?{}:{enqueuedAtMs:u.header.enqueuedAtMs},...u.header.deadlineAtMs===void 0?{}:{deadlineAtMs:u.header.deadlineAtMs},legacy:u.legacy,directorySync:Te})}return y}function wt(e,r={}){let t=S(r);if(e.byteLength>t.maxItemBytes)throw new x("item-too-large",{pending:0,inflight:1,responses:0,deadLetters:0,invalid:0,totalItems:1,totalBytes:e.byteLength},t,e.byteLength);return de(e.path,{maxBytes:t.maxItemBytes,inputKind:"bounded mailbox item"})}function Mr(e,r,t,n={}){let i=n.nowMs??Date.now(),o=S(n.limits),s={...t,mailboxVersion:Z,operationKey:r.operationKey??`legacy-${r.requestId}`,clientId:r.clientId??"legacy",...r.deadlineAtMs===void 0?{}:{deadlineAtMs:r.deadlineAtMs},completedAtMs:i,expiresAtMs:i+o.responseRetentionMs},c=Buffer.byteLength(`${JSON.stringify(s)}
@@ -6,4 +6,4 @@ import{a as P,b as k,c as le,d as B}from"./chunk-EF2R3WNQ.js";import{e as ae,g a
6
6
  `),l=q(e);l.totalItems<s.maxItems&&l.totalBytes+d<=s.maxBytes&&H(c,a,{spacing:2,trailingNewline:!0})}}function Ft(e,r={}){let t=r.nowMs??Date.now(),n=S(r.limits);return C(e),te(e,n,2e3,r.monotonicNow??B,()=>re(e,t,n,r.liveness??ee))}function re(e,r,t,n=ee){let i={reclaimed:0,completedClaimsRemoved:0,responsesRemoved:0,deadLettersRemoved:0,temporaryFilesRemoved:0},o=t.cleanupBatch;for(let s of ie(e.inflightDir)){if(o<=0)break;let c=m(e.responseDir,`${s.requestId}.json`);if(M(c)){g(s.path,{force:!0}),i.completedClaimsRemoved++,o--;continue}if(s.claimExpiresAtMs>r||Dr(e,s.ownerId,n)!=="dead")continue;let a=m(e.pendingDir,s.originalFile);try{G(s.path,a),i.reclaimed++}catch(d){if(d.code!=="EEXIST")throw d;g(s.path,{force:!0})}f(Q(s.path)),f(e.pendingDir),o--}o=De(e.responseDir,o,(s,c)=>c+t.responseRetentionMs,r,()=>{i.responsesRemoved++}),o=De(e.deadLetterDir,o,(s,c)=>c+t.deadLetterRetentionMs,r,()=>{i.deadLettersRemoved++});for(let s of[e.pendingDir,e.inflightDir,e.responseDir,e.deadLetterDir,e.legacyRequestDir]){if(o<=0)break;for(let c of Pe(s)){if(o<=0)break;A(c).includes(".tmp-")&&(D(c).mtimeMs+t.temporaryRetentionMs>r||(g(c,{force:!0}),i.temporaryFilesRemoved++,o--))}}return Lr(e.inflightDir),i}function q(e){C(e);let r=[...h(e.pendingDir).map(a=>({path:a,pending:!0})),...h(e.legacyRequestDir).map(a=>({path:a,pending:!0}))],t=ie(e.inflightDir).map(a=>({path:a.path,pending:!1})),n=h(e.responseDir).map(a=>({path:a,pending:!1})),i=h(e.deadLetterDir).map(a=>({path:a,pending:!1})),o=[...r,...t,...n,...i],s=0,c;for(let a of r){let d=E(a.path);if(!d){s++;continue}let l=d.enqueuedAtMs??D(a.path).mtimeMs;c=c===void 0?l:Math.min(c,l)}return{pending:r.length,inflight:t.length,responses:n.length,deadLetters:i.length,invalid:s,totalItems:o.length,totalBytes:o.reduce((a,d)=>a+Ar(d.path),0),...c===void 0?{}:{oldestPendingAt:new Date(c).toISOString()}}}function Fr(e,r,t){let n=m(e.responseDir,`${r.requestId}.json`),i=`${JSON.stringify(t)}
7
7
  `;try{N(n,i,{durability:"durable"})}catch(o){if(o.code!=="EEXIST")throw o;let s=E(n),c=r.operationKey??`legacy-${r.requestId}`;if(s?.operationKey!==c)throw new Error(`Mailbox completion ${r.requestId} conflicts with an existing operation.`,{cause:o})}}function te(e,r,t,n,i){let o=m(e.rootDir,".admission.lock"),s=`${process.pid}-${Ae()}`,c=n()+Math.max(0,t);for(;!hr(e.rootDir,o,s);){if(Ir(o),n()>=c)throw new x("admission-busy",q(e),r,0);Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,5)}try{return i()}finally{try{ne(o).ownerToken===s&&(g(o,{recursive:!0,force:!0}),f(e.rootDir))}catch{}}}function hr(e,r,t){let n=`${JSON.stringify({ownerToken:t,pid:process.pid,acquiredAtMs:Date.now()})}
8
8
  `;try{return N(r,n,{durability:"durable"}),!0}catch(i){if(i.code==="EEXIST")return!1;try{ne(r).ownerToken===t&&(g(r,{force:!0}),f(e))}catch{}throw i}}function Ir(e){let r=null;try{let n=ne(e);typeof n.ownerToken=="string"&&Number.isSafeInteger(n.pid)&&Number(n.pid)>0&&(r=Number(n.pid))}catch{}if(r===null||kr(r))return;let t=`${e}.stale-${Ae()}`;try{G(e,t)}catch(n){let i=n.code;if(i==="ENOENT"||i==="EEXIST")return;throw n}g(t,{recursive:!0,force:!0})}function ne(e){try{return JSON.parse(F(e,"mailbox lock record"))}catch(r){if(r.code!=="EISDIR"&&!(r instanceof ae&&r.reason==="not-regular"))throw r;return JSON.parse(F(m(e,"owner.json"),"mailbox lock owner record"))}}function kr(e){try{return process.kill(e,0),!0}catch(r){let t=r.code;return t==="EPERM"||t!=="ESRCH"}}function Rr(e,r,t){let n=m(e,Ee),i=t.processIdentity,o=ve(n);if(!(o&&o.ownerId===r&&o.pid===t.pid&&(!o.processIdentity&&!i||o.processIdentity&&i&&k(o.processIdentity,i)))){if(h(e).some(s=>s.endsWith(".claim")))throw new Error(`Mailbox owner identity ${r} collides with retained work from another process instance.`);H(n,{version:1,ownerId:r,pid:t.pid,...i?{processIdentity:i}:{}})}}function Dr(e,r,t){let n=ve(m(e.inflightDir,_(r),Ee));if(!n)return"unknown";if(!t.isProcessAlive(n.pid))return"dead";if(!n.processIdentity)return"live";let i=t.readProcessIdentity(n.pid);return i?k(n.processIdentity,i)?"live":"dead":"unknown"}function ve(e){try{let r=JSON.parse(F(e,"mailbox owner record"));if(r.version!==1||typeof r.ownerId!="string"||!r.ownerId||typeof r.pid!="number"||!Number.isSafeInteger(r.pid)||r.pid<=0)return null;let t=r.processIdentity===void 0?null:P(r.processIdentity);return r.processIdentity!==void 0&&(!t||t.pid!==r.pid)?null:{version:1,ownerId:r.ownerId,pid:r.pid,...t?{processIdentity:t}:{}}}catch{return null}}function Ie(e,r){for(let t of[m(e.pendingDir,`${r}.json`),m(e.legacyRequestDir,`${r}.json`),m(e.responseDir,`${r}.json`)])if(M(t))return t;for(let t of ie(e.inflightDir))if(t.requestId===r)return t.path;return null}function ke(e,r,t){let n=E(e);if(!n||n.operationKey!==r)throw new Error(`Mailbox operation ${t} conflicts with an existing retained record.`);return n}function Sr(e){if(e.mailboxVersion!==Z||e.id!==gr(e.operationKey)||!e.clientId.trim()||!Number.isFinite(e.enqueuedAtMs)||!Number.isFinite(e.deadlineAtMs)||e.deadlineAtMs<e.enqueuedAtMs)throw new Error("Mailbox request has an invalid lifecycle identity.")}function Re(e,r){return h(e).filter(t=>t.endsWith(".json")).map(t=>{let n=D(t),i=A(t,".json"),o=E(t)??{id:i};return{path:t,originalFile:A(t),header:o,byteLength:n.size,orderAtMs:o.enqueuedAtMs??n.mtimeMs,legacy:r}})}function ie(e){if(!M(e))return[];let r=[];for(let t of I(e,{withFileTypes:!0})){if(!t.isDirectory())continue;let n=Le(t.name);if(n===null)continue;let i=m(e,t.name);for(let o of I(i,{withFileTypes:!0})){if(!o.isFile()||!o.name.endsWith(".claim"))continue;let s=/^(.*)\.(\d+)\.claim$/.exec(o.name);if(!s)continue;let c=Le(s[1]),a=Number(s[2]);if(c===null||A(c)!==c||!c.endsWith(".json")||!Number.isSafeInteger(a))continue;let d=m(i,o.name),l=E(d)??{id:A(c,".json")},y=D(d);r.push({requestId:l.id,ownerId:n,path:d,originalFile:c,claimedAtMs:y.mtimeMs,claimExpiresAtMs:a,byteLength:y.size,...l.operationKey?{operationKey:l.operationKey}:{},...l.clientId?{clientId:l.clientId}:{},...l.enqueuedAtMs===void 0?{}:{enqueuedAtMs:l.enqueuedAtMs},...l.deadlineAtMs===void 0?{}:{deadlineAtMs:l.deadlineAtMs},legacy:l.operationKey===void 0})}}return r.sort((t,n)=>t.claimedAtMs-n.claimedAtMs||t.path.localeCompare(n.path))}function E(e){try{let r=JSON.parse(F(e,"mailbox record"));return typeof r.id!="string"||!r.id?null:{id:r.id,...typeof r.operationKey=="string"?{operationKey:r.operationKey}:{},...typeof r.clientId=="string"?{clientId:r.clientId}:{},...typeof r.enqueuedAtMs=="number"?{enqueuedAtMs:r.enqueuedAtMs}:{},...typeof r.deadlineAtMs=="number"?{deadlineAtMs:r.deadlineAtMs}:{}}}catch{return null}}function De(e,r,t,n,i){for(let o of h(e)){if(r<=0)break;let s=D(o);t(o,s.mtimeMs)>n||(g(o,{force:!0}),i(),r--)}return r}function h(e){return M(e)?I(e,{withFileTypes:!0}).filter(r=>r.isFile()).map(r=>m(e,r.name)).sort():[]}function Se(e){try{return I(e).some(r=>r.endsWith(".json"))}catch{return!1}}function Pe(e){if(!M(e))return[];let r=[];for(let t of I(e,{withFileTypes:!0})){let n=m(e,t.name);t.isFile()?r.push(n):t.isDirectory()&&r.push(...Pe(n))}return r.sort()}function Lr(e){if(M(e))for(let r of I(e,{withFileTypes:!0})){if(!r.isDirectory())continue;let t=m(e,r.name);I(t).some(n=>n.endsWith(".claim"))||g(t,{recursive:!0,force:!0})}}function Ar(e){try{return D(e).size}catch{return 0}}function _(e){return Buffer.from(e,"utf8").toString("base64url")}function Le(e){try{let r=Buffer.from(e,"base64url").toString("utf8");return _(r)===e?r:null}catch{return null}}function Er(e){return/^[a-z0-9][a-z0-9-]{0,127}$/i.test(e)?e:`invalid-${Y("sha256").update(e).digest("hex")}`}function vr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function It(e){return typeof e=="string"&&Number.isFinite(Date.parse(e))}function kt(e){return vr(e)&&Object.values(e).every(r=>typeof r=="string"||r===null)}function Rt(e){return typeof e=="string"&&e.length>0}function Dt(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function St(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}function Lt(e){return typeof e=="string"&&e.length>0&&e.length<=256&&!/[\0\r\n]/u.test(e)}function At(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}export{vr as a,It as b,kt as c,Rt as d,Dt as e,St as f,Lt as g,At as h,ge as i,me as j,O as k,$r as l,R as m,Xe as n,ir as o,V as p,N as q,nt as r,H as s,T as t,Z as u,pt as v,C as w,bt as x,gr as y,gt as z,xt as A,wt as B,Mr as C,Mt as D,Ft as E,q as F};
9
- //# sourceMappingURL=chunk-RDBI2RXU.js.map
9
+ //# sourceMappingURL=chunk-ACZDU5GK.js.map
@@ -1,4 +1,4 @@
1
- import{a as _,g as C,j as T,o as $,p as w}from"./chunk-O6QTXQPJ.js";import{C as O,a as x}from"./chunk-ADTBPVUZ.js";import{e as y,f as R,j as S,k as h,p as D,r as E,t as M,u as k,v as N}from"./chunk-BMYOV5GP.js";var ne={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function u(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let n=e.split(" ");if(n.length<4)return{scheme:n[0]??"",manager:n[1]??"",packageName:n[2]??"",version:"",descriptors:[],raw:e};let t=n[0],i=n[1],r=e.slice(t.length+1+i.length+1),s;if(r.startsWith("`")){let l=r.indexOf("`",1);l===-1?(s=r.slice(1),r=""):(s=r.slice(1,l),r=r.slice(l+2))}else{let l=r.indexOf(" ");l===-1?(s=r,r=""):(s=r.slice(0,l),r=r.slice(l+1))}let o,a=r.indexOf(" ");a===-1?(o=r,r=""):(o=r.slice(0,a),r=r.slice(a+1));let c=te(r);return{scheme:t,manager:i,packageName:s,version:o,descriptors:c,raw:e}}function m(e){let n=u(e);if("kind"in n)return null;for(let t=n.descriptors.length-2;t>=0;t--){let i=n.descriptors[t];if(i?.suffix==="type")return i.name}return null}function te(e){let n=[],t=0;for(;t<e.length;){if(e[t]==="["){let s=e.indexOf("]",t+1);if(s===-1){n.push({name:e.slice(t+1),suffix:"type-param"});break}n.push({name:e.slice(t+1,s),suffix:"type-param"}),t=s+1;continue}if(e[t]==="("&&(n.length===0||t===0||A(e[t-1]))){let s=e.indexOf(")",t+1);if(s!==-1&&e[s+1]!=="."){n.push({name:e.slice(t+1,s),suffix:"parameter"}),t=s+1;continue}}let i;if(e[t]==="`"){let s=e.indexOf("`",t+1);if(s===-1){i=e.slice(t+1),n.push({name:i,suffix:"term"});break}i=e.slice(t+1,s),t=s+1}else{let s=t;for(;t<e.length&&!A(e[t]);)t++;i=e.slice(s,t)}if(t>=e.length){i&&n.push({name:i,suffix:"term"});break}let r=e[t];if(r==="("){let s=e.indexOf(")",t+1);s!==-1&&e[s+1]==="."?(n.push({name:i,suffix:"method"}),t=s+2):s!==-1?(n.push({name:i,suffix:"method"}),t=s+1):(n.push({name:i,suffix:"term"}),t++)}else{let s=ne[r];s&&n.push({name:i,suffix:s}),t+=1}}return n}function A(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function v(e){let n=u(e);if("kind"in n&&n.kind==="local")return`local:${n.id}`;let t=n;if(t.descriptors.length===0)return t.raw;let i=[];for(let r of t.descriptors){let s=ie(r);s&&i.push(s)}return i.join(":")}function ie(e){let n=e.suffix==="namespace"?re(e.name):e.name;return n?e.suffix==="method"?`${n}()`:n:""}function re(e){return e.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/,"").replace(/\.(py|pyi)$/,"").replace(/\.(rs)$/,"").replace(/\.(java|scala|kt|kts)$/,"").replace(/\.(rb)$/,"").replace(/\.(go)$/,"").replace(/\.(cs|vb)$/,"").replace(/\.(dart)$/,"").replace(/\.(php)$/,"").replace(/\.(c|cc|cpp|cxx|h|hpp)$/,"")}function P(e){let n=u(e);if("kind"in n&&n.kind==="local")return n.id;let t=n;return t.descriptors.length===0?"":t.descriptors[t.descriptors.length-1].name}function p(e){let n=u(e);if("kind"in n&&n.kind==="local")return null;let t=n;return t.descriptors[t.descriptors.length-1]?.suffix??null}function Qe(e){return e.endsWith("().")||p(e)==="method"}function Q(e){let n=p(e);return n==="method"?!0:n!=="term"?!1:e.endsWith("().")?!0:e.startsWith("rust-analyzer ")&&e.includes("#")?!1:e.startsWith("scip-typescript ")?!/#[A-Za-z0-9_$]+\.$/.test(e):!0}function je(e){return p(e)==="namespace"}var se=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function Be(e){return se.test(e)}var oe=new Set(["test","tests","_tests"]);function Je(e){let n=u(e);if("kind"in n)return!1;for(let t=0;t<n.descriptors.length-1;t+=1){let i=n.descriptors[t];if(i?.suffix==="namespace"&&i.name&&oe.has(i.name))return!0}return!1}function We(e,n){let t=u(e),i=u(n);if("kind"in t||"kind"in i)return!1;let r=t.descriptors,s=i.descriptors;if(s.length!==r.length+1)return!1;for(let o=0;o<r.length;o++){let a=r[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function ze(e,n){let t=u(e),i=u(n);if("kind"in t||"kind"in i)return!1;let r=t.descriptors,s=i.descriptors;if(s.length<=r.length)return!1;for(let o=0;o<r.length;o++){let a=r[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function Ue(e,n){return e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.start_char, der.end_line, der.end_char, d.relative_path, gs.display_name, gs.documentation
1
+ import{a as _,g as C,j as T,o as $,p as w}from"./chunk-JOALNFY3.js";import{C as O,a as x}from"./chunk-RVYLJDXC.js";import{g as y,h as R,l as S,m as h,r as D,t as E,v as M,w as k,x as N}from"./chunk-PLZXWZHY.js";var ne={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function u(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let n=e.split(" ");if(n.length<4)return{scheme:n[0]??"",manager:n[1]??"",packageName:n[2]??"",version:"",descriptors:[],raw:e};let t=n[0],i=n[1],r=e.slice(t.length+1+i.length+1),s;if(r.startsWith("`")){let l=r.indexOf("`",1);l===-1?(s=r.slice(1),r=""):(s=r.slice(1,l),r=r.slice(l+2))}else{let l=r.indexOf(" ");l===-1?(s=r,r=""):(s=r.slice(0,l),r=r.slice(l+1))}let o,a=r.indexOf(" ");a===-1?(o=r,r=""):(o=r.slice(0,a),r=r.slice(a+1));let c=te(r);return{scheme:t,manager:i,packageName:s,version:o,descriptors:c,raw:e}}function m(e){let n=u(e);if("kind"in n)return null;for(let t=n.descriptors.length-2;t>=0;t--){let i=n.descriptors[t];if(i?.suffix==="type")return i.name}return null}function te(e){let n=[],t=0;for(;t<e.length;){if(e[t]==="["){let s=e.indexOf("]",t+1);if(s===-1){n.push({name:e.slice(t+1),suffix:"type-param"});break}n.push({name:e.slice(t+1,s),suffix:"type-param"}),t=s+1;continue}if(e[t]==="("&&(n.length===0||t===0||A(e[t-1]))){let s=e.indexOf(")",t+1);if(s!==-1&&e[s+1]!=="."){n.push({name:e.slice(t+1,s),suffix:"parameter"}),t=s+1;continue}}let i;if(e[t]==="`"){let s=e.indexOf("`",t+1);if(s===-1){i=e.slice(t+1),n.push({name:i,suffix:"term"});break}i=e.slice(t+1,s),t=s+1}else{let s=t;for(;t<e.length&&!A(e[t]);)t++;i=e.slice(s,t)}if(t>=e.length){i&&n.push({name:i,suffix:"term"});break}let r=e[t];if(r==="("){let s=e.indexOf(")",t+1);s!==-1&&e[s+1]==="."?(n.push({name:i,suffix:"method"}),t=s+2):s!==-1?(n.push({name:i,suffix:"method"}),t=s+1):(n.push({name:i,suffix:"term"}),t++)}else{let s=ne[r];s&&n.push({name:i,suffix:s}),t+=1}}return n}function A(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function v(e){let n=u(e);if("kind"in n&&n.kind==="local")return`local:${n.id}`;let t=n;if(t.descriptors.length===0)return t.raw;let i=[];for(let r of t.descriptors){let s=ie(r);s&&i.push(s)}return i.join(":")}function ie(e){let n=e.suffix==="namespace"?re(e.name):e.name;return n?e.suffix==="method"?`${n}()`:n:""}function re(e){return e.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/,"").replace(/\.(py|pyi)$/,"").replace(/\.(rs)$/,"").replace(/\.(java|scala|kt|kts)$/,"").replace(/\.(rb)$/,"").replace(/\.(go)$/,"").replace(/\.(cs|vb)$/,"").replace(/\.(dart)$/,"").replace(/\.(php)$/,"").replace(/\.(c|cc|cpp|cxx|h|hpp)$/,"")}function P(e){let n=u(e);if("kind"in n&&n.kind==="local")return n.id;let t=n;return t.descriptors.length===0?"":t.descriptors[t.descriptors.length-1].name}function p(e){let n=u(e);if("kind"in n&&n.kind==="local")return null;let t=n;return t.descriptors[t.descriptors.length-1]?.suffix??null}function Qe(e){return e.endsWith("().")||p(e)==="method"}function Q(e){let n=p(e);return n==="method"?!0:n!=="term"?!1:e.endsWith("().")?!0:e.startsWith("rust-analyzer ")&&e.includes("#")?!1:e.startsWith("scip-typescript ")?!/#[A-Za-z0-9_$]+\.$/.test(e):!0}function je(e){return p(e)==="namespace"}var se=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function Be(e){return se.test(e)}var oe=new Set(["test","tests","_tests"]);function Je(e){let n=u(e);if("kind"in n)return!1;for(let t=0;t<n.descriptors.length-1;t+=1){let i=n.descriptors[t];if(i?.suffix==="namespace"&&i.name&&oe.has(i.name))return!0}return!1}function We(e,n){let t=u(e),i=u(n);if("kind"in t||"kind"in i)return!1;let r=t.descriptors,s=i.descriptors;if(s.length!==r.length+1)return!1;for(let o=0;o<r.length;o++){let a=r[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function ze(e,n){let t=u(e),i=u(n);if("kind"in t||"kind"in i)return!1;let r=t.descriptors,s=i.descriptors;if(s.length<=r.length)return!1;for(let o=0;o<r.length;o++){let a=r[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function Ue(e,n){return e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.start_char, der.end_line, der.end_char, d.relative_path, gs.display_name, gs.documentation
2
2
  FROM global_symbols gs
3
3
  JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
4
4
  JOIN documents d ON der.document_id = d.id
@@ -114,4 +114,4 @@ import{a as _,g as C,j as T,o as $,p as w}from"./chunk-O6QTXQPJ.js";import{C as
114
114
  ${e.symbolNoiseFor("gs")}
115
115
  GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
116
116
  ORDER BY d.relative_path, start_line, end_line`,...s)}function De(e){return`(${e}.symbol LIKE '%().' OR ${e}.symbol LIKE '%()')`}function q(e,n){return n==="callable"?De(e):_e(e)}function _e(e){return`(${e}.symbol LIKE '%.' OR ${e}.symbol LIKE '%()')`}function G(e){let n=new Map;for(let t of e){let i=n.get(t.relative_path);i?i.push(t):n.set(t.relative_path,[t])}return n}function Sn(e,n,t={}){if(n.length===0)return[];let i=n.flatMap(r=>F(e,r)).filter(r=>!e.isIgnored(r.relativePath));return t.onlyDocumented&&(i=i.filter(r=>r.documentation!==null&&r.documentation!=="")),t.sort&&(i=i.sort((r,s)=>r.relativePath.localeCompare(s.relativePath)||r.startLine-s.startLine||r.endLine-s.endLine)),i.map(r=>({startLine:r.startLine,endLine:r.endLine,symbol:r.symbol,shortName:v(r.symbol),signature:W(z(r.documentation)),relativePath:r.relativePath,enclosingSymbol:r.enclosingSymbol}))}function Ie(e){let n=new Map,t=e.map((i,r)=>({definition:i,index:r,span:i.endLine-i.startLine})).sort((i,r)=>i.span-r.span||i.index-r.index);for(let{definition:i}of t)for(let r=i.startLine;r<=i.endLine;r+=1)n.has(r)||n.set(r,i);return n}function hn(e,n){let t=U.get(e);return t||(t=Ie(e),U.set(e,t)),t.get(n)??null}function xn(e,n){let t=F(e,n.relative_path).find(i=>i.symbolId===n.id);return t?{symbolId:t.symbolId,symbol:t.symbol,documentId:t.documentId,startLine:t.startLine,startChar:t.startChar,endLine:t.endLine,endChar:t.endChar,relativePath:t.relativePath}:{symbolId:n.id,symbol:n.symbol,documentId:n.document_id,startLine:n.start_line,startChar:n.start_char??0,endLine:n.end_line,endChar:n.end_char??0,relativePath:n.relative_path}}function V(e,n,t){let i=g(e).forFile(n,{text:!0}).text,r=T(e,n);return r?ke(t,r,i):i?Le(t,i):t}function Le(e,n){let t=n.split(/\r?\n/),i=Fe(e,t),r=Re(e,i),s=Ee(r,t);return Me(e,s)}function Fe(e,n){let t=e.some(r=>b(r.symbol))?Ae(n):null,i=new Map;for(let r of e)i.set(r.symbolId,we(n,t,r));return i}function Re(e,n){return e.filter(t=>b(t.symbol)).map(t=>({definition:t,startLine:n.get(t.symbolId)??t.startLine})).sort((t,i)=>t.startLine-i.startLine||t.definition.startLine-i.definition.startLine||t.definition.symbol.localeCompare(i.definition.symbol))}function Ee(e,n){let t=new Map;for(let i=0;i<e.length;i+=1){let r=e[i],s=e[i+1],o=s?Math.max(r.startLine,s.startLine-1):n.length-1;t.set(r.definition.symbolId,{startLine:r.startLine,endLine:ve(n,r.definition,r.startLine,o)})}return t}function Me(e,n){return e.map(t=>{let i=n.get(t.symbolId);return i?{...t,startLine:i.startLine,endLine:i.endLine}:t})}function ke(e,n,t=null){let i=new Map;for(let r of n){let s=i.get(r.name);s?s.push(r):i.set(r.name,[r])}return e.map(r=>{if(!$e(r)||!r.leaf)return K(r,t);let s=i.get(r.leaf);if(!s||s.length===0)return K(r,t);let o=t?Ne(r,s,t):null;if(o)return{...r,startLine:o.startLine,endLine:o.endLine};let a=s[0],c=Math.abs(a.startLine-r.startLine);for(let l=1;l<s.length;l+=1){let d=s[l],f=Math.abs(d.startLine-r.startLine);f<c&&(a=d,c=f)}return{...r,startLine:a.startLine,endLine:a.endLine}})}function Ne(e,n,t){let i=Oe(e.symbol);if(!i)return null;let r=t.split(/\r?\n/),s=new RegExp(`\\b${_(i)}\\b`);for(let o of n){let a=Ce(r,o.startLine);if(a&&s.test(a))return o}return null}function Oe(e){return e.match(/\/impl#\[([^\]]+)\]/)?.[1]??null}function Ce(e,n){for(let t=n;t>=0;t-=1){let i=e[t]?.trim()??"";if(i){if(/^impl\b/.test(i))return Te(e,t,n);if(/^(?:struct|enum|trait|mod)\b/.test(i))return null}}return null}function Te(e,n,t){let i=[];for(let r=n;r<=t;r+=1){let s=e[r]??"";if(i.push(s),s.includes("{"))break}return i.join(" ")}function $e(e){return b(e.symbol)?!0:p(e.symbol)==="term"&&m(e.symbol)===null}function K(e,n){if(!n||!e.leaf||p(e.symbol)!=="term"||m(e.symbol)!==null)return e;let t=_(e.leaf),i=new RegExp(`\\b(?:export\\s+)?(?:const|let|var)\\s+${t}\\b`),s=n.split(/\r?\n/).findIndex(o=>i.test(o));return s>=0?{...e,startLine:s,endLine:s}:e}function we(e,n,t){if(!b(t.symbol))return t.startLine;let i=Math.max(0,Math.min(t.startLine,e.length-1));if(!n)return i;let r=n.get(t.leaf);if(!r||r.length===0)return i;let s=null;for(let o of r){let a=Math.abs(o-t.startLine);(!s||a<s.distance)&&(s={line:o,distance:a})}return s?.line??i}function Ae(e){let n=/\b(?:function|def|fn)\s+([A-Za-z_$][\w$]*)/g,t=/\b([A-Za-z_$][\w$]*)\s*[:=]\s*(?:async\s*)?(?:function\b|\()/g,i=/^\s*(?:(?:export|public|private|protected|static|readonly|async|abstract|get|set)\s+)*([A-Za-z_$][\w$]*)\s*(?:<[^(]*>)?\s*\(/,r=/\b([A-Za-z_$][\w$]*)\s*\(/g,s=new Map,o=(a,c)=>{let l=s.get(a);if(!l){s.set(a,[c]);return}l[l.length-1]!==c&&l.push(c)};for(let a=0;a<e.length;a+=1){let c=e[a]??"";for(let d of c.matchAll(n))d[1]&&o(d[1],a);for(let d of c.matchAll(t))d[1]&&o(d[1],a);let l=c.match(i);l?.[1]&&o(l[1],a);for(let d of c.matchAll(r))d[1]&&o(d[1],a)}return s}function ve(e,n,t,i){let r=Math.max(t,Math.min(e.length-1,i)),s=Math.max(t,Math.min(r,n.endLine)),o=0,a=0,c=!1;for(let l=t;l<=r;l+=1){let d=Pe(e[l]??"");for(let f of d)f==="{"?(o+=1,c=!0):f==="}"?o=Math.max(0,o-1):f==="("?a+=1:f===")"&&(a=Math.max(0,a-1));if(c&&o===0||!c&&a===0&&l>=s)return l}return s}function Pe(e){let n="",t=null,i=!1;for(let r=0;r<e.length;r+=1){let s=e[r],o=e[r+1];if(!t&&s==="/"&&o==="/"){n+=" ".repeat(e.length-r);break}if(t){if(i){i=!1,n+=" ";continue}if(s==="\\"){i=!0,n+=" ";continue}s===t&&(t=null),n+=" ";continue}if(s==='"'||s==="'"||s==="`"){t=s,n+=" ";continue}n+=s}return n}function b(e){return e.includes("().")}function Dn(e){let n=u(e);if("kind"in n)return[];let t=[];for(let i=n.descriptors.length-2;i>=0;i-=1){let r=n.descriptors[i];r?.suffix==="type"&&r.name&&t.push(r.name)}return t}export{g as a,u as b,m as c,v as d,P as e,p as f,Qe as g,Q as h,je as i,Be as j,Je as k,We as l,ze as m,Ue as n,Ge as o,W as p,z as q,I as r,pn as s,F as t,gn as u,Se as v,bn as w,yn as x,Sn as y,Ie as z,hn as A,xn as B,Dn as C};
117
- //# sourceMappingURL=chunk-FETNQCFO.js.map
117
+ //# sourceMappingURL=chunk-AM5SUGHF.js.map
@@ -1,4 +1,4 @@
1
- import{o as O,p as A}from"./chunk-O6QTXQPJ.js";import{a as P}from"./chunk-ADTBPVUZ.js";import{e as F,i as S,k as _,s as C,t as N}from"./chunk-BMYOV5GP.js";import{d as y}from"./chunk-3LCDIREB.js";var G=C({kind:"file-dependency-graph",invalidation:N("file-dependency-graph"),serialize:e=>JSON.stringify(e),deserialize:x}),I=F("file-dep-graph",{clearGroups:["whole-project"]});function U(e,n,t={}){let s=t.scipEdges??"all-references",i=t.sourceEdges??"imports-only",o=v(n,s,i);return I.get(e,o,()=>{let d=new Set(P(e,{includeIgnored:!1})),c=_(e),p=0,l=0,m=null,E=!1,a=0,h=0;return y("file-dep-graph.product",()=>{if(c){let r=G.read(e,o,c);if(r){E=!0;let f=R(r);return p=r.sourceFileCount,l=r.sourceEdgeCount,a=r.scipEdgeCount,h=f.size,m=r.sourceDependencyFingerprint,f}}let g=y("file-dep-graph.source-imports",()=>{let r=b(e,d,n,i);return p=r.files.length,l=r.edges.length,m=r.fingerprint,r},()=>({scope:n??null,sourceEdges:i,files:p,edges:l})),u=new Map,D=(r,f)=>j(e,u,d,r,f);y("file-dep-graph.scip-edges",()=>{for(let r of $(e,n,s))a+=1,D(r.from_file,r.to_file)},()=>({scope:n??null,edges:a}));for(let r of g.edges)D(r.fromFile,r.toFile);return h=u.size,c&&G.write(e,o,c,{sourceDependencyFingerprint:g.fingerprint,sourceFileCount:g.files.length,sourceEdgeCount:g.edges.length,scipEdgeCount:a,graph:w(u)}),u},()=>({scope:n??null,available:c!==null,hit:E,files:p,sourceEdges:l,sourceEdgeMode:i,scipEdges:a,graphFiles:h,sourceDependencyFingerprint:m}))})}function b(e,n,t,s){let i=[],o=[];for(let d of n)if(!(t&&!d.includes(t))){i.push(d);for(let c of A(e,d))c.sourcePath&&o.push({fromFile:d,toFile:c.sourcePath});if(s==="imports-and-reexports")for(let c of O(e,d))c.sourcePath&&o.push({fromFile:d,toFile:c.sourcePath})}return{files:i,edges:o,fingerprint:M(i,o)}}function M(e,n){let t=n.map(s=>`${s.fromFile}\0${s.toFile}`).sort();return S(JSON.stringify({files:e,edges:t}))}function v(e,n,t){return`edge-mode-v3:${n}:${t}:${e??"<all>"}`}function w(e){return[...e].map(([n,t])=>[n,[...t]])}function R(e){return new Map(e.graph.map(([n,t])=>[n,new Set(t)]))}function x(e){let n=JSON.parse(e);return k(n)?n:null}function k(e){if(!e||typeof e!="object")return!1;let n=e;return typeof n.sourceDependencyFingerprint=="string"&&typeof n.sourceFileCount=="number"&&typeof n.sourceEdgeCount=="number"&&typeof n.scipEdgeCount=="number"&&Array.isArray(n.graph)&&n.graph.every(J)}function J(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&Array.isArray(e[1])&&e[1].every(n=>typeof n=="string")}function $(e,n,t){let s=n?"AND d1.relative_path LIKE ?":"",i=n?[`%${n}%`]:[],o=t==="imports-only"?"AND m.role = 2":"AND m.role != 1";return e.all(`SELECT DISTINCT
1
+ import{o as O,p as A}from"./chunk-JOALNFY3.js";import{a as P}from"./chunk-RVYLJDXC.js";import{g as F,k as S,m as _,u as C,v as N}from"./chunk-PLZXWZHY.js";import{d as y}from"./chunk-3LCDIREB.js";var G=C({kind:"file-dependency-graph",invalidation:N("file-dependency-graph"),serialize:e=>JSON.stringify(e),deserialize:x}),I=F("file-dep-graph",{clearGroups:["whole-project"]});function U(e,n,t={}){let s=t.scipEdges??"all-references",i=t.sourceEdges??"imports-only",o=v(n,s,i);return I.get(e,o,()=>{let d=new Set(P(e,{includeIgnored:!1})),c=_(e),p=0,l=0,m=null,E=!1,a=0,h=0;return y("file-dep-graph.product",()=>{if(c){let r=G.read(e,o,c);if(r){E=!0;let f=R(r);return p=r.sourceFileCount,l=r.sourceEdgeCount,a=r.scipEdgeCount,h=f.size,m=r.sourceDependencyFingerprint,f}}let g=y("file-dep-graph.source-imports",()=>{let r=b(e,d,n,i);return p=r.files.length,l=r.edges.length,m=r.fingerprint,r},()=>({scope:n??null,sourceEdges:i,files:p,edges:l})),u=new Map,D=(r,f)=>j(e,u,d,r,f);y("file-dep-graph.scip-edges",()=>{for(let r of $(e,n,s))a+=1,D(r.from_file,r.to_file)},()=>({scope:n??null,edges:a}));for(let r of g.edges)D(r.fromFile,r.toFile);return h=u.size,c&&G.write(e,o,c,{sourceDependencyFingerprint:g.fingerprint,sourceFileCount:g.files.length,sourceEdgeCount:g.edges.length,scipEdgeCount:a,graph:w(u)}),u},()=>({scope:n??null,available:c!==null,hit:E,files:p,sourceEdges:l,sourceEdgeMode:i,scipEdges:a,graphFiles:h,sourceDependencyFingerprint:m}))})}function b(e,n,t,s){let i=[],o=[];for(let d of n)if(!(t&&!d.includes(t))){i.push(d);for(let c of A(e,d))c.sourcePath&&o.push({fromFile:d,toFile:c.sourcePath});if(s==="imports-and-reexports")for(let c of O(e,d))c.sourcePath&&o.push({fromFile:d,toFile:c.sourcePath})}return{files:i,edges:o,fingerprint:M(i,o)}}function M(e,n){let t=n.map(s=>`${s.fromFile}\0${s.toFile}`).sort();return S(JSON.stringify({files:e,edges:t}))}function v(e,n,t){return`edge-mode-v3:${n}:${t}:${e??"<all>"}`}function w(e){return[...e].map(([n,t])=>[n,[...t]])}function R(e){return new Map(e.graph.map(([n,t])=>[n,new Set(t)]))}function x(e){let n=JSON.parse(e);return k(n)?n:null}function k(e){if(!e||typeof e!="object")return!1;let n=e;return typeof n.sourceDependencyFingerprint=="string"&&typeof n.sourceFileCount=="number"&&typeof n.sourceEdgeCount=="number"&&typeof n.scipEdgeCount=="number"&&Array.isArray(n.graph)&&n.graph.every(J)}function J(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&Array.isArray(e[1])&&e[1].every(n=>typeof n=="string")}function $(e,n,t){let s=n?"AND d1.relative_path LIKE ?":"",i=n?[`%${n}%`]:[],o=t==="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
@@ -17,4 +17,4 @@ import{o as O,p as A}from"./chunk-O6QTXQPJ.js";import{a as P}from"./chunk-ADTBPV
17
17
  ${o}
18
18
  ${e.pathExclusionsFor("d1","d2")}
19
19
  ${s}`,...i)}function j(e,n,t,s,i){if(s===i||e.isIgnored(s)||e.isIgnored(i)||!t.has(i))return;let o=n.get(s);o||(o=new Set,n.set(s,o)),o.add(i)}export{U as a};
20
- //# sourceMappingURL=chunk-NNOKTMZT.js.map
20
+ //# sourceMappingURL=chunk-B2E3HZ2A.js.map
@@ -1,4 +1,4 @@
1
- import{d as O}from"./chunk-ELNRLMC5.js";import{d as S}from"./chunk-UZGZB3VB.js";import{A as T,c as A,e as b,t as F}from"./chunk-FETNQCFO.js";import{a as D,b as P,f as h,p as I}from"./chunk-O6QTXQPJ.js";import{K as _,z as k}from"./chunk-ADTBPVUZ.js";import{e as g,f as w,u as m}from"./chunk-BMYOV5GP.js";import{b as C,d as p}from"./chunk-NNJ2KZZG.js";function L(e,n,t,r={}){if(!t)return[];let i=m(e,n);return i?i.indexOf(t)===-1?[]:(x(e,n).get(t)??[]).filter(s=>!Y(s,r)):[]}function Y(e,n){return typeof n.excludeStartLine=="number"&&typeof n.excludeEndLine=="number"&&e>=n.excludeStartLine&&e<=n.excludeEndLine}var W=g("file-identifiers",{clearGroups:["whole-project","source-file"]});function $(e,n){let t=h(e,n);return t?t.fileIdentifiers:W.get(e,n,()=>new Set(x(e,n).keys()))}var V=g("file-ident-lines",{clearGroups:["whole-project","source-file"]});function x(e,n){let t=h(e,n);return t?t.identifierLineMap:V.get(e,n,()=>q(e,n))}var X=g("file-idents-by-line",{clearGroups:["whole-project","source-file"]});function he(e,n){let t=h(e,n);return t?t.identifiersByLine:X.get(e,n,()=>{let r=x(e,n),i=0;for(let s of r.values()){let a=s[s.length-1];a!==void 0&&a>i&&(i=a)}let o=new Array(i+1);for(let s=0;s<=i;s+=1)o[s]=new Set;for(let[s,a]of r)for(let c of a)o[c].add(s);return o})}function q(e,n){let t=new Map,r=(a,c)=>{let l=t.get(a);if(!l){t.set(a,[c]);return}l[l.length-1]!==c&&l.push(c)},i=m(e,n);if(!i)return t;let o=P(i).split(/\r?\n/),s=/\b([A-Za-z_$][\w$]*)\b/g;for(let a=0;a<o.length;a+=1){let c=o[a]??"";for(let l of c.matchAll(s))l[1]&&r(l[1],a)}return t}function Ne(e,n){let t=z(e);return t?n.filter(r=>z(r.file)===t):n}function Me(e,n,t,r,i){let o=t.find(s=>s.file===n);if(o)return o;if(r){let s=i?.match(/^[A-Za-z_$][\w$]*/u)?.[0];if(!s)return null;let a=I(e,n),c=new Set(a.filter(f=>f.localName===s||f.importedName===s).map(f=>f.sourcePath).filter(f=>!!f));for(let f of t)for(let E of c)if(p(E,f.file))return f;let l=K(m(e,n)??"",s);if(l.size===0)return null;let u=new Set(a.filter(f=>l.has(f.localName??f.importedName)).map(f=>f.sourcePath).filter(f=>!!f)),d=t.filter(f=>l.has(A(f.symbol)??"")&&[...u].some(E=>p(E,f.file)));return d.length===1?d[0]:null}return t.length===1?t[0]:null}function K(e,n){let t=n.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),r=new Set,i=[new RegExp(`\\b${t}\\s*:\\s*([A-Za-z_$][\\w$]*)`,"gu"),new RegExp(`\\b${t}\\s*=\\s*(?:new\\s+)?([A-Za-z_$][\\w$]*)\\s*\\(`,"gu")];for(let o of i)for(let s of e.matchAll(o))r.add(s[1]);return r.size===1?r:new Set}function z(e){let n=k(e);return n?n==="typescript"||n==="tsx"||n==="javascript"?"javascript-family":n:null}var Q=w("global-leaf-index",{clearGroups:["whole-project"]});function v(e){return Q.get(e,()=>{let n=e.all(`SELECT gs.id, gs.symbol,
1
+ import{d as O}from"./chunk-ELNRLMC5.js";import{d as S}from"./chunk-3XFJUWJE.js";import{A as T,c as A,e as b,t as F}from"./chunk-AM5SUGHF.js";import{a as D,b as P,f as h,p as I}from"./chunk-JOALNFY3.js";import{K as _,z as k}from"./chunk-RVYLJDXC.js";import{g,h as w,w as m}from"./chunk-PLZXWZHY.js";import{b as C,d as p}from"./chunk-327YK6TB.js";function L(e,n,t,r={}){if(!t)return[];let i=m(e,n);return i?i.indexOf(t)===-1?[]:(x(e,n).get(t)??[]).filter(s=>!Y(s,r)):[]}function Y(e,n){return typeof n.excludeStartLine=="number"&&typeof n.excludeEndLine=="number"&&e>=n.excludeStartLine&&e<=n.excludeEndLine}var W=g("file-identifiers",{clearGroups:["whole-project","source-file"]});function $(e,n){let t=h(e,n);return t?t.fileIdentifiers:W.get(e,n,()=>new Set(x(e,n).keys()))}var V=g("file-ident-lines",{clearGroups:["whole-project","source-file"]});function x(e,n){let t=h(e,n);return t?t.identifierLineMap:V.get(e,n,()=>q(e,n))}var X=g("file-idents-by-line",{clearGroups:["whole-project","source-file"]});function he(e,n){let t=h(e,n);return t?t.identifiersByLine:X.get(e,n,()=>{let r=x(e,n),i=0;for(let s of r.values()){let a=s[s.length-1];a!==void 0&&a>i&&(i=a)}let o=new Array(i+1);for(let s=0;s<=i;s+=1)o[s]=new Set;for(let[s,a]of r)for(let c of a)o[c].add(s);return o})}function q(e,n){let t=new Map,r=(a,c)=>{let l=t.get(a);if(!l){t.set(a,[c]);return}l[l.length-1]!==c&&l.push(c)},i=m(e,n);if(!i)return t;let o=P(i).split(/\r?\n/),s=/\b([A-Za-z_$][\w$]*)\b/g;for(let a=0;a<o.length;a+=1){let c=o[a]??"";for(let l of c.matchAll(s))l[1]&&r(l[1],a)}return t}function Ne(e,n){let t=z(e);return t?n.filter(r=>z(r.file)===t):n}function Me(e,n,t,r,i){let o=t.find(s=>s.file===n);if(o)return o;if(r){let s=i?.match(/^[A-Za-z_$][\w$]*/u)?.[0];if(!s)return null;let a=I(e,n),c=new Set(a.filter(f=>f.localName===s||f.importedName===s).map(f=>f.sourcePath).filter(f=>!!f));for(let f of t)for(let E of c)if(p(E,f.file))return f;let l=K(m(e,n)??"",s);if(l.size===0)return null;let u=new Set(a.filter(f=>l.has(f.localName??f.importedName)).map(f=>f.sourcePath).filter(f=>!!f)),d=t.filter(f=>l.has(A(f.symbol)??"")&&[...u].some(E=>p(E,f.file)));return d.length===1?d[0]:null}return t.length===1?t[0]:null}function K(e,n){let t=n.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),r=new Set,i=[new RegExp(`\\b${t}\\s*:\\s*([A-Za-z_$][\\w$]*)`,"gu"),new RegExp(`\\b${t}\\s*=\\s*(?:new\\s+)?([A-Za-z_$][\\w$]*)\\s*\\(`,"gu")];for(let o of i)for(let s of e.matchAll(o))r.add(s[1]);return r.size===1?r:new Set}function z(e){let n=k(e);return n?n==="typescript"||n==="tsx"||n==="javascript"?"javascript-family":n:null}var Q=w("global-leaf-index",{clearGroups:["whole-project"]});function v(e){return Q.get(e,()=>{let n=e.all(`SELECT gs.id, gs.symbol,
2
2
  COALESCE(der_doc.relative_path, mention_doc.relative_path) AS relative_path
3
3
  FROM global_symbols gs
4
4
  LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
@@ -13,4 +13,4 @@ import{d as O}from"./chunk-ELNRLMC5.js";import{d as S}from"./chunk-UZGZB3VB.js";
13
13
  ) mention_doc ON mention_doc.symbol_id = gs.id
14
14
  WHERE 1 = 1
15
15
  ${e.symbolNoiseFor("gs")}`),t=new Map;for(let r of n){if(!r.relative_path||e.isIgnored(r.relative_path))continue;let i=b(r.symbol);if(!i)continue;let o=t.get(i);o||(o=[],t.set(i,o)),o.some(s=>s.symbolId===r.id)||o.push({symbol:r.symbol,symbolId:r.id,file:r.relative_path})}return t})}var ee=g("source-import-paths-by-local-name",{clearGroups:["whole-project","source-file"]});function j(e,n){let t=C(n);return ee.get(e,t,()=>te(e,t))}function te(e,n){let t=new Map;for(let r of I(e,n)){if(!r.sourcePath)continue;let i=r.localName??r.importedName;if(i&&B(t,i,r.sourcePath),r.kind==="namespace")for(let o of r.usedMembers)B(t,o,r.sourcePath)}return t}function B(e,n,t){let r=e.get(n);r||(r=new Set,e.set(n,r)),r.add(t)}var G=/[A-Za-z_$][A-Za-z0-9_$]*/g,Z=/^[A-Za-z_$][A-Za-z0-9_$]*$/,ne=512;function N(e){let n=[],t=!1;for(let r of e)r&&(t=!0,Z.test(r)||n.push(r));return{candidateNames:e,hasUsableCandidate:t,nonIdentifierNames:n}}function H(e,n){let t=re(n)?n:N(n);if(t.candidateNames.size===0||!t.hasUsableCandidate)return!0;if(t.candidateNames.size<=ne){for(let i of t.candidateNames)if(i){if(Z.test(i)){if(ie(i).test(e))return!0;continue}if(e.includes(i))return!0}return!1}G.lastIndex=0;let r;for(;(r=G.exec(e))!==null;)if(t.candidateNames.has(r[0]))return!0;for(let i of t.nonIdentifierNames)if(e.includes(i))return!0;return!1}function re(e){return"candidateNames"in e}function ie(e){return new RegExp(`(?<![A-Za-z_$0-9])${D(e)}(?![A-Za-z_$0-9])`)}function M(e,n,t){let r=v(e).get(t);if(!r||r.length===0)return[];if(r.length===1)return[y(r[0])];let i=r.filter(c=>c.file===n);if(i.length>0)return i.map(y);let o=j(e,n),s=o.get(t);if(s)for(let c of s){let l=r.filter(u=>p(c,u.file));if(l.length>0)return l.map(y)}let a=new Set;for(let c of o.values())for(let l of c)a.add(l);for(let c of a){let l=r.filter(u=>p(c,u.file));if(l.length>0&&l.length===r.length)return l.map(y)}return[]}function Je(e,n,t){let r=M(e,n,t);if(r.length>0)return r;let i=v(e).get(t);return!i||i.length===0?[]:i.map(y)}function U(e,n,t={}){let r=oe(e,n);if(!r)return[];let i=S(e,n);if(t.semantic!==!1&&t.semanticEvidence){let s=t.semanticEvidence.references(e,{...i,leaf:r.identifier,parentTypeName:null,isFunctionLike:!1,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null});if(s.length>0){let a=new Map;for(let c of s){let l=a.get(c.file)??[];l.push(c.line),a.set(c.file,l)}return R(e,a)}}let o=new Map;for(let s of _(e)){let a=se(e,r,s);a.length>0&&o.set(s,a)}return R(e,o)}function oe(e,n){let t=S(e,n);if(!t)return null;let r=b(t.symbol);return r?{symbolId:t.symbolId,relativePath:t.relativePath,startLine:t.startLine,endLine:t.endLine,identifier:r}:null}function se(e,n,t){let r=m(e,t);return!r||r.indexOf(n.identifier)===-1?[]:t!==n.relativePath&&!M(e,t,n.identifier).some(o=>o.symbolId===n.symbolId)?[]:L(e,t,n.identifier,t===n.relativePath?{excludeStartLine:n.startLine,excludeEndLine:n.endLine}:{})}function Ye(e,n,t={}){let r=new Map;for(let c of n){if(!c.leaf)continue;let l=r.get(c.leaf)??[];l.push(c),r.set(c.leaf,l)}if(r.size===0)return new Map;let i=new Set(n.map(c=>c.symbolId)),o=new Set(r.keys()),s=N(o),a=new Map;for(let c of _(e)){if(t.skipPath?.(c)||!H(m(e,c),s))continue;let l=$(e,c);if(l.size!==0){for(let u of l)if(r.has(u))for(let d of M(e,c,u)){if(!i.has(d.symbolId)||c===d.relativePath)continue;let f=a.get(d.symbolId);f||(f=new Set,a.set(d.symbolId,f)),f.add(c)}}}return a}function y(e){return{symbolId:e.symbolId,symbol:e.symbol,relativePath:e.file}}function R(e,n){let t=[],r=new Set;for(let[i,o]of n){let s=F(e,i);for(let a of o){let c=T(s,a),l=`${i}|${a}|${c?.symbol??""}`;r.has(l)||(r.add(l),t.push({file:i,line:a,enclosingSymbol:c?.symbol??null}))}}return t}function ae(e,n){return ce(e,[n]).get(n.symbolId)??[]}function ce(e,n){let t=n.map(o=>({symbolId:o.symbolId,prelude:pe(e,o)})).filter(o=>o.prelude!==null),r=ue(e,t.map(o=>o.symbolId)),i=new Map;for(let{symbolId:o,prelude:s}of t){let a=fe(e,r.get(o)??new Map,s.match,s.identifier);i.set(o,R(e,a))}return i}function et(e,n,t={}){return le(e,n,t).map(r=>({file:r.file,line:r.line,enclosingSymbol:r.enclosingSymbol}))}function le(e,n,t={}){let r=U(e,n,{semantic:t.semantic,semanticEvidence:t.semanticEvidence}),i=r.length>0?J(r,"source-attribution"):J(ae(e,n),"scip-reference-chunk");return t.includeIgnored===!0?i:i.filter(o=>!e.isIgnored(o.file))}function J(e,n){return e.map(t=>({...t,provenance:n}))}function fe(e,n,t,r){let i=new Map;for(let[o,s]of n)i.set(o,me(e,o,s,t,r));return i}function ue(e,n){let t=new Map;for(let r of O(e,n)){if(e.isIgnored(r.relative_path))continue;let i=t.get(r.symbol_id);i||(i=new Map,t.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 t}function me(e,n,t,r,i){let o=n===r.relativePath?{excludeStartLine:r.startLine,excludeEndLine:r.endLine}:{},s=i?L(e,n,i,o):[];return t.flatMap(a=>de(s,a))}function de(e,n){let t=e.filter(r=>r>=n.start_line&&r<=n.end_line);return t.length>0?t:[n.start_line]}function pe(e,n){let t=S(e,n);return t?{match:t,identifier:b(t.symbol)||null}:null}export{L as a,x as b,he as c,Ne as d,Me as e,v as f,N as g,H as h,j as i,M as j,Je as k,Ye as l,ae as m,ce as n,et as o,le as p};
16
- //# sourceMappingURL=chunk-CVYSU6BX.js.map
16
+ //# sourceMappingURL=chunk-BH5CE4LN.js.map