scip-query 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/README.md +88 -1007
  2. package/dist/augment-vue-worker.js +1 -1
  3. package/dist/chunk-2QNKEJ7R.js +2 -0
  4. package/dist/{chunk-JTXKS5GK.js → chunk-3X43EYFU.js} +2 -2
  5. package/dist/{chunk-JB4PUN5S.js → chunk-4GPWGSOE.js} +2 -2
  6. package/dist/{chunk-WODJHE6Z.js → chunk-4LKJMRT5.js} +2 -2
  7. package/dist/{chunk-2IYEIFPP.js → chunk-4T35WUCX.js} +2 -2
  8. package/dist/chunk-4VYIZV3S.js +62 -0
  9. package/dist/{chunk-7O4MJYIW.js → chunk-5RGK4YA5.js} +2 -2
  10. package/dist/{chunk-KJ3ZJIE5.js → chunk-5TB4N27G.js} +2 -2
  11. package/dist/{chunk-ROOHENEP.js → chunk-6QC7SCKV.js} +2 -2
  12. package/dist/{chunk-6H2XIIPY.js → chunk-6QH2L26C.js} +6 -6
  13. package/dist/{chunk-MDAYGS6T.js → chunk-6SR4UNWI.js} +2 -2
  14. package/dist/chunk-6XEWA6FX.js +2 -0
  15. package/dist/{chunk-3GNFUVFA.js → chunk-7WHNTKSD.js} +2 -2
  16. package/dist/{chunk-XO6R3X5J.js → chunk-D62LLANH.js} +2 -2
  17. package/dist/{chunk-OHEIZWIA.js → chunk-EDXML2HI.js} +2 -2
  18. package/dist/{chunk-23YIGCYF.js → chunk-EIGCLVKK.js} +5 -5
  19. package/dist/{chunk-ZNUPGRPR.js → chunk-EVXQF7DM.js} +2 -2
  20. package/dist/chunk-EZQOVY3C.js +2 -0
  21. package/dist/{chunk-563HLCDW.js → chunk-FU5WRWAN.js} +2 -2
  22. package/dist/{chunk-4STLJYHI.js → chunk-GIRI7FHW.js} +2 -2
  23. package/dist/{chunk-A2AVLALL.js → chunk-HTVLH3NL.js} +2 -2
  24. package/dist/{chunk-J6Z5YKGQ.js → chunk-IFGEPTH5.js} +2 -2
  25. package/dist/chunk-JDFWJ7VK.js +2 -0
  26. package/dist/{chunk-33SSUPCB.js → chunk-LLL7THVV.js} +2 -2
  27. package/dist/{chunk-72JOIFXL.js → chunk-LXJTDFOV.js} +2 -2
  28. package/dist/chunk-NBUINPSH.js +2 -0
  29. package/dist/{chunk-NSTZMBAB.js → chunk-OPWOX7NT.js} +2 -2
  30. package/dist/{chunk-TRNAQABL.js → chunk-OPZQIJZU.js} +2 -2
  31. package/dist/chunk-P3PVY6TX.js +2 -0
  32. package/dist/{chunk-3OUC276S.js → chunk-P7UMQ7R7.js} +2 -2
  33. package/dist/{chunk-VUBQBW7H.js → chunk-PEU24CSY.js} +2 -2
  34. package/dist/{chunk-GAQGJ52J.js → chunk-QBXTQODK.js} +2 -2
  35. package/dist/{chunk-LDV2B7ET.js → chunk-QP6FLI6D.js} +2 -2
  36. package/dist/{chunk-NYEMZHUC.js → chunk-QVPYMZUJ.js} +2 -2
  37. package/dist/{chunk-2JEFS2YJ.js → chunk-RFCR2BRD.js} +2 -2
  38. package/dist/chunk-S5VMVNFM.js +2 -0
  39. package/dist/{chunk-DFK54IRN.js → chunk-SDPP5KVQ.js} +2 -2
  40. package/dist/{chunk-ZXFTC5ET.js → chunk-SVSLAUSJ.js} +2 -2
  41. package/dist/{chunk-WPLKHAH7.js → chunk-TB2OYNRS.js} +2 -2
  42. package/dist/chunk-TGNL3ZKZ.js +2 -0
  43. package/dist/{chunk-7H4RJ4MC.js → chunk-UHMJYNTK.js} +2 -2
  44. package/dist/{chunk-QPRIYXH4.js → chunk-VMS5YTBS.js} +2 -2
  45. package/dist/{chunk-FD37DBTD.js → chunk-WJQFABZN.js} +2 -2
  46. package/dist/{chunk-KNA6Z7JB.js → chunk-X2JB54QF.js} +2 -2
  47. package/dist/{chunk-QWJBIBE6.js → chunk-XANDY7N5.js} +2 -2
  48. package/dist/{chunk-WJQY2LGT.js → chunk-XDXZP3BE.js} +2 -2
  49. package/dist/{chunk-ARBZM2NF.js → chunk-YH6TTQEI.js} +2 -2
  50. package/dist/cli.js +122 -123
  51. package/dist/index.d.ts +21 -28
  52. package/dist/index.js +1 -1
  53. package/dist/queries/affected.js +1 -1
  54. package/dist/queries/bottlenecks.js +1 -1
  55. package/dist/queries/by-kind.js +1 -1
  56. package/dist/queries/call-graph.js +1 -1
  57. package/dist/queries/change-surface.js +1 -1
  58. package/dist/queries/code.js +1 -1
  59. package/dist/queries/complexity-hotspots.d.ts +1 -1
  60. package/dist/queries/complexity-hotspots.js +1 -1
  61. package/dist/queries/complexity.js +1 -1
  62. package/dist/queries/convergence.js +1 -1
  63. package/dist/queries/coupling.js +1 -1
  64. package/dist/queries/dataflow.js +1 -1
  65. package/dist/queries/dead.js +1 -1
  66. package/dist/queries/deps.js +1 -1
  67. package/dist/queries/diff-impact.js +1 -1
  68. package/dist/queries/drift.js +1 -1
  69. package/dist/queries/extract-candidates.js +1 -1
  70. package/dist/queries/fan.js +1 -1
  71. package/dist/queries/health.js +1 -1
  72. package/dist/queries/hierarchy.js +1 -1
  73. package/dist/queries/hotspots.js +1 -1
  74. package/dist/queries/imports.js +1 -1
  75. package/dist/queries/index.js +1 -1
  76. package/dist/queries/isolated.js +1 -1
  77. package/dist/queries/members.js +1 -1
  78. package/dist/queries/methods.js +1 -1
  79. package/dist/queries/outline.js +1 -1
  80. package/dist/queries/passthrough-candidates.js +1 -1
  81. package/dist/queries/redundant-reexports.js +1 -1
  82. package/dist/queries/refs.js +1 -1
  83. package/dist/queries/similar-signatures.js +1 -1
  84. package/dist/queries/similar.js +1 -1
  85. package/dist/queries/slice.js +1 -1
  86. package/dist/queries/stale-abstractions.js +1 -1
  87. package/dist/queries/surface.js +1 -1
  88. package/dist/queries/symbols.js +1 -1
  89. package/dist/queries/system.js +1 -1
  90. package/dist/queries/trace.js +1 -1
  91. package/dist/queries/wrapper-candidates.js +1 -1
  92. package/dist/reindex-worker.js +1 -1
  93. package/dist/reindex.js +16 -16
  94. package/package.json +2 -1
  95. package/dist/chunk-7OX2O53H.js +0 -62
  96. package/dist/chunk-CKIO6SVS.js +0 -2
  97. package/dist/chunk-D6Z67MZL.js +0 -2
  98. package/dist/chunk-FOQQDXE7.js +0 -2
  99. package/dist/chunk-QAEDNTY7.js +0 -2
  100. package/dist/chunk-TGK5DFBJ.js +0 -2
  101. package/dist/chunk-V53J46BX.js +0 -2
  102. package/dist/chunk-YSZNAG4G.js +0 -2
@@ -1,2 +1,2 @@
1
- import{c as t}from"./chunk-6H2XIIPY.js";import{writeFileSync as o}from"fs";import{workerData as s}from"worker_threads";var e=s;try{let r=t({projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,vueFiles:e.vueFiles,tasks:e.tasks});o(e.resultPath,JSON.stringify({ok:!0,result:r}))}catch(r){o(e.resultPath,JSON.stringify({ok:!1,error:r instanceof Error?r.message:String(r)}))}finally{let r=new Int32Array(e.sharedBuffer);Atomics.add(r,0,1),Atomics.notify(r,0)}
1
+ import{c as t}from"./chunk-6QH2L26C.js";import{writeFileSync as o}from"fs";import{workerData as s}from"worker_threads";var e=s;try{let r=t({projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,vueFiles:e.vueFiles,tasks:e.tasks});o(e.resultPath,JSON.stringify({ok:!0,result:r}))}catch(r){o(e.resultPath,JSON.stringify({ok:!1,error:r instanceof Error?r.message:String(r)}))}finally{let r=new Int32Array(e.sharedBuffer);Atomics.add(r,0,1),Atomics.notify(r,0)}
2
2
  //# sourceMappingURL=augment-vue-worker.js.map
@@ -0,0 +1,2 @@
1
+ import{d as i}from"./chunk-MX6F756F.js";import{d as m}from"./chunk-P3PVY6TX.js";import{a}from"./chunk-YH6TTQEI.js";import{a as r}from"./chunk-EVXQF7DM.js";import{c as o}from"./chunk-4VYIZV3S.js";function S(s,n,c={}){let e=r(s,n);if(!e)return null;let t=c.semantic!==!1,y=m(s,e,{limit:50,semantic:t}),b=i(a(s,e,{limit:50,additive:!0,callableOnly:!0,semantic:t}));return{symbol:e.symbol,shortName:o(e.symbol),callers:y.map(l=>({symbol:l.symbol,shortName:o(l.symbol),file:l.file})),callees:b.map(l=>({symbol:l.symbol,shortName:o(l.symbol),file:l.file}))}}export{S as a};
2
+ //# sourceMappingURL=chunk-2QNKEJ7R.js.map
@@ -1,3 +1,3 @@
1
- import{a as b}from"./chunk-RCJEFQOK.js";import{d as x}from"./chunk-7OX2O53H.js";import{a as d,e as g,j as y}from"./chunk-5TT47UMX.js";import{a as u}from"./chunk-NHDPYW7O.js";var C=u("definition-consumer-file-usage");function I(e,t,n){return e.callerFileMap(t,{semantic:n.semantic,sourceFallback:n.sourceFallback})}function P(e,t,n){let i=[],r=0,s=0,p=x(t.symbol);for(let a of n)D(e,a,t.relativePath,p)?r++:S(e,a,p)?s++:i.push(a);return{realConsumers:i,barrelConsumers:r,importOnlyConsumers:s}}function S(e,t,n){if(!n)return!1;let i=g(t);if(!i)return!1;let r=C.get(e,t,()=>v(e,t,i));return r.importedLeaves.has(n)&&!r.usedLeaves.has(n)}function j(e){C.invalidateAll(e)}function v(e,t,n){let i=new Set,r=new Set,s=y(e,t);if(!s)return{importedLeaves:i,usedLeaves:r};let p=n==="rust"?new Set(["use_declaration"]):n==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),a=(o,f)=>{let c=f||p.has(o.type);(o.type==="identifier"||o.type==="type_identifier"||o.type==="property_identifier"||o.type==="field_identifier")&&(c?i.add(o.text):r.add(o.text));for(let l of o.children)a(l,c)};return a(s.rootNode,!1),{importedLeaves:i,usedLeaves:r}}function D(e,t,n,i){if(!i)return!1;let r=d(e,t);if(!r)return!1;let s=b(e,t);if(s.length===0)return!1;let p=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`\\b${p}\\b`),o=r.split(`
1
+ import{a as b}from"./chunk-RCJEFQOK.js";import{d as x}from"./chunk-4VYIZV3S.js";import{a as d,e as g,j as y}from"./chunk-5TT47UMX.js";import{a as u}from"./chunk-NHDPYW7O.js";var C=u("definition-consumer-file-usage");function I(e,t,n){return e.callerFileMap(t,{semantic:n.semantic,sourceFallback:n.sourceFallback})}function P(e,t,n){let i=[],r=0,s=0,p=x(t.symbol);for(let a of n)D(e,a,t.relativePath,p)?r++:S(e,a,p)?s++:i.push(a);return{realConsumers:i,barrelConsumers:r,importOnlyConsumers:s}}function S(e,t,n){if(!n)return!1;let i=g(t);if(!i)return!1;let r=C.get(e,t,()=>v(e,t,i));return r.importedLeaves.has(n)&&!r.usedLeaves.has(n)}function j(e){C.invalidateAll(e)}function v(e,t,n){let i=new Set,r=new Set,s=y(e,t);if(!s)return{importedLeaves:i,usedLeaves:r};let p=n==="rust"?new Set(["use_declaration"]):n==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),a=(o,f)=>{let c=f||p.has(o.type);(o.type==="identifier"||o.type==="type_identifier"||o.type==="property_identifier"||o.type==="field_identifier")&&(c?i.add(o.text):r.add(o.text));for(let l of o.children)a(l,c)};return a(s.rootNode,!1),{importedLeaves:i,usedLeaves:r}}function D(e,t,n,i){if(!i)return!1;let r=d(e,t);if(!r)return!1;let s=b(e,t);if(s.length===0)return!1;let p=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`\\b${p}\\b`),o=r.split(`
2
2
  `),f=0;for(let c=0;c<o.length;c++){if(!a.test(o[c]??""))continue;if(f++,!s.find(m=>m.startLine<=c&&c<=m.endLine))return!1}return f>0}export{I as a,P as b,S as c,j as d};
3
- //# sourceMappingURL=chunk-JTXKS5GK.js.map
3
+ //# sourceMappingURL=chunk-3X43EYFU.js.map
@@ -1,4 +1,4 @@
1
- import{c as $}from"./chunk-7O4MJYIW.js";import{c as R}from"./chunk-ZNUPGRPR.js";import{b as y}from"./chunk-RCJEFQOK.js";import{A as O,t as A,u as T}from"./chunk-BOVNTAKQ.js";import{c as L}from"./chunk-KJ6CW6EK.js";import{d,s as h,w as _}from"./chunk-7OX2O53H.js";import{a as p,e as m,j as P}from"./chunk-5TT47UMX.js";import{a as S,b as k}from"./chunk-NHDPYW7O.js";var X=new Set(["identifier","type_identifier","field_identifier"]),q=new Set(["identifier"]),ee=new Set(["identifier","property_identifier","type_identifier"]),ne=new Set(["rust","python"]),te=/\{([^{}]*)\}/g,ie=/\b([A-Za-z_][\w]*)\b/g;function I(e,t,i,n={}){if(!i)return[];let r=p(e,t);if(!r)return[];if(r.indexOf(i)===-1)return[];if(m(t))return(D(e,t).get(i)??[]).filter(f=>!B(f,n));let o=T(e,t,r),s=new RegExp(`\\b${O(i)}\\b`),a=[];for(let c=0;c<o.length;c++)B(c,n)||s.test(o[c]??"")&&a.push(c);return a}function B(e,t){return typeof t.excludeStartLine=="number"&&typeof t.excludeEndLine=="number"&&e>=t.excludeStartLine&&e<=t.excludeEndLine}var x=S("file-identifiers");function H(e,t){return x.get(e,t,()=>new Set(D(e,t).keys()))}var N=S("file-ident-lines");function D(e,t){return N.get(e,t,()=>re(e,t))}var v=S("file-idents-by-line");function Se(e,t){return v.get(e,t,()=>{let i=D(e,t),n=0;for(let o of i.values()){let s=o[o.length-1];s!==void 0&&s>n&&(n=s)}let r=new Array(n+1);for(let o=0;o<=n;o+=1)r[o]=new Set;for(let[o,s]of i)for(let a of s)r[a].add(o);return r})}function ye(e){x.invalidateAll(e),N.invalidateAll(e),v.invalidateAll(e)}function he(e,t){x.invalidate(e,t),N.invalidate(e,t),v.invalidate(e,t)}function re(e,t){let i=new Map,n=(a,c)=>{let l=i.get(a);if(!l){i.set(a,[c]);return}l[l.length-1]!==c&&l.push(c)};if(m(t)){let a=P(e,t);if(a){let c=m(t),l=c==="rust"?X:c==="python"?q:ee,f=u=>{if(l.has(u.type)&&n(u.text,u.startPosition.row),c&&ne.has(c)&&u.type==="string_content"){let E=u.startPosition.row;for(let K of u.text.matchAll(te)){let V=K[1]??"";for(let F of V.matchAll(ie))F[1]&&n(F[1],E)}}for(let E of u.children)f(E)};return f(a.rootNode),i}}let r=p(e,t);if(!r)return i;let o=A(r).split(/\r?\n/),s=/\b([A-Za-z_$][\w$]*)\b/g;for(let a=0;a<o.length;a+=1){let c=o[a]??"";for(let l of c.matchAll(s))l[1]&&n(l[1],a)}return i}function j(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function g(e,t){return j(e)===j(t)}function J(e,t){let i=new Map;for(let n of y(e,t)){if(!n.sourcePath)continue;let r=n.localName??n.importedName;if(r&&G(i,r,n.sourcePath),n.kind==="namespace")for(let o of n.usedMembers)G(i,o,n.sourcePath)}return i}function G(e,t,i){let n=e.get(t);n||(n=new Set,e.set(t,n)),n.add(i)}function Le(e,t){return C(e,t,i=>{let n=i?`AND m.symbol_id IN (${i.map(()=>"?").join(",")})`:"";return e.all(`SELECT
1
+ import{c as $}from"./chunk-5RGK4YA5.js";import{c as R}from"./chunk-EVXQF7DM.js";import{b as y}from"./chunk-RCJEFQOK.js";import{A as O,t as A,u as T}from"./chunk-BOVNTAKQ.js";import{c as L}from"./chunk-KJ6CW6EK.js";import{d,s as h,w as _}from"./chunk-4VYIZV3S.js";import{a as p,e as m,j as P}from"./chunk-5TT47UMX.js";import{a as S,b as k}from"./chunk-NHDPYW7O.js";var X=new Set(["identifier","type_identifier","field_identifier"]),q=new Set(["identifier"]),ee=new Set(["identifier","property_identifier","type_identifier"]),ne=new Set(["rust","python"]),te=/\{([^{}]*)\}/g,ie=/\b([A-Za-z_][\w]*)\b/g;function I(e,t,i,n={}){if(!i)return[];let r=p(e,t);if(!r)return[];if(r.indexOf(i)===-1)return[];if(m(t))return(D(e,t).get(i)??[]).filter(f=>!B(f,n));let o=T(e,t,r),s=new RegExp(`\\b${O(i)}\\b`),a=[];for(let c=0;c<o.length;c++)B(c,n)||s.test(o[c]??"")&&a.push(c);return a}function B(e,t){return typeof t.excludeStartLine=="number"&&typeof t.excludeEndLine=="number"&&e>=t.excludeStartLine&&e<=t.excludeEndLine}var x=S("file-identifiers");function H(e,t){return x.get(e,t,()=>new Set(D(e,t).keys()))}var N=S("file-ident-lines");function D(e,t){return N.get(e,t,()=>re(e,t))}var v=S("file-idents-by-line");function Se(e,t){return v.get(e,t,()=>{let i=D(e,t),n=0;for(let o of i.values()){let s=o[o.length-1];s!==void 0&&s>n&&(n=s)}let r=new Array(n+1);for(let o=0;o<=n;o+=1)r[o]=new Set;for(let[o,s]of i)for(let a of s)r[a].add(o);return r})}function ye(e){x.invalidateAll(e),N.invalidateAll(e),v.invalidateAll(e)}function he(e,t){x.invalidate(e,t),N.invalidate(e,t),v.invalidate(e,t)}function re(e,t){let i=new Map,n=(a,c)=>{let l=i.get(a);if(!l){i.set(a,[c]);return}l[l.length-1]!==c&&l.push(c)};if(m(t)){let a=P(e,t);if(a){let c=m(t),l=c==="rust"?X:c==="python"?q:ee,f=u=>{if(l.has(u.type)&&n(u.text,u.startPosition.row),c&&ne.has(c)&&u.type==="string_content"){let E=u.startPosition.row;for(let K of u.text.matchAll(te)){let V=K[1]??"";for(let F of V.matchAll(ie))F[1]&&n(F[1],E)}}for(let E of u.children)f(E)};return f(a.rootNode),i}}let r=p(e,t);if(!r)return i;let o=A(r).split(/\r?\n/),s=/\b([A-Za-z_$][\w$]*)\b/g;for(let a=0;a<o.length;a+=1){let c=o[a]??"";for(let l of c.matchAll(s))l[1]&&n(l[1],a)}return i}function j(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function g(e,t){return j(e)===j(t)}function J(e,t){let i=new Map;for(let n of y(e,t)){if(!n.sourcePath)continue;let r=n.localName??n.importedName;if(r&&G(i,r,n.sourcePath),n.kind==="namespace")for(let o of n.usedMembers)G(i,o,n.sourcePath)}return i}function G(e,t,i){let n=e.get(t);n||(n=new Set,e.set(t,n)),n.add(i)}function Le(e,t){return C(e,t,i=>{let n=i?`AND m.symbol_id IN (${i.map(()=>"?").join(",")})`:"";return e.all(`SELECT
2
2
  m.symbol_id,
3
3
  d.relative_path,
4
4
  COUNT(*) AS ref_count
@@ -37,4 +37,4 @@ import{c as $}from"./chunk-7O4MJYIW.js";import{c as R}from"./chunk-ZNUPGRPR.js";
37
37
  ) mention_doc ON mention_doc.symbol_id = gs.id
38
38
  WHERE 1 = 1
39
39
  ${e.symbolNoiseFor("gs")}`),i=new Map;for(let n of t){if(!n.relative_path||e.isIgnored(n.relative_path))continue;let r=d(n.symbol);if(!r)continue;let o=i.get(r);o||(o=[],i.set(r,o)),o.some(s=>s.symbolId===n.id)||o.push({symbol:n.symbol,symbolId:n.id,file:n.relative_path})}return i})}function Ae(e){U.invalidate(e)}function M(e,t,i){let n=w(e).get(i);if(!n||n.length===0)return[];if(n.length===1)return[b(n[0])];let r=n.filter(c=>c.file===t);if(r.length>0)return r.map(b);let o=J(e,t),s=o.get(i);if(s)for(let c of s){let l=n.filter(f=>g(c,f.file));if(l.length>0)return l.map(b)}let a=new Set;for(let c of o.values())for(let l of c)a.add(l);for(let c of a){let l=n.filter(f=>g(c,f.file));if(l.length>0&&l.length===n.length)return l.map(b)}return[]}function Ue(e,t,i){let n=M(e,t,i);if(n.length>0)return n;let r=w(e).get(i);return!r||r.length===0?[]:r.map(b)}function Z(e,t,i={}){let n=R(e,t);if(!n)return[];let r=d(n.symbol);if(!r)return[];if(i.semantic!==!1){let s=$(e,{...n,leaf:r,parentTypeName:null,isFunctionLike:!1,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null});if(s.length>0){let a=new Map;for(let c of s){let l=a.get(c.file)??[];l.push(c.line),a.set(c.file,l)}return W(e,a)}}let o=new Map;for(let s of L(e)){let a=p(e,s);if(!a||a.indexOf(r)===-1||s!==n.relativePath&&!M(e,s,r).some(f=>f.symbolId===n.symbolId))continue;let c=I(e,s,r,s===n.relativePath?{excludeStartLine:n.startLine,excludeEndLine:n.endLine}:{});c.length>0&&o.set(s,c)}return W(e,o)}function We(e,t){let i=new Map;for(let o of t){if(!o.leaf)continue;let s=i.get(o.leaf)??[];s.push(o),i.set(o.leaf,s)}if(i.size===0)return new Map;let n=new Set(t.map(o=>o.symbolId)),r=new Map;for(let o of L(e)){let s=H(e,o);if(s.size!==0){for(let a of s)if(i.has(a))for(let c of M(e,o,a)){if(!n.has(c.symbolId)||o===c.relativePath)continue;let l=r.get(c.symbolId);l||(l=new Set,r.set(c.symbolId,l)),l.add(o)}}}return r}function b(e){return{symbolId:e.symbolId,symbol:e.symbol,relativePath:e.file}}function W(e,t){let i=[],n=new Set;for(let[r,o]of t){let s=h(e,r);for(let a of o){let c=_(s,a),l=`${r}|${a}|${c?.symbol??""}`;n.has(l)||(n.add(l),i.push({file:r,line:a,enclosingSymbol:c?.symbol??null}))}}return i}function oe(e,t){let i=ue(e,t);return i?me(e,ce(e,i.match,i.identifier)):[]}function nn(e,t,i={}){return se(e,t,i).map(n=>({file:n.file,line:n.line,enclosingSymbol:n.enclosingSymbol}))}function se(e,t,i={}){let n=Z(e,t,{semantic:i.semantic}),r=n.length>0?Q(n,"source-attribution"):Q(oe(e,t),"scip-reference-chunk");return i.includeIgnored===!0?r:r.filter(o=>!e.isIgnored(o.file))}function Q(e,t){return e.map(i=>({...i,provenance:t}))}function ce(e,t,i){let n=new Map;for(let[r,o]of ae(e,t.symbolId))n.set(r,le(e,r,o,t,i));return n}function ae(e,t){let i=new Map;for(let n of Y(e,[t])){if(e.isIgnored(n.relative_path))continue;let r=i.get(n.relative_path);r||(r=[],i.set(n.relative_path,r)),r.push({start_line:n.chunk_start,end_line:n.chunk_end})}return i}function le(e,t,i,n,r){let o=t===n.relativePath?{excludeStartLine:n.startLine,excludeEndLine:n.endLine}:{},s=r?I(e,t,r,o):[];return i.flatMap(a=>fe(s,a))}function fe(e,t){let i=e.filter(n=>n>=t.start_line&&n<=t.end_line);return i.length>0?i:[t.start_line]}function ue(e,t){let i=R(e,t);return i?{match:i,identifier:d(i.symbol)||null}:null}function me(e,t){let i=[],n=new Set;for(let[r,o]of t){let s=h(e,r);for(let a of o){let c=_(s,a),l=`${r}|${a}|${c?.symbol??""}`;n.has(l)||(n.add(l),i.push({file:r,line:a,enclosingSymbol:c?.symbol??null}))}}return i}export{D as a,Se as b,ye as c,he as d,Le as e,xe as f,Y as g,g as h,Fe as i,ke as j,w as k,Ae as l,J as m,M as n,Ue as o,We as p,oe as q,nn as r};
40
- //# sourceMappingURL=chunk-JB4PUN5S.js.map
40
+ //# sourceMappingURL=chunk-4GPWGSOE.js.map
@@ -1,4 +1,4 @@
1
- import{b as l}from"./chunk-DFK54IRN.js";import{b as a}from"./chunk-QAEDNTY7.js";import{c as i,f as n}from"./chunk-7OX2O53H.js";function _(e,r){let t=l(e,r);return t.length===0?[]:m([...d(e,t),...c(e,t)]).filter(o=>!e.isIgnored(o.relative_path)).map(u)}function d(e,r){let t=r.map(()=>"?").join(", ");return e.all(`SELECT DISTINCT d1.relative_path, gs.symbol
1
+ import{b as l}from"./chunk-SDPP5KVQ.js";import{a}from"./chunk-NBUINPSH.js";import{c as i,f as n}from"./chunk-4VYIZV3S.js";function _(e,r){let t=l(e,r);return t.length===0?[]:m([...d(e,t),...c(e,t)]).filter(o=>!e.isIgnored(o.relative_path)).map(u)}function d(e,r){let t=r.map(()=>"?").join(", ");return e.all(`SELECT DISTINCT d1.relative_path, gs.symbol
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents d1 ON c.document_id = d1.id
@@ -26,4 +26,4 @@ import{b as l}from"./chunk-DFK54IRN.js";import{b as a}from"./chunk-QAEDNTY7.js";
26
26
  AND ${e.localSymbolPredicate}
27
27
  ${e.pathExclusionsFor("d1")}
28
28
  ORDER BY d1.relative_path`,...r,...r,...r)}function c(e,r){let t=new a(e);return r.flatMap(o=>t.definitionsForFile(o).filter(s=>n(s.symbol)).map(s=>({relative_path:o,symbol:s.symbol})))}function m(e){let r=new Set;return e.filter(t=>{let o=`${t.relative_path}|${t.symbol}`;return r.has(o)?!1:(r.add(o),!0)})}function u(e){return{consumer:e.relative_path,symbol:e.symbol,shortName:i(e.symbol)}}export{_ as a};
29
- //# sourceMappingURL=chunk-WODJHE6Z.js.map
29
+ //# sourceMappingURL=chunk-4LKJMRT5.js.map
@@ -1,6 +1,6 @@
1
- import{a as m}from"./chunk-DFK54IRN.js";import{a as h}from"./chunk-ZNUPGRPR.js";import{c as p}from"./chunk-7OX2O53H.js";import{readFileSync as f}from"fs";import{extname as y,join as d}from"path";function M(t,e,a={}){let{context:s=0}=a,r=L(e);if(r)return j(t,r.filePath,r.startLine,r.endLine,s);let l=h(t,e);return l?R(t,l,s):null}function L(t){let e=t.match(/^(.+\.\w+):(\d+)-(\d+)$/);return e?{filePath:e[1],startLine:parseInt(e[2],10),endLine:parseInt(e[3],10)}:null}function R(t,e,a){let s=t.get("SELECT language FROM documents WHERE relative_path = ?",e.relativePath),r=d(t.config.projectRoot,e.relativePath),l;try{l=f(r,"utf-8")}catch{return null}let n=l.split(`
1
+ import{a as m}from"./chunk-SDPP5KVQ.js";import{a as h}from"./chunk-EVXQF7DM.js";import{c as p}from"./chunk-4VYIZV3S.js";import{readFileSync as f}from"fs";import{extname as y,join as d}from"path";function M(t,e,a={}){let{context:s=0}=a,r=L(e);if(r)return j(t,r.filePath,r.startLine,r.endLine,s);let l=h(t,e);return l?R(t,l,s):null}function L(t){let e=t.match(/^(.+\.\w+):(\d+)-(\d+)$/);return e?{filePath:e[1],startLine:parseInt(e[2],10),endLine:parseInt(e[3],10)}:null}function R(t,e,a){let s=t.get("SELECT language FROM documents WHERE relative_path = ?",e.relativePath),r=d(t.config.projectRoot,e.relativePath),l;try{l=f(r,"utf-8")}catch{return null}let n=l.split(`
2
2
  `),c=Math.max(0,e.startLine-a),i=Math.min(n.length-1,e.endLine+a),u=n.slice(c,i+1).join(`
3
3
  `);return{symbol:e.symbol,shortName:p(e.symbol),relativePath:e.relativePath,startLine:c,endLine:i,language:s?.language??v(e.relativePath),source:u}}function j(t,e,a,s,r){let l=m(t,e);if(!l)return null;let n=t.get("SELECT relative_path, language FROM documents WHERE relative_path = ?",l);if(!n)return null;let c=d(t.config.projectRoot,n.relative_path),i;try{i=f(c,"utf-8")}catch{return null}let u=i.split(`
4
4
  `),o=Math.max(0,a-1-r),g=Math.min(u.length-1,s-1+r),b=u.slice(o,g+1).join(`
5
5
  `);return{symbol:`${n.relative_path}:${a}-${s}`,shortName:`${n.relative_path}:${a}-${s}`,relativePath:n.relative_path,startLine:o,endLine:g,language:n.language??v(n.relative_path),source:b}}function v(t){switch(y(t).toLowerCase()){case".ts":case".tsx":case".mts":case".cts":return"typescript";case".js":case".jsx":case".mjs":case".cjs":return"javascript";case".py":case".pyi":return"python";case".rs":return"rust";case".go":return"go";case".java":return"java";case".kt":case".kts":return"kotlin";case".scala":return"scala";case".rb":return"ruby";case".php":return"php";case".cs":return"csharp";case".vb":return"vb";case".dart":return"dart";case".c":case".h":return"c";case".cc":case".cpp":case".cxx":case".hpp":case".hh":case".hxx":return"cpp";case".vue":return"vue";default:return null}}export{M as a};
6
- //# sourceMappingURL=chunk-2IYEIFPP.js.map
6
+ //# sourceMappingURL=chunk-4T35WUCX.js.map
@@ -0,0 +1,62 @@
1
+ import{a as h,k as S}from"./chunk-5TT47UMX.js";import{a as y}from"./chunk-NHDPYW7O.js";import{a as x}from"./chunk-NN3O7TPH.js";var C={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function d(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let t=e.split(" ");if(t.length<4)return{scheme:t[0]??"",manager:t[1]??"",packageName:t[2]??"",version:"",descriptors:[],raw:e};let n=t[0],i=t[1],r=e.slice(n.length+1+i.length+1),s;if(r.startsWith("`")){let l=r.indexOf("`",1);l===-1?(s=r.slice(1),r=""):(s=r.slice(1,l),r=r.slice(l+2))}else{let l=r.indexOf(" ");l===-1?(s=r,r=""):(s=r.slice(0,l),r=r.slice(l+1))}let o,a=r.indexOf(" ");a===-1?(o=r,r=""):(o=r.slice(0,a),r=r.slice(a+1));let c=F(r);return{scheme:n,manager:i,packageName:s,version:o,descriptors:c,raw:e}}function m(e){let t=d(e);if("kind"in t)return null;for(let n=t.descriptors.length-2;n>=0;n--){let i=t.descriptors[n];if(i?.suffix==="type")return i.name}return null}function F(e){let t=[],n=0;for(;n<e.length;){if(e[n]==="["){let s=e.indexOf("]",n+1);if(s===-1){t.push({name:e.slice(n+1),suffix:"type-param"});break}t.push({name:e.slice(n+1,s),suffix:"type-param"}),n=s+1;continue}if(e[n]==="("&&(t.length===0||n===0||D(e[n-1]))){let s=e.indexOf(")",n+1);if(s!==-1&&e[s+1]!=="."){t.push({name:e.slice(n+1,s),suffix:"parameter"}),n=s+1;continue}}let i;if(e[n]==="`"){let s=e.indexOf("`",n+1);if(s===-1){i=e.slice(n+1),t.push({name:i,suffix:"term"});break}i=e.slice(n+1,s),n=s+1}else{let s=n;for(;n<e.length&&!D(e[n]);)n++;i=e.slice(s,n)}if(n>=e.length){i&&t.push({name:i,suffix:"term"});break}let r=e[n];if(r==="("){let s=e.indexOf(")",n+1);s!==-1&&e[s+1]==="."?(t.push({name:i,suffix:"method"}),n=s+2):s!==-1?(t.push({name:i,suffix:"method"}),n=s+1):(t.push({name:i,suffix:"term"}),n++)}else{let s=C[r];s&&t.push({name:i,suffix:s}),n+=1}}return t}function D(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function _(e){let t=d(e);if("kind"in t&&t.kind==="local")return`local:${t.id}`;let n=t;if(n.descriptors.length===0)return n.raw;let i=[];for(let r of n.descriptors){let s=w(r);s&&i.push(s)}return i.join(":")}function w(e){let t=e.suffix==="namespace"?A(e.name):e.name;return t?e.suffix==="method"?`${t}()`:t:""}function A(e){return e.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/,"").replace(/\.(py|pyi)$/,"").replace(/\.(rs)$/,"").replace(/\.(java|scala|kt|kts)$/,"").replace(/\.(rb)$/,"").replace(/\.(go)$/,"").replace(/\.(cs|vb)$/,"").replace(/\.(dart)$/,"").replace(/\.(php)$/,"").replace(/\.(c|cc|cpp|cxx|h|hpp)$/,"")}function L(e){let t=d(e);if("kind"in t&&t.kind==="local")return t.id;let n=t;return n.descriptors.length===0?"":n.descriptors[n.descriptors.length-1].name}function f(e){let t=d(e);if("kind"in t&&t.kind==="local")return null;let n=t;return n.descriptors[n.descriptors.length-1]?.suffix??null}function te(e){return e.endsWith("().")||f(e)==="method"}function I(e){let t=f(e);return t==="method"||t==="term"}function re(e){return f(e)==="namespace"}var T=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function ie(e){return T.test(e)}var Q=new Set(["test","tests","_tests"]);function se(e){let t=d(e);if("kind"in t)return!1;for(let n=0;n<t.descriptors.length-1;n+=1){let i=t.descriptors[n];if(i?.suffix==="namespace"&&i.name&&Q.has(i.name))return!0}return!1}function oe(e,t){let n=d(e),i=d(t);if("kind"in n||"kind"in i)return!1;let r=n.descriptors,s=i.descriptors;if(s.length!==r.length+1)return!1;for(let o=0;o<r.length;o++){let a=r[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function ae(e,t){let n=d(e),i=d(t);if("kind"in n||"kind"in i)return!1;let r=n.descriptors,s=i.descriptors;if(s.length<=r.length)return!1;for(let o=0;o<r.length;o++){let a=r[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function ce(e,t){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
+ FROM global_symbols gs
3
+ JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
4
+ JOIN documents d ON der.document_id = d.id
5
+ WHERE ${t.where}
6
+ ${e.pathExclusionsFor("d")}
7
+ ${M(t.orderBy)}
8
+ ${k(t.limit)}`,...t.params??[])}function ue(e,t){return e.all(`SELECT
9
+ gs.id,
10
+ gs.symbol,
11
+ c.document_id,
12
+ MIN(c.start_line) AS start_line,
13
+ MAX(c.end_line) AS end_line,
14
+ d.relative_path,
15
+ gs.display_name,
16
+ gs.documentation
17
+ FROM global_symbols gs
18
+ JOIN mentions m ON m.symbol_id = gs.id
19
+ JOIN chunks c ON m.chunk_id = c.id
20
+ JOIN documents d ON c.document_id = d.id
21
+ WHERE m.role = 1
22
+ AND ${t.where}
23
+ ${e.pathExclusionsFor("d")}
24
+ GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path, gs.display_name, gs.documentation
25
+ ${M(t.orderBy)}
26
+ ${k(t.limit)}`,...t.params??[])}function M(e){return e?`ORDER BY ${e}`:""}function k(e){return typeof e=="number"?`LIMIT ${e}`:""}function N(e){return!e||!e.trim()?null:e.replace(/^```\w*\s*/,"").replace(/\s*```$/,"").replace(/^\(method\)\s*/,"").replace(/^\(property\)\s*/,"").replace(/^\(function\)\s*/,"").replace(/^\(class\)\s*/,"").replace(/^\(interface\)\s*/,"").replace(/^\(enum\)\s*/,"").replace(/^\(type alias\)\s*/,"").replace(/^\(const\)\s*/,"").replace(/^\(var\)\s*/,"").trim()||null}function O(e){if(!e)return null;let t=R(e);if(t)return t.replace(/\n/g," ");let n=e.indexOf("|");if(n===-1)return e.replace(/\n/g," ");let i=e.slice(n+1);return(R(i)??i).replace(/\n/g," ")}function R(e){return/^```(?:\w+)?\s*\n?([\s\S]*?)\n?```/.exec(e.trimStart())?.[1]?.trim()||null}function P(e){if(m(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 $(e,t,n={}){let i=new Map;for(let s of t)e.length>0&&!P(s)||i.set(s.id,s);for(let s of e)i.set(s.id,s);let r=[...i.values()];return n.sort?r.sort((s,o)=>s.start_line-o.start_line||s.end_line-o.end_line||s.symbol.localeCompare(o.symbol)):r}var E=y("file-definitions");function De(e,t){E.invalidate(e,t)}function g(e,t){return E.get(e,t,()=>{let n=$(B(e,t),j(e,t),{sort:!0});return H(e,t,n.map(J))})}function B(e,t){return e.all(`SELECT
27
+ gs.id,
28
+ gs.symbol,
29
+ der.document_id,
30
+ der.start_line,
31
+ der.end_line,
32
+ d.relative_path,
33
+ gs.display_name,
34
+ gs.kind,
35
+ gs.documentation,
36
+ gs.enclosing_symbol
37
+ FROM global_symbols gs
38
+ JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
39
+ JOIN documents d ON der.document_id = d.id
40
+ WHERE d.relative_path = ?
41
+ ${e.symbolNoiseFor("gs")}
42
+ ORDER BY der.start_line, der.end_line`,t)}function j(e,t){return e.all(`SELECT
43
+ gs.id,
44
+ gs.symbol,
45
+ c.document_id,
46
+ MIN(c.start_line) AS start_line,
47
+ MAX(c.end_line) AS end_line,
48
+ d.relative_path,
49
+ gs.display_name,
50
+ gs.kind,
51
+ gs.documentation,
52
+ gs.enclosing_symbol
53
+ FROM global_symbols gs
54
+ JOIN mentions m ON m.symbol_id = gs.id
55
+ JOIN chunks c ON m.chunk_id = c.id
56
+ JOIN documents d ON c.document_id = d.id
57
+ WHERE d.relative_path = ?
58
+ AND m.role = 1
59
+ ${e.symbolNoiseFor("gs")}
60
+ GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
61
+ ORDER BY start_line, end_line`,t)}function J(e){return{symbolId:e.id,symbol:e.symbol,documentId:e.document_id,startLine:e.start_line,endLine:e.end_line,relativePath:e.relative_path,leaf:L(e.symbol),parentTypeName:m(e.symbol),isFunctionLike:I(e.symbol),isTypeLike:f(e.symbol)==="type",kind:e.kind??null,documentation:e.documentation??null,enclosingSymbol:e.enclosing_symbol??null}}function _e(e,t={}){return W(e,t.scope)}function W(e,t){return x(e,{scope:t,includeIgnored:!1}).flatMap(n=>g(e,n)).filter(n=>!e.isIgnored(n.relativePath))}function Le(e,t,n={}){if(t.length===0)return[];let i=t.flatMap(r=>g(e,r)).filter(r=>!e.isIgnored(r.relativePath));return n.onlyDocumented&&(i=i.filter(r=>r.documentation!==null&&r.documentation!=="")),n.sort&&(i=i.sort((r,s)=>r.relativePath.localeCompare(s.relativePath)||r.startLine-s.startLine||r.endLine-s.endLine)),i.map(r=>({startLine:r.startLine,endLine:r.endLine,symbol:r.symbol,shortName:_(r.symbol),signature:N(O(r.documentation)),relativePath:r.relativePath,enclosingSymbol:r.enclosingSymbol}))}function Ie(e,t){let n=null;for(let i of e)i.startLine>t||i.endLine<t||(!n||i.endLine-i.startLine<n.endLine-n.startLine)&&(n=i);return n}function Re(e,t){let n=g(e,t.relative_path).find(i=>i.symbolId===t.id);return n?{symbolId:n.symbolId,symbol:n.symbol,documentId:n.documentId,startLine:n.startLine,endLine:n.endLine,relativePath:n.relativePath}:{symbolId:t.id,symbol:t.symbol,documentId:t.document_id,startLine:t.start_line,endLine:t.end_line,relativePath:t.relative_path}}function H(e,t,n){let i=h(e,t),r=S(e,t);return r?G(n,r,i):i?z(n,i):n}function z(e,t){let n=t.split(/\r?\n/),i=U(e,n),r=Y(e,i),s=Z(r,n);return X(e,s)}function U(e,t){let n=e.some(r=>b(r.symbol))?q(t):null,i=new Map;for(let r of e)i.set(r.symbolId,V(t,n,r));return i}function Y(e,t){return e.filter(n=>b(n.symbol)).map(n=>({definition:n,startLine:t.get(n.symbolId)??n.startLine})).sort((n,i)=>n.startLine-i.startLine||n.definition.startLine-i.definition.startLine||n.definition.symbol.localeCompare(i.definition.symbol))}function Z(e,t){let n=new Map;for(let i=0;i<e.length;i+=1){let r=e[i],s=e[i+1],o=s?Math.max(r.startLine,s.startLine-1):t.length-1;n.set(r.definition.symbolId,{startLine:r.startLine,endLine:ee(t,r.definition,r.startLine,o)})}return n}function X(e,t){return e.map(n=>{let i=t.get(n.symbolId);return i?{...n,startLine:i.startLine,endLine:i.endLine}:n})}function G(e,t,n=null){let i=new Map;for(let r of t){let s=i.get(r.name);s?s.push(r):i.set(r.name,[r])}return e.map(r=>{if(!K(r)||!r.leaf)return v(r,n);let s=i.get(r.leaf);if(!s||s.length===0)return v(r,n);let o=s[0],a=Math.abs(o.startLine-r.startLine);for(let c=1;c<s.length;c+=1){let l=s[c],u=Math.abs(l.startLine-r.startLine);u<a&&(o=l,a=u)}return{...r,startLine:o.startLine,endLine:o.endLine}})}function K(e){return b(e.symbol)?!0:f(e.symbol)==="term"&&m(e.symbol)===null}function v(e,t){if(!t||!e.leaf||f(e.symbol)!=="term"||m(e.symbol)!==null)return e;let n=e.leaf.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`\\b(?:export\\s+)?(?:const|let|var)\\s+${n}\\b`),s=t.split(/\r?\n/).findIndex(o=>i.test(o));return s>=0?{...e,startLine:s,endLine:s}:e}function V(e,t,n){if(!b(n.symbol))return n.startLine;let i=Math.max(0,Math.min(n.startLine,e.length-1));if(!t)return i;let r=t.get(n.leaf);if(!r||r.length===0)return i;let s=null;for(let o of r){let a=Math.abs(o-n.startLine);(!s||a<s.distance)&&(s={line:o,distance:a})}return s?.line??i}function q(e){let t=/\b(?:function|def|fn)\s+([A-Za-z_$][\w$]*)/g,n=/\b([A-Za-z_$][\w$]*)\s*[:=]\s*(?:async\s*)?(?:function\b|\()/g,i=/^\s*(?:(?:export|public|private|protected|static|readonly|async|abstract|get|set)\s+)*([A-Za-z_$][\w$]*)\s*(?:<[^(]*>)?\s*\(/,r=/\b([A-Za-z_$][\w$]*)\s*\(/g,s=new Map,o=(a,c)=>{let l=s.get(a);if(!l){s.set(a,[c]);return}l[l.length-1]!==c&&l.push(c)};for(let a=0;a<e.length;a+=1){let c=e[a]??"";for(let u of c.matchAll(t))u[1]&&o(u[1],a);for(let u of c.matchAll(n))u[1]&&o(u[1],a);let l=c.match(i);l?.[1]&&o(l[1],a);for(let u of c.matchAll(r))u[1]&&o(u[1],a)}return s}function ee(e,t,n,i){let r=Math.max(n,Math.min(e.length-1,i)),s=Math.max(n,Math.min(r,t.endLine)),o=0,a=0,c=!1;for(let l=n;l<=r;l+=1){let u=ne(e[l]??"");for(let p of u)p==="{"?(o+=1,c=!0):p==="}"?o=Math.max(0,o-1):p==="("?a+=1:p===")"&&(a=Math.max(0,a-1));if(c&&o===0||!c&&a===0&&l>=s)return l}return s}function ne(e){let t="",n=null,i=!1;for(let r=0;r<e.length;r+=1){let s=e[r],o=e[r+1];if(!n&&s==="/"&&o==="/"){t+=" ".repeat(e.length-r);break}if(n){if(i){i=!1,t+=" ";continue}if(s==="\\"){i=!0,t+=" ";continue}s===n&&(n=null),t+=" ";continue}if(s==='"'||s==="'"||s==="`"){n=s,t+=" ";continue}t+=s}return t}function b(e){return e.includes("().")}function Me(e){let t=d(e);if("kind"in t)return[];let n=[];for(let i=t.descriptors.length-2;i>=0;i-=1){let r=t.descriptors[i];r?.suffix==="type"&&r.name&&n.push(r.name)}return n}export{d as a,m as b,_ as c,L as d,f as e,te as f,I as g,re as h,ie as i,se as j,oe as k,ae as l,ce as m,ue as n,N as o,O as p,$ as q,De as r,g as s,_e as t,W as u,Le as v,Ie as w,Re as x,Me as y};
62
+ //# sourceMappingURL=chunk-4VYIZV3S.js.map
@@ -1,4 +1,4 @@
1
- import{l as T}from"./chunk-BOVNTAKQ.js";import{d as N,s as k}from"./chunk-7OX2O53H.js";import{a as x}from"./chunk-NN3O7TPH.js";function p(i,e,t){if(i.has(e))return i.get(e);let n=t();return i.set(e,n),n}import _ from"path";function oe(i,e){return i.getReferences().map(t=>{let n=t.getNode();return $(n,e)})}function se(i){let e=i;return typeof e.findReferences=="function"?e.findReferences():[]}function U(i,e,t,n){let r=[];for(let o of se(i))for(let s of oe(o,n))s.file===e.relativePath&&s.line>=e.startLine&&s.line<=e.endLine||r.push(s);for(let o of t)r.push(o);return E(r)}function W(i,e,t,n){let r=[],o=t?.getStart();for(let s of i.getReferences()){let a=s.getNode();y(n,a.getSourceFile().getFilePath())===e&&(o!==void 0&&a.getStart()===o||r.push({location:$(a,n),node:a}))}return r}function $(i,e){let t=i.getSourceFile(),n=t.getLineAndColumnAtPos(i.getStart());return{file:y(e,t.getFilePath())??t.getBaseName(),line:n.line-1,column:n.column-1}}function B(i,e,t){let n=i.getSourceFile(),r=g(n,i),o=i.getText(),s=new RegExp(`\\b${ae(o)}\\b`,"g"),a=n.getFullText().split(`
1
+ import{l as T}from"./chunk-BOVNTAKQ.js";import{d as N,s as k}from"./chunk-4VYIZV3S.js";import{a as x}from"./chunk-NN3O7TPH.js";function p(i,e,t){if(i.has(e))return i.get(e);let n=t();return i.set(e,n),n}import _ from"path";function oe(i,e){return i.getReferences().map(t=>{let n=t.getNode();return $(n,e)})}function se(i){let e=i;return typeof e.findReferences=="function"?e.findReferences():[]}function U(i,e,t,n){let r=[];for(let o of se(i))for(let s of oe(o,n))s.file===e.relativePath&&s.line>=e.startLine&&s.line<=e.endLine||r.push(s);for(let o of t)r.push(o);return E(r)}function W(i,e,t,n){let r=[],o=t?.getStart();for(let s of i.getReferences()){let a=s.getNode();y(n,a.getSourceFile().getFilePath())===e&&(o!==void 0&&a.getStart()===o||r.push({location:$(a,n),node:a}))}return r}function $(i,e){let t=i.getSourceFile(),n=t.getLineAndColumnAtPos(i.getStart());return{file:y(e,t.getFilePath())??t.getBaseName(),line:n.line-1,column:n.column-1}}function B(i,e,t){let n=i.getSourceFile(),r=g(n,i),o=i.getText(),s=new RegExp(`\\b${ae(o)}\\b`,"g"),a=n.getFullText().split(`
2
2
  `),l=[];for(let c=0;c<a.length;c++){if(c===r)continue;let f=a[c]??"";s.lastIndex=0;let u;for(;(u=s.exec(f))!==null;)l.push({file:e,line:c,column:u.index})}return E(l.filter(c=>y(t,_.join(t,c.file))===e))}function P(i){for(let e=i;e;e=e.getParent()){let t=e.getKindName();if(t.includes("Type")||t==="InterfaceDeclaration"||t==="TypeAliasDeclaration")return!0;if(t==="CallExpression"||t==="NewExpression"||t==="ExpressionStatement")return!1}return!1}function g(i,e){return i.getLineAndColumnAtPos(e.getStart()).line-1}function E(i){let e=new Set,t=[];for(let n of i){let r=`${n.file}:${n.line}:${n.column}`;e.has(r)||(e.add(r),t.push(n))}return t}function y(i,e){let t=_.relative(i||process.cwd(),e).replace(/\\/g,"/");return!t||t.startsWith("..")?null:t}function ae(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function H(i,e,t,n){let r=ce(e,n);return r.size===0?new Map:le(i,t,r)}function ce(i,e){let t=new Map;for(let n of k(i,e)){let r=N(n.symbol)??n.leaf;if(!r)continue;let o=t.get(r);o||(o=[],t.set(r,o)),o.push(n)}return t}function le(i,e,t){let n=new Map,r=new Map;return e.forEachDescendant(o=>{for(let s of de(i,o)){let a=t.get(s);if(!a)continue;let l=g(e,o);for(let c of a){if(l<c.startLine-1||l>c.endLine+1)continue;let f=Math.abs(l-c.startLine),u=r.get(c.symbolId);u!==void 0&&u<=f||(r.set(c.symbolId,f),n.set(c.symbolId,o))}}}),n}function de(i,e){let t=[],n=r=>{r&&!t.includes(r)&&t.push(r)};if("getNameNode"in e&&typeof e.getNameNode=="function"){let r=e.getNameNode();n(r?.getText())}if("getName"in e&&typeof e.getName=="function"){let r=e.getName();n(r)}return i.Node.isIdentifier(e)&&n(e.getText()),t}function J(i,e,t,n){return i.all(`SELECT
3
3
  gs.id AS symbolId,
4
4
  gs.symbol,
@@ -60,4 +60,4 @@ import{l as T}from"./chunk-BOVNTAKQ.js";import{d as N,s as k}from"./chunk-7OX2O5
60
60
  AND m.role = 1
61
61
  GROUP BY gs.id, gs.symbol, d.id, d.relative_path, gs.display_name, gs.kind, gs.documentation, gs.enclosing_symbol
62
62
  ORDER BY startLine, endLine`,e,e),n=new Set,r=new Map;for(let o of t){if(n.has(o.symbolId))continue;n.add(o.symbolId);let s=o.leaf||N(o.symbol);!s||r.has(s)||r.set(s,{...o,leaf:s})}return r}import pe from"path";var S=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"];function D(i){let e=i.toLowerCase();return S.some(t=>e.endsWith(t))}function K(i,e){let t=new Map,n=r=>D(r)?p(t,r,()=>{let o=pe.join(i.config.projectRoot,r);for(let{project:s}of e){let a=s.getSourceFile(o)??s.addSourceFileAtPathIfExists(o)??null;if(a)return{project:s,sourceFile:a}}return null}):null;return{sourceFile:r=>n(r)?.sourceFile??null,sourceFileMatch:n,indexedTypeScriptLikeDocuments:()=>x(i,{extensions:S})}}import m from"path";import{existsSync as M,readdirSync as fe,readFileSync as z}from"fs";function Y(i){let e=m.join(i,"package.json");if(!M(e))return[];let t;try{t=JSON.parse(z(e,"utf8"))}catch{return[]}return(Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[]).flatMap(r=>ue(i,r)).flatMap(r=>me(i,r))}function ue(i,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=m.join(i,e);return M(m.join(s,"package.json"))?[s]:[]}let t=e.indexOf("*"),n=e.slice(0,t).replace(/\/$/,""),r=e.slice(t+1).replace(/^\//,""),o=m.join(i,n||".");if(!M(o))return[];try{return fe(o).map(s=>m.join(o,s,r)).filter(s=>M(m.join(s,"package.json")))}catch{return[]}}function me(i,e){try{let t=JSON.parse(z(m.join(e,"package.json"),"utf8"));if(!t.name)return[];let n=m.relative(i,e).replace(/\\/g,"/");return[{name:t.name,rootRelative:n,sourceRootRelative:`${n}/src`}]}catch{return[]}}function X(i,e){for(let t of i)if(e===t.name||e.startsWith(`${t.name}/`))return t.name;return null}function q(i){return[`${i.sourceRootRelative}/index.ts`,`${i.sourceRootRelative}/index.tsx`,`${i.sourceRootRelative}/index.mts`,`${i.sourceRootRelative}/index.cts`]}import{existsSync as h,readFileSync as ge,readdirSync as ye,statSync as Se}from"fs";import d from"path";var R=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function C(i,e){let n=e?d.dirname(d.join(i,e)):i,r=d.resolve(i);for(;n.startsWith(r);){for(let s of R){let a=d.join(n,s);if(h(a))return a}let o=d.dirname(n);if(o===n)break;n=o}for(let o of R){let s=d.join(i,o);if(h(s))return s}return null}function G(i){let e=i.config.projectRoot,t=new Set(he(e,i.config.semantic?.typescript?.tsconfigs)),n=x(i,{includeIgnored:!1,extensions:S});for(let r of n){let o=C(e,r);o&&t.add(d.resolve(o))}if(t.size===0){let r=C(e);r&&t.add(d.resolve(r))}return[...t].filter(r=>!Q(e,r)).sort((r,o)=>r.localeCompare(o))}function he(i,e=[]){let t=new Set;for(let n of e){let r=d.isAbsolute(n)?n:d.join(i,n);h(r)&&t.add(d.resolve(r))}for(let n of be(i))for(let r of R){let o=d.join(n,r);h(o)&&t.add(d.resolve(o))}if(t.size===0){let n=C(i);n&&t.add(d.resolve(n))}return[...t].filter(n=>!Q(i,n)).sort((n,r)=>n.localeCompare(r))}function be(i){let e=d.join(i,"package.json");if(!h(e))return[];let t;try{t=JSON.parse(ge(e,"utf8"))}catch{return[]}return(Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[]).flatMap(r=>Ie(i,r))}function Ie(i,e){if(!e||e.startsWith("!")||e.includes("node_modules"))return[];if(!e.includes("*")){let s=d.join(i,e);return L(s)?[s]:[]}let t=e.indexOf("*"),n=e.slice(0,t).replace(/\/$/,""),r=e.slice(t+1).replace(/^\//,""),o=d.join(i,n||".");return L(o)?ye(o).map(s=>d.join(o,s,r)).filter(L):[]}function L(i){try{return Se(i).isDirectory()}catch{return!1}}function Q(i,e){let t=d.relative(i,e).replace(/\\/g,"/");return t.startsWith("..")||t.includes("/node_modules/")||t.startsWith("node_modules/")||t.includes("/dist/")||t.startsWith("dist/")}import{createRequire as xe}from"module";var Ne=xe(import.meta.url),b;function Z(){if(b!==void 0)return b;try{b=Ne("ts-morph")}catch{b=null}return b}function ee(i,e){return e.map(t=>({tsconfigPath:t,project:new i.Project({tsConfigFilePath:t,skipFileDependencyResolution:!1})}))}function F(i,e,t){return{language:"typescript",availability:()=>({available:!1,reason:i,tsconfigPath:e,tsconfigPaths:t}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}function ie(i,e){let t=Z();if(!t)return F("ts-morph is not installed");let n=G(i);if(n.length===0)return F("no tsconfig found");try{let r=ee(t,n);return new A(i,t,r)}catch(r){return F(r instanceof Error?r.message:String(r),n[0],n)}}var A=class{constructor(e,t,n){this.db=e;this.tsMorph=t;this.projects=n;this.workspacePackages=Y(e.config.projectRoot),this.sourceFiles=K(e,n)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;definitionNodeCache=new Map;fileDefinitionNodeCache=new Map;indexedDefinitionLeafCache=new Map;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;sourceFiles;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(e=>e.tsconfigPath)}}importUsage(e){return p(this.importUsageCache,e,()=>{let t=this.sourceFiles.sourceFile(e);if(!t)return[];let n=[];for(let r of t.getImportDeclarations())for(let o of this.importUsageForDeclaration(e,r))n.push(o);return n})}referencesFor(e){return p(this.referencesCache,e.symbolId,()=>{let t=this.nodeForDefinition(e),n=this.packageImportReferencesForDefinition(e);return t?U(t,e,n,this.db.config.projectRoot):n})}calleesFor(e){return p(this.calleesCache,e.symbolId,()=>p(this.fileCalleesCache,e.relativePath,()=>this.calleeMapForFile(e.relativePath)).get(e.symbolId)??[])}signatureFor(e){return p(this.signatureCache,e.symbolId,()=>{let t=this.nodeForDefinition(e);if(!t||!this.tsMorph.Node.isFunctionDeclaration(t)&&!this.tsMorph.Node.isMethodDeclaration(t)&&!this.tsMorph.Node.isArrowFunction(t)&&!this.tsMorph.Node.isFunctionExpression(t)&&!this.tsMorph.Node.isConstructorDeclaration(t))return null;let n=t.getType().getCallSignatures()[0];if(!n)return null;let r=n.getParameters().map(s=>{let a=s.getDeclarations()[0],l=a?s.getTypeAtLocation(a).getText(a):s.getValueDeclaration()?.getType().getText()??"unknown";return ne(l)}),o=n.getReturnType().getText(t);return`(${r.join(",")})=>${ne(o)}`})}importUsageForDeclaration(e,t){let n=T(this.db,e,t.getModuleSpecifierValue()),r=te(t);return t.getImportClause()?.isTypeOnly()?r.map(o=>ke(e,n,o)):r.map(o=>this.valueImportUsageForEntry(e,n,o))}valueImportUsageForEntry(e,t,n){let r=n.identifier?n.identifier.findReferences():[],o=[];for(let c of r)for(let f of W(c,e,n.identifier,this.db.config.projectRoot))o.push(f);let s=o.some(c=>!P(c.node)),a=o.some(c=>P(c.node)),l=n.isTypeOnly;return{importer:e,sourcePath:t,importedName:n.importedName,localName:n.localName,kind:n.kind,isTypeOnly:l,isUsed:l||o.length>0,isTypeUsed:l||a,isValueUsed:s,references:o.map(c=>c.location)}}packageImportReferencesForDefinition(e){return this.packageImportReferences().get(e.symbolId)??[]}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let e=new Map,t=this.packageExports();for(let n of this.sourceFiles.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(e,t,n);for(let[n,r]of e)e.set(n,E(r));return this.packageImportReferenceIndex=e,e}addPackageImportReferencesForDocument(e,t,n){if(this.db.isIgnored(n))return;let r=this.sourceFiles.sourceFileMatch(n);if(r)for(let o of r.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(e,t,n,o)}addPackageImportReferencesForDeclaration(e,t,n,r){let o=X(this.workspacePackages,r.getModuleSpecifierValue());if(!o)return;let s=t.get(o);if(s)for(let a of te(r)){if(a.kind!=="named"||!a.identifier)continue;let l=s.get(a.importedName);if(!l||l.size===0)continue;let c=B(a.identifier,n,this.db.config.projectRoot);c.length>0&&Me(e,l,c)}}packageExports(){if(this.packageExportIndex)return this.packageExportIndex;let e=new Map;for(let t of this.workspacePackages){let n=new Map;for(let r of q(t))this.collectPackageExports(t,r,n,new Set);n.size>0&&e.set(t.name,n)}return this.packageExportIndex=e,e}collectPackageExports(e,t,n,r){if(r.has(t))return;r.add(t);let o=this.sourceFiles.sourceFile(t);if(o)for(let s of o.getExportDeclarations()){let a=s.getModuleSpecifierValue(),l=a?T(this.db,t,a):t;if(!l||!l.startsWith(`${e.sourceRootRelative}/`))continue;let c=s.getNamedExports();if(c.length===0){if(s.isNamespaceExport())continue;this.collectPackageExports(e,l,n,r);continue}for(let f of c){let u=f.getNameNode().getText(),w=f.getAliasNode()?.getText()??u,O=this.indexedDefinitionByLeaf(l,u);if(!O)continue;let I=n.get(w);I||(I=new Set,n.set(w,I)),I.add(O.symbolId)}}}indexedDefinitionByLeaf(e,t){return p(this.indexedDefinitionLeafCache,e,()=>V(this.db,e)).get(t)??null}nodeForDefinition(e){return p(this.definitionNodeCache,e.symbolId,()=>this.definitionNodesForFile(e.relativePath).get(e.symbolId)??null)}definitionNodesForFile(e){return p(this.fileDefinitionNodeCache,e,()=>{let t=this.sourceFiles.sourceFile(e);return t?H(this.tsMorph,this.db,t,e):new Map})}definitionFromSymbol(e){let t=e.getDeclarations();for(let n of t){let r=n.getSourceFile(),o=y(this.db.config.projectRoot,r.getFilePath());if(!o||this.db.isIgnored(o))continue;let s=g(r,n),a=J(this.db,o,s,e.getName());if(a)return{symbol:a.symbol,file:a.relativePath,line:a.startLine}}return null}calleeMapForFile(e){let t=this.sourceFiles.sourceFile(e);if(!t)return new Map;let n=k(this.db,e).sort((o,s)=>o.startLine-s.startLine||s.endLine-o.endLine);if(n.length===0)return new Map;let r=new Map;t.forEachDescendant(o=>{if(!this.tsMorph.Node.isCallExpression(o)&&!this.tsMorph.Node.isNewExpression(o))return;let s=this.semanticCalleeForCallNode(t,n,o);s&&Ee(r,s.callerId,s.target)});for(let[o,s]of r)r.set(o,Fe(s));return r}semanticCalleeForCallNode(e,t,n){let r=De(t,g(e,n));if(!r)return null;let o=n.getExpression(),s=o.getSymbol()??o.getType().getSymbol(),a=s?this.definitionFromSymbol(s):null;return a?{callerId:r.symbolId,target:{symbol:a.symbol,file:a.file,line:a.line}}:null}};function te(i){let e=[],t=i.getDefaultImport();t&&e.push({identifier:t,importedName:"default",localName:t.getText(),kind:"default",isTypeOnly:i.getImportClause()?.isTypeOnly()??!1});let n=i.getNamespaceImport();n&&e.push({identifier:n,importedName:"*",localName:n.getText(),kind:"namespace",isTypeOnly:i.getImportClause()?.isTypeOnly()??!1});for(let r of i.getNamedImports()){let o=r.getNameNode(),a=r.getAliasNode()??(o.getKindName()==="Identifier"?o:null);e.push({identifier:a,importedName:o.getText(),localName:a?.getText()??o.getText(),kind:"named",isTypeOnly:r.isTypeOnly()||(i.getImportClause()?.isTypeOnly()??!1)})}return e.length===0&&e.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),e}function ke(i,e,t){return{importer:i,sourcePath:e,importedName:t.importedName,localName:t.localName,kind:t.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function Ee(i,e,t){let n=i.get(e);n||(n=[],i.set(e,n)),n.push(t)}function De(i,e){let t=null;for(let n of i)e<n.startLine||e>n.endLine||(!t||n.startLine>=t.startLine)&&(t=n);return t}function Me(i,e,t){for(let n of e){let r=i.get(n)??[];r.push(...t),i.set(n,r)}}function Fe(i){let e=new Set,t=[];for(let n of i){let r=`${n.symbol}|${n.file}|${n.line}`;e.has(r)||(e.add(r),t.push(n))}return t}function ne(i){return i.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}var j=new WeakMap;function re(i,e){let t=`${i.config.projectRoot}:typescript-workspace`,n=j.get(i);n||(n=new Map,j.set(i,n));let r=n.get(t);if(r)return r;let o=ie(i,e);return n.set(t,o),o}function ft(i){j.delete(i)}function yt(i,e){let t=v(i,e);return t?t.importUsage(e):[]}function ve(i,e){let t=v(i,e.relativePath);return t?t.referencesFor(e):[]}function St(i,e){let t=new Map;for(let n of e)for(let r of ve(i,n)){if(r.file===n.relativePath||i.isIgnored(r.file))continue;let o=t.get(n.symbolId);o||(o=new Set,t.set(n.symbolId,o)),o.add(r.file)}return t}function ht(i,e){let t=new Map;for(let n of e){let r=v(i,n.relativePath);if(!r)continue;let o=r.calleesFor(n);o.length>0&&t.set(n.symbolId,o)}return t}function bt(i,e){let t=v(i,e.relativePath);return t?t.signatureFor(e):null}function v(i,e){if(!D(e))return null;let t=re(i,e);return t.availability().available?t:null}export{ft as a,yt as b,ve as c,St as d,ht as e,bt as f};
63
- //# sourceMappingURL=chunk-7O4MJYIW.js.map
63
+ //# sourceMappingURL=chunk-5RGK4YA5.js.map
@@ -1,2 +1,2 @@
1
- import{a as g}from"./chunk-ARBZM2NF.js";import{a as u}from"./chunk-ZNUPGRPR.js";import{c as i}from"./chunk-7OX2O53H.js";function w(r,b,y,f={}){let s=u(r,b),n=u(r,y);if(!s||!n)return null;let c=new Set(g(r,s,{semantic:f.semantic}).map(e=>e.symbol)),m=new Set(g(r,n,{semantic:f.semantic}).map(e=>e.symbol)),l=[];for(let e of c)m.has(e)&&l.push(e);let o=[];for(let e of c)m.has(e)||o.push(e);let a=[];for(let e of m)c.has(e)||a.push(e);let h=new Set([...c,...m]),d=h.size>0?l.length/h.size:0,t;h.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.":o.length===0&&a.length===0?t="These functions have identical tracked callee sets. They are a strong structural match, but identical callees do not prove interchangeable semantics; inspect signatures, control flow, and return values before consolidating.":o.length===0?t="A's tracked callees are a subset of B's. B may subsume part of A's structure, but verify signatures, guards, and non-call logic before replacing A with B.":a.length===0?t="B's tracked callees are a subset of A's. A may subsume part of B's structure, but verify signatures, guards, and non-call logic before replacing B with A.":o.length<=2&&a.length<=2?t=`Create a shared function with the ${l.length} common callees. Pass the ${o.length+a.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 (${o.length} callees in A, ${a.length} in B).`;let p=s.endLine-s.startLine+1,A=n.endLine-n.startLine+1;return{symbolA:{symbol:s.symbol,shortName:i(s.symbol),file:s.relativePath,loc:p},symbolB:{symbol:n.symbol,shortName:i(n.symbol),file:n.relativePath,loc:A},similarity:d,sharedCallees:l.map(i),uniqueToA:o.map(i),uniqueToB:a.map(i),consolidationStrategy:t}}export{w as a};
2
- //# sourceMappingURL=chunk-KJ3ZJIE5.js.map
1
+ import{a as g}from"./chunk-YH6TTQEI.js";import{a as u}from"./chunk-EVXQF7DM.js";import{c as i}from"./chunk-4VYIZV3S.js";function w(r,b,y,f={}){let s=u(r,b),n=u(r,y);if(!s||!n)return null;let c=new Set(g(r,s,{semantic:f.semantic}).map(e=>e.symbol)),m=new Set(g(r,n,{semantic:f.semantic}).map(e=>e.symbol)),l=[];for(let e of c)m.has(e)&&l.push(e);let o=[];for(let e of c)m.has(e)||o.push(e);let a=[];for(let e of m)c.has(e)||a.push(e);let h=new Set([...c,...m]),d=h.size>0?l.length/h.size:0,t;h.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.":o.length===0&&a.length===0?t="These functions have identical tracked callee sets. They are a strong structural match, but identical callees do not prove interchangeable semantics; inspect signatures, control flow, and return values before consolidating.":o.length===0?t="A's tracked callees are a subset of B's. B may subsume part of A's structure, but verify signatures, guards, and non-call logic before replacing A with B.":a.length===0?t="B's tracked callees are a subset of A's. A may subsume part of B's structure, but verify signatures, guards, and non-call logic before replacing B with A.":o.length<=2&&a.length<=2?t=`Create a shared function with the ${l.length} common callees. Pass the ${o.length+a.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 (${o.length} callees in A, ${a.length} in B).`;let p=s.endLine-s.startLine+1,A=n.endLine-n.startLine+1;return{symbolA:{symbol:s.symbol,shortName:i(s.symbol),file:s.relativePath,loc:p},symbolB:{symbol:n.symbol,shortName:i(n.symbol),file:n.relativePath,loc:A},similarity:d,sharedCallees:l.map(i),uniqueToA:o.map(i),uniqueToB:a.map(i),consolidationStrategy:t}}export{w as a};
2
+ //# sourceMappingURL=chunk-5TB4N27G.js.map
@@ -1,4 +1,4 @@
1
- import{b as _}from"./chunk-QAEDNTY7.js";import{c as u}from"./chunk-NKJKI6SE.js";import{b as l,c as d}from"./chunk-RCJEFQOK.js";import{c as a,e as m}from"./chunk-7OX2O53H.js";import{a as s}from"./chunk-NN3O7TPH.js";function A(e,o={}){let{scope:n,limit:r}=o,t=new _(e),i=h([...b(e,n),...g(e,t,n)]);return y(i),r?i.slice(0,r):i}function b(e,o){let n=[];for(let r of f(e,o)){if(e.isIgnored(r.barrel_path)||e.isIgnored(r.original_path)||u(e,r.barrel_path))continue;let t=R(e,r),i=t?.barrel_consumers??0,c=t?.direct_consumers??0;i!==0||c!==0||n.push({barrelFile:r.barrel_path,symbol:r.symbol,shortName:a(r.symbol),originalFile:r.original_path,barrelConsumers:i,directConsumers:c})}return n}function f(e,o){let n=o?`AND barrel_d.relative_path LIKE '%${o}%'`:"";return e.all(`SELECT DISTINCT
1
+ import{a as _}from"./chunk-NBUINPSH.js";import{c as u}from"./chunk-NKJKI6SE.js";import{b as l,c as d}from"./chunk-RCJEFQOK.js";import{c as a,e as m}from"./chunk-4VYIZV3S.js";import{a as s}from"./chunk-NN3O7TPH.js";function A(e,o={}){let{scope:n,limit:r}=o,t=new _(e),i=h([...b(e,n),...g(e,t,n)]);return y(i),r?i.slice(0,r):i}function b(e,o){let n=[];for(let r of f(e,o)){if(e.isIgnored(r.barrel_path)||e.isIgnored(r.original_path)||u(e,r.barrel_path))continue;let t=R(e,r),i=t?.barrel_consumers??0,c=t?.direct_consumers??0;i!==0||c!==0||n.push({barrelFile:r.barrel_path,symbol:r.symbol,shortName:a(r.symbol),originalFile:r.original_path,barrelConsumers:i,directConsumers:c})}return n}function f(e,o){let n=o?`AND barrel_d.relative_path LIKE '%${o}%'`:"";return e.all(`SELECT DISTINCT
2
2
  barrel_d.id AS barrel_doc_id,
3
3
  barrel_d.relative_path AS barrel_path,
4
4
  gs.id AS symbol_id,
@@ -58,4 +58,4 @@ import{b as _}from"./chunk-QAEDNTY7.js";import{c as u}from"./chunk-NKJKI6SE.js";
58
58
  ${e.pathExclusionsFor("consumer_d")}
59
59
  GROUP BY consumer_d.id
60
60
  )`,o.barrel_doc_id,o.symbol_id,o.barrel_doc_id,o.original_doc_id)}function g(e,o,n){let r=[];for(let t of E(e,n))p(e,t,t)>0||r.push(...S(e,o,t));return r}function E(e,o){return s(e,{scope:o,includeIgnored:!1}).filter(n=>d(e,n).length>0)}function S(e,o,n){return d(e,n).filter(r=>r.sourcePath&&!e.isIgnored(r.sourcePath)).flatMap(r=>x(e,o,n,r.sourcePath))}function x(e,o,n,r){let t=N(o,r);return t?[{barrelFile:n,symbol:t.symbol,shortName:a(t.symbol),originalFile:r,barrelConsumers:0,directConsumers:p(e,r,n)}]:[]}function p(e,o,n){let r=new Set;for(let t of s(e,{includeIgnored:!1}))if(t!==n)for(let i of l(e,t))i.sourcePath===o&&r.add(t);return r.size}function N(e,o){let n=e.definitionsForFile(o);return n.find(r=>m(r.symbol)==="method")??n[0]??null}function h(e){let o=new Set,n=[];for(let r of e){let t=`${r.barrelFile}|${r.symbol}|${r.originalFile}`;o.has(t)||(o.add(t),n.push(r))}return n}function y(e){e.sort((o,n)=>n.directConsumers-o.directConsumers||o.barrelFile.localeCompare(n.barrelFile)||o.shortName.localeCompare(n.shortName))}export{A as a};
61
- //# sourceMappingURL=chunk-ROOHENEP.js.map
61
+ //# sourceMappingURL=chunk-6QC7SCKV.js.map
@@ -1,4 +1,4 @@
1
- import we from"better-sqlite3";import{existsSync as Lt,readFileSync as It,writeFileSync as Ft}from"fs";import{dirname as Et,join as wt,resolve as Oe}from"path";import Q from"better-sqlite3";import{execFileSync as Z}from"child_process";import{existsSync as ee,readdirSync as te,readFileSync as ne}from"fs";import{extname as m,join as I}from"path";import G from"ignore";import{readFileSync as U,existsSync as b}from"fs";import{dirname as h,isAbsolute as V,join as S,relative as K,resolve as B}from"path";function k(e){let t=G(),r=!1,n=J(e);for(let o of n)try{let i=U(o,"utf-8");t.add(i),r=!0}catch{}return r||t.add(z),{isIgnored:o=>x(t,e,o),filter:o=>o.filter(i=>!x(t,e,i))}}function J(e){let t=[],r=S(e,".gitignore");b(r)&&t.push(r);let n=h(e),o=0;for(;n!==h(n)&&o<5;){let i=S(n,".gitignore");if(b(i)&&t.push(i),b(S(n,".git")))break;n=h(n),o++}return t}var z=`
1
+ import we from"better-sqlite3";import{existsSync as It,readFileSync as Dt,writeFileSync as Ft}from"fs";import{dirname as wt,join as Ot,resolve as Oe}from"path";import Q from"better-sqlite3";import{execFileSync as Z}from"child_process";import{existsSync as ee,readdirSync as te,readFileSync as ne}from"fs";import{extname as m,join as I}from"path";import G from"ignore";import{readFileSync as U,existsSync as b}from"fs";import{dirname as h,isAbsolute as V,join as S,relative as K,resolve as B}from"path";function k(e){let t=G(),r=!1,n=J(e);for(let o of n)try{let i=U(o,"utf-8");t.add(i),r=!0}catch{}return r||t.add(z),{isIgnored:o=>x(t,e,o),filter:o=>o.filter(i=>!x(t,e,i))}}function J(e){let t=[],r=S(e,".gitignore");b(r)&&t.push(r);let n=h(e),o=0;for(;n!==h(n)&&o<5;){let i=S(n,".gitignore");if(b(i)&&t.push(i),b(S(n,".git")))break;n=h(n),o++}return t}var z=`
2
2
  # Dependencies
3
3
  node_modules/
4
4
  vendor/
@@ -55,10 +55,10 @@ Thumbs.db
55
55
 
56
56
  # Type definitions (often noise in queries)
57
57
  *.d.ts
58
- `;function x(e,t,r){let n=X(t,r);if(!n)return!1;try{return e.ignores(n)}catch{return!1}}function X(e,t){if(!t||t===".")return null;if(!V(t)&&!t.startsWith(".."))return t.replaceAll("\\","/");let r=V(t)?t:B(e,t),n=K(e,r).replaceAll("\\","/");return!n||n==="."||n.startsWith("..")?null:n}import{readdirSync as Je}from"fs";import{extname as Xe,join as qe}from"path";function T(e){let t=new WeakMap,r=n=>{let o=t.get(n);return o||(o=new Map,t.set(n,o)),o};return{get(n,o,i){let s=r(n);if(s.has(o))return s.get(o);let a=i();return s.set(o,a),a},invalidate(n,o){t.get(n)?.delete(o)},invalidateAll(n){t.delete(n)},size(n){return t.get(n)?.size??0}}}var q=[".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"],C=[".vue"],Y=new Set(q.map(e=>e.toLowerCase())),Qe=[...Y].sort().join(","),L=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);var Ze=T("source-files");function at(e){let t=new Set((e.extensions??C).map(i=>i.toLowerCase()));if(t.size===0)return{scanned:0,inserted:0,existing:0};if(!ee(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let r=k(e.projectRoot),n=re(e.projectRoot,t).filter(i=>!r.isIgnored(i)),o=new Q(e.dbPath);try{let i=ie(o,n),s=o.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
58
+ `;function x(e,t,r){let n=X(t,r);if(!n)return!1;try{return e.ignores(n)}catch{return!1}}function X(e,t){if(!t||t===".")return null;if(!V(t)&&!t.startsWith(".."))return t.replaceAll("\\","/");let r=V(t)?t:B(e,t),n=K(e,r).replaceAll("\\","/");return!n||n==="."||n.startsWith("..")?null:n}import{readdirSync as ze}from"fs";import{extname as qe,join as Ye}from"path";function C(e){let t=new WeakMap,r=n=>{let o=t.get(n);return o||(o=new Map,t.set(n,o)),o};return{get(n,o,i){let s=r(n);if(s.has(o))return s.get(o);let a=i();return s.set(o,a),a},invalidate(n,o){t.get(n)?.delete(o)},invalidateAll(n){t.delete(n)},size(n){return t.get(n)?.size??0}}}var q=[".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"],T=[".vue"],Y=new Set(q.map(e=>e.toLowerCase())),Ze=[...Y].sort().join(","),L=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);var et=C("source-files");function ut(e){let t=new Set((e.extensions??T).map(i=>i.toLowerCase()));if(t.size===0)return{scanned:0,inserted:0,existing:0};if(!ee(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let r=k(e.projectRoot),n=re(e.projectRoot,t).filter(i=>!r.isIgnored(i)),o=new Q(e.dbPath);try{let i=ie(o,n),s=o.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
59
59
  VALUES (?, ?, NULL, ?)`),u=o.transaction(l=>{let p=0;for(let g of l){if(i.has(g))continue;let d=ne(I(e.projectRoot,g),"utf-8"),H=s.run(se(g),g,d);p+=Number(H.changes)}return p})(n),c={scanned:n.length,inserted:u,existing:n.length-u};return e.onStatus?.(`Augmented SQLite documents with ${u} auxiliary source file${u===1?"":"s"} (${c.existing} already present).`),c}finally{o.close()}}function re(e,t){let r=oe(e,t);if(r)return r;let n=[],o=i=>{let s=i?I(e,i):e,a;try{a=te(s,{withFileTypes:!0})}catch{return}for(let u of a){if(L.has(u.name))continue;let c=i?`${i}/${u.name}`:u.name;if(u.isDirectory()){o(c);continue}t.has(m(u.name).toLowerCase())&&n.push(c)}};return o(""),n.sort()}function oe(e,t){try{return Z("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"]}).split(`
60
- `).filter(n=>n&&t.has(m(n).toLowerCase())).sort()}catch{return null}}function ie(e,t){let r=new Set,n=500;for(let o=0;o<t.length;o+=n){let i=t.slice(o,o+n),s=e.prepare(`SELECT relative_path FROM documents WHERE relative_path IN (${i.map(()=>"?").join(",")})`).all(...i);for(let a of s)r.add(a.relative_path)}return r}function se(e){return m(e).toLowerCase()===".vue"?"vue":m(e).replace(/^\./,"").toLowerCase()||"source"}import{execFileSync as ae}from"child_process";import{createHash as ue}from"crypto";import{readdirSync as ce,readFileSync as le}from"fs";import{join as F}from"path";function ge(e){return(de(e)??fe(e)).filter(t=>t&&!D(t)).sort()}function ft(e){return ge(e).map(t=>{let r=F(e,t);try{let n=le(r);return{path:t,size:n.byteLength,hash:ue("sha256").update(n).digest("hex")}}catch{return{path:t,size:-1,hash:"unreadable"}}})}function de(e){try{return ae("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:50*1024*1024,stdio:["ignore","pipe","ignore"]}).split(`
61
- `).filter(Boolean)}catch{return null}}function fe(e){let t=[],r=[""];for(;r.length>0;){let n=r.pop(),o=n?F(e,n):e,i;try{i=ce(o,{withFileTypes:!0})}catch{continue}for(let s of i){let a=n?`${n}/${s.name}`:s.name;if(s.isDirectory()){D(a)||r.push(a);continue}t.push(a)}}return t}function D(e){return e.split("/").some(r=>pe.has(r))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var pe=new Set([".git","node_modules",".scipquery-cache",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]);import{createRequire as me}from"module";import{existsSync as be,readFileSync as v}from"fs";import{dirname as E,extname as he,join as w,relative as Se,resolve as St}from"path";import{pathToFileURL as ye}from"url";function O(e,t){let{vueCore:r,ts:n,volarTs:o}=ve(e),{parsed:i,vueOptions:s}=Re(r,n,t),a=E(t),u=r.createVueLanguagePlugin(n,i.options,s,d=>d),c=Ve(r,n,u),l=xe(a,i),{languageServiceHost:p}=o.createLanguageServiceHost(n,n.sys,c,d=>d,l),g=n.createLanguageService(p);return{ts:n,language:c,languageService:g,fileNames:i.fileNames,configDir:a}}function ve(e){let t=me(ye(w(e,"package.json")).href);return{vueCore:y(t,"@vue/language-core",e),ts:y(t,"typescript",e),volarTs:y(t,"@volar/typescript",e)}}function Re(e,t,r){let n=t.readConfigFile(r,t.sys.readFile);if(n.error||!n.config)throw new Error(`Failed to read ${r}`);let i=e.createParsedCommandLine(t,t.sys,r).vueOptions;return typeof e.createGlobalTypesWriter=="function"&&(i.globalTypesPath=e.createGlobalTypesWriter(i,t.sys.writeFile)),{parsed:t.parseJsonConfigFileContent(n.config,t.sys,E(r),void 0,r,void 0,e.getAllExtensions(i).map(s=>({extension:s.slice(1),isMixedContent:!0,scriptKind:t.ScriptKind.Deferred}))),vueOptions:i}}function Ve(e,t,r){let n={},o=e.createLanguage([r],new Map,i=>{if(!be(i))return;let s=v(i,"utf-8");n.current?.scripts.set(i,t.ScriptSnapshot.fromString(s),r.getLanguageId(i)??Le(i))});return n.current=o,o}function xe(e,t){return{getCurrentDirectory:()=>e,getCompilationSettings:()=>t.options,getScriptFileNames:()=>t.fileNames,getProjectReferences:()=>t.projectReferences,getProjectVersion:()=>"0"}}function y(e,t,r){try{return e(t)}catch(n){throw(typeof n=="object"&&n!==null&&"code"in n?n.code:null)==="MODULE_NOT_FOUND"?new Error(`Vue augmentation requires ${t} to be installed in ${r}. Install Vue/Volar dependencies for that project, then rerun augment-vue.`,{cause:n}):n}}function A(e,t,r){let n=ke(e);return o=>{let i=f(t,o.fileName),s=r.get(o.fileName);if(!s)return null;let a=r.positionAt(s,o.textSpan.start),u=n.get(i);if(!u)return null;let c=u.containingByLine.get(a.line);return c!==void 0?c:Te(u.starts,a.line,2)}}function ke(e){let t=e.prepare(`
60
+ `).filter(n=>n&&t.has(m(n).toLowerCase())).sort()}catch{return null}}function ie(e,t){let r=new Set,n=500;for(let o=0;o<t.length;o+=n){let i=t.slice(o,o+n),s=e.prepare(`SELECT relative_path FROM documents WHERE relative_path IN (${i.map(()=>"?").join(",")})`).all(...i);for(let a of s)r.add(a.relative_path)}return r}function se(e){return m(e).toLowerCase()===".vue"?"vue":m(e).replace(/^\./,"").toLowerCase()||"source"}import{execFileSync as ae}from"child_process";import{createHash as ue}from"crypto";import{readdirSync as ce,readFileSync as le}from"fs";import{join as D}from"path";function ge(e){return(de(e)??fe(e)).filter(t=>t&&!F(t)).sort()}function pt(e){return ge(e).map(t=>{let r=D(e,t);try{let n=le(r);return{path:t,size:n.byteLength,hash:ue("sha256").update(n).digest("hex")}}catch{return{path:t,size:-1,hash:"unreadable"}}})}function de(e){try{return ae("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:50*1024*1024,stdio:["ignore","pipe","ignore"]}).split(`
61
+ `).filter(Boolean)}catch{return null}}function fe(e){let t=[],r=[""];for(;r.length>0;){let n=r.pop(),o=n?D(e,n):e,i;try{i=ce(o,{withFileTypes:!0})}catch{continue}for(let s of i){let a=n?`${n}/${s.name}`:s.name;if(s.isDirectory()){F(a)||r.push(a);continue}t.push(a)}}return t}function F(e){return e.split("/").some(r=>pe.has(r))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var pe=new Set([".git","node_modules",".scipquery-cache",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]);import{createRequire as me}from"module";import{existsSync as be,readFileSync as v}from"fs";import{dirname as E,extname as he,join as w,relative as Se,resolve as yt}from"path";import{pathToFileURL as ye}from"url";function O(e,t){let{vueCore:r,ts:n,volarTs:o}=ve(e),{parsed:i,vueOptions:s}=Re(r,n,t),a=E(t),u=r.createVueLanguagePlugin(n,i.options,s,d=>d),c=Ve(r,n,u),l=xe(a,i),{languageServiceHost:p}=o.createLanguageServiceHost(n,n.sys,c,d=>d,l),g=n.createLanguageService(p);return{ts:n,language:c,languageService:g,fileNames:i.fileNames,configDir:a}}function ve(e){let t=me(ye(w(e,"package.json")).href);return{vueCore:y(t,"@vue/language-core",e),ts:y(t,"typescript",e),volarTs:y(t,"@volar/typescript",e)}}function Re(e,t,r){let n=t.readConfigFile(r,t.sys.readFile);if(n.error||!n.config)throw new Error(`Failed to read ${r}`);let i=e.createParsedCommandLine(t,t.sys,r).vueOptions;return typeof e.createGlobalTypesWriter=="function"&&(i.globalTypesPath=e.createGlobalTypesWriter(i,t.sys.writeFile)),{parsed:t.parseJsonConfigFileContent(n.config,t.sys,E(r),void 0,r,void 0,e.getAllExtensions(i).map(s=>({extension:s.slice(1),isMixedContent:!0,scriptKind:t.ScriptKind.Deferred}))),vueOptions:i}}function Ve(e,t,r){let n={},o=e.createLanguage([r],new Map,i=>{if(!be(i))return;let s=v(i,"utf-8");n.current?.scripts.set(i,t.ScriptSnapshot.fromString(s),r.getLanguageId(i)??Le(i))});return n.current=o,o}function xe(e,t){return{getCurrentDirectory:()=>e,getCompilationSettings:()=>t.options,getScriptFileNames:()=>t.fileNames,getProjectReferences:()=>t.projectReferences,getProjectVersion:()=>"0"}}function y(e,t,r){try{return e(t)}catch(n){throw(typeof n=="object"&&n!==null&&"code"in n?n.code:null)==="MODULE_NOT_FOUND"?new Error(`Vue augmentation requires ${t} to be installed in ${r}. Install Vue/Volar dependencies for that project, then rerun augment-vue.`,{cause:n}):n}}function A(e,t,r){let n=ke(e);return o=>{let i=f(t,o.fileName),s=r.get(o.fileName);if(!s)return null;let a=r.positionAt(s,o.textSpan.start),u=n.get(i);if(!u)return null;let c=u.containingByLine.get(a.line);return c!==void 0?c:Ce(u.starts,a.line,2)}}function ke(e){let t=e.prepare(`
62
62
  SELECT
63
63
  d.relative_path AS relativePath,
64
64
  der.start_line AS startLine,
@@ -67,5 +67,5 @@ Thumbs.db
67
67
  FROM defn_enclosing_ranges der
68
68
  JOIN documents d ON d.id = der.document_id
69
69
  ORDER BY d.relative_path, (der.end_line - der.start_line) DESC
70
- `).all(),r=new Map;for(let n of t){let o=r.get(n.relativePath);o||(o={containingByLine:new Map,starts:[]},r.set(n.relativePath,o)),o.starts.push({line:n.startLine,symbolId:n.symbolId});for(let i=n.startLine;i<=n.endLine;i++)o.containingByLine.set(i,n.symbolId)}for(let n of r.values())n.starts.sort((o,i)=>o.line-i.line);return r}function Te(e,t,r){let n=0,o=e.length-1;for(;n<=o;){let s=Math.floor((n+o)/2);e[s].line<t?n=s+1:o=s-1}let i=null;for(let s of[o,n]){let a=e[s];if(!a)continue;let u=Math.abs(a.line-t);u>r||(!i||u<i.distance)&&(i={distance:u,symbolId:a.symbolId})}return i?.symbolId??null}function N(e,t){let r=Fe(t),n=e.prepare("SELECT id FROM global_symbols WHERE symbol = ?"),o=new Map;return{get(i){if(o.has(i))return o.get(i)??null;let s=De(n,r,t,i);return o.set(i,s),s}}}function P(e,t,r,n,o){if(e.fileName.endsWith(".vue")){let i=n.language.scripts.get(e.fileName),s=i?.generated?.languagePlugin.typescript?.getServiceScript(i.generated.root)?.code;if(i&&s){let a=n.language.maps.get(s,i);if(R(a,e.textSpan.start)!==null)return r.get(e.fileName)}return e.fileName.startsWith(o)?r.get(e.fileName):null}return t(e)}function*M(e){let t=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,r=new Set(["script","setup","template","style","lang","scoped","true","false","null","undefined","const","let","var","import","from","export","return","if","else","for","while","function","class","type","interface","as","await","async"]),n;for(;n=t.exec(e);){let o=n[0];r.has(o)||(yield{text:o,start:n.index,end:n.index+o.length})}}function _(e,t){for(let[r]of e.toGeneratedLocation(t,n=>!!n.navigation))return r;return null}function R(e,t){let r=e;for(let[n]of r.toSourceLocation(t,o=>!!o.navigation))return n;return null}function Ce(e,t){let r=0,n=e.lineStarts.length-1;for(;r<=n;){let i=Math.floor((r+n)/2);e.lineStarts[i]<=t?r=i+1:n=i-1}let o=Math.max(0,n);return{line:o,character:t-e.lineStarts[o]}}function j(e,t){return f(e,t).startsWith("node_modules/")}function f(e,t){return Se(e,t).replaceAll("\\","/")}function Le(e){switch(he(e)){case".vue":return"vue";case".tsx":return"typescriptreact";case".ts":case".mts":case".cts":return"typescript";case".jsx":return"javascriptreact";case".js":case".mjs":case".cjs":return"javascript";case".json":return"json";default:return"typescript"}}function $(){let e=new Map;return{get(t){if(e.has(t))return e.get(t)??null;try{let r=v(t,"utf-8"),n={text:r,lineStarts:Ie(r)};return e.set(t,n),n}catch{return e.set(t,null),null}},positionAt:Ce}}function Ie(e){let t=[0];for(let r=0;r<e.length;r++)e.charCodeAt(r)===10&&t.push(r+1);return t}function Fe(e){try{let t=JSON.parse(v(w(e,"package.json"),"utf-8"));return{name:t.name??"workspace",version:t.version??"0.0.0"}}catch{return{name:"workspace",version:"0.0.0"}}}function De(e,t,r,n){let o=f(r,n),i=Ee(t.name,t.version,o);return e.get(i)?.id??null}function Ee(e,t,r){let n=r.split("/").map(o=>`\`${o.replaceAll("`","")}\``).join("/");return`scip-vue npm ${e} ${t} ${n}/default.`}function At(e){let t=Oe(e.projectRoot,e.tsconfig),r=O(e.projectRoot,t),n=new we(e.dbPath,{readonly:!0});try{let o=$();return Ae({projectRoot:e.projectRoot,vueFiles:e.vueFiles??[],tasks:e.tasks,context:r,symbolLookup:A(n,e.projectRoot,o),vueSymbolLookup:N(n,e.projectRoot),sourceReader:o})}finally{n.close()}}function Ae(e){let t=[],r=0,n=e.tasks??e.vueFiles.map(o=>({fileName:o,startOffset:0,endOffset:Number.POSITIVE_INFINITY,countFileSkip:!0}));for(let o of n){let i=Ne(e,o);t.push(...i.occurrences),r+=i.skippedReferences}return{occurrences:t,skippedReferences:r}}function Ne(e,t){let r=e.context.language.scripts.get(t.fileName),n=r?.generated?.languagePlugin.typescript?.getServiceScript(r.generated.root)?.code;if(!r||!n)return{occurrences:[],skippedReferences:t.countFileSkip?1:0};let o=e.sourceReader.get(t.fileName);if(!o)return{occurrences:[],skippedReferences:t.countFileSkip?1:0};let i=e.context.language.maps.get(n,r),s=f(e.projectRoot,t.fileName),a=[...M(o.text)],u={tokens:a.filter(c=>c.start>=t.startOffset&&c.start<t.endOffset),tokenByStart:new Map(a.map(c=>[c.start,c])),tokenTextCounts:_e(a),processedStarts:new Set};return Pe({...e,fileName:t.fileName,sourceInfo:o,sourceFile:s,map:i,tokenContext:u})}function Pe(e){let t=[],r=0;for(let n of e.tokenContext.tokens){if(e.tokenContext.processedStarts.has(n.start))continue;let o=_(e.map,n.start);if(o===null)continue;let s=(e.context.languageService.getDefinitionAtPosition(e.fileName,o+1)??[]).find(u=>!j(e.projectRoot,u.fileName));if(!s){r++;continue}let a=P(s,e.symbolLookup,e.vueSymbolLookup,e.context,e.projectRoot);if(a===null){r++;continue}W(t,e.sourceReader,e.sourceInfo,e.sourceFile,n,a),e.tokenContext.processedStarts.add(n.start),Me(t,e,n,o,a)}return{occurrences:t,skippedReferences:r}}function Me(e,t,r,n,o){if(!((t.tokenContext.tokenTextCounts.get(r.text)??0)<=1))for(let i of je(t.context.languageService,t.fileName,n+1,t.map,r,t.tokenContext.tokenByStart)){if(t.tokenContext.processedStarts.has(i))continue;let s=t.tokenContext.tokenByStart.get(i);s&&(W(e,t.sourceReader,t.sourceInfo,t.sourceFile,s,o),t.tokenContext.processedStarts.add(i))}}function W(e,t,r,n,o,i){let s=t.positionAt(r,o.start);e.push({sourceFile:n,sourceLine:s.line,sourceStartChar:s.character,sourceEndChar:s.character+o.text.length,symbolId:i})}function _e(e){let t=new Map;for(let r of e)t.set(r.text,(t.get(r.text)??0)+1);return t}function je(e,t,r,n,o,i){let s=e.getDocumentHighlights?.(t,r,[t])??[],a=[];for(let u of s)if(u.fileName===t)for(let c of u.highlightSpans){let l=$e(n,c.textSpan.start,i,o.text);l!==null&&a.push(l)}return a}function $e(e,t,r,n){let o=r.get(t);if(o?.text===n)return o.start;let i=R(e,t);if(i===null)return null;let s=r.get(i);return s?.text===n?s.start:null}export{at as a,ft as b,At as c};
71
- //# sourceMappingURL=chunk-6H2XIIPY.js.map
70
+ `).all(),r=new Map;for(let n of t){let o=r.get(n.relativePath);o||(o={containingByLine:new Map,starts:[]},r.set(n.relativePath,o)),o.starts.push({line:n.startLine,symbolId:n.symbolId});for(let i=n.startLine;i<=n.endLine;i++)o.containingByLine.set(i,n.symbolId)}for(let n of r.values())n.starts.sort((o,i)=>o.line-i.line);return r}function Ce(e,t,r){let n=0,o=e.length-1;for(;n<=o;){let s=Math.floor((n+o)/2);e[s].line<t?n=s+1:o=s-1}let i=null;for(let s of[o,n]){let a=e[s];if(!a)continue;let u=Math.abs(a.line-t);u>r||(!i||u<i.distance)&&(i={distance:u,symbolId:a.symbolId})}return i?.symbolId??null}function N(e,t){let r=De(t),n=e.prepare("SELECT id FROM global_symbols WHERE symbol = ?"),o=new Map;return{get(i){if(o.has(i))return o.get(i)??null;let s=Fe(n,r,t,i);return o.set(i,s),s}}}function P(e,t,r,n,o){if(e.fileName.endsWith(".vue")){let i=n.language.scripts.get(e.fileName),s=i?.generated?.languagePlugin.typescript?.getServiceScript(i.generated.root)?.code;if(i&&s){let a=n.language.maps.get(s,i);if(R(a,e.textSpan.start)!==null)return r.get(e.fileName)}return e.fileName.startsWith(o)?r.get(e.fileName):null}return t(e)}function*M(e){let t=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,r=new Set(["script","setup","template","style","lang","scoped","true","false","null","undefined","const","let","var","import","from","export","return","if","else","for","while","function","class","type","interface","as","await","async"]),n;for(;n=t.exec(e);){let o=n[0];r.has(o)||(yield{text:o,start:n.index,end:n.index+o.length})}}function _(e,t){for(let[r]of e.toGeneratedLocation(t,n=>!!n.navigation))return r;return null}function R(e,t){let r=e;for(let[n]of r.toSourceLocation(t,o=>!!o.navigation))return n;return null}function Te(e,t){let r=0,n=e.lineStarts.length-1;for(;r<=n;){let i=Math.floor((r+n)/2);e.lineStarts[i]<=t?r=i+1:n=i-1}let o=Math.max(0,n);return{line:o,character:t-e.lineStarts[o]}}function j(e,t){return f(e,t).startsWith("node_modules/")}function f(e,t){return Se(e,t).replaceAll("\\","/")}function Le(e){switch(he(e)){case".vue":return"vue";case".tsx":return"typescriptreact";case".ts":case".mts":case".cts":return"typescript";case".jsx":return"javascriptreact";case".js":case".mjs":case".cjs":return"javascript";case".json":return"json";default:return"typescript"}}function $(){let e=new Map;return{get(t){if(e.has(t))return e.get(t)??null;try{let r=v(t,"utf-8"),n={text:r,lineStarts:Ie(r)};return e.set(t,n),n}catch{return e.set(t,null),null}},positionAt:Te}}function Ie(e){let t=[0];for(let r=0;r<e.length;r++)e.charCodeAt(r)===10&&t.push(r+1);return t}function De(e){try{let t=JSON.parse(v(w(e,"package.json"),"utf-8"));return{name:t.name??"workspace",version:t.version??"0.0.0"}}catch{return{name:"workspace",version:"0.0.0"}}}function Fe(e,t,r,n){let o=f(r,n),i=Ee(t.name,t.version,o);return e.get(i)?.id??null}function Ee(e,t,r){let n=r.split("/").map(o=>`\`${o.replaceAll("`","")}\``).join("/");return`scip-vue npm ${e} ${t} ${n}/default.`}function Nt(e){let t=Oe(e.projectRoot,e.tsconfig),r=new we(e.dbPath,{readonly:!0});try{let n=Ae({db:r,projectRoot:e.projectRoot,configPath:t,vueSymbolLookup:N(r,e.projectRoot)});return Ne({vueFiles:e.vueFiles??[],tasks:e.tasks,...n})}finally{r.close()}}function Ae(e){let t=$();return{projectRoot:e.projectRoot,context:O(e.projectRoot,e.configPath),symbolLookup:A(e.db,e.projectRoot,t),vueSymbolLookup:e.vueSymbolLookup,sourceReader:t}}function Ne(e){let t=[],r=0,n=e.tasks??e.vueFiles.map(o=>({fileName:o,startOffset:0,endOffset:Number.POSITIVE_INFINITY,countFileSkip:!0}));for(let o of n){let i=Pe(e,o);t.push(...i.occurrences),r+=i.skippedReferences}return{occurrences:t,skippedReferences:r}}function Pe(e,t){let r=e.context.language.scripts.get(t.fileName),n=r?.generated?.languagePlugin.typescript?.getServiceScript(r.generated.root)?.code;if(!r||!n)return{occurrences:[],skippedReferences:t.countFileSkip?1:0};let o=e.sourceReader.get(t.fileName);if(!o)return{occurrences:[],skippedReferences:t.countFileSkip?1:0};let i=e.context.language.maps.get(n,r),s=f(e.projectRoot,t.fileName),a=[...M(o.text)],u={tokens:a.filter(c=>c.start>=t.startOffset&&c.start<t.endOffset),tokenByStart:new Map(a.map(c=>[c.start,c])),tokenTextCounts:je(a),processedStarts:new Set};return Me({...e,fileName:t.fileName,sourceInfo:o,sourceFile:s,map:i,tokenContext:u})}function Me(e){let t=[],r=0;for(let n of e.tokenContext.tokens){if(e.tokenContext.processedStarts.has(n.start))continue;let o=_(e.map,n.start);if(o===null)continue;let s=(e.context.languageService.getDefinitionAtPosition(e.fileName,o+1)??[]).find(u=>!j(e.projectRoot,u.fileName));if(!s){r++;continue}let a=P(s,e.symbolLookup,e.vueSymbolLookup,e.context,e.projectRoot);if(a===null){r++;continue}W(t,e.sourceReader,e.sourceInfo,e.sourceFile,n,a),e.tokenContext.processedStarts.add(n.start),_e(t,e,n,o,a)}return{occurrences:t,skippedReferences:r}}function _e(e,t,r,n,o){if(!((t.tokenContext.tokenTextCounts.get(r.text)??0)<=1))for(let i of $e(t.context.languageService,t.fileName,n+1,t.map,r,t.tokenContext.tokenByStart)){if(t.tokenContext.processedStarts.has(i))continue;let s=t.tokenContext.tokenByStart.get(i);s&&(W(e,t.sourceReader,t.sourceInfo,t.sourceFile,s,o),t.tokenContext.processedStarts.add(i))}}function W(e,t,r,n,o,i){let s=t.positionAt(r,o.start);e.push({sourceFile:n,sourceLine:s.line,sourceStartChar:s.character,sourceEndChar:s.character+o.text.length,symbolId:i})}function je(e){let t=new Map;for(let r of e)t.set(r.text,(t.get(r.text)??0)+1);return t}function $e(e,t,r,n,o,i){let s=e.getDocumentHighlights?.(t,r,[t])??[],a=[];for(let u of s)if(u.fileName===t)for(let c of u.highlightSpans){let l=We(n,c.textSpan.start,i,o.text);l!==null&&a.push(l)}return a}function We(e,t,r,n){let o=r.get(t);if(o?.text===n)return o.start;let i=R(e,t);if(i===null)return null;let s=r.get(i);return s?.text===n?s.start:null}export{ut as a,pt as b,Nt as c};
71
+ //# sourceMappingURL=chunk-6QH2L26C.js.map
@@ -1,2 +1,2 @@
1
- import{b}from"./chunk-DFK54IRN.js";import{l as u,v as f}from"./chunk-7OX2O53H.js";function S(a,p){let L=b(a,p),o=f(a,L,{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 c=[];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,m=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&&!u(t.symbol,n.symbol))continue;let d=t.endLine-t.startLine;d<m&&(m=d,l=t)}l?l.children.push(n):c.push(n)}return c}export{S as a};
2
- //# sourceMappingURL=chunk-MDAYGS6T.js.map
1
+ import{b}from"./chunk-SDPP5KVQ.js";import{l as u,v as f}from"./chunk-4VYIZV3S.js";function S(a,p){let L=b(a,p),o=f(a,L,{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 c=[];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,m=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&&!u(t.symbol,n.symbol))continue;let d=t.endLine-t.startLine;d<m&&(m=d,l=t)}l?l.children.push(n):c.push(n)}return c}export{S as a};
2
+ //# sourceMappingURL=chunk-6SR4UNWI.js.map
@@ -0,0 +1,2 @@
1
+ import{b as r}from"./chunk-SDPP5KVQ.js";import{v as e}from"./chunk-4VYIZV3S.js";function l(t,s){let o=r(t,s);return e(t,o).map(({relativePath:n,...a})=>a)}export{l as a};
2
+ //# sourceMappingURL=chunk-6XEWA6FX.js.map
@@ -1,2 +1,2 @@
1
- import{a as C}from"./chunk-V76FCF5F.js";import{a as x,b as L}from"./chunk-MX6F756F.js";import{b as h}from"./chunk-QAEDNTY7.js";import{c as m,g as c}from"./chunk-7OX2O53H.js";import{e as g,g as y,j as b}from"./chunk-5TT47UMX.js";function P(o,e,s,n){let r=g(e);if(!r)return!0;let i=b(o,e);if(!i)return!0;let a=S.get(i);return a||(a=N(i,r),S.set(i,a)),a.get(`${s}:${n}`)??!0}var S=new WeakMap;function N(o,e){let s=y(e),n=new Map,r=i=>{s.has(i.type)&&n.set(`${i.startPosition.row}:${i.endPosition.row}`,w(i,e));for(let a of i.children)r(a)};return r(o.rootNode),n}function w(o,e){let s=o.namedChildren.find(t=>t.type==="block"||t.type==="statement_block");if(!s)return!1;let n=s.namedChildren.filter(t=>t.type!=="comment"&&t.type!=="line_comment"&&t.type!=="block_comment");if(n.length!==1)return!1;let r=n[0],i=null;if(r.type==="return_statement"||r.type==="expression_statement"?i=r.namedChild(0)??null:e==="rust"&&(r.type==="call_expression"||r.type==="macro_invocation")&&(i=r),!i)return!1;let a=e==="python"?"call":"call_expression";if(i.type!==a)return!1;let l=i.namedChildren.find(t=>t.type==="arguments"||t.type==="argument_list");if(!l)return!1;let d=l.namedChildren.filter(t=>t.type!=="comment"),p=o.namedChildren.find(t=>t.type==="parameters"||t.type==="formal_parameters");if(!p)return!1;let u=[];for(let t of p.namedChildren)if(t.type==="identifier")u.push(t.text);else{let f=t.namedChildren.find(T=>T.type==="identifier");f&&u.push(f.text)}if(d.length!==u.length)return!1;for(let t=0;t<u.length;t+=1){let f=d[t];if(f.type!=="identifier"||f.text!==u[t])return!1}return!0}function $(o,e){let{scope:s,maxLoc:n=15,limit:r=30,scanLimit:i}=e??{},a=new h(o);return C({candidates:()=>A(a,s,n),orderCandidates:L,scanLimit:i,prepare:l=>a.calleeMap(l,{semantic:e?.semantic!==!1}),evaluate:(l,d)=>_(o,l,d.get(l.symbolId)??[]),orderResults:(l,d)=>l.loc-d.loc||l.file.localeCompare(d.file),limit:r})}function _(o,e,s){let n=D(s);if(n.size!==1||!P(o,e.relativePath,e.startLine,e.endLine))return null;let[,r]=[...n.entries()][0];return{symbol:e.symbol,shortName:m(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:x(e),forwardsTo:r.symbol,forwardsToShort:m(r.symbol),forwardsToFile:r.file}}function D(o){let e=o.some(n=>c(n.symbol))?o.filter(n=>c(n.symbol)):o,s=new Map;for(let n of e)s.has(n.symbol)||s.set(n.symbol,n);return s}function A(o,e,s){return o.productionCallableDefinitions({scope:e,minLoc:3,maxLoc:s,requireFunctionLikeSymbol:!0,excludeRustTraitImplMembers:!0})}export{$ as a};
2
- //# sourceMappingURL=chunk-3GNFUVFA.js.map
1
+ import{a as C}from"./chunk-V76FCF5F.js";import{a as x,b as L}from"./chunk-MX6F756F.js";import{a as h}from"./chunk-NBUINPSH.js";import{c as m,g as c}from"./chunk-4VYIZV3S.js";import{e as g,g as y,j as b}from"./chunk-5TT47UMX.js";function P(o,e,s,n){let r=g(e);if(!r)return!0;let i=b(o,e);if(!i)return!0;let a=S.get(i);return a||(a=N(i,r),S.set(i,a)),a.get(`${s}:${n}`)??!0}var S=new WeakMap;function N(o,e){let s=y(e),n=new Map,r=i=>{s.has(i.type)&&n.set(`${i.startPosition.row}:${i.endPosition.row}`,w(i,e));for(let a of i.children)r(a)};return r(o.rootNode),n}function w(o,e){let s=o.namedChildren.find(t=>t.type==="block"||t.type==="statement_block");if(!s)return!1;let n=s.namedChildren.filter(t=>t.type!=="comment"&&t.type!=="line_comment"&&t.type!=="block_comment");if(n.length!==1)return!1;let r=n[0],i=null;if(r.type==="return_statement"||r.type==="expression_statement"?i=r.namedChild(0)??null:e==="rust"&&(r.type==="call_expression"||r.type==="macro_invocation")&&(i=r),!i)return!1;let a=e==="python"?"call":"call_expression";if(i.type!==a)return!1;let l=i.namedChildren.find(t=>t.type==="arguments"||t.type==="argument_list");if(!l)return!1;let d=l.namedChildren.filter(t=>t.type!=="comment"),p=o.namedChildren.find(t=>t.type==="parameters"||t.type==="formal_parameters");if(!p)return!1;let u=[];for(let t of p.namedChildren)if(t.type==="identifier")u.push(t.text);else{let f=t.namedChildren.find(T=>T.type==="identifier");f&&u.push(f.text)}if(d.length!==u.length)return!1;for(let t=0;t<u.length;t+=1){let f=d[t];if(f.type!=="identifier"||f.text!==u[t])return!1}return!0}function $(o,e){let{scope:s,maxLoc:n=15,limit:r=30,scanLimit:i}=e??{},a=new h(o);return C({candidates:()=>A(a,s,n),orderCandidates:L,scanLimit:i,prepare:l=>a.calleeMap(l,{semantic:e?.semantic!==!1}),evaluate:(l,d)=>_(o,l,d.get(l.symbolId)??[]),orderResults:(l,d)=>l.loc-d.loc||l.file.localeCompare(d.file),limit:r})}function _(o,e,s){let n=D(s);if(n.size!==1||!P(o,e.relativePath,e.startLine,e.endLine))return null;let[,r]=[...n.entries()][0];return{symbol:e.symbol,shortName:m(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:x(e),forwardsTo:r.symbol,forwardsToShort:m(r.symbol),forwardsToFile:r.file}}function D(o){let e=o.some(n=>c(n.symbol))?o.filter(n=>c(n.symbol)):o,s=new Map;for(let n of e)s.has(n.symbol)||s.set(n.symbol,n);return s}function A(o,e,s){return o.productionCallableDefinitions({scope:e,minLoc:3,maxLoc:s,requireFunctionLikeSymbol:!0,excludeRustTraitImplMembers:!0})}export{$ as a};
2
+ //# sourceMappingURL=chunk-7WHNTKSD.js.map
@@ -1,2 +1,2 @@
1
- import{a as b,c as p}from"./chunk-MX6F756F.js";import{b as g}from"./chunk-QAEDNTY7.js";import{c as d}from"./chunk-7OX2O53H.js";function M(n,l={}){let{scope:e,minLoc:s=10,minCallees:o=6,limit:t=20,scanLimit:i}=l,r=new g(n),c=r.productionCallableDefinitions({scope:e,minLoc:s,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),f=p(c,i),h=r.calleeMap(f,{semantic:l.semantic!==!1}),m=[];for(let a of f){let u=S(a,h.get(a.symbolId)??[],o);u&&m.push(u)}return m.sort((a,u)=>u.clusters.length-a.clusters.length||u.loc-a.loc),m.slice(0,t)}function S(n,l,e){let s=new Set(l.map(r=>r.symbol));if(s.size<e)return null;let o=C(s,l),t=y(s,o);if(t.length<2)return null;let i=x(t,o);return i.length===0?null:{symbol:n.symbol,shortName:d(n.symbol),relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:b(n),totalCallees:s.size,clusters:i}}function C(n,l){let e=new Map;for(let o of n)e.set(o,new Set);let s=new Map;for(let o of l){let t=s.get(o.chunkId);t||(t=new Set,s.set(o.chunkId,t)),t.add(o.symbol)}for(let o of s.values()){let t=[...o];for(let i=0;i<t.length;i++)for(let r=i+1;r<t.length;r++)e.get(t[i]).add(t[r]),e.get(t[r]).add(t[i])}return e}function y(n,l){let e=new Set,s=[];for(let o of n){if(e.has(o))continue;let t=new Set,i=[o];for(;i.length>0;){let r=i.pop();if(!e.has(r)){e.add(r),t.add(r);for(let c of l.get(r)??[])e.has(c)||i.push(c)}}s.push(t)}return s}function x(n,l){return n.filter(e=>e.size>=3).map(e=>L(e,n,l)).filter(e=>e.isolation>.5).sort((e,s)=>s.isolation-e.isolation)}function L(n,l,e){let s=new Set;for(let r of l)if(r!==n)for(let c of r)s.add(c);let o=0;for(let r of n)for(let c of e.get(r)??[])s.has(c)&&o++;let t=n.size*s.size,i=t>0?1-o/t:1;return{callees:[...n].map(d),isolation:i}}export{M as a};
2
- //# sourceMappingURL=chunk-XO6R3X5J.js.map
1
+ import{a as b,c as p}from"./chunk-MX6F756F.js";import{a as g}from"./chunk-NBUINPSH.js";import{c as d}from"./chunk-4VYIZV3S.js";function M(n,l={}){let{scope:e,minLoc:s=10,minCallees:o=6,limit:t=20,scanLimit:i}=l,r=new g(n),c=r.productionCallableDefinitions({scope:e,minLoc:s,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),f=p(c,i),h=r.calleeMap(f,{semantic:l.semantic!==!1}),m=[];for(let a of f){let u=S(a,h.get(a.symbolId)??[],o);u&&m.push(u)}return m.sort((a,u)=>u.clusters.length-a.clusters.length||u.loc-a.loc),m.slice(0,t)}function S(n,l,e){let s=new Set(l.map(r=>r.symbol));if(s.size<e)return null;let o=C(s,l),t=y(s,o);if(t.length<2)return null;let i=x(t,o);return i.length===0?null:{symbol:n.symbol,shortName:d(n.symbol),relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:b(n),totalCallees:s.size,clusters:i}}function C(n,l){let e=new Map;for(let o of n)e.set(o,new Set);let s=new Map;for(let o of l){let t=s.get(o.chunkId);t||(t=new Set,s.set(o.chunkId,t)),t.add(o.symbol)}for(let o of s.values()){let t=[...o];for(let i=0;i<t.length;i++)for(let r=i+1;r<t.length;r++)e.get(t[i]).add(t[r]),e.get(t[r]).add(t[i])}return e}function y(n,l){let e=new Set,s=[];for(let o of n){if(e.has(o))continue;let t=new Set,i=[o];for(;i.length>0;){let r=i.pop();if(!e.has(r)){e.add(r),t.add(r);for(let c of l.get(r)??[])e.has(c)||i.push(c)}}s.push(t)}return s}function x(n,l){return n.filter(e=>e.size>=3).map(e=>L(e,n,l)).filter(e=>e.isolation>.5).sort((e,s)=>s.isolation-e.isolation)}function L(n,l,e){let s=new Set;for(let r of l)if(r!==n)for(let c of r)s.add(c);let o=0;for(let r of n)for(let c of e.get(r)??[])s.has(c)&&o++;let t=n.size*s.size,i=t>0?1-o/t:1;return{callees:[...n].map(d),isolation:i}}export{M as a};
2
+ //# sourceMappingURL=chunk-D62LLANH.js.map
@@ -1,4 +1,4 @@
1
- import{a as h,b as v,c as P}from"./chunk-JTXKS5GK.js";import{a as b,c as L}from"./chunk-MX6F756F.js";import{b as D}from"./chunk-QAEDNTY7.js";import{a as I,c as S,d as p}from"./chunk-7OX2O53H.js";import{a as y,m as x}from"./chunk-5TT47UMX.js";function ie(t,n){let{scope:e,minLoc:i=3,maxLoc:s=80,limit:r=30,includeLowConfidence:c=!1,scanLimit:l}=n??{},d=n?.semantic!==!1,a=new D(t),f=a.scopedDefinitions(e),u=V(a,e),g=L($(t,a,f,{minLoc:i,maxLoc:s}).sort((o,m)=>b(m)-b(o)||o.relativePath.localeCompare(m.relativePath)),l),F=A(a,g,{semantic:d}),k=O(t,a,f,g,{semantic:d}),R=B(g);return N(t,g,F,R).filter(o=>!k.has(o.definition.symbolId)).filter(o=>!o.transitivelyReachable).filter(o=>o.realConsumers.length<=1).filter(o=>!(o.realConsumers.length===0&&o.barrelConsumers>0)).filter(o=>Z(o.definition,o.realConsumers.length,u)).map(o=>j(t,o)).filter(o=>c||o.confidence!=="low").sort((o,m)=>{let C={high:0,medium:1,low:2};return C[o.confidence]-C[m.confidence]||m.loc-o.loc||o.file.localeCompare(m.file)||o.startLine-m.startLine}).slice(0,r)}function $(t,n,e,i){return e.filter(s=>s.isTypeLike&&b(s)>=i.minLoc).filter(s=>b(s)<=i.maxLoc).filter(s=>!t.isIgnored(s.relativePath)).filter(s=>!H(s.symbol)).filter(s=>!n.hasSuppressionComment(s))}function A(t,n,e){return h(t,n,{semantic:e.semantic})}function B(t){let n=new Map;for(let e of t){let i=n.get(e.relativePath);i||(i=new Map,n.set(e.relativePath,i));let s=p(e.symbol);s&&i.set(s,e)}return n}function N(t,n,e,i){return n.map(s=>{let c=[...e.get(s.symbolId)??new Set].filter(u=>u!==s.relativePath&&!t.isIgnored(u)),{realConsumers:l,barrelConsumers:d,importOnlyConsumers:a}=v(t,s,c),f=_(t,s,e,i);return{definition:s,realConsumers:l,barrelConsumers:d+a,transitivelyReachable:f}})}function j(t,n){let e=w(t,n.definition.relativePath,n.definition.startLine),i=T(n.definition.relativePath)?!0:q(t,n.definition),{confidence:s,reason:r}=G(n.realConsumers.length,e,i);return{symbol:n.definition.symbol,shortName:S(n.definition.symbol),file:n.definition.relativePath,startLine:n.definition.startLine,endLine:n.definition.endLine,loc:b(n.definition),consumers:n.realConsumers.length,barrelConsumers:n.barrelConsumers,kind:e,definerUsesType:i,confidence:s,reason:r}}function O(t,n,e,i,s){let r=W(t,U(e),i),c=r.map(a=>a.singleton);if(r.length===0)return new Set;let l=h(n,c,{semantic:s.semantic}),d=new Set;for(let{singleton:a,classId:f}of r)E(t,a,l)&&d.add(f);return d}function U(t){let n=new Map;for(let e of t){let i=p(e.symbol);i&&n.set(M(e.relativePath,i),e)}return n}function W(t,n,e){let i=[];for(let s of e){let r=z(t,n,s);r&&i.push({singleton:r,classId:s.symbolId})}return i}function z(t,n,e){if(w(t,e.relativePath,e.startLine)!=="class")return null;let i=p(e.symbol);if(!i)return null;let s=K(t,e.relativePath,i);return s?n.get(M(e.relativePath,s))??null:null}function E(t,n,e){let i=p(n.symbol),s=e.get(n.symbolId);return!i||!s?!1:[...s].some(r=>r!==n.relativePath&&!t.isIgnored(r)&&!P(t,r,i))}function M(t,n){return`${t}\0${n}`}function K(t,n,e){let i=y(t,n);if(!i)return null;let s=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\bexport\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*new\\s+${s}\\s*\\(`);return i.match(r)?.[1]??null}function V(t,n){return new Set(t.scopedDefinitions(n).filter(e=>e.isFunctionLike).map(e=>e.relativePath))}function H(t){let n=I(t);if("kind"in n)return!1;let e=n.descriptors;if(e.length<2)return!1;let i=e[e.length-1],s=e[e.length-2];return i?.suffix==="type"&&s?.suffix==="type"}function T(t){let e=(t.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(e==="types"||e.endsWith("-types")||e==="models"||e==="schema"||e==="common"||e==="protocol"||e==="proto"||e==="dto"||e==="mod"||/(^|\/)types(\/|\.)/.test(t)||/(^|\/)models?(\/|\.)/.test(t)||/(^|\/)proto(?:col)?(\/|\.)/.test(t)||/(^|\/)schema(\/|\.)/.test(t))}function Z(t,n,e){return!(T(t.relativePath)&&n>0||n===0&&e.has(t.relativePath))}function _(t,n,e,i){let s=x(t,n.relativePath),r=p(n.symbol);if(!r)return!1;let c=s.get(r);if(!c||c.size===0)return!1;let l=i.get(n.relativePath);if(!l)return!1;for(let d of c){let a=l.get(d);if(!a)continue;let f=e.get(a.symbolId);if(f){for(let u of f)if(u!==n.relativePath&&!t.isIgnored(u))return!0}}return!1}function w(t,n,e){let i=y(t,n);if(!i)return"other";let s=i.split(`
1
+ import{a as h,b as v,c as P}from"./chunk-3X43EYFU.js";import{a as b,c as L}from"./chunk-MX6F756F.js";import{a as D}from"./chunk-NBUINPSH.js";import{a as I,c as S,d as p}from"./chunk-4VYIZV3S.js";import{a as y,m as x}from"./chunk-5TT47UMX.js";function ie(t,n){let{scope:e,minLoc:i=3,maxLoc:s=80,limit:r=30,includeLowConfidence:c=!1,scanLimit:l}=n??{},d=n?.semantic!==!1,a=new D(t),f=a.scopedDefinitions(e),u=V(a,e),g=L($(t,a,f,{minLoc:i,maxLoc:s}).sort((o,m)=>b(m)-b(o)||o.relativePath.localeCompare(m.relativePath)),l),F=A(a,g,{semantic:d}),k=O(t,a,f,g,{semantic:d}),R=B(g);return N(t,g,F,R).filter(o=>!k.has(o.definition.symbolId)).filter(o=>!o.transitivelyReachable).filter(o=>o.realConsumers.length<=1).filter(o=>!(o.realConsumers.length===0&&o.barrelConsumers>0)).filter(o=>Z(o.definition,o.realConsumers.length,u)).map(o=>j(t,o)).filter(o=>c||o.confidence!=="low").sort((o,m)=>{let C={high:0,medium:1,low:2};return C[o.confidence]-C[m.confidence]||m.loc-o.loc||o.file.localeCompare(m.file)||o.startLine-m.startLine}).slice(0,r)}function $(t,n,e,i){return e.filter(s=>s.isTypeLike&&b(s)>=i.minLoc).filter(s=>b(s)<=i.maxLoc).filter(s=>!t.isIgnored(s.relativePath)).filter(s=>!H(s.symbol)).filter(s=>!n.hasSuppressionComment(s))}function A(t,n,e){return h(t,n,{semantic:e.semantic})}function B(t){let n=new Map;for(let e of t){let i=n.get(e.relativePath);i||(i=new Map,n.set(e.relativePath,i));let s=p(e.symbol);s&&i.set(s,e)}return n}function N(t,n,e,i){return n.map(s=>{let c=[...e.get(s.symbolId)??new Set].filter(u=>u!==s.relativePath&&!t.isIgnored(u)),{realConsumers:l,barrelConsumers:d,importOnlyConsumers:a}=v(t,s,c),f=_(t,s,e,i);return{definition:s,realConsumers:l,barrelConsumers:d+a,transitivelyReachable:f}})}function j(t,n){let e=w(t,n.definition.relativePath,n.definition.startLine),i=T(n.definition.relativePath)?!0:q(t,n.definition),{confidence:s,reason:r}=G(n.realConsumers.length,e,i);return{symbol:n.definition.symbol,shortName:S(n.definition.symbol),file:n.definition.relativePath,startLine:n.definition.startLine,endLine:n.definition.endLine,loc:b(n.definition),consumers:n.realConsumers.length,barrelConsumers:n.barrelConsumers,kind:e,definerUsesType:i,confidence:s,reason:r}}function O(t,n,e,i,s){let r=W(t,U(e),i),c=r.map(a=>a.singleton);if(r.length===0)return new Set;let l=h(n,c,{semantic:s.semantic}),d=new Set;for(let{singleton:a,classId:f}of r)E(t,a,l)&&d.add(f);return d}function U(t){let n=new Map;for(let e of t){let i=p(e.symbol);i&&n.set(M(e.relativePath,i),e)}return n}function W(t,n,e){let i=[];for(let s of e){let r=z(t,n,s);r&&i.push({singleton:r,classId:s.symbolId})}return i}function z(t,n,e){if(w(t,e.relativePath,e.startLine)!=="class")return null;let i=p(e.symbol);if(!i)return null;let s=K(t,e.relativePath,i);return s?n.get(M(e.relativePath,s))??null:null}function E(t,n,e){let i=p(n.symbol),s=e.get(n.symbolId);return!i||!s?!1:[...s].some(r=>r!==n.relativePath&&!t.isIgnored(r)&&!P(t,r,i))}function M(t,n){return`${t}\0${n}`}function K(t,n,e){let i=y(t,n);if(!i)return null;let s=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\bexport\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*new\\s+${s}\\s*\\(`);return i.match(r)?.[1]??null}function V(t,n){return new Set(t.scopedDefinitions(n).filter(e=>e.isFunctionLike).map(e=>e.relativePath))}function H(t){let n=I(t);if("kind"in n)return!1;let e=n.descriptors;if(e.length<2)return!1;let i=e[e.length-1],s=e[e.length-2];return i?.suffix==="type"&&s?.suffix==="type"}function T(t){let e=(t.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(e==="types"||e.endsWith("-types")||e==="models"||e==="schema"||e==="common"||e==="protocol"||e==="proto"||e==="dto"||e==="mod"||/(^|\/)types(\/|\.)/.test(t)||/(^|\/)models?(\/|\.)/.test(t)||/(^|\/)proto(?:col)?(\/|\.)/.test(t)||/(^|\/)schema(\/|\.)/.test(t))}function Z(t,n,e){return!(T(t.relativePath)&&n>0||n===0&&e.has(t.relativePath))}function _(t,n,e,i){let s=x(t,n.relativePath),r=p(n.symbol);if(!r)return!1;let c=s.get(r);if(!c||c.size===0)return!1;let l=i.get(n.relativePath);if(!l)return!1;for(let d of c){let a=l.get(d);if(!a)continue;let f=e.get(a.symbolId);if(f){for(let u of f)if(u!==n.relativePath&&!t.isIgnored(u))return!0}}return!1}function w(t,n,e){let i=y(t,n);if(!i)return"other";let s=i.split(`
2
2
  `),r=Math.max(0,e-2),c=Math.min(s.length-1,e+2);for(let l=r;l<=c;l++){let a=(s[l]??"").replace(/^\s*\/\/.*$/g,"");if(/\b(?:export\s+)?(?:abstract\s+)?class\s+\w/.test(a))return"class";if(/\b(?:export\s+)?interface\s+\w/.test(a))return"interface";if(/\b(?:export\s+)?type\s+\w/.test(a))return"type";if(/\b(?:export\s+)?(?:const\s+)?enum\s+\w/.test(a))return"enum"}return"other"}function q(t,n){let e=y(t,n.relativePath);if(!e)return!1;let i=p(n.symbol);if(!i)return!1;let s=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b${s}\\b`),c=e.split(`
3
3
  `);for(let l=0;l<c.length;l++)if(!(l>=n.startLine&&l<=n.endLine)&&r.test(c[l]??""))return!0;return!1}function G(t,n,e){return t===0?{confidence:"high",reason:"unused \u2014 no consumers and defining file has no real usage"}:t===1&&n==="class"?{confidence:"low",reason:"1 consumer + class kind \u2014 likely 1:1 encapsulation, not over-abstraction"}:t===1&&!e?{confidence:"high",reason:"1 consumer + defining file never uses it \u2014 type belongs with its consumer"}:{confidence:"medium",reason:"1 consumer \u2014 single-use abstraction"}}export{ie as a};
4
- //# sourceMappingURL=chunk-OHEIZWIA.js.map
4
+ //# sourceMappingURL=chunk-EDXML2HI.js.map
@@ -1,4 +1,4 @@
1
- import{b as d}from"./chunk-ARBZM2NF.js";import{c as r,t as l}from"./chunk-7OX2O53H.js";function b(t,o={}){let{limit:n=30,scope:e}=o,i=e?`AND def_d.relative_path LIKE '%${e}%'`:"",m=t.all(`SELECT
1
+ import{d}from"./chunk-P3PVY6TX.js";import{c as r,t as l}from"./chunk-4VYIZV3S.js";function b(o,t={}){let{limit:n=30,scope:e}=t,i=e?`AND def_d.relative_path LIKE '%${e}%'`:"",m=o.all(`SELECT
2
2
  gs.symbol,
3
3
  COUNT(*) AS ref_count,
4
4
  COUNT(DISTINCT ref_d.id) AS file_count,
@@ -16,10 +16,10 @@ import{b as d}from"./chunk-ARBZM2NF.js";import{c as r,t as l}from"./chunk-7OX2O5
16
16
  ) sym_def ON sym_def.symbol_id = gs.id
17
17
  JOIN documents def_d ON sym_def.document_id = def_d.id
18
18
  WHERE m.role != 1
19
- ${t.pathExclusionsFor("def_d")}
20
- ${t.symbolNoiseFor("gs")}
19
+ ${o.pathExclusionsFor("def_d")}
20
+ ${o.symbolNoiseFor("gs")}
21
21
  ${i}
22
22
  GROUP BY gs.id
23
23
  ORDER BY ref_count DESC
24
- LIMIT ?`,n).filter(s=>!t.isIgnored(s.defined_in)).map(s=>({symbol:s.symbol,shortName:r(s.symbol),refCount:s.ref_count,fileCount:s.file_count,definedIn:s.defined_in}));return m.length>0?m:f(t,e,n)}function f(t,o,n){return l(t,{scope:o}).filter(e=>!t.isIgnored(e.relativePath)).map(e=>u(t,e)).filter(e=>e.refCount>0).sort((e,i)=>i.refCount-e.refCount||i.fileCount-e.fileCount).slice(0,n)}function u(t,o){let n=d(t,o,{limit:500});return{symbol:o.symbol,shortName:r(o.symbol),refCount:n.length,fileCount:new Set(n.map(e=>e.file)).size,definedIn:o.relativePath}}export{b as a};
25
- //# sourceMappingURL=chunk-23YIGCYF.js.map
24
+ LIMIT ?`,n).filter(s=>!o.isIgnored(s.defined_in)).map(s=>({symbol:s.symbol,shortName:r(s.symbol),refCount:s.ref_count,fileCount:s.file_count,definedIn:s.defined_in}));return m.length>0?m:f(o,e,n)}function f(o,t,n){return l(o,{scope:t}).filter(e=>!o.isIgnored(e.relativePath)).map(e=>u(o,e)).filter(e=>e.refCount>0).sort((e,i)=>i.refCount-e.refCount||i.fileCount-e.fileCount).slice(0,n)}function u(o,t){let n=d(o,t,{limit:500});return{symbol:t.symbol,shortName:r(t.symbol),refCount:n.length,fileCount:new Set(n.map(e=>e.file)).size,definedIn:t.relativePath}}export{b as a};
25
+ //# sourceMappingURL=chunk-EIGCLVKK.js.map
@@ -1,3 +1,3 @@
1
- import{b as D,c as $,d as Q,f as v,g as A,h as N,m as y,n as d,q as w,x as f}from"./chunk-7OX2O53H.js";function re(e,n){let t=Z(e,n.trim());if(t)return t;let i=q(e,n);if(i)return i;let o=F(e,n);return o||j(e,n)}function F(e,n){let t=x(n),i=I(t);if(!i)return null;let o=`%${i.path}%`,r=i.leaf,c=O(e,o,r,t)[0];return c?f(e,c):null}function O(e,n,t,i){let o=w([],[...z(e,n,t),...W(e,n,t)]).filter(r=>!e.isIgnored(r.relative_path)).filter(r=>h(r,i)>1);return o.sort((r,a)=>h(a,i)-h(r,i)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.start_line-a.start_line||r.symbol.localeCompare(a.symbol)),o}function z(e,n,t){return y(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function W(e,n,t){return d(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function j(e,n){let t=x(n),i=U(n),o=H(e,i),r=V(o,n,t);if(r&&!e.isIgnored(r.relative_path))return f(e,r);let a=null;for(let c of o){if(e.isIgnored(c.relative_path))continue;let l=J(c,n,t,i);l<=0||(!a||l>a.score)&&(a={row:c,score:l})}return a?f(e,a.row):null}function q(e,n){let t=n.match(/^(.+):(\d+)-(\d+)$/);if(!t)return null;let[,i,o,r]=t,a=Math.max(0,parseInt(o,10)-1),c=Math.max(a,parseInt(r,10)-1),l=T(e,i,a,c)??X(e,i,a,c);return l&&!e.isIgnored(l.relative_path)?f(e,l):null}function T(e,n,t,i){return y(e,{where:"d.relative_path LIKE ? AND der.start_line <= ? AND der.end_line >= ?",params:[`%${n}%`,t,i],orderBy:"(der.end_line - der.start_line) ASC",limit:1})[0]}function X(e,n,t,i){return d(e,{where:"d.relative_path LIKE ? AND c.start_line <= ? AND c.end_line >= ?",params:[`%${n}%`,t,i],orderBy:"(MAX(c.end_line) - MIN(c.start_line)) ASC",limit:1})[0]}function Z(e,n){let i=y(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, der.start_line",limit:1})[0]??d(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, start_line",limit:1})[0];return!i||e.isIgnored(i.relative_path)?null:f(e,i)}function ae(e,n){if("symbol"in n&&"relativePath"in n)return n;let t=G(e,n.symbolId)[0];return t?f(e,t):null}function G(e,n){let t=y(e,{where:"gs.id = ?",params:[n],orderBy:"der.start_line, der.end_line"}),i=d(e,{where:"gs.id = ?",params:[n],orderBy:"start_line, end_line"});return w(t,i)}function H(e,n){let t=n.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),i=n.flatMap(c=>{let l=`%${c}%`;return[l,l,l]}),o=t.join(`
1
+ import{b as D,c as $,d as Q,f as v,g as A,h as N,m as y,n as d,q as w,x as f}from"./chunk-4VYIZV3S.js";function re(e,n){let t=Z(e,n.trim());if(t)return t;let i=q(e,n);if(i)return i;let o=F(e,n);return o||j(e,n)}function F(e,n){let t=x(n),i=I(t);if(!i)return null;let o=`%${i.path}%`,r=i.leaf,c=O(e,o,r,t)[0];return c?f(e,c):null}function O(e,n,t,i){let o=w([],[...z(e,n,t),...W(e,n,t)]).filter(r=>!e.isIgnored(r.relative_path)).filter(r=>h(r,i)>1);return o.sort((r,a)=>h(a,i)-h(r,i)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.start_line-a.start_line||r.symbol.localeCompare(a.symbol)),o}function z(e,n,t){return y(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function W(e,n,t){return d(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function j(e,n){let t=x(n),i=U(n),o=H(e,i),r=V(o,n,t);if(r&&!e.isIgnored(r.relative_path))return f(e,r);let a=null;for(let c of o){if(e.isIgnored(c.relative_path))continue;let l=J(c,n,t,i);l<=0||(!a||l>a.score)&&(a={row:c,score:l})}return a?f(e,a.row):null}function q(e,n){let t=n.match(/^(.+):(\d+)-(\d+)$/);if(!t)return null;let[,i,o,r]=t,a=Math.max(0,parseInt(o,10)-1),c=Math.max(a,parseInt(r,10)-1),l=T(e,i,a,c)??X(e,i,a,c);return l&&!e.isIgnored(l.relative_path)?f(e,l):null}function T(e,n,t,i){return y(e,{where:"d.relative_path LIKE ? AND der.start_line <= ? AND der.end_line >= ?",params:[`%${n}%`,t,i],orderBy:"(der.end_line - der.start_line) ASC",limit:1})[0]}function X(e,n,t,i){return d(e,{where:"d.relative_path LIKE ? AND c.start_line <= ? AND c.end_line >= ?",params:[`%${n}%`,t,i],orderBy:"(MAX(c.end_line) - MIN(c.start_line)) ASC",limit:1})[0]}function Z(e,n){let i=y(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, der.start_line",limit:1})[0]??d(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, start_line",limit:1})[0];return!i||e.isIgnored(i.relative_path)?null:f(e,i)}function ae(e,n){if("symbol"in n&&"relativePath"in n)return n;let t=G(e,n.symbolId)[0];return t?f(e,t):null}function G(e,n){let t=y(e,{where:"gs.id = ?",params:[n],orderBy:"der.start_line, der.end_line"}),i=d(e,{where:"gs.id = ?",params:[n],orderBy:"start_line, end_line"});return w(t,i)}function H(e,n){let t=n.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),i=n.flatMap(c=>{let l=`%${c}%`;return[l,l,l]}),o=t.join(`
2
2
  AND `),r=y(e,{where:o,params:i,limit:200}),a=d(e,{where:o,params:i,limit:200});return w(r,a)}function J(e,n,t,i){let o=n.trim(),r=t,a=r.replace(/\(\)$/,""),c=n.toLowerCase(),l=t.toLowerCase(),S=l.replace(/\(\)$/,""),k=e.symbol,C=$(e.symbol),b=Q(e.symbol),E=e.display_name??"",g=e.symbol.toLowerCase(),u=C.toLowerCase(),m=b.toLowerCase(),R=E.toLowerCase(),p=e.relative_path.toLowerCase(),K=/[/:.]/.test(t),M=I(t),_=M?.leaf.toLowerCase(),s=0;return(k===o||k===r)&&(s+=1150),(C===o||C===r)&&(s+=1100),E===a&&(s+=1180),b===a&&(s+=1160),(`${b}()`===o||`${b}()`===r)&&(s+=955),(g===c||g===l)&&(s+=1e3),(u===c||u===l)&&(s+=950),(p===c||p===l)&&(s+=925),(p.endsWith(`/${l}`)||p.endsWith(`/${c}`))&&(s+=875),R===S&&(s+=850),m===S&&(s+=825),(`${m}()`===c||`${m}()`===l)&&(s+=820),(u.endsWith(`:${l}`)||u.endsWith(`:${S}`)||u.endsWith(`:${S}()`))&&(s+=800),g.includes(l)&&(s+=120),u.includes(l)&&(s+=140),p.includes(l)&&(s+=140),R.includes(l)&&(s+=110),i.every(B=>{let L=B.toLowerCase();return g.includes(L)||u.includes(L)||p.includes(L)||R.includes(L)})&&(s+=100+i.length*15),M&&p.includes(M.path.toLowerCase())&&(s+=360,_&&(m===_||`${m}()`===_||`${m}()`==`${_}()`)&&(s+=700),v(e.symbol)&&(s+=180)),A(e.symbol)&&m===S&&(s+=60),!K&&N(e.symbol)&&(s-=160),s-=Math.min(50,Math.max(0,e.end_line-e.start_line)),s}function I(e){let n=e.trim().replace(/\\/g,"/"),t=n.lastIndexOf("/");if(t<=0||t===n.length-1)return null;let i=n.slice(t+1).replace(/\(\)$/,"");return!i||i.includes(".")?null:{path:n.slice(0,t),leaf:i}}function x(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function U(e){let n=x(e),t=n.split(/[^A-Za-z0-9_]+/).map(i=>i.trim()).filter(i=>i.length>0);return t.length>0?[...new Set(t)]:[n]}function V(e,n,t){let i=n.trim(),o=e.filter(r=>{let a=$(r.symbol),c=(r.display_name??"").trim();return r.symbol===i||a===i||a===t||c===i||c===t||`${c}()`===i||h(r,t)>1||r.relative_path===i});return o.length===0?null:(o.sort((r,a)=>h(a,t)-h(r,t)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.relative_path.localeCompare(a.relative_path)||r.symbol.localeCompare(a.symbol)),o[0]??null)}function h(e,n){let t=I(n);if(!t)return 0;let i=e.relative_path.toLowerCase(),o=Q(e.symbol).toLowerCase(),r=t.path.toLowerCase(),a=t.leaf.toLowerCase();return i.includes(r)?o!==a?1:v(e.symbol)?D(e.symbol)===null?5:4:D(e.symbol)===null?3:2:0}export{re as a,Z as b,ae as c};
3
- //# sourceMappingURL=chunk-ZNUPGRPR.js.map
3
+ //# sourceMappingURL=chunk-EVXQF7DM.js.map
@@ -0,0 +1,2 @@
1
+ import{c as ae}from"./chunk-MX6F756F.js";import{a as C}from"./chunk-NBUINPSH.js";import{d as A,e as j,f as O,g as B,h as H}from"./chunk-NKJKI6SE.js";import{b as N}from"./chunk-IODTPF5H.js";import{a as K,d as te}from"./chunk-P3PVY6TX.js";import{d as re}from"./chunk-YH6TTQEI.js";import{c as Y,d as Q,e as X,f as Z,h as v,l as ee,m as ne}from"./chunk-4GPWGSOE.js";import{a as R}from"./chunk-5RGK4YA5.js";import{b as T,d as w,e as M}from"./chunk-RCJEFQOK.js";import{v as L,w as _}from"./chunk-BOVNTAKQ.js";import{c as U,f as G,g as W,h as $,i as V,j as q,r as z,s as J,y as h}from"./chunk-4VYIZV3S.js";import{b as I,c as F,h as k,i as E}from"./chunk-5TT47UMX.js";import{a as y}from"./chunk-NN3O7TPH.js";function ie(e){let n=new Map,r=t=>{let a=n.get(t);if(a)return a;let s=K(e,t);return a={ranges:s.map(i=>({startLine:i.startLine,endLine:i.endLine})),containers:new Set(s.map(i=>i.containerName).filter(i=>!!i))},n.set(t,a),a};return(t,a,s,i)=>{let l=r(t);for(let c of l.ranges)if(a>=c.startLine&&a<=c.endLine)return!0;if(i&&l.containers.has(i))return!0;for(let c of h(s))if(l.containers.has(c))return!0;return!1}}function oe(e){N(e),re(e),ee(e)}var Re=[{kind:"symbol-evidence",clearDatabase:oe},{kind:"semantic-provider",clearDatabase:R},{kind:"identifier-index",clearDatabase:Y,clearFile:Q},{kind:"language-parser",clearDatabase:w,clearFile:M},{kind:"source-stripper",clearDatabase:L,clearFile:_},{kind:"ast-tree",clearDatabase:k,clearFile:E},{kind:"source-text",clearDatabase:I,clearFile:F},{kind:"definition-catalog",clearFile:z}],se=["symbol-evidence","identifier-index","language-parser","source-stripper","ast-tree","source-text"],ce=["identifier-index","language-parser","source-stripper","ast-tree","source-text"];function le(e,n){let r=new Set(n.kinds);for(let t of Re)r.has(t.kind)&&(n.scope.kind==="database"?t.clearDatabase?.(e):t.clearFile?.(e,Ce(n.scope.relativePath)))}function en(e,n={}){le(e,{scope:{kind:"database"},kinds:n.semanticProvider===!0?[...se,"semantic-provider"]:se})}function D(e,n,r={}){le(e,{scope:{kind:"file",relativePath:n},kinds:r.definitions===!0?[...ce,"definition-catalog"]:ce})}function Ce(e){return e.replace(/\\/g,"/")}function de(e,n){return n.isIgnoredPath(e.relativePath)?m("ignored-file"):$(e.symbol)?m("module-like-symbol"):ue(e.symbol)?!e.isFunctionLike&&e.enclosingSymbol&&ue(e.enclosingSymbol)?m("nested-non-callable-value"):!n.includeTests&&!x(e.relativePath)?m("test-file"):!n.includeTests&&n.isExcludedRegion(e.relativePath,e.startLine,e.symbol,e.parentTypeName)?m("excluded-file-region"):V(e.symbol)?m("rust-trait-impl-member"):q(e.symbol)?m("rust-test-module"):!n.includeMembers&&!xe(e)?m("member"):e.endLine-e.startLine+1<n.minLoc?m("below-min-loc"):{accepted:!0}:m("non-value-symbol")}function x(e){return[...new Set([...B,...H])].every(r=>!De(e,r))}function m(e){return{accepted:!1,rejectionReason:e}}function De(e,n){return new RegExp(`^${n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/%/g,".*").replace(/_/g,".")}$`).test(e)}function ue(e){return W(e)||e.endsWith("().")||e.endsWith(".")}function xe(e){return G(e.symbol)||h(e.symbol).length===0}function me(){return new Map}function fe(e,n,r){let t=new Map;for(let a of X(e,r))e.isIgnored(a.relative_path)||n.has(a.relative_path)||S(t,a.symbol_id,a.relative_path,a.ref_count,"scip-mention");return t}function pe(e,n,r){let t=new Set;for(let a of Z(e,n))e.isIgnored(a.relative_path)||r.has(a.relative_path)||t.add(a.symbol_id);return t}function P(e,n){let r=e.get(n);if(!r)return!1;for(let t of r.values())if(t.occurrences>0)return!0;return!1}function ge(e){return e?.occurrences??0}function S(e,n,r,t,a="source-fallback"){if(t<=0)return;let s=ye(e,n,r);s.occurrences+=t,s.sources.add(a)}function be(e,n,r,t,a){if(t<=0)return;let s=ye(e,n,r);s.occurrences=Math.max(t,s.occurrences),s.sources.add(a)}function ye(e,n,r){let t=e.get(n);t||(t=new Map,e.set(n,t));let a=t.get(r);return a||(a={occurrences:0,sources:new Set},t.set(r,a)),a}function Dn(e,n={}){let{scope:r,minLoc:t=1,includeTests:a=!1,skipBarrels:s=!1,includeMembers:i=!1,deadCodeOnly:l=!1,scanLimit:c,semantic:d=!0}=n,o=ae(Pe(e,{scope:r,minLoc:t,includeTests:a,includeMembers:i}),c),u=s?new Set(A(e)):new Set,p=l?me():fe(e,u,o.map(f=>f.symbolId)),g=l?pe(e,o.map(f=>f.symbolId),u):new Set,b=l?o.filter(f=>!g.has(f.symbolId)):o;l?ke(e,b,p,u):_e(e,b,p,u);let Se=l?b.filter(f=>!P(p,f.symbolId)):o;Ne(e,Se,p,{includeTests:a,inactiveBarrelPaths:u,includeSemantic:!l&&d});let ve=l?b.filter(f=>!P(p,f.symbolId)):o;return Le(e,Ie(ve,p))}function Pe(e,n){let r=ie(e),t=[];for(let a of y(e,{scope:n.scope}))try{for(let s of J(e,a))de(s,{minLoc:n.minLoc,includeTests:n.includeTests,includeMembers:n.includeMembers,isIgnoredPath:l=>e.isIgnored(l),isExcludedRegion:r}).accepted&&t.push(s)}finally{D(e,a,{definitions:!0})}return t}function Ie(e,n){return e.map(r=>Fe(r,n)).filter(r=>r.cross_file_refs===0).sort((r,t)=>t.loc-r.loc||r.relative_path.localeCompare(t.relative_path)||r.start_line-t.start_line)}function Fe(e,n){let r=n.get(e.symbolId)??new Map,t=ge(r.get(e.relativePath)),a=0;for(let[s,i]of r)s!==e.relativePath&&(a+=i.occurrences);return{relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine,loc:e.endLine-e.startLine+1,symbol:e.symbol,same_file_refs:t,cross_file_refs:a}}function Le(e,n){let r=[],t=0,a=0,s=0;for(let i of n){if(e.isIgnored(i.relative_path)||j(e,i.relative_path)||O(e,i.symbol,i.relative_path))continue;let l=i.same_file_refs===0?"dead-code":"file-internal";l==="dead-code"?t++:a++,s+=i.loc,r.push({relativePath:i.relative_path,startLine:i.start_line,endLine:i.end_line,loc:i.loc,symbol:i.symbol,shortName:U(i.symbol),sameFileRefs:i.same_file_refs,kind:l})}return{symbols:r,totalCount:r.length,deadCodeCount:t,fileInternalCount:a,totalLoc:s}}function _e(e,n,r,t){if(n.length===0)return;let a=new C(e),s=new Set(n.map(c=>c.symbolId)),i=new Set(n.map(c=>c.leaf).filter(Boolean)),l=new Set(a.sourceFiles());for(let c of y(e))l.add(c);a.scanSourceReferences({paths:l,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:i,skipPath:c=>t.has(c)},c=>{s.has(c.target.symbolId)&&(we(e,c)||S(r,c.target.symbolId,c.sourceFile,Me(c),"source-fallback"))})}function ke(e,n,r,t){if(n.length===0)return;let a=new C(e),s=Ee(n),i=new Set(a.sourceFiles());for(let o of y(e))i.add(o);let l=new Set(s.keys()),c=new Map,d=o=>{let u=c.get(o);return u||(u=ne(e,o),c.set(o,u)),u};a.scanSourceReferences({paths:i,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:l,skipPath:o=>t.has(o),resolveTargets:({sourceFile:o,name:u,kind:p})=>{let g=s.get(u);return g?Te(o,u,g,d(o),{permissive:p!=="cross-language-dispatch"}):[]},afterPath:o=>{c.delete(o),D(e,o)}},o=>{let u=o.kind==="identifier"&&o.sourceFile===o.target.relativePath?Math.max(0,o.occurrences-1):o.occurrences;o.kind==="identifier"&&he(e,{sourceFile:o.sourceFile,name:o.name,target:o.target,occurrences:u})||S(r,o.target.symbolId,o.sourceFile,u,"source-fallback")})}function Ee(e){let n=new Map;for(let r of e){if(!r.leaf)continue;let t=n.get(r.leaf)??[];t.push(r),n.set(r.leaf,t)}return n}function Te(e,n,r,t,a){let s=r.filter(c=>c.relativePath===e);if(s.length>0)return s;let i=t.get(n);if(i)for(let c of i){let d=r.filter(o=>v(c,o.relativePath));if(d.length>0)return d}let l=new Set;for(let c of t.values())for(let d of c)l.add(d);for(let c of l){let d=r.filter(o=>v(c,o.relativePath));if(d.length>0&&d.length===r.length)return d}return a.permissive?[...r]:[]}function we(e,n){return n.kind==="cross-language-dispatch"&&n.target.relativePath===n.sourceFile?!0:n.kind==="identifier"&&he(e,n)}function Me(e){return e.kind==="identifier"&&e.target.relativePath===e.sourceFile?Math.max(0,e.occurrences-1):e.occurrences}function he(e,n){return n.occurrences>1?!1:T(e,n.sourceFile).some(r=>r.used||r.sourcePath!==n.target.relativePath?!1:r.importedName===n.name||r.localName===n.name)}function Ne(e,n,r,t){for(let a of n){let s=te(e,a,{semantic:t.includeSemantic!==!1});if(s.length!==0)for(let i of s){let l=i.file;l===a.relativePath||e.isIgnored(l)||t.inactiveBarrelPaths.has(l)||!t.includeTests&&!x(l)||be(r,a.symbolId,l,1,"caller-map")}}}export{en as a,Dn as b};
2
+ //# sourceMappingURL=chunk-EZQOVY3C.js.map
@@ -1,4 +1,4 @@
1
- import{a as g}from"./chunk-DFK54IRN.js";import{b as u}from"./chunk-7O4MJYIW.js";import{a as p}from"./chunk-ZNUPGRPR.js";import{b as a}from"./chunk-RCJEFQOK.js";import{c as l,d as c,h as f}from"./chunk-7OX2O53H.js";import{a as d}from"./chunk-NN3O7TPH.js";function J(e,s,t={}){return I(e,s,t)?.map(r=>({symbol:r.symbol,shortName:r.shortName,fromFile:r.fromFile}))??[]}function P(e,s){let t=N(e,s);return t.length>0?t:E(e,s)}function v(e,s,t={}){return I(e,s,t)?.filter(r=>!r.used).map(r=>({symbol:r.symbol,shortName:r.shortName,importedIn:r.importer}))??[]}function N(e,s){return e.all(`SELECT DISTINCT gs.symbol, d.relative_path AS importer
1
+ import{a as g}from"./chunk-SDPP5KVQ.js";import{b as u}from"./chunk-5RGK4YA5.js";import{a as p}from"./chunk-EVXQF7DM.js";import{b as a}from"./chunk-RCJEFQOK.js";import{c as l,d as c,h as f}from"./chunk-4VYIZV3S.js";import{a as d}from"./chunk-NN3O7TPH.js";function J(e,s,t={}){return I(e,s,t)?.map(r=>({symbol:r.symbol,shortName:r.shortName,fromFile:r.fromFile}))??[]}function P(e,s){let t=N(e,s);return t.length>0?t:E(e,s)}function v(e,s,t={}){return I(e,s,t)?.filter(r=>!r.used).map(r=>({symbol:r.symbol,shortName:r.shortName,importedIn:r.importer}))??[]}function N(e,s){return e.all(`SELECT DISTINCT gs.symbol, d.relative_path AS importer
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents d ON c.document_id = d.id
@@ -32,4 +32,4 @@ import{a as g}from"./chunk-DFK54IRN.js";import{b as u}from"./chunk-7O4MJYIW.js";
32
32
  WHERE imp_d.relative_path = ?
33
33
  AND m.role = 2
34
34
  ORDER BY def_d.relative_path, gs.symbol`,s).filter(m=>!e.isIgnored(m.importer));if(o.length>0){let m=t.semantic===!1?[]:u(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(n=>n.isUsed&&n.sourcePath===i.from_file)}))}return null}function F(e,s){let t=u(e,s);return t.length>0?t.map(r=>{let o=h(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 O(e,s){return a(e,s).map(t=>{let r=h(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 h(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 b(e){return e.replace(/\\/g,"/")}function R(e){return/\.(?:c|h|cc|cpp|cxx|hpp|hh|hxx)$/i.test(e)}export{J as a,P as b,v as c};
35
- //# sourceMappingURL=chunk-563HLCDW.js.map
35
+ //# sourceMappingURL=chunk-FU5WRWAN.js.map
@@ -1,4 +1,4 @@
1
- import{a as s}from"./chunk-DFK54IRN.js";function m(e,d){let i=s(e,d);return i?e.all(`SELECT DISTINCT d2.relative_path
1
+ import{a as s}from"./chunk-SDPP5KVQ.js";function m(e,d){let i=s(e,d);return i?e.all(`SELECT DISTINCT d2.relative_path
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents d1 ON c.document_id = d1.id
@@ -30,4 +30,4 @@ import{a as s}from"./chunk-DFK54IRN.js";function m(e,d){let i=s(e,d);return i?e.
30
30
  WHERE d2.relative_path = ?
31
31
  AND d1.relative_path != ?
32
32
  ORDER BY d1.relative_path`,i,i).filter(t=>!e.isIgnored(t.relative_path)).map(t=>({relativePath:t.relative_path})):[]}export{m as a,o as b};
33
- //# sourceMappingURL=chunk-4STLJYHI.js.map
33
+ //# sourceMappingURL=chunk-GIRI7FHW.js.map
@@ -1,2 +1,2 @@
1
- import{a as o,c as p}from"./chunk-MX6F756F.js";import{b as y}from"./chunk-QAEDNTY7.js";import{c as b}from"./chunk-7OX2O53H.js";function P(u,c={}){let{scope:f,minLoc:L=3,scanLimit:l}=c,s=new y(u),r=c.semantic!==!1,t=p(s.productionCallableDefinitions({scope:f,minLoc:L,excludeEntrySurfaces:!0,excludeRustTraitImplMembers:!0,includeSuppressed:!0,sortByLocDesc:typeof l=="number"&&l>0}),l),h=s.crossFileCallerMap(t,{semantic:r}),a=new Set(h.keys());for(let e of s.frameworkReferencedSymbolIds(t))a.add(e);let n=s.symbolsWithNonSelfCallees(t,{additive:!1,semantic:r}),m=t.filter(e=>!a.has(e.symbolId)).filter(e=>!n.has(e.symbolId)),I=s.sourceFallbackCallerFiles(m);for(let e of I.keys())a.add(e);let d=m.filter(e=>!a.has(e.symbolId)),C=s.symbolsWithNonSelfCallees(d,{additive:!0,semantic:r});for(let e of C)n.add(e);return d.filter(e=>!n.has(e.symbolId)).sort((e,i)=>o(i)-o(e)||e.relativePath.localeCompare(i.relativePath)||e.startLine-i.startLine).map(e=>({symbol:e.symbol,shortName:b(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:o(e)}))}export{P as a};
2
- //# sourceMappingURL=chunk-A2AVLALL.js.map
1
+ import{a as o,c as p}from"./chunk-MX6F756F.js";import{a as y}from"./chunk-NBUINPSH.js";import{c as b}from"./chunk-4VYIZV3S.js";function P(u,c={}){let{scope:f,minLoc:L=3,scanLimit:l}=c,s=new y(u),r=c.semantic!==!1,t=p(s.productionCallableDefinitions({scope:f,minLoc:L,excludeEntrySurfaces:!0,excludeRustTraitImplMembers:!0,includeSuppressed:!0,sortByLocDesc:typeof l=="number"&&l>0}),l),h=s.crossFileCallerMap(t,{semantic:r}),a=new Set(h.keys());for(let e of s.frameworkReferencedSymbolIds(t))a.add(e);let n=s.symbolsWithNonSelfCallees(t,{additive:!1,semantic:r}),m=t.filter(e=>!a.has(e.symbolId)).filter(e=>!n.has(e.symbolId)),I=s.sourceFallbackCallerFiles(m);for(let e of I.keys())a.add(e);let d=m.filter(e=>!a.has(e.symbolId)),C=s.symbolsWithNonSelfCallees(d,{additive:!0,semantic:r});for(let e of C)n.add(e);return d.filter(e=>!n.has(e.symbolId)).sort((e,i)=>o(i)-o(e)||e.relativePath.localeCompare(i.relativePath)||e.startLine-i.startLine).map(e=>({symbol:e.symbol,shortName:b(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:o(e)}))}export{P as a};
2
+ //# sourceMappingURL=chunk-HTVLH3NL.js.map
@@ -1,4 +1,4 @@
1
- import{r as f}from"./chunk-JB4PUN5S.js";import{a as d}from"./chunk-ZNUPGRPR.js";import{c as s,g as u,o as m,p as g}from"./chunk-7OX2O53H.js";import{a as c}from"./chunk-5TT47UMX.js";function E(e,r,i={}){let n=d(e,r);if(!n)return{definitions:[],referencedBy:[]};let t=e.get("SELECT display_name, documentation FROM global_symbols WHERE id = ?",n.symbolId),a=g(t?.documentation??null),o=e.isIgnored(n.relativePath)?[]:[{relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,signature:y(a,t?.display_name??null,n.symbol),source:S(e,n.relativePath,n.startLine,n.endLine)}],b=f(e,n,{semantic:i.semantic}).map(l=>({relativePath:l.file,line:l.line,enclosingSymbol:l.enclosingSymbol,enclosingShort:l.enclosingSymbol?s(l.enclosingSymbol):"(top-level)"}));return{definitions:o,referencedBy:b}}function S(e,r,i,n){let t=c(e,r);if(!t)return null;let o=t.split(`
1
+ import{r as f}from"./chunk-4GPWGSOE.js";import{a as d}from"./chunk-EVXQF7DM.js";import{c as s,g as u,o as m,p as g}from"./chunk-4VYIZV3S.js";import{a as c}from"./chunk-5TT47UMX.js";function E(e,r,i={}){let n=d(e,r);if(!n)return{definitions:[],referencedBy:[]};let t=e.get("SELECT display_name, documentation FROM global_symbols WHERE id = ?",n.symbolId),a=g(t?.documentation??null),o=e.isIgnored(n.relativePath)?[]:[{relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,signature:y(a,t?.display_name??null,n.symbol),source:S(e,n.relativePath,n.startLine,n.endLine)}],b=f(e,n,{semantic:i.semantic}).map(l=>({relativePath:l.file,line:l.line,enclosingSymbol:l.enclosingSymbol,enclosingShort:l.enclosingSymbol?s(l.enclosingSymbol):"(top-level)"}));return{definitions:o,referencedBy:b}}function S(e,r,i,n){let t=c(e,r);if(!t)return null;let o=t.split(`
2
2
  `).slice(i,n+1).join(`
3
3
  `).trimEnd();return o.length>0?o:null}function y(e,r,i){let n=m(e);if(n&&!p(n))return n;let t=(r??"").trim();return t?u(i)&&!t.endsWith("()")?`${t}()`:t:s(i)}function p(e){return e.startsWith("undefined")||e.includes("|")||e.includes("```")}export{E as a};
4
- //# sourceMappingURL=chunk-J6Z5YKGQ.js.map
4
+ //# sourceMappingURL=chunk-IFGEPTH5.js.map
@@ -0,0 +1,2 @@
1
+ import{d as m}from"./chunk-MX6F756F.js";import{d as b}from"./chunk-P3PVY6TX.js";import{a as g}from"./chunk-YH6TTQEI.js";import{r as y}from"./chunk-4GPWGSOE.js";import{a as c}from"./chunk-EVXQF7DM.js";import{c as r}from"./chunk-4VYIZV3S.js";function v(l,t,n={}){let o=c(l,t);if(!o)return null;let a=[{file:o.relativePath,line:o.startLine}],s=y(l,o,{semantic:n.semantic}).map(e=>({file:e.file,line:e.line,enclosingSymbol:e.enclosingSymbol??"(top-level)",enclosingShort:e.enclosingSymbol?r(e.enclosingSymbol):"(top-level)"})),{producers:f,consumers:i}=S(l,o,s,{semantic:n.semantic!==!1});return{symbol:o.symbol,shortName:r(o.symbol),relativePath:o.relativePath,definitionSites:a.filter(e=>!l.isIgnored(e.file)),usageSites:s,producers:f.filter(e=>!l.isIgnored(e.file)).map(e=>({symbol:e.symbol,shortName:r(e.symbol),file:e.file})),consumers:i.filter(e=>!l.isIgnored(e.file)).map(e=>({symbol:e.symbol,shortName:e.symbol===e.file?"(top-level)":r(e.symbol),file:e.file}))}}function S(l,t,n,o){let a=m(g(l,t,{limit:30,semantic:o.semantic}).map(i=>({symbol:i.symbol,file:i.file}))),s=m(b(l,t,{limit:30,semantic:o.semantic})),f=s.length>0?s:m(n.map(i=>({symbol:i.enclosingSymbol==="(top-level)"?i.file:i.enclosingSymbol,file:i.file})));return{producers:a,consumers:f}}export{v as a};
2
+ //# sourceMappingURL=chunk-JDFWJ7VK.js.map
@@ -1,7 +1,7 @@
1
- import{b as u}from"./chunk-QAEDNTY7.js";import{a as b}from"./chunk-ZNUPGRPR.js";import{t as l}from"./chunk-BOVNTAKQ.js";import{c as m}from"./chunk-7OX2O53H.js";import{readFileSync as p}from"fs";import{join as h}from"path";function O(e,n,r={}){let t=b(e,n);if(!t)return null;let c=new u(e),o=P(d(e,t.relativePath,t.startLine,t.endLine),y(e,t.relativePath)),s=t.endLine-t.startLine+1,a=c.calleeMap([t],{additive:!0,semantic:r.semantic}).get(t.symbolId)??[],f=new Set(a.map(g=>g.symbol));return{symbol:t.symbol,shortName:m(t.symbol),relativePath:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:s,branches:o,cyclomaticEstimate:o+1,calleeCount:f.size,fanIn:S(e,t.symbolId),fanOut:L(a,t.relativePath)}}function y(e,n){return e.get("SELECT language FROM documents WHERE relative_path = ?",n)?.language??"unknown"}function d(e,n,r,t){try{return p(h(e.config.projectRoot,n),"utf-8").split(`
1
+ import{a as u}from"./chunk-NBUINPSH.js";import{a as b}from"./chunk-EVXQF7DM.js";import{t as l}from"./chunk-BOVNTAKQ.js";import{c as m}from"./chunk-4VYIZV3S.js";import{readFileSync as p}from"fs";import{join as h}from"path";function O(e,n,r={}){let t=b(e,n);if(!t)return null;let c=new u(e),o=P(d(e,t.relativePath,t.startLine,t.endLine),y(e,t.relativePath)),s=t.endLine-t.startLine+1,a=c.calleeMap([t],{additive:!0,semantic:r.semantic}).get(t.symbolId)??[],f=new Set(a.map(g=>g.symbol));return{symbol:t.symbol,shortName:m(t.symbol),relativePath:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:s,branches:o,cyclomaticEstimate:o+1,calleeCount:f.size,fanIn:S(e,t.symbolId),fanOut:L(a,t.relativePath)}}function y(e,n){return e.get("SELECT language FROM documents WHERE relative_path = ?",n)?.language??"unknown"}function d(e,n,r,t){try{return p(h(e.config.projectRoot,n),"utf-8").split(`
2
2
  `).slice(r,t+1).join(`
3
3
  `)}catch{return""}}function S(e,n){return e.get(`SELECT COUNT(DISTINCT c.document_id) AS c
4
4
  FROM mentions m
5
5
  JOIN chunks c ON m.chunk_id = c.id
6
6
  WHERE m.symbol_id = ? AND m.role != 1`,n)?.c??0}function L(e,n){return new Set(e.filter(r=>r.file!==n).map(r=>r.symbol)).size}function P(e,n){let r=l(e),t=0,c=[/\bif\b/g,/\belse\s+if\b/g,/\belse\b/g,/\bfor\b/g,/\bwhile\b/g,/\bswitch\b/g,/\bcase\b/g,/\bcatch\b/g,/\?\s*[^?]/g,/&&/g,/\|\|/g];for(let o of c){let s=r.match(o);s&&(t+=s.length)}if(n==="python"){let o=[/\belif\b/g,/\bexcept\b/g,/\bfinally\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}else if(n==="rust"){let o=[/\bmatch\b/g,/=>/g,/\bloop\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}else if(n==="ruby"){let o=[/\belsif\b/g,/\bunless\b/g,/\brescue\b/g,/\bwhen\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}else if(n==="go"){let o=[/\bselect\b/g,/\bdefer\b/g];for(let s of o){let i=r.match(s);i&&(t+=i.length)}}return t}export{O as a};
7
- //# sourceMappingURL=chunk-33SSUPCB.js.map
7
+ //# sourceMappingURL=chunk-LLL7THVV.js.map