scip-query 0.22.0 → 0.23.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 (386) hide show
  1. package/CHANGELOG.md +257 -0
  2. package/README.md +11 -0
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/by-kind-XI2CSWEY.js +2 -0
  5. package/dist/call-graph-UONR6JR5.js +2 -0
  6. package/dist/{chunk-FGNCOQUX.js → chunk-2E7CX53V.js} +2 -2
  7. package/dist/chunk-2GRUZAQF.js +43 -0
  8. package/dist/{chunk-DPWKKNKI.js → chunk-2LDBDR6J.js} +2 -2
  9. package/dist/{chunk-JHH5SCZ3.js → chunk-2OOY75BW.js} +2 -2
  10. package/dist/{chunk-XGGBK66W.js → chunk-2R3V3PSD.js} +2 -2
  11. package/dist/chunk-2WC2OEDO.js +4 -0
  12. package/dist/{chunk-57N6LN2A.js → chunk-3AF4TUFK.js} +2 -2
  13. package/dist/{chunk-2RE5OCHZ.js → chunk-3D3QG236.js} +2 -2
  14. package/dist/{chunk-D2MVJSP4.js → chunk-3FHOF22C.js} +2 -2
  15. package/dist/{chunk-7XZGZBSQ.js → chunk-3JKSW6LJ.js} +2 -2
  16. package/dist/chunk-3L2ZBPEX.js +133 -0
  17. package/dist/{chunk-NVSZNESQ.js → chunk-3PJABJSU.js} +2 -2
  18. package/dist/{chunk-WOOAY3PA.js → chunk-3SVF22I5.js} +2 -2
  19. package/dist/{chunk-YAGYMBEX.js → chunk-3WR4E3A3.js} +2 -2
  20. package/dist/chunk-4FTZ4P5G.js +2 -0
  21. package/dist/{chunk-F24G5NBE.js → chunk-4ILJCCXV.js} +2 -2
  22. package/dist/chunk-4UX2F3JX.js +2 -0
  23. package/dist/chunk-4WNW27SX.js +2 -0
  24. package/dist/chunk-5ENOG4VP.js +61 -0
  25. package/dist/{chunk-RHHCLWQ6.js → chunk-64BFSI5I.js} +2 -2
  26. package/dist/chunk-66DVSJQG.js +455 -0
  27. package/dist/{chunk-ISWFRGJ6.js → chunk-6HFCYNYE.js} +2 -2
  28. package/dist/{chunk-Y2VM4CJC.js → chunk-6I6L7Z62.js} +2 -2
  29. package/dist/{chunk-CKRWA452.js → chunk-6PQNKL3G.js} +2 -2
  30. package/dist/{chunk-GPGRZJ3R.js → chunk-6V5CNXL6.js} +2 -2
  31. package/dist/chunk-6VVV4WRR.js +4 -0
  32. package/dist/{chunk-BDGTPN27.js → chunk-7BWFZPPZ.js} +2 -2
  33. package/dist/{chunk-25GWKRUZ.js → chunk-7CYG22FH.js} +2 -2
  34. package/dist/chunk-7F45LJKI.js +2 -0
  35. package/dist/{chunk-4TQU4TX2.js → chunk-7IWV2EG3.js} +2 -2
  36. package/dist/{chunk-UDY7MIAW.js → chunk-AFHTBORT.js} +2 -2
  37. package/dist/chunk-AVRYW5OZ.js +2 -0
  38. package/dist/chunk-B3PYOSCX.js +2 -0
  39. package/dist/{chunk-RNKPYYYE.js → chunk-B5D7QPBE.js} +2 -2
  40. package/dist/{chunk-FFJQZG6J.js → chunk-BBCIS4DX.js} +2 -2
  41. package/dist/chunk-BDUVI7TO.js +3 -0
  42. package/dist/{chunk-BVFYEEBH.js → chunk-BE7ZZTMC.js} +2 -2
  43. package/dist/{chunk-NEIQPFBI.js → chunk-BHVUJOCQ.js} +2 -2
  44. package/dist/chunk-BKVWUP7Y.js +2 -0
  45. package/dist/{chunk-IJMD6BRI.js → chunk-BQGB4HBD.js} +2 -2
  46. package/dist/{chunk-ERCYGVAM.js → chunk-BRV7PIFF.js} +2 -2
  47. package/dist/chunk-CEEZJXEF.js +2 -0
  48. package/dist/{chunk-BTVKZGWT.js → chunk-CIYLO6SI.js} +2 -2
  49. package/dist/chunk-CJZXN4NU.js +2 -0
  50. package/dist/{chunk-VXJJTQYE.js → chunk-CNO7TOKL.js} +2 -2
  51. package/dist/{chunk-ZZ3Z7D56.js → chunk-COF23M5F.js} +2 -2
  52. package/dist/{chunk-ZGW4HLPD.js → chunk-CWFP7GM5.js} +2 -2
  53. package/dist/chunk-D2DHWI3D.js +2 -0
  54. package/dist/{chunk-Q55NF3ZG.js → chunk-D4N5SQ2M.js} +2 -2
  55. package/dist/{chunk-LXQUF2RP.js → chunk-DBRSYFXR.js} +2 -2
  56. package/dist/{chunk-PXXYQK55.js → chunk-DHUIOLDT.js} +2 -2
  57. package/dist/{chunk-KZYID5KV.js → chunk-DIRJWYBM.js} +2 -2
  58. package/dist/{chunk-IKVNEGTW.js → chunk-DIUFNHRJ.js} +2 -2
  59. package/dist/{chunk-CLG6DWVS.js → chunk-DTZCKZEU.js} +2 -2
  60. package/dist/{chunk-Z2PZVKPR.js → chunk-DULC3QFP.js} +2 -2
  61. package/dist/{chunk-AYPDH2LU.js → chunk-DYGHBZ2N.js} +2 -2
  62. package/dist/{chunk-JJ62MTQH.js → chunk-E5R6AQ73.js} +2 -2
  63. package/dist/{chunk-BWVQP3LB.js → chunk-E73UNJTF.js} +2 -2
  64. package/dist/{chunk-GVOMSPGL.js → chunk-EG2CPZMJ.js} +2 -2
  65. package/dist/{chunk-56NQAEPJ.js → chunk-EKV5HX33.js} +2 -2
  66. package/dist/{chunk-GDRJB3SB.js → chunk-EQHFIL6T.js} +2 -2
  67. package/dist/{chunk-EWWY2ZFL.js → chunk-ESIQ66Z7.js} +2 -2
  68. package/dist/chunk-EVFUMY4R.js +3 -0
  69. package/dist/{chunk-ZYM4HOFA.js → chunk-F7DY272B.js} +2 -2
  70. package/dist/chunk-FBN2FGXG.js +2 -0
  71. package/dist/{chunk-AZS7YPCB.js → chunk-FDLOBR6P.js} +2 -2
  72. package/dist/chunk-FESCRNVV.js +5 -0
  73. package/dist/{chunk-URSGGIZX.js → chunk-FFRKR4EQ.js} +2 -2
  74. package/dist/chunk-FGA2U4OR.js +8 -0
  75. package/dist/{chunk-7YQOCABQ.js → chunk-FIQRSHVM.js} +2 -2
  76. package/dist/{chunk-KFVSJX25.js → chunk-FPYLNQPT.js} +2 -2
  77. package/dist/{chunk-FELGD32K.js → chunk-FRUSVINH.js} +2 -2
  78. package/dist/chunk-GAS2LJMP.js +3 -0
  79. package/dist/{chunk-OTSPRVNW.js → chunk-GSP44ENC.js} +2 -2
  80. package/dist/{chunk-K3XFWJI2.js → chunk-GUFSG5TX.js} +2 -2
  81. package/dist/chunk-GYIZ4NXB.js +2 -0
  82. package/dist/{chunk-2OXVP5U5.js → chunk-GZIUDL6G.js} +2 -2
  83. package/dist/chunk-HCXEQRFF.js +18 -0
  84. package/dist/{chunk-LO5JSW2C.js → chunk-HEHOQQKH.js} +2 -2
  85. package/dist/{chunk-U2N2KE7A.js → chunk-HKGFPJ4T.js} +2 -2
  86. package/dist/chunk-HLZTEXRA.js +2 -0
  87. package/dist/{chunk-EELPBR7E.js → chunk-HOENASQM.js} +2 -2
  88. package/dist/{chunk-VTCIYFEK.js → chunk-HVF5VBG6.js} +2 -2
  89. package/dist/{chunk-TH6IC56G.js → chunk-HYO3NP5Q.js} +2 -2
  90. package/dist/{chunk-OPSAW5DT.js → chunk-I55I7XXP.js} +2 -2
  91. package/dist/{chunk-DEAB5TGT.js → chunk-IDFEUFKS.js} +2 -2
  92. package/dist/{chunk-DJAO2OZJ.js → chunk-IHGQTTVW.js} +2 -2
  93. package/dist/{chunk-XU75YQN4.js → chunk-IICPE7B2.js} +2 -2
  94. package/dist/{chunk-GY7CCCEZ.js → chunk-IL676XCC.js} +2 -2
  95. package/dist/{chunk-4HE7MVWD.js → chunk-ILTDAWEF.js} +2 -2
  96. package/dist/chunk-IZDPJ2QI.js +2 -0
  97. package/dist/{chunk-5YRQIE2B.js → chunk-J66VOFW6.js} +2 -2
  98. package/dist/{chunk-SB25YMEQ.js → chunk-JFMEXGFE.js} +2 -2
  99. package/dist/{chunk-QLBSG7U5.js → chunk-JGKUET5J.js} +2 -2
  100. package/dist/{chunk-VZ7NXSHV.js → chunk-JS4PGXMV.js} +2 -2
  101. package/dist/{chunk-ZAZGGSM3.js → chunk-JTQVMR42.js} +2 -2
  102. package/dist/chunk-JWTGMPIT.js +80 -0
  103. package/dist/{chunk-5ZMBRQFC.js → chunk-JYR66JN5.js} +2 -2
  104. package/dist/chunk-KLFEXGQA.js +2 -0
  105. package/dist/chunk-KYSDI3GE.js +5 -0
  106. package/dist/{chunk-MSR2QRUE.js → chunk-L6PJPETJ.js} +2 -2
  107. package/dist/{chunk-VU6LIWHT.js → chunk-LDVT66YM.js} +2 -2
  108. package/dist/chunk-LEECKFCJ.js +2 -0
  109. package/dist/{chunk-H7CG6LOE.js → chunk-LMZ5PRUV.js} +2 -2
  110. package/dist/{chunk-ZPASRBLF.js → chunk-LQRQN2XA.js} +2 -2
  111. package/dist/{chunk-HISEUIL2.js → chunk-LXABEJX3.js} +2 -2
  112. package/dist/{chunk-WHADK6OS.js → chunk-M2O5NY6W.js} +2 -2
  113. package/dist/{chunk-Y334QQU5.js → chunk-MNV5FSBW.js} +2 -2
  114. package/dist/{chunk-RYOYJMGF.js → chunk-MPQ4OTBM.js} +2 -2
  115. package/dist/{chunk-6NC3YSPY.js → chunk-MV3CDXPI.js} +2 -2
  116. package/dist/{chunk-NRBNAECH.js → chunk-MWN53KRN.js} +2 -2
  117. package/dist/chunk-N2ZSIIGR.js +117 -0
  118. package/dist/chunk-N5B2NILC.js +5 -0
  119. package/dist/{chunk-Q6T2CAJL.js → chunk-NJITK2GP.js} +2 -2
  120. package/dist/{chunk-ENWQWA2R.js → chunk-NOGJXYFO.js} +2 -2
  121. package/dist/{chunk-V4NG5OMS.js → chunk-NOYBFVJA.js} +106 -106
  122. package/dist/chunk-NWQXSFFU.js +3 -0
  123. package/dist/chunk-ODDUPDP7.js +13 -0
  124. package/dist/{chunk-A77SCPW2.js → chunk-OLIWTZI3.js} +2 -2
  125. package/dist/{chunk-XFMVKFSF.js → chunk-OLNV6I6U.js} +2 -2
  126. package/dist/{chunk-QKT4UI2Y.js → chunk-OR2E3AGZ.js} +2 -2
  127. package/dist/chunk-OSR2GEHQ.js +2 -0
  128. package/dist/{chunk-5H5WTJSD.js → chunk-OSSESPDX.js} +2 -2
  129. package/dist/{chunk-KQHJEU6V.js → chunk-OWOOWNJ5.js} +2 -2
  130. package/dist/{chunk-GRX7JOXQ.js → chunk-P42EIXTA.js} +2 -2
  131. package/dist/{chunk-AQ2PORIO.js → chunk-PJFGPYTU.js} +2 -2
  132. package/dist/{chunk-LRI5OMPE.js → chunk-PP7KNN7L.js} +2 -2
  133. package/dist/{chunk-PLJUQFQN.js → chunk-PU7T5QYQ.js} +2 -2
  134. package/dist/{chunk-JUN5DOAK.js → chunk-PWWAJSKV.js} +2 -2
  135. package/dist/{chunk-7IQXARSQ.js → chunk-PZL5T7SU.js} +2 -2
  136. package/dist/{chunk-UAQ4T73O.js → chunk-QBE3YX64.js} +2 -2
  137. package/dist/{chunk-3TJY6M3B.js → chunk-QGVTFRY2.js} +2 -2
  138. package/dist/chunk-QOJONDS7.js +2 -0
  139. package/dist/chunk-QU5XRYB5.js +4 -0
  140. package/dist/{chunk-2KVU55CW.js → chunk-QUU5OBVK.js} +2 -2
  141. package/dist/{chunk-Q5TA4OY4.js → chunk-RBLQNW26.js} +2 -2
  142. package/dist/chunk-RTQ7NEKG.js +81 -0
  143. package/dist/{chunk-F24QUEQP.js → chunk-SQXRS7BG.js} +2 -2
  144. package/dist/chunk-SSK6LDPC.js +2 -0
  145. package/dist/chunk-SZHGTCPP.js +7 -0
  146. package/dist/chunk-T4N4P2K5.js +16 -0
  147. package/dist/chunk-TA3QKLLU.js +2 -0
  148. package/dist/chunk-TEBQMNVI.js +43 -0
  149. package/dist/{chunk-NK3JMP22.js → chunk-TPFHAQ2G.js} +2 -2
  150. package/dist/chunk-TQPCBMWT.js +5 -0
  151. package/dist/{chunk-HG722PO7.js → chunk-TRNAEQ6P.js} +2 -2
  152. package/dist/chunk-TY7CRN3Z.js +2 -0
  153. package/dist/{chunk-7XA3OM44.js → chunk-UHFYCMZO.js} +2 -2
  154. package/dist/{chunk-ARVO6TTW.js → chunk-UICY4GTQ.js} +2 -2
  155. package/dist/{chunk-SWK4XPUS.js → chunk-UVGEWT4Y.js} +2 -2
  156. package/dist/{chunk-GIQ6CSL4.js → chunk-UXW33INU.js} +2 -2
  157. package/dist/{chunk-RDULNRSJ.js → chunk-VMPRET3I.js} +2 -2
  158. package/dist/{chunk-I6UTXNHU.js → chunk-VNLGKHS6.js} +2 -2
  159. package/dist/{chunk-44T4DUAA.js → chunk-VQILFTEH.js} +2 -2
  160. package/dist/{chunk-N7FP5H5U.js → chunk-VUPHCS7Y.js} +8 -8
  161. package/dist/{chunk-JAT6C3VX.js → chunk-VVZSBTSU.js} +2 -2
  162. package/dist/{chunk-FBCVASUG.js → chunk-VZRNID6A.js} +2 -2
  163. package/dist/{chunk-TUQIPUDS.js → chunk-W5OXRYGE.js} +2 -2
  164. package/dist/chunk-W6STWDQI.js +57 -0
  165. package/dist/chunk-W7CXK74K.js +2 -0
  166. package/dist/chunk-WB3WYIRE.js +4 -0
  167. package/dist/{chunk-C76O5MDS.js → chunk-WDNVY4E7.js} +2 -2
  168. package/dist/{chunk-TAYD3AE7.js → chunk-WIWY3CRX.js} +2 -2
  169. package/dist/chunk-WK46TNUM.js +3 -0
  170. package/dist/chunk-WNTFFKAX.js +12 -0
  171. package/dist/{chunk-JFQBRL3J.js → chunk-WOIKCX6A.js} +2 -2
  172. package/dist/{chunk-PIFTZEEM.js → chunk-WUN6KBHV.js} +2 -2
  173. package/dist/chunk-WYCTJDVR.js +2 -0
  174. package/dist/chunk-WYPL7GF7.js +2 -0
  175. package/dist/{chunk-XN22RGSR.js → chunk-XBGWL66K.js} +2 -2
  176. package/dist/{chunk-R6M456QG.js → chunk-XDQMU3BT.js} +2 -2
  177. package/dist/{chunk-XJX6LGHL.js → chunk-XFA4SSO3.js} +2 -2
  178. package/dist/{chunk-2YC7YNKT.js → chunk-XGZEP6GR.js} +2 -2
  179. package/dist/chunk-XPDPNWTQ.js +368 -0
  180. package/dist/chunk-XRYABF57.js +8 -0
  181. package/dist/{chunk-YIHNPKWD.js → chunk-YBGKCQIS.js} +2 -2
  182. package/dist/{chunk-2XCGSDIT.js → chunk-YEN6CYC7.js} +2 -2
  183. package/dist/{chunk-VMWUV6WB.js → chunk-YF5IB2LF.js} +2 -2
  184. package/dist/{chunk-TNG2FYS5.js → chunk-YI2AWIHC.js} +2 -2
  185. package/dist/{chunk-EELG7D3Q.js → chunk-YPWBKGFU.js} +2 -2
  186. package/dist/{chunk-GQIDEID3.js → chunk-YPWHBBIS.js} +2 -2
  187. package/dist/{chunk-TKDNDQA7.js → chunk-YSH6U3L4.js} +2 -2
  188. package/dist/{chunk-BUTEIZKP.js → chunk-YU5DZUZI.js} +2 -2
  189. package/dist/chunk-YWO5DDRC.js +16 -0
  190. package/dist/{chunk-6HRZQLOI.js → chunk-Z4CDXYNQ.js} +2 -2
  191. package/dist/{chunk-XSWYJCAK.js → chunk-ZF5KHH7C.js} +2 -2
  192. package/dist/chunk-ZOHS7AQV.js +21 -0
  193. package/dist/{chunk-7U2YQSDE.js → chunk-ZTI4SBFV.js} +2 -2
  194. package/dist/cli-main.js +2 -2
  195. package/dist/code-MI6F2TTU.js +2 -0
  196. package/dist/code-result-json-FXALY4HE.js +2 -0
  197. package/dist/{command-descriptors-ORNTVNYV.js → command-descriptors-P34VABY5.js} +136 -135
  198. package/dist/dataflow-4KEMJPC6.js +2 -0
  199. package/dist/dependence-slice-R7FPWD5M.js +2 -0
  200. package/dist/deps-7EMQUYUT.js +2 -0
  201. package/dist/direct-navigation-6YO234F2.js +3 -0
  202. package/dist/entry-map-KOOLR26E.js +2 -0
  203. package/dist/files-OPIPJIGZ.js +2 -0
  204. package/dist/hierarchy-QPD2CAER.js +2 -0
  205. package/dist/imports-M6HUXRXC.js +2 -0
  206. package/dist/index.js +1 -1
  207. package/dist/members-I5MEFOCT.js +2 -0
  208. package/dist/methods-5JYGGHXA.js +2 -0
  209. package/dist/output-continuation-command-UPQAAKBP.js +3 -0
  210. package/dist/postinstall.js +1 -1
  211. package/dist/project-reindex-UKKQ5PLS.js +3 -0
  212. package/dist/queries/affected.js +1 -1
  213. package/dist/queries/anchors.js +1 -1
  214. package/dist/queries/architecture.js +1 -1
  215. package/dist/queries/bottlenecks.js +1 -1
  216. package/dist/queries/by-kind.js +1 -1
  217. package/dist/queries/call-graph.js +1 -1
  218. package/dist/queries/change-surface.js +1 -1
  219. package/dist/queries/cleanup-plan.js +1 -1
  220. package/dist/queries/co-change.js +1 -1
  221. package/dist/queries/code.js +1 -1
  222. package/dist/queries/complexity-hotspots.js +1 -1
  223. package/dist/queries/complexity.js +1 -1
  224. package/dist/queries/context.js +1 -1
  225. package/dist/queries/convergence.js +1 -1
  226. package/dist/queries/coupling.js +1 -1
  227. package/dist/queries/cycles.js +1 -1
  228. package/dist/queries/dataflow.js +1 -1
  229. package/dist/queries/dead.js +1 -1
  230. package/dist/queries/decorative-checkers.js +1 -1
  231. package/dist/queries/deep-chains.js +1 -1
  232. package/dist/queries/dependence-slice.js +1 -1
  233. package/dist/queries/dependency-depth.js +1 -1
  234. package/dist/queries/deps.js +1 -1
  235. package/dist/queries/diff-impact.d.ts +9 -0
  236. package/dist/queries/diff-impact.js +1 -1
  237. package/dist/queries/doc-drift.js +1 -1
  238. package/dist/queries/drift.js +1 -1
  239. package/dist/queries/duplicate-bodies.js +1 -1
  240. package/dist/queries/entry-map.js +1 -1
  241. package/dist/queries/evidence.js +1 -1
  242. package/dist/queries/extract-candidates.js +1 -1
  243. package/dist/queries/fan.js +1 -1
  244. package/dist/queries/files.js +1 -1
  245. package/dist/queries/health.js +1 -1
  246. package/dist/queries/hierarchy.js +1 -1
  247. package/dist/queries/hotspots.js +1 -1
  248. package/dist/queries/imports.js +1 -1
  249. package/dist/queries/incomplete-migration.js +1 -1
  250. package/dist/queries/index.js +1 -1
  251. package/dist/queries/isolated.js +1 -1
  252. package/dist/queries/locality-candidates.js +1 -1
  253. package/dist/queries/members.js +1 -1
  254. package/dist/queries/methods.js +1 -1
  255. package/dist/queries/not-implemented.js +1 -1
  256. package/dist/queries/outline.js +1 -1
  257. package/dist/queries/passthrough-candidates.js +1 -1
  258. package/dist/queries/plan-context.js +1 -1
  259. package/dist/queries/react-component-duplicates.js +1 -1
  260. package/dist/queries/react-hook-candidates.js +1 -1
  261. package/dist/queries/react-large-component-pressure.js +1 -1
  262. package/dist/queries/recent-duplicates.js +1 -1
  263. package/dist/queries/redundant-reexports.js +1 -1
  264. package/dist/queries/reference-neighborhood.js +1 -1
  265. package/dist/queries/reference-reachability.js +1 -1
  266. package/dist/queries/refs.js +1 -1
  267. package/dist/queries/self-audit.js +1 -1
  268. package/dist/queries/similar-chains.js +1 -1
  269. package/dist/queries/similar-files.js +1 -1
  270. package/dist/queries/similar-signatures.js +1 -1
  271. package/dist/queries/similar.js +1 -1
  272. package/dist/queries/slice.js +1 -1
  273. package/dist/queries/source-inspection.js +1 -1
  274. package/dist/queries/source-search.js +1 -1
  275. package/dist/queries/stale-abstractions.js +1 -1
  276. package/dist/queries/surface.js +1 -1
  277. package/dist/queries/symbols.js +1 -1
  278. package/dist/queries/system-map.js +1 -1
  279. package/dist/queries/system.js +1 -1
  280. package/dist/queries/test-quality.js +1 -1
  281. package/dist/queries/trace.js +1 -1
  282. package/dist/queries/twin-ab.js +1 -1
  283. package/dist/queries/twin-drift.js +1 -1
  284. package/dist/queries/unused-imports.js +1 -1
  285. package/dist/queries/unused-params.js +1 -1
  286. package/dist/queries/value-flow.js +1 -1
  287. package/dist/queries/vue-component-duplicates.js +1 -1
  288. package/dist/queries/vue-composable-candidates.js +1 -1
  289. package/dist/queries/vue-large-view-pressure.js +1 -1
  290. package/dist/queries/wrapper-candidates.js +1 -1
  291. package/dist/query-service-server.js +3 -3
  292. package/dist/refs-PSU4JZZW.js +2 -0
  293. package/dist/refs-pagination-JG6CJMRC.js +2 -0
  294. package/dist/reindex-worker.js +25 -25
  295. package/dist/reindex.d.ts +3 -2
  296. package/dist/reindex.js +35 -35
  297. package/dist/runtime.d.ts +34 -2
  298. package/dist/runtime.js +4 -4
  299. package/dist/rust-semantic-session-server.js +1 -1
  300. package/dist/rust-semantic-session-worker.js +1 -1
  301. package/dist/rust-semantic-worker.js +1 -1
  302. package/dist/{scip-cli-H-n59izO.d.ts → scip-cli-DOerTq-R.d.ts} +42 -4
  303. package/dist/slice-HYRATV64.js +2 -0
  304. package/dist/surface-VTGDYWF5.js +2 -0
  305. package/dist/symbol-resolution-WD5EU5JE.js +2 -0
  306. package/dist/system-LRQNFOR2.js +2 -0
  307. package/dist/trace-F4B6OLL4.js +2 -0
  308. package/dist/typescript-mailbox-worker.js +1 -1
  309. package/dist/value-flow-VRPZY72V.js +2 -0
  310. package/dist/watch-server.js +3 -3
  311. package/package.json +1 -1
  312. package/dist/by-kind-4IYG2SKW.js +0 -2
  313. package/dist/call-graph-WQNXMNNN.js +0 -2
  314. package/dist/chunk-2BTJALUS.js +0 -454
  315. package/dist/chunk-3QXC54FQ.js +0 -3
  316. package/dist/chunk-42W3LFUK.js +0 -13
  317. package/dist/chunk-4GAQ6FI4.js +0 -43
  318. package/dist/chunk-6VEFRPTD.js +0 -5
  319. package/dist/chunk-7C26EKLZ.js +0 -4
  320. package/dist/chunk-7JYHQAH2.js +0 -22
  321. package/dist/chunk-7KSO2OAP.js +0 -2
  322. package/dist/chunk-AK3PYTIK.js +0 -5
  323. package/dist/chunk-AMIMMNA4.js +0 -11
  324. package/dist/chunk-AUY5BL74.js +0 -2
  325. package/dist/chunk-BDHFVH2M.js +0 -18
  326. package/dist/chunk-BECZLYNU.js +0 -8
  327. package/dist/chunk-BYDAFMSR.js +0 -57
  328. package/dist/chunk-BZYSGZRK.js +0 -2
  329. package/dist/chunk-C7IJMOFP.js +0 -134
  330. package/dist/chunk-CBBHFNLX.js +0 -2
  331. package/dist/chunk-D35XIZGN.js +0 -2
  332. package/dist/chunk-DKM723YF.js +0 -79
  333. package/dist/chunk-E44IVWIJ.js +0 -367
  334. package/dist/chunk-EDMB6SSO.js +0 -7
  335. package/dist/chunk-EETGXQY7.js +0 -3
  336. package/dist/chunk-FKGQOTKD.js +0 -2
  337. package/dist/chunk-GH5YSGZL.js +0 -5
  338. package/dist/chunk-HCVJR2V4.js +0 -3
  339. package/dist/chunk-HXOU4XNH.js +0 -3
  340. package/dist/chunk-IMKZEXZG.js +0 -2
  341. package/dist/chunk-ISIQLPJ2.js +0 -61
  342. package/dist/chunk-IXESDH3J.js +0 -2
  343. package/dist/chunk-JT6XX7QY.js +0 -8
  344. package/dist/chunk-MHIEP7EG.js +0 -4
  345. package/dist/chunk-OJNK5ALA.js +0 -2
  346. package/dist/chunk-OXYAWIEA.js +0 -2
  347. package/dist/chunk-OZETODHH.js +0 -2
  348. package/dist/chunk-PBUH2P5S.js +0 -3
  349. package/dist/chunk-PLYUVM4F.js +0 -2
  350. package/dist/chunk-Q7GBK5T7.js +0 -81
  351. package/dist/chunk-QWKHW6VZ.js +0 -2
  352. package/dist/chunk-RPL3ARU7.js +0 -16
  353. package/dist/chunk-SVHTMVA4.js +0 -4
  354. package/dist/chunk-T6QD2ZQB.js +0 -43
  355. package/dist/chunk-TD7VKJ2Y.js +0 -117
  356. package/dist/chunk-TUSPIVZ3.js +0 -4
  357. package/dist/chunk-UT7TADJX.js +0 -2
  358. package/dist/chunk-VUSKPCUB.js +0 -2
  359. package/dist/chunk-WN3TCGJ4.js +0 -2
  360. package/dist/chunk-WSLEJSFR.js +0 -2
  361. package/dist/chunk-WYZIHUPZ.js +0 -16
  362. package/dist/chunk-XE33FV5W.js +0 -2
  363. package/dist/chunk-Z2AWCTN6.js +0 -2
  364. package/dist/chunk-ZOXKSQQB.js +0 -2
  365. package/dist/code-EQJFDT6I.js +0 -2
  366. package/dist/code-result-json-7UWIWBOO.js +0 -2
  367. package/dist/dataflow-6VL54GX5.js +0 -2
  368. package/dist/dependence-slice-DT2NUHD2.js +0 -2
  369. package/dist/deps-DB7H5IKC.js +0 -2
  370. package/dist/direct-navigation-O3LUAYWQ.js +0 -3
  371. package/dist/entry-map-6K62RV3D.js +0 -2
  372. package/dist/files-MSLD7MO6.js +0 -2
  373. package/dist/hierarchy-IVBXAKFA.js +0 -2
  374. package/dist/imports-FRAVZ3Y2.js +0 -2
  375. package/dist/members-KJOJDYGO.js +0 -2
  376. package/dist/methods-2AYABBT3.js +0 -2
  377. package/dist/output-continuation-command-JHMPH6NC.js +0 -3
  378. package/dist/project-reindex-HYO4WD7Z.js +0 -3
  379. package/dist/refs-ARMA6XUJ.js +0 -2
  380. package/dist/refs-pagination-VUGIWN6U.js +0 -2
  381. package/dist/slice-YOB5YFAM.js +0 -2
  382. package/dist/surface-VY5EFWTW.js +0 -2
  383. package/dist/symbol-resolution-DGQN4XIV.js +0 -2
  384. package/dist/system-2KQ3QD2P.js +0 -2
  385. package/dist/trace-HTIPTXAE.js +0 -2
  386. package/dist/value-flow-5FV3VQI7.js +0 -2
@@ -1,7 +0,0 @@
1
- import{a as U,b as j}from"./chunk-JHH5SCZ3.js";import{a as I}from"./chunk-K3XFWJI2.js";import{b as K}from"./chunk-57N6LN2A.js";import{b as z,e as N,i as b}from"./chunk-H5EXS3HM.js";import{d as X}from"./chunk-SB25YMEQ.js";import{d as A,e as w,f as F,h as G}from"./chunk-AK3PYTIK.js";var V=class extends Error{constructor(t){super(t),this.name="ReindexLockUnavailableError"}};import{existsSync as ee,statSync as Te}from"fs";import{dirname as ie,join as ae}from"path";import{appendFileSync as ge,existsSync as fe,mkdirSync as me,renameSync as pe,rmSync as ye,statSync as Re,truncateSync as be}from"fs";import{basename as xe,dirname as Be}from"path";var L=".previous",he=".rotation.lock",ve=2e3,J=class extends Error{constructor(n,r){super(`Timed out after ${r}ms waiting for rotating JSONL lock: ${n}`);this.lockPath=n;this.timeoutMs=r;this.name="RotatingJsonlLockTimeoutError"}lockPath;timeoutMs;code="ROTATING_JSONL_LOCK_TIMEOUT"},M=class extends Error{constructor(n){super(`Rotating JSONL lock ownership changed before release: ${n}`);this.lockPath=n;this.name="RotatingJsonlLockReleaseError"}lockPath;code="ROTATING_JSONL_LOCK_RELEASE_FAILED"},q=Object.freeze({monotonicNow:X,wait(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)},tryAcquireLock(e,t){let n=K(e,{kind:"rotating-jsonl",detail:{target:xe(t)}});return n.kind==="acquired"?{kind:"acquired",lock:n.lock}:{kind:"contended"}},makeDirectory(e){me(e,{recursive:!0})},exists:fe,readBytes(e){return F(e,{maxBytes:A,inputKind:"rotating JSONL segment"})},size(e){return Re(e).size},truncate:be,remove(e){ye(e,{force:!0})},rename:pe,append:ge});function Y(e,t,n){let r=n.runtime??q,a=JSON.stringify(t);if(a===void 0)throw new TypeError("Rotating JSONL records must be JSON-serializable values.");let s=Buffer.from(`${a}
2
- `),i=Math.max(1,Math.floor(n.maxSegmentBytes),s.length);return Z(e,n.lockTimeoutMs,r,()=>{r.makeDirectory(Be(e));let c=Ae(e,A,r);n.onPhase?.("tail-repaired");let o=`${e}${n.previousSuffix??L}`,u=!1,g=!1;return r.exists(e)&&r.size(e)+s.length>i&&(r.exists(o)&&(r.remove(o),g=!0),n.onPhase?.("previous-pruned"),r.rename(e,o),u=!0,n.onPhase?.("current-rotated")),r.append(e,s),n.onPhase?.("record-appended"),{lineBytes:s.length,segmentLimitBytes:i,repairedTailBytes:c,rotated:u,prunedPrevious:g}})}function H(e,t={}){let n=t.runtime??q,r=Le(t.maxSegmentBytes);return Z(e,t.lockTimeoutMs,n,()=>{let a=[],s=0,i=`${e}${t.previousSuffix??L}`;for(let c of[i,e]){if(!n.exists(c))continue;let o=Se(Q(c,r,n));a.push(...o.lines),s+=o.partialTailBytes}return{lines:a,ignoredPartialTailBytes:s}})}function Z(e,t,n,r){let a=`${e}${he}`,s=Math.max(0,t??ve),i=n.monotonicNow()+s,c;for(;;){let m=n.tryAcquireLock(a,e);if(m.kind==="acquired"){c=m.lock;break}let R=i-n.monotonicNow();if(R<=0)throw new J(a,s);n.wait(Math.min(5,R))}let o=!1,u,g;try{g=r()}catch(m){o=!0,u=m}let l=!1;try{l=c.release()}catch(m){if(!o)throw m}if(o)throw u;if(!l)throw new M(a);return g}function Ae(e,t,n){if(!n.exists(e))return 0;let r=Q(e,t,n);if(r.length===0||r[r.length-1]===10)return 0;let a=r.lastIndexOf(10),s=a<0?0:a+1;return n.truncate(e,s),r.length-s}function Le(e){let t=e??A;if(!Number.isSafeInteger(t)||t<=0)throw new RangeError(`maxSegmentBytes must be a positive safe integer; received ${t}`);return t}function Q(e,t,n){let r=n.size(e);if(r>t)throw new w("rotating JSONL segment",e,"too-large",r,t);let a=n.readBytes(e),s=n.size(e);if(s!==r||a.byteLength!==r)throw new w("rotating JSONL segment",e,"changed-during-read",s,t);return a}function Se(e){let t=e.lastIndexOf(10),n=t<0?0:t+1;return{lines:e.subarray(0,n).toString("utf8").split(`
3
- `).filter(a=>a.length>0),partialTailBytes:e.length-n}}var Oe="reindex-activity.jsonl",S=L,ke=1024*1024,Pe=1440*60*1e3,te=e=>G(e,"reindex activity segment");function T(e){return ae(ie(e),Oe)}function se(e){if(e.reused)return 0;let n=(e.shards?.some(r=>!r.reused&&r.strategy==="incremental")??!1?0:C(e.indexPath))+C(e.dbPath);for(let r of e.shards??[]){if(r.reused)continue;let a=r.producedOutputBytes??r.outputBytes;a!==null&&(n+=a)}return n}function Ee(e){let t=se(e),n=e.writeTelemetry;return n?Math.max(0,t-n.reflinkedBytes)+n.fallbackCopiedBytes+(n.incrementalWrittenBytes??0):t}function st(e,t){let n=t.lastRefresh;if(!n)return{state:"failed",reason:"reindex result has no refresh metadata"};let r=se(t);return D(T(e),{version:1,event:"run",recordedAt:n.completedAt,trigger:n.trigger,result:n.result,durationMs:n.durationMs,estimatedLogicalOutputBytes:r,estimatedWriteBytes:Ee(t),reflinkedBytes:t.writeTelemetry?.reflinkedBytes??0,fallbackCopiedBytes:t.writeTelemetry?.fallbackCopiedBytes??0,incrementalWrittenBytes:t.writeTelemetry?.incrementalWrittenBytes??0,byLanguage:Ce(t)})}function ot(e,t){return D(T(e),{version:1,event:"run",recordedAt:t.completedAt,trigger:t.trigger,result:"failed",durationMs:t.durationMs,estimatedLogicalOutputBytes:0})}function ut(e,t,n=new Date){return D(T(e),{version:1,event:"suppressed",recordedAt:n.toISOString(),trigger:t,reason:"completed-index-is-fresh"})}function _e(e,t,n=ke,r){Y(e,t,{maxSegmentBytes:n,previousSuffix:S,...r?{runtime:r}:{}})}function we(e,t=new Date,n=Pe,r=te){let a=t.getTime(),s=a-n,i={confidence:"complete",recordsRead:0,invalidRecords:0,skippedRecords:0,readErrors:0,ignoredPartialTailBytes:0,windowStartedAt:new Date(s).toISOString(),windowEndedAt:t.toISOString(),runs:0,rebuilt:0,fullRebuilds:0,reused:0,failed:0,suppressed:0,estimatedLogicalOutputBytes:0,estimatedWriteBytes:0,reflinkedBytes:0,fallbackCopiedBytes:0,languageAttribution:"complete",attributedRuns:0,unattributedRuns:0,invalidLanguageDetails:0,byLanguage:{},byTrigger:{}},c=T(e),o=[];if(r===te){if(!ee(c)&&!ee(`${c}${S}`))return i;try{let u=H(c,{previousSuffix:S});o=u.lines,i.ignoredPartialTailBytes=u.ignoredPartialTailBytes}catch{i.readErrors+=1,i.confidence="unavailable"}}else{let u=0;for(let g of[`${c}${S}`,c])try{o.push(...Ue(r(g))),u+=1}catch{i.readErrors+=1}u===0?i.confidence="unavailable":i.readErrors>0&&(i.confidence="partial")}for(let u of o){i.recordsRead+=1;let g=Ne(u);if(!g){i.invalidRecords+=1,i.confidence!=="unavailable"&&(i.confidence="partial");continue}let{record:l}=g,m=Date.parse(l.recordedAt);if(m<s||m>a){i.skippedRecords+=1;continue}if(i.invalidLanguageDetails=(i.invalidLanguageDetails??0)+g.invalidLanguageDetails,i.byTrigger[l.trigger.kind]=(i.byTrigger[l.trigger.kind]??0)+1,l.event==="suppressed"){i.suppressed+=1;continue}i.runs+=1,i[l.result]+=1,i.estimatedLogicalOutputBytes+=l.estimatedLogicalOutputBytes;let R=Ie(l);i.estimatedWriteBytes=(i.estimatedWriteBytes??0)+R,i.reflinkedBytes=(i.reflinkedBytes??0)+(l.reflinkedBytes??0),i.fallbackCopiedBytes=(i.fallbackCopiedBytes??0)+(l.fallbackCopiedBytes??0),l.result!=="failed"&&(g.hasLanguageDetails?i.attributedRuns=(i.attributedRuns??0)+1:i.unattributedRuns=(i.unattributedRuns??0)+1);for(let[x,p]of oe(l.byLanguage)){let y=(i.byLanguage??={})[x]??=Fe();y.runs+=1,y[p.result]+=1,y.producedOutputBytes+=p.producedOutputBytes,y.durationMs+=p.durationMs}ne(l)&&i.oldestRebuildAt===void 0&&(i.oldestRebuildAt=l.recordedAt),ne(l)&&(i.fullRebuilds=(i.fullRebuilds??0)+1),R>0&&i.oldestWriteAt===void 0&&(i.oldestWriteAt=l.recordedAt)}return i.ignoredPartialTailBytes>0&&i.confidence!=="unavailable"&&(i.confidence="partial"),i.languageAttribution=Ge(i),i}function D(e,t){try{return _e(e,t),{state:"recorded"}}catch(n){return{state:"failed",reason:n instanceof Error?n.message:String(n)}}}function Ne(e){try{let t=JSON.parse(e);if(!t||typeof t!="object")return null;let n=t;if(n.version!==1||!z(n.recordedAt)||!n.trigger||!Me(n.trigger.kind))return null;if(n.event==="suppressed")return n.reason==="completed-index-is-fresh"?{record:n,hasLanguageDetails:!1,invalidLanguageDetails:0}:null;if(n.event!=="run"||n.result!=="rebuilt"&&n.result!=="reused"&&n.result!=="failed"||!b(n.durationMs)||!b(n.estimatedLogicalOutputBytes)||n.estimatedWriteBytes!==void 0&&!b(n.estimatedWriteBytes)||n.reflinkedBytes!==void 0&&!b(n.reflinkedBytes)||n.fallbackCopiedBytes!==void 0&&!b(n.fallbackCopiedBytes)||n.incrementalWrittenBytes!==void 0&&!b(n.incrementalWrittenBytes))return null;let r=n,{byLanguage:a,...s}=r,i=De(a);return{record:{...s,...i.byLanguage?{byLanguage:i.byLanguage}:{}},hasLanguageDetails:i.hasLanguageDetails,invalidLanguageDetails:i.invalidLanguageDetails}}catch{return null}}function Ie(e){return e.reflinkedBytes===void 0?e.estimatedWriteBytes??e.estimatedLogicalOutputBytes:Math.max(0,e.estimatedLogicalOutputBytes-e.reflinkedBytes)+(e.fallbackCopiedBytes??0)+(e.incrementalWrittenBytes??0)}function dt(e,t,n=new Date){return t.enabled?Je(we(e,n,t.windowMs),t,n.getTime()):{state:"allowed",rebuilt:0,estimatedWriteBytes:0}}function Je(e,t,n){let r=e.estimatedWriteBytes??e.estimatedLogicalOutputBytes,a=e.fullRebuilds??e.rebuilt,s={rebuilt:a,estimatedWriteBytes:r};return t.enabled?e.confidence!==void 0&&e.confidence!=="complete"?{state:"paused",reason:"activity-evidence",until:n+t.windowMs,...s,detail:`reindex activity evidence is ${e.confidence}`}:a>=t.maxRebuilds?{state:"paused",reason:"rebuild-count",until:re(e.oldestRebuildAt,t.windowMs,n),...s,detail:`${a}/${t.maxRebuilds} expensive full rebuild slots consumed`}:r>=t.maxEstimatedWriteBytes?{state:"paused",reason:"estimated-write-bytes",until:re(e.oldestWriteAt,t.windowMs,n),...s,detail:`${r}/${t.maxEstimatedWriteBytes} estimated write bytes consumed`}:{state:"allowed",...s}:{state:"allowed",...s}}function ne(e){if(e.result!=="rebuilt")return!1;let t=oe(e.byLanguage);return t.length===0?!0:t.some(([,n])=>n.result==="rebuilt"&&n.strategy!=="incremental"&&n.strategy!=="reused")}function re(e,t,n){let r=e?Date.parse(e):Number.NaN;return Number.isFinite(r)&&r+t>n?r+t:n+t}function Me(e){return e==="manual-cli"||e==="setup"||e==="watch-source"||e==="watch-startup"||e==="watch-demand"||e==="watch-git-head"||e==="watch-git-index"||e==="watch-git-state"||e==="unknown"}function C(e){try{return Te(e).size}catch{return 0}}function Ce(e){let t={};for(let n of e.languages){let r=(e.shards??[]).filter(u=>u.language===n),a=r.find(u=>u.id===n),s=e.reused||(a?a.reused:r.length>0&&r.every(u=>u.reused)),i=C(ae(ie(e.dbPath),"language-indexes",`${n}.scip`)),c=i>0?i:a?.outputBytes??i,o=s?0:a?.durationMs??r.filter(u=>!u.reused).reduce((u,g)=>u+g.durationMs,0);t[n]={result:s?"reused":"rebuilt",strategy:s?"reused":a?.strategy??"full",...a?.strategy==="full"&&(a.fallbackReason??a.missReason)?{fallbackReason:a.fallbackReason??a.missReason}:{},outputBytes:c,producedOutputBytes:s?0:a?.producedOutputBytes??c,durationMs:o}}return t}function De(e){if(e===void 0)return{hasLanguageDetails:!1,invalidLanguageDetails:0};if(!e||typeof e!="object"||Array.isArray(e))return{hasLanguageDetails:!1,invalidLanguageDetails:1};let t={},n=0;for(let[a,s]of Object.entries(e)){if(!$e(a)||!We(s)){n+=1;continue}t[a]=s}let r=Object.keys(t).length>0;return{...r?{byLanguage:t}:{},hasLanguageDetails:r,invalidLanguageDetails:n}}function We(e){if(!e||typeof e!="object")return!1;let t=e;return(t.result==="rebuilt"||t.result==="reused")&&(t.strategy===void 0||t.strategy==="reused"||t.strategy==="incremental"||t.strategy==="full")&&(t.fallbackReason===void 0||typeof t.fallbackReason=="string")&&N(t.outputBytes)&&N(t.producedOutputBytes)&&b(t.durationMs)&&(t.result!=="reused"||t.producedOutputBytes===0&&t.durationMs===0)&&t.producedOutputBytes<=t.outputBytes}function $e(e){return I.includes(e)}function oe(e){return e?I.flatMap(t=>{let n=e[t];return n?[[t,n]]:[]}):[]}function Fe(){return{runs:0,rebuilt:0,reused:0,producedOutputBytes:0,durationMs:0}}function Ge(e){let t=e.invalidLanguageDetails??0,n=e.attributedRuns??0;return(e.unattributedRuns??0)===0&&t===0?"complete":n===0?"unavailable":"partial"}function Ue(e){return e.endsWith(`
4
- `)||(e=e.slice(0,Math.max(0,e.lastIndexOf(`
5
- `)+1))),e.split(`
6
- `).filter(t=>t.length>0)}function ct(e){let t=JSON.stringify(e);return Buffer.byteLength(t)<=65536?t:void 0}function gt(e){if(!(!e||Buffer.byteLength(e)>65536))try{return je(JSON.parse(e))}catch{return}}function je(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e;if(t.version!==1||t.baseGeneration!==null&&typeof t.baseGeneration!="string"||typeof t.complete!="boolean"||!Array.isArray(t.entries)||t.entries.length>1024||t.incompleteReason!==void 0&&typeof t.incompleteReason!="string")return;let n=[],r=new Set;for(let a of t.entries){if(!a||typeof a!="object"||Array.isArray(a))return;let s=a;if(typeof s.path!="string"||!ze(s.path)||s.kind!=="add"&&s.kind!=="change"&&s.kind!=="delete"||r.has(s.path))return;r.add(s.path),n.push({path:s.path,kind:s.kind})}if(!(t.complete&&t.incompleteReason!==void 0)&&!(!t.complete&&(!t.incompleteReason||t.incompleteReason.trim()==="")))return{version:1,baseGeneration:t.baseGeneration,complete:t.complete,...t.incompleteReason===void 0?{}:{incompleteReason:t.incompleteReason},entries:n}}function ze(e){return!e||e.includes("\0")||e.includes("\\")||e.startsWith("/")||/^[A-Za-z]:\//.test(e)?!1:e.split("/").every(t=>t!==""&&t!=="."&&t!=="..")}import{spawn as Xe}from"child_process";import{platform as ue}from"os";import{performance as de}from"perf_hooks";var bt={probe:1e4,git:3e4,analysis:18e4,install:3e5,indexer:6e5},v=class extends Error{constructor(n,r,a,s={}){super(a,s.cause===void 0?void 0:{cause:s.cause});this.kind=n;this.label=r;this.name="BoundedProcessError",this.timedOut=s.timedOut??!1,this.reaped=s.reaped??!1,this.stdout=s.stdout??"",this.stderr=s.stderr??"",this.stdoutTruncated=s.stdoutTruncated??!1,this.stderrTruncated=s.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 le(e,t,n,r){let a=Math.max(0,r-n);a>0&&e.push(t.subarray(0,a))}function ce(e,t,n){let r=Buffer.concat([...e,t]);e.length=0,e.push(r.subarray(Math.max(0,r.length-n)))}function xt(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((r,a)=>{let s=de.now(),i=ue()!=="win32"&&process.env.SCIP_REINDEX_PROCESS_GROUP_LEADER==="1",c=ue()!=="win32"&&!i,o;try{o=Xe(e.command,[...e.args??[]],{cwd:e.cwd,env:e.env,detached:c?!0:e.detached,stdio:["pipe","pipe","pipe"]})}catch(d){let f=d instanceof Error?d.message:String(d);a(new v("spawn",e.label,`${e.label} could not start: ${f}`,{cause:d,reaped:!0}));return}let u=[],g=[],l=0,m=0,R=!1,x=!1,p=null,y=!1,W=o.pid===void 0?null:U(o.pid,c),O=()=>{clearTimeout($),e.signal?.removeEventListener("abort",P)},k=d=>{if(y||!p)return;y=!0,O();let f=Buffer.concat(u).toString("utf8"),E=Buffer.concat(g).toString("utf8"),_=d.reaped||!d.detail?"":` Process-tree cleanup failed: ${d.detail}`;a(new v(p.kind,e.label,`${p.message}${_}`,{timedOut:p.timedOut,reaped:d.reaped,stdout:f,stderr:E,stdoutTruncated:R,stderrTruncated:x}))},B=d=>{if(!(p||y)){if(p=d,!W){k({reaped:o.pid===void 0,reason:o.pid===void 0?"terminated":"identity-unavailable"});return}j(W,{gracefulMs:t,forceMs:n}).then(k,f=>{k({reaped:!1,reason:"signal-failed",detail:f instanceof Error?f.message:String(f)})})}},$=setTimeout(()=>{B({kind:"timeout",timedOut:!0,message:`${e.label} timed out after ${e.timeoutMs}ms.`})},e.timeoutMs);$.unref();let P=()=>{B({kind:"aborted",timedOut:!1,message:`${e.label} was cancelled.`})};e.signal?.addEventListener("abort",P,{once:!0}),e.signal?.aborted&&P(),o.stdout.on("data",d=>{let f=Buffer.isBuffer(d)?d:Buffer.from(d);e.outputLimitBehavior==="truncate-tail"?ce(u,f,e.maxStdoutBytes):le(u,f,l,e.maxStdoutBytes),l+=f.length,l>e.maxStdoutBytes&&(R=!0,e.outputLimitBehavior!=="truncate-tail"&&B({kind:"stdout-limit",timedOut:!1,message:`${e.label} exceeded stdout limit (${e.maxStdoutBytes} bytes).`}))}),o.stderr.on("data",d=>{let f=Buffer.isBuffer(d)?d:Buffer.from(d);e.outputLimitBehavior==="truncate-tail"?ce(g,f,e.maxStderrBytes):le(g,f,m,e.maxStderrBytes),m+=f.length,m>e.maxStderrBytes&&(x=!0,e.outputLimitBehavior!=="truncate-tail"&&B({kind:"stderr-limit",timedOut:!1,message:`${e.label} exceeded stderr limit (${e.maxStderrBytes} bytes).`}))}),o.on("error",d=>{if(!y&&!p){if(o.pid===void 0){O(),y=!0,a(new v("spawn",e.label,`${e.label} could not start: ${d.message}`,{cause:d,reaped:!0}));return}B({kind:"spawn",timedOut:!1,message:`${e.label} failed after start: ${d.message}`})}}),o.on("close",(d,f)=>{if(y||p)return;y=!0,O();let E=Buffer.concat(u).toString("utf8"),_=Buffer.concat(g).toString("utf8");r({status:d,signal:f,stdout:E,stderr:_,timedOut:!1,durationMs:de.now()-s,stdoutTruncated:R,stderrTruncated:x})}),e.input===void 0?o.stdin.end():o.stdin.end(e.input)})}export{bt as a,v as b,xt as c,V as d,L as e,Y as f,Oe as g,st as h,ot as i,ut as j,we as k,dt as l,ct as m,gt as n};
7
- //# sourceMappingURL=chunk-EDMB6SSO.js.map
@@ -1,3 +0,0 @@
1
- import{a as O,b as H,c as ce,e as le,f as U,j as fe}from"./chunk-TQZV7KV4.js";import{R as v,S as de,d as ie,e as se,f as K,m as ae}from"./chunk-C7IJMOFP.js";import{a as A}from"./chunk-YXPUP5G2.js";import{d as w,e as pe}from"./chunk-DRENNWRG.js";import{c as re}from"./chunk-IW5XQG5G.js";import{a as j,e as x}from"./chunk-HGFDYOVB.js";import{h as ne,ia as oe,na as $}from"./chunk-AK3PYTIK.js";import{existsSync as E}from"fs";import b from"path";var _=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function z(i,t){let e=t?b.dirname(b.join(i,t)):i,o=b.resolve(i);for(;e.startsWith(o);){for(let a of _){let s=b.join(e,a);if(E(s))return s}let r=b.dirname(e);if(r===e)break;e=r}for(let r of _){let a=b.join(i,r);if(E(a))return a}return null}function ue(i){let t=i.config.projectRoot,n=new Set(Le(t,i.config.semantic?.typescript?.tsconfigs)),e=A(i,{includeIgnored:!1,extensions:O});for(let o of e){let r=z(t,o);r&&n.add(b.resolve(r))}if(n.size===0){let o=z(t);o&&n.add(b.resolve(o))}return[...n].filter(o=>!me(t,o)).sort((o,r)=>o.localeCompare(r))}function Le(i,t=[]){let n=new Set;for(let e of t){let o=b.isAbsolute(e)?e:b.join(i,e);E(o)&&n.add(b.resolve(o))}for(let e of we(i))for(let o of _){let r=b.join(e,o);E(r)&&n.add(b.resolve(r))}if(n.size===0){let e=z(i);e&&n.add(b.resolve(e))}return[...n].filter(e=>!me(i,e)).sort((e,o)=>e.localeCompare(o))}function we(i){let t=b.join(i,"package.json");if(!E(t))return[];let n;try{n=JSON.parse(ne(t,"project package manifest"))}catch{return[]}return(Array.isArray(n.workspaces)?n.workspaces:n.workspaces?.packages??[]).flatMap(o=>se(i,o))}function me(i,t){let n=b.relative(i,t).replace(/\\/g,"/");return n.startsWith("..")||n.includes("/node_modules/")||n.startsWith("node_modules/")||n.includes("/dist/")||n.startsWith("dist/")}import{performance as m}from"perf_hooks";function I(i,t,n){if(i.has(t))return i.get(t);let e=n();return i.set(t,e),e}import he from"path";import{realpathSync as ye}from"fs";function Ee(i,t){return i.getReferences().map(n=>{let e=n.getNode();return B(e,t)})}function je(i){let t=i;return typeof t.findReferences=="function"?t.findReferences():[]}function Se(i,t,n,e){let o=[];for(let r of je(i))for(let a of Ee(r,e))a.file===t.relativePath&&a.line>=t.startLine&&a.line<=t.endLine||o.push(a);for(let r of n)o.push(r);return P(o)}function be(i,t,n,e){let o=[],r=n?.getStart();for(let a of i.getReferences()){let s=a.getNode();L(e,s.getSourceFile().getFilePath())===t&&(r!==void 0&&s.getStart()===r||o.push({location:B(s,e),node:s}))}return o}function B(i,t){let n=i.getSourceFile(),e=n.getLineAndColumnAtPos(i.getStart());return{file:L(t,n.getFilePath())??n.getBaseName(),line:e.line-1,column:e.column-1}}function Me(i,t,n){let e=i.getSourceFile(),o=q(e,i),r=i.getText(),a=new RegExp(`\\b${ae(r)}\\b`,"g"),s=e.getFullText().split(`
2
- `),c=[];for(let l=0;l<s.length;l++){if(l===o)continue;let f=s[l]??"";a.lastIndex=0;let p;for(;(p=a.exec(f))!==null;)c.push({file:t,line:l,column:p.index})}return P(c.filter(l=>L(n,he.join(n,l.file))===t))}function V(i){for(let t=i;t;t=t.getParent()){let n=t.getKindName();if(n.includes("Type")||n==="InterfaceDeclaration"||n==="TypeAliasDeclaration")return!0;if(n==="CallExpression"||n==="NewExpression"||n==="ExpressionStatement")return!1}return!1}function q(i,t){return i.getLineAndColumnAtPos(t.getStart()).line-1}function P(i){let t=new Set,n=[];for(let e of i){let o=`${e.file}:${e.line}:${e.column}`;t.has(o)||(t.add(o),n.push(e))}return n}function L(i,t){let n=i||process.cwd(),e=ge(n,t);if(e)return e;try{return ge(ye(n),ye(t))}catch{return null}}function ge(i,t){let n=he.relative(i,t).replace(/\\/g,"/");return!n||n===".."||n.startsWith("../")?null:n}function Ie(i,t,n,e){let o=Ae(t,e);return o.size===0?new Map:Oe(i,n,o)}function Ae(i,t){let n=new Map;for(let e of v(i,t)){let o=w(e.symbol)??e.leaf;if(!o)continue;let r=n.get(o);r||(r=[],n.set(o,r)),r.push(e)}return n}function Oe(i,t,n){let e=new Map,o=new Map;return t.forEachDescendant(r=>{for(let a of He(i,r)){let s=n.get(a);if(!s)continue;let c=q(t,r);for(let l of s){if(c<l.startLine-1||c>l.endLine+1)continue;let f=Math.abs(c-l.startLine),p=o.get(l.symbolId);p!==void 0&&p<=f||(o.set(l.symbolId,f),e.set(l.symbolId,r))}}}),e}function He(i,t){let n=[],e=o=>{o&&!n.includes(o)&&n.push(o)};if("getNameNode"in t&&typeof t.getNameNode=="function"){let o=t.getNameNode();e(o?.getText())}if("getName"in t&&typeof t.getName=="function"){let o=t.getName();e(o)}return i.Node.isIdentifier(t)&&e(t.getText()),n}var Ue=re("ts-definition-leaf-candidates",{clearGroups:["definition-catalog"]});function Fe(i,t,n,e){let o=J(i,t),r=Y(o.get(e)??[],n);if(r)return r;let a=[];for(let s of o.values())for(let c of s)((c.leaf||w(c.symbol)||"").includes(e)||c.symbol.includes(e))&&a.push(c);return Y(a,n)}function G(i,t,n,e){return Y(J(i,t).get(e)??[],n)}function xe(i,t){let n=new Map;for(let[e,o]of J(i,t)){let r=o[0];r&&n.set(e,r)}return n}function J(i,t){return Ue.get(i,t,()=>{let n=new Map;for(let e of v(i,t)){let o=e.leaf||w(e.symbol);if(!o)continue;let r=n.get(o);r||(r=[],n.set(o,r)),r.push({...e,leaf:o})}for(let e of n.values())e.sort((o,r)=>o.startLine-r.startLine||o.endLine-r.endLine||o.symbolId-r.symbolId);return n})}function Y(i,t){let n=null,e=Number.POSITIVE_INFINITY;for(let o of i){let r=Math.abs(o.startLine-t);(r<e||r===e&&n&&o.startLine<n.startLine)&&(n=o,e=r)}return n}import Be from"path";import{realpathSync as We}from"fs";function ke(i,t){let n=new Map,e=null,o=null,r=()=>(o??=A(i,{extensions:O}),o),a=()=>(e??=x("typescript.source-file-index",()=>$e(i.config.projectRoot,t,r()),()=>({projects:t.length,indexedDocuments:r().length})),e),s=c=>H(c)?I(n,c,()=>{let l=Te(i.config.projectRoot,c);if(!l)return null;for(let{project:f,sourceFiles:p}of a()){let d=p.get(l)??null;if(d||(d=f.addSourceFileAtPathIfExists(l)??null,d&&X(p,d)),d)return{project:f,sourceFile:d}}return null}):null;return{sourceFile:c=>s(c)?.sourceFile??null,sourceFileMatch:s,indexedTypeScriptLikeDocuments:r}}function $e(i,t,n){let e=t.map(({project:o})=>{let r=new Map;for(let a of o.getSourceFiles())X(r,a);return{project:o,sourceFiles:r}});for(let o of n){let r=Te(i,o);if(r)for(let a of e){if(a.sourceFiles.has(r))break;let s=a.project.addSourceFileAtPathIfExists(r)??null;if(s){X(a.sourceFiles,s);break}}}return e}function X(i,t){let n=Q(t.getFilePath());i.set(n,t);try{i.set(Q(We(n)),t)}catch(e){if(!$(e))throw e}}function Te(i,t){try{return Q(oe(i,t,{inputKind:"indexed TypeScript source file"}).absolutePath)}catch(n){if(!$(n))throw n;return null}}function Q(i){return Be.resolve(i)}function Z(i,t){for(let n of i)if(t===n.name||t.startsWith(`${n.name}/`))return n.name;return null}function De(i){let t=`${i.relativeDir}/src`;return[`${t}/index.ts`,`${t}/index.tsx`,`${t}/index.mts`,`${t}/index.cts`]}var Ke=32;function Vt(i,t){let n=x("typescript.provider.load",()=>ce());if(!n)return U("ts-morph is not installed");let e=x("typescript.provider.tsconfig-discovery",()=>ue(i));if(e.length===0)return U("no tsconfig found");try{let o=x("typescript.provider.project-bundles",()=>le(n,e),()=>({tsconfigs:e.length}));return _e(i,n,o)}catch(o){return U(o instanceof Error?o.message:String(o),e[0],e)}}function _e(i,t,n,e={}){return x("typescript.provider.construct",()=>new ee(i,t,n),()=>({tsconfigs:n.length,reusedProjects:e.reusedProjects===!0}))}var ee=class{constructor(t,n,e){this.db=t;this.tsMorph=n;this.projects=e;this.workspacePackages=ie(t.config.projectRoot),this.sourceFiles=ke(t,e)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;definitionNodeCache=new Map;fileDefinitionNodeCache=new Map;indexedDefinitionLeafCache=new Map;compilerCheckerCache=new WeakMap;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;sourceFiles;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(t=>t.tsconfigPath)}}importUsage(t){return I(this.importUsageCache,t,()=>{let n=this.sourceFiles.sourceFile(t);if(!n)return[];let e=Ve();return x("typescript.import-usage.file",()=>this.importUsageForSourceFile(t,n,e),()=>({file:t,...e}))})}referencesFor(t){return I(this.referencesCache,t.symbolId,()=>{let n=this.nodeForDefinition(t);return this.referencesForDefinitionNode(t,n)})}referencesForDefinitions(t,n={}){let e=new Map,o=j(),r=[];for(let f of t){let p=this.referencesCache.get(f.symbolId);p?e.set(f.symbolId,p):r.push(f)}if(r.length===0)return e;let a=r,s=n.exact?[]:r.filter(f=>!Ce(f));if(s.length>=Ke){let f=this.referencesForDefinitionsBySymbolScan(s);for(let p of s){let d=f.get(p.symbolId)??[];this.referencesCache.set(p.symbolId,d),e.set(p.symbolId,d)}if(a=r.filter(p=>Ce(p)),a.length===0)return e}let c=new Map;for(let f of a){let p=c.get(f.relativePath);p?p.push(f):c.set(f.relativePath,[f])}let l=[];for(let[f,p]of c){let d=Re();x("typescript.references-map.file",()=>{let S=this.definitionNodesForFile(f);for(let y of p){o&&(d.cacheMisses+=1);let h=S.get(y.symbolId)??null;o&&(h?d.nodeHits+=1:d.nodeMisses+=1);try{let u=this.referencesForDefinitionNode(y,h,o?d:void 0);this.referencesCache.set(y.symbolId,u),e.set(y.symbolId,u)}catch{d.preciseSearchFailures+=1,l.push(y)}}},()=>({relativePath:f,definitions:p.length,...ve(d)}))}if(l.length>0){let f=this.referencesForDefinitionsBySymbolScan(l);for(let p of l){let d=f.get(p.symbolId)??[];this.referencesCache.set(p.symbolId,d),e.set(p.symbolId,d)}}return e}referenceFragmentsForFiles(t){let n=de(this.db).filter(r=>H(r.relativePath)),e=t.filter(r=>this.sourceFiles.sourceFile(r)!==null),o=this.referencesForDefinitionsBySymbolScan(n,e);return fe(n,o,e)}referencesForDefinitionsBySymbolScan(t,n){let e=j(),o=Re(),r=new Map,a=new Set(t.map(c=>c.symbolId)),s=new Map(t.map(c=>[c.symbolId,c]));for(let c of t)r.set(c.symbolId,[]);return x("typescript.references-map.inverted-scan",()=>{let c=e?m.now():0,l=n?this.packageImportReferencesForFiles(n):this.packageImportReferences();for(let u of t){let g=l.get(u.symbolId)??[];if(g.length>0){let k=r.get(u.symbolId)??[];k.push(...g),r.set(u.symbolId,k)}e&&(o.packageReferenceCount+=g.length)}e&&(o.packageRefsMs+=m.now()-c);let f=new Map,p=new Map,d=this.hierarchyTargetsForDefinitions(t),S=new Set(t.map(u=>u.leaf).filter(Boolean)),y=e?m.now():0;for(let u of n??this.sourceFiles.indexedTypeScriptLikeDocuments()){if(this.db.isIgnored(u))continue;let g=this.sourceFiles.sourceFile(u);g&&(e&&(o.scanFiles+=1),this.addReferencesFromSourceFileScan(g,u,a,s,d,S,f,p,r,e?o:void 0))}e&&(o.scanMs+=m.now()-y);let h=e?m.now():0;this.addHierarchyMemberReferences(t,r,e?o:void 0),e&&(o.hierarchyMs+=m.now()-h);for(let[u,g]of r){let k=P(g);r.set(u,k),e&&(o.referenceCount+=k.length)}},()=>({definitions:t.length,...ve(o)})),r}addReferencesFromSourceFileScan(t,n,e,o,r,a,s,c,l,f){let p=this.compilerCheckerForSourceFile(t),d=t.compilerNode,S=Ge(t),y=h=>{if(this.tsMorph.ts.isIdentifier(h)){if(f&&(f.identifiers+=1),!a.has(h.text)&&!S.has(h.text)){this.tsMorph.ts.forEachChild(h,y);return}let u=this.compilerReferenceSymbol(p,h,f);if(u){let g;s.has(u)?g=s.get(u)??null:(g=this.referenceDefinitionFromCompilerSymbol(u),s.set(u,g)),f&&(g?f.targetHits+=1:f.targetMisses+=1);let k=I(c,u,()=>this.compilerSymbolKeys(u)),C=null,T=null,R=g&&e.has(g.symbolId)?o.get(g.symbolId):void 0;if(R&&(C=W(d,h),!Ne(R,n,C))){let N=d.getLineAndCharacterOfPosition(h.getStart(d));T={file:n,line:N.line,column:N.character};let D=l.get(R.symbolId)??[];D.push(T),l.set(R.symbolId,D),f&&(f.requestedHits+=1)}for(let N of k)for(let D of r.get(N)?.values()??[]){if(C??=W(d,h),Ne(D,n,C))continue;if(!T){let F=d.getLineAndCharacterOfPosition(h.getStart(d));T={file:n,line:F.line,column:F.character}}let M=l.get(D.symbolId)??[];M.push(T),l.set(D.symbolId,M),f&&(f.requestedHits+=1)}}}this.tsMorph.ts.forEachChild(h,y)};y(d)}hierarchyTargetsForDefinitions(t){let n=new Map;for(let e of t){let o=this.nodeForDefinition(e),r=o?.compilerNode;if(!r||!this.isHierarchyMethod(r))continue;let a=r.parent;if(!this.isHierarchyContainer(a))continue;let s=this.compilerCheckerForSourceFile(o.getSourceFile()),c=s.getSymbolAtLocation(r.name);if(c)for(let l of this.hierarchyMemberSymbols(s,a,c))for(let f of this.compilerSymbolKeys(l)){let p=n.get(f)??new Map;p.set(e.symbolId,e),n.set(f,p)}}return n}hierarchyMemberSymbols(t,n,e){let o=new Set,r=new Set,a=(s,c,l)=>{if(!r.has(s)){r.add(s),o.add(c);for(let f of l){let p=f.getProperty(e.name);p&&a(f,p,this.hierarchyAncestorTypesForType(t,f))}}};return a(t.getTypeAtLocation(n),e,this.hierarchyAncestorTypes(t,n)),o}addHierarchyMemberReferences(t,n,e){let o=new Map;for(let r of t){let a=this.nodeForDefinition(r),s=a?.compilerNode;if(!s||!this.isHierarchyMethod(s))continue;let c=s.parent;if(!this.isHierarchyContainer(c))continue;let l=this.compilerCheckerForSourceFile(a.getSourceFile()),f=l.getSymbolAtLocation(s.name);if(!f)continue;let p=s.getSourceFile(),d=p.getLineAndCharacterOfPosition(s.name.getStart(p)),S={definition:r,location:{file:r.relativePath,line:d.line,column:d.character}},y=n.get(r.symbolId)??[];for(let u of this.hierarchyMemberSymbols(l,c,f))if(u!==f)for(let g of this.compilerSymbolLocations(u))y.push(g),e&&(e.hierarchyReferences+=1);n.set(r.symbolId,y);let h=this.hierarchyRootMemberSymbols(l,c,f);for(let u of h){let g=o.get(u)??new Map;g.set(r.symbolId,S),o.set(u,g)}e&&(e.hierarchyDefinitions+=1)}for(let r of o.values())if(!(r.size<2)){e&&(e.hierarchyFamilies+=1);for(let{definition:a}of r.values()){let s=n.get(a.symbolId)??[];for(let c of r.values())c.definition.symbolId!==a.symbolId&&(s.push(c.location),e&&(e.hierarchyReferences+=1));n.set(a.symbolId,s)}}}hierarchyRootMemberSymbols(t,n,e){let o=new Set,r=new Set,a=(s,c,l)=>{if(r.has(s))return;r.add(s);let f=!1;for(let p of l){let d=p.getProperty(e.name);d&&(f=!0,a(p,d,this.hierarchyAncestorTypesForType(t,p)))}if(!f)for(let p of this.compilerSymbolKeys(c))o.add(p)};return a(t.getTypeAtLocation(n),e,this.hierarchyAncestorTypes(t,n)),o}compilerSymbolKeys(t){return(t.declarations??[]).map(n=>{let e=n.getSourceFile();return`${e.fileName}\0${n.getStart(e)}\0${t.name}`})}compilerSymbolLocations(t){let n=[];for(let e of t.declarations??[]){let o=e.getSourceFile(),r=L(this.db.config.projectRoot,o.fileName);if(!r)continue;let a=e.name,s=o.getLineAndCharacterOfPosition((a??e).getStart(o));n.push({file:r,line:s.line,column:s.character})}return n}baseTypes(t,n){try{return t.getBaseTypes(n)??[]}catch{return[]}}hierarchyAncestorTypes(t,n){let e=new Set(this.hierarchyAncestorTypesForType(t,t.getTypeAtLocation(n)));for(let o of n.heritageClauses??[])for(let r of o.types)e.add(t.getTypeAtLocation(r));return[...e]}hierarchyAncestorTypesForType(t,n){let e=new Set(this.baseTypes(t,n));for(let o of n.getSymbol()?.declarations??[])if(this.isHierarchyContainer(o))for(let r of o.heritageClauses??[])for(let a of r.types)e.add(t.getTypeAtLocation(a));return[...e]}isHierarchyMethod(t){return this.tsMorph.ts.isMethodDeclaration(t)||this.tsMorph.ts.isMethodSignature(t)}isHierarchyContainer(t){return this.tsMorph.ts.isClassDeclaration(t)||this.tsMorph.ts.isClassExpression(t)||this.tsMorph.ts.isInterfaceDeclaration(t)}compilerReferenceSymbol(t,n,e){e&&(e.symbolLookups+=1);let o=t.getSymbolAtLocation(n);if(o){if((o.flags&this.tsMorph.ts.SymbolFlags.Alias)===0)return o;try{return e&&(e.aliasResolutions+=1),t.getAliasedSymbol(o)}catch{return o}}}calleesFor(t){return I(this.calleesCache,t.symbolId,()=>I(this.fileCalleesCache,t.relativePath,()=>this.calleeMapForFile(t.relativePath)).get(t.symbolId)??[])}calleesForDefinitions(t){let n=new Map,e=new Map;for(let o of t){let r=e.get(o.relativePath);r?r.push(o):e.set(o.relativePath,[o])}for(let[o,r]of e){let a=this.fileCalleesCache.get(o),s=new Set(r.map(l=>l.symbolId)),c=a??this.calleeMapForFile(o,s);for(let l of r){let f=c.get(l.symbolId)??[];this.calleesCache.set(l.symbolId,f),n.set(l.symbolId,f)}}return n}referencesForDefinitionNode(t,n,e){let o=e?m.now():0,r=this.packageImportReferencesForDefinition(t);if(e&&(e.packageRefsMs+=m.now()-o,e.packageReferenceCount+=r.length),!n)return r;let a=e?m.now():0,s=Se(n,t,r,this.db.config.projectRoot);return e&&(e.semanticRefsMs+=m.now()-a,e.referenceCount+=s.length),s}signatureFor(t){return I(this.signatureCache,t.symbolId,()=>{let n=this.nodeForDefinition(t);if(!n||!this.tsMorph.Node.isFunctionDeclaration(n)&&!this.tsMorph.Node.isMethodDeclaration(n)&&!this.tsMorph.Node.isArrowFunction(n)&&!this.tsMorph.Node.isFunctionExpression(n)&&!this.tsMorph.Node.isConstructorDeclaration(n))return null;let e=n.getType().getCallSignatures()[0];if(!e)return null;let o=e.getParameters().map(a=>{let s=a.getDeclarations()[0],c=s?a.getTypeAtLocation(s).getText(s):a.getValueDeclaration()?.getType().getText()??"unknown";return Pe(c)}),r=e.getReturnType().getText(n);return`(${o.join(",")})=>${Pe(r)}`})}importUsageForSourceFile(t,n,e){let o=[],r=new Map;for(let a of n.getImportDeclarations()){e.declarations+=1;let s=K(this.db,t,a.getModuleSpecifierValue()),c=a.getImportClause()?.isTypeOnly()??!1;for(let l of te(a)){e.entries+=1;let f=c?null:l.identifier?.getSymbol()?.compilerSymbol??null;!c&&l.identifier&&(f?e.bindingSymbols+=1:e.missingBindingSymbols+=1);let p={sourcePath:s,entry:l,typeOnlyDeclaration:c,bindingSymbol:f,references:[]};if(o.push(p),c||!l.localName||!f)continue;let d=r.get(l.localName);d?d.push(p):r.set(l.localName,[p])}}return r.size>0&&n.forEachDescendant(a=>{if(a.getKindName()!=="Identifier")return;let s=r.get(a.getText());if(!s||qe(a))return;e.scannedIdentifiers+=1;let c=a.getSymbol()?.compilerSymbol;if(e.symbolLookups+=1,!!c){for(let l of s)if(l.bindingSymbol===c){l.references.push({location:B(a,this.db.config.projectRoot),node:a}),e.matchedReferences+=1;break}}}),o.map(a=>a.typeOnlyDeclaration?ze(t,a.sourcePath,a.entry):a.entry.identifier&&!a.bindingSymbol?(e.fallbackEntries+=1,this.valueImportUsageForEntry(t,a.sourcePath,a.entry)):this.valueImportUsageFromLocations(t,a.sourcePath,a.entry,a.references))}valueImportUsageForEntry(t,n,e){let o=e.identifier?e.identifier.findReferences():[],r=[];for(let a of o)for(let s of be(a,t,e.identifier,this.db.config.projectRoot))r.push(s);return this.valueImportUsageFromLocations(t,n,e,r)}valueImportUsageFromLocations(t,n,e,o){let r=o.some(c=>!V(c.node)),a=o.some(c=>V(c.node)),s=e.isTypeOnly;return{importer:t,sourcePath:n,importedName:e.importedName,localName:e.localName,kind:e.kind,isTypeOnly:s,isUsed:s||o.length>0,isTypeUsed:s||a,isValueUsed:r,references:o.map(c=>c.location)}}packageImportReferencesForDefinition(t){return this.packageImportReferences().get(t.symbolId)??[]}packageImportReferencesForFiles(t){let n=new Map,e=new Set;for(let r of t){let a=this.sourceFiles.sourceFile(r);if(a)for(let s of a.getImportDeclarations()){let c=Z(this.workspacePackages,s.getModuleSpecifierValue());c&&e.add(c)}}if(e.size===0)return n;let o=this.packageExportsForNames(e);for(let r of t)this.addPackageImportReferencesForDocument(n,o,r);for(let[r,a]of n)n.set(r,P(a));return n}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let t=new Map,n=this.packageExports();for(let e of this.sourceFiles.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(t,n,e);for(let[e,o]of t)t.set(e,P(o));return this.packageImportReferenceIndex=t,t}addPackageImportReferencesForDocument(t,n,e){if(this.db.isIgnored(e))return;let o=this.sourceFiles.sourceFileMatch(e);if(o)for(let r of o.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(t,n,e,r)}addPackageImportReferencesForDeclaration(t,n,e,o){let r=Z(this.workspacePackages,o.getModuleSpecifierValue());if(!r)return;let a=n.get(r);if(a)for(let s of te(o)){if(s.kind!=="named"||!s.identifier)continue;let c=a.get(s.importedName);if(!c||c.size===0)continue;let l=Me(s.identifier,e,this.db.config.projectRoot);l.length>0&&Ze(t,c,l)}}packageExports(){return this.packageExportIndex?this.packageExportIndex:(this.packageExportIndex=this.packageExportsForNames(new Set(this.workspacePackages.map(t=>t.name))),this.packageExportIndex)}packageExportsForNames(t){let n=new Map;for(let e of this.workspacePackages){if(!t.has(e.name))continue;let o=new Map;for(let r of De(e))this.collectPackageExports(e,r,o,new Set);o.size>0&&n.set(e.name,o)}return n}collectPackageExports(t,n,e,o){if(o.has(n))return;o.add(n);let r=this.sourceFiles.sourceFile(n);if(r)for(let a of r.getExportDeclarations()){let s=a.getModuleSpecifierValue(),c=s?K(this.db,n,s):n;if(!c||!c.startsWith(`${t.relativeDir}/src/`))continue;let l=a.getNamedExports();if(l.length===0){if(a.isNamespaceExport())continue;this.collectPackageExports(t,c,e,o);continue}for(let f of l){let p=f.getNameNode().getText(),d=f.getAliasNode()?.getText()??p,S=this.indexedDefinitionByLeaf(c,p);if(!S)continue;let y=e.get(d);y||(y=new Set,e.set(d,y)),y.add(S.symbolId)}}}indexedDefinitionByLeaf(t,n){return I(this.indexedDefinitionLeafCache,t,()=>xe(this.db,t)).get(n)??null}nodeForDefinition(t){return I(this.definitionNodeCache,t.symbolId,()=>this.definitionNodesForFile(t.relativePath).get(t.symbolId)??null)}definitionNodesForFile(t){return I(this.fileDefinitionNodeCache,t,()=>{let n=this.sourceFiles.sourceFile(t);return n?Ie(this.tsMorph,this.db,n,t):new Map})}referenceDefinitionFromCompilerSymbol(t){return this.definitionFromCompilerSymbol(t,void 0,!0)}definitionFromCompilerSymbol(t,n,e=!1){let o=t.name,r=n?m.now():0,a=t.declarations??[];n&&(n.declarationsMs+=m.now()-r,n.declarationChecks+=a.length);for(let s of a){let c=n?m.now():0,l=s.getSourceFile(),f=L(this.db.config.projectRoot,l.fileName),p=l.getLineAndCharacterOfPosition(s.getStart(l)).line;if(n&&(n.declarationLocationMs+=m.now()-c),!f||this.db.isIgnored(f))continue;let d=n?m.now():0,S=this.compilerDeclarationName(s),y=e?G(this.db,f,p,o)??(S&&S!==o?G(this.db,f,p,S):null):Fe(this.db,f,p,o);if(n&&(n.indexedLookupMs+=m.now()-d),y)return{symbolId:y.symbolId,symbol:y.symbol,file:y.relativePath,line:y.startLine}}return null}compilerDeclarationName(t){let n=t.name;return n&&this.tsMorph.ts.isIdentifier(n)?n.text:null}calleeMapForFile(t,n){let e=j(),o=0,r=0,a=0,s=0,c=0,l=0,f=0,p=0,d=e?Xe():void 0;return x("typescript.callee-map.file",()=>{let S=e?m.now():0,y=this.sourceFiles.sourceFile(t);if(e&&(c=Math.round(m.now()-S)),!y)return new Map;let h=e?m.now():0,u=v(this.db,t).sort((M,F)=>M.startLine-F.startLine||F.endLine-M.endLine);if(e&&(l=Math.round(m.now()-h)),o=u.length,u.length===0)return new Map;let g=new Map,k=e?m.now():0,C=this.compilerCheckerForSourceFile(y),T=y.compilerNode;e&&(f=Math.round(m.now()-k));let R=new Map,N=M=>{if(this.tsMorph.ts.isCallExpression(M)||this.tsMorph.ts.isNewExpression(M)){e&&(r+=1);let F=this.semanticCalleeForCallNode(C,T,u,M,R,n,d);F&&(e&&(a+=1),Ye(g,F.callerId,F.target))}this.tsMorph.ts.forEachChild(M,N)},D=e?m.now():0;N(T),e&&(p=Math.round(m.now()-D));for(let[M,F]of g)g.set(M,et(F));return s=g.size,g},()=>({relativePath:t,definitions:o,callNodes:r,resolvedCallees:a,outputRows:s,requestedDefinitions:n?.size??o,sourceFileLookupMs:c,definitionsLoadMs:l,checkerLookupMs:f,traversalMs:p,...d?Qe(d):{}}))}semanticCalleeForCallNode(t,n,e,o,r,a,s){let c=s?m.now():0,l=Je(e,W(n,o));if(s&&(s.callerLookupMs+=m.now()-c),!l)return null;if(a&&!a.has(l.symbolId))return s&&(s.skippedUnrequestedCallers+=1),null;let f=o.expression,p=this.compilerSymbolForExpression(t,f,s),d=null;if(p)if(s&&(s.targetSymbolHits+=1),r.has(p))s&&(s.compilerSymbolCacheHits+=1),d=r.get(p)??null;else{s&&(s.compilerSymbolCacheMisses+=1);let S=s?m.now():0;d=this.definitionFromCompilerSymbol(p,s),s&&(s.targetLookupMs+=m.now()-S),r.set(p,d)}else s&&(s.targetMisses+=1);return d?{callerId:l.symbolId,target:{symbol:d.symbol,file:d.file,line:d.line,callsiteLine:W(n,o)}}:null}compilerSymbolForExpression(t,n,e){let o=e?m.now():0,r=t.getSymbolAtLocation(n);if(e&&(e.expressionSymbolMs+=m.now()-o),r)return r;e&&(e.typeFallbacks+=1);let a=e?m.now():0,s=t.getTypeAtLocation(n).getSymbol();return e&&(e.typeSymbolMs+=m.now()-a),s}compilerCheckerForSourceFile(t){let n=t.getProject(),e=this.compilerCheckerCache.get(n);return e||(e=n.getTypeChecker().compilerObject,this.compilerCheckerCache.set(n,e)),e}};function te(i){let t=[],n=i.getDefaultImport();n&&t.push({identifier:n,importedName:"default",localName:n.getText(),kind:"default",isTypeOnly:i.getImportClause()?.isTypeOnly()??!1});let e=i.getNamespaceImport();e&&t.push({identifier:e,importedName:"*",localName:e.getText(),kind:"namespace",isTypeOnly:i.getImportClause()?.isTypeOnly()??!1});for(let o of i.getNamedImports()){let r=o.getNameNode(),s=o.getAliasNode()??(r.getKindName()==="Identifier"?r:null);t.push({identifier:s,importedName:r.getText(),localName:s?.getText()??r.getText(),kind:"named",isTypeOnly:o.isTypeOnly()||(i.getImportClause()?.isTypeOnly()??!1)})}return t.length===0&&t.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),t}function ze(i,t,n){return{importer:i,sourcePath:t,importedName:n.importedName,localName:n.localName,kind:n.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function Ve(){return{declarations:0,entries:0,bindingSymbols:0,missingBindingSymbols:0,scannedIdentifiers:0,symbolLookups:0,matchedReferences:0,fallbackEntries:0}}function qe(i){for(let t=i;t;t=t.getParent())if(t.getKindName()==="ImportDeclaration")return!0;return!1}function Ye(i,t,n){let e=i.get(t);e||(e=[],i.set(t,e)),e.push(n)}function Ge(i){let t=new Set;for(let n of i.getImportDeclarations())for(let e of te(n))e.localName&&t.add(e.localName);return t}function Je(i,t){let n=null;for(let e of i)t<e.startLine||t>e.endLine||(!n||e.startLine>=n.startLine)&&(n=e);return n}function W(i,t){return i.getLineAndCharacterOfPosition(t.getStart(i)).line}function Ne(i,t,n){return t===i.relativePath&&n>=i.startLine&&n<=i.endLine}function Ce(i){return i.symbol.includes("#")?pe(i.symbol)==="type"&&i.relativePath.endsWith(".d.ts"):!1}function Xe(){return{callerLookupMs:0,expressionSymbolMs:0,typeSymbolMs:0,targetLookupMs:0,declarationsMs:0,declarationLocationMs:0,indexedLookupMs:0,compilerSymbolCacheHits:0,compilerSymbolCacheMisses:0,targetSymbolHits:0,targetMisses:0,typeFallbacks:0,declarationChecks:0,skippedUnrequestedCallers:0}}function Qe(i){return{...i,callerLookupMs:Math.round(i.callerLookupMs),expressionSymbolMs:Math.round(i.expressionSymbolMs),typeSymbolMs:Math.round(i.typeSymbolMs),targetLookupMs:Math.round(i.targetLookupMs),declarationsMs:Math.round(i.declarationsMs),declarationLocationMs:Math.round(i.declarationLocationMs),indexedLookupMs:Math.round(i.indexedLookupMs)}}function Re(){return{cacheHits:0,cacheMisses:0,nodeHits:0,nodeMisses:0,scanFiles:0,identifiers:0,symbolLookups:0,aliasResolutions:0,targetHits:0,targetMisses:0,requestedHits:0,scanMs:0,packageRefsMs:0,semanticRefsMs:0,packageReferenceCount:0,referenceCount:0,preciseSearchFailures:0,hierarchyDefinitions:0,hierarchyFamilies:0,hierarchyReferences:0,hierarchyMs:0}}function ve(i){return{...i,scanMs:Math.round(i.scanMs),packageRefsMs:Math.round(i.packageRefsMs),semanticRefsMs:Math.round(i.semanticRefsMs),hierarchyMs:Math.round(i.hierarchyMs)}}function Ze(i,t,n){for(let e of t){let o=i.get(e)??[];o.push(...n),i.set(e,o)}}function et(i){let t=new Set,n=[];for(let e of i){let o=`${e.symbol}|${e.file}|${e.line}|${e.callsiteLine??""}`;t.has(o)||(t.add(o),n.push(e))}return n}function Pe(i){return i.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}export{ue as a,Vt as b,_e as c};
3
- //# sourceMappingURL=chunk-EETGXQY7.js.map
@@ -1,2 +0,0 @@
1
- import{b as R}from"./chunk-T6QD2ZQB.js";import{b as T,d as b,g as z,h as _,i as O}from"./chunk-TQZV7KV4.js";import{a as A,c as N}from"./chunk-C7IJMOFP.js";import{a as G}from"./chunk-YXPUP5G2.js";import{b as k}from"./chunk-DKM723YF.js";import{d as H}from"./chunk-K3XFWJI2.js";import{d as B}from"./chunk-IW5XQG5G.js";import{e as w}from"./chunk-HGFDYOVB.js";import{m as E,o as C}from"./chunk-AK3PYTIK.js";function P(e){let t=v(e.projectFiles),n=new Set(t),c=new Map(e.snapshot.files.map(r=>[r.path,r])),s=e.snapshot.files.filter(r=>{let o=E(r.path,["typescript"]);return o==="config"||o==="ambient"}).map(r=>r.path),i=v([...t,...s]),a=i.find(r=>!c.has(r)),u=new Set(e.snapshot.files.map(r=>r.path)).size!==e.snapshot.files.length,m=!a&&i.some(r=>J(c.get(r))),f=k(JSON.stringify({pnpmWorkspaces:e.snapshot.pnpmWorkspaces,typescriptProjectMode:e.snapshot.typescriptProjectMode,typescriptProjects:v(e.snapshot.typescriptProjects),membership:t})),y,l;return{identityFor(r,o){if(!n.has(r))return g("target-outside-project");if(u)return g("duplicate-input-path");if(a)return g("missing-input-fingerprint");if(m)return g("unreadable-input");let d=[],p,S;if(e.graph===null)d.push("dependency-graph-unavailable"),S="whole-project",p=i;else{let h=r===y&&l?l:Y(r,e.graph);if(y=r,l=h,h.find(j=>!c.has(j)))return g("missing-input-fingerprint");if(p=v([...h,...s]),p.some(j=>J(c.get(j))))return g("unreadable-input");S="dependency-closure"}let W=p.map(h=>q(c.get(h)));return{version:1,key:k(JSON.stringify({version:1,engineIdentity:e.engineIdentity,schemaVersion:o,projectIdentity:f,inputs:W})),mode:S,inputFiles:p,reasons:d}}}}function Y(e,t){let n=new Set,c=[e];for(let s=0;s<c.length;s+=1){let i=c[s];if(!(i===void 0||n.has(i))){n.add(i);for(let a of[...t.get(i)??[]].sort())n.has(a)||c.push(a)}}return[...n].sort()}function q(e){return e.semanticHash===void 0?{path:e.path,size:e.size,hash:e.hash}:{path:e.path,semanticHash:e.semanticHash}}function J(e){return e.size<0||e.hash==="unreadable"}function g(e){return{version:1,key:null,mode:"unkeyed",inputFiles:[],reasons:[e]}}function v(e){return[...new Set(e)].sort()}var L=B("typescript-semantic-identity-context",{clearGroups:["whole-project"]});function D(e,t,n){let c=L.get(e,()=>$(e));if(!c)return null;let s=`${n}\0${t}`,i=c.identities.get(s);if(i)return i;let a=c.builder.identityFor(t,n);return c.identities.set(s,a),a}function F(e){return G(e,{includeIgnored:!1}).filter(T).sort()}function $(e){try{if(!e.generation.metadataRaw)return null;let t=H(e.generation.metadataRaw);if(t.kind!=="legacy"&&t.kind!=="supported"||!t.capabilities.usableForEvidenceCache)return null;let n=C(t.metadata.fingerprint);return n?{builder:P({projectFiles:F(e),snapshot:n,graph:R(e),engineIdentity:b()}),identities:new Map}:null}catch{return null}}var M="typescript-reference-fragment-v2",U=128,x=A({kind:"typescript-reference-fragments",invalidation:N("typescript-reference-fragments"),serialize:e=>JSON.stringify(e),deserialize:X});function Re(e,t,n,c=e,s,i=new Set(n.keys())){let a=F(e),u=P({projectFiles:a,snapshot:t,graph:s??R(e),engineIdentity:b()}),m=[],f=0;for(let[l,r]of n){let o=u.identityFor(l,M).key;if(!o){f+=1;continue}m.push({relativePath:l,contentHash:o,value:[...r]})}let y=a.filter(l=>!i.has(l)&&!n.has(l)).length;return x.writeBatch(c,m),{affectedFiles:m.length,carriedFiles:y,skippedAffectedFiles:f}}function Te(e,t,n,c){let s=t.filter(a=>T(a.relativePath));if(s.length===0)return I("no TypeScript definitions");let i=I("shadow did not run");return w("typescript.reference-fragments.shadow",()=>{try{let a=c(s[0].relativePath);if(!a.availability().available||!a.referenceFragmentsForFiles)return i=I("TypeScript reference fragment provider is unavailable"),i;let u=F(e),m=new Set(u),f=new Map;for(let o of V(u)){let d=a.referenceFragmentsForFiles(o);if(o.some(p=>!d.has(p)))return i=I("TypeScript reference fragment provider returned an incomplete batch"),i;for(let p of o)f.set(p,d.get(p)??[])}let y=z(s,f),l=O(s,K(n,m),y);if(!l.passed)return i={state:"failing",files:u.length,keyedFiles:0,writtenFiles:0,...l},i;let r=[];for(let o of u){let d=D(e,o,M);d?.key&&r.push({relativePath:o,contentHash:d.key,value:f.get(o)??[]})}return x.writeBatch(e,r),i={state:"passing",files:u.length,keyedFiles:r.length,writtenFiles:r.length,...l},i}catch(a){return i=I(a instanceof Error?a.message:String(a)),i}},()=>({...i}))}function K(e,t){return new Map([...e].map(([n,c])=>[n,c.filter(s=>t.has(s.file))]))}function be(e,t,n){if(t.length===0)return{references:new Map,files:0,cacheHits:0,cacheMisses:0,computedFiles:0};let c="fallback",s=0,i=0,a=0,u=0;return w("typescript.reference-fragments.materialize",()=>{try{let m=F(e);s=m.length;let f=_(t),y=[];for(let r of m){let o=D(e,r,M);if(!o?.key)return null;let d=x.read(e,r,o.key);d===null?(a+=1,y.push({file:r,contentHash:o.key})):(i+=1,f.add(d))}if(a===0)return c="hit",{references:f.finish(),files:s,cacheHits:i,cacheMisses:a,computedFiles:u};let l=n(t[0].relativePath);if(!l.availability().available||!l.referenceFragmentsForFiles)return null;for(let r of V(y)){let o=r.map(({file:p})=>p),d=l.referenceFragmentsForFiles(o);if(o.some(p=>!d.has(p)))return null;x.writeBatch(e,r.map(({file:p,contentHash:S})=>({relativePath:p,contentHash:S,value:d.get(p)??[]})));for(let p of o)f.add(d.get(p)??[]);u+=r.length}return c="computed",{references:f.finish(),files:s,cacheHits:i,cacheMisses:a,computedFiles:u}}catch{return null}},()=>({state:c,files:s,cacheHits:i,cacheMisses:a,computedFiles:u}))}function V(e){let t=[];for(let n=0;n<e.length;n+=U)t.push(e.slice(n,n+U));return t}function I(e){return{state:"unavailable",files:0,keyedFiles:0,writtenFiles:0,expectedCount:0,actualCount:0,missing:[],extra:[],reason:e}}function X(e){try{let t=JSON.parse(e);return!Array.isArray(t)||!t.every(Z)?null:t}catch{return null}}function Z(e){if(!e||typeof e!="object")return!1;let t=e,n=t.location;return typeof t.targetSymbol=="string"&&!!n&&typeof n.file=="string"&&typeof n.line=="number"&&typeof n.column=="number"}export{D as a,Re as b,Te as c,be as d};
2
- //# sourceMappingURL=chunk-FKGQOTKD.js.map
@@ -1,5 +0,0 @@
1
- import{isAbsolute as nt,relative as Sn}from"path";var g=class extends Error{constructor(n,r){super(`refusing unsafe project file path ${JSON.stringify(n)} (${r})`);this.relativePath=n;this.reason=r;this.name="UnsafeProjectPathError"}relativePath;reason;code="SCIP_QUERY_UNSAFE_PROJECT_PATH"};function Se(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function Gi(e){return e.replace(/\\/g,"/")}function Wi(e,t){return Se(e)===Se(t)}function j(e,t){let n=Sn(e,t);return n===""||!n.startsWith("..")&&!nt(n)}function w(e){if(!e)throw new g(e,"empty-path");if(e.includes("\0"))throw new g(e,"nul-byte");if(nt(e)||/^[A-Za-z]:/.test(e)||e.startsWith("//")||e.startsWith("\\\\"))throw new g(e,"absolute-path");let t=Se(e);if(t.split("/").some(r=>r===".."))throw new g(e,"parent-traversal");if(!t||t===".")throw new g(e,"empty-path");return t}function te(e,t,n=[]){let r=xe(e);if(ut.has(r)||n.some(o=>ee(r,o))||t.some(o=>pt(r,o)))return"config";if(t.some(lt)&&/\.d\.(?:ts|mts|cts)$/.test(r.toLowerCase()))return"ambient";let i=dt(r);return t.some(o=>(ft[o]??[]).includes(i))?"source":"other"}function ct(e,t,n){let r=xe(e);if(ut.has(r)||n?.some(o=>ee(r,o))||pt(r,t)||lt(t)&&/\.d\.(?:ts|mts|cts)$/.test(r.toLowerCase()))return!0;let i=dt(r);return(ft[t]??[]).includes(i)}function Hi(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.version!="number"||!it(t.languages)||typeof t.pnpmWorkspaces!="boolean"||typeof t.typescriptProjectMode!="string"||!it(t.typescriptProjects)||t.clojureConfigPath!==void 0&&typeof t.clojureConfigPath!="string"||!Array.isArray(t.files)||!t.files.every(be)?null:t}function rt(e){return{...e,files:e.files.map(({semanticHash:t,...n})=>n)}}function $i(e,t){return!e||!t?e===t:JSON.stringify(rt(e))===JSON.stringify(rt(t))}function Ui(e,t){let n=new Map((e?.files??[]).map(a=>[a.path,a])),r=new Map(t.files.map(a=>[a.path,a])),i=new Set([...n.keys(),...r.keys()]),o=[];for(let a of[...i].sort()){let c=n.get(a),u=r.get(a),d=te(a,t.languages);!c&&u?o.push({kind:"added",path:a,inputKind:d,after:u}):c&&!u?o.push({kind:"deleted",path:a,inputKind:d,before:c}):c&&u&&(c.hash!==u.hash||c.size!==u.size)&&o.push({kind:"modified",path:a,inputKind:d,before:c,after:u})}let s=new Set;return e||s.add("prior-snapshot-unavailable"),e&&e.version!==t.version&&s.add("snapshot-version-changed"),(ot(e?.files??[])||ot(t.files))&&s.add("duplicate-input-path"),[...e?.files??[],...t.files].some(bn)&&s.add("unreadable-input"),{version:1,changes:o,projectIdentityChanged:e?!xn(e,t):!0,uncertainty:[...s].sort()}}function it(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function ot(e){return new Set(e.map(t=>t.path)).size!==e.length}function be(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.path=="string"&&typeof t.size=="number"&&Number.isFinite(t.size)&&typeof t.hash=="string"&&(t.semanticHash===void 0||typeof t.semanticHash=="string")}function bn(e){return e.hash==="unreadable"||e.size<0}function xn(e,t){return st(e.languages,t.languages)&&e.pnpmWorkspaces===t.pnpmWorkspaces&&e.typescriptProjectMode===t.typescriptProjectMode&&st(e.typescriptProjects,t.typescriptProjects)&&e.clojureConfigPath===t.clojureConfigPath}function st(e,t){if(e.length!==t.length)return!1;let n=[...e].sort(),r=[...t].sort();return n.every((i,o)=>i===r[o])}var ut=new Set([".scipquery.json"]),Pn={typescript:["tsconfig.json"],javascript:["package.json"],java:["pom.xml","build.gradle"],scala:["build.sbt"],kotlin:["build.gradle.kts"],rust:["Cargo.toml"],python:["pyproject.toml","setup.py"],ruby:["Gemfile"],go:["go.mod"],cpp:["CMakeLists.txt","Makefile"],c:["CMakeLists.txt","Makefile"],csharp:["*.csproj","*.sln"],vb:["*.vbproj","*.sln"],dart:["pubspec.yaml"],php:["composer.json"],clojure:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"]},jn={typescript:["package.json","package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb","tsconfig.*.json","jsconfig.json","jsconfig.*.json"],javascript:["package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb","tsconfig.json","tsconfig.*.json","jsconfig.json","jsconfig.*.json"],java:["build.gradle.kts","settings.gradle","settings.gradle.kts","gradle.properties","gradle.lockfile","gradle-wrapper.properties"],scala:["plugins.sbt","build.properties"],kotlin:["pom.xml","build.gradle","settings.gradle","settings.gradle.kts","gradle.properties","gradle.lockfile","gradle-wrapper.properties"],rust:["Cargo.lock","rust-project.json","rust-toolchain","rust-toolchain.toml"],python:["setup.cfg","requirements*.txt","Pipfile","Pipfile.lock","poetry.lock","uv.lock"],ruby:["Gemfile.lock","gems.locked"],go:["go.sum","go.work","go.work.sum"],cpp:["compile_commands.json"],c:["compile_commands.json"],csharp:["Directory.Build.props","Directory.Build.targets","Directory.Packages.props","packages.lock.json","NuGet.Config","global.json"],vb:["Directory.Build.props","Directory.Build.targets","Directory.Packages.props","packages.lock.json","NuGet.Config","global.json"],dart:["pubspec.lock","analysis_options.yaml"],php:["composer.lock"],clojure:[]},at=new Map;function pt(e,t){return Pn[t].some(n=>ee(e,n))||jn[t].some(n=>ee(e,n))}function ee(e,t){let n=xe(t).replace(/^\.\//,"");if(!n)return!1;let r=e.split("/").at(-1)??e,i=n.includes("/")?e:r;if(!n.includes("*")&&!n.includes("?"))return i===n;let o=at.get(n);if(!o){let s=n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/\?/g,"[^/]");o=new RegExp(`^${s}$`),at.set(n,o)}return o.test(i)}function xe(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function dt(e){return e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:""}function lt(e){return e==="typescript"||e==="javascript"}var ft={typescript:[".ts",".tsx",".mts",".cts"],javascript:[".js",".jsx",".mjs",".cjs",".vue"],java:[".java"],scala:[".scala"],kotlin:[".kt",".kts"],rust:[".rs"],python:[".py",".pyi"],ruby:[".rb"],go:[".go"],cpp:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"],c:[".c",".h"],csharp:[".cs"],vb:[".vb"],dart:[".dart"],php:[".php"],clojure:[".clj",".cljs",".cljc"]};function R(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function gt(e){return typeof e=="string"&&Number.isFinite(Date.parse(e))}function Ji(e){return typeof e=="string"&&e.length>0}function Vi(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function Ki(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}var Cn=/^[a-f0-9]{64}$/u;function Yi(e){return typeof e=="string"&&Cn.test(e)}function Xi(e){return typeof e=="string"&&e.length>0&&e.length<=256&&!/[\0\r\n]/u.test(e)}function Qi(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}var ht=["typescript","javascript","java","scala","kotlin","rust","python","ruby","go","cpp","c","csharp","vb","dart","php","clojure"];var Pe=2,v=3;var je=new Set(ht);function oo(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch(s){return{kind:"malformed",reason:`invalid JSON: ${vn(s)}`}}if(!R(t))return{kind:"malformed",reason:"metadata must be a JSON object"};let n=t.version;if(!Number.isInteger(n))return{kind:"malformed",reason:"version must be an integer"};if(n!==Pe&&n!==v)return{kind:"unsupported",version:n,direction:n<Pe?"older":"future"};let r=kn(t,n);if(r)return{kind:"malformed",reason:r};let i=t,o={metadata:i,capabilities:Fn(i)};return n===Pe?{kind:"legacy",...o,metadata:i}:{kind:"supported",...o,metadata:i}}function so(e){return e.kind==="legacy"||e.kind==="supported"?e.metadata:null}function ao(e){if(e.kind!=="legacy"&&e.kind!=="supported"||!e.capabilities.stableGenerationIdentity)return null;let t=e.metadata;return JSON.stringify({version:t.version,status:t.status,updatedAt:t.updatedAt,fingerprint:t.fingerprint,indexedLanguages:t.indexedLanguages,scipCompanion:t.scipCompanion,sqliteLayoutVersion:t.version===v?t.sqliteLayoutVersion:void 0})}function Fn(e){let t=e.fingerprint!==void 0,n=R(e.fingerprint),r=e.indexedLanguages!==void 0,i=e.status==="complete",o=e.version===v?e:null;return{usableForQuery:r,usableForEvidenceCache:t,publishableGeneration:i&&n&&r,stableGenerationIdentity:i&&t&&typeof e.updatedAt=="string",languageShardReuse:!!o?.languageFingerprints,typescriptProjectShardReuse:!!o?.typescriptProjectShards}}function kn(e,t){if(e.status!=="complete"&&e.status!=="partial")return"status must be complete or partial";if(e.updatedAt!==void 0&&!gt(e.updatedAt))return"updatedAt must be a valid timestamp";for(let n of["requestedLanguages","indexedLanguages"])if(e[n]!==void 0&&!wn(e[n]))return`${n} must contain unique supported languages`;return e.skipped!==void 0&&!Rn(e.skipped)?"skipped must contain supported language/reason pairs":e.scipCompanion!==void 0&&e.scipCompanion!=="current"&&e.scipCompanion!=="deferred"?"scipCompanion must be current or deferred":t===v&&e.sqliteLayoutVersion!==void 0&&(!Number.isSafeInteger(e.sqliteLayoutVersion)||e.sqliteLayoutVersion<1)?"sqliteLayoutVersion must be a positive safe integer":t===v&&e.languageFingerprints!==void 0&&!En(e.languageFingerprints)?"languageFingerprints must map supported languages to fingerprint objects":t===v&&e.typescriptProjectShards!==void 0&&!In(e.typescriptProjectShards)?"typescriptProjectShards must map project names to file fingerprints":null}function co(e){return e.version===v&&e.sqliteLayoutVersion===1}function wn(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string"&&je.has(t))?!1:new Set(e).size===e.length}function Rn(e){return Array.isArray(e)&&e.every(t=>R(t)&&typeof t.language=="string"&&je.has(t.language)&&typeof t.reason=="string")}function En(e){return R(e)&&Object.entries(e).every(([t,n])=>je.has(t)&&R(n))}function In(e){return R(e)&&Object.values(e).every(t=>R(t)&&Array.isArray(t.files)&&t.files.every(be))}function vn(e){return e instanceof Error?e.message:String(e)}import{closeSync as Ce,fstatSync as ne,openSync as Fe,readFileSync as Tn,readSync as mt}from"fs";import{createHash as On}from"crypto";var yt=8*1024*1024,St=64*1024*1024,An=512*1024*1024,Ln=256*1024*1024,E=class extends Error{constructor(n,r,i,o,s){let a=i==="too-large"?`is ${o} bytes; the safety limit is ${s} bytes`:i==="not-regular"?"is not a regular file":"changed while it was being read";super(`${n} ${JSON.stringify(r)} ${a}`);this.inputKind=n;this.inputPath=r;this.reason=i;this.observedBytes=o;this.limitBytes=s;this.name="BoundedFileReadError"}inputKind;inputPath;reason;observedBytes;limitBytes;code="SCIP_QUERY_BOUNDED_FILE_READ"};function re(e,t){T(t.maxBytes);let n=String(e),r=Fe(e,"r");try{let i=ne(r);xt(i,t,n);let o=Tn(r),s=ne(r);if(s.dev!==i.dev||s.ino!==i.ino||s.size!==i.size||o.byteLength!==i.size)throw new E(t.inputKind,n,"changed-during-read",s.size,t.maxBytes);return o}finally{Ce(r)}}function ke(e,t,n="utf8"){return re(e,t).toString(n)}function z(e,t){return ke(e,{maxBytes:yt,inputKind:t})}function Dn(e,t){return ke(e,{maxBytes:St,inputKind:t})}function we(e,t){T(t.maxBytes);let n=[],r=Buffer.allocUnsafe(64*1024),i=0;for(;;){let o=mt(e,r,0,r.length,null);if(o===0)break;if(i+=o,!Number.isSafeInteger(i)||i>t.maxBytes)throw new E(t.inputKind,`file descriptor ${e}`,"too-large",i,t.maxBytes);n.push(Buffer.from(r.subarray(0,o)))}return Buffer.concat(n,i)}function _n(e,t,n="utf8"){return we(e,t).toString(n)}function bt(e,t){let n=Fe(e,"r");try{return we(n,t)}finally{Ce(n)}}function Bn(e,t,n="utf8"){return bt(e,t).toString(n)}function ie(e,t,n){T(t.maxBytes);let r=String(e),i=Fe(e,"r");try{let o=ne(i);xt(o,t,r);let s=Buffer.allocUnsafe(Math.min(1024*1024,Math.max(1,o.size))),a=0;for(;a<o.size;){let u=mt(i,s,0,Math.min(s.length,o.size-a),a);if(u===0)break;n(s.subarray(0,u)),a+=u}let c=ne(i);if(c.dev!==o.dev||c.ino!==o.ino||c.size!==o.size||a!==o.size)throw new E(t.inputKind,r,"changed-during-read",c.size,t.maxBytes);return a}finally{Ce(i)}}function Mn(e,t){let n=On("sha256");return ie(e,t,r=>n.update(r)),n.digest("hex")}function xt(e,t,n){if(!e.isFile())throw new E(t.inputKind,n,"not-regular",Number(e.size),t.maxBytes);if(e.size>t.maxBytes)throw new E(t.inputKind,n,"too-large",Number(e.size),t.maxBytes)}function T(e){if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`maxBytes must be a non-negative safe integer; received ${e}`)}import{spawnSync as Gn}from"child_process";import{createHash as Wn}from"crypto";import{existsSync as zn,lstatSync as Hn,realpathSync as $n}from"fs";import{dirname as Un,isAbsolute as qn,join as Jn,relative as Co,resolve as ae,sep as Fo}from"path";var Pt=Symbol.for("scip-query.project-file-listing-context.v1"),jt=globalThis,Re=jt[Pt],O=Re&&typeof Re=="object"?Re:{};jt[Pt]=O;function Ct(e,t){let n=O.active?O.canonicalProjectRoots:void 0,r=n?.get(e);if(r!==void 0)return r;let i=t();return n?.set(e,i),i}function Ft(){return O.sequence??0}function kt(e,t,n){let r=O.active,i=r?.get(e);if(i&&i.pathBytes<=t)return i;let o=Nn(n(),(O.sequence??0)+1);if(O.sequence=o.sequence,o.pathBytes>t)throw new RangeError(`Git project file listing exceeded ${t} path bytes.`);return r?.set(e,o),o}function*wt(e){let t=0;for(;t<e.taggedOutput.length;){let n=e.taggedOutput.indexOf("\0",t);if(n<0)return;yield e.taggedOutput.slice(t+2,n),t=n+1}}function Nn(e,t){let n=0,r=0,i=!0;for(;n<e.length;){let o=e.indexOf("\0",n);if(o<0||o<=n+2||e[n+1]!==" ")throw new Error("Git returned a malformed tagged project file listing.");let s=e[n];i&&=s==="H"||s==="?",r+=1,n=o+1}return{taggedOutput:e,pathBytes:Buffer.byteLength(e,"utf8")-r*2,indexAllowsTreeFingerprintReuse:i,sequence:t}}var H={run(e,t){let n=Et(e,t);return n.kind==="success"?n.output:void 0},runResult:Et},Vn=["rev-parse","--show-toplevel","--absolute-git-dir","--git-common-dir","HEAD","HEAD^{tree}"],It=["status","--porcelain=v2","--branch","-z","--untracked-files=all"],oe=/^[0-9a-f]{40,64}$/;function wo(e,t,n=H){if(!t||t.startsWith("-")||/[\0\r\n]/.test(t))throw new Error(`Invalid Git revision ${JSON.stringify(t)}.`);let r=n.runResult(e,["rev-parse","--verify","--end-of-options",`${t}^{commit}`]);if(r.kind!=="success"||!oe.test(r.output))throw new Error(`Git revision ${JSON.stringify(t)} does not resolve to exactly one commit.`);return r.output}function Ro(e,t=H){return Kn(e,t)?.context}function Kn(e,t=H){let n=t.runResult(e,Vn);if(n.kind==="success"){let i=Yn(n.output);if(i){let o=Xn(i,t);if(o)return Rt(o)}}let r=Qn(e,t);return r?Rt(r):void 0}function Rt(e){return{context:e,projectFileInventorySequence:Ft()}}function vt(e){let t=e.split("\0").filter(Boolean),n=t.find(i=>i.startsWith("# branch.oid "))?.slice(13),r=n==="(initial)"?void 0:n;if(!(r!==void 0&&!oe.test(r))&&n!==void 0)return{headCommit:r,clean:t.every(i=>i.startsWith("# "))}}function Yn(e){let t=e.split(`
2
- `).map(c=>c.trim());if(t.length!==5)return;let[n,r,i,o,s]=t;if(!n||!r||!i||!o||!s||!oe.test(o)||!oe.test(s))return;let a=I(n);return{root:a,gitDir:I(se(a,r)),commonDir:I(se(a,i)),headCommit:o,treeOid:s}}function Xn(e,t){let n=t.run(e.root,It);if(n===void 0)return;let r=vt(n);return r?.headCommit!==e.headCommit?void 0:{...Tt(e.root,e.gitDir),commonDir:e.commonDir,repositoryId:Ie("repository",e.commonDir),headCommit:e.headCommit,treeOid:e.treeOid,clean:r.clean}}function Qn(e,t){let n=Zn(e,t);if(n.kind!=="worktree")return;let r=n.identity,i=r.projectRoot,o=t.run(i,["rev-parse","--git-common-dir"])?.trim();if(!o)return;let s=I(se(i,o)),a=Ee(t.run(i,["rev-parse","--verify","HEAD"])),c=Ee(t.run(i,["rev-parse","--verify","HEAD^{tree}"])),u=t.run(i,It);if(u===void 0)return;let d=vt(u);if(!(!d||d.headCommit!==a))return{...r,commonDir:s,repositoryId:Ie("repository",s),headCommit:a,treeOid:c,clean:d.clean}}function Zn(e,t=H){let n=t.runResult(e,["rev-parse","--show-toplevel"]);if(n.kind==="not-repository")return{kind:"non-git"};if(n.kind==="error")return n;let r=n.output.trim();if(!r)return{kind:"error",message:"Git returned an empty worktree root."};let i=I(r),o=t.run(i,["rev-parse","--absolute-git-dir"])?.trim();if(!o)return{kind:"error",message:"Git did not return an absolute worktree directory."};let s=I(se(i,o));return{kind:"worktree",identity:Tt(i,s)}}function Tt(e,t){return{projectRoot:e,gitDir:t,worktreeId:Ie("worktree",`${e}\0${t}`)}}function Eo(e,t,n=H){return Ee(n.run(e,t))}function se(e,t){return qn(t)?t:ae(e,t)}function I(e){try{return $n(e)}catch{return ae(e)}}function Ie(e,t){return Wn("sha256").update(`${e}\0${t}`).digest("hex").slice(0,24)}function Ee(e){return e?.trim()||void 0}function Et(e,t){let n=Gn("git",["-C",e,...t],{encoding:"utf-8",env:{...process.env,LC_ALL:"C"},maxBuffer:52428800,stdio:["ignore","pipe","pipe"],timeout:3e4,killSignal:"SIGKILL"});if(n.status===0)return{kind:"success",output:n.stdout.trimEnd()};let i=(typeof n.stderr=="string"?n.stderr.trim():"")||n.error?.message||`git exited with status ${n.status??"unknown"}`,o=n.error?.code;return(/not a git repository/i.test(i)||o==="ENOENT"&&zn(ae(e)))&&!er(e)?{kind:"not-repository"}:{kind:"error",message:i}}function er(e){if(process.env.GIT_DIR||process.env.GIT_COMMON_DIR)return!0;let t=ae(e);for(;;){try{return Hn(Jn(t,".git")),!0}catch(r){let i=r.code;if(i!=="ENOENT"&&i!=="ENOTDIR")return!0}let n=Un(t);if(n===t)return!1;t=n}}import{createRequire as rr}from"module";import{existsSync as ir,lstatSync as Do,readdirSync as or,statSync as sr}from"fs";import f from"path";import{AsyncLocalStorage as tr}from"async_hooks";var nr=new tr;function A(e,t){let n=ce(e);if(!n||n.missing.has(t))return;let r=n.files.get(t);if(r)return r;let i=n.readBaseFile?.(t);return i&&n.files.set(t,i),i}function L(e,t){let n=ce(e);if(n)return n.missing.has(t)?"missing":n.paths.includes(t)?"present":"missing"}function Ot(e,t){return ce(e)?.fingerprints.get(t)}function D(e){return ce(e)?.paths}function ce(e){let t=nr.getStore();if(t)return t.projectRoot===I(e)?t:void 0}var ar=rr(import.meta.url),At=new Set([".cache",".git",".next",".nuxt",".turbo",".nx","build","coverage","dist","node_modules","tmp","vendor"]),cr=18003;function Te(e,t=[]){let n=f.resolve(e),r=t.flatMap(c=>dr(n,c));if(r.length>0)return Lt(n,_t(r));let i=pr(n),o=_t(i),s=lr(n,o)?[n,...o]:o,a=s.length>0?s:[n];return Lt(n,a)}function Bt(e){return new Set(e.map(t=>t==="."?"tsconfig.json":`${t.replace(/\/$/u,"")}/tsconfig.json`))}function Mt(e){let t=e.split("/").at(-1)?.toLowerCase();return t?.startsWith("tsconfig")===!0&&t.endsWith(".json")}var ur=/^\.scipquery-compiler-shard-\d+\.tsconfig\.json$/;function Go(e){return`.scipquery-compiler-shard-${e}.tsconfig.json`}function Nt(e){return ur.test(e)}function Gt(e,t,n=[]){let r;try{r=ar("@ts-morph/common/dist/typescript.js")}catch{return null}let i=f.resolve(e),o=t==="workspace"?Te(i,n):["."],s=new Set;for(let a of o){let c=a==="."?i:f.join(i,a),u=f.join(c,"tsconfig.json"),d=mr(r,i);if(!d.fileExists(u))return null;let p=r.readConfigFile(u,d.readFile);if(p.error)return null;let l=r.parseJsonConfigFileContent(p.config,d,c);if(l.errors.some(m=>m.code!==cr))return null;for(let m of l.fileNames){let h=f.resolve(m);j(i,h)&&s.add(f.relative(i,h).split(f.sep).join("/"))}}return s}function Lt(e,t){return[...new Set(t.map(n=>$(e,n)))].sort((n,r)=>n.localeCompare(r))}function pr(e){let t=D(e);if(t)return t.flatMap(i=>{if(i.split("/").some(s=>At.has(s)))return[];let o=f.join(e,...i.split("/"));return Dt(e,o)?[f.dirname(o)]:[]});let n=[],r=[e];for(;r.length>0;){let i=r.pop(),o;try{o=or(i,{withFileTypes:!0})}catch{continue}for(let s of o){let a=f.join(i,s.name);if(s.isDirectory()){!At.has(s.name)&&!s.name.startsWith(".")&&r.push(a);continue}s.isFile()&&Dt(e,a)&&n.push(f.dirname(a))}}return n}function dr(e,t){let n=t.trim();if(!n)return[];let r=f.resolve(e,n);if(!j(e,r))return[];let i=D(e);if(i){let o=$(e,r);if(i.includes(o)&&ve(f.basename(r)))return[f.dirname(r)];let s=o==="."?"":`${o}/`;return i.some(a=>a.startsWith(s))?[r]:[]}try{let o=sr(r);if(o.isDirectory())return[r];if(o.isFile()&&ve(f.basename(r)))return[f.dirname(r)]}catch{return[]}return[]}function Dt(e,t){if(!ve(f.basename(t)))return!1;let n=Wt(e,t);return n?f.basename(t)==="tsconfig.json"||"include"in n||"files"in n||"references"in n:!1}function ve(e){return e.startsWith("tsconfig")&&e.endsWith(".json")}function _t(e){let t=[...new Set(e.map(n=>f.resolve(n)))].sort((n,r)=>n.localeCompare(r));return t.length<=1?t:t.filter(n=>!t.some(r=>r!==n&&Sr(n,r)))}function lr(e,t){if(t.length===0||t.some(r=>f.resolve(r)===e))return!1;let n=f.join(e,"tsconfig.json");return gr(e,n)&&fr(e,n)}function fr(e,t){let r=Wt(e,t)?.include;return Array.isArray(r)?r.some(i=>typeof i=="string"&&i.trim()!==""&&!i.startsWith("!")&&(i.includes("/")||i.includes("**")||!f.extname(i))):!1}function Wt(e,t){try{let n=JSON.parse(hr(e,t));return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}function gr(e,t){let n=$(e,t),r=L(e,n);return r?r==="present":ir(t)}function hr(e,t){let n=$(e,t);if(D(e)){let i=A(e,n);if(!i)throw Object.assign(new Error(`Snapshot file ${n} is missing.`),{code:"ENOENT"});return i.content.toString("utf8")}return z(t,"TypeScript project config")}function mr(e,t){let n=D(t);if(!n)return e.sys;let r=f.resolve(t),i=new Set(n),o=yr(r,n),s=e,a=c=>{let u=f.resolve(c);return j(r,u)?$(r,u):null};return{useCaseSensitiveFileNames:e.sys.useCaseSensitiveFileNames,fileExists(c){let u=a(c);return u===null?e.sys.fileExists(c):i.has(u)},readFile(c){let u=a(c);return u===null?e.sys.readFile(c):A(r,u)?.content.toString("utf8")},readDirectory(c,u,d,p,l){let m=f.resolve(c);return j(r,m)?s.matchFiles(m,u,d,p,e.sys.useCaseSensitiveFileNames,r,l,h=>o.get(f.resolve(h))??{files:[],directories:[]},h=>h):e.sys.readDirectory(c,u,d,p,l)}}}function yr(e,t){let n=new Map,r=new Map,i=o=>{n.has(o)||n.set(o,new Set),r.has(o)||r.set(o,new Set)};i(e);for(let o of t){let s=o.split("/"),a=e;for(let c=0;c<s.length-1;c+=1){let u=s[c];i(a),r.get(a).add(u),a=f.join(a,u),i(a)}n.get(a).add(s.at(-1))}return new Map([...n].map(([o,s])=>[o,{files:[...s].sort(),directories:[...r.get(o)??[]].sort()}]))}function $(e,t){let n=f.relative(e,t);return n?n.split(f.sep).join("/"):"."}function Sr(e,t){let n=f.relative(e,t);return!!n&&!n.startsWith("..")&&!f.isAbsolute(n)}import{createHash as Le}from"crypto";import{execFileSync as zt}from"child_process";import{createRequire as br}from"module";var xr=br(import.meta.url),Pr=/\.(?:[cm]?[jt]sx?)$/iu,jr=/\.[jt]sx$/iu,Ht=/(?:^|\/)package\.json$/iu,U,Oe=new Map;function $t(e,t){if(!De(e))return;let n=Cr();if(n)try{let r=typeof t=="string"?t:t.toString("utf8"),i=jr.test(e)?n.LanguageVariant.JSX:n.LanguageVariant.Standard,o=n.createScanner(n.ScriptTarget.Latest,!1,i,r),s=Le("sha256").update(`typescript-semantic-v1\0${i}\0`),a=!1,c=!1;for(;;){let u=o.scan();if(u===n.SyntaxKind.EndOfFileToken)break;if(u===n.SyntaxKind.WhitespaceTrivia)continue;if(u===n.SyntaxKind.NewLineTrivia){a&&(c=!0);continue}c&&s.update("line-break\0");let d=o.getTokenText();s.update(`${u}\0${Buffer.byteLength(d)}\0`).update(d).update("\0"),a=!0,c=!1}return s.digest("hex")}catch{return}}function De(e){return Pr.test(e)}function _e(e,t){if(Ht.test(e))try{let n=JSON.parse(typeof t=="string"?t:t.toString("utf8"));if(typeof n!="object"||n===null||Array.isArray(n))return;let{scripts:r,...i}=n;return Le("sha256").update("typescript-package-json-v1\0").update(Ae(i)).digest("hex")}catch{return}}function Be(e){return Ht.test(e)}function Uo(e,t,n){if(!Be(t)||!/^[a-f0-9]{64}$/u.test(n))return;let r=`${e}\0${t}\0${n}`;if(Oe.has(r))return Oe.get(r);let i;try{let o=zt("git",["-C",e,"log","--all","--format=%H","--max-count=64","--",t],{encoding:"utf8",maxBuffer:1048576,timeout:5e3}).split(/\r?\n/u).filter(Boolean);for(let s of o){let a=zt("git",["-C",e,"show",`${s}:${t}`],{encoding:null,maxBuffer:4194304,timeout:5e3});if(Le("sha256").update(a).digest("hex")===n){i=_e(t,a);break}}}catch{i=void 0}return Oe.set(r,i),i}function Cr(){if(U!==void 0)return U;try{U=xr("typescript")}catch{U=null}return U}function Ae(e){return Array.isArray(e)?`[${e.map(Ae).join(",")}]`:typeof e=="object"&&e!==null?`{${Object.entries(e).sort(([t],[n])=>t.localeCompare(n)).map(([t,n])=>`${JSON.stringify(t)}:${Ae(n)}`).join(",")}}`:JSON.stringify(e)}import{createHash as Yt,randomUUID as Or}from"crypto";import{chmodSync as Xt,existsSync as _,linkSync as Ar,lstatSync as fe,readdirSync as Ge,realpathSync as C,unlinkSync as Lr,writeSync as Dr}from"fs";import{homedir as _r}from"os";import{basename as Br,dirname as ge,isAbsolute as Vt,join as y,resolve as he}from"path";import{closeSync as Fr,existsSync as kr,fsyncSync as wr,mkdirSync as Rr,openSync as Er}from"fs";import{dirname as Ut}from"path";function ue(e,t,n,r){let i=0;for(;i<t.length;){let o=n.writeFile(e,t,i,t.length-i);if(!Number.isSafeInteger(o)||o<=0||o>t.length-i)throw new Error(`${r} write did not make valid forward progress`);i+=o}}function Me(e,t){if(t!=="win32")return!1;let n=e.code;return n==="EACCES"||n==="EBADF"||n==="EINVAL"||n==="EISDIR"||n==="EPERM"}var q=Object.freeze({platform:process.platform,pathExists:e=>kr(e),makeDirectory:e=>Rr(e,{recursive:!0}),openFile:(e,t,n)=>Er(e,t,n),syncFile:e=>wr(e),closeFile:e=>Fr(e)});function qt(e,t=q){let n=[],r=e;for(;!t.pathExists(r);){n.push(r);let o=Ut(r);if(o===r)throw new Error(`Cannot establish a durable directory path without an existing ancestor: ${e}`);r=o}let i="synced";for(let o of n.reverse())t.makeDirectory(o),i=de(i,pe(Ut(o),t));return i}function pe(e,t=q){let n;try{n=t.openFile(e,"r")}catch(r){if(Me(r,t.platform))return"unsupported";throw r}try{t.syncFile(n)}catch(r){try{t.closeFile(n)}catch{}if(Me(r,t.platform))return"unsupported";throw r}return t.closeFile(n),"synced"}function de(...e){return e.every(t=>t==="not-requested")?"not-requested":e.includes("unsupported")?"unsupported":"synced"}import{createRequire as Ir}from"module";var vr=Ir(import.meta.url),Jt=Tr().version;function Tr(){for(let e of["../package.json","../../package.json"])try{return vr(e)}catch{}return{version:"0.0.0"}}var Qt=1,V=".scip-query-cache-owner.json",Mr=16*1024,Zt=Object.freeze({...q,randomToken:()=>Or(),linkFile:(e,t)=>Ar(e,t),removeFile:e=>Lr(e),writeFile:(e,t,n,r)=>Dr(e,t,n,r)});function le(e,t){return Object.assign(new Error(`refusing unsafe project dbPath ${JSON.stringify(e)} (${t}); use a repository-relative directory that remains inside the checkout`),{name:"UnsafeCachePathError",code:"SCIP_QUERY_UNSAFE_CACHE_PATH",configuredPath:e,reason:t})}function F(e,t){return Object.assign(new Error(`refusing unowned cache directory ${JSON.stringify(e)} (${t}); move unrelated data elsewhere or choose a new empty dbPath`),{name:"CacheOwnershipError",code:"SCIP_QUERY_CACHE_OWNERSHIP",cacheDir:e,reason:t})}function Nr(e,t){let n=C(e);return Wr(n,We(n,t))}function We(e,t){let n=C(e),r=process.env.SCIP_QUERY_CACHE_DIR;return r?he(r):t?.dbPath?Hr(n,t.dbPath):Gr(n)}function en(){let e=process.env.XDG_CACHE_HOME;return y(e||y(_r(),".cache"),"scip-query")}function Gr(e){let t=he(e);try{t=C(t)}catch{}let n=Yt("sha256").update(t).digest("hex").slice(0,12);return y(en(),"projects",n)}function us(e){if(!/^[a-f0-9]{24}$/.test(e))throw new Error(`invalid repository cache identity: ${e}`);let t=y(en(),"repositories",e);return rn(t),C(t)}function ps(e){return process.env.SCIP_QUERY_SHARED_CACHE!=="0"&&!process.env.SCIP_QUERY_CACHE_DIR&&!process.env.SCIP_QUERY_INDEX_DB&&!e?.dbPath}function ds(e,t){let n=Nr(e,t);return{cacheDir:n,dbPath:y(n,"index.db"),indexPath:y(n,"index.scip"),metaPath:y(n,"meta.json")}}function Wr(e,t,n=Zt){return zr(e,t,n).cacheDir}function zr(e,t,n=Zt){let r=C(e),i=_(t)?"synced":rn(t,n),o=C(t),s=y(o,V);if(_(s))return Ne(r,o),ze(s),J(o),{kind:"existing",cacheDir:o};Kt(o),Vr(o),Kt(o);let c=`${JSON.stringify({schemaVersion:Qt,canonicalProjectRoot:r,canonicalCacheDir:o,creatorVersion:Jt},null,2)}
3
- `;try{let u=Kr(s,c,n),d=de(i,u);return{kind:"published",cacheDir:o,achievedDurability:d==="synced"?"directory-durable":"file-flushed",directorySync:d}}catch(u){if(Xr(u))return Ne(r,o),{kind:"existing",cacheDir:o};throw u}}function Ne(e,t){let n=C(e),r=C(t);return Ur(r,n,r)}function ls(e,t){return _(y(t,V))?(Ne(e,t),tn(t),!0):!1}function Hr(e,t){let n;try{n=w(t)}catch(s){throw s instanceof g?le(t,s.reason):s}let r=he(e,...n.split("/"));if(r===e||!j(e,r))throw le(t,"outside-project");let i=$r(r),o=C(i);if(!j(e,o)&&o!==e)throw le(t,"symlink-escape");return r}function $r(e){let t=e;for(;!_(t);){let n=ge(t);if(n===t)throw le(e,"no-existing-ancestor");t=n}return t}function Ur(e,t,n){let r=y(e,V);if(!_(r)||fe(r).isSymbolicLink())throw F(e,"missing regular ownership record");let i=fe(r);if(!i.isFile()||i.size>Mr)throw F(e,"invalid ownership record file");let o=z(r,"cache ownership record"),s=qr(o,e);if(t!==void 0&&s.canonicalProjectRoot!==t)throw F(e,"ownership record belongs to a different project");if(s.canonicalCacheDir!==n)throw F(e,"ownership record names a different cache directory");return{record:s,ownerSha256:Yt("sha256").update(o).digest("hex"),physicalCacheDir:e}}function qr(e,t){try{let n=JSON.parse(e);if(n.schemaVersion!==Qt||typeof n.canonicalProjectRoot!="string"||typeof n.canonicalCacheDir!="string"||typeof n.creatorVersion!="string"||!Vt(n.canonicalProjectRoot)||!Vt(n.canonicalCacheDir))throw new Error("invalid fields");return n}catch(n){throw F(t,`malformed ownership record: ${n instanceof Error?n.message:String(n)}`)}}function Kt(e){let t=Ge(e).filter(n=>n!==V&&!Jr(n));if(t.length>0)throw F(e,`unrecognized existing entries: ${t.slice(0,3).join(", ")}`)}function Jr(e){return e.startsWith(`${V}.tmp-`)||e.startsWith("git-worktree-context.json.tmp-")||[".scipquery-generations","affected-shadow-latest.json","affected-shadow.jsonl","agent-hooks","augment-vue-meta.json","cache-lifecycle.lock","evidence.db","evidence.db-shm","evidence.db-wal","health-report-cache.json","git-worktree-context.json","index.db","index.db-shm","index.db-wal","index.lock","index.scip","language-indexes","meta.json","reindex-activity.jsonl","shared-cache.json","typescript-index","typescript-scip-fragments","typescript-scip-overlays","typescript-semantic","typescript-shard-costs.json","watch-activity.json","watch-refresh-requests","watch-state.json","watch.lock"].includes(e)?!0:/^(?:reindex-|rust-|typescript-)/.test(e)}function Vr(e){for(let t of Ge(e)){let n=y(e,t);try{let r=fe(n);if(r.isSymbolicLink())throw F(e,`legacy cache entry ${t} is a symlink`);if(r.isDirectory())J(n);else if(r.isFile())ze(n);else throw F(e,`legacy cache entry ${t} is not a file or directory`)}catch(r){if(nn(r))continue;throw r}}J(e)}function tn(e,t=!1){try{let n=fe(e);if(n.isSymbolicLink())throw F(e,"managed cache tree contains a symlink");if(n.isFile()){ze(e);return}if(!n.isDirectory())throw F(e,"managed cache tree contains a special file");J(e);for(let r of Ge(e))tn(y(e,r),!0)}catch(n){if(t&&nn(n))return;throw n}}function nn(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}function rn(e,t=q){let n=qt(e,t);return J(e),n}function Kr(e,t,n){let r=`${e}.tmp-${process.pid}-${n.randomToken()}`,i,o=!1;try{i=n.openFile(r,"wx",384),o=!0,ue(i,Buffer.from(t),n,"cache ownership record"),n.syncFile(i),n.closeFile(i),i=void 0,n.linkFile(r,e);let s=pe(ge(e),n);return n.removeFile(r),o=!1,de(s,pe(ge(e),n))}finally{if(i!==void 0)try{n.closeFile(i)}catch{}if(o)try{n.removeFile(r)}catch{}}}function J(e){process.platform!=="win32"&&Xt(e,448)}function ze(e){process.platform!=="win32"&&Xt(e,384)}function Yr(e){if(_(e))return C(e);let t=C(ge(e));return y(t,Br(e))}function fs(e){return Yr(he(e))}function Xr(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="EEXIST"}import{execFileSync as fi}from"child_process";import{isUtf8 as dn}from"buffer";import{createHash as Ve}from"crypto";import{closeSync as gn,fstatSync as K,lstatSync as Ye,openSync as hn,readdirSync as gi,readFileSync as hi,readSync as ln,readlinkSync as mi,realpathSync as X}from"fs";import{isAbsolute as yi,join as Xe,relative as Si,resolve as bi,sep as xi}from"path";import{closeSync as on,existsSync as $e,openSync as Qr,realpathSync as Zr,renameSync as ei,unlinkSync as sn,writeSync as ti}from"fs";import{dirname as ni,join as ri}from"path";var ii="fingerprint-stat-cache.json",an=1,oi=8*1024*1024,He=new Map;function Ue(e,t,n,r){let i=cn(e),o=i.files.get(t);if(!(!o||!un(o,n,r)))return i.hits+=1,{hash:o.hash,size:o.fingerprintSize,...o.semanticHash===void 0?{}:{semanticHash:o.semanticHash}}}function qe(e,t,n,r,i){if(i.hash==="unreadable"||i.size<0||!Number.isFinite(i.size))return;let o=cn(e),s={kind:n,dev:r.dev,ino:r.ino,mtimeMs:r.mtimeMs,ctimeMs:r.ctimeMs,size:r.size,hash:i.hash,fingerprintSize:i.size,...i.semanticHash===void 0?{}:{semanticHash:i.semanticHash}},a=o.files.get(t);a&&di(a,s)||(o.files.set(t,s),o.stores+=1,o.dirty=!0)}function Je(e){let t=He.get(pn(e));if(!(!t?.dirty||!t.cachePath))try{let n=ni(t.cachePath);if(!$e(n))return;li(t.cachePath,ci(t)),t.dirty=!1}catch{}}function cn(e){let t=pn(e),n=He.get(t);if(n)return n;let r=si(t),i=ai(r),o={cachePath:r,files:i,dirty:!1,hits:0,stores:0};return He.set(t,o),o}function si(e){try{let t=We(e);return $e(t)?ri(t,ii):null}catch{return null}}function ai(e){let t=new Map;if(!e||!$e(e))return t;try{let n=JSON.parse(re(e,{inputKind:"fingerprint stat cache",maxBytes:oi}).toString("utf8"));if(!ui(n))return t;for(let[r,i]of Object.entries(n.files))i&&t.set(r,i)}catch{return t}return t}function ci(e){return{version:an,files:Object.fromEntries(e.files)}}function ui(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.version!==an||typeof t.files!="object"||t.files===null?!1:Object.values(t.files).every(pi)}function pi(e){if(typeof e!="object"||e===null)return!1;let t=e;return(t.kind==="file"||t.kind==="symlink")&&Number.isFinite(t.dev)&&Number.isFinite(t.ino)&&Number.isFinite(t.mtimeMs)&&Number.isFinite(t.ctimeMs)&&Number.isFinite(t.size)&&Number.isFinite(t.fingerprintSize)&&typeof t.hash=="string"&&t.hash!=="unreadable"&&(t.semanticHash===void 0||typeof t.semanticHash=="string")}function un(e,t,n){return e.kind===t&&e.dev===n.dev&&e.ino===n.ino&&e.mtimeMs===n.mtimeMs&&e.ctimeMs===n.ctimeMs&&e.size===n.size}function di(e,t){return un(e,t.kind,t)&&e.hash===t.hash&&e.fingerprintSize===t.fingerprintSize&&e.semanticHash===t.semanticHash}function li(e,t){let n=`${e}.${process.pid}.tmp`;try{sn(n)}catch{}let r=Buffer.from(`${JSON.stringify(t)}
4
- `,"utf8"),i=Qr(n,"wx",384);try{ue(i,r,{writeFile:(o,s,a,c)=>ti(o,s,a,c)},"fingerprint stat cache")}catch(o){throw on(i),sn(n),o}on(i),ei(n,e)}function pn(e){return Zr(e)}var Q=64*1024*1024,Pi=1024*1024,ji=1024,B=class extends Error{constructor(n,r,i,o){super(`${n} ${JSON.stringify(r)} is ${i} bytes; the safety limit is ${o} bytes`);this.inputKind=n;this.inputPath=r;this.observedBytes=i;this.limitBytes=o;this.name="InputTooLargeError"}inputKind;inputPath;observedBytes;limitBytes;code="SCIP_QUERY_INPUT_TOO_LARGE"};function Ci(e){return[...new Set((e??[]).map(t=>t.trim()).filter(Boolean))].sort((t,n)=>t.localeCompare(n))}function Qe(e,t,n={}){let r=w(t),i=Ct(e,()=>X(e)),o=bi(i,...r.split("/"));if(!j(i,o)||o===i)throw new g(t,"outside-project");let s=X(o);if(!j(i,s)||s===i)throw new g(t,"outside-project");let a=Ye(s);if(!a.isFile())throw new g(t,"not-a-file");let c={projectRoot:i,relativePath:r,absolutePath:s,size:a.size,mtimeMs:a.mtimeMs,device:a.dev,inode:a.ino},u=n.maxBytes??Q;if(T(u),c.size>u)throw new B(n.inputKind??"project file",c.relativePath,c.size,u);return c}function Fi(e,t,n={}){let r=w(t),i=L(e,r);if(i){if(i==="missing")throw Object.assign(new Error(`Snapshot project file ${JSON.stringify(r)} does not exist.`),{code:"ENOENT"});let c=A(e,r);if(!c)throw new g(r,"changed-during-read");let u=n.maxBytes??Q;if(T(u),c.size>u)throw new B(n.inputKind??"project file",r,c.size,u);return Buffer.from(c.content)}let o=Qe(e,t,n),s=n.maxBytes??Q,a=hn(o.absolutePath,"r");try{let c=K(a);if(Y(c,o,t),c.size>s)throw new B(n.inputKind??"project file",o.relativePath,c.size,s);let u=hi(a),d=K(a);if(Y(d,o,t),u.byteLength!==c.size)throw new g(t,"changed-during-read");return u}finally{gn(a)}}function Ls(e,t,n,r={}){if(n.byteLength===0)throw new Error("Project file probe literal must not be empty.");let{matchedLiteralIndexes:i,...o}=ki(e,t,[n],r);return{...o,includesLiteral:i.length>0}}function ki(e,t,n,r={}){if(n.length===0||n.some(c=>c.byteLength===0))throw new Error("Project file probe literals must not be empty.");let i=w(t),o=L(e,i);if(o){if(o==="missing")throw Object.assign(new Error(`Snapshot project file ${JSON.stringify(i)} does not exist.`),{code:"ENOENT"});let c=A(e,i);if(!c)throw new g(i,"changed-during-read");let u=r.maxBytes??Q;if(T(u),c.size>u)throw new B(r.inputKind??"project file",i,c.size,u);let d=!c.content.includes(0)&&dn(c.content),p=n.map(fn),l=d?Ri(c.content,n,p):[];return{byteLength:c.size,isUtf8Text:d,matchedLiteralIndexes:l,bytes:l.length>0?Buffer.from(c.content):null,...r.computeSha256?{sha256:c.sha256}:{}}}let s=Qe(e,t,r),a=hn(s.absolutePath,"r");try{let c=K(a);Y(c,s,t);let u=r.computeSha256?Ve("sha256"):null,d=r.scratchBuffer??Buffer.allocUnsafe(Pi);if(d.byteLength===0)throw new Error("Project file probe scratch buffer must not be empty.");let p=0,l=n.map(()=>!1),m=!1,h=!0,b=Buffer.alloc(0),Z=n.map(()=>Buffer.alloc(0)),M=n.map(fn);for(;p<c.size;){let x=ln(a,d,0,Math.min(d.byteLength,c.size-p),p);if(x<=0)throw new g(t,"changed-during-read");let P=d.subarray(0,x);if(u?.update(P),m||=P.includes(0),h){let S=b.byteLength>0?Buffer.concat([b,P]):P,W=wi(S);h=dn(S.subarray(0,W)),b=Buffer.from(S.subarray(W))}for(let S=0;S<n.length;S+=1){if(l[S])continue;let W=n[S],tt=Z[S];l[S]=Ei(P,W,tt,M[S]),Z[S]=Ii(P,W,tt)}p+=x}h&&=b.byteLength===0,Y(K(a),s,t);let N=!m&&h,G=N?l.flatMap((x,P)=>x?[P]:[]):[],k=null;if(G.length>0){k=Buffer.allocUnsafe(c.size);let x=0;for(;x<k.byteLength;){let P=ln(a,k,x,k.byteLength-x,x);if(P<=0)throw new g(t,"changed-during-read");x+=P}Y(K(a),s,t)}return{byteLength:c.size,isUtf8Text:N,matchedLiteralIndexes:G,bytes:k,...u?{sha256:u.digest("hex")}:{}}}finally{gn(a)}}function Ds(e,t,n={}){return Fi(e,t,n).toString("utf8")}function Y(e,t,n){if(!e.isFile()||e.dev!==t.device||e.ino!==t.inode||e.size!==t.size)throw new g(n,"changed-during-read")}function wi(e){if(e.byteLength===0)return 0;let t=e.byteLength-1,n=0;for(;t>=0&&n<3&&(e[t]&192)===128;)n+=1,t-=1;if(t<0)return e.byteLength;let r=e[t];return((r&128)===0?1:(r&224)===192?2:(r&240)===224?3:(r&248)===240?4:0)>e.byteLength-t?t:e.byteLength}function Ri(e,t,n){return t.flatMap((r,i)=>Ke(e,r,n[i])?[i]:[])}function Ei(e,t,n,r){if(Ke(e,t,r))return!0;if(n.byteLength===0||t.byteLength===1)return!1;let i=e.subarray(0,Math.min(e.byteLength,t.byteLength-1));return Ke(Buffer.concat([n,i]),t,r)}function Ke(e,t,n){if(n<0)return e.includes(t);let r=t[n],i=e.indexOf(r),o=0;for(;i>=0;){if(o+=1,o>ji)return e.includes(t);let s=i-n;if(s>=0&&s+t.byteLength<=e.byteLength&&e.compare(t,0,t.byteLength,s,s+t.byteLength)===0)return!0;i=e.indexOf(r,i+1)}return!1}function fn(e){for(let n=1;n<e.byteLength;n+=1){let r=e[n];if(r>=65&&r<=90)return n}let t=e[0];return t>=65&&t<=90?0:-1}function Ii(e,t,n){let r=t.byteLength-1;if(r===0)return Buffer.alloc(0);if(e.byteLength>=r)return Buffer.from(e.subarray(e.byteLength-r));let i=Buffer.concat([n,e]);return Buffer.from(i.subarray(Math.max(0,i.byteLength-r)))}function Ze(e){return typeof e=="object"&&e!==null&&"code"in e&&(e.code==="ENOENT"||e.code==="ENOTDIR")}function _s(e,t){try{return Qe(e,t),!0}catch(n){if(Ze(n))return!1;throw n}}function vi(e){let t=D(e);return t?t.filter(n=>n&&!ye(n)).sort():(_i(e)??Bi(e)).filter(n=>n&&!ye(n)).sort()}function Ti(e,t={}){let n=(t.includePaths??[]).map(w),r=[...new Set([...vi(e),...n])].filter(s=>!ye(s)).filter(s=>!t.language||ct(s,t.language,t.markerFiles)).filter(s=>!t.includePath||t.includePath(s)).sort((s,a)=>s.localeCompare(a)),i=X(e),o=r.flatMap(s=>mn(e,i,s));return Je(i),o}function mn(e,t,n){let r=Ot(e,n);if(r)return[{path:n,size:r.fingerprintSize??r.size,hash:r.sha256}];if(L(e,n)==="present"){let o=A(e,n);if(o)return[{path:n,size:o.fingerprintSize??o.size,hash:o.sha256}]}let i=Xe(e,n);try{let o=Ye(i);if(o.isSymbolicLink()){let b=Ue(t,n,"symlink",me(o));if(b)return[{path:n,size:b.size,hash:b.hash}];let Z=X(i),M=Si(t,Z);if(M===".."||M.startsWith(`..${xi}`)||yi(M))throw new Error("external symlink");let N=mi(i),G=Ve("sha256").update("symlink\0").update(N).digest("hex"),k=Buffer.byteLength(N);return qe(t,n,"symlink",me(o),{hash:G,size:k}),[{path:n,size:k,hash:G}]}let s=De(n)||Be(n),a=Ue(t,n,"file",me(o));if(a&&(!s||a.semanticHash!==void 0))return[{path:n,size:a.size,hash:a.hash,...a.semanticHash===void 0?{}:{semanticHash:a.semanticHash}}];let c=Ve("sha256"),u=s,d=[],p=ie(i,{inputKind:"project fingerprint input",maxBytes:Q},b=>{c.update(b),u&&d.push(Buffer.from(b))}),l=c.digest("hex"),m=u?Buffer.concat(d,p):void 0,h=m?$t(n,m)??_e(n,m):void 0;return qe(t,n,"file",me(o),{hash:l,size:p,...h===void 0?{}:{semanticHash:h}}),[{path:n,size:p,hash:l,...h===void 0?{}:{semanticHash:h}}]}catch(o){return Ze(o)?[]:[{path:n,size:-1,hash:"unreadable"}]}}function me(e){return{dev:e.dev,ino:e.ino,mtimeMs:e.mtimeMs,ctimeMs:e.ctimeMs,size:e.size}}function yn(e,t,n){let r=et(t,n),i=[...r.typescriptProjects.filter(c=>Li(e,c)),...r.clojureConfigPath?[r.clojureConfigPath]:[]],o=r.languages.includes("typescript")?Gt(e,r.typescriptProjectMode,r.typescriptProjects):null,s=r.languages.includes("typescript")?r.typescriptProjectMode==="workspace"?Te(e,r.typescriptProjects):["."]:[],a=Bt(s);return{...r,files:Ti(e,{includePath:c=>{if(c===".scipquery.json")return!1;let u=te(c,t,i);return u==="other"||u==="config"&&Mt(c)&&!a.has(c)?!1:u!=="source"||!Ai(c)||!o?!0:o.has(c)},includePaths:i})}}function Bs(e,t){let n=new Set(t.files.map(o=>o.path)),r=yn(e,t.languages,t),i=new Map(r.files.map(o=>[o.path,o]));return{...et(t.languages,t),files:[...t.files.flatMap(o=>{let s=i.get(o.path);return s?[s]:[]}),...r.files.filter(o=>!n.has(o.path))]}}function Ms(e,t,n,r,i,o){let s=p=>({mode:"full",fingerprint:yn(e,t,n),reason:p});if(!i)return s("change-journal-unavailable");if(!i.complete)return s(`change-journal-incomplete:${i.incompleteReason??"unknown"}`);if(!o)return s("accepted-generation-unavailable");if(i.baseGeneration!==o)return s("change-journal-base-mismatch");if(!r)return s("prior-project-input-snapshot-unavailable");let a=et(t,n);if(!Oi(r,a))return s("project-input-configuration-changed");if(new Set(r.files.map(p=>p.path)).size!==r.files.length)return s("prior-project-input-snapshot-has-duplicate-paths");if(i.entries.length===0)return{mode:"delta",fingerprint:{...a,files:[...r.files].sort((p,l)=>p.path.localeCompare(l.path))},changedPaths:[]};let c=[...a.typescriptProjects,...a.clojureConfigPath?[a.clojureConfigPath]:[]],u=new Map(r.files.map(p=>[p.path,p]));for(let p of i.entries){let l=u.get(p.path);if(te(p.path,t,c)!=="source")return s("non-source-project-input-changed");if(p.kind==="add"&&l)return s("added-path-already-in-prior-project-input-snapshot");if(p.kind==="delete"&&!l)return s("deleted-path-not-in-prior-project-input-snapshot");if(p.kind==="change"&&!l)return s("changed-path-not-in-prior-project-input-snapshot");if(l&&(l.hash==="unreadable"||l.size<0))return s("changed-path-was-unreadable")}let d=X(e);for(let p of i.entries){let l=mn(e,d,p.path);if(p.kind==="delete"){if(l.length!==0)return s("deleted-source-is-still-readable");u.delete(p.path);continue}if(l.length!==1||l[0].hash==="unreadable"||l[0].size<0)return s(p.kind==="add"?"added-source-is-not-readable":"changed-source-no-longer-readable");u.set(p.path,l[0])}return Je(d),{mode:"delta",fingerprint:{...a,files:[...u.values()].sort((p,l)=>p.path.localeCompare(l.path))},changedPaths:i.entries.map(p=>p.path).sort()}}function Oi(e,t){return e.version===t.version&&JSON.stringify([...e.languages].sort())===JSON.stringify(t.languages)&&e.pnpmWorkspaces===t.pnpmWorkspaces&&e.typescriptProjectMode===t.typescriptProjectMode&&JSON.stringify([...e.typescriptProjects].sort())===JSON.stringify(t.typescriptProjects)&&e.clojureConfigPath===t.clojureConfigPath}function Ai(e){return/\.(?:[cm]?[jt]sx?|vue)$/iu.test(e)}function Li(e,t){let n;try{n=w(t)}catch{return!1}let r=L(e,n);if(r)return r==="present";try{return Ye(Xe(e,n)).isFile()}catch(i){if(Ze(i))return!1;throw i}}function et(e,t){return{version:3,languages:[...e].sort(),pnpmWorkspaces:t.typescriptProjectMode!=="workspace"&&t.pnpmWorkspaces===!0,typescriptProjectMode:t.typescriptProjectMode??"single",typescriptProjects:Ci(t.typescriptProjects),clojureConfigPath:Di(t.clojureConfigPath)}}function Di(e){return e?.trim()||void 0}function _i(e){try{let t=kt(e,52428800,()=>fi("git",["-C",e,"ls-files","-co","-v","-z","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:104857600,stdio:["ignore","pipe","ignore"],timeout:3e4,killSignal:"SIGKILL"}));return[...wt(t)]}catch{return null}}function Bi(e){let t=[],n=[""];for(;n.length>0;){let r=n.pop(),i=r?Xe(e,r):e,o;try{o=gi(i,{withFileTypes:!0})}catch{continue}for(let s of o){let a=r?`${r}/${s.name}`:s.name;if(s.isDirectory()){ye(a)||n.push(a);continue}t.push(a)}}return t}function ye(e){let t=e.split("/");return e==="meta.json"||Nt(e)||t[0]===".scipquery"&&(t[1]==="events"||t[1]==="ledger"||t[1]==="releases"||t[1]==="suppressions")||t.some(n=>Mi.has(n))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var Mi=new Set([".git","node_modules",".scipquery-cache",".scipquery-generations",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]);export{g as a,Se as b,Gi as c,Wi as d,j as e,w as f,te as g,ct as h,Hi as i,rt as j,$i as k,Ui as l,Pn as m,R as n,gt as o,Ji as p,Vi as q,Ki as r,Yi as s,Xi as t,Qi as u,ht as v,v as w,oo as x,so as y,ao as z,Fn as A,co as B,yt as C,St as D,An as E,Ln as F,E as G,re as H,ke as I,z as J,Dn as K,_n as L,Bn as M,ie as N,Mn as O,ue as P,Me as Q,q as R,qt as S,pe as T,de as U,kt as V,wt as W,H as X,wo as Y,Ro as Z,Eo as _,se as $,I as aa,Te as ba,Bt as ca,Mt as da,Go as ea,Nt as fa,Gt as ga,Uo as ha,Jt as ia,We as ja,en as ka,Gr as la,us as ma,ps as na,ds as oa,ls as pa,fs as qa,B as ra,Ci as sa,Qe as ta,Fi as ua,Ls as va,ki as wa,Ds as xa,Ze as ya,_s as za,vi as Aa,Ti as Ba,yn as Ca,Bs as Da,Ms as Ea,et as Fa};
5
- //# sourceMappingURL=chunk-GH5YSGZL.js.map
@@ -1,3 +0,0 @@
1
- import{b as m}from"./chunk-JHH5SCZ3.js";import{a as p}from"./chunk-SB25YMEQ.js";import{g as f,ia as d,ma as P,na as h}from"./chunk-AK3PYTIK.js";import{realpathSync as c}from"fs";import{basename as x,dirname as L,join as T,relative as I,sep as O}from"path";import{fileURLToPath as S,pathToFileURL as y}from"url";function F(n,e){return e==="."||e==="./"?y(c(n)).href:y(d(n,e).absolutePath).href}function b(n,e){let r=S(e);return I(c(n),v(r)).split(O).join("/")}function v(n){try{return c(n)}catch{try{return T(c(L(n)),x(n))}catch{return n}}}function H(n,e,r){return{textDocument:{uri:F(n,e.relativePath)},position:z(n,e),context:{includeDeclaration:r}}}function z(n,e){let r={line:e.startLine,character:e.startChar??0};try{return M(P(n,e.relativePath,{inputKind:"indexed Rust source file"}),e,r)}catch(t){if(!h(t))throw t;return r}}function M(n,e,r={line:e.startLine,character:e.startChar??0}){let t=n.split(/\r?\n/),o=t[e.startLine];if(o===void 0||e.leaf.length===0)return r;let i=Math.max(0,Math.min(r.character,o.length)),s=o.indexOf(e.leaf,i);if(s>=0)return{line:e.startLine,character:u(s,e.leaf)};let a=o.indexOf(e.leaf);if(a>=0)return{line:e.startLine,character:u(a,e.leaf)};let l=D(t,e.startLine,e.leaf);return l||r}function u(n,e){return n+Math.max(0,e.length-2)}function D(n,e,r){for(let t of[-1,1,-2,2]){let o=e+t;if(o<0||o>=n.length)continue;let i=n[o].indexOf(r);if(i>=0)return{line:o,character:u(i,r)}}return null}function K(n,e){return e.map(r=>({file:b(n,r.uri),line:r.range.start.line,column:r.range.start.character}))}function X(n){let e=new Map;for(let r of n)e.set(`${r.file}\0${r.line}\0${r.column}`,r);return[...e.values()].sort((r,t)=>{let o=r.file.localeCompare(t.file);return o!==0?o:r.line!==t.line?r.line-t.line:r.column-t.column})}import{randomUUID as E}from"crypto";import{readdirSync as $,rmSync as j,writeFileSync as A}from"fs";import{join as g}from"path";var R="rust-analyzer-owner-",w=".json",U=16*1024;function Z(n,e){if(!n||!e.rootIdentity)return null;let r=g(n,`${R}${e.rootPid}-${E()}${w}`),t={version:1,rootIdentity:e.rootIdentity,ownsProcessGroup:e.ownsProcessGroup};return A(r,`${JSON.stringify(t)}
2
- `,{encoding:"utf8",mode:384,flag:"wx"}),r}function ee(n){n&&j(n,{force:!0})}async function re(n,e){if(!n)return[];let r;try{r=$(n)}catch{return[]}let t=r.filter(s=>s.startsWith(R)&&s.endsWith(w)).map(s=>g(n,s)),o=[],i=[];for(let s of t){let a=C(s);a?i.push(a):o.push({reaped:!1,reason:"identity-unavailable",detail:`Rust analyzer ownership record ${s} could not be validated.`})}return o.push(...await Promise.all(i.map(s=>m(s,e)))),o}function C(n){try{let e=f(n,{maxBytes:U,inputKind:"rust-analyzer process ownership record"}),r=JSON.parse(e),t=p(r.rootIdentity);return r.version!==1||!t||typeof r.ownsProcessGroup!="boolean"?null:{rootPid:t.pid,rootIdentity:t,ownsProcessGroup:r.ownsProcessGroup,knownMembers:new Map([[t.pid,t]])}}catch{return null}}export{Z as a,ee as b,re as c,F as d,b as e,H as f,K as g,X as h};
3
- //# sourceMappingURL=chunk-HCVJR2V4.js.map
@@ -1,3 +0,0 @@
1
- import{a as d}from"./chunk-ILMHV3KM.js";import{a as A,b as T,c as v,g as P,j as R}from"./chunk-KQHJEU6V.js";import{d as g,e as L,f as p,g as M,h as k}from"./chunk-HCVJR2V4.js";import{ma as I,na as z}from"./chunk-AK3PYTIK.js";import c from"process";import{existsSync as _}from"fs";import{dirname as h,join as J,resolve as b,sep as N}from"path";import{fileURLToPath as K}from"url";async function G(e){let n=e.includeReferences!==!1,r=e.includeCallees===!0,t=e.includeSignatures===!0,s={timeoutMs:e.requestTimeoutMs},o=Q(e),a=W(e),l=H(e),f=j(e),C=re(e.projectRoot,o),x=te(e.projectRoot,C),w=ne(C),u=new T(v(e.rustAnalyzerBinary,x),{requestTimeoutMs:e.requestTimeoutMs,configuration:w});try{let y=await u.initialize({processId:c.pid,rootUri:g(x,"."),capabilities:{textDocument:{references:{dynamicRegistration:!1},callHierarchy:{dynamicRegistration:!1},hover:{dynamicRegistration:!1}}},initializationOptions:w});if(n&&!y.capabilities.referencesProvider)return{available:!1,reason:"rust-analyzer initialized without textDocument/references support.",references:a.map(i=>[i.symbolId,[]]),...r?{callees:l.map(i=>[i.symbolId,[]])}:{}};if(r&&!y.capabilities.callHierarchyProvider)return{available:!1,reason:"rust-analyzer initialized without call hierarchy support.",references:a.map(i=>[i.symbolId,[]]),callees:l.map(i=>[i.symbolId,[]]),...t?{signatures:f.map(i=>[i.symbolId,null])}:{}};if(t&&!y.capabilities.hoverProvider)return{available:!1,reason:"rust-analyzer initialized without hover support.",references:a.map(i=>[i.symbolId,[]]),...r?{callees:l.map(i=>[i.symbolId,[]])}:{},signatures:f.map(i=>[i.symbolId,null])};let $=ie(u,e.projectRoot,o);await se(u,$,e.diagnosticsTimeoutMs??1e4),await R(e.settleDelayMs??5e3);let S=n?await d(a,e.concurrency??8,async i=>{let D=await E(u,p(e.projectRoot,i,!1),{requestTimeoutMs:e.requestTimeoutMs,retryTimeoutMs:e.referenceRetryTimeoutMs});return{symbolId:i.symbolId,references:k(M(e.projectRoot,D.locations)),complete:D.complete}}):a.map(i=>({symbolId:i.symbolId,references:[],complete:!0})),B=r?await d(l,e.concurrency??8,async i=>({symbolId:i.symbolId,callees:await ae(u,e.projectRoot,i,s)})):[],U=t?await d(f,e.concurrency??8,async i=>({symbolId:i.symbolId,signature:await V(u,e.projectRoot,i,s)})):[];return{available:!0,references:S.filter(i=>i.complete).map(i=>[i.symbolId,i.references]),incompleteReferenceSymbolIds:S.filter(i=>!i.complete).map(i=>i.symbolId),...r?{callees:B.map(i=>[i.symbolId,i.callees])}:{},...t?{signatures:U.map(i=>[i.symbolId,i.signature])}:{}}}finally{await u.shutdown().catch(()=>{})}}function W(e){return e.referenceDefinitions??e.definitions}function H(e){return e.calleeDefinitions??e.definitions}function j(e){return e.signatureDefinitions??e.definitions}function Q(e){return[...e.includeReferences!==!1?W(e):[],...e.includeCallees===!0?H(e):[],...e.includeSignatures===!0?j(e):[]]}async function V(e,n,r,t={}){let s=p(n,r,!1),o=await X(e,{textDocument:s.textDocument,position:s.position},t);return Y(o)}async function X(e,n,r={}){try{return await e.hover(n,r)}catch(t){if(m(t),!(t instanceof Error?t.message:String(t)).includes("content modified"))return null;await F(r.deadlineMs);try{return await e.hover(n,r)}catch(o){return m(o),null}}}function Y(e){if(!e)return null;let n=Z(e.contents),r=/```(?:rust)?\s*([\s\S]*?)```/i.exec(n),t=r?r[1]:n;for(let s of t.split(/\r?\n/)){let o=s.replace(/^`+|`+$/g,"").trim();if(o&&ee(o))return o}return null}function Z(e){return typeof e=="string"?e:Array.isArray(e)?e.map(q).join(`
2
- `):"value"in e?e.value:""}function q(e){return typeof e=="string"?e:e.value}function ee(e){return/^(?:pub(?:\([^)]*\))?\s+)?(?:async\s+)?(?:const\s+)?(?:unsafe\s+)?(?:extern\s+(?:"[^"]+"\s+)?)?(?:fn|struct|enum|trait|type|const|static|mod)\b/.test(e)}function ne(e){return{...e.length>0?{linkedProjects:e}:{},references:{excludeImports:!1,excludeTests:!1}}}function te(e,n){return n.length===1?h(n[0]):b(e)}function re(e,n){let r=b(e),t=[],s=new Set;for(let o of n){let a=h(b(r,o.relativePath));for(;me(r,a);){let l=J(a,"Cargo.toml");if(_(l)){s.has(l)||(s.add(l),t.push(l));break}let f=h(a);if(f===a)break;a=f}}return t}function ie(e,n,r){let t=new Set,s=[];for(let o of r)if(!t.has(o.relativePath)){t.add(o.relativePath);try{let a=g(n,o.relativePath);e.didOpenTextDocument({uri:a,languageId:"rust",version:1,text:I(n,o.relativePath,{inputKind:"indexed Rust source file"})}),s.push(a)}catch(a){if(!z(a))throw a}}return s}async function se(e,n,r){await Promise.all(n.map(t=>e.waitForDiagnostics(t,r).catch(()=>!1)))}async function De(e,n){return(await E(e,n)).locations}async function E(e,n,r={}){try{return{locations:await e.references(n,{timeoutMs:r.requestTimeoutMs,deadlineMs:r.deadlineMs}),complete:!0}}catch(t){m(t);let s=t instanceof Error?t.message:String(t);if(O(t))return{locations:[],complete:!1};if(!s.includes("content modified"))return{locations:[],complete:!0};await F(r.deadlineMs);try{return{locations:await e.references(n,oe(r)),complete:!0}}catch(o){return m(o),{locations:[],complete:!O(o)}}}}function oe(e){return{...e.retryTimeoutMs&&e.retryTimeoutMs>0?{timeoutMs:e.retryTimeoutMs}:{},...e.deadlineMs!==void 0?{deadlineMs:e.deadlineMs}:{}}}function O(e){let n=e instanceof Error?e.message:String(e);return n.includes("rust-analyzer LSP request")&&n.includes("timed out after")}async function ae(e,n,r,t={}){let s=p(n,r,!1),o=await le(e,{textDocument:s.textDocument,position:s.position},t),a=(await Promise.all(o.map(l=>ce(e,l,t)))).flat();return fe(ue(n,a))}async function le(e,n,r={}){try{return await e.prepareCallHierarchy(n,r)}catch(t){return m(t),[]}}async function ce(e,n,r={}){try{return await e.outgoingCalls(n,r)}catch(t){return m(t),[]}}async function F(e){if(e===void 0){await R(1e3);return}await P(1e3,e)}function m(e){if(e instanceof A)throw e}function ue(e,n){return n.map(r=>({symbol:r.to.name,file:L(e,r.to.uri),line:r.to.selectionRange.start.line,...r.fromRanges[0]===void 0?{}:{callsiteLine:r.fromRanges[0].start.line}}))}function fe(e){let n=new Set,r=[];for(let t of e){let s=`${t.symbol}\0${t.file}\0${t.line}\0${t.callsiteLine??""}`;n.has(s)||(n.add(s),r.push(t))}return r.sort((t,s)=>t.file.localeCompare(s.file)||t.line-s.line||t.symbol.localeCompare(s.symbol))}function me(e,n){return n===e||n.startsWith(`${e}${N}`)}async function de(){return new Promise((e,n)=>{let r=[];c.stdin.on("data",t=>r.push(t)),c.stdin.on("error",n),c.stdin.on("end",()=>e(Buffer.concat(r).toString("utf8")))})}async function pe(){try{let e=JSON.parse(await de()),n=await G(e);c.stdout.write(JSON.stringify(n))}catch(e){let n={available:!1,reason:e instanceof Error?e.message:String(e),references:[]};c.stdout.write(JSON.stringify(n)),c.exitCode=1}}c.argv[1]&&K(import.meta.url)===c.argv[1]&&pe();export{G as a,W as b,H as c,j as d,Q as e,V as f,X as g,Y as h,ne as i,te as j,re as k,ie as l,se as m,De as n,E as o,ae as p};
3
- //# sourceMappingURL=chunk-HXOU4XNH.js.map
@@ -1,2 +0,0 @@
1
- import{a as t}from"./chunk-I6UTXNHU.js";var e=t;export{e as a};
2
- //# sourceMappingURL=chunk-IMKZEXZG.js.map
@@ -1,61 +0,0 @@
1
- import{a as S,b as k,c as P,d as I,e as j,i as J}from"./chunk-HG722PO7.js";import{C as z,I as Q,J as f,O as B,P as W,Q as h,x as C,z as $}from"./chunk-GH5YSGZL.js";function de(t,e){return t.reason instanceof Error?t.reason:new Error(e)}function dt(t,e){if(t?.aborted)throw de(t,e)}import{randomUUID as le}from"crypto";import{closeSync as ue,fsyncSync as fe,linkSync as ye,mkdirSync as pe,openSync as me,statSync as ge,unlinkSync as be,writeSync as ke}from"fs";import{dirname as x}from"path";var E="scip-query-process-lock",G=1,F=Object.freeze({wallNow:()=>Date.now(),isProcessAlive:I,readProcessIdentity:P,randomToken:()=>le(),makeDirectory:t=>pe(t,{recursive:!0}),openFile:(t,e,r)=>me(t,e,r),writeFile:(t,e,r,n)=>ke(t,e,r,n),syncFile:t=>fe(t),closeFile:t=>ue(t),linkFile:(t,e)=>ye(t,e),readFile:t=>f(t,"process lock record"),statFile:t=>{let e=ge(t);return{dev:e.dev,ino:e.ino,size:e.size,mtimeMs:e.mtimeMs}},removeFile:t=>be(t)});function K(t,e){let r=e.runtime??F;r.makeDirectory(x(t));let n;for(let i=0;i<2;i+=1)try{return{kind:"acquired",lock:H(t,e,r),...n?{reclaimed:n}:{}}}catch(o){if(o.code!=="EEXIST")throw o;let s=m(t,{parseLegacy:e.parseLegacy,runtime:r});if(i===0&&Se(t,s,{creationGraceMs:e.creationGraceMs,parseLegacy:e.parseLegacy,runtime:r})){n=s;continue}return{kind:"contended",observation:s}}return{kind:"contended",observation:m(t,{parseLegacy:e.parseLegacy,runtime:r})}}function m(t,e={}){let r=e.runtime??F,n,i;try{n=r.statFile(t),i=r.readFile(t)}catch(c){return c.code==="ENOENT"?{state:"missing"}:{state:"malformed"}}let o;try{o=JSON.parse(i)}catch{return{state:"malformed",raw:i,identity:n}}let s=Le(o);if(s)return{state:"valid",raw:i,identity:n,record:s,owner:Fe(s),parsed:o};let a=e.parseLegacy?.(o)??null;return a?{state:"legacy",raw:i,identity:n,owner:a,parsed:o}:{state:"malformed",raw:i,identity:n,parsed:o}}function Le(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t;if(e.protocol!==E||e.version!==G||typeof e.kind!="string"||e.kind.trim()===""||typeof e.pid!="number"||!Number.isSafeInteger(e.pid)||e.pid<=0||typeof e.token!="string"||e.token.trim()===""||typeof e.startedAt!="string"||!Number.isFinite(Date.parse(e.startedAt))||e.detail!==void 0&&(typeof e.detail!="object"||e.detail===null||Array.isArray(e.detail)))return null;let r=e.processIdentity===void 0?null:S(e.processIdentity);return e.processIdentity!==void 0&&(!r||r.pid!==e.pid)?null:{protocol:E,version:G,kind:e.kind,pid:e.pid,token:e.token,...r?{processIdentity:r}:{},startedAt:e.startedAt,...e.detail?{detail:e.detail}:{}}}function Se(t,e,r={}){let n=r.runtime??F;if(!A(e,n))return!1;let i=Ie(`${t}.reclaim`,n);if(!i)return!1;try{let o=m(t,{parseLegacy:r.parseLegacy,runtime:n});return!V(e,o)||!A(o,n)?!1:q(t,n)}finally{i.release()}}function H(t,e,r){let n=e.directoryDurability??"durable",i=e.pid??process.pid,o=r.randomToken(),s=e.processIdentity===void 0?r.readProcessIdentity(i):e.processIdentity,a={protocol:E,version:G,kind:e.kind,pid:i,token:o,...s?{processIdentity:s}:{},startedAt:new Date(r.wallNow()).toISOString(),...e.detail?{detail:e.detail}:{}},c=`${t}.${o}.candidate`,y=r.openFile(c,"wx",384),l;try{W(y,Buffer.from(`${JSON.stringify(a)}
2
- `),r,"process lock"),r.syncFile(y)}catch(u){l=u}try{r.closeFile(y)}catch(u){l??=u}if(l!==void 0)throw v(c,r),l;try{r.linkFile(c,t)}catch(u){throw v(c,r),u}if(v(c,r),n==="durable")try{X(x(t),r)}catch(u){throw Pe(t,a,r),u}let p=!1;return{path:t,record:a,release:()=>p?!1:(p=!0,U(t,a,r,n))}}function Pe(t,e,r=F){return U(t,e,r,"durable")}function U(t,e,r,n){let i=m(t,{runtime:r});return i.state!=="valid"||!i.record||i.record.pid!==e.pid||i.record.token!==e.token||e.processIdentity&&(!i.record.processIdentity||!k(e.processIdentity,i.record.processIdentity))?!1:q(t,r,n)}function Ie(t,e){for(let r=0;r<2;r+=1)try{return H(t,{kind:"reclaim-guard",runtime:e},e)}catch(n){if(n.code!=="EEXIST")return null;let i=m(t,{runtime:e});if(r>0||!A(i,e))return null;let o=m(t,{runtime:e});if(!V(i,o)||!q(t,e))return null}return null}function A(t,e){if(t.state==="missing")return!1;if(t.owner){if(!e.isProcessAlive(t.owner.pid))return!0;if(!t.owner.processIdentity)return!1;let r=e.readProcessIdentity(t.owner.pid);return r!==null&&!k(t.owner.processIdentity,r)}return!1}function V(t,e){return t.state===e.state&&t.raw===e.raw&&t.identity!==void 0&&e.identity!==void 0&&t.identity.dev===e.identity.dev&&t.identity.ino===e.identity.ino&&t.identity.size===e.identity.size&&t.identity.mtimeMs===e.identity.mtimeMs}function Fe(t){return{pid:t.pid,...t.processIdentity?{processIdentity:t.processIdentity}:{}}}function X(t,e){let r;try{r=e.openFile(t,"r")}catch(n){if(h(n,process.platform))return;throw n}try{e.syncFile(r)}catch(n){if(!h(n,process.platform))throw n}finally{e.closeFile(r)}}function q(t,e,r="durable"){try{return e.removeFile(t),r==="durable"&&X(x(t),e),!0}catch{return!1}}function v(t,e){try{e.removeFile(t)}catch{}}import{join as we}from"path";var Re=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 It(t,e={}){return O(we(t,"gc.lock"),e)}function O(t,e={}){let r=e.waitMs??0,n=e.pollMs??10,i=e.now??j,o=i()+r;do{let s=he(t,e.directoryDurability);if(s)return ve(s);let a=o-i();if(a<=0)return null;Ee(Math.min(n,a))}while(i()<=o);return null}function he(t,e){let r=K(t,{kind:"generic",parseLegacy:Re,...e?{directoryDurability:e}:{}});return r.kind==="acquired"?r.lock:null}function ve(t){return{release:()=>{t.release()}}}function Ee(t){let e=new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));Atomics.wait(e,0,0,t)}import{createHash as Ge,randomUUID as Ae}from"crypto";import{existsSync as g,mkdirSync as xe,readdirSync as qe,rmSync as Z,statSync as ee}from"fs";import{basename as Oe,dirname as w,join as d}from"path";var De=1,Me=1,Te=".scipquery-generations",Ne="manifest.json",te="readers",_e="gc.lock",Ce=128,L=new Map,re={pid:process.pid,now:()=>new Date,randomToken:()=>Ae(),isProcessAlive:I,readProcessIdentity:P};function b(t){return d(w(t),Te)}function $e(t){return d(b(t),_e)}function Dt(t,e=re){let r=O($e(t.dbPath),{waitMs:5e3,directoryDurability:"recoverable"});if(!r)throw new Error("SQLite generation retention is busy; retry opening the index.");let n;try{let i=We(t);if(i.source!=="immutable")return{generation:i,release(){}};let o=e.randomToken();if(!/^[A-Za-z0-9._-]+$/.test(o))throw new Error("SQLite generation reader token is unsafe.");let s=d(b(t.dbPath),te);xe(s,{recursive:!0}),n=d(s,`${e.pid}-${o}.json`);let a=e.readProcessIdentity(e.pid);J(n,{version:1,token:o,generationIdentity:i.identity,pid:e.pid,...a?{processIdentity:a}:{},acquiredAt:e.now().toISOString()},{spacing:2,trailingNewline:!0});let c=!1;return{generation:i,release(){c||!n||(c=!0,Z(n,{force:!0}))}}}finally{r.release()}}function Mt(t,e,r=re,n={}){let i=d(b(t),te);if(!g(i))return{protectedGenerations:new Set,activeLeases:0,staleLeasesRemoved:0,malformedLeases:0};let o=new Set,s=0,a=0,c=0;for(let y of qe(i,{withFileTypes:!0})){if(!y.isFile()||!y.name.endsWith(".json"))continue;let l=d(i,y.name),p;try{p=ze(JSON.parse(f(l,"SQLite generation reader lease")))}catch{p=null}if(!p){c+=1;for(let u of e)o.add(u);continue}if(!Qe(p,r)){n.removeStale!==!1&&(Z(l,{force:!0}),a+=1);continue}s+=1,o.add(p.generationIdentity)}return{protectedGenerations:o,activeLeases:s,staleLeasesRemoved:a,malformedLeases:c}}function ze(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t,r=e.processIdentity===void 0?null:S(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&&(!r||r.pid!==e.pid)?null:{version:1,token:e.token,generationIdentity:e.generationIdentity,pid:e.pid,...r?{processIdentity:r}:{},acquiredAt:e.acquiredAt}}function Qe(t,e){if(!e.isProcessAlive(t.pid))return!1;if(!t.processIdentity)return!0;let r=e.readProcessIdentity(t.pid);return r===null||k(t.processIdentity,r)}function ne(t){try{let e=JSON.parse(f(d(b(t),"state.json"),"SQLite generation state"));return Ve(e)?e:null}catch{return null}}function Be(t,e){return je(b(t),e)}function je(t,e){try{let r=JSON.parse(f(d(t,e,Ne),"SQLite generation manifest"));return Ue(r,e)?r:null}catch{return null}}function We(t){let e=ne(t.dbPath);if(e){let r=Ke(t,e.currentGeneration);if(r)return r;if(e.artifactSet==="immutable-v1")throw new Error(`Published SQLite generation ${e.currentGeneration} is missing or invalid.`)}if(g(d(w(t.dbPath),"index.lock")))throw new Error("Legacy SQLite publication is in progress; retry after the reindex lock is released.");return He(t,e?.currentGeneration)}function Tt(t){let e=ne(t);if(e)return e.currentGeneration;try{let r=d(w(t),"meta.json"),n=g(r)?f(r,"reindex metadata"):void 0;return ie(t,n)}catch{return null}}function Je(t){return $(C(t))??t}function Ke(t,e){try{let r=d(b(t.dbPath),e),n=Be(t.dbPath,e);if(!n)return null;let i=D(r,n.database),o=n.index?D(r,n.index):void 0,s=n.metadata?D(r,n.metadata):void 0;return!M(i,n.database)||n.index&&(!o||!M(o,n.index))||n.metadata&&(!s||!M(s,n.metadata))?null:{identity:e,databasePath:i,...o?{indexPath:o}:{},...s?{metadataPath:s,metadataRaw:f(s,"reindex metadata")}:{},source:"immutable"}}catch{return null}}function He(t,e){let r=oe(t.dbPath),n=d(w(t.dbPath),"meta.json"),i=g(n)?f(n,"reindex metadata"):void 0,o=g(t.indexPath)?t.indexPath:void 0;return{identity:e??ie(t.dbPath,i),databasePath:t.dbPath,...o?{indexPath:o}:{},...i===void 0?{}:{metadataPath:n,metadataRaw:i},source:"legacy",databaseFileIdentity:r}}function ie(t,e){let r=Ge("sha256").update("sqlite-generation-legacy-v1\0");return e!==void 0&&r.update(Je(e)),r.update(`\0${oe(t)}`),r.digest("hex")}function oe(t){let e=ee(t);return`${e.dev}:${e.ino}:${e.size}:${e.mtimeMs}`}function D(t,e){if(Oe(e.file)!==e.file||e.file==="."||e.file==="..")throw new Error("SQLite generation manifest contains an unsafe artifact path");return d(t,e.file)}function M(t,e){if(!g(t))return!1;let r=Y(t);if(!r||r.size!==e.size)return!1;let n=`${t}\0${e.sha256}\0${r.identity}`;if(L.has(n))return!0;let i=B(t,{inputKind:"immutable SQLite generation artifact",maxBytes:e.size}),o=Y(t);if(!o||o.identity!==r.identity||i!==e.sha256)return!1;for(L.set(n,!0);L.size>Ce;){let s=L.keys().next().value;if(s===void 0)break;L.delete(s)}return!0}function Y(t){let e=ee(t,{bigint:!0});return e.isFile()?{identity:`${e.dev}:${e.ino}:${e.size}:${e.mtimeNs}:${e.ctimeNs}`,size:Number(e.size)}:null}function Ue(t,e){return t.version===Me&&t.identity===e&&T(t.database)&&(t.index===void 0||T(t.index))&&(t.metadata===void 0||T(t.metadata))}function T(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 Ve(t){return t.version===De&&typeof t.currentGeneration=="string"&&!!t.currentGeneration&&typeof t.publishedAt=="string"&&Number.isFinite(Date.parse(t.publishedAt))&&(t.artifactSet===void 0||t.artifactSet==="immutable-v1")&&Xe(t.stableMirrors)&&Ye(t.previousGeneration)&&Ze(t.publication)}function Xe(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 Ye(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 Ze(t){if(t===void 0)return!0;if(!t||typeof t!="object")return!1;let e=t,r=[e.converterDurationMs,e.affectedDocumentCount,e.changedDocumentCount,e.producerDurationMs,e.materializationDurationMs,e.patchDurationMs].filter(n=>n!==void 0);return(e.mode==="incremental"||e.mode==="full")&&e.validation==="passed"&&e.converterDurationMs!==void 0&&r.every(n=>typeof n=="number"&&Number.isFinite(n)&&n>=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 et from"ignore";import{existsSync as se,readdirSync as tt}from"fs";import{dirname as N,isAbsolute as ae,join as R,relative as rt,resolve as nt}from"path";function Qt(t){let e=et();return it(t,e)||e.add(at),{isIgnored:n=>_(e,t,n),filter:n=>n.filter(i=>!_(e,t,i))}}function it(t,e){let r=new Set,n=(s,a)=>{if(!(r.has(s)||!se(s)))try{let c=Q(s,{maxBytes:z,inputKind:"gitignore file"});e.add(a?ot(c,a):c),r.add(s)}catch{}},i=N(t),o=0;for(;i!==N(i)&&o<5&&(n(R(i,".gitignore"),""),!se(R(i,".git")));)i=N(i),o++;return ce(t,"",e,n),r.size>0}function ce(t,e,r,n){let i=e?R(t,e):t;n(R(i,".gitignore"),e);let o;try{o=tt(i,{withFileTypes:!0})}catch{return}for(let s of o){if(!s.isDirectory()||s.name===".git")continue;let a=e?`${e}/${s.name}`:s.name;_(r,t,`${a}/`)||ce(t,a,r,n)}}function ot(t,e){let r=e.replaceAll("\\","/").replace(/\/+$/,"");return t.split(/\r?\n/).map(n=>st(n,r)).join(`
3
- `)}function st(t,e){let r=t.trimStart();if(!r||r.startsWith("#"))return t;let n=t.slice(0,t.length-r.length),i=r.startsWith("!"),o=i?r.slice(1):r;if(!o||o.startsWith("#"))return t;let s=o.startsWith("/"),a=s?o.slice(1):o,l=(a.endsWith("/")?a.slice(0,-1):a).includes("/")||s?`${e}/${a}`:`${e}/**/${a}`;return`${n}${i?"!":""}${l}`}var at=`
4
- # Dependencies
5
- node_modules/
6
- vendor/
7
- .bundle/
8
-
9
- # Build output
10
- dist/
11
- build/
12
- out/
13
- target/
14
- bin/
15
- obj/
16
-
17
- # Python
18
- __pycache__/
19
- *.pyc
20
- *.pyo
21
- .venv/
22
- venv/
23
- .env/
24
- env/
25
- *.egg-info/
26
-
27
- # Rust
28
- target/
29
-
30
- # Java / Kotlin / Scala
31
- *.class
32
- .gradle/
33
- .mvn/
34
-
35
- # C# / .NET
36
- bin/
37
- obj/
38
- packages/
39
-
40
- # Go
41
- vendor/
42
-
43
- # Dart
44
- .dart_tool/
45
- build/
46
-
47
- # PHP
48
- vendor/
49
-
50
- # IDE / OS
51
- .idea/
52
- .vscode/
53
- *.swp
54
- *.swo
55
- .DS_Store
56
- Thumbs.db
57
-
58
- # Type definitions (often noise in queries)
59
- *.d.ts
60
- `;function _(t,e,r){let n=ct(e,r);if(!n)return!1;try{return t.ignores(n)}catch{return!1}}function ct(t,e){if(!e||e===".")return null;if(!ae(e)&&!e.startsWith(".."))return e.replaceAll("\\","/");let r=ae(e)?e:nt(t,e),n=rt(t,r).replaceAll("\\","/");return!n||n==="."||n.startsWith("..")?null:n}export{de as a,dt as b,K as c,m as d,Se as e,It as f,O as g,De as h,Me as i,Te as j,Ne as k,b as l,$e as m,Dt as n,Mt as o,ne as p,Be as q,je as r,We as s,Tt as t,Je as u,oe as v,Qt as w};
61
- //# sourceMappingURL=chunk-ISIQLPJ2.js.map
@@ -1,2 +0,0 @@
1
- import{a as O,b as y,c as b,d as T,f as _,g as z,h as G}from"./chunk-OXYAWIEA.js";import{a as J}from"./chunk-FKGQOTKD.js";import{b as B}from"./chunk-T6QD2ZQB.js";import{d as N}from"./chunk-WSLEJSFR.js";import{h as d}from"./chunk-C7IJMOFP.js";import{b as v,c as g,l as U,n as P}from"./chunk-DKM723YF.js";import{c as A}from"./chunk-IW5XQG5G.js";import{a as j,e as m}from"./chunk-HGFDYOVB.js";var ce={references:_,referenceMap:z,callerMap:(e,s)=>b(e).callerMap(s),calleeMap:q};function q(e,s){let a=j(),i=new Map,o=T(e,s),l=[],n=[],h=0,c=0,p=0,f=0,E=0,H=0,I=0;for(let{definition:t,callees:r}of o.hits)E+=1,r.length>0&&(H+=1,I+=r.length,i.set(t.symbolId,r));let u=K(e,o.hits);if(u.entries.length>0&&m("semantic.callees.prefetch-cache-write",()=>P(e,u.entries),()=>({entries:u.entries.length,sourceMissing:u.sourceMissing,skippedUnsupportedLanguage:u.skippedUnsupportedLanguage})),m("semantic.callees.cache-scan",()=>{for(let[t,r]of O(o.misses)){if(!y(t)){a&&(h+=r.length);continue}let R=d(e,t);if(!R){a&&(c+=r.length),n.push(...r);continue}let x=g(e,t,R),C=$(e,t);if(!C){n.push(...r);continue}let Y=U(e,t,x,C);for(let D of r){let L=Y.get(D.symbol)??null;if(L!==null){let M=V(L);if(M){a&&(p+=1),M.length>0&&i.set(D.symbolId,M);continue}a&&(f+=1)}l.push({def:D,contentHash:x,depsDigest:C})}}},()=>({definitions:s.length,skippedUnsupportedLanguage:h,sourceMissing:c,cacheHits:p,parseFailures:f,misses:l.length,unkeyed:n.length,inMemoryHits:E,inMemoryRows:H,inMemoryCalleeCount:I,resultRows:i.size})),l.length===0&&n.length===0)return i;let k=[...n,...l.map(t=>t.def)],w=0,F=m("semantic.callees.compute-misses",()=>{let t=G(e,k);return w=t.size,t},()=>({definitions:k.length,misses:l.length,unkeyed:n.length,rows:w}));for(let[t,r]of F)i.set(t,r);let S=l.filter(t=>b(e).capability("semantic-callees",t.def.relativePath).available).map(t=>({relativePath:t.def.relativePath,symbol:t.def.symbol,contentHash:t.contentHash,depsDigest:t.depsDigest,payload:JSON.stringify(F.get(t.def.symbolId)??[])}));return S.length>0?m("semantic.callees.cache-write",()=>P(e,S),()=>({entries:S.length})):m("semantic.callees.cache-write-skip",()=>{},()=>({reason:"provider-unavailable",misses:l.length})),i}function K(e,s){let a=[],i=new Map,o=0,l=0;for(let{definition:n,callees:h}of s){if(!y(n.relativePath)){l+=1;continue}if(!i.has(n.relativePath)){let p=d(e,n.relativePath),f=p?$(e,n.relativePath):null;i.set(n.relativePath,p&&f?{contentHash:g(e,n.relativePath,p),depsDigest:f}:null)}let c=i.get(n.relativePath);if(!c){o+=1;continue}a.push({relativePath:n.relativePath,symbol:n.symbol,contentHash:c.contentHash,depsDigest:c.depsDigest,payload:JSON.stringify(h)})}return{entries:a,sourceMissing:o,skippedUnsupportedLanguage:l}}var Q="typescript-callees-v2-callsite-line";function $(e,s){let a=y(s);if(a==="typescript")return J(e,s,Q)?.key??null;let i=X(e,s);return a==="rust"?v(JSON.stringify({kind:"semantic-callees",language:a,engine:N(e.config.projectRoot),positionMapping:"nearby-leaf-v2-callsite-line",depsDigest:i})):i}function V(e){try{return JSON.parse(e)}catch{return null}}var W=A("semantic-deps-digest",{clearGroups:["whole-project","source-file"]});function X(e,s){return W.get(e,s,()=>{let i=[...B(e).get(s)??[]].sort().map(o=>`${o}:${g(e,o,d(e,o))}`);return v(i.join("|"))})}export{ce as a,q as b};
2
- //# sourceMappingURL=chunk-IXESDH3J.js.map
@@ -1,8 +0,0 @@
1
- import{a as ee,b as P,d as v}from"./chunk-SB25YMEQ.js";import{e as Q,g as Z,h as F,u as q,w as te,x as h,y as f,z as p}from"./chunk-AK3PYTIK.js";function lt(e){try{return process.kill(e,0),!0}catch(t){return typeof t=="object"&&t!==null&&"code"in t&&t.code==="EPERM"}}import{randomUUID as Le}from"crypto";import{closeSync as Ne,existsSync as Oe,fsyncSync as ke,linkSync as Pe,mkdirSync as qe,openSync as $e,renameSync as Ce,unlinkSync as Te,writeSync as _e}from"fs";import{dirname as ie}from"path";import{chmodSync as Ie,constants as Fe,copyFileSync as Re}from"fs";import{dirname as Ee}from"path";var ne=Object.freeze({...te,copyFile:(e,t)=>Re(e,t,Fe.COPYFILE_FICLONE),chmodFile:(e,t)=>Ie(e,t)});function ve(e,t,n={}){let i=n.runtime??ne,r=Ee(t),o=h(r,i);i.copyFile(e,t),n.mode!==void 0&&i.chmodFile(t,n.mode);let s=i.openFile(t,"r");try{i.syncFile(s)}finally{i.closeFile(s)}return p(o,f(r,i))}var re=Object.freeze({platform:process.platform,randomToken:()=>Le(),pathExists:e=>Oe(e),makeDirectory:e=>qe(e,{recursive:!0}),openFile:(e,t,n)=>$e(e,t,n),writeFile:(e,t,n,i)=>_e(e,t,n,i),syncFile:e=>ke(e),closeFile:e=>Ne(e),renameFile:(e,t)=>Ce(e,t),linkFile:(e,t)=>Pe(e,t),removeFile:e=>Te(e)});function $(e,t,n={}){let i=n.durability??"visibility",r=n.runtime??re,o=ie(e),s=i==="durable"?h(o,r):(r.makeDirectory(o),"not-requested"),a=`${e}.tmp-${r.randomToken()}`,c=typeof t=="string"?Buffer.from(t):t,d,l=!1;try{d=r.openFile(a,"wx",n.mode??384),l=!0,q(d,c,r,"atomic file"),i==="durable"&&r.syncFile(d),r.closeFile(d),d=void 0,r.renameFile(a,e),l=!1;let m=i==="durable"?p(s,f(o,r)):"not-requested";return oe(i,m)}finally{if(d!==void 0)try{r.closeFile(d)}catch{}if(l)try{r.removeFile(a)}catch{}}}function L(e,t,n={}){let i=n.durability??"visibility",r=n.runtime??re;if(!r.linkFile)throw new Error("Exclusive atomic file publication requires hard-link support.");let o=ie(e),s=i==="durable"?h(o,r):(r.makeDirectory(o),"not-requested"),a=`${e}.tmp-${r.randomToken()}`,c=typeof t=="string"?Buffer.from(t):t,d,l=!1;try{d=r.openFile(a,"wx",n.mode??384),l=!0,q(d,c,r,"exclusive atomic file"),i==="durable"&&r.syncFile(d),r.closeFile(d),d=void 0,r.linkFile(a,e);let m=i==="durable"?f(o,r):"not-requested";r.removeFile(a),l=!1;let b=i==="durable"?p(s,m,f(o,r)):"not-requested";return oe(i,b)}finally{if(d!==void 0)try{r.closeFile(d)}catch{}if(l)try{r.removeFile(a)}catch{}}}function oe(e,t){return{requestedDurability:e,achievedDurability:e==="visibility"?"visibility":t==="synced"?"directory-durable":"file-flushed",directorySync:t}}function se(e,t,n={}){$(e,ae(t,n),{durability:"visibility",runtime:n.runtime})}function C(e,t,n={}){return $(e,ae(t,n),{durability:"durable",runtime:n.runtime})}function ae(e,t){let n=JSON.stringify(e,null,t.spacing);return t.trailingNewline?`${n}
2
- `:n}import{createHash as T,randomUUID as pe}from"crypto";import{closeSync as Ue,existsSync as w,fstatSync as We,lstatSync as B,mkdirSync as Ke,openSync as ze,readdirSync as D,readSync as Xe,renameSync as _,rmSync as g}from"fs";import{basename as S,dirname as J,join as y}from"path";function de(e){return N(e,Je)}function It(e){return N(e,je)}function N(e,t){return Array.isArray(e)?`[${e.map(n=>N(n,t)).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).sort(([n],[i])=>t(n,i)).map(([n,i])=>`${JSON.stringify(n)}:${N(i,t)}`).join(",")}}`:JSON.stringify(e)}function Je(e,t){return e.localeCompare(t)}function je(e,t){return e<t?-1:e>t?1:0}var j=1,He=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(n,i,r,o){let s=n==="item-too-large"?`request is ${o} bytes; per-item limit is ${r.maxItemBytes}`:n==="item-capacity"?`mailbox has ${i.totalItems} retained items; limit is ${r.maxItems}`:n==="byte-capacity"?`mailbox retains ${i.totalBytes} bytes and the request adds ${o}; limit is ${r.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=i;this.limits=r;this.attemptedBytes=o;this.name="MailboxBackpressureError"}code;status;limits;attemptedBytes},ge=".owner.json",U={isProcessAlive:()=>!0,readProcessIdentity:()=>null};function $t(e){return{rootDir:e,pendingDir:y(e,"pending"),inflightDir:y(e,"inflight"),responseDir:y(e,"responses"),deadLetterDir:y(e,"dead-letter"),legacyRequestDir:y(e,"requests")}}function I(e={}){let t={...He,...e};for(let[n,i]of Object.entries(t))if(!Number.isFinite(i)||i<=0||!Number.isInteger(i))throw new Error(`Mailbox limit ${n} must be a positive integer.`);return t}function k(e){let t=[e.pendingDir,e.inflightDir,e.responseDir,e.deadLetterDir,e.legacyRequestDir].map(n=>h(n));return p(...t)}function Ct(e,t){return T("sha256").update(de({namespace:e,payload:t})).digest("hex")}function xe(e){if(!/^[a-f0-9]{64}$/.test(e))throw new Error("Mailbox operation keys must be lowercase SHA-256 identities.");return`op-${e}`}function Tt(e,t,n={}){let i=I(n.limits),r=n.nowMs??Date.now(),o=k(e);return st(t),K(e,i,n.admissionLockTimeoutMs??2e3,n.monotonicNow??v,n.durability??"durable",()=>{W(e,r,i);let s=y(e.pendingDir,`${t.id}.json`),a=y(e.responseDir,`${t.id}.json`),c=le(e,t.id);if(c){let b=ue(c,t.operationKey,t.id);return{disposition:"duplicate",requestId:t.id,responsePath:a,authoritativeDeadlineAtMs:b.deadlineAtMs??t.deadlineAtMs}}let d=`${JSON.stringify(t)}
3
- `,l=Buffer.byteLength(d),m=R(e);if(l>i.maxItemBytes)throw new x("item-too-large",m,i,l);if(m.totalItems+1>i.maxItems)throw new x("item-capacity",m,i,l);if(m.totalBytes+l>i.maxBytes)throw new x("byte-capacity",m,i,l);n.onBeforePublish?.();try{let b=n.durability??"durable",u=L(s,d,{durability:b}),M=b==="durable"?p(o,u.directorySync):"not-requested";return{disposition:"accepted",requestId:t.id,responsePath:a,authoritativeDeadlineAtMs:t.deadlineAtMs,achievedDurability:u.achievedDurability,directorySync:M}}catch(b){if(b.code!=="EEXIST")throw b;let u=le(e,t.id);if(!u)throw b;let M=ue(u,t.operationKey,t.id);return{disposition:"duplicate",requestId:t.id,responsePath:a,authoritativeDeadlineAtMs:M.deadlineAtMs??t.deadlineAtMs}}})}function Ve(e,t){if(!t.ownerId.trim())throw new Error("Mailbox claim owner identity is required.");if(t.owner&&(!Number.isSafeInteger(t.owner.pid)||t.owner.pid<=0||t.owner.processIdentity!==void 0&&t.owner.processIdentity.pid!==t.owner.pid))throw new Error("Mailbox claim process identity is invalid.");let n=t.nowMs??Date.now(),i=I(t.limits),r=k(e);try{return K(e,i,2e3,t.monotonicNow??v,t.durability??"durable",()=>Ye(e,t.ownerId,n,i,t.liveness??U,t.owner??{pid:process.pid},r,t.durability??"durable",t.onClaimStage))}catch(o){if(o instanceof x&&o.code==="admission-busy")return[];throw o}}function _t(e,t){return!be(e.pendingDir)&&!be(e.legacyRequestDir)?[]:Ve(e,t)}function Ye(e,t,n,i,r,o,s,a,c){W(e,n,i,r);let d=y(e.inflightDir,O(t)),l=[...me(e.pendingDir,!1),...me(e.legacyRequestDir,!0)].sort((u,M)=>u.orderAtMs-M.orderAtMs||u.header.id.localeCompare(M.header.id)||u.path.localeCompare(M.path)),m=a==="durable"?s:"not-requested";l.length>0&&(a==="durable"?m=p(m,h(d)):Ke(d,{recursive:!0}),c?.("after-owner-directory-durable"),rt(d,t,o,a),c?.("after-owner-record-published"));let b=[];for(let u of l){if(b.length>=i.maxBatch)break;let M=y(e.responseDir,`${u.header.id}.json`);if(w(M)){g(u.path,{force:!0});continue}let H=Math.max(n+i.claimLeaseMs,(u.header.deadlineAtMs??n)+5e3),De=`${O(u.originalFile)}.${H}.claim`,V=y(d,De);try{_(u.path,V)}catch(Y){let G=Y.code;if(G==="ENOENT"||G==="EEXIST")continue;throw Y}c?.("after-claim-renamed");let Ae=a==="durable"?f(J(u.path)):"not-requested";c?.("after-source-directory-synced");let Se=a==="durable"?f(d):"not-requested";c?.("after-destination-directory-synced");let Be=p(m,Ae,Se);b.push({requestId:u.header.id,ownerId:t,path:V,originalFile:u.originalFile,claimedAtMs:n,claimExpiresAtMs:H,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:Be})}return b}function Jt(e,t={}){let n=I(t);if(e.byteLength>n.maxItemBytes)throw new x("item-too-large",{pending:0,inflight:1,responses:0,deadLetters:0,invalid:0,totalItems:1,totalBytes:e.byteLength},n,e.byteLength);return Z(e.path,{maxBytes:n.maxItemBytes,inputKind:"bounded mailbox item"})}function Ge(e,t,n,i={}){let r=i.nowMs??Date.now(),o=I(i.limits),s=t.deadlineAtMs===void 0?r+o.responseRetentionMs:Math.min(r+o.responseRetentionMs,Math.max(t.deadlineAtMs,r)+Me),a={mailboxVersion:j,operationKey:t.operationKey??`legacy-${t.requestId}`,clientId:t.clientId??"legacy",...t.deadlineAtMs===void 0?{}:{deadlineAtMs:t.deadlineAtMs},completedAtMs:r,expiresAtMs:s},c={...a,...n,...a},d=Buffer.byteLength(`${JSON.stringify(c)}
4
- `),l=R(e);if(d>o.maxItemBytes)throw new x("item-too-large",l,o,d);let m=Math.max(0,l.totalBytes-t.byteLength)+d;if(m>o.maxBytes&&m>l.totalBytes&&(Ze(e,r).removed>0&&(l=R(e),m=Math.max(0,l.totalBytes-t.byteLength)+d),m>o.maxBytes&&m>l.totalBytes))throw new x("byte-capacity",l,o,d);let b=i.durability??"durable";if(et(e,t,c,b),i.onAfterResponsePublished?.(),g(t.path,{force:!0}),b==="durable"){let u=J(t.path);f(w(u)?u:e.inflightDir)}}var Me=3e4,Qe=4096;function Ze(e,t){let n={removed:0,bytesFreed:0},i;try{i=D(e.responseDir)}catch{return n}for(let r of i){if(!r.endsWith(".json"))continue;let o=y(e.responseDir,r),s,a;try{let m=ze(o,"r");try{a=We(m).size;let b=Buffer.alloc(Math.min(Qe,a));Xe(m,b,0,b.length,0),s=b.toString("utf8")}finally{Ue(m)}}catch{continue}let c=ce(s,"expiresAtMs"),d=ce(s,"deadlineAtMs");if(c!==null&&c<=t||d!==null&&d+Me<=t)try{g(o,{force:!0}),n.removed+=1,n.bytesFreed+=a}catch{}}return n}function ce(e,t){let n=new RegExp(`"${t}":(\\d+)`).exec(e);if(!n)return null;let i=Number(n[1]);return Number.isSafeInteger(i)?i:null}function jt(e,t,n,i,r={}){let o=r.nowMs??Date.now(),s=I(r.limits);if(Ge(e,t,n,{...r,nowMs:o,limits:s}),!w(t.path)){let a=y(e.deadLetterDir,`${ct(t.requestId)}.${o}.${T("sha256").update(i).digest("hex").slice(0,12)}.json`),c={mailboxVersion:j,requestId:t.requestId,ownerId:t.ownerId,rejectedAtMs:o,reason:i,originalFile:t.originalFile},d=Buffer.byteLength(`${JSON.stringify(c,null,2)}
5
- `),l=R(e);l.totalItems<s.maxItems&&l.totalBytes+d<=s.maxBytes&&C(a,c,{spacing:2,trailingNewline:!0})}}function Ut(e,t={}){let n=t.nowMs??Date.now(),i=I(t.limits);return k(e),K(e,i,2e3,t.monotonicNow??v,"durable",()=>W(e,n,i,t.liveness??U))}function W(e,t,n,i=U){let r={reclaimed:0,completedClaimsRemoved:0,responsesRemoved:0,deadLettersRemoved:0,temporaryFilesRemoved:0},o=n.cleanupBatch;for(let s of X(e.inflightDir)){if(o<=0)break;let a=y(e.responseDir,`${s.requestId}.json`);if(w(a)){g(s.path,{force:!0}),r.completedClaimsRemoved++,o--;continue}if(s.claimExpiresAtMs>t||ot(e,s.ownerId,i)!=="dead")continue;let c=y(e.pendingDir,s.originalFile);try{_(s.path,c),r.reclaimed++}catch(d){if(d.code!=="EEXIST")throw d;g(s.path,{force:!0})}f(J(s.path)),f(e.pendingDir),o--}o=ye(e.responseDir,o,(s,a)=>a+n.responseRetentionMs,t,()=>{r.responsesRemoved++}),o=ye(e.deadLetterDir,o,(s,a)=>a+n.deadLetterRetentionMs,t,()=>{r.deadLettersRemoved++});for(let s of[e.pendingDir,e.inflightDir,e.responseDir,e.deadLetterDir,e.legacyRequestDir]){if(o<=0)break;for(let a of we(s)){if(o<=0)break;if(!S(a).includes(".tmp-"))continue;let c;try{c=B(a).mtimeMs}catch(d){if(d.code==="ENOENT")continue;throw d}c+n.temporaryRetentionMs>t||(g(a,{force:!0}),r.temporaryFilesRemoved++,o--)}}return at(e.inflightDir),r}function R(e){k(e);let t=[...A(e.pendingDir).map(c=>({path:c,pending:!0})),...A(e.legacyRequestDir).map(c=>({path:c,pending:!0}))],n=X(e.inflightDir).map(c=>({path:c.path,pending:!1})),i=A(e.responseDir).map(c=>({path:c,pending:!1})),r=A(e.deadLetterDir).map(c=>({path:c,pending:!1})),o=[...t,...n,...i,...r],s=0,a;for(let c of t){let d=E(c.path);if(!d){s++;continue}let l=d.enqueuedAtMs;if(l===void 0)try{l=B(c.path).mtimeMs}catch(m){if(m.code==="ENOENT")continue;throw m}a=a===void 0?l:Math.min(a,l)}return{pending:t.length,inflight:n.length,responses:i.length,deadLetters:r.length,invalid:s,totalItems:o.length,totalBytes:o.reduce((c,d)=>c+dt(d.path),0),...a===void 0?{}:{oldestPendingAt:new Date(a).toISOString()}}}function et(e,t,n,i){let r=y(e.responseDir,`${t.requestId}.json`),o=`${JSON.stringify(n)}
6
- `;try{L(r,o,{durability:i})}catch(s){if(s.code!=="EEXIST")throw s;let a=E(r),c=t.operationKey??`legacy-${t.requestId}`;if(a?.operationKey!==c)throw new Error(`Mailbox completion ${t.requestId} conflicts with an existing operation.`,{cause:s})}}function K(e,t,n,i,r,o){let s=y(e.rootDir,".admission.lock"),a=`${process.pid}-${pe()}`,c=i()+Math.max(0,n);for(;!tt(e.rootDir,s,a,r);){if(nt(s),i()>=c)throw new x("admission-busy",R(e),t,0);Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,5)}try{return o()}finally{try{z(s).ownerToken===a&&(g(s,{recursive:!0,force:!0}),r==="durable"&&f(e.rootDir))}catch{}}}function tt(e,t,n,i){let r=`${JSON.stringify({ownerToken:n,pid:process.pid,acquiredAtMs:Date.now()})}
7
- `;try{return L(t,r,{durability:i}),!0}catch(o){if(o.code==="EEXIST")return!1;try{z(t).ownerToken===n&&(g(t,{force:!0}),i==="durable"&&f(e))}catch{}throw o}}function nt(e){let t=null;try{let i=z(e);typeof i.ownerToken=="string"&&Number.isSafeInteger(i.pid)&&Number(i.pid)>0&&(t=Number(i.pid))}catch{}if(t===null||it(t))return;let n=`${e}.stale-${pe()}`;try{_(e,n)}catch(i){let r=i.code;if(r==="ENOENT"||r==="EEXIST")return;throw i}g(n,{recursive:!0,force:!0})}function z(e){try{return JSON.parse(F(e,"mailbox lock record"))}catch(t){if(t.code!=="EISDIR"&&!(t instanceof Q&&t.reason==="not-regular"))throw t;return JSON.parse(F(y(e,"owner.json"),"mailbox lock owner record"))}}function it(e){try{return process.kill(e,0),!0}catch(t){let n=t.code;return n==="EPERM"||n!=="ESRCH"}}function rt(e,t,n,i){let r=y(e,ge),o=n.processIdentity,s=he(r);if(s&&s.ownerId===t&&s.pid===n.pid&&(!s.processIdentity&&!o||s.processIdentity&&o&&P(s.processIdentity,o)))return;if(A(e).some(c=>c.endsWith(".claim")))throw new Error(`Mailbox owner identity ${t} collides with retained work from another process instance.`);let a={version:1,ownerId:t,pid:n.pid,...o?{processIdentity:o}:{}};i==="durable"?C(r,a):se(r,a)}function ot(e,t,n){let i=he(y(e.inflightDir,O(t),ge));if(!i)return"unknown";if(!n.isProcessAlive(i.pid))return"dead";if(!i.processIdentity)return"live";let r=n.readProcessIdentity(i.pid);return r?P(i.processIdentity,r)?"live":"dead":"unknown"}function he(e){try{let t=JSON.parse(F(e,"mailbox owner record"));if(t.version!==1||typeof t.ownerId!="string"||!t.ownerId||typeof t.pid!="number"||!Number.isSafeInteger(t.pid)||t.pid<=0)return null;let n=t.processIdentity===void 0?null:ee(t.processIdentity);return t.processIdentity!==void 0&&(!n||n.pid!==t.pid)?null:{version:1,ownerId:t.ownerId,pid:t.pid,...n?{processIdentity:n}:{}}}catch{return null}}function le(e,t){for(let n of[y(e.pendingDir,`${t}.json`),y(e.legacyRequestDir,`${t}.json`),y(e.responseDir,`${t}.json`)])if(w(n))return n;for(let n of X(e.inflightDir))if(n.requestId===t)return n.path;return null}function ue(e,t,n){let i=E(e);if(i?.operationKey===t)return i;if(S(e)===`${xe(t)}.json`)return{id:n,operationKey:t};throw new Error(`Mailbox operation ${n} conflicts with an existing retained record.`)}function st(e){if(e.mailboxVersion!==j||e.id!==xe(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 me(e,t){return A(e).filter(n=>n.endsWith(".json")).map(n=>{let i=B(n),r=S(n,".json"),o=E(n)??{id:r};return{path:n,originalFile:S(n),header:o,byteLength:i.size,orderAtMs:o.enqueuedAtMs??i.mtimeMs,legacy:t}})}function X(e){if(!w(e))return[];let t=[];for(let n of D(e,{withFileTypes:!0})){if(!n.isDirectory())continue;let i=fe(n.name);if(i===null)continue;let r=y(e,n.name);for(let o of D(r,{withFileTypes:!0})){if(!o.isFile()||!o.name.endsWith(".claim"))continue;let s=/^(.*)\.(\d+)\.claim$/.exec(o.name);if(!s)continue;let a=fe(s[1]),c=Number(s[2]);if(a===null||S(a)!==a||!a.endsWith(".json")||!Number.isSafeInteger(c))continue;let d=y(r,o.name),l=E(d)??{id:S(a,".json")},m;try{m=B(d)}catch(b){if(b.code==="ENOENT")continue;throw b}t.push({requestId:l.id,ownerId:i,path:d,originalFile:a,claimedAtMs:m.mtimeMs,claimExpiresAtMs:c,byteLength:m.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 t.sort((n,i)=>n.claimedAtMs-i.claimedAtMs||n.path.localeCompare(i.path))}function E(e){try{let t=JSON.parse(F(e,"mailbox record"));return typeof t.id!="string"||!t.id?null:{id:t.id,...typeof t.operationKey=="string"?{operationKey:t.operationKey}:{},...typeof t.clientId=="string"?{clientId:t.clientId}:{},...typeof t.enqueuedAtMs=="number"?{enqueuedAtMs:t.enqueuedAtMs}:{},...typeof t.deadlineAtMs=="number"?{deadlineAtMs:t.deadlineAtMs}:{}}}catch{return null}}function ye(e,t,n,i,r){for(let o of A(e)){if(t<=0)break;let s;try{s=B(o)}catch(a){if(a.code==="ENOENT")continue;throw a}n(o,s.mtimeMs)>i||(g(o,{force:!0}),r(),t--)}return t}function A(e){return w(e)?D(e,{withFileTypes:!0}).filter(t=>t.isFile()).map(t=>y(e,t.name)).sort():[]}function be(e){try{return D(e).some(t=>t.endsWith(".json"))}catch{return!1}}function we(e){if(!w(e))return[];let t=[];for(let n of D(e,{withFileTypes:!0})){let i=y(e,n.name);n.isFile()?t.push(i):n.isDirectory()&&t.push(...we(i))}return t.sort()}function at(e){if(w(e))for(let t of D(e,{withFileTypes:!0})){if(!t.isDirectory())continue;let n=y(e,t.name);D(n).some(i=>i.endsWith(".claim"))||g(n,{recursive:!0,force:!0})}}function dt(e){try{return B(e).size}catch{return 0}}function O(e){return Buffer.from(e,"utf8").toString("base64url")}function fe(e){try{let t=Buffer.from(e,"base64url").toString("utf8");return O(t)===e?t:null}catch{return null}}function ct(e){return/^[a-z0-9][a-z0-9-]{0,127}$/i.test(e)?e:`invalid-${T("sha256").update(e).digest("hex")}`}export{lt as a,ve as b,se as c,C as d,de as e,It as f,j as g,x as h,$t as i,k as j,Ct as k,xe as l,Tt as m,_t as n,Jt as o,Ge as p,jt as q,Ut as r,R as s};
8
- //# sourceMappingURL=chunk-JT6XX7QY.js.map
@@ -1,4 +0,0 @@
1
- import{b as ye}from"./chunk-Q6T2CAJL.js";import{i as I,m as W}from"./chunk-42W3LFUK.js";import{C as O}from"./chunk-7JYHQAH2.js";import{B as pe,E as G,e as me}from"./chunk-Q7GBK5T7.js";var Pe=12,Te=20,re=200,oe=800,Ae=.9,Oe=64,De=me("behavior-construct-ranges"),Se={if_statement:"branch",conditional_expression:"branch",ternary_expression:"branch",switch_statement:"branch",switch_expression:"branch",switch_case:"branch",case_statement:"branch",match_statement:"branch",match_expression:"branch",match_arm:"branch",for_statement:"loop",for_in_statement:"loop",for_of_statement:"loop",while_statement:"loop",do_statement:"loop",await_expression:"await",return_statement:"return",throw_statement:"throw",raise_statement:"throw",assignment_expression:"mutation",augmented_assignment_expression:"mutation",assignment:"mutation",pair:"shape",field_initializer:"shape",spread_element:"spread",dictionary_splat:"spread",catch_clause:"catch",except_clause:"catch",finally_clause:"finally"},Z=["anchor","signature","binding","branch","loop","call","await","return","throw","mutation","shape","spread","catch","finally"],ge=[...Z,"lifecycle"],Ce=["loop","await","throw","mutation","spread","catch","finally","lifecycle"],Ie=new Set(["onBeforeMount","onBeforeUnmount","onMounted","onUnmounted","useEffect","useInsertionEffect","useLayoutEffect"]);var _e=new Set(["object","object_pattern","dictionary","field_declaration_list","struct_expression","struct_pattern"]);function mt(e,n,t,o,r=[],s={}){let a=O(e,n);if(!a)return null;let h=G(e,n),c=Ne(e,n,t,o,r),l=te(e,n,c.startLine,c.endLine),u=l?.startLine??t,p=l?.endLine??o,N=(l?D(a.rootNode,c.startLine,c.endLine):null)??I(a.rootNode,u,p);if(!N)return null;let b=Le(N,h,u,p,r);if(!b||b.lines.length===0||b.lines.some(S=>S.text.length>oe))return null;let m=tt(h,u,p),C=nt(b);if((s.requireSavings??!0)&&C>=m*Ae)return null;let v=Z.filter(S=>b.lines.some(x=>x.signals.includes(S)));return{...l?{callable:{name:l.name,startLine:l.startLine,endLine:l.endLine}}:{},representation:"outline",constructKind:b.constructKind,signature:b.signature,lines:b.lines,signals:v,testCases:ye(n)==="test"?st(h,u,p):[],coverage:{sourceStatements:b.sourceStatements,representedStatements:b.sourceStatements,copiedStatements:b.copiedStatements,omittedStatements:0},rawCharacters:m,outlineCharacters:C,candidateLines:b.sourceStatements,omittedLines:0}}function pt(e,n,t,o,r){if(r.length===0)return[];let s=O(e,n);if(!s)return[];let a=G(e,n),h=Ne(e,n,t,o,r),c=te(e,n,h.startLine,h.endLine),l=c?.startLine??t,u=c?.endLine??o,p=(c?D(s.rootNode,h.startLine,h.endLine):null)??I(s.rootNode,l,u);if(!p)return[];let N=Le(p,a,l,u,r);return N?N.lines.filter(b=>b.text.length<=oe&&b.signals.some(m=>["branch","loop","catch","finally"].includes(m))&&r.some(m=>m>=b.line&&m<=b.endLine)):[]}function yt(e,n,t,o){let r=O(e,n);if(!r)return null;let s=D(r.rootNode,t,o)??I(r.rootNode,t,o);if(!s)return null;let a=[],h=ae(s),c=[];return se(s,s,l=>{if(k.has(l.type)||ke.has(l.type)){$e(a,c,l);return}if(ee.has(l.type)){qe(a,c,l);return}if(z.has(l.type)){ze(a,c,l);return}j.has(l.type)&&je(a,l)}),{facts:Ue(a),terminals:we(h),unsupported:c}}function Ne(e,n,t,o,r=[]){let s=r.filter(u=>u>=t&&u<=o),a=De.get(e,n,pe(e,n)??"",()=>new Map),h=`${t}:${o}:${s.join(",")}`,c=a.get(h);if(c)return a.delete(h),a.set(h,c),{startLine:c[0],endLine:c[1]};let l=Me(e,n,t,o,s);if(a.set(h,[l.startLine,l.endLine]),a.size>Oe){let u=a.keys().next().value;u!==void 0&&a.delete(u)}return l}function Me(e,n,t,o,r){let s=O(e,n),a=[];if(r.length>0&&s){let u=[],p=r[0],N=p;for(let m of r)p=Math.min(p,m),N=Math.max(N,m);Ee(s.rootNode,p,N,m=>{Ve(m)&&m.startPosition.row>=t&&m.endPosition.row<=o&&r.every(C=>m.startPosition.row<=C&&m.endPosition.row>=C)&&u.push(m),P.has(m.type)&&m.startPosition.row>=t&&m.endPosition.row<=o&&r.every(C=>m.startPosition.row<=C&&m.endPosition.row>=C)&&a.push(m)});let b=u.sort((m,C)=>m.endPosition.row-m.startPosition.row-(C.endPosition.row-C.startPosition.row)||m.startPosition.row-C.startPosition.row)[0];if(b)return{startLine:b.startPosition.row,endLine:b.endPosition.row}}let h=te(e,n,t,o);if(h)return{startLine:h.startLine,endLine:h.endLine};if(r.length===0)return{startLine:t,endLine:o};let c=(W(e,n)?.callables??[]).filter(u=>u.startLine>=t&&u.endLine<=o&&r.every(p=>u.startLine<=p&&u.endLine>=p)).sort((u,p)=>u.endLine-u.startLine-(p.endLine-p.startLine)||u.startLine-p.startLine)[0];if(!s)return c?{startLine:c.startLine,endLine:c.endLine}:{startLine:t,endLine:o};let l=a.sort((u,p)=>u.endPosition.row-u.startPosition.row-(p.endPosition.row-p.startPosition.row)||u.startPosition.row-p.startPosition.row)[0];return l?{startLine:l.startPosition.row,endLine:l.endPosition.row}:c?{startLine:c.startLine,endLine:c.endLine}:{startLine:t,endLine:o}}function bt(e,n,t,o,r={}){if(o-t+1<(r.minimumBodyLines??Te))return null;let a=Re(e,n,t,o,[],!1);if(!a)return null;let h=a.candidates.map(S=>({...S,signals:S.signals.filter(x=>x!=="anchor"&&x!=="signature")})).filter(S=>S.signals.length>0);if(h.length===0)return null;let c=it(h),l=h.filter(S=>S.text.length<=re);if(l.length===0)return null;let u=Ce.filter(S=>(c[S]??0)>0),p=u.filter(S=>S!=="await"),N=a.shapes.reduce((S,x)=>S+x.fields.length,0);if(p.length===0&&!((c.await??0)>0&&N>0)&&N<3)return null;let b=at(l,c),m=new Map;for(let S of u){let x=b.find(f=>f.signals.includes(S));x&&m.set(x.line,x)}if(m.size===0){let S=b.find(x=>x.signals.includes("branch"));S&&m.set(S.line,S)}let C=Math.min(10,Math.max(1,r.maxLines??m.size)),v=new Map;for(let S of m.values()){if(v.size>=C)break;v.set(S.line,S)}return v.size>=h.length&&a.shapes.length===0?null:{owner:a.callable?.name??null,startLine:t,endLine:o,lines:[...v.values()].sort((S,x)=>S.line-x.line),shapes:a.shapes,signalCounts:c,candidateLines:h.length,omittedLines:h.length-v.size}}function St(e,n,t,o){let r=Re(e,n,t,o,[],!1);return r?new Map(r.candidates.map(s=>[s.line,s.signals.filter(a=>a!=="lifecycle")])):new Map}var P=new Set(["arrow_function","constructor_declaration","function_declaration","function_definition","function_expression","generator_function","generator_function_declaration","function_item","lambda","lambda_expression","method","method_declaration","method_definition"]),B=new Set(["block","body","compound_statement","declaration_list","statement_block"]),k=new Set(["if_expression","if_statement","unless","unless_statement"]),ke=new Set(["conditional_expression","ternary_expression"]),ee=new Set(["do_statement","enhanced_for_statement","for_expression","for_in_statement","for_of_statement","for_statement","loop_expression","while_statement"]),z=new Set(["match_expression","match_statement","switch_expression","switch_statement"]),ve=new Set(["case_statement","match_arm","switch_case","switch_default"]),j=new Set(["try_expression","try_statement"]),X=new Set(["catch_clause","except_clause","rescue"]),$=new Set(["ensure","finally_clause"]),Y=new Set(["else","else_clause"]),xe=new Set(["raise_statement","return_statement","throw_statement"]),Ye=new Set(["block_comment","comment","line_comment"]);function $e(e,n,t){let o=t.childForFieldName("condition")??le(t),r=t.childForFieldName("consequence")??t.childForFieldName("body")??t.namedChildren.find(c=>B.has(c.type)),s=t.childForFieldName("alternative")??t.namedChildren.find(c=>Y.has(c.type));if(!o||!r){n.push(ce(t,"conditional-fields-unresolved"));return}let a=F(o,"predicate",o.text),h=F(r,be(r),"consequence");if(E(e,a,h,"predicate-consequence",{branchRole:"consequence"}),J(e,a,r,"consequence"),s){let c=F(s,be(s),"alternative");E(e,a,c,"predicate-alternative",{branchRole:"alternative"}),J(e,a,s,"alternative");return}E(e,a,ie(a,"otherwise continue"),"predicate-fallthrough",{branchRole:"fallthrough"})}function qe(e,n,t){let o=t.childForFieldName("body")??t.namedChildren.find(a=>B.has(a.type));if(!o){n.push(ce(t,"loop-body-unresolved"));return}let r=t.childForFieldName("condition"),s=F(r??t,"predicate",r?.text??R(t,o));E(e,s,F(o,"outcome","iteration"),"loop-iteration",{branchRole:"iteration"}),J(e,s,o,"iteration"),E(e,s,ie(s,"loop exits"),"loop-exit",{branchRole:"exit"})}function ze(e,n,t){let o=t.childForFieldName("body")??t.namedChildren.find(c=>B.has(c.type)),r=t.childForFieldName("value")??t.childForFieldName("condition")??t.childForFieldName("subject")??le(t),s=Ke(o??t);if(!r||s.length===0){n.push(ce(t,"switch-cases-unresolved"));return}let a=F(r,"predicate",r.text),h=!1;for(let c of s){let l=We(c);h||=l;let u=R(c,c.namedChildren.find(p=>Q(p)));E(e,a,F(c,"outcome",u||(l?"default":"case")),l?"predicate-default":"predicate-case",{branchRole:l?"default":"case"}),J(e,a,c,l?"default":"case")}h||E(e,a,ie(a,"no case matched"),"predicate-fallthrough",{branchRole:"fallthrough"})}function je(e,n){let t=F(n,"scope","try");for(let o of Ge(n)){let r=$.has(o.type),s=F(o,"handler",r?"finally":R(o,U(o)));E(e,t,s,r?"finally-cleanup":"exception-handler",{branchRole:r?"finally":"catch"}),He(e,s,o,r?"finally":"catch")}}function He(e,n,t,o){for(let r of ae(t)){let s=r.label.startsWith("throw")||r.label.startsWith("raise")?"throw":"return";E(e,n,r,s==="throw"?"handler-throw":"handler-return",{branchRole:o,terminalKind:s})}}function J(e,n,t,o){for(let r of ae(t)){let s=r.label.startsWith("throw")||r.label.startsWith("raise")?"throw":"return";E(e,n,r,s==="throw"?"predicate-throw":"predicate-return",{branchRole:o,terminalKind:s})}}function E(e,n,t,o,r){e.push({controller:n,outcome:t,subtype:o,attributes:r})}function F(e,n,t){return{kind:n,label:q(t).slice(0,oe),startLine:e.startPosition.row,endLine:e.endPosition.row,implicit:!1}}function ie(e,n){return{...e,kind:"outcome",label:n,implicit:!0}}function be(e){return xe.has(e.type)?"terminal":"outcome"}function ae(e){let n=[];return se(e,e,t=>{xe.has(t.type)&&n.push(F(t,"terminal",t.text))}),we(n)}function se(e,n,t){t(n);for(let o of n.namedChildren)o!==e&&P.has(o.type)||se(e,o,t)}function Ke(e){let n=[],t=o=>{for(let r of o.namedChildren)z.has(r.type)||(ve.has(r.type)?n.push(r):t(r))};return t(e),n}function Ge(e){let n=[],t=o=>{for(let r of o.namedChildren)j.has(r.type)||(X.has(r.type)||$.has(r.type)?n.push(r):P.has(r.type)||t(r))};return t(e),n}function We(e){let n=R(e,e.namedChildren.find(t=>Q(t))).trim();return e.type==="switch_default"||/^(?:default\b|_\s*=>)/u.test(n)}function ce(e,n){return{startLine:e.startPosition.row,endLine:e.endPosition.row,reason:n}}function Ue(e){let n=new Map;for(let t of e)n.set(`${t.controller.startLine}\0${t.controller.endLine}\0${t.outcome.startLine}\0${t.outcome.endLine}\0${t.subtype}\0${t.outcome.label}`,t);return[...n.values()]}function we(e){let n=new Map;for(let t of e)n.set(`${t.startLine}\0${t.endLine}\0${t.kind}\0${t.label}`,t);return[...n.values()]}function Ve(e){return P.has(e.type)||ee.has(e.type)||z.has(e.type)||j.has(e.type)||X.has(e.type)||$.has(e.type)}function Le(e,n,t,o,r){let a=D(e,t,o)??e,h=U(a),c=[],l=0,u=0,p=(i,d,y,g,w=!1,A=!0)=>{let K=w?y.trim():q(y);if(!K)return;let T=Math.max(t,i.startPosition.row),de=Math.min(o,i.endPosition.row);c.push({line:T,endLine:Math.max(T,de),depth:d,signals:Z.filter(he=>g.includes(he)||he==="anchor"&&r.some(fe=>fe>=T&&fe<=de)),text:K,copied:w}),A&&(l+=1,w&&(u+=1))},N=(i,d)=>{for(let y of i.namedChildren)_(y,d)},b=(i,d)=>{if(k.has(i.type)){m(i,d,"else if");return}if(Y.has(i.type)){let y=i.namedChildren.find(w=>k.has(w.type));if(y){m(y,d,"else if");return}p(i,d,"else",["branch"],!1,!1);let g=U(i)??i.namedChildren.find(w=>B.has(w.type));if(g)_(g,d+1);else for(let w of i.namedChildren)_(w,d+1);return}p(i,d,"else",["branch"],!1,!1),_(i,d+1)},m=(i,d,y=i.type.startsWith("unless")?"unless":"if")=>{let g=i.childForFieldName("condition")??le(i),w=i.childForFieldName("consequence")??i.childForFieldName("body")??i.namedChildren.find(T=>B.has(T.type)),A=i.childForFieldName("alternative")??i.namedChildren.find(T=>Y.has(T.type)),K=g?g.text:R(i,w);p(i,d,`${y} ${Ze(K)}`,M(g,["branch"])),w&&_(w,d+1),A&&b(A,d)},C=(i,d)=>{let y=i.childForFieldName("body")??i.namedChildren.find(g=>B.has(g.type));p(i,d,R(i,y),M(i,["loop"])),y&&_(y,d+1)},v=(i,d)=>{let y=i.childForFieldName("body")??i.namedChildren.find(g=>B.has(g.type));p(i,d,R(i,y),M(i,["branch"])),y&&_(y,d+1)},S=(i,d)=>{let y=i.namedChildren.find(g=>Q(g));p(i,d,R(i,y),["branch"],!1,!1);for(let g of i.namedChildren)(g===y||Q(g))&&_(g,d+1)},x=(i,d)=>{p(i,d,"try",[],!1);for(let y of i.namedChildren)B.has(y.type)?_(y,d+1):(X.has(y.type)||$.has(y.type))&&_(y,d)},f=(i,d,y)=>{let g=i.childForFieldName("body")??i.namedChildren.find(A=>B.has(A.type)),w=y==="finally"?"finally":R(i,g);p(i,d,w,[y],!1,!1),g&&_(g,d+1)},L=(i,d)=>{let y=U(i);p(i,d,R(i,y),M(i,["binding"])),y&&_(y,d+1)},_=(i,d)=>{if(i.startPosition.row>o||i.endPosition.row<t||Ye.has(i.type)||i.type==="empty_statement")return;if(B.has(i.type)){N(i,d);return}if(k.has(i.type)){m(i,d);return}if(ee.has(i.type)){C(i,d);return}if(z.has(i.type)){v(i,d);return}if(ve.has(i.type)){S(i,d);return}if(j.has(i.type)){x(i,d);return}if(X.has(i.type)){f(i,d,"catch");return}if($.has(i.type)){f(i,d,"finally");return}if(Y.has(i.type)){b(i,d);return}if(P.has(i.type)){L(i,d);return}let g=!Be(i)||et(i);p(i,d,i.text,M(i),g)};return _(h&&h!==a?h:a,0),l===0?null:{constructKind:Qe(a),signature:Je(a,h,n,t),lines:c,sourceStatements:l,copiedStatements:u}}function D(e,n,t){let o=e.namedChildren.filter(r=>r.startPosition.row<=n&&r.endPosition.row>=t);for(let r of o.sort(Xe)){let s=D(r,n,t);if(s)return s}return P.has(e.type)&&e.startPosition.row<=n&&e.endPosition.row>=t?e:null}function Xe(e,n){return e.endPosition.row-e.startPosition.row-(n.endPosition.row-n.startPosition.row)||e.startPosition.row-n.startPosition.row}function U(e){return e.childForFieldName("body")??e.childForFieldName("consequence")??e.namedChildren.find(n=>B.has(n.type))??null}function Je(e,n,t,o){let r=R(e,n);return r||(t[o]??e.text).trim()}function Qe(e){return e.type.includes("constructor")?"constructor":e.type.includes("method")||e.type==="method"?ne(e,new Set(["class_body","class_declaration","class_definition"]))?"class method":"object method":e.type==="arrow_function"||e.type==="function_expression"||e.type==="lambda"?ne(e,new Set(["object","pair"]))?"object member":"function value":e.type.includes("function")?ne(e,P)?"nested function":"module function":"source construct"}function ne(e,n){let t=e.parent;for(;t;){if(n.has(t.type))return!0;t=t.parent}return!1}function le(e){return e.namedChildren.find(n=>!B.has(n.type)&&!Y.has(n.type))??null}function R(e,n){if(!n)return q(e.text);let t=Math.max(0,n.startIndex-e.startIndex);return q(e.text.slice(0,t)).replace(/[:{]\s*$/u,"").trim()}function Ze(e){let n=q(e);return n.startsWith("(")&&n.endsWith(")")?n.slice(1,-1).trim():n}function q(e){return e.trim().replace(/\r?\n[\t ]*/gu," ")}function M(e,n=[]){let t=new Set(n);return e&&H(e,o=>{let r=Se[o.type];r&&t.add(r),o.type==="call_expression"&&(t.add("call"),Fe(o)&&t.add("shape")),ue.has(o.type)&&t.add("binding")}),Z.filter(o=>t.has(o))}function et(e){let n=!1;return H(e,t=>{n||!t.text.includes(`
2
- `)||/(?:string|template|heredoc|raw_string)/u.test(t.type)&&(n=!0)}),n}function Q(e){return B.has(e.type)||k.has(e.type)||ee.has(e.type)||z.has(e.type)||j.has(e.type)||P.has(e.type)||Be(e)}function Be(e){return/(?:statement|declaration|expression|assignment|return|throw|raise|break|continue|yield|with_item)$/u.test(e.type)||ue.has(e.type)}function tt(e,n,t){let o=0;for(let r=n;r<=t;r+=1)o+=(e[r]?.length??0)+10;return o}function nt(e){return e.constructKind.length+e.signature.length+80+e.lines.reduce((n,t)=>n+t.text.length+t.depth*2+10,0)}function Re(e,n,t,o,r,s){let a=O(e,n);if(!a)return null;let h=G(e,n),c=te(e,n,t,o),l=s?c?.startLine??t:t,u=s?c?.endLine??o:o,N=(c?.startLine===l&&c.endLine===u?D(a.rootNode,l,u):null)??I(a.rootNode,l,u);if(!N)return null;let b=new Map,m=new Map,C=new Map,v=(f,L)=>{if(f<l||f>u)return;let _=b.get(f)??new Set;_.add(L),b.set(f,_)};c&&v(c.startLine,"signature");for(let f of r)v(f,"anchor");H(N,f=>{let L=Se[f.type];if(L&&v(f.startPosition.row,L),L==="shape"&&rt(m,f,N,l,u),f.type==="call_expression"){let i=(f.childForFieldName("function")??f.namedChild(0))?.text.split(".").at(-1);if(Fe(f)){v(f.startPosition.row,"shape");let d=V(f.text);d.length<=re&&C.set(f.startPosition.row,d)}if(i&&Ie.has(i)){v(f.startPosition.row,"lifecycle");let d=V(f.text);d.length<=re&&C.set(f.startPosition.row,d)}}ue.has(f.type)&&v(f.startPosition.row,"binding")});let S=W(e,n);for(let f of S?.callSites??[])f.line<l||f.line>u||(v(f.line,"call"),f.calleeLeaf==="catch"&&v(f.line,"catch"));let x=[...b.entries()].sort(([f],[L])=>f-L).map(([f,L])=>({line:f,signals:ge.filter(_=>L.has(_)),text:C.get(f)??V(h[f]??"")})).filter(f=>f.text.length>0||f.signals.includes("anchor"));return{...c?{callable:c}:{},rangeStart:l,rangeEnd:u,sourceLines:h,candidates:x,shapes:[...m.values()].sort((f,L)=>f.startLine-L.startLine)}}function rt(e,n,t,o,r){if(n.startPosition.row<o||n.endPosition.row>r)return;let s=n.childForFieldName("key")??n.childForFieldName("name")??n.namedChild(0),a=V(s?.text??"");if(!a||a.includes(`
3
- `)||a.length>60)return;let h=ot(n,t);if(h.startPosition.row<o||h.endPosition.row>r)return;let c=`${h.startPosition.row}:${h.endPosition.row}`,l=e.get(c)??{startLine:h.startPosition.row,endLine:h.endPosition.row,fields:[]};l.fields.some(u=>u.name===a&&u.line===n.startPosition.row)||l.fields.push({name:a,line:n.startPosition.row}),e.set(c,l)}function ot(e,n){let t=e.parent;for(;t&&t!==n.parent;){if(_e.has(t.type))return t;if(t===n)break;t=t.parent}return e.parent??e}function te(e,n,t,o){return W(e,n)?.callables.filter(r=>r.startLine<=t&&r.endLine>=o).sort((r,s)=>r.endLine-r.startLine-(s.endLine-s.startLine)||r.startLine-s.startLine)[0]}function H(e,n){n(e);for(let t of e.namedChildren)H(t,n)}function Ee(e,n,t,o){o(e);for(let r of e.namedChildren)r.startPosition.row>n||r.endPosition.row<t||Ee(r,n,t,o)}function V(e){return e.trim().replace(/\s+/gu," ")}function Fe(e){if(e.type!=="call_expression")return!1;let n=e.childForFieldName("arguments")??e.namedChildren.find(o=>o.type==="arguments"||o.type==="argument_list");if(!n)return!1;let t=!1;return H(n,o=>{_e.has(o.type)&&(t=!0)}),t}function it(e){let n={};for(let t of ge){let o=e.filter(r=>r.signals.includes(t)).length;o>0&&(n[t]=o)}return n}function at(e,n){let t=new Map;for(let s of e){let a=s.signals.join(",");t.set(a,(t.get(a)??0)+1)}let o=new Set(Ce),r=s=>{let a=t.get(s.signals.join(","))??1,h=Math.min(...s.signals.map(u=>n[u]??1)),c=s.signals.some(u=>o.has(u))?3:1,l=Math.max(0,s.signals.length-1)*1e3;return c*(1e3/a+1e3/h)+l};return[...e].sort((s,a)=>r(a)-r(s)||a.line-s.line)}var ue=new Set(["lexical_declaration","variable_declarator","const_item","static_item","let_declaration","assignment"]);function st(e,n,t){let o=[],r=/\b(?:describe|it|test)(?:\.(?:only|skip|todo))?\s*\(\s*(['"`])([^'"`]+)\1/u;for(let s=n;s<=t;s+=1){let a=r.exec(e[s]??"")?.[2];if(!(!a||o.includes(a))&&(o.push(a),o.length>=Pe))break}return o}export{mt as a,pt as b,yt as c,Ne as d,bt as e,St as f};
4
- //# sourceMappingURL=chunk-MHIEP7EG.js.map
@@ -1,2 +0,0 @@
1
- import{f as B,g as S}from"./chunk-QLBSG7U5.js";import{b as O}from"./chunk-BOJ5SVE2.js";import{a as E}from"./chunk-BGBBVSH4.js";import{c as k}from"./chunk-BECZLYNU.js";import{b as L}from"./chunk-Q6T2CAJL.js";import{d as P}from"./chunk-MTDBHTSF.js";import{d as I,g as z,j as D,u as $}from"./chunk-TD7VKJ2Y.js";import{b as T,s as v,x as A}from"./chunk-42W3LFUK.js";import{H as _,t as p}from"./chunk-Q7GBK5T7.js";import{d as b}from"./chunk-GH5YSGZL.js";var U=new Set(P());function $e(e,t={}){let{includeHomonyms:n=!1,limit:i}=t,s=X(e,t).filter(r=>r.relationship==="divergent"||n&&r.relationship==="homonym");return i?s.slice(0,i):s}function X(e,t={}){let{scope:n,minSimilarity:i=.3,scanLimit:s}=t,r=Q(e,{scope:n,scanLimit:s});return Y(r,{minSimilarity:i,isDelegatePair:De(e)}).filter(a=>!a.members.some(o=>_(e,o.file,o.startLine,"twin")))}function Y(e,t={}){let n=t.minSimilarity??.3,i=t.isDelegatePair,s=e.filter(c=>!V(c.leaf)&&!fe(c.leaf)&&L(c.file)!=="test"&&!D(c.symbol)&&!Z(c.symbol)&&!j(c.symbol,c.leaf)),{recordsByLeaf:r,recordOrder:a}=p("twin-drift.group-by-leaf",()=>q(s),()=>({records:s.length})),o=p("twin-drift.cluster-leaf-names",()=>W([...r.keys()]),()=>({leaves:r.size}));return p("twin-drift.compare-clusters",()=>{let c=[];for(let h of o){let u=J(h,r,a);if(u.length<2||new Set(u.map(f=>f.file)).size<2)continue;let m=null,R=!1,C=!1,y=new Set;for(let f=0;f<u.length;f+=1)for(let w=f+1;w<u.length;w+=1){let d=u[f],g=u[w];if(d.file===g.file||!ge(d,g)||i?.(d,g,u)||i?.(g,d,u))continue;if(R=!0,y.add(d.symbol),y.add(g.symbol),d.normalizedBody===g.normalizedBody){C=!0;continue}let M=oe(d.tokens,g.tokens);(!m||M>m.similarity)&&(m={a:d,b:g,similarity:M})}if(!R)continue;let x=u.filter(f=>y.has(f.symbol)).sort((f,w)=>f.file.localeCompare(w.file)||f.startLine-w.startLine).map(se);if(!m){c.push({leaf:G(h),relationship:C?"identical":"homonym",maxDivergence:0,members:x});continue}let N=m.similarity>=n?"divergent":"homonym";c.push({leaf:G(h),relationship:N,maxDivergence:Math.round((1-m.similarity)*1e3)/1e3,members:x,...N==="divergent"?{firstDivergentTokens:ae(m.a.tokens,m.b.tokens)}:{}})}return c},()=>({clusters:o.length,records:s.length})).sort((c,h)=>h.members.length-c.members.length||h.maxDivergence-c.maxDivergence||c.leaf.localeCompare(h.leaf))}function q(e){let t=new Map,n=new Map;for(let[i,s]of e.entries()){let r=t.get(s.leaf)??[];r.push(s),t.set(s.leaf,r),n.set(s,i)}return{recordsByLeaf:t,recordOrder:n}}function J(e,t,n){let i=[...e].flatMap(s=>t.get(s)??[]);return e.size>1&&i.sort((s,r)=>(n.get(s)??0)-(n.get(r)??0)),i}function Q(e,t){let n=p("twin-drift.load-definitions",()=>$(e,{scope:t.scope}).filter(r=>ee(r)&&!e.isIgnored(r.relativePath)).filter(r=>!k(r.relativePath)));p("twin-drift.sort-definitions",()=>n.sort((r,a)=>r.relativePath.localeCompare(a.relativePath)||r.startLine-a.startLine),()=>({definitions:n.length}));let i=O(n,t.scanLimit),s=p("twin-drift.select-candidates",()=>te(i),()=>({scanned:i.length}));return p("twin-drift.build-records",()=>{let r=[];for(let a of s){let o=ne(e,a);o&&r.push(o)}return r},()=>({candidates:s.length,scanned:i.length}))}function ee(e){return e.isFunctionLike?e.symbol.startsWith("rust-analyzer ")?typeof e.kind=="number"&&U.has(e.kind):!0:!1}function te(e){let t=e.filter(r=>r.leaf&&!V(r.leaf)&&!D(r.symbol)&&!Z(r.symbol)&&!j(r.symbol,r.leaf)),n=new Map;for(let r of t){let a=n.get(r.leaf)??[];a.push(r),n.set(r.leaf,a)}let i=W([...n.keys()]),s=new Set;for(let r of i){let a=[...r].flatMap(o=>n.get(o)??[]);if(!(a.length<2)&&!(new Set(a.map(o=>o.relativePath)).size<2)&&!a.every(o=>L(o.relativePath)==="test"))for(let o of a)s.add(o)}return e.filter(r=>s.has(r))}function ne(e,t){if(!t.leaf)return null;let n=B(e,t);if(!n||!z(t.symbol)&&!re(n,t.leaf))return null;let i=T(S(n)),s=i.replace(/\s+/g,"");if(!s||s.length<8)return null;let r=i.match(ie)??[];return r.length===0?null:{leaf:t.leaf,symbol:t.symbol,shortName:I(t.symbol),file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:E(t),normalizedBody:s,tokens:r,isThinForwarder:H(i)}}function re(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`\\b(?:const|let|var)\\s+${n}(?:\\s*:[^=]+)?\\s*=\\s*(?:async\\s*)?(?:\\([^)]*\\)|[A-Za-z_$][\\w$]*)\\s*=>`,"s").test(e)}var ie=/[A-Za-z_$][A-Za-z0-9_$]*|\d+(?:\.\d+)?|[^\sA-Za-z0-9_$]/g;function se(e){return{symbol:e.symbol,shortName:e.shortName,file:e.file,startLine:e.startLine,endLine:e.endLine,loc:e.loc}}function oe(e,t){let n=new Set(e),i=new Set(t);if(n.size===0&&i.size===0)return 1;if(n.size===0||i.size===0)return 0;let s=0;for(let a of n)i.has(a)&&(s+=1);let r=n.size+i.size-s;return r===0?0:s/r}function ae(e,t){let n=Math.min(e.length,t.length),i=0;for(;i<n&&e[i]===t[i];)i+=1;let s=e.slice(i,i+6).join(" "),r=t.slice(i,i+6).join(" ");return!s&&!r?"(bodies differ only in trailing length)":`A: ${s||"(end)"} | B: ${r||"(end)"}`}function W(e){let t=new Map;for(let a of e)t.set(a,a);let n=a=>{let o=a;for(;t.get(o)!==o;)o=t.get(o);let l=a;for(;t.get(l)!==o;){let c=t.get(l);t.set(l,o),l=c}return o},i=(a,o)=>{let l=n(a),c=n(o);l!==c&&t.set(l,c)},s=new Map;for(let a of e){let o=a.slice(0,2).toLowerCase(),l=s.get(o)??[];l.push(a),s.set(o,l)}for(let a of s.values())for(let o=0;o<a.length;o+=1)for(let l=o+1;l<a.length;l+=1)le(a[o],a[l])&&i(a[o],a[l]);let r=new Map;for(let a of e){let o=n(a),l=r.get(o)??new Set;l.add(a),r.set(o,l)}return[...r.values()]}function le(e,t){return e===t||e.toLowerCase()===t.toLowerCase()?!0:e.length<8||t.length<8||Math.abs(e.length-t.length)>2||ce(e.toLowerCase(),t.toLowerCase())/Math.max(e.length,t.length)<.8?!1:pe(e.toLowerCase(),t.toLowerCase(),2)}function ce(e,t){let n=Math.min(e.length,t.length),i=0;for(;i<n&&e[i]===t[i];)i+=1;return i}function fe(e){return/^[A-Z][A-Z0-9_]*$/.test(e)||/^__[^_].*__$/.test(e)||ue.has(e.toLowerCase())}var ue=new Set(["main","row"]),me=new Set(["app","component","components","feature","features","impl","index","lib","route","routes","shared","src","tsx","typescript","ui"]);function Z(e){return e.startsWith("rust-analyzer ")&&/\/(?:tests?|benches?)\//.test(e)}var de=new Set(["default","new","reset"]);function j(e,t){return e.startsWith("rust-analyzer ")&&de.has(t.toLowerCase())}function ge(e,t){if(e.leaf.toLowerCase()!==t.leaf.toLowerCase()||e.leaf.length>4)return!0;let n=F(e);return[...F(t)].some(i=>n.has(i))}function F(e){let t=e.leaf.toLowerCase();return new Set(`${e.file}/${e.shortName}`.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>2&&n!==t&&!me.has(n)))}function pe(e,t,n){if(Math.abs(e.length-t.length)>n)return!1;let i=Array.from({length:t.length+1},(s,r)=>r);for(let s=1;s<=e.length;s+=1){let r=[s],a=r[0];for(let o=1;o<=t.length;o+=1){let l=e[s-1]===t[o-1]?0:1,c=Math.min(i[o]+1,r[o-1]+1,i[o-1]+l);r.push(c),a=Math.min(a,c)}if(a>n)return!1;i=r}return i[t.length]<=n}function ke(e){return H(T(S(e)))}function H(e){let t=e.trim();if(!t||he.test(t))return!1;let n=be(t);return n.length===0||n.length>2?!1:ye(n[n.length-1])}var he=/\b(?:if|else|for|while|switch|try|catch|do)\b/,we=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\[[^[\]]*\])*\((?:[^()]|\([^()]*\))*\)$/;function ye(e){let t=e.trim().replace(/^return\s+/,"").replace(/^await\s+/,"").replace(/;\s*$/,"").trim();return we.test(t)}function be(e){let t=[],n=0,i="";for(let s of e){if(s==="("||s==="["||s==="{"?n+=1:(s===")"||s==="]"||s==="}")&&(n=Math.max(0,n-1)),s===";"&&n===0){t.push(i),i="";continue}i+=s}return i.trim()&&t.push(i),t.map(s=>s.trim()).filter(s=>s.length>0)}var Te=3;function De(e){let t=new Map;return(n,i,s)=>{if(!n.isThinForwarder)return!1;let r=`${n.symbol}\0${i.symbol}`,a=t.get(r);if(a!==void 0)return a;let o=K(e,n,i,s,Te,new Set);return t.set(r,o),o}}function K(e,t,n,i,s,r){if(s<=0||r.has(t.symbol)||(r.add(t.symbol),(v(e,t.file)??[]).filter(l=>l.line>=t.startLine&&l.line<=t.endLine&&l.calleeLeaf===n.leaf).length===0))return!1;let o=new Set(A(e,t.file).filter(l=>l.sourcePath&&(l.kind!=="namespace"||l.usedMembers.includes(n.leaf))).map(l=>l.sourcePath));if([...o].some(l=>b(l,n.file)))return!0;for(let l of i)if(!(l.symbol===t.symbol||l.symbol===n.symbol||!l.isThinForwarder)&&[...o].some(c=>b(c,l.file))&&K(e,l,n,i,s-1,r))return!0;return!1}function V(e){return e.startsWith("<")&&e.endsWith(">")}function G(e){return[...e].sort()[0]}export{$e as a,X as b,Y as c,ke as d,be as e};
2
- //# sourceMappingURL=chunk-OJNK5ALA.js.map