scip-query 0.6.0 → 0.6.2

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 (163) hide show
  1. package/README.md +14 -7
  2. package/dist/{chunk-FCC3XJTI.js → chunk-26LSAIEP.js} +2 -2
  3. package/dist/{chunk-SG35Y7J2.js → chunk-2HEJQBMS.js} +2 -2
  4. package/dist/chunk-3FG3VLK3.js +65 -0
  5. package/dist/{chunk-DE5ZBHMK.js → chunk-3J463LOK.js} +2 -2
  6. package/dist/{chunk-XVDASCN7.js → chunk-3QJ2NOYG.js} +2 -2
  7. package/dist/{chunk-AJ5PWKD4.js → chunk-3T53QAUS.js} +2 -2
  8. package/dist/chunk-435YC4OF.js +2 -0
  9. package/dist/chunk-4LBOHXT7.js +6 -0
  10. package/dist/chunk-5IM4IQ6N.js +2 -0
  11. package/dist/{chunk-BDBRZPX3.js → chunk-5NRGSXZQ.js} +2 -2
  12. package/dist/chunk-5V76WMMZ.js +5 -0
  13. package/dist/{chunk-HMKJTAZD.js → chunk-5VU2RVKI.js} +2 -2
  14. package/dist/{chunk-NTDA4A2D.js → chunk-5W22HCSF.js} +2 -2
  15. package/dist/{chunk-IBGBI3VU.js → chunk-67UXTIFZ.js} +2 -2
  16. package/dist/{chunk-SDX6MDBL.js → chunk-6ALIV5SZ.js} +2 -2
  17. package/dist/{chunk-K5FQFCSN.js → chunk-6CTMG3IF.js} +2 -2
  18. package/dist/{chunk-BQ3INTYT.js → chunk-6XP3KWHC.js} +2 -2
  19. package/dist/chunk-7DKDFRXQ.js +7 -0
  20. package/dist/{chunk-LX4H4LLG.js → chunk-7NEBSLI3.js} +2 -2
  21. package/dist/chunk-AEMTUHQ7.js +2 -0
  22. package/dist/{chunk-Y7LOQSWY.js → chunk-AVLUWGXG.js} +2 -2
  23. package/dist/chunk-AZQ3ENHU.js +2 -0
  24. package/dist/{chunk-ZXKURFVB.js → chunk-AZTWY4OT.js} +2 -2
  25. package/dist/{chunk-BE6EQIWY.js → chunk-CHW7433E.js} +2 -2
  26. package/dist/chunk-CW5K3KIF.js +12 -0
  27. package/dist/{chunk-ZSRXMNMK.js → chunk-F6F2QUIH.js} +3 -3
  28. package/dist/{chunk-D7KLLMPB.js → chunk-FJV7QT4G.js} +2 -2
  29. package/dist/chunk-FPDWFGBQ.js +19 -0
  30. package/dist/chunk-G2SX5EHW.js +2 -0
  31. package/dist/{chunk-RWE6FHG3.js → chunk-GK6VXKLY.js} +2 -2
  32. package/dist/{chunk-STOGKRJH.js → chunk-HS5LX75F.js} +2 -2
  33. package/dist/{chunk-D7YBWSON.js → chunk-HS65NNKP.js} +2 -2
  34. package/dist/{chunk-DHYIJHXZ.js → chunk-LKCPNPHH.js} +2 -2
  35. package/dist/{chunk-JS2RNIC7.js → chunk-MQ5FKM2F.js} +2 -2
  36. package/dist/{chunk-WTSTDJZ7.js → chunk-NFOSOUH6.js} +2 -2
  37. package/dist/{chunk-4QJ7LVW5.js → chunk-NLWXQMKR.js} +2 -2
  38. package/dist/{chunk-YIPCV7M7.js → chunk-ORD3HEWI.js} +2 -2
  39. package/dist/{chunk-2RLP74AO.js → chunk-OU2D2T4A.js} +2 -2
  40. package/dist/{chunk-NXMYYHDO.js → chunk-P6IUCZA3.js} +2 -2
  41. package/dist/{chunk-2DSS2NGF.js → chunk-PU7P5NPE.js} +2 -2
  42. package/dist/chunk-QSTMORTI.js +2 -0
  43. package/dist/{chunk-QXE6EDY2.js → chunk-RC2PKZSS.js} +2 -2
  44. package/dist/chunk-S65VVU3R.js +2 -0
  45. package/dist/{chunk-IYFZS4PV.js → chunk-SPMLGXCE.js} +5 -5
  46. package/dist/{chunk-GXVB36TG.js → chunk-T26XHATT.js} +2 -2
  47. package/dist/chunk-TWYHFB5K.js +2 -0
  48. package/dist/{chunk-XAZTIDST.js → chunk-TXADWK4I.js} +2 -2
  49. package/dist/chunk-YRUHPGC3.js +7 -0
  50. package/dist/chunk-ZJM2HD2Z.js +2 -0
  51. package/dist/chunk-ZORIMKQO.js +2 -0
  52. package/dist/cli.js +218 -169
  53. package/dist/{db-BSTtBG_H.d.ts → db-DKhNQ75l.d.ts} +15 -1
  54. package/dist/index.d.ts +36 -3
  55. package/dist/index.js +60 -12
  56. package/dist/queries/affected.d.ts +1 -1
  57. package/dist/queries/affected.js +1 -1
  58. package/dist/queries/bottlenecks.d.ts +1 -1
  59. package/dist/queries/bottlenecks.js +1 -1
  60. package/dist/queries/by-kind.d.ts +1 -1
  61. package/dist/queries/by-kind.js +1 -1
  62. package/dist/queries/call-graph.d.ts +1 -1
  63. package/dist/queries/call-graph.js +1 -1
  64. package/dist/queries/change-surface.d.ts +1 -1
  65. package/dist/queries/change-surface.js +1 -1
  66. package/dist/queries/code.d.ts +1 -1
  67. package/dist/queries/code.js +1 -1
  68. package/dist/queries/complexity-hotspots.d.ts +1 -1
  69. package/dist/queries/complexity-hotspots.js +1 -1
  70. package/dist/queries/complexity.d.ts +1 -1
  71. package/dist/queries/complexity.js +1 -1
  72. package/dist/queries/convergence.d.ts +1 -1
  73. package/dist/queries/convergence.js +1 -1
  74. package/dist/queries/coupling.d.ts +1 -1
  75. package/dist/queries/coupling.js +1 -1
  76. package/dist/queries/cycles.d.ts +1 -1
  77. package/dist/queries/cycles.js +1 -1
  78. package/dist/queries/dataflow.d.ts +1 -1
  79. package/dist/queries/dataflow.js +1 -1
  80. package/dist/queries/dead.d.ts +1 -1
  81. package/dist/queries/dead.js +1 -1
  82. package/dist/queries/deep-chains.d.ts +1 -1
  83. package/dist/queries/deep-chains.js +1 -1
  84. package/dist/queries/deps.d.ts +1 -1
  85. package/dist/queries/deps.js +1 -1
  86. package/dist/queries/diff-impact.d.ts +1 -1
  87. package/dist/queries/diff-impact.js +1 -1
  88. package/dist/queries/drift.d.ts +1 -1
  89. package/dist/queries/drift.js +1 -1
  90. package/dist/queries/extract-candidates.d.ts +1 -1
  91. package/dist/queries/extract-candidates.js +1 -1
  92. package/dist/queries/fan.d.ts +1 -1
  93. package/dist/queries/fan.js +1 -1
  94. package/dist/queries/files.d.ts +1 -1
  95. package/dist/queries/health.d.ts +1 -1
  96. package/dist/queries/health.js +1 -1
  97. package/dist/queries/hierarchy.d.ts +1 -1
  98. package/dist/queries/hierarchy.js +1 -1
  99. package/dist/queries/hotspots.d.ts +1 -1
  100. package/dist/queries/hotspots.js +1 -1
  101. package/dist/queries/imports.d.ts +1 -1
  102. package/dist/queries/imports.js +1 -1
  103. package/dist/queries/index.d.ts +1 -1
  104. package/dist/queries/index.js +1 -1
  105. package/dist/queries/isolated.d.ts +1 -1
  106. package/dist/queries/isolated.js +1 -1
  107. package/dist/queries/members.d.ts +1 -1
  108. package/dist/queries/members.js +1 -1
  109. package/dist/queries/methods.d.ts +1 -1
  110. package/dist/queries/methods.js +1 -1
  111. package/dist/queries/outline.d.ts +1 -1
  112. package/dist/queries/outline.js +1 -1
  113. package/dist/queries/passthrough-candidates.d.ts +1 -1
  114. package/dist/queries/passthrough-candidates.js +1 -1
  115. package/dist/queries/redundant-reexports.d.ts +1 -1
  116. package/dist/queries/redundant-reexports.js +1 -1
  117. package/dist/queries/refs.d.ts +1 -1
  118. package/dist/queries/refs.js +1 -1
  119. package/dist/queries/similar-chains.d.ts +1 -1
  120. package/dist/queries/similar-chains.js +1 -1
  121. package/dist/queries/similar-files.d.ts +1 -1
  122. package/dist/queries/similar-files.js +1 -1
  123. package/dist/queries/similar-signatures.d.ts +1 -1
  124. package/dist/queries/similar-signatures.js +1 -1
  125. package/dist/queries/similar.d.ts +1 -1
  126. package/dist/queries/similar.js +1 -1
  127. package/dist/queries/slice.d.ts +1 -1
  128. package/dist/queries/slice.js +1 -1
  129. package/dist/queries/stale-abstractions.d.ts +2 -1
  130. package/dist/queries/stale-abstractions.js +1 -1
  131. package/dist/queries/stats.d.ts +1 -1
  132. package/dist/queries/surface.d.ts +1 -1
  133. package/dist/queries/surface.js +1 -1
  134. package/dist/queries/symbols.d.ts +1 -1
  135. package/dist/queries/symbols.js +1 -1
  136. package/dist/queries/system.d.ts +1 -1
  137. package/dist/queries/system.js +1 -1
  138. package/dist/queries/trace.d.ts +1 -1
  139. package/dist/queries/trace.js +1 -1
  140. package/dist/queries/wrapper-candidates.d.ts +1 -1
  141. package/dist/queries/wrapper-candidates.js +1 -1
  142. package/dist/reindex-worker.js +63 -5
  143. package/package.json +15 -16
  144. package/skills/concrete-plan/SKILL.md +51 -25
  145. package/skills/scip-debloat/SKILL.md +3 -6
  146. package/skills/scip-language-playbook/SKILL.md +2 -0
  147. package/dist/chunk-5IADAU5B.js +0 -7
  148. package/dist/chunk-7754WFFV.js +0 -18
  149. package/dist/chunk-7VOF4ZG6.js +0 -2
  150. package/dist/chunk-7Z4COVMC.js +0 -2
  151. package/dist/chunk-EEF3YEHW.js +0 -2
  152. package/dist/chunk-F2LLHRRZ.js +0 -2
  153. package/dist/chunk-GNXRLK5G.js +0 -2
  154. package/dist/chunk-JH3A7HTU.js +0 -2
  155. package/dist/chunk-K6GBKEQE.js +0 -6
  156. package/dist/chunk-KO7YJRWP.js +0 -12
  157. package/dist/chunk-PZ6ESKRH.js +0 -7
  158. package/dist/chunk-RJ7SPBJ5.js +0 -5
  159. package/dist/chunk-TINPMWJK.js +0 -2
  160. package/dist/chunk-UJB62HV3.js +0 -2
  161. package/dist/chunk-VEUMRDHW.js +0 -2
  162. package/dist/chunk-WCDXJGYT.js +0 -65
  163. package/dist/chunk-Y7H6D2EV.js +0 -2
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Language-agnostic code intelligence CLI powered by [SCIP](https://github.com/sourcegraph/scip) indexes. Index any codebase, then query it for references, dependencies, dead code, similarity, coupling, and more — without an IDE or language server running.
4
4
 
5
- Works with every language that has a SCIP indexer: TypeScript, JavaScript, Java, Scala, Kotlin, Rust, Python, Ruby, Go, C/C++, C#, Dart, PHP.
5
+ Works with every language that has a SCIP indexer: TypeScript, JavaScript, Vue, Java, Scala, Kotlin, Rust, Python, Ruby, Go, C/C++, C#, Visual Basic, Dart, PHP.
6
6
 
7
7
  ## Workflows
8
8
 
@@ -43,7 +43,7 @@ scip-query diff-impact # what did my changes affect?
43
43
 
44
44
  | Language | Indexer | Install |
45
45
  |---|---|---|
46
- | TypeScript / JavaScript | scip-typescript | `npm install -g @sourcegraph/scip-typescript` |
46
+ | TypeScript / JavaScript / Vue | scip-typescript | `npm install -g @sourcegraph/scip-typescript` |
47
47
  | Java / Scala / Kotlin | scip-java | [releases](https://github.com/sourcegraph/scip-java/releases) |
48
48
  | Rust | rust-analyzer | Ships with rust-analyzer (`rust-analyzer scip`) |
49
49
  | Python | scip-python-plus | `npm install -g scip-python-plus` |
@@ -54,7 +54,9 @@ scip-query diff-impact # what did my changes affect?
54
54
  | Dart | scip-dart | [releases](https://github.com/nicovince/scip-dart/releases) |
55
55
  | PHP | scip-php | [releases](https://github.com/nicovince/scip-php/releases) |
56
56
 
57
- For Python, the npm package is `scip-python-plus`. Depending on which version you installed, the executable on your `PATH` may be `scip-python`, `scip-python-plus`, or both. `scip-query` now accepts either name.
57
+ For Python, the npm package is `scip-python-plus`. Depending on which version you installed, the executable on your `PATH` may be `scip-python`, `scip-python-plus`, or both. `scip-query` accepts either name.
58
+
59
+ Vue single-file components (`.vue`) are handled by the JavaScript/TypeScript indexer. `scip-query` extracts the `<script>` block (or `<script setup>`, picking the language from the `lang=` attribute) and parses it as TS/JS so symbol, reference, and import queries cover Vue components alongside regular `.ts`/`.js` files.
58
60
 
59
61
  ## How It Works
60
62
 
@@ -466,6 +468,8 @@ scip-query dead src/utils --skip-barrels --include-members
466
468
  - `--include-tests` — Include test files in results (excluded by default)
467
469
  - `--skip-barrels` — Ignore references from inactive barrel re-export files
468
470
  - `--include-members` — Include class members (module-level only by default)
471
+ - `--only-dead` — Show only `[dead code]` symbols (skip `[file-internal only]`)
472
+ - `--only-internal` — Show only `[file-internal only]` symbols (skip `[dead code]`)
469
473
 
470
474
  **Value:** Find code you can delete. The `--skip-barrels` flag is key when a codebase has unused barrels, but it now keeps live entry-surface barrels counted so active exports do not look dead.
471
475
 
@@ -695,7 +699,7 @@ These commands find duplication, redundancy, and extraction opportunities — th
695
699
 
696
700
  #### `similar [symbol]`
697
701
 
698
- Find functions with similar callee fingerprints using Jaccard similarity. Two functions that call the same set of symbols are likely doing the same work and are candidates for consolidation.
702
+ Find functions with similar callee fingerprints using TF-IDF weighted cosine similarity. Each callee is weighted by how rare it is across the codebase two functions sharing a niche helper (`sendWelcomeEmail()`) score much higher than two functions sharing infrastructure callees (`db.all()`, `shortenSymbol()`). The "shared" list shown for each pair is the high-IDF (significant) intersection, not every shared callee.
699
703
 
700
704
  Without a symbol argument, finds the top N most similar pairs across the codebase. With a symbol, finds what's most similar to that specific function.
701
705
 
@@ -716,10 +720,11 @@ scip-query similar dead --min-similarity 0.3
716
720
  ```
717
721
 
718
722
  **Options:**
719
- - `--min-similarity <n>` — Minimum Jaccard similarity 0-1 (default: 0.4)
723
+ - `--min-similarity <n>` — Minimum cosine similarity 0-1 (default: 0.4)
720
724
  - `-n, --limit <n>` — Number of results (default: 20)
721
725
  - `-s, --scope <path>` — Limit to files matching path
722
726
  - `--min-callees <n>` — Minimum callees to consider a symbol (default: 4)
727
+ - `--cross-file-only` — Only show cross-file pairs (skip same-file matches)
723
728
 
724
729
  **Value:** Finds "these two functions do basically the same thing" at scale. The shared callee list shows exactly what's duplicated. The unique callees show where they diverge — that's the parameterization point for a consolidated version.
725
730
 
@@ -743,7 +748,7 @@ scip-query similar-files auth.controller.ts
743
748
  - `--min-similarity <n>` — Minimum Jaccard similarity 0-1 (default: 0.5)
744
749
  - `-n, --limit <n>` — Number of results (default: 20)
745
750
  - `-s, --scope <path>` — Limit to files matching path
746
- - `--min-deps <n>` — Minimum dependencies to consider (default: 3)
751
+ - `--min-deps <n>` — Minimum dependencies on the smaller side (auto-tunes by default; pass to override)
747
752
 
748
753
  **Value:** Finds copy-paste file variants and structurally redundant modules. When two files have 90%+ dependency overlap, they're likely doing similar jobs and should share code or be merged.
749
754
 
@@ -928,6 +933,7 @@ scip-query stale-abstractions --min-loc 5
928
933
  - `-s, --scope <path>` — Limit to files matching path
929
934
  - `--min-loc <n>` — Minimum LOC (default: 3)
930
935
  - `-n, --limit <n>` — Number of results (default: 30)
936
+ - `--include-low-confidence` — Include 1-consumer classes (usually encapsulation, not stale)
931
937
 
932
938
  **Value:** An interface with one implementation isn't an abstraction — it's indirection. Finds over-engineering.
933
939
 
@@ -1076,6 +1082,7 @@ scip-query slice login --forward # forward: what this feeds into
1076
1082
 
1077
1083
  **Options:**
1078
1084
  - `--forward` — Forward slice instead of backward (default: backward)
1085
+ - `--depth <n>` — Max transitive depth for backward slice (default: 3)
1079
1086
 
1080
1087
  **Value:** Backward slice shows inputs/dependencies. Forward slice shows outputs/effects. Useful for tracing data flow through error handling and concurrency paths.
1081
1088
 
@@ -1124,7 +1131,7 @@ scip-query similar-signatures --min-loc 5
1124
1131
 
1125
1132
  ## Programmatic API
1126
1133
 
1127
- All 49 commands are available as TypeScript functions:
1134
+ Every CLI command is also a TypeScript function. The `queries` namespace exports cover all of them — including the `top*` variants of `fan-in`, `fan-out`, and `coupling`, plus `similarAll` for the cross-codebase mode of `similar`:
1128
1135
 
1129
1136
  ```typescript
1130
1137
  import {
@@ -1,2 +1,2 @@
1
- import{e as n,f as a}from"./chunk-WCDXJGYT.js";import{a as i}from"./chunk-LX4H4LLG.js";import{b as m}from"./chunk-TINPMWJK.js";function b(s,e){let o=i(s,e);if(!o)return null;let t=a(s,o,{limit:50}),r=y(n(s,o,{limit:50}));return{symbol:o.symbol,shortName:m(o.symbol),callers:t.map(l=>({symbol:l.symbol,shortName:m(l.symbol),file:l.file})),callees:r.map(l=>({symbol:l.symbol,shortName:m(l.symbol),file:l.file}))}}function y(s){let e=new Set,o=[];for(let t of s){let r=`${t.symbol}|${t.file}`;e.has(r)||(e.add(r),o.push(t))}return o}export{b as a};
2
- //# sourceMappingURL=chunk-FCC3XJTI.js.map
1
+ import{h as n,i as a}from"./chunk-3FG3VLK3.js";import{a as i}from"./chunk-7NEBSLI3.js";import{b as m}from"./chunk-5IM4IQ6N.js";function b(s,e){let o=i(s,e);if(!o)return null;let t=a(s,o,{limit:50}),r=y(n(s,o,{limit:50}));return{symbol:o.symbol,shortName:m(o.symbol),callers:t.map(l=>({symbol:l.symbol,shortName:m(l.symbol),file:l.file})),callees:r.map(l=>({symbol:l.symbol,shortName:m(l.symbol),file:l.file}))}}function y(s){let e=new Set,o=[];for(let t of s){let r=`${t.symbol}|${t.file}`;e.has(r)||(e.add(r),o.push(t))}return o}export{b as a};
2
+ //# sourceMappingURL=chunk-26LSAIEP.js.map
@@ -1,2 +1,2 @@
1
- import{b as g}from"./chunk-VEUMRDHW.js";import{e as c,f as y,g as S}from"./chunk-WCDXJGYT.js";import{a}from"./chunk-LX4H4LLG.js";import{b as r}from"./chunk-TINPMWJK.js";function v(l,i){let o=a(l,i);if(!o)return null;let n=[{file:o.relativePath,line:o.startLine}],t=g(l,o),s=(t.length>0?t:S(l,o)).filter(e=>!l.isIgnored(e.file)).map(e=>({file:e.file,line:e.line,enclosingSymbol:e.enclosingSymbol??"(top-level)",enclosingShort:e.enclosingSymbol?r(e.enclosingSymbol):"(top-level)"})),{producers:u,consumers:b}=p(l,o,s);return{symbol:o.symbol,shortName:r(o.symbol),relativePath:o.relativePath,definitionSites:n.filter(e=>!l.isIgnored(e.file)),usageSites:s,producers:u.filter(e=>!l.isIgnored(e.file)).map(e=>({symbol:e.symbol,shortName:r(e.symbol),file:e.file})),consumers:b.filter(e=>!l.isIgnored(e.file)).map(e=>({symbol:e.symbol,shortName:e.symbol===e.file?"(top-level)":r(e.symbol),file:e.file}))}}function p(l,i,o){let n=m(c(l,i,{limit:30}).map(s=>({symbol:s.symbol,file:s.file}))),t=m(y(l,i,{limit:30})),f=t.length>0?t:m(o.map(s=>({symbol:s.enclosingSymbol==="(top-level)"?s.file:s.enclosingSymbol,file:s.file})));return{producers:n,consumers:f}}function m(l){let i=new Set,o=[];for(let n of l){let t=`${n.symbol}|${n.file}`;i.has(t)||(i.add(t),o.push(n))}return o}export{v as a};
2
- //# sourceMappingURL=chunk-SG35Y7J2.js.map
1
+ import{c as g}from"./chunk-QSTMORTI.js";import{h as c,i as y,j as S}from"./chunk-3FG3VLK3.js";import{a}from"./chunk-7NEBSLI3.js";import{b as r}from"./chunk-5IM4IQ6N.js";function v(l,i){let o=a(l,i);if(!o)return null;let n=[{file:o.relativePath,line:o.startLine}],t=g(l,o),s=(t.length>0?t:S(l,o)).filter(e=>!l.isIgnored(e.file)).map(e=>({file:e.file,line:e.line,enclosingSymbol:e.enclosingSymbol??"(top-level)",enclosingShort:e.enclosingSymbol?r(e.enclosingSymbol):"(top-level)"})),{producers:u,consumers:b}=p(l,o,s);return{symbol:o.symbol,shortName:r(o.symbol),relativePath:o.relativePath,definitionSites:n.filter(e=>!l.isIgnored(e.file)),usageSites:s,producers:u.filter(e=>!l.isIgnored(e.file)).map(e=>({symbol:e.symbol,shortName:r(e.symbol),file:e.file})),consumers:b.filter(e=>!l.isIgnored(e.file)).map(e=>({symbol:e.symbol,shortName:e.symbol===e.file?"(top-level)":r(e.symbol),file:e.file}))}}function p(l,i,o){let n=m(c(l,i,{limit:30}).map(s=>({symbol:s.symbol,file:s.file}))),t=m(y(l,i,{limit:30})),f=t.length>0?t:m(o.map(s=>({symbol:s.enclosingSymbol==="(top-level)"?s.file:s.enclosingSymbol,file:s.file})));return{producers:n,consumers:f}}function m(l){let i=new Set,o=[];for(let n of l){let t=`${n.symbol}|${n.file}`;i.has(t)||(i.add(t),o.push(n))}return o}export{v as a};
2
+ //# sourceMappingURL=chunk-2HEJQBMS.js.map
@@ -0,0 +1,65 @@
1
+ import{a as T,b as H,c as $,e as J}from"./chunk-6XP3KWHC.js";import{c as P}from"./chunk-7NEBSLI3.js";import{a as I,b as N,d as A,f as E,h as L,i as k,k as C,m as v,p as O,q as D,t as F}from"./chunk-SPMLGXCE.js";import{c as R}from"./chunk-5IM4IQ6N.js";var x=new WeakMap;function xe(n,o){let i=E(o);return i==="rust"?ne(n,o):i==="typescript"||i==="tsx"||i==="javascript"?Q(n,o):[]}var X=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]);function Q(n,o){let i=L(n,o);if(!i)return[];let l=x.get(i);if(l)return l;let a=/(^|\/)(pages|app)\/.+\.(tsx?|jsx?)$/.test(o)||/(^|\/)(layout|page|loading|error|not-found|head|template|default)\.(tsx?|jsx?)$/.test(o),r=/(^|\/)src\/(pages|views|routes)\/.+\.(tsx?|jsx?|vue)$/.test(o),d=!1,t=i.rootNode;for(let s of t.namedChildren){if(s.type!=="expression_statement")continue;let f=s.namedChild(0);if(!f||f.type!=="call_expression")continue;let e=f.namedChild(0);if(!e)continue;let u=e.type==="member_expression"?e.namedChild(e.namedChildCount-1)?.text:e.text;if(u&&X.has(u)){d=!0;break}}let c=[];d&&c.push({startLine:0,endLine:t.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)"}),(a||r)&&c.push({startLine:0,endLine:t.endPosition.row,reason:a?"Next.js / Remix route file":"Vite/Vue route component"});for(let s of t.namedChildren){let f=null,e=null;if(s.type==="function_declaration")f=s.namedChild(0)?.text??null,e=s;else if(s.type==="export_statement"){let u=s.namedChild(0);u?.type==="function_declaration"&&(f=u.namedChild(0)?.text??null,e=u)}else if(s.type==="lexical_declaration"){let u=s.namedChild(0);if(u?.type==="variable_declarator"){let p=u.namedChild(0)?.text,m=u.namedChild(1);p&&(m?.type==="arrow_function"||m?.type==="function_expression")&&(f=p,e=u)}}f&&/^use[A-Z]/.test(f)&&e&&c.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"React custom hook (use*)"})}return c.push(...z(i,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),x.set(i,c),c}var ee=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function te(n){return ee.test(n)}function z(n,o,i){let l=[],a=r=>{if(o.has(r.type)&&r.parent){let t=r.parent.children,c=-1;for(let s=0;s<t.length;s+=1)if(t[s].startIndex===r.startIndex&&t[s].type===r.type){c=s;break}if(c>0)for(let s=c-1;s>=0;s-=1){let f=t[s];if(i.has(f.type)){if(te(f.text)){l.push({startLine:r.startPosition.row,endLine:r.endPosition.row,reason:"scip-query suppression comment"});break}continue}if(!(f.type==="attribute_item"||f.type==="inner_attribute_item"))break}}for(let d of r.namedChildren)a(d)};return a(n.rootNode),l}function ne(n,o){let i=L(n,o);if(!i)return[];let l=x.get(i);if(l)return l;let a=[];if(ie(i.rootNode)){let e={startLine:0,endLine:i.rootNode.endPosition.row,reason:"generated file (@generated header)"};return x.set(i,[e]),[e]}let r=e=>{let u=e.parent;if(!u)return[];let p=u.children,m=-1;for(let g=0;g<p.length;g+=1)if(p[g].startIndex===e.startIndex&&p[g].type===e.type){m=g;break}if(m<=0)return[];let b=[];for(let g=m-1;g>=0;g-=1){let _=p[g];if(_.type==="attribute_item"||_.type==="inner_attribute_item")b.push(_.text);else{if(_.type==="line_comment"||_.type==="block_comment")continue;break}}return b},d=e=>/#\[\s*tauri::command\b/.test(e)?"#[tauri::command]":/#\[\s*command\b/.test(e)?"#[command]":/#\[\s*test\b/.test(e)?"#[test]":/#\[\s*bench\b/.test(e)?"#[bench]":/#\[\s*tokio::test\b/.test(e)?"#[tokio::test]":/#\[\s*async_std::test\b/.test(e)?"#[async_std::test]":/#\[\s*wasm_bindgen\b/.test(e)?"#[wasm_bindgen]":/#\[\s*no_mangle\b/.test(e)?"#[no_mangle]":/#\[\s*napi\b/.test(e)?"#[napi]":/#\[\s*pyfunction\b/.test(e)?"#[pyfunction]":/#\[\s*pymethod\b/.test(e)?"#[pymethod]":/#\[\s*pyo3\b/.test(e)?"#[pyo3]":/#\[\s*cfg\s*\(\s*test\s*\)/.test(e)?"#[cfg(test)]":/#\[\s*doc\s*\(\s*hidden\s*\)/.test(e)?"#[doc(hidden)]":null,t=e=>/#\[\s*derive\s*\(/.test(e)?/\bSerialize\b/.test(e)||/\bDeserialize\b/.test(e)||/\bFromRow\b/.test(e)||/\bDeriveEntityModel\b/.test(e)||/\bIntoSchema\b/.test(e)||/\bToSchema\b/.test(e)||/\bDeriveValueType\b/.test(e)||/\bsqlx::FromRow\b/.test(e)||/\bError\b/.test(e)||/\bthiserror::Error\b/.test(e):!1,c=e=>/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e),s=(e,u,p,m)=>{let b=u,g=p,_=m;if(e.type==="trait_item"&&(_=!0,a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)"})),e.type==="impl_item"&&e.childForFieldName("trait")&&(g=!0,a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)"})),e.type==="function_item"||e.type==="function_signature_item"){let y=r(e),h=null;p?h="trait impl method (dynamic dispatch)":u&&(h="inside #[cfg(test)] mod");for(let S of y){let w=d(S);if(w){h=w;break}if(c(S)){h="#[allow(dead_code)]";break}}h&&a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:h})}else if(p&&(e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"))a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)"});else if(e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"){let y=r(e),h=y.some(t),S=y.some(c),w=e.namedChildren.find(Z=>Z.type==="type_identifier")?.text;h&&a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(<reflective>)] \u2014 fields accessed via macro/reflection",containerName:w}),S&&a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",containerName:w}),u&&a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",containerName:w})}else e.type==="mod_item"&&r(e).some(h=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(h))&&(b=!0);for(let y of e.namedChildren)s(y,b,g,_)};s(i.rootNode,!1,!1,!1),a.push(...z(i,new Set(["function_item","function_signature_item","struct_item","enum_item","union_item","impl_item","mod_item","static_item","const_item"]),new Set(["line_comment","block_comment"])));let f=ce(i.rootNode);if(f.size>0)for(let e of i.rootNode.descendantsOfType("mod_item")){let u=e.childForFieldName("name")?.text;u&&f.has(u)&&a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:'serde `with = "..."` module \u2014 body invoked via reflection',containerName:u})}return x.set(i,a),a}function ie(n){for(let o=0;o<Math.min(n.namedChildCount,12);o+=1){let i=n.namedChild(o);if(!i||i.type!=="line_comment"&&i.type!=="block_comment")break;if(/@generated\b/.test(i.text)||/This file is .*generated\b/i.test(i.text)||/Code generated by/i.test(i.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(i.text)||/openapi-generator/i.test(i.text)&&/Generated by/i.test(i.text))return!0}return!1}var se=[{key:"default",re:/\bdefault\s*=\s*"([^"]+)"/g},{key:"with",re:/\bwith\s*=\s*"([^"]+)"/g},{key:"serialize_with",re:/\bserialize_with\s*=\s*"([^"]+)"/g},{key:"deserialize_with",re:/\bdeserialize_with\s*=\s*"([^"]+)"/g},{key:"skip_serializing_if",re:/\bskip_serializing_if\s*=\s*"([^"]+)"/g},{key:"getter",re:/\bgetter\s*=\s*"([^"]+)"/g},{key:"rename_all_with",re:/\brename_all_with\s*=\s*"([^"]+)"/g},{key:"schema_with",re:/\bschema_with\s*=\s*"([^"]+)"/g}],j=/^#!?\[\s*serde\s*\(/,oe=/^#!?\[\s*schemars\s*\(/,re=/^#!?\[\s*validate\s*\(/,W=/\bwith\s*=\s*"([^"]+)"/g;function G(n,o){return C(n,o,ae,()=>new Set,(i,l,a)=>{if(l==="rust"){for(let r of i.rootNode.descendantsOfType("attribute_item"))B(r.text,a);for(let r of i.rootNode.descendantsOfType("inner_attribute_item"))B(r.text,a)}})??new Set}var ae=new WeakMap;function B(n,o){let i=j.test(n),l=oe.test(n),a=re.test(n);if(!(!i&&!l&&!a))for(let{re:r}of se){r.lastIndex=0;let d;for(;(d=r.exec(n))!==null;){let t=d[1],c=t.split("::").pop()??t;c==="is_none"&&/\bOption\b/.test(t)||c==="is_empty"&&/\b(String|Vec|HashMap|BTreeMap|HashSet|BTreeSet)\b/.test(t)||c&&o.add(c)}}}function ce(n){let o=new Set;for(let i of n.descendantsOfType("attribute_item")){if(!j.test(i.text))continue;W.lastIndex=0;let l;for(;(l=W.exec(i.text))!==null;){let a=l[1],r=a.split("::").pop()??a;r&&o.add(r)}}return o}var le=new Set(["invoke","invokeTauriCommand","listen","once","emit","subscribe","dispatch","sendCommand","callRust"]);function Re(n,o){return C(n,o,de,()=>new Set,(i,l,a)=>{if(!(l!=="typescript"&&l!=="tsx"&&l!=="javascript"))for(let r of i.rootNode.descendantsOfType("call_expression")){let d=r.namedChild(0);if(!d)continue;let t=v(d);if(!t||!le.has(t))continue;let c=r.namedChildren.find(e=>e.type==="arguments");if(!c)continue;let s=c.namedChild(0);if(!s||s.type!=="string")continue;let f=s.namedChildren.find(e=>e.type==="string_fragment");f&&a.add(f.text)}})??new Set}var de=new WeakMap;function Y(n,o,i,l={}){if(!i)return[];let a=A(n,o);if(!a)return[];if(a.indexOf(i)===-1)return[];if(E(o))return(M(n,o).get(i)??[]).filter(f=>!V(f,l));let r=H(n,o,a),d=new RegExp(`\\b${$(i)}\\b`),t=[];for(let c=0;c<r.length;c++)V(c,l)||d.test(r[c]??"")&&t.push(c);return t}function V(n,o){return typeof o.excludeStartLine=="number"&&typeof o.excludeEndLine=="number"&&n>=o.excludeStartLine&&n<=o.excludeEndLine}var ue=I("file-identifiers");function ve(n,o){return ue.get(n,o,()=>new Set(M(n,o).keys()))}var fe=I("file-ident-lines");function M(n,o){return fe.get(n,o,()=>pe(n,o))}var me=I("file-idents-by-line");function U(n,o){return me.get(n,o,()=>{let i=M(n,o),l=0;for(let r of i.values()){let d=r[r.length-1];d!==void 0&&d>l&&(l=d)}let a=new Array(l+1);for(let r=0;r<=l;r+=1)a[r]=new Set;for(let[r,d]of i)for(let t of d)a[t].add(r);return a})}function pe(n,o){let i=new Map,l=(t,c)=>{let s=i.get(t);if(!s){i.set(t,[c]);return}s[s.length-1]!==c&&s.push(c)};if(E(o)){let t=L(n,o);if(t){let c=E(o),s=c==="rust"?new Set(["identifier","type_identifier","field_identifier"]):c==="python"?new Set(["identifier"]):new Set(["identifier","property_identifier","type_identifier"]),f=new Set(["rust","python"]),e=/\{([^{}]*)\}/g,u=/\b([A-Za-z_][\w]*)\b/g,p=m=>{if(s.has(m.type)&&l(m.text,m.startPosition.row),c&&f.has(c)&&m.type==="string_content"){let b=m.startPosition.row;for(let g of m.text.matchAll(e)){let _=g[1]??"";for(let y of _.matchAll(u))y[1]&&l(y[1],b)}}for(let b of m.children)p(b)};return p(t.rootNode),i}}let a=A(n,o);if(!a)return i;let r=T(a).split(/\r?\n/),d=/\b([A-Za-z_$][\w$]*)\b/g;for(let t=0;t<r.length;t+=1){let c=r[t]??"";for(let s of c.matchAll(d))s[1]&&l(s[1],t)}return i}var be=I("file-dep-graph");function Be(n,o){return be.get(n,o??"",()=>{let i=o?`AND d1.relative_path LIKE '%${o}%'`:"",l=n.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
+ AND m.role != 1
18
+ ${n.pathExclusionsFor("d1","d2")}
19
+ ${i}`),a=new Map,r=new Set(n.all(`SELECT relative_path
20
+ FROM documents
21
+ WHERE 1 = 1
22
+ ${n.pathExclusionsFor("documents")}
23
+ ORDER BY relative_path`).map(t=>t.relative_path).filter(t=>!n.isIgnored(t))),d=(t,c)=>{t!==c&&(n.isIgnored(t)||n.isIgnored(c)||r.has(c)&&(a.has(t)||a.set(t,new Set),a.get(t).add(c)))};for(let t of l)d(t.from_file,t.to_file);for(let t of r)if(!(o&&!t.includes(o)))for(let c of J(n,t))c.sourcePath&&d(t,c.sourcePath);return a})}function ze(n,o,i={}){let a=K(n,[o]).get(o.symbolId)??[];return typeof i.limit=="number"?a.slice(0,i.limit):a}function je(n,o,i={}){let a=ye(n).get(o.symbolId)??[];return typeof i.limit=="number"?a.slice(0,i.limit):a}var ge=N("caller-rows");function ye(n){return ge.get(n,()=>{let o=D(n),i=K(n,o),l=new Map;for(let d of o)l.set(d.symbol,d.symbolId);let a=new Map,r=new Map;for(let d of o){let t=i.get(d.symbolId);if(!(!t||t.length===0))for(let c of t){let s=l.get(c.symbol);if(s===void 0||s===d.symbolId)continue;let f=a.get(s);f||(f=[],a.set(s,f),r.set(s,new Set));let e=`${d.symbol}|${d.relativePath}`;r.get(s).has(e)||(r.get(s).add(e),f.push({symbol:d.symbol,file:d.relativePath}))}}return a})}function Ge(n,o){let i=he(n,o);return i?Se(n,_e(n,i.match,i.identifier)):[]}function _e(n,o,i){let l=n.all(`SELECT DISTINCT d.relative_path, c.start_line, c.end_line
24
+ FROM mentions m
25
+ JOIN chunks c ON m.chunk_id = c.id
26
+ JOIN documents d ON c.document_id = d.id
27
+ WHERE m.symbol_id = ?
28
+ AND m.role != 1
29
+ ${n.pathExclusionsFor("d")}
30
+ ORDER BY d.relative_path, c.start_line`,o.symbolId),a=new Map;for(let d of l){if(n.isIgnored(d.relative_path))continue;let t=a.get(d.relative_path);t||(t=[],a.set(d.relative_path,t)),t.push({start_line:d.start_line,end_line:d.end_line})}let r=new Map;for(let[d,t]of a){let c=d===o.relativePath?{excludeStartLine:o.startLine,excludeEndLine:o.endLine}:{},s=i?Y(n,d,i,c):[],f=[];for(let e of t){let u=s.filter(m=>m>=e.start_line&&m<=e.end_line),p=u.length>0?u:[e.start_line];for(let m of p)f.push(m)}r.set(d,f)}return r}function he(n,o){let i=P(n,o);return i?{match:i,identifier:R(i.symbol)||null}:null}function Se(n,o){let i=[],l=new Set;for(let[a,r]of o){let d=O(n,a);for(let t of r){let c=F(d,t),s=`${a}|${t}|${c?.symbol??""}`;l.has(s)||(l.add(s),i.push({file:a,line:t,enclosingSymbol:c?.symbol??null}))}}return i}function K(n,o,i={}){if(o.length===0)return new Map;let l=i.additive??!1,a=[],r=[];for(let s of o)E(s.relativePath)&&k(n,s.relativePath)!==null?a.push(s):r.push(s);let d=new Map,t=s=>{for(let[f,e]of s){let u=d.get(f);u||(u=[],d.set(f,u));let p=new Set(u.map(m=>`${m.symbol}|${m.chunkId}`));for(let m of e){let b=`${m.symbol}|${m.chunkId}`;p.has(b)||(p.add(b),u.push(m))}}};a.length>0&&t(Ee(n,a));let c=l?o:r;return c.length>0&&t(Ie(n,c)),d}function Ee(n,o){let i=new Map,l=new Map;for(let r of o){let d=l.get(r.relativePath);d?d.push(r):l.set(r.relativePath,[r]),i.set(r.symbolId,[])}let a=q(n);for(let[r,d]of l){let t=k(n,r);if(!t)continue;let c=[...d].sort((s,f)=>{let e=s.endLine-s.startLine,u=f.endLine-f.startLine;return e-u});for(let s of t){let f=null;for(let b of c)if(s.line>=b.startLine&&s.line<=b.endLine){f=b;break}if(!f)continue;let e=a.get(s.calleeLeaf);if(!e||e.length===0)continue;let u=null,p=e.find(b=>b.file===r);if(p?u=p:e.length===1&&(u=e[0]),!u||u.symbol===f.symbol)continue;i.get(f.symbolId).push({symbol:u.symbol,file:u.file,chunkId:s.line})}}return i}var we=N("global-leaf-index");function q(n){return we.get(n,()=>{let o=n.all(`SELECT gs.id, gs.symbol,
31
+ COALESCE(der_doc.relative_path, mention_doc.relative_path) AS relative_path
32
+ FROM global_symbols gs
33
+ LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
34
+ LEFT JOIN documents der_doc ON der_doc.id = der.document_id
35
+ LEFT JOIN (
36
+ SELECT m.symbol_id, MIN(d.relative_path) AS relative_path
37
+ FROM mentions m
38
+ JOIN chunks c ON m.chunk_id = c.id
39
+ JOIN documents d ON c.document_id = d.id
40
+ WHERE m.role = 1
41
+ GROUP BY m.symbol_id
42
+ ) mention_doc ON mention_doc.symbol_id = gs.id
43
+ WHERE 1 = 1
44
+ ${n.symbolNoiseFor("gs")}`),i=new Map;for(let l of o){if(!l.relative_path||n.isIgnored(l.relative_path))continue;let a=R(l.symbol);if(!a)continue;let r=i.get(a);r||(r=[],i.set(a,r)),r.some(d=>d.symbolId===l.id)||r.push({symbol:l.symbol,symbolId:l.id,file:l.relative_path})}return i})}function Ie(n,o){if(o.length===0)return new Map;let i=n.all(`SELECT c.document_id, c.id AS chunk_id, c.start_line, c.end_line, m.symbol_id
45
+ FROM mentions m
46
+ JOIN chunks c ON m.chunk_id = c.id
47
+ WHERE m.role != 1`),l=new Map;for(let s of i)l.has(s.document_id)||l.set(s.document_id,[]),l.get(s.document_id).push(s);let a=new Map(n.all("SELECT id, relative_path FROM documents").map(s=>[s.id,s.relative_path])),r=new Map,d=n.all(`SELECT gs.id AS symbol_id, gs.symbol,
48
+ COALESCE(der.document_id, def_chunk.document_id) AS document_id
49
+ FROM global_symbols gs
50
+ LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
51
+ LEFT JOIN (
52
+ SELECT m.symbol_id, MIN(c.document_id) AS document_id
53
+ FROM mentions m
54
+ JOIN chunks c ON m.chunk_id = c.id
55
+ WHERE m.role = 1
56
+ GROUP BY m.symbol_id
57
+ ) def_chunk ON def_chunk.symbol_id = gs.id`);for(let s of d)r.has(s.symbol_id)||r.set(s.symbol_id,{symbol:s.symbol,file:s.document_id!==null?a.get(s.document_id)??"":""});let t=new Map,c=a;for(let s of o){let f=l.get(s.documentId)??[],e=new Set,u=[],p=null,m=()=>{if(p)return p;let b=c.get(s.documentId)??"",g=new Set;if(b){let _=U(n,b),y=Math.max(0,s.startLine),h=Math.min(_.length-1,s.endLine);for(let S=y;S<=h;S+=1)for(let w of _[S])g.add(w)}return p=g,g};for(let b of f){if(b.symbol_id===s.symbolId)continue;let g=r.get(b.symbol_id);if(!g)continue;if(!(b.start_line>=s.startLine&&b.end_line<=s.endLine)){if(!(b.start_line<=s.endLine&&b.end_line>=s.startLine))continue;let S=R(g.symbol);if(!S||!m().has(S))continue}let y=`${g.symbol}|${b.chunk_id}`;e.has(y)||(e.add(y),u.push({...g,chunkId:b.chunk_id}))}t.set(s.symbolId,u)}return t}function Ve(n,o){let i=new Map,l=n.all(`SELECT relative_path FROM documents
58
+ WHERE 1 = 1 ${n.pathExclusionsFor("documents")}`),a=q(n);for(let t of l){if(!E(t.relative_path)||n.isIgnored(t.relative_path))continue;let c=k(n,t.relative_path);if(c)for(let s of c){let f=a.get(s.calleeLeaf);if(!f||f.length===0)continue;let u=f.find(m=>m.file===t.relative_path)??(f.length===1?f[0]:null);if(!u||u.file===t.relative_path)continue;let p=i.get(u.symbolId);p||(p=new Set,i.set(u.symbolId,p)),p.add(t.relative_path)}}let r=n.all(`SELECT DISTINCT m.symbol_id, d.relative_path, c.document_id,
59
+ c.start_line AS chunk_start, c.end_line AS chunk_end
60
+ FROM mentions m
61
+ JOIN chunks c ON m.chunk_id = c.id
62
+ JOIN documents d ON c.document_id = d.id
63
+ WHERE m.role != 1
64
+ ${n.pathExclusionsFor("d")}`),d=new Map;if(o)for(let t of o)d.set(t.symbolId,{docId:t.documentId,startLine:t.startLine,endLine:t.endLine});for(let t of r){if(n.isIgnored(t.relative_path))continue;let c=d.get(t.symbol_id);if(c&&c.docId===t.document_id&&t.chunk_start>=c.startLine&&t.chunk_end<=c.endLine)continue;let s=i.get(t.symbol_id);s||(s=new Set,i.set(t.symbol_id,s)),s.add(t.relative_path)}for(let t of l){if(n.isIgnored(t.relative_path)||E(t.relative_path)!=="rust")continue;let c=G(n,t.relative_path);if(c.size!==0)for(let s of c){let f=a.get(s);if(f)for(let e of f){if(e.file===t.relative_path)continue;let u=i.get(e.symbolId);u||(u=new Set,i.set(e.symbolId,u)),u.add(t.relative_path)}}}return i}export{xe as a,G as b,Re as c,Y as d,ve as e,M as f,Be as g,ze as h,je as i,Ge as j,K as k,q as l,Ve as m};
65
+ //# sourceMappingURL=chunk-3FG3VLK3.js.map
@@ -1,4 +1,4 @@
1
- import{a as h}from"./chunk-WTSTDJZ7.js";import{e as p}from"./chunk-BQ3INTYT.js";import{a as _}from"./chunk-LX4H4LLG.js";import{b as d,c,g as f}from"./chunk-TINPMWJK.js";function v(e,i){return b(e,i)?.map(t=>({symbol:t.symbol,shortName:t.shortName,fromFile:t.fromFile}))??[]}function F(e,i){let a=e.all(`SELECT DISTINCT gs.symbol, d.relative_path AS importer
1
+ import{a as h}from"./chunk-NFOSOUH6.js";import{e as p}from"./chunk-6XP3KWHC.js";import{a as _}from"./chunk-7NEBSLI3.js";import{b as d,c,g as f}from"./chunk-5IM4IQ6N.js";function v(e,i){return b(e,i)?.map(t=>({symbol:t.symbol,shortName:t.shortName,fromFile:t.fromFile}))??[]}function F(e,i){let a=e.all(`SELECT DISTINCT gs.symbol, d.relative_path AS importer
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents d ON c.document_id = d.id
@@ -36,4 +36,4 @@ import{a as h}from"./chunk-WTSTDJZ7.js";import{e as p}from"./chunk-BQ3INTYT.js";
36
36
  WHERE imp_d.relative_path = ?
37
37
  AND m.role = 2
38
38
  ORDER BY def_d.relative_path, gs.symbol`,t).filter(r=>!e.isIgnored(r.importer));return o.length>0?o.map(r=>({symbol:r.symbol,shortName:d(r.symbol),fromFile:r.from_file??"(external)",importer:r.importer,used:r.used!==0})):p(e,t).map(r=>{let m=I(r.importedName,r.localName,r.kind),u=r.kind==="side-effect"?!0:r.used;return{symbol:m,shortName:m,fromFile:r.sourcePath??"(external)",importer:t,used:u}})}function I(e,i,t){return t==="namespace"&&e==="*"&&i?`* as ${i}`:t==="default"&&i?`default as ${i}`:t==="side-effect"?"(side effect import)":i&&i!==e?`${e} as ${i}`:e}function g(e){return e.replace(/\\/g,"/")}function E(e){return/\.(?:c|h|cc|cpp|cxx|hpp|hh|hxx)$/i.test(e)}export{v as a,F as b,D as c};
39
- //# sourceMappingURL=chunk-DE5ZBHMK.js.map
39
+ //# sourceMappingURL=chunk-3J463LOK.js.map
@@ -1,4 +1,4 @@
1
- import{b as o}from"./chunk-WTSTDJZ7.js";import{s as m}from"./chunk-IYFZS4PV.js";function y(t,l){let s=o(t,l);if(s.length===0)return{files:[],symbols:[],dependsOn:[],dependedOnBy:[]};let d=s.map(()=>"?").join(", "),i=t.all(`SELECT relative_path FROM documents
1
+ import{b as o}from"./chunk-NFOSOUH6.js";import{s as m}from"./chunk-SPMLGXCE.js";function y(t,l){let s=o(t,l);if(s.length===0)return{files:[],symbols:[],dependsOn:[],dependedOnBy:[]};let d=s.map(()=>"?").join(", "),i=t.all(`SELECT relative_path FROM documents
2
2
  WHERE relative_path IN (${d})
3
3
  ORDER BY relative_path`,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e)),n=m(t,i,{onlyDocumented:!0,sort:!0}).map(({relativePath:e,...c})=>c),a=t.all(`SELECT DISTINCT d2.relative_path
4
4
  FROM mentions m
@@ -32,4 +32,4 @@ import{b as o}from"./chunk-WTSTDJZ7.js";import{s as m}from"./chunk-IYFZS4PV.js";
32
32
  WHERE d2.relative_path IN (${d})
33
33
  AND d1.relative_path NOT IN (${d})
34
34
  ORDER BY d1.relative_path`,...s,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e));return{files:i,symbols:n,dependsOn:a,dependedOnBy:r}}export{y as a};
35
- //# sourceMappingURL=chunk-XVDASCN7.js.map
35
+ //# sourceMappingURL=chunk-3QJ2NOYG.js.map
@@ -1,2 +1,2 @@
1
- import{b as g}from"./chunk-VEUMRDHW.js";import{e as u,g as h}from"./chunk-WCDXJGYT.js";import{a as d,b as y}from"./chunk-LX4H4LLG.js";import{p as S,t as p}from"./chunk-IYFZS4PV.js";import{b as m}from"./chunk-TINPMWJK.js";function N(e,o,r={}){let{direction:c="backward",maxDepth:s=3}=r,t=d(e,o);return t?c==="backward"?w(e,t,s):R(e,t):null}function w(e,o,r){let c=[],s=new Set([o.symbol]),t=[o];for(let n=1;n<=r&&t.length!==0;n++){let l=[];for(let a of t){let i=u(e,a);for(let f of i){if(s.has(f.symbol))continue;s.add(f.symbol),c.push({symbol:f.symbol,shortName:m(f.symbol),file:f.file,relationship:n===1?"referenced within definition (callee)":`depth ${n} callee`});let b=y(e,f.symbol);b&&!e.isIgnored(b.relativePath)&&l.push(b)}}t=l}return{symbol:o.symbol,shortName:m(o.symbol),direction:"backward",connectedSymbols:c}}function R(e,o){let r=g(e,o),c=r.length>0?r:h(e,o),s=new Set,t=[];for(let n of c){if(t.length>=30)break;if(e.isIgnored(n.file))continue;let l=n.enclosingSymbol??p(S(e,n.file),n.line)?.symbol??null;if(!l||l===o.symbol)continue;let a=y(e,l);if(a){for(let i of u(e,a))if(i.symbol!==o.symbol&&i.symbol!==l&&i.file!==n.file&&!e.isIgnored(i.file)&&!s.has(i.symbol)&&(s.add(i.symbol),t.push({symbol:i.symbol,shortName:m(i.symbol),file:i.file,relationship:`used alongside target in ${m(l)}`}),t.length>=30))break}}return t.sort((n,l)=>n.file.localeCompare(l.file)),{symbol:o.symbol,shortName:m(o.symbol),direction:"forward",connectedSymbols:t}}export{N as a};
2
- //# sourceMappingURL=chunk-AJ5PWKD4.js.map
1
+ import{c as g}from"./chunk-QSTMORTI.js";import{h as u,j as h}from"./chunk-3FG3VLK3.js";import{a as d,b as y}from"./chunk-7NEBSLI3.js";import{p as S,t as p}from"./chunk-SPMLGXCE.js";import{b as m}from"./chunk-5IM4IQ6N.js";function N(e,o,r={}){let{direction:c="backward",maxDepth:s=3}=r,t=d(e,o);return t?c==="backward"?w(e,t,s):R(e,t):null}function w(e,o,r){let c=[],s=new Set([o.symbol]),t=[o];for(let n=1;n<=r&&t.length!==0;n++){let l=[];for(let a of t){let i=u(e,a);for(let f of i){if(s.has(f.symbol))continue;s.add(f.symbol),c.push({symbol:f.symbol,shortName:m(f.symbol),file:f.file,relationship:n===1?"referenced within definition (callee)":`depth ${n} callee`});let b=y(e,f.symbol);b&&!e.isIgnored(b.relativePath)&&l.push(b)}}t=l}return{symbol:o.symbol,shortName:m(o.symbol),direction:"backward",connectedSymbols:c}}function R(e,o){let r=g(e,o),c=r.length>0?r:h(e,o),s=new Set,t=[];for(let n of c){if(t.length>=30)break;if(e.isIgnored(n.file))continue;let l=n.enclosingSymbol??p(S(e,n.file),n.line)?.symbol??null;if(!l||l===o.symbol)continue;let a=y(e,l);if(a){for(let i of u(e,a))if(i.symbol!==o.symbol&&i.symbol!==l&&i.file!==n.file&&!e.isIgnored(i.file)&&!s.has(i.symbol)&&(s.add(i.symbol),t.push({symbol:i.symbol,shortName:m(i.symbol),file:i.file,relationship:`used alongside target in ${m(l)}`}),t.length>=30))break}}return t.sort((n,l)=>n.file.localeCompare(l.file)),{symbol:o.symbol,shortName:m(o.symbol),direction:"forward",connectedSymbols:t}}export{N as a};
2
+ //# sourceMappingURL=chunk-3T53QAUS.js.map
@@ -0,0 +1,2 @@
1
+ import{a as p,b as d}from"./chunk-AEMTUHQ7.js";import{g as B}from"./chunk-3FG3VLK3.js";function w(s,e={}){let{scope:r,maxDepth:c=10}=e,n=B(s,r),i=[],l=new Set,a=new Set,f=[];function g(t,o){if(o>c)return;if(a.has(t)){let h=f.indexOf(t);if(h!==-1){let u=f.slice(h).concat(t),m=u.indexOf(u.reduce(($,x)=>$<x?$:x)),y=[...u.slice(m,-1),...u.slice(0,m),u[m]],S=y.join(" -> ");b.has(S)||(b.add(S),i.push({path:y,kind:R(y)}))}return}if(l.has(t))return;l.add(t),a.add(t),f.push(t);let k=n.get(t);if(k)for(let h of k)g(h,o+1);f.pop(),a.delete(t)}let b=new Set;for(let t of n.keys())l.has(t)||g(t,0);return i.sort((t,o)=>t.kind!==o.kind?t.kind==="real"?-1:1:t.path.length-o.path.length),i}function R(s){for(let c of s){let n=p(c);if(n==="test"||n==="barrel"||n==="entry")return"module-hierarchy"}if(s.length!==3)return"real";let[e,r]=s;return!e||!r?"real":d(e)||d(r)||C(e,r)||C(r,e)||D(e,r)||D(r,e)||p(e)==="entry"||p(r)==="entry"?"module-hierarchy":"real"}function C(s,e){if(!/\.rs$/.test(s)||!/\.rs$/.test(e))return!1;let r=e.replace(/\.rs$/,"/");return s.startsWith(r)?!s.slice(r.length).includes("/"):!1}function D(s,e){if(!/\.rs$/.test(s)||!/\.rs$/.test(e))return!1;let r=s.replace(/\.rs$/,""),c=e.replace(/\.rs$/,"");if(r===c+"_tests"||r===c+"/tests")return!0;let n=s.split("/"),i=e.split("/");if(n.length===i.length&&n.includes("tests")&&i.includes("src")){let l=n[n.length-1],a=i[i.length-1];if(l&&l===a)return!0}return!1}export{w as a};
2
+ //# sourceMappingURL=chunk-435YC4OF.js.map
@@ -0,0 +1,6 @@
1
+ import{a as w,b as h,d as R,e as N}from"./chunk-LORWXBOO.js";import{a as P}from"./chunk-AEMTUHQ7.js";import{h as T,k as j}from"./chunk-3FG3VLK3.js";import{a as A}from"./chunk-7NEBSLI3.js";import{d as D,e as L,l as z,q as $,r as B}from"./chunk-SPMLGXCE.js";import{b,c as q,f as F,i as x}from"./chunk-5IM4IQ6N.js";function ae(i,e,r={}){let{minSimilarity:s=.4,limit:l=20}=r,o=U(i,e);if(!o)return[];if(!F(o.symbol))return[];let n=K(i,o,s);return n.length>0?n.slice(0,l):G(i,e,{minSimilarity:s,limit:l})}function K(i,e,r){let s=E(i,{minCallees:3,excludeSymbol:e.symbol}),l=R([e,...s].map(n=>n.callees)),o=[];for(let n of s){if(n.callees.size<3)continue;let t=I(e,n,l,{minSimilarity:r,requireSignificantShared:1,requireSharedCount:0});t&&o.push(t)}return o.sort((n,t)=>t.similarity-n.similarity),o}function I(i,e,r,s){let{similarity:l,significantShared:o}=N(i.callees,e.callees,r);if(l<s.minSimilarity)return null;let n=w(i.callees,e.callees).size;if(o.length<s.requireSignificantShared&&n<s.requireSharedCount)return null;let t=o.length>0?o:[...w(i.callees,e.callees)];return{symbolA:i.symbol,shortNameA:b(i.symbol),fileA:i.file,symbolB:e.symbol,shortNameB:b(e.symbol),fileB:e.file,similarity:l,sharedCallees:t.map(b),uniqueToA:[...h(i.callees,e.callees)].map(b),uniqueToB:[...h(e.callees,i.callees)].map(b)}}function me(i,e={}){let{minSimilarity:r=.5,limit:s=20,scope:l,minCallees:o=4,crossFileOnly:n=!1}=e,t=E(i,{minCallees:o,scope:l}),c=R(t.map(a=>a.callees)),u=new Map;for(let a of t)for(let m of a.callees)u.set(m,(u.get(m)??0)+1);let f=Math.max(8,Math.ceil(Math.sqrt(t.length))),S=new Map;for(let a=0;a<t.length;a+=1)for(let m of t[a].callees){if((u.get(m)??0)>f)continue;let g=S.get(m);g||(g=[],S.set(m,g)),g.push(a)}let C=[],v=new Set;e:for(let a=0;a<t.length;a+=1){let m=t[a],g=new Set;for(let k of m.callees){let y=S.get(k);if(y)for(let p of y)p>a&&g.add(p)}for(let k of g){let y=`${a}|${k}`;if(v.has(y))continue;v.add(y);let p=t[k];if(n&&m.file===p.file)continue;if(m.paramCount>=0&&p.paramCount>=0){let _=Math.abs(m.paramCount-p.paramCount),W=Math.max(2,Math.ceil(Math.max(m.paramCount,p.paramCount)*.5));if(_>W)continue}let M=I(m,p,c,{minSimilarity:r,requireSignificantShared:2,requireSharedCount:4});if(M&&(C.push(M),C.length>s*5))break e}}return C.sort((a,m)=>m.similarity-a.similarity),C.slice(0,s)}function U(i,e){let r=A(i,e);if(!r)return null;let s=T(i,r);return{symbol:r.symbol,file:r.relativePath,callees:new Set(s.map(l=>l.symbol)),paramCount:z(i,r.relativePath,r.startLine,r.endLine)?.paramCount??-1}}function E(i,e){let{minCallees:r,scope:s,excludeSymbol:l}=e,o=B(i,s).filter(t=>!i.isIgnored(t.relativePath)).filter(t=>t.isFunctionLike).filter(t=>l===void 0||t.symbol!==l).filter(t=>t.endLine-t.startLine+1>=5).filter(t=>P(t.relativePath)!=="test").filter(t=>!x(t.symbol)).filter(t=>!L(i,t.relativePath,t.startLine)),n=j(i,o);return o.map(t=>({symbol:t.symbol,file:t.relativePath,callees:new Set((n.get(t.symbolId)??[]).map(c=>c.symbol)),paramCount:z(i,t.relativePath,t.startLine,t.endLine)?.paramCount??-1})).filter(t=>t.callees.size>=r)}function G(i,e,r){let s=H(i,e);if(!s||s.tokens.size<3)return[];let l=r.minSimilarity>=.5?r.minSimilarity:.3,o=[];for(let n of Q(i)){if(n.symbol===s.symbol||n.tokens.size<3)continue;let t=w(s.tokens,n.tokens);if(t.size<2)continue;let c=new Set([...s.tokens,...n.tokens]),u=c.size>0?t.size/c.size:0;u<l||o.push({symbolA:s.symbol,shortNameA:b(s.symbol),fileA:s.file,symbolB:n.symbol,shortNameB:b(n.symbol),fileB:n.file,similarity:u,sharedCallees:[...t].sort(),uniqueToA:[...h(s.tokens,n.tokens)].sort(),uniqueToB:[...h(n.tokens,s.tokens)].sort()})}return o.sort((n,t)=>t.similarity-n.similarity||n.shortNameB.localeCompare(t.shortNameB)),o.slice(0,r.limit)}function H(i,e){let r=A(i,e);if(!r||!F(r.symbol))return null;let s=J(i,r);return s?{symbol:r.symbol,file:r.relativePath,tokens:s}:null}function J(i,e){let r=q(e.symbol),s=O(i,e.relativePath,e.startLine,e.endLine,r),l=Z(s,r);return l.size>0?l:null}function Q(i){return $(i).filter(e=>e.isFunctionLike).filter(e=>P(e.relativePath)!=="test").filter(e=>!x(e.symbol)).map(e=>({symbol:e.symbol,file:e.relativePath,tokens:Z(O(i,e.relativePath,e.startLine,e.endLine,e.leaf),e.leaf)})).filter(e=>e.tokens.size>0)}function O(i,e,r,s,l){let o=D(i,e);if(!o)return"";let n=o.split(`
2
+ `);if(s>=r&&s-r<=12)return n.slice(r,s+1).join(`
3
+ `);let t=[new RegExp(`\\bdef\\s+${d(l)}\\b`),new RegExp(`\\bfun\\s+${d(l)}\\b`),new RegExp(`\\bfn\\s+${d(l)}\\b`),new RegExp(`\\bfunction\\s+${d(l)}\\b`),new RegExp(`\\b${d(l)}\\s*\\(`)],c=n.findIndex(u=>t.some(f=>f.test(u)));if(c>=0){let u=c;for(let f=c+1;f<n.length&&f<=c+8;f++){let S=n[f]??"";if(f>c&&X(S)||(u=f,S.trim()===""&&f>c+1))break}return n.slice(c,u+1).join(`
4
+ `)}return n.slice(r,Math.min(n.length,r+8)).join(`
5
+ `)}function Z(i,e){if(!i)return new Set;let r=new Set(["public","private","protected","final","static","class","def","fun","fn","function","return","string","bool","boolean","void","unit","self","this","new","const","let","var","end","pub"]),s=V(e),o=i.replace(/["'`]/g," ").replace(/\b\d+\b/g," NUM ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9_]+/g," ").replace(/_/g," ").toLowerCase().split(/\s+/).map(n=>n.trim()).filter(n=>n.length>1).filter(n=>!r.has(n)).filter(n=>!s.has(n));return new Set(o)}function V(i){return new Set(i.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(e=>e.toLowerCase()).filter(e=>e.length>1))}function X(i){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(i)}function d(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{ae as a,me as b};
6
+ //# sourceMappingURL=chunk-4LBOHXT7.js.map
@@ -0,0 +1,2 @@
1
+ var d={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function l(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let t=e.split(" ");if(t.length<4)return{scheme:t[0]??"",manager:t[1]??"",packageName:t[2]??"",version:"",descriptors:[],raw:e};let s=t[0],i=t[1],r=e.slice(s.length+1+i.length+1),n;if(r.startsWith("`")){let f=r.indexOf("`",1);f===-1?(n=r.slice(1),r=""):(n=r.slice(1,f),r=r.slice(f+2))}else{let f=r.indexOf(" ");f===-1?(n=r,r=""):(n=r.slice(0,f),r=r.slice(f+1))}let c,o=r.indexOf(" ");o===-1?(c=r,r=""):(c=r.slice(0,o),r=r.slice(o+1));let a=m(r);return{scheme:s,manager:i,packageName:n,version:c,descriptors:a,raw:e}}function m(e){let t=[],s=0;for(;s<e.length;){if(e[s]==="["){let n=e.indexOf("]",s+1);if(n===-1){t.push({name:e.slice(s+1),suffix:"type-param"});break}t.push({name:e.slice(s+1,n),suffix:"type-param"}),s=n+1;continue}if(e[s]==="("&&(t.length===0||s===0||u(e[s-1]))){let n=e.indexOf(")",s+1);if(n!==-1&&e[n+1]!=="."){t.push({name:e.slice(s+1,n),suffix:"parameter"}),s=n+1;continue}}let i;if(e[s]==="`"){let n=e.indexOf("`",s+1);if(n===-1){i=e.slice(s+1),t.push({name:i,suffix:"term"});break}i=e.slice(s+1,n),s=n+1}else{let n=s;for(;s<e.length&&!u(e[s]);)s++;i=e.slice(n,s)}if(s>=e.length){i&&t.push({name:i,suffix:"term"});break}let r=e[s];if(r==="("){let n=e.indexOf(")",s+1);n!==-1&&e[n+1]==="."?(t.push({name:i,suffix:"method"}),s=n+2):n!==-1?(t.push({name:i,suffix:"method"}),s=n+1):(t.push({name:i,suffix:"term"}),s++)}else{let n=d[r];n&&t.push({name:i,suffix:n}),s+=1}}return t}function u(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function x(e){let t=l(e);if("kind"in t&&t.kind==="local")return`local:${t.id}`;let s=t;if(s.descriptors.length===0)return s.raw;let i=[];for(let r of s.descriptors){let n=r.name;r.suffix==="namespace"&&(n=n.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)$/,"")),n&&(r.suffix==="method"?i.push(`${n}()`):i.push(n))}return i.join(":")}function S(e){let t=l(e);if("kind"in t&&t.kind==="local")return t.id;let s=t;return s.descriptors.length===0?"":s.descriptors[s.descriptors.length-1].name}function p(e){let t=l(e);if("kind"in t&&t.kind==="local")return null;let s=t;return s.descriptors[s.descriptors.length-1]?.suffix??null}function b(e){return e.endsWith("().")||p(e)==="method"}function y(e){let t=p(e);return t==="method"||t==="term"}function k(e){return p(e)==="namespace"}var h=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function D(e){return h.test(e)}var g=new Set(["test","tests","_tests"]);function $(e){let t=l(e);if("kind"in t)return!1;for(let s=0;s<t.descriptors.length-1;s+=1){let i=t.descriptors[s];if(i?.suffix==="namespace"&&i.name&&g.has(i.name))return!0}return!1}function T(e,t){let s=l(e),i=l(t);if("kind"in s||"kind"in i)return!1;let r=s.descriptors,n=i.descriptors;if(n.length!==r.length+1)return!1;for(let c=0;c<r.length;c++){let o=r[c],a=n[c];if(o.name!==a.name||o.suffix!==a.suffix)return!1}return!0}function M(e,t){let s=l(e),i=l(t);if("kind"in s||"kind"in i)return!1;let r=s.descriptors,n=i.descriptors;if(n.length<=r.length)return!1;for(let c=0;c<r.length;c++){let o=r[c],a=n[c];if(o.name!==a.name||o.suffix!==a.suffix)return!1}return!0}export{l as a,x as b,S as c,p as d,b as e,y as f,k as g,D as h,$ as i,T as j,M as k};
2
+ //# sourceMappingURL=chunk-5IM4IQ6N.js.map
@@ -1,7 +1,7 @@
1
- import{h as g}from"./chunk-WCDXJGYT.js";import{a as b}from"./chunk-LX4H4LLG.js";import{b as m}from"./chunk-TINPMWJK.js";import{readFileSync as y}from"fs";import{join as d}from"path";function I(o,i){let t=b(o,i);if(!t)return null;let l=o.get("SELECT language FROM documents WHERE relative_path = ?",t.relativePath)?.language??"unknown",s=d(o.config.projectRoot,t.relativePath),n="";try{n=y(s,"utf-8").split(`
1
+ import{k as g}from"./chunk-3FG3VLK3.js";import{a as b}from"./chunk-7NEBSLI3.js";import{b as m}from"./chunk-5IM4IQ6N.js";import{readFileSync as y}from"fs";import{join as d}from"path";function I(o,i){let t=b(o,i);if(!t)return null;let l=o.get("SELECT language FROM documents WHERE relative_path = ?",t.relativePath)?.language??"unknown",s=d(o.config.projectRoot,t.relativePath),n="";try{n=y(s,"utf-8").split(`
2
2
  `).slice(t.startLine,t.endLine+1).join(`
3
3
  `)}catch{}let e=S(n,l),f=t.endLine-t.startLine+1,a=g(o,[t],{additive:!0}).get(t.symbolId)??[],p=new Set(a.map(r=>r.symbol)),u=o.get(`SELECT COUNT(DISTINCT c.document_id) AS c
4
4
  FROM mentions m
5
5
  JOIN chunks c ON m.chunk_id = c.id
6
6
  WHERE m.symbol_id = ? AND m.role != 1`,t.symbolId),h=new Set(a.filter(r=>r.file!==t.relativePath).map(r=>r.symbol)).size;return{symbol:t.symbol,shortName:m(t.symbol),relativePath:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:f,branches:e,cyclomaticEstimate:e+1,calleeCount:p.size,fanIn:u?.c??0,fanOut:h}}function S(o,i){let t=P(o),c=0,l=[/\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 s of l){let n=t.match(s);n&&(c+=n.length)}if(i==="python"){let s=[/\belif\b/g,/\bexcept\b/g,/\bfinally\b/g];for(let n of s){let e=t.match(n);e&&(c+=e.length)}}else if(i==="rust"){let s=[/\bmatch\b/g,/=>/g,/\bloop\b/g];for(let n of s){let e=t.match(n);e&&(c+=e.length)}}else if(i==="ruby"){let s=[/\belsif\b/g,/\bunless\b/g,/\brescue\b/g,/\bwhen\b/g];for(let n of s){let e=t.match(n);e&&(c+=e.length)}}else if(i==="go"){let s=[/\bselect\b/g,/\bdefer\b/g];for(let n of s){let e=t.match(n);e&&(c+=e.length)}}return c}function P(o){return o.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*/g,"").replace(/#.*/g,"").replace(/"(?:[^"\\]|\\.)*"/g,'""').replace(/'(?:[^'\\]|\\.)*'/g,"''").replace(/`(?:[^`\\]|\\.)*`/g,"``")}export{I as a};
7
- //# sourceMappingURL=chunk-BDBRZPX3.js.map
7
+ //# sourceMappingURL=chunk-5NRGSXZQ.js.map
@@ -0,0 +1,5 @@
1
+ import{d as T}from"./chunk-QSTMORTI.js";import{m as I}from"./chunk-3FG3VLK3.js";import{d as k}from"./chunk-6XP3KWHC.js";import{a as M,d as y,e as D,f as P,h as w,j as A,r as C}from"./chunk-SPMLGXCE.js";import{a as x,b as F,c as b}from"./chunk-5IM4IQ6N.js";function ie(t,s){let{scope:n,minLoc:r=3,maxLoc:i=80,limit:o=30,includeLowConfidence:c=!1}=s??{},a=E(t,n),l=C(t,n).filter(e=>e.isTypeLike&&L(e)>=r).filter(e=>L(e)<=i).filter(e=>!t.isIgnored(e.relativePath)).filter(e=>!$(e.symbol)).filter(e=>!D(t,e.relativePath,e.startLine)),f=I(t,l),u=T(t,l),g=q(f,u),d=new Map;for(let e of l){let m=d.get(e.relativePath);m||(m=new Map,d.set(e.relativePath,m));let p=b(e.symbol);p&&m.set(p,e)}return l.map(e=>{let p=[...g.get(e.symbolId)??new Set].filter(v=>v!==e.relativePath&&!t.isIgnored(v)),{realConsumers:h,barrelConsumers:S}=O(t,e.relativePath,e.symbol,p),R=U(t,e,g,d);return{definition:e,realConsumers:h,barrelConsumers:S,transitivelyReachable:R}}).filter(e=>!e.transitivelyReachable).filter(e=>e.realConsumers.length<=1).filter(e=>!(e.realConsumers.length===0&&e.barrelConsumers>0)).filter(e=>N(e.definition,e.realConsumers.length,a)).map(e=>{let m=G(t,e.definition.relativePath,e.definition.startLine),p=_(e.definition.relativePath)?!0:H(t,e.definition),{confidence:h,reason:S}=K(e.realConsumers.length,m,p);return{symbol:e.definition.symbol,shortName:F(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:L(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:m,definerUsesType:p,confidence:h,reason:S}}).filter(e=>c||e.confidence!=="low").sort((e,m)=>{let p={high:0,medium:1,low:2};return p[e.confidence]-p[m.confidence]||m.loc-e.loc||e.file.localeCompare(m.file)||e.startLine-m.startLine}).slice(0,o)}function E(t,s){return new Set(C(t,s).filter(n=>n.isFunctionLike).map(n=>n.relativePath))}function $(t){let s=x(t);if("kind"in s)return!1;let n=s.descriptors;if(n.length<2)return!1;let r=n[n.length-1],i=n[n.length-2];return r?.suffix==="type"&&i?.suffix==="type"}function _(t){let n=(t.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(n==="types"||n==="models"||n==="schema"||n==="common"||n==="protocol"||n==="proto"||n==="dto"||n==="mod"||/(^|\/)types(\/|\.)/.test(t)||/(^|\/)models?(\/|\.)/.test(t)||/(^|\/)proto(?:col)?(\/|\.)/.test(t)||/(^|\/)schema(\/|\.)/.test(t))}function N(t,s,n){return!(_(t.relativePath)&&s>0||s===0&&n.has(t.relativePath))}function O(t,s,n,r){let i=[],o=0,c=b(n);for(let a of r)z(t,a,s,c)||B(t,a,c)?o++:i.push(a);return{realConsumers:i,barrelConsumers:o}}function U(t,s,n,r){let i=A(t,s.relativePath),o=b(s.symbol);if(!o)return!1;let c=i.get(o);if(!c||c.size===0)return!1;let a=r.get(s.relativePath);if(!a)return!1;for(let l of c){let f=a.get(l);if(!f)continue;let u=n.get(f.symbolId);if(u){for(let g of u)if(g!==s.relativePath&&!t.isIgnored(g))return!0}}return!1}var j=M("stale-abs-file-usage");function B(t,s,n){if(!n)return!1;let r=P(s);if(!r)return!1;let i=j.get(t,s,()=>W(t,s,r));return i.importedLeaves.has(n)&&!i.usedLeaves.has(n)}function W(t,s,n){let r=new Set,i=new Set,o=w(t,s);if(!o)return{importedLeaves:r,usedLeaves:i};let c=n==="rust"?new Set(["use_declaration"]):n==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),a=(l,f)=>{let u=f||c.has(l.type);(l.type==="identifier"||l.type==="type_identifier"||l.type==="property_identifier"||l.type==="field_identifier")&&(u?r.add(l.text):i.add(l.text));for(let g of l.children)a(g,u)};return a(o.rootNode,!1),{importedLeaves:r,usedLeaves:i}}function z(t,s,n,r){if(!r)return!1;let i=y(t,s);if(!i)return!1;let o=k(t,s);if(o.length===0)return!1;let c=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`\\b${c}\\b`),l=i.split(`
2
+ `),f=0;for(let u=0;u<l.length;u++){if(!a.test(l[u]??""))continue;if(f++,!o.find(d=>d.startLine<=u&&u<=d.endLine))return!1}return f>0}function G(t,s,n){let r=y(t,s);if(!r)return"other";let i=r.split(`
3
+ `),o=Math.max(0,n-2),c=Math.min(i.length-1,n+2);for(let a=o;a<=c;a++){let f=(i[a]??"").replace(/^\s*\/\/.*$/g,"");if(/\b(?:export\s+)?(?:abstract\s+)?class\s+\w/.test(f))return"class";if(/\b(?:export\s+)?interface\s+\w/.test(f))return"interface";if(/\b(?:export\s+)?type\s+\w/.test(f))return"type";if(/\b(?:export\s+)?(?:const\s+)?enum\s+\w/.test(f))return"enum"}return"other"}function H(t,s){let n=y(t,s.relativePath);if(!n)return!1;let r=b(s.symbol);if(!r)return!1;let i=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`\\b${i}\\b`),c=n.split(`
4
+ `);for(let a=0;a<c.length;a++)if(!(a>=s.startLine&&a<=s.endLine)&&o.test(c[a]??""))return!0;return!1}function K(t,s,n){return t===0?{confidence:"high",reason:"unused \u2014 no consumers and defining file has no real usage"}:t===1&&s==="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"}}function L(t){return t.endLine-t.startLine+1}function q(...t){let s=new Map;for(let n of t)for(let[r,i]of n){let o=s.get(r);o||(o=new Set,s.set(r,o));for(let c of i)o.add(c)}return s}export{ie as a};
5
+ //# sourceMappingURL=chunk-5V76WMMZ.js.map
@@ -1,2 +1,2 @@
1
- import{e as f}from"./chunk-WCDXJGYT.js";import{a as m}from"./chunk-LX4H4LLG.js";import{b as r}from"./chunk-TINPMWJK.js";function w(i,g,p){let s=m(i,g),n=m(i,p);if(!s||!n)return null;let c=new Set(f(i,s).map(e=>e.symbol)),h=new Set(f(i,n).map(e=>e.symbol)),a=[];for(let e of c)h.has(e)&&a.push(e);let o=[];for(let e of c)h.has(e)||o.push(e);let l=[];for(let e of h)c.has(e)||l.push(e);let u=new Set([...c,...h]),d=u.size>0?a.length/u.size:0,t;u.size===0?t="Neither function calls other tracked symbols. There is no callee-pattern evidence for consolidation; inspect the source bodies directly.":a.length===0?t="These functions do not share any callees. They are not a callee-based consolidation candidate.":o.length===0&&l.length===0?t="These functions have identical tracked callee sets. They are a strong structural match, but identical callees do not prove interchangeable semantics; inspect signatures, control flow, and return values before consolidating.":o.length===0?t="A's tracked callees are a subset of B's. B may subsume part of A's structure, but verify signatures, guards, and non-call logic before replacing A with B.":l.length===0?t="B's tracked callees are a subset of A's. A may subsume part of B's structure, but verify signatures, guards, and non-call logic before replacing B with A.":o.length<=2&&l.length<=2?t=`Create a shared function with the ${a.length} common callees. Pass the ${o.length+l.length} divergent callees as parameters or strategy callbacks.`:t=`Extract the ${a.length} shared callees into a common helper. Each function calls the helper plus its own unique logic (${o.length} callees in A, ${l.length} in B).`;let y=s.endLine-s.startLine+1,b=n.endLine-n.startLine+1;return{symbolA:{symbol:s.symbol,shortName:r(s.symbol),file:s.relativePath,loc:y},symbolB:{symbol:n.symbol,shortName:r(n.symbol),file:n.relativePath,loc:b},similarity:d,sharedCallees:a.map(r),uniqueToA:o.map(r),uniqueToB:l.map(r),consolidationStrategy:t}}export{w as a};
2
- //# sourceMappingURL=chunk-HMKJTAZD.js.map
1
+ import{h as f}from"./chunk-3FG3VLK3.js";import{a as m}from"./chunk-7NEBSLI3.js";import{b as r}from"./chunk-5IM4IQ6N.js";function w(i,g,p){let s=m(i,g),n=m(i,p);if(!s||!n)return null;let c=new Set(f(i,s).map(e=>e.symbol)),h=new Set(f(i,n).map(e=>e.symbol)),a=[];for(let e of c)h.has(e)&&a.push(e);let o=[];for(let e of c)h.has(e)||o.push(e);let l=[];for(let e of h)c.has(e)||l.push(e);let u=new Set([...c,...h]),d=u.size>0?a.length/u.size:0,t;u.size===0?t="Neither function calls other tracked symbols. There is no callee-pattern evidence for consolidation; inspect the source bodies directly.":a.length===0?t="These functions do not share any callees. They are not a callee-based consolidation candidate.":o.length===0&&l.length===0?t="These functions have identical tracked callee sets. They are a strong structural match, but identical callees do not prove interchangeable semantics; inspect signatures, control flow, and return values before consolidating.":o.length===0?t="A's tracked callees are a subset of B's. B may subsume part of A's structure, but verify signatures, guards, and non-call logic before replacing A with B.":l.length===0?t="B's tracked callees are a subset of A's. A may subsume part of B's structure, but verify signatures, guards, and non-call logic before replacing B with A.":o.length<=2&&l.length<=2?t=`Create a shared function with the ${a.length} common callees. Pass the ${o.length+l.length} divergent callees as parameters or strategy callbacks.`:t=`Extract the ${a.length} shared callees into a common helper. Each function calls the helper plus its own unique logic (${o.length} callees in A, ${l.length} in B).`;let y=s.endLine-s.startLine+1,b=n.endLine-n.startLine+1;return{symbolA:{symbol:s.symbol,shortName:r(s.symbol),file:s.relativePath,loc:y},symbolB:{symbol:n.symbol,shortName:r(n.symbol),file:n.relativePath,loc:b},similarity:d,sharedCallees:a.map(r),uniqueToA:o.map(r),uniqueToB:l.map(r),consolidationStrategy:t}}export{w as a};
2
+ //# sourceMappingURL=chunk-5VU2RVKI.js.map
@@ -1,4 +1,4 @@
1
- import{f as d}from"./chunk-WCDXJGYT.js";import{q as l}from"./chunk-IYFZS4PV.js";import{b as r}from"./chunk-TINPMWJK.js";function y(o,t={}){let{limit:s=30,scope:e}=t,n=e?`AND def_d.relative_path LIKE '%${e}%'`:"",m=o.all(`SELECT
1
+ import{i as d}from"./chunk-3FG3VLK3.js";import{q as l}from"./chunk-SPMLGXCE.js";import{b as r}from"./chunk-5IM4IQ6N.js";function y(o,t={}){let{limit:s=30,scope:e}=t,n=e?`AND def_d.relative_path LIKE '%${e}%'`:"",m=o.all(`SELECT
2
2
  gs.symbol,
3
3
  COUNT(*) AS ref_count,
4
4
  COUNT(DISTINCT ref_d.id) AS file_count,
@@ -22,4 +22,4 @@ import{f as d}from"./chunk-WCDXJGYT.js";import{q as l}from"./chunk-IYFZS4PV.js";
22
22
  GROUP BY gs.id
23
23
  ORDER BY ref_count DESC
24
24
  LIMIT ?`,s).filter(i=>!o.isIgnored(i.defined_in)).map(i=>({symbol:i.symbol,shortName:r(i.symbol),refCount:i.ref_count,fileCount:i.file_count,definedIn:i.defined_in}));return m.length>0?m:f(o,e,s)}function f(o,t,s){return l(o,{scope:t}).filter(e=>!o.isIgnored(e.relativePath)).map(e=>u(o,e)).filter(e=>e.refCount>0).sort((e,n)=>n.refCount-e.refCount||n.fileCount-e.fileCount).slice(0,s)}function u(o,t){let s=d(o,t,{limit:500});return{symbol:t.symbol,shortName:r(t.symbol),refCount:s.length,fileCount:new Set(s.map(e=>e.file)).size,definedIn:t.relativePath}}export{y as a};
25
- //# sourceMappingURL=chunk-NTDA4A2D.js.map
25
+ //# sourceMappingURL=chunk-5W22HCSF.js.map
@@ -1,2 +1,2 @@
1
- import{d as y}from"./chunk-WCDXJGYT.js";function L(D,k={}){let{limit:x=10,scope:M,minDepth:j=3}=k,g=y(D,M),u=new Map,o=[],l=new Map,r=new Map,a=new Set,f=[],d=0;for(let t of g.keys()){if(l.has(t))continue;let n=[],s=(g.get(t)??new Set).values();for(l.set(t,d),r.set(t,d),d+=1,f.push(t),a.add(t),n.push({node:t,iter:s,pendingChild:null});n.length>0;){let e=n[n.length-1];if(e.pendingChild!==null){let h=e.pendingChild;e.pendingChild=null,r.set(e.node,Math.min(r.get(e.node),r.get(h)))}let c=e.iter.next();if(c.done){if(r.get(e.node)===l.get(e.node)){let h=[];for(;;){let p=f.pop();if(a.delete(p),h.push(p),u.set(p,o.length),p===e.node)break}o.push(h)}n.pop();continue}let i=c.value;if(l.has(i))a.has(i)&&r.set(e.node,Math.min(r.get(e.node),l.get(i)));else{l.set(i,d),r.set(i,d),d+=1,f.push(i),a.add(i);let h=(g.get(i)??new Set).values();e.pendingChild=i,n.push({node:i,iter:h,pendingChild:null})}}}let m=new Map,b=new Array(o.length);for(let t=0;t<o.length;t++)b[t]=o[t].length,m.set(t,new Set);for(let[t,n]of g){let s=u.get(t);for(let e of n){let c=u.get(e);c!==s&&m.get(s).add(c)}}let S=new Array(o.length),I=new Array(o.length);for(let t=0;t<o.length;t++){let n=[],s=0;for(let e of m.get(t)){let c=I[e];c>s&&(s=c,n=S[e])}S[t]=[t,...n],I[t]=b[t]+s}function v(t){return S[t]}let A=o.map(t=>[...t].sort()),C=new Set,w=[];for(let t=0;t<o.length;t++){let n=v(t),s=[];for(let c of n)s.push(...A[c]);if(s.length<j)continue;let e=s.join(" ");C.has(e)||(C.add(e),w.push({chain:s,depth:s.length}))}return w.sort((t,n)=>n.depth-t.depth),w.slice(0,x)}export{L as a};
2
- //# sourceMappingURL=chunk-IBGBI3VU.js.map
1
+ import{g as y}from"./chunk-3FG3VLK3.js";function L(D,k={}){let{limit:x=10,scope:M,minDepth:j=3}=k,g=y(D,M),u=new Map,o=[],l=new Map,r=new Map,a=new Set,f=[],d=0;for(let t of g.keys()){if(l.has(t))continue;let n=[],s=(g.get(t)??new Set).values();for(l.set(t,d),r.set(t,d),d+=1,f.push(t),a.add(t),n.push({node:t,iter:s,pendingChild:null});n.length>0;){let e=n[n.length-1];if(e.pendingChild!==null){let h=e.pendingChild;e.pendingChild=null,r.set(e.node,Math.min(r.get(e.node),r.get(h)))}let c=e.iter.next();if(c.done){if(r.get(e.node)===l.get(e.node)){let h=[];for(;;){let p=f.pop();if(a.delete(p),h.push(p),u.set(p,o.length),p===e.node)break}o.push(h)}n.pop();continue}let i=c.value;if(l.has(i))a.has(i)&&r.set(e.node,Math.min(r.get(e.node),l.get(i)));else{l.set(i,d),r.set(i,d),d+=1,f.push(i),a.add(i);let h=(g.get(i)??new Set).values();e.pendingChild=i,n.push({node:i,iter:h,pendingChild:null})}}}let m=new Map,b=new Array(o.length);for(let t=0;t<o.length;t++)b[t]=o[t].length,m.set(t,new Set);for(let[t,n]of g){let s=u.get(t);for(let e of n){let c=u.get(e);c!==s&&m.get(s).add(c)}}let S=new Array(o.length),I=new Array(o.length);for(let t=0;t<o.length;t++){let n=[],s=0;for(let e of m.get(t)){let c=I[e];c>s&&(s=c,n=S[e])}S[t]=[t,...n],I[t]=b[t]+s}function v(t){return S[t]}let A=o.map(t=>[...t].sort()),C=new Set,w=[];for(let t=0;t<o.length;t++){let n=v(t),s=[];for(let c of n)s.push(...A[c]);if(s.length<j)continue;let e=s.join(" ");C.has(e)||(C.add(e),w.push({chain:s,depth:s.length}))}return w.sort((t,n)=>n.depth-t.depth),w.slice(0,x)}export{L as a};
2
+ //# sourceMappingURL=chunk-67UXTIFZ.js.map
@@ -1,2 +1,2 @@
1
- import{q as p}from"./chunk-IYFZS4PV.js";import{a as d,b as f,d as u}from"./chunk-TINPMWJK.js";var m={0:"UnspecifiedKind",1:"AbstractMethod",2:"Accessor",3:"Array",4:"Assertion",5:"AssociatedType",6:"Attribute",7:"Axiom",8:"Boolean",9:"Class",10:"Constant",11:"Constructor",12:"Contract",13:"DataFamily",14:"DefinitionMacro",15:"Delegate",16:"Enum",17:"EnumMember",18:"Error",19:"Event",20:"Fact",21:"Field",22:"File",23:"Function",24:"Getter",25:"Grammar",26:"Instance",27:"Interface",28:"Key",29:"Lang",30:"Lemma",31:"Library",32:"Macro",33:"Method",34:"MethodAlias",35:"MethodReceiver",36:"MethodSpecification",37:"Message",38:"Modifier",39:"Module",40:"Namespace",41:"Null",42:"Number",43:"Object",44:"Operator",45:"Package",46:"PackageObject",47:"Parameter",48:"ParameterLabel",49:"Pattern",50:"Predicate",51:"Property",52:"Protocol",53:"ProtocolMethod",54:"PureVirtualMethod",55:"Quasiquoter",56:"SelfParameter",57:"Setter",58:"Signature",59:"SingletonClass",60:"SingletonMethod",61:"StaticDataMember",62:"StaticEvent",63:"StaticField",64:"StaticMethod",65:"StaticProperty",66:"StaticVariable",67:"String",68:"Struct",69:"Subscript",70:"Tactic",71:"Theorem",72:"ThisParameter",73:"Trait",74:"TraitMethod",75:"Type",76:"TypeAlias",77:"TypeClass",78:"TypeClassMethod",79:"TypeFamily",80:"TypeParameter",81:"Union",82:"Value",83:"Variable"},c=new Map;for(let[e,i]of Object.entries(m))c.set(i.toLowerCase(),Number(e));function g(e){let i=parseInt(e,10);if(!isNaN(i))return i;let s=e.toLowerCase(),n=c.get(s);if(n!==void 0)return n;for(let[r,o]of c)if(r.includes(s))return o;return null}function N(e,i,s={}){let{scope:n,limit:r=100}=s,o=g(i);return o===null?[]:b(e,n).map(t=>({row:t,resolvedKind:y(t)})).filter(t=>t.resolvedKind===o).slice(0,r).map(({row:t,resolvedKind:l})=>({symbol:t.symbol,shortName:f(t.symbol),kind:l,kindName:m[l]??"Unknown",relativePath:t.relative_path,startLine:t.start_line,endLine:t.end_line}))}function P(e,i={}){let s=new Map;for(let n of b(e,i.scope)){let r=y(n);r===null||r===0||s.set(r,(s.get(r)??0)+1)}return[...s.entries()].sort((n,r)=>r[1]-n[1]||n[0]-r[0]).map(([n,r])=>({kind:n,kindName:m[n]??"Unknown",count:r}))}function b(e,i){return p(e,{scope:i}).map(S)}function S(e){return{symbol:e.symbol,kind:e.kind,documentation:e.documentation,enclosing_symbol:e.enclosingSymbol,relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine}}function y(e){return e.kind!==null&&e.kind!==0?h(e.kind,e.symbol,e.documentation):M(e.symbol,e.documentation,e.enclosing_symbol)}function h(e,i,s){let n=(s??"").toLowerCase();if(u(i)==="type"){if(n.includes("type "))return 76;if(n.includes("interface "))return 27;if(n.includes("struct "))return 68;if(n.includes("trait "))return 73;if(n.includes("class "))return 9}return e}function M(e,i,s){let n=d(e);if("kind"in n)return null;let r=n.descriptors,o=r[r.length-2]??null,a=u(e),t=(i??"").toLowerCase();return a==="type"?t.includes("type ")?76:t.includes("interface ")?27:t.includes("struct ")?68:t.includes("trait ")?73:(t.includes("class "),9):a==="method"?o?.suffix==="type"?33:23:a==="namespace"?39:a!=="term"?null:t.includes("async def ")||t.includes("def ")?23:(s?u(s):o?.suffix??null)==="type"?21:83}export{N as a,P as b};
2
- //# sourceMappingURL=chunk-SDX6MDBL.js.map
1
+ import{q as p}from"./chunk-SPMLGXCE.js";import{a as d,b as f,d as u}from"./chunk-5IM4IQ6N.js";var m={0:"UnspecifiedKind",1:"AbstractMethod",2:"Accessor",3:"Array",4:"Assertion",5:"AssociatedType",6:"Attribute",7:"Axiom",8:"Boolean",9:"Class",10:"Constant",11:"Constructor",12:"Contract",13:"DataFamily",14:"DefinitionMacro",15:"Delegate",16:"Enum",17:"EnumMember",18:"Error",19:"Event",20:"Fact",21:"Field",22:"File",23:"Function",24:"Getter",25:"Grammar",26:"Instance",27:"Interface",28:"Key",29:"Lang",30:"Lemma",31:"Library",32:"Macro",33:"Method",34:"MethodAlias",35:"MethodReceiver",36:"MethodSpecification",37:"Message",38:"Modifier",39:"Module",40:"Namespace",41:"Null",42:"Number",43:"Object",44:"Operator",45:"Package",46:"PackageObject",47:"Parameter",48:"ParameterLabel",49:"Pattern",50:"Predicate",51:"Property",52:"Protocol",53:"ProtocolMethod",54:"PureVirtualMethod",55:"Quasiquoter",56:"SelfParameter",57:"Setter",58:"Signature",59:"SingletonClass",60:"SingletonMethod",61:"StaticDataMember",62:"StaticEvent",63:"StaticField",64:"StaticMethod",65:"StaticProperty",66:"StaticVariable",67:"String",68:"Struct",69:"Subscript",70:"Tactic",71:"Theorem",72:"ThisParameter",73:"Trait",74:"TraitMethod",75:"Type",76:"TypeAlias",77:"TypeClass",78:"TypeClassMethod",79:"TypeFamily",80:"TypeParameter",81:"Union",82:"Value",83:"Variable"},c=new Map;for(let[e,i]of Object.entries(m))c.set(i.toLowerCase(),Number(e));function g(e){let i=parseInt(e,10);if(!isNaN(i))return i;let s=e.toLowerCase(),n=c.get(s);if(n!==void 0)return n;for(let[r,o]of c)if(r.includes(s))return o;return null}function N(e,i,s={}){let{scope:n,limit:r=100}=s,o=g(i);return o===null?[]:b(e,n).map(t=>({row:t,resolvedKind:y(t)})).filter(t=>t.resolvedKind===o).slice(0,r).map(({row:t,resolvedKind:l})=>({symbol:t.symbol,shortName:f(t.symbol),kind:l,kindName:m[l]??"Unknown",relativePath:t.relative_path,startLine:t.start_line,endLine:t.end_line}))}function P(e,i={}){let s=new Map;for(let n of b(e,i.scope)){let r=y(n);r===null||r===0||s.set(r,(s.get(r)??0)+1)}return[...s.entries()].sort((n,r)=>r[1]-n[1]||n[0]-r[0]).map(([n,r])=>({kind:n,kindName:m[n]??"Unknown",count:r}))}function b(e,i){return p(e,{scope:i}).map(S)}function S(e){return{symbol:e.symbol,kind:e.kind,documentation:e.documentation,enclosing_symbol:e.enclosingSymbol,relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine}}function y(e){return e.kind!==null&&e.kind!==0?h(e.kind,e.symbol,e.documentation):M(e.symbol,e.documentation,e.enclosing_symbol)}function h(e,i,s){let n=(s??"").toLowerCase();if(u(i)==="type"){if(n.includes("type "))return 76;if(n.includes("interface "))return 27;if(n.includes("struct "))return 68;if(n.includes("trait "))return 73;if(n.includes("class "))return 9}return e}function M(e,i,s){let n=d(e);if("kind"in n)return null;let r=n.descriptors,o=r[r.length-2]??null,a=u(e),t=(i??"").toLowerCase();return a==="type"?t.includes("type ")?76:t.includes("interface ")?27:t.includes("struct ")?68:t.includes("trait ")?73:(t.includes("class "),9):a==="method"?o?.suffix==="type"?33:23:a==="namespace"?39:a!=="term"?null:t.includes("async def ")||t.includes("def ")?23:(s?u(s):o?.suffix??null)==="type"?21:83}export{N as a,P as b};
2
+ //# sourceMappingURL=chunk-6ALIV5SZ.js.map
@@ -1,4 +1,4 @@
1
- import{e as a,f as c}from"./chunk-WCDXJGYT.js";import{q as d}from"./chunk-IYFZS4PV.js";import{b as l}from"./chunk-TINPMWJK.js";function E(e,t={}){let{limit:m=20,scope:s,minFanIn:n=2,minFanOut:f=2}=t,_=s?`AND def_d.relative_path LIKE '%${s}%'`:"",r=e.all(`SELECT * FROM (
1
+ import{h as a,i as c}from"./chunk-3FG3VLK3.js";import{q as d}from"./chunk-SPMLGXCE.js";import{b as l}from"./chunk-5IM4IQ6N.js";function E(e,t={}){let{limit:m=20,scope:s,minFanIn:n=2,minFanOut:f=2}=t,_=s?`AND def_d.relative_path LIKE '%${s}%'`:"",r=e.all(`SELECT * FROM (
2
2
  SELECT
3
3
  gs.symbol,
4
4
  def_d.relative_path AS defined_in,
@@ -38,4 +38,4 @@ import{e as a,f as c}from"./chunk-WCDXJGYT.js";import{q as d}from"./chunk-IYFZS4
38
38
  ) WHERE fan_in >= ? AND fan_out >= ?
39
39
  ORDER BY (fan_in * fan_out) DESC
40
40
  LIMIT ?`,n,f,m).filter(o=>!e.isIgnored(o.defined_in)).map(o=>({symbol:o.symbol,shortName:l(o.symbol),fanIn:o.fan_in,fanOut:o.fan_out,score:o.fan_in*o.fan_out,definedIn:o.defined_in}));return r.length>0?r:u(e,s,{minFanIn:n,minFanOut:f,limit:m})}function u(e,t,m){let{minFanIn:s,minFanOut:n,limit:f}=m;return d(e,{scope:t}).filter(i=>!e.isIgnored(i.relativePath)).map(i=>b(e,i)).filter(i=>i.fanIn>=s&&i.fanOut>=n).sort((i,r)=>r.score-i.score||r.fanIn-i.fanIn).slice(0,f)}function b(e,t){let m=new Set(c(e,t,{limit:500}).map(n=>n.file)).size,s=new Set(a(e,t,{limit:500}).filter(n=>n.file!==t.relativePath).map(n=>`${n.symbol}|${n.file}`)).size;return{symbol:t.symbol,shortName:l(t.symbol),fanIn:m,fanOut:s,score:m*s,definedIn:t.relativePath}}export{E as a};
41
- //# sourceMappingURL=chunk-K5FQFCSN.js.map
41
+ //# sourceMappingURL=chunk-6CTMG3IF.js.map
@@ -1,8 +1,8 @@
1
- import{a as B,b as ie,c as ae,d as G,f as F,g as ce,h as S}from"./chunk-IYFZS4PV.js";import{existsSync as ve,readFileSync as Ae}from"fs";import{join as Oe}from"path";import{existsSync as w}from"fs";import{basename as Le,dirname as j,extname as R,join as E,relative as A,resolve as P}from"path";var qe=ie("indexed-paths"),H=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],K=[".py",".pyi"],C=[".java",".scala",".kt",".kts"],Z=[".rs"],ee=[".rb"],pe=[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],L=[".cs",".vb"],te=[".dart"],X=[".php"],Ue=[H,K,C,Z,ee,pe,L,te,X];function $(e,r){return r.includes(R(e).toLowerCase())}function We(e){return $(e,K)}function Be(e){return $(e,C)}function Xe(e){return $(e,Z)}function Je(e){return $(e,ee)}function Fe(e){return $(e,pe)}function He(e){return $(e,L)}function le(e){return R(e).toLowerCase()===".vb"}function ze(e){return $(e,te)}function Ve(e){return $(e,X)}function re(e){let r=R(e).toLowerCase();for(let t of Ue)if(t.includes(r))return t;return H}function Qe(e){return Be(e)||He(e)||Ve(e)}function O(e,r,t){return We(r)?q(e,r,t):Xe(r)?T(e,r,t):Je(r)?z(e,r,t):Fe(r)?V(e,r,t):Qe(r)?g(e,t.replace(/\\/g,"."),re(r)):ze(r)?Q(e,r,t):Ye(e,r,t)}function Ye(e,r,t){if(!t.startsWith(".")&&!t.startsWith("/"))return null;let n=j(E(e.config.projectRoot,r)),s=P(n,t),o=M(e);for(let i of tt(s)){let a=b(A(e.config.projectRoot,i));if(o.has(a)||w(i))return a}return b(A(e.config.projectRoot,s))}function q(e,r,t){let n=M(e),s;if(t.startsWith(".")){let o=t.match(/^(\.+)(.*)$/);if(!o)return null;let i=o[1].length,a=o[2].replace(/^\./,""),c=j(E(e.config.projectRoot,r));for(let p=1;p<i;p++)c=j(c);s=a?P(c,a.replace(/\./g,"/")):c}else s=P(e.config.projectRoot,t.replace(/\./g,"/"));for(let o of Ge(s)){let i=b(A(e.config.projectRoot,o));if(n.has(i)||w(o))return i}return null}function T(e,r,t){if(!t)return null;let n=t.replace(/\s+as\s+.+$/,"").trim();if(!n.startsWith("crate::")&&!n.startsWith("self::")&&!n.startsWith("super::"))return null;let s=j(E(e.config.projectRoot,r)),o;n.startsWith("crate::")?o=P(e.config.projectRoot,"src",n.slice(7).replace(/::/g,"/")):n.startsWith("self::")?o=P(s,n.slice(6).replace(/::/g,"/")):o=P(j(s),n.slice(7).replace(/::/g,"/"));for(let i of Ke(o)){let a=b(A(e.config.projectRoot,i));if(M(e).has(a)||w(i))return a}return null}function z(e,r,t){let n=j(E(e.config.projectRoot,r)),s=P(n,t);for(let o of Ze(s)){let i=b(A(e.config.projectRoot,o));if(M(e).has(i)||w(o))return i}return null}function V(e,r,t){let n=M(e),s=j(E(e.config.projectRoot,r)),o=[P(s,t),P(e.config.projectRoot,t),P(e.config.projectRoot,"include",t),P(e.config.projectRoot,"src",t)];for(let i of o){let a=b(A(e.config.projectRoot,i));if(n.has(a)||w(i))return a}return null}function g(e,r,t){let n=M(e),s=r.replace(/\\/g,".").replace(/::/g,".").replace(/^global::/,""),o=s.replace(/\./g,"/"),i=s.split(".").pop()??s;for(let c of t){let p=`${o}${c}`,l=[...n].find(u=>u.endsWith(p));if(l)return l}for(let c of t){let p=[...n].find(l=>Le(l)===`${i}${c}`);if(p)return p}let a=[...n].filter(c=>t.includes(R(c).toLowerCase())).filter(c=>c.includes(`/${o}/`)||c.includes(`/${i}/`)).sort((c,p)=>c.localeCompare(p));return a.length===1?a[0]:null}function Q(e,r,t){let n=M(e);if(t.startsWith("package:")){let i=t.slice(8),a=i.indexOf("/");if(a<0)return null;let c=i.slice(a+1),p=b(c.startsWith("lib/")?c:`lib/${c}`);return n.has(p)?p:null}let s=j(E(e.config.projectRoot,r)),o=P(s,t);for(let i of et(o)){let a=b(A(e.config.projectRoot,i));if(n.has(a)||w(i))return a}return null}function Ge(e){let r=R(e);return K.includes(r)?[e]:[`${e}.py`,`${e}.pyi`,E(e,"__init__.py"),E(e,"__init__.pyi")]}function Ke(e){let r=R(e);return Z.includes(r)?[e]:[`${e}.rs`,E(e,"mod.rs")]}function Ze(e){let r=R(e);return ee.includes(r)?[e]:[`${e}.rb`,E(e,"index.rb")]}function et(e){let r=R(e);return te.includes(r)?[e]:[`${e}.dart`,e]}function tt(e){let r=R(e),t=new Set;if(r){t.add(e);for(let n of H)t.add(e.slice(0,-r.length)+n)}else for(let n of H)t.add(`${e}${n}`),t.add(E(e,`index${n}`));return[...t]}function M(e){return qe.get(e,()=>new Set(e.all(`SELECT relative_path
1
+ import{a as B,b as ie,c as ae,d as G,f as F,g as ce,h as S}from"./chunk-SPMLGXCE.js";import{existsSync as ve,readFileSync as Ae}from"fs";import{join as Oe}from"path";import{existsSync as w}from"fs";import{basename as Le,dirname as j,extname as R,join as E,relative as A,resolve as P}from"path";var qe=ie("indexed-paths"),H=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],K=[".py",".pyi"],C=[".java",".scala",".kt",".kts"],Z=[".rs"],ee=[".rb"],pe=[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],L=[".cs",".vb"],te=[".dart"],X=[".php"],Ue=[H,K,C,Z,ee,pe,L,te,X];function $(e,r){return r.includes(R(e).toLowerCase())}function We(e){return $(e,K)}function Be(e){return $(e,C)}function Xe(e){return $(e,Z)}function Je(e){return $(e,ee)}function Fe(e){return $(e,pe)}function He(e){return $(e,L)}function le(e){return R(e).toLowerCase()===".vb"}function ze(e){return $(e,te)}function Ve(e){return $(e,X)}function re(e){let r=R(e).toLowerCase();for(let t of Ue)if(t.includes(r))return t;return H}function Qe(e){return Be(e)||He(e)||Ve(e)}function O(e,r,t){return We(r)?q(e,r,t):Xe(r)?T(e,r,t):Je(r)?z(e,r,t):Fe(r)?V(e,r,t):Qe(r)?g(e,t.replace(/\\/g,"."),re(r)):ze(r)?Q(e,r,t):Ye(e,r,t)}function Ye(e,r,t){if(!t.startsWith(".")&&!t.startsWith("/"))return null;let n=j(E(e.config.projectRoot,r)),s=P(n,t),o=M(e);for(let i of tt(s)){let a=b(A(e.config.projectRoot,i));if(o.has(a)||w(i))return a}return b(A(e.config.projectRoot,s))}function q(e,r,t){let n=M(e),s;if(t.startsWith(".")){let o=t.match(/^(\.+)(.*)$/);if(!o)return null;let i=o[1].length,a=o[2].replace(/^\./,""),c=j(E(e.config.projectRoot,r));for(let p=1;p<i;p++)c=j(c);s=a?P(c,a.replace(/\./g,"/")):c}else s=P(e.config.projectRoot,t.replace(/\./g,"/"));for(let o of Ge(s)){let i=b(A(e.config.projectRoot,o));if(n.has(i)||w(o))return i}return null}function T(e,r,t){if(!t)return null;let n=t.replace(/\s+as\s+.+$/,"").trim();if(!n.startsWith("crate::")&&!n.startsWith("self::")&&!n.startsWith("super::"))return null;let s=j(E(e.config.projectRoot,r)),o;n.startsWith("crate::")?o=P(e.config.projectRoot,"src",n.slice(7).replace(/::/g,"/")):n.startsWith("self::")?o=P(s,n.slice(6).replace(/::/g,"/")):o=P(j(s),n.slice(7).replace(/::/g,"/"));for(let i of Ke(o)){let a=b(A(e.config.projectRoot,i));if(M(e).has(a)||w(i))return a}return null}function z(e,r,t){let n=j(E(e.config.projectRoot,r)),s=P(n,t);for(let o of Ze(s)){let i=b(A(e.config.projectRoot,o));if(M(e).has(i)||w(o))return i}return null}function V(e,r,t){let n=M(e),s=j(E(e.config.projectRoot,r)),o=[P(s,t),P(e.config.projectRoot,t),P(e.config.projectRoot,"include",t),P(e.config.projectRoot,"src",t)];for(let i of o){let a=b(A(e.config.projectRoot,i));if(n.has(a)||w(i))return a}return null}function g(e,r,t){let n=M(e),s=r.replace(/\\/g,".").replace(/::/g,".").replace(/^global::/,""),o=s.replace(/\./g,"/"),i=s.split(".").pop()??s;for(let c of t){let p=`${o}${c}`,l=[...n].find(u=>u.endsWith(p));if(l)return l}for(let c of t){let p=[...n].find(l=>Le(l)===`${i}${c}`);if(p)return p}let a=[...n].filter(c=>t.includes(R(c).toLowerCase())).filter(c=>c.includes(`/${o}/`)||c.includes(`/${i}/`)).sort((c,p)=>c.localeCompare(p));return a.length===1?a[0]:null}function Q(e,r,t){let n=M(e);if(t.startsWith("package:")){let i=t.slice(8),a=i.indexOf("/");if(a<0)return null;let c=i.slice(a+1),p=b(c.startsWith("lib/")?c:`lib/${c}`);return n.has(p)?p:null}let s=j(E(e.config.projectRoot,r)),o=P(s,t);for(let i of et(o)){let a=b(A(e.config.projectRoot,i));if(n.has(a)||w(i))return a}return null}function Ge(e){let r=R(e);return K.includes(r)?[e]:[`${e}.py`,`${e}.pyi`,E(e,"__init__.py"),E(e,"__init__.pyi")]}function Ke(e){let r=R(e);return Z.includes(r)?[e]:[`${e}.rs`,E(e,"mod.rs")]}function Ze(e){let r=R(e);return ee.includes(r)?[e]:[`${e}.rb`,E(e,"index.rb")]}function et(e){let r=R(e);return te.includes(r)?[e]:[`${e}.dart`,e]}function tt(e){let r=R(e),t=new Set;if(r){t.add(e);for(let n of H)t.add(e.slice(0,-r.length)+n)}else for(let n of H)t.add(`${e}${n}`),t.add(E(e,`index${n}`));return[...t]}function M(e){return qe.get(e,()=>new Set(e.all(`SELECT relative_path
2
2
  FROM documents
3
3
  WHERE 1 = 1
4
4
  ${e.pathExclusionsFor("documents")}`).map(r=>b(r.relative_path)).filter(r=>!e.isIgnored(r))))}function b(e){return e.replace(/\\/g,"/")}function me(e){return e.replace(/'''[\s\S]*?'''/g,v).replace(/"""[\s\S]*?"""/g,v).replace(/#.*$/gm,v).replace(/\/\/.*$/gm,v).replace(/\/\*[\s\S]*?\*\//g,v).replace(/`(?:\\[\s\S]|[^`])*`/g,v).replace(/'(?:\\.|[^'\\\r\n])*'/g,v).replace(/"(?:\\.|[^"\\\r\n])*"/g,v)}function v(e){return e.replace(/[^\r\n]/g," ")}var rt=ae("stripped-lines");function er(e,r,t){return rt.get(e,r,t,()=>me(t).split(`
5
5
  `))}var ue=null,ne="";function nt(e){return ue===e||(ue=e,ne=me(e)),ne}function x(e,r,t){let n=nt(e);return`${n.slice(0,r)}${" ".repeat(t-r)}${n.slice(t)}`}function y(e,r){return new RegExp(`\\b${de(r)}\\b`,"m").test(e)}function U(e,r){let t=new Set,n=new RegExp(`\\b${de(r)}\\s*\\.\\s*([A-Za-z_$][\\w$]*)`,"g");for(let s of e.matchAll(n)){let o=s[1];o&&t.add(o)}return[...t]}function de(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function I(e){let r=[],t=0,n=0;for(let s=0;s<e.length;s++){let o=e[s];(o==="{"||o==="["||o==="(")&&t++,(o==="}"||o==="]"||o===")")&&t--,o===","&&t===0&&(r.push(e.slice(n,s)),n=s+1)}return r.push(e.slice(n)),r}function _(e,r){for(let t of e.namedChildren)if(t.type===r)return t;return null}function h(e,r){let t=new Set,n=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier","field_identifier"]),s=(o,i)=>{let a=i||r.has(o.type);!a&&n.has(o.type)&&t.add(o.text);for(let c of o.children)s(c,a)};return s(e.rootNode,!1),t}function D(e,r,t,n,s,o,i){return{importedName:s,localName:o,sourcePath:i??g(e,n,re(r)),kind:"named",used:y(t,o),usedMembers:[]}}function ge(e,r,t){let n=S(e,r);return n?st(e,r,n):at(t).flatMap(s=>ct(e,r,s.clause,s.specifier,s.start,s.end,t))}function st(e,r,t){let n=h(t,new Set(["import_statement"]));if(ce(r))for(let o of ht(e,r))n.add(o);let s=[];for(let o of t.rootNode.descendantsOfType("import_statement")){let i=ot(o);if(!i)continue;let a=O(e,r,i),c=_(o,"import_clause");if(!c){s.push({importedName:"*",localName:null,sourcePath:a,kind:"side-effect",used:!0,usedMembers:[]});continue}for(let p of c.namedChildren)switch(p.type){case"identifier":{let l=p.text;s.push({importedName:"default",localName:l,sourcePath:a,kind:"default",used:n.has(l),usedMembers:[]});break}case"namespace_import":{let u=_(p,"identifier")?.text??"";if(!u)break;let m=it(t,u);s.push({importedName:"*",localName:u,sourcePath:a,kind:"namespace",used:m.length>0||n.has(u),usedMembers:m});break}case"named_imports":{for(let l of p.namedChildren){if(l.type!=="import_specifier")continue;let u=l.namedChild(0),m=l.namedChild(1);if(!u)continue;let d=u.text,f=m?.text??d;s.push({importedName:d,localName:f,sourcePath:a,kind:"named",used:n.has(f),usedMembers:[]})}break}}}return s}function ot(e){let r=_(e,"string");if(!r)return null;let t=_(r,"string_fragment");return t?t.text:null}function it(e,r){let t=new Set;for(let n of e.rootNode.descendantsOfType("member_expression")){let s=n.namedChild(0),o=n.namedChild(1);!s||!o||s.type!=="identifier"||s.text!==r||(o.type==="property_identifier"||o.type==="identifier")&&t.add(o.text)}return[...t]}function at(e){let r=[],t=/^[ \t]*import\s+([\s\S]*?)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let s of e.matchAll(t)){let o=s[0],i=s[1],a=s[2];!o||!a||typeof s.index!="number"||r.push({clause:i,specifier:a,start:s.index,end:s.index+o.length})}let n=/^[ \t]*import\s+['"]([^'"]+)['"]\s*;?/gm;for(let s of e.matchAll(n)){let o=s[0],i=s[1];!o||!i||typeof s.index!="number"||r.push({clause:null,specifier:i,start:s.index,end:s.index+o.length})}return r.sort((s,o)=>s.start-o.start)}function ct(e,r,t,n,s,o,i){let a=O(e,r,n),c=x(i,s,o);return t?pt(t).map(l=>({...l,sourcePath:a})).map(l=>{if(l.kind==="namespace"){let u=U(c,l.localName);return{...l,used:u.length>0||y(c,l.localName),usedMembers:u}}return l.kind==="side-effect"?{...l,used:!0,usedMembers:[]}:{...l,used:l.localName?y(c,l.localName):!1,usedMembers:[]}}):[{importedName:"*",localName:null,sourcePath:a,kind:"side-effect",used:!0,usedMembers:[]}]}function pt(e){let r=e.trim().replace(/^type\s+/,""),[t,n]=lt(r),s=[];return t&&s.push(...fe(t)),n&&s.push(...fe(n)),s}function fe(e){let r=e.trim();if(!r)return[];if(r.startsWith("{")){let t=r.slice(1,-1).trim();return t?I(t).map(n=>{let s=n.trim().replace(/^type\s+/,""),[o,i]=s.split(/\s+as\s+/);return{importedName:o.trim(),localName:(i??o).trim(),kind:"named"}}):[]}return r.startsWith("* as ")?[{importedName:"*",localName:r.slice(5).trim(),kind:"namespace"}]:[{importedName:"default",localName:r,kind:"default"}]}function lt(e){let r=0;for(let t=0;t<e.length;t++){let n=e[t];if(n==="{"&&r++,n==="}"&&r--,n===","&&r===0)return[e.slice(0,t).trim(),e.slice(t+1).trim()]}return[e.trim(),null]}function he(e,r){let t=S(e,r);if(t)return mt(e,r,t);let n=G(e,r);if(!n)return[];let s=[],o=/^[ \t]*export\s+(?:type\s+)?\{([\s\S]*?)\}\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let c of n.matchAll(o)){if(typeof c.index!="number")continue;let p=c[1]??"",l=c[2]??"",u=I(p).map(f=>ut(f.trim())).filter(f=>!!f),m=W(n,c.index),d=W(n,c.index+c[0].length-1);s.push({kind:"named",sourcePath:O(e,r,l),names:u,startLine:m,endLine:d})}let i=/^[ \t]*export\s+\*\s+as\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let c of n.matchAll(i)){if(typeof c.index!="number")continue;let p=c[2]??"",l=W(n,c.index),u=W(n,c.index+c[0].length-1);s.push({kind:"star-as",sourcePath:O(e,r,p),names:[],startLine:l,endLine:u})}let a=/^[ \t]*export\s+\*\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let c of n.matchAll(a)){if(typeof c.index!="number")continue;let p=c[1]??"",l=W(n,c.index),u=W(n,c.index+c[0].length-1);s.push({kind:"star",sourcePath:O(e,r,p),names:[],startLine:l,endLine:u})}return s}function ut(e){if(!e)return null;let r=e.replace(/^type\s+/,"").trim();if(!r)return null;let t=r.match(/^(\w+)\s+as\s+(\w+)$/);if(t)return t[2]??null;let n=r.match(/^(\w+)$/);return n?n[1]??null:null}function W(e,r){let t=0;for(let n=0;n<r&&n<e.length;n++)e.charCodeAt(n)===10&&t++;return t}function mt(e,r,t){let n=[];for(let s of t.rootNode.descendantsOfType("export_statement")){let o=dt(e,r,s);if(o===void 0)continue;let i=s.startPosition.row,a=s.endPosition.row,c=ft(s,o,i,a);n.push(c)}return n}function dt(e,r,t){let n=_(t,"string");if(!n)return;let s=_(n,"string_fragment");if(s)return O(e,r,s.text)}function ft(e,r,t,n){let s=_(e,"export_clause");if(s){let i=[];for(let a of s.namedChildren){if(a.type!=="export_specifier")continue;let c=a.namedChild(0),p=a.namedChild(1);c&&i.push((p??c).text)}return{kind:"named",sourcePath:r,names:i,startLine:t,endLine:n}}return _(e,"namespace_export")?{kind:"star-as",sourcePath:r,names:[],startLine:t,endLine:n}:{kind:"star",sourcePath:r,names:[],startLine:t,endLine:n}}var gt=B("vue-non-script-identifiers");function ht(e,r){return gt.get(e,r,()=>{let t=new Set,n=G(e,r);if(!n)return t;let o=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g,i=>i.replace(/[^\r\n]/g," ")).replace(/<!--[\s\S]*?-->/g,i=>i.replace(/[^\r\n]/g," ")).replace(/\/\*[\s\S]*?\*\//g,i=>i.replace(/[^\r\n]/g," "));for(let i of o.matchAll(/[A-Za-z_$][\w$]*/g))t.add(i[0]);return t})}import{basename as Se}from"path";function xe(e,r,t){let n=S(e,r);if(n)return St(e,r,n);let s=[];for(let o of t.matchAll(/^[ \t]*#include\s+[<"]([^">]+)[">]\s*$/gm)){let i=o[1]?.trim(),a=o[0];if(!i||!a||typeof o.index!="number")continue;let c=x(t,o.index,o.index+a.length),p=Se(i).replace(/\.[^.]+$/,"");s.push({importedName:i,localName:p,sourcePath:V(e,r,i),kind:"named",used:y(c,p),usedMembers:[]})}return s}function St(e,r,t){let n=h(t,new Set(["preproc_include"])),s=[];for(let o of t.rootNode.descendantsOfType("preproc_include")){let i=null;for(let c of o.namedChildren){if(c.type==="system_lib_string"){i=c.text.replace(/^<|>$/g,"");break}if(c.type==="string_literal"){i=c.namedChildren.find(l=>l.type==="string_content")?.text??c.text.replace(/^"|"$/g,"");break}}if(!i)continue;let a=Se(i).replace(/\.[^.]+$/,"");s.push({importedName:i,localName:a,sourcePath:V(e,r,i),kind:"named",used:n.has(a),usedMembers:[]})}return s}function ye(e,r,t){let n=[];for(let s of t.matchAll(/^[ \t]*import\s+['"]([^'"]+)['"](?:\s+as\s+([A-Za-z_]\w*))?[\s\S]*?;$/gm)){let o=s[1]?.trim(),i=s[2]?.trim()??null,a=s[0];if(!o||!a||typeof s.index!="number")continue;let c=x(t,s.index,s.index+a.length);n.push({importedName:o,localName:i,sourcePath:Q(e,r,o),kind:i?"namespace":"side-effect",used:i?y(c,i):!0,usedMembers:i?U(c,i):[]})}return n}function Ne(e,r,t){let n=[];for(let s of t.matchAll(/^[ \t]*export\s+['"]([^'"]+)['"][\s\S]*?;$/gm)){let o=s[1]?.trim();o&&n.push({specifier:o,sourcePath:Q(e,r,o)})}return n}function Ie(e,r,t){let n=S(e,r),s=F(r);if(n&&s==="csharp")return yt(e,r,n);if(n&&s==="vb")return xt(e,r,n);let o=[],i=le(r)?/^[ \t]*Imports\s+(.+?)\s*$/gm:/^[ \t]*using\s+(.+?)\s*;$/gm;for(let a of t.matchAll(i)){let c=a[1]?.trim(),p=a[0];if(!c||!p||typeof a.index!="number")continue;let l=x(t,a.index,a.index+p.length),[u,m]=c.split(/\s*=\s*/),d=!!m,f=(d?m:u)?.trim()??c,N=f.split(".").pop()??f,k=d?u?.trim()??N:N;o.push(D(e,r,l,f,N,k,g(e,f,L)))}return o}function xt(e,r,t){let n=h(t,new Set(["imports_statement"])),s=[];for(let o of t.rootNode.descendantsOfType("imports_statement")){let i=o.namedChildren.filter(m=>m.type==="namespace_name");if(i.length===0)continue;let a=i[i.length-1],c=i.length>1?i[0]:null,p=a.text,l=p.split(".").pop()??p,u=c?.text??l;s.push({importedName:l,localName:u,sourcePath:g(e,p,L),kind:c?"namespace":"named",used:n.has(u),usedMembers:[]})}return s}function yt(e,r,t){let n=h(t,new Set(["using_directive"])),s=[];for(let o of t.rootNode.descendantsOfType("using_directive")){let i=o.namedChildren;if(i.length===0)continue;let a=null,c=null;if(i.length>=2&&i[0].type==="identifier"&&(i[1].type==="qualified_name"||i[1].type==="identifier")?(a=i[0],c=i[1]):c=i[i.length-1],!c)continue;let p=c.text,l=p.split(".").pop()??p,u=a?.text??l;s.push({importedName:l,localName:u,sourcePath:g(e,p,L),kind:a?"namespace":"named",used:n.has(u),usedMembers:[]})}return s}function Pe(e,r,t){let n=S(e,r),s=F(r);if(n&&s==="java")return Nt(e,r,n);if(n&&s==="kotlin")return It(e,r,n);if(n&&s==="scala")return Pt(e,r,n);let o=[];for(let i of t.matchAll(/^[ \t]*import\s+(?:static\s+)?(.+?)\s*;?$/gm)){let a=i[1]?.trim(),c=i[0];if(!a||!c||typeof i.index!="number")continue;let p=x(t,i.index,i.index+c.length);o.push(...bt(e,r,a,p))}return o}function Nt(e,r,t){let n=h(t,new Set(["import_declaration"])),s=[];for(let o of t.rootNode.descendantsOfType("import_declaration")){let i=o.children.some(u=>u.type==="asterisk"),c=o.namedChildren.find(u=>u.type==="scoped_identifier")??o.namedChildren.find(u=>u.type==="identifier");if(!c)continue;let p=c.text;if(i){s.push({importedName:"*",localName:null,sourcePath:g(e,p,C),kind:"namespace",used:!0,usedMembers:[]});continue}let l=p.split(".").pop()??p;s.push({importedName:l,localName:l,sourcePath:g(e,p,C),kind:"named",used:n.has(l),usedMembers:[]})}return s}function It(e,r,t){let n=h(t,new Set(["import_header","import_list"])),s=[];for(let o of t.rootNode.descendantsOfType("import_header")){let i=o.namedChildren.find(d=>d.type==="identifier");if(!i)continue;let a=o.namedChildren.some(d=>d.type==="wildcard_import"),c=o.namedChildren.find(d=>d.type==="import_alias");if(a){s.push({importedName:"*",localName:null,sourcePath:g(e,i.text,C),kind:"namespace",used:!0,usedMembers:[]});continue}let p=i.text,l=p.split(".").pop()??p,m=c?.namedChild(0)?.text??l;s.push({importedName:l,localName:m,sourcePath:g(e,p,C),kind:"named",used:n.has(m),usedMembers:[]})}return s}function Pt(e,r,t){let n=h(t,new Set(["import_declaration"])),s=[];for(let o of t.rootNode.descendantsOfType("import_declaration")){let i=o.namedChildren.find(u=>u.type==="namespace_selectors"||u.type==="namespace_wildcard"),a=o.namedChildren.filter(u=>u!==i&&(u.type==="identifier"||u.type==="stable_identifier")),c=a.map(u=>u.text).join(".");if(!c)continue;if(i?.type==="namespace_wildcard"){s.push({importedName:"*",localName:null,sourcePath:g(e,c,C),kind:"namespace",used:!0,usedMembers:[]});continue}if(i?.type==="namespace_selectors"){for(let u of i.namedChildren)if(u.type==="arrow_renamed_identifier"){let[m,d]=u.namedChildren;if(!m)continue;let f=m.text,N=d?.text??f;if(f==="_")continue;s.push({importedName:f,localName:N,sourcePath:g(e,`${c}.${f}`,C),kind:"named",used:n.has(N),usedMembers:[]})}else if(u.type==="identifier"){let m=u.text;s.push({importedName:m,localName:m,sourcePath:g(e,`${c}.${m}`,C),kind:"named",used:n.has(m),usedMembers:[]})}continue}let p=a[a.length-1]?.text??c,l=a.slice(0,-1).map(u=>u.text).join(".")||c;s.push({importedName:p,localName:p,sourcePath:g(e,l&&a.length>1?`${l}.${p}`:c,C),kind:"named",used:n.has(p),usedMembers:[]})}return s}function bt(e,r,t,n){if(t.includes("{")&&t.includes("}")){let s=t.slice(0,t.indexOf("{")).replace(/\.$/,"").trim(),o=t.slice(t.indexOf("{")+1,t.lastIndexOf("}")).trim();return I(o).flatMap(i=>{let a=i.trim();if(!a)return[];let[c,p]=a.includes("=>")?a.split(/\s*=>\s*/):a.split(/\s+as\s+/),l=c?.trim();if(!l||l==="_")return[];let u=(p??l.split(".").pop()??l).trim(),m=l==="_"?s:`${s}.${l}`.replace(/\.\./g,".");return[D(e,r,n,m,l,u)]})}return[D(e,r,n,t,t.split(".").pop()??t,t.split(".").pop()??t)]}function _e(e,r,t){let n=S(e,r);if(n)return _t(e,r,n);let s=[];for(let o of t.matchAll(/^[ \t]*use\s+(.+?)\s*;$/gm)){let i=o[1]?.trim(),a=o[0];if(!i||!a||typeof o.index!="number")continue;let c=x(t,o.index,o.index+a.length);for(let p of I(i)){let l=p.trim();if(!l)continue;let[u,m]=l.split(/\s+as\s+/i),d=u?.trim()??l,f=d.split("\\").pop()??d,N=(m??f).trim();s.push(D(e,r,c,d,f,N,g(e,d.replace(/\\/g,"."),X)))}}return s}function _t(e,r,t){let n=h(t,new Set(["namespace_use_declaration"])),s=[],o=(i,a,c)=>{s.push({importedName:a,localName:c,sourcePath:g(e,i.replace(/\\/g,"."),X),kind:"named",used:n.has(c),usedMembers:[]})};for(let i of t.rootNode.descendantsOfType("namespace_use_declaration")){let a=i.namedChildren.find(c=>c.type==="namespace_use_group");if(a){let c=i.namedChildren.find(p=>p.type==="namespace_name")?.text??"";for(let p of a.namedChildren){if(p.type!=="namespace_use_clause")continue;let{importedName:l,localName:u,qualified:m}=be(p,c);l&&o(m,l,u)}continue}for(let c of i.namedChildren){if(c.type!=="namespace_use_clause")continue;let{importedName:p,localName:l,qualified:u}=be(c,"");p&&o(u,p,l)}}return s}function be(e,r){let t=e.namedChildren.find(p=>p.type==="qualified_name"),n=e.namedChildren.filter(p=>p.type==="name"),s="";t?s=t.text:n.length>=1&&(s=n[0].text);let o=t&&n.length>0?n[n.length-1]:null,i=s.split("\\").pop()??s,a=o?.text??i,c=r?`${r}\\${s}`:s;return{importedName:i,localName:a,qualified:c}}function De(e,r,t){let n=S(e,r);return n?Et(e,r,n):Dt(t).flatMap(s=>Tt(e,r,s,t))}function Et(e,r,t){let n=h(t,new Set(["import_statement","import_from_statement"])),s=[];for(let o of t.rootNode.descendantsOfType("import_statement"))for(let i of o.namedChildren){let a=Ee(i);if(!a)continue;let c=q(e,r,a.qualifiedName);s.push({importedName:a.qualifiedName,localName:a.localName,sourcePath:c,kind:"namespace",used:n.has(a.localName),usedMembers:[]})}for(let o of t.rootNode.descendantsOfType("import_from_statement")){let i=o.namedChild(0);if(!i)continue;let a=Ct(i);if(a===null)continue;let c=q(e,r,a);for(let p=1;p<o.namedChildCount;p+=1){let l=o.namedChild(p);if(l.type==="wildcard_import"){s.push({importedName:"*",localName:null,sourcePath:c,kind:"side-effect",used:!0,usedMembers:[]});continue}let u=Ee(l);u&&s.push({importedName:u.qualifiedName,localName:u.localName,sourcePath:c,kind:"named",used:n.has(u.localName),usedMembers:[]})}}return s}function Ee(e){if(e.type==="aliased_import"){let r=e.namedChild(0),t=e.namedChild(1);return!r||!t?null:{qualifiedName:r.text,localName:t.text}}if(e.type==="dotted_name"){let r=e.text;return{qualifiedName:r,localName:r.split(".")[0]??r}}return e.type==="identifier"?{qualifiedName:e.text,localName:e.text}:null}function Ct(e){if(e.type==="dotted_name")return e.text;if(e.type==="relative_import"){let r=_(e,"import_prefix")?.text??"",t=_(e,"dotted_name")?.text??"";return`${r}${t}`}return null}function Dt(e){let r=e.split(`
6
6
  `),t=[],n=0;for(let s=0;s<r.length;s++){let o=r[s],i=o.trimStart(),a=n;if(n+=o.length+1,!i.startsWith("import ")&&!i.startsWith("from "))continue;let c=o,p=a+o.length,l=Ce(o);for(;s+1<r.length&&(l>0||c.trimEnd().endsWith("\\"));){s++;let m=r[s];c+=`
7
7
  ${m}`,p+=1+m.length,l+=Ce(m),n+=m.length+1}let u=Rt(c);u&&t.push({...u,start:a,end:p})}return t}function Rt(e){let r=e.replace(/\\\s*\n/g," ").trim();if(r.startsWith("import "))return{kind:"import",module:null,clause:r.slice(7).trim()};let t=r.match(/^from\s+([.\w]+)\s+import\s+([\s\S]+)$/);if(!t)return null;let n=t[2].trim();return n.startsWith("(")&&n.endsWith(")")&&(n=n.slice(1,-1).trim()),{kind:"from",module:t[1],clause:n}}function Tt(e,r,t,n){let s=x(n,t.start,t.end),o=t.clause.replace(/\n/g," ").trim();if(t.kind==="import")return I(o).flatMap(c=>{let p=c.trim().replace(/,$/,"");if(!p)return[];let[l,u]=p.split(/\s+as\s+/),m=l.trim(),d=(u??m.split(".")[0]??m).trim(),f=q(e,r,m),N=U(s,d);return[{importedName:m,localName:d,sourcePath:f,kind:"namespace",used:y(s,d)||N.length>0,usedMembers:N}]});let i=t.module?q(e,r,t.module):null,a=[];for(let c of I(o)){let p=c.trim().replace(/,$/,"");if(!p)continue;if(p==="*"){a.push({importedName:"*",localName:null,sourcePath:i,kind:"side-effect",used:!0,usedMembers:[]});continue}let[l,u]=p.split(/\s+as\s+/),m=(u??l).trim();a.push({importedName:l.trim(),localName:m,sourcePath:i,kind:"named",used:y(s,m),usedMembers:[]})}return a}function Ce(e){let r=0;for(let t of e)t==="("&&r++,t===")"&&r--;return r}import{basename as kt}from"path";function Re(e,r,t){let n=S(e,r);if(n)return jt(e,r,n);let s=[];for(let o of t.matchAll(/^[ \t]*(require_relative|require)\s+["']([^"']+)["']\s*$/gm)){let i=o[1],a=o[2],c=o[0];if(!i||!a||!c||typeof o.index!="number")continue;let p=x(t,o.index,o.index+c.length),l=i==="require_relative"?z(e,r,a):null;if(l){let u=Te(a);s.push({importedName:u,localName:u,sourcePath:l,kind:"named",used:y(p,u),usedMembers:[]});continue}s.push({importedName:a,localName:null,sourcePath:l,kind:"side-effect",used:!0,usedMembers:[]})}return s}function jt(e,r,t){let n=h(t,new Set([])),s=[],o=new Set(["require","require_relative","load"]);for(let i of t.rootNode.descendantsOfType("call")){let a=i.namedChild(0);if(!a||a.type!=="identifier"||!o.has(a.text))continue;let p=i.namedChildren.find(d=>d.type==="argument_list")?.namedChild(0);if(!p||p.type!=="string")continue;let u=p.namedChildren.find(d=>d.type==="string_content")?.text;if(!u)continue;let m=a.text==="require_relative"?z(e,r,u):null;if(m){let d=Te(u);s.push({importedName:d,localName:d,sourcePath:m,kind:"named",used:n.has(d),usedMembers:[]})}else s.push({importedName:u,localName:null,sourcePath:m,kind:"side-effect",used:!0,usedMembers:[]})}return s}function Te(e){return kt(e).replace(/\.[^.]+$/,"").split("_").filter(Boolean).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")}function ke(e,r,t){let n=S(e,r);if(n)return $t(e,r,n);let s=[];for(let o of t.matchAll(/^[ \t]*use\s+(.+?)\s*;$/gm)){let i=o[1]?.trim(),a=o[0];if(!i||!a||typeof o.index!="number")continue;let c=x(t,o.index,o.index+a.length);s.push(...vt(e,r,i,c))}return s}function $t(e,r,t){let n=h(t,new Set(["use_declaration"])),s=[];for(let o of t.rootNode.descendantsOfType("use_declaration")){let i=o.namedChild(0);if(i)for(let a of J(i,"")){if(!a.importedName||a.importedName==="*")continue;let c=T(e,r,a.qualifiedName)??T(e,r,a.qualifiedName.split("::").slice(0,-1).join("::"));s.push({importedName:a.importedName,localName:a.localName,sourcePath:c,kind:"named",used:n.has(a.localName),usedMembers:[]})}}return s}function J(e,r){switch(e.type){case"identifier":case"super":case"self":case"crate":{let t=e.text;return[{qualifiedName:Y(r,t),importedName:t,localName:t}]}case"scoped_identifier":{let t=e.text,n=t.split("::").pop()??t;return[{qualifiedName:Y(r,t),importedName:n,localName:n}]}case"scoped_use_list":{let t=e.namedChild(0),n=e.namedChild(1);if(!t||!n)return[];let s=Y(r,t.text),o=[];for(let i of n.namedChildren)o.push(...J(i,s));return o}case"use_list":{let t=[];for(let n of e.namedChildren)t.push(...J(n,r));return t}case"use_as_clause":{let t=e.namedChild(0),n=e.namedChild(1);if(!t||!n)return[];let s=J(t,r),o=n.text;return s.map(i=>({...i,localName:o}))}case"use_wildcard":{let t=e.namedChild(0),n=t?t.text:"";return[{qualifiedName:Y(r,`${n}::*`),importedName:"*",localName:"*"}]}default:return[]}}function Y(e,r){return e?r?`${e}::${r}`:e:r}function vt(e,r,t,n){let s=t.trim();if(s.includes("{")&&s.includes("}")){let l=s.slice(0,s.indexOf("{")).replace(/::$/,"").trim(),u=s.slice(s.indexOf("{")+1,s.lastIndexOf("}")).trim();return I(u).flatMap(m=>{let d=m.trim();if(!d||d==="self")return[];let[f,N]=d.split(/\s+as\s+/),k=f?.trim();if(!k)return[];let Me=(N??k.split("::").pop()??k).trim(),we=`${l}::${k}`.replace(/::::/g,"::");return[D(e,r,n,we,k.split("::").pop()??k,Me,T(e,r,l))]})}let[o,i]=s.split(/\s+as\s+/),a=o?.trim()??s,c=(i??a.split("::").pop()??a).trim(),p=T(e,r,a)??T(e,r,a.split("::").slice(0,-1).join("::"));return[D(e,r,n,a,a.split("::").pop()??a,c,p)]}function je(e,r,t){let n=S(e,r);if(n)return At(e,r,n);let s=[];for(let o of t.matchAll(/^[ \t]*pub\s+use\s+(.+?)\s*;$/gm)){let i=o[1]?.trim();i&&s.push(...Mt(e,r,i))}return s}function At(e,r,t){let n=[];for(let s of t.rootNode.descendantsOfType("use_declaration")){if(!Ot(s))continue;let o=s.namedChildren.find(i=>i.type!=="visibility_modifier");if(o)for(let i of J(o,""))i.importedName&&n.push(se(e,r,i.qualifiedName))}return n}function Ot(e){for(let r of e.children)if(r.type==="visibility_modifier"&&r.text.startsWith("pub"))return!0;return!1}function Mt(e,r,t){let n=t.trim();if(n.includes("{")&&n.includes("}")){let s=n.slice(0,n.indexOf("{")).replace(/::$/,"").trim(),o=n.slice(n.indexOf("{")+1,n.lastIndexOf("}")).trim();return I(o).flatMap(i=>{let a=i.trim();if(!a||a==="self")return[];let[c]=a.split(/\s+as\s+/),p=`${s}::${c?.trim()??a}`.replace(/::::/g,"::");return[se(e,r,p)]})}return[se(e,r,n)]}function se(e,r,t){return{specifier:t,sourcePath:T(e,r,t)??T(e,r,t.split("::").slice(0,-1).join("::"))}}function $e(e,r){let t=r.toLowerCase();for(let n of e)for(let s of n.extensions)if(t.endsWith(s))return n;return null}var wt={language:"javascript",extensions:[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],parseImports:ge},Lt={language:"python",extensions:[".py",".pyi"],parseImports:De},qt={language:"jvm",extensions:[".java",".scala",".kt",".kts"],parseImports:Pe},Ut={language:"rust",extensions:[".rs"],parseImports:ke,parseExports:je},Wt={language:"ruby",extensions:[".rb"],parseImports:Re},Bt={language:"c/cpp",extensions:[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],parseImports:xe},Xt={language:"dotnet",extensions:[".cs",".vb"],parseImports:Ie},Jt={language:"dart",extensions:[".dart"],parseImports:ye,parseExports:Ne},Ft={language:"php",extensions:[".php"],parseImports:_e},Ht=[wt,Lt,qt,Ut,Wt,Bt,Xt,Jt,Ft];function oe(e){return $e(Ht,e)}function Sn(e,r){return he(e,r)}var zt=B("source-imports"),Vt=B("source-exports");function xn(e,r){let t=b(r);return zt.get(e,t,()=>{let n=oe(t);if(!n)return[];let s=Oe(e.config.projectRoot,t);if(!ve(s))return[];let o=Ae(s,"utf-8");return n.parseImports(e,t,o)})}function yn(e,r){let t=b(r);return Vt.get(e,t,()=>{let n=oe(t);if(!n?.parseExports)return[];let s=Oe(e.config.projectRoot,t);if(!ve(s))return[];let o=Ae(s,"utf-8");return n.parseExports(e,t,o)})}export{me as a,er as b,de as c,Sn as d,xn as e,yn as f};
8
- //# sourceMappingURL=chunk-BQ3INTYT.js.map
8
+ //# sourceMappingURL=chunk-6XP3KWHC.js.map
@@ -0,0 +1,7 @@
1
+ import{c as m}from"./chunk-QSTMORTI.js";import{j as g}from"./chunk-3FG3VLK3.js";import{a as R}from"./chunk-7NEBSLI3.js";import{d as h}from"./chunk-SPMLGXCE.js";import{f as u}from"./chunk-5IM4IQ6N.js";function $(t,a){let e=R(t,a);if(!e)return[];let i=!u(e.symbol)&&!t.isIgnored(e.relativePath)?[{relativePath:e.relativePath,line:e.startLine}]:[],r=m(t,e),l=(r.length>0?r:g(t,e)).filter(n=>!t.isIgnored(n.file)).map(n=>({relativePath:n.file,line:n.line})),c=S(t,e),o=new Set,f=[];for(let n of[...i,...l,...c]){let p=`${n.relativePath}:${n.line}`;o.has(p)||(o.add(p),f.push(n))}return f}function S(t,a){if(!a.relativePath.endsWith(".rb"))return[];let e=d(a.symbol);if(e.length===0)return[];let s=t.all(`SELECT relative_path
2
+ FROM documents
3
+ WHERE relative_path LIKE '%.rb'
4
+ ${t.pathExclusionsFor("documents")}
5
+ ORDER BY relative_path`),i=[];for(let r of s){if(t.isIgnored(r.relative_path))continue;let l=h(t,r.relative_path);if(!l)continue;let c=l.split(`
6
+ `);for(let o=0;o<c.length;o++){let f=c[o]??"";e.some(n=>new RegExp(`@${n}\\b|\\b${n}:`).test(f))&&i.push({relativePath:r.relative_path,line:o})}}return i}function d(t){let e=(t.split(":").pop()??t).replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[^A-Za-z0-9_]+/g,"_").toLowerCase().replace(/^_+|_+$/g,""),s=e.split("_").filter(Boolean),i=new Set;return e&&i.add(e),s.length>=1&&i.add(s[s.length-1]),s.length>=2&&i.add(s.slice(-2).join("_")),[...i]}export{$ as a};
7
+ //# sourceMappingURL=chunk-7DKDFRXQ.js.map
@@ -1,4 +1,4 @@
1
- import{u as p}from"./chunk-IYFZS4PV.js";import{b as N,c as E,f as R,g as I}from"./chunk-TINPMWJK.js";function T(e,t){let n=v(e,t.trim());if(n)return n;let i=t.match(/^(.+):(\d+)-(\d+)$/);if(i){let[,c,_,h]=i,u=Math.max(0,parseInt(_,10)-1),f=Math.max(u,parseInt(h,10)-1),m=e.get(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.end_line, d.relative_path
1
+ import{u as p}from"./chunk-SPMLGXCE.js";import{b as N,c as E,f as R,g as I}from"./chunk-5IM4IQ6N.js";function T(e,t){let n=v(e,t.trim());if(n)return n;let i=t.match(/^(.+):(\d+)-(\d+)$/);if(i){let[,c,_,h]=i,u=Math.max(0,parseInt(_,10)-1),f=Math.max(u,parseInt(h,10)-1),m=e.get(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.end_line, d.relative_path
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
@@ -86,4 +86,4 @@ import{u as p}from"./chunk-IYFZS4PV.js";import{b as N,c as E,f as R,g as I}from"
86
86
  ${e.pathExclusionsFor("d")}
87
87
  GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path, gs.display_name
88
88
  LIMIT 200`,...i)}function D(e,t,n,i){let d=t.trim(),o=n,l=o.replace(/\(\)$/,""),a=t.toLowerCase(),r=n.toLowerCase(),c=r.replace(/\(\)$/,""),_=e.symbol,h=N(e.symbol),u=E(e.symbol),f=e.display_name??"",m=e.symbol.toLowerCase(),y=h.toLowerCase(),S=u.toLowerCase(),O=f.toLowerCase(),g=e.relative_path.toLowerCase(),L=/[/:.]/.test(n),s=0;return(_===d||_===o)&&(s+=1150),(h===d||h===o)&&(s+=1100),f===l&&(s+=980),u===l&&(s+=960),(`${u}()`===d||`${u}()`===o)&&(s+=955),(m===a||m===r)&&(s+=1e3),(y===a||y===r)&&(s+=950),(g===a||g===r)&&(s+=925),(g.endsWith(`/${r}`)||g.endsWith(`/${a}`))&&(s+=875),O===c&&(s+=850),S===c&&(s+=825),(`${S}()`===a||`${S}()`===r)&&(s+=820),(y.endsWith(`:${r}`)||y.endsWith(`:${c}`)||y.endsWith(`:${c}()`))&&(s+=800),m.includes(r)&&(s+=120),y.includes(r)&&(s+=140),g.includes(r)&&(s+=140),O.includes(r)&&(s+=110),i.every(C=>{let b=C.toLowerCase();return m.includes(b)||y.includes(b)||g.includes(b)||O.includes(b)})&&(s+=100+i.length*15),R(e.symbol)&&S===c&&(s+=60),!L&&I(e.symbol)&&(s-=160),s-=Math.min(50,Math.max(0,e.end_line-e.start_line)),s}function M(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function w(e){let t=M(e),n=t.split(/[^A-Za-z0-9_]+/).map(i=>i.trim()).filter(i=>i.length>0);return n.length>0?[...new Set(n)]:[t]}function x(e,t,n){let i=t.trim(),d=e.filter(o=>{let l=N(o.symbol),a=(o.display_name??"").trim();return o.symbol===i||l===i||l===n||a===i||a===n||`${a}()`===i||o.relative_path===i});return d.length===0?null:(d.sort((o,l)=>o.end_line-o.start_line-(l.end_line-l.start_line)||o.relative_path.localeCompare(l.relative_path)||o.symbol.localeCompare(l.symbol)),d[0]??null)}export{T as a,v as b,W as c};
89
- //# sourceMappingURL=chunk-LX4H4LLG.js.map
89
+ //# sourceMappingURL=chunk-7NEBSLI3.js.map
@@ -0,0 +1,2 @@
1
+ import{c as a}from"./chunk-F6F2QUIH.js";import{g as p}from"./chunk-3FG3VLK3.js";import{b as f}from"./chunk-SPMLGXCE.js";function c(t){let r=o(t);return x(r)?"test":S(r)?"worker":y(r)?"entry":P(r)?"barrel":"source"}function _(t){return c(t)==="barrel"}function g(t){return h.get(t,()=>{let r=p(t),e=a(t).filter(s=>{let u=c(s);return u==="entry"||u==="worker"}),n=new Set,i=new Set;for(;e.length>0;){let s=e.shift();if(!n.has(s)){n.add(s),c(s)==="barrel"&&i.add(s);for(let u of r.get(s)??[])n.has(u)||e.push(u)}}return i})}var h=f("live-barrels");function b(t,r){return g(t).has(o(r))}function w(t){let r=g(t);return a(t).filter(e=>_(e)&&!r.has(e))}function D(t,r){let e=c(r);return e==="entry"||e==="worker"||b(t,r)}function E(t,r,e){let n=t.config.entryRoots;if(!n)return!1;let i=o(e);return!!(n.files?.some(s=>o(s)===i)||n.pathPrefixes?.some(s=>i.startsWith(o(s)))||n.qualifiedVars?.some(s=>$(r,s))||n.symbolPatterns?.some(s=>{try{return new RegExp(s).test(r)}catch{return!1}}))}var m=["%/__tests__/%","%.test.%","%.spec.%","%/test/%","%/tests/%","%_test.%","%_spec.%","%/test_%.%","%/spec_%.%"],B=["%/test-utils/%"];function x(t){return!!(/\.(?:test|spec)\.[a-z0-9]+$/i.test(t)||/(?:^|\/)(?:_)?test_[^/]+$/i.test(t)||/(?:^|\/)spec_[^/]+$/i.test(t)||/(?:^|\/)[^/]+_test\.[a-z0-9]+$/i.test(t)||/(?:^|\/)[^/]+_tests\.rs$/i.test(t)||/(?:^|\/)tests\.rs$/i.test(t)||/(?:^|\/)[^/]+_spec\.[a-z0-9]+$/i.test(t)||/(?:^|\/)__tests__\//i.test(t)||/(?:^|\/)test\//i.test(t)||/(?:^|\/)tests\//i.test(t)||/(?:^|\/)__fixtures__\//i.test(t)||/(?:^|\/)__mocks__\//i.test(t)||/(?:^|\/)test-support\//i.test(t)||/(?:^|\/)test-utils\//i.test(t)||/(?:^|\/)testing\//i.test(t))}function S(t){return/(?:^|\/)[^/]*worker\.(?:ts|tsx|js|mjs|cjs|rs|py|go)$/.test(t)}function y(t){let r=t.split("/"),e=r[r.length-1]??t;return e==="cli.ts"||e==="cli.js"||e==="postinstall.ts"||e==="postinstall.js"||e==="main.ts"||e==="main.js"||e==="main.rs"||e==="main.go"||e==="main.py"||e==="build.rs"||e==="lib.rs"||/\bsrc\/bin\/[^/]+\.rs$/.test(t)||/(?:^|\/)examples\/[^/]+\.rs$/.test(t)||/(?:^|\/)tests\/[^/]+\.rs$/.test(t)||/(?:^|\/)benches\/[^/]+\.rs$/.test(t)?!0:e==="index.ts"||e==="index.js"?r.length<=2:!1}function P(t){return t==="index.ts"||t==="index.js"||t.endsWith("/index.ts")||t.endsWith("/index.js")||t.endsWith("/mod.rs")||t.endsWith("/__init__.py")}function o(t){return t.replace(/\\/g,"/")}function $(t,r){let e=r.lastIndexOf("/");if(e<0)return!1;let n=r.slice(0,e),i=r.slice(e+1);return t.includes(l(n)+"/")&&t.includes(l(i)+".")}function l(t){return/^[A-Za-z0-9_$+-]+$/.test(t)?t:"`"+t.replace(/`/g,"``")+"`"}export{c as a,_ as b,b as c,w as d,D as e,E as f,m as g,B as h};
2
+ //# sourceMappingURL=chunk-AEMTUHQ7.js.map
@@ -1,2 +1,2 @@
1
- import{d as M}from"./chunk-WCDXJGYT.js";function H(o,c={}){let{minSimilarity:e=.5,limit:n=15,scope:r,minChainLength:g=3,maxChainLength:s=8}=c,l=M(o,r),t=R(l,g,s);if(t.length===0)return[];let h=new Map,u=new Map;for(let i of t){let a=new Set;for(let f of i)a.has(f)||(h.set(f,(h.get(f)??0)+1),a.add(f));for(let f=Math.max(0,i.length-2);f<i.length;f++)u.set(i[f],(u.get(i[f])??0)+1)}let P=t.length*.9,q=t.length*.8,x=new Set;for(let[i,a]of h)a>P&&x.add(i);for(let[i,a]of u)a>q&&x.add(i);let E=["index.ts","index.js","cli.ts","main.ts","health.ts","health.js"];for(let i of h.keys()){let a=i.split("/").pop()??"";E.includes(a)&&x.add(i)}let p=[];for(let i of t){let a=i.filter(f=>!x.has(f));a.length>=2&&p.push({original:i,filtered:a})}if(p.length<2)return[];let b=[];for(let i=0;i<p.length;i++){for(let a=i+1;a<p.length;a++){let f=p[i],m=p[a],F=new Set(f.filtered),S=!1;for(let d of m.filtered)if(F.has(d)){S=!0;break}if(!S)continue;let{distance:C,ops:A}=T(f.filtered,m.filtered),j=Math.max(f.filtered.length,m.filtered.length);if(j===0)continue;let B=1-C/j;if(B<e||C===0)continue;let w=A.filter(d=>d.type==="substitute").map(d=>({index:d.indexA,nodeA:f.filtered[d.indexA],nodeB:m.filtered[d.indexB]}));if(w.length===0||A.filter(d=>d.type==="match").length<2)continue;let N=v(f.original,m.original),O=z(f.original,m.original);b.push({chainA:f.original,chainB:m.original,similarity:B,editDistance:C,divergencePoints:w,commonPrefix:N,commonSuffix:O})}if(b.length>n*10)break}b.sort((i,a)=>Math.abs(a.similarity-i.similarity)>.01?a.similarity-i.similarity:i.divergencePoints.length-a.divergencePoints.length);let y=[];for(let i of b)if(y.some(f=>k(i.chainA,f.chainA)&&k(i.chainB,f.chainB))||y.push(i),y.length>=n)break;return y}function R(o,c,e){let n=[];for(let g of o.keys()){if(n.length>=500)break;D(o,g,[g],new Set([g]),c,e,n,500)}return n}function D(o,c,e,n,r,g,s,l){if(s.length>=l)return;if(e.length>=g){e.length>=r&&s.push([...e]);return}let t=o.get(c);if(!t||t.size===0){e.length>=r&&s.push([...e]);return}let h=!1;for(let u of t)if(!n.has(u)&&(n.add(u),e.push(u),D(o,u,e,n,r,g,s,l),e.pop(),n.delete(u),h=!0,s.length>=l))return;!h&&e.length>=r&&s.push([...e])}function T(o,c){let e=o.length,n=c.length,r=Array.from({length:e+1},()=>Array(n+1).fill(0));for(let t=0;t<=e;t++)r[t][0]=t;for(let t=0;t<=n;t++)r[0][t]=t;for(let t=1;t<=e;t++)for(let h=1;h<=n;h++)o[t-1]===c[h-1]?r[t][h]=r[t-1][h-1]:r[t][h]=1+Math.min(r[t-1][h],r[t][h-1],r[t-1][h-1]);let g=[],s=e,l=n;for(;s>0||l>0;)s>0&&l>0&&o[s-1]===c[l-1]?(g.unshift({type:"match",indexA:s-1,indexB:l-1}),s--,l--):s>0&&l>0&&r[s][l]===r[s-1][l-1]+1?(g.unshift({type:"substitute",indexA:s-1,indexB:l-1}),s--,l--):l>0&&r[s][l]===r[s][l-1]+1?(g.unshift({type:"insert",indexA:s,indexB:l-1}),l--):(g.unshift({type:"delete",indexA:s-1,indexB:l}),s--);return{distance:r[e][n],ops:g}}function v(o,c){let e=[];for(let n=0;n<Math.min(o.length,c.length)&&o[n]===c[n];n++)e.push(o[n]);return e}function z(o,c){let e=[],n=o.length-1,r=c.length-1;for(;n>=0&&r>=0&&o[n]===c[r];)e.unshift(o[n]),n--,r--;return e}function k(o,c){if(o.length>c.length)return!1;let e=c.join("\u2192"),n=o.join("\u2192");return e.includes(n)}export{H as a};
2
- //# sourceMappingURL=chunk-Y7LOQSWY.js.map
1
+ import{g as M}from"./chunk-3FG3VLK3.js";function H(o,c={}){let{minSimilarity:e=.5,limit:n=15,scope:r,minChainLength:g=3,maxChainLength:s=8}=c,l=M(o,r),t=R(l,g,s);if(t.length===0)return[];let h=new Map,u=new Map;for(let i of t){let a=new Set;for(let f of i)a.has(f)||(h.set(f,(h.get(f)??0)+1),a.add(f));for(let f=Math.max(0,i.length-2);f<i.length;f++)u.set(i[f],(u.get(i[f])??0)+1)}let P=t.length*.9,q=t.length*.8,x=new Set;for(let[i,a]of h)a>P&&x.add(i);for(let[i,a]of u)a>q&&x.add(i);let E=["index.ts","index.js","cli.ts","main.ts","health.ts","health.js"];for(let i of h.keys()){let a=i.split("/").pop()??"";E.includes(a)&&x.add(i)}let p=[];for(let i of t){let a=i.filter(f=>!x.has(f));a.length>=2&&p.push({original:i,filtered:a})}if(p.length<2)return[];let b=[];for(let i=0;i<p.length;i++){for(let a=i+1;a<p.length;a++){let f=p[i],m=p[a],F=new Set(f.filtered),S=!1;for(let d of m.filtered)if(F.has(d)){S=!0;break}if(!S)continue;let{distance:C,ops:A}=T(f.filtered,m.filtered),j=Math.max(f.filtered.length,m.filtered.length);if(j===0)continue;let B=1-C/j;if(B<e||C===0)continue;let w=A.filter(d=>d.type==="substitute").map(d=>({index:d.indexA,nodeA:f.filtered[d.indexA],nodeB:m.filtered[d.indexB]}));if(w.length===0||A.filter(d=>d.type==="match").length<2)continue;let N=v(f.original,m.original),O=z(f.original,m.original);b.push({chainA:f.original,chainB:m.original,similarity:B,editDistance:C,divergencePoints:w,commonPrefix:N,commonSuffix:O})}if(b.length>n*10)break}b.sort((i,a)=>Math.abs(a.similarity-i.similarity)>.01?a.similarity-i.similarity:i.divergencePoints.length-a.divergencePoints.length);let y=[];for(let i of b)if(y.some(f=>k(i.chainA,f.chainA)&&k(i.chainB,f.chainB))||y.push(i),y.length>=n)break;return y}function R(o,c,e){let n=[];for(let g of o.keys()){if(n.length>=500)break;D(o,g,[g],new Set([g]),c,e,n,500)}return n}function D(o,c,e,n,r,g,s,l){if(s.length>=l)return;if(e.length>=g){e.length>=r&&s.push([...e]);return}let t=o.get(c);if(!t||t.size===0){e.length>=r&&s.push([...e]);return}let h=!1;for(let u of t)if(!n.has(u)&&(n.add(u),e.push(u),D(o,u,e,n,r,g,s,l),e.pop(),n.delete(u),h=!0,s.length>=l))return;!h&&e.length>=r&&s.push([...e])}function T(o,c){let e=o.length,n=c.length,r=Array.from({length:e+1},()=>Array(n+1).fill(0));for(let t=0;t<=e;t++)r[t][0]=t;for(let t=0;t<=n;t++)r[0][t]=t;for(let t=1;t<=e;t++)for(let h=1;h<=n;h++)o[t-1]===c[h-1]?r[t][h]=r[t-1][h-1]:r[t][h]=1+Math.min(r[t-1][h],r[t][h-1],r[t-1][h-1]);let g=[],s=e,l=n;for(;s>0||l>0;)s>0&&l>0&&o[s-1]===c[l-1]?(g.unshift({type:"match",indexA:s-1,indexB:l-1}),s--,l--):s>0&&l>0&&r[s][l]===r[s-1][l-1]+1?(g.unshift({type:"substitute",indexA:s-1,indexB:l-1}),s--,l--):l>0&&r[s][l]===r[s][l-1]+1?(g.unshift({type:"insert",indexA:s,indexB:l-1}),l--):(g.unshift({type:"delete",indexA:s-1,indexB:l}),s--);return{distance:r[e][n],ops:g}}function v(o,c){let e=[];for(let n=0;n<Math.min(o.length,c.length)&&o[n]===c[n];n++)e.push(o[n]);return e}function z(o,c){let e=[],n=o.length-1,r=c.length-1;for(;n>=0&&r>=0&&o[n]===c[r];)e.unshift(o[n]),n--,r--;return e}function k(o,c){if(o.length>c.length)return!1;let e=c.join("\u2192"),n=o.join("\u2192");return e.includes(n)}export{H as a};
2
+ //# sourceMappingURL=chunk-AVLUWGXG.js.map
@@ -0,0 +1,2 @@
1
+ import{d as L}from"./chunk-QSTMORTI.js";import{e as h}from"./chunk-AEMTUHQ7.js";import{b as y,k as d,m as b}from"./chunk-3FG3VLK3.js";import{f,r as u}from"./chunk-SPMLGXCE.js";import{b as i,c as m,h as c,i as p}from"./chunk-5IM4IQ6N.js";function x(s,v={}){let{scope:I,minLoc:S=3}=v,o=u(s,I).filter(e=>!s.isIgnored(e.relativePath)).filter(e=>!h(s,e.relativePath)).filter(e=>e.isFunctionLike).filter(e=>!c(e.symbol)).filter(e=>!p(e.symbol)).filter(e=>e.endLine-e.startLine+1>=S),C=b(s,o),M=L(s,o),n=new Set([...C.keys(),...M.keys()]),l=new Map;for(let e of o){let t=m(e.symbol);if(!t)continue;let a=l.get(t)??[];a.push(e.symbolId),l.set(t,a)}let g=s.all(`SELECT relative_path FROM documents WHERE 1 = 1 ${s.pathExclusionsFor("documents")}`);for(let e of g){if(s.isIgnored(e.relative_path)||f(e.relative_path)!=="rust")continue;let t=y(s,e.relative_path);for(let a of t){let r=l.get(a);if(r)for(let F of r)n.add(F)}}let R=new Map(o.map(e=>[e.symbolId,e.symbol])),k=d(s,o,{additive:!0}),E=new Set([...k.entries()].filter(([e,t])=>{let a=R.get(e);return t.some(r=>r.symbol!==a)}).map(([e])=>e));return o.filter(e=>!n.has(e.symbolId)).filter(e=>!E.has(e.symbolId)).sort((e,t)=>t.endLine-t.startLine-(e.endLine-e.startLine)||e.relativePath.localeCompare(t.relativePath)||e.startLine-t.startLine).map(e=>({symbol:e.symbol,shortName:i(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:e.endLine-e.startLine+1}))}export{x as a};
2
+ //# sourceMappingURL=chunk-AZQ3ENHU.js.map