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,4 +1,4 @@
1
- import{b as N}from"./chunk-ARBZM2NF.js";import{a as I,b as S}from"./chunk-ZNUPGRPR.js";import{c as h,e as b,s as p,w as g}from"./chunk-7OX2O53H.js";function x(o,s,r={}){let{maxDepth:c=5,scope:a}=r,l=I(o,s);if(!l)return[];let u=[],f=new Set([l.symbolId]),m=new Set,t=[l];for(let e=1;e<=c&&t.length!==0;e++){let i=[];for(let y of t)for(let n of D(o,y,a)){let d=`${n.file}|${n.shortName}`;if(n.symbolId!==null){if(f.has(n.symbolId))continue;f.add(n.symbolId)}else if(m.has(d))continue;m.add(d),u.push({symbol:n.symbol,shortName:n.shortName,file:n.file,depth:e}),n.symbolId!==null&&n.symbolMatch&&i.push(n.symbolMatch)}t=i}return u.sort((e,i)=>e.depth-i.depth||e.file.localeCompare(i.file)),u}function D(o,s,r){let c=N(o,s,{limit:500}).filter(t=>!o.isIgnored(t.file)).filter(t=>!r||t.file.includes(r)),a=new Set(c.map(t=>t.file)),l=[];for(let t of M(o,s,r)){if(a.has(t))continue;let e=p(o,t),i=e.length>0?g(e,e[0].startLine):null;l.push({symbol:i?.symbol??t,file:t})}let u=[...c,...l],f=[],m=new Set;for(let t of u){let e=S(o,t.symbol);if(!e){let y=`${t.file}|${t.symbol}`;if(m.has(y))continue;m.add(y),f.push({symbolId:null,symbol:t.symbol,shortName:h(t.symbol),file:t.file,symbolMatch:null});continue}if(e.symbolId===s.symbolId||o.isIgnored(e.relativePath)||!_(e.symbol))continue;let i=`${e.symbolId}|${e.relativePath}`;m.has(i)||(m.add(i),f.push({symbolId:e.symbolId,symbol:e.symbol,shortName:h(e.symbol),file:e.relativePath,symbolMatch:e}))}return f}function M(o,s,r){let c=r?"AND consumer_d.relative_path LIKE ?":"",a=[s.symbolId,s.documentId];return r&&a.push(`%${r}%`),new Set(o.all(`SELECT DISTINCT consumer_d.relative_path
1
+ import{d as N}from"./chunk-P3PVY6TX.js";import{a as I,b as S}from"./chunk-EVXQF7DM.js";import{c as h,e as b,s as p,w as g}from"./chunk-4VYIZV3S.js";function x(o,s,r={}){let{maxDepth:c=5,scope:a}=r,l=I(o,s);if(!l)return[];let u=[],f=new Set([l.symbolId]),m=new Set,t=[l];for(let e=1;e<=c&&t.length!==0;e++){let i=[];for(let y of t)for(let n of D(o,y,a)){let d=`${n.file}|${n.shortName}`;if(n.symbolId!==null){if(f.has(n.symbolId))continue;f.add(n.symbolId)}else if(m.has(d))continue;m.add(d),u.push({symbol:n.symbol,shortName:n.shortName,file:n.file,depth:e}),n.symbolId!==null&&n.symbolMatch&&i.push(n.symbolMatch)}t=i}return u.sort((e,i)=>e.depth-i.depth||e.file.localeCompare(i.file)),u}function D(o,s,r){let c=N(o,s,{limit:500}).filter(t=>!o.isIgnored(t.file)).filter(t=>!r||t.file.includes(r)),a=new Set(c.map(t=>t.file)),l=[];for(let t of M(o,s,r)){if(a.has(t))continue;let e=p(o,t),i=e.length>0?g(e,e[0].startLine):null;l.push({symbol:i?.symbol??t,file:t})}let u=[...c,...l],f=[],m=new Set;for(let t of u){let e=S(o,t.symbol);if(!e){let y=`${t.file}|${t.symbol}`;if(m.has(y))continue;m.add(y),f.push({symbolId:null,symbol:t.symbol,shortName:h(t.symbol),file:t.file,symbolMatch:null});continue}if(e.symbolId===s.symbolId||o.isIgnored(e.relativePath)||!_(e.symbol))continue;let i=`${e.symbolId}|${e.relativePath}`;m.has(i)||(m.add(i),f.push({symbolId:e.symbolId,symbol:e.symbol,shortName:h(e.symbol),file:e.relativePath,symbolMatch:e}))}return f}function M(o,s,r){let c=r?"AND consumer_d.relative_path LIKE ?":"",a=[s.symbolId,s.documentId];return r&&a.push(`%${r}%`),new Set(o.all(`SELECT DISTINCT consumer_d.relative_path
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents consumer_d ON consumer_d.id = c.document_id
@@ -7,4 +7,4 @@ import{b as N}from"./chunk-ARBZM2NF.js";import{a as I,b as S}from"./chunk-ZNUPGR
7
7
  AND c.document_id != ?
8
8
  ${o.pathExclusionsFor("consumer_d")}
9
9
  ${c}`,...a).map(l=>l.relative_path).filter(l=>!o.isIgnored(l)))}function _(o){let s=b(o);return s==="method"||s==="type"||o.endsWith("().")}export{x as a};
10
- //# sourceMappingURL=chunk-72JOIFXL.js.map
10
+ //# sourceMappingURL=chunk-LXJTDFOV.js.map
@@ -0,0 +1,2 @@
1
+ import{a as h,e as M}from"./chunk-NKJKI6SE.js";import{a as v}from"./chunk-IODTPF5H.js";import{b as p,c as P,e as _,f as j,g as G}from"./chunk-P3PVY6TX.js";import{c as O}from"./chunk-YH6TTQEI.js";import{a as B,n as R,o as K}from"./chunk-4GPWGSOE.js";import{c as T}from"./chunk-KJ6CW6EK.js";import{f as N,g as k,i as A,j as w,s as E,u as q}from"./chunk-4VYIZV3S.js";import{d as S,e as d,f as L,g as x,j as F}from"./chunk-5TT47UMX.js";import{a as D}from"./chunk-NN3O7TPH.js";var V=new WeakMap;function $(i,e,o,s){let t=d(e);if(!t)return null;let n=F(i,e);if(!n)return null;let a=V.get(n);return a||(a=U(n,t),V.set(n,a)),a.get(`${o}:${s}`)??null}function U(i,e){let o=x(e),s=new Map,t=n=>{if(o.has(n.type)){let a=n.namedChildren.find(r=>r.type==="parameters"||r.type==="formal_parameters"),c=0;if(a)for(let r of a.namedChildren)r.type==="comment"||r.type==="line_comment"||r.type==="block_comment"||(c+=1);s.set(`${n.startPosition.row}:${n.endPosition.row}`,{paramCount:c})}for(let a of n.children)t(a)};return t(i.rootNode),s}function H(i,e,o){let s=e.identifierResolution==="strict"?R:K;for(let t of e.paths){let n=d(t);if(!(!n&&!(e.includeVueSfc&&L(t)))&&!i.isIgnored(t)&&!e.skipPath?.(t))try{let a=(r,f,y,b)=>{if(e.candidateNames&&!e.candidateNames.has(r))return;let g=e.resolveTargets?e.resolveTargets({sourceFile:t,name:r,kind:f,defaultTargets:b}):b();for(let m of g)o({sourceFile:t,name:r,target:m,occurrences:y,kind:f})},c=B(i,t);for(let[r,f]of c)a(r,"identifier",f.length,()=>s(i,t,r));if(e.includeCrossLanguageDispatchNames)for(let r of P(i,t))a(r,"cross-language-dispatch",1,()=>R(i,t,r));if(e.includeRustAttributeNames&&n==="rust")for(let r of p(i,t))a(r,"rust-attribute",1,()=>s(i,t,r))}finally{e.afterPath?.(t)}}}var W=class{constructor(e){this.db=e}db;scopedDefinitions(e){return q(this.db,e)}definitionsForFile(e){return E(this.db,e)}productionCallableDefinitions(e={}){let{scope:o,minLoc:s=1,maxLoc:t=Number.POSITIVE_INFINITY,excludeSymbol:n,excludeEntrySurfaces:a=!1,excludeTypesFiles:c=!1,requireFunctionLikeSymbol:r=!1,requireCallableSymbol:f=!1,excludeRustTraitImplMembers:y=!1,includeSuppressed:b=!1,sortByLocDesc:g=!1}=e,m=[];for(let l of this.scopedDefinitions(o)){let u=l.relativePath;if(this.db.isIgnored(u)||a&&M(this.db,u)||!Y(l,{requireFunctionLikeSymbol:r,requireCallableSymbol:f})||n!==void 0&&l.symbol===n)continue;let C=I(l);C<s||C>t||c&&z(u)||y&&A(l.symbol)||h(u)!=="test"&&(w(l.symbol)||!b&&S(this.db,u,l.startLine)||m.push(l))}return g?m.sort((l,u)=>I(u)-I(l)):m}calleeMap(e,o={}){return O(this.db,e,o)}crossFileCallerMap(e,o={}){return _(this.db,e,o)}sourceFallbackCallerFiles(e){return j(this.db,e)}callerFileMap(e,o={}){return G(this.db,e,o)}frameworkReferencedSymbolIds(e){let o=new Map;for(let t of e){if(!t.leaf)continue;let n=o.get(t.leaf)??[];n.push(t.symbolId),o.set(t.leaf,n)}let s=new Set;for(let t of D(this.db,{includeIgnored:!1}))if(d(t)==="rust")for(let n of p(this.db,t))for(let a of o.get(n)??[])s.add(a);return s}symbolsWithNonSelfCallees(e,o={}){if(e.length===0)return new Set;let s=new Map(e.map(n=>[n.symbolId,n.symbol])),t=this.calleeMap(e,o);return new Set([...t.entries()].filter(([n,a])=>{let c=s.get(n);return a.some(r=>r.symbol!==c)}).map(([n])=>n))}fileDependencyGraph(e){return v(this.db,e)}fileKind(e){return h(e)}hasSuppressionComment(e){return S(this.db,e.relativePath,e.startLine)}sourceFiles(){return T(this.db)}scanSourceReferences(e,o){H(this.db,e,o)}callableSignature(e){return $(this.db,e.relativePath,e.startLine,e.endLine)}};function Y(i,e){return e.requireCallableSymbol?N(i.symbol):e.requireFunctionLikeSymbol?k(i.symbol):i.isFunctionLike}function I(i){return i.endLine-i.startLine+1}function z(i){return(i.split("/").pop()??"").includes("types")}export{W as a};
2
+ //# sourceMappingURL=chunk-NBUINPSH.js.map
@@ -1,4 +1,4 @@
1
- import{b as m}from"./chunk-QAEDNTY7.js";import{a as S}from"./chunk-NKJKI6SE.js";import{b as h}from"./chunk-7O4MJYIW.js";import{b as d}from"./chunk-RCJEFQOK.js";import{a as y}from"./chunk-NN3O7TPH.js";import f from"path";function l(e){let n=e.replace(/\\/g,"/").split("/").filter(Boolean);return n.length<=1?"(root)":n.length>=3&&["src","lib","app","server","client"].includes(n[0])?`${n[0]}/${n[1]}`:n[0]}function p(e,t){if(e===t)return"ok";let n=g(e),i=g(t);return n&&i?v(n,i)?"ok":"violation":w(e,t)}function D(e,t){let n=g(l(e)),i=g(l(t));return!!n&&!!i}function g(e){return/^src\/([^/]+)$/.exec(e)?.[1]??null}function v(e,t){return t==="domain"?!0:e==="domain"?!1:{analysis:new Set(["domain","source","storage","symbols"]),core:new Set(["analysis","domain","resolution","source","storage","symbols"]),"language-parsers":new Set(["domain","resolution","source","storage"]),queries:new Set(["analysis","core","domain","language-parsers","resolution","semantic","source","storage","symbols"]),reindex:new Set(["domain","language-parsers","resolution","runtime","semantic","source","storage","symbols"]),resolution:new Set(["domain","source","storage","symbols"]),runtime:new Set(["domain","queries","reindex","resolution","semantic","source","storage","symbols"]),semantic:new Set(["domain","resolution","storage","symbols"]),source:new Set(["domain","storage"]),storage:new Set(["domain","source"]),symbols:new Set(["analysis","domain","language-parsers","resolution","semantic","source","storage"])}[e]?.has(t)??!1}function w(e,t){if(t==="shared")return"ok";let n={app:new Set(["core","shared","ui"]),core:new Set(["shared"]),infra:new Set(["core","shared"]),ui:new Set(["core","shared"])};return n[e]?n[e].has(t)?"ok":"violation":null}function G(e,t){let{scope:n,minDeviation:i=5}=t??{},r=t?.semantic!==!1,c=new m(e).fileDependencyGraph(n),a=O(e,n);return _([...R(e,c,a,{semantic:r}),...k(c),...I(c,i)])}function R(e,t,n,i){let r=[];for(let[s,c]of t){if(u(s))continue;let a=n.get(s)??new Set;for(let o of c)if(!u(o)&&!a.has(o)){if(i.semantic&&L(e,s,o)||A(e,s,o)||T(e,s,o)||F(o)||j(e,s,o)||V(o))continue;r.push({file:s,kind:"unused-import",description:`Depends on ${o} but references none of its symbols`,dep:o})}}return r}function k(e){let t=[],n=$(e);for(let[i,r]of e){if(u(i))continue;let s=l(i);for(let c of r){if(u(c))continue;let a=l(c);if(s===a)continue;(p(s,a)??n.get(`${s}->${a}`))==="violation"&&t.push({file:i,kind:"layer-violation",description:`Imports from ${a}/ (${c}) \u2014 may cross architectural boundary`,dep:c,detail:`${s}/ should not depend on ${a}/`})}}return t}function I(e,t){let n=[];for(let[i,r]of M(e)){let s=r.filter(a=>!u(a));if(s.length<t)continue;let c=x(e,s);for(let a of s)for(let o of e.get(a)??[])u(o)||(c.get(o)??0)===1&&f.dirname(o)!==i&&f.dirname(o)!==f.dirname(i)&&(D(a,o)||n.push({file:a,kind:"pattern-deviation",description:`Only file in ${i}/ that depends on ${o}`,dep:o}))}return n}function _(e){return{results:e,unusedImports:e.filter(t=>t.kind==="unused-import").length,layerViolations:e.filter(t=>t.kind==="layer-violation").length,patternDeviations:e.filter(t=>t.kind==="pattern-deviation").length}}function M(e){let t=new Map;for(let n of e.keys()){let i=f.dirname(n),r=t.get(i);r||(r=[],t.set(i,r)),r.push(n)}return t}function x(e,t){let n=new Map;for(let i of t)for(let r of e.get(i)??[])u(r)||n.set(r,(n.get(r)??0)+1);return n}function O(e,t){let n=new Map;return E(e,n,t),P(e,n),n}function E(e,t,n){for(let i of N(e,n))b(e,t,i.from_file,i.to_file)}function N(e,t){let n=t?`AND d1.relative_path LIKE '%${t}%'`:"";return e.all(`SELECT DISTINCT d1.relative_path AS from_file, d2.relative_path AS to_file
1
+ import{a as m}from"./chunk-NBUINPSH.js";import{a as S}from"./chunk-NKJKI6SE.js";import{b as h}from"./chunk-5RGK4YA5.js";import{b as d}from"./chunk-RCJEFQOK.js";import{a as y}from"./chunk-NN3O7TPH.js";import f from"path";function l(e){let n=e.replace(/\\/g,"/").split("/").filter(Boolean);return n.length<=1?"(root)":n.length>=3&&["src","lib","app","server","client"].includes(n[0])?`${n[0]}/${n[1]}`:n[0]}function p(e,t){if(e===t)return"ok";let n=g(e),i=g(t);return n&&i?v(n,i)?"ok":"violation":w(e,t)}function D(e,t){let n=g(l(e)),i=g(l(t));return!!n&&!!i}function g(e){return/^src\/([^/]+)$/.exec(e)?.[1]??null}function v(e,t){return t==="domain"?!0:e==="domain"?!1:{analysis:new Set(["domain","source","storage","symbols"]),core:new Set(["analysis","domain","resolution","source","storage","symbols"]),"language-parsers":new Set(["domain","resolution","source","storage"]),queries:new Set(["analysis","core","domain","language-parsers","resolution","semantic","source","storage","symbols"]),reindex:new Set(["domain","language-parsers","resolution","runtime","semantic","source","storage","symbols"]),resolution:new Set(["domain","source","storage","symbols"]),runtime:new Set(["domain","queries","reindex","resolution","semantic","source","storage","symbols"]),semantic:new Set(["domain","resolution","storage","symbols"]),source:new Set(["domain","storage"]),storage:new Set(["domain","source"]),symbols:new Set(["analysis","domain","language-parsers","resolution","semantic","source","storage"])}[e]?.has(t)??!1}function w(e,t){if(t==="shared")return"ok";let n={app:new Set(["core","shared","ui"]),core:new Set(["shared"]),infra:new Set(["core","shared"]),ui:new Set(["core","shared"])};return n[e]?n[e].has(t)?"ok":"violation":null}function G(e,t){let{scope:n,minDeviation:i=5}=t??{},r=t?.semantic!==!1,c=new m(e).fileDependencyGraph(n),a=O(e,n);return _([...R(e,c,a,{semantic:r}),...k(c),...I(c,i)])}function R(e,t,n,i){let r=[];for(let[s,c]of t){if(u(s))continue;let a=n.get(s)??new Set;for(let o of c)if(!u(o)&&!a.has(o)){if(i.semantic&&L(e,s,o)||A(e,s,o)||T(e,s,o)||F(o)||j(e,s,o)||V(o))continue;r.push({file:s,kind:"unused-import",description:`Depends on ${o} but references none of its symbols`,dep:o})}}return r}function k(e){let t=[],n=$(e);for(let[i,r]of e){if(u(i))continue;let s=l(i);for(let c of r){if(u(c))continue;let a=l(c);if(s===a)continue;(p(s,a)??n.get(`${s}->${a}`))==="violation"&&t.push({file:i,kind:"layer-violation",description:`Imports from ${a}/ (${c}) \u2014 may cross architectural boundary`,dep:c,detail:`${s}/ should not depend on ${a}/`})}}return t}function I(e,t){let n=[];for(let[i,r]of M(e)){let s=r.filter(a=>!u(a));if(s.length<t)continue;let c=x(e,s);for(let a of s)for(let o of e.get(a)??[])u(o)||(c.get(o)??0)===1&&f.dirname(o)!==i&&f.dirname(o)!==f.dirname(i)&&(D(a,o)||n.push({file:a,kind:"pattern-deviation",description:`Only file in ${i}/ that depends on ${o}`,dep:o}))}return n}function _(e){return{results:e,unusedImports:e.filter(t=>t.kind==="unused-import").length,layerViolations:e.filter(t=>t.kind==="layer-violation").length,patternDeviations:e.filter(t=>t.kind==="pattern-deviation").length}}function M(e){let t=new Map;for(let n of e.keys()){let i=f.dirname(n),r=t.get(i);r||(r=[],t.set(i,r)),r.push(n)}return t}function x(e,t){let n=new Map;for(let i of t)for(let r of e.get(i)??[])u(r)||n.set(r,(n.get(r)??0)+1);return n}function O(e,t){let n=new Map;return E(e,n,t),P(e,n),n}function E(e,t,n){for(let i of N(e,n))b(e,t,i.from_file,i.to_file)}function N(e,t){let n=t?`AND d1.relative_path LIKE '%${t}%'`:"";return e.all(`SELECT DISTINCT d1.relative_path AS from_file, d2.relative_path AS to_file
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
@@ -15,4 +15,4 @@ import{b as m}from"./chunk-QAEDNTY7.js";import{a as S}from"./chunk-NKJKI6SE.js";
15
15
  AND m.role != 1
16
16
  ${e.pathExclusionsFor("d1","d2")}
17
17
  ${n}`)}function P(e,t){new m(e).scanSourceReferences({paths:y(e,{includeIgnored:!1}),includeRustAttributeNames:!0,identifierResolution:"permissive"},i=>{i.target.relativePath!==i.sourceFile&&(e.isIgnored(i.target.relativePath)||b(e,t,i.sourceFile,i.target.relativePath))})}function b(e,t,n,i){if(e.isIgnored(n)||e.isIgnored(i))return;let r=t.get(n);r||(r=new Set,t.set(n,r)),r.add(i)}function $(e){let t=new Map;for(let[i,r]of e){if(u(i))continue;let s=l(i);for(let c of r){if(u(c))continue;let a=l(c);if(s===a||p(s,a))continue;let o=`${s}->${a}`;t.set(o,(t.get(o)??0)+1)}}let n=new Map;for(let[i,r]of t)n.set(i,r<=2?"violation":"ok");return n}function F(e){return e.includes("types")||e.endsWith(".d.ts")}function L(e,t,n){let i=h(e,t).filter(r=>r.sourcePath===n);return i.length>0&&i.some(r=>r.isUsed)}function A(e,t,n){let i=d(e,t).filter(r=>r.sourcePath===n);return i.length>0&&i.some(r=>r.used)}function T(e,t,n){let i=d(e,t).filter(r=>r.sourcePath===n);return i.length>0&&i.every(r=>r.isTypeOnly===!0)}function V(e){return e.endsWith(".vue")}function j(e,t,n){let i=d(e,t).filter(r=>r.sourcePath===n);return i.length===0?!1:i.every(r=>r.kind==="side-effect"||r.kind==="namespace"&&r.usedMembers.length===0&&!r.used)}function u(e){let t=S(e);return!!(t==="entry"||t==="barrel"||t==="test"||t==="worker"||J(f.basename(e)))}function J(e){return!!(e==="index.ts"||e==="index.js"||e==="cli.ts"||e==="main.ts"||e==="main.rs"||e.includes("worker.")||e.includes("postinstall.")||e==="health.ts"||e==="health.js")}export{G as a};
18
- //# sourceMappingURL=chunk-NSTZMBAB.js.map
18
+ //# sourceMappingURL=chunk-OPWOX7NT.js.map
@@ -1,7 +1,7 @@
1
- import{a as D,b as L}from"./chunk-JTXKS5GK.js";import{a as M}from"./chunk-V76FCF5F.js";import{a as C,b as F}from"./chunk-MX6F756F.js";import{b as I}from"./chunk-QAEDNTY7.js";import{a as b}from"./chunk-JB4PUN5S.js";import{c as f,d,j as p,w as g}from"./chunk-7OX2O53H.js";import{basename as c,extname as m}from"path";function q(t,n){let{scope:e,maxLoc:r=15,limit:a=30,scanLimit:o}=n??{},i=new I(t),s=k(i.fileDependencyGraph(e));return M({candidates:()=>x(i,e,r),orderCandidates:F,scanLimit:o,prepare:l=>({callerFileMap:D(i,l,{semantic:n?.semantic!==!1}),reverseFanIn:s}),evaluate:(l,u)=>h(t,i,l,u),orderResults:(l,u)=>u.callerFanIn-l.callerFanIn||u.loc-l.loc,limit:a})}function h(t,n,e,r){let a=S(t,n,e,r.callerFileMap);if(a.length!==1)return null;let o=a[0],i=y(t,e.symbolId,o);if(!i)return null;let s=v(n,t,o,e.symbol,i);if(s&&p(s.symbol))return null;let l=P(r.callerFileMap,r.reverseFanIn,o,s);return l<=3?null:{symbol:e.symbol,shortName:f(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:C(e),singleCaller:s?.symbol??"",singleCallerShort:s?.isFunctionLike?f(s.symbol):c(o),callerFanIn:l}}function x(t,n,e){return t.productionCallableDefinitions({scope:n,minLoc:2,maxLoc:e,requireFunctionLikeSymbol:!0})}function S(t,n,e,r){let a=c(e.relativePath,m(e.relativePath)),o=[...r.get(e.symbolId)??[]].filter(i=>i!==e.relativePath).filter(i=>c(i,m(i))!==a).filter(i=>{let s=n.fileKind(i);return s!=="barrel"&&s!=="entry"&&s!=="test"});return L(t,e,o).realConsumers}function y(t,n,e){return t.get(`SELECT c.start_line, c.end_line
1
+ import{a as D,b as L}from"./chunk-3X43EYFU.js";import{a as M}from"./chunk-V76FCF5F.js";import{a as C,b as F}from"./chunk-MX6F756F.js";import{a as I}from"./chunk-NBUINPSH.js";import{a as b}from"./chunk-4GPWGSOE.js";import{c as f,d,j as p,w as g}from"./chunk-4VYIZV3S.js";import{basename as c,extname as m}from"path";function q(t,n){let{scope:e,maxLoc:r=15,limit:a=30,scanLimit:o}=n??{},i=new I(t),s=k(i.fileDependencyGraph(e));return M({candidates:()=>x(i,e,r),orderCandidates:F,scanLimit:o,prepare:l=>({callerFileMap:D(i,l,{semantic:n?.semantic!==!1}),reverseFanIn:s}),evaluate:(l,u)=>h(t,i,l,u),orderResults:(l,u)=>u.callerFanIn-l.callerFanIn||u.loc-l.loc,limit:a})}function h(t,n,e,r){let a=S(t,n,e,r.callerFileMap);if(a.length!==1)return null;let o=a[0],i=y(t,e.symbolId,o);if(!i)return null;let s=v(n,t,o,e.symbol,i);if(s&&p(s.symbol))return null;let l=P(r.callerFileMap,r.reverseFanIn,o,s);return l<=3?null:{symbol:e.symbol,shortName:f(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:C(e),singleCaller:s?.symbol??"",singleCallerShort:s?.isFunctionLike?f(s.symbol):c(o),callerFanIn:l}}function x(t,n,e){return t.productionCallableDefinitions({scope:n,minLoc:2,maxLoc:e,requireFunctionLikeSymbol:!0})}function S(t,n,e,r){let a=c(e.relativePath,m(e.relativePath)),o=[...r.get(e.symbolId)??[]].filter(i=>i!==e.relativePath).filter(i=>c(i,m(i))!==a).filter(i=>{let s=n.fileKind(i);return s!=="barrel"&&s!=="entry"&&s!=="test"});return L(t,e,o).realConsumers}function y(t,n,e){return t.get(`SELECT c.start_line, c.end_line
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
5
5
  WHERE m.symbol_id = ? AND m.role != 1 AND d.relative_path = ?
6
6
  LIMIT 1`,n,e)}function v(t,n,e,r,a){let o=t.definitionsForFile(e),i=_(n,e,r,a.start_line,a.end_line);return g(o,i)}function P(t,n,e,r){if(r?.isFunctionLike){let a=[...t.get(r.symbolId)??[]].filter(o=>o!==r.relativePath);if(a.length>0)return a.length}return N(n,e)}function _(t,n,e,r,a){let o=d(e);if(!o)return r;let i=b(t,n).get(o);if(!i||i.length===0)return r;for(let s of i)if(s>=r&&s<=a)return s;return r}function k(t){let n=new Map;for(let[e,r]of t){n.has(e)||n.set(e,n.get(e)??0);for(let a of r)n.set(a,(n.get(a)??0)+1)}return n}function N(t,n){let e=t.get(n)??0;if(e>0)return e;let r=c(n,m(n)),a=0;for(let[o,i]of t)o!==n&&c(o,m(o))===r&&i>a&&(a=i);return a}export{q as a};
7
- //# sourceMappingURL=chunk-TRNAQABL.js.map
7
+ //# sourceMappingURL=chunk-OPZQIJZU.js.map
@@ -0,0 +1,2 @@
1
+ import{b as N}from"./chunk-YH6TTQEI.js";import{g as C,i as k,j as L,k as A,p as D}from"./chunk-4GPWGSOE.js";import{d as M}from"./chunk-5RGK4YA5.js";import{t as R}from"./chunk-4VYIZV3S.js";import{e as m,j as b,l as w,n as y,o as E}from"./chunk-5TT47UMX.js";import{a as x}from"./chunk-NN3O7TPH.js";var p=new WeakMap;function he(e,n){let t=m(n);return t==="rust"?K(e,n):t==="typescript"||t==="tsx"||t==="javascript"?O(e,n):[]}var z=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]);function O(e,n){let t=b(e,n);if(!t)return[];let s=p.get(t);if(s)return s;let o=/(^|\/)(pages|app)\/.+\.(tsx?|jsx?)$/.test(n)||/(^|\/)(layout|page|loading|error|not-found|head|template|default)\.(tsx?|jsx?)$/.test(n),i=/(^|\/)src\/(pages|views|routes)\/.+\.(tsx?|jsx?|vue)$/.test(n),r=!1,c=t.rootNode;for(let a of c.namedChildren){if(a.type!=="expression_statement")continue;let d=a.namedChild(0);if(!d||d.type!=="call_expression")continue;let u=d.namedChild(0);if(!u)continue;let f=u.type==="member_expression"?u.namedChild(u.namedChildCount-1)?.text:u.text;if(f&&z.has(f)){r=!0;break}}let l=[];r&&l.push({startLine:0,endLine:c.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)"}),(o||i)&&l.push({startLine:0,endLine:c.endPosition.row,reason:o?"Next.js / Remix route file":"Vite/Vue route component"});for(let a of c.namedChildren){let d=null,u=null;if(a.type==="function_declaration")d=a.namedChild(0)?.text??null,u=a;else if(a.type==="export_statement"){let f=a.namedChild(0);f?.type==="function_declaration"&&(d=f.namedChild(0)?.text??null,u=f)}else if(a.type==="lexical_declaration"){let f=a.namedChild(0);if(f?.type==="variable_declarator"){let _=f.namedChild(0)?.text,S=f.namedChild(1);_&&(S?.type==="arrow_function"||S?.type==="function_expression")&&(d=_,u=f)}}d&&/^use[A-Z]/.test(d)&&u&&l.push({startLine:u.startPosition.row,endLine:u.endPosition.row,reason:"React custom hook (use*)"})}return l.push(...P(t,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),p.set(t,l),l}var W=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function G(e){return W.test(e)}function P(e,n,t){let s=[],o=i=>{if(n.has(i.type)&&i.parent){let c=i.parent.children,l=-1;for(let a=0;a<c.length;a+=1)if(c[a].startIndex===i.startIndex&&c[a].type===i.type){l=a;break}if(l>0)for(let a=l-1;a>=0;a-=1){let d=c[a];if(t.has(d.type)){if(G(d.text)){s.push({startLine:i.startPosition.row,endLine:i.endPosition.row,reason:"scip-query suppression comment"});break}continue}if(!(d.type==="attribute_item"||d.type==="inner_attribute_item"))break}}for(let r of i.namedChildren)o(r)};return o(e.rootNode),s}function K(e,n){let t=b(e,n);if(!t)return[];let s=p.get(t);if(s)return s;let o=[],i=q(t);return i?(p.set(t,i),i):(F(t.rootNode,o,!1,!1),o.push(...P(t,new Set(["function_item","function_signature_item","struct_item","enum_item","union_item","impl_item","mod_item","static_item","const_item"]),new Set(["line_comment","block_comment"]))),o.push(...Z(t.rootNode)),p.set(t,o),o)}function q(e){return Q(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)"}]:null}function F(e,n,t,s){let o=t,i=s;e.type==="trait_item"&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(i=!0,n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)"})),e.type==="function_item"||e.type==="function_signature_item"?$(e,n,t,s):s&&X(e)?n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)"}):e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"?B(e,n,t):e.type==="mod_item"&&g(e).some(r=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(r))&&(o=!0);for(let r of e.namedChildren)F(r,n,o,i)}function $(e,n,t,s){let o=g(e),i=null;s?i="trait impl method (dynamic dispatch)":t&&(i="inside #[cfg(test)] mod");for(let r of o){let c=J(r);if(c){i=c;break}if(H(r)){i="#[allow(dead_code)]";break}}i&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:i})}function B(e,n,t){let s=g(e),o=e.namedChildren.find(i=>i.type==="type_identifier")?.text;s.some(U)&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(<reflective>)] \u2014 fields accessed via macro/reflection",containerName:o}),s.some(H)&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",containerName:o}),t&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",containerName:o})}function g(e){let n=e.parent;if(!n)return[];let t=n.children,s=-1;for(let i=0;i<t.length;i+=1)if(t[i].startIndex===e.startIndex&&t[i].type===e.type){s=i;break}if(s<=0)return[];let o=[];for(let i=s-1;i>=0;i-=1){let r=t[i];if(r.type==="attribute_item"||r.type==="inner_attribute_item")o.push(r.text);else{if(r.type==="line_comment"||r.type==="block_comment")continue;break}}return o}function J(e){return/#\[\s*tauri::command\b/.test(e)?"#[tauri::command]":/#\[\s*command\b/.test(e)?"#[command]":/#\[\s*test\b/.test(e)?"#[test]":/#\[\s*bench\b/.test(e)?"#[bench]":/#\[\s*tokio::test\b/.test(e)?"#[tokio::test]":/#\[\s*async_std::test\b/.test(e)?"#[async_std::test]":/#\[\s*wasm_bindgen\b/.test(e)?"#[wasm_bindgen]":/#\[\s*no_mangle\b/.test(e)?"#[no_mangle]":/#\[\s*napi\b/.test(e)?"#[napi]":/#\[\s*pyfunction\b/.test(e)?"#[pyfunction]":/#\[\s*pymethod\b/.test(e)?"#[pymethod]":/#\[\s*pyo3\b/.test(e)?"#[pyo3]":/#\[\s*cfg\s*\(\s*test\s*\)/.test(e)?"#[cfg(test)]":/#\[\s*doc\s*\(\s*hidden\s*\)/.test(e)?"#[doc(hidden)]":null}function U(e){return/#\[\s*derive\s*\(/.test(e)?/\bSerialize\b/.test(e)||/\bDeserialize\b/.test(e)||/\bFromRow\b/.test(e)||/\bDeriveEntityModel\b/.test(e)||/\bIntoSchema\b/.test(e)||/\bToSchema\b/.test(e)||/\bDeriveValueType\b/.test(e)||/\bsqlx::FromRow\b/.test(e)||/\bError\b/.test(e)||/\bthiserror::Error\b/.test(e):!1}function H(e){return/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e)}function X(e){return e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"}function Z(e){let n=ie(e);if(n.size===0)return[];let t=[];for(let s of e.descendantsOfType("mod_item")){let o=s.childForFieldName("name")?.text;o&&n.has(o)&&t.push({startLine:s.startPosition.row,endLine:s.endPosition.row,reason:'serde `with = "..."` module \u2014 body invoked via reflection',containerName:o})}return t}function Q(e){for(let n=0;n<Math.min(e.namedChildCount,12);n+=1){let t=e.namedChild(n);if(!t||t.type!=="line_comment"&&t.type!=="block_comment")break;if(/@generated\b/.test(t.text)||/This file is .*generated\b/i.test(t.text)||/Code generated by/i.test(t.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(t.text)||/openapi-generator/i.test(t.text)&&/Generated by/i.test(t.text))return!0}return!1}var Y=[{key:"default",re:/\bdefault\s*=\s*"([^"]+)"/g},{key:"with",re:/\bwith\s*=\s*"([^"]+)"/g},{key:"serialize_with",re:/\bserialize_with\s*=\s*"([^"]+)"/g},{key:"deserialize_with",re:/\bdeserialize_with\s*=\s*"([^"]+)"/g},{key:"skip_serializing_if",re:/\bskip_serializing_if\s*=\s*"([^"]+)"/g},{key:"getter",re:/\bgetter\s*=\s*"([^"]+)"/g},{key:"rename_all_with",re:/\brename_all_with\s*=\s*"([^"]+)"/g},{key:"schema_with",re:/\bschema_with\s*=\s*"([^"]+)"/g}],j=/^#!?\[\s*serde\s*\(/,ee=/^#!?\[\s*schemars\s*\(/,te=/^#!?\[\s*validate\s*\(/,v=/\bwith\s*=\s*"([^"]+)"/g;function V(e,n){return y(e,n,ne,()=>new Set,(t,s,o)=>{if(s==="rust"){for(let i of t.rootNode.descendantsOfType("attribute_item"))I(i.text,o);for(let i of t.rootNode.descendantsOfType("inner_attribute_item"))I(i.text,o)}})??new Set}var ne=new WeakMap;function I(e,n){let t=j.test(e),s=ee.test(e),o=te.test(e);if(!(!t&&!s&&!o))for(let{re:i}of Y){i.lastIndex=0;let r;for(;(r=i.exec(e))!==null;){let c=r[1],l=c.split("::").pop()??c;l==="is_none"&&/\bOption\b/.test(c)||l==="is_empty"&&/\b(String|Vec|HashMap|BTreeMap|HashSet|BTreeSet)\b/.test(c)||l&&n.add(l)}}}function ie(e){let n=new Set;for(let t of e.descendantsOfType("attribute_item")){if(!j.test(t.text))continue;v.lastIndex=0;let s;for(;(s=v.exec(t.text))!==null;){let o=s[1],i=o.split("::").pop()??o;i&&n.add(i)}}return n}var se=new Set(["invoke","invokeTauriCommand","listen","once","emit","subscribe","dispatch","sendCommand","callRust"]);function _e(e,n){return y(e,n,oe,()=>new Set,(t,s,o)=>{if(!(s!=="typescript"&&s!=="tsx"&&s!=="javascript"))for(let i of t.rootNode.descendantsOfType("call_expression")){let r=i.namedChild(0);if(!r)continue;let c=E(r);if(!c||!se.has(c))continue;let l=i.namedChildren.find(u=>u.type==="arguments");if(!l)continue;let a=l.namedChild(0);if(!a||a.type!=="string")continue;let d=a.namedChildren.find(u=>u.type==="string_fragment");d&&o.add(d.text)}})??new Set}var oe=new WeakMap;function T(e,n,t={}){let s=new Map;if(n&&n.length===0)return s;let o=x(e,{includeIgnored:!1}),i=A(e),r=n??R(e),c=new Set(r.map(l=>l.symbolId));return re(e,s,o,i,c),ae(e,s,r,c),ue(e,s,o,i,c),t.semantic!==!1&&me(s,M(e,fe(r))),s}function re(e,n,t,s,o){for(let i of t){if(!m(i))continue;let r=w(e,i);if(r)for(let c of r){let l=k(i,s.get(c.calleeLeaf)??[]);if(!l||l.length===0)continue;let a=L(e,i,l,c.memberAccess);a&&o.has(a.symbolId)&&a.file!==i&&h(n,a.symbolId,i)}}}function ae(e,n,t,s){let o=le(t);for(let i of ce(e,s))e.isIgnored(i.relative_path)||de(i,o.get(i.symbol_id))||h(n,i.symbol_id,i.relative_path)}function ce(e,n){return C(e,n?[...n]:void 0)}function le(e){let n=new Map;for(let t of e)n.set(t.symbolId,{docId:t.documentId,startLine:t.startLine,endLine:t.endLine});return n}function de(e,n){return!!n&&n.docId===e.document_id&&e.chunk_start>=n.startLine&&e.chunk_end<=n.endLine}function ue(e,n,t,s,o){for(let i of t){if(m(i)!=="rust")continue;let r=V(e,i);if(r.size!==0)for(let c of r){let l=s.get(c);if(l)for(let a of l)o.has(a.symbolId)&&a.file!==i&&h(n,a.symbolId,i)}}}function h(e,n,t){let s=e.get(n);s||(s=new Set,e.set(n,s)),s.add(t)}function fe(e){return e.filter(n=>"relativePath"in n&&"symbol"in n&&"leaf"in n)}function me(e,n){for(let[t,s]of n){let o=e.get(t);o||(o=new Set,e.set(t,o));for(let i of s)o.add(i)}}function ve(e,n,t={}){return N(e,n,t)}function pe(e,n,t={}){return T(e,n,t)}function be(e,n){return D(e,n)}function Ie(e,n,t={}){let s=pe(e,n,{semantic:t.semantic});return t.sourceFallback===!1?s:ye(s,be(e,n))}function ye(e,n){let t=new Map;for(let[s,o]of e)t.set(s,new Set(o));for(let[s,o]of n){let i=t.get(s)??new Set;for(let r of o)i.add(r);t.set(s,i)}return t}export{he as a,V as b,_e as c,ve as d,pe as e,be as f,Ie as g};
2
+ //# sourceMappingURL=chunk-P3PVY6TX.js.map
@@ -1,2 +1,2 @@
1
- import{a as d,c as f,e as u,t as p}from"./chunk-7OX2O53H.js";var m={0:"UnspecifiedKind",1:"AbstractMethod",2:"Accessor",3:"Array",4:"Assertion",5:"AssociatedType",6:"Attribute",7:"Axiom",8:"Boolean",9:"Class",10:"Constant",11:"Constructor",12:"Contract",13:"DataFamily",14:"DefinitionMacro",15:"Delegate",16:"Enum",17:"EnumMember",18:"Error",19:"Event",20:"Fact",21:"Field",22:"File",23:"Function",24:"Getter",25:"Grammar",26:"Instance",27:"Interface",28:"Key",29:"Lang",30:"Lemma",31:"Library",32:"Macro",33:"Method",34:"MethodAlias",35:"MethodReceiver",36:"MethodSpecification",37:"Message",38:"Modifier",39:"Module",40:"Namespace",41:"Null",42:"Number",43:"Object",44:"Operator",45:"Package",46:"PackageObject",47:"Parameter",48:"ParameterLabel",49:"Pattern",50:"Predicate",51:"Property",52:"Protocol",53:"ProtocolMethod",54:"PureVirtualMethod",55:"Quasiquoter",56:"SelfParameter",57:"Setter",58:"Signature",59:"SingletonClass",60:"SingletonMethod",61:"StaticDataMember",62:"StaticEvent",63:"StaticField",64:"StaticMethod",65:"StaticProperty",66:"StaticVariable",67:"String",68:"Struct",69:"Subscript",70:"Tactic",71:"Theorem",72:"ThisParameter",73:"Trait",74:"TraitMethod",75:"Type",76:"TypeAlias",77:"TypeClass",78:"TypeClassMethod",79:"TypeFamily",80:"TypeParameter",81:"Union",82:"Value",83:"Variable"},c=new Map;for(let[e,i]of Object.entries(m))c.set(i.toLowerCase(),Number(e));function y(e){let i=parseInt(e,10);if(!isNaN(i))return i;let s=e.toLowerCase(),n=c.get(s);if(n!==void 0)return n;for(let[r,o]of c)if(r.includes(s))return o;return null}function K(e,i,s={}){let{scope:n,limit:r=100}=s,o=y(i);return o===null?[]:b(e,n).map(t=>({row:t,resolvedKind:g(t)})).filter(t=>t.resolvedKind===o).slice(0,r).map(({row:t,resolvedKind:l})=>({symbol:t.symbol,shortName:f(t.symbol),kind:l,kindName:m[l]??"Unknown",relativePath:t.relative_path,startLine:t.start_line,endLine:t.end_line}))}function P(e,i={}){let s=new Map;for(let n of b(e,i.scope)){let r=g(n);r===null||r===0||s.set(r,(s.get(r)??0)+1)}return[...s.entries()].sort((n,r)=>r[1]-n[1]||n[0]-r[0]).map(([n,r])=>({kind:n,kindName:m[n]??"Unknown",count:r}))}function b(e,i){return p(e,{scope:i}).map(S)}function S(e){return{symbol:e.symbol,kind:e.kind,documentation:e.documentation,enclosing_symbol:e.enclosingSymbol,relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine}}function g(e){return e.kind!==null&&e.kind!==0?h(e.kind,e.symbol,e.documentation):k(e.symbol,e.documentation,e.enclosing_symbol)}function h(e,i,s){let n=(s??"").toLowerCase();if(u(i)==="type"){if(n.includes("type "))return 76;if(n.includes("interface "))return 27;if(n.includes("struct "))return 68;if(n.includes("trait "))return 73;if(n.includes("class "))return 9}return e}function k(e,i,s){let n=d(e);if("kind"in n)return null;let r=n.descriptors,o=r[r.length-2]??null,a=u(e),t=(i??"").toLowerCase();return a==="type"?t.includes("type ")?76:t.includes("interface ")?27:t.includes("struct ")?68:t.includes("trait ")?73:(t.includes("class "),9):a==="method"?o?.suffix==="type"?33:23:a==="namespace"?39:a!=="term"?null:t.includes("async def ")||t.includes("def ")?23:(s?u(s):o?.suffix??null)==="type"?21:83}export{K as a,P as b};
2
- //# sourceMappingURL=chunk-3OUC276S.js.map
1
+ import{a as d,c as f,e as u,t as p}from"./chunk-4VYIZV3S.js";var m={0:"UnspecifiedKind",1:"AbstractMethod",2:"Accessor",3:"Array",4:"Assertion",5:"AssociatedType",6:"Attribute",7:"Axiom",8:"Boolean",9:"Class",10:"Constant",11:"Constructor",12:"Contract",13:"DataFamily",14:"DefinitionMacro",15:"Delegate",16:"Enum",17:"EnumMember",18:"Error",19:"Event",20:"Fact",21:"Field",22:"File",23:"Function",24:"Getter",25:"Grammar",26:"Instance",27:"Interface",28:"Key",29:"Lang",30:"Lemma",31:"Library",32:"Macro",33:"Method",34:"MethodAlias",35:"MethodReceiver",36:"MethodSpecification",37:"Message",38:"Modifier",39:"Module",40:"Namespace",41:"Null",42:"Number",43:"Object",44:"Operator",45:"Package",46:"PackageObject",47:"Parameter",48:"ParameterLabel",49:"Pattern",50:"Predicate",51:"Property",52:"Protocol",53:"ProtocolMethod",54:"PureVirtualMethod",55:"Quasiquoter",56:"SelfParameter",57:"Setter",58:"Signature",59:"SingletonClass",60:"SingletonMethod",61:"StaticDataMember",62:"StaticEvent",63:"StaticField",64:"StaticMethod",65:"StaticProperty",66:"StaticVariable",67:"String",68:"Struct",69:"Subscript",70:"Tactic",71:"Theorem",72:"ThisParameter",73:"Trait",74:"TraitMethod",75:"Type",76:"TypeAlias",77:"TypeClass",78:"TypeClassMethod",79:"TypeFamily",80:"TypeParameter",81:"Union",82:"Value",83:"Variable"},c=new Map;for(let[e,i]of Object.entries(m))c.set(i.toLowerCase(),Number(e));function y(e){let i=parseInt(e,10);if(!isNaN(i))return i;let s=e.toLowerCase(),n=c.get(s);if(n!==void 0)return n;for(let[r,o]of c)if(r.includes(s))return o;return null}function K(e,i,s={}){let{scope:n,limit:r=100}=s,o=y(i);return o===null?[]:b(e,n).map(t=>({row:t,resolvedKind:g(t)})).filter(t=>t.resolvedKind===o).slice(0,r).map(({row:t,resolvedKind:l})=>({symbol:t.symbol,shortName:f(t.symbol),kind:l,kindName:m[l]??"Unknown",relativePath:t.relative_path,startLine:t.start_line,endLine:t.end_line}))}function P(e,i={}){let s=new Map;for(let n of b(e,i.scope)){let r=g(n);r===null||r===0||s.set(r,(s.get(r)??0)+1)}return[...s.entries()].sort((n,r)=>r[1]-n[1]||n[0]-r[0]).map(([n,r])=>({kind:n,kindName:m[n]??"Unknown",count:r}))}function b(e,i){return p(e,{scope:i}).map(S)}function S(e){return{symbol:e.symbol,kind:e.kind,documentation:e.documentation,enclosing_symbol:e.enclosingSymbol,relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine}}function g(e){return e.kind!==null&&e.kind!==0?h(e.kind,e.symbol,e.documentation):k(e.symbol,e.documentation,e.enclosing_symbol)}function h(e,i,s){let n=(s??"").toLowerCase();if(u(i)==="type"){if(n.includes("type "))return 76;if(n.includes("interface "))return 27;if(n.includes("struct "))return 68;if(n.includes("trait "))return 73;if(n.includes("class "))return 9}return e}function k(e,i,s){let n=d(e);if("kind"in n)return null;let r=n.descriptors,o=r[r.length-2]??null,a=u(e),t=(i??"").toLowerCase();return a==="type"?t.includes("type ")?76:t.includes("interface ")?27:t.includes("struct ")?68:t.includes("trait ")?73:(t.includes("class "),9):a==="method"?o?.suffix==="type"?33:23:a==="namespace"?39:a!=="term"?null:t.includes("async def ")||t.includes("def ")?23:(s?u(s):o?.suffix??null)==="type"?21:83}export{K as a,P as b};
2
+ //# sourceMappingURL=chunk-P7UMQ7R7.js.map
@@ -1,4 +1,4 @@
1
- import{b as h}from"./chunk-QAEDNTY7.js";import{d as p}from"./chunk-7O4MJYIW.js";import{c as u,f,h as g}from"./chunk-7OX2O53H.js";import{execFileSync as d}from"child_process";function A(e,n={}){let t=b(e,n);return t.note?C(t.note,t.changedFileLines):t.changedFiles.length===0?D(t.changedFileLines):I(t.changedFiles,[S(e,t.changedFiles,t.changedFiles)])}function b(e,n={}){let{base:t="HEAD"}=n;try{let s=F(e.config.projectRoot,t);return{changedFileLines:s,changedFiles:_(e,s),note:s.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],note:"Unable to compute git diff."}}}function S(e,n,t){let s=new h(e),r=new Set(t),a=[],l=new Map,o=n.flatMap(i=>s.definitionsForFile(i)).filter(E).sort((i,m)=>i.relativePath.localeCompare(m.relativePath)||i.startLine-m.startLine),c=p(e,o);for(let i of o)x(e,i,t,r,a,l,c.get(i.symbolId)??new Set);return{changedSymbols:a,consumerEntries:[...l.entries()].map(([i,m])=>({file:i,symbols:[...m].sort()}))}}function I(e,n){let t=new Map,s=n.flatMap(a=>a.changedSymbols);for(let a of n)for(let l of a.consumerEntries){let o=t.get(l.file);o||(o=new Set,t.set(l.file,o));for(let c of l.symbols)o.add(c)}let r=N(t);return{changedFiles:[...e],changedSymbols:s,affectedConsumers:r,summary:{totalChangedFiles:e.length,totalChangedSymbols:s.length,totalAffectedFiles:r.length}}}function C(e,n=[]){return{changedFiles:n,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:n.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function D(e){return{changedFiles:e,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:e.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}}}function F(e,n){let t=d("git",["diff","--name-only",n],{encoding:"utf-8",cwd:e,timeout:1e4}),s=d("git",["diff","--name-only","--cached",n],{encoding:"utf-8",cwd:e,timeout:1e4}),r=d("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([t,s,r].flatMap(a=>a.split(`
1
+ import{a as h}from"./chunk-NBUINPSH.js";import{d as p}from"./chunk-5RGK4YA5.js";import{c as u,f,h as g}from"./chunk-4VYIZV3S.js";import{execFileSync as d}from"child_process";function A(e,n={}){let t=b(e,n);return t.note?C(t.note,t.changedFileLines):t.changedFiles.length===0?D(t.changedFileLines):I(t.changedFiles,[S(e,t.changedFiles,t.changedFiles)])}function b(e,n={}){let{base:t="HEAD"}=n;try{let s=F(e.config.projectRoot,t);return{changedFileLines:s,changedFiles:_(e,s),note:s.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],note:"Unable to compute git diff."}}}function S(e,n,t){let s=new h(e),r=new Set(t),a=[],l=new Map,o=n.flatMap(i=>s.definitionsForFile(i)).filter(E).sort((i,m)=>i.relativePath.localeCompare(m.relativePath)||i.startLine-m.startLine),c=p(e,o);for(let i of o)x(e,i,t,r,a,l,c.get(i.symbolId)??new Set);return{changedSymbols:a,consumerEntries:[...l.entries()].map(([i,m])=>({file:i,symbols:[...m].sort()}))}}function I(e,n){let t=new Map,s=n.flatMap(a=>a.changedSymbols);for(let a of n)for(let l of a.consumerEntries){let o=t.get(l.file);o||(o=new Set,t.set(l.file,o));for(let c of l.symbols)o.add(c)}let r=N(t);return{changedFiles:[...e],changedSymbols:s,affectedConsumers:r,summary:{totalChangedFiles:e.length,totalChangedSymbols:s.length,totalAffectedFiles:r.length}}}function C(e,n=[]){return{changedFiles:n,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:n.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function D(e){return{changedFiles:e,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:e.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}}}function F(e,n){let t=d("git",["diff","--name-only",n],{encoding:"utf-8",cwd:e,timeout:1e4}),s=d("git",["diff","--name-only","--cached",n],{encoding:"utf-8",cwd:e,timeout:1e4}),r=d("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([t,s,r].flatMap(a=>a.split(`
2
2
  `)).map(a=>a.trim()).filter(a=>a.length>0))]}function _(e,n){let t=[];for(let s of n){let r=e.get(`SELECT relative_path FROM documents
3
3
  WHERE relative_path LIKE ?
4
4
  LIMIT 1`,`%${s}`);r&&!e.isIgnored(r.relative_path)&&t.push(r.relative_path)}return t}function x(e,n,t,s,r,a,l){let o=Math.max(R(e,n.symbolId),l.size);if(!v(n,o))return;let c=u(n.symbol);r.push({symbol:n.symbol,shortName:c,file:n.relativePath,fanIn:o});for(let i of M(e,n.symbolId,t))y(e,s,a,i,c);for(let i of l)y(e,s,a,i,c)}function R(e,n){return e.get(`SELECT COUNT(DISTINCT c.document_id) AS fan_in
@@ -13,4 +13,4 @@ import{b as h}from"./chunk-QAEDNTY7.js";import{d as p}from"./chunk-7O4MJYIW.js";
13
13
  AND m.role != 1
14
14
  AND ref_d.relative_path NOT IN (${t.map(()=>"?").join(",")})
15
15
  ${e.pathExclusionsFor("ref_d")}`,n,...t).map(r=>r.relative_path)}function y(e,n,t,s,r){if(e.isIgnored(s)||n.has(s))return;let a=t.get(s);a||(a=new Set,t.set(s,a)),a.add(r)}function N(e){return[...e.entries()].map(([n,t])=>({file:n,consumedSymbols:t.size})).sort((n,t)=>t.consumedSymbols-n.consumedSymbols)}function E(e){return!(g(e.symbol)||e.parentTypeName!==null&&!f(e.symbol))}function v(e,n){return f(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&n>0}export{A as a,b,S as c,I as d};
16
- //# sourceMappingURL=chunk-VUBQBW7H.js.map
16
+ //# sourceMappingURL=chunk-PEU24CSY.js.map
@@ -1,4 +1,4 @@
1
- import{a as f}from"./chunk-DFK54IRN.js";import{b as d}from"./chunk-QAEDNTY7.js";import{d as c}from"./chunk-7O4MJYIW.js";import{c as u}from"./chunk-7OX2O53H.js";function L(e,n,i={}){let t=f(e,n);if(!t)return null;let r=h(e,t);if(!r||e.isIgnored(r.relative_path))return null;let s=[],m=0,l=g(e,r.relative_path),p=i.semantic===!1?new Map:c(e,l);for(let o of l){let a=S(e,r,o,p.get(o.symbolId)??new Set);m+=a,s.push({symbol:o.symbol,shortName:u(o.symbol),startLine:o.startLine,endLine:o.endLine,externalConsumers:a,riskLevel:b(a)})}return{file:r.relative_path,symbols:s,totalExternalConsumers:m}}function h(e,n){return e.get(`SELECT id, relative_path FROM documents
1
+ import{a as f}from"./chunk-SDPP5KVQ.js";import{a as d}from"./chunk-NBUINPSH.js";import{d as c}from"./chunk-5RGK4YA5.js";import{c as u}from"./chunk-4VYIZV3S.js";function L(e,n,i={}){let t=f(e,n);if(!t)return null;let r=h(e,t);if(!r||e.isIgnored(r.relative_path))return null;let s=[],m=0,l=g(e,r.relative_path),p=i.semantic===!1?new Map:c(e,l);for(let o of l){let a=S(e,r,o,p.get(o.symbolId)??new Set);m+=a,s.push({symbol:o.symbol,shortName:u(o.symbol),startLine:o.startLine,endLine:o.endLine,externalConsumers:a,riskLevel:b(a)})}return{file:r.relative_path,symbols:s,totalExternalConsumers:m}}function h(e,n){return e.get(`SELECT id, relative_path FROM documents
2
2
  WHERE relative_path = ?
3
3
  ${e.pathExclusionsFor("documents")}
4
4
  LIMIT 1`,n)??null}function g(e,n){return new d(e).definitionsForFile(n).sort((i,t)=>i.startLine-t.startLine||i.endLine-t.endLine)}function S(e,n,i,t){let r=e.all(`SELECT DISTINCT consumer_d.relative_path
@@ -8,4 +8,4 @@ import{a as f}from"./chunk-DFK54IRN.js";import{b as d}from"./chunk-QAEDNTY7.js";
8
8
  WHERE m.symbol_id = ?
9
9
  AND m.role != 1
10
10
  AND c.document_id != ?`,i.symbolId,n.id);return new Set([...r.map(s=>s.relative_path),...[...t].filter(s=>s!==n.relative_path)]).size}function b(e){return e>10?"high":e>0?"medium":"low"}export{L as a};
11
- //# sourceMappingURL=chunk-GAQGJ52J.js.map
11
+ //# sourceMappingURL=chunk-QBXTQODK.js.map
@@ -1,4 +1,4 @@
1
- import{a as r}from"./chunk-DFK54IRN.js";import{a as c}from"./chunk-IODTPF5H.js";import{a as l}from"./chunk-ZNUPGRPR.js";import{c as d}from"./chunk-7OX2O53H.js";function p(e,t){let o=l(e,t);if(!o)return[];let n=e.get(`SELECT COUNT(DISTINCT c.document_id) AS file_count
1
+ import{a as r}from"./chunk-SDPP5KVQ.js";import{a as c}from"./chunk-IODTPF5H.js";import{a as l}from"./chunk-EVXQF7DM.js";import{c as d}from"./chunk-4VYIZV3S.js";function p(e,t){let o=l(e,t);if(!o)return[];let n=e.get(`SELECT COUNT(DISTINCT c.document_id) AS file_count
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  WHERE m.symbol_id = ?
@@ -59,4 +59,4 @@ import{a as r}from"./chunk-DFK54IRN.js";import{a as c}from"./chunk-IODTPF5H.js";
59
59
  GROUP BY d.id
60
60
  ORDER BY symbol_count DESC
61
61
  LIMIT ?`,o).filter(i=>!e.isIgnored(i.relative_path)).map(i=>({name:i.relative_path,count:i.symbol_count}))}export{p as a,b,y as c,I as d};
62
- //# sourceMappingURL=chunk-LDV2B7ET.js.map
62
+ //# sourceMappingURL=chunk-QP6FLI6D.js.map
@@ -1,6 +1,6 @@
1
- import{a as F,b as y,d as R,e as T}from"./chunk-RKTDEIHF.js";import{c as N}from"./chunk-MX6F756F.js";import{b as k}from"./chunk-QAEDNTY7.js";import{a as M}from"./chunk-ARBZM2NF.js";import{a as A}from"./chunk-ZNUPGRPR.js";import{c as p,d as P,g as w,j as q}from"./chunk-7OX2O53H.js";import{a as z}from"./chunk-5TT47UMX.js";function ae(i,t,e={}){let{minSimilarity:s=.4,limit:r=20}=e,a=U(i,t,{semantic:e.semantic!==!1});if(!a)return[];if(!w(a.symbol))return[];let n=V(i,a,s,{scanLimit:e.scanLimit,semantic:e.semantic!==!1});return n.length>0?n.slice(0,r):K(i,t,{minSimilarity:s,limit:r})}function V(i,t,e,s){let r=v(i,{minCallees:3,excludeSymbol:t.symbol,scanLimit:s.scanLimit,semantic:s.semantic}),a=R([t,...r].map(o=>o.callees)),n=[];for(let o of r){if(o.callees.size<3)continue;let l=$(t,o,a,{minSimilarity:e,requireSignificantShared:1,requireSharedCount:0});l&&n.push(l)}return n.sort((o,l)=>l.similarity-o.similarity),n}function $(i,t,e,s){let{similarity:r,significantShared:a}=T(i.callees,t.callees,e);if(r<s.minSimilarity)return null;let n=F(i.callees,t.callees).size;if(a.length<s.requireSignificantShared&&n<s.requireSharedCount)return null;let o=a.length>0?a:[...F(i.callees,t.callees)];return{symbolA:i.symbol,shortNameA:p(i.symbol),fileA:i.file,symbolB:t.symbol,shortNameB:p(t.symbol),fileB:t.file,similarity:r,similarityBasis:"callees",sharedCallees:o.map(p),uniqueToA:[...y(i.callees,t.callees)].map(p),uniqueToB:[...y(t.callees,i.callees)].map(p)}}function le(i,t={}){let{minSimilarity:e=.5,limit:s=20,scope:r,minCallees:a=4,crossFileOnly:n=!1,scanLimit:o}=t,l=v(i,{minCallees:a,scope:r,scanLimit:o,semantic:t.semantic!==!1}),c=R(l.map(m=>m.callees)),u=new Map;for(let m of l)for(let f of m.callees)u.set(f,(u.get(f)??0)+1);let h=Math.max(8,Math.ceil(Math.sqrt(l.length))),x=new Map;for(let m=0;m<l.length;m+=1)for(let f of l[m].callees){if((u.get(f)??0)>h)continue;let g=x.get(f);g||(g=[],x.set(f,g)),g.push(m)}let C=[],L=new Set;e:for(let m=0;m<l.length;m+=1){let f=l[m],g=new Set;for(let D of f.callees){let S=x.get(D);if(S)for(let b of S)b>m&&g.add(b)}for(let D of g){let S=`${m}|${D}`;if(L.has(S))continue;L.add(S);let b=l[D];if(n&&f.file===b.file)continue;if(f.paramCount>=0&&b.paramCount>=0){let _=Math.abs(f.paramCount-b.paramCount),O=Math.max(2,Math.ceil(Math.max(f.paramCount,b.paramCount)*.5));if(_>O)continue}let B=$(f,b,c,{minSimilarity:e,requireSignificantShared:2,requireSharedCount:4});if(B&&(C.push(B),C.length>s*5))break e}}return C.sort((m,f)=>f.similarity-m.similarity),C.slice(0,s)}var Z=["ScipDatabase#all","ScipDatabase#get","ScipDatabase#prepare","ScipDatabase#pathExclusionsFor","ScipDatabase#isIgnored","ScipDatabase#symbolNoiseFor","PerDbValue#get","PerDbValue#has",":storage:db:ScipDatabase:all",":storage:db:ScipDatabase:get",":storage:db:ScipDatabase:prepare",":storage:db:ScipDatabase:pathExclusionsFor",":storage:db:ScipDatabase:isIgnored",":storage:db:ScipDatabase:symbolNoiseFor",":storage:per-db-cache:PerDbValue:get",":storage:per-db-cache:PerDbValue:has"];function U(i,t,e){let s=A(i,t),r=new k(i);if(!s)return null;let a=M(i,s,{semantic:e.semantic});return{symbol:s.symbol,file:s.relativePath,callees:E(a.map(n=>n.symbol)),paramCount:r.callableSignature(s)?.paramCount??-1}}function v(i,t){let{minCallees:e,scope:s,excludeSymbol:r,scanLimit:a}=t,n=new k(i),o=N(n.productionCallableDefinitions({scope:s,minLoc:5,excludeSymbol:r,sortByLocDesc:typeof a=="number"&&a>0}),a),l=n.calleeMap(o,{semantic:t.semantic!==!1});return o.map(c=>({symbol:c.symbol,file:c.relativePath,callees:E((l.get(c.symbolId)??[]).map(u=>u.symbol)),paramCount:n.callableSignature(c)?.paramCount??-1})).filter(c=>c.callees.size>=e)}function E(i){return new Set([...i].filter(t=>!W(t)))}function W(i){return Z.some(t=>i.includes(t))}function K(i,t,e){let s=G(i,t);if(!s||s.tokens.size<3)return[];let r=e.minSimilarity>=.5?e.minSimilarity:.3,a=[];for(let n of J(i)){if(n.symbol===s.symbol||n.tokens.size<3)continue;let o=F(s.tokens,n.tokens);if(o.size<2)continue;let l=new Set([...s.tokens,...n.tokens]),c=l.size>0?o.size/l.size:0;c<r||a.push({symbolA:s.symbol,shortNameA:p(s.symbol),fileA:s.file,symbolB:n.symbol,shortNameB:p(n.symbol),fileB:n.file,similarity:c,similarityBasis:"source-tokens",sharedCallees:[...o].sort(),uniqueToA:[...y(s.tokens,n.tokens)].sort(),uniqueToB:[...y(n.tokens,s.tokens)].sort()})}return a.sort((n,o)=>o.similarity-n.similarity||n.shortNameB.localeCompare(o.shortNameB)),a.slice(0,e.limit)}function G(i,t){let e=A(i,t);if(!e||!w(e.symbol))return null;let s=H(i,e);return s?{symbol:e.symbol,file:e.relativePath,tokens:s}:null}function H(i,t){let e=P(t.symbol),s=I(i,t.relativePath,t.startLine,t.endLine,e),r=j(s,e);return r.size>0?r:null}function J(i){let t=new k(i);return t.scopedDefinitions().filter(e=>e.isFunctionLike).filter(e=>t.fileKind(e.relativePath)!=="test").filter(e=>!q(e.symbol)).map(e=>({symbol:e.symbol,file:e.relativePath,tokens:j(I(i,e.relativePath,e.startLine,e.endLine,e.leaf),e.leaf)})).filter(e=>e.tokens.size>0)}function I(i,t,e,s,r){let a=z(i,t);if(!a)return"";let n=a.split(`
1
+ import{a as F,b as y,d as R,e as T}from"./chunk-RKTDEIHF.js";import{c as N}from"./chunk-MX6F756F.js";import{a as k}from"./chunk-NBUINPSH.js";import{a as M}from"./chunk-YH6TTQEI.js";import{a as A}from"./chunk-EVXQF7DM.js";import{c as p,d as P,g as w,j as q}from"./chunk-4VYIZV3S.js";import{a as z}from"./chunk-5TT47UMX.js";function ae(i,t,e={}){let{minSimilarity:s=.4,limit:r=20}=e,a=U(i,t,{semantic:e.semantic!==!1});if(!a)return[];if(!w(a.symbol))return[];let n=V(i,a,s,{scanLimit:e.scanLimit,semantic:e.semantic!==!1});return n.length>0?n.slice(0,r):K(i,t,{minSimilarity:s,limit:r})}function V(i,t,e,s){let r=v(i,{minCallees:3,excludeSymbol:t.symbol,scanLimit:s.scanLimit,semantic:s.semantic}),a=R([t,...r].map(o=>o.callees)),n=[];for(let o of r){if(o.callees.size<3)continue;let l=$(t,o,a,{minSimilarity:e,requireSignificantShared:1,requireSharedCount:0});l&&n.push(l)}return n.sort((o,l)=>l.similarity-o.similarity),n}function $(i,t,e,s){let{similarity:r,significantShared:a}=T(i.callees,t.callees,e);if(r<s.minSimilarity)return null;let n=F(i.callees,t.callees).size;if(a.length<s.requireSignificantShared&&n<s.requireSharedCount)return null;let o=a.length>0?a:[...F(i.callees,t.callees)];return{symbolA:i.symbol,shortNameA:p(i.symbol),fileA:i.file,symbolB:t.symbol,shortNameB:p(t.symbol),fileB:t.file,similarity:r,similarityBasis:"callees",sharedCallees:o.map(p),uniqueToA:[...y(i.callees,t.callees)].map(p),uniqueToB:[...y(t.callees,i.callees)].map(p)}}function le(i,t={}){let{minSimilarity:e=.5,limit:s=20,scope:r,minCallees:a=4,crossFileOnly:n=!1,scanLimit:o}=t,l=v(i,{minCallees:a,scope:r,scanLimit:o,semantic:t.semantic!==!1}),c=R(l.map(m=>m.callees)),u=new Map;for(let m of l)for(let f of m.callees)u.set(f,(u.get(f)??0)+1);let h=Math.max(8,Math.ceil(Math.sqrt(l.length))),x=new Map;for(let m=0;m<l.length;m+=1)for(let f of l[m].callees){if((u.get(f)??0)>h)continue;let g=x.get(f);g||(g=[],x.set(f,g)),g.push(m)}let C=[],L=new Set;e:for(let m=0;m<l.length;m+=1){let f=l[m],g=new Set;for(let D of f.callees){let S=x.get(D);if(S)for(let b of S)b>m&&g.add(b)}for(let D of g){let S=`${m}|${D}`;if(L.has(S))continue;L.add(S);let b=l[D];if(n&&f.file===b.file)continue;if(f.paramCount>=0&&b.paramCount>=0){let _=Math.abs(f.paramCount-b.paramCount),O=Math.max(2,Math.ceil(Math.max(f.paramCount,b.paramCount)*.5));if(_>O)continue}let B=$(f,b,c,{minSimilarity:e,requireSignificantShared:2,requireSharedCount:4});if(B&&(C.push(B),C.length>s*5))break e}}return C.sort((m,f)=>f.similarity-m.similarity),C.slice(0,s)}var Z=["ScipDatabase#all","ScipDatabase#get","ScipDatabase#prepare","ScipDatabase#pathExclusionsFor","ScipDatabase#isIgnored","ScipDatabase#symbolNoiseFor","PerDbValue#get","PerDbValue#has",":storage:db:ScipDatabase:all",":storage:db:ScipDatabase:get",":storage:db:ScipDatabase:prepare",":storage:db:ScipDatabase:pathExclusionsFor",":storage:db:ScipDatabase:isIgnored",":storage:db:ScipDatabase:symbolNoiseFor",":storage:per-db-cache:PerDbValue:get",":storage:per-db-cache:PerDbValue:has"];function U(i,t,e){let s=A(i,t),r=new k(i);if(!s)return null;let a=M(i,s,{semantic:e.semantic});return{symbol:s.symbol,file:s.relativePath,callees:E(a.map(n=>n.symbol)),paramCount:r.callableSignature(s)?.paramCount??-1}}function v(i,t){let{minCallees:e,scope:s,excludeSymbol:r,scanLimit:a}=t,n=new k(i),o=N(n.productionCallableDefinitions({scope:s,minLoc:5,excludeSymbol:r,sortByLocDesc:typeof a=="number"&&a>0}),a),l=n.calleeMap(o,{semantic:t.semantic!==!1});return o.map(c=>({symbol:c.symbol,file:c.relativePath,callees:E((l.get(c.symbolId)??[]).map(u=>u.symbol)),paramCount:n.callableSignature(c)?.paramCount??-1})).filter(c=>c.callees.size>=e)}function E(i){return new Set([...i].filter(t=>!W(t)))}function W(i){return Z.some(t=>i.includes(t))}function K(i,t,e){let s=G(i,t);if(!s||s.tokens.size<3)return[];let r=e.minSimilarity>=.5?e.minSimilarity:.3,a=[];for(let n of J(i)){if(n.symbol===s.symbol||n.tokens.size<3)continue;let o=F(s.tokens,n.tokens);if(o.size<2)continue;let l=new Set([...s.tokens,...n.tokens]),c=l.size>0?o.size/l.size:0;c<r||a.push({symbolA:s.symbol,shortNameA:p(s.symbol),fileA:s.file,symbolB:n.symbol,shortNameB:p(n.symbol),fileB:n.file,similarity:c,similarityBasis:"source-tokens",sharedCallees:[...o].sort(),uniqueToA:[...y(s.tokens,n.tokens)].sort(),uniqueToB:[...y(n.tokens,s.tokens)].sort()})}return a.sort((n,o)=>o.similarity-n.similarity||n.shortNameB.localeCompare(o.shortNameB)),a.slice(0,e.limit)}function G(i,t){let e=A(i,t);if(!e||!w(e.symbol))return null;let s=H(i,e);return s?{symbol:e.symbol,file:e.relativePath,tokens:s}:null}function H(i,t){let e=P(t.symbol),s=I(i,t.relativePath,t.startLine,t.endLine,e),r=j(s,e);return r.size>0?r:null}function J(i){let t=new k(i);return t.scopedDefinitions().filter(e=>e.isFunctionLike).filter(e=>t.fileKind(e.relativePath)!=="test").filter(e=>!q(e.symbol)).map(e=>({symbol:e.symbol,file:e.relativePath,tokens:j(I(i,e.relativePath,e.startLine,e.endLine,e.leaf),e.leaf)})).filter(e=>e.tokens.size>0)}function I(i,t,e,s,r){let a=z(i,t);if(!a)return"";let n=a.split(`
2
2
  `);if(s>=e&&s-e<=12)return n.slice(e,s+1).join(`
3
3
  `);let o=[new RegExp(`\\bdef\\s+${d(r)}\\b`),new RegExp(`\\bfun\\s+${d(r)}\\b`),new RegExp(`\\bfn\\s+${d(r)}\\b`),new RegExp(`\\bfunction\\s+${d(r)}\\b`),new RegExp(`\\b${d(r)}\\s*\\(`)],l=n.findIndex(c=>o.some(u=>u.test(c)));if(l>=0){let c=l;for(let u=l+1;u<n.length&&u<=l+8;u++){let h=n[u]??"";if(u>l&&X(h)||(c=u,h.trim()===""&&u>l+1))break}return n.slice(l,c+1).join(`
4
4
  `)}return n.slice(e,Math.min(n.length,e+8)).join(`
5
5
  `)}function j(i,t){if(!i)return new Set;let e=new Set(["public","private","protected","final","static","class","def","fun","fn","function","return","string","bool","boolean","void","unit","self","this","new","const","let","var","end","pub"]),s=Q(t),a=i.replace(/["'`]/g," ").replace(/\b\d+\b/g," NUM ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9_]+/g," ").replace(/_/g," ").toLowerCase().split(/\s+/).map(n=>n.trim()).filter(n=>n.length>1).filter(n=>!e.has(n)).filter(n=>!s.has(n));return new Set(a)}function Q(i){return new Set(i.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(t=>t.toLowerCase()).filter(t=>t.length>1))}function X(i){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(i)}function d(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{ae as a,le as b};
6
- //# sourceMappingURL=chunk-NYEMZHUC.js.map
6
+ //# sourceMappingURL=chunk-QVPYMZUJ.js.map
@@ -1,2 +1,2 @@
1
- import{b as u}from"./chunk-QAEDNTY7.js";import{a as h}from"./chunk-ARBZM2NF.js";import{r as S}from"./chunk-JB4PUN5S.js";import{a as d,b}from"./chunk-ZNUPGRPR.js";import{c as m,w as y}from"./chunk-7OX2O53H.js";function v(e,o,l={}){let{direction:c="backward",maxDepth:s=3}=l,r=d(e,o);return r?c==="backward"?w(e,r,s,{semantic:l.semantic!==!1}):M(e,r,{semantic:l.semantic!==!1}):null}function w(e,o,l,c){let s=[],r=new Set([o.symbol]),t=[o];for(let n=1;n<=l&&t.length!==0;n++){let i=[];for(let p of t){let g=h(e,p,{semantic:c.semantic});for(let a of g){if(r.has(a.symbol))continue;r.add(a.symbol),s.push({symbol:a.symbol,shortName:m(a.symbol),file:a.file,relationship:n===1?"referenced within definition (callee)":`depth ${n} callee`});let f=b(e,a.symbol);f&&!e.isIgnored(f.relativePath)&&i.push(f)}}t=i}return{symbol:o.symbol,shortName:m(o.symbol),direction:"backward",connectedSymbols:s}}function M(e,o,l){let c=new Set,s=[],r=new u(e);for(let t of S(e,o,{semantic:l.semantic})){if(s.length>=30)break;let n=t.enclosingSymbol??y(r.definitionsForFile(t.file),t.line)?.symbol??null;if(!n||n===o.symbol)continue;let i=b(e,n);!i||e.isIgnored(i.relativePath)||c.has(i.symbol)||(c.add(i.symbol),s.push({symbol:i.symbol,shortName:m(i.symbol),file:i.relativePath,relationship:`references target at ${t.file}:${t.line+1}`}))}return s.sort((t,n)=>t.file.localeCompare(n.file)),{symbol:o.symbol,shortName:m(o.symbol),direction:"forward",connectedSymbols:s}}export{v as a};
2
- //# sourceMappingURL=chunk-2JEFS2YJ.js.map
1
+ import{a as u}from"./chunk-NBUINPSH.js";import{a as h}from"./chunk-YH6TTQEI.js";import{r as S}from"./chunk-4GPWGSOE.js";import{a as d,b}from"./chunk-EVXQF7DM.js";import{c as m,w as y}from"./chunk-4VYIZV3S.js";function v(e,o,l={}){let{direction:c="backward",maxDepth:s=3}=l,r=d(e,o);return r?c==="backward"?w(e,r,s,{semantic:l.semantic!==!1}):M(e,r,{semantic:l.semantic!==!1}):null}function w(e,o,l,c){let s=[],r=new Set([o.symbol]),t=[o];for(let n=1;n<=l&&t.length!==0;n++){let i=[];for(let p of t){let g=h(e,p,{semantic:c.semantic});for(let a of g){if(r.has(a.symbol))continue;r.add(a.symbol),s.push({symbol:a.symbol,shortName:m(a.symbol),file:a.file,relationship:n===1?"referenced within definition (callee)":`depth ${n} callee`});let f=b(e,a.symbol);f&&!e.isIgnored(f.relativePath)&&i.push(f)}}t=i}return{symbol:o.symbol,shortName:m(o.symbol),direction:"backward",connectedSymbols:s}}function M(e,o,l){let c=new Set,s=[],r=new u(e);for(let t of S(e,o,{semantic:l.semantic})){if(s.length>=30)break;let n=t.enclosingSymbol??y(r.definitionsForFile(t.file),t.line)?.symbol??null;if(!n||n===o.symbol)continue;let i=b(e,n);!i||e.isIgnored(i.relativePath)||c.has(i.symbol)||(c.add(i.symbol),s.push({symbol:i.symbol,shortName:m(i.symbol),file:i.relativePath,relationship:`references target at ${t.file}:${t.line+1}`}))}return s.sort((t,n)=>t.file.localeCompare(n.file)),{symbol:o.symbol,shortName:m(o.symbol),direction:"forward",connectedSymbols:s}}export{v as a};
2
+ //# sourceMappingURL=chunk-RFCR2BRD.js.map
@@ -0,0 +1,2 @@
1
+ import{a}from"./chunk-NBUINPSH.js";import{a as i}from"./chunk-EVXQF7DM.js";import{c as s,e as o,k as m}from"./chunk-4VYIZV3S.js";function L(t,l){let r=i(t,l);return r?new a(t).definitionsForFile(r.relativePath).filter(e=>e.symbol!==r.symbol).filter(e=>m(r.symbol,e.symbol)).sort((e,n)=>e.startLine-n.startLine||e.endLine-n.endLine).map(e=>({symbol:e.symbol,shortName:s(e.symbol),startLine:e.startLine,endLine:e.endLine,kind:o(e.symbol)??"unknown"})):[]}export{L as a};
2
+ //# sourceMappingURL=chunk-S5VMVNFM.js.map
@@ -1,2 +1,2 @@
1
- import{a as u}from"./chunk-ZNUPGRPR.js";import{a as c}from"./chunk-NN3O7TPH.js";import{existsSync as m}from"fs";import{basename as p,isAbsolute as g,join as d}from"path";function S(t,r){let e=f(t,r,{allowMultiple:!1})[0]?.relativePath;return e||x(t,r)}function j(t,r){return f(t,r,{allowMultiple:!0}).map(e=>e.relativePath)}function x(t,r){if(!r)return null;let e=r.replace(/\\/g,"/").replace(/^\.\//,""),s=g(e)&&e.startsWith(t.config.projectRoot)?e.slice(t.config.projectRoot.length).replace(/^\/+/,""):e,i=d(t.config.projectRoot,s);return m(i)?s:null}function f(t,r,e){let s=h(r);if(!s)return[];let i=c(t,{includeIgnored:!1}).map(o=>({relativePath:o,score:v(o,s)})).filter(o=>o.score>0).sort((o,l)=>l.score-o.score||o.relativePath.localeCompare(l.relativePath));if(i.length===0){let o=u(t,r);return!o||t.isIgnored(o.relativePath)?[]:[{relativePath:o.relativePath,score:700}]}let n=i.filter(o=>o.score>=1100);if(n.length>0)return e.allowMultiple?n:[n[0]];let a=i.filter(o=>o.score>=800);return a.length>0?e.allowMultiple?a:[a[0]]:e.allowMultiple?i:[i[0]]}function v(t,r){let e=h(t),s=p(e),i=p(r),n=0;return e===r&&(n+=1200),e.endsWith(`/${r}`)&&(n+=1100),s===i&&(n+=900),e.startsWith(`${r}/`)&&(n+=850),e.includes(r)&&(n+=250),n}function h(t){return t.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}export{S as a,j as b};
2
- //# sourceMappingURL=chunk-DFK54IRN.js.map
1
+ import{a as u}from"./chunk-EVXQF7DM.js";import{a as c}from"./chunk-NN3O7TPH.js";import{existsSync as m}from"fs";import{basename as p,isAbsolute as g,join as d}from"path";function S(t,r){let e=f(t,r,{allowMultiple:!1})[0]?.relativePath;return e||x(t,r)}function j(t,r){return f(t,r,{allowMultiple:!0}).map(e=>e.relativePath)}function x(t,r){if(!r)return null;let e=r.replace(/\\/g,"/").replace(/^\.\//,""),s=g(e)&&e.startsWith(t.config.projectRoot)?e.slice(t.config.projectRoot.length).replace(/^\/+/,""):e,i=d(t.config.projectRoot,s);return m(i)?s:null}function f(t,r,e){let s=h(r);if(!s)return[];let i=c(t,{includeIgnored:!1}).map(o=>({relativePath:o,score:v(o,s)})).filter(o=>o.score>0).sort((o,l)=>l.score-o.score||o.relativePath.localeCompare(l.relativePath));if(i.length===0){let o=u(t,r);return!o||t.isIgnored(o.relativePath)?[]:[{relativePath:o.relativePath,score:700}]}let n=i.filter(o=>o.score>=1100);if(n.length>0)return e.allowMultiple?n:[n[0]];let a=i.filter(o=>o.score>=800);return a.length>0?e.allowMultiple?a:[a[0]]:e.allowMultiple?i:[i[0]]}function v(t,r){let e=h(t),s=p(e),i=p(r),n=0;return e===r&&(n+=1200),e.endsWith(`/${r}`)&&(n+=1100),s===i&&(n+=900),e.startsWith(`${r}/`)&&(n+=850),e.includes(r)&&(n+=250),n}function h(t){return t.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}export{S as a,j as b};
2
+ //# sourceMappingURL=chunk-SDPP5KVQ.js.map
@@ -1,4 +1,4 @@
1
- import{a as t}from"./chunk-DFK54IRN.js";function r(e,n,o){let d=t(e,n)??n,s=t(e,o)??o,m=e.get(`SELECT COUNT(DISTINCT gs.id) AS shared
1
+ import{a as t}from"./chunk-SDPP5KVQ.js";function r(e,n,o){let d=t(e,n)??n,s=t(e,o)??o,m=e.get(`SELECT COUNT(DISTINCT gs.id) AS shared
2
2
  FROM global_symbols gs
3
3
  WHERE (
4
4
  -- Defined in file1, referenced in file2
@@ -53,4 +53,4 @@ import{a as t}from"./chunk-DFK54IRN.js";function r(e,n,o){let d=t(e,n)??n,s=t(e,
53
53
  GROUP BY def_d.id, ref_d.id
54
54
  ORDER BY shared DESC
55
55
  LIMIT ?`,o).filter(i=>!e.isIgnored(i.file1)&&!e.isIgnored(i.file2)).map(i=>({file1:i.file1,file2:i.file2,sharedSymbols:i.shared}))}export{r as a,c as b};
56
- //# sourceMappingURL=chunk-ZXFTC5ET.js.map
56
+ //# sourceMappingURL=chunk-SVSLAUSJ.js.map
@@ -1,4 +1,4 @@
1
- import{b as m}from"./chunk-DFK54IRN.js";import{v as o}from"./chunk-7OX2O53H.js";function h(t,l){let s=m(t,l);if(s.length===0)return{files:[],symbols:[],dependsOn:[],dependedOnBy:[]};let d=s.map(()=>"?").join(", "),i=t.all(`SELECT relative_path FROM documents
1
+ import{b as m}from"./chunk-SDPP5KVQ.js";import{v as o}from"./chunk-4VYIZV3S.js";function h(t,l){let s=m(t,l);if(s.length===0)return{files:[],symbols:[],dependsOn:[],dependedOnBy:[]};let d=s.map(()=>"?").join(", "),i=t.all(`SELECT relative_path FROM documents
2
2
  WHERE relative_path IN (${d})
3
3
  ORDER BY relative_path`,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e)),n=o(t,i,{onlyDocumented:!0,sort:!0}).map(({relativePath:e,...c})=>c),a=t.all(`SELECT DISTINCT d2.relative_path
4
4
  FROM mentions m
@@ -32,4 +32,4 @@ import{b as m}from"./chunk-DFK54IRN.js";import{v as o}from"./chunk-7OX2O53H.js";
32
32
  WHERE d2.relative_path IN (${d})
33
33
  AND d1.relative_path NOT IN (${d})
34
34
  ORDER BY d1.relative_path`,...s,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e));return{files:i,symbols:n,dependsOn:a,dependedOnBy:r}}export{h as a};
35
- //# sourceMappingURL=chunk-WPLKHAH7.js.map
35
+ //# sourceMappingURL=chunk-TB2OYNRS.js.map
@@ -0,0 +1,2 @@
1
+ import{c as b}from"./chunk-MX6F756F.js";import{a as u}from"./chunk-NBUINPSH.js";import{d as f}from"./chunk-P3PVY6TX.js";import{a as c}from"./chunk-YH6TTQEI.js";import{c as l}from"./chunk-4VYIZV3S.js";function R(o,e={}){let{limit:r=20,scope:s,minFanIn:i=2,minFanOut:n=2,scanLimit:m}=e,p=new u(o);return b(p.productionCallableDefinitions({scope:s,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof m=="number"&&m>0}),m).map(t=>y(o,t,e.semantic!==!1)).filter(t=>t.fanIn>=i&&t.fanOut>=n).sort((t,a)=>a.score-t.score||a.fanIn-t.fanIn).slice(0,r)}function y(o,e,r){let s=new Set(f(o,e,{limit:500,semantic:r}).map(n=>n.file)).size,i=new Set(c(o,e,{limit:500,semantic:r}).filter(n=>n.file!==e.relativePath).map(n=>`${n.symbol}|${n.file}`)).size;return{symbol:e.symbol,shortName:l(e.symbol),fanIn:s,fanOut:i,score:s*i,definedIn:e.relativePath}}export{R as a};
2
+ //# sourceMappingURL=chunk-TGNL3ZKZ.js.map
@@ -1,2 +1,2 @@
1
- import{a as P}from"./chunk-OHEIZWIA.js";import{a as v}from"./chunk-AQYBOORI.js";import{a as R}from"./chunk-TRNAQABL.js";import{d as w}from"./chunk-JTXKS5GK.js";import{a as L}from"./chunk-3GNFUVFA.js";import{b as x}from"./chunk-NYEMZHUC.js";import{a as S}from"./chunk-A2AVLALL.js";import{a as b}from"./chunk-NSTZMBAB.js";import{a as C}from"./chunk-XO6R3X5J.js";import{a as g}from"./chunk-FD37DBTD.js";import{a as H}from"./chunk-BI4F6GXI.js";import{a as d,b as y}from"./chunk-D6Z67MZL.js";import{e as u,f as l}from"./chunk-NKJKI6SE.js";function m(t){let e=z(t);return{score:I(t),overview:{documents:t.statsResult.documents,symbols:t.statsResult.symbols,indexSizeBytes:t.statsResult.indexSizeBytes},findings:{deadSymbols:t.dead.count,deadLoc:t.dead.loc,isolatedSymbols:t.isolated.count,isolatedLoc:t.isolated.loc,cycles:t.realCycleCount,similarPairs:t.similarCount,extractionCandidates:t.extractCount,wrappers:t.wrappers.count,passthroughs:t.passthroughs.count,staleTypes:t.stale.count,driftedFiles:t.drift.count,complexityHotspotCount:t.complexity.extremeCount},actions:e,topComplexity:t.complexity.top,warnings:t.warnings.length>0?t.warnings:void 0}}function z(t){let e=[];if(t.dead.count>0&&e.push({category:"Dead code",description:`${t.dead.count} symbols with zero references anywhere \u2014 safe to delete`,effort:"low",impact:"high",count:t.dead.count,locRecoverable:t.dead.loc}),t.isolated.count>0&&e.push({category:"Isolated symbols",description:`${t.isolated.count} symbols completely disconnected from the codebase graph`,effort:"low",impact:"medium",count:t.isolated.count,locRecoverable:t.isolated.loc}),t.realCycleCount>0&&e.push({category:"Circular dependencies",description:`${t.realCycleCount} cycle(s) \u2014 break with dependency inversion or module restructuring`,effort:"medium",impact:"high",count:t.realCycleCount,locRecoverable:0}),t.similarCount>0&&e.push({category:"Similar functions",description:`${t.similarCount} pairs with real logic overlap (beyond shared imports) \u2014 consolidation candidates`,effort:"medium",impact:"medium",count:t.similarCount,locRecoverable:0}),t.extractCount>0&&e.push({category:"Extraction candidates",description:`${t.extractCount} large functions with isolated callee clusters \u2014 extract method opportunities`,effort:"medium",impact:"medium",count:t.extractCount,locRecoverable:0}),t.wrappers.count>0&&e.push({category:"Wrapper functions",description:`${t.wrappers.count} single-consumer symbols that could be inlined`,effort:"low",impact:"low",count:t.wrappers.count,locRecoverable:t.wrappers.loc}),t.passthroughs.count>0&&e.push({category:"Passthrough functions",description:`${t.passthroughs.count} functions that just forward to one callee \u2014 unnecessary indirection`,effort:"low",impact:"low",count:t.passthroughs.count,locRecoverable:t.passthroughs.loc}),t.stale.count>0){let i=[];t.stale.unused>0&&i.push(`${t.stale.unused} unused`),t.stale.singleUse>0&&i.push(`${t.stale.singleUse} single-consumer (not in types file)`),e.push({category:"Stale abstractions",description:`${i.join(", ")} \u2014 premature abstraction`,effort:"low",impact:"medium",count:t.stale.count,locRecoverable:t.stale.loc})}if(t.drift.count>0){let i=[];t.drift.unusedImports>0&&i.push(`${t.drift.unusedImports} unused imports`),t.drift.layerViolations>0&&i.push(`${t.drift.layerViolations} layer violations`),e.push({category:"Structural drift",description:i.join(", "),effort:t.drift.layerViolations>0?"medium":"low",impact:t.drift.layerViolations>0?"medium":"low",count:t.drift.count,locRecoverable:0})}let a={high:3,medium:2,low:1},r={low:3,medium:2,high:1};return e.sort((i,n)=>{let c=a[i.impact]*r[i.effort];return a[n.impact]*r[n.effort]-c}),e}function I(t){let e=Math.max(t.statsResult.documents,1),a=Math.max(t.statsResult.symbols,1),r=100,i=t.dead.count/a;r-=Math.min(20,Math.round(i*200));let n=t.isolated.count/a;r-=Math.min(10,Math.round(n*200)),r-=Math.min(15,t.realCycleCount*5);let c=t.similarCount/a*1e3;r-=Math.min(10,Math.round(c));let f=t.extractCount/a*1e3;r-=Math.min(5,Math.round(f/2)),r-=Math.min(3,t.wrappers.count),r-=Math.min(3,t.passthroughs.count);let M=t.stale.count/Math.max(a*.1,1);r-=Math.min(8,Math.round(M*10));let _=t.drift.count/e;return r-=Math.min(5,Math.round(_*50)),r-=Math.min(5,t.complexity.extremeCount*2),Math.max(0,Math.min(100,r))}import{getHeapStatistics as $}from"v8";var N=64*1024*1024;function h(){let t=globalThis.gc;if(!t)return;let e=$();e.heap_size_limit-e.used_heap_size<N||t()}var O=50,j=75e3,U=5e3,E=2500,V=["overview","dead","isolated","cycles","similar","extract-candidates","wrapper-candidates","passthrough-candidates","stale-abstractions","drift","complexity-hotspots"],A={overview:(t,e,a,r)=>({phase:"overview",statsResult:r,warnings:a.warnings}),dead:(t,e,a)=>({phase:"dead",dead:G(t,e,a)}),isolated:(t,e,a)=>({phase:"isolated",isolated:F(t,e,a)}),cycles:(t,e,a)=>({phase:"cycles",realCycleCount:W(t,e,a)}),similar:(t,e,a)=>({phase:"similar",similarCount:q(t,e,a)}),"extract-candidates":(t,e,a)=>({phase:"extract-candidates",extractCount:Y(t,e,a)}),"wrapper-candidates":(t,e,a)=>({phase:"wrapper-candidates",wrappers:Q(t,e,a)}),"passthrough-candidates":(t,e,a)=>({phase:"passthrough-candidates",passthroughs:X(t,e,a)}),"stale-abstractions":(t,e,a)=>({phase:"stale-abstractions",stale:J(t,e,a)}),drift:(t,e,a)=>({phase:"drift",drift:K(t,e,a)}),"complexity-hotspots":(t,e,a)=>({phase:"complexity-hotspots",complexity:Z(t,e,a)})};function Rt(t,e={}){return T(t,e.full===!0,(a,r)=>{let i=k(t,e.scope,a,r);return m(i)})}function Lt(t,e,a={}){return T(t,a.full===!0,(r,i)=>A[e](t,a.scope,i,r))}function T(t,e,a){let r=v(t),i=tt(r,e);try{return a(r,i)}finally{d(t,{semanticProvider:!0}),h()}}function Pt(t){return m(D(t))}function D(t){let e=o(t,"overview");return{statsResult:e.statsResult,warnings:e.warnings,dead:o(t,"dead").dead,isolated:o(t,"isolated").isolated,realCycleCount:o(t,"cycles").realCycleCount,similarCount:o(t,"similar").similarCount,extractCount:o(t,"extract-candidates").extractCount,wrappers:o(t,"wrapper-candidates").wrappers,passthroughs:o(t,"passthrough-candidates").passthroughs,stale:o(t,"stale-abstractions").stale,drift:o(t,"drift").drift,complexity:o(t,"complexity-hotspots").complexity}}function o(t,e){let a=t.find(r=>r.phase===e);if(!a)throw new Error(`Missing health phase result: ${e}`);return a}function k(t,e,a,r){return D(V.map(i=>A[i](t,e,r,a)))}function G(t,e,a){return s(t,a,"dead",()=>{let r=y(t,{scope:e,minLoc:3,skipBarrels:!0,deadCodeOnly:!0,scanLimit:a.candidateScanLimit,semantic:!1});return p(rt(t,r.symbols))})}function F(t,e,a){return s(t,a,"isolated",()=>{let r=S(t,{scope:e,minLoc:3,scanLimit:a.candidateScanLimit,semantic:!1});return p(it(t,r))})}function W(t,e,a){return s(t,a,"cycles",()=>H(t,{scope:e}).filter(i=>i.kind==="real").length)}function q(t,e,a){return s(t,a,"similar",()=>x(t,{scope:e,minSimilarity:.6,limit:50,minCallees:4,scanLimit:a.candidateScanLimit,semantic:!1}).length)}function Y(t,e,a){return s(t,a,"extract-candidates",()=>C(t,{scope:e,minLoc:15,minCallees:5,limit:50,scanLimit:a.candidateScanLimit,semantic:!1}).length)}function Q(t,e,a){return B(t,a,"wrapper-candidates",()=>R(t,{scope:e,maxLoc:15,limit:50,scanLimit:a.candidateScanLimit,semantic:!1}))}function X(t,e,a){return B(t,a,"passthrough-candidates",()=>L(t,{scope:e,maxLoc:15,limit:50,scanLimit:a.candidateScanLimit,semantic:!1}))}function J(t,e,a){return s(t,a,"stale-abstractions",()=>{let r=P(t,{scope:e,minLoc:3,limit:50,scanLimit:a.candidateScanLimit,semantic:!1}),i=r.filter(n=>n.consumers===0).length;return{count:r.length,loc:r.reduce((n,c)=>n+c.loc,0),unused:i,singleUse:r.length-i}})}function K(t,e,a){return s(t,a,"drift",()=>{let r=b(t,{scope:e,semantic:!1});return{count:r.unusedImports+r.layerViolations,unusedImports:r.unusedImports,layerViolations:r.layerViolations}})}function Z(t,e,a){return s(t,a,"complexity-hotspots",()=>{let r=g(t,{scope:e,minLoc:10,limit:10,scanLimit:a.candidateScanLimit,semantic:!1});return{top:r.slice(0,5).map(i=>({symbol:i.shortName,score:i.score})),extremeCount:r.filter(i=>i.score>O).length}})}function tt(t,e){return t.symbols>=j||t.documents>=U?e?{candidateScanLimit:void 0,releaseCachesBetweenPhases:!0,warnings:["Large index detected; running unbounded health analyses because --full was supplied."]}:{candidateScanLimit:E,releaseCachesBetweenPhases:!0,warnings:[`Large index detected; candidate-style health checks scanned their highest-priority ${E} symbols. Run "scip-query health --full" for unbounded candidate counts.`]}:{candidateScanLimit:void 0,releaseCachesBetweenPhases:!0,warnings:[]}}function et(t,e){e.releaseCachesBetweenPhases&&(w(t),d(t),h())}function s(t,e,a,r){at(a);try{return r()}finally{et(t,e)}}function B(t,e,a,r){return s(t,e,a,()=>p(r()))}function at(t){process.env.SCIP_QUERY_HEALTH_TRACE==="1"&&console.error(`[health] ${t}`)}function rt(t,e){return e.filter(a=>!u(t,a.relativePath)&&!l(t,a.symbol,a.relativePath)&&a.kind==="dead-code")}function it(t,e){return e.filter(a=>!u(t,a.relativePath)&&!l(t,a.symbol,a.relativePath))}function p(t){return{count:t.length,loc:t.reduce((e,a)=>e+a.loc,0)}}export{V as a,Rt as b,Lt as c,Pt as d};
2
- //# sourceMappingURL=chunk-7H4RJ4MC.js.map
1
+ import{a as P}from"./chunk-EDXML2HI.js";import{a as v}from"./chunk-AQYBOORI.js";import{a as R}from"./chunk-OPZQIJZU.js";import{d as w}from"./chunk-3X43EYFU.js";import{a as L}from"./chunk-7WHNTKSD.js";import{b as x}from"./chunk-QVPYMZUJ.js";import{a as S}from"./chunk-HTVLH3NL.js";import{a as b}from"./chunk-OPWOX7NT.js";import{a as C}from"./chunk-D62LLANH.js";import{a as g}from"./chunk-WJQFABZN.js";import{a as H}from"./chunk-BI4F6GXI.js";import{a as d,b as y}from"./chunk-EZQOVY3C.js";import{e as u,f as l}from"./chunk-NKJKI6SE.js";function m(t){let e=z(t);return{score:I(t),overview:{documents:t.statsResult.documents,symbols:t.statsResult.symbols,indexSizeBytes:t.statsResult.indexSizeBytes},findings:{deadSymbols:t.dead.count,deadLoc:t.dead.loc,isolatedSymbols:t.isolated.count,isolatedLoc:t.isolated.loc,cycles:t.realCycleCount,similarPairs:t.similarCount,extractionCandidates:t.extractCount,wrappers:t.wrappers.count,passthroughs:t.passthroughs.count,staleTypes:t.stale.count,driftedFiles:t.drift.count,complexityHotspotCount:t.complexity.extremeCount},actions:e,topComplexity:t.complexity.top,warnings:t.warnings.length>0?t.warnings:void 0}}function z(t){let e=[];if(t.dead.count>0&&e.push({category:"Dead code",description:`${t.dead.count} symbols with zero references anywhere \u2014 safe to delete`,effort:"low",impact:"high",count:t.dead.count,locRecoverable:t.dead.loc}),t.isolated.count>0&&e.push({category:"Isolated symbols",description:`${t.isolated.count} symbols completely disconnected from the codebase graph`,effort:"low",impact:"medium",count:t.isolated.count,locRecoverable:t.isolated.loc}),t.realCycleCount>0&&e.push({category:"Circular dependencies",description:`${t.realCycleCount} cycle(s) \u2014 break with dependency inversion or module restructuring`,effort:"medium",impact:"high",count:t.realCycleCount,locRecoverable:0}),t.similarCount>0&&e.push({category:"Similar functions",description:`${t.similarCount} pairs with real logic overlap (beyond shared imports) \u2014 consolidation candidates`,effort:"medium",impact:"medium",count:t.similarCount,locRecoverable:0}),t.extractCount>0&&e.push({category:"Extraction candidates",description:`${t.extractCount} large functions with isolated callee clusters \u2014 extract method opportunities`,effort:"medium",impact:"medium",count:t.extractCount,locRecoverable:0}),t.wrappers.count>0&&e.push({category:"Wrapper functions",description:`${t.wrappers.count} single-consumer symbols that could be inlined`,effort:"low",impact:"low",count:t.wrappers.count,locRecoverable:t.wrappers.loc}),t.passthroughs.count>0&&e.push({category:"Passthrough functions",description:`${t.passthroughs.count} functions that just forward to one callee \u2014 unnecessary indirection`,effort:"low",impact:"low",count:t.passthroughs.count,locRecoverable:t.passthroughs.loc}),t.stale.count>0){let i=[];t.stale.unused>0&&i.push(`${t.stale.unused} unused`),t.stale.singleUse>0&&i.push(`${t.stale.singleUse} single-consumer (not in types file)`),e.push({category:"Stale abstractions",description:`${i.join(", ")} \u2014 premature abstraction`,effort:"low",impact:"medium",count:t.stale.count,locRecoverable:t.stale.loc})}if(t.drift.count>0){let i=[];t.drift.unusedImports>0&&i.push(`${t.drift.unusedImports} unused imports`),t.drift.layerViolations>0&&i.push(`${t.drift.layerViolations} layer violations`),e.push({category:"Structural drift",description:i.join(", "),effort:t.drift.layerViolations>0?"medium":"low",impact:t.drift.layerViolations>0?"medium":"low",count:t.drift.count,locRecoverable:0})}let a={high:3,medium:2,low:1},r={low:3,medium:2,high:1};return e.sort((i,n)=>{let c=a[i.impact]*r[i.effort];return a[n.impact]*r[n.effort]-c}),e}function I(t){let e=Math.max(t.statsResult.documents,1),a=Math.max(t.statsResult.symbols,1),r=100,i=t.dead.count/a;r-=Math.min(20,Math.round(i*200));let n=t.isolated.count/a;r-=Math.min(10,Math.round(n*200)),r-=Math.min(15,t.realCycleCount*5);let c=t.similarCount/a*1e3;r-=Math.min(10,Math.round(c));let f=t.extractCount/a*1e3;r-=Math.min(5,Math.round(f/2)),r-=Math.min(3,t.wrappers.count),r-=Math.min(3,t.passthroughs.count);let M=t.stale.count/Math.max(a*.1,1);r-=Math.min(8,Math.round(M*10));let _=t.drift.count/e;return r-=Math.min(5,Math.round(_*50)),r-=Math.min(5,t.complexity.extremeCount*2),Math.max(0,Math.min(100,r))}import{getHeapStatistics as $}from"v8";var N=64*1024*1024;function h(){let t=globalThis.gc;if(!t)return;let e=$();e.heap_size_limit-e.used_heap_size<N||t()}var O=50,j=75e3,U=5e3,E=2500,V=["overview","dead","isolated","cycles","similar","extract-candidates","wrapper-candidates","passthrough-candidates","stale-abstractions","drift","complexity-hotspots"],A={overview:(t,e,a,r)=>({phase:"overview",statsResult:r,warnings:a.warnings}),dead:(t,e,a)=>({phase:"dead",dead:G(t,e,a)}),isolated:(t,e,a)=>({phase:"isolated",isolated:F(t,e,a)}),cycles:(t,e,a)=>({phase:"cycles",realCycleCount:W(t,e,a)}),similar:(t,e,a)=>({phase:"similar",similarCount:q(t,e,a)}),"extract-candidates":(t,e,a)=>({phase:"extract-candidates",extractCount:Y(t,e,a)}),"wrapper-candidates":(t,e,a)=>({phase:"wrapper-candidates",wrappers:Q(t,e,a)}),"passthrough-candidates":(t,e,a)=>({phase:"passthrough-candidates",passthroughs:X(t,e,a)}),"stale-abstractions":(t,e,a)=>({phase:"stale-abstractions",stale:J(t,e,a)}),drift:(t,e,a)=>({phase:"drift",drift:K(t,e,a)}),"complexity-hotspots":(t,e,a)=>({phase:"complexity-hotspots",complexity:Z(t,e,a)})};function Rt(t,e={}){return T(t,e.full===!0,(a,r)=>{let i=k(t,e.scope,a,r);return m(i)})}function Lt(t,e,a={}){return T(t,a.full===!0,(r,i)=>A[e](t,a.scope,i,r))}function T(t,e,a){let r=v(t),i=tt(r,e);try{return a(r,i)}finally{d(t,{semanticProvider:!0}),h()}}function Pt(t){return m(D(t))}function D(t){let e=o(t,"overview");return{statsResult:e.statsResult,warnings:e.warnings,dead:o(t,"dead").dead,isolated:o(t,"isolated").isolated,realCycleCount:o(t,"cycles").realCycleCount,similarCount:o(t,"similar").similarCount,extractCount:o(t,"extract-candidates").extractCount,wrappers:o(t,"wrapper-candidates").wrappers,passthroughs:o(t,"passthrough-candidates").passthroughs,stale:o(t,"stale-abstractions").stale,drift:o(t,"drift").drift,complexity:o(t,"complexity-hotspots").complexity}}function o(t,e){let a=t.find(r=>r.phase===e);if(!a)throw new Error(`Missing health phase result: ${e}`);return a}function k(t,e,a,r){return D(V.map(i=>A[i](t,e,r,a)))}function G(t,e,a){return s(t,a,"dead",()=>{let r=y(t,{scope:e,minLoc:3,skipBarrels:!0,deadCodeOnly:!0,scanLimit:a.candidateScanLimit,semantic:!1});return p(rt(t,r.symbols))})}function F(t,e,a){return s(t,a,"isolated",()=>{let r=S(t,{scope:e,minLoc:3,scanLimit:a.candidateScanLimit,semantic:!1});return p(it(t,r))})}function W(t,e,a){return s(t,a,"cycles",()=>H(t,{scope:e}).filter(i=>i.kind==="real").length)}function q(t,e,a){return s(t,a,"similar",()=>x(t,{scope:e,minSimilarity:.6,limit:50,minCallees:4,scanLimit:a.candidateScanLimit,semantic:!1}).length)}function Y(t,e,a){return s(t,a,"extract-candidates",()=>C(t,{scope:e,minLoc:15,minCallees:5,limit:50,scanLimit:a.candidateScanLimit,semantic:!1}).length)}function Q(t,e,a){return B(t,a,"wrapper-candidates",()=>R(t,{scope:e,maxLoc:15,limit:50,scanLimit:a.candidateScanLimit,semantic:!1}))}function X(t,e,a){return B(t,a,"passthrough-candidates",()=>L(t,{scope:e,maxLoc:15,limit:50,scanLimit:a.candidateScanLimit,semantic:!1}))}function J(t,e,a){return s(t,a,"stale-abstractions",()=>{let r=P(t,{scope:e,minLoc:3,limit:50,scanLimit:a.candidateScanLimit,semantic:!1}),i=r.filter(n=>n.consumers===0).length;return{count:r.length,loc:r.reduce((n,c)=>n+c.loc,0),unused:i,singleUse:r.length-i}})}function K(t,e,a){return s(t,a,"drift",()=>{let r=b(t,{scope:e,semantic:!1});return{count:r.unusedImports+r.layerViolations,unusedImports:r.unusedImports,layerViolations:r.layerViolations}})}function Z(t,e,a){return s(t,a,"complexity-hotspots",()=>{let r=g(t,{scope:e,minLoc:10,limit:10,scanLimit:a.candidateScanLimit,semantic:!1});return{top:r.slice(0,5).map(i=>({symbol:i.shortName,score:i.score})),extremeCount:r.filter(i=>i.score>O).length}})}function tt(t,e){return t.symbols>=j||t.documents>=U?e?{candidateScanLimit:void 0,releaseCachesBetweenPhases:!0,warnings:["Large index detected; running unbounded health analyses because --full was supplied."]}:{candidateScanLimit:E,releaseCachesBetweenPhases:!0,warnings:[`Large index detected; candidate-style health checks scanned their highest-priority ${E} symbols. Run "scip-query health --full" for unbounded candidate counts.`]}:{candidateScanLimit:void 0,releaseCachesBetweenPhases:!0,warnings:[]}}function et(t,e){e.releaseCachesBetweenPhases&&(w(t),d(t),h())}function s(t,e,a,r){at(a);try{return r()}finally{et(t,e)}}function B(t,e,a,r){return s(t,e,a,()=>p(r()))}function at(t){process.env.SCIP_QUERY_HEALTH_TRACE==="1"&&console.error(`[health] ${t}`)}function rt(t,e){return e.filter(a=>!u(t,a.relativePath)&&!l(t,a.symbol,a.relativePath)&&a.kind==="dead-code")}function it(t,e){return e.filter(a=>!u(t,a.relativePath)&&!l(t,a.symbol,a.relativePath))}function p(t){return{count:t.length,loc:t.reduce((e,a)=>e+a.loc,0)}}export{V as a,Rt as b,Lt as c,Pt as d};
2
+ //# sourceMappingURL=chunk-UHMJYNTK.js.map
@@ -1,2 +1,2 @@
1
- import{a as f,c as y}from"./chunk-MX6F756F.js";import{f as L}from"./chunk-7O4MJYIW.js";import{B as d}from"./chunk-BOVNTAKQ.js";import{c as b,o as h,p as S,t as x}from"./chunk-7OX2O53H.js";import{a as g}from"./chunk-5TT47UMX.js";function F(n,e={}){let{scope:s,minLoc:t=1,limit:i,scanLimit:a}=e,o=e.semantic!==!1,l=M(n,$(n,{scope:s,minLoc:t,scanLimit:a}),{semantic:o}),r=I(l);return i?r.slice(0,i):r}function $(n,e){let s=x(n,{scope:e.scope}).filter(t=>t.isFunctionLike&&!n.isIgnored(t.relativePath)).filter(t=>f(t)>=e.minLoc);return typeof e.scanLimit=="number"&&e.scanLimit>0&&s.sort((t,i)=>f(i)-f(t)||t.relativePath.localeCompare(i.relativePath)),y(s,e.scanLimit)}function M(n,e,s){let t=new Map;for(let i of e){let a=w(n,i,s);if(!a)continue;let o=t.get(a)??[];o.push(v(i)),t.set(a,o)}return t}function v(n){return{symbol:n.symbol,shortName:b(n.symbol),file:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:f(n)}}function I(n){let e=[];for(let[s,t]of n)t.length>=2&&e.push({signature:s,functions:t});return e.sort((s,t)=>{let i=t.functions.length-s.functions.length;if(i!==0)return i;let a=s.functions.reduce((l,r)=>l+r.loc,0);return t.functions.reduce((l,r)=>l+r.loc,0)-a}),e}function w(n,e,s){if(s.semantic){let a=L(n,e);if(a)return a}let t=G(e.documentation),i=t?A(t):null;return i||R(P(n,e.relativePath,e.startLine,e.endLine,e.leaf),e.leaf)}function G(n){return h(S(n))}function P(n,e,s,t,i){let a=g(n,e);if(!a)return null;let o=a.split(/\r?\n/),l=E(o,s,t,i);for(let r of l){let p=Math.min(o.length-1,Math.max(r,r+4)),u="";for(let c=r;c<=p;c+=1){let m=o[c]?.trim();if(m&&(u=u?`${u} ${m}`:m,z(u)))return u}if(u&&u.includes("("))return u}return null}function z(n){let e=n.replace(/\s+/g," ").trim();return!e.includes("(")||d(e)>0?!1:/[;{]$/.test(e)||/\)\s*(?::\s*[^={]+)?\s*(?:=>|=|throws\b|where\b|$)/i.test(e)||/\)\s*As\s+.+$/i.test(e)}function A(n){if(!n||!n.trim())return null;let e=n.replace(/^```\w*\s*/,"").replace(/\s*```$/,"").replace(/^\(method\)\s*/,"").replace(/^\(property\)\s*/,"").replace(/^\(function\)\s*/,"").replace(/^\(class\)\s*/,"").replace(/^\(interface\)\s*/,"").replace(/^\(enum\)\s*/,"").replace(/^\(type alias\)\s*/,"").replace(/^\(const\)\s*/,"").replace(/^\(var\)\s*/,"").trim(),s=e.indexOf("(");return s===-1||(e=e.slice(s),e=e.replace(/\s+/g,"").toLowerCase(),e.length<3)?null:e}function R(n,e){if(!n||!n.trim())return null;let s=n.replace(/\s+/g," ").trim(),t=s.indexOf("(");if(t===-1)return null;let i=s.slice(0,t),o=new RegExp(`\\b${D(e)}\\b`,"i").exec(i);o&&typeof o.index=="number"&&(i=i.slice(0,o.index)),i=i.replace(/\b(public|private|protected|internal|final|static|abstract|sealed|virtual|override|async|suspend|inline|constexpr|consteval|constinit|const|pub|fn|function|def|sub|friend|shared|readonly|new|open|partial|export)\b/gi," ").replace(/\s+/g," ").trim();let l=C(s.slice(t)).replace(/\)\s*=\s*[\s\S]*$/,")").replace(/\s+throws\s+[^={]+$/i,"").replace(/\s+where\s+.+$/i,"").replace(/\s+/g," ").trim();if(!l.startsWith("("))return null;let r=`${i?`${i} `:""}${l}`.replace(/\s+/g,"").toLowerCase();return r.length>=3?r:null}function C(n){let e=0,s=0,t=0,i=0,a=null,o=!1;for(let l=0;l<n.length;l+=1){let r=n[l];if(a){if(o){o=!1;continue}if(r==="\\"){o=!0;continue}r===a&&(a=null);continue}if(r==='"'||r==="'"||r==="`"){a=r;continue}if(r==="(")e+=1;else if(r===")")e=Math.max(0,e-1);else if(r==="[")t+=1;else if(r==="]")t=Math.max(0,t-1);else if(r==="<")i+=1;else if(r===">")i=Math.max(0,i-1);else if(r==="{"){if(e===0&&t===0&&i===0)return n.slice(0,l);s+=1}else if(r==="}")s=Math.max(0,s-1);else if(r==="="&&n[l+1]===">"&&e===0&&s===0&&t===0&&i===0)return n.slice(0,l)}return n}function E(n,e,s,t){let i=D(t),a=new RegExp(`\\b${i}\\b\\s*\\(`,"i"),o=new RegExp(`\\bdef\\s+${i}\\b`,"i"),l=[],r=new Set,p=Math.max(0,Math.min(e,n.length-1)),u=Math.max(p,Math.min(n.length-1,Math.max(s,e+4)));for(let c=p;c<=u;c+=1){let m=n[c]??"";(a.test(m)||o.test(m))&&!r.has(c)&&(r.add(c),l.push(c))}for(let c=0;c<n.length;c+=1){let m=n[c]??"";(a.test(m)||o.test(m))&&!r.has(c)&&(r.add(c),l.push(c))}return l}function D(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{F as a};
2
- //# sourceMappingURL=chunk-QPRIYXH4.js.map
1
+ import{a as f,c as y}from"./chunk-MX6F756F.js";import{f as L}from"./chunk-5RGK4YA5.js";import{B as d}from"./chunk-BOVNTAKQ.js";import{c as b,o as h,p as S,t as x}from"./chunk-4VYIZV3S.js";import{a as g}from"./chunk-5TT47UMX.js";function F(n,e={}){let{scope:s,minLoc:t=1,limit:i,scanLimit:a}=e,o=e.semantic!==!1,l=M(n,$(n,{scope:s,minLoc:t,scanLimit:a}),{semantic:o}),r=I(l);return i?r.slice(0,i):r}function $(n,e){let s=x(n,{scope:e.scope}).filter(t=>t.isFunctionLike&&!n.isIgnored(t.relativePath)).filter(t=>f(t)>=e.minLoc);return typeof e.scanLimit=="number"&&e.scanLimit>0&&s.sort((t,i)=>f(i)-f(t)||t.relativePath.localeCompare(i.relativePath)),y(s,e.scanLimit)}function M(n,e,s){let t=new Map;for(let i of e){let a=w(n,i,s);if(!a)continue;let o=t.get(a)??[];o.push(v(i)),t.set(a,o)}return t}function v(n){return{symbol:n.symbol,shortName:b(n.symbol),file:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:f(n)}}function I(n){let e=[];for(let[s,t]of n)t.length>=2&&e.push({signature:s,functions:t});return e.sort((s,t)=>{let i=t.functions.length-s.functions.length;if(i!==0)return i;let a=s.functions.reduce((l,r)=>l+r.loc,0);return t.functions.reduce((l,r)=>l+r.loc,0)-a}),e}function w(n,e,s){if(s.semantic){let a=L(n,e);if(a)return a}let t=G(e.documentation),i=t?A(t):null;return i||R(P(n,e.relativePath,e.startLine,e.endLine,e.leaf),e.leaf)}function G(n){return h(S(n))}function P(n,e,s,t,i){let a=g(n,e);if(!a)return null;let o=a.split(/\r?\n/),l=E(o,s,t,i);for(let r of l){let p=Math.min(o.length-1,Math.max(r,r+4)),u="";for(let c=r;c<=p;c+=1){let m=o[c]?.trim();if(m&&(u=u?`${u} ${m}`:m,z(u)))return u}if(u&&u.includes("("))return u}return null}function z(n){let e=n.replace(/\s+/g," ").trim();return!e.includes("(")||d(e)>0?!1:/[;{]$/.test(e)||/\)\s*(?::\s*[^={]+)?\s*(?:=>|=|throws\b|where\b|$)/i.test(e)||/\)\s*As\s+.+$/i.test(e)}function A(n){if(!n||!n.trim())return null;let e=n.replace(/^```\w*\s*/,"").replace(/\s*```$/,"").replace(/^\(method\)\s*/,"").replace(/^\(property\)\s*/,"").replace(/^\(function\)\s*/,"").replace(/^\(class\)\s*/,"").replace(/^\(interface\)\s*/,"").replace(/^\(enum\)\s*/,"").replace(/^\(type alias\)\s*/,"").replace(/^\(const\)\s*/,"").replace(/^\(var\)\s*/,"").trim(),s=e.indexOf("(");return s===-1||(e=e.slice(s),e=e.replace(/\s+/g,"").toLowerCase(),e.length<3)?null:e}function R(n,e){if(!n||!n.trim())return null;let s=n.replace(/\s+/g," ").trim(),t=s.indexOf("(");if(t===-1)return null;let i=s.slice(0,t),o=new RegExp(`\\b${D(e)}\\b`,"i").exec(i);o&&typeof o.index=="number"&&(i=i.slice(0,o.index)),i=i.replace(/\b(public|private|protected|internal|final|static|abstract|sealed|virtual|override|async|suspend|inline|constexpr|consteval|constinit|const|pub|fn|function|def|sub|friend|shared|readonly|new|open|partial|export)\b/gi," ").replace(/\s+/g," ").trim();let l=C(s.slice(t)).replace(/\)\s*=\s*[\s\S]*$/,")").replace(/\s+throws\s+[^={]+$/i,"").replace(/\s+where\s+.+$/i,"").replace(/\s+/g," ").trim();if(!l.startsWith("("))return null;let r=`${i?`${i} `:""}${l}`.replace(/\s+/g,"").toLowerCase();return r.length>=3?r:null}function C(n){let e=0,s=0,t=0,i=0,a=null,o=!1;for(let l=0;l<n.length;l+=1){let r=n[l];if(a){if(o){o=!1;continue}if(r==="\\"){o=!0;continue}r===a&&(a=null);continue}if(r==='"'||r==="'"||r==="`"){a=r;continue}if(r==="(")e+=1;else if(r===")")e=Math.max(0,e-1);else if(r==="[")t+=1;else if(r==="]")t=Math.max(0,t-1);else if(r==="<")i+=1;else if(r===">")i=Math.max(0,i-1);else if(r==="{"){if(e===0&&t===0&&i===0)return n.slice(0,l);s+=1}else if(r==="}")s=Math.max(0,s-1);else if(r==="="&&n[l+1]===">"&&e===0&&s===0&&t===0&&i===0)return n.slice(0,l)}return n}function E(n,e,s,t){let i=D(t),a=new RegExp(`\\b${i}\\b\\s*\\(`,"i"),o=new RegExp(`\\bdef\\s+${i}\\b`,"i"),l=[],r=new Set,p=Math.max(0,Math.min(e,n.length-1)),u=Math.max(p,Math.min(n.length-1,Math.max(s,e+4)));for(let c=p;c<=u;c+=1){let m=n[c]??"";(a.test(m)||o.test(m))&&!r.has(c)&&(r.add(c),l.push(c))}for(let c=0;c<n.length;c+=1){let m=n[c]??"";(a.test(m)||o.test(m))&&!r.has(c)&&(r.add(c),l.push(c))}return l}function D(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{F as a};
2
+ //# sourceMappingURL=chunk-VMS5YTBS.js.map
@@ -1,2 +1,2 @@
1
- import{a as u}from"./chunk-V76FCF5F.js";import{b as p}from"./chunk-QAEDNTY7.js";import{c as i}from"./chunk-7OX2O53H.js";function x(e,r){let{scope:m,minLoc:o=10,limit:c=30,scanLimit:a}=r??{},s=new p(e);return u({candidates:()=>s.productionCallableDefinitions({scope:m,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof a=="number"&&a>0}),scanLimit:a,prepare:t=>({callerMap:s.crossFileCallerMap(t,{semantic:r?.semantic!==!1}),calleeMap:s.calleeMap(t,{semantic:r?.semantic!==!1})}),evaluate:(t,n)=>b(t,n,o),orderResults:(t,n)=>n.score-t.score||n.loc-t.loc,limit:c})}function b(e,r,m){let o=e.endLine-e.startLine+1;if(o<m)return null;let c=r.callerMap.get(e.symbolId)?.size??0,a=r.calleeMap.get(e.symbolId)??[],s=a.filter(l=>l.file!==e.relativePath),t=new Set(s.map(l=>`${l.symbol}|${l.file}`)).size,n=new Set(a.map(l=>`${l.symbol}|${l.file}`)).size;return{symbol:e.symbol,shortName:i(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:o,fanIn:c,fanOut:t,calleeCount:n,score:Math.round(o/50*(c/5)*Math.max(t/5,1)*100)/100}}export{x as a};
2
- //# sourceMappingURL=chunk-FD37DBTD.js.map
1
+ import{a as u}from"./chunk-V76FCF5F.js";import{a as p}from"./chunk-NBUINPSH.js";import{c as i}from"./chunk-4VYIZV3S.js";function x(e,r){let{scope:m,minLoc:o=10,limit:c=30,scanLimit:a}=r??{},s=new p(e);return u({candidates:()=>s.productionCallableDefinitions({scope:m,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof a=="number"&&a>0}),scanLimit:a,prepare:t=>({callerMap:s.crossFileCallerMap(t,{semantic:r?.semantic!==!1}),calleeMap:s.calleeMap(t,{semantic:r?.semantic!==!1})}),evaluate:(t,n)=>b(t,n,o),orderResults:(t,n)=>n.score-t.score||n.loc-t.loc,limit:c})}function b(e,r,m){let o=e.endLine-e.startLine+1;if(o<m)return null;let c=r.callerMap.get(e.symbolId)?.size??0,a=r.calleeMap.get(e.symbolId)??[],s=a.filter(l=>l.file!==e.relativePath),t=new Set(s.map(l=>`${l.symbol}|${l.file}`)).size,n=new Set(a.map(l=>`${l.symbol}|${l.file}`)).size;return{symbol:e.symbol,shortName:i(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:o,fanIn:c,fanOut:t,calleeCount:n,score:Math.round(o/50*(c/5)*Math.max(t/5,1)*100)/100}}export{x as a};
2
+ //# sourceMappingURL=chunk-WJQFABZN.js.map
@@ -1,3 +1,3 @@
1
- import{a as d}from"./chunk-ZNUPGRPR.js";import{a as g,c as m}from"./chunk-7OX2O53H.js";function _(n,f){let a=d(n,f);if(!a)return[];let t=n.get(`SELECT symbol, enclosing_symbol FROM global_symbols
1
+ import{a as d}from"./chunk-EVXQF7DM.js";import{a as g,c as m}from"./chunk-4VYIZV3S.js";function _(n,f){let a=d(n,f);if(!a)return[];let t=n.get(`SELECT symbol, enclosing_symbol FROM global_symbols
2
2
  WHERE id = ? LIMIT 1`,a.symbolId);if(!t)return[];let o=[{symbol:t.symbol,shortName:m(t.symbol),depth:0}],e=t.enclosing_symbol,r=1,c=new Set([t.symbol]);for(;e&&!c.has(e)&&r<20;){c.add(e);let s=n.get("SELECT symbol, enclosing_symbol FROM global_symbols WHERE symbol = ?",e);if(!s)break;o.push({symbol:s.symbol,shortName:m(s.symbol),depth:r}),e=s.enclosing_symbol,r++}if(o.length>1)return o;let y=g(t.symbol);if("kind"in y)return o;let l=y.descriptors;if(l.length<=1)return o;let b=[o[0]];for(let s=l.length-2,h=1;s>=0;s--,h++){let p=l.slice(0,s+1).map(i=>i.suffix==="method"?`${i.name}()`:i.name.replace(/\.(ts|tsx|js|jsx|mjs|cjs|py|pyi|rs|java|scala|kt|kts|rb|go|cs|vb|dart|php|c|cc|cpp|cxx|h|hpp)$/,"")).join(":");b.push({symbol:p,shortName:p,depth:h})}return b}export{_ as a};
3
- //# sourceMappingURL=chunk-KNA6Z7JB.js.map
3
+ //# sourceMappingURL=chunk-X2JB54QF.js.map
@@ -1,3 +1,3 @@
1
- import{r as d}from"./chunk-JB4PUN5S.js";import{a as h}from"./chunk-ZNUPGRPR.js";import{g}from"./chunk-7OX2O53H.js";import{a as m}from"./chunk-5TT47UMX.js";import{a as p}from"./chunk-NN3O7TPH.js";function _(t,r,n={}){let e=h(t,r);if(!e)return[];let l=!g(e.symbol)&&!t.isIgnored(e.relativePath)?[{relativePath:e.relativePath,line:e.startLine}]:[],c=d(t,e,{semantic:n.semantic}).map(o=>({relativePath:o.file,line:o.line})),s=R(t,e),f=new Set,a=[];for(let o of[...l,...c,...s]){let u=`${o.relativePath}:${o.line}`;f.has(u)||(f.add(u),a.push(o))}return a}function R(t,r){if(!r.relativePath.endsWith(".rb"))return[];let n=b(r.symbol);if(n.length===0)return[];let e=[];for(let i of p(t,{extensions:[".rb"],includeIgnored:!1})){let l=m(t,i);if(!l)continue;let c=l.split(`
1
+ import{r as d}from"./chunk-4GPWGSOE.js";import{a as h}from"./chunk-EVXQF7DM.js";import{g}from"./chunk-4VYIZV3S.js";import{a as m}from"./chunk-5TT47UMX.js";import{a as p}from"./chunk-NN3O7TPH.js";function _(t,r,n={}){let e=h(t,r);if(!e)return[];let l=!g(e.symbol)&&!t.isIgnored(e.relativePath)?[{relativePath:e.relativePath,line:e.startLine}]:[],c=d(t,e,{semantic:n.semantic}).map(o=>({relativePath:o.file,line:o.line})),s=R(t,e),f=new Set,a=[];for(let o of[...l,...c,...s]){let u=`${o.relativePath}:${o.line}`;f.has(u)||(f.add(u),a.push(o))}return a}function R(t,r){if(!r.relativePath.endsWith(".rb"))return[];let n=b(r.symbol);if(n.length===0)return[];let e=[];for(let i of p(t,{extensions:[".rb"],includeIgnored:!1})){let l=m(t,i);if(!l)continue;let c=l.split(`
2
2
  `);for(let s=0;s<c.length;s++){let f=c[s]??"";n.some(a=>new RegExp(`@${a}\\b|\\b${a}:`).test(f))&&e.push({relativePath:i,line:s})}}return e}function b(t){let n=(t.split(":").pop()??t).replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[^A-Za-z0-9_]+/g,"_").toLowerCase().replace(/^_+|_+$/g,""),e=n.split("_").filter(Boolean),i=new Set;return n&&i.add(n),e.length>=1&&i.add(e[e.length-1]),e.length>=2&&i.add(e.slice(-2).join("_")),[...i]}export{_ as a};
3
- //# sourceMappingURL=chunk-QWJBIBE6.js.map
3
+ //# sourceMappingURL=chunk-XANDY7N5.js.map
@@ -1,2 +1,2 @@
1
- import{b as m}from"./chunk-QAEDNTY7.js";import{a as l}from"./chunk-ZNUPGRPR.js";import{d as o,f as a}from"./chunk-7OX2O53H.js";import{basename as d}from"path";function M(t,c){let n=l(t,c);if(!n)return[];let r=o(n.symbol),s=new m(t).definitionsForFile(n.relativePath).filter(e=>a(e.symbol)),i=s.filter(e=>e.parentTypeName===r||e.symbol.includes(r));return(i.length>0?i:p(d(n.relativePath))===r?s.filter(e=>e.symbol.includes("<invalid-global-code>")):[]).map(e=>({startLine:e.startLine,endLine:e.endLine,name:o(e.symbol)}))}function p(t){return t.replace(/\.[^.]+$/,"")}export{M as a};
2
- //# sourceMappingURL=chunk-WJQY2LGT.js.map
1
+ import{a as m}from"./chunk-NBUINPSH.js";import{a as l}from"./chunk-EVXQF7DM.js";import{d as o,f as a}from"./chunk-4VYIZV3S.js";import{basename as d}from"path";function M(t,c){let n=l(t,c);if(!n)return[];let r=o(n.symbol),s=new m(t).definitionsForFile(n.relativePath).filter(e=>a(e.symbol)),i=s.filter(e=>e.parentTypeName===r||e.symbol.includes(r));return(i.length>0?i:p(d(n.relativePath))===r?s.filter(e=>e.symbol.includes("<invalid-global-code>")):[]).map(e=>({startLine:e.startLine,endLine:e.endLine,name:o(e.symbol)}))}function p(t){return t.replace(/\.[^.]+$/,"")}export{M as a};
2
+ //# sourceMappingURL=chunk-XDXZP3BE.js.map
@@ -1,4 +1,4 @@
1
- import{b as v,i as k,j as O,k as D,q as F}from"./chunk-JB4PUN5S.js";import{c as N,e as T}from"./chunk-7O4MJYIW.js";import{d as M,f as w,s as L,t as I,w as A}from"./chunk-7OX2O53H.js";import{e as E,l as C}from"./chunk-5TT47UMX.js";import{b as R}from"./chunk-NHDPYW7O.js";function le(e,n,o={}){let l=P(e,[n],{additive:o.additive,semantic:o.semantic}),i=o.callableOnly?(l.get(n.symbolId)??[]).filter(a=>w(a.symbol)):l.get(n.symbolId)??[];return typeof o.limit=="number"?i.slice(0,o.limit):i}function ie(e,n,o={}){let l=G(e)?W(e,n,{semantic:o.semantic!==!1}):J(e).get(n.symbolId)??[];return typeof o.limit=="number"?l.slice(0,o.limit):l}var x=R("caller-rows"),$=2e4;function G(e){return(e.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>$}function J(e){return x.get(e,()=>{let n=I(e),o=P(e,n),l=new Map;for(let c of n)l.set(c.symbol,c.symbolId);let i=new Map,a=new Map;for(let c of n){let s=o.get(c.symbolId);if(!(!s||s.length===0))for(let d of s){let t=l.get(d.symbol);if(t===void 0||t===c.symbolId)continue;let r=i.get(t);r||(r=[],i.set(t,r),a.set(t,new Set));let f=`${c.symbol}|${c.relativePath}`;a.get(t).has(f)||(a.get(t).add(f),r.push({symbol:c.symbol,file:c.relativePath,source:"caller-map-inversion"}))}}return i})}function W(e,n,o){let l=[],i=new Set,a=s=>{if(s.symbol===n.symbol)return;let d=`${s.symbol}|${s.file}`;i.has(d)||(i.add(d),l.push(s))};for(let s of F(e,n))s.file!==n.relativePath&&a({symbol:s.enclosingSymbol??s.file,file:s.file,source:"resolved-reference"});let c=o.semantic?B(e,n):null;if(c)for(let s of N(e,c)){if(s.file===n.relativePath||e.isIgnored(s.file))continue;let d=A(L(e,s.file),s.line);a({symbol:d?.symbol??s.file,file:s.file,source:"semantic-reference"})}return l}function B(e,n){return e.get(`SELECT
1
+ import{b as v,i as k,j as O,k as D,q as F}from"./chunk-4GPWGSOE.js";import{c as N,e as T}from"./chunk-5RGK4YA5.js";import{d as M,f as w,s as L,t as I,w as A}from"./chunk-4VYIZV3S.js";import{e as E,l as C}from"./chunk-5TT47UMX.js";import{b as R}from"./chunk-NHDPYW7O.js";function le(e,n,o={}){let l=P(e,[n],{additive:o.additive,semantic:o.semantic}),i=o.callableOnly?(l.get(n.symbolId)??[]).filter(a=>w(a.symbol)):l.get(n.symbolId)??[];return typeof o.limit=="number"?i.slice(0,o.limit):i}function ie(e,n,o={}){let l=G(e)?W(e,n,{semantic:o.semantic!==!1}):J(e).get(n.symbolId)??[];return typeof o.limit=="number"?l.slice(0,o.limit):l}var x=R("caller-rows"),$=2e4;function G(e){return(e.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>$}function J(e){return x.get(e,()=>{let n=I(e),o=P(e,n),l=new Map;for(let c of n)l.set(c.symbol,c.symbolId);let i=new Map,a=new Map;for(let c of n){let s=o.get(c.symbolId);if(!(!s||s.length===0))for(let d of s){let t=l.get(d.symbol);if(t===void 0||t===c.symbolId)continue;let r=i.get(t);r||(r=[],i.set(t,r),a.set(t,new Set));let f=`${c.symbol}|${c.relativePath}`;a.get(t).has(f)||(a.get(t).add(f),r.push({symbol:c.symbol,file:c.relativePath,source:"caller-map-inversion"}))}}return i})}function W(e,n,o){let l=[],i=new Set,a=s=>{if(s.symbol===n.symbol)return;let d=`${s.symbol}|${s.file}`;i.has(d)||(i.add(d),l.push(s))};for(let s of F(e,n))s.file!==n.relativePath&&a({symbol:s.enclosingSymbol??s.file,file:s.file,source:"resolved-reference"});let c=o.semantic?B(e,n):null;if(c)for(let s of N(e,c)){if(s.file===n.relativePath||e.isIgnored(s.file))continue;let d=A(L(e,s.file),s.line);a({symbol:d?.symbol??s.file,file:s.file,source:"semantic-reference"})}return l}function B(e,n){return e.get(`SELECT
2
2
  d.id AS documentId,
3
3
  gs.id AS symbolId,
4
4
  gs.symbol,
@@ -31,4 +31,4 @@ import{b as v,i as k,j as O,k as D,q as F}from"./chunk-JB4PUN5S.js";import{c as
31
31
  WHERE m.role = 1
32
32
  GROUP BY m.symbol_id
33
33
  ) def_chunk ON def_chunk.symbol_id = gs.id`);for(let t of c)a.has(t.symbol_id)||a.set(t.symbol_id,{symbol:t.symbol,file:t.document_id!==null?i.get(t.document_id)??"":""});let s=new Map,d=i;for(let t of n){let r=l.get(t.documentId)??[],f=new Set,p=[],b=null,y=()=>{if(b)return b;let m=d.get(t.documentId)??"",u=new Set;if(m){let h=v(e,m),S=Math.max(0,t.startLine),_=Math.min(h.length-1,t.endLine);for(let g=S;g<=_;g+=1)for(let H of h[g])u.add(H)}return b=u,u};for(let m of r){if(m.symbol_id===t.symbolId)continue;let u=a.get(m.symbol_id);if(!u)continue;if(!(m.start_line>=t.startLine&&m.end_line<=t.endLine)){if(!(m.start_line<=t.endLine&&m.end_line>=t.startLine))continue;let g=M(u.symbol);if(!g||!y().has(g))continue}let S=`${u.symbol}|${m.chunk_id}`;f.has(S)||(f.add(S),p.push({...u,chunkId:m.chunk_id,source:"scip-chunk"}))}s.set(t.symbolId,p)}return s}function q(e){let n=new Map;for(let[o,l]of e){let i=[];for(let a of l)i.push({symbol:a.symbol,file:a.file,chunkId:-1,source:"semantic-callee"});n.set(o,i)}return n}function se(e){x.invalidate(e)}export{le as a,ie as b,P as c,se as d};
34
- //# sourceMappingURL=chunk-ARBZM2NF.js.map
34
+ //# sourceMappingURL=chunk-YH6TTQEI.js.map