scip-query 0.6.6 → 0.6.9

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 (177) hide show
  1. package/README.md +20 -1
  2. package/dist/chunk-2OP63JQQ.js +2 -0
  3. package/dist/chunk-33Z6HQBX.js +5 -0
  4. package/dist/chunk-3F453KPT.js +2 -0
  5. package/dist/{chunk-7PRMSA4Z.js → chunk-3JGBAAP7.js} +2 -2
  6. package/dist/chunk-3PKPUCIJ.js +11 -0
  7. package/dist/chunk-42BWO2NN.js +2 -0
  8. package/dist/chunk-4MDCFY3E.js +2 -0
  9. package/dist/chunk-4QWTQ6YV.js +2 -0
  10. package/dist/{chunk-Y4DS3MDC.js → chunk-5IRX5I64.js} +2 -2
  11. package/dist/chunk-5MPZ2A7J.js +2 -0
  12. package/dist/chunk-67OMD56K.js +90 -0
  13. package/dist/chunk-6UVVA5I4.js +7 -0
  14. package/dist/{chunk-OQZF2DQJ.js → chunk-AXHDRSRI.js} +2 -2
  15. package/dist/{chunk-TLRA5TR6.js → chunk-BAA4EJRX.js} +2 -2
  16. package/dist/{chunk-ZHHMG4UC.js → chunk-BT36WY5B.js} +2 -2
  17. package/dist/chunk-CLKFDBS6.js +39 -0
  18. package/dist/{chunk-CSRPJCWO.js → chunk-CWMWTHV3.js} +2 -2
  19. package/dist/chunk-DXO2ECRF.js +7 -0
  20. package/dist/chunk-EHEZLULQ.js +85 -0
  21. package/dist/{chunk-PIRXZGV6.js → chunk-GRAEZYYU.js} +2 -2
  22. package/dist/chunk-GWBRU65E.js +2 -0
  23. package/dist/chunk-I2KUHGMX.js +16 -0
  24. package/dist/chunk-I5BB33E6.js +10 -0
  25. package/dist/{chunk-YXMHTJYY.js → chunk-IIKNAXAE.js} +2 -2
  26. package/dist/{chunk-MXWC53GJ.js → chunk-IX45SWX5.js} +2 -2
  27. package/dist/{chunk-ERRUE5G4.js → chunk-JLFAQ2E2.js} +2 -2
  28. package/dist/chunk-JMASYYSW.js +2 -0
  29. package/dist/{chunk-E2V5SE6M.js → chunk-LBWLO7NA.js} +2 -2
  30. package/dist/{chunk-MO65UK5V.js → chunk-LLDPR3DG.js} +2 -2
  31. package/dist/chunk-LNUZWWWL.js +2 -0
  32. package/dist/{chunk-QFZE73XF.js → chunk-NLJCXHFU.js} +8 -8
  33. package/dist/chunk-NRAJIFQA.js +2 -0
  34. package/dist/chunk-OYRGWW6Z.js +2 -0
  35. package/dist/chunk-PVMRIOM6.js +33 -0
  36. package/dist/chunk-SF2HYG53.js +4 -0
  37. package/dist/chunk-SHGPRVWH.js +2 -0
  38. package/dist/chunk-SMOUOKAO.js +2 -0
  39. package/dist/chunk-TPXWXKL6.js +2 -0
  40. package/dist/chunk-TTCUMJ43.js +19 -0
  41. package/dist/chunk-TYR7QY5G.js +2 -0
  42. package/dist/{chunk-HVNVO6UW.js → chunk-U3GYMGBX.js} +2 -2
  43. package/dist/{chunk-Q2ALKKSE.js → chunk-UIM4WALN.js} +2 -2
  44. package/dist/chunk-UZG3QXTG.js +2 -0
  45. package/dist/{chunk-7LSCW7NF.js → chunk-V4WRHJU3.js} +2 -2
  46. package/dist/chunk-VDMRAGBK.js +6 -0
  47. package/dist/chunk-W6SRVK2Y.js +5 -0
  48. package/dist/{chunk-QFBJZHMV.js → chunk-WGYJDGBI.js} +2 -2
  49. package/dist/{chunk-KBGFYKOJ.js → chunk-WYX3RU2K.js} +2 -2
  50. package/dist/chunk-WZYA234B.js +2 -0
  51. package/dist/{chunk-O6VBAW7P.js → chunk-Y6ZFXZ7B.js} +2 -2
  52. package/dist/chunk-YCN5XEST.js +7 -0
  53. package/dist/{chunk-DLWRLPKO.js → chunk-ZO5IFJRM.js} +2 -2
  54. package/dist/cli.js +198 -166
  55. package/dist/{db-BZPa7dzJ.d.ts → db-Rx8Ho_JF.d.ts} +4 -0
  56. package/dist/index.d.ts +13 -6
  57. package/dist/index.js +23 -23
  58. package/dist/queries/affected.d.ts +1 -1
  59. package/dist/queries/affected.js +1 -1
  60. package/dist/queries/bottlenecks.d.ts +3 -1
  61. package/dist/queries/bottlenecks.js +1 -1
  62. package/dist/queries/by-kind.d.ts +1 -1
  63. package/dist/queries/by-kind.js +1 -1
  64. package/dist/queries/call-graph.d.ts +4 -2
  65. package/dist/queries/call-graph.js +1 -1
  66. package/dist/queries/change-surface.d.ts +4 -2
  67. package/dist/queries/change-surface.js +1 -1
  68. package/dist/queries/code.d.ts +1 -1
  69. package/dist/queries/code.js +1 -1
  70. package/dist/queries/complexity-hotspots.d.ts +3 -1
  71. package/dist/queries/complexity-hotspots.js +1 -1
  72. package/dist/queries/complexity.d.ts +4 -2
  73. package/dist/queries/complexity.js +1 -1
  74. package/dist/queries/convergence.d.ts +4 -2
  75. package/dist/queries/convergence.js +1 -1
  76. package/dist/queries/coupling.d.ts +1 -1
  77. package/dist/queries/coupling.js +1 -1
  78. package/dist/queries/cycles.d.ts +1 -1
  79. package/dist/queries/cycles.js +1 -1
  80. package/dist/queries/dataflow.d.ts +4 -2
  81. package/dist/queries/dataflow.js +1 -1
  82. package/dist/queries/dead.d.ts +1 -1
  83. package/dist/queries/dead.js +1 -1
  84. package/dist/queries/deep-chains.d.ts +1 -1
  85. package/dist/queries/deep-chains.js +1 -1
  86. package/dist/queries/deps.d.ts +1 -1
  87. package/dist/queries/deps.js +1 -1
  88. package/dist/queries/diff-impact.d.ts +20 -2
  89. package/dist/queries/diff-impact.js +1 -1
  90. package/dist/queries/drift.d.ts +2 -1
  91. package/dist/queries/drift.js +1 -1
  92. package/dist/queries/extract-candidates.d.ts +3 -1
  93. package/dist/queries/extract-candidates.js +1 -1
  94. package/dist/queries/fan.d.ts +1 -1
  95. package/dist/queries/fan.js +1 -1
  96. package/dist/queries/files.d.ts +1 -1
  97. package/dist/queries/health-cache-control.d.ts +15 -0
  98. package/dist/queries/health-cache-control.js +2 -0
  99. package/dist/queries/health.d.ts +66 -2
  100. package/dist/queries/health.js +1 -1
  101. package/dist/queries/hierarchy.d.ts +1 -1
  102. package/dist/queries/hierarchy.js +1 -1
  103. package/dist/queries/hotspots.d.ts +1 -1
  104. package/dist/queries/hotspots.js +1 -1
  105. package/dist/queries/imports.d.ts +7 -3
  106. package/dist/queries/imports.js +1 -1
  107. package/dist/queries/index.d.ts +3 -3
  108. package/dist/queries/index.js +1 -1
  109. package/dist/queries/isolated.d.ts +3 -1
  110. package/dist/queries/isolated.js +1 -1
  111. package/dist/queries/members.d.ts +1 -1
  112. package/dist/queries/members.js +1 -1
  113. package/dist/queries/methods.d.ts +1 -1
  114. package/dist/queries/methods.js +1 -1
  115. package/dist/queries/outline.d.ts +1 -1
  116. package/dist/queries/outline.js +1 -1
  117. package/dist/queries/passthrough-candidates.d.ts +3 -1
  118. package/dist/queries/passthrough-candidates.js +1 -1
  119. package/dist/queries/redundant-reexports.d.ts +1 -1
  120. package/dist/queries/redundant-reexports.js +1 -1
  121. package/dist/queries/refs.d.ts +4 -2
  122. package/dist/queries/refs.js +1 -1
  123. package/dist/queries/similar-chains.d.ts +1 -1
  124. package/dist/queries/similar-chains.js +1 -1
  125. package/dist/queries/similar-files.d.ts +1 -1
  126. package/dist/queries/similar-files.js +1 -1
  127. package/dist/queries/similar-signatures.d.ts +3 -1
  128. package/dist/queries/similar-signatures.js +1 -1
  129. package/dist/queries/similar.d.ts +5 -1
  130. package/dist/queries/similar.js +1 -1
  131. package/dist/queries/slice.d.ts +2 -1
  132. package/dist/queries/slice.js +1 -1
  133. package/dist/queries/stale-abstractions.d.ts +5 -2
  134. package/dist/queries/stale-abstractions.js +1 -1
  135. package/dist/queries/stats.d.ts +1 -1
  136. package/dist/queries/surface.d.ts +1 -1
  137. package/dist/queries/surface.js +1 -1
  138. package/dist/queries/symbols.d.ts +1 -1
  139. package/dist/queries/symbols.js +1 -1
  140. package/dist/queries/system.d.ts +1 -1
  141. package/dist/queries/system.js +1 -1
  142. package/dist/queries/trace.d.ts +4 -2
  143. package/dist/queries/trace.js +1 -1
  144. package/dist/queries/wrapper-candidates.d.ts +3 -1
  145. package/dist/queries/wrapper-candidates.js +1 -1
  146. package/package.json +1 -1
  147. package/dist/chunk-25HOGELX.js +0 -2
  148. package/dist/chunk-2TLYCK2L.js +0 -11
  149. package/dist/chunk-3PVIYZ74.js +0 -84
  150. package/dist/chunk-4TX5IMMK.js +0 -12
  151. package/dist/chunk-6DVA22YE.js +0 -2
  152. package/dist/chunk-6GPFHZP3.js +0 -2
  153. package/dist/chunk-7X7FLQC5.js +0 -2
  154. package/dist/chunk-7YI2M2AQ.js +0 -2
  155. package/dist/chunk-AADJ7MCQ.js +0 -2
  156. package/dist/chunk-AV7BOODV.js +0 -4
  157. package/dist/chunk-AXP4H62Q.js +0 -6
  158. package/dist/chunk-C4C3T4K3.js +0 -2
  159. package/dist/chunk-CYJMOTIH.js +0 -2
  160. package/dist/chunk-GBDZY73J.js +0 -2
  161. package/dist/chunk-GPY33RTH.js +0 -19
  162. package/dist/chunk-I377UMS2.js +0 -2
  163. package/dist/chunk-IKQYNTW3.js +0 -2
  164. package/dist/chunk-IZ4KV37N.js +0 -7
  165. package/dist/chunk-KW2F3WSV.js +0 -5
  166. package/dist/chunk-NIN762LD.js +0 -5
  167. package/dist/chunk-Q4R2IYA3.js +0 -7
  168. package/dist/chunk-QPJG6VRT.js +0 -16
  169. package/dist/chunk-TUV2VI7D.js +0 -7
  170. package/dist/chunk-UAPNU7UP.js +0 -2
  171. package/dist/chunk-URCJTFOD.js +0 -2
  172. package/dist/chunk-UUIWMLDX.js +0 -39
  173. package/dist/chunk-VEXS3I3N.js +0 -2
  174. package/dist/chunk-VRC3WKKE.js +0 -2
  175. package/dist/chunk-WFDTS7XL.js +0 -2
  176. package/dist/chunk-YJODB2F5.js +0 -2
  177. package/dist/chunk-Z4AMQWVY.js +0 -90
package/README.md CHANGED
@@ -50,11 +50,30 @@ For goal-oriented usage guides (not just command reference), see **[Agent Guide]
50
50
 
51
51
  Historical implementation plans and completed cleanup notes live in [`docs/plans/`](docs/plans/).
52
52
 
53
+ ## Install From npm
54
+
55
+ Install the published CLI globally from npm:
56
+
57
+ ```bash
58
+ npm install -g scip-query@latest
59
+ scip-query --version
60
+ ```
61
+
62
+ You can also run it without a global install:
63
+
64
+ ```bash
65
+ npx scip-query@latest --version
66
+ npx scip-query@latest reindex
67
+ ```
68
+
69
+ The npm package is published at [`scip-query`](https://www.npmjs.com/package/scip-query). `@latest` should resolve to the newest published version.
70
+
53
71
  ## Quick Start
54
72
 
55
73
  ```bash
56
74
  # Install
57
- npm install -g scip-query
75
+ npm install -g scip-query@latest
76
+ scip-query --version
58
77
  scip-query check-deps # verify optional indexers and parser support
59
78
  scip-query install-skills # install built-in Codex/Claude skills
60
79
 
@@ -0,0 +1,2 @@
1
+ import{a as p}from"./chunk-LNUZWWWL.js";import{k as c,l as u}from"./chunk-EHEZLULQ.js";import{s as m}from"./chunk-NLJCXHFU.js";function w(n,e={}){let{limit:r=20,scope:s,minFanIn:l=2,minFanOut:t=2,scanLimit:i}=e,f=new p(n);return y(f.productionCallableDefinitions({scope:s,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof i=="number"&&i>0}),i).map(o=>b(n,o,e.semantic!==!1)).filter(o=>o.fanIn>=l&&o.fanOut>=t).sort((o,a)=>a.score-o.score||a.fanIn-o.fanIn).slice(0,r)}function b(n,e,r){let s=new Set(u(n,e,{limit:500,semantic:r}).map(t=>t.file)).size,l=new Set(c(n,e,{limit:500,semantic:r}).filter(t=>t.file!==e.relativePath).map(t=>`${t.symbol}|${t.file}`)).size;return{symbol:e.symbol,shortName:m(e.symbol),fanIn:s,fanOut:l,score:s*l,definedIn:e.relativePath}}function y(n,e){return typeof e!="number"||e<=0||n.length<=e?n:n.slice(0,e)}export{w as a};
2
+ //# sourceMappingURL=chunk-2OP63JQQ.js.map
@@ -0,0 +1,5 @@
1
+ import{a as b,b as w,c as F,d as G,e as ee,f as D,g as v,h as _,i as W,j as J,k as h,l as z,m as q}from"./chunk-67OMD56K.js";import{a as $,c as K,d as k,h as j,i as Y,l as g}from"./chunk-NLJCXHFU.js";function te(e){return e.replace(/'''[\s\S]*?'''/g,C).replace(/"""[\s\S]*?"""/g,C).replace(/#.*$/gm,C).replace(/\/\/.*$/gm,C).replace(/\/\*[\s\S]*?\*\//g,C).replace(/`(?:\\[\s\S]|[^`])*`/g,C).replace(/'(?:\\.|[^'\\\r\n])*'/g,C).replace(/"(?:\\.|[^"\\\r\n])*"/g,C)}function C(e){return e.replace(/[^\r\n]/g," ")}var V=K("stripped-lines");function Tt(e,r,t){return V.get(e,r,t,()=>te(t).split(`
2
+ `))}function kt(e){V.invalidateAll(e),U=null,O=""}function At(e,r){V.invalidate(e,r),U=null,O=""}var U=null,O="";function _e(e){return U===e||(U=e,O=te(e)),O}function E(e,r,t){let s=_e(e);return`${s.slice(0,r)}${" ".repeat(t-r)}${s.slice(t)}`}function S(e,r){return new RegExp(`\\b${re(r)}\\b`,"m").test(e)}function A(e,r){let t=new Set,s=new RegExp(`\\b${re(r)}\\s*\\.\\s*([A-Za-z_$][\\w$]*)`,"g");for(let n of e.matchAll(s)){let i=n[1];i&&t.add(i)}return[...t]}function re(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Ce=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier","field_identifier"]);function x(e){let r=[],t=0,s=0;for(let n=0;n<e.length;n++){let i=e[n];(i==="{"||i==="["||i==="(")&&t++,(i==="}"||i==="]"||i===")")&&t--,i===","&&t===0&&(r.push(e.slice(s,n)),s=n+1)}return r.push(e.slice(s)),r}function y(e,r){for(let t of e.namedChildren)if(t.type===r)return t;return null}function f(e,r){let t=new Set,s=(n,i)=>{let o=i||r.has(n.type);!o&&Ce.has(n.type)&&t.add(n.text);for(let a of n.children)s(a,o)};return s(e.rootNode,!1),t}function P(e,r,t,s,n,i,o){return{importedName:n,localName:i,sourcePath:o??h(e,s,ee(r)),kind:"named",used:S(t,i),usedMembers:[]}}function N(e,r,t){let s=[];for(let n of e.matchAll(r)){let i=n[0];if(!i||typeof n.index!="number")continue;let o=E(e,n.index,n.index+i.length);for(let a of t(n,o))s.push(a)}return s}function ne(e,r,t){let s=g(e,r);return s?Ee(e,r,s):we(t).flatMap(n=>qe(e,r,n.clause,n.specifier,n.start,n.end,t))}function Ee(e,r,t){let s=Re(e,r,t),n=[];for(let i of t.rootNode.descendantsOfType("import_statement"))n.push(...De(e,r,t,i,s));return n}function Re(e,r,t){let s=f(t,new Set(["import_statement"]));if(Y(r))for(let n of Ke(e,r))s.add(n);return s}function De(e,r,t,s,n){let i=ve(s);if(!i)return[];let o=D(e,r,i),a=y(s,"import_clause");return a?Te(t,a,o,n,Oe(s.text)):[ke(o)]}function Te(e,r,t,s,n){let i=[];for(let o of r.namedChildren)if(o.type==="identifier")i.push(Ae(o.text,t,s,n));else if(o.type==="namespace_import"){let a=Me(e,o,t,s,n);a&&i.push(a)}else o.type==="named_imports"&&i.push(...$e(o,t,s,n));return i}function ke(e){return{importedName:"*",localName:null,sourcePath:e,kind:"side-effect",used:!0,usedMembers:[]}}function Ae(e,r,t,s){return{importedName:"default",localName:e,sourcePath:r,kind:"default",used:t.has(e),usedMembers:[],isTypeOnly:s}}function Me(e,r,t,s,n){let o=y(r,"identifier")?.text??"";if(!o)return null;let a=je(e,o);return{importedName:"*",localName:o,sourcePath:t,kind:"namespace",used:a.length>0||s.has(o),usedMembers:a,isTypeOnly:n}}function $e(e,r,t,s){let n=[];for(let i of e.namedChildren){if(i.type!=="import_specifier")continue;let o=i.namedChild(0),a=i.namedChild(1);if(!o)continue;let c=o.text,p=a?.text??c;n.push({importedName:c,localName:p,sourcePath:r,kind:"named",used:t.has(p),usedMembers:[],isTypeOnly:s||Le(i.text)})}return n}function ve(e){let r=y(e,"string");if(!r)return null;let t=y(r,"string_fragment");return t?t.text:null}function Oe(e){return/^\s*import\s+type\b/.test(e)}function Le(e){return/^\s*type\b/.test(e.trim())}function je(e,r){let t=new Set;for(let s of e.rootNode.descendantsOfType("member_expression")){let n=s.namedChild(0),i=s.namedChild(1);!n||!i||n.type!=="identifier"||n.text!==r||(i.type==="property_identifier"||i.type==="identifier")&&t.add(i.text)}return[...t]}function we(e){let r=[],t=/^[ \t]*import\s+([\s\S]*?)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let n of e.matchAll(t)){let i=n[0],o=n[1],a=n[2];!i||!a||typeof n.index!="number"||r.push({clause:o,specifier:a,start:n.index,end:n.index+i.length})}let s=/^[ \t]*import\s+['"]([^'"]+)['"]\s*;?/gm;for(let n of e.matchAll(s)){let i=n[0],o=n[1];!i||!o||typeof n.index!="number"||r.push({clause:null,specifier:o,start:n.index,end:n.index+i.length})}return r.sort((n,i)=>n.start-i.start)}function qe(e,r,t,s,n,i,o){let a=D(e,r,s),c=E(o,n,i);return t?Ue(t).map(u=>({...u,sourcePath:a})).map(u=>{if(u.kind==="namespace"){let m=A(c,u.localName);return{...u,used:m.length>0||S(c,u.localName),usedMembers:m}}return u.kind==="side-effect"?{...u,used:!0,usedMembers:[]}:{...u,used:u.localName?S(c,u.localName):!1,usedMembers:[]}}):[{importedName:"*",localName:null,sourcePath:a,kind:"side-effect",used:!0,usedMembers:[]}]}function Ue(e){let r=e.trim(),t=/^type\b/.test(r),s=r.replace(/^type\s+/,""),[n,i]=Be(s),o=[];return n&&o.push(...se(n,t)),i&&o.push(...se(i,t)),o}function se(e,r){let t=e.trim();if(!t)return[];if(t.startsWith("{")){let s=t.slice(1,-1).trim();return s?x(s).map(n=>{let i=n.trim(),o=r||/^type\b/.test(i),a=i.replace(/^type\s+/,""),[c,p]=a.split(/\s+as\s+/);return{importedName:c.trim(),localName:(p??c).trim(),kind:"named",isTypeOnly:o}}):[]}return t.startsWith("* as ")?[{importedName:"*",localName:t.slice(5).trim(),kind:"namespace",isTypeOnly:r}]:[{importedName:"default",localName:t,kind:"default",isTypeOnly:r}]}function Be(e){let r=0;for(let t=0;t<e.length;t++){let s=e[t];if(s==="{"&&r++,s==="}"&&r--,s===","&&r===0)return[e.slice(0,t).trim(),e.slice(t+1).trim()]}return[e.trim(),null]}function oe(e,r){let t=g(e,r);if(t)return He(e,r,t);let s=k(e,r);return s?Fe(e,r,s):[]}function Fe(e,r,t){return[...We(e,r,t),...Je(e,r,t),...ze(e,r,t)]}function We(e,r,t){let s=[],n=/^[ \t]*export\s+(?:type\s+)?\{([\s\S]*?)\}\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let i of t.matchAll(n)){if(typeof i.index!="number")continue;let o=i[1]??"",a=i[2]??"",c=x(o).map(m=>Ve(m.trim())).filter(m=>!!m),p=M(t,i.index),u=M(t,i.index+i[0].length-1);s.push({kind:"named",sourcePath:D(e,r,a),names:c,startLine:p,endLine:u})}return s}function Je(e,r,t){let s=[],n=/^[ \t]*export\s+\*\s+as\s+(\w+)\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let i of t.matchAll(n)){if(typeof i.index!="number")continue;let o=i[2]??"",a=M(t,i.index),c=M(t,i.index+i[0].length-1);s.push({kind:"star-as",sourcePath:D(e,r,o),names:[],startLine:a,endLine:c})}return s}function ze(e,r,t){let s=[],n=/^[ \t]*export\s+\*\s+from\s+['"]([^'"]+)['"]\s*;?/gm;for(let i of t.matchAll(n)){if(typeof i.index!="number")continue;let o=i[1]??"",a=M(t,i.index),c=M(t,i.index+i[0].length-1);s.push({kind:"star",sourcePath:D(e,r,o),names:[],startLine:a,endLine:c})}return s}function Ve(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 s=r.match(/^(\w+)$/);return s?s[1]??null:null}function M(e,r){let t=0;for(let s=0;s<r&&s<e.length;s++)e.charCodeAt(s)===10&&t++;return t}function He(e,r,t){let s=[];for(let n of t.rootNode.descendantsOfType("export_statement")){let i=Qe(e,r,n);if(i===void 0)continue;let o=n.startPosition.row,a=n.endPosition.row,c=Xe(n,i,o,a);s.push(c)}return s}function Qe(e,r,t){let s=y(t,"string");if(!s)return;let n=y(s,"string_fragment");if(n)return D(e,r,n.text)}function Xe(e,r,t,s){let n=y(e,"export_clause");if(n){let o=[];for(let a of n.namedChildren){if(a.type!=="export_specifier")continue;let c=a.namedChild(0),p=a.namedChild(1);c&&o.push((p??c).text)}return{kind:"named",sourcePath:r,names:o,startLine:t,endLine:s}}return y(e,"namespace_export")?{kind:"star-as",sourcePath:r,names:[],startLine:t,endLine:s}:{kind:"star",sourcePath:r,names:[],startLine:t,endLine:s}}var Ze=$("vue-non-script-identifiers");function Ke(e,r){return Ze.get(e,r,()=>{let t=new Set,s=k(e,r);if(!s)return t;let i=s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g,o=>o.replace(/[^\r\n]/g," ")).replace(/<!--[\s\S]*?-->/g,o=>o.replace(/[^\r\n]/g," ")).replace(/\/\*[\s\S]*?\*\//g,o=>o.replace(/[^\r\n]/g," "));for(let o of i.matchAll(/[A-Za-z_$][\w$]*/g))t.add(o[0]);return t})}import{basename as ie}from"path";function ae(e,r,t){let s=g(e,r);return s?Ye(e,r,s):N(t,/^[ \t]*#include\s+[<"]([^">]+)[">]\s*$/gm,(n,i)=>{let o=n[1]?.trim();if(!o)return[];let a=ie(o).replace(/\.[^.]+$/,"");return[{importedName:o,localName:a,sourcePath:J(e,r,o),kind:"named",used:S(i,a),usedMembers:[]}]})}function Ye(e,r,t){let s=f(t,new Set(["preproc_include"])),n=[];for(let i of t.rootNode.descendantsOfType("preproc_include")){let o=null;for(let c of i.namedChildren){if(c.type==="system_lib_string"){o=c.text.replace(/^<|>$/g,"");break}if(c.type==="string_literal"){o=c.namedChildren.find(u=>u.type==="string_content")?.text??c.text.replace(/^"|"$/g,"");break}}if(!o)continue;let a=ie(o).replace(/\.[^.]+$/,"");n.push({importedName:o,localName:a,sourcePath:J(e,r,o),kind:"named",used:s.has(a),usedMembers:[]})}return n}function ce(e,r,t){let s=[];for(let n of t.matchAll(/^[ \t]*import\s+['"]([^'"]+)['"](?:\s+as\s+([A-Za-z_]\w*))?[\s\S]*?;$/gm)){let i=n[1]?.trim(),o=n[2]?.trim()??null,a=n[0];if(!i||!a||typeof n.index!="number")continue;let c=E(t,n.index,n.index+a.length);s.push({importedName:i,localName:o,sourcePath:z(e,r,i),kind:o?"namespace":"side-effect",used:o?S(c,o):!0,usedMembers:o?A(c,o):[]})}return s}function pe(e,r,t){let s=[];for(let n of t.matchAll(/^[ \t]*export\s+['"]([^'"]+)['"][\s\S]*?;$/gm)){let i=n[1]?.trim();i&&s.push({specifier:i,sourcePath:z(e,r,i)})}return s}function me(e,r,t){let s=g(e,r),n=j(r);if(s&&n==="csharp")return et(e,r,s);if(s&&n==="vb")return Ge(e,r,s);let i=G(r)?/^[ \t]*Imports\s+(.+?)\s*$/gm:/^[ \t]*using\s+(.+?)\s*;$/gm;return N(t,i,(o,a)=>{let c=o[1]?.trim();if(!c)return[];let[p,u]=c.split(/\s*=\s*/),m=!!u,l=(m?u:p)?.trim()??c,d=l.split(".").pop()??l,I=m?p?.trim()??d:d;return[P(e,r,a,l,d,I,h(e,l,w))]})}function Ge(e,r,t){let s=f(t,new Set(["imports_statement"])),n=[];for(let i of t.rootNode.descendantsOfType("imports_statement")){let o=i.namedChildren.filter(l=>l.type==="namespace_name");if(o.length===0)continue;let a=o[o.length-1],c=o.length>1?o[0]:null,p=a.text,u=p.split(".").pop()??p,m=c?.text??u;n.push({importedName:u,localName:m,sourcePath:h(e,p,w),kind:c?"namespace":"named",used:s.has(m),usedMembers:[]})}return n}function et(e,r,t){let s=f(t,new Set(["using_directive"])),n=[];for(let i of t.rootNode.descendantsOfType("using_directive")){let o=i.namedChildren;if(o.length===0)continue;let a=null,c;o.length>=2&&o[0].type==="identifier"&&(o[1].type==="qualified_name"||o[1].type==="identifier")?(a=o[0],c=o[1]):c=o[o.length-1];let p=c.text,u=p.split(".").pop()??p,m=a?.text??u;n.push({importedName:u,localName:m,sourcePath:h(e,p,w),kind:a?"namespace":"named",used:s.has(m),usedMembers:[]})}return n}function ue(e,r,t){let s=g(e,r),n=j(r);return s&&n==="java"?tt(e,r,s):s&&n==="kotlin"?rt(e,r,s):s&&n==="scala"?st(e,r,s):N(t,/^[ \t]*import\s+(?:static\s+)?(.+?)\s*;?$/gm,(i,o)=>{let a=i[1]?.trim();return a?nt(e,r,a,o):[]})}function tt(e,r,t){let s=f(t,new Set(["import_declaration"])),n=[];for(let i of t.rootNode.descendantsOfType("import_declaration")){let o=i.children.some(m=>m.type==="asterisk"),c=i.namedChildren.find(m=>m.type==="scoped_identifier")??i.namedChildren.find(m=>m.type==="identifier");if(!c)continue;let p=c.text;if(o){n.push({importedName:"*",localName:null,sourcePath:h(e,p,b),kind:"namespace",used:!0,usedMembers:[]});continue}let u=p.split(".").pop()??p;n.push({importedName:u,localName:u,sourcePath:h(e,p,b),kind:"named",used:s.has(u),usedMembers:[]})}return n}function rt(e,r,t){let s=f(t,new Set(["import_header","import_list"])),n=[];for(let i of t.rootNode.descendantsOfType("import_header")){let o=i.namedChildren.find(d=>d.type==="identifier");if(!o)continue;let a=i.namedChildren.some(d=>d.type==="wildcard_import"),c=i.namedChildren.find(d=>d.type==="import_alias");if(a){n.push({importedName:"*",localName:null,sourcePath:h(e,o.text,b),kind:"namespace",used:!0,usedMembers:[]});continue}let p=o.text,u=p.split(".").pop()??p,l=c?.namedChild(0)?.text??u;n.push({importedName:u,localName:l,sourcePath:h(e,p,b),kind:"named",used:s.has(l),usedMembers:[]})}return n}function st(e,r,t){let s=f(t,new Set(["import_declaration"])),n=[];for(let i of t.rootNode.descendantsOfType("import_declaration")){let o=i.namedChildren.find(m=>m.type==="namespace_selectors"||m.type==="namespace_wildcard"),a=i.namedChildren.filter(m=>m!==o&&(m.type==="identifier"||m.type==="stable_identifier")),c=a.map(m=>m.text).join(".");if(!c)continue;if(o?.type==="namespace_wildcard"){n.push({importedName:"*",localName:null,sourcePath:h(e,c,b),kind:"namespace",used:!0,usedMembers:[]});continue}if(o?.type==="namespace_selectors"){for(let m of o.namedChildren)if(m.type==="arrow_renamed_identifier"){let[l,d]=m.namedChildren;if(!l)continue;let I=l.text,R=d?.text??I;if(I==="_")continue;n.push({importedName:I,localName:R,sourcePath:h(e,`${c}.${I}`,b),kind:"named",used:s.has(R),usedMembers:[]})}else if(m.type==="identifier"){let l=m.text;n.push({importedName:l,localName:l,sourcePath:h(e,`${c}.${l}`,b),kind:"named",used:s.has(l),usedMembers:[]})}continue}let p=a[a.length-1]?.text??c,u=a.slice(0,-1).map(m=>m.text).join(".")||c;n.push({importedName:p,localName:p,sourcePath:h(e,u&&a.length>1?`${u}.${p}`:c,b),kind:"named",used:s.has(p),usedMembers:[]})}return n}function nt(e,r,t,s){if(t.includes("{")&&t.includes("}")){let n=t.slice(0,t.indexOf("{")).replace(/\.$/,"").trim(),i=t.slice(t.indexOf("{")+1,t.lastIndexOf("}")).trim();return x(i).flatMap(o=>{let a=o.trim();if(!a)return[];let[c,p]=a.includes("=>")?a.split(/\s*=>\s*/):a.split(/\s+as\s+/),u=c?.trim();if(!u||u==="_")return[];let m=(p??u.split(".").pop()??u).trim(),l=u==="_"?n:`${n}.${u}`.replace(/\.\./g,".");return[P(e,r,s,l,u,m)]})}return[P(e,r,s,t,t.split(".").pop()??t,t.split(".").pop()??t)]}function de(e,r,t){let s=g(e,r);return s?ot(e,r,s):N(t,/^[ \t]*use\s+(.+?)\s*;$/gm,(n,i)=>{let o=n[1]?.trim();return o?x(o).flatMap(a=>{let c=a.trim();if(!c)return[];let[p,u]=c.split(/\s+as\s+/i),m=p?.trim()??c,l=m.split("\\").pop()??m,d=(u??l).trim();return[P(e,r,i,m,l,d,h(e,m.replace(/\\/g,"."),F))]}):[]})}function ot(e,r,t){let s=f(t,new Set(["namespace_use_declaration"])),n=[],i=(o,a,c)=>{n.push({importedName:a,localName:c,sourcePath:h(e,o.replace(/\\/g,"."),F),kind:"named",used:s.has(c),usedMembers:[]})};for(let o of t.rootNode.descendantsOfType("namespace_use_declaration")){let a=o.namedChildren.find(c=>c.type==="namespace_use_group");if(a){let c=o.namedChildren.find(p=>p.type==="namespace_name")?.text??"";for(let p of a.namedChildren){if(p.type!=="namespace_use_clause")continue;let{importedName:u,localName:m,qualified:l}=le(p,c);u&&i(l,u,m)}continue}for(let c of o.namedChildren){if(c.type!=="namespace_use_clause")continue;let{importedName:p,localName:u,qualified:m}=le(c,"");p&&i(m,p,u)}}return n}function le(e,r){let t=e.namedChildren.find(p=>p.type==="qualified_name"),s=e.namedChildren.filter(p=>p.type==="name"),n="";t?n=t.text:s.length>=1&&(n=s[0].text);let i=t&&s.length>0?s[s.length-1]:null,o=n.split("\\").pop()??n,a=i?.text??o,c=r?`${r}\\${n}`:n;return{importedName:o,localName:a,qualified:c}}function he(e,r,t){let s=g(e,r);return s?it(e,r,s):ct(t).flatMap(n=>mt(e,r,n,t))}function it(e,r,t){let s=f(t,new Set(["import_statement","import_from_statement"])),n=[];for(let i of t.rootNode.descendantsOfType("import_statement"))for(let o of i.namedChildren){let a=fe(o);if(!a)continue;let c=v(e,r,a.qualifiedName);n.push({importedName:a.qualifiedName,localName:a.localName,sourcePath:c,kind:"namespace",used:s.has(a.localName),usedMembers:[]})}for(let i of t.rootNode.descendantsOfType("import_from_statement")){let o=i.namedChild(0);if(!o)continue;let a=at(o);if(a===null)continue;let c=v(e,r,a);for(let p=1;p<i.namedChildCount;p+=1){let u=i.namedChild(p);if(u.type==="wildcard_import"){n.push({importedName:"*",localName:null,sourcePath:c,kind:"side-effect",used:!0,usedMembers:[]});continue}let m=fe(u);m&&n.push({importedName:m.qualifiedName,localName:m.localName,sourcePath:c,kind:"named",used:s.has(m.localName),usedMembers:[]})}}return n}function fe(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 at(e){if(e.type==="dotted_name")return e.text;if(e.type==="relative_import"){let r=y(e,"import_prefix")?.text??"",t=y(e,"dotted_name")?.text??"";return`${r}${t}`}return null}function ct(e){let r=e.split(`
3
+ `),t=[],s=0;for(let n=0;n<r.length;n++){let i=r[n],o=i.trimStart(),a=s;if(s+=i.length+1,!o.startsWith("import ")&&!o.startsWith("from "))continue;let c=i,p=a+i.length,u=ge(i);for(;n+1<r.length&&(u>0||c.trimEnd().endsWith("\\"));){n++;let l=r[n];c+=`
4
+ ${l}`,p+=1+l.length,u+=ge(l),s+=l.length+1}let m=pt(c);m&&t.push({...m,start:a,end:p})}return t}function pt(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 s=t[2].trim();return s.startsWith("(")&&s.endsWith(")")&&(s=s.slice(1,-1).trim()),{kind:"from",module:t[1],clause:s}}function mt(e,r,t,s){let n=E(s,t.start,t.end),i=t.clause.replace(/\n/g," ").trim();if(t.kind==="import")return x(i).flatMap(c=>{let p=c.trim().replace(/,$/,"");if(!p)return[];let[u,m]=p.split(/\s+as\s+/),l=u.trim(),d=(m??l.split(".")[0]??l).trim(),I=v(e,r,l),R=A(n,d);return[{importedName:l,localName:d,sourcePath:I,kind:"namespace",used:S(n,d)||R.length>0,usedMembers:R}]});let o=t.module?v(e,r,t.module):null,a=[];for(let c of x(i)){let p=c.trim().replace(/,$/,"");if(!p)continue;if(p==="*"){a.push({importedName:"*",localName:null,sourcePath:o,kind:"side-effect",used:!0,usedMembers:[]});continue}let[u,m]=p.split(/\s+as\s+/),l=(m??u).trim();a.push({importedName:u.trim(),localName:l,sourcePath:o,kind:"named",used:S(n,l),usedMembers:[]})}return a}function ge(e){let r=0;for(let t of e)t==="("&&r++,t===")"&&r--;return r}import{basename as ut}from"path";function Se(e,r,t){let s=g(e,r);return s?lt(e,r,s):N(t,/^[ \t]*(require_relative|require)\s+["']([^"']+)["']\s*$/gm,(n,i)=>{let o=n[1],a=n[2];if(!o||!a)return[];let c=o==="require_relative"?W(e,r,a):null;if(c){let p=xe(a);return[{importedName:p,localName:p,sourcePath:c,kind:"named",used:S(i,p),usedMembers:[]}]}return[{importedName:a,localName:null,sourcePath:c,kind:"side-effect",used:!0,usedMembers:[]}]})}function lt(e,r,t){let s=f(t,new Set([])),n=[],i=new Set(["require","require_relative","load"]);for(let o of t.rootNode.descendantsOfType("call")){let a=o.namedChild(0);if(!a||a.type!=="identifier"||!i.has(a.text))continue;let p=o.namedChildren.find(d=>d.type==="argument_list")?.namedChild(0);if(!p||p.type!=="string")continue;let m=p.namedChildren.find(d=>d.type==="string_content")?.text;if(!m)continue;let l=a.text==="require_relative"?W(e,r,m):null;if(l){let d=xe(m);n.push({importedName:d,localName:d,sourcePath:l,kind:"named",used:s.has(d),usedMembers:[]})}else n.push({importedName:m,localName:null,sourcePath:l,kind:"side-effect",used:!0,usedMembers:[]})}return n}function xe(e){return ut(e).replace(/\.[^.]+$/,"").split("_").filter(Boolean).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")}function ye(e,r,t){let s=g(e,r);return s?dt(e,r,s):N(t,/^[ \t]*use\s+(.+?)\s*;$/gm,(n,i)=>{let o=n[1]?.trim();return o?ft(e,r,o,i):[]})}function dt(e,r,t){let s=f(t,new Set(["use_declaration"])),n=[];for(let i of t.rootNode.descendantsOfType("use_declaration")){let o=i.namedChild(0);if(o)for(let a of L(o,"")){if(!a.importedName||a.importedName==="*")continue;let c=_(e,r,a.qualifiedName)??_(e,r,a.qualifiedName.split("::").slice(0,-1).join("::"));n.push({importedName:a.importedName,localName:a.localName,sourcePath:c,kind:"named",used:s.has(a.localName),usedMembers:[]})}}return n}function L(e,r){switch(e.type){case"identifier":case"super":case"self":case"crate":{let t=e.text;return[{qualifiedName:B(r,t),importedName:t,localName:t}]}case"scoped_identifier":{let t=e.text,s=t.split("::").pop()??t;return[{qualifiedName:B(r,t),importedName:s,localName:s}]}case"scoped_use_list":{let t=e.namedChild(0),s=e.namedChild(1);if(!t||!s)return[];let n=B(r,t.text),i=[];for(let o of s.namedChildren)i.push(...L(o,n));return i}case"use_list":{let t=[];for(let s of e.namedChildren)t.push(...L(s,r));return t}case"use_as_clause":{let t=e.namedChild(0),s=e.namedChild(1);if(!t||!s)return[];let n=L(t,r),i=s.text;return n.map(o=>({...o,localName:i}))}case"use_wildcard":{let t=e.namedChild(0),s=t?t.text:"";return[{qualifiedName:B(r,`${s}::*`),importedName:"*",localName:"*"}]}default:return[]}}function B(e,r){return e?r?`${e}::${r}`:e:r}function ft(e,r,t,s){let n=t.trim();if(n.includes("{")&&n.includes("}")){let u=n.slice(0,n.indexOf("{")).replace(/::$/,"").trim(),m=n.slice(n.indexOf("{")+1,n.lastIndexOf("}")).trim();return x(m).flatMap(l=>{let d=l.trim();if(!d||d==="self")return[];let[I,R]=d.split(/\s+as\s+/),T=I?.trim();if(!T)return[];let Pe=(R??T.split("::").pop()??T).trim(),be=`${u}::${T}`.replace(/::::/g,"::");return[P(e,r,s,be,T.split("::").pop()??T,Pe,_(e,r,u))]})}let[i,o]=n.split(/\s+as\s+/),a=i?.trim()??n,c=(o??a.split("::").pop()??a).trim(),p=_(e,r,a)??_(e,r,a.split("::").slice(0,-1).join("::"));return[P(e,r,s,a,a.split("::").pop()??a,c,p)]}function Ne(e,r,t){let s=g(e,r);if(s)return gt(e,r,s);let n=[];for(let i of t.matchAll(/^[ \t]*pub\s+use\s+(.+?)\s*;$/gm)){let o=i[1]?.trim();o&&n.push(...St(e,r,o))}return n}function gt(e,r,t){let s=[];for(let n of t.rootNode.descendantsOfType("use_declaration")){if(!ht(n))continue;let i=n.namedChildren.find(o=>o.type!=="visibility_modifier");if(i)for(let o of L(i,""))o.importedName&&s.push(H(e,r,o.qualifiedName))}return s}function ht(e){for(let r of e.children)if(r.type==="visibility_modifier"&&r.text.startsWith("pub"))return!0;return!1}function St(e,r,t){let s=t.trim();if(s.includes("{")&&s.includes("}")){let n=s.slice(0,s.indexOf("{")).replace(/::$/,"").trim(),i=s.slice(s.indexOf("{")+1,s.lastIndexOf("}")).trim();return x(i).flatMap(o=>{let a=o.trim();if(!a||a==="self")return[];let[c]=a.split(/\s+as\s+/),p=`${n}::${c?.trim()??a}`.replace(/::::/g,"::");return[H(e,r,p)]})}return[H(e,r,s)]}function H(e,r,t){return{specifier:t,sourcePath:_(e,r,t)??_(e,r,t.split("::").slice(0,-1).join("::"))}}function Ie(e,r){let t=r.toLowerCase();for(let s of e)for(let n of s.extensions)if(t.endsWith(n))return s;return null}var xt={language:"javascript",extensions:[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],parseImports:ne},yt={language:"python",extensions:[".py",".pyi"],parseImports:he},Nt={language:"jvm",extensions:[".java",".scala",".kt",".kts"],parseImports:ue},It={language:"rust",extensions:[".rs"],parseImports:ye,parseExports:Ne},Pt={language:"ruby",extensions:[".rb"],parseImports:Se},bt={language:"c/cpp",extensions:[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],parseImports:ae},_t={language:"dotnet",extensions:[".cs",".vb"],parseImports:me},Ct={language:"dart",extensions:[".dart"],parseImports:ce,parseExports:pe},Et={language:"php",extensions:[".php"],parseImports:de},Rt=[xt,yt,Nt,It,Pt,bt,_t,Ct,Et];function Q(e){return Ie(Rt,e)}function Fr(e,r){return oe(e,r)}var X=$("source-imports"),Z=$("source-exports");function Wr(e,r){let t=q(r);return X.get(e,t,()=>{let s=Q(t);if(!s)return[];let n=k(e,t);return n?s.parseImports(e,t,n):[]})}function Jr(e,r){let t=q(r);return Z.get(e,t,()=>{let s=Q(t);if(!s?.parseExports)return[];let n=k(e,t);return n?s.parseExports(e,t,n):[]})}function zr(e){X.invalidateAll(e),Z.invalidateAll(e)}function Vr(e,r){let t=q(r);X.invalidate(e,t),Z.invalidate(e,t)}export{te as a,Tt as b,kt as c,At as d,re as e,Fr as f,Wr as g,Jr as h,zr as i,Vr as j};
5
+ //# sourceMappingURL=chunk-33Z6HQBX.js.map
@@ -0,0 +1,2 @@
1
+ import{g as c,i as n}from"./chunk-EHEZLULQ.js";import{c as o,i as m}from"./chunk-33Z6HQBX.js";import{n as r}from"./chunk-67OMD56K.js";import{e as t,j as i}from"./chunk-NLJCXHFU.js";import{getHeapStatistics as s}from"v8";var p=64*1024*1024;function P(e,a={}){n(e),a.semanticProvider===!0&&r(e),c(e),m(e),o(e),i(e),t(e)}function _(){let e=globalThis.gc;if(!e)return;let a=s();a.heap_size_limit-a.used_heap_size<p||e()}export{P as a,_ as b};
2
+ //# sourceMappingURL=chunk-3F453KPT.js.map
@@ -1,2 +1,2 @@
1
- import{g as h}from"./chunk-3PVIYZ74.js";function B(e,s={}){let{minSimilarity:t=.5,limit:n=15,scope:i,minChainLength:r=3,maxChainLength:l=8}=s,a=h(e,i),o=y(a,r,l);if(o.length===0)return[];let f=d(o);return f.length<2?[]:S(C(f,t,n),n)}function d(e){let s=m(e),t=[];for(let n of e){let i=n.filter(r=>!s.has(r));i.length>=2&&t.push({original:n,filtered:i})}return t}function m(e){let{nodeFreq:s,tailFreq:t}=p(e),n=e.length*.9,i=e.length*.8,r=new Set;for(let[a,o]of s)o>n&&r.add(a);for(let[a,o]of t)o>i&&r.add(a);let l=["index.ts","index.js","cli.ts","main.ts","health.ts","health.js"];for(let a of s.keys()){let o=a.split("/").pop()??"";l.includes(o)&&r.add(a)}return r}function p(e){let s=new Map,t=new Map;for(let n of e){let i=new Set;for(let r of n)i.has(r)||(s.set(r,(s.get(r)??0)+1),i.add(r));for(let r=Math.max(0,n.length-2);r<n.length;r++)t.set(n[r],(t.get(n[r])??0)+1)}return{nodeFreq:s,tailFreq:t}}function C(e,s,t){let n=[];for(let i=0;i<e.length;i++){for(let r=i+1;r<e.length;r++){let l=x(e[i],e[r],s);l&&n.push(l)}if(n.length>t*10)break}return n.sort((i,r)=>Math.abs(r.similarity-i.similarity)>.01?r.similarity-i.similarity:i.divergencePoints.length-r.divergencePoints.length),n}function x(e,s,t){if(!b(e.filtered,s.filtered))return null;let{distance:n,ops:i}=F(e.filtered,s.filtered),r=Math.max(e.filtered.length,s.filtered.length);if(r===0)return null;let l=1-n/r;if(l<t||n===0)return null;let a=i.filter(f=>f.type==="substitute").map(f=>({index:f.indexA,nodeA:e.filtered[f.indexA],nodeB:s.filtered[f.indexB]}));return a.length===0||i.filter(f=>f.type==="match").length<2?null:{chainA:e.original,chainB:s.original,similarity:l,editDistance:n,divergencePoints:a,commonPrefix:A(e.original,s.original),commonSuffix:M(e.original,s.original)}}function b(e,s){let t=new Set(e);return s.some(n=>t.has(n))}function S(e,s){let t=[];for(let n of e)if(t.some(r=>c(n.chainA,r.chainA)&&c(n.chainB,r.chainB))||t.push(n),t.length>=s)break;return t}function y(e,s,t){let n=[];for(let r of e.keys()){if(n.length>=500)break;g(e,r,[r],new Set([r]),s,t,n,500)}return n}function g(e,s,t,n,i,r,l,a){if(l.length>=a)return;if(t.length>=r){t.length>=i&&l.push([...t]);return}let o=e.get(s);if(!o||o.size===0){t.length>=i&&l.push([...t]);return}let f=!1;for(let u of o)if(!n.has(u)&&(n.add(u),t.push(u),g(e,u,t,n,i,r,l,a),t.pop(),n.delete(u),f=!0,l.length>=a))return;!f&&t.length>=i&&l.push([...t])}function F(e,s){let t=e.length,n=s.length,i=Array.from({length:t+1},()=>Array(n+1).fill(0));for(let o=0;o<=t;o++)i[o][0]=o;for(let o=0;o<=n;o++)i[0][o]=o;for(let o=1;o<=t;o++)for(let f=1;f<=n;f++)e[o-1]===s[f-1]?i[o][f]=i[o-1][f-1]:i[o][f]=1+Math.min(i[o-1][f],i[o][f-1],i[o-1][f-1]);let r=[],l=t,a=n;for(;l>0||a>0;)l>0&&a>0&&e[l-1]===s[a-1]?(r.unshift({type:"match",indexA:l-1,indexB:a-1}),l--,a--):l>0&&a>0&&i[l][a]===i[l-1][a-1]+1?(r.unshift({type:"substitute",indexA:l-1,indexB:a-1}),l--,a--):a>0&&i[l][a]===i[l][a-1]+1?(r.unshift({type:"insert",indexA:l,indexB:a-1}),a--):(r.unshift({type:"delete",indexA:l-1,indexB:a}),l--);return{distance:i[t][n],ops:r}}function A(e,s){let t=[];for(let n=0;n<Math.min(e.length,s.length)&&e[n]===s[n];n++)t.push(e[n]);return t}function M(e,s){let t=[],n=e.length-1,i=s.length-1;for(;n>=0&&i>=0&&e[n]===s[i];)t.unshift(e[n]),n--,i--;return t}function c(e,s){if(e.length>s.length)return!1;let t=s.join("\u2192"),n=e.join("\u2192");return t.includes(n)}export{B as a};
2
- //# sourceMappingURL=chunk-7PRMSA4Z.js.map
1
+ import{j as h}from"./chunk-EHEZLULQ.js";function B(e,s={}){let{minSimilarity:t=.5,limit:n=15,scope:i,minChainLength:r=3,maxChainLength:l=8}=s,a=h(e,i),o=y(a,r,l);if(o.length===0)return[];let f=d(o);return f.length<2?[]:S(C(f,t,n),n)}function d(e){let s=m(e),t=[];for(let n of e){let i=n.filter(r=>!s.has(r));i.length>=2&&t.push({original:n,filtered:i})}return t}function m(e){let{nodeFreq:s,tailFreq:t}=p(e),n=e.length*.9,i=e.length*.8,r=new Set;for(let[a,o]of s)o>n&&r.add(a);for(let[a,o]of t)o>i&&r.add(a);let l=["index.ts","index.js","cli.ts","main.ts","health.ts","health.js"];for(let a of s.keys()){let o=a.split("/").pop()??"";l.includes(o)&&r.add(a)}return r}function p(e){let s=new Map,t=new Map;for(let n of e){let i=new Set;for(let r of n)i.has(r)||(s.set(r,(s.get(r)??0)+1),i.add(r));for(let r=Math.max(0,n.length-2);r<n.length;r++)t.set(n[r],(t.get(n[r])??0)+1)}return{nodeFreq:s,tailFreq:t}}function C(e,s,t){let n=[];for(let i=0;i<e.length;i++){for(let r=i+1;r<e.length;r++){let l=x(e[i],e[r],s);l&&n.push(l)}if(n.length>t*10)break}return n.sort((i,r)=>Math.abs(r.similarity-i.similarity)>.01?r.similarity-i.similarity:i.divergencePoints.length-r.divergencePoints.length),n}function x(e,s,t){if(!b(e.filtered,s.filtered))return null;let{distance:n,ops:i}=F(e.filtered,s.filtered),r=Math.max(e.filtered.length,s.filtered.length);if(r===0)return null;let l=1-n/r;if(l<t||n===0)return null;let a=i.filter(f=>f.type==="substitute").map(f=>({index:f.indexA,nodeA:e.filtered[f.indexA],nodeB:s.filtered[f.indexB]}));return a.length===0||i.filter(f=>f.type==="match").length<2?null:{chainA:e.original,chainB:s.original,similarity:l,editDistance:n,divergencePoints:a,commonPrefix:A(e.original,s.original),commonSuffix:M(e.original,s.original)}}function b(e,s){let t=new Set(e);return s.some(n=>t.has(n))}function S(e,s){let t=[];for(let n of e)if(t.some(r=>c(n.chainA,r.chainA)&&c(n.chainB,r.chainB))||t.push(n),t.length>=s)break;return t}function y(e,s,t){let n=[];for(let r of e.keys()){if(n.length>=500)break;g(e,r,[r],new Set([r]),s,t,n,500)}return n}function g(e,s,t,n,i,r,l,a){if(l.length>=a)return;if(t.length>=r){t.length>=i&&l.push([...t]);return}let o=e.get(s);if(!o||o.size===0){t.length>=i&&l.push([...t]);return}let f=!1;for(let u of o)if(!n.has(u)&&(n.add(u),t.push(u),g(e,u,t,n,i,r,l,a),t.pop(),n.delete(u),f=!0,l.length>=a))return;!f&&t.length>=i&&l.push([...t])}function F(e,s){let t=e.length,n=s.length,i=Array.from({length:t+1},()=>Array(n+1).fill(0));for(let o=0;o<=t;o++)i[o][0]=o;for(let o=0;o<=n;o++)i[0][o]=o;for(let o=1;o<=t;o++)for(let f=1;f<=n;f++)e[o-1]===s[f-1]?i[o][f]=i[o-1][f-1]:i[o][f]=1+Math.min(i[o-1][f],i[o][f-1],i[o-1][f-1]);let r=[],l=t,a=n;for(;l>0||a>0;)l>0&&a>0&&e[l-1]===s[a-1]?(r.unshift({type:"match",indexA:l-1,indexB:a-1}),l--,a--):l>0&&a>0&&i[l][a]===i[l-1][a-1]+1?(r.unshift({type:"substitute",indexA:l-1,indexB:a-1}),l--,a--):a>0&&i[l][a]===i[l][a-1]+1?(r.unshift({type:"insert",indexA:l,indexB:a-1}),a--):(r.unshift({type:"delete",indexA:l-1,indexB:a}),l--);return{distance:i[t][n],ops:r}}function A(e,s){let t=[];for(let n=0;n<Math.min(e.length,s.length)&&e[n]===s[n];n++)t.push(e[n]);return t}function M(e,s){let t=[],n=e.length-1,i=s.length-1;for(;n>=0&&i>=0&&e[n]===s[i];)t.unshift(e[n]),n--,i--;return t}function c(e,s){if(e.length>s.length)return!1;let t=s.join("\u2192"),n=e.join("\u2192");return t.includes(n)}export{B as a};
2
+ //# sourceMappingURL=chunk-3JGBAAP7.js.map
@@ -0,0 +1,11 @@
1
+ import{a as f}from"./chunk-LLDPR3DG.js";import{a as d}from"./chunk-LNUZWWWL.js";import{q as c}from"./chunk-67OMD56K.js";import{s as u}from"./chunk-NLJCXHFU.js";function I(e,t,i={}){let n=f(e,t);if(!n)return null;let r=h(e,n);if(!r||e.isIgnored(r.relative_path))return null;let o=[],l=0,m=g(e,r.relative_path),p=i.semantic===!1?new Map:c(e,m);for(let s of m){let a=S(e,r,s,p.get(s.symbolId)??new Set);l+=a,o.push({symbol:s.symbol,shortName:u(s.symbol),startLine:s.startLine,endLine:s.endLine,externalConsumers:a,riskLevel:_(a)})}return{file:r.relative_path,symbols:o,totalExternalConsumers:l}}function h(e,t){return e.get(`SELECT id, relative_path FROM documents
2
+ WHERE relative_path = ?
3
+ ${e.pathExclusionsFor("documents")}
4
+ LIMIT 1`,t)??null}function g(e,t){return new d(e).definitionsForFile(t).sort((i,n)=>i.startLine-n.startLine||i.endLine-n.endLine)}function S(e,t,i,n){let r=e.all(`SELECT DISTINCT consumer_d.relative_path
5
+ FROM mentions m
6
+ JOIN chunks c ON m.chunk_id = c.id
7
+ JOIN documents consumer_d ON consumer_d.id = c.document_id
8
+ WHERE m.symbol_id = ?
9
+ AND m.role != 1
10
+ AND c.document_id != ?`,i.symbolId,t.id);return new Set([...r.map(o=>o.relative_path),...[...n].filter(o=>o!==t.relative_path)]).size}function _(e){return e>10?"high":e>0?"medium":"low"}export{I as a};
11
+ //# sourceMappingURL=chunk-3PKPUCIJ.js.map
@@ -0,0 +1,2 @@
1
+ import{G as p,r as d,s as f,u}from"./chunk-NLJCXHFU.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-42BWO2NN.js.map
@@ -0,0 +1,2 @@
1
+ import{k as g}from"./chunk-EHEZLULQ.js";import{a as u}from"./chunk-BT36WY5B.js";import{s as i}from"./chunk-NLJCXHFU.js";function S(r,d,p,f={}){let s=u(r,d),n=u(r,p);if(!s||!n)return null;let c=new Set(g(r,s,{semantic:f.semantic}).map(e=>e.symbol)),h=new Set(g(r,n,{semantic:f.semantic}).map(e=>e.symbol)),l=[];for(let e of c)h.has(e)&&l.push(e);let a=[];for(let e of c)h.has(e)||a.push(e);let o=[];for(let e of h)c.has(e)||o.push(e);let m=new Set([...c,...h]),b=m.size>0?l.length/m.size:0,t;m.size===0?t="Neither function calls other tracked symbols. There is no callee-pattern evidence for consolidation; inspect the source bodies directly.":l.length===0?t="These functions do not share any callees. They are not a callee-based consolidation candidate.":a.length===0&&o.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.":a.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.":o.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.":a.length<=2&&o.length<=2?t=`Create a shared function with the ${l.length} common callees. Pass the ${a.length+o.length} divergent callees as parameters or strategy callbacks.`:t=`Extract the ${l.length} shared callees into a common helper. Each function calls the helper plus its own unique logic (${a.length} callees in A, ${o.length} in B).`;let y=s.endLine-s.startLine+1,A=n.endLine-n.startLine+1;return{symbolA:{symbol:s.symbol,shortName:i(s.symbol),file:s.relativePath,loc:y},symbolB:{symbol:n.symbol,shortName:i(n.symbol),file:n.relativePath,loc:A},similarity:b,sharedCallees:l.map(i),uniqueToA:a.map(i),uniqueToB:o.map(i),consolidationStrategy:t}}export{S as a};
2
+ //# sourceMappingURL=chunk-4MDCFY3E.js.map
@@ -0,0 +1,2 @@
1
+ import{a as C}from"./chunk-LNUZWWWL.js";import{b as L}from"./chunk-EHEZLULQ.js";import{h,s as v,t as S}from"./chunk-NLJCXHFU.js";function D(s,o={}){let{scope:c,minLoc:d=3,scanLimit:r}=o,t=new C(s),l=o.semantic!==!1,a=P(t.productionCallableDefinitions({scope:c,minLoc:d,excludeEntrySurfaces:!0,excludeRustTraitImplMembers:!0,includeSuppressed:!0,sortByLocDesc:typeof r=="number"&&r>0}),r),u=t.crossFileCallerMap(a,{semantic:l}),i=new Set(u.keys()),p=new Map;for(let e of a){let n=S(e.symbol);if(!n)continue;let m=p.get(n)??[];m.push(e.symbolId),p.set(n,m)}let M=s.all(`SELECT relative_path FROM documents WHERE 1 = 1 ${s.pathExclusionsFor("documents")}`);for(let e of M){if(s.isIgnored(e.relative_path)||h(e.relative_path)!=="rust")continue;let n=L(s,e.relative_path);for(let m of n){let I=p.get(m);if(I)for(let w of I)i.add(w)}}let b=g(t,a,{additive:!1,semantic:l}),f=a.filter(e=>!i.has(e.symbolId)).filter(e=>!b.has(e.symbolId)),x=t.sourceFallbackCallerFiles(f);for(let e of x.keys())i.add(e);let y=f.filter(e=>!i.has(e.symbolId)),R=g(t,y,{additive:!0,semantic:l});for(let e of R)b.add(e);return y.filter(e=>!b.has(e.symbolId)).sort((e,n)=>n.endLine-n.startLine-(e.endLine-e.startLine)||e.relativePath.localeCompare(n.relativePath)||e.startLine-n.startLine).map(e=>({symbol:e.symbol,shortName:v(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:e.endLine-e.startLine+1}))}function g(s,o,c){if(o.length===0)return new Set;let d=new Map(o.map(t=>[t.symbolId,t.symbol])),r=s.calleeMap(o,{additive:c.additive,semantic:c.semantic});return new Set([...r.entries()].filter(([t,l])=>{let a=d.get(t);return l.some(u=>u.symbol!==a)}).map(([t])=>t))}function P(s,o){return typeof o!="number"||o<=0||s.length<=o?s:s.slice(0,o)}export{D as a};
2
+ //# sourceMappingURL=chunk-4QWTQ6YV.js.map
@@ -1,5 +1,5 @@
1
- import{a as l}from"./chunk-QFZE73XF.js";import{readdirSync as x}from"fs";import{extname as p,join as g}from"path";var f=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],w=[".vue"],S=new Set(f.map(e=>e.toLowerCase())),m=[...S].sort().join(","),E=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);function C(e,o={}){let s=o.includeIndexed??!0,i=o.includeAuxiliary??!0,t=o.extensions?.map(c=>c.toLowerCase()),r=t?new Set(t):S,a=t?[...r].sort().join(","):m,n=`${s?"1":"0"}|${i?"1":"0"}|${a}`;return h.get(e,n,()=>{let c=new Set;if(s){let u=e.all(`SELECT relative_path
1
+ import{a as l}from"./chunk-NLJCXHFU.js";import{readdirSync as x}from"fs";import{extname as p,join as g}from"path";var f=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],w=[".vue"],S=new Set(f.map(e=>e.toLowerCase())),m=[...S].sort().join(","),E=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);function C(e,o={}){let s=o.includeIndexed??!0,i=o.includeAuxiliary??!0,t=o.extensions?.map(c=>c.toLowerCase()),r=t?new Set(t):S,a=t?[...r].sort().join(","):m,n=`${s?"1":"0"}|${i?"1":"0"}|${a}`;return h.get(e,n,()=>{let c=new Set;if(s){let u=e.all(`SELECT relative_path
2
2
  FROM documents
3
3
  WHERE 1 = 1
4
4
  ${e.pathExclusionsFor("documents")}`);for(let d of u)e.isIgnored(d.relative_path)||r.has(p(d.relative_path).toLowerCase())&&c.add(d.relative_path)}if(i)for(let u of y(e.config.projectRoot,r))e.isIgnored(u)||c.add(u);return[...c].sort()})}var h=l("source-files");function y(e,o){let s=new Set,i=t=>{let r=t?g(e,t):e,a;try{a=x(r,{withFileTypes:!0})}catch{return}for(let n of a)if(!E.has(n.name)){if(n.isDirectory()){i(t?`${t}/${n.name}`:n.name);continue}o.has(p(n.name).toLowerCase())&&s.add(t?`${t}/${n.name}`:n.name)}};return i(""),s}export{w as a,E as b,C as c};
5
- //# sourceMappingURL=chunk-Y4DS3MDC.js.map
5
+ //# sourceMappingURL=chunk-5IRX5I64.js.map
@@ -0,0 +1,2 @@
1
+ import{a as w}from"./chunk-LNUZWWWL.js";import{c as g}from"./chunk-JMASYYSW.js";import{k as p,m as h}from"./chunk-EHEZLULQ.js";import{a as u,b as S}from"./chunk-BT36WY5B.js";import{J as d,s as b}from"./chunk-NLJCXHFU.js";function I(e,o,l={}){let{direction:c="backward",maxDepth:a=3}=l,n=u(e,o);return n?c==="backward"?R(e,n,a,{semantic:l.semantic!==!1}):M(e,n,{semantic:l.semantic!==!1}):null}function R(e,o,l,c){let a=[],n=new Set([o.symbol]),s=[o];for(let m=1;m<=l&&s.length!==0;m++){let t=[];for(let r of s){let i=p(e,r,{semantic:c.semantic});for(let f of i){if(n.has(f.symbol))continue;n.add(f.symbol),a.push({symbol:f.symbol,shortName:b(f.symbol),file:f.file,relationship:m===1?"referenced within definition (callee)":`depth ${m} callee`});let y=S(e,f.symbol);y&&!e.isIgnored(y.relativePath)&&t.push(y)}}s=t}return{symbol:o.symbol,shortName:b(o.symbol),direction:"backward",connectedSymbols:a}}function M(e,o,l){let c=g(e,o,{semantic:l.semantic}),a=c.length>0?c:h(e,o),n=new Set,s=[],m=new w(e);for(let t of a){if(s.length>=30)break;if(e.isIgnored(t.file))continue;let r=t.enclosingSymbol??d(m.definitionsForFile(t.file),t.line)?.symbol??null;if(!r||r===o.symbol)continue;let i=S(e,r);!i||e.isIgnored(i.relativePath)||n.has(i.symbol)||(n.add(i.symbol),s.push({symbol:i.symbol,shortName:b(i.symbol),file:i.relativePath,relationship:`references target at ${t.file}:${t.line+1}`}))}return s.sort((t,r)=>t.file.localeCompare(r.file)),{symbol:o.symbol,shortName:b(o.symbol),direction:"forward",connectedSymbols:s}}export{I as a};
2
+ //# sourceMappingURL=chunk-5MPZ2A7J.js.map
@@ -0,0 +1,90 @@
1
+ import{F,b as Y,t as C}from"./chunk-NLJCXHFU.js";import g from"path";import{createRequire as Ye}from"module";import{existsSync as T,readdirSync as Ge,readFileSync as pe}from"fs";import{existsSync as R}from"fs";import{basename as he,dirname as y,extname as S,join as p,relative as E,resolve as f}from"path";var ye=Y("indexed-paths"),N=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],G=[".py",".pyi"],q=[".java",".scala",".kt",".kts"],Q=[".rs"],Z=[".rb"],ee=[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],te=[".cs",".vb"],ne=[".dart"],re=[".php"],Ie=new Set(N),O=new Set(G),ie=new Set(q),P=new Set(Q),A=new Set(Z),oe=new Set(ee),se=new Set(te),j=new Set(ne),ae=new Set(re),xe=[{extensions:N,lookup:Ie},{extensions:G,lookup:O},{extensions:q,lookup:ie},{extensions:Q,lookup:P},{extensions:Z,lookup:A},{extensions:ee,lookup:oe},{extensions:te,lookup:se},{extensions:ne,lookup:j},{extensions:re,lookup:ae}];function I(t,e){return e.has(S(t).toLowerCase())}function Ee(t){return I(t,O)}function Ne(t){return I(t,ie)}function be(t){return I(t,P)}function ve(t){return I(t,A)}function ke(t){return I(t,oe)}function De(t){return I(t,se)}function Dt(t){return S(t).toLowerCase()===".vb"}function Re(t){return I(t,j)}function Te(t){return I(t,ae)}function Le(t){let e=S(t).toLowerCase();for(let n of xe)if(n.lookup.has(e))return n.extensions;return N}function _e(t){return Ne(t)||De(t)||Te(t)}function w(t,e,n){return Ee(e)?Ce(t,e,n):be(e)?Fe(t,e,n):ve(e)?Oe(t,e,n):ke(e)?Pe(t,e,n):_e(e)?Ae(t,n.replace(/\\/g,"."),Le(e)):Re(e)?je(t,e,n):Me(t,e,n)}function Me(t,e,n){if(!n.startsWith(".")&&!n.startsWith("/"))return null;let r=y(p(t.config.projectRoot,e)),i=f(r,n),o=b(t);for(let s of Ke(i)){let a=x(E(t.config.projectRoot,s));if(o.has(a)||R(s))return a}return x(E(t.config.projectRoot,i))}function Ce(t,e,n){let r=b(t),i;if(n.startsWith(".")){let o=n.match(/^(\.+)(.*)$/);if(!o)return null;let s=o[1].length,a=o[2].replace(/^\./,""),c=y(p(t.config.projectRoot,e));for(let l=1;l<s;l++)c=y(c);i=a?f(c,a.replace(/\./g,"/")):c}else i=f(t.config.projectRoot,n.replace(/\./g,"/"));for(let o of we(i)){let s=x(E(t.config.projectRoot,o));if(r.has(s)||R(o))return s}return null}function Fe(t,e,n){if(!n)return null;let r=n.replace(/\s+as\s+.+$/,"").trim();if(!r.startsWith("crate::")&&!r.startsWith("self::")&&!r.startsWith("super::"))return null;let i=y(p(t.config.projectRoot,e)),o;return r.startsWith("crate::")?o=f(t.config.projectRoot,"src",r.slice(7).replace(/::/g,"/")):r.startsWith("self::")?o=f(i,r.slice(6).replace(/::/g,"/")):o=f(y(i),r.slice(7).replace(/::/g,"/")),W(t,We(o))}function Oe(t,e,n){let r=y(p(t.config.projectRoot,e)),i=f(r,n);return W(t,$e(i))}function Pe(t,e,n){let r=y(p(t.config.projectRoot,e)),i=[f(r,n),f(t.config.projectRoot,n),f(t.config.projectRoot,"include",n),f(t.config.projectRoot,"src",n)];return W(t,i)}function Ae(t,e,n){let r=b(t),i=e.replace(/\\/g,".").replace(/::/g,".").replace(/^global::/,""),o=i.replace(/\./g,"/"),s=i.split(".").pop()??i;for(let c of n){let l=`${o}${c}`,d=[...r].find(m=>m.endsWith(l));if(d)return d}for(let c of n){let l=[...r].find(d=>he(d)===`${s}${c}`);if(l)return l}let a=[...r].filter(c=>n.includes(S(c).toLowerCase())).filter(c=>c.includes(`/${o}/`)||c.includes(`/${s}/`)).sort((c,l)=>c.localeCompare(l));return a.length===1?a[0]:null}function je(t,e,n){let r=b(t);if(n.startsWith("package:")){let s=n.slice(8),a=s.indexOf("/");if(a<0)return null;let c=s.slice(a+1),l=x(c.startsWith("lib/")?c:`lib/${c}`);return r.has(l)?l:null}let i=y(p(t.config.projectRoot,e)),o=f(i,n);for(let s of Ue(o)){let a=x(E(t.config.projectRoot,s));if(r.has(a)||R(s))return a}return null}function we(t){let e=S(t);return O.has(e)?[t]:[`${t}.py`,`${t}.pyi`,p(t,"__init__.py"),p(t,"__init__.pyi")]}function W(t,e){let n=b(t);for(let r of e){let i=x(E(t.config.projectRoot,r));if(n.has(i)||R(r))return i}return null}function We(t){let e=S(t);return P.has(e)?[t]:[`${t}.rs`,p(t,"mod.rs")]}function $e(t){let e=S(t);return A.has(e)?[t]:[`${t}.rb`,p(t,"index.rb")]}function Ue(t){let e=S(t);return j.has(e)?[t]:[`${t}.dart`,t]}function Ke(t){let e=S(t),n=new Set;if(e){n.add(t);for(let r of N)n.add(t.slice(0,-e.length)+r)}else for(let r of N)n.add(`${t}${r}`),n.add(p(t,`index${r}`));return[...n]}function b(t){return ye.get(t,()=>new Set(t.all(`SELECT relative_path
2
+ FROM documents
3
+ WHERE 1 = 1
4
+ ${t.pathExclusionsFor("documents")}`).map(e=>x(e.relative_path)).filter(e=>!t.isIgnored(e))))}function x(t){return t.replace(/\\/g,"/")}import{existsSync as v,readFileSync as He,readdirSync as Xe,statSync as Je}from"fs";import u from"path";var U=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function K(t,e){let r=e?u.dirname(u.join(t,e)):t,i=u.resolve(t);for(;r.startsWith(i);){for(let s of U){let a=u.join(r,s);if(v(a))return a}let o=u.dirname(r);if(o===r)break;r=o}for(let o of U){let s=u.join(t,o);if(v(s))return s}return null}function ce(t){let e=t.config.projectRoot,n=new Set(Be(e,t.config.semantic?.typescript?.tsconfigs)),r=t.all(`SELECT relative_path
5
+ FROM documents
6
+ WHERE (
7
+ relative_path LIKE '%.ts'
8
+ OR relative_path LIKE '%.tsx'
9
+ OR relative_path LIKE '%.mts'
10
+ OR relative_path LIKE '%.cts'
11
+ OR relative_path LIKE '%.js'
12
+ OR relative_path LIKE '%.jsx'
13
+ OR relative_path LIKE '%.mjs'
14
+ OR relative_path LIKE '%.cjs'
15
+ )
16
+ ${t.pathExclusionsFor("documents")}`);for(let i of r){if(t.isIgnored(i.relative_path))continue;let o=K(e,i.relative_path);o&&n.add(u.resolve(o))}if(n.size===0){let i=K(e);i&&n.add(u.resolve(i))}return[...n].filter(i=>!le(e,i)).sort((i,o)=>i.localeCompare(o))}function Be(t,e=[]){let n=new Set;for(let r of e){let i=u.isAbsolute(r)?r:u.join(t,r);v(i)&&n.add(u.resolve(i))}for(let r of Ve(t))for(let i of U){let o=u.join(r,i);v(o)&&n.add(u.resolve(o))}if(n.size===0){let r=K(t);r&&n.add(u.resolve(r))}return[...n].filter(r=>!le(t,r)).sort((r,i)=>r.localeCompare(i))}function Ve(t){let e=u.join(t,"package.json");if(!v(e))return[];let n;try{n=JSON.parse(He(e,"utf8"))}catch{return[]}return(Array.isArray(n.workspaces)?n.workspaces:n.workspaces?.packages??[]).flatMap(i=>ze(t,i))}function ze(t,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=u.join(t,e);return $(s)?[s]:[]}let n=e.indexOf("*"),r=e.slice(0,n).replace(/\/$/,""),i=e.slice(n+1).replace(/^\//,""),o=u.join(t,r||".");return $(o)?Xe(o).map(s=>u.join(o,s,i)).filter($):[]}function $(t){try{return Je(t).isDirectory()}catch{return!1}}function le(t,e){let n=u.relative(t,e).replace(/\\/g,"/");return n.startsWith("..")||n.includes("/node_modules/")||n.startsWith("node_modules/")||n.includes("/dist/")||n.startsWith("dist/")}var qe=Ye(import.meta.url),k;function ge(t,e){let n=Qe();if(!n)return H("ts-morph is not installed");let r=ce(t);if(r.length===0)return H("no tsconfig found");try{let i=r.map(o=>({tsconfigPath:o,project:new n.Project({tsConfigFilePath:o,skipFileDependencyResolution:!1})}));return new X(t,n,i)}catch(i){return H(i instanceof Error?i.message:String(i),r[0],r)}}function Qe(){if(k!==void 0)return k;try{k=qe("ts-morph")}catch{k=null}return k}function H(t,e,n){return{language:"typescript",availability:()=>({available:!1,reason:t,tsconfigPath:e,tsconfigPaths:n}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}var X=class{constructor(e,n,r){this.db=e;this.tsMorph=n;this.projects=r;this.workspacePackages=rt(e.config.projectRoot)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;sourceFileCache=new Map;definitionNodeCache=new Map;fileDefinitionNodeCache=new Map;indexedDefinitionLeafCache=new Map;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(e=>e.tsconfigPath)}}importUsage(e){return h(this.importUsageCache,e,()=>{let n=this.sourceFile(e);if(!n)return[];let r=[];for(let i of n.getImportDeclarations())for(let o of this.importUsageForDeclaration(e,i))r.push(o);return r})}referencesFor(e){return h(this.referencesCache,e.symbolId,()=>{let n=this.nodeForDefinition(e),r=this.packageImportReferencesForDefinition(e);return n?ut(n,e,r,this.db.config.projectRoot):r})}calleesFor(e){return h(this.calleesCache,e.symbolId,()=>h(this.fileCalleesCache,e.relativePath,()=>this.calleeMapForFile(e.relativePath)).get(e.symbolId)??[])}signatureFor(e){return h(this.signatureCache,e.symbolId,()=>{let n=this.nodeForDefinition(e);if(!n||!this.tsMorph.Node.isFunctionDeclaration(n)&&!this.tsMorph.Node.isMethodDeclaration(n)&&!this.tsMorph.Node.isArrowFunction(n)&&!this.tsMorph.Node.isFunctionExpression(n)&&!this.tsMorph.Node.isConstructorDeclaration(n))return null;let r=n.getType().getCallSignatures()[0];if(!r)return null;let i=r.getParameters().map(s=>{let a=s.getDeclarations()[0],c=a?s.getTypeAtLocation(a).getText(a):s.getValueDeclaration()?.getType().getText()??"unknown";return fe(c)}),o=r.getReturnType().getText(n);return`(${i.join(",")})=>${fe(o)}`})}importUsageForDeclaration(e,n){let r=w(this.db,e,n.getModuleSpecifierValue()),i=ue(n);return n.getImportClause()?.isTypeOnly()?i.map(o=>tt(e,r,o)):i.map(o=>this.valueImportUsageForEntry(e,r,o))}valueImportUsageForEntry(e,n,r){let i=r.identifier?r.identifier.findReferences():[],o=[];for(let l of i)for(let d of dt(l,e,r.identifier,this.db.config.projectRoot))o.push(d);let s=o.some(l=>!de(l.node)),a=o.some(l=>de(l.node)),c=r.isTypeOnly;return{importer:e,sourcePath:n,importedName:r.importedName,localName:r.localName,kind:r.kind,isTypeOnly:c,isUsed:c||o.length>0,isTypeUsed:c||a,isValueUsed:s,references:o.map(l=>l.location)}}sourceFile(e){return this.sourceFileMatch(e)?.sourceFile??null}sourceFileMatch(e){return It(e)?h(this.sourceFileCache,e,()=>{let n=g.join(this.db.config.projectRoot,e);for(let{project:r}of this.projects){let i=r.getSourceFile(n)??r.addSourceFileAtPathIfExists(n)??null;if(i)return{project:r,sourceFile:i}}return null}):null}packageImportReferencesForDefinition(e){return this.packageImportReferences().get(e.symbolId)??[]}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let e=new Map,n=this.packageExports();for(let r of this.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(e,n,r);for(let[r,i]of e)e.set(r,J(i));return this.packageImportReferenceIndex=e,e}indexedTypeScriptLikeDocuments(){return this.db.all(`SELECT relative_path
17
+ FROM documents
18
+ WHERE (
19
+ relative_path LIKE '%.ts'
20
+ OR relative_path LIKE '%.tsx'
21
+ OR relative_path LIKE '%.mts'
22
+ OR relative_path LIKE '%.cts'
23
+ OR relative_path LIKE '%.js'
24
+ OR relative_path LIKE '%.jsx'
25
+ OR relative_path LIKE '%.mjs'
26
+ OR relative_path LIKE '%.cjs'
27
+ )
28
+ ${this.db.pathExclusionsFor("documents")}`).map(e=>e.relative_path)}addPackageImportReferencesForDocument(e,n,r){if(this.db.isIgnored(r))return;let i=this.sourceFileMatch(r);if(i)for(let o of i.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(e,n,r,o)}addPackageImportReferencesForDeclaration(e,n,r,i){let o=st(this.workspacePackages,i.getModuleSpecifierValue());if(!o)return;let s=n.get(o);if(s)for(let a of ue(i)){if(a.kind!=="named"||!a.identifier)continue;let c=s.get(a.importedName);if(!c||c.size===0)continue;let l=ft(a.identifier,r,this.db.config.projectRoot);l.length>0&&ht(e,c,l)}}packageExports(){if(this.packageExportIndex)return this.packageExportIndex;let e=new Map;for(let n of this.workspacePackages){let r=new Map;for(let i of at(n))this.collectPackageExports(n,i,r,new Set);r.size>0&&e.set(n.name,r)}return this.packageExportIndex=e,e}collectPackageExports(e,n,r,i){if(i.has(n))return;i.add(n);let o=this.sourceFile(n);if(o)for(let s of o.getExportDeclarations()){let a=s.getModuleSpecifierValue(),c=a?w(this.db,n,a):n;if(!c||!c.startsWith(`${e.sourceRootRelative}/`))continue;let l=s.getNamedExports();if(l.length===0){if(s.isNamespaceExport())continue;this.collectPackageExports(e,c,r,i);continue}for(let d of l){let m=d.getNameNode().getText(),V=d.getAliasNode()?.getText()??m,z=this.indexedDefinitionByLeaf(c,m);if(!z)continue;let D=r.get(V);D||(D=new Set,r.set(V,D)),D.add(z.symbolId)}}}indexedDefinitionByLeaf(e,n){return h(this.indexedDefinitionLeafCache,e,()=>mt(this.db,e)).get(n)??null}nodeForDefinition(e){return h(this.definitionNodeCache,e.symbolId,()=>this.definitionNodesForFile(e.relativePath).get(e.symbolId)??null)}definitionNodesForFile(e){return h(this.fileDefinitionNodeCache,e,()=>{let n=this.sourceFile(e);if(!n)return new Map;let r=Ze(this.db,e);return r.size===0?new Map:et(this.tsMorph,n,r)})}definitionFromSymbol(e){let n=e.getDeclarations();for(let r of n){let i=r.getSourceFile(),o=_(this.db.config.projectRoot,i.getFilePath());if(!o||this.db.isIgnored(o))continue;let s=L(i,r),a=gt(this.db,o,s,e.getName());if(a)return{symbol:a.symbol,file:a.relativePath,line:a.startLine}}return null}calleeMapForFile(e){let n=this.sourceFile(e);if(!n)return new Map;let r=F(this.db,e).sort((o,s)=>o.startLine-s.startLine||s.endLine-o.endLine);if(r.length===0)return new Map;let i=new Map;n.forEachDescendant(o=>{if(!this.tsMorph.Node.isCallExpression(o)&&!this.tsMorph.Node.isNewExpression(o))return;let s=this.semanticCalleeForCallNode(n,r,o);s&&nt(i,s.callerId,s.target)});for(let[o,s]of i)i.set(o,yt(s));return i}semanticCalleeForCallNode(e,n,r){let i=St(n,L(e,r));if(!i)return null;let o=r.getExpression(),s=o.getSymbol()??o.getType().getSymbol(),a=s?this.definitionFromSymbol(s):null;return a?{callerId:i.symbolId,target:{symbol:a.symbol,file:a.file,line:a.line}}:null}};function ue(t){let e=[],n=t.getDefaultImport();n&&e.push({identifier:n,importedName:"default",localName:n.getText(),kind:"default",isTypeOnly:t.getImportClause()?.isTypeOnly()??!1});let r=t.getNamespaceImport();r&&e.push({identifier:r,importedName:"*",localName:r.getText(),kind:"namespace",isTypeOnly:t.getImportClause()?.isTypeOnly()??!1});for(let i of t.getNamedImports()){let o=i.getNameNode(),a=i.getAliasNode()??(o.getKindName()==="Identifier"?o:null);e.push({identifier:a,importedName:o.getText(),localName:a?.getText()??o.getText(),kind:"named",isTypeOnly:i.isTypeOnly()||(t.getImportClause()?.isTypeOnly()??!1)})}return e.length===0&&e.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),e}function Ze(t,e){let n=new Map;for(let r of F(t,e)){let i=C(r.symbol)??r.leaf;if(!i)continue;let o=n.get(i);o||(o=[],n.set(i,o)),o.push(r)}return n}function et(t,e,n){let r=new Map,i=new Map;return e.forEachDescendant(o=>{for(let s of pt(t,o)){let a=n.get(s);if(!a)continue;let c=L(e,o);for(let l of a){if(c<l.startLine-1||c>l.endLine+1)continue;let d=Math.abs(c-l.startLine),m=i.get(l.symbolId);m!==void 0&&m<=d||(i.set(l.symbolId,d),r.set(l.symbolId,o))}}}),r}function tt(t,e,n){return{importer:t,sourcePath:e,importedName:n.importedName,localName:n.localName,kind:n.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function nt(t,e,n){let r=t.get(e);r||(r=[],t.set(e,r)),r.push(n)}function rt(t){let e=g.join(t,"package.json");if(!T(e))return[];let n;try{n=JSON.parse(pe(e,"utf8"))}catch{return[]}return(Array.isArray(n.workspaces)?n.workspaces:n.workspaces?.packages??[]).flatMap(i=>it(t,i)).flatMap(i=>ot(t,i))}function it(t,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=g.join(t,e);return T(g.join(s,"package.json"))?[s]:[]}let n=e.indexOf("*"),r=e.slice(0,n).replace(/\/$/,""),i=e.slice(n+1).replace(/^\//,""),o=g.join(t,r||".");if(!T(o))return[];try{return Ge(o).map(s=>g.join(o,s,i)).filter(s=>T(g.join(s,"package.json")))}catch{return[]}}function ot(t,e){try{let n=JSON.parse(pe(g.join(e,"package.json"),"utf8"));if(!n.name)return[];let r=g.relative(t,e).replace(/\\/g,"/");return[{name:n.name,rootRelative:r,sourceRootRelative:`${r}/src`}]}catch{return[]}}function st(t,e){for(let n of t)if(e===n.name||e.startsWith(`${n.name}/`))return n.name;return null}function at(t){return[`${t.sourceRootRelative}/index.ts`,`${t.sourceRootRelative}/index.tsx`,`${t.sourceRootRelative}/index.mts`,`${t.sourceRootRelative}/index.cts`]}function ct(t,e){return t.getReferences().map(n=>{let r=n.getNode();return me(r,e)})}function lt(t){let e=t;return typeof e.findReferences=="function"?e.findReferences():[]}function ut(t,e,n,r){let i=[];for(let o of lt(t))for(let s of ct(o,r))s.file===e.relativePath&&s.line>=e.startLine&&s.line<=e.endLine||i.push(s);for(let o of n)i.push(o);return J(i)}function dt(t,e,n,r){let i=[],o=n?.getStart();for(let s of t.getReferences()){let a=s.getNode();_(r,a.getSourceFile().getFilePath())===e&&(o!==void 0&&a.getStart()===o||i.push({location:me(a,r),node:a}))}return i}function me(t,e){let n=t.getSourceFile(),r=n.getLineAndColumnAtPos(t.getStart());return{file:_(e,n.getFilePath())??n.getBaseName(),line:r.line-1,column:r.column-1}}function ft(t,e,n){let r=t.getSourceFile(),i=L(r,t),o=t.getText(),s=new RegExp(`\\b${xt(o)}\\b`,"g"),a=r.getFullText().split(`
29
+ `),c=[];for(let l=0;l<a.length;l++){if(l===i)continue;let d=a[l]??"";s.lastIndex=0;let m;for(;(m=s.exec(d))!==null;)c.push({file:e,line:l,column:m.index})}return J(c.filter(l=>_(n,g.join(n,l.file))===e))}function de(t){for(let e=t;e;e=e.getParent()){let n=e.getKindName();if(n.includes("Type")||n==="InterfaceDeclaration"||n==="TypeAliasDeclaration")return!0;if(n==="CallExpression"||n==="NewExpression"||n==="ExpressionStatement")return!1}return!1}function pt(t,e){let n=[],r=i=>{i&&!n.includes(i)&&n.push(i)};if("getNameNode"in e&&typeof e.getNameNode=="function"){let i=e.getNameNode();r(i?.getText())}if("getName"in e&&typeof e.getName=="function"){let i=e.getName();r(i)}return t.Node.isIdentifier(e)&&r(e.getText()),n}function gt(t,e,n,r){return t.all(`SELECT
30
+ gs.id AS symbolId,
31
+ gs.symbol,
32
+ d.relative_path AS relativePath,
33
+ COALESCE(der.start_line, c.start_line) AS startLine,
34
+ COALESCE(der.end_line, c.end_line) AS endLine,
35
+ COALESCE(gs.display_name, '') AS leaf,
36
+ NULL AS parentTypeName,
37
+ CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
38
+ CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
39
+ gs.kind AS kind,
40
+ gs.documentation AS documentation,
41
+ gs.enclosing_symbol AS enclosingSymbol
42
+ FROM global_symbols gs
43
+ LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
44
+ LEFT JOIN chunks c ON c.document_id = der.document_id
45
+ JOIN documents d ON d.id = der.document_id
46
+ WHERE d.relative_path = ?
47
+ AND COALESCE(gs.display_name, gs.symbol) LIKE ?
48
+ ORDER BY ABS(COALESCE(der.start_line, c.start_line) - ?)
49
+ LIMIT 5`,e,`%${r}%`,n)[0]??null}function mt(t,e){let n=t.all(`SELECT
50
+ d.id AS documentId,
51
+ gs.id AS symbolId,
52
+ gs.symbol,
53
+ d.relative_path AS relativePath,
54
+ der.start_line AS startLine,
55
+ der.end_line AS endLine,
56
+ COALESCE(gs.display_name, '') AS leaf,
57
+ NULL AS parentTypeName,
58
+ CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
59
+ CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
60
+ gs.kind AS kind,
61
+ gs.documentation AS documentation,
62
+ gs.enclosing_symbol AS enclosingSymbol
63
+ FROM global_symbols gs
64
+ JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
65
+ JOIN documents d ON d.id = der.document_id
66
+ WHERE d.relative_path = ?
67
+ UNION ALL
68
+ SELECT
69
+ d.id AS documentId,
70
+ gs.id AS symbolId,
71
+ gs.symbol,
72
+ d.relative_path AS relativePath,
73
+ MIN(c.start_line) AS startLine,
74
+ MAX(c.end_line) AS endLine,
75
+ COALESCE(gs.display_name, '') AS leaf,
76
+ NULL AS parentTypeName,
77
+ CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
78
+ CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
79
+ gs.kind AS kind,
80
+ gs.documentation AS documentation,
81
+ gs.enclosing_symbol AS enclosingSymbol
82
+ FROM global_symbols gs
83
+ JOIN mentions m ON m.symbol_id = gs.id
84
+ JOIN chunks c ON c.id = m.chunk_id
85
+ JOIN documents d ON d.id = c.document_id
86
+ WHERE d.relative_path = ?
87
+ AND m.role = 1
88
+ GROUP BY gs.id, gs.symbol, d.id, d.relative_path, gs.display_name, gs.kind, gs.documentation, gs.enclosing_symbol
89
+ ORDER BY startLine, endLine`,e,e),r=new Set,i=new Map;for(let o of n){if(r.has(o.symbolId))continue;r.add(o.symbolId);let s=o.leaf||C(o.symbol);!s||i.has(s)||i.set(s,{...o,leaf:s})}return i}function St(t,e){let n=null;for(let r of t)e<r.startLine||e>r.endLine||(!n||r.startLine>=n.startLine)&&(n=r);return n}function L(t,e){return t.getLineAndColumnAtPos(e.getStart()).line-1}function J(t){let e=new Set,n=[];for(let r of t){let i=`${r.file}:${r.line}:${r.column}`;e.has(i)||(e.add(i),n.push(r))}return n}function ht(t,e,n){for(let r of e){let i=t.get(r)??[];i.push(...n),t.set(r,i)}}function yt(t){let e=new Set,n=[];for(let r of t){let i=`${r.symbol}|${r.file}|${r.line}`;e.has(i)||(e.add(i),n.push(r))}return n}function h(t,e,n){if(t.has(e))return t.get(e);let r=n();return t.set(e,r),r}function _(t,e){let n=g.relative(t||process.cwd(),e).replace(/\\/g,"/");return!n||n.startsWith("..")?null:n}function It(t){return/\.(?:ts|tsx|mts|cts|js|jsx|mjs|cjs)$/.test(t)}function fe(t){return t.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}function xt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var B=new WeakMap;function Se(t,e){let n=`${t.config.projectRoot}:typescript-workspace`,r=B.get(t);r||(r=new Map,B.set(t,r));let i=r.get(n);if(i)return i;let o=ge(t,e);return r.set(n,o),o}function $t(t){B.delete(t)}function Ht(t,e){let n=M(t,e);return n?n.importUsage(e):[]}function Et(t,e){let n=M(t,e.relativePath);return n?n.referencesFor(e):[]}function Xt(t,e){let n=new Map;for(let r of e)for(let i of Et(t,r)){if(i.file===r.relativePath||t.isIgnored(i.file))continue;let o=n.get(r.symbolId);o||(o=new Set,n.set(r.symbolId,o)),o.add(i.file)}return n}function Jt(t,e){let n=new Map;for(let r of e){let i=M(t,r.relativePath);if(!i)continue;let o=i.calleesFor(r);o.length>0&&n.set(r.symbolId,o)}return n}function Bt(t,e){let n=M(t,e.relativePath);return n?n.signatureFor(e):null}function M(t,e){if(!Nt(e))return null;let n=Se(t,e);return n.availability().available?n:null}function Nt(t){return/\.(?:ts|tsx|mts|cts|js|jsx|mjs|cjs)$/.test(t)}export{q as a,te as b,re as c,Dt as d,Le as e,w as f,Ce as g,Fe as h,Oe as i,Pe as j,Ae as k,je as l,x as m,$t as n,Ht as o,Et as p,Xt as q,Jt as r,Bt as s};
90
+ //# sourceMappingURL=chunk-67OMD56K.js.map
@@ -0,0 +1,7 @@
1
+ import{c as S}from"./chunk-JMASYYSW.js";import{m as g}from"./chunk-EHEZLULQ.js";import{a as R}from"./chunk-BT36WY5B.js";import{d as h,w as m}from"./chunk-NLJCXHFU.js";function w(t,r,n={}){let e=R(t,r);if(!e)return[];let a=!m(e.symbol)&&!t.isIgnored(e.relativePath)?[{relativePath:e.relativePath,line:e.startLine}]:[],l=S(t,e,{semantic:n.semantic}),f=(l.length>0?l:g(t,e)).filter(s=>!t.isIgnored(s.file)).map(s=>({relativePath:s.file,line:s.line})),o=d(t,e),p=new Set,c=[];for(let s of[...a,...f,...o]){let u=`${s.relativePath}:${s.line}`;p.has(u)||(p.add(u),c.push(s))}return c}function d(t,r){if(!r.relativePath.endsWith(".rb"))return[];let n=v(r.symbol);if(n.length===0)return[];let e=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 a of e){if(t.isIgnored(a.relative_path))continue;let l=h(t,a.relative_path);if(!l)continue;let f=l.split(`
6
+ `);for(let o=0;o<f.length;o++){let p=f[o]??"";n.some(c=>new RegExp(`@${c}\\b|\\b${c}:`).test(p))&&i.push({relativePath:a.relative_path,line:o})}}return i}function v(t){let n=(t.split(":").pop()??t).replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[^A-Za-z0-9_]+/g,"_").toLowerCase().replace(/^_+|_+$/g,""),e=n.split("_").filter(Boolean),i=new Set;return n&&i.add(n),e.length>=1&&i.add(e[e.length-1]),e.length>=2&&i.add(e.slice(-2).join("_")),[...i]}export{w as a};
7
+ //# sourceMappingURL=chunk-6UVVA5I4.js.map
@@ -1,3 +1,3 @@
1
- import{a as d}from"./chunk-ZHHMG4UC.js";import{n as g,o as m}from"./chunk-QFZE73XF.js";function S(n,f){let a=d(n,f);if(!a)return[];let t=n.get(`SELECT symbol, enclosing_symbol FROM global_symbols
1
+ import{a as d}from"./chunk-BT36WY5B.js";import{r as g,s as m}from"./chunk-NLJCXHFU.js";function S(n,f){let a=d(n,f);if(!a)return[];let t=n.get(`SELECT symbol, enclosing_symbol FROM global_symbols
2
2
  WHERE id = ? LIMIT 1`,a.symbolId);if(!t)return[];let o=[{symbol:t.symbol,shortName:m(t.symbol),depth:0}],e=t.enclosing_symbol,r=1,c=new Set([t.symbol]);for(;e&&!c.has(e)&&r<20;){c.add(e);let s=n.get("SELECT symbol, enclosing_symbol FROM global_symbols WHERE symbol = ?",e);if(!s)break;o.push({symbol:s.symbol,shortName:m(s.symbol),depth:r}),e=s.enclosing_symbol,r++}if(o.length>1)return o;let y=g(t.symbol);if("kind"in y)return o;let l=y.descriptors;if(l.length<=1)return o;let b=[o[0]];for(let s=l.length-2,p=1;s>=0;s--,p++){let h=l.slice(0,s+1).map(i=>i.suffix==="method"?`${i.name}()`:i.name.replace(/\.(ts|tsx|js|jsx|mjs|cjs|py|pyi|rs|java|scala|kt|kts|rb|go|cs|vb|dart|php|c|cc|cpp|cxx|h|hpp)$/,"")).join(":");b.push({symbol:h,shortName:h,depth:p})}return b}export{S as a};
3
- //# sourceMappingURL=chunk-OQZF2DQJ.js.map
3
+ //# sourceMappingURL=chunk-AXHDRSRI.js.map
@@ -1,2 +1,2 @@
1
- import{b as p}from"./chunk-MO65UK5V.js";import{D as u,x as f}from"./chunk-QFZE73XF.js";function S(a,b){let y=p(a,b),o=u(a,y,{sort:!0});if(o.length===0)return[];let i=o.map(e=>({symbol:e.symbol,shortName:e.shortName,startLine:e.startLine,endLine:e.endLine,children:[]})),s=new Map;for(let e of i)s.set(e.symbol,e);let m=[];for(let e=0;e<o.length;e++){let r=o[e],n=i[e];if(r.enclosingSymbol&&s.has(r.enclosingSymbol)){s.get(r.enclosingSymbol).children.push(n);continue}let l=null,c=1/0;for(let t of i)if(t!==n&&t.startLine<=n.startLine&&t.endLine>=n.endLine){if(t.startLine===n.startLine&&t.endLine===n.endLine&&!f(t.symbol,n.symbol))continue;let d=t.endLine-t.startLine;d<c&&(c=d,l=t)}l?l.children.push(n):m.push(n)}return m}export{S as a};
2
- //# sourceMappingURL=chunk-TLRA5TR6.js.map
1
+ import{b as p}from"./chunk-LLDPR3DG.js";import{B as f,I as u}from"./chunk-NLJCXHFU.js";function S(a,b){let y=p(a,b),o=u(a,y,{sort:!0});if(o.length===0)return[];let i=o.map(e=>({symbol:e.symbol,shortName:e.shortName,startLine:e.startLine,endLine:e.endLine,children:[]})),s=new Map;for(let e of i)s.set(e.symbol,e);let m=[];for(let e=0;e<o.length;e++){let r=o[e],n=i[e];if(r.enclosingSymbol&&s.has(r.enclosingSymbol)){s.get(r.enclosingSymbol).children.push(n);continue}let l=null,c=1/0;for(let t of i)if(t!==n&&t.startLine<=n.startLine&&t.endLine>=n.endLine){if(t.startLine===n.startLine&&t.endLine===n.endLine&&!f(t.symbol,n.symbol))continue;let d=t.endLine-t.startLine;d<c&&(c=d,l=t)}l?l.children.push(n):m.push(n)}return m}export{S as a};
2
+ //# sourceMappingURL=chunk-BAA4EJRX.js.map
@@ -1,4 +1,4 @@
1
- import{F as y,G as S,o as E,p as I,r as L,s as $,t as v}from"./chunk-QFZE73XF.js";function ne(e,t){let n=K(e,t.trim());if(n)return n;let s=B(e,t);if(s)return s;let a=F(e,t);return a||W(e,t)}function F(e,t){let n=C(t),s=w(n);if(!s)return null;let a=`%${s.path}%`,i=s.leaf,r=k(e,a,i,n)[0];return r?y(e,r):null}function k(e,t,n,s){let a=M([],[...J(e,t,n),...T(e,t,n)]).filter(i=>!e.isIgnored(i.relative_path)).filter(i=>_(i,s)>1);return a.sort((i,o)=>_(o,s)-_(i,s)||i.end_line-i.start_line-(o.end_line-o.start_line)||i.start_line-o.start_line||i.symbol.localeCompare(o.symbol)),a}function J(e,t,n){return e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.end_line, d.relative_path, gs.display_name, gs.documentation
1
+ import{K as y,L as S,s as E,t as I,v as L,w as $,x as v}from"./chunk-NLJCXHFU.js";function ne(e,t){let n=K(e,t.trim());if(n)return n;let s=B(e,t);if(s)return s;let a=F(e,t);return a||W(e,t)}function F(e,t){let n=C(t),s=w(n);if(!s)return null;let a=`%${s.path}%`,i=s.leaf,r=k(e,a,i,n)[0];return r?y(e,r):null}function k(e,t,n,s){let a=M([],[...J(e,t,n),...T(e,t,n)]).filter(i=>!e.isIgnored(i.relative_path)).filter(i=>_(i,s)>1);return a.sort((i,o)=>_(o,s)-_(i,s)||i.end_line-i.start_line-(o.end_line-o.start_line)||i.start_line-o.start_line||i.symbol.localeCompare(o.symbol)),a}function J(e,t,n){return e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.end_line, d.relative_path, gs.display_name, gs.documentation
2
2
  FROM global_symbols gs
3
3
  JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
4
4
  JOIN documents d ON der.document_id = d.id
@@ -111,4 +111,4 @@ import{F as y,G as S,o as E,p as I,r as L,s as $,t as v}from"./chunk-QFZE73XF.js
111
111
  ${e.pathExclusionsFor("d")}
112
112
  GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path, gs.display_name, gs.documentation
113
113
  LIMIT 200`,...s);return M(a,i)}function M(e,t){let n=new Map;for(let s of t)e.length>0&&!G(s)||n.set(s.id,s);for(let s of e)n.set(s.id,s);return[...n.values()]}function G(e){if(S(e.symbol)!==null)return!1;let n=(e.documentation??"").replace(/^```\w*\s*/,"").replace(/\s*```$/,"").trim();return/^(?:var|let|const|function|class|interface|type|enum)\b/.test(n)}function U(e,t,n,s){let a=t.trim(),i=n,o=i.replace(/\(\)$/,""),r=t.toLowerCase(),d=n.toLowerCase(),g=d.replace(/\(\)$/,""),D=e.symbol,R=E(e.symbol),p=I(e.symbol),Q=e.display_name??"",f=e.symbol.toLowerCase(),c=R.toLowerCase(),m=p.toLowerCase(),O=Q.toLowerCase(),u=e.relative_path.toLowerCase(),A=/[/:.]/.test(n),N=w(n),b=N?.leaf.toLowerCase(),l=0;return(D===a||D===i)&&(l+=1150),(R===a||R===i)&&(l+=1100),Q===o&&(l+=1180),p===o&&(l+=1160),(`${p}()`===a||`${p}()`===i)&&(l+=955),(f===r||f===d)&&(l+=1e3),(c===r||c===d)&&(l+=950),(u===r||u===d)&&(l+=925),(u.endsWith(`/${d}`)||u.endsWith(`/${r}`))&&(l+=875),O===g&&(l+=850),m===g&&(l+=825),(`${m}()`===r||`${m}()`===d)&&(l+=820),(c.endsWith(`:${d}`)||c.endsWith(`:${g}`)||c.endsWith(`:${g}()`))&&(l+=800),f.includes(d)&&(l+=120),c.includes(d)&&(l+=140),u.includes(d)&&(l+=140),O.includes(d)&&(l+=110),s.every(x=>{let h=x.toLowerCase();return f.includes(h)||c.includes(h)||u.includes(h)||O.includes(h)})&&(l+=100+s.length*15),N&&u.includes(N.path.toLowerCase())&&(l+=360,b&&(m===b||`${m}()`===b||`${m}()`==`${b}()`)&&(l+=700),L(e.symbol)&&(l+=180)),$(e.symbol)&&m===g&&(l+=60),!A&&v(e.symbol)&&(l-=160),l-=Math.min(50,Math.max(0,e.end_line-e.start_line)),l}function w(e){let t=e.trim().replace(/\\/g,"/"),n=t.lastIndexOf("/");if(n<=0||n===t.length-1)return null;let s=t.slice(n+1).replace(/\(\)$/,"");return!s||s.includes(".")?null:{path:t.slice(0,n),leaf:s}}function C(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function j(e){let t=C(e),n=t.split(/[^A-Za-z0-9_]+/).map(s=>s.trim()).filter(s=>s.length>0);return n.length>0?[...new Set(n)]:[t]}function q(e,t,n){let s=t.trim(),a=e.filter(i=>{let o=E(i.symbol),r=(i.display_name??"").trim();return i.symbol===s||o===s||o===n||r===s||r===n||`${r}()`===s||_(i,n)>1||i.relative_path===s});return a.length===0?null:(a.sort((i,o)=>_(o,n)-_(i,n)||i.end_line-i.start_line-(o.end_line-o.start_line)||i.relative_path.localeCompare(o.relative_path)||i.symbol.localeCompare(o.symbol)),a[0]??null)}function _(e,t){let n=w(t);if(!n)return 0;let s=e.relative_path.toLowerCase(),a=I(e.symbol).toLowerCase(),i=n.path.toLowerCase(),o=n.leaf.toLowerCase();return s.includes(i)?a!==o?1:L(e.symbol)?S(e.symbol)===null?5:4:S(e.symbol)===null?3:2:0}export{ne as a,K as b,te as c};
114
- //# sourceMappingURL=chunk-ZHHMG4UC.js.map
114
+ //# sourceMappingURL=chunk-BT36WY5B.js.map
@@ -0,0 +1,39 @@
1
+ import{a as g}from"./chunk-LLDPR3DG.js";import{g as u}from"./chunk-33Z6HQBX.js";import{o as c}from"./chunk-67OMD56K.js";import{a as p}from"./chunk-BT36WY5B.js";import{s as l,t as d,x as f}from"./chunk-NLJCXHFU.js";function T(e,s,t={}){return h(e,s,t)?.map(r=>({symbol:r.symbol,shortName:r.shortName,fromFile:r.fromFile}))??[]}function M(e,s){let t=E(e,s);return t.length>0?t:N(e,s)}function J(e,s,t={}){return h(e,s,t)?.filter(r=>!r.used).map(r=>({symbol:r.symbol,shortName:r.shortName,importedIn:r.importer}))??[]}function E(e,s){return e.all(`SELECT DISTINCT gs.symbol, d.relative_path AS importer
2
+ FROM mentions m
3
+ JOIN chunks c ON m.chunk_id = c.id
4
+ JOIN documents d ON c.document_id = d.id
5
+ JOIN global_symbols gs ON m.symbol_id = gs.id
6
+ WHERE gs.symbol LIKE ?
7
+ AND m.role = 2
8
+ ORDER BY d.relative_path`,`%${s}%`).filter(r=>!e.isIgnored(r.importer)).map(r=>({symbol:r.symbol,shortName:l(r.symbol),fromFile:r.importer}))}function N(e,s){let t=p(e,s),r=t?.relativePath??null,o=t?d(t.symbol):s.replace(/\(\)$/,""),m=t?f(t.symbol):!1,i=e.all(`SELECT relative_path
9
+ FROM documents
10
+ WHERE 1 = 1
11
+ ${e.pathExclusionsFor("documents")}
12
+ ORDER BY relative_path`),a=new Set;for(let n of i)if(!e.isIgnored(n.relative_path))for(let b of u(e,n.relative_path))S(b,n.relative_path,{targetFile:r,targetLeaf:o,targetIsModule:m})&&a.add(n.relative_path);return[...a].sort().map(n=>({symbol:t?.symbol??o,shortName:t?l(t.symbol):o,fromFile:n}))}function S(e,s,t){return!e.sourcePath||t.targetFile&&_(e.sourcePath)!==_(t.targetFile)?!1:e.kind==="side-effect"||t.targetFile&&R(s)||t.targetIsModule||e.kind==="named"&&e.importedName===t.targetLeaf?!0:e.kind==="namespace"&&e.usedMembers.includes(t.targetLeaf)}function h(e,s,t={}){let r=g(e,s);return r?O(e,r,t)??(t.semantic===!1?null:F(e,r))??y(e,r):null}function O(e,s,t){let o=e.all(`SELECT DISTINCT
13
+ gs.symbol,
14
+ def_d.relative_path AS from_file,
15
+ imp_d.relative_path AS importer,
16
+ EXISTS (
17
+ SELECT 1
18
+ FROM mentions ref_m
19
+ JOIN chunks ref_c ON ref_m.chunk_id = ref_c.id
20
+ WHERE ref_m.symbol_id = gs.id
21
+ AND ref_m.role != 1
22
+ AND ref_c.document_id = imp_d.id
23
+ ) AS used
24
+ FROM mentions m
25
+ JOIN chunks c ON m.chunk_id = c.id
26
+ JOIN documents imp_d ON c.document_id = imp_d.id
27
+ JOIN global_symbols gs ON m.symbol_id = gs.id
28
+ LEFT JOIN (
29
+ SELECT m2.symbol_id, c2.document_id
30
+ FROM mentions m2
31
+ JOIN chunks c2 ON m2.chunk_id = c2.id
32
+ WHERE m2.role = 1
33
+ GROUP BY m2.symbol_id
34
+ ) sym_def ON sym_def.symbol_id = gs.id
35
+ LEFT JOIN documents def_d ON sym_def.document_id = def_d.id
36
+ WHERE imp_d.relative_path = ?
37
+ AND m.role = 2
38
+ ORDER BY def_d.relative_path, gs.symbol`,s).filter(m=>!e.isIgnored(m.importer));if(o.length>0){let m=t.semantic===!1?[]:c(e,s);return o.map(i=>({symbol:i.symbol,shortName:l(i.symbol),fromFile:i.from_file??"(external)",importer:i.importer,used:i.used!==0||m.some(a=>a.isUsed&&a.sourcePath===i.from_file)}))}return null}function F(e,s){let t=c(e,s);return t.length>0?t.map(r=>{let o=I(r.importedName,r.localName,r.kind);return{symbol:o,shortName:o,fromFile:r.sourcePath??"(external)",importer:s,used:r.kind==="side-effect"?!0:r.isUsed}}):null}function y(e,s){return u(e,s).map(t=>{let r=I(t.importedName,t.localName,t.kind),o=t.kind==="side-effect"?!0:t.used;return{symbol:r,shortName:r,fromFile:t.sourcePath??"(external)",importer:s,used:o}})}function I(e,s,t){return t==="namespace"&&e==="*"&&s?`* as ${s}`:t==="default"&&s?`default as ${s}`:t==="side-effect"?"(side effect import)":s&&s!==e?`${e} as ${s}`:e}function _(e){return e.replace(/\\/g,"/")}function R(e){return/\.(?:c|h|cc|cpp|cxx|hpp|hh|hxx)$/i.test(e)}export{T as a,M as b,J as c};
39
+ //# sourceMappingURL=chunk-CLKFDBS6.js.map
@@ -1,2 +1,2 @@
1
- import{a as m}from"./chunk-UAPNU7UP.js";import{a as l}from"./chunk-ZHHMG4UC.js";import{p as r,r as a}from"./chunk-QFZE73XF.js";import{basename as d}from"path";function g(t,c){let o=l(t,c);if(!o)return[];let s=r(o.symbol),i=new m(t).definitionsForFile(o.relativePath).filter(e=>a(e.symbol)),n=i.filter(e=>e.parentTypeName===s||e.symbol.includes(s));return(n.length>0?n:p(d(o.relativePath))===s?i.filter(e=>e.symbol.includes("<invalid-global-code>")):[]).map(e=>({startLine:e.startLine,endLine:e.endLine,name:r(e.symbol)}))}function p(t){return t.replace(/\.[^.]+$/,"")}export{g as a};
2
- //# sourceMappingURL=chunk-CSRPJCWO.js.map
1
+ import{a as m}from"./chunk-LNUZWWWL.js";import{a as l}from"./chunk-BT36WY5B.js";import{t as r,v as a}from"./chunk-NLJCXHFU.js";import{basename as d}from"path";function g(t,c){let o=l(t,c);if(!o)return[];let s=r(o.symbol),i=new m(t).definitionsForFile(o.relativePath).filter(e=>a(e.symbol)),n=i.filter(e=>e.parentTypeName===s||e.symbol.includes(s));return(n.length>0?n:p(d(o.relativePath))===s?i.filter(e=>e.symbol.includes("<invalid-global-code>")):[]).map(e=>({startLine:e.startLine,endLine:e.endLine,name:r(e.symbol)}))}function p(t){return t.replace(/\.[^.]+$/,"")}export{g as a};
2
+ //# sourceMappingURL=chunk-CWMWTHV3.js.map
@@ -0,0 +1,7 @@
1
+ import{a as F}from"./chunk-LNUZWWWL.js";import{f as g}from"./chunk-EHEZLULQ.js";import{J as M,s as p,t as I,z as C}from"./chunk-NLJCXHFU.js";import{basename as f,extname as d}from"path";function A(t,e){let{scope:n,maxLoc:o=15,limit:r=30,scanLimit:i}=e??{},a=new F(t),l=_(a.fileDependencyGraph(n)),u=j(x(a,n,o).sort((c,s)=>b(c)-b(s)||c.relativePath.localeCompare(s.relativePath)),i),h=P(a.crossFileCallerMap(u,{semantic:e?.semantic!==!1}),a.sourceFallbackCallerFiles(u)),m=[];for(let c of u){let s=S(t,a,c,{callerFileMap:h,reverseFanIn:l});s&&m.push(s)}return m.sort((c,s)=>s.callerFanIn-c.callerFanIn||s.loc-c.loc),m.slice(0,r)}function S(t,e,n,o){let r=D(e,n,o.callerFileMap);if(r.length!==1)return null;let i=r[0],a=L(t,n.symbolId,i);if(!a)return null;let l=y(e,t,i,n.symbol,a);if(l&&C(l.symbol))return null;let u=v(o.callerFileMap,o.reverseFanIn,i,l);return u<=3?null:{symbol:n.symbol,shortName:p(n.symbol),file:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:b(n),singleCaller:l?.symbol??"",singleCallerShort:l?.isFunctionLike?p(l.symbol):f(i),callerFanIn:u}}function b(t){return t.endLine-t.startLine+1}function x(t,e,n){return t.productionCallableDefinitions({scope:e,minLoc:2,maxLoc:n,requireFunctionLikeSymbol:!0})}function D(t,e,n){let o=f(e.relativePath,d(e.relativePath));return[...n.get(e.symbolId)??[]].filter(r=>r!==e.relativePath).filter(r=>f(r,d(r))!==o).filter(r=>{let i=t.fileKind(r);return i!=="barrel"&&i!=="entry"&&i!=="test"})}function L(t,e,n){return t.get(`SELECT c.start_line, c.end_line
2
+ FROM mentions m
3
+ JOIN chunks c ON m.chunk_id = c.id
4
+ JOIN documents d ON c.document_id = d.id
5
+ WHERE m.symbol_id = ? AND m.role != 1 AND d.relative_path = ?
6
+ LIMIT 1`,e,n)}function y(t,e,n,o,r){let i=t.definitionsForFile(n),a=k(e,n,o,r.start_line,r.end_line);return M(i,a)}function v(t,e,n,o){if(o?.isFunctionLike){let r=[...t.get(o.symbolId)??[]].filter(i=>i!==o.relativePath);if(r.length>0)return r.length}return N(e,n)}function k(t,e,n,o,r){let i=I(n);if(!i)return o;let a=g(t,e).get(i);if(!a||a.length===0)return o;for(let l of a)if(l>=o&&l<=r)return l;return o}function P(...t){let e=new Map;for(let n of t)for(let[o,r]of n){let i=e.get(o);i||(i=new Set,e.set(o,i));for(let a of r)i.add(a)}return e}function _(t){let e=new Map;for(let[n,o]of t){e.has(n)||e.set(n,e.get(n)??0);for(let r of o)e.set(r,(e.get(r)??0)+1)}return e}function N(t,e){let n=t.get(e)??0;if(n>0)return n;let o=f(e,d(e)),r=0;for(let[i,a]of t)i!==e&&f(i,d(i))===o&&a>r&&(r=a);return r}function j(t,e){return typeof e!="number"||e<=0||t.length<=e?t:t.slice(0,e)}export{A as a};
7
+ //# sourceMappingURL=chunk-DXO2ECRF.js.map
@@ -0,0 +1,85 @@
1
+ import{a as G,b as W,e as B,g as N}from"./chunk-33Z6HQBX.js";import{p as U,q as Y,r as V}from"./chunk-67OMD56K.js";import{c as z}from"./chunk-BT36WY5B.js";import{F as M,G as k,J as v,a as h,b as w,d as x,h as y,l as S,m as C,o as A,q as J,t as L,v as j}from"./chunk-NLJCXHFU.js";var E=new WeakMap;function St(e,t){let n=y(t);return n==="rust"?Se(e,t):n==="typescript"||n==="tsx"||n==="javascript"?ye(e,t):[]}var be=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]);function ye(e,t){let n=S(e,t);if(!n)return[];let s=E.get(n);if(s)return s;let o=/(^|\/)(pages|app)\/.+\.(tsx?|jsx?)$/.test(t)||/(^|\/)(layout|page|loading|error|not-found|head|template|default)\.(tsx?|jsx?)$/.test(t),i=/(^|\/)src\/(pages|views|routes)\/.+\.(tsx?|jsx?|vue)$/.test(t),a=!1,l=n.rootNode;for(let r of l.namedChildren){if(r.type!=="expression_statement")continue;let u=r.namedChild(0);if(!u||u.type!=="call_expression")continue;let d=u.namedChild(0);if(!d)continue;let f=d.type==="member_expression"?d.namedChild(d.namedChildCount-1)?.text:d.text;if(f&&be.has(f)){a=!0;break}}let c=[];a&&c.push({startLine:0,endLine:l.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)"}),(o||i)&&c.push({startLine:0,endLine:l.endPosition.row,reason:o?"Next.js / Remix route file":"Vite/Vue route component"});for(let r of l.namedChildren){let u=null,d=null;if(r.type==="function_declaration")u=r.namedChild(0)?.text??null,d=r;else if(r.type==="export_statement"){let f=r.namedChild(0);f?.type==="function_declaration"&&(u=f.namedChild(0)?.text??null,d=f)}else if(r.type==="lexical_declaration"){let f=r.namedChild(0);if(f?.type==="variable_declarator"){let p=f.namedChild(0)?.text,g=f.namedChild(1);p&&(g?.type==="arrow_function"||g?.type==="function_expression")&&(u=p,d=f)}}u&&/^use[A-Z]/.test(u)&&d&&c.push({startLine:d.startPosition.row,endLine:d.endPosition.row,reason:"React custom hook (use*)"})}return c.push(...q(n,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),E.set(n,c),c}var _e=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function he(e){return _e.test(e)}function q(e,t,n){let s=[],o=i=>{if(t.has(i.type)&&i.parent){let l=i.parent.children,c=-1;for(let r=0;r<l.length;r+=1)if(l[r].startIndex===i.startIndex&&l[r].type===i.type){c=r;break}if(c>0)for(let r=c-1;r>=0;r-=1){let u=l[r];if(n.has(u.type)){if(he(u.text)){s.push({startLine:i.startPosition.row,endLine:i.endPosition.row,reason:"scip-query suppression comment"});break}continue}if(!(u.type==="attribute_item"||u.type==="inner_attribute_item"))break}}for(let a of i.namedChildren)o(a)};return o(e.rootNode),s}function Se(e,t){let n=S(e,t);if(!n)return[];let s=E.get(n);if(s)return s;let o=[],i=Ee(n);return i?(E.set(n,i),i):(X(n.rootNode,o,!1,!1),o.push(...q(n,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"]))),o.push(...xe(n.rootNode)),E.set(n,o),o)}function Ee(e){return Ae(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)"}]:null}function X(e,t,n,s){let o=n,i=s;e.type==="trait_item"&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(i=!0,t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)"})),e.type==="function_item"||e.type==="function_signature_item"?Re(e,t,n,s):s&&we(e)?t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)"}):e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"?Ce(e,t,n):e.type==="mod_item"&&D(e).some(a=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(a))&&(o=!0);for(let a of e.namedChildren)X(a,t,o,i)}function Re(e,t,n,s){let o=D(e),i=null;s?i="trait impl method (dynamic dispatch)":n&&(i="inside #[cfg(test)] mod");for(let a of o){let l=Le(a);if(l){i=l;break}if(Q(a)){i="#[allow(dead_code)]";break}}i&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:i})}function Ce(e,t,n){let s=D(e),o=e.namedChildren.find(i=>i.type==="type_identifier")?.text;s.some(Ie)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(<reflective>)] \u2014 fields accessed via macro/reflection",containerName:o}),s.some(Q)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",containerName:o}),n&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",containerName:o})}function D(e){let t=e.parent;if(!t)return[];let n=t.children,s=-1;for(let i=0;i<n.length;i+=1)if(n[i].startIndex===e.startIndex&&n[i].type===e.type){s=i;break}if(s<=0)return[];let o=[];for(let i=s-1;i>=0;i-=1){let a=n[i];if(a.type==="attribute_item"||a.type==="inner_attribute_item")o.push(a.text);else{if(a.type==="line_comment"||a.type==="block_comment")continue;break}}return o}function Le(e){return/#\[\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}function Ie(e){return/#\[\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}function Q(e){return/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e)}function we(e){return e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"}function xe(e){let t=De(e);if(t.size===0)return[];let n=[];for(let s of e.descendantsOfType("mod_item")){let o=s.childForFieldName("name")?.text;o&&t.has(o)&&n.push({startLine:s.startPosition.row,endLine:s.endPosition.row,reason:'serde `with = "..."` module \u2014 body invoked via reflection',containerName:o})}return n}function Ae(e){for(let t=0;t<Math.min(e.namedChildCount,12);t+=1){let n=e.namedChild(t);if(!n||n.type!=="line_comment"&&n.type!=="block_comment")break;if(/@generated\b/.test(n.text)||/This file is .*generated\b/i.test(n.text)||/Code generated by/i.test(n.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(n.text)||/openapi-generator/i.test(n.text)&&/Generated by/i.test(n.text))return!0}return!1}var Ne=[{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}],ee=/^#!?\[\s*serde\s*\(/,Me=/^#!?\[\s*schemars\s*\(/,ke=/^#!?\[\s*validate\s*\(/,K=/\bwith\s*=\s*"([^"]+)"/g;function te(e,t){return A(e,t,ve,()=>new Set,(n,s,o)=>{if(s==="rust"){for(let i of n.rootNode.descendantsOfType("attribute_item"))Z(i.text,o);for(let i of n.rootNode.descendantsOfType("inner_attribute_item"))Z(i.text,o)}})??new Set}var ve=new WeakMap;function Z(e,t){let n=ee.test(e),s=Me.test(e),o=ke.test(e);if(!(!n&&!s&&!o))for(let{re:i}of Ne){i.lastIndex=0;let a;for(;(a=i.exec(e))!==null;){let l=a[1],c=l.split("::").pop()??l;c==="is_none"&&/\bOption\b/.test(l)||c==="is_empty"&&/\b(String|Vec|HashMap|BTreeMap|HashSet|BTreeSet)\b/.test(l)||c&&t.add(c)}}}function De(e){let t=new Set;for(let n of e.descendantsOfType("attribute_item")){if(!ee.test(n.text))continue;K.lastIndex=0;let s;for(;(s=K.exec(n.text))!==null;){let o=s[1],i=o.split("::").pop()??o;i&&t.add(i)}}return t}var Oe=new Set(["invoke","invokeTauriCommand","listen","once","emit","subscribe","dispatch","sendCommand","callRust"]);function Et(e,t){return A(e,t,Te,()=>new Set,(n,s,o)=>{if(!(s!=="typescript"&&s!=="tsx"&&s!=="javascript"))for(let i of n.rootNode.descendantsOfType("call_expression")){let a=i.namedChild(0);if(!a)continue;let l=J(a);if(!l||!Oe.has(l))continue;let c=i.namedChildren.find(d=>d.type==="arguments");if(!c)continue;let r=c.namedChild(0);if(!r||r.type!=="string")continue;let u=r.namedChildren.find(d=>d.type==="string_fragment");u&&o.add(u.text)}})??new Set}var Te=new WeakMap;var Fe=new Set(["identifier","type_identifier","field_identifier"]),Pe=new Set(["identifier"]),He=new Set(["identifier","property_identifier","type_identifier"]),$e=new Set(["rust","python"]),Je=/\{([^{}]*)\}/g,Ge=/\b([A-Za-z_][\w]*)\b/g;function ie(e,t,n,s={}){if(!n)return[];let o=x(e,t);if(!o)return[];if(o.indexOf(n)===-1)return[];if(y(t))return(F(e,t).get(n)??[]).filter(u=>!ne(u,s));let i=W(e,t,o),a=new RegExp(`\\b${B(n)}\\b`),l=[];for(let c=0;c<i.length;c++)ne(c,s)||a.test(i[c]??"")&&l.push(c);return l}function ne(e,t){return typeof t.excludeStartLine=="number"&&typeof t.excludeEndLine=="number"&&e>=t.excludeStartLine&&e<=t.excludeEndLine}var O=h("file-identifiers");function xt(e,t){return O.get(e,t,()=>new Set(F(e,t).keys()))}var T=h("file-ident-lines");function F(e,t){return T.get(e,t,()=>We(e,t))}var P=h("file-idents-by-line");function se(e,t){return P.get(e,t,()=>{let n=F(e,t),s=0;for(let i of n.values()){let a=i[i.length-1];a!==void 0&&a>s&&(s=a)}let o=new Array(s+1);for(let i=0;i<=s;i+=1)o[i]=new Set;for(let[i,a]of n)for(let l of a)o[l].add(i);return o})}function At(e){O.invalidateAll(e),T.invalidateAll(e),P.invalidateAll(e)}function Nt(e,t){O.invalidate(e,t),T.invalidate(e,t),P.invalidate(e,t)}function We(e,t){let n=new Map,s=(l,c)=>{let r=n.get(l);if(!r){n.set(l,[c]);return}r[r.length-1]!==c&&r.push(c)};if(y(t)){let l=S(e,t);if(l){let c=y(t),r=c==="rust"?Fe:c==="python"?Pe:He,u=d=>{if(r.has(d.type)&&s(d.text,d.startPosition.row),c&&$e.has(c)&&d.type==="string_content"){let f=d.startPosition.row;for(let p of d.text.matchAll(Je)){let g=p[1]??"";for(let m of g.matchAll(Ge))m[1]&&s(m[1],f)}}for(let f of d.children)u(f)};return u(l.rootNode),n}}let o=x(e,t);if(!o)return n;let i=G(o).split(/\r?\n/),a=/\b([A-Za-z_$][\w$]*)\b/g;for(let l=0;l<i.length;l+=1){let c=i[l]??"";for(let r of c.matchAll(a))r[1]&&s(r[1],l)}return n}var le=h("file-dep-graph");function Jt(e){le.invalidateAll(e),ce.invalidate(e),me.invalidate(e)}function Gt(e,t){return le.get(e,t??"",()=>{let n=new Map,s=je(e),o=(i,a)=>ze(e,n,s,i,a);for(let i of Be(e,t))o(i.from_file,i.to_file);for(let i of s)if(!(t&&!i.includes(t)))for(let a of N(e,i))a.sourcePath&&o(i,a.sourcePath);return n})}function Be(e,t){let n=t?`AND d1.relative_path LIKE '%${t}%'`:"";return e.all(`SELECT DISTINCT
2
+ d1.relative_path AS from_file,
3
+ d2.relative_path AS to_file
4
+ FROM mentions m
5
+ JOIN chunks c ON m.chunk_id = c.id
6
+ JOIN documents d1 ON c.document_id = d1.id
7
+ JOIN global_symbols gs ON m.symbol_id = gs.id
8
+ JOIN (
9
+ SELECT m2.symbol_id, c2.document_id
10
+ FROM mentions m2
11
+ JOIN chunks c2 ON m2.chunk_id = c2.id
12
+ WHERE m2.role = 1
13
+ GROUP BY m2.symbol_id
14
+ ) sym_def ON sym_def.symbol_id = gs.id
15
+ JOIN documents d2 ON sym_def.document_id = d2.id
16
+ WHERE d1.id != d2.id
17
+ AND m.role != 1
18
+ ${e.pathExclusionsFor("d1","d2")}
19
+ ${n}`)}function je(e){return new Set(e.all(`SELECT relative_path
20
+ FROM documents
21
+ WHERE 1 = 1
22
+ ${e.pathExclusionsFor("documents")}
23
+ ORDER BY relative_path`).map(t=>t.relative_path).filter(t=>!e.isIgnored(t)))}function ze(e,t,n,s,o){if(s===o||e.isIgnored(s)||e.isIgnored(o)||!n.has(o))return;let i=t.get(s);i||(i=new Set,t.set(s,i)),i.add(o)}function Wt(e,t,n={}){let s=ue(e,[t],{additive:n.additive,semantic:n.semantic}),o=n.callableOnly?(s.get(t.symbolId)??[]).filter(i=>j(i.symbol)):s.get(t.symbolId)??[];return typeof n.limit=="number"?o.slice(0,n.limit):o}function Bt(e,t,n={}){let s=Ye(e)?Ke(e,t,{semantic:n.semantic!==!1}):Ve(e).get(t.symbolId)??[];return typeof n.limit=="number"?s.slice(0,n.limit):s}var ce=w("caller-rows"),Ue=2e4;function Ye(e){return(e.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>Ue}function Ve(e){return ce.get(e,()=>{let t=k(e),n=ue(e,t),s=new Map;for(let a of t)s.set(a.symbol,a.symbolId);let o=new Map,i=new Map;for(let a of t){let l=n.get(a.symbolId);if(!(!l||l.length===0))for(let c of l){let r=s.get(c.symbol);if(r===void 0||r===a.symbolId)continue;let u=o.get(r);u||(u=[],o.set(r,u),i.set(r,new Set));let d=`${a.symbol}|${a.relativePath}`;i.get(r).has(d)||(i.get(r).add(d),u.push({symbol:a.symbol,file:a.relativePath}))}}return o})}function Ke(e,t,n){let s=[],o=new Set,i=l=>{if(l.symbol===t.symbol)return;let c=`${l.symbol}|${l.file}`;o.has(c)||(o.add(c),s.push(l))};for(let l of qe(e,t))l.file!==t.relativePath&&i({symbol:l.enclosingSymbol??l.file,file:l.file});let a=n.semantic?Ze(e,t):null;if(a)for(let l of U(e,a)){if(l.file===t.relativePath||e.isIgnored(l.file))continue;let c=v(M(e,l.file),l.line);i({symbol:c?.symbol??l.file,file:l.file})}return s}function Ze(e,t){return e.get(`SELECT
24
+ d.id AS documentId,
25
+ gs.id AS symbolId,
26
+ gs.symbol,
27
+ d.relative_path AS relativePath,
28
+ COALESCE(der.start_line, c.start_line) AS startLine,
29
+ COALESCE(der.end_line, c.end_line) AS endLine,
30
+ COALESCE(gs.display_name, '') AS leaf,
31
+ NULL AS parentTypeName,
32
+ CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
33
+ CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
34
+ gs.kind AS kind,
35
+ gs.documentation AS documentation,
36
+ gs.enclosing_symbol AS enclosingSymbol
37
+ FROM global_symbols gs
38
+ LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
39
+ LEFT JOIN chunks c ON c.document_id = der.document_id
40
+ JOIN documents d ON d.id = COALESCE(der.document_id, c.document_id)
41
+ WHERE gs.id = ?
42
+ LIMIT 1`,t.symbolId)??null}function qe(e,t){let n=nt(e,t);return n?it(e,Xe(e,n.match,n.identifier)):[]}function Xe(e,t,n){let s=new Map;for(let[o,i]of Qe(e,t.symbolId))s.set(o,et(e,o,i,t,n));return s}function Qe(e,t){let n=new Map,s=e.all(`SELECT DISTINCT d.relative_path, c.start_line, c.end_line
43
+ FROM mentions m
44
+ JOIN chunks c ON m.chunk_id = c.id
45
+ JOIN documents d ON c.document_id = d.id
46
+ WHERE m.symbol_id = ?
47
+ AND m.role != 1
48
+ ${e.pathExclusionsFor("d")}
49
+ ORDER BY d.relative_path, c.start_line`,t);for(let o of s){if(e.isIgnored(o.relative_path))continue;let i=n.get(o.relative_path);i||(i=[],n.set(o.relative_path,i)),i.push({start_line:o.start_line,end_line:o.end_line})}return n}function et(e,t,n,s,o){let i=t===s.relativePath?{excludeStartLine:s.startLine,excludeEndLine:s.endLine}:{},a=o?ie(e,t,o,i):[];return n.flatMap(l=>tt(a,l))}function tt(e,t){let n=e.filter(s=>s>=t.start_line&&s<=t.end_line);return n.length>0?n:[t.start_line]}function nt(e,t){let n=z(e,t);return n?{match:n,identifier:L(n.symbol)||null}:null}function it(e,t){let n=[],s=new Set;for(let[o,i]of t){let a=M(e,o);for(let l of i){let c=v(a,l),r=`${o}|${l}|${c?.symbol??""}`;s.has(r)||(s.add(r),n.push({file:o,line:l,enclosingSymbol:c?.symbol??null}))}}return n}function ue(e,t,n={}){if(t.length===0)return new Map;let s=n.additive??!1,o=[],i=[];for(let u of t)y(u.relativePath)&&C(e,u.relativePath)!==null?o.push(u):i.push(u);let a=new Map,l=new Map,c=u=>{for(let[d,f]of u){let p=a.get(d);p||(p=[],a.set(d,p));let g=l.get(d);g||(g=new Set,l.set(d,g));for(let m of f){let b=`${m.symbol}|${m.chunkId}`;g.has(b)||(g.add(b),p.push(m))}}};o.length>0&&c(st(e,o)),n.semantic!==!1&&c(yt(V(e,t)));let r=s?t:i;return r.length>0&&c(ct(e,r)),a}function st(e,t){let n=new Map,s=ot(t,n),o=pe(e);for(let[i,a]of s){let l=C(e,i);if(l)for(let c of l){let r=rt(a,c.line);if(!r)continue;let u=at(e,i,o,c.calleeLeaf,c.memberAccess);u&&u.symbol!==r.symbol&&n.get(r.symbolId).push({symbol:u.symbol,file:u.file,chunkId:c.line})}}return n}function ot(e,t){let n=new Map;for(let s of e){let o=n.get(s.relativePath);o?o.push(s):n.set(s.relativePath,[s]),t.set(s.symbolId,[])}for(let s of n.values())s.sort((o,i)=>o.endLine-o.startLine-(i.endLine-i.startLine));return n}function rt(e,t){return e.find(n=>t>=n.startLine&&t<=n.endLine)??null}function at(e,t,n,s,o){let i=de(t,n.get(s)??[]);return i.length===0?null:fe(e,t,i,o)}function de(e,t){let n=oe(e);return n?t.filter(s=>oe(s.file)===n):t}function fe(e,t,n,s){let o=n.find(i=>i.file===t);if(o)return o;if(s){let i=new Set(N(e,t).map(a=>a.sourcePath).filter(a=>!!a));for(let a of n)for(let l of i)if(lt(l,a.file))return a;return null}return n.length===1?n[0]:null}function lt(e,t){let n=s=>s.replace(/\\/g,"/").replace(/^\.\//,"");return n(e)===n(t)}function oe(e){let t=y(e);return t?t==="typescript"||t==="tsx"||t==="javascript"?"javascript-family":t:null}var me=w("global-leaf-index");function pe(e){return me.get(e,()=>{let t=e.all(`SELECT gs.id, gs.symbol,
50
+ COALESCE(der_doc.relative_path, mention_doc.relative_path) AS relative_path
51
+ FROM global_symbols gs
52
+ LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
53
+ LEFT JOIN documents der_doc ON der_doc.id = der.document_id
54
+ LEFT JOIN (
55
+ SELECT m.symbol_id, MIN(d.relative_path) AS relative_path
56
+ FROM mentions m
57
+ JOIN chunks c ON m.chunk_id = c.id
58
+ JOIN documents d ON c.document_id = d.id
59
+ WHERE m.role = 1
60
+ GROUP BY m.symbol_id
61
+ ) mention_doc ON mention_doc.symbol_id = gs.id
62
+ WHERE 1 = 1
63
+ ${e.symbolNoiseFor("gs")}`),n=new Map;for(let s of t){if(!s.relative_path||e.isIgnored(s.relative_path))continue;let o=L(s.symbol);if(!o)continue;let i=n.get(o);i||(i=[],n.set(o,i)),i.some(a=>a.symbolId===s.id)||i.push({symbol:s.symbol,symbolId:s.id,file:s.relative_path})}return n})}function ct(e,t){if(t.length===0)return new Map;let n=e.all(`SELECT c.document_id, c.id AS chunk_id, c.start_line, c.end_line, m.symbol_id
64
+ FROM mentions m
65
+ JOIN chunks c ON m.chunk_id = c.id
66
+ WHERE m.role != 1`),s=new Map;for(let r of n)s.has(r.document_id)||s.set(r.document_id,[]),s.get(r.document_id).push(r);let o=new Map(e.all("SELECT id, relative_path FROM documents").map(r=>[r.id,r.relative_path])),i=new Map,a=e.all(`SELECT gs.id AS symbol_id, gs.symbol,
67
+ COALESCE(der.document_id, def_chunk.document_id) AS document_id
68
+ FROM global_symbols gs
69
+ LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
70
+ LEFT JOIN (
71
+ SELECT m.symbol_id, MIN(c.document_id) AS document_id
72
+ FROM mentions m
73
+ JOIN chunks c ON m.chunk_id = c.id
74
+ WHERE m.role = 1
75
+ GROUP BY m.symbol_id
76
+ ) def_chunk ON def_chunk.symbol_id = gs.id`);for(let r of a)i.has(r.symbol_id)||i.set(r.symbol_id,{symbol:r.symbol,file:r.document_id!==null?o.get(r.document_id)??"":""});let l=new Map,c=o;for(let r of t){let u=s.get(r.documentId)??[],d=new Set,f=[],p=null,g=()=>{if(p)return p;let m=c.get(r.documentId)??"",b=new Set;if(m){let I=se(e,m),R=Math.max(0,r.startLine),$=Math.min(I.length-1,r.endLine);for(let _=R;_<=$;_+=1)for(let ge of I[_])b.add(ge)}return p=b,b};for(let m of u){if(m.symbol_id===r.symbolId)continue;let b=i.get(m.symbol_id);if(!b)continue;if(!(m.start_line>=r.startLine&&m.end_line<=r.endLine)){if(!(m.start_line<=r.endLine&&m.end_line>=r.startLine))continue;let _=L(b.symbol);if(!_||!g().has(_))continue}let R=`${b.symbol}|${m.chunk_id}`;d.has(R)||(d.add(R),f.push({...b,chunkId:m.chunk_id}))}l.set(r.symbolId,f)}return l}function jt(e,t,n={}){let s=new Map;if(t&&t.length===0)return s;let o=e.all(`SELECT relative_path FROM documents
77
+ WHERE 1 = 1 ${e.pathExclusionsFor("documents")}`),i=pe(e),a=t??k(e),l=new Set(a.map(c=>c.symbolId));return ut(e,s,o,i,l),dt(e,s,a,l),gt(e,s,o,i,l),n.semantic!==!1&&_t(s,Y(e,bt(a))),s}function ut(e,t,n,s,o){for(let i of n){if(!y(i.relative_path)||e.isIgnored(i.relative_path))continue;let a=C(e,i.relative_path);if(a)for(let l of a){let c=de(i.relative_path,s.get(l.calleeLeaf)??[]);if(!c||c.length===0)continue;let r=fe(e,i.relative_path,c,l.memberAccess);r&&o.has(r.symbolId)&&r.file!==i.relative_path&&H(t,r.symbolId,i.relative_path)}}}function dt(e,t,n,s){let o=mt(n);for(let i of ft(e,s))e.isIgnored(i.relative_path)||pt(i,o.get(i.symbol_id))||H(t,i.symbol_id,i.relative_path)}function ft(e,t){if(!t)return ae(e);let n=[...t];if(n.length===0)return[];let s=[];for(let o=0;o<n.length;o+=re)s.push(...ae(e,n.slice(o,o+re)));return s}var re=750;function ae(e,t){let n=t&&t.length>0?`AND m.symbol_id IN (${t.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id, d.relative_path, c.document_id,
78
+ c.start_line AS chunk_start, c.end_line AS chunk_end
79
+ FROM mentions m
80
+ JOIN chunks c ON m.chunk_id = c.id
81
+ JOIN documents d ON c.document_id = d.id
82
+ WHERE m.role != 1
83
+ ${n}
84
+ ${e.pathExclusionsFor("d")}`,...t??[])}function mt(e){let t=new Map;for(let n of e)t.set(n.symbolId,{docId:n.documentId,startLine:n.startLine,endLine:n.endLine});return t}function pt(e,t){return!!t&&t.docId===e.document_id&&e.chunk_start>=t.startLine&&e.chunk_end<=t.endLine}function gt(e,t,n,s,o){for(let i of n){if(e.isIgnored(i.relative_path)||y(i.relative_path)!=="rust")continue;let a=te(e,i.relative_path);if(a.size!==0)for(let l of a){let c=s.get(l);if(c)for(let r of c)o.has(r.symbolId)&&r.file!==i.relative_path&&H(t,r.symbolId,i.relative_path)}}}function H(e,t,n){let s=e.get(t);s||(s=new Set,e.set(t,s)),s.add(n)}function bt(e){return e.filter(t=>"relativePath"in t&&"symbol"in t&&"leaf"in t)}function yt(e){let t=new Map;for(let[n,s]of e){let o=[];for(let i of s)o.push({symbol:i.symbol,file:i.file,chunkId:-1});t.set(n,o)}return t}function _t(e,t){for(let[n,s]of t){let o=e.get(n);o||(o=new Set,e.set(n,o));for(let i of s)o.add(i)}}export{St as a,te as b,Et as c,ie as d,xt as e,F as f,At as g,Nt as h,Jt as i,Gt as j,Wt as k,Bt as l,qe as m,ue as n,pe as o,jt as p};
85
+ //# sourceMappingURL=chunk-EHEZLULQ.js.map
@@ -1,2 +1,2 @@
1
- import{a as p,b as g}from"./chunk-YXMHTJYY.js";import{g as B}from"./chunk-3PVIYZ74.js";function w(s,e={}){let{scope:r,maxDepth:c=10}=e,n=B(s,r),i=[],a=new Set,l=new Set,f=[];function y(t,o){if(o>c)return;if(l.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)),d=[...u.slice(m,-1),...u.slice(0,m),u[m]],S=d.join(" -> ");b.has(S)||(b.add(S),i.push({path:d,kind:R(d)}))}return}if(a.has(t))return;a.add(t),l.add(t),f.push(t);let k=n.get(t);if(k)for(let h of k)y(h,o+1);f.pop(),l.delete(t)}let b=new Set;for(let t of n.keys())a.has(t)||y(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":g(e)||g(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 a=n[n.length-1],l=i[i.length-1];if(a&&a===l)return!0}return!1}export{w as a};
2
- //# sourceMappingURL=chunk-PIRXZGV6.js.map
1
+ import{a as p,b as g}from"./chunk-IIKNAXAE.js";import{j as B}from"./chunk-EHEZLULQ.js";function w(s,e={}){let{scope:r,maxDepth:c=10}=e,n=B(s,r),i=[],a=new Set,l=new Set,f=[];function y(t,o){if(o>c)return;if(l.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)),d=[...u.slice(m,-1),...u.slice(0,m),u[m]],S=d.join(" -> ");b.has(S)||(b.add(S),i.push({path:d,kind:R(d)}))}return}if(a.has(t))return;a.add(t),l.add(t),f.push(t);let k=n.get(t);if(k)for(let h of k)y(h,o+1);f.pop(),l.delete(t)}let b=new Set;for(let t of n.keys())a.has(t)||y(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":g(e)||g(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 a=n[n.length-1],l=i[i.length-1];if(a&&a===l)return!0}return!1}export{w as a};
2
+ //# sourceMappingURL=chunk-GRAEZYYU.js.map