scip-query 0.18.0 → 0.19.1

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 (300) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +1 -0
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/{chunk-2DBY4MO7.js → chunk-24ET4VLC.js} +2 -2
  5. package/dist/chunk-2NA6TYP4.js +120 -0
  6. package/dist/{chunk-XKWEMFHP.js → chunk-2WCXKANA.js} +2 -2
  7. package/dist/{chunk-LL5NQB5V.js → chunk-34MLC6UI.js} +2 -2
  8. package/dist/chunk-35NLDRZC.js +2 -0
  9. package/dist/{chunk-MNRKD3WP.js → chunk-3WLRW5TC.js} +2 -2
  10. package/dist/{chunk-SW7LKHRU.js → chunk-4BU54UJG.js} +2 -2
  11. package/dist/{chunk-T4P27T6S.js → chunk-4CZJ4YJB.js} +2 -2
  12. package/dist/{chunk-3CJXFMR5.js → chunk-4FMT4HPC.js} +2 -2
  13. package/dist/{chunk-J7IMQRCU.js → chunk-53SUJOJA.js} +2 -2
  14. package/dist/{chunk-27YDE22N.js → chunk-5GOBZI34.js} +2 -2
  15. package/dist/{chunk-4FLF7BHJ.js → chunk-5OZCNAVM.js} +2 -2
  16. package/dist/chunk-5TEUKVSM.js +2 -0
  17. package/dist/{chunk-GTANVH72.js → chunk-5W2VAEVR.js} +2 -2
  18. package/dist/{chunk-43QUXX3E.js → chunk-63P42UR6.js} +2 -2
  19. package/dist/{chunk-OQFPCIXO.js → chunk-64QITTX7.js} +2 -2
  20. package/dist/{chunk-P4L5QQT5.js → chunk-6O5JOS7T.js} +2 -2
  21. package/dist/chunk-6PKO2TNZ.js +2 -0
  22. package/dist/{chunk-OSBLECSI.js → chunk-7SGOWD2Y.js} +2 -2
  23. package/dist/chunk-7TJJY2C3.js +2 -0
  24. package/dist/{chunk-K3UVTL3J.js → chunk-AEM24WSF.js} +2 -2
  25. package/dist/{chunk-PV3GKBO5.js → chunk-AGTATREV.js} +2 -2
  26. package/dist/chunk-AOSFSYEA.js +20 -0
  27. package/dist/{chunk-VCRMI56V.js → chunk-APLNTJPJ.js} +2 -2
  28. package/dist/{chunk-7XP7ZRSI.js → chunk-AYRHVJXW.js} +2 -2
  29. package/dist/chunk-B2WQKQKP.js +3 -0
  30. package/dist/{chunk-SWJEREML.js → chunk-BBBKPOIT.js} +2 -2
  31. package/dist/{chunk-OTTHMUMV.js → chunk-BCMOTIB6.js} +2 -2
  32. package/dist/chunk-BMTBVMA3.js +10 -0
  33. package/dist/{chunk-J7WYG63U.js → chunk-C3KCSAQ4.js} +2 -2
  34. package/dist/{chunk-5CJ6AQN7.js → chunk-CAKPEQZB.js} +2 -2
  35. package/dist/{chunk-UWR52GNZ.js → chunk-CIYUFF24.js} +2 -2
  36. package/dist/{chunk-ABDXTPCT.js → chunk-CKFMZE77.js} +2 -2
  37. package/dist/chunk-DCDOGW32.js +2 -0
  38. package/dist/{chunk-ODH4FT3P.js → chunk-DFQNE73Y.js} +2 -2
  39. package/dist/chunk-DO775SYA.js +2 -0
  40. package/dist/chunk-DRH3AD7W.js +4 -0
  41. package/dist/chunk-DZXFZAZO.js +16 -0
  42. package/dist/chunk-E3KWOHH7.js +5 -0
  43. package/dist/chunk-EMIIOOTM.js +38 -0
  44. package/dist/chunk-ESNRT7QN.js +927 -0
  45. package/dist/{chunk-AWYKDRYV.js → chunk-FB6IKAKZ.js} +2 -2
  46. package/dist/{chunk-BGUYAA3Q.js → chunk-FBUNGRKI.js} +2 -2
  47. package/dist/{chunk-M2TRDR25.js → chunk-FC5K7T35.js} +1 -1
  48. package/dist/{chunk-GWCW25ON.js → chunk-FHLYJVXF.js} +2 -2
  49. package/dist/{chunk-IG6X65MG.js → chunk-FRXB74RQ.js} +2 -2
  50. package/dist/{chunk-IKMOYFUM.js → chunk-FTRNGQGR.js} +2 -2
  51. package/dist/{chunk-NX2YAXVQ.js → chunk-FUFNRZFJ.js} +2 -2
  52. package/dist/{chunk-JLZUM476.js → chunk-GAE7WCBK.js} +2 -2
  53. package/dist/chunk-GIHVWNKQ.js +18 -0
  54. package/dist/{chunk-MPBN5DO4.js → chunk-HCS5LB6U.js} +2 -2
  55. package/dist/{chunk-6JSTKSZH.js → chunk-HFBNIIZX.js} +2 -2
  56. package/dist/{chunk-JHK2DMUQ.js → chunk-HGFDYOVB.js} +1 -1
  57. package/dist/chunk-IOOCKVUA.js +6 -0
  58. package/dist/{chunk-4L4X66GE.js → chunk-J4MYRIYT.js} +2 -2
  59. package/dist/{chunk-TAB7AWKO.js → chunk-J5XJWCB3.js} +2 -2
  60. package/dist/{chunk-POGZSZPX.js → chunk-JBZXJXIS.js} +2 -2
  61. package/dist/chunk-JJZRS2OP.js +5 -0
  62. package/dist/chunk-KC2IFAAU.js +3 -0
  63. package/dist/{chunk-3M2UCPFS.js → chunk-KHE7J5ZN.js} +1 -1
  64. package/dist/{chunk-4XTPZ5CR.js → chunk-KMOMNTB4.js} +2 -2
  65. package/dist/chunk-KMUFGAIK.js +2 -0
  66. package/dist/chunk-LF5CIKWZ.js +26 -0
  67. package/dist/chunk-LM72NQ7T.js +3 -0
  68. package/dist/{chunk-QPF7CS5W.js → chunk-LQUDSHLB.js} +2 -2
  69. package/dist/chunk-MP43RX4O.js +67 -0
  70. package/dist/{chunk-D5OXYOJP.js → chunk-MQ2B33LQ.js} +1 -1
  71. package/dist/{chunk-WA64GKWB.js → chunk-NH7WNNQC.js} +3 -3
  72. package/dist/{chunk-HOZ3IXZ5.js → chunk-NTOBQK5H.js} +2 -2
  73. package/dist/{chunk-SUYCF4SX.js → chunk-OLG2YPLS.js} +2 -2
  74. package/dist/{chunk-O5Y3ISO3.js → chunk-OOUJBAKJ.js} +2 -2
  75. package/dist/{chunk-U244OVE6.js → chunk-OQ6TCHBB.js} +2 -2
  76. package/dist/{chunk-5GAUXLOE.js → chunk-PNESKY2Z.js} +2 -2
  77. package/dist/chunk-PYMZU5EG.js +2 -0
  78. package/dist/chunk-Q2WEWIKX.js +4 -0
  79. package/dist/chunk-QHKXGMOI.js +3 -0
  80. package/dist/{chunk-VXDMXZKC.js → chunk-RPEA7P5Z.js} +2 -2
  81. package/dist/{chunk-K65T4TJS.js → chunk-SJ6XSCG7.js} +2 -2
  82. package/dist/{chunk-LADYDOS5.js → chunk-SSXEYWN3.js} +2 -2
  83. package/dist/chunk-SYGAA54M.js +2 -0
  84. package/dist/{chunk-H4T2AST4.js → chunk-TYEGFDOP.js} +2 -2
  85. package/dist/chunk-UJKZQLDB.js +2 -0
  86. package/dist/{chunk-PZV2PGBR.js → chunk-US44MEVU.js} +2 -2
  87. package/dist/{chunk-EJ65IVPV.js → chunk-V5WBVF6K.js} +2 -2
  88. package/dist/{chunk-AV54WZUK.js → chunk-V7J4A3AH.js} +2 -2
  89. package/dist/{chunk-45QWQSWS.js → chunk-VIKEPD4D.js} +2 -2
  90. package/dist/{chunk-TLTLJ4SW.js → chunk-WAU7HVDI.js} +2 -2
  91. package/dist/chunk-WCZAABYF.js +2 -0
  92. package/dist/{chunk-FMD46HAG.js → chunk-WFRET75Z.js} +2 -2
  93. package/dist/chunk-WWCZCH7W.js +3 -0
  94. package/dist/chunk-XBN5VO53.js +2 -0
  95. package/dist/{chunk-35TZERMO.js → chunk-XCPE3G75.js} +2 -2
  96. package/dist/chunk-XYBNOILR.js +2 -0
  97. package/dist/{chunk-BAMVG4WQ.js → chunk-XZXUMGAA.js} +2 -2
  98. package/dist/{chunk-MN54AGZ3.js → chunk-YCSTKIYU.js} +2 -2
  99. package/dist/{chunk-CMLHZWRS.js → chunk-YGQBJUS6.js} +2 -2
  100. package/dist/{chunk-7ROLM67J.js → chunk-YILKXTIY.js} +2 -2
  101. package/dist/{chunk-YMFHC5J2.js → chunk-ZJGZCBYT.js} +2 -2
  102. package/dist/{chunk-D5F3IQYP.js → chunk-ZNK6K3LB.js} +2 -2
  103. package/dist/cli.js +2 -2
  104. package/dist/{command-descriptors-AQWWJNTT.js → command-descriptors-3EJHQLQZ.js} +173 -167
  105. package/dist/{config-types-70s7NxKB.d.ts → config-types-BA3xLCfG.d.ts} +28 -1
  106. package/dist/{db-BBmJ0v3b.d.ts → db-CzA-9_rL.d.ts} +6 -18
  107. package/dist/direct-navigation-C2A44KFT.js +3 -0
  108. package/dist/{health-CWpFL_6z.d.ts → health-DYy13GAe.d.ts} +3 -1
  109. package/dist/index.d.ts +23 -41
  110. package/dist/index.js +1 -1
  111. package/dist/postinstall.js +1 -1
  112. package/dist/queries/affected.d.ts +2 -2
  113. package/dist/queries/affected.js +1 -1
  114. package/dist/queries/architecture.d.ts +83 -0
  115. package/dist/queries/architecture.js +2 -0
  116. package/dist/queries/bottlenecks.d.ts +2 -2
  117. package/dist/queries/bottlenecks.js +1 -1
  118. package/dist/queries/by-kind.d.ts +2 -2
  119. package/dist/queries/by-kind.js +1 -1
  120. package/dist/queries/call-graph.d.ts +2 -2
  121. package/dist/queries/call-graph.js +1 -1
  122. package/dist/queries/change-surface.d.ts +2 -2
  123. package/dist/queries/change-surface.js +1 -1
  124. package/dist/queries/cleanup-plan.d.ts +2 -2
  125. package/dist/queries/cleanup-plan.js +1 -1
  126. package/dist/queries/co-change.d.ts +2 -2
  127. package/dist/queries/co-change.js +1 -1
  128. package/dist/queries/code.d.ts +2 -2
  129. package/dist/queries/code.js +1 -1
  130. package/dist/queries/complexity-hotspots.d.ts +2 -2
  131. package/dist/queries/complexity-hotspots.js +1 -1
  132. package/dist/queries/complexity.d.ts +2 -2
  133. package/dist/queries/complexity.js +1 -1
  134. package/dist/queries/convergence.d.ts +2 -2
  135. package/dist/queries/convergence.js +1 -1
  136. package/dist/queries/coupling.d.ts +2 -2
  137. package/dist/queries/coupling.js +1 -1
  138. package/dist/queries/cycles.d.ts +2 -2
  139. package/dist/queries/cycles.js +1 -1
  140. package/dist/queries/dataflow.d.ts +2 -2
  141. package/dist/queries/dataflow.js +1 -1
  142. package/dist/queries/dead.d.ts +2 -2
  143. package/dist/queries/dead.js +1 -1
  144. package/dist/queries/decorative-checkers.d.ts +2 -2
  145. package/dist/queries/decorative-checkers.js +1 -1
  146. package/dist/queries/deep-chains.d.ts +2 -2
  147. package/dist/queries/deep-chains.js +1 -1
  148. package/dist/queries/deps.d.ts +2 -2
  149. package/dist/queries/deps.js +1 -1
  150. package/dist/queries/diff-gate.d.ts +5 -3
  151. package/dist/queries/diff-gate.js +1 -1
  152. package/dist/queries/diff-impact.d.ts +2 -2
  153. package/dist/queries/diff-impact.js +1 -1
  154. package/dist/queries/doc-drift.d.ts +2 -2
  155. package/dist/queries/doc-drift.js +1 -1
  156. package/dist/queries/drift.d.ts +27 -10
  157. package/dist/queries/drift.js +1 -1
  158. package/dist/queries/duplicate-bodies.d.ts +2 -2
  159. package/dist/queries/duplicate-bodies.js +1 -1
  160. package/dist/queries/extract-candidates.d.ts +2 -2
  161. package/dist/queries/extract-candidates.js +1 -1
  162. package/dist/queries/fan.d.ts +2 -2
  163. package/dist/queries/fan.js +1 -1
  164. package/dist/queries/files.d.ts +2 -2
  165. package/dist/queries/health.d.ts +3 -3
  166. package/dist/queries/health.js +1 -1
  167. package/dist/queries/hierarchy.d.ts +2 -2
  168. package/dist/queries/hierarchy.js +1 -1
  169. package/dist/queries/hotspots.d.ts +2 -2
  170. package/dist/queries/hotspots.js +1 -1
  171. package/dist/queries/imports.d.ts +2 -2
  172. package/dist/queries/imports.js +1 -1
  173. package/dist/queries/incomplete-migration.d.ts +2 -2
  174. package/dist/queries/incomplete-migration.js +1 -1
  175. package/dist/queries/index.d.ts +5 -4
  176. package/dist/queries/index.js +1 -1
  177. package/dist/queries/isolated.d.ts +2 -2
  178. package/dist/queries/isolated.js +1 -1
  179. package/dist/queries/locality-candidates.d.ts +2 -2
  180. package/dist/queries/locality-candidates.js +1 -1
  181. package/dist/queries/members.d.ts +2 -2
  182. package/dist/queries/members.js +1 -1
  183. package/dist/queries/methods.d.ts +2 -2
  184. package/dist/queries/methods.js +1 -1
  185. package/dist/queries/not-implemented.d.ts +2 -2
  186. package/dist/queries/not-implemented.js +1 -1
  187. package/dist/queries/outline.d.ts +2 -2
  188. package/dist/queries/outline.js +1 -1
  189. package/dist/queries/passthrough-candidates.d.ts +2 -2
  190. package/dist/queries/passthrough-candidates.js +1 -1
  191. package/dist/queries/plan-context.d.ts +2 -2
  192. package/dist/queries/plan-context.js +1 -1
  193. package/dist/queries/react-component-duplicates.d.ts +2 -2
  194. package/dist/queries/react-component-duplicates.js +1 -1
  195. package/dist/queries/react-hook-candidates.d.ts +2 -2
  196. package/dist/queries/react-hook-candidates.js +1 -1
  197. package/dist/queries/react-large-component-pressure.d.ts +2 -2
  198. package/dist/queries/react-large-component-pressure.js +1 -1
  199. package/dist/queries/recent-duplicates.d.ts +2 -2
  200. package/dist/queries/recent-duplicates.js +1 -1
  201. package/dist/queries/redundant-reexports.d.ts +2 -2
  202. package/dist/queries/redundant-reexports.js +1 -1
  203. package/dist/queries/refs.d.ts +2 -2
  204. package/dist/queries/refs.js +1 -1
  205. package/dist/queries/self-audit.d.ts +2 -2
  206. package/dist/queries/self-audit.js +1 -1
  207. package/dist/queries/similar-chains.d.ts +2 -2
  208. package/dist/queries/similar-chains.js +1 -1
  209. package/dist/queries/similar-files.d.ts +2 -2
  210. package/dist/queries/similar-files.js +1 -1
  211. package/dist/queries/similar-signatures.d.ts +2 -2
  212. package/dist/queries/similar-signatures.js +1 -1
  213. package/dist/queries/similar.d.ts +2 -2
  214. package/dist/queries/similar.js +1 -1
  215. package/dist/queries/slice.d.ts +2 -2
  216. package/dist/queries/slice.js +1 -1
  217. package/dist/queries/stale-abstractions.d.ts +2 -2
  218. package/dist/queries/stale-abstractions.js +1 -1
  219. package/dist/queries/stats.d.ts +2 -2
  220. package/dist/queries/surface.d.ts +2 -2
  221. package/dist/queries/surface.js +1 -1
  222. package/dist/queries/symbols.d.ts +2 -2
  223. package/dist/queries/symbols.js +1 -1
  224. package/dist/queries/system.d.ts +2 -2
  225. package/dist/queries/system.js +1 -1
  226. package/dist/queries/test-quality.d.ts +2 -2
  227. package/dist/queries/test-quality.js +1 -1
  228. package/dist/queries/trace.d.ts +2 -2
  229. package/dist/queries/trace.js +1 -1
  230. package/dist/queries/twin-ab.d.ts +2 -2
  231. package/dist/queries/twin-ab.js +1 -1
  232. package/dist/queries/twin-drift.d.ts +2 -2
  233. package/dist/queries/twin-drift.js +1 -1
  234. package/dist/queries/unused-imports.d.ts +2 -2
  235. package/dist/queries/unused-imports.js +1 -1
  236. package/dist/queries/unused-params.d.ts +2 -2
  237. package/dist/queries/unused-params.js +1 -1
  238. package/dist/queries/vue-component-duplicates.d.ts +2 -2
  239. package/dist/queries/vue-component-duplicates.js +1 -1
  240. package/dist/queries/vue-composable-candidates.d.ts +2 -2
  241. package/dist/queries/vue-composable-candidates.js +1 -1
  242. package/dist/queries/vue-large-view-pressure.d.ts +2 -2
  243. package/dist/queries/vue-large-view-pressure.js +1 -1
  244. package/dist/queries/wrapper-candidates.d.ts +2 -2
  245. package/dist/queries/wrapper-candidates.js +1 -1
  246. package/dist/reindex-worker.js +24 -24
  247. package/dist/reindex.d.ts +12 -10
  248. package/dist/reindex.js +38 -38
  249. package/dist/runtime.d.ts +10 -9
  250. package/dist/runtime.js +2 -1
  251. package/dist/rust-semantic-session-server.js +1 -1
  252. package/dist/rust-semantic-session-worker.js +1 -1
  253. package/dist/rust-semantic-worker.js +1 -1
  254. package/dist/{scip-cli-CoMzb7Zu.d.ts → scip-cli-1bVKJgXi.d.ts} +1 -1
  255. package/dist/watch-server.js +7 -6
  256. package/docs/AI_FAILURE_MODES.md +1 -0
  257. package/docs/COMMAND_REFERENCE.md +3 -2
  258. package/docs/DETECTOR_GUIDE.md +5 -3
  259. package/docs/analyzer-inventory.md +16 -6
  260. package/docs/analyzer-validation-ledger.md +12 -1
  261. package/docs/architecture-coherence-vision.md +219 -0
  262. package/package.json +5 -1
  263. package/skills/_shared/SKILL.md +4 -3
  264. package/skills/scip-conductor/SKILL.md +1 -1
  265. package/skills/scip-directory-architecture/SKILL.md +116 -2
  266. package/skills/scip-maintainability/SKILL.md +3 -3
  267. package/skills/scip-query/SKILL.md +1 -1
  268. package/skills/scip-twin-drift/SKILL.md +1 -1
  269. package/skills/scip-verify/SKILL.md +1 -1
  270. package/dist/chunk-2GX3TNOW.js +0 -38
  271. package/dist/chunk-45XOH33S.js +0 -2
  272. package/dist/chunk-4MFMTEJ4.js +0 -5
  273. package/dist/chunk-BECOMXAL.js +0 -2
  274. package/dist/chunk-BJJHBKEC.js +0 -2
  275. package/dist/chunk-DDGO34I2.js +0 -26
  276. package/dist/chunk-DUKRAHV2.js +0 -2
  277. package/dist/chunk-EMEXMHOP.js +0 -7
  278. package/dist/chunk-GWNE2WJN.js +0 -3
  279. package/dist/chunk-H4JNB7RT.js +0 -3
  280. package/dist/chunk-L2RE5P3X.js +0 -2
  281. package/dist/chunk-L2TSLMPT.js +0 -5
  282. package/dist/chunk-NQBMGFFD.js +0 -2
  283. package/dist/chunk-O5A7BTMA.js +0 -3
  284. package/dist/chunk-OINSINYW.js +0 -2
  285. package/dist/chunk-OM6JHEW3.js +0 -16
  286. package/dist/chunk-OUXPJ4H5.js +0 -3
  287. package/dist/chunk-OWXNDSG3.js +0 -2
  288. package/dist/chunk-Q4UM4JJP.js +0 -2
  289. package/dist/chunk-QEIGJJBC.js +0 -20
  290. package/dist/chunk-R4VPIS4D.js +0 -10
  291. package/dist/chunk-RDX6WWHN.js +0 -4
  292. package/dist/chunk-RUQE7DZT.js +0 -2
  293. package/dist/chunk-S43DIBME.js +0 -18
  294. package/dist/chunk-SALRDXWM.js +0 -121
  295. package/dist/chunk-SMBIGBGN.js +0 -67
  296. package/dist/chunk-VQWDZ34M.js +0 -928
  297. package/dist/chunk-W3557RPL.js +0 -3
  298. package/dist/chunk-W3SKYOTF.js +0 -2
  299. package/dist/chunk-XEEQX5X3.js +0 -3
  300. package/dist/direct-navigation-K3CTVVBU.js +0 -3
@@ -1,4 +1,4 @@
1
- import{a as v}from"./chunk-WXVGNFAO.js";import{a as _}from"./chunk-L2RE5P3X.js";import{f as N}from"./chunk-2GX3TNOW.js";import{j as M}from"./chunk-PZV2PGBR.js";import{d as w,g as y,i as x}from"./chunk-7XP7ZRSI.js";import{E as R}from"./chunk-TLTLJ4SW.js";import{execFileSync as g}from"child_process";import{existsSync as U,readFileSync as j}from"fs";import{basename as A}from"path";var q="Unable to compute git diff.";function Ne(e,n={}){let i=n.plan??H(e,n);return i.note?Y(i.note,i.changedFileLines):i.changedFiles.length===0?V(i.changedFileLines):Z(i.changedFiles,[J(e,i.changedFiles,i.changedFiles,i.changedRanges)])}function H(e,n={}){let{base:i="HEAD"}=n;try{let t=K(e.config.projectRoot,i),r=t.changedFileLines,s=ie(e,r),a=re(e,t.changedRanges);return{changedFileLines:r,changedFiles:s,changedRanges:a,renamedFiles:ee(e.config.projectRoot,i,s,t),note:r.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],changedRanges:[],renamedFiles:[],note:q}}}function J(e,n,i,t=[]){let r=new _(e),s=new Set(i),a=v(t),o=[],c=new Map,u=n.flatMap(f=>r.definitionsForFile(f)).filter(be),d=u.filter(f=>oe(f,a)),l=le(e,u,d,a),m=fe([...d,...l.definitions]).sort((f,h)=>f.relativePath.localeCompare(h.relativePath)||f.startLine-h.startLine),p=m.map(f=>f.symbolId),F=pe(e,p),z=he(e,p,i),C=m.filter(f=>(F.get(f.symbolId)??0)===0),I=E(()=>M(e,C)),W=C.filter(f=>(I.get(f.symbolId)?.size??0)===0),G=E(()=>N(e,W));for(let f of m)ge(e,f,s,o,c,I.get(f.symbolId)??new Set,G.get(f.symbolId)??new Set,F.get(f.symbolId)??0,z.get(f.symbolId)??new Set);return{changedSymbols:o,consumerEntries:[...c.entries()].map(([f,h])=>({file:f,symbols:[...h].sort()})),attributionNotes:l.notes}}function Z(e,n){let i=new Map,t=n.flatMap(a=>a.changedSymbols),r=n.flatMap(a=>a.attributionNotes??[]);for(let a of n)for(let o of a.consumerEntries){let c=i.get(o.file);c||(c=new Set,i.set(o.file,c));for(let u of o.symbols)c.add(u)}let s=ye(i);return{changedFiles:[...e],changedSymbols:t,affectedConsumers:s,attributionNotes:r,summary:{totalChangedFiles:e.length,totalChangedSymbols:t.length,totalAffectedFiles:s.length}}}function Y(e,n=[]){return{changedFiles:n,changedSymbols:[],affectedConsumers:[],attributionNotes:[],summary:{totalChangedFiles:n.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function V(e){return{changedFiles:e,changedSymbols:[],affectedConsumers:[],attributionNotes:[],summary:{totalChangedFiles:e.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}}}function K(e,n){let i=g("git",["diff","--name-status","--find-renames",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:67108864}),t=g("git",["diff","--name-status","--find-renames","--cached",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),r=g("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),s=g("git",["diff","--unified=0",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),a=g("git",["diff","--unified=0","--cached",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),o=ne([i,t]);return{changedFileLines:[...new Set([...o.changedFiles,...T(r)])],changedRanges:O([...P(s),...P(a)]),renamedFiles:o.renamedFiles,deletedFiles:o.deletedFiles}}function L(e,n,i){try{return g("git",["show",`${n}:./${i}`],{encoding:"utf-8",cwd:e,timeout:1e4,stdio:["ignore","pipe","ignore"]})}catch{return null}}function _e(e,n,i=[]){let t=Q(e,n,i);return r=>(t.has(r)||t.set(r,L(e,n,r)),t.get(r)??null)}function ve(e,n=e.changedFiles){let i=new Map(e.renamedFiles.map(t=>[t.to,t.from]));return[...new Set(n.map(t=>i.get(t)??t))]}function Q(e,n,i){let t=[...new Set(i)],r=new Map;if(t.length===0)return r;try{let s=t.map(o=>`${n}:./${o}
1
+ import{a as v}from"./chunk-WXVGNFAO.js";import{a as _}from"./chunk-7TJJY2C3.js";import{f as M}from"./chunk-EMIIOOTM.js";import{j as N}from"./chunk-US44MEVU.js";import{d as w,g as y,i as x}from"./chunk-AYRHVJXW.js";import{E as R}from"./chunk-WAU7HVDI.js";import{execFileSync as g}from"child_process";import{existsSync as U,readFileSync as j}from"fs";import{basename as A}from"path";var q="Unable to compute git diff.";function Ne(e,n={}){let i=n.plan??H(e,n);return i.note?Y(i.note,i.changedFileLines):i.changedFiles.length===0?V(i.changedFileLines):Z(i.changedFiles,[J(e,i.changedFiles,i.changedFiles,i.changedRanges)])}function H(e,n={}){let{base:i="HEAD"}=n;try{let t=K(e.config.projectRoot,i),r=t.changedFileLines,s=ie(e,r),a=re(e,t.changedRanges);return{changedFileLines:r,changedFiles:s,changedRanges:a,renamedFiles:ee(e.config.projectRoot,i,s,t),note:r.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],changedRanges:[],renamedFiles:[],note:q}}}function J(e,n,i,t=[]){let r=new _(e),s=new Set(i),a=v(t),o=[],c=new Map,u=n.flatMap(f=>r.definitionsForFile(f)).filter(be),d=u.filter(f=>oe(f,a)),l=le(e,u,d,a),m=fe([...d,...l.definitions]).sort((f,h)=>f.relativePath.localeCompare(h.relativePath)||f.startLine-h.startLine),p=m.map(f=>f.symbolId),F=pe(e,p),z=he(e,p,i),C=m.filter(f=>(F.get(f.symbolId)??0)===0),I=E(()=>N(e,C)),W=C.filter(f=>(I.get(f.symbolId)?.size??0)===0),G=E(()=>M(e,W));for(let f of m)ge(e,f,s,o,c,I.get(f.symbolId)??new Set,G.get(f.symbolId)??new Set,F.get(f.symbolId)??0,z.get(f.symbolId)??new Set);return{changedSymbols:o,consumerEntries:[...c.entries()].map(([f,h])=>({file:f,symbols:[...h].sort()})),attributionNotes:l.notes}}function Z(e,n){let i=new Map,t=n.flatMap(a=>a.changedSymbols),r=n.flatMap(a=>a.attributionNotes??[]);for(let a of n)for(let o of a.consumerEntries){let c=i.get(o.file);c||(c=new Set,i.set(o.file,c));for(let u of o.symbols)c.add(u)}let s=ye(i);return{changedFiles:[...e],changedSymbols:t,affectedConsumers:s,attributionNotes:r,summary:{totalChangedFiles:e.length,totalChangedSymbols:t.length,totalAffectedFiles:s.length}}}function Y(e,n=[]){return{changedFiles:n,changedSymbols:[],affectedConsumers:[],attributionNotes:[],summary:{totalChangedFiles:n.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function V(e){return{changedFiles:e,changedSymbols:[],affectedConsumers:[],attributionNotes:[],summary:{totalChangedFiles:e.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}}}function K(e,n){let i=g("git",["diff","--name-status","--find-renames",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:67108864}),t=g("git",["diff","--name-status","--find-renames","--cached",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),r=g("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),s=g("git",["diff","--unified=0",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),a=g("git",["diff","--unified=0","--cached",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),o=ne([i,t]);return{changedFileLines:[...new Set([...o.changedFiles,...T(r)])],changedRanges:O([...P(s),...P(a)]),renamedFiles:o.renamedFiles,deletedFiles:o.deletedFiles}}function L(e,n,i){try{return g("git",["show",`${n}:./${i}`],{encoding:"utf-8",cwd:e,timeout:1e4,stdio:["ignore","pipe","ignore"]})}catch{return null}}function _e(e,n,i=[]){let t=Q(e,n,i);return r=>(t.has(r)||t.set(r,L(e,n,r)),t.get(r)??null)}function ve(e,n=e.changedFiles){let i=new Map(e.renamedFiles.map(t=>[t.to,t.from]));return[...new Set(n.map(t=>i.get(t)??t))]}function Q(e,n,i){let t=[...new Set(i)],r=new Map;if(t.length===0)return r;try{let s=t.map(o=>`${n}:./${o}
2
2
  `).join(""),a=g("git",["cat-file","--batch"],{cwd:e,input:s,maxBuffer:256*1024*1024,timeout:1e4,stdio:["pipe","pipe","ignore"]});return X(a,t)}catch{for(let s of t)r.set(s,L(e,n,s));return r}}function X(e,n){let i=new Map,t=0;for(let r of n){let s=e.indexOf(10,t);if(s<0)throw new Error("git cat-file batch output ended before object header");let a=e.subarray(t,s).toString("utf-8");if(t=s+1,a.endsWith(" missing")){i.set(r,null);continue}let o=/^[0-9a-f]+ ([^ ]+) (\d+)$/.exec(a);if(!o)throw new Error(`unexpected git cat-file batch header: ${a}`);let[,c,u]=o,d=Number(u);if(!Number.isFinite(d)||d<0)throw new Error(`unexpected git cat-file batch size: ${a}`);if(t+d>e.length)throw new Error("git cat-file batch output ended before blob payload");let l=e.subarray(t,t+d);i.set(r,c==="blob"?l.toString("utf-8"):null),t+=d,e[t]===10&&(t+=1)}return i}function ee(e,n,i,t){if(i.length===0)return[];let r=new Map,s=new Set;for(let o of t.renamedFiles)i.includes(o.to)&&(r.set(o.to,o),s.add(o.from));let a=t.deletedFiles;if(a.length===0)return[...r.values()].sort((o,c)=>o.to.localeCompare(c.to));for(let o of i){if(r.has(o)||!U(`${e}/${o}`))continue;let c=a.filter(l=>!s.has(l)).filter(l=>A(l)===A(o));if(c.length===0)continue;let u=j(`${e}/${o}`,"utf-8"),d=c.map(l=>({from:l,to:o,similarity:te(L(e,n,l)??"",u)})).sort((l,m)=>m.similarity-l.similarity)[0];d&&d.similarity>=.45&&(r.set(o,d),s.add(d.from))}return[...r.values()].sort((o,c)=>o.to.localeCompare(c.to))}function ne(e){let n=new Set,i=new Map,t=new Set;for(let r of e.flatMap(s=>T(s))){let[s,a,o]=r.split(" ");if(!(!s||!a)){if(s.startsWith("R")&&o){n.add(o),i.set(o,{from:a,to:o,similarity:Number(s.slice(1))/100});continue}n.add(a),s.startsWith("D")&&t.add(a)}}return{changedFiles:[...n],renamedFiles:[...i.values()],deletedFiles:[...t]}}function te(e,n){let i=new Set(B(e)),t=new Set(B(n));if(i.size===0&&t.size===0)return 1;if(i.size===0||t.size===0)return 0;let r=0;for(let s of i)t.has(s)&&(r+=1);return 2*r/(i.size+t.size)}function B(e){return e.match(/[A-Za-z_$][\w$]*|[{}()[\].,]/g)??[]}function T(e){return e.split(`
3
3
  `).map(n=>n.trim()).filter(n=>n.length>0)}function ie(e,n){let i=$(e),t=[];for(let r of n){let s=i(r);s&&!e.isIgnored(s)&&t.push(s)}return t}function re(e,n){let i=$(e),t=[];for(let r of n){let s=i(r.file);s&&!e.isIgnored(s)&&t.push({...r,file:s})}return O(t)}function $(e){let n=e.all(`SELECT relative_path FROM documents
4
4
  ORDER BY id`).map(t=>t.relative_path),i=new Map(n.map(t=>[t,t]));return t=>{let r=t.replace(/\\/g,"/"),s=i.get(r);return s||(n.find(a=>a.endsWith(r))??null)}}function P(e){let n=[],i=null;for(let t of e.split(`
@@ -15,4 +15,4 @@ import{a as v}from"./chunk-WXVGNFAO.js";import{a as _}from"./chunk-L2RE5P3X.js";
15
15
  AND m.role != 1
16
16
  AND ref_d.relative_path NOT IN (${i.map(()=>"?").join(",")})
17
17
  ${e.pathExclusionsFor("ref_d")}`,...n,...i),r=new Map;for(let s of t){let a=r.get(s.symbol_id);a||(a=new Set,r.set(s.symbol_id,a)),a.add(s.relative_path)}return r}function S(e,n,i,t,r){if(e.isIgnored(t)||n.has(t))return;let s=i.get(t);s||(s=new Set,i.set(t,s)),s.add(r)}function ye(e){return[...e.entries()].map(([n,i])=>({file:n,consumedSymbols:i.size})).sort((n,i)=>i.consumedSymbols-n.consumedSymbols)}function be(e){return!(x(e.symbol)||e.parentTypeName!==null&&!y(e.symbol))}function Se(e,n){return y(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&n>0}export{q as a,Ne as b,H as c,J as d,Z as e,L as f,_e as g,ve as h,Q as i,ae as j};
18
- //# sourceMappingURL=chunk-MNRKD3WP.js.map
18
+ //# sourceMappingURL=chunk-3WLRW5TC.js.map
@@ -1,2 +1,2 @@
1
- import{e as M}from"./chunk-O5A7BTMA.js";import{b as $}from"./chunk-B75HZHUP.js";import{a as p}from"./chunk-BGBBVSH4.js";import{n as D}from"./chunk-PZV2PGBR.js";import{d as I}from"./chunk-MTDBHTSF.js";import{d as b,j as h,p as x,q as y,t as L}from"./chunk-7XP7ZRSI.js";import{a as g,e as S}from"./chunk-JLZUM476.js";import{y as d}from"./chunk-M2TRDR25.js";var B=new Set(I());function X(e,n={}){let{scope:s,minLoc:i=1,limit:r,scanLimit:c,maxShapeFrequency:a=12}=n,o=n.semantic!==!1,t=w(e,F(e,{scope:s,minLoc:i,scanLimit:c}),{semantic:o,maxShapeFrequency:a}),m=P(t);return r?m.slice(0,r):m}function F(e,n){let s=L(e,{scope:n.scope}).filter(i=>v(i)&&!e.isIgnored(i.relativePath)).filter(i=>p(i)>=n.minLoc);return typeof n.scanLimit=="number"&&n.scanLimit>0&&s.sort((i,r)=>p(r)-p(i)||i.relativePath.localeCompare(r.relativePath)),$(s,n.scanLimit)}function v(e){return!e.isFunctionLike||h(e.symbol)?!1:e.kind===null||B.has(e.kind)}function w(e,n,s){let i=[];for(let a of n){let o=G(e,a,s);o&&i.push({signature:o,definition:a,fn:z(a)})}let r=new Map;for(let a of i)r.set(a.signature,(r.get(a.signature)??0)+1);let c=new Map;for(let a of i){let o=C(a.fn.loc),t=(r.get(a.signature)??0)>s.maxShapeFrequency,m=t?M(e,a.definition):null;if(t&&!m)continue;let u=t?`${a.signature}\0body\0${m}`:`${a.signature}\0band\0${o}`,l=c.get(u)??{signature:a.signature,locBand:o,exactBody:t,functions:[]};l.functions.push(a.fn),c.set(u,l)}return[...c.values()]}function z(e){return{symbol:e.symbol,shortName:b(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:p(e)}}function P(e){let n=[];for(let s of e)s.functions.length>=2&&n.push(s);return n.sort((s,i)=>{let r=i.functions.length-s.functions.length;if(r!==0)return r;let c=s.functions.reduce((o,t)=>o+t.loc,0);return i.functions.reduce((o,t)=>o+t.loc,0)-c}),n}function C(e){return e<=5?"<=5":e<=20?"6-20":">20"}function G(e,n,s){if(s.semantic){let c=D(e,n);if(c)return c}let i=k(n.documentation),r=i?A(i):null;return r||E(N(e,n.relativePath,n.startLine,n.endLine,n.leaf),n.leaf)}function k(e){return x(y(e))}function N(e,n,s,i,r){let c=d(e,n);if(!c)return null;let a=c.split(/\r?\n/),o=O(a,s,i,r);for(let t of o){let m=Math.min(a.length-1,Math.max(t,t+4)),u="";for(let l=t;l<=m;l+=1){let f=a[l]?.trim();if(f&&(u=u?`${u} ${f}`:f,q(u)))return u}if(u&&u.includes("("))return u}return null}function q(e){let n=e.replace(/\s+/g," ").trim();return!n.includes("(")||S(n)>0?!1:/[;{]$/.test(n)||/\)\s*(?::\s*[^={]+)?\s*(?:=>|=|throws\b|where\b|$)/i.test(n)||/\)\s*As\s+.+$/i.test(n)}function A(e){if(!e||!e.trim())return null;let n=e.replace(/^```\w*\s*/,"").replace(/\s*```$/,"").replace(/^\(method\)\s*/,"").replace(/^\(property\)\s*/,"").replace(/^\(function\)\s*/,"").replace(/^\(class\)\s*/,"").replace(/^\(interface\)\s*/,"").replace(/^\(enum\)\s*/,"").replace(/^\(type alias\)\s*/,"").replace(/^\(const\)\s*/,"").replace(/^\(var\)\s*/,"").trim(),s=n.indexOf("(");return s===-1||(n=n.slice(s),n=n.replace(/\s+/g,"").toLowerCase(),n.length<3)?null:n}function E(e,n){if(!e||!e.trim())return null;let s=e.replace(/\s+/g," ").trim(),i=s.indexOf("(");if(i===-1)return null;let r=s.slice(0,i),a=new RegExp(`\\b${g(n)}\\b`,"i").exec(r);a&&typeof a.index=="number"&&(r=r.slice(0,a.index)),r=r.replace(/\b(public|private|protected|internal|final|static|abstract|sealed|virtual|override|async|suspend|inline|constexpr|consteval|constinit|const|pub|fn|function|def|sub|friend|shared|readonly|new|open|partial|export)\b/gi," ").replace(/\s+/g," ").trim();let o=R(s.slice(i)).replace(/\)\s*=\s*[\s\S]*$/,")").replace(/\s+throws\s+[^={]+$/i,"").replace(/\s+where\s+.+$/i,"").replace(/\s+/g," ").trim();if(!o.startsWith("("))return null;let t=`${r?`${r} `:""}${o}`.replace(/\s+/g,"").toLowerCase();return t.length>=3?t:null}function R(e){let n=0,s=0,i=0,r=0,c=null,a=!1;for(let o=0;o<e.length;o+=1){let t=e[o];if(c){if(a){a=!1;continue}if(t==="\\"){a=!0;continue}t===c&&(c=null);continue}if(t==='"'||t==="'"||t==="`"){c=t;continue}if(t==="(")n+=1;else if(t===")")n=Math.max(0,n-1);else if(t==="[")i+=1;else if(t==="]")i=Math.max(0,i-1);else if(t==="<")r+=1;else if(t===">")r=Math.max(0,r-1);else if(t==="{"){if(n===0&&i===0&&r===0)return e.slice(0,o);s+=1}else if(t==="}")s=Math.max(0,s-1);else if(t==="="&&e[o+1]===">"&&n===0&&s===0&&i===0&&r===0)return e.slice(0,o)}return e}function O(e,n,s,i){let r=g(i),c=new RegExp(`\\b${r}\\b\\s*\\(`,"i"),a=new RegExp(`\\bdef\\s+${r}\\b`,"i"),o=[],t=new Set,m=Math.max(0,Math.min(n,e.length-1)),u=Math.max(m,Math.min(e.length-1,Math.max(s,n+4)));for(let l=m;l<=u;l+=1){let f=e[l]??"";(c.test(f)||a.test(f))&&!t.has(l)&&(t.add(l),o.push(l))}for(let l=0;l<e.length;l+=1){let f=e[l]??"";(c.test(f)||a.test(f))&&!t.has(l)&&(t.add(l),o.push(l))}return o}export{X as a};
2
- //# sourceMappingURL=chunk-SW7LKHRU.js.map
1
+ import{e as M}from"./chunk-WWCZCH7W.js";import{b as $}from"./chunk-B75HZHUP.js";import{a as p}from"./chunk-BGBBVSH4.js";import{n as I}from"./chunk-US44MEVU.js";import{d as D}from"./chunk-MTDBHTSF.js";import{d as b,j as h,p as x,q as y,t as L}from"./chunk-AYRHVJXW.js";import{a as g,e as S}from"./chunk-GAE7WCBK.js";import{y as d}from"./chunk-FC5K7T35.js";var B=new Set(D());function X(e,n={}){let{scope:s,minLoc:i=1,limit:r,scanLimit:c,maxShapeFrequency:a=12}=n,o=n.semantic!==!1,t=w(e,F(e,{scope:s,minLoc:i,scanLimit:c}),{semantic:o,maxShapeFrequency:a}),m=P(t);return r?m.slice(0,r):m}function F(e,n){let s=L(e,{scope:n.scope}).filter(i=>v(i)&&!e.isIgnored(i.relativePath)).filter(i=>p(i)>=n.minLoc);return typeof n.scanLimit=="number"&&n.scanLimit>0&&s.sort((i,r)=>p(r)-p(i)||i.relativePath.localeCompare(r.relativePath)),$(s,n.scanLimit)}function v(e){return!e.isFunctionLike||h(e.symbol)?!1:e.kind===null||B.has(e.kind)}function w(e,n,s){let i=[];for(let a of n){let o=G(e,a,s);o&&i.push({signature:o,definition:a,fn:z(a)})}let r=new Map;for(let a of i)r.set(a.signature,(r.get(a.signature)??0)+1);let c=new Map;for(let a of i){let o=C(a.fn.loc),t=(r.get(a.signature)??0)>s.maxShapeFrequency,m=t?M(e,a.definition):null;if(t&&!m)continue;let u=t?`${a.signature}\0body\0${m}`:`${a.signature}\0band\0${o}`,l=c.get(u)??{signature:a.signature,locBand:o,exactBody:t,functions:[]};l.functions.push(a.fn),c.set(u,l)}return[...c.values()]}function z(e){return{symbol:e.symbol,shortName:b(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:p(e)}}function P(e){let n=[];for(let s of e)s.functions.length>=2&&n.push(s);return n.sort((s,i)=>{let r=i.functions.length-s.functions.length;if(r!==0)return r;let c=s.functions.reduce((o,t)=>o+t.loc,0);return i.functions.reduce((o,t)=>o+t.loc,0)-c}),n}function C(e){return e<=5?"<=5":e<=20?"6-20":">20"}function G(e,n,s){if(s.semantic){let c=I(e,n);if(c)return c}let i=k(n.documentation),r=i?A(i):null;return r||E(N(e,n.relativePath,n.startLine,n.endLine,n.leaf),n.leaf)}function k(e){return x(y(e))}function N(e,n,s,i,r){let c=d(e,n);if(!c)return null;let a=c.split(/\r?\n/),o=O(a,s,i,r);for(let t of o){let m=Math.min(a.length-1,Math.max(t,t+4)),u="";for(let l=t;l<=m;l+=1){let f=a[l]?.trim();if(f&&(u=u?`${u} ${f}`:f,q(u)))return u}if(u&&u.includes("("))return u}return null}function q(e){let n=e.replace(/\s+/g," ").trim();return!n.includes("(")||S(n)>0?!1:/[;{]$/.test(n)||/\)\s*(?::\s*[^={]+)?\s*(?:=>|=|throws\b|where\b|$)/i.test(n)||/\)\s*As\s+.+$/i.test(n)}function A(e){if(!e||!e.trim())return null;let n=e.replace(/^```\w*\s*/,"").replace(/\s*```$/,"").replace(/^\(method\)\s*/,"").replace(/^\(property\)\s*/,"").replace(/^\(function\)\s*/,"").replace(/^\(class\)\s*/,"").replace(/^\(interface\)\s*/,"").replace(/^\(enum\)\s*/,"").replace(/^\(type alias\)\s*/,"").replace(/^\(const\)\s*/,"").replace(/^\(var\)\s*/,"").trim(),s=n.indexOf("(");return s===-1||(n=n.slice(s),n=n.replace(/\s+/g,"").toLowerCase(),n.length<3)?null:n}function E(e,n){if(!e||!e.trim())return null;let s=e.replace(/\s+/g," ").trim(),i=s.indexOf("(");if(i===-1)return null;let r=s.slice(0,i),a=new RegExp(`\\b${g(n)}\\b`,"i").exec(r);a&&typeof a.index=="number"&&(r=r.slice(0,a.index)),r=r.replace(/\b(public|private|protected|internal|final|static|abstract|sealed|virtual|override|async|suspend|inline|constexpr|consteval|constinit|const|pub|fn|function|def|sub|friend|shared|readonly|new|open|partial|export)\b/gi," ").replace(/\s+/g," ").trim();let o=R(s.slice(i)).replace(/\)\s*=\s*[\s\S]*$/,")").replace(/\s+throws\s+[^={]+$/i,"").replace(/\s+where\s+.+$/i,"").replace(/\s+/g," ").trim();if(!o.startsWith("("))return null;let t=`${r?`${r} `:""}${o}`.replace(/\s+/g,"").toLowerCase();return t.length>=3?t:null}function R(e){let n=0,s=0,i=0,r=0,c=null,a=!1;for(let o=0;o<e.length;o+=1){let t=e[o];if(c){if(a){a=!1;continue}if(t==="\\"){a=!0;continue}t===c&&(c=null);continue}if(t==='"'||t==="'"||t==="`"){c=t;continue}if(t==="(")n+=1;else if(t===")")n=Math.max(0,n-1);else if(t==="[")i+=1;else if(t==="]")i=Math.max(0,i-1);else if(t==="<")r+=1;else if(t===">")r=Math.max(0,r-1);else if(t==="{"){if(n===0&&i===0&&r===0)return e.slice(0,o);s+=1}else if(t==="}")s=Math.max(0,s-1);else if(t==="="&&e[o+1]===">"&&n===0&&s===0&&i===0&&r===0)return e.slice(0,o)}return e}function O(e,n,s,i){let r=g(i),c=new RegExp(`\\b${r}\\b\\s*\\(`,"i"),a=new RegExp(`\\bdef\\s+${r}\\b`,"i"),o=[],t=new Set,m=Math.max(0,Math.min(n,e.length-1)),u=Math.max(m,Math.min(e.length-1,Math.max(s,n+4)));for(let l=m;l<=u;l+=1){let f=e[l]??"";(c.test(f)||a.test(f))&&!t.has(l)&&(t.add(l),o.push(l))}for(let l=0;l<e.length;l+=1){let f=e[l]??"";(c.test(f)||a.test(f))&&!t.has(l)&&(t.add(l),o.push(l))}return o}export{X as a};
2
+ //# sourceMappingURL=chunk-4BU54UJG.js.map
@@ -1,2 +1,2 @@
1
- import{b}from"./chunk-K65T4TJS.js";import{m as d,x as f}from"./chunk-7XP7ZRSI.js";function S(a,g){let p=b(a,g),i=f(a,p,{sort:!0});if(i.length===0)return[];let o=i.map(e=>({symbol:e.symbol,shortName:e.shortName,startLine:e.startLine,endLine:e.endLine,signature:e.signature,children:[]})),s=new Map;for(let e of o)s.set(e.symbol,e);let c=[];for(let e=0;e<i.length;e++){let r=i[e],n=o[e];if(r.enclosingSymbol&&s.has(r.enclosingSymbol)){s.get(r.enclosingSymbol).children.push(n);continue}let l=null,m=1/0;for(let t of o)if(t!==n&&t.startLine<=n.startLine&&t.endLine>=n.endLine){if(t.startLine===n.startLine&&t.endLine===n.endLine&&!d(t.symbol,n.symbol))continue;let u=t.endLine-t.startLine;u<m&&(m=u,l=t)}l?l.children.push(n):c.push(n)}return c}export{S as a};
2
- //# sourceMappingURL=chunk-T4P27T6S.js.map
1
+ import{b}from"./chunk-SJ6XSCG7.js";import{m as d,x as f}from"./chunk-AYRHVJXW.js";function S(a,g){let p=b(a,g),i=f(a,p,{sort:!0});if(i.length===0)return[];let o=i.map(e=>({symbol:e.symbol,shortName:e.shortName,startLine:e.startLine,endLine:e.endLine,signature:e.signature,children:[]})),s=new Map;for(let e of o)s.set(e.symbol,e);let c=[];for(let e=0;e<i.length;e++){let r=i[e],n=o[e];if(r.enclosingSymbol&&s.has(r.enclosingSymbol)){s.get(r.enclosingSymbol).children.push(n);continue}let l=null,m=1/0;for(let t of o)if(t!==n&&t.startLine<=n.startLine&&t.endLine>=n.endLine){if(t.startLine===n.startLine&&t.endLine===n.endLine&&!d(t.symbol,n.symbol))continue;let u=t.endLine-t.startLine;u<m&&(m=u,l=t)}l?l.children.push(n):c.push(n)}return c}export{S as a};
2
+ //# sourceMappingURL=chunk-4CZJ4YJB.js.map
@@ -1,2 +1,2 @@
1
- import{a as R,b as H}from"./chunk-XKWEMFHP.js";import{a as B,b,c as y,e as h,f as k}from"./chunk-B3X6KU75.js";import{a as p,b as g}from"./chunk-KMVGRIO2.js";import{N as v}from"./chunk-TLTLJ4SW.js";function V(e,s={}){let{minSimilarity:m=.45,minSharedBehaviors:i=6,limit:o=20,scope:c,scanLimit:n,filePattern:d,focusFiles:f}=s,l=v(e).reactProfiles({scope:c,minBehaviorTokens:Math.max(3,i),scanLimit:n}).map(r=>({file:r.file,component:r.name,tokens:r.behaviorTokens,profile:r})),t=R(l,r=>r.tokens);return H({profiles:l,limit:o,filePattern:d,focusFiles:f,candidateIndex:t,profile:{name:"react-hook-candidates"},compare:(r,a)=>C(r,a,m,i),sort:(r,a)=>a.similarity-r.similarity||r.fileA.localeCompare(a.fileA)||r.componentA.localeCompare(a.componentA)||r.fileB.localeCompare(a.fileB)||r.componentB.localeCompare(a.componentB)})}function C(e,s,m,i){let o=p(e.tokens,s.tokens);if(o.size<i||!E(o))return null;let c=b(e.tokens,s.tokens);if(c<m)return null;let n=h(o,"hook:"),d=h(o,"react-hook:"),f=h(o,"effect:"),l=h(o,"state:"),t=h(o,"request:"),r=h(o,"handler:"),a=h(o,"handler-verb:"),u=A({sharedHooks:n,sharedReactHooks:d,sharedEffects:f,sharedState:l,sharedRequests:t,sharedHandlers:r,sharedHandlerVerbs:a});return{fileA:e.file,componentA:e.component,fileB:s.file,componentB:s.component,similarity:c,tokenCountA:e.tokens.size,tokenCountB:s.tokens.size,sharedTokens:k(o),sharedHooks:n,sharedReactHooks:d,sharedEffects:f,sharedState:l,sharedRequests:t,sharedHandlers:r,sharedHandlerVerbs:a,evidenceClass:u.evidenceClass,actionTier:u.actionTier,evidenceClassReasons:u.reasons,recommendation:u.recommendation,uniqueToA:k(g(e.tokens,s.tokens)).slice(0,25),uniqueToB:k(g(s.tokens,e.tokens)).slice(0,25),reason:P({sharedHooks:n,sharedReactHooks:d,sharedEffects:f,sharedState:l,sharedRequests:t,sharedHandlers:r,sharedHandlerVerbs:a}),locA:e.profile.loc,locB:s.profile.loc}}function A(e){return B({genericWords:q,stripPrefixes:w,primitiveGroups:[{values:e.sharedReactHooks,reasonPrefix:"shared React primitives",bucket:"generic"},{values:e.sharedEffects,reasonPrefix:"shared lifecycle primitive",bucket:"generic"}],nameGroups:[{names:e.sharedHooks,label:"shared hook",fallbackBucket:"shared-abstraction"},{names:e.sharedRequests,label:"shared request",fallbackBucket:"generic"},{names:e.sharedState,label:"shared state",fallbackBucket:"generic"},{names:e.sharedHandlers,label:"shared handler",fallbackBucket:"generic"},{names:e.sharedHandlerVerbs,label:"shared action verb",fallbackBucket:"generic"}],recommendation:S})}function S(e){switch(e){case"domain-behavior":return"Review for a shared hook, controller, or feature module around the named domain behavior.";case"mixed":return"Separate generic React mechanics from domain-specific behavior before extracting a shared hook.";case"shared-abstraction":return"Review the existing shared hook usage first; extract only if duplicated behavior remains outside it.";case"generic-workflow-scaffolding":return"Treat as support evidence for a repeated workflow shape, not direct hook-extraction evidence."}}function E(e){let s=0,m=0,i=0,o=0,c=0,n=0,d=0;for(let t of e)t.startsWith("hook:")?s+=1:t.startsWith("react-hook:")?m+=1:t.startsWith("effect:")?i+=1:t.startsWith("request:")?o+=1:t.startsWith("handler:")||t.startsWith("handler-verb:")?c+=1:t.startsWith("state:")?n+=1:t.startsWith("state-hook:")&&(d+=1);let f=n+d,l=s+m+i+o+c+f;return y([{name:"requests",count:o},{name:"customHooks",count:s},{name:"namedStates",count:n},{name:"handlers",count:c},{name:"effects",count:i},{name:"reactHooks",count:m},{name:"namedBehavior",count:l}],[{min:{requests:1,namedBehavior:4},reason:"shared request workflow"},{min:{customHooks:1,requests:1,namedBehavior:5},reason:"shared custom hook and request workflow"},{min:{customHooks:1,namedStates:1,namedBehavior:5},reason:"shared custom hook and state"},{min:{customHooks:1,handlers:2,namedBehavior:5},reason:"shared custom hook and handlers"},{min:{namedStates:1,handlers:2,effects:1,namedBehavior:5},reason:"shared stateful effects"},{min:{namedStates:1,handlers:2,reactHooks:2,namedBehavior:5},reason:"shared stateful React primitives"}]).pass}function P(e){let s=[];return e.sharedHooks.length&&s.push(`shared hooks: ${e.sharedHooks.join(", ")}`),e.sharedReactHooks.length&&s.push(`shared React hooks: ${e.sharedReactHooks.join(", ")}`),e.sharedEffects.length&&s.push(`shared effects: ${e.sharedEffects.join(", ")}`),e.sharedState.length&&s.push(`shared state: ${e.sharedState.join(", ")}`),e.sharedRequests.length&&s.push(`shared requests: ${e.sharedRequests.join(", ")}`),e.sharedHandlers.length&&s.push(`shared handlers: ${e.sharedHandlers.slice(0,6).join(", ")}`),e.sharedHandlerVerbs.length&&s.push(`shared action verbs: ${e.sharedHandlerVerbs.slice(0,6).join(", ")}`),s.join("; ")||"shared React behavior profile"}var q=new Set(["add","apply","async","callback","cancel","change","clear","close","create","data","delete","draft","edit","effect","error","fetch","filter","form","handle","has","is","item","items","load","loader","loading","memo","name","open","reducer","refresh","ref","remove","request","reset","resource","row","rows","save","saving","search","select","selected","state","store","submit","toggle","update","use","value"]),w=[/^use(?=[A-Z])/,/^handle(?=[A-Z])/,/^is(?=[A-Z])/,/^has(?=[A-Z])/];export{V as a};
2
- //# sourceMappingURL=chunk-3CJXFMR5.js.map
1
+ import{a as R,b as H}from"./chunk-2WCXKANA.js";import{a as B,b,c as y,e as h,f as k}from"./chunk-B3X6KU75.js";import{a as p,b as g}from"./chunk-KMVGRIO2.js";import{N as v}from"./chunk-WAU7HVDI.js";function V(e,s={}){let{minSimilarity:m=.45,minSharedBehaviors:i=6,limit:o=20,scope:c,scanLimit:n,filePattern:d,focusFiles:f}=s,l=v(e).reactProfiles({scope:c,minBehaviorTokens:Math.max(3,i),scanLimit:n}).map(r=>({file:r.file,component:r.name,tokens:r.behaviorTokens,profile:r})),t=R(l,r=>r.tokens);return H({profiles:l,limit:o,filePattern:d,focusFiles:f,candidateIndex:t,profile:{name:"react-hook-candidates"},compare:(r,a)=>C(r,a,m,i),sort:(r,a)=>a.similarity-r.similarity||r.fileA.localeCompare(a.fileA)||r.componentA.localeCompare(a.componentA)||r.fileB.localeCompare(a.fileB)||r.componentB.localeCompare(a.componentB)})}function C(e,s,m,i){let o=p(e.tokens,s.tokens);if(o.size<i||!E(o))return null;let c=b(e.tokens,s.tokens);if(c<m)return null;let n=h(o,"hook:"),d=h(o,"react-hook:"),f=h(o,"effect:"),l=h(o,"state:"),t=h(o,"request:"),r=h(o,"handler:"),a=h(o,"handler-verb:"),u=A({sharedHooks:n,sharedReactHooks:d,sharedEffects:f,sharedState:l,sharedRequests:t,sharedHandlers:r,sharedHandlerVerbs:a});return{fileA:e.file,componentA:e.component,fileB:s.file,componentB:s.component,similarity:c,tokenCountA:e.tokens.size,tokenCountB:s.tokens.size,sharedTokens:k(o),sharedHooks:n,sharedReactHooks:d,sharedEffects:f,sharedState:l,sharedRequests:t,sharedHandlers:r,sharedHandlerVerbs:a,evidenceClass:u.evidenceClass,actionTier:u.actionTier,evidenceClassReasons:u.reasons,recommendation:u.recommendation,uniqueToA:k(g(e.tokens,s.tokens)).slice(0,25),uniqueToB:k(g(s.tokens,e.tokens)).slice(0,25),reason:P({sharedHooks:n,sharedReactHooks:d,sharedEffects:f,sharedState:l,sharedRequests:t,sharedHandlers:r,sharedHandlerVerbs:a}),locA:e.profile.loc,locB:s.profile.loc}}function A(e){return B({genericWords:q,stripPrefixes:w,primitiveGroups:[{values:e.sharedReactHooks,reasonPrefix:"shared React primitives",bucket:"generic"},{values:e.sharedEffects,reasonPrefix:"shared lifecycle primitive",bucket:"generic"}],nameGroups:[{names:e.sharedHooks,label:"shared hook",fallbackBucket:"shared-abstraction"},{names:e.sharedRequests,label:"shared request",fallbackBucket:"generic"},{names:e.sharedState,label:"shared state",fallbackBucket:"generic"},{names:e.sharedHandlers,label:"shared handler",fallbackBucket:"generic"},{names:e.sharedHandlerVerbs,label:"shared action verb",fallbackBucket:"generic"}],recommendation:S})}function S(e){switch(e){case"domain-behavior":return"Review for a shared hook, controller, or feature module around the named domain behavior.";case"mixed":return"Separate generic React mechanics from domain-specific behavior before extracting a shared hook.";case"shared-abstraction":return"Review the existing shared hook usage first; extract only if duplicated behavior remains outside it.";case"generic-workflow-scaffolding":return"Treat as support evidence for a repeated workflow shape, not direct hook-extraction evidence."}}function E(e){let s=0,m=0,i=0,o=0,c=0,n=0,d=0;for(let t of e)t.startsWith("hook:")?s+=1:t.startsWith("react-hook:")?m+=1:t.startsWith("effect:")?i+=1:t.startsWith("request:")?o+=1:t.startsWith("handler:")||t.startsWith("handler-verb:")?c+=1:t.startsWith("state:")?n+=1:t.startsWith("state-hook:")&&(d+=1);let f=n+d,l=s+m+i+o+c+f;return y([{name:"requests",count:o},{name:"customHooks",count:s},{name:"namedStates",count:n},{name:"handlers",count:c},{name:"effects",count:i},{name:"reactHooks",count:m},{name:"namedBehavior",count:l}],[{min:{requests:1,namedBehavior:4},reason:"shared request workflow"},{min:{customHooks:1,requests:1,namedBehavior:5},reason:"shared custom hook and request workflow"},{min:{customHooks:1,namedStates:1,namedBehavior:5},reason:"shared custom hook and state"},{min:{customHooks:1,handlers:2,namedBehavior:5},reason:"shared custom hook and handlers"},{min:{namedStates:1,handlers:2,effects:1,namedBehavior:5},reason:"shared stateful effects"},{min:{namedStates:1,handlers:2,reactHooks:2,namedBehavior:5},reason:"shared stateful React primitives"}]).pass}function P(e){let s=[];return e.sharedHooks.length&&s.push(`shared hooks: ${e.sharedHooks.join(", ")}`),e.sharedReactHooks.length&&s.push(`shared React hooks: ${e.sharedReactHooks.join(", ")}`),e.sharedEffects.length&&s.push(`shared effects: ${e.sharedEffects.join(", ")}`),e.sharedState.length&&s.push(`shared state: ${e.sharedState.join(", ")}`),e.sharedRequests.length&&s.push(`shared requests: ${e.sharedRequests.join(", ")}`),e.sharedHandlers.length&&s.push(`shared handlers: ${e.sharedHandlers.slice(0,6).join(", ")}`),e.sharedHandlerVerbs.length&&s.push(`shared action verbs: ${e.sharedHandlerVerbs.slice(0,6).join(", ")}`),s.join("; ")||"shared React behavior profile"}var q=new Set(["add","apply","async","callback","cancel","change","clear","close","create","data","delete","draft","edit","effect","error","fetch","filter","form","handle","has","is","item","items","load","loader","loading","memo","name","open","reducer","refresh","ref","remove","request","reset","resource","row","rows","save","saving","search","select","selected","state","store","submit","toggle","update","use","value"]),w=[/^use(?=[A-Z])/,/^handle(?=[A-Z])/,/^is(?=[A-Z])/,/^has(?=[A-Z])/];export{V as a};
2
+ //# sourceMappingURL=chunk-4FMT4HPC.js.map
@@ -1,2 +1,2 @@
1
- import{f as B,g as S}from"./chunk-O5A7BTMA.js";import{b as O}from"./chunk-B75HZHUP.js";import{b as L,c as k}from"./chunk-5CJ6AQN7.js";import{a as E}from"./chunk-BGBBVSH4.js";import{d as P}from"./chunk-MTDBHTSF.js";import{d as I,g as z,j as D,t as $}from"./chunk-7XP7ZRSI.js";import{b as T,k as v,p as A}from"./chunk-JLZUM476.js";import{c as b}from"./chunk-TLTLJ4SW.js";import{C as _,s as p}from"./chunk-M2TRDR25.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-J7IMQRCU.js.map
1
+ import{f as B,g as S}from"./chunk-WWCZCH7W.js";import{b as L,c as k}from"./chunk-CAKPEQZB.js";import{b as O}from"./chunk-B75HZHUP.js";import{a as E}from"./chunk-BGBBVSH4.js";import{d as P}from"./chunk-MTDBHTSF.js";import{d as I,g as z,j as D,t as $}from"./chunk-AYRHVJXW.js";import{b as T,k as v,p as A}from"./chunk-GAE7WCBK.js";import{c as b}from"./chunk-WAU7HVDI.js";import{C as _,s as p}from"./chunk-FC5K7T35.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-53SUJOJA.js.map
@@ -1,2 +1,2 @@
1
- import{b as m,c as d}from"./chunk-5CJ6AQN7.js";import{a as $}from"./chunk-QEIGJJBC.js";function v(r,e={}){return P(r,e).cycles}function P(r,e={}){let{scope:s,maxDepth:i=10}=e,n=$(r,s,{scipEdges:"imports-only"}),c=[],a=new Set,l=new Set,f=[],g=!1;function b(t,o){if(o>i){g=!0;return}if(l.has(t)){let h=f.indexOf(t);if(h!==-1){let u=f.slice(h).concat(t),y=u.indexOf(u.reduce((C,D)=>C<D?C:D)),p=[...u.slice(y,-1),...u.slice(0,y),u[y]],k=p.join(" -> ");S.has(k)||(S.add(k),c.push({path:p,kind:w(p)}))}return}if(a.has(t))return;a.add(t),l.add(t),f.push(t);let x=n.get(t);if(x)for(let h of x)b(h,o+1);f.pop(),l.delete(t)}let S=new Set;for(let t of n.keys())a.has(t)||b(t,0);return c.sort((t,o)=>t.kind!==o.kind?t.kind==="real"?-1:1:t.path.length-o.path.length),{cycles:c,truncated:g,maxDepth:i}}function w(r){for(let i of r){let n=m(i);if(n==="test"||n==="barrel"||n==="entry")return"module-hierarchy"}if(r.length!==3)return"real";let[e,s]=r;return!e||!s?"real":d(e)||d(s)||B(e,s)||B(s,e)||R(e,s)||R(s,e)||m(e)==="entry"||m(s)==="entry"?"module-hierarchy":"real"}function B(r,e){if(!/\.rs$/.test(r)||!/\.rs$/.test(e))return!1;let s=e.replace(/\.rs$/,"/");return r.startsWith(s)?!r.slice(s.length).includes("/"):!1}function R(r,e){if(!/\.rs$/.test(r)||!/\.rs$/.test(e))return!1;let s=r.replace(/\.rs$/,""),i=e.replace(/\.rs$/,"");if(s===i+"_tests"||s===i+"/tests")return!0;let n=r.split("/"),c=e.split("/");if(n.length===c.length&&n.includes("tests")&&c.includes("src")){let a=n[n.length-1],l=c[c.length-1];if(a&&a===l)return!0}return!1}export{v as a,P as b};
2
- //# sourceMappingURL=chunk-27YDE22N.js.map
1
+ import{b as m,c as d}from"./chunk-CAKPEQZB.js";import{a as $}from"./chunk-AOSFSYEA.js";function v(r,e={}){return P(r,e).cycles}function P(r,e={}){let{scope:s,maxDepth:i=10}=e,n=$(r,s,{scipEdges:"imports-only"}),c=[],a=new Set,l=new Set,f=[],g=!1;function b(t,o){if(o>i){g=!0;return}if(l.has(t)){let h=f.indexOf(t);if(h!==-1){let u=f.slice(h).concat(t),y=u.indexOf(u.reduce((C,D)=>C<D?C:D)),p=[...u.slice(y,-1),...u.slice(0,y),u[y]],k=p.join(" -> ");S.has(k)||(S.add(k),c.push({path:p,kind:w(p)}))}return}if(a.has(t))return;a.add(t),l.add(t),f.push(t);let x=n.get(t);if(x)for(let h of x)b(h,o+1);f.pop(),l.delete(t)}let S=new Set;for(let t of n.keys())a.has(t)||b(t,0);return c.sort((t,o)=>t.kind!==o.kind?t.kind==="real"?-1:1:t.path.length-o.path.length),{cycles:c,truncated:g,maxDepth:i}}function w(r){for(let i of r){let n=m(i);if(n==="test"||n==="barrel"||n==="entry")return"module-hierarchy"}if(r.length!==3)return"real";let[e,s]=r;return!e||!s?"real":d(e)||d(s)||B(e,s)||B(s,e)||R(e,s)||R(s,e)||m(e)==="entry"||m(s)==="entry"?"module-hierarchy":"real"}function B(r,e){if(!/\.rs$/.test(r)||!/\.rs$/.test(e))return!1;let s=e.replace(/\.rs$/,"/");return r.startsWith(s)?!r.slice(s.length).includes("/"):!1}function R(r,e){if(!/\.rs$/.test(r)||!/\.rs$/.test(e))return!1;let s=r.replace(/\.rs$/,""),i=e.replace(/\.rs$/,"");if(s===i+"_tests"||s===i+"/tests")return!0;let n=r.split("/"),c=e.split("/");if(n.length===c.length&&n.includes("tests")&&c.includes("src")){let a=n[n.length-1],l=c[c.length-1];if(a&&a===l)return!0}return!1}export{v as a,P as b};
2
+ //# sourceMappingURL=chunk-5GOBZI34.js.map
@@ -1,2 +1,2 @@
1
- import{a as c}from"./chunk-QEIGJJBC.js";function j(e,s={}){let{minSimilarity:t=.5,limit:n=15,scope:i,minChainLength:r=3,maxChainLength:l=8}=s,a=c(e,i),o=y(a,r,l);if(o.length===0)return[];let f=d(o);return f.length<2?[]:S(x(f,t,n),n)}function d(e){let s=m(e),t=[];for(let n of e){let i=n.filter(r=>!s.has(r));i.length>=2&&t.push({original:n,filtered:i})}return t}function m(e){let{nodeFreq:s,tailFreq:t}=p(e),n=e.length*.9,i=e.length*.8,r=new Set;for(let[a,o]of s)o>n&&r.add(a);for(let[a,o]of t)o>i&&r.add(a);let l=["index.ts","index.js","cli.ts","main.ts","health.ts","health.js"];for(let a of s.keys()){let o=a.split("/").pop()??"";l.includes(o)&&r.add(a)}return r}function p(e){let s=new Map,t=new Map;for(let n of e){let i=new Set;for(let r of n)i.has(r)||(s.set(r,(s.get(r)??0)+1),i.add(r));for(let r=Math.max(0,n.length-2);r<n.length;r++)t.set(n[r],(t.get(n[r])??0)+1)}return{nodeFreq:s,tailFreq:t}}function x(e,s,t){let n=[];for(let i=0;i<e.length;i++){for(let r=i+1;r<e.length;r++){let l=b(e[i],e[r],s);l&&n.push(l)}if(n.length>t*10)break}return n.sort((i,r)=>Math.abs(r.similarity-i.similarity)>.01?r.similarity-i.similarity:i.divergencePoints.length-r.divergencePoints.length),n}function b(e,s,t){if(!C(e.filtered,s.filtered))return null;let{distance:n,ops:i}=A(e.filtered,s.filtered),r=Math.max(e.filtered.length,s.filtered.length);if(r===0)return null;let l=1-n/r;if(l<t||n===0)return null;let a=i.filter(f=>f.type==="substitute").map(f=>({index:f.indexA,nodeA:e.filtered[f.indexA],nodeB:s.filtered[f.indexB]}));return a.length===0||i.filter(f=>f.type==="match").length<2?null:{chainA:e.original,chainB:s.original,similarity:l,editDistance:n,divergencePoints:a,commonPrefix:F(e.original,s.original),commonSuffix:B(e.original,s.original)}}function C(e,s){let t=new Set(e);return s.some(n=>t.has(n))}function S(e,s){let t=[];for(let n of e)if(t.some(r=>h(n.chainA,r.chainA)&&h(n.chainB,r.chainB))||t.push(n),t.length>=s)break;return t}function y(e,s,t){let n=[];for(let r of e.keys()){if(n.length>=500)break;g(e,r,[r],new Set([r]),s,t,n,500)}return n}function g(e,s,t,n,i,r,l,a){if(l.length>=a)return;if(t.length>=r){t.length>=i&&l.push([...t]);return}let o=e.get(s);if(!o||o.size===0){t.length>=i&&l.push([...t]);return}let f=!1;for(let u of o)if(!n.has(u)&&(n.add(u),t.push(u),g(e,u,t,n,i,r,l,a),t.pop(),n.delete(u),f=!0,l.length>=a))return;!f&&t.length>=i&&l.push([...t])}function A(e,s){let t=e.length,n=s.length,i=Array.from({length:t+1},()=>Array(n+1).fill(0));for(let o=0;o<=t;o++)i[o][0]=o;for(let o=0;o<=n;o++)i[0][o]=o;for(let o=1;o<=t;o++)for(let f=1;f<=n;f++)e[o-1]===s[f-1]?i[o][f]=i[o-1][f-1]:i[o][f]=1+Math.min(i[o-1][f],i[o][f-1],i[o-1][f-1]);let r=[],l=t,a=n;for(;l>0||a>0;)l>0&&a>0&&e[l-1]===s[a-1]?(r.unshift({type:"match",indexA:l-1,indexB:a-1}),l--,a--):l>0&&a>0&&i[l][a]===i[l-1][a-1]+1?(r.unshift({type:"substitute",indexA:l-1,indexB:a-1}),l--,a--):a>0&&i[l][a]===i[l][a-1]+1?(r.unshift({type:"insert",indexA:l,indexB:a-1}),a--):(r.unshift({type:"delete",indexA:l-1,indexB:a}),l--);return{distance:i[t][n],ops:r}}function F(e,s){let t=[];for(let n=0;n<Math.min(e.length,s.length)&&e[n]===s[n];n++)t.push(e[n]);return t}function B(e,s){let t=[],n=e.length-1,i=s.length-1;for(;n>=0&&i>=0&&e[n]===s[i];)t.unshift(e[n]),n--,i--;return t}function h(e,s){if(e.length>s.length)return!1;let t=s.join("\u2192"),n=e.join("\u2192");return t.includes(n)}export{j as a};
2
- //# sourceMappingURL=chunk-4FLF7BHJ.js.map
1
+ import{a as c}from"./chunk-AOSFSYEA.js";function j(e,s={}){let{minSimilarity:t=.5,limit:n=15,scope:i,minChainLength:r=3,maxChainLength:l=8}=s,a=c(e,i),o=y(a,r,l);if(o.length===0)return[];let f=d(o);return f.length<2?[]:S(x(f,t,n),n)}function d(e){let s=m(e),t=[];for(let n of e){let i=n.filter(r=>!s.has(r));i.length>=2&&t.push({original:n,filtered:i})}return t}function m(e){let{nodeFreq:s,tailFreq:t}=p(e),n=e.length*.9,i=e.length*.8,r=new Set;for(let[a,o]of s)o>n&&r.add(a);for(let[a,o]of t)o>i&&r.add(a);let l=["index.ts","index.js","cli.ts","main.ts","health.ts","health.js"];for(let a of s.keys()){let o=a.split("/").pop()??"";l.includes(o)&&r.add(a)}return r}function p(e){let s=new Map,t=new Map;for(let n of e){let i=new Set;for(let r of n)i.has(r)||(s.set(r,(s.get(r)??0)+1),i.add(r));for(let r=Math.max(0,n.length-2);r<n.length;r++)t.set(n[r],(t.get(n[r])??0)+1)}return{nodeFreq:s,tailFreq:t}}function x(e,s,t){let n=[];for(let i=0;i<e.length;i++){for(let r=i+1;r<e.length;r++){let l=b(e[i],e[r],s);l&&n.push(l)}if(n.length>t*10)break}return n.sort((i,r)=>Math.abs(r.similarity-i.similarity)>.01?r.similarity-i.similarity:i.divergencePoints.length-r.divergencePoints.length),n}function b(e,s,t){if(!C(e.filtered,s.filtered))return null;let{distance:n,ops:i}=A(e.filtered,s.filtered),r=Math.max(e.filtered.length,s.filtered.length);if(r===0)return null;let l=1-n/r;if(l<t||n===0)return null;let a=i.filter(f=>f.type==="substitute").map(f=>({index:f.indexA,nodeA:e.filtered[f.indexA],nodeB:s.filtered[f.indexB]}));return a.length===0||i.filter(f=>f.type==="match").length<2?null:{chainA:e.original,chainB:s.original,similarity:l,editDistance:n,divergencePoints:a,commonPrefix:F(e.original,s.original),commonSuffix:B(e.original,s.original)}}function C(e,s){let t=new Set(e);return s.some(n=>t.has(n))}function S(e,s){let t=[];for(let n of e)if(t.some(r=>h(n.chainA,r.chainA)&&h(n.chainB,r.chainB))||t.push(n),t.length>=s)break;return t}function y(e,s,t){let n=[];for(let r of e.keys()){if(n.length>=500)break;g(e,r,[r],new Set([r]),s,t,n,500)}return n}function g(e,s,t,n,i,r,l,a){if(l.length>=a)return;if(t.length>=r){t.length>=i&&l.push([...t]);return}let o=e.get(s);if(!o||o.size===0){t.length>=i&&l.push([...t]);return}let f=!1;for(let u of o)if(!n.has(u)&&(n.add(u),t.push(u),g(e,u,t,n,i,r,l,a),t.pop(),n.delete(u),f=!0,l.length>=a))return;!f&&t.length>=i&&l.push([...t])}function A(e,s){let t=e.length,n=s.length,i=Array.from({length:t+1},()=>Array(n+1).fill(0));for(let o=0;o<=t;o++)i[o][0]=o;for(let o=0;o<=n;o++)i[0][o]=o;for(let o=1;o<=t;o++)for(let f=1;f<=n;f++)e[o-1]===s[f-1]?i[o][f]=i[o-1][f-1]:i[o][f]=1+Math.min(i[o-1][f],i[o][f-1],i[o-1][f-1]);let r=[],l=t,a=n;for(;l>0||a>0;)l>0&&a>0&&e[l-1]===s[a-1]?(r.unshift({type:"match",indexA:l-1,indexB:a-1}),l--,a--):l>0&&a>0&&i[l][a]===i[l-1][a-1]+1?(r.unshift({type:"substitute",indexA:l-1,indexB:a-1}),l--,a--):a>0&&i[l][a]===i[l][a-1]+1?(r.unshift({type:"insert",indexA:l,indexB:a-1}),a--):(r.unshift({type:"delete",indexA:l-1,indexB:a}),l--);return{distance:i[t][n],ops:r}}function F(e,s){let t=[];for(let n=0;n<Math.min(e.length,s.length)&&e[n]===s[n];n++)t.push(e[n]);return t}function B(e,s){let t=[],n=e.length-1,i=s.length-1;for(;n>=0&&i>=0&&e[n]===s[i];)t.unshift(e[n]),n--,i--;return t}function h(e,s){if(e.length>s.length)return!1;let t=s.join("\u2192"),n=e.join("\u2192");return t.includes(n)}export{j as a};
2
+ //# sourceMappingURL=chunk-5OZCNAVM.js.map
@@ -0,0 +1,2 @@
1
+ import{c as a}from"./chunk-B75HZHUP.js";import{a as g,c as S}from"./chunk-EMIIOOTM.js";import{m as b,n as m}from"./chunk-DZXFZAZO.js";import{a as y}from"./chunk-HFBNIIZX.js";import{d as n}from"./chunk-AYRHVJXW.js";function N(i,t,r={}){let o=y(i,t);if(!o)return null;let c=[{file:o.relativePath,line:o.startLine}],s=b(i,o,{semantic:r.semantic,semanticEvidence:m}).map(e=>({file:e.file,line:e.line,enclosingSymbol:e.enclosingSymbol??"(top-level)",enclosingShort:e.enclosingSymbol?n(e.enclosingSymbol):"(top-level)"})),{producers:f,consumers:l}=p(i,o,s,{semantic:r.semantic!==!1});return{symbol:o.symbol,shortName:n(o.symbol),relativePath:o.relativePath,definitionSites:c.filter(e=>!i.isIgnored(e.file)),usageSites:s,producers:f.filter(e=>!i.isIgnored(e.file)).map(e=>({symbol:e.symbol,shortName:n(e.symbol),file:e.file})),consumers:l.filter(e=>!i.isIgnored(e.file)).map(e=>({symbol:e.symbol,shortName:e.symbol===e.file?"(top-level)":n(e.symbol),file:e.file}))}}function p(i,t,r,o){let c=a(g(i,t,{limit:30,semantic:o.semantic,semanticEvidence:m}).map(l=>({symbol:l.symbol,file:l.file}))),s=a(S(i,t,{limit:30,semantic:o.semantic,semanticEvidence:m})),f=s.length>0?s:a(r.map(l=>({symbol:l.enclosingSymbol==="(top-level)"?l.file:l.enclosingSymbol,file:l.file})));return{producers:c,consumers:f}}export{N as a};
2
+ //# sourceMappingURL=chunk-5TEUKVSM.js.map
@@ -1,4 +1,4 @@
1
- import{a as D,b as v,c as $,d as B}from"./chunk-PV3GKBO5.js";import{a as K}from"./chunk-BGUYAA3Q.js";import{a as A}from"./chunk-L2RE5P3X.js";import{b as M,g as R}from"./chunk-5CJ6AQN7.js";import{a as g}from"./chunk-BGBBVSH4.js";import{h as I}from"./chunk-2GX3TNOW.js";import{b as k,d as F,e as b}from"./chunk-7XP7ZRSI.js";import{l as w}from"./chunk-JLZUM476.js";import{y as C}from"./chunk-M2TRDR25.js";function de(t,e){let{scope:n,minLoc:i=3,maxLoc:s=80,limit:r=30,includeLowConfidence:l=!1,scanLimit:o}=e??{},d=e?.semantic!==!1,a=new A(t),m=a.scopedDefinitions(n),y=Q(a,n),p={high:0,medium:1,low:2};return K({candidates:()=>O(t,a,m,{minLoc:i,maxLoc:s}),orderCandidates:(u,c)=>g(c)-g(u)||u.relativePath.localeCompare(c.relativePath),scanLimit:o,profile:{name:"stale-abstractions"},prepare:u=>{let c=U(u),f=W(t,a,u,c,{semantic:d}),h=u.filter(P=>{let x=S(t,P,f,c);return x.realConsumers.length<=1&&!x.transitivelyReachable&&j(P,x.realConsumers.length,y)});return{consumerFileMap:f,singletonBackedClassIds:H(t,a,m,h,{semantic:d}),candidateIndex:c}},evaluate:(u,c)=>{if(c.singletonBackedClassIds.has(u.symbolId))return null;let f=S(t,u,c.consumerFileMap,c.candidateIndex);if(f.transitivelyReachable||f.realConsumers.length>1||f.realConsumers.length===0&&f.barrelConsumers>0||!j(f.definition,f.realConsumers.length,y))return null;let h=V(t,f);return!l&&h.confidence==="low"?null:h},orderResults:(u,c)=>p[u.confidence]-p[c.confidence]||c.loc-u.loc||u.file.localeCompare(c.file)||u.startLine-c.startLine,limit:r})}function O(t,e,n,i){return n.filter(s=>s.isTypeLike&&g(s)>=i.minLoc).filter(s=>g(s)<=i.maxLoc).filter(s=>!t.isIgnored(s.relativePath)).filter(s=>!s.relativePath.endsWith(".d.ts")).filter(s=>M(s.relativePath)!=="test").filter(s=>!R(t,s.symbol,s.relativePath)).filter(s=>!X(s.symbol)).filter(s=>!e.hasSuppressionComment(s))}function L(t,e,n,i){return v(D(t,e).forDefinitions(n,{semantic:i.semantic,sourceFallback:i.sourceFallback}))}function W(t,e,n,i,s){let r=L(t,e,n,{semantic:!1,sourceFallback:!1}),l=n.filter(a=>{let m=S(t,a,r,i);return m.realConsumers.length<=1&&!(m.realConsumers.length>0&&T(a.relativePath))}),o=s.semantic&&l.length>0?I(r,L(t,e,l,{semantic:!0,sourceFallback:!1})):r,d=l.filter(a=>S(t,a,o,i).realConsumers.length<=1);return I(o,L(t,e,d,{semantic:!1,sourceFallback:!0}))}function U(t){let e=new Map;for(let n of t){let i=e.get(n.relativePath);i||(i=new Map,e.set(n.relativePath,i));let s=b(n.symbol);s&&i.set(s,n)}return e}function S(t,e,n,i){let r=[...n.get(e.symbolId)??new Set].filter(m=>m!==e.relativePath&&!t.isIgnored(m)),{realConsumers:l,barrelConsumers:o,importOnlyConsumers:d}=$(t,e,r),a=Y(t,e,n,i);return{definition:e,realConsumers:l,barrelConsumers:o+d,transitivelyReachable:a}}function V(t,e){let n=E(t,e.definition.relativePath,e.definition.startLine),i=T(e.definition.relativePath)?!0:ee(t,e.definition),{confidence:s,reason:r}=ne(e.realConsumers.length,n,i),l=z(e.realConsumers.length,n,i);return{symbol:e.definition.symbol,shortName:F(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:g(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:n,definerUsesType:i,confidence:s,reason:r,actionTier:l.actionTier,stalenessKind:l.stalenessKind,recommendation:l.recommendation}}function z(t,e,n){return t===0?{actionTier:"direct",stalenessKind:"unused-abstraction",recommendation:"Delete the abstraction or wire the missing consumer after checking public/package surfaces."}:e==="class"?{actionTier:"signal",stalenessKind:"one-to-one-class-encapsulation",recommendation:"Treat as weak signal: a one-consumer class may be intentional encapsulation, so inline only after reviewing ownership and state boundaries."}:n?{actionTier:"signal",stalenessKind:"single-consumer-abstraction",recommendation:"Review whether this single-consumer abstraction earns its name or should be folded into the owning feature."}:{actionTier:"signal",stalenessKind:"misplaced-single-consumer-type",recommendation:"Review moving or co-locating the type with its only real consumer; keep it here only if this file owns the public contract."}}function H(t,e,n,i,s){let r=_(t,Z(n),i),l=r.map(a=>a.singleton);if(r.length===0)return new Set;let o=v(D(t,e).forDefinitions(l,{semantic:s.semantic,sourceFallback:!0})),d=new Set;for(let{singleton:a,classId:m}of r)G(t,a,o)&&d.add(m);return d}function Z(t){let e=new Map;for(let n of t){let i=b(n.symbol);i&&e.set(N(n.relativePath,i),n)}return e}function _(t,e,n){let i=[];for(let s of n){let r=q(t,e,s);r&&i.push({singleton:r,classId:s.symbolId})}return i}function q(t,e,n){if(E(t,n.relativePath,n.startLine)!=="class")return null;let i=b(n.symbol);if(!i)return null;let s=J(t,n.relativePath,i);return s?e.get(N(n.relativePath,s))??null:null}function G(t,e,n){let i=b(e.symbol),s=n.get(e.symbolId);return!i||!s?!1:[...s].some(r=>r!==e.relativePath&&!t.isIgnored(r)&&!B(t,r,i))}function N(t,e){return`${t}\0${e}`}function J(t,e,n){let i=C(t,e);if(!i)return null;let s=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\bexport\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*new\\s+${s}\\s*\\(`);return i.match(r)?.[1]??null}function Q(t,e){return new Set(t.scopedDefinitions(e).filter(n=>n.isFunctionLike).map(n=>n.relativePath))}function X(t){let e=k(t);if("kind"in e)return!1;let n=e.descriptors;if(n.length<2)return!1;let i=n[n.length-1],s=n[n.length-2];return i?.suffix==="type"&&s?.suffix==="type"}function T(t){let n=(t.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(n==="types"||n.endsWith("-types")||n==="models"||n==="schema"||n==="common"||n==="protocol"||n==="proto"||n==="dto"||n==="mod"||n==="contracts"||/(^|\/)types(\/|\.)/.test(t)||/(^|\/)models?(\/|\.)/.test(t)||/(^|\/)proto(?:col)?(\/|\.)/.test(t)||/(^|\/)schema(\/|\.)/.test(t)||/(^|\/)contracts?(\/|\.)/.test(t))}function j(t,e,n){return!(T(t.relativePath)&&e>0||e===0&&n.has(t.relativePath))}function Y(t,e,n,i){let s=w(t,e.relativePath),r=b(e.symbol);if(!r)return!1;let l=i.get(e.relativePath);if(!l)return!1;let o=[...s.get(r)??[]],d=new Set;for(;o.length>0;){let a=o.pop();if(d.has(a))continue;d.add(a);let m=l.get(a);if(!m)continue;let y=n.get(m.symbolId);if(y){for(let p of y)if(p!==e.relativePath&&!t.isIgnored(p))return!0}for(let p of s.get(a)??[])o.push(p)}return!1}function E(t,e,n){let i=C(t,e);if(!i)return"other";let s=i.split(`
1
+ import{a as D,b as v,c as $,d as B}from"./chunk-AGTATREV.js";import{a as K}from"./chunk-FBUNGRKI.js";import{a as A}from"./chunk-7TJJY2C3.js";import{b as M,g as R}from"./chunk-CAKPEQZB.js";import{a as g}from"./chunk-BGBBVSH4.js";import{h as I}from"./chunk-EMIIOOTM.js";import{b as k,d as F,e as b}from"./chunk-AYRHVJXW.js";import{l as w}from"./chunk-GAE7WCBK.js";import{y as C}from"./chunk-FC5K7T35.js";function de(t,e){let{scope:n,minLoc:i=3,maxLoc:s=80,limit:r=30,includeLowConfidence:l=!1,scanLimit:o}=e??{},d=e?.semantic!==!1,a=new A(t),m=a.scopedDefinitions(n),y=Q(a,n),p={high:0,medium:1,low:2};return K({candidates:()=>O(t,a,m,{minLoc:i,maxLoc:s}),orderCandidates:(u,c)=>g(c)-g(u)||u.relativePath.localeCompare(c.relativePath),scanLimit:o,profile:{name:"stale-abstractions"},prepare:u=>{let c=U(u),f=W(t,a,u,c,{semantic:d}),h=u.filter(P=>{let x=S(t,P,f,c);return x.realConsumers.length<=1&&!x.transitivelyReachable&&j(P,x.realConsumers.length,y)});return{consumerFileMap:f,singletonBackedClassIds:H(t,a,m,h,{semantic:d}),candidateIndex:c}},evaluate:(u,c)=>{if(c.singletonBackedClassIds.has(u.symbolId))return null;let f=S(t,u,c.consumerFileMap,c.candidateIndex);if(f.transitivelyReachable||f.realConsumers.length>1||f.realConsumers.length===0&&f.barrelConsumers>0||!j(f.definition,f.realConsumers.length,y))return null;let h=V(t,f);return!l&&h.confidence==="low"?null:h},orderResults:(u,c)=>p[u.confidence]-p[c.confidence]||c.loc-u.loc||u.file.localeCompare(c.file)||u.startLine-c.startLine,limit:r})}function O(t,e,n,i){return n.filter(s=>s.isTypeLike&&g(s)>=i.minLoc).filter(s=>g(s)<=i.maxLoc).filter(s=>!t.isIgnored(s.relativePath)).filter(s=>!s.relativePath.endsWith(".d.ts")).filter(s=>M(s.relativePath)!=="test").filter(s=>!R(t,s.symbol,s.relativePath)).filter(s=>!X(s.symbol)).filter(s=>!e.hasSuppressionComment(s))}function L(t,e,n,i){return v(D(t,e).forDefinitions(n,{semantic:i.semantic,sourceFallback:i.sourceFallback}))}function W(t,e,n,i,s){let r=L(t,e,n,{semantic:!1,sourceFallback:!1}),l=n.filter(a=>{let m=S(t,a,r,i);return m.realConsumers.length<=1&&!(m.realConsumers.length>0&&T(a.relativePath))}),o=s.semantic&&l.length>0?I(r,L(t,e,l,{semantic:!0,sourceFallback:!1})):r,d=l.filter(a=>S(t,a,o,i).realConsumers.length<=1);return I(o,L(t,e,d,{semantic:!1,sourceFallback:!0}))}function U(t){let e=new Map;for(let n of t){let i=e.get(n.relativePath);i||(i=new Map,e.set(n.relativePath,i));let s=b(n.symbol);s&&i.set(s,n)}return e}function S(t,e,n,i){let r=[...n.get(e.symbolId)??new Set].filter(m=>m!==e.relativePath&&!t.isIgnored(m)),{realConsumers:l,barrelConsumers:o,importOnlyConsumers:d}=$(t,e,r),a=Y(t,e,n,i);return{definition:e,realConsumers:l,barrelConsumers:o+d,transitivelyReachable:a}}function V(t,e){let n=E(t,e.definition.relativePath,e.definition.startLine),i=T(e.definition.relativePath)?!0:ee(t,e.definition),{confidence:s,reason:r}=ne(e.realConsumers.length,n,i),l=z(e.realConsumers.length,n,i);return{symbol:e.definition.symbol,shortName:F(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:g(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:n,definerUsesType:i,confidence:s,reason:r,actionTier:l.actionTier,stalenessKind:l.stalenessKind,recommendation:l.recommendation}}function z(t,e,n){return t===0?{actionTier:"direct",stalenessKind:"unused-abstraction",recommendation:"Delete the abstraction or wire the missing consumer after checking public/package surfaces."}:e==="class"?{actionTier:"signal",stalenessKind:"one-to-one-class-encapsulation",recommendation:"Treat as weak signal: a one-consumer class may be intentional encapsulation, so inline only after reviewing ownership and state boundaries."}:n?{actionTier:"signal",stalenessKind:"single-consumer-abstraction",recommendation:"Review whether this single-consumer abstraction earns its name or should be folded into the owning feature."}:{actionTier:"signal",stalenessKind:"misplaced-single-consumer-type",recommendation:"Review moving or co-locating the type with its only real consumer; keep it here only if this file owns the public contract."}}function H(t,e,n,i,s){let r=_(t,Z(n),i),l=r.map(a=>a.singleton);if(r.length===0)return new Set;let o=v(D(t,e).forDefinitions(l,{semantic:s.semantic,sourceFallback:!0})),d=new Set;for(let{singleton:a,classId:m}of r)G(t,a,o)&&d.add(m);return d}function Z(t){let e=new Map;for(let n of t){let i=b(n.symbol);i&&e.set(N(n.relativePath,i),n)}return e}function _(t,e,n){let i=[];for(let s of n){let r=q(t,e,s);r&&i.push({singleton:r,classId:s.symbolId})}return i}function q(t,e,n){if(E(t,n.relativePath,n.startLine)!=="class")return null;let i=b(n.symbol);if(!i)return null;let s=J(t,n.relativePath,i);return s?e.get(N(n.relativePath,s))??null:null}function G(t,e,n){let i=b(e.symbol),s=n.get(e.symbolId);return!i||!s?!1:[...s].some(r=>r!==e.relativePath&&!t.isIgnored(r)&&!B(t,r,i))}function N(t,e){return`${t}\0${e}`}function J(t,e,n){let i=C(t,e);if(!i)return null;let s=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\bexport\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*new\\s+${s}\\s*\\(`);return i.match(r)?.[1]??null}function Q(t,e){return new Set(t.scopedDefinitions(e).filter(n=>n.isFunctionLike).map(n=>n.relativePath))}function X(t){let e=k(t);if("kind"in e)return!1;let n=e.descriptors;if(n.length<2)return!1;let i=n[n.length-1],s=n[n.length-2];return i?.suffix==="type"&&s?.suffix==="type"}function T(t){let n=(t.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(n==="types"||n.endsWith("-types")||n==="models"||n==="schema"||n==="common"||n==="protocol"||n==="proto"||n==="dto"||n==="mod"||n==="contracts"||/(^|\/)types(\/|\.)/.test(t)||/(^|\/)models?(\/|\.)/.test(t)||/(^|\/)proto(?:col)?(\/|\.)/.test(t)||/(^|\/)schema(\/|\.)/.test(t)||/(^|\/)contracts?(\/|\.)/.test(t))}function j(t,e,n){return!(T(t.relativePath)&&e>0||e===0&&n.has(t.relativePath))}function Y(t,e,n,i){let s=w(t,e.relativePath),r=b(e.symbol);if(!r)return!1;let l=i.get(e.relativePath);if(!l)return!1;let o=[...s.get(r)??[]],d=new Set;for(;o.length>0;){let a=o.pop();if(d.has(a))continue;d.add(a);let m=l.get(a);if(!m)continue;let y=n.get(m.symbolId);if(y){for(let p of y)if(p!==e.relativePath&&!t.isIgnored(p))return!0}for(let p of s.get(a)??[])o.push(p)}return!1}function E(t,e,n){let i=C(t,e);if(!i)return"other";let s=i.split(`
2
2
  `),r=Math.max(0,n-2),l=Math.min(s.length-1,n+2);for(let o=r;o<=l;o++){let a=(s[o]??"").replace(/^\s*\/\/.*$/g,"");if(/\b(?:export\s+)?(?:abstract\s+)?class\s+\w/.test(a))return"class";if(/\b(?:export\s+)?interface\s+\w/.test(a))return"interface";if(/\b(?:export\s+)?type\s+\w/.test(a))return"type";if(/\b(?:export\s+)?(?:const\s+)?enum\s+\w/.test(a))return"enum"}return"other"}function ee(t,e){let n=C(t,e.relativePath);if(!n)return!1;let i=b(e.symbol);if(!i)return!1;let s=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b${s}\\b`),l=n.split(`
3
3
  `);for(let o=0;o<l.length;o++)if(!(o>=e.startLine&&o<=e.endLine)&&r.test(l[o]??""))return!0;return!1}function ne(t,e,n){return t===0?{confidence:"high",reason:"unused \u2014 no consumers and defining file has no real usage"}:t===1&&e==="class"?{confidence:"low",reason:"1 consumer + class kind \u2014 likely 1:1 encapsulation, not over-abstraction"}:t===1&&!n?{confidence:"high",reason:"1 consumer + defining file never uses it \u2014 type belongs with its consumer"}:{confidence:"medium",reason:"1 consumer \u2014 single-use abstraction"}}export{de as a};
4
- //# sourceMappingURL=chunk-GTANVH72.js.map
4
+ //# sourceMappingURL=chunk-5W2VAEVR.js.map
@@ -1,4 +1,4 @@
1
- import{a as d}from"./chunk-L2RE5P3X.js";import{a as h}from"./chunk-6JSTKSZH.js";import{d as f}from"./chunk-7XP7ZRSI.js";import{b as u}from"./chunk-JLZUM476.js";import{E as l}from"./chunk-TLTLJ4SW.js";import{readFileSync as E}from"fs";import{join as B}from"path";function j(t,e,s={}){let n=h(t,e);if(!n)return null;let a=new d(t),o=N(t,n),r=n.endLine-n.startLine+1,m=a.calleeMap([n],{additive:!0,semantic:s.semantic}).get(n.symbolId)??[],c=new Set(m.map(x=>x.symbol));return{symbol:n.symbol,shortName:f(n.symbol),relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:r,branches:o.branches,estimateBasis:o.estimateBasis,cyclomaticEstimate:o.branches+1,calleeCount:c.size,fanIn:P(t,n.symbolId),fanOut:w(m,n.relativePath)}}function N(t,e){let s=l(t,e.relativePath);if(s){let n=g(s.rootNode,e.startLine,e.endLine);if(n)return{branches:v(n),estimateBasis:"ast"}}return{branches:_(p(t,e.relativePath,e.startLine,e.endLine),y(t,e.relativePath)),estimateBasis:"regex-fallback"}}function H(t,e){let s=new Map,n=new Map;for(let a of e){let o=n.get(a.relativePath)??[];o.push(a),n.set(a.relativePath,o)}for(let[a,o]of n){let r=l(t,a),i=r===null?[]:o.filter(c=>r.rootNode.startPosition.row<=c.startLine&&r.rootNode.endPosition.row>=c.endLine),m=new Set(i.map(c=>c.symbolId));if(r&&i.length>0){for(let c of i)s.set(c.symbolId,{branches:0,estimateBasis:"ast"});C(r.rootNode,i,s)}for(let c of o)m.has(c.symbolId)||s.set(c.symbolId,L(t,c))}return s}function L(t,e){return{branches:_(p(t,e.relativePath,e.startLine,e.endLine),y(t,e.relativePath)),estimateBasis:"regex-fallback"}}function y(t,e){return t.get("SELECT language FROM documents WHERE relative_path = ?",e)?.language??"unknown"}function p(t,e,s,n){try{return E(B(t.config.projectRoot,e),"utf-8").split(`
1
+ import{a as d}from"./chunk-7TJJY2C3.js";import{a as h}from"./chunk-HFBNIIZX.js";import{d as f}from"./chunk-AYRHVJXW.js";import{b as u}from"./chunk-GAE7WCBK.js";import{E as l}from"./chunk-WAU7HVDI.js";import{readFileSync as E}from"fs";import{join as B}from"path";function j(t,e,s={}){let n=h(t,e);if(!n)return null;let a=new d(t),o=N(t,n),r=n.endLine-n.startLine+1,m=a.calleeMap([n],{additive:!0,semantic:s.semantic}).get(n.symbolId)??[],c=new Set(m.map(x=>x.symbol));return{symbol:n.symbol,shortName:f(n.symbol),relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:r,branches:o.branches,estimateBasis:o.estimateBasis,cyclomaticEstimate:o.branches+1,calleeCount:c.size,fanIn:P(t,n.symbolId),fanOut:w(m,n.relativePath)}}function N(t,e){let s=l(t,e.relativePath);if(s){let n=g(s.rootNode,e.startLine,e.endLine);if(n)return{branches:v(n),estimateBasis:"ast"}}return{branches:_(p(t,e.relativePath,e.startLine,e.endLine),y(t,e.relativePath)),estimateBasis:"regex-fallback"}}function H(t,e){let s=new Map,n=new Map;for(let a of e){let o=n.get(a.relativePath)??[];o.push(a),n.set(a.relativePath,o)}for(let[a,o]of n){let r=l(t,a),i=r===null?[]:o.filter(c=>r.rootNode.startPosition.row<=c.startLine&&r.rootNode.endPosition.row>=c.endLine),m=new Set(i.map(c=>c.symbolId));if(r&&i.length>0){for(let c of i)s.set(c.symbolId,{branches:0,estimateBasis:"ast"});C(r.rootNode,i,s)}for(let c of o)m.has(c.symbolId)||s.set(c.symbolId,L(t,c))}return s}function L(t,e){return{branches:_(p(t,e.relativePath,e.startLine,e.endLine),y(t,e.relativePath)),estimateBasis:"regex-fallback"}}function y(t,e){return t.get("SELECT language FROM documents WHERE relative_path = ?",e)?.language??"unknown"}function p(t,e,s,n){try{return E(B(t.config.projectRoot,e),"utf-8").split(`
2
2
  `).slice(s,n+1).join(`
3
3
  `)}catch{return""}}function P(t,e){return t.get(`SELECT COUNT(DISTINCT c.document_id) AS c
4
4
  FROM mentions m
@@ -13,4 +13,4 @@ import{a as d}from"./chunk-L2RE5P3X.js";import{a as h}from"./chunk-6JSTKSZH.js";
13
13
  WHERE m.symbol_id = ?
14
14
  AND m.role != 1
15
15
  AND sym_def.document_id != c.document_id`,e)?.c??0}function w(t,e){return new Set(t.filter(s=>s.file!==e).map(s=>s.symbol)).size}function v(t){let e=0;return b(t,s=>{e+=S(s)}),e}function C(t,e,s){let n=[...e].sort((a,o)=>a.startLine-o.startLine||o.endLine-a.endLine);b(t,a=>{let o=S(a);if(o===0)return;let r=a.startPosition.row,i=a.endPosition.row;for(let m of n){if(m.startLine>r)break;if(m.endLine<i)continue;let c=s.get(m.symbolId);c&&(c.branches+=o)}})}function b(t,e){e(t);for(let s of t.namedChildren)b(s,e)}function g(t,e,s){if(t.startPosition.row>e||t.endPosition.row<s)return null;for(let n of t.namedChildren){let a=g(n,e,s);if(a)return a}return t}var D=new Set(["if_statement","conditional_expression","ternary_expression","for_statement","for_in_statement","for_of_statement","while_statement","do_statement","switch_case","case_statement","catch_clause","except_clause","elif_clause","match_arm"]);function S(t){return D.has(t.type)?1:t.type==="binary_expression"&&t.parent?.type!=="binary_expression"&&(t.text.includes("&&")||t.text.includes("||"))?I(t.text):0}function I(t){return(t.match(/&&|\|\|/g)??[]).length}function _(t,e){let s=u(t),n=0,a=[/\bif\b/g,/\belse\s+if\b/g,/\belse\b/g,/\bfor\b/g,/\bwhile\b/g,/\bswitch\b/g,/\bcase\b/g,/\bcatch\b/g,/\?\s*[^?]/g,/&&/g,/\|\|/g];for(let o of a){let r=s.match(o);r&&(n+=r.length)}if(e==="python"){let o=[/\belif\b/g,/\bexcept\b/g,/\bfinally\b/g];for(let r of o){let i=s.match(r);i&&(n+=i.length)}}else if(e==="rust"){let o=[/\bmatch\b/g,/=>/g,/\bloop\b/g];for(let r of o){let i=s.match(r);i&&(n+=i.length)}}else if(e==="ruby"){let o=[/\belsif\b/g,/\bunless\b/g,/\brescue\b/g,/\bwhen\b/g];for(let r of o){let i=s.match(r);i&&(n+=i.length)}}else if(e==="go"){let o=[/\bselect\b/g,/\bdefer\b/g];for(let r of o){let i=s.match(r);i&&(n+=i.length)}}return n}export{j as a,N as b,H as c,v as d};
16
- //# sourceMappingURL=chunk-43QUXX3E.js.map
16
+ //# sourceMappingURL=chunk-63P42UR6.js.map
@@ -1,6 +1,6 @@
1
- import{a as m}from"./chunk-K65T4TJS.js";import{a as h}from"./chunk-6JSTKSZH.js";import{d as g}from"./chunk-7XP7ZRSI.js";import{readFileSync as f}from"fs";import{extname as y,join as d}from"path";function M(t,e,a={}){let{context:s=0}=a,r=L(e);if(r)return j(t,r.filePath,r.startLine,r.endLine,s);let i=h(t,e);return i?R(t,i,s):null}function L(t){let e=t.match(/^(.+\.\w+):(\d+)-(\d+)$/);return e?{filePath:e[1],startLine:parseInt(e[2],10),endLine:parseInt(e[3],10)}:null}function R(t,e,a){let s=t.get("SELECT language FROM documents WHERE relative_path = ?",e.relativePath),r=d(t.config.projectRoot,e.relativePath),i;try{i=f(r,"utf-8")}catch{return null}let n=i.split(`
1
+ import{a as m}from"./chunk-SJ6XSCG7.js";import{a as h}from"./chunk-HFBNIIZX.js";import{d as g}from"./chunk-AYRHVJXW.js";import{readFileSync as f}from"fs";import{extname as y,join as d}from"path";function M(t,e,a={}){let{context:s=0}=a,r=L(e);if(r)return j(t,r.filePath,r.startLine,r.endLine,s);let i=h(t,e);return i?R(t,i,s):null}function L(t){let e=t.match(/^(.+\.\w+):(\d+)-(\d+)$/);return e?{filePath:e[1],startLine:parseInt(e[2],10),endLine:parseInt(e[3],10)}:null}function R(t,e,a){let s=t.get("SELECT language FROM documents WHERE relative_path = ?",e.relativePath),r=d(t.config.projectRoot,e.relativePath),i;try{i=f(r,"utf-8")}catch{return null}let n=i.split(`
2
2
  `),c=Math.max(0,e.startLine-a),l=Math.min(n.length-1,e.endLine+a),u=n.slice(c,l+1).join(`
3
3
  `);return{symbol:e.symbol,shortName:g(e.symbol),relativePath:e.relativePath,startLine:c,endLine:l,language:s?.language??v(e.relativePath),source:u}}function j(t,e,a,s,r){let i=m(t,e);if(!i)return null;let n=t.get("SELECT relative_path, language FROM documents WHERE relative_path = ?",i);if(!n)return null;let c=d(t.config.projectRoot,n.relative_path),l;try{l=f(c,"utf-8")}catch{return null}let u=l.split(`
4
4
  `),o=Math.max(0,a-1-r),p=Math.min(u.length-1,s-1+r),b=u.slice(o,p+1).join(`
5
5
  `);return{symbol:`${n.relative_path}:${a}-${s}`,shortName:`${n.relative_path}:${a}-${s}`,relativePath:n.relative_path,startLine:o,endLine:p,language:n.language??v(n.relative_path),source:b}}function v(t){switch(y(t).toLowerCase()){case".ts":case".tsx":case".mts":case".cts":return"typescript";case".js":case".jsx":case".mjs":case".cjs":return"javascript";case".py":case".pyi":return"python";case".rs":return"rust";case".go":return"go";case".java":return"java";case".kt":case".kts":return"kotlin";case".scala":return"scala";case".rb":return"ruby";case".php":return"php";case".cs":return"csharp";case".vb":return"vb";case".dart":return"dart";case".c":case".h":return"c";case".cc":case".cpp":case".cxx":case".hpp":case".hh":case".hxx":return"cpp";case".vue":return"vue";default:return null}}export{M as a};
6
- //# sourceMappingURL=chunk-OQFPCIXO.js.map
6
+ //# sourceMappingURL=chunk-64QITTX7.js.map
@@ -1,7 +1,7 @@
1
- import{b as k}from"./chunk-XEEQX5X3.js";import{a as D}from"./chunk-L2RE5P3X.js";import{f as v,g as L}from"./chunk-5CJ6AQN7.js";import{l as S}from"./chunk-OM6JHEW3.js";import{d as h,s as y}from"./chunk-7XP7ZRSI.js";function z(e,n={}){let{scope:s,minLoc:c=1,maxDepth:a=5,scanLimit:f}=n,t=new D(e),i=_(e,s,c,f),o=new P;for(let r of i)o.add(r);let m=[],I=[];i.length>0&&m.push(C(e,0,i,o));let b=i.map(r=>r.definition).filter(r=>r!==null),x=new Set(i.map(r=>r.symbol));for(let r=1;r<=a&&b.length>0;r++){let u=t.calleeMap(b,{semantic:!1}),E=new Set;for(let d of b)for(let l of u.get(d.symbolId)??[])x.has(l.symbol)||E.add(l.symbol);let p=[];for(let d of E){x.add(d);let l=F(e,d);if(!l||e.isIgnored(l.relativePath)||v(e,l.relativePath)||L(e,l.symbol,l.relativePath)||t.fileKind(l.relativePath)==="test"||t.hasSuppressionComment(l))continue;let g=B(e,l,o);g.removable?p.push(w(l,"cascade")):g.blockingFiles.length>0&&I.push({shortName:h(l.symbol),file:l.relativePath,blockingFiles:g.blockingFiles.slice(0,3)})}if(p.length===0)break;for(let d of p)o.add(d);m.push(C(e,r,p,o)),b=p.map(d=>d.definition).filter(d=>d!==null)}let N=m.reduce((r,u)=>r+u.loc,0),R=m.reduce((r,u)=>r+u.entries.length,0);return{batches:m,totalSymbols:R,totalLoc:N,blocked:I}}function _(e,n,s,c){let a=k(e,{scope:n,minLoc:s,skipBarrels:!0,deadCodeOnly:!0,scanLimit:c,semantic:!1}),f=[];for(let t of a.symbols)t.kind==="dead-code"&&(v(e,t.relativePath)||L(e,t.symbol,t.relativePath)||f.push({symbol:t.symbol,shortName:t.shortName,file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:t.loc,evidence:"graph-fact",definition:F(e,t.symbol)}));return f}function w(e,n){return{symbol:e.symbol,shortName:h(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:e.endLine-e.startLine+1,evidence:n,definition:e}}function F(e,n){let s=e.get(`SELECT d.relative_path
1
+ import{b as k}from"./chunk-B2WQKQKP.js";import{a as D}from"./chunk-7TJJY2C3.js";import{f as v,g as L}from"./chunk-CAKPEQZB.js";import{l as S}from"./chunk-DZXFZAZO.js";import{d as h,s as y}from"./chunk-AYRHVJXW.js";function z(e,n={}){let{scope:s,minLoc:c=1,maxDepth:a=5,scanLimit:f}=n,t=new D(e),i=_(e,s,c,f),o=new P;for(let r of i)o.add(r);let m=[],I=[];i.length>0&&m.push(C(e,0,i,o));let b=i.map(r=>r.definition).filter(r=>r!==null),x=new Set(i.map(r=>r.symbol));for(let r=1;r<=a&&b.length>0;r++){let u=t.calleeMap(b,{semantic:!1}),E=new Set;for(let d of b)for(let l of u.get(d.symbolId)??[])x.has(l.symbol)||E.add(l.symbol);let p=[];for(let d of E){x.add(d);let l=F(e,d);if(!l||e.isIgnored(l.relativePath)||v(e,l.relativePath)||L(e,l.symbol,l.relativePath)||t.fileKind(l.relativePath)==="test"||t.hasSuppressionComment(l))continue;let g=B(e,l,o);g.removable?p.push(w(l,"cascade")):g.blockingFiles.length>0&&I.push({shortName:h(l.symbol),file:l.relativePath,blockingFiles:g.blockingFiles.slice(0,3)})}if(p.length===0)break;for(let d of p)o.add(d);m.push(C(e,r,p,o)),b=p.map(d=>d.definition).filter(d=>d!==null)}let N=m.reduce((r,u)=>r+u.loc,0),R=m.reduce((r,u)=>r+u.entries.length,0);return{batches:m,totalSymbols:R,totalLoc:N,blocked:I}}function _(e,n,s,c){let a=k(e,{scope:n,minLoc:s,skipBarrels:!0,deadCodeOnly:!0,scanLimit:c,semantic:!1}),f=[];for(let t of a.symbols)t.kind==="dead-code"&&(v(e,t.relativePath)||L(e,t.symbol,t.relativePath)||f.push({symbol:t.symbol,shortName:t.shortName,file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:t.loc,evidence:"graph-fact",definition:F(e,t.symbol)}));return f}function w(e,n){return{symbol:e.symbol,shortName:h(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:e.endLine-e.startLine+1,evidence:n,definition:e}}function F(e,n){let s=e.get(`SELECT d.relative_path
2
2
  FROM global_symbols gs
3
3
  JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
4
4
  JOIN documents d ON d.id = der.document_id
5
5
  WHERE gs.symbol = ?
6
6
  LIMIT 1`,n);return s?y(e,s.relative_path).find(c=>c.symbol===n)??null:null}function B(e,n,s){let c=S(e,n);if(c.length===0)return{removable:!1,blockingFiles:[]};let a=new Set;for(let f of c)f.file===n.relativePath&&f.line>=n.startLine&&f.line<=n.endLine||s.contains(f.file,f.line)||a.add(f.file);return{removable:a.size===0,blockingFiles:[...a]}}function C(e,n,s,c){let a=[...s].sort((i,o)=>i.file.localeCompare(o.file)||i.startLine-o.startLine),f=new Set(a.map(i=>i.file)),t=[];for(let i of f){let o=y(e,i);o.length>0&&o.every(m=>c.contains(i,m.startLine))&&t.push(i)}return{depth:n,entries:a.map(({definition:i,...o})=>o),loc:a.reduce((i,o)=>i+o.loc,0),filesEmptied:t.sort()}}var P=class{ranges=new Map;add(n){let s=this.ranges.get(n.file)??[];s.push({start:n.startLine,end:n.endLine}),this.ranges.set(n.file,s)}contains(n,s){let c=this.ranges.get(n);return c?c.some(a=>s>=a.start&&s<=a.end):!1}};export{z as a,P as b};
7
- //# sourceMappingURL=chunk-P4L5QQT5.js.map
7
+ //# sourceMappingURL=chunk-6O5JOS7T.js.map
@@ -0,0 +1,2 @@
1
+ import{a as p}from"./chunk-7TJJY2C3.js";import{a as u}from"./chunk-EMIIOOTM.js";import{m as h,n as y}from"./chunk-DZXFZAZO.js";import{a as S,c as b}from"./chunk-HFBNIIZX.js";import{d as m,z as d}from"./chunk-AYRHVJXW.js";function P(e,o,l={}){let{direction:c="backward",maxDepth:s=3}=l,r=S(e,o);return r?c==="backward"?M(e,r,s,{semantic:l.semantic!==!1}):k(e,r,{semantic:l.semantic!==!1}):null}function M(e,o,l,c){let s=[],r=new Set([o.symbol]),t=[o];for(let n=1;n<=l&&t.length!==0;n++){let i=[];for(let g of t){let w=u(e,g,{semantic:c.semantic,semanticEvidence:y});for(let a of w){if(r.has(a.symbol))continue;r.add(a.symbol),s.push({symbol:a.symbol,shortName:m(a.symbol),file:a.file,relationship:n===1?"referenced within definition (callee)":`depth ${n} callee`});let f=b(e,a.symbol);f&&!e.isIgnored(f.relativePath)&&i.push(f)}}t=i}return{symbol:o.symbol,shortName:m(o.symbol),direction:"backward",connectedSymbols:s}}function k(e,o,l){let c=new Set,s=[],r=new p(e);for(let t of h(e,o,{semantic:l.semantic,semanticEvidence:y})){if(s.length>=30)break;let n=t.enclosingSymbol??d(r.definitionsForFile(t.file),t.line)?.symbol??null;if(!n||n===o.symbol)continue;let i=b(e,n);!i||e.isIgnored(i.relativePath)||c.has(i.symbol)||(c.add(i.symbol),s.push({symbol:i.symbol,shortName:m(i.symbol),file:i.relativePath,relationship:`references target at ${t.file}:${t.line+1}`}))}return s.sort((t,n)=>t.file.localeCompare(n.file)),{symbol:o.symbol,shortName:m(o.symbol),direction:"forward",connectedSymbols:s}}export{P as a};
2
+ //# sourceMappingURL=chunk-6PKO2TNZ.js.map
@@ -1,3 +1,3 @@
1
- import{a as S}from"./chunk-TAB7AWKO.js";import{a as y}from"./chunk-BGUYAA3Q.js";import{a as P}from"./chunk-B75HZHUP.js";import{a as x}from"./chunk-L2RE5P3X.js";import{a as h,g as b}from"./chunk-5CJ6AQN7.js";import{a as v}from"./chunk-BGBBVSH4.js";import{d as l,e as p,h as d}from"./chunk-7XP7ZRSI.js";import{a as u,h as m,i as g}from"./chunk-JLZUM476.js";import{z as f}from"./chunk-M2TRDR25.js";import{basename as L,extname as D}from"path";function K(n,e){let{scope:i,maxLoc:t=15,limit:r=30,scanLimit:a}=e??{},s=new x(n);return y({candidates:()=>A(n,s,i,t),orderCandidates:P,scanLimit:a,profile:{name:"passthrough-candidates"},prepare:o=>s.calleeMap(o,{semantic:e?.semantic!==!1}),evaluate:(o,c)=>w(n,o,c.get(o.symbolId)??[]),orderResults:(o,c)=>o.loc-c.loc||o.file.localeCompare(c.file),limit:r})}function w(n,e,i){let t=j(i);if(t.size!==1||!m(n,e.relativePath,e.startLine,e.endLine))return null;let[,r]=[...t.entries()][0],a=I(n,e,r),s=T(n,e),o=a.length>0||s.length>0?"signal":"direct";return{symbol:e.symbol,shortName:l(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:v(e),forwardsTo:r.symbol,forwardsToShort:l(r.symbol),forwardsToFile:r.file,actionTier:o,boundaryEvidence:a,publicFacadeEvidence:s,recommendation:E(o,a,s)}}function I(n,e,i){return S(n,e.relativePath,e.startLine,"passthrough","explicit ignore-passthrough comment",[{label:"passthrough name",value:l(e.symbol)},{label:"callee name",value:l(i.symbol)},{label:"passthrough module",value:L(e.relativePath,D(e.relativePath))},{label:"callee module",value:L(i.file,D(i.file))}])}function E(n,e,i){if(n==="signal"){if(i.length>0)return`Review the public API before inlining; public-facade evidence: ${i.slice(0,2).join("; ")}.`;let t=e.filter(F);return t.length>0?`Review the public API before inlining; public-surface evidence: ${t.slice(0,2).join("; ")}.`:`Review the boundary before inlining; boundary evidence: ${e.slice(0,2).join("; ")}.`}return"Inline or remove this passthrough unless an external API or runtime registration depends on the forwarding name."}function T(n,e){return C(n,e)?h(n,e.relativePath)?["exported passthrough is declared on the package public surface"]:b(n,e.symbol,e.relativePath)?["exported passthrough matches configured or framework public entry surface"]:[]:[]}function C(n,e){let i=f(n,e.relativePath);if(i.length===0)return!1;let t=p(e.symbol);if(!t)return!1;let r=i.slice(Math.max(0,e.startLine-2),e.startLine+1).join(`
1
+ import{a as S}from"./chunk-J5XJWCB3.js";import{a as y}from"./chunk-FBUNGRKI.js";import{a as x}from"./chunk-7TJJY2C3.js";import{a as h,g as b}from"./chunk-CAKPEQZB.js";import{a as P}from"./chunk-B75HZHUP.js";import{a as v}from"./chunk-BGBBVSH4.js";import{d as l,e as p,h as d}from"./chunk-AYRHVJXW.js";import{a as u,h as m,i as g}from"./chunk-GAE7WCBK.js";import{z as f}from"./chunk-FC5K7T35.js";import{basename as L,extname as D}from"path";function K(n,e){let{scope:i,maxLoc:t=15,limit:r=30,scanLimit:a}=e??{},s=new x(n);return y({candidates:()=>A(n,s,i,t),orderCandidates:P,scanLimit:a,profile:{name:"passthrough-candidates"},prepare:o=>s.calleeMap(o,{semantic:e?.semantic!==!1}),evaluate:(o,c)=>w(n,o,c.get(o.symbolId)??[]),orderResults:(o,c)=>o.loc-c.loc||o.file.localeCompare(c.file),limit:r})}function w(n,e,i){let t=j(i);if(t.size!==1||!m(n,e.relativePath,e.startLine,e.endLine))return null;let[,r]=[...t.entries()][0],a=I(n,e,r),s=T(n,e),o=a.length>0||s.length>0?"signal":"direct";return{symbol:e.symbol,shortName:l(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:v(e),forwardsTo:r.symbol,forwardsToShort:l(r.symbol),forwardsToFile:r.file,actionTier:o,boundaryEvidence:a,publicFacadeEvidence:s,recommendation:E(o,a,s)}}function I(n,e,i){return S(n,e.relativePath,e.startLine,"passthrough","explicit ignore-passthrough comment",[{label:"passthrough name",value:l(e.symbol)},{label:"callee name",value:l(i.symbol)},{label:"passthrough module",value:L(e.relativePath,D(e.relativePath))},{label:"callee module",value:L(i.file,D(i.file))}])}function E(n,e,i){if(n==="signal"){if(i.length>0)return`Review the public API before inlining; public-facade evidence: ${i.slice(0,2).join("; ")}.`;let t=e.filter(F);return t.length>0?`Review the public API before inlining; public-surface evidence: ${t.slice(0,2).join("; ")}.`:`Review the boundary before inlining; boundary evidence: ${e.slice(0,2).join("; ")}.`}return"Inline or remove this passthrough unless an external API or runtime registration depends on the forwarding name."}function T(n,e){return C(n,e)?h(n,e.relativePath)?["exported passthrough is declared on the package public surface"]:b(n,e.symbol,e.relativePath)?["exported passthrough matches configured or framework public entry surface"]:[]:[]}function C(n,e){let i=f(n,e.relativePath);if(i.length===0)return!1;let t=p(e.symbol);if(!t)return!1;let r=i.slice(Math.max(0,e.startLine-2),e.startLine+1).join(`
2
2
  `),a=u(t);return new RegExp(`^\\s*export\\s+(?:default\\s+)?(?:(?:async\\s+)?function\\s+${a}\\b|(?:const|let|var)\\s+${a}\\b)`,"m").test(r)?!0:R(i,t)}function R(n,e){if(!e)return!1;let i=new RegExp(`^\\s*export\\s*\\{[^}\\n]*\\b${u(e)}\\b`);return n.some(t=>i.test(t))}function F(n){return n.includes("public surface")}function j(n){let e=n.some(t=>d(t.symbol))?n.filter(t=>d(t.symbol)):n,i=new Map;for(let t of e)i.has(t.symbol)||i.set(t.symbol,t);return i}function A(n,e,i,t){return e.productionCallableDefinitions({scope:i,minLoc:3,maxLoc:t,requireFunctionLikeSymbol:!0,excludeRustTraitImplMembers:!0}).filter(r=>!g(n,r))}export{K as a,C as b};
3
- //# sourceMappingURL=chunk-OSBLECSI.js.map
3
+ //# sourceMappingURL=chunk-7SGOWD2Y.js.map
@@ -0,0 +1,2 @@
1
+ import{b as I,f as Y,g as _}from"./chunk-CAKPEQZB.js";import{a as M}from"./chunk-BGBBVSH4.js";import{b as X,e as Z,f as $,g as ee}from"./chunk-EMIIOOTM.js";import{a as z,f as J,g as Q,i as w,j as U,n as v}from"./chunk-DZXFZAZO.js";import{a as B}from"./chunk-AOSFSYEA.js";import{a as V,g as T,h as P,j as H,k as O,s as D,u as G,v as W,w as N}from"./chunk-AYRHVJXW.js";import{m as F}from"./chunk-GAE7WCBK.js";import{B as R,C as K,L as j}from"./chunk-WAU7HVDI.js";import{B as h,s as E,y as A}from"./chunk-FC5K7T35.js";import{a as q}from"./chunk-64MNV6AB.js";function ne(n,e,t){let r=e.identifierResolution==="strict"?w:U,l=e.candidateNames?J(e.candidateNames):null,o=0,f=0,m=0,p=0,y="";for(let a of e.paths)if(o+=1,y=a,!(!R(a)&&!(e.includeVueSfc&&K(a)))&&!n.isIgnored(a)&&!e.skipPath?.(a))try{if(l&&!Q(A(n,a),l))continue;f+=1;let S=(s,u,L,b)=>{if(e.candidateNames&&!e.candidateNames.has(s))return;m+=1;let g=e.resolveTargets?e.resolveTargets({sourceFile:a,name:s,kind:u,defaultTargets:b}):b();for(let k of g)p+=1,t({sourceFile:a,name:s,target:k,occurrences:L,kind:u})},C=z(n,a);for(let[s,u]of C)S(s,"identifier",u.length,()=>r(n,a,s));for(let s of F(n,a,{includeCrossLanguageDispatchNames:e.includeCrossLanguageDispatchNames,includeRustAttributeNames:e.includeRustAttributeNames})){let u=s.kind==="cross-language-dispatch"?()=>w(n,a,s.name):()=>r(n,a,s.name);S(s.name,s.kind,s.occurrences,u)}}finally{e.afterPath?.(a),o%10===0&&E("source-reference-scan.progress",()=>{},()=>({scannedPaths:o,currentPath:y,candidateMatchedPaths:f,visitedNames:m,visitedHits:p}))}}function te(n,e={}){let{scope:t,files:r,minLoc:l=1,maxLoc:o=Number.POSITIVE_INFINITY,excludeSymbol:f,excludeEntrySurfaces:m=!1,excludeTypesFiles:p=!1,excludeRootedSymbols:y=!1,requireFunctionLikeSymbol:a=!1,requireCallableSymbol:x=!1,excludeRustTraitImplMembers:S=!1,includeSuppressed:C=!1,sortByLocDesc:s=!1}=e,u=[],L=oe(n,{scope:t,files:r,requireFunctionLikeSymbol:a,requireCallableSymbol:x}),b=new Map,g=new Map,k=i=>{let c=b.get(i);if(c!==void 0)return c;let d=Y(n,i);return b.set(i,d),d},re=i=>{let c=g.get(i);if(c!==void 0)return c;let d=I(i);return g.set(i,d),d};for(let i of L){let c=i.relativePath;if(n.isIgnored(c)||m&&k(c)||!ae(i,{requireFunctionLikeSymbol:a,requireCallableSymbol:x})||f!==void 0&&i.symbol===f)continue;let d=M(i);d<l||d>o||p&&se(c)||y&&_(n,i.symbol,c)||S&&H(i.symbol)||re(c)!=="test"&&(O(i.symbol)||!C&&h(n,c,i.startLine)||u.push(i))}return s?u.sort((i,c)=>M(c)-M(i)):u}function oe(n,e){return e.files!==void 0?[...new Set(e.files.map(r=>r.replace(/\\/g,"/")))].sort().filter(r=>!e.scope||r.includes(e.scope)).flatMap(r=>D(n,r)):e.requireCallableSymbol?N(n,{scope:e.scope,symbolMatches:T,sqlPrefilter:"callable"}):e.requireFunctionLikeSymbol?N(n,{scope:e.scope,symbolMatches:P,sqlPrefilter:"function-like"}):W(n,e.scope)}function ae(n,e){return e.requireCallableSymbol?T(n.symbol):e.requireFunctionLikeSymbol?P(n.symbol):n.isFunctionLike}function se(n){return(n.split("/").pop()??"").includes("types")}var ie=class{constructor(e){this.db=e}db;scopedDefinitions(e){return G(this.db,e)}definitionsForFile(e){return D(this.db,e)}productionCallableDefinitions(e={}){return te(this.db,e)}calleeMap(e,t={}){return X(this.db,e,{...t,semanticEvidence:v})}crossFileCallerMap(e,t={}){return Z(this.db,e,{...t,semanticEvidence:v})}sourceFallbackCallerFiles(e,t={}){return $(this.db,e,t)}callerFileMap(e,t={}){return ee(this.db,e,{...t,semanticEvidence:v})}frameworkReferencedSymbolIds(e){let t=new Map;for(let l of e){if(!l.leaf)continue;let o=t.get(l.leaf)??[];o.push(l.symbolId),t.set(l.leaf,o)}let r=new Set;for(let l of q(this.db,{includeIgnored:!1}))if(R(l)==="rust")for(let{name:o}of F(this.db,l,{includeRustAttributeNames:!0}))for(let f of t.get(o)??[])r.add(f);return r}symbolsWithNonSelfCallees(e,t={}){if(e.length===0)return new Set;let r=new Map(e.map(o=>[o.symbolId,o.symbol])),l=this.calleeMap(e,t);return new Set([...l.entries()].filter(([o,f])=>{let m=r.get(o);return f.some(p=>p.symbol!==m)}).map(([o])=>o))}fileDependencyGraph(e){return B(this.db,e)}fileKind(e){return I(e)}hasSuppressionComment(e){return h(this.db,e.relativePath,e.startLine)}sourceFiles(){return j(this.db)}scanSourceReferences(e,t){ne(this.db,e,t)}callableSignature(e){let t=V(this.db).forFile(e.relativePath,{facts:!0}).facts?.callables.find(r=>r.startLine===e.startLine&&r.endLine===e.endLine);return t?{paramCount:t.paramCount}:null}};export{ie as a};
2
+ //# sourceMappingURL=chunk-7TJJY2C3.js.map
@@ -1,2 +1,2 @@
1
- import{a as C,b as B}from"./chunk-XKWEMFHP.js";import{a as R,c as P,e as a,f}from"./chunk-B3X6KU75.js";import{a as v,b as h,c as k}from"./chunk-KMVGRIO2.js";import{N as g}from"./chunk-TLTLJ4SW.js";function D(e,o={}){let{minSimilarity:r=.62,minTokens:n=8,limit:l=20,scope:m,scanLimit:d,filePattern:p,focusFiles:u}=o,c=g(e).reactProfiles({scope:m,minJsxTokens:n,scanLimit:d}).filter(t=>t.kind==="component").map(t=>({file:t.file,component:t.name,tokens:t.jsxTokens,profile:t})),s=C(c,t=>t.tokens);return B({profiles:c,limit:l,filePattern:p,focusFiles:u,candidateIndex:s,profile:{name:"react-component-duplicates"},compare:(t,i)=>y(t,i,r),sort:(t,i)=>i.similarity-t.similarity||t.fileA.localeCompare(i.fileA)||t.componentA.localeCompare(i.componentA)||t.fileB.localeCompare(i.fileB)||t.componentB.localeCompare(i.componentB)})}function y(e,o,r){let n=v(e.tokens,o.tokens);if(n.size<6||!T(n))return null;let l=k(e.tokens,o.tokens);if(l<r)return null;let m=a(n,"component:"),d=a(n,"native:"),p=a(n,"prop:"),u=a(n,"event:"),c=a(n,"binding:"),s=b({sharedComponents:m,sharedNativeTags:d,sharedProps:p,sharedEvents:u,sharedBindings:c});return{fileA:e.file,componentA:e.component,fileB:o.file,componentB:o.component,similarity:l,tokenCountA:e.tokens.size,tokenCountB:o.tokens.size,sharedTokens:f(n),sharedComponents:m,sharedNativeTags:d,sharedProps:p,sharedEvents:u,sharedBindings:c,evidenceClass:s.evidenceClass,actionTier:s.actionTier,evidenceClassReasons:s.reasons,recommendation:s.recommendation,uniqueToA:f(h(e.tokens,o.tokens)).slice(0,25),uniqueToB:f(h(o.tokens,e.tokens)).slice(0,25),locA:e.profile.loc,locB:o.profile.loc}}function T(e){let o=0,r=0;for(let n of e)n.startsWith("component:")&&(o+=1),(n.startsWith("prop:")||n.startsWith("event:")||n.startsWith("native:")||n.startsWith("jsx:"))&&(r+=1);return P([{name:"component",count:o},{name:"shape",count:r}],[{min:{component:1},reason:"shared custom component"},{min:{shape:4},reason:"shared JSX structure"}]).pass}function b(e){return R({genericWords:w,primitiveGroups:[{values:e.sharedNativeTags,reasonPrefix:"shared native tags",bucket:"generic"},{values:e.sharedProps,reasonPrefix:"shared props",bucket:"generic"},{values:e.sharedEvents,reasonPrefix:"shared events",bucket:"generic"}],nameGroups:[{names:e.sharedComponents,label:"shared component",fallbackBucket:"generic"},{names:e.sharedBindings,label:"shared binding",fallbackBucket:"generic"}],recommendation:A})}function A(e){switch(e){case"domain-behavior":case"mixed":return"Review for a shared component or feature-specific UI primitive around the named domain structure.";case"shared-abstraction":return"Review the existing shared component usage first; extract only if duplicated structure remains outside it.";case"generic-workflow-scaffolding":return"Generic structural overlap \u2014 verify intent before consolidating."}}var w=new Set(["actions","app","button","card","children","content","container","dialog","field","form","header","input","item","label","layout","list","modal","page","panel","row","section","shell","table","text","toolbar","ui","value","view","wrapper"]);export{D as a};
2
- //# sourceMappingURL=chunk-K3UVTL3J.js.map
1
+ import{a as C,b as B}from"./chunk-2WCXKANA.js";import{a as R,c as P,e as a,f}from"./chunk-B3X6KU75.js";import{a as v,b as h,c as k}from"./chunk-KMVGRIO2.js";import{N as g}from"./chunk-WAU7HVDI.js";function D(e,o={}){let{minSimilarity:r=.62,minTokens:n=8,limit:l=20,scope:m,scanLimit:d,filePattern:p,focusFiles:u}=o,c=g(e).reactProfiles({scope:m,minJsxTokens:n,scanLimit:d}).filter(t=>t.kind==="component").map(t=>({file:t.file,component:t.name,tokens:t.jsxTokens,profile:t})),s=C(c,t=>t.tokens);return B({profiles:c,limit:l,filePattern:p,focusFiles:u,candidateIndex:s,profile:{name:"react-component-duplicates"},compare:(t,i)=>y(t,i,r),sort:(t,i)=>i.similarity-t.similarity||t.fileA.localeCompare(i.fileA)||t.componentA.localeCompare(i.componentA)||t.fileB.localeCompare(i.fileB)||t.componentB.localeCompare(i.componentB)})}function y(e,o,r){let n=v(e.tokens,o.tokens);if(n.size<6||!T(n))return null;let l=k(e.tokens,o.tokens);if(l<r)return null;let m=a(n,"component:"),d=a(n,"native:"),p=a(n,"prop:"),u=a(n,"event:"),c=a(n,"binding:"),s=b({sharedComponents:m,sharedNativeTags:d,sharedProps:p,sharedEvents:u,sharedBindings:c});return{fileA:e.file,componentA:e.component,fileB:o.file,componentB:o.component,similarity:l,tokenCountA:e.tokens.size,tokenCountB:o.tokens.size,sharedTokens:f(n),sharedComponents:m,sharedNativeTags:d,sharedProps:p,sharedEvents:u,sharedBindings:c,evidenceClass:s.evidenceClass,actionTier:s.actionTier,evidenceClassReasons:s.reasons,recommendation:s.recommendation,uniqueToA:f(h(e.tokens,o.tokens)).slice(0,25),uniqueToB:f(h(o.tokens,e.tokens)).slice(0,25),locA:e.profile.loc,locB:o.profile.loc}}function T(e){let o=0,r=0;for(let n of e)n.startsWith("component:")&&(o+=1),(n.startsWith("prop:")||n.startsWith("event:")||n.startsWith("native:")||n.startsWith("jsx:"))&&(r+=1);return P([{name:"component",count:o},{name:"shape",count:r}],[{min:{component:1},reason:"shared custom component"},{min:{shape:4},reason:"shared JSX structure"}]).pass}function b(e){return R({genericWords:w,primitiveGroups:[{values:e.sharedNativeTags,reasonPrefix:"shared native tags",bucket:"generic"},{values:e.sharedProps,reasonPrefix:"shared props",bucket:"generic"},{values:e.sharedEvents,reasonPrefix:"shared events",bucket:"generic"}],nameGroups:[{names:e.sharedComponents,label:"shared component",fallbackBucket:"generic"},{names:e.sharedBindings,label:"shared binding",fallbackBucket:"generic"}],recommendation:A})}function A(e){switch(e){case"domain-behavior":case"mixed":return"Review for a shared component or feature-specific UI primitive around the named domain structure.";case"shared-abstraction":return"Review the existing shared component usage first; extract only if duplicated structure remains outside it.";case"generic-workflow-scaffolding":return"Generic structural overlap \u2014 verify intent before consolidating."}}var w=new Set(["actions","app","button","card","children","content","container","dialog","field","form","header","input","item","label","layout","list","modal","page","panel","row","section","shell","table","text","toolbar","ui","value","view","wrapper"]);export{D as a};
2
+ //# sourceMappingURL=chunk-AEM24WSF.js.map
@@ -1,2 +1,2 @@
1
- import{j as I}from"./chunk-PZV2PGBR.js";import{a as y,e as g}from"./chunk-7XP7ZRSI.js";import{B as v}from"./chunk-TLTLJ4SW.js";import{c as b,h as D,i as _,q as F,s as p,v as E,x}from"./chunk-M2TRDR25.js";import{spawnSync as O}from"child_process";import{createHash as U}from"crypto";import{existsSync as k}from"fs";import{dirname as L,join as T}from"path";import{fileURLToPath as j}from"url";var N=b("definition-consumer-file-usage",{clearGroups:["whole-project","source-file"]}),M=E({kind:"consumer-file-usage",invalidation:x("consumer-file-usage"),serialize:Q,deserialize:W});function Le(e,n){return{forDefinitions(r,i){return V(e,n,r,i)}}}function Me(e){let n=new Map;for(let[r,i]of e)n.set(r,new Set(i.files.map(t=>t.file)));return n}function Re(e,n,r){return w(e,n,r).partition}function V(e,n,r,i){let t=h(r.length),s=F()?_(e):null,a=s?B(r,i,s):void 0,o=a?{workIdentity:a,workOutcome:"computed"}:{};return p("consumer-evidence.product",()=>{let l=p("consumer-evidence.provenance",()=>z(e,n,r,i),()=>({...o,definitions:r.length,semantic:i.semantic,sourceFallback:i.sourceFallback!==!1})),u=new Map;t={...t,...l.counters};let c=Y(r,l.sources);return p("consumer-evidence.classify",()=>{let f=q(e,r,l.sources,c);for(let d of r){let m=f.get(d.symbolId)??H();t.realFiles+=m.partition.realConsumers.length,t.reexportOnlyFiles+=m.partition.barrelConsumers,t.importOnlyFiles+=m.partition.importOnlyConsumers,u.set(d.symbolId,{definition:d,files:m.files,...m.partition})}},()=>({...o,...c,realFiles:t.realFiles,reexportOnlyFiles:t.reexportOnlyFiles,importOnlyFiles:t.importOnlyFiles})),u},()=>({...o,...t}))}function B(e,n,r){let i=U("sha256").update("consumer-evidence-v1\0").update(r).update("\0").update(n.semantic?"semantic\0":"indexed\0").update(n.sourceFallback===!1?"no-source-fallback":"source-fallback");for(let t of e.map(s=>s.symbol).sort())i.update("\0").update(t);return i.digest("hex").slice(0,24)}function h(e){return{definitions:e,indexedFiles:0,semanticFiles:0,fallbackFiles:0,totalFiles:0,realFiles:0,reexportOnlyFiles:0,importOnlyFiles:0}}function z(e,n,r,i){let t=h(r.length),s=new Map;return S(s,t,"indexed",n.crossFileCallerMap(r,{semantic:!1})),i.semantic&&S(s,t,"semantic",I(e,r)),i.sourceFallback!==!1&&S(s,t,"source-fallback",n.sourceFallbackCallerFiles(r)),t.totalFiles=[...s.values()].reduce((a,o)=>a+o.size,0),{sources:s,counters:t}}function Y(e,n){return{definitions:e.length,consumerFiles:[...n.values()].reduce((r,i)=>r+i.size,0),nativeAttempted:!1,nativeUsed:!1,nativeReason:"not-attempted"}}function S(e,n,r,i){let t=0;for(let[s,a]of i){let o=e.get(s);o||(o=new Map,e.set(s,o));for(let l of a){t++;let u=o.get(l)??new Set;u.add(r),o.set(l,u)}}r==="indexed"?n.indexedFiles+=t:r==="semantic"?n.semanticFiles+=t:n.fallbackFiles+=t}function q(e,n,r,i){let t=re(e,n,r,i);return t||$(e,n,r)}function $(e,n,r){let i=new Map;for(let t of n){let s=r.get(t.symbolId)??new Map;i.set(t.symbolId,w(e,t,[...s.keys()],s))}return i}function w(e,n,r,i=new Map){let t=[],s=0,a=0,o=g(n.symbol),l=[];for(let u of r){let c;X(e,u,n.relativePath,o)?(s++,c="reexport-only"):J(e,u,o)?(a++,c="import-only"):(t.push(u),c="real"),l.push({file:u,sources:[...i.get(u)??[]],classification:c})}return{partition:{realConsumers:t,barrelConsumers:s,importOnlyConsumers:a},files:l}}function H(){return{partition:{realConsumers:[],barrelConsumers:0,importOnlyConsumers:0},files:[]}}function J(e,n,r){if(!r)return!1;let i=v(n);if(!i)return!1;let t=N.get(e,n,()=>A(e,n,i));return t.importedLeaves.has(r)&&!t.usedLeaves.has(r)}function A(e,n,r){let i=y(e).forFile(n,{text:!0,ast:!0}),t=i.text;if(!t)return G();let s=D(e,n,t),a=M.read(e,n,s);if(a)return a;let o=K(i.ast,r);return M.write(e,n,s,o),o}function K(e,n){let r=new Set,i=new Set;if(!e)return{importedLeaves:r,usedLeaves:i};let t=n==="rust"?new Set(["use_declaration"]):n==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),s=(a,o)=>{let l=o||t.has(a.type);(a.type==="identifier"||a.type==="type_identifier"||a.type==="property_identifier"||a.type==="field_identifier")&&(l?r.add(a.text):i.add(a.text));for(let u of a.children)s(u,l)};return s(e.rootNode,!1),{importedLeaves:r,usedLeaves:i}}function G(){return{importedLeaves:new Set,usedLeaves:new Set}}function Q(e){return JSON.stringify({importedLeaves:[...e.importedLeaves],usedLeaves:[...e.usedLeaves]})}function W(e){try{let n=JSON.parse(e);return!Array.isArray(n.importedLeaves)||!Array.isArray(n.usedLeaves)?null:{importedLeaves:new Set(n.importedLeaves.filter(r=>typeof r=="string")),usedLeaves:new Set(n.usedLeaves.filter(r=>typeof r=="string"))}}catch{return null}}function X(e,n,r,i){if(!i)return!1;let t=y(e).forFile(n,{lines:!0,reexports:!0}),s=t.lines??[];if(s.length===0)return!1;let a=t.reexports??[];return P(s,a,i)}function P(e,n,r){if(e.length===0||n.length===0)return!1;let i=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),t=new RegExp(`\\b${i}\\b`),s=0;for(let a=0;a<e.length;a++){if(!t.test(e[a]??""))continue;if(s++,!n.find(l=>l.startLine<=a&&a<=l.endLine))return!1}return s>0}var Z="SCIP_QUERY_NATIVE_CONSUMER_CLASSIFY",ee="SCIP_QUERY_NATIVE_KERNELS_BIN",ne="SCIP_QUERY_NATIVE_CONSUMER_CLASSIFY_MIN_FILES",R=1e3,ie=5e3,te=64*1024*1024,C;function re(e,n,r,i){let t=process.env[Z]?.toLowerCase();if(t!=="1"&&t!=="true")return i.nativeReason=t==="0"||t==="false"?"disabled":"opt-in-required",null;if(i.consumerFiles<fe())return i.nativeReason="below-threshold",null;let s=me();if(!s)return i.nativeReason="binary-missing",null;i.nativeAttempted=!0;let a=se(e,n,r),o=O(s,["consumer-classify"],{input:JSON.stringify(a),encoding:"utf8",timeout:ie,maxBuffer:te});if(o.status!==0||o.error)return i.nativeReason=o.error?`spawn-error:${o.error.message}`:`exit-${o.status??"null"}`,null;try{let l=JSON.parse(o.stdout),u=ae(l,n);return u?(i.nativeUsed=!0,i.nativeReason="used",u):(i.nativeReason="invalid-response",null)}catch{return i.nativeReason="invalid-json",null}}function se(e,n,r){let i=new Map,t=[];for(let o of n){let l=g(o.symbol),c=[...(r.get(o.symbolId)??new Map).entries()].map(([f,d])=>{let m=i.get(f)??new Set;return l&&m.add(l),i.set(f,m),{file:f,sources:[...d]}});t.push({symbol_id:o.symbolId,leaf:l,consumer_files:c})}let s={},a={};for(let[o,l]of i){let u=v(o);if(u){let f=N.get(e,o,()=>A(e,o,u));s[o]={imported_leaves:[...f.importedLeaves],used_leaves:[...f.usedLeaves]}}let c=oe(e,o,l);c.length>0&&(a[o]=c)}return{definitions:t,file_usages:s,reexport_only_leaves:a}}function oe(e,n,r){if(r.size===0)return[];let i=y(e).forFile(n,{lines:!0,reexports:!0}),t=i.lines??[],s=i.reexports??[];return t.length===0||s.length===0?[]:[...r].filter(a=>P(t,s,a))}function ae(e,n){if(!Array.isArray(e.entries)||e.entries.length!==n.length)return null;let r=new Set(n.map(t=>t.symbolId)),i=new Map;for(let t of e.entries){let s=le(t);if(!s||!r.has(s.symbol_id))return null;i.set(s.symbol_id,{partition:{realConsumers:s.real_consumers,barrelConsumers:s.barrel_consumers,importOnlyConsumers:s.import_only_consumers},files:s.files})}for(let t of r)if(!i.has(t))return null;return i}function le(e){if(!e||typeof e!="object")return null;let n=e;if(typeof n.symbol_id!="number"||!Array.isArray(n.real_consumers)||typeof n.barrel_consumers!="number"||typeof n.import_only_consumers!="number"||!Array.isArray(n.files)||!n.real_consumers.every(i=>typeof i=="string"))return null;let r=[];for(let i of n.files){if(!i||typeof i!="object")return null;let t=i;if(typeof t.file!="string"||!Array.isArray(t.sources)||!t.sources.every(ue)||!ce(t.classification))return null;r.push({file:t.file,sources:t.sources,classification:t.classification})}return{symbol_id:n.symbol_id,real_consumers:n.real_consumers,barrel_consumers:n.barrel_consumers,import_only_consumers:n.import_only_consumers,files:r}}function ue(e){return e==="indexed"||e==="semantic"||e==="source-fallback"}function ce(e){return e==="real"||e==="reexport-only"||e==="import-only"}function fe(){let e=process.env[ne];if(!e)return R;let n=Number(e);return Number.isFinite(n)&&n>=0?n:R}function me(){if(C!==void 0)return C;let e=process.env[ee],n=process.platform==="win32"?"scip-query-kernels.exe":"scip-query-kernels";return C=[...e?[e]:[],...de().map(i=>T(i,"target","release",n))].find(i=>k(i))??null,C}function de(){let e=new Set,n=L(j(import.meta.url));for(let r=0;r<5;r++)e.add(n),n=L(n);return[...e]}export{Le as a,Me as b,Re as c,J as d};
2
- //# sourceMappingURL=chunk-PV3GKBO5.js.map
1
+ import{j as I}from"./chunk-US44MEVU.js";import{a as y,e as g}from"./chunk-AYRHVJXW.js";import{B as v}from"./chunk-WAU7HVDI.js";import{c as b,h as D,i as _,q as F,s as p,v as E,x}from"./chunk-FC5K7T35.js";import{spawnSync as O}from"child_process";import{createHash as U}from"crypto";import{existsSync as k}from"fs";import{dirname as L,join as T}from"path";import{fileURLToPath as j}from"url";var N=b("definition-consumer-file-usage",{clearGroups:["whole-project","source-file"]}),M=E({kind:"consumer-file-usage",invalidation:x("consumer-file-usage"),serialize:Q,deserialize:W});function Le(e,n){return{forDefinitions(r,i){return V(e,n,r,i)}}}function Me(e){let n=new Map;for(let[r,i]of e)n.set(r,new Set(i.files.map(t=>t.file)));return n}function Re(e,n,r){return w(e,n,r).partition}function V(e,n,r,i){let t=h(r.length),s=F()?_(e):null,a=s?B(r,i,s):void 0,o=a?{workIdentity:a,workOutcome:"computed"}:{};return p("consumer-evidence.product",()=>{let l=p("consumer-evidence.provenance",()=>z(e,n,r,i),()=>({...o,definitions:r.length,semantic:i.semantic,sourceFallback:i.sourceFallback!==!1})),u=new Map;t={...t,...l.counters};let c=Y(r,l.sources);return p("consumer-evidence.classify",()=>{let f=q(e,r,l.sources,c);for(let d of r){let m=f.get(d.symbolId)??H();t.realFiles+=m.partition.realConsumers.length,t.reexportOnlyFiles+=m.partition.barrelConsumers,t.importOnlyFiles+=m.partition.importOnlyConsumers,u.set(d.symbolId,{definition:d,files:m.files,...m.partition})}},()=>({...o,...c,realFiles:t.realFiles,reexportOnlyFiles:t.reexportOnlyFiles,importOnlyFiles:t.importOnlyFiles})),u},()=>({...o,...t}))}function B(e,n,r){let i=U("sha256").update("consumer-evidence-v1\0").update(r).update("\0").update(n.semantic?"semantic\0":"indexed\0").update(n.sourceFallback===!1?"no-source-fallback":"source-fallback");for(let t of e.map(s=>s.symbol).sort())i.update("\0").update(t);return i.digest("hex").slice(0,24)}function h(e){return{definitions:e,indexedFiles:0,semanticFiles:0,fallbackFiles:0,totalFiles:0,realFiles:0,reexportOnlyFiles:0,importOnlyFiles:0}}function z(e,n,r,i){let t=h(r.length),s=new Map;return S(s,t,"indexed",n.crossFileCallerMap(r,{semantic:!1})),i.semantic&&S(s,t,"semantic",I(e,r)),i.sourceFallback!==!1&&S(s,t,"source-fallback",n.sourceFallbackCallerFiles(r)),t.totalFiles=[...s.values()].reduce((a,o)=>a+o.size,0),{sources:s,counters:t}}function Y(e,n){return{definitions:e.length,consumerFiles:[...n.values()].reduce((r,i)=>r+i.size,0),nativeAttempted:!1,nativeUsed:!1,nativeReason:"not-attempted"}}function S(e,n,r,i){let t=0;for(let[s,a]of i){let o=e.get(s);o||(o=new Map,e.set(s,o));for(let l of a){t++;let u=o.get(l)??new Set;u.add(r),o.set(l,u)}}r==="indexed"?n.indexedFiles+=t:r==="semantic"?n.semanticFiles+=t:n.fallbackFiles+=t}function q(e,n,r,i){let t=re(e,n,r,i);return t||$(e,n,r)}function $(e,n,r){let i=new Map;for(let t of n){let s=r.get(t.symbolId)??new Map;i.set(t.symbolId,w(e,t,[...s.keys()],s))}return i}function w(e,n,r,i=new Map){let t=[],s=0,a=0,o=g(n.symbol),l=[];for(let u of r){let c;X(e,u,n.relativePath,o)?(s++,c="reexport-only"):J(e,u,o)?(a++,c="import-only"):(t.push(u),c="real"),l.push({file:u,sources:[...i.get(u)??[]],classification:c})}return{partition:{realConsumers:t,barrelConsumers:s,importOnlyConsumers:a},files:l}}function H(){return{partition:{realConsumers:[],barrelConsumers:0,importOnlyConsumers:0},files:[]}}function J(e,n,r){if(!r)return!1;let i=v(n);if(!i)return!1;let t=N.get(e,n,()=>A(e,n,i));return t.importedLeaves.has(r)&&!t.usedLeaves.has(r)}function A(e,n,r){let i=y(e).forFile(n,{text:!0,ast:!0}),t=i.text;if(!t)return G();let s=D(e,n,t),a=M.read(e,n,s);if(a)return a;let o=K(i.ast,r);return M.write(e,n,s,o),o}function K(e,n){let r=new Set,i=new Set;if(!e)return{importedLeaves:r,usedLeaves:i};let t=n==="rust"?new Set(["use_declaration"]):n==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),s=(a,o)=>{let l=o||t.has(a.type);(a.type==="identifier"||a.type==="type_identifier"||a.type==="property_identifier"||a.type==="field_identifier")&&(l?r.add(a.text):i.add(a.text));for(let u of a.children)s(u,l)};return s(e.rootNode,!1),{importedLeaves:r,usedLeaves:i}}function G(){return{importedLeaves:new Set,usedLeaves:new Set}}function Q(e){return JSON.stringify({importedLeaves:[...e.importedLeaves],usedLeaves:[...e.usedLeaves]})}function W(e){try{let n=JSON.parse(e);return!Array.isArray(n.importedLeaves)||!Array.isArray(n.usedLeaves)?null:{importedLeaves:new Set(n.importedLeaves.filter(r=>typeof r=="string")),usedLeaves:new Set(n.usedLeaves.filter(r=>typeof r=="string"))}}catch{return null}}function X(e,n,r,i){if(!i)return!1;let t=y(e).forFile(n,{lines:!0,reexports:!0}),s=t.lines??[];if(s.length===0)return!1;let a=t.reexports??[];return P(s,a,i)}function P(e,n,r){if(e.length===0||n.length===0)return!1;let i=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),t=new RegExp(`\\b${i}\\b`),s=0;for(let a=0;a<e.length;a++){if(!t.test(e[a]??""))continue;if(s++,!n.find(l=>l.startLine<=a&&a<=l.endLine))return!1}return s>0}var Z="SCIP_QUERY_NATIVE_CONSUMER_CLASSIFY",ee="SCIP_QUERY_NATIVE_KERNELS_BIN",ne="SCIP_QUERY_NATIVE_CONSUMER_CLASSIFY_MIN_FILES",R=1e3,ie=5e3,te=64*1024*1024,C;function re(e,n,r,i){let t=process.env[Z]?.toLowerCase();if(t!=="1"&&t!=="true")return i.nativeReason=t==="0"||t==="false"?"disabled":"opt-in-required",null;if(i.consumerFiles<fe())return i.nativeReason="below-threshold",null;let s=me();if(!s)return i.nativeReason="binary-missing",null;i.nativeAttempted=!0;let a=se(e,n,r),o=O(s,["consumer-classify"],{input:JSON.stringify(a),encoding:"utf8",timeout:ie,maxBuffer:te});if(o.status!==0||o.error)return i.nativeReason=o.error?`spawn-error:${o.error.message}`:`exit-${o.status??"null"}`,null;try{let l=JSON.parse(o.stdout),u=ae(l,n);return u?(i.nativeUsed=!0,i.nativeReason="used",u):(i.nativeReason="invalid-response",null)}catch{return i.nativeReason="invalid-json",null}}function se(e,n,r){let i=new Map,t=[];for(let o of n){let l=g(o.symbol),c=[...(r.get(o.symbolId)??new Map).entries()].map(([f,d])=>{let m=i.get(f)??new Set;return l&&m.add(l),i.set(f,m),{file:f,sources:[...d]}});t.push({symbol_id:o.symbolId,leaf:l,consumer_files:c})}let s={},a={};for(let[o,l]of i){let u=v(o);if(u){let f=N.get(e,o,()=>A(e,o,u));s[o]={imported_leaves:[...f.importedLeaves],used_leaves:[...f.usedLeaves]}}let c=oe(e,o,l);c.length>0&&(a[o]=c)}return{definitions:t,file_usages:s,reexport_only_leaves:a}}function oe(e,n,r){if(r.size===0)return[];let i=y(e).forFile(n,{lines:!0,reexports:!0}),t=i.lines??[],s=i.reexports??[];return t.length===0||s.length===0?[]:[...r].filter(a=>P(t,s,a))}function ae(e,n){if(!Array.isArray(e.entries)||e.entries.length!==n.length)return null;let r=new Set(n.map(t=>t.symbolId)),i=new Map;for(let t of e.entries){let s=le(t);if(!s||!r.has(s.symbol_id))return null;i.set(s.symbol_id,{partition:{realConsumers:s.real_consumers,barrelConsumers:s.barrel_consumers,importOnlyConsumers:s.import_only_consumers},files:s.files})}for(let t of r)if(!i.has(t))return null;return i}function le(e){if(!e||typeof e!="object")return null;let n=e;if(typeof n.symbol_id!="number"||!Array.isArray(n.real_consumers)||typeof n.barrel_consumers!="number"||typeof n.import_only_consumers!="number"||!Array.isArray(n.files)||!n.real_consumers.every(i=>typeof i=="string"))return null;let r=[];for(let i of n.files){if(!i||typeof i!="object")return null;let t=i;if(typeof t.file!="string"||!Array.isArray(t.sources)||!t.sources.every(ue)||!ce(t.classification))return null;r.push({file:t.file,sources:t.sources,classification:t.classification})}return{symbol_id:n.symbol_id,real_consumers:n.real_consumers,barrel_consumers:n.barrel_consumers,import_only_consumers:n.import_only_consumers,files:r}}function ue(e){return e==="indexed"||e==="semantic"||e==="source-fallback"}function ce(e){return e==="real"||e==="reexport-only"||e==="import-only"}function fe(){let e=process.env[ne];if(!e)return R;let n=Number(e);return Number.isFinite(n)&&n>=0?n:R}function me(){if(C!==void 0)return C;let e=process.env[ee],n=process.platform==="win32"?"scip-query-kernels.exe":"scip-query-kernels";return C=[...e?[e]:[],...de().map(i=>T(i,"target","release",n))].find(i=>k(i))??null,C}function de(){let e=new Set,n=L(j(import.meta.url));for(let r=0;r<5;r++)e.add(n),n=L(n);return[...e]}export{Le as a,Me as b,Re as c,J as d};
2
+ //# sourceMappingURL=chunk-AGTATREV.js.map
@@ -0,0 +1,20 @@
1
+ import{o as O,p as A}from"./chunk-GAE7WCBK.js";import{c as F,g as S,i as _,s as y,w as C,x as N}from"./chunk-FC5K7T35.js";import{a as P}from"./chunk-64MNV6AB.js";var G=C({kind:"file-dependency-graph",invalidation:N("file-dependency-graph"),serialize:e=>JSON.stringify(e),deserialize:k}),I=F("file-dep-graph",{clearGroups:["whole-project"]});function W(e,n,t={}){let s=t.scipEdges??"all-references",i=t.sourceEdges??"imports-only",o=v(n,s,i);return I.get(e,o,()=>{let d=new Set(P(e,{includeIgnored:!1})),c=_(e),p=0,l=0,m=null,E=!1,a=0,h=0;return y("file-dep-graph.product",()=>{if(c){let r=G.read(e,o,c);if(r){E=!0;let f=R(r);return p=r.sourceFileCount,l=r.sourceEdgeCount,a=r.scipEdgeCount,h=f.size,m=r.sourceDependencyFingerprint,f}}let g=y("file-dep-graph.source-imports",()=>{let r=M(e,d,n,i);return p=r.files.length,l=r.edges.length,m=r.fingerprint,r},()=>({scope:n??null,sourceEdges:i,files:p,edges:l})),u=new Map,D=(r,f)=>j(e,u,d,r,f);y("file-dep-graph.scip-edges",()=>{for(let r of $(e,n,s))a+=1,D(r.from_file,r.to_file)},()=>({scope:n??null,edges:a}));for(let r of g.edges)D(r.fromFile,r.toFile);return h=u.size,c&&G.write(e,o,c,{sourceDependencyFingerprint:g.fingerprint,sourceFileCount:g.files.length,sourceEdgeCount:g.edges.length,scipEdgeCount:a,graph:w(u)}),u},()=>({scope:n??null,available:c!==null,hit:E,files:p,sourceEdges:l,sourceEdgeMode:i,scipEdges:a,graphFiles:h,sourceDependencyFingerprint:m}))})}function M(e,n,t,s){let i=[],o=[];for(let d of n)if(!(t&&!d.includes(t))){i.push(d);for(let c of A(e,d))c.sourcePath&&o.push({fromFile:d,toFile:c.sourcePath});if(s==="imports-and-reexports")for(let c of O(e,d))c.sourcePath&&o.push({fromFile:d,toFile:c.sourcePath})}return{files:i,edges:o,fingerprint:b(i,o)}}function b(e,n){let t=n.map(s=>`${s.fromFile}\0${s.toFile}`).sort();return S(JSON.stringify({files:e,edges:t}))}function v(e,n,t){return`edge-mode-v3:${n}:${t}:${e??"<all>"}`}function w(e){return[...e].map(([n,t])=>[n,[...t]])}function R(e){return new Map(e.graph.map(([n,t])=>[n,new Set(t)]))}function k(e){let n=JSON.parse(e);return x(n)?n:null}function x(e){if(!e||typeof e!="object")return!1;let n=e;return typeof n.sourceDependencyFingerprint=="string"&&typeof n.sourceFileCount=="number"&&typeof n.sourceEdgeCount=="number"&&typeof n.scipEdgeCount=="number"&&Array.isArray(n.graph)&&n.graph.every(J)}function J(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&Array.isArray(e[1])&&e[1].every(n=>typeof n=="string")}function $(e,n,t){let s=n?"AND d1.relative_path LIKE ?":"",i=n?[`%${n}%`]:[],o=t==="imports-only"?"AND m.role = 2":"AND m.role != 1";return e.all(`SELECT DISTINCT
2
+ d1.relative_path AS from_file,
3
+ d2.relative_path AS to_file
4
+ FROM mentions m
5
+ JOIN chunks c ON m.chunk_id = c.id
6
+ JOIN documents d1 ON c.document_id = d1.id
7
+ JOIN global_symbols gs ON m.symbol_id = gs.id
8
+ JOIN (
9
+ SELECT m2.symbol_id, c2.document_id
10
+ FROM mentions m2
11
+ JOIN chunks c2 ON m2.chunk_id = c2.id
12
+ WHERE m2.role = 1
13
+ GROUP BY m2.symbol_id
14
+ ) sym_def ON sym_def.symbol_id = gs.id
15
+ JOIN documents d2 ON sym_def.document_id = d2.id
16
+ WHERE d1.id != d2.id
17
+ ${o}
18
+ ${e.pathExclusionsFor("d1","d2")}
19
+ ${s}`,...i)}function j(e,n,t,s,i){if(s===i||e.isIgnored(s)||e.isIgnored(i)||!t.has(i))return;let o=n.get(s);o||(o=new Set,n.set(s,o)),o.add(i)}export{W as a};
20
+ //# sourceMappingURL=chunk-AOSFSYEA.js.map
@@ -1,4 +1,4 @@
1
- import{a as b,b as y,c as m}from"./chunk-MTDBHTSF.js";import{b as f,d as g,f as d,t as p}from"./chunk-7XP7ZRSI.js";import{a as c}from"./chunk-64MNV6AB.js";import{SymbolInformation_Kind as o}from"@c4312/scip";var _=500;function K(n){let s=parseInt(n,10);if(!isNaN(s))return s;let t=n.toLowerCase(),e=y.get(t);if(e!==void 0)return e;for(let[i,l]of b)if(l.toLowerCase().includes(t))return i;return null}function v(n,s,t={}){let{scope:e,limit:i=100}=t,l=K(s);return l===null?[]:h(n,e).map(r=>({row:r,resolvedKind:k(r)})).filter(r=>r.resolvedKind===l).slice(0,i).map(({row:r,resolvedKind:a})=>({symbol:r.symbol,shortName:g(r.symbol),kind:a,kindName:m(a),relativePath:r.relative_path,startLine:r.start_line,endLine:r.end_line}))}function T(n,s={}){let t=I(n,s.scope);for(let e of S(n,s.scope)){let i=k(e);i===null||i===0||t.set(i,(t.get(i)??0)+1)}return[...t.entries()].sort((e,i)=>i[1]-e[1]||e[0]-i[0]).map(([e,i])=>({kind:e,kindName:m(e),count:i}))}function h(n,s){return p(n,{scope:s}).map(R)}function I(n,s){let t=new Map;for(let e of N(c(n,{scope:s,includeIgnored:!1}))){let i=e.map(()=>"?").join(", "),l=n.all(`SELECT gs.kind AS kind, COUNT(*) AS count
1
+ import{a as b,b as y,c as m}from"./chunk-MTDBHTSF.js";import{b as f,d as g,f as d,t as p}from"./chunk-AYRHVJXW.js";import{a as c}from"./chunk-64MNV6AB.js";import{SymbolInformation_Kind as o}from"@c4312/scip";var _=500;function K(n){let s=parseInt(n,10);if(!isNaN(s))return s;let t=n.toLowerCase(),e=y.get(t);if(e!==void 0)return e;for(let[i,l]of b)if(l.toLowerCase().includes(t))return i;return null}function v(n,s,t={}){let{scope:e,limit:i=100}=t,l=K(s);return l===null?[]:h(n,e).map(r=>({row:r,resolvedKind:k(r)})).filter(r=>r.resolvedKind===l).slice(0,i).map(({row:r,resolvedKind:a})=>({symbol:r.symbol,shortName:g(r.symbol),kind:a,kindName:m(a),relativePath:r.relative_path,startLine:r.start_line,endLine:r.end_line}))}function T(n,s={}){let t=I(n,s.scope);for(let e of S(n,s.scope)){let i=k(e);i===null||i===0||t.set(i,(t.get(i)??0)+1)}return[...t.entries()].sort((e,i)=>i[1]-e[1]||e[0]-i[0]).map(([e,i])=>({kind:e,kindName:m(e),count:i}))}function h(n,s){return p(n,{scope:s}).map(R)}function I(n,s){let t=new Map;for(let e of N(c(n,{scope:s,includeIgnored:!1}))){let i=e.map(()=>"?").join(", "),l=n.all(`SELECT gs.kind AS kind, COUNT(*) AS count
2
2
  FROM defn_enclosing_ranges der
3
3
  JOIN global_symbols gs ON der.symbol_id = gs.id
4
4
  JOIN documents d ON der.document_id = d.id
@@ -20,4 +20,4 @@ import{a as b,b as y,c as m}from"./chunk-MTDBHTSF.js";import{b as f,d as g,f as
20
20
  ${n.symbolNoiseFor("gs")}
21
21
  AND d.relative_path IN (${i})
22
22
  ORDER BY d.relative_path, der.start_line, der.end_line, gs.symbol`,...e))}return t}function N(n){let s=[];for(let t=0;t<n.length;t+=_)s.push(n.slice(t,t+_));return s}function R(n){return{symbol:n.symbol,kind:n.kind,documentation:n.documentation,enclosing_symbol:n.enclosingSymbol,relative_path:n.relativePath,start_line:n.startLine,end_line:n.endLine}}function k(n){return n.kind!==null&&n.kind!==0?D(n.kind,n.symbol,n.documentation):C(n.symbol,n.documentation,n.enclosing_symbol)}function D(n,s,t){let e=(t??"").toLowerCase();if(d(s)==="type"){if(e.includes("type "))return o.TypeAlias;if(e.includes("interface "))return o.Interface;if(e.includes("struct "))return o.Struct;if(e.includes("trait "))return o.Trait;if(e.includes("class "))return o.Class}return n}function C(n,s,t){let e=f(n);if("kind"in e)return null;let i=e.descriptors,l=i[i.length-2]??null,u=d(n),r=(s??"").toLowerCase();return u==="type"?r.includes("type ")?o.TypeAlias:r.includes("interface ")?o.Interface:r.includes("struct ")?o.Struct:r.includes("trait ")?o.Trait:r.includes("class ")?o.Class:o.Class:u==="method"?l?.suffix==="type"?o.Method:o.Function:u==="namespace"?o.Module:u!=="term"?null:r.includes("async def ")||r.includes("def ")?o.Function:(t?d(t):l?.suffix??null)==="type"?o.Field:o.Variable}export{v as a,T as b};
23
- //# sourceMappingURL=chunk-VCRMI56V.js.map
23
+ //# sourceMappingURL=chunk-APLNTJPJ.js.map
@@ -1,4 +1,4 @@
1
- import{a as _,g as O,j as C,o as $,p as T}from"./chunk-JLZUM476.js";import{E as N}from"./chunk-TLTLJ4SW.js";import{a as h}from"./chunk-64MNV6AB.js";import{c as y,h as S,i as x,o as D,v as R,x as E,y as k,z as M}from"./chunk-M2TRDR25.js";var V={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function u(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let n=e.split(" ");if(n.length<4)return{scheme:n[0]??"",manager:n[1]??"",packageName:n[2]??"",version:"",descriptors:[],raw:e};let t=n[0],i=n[1],r=e.slice(t.length+1+i.length+1),s;if(r.startsWith("`")){let l=r.indexOf("`",1);l===-1?(s=r.slice(1),r=""):(s=r.slice(1,l),r=r.slice(l+2))}else{let l=r.indexOf(" ");l===-1?(s=r,r=""):(s=r.slice(0,l),r=r.slice(l+1))}let o,a=r.indexOf(" ");a===-1?(o=r,r=""):(o=r.slice(0,a),r=r.slice(a+1));let c=ee(r);return{scheme:t,manager:i,packageName:s,version:o,descriptors:c,raw:e}}function f(e){let n=u(e);if("kind"in n)return null;for(let t=n.descriptors.length-2;t>=0;t--){let i=n.descriptors[t];if(i?.suffix==="type")return i.name}return null}function ee(e){let n=[],t=0;for(;t<e.length;){if(e[t]==="["){let s=e.indexOf("]",t+1);if(s===-1){n.push({name:e.slice(t+1),suffix:"type-param"});break}n.push({name:e.slice(t+1,s),suffix:"type-param"}),t=s+1;continue}if(e[t]==="("&&(n.length===0||t===0||w(e[t-1]))){let s=e.indexOf(")",t+1);if(s!==-1&&e[s+1]!=="."){n.push({name:e.slice(t+1,s),suffix:"parameter"}),t=s+1;continue}}let i;if(e[t]==="`"){let s=e.indexOf("`",t+1);if(s===-1){i=e.slice(t+1),n.push({name:i,suffix:"term"});break}i=e.slice(t+1,s),t=s+1}else{let s=t;for(;t<e.length&&!w(e[t]);)t++;i=e.slice(s,t)}if(t>=e.length){i&&n.push({name:i,suffix:"term"});break}let r=e[t];if(r==="("){let s=e.indexOf(")",t+1);s!==-1&&e[s+1]==="."?(n.push({name:i,suffix:"method"}),t=s+2):s!==-1?(n.push({name:i,suffix:"method"}),t=s+1):(n.push({name:i,suffix:"term"}),t++)}else{let s=V[r];s&&n.push({name:i,suffix:s}),t+=1}}return n}function w(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function A(e){let n=u(e);if("kind"in n&&n.kind==="local")return`local:${n.id}`;let t=n;if(t.descriptors.length===0)return t.raw;let i=[];for(let r of t.descriptors){let s=ne(r);s&&i.push(s)}return i.join(":")}function ne(e){let n=e.suffix==="namespace"?te(e.name):e.name;return n?e.suffix==="method"?`${n}()`:n:""}function te(e){return e.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/,"").replace(/\.(py|pyi)$/,"").replace(/\.(rs)$/,"").replace(/\.(java|scala|kt|kts)$/,"").replace(/\.(rb)$/,"").replace(/\.(go)$/,"").replace(/\.(cs|vb)$/,"").replace(/\.(dart)$/,"").replace(/\.(php)$/,"").replace(/\.(c|cc|cpp|cxx|h|hpp)$/,"")}function v(e){let n=u(e);if("kind"in n&&n.kind==="local")return n.id;let t=n;return t.descriptors.length===0?"":t.descriptors[t.descriptors.length-1].name}function p(e){let n=u(e);if("kind"in n&&n.kind==="local")return null;let t=n;return t.descriptors[t.descriptors.length-1]?.suffix??null}function Ae(e){return e.endsWith("().")||p(e)==="method"}function P(e){let n=p(e);return n==="method"?!0:n!=="term"?!1:e.endsWith("().")?!0:e.startsWith("rust-analyzer ")&&e.includes("#")?!1:e.startsWith("scip-typescript ")?!/#[A-Za-z0-9_$]+\.$/.test(e):!0}function ve(e){return p(e)==="namespace"}var ie=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function Pe(e){return ie.test(e)}var re=new Set(["test","tests","_tests"]);function Qe(e){let n=u(e);if("kind"in n)return!1;for(let t=0;t<n.descriptors.length-1;t+=1){let i=n.descriptors[t];if(i?.suffix==="namespace"&&i.name&&re.has(i.name))return!0}return!1}function je(e,n){let t=u(e),i=u(n);if("kind"in t||"kind"in i)return!1;let r=t.descriptors,s=i.descriptors;if(s.length!==r.length+1)return!1;for(let o=0;o<r.length;o++){let a=r[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function Be(e,n){let t=u(e),i=u(n);if("kind"in t||"kind"in i)return!1;let r=t.descriptors,s=i.descriptors;if(s.length<=r.length)return!1;for(let o=0;o<r.length;o++){let a=r[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function Je(e,n){return e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.start_char, der.end_line, der.end_char, d.relative_path, gs.display_name, gs.documentation
1
+ import{a as _,g as O,j as C,o as $,p as T}from"./chunk-GAE7WCBK.js";import{E as N}from"./chunk-WAU7HVDI.js";import{c as y,h as S,i as x,o as D,v as R,x as E,y as k,z as M}from"./chunk-FC5K7T35.js";import{a as h}from"./chunk-64MNV6AB.js";var V={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function u(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let n=e.split(" ");if(n.length<4)return{scheme:n[0]??"",manager:n[1]??"",packageName:n[2]??"",version:"",descriptors:[],raw:e};let t=n[0],i=n[1],r=e.slice(t.length+1+i.length+1),s;if(r.startsWith("`")){let l=r.indexOf("`",1);l===-1?(s=r.slice(1),r=""):(s=r.slice(1,l),r=r.slice(l+2))}else{let l=r.indexOf(" ");l===-1?(s=r,r=""):(s=r.slice(0,l),r=r.slice(l+1))}let o,a=r.indexOf(" ");a===-1?(o=r,r=""):(o=r.slice(0,a),r=r.slice(a+1));let c=ee(r);return{scheme:t,manager:i,packageName:s,version:o,descriptors:c,raw:e}}function f(e){let n=u(e);if("kind"in n)return null;for(let t=n.descriptors.length-2;t>=0;t--){let i=n.descriptors[t];if(i?.suffix==="type")return i.name}return null}function ee(e){let n=[],t=0;for(;t<e.length;){if(e[t]==="["){let s=e.indexOf("]",t+1);if(s===-1){n.push({name:e.slice(t+1),suffix:"type-param"});break}n.push({name:e.slice(t+1,s),suffix:"type-param"}),t=s+1;continue}if(e[t]==="("&&(n.length===0||t===0||w(e[t-1]))){let s=e.indexOf(")",t+1);if(s!==-1&&e[s+1]!=="."){n.push({name:e.slice(t+1,s),suffix:"parameter"}),t=s+1;continue}}let i;if(e[t]==="`"){let s=e.indexOf("`",t+1);if(s===-1){i=e.slice(t+1),n.push({name:i,suffix:"term"});break}i=e.slice(t+1,s),t=s+1}else{let s=t;for(;t<e.length&&!w(e[t]);)t++;i=e.slice(s,t)}if(t>=e.length){i&&n.push({name:i,suffix:"term"});break}let r=e[t];if(r==="("){let s=e.indexOf(")",t+1);s!==-1&&e[s+1]==="."?(n.push({name:i,suffix:"method"}),t=s+2):s!==-1?(n.push({name:i,suffix:"method"}),t=s+1):(n.push({name:i,suffix:"term"}),t++)}else{let s=V[r];s&&n.push({name:i,suffix:s}),t+=1}}return n}function w(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function A(e){let n=u(e);if("kind"in n&&n.kind==="local")return`local:${n.id}`;let t=n;if(t.descriptors.length===0)return t.raw;let i=[];for(let r of t.descriptors){let s=ne(r);s&&i.push(s)}return i.join(":")}function ne(e){let n=e.suffix==="namespace"?te(e.name):e.name;return n?e.suffix==="method"?`${n}()`:n:""}function te(e){return e.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/,"").replace(/\.(py|pyi)$/,"").replace(/\.(rs)$/,"").replace(/\.(java|scala|kt|kts)$/,"").replace(/\.(rb)$/,"").replace(/\.(go)$/,"").replace(/\.(cs|vb)$/,"").replace(/\.(dart)$/,"").replace(/\.(php)$/,"").replace(/\.(c|cc|cpp|cxx|h|hpp)$/,"")}function v(e){let n=u(e);if("kind"in n&&n.kind==="local")return n.id;let t=n;return t.descriptors.length===0?"":t.descriptors[t.descriptors.length-1].name}function p(e){let n=u(e);if("kind"in n&&n.kind==="local")return null;let t=n;return t.descriptors[t.descriptors.length-1]?.suffix??null}function Ae(e){return e.endsWith("().")||p(e)==="method"}function P(e){let n=p(e);return n==="method"?!0:n!=="term"?!1:e.endsWith("().")?!0:e.startsWith("rust-analyzer ")&&e.includes("#")?!1:e.startsWith("scip-typescript ")?!/#[A-Za-z0-9_$]+\.$/.test(e):!0}function ve(e){return p(e)==="namespace"}var ie=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function Pe(e){return ie.test(e)}var re=new Set(["test","tests","_tests"]);function Qe(e){let n=u(e);if("kind"in n)return!1;for(let t=0;t<n.descriptors.length-1;t+=1){let i=n.descriptors[t];if(i?.suffix==="namespace"&&i.name&&re.has(i.name))return!0}return!1}function je(e,n){let t=u(e),i=u(n);if("kind"in t||"kind"in i)return!1;let r=t.descriptors,s=i.descriptors;if(s.length!==r.length+1)return!1;for(let o=0;o<r.length;o++){let a=r[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function Be(e,n){let t=u(e),i=u(n);if("kind"in t||"kind"in i)return!1;let r=t.descriptors,s=i.descriptors;if(s.length<=r.length)return!1;for(let o=0;o<r.length;o++){let a=r[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function Je(e,n){return e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.start_char, der.end_line, der.end_char, d.relative_path, gs.display_name, gs.documentation
2
2
  FROM global_symbols gs
3
3
  JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
4
4
  JOIN documents d ON der.document_id = d.id
@@ -109,4 +109,4 @@ import{a as _,g as O,j as C,o as $,p as T}from"./chunk-JLZUM476.js";import{E as
109
109
  ${e.symbolNoiseFor("gs")}
110
110
  GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
111
111
  ORDER BY d.relative_path, start_line, end_line`,...s)}function Se(e){return`(${e}.symbol LIKE '%().' OR ${e}.symbol LIKE '%()')`}function Z(e,n){return n==="callable"?Se(e):xe(e)}function xe(e){return`(${e}.symbol LIKE '%.' OR ${e}.symbol LIKE '%()')`}function U(e){let n=new Map;for(let t of e){let i=n.get(t.relative_path);i?i.push(t):n.set(t.relative_path,[t])}return n}function pn(e,n,t={}){if(n.length===0)return[];let i=n.flatMap(r=>F(e,r)).filter(r=>!e.isIgnored(r.relativePath));return t.onlyDocumented&&(i=i.filter(r=>r.documentation!==null&&r.documentation!=="")),t.sort&&(i=i.sort((r,s)=>r.relativePath.localeCompare(s.relativePath)||r.startLine-s.startLine||r.endLine-s.endLine)),i.map(r=>({startLine:r.startLine,endLine:r.endLine,symbol:r.symbol,shortName:A(r.symbol),signature:z(J(r.documentation)),relativePath:r.relativePath,enclosingSymbol:r.enclosingSymbol}))}function he(e){let n=new Map,t=e.map((i,r)=>({definition:i,index:r,span:i.endLine-i.startLine})).sort((i,r)=>i.span-r.span||i.index-r.index);for(let{definition:i}of t)for(let r=i.startLine;r<=i.endLine;r+=1)n.has(r)||n.set(r,i);return n}function gn(e,n){let t=H.get(e);return t||(t=he(e),H.set(e,t)),t.get(n)??null}function bn(e,n){let t=F(e,n.relative_path).find(i=>i.symbolId===n.id);return t?{symbolId:t.symbolId,symbol:t.symbol,documentId:t.documentId,startLine:t.startLine,startChar:t.startChar,endLine:t.endLine,endChar:t.endChar,relativePath:t.relativePath}:{symbolId:n.id,symbol:n.symbol,documentId:n.document_id,startLine:n.start_line,startChar:n.start_char??0,endLine:n.end_line,endChar:n.end_char??0,relativePath:n.relative_path}}function q(e,n,t){let i=g(e).forFile(n,{text:!0}).text,r=C(e,n);return r?Re(t,r,i):i?De(t,i):t}function De(e,n){let t=n.split(/\r?\n/),i=_e(e,t),r=Ie(e,i),s=Le(r,t);return Fe(e,s)}function _e(e,n){let t=e.some(r=>b(r.symbol))?$e(n):null,i=new Map;for(let r of e)i.set(r.symbolId,Ce(n,t,r));return i}function Ie(e,n){return e.filter(t=>b(t.symbol)).map(t=>({definition:t,startLine:n.get(t.symbolId)??t.startLine})).sort((t,i)=>t.startLine-i.startLine||t.definition.startLine-i.definition.startLine||t.definition.symbol.localeCompare(i.definition.symbol))}function Le(e,n){let t=new Map;for(let i=0;i<e.length;i+=1){let r=e[i],s=e[i+1],o=s?Math.max(r.startLine,s.startLine-1):n.length-1;t.set(r.definition.symbolId,{startLine:r.startLine,endLine:Te(n,r.definition,r.startLine,o)})}return t}function Fe(e,n){return e.map(t=>{let i=n.get(t.symbolId);return i?{...t,startLine:i.startLine,endLine:i.endLine}:t})}function Re(e,n,t=null){let i=new Map;for(let r of n){let s=i.get(r.name);s?s.push(r):i.set(r.name,[r])}return e.map(r=>{if(!Oe(r)||!r.leaf)return G(r,t);let s=i.get(r.leaf);if(!s||s.length===0)return G(r,t);let o=t?Ee(r,s,t):null;if(o)return{...r,startLine:o.startLine,endLine:o.endLine};let a=s[0],c=Math.abs(a.startLine-r.startLine);for(let l=1;l<s.length;l+=1){let d=s[l],m=Math.abs(d.startLine-r.startLine);m<c&&(a=d,c=m)}return{...r,startLine:a.startLine,endLine:a.endLine}})}function Ee(e,n,t){let i=ke(e.symbol);if(!i)return null;let r=t.split(/\r?\n/),s=new RegExp(`\\b${_(i)}\\b`);for(let o of n){let a=Me(r,o.startLine);if(a&&s.test(a))return o}return null}function ke(e){return e.match(/\/impl#\[([^\]]+)\]/)?.[1]??null}function Me(e,n){for(let t=n;t>=0;t-=1){let i=e[t]?.trim()??"";if(i){if(/^impl\b/.test(i))return Ne(e,t,n);if(/^(?:struct|enum|trait|mod)\b/.test(i))return null}}return null}function Ne(e,n,t){let i=[];for(let r=n;r<=t;r+=1){let s=e[r]??"";if(i.push(s),s.includes("{"))break}return i.join(" ")}function Oe(e){return b(e.symbol)?!0:p(e.symbol)==="term"&&f(e.symbol)===null}function G(e,n){if(!n||!e.leaf||p(e.symbol)!=="term"||f(e.symbol)!==null)return e;let t=_(e.leaf),i=new RegExp(`\\b(?:export\\s+)?(?:const|let|var)\\s+${t}\\b`),s=n.split(/\r?\n/).findIndex(o=>i.test(o));return s>=0?{...e,startLine:s,endLine:s}:e}function Ce(e,n,t){if(!b(t.symbol))return t.startLine;let i=Math.max(0,Math.min(t.startLine,e.length-1));if(!n)return i;let r=n.get(t.leaf);if(!r||r.length===0)return i;let s=null;for(let o of r){let a=Math.abs(o-t.startLine);(!s||a<s.distance)&&(s={line:o,distance:a})}return s?.line??i}function $e(e){let n=/\b(?:function|def|fn)\s+([A-Za-z_$][\w$]*)/g,t=/\b([A-Za-z_$][\w$]*)\s*[:=]\s*(?:async\s*)?(?:function\b|\()/g,i=/^\s*(?:(?:export|public|private|protected|static|readonly|async|abstract|get|set)\s+)*([A-Za-z_$][\w$]*)\s*(?:<[^(]*>)?\s*\(/,r=/\b([A-Za-z_$][\w$]*)\s*\(/g,s=new Map,o=(a,c)=>{let l=s.get(a);if(!l){s.set(a,[c]);return}l[l.length-1]!==c&&l.push(c)};for(let a=0;a<e.length;a+=1){let c=e[a]??"";for(let d of c.matchAll(n))d[1]&&o(d[1],a);for(let d of c.matchAll(t))d[1]&&o(d[1],a);let l=c.match(i);l?.[1]&&o(l[1],a);for(let d of c.matchAll(r))d[1]&&o(d[1],a)}return s}function Te(e,n,t,i){let r=Math.max(t,Math.min(e.length-1,i)),s=Math.max(t,Math.min(r,n.endLine)),o=0,a=0,c=!1;for(let l=t;l<=r;l+=1){let d=we(e[l]??"");for(let m of d)m==="{"?(o+=1,c=!0):m==="}"?o=Math.max(0,o-1):m==="("?a+=1:m===")"&&(a=Math.max(0,a-1));if(c&&o===0||!c&&a===0&&l>=s)return l}return s}function we(e){let n="",t=null,i=!1;for(let r=0;r<e.length;r+=1){let s=e[r],o=e[r+1];if(!t&&s==="/"&&o==="/"){n+=" ".repeat(e.length-r);break}if(t){if(i){i=!1,n+=" ";continue}if(s==="\\"){i=!0,n+=" ";continue}s===t&&(t=null),n+=" ";continue}if(s==='"'||s==="'"||s==="`"){t=s,n+=" ";continue}n+=s}return n}function b(e){return e.includes("().")}function yn(e){let n=u(e);if("kind"in n)return[];let t=[];for(let i=n.descriptors.length-2;i>=0;i-=1){let r=n.descriptors[i];r?.suffix==="type"&&r.name&&t.push(r.name)}return t}export{g as a,u as b,f as c,A as d,v as e,p as f,Ae as g,P as h,ve as i,Pe as j,Qe as k,je as l,Be as m,Je as n,We as o,z as p,J as q,I as r,F as s,un as t,ge as u,mn as v,fn as w,pn as x,he as y,gn as z,bn as A,yn as B};
112
- //# sourceMappingURL=chunk-7XP7ZRSI.js.map
112
+ //# sourceMappingURL=chunk-AYRHVJXW.js.map