scip-query 0.11.0 → 0.12.0

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 (117) hide show
  1. package/README.md +23 -0
  2. package/dist/{chunk-3KDUITBE.js → chunk-2LQWMYG4.js} +2 -2
  3. package/dist/{chunk-KKMOB3OJ.js → chunk-2QGE5AEP.js} +2 -2
  4. package/dist/{chunk-HINMXZ6J.js → chunk-4D54JIU3.js} +2 -2
  5. package/dist/{chunk-CMHYBXJB.js → chunk-52Q4JFDW.js} +2 -2
  6. package/dist/{chunk-UIKLA3F5.js → chunk-64PRNLKP.js} +2 -2
  7. package/dist/{chunk-QJ3FK4TB.js → chunk-72MFTCU5.js} +2 -2
  8. package/dist/{chunk-7HB3CZFD.js → chunk-7ITCOJGD.js} +2 -2
  9. package/dist/{chunk-ZEKBR4OK.js → chunk-AZLKLZ5S.js} +2 -2
  10. package/dist/{chunk-ODVITBYU.js → chunk-B4VYXRCQ.js} +2 -2
  11. package/dist/{chunk-STBXCPKY.js → chunk-BCNT6ODA.js} +2 -2
  12. package/dist/{chunk-WPSS37EW.js → chunk-BP2NAIAZ.js} +2 -2
  13. package/dist/{chunk-LWOOTRHC.js → chunk-BVNO67DB.js} +2 -2
  14. package/dist/{chunk-NBXK32I6.js → chunk-CW3KZ7UF.js} +2 -2
  15. package/dist/{chunk-UMPNL7T6.js → chunk-D64L53WX.js} +2 -2
  16. package/dist/{chunk-IFSX6YVU.js → chunk-D7J6GZAG.js} +2 -2
  17. package/dist/{chunk-WQHWIVA7.js → chunk-ECVXWZ4Q.js} +2 -2
  18. package/dist/{chunk-H4LUPLEJ.js → chunk-EDB7Y442.js} +2 -2
  19. package/dist/{chunk-QXGTGE2C.js → chunk-ETU2I5JM.js} +2 -2
  20. package/dist/{chunk-VXTNADIW.js → chunk-EXKLAEB4.js} +2 -2
  21. package/dist/{chunk-MNEJYEHW.js → chunk-EZ5WDZ2Q.js} +2 -2
  22. package/dist/{chunk-DRPAQAFM.js → chunk-F5BJSNU5.js} +2 -2
  23. package/dist/{chunk-343O6EVV.js → chunk-FBCOFKEC.js} +2 -2
  24. package/dist/{chunk-H56MGERE.js → chunk-G2UBOONK.js} +2 -2
  25. package/dist/{chunk-GCN2P4EJ.js → chunk-H2NMIZFD.js} +2 -2
  26. package/dist/{chunk-GHXRVCIY.js → chunk-HSU3M25J.js} +2 -2
  27. package/dist/{chunk-PYZZBIEU.js → chunk-IRJDYTNZ.js} +2 -2
  28. package/dist/{chunk-PZS6J5YG.js → chunk-KSUZS77X.js} +2 -2
  29. package/dist/{chunk-HZKMEXA3.js → chunk-L2CX5GHZ.js} +2 -2
  30. package/dist/{chunk-X6OGDTQH.js → chunk-LFM3O5KX.js} +2 -2
  31. package/dist/{chunk-TTS75UF2.js → chunk-M72ZFN6E.js} +2 -2
  32. package/dist/chunk-MBKJ7GHT.js +102 -0
  33. package/dist/{chunk-3T2FNHIU.js → chunk-MJKJMWIM.js} +2 -2
  34. package/dist/{chunk-WFGOH2UI.js → chunk-MKM7NBZK.js} +2 -2
  35. package/dist/{chunk-3V6JQQM5.js → chunk-NKT5EMEX.js} +2 -2
  36. package/dist/{chunk-BN5SXXQS.js → chunk-NQ75OVUU.js} +2 -2
  37. package/dist/{chunk-BDRBPG7Y.js → chunk-O3WDE26W.js} +2 -2
  38. package/dist/{chunk-N2Z3CU7X.js → chunk-OPE5YXFE.js} +2 -2
  39. package/dist/{chunk-XHWLNQVZ.js → chunk-OSWF3HSF.js} +2 -2
  40. package/dist/{chunk-Y6L4LXPG.js → chunk-OVMUVXKQ.js} +2 -2
  41. package/dist/{chunk-P36UR5II.js → chunk-PH7ZFK6L.js} +2 -2
  42. package/dist/chunk-PXHPCWX5.js +2 -0
  43. package/dist/{chunk-K2HYR5A7.js → chunk-Q3B3FNCU.js} +2 -2
  44. package/dist/{chunk-7XL7J7PT.js → chunk-Q7S2DADC.js} +2 -2
  45. package/dist/{chunk-FLJJLSGB.js → chunk-RA5MTIOO.js} +2 -2
  46. package/dist/{chunk-WZLPXFZU.js → chunk-RIQED5OU.js} +2 -2
  47. package/dist/{chunk-VGMUFW3J.js → chunk-T6NGEV5I.js} +2 -2
  48. package/dist/{chunk-XMR747CP.js → chunk-T7VQG55Q.js} +2 -2
  49. package/dist/{chunk-LZNLRE4X.js → chunk-TTMKELT7.js} +2 -2
  50. package/dist/{chunk-X4O6K47U.js → chunk-UAHZ57BR.js} +2 -2
  51. package/dist/{chunk-RJMXSHKM.js → chunk-V3Z3IOWO.js} +2 -2
  52. package/dist/{chunk-M2YXL62V.js → chunk-V7CVBPWX.js} +2 -2
  53. package/dist/{chunk-C4ICAIJ4.js → chunk-YDDGCJJG.js} +2 -2
  54. package/dist/{chunk-N7PNFLGY.js → chunk-YPKBZ77R.js} +2 -2
  55. package/dist/{chunk-WGA5BBTA.js → chunk-Z3IPJKJP.js} +2 -2
  56. package/dist/{chunk-ALHNAPS2.js → chunk-ZOIPAYRP.js} +2 -2
  57. package/dist/{chunk-6Q6OFLFQ.js → chunk-ZRIOGL7F.js} +2 -2
  58. package/dist/cli.js +243 -243
  59. package/dist/index.js +1 -1
  60. package/dist/queries/affected.js +1 -1
  61. package/dist/queries/bottlenecks.js +1 -1
  62. package/dist/queries/by-kind.js +1 -1
  63. package/dist/queries/call-graph.js +1 -1
  64. package/dist/queries/change-surface.js +1 -1
  65. package/dist/queries/cleanup-plan.js +1 -1
  66. package/dist/queries/code.js +1 -1
  67. package/dist/queries/complexity-hotspots.js +1 -1
  68. package/dist/queries/complexity.js +1 -1
  69. package/dist/queries/convergence.js +1 -1
  70. package/dist/queries/coupling.js +1 -1
  71. package/dist/queries/dataflow.js +1 -1
  72. package/dist/queries/dead.js +1 -1
  73. package/dist/queries/deps.js +1 -1
  74. package/dist/queries/diff-gate.js +1 -1
  75. package/dist/queries/diff-impact.js +1 -1
  76. package/dist/queries/drift.js +1 -1
  77. package/dist/queries/duplicate-bodies.js +1 -1
  78. package/dist/queries/extract-candidates.js +1 -1
  79. package/dist/queries/fan.js +1 -1
  80. package/dist/queries/health.js +1 -1
  81. package/dist/queries/hierarchy.js +1 -1
  82. package/dist/queries/hotspots.js +1 -1
  83. package/dist/queries/imports.js +1 -1
  84. package/dist/queries/incomplete-migration.js +1 -1
  85. package/dist/queries/index.js +1 -1
  86. package/dist/queries/isolated.js +1 -1
  87. package/dist/queries/locality-candidates.js +1 -1
  88. package/dist/queries/members.js +1 -1
  89. package/dist/queries/methods.js +1 -1
  90. package/dist/queries/outline.js +1 -1
  91. package/dist/queries/passthrough-candidates.js +1 -1
  92. package/dist/queries/plan-context.js +1 -1
  93. package/dist/queries/recent-duplicates.js +1 -1
  94. package/dist/queries/redundant-reexports.js +1 -1
  95. package/dist/queries/refs.js +1 -1
  96. package/dist/queries/self-audit.js +1 -1
  97. package/dist/queries/similar-signatures.js +1 -1
  98. package/dist/queries/similar.js +1 -1
  99. package/dist/queries/slice.js +1 -1
  100. package/dist/queries/stale-abstractions.js +1 -1
  101. package/dist/queries/surface.js +1 -1
  102. package/dist/queries/symbols.js +1 -1
  103. package/dist/queries/system.js +1 -1
  104. package/dist/queries/trace.js +1 -1
  105. package/dist/queries/twin-ab.js +1 -1
  106. package/dist/queries/twin-drift.js +1 -1
  107. package/dist/queries/unused-imports.js +1 -1
  108. package/dist/queries/unused-params.js +1 -1
  109. package/dist/queries/wrapper-candidates.js +1 -1
  110. package/dist/reindex-worker.js +9 -9
  111. package/dist/reindex.d.ts +20 -1
  112. package/dist/reindex.js +19 -19
  113. package/docs/COMMAND_REFERENCE.md +2 -2
  114. package/package.json +20 -2
  115. package/skills/scip-tla-model-system/SKILL.md +17 -5
  116. package/dist/chunk-2VSDXOG5.js +0 -2
  117. package/dist/chunk-R3JY4EZ4.js +0 -102
@@ -0,0 +1,102 @@
1
+ import{a as f,b as N,c as m,d as E,e as M,f as p,h as k}from"./chunk-HXXMPYEF.js";import{h as R}from"./chunk-T2FQ4GHD.js";import{b as g,c as D,i as x,m as h,o as F}from"./chunk-WS3Z6W3M.js";import{a as S}from"./chunk-64MNV6AB.js";import{c as y}from"./chunk-7S5E7KWT.js";function ge(e,n){return e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.end_line, d.relative_path, gs.display_name, gs.documentation
2
+ FROM global_symbols gs
3
+ JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
4
+ JOIN documents d ON der.document_id = d.id
5
+ WHERE ${n.where}
6
+ ${e.pathExclusionsFor("d")}
7
+ ${w(n.orderBy)}
8
+ ${C(n.limit)}`,...n.params??[])}function De(e,n){return e.all(`SELECT
9
+ gs.id,
10
+ gs.symbol,
11
+ c.document_id,
12
+ MIN(c.start_line) AS start_line,
13
+ MAX(c.end_line) AS end_line,
14
+ d.relative_path,
15
+ gs.display_name,
16
+ gs.documentation
17
+ FROM global_symbols gs
18
+ JOIN mentions m ON m.symbol_id = gs.id
19
+ JOIN chunks c ON m.chunk_id = c.id
20
+ JOIN documents d ON c.document_id = d.id
21
+ WHERE m.role = 1
22
+ AND ${n.where}
23
+ ${e.pathExclusionsFor("d")}
24
+ GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path, gs.display_name, gs.documentation
25
+ ${w(n.orderBy)}
26
+ ${C(n.limit)}`,...n.params??[])}function w(e){return e?`ORDER BY ${e}`:""}function C(e){return typeof e=="number"?`LIMIT ${e}`:""}function $(e){return!e||!e.trim()?null:e.replace(/^```\w*\s*/,"").replace(/\s*```$/,"").replace(/^\(method\)\s*/,"").replace(/^\(property\)\s*/,"").replace(/^\(function\)\s*/,"").replace(/^\(class\)\s*/,"").replace(/^\(interface\)\s*/,"").replace(/^\(enum\)\s*/,"").replace(/^\(type alias\)\s*/,"").replace(/^\(const\)\s*/,"").replace(/^\(var\)\s*/,"").trim()||null}function T(e){if(!e)return null;let n=O(e);if(n)return n.replace(/\n/g," ");let t=e.indexOf("|");if(t===-1)return e.replace(/\n/g," ");let r=e.slice(t+1);return(O(r)??r).replace(/\n/g," ")}function O(e){return/^```(?:\w+)?\s*\n?([\s\S]*?)\n?```/.exec(e.trimStart())?.[1]?.trim()||null}function H(e,n={}){if(m(e.symbol)!==null)return n.includeClassMemberFallbacks===!0;let i=(e.documentation??"").replace(/^```\w*\s*/,"").replace(/\s*```$/,"").trim();return/^(?:var|let|const|function|class|interface|type|enum)\b/.test(i)}function _(e,n,t={}){let r=new Map;for(let o of n)e.length>0&&!H(o,{includeClassMemberFallbacks:t.includeClassMemberFallbacks})||r.set(o.id,o);for(let o of e)r.set(o.id,o);let i=[...r.values()];return t.sort?i.sort((o,s)=>o.start_line-s.start_line||o.end_line-s.end_line||o.symbol.localeCompare(s.symbol)):i}var G=y("file-definitions",{clearGroups:["definition-catalog"]}),W=y("file-function-like-definitions",{clearGroups:["definition-catalog"]}),A=new WeakMap;function L(e,n,t={}){return t.includeClassMemberFallbacks?I(e,n,void 0,{includeClassMemberFallbacks:!0}):G.get(e,n,()=>{let r=B(e,n);if(r)return r;let i=I(e,n),o=D(e),s=f(e).forFile(n,{text:!0}).text;return o&&s&&v.write(e,n,g(e,n,s),{projectFingerprint:o,definitions:i.map(l=>({...l}))}),i})}function Y(e,n){return W.get(e,n,()=>{let t=B(e,n);return t?t.filter(r=>r.isFunctionLike):I(e,n,r=>r.isFunctionLike)})}var v=h({kind:"file-definitions",invalidation:F("file-definitions"),serialize:K,deserialize:U});function B(e,n){let t=D(e);if(!t)return null;let r=f(e).forFile(n,{text:!0}).text;if(!r)return null;let i=v.read(e,n,g(e,n,r));return i?q(i,t,n):null}function K(e){return JSON.stringify(e)}function U(e){try{let n=JSON.parse(e);return!x(n)||typeof n.projectFingerprint!="string"||!Array.isArray(n.definitions)?null:{projectFingerprint:n.projectFingerprint,definitions:n.definitions}}catch{return null}}function q(e,n,t){if(e.projectFingerprint!==n)return null;let r=[];for(let i of e.definitions){let o=X(i,t);if(!o)return null;r.push(o)}return r}function X(e,n){return!x(e)||typeof e.symbolId!="number"||typeof e.symbol!="string"||typeof e.documentId!="number"||typeof e.startLine!="number"||typeof e.endLine!="number"||e.relativePath!==n||typeof e.leaf!="string"||typeof e.parentTypeName!="string"&&e.parentTypeName!==null||typeof e.isFunctionLike!="boolean"||typeof e.isTypeLike!="boolean"||typeof e.kind!="number"&&e.kind!==null||typeof e.documentation!="string"&&e.documentation!==null||typeof e.enclosingSymbol!="string"&&e.enclosingSymbol!==null?null:{symbolId:e.symbolId,symbol:e.symbol,documentId:e.documentId,startLine:e.startLine,endLine:e.endLine,relativePath:e.relativePath,leaf:e.leaf,parentTypeName:e.parentTypeName,isFunctionLike:e.isFunctionLike,isTypeLike:e.isTypeLike,kind:e.kind,documentation:e.documentation,enclosingSymbol:e.enclosingSymbol}}function I(e,n,t,r={}){let i=_(Z(e,n),V(e,n),{sort:!0,includeClassMemberFallbacks:r.includeClassMemberFallbacks}).map(J);return t&&(i=i.filter(t)),j(e,n,i)}function Z(e,n){return e.all(`SELECT
27
+ gs.id,
28
+ gs.symbol,
29
+ der.document_id,
30
+ der.start_line,
31
+ der.end_line,
32
+ d.relative_path,
33
+ gs.display_name,
34
+ gs.kind,
35
+ gs.documentation,
36
+ gs.enclosing_symbol
37
+ FROM global_symbols gs
38
+ JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
39
+ JOIN documents d ON der.document_id = d.id
40
+ WHERE d.relative_path = ?
41
+ ${e.symbolNoiseFor("gs")}
42
+ ORDER BY der.start_line, der.end_line`,n)}function V(e,n){return e.all(`SELECT
43
+ gs.id,
44
+ gs.symbol,
45
+ c.document_id,
46
+ MIN(c.start_line) AS start_line,
47
+ MAX(c.end_line) AS end_line,
48
+ d.relative_path,
49
+ gs.display_name,
50
+ gs.kind,
51
+ gs.documentation,
52
+ gs.enclosing_symbol
53
+ FROM global_symbols gs
54
+ JOIN mentions m ON m.symbol_id = gs.id
55
+ JOIN chunks c ON m.chunk_id = c.id
56
+ JOIN documents d ON c.document_id = d.id
57
+ WHERE d.relative_path = ?
58
+ AND m.role = 1
59
+ ${e.symbolNoiseFor("gs")}
60
+ GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
61
+ ORDER BY start_line, end_line`,n)}function J(e){return{symbolId:e.id,symbol:e.symbol,documentId:e.document_id,startLine:e.start_line,endLine:e.end_line,relativePath:e.relative_path,leaf:M(e.symbol),parentTypeName:m(e.symbol),isFunctionLike:k(e.symbol),isTypeLike:p(e.symbol)==="type",kind:e.kind??null,documentation:e.documentation??null,enclosingSymbol:e.enclosing_symbol??null}}function we(e,n={}){return ee(e,n.scope)}function ee(e,n){return S(e,{scope:n,includeIgnored:!1}).flatMap(t=>L(e,t)).filter(t=>!e.isIgnored(t.relativePath))}function Ce(e,n){return S(e,{scope:n,includeIgnored:!1}).flatMap(t=>Y(e,t)).filter(t=>!e.isIgnored(t.relativePath))}function $e(e,n){let t=Q(ne(e,n.scope,n.sqlPrefilter)),r=Q(te(e,n.scope,n.sqlPrefilter)),i=new Set([...t.keys(),...r.keys()]),o=[];for(let s of[...i].sort()){if(e.isIgnored(s))continue;let l=_(t.get(s)??[],r.get(s)??[],{sort:!0}).filter(a=>n.symbolMatches(a.symbol));l.length!==0&&o.push(...j(e,s,l.map(J)))}return o}function ne(e,n,t){let r=n?"AND d.relative_path LIKE ?":"",i=t?`AND ${z("gs",t)}`:"",o=n?[`%${n}%`]:[];return e.all(`SELECT
62
+ gs.id,
63
+ gs.symbol,
64
+ der.document_id,
65
+ der.start_line,
66
+ der.end_line,
67
+ d.relative_path,
68
+ gs.display_name,
69
+ gs.kind,
70
+ gs.documentation,
71
+ gs.enclosing_symbol
72
+ FROM global_symbols gs
73
+ JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
74
+ JOIN documents d ON der.document_id = d.id
75
+ WHERE 1 = 1
76
+ ${e.pathExclusionsFor("d")}
77
+ ${r}
78
+ ${i}
79
+ ${e.symbolNoiseFor("gs")}
80
+ ORDER BY d.relative_path, der.start_line, der.end_line`,...o)}function te(e,n,t){let r=n?"AND d.relative_path LIKE ?":"",i=t?`AND ${z("gs",t)}`:"",o=n?[`%${n}%`]:[];return e.all(`SELECT
81
+ gs.id,
82
+ gs.symbol,
83
+ c.document_id,
84
+ MIN(c.start_line) AS start_line,
85
+ MAX(c.end_line) AS end_line,
86
+ d.relative_path,
87
+ gs.display_name,
88
+ gs.kind,
89
+ gs.documentation,
90
+ gs.enclosing_symbol
91
+ FROM global_symbols gs
92
+ JOIN mentions m ON m.symbol_id = gs.id
93
+ JOIN chunks c ON m.chunk_id = c.id
94
+ JOIN documents d ON c.document_id = d.id
95
+ WHERE m.role = 1
96
+ ${e.pathExclusionsFor("d")}
97
+ ${r}
98
+ ${i}
99
+ ${e.symbolNoiseFor("gs")}
100
+ GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
101
+ ORDER BY d.relative_path, start_line, end_line`,...o)}function ie(e){return`(${e}.symbol LIKE '%().' OR ${e}.symbol LIKE '%()')`}function z(e,n){return n==="callable"?ie(e):re(e)}function re(e){return`(${e}.symbol LIKE '%.' OR ${e}.symbol LIKE '%()')`}function Q(e){let n=new Map;for(let t of e){let r=n.get(t.relative_path);r?r.push(t):n.set(t.relative_path,[t])}return n}function Te(e,n,t={}){if(n.length===0)return[];let r=n.flatMap(i=>L(e,i)).filter(i=>!e.isIgnored(i.relativePath));return t.onlyDocumented&&(r=r.filter(i=>i.documentation!==null&&i.documentation!=="")),t.sort&&(r=r.sort((i,o)=>i.relativePath.localeCompare(o.relativePath)||i.startLine-o.startLine||i.endLine-o.endLine)),r.map(i=>({startLine:i.startLine,endLine:i.endLine,symbol:i.symbol,shortName:E(i.symbol),signature:$(T(i.documentation)),relativePath:i.relativePath,enclosingSymbol:i.enclosingSymbol}))}function oe(e){let n=new Map,t=e.map((r,i)=>({definition:r,index:i,span:r.endLine-r.startLine})).sort((r,i)=>r.span-i.span||r.index-i.index);for(let{definition:r}of t)for(let i=r.startLine;i<=r.endLine;i+=1)n.has(i)||n.set(i,r);return n}function Ae(e,n){let t=A.get(e);return t||(t=oe(e),A.set(e,t)),t.get(n)??null}function Qe(e,n){let t=L(e,n.relative_path).find(r=>r.symbolId===n.id);return t?{symbolId:t.symbolId,symbol:t.symbol,documentId:t.documentId,startLine:t.startLine,endLine:t.endLine,relativePath:t.relativePath}:{symbolId:n.id,symbol:n.symbol,documentId:n.document_id,startLine:n.start_line,endLine:n.end_line,relativePath:n.relative_path}}function j(e,n,t){let r=f(e).forFile(n,{text:!0}).text,i=R(e,n);return i?me(t,i,r):r?se(t,r):t}function se(e,n){let t=n.split(/\r?\n/),r=le(e,t),i=ae(e,r),o=ce(i,t);return de(e,o)}function le(e,n){let t=e.some(i=>b(i.symbol))?pe(n):null,r=new Map;for(let i of e)r.set(i.symbolId,fe(n,t,i));return r}function ae(e,n){return e.filter(t=>b(t.symbol)).map(t=>({definition:t,startLine:n.get(t.symbolId)??t.startLine})).sort((t,r)=>t.startLine-r.startLine||t.definition.startLine-r.definition.startLine||t.definition.symbol.localeCompare(r.definition.symbol))}function ce(e,n){let t=new Map;for(let r=0;r<e.length;r+=1){let i=e[r],o=e[r+1],s=o?Math.max(i.startLine,o.startLine-1):n.length-1;t.set(i.definition.symbolId,{startLine:i.startLine,endLine:be(n,i.definition,i.startLine,s)})}return t}function de(e,n){return e.map(t=>{let r=n.get(t.symbolId);return r?{...t,startLine:r.startLine,endLine:r.endLine}:t})}function me(e,n,t=null){let r=new Map;for(let i of n){let o=r.get(i.name);o?o.push(i):r.set(i.name,[i])}return e.map(i=>{if(!ue(i)||!i.leaf)return P(i,t);let o=r.get(i.leaf);if(!o||o.length===0)return P(i,t);let s=o[0],l=Math.abs(s.startLine-i.startLine);for(let a=1;a<o.length;a+=1){let c=o[a],d=Math.abs(c.startLine-i.startLine);d<l&&(s=c,l=d)}return{...i,startLine:s.startLine,endLine:s.endLine}})}function ue(e){return b(e.symbol)?!0:p(e.symbol)==="term"&&m(e.symbol)===null}function P(e,n){if(!n||!e.leaf||p(e.symbol)!=="term"||m(e.symbol)!==null)return e;let t=e.leaf.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`\\b(?:export\\s+)?(?:const|let|var)\\s+${t}\\b`),o=n.split(/\r?\n/).findIndex(s=>r.test(s));return o>=0?{...e,startLine:o,endLine:o}:e}function fe(e,n,t){if(!b(t.symbol))return t.startLine;let r=Math.max(0,Math.min(t.startLine,e.length-1));if(!n)return r;let i=n.get(t.leaf);if(!i||i.length===0)return r;let o=null;for(let s of i){let l=Math.abs(s-t.startLine);(!o||l<o.distance)&&(o={line:s,distance:l})}return o?.line??r}function pe(e){let n=/\b(?:function|def|fn)\s+([A-Za-z_$][\w$]*)/g,t=/\b([A-Za-z_$][\w$]*)\s*[:=]\s*(?:async\s*)?(?:function\b|\()/g,r=/^\s*(?:(?:export|public|private|protected|static|readonly|async|abstract|get|set)\s+)*([A-Za-z_$][\w$]*)\s*(?:<[^(]*>)?\s*\(/,i=/\b([A-Za-z_$][\w$]*)\s*\(/g,o=new Map,s=(l,a)=>{let c=o.get(l);if(!c){o.set(l,[a]);return}c[c.length-1]!==a&&c.push(a)};for(let l=0;l<e.length;l+=1){let a=e[l]??"";for(let d of a.matchAll(n))d[1]&&s(d[1],l);for(let d of a.matchAll(t))d[1]&&s(d[1],l);let c=a.match(r);c?.[1]&&s(c[1],l);for(let d of a.matchAll(i))d[1]&&s(d[1],l)}return o}function be(e,n,t,r){let i=Math.max(t,Math.min(e.length-1,r)),o=Math.max(t,Math.min(i,n.endLine)),s=0,l=0,a=!1;for(let c=t;c<=i;c+=1){let d=ye(e[c]??"");for(let u of d)u==="{"?(s+=1,a=!0):u==="}"?s=Math.max(0,s-1):u==="("?l+=1:u===")"&&(l=Math.max(0,l-1));if(a&&s===0||!a&&l===0&&c>=o)return c}return o}function ye(e){let n="",t=null,r=!1;for(let i=0;i<e.length;i+=1){let o=e[i],s=e[i+1];if(!t&&o==="/"&&s==="/"){n+=" ".repeat(e.length-i);break}if(t){if(r){r=!1,n+=" ";continue}if(o==="\\"){r=!0,n+=" ";continue}o===t&&(t=null),n+=" ";continue}if(o==='"'||o==="'"||o==="`"){t=o,n+=" ";continue}n+=o}return n}function b(e){return e.includes("().")}function Pe(e){let n=N(e);if("kind"in n)return[];let t=[];for(let r=n.descriptors.length-2;r>=0;r-=1){let i=n.descriptors[r];i?.suffix==="type"&&i.name&&t.push(i.name)}return t}export{ge as a,De as b,$ as c,T as d,_ as e,L as f,we as g,ee as h,Ce as i,$e as j,Te as k,oe as l,Ae as m,Qe as n,Pe as o};
102
+ //# sourceMappingURL=chunk-MBKJ7GHT.js.map
@@ -1,2 +1,2 @@
1
- import{c as i}from"./chunk-B75HZHUP.js";import{a,c as m}from"./chunk-QJ3FK4TB.js";import{a as r}from"./chunk-WQHWIVA7.js";import{d as o}from"./chunk-HXXMPYEF.js";function S(s,n,c={}){let e=r(s,n);if(!e)return null;let t=c.semantic!==!1,y=m(s,e,{limit:50,semantic:t}),b=i(a(s,e,{limit:50,additive:!0,callableOnly:!0,semantic:t}));return{symbol:e.symbol,shortName:o(e.symbol),callers:y.map(l=>({symbol:l.symbol,shortName:o(l.symbol),file:l.file})),callees:b.map(l=>({symbol:l.symbol,shortName:o(l.symbol),file:l.file}))}}export{S as a};
2
- //# sourceMappingURL=chunk-3T2FNHIU.js.map
1
+ import{c as i}from"./chunk-B75HZHUP.js";import{a,c as m}from"./chunk-72MFTCU5.js";import{a as r}from"./chunk-ECVXWZ4Q.js";import{d as o}from"./chunk-HXXMPYEF.js";function S(s,n,c={}){let e=r(s,n);if(!e)return null;let t=c.semantic!==!1,y=m(s,e,{limit:50,semantic:t}),b=i(a(s,e,{limit:50,additive:!0,callableOnly:!0,semantic:t}));return{symbol:e.symbol,shortName:o(e.symbol),callers:y.map(l=>({symbol:l.symbol,shortName:o(l.symbol),file:l.file})),callees:b.map(l=>({symbol:l.symbol,shortName:o(l.symbol),file:l.file}))}}export{S as a};
2
+ //# sourceMappingURL=chunk-MJKJMWIM.js.map
@@ -1,4 +1,4 @@
1
- import{d as O}from"./chunk-C4ICAIJ4.js";import{d as R}from"./chunk-WQHWIVA7.js";import{f as F,m as T}from"./chunk-R3JY4EZ4.js";import{e as d}from"./chunk-HXXMPYEF.js";import{a as v,b as k,d as h,m as y}from"./chunk-T2FQ4GHD.js";import{x as A}from"./chunk-ISLWJ4PY.js";import{p as m}from"./chunk-WS3Z6W3M.js";import{a as w,c as p,g as L}from"./chunk-GNG622H3.js";import{c as u,d as D}from"./chunk-7S5E7KWT.js";function _(e,r,n,t={}){if(!n)return[];let i=m(e,r);return i?i.indexOf(n)===-1?[]:(N(e,r).get(n)??[]).filter(o=>!W(o,t)):[]}function W(e,r){return typeof r.excludeStartLine=="number"&&typeof r.excludeEndLine=="number"&&e>=r.excludeStartLine&&e<=r.excludeEndLine}var Y=u("file-identifiers",{clearGroups:["whole-project","source-file"]});function P(e,r){let n=h(e,r);return n?n.fileIdentifiers:Y.get(e,r,()=>new Set(N(e,r).keys()))}var Q=u("file-ident-lines",{clearGroups:["whole-project","source-file"]});function N(e,r){let n=h(e,r);return n?n.identifierLineMap:Q.get(e,r,()=>X(e,r))}var V=u("file-idents-by-line",{clearGroups:["whole-project","source-file"]});function ge(e,r){let n=h(e,r);return n?n.identifiersByLine:V.get(e,r,()=>{let t=N(e,r),i=0;for(let o of t.values()){let c=o[o.length-1];c!==void 0&&c>i&&(i=c)}let a=new Array(i+1);for(let o=0;o<=i;o+=1)a[o]=new Set;for(let[o,c]of t)for(let s of c)a[s].add(o);return a})}function X(e,r){let n=new Map,t=(c,s)=>{let l=n.get(c);if(!l){n.set(c,[s]);return}l[l.length-1]!==s&&l.push(s)},i=m(e,r);if(!i)return n;let a=k(i).split(/\r?\n/),o=/\b([A-Za-z_$][\w$]*)\b/g;for(let c=0;c<a.length;c+=1){let s=a[c]??"";for(let l of s.matchAll(o))l[1]&&t(l[1],c)}return n}function Se(e,r){return I(e,r,n=>{let t=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT
1
+ import{d as O}from"./chunk-YDDGCJJG.js";import{d as R}from"./chunk-ECVXWZ4Q.js";import{f as F,m as T}from"./chunk-MBKJ7GHT.js";import{e as d}from"./chunk-HXXMPYEF.js";import{a as v,b as k,d as h,m as y}from"./chunk-T2FQ4GHD.js";import{x as A}from"./chunk-ISLWJ4PY.js";import{p as m}from"./chunk-WS3Z6W3M.js";import{a as w,c as p,g as L}from"./chunk-GNG622H3.js";import{c as u,d as D}from"./chunk-7S5E7KWT.js";function _(e,r,n,t={}){if(!n)return[];let i=m(e,r);return i?i.indexOf(n)===-1?[]:(N(e,r).get(n)??[]).filter(o=>!W(o,t)):[]}function W(e,r){return typeof r.excludeStartLine=="number"&&typeof r.excludeEndLine=="number"&&e>=r.excludeStartLine&&e<=r.excludeEndLine}var Y=u("file-identifiers",{clearGroups:["whole-project","source-file"]});function P(e,r){let n=h(e,r);return n?n.fileIdentifiers:Y.get(e,r,()=>new Set(N(e,r).keys()))}var Q=u("file-ident-lines",{clearGroups:["whole-project","source-file"]});function N(e,r){let n=h(e,r);return n?n.identifierLineMap:Q.get(e,r,()=>X(e,r))}var V=u("file-idents-by-line",{clearGroups:["whole-project","source-file"]});function ge(e,r){let n=h(e,r);return n?n.identifiersByLine:V.get(e,r,()=>{let t=N(e,r),i=0;for(let o of t.values()){let c=o[o.length-1];c!==void 0&&c>i&&(i=c)}let a=new Array(i+1);for(let o=0;o<=i;o+=1)a[o]=new Set;for(let[o,c]of t)for(let s of c)a[s].add(o);return a})}function X(e,r){let n=new Map,t=(c,s)=>{let l=n.get(c);if(!l){n.set(c,[s]);return}l[l.length-1]!==s&&l.push(s)},i=m(e,r);if(!i)return n;let a=k(i).split(/\r?\n/),o=/\b([A-Za-z_$][\w$]*)\b/g;for(let c=0;c<a.length;c+=1){let s=a[c]??"";for(let l of s.matchAll(o))l[1]&&t(l[1],c)}return n}function Se(e,r){return I(e,r,n=>{let t=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT
2
2
  m.symbol_id,
3
3
  d.relative_path,
4
4
  COUNT(*) AS ref_count
@@ -40,4 +40,4 @@ import{d as O}from"./chunk-C4ICAIJ4.js";import{d as R}from"./chunk-WQHWIVA7.js";
40
40
  ) mention_doc ON mention_doc.symbol_id = gs.id
41
41
  WHERE 1 = 1
42
42
  ${e.symbolNoiseFor("gs")}`),n=new Map;for(let t of r){if(!t.relative_path||e.isIgnored(t.relative_path))continue;let i=d(t.symbol);if(!i)continue;let a=n.get(i);a||(a=[],n.set(i,a)),a.some(o=>o.symbolId===t.id)||a.push({symbol:t.symbol,symbolId:t.id,file:t.relative_path})}return n})}var K=u("source-import-paths-by-local-name",{clearGroups:["whole-project","source-file"]});function H(e,r){let n=w(r);return K.get(e,n,()=>ee(e,n))}function ee(e,r){let n=new Map;for(let t of y(e,r)){if(!t.sourcePath)continue;let i=t.localName??t.importedName;if(i&&B(n,i,t.sourcePath),t.kind==="namespace")for(let a of t.usedMembers)B(n,a,t.sourcePath)}return n}function B(e,r,n){let t=e.get(r);t||(t=new Set,e.set(r,t)),t.add(n)}var z=/[A-Za-z_$][A-Za-z0-9_$]*/g,G=/^[A-Za-z_$][A-Za-z0-9_$]*$/,ne=512;function C(e){let r=[],n=!1;for(let t of e)t&&(n=!0,G.test(t)||r.push(t));return{candidateNames:e,hasUsableCandidate:n,nonIdentifierNames:r}}function J(e,r){let n=te(r)?r:C(r);if(n.candidateNames.size===0||!n.hasUsableCandidate)return!0;if(n.candidateNames.size<=ne){for(let i of n.candidateNames)if(i){if(G.test(i)){if(re(i).test(e))return!0;continue}if(e.includes(i))return!0}return!1}z.lastIndex=0;let t;for(;(t=z.exec(e))!==null;)if(n.candidateNames.has(t[0]))return!0;for(let i of n.nonIdentifierNames)if(e.includes(i))return!0;return!1}function te(e){return"candidateNames"in e}function re(e){return new RegExp(`(?<![A-Za-z_$0-9])${v(e)}(?![A-Za-z_$0-9])`)}function M(e,r,n){let t=x(e).get(n);if(!t||t.length===0)return[];if(t.length===1)return[g(t[0])];let i=t.filter(s=>s.file===r);if(i.length>0)return i.map(g);let a=H(e,r),o=a.get(n);if(o)for(let s of o){let l=t.filter(f=>p(s,f.file));if(l.length>0)return l.map(g)}let c=new Set;for(let s of a.values())for(let l of s)c.add(l);for(let s of c){let l=t.filter(f=>p(s,f.file));if(l.length>0&&l.length===t.length)return l.map(g)}return[]}function Ue(e,r,n){let t=M(e,r,n);if(t.length>0)return t;let i=x(e).get(n);return!i||i.length===0?[]:i.map(g)}function Z(e,r,n={}){let t=R(e,r);if(!t)return[];let i=d(t.symbol);if(!i)return[];if(n.semantic!==!1){let o=O(e,{...t,leaf:i,parentTypeName:null,isFunctionLike:!1,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null});if(o.length>0){let c=new Map;for(let s of o){let l=c.get(s.file)??[];l.push(s.line),c.set(s.file,l)}return E(e,c)}}let a=new Map;for(let o of L(e)){let c=m(e,o);if(!c||c.indexOf(i)===-1||o!==t.relativePath&&!M(e,o,i).some(f=>f.symbolId===t.symbolId))continue;let s=_(e,o,i,o===t.relativePath?{excludeStartLine:t.startLine,excludeEndLine:t.endLine}:{});s.length>0&&a.set(o,s)}return E(e,a)}function We(e,r,n={}){let t=new Map;for(let s of r){if(!s.leaf)continue;let l=t.get(s.leaf)??[];l.push(s),t.set(s.leaf,l)}if(t.size===0)return new Map;let i=new Set(r.map(s=>s.symbolId)),a=new Set(t.keys()),o=C(a),c=new Map;for(let s of L(e)){if(n.skipPath?.(s)||!J(m(e,s),o))continue;let l=P(e,s);if(l.size!==0){for(let f of l)if(t.has(f))for(let b of M(e,s,f)){if(!i.has(b.symbolId)||s===b.relativePath)continue;let S=c.get(b.symbolId);S||(S=new Set,c.set(b.symbolId,S)),S.add(s)}}}return c}function g(e){return{symbolId:e.symbolId,symbol:e.symbol,relativePath:e.file}}function E(e,r){let n=[],t=new Set;for(let[i,a]of r){let o=F(e,i);for(let c of a){let s=T(o,c),l=`${i}|${c}|${s?.symbol??""}`;t.has(l)||(t.add(l),n.push({file:i,line:c,enclosingSymbol:s?.symbol??null}))}}return n}function ie(e,r){let n=fe(e,r);return n?E(e,se(e,n.match,n.identifier)):[]}function en(e,r,n={}){return oe(e,r,n).map(t=>({file:t.file,line:t.line,enclosingSymbol:t.enclosingSymbol}))}function oe(e,r,n={}){let t=Z(e,r,{semantic:n.semantic}),i=t.length>0?U(t,"source-attribution"):U(ie(e,r),"scip-reference-chunk");return n.includeIgnored===!0?i:i.filter(a=>!e.isIgnored(a.file))}function U(e,r){return e.map(n=>({...n,provenance:r}))}function se(e,r,n){let t=new Map;for(let[i,a]of ae(e,r.symbolId))t.set(i,ce(e,i,a,r,n));return t}function ae(e,r){let n=new Map;for(let t of $(e,[r])){if(e.isIgnored(t.relative_path))continue;let i=n.get(t.relative_path);i||(i=[],n.set(t.relative_path,i)),i.push({start_line:t.chunk_start,end_line:t.chunk_end})}return n}function ce(e,r,n,t,i){let a=r===t.relativePath?{excludeStartLine:t.startLine,excludeEndLine:t.endLine}:{},o=i?_(e,r,i,a):[];return n.flatMap(c=>le(o,c))}function le(e,r){let n=e.filter(t=>t>=r.start_line&&t<=r.end_line);return n.length>0?n:[r.start_line]}function fe(e,r){let n=R(e,r);return n?{match:n,identifier:d(n.symbol)||null}:null}export{N as a,ge as b,Se as c,he as d,ye as e,$ as f,xe as g,Ce as h,x as i,C as j,J as k,H as l,M as m,Ue as n,We as o,ie as p,en as q};
43
- //# sourceMappingURL=chunk-WFGOH2UI.js.map
43
+ //# sourceMappingURL=chunk-MKM7NBZK.js.map
@@ -1,2 +1,2 @@
1
- import{a as f}from"./chunk-X4O6K47U.js";import{a as L}from"./chunk-WQHWIVA7.js";import{d as i,e as b,f as u,l as c}from"./chunk-HXXMPYEF.js";import{d as l}from"./chunk-T2FQ4GHD.js";import{x as a}from"./chunk-ISLWJ4PY.js";function S(o,s){let t=L(o,s);if(!t)return[];let e=new f(o).definitionsForFile(t.relativePath).filter(r=>r.symbol!==t.symbol).filter(r=>c(t.symbol,r.symbol)).sort((r,m)=>r.startLine-m.startLine||r.endLine-m.endLine).map(r=>({symbol:r.symbol,shortName:i(r.symbol),startLine:r.startLine,endLine:r.endLine,kind:u(r.symbol)??"unknown"}));return a(t.relativePath)!=="clojure"?e:d(e,y(o,t))}function y(o,s){let t=b(s.symbol);if(!t)return[];let n=i(s.symbol);return(l(o,s.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===t).map(e=>({symbol:`${s.symbol}${e.memberName}().`,shortName:`${n}:${e.memberName}()`,startLine:e.startLine,endLine:e.endLine,kind:e.memberKind}))}function d(o,s){let t=new Map;for(let n of[...o,...s])t.set(`${n.shortName}:${n.startLine}:${n.endLine}`,n);return[...t.values()].sort((n,e)=>n.startLine-e.startLine||n.endLine-e.endLine)}export{S as a};
2
- //# sourceMappingURL=chunk-3V6JQQM5.js.map
1
+ import{a as f}from"./chunk-UAHZ57BR.js";import{a as L}from"./chunk-ECVXWZ4Q.js";import{d as i,e as b,f as u,l as c}from"./chunk-HXXMPYEF.js";import{d as l}from"./chunk-T2FQ4GHD.js";import{x as a}from"./chunk-ISLWJ4PY.js";function S(o,s){let t=L(o,s);if(!t)return[];let e=new f(o).definitionsForFile(t.relativePath).filter(r=>r.symbol!==t.symbol).filter(r=>c(t.symbol,r.symbol)).sort((r,m)=>r.startLine-m.startLine||r.endLine-m.endLine).map(r=>({symbol:r.symbol,shortName:i(r.symbol),startLine:r.startLine,endLine:r.endLine,kind:u(r.symbol)??"unknown"}));return a(t.relativePath)!=="clojure"?e:d(e,y(o,t))}function y(o,s){let t=b(s.symbol);if(!t)return[];let n=i(s.symbol);return(l(o,s.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===t).map(e=>({symbol:`${s.symbol}${e.memberName}().`,shortName:`${n}:${e.memberName}()`,startLine:e.startLine,endLine:e.endLine,kind:e.memberKind}))}function d(o,s){let t=new Map;for(let n of[...o,...s])t.set(`${n.shortName}:${n.startLine}:${n.endLine}`,n);return[...t.values()].sort((n,e)=>n.startLine-e.startLine||n.endLine-e.endLine)}export{S as a};
2
+ //# sourceMappingURL=chunk-NKT5EMEX.js.map
@@ -1,4 +1,4 @@
1
- import{b as w}from"./chunk-MNEJYEHW.js";import{b as g}from"./chunk-WQHWIVA7.js";import{c as h,d as f}from"./chunk-MTDBHTSF.js";import{c as b,d as p}from"./chunk-R3JY4EZ4.js";import{d as u,e as c,h as m}from"./chunk-HXXMPYEF.js";import{dirname as $,relative as T,resolve as k}from"path";var A=new Set(f());function O(t,n){return`tests/generated/twin-ab/${y(t)}-vs-${y(n)}.test.ts`}function y(t){return(t.split(/[/#]/).pop()||t).replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"symbol"}function I(t,n,a,e){let o=d(t,n);if(!o.ok)return o;let i=d(t,a);if(!i.ok)return i;let r=o.symbol.paramCount===null||i.symbol.paramCount===null?null:o.symbol.paramCount===i.symbol.paramCount,s=v(o.symbol,i.symbol,t.config.projectRoot,e,r);return{ok:!0,a:o.symbol,b:i.symbol,signatureCompatible:r,testSource:s}}function d(t,n){let e=g(t,n).match;if(!e)return{ok:!1,reason:`${n} does not resolve to an indexed symbol.`};let i=t.get("SELECT kind FROM global_symbols WHERE id = ?",e.symbolId)?.kind??null;if(!(i!==null?A.has(i):m(e.symbol)))return{ok:!1,reason:`${n} resolves to ${u(e.symbol)}${i!==null?` with SCIP kind ${h(i)}`:""} \u2014 twin-ab compares call outputs, so both referents must be functions or methods.`};if(!w(t,e))return{ok:!1,reason:`${n} (${u(e.symbol)} at ${e.relativePath}:${e.startLine+1}) is not exported \u2014 twin-ab needs an importable named binding for both twins.`};let s=t.get("SELECT documentation FROM global_symbols WHERE id = ?",e.symbolId),l=b(p(s?.documentation??null));return{ok:!0,symbol:{ref:n,symbol:e.symbol,shortName:c(e.symbol)||u(e.symbol),file:e.relativePath,startLine:e.startLine,signature:l,paramCount:l?x(l):null}}}function x(t){let n=t.indexOf("(");if(n===-1)return null;let a=0,e=-1;for(let s=n;s<t.length;s+=1){let l=t[s];if(l==="(")a+=1;else if(l===")"&&(a-=1,a===0)){e=s;break}}if(e===-1)return null;let o=t.slice(n+1,e).trim();if(!o)return 0;let i=1,r=0;for(let s of o)s==="("||s==="["||s==="{"?r+=1:s===")"||s==="]"||s==="}"?r=Math.max(0,r-1):s===","&&r===0&&(i+=1);return i}function S(t,n,a){let e=$(n),o=k(t,a),r=T(e,o).replace(/\\/g,"/").replace(/\.tsx?$/,".js");return r.startsWith(".")?r:`./${r}`}function v(t,n,a,e,o){let i=S(a,e,t.file),r=S(a,e,n.file),s=o===null?"Signature comparison: unknown (one or both signatures unavailable in the index) \u2014 check by hand.":o?"Signature comparison: param counts match.":"Signature comparison: param counts DIFFER \u2014 twins may not be directly comparable; check by hand.";return`/**
1
+ import{b as w}from"./chunk-EZ5WDZ2Q.js";import{b as g}from"./chunk-ECVXWZ4Q.js";import{c as h,d as f}from"./chunk-MTDBHTSF.js";import{c as b,d as p}from"./chunk-MBKJ7GHT.js";import{d as u,e as c,h as m}from"./chunk-HXXMPYEF.js";import{dirname as $,relative as T,resolve as k}from"path";var A=new Set(f());function O(t,n){return`tests/generated/twin-ab/${y(t)}-vs-${y(n)}.test.ts`}function y(t){return(t.split(/[/#]/).pop()||t).replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"symbol"}function I(t,n,a,e){let o=d(t,n);if(!o.ok)return o;let i=d(t,a);if(!i.ok)return i;let r=o.symbol.paramCount===null||i.symbol.paramCount===null?null:o.symbol.paramCount===i.symbol.paramCount,s=v(o.symbol,i.symbol,t.config.projectRoot,e,r);return{ok:!0,a:o.symbol,b:i.symbol,signatureCompatible:r,testSource:s}}function d(t,n){let e=g(t,n).match;if(!e)return{ok:!1,reason:`${n} does not resolve to an indexed symbol.`};let i=t.get("SELECT kind FROM global_symbols WHERE id = ?",e.symbolId)?.kind??null;if(!(i!==null?A.has(i):m(e.symbol)))return{ok:!1,reason:`${n} resolves to ${u(e.symbol)}${i!==null?` with SCIP kind ${h(i)}`:""} \u2014 twin-ab compares call outputs, so both referents must be functions or methods.`};if(!w(t,e))return{ok:!1,reason:`${n} (${u(e.symbol)} at ${e.relativePath}:${e.startLine+1}) is not exported \u2014 twin-ab needs an importable named binding for both twins.`};let s=t.get("SELECT documentation FROM global_symbols WHERE id = ?",e.symbolId),l=b(p(s?.documentation??null));return{ok:!0,symbol:{ref:n,symbol:e.symbol,shortName:c(e.symbol)||u(e.symbol),file:e.relativePath,startLine:e.startLine,signature:l,paramCount:l?x(l):null}}}function x(t){let n=t.indexOf("(");if(n===-1)return null;let a=0,e=-1;for(let s=n;s<t.length;s+=1){let l=t[s];if(l==="(")a+=1;else if(l===")"&&(a-=1,a===0)){e=s;break}}if(e===-1)return null;let o=t.slice(n+1,e).trim();if(!o)return 0;let i=1,r=0;for(let s of o)s==="("||s==="["||s==="{"?r+=1:s===")"||s==="]"||s==="}"?r=Math.max(0,r-1):s===","&&r===0&&(i+=1);return i}function S(t,n,a){let e=$(n),o=k(t,a),r=T(e,o).replace(/\\/g,"/").replace(/\.tsx?$/,".js");return r.startsWith(".")?r:`./${r}`}function v(t,n,a,e,o){let i=S(a,e,t.file),r=S(a,e,n.file),s=o===null?"Signature comparison: unknown (one or both signatures unavailable in the index) \u2014 check by hand.":o?"Signature comparison: param counts match.":"Signature comparison: param counts DIFFER \u2014 twins may not be directly comparable; check by hand.";return`/**
2
2
  * Generated by 'scip-query twin-ab'. scip-integrity-audit drill 5
3
3
  * ("cross-examine same-concept twins"): where one concept is computed in
4
4
  * more than one place, feed both the same input and require the same
@@ -37,4 +37,4 @@ describe.skipIf(inputs.length === 0)('twin-ab: ${t.shortName} vs ${n.shortName}'
37
37
  });
38
38
  });
39
39
  `}export{O as a,I as b};
40
- //# sourceMappingURL=chunk-BN5SXXQS.js.map
40
+ //# sourceMappingURL=chunk-NQ75OVUU.js.map
@@ -1,7 +1,7 @@
1
- import{b as k}from"./chunk-343O6EVV.js";import{a as D}from"./chunk-X4O6K47U.js";import{f as y,g as v}from"./chunk-NAH5EAZS.js";import{p as S}from"./chunk-WFGOH2UI.js";import{f as L}from"./chunk-R3JY4EZ4.js";import{d as h}from"./chunk-HXXMPYEF.js";function z(e,n={}){let{scope:s,minLoc:c=1,maxDepth:a=5,scanLimit:f}=n,t=new D(e),i=_(e,s,c,f),o=new P;for(let r of i)o.add(r);let m=[],I=[];i.length>0&&m.push(C(e,0,i,o));let b=i.map(r=>r.definition).filter(r=>r!==null),x=new Set(i.map(r=>r.symbol));for(let r=1;r<=a&&b.length>0;r++){let u=t.calleeMap(b,{semantic:!1}),E=new Set;for(let d of b)for(let l of u.get(d.symbolId)??[])x.has(l.symbol)||E.add(l.symbol);let p=[];for(let d of E){x.add(d);let l=F(e,d);if(!l||e.isIgnored(l.relativePath)||y(e,l.relativePath)||v(e,l.symbol,l.relativePath)||t.fileKind(l.relativePath)==="test"||t.hasSuppressionComment(l))continue;let g=B(e,l,o);g.removable?p.push(w(l,"cascade")):g.blockingFiles.length>0&&I.push({shortName:h(l.symbol),file:l.relativePath,blockingFiles:g.blockingFiles.slice(0,3)})}if(p.length===0)break;for(let d of p)o.add(d);m.push(C(e,r,p,o)),b=p.map(d=>d.definition).filter(d=>d!==null)}let N=m.reduce((r,u)=>r+u.loc,0),R=m.reduce((r,u)=>r+u.entries.length,0);return{batches:m,totalSymbols:R,totalLoc:N,blocked:I}}function _(e,n,s,c){let a=k(e,{scope:n,minLoc:s,skipBarrels:!0,deadCodeOnly:!0,scanLimit:c,semantic:!1}),f=[];for(let t of a.symbols)t.kind==="dead-code"&&(y(e,t.relativePath)||v(e,t.symbol,t.relativePath)||f.push({symbol:t.symbol,shortName:t.shortName,file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:t.loc,evidence:"graph-fact",definition:F(e,t.symbol)}));return f}function w(e,n){return{symbol:e.symbol,shortName:h(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:e.endLine-e.startLine+1,evidence:n,definition:e}}function F(e,n){let s=e.get(`SELECT d.relative_path
1
+ import{b as k}from"./chunk-FBCOFKEC.js";import{a as D}from"./chunk-UAHZ57BR.js";import{f as y,g as v}from"./chunk-NAH5EAZS.js";import{p as S}from"./chunk-MKM7NBZK.js";import{f as L}from"./chunk-MBKJ7GHT.js";import{d as h}from"./chunk-HXXMPYEF.js";function z(e,n={}){let{scope:s,minLoc:c=1,maxDepth:a=5,scanLimit:f}=n,t=new D(e),i=_(e,s,c,f),o=new P;for(let r of i)o.add(r);let m=[],I=[];i.length>0&&m.push(C(e,0,i,o));let b=i.map(r=>r.definition).filter(r=>r!==null),x=new Set(i.map(r=>r.symbol));for(let r=1;r<=a&&b.length>0;r++){let u=t.calleeMap(b,{semantic:!1}),E=new Set;for(let d of b)for(let l of u.get(d.symbolId)??[])x.has(l.symbol)||E.add(l.symbol);let p=[];for(let d of E){x.add(d);let l=F(e,d);if(!l||e.isIgnored(l.relativePath)||y(e,l.relativePath)||v(e,l.symbol,l.relativePath)||t.fileKind(l.relativePath)==="test"||t.hasSuppressionComment(l))continue;let g=B(e,l,o);g.removable?p.push(w(l,"cascade")):g.blockingFiles.length>0&&I.push({shortName:h(l.symbol),file:l.relativePath,blockingFiles:g.blockingFiles.slice(0,3)})}if(p.length===0)break;for(let d of p)o.add(d);m.push(C(e,r,p,o)),b=p.map(d=>d.definition).filter(d=>d!==null)}let N=m.reduce((r,u)=>r+u.loc,0),R=m.reduce((r,u)=>r+u.entries.length,0);return{batches:m,totalSymbols:R,totalLoc:N,blocked:I}}function _(e,n,s,c){let a=k(e,{scope:n,minLoc:s,skipBarrels:!0,deadCodeOnly:!0,scanLimit:c,semantic:!1}),f=[];for(let t of a.symbols)t.kind==="dead-code"&&(y(e,t.relativePath)||v(e,t.symbol,t.relativePath)||f.push({symbol:t.symbol,shortName:t.shortName,file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:t.loc,evidence:"graph-fact",definition:F(e,t.symbol)}));return f}function w(e,n){return{symbol:e.symbol,shortName:h(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:e.endLine-e.startLine+1,evidence:n,definition:e}}function F(e,n){let s=e.get(`SELECT d.relative_path
2
2
  FROM global_symbols gs
3
3
  JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
4
4
  JOIN documents d ON d.id = der.document_id
5
5
  WHERE gs.symbol = ?
6
6
  LIMIT 1`,n);return s?L(e,s.relative_path).find(c=>c.symbol===n)??null:null}function B(e,n,s){let c=S(e,n);if(c.length===0)return{removable:!1,blockingFiles:[]};let a=new Set;for(let f of c)f.file===n.relativePath&&f.line>=n.startLine&&f.line<=n.endLine||s.contains(f.file,f.line)||a.add(f.file);return{removable:a.size===0,blockingFiles:[...a]}}function C(e,n,s,c){let a=[...s].sort((i,o)=>i.file.localeCompare(o.file)||i.startLine-o.startLine),f=new Set(a.map(i=>i.file)),t=[];for(let i of f){let o=L(e,i);o.length>0&&o.every(m=>c.contains(i,m.startLine))&&t.push(i)}return{depth:n,entries:a.map(({definition:i,...o})=>o),loc:a.reduce((i,o)=>i+o.loc,0),filesEmptied:t.sort()}}var P=class{ranges=new Map;add(n){let s=this.ranges.get(n.file)??[];s.push({start:n.startLine,end:n.endLine}),this.ranges.set(n.file,s)}contains(n,s){let c=this.ranges.get(n);return c?c.some(a=>s>=a.start&&s<=a.end):!1}};export{z as a,P as b};
7
- //# sourceMappingURL=chunk-BDRBPG7Y.js.map
7
+ //# sourceMappingURL=chunk-O3WDE26W.js.map
@@ -1,4 +1,4 @@
1
- import{b as l}from"./chunk-XHWLNQVZ.js";import{a}from"./chunk-X4O6K47U.js";import{d as i,g as n}from"./chunk-HXXMPYEF.js";function _(e,r){let t=l(e,r);return t.length===0?[]:m([...d(e,t),...c(e,t)]).filter(o=>!e.isIgnored(o.relative_path)).map(u)}function d(e,r){let t=r.map(()=>"?").join(", ");return e.all(`SELECT DISTINCT d1.relative_path, gs.symbol
1
+ import{b as l}from"./chunk-OSWF3HSF.js";import{a}from"./chunk-UAHZ57BR.js";import{d as i,g as n}from"./chunk-HXXMPYEF.js";function _(e,r){let t=l(e,r);return t.length===0?[]:m([...d(e,t),...c(e,t)]).filter(o=>!e.isIgnored(o.relative_path)).map(u)}function d(e,r){let t=r.map(()=>"?").join(", ");return e.all(`SELECT DISTINCT d1.relative_path, gs.symbol
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents d1 ON c.document_id = d1.id
@@ -26,4 +26,4 @@ import{b as l}from"./chunk-XHWLNQVZ.js";import{a}from"./chunk-X4O6K47U.js";impor
26
26
  AND ${e.localSymbolPredicate}
27
27
  ${e.pathExclusionsFor("d1")}
28
28
  ORDER BY d1.relative_path`,...r,...r,...r)}function c(e,r){let t=new a(e);return r.flatMap(o=>t.definitionsForFile(o).filter(s=>n(s.symbol)).map(s=>({relative_path:o,symbol:s.symbol})))}function m(e){let r=new Set;return e.filter(t=>{let o=`${t.relative_path}|${t.symbol}`;return r.has(o)?!1:(r.add(o),!0)})}function u(e){return{consumer:e.relative_path,symbol:e.symbol,shortName:i(e.symbol)}}export{_ as a};
29
- //# sourceMappingURL=chunk-N2Z3CU7X.js.map
29
+ //# sourceMappingURL=chunk-OPE5YXFE.js.map
@@ -1,2 +1,2 @@
1
- import{a as u}from"./chunk-WQHWIVA7.js";import{a as c}from"./chunk-64MNV6AB.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-XHWLNQVZ.js.map
1
+ import{a as u}from"./chunk-ECVXWZ4Q.js";import{a as c}from"./chunk-64MNV6AB.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-OSWF3HSF.js.map
@@ -1,2 +1,2 @@
1
- import{b as k}from"./chunk-B75HZHUP.js";import{a as g}from"./chunk-X4O6K47U.js";import{b as S}from"./chunk-NAH5EAZS.js";import{a as n}from"./chunk-BGBBVSH4.js";import{e as v}from"./chunk-C4ICAIJ4.js";import{d as L}from"./chunk-HXXMPYEF.js";import{l as a}from"./chunk-WS3Z6W3M.js";function q(u,b={}){let{scope:P,minLoc:x=3,scanLimit:c}=b,t=new g(u),f=b.semantic!==!1,y=0,d=a("isolated.candidates",()=>{let e=k(t.productionCallableDefinitions({scope:P,minLoc:x,excludeEntrySurfaces:!0,excludeRustTraitImplMembers:!0,includeSuppressed:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:typeof c=="number"&&c>0}),c);return y=e.length,e},()=>({definitions:y})),p=0,o=a("isolated.strict-callees",()=>{let e=t.symbolsWithNonSelfCallees(d,{additive:!1,semantic:!1});return p=e.size,e},()=>({definitions:d.length,symbols:p})),r=d.filter(e=>!o.has(e.symbolId)),h=0,N=a("isolated.scip-callers",()=>{let e=t.crossFileCallerMap(r,{semantic:!1});return h=e.size,e},()=>({definitions:r.length,symbols:h})),l=new Set(N.keys());for(let e of t.frameworkReferencedSymbolIds(r))l.add(e);let s=r.filter(e=>!l.has(e.symbolId));if(f&&s.length>0){for(let e of v(u,s).keys())l.add(e);for(let e of t.symbolsWithNonSelfCallees(s,{additive:!1,semantic:!0}))o.add(e);s=s.filter(e=>!l.has(e.symbolId)).filter(e=>!o.has(e.symbolId))}let C=0,W=a("isolated.source-fallback-callers",()=>{let e=t.sourceFallbackCallerFiles(s,{skipPath:i=>S(i)==="test"});return C=e.size,e},()=>({definitions:s.length,symbols:C}));for(let e of W.keys())l.add(e);let m=s.filter(e=>!l.has(e.symbolId)),I=0,F=a("isolated.additive-callees",()=>{let e=t.symbolsWithNonSelfCallees(m,{additive:!0,semantic:f});return I=e.size,e},()=>({definitions:m.length,symbols:I}));for(let e of F)o.add(e);return m.filter(e=>!o.has(e.symbolId)).sort((e,i)=>n(i)-n(e)||e.relativePath.localeCompare(i.relativePath)||e.startLine-i.startLine).map(e=>({symbol:e.symbol,shortName:L(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:n(e)}))}export{q as a};
2
- //# sourceMappingURL=chunk-Y6L4LXPG.js.map
1
+ import{b as k}from"./chunk-B75HZHUP.js";import{a as g}from"./chunk-UAHZ57BR.js";import{b as S}from"./chunk-NAH5EAZS.js";import{a as n}from"./chunk-BGBBVSH4.js";import{e as v}from"./chunk-YDDGCJJG.js";import{d as L}from"./chunk-HXXMPYEF.js";import{l as a}from"./chunk-WS3Z6W3M.js";function q(u,b={}){let{scope:P,minLoc:x=3,scanLimit:c}=b,t=new g(u),f=b.semantic!==!1,y=0,d=a("isolated.candidates",()=>{let e=k(t.productionCallableDefinitions({scope:P,minLoc:x,excludeEntrySurfaces:!0,excludeRustTraitImplMembers:!0,includeSuppressed:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:typeof c=="number"&&c>0}),c);return y=e.length,e},()=>({definitions:y})),p=0,o=a("isolated.strict-callees",()=>{let e=t.symbolsWithNonSelfCallees(d,{additive:!1,semantic:!1});return p=e.size,e},()=>({definitions:d.length,symbols:p})),r=d.filter(e=>!o.has(e.symbolId)),h=0,N=a("isolated.scip-callers",()=>{let e=t.crossFileCallerMap(r,{semantic:!1});return h=e.size,e},()=>({definitions:r.length,symbols:h})),l=new Set(N.keys());for(let e of t.frameworkReferencedSymbolIds(r))l.add(e);let s=r.filter(e=>!l.has(e.symbolId));if(f&&s.length>0){for(let e of v(u,s).keys())l.add(e);for(let e of t.symbolsWithNonSelfCallees(s,{additive:!1,semantic:!0}))o.add(e);s=s.filter(e=>!l.has(e.symbolId)).filter(e=>!o.has(e.symbolId))}let C=0,W=a("isolated.source-fallback-callers",()=>{let e=t.sourceFallbackCallerFiles(s,{skipPath:i=>S(i)==="test"});return C=e.size,e},()=>({definitions:s.length,symbols:C}));for(let e of W.keys())l.add(e);let m=s.filter(e=>!l.has(e.symbolId)),I=0,F=a("isolated.additive-callees",()=>{let e=t.symbolsWithNonSelfCallees(m,{additive:!0,semantic:f});return I=e.size,e},()=>({definitions:m.length,symbols:I}));for(let e of F)o.add(e);return m.filter(e=>!o.has(e.symbolId)).sort((e,i)=>n(i)-n(e)||e.relativePath.localeCompare(i.relativePath)||e.startLine-i.startLine).map(e=>({symbol:e.symbol,shortName:L(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:n(e)}))}export{q as a};
2
+ //# sourceMappingURL=chunk-OVMUVXKQ.js.map
@@ -1,2 +1,2 @@
1
- import{a as T}from"./chunk-N2Z3CU7X.js";import{a as I}from"./chunk-7HB3CZFD.js";import{a as H}from"./chunk-CMHYBXJB.js";import{a as p}from"./chunk-XMR747CP.js";import{a as F}from"./chunk-R5336VHZ.js";import{a as v}from"./chunk-LWOOTRHC.js";import{a as k,b as G}from"./chunk-WZLPXFZU.js";import{b as D}from"./chunk-NJJ7AS4F.js";import{a as S}from"./chunk-FXG3PHVW.js";import{a as j}from"./chunk-PZS6J5YG.js";import{a as w}from"./chunk-ZEKBR4OK.js";import{a as P}from"./chunk-3T2FNHIU.js";import{a as A}from"./chunk-KKMOB3OJ.js";function X(t,e,n={}){let o=n.impactDepth??3,r=n.sliceDepth??3,l=n.semantic,s=!z(e),a=s?H(t,e,{semantic:l}):{definitions:[],referencedBy:[]},m=s?P(t,e,{semantic:l}):null,f=s?j(t,e,{semantic:l}):null,h=s?v(t,e,{semantic:l}):null,y=s?p(t,e,{direction:"backward",maxDepth:r,semantic:l}):null,R=s?p(t,e,{direction:"forward",maxDepth:r,semantic:l}):null,d=s?w(t,e,{maxDepth:o,scope:n.scope}):[],i=A(t,e,{semantic:l}),C=k(t,e),g=G(t,e),u=I(t,e),x=T(t,e),c={symbol:a.definitions.length>0||a.referencedBy.length>0||m!==null||f!==null||h!==null||y!==null||R!==null||d.length>0,file:i!==null||C.length>0||g.length>0,module:u.files.length>0||u.symbols.length>0||x.length>0},b=[];!c.symbol&&!c.file&&!c.module&&b.push("No symbol, file, or module matched target.");let B=i?.file??a.definitions[0]?.relativePath??null;return{target:e,matched:c,history:O(t,B),trace:a,callGraph:m,complexity:f,dataflow:h,backwardSlice:y,forwardSlice:R,affected:d,changeSurface:i,deps:C,rdeps:g,system:u,surface:x,warnings:b}}function O(t,e){let n={available:!1,file:e,churn:null,coChangePartners:[],suppressionsInFile:0};if(!e)return n;let o=S(t).fileChurn();if(!o)return n;let r=D(t,e,{limit:5});return{available:!0,file:e,churn:o.get(e)??{changes:0,fixChanges:0,lastChangedAt:0},coChangePartners:r.findings.map(l=>({file:l.fileA===e?l.fileB:l.fileA,together:l.together,confidence:l.confidence,subjectContext:l.subjectContext})),suppressionsInFile:F(t).byFile.get(e)??0}}function z(t){return t.includes("/")||t.includes("\\")||/\.[A-Za-z0-9]+(?::\d+(?:-\d+)?)?$/.test(t)}export{X as a};
2
- //# sourceMappingURL=chunk-P36UR5II.js.map
1
+ import{a as T}from"./chunk-OPE5YXFE.js";import{a as I}from"./chunk-7ITCOJGD.js";import{a as H}from"./chunk-52Q4JFDW.js";import{a as p}from"./chunk-T7VQG55Q.js";import{a as F}from"./chunk-R5336VHZ.js";import{a as v}from"./chunk-BVNO67DB.js";import{a as k,b as G}from"./chunk-RIQED5OU.js";import{b as D}from"./chunk-NJJ7AS4F.js";import{a as S}from"./chunk-FXG3PHVW.js";import{a as j}from"./chunk-KSUZS77X.js";import{a as w}from"./chunk-AZLKLZ5S.js";import{a as P}from"./chunk-MJKJMWIM.js";import{a as A}from"./chunk-2QGE5AEP.js";function X(t,e,n={}){let o=n.impactDepth??3,r=n.sliceDepth??3,l=n.semantic,s=!z(e),a=s?H(t,e,{semantic:l}):{definitions:[],referencedBy:[]},m=s?P(t,e,{semantic:l}):null,f=s?j(t,e,{semantic:l}):null,h=s?v(t,e,{semantic:l}):null,y=s?p(t,e,{direction:"backward",maxDepth:r,semantic:l}):null,R=s?p(t,e,{direction:"forward",maxDepth:r,semantic:l}):null,d=s?w(t,e,{maxDepth:o,scope:n.scope}):[],i=A(t,e,{semantic:l}),C=k(t,e),g=G(t,e),u=I(t,e),x=T(t,e),c={symbol:a.definitions.length>0||a.referencedBy.length>0||m!==null||f!==null||h!==null||y!==null||R!==null||d.length>0,file:i!==null||C.length>0||g.length>0,module:u.files.length>0||u.symbols.length>0||x.length>0},b=[];!c.symbol&&!c.file&&!c.module&&b.push("No symbol, file, or module matched target.");let B=i?.file??a.definitions[0]?.relativePath??null;return{target:e,matched:c,history:O(t,B),trace:a,callGraph:m,complexity:f,dataflow:h,backwardSlice:y,forwardSlice:R,affected:d,changeSurface:i,deps:C,rdeps:g,system:u,surface:x,warnings:b}}function O(t,e){let n={available:!1,file:e,churn:null,coChangePartners:[],suppressionsInFile:0};if(!e)return n;let o=S(t).fileChurn();if(!o)return n;let r=D(t,e,{limit:5});return{available:!0,file:e,churn:o.get(e)??{changes:0,fixChanges:0,lastChangedAt:0},coChangePartners:r.findings.map(l=>({file:l.fileA===e?l.fileB:l.fileA,together:l.together,confidence:l.confidence,subjectContext:l.subjectContext})),suppressionsInFile:F(t).byFile.get(e)??0}}function z(t){return t.includes("/")||t.includes("\\")||/\.[A-Za-z0-9]+(?::\d+(?:-\d+)?)?$/.test(t)}export{X as a};
2
+ //# sourceMappingURL=chunk-PH7ZFK6L.js.map
@@ -0,0 +1,2 @@
1
+ import{b as r}from"./chunk-OSWF3HSF.js";import{k as e}from"./chunk-MBKJ7GHT.js";function l(t,s){let o=r(t,s);return e(t,o).map(({relativePath:n,...a})=>a)}export{l as a};
2
+ //# sourceMappingURL=chunk-PXHPCWX5.js.map
@@ -1,3 +1,3 @@
1
- import{b as p}from"./chunk-FXG3PHVW.js";import{b as B}from"./chunk-B75HZHUP.js";import{a as m}from"./chunk-BGBBVSH4.js";import{g}from"./chunk-R3JY4EZ4.js";import{d as f}from"./chunk-HXXMPYEF.js";import{b as y}from"./chunk-T2FQ4GHD.js";import{p as d}from"./chunk-WS3Z6W3M.js";import{createHash as C}from"crypto";var b=3;function w(n,t={}){let{scope:e,maxLoc:o=15,minLoc:i=b,limit:r,scanLimit:a}=t,l=p(n),u=L(n,{scope:e,maxLoc:o,scanLimit:a}).map(s=>h(n,s,l,i)).filter(s=>s!==null),c=I(u);return r?c.slice(0,r):c}function H(n,t,e={}){let{scope:o,maxLoc:i=15,minLoc:r=b,scanLimit:a}=e,l=p(n),u=L(n,{scope:o,maxLoc:i,scanLimit:a}).map(s=>h(n,s,l,r)).filter(s=>s!==null),c=u.find(s=>s.symbol===t);return c?u.filter(s=>s.symbol!==c.symbol&&s.normalizedBody===c.normalizedBody&&s.file!==c.file).sort(z).map(({normalizedBody:s,...S})=>S):[]}function A(n){let t=E(n);return y(t).replace(/\s+/g,"")}function I(n){let t=new Map;for(let o of n){if(o.normalizedBody.length<8)continue;let i=W(o.normalizedBody),r=t.get(i)??[];r.push(o),t.set(i,r)}let e=[];for(let[o,i]of t){let r=new Set(i.map(l=>l.file));if(i.length<2||r.size<2)continue;let a=[...i].sort(z).map(({normalizedBody:l,...u})=>u);e.push({hash:o,canonical:a[0],functions:a})}return e.sort((o,i)=>{let r=i.functions.length-o.functions.length;if(r!==0)return r;let a=D(i)-D(o);return a!==0?a:o.canonical.file.localeCompare(i.canonical.file)}),e}function L(n,t){let e=g(n,{scope:t.scope}).filter(o=>o.isFunctionLike&&!n.isIgnored(o.relativePath)).filter(o=>m(o)<=t.maxLoc);return e.sort((o,i)=>m(i)-m(o)||o.relativePath.localeCompare(i.relativePath)),B(e,t.scanLimit)}function h(n,t,e,o){let i=x(n,t);if(!i||P(i)<o)return null;let r=v(n,t);return r?{symbol:t.symbol,shortName:f(t.symbol),file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:m(t),ageCommits:e?.get(t.relativePath)?.commitsAgo??null,normalizedBody:r}:null}function v(n,t){let e=x(n,t);return e&&A(e)||null}function x(n,t){let e=d(n,t.relativePath);return e?e.split(/\r?\n/).slice(t.startLine,t.endLine+1).join(`
1
+ import{b as p}from"./chunk-FXG3PHVW.js";import{b as B}from"./chunk-B75HZHUP.js";import{a as m}from"./chunk-BGBBVSH4.js";import{g}from"./chunk-MBKJ7GHT.js";import{d as f}from"./chunk-HXXMPYEF.js";import{b as y}from"./chunk-T2FQ4GHD.js";import{p as d}from"./chunk-WS3Z6W3M.js";import{createHash as C}from"crypto";var b=3;function w(n,t={}){let{scope:e,maxLoc:o=15,minLoc:i=b,limit:r,scanLimit:a}=t,l=p(n),u=L(n,{scope:e,maxLoc:o,scanLimit:a}).map(s=>h(n,s,l,i)).filter(s=>s!==null),c=I(u);return r?c.slice(0,r):c}function H(n,t,e={}){let{scope:o,maxLoc:i=15,minLoc:r=b,scanLimit:a}=e,l=p(n),u=L(n,{scope:o,maxLoc:i,scanLimit:a}).map(s=>h(n,s,l,r)).filter(s=>s!==null),c=u.find(s=>s.symbol===t);return c?u.filter(s=>s.symbol!==c.symbol&&s.normalizedBody===c.normalizedBody&&s.file!==c.file).sort(z).map(({normalizedBody:s,...S})=>S):[]}function A(n){let t=E(n);return y(t).replace(/\s+/g,"")}function I(n){let t=new Map;for(let o of n){if(o.normalizedBody.length<8)continue;let i=W(o.normalizedBody),r=t.get(i)??[];r.push(o),t.set(i,r)}let e=[];for(let[o,i]of t){let r=new Set(i.map(l=>l.file));if(i.length<2||r.size<2)continue;let a=[...i].sort(z).map(({normalizedBody:l,...u})=>u);e.push({hash:o,canonical:a[0],functions:a})}return e.sort((o,i)=>{let r=i.functions.length-o.functions.length;if(r!==0)return r;let a=D(i)-D(o);return a!==0?a:o.canonical.file.localeCompare(i.canonical.file)}),e}function L(n,t){let e=g(n,{scope:t.scope}).filter(o=>o.isFunctionLike&&!n.isIgnored(o.relativePath)).filter(o=>m(o)<=t.maxLoc);return e.sort((o,i)=>m(i)-m(o)||o.relativePath.localeCompare(i.relativePath)),B(e,t.scanLimit)}function h(n,t,e,o){let i=x(n,t);if(!i||P(i)<o)return null;let r=v(n,t);return r?{symbol:t.symbol,shortName:f(t.symbol),file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:m(t),ageCommits:e?.get(t.relativePath)?.commitsAgo??null,normalizedBody:r}:null}function v(n,t){let e=x(n,t);return e&&A(e)||null}function x(n,t){let e=d(n,t.relativePath);return e?e.split(/\r?\n/).slice(t.startLine,t.endLine+1).join(`
2
2
  `):null}function E(n){let t=n.indexOf("{"),e=n.lastIndexOf("}");if(t>=0&&e>t)return n.slice(t+1,e);let o=n.indexOf("=>");return o>=0?n.slice(o+2).replace(/;+\s*$/,""):n}function P(n){return E(n).split(/\r?\n/).map(e=>e.trim()).filter(e=>e.length>0).length}function W(n){return C("sha256").update(n).digest("hex").slice(0,16)}function z(n,t){let e=n.ageCommits??-1;return(t.ageCommits??-1)-e||n.file.localeCompare(t.file)||n.startLine-t.startLine}function D(n){return n.functions.reduce((t,e)=>t+e.loc,0)}export{w as a,H as b,A as c,I as d,v as e,x as f,E as g};
3
- //# sourceMappingURL=chunk-K2HYR5A7.js.map
3
+ //# sourceMappingURL=chunk-Q3B3FNCU.js.map
@@ -1,3 +1,3 @@
1
- import{q as d}from"./chunk-WFGOH2UI.js";import{a as h}from"./chunk-WQHWIVA7.js";import{h as g}from"./chunk-HXXMPYEF.js";import{p as m}from"./chunk-WS3Z6W3M.js";import{a as p}from"./chunk-64MNV6AB.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{q as d}from"./chunk-MKM7NBZK.js";import{a as h}from"./chunk-ECVXWZ4Q.js";import{h as g}from"./chunk-HXXMPYEF.js";import{p as m}from"./chunk-WS3Z6W3M.js";import{a as p}from"./chunk-64MNV6AB.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-7XL7J7PT.js.map
3
+ //# sourceMappingURL=chunk-Q7S2DADC.js.map
@@ -1,2 +1,2 @@
1
- import{b as i}from"./chunk-STBXCPKY.js";function l(n,o,s,t={}){let e=i(n,o,s,t);return e?{symbolA:e.symbolA,symbolB:e.symbolB,similarity:e.similarity,sharedCallees:e.sharedEvidence,uniqueToA:e.uniqueToA,uniqueToB:e.uniqueToB,consolidationStrategy:e.consolidationStrategy}:null}export{l as a};
2
- //# sourceMappingURL=chunk-FLJJLSGB.js.map
1
+ import{b as i}from"./chunk-BCNT6ODA.js";function l(n,o,s,t={}){let e=i(n,o,s,t);return e?{symbolA:e.symbolA,symbolB:e.symbolB,similarity:e.similarity,sharedCallees:e.sharedEvidence,uniqueToA:e.uniqueToA,uniqueToB:e.uniqueToB,consolidationStrategy:e.consolidationStrategy}:null}export{l as a};
2
+ //# sourceMappingURL=chunk-RA5MTIOO.js.map
@@ -1,4 +1,4 @@
1
- import{a as s}from"./chunk-XHWLNQVZ.js";function m(e,d){let i=s(e,d);return i?e.all(`SELECT DISTINCT d2.relative_path
1
+ import{a as s}from"./chunk-OSWF3HSF.js";function m(e,d){let i=s(e,d);return i?e.all(`SELECT DISTINCT d2.relative_path
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents d1 ON c.document_id = d1.id
@@ -30,4 +30,4 @@ import{a as s}from"./chunk-XHWLNQVZ.js";function m(e,d){let i=s(e,d);return i?e.
30
30
  WHERE d2.relative_path = ?
31
31
  AND d1.relative_path != ?
32
32
  ORDER BY d1.relative_path`,i,i).filter(t=>!e.isIgnored(t.relative_path)).map(t=>({relativePath:t.relative_path})):[]}export{m as a,o as b};
33
- //# sourceMappingURL=chunk-WZLPXFZU.js.map
33
+ //# sourceMappingURL=chunk-RIQED5OU.js.map
@@ -1,2 +1,2 @@
1
- import{e as S}from"./chunk-C4ICAIJ4.js";import{a as f,e as D}from"./chunk-HXXMPYEF.js";import{x as F}from"./chunk-ISLWJ4PY.js";import{b as C,l as g,m as v,o as y}from"./chunk-WS3Z6W3M.js";import{c as d}from"./chunk-7S5E7KWT.js";var E=d("definition-consumer-file-usage",{clearGroups:["whole-project","source-file"]}),b=v({kind:"consumer-file-usage",invalidation:y("consumer-file-usage"),serialize:O,deserialize:k});function B(n,e){return{forDefinitions(i,r){return M(n,e,i,r)}}}function J(n){let e=new Map;for(let[i,r]of n)e.set(i,new Set(r.files.map(t=>t.file)));return e}function q(n,e,i){return L(n,e,i).partition}function M(n,e,i,r){let t=x(i.length);return g("consumer-evidence.product",()=>{let o=w(n,e,i,r),s=new Map;t={...t,...o.counters};for(let a of i){let c=o.sources.get(a.symbolId)??new Map,l=L(n,a,[...c.keys()],c);t.realFiles+=l.partition.realConsumers.length,t.reexportOnlyFiles+=l.partition.barrelConsumers,t.importOnlyFiles+=l.partition.importOnlyConsumers,s.set(a.symbolId,{definition:a,files:l.files,...l.partition})}return s},()=>({...t}))}function x(n){return{definitions:n,indexedFiles:0,semanticFiles:0,fallbackFiles:0,totalFiles:0,realFiles:0,reexportOnlyFiles:0,importOnlyFiles:0}}function w(n,e,i,r){let t=x(i.length),o=new Map;return m(o,t,"indexed",e.crossFileCallerMap(i,{semantic:!1})),r.semantic&&m(o,t,"semantic",S(n,i)),r.sourceFallback!==!1&&m(o,t,"source-fallback",e.sourceFallbackCallerFiles(i)),t.totalFiles=[...o.values()].reduce((s,a)=>s+a.size,0),{sources:o,counters:t}}function m(n,e,i,r){let t=0;for(let[o,s]of r){let a=n.get(o);a||(a=new Map,n.set(o,a));for(let c of s){t++;let l=a.get(c)??new Set;l.add(i),a.set(c,l)}}i==="indexed"?e.indexedFiles+=t:i==="semantic"?e.semanticFiles+=t:e.fallbackFiles+=t}function L(n,e,i,r=new Map){let t=[],o=0,s=0,a=D(e.symbol),c=[];for(let l of i){let u;_(n,l,e.relativePath,a)?(o++,u="reexport-only"):h(n,l,a)?(s++,u="import-only"):(t.push(l),u="real"),c.push({file:l,sources:[...r.get(l)??[]],classification:u})}return{partition:{realConsumers:t,barrelConsumers:o,importOnlyConsumers:s},files:c}}function h(n,e,i){if(!i)return!1;let r=F(e);if(!r)return!1;let t=E.get(n,e,()=>P(n,e,r));return t.importedLeaves.has(i)&&!t.usedLeaves.has(i)}function P(n,e,i){let r=f(n).forFile(e,{text:!0,ast:!0}),t=r.text;if(!t)return U();let o=C(n,e,t),s=b.read(n,e,o);if(s)return s;let a=I(r.ast,i);return b.write(n,e,o,a),a}function I(n,e){let i=new Set,r=new Set;if(!n)return{importedLeaves:i,usedLeaves:r};let t=e==="rust"?new Set(["use_declaration"]):e==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),o=(s,a)=>{let c=a||t.has(s.type);(s.type==="identifier"||s.type==="type_identifier"||s.type==="property_identifier"||s.type==="field_identifier")&&(c?i.add(s.text):r.add(s.text));for(let l of s.children)o(l,c)};return o(n.rootNode,!1),{importedLeaves:i,usedLeaves:r}}function U(){return{importedLeaves:new Set,usedLeaves:new Set}}function O(n){return JSON.stringify({importedLeaves:[...n.importedLeaves],usedLeaves:[...n.usedLeaves]})}function k(n){try{let e=JSON.parse(n);return!Array.isArray(e.importedLeaves)||!Array.isArray(e.usedLeaves)?null:{importedLeaves:new Set(e.importedLeaves.filter(i=>typeof i=="string")),usedLeaves:new Set(e.usedLeaves.filter(i=>typeof i=="string"))}}catch{return null}}function _(n,e,i,r){if(!r)return!1;let t=f(n).forFile(e,{lines:!0,reexports:!0}),o=t.lines??[];if(o.length===0)return!1;let s=t.reexports??[];if(s.length===0)return!1;let a=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=new RegExp(`\\b${a}\\b`),l=0;for(let u=0;u<o.length;u++){if(!c.test(o[u]??""))continue;if(l++,!s.find(p=>p.startLine<=u&&u<=p.endLine))return!1}return l>0}export{B as a,J as b,q as c,h as d};
2
- //# sourceMappingURL=chunk-VGMUFW3J.js.map
1
+ import{e as S}from"./chunk-YDDGCJJG.js";import{a as f,e as D}from"./chunk-HXXMPYEF.js";import{x as F}from"./chunk-ISLWJ4PY.js";import{b as C,l as g,m as v,o as y}from"./chunk-WS3Z6W3M.js";import{c as d}from"./chunk-7S5E7KWT.js";var E=d("definition-consumer-file-usage",{clearGroups:["whole-project","source-file"]}),b=v({kind:"consumer-file-usage",invalidation:y("consumer-file-usage"),serialize:O,deserialize:k});function B(n,e){return{forDefinitions(i,r){return M(n,e,i,r)}}}function J(n){let e=new Map;for(let[i,r]of n)e.set(i,new Set(r.files.map(t=>t.file)));return e}function q(n,e,i){return L(n,e,i).partition}function M(n,e,i,r){let t=x(i.length);return g("consumer-evidence.product",()=>{let o=w(n,e,i,r),s=new Map;t={...t,...o.counters};for(let a of i){let c=o.sources.get(a.symbolId)??new Map,l=L(n,a,[...c.keys()],c);t.realFiles+=l.partition.realConsumers.length,t.reexportOnlyFiles+=l.partition.barrelConsumers,t.importOnlyFiles+=l.partition.importOnlyConsumers,s.set(a.symbolId,{definition:a,files:l.files,...l.partition})}return s},()=>({...t}))}function x(n){return{definitions:n,indexedFiles:0,semanticFiles:0,fallbackFiles:0,totalFiles:0,realFiles:0,reexportOnlyFiles:0,importOnlyFiles:0}}function w(n,e,i,r){let t=x(i.length),o=new Map;return m(o,t,"indexed",e.crossFileCallerMap(i,{semantic:!1})),r.semantic&&m(o,t,"semantic",S(n,i)),r.sourceFallback!==!1&&m(o,t,"source-fallback",e.sourceFallbackCallerFiles(i)),t.totalFiles=[...o.values()].reduce((s,a)=>s+a.size,0),{sources:o,counters:t}}function m(n,e,i,r){let t=0;for(let[o,s]of r){let a=n.get(o);a||(a=new Map,n.set(o,a));for(let c of s){t++;let l=a.get(c)??new Set;l.add(i),a.set(c,l)}}i==="indexed"?e.indexedFiles+=t:i==="semantic"?e.semanticFiles+=t:e.fallbackFiles+=t}function L(n,e,i,r=new Map){let t=[],o=0,s=0,a=D(e.symbol),c=[];for(let l of i){let u;_(n,l,e.relativePath,a)?(o++,u="reexport-only"):h(n,l,a)?(s++,u="import-only"):(t.push(l),u="real"),c.push({file:l,sources:[...r.get(l)??[]],classification:u})}return{partition:{realConsumers:t,barrelConsumers:o,importOnlyConsumers:s},files:c}}function h(n,e,i){if(!i)return!1;let r=F(e);if(!r)return!1;let t=E.get(n,e,()=>P(n,e,r));return t.importedLeaves.has(i)&&!t.usedLeaves.has(i)}function P(n,e,i){let r=f(n).forFile(e,{text:!0,ast:!0}),t=r.text;if(!t)return U();let o=C(n,e,t),s=b.read(n,e,o);if(s)return s;let a=I(r.ast,i);return b.write(n,e,o,a),a}function I(n,e){let i=new Set,r=new Set;if(!n)return{importedLeaves:i,usedLeaves:r};let t=e==="rust"?new Set(["use_declaration"]):e==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),o=(s,a)=>{let c=a||t.has(s.type);(s.type==="identifier"||s.type==="type_identifier"||s.type==="property_identifier"||s.type==="field_identifier")&&(c?i.add(s.text):r.add(s.text));for(let l of s.children)o(l,c)};return o(n.rootNode,!1),{importedLeaves:i,usedLeaves:r}}function U(){return{importedLeaves:new Set,usedLeaves:new Set}}function O(n){return JSON.stringify({importedLeaves:[...n.importedLeaves],usedLeaves:[...n.usedLeaves]})}function k(n){try{let e=JSON.parse(n);return!Array.isArray(e.importedLeaves)||!Array.isArray(e.usedLeaves)?null:{importedLeaves:new Set(e.importedLeaves.filter(i=>typeof i=="string")),usedLeaves:new Set(e.usedLeaves.filter(i=>typeof i=="string"))}}catch{return null}}function _(n,e,i,r){if(!r)return!1;let t=f(n).forFile(e,{lines:!0,reexports:!0}),o=t.lines??[];if(o.length===0)return!1;let s=t.reexports??[];if(s.length===0)return!1;let a=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=new RegExp(`\\b${a}\\b`),l=0;for(let u=0;u<o.length;u++){if(!c.test(o[u]??""))continue;if(l++,!s.find(p=>p.startLine<=u&&u<=p.endLine))return!1}return l>0}export{B as a,J as b,q as c,h as d};
2
+ //# sourceMappingURL=chunk-T6NGEV5I.js.map
@@ -1,2 +1,2 @@
1
- import{a as u}from"./chunk-X4O6K47U.js";import{a as h}from"./chunk-QJ3FK4TB.js";import{q as S}from"./chunk-WFGOH2UI.js";import{a as d,c as b}from"./chunk-WQHWIVA7.js";import{m as y}from"./chunk-R3JY4EZ4.js";import{d as m}from"./chunk-HXXMPYEF.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-XMR747CP.js.map
1
+ import{a as u}from"./chunk-UAHZ57BR.js";import{a as h}from"./chunk-72MFTCU5.js";import{q as S}from"./chunk-MKM7NBZK.js";import{a as d,c as b}from"./chunk-ECVXWZ4Q.js";import{m as y}from"./chunk-MBKJ7GHT.js";import{d as m}from"./chunk-HXXMPYEF.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-T7VQG55Q.js.map
@@ -1,4 +1,4 @@
1
- import{a as _}from"./chunk-XHWLNQVZ.js";import{a as r}from"./chunk-WQHWIVA7.js";import{a as l}from"./chunk-XEMQUN3Z.js";import{d as c}from"./chunk-HXXMPYEF.js";function y(e,s){let o=r(e,s);if(!o)return[];let t=e.get(`SELECT COUNT(DISTINCT c.document_id) AS file_count
1
+ import{a as _}from"./chunk-OSWF3HSF.js";import{a as r}from"./chunk-ECVXWZ4Q.js";import{a as l}from"./chunk-XEMQUN3Z.js";import{d as c}from"./chunk-HXXMPYEF.js";function y(e,s){let o=r(e,s);if(!o)return[];let t=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
  JOIN (
@@ -68,4 +68,4 @@ import{a as _}from"./chunk-XHWLNQVZ.js";import{a as r}from"./chunk-WQHWIVA7.js";
68
68
  GROUP BY d.id
69
69
  ORDER BY symbol_count DESC
70
70
  LIMIT ?`,...m,o).filter(i=>!e.isIgnored(i.relative_path)).map(i=>({name:i.relative_path,count:i.symbol_count}))}export{y as a,p as b,b as c,E as d};
71
- //# sourceMappingURL=chunk-LZNLRE4X.js.map
71
+ //# sourceMappingURL=chunk-TTMKELT7.js.map
@@ -1,2 +1,2 @@
1
- import{b as D,f as H,g as O}from"./chunk-NAH5EAZS.js";import{a as x}from"./chunk-BGBBVSH4.js";import{b as U,d as X,e as Z,f as $}from"./chunk-QJ3FK4TB.js";import{a as _,j as z,k as J,m as N,n as Q}from"./chunk-WFGOH2UI.js";import{a as B}from"./chunk-XEMQUN3Z.js";import{f as I,h as W,i as Y,j as P}from"./chunk-R3JY4EZ4.js";import{a as j,g as k,h as T,j as V,k as G}from"./chunk-HXXMPYEF.js";import{k as F}from"./chunk-T2FQ4GHD.js";import{x as R,y as E}from"./chunk-ISLWJ4PY.js";import{l as w,p as A,s as h}from"./chunk-WS3Z6W3M.js";import{g as K}from"./chunk-GNG622H3.js";import{a as q}from"./chunk-64MNV6AB.js";function ee(n,e,t){let r=e.identifierResolution==="strict"?N:Q,l=e.candidateNames?z(e.candidateNames):null,o=0,f=0,m=0,p=0,y="";for(let a of e.paths)if(o+=1,y=a,!(!R(a)&&!(e.includeVueSfc&&E(a)))&&!n.isIgnored(a)&&!e.skipPath?.(a))try{if(l&&!J(A(n,a),l))continue;f+=1;let S=(s,u,v,b)=>{if(e.candidateNames&&!e.candidateNames.has(s))return;m+=1;let g=e.resolveTargets?e.resolveTargets({sourceFile:a,name:s,kind:u,defaultTargets:b}):b();for(let L of g)p+=1,t({sourceFile:a,name:s,target:L,occurrences:v,kind:u})},M=_(n,a);for(let[s,u]of M)S(s,"identifier",u.length,()=>r(n,a,s));for(let s of F(n,a,{includeCrossLanguageDispatchNames:e.includeCrossLanguageDispatchNames,includeRustAttributeNames:e.includeRustAttributeNames})){let u=s.kind==="cross-language-dispatch"?()=>N(n,a,s.name):()=>r(n,a,s.name);S(s.name,s.kind,s.occurrences,u)}}finally{e.afterPath?.(a),o%10===0&&w("source-reference-scan.progress",()=>{},()=>({scannedPaths:o,currentPath:y,candidateMatchedPaths:f,visitedNames:m,visitedHits:p}))}}function ne(n,e={}){let{scope:t,files:r,minLoc:l=1,maxLoc:o=Number.POSITIVE_INFINITY,excludeSymbol:f,excludeEntrySurfaces:m=!1,excludeTypesFiles:p=!1,excludeRootedSymbols:y=!1,requireFunctionLikeSymbol:a=!1,requireCallableSymbol:C=!1,excludeRustTraitImplMembers:S=!1,includeSuppressed:M=!1,sortByLocDesc:s=!1}=e,u=[],v=re(n,{scope:t,files:r,requireFunctionLikeSymbol:a,requireCallableSymbol:C}),b=new Map,g=new Map,L=i=>{let c=b.get(i);if(c!==void 0)return c;let d=H(n,i);return b.set(i,d),d},ie=i=>{let c=g.get(i);if(c!==void 0)return c;let d=D(i);return g.set(i,d),d};for(let i of v){let c=i.relativePath;if(n.isIgnored(c)||m&&L(c)||!oe(i,{requireFunctionLikeSymbol:a,requireCallableSymbol:C})||f!==void 0&&i.symbol===f)continue;let d=x(i);d<l||d>o||p&&ae(c)||y&&O(n,i.symbol,c)||S&&V(i.symbol)||ie(c)!=="test"&&(G(i.symbol)||!M&&h(n,c,i.startLine)||u.push(i))}return s?u.sort((i,c)=>x(c)-x(i)):u}function re(n,e){return e.files!==void 0?[...new Set(e.files.map(r=>r.replace(/\\/g,"/")))].sort().filter(r=>!e.scope||r.includes(e.scope)).flatMap(r=>I(n,r)):e.requireCallableSymbol?P(n,{scope:e.scope,symbolMatches:k,sqlPrefilter:"callable"}):e.requireFunctionLikeSymbol?P(n,{scope:e.scope,symbolMatches:T,sqlPrefilter:"function-like"}):Y(n,e.scope)}function oe(n,e){return e.requireCallableSymbol?k(n.symbol):e.requireFunctionLikeSymbol?T(n.symbol):n.isFunctionLike}function ae(n){return(n.split("/").pop()??"").includes("types")}var te=class{constructor(e){this.db=e}db;scopedDefinitions(e){return W(this.db,e)}definitionsForFile(e){return I(this.db,e)}productionCallableDefinitions(e={}){return ne(this.db,e)}calleeMap(e,t={}){return U(this.db,e,t)}crossFileCallerMap(e,t={}){return X(this.db,e,t)}sourceFallbackCallerFiles(e,t={}){return Z(this.db,e,t)}callerFileMap(e,t={}){return $(this.db,e,t)}frameworkReferencedSymbolIds(e){let t=new Map;for(let l of e){if(!l.leaf)continue;let o=t.get(l.leaf)??[];o.push(l.symbolId),t.set(l.leaf,o)}let r=new Set;for(let l of q(this.db,{includeIgnored:!1}))if(R(l)==="rust")for(let{name:o}of F(this.db,l,{includeRustAttributeNames:!0}))for(let f of t.get(o)??[])r.add(f);return r}symbolsWithNonSelfCallees(e,t={}){if(e.length===0)return new Set;let r=new Map(e.map(o=>[o.symbolId,o.symbol])),l=this.calleeMap(e,t);return new Set([...l.entries()].filter(([o,f])=>{let m=r.get(o);return f.some(p=>p.symbol!==m)}).map(([o])=>o))}fileDependencyGraph(e){return B(this.db,e)}fileKind(e){return D(e)}hasSuppressionComment(e){return h(this.db,e.relativePath,e.startLine)}sourceFiles(){return K(this.db)}scanSourceReferences(e,t){ee(this.db,e,t)}callableSignature(e){let t=j(this.db).forFile(e.relativePath,{facts:!0}).facts?.callables.find(r=>r.startLine===e.startLine&&r.endLine===e.endLine);return t?{paramCount:t.paramCount}:null}};export{te as a};
2
- //# sourceMappingURL=chunk-X4O6K47U.js.map
1
+ import{b as D,f as H,g as O}from"./chunk-NAH5EAZS.js";import{a as x}from"./chunk-BGBBVSH4.js";import{b as U,d as X,e as Z,f as $}from"./chunk-72MFTCU5.js";import{a as _,j as z,k as J,m as N,n as Q}from"./chunk-MKM7NBZK.js";import{a as B}from"./chunk-XEMQUN3Z.js";import{f as I,h as W,i as Y,j as P}from"./chunk-MBKJ7GHT.js";import{a as j,g as k,h as T,j as V,k as G}from"./chunk-HXXMPYEF.js";import{k as F}from"./chunk-T2FQ4GHD.js";import{x as R,y as E}from"./chunk-ISLWJ4PY.js";import{l as w,p as A,s as h}from"./chunk-WS3Z6W3M.js";import{g as K}from"./chunk-GNG622H3.js";import{a as q}from"./chunk-64MNV6AB.js";function ee(n,e,t){let r=e.identifierResolution==="strict"?N:Q,l=e.candidateNames?z(e.candidateNames):null,o=0,f=0,m=0,p=0,y="";for(let a of e.paths)if(o+=1,y=a,!(!R(a)&&!(e.includeVueSfc&&E(a)))&&!n.isIgnored(a)&&!e.skipPath?.(a))try{if(l&&!J(A(n,a),l))continue;f+=1;let S=(s,u,v,b)=>{if(e.candidateNames&&!e.candidateNames.has(s))return;m+=1;let g=e.resolveTargets?e.resolveTargets({sourceFile:a,name:s,kind:u,defaultTargets:b}):b();for(let L of g)p+=1,t({sourceFile:a,name:s,target:L,occurrences:v,kind:u})},M=_(n,a);for(let[s,u]of M)S(s,"identifier",u.length,()=>r(n,a,s));for(let s of F(n,a,{includeCrossLanguageDispatchNames:e.includeCrossLanguageDispatchNames,includeRustAttributeNames:e.includeRustAttributeNames})){let u=s.kind==="cross-language-dispatch"?()=>N(n,a,s.name):()=>r(n,a,s.name);S(s.name,s.kind,s.occurrences,u)}}finally{e.afterPath?.(a),o%10===0&&w("source-reference-scan.progress",()=>{},()=>({scannedPaths:o,currentPath:y,candidateMatchedPaths:f,visitedNames:m,visitedHits:p}))}}function ne(n,e={}){let{scope:t,files:r,minLoc:l=1,maxLoc:o=Number.POSITIVE_INFINITY,excludeSymbol:f,excludeEntrySurfaces:m=!1,excludeTypesFiles:p=!1,excludeRootedSymbols:y=!1,requireFunctionLikeSymbol:a=!1,requireCallableSymbol:C=!1,excludeRustTraitImplMembers:S=!1,includeSuppressed:M=!1,sortByLocDesc:s=!1}=e,u=[],v=re(n,{scope:t,files:r,requireFunctionLikeSymbol:a,requireCallableSymbol:C}),b=new Map,g=new Map,L=i=>{let c=b.get(i);if(c!==void 0)return c;let d=H(n,i);return b.set(i,d),d},ie=i=>{let c=g.get(i);if(c!==void 0)return c;let d=D(i);return g.set(i,d),d};for(let i of v){let c=i.relativePath;if(n.isIgnored(c)||m&&L(c)||!oe(i,{requireFunctionLikeSymbol:a,requireCallableSymbol:C})||f!==void 0&&i.symbol===f)continue;let d=x(i);d<l||d>o||p&&ae(c)||y&&O(n,i.symbol,c)||S&&V(i.symbol)||ie(c)!=="test"&&(G(i.symbol)||!M&&h(n,c,i.startLine)||u.push(i))}return s?u.sort((i,c)=>x(c)-x(i)):u}function re(n,e){return e.files!==void 0?[...new Set(e.files.map(r=>r.replace(/\\/g,"/")))].sort().filter(r=>!e.scope||r.includes(e.scope)).flatMap(r=>I(n,r)):e.requireCallableSymbol?P(n,{scope:e.scope,symbolMatches:k,sqlPrefilter:"callable"}):e.requireFunctionLikeSymbol?P(n,{scope:e.scope,symbolMatches:T,sqlPrefilter:"function-like"}):Y(n,e.scope)}function oe(n,e){return e.requireCallableSymbol?k(n.symbol):e.requireFunctionLikeSymbol?T(n.symbol):n.isFunctionLike}function ae(n){return(n.split("/").pop()??"").includes("types")}var te=class{constructor(e){this.db=e}db;scopedDefinitions(e){return W(this.db,e)}definitionsForFile(e){return I(this.db,e)}productionCallableDefinitions(e={}){return ne(this.db,e)}calleeMap(e,t={}){return U(this.db,e,t)}crossFileCallerMap(e,t={}){return X(this.db,e,t)}sourceFallbackCallerFiles(e,t={}){return Z(this.db,e,t)}callerFileMap(e,t={}){return $(this.db,e,t)}frameworkReferencedSymbolIds(e){let t=new Map;for(let l of e){if(!l.leaf)continue;let o=t.get(l.leaf)??[];o.push(l.symbolId),t.set(l.leaf,o)}let r=new Set;for(let l of q(this.db,{includeIgnored:!1}))if(R(l)==="rust")for(let{name:o}of F(this.db,l,{includeRustAttributeNames:!0}))for(let f of t.get(o)??[])r.add(f);return r}symbolsWithNonSelfCallees(e,t={}){if(e.length===0)return new Set;let r=new Map(e.map(o=>[o.symbolId,o.symbol])),l=this.calleeMap(e,t);return new Set([...l.entries()].filter(([o,f])=>{let m=r.get(o);return f.some(p=>p.symbol!==m)}).map(([o])=>o))}fileDependencyGraph(e){return B(this.db,e)}fileKind(e){return D(e)}hasSuppressionComment(e){return h(this.db,e.relativePath,e.startLine)}sourceFiles(){return K(this.db)}scanSourceReferences(e,t){ee(this.db,e,t)}callableSignature(e){let t=j(this.db).forFile(e.relativePath,{facts:!0}).facts?.callables.find(r=>r.startLine===e.startLine&&r.endLine===e.endLine);return t?{paramCount:t.paramCount}:null}};export{te as a};
2
+ //# sourceMappingURL=chunk-UAHZ57BR.js.map
@@ -1,2 +1,2 @@
1
- import{a as F,b as A}from"./chunk-VGMUFW3J.js";import{a as C}from"./chunk-X4O6K47U.js";import{a as k}from"./chunk-WQHWIVA7.js";import{d as S}from"./chunk-HXXMPYEF.js";import{a as y}from"./chunk-GNG622H3.js";import{a as p}from"./chunk-64MNV6AB.js";import{posix as h}from"path";var _=20,G=1,O=new Map([["app","app"],["apps","app"],["component","component"],["components","component"],["composable","composable"],["composables","composable"],["contract","contract"],["contracts","contract"],["domain","domain"],["domains","domain"],["feature","feature"],["features","feature"],["hook","hook"],["hooks","hook"],["lib","library"],["module","module"],["modules","module"],["package","package"],["packages","package"],["page","page"],["pages","page"],["route","route"],["routes","route"],["screen","screen"],["screens","screen"],["service","service"],["services","service"],["shared","shared"],["src","source-root"],["store","state"],["stores","state"],["test","test"],["tests","test"],["util","utility"],["utils","utility"],["view","view"],["views","view"]]),q=new Set(["components","contracts","hooks","lib","services","shared","stores","utils"]),Y=new Set(["access","api","auth","config","db","effect","errors","hooks","lib","middleware","permissions","routes","schemas","servicetasks","services","startup","store","stores","test-utils","repository","repositories","tests","types","ui","utils","workflow","workflows"]);function Ce(e,n={}){let t=L(n.limit,_),i=L(n.minConsumers,G),r=new C(e),s=r.fileDependencyGraph(n.scope),o=ge(p(e,{includeIgnored:!1})),a=pe(e.config.locality?.architecturalBoundarySegments,n.architecturalBoundarySegments);return(n.target?K(e,r,n.target):J(e,n.scope,n.scanLimit)).map(c=>Q(e,r,s,c,n,o,a)).filter(c=>c.consumerFiles.length>=i||n.target).sort(me).slice(0,t)}function K(e,n,t){let i=Z(e,t);if(i)return[I(i)];let r=k(e,t);if(!r)return[];let s=n.definitionsForFile(r.relativePath).find(o=>o.symbolId===r.symbolId);return s?[ee(s)]:[{unit:{kind:"symbol",file:r.relativePath,shortName:S(r.symbol),symbol:r.symbol,startLine:r.startLine,endLine:r.endLine}}]}function J(e,n,t){let i=p(e,{scope:n,includeIgnored:!1}),r=L(t,i.length);return i.slice(0,r).map(s=>I(s))}function Q(e,n,t,i,r,s,o){let a=i.definition?V(e,n,i.definition,r.semantic):X(t,i.unit.file),d=i.definition?a.length>0?"exact":"none":a.length>0?"file-level":"none",f=i.unit.file,c=l(h.dirname(f)),u=te(a),B=ne(c),W=w([...T(c),...u?T(u):[]]),b=ie(i.unit,c,u,a),g=re(b,i.unit,c,u,a,s,o),j=le(i.unit,d,u,a,c,g.whyNoSuggestedHome),z=ue(i.unit,c,u,a,g.suggestedHome,g.whyNoSuggestedHome);return{actionTier:"signal",sourceUnit:i.unit,candidatePath:f,currentDirectory:c,directoryAncestry:B,consumerFiles:a,consumerCoverage:d,nearestCommonOwner:u,boundaryMarkers:W,recommendedTier:b,suggestedHome:g.suggestedHome,destinationConfidence:g.confidence,whyNoSuggestedHome:g.whyNoSuggestedHome,counterevidence:j,reasons:z,recommendation:de(b,g.suggestedHome,d)}}function V(e,n,t,i){let r=A(F(e,n).forDefinitions([t],{semantic:i!==!1,sourceFallback:!0}));return E(r.get(t.symbolId)??[])}function X(e,n){let t=[];for(let[i,r]of e.entries())i!==n&&r.has(n)&&t.push(i);return E(t)}function Z(e,n){let t=y(n),i=p(e,{includeIgnored:!1}),r=i.find(o=>o===t);if(r)return r;let s=i.find(o=>o.endsWith(`/${t}`));return s||(i.find(o=>o.includes(t))??null)}function ee(e){return{definition:e,unit:{kind:"symbol",file:e.relativePath,shortName:S(e.symbol),symbol:e.symbol,startLine:e.startLine,endLine:e.endLine}}}function I(e){return{unit:{kind:"file",file:e,shortName:h.basename(e)}}}function ne(e){if(e===".")return[{path:".",depth:0,markers:[]}];let n=[],t=e.split("/").filter(Boolean);for(let i=0;i<t.length;i+=1){let r=t.slice(0,i+1).join("/");n.push({path:r,depth:i,markers:D(r)})}return n}function T(e){return e==="."?[]:$(e).map(({marker:n,prefix:t})=>`${n}: ${t}`)}function D(e){return w($(e).map(({marker:n})=>n))}function $(e){let n=e.split("/").filter(Boolean),t=[];for(let i=0;i<n.length;i+=1){let r=O.get(n[i]);r&&t.push({marker:r,prefix:n.slice(0,i+1).join("/")})}return t}function te(e){if(e.length===0)return null;let n=e.map(i=>l(h.dirname(i))),t=n[0].split("/").filter(Boolean);for(let i of n.slice(1)){let r=i.split("/").filter(Boolean),s=[],o=Math.min(t.length,r.length);for(let a=0;a<o&&t[a]===r[a];a+=1)s.push(t[a]);t=s}return t.length===0?".":t.join("/")}function ie(e,n,t,i){return t?e.kind==="symbol"&&i.length===1?i[0]===e.file?"same-file":"sibling-folder":t==="."||t==="src"?"repository-level-review":U(t,"package")?"package-level-shared":U(t,"app")?"app-level-shared":N(t,["feature","domain","module"])||N(n,["feature","domain","module"])?"feature-local-shared":"sibling-folder":"no-exact-consumers"}function re(e,n,t,i,r,s,o){let a=oe(e,i);if(a)return m(a);let d=fe(n.file),f=se(e,t,d,r,o);if(f)return f;let c=i;if(l(t)===l(c))return m(`${t} is already the nearest common owner for its consumers.`);let u=ae(c,t,d,o);return u||ce(c,t,d,s,o)}function oe(e,n){return n?e==="no-exact-consumers"||e==="repository-level-review"?"The inferred owner is too broad or unsupported for an exact destination.":null:"No consumer owner could be inferred from the current index."}function se(e,n,t,i,r){if(e==="same-file"){let s=i[0]??null;return s?v(s):m("No same-file consumer path was available.")}if(e==="sibling-folder"&&i.length===1){let s=l(h.dirname(i[0])),o=H(n,t,s,r);return o?m(o):v(s)}return null}function ae(e,n,t,i){return be(e)?P(e,n,t,i,`Nearest shared owner ${e} is outside source root ${t}.`):null}function ce(e,n,t,i,r){if(e===".")return m("The nearest common owner is the repository root.");let s=`${e}/shared`,o=P(s,n,t,r,`Proposed home ${s} is outside source root ${t}.`);return o.confidence==="withheld"||i.has(s)?o:m(`${s} does not exist in the indexed project.`)}function P(e,n,t,i,r){if(!M(e,t))return m(r);let s=H(n,t,e,i);return s?m(s):v(e)}function v(e){return{suggestedHome:e,confidence:"exact",whyNoSuggestedHome:null}}function m(e){return{suggestedHome:null,confidence:"withheld",whyNoSuggestedHome:e}}function le(e,n,t,i,r,s){let o=["Report-only signal; review ownership before moving files."];return n==="none"&&o.push("No consumers were found in the current index."),n==="file-level"&&o.push("File-level import evidence can hide which exported unit is actually used."),(t==="."||t==="src")&&o.push("Nearest common owner is broad, so this is not enough evidence for automatic placement."),i.length===1&&o.push("Only one consumer was found; inlining or same-folder placement may be better than shared extraction."),e.kind==="file"&&o.push("File targets describe module locality, not symbol-level usage."),t&&r.startsWith(`${t}/`)&&o.push("Candidate already lives under the nearest common owner."),s&&o.push(`No exact suggested home: ${s}`),o}function ue(e,n,t,i,r,s){let o=[];return o.push(`${e.shortName} currently lives in ${n}.`),t?o.push(`${i.length} consumer file(s) share ${t} as their nearest common owner.`):o.push("No consumer owner could be inferred from the current index."),r?o.push(`Suggested home is ${r}.`):s&&o.push(`No exact suggested home: ${s}`),o}function de(e,n,t){return e==="no-exact-consumers"?"Review references before moving; no consumers were found.":e==="repository-level-review"?"Keep this as a broad locality signal; the inferred owner is too general for automatic relocation.":n?`Review whether ${t==="exact"?"symbol usage":"module import"} supports moving or extracting toward ${n}.`:"Review ownership manually before changing structure."}function me(e,n){return R(n)-R(e)||e.candidatePath.localeCompare(n.candidatePath)}function R(e){let n=e.consumerFiles.length*10;return e.consumerCoverage==="exact"&&(n+=5),e.suggestedHome&&(n+=3),e.recommendedTier==="repository-level-review"&&(n*=.1),e.recommendedTier==="no-exact-consumers"&&(n*=.05),n}function ge(e){let n=new Set(["."]);for(let t of e){let i=l(h.dirname(t));for(;!n.has(i)&&(n.add(i),i!==".");)i=l(h.dirname(i))}return n}function fe(e){let n=x(e),t=n.indexOf("src");return t>=0?n.slice(0,t+1).join("/"):n.length<=1?".":n[0]}function M(e,n){let t=l(e),i=l(n);return i==="."||t===i||t.startsWith(`${i}/`)}function he(e,n,t){let i=x(e),r=x(n);return(M(e,n)?i.slice(r.length):i).some(o=>t.has(o.toLowerCase()))}function H(e,n,t,i){return l(e)===l(t)||!he(e,n,i)?null:`${e} is a named architectural boundary; an exact move to ${t} needs human design.`}function pe(...e){let n=new Set(Y);for(let t of e)for(let i of t??[]){let r=ye(i);r&&n.add(r)}return n}function ye(e){let n=e.trim().toLowerCase();return n===""?null:n}function U(e,n){return D(e).includes(n)}function N(e,n){let t=D(e);return n.some(i=>t.includes(i))}function be(e){let n=e.split("/").filter(Boolean),t=n[n.length-1];return t?q.has(t):!1}function l(e){let n=y(e);return n===""?".":n}function x(e){let n=y(e);return n==="."?[]:n.split("/").filter(Boolean)}function L(e,n){return!Number.isFinite(e)||e===void 0||e<1?n:Math.floor(e)}function E(e){return w([...e]).sort((n,t)=>n.localeCompare(t))}function w(e){return[...new Set(e)]}export{Ce as a};
2
- //# sourceMappingURL=chunk-RJMXSHKM.js.map
1
+ import{a as F,b as A}from"./chunk-T6NGEV5I.js";import{a as C}from"./chunk-UAHZ57BR.js";import{a as k}from"./chunk-ECVXWZ4Q.js";import{d as S}from"./chunk-HXXMPYEF.js";import{a as y}from"./chunk-GNG622H3.js";import{a as p}from"./chunk-64MNV6AB.js";import{posix as h}from"path";var _=20,G=1,O=new Map([["app","app"],["apps","app"],["component","component"],["components","component"],["composable","composable"],["composables","composable"],["contract","contract"],["contracts","contract"],["domain","domain"],["domains","domain"],["feature","feature"],["features","feature"],["hook","hook"],["hooks","hook"],["lib","library"],["module","module"],["modules","module"],["package","package"],["packages","package"],["page","page"],["pages","page"],["route","route"],["routes","route"],["screen","screen"],["screens","screen"],["service","service"],["services","service"],["shared","shared"],["src","source-root"],["store","state"],["stores","state"],["test","test"],["tests","test"],["util","utility"],["utils","utility"],["view","view"],["views","view"]]),q=new Set(["components","contracts","hooks","lib","services","shared","stores","utils"]),Y=new Set(["access","api","auth","config","db","effect","errors","hooks","lib","middleware","permissions","routes","schemas","servicetasks","services","startup","store","stores","test-utils","repository","repositories","tests","types","ui","utils","workflow","workflows"]);function Ce(e,n={}){let t=L(n.limit,_),i=L(n.minConsumers,G),r=new C(e),s=r.fileDependencyGraph(n.scope),o=ge(p(e,{includeIgnored:!1})),a=pe(e.config.locality?.architecturalBoundarySegments,n.architecturalBoundarySegments);return(n.target?K(e,r,n.target):J(e,n.scope,n.scanLimit)).map(c=>Q(e,r,s,c,n,o,a)).filter(c=>c.consumerFiles.length>=i||n.target).sort(me).slice(0,t)}function K(e,n,t){let i=Z(e,t);if(i)return[I(i)];let r=k(e,t);if(!r)return[];let s=n.definitionsForFile(r.relativePath).find(o=>o.symbolId===r.symbolId);return s?[ee(s)]:[{unit:{kind:"symbol",file:r.relativePath,shortName:S(r.symbol),symbol:r.symbol,startLine:r.startLine,endLine:r.endLine}}]}function J(e,n,t){let i=p(e,{scope:n,includeIgnored:!1}),r=L(t,i.length);return i.slice(0,r).map(s=>I(s))}function Q(e,n,t,i,r,s,o){let a=i.definition?V(e,n,i.definition,r.semantic):X(t,i.unit.file),d=i.definition?a.length>0?"exact":"none":a.length>0?"file-level":"none",f=i.unit.file,c=l(h.dirname(f)),u=te(a),B=ne(c),W=w([...T(c),...u?T(u):[]]),b=ie(i.unit,c,u,a),g=re(b,i.unit,c,u,a,s,o),j=le(i.unit,d,u,a,c,g.whyNoSuggestedHome),z=ue(i.unit,c,u,a,g.suggestedHome,g.whyNoSuggestedHome);return{actionTier:"signal",sourceUnit:i.unit,candidatePath:f,currentDirectory:c,directoryAncestry:B,consumerFiles:a,consumerCoverage:d,nearestCommonOwner:u,boundaryMarkers:W,recommendedTier:b,suggestedHome:g.suggestedHome,destinationConfidence:g.confidence,whyNoSuggestedHome:g.whyNoSuggestedHome,counterevidence:j,reasons:z,recommendation:de(b,g.suggestedHome,d)}}function V(e,n,t,i){let r=A(F(e,n).forDefinitions([t],{semantic:i!==!1,sourceFallback:!0}));return E(r.get(t.symbolId)??[])}function X(e,n){let t=[];for(let[i,r]of e.entries())i!==n&&r.has(n)&&t.push(i);return E(t)}function Z(e,n){let t=y(n),i=p(e,{includeIgnored:!1}),r=i.find(o=>o===t);if(r)return r;let s=i.find(o=>o.endsWith(`/${t}`));return s||(i.find(o=>o.includes(t))??null)}function ee(e){return{definition:e,unit:{kind:"symbol",file:e.relativePath,shortName:S(e.symbol),symbol:e.symbol,startLine:e.startLine,endLine:e.endLine}}}function I(e){return{unit:{kind:"file",file:e,shortName:h.basename(e)}}}function ne(e){if(e===".")return[{path:".",depth:0,markers:[]}];let n=[],t=e.split("/").filter(Boolean);for(let i=0;i<t.length;i+=1){let r=t.slice(0,i+1).join("/");n.push({path:r,depth:i,markers:D(r)})}return n}function T(e){return e==="."?[]:$(e).map(({marker:n,prefix:t})=>`${n}: ${t}`)}function D(e){return w($(e).map(({marker:n})=>n))}function $(e){let n=e.split("/").filter(Boolean),t=[];for(let i=0;i<n.length;i+=1){let r=O.get(n[i]);r&&t.push({marker:r,prefix:n.slice(0,i+1).join("/")})}return t}function te(e){if(e.length===0)return null;let n=e.map(i=>l(h.dirname(i))),t=n[0].split("/").filter(Boolean);for(let i of n.slice(1)){let r=i.split("/").filter(Boolean),s=[],o=Math.min(t.length,r.length);for(let a=0;a<o&&t[a]===r[a];a+=1)s.push(t[a]);t=s}return t.length===0?".":t.join("/")}function ie(e,n,t,i){return t?e.kind==="symbol"&&i.length===1?i[0]===e.file?"same-file":"sibling-folder":t==="."||t==="src"?"repository-level-review":U(t,"package")?"package-level-shared":U(t,"app")?"app-level-shared":N(t,["feature","domain","module"])||N(n,["feature","domain","module"])?"feature-local-shared":"sibling-folder":"no-exact-consumers"}function re(e,n,t,i,r,s,o){let a=oe(e,i);if(a)return m(a);let d=fe(n.file),f=se(e,t,d,r,o);if(f)return f;let c=i;if(l(t)===l(c))return m(`${t} is already the nearest common owner for its consumers.`);let u=ae(c,t,d,o);return u||ce(c,t,d,s,o)}function oe(e,n){return n?e==="no-exact-consumers"||e==="repository-level-review"?"The inferred owner is too broad or unsupported for an exact destination.":null:"No consumer owner could be inferred from the current index."}function se(e,n,t,i,r){if(e==="same-file"){let s=i[0]??null;return s?v(s):m("No same-file consumer path was available.")}if(e==="sibling-folder"&&i.length===1){let s=l(h.dirname(i[0])),o=H(n,t,s,r);return o?m(o):v(s)}return null}function ae(e,n,t,i){return be(e)?P(e,n,t,i,`Nearest shared owner ${e} is outside source root ${t}.`):null}function ce(e,n,t,i,r){if(e===".")return m("The nearest common owner is the repository root.");let s=`${e}/shared`,o=P(s,n,t,r,`Proposed home ${s} is outside source root ${t}.`);return o.confidence==="withheld"||i.has(s)?o:m(`${s} does not exist in the indexed project.`)}function P(e,n,t,i,r){if(!M(e,t))return m(r);let s=H(n,t,e,i);return s?m(s):v(e)}function v(e){return{suggestedHome:e,confidence:"exact",whyNoSuggestedHome:null}}function m(e){return{suggestedHome:null,confidence:"withheld",whyNoSuggestedHome:e}}function le(e,n,t,i,r,s){let o=["Report-only signal; review ownership before moving files."];return n==="none"&&o.push("No consumers were found in the current index."),n==="file-level"&&o.push("File-level import evidence can hide which exported unit is actually used."),(t==="."||t==="src")&&o.push("Nearest common owner is broad, so this is not enough evidence for automatic placement."),i.length===1&&o.push("Only one consumer was found; inlining or same-folder placement may be better than shared extraction."),e.kind==="file"&&o.push("File targets describe module locality, not symbol-level usage."),t&&r.startsWith(`${t}/`)&&o.push("Candidate already lives under the nearest common owner."),s&&o.push(`No exact suggested home: ${s}`),o}function ue(e,n,t,i,r,s){let o=[];return o.push(`${e.shortName} currently lives in ${n}.`),t?o.push(`${i.length} consumer file(s) share ${t} as their nearest common owner.`):o.push("No consumer owner could be inferred from the current index."),r?o.push(`Suggested home is ${r}.`):s&&o.push(`No exact suggested home: ${s}`),o}function de(e,n,t){return e==="no-exact-consumers"?"Review references before moving; no consumers were found.":e==="repository-level-review"?"Keep this as a broad locality signal; the inferred owner is too general for automatic relocation.":n?`Review whether ${t==="exact"?"symbol usage":"module import"} supports moving or extracting toward ${n}.`:"Review ownership manually before changing structure."}function me(e,n){return R(n)-R(e)||e.candidatePath.localeCompare(n.candidatePath)}function R(e){let n=e.consumerFiles.length*10;return e.consumerCoverage==="exact"&&(n+=5),e.suggestedHome&&(n+=3),e.recommendedTier==="repository-level-review"&&(n*=.1),e.recommendedTier==="no-exact-consumers"&&(n*=.05),n}function ge(e){let n=new Set(["."]);for(let t of e){let i=l(h.dirname(t));for(;!n.has(i)&&(n.add(i),i!==".");)i=l(h.dirname(i))}return n}function fe(e){let n=x(e),t=n.indexOf("src");return t>=0?n.slice(0,t+1).join("/"):n.length<=1?".":n[0]}function M(e,n){let t=l(e),i=l(n);return i==="."||t===i||t.startsWith(`${i}/`)}function he(e,n,t){let i=x(e),r=x(n);return(M(e,n)?i.slice(r.length):i).some(o=>t.has(o.toLowerCase()))}function H(e,n,t,i){return l(e)===l(t)||!he(e,n,i)?null:`${e} is a named architectural boundary; an exact move to ${t} needs human design.`}function pe(...e){let n=new Set(Y);for(let t of e)for(let i of t??[]){let r=ye(i);r&&n.add(r)}return n}function ye(e){let n=e.trim().toLowerCase();return n===""?null:n}function U(e,n){return D(e).includes(n)}function N(e,n){let t=D(e);return n.some(i=>t.includes(i))}function be(e){let n=e.split("/").filter(Boolean),t=n[n.length-1];return t?q.has(t):!1}function l(e){let n=y(e);return n===""?".":n}function x(e){let n=y(e);return n==="."?[]:n.split("/").filter(Boolean)}function L(e,n){return!Number.isFinite(e)||e===void 0||e<1?n:Math.floor(e)}function E(e){return w([...e]).sort((n,t)=>n.localeCompare(t))}function w(e){return[...new Set(e)]}export{Ce as a};
2
+ //# sourceMappingURL=chunk-V3Z3IOWO.js.map
@@ -1,4 +1,4 @@
1
- import{a as b,b as y,c as m}from"./chunk-MTDBHTSF.js";import{g as p}from"./chunk-R3JY4EZ4.js";import{b as f,d as g,f as d}from"./chunk-HXXMPYEF.js";import{a as c}from"./chunk-64MNV6AB.js";import{SymbolInformation_Kind as o}from"@c4312/scip";var _=500;function K(n){let s=parseInt(n,10);if(!isNaN(s))return s;let t=n.toLowerCase(),e=y.get(t);if(e!==void 0)return e;for(let[i,l]of b)if(l.toLowerCase().includes(t))return i;return null}function v(n,s,t={}){let{scope:e,limit:i=100}=t,l=K(s);return l===null?[]:h(n,e).map(r=>({row:r,resolvedKind:k(r)})).filter(r=>r.resolvedKind===l).slice(0,i).map(({row:r,resolvedKind:a})=>({symbol:r.symbol,shortName:g(r.symbol),kind:a,kindName:m(a),relativePath:r.relative_path,startLine:r.start_line,endLine:r.end_line}))}function T(n,s={}){let t=I(n,s.scope);for(let e of S(n,s.scope)){let i=k(e);i===null||i===0||t.set(i,(t.get(i)??0)+1)}return[...t.entries()].sort((e,i)=>i[1]-e[1]||e[0]-i[0]).map(([e,i])=>({kind:e,kindName:m(e),count:i}))}function h(n,s){return p(n,{scope:s}).map(R)}function I(n,s){let t=new Map;for(let e of N(c(n,{scope:s,includeIgnored:!1}))){let i=e.map(()=>"?").join(", "),l=n.all(`SELECT gs.kind AS kind, COUNT(*) AS count
1
+ import{a as b,b as y,c as m}from"./chunk-MTDBHTSF.js";import{g as p}from"./chunk-MBKJ7GHT.js";import{b as f,d as g,f as d}from"./chunk-HXXMPYEF.js";import{a as c}from"./chunk-64MNV6AB.js";import{SymbolInformation_Kind as o}from"@c4312/scip";var _=500;function K(n){let s=parseInt(n,10);if(!isNaN(s))return s;let t=n.toLowerCase(),e=y.get(t);if(e!==void 0)return e;for(let[i,l]of b)if(l.toLowerCase().includes(t))return i;return null}function v(n,s,t={}){let{scope:e,limit:i=100}=t,l=K(s);return l===null?[]:h(n,e).map(r=>({row:r,resolvedKind:k(r)})).filter(r=>r.resolvedKind===l).slice(0,i).map(({row:r,resolvedKind:a})=>({symbol:r.symbol,shortName:g(r.symbol),kind:a,kindName:m(a),relativePath:r.relative_path,startLine:r.start_line,endLine:r.end_line}))}function T(n,s={}){let t=I(n,s.scope);for(let e of S(n,s.scope)){let i=k(e);i===null||i===0||t.set(i,(t.get(i)??0)+1)}return[...t.entries()].sort((e,i)=>i[1]-e[1]||e[0]-i[0]).map(([e,i])=>({kind:e,kindName:m(e),count:i}))}function h(n,s){return p(n,{scope:s}).map(R)}function I(n,s){let t=new Map;for(let e of N(c(n,{scope:s,includeIgnored:!1}))){let i=e.map(()=>"?").join(", "),l=n.all(`SELECT gs.kind AS kind, COUNT(*) AS count
2
2
  FROM defn_enclosing_ranges der
3
3
  JOIN global_symbols gs ON der.symbol_id = gs.id
4
4
  JOIN documents d ON der.document_id = d.id
@@ -20,4 +20,4 @@ import{a as b,b as y,c as m}from"./chunk-MTDBHTSF.js";import{g as p}from"./chunk
20
20
  ${n.symbolNoiseFor("gs")}
21
21
  AND d.relative_path IN (${i})
22
22
  ORDER BY d.relative_path, der.start_line, der.end_line, gs.symbol`,...e))}return t}function N(n){let s=[];for(let t=0;t<n.length;t+=_)s.push(n.slice(t,t+_));return s}function R(n){return{symbol:n.symbol,kind:n.kind,documentation:n.documentation,enclosing_symbol:n.enclosingSymbol,relative_path:n.relativePath,start_line:n.startLine,end_line:n.endLine}}function k(n){return n.kind!==null&&n.kind!==0?D(n.kind,n.symbol,n.documentation):C(n.symbol,n.documentation,n.enclosing_symbol)}function D(n,s,t){let e=(t??"").toLowerCase();if(d(s)==="type"){if(e.includes("type "))return o.TypeAlias;if(e.includes("interface "))return o.Interface;if(e.includes("struct "))return o.Struct;if(e.includes("trait "))return o.Trait;if(e.includes("class "))return o.Class}return n}function C(n,s,t){let e=f(n);if("kind"in e)return null;let i=e.descriptors,l=i[i.length-2]??null,u=d(n),r=(s??"").toLowerCase();return u==="type"?r.includes("type ")?o.TypeAlias:r.includes("interface ")?o.Interface:r.includes("struct ")?o.Struct:r.includes("trait ")?o.Trait:r.includes("class ")?o.Class:o.Class:u==="method"?l?.suffix==="type"?o.Method:o.Function:u==="namespace"?o.Module:u!=="term"?null:r.includes("async def ")||r.includes("def ")?o.Function:(t?d(t):l?.suffix??null)==="type"?o.Field:o.Variable}export{v as a,T as b};
23
- //# sourceMappingURL=chunk-M2YXL62V.js.map
23
+ //# sourceMappingURL=chunk-V7CVBPWX.js.map
@@ -1,3 +1,3 @@
1
- import{f as k}from"./chunk-R3JY4EZ4.js";import{e as C,f as se}from"./chunk-HXXMPYEF.js";import{a as oe}from"./chunk-T2FQ4GHD.js";import{a as ie,b as re,o as W}from"./chunk-ISLWJ4PY.js";import{c as ee,e as te,g as ne,k as v,l as S}from"./chunk-WS3Z6W3M.js";import{a as U}from"./chunk-64MNV6AB.js";import{a as Q,c as Z}from"./chunk-7S5E7KWT.js";import{performance as m}from"perf_hooks";function b(i,e,t){if(i.has(e))return i.get(e);let n=t();return i.set(e,n),n}import ae from"path";function Ae(i,e){return i.getReferences().map(t=>{let n=t.getNode();return O(n,e)})}function Ue(i){let e=i;return typeof e.findReferences=="function"?e.findReferences():[]}function ce(i,e,t,n){let r=[];for(let o of Ue(i))for(let a of Ae(o,n))a.file===e.relativePath&&a.line>=e.startLine&&a.line<=e.endLine||r.push(a);for(let o of t)r.push(o);return R(r)}function le(i,e,t,n){let r=[],o=t?.getStart();for(let a of i.getReferences()){let s=a.getNode();P(n,s.getSourceFile().getFilePath())===e&&(o!==void 0&&s.getStart()===o||r.push({location:O(s,n),node:s}))}return r}function O(i,e){let t=i.getSourceFile(),n=t.getLineAndColumnAtPos(i.getStart());return{file:P(e,t.getFilePath())??t.getBaseName(),line:n.line-1,column:n.column-1}}function fe(i,e,t){let n=i.getSourceFile(),r=_(n,i),o=i.getText(),a=new RegExp(`\\b${oe(o)}\\b`,"g"),s=n.getFullText().split(`
1
+ import{f as k}from"./chunk-MBKJ7GHT.js";import{e as C,f as se}from"./chunk-HXXMPYEF.js";import{a as oe}from"./chunk-T2FQ4GHD.js";import{a as ie,b as re,o as W}from"./chunk-ISLWJ4PY.js";import{c as ee,e as te,g as ne,k as v,l as S}from"./chunk-WS3Z6W3M.js";import{a as U}from"./chunk-64MNV6AB.js";import{a as Q,c as Z}from"./chunk-7S5E7KWT.js";import{performance as m}from"perf_hooks";function b(i,e,t){if(i.has(e))return i.get(e);let n=t();return i.set(e,n),n}import ae from"path";function Ae(i,e){return i.getReferences().map(t=>{let n=t.getNode();return O(n,e)})}function Ue(i){let e=i;return typeof e.findReferences=="function"?e.findReferences():[]}function ce(i,e,t,n){let r=[];for(let o of Ue(i))for(let a of Ae(o,n))a.file===e.relativePath&&a.line>=e.startLine&&a.line<=e.endLine||r.push(a);for(let o of t)r.push(o);return R(r)}function le(i,e,t,n){let r=[],o=t?.getStart();for(let a of i.getReferences()){let s=a.getNode();P(n,s.getSourceFile().getFilePath())===e&&(o!==void 0&&s.getStart()===o||r.push({location:O(s,n),node:s}))}return r}function O(i,e){let t=i.getSourceFile(),n=t.getLineAndColumnAtPos(i.getStart());return{file:P(e,t.getFilePath())??t.getBaseName(),line:n.line-1,column:n.column-1}}function fe(i,e,t){let n=i.getSourceFile(),r=_(n,i),o=i.getText(),a=new RegExp(`\\b${oe(o)}\\b`,"g"),s=n.getFullText().split(`
2
2
  `),c=[];for(let l=0;l<s.length;l++){if(l===r)continue;let d=s[l]??"";a.lastIndex=0;let p;for(;(p=a.exec(d))!==null;)c.push({file:e,line:l,column:p.index})}return R(c.filter(l=>P(t,ae.join(t,l.file))===e))}function H(i){for(let e=i;e;e=e.getParent()){let t=e.getKindName();if(t.includes("Type")||t==="InterfaceDeclaration"||t==="TypeAliasDeclaration")return!0;if(t==="CallExpression"||t==="NewExpression"||t==="ExpressionStatement")return!1}return!1}function _(i,e){return i.getLineAndColumnAtPos(e.getStart()).line-1}function R(i){let e=new Set,t=[];for(let n of i){let r=`${n.file}:${n.line}:${n.column}`;e.has(r)||(e.add(r),t.push(n))}return t}function P(i,e){let t=ae.relative(i||process.cwd(),e).replace(/\\/g,"/");return!t||t.startsWith("..")?null:t}function pe(i,e,t,n){let r=Oe(e,n);return r.size===0?new Map:Be(i,t,r)}function Oe(i,e){let t=new Map;for(let n of k(i,e)){let r=C(n.symbol)??n.leaf;if(!r)continue;let o=t.get(r);o||(o=[],t.set(r,o)),o.push(n)}return t}function Be(i,e,t){let n=new Map,r=new Map;return e.forEachDescendant(o=>{for(let a of We(i,o)){let s=t.get(a);if(!s)continue;let c=_(e,o);for(let l of s){if(c<l.startLine-1||c>l.endLine+1)continue;let d=Math.abs(c-l.startLine),p=r.get(l.symbolId);p!==void 0&&p<=d||(r.set(l.symbolId,d),n.set(l.symbolId,o))}}}),n}function We(i,e){let t=[],n=r=>{r&&!t.includes(r)&&t.push(r)};if("getNameNode"in e&&typeof e.getNameNode=="function"){let r=e.getNameNode();n(r?.getText())}if("getName"in e&&typeof e.getName=="function"){let r=e.getName();n(r)}return i.Node.isIdentifier(e)&&n(e.getText()),t}var He=Z("ts-definition-leaf-candidates",{clearGroups:["definition-catalog"]});function ue(i,e,t,n){let r=ge(i,e),o=de(r.get(n)??[],t);if(o)return o;let a=[];for(let s of r.values())for(let c of s)((c.leaf||C(c.symbol)||"").includes(n)||c.symbol.includes(n))&&a.push(c);return de(a,t)}function me(i,e){let t=new Map;for(let[n,r]of ge(i,e)){let o=r[0];o&&t.set(n,o)}return t}function ge(i,e){return He.get(i,e,()=>{let t=new Map;for(let n of k(i,e)){let r=n.leaf||C(n.symbol);if(!r)continue;let o=t.get(r);o||(o=[],t.set(r,o)),o.push({...n,leaf:r})}for(let n of t.values())n.sort((r,o)=>r.startLine-o.startLine||r.endLine-o.endLine||r.symbolId-o.symbolId);return t})}function de(i,e){let t=null,n=Number.POSITIVE_INFINITY;for(let r of i){let o=Math.abs(r.startLine-e);(o<n||o===n&&t&&r.startLine<t.startLine)&&(t=r,n=o)}return t}import z from"path";var N=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"];function D(i){let e=i.toLowerCase();return N.some(t=>e.endsWith(t))}function ye(i,e){let t=new Map,n=null,r=null,o=()=>(r??=U(i,{extensions:N}),r),a=()=>(n??=S("typescript.source-file-index",()=>_e(i.config.projectRoot,e,o()),()=>({projects:e.length,indexedDocuments:o().length})),n),s=c=>D(c)?b(t,c,()=>{let l=T(z.resolve(i.config.projectRoot,c));for(let{project:d,sourceFiles:p}of a()){let f=p.get(l)??null;if(f||(f=d.addSourceFileAtPathIfExists(l)??null,f&&p.set(T(f.getFilePath()),f)),f)return{project:d,sourceFile:f}}return null}):null;return{sourceFile:c=>s(c)?.sourceFile??null,sourceFileMatch:s,indexedTypeScriptLikeDocuments:o}}function _e(i,e,t){let n=e.map(({project:r})=>({project:r,sourceFiles:new Map(r.getSourceFiles().map(o=>[T(o.getFilePath()),o]))}));for(let r of t){let o=T(z.resolve(i,r));for(let a of n){if(a.sourceFiles.has(o))break;let s=a.project.addSourceFileAtPathIfExists(o)??null;if(s){a.sourceFiles.set(T(s.getFilePath()),s);break}}}return n}function T(i){return z.resolve(i)}function Se(i,e){for(let t of i)if(e===t.name||e.startsWith(`${t.name}/`))return t.name;return null}function he(i){let e=`${i.relativeDir}/src`;return[`${e}/index.ts`,`${e}/index.tsx`,`${e}/index.mts`,`${e}/index.cts`]}import{existsSync as w,readFileSync as ze}from"fs";import h from"path";var $=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function V(i,e){let n=e?h.dirname(h.join(i,e)):i,r=h.resolve(i);for(;n.startsWith(r);){for(let a of $){let s=h.join(n,a);if(w(s))return s}let o=h.dirname(n);if(o===n)break;n=o}for(let o of $){let a=h.join(i,o);if(w(a))return a}return null}function be(i){let e=i.config.projectRoot,t=new Set($e(e,i.config.semantic?.typescript?.tsconfigs)),n=U(i,{includeIgnored:!1,extensions:N});for(let r of n){let o=V(e,r);o&&t.add(h.resolve(o))}if(t.size===0){let r=V(e);r&&t.add(h.resolve(r))}return[...t].filter(r=>!Me(e,r)).sort((r,o)=>r.localeCompare(o))}function $e(i,e=[]){let t=new Set;for(let n of e){let r=h.isAbsolute(n)?n:h.join(i,n);w(r)&&t.add(h.resolve(r))}for(let n of Ve(i))for(let r of $){let o=h.join(n,r);w(o)&&t.add(h.resolve(o))}if(t.size===0){let n=V(i);n&&t.add(h.resolve(n))}return[...t].filter(n=>!Me(i,n)).sort((n,r)=>n.localeCompare(r))}function Ve(i){let e=h.join(i,"package.json");if(!w(e))return[];let t;try{t=JSON.parse(ze(e,"utf8"))}catch{return[]}return(Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[]).flatMap(r=>re(i,r))}function Me(i,e){let t=h.relative(i,e).replace(/\\/g,"/");return t.startsWith("..")||t.includes("/node_modules/")||t.startsWith("node_modules/")||t.includes("/dist/")||t.startsWith("dist/")}import{createRequire as qe}from"module";var Ke=qe(import.meta.url),L;function Ie(){if(L!==void 0)return L;try{L=Ke("ts-morph")}catch{L=null}return L}function xe(i,e){return e.map(t=>({tsconfigPath:t,project:new i.Project({tsConfigFilePath:t,skipFileDependencyResolution:!0})}))}function B(i,e,t){return{language:"typescript",availability:()=>({available:!1,reason:i,tsconfigPath:e,tsconfigPaths:t}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}var Ge=32;function Re(i,e){let t=S("typescript.provider.load",()=>Ie());if(!t)return B("ts-morph is not installed");let n=S("typescript.provider.tsconfig-discovery",()=>be(i));if(n.length===0)return B("no tsconfig found");try{let r=S("typescript.provider.project-bundles",()=>xe(t,n),()=>({tsconfigs:n.length}));return S("typescript.provider.construct",()=>new q(i,t,r),()=>({tsconfigs:n.length}))}catch(r){return B(r instanceof Error?r.message:String(r),n[0],n)}}var q=class{constructor(e,t,n){this.db=e;this.tsMorph=t;this.projects=n;this.workspacePackages=ie(e.config.projectRoot),this.sourceFiles=ye(e,n)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;definitionNodeCache=new Map;fileDefinitionNodeCache=new Map;indexedDefinitionLeafCache=new Map;compilerCheckerCache=new WeakMap;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;sourceFiles;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(e=>e.tsconfigPath)}}importUsage(e){return b(this.importUsageCache,e,()=>{let t=this.sourceFiles.sourceFile(e);if(!t)return[];let n=Ye();return S("typescript.import-usage.file",()=>this.importUsageForSourceFile(e,t,n),()=>({file:e,...n}))})}referencesFor(e){return b(this.referencesCache,e.symbolId,()=>{let t=this.nodeForDefinition(e);return this.referencesForDefinitionNode(e,t)})}referencesForDefinitions(e){let t=new Map,n=v(),r=[];for(let c of e){let l=this.referencesCache.get(c.symbolId);l?t.set(c.symbolId,l):r.push(c)}if(r.length===0)return t;let o=r,a=r.filter(c=>!De(c));if(a.length>=Ge){let c=this.referencesForDefinitionsBySymbolScan(a);for(let l of a){let d=c.get(l.symbolId)??[];this.referencesCache.set(l.symbolId,d),t.set(l.symbolId,d)}if(o=r.filter(l=>De(l)),o.length===0)return t}let s=new Map;for(let c of o){let l=s.get(c.relativePath);l?l.push(c):s.set(c.relativePath,[c])}for(let[c,l]of s){let d=Fe();S("typescript.references-map.file",()=>{let p=this.definitionNodesForFile(c);for(let f of l){n&&(d.cacheMisses+=1);let u=p.get(f.symbolId)??null;n&&(u?d.nodeHits+=1:d.nodeMisses+=1);let g=this.referencesForDefinitionNode(f,u,n?d:void 0);this.referencesCache.set(f.symbolId,g),t.set(f.symbolId,g)}},()=>({relativePath:c,definitions:l.length,...ke(d)}))}return t}referencesForDefinitionsBySymbolScan(e){let t=v(),n=Fe(),r=new Map,o=new Set(e.map(s=>s.symbolId)),a=new Map(e.map(s=>[s.symbolId,s]));for(let s of e)r.set(s.symbolId,[]);return S("typescript.references-map.inverted-scan",()=>{let s=t?m.now():0;for(let p of e){let f=this.packageImportReferencesForDefinition(p);if(f.length>0){let u=r.get(p.symbolId)??[];u.push(...f),r.set(p.symbolId,u)}t&&(n.packageReferenceCount+=f.length)}t&&(n.packageRefsMs+=m.now()-s);let c=new Map,l=new Set(e.map(p=>p.leaf).filter(Boolean)),d=t?m.now():0;for(let p of this.sourceFiles.indexedTypeScriptLikeDocuments()){if(this.db.isIgnored(p))continue;let f=this.sourceFiles.sourceFile(p);f&&(t&&(n.scanFiles+=1),this.addReferencesFromSourceFileScan(f,p,o,a,l,c,r,t?n:void 0))}t&&(n.scanMs+=m.now()-d);for(let[p,f]of r){let u=R(f);r.set(p,u),t&&(n.referenceCount+=u.length)}},()=>({definitions:e.length,...ke(n)})),r}addReferencesFromSourceFileScan(e,t,n,r,o,a,s,c){let l=this.compilerCheckerForSourceFile(e),d=e.compilerNode,p=Ze(e),f=u=>{if(this.tsMorph.ts.isIdentifier(u)){if(c&&(c.identifiers+=1),!o.has(u.text)&&!p.has(u.text)){this.tsMorph.ts.forEachChild(u,f);return}let g=this.compilerReferenceSymbol(l,u,c);if(g){let y;if(a.has(g)?y=a.get(g)??null:(y=this.definitionFromCompilerSymbol(g),a.set(g,y)),c&&(y?c.targetHits+=1:c.targetMisses+=1),y&&n.has(y.symbolId)){c&&(c.requestedHits+=1);let F=r.get(y.symbolId);if(F&&!tt(F,t,ve(d,u))){let I=s.get(y.symbolId)??[],A=d.getLineAndCharacterOfPosition(u.getStart(d));I.push({file:t,line:A.line,column:A.character}),s.set(y.symbolId,I)}}}}this.tsMorph.ts.forEachChild(u,f)};f(d)}compilerReferenceSymbol(e,t,n){n&&(n.symbolLookups+=1);let r=e.getSymbolAtLocation(t);if(r){if((r.flags&this.tsMorph.ts.SymbolFlags.Alias)===0)return r;try{return n&&(n.aliasResolutions+=1),e.getAliasedSymbol(r)}catch{return r}}}calleesFor(e){return b(this.calleesCache,e.symbolId,()=>b(this.fileCalleesCache,e.relativePath,()=>this.calleeMapForFile(e.relativePath)).get(e.symbolId)??[])}calleesForDefinitions(e){let t=new Map,n=new Map;for(let r of e){let o=n.get(r.relativePath);o?o.push(r):n.set(r.relativePath,[r])}for(let[r,o]of n){let a=this.fileCalleesCache.get(r),s=new Set(o.map(l=>l.symbolId)),c=a??this.calleeMapForFile(r,s);for(let l of o){let d=c.get(l.symbolId)??[];this.calleesCache.set(l.symbolId,d),t.set(l.symbolId,d)}}return t}referencesForDefinitionNode(e,t,n){let r=n?m.now():0,o=this.packageImportReferencesForDefinition(e);if(n&&(n.packageRefsMs+=m.now()-r,n.packageReferenceCount+=o.length),!t)return o;let a=n?m.now():0,s=ce(t,e,o,this.db.config.projectRoot);return n&&(n.semanticRefsMs+=m.now()-a,n.referenceCount+=s.length),s}signatureFor(e){return b(this.signatureCache,e.symbolId,()=>{let t=this.nodeForDefinition(e);if(!t||!this.tsMorph.Node.isFunctionDeclaration(t)&&!this.tsMorph.Node.isMethodDeclaration(t)&&!this.tsMorph.Node.isArrowFunction(t)&&!this.tsMorph.Node.isFunctionExpression(t)&&!this.tsMorph.Node.isConstructorDeclaration(t))return null;let n=t.getType().getCallSignatures()[0];if(!n)return null;let r=n.getParameters().map(a=>{let s=a.getDeclarations()[0],c=s?a.getTypeAtLocation(s).getText(s):a.getValueDeclaration()?.getType().getText()??"unknown";return Ce(c)}),o=n.getReturnType().getText(t);return`(${r.join(",")})=>${Ce(o)}`})}importUsageForSourceFile(e,t,n){let r=[],o=new Map;for(let a of t.getImportDeclarations()){n.declarations+=1;let s=W(this.db,e,a.getModuleSpecifierValue()),c=a.getImportClause()?.isTypeOnly()??!1;for(let l of K(a)){n.entries+=1;let d=c?null:l.identifier?.getSymbol()?.compilerSymbol??null;!c&&l.identifier&&(d?n.bindingSymbols+=1:n.missingBindingSymbols+=1);let p={sourcePath:s,entry:l,typeOnlyDeclaration:c,bindingSymbol:d,references:[]};if(r.push(p),c||!l.localName||!d)continue;let f=o.get(l.localName);f?f.push(p):o.set(l.localName,[p])}}return o.size>0&&t.forEachDescendant(a=>{if(a.getKindName()!=="Identifier")return;let s=o.get(a.getText());if(!s||Xe(a))return;n.scannedIdentifiers+=1;let c=a.getSymbol()?.compilerSymbol;if(n.symbolLookups+=1,!!c){for(let l of s)if(l.bindingSymbol===c){l.references.push({location:O(a,this.db.config.projectRoot),node:a}),n.matchedReferences+=1;break}}}),r.map(a=>a.typeOnlyDeclaration?Je(e,a.sourcePath,a.entry):a.entry.identifier&&!a.bindingSymbol?(n.fallbackEntries+=1,this.valueImportUsageForEntry(e,a.sourcePath,a.entry)):this.valueImportUsageFromLocations(e,a.sourcePath,a.entry,a.references))}valueImportUsageForEntry(e,t,n){let r=n.identifier?n.identifier.findReferences():[],o=[];for(let a of r)for(let s of le(a,e,n.identifier,this.db.config.projectRoot))o.push(s);return this.valueImportUsageFromLocations(e,t,n,o)}valueImportUsageFromLocations(e,t,n,r){let o=r.some(c=>!H(c.node)),a=r.some(c=>H(c.node)),s=n.isTypeOnly;return{importer:e,sourcePath:t,importedName:n.importedName,localName:n.localName,kind:n.kind,isTypeOnly:s,isUsed:s||r.length>0,isTypeUsed:s||a,isValueUsed:o,references:r.map(c=>c.location)}}packageImportReferencesForDefinition(e){return this.packageImportReferences().get(e.symbolId)??[]}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let e=new Map,t=this.packageExports();for(let n of this.sourceFiles.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(e,t,n);for(let[n,r]of e)e.set(n,R(r));return this.packageImportReferenceIndex=e,e}addPackageImportReferencesForDocument(e,t,n){if(this.db.isIgnored(n))return;let r=this.sourceFiles.sourceFileMatch(n);if(r)for(let o of r.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(e,t,n,o)}addPackageImportReferencesForDeclaration(e,t,n,r){let o=Se(this.workspacePackages,r.getModuleSpecifierValue());if(!o)return;let a=t.get(o);if(a)for(let s of K(r)){if(s.kind!=="named"||!s.identifier)continue;let c=a.get(s.importedName);if(!c||c.size===0)continue;let l=fe(s.identifier,n,this.db.config.projectRoot);l.length>0&&rt(e,c,l)}}packageExports(){if(this.packageExportIndex)return this.packageExportIndex;let e=new Map;for(let t of this.workspacePackages){let n=new Map;for(let r of he(t))this.collectPackageExports(t,r,n,new Set);n.size>0&&e.set(t.name,n)}return this.packageExportIndex=e,e}collectPackageExports(e,t,n,r){if(r.has(t))return;r.add(t);let o=this.sourceFiles.sourceFile(t);if(o)for(let a of o.getExportDeclarations()){let s=a.getModuleSpecifierValue(),c=s?W(this.db,t,s):t;if(!c||!c.startsWith(`${e.relativeDir}/src/`))continue;let l=a.getNamedExports();if(l.length===0){if(a.isNamespaceExport())continue;this.collectPackageExports(e,c,n,r);continue}for(let d of l){let p=d.getNameNode().getText(),f=d.getAliasNode()?.getText()??p,u=this.indexedDefinitionByLeaf(c,p);if(!u)continue;let g=n.get(f);g||(g=new Set,n.set(f,g)),g.add(u.symbolId)}}}indexedDefinitionByLeaf(e,t){return b(this.indexedDefinitionLeafCache,e,()=>me(this.db,e)).get(t)??null}nodeForDefinition(e){return b(this.definitionNodeCache,e.symbolId,()=>this.definitionNodesForFile(e.relativePath).get(e.symbolId)??null)}definitionNodesForFile(e){return b(this.fileDefinitionNodeCache,e,()=>{let t=this.sourceFiles.sourceFile(e);return t?pe(this.tsMorph,this.db,t,e):new Map})}definitionFromCompilerSymbol(e,t){let n=e.name,r=t?m.now():0,o=e.declarations??[];t&&(t.declarationsMs+=m.now()-r,t.declarationChecks+=o.length);for(let a of o){let s=t?m.now():0,c=a.getSourceFile(),l=P(this.db.config.projectRoot,c.fileName),d=c.getLineAndCharacterOfPosition(a.getStart(c)).line;if(t&&(t.declarationLocationMs+=m.now()-s),!l||this.db.isIgnored(l))continue;let p=t?m.now():0,f=ue(this.db,l,d,n);if(t&&(t.indexedLookupMs+=m.now()-p),f)return{symbolId:f.symbolId,symbol:f.symbol,file:f.relativePath,line:f.startLine}}return null}calleeMapForFile(e,t){let n=v(),r=0,o=0,a=0,s=0,c=0,l=0,d=0,p=0,f=n?nt():void 0;return S("typescript.callee-map.file",()=>{let u=n?m.now():0,g=this.sourceFiles.sourceFile(e);if(n&&(c=Math.round(m.now()-u)),!g)return new Map;let y=n?m.now():0,F=k(this.db,e).sort((M,x)=>M.startLine-x.startLine||x.endLine-M.endLine);if(n&&(l=Math.round(m.now()-y)),r=F.length,F.length===0)return new Map;let I=new Map,A=n?m.now():0,Le=this.compilerCheckerForSourceFile(g),Y=g.compilerNode;n&&(d=Math.round(m.now()-A));let Ee=new Map,X=M=>{if(this.tsMorph.ts.isCallExpression(M)||this.tsMorph.ts.isNewExpression(M)){n&&(o+=1);let x=this.semanticCalleeForCallNode(Le,Y,F,M,Ee,t,f);x&&(n&&(a+=1),Qe(I,x.callerId,x.target))}this.tsMorph.ts.forEachChild(M,X)},je=n?m.now():0;X(Y),n&&(p=Math.round(m.now()-je));for(let[M,x]of I)I.set(M,ot(x));return s=I.size,I},()=>({relativePath:e,definitions:r,callNodes:o,resolvedCallees:a,outputRows:s,requestedDefinitions:t?.size??r,sourceFileLookupMs:c,definitionsLoadMs:l,checkerLookupMs:d,traversalMs:p,...f?it(f):{}}))}semanticCalleeForCallNode(e,t,n,r,o,a,s){let c=s?m.now():0,l=et(n,ve(t,r));if(s&&(s.callerLookupMs+=m.now()-c),!l)return null;if(a&&!a.has(l.symbolId))return s&&(s.skippedUnrequestedCallers+=1),null;let d=r.expression,p=this.compilerSymbolForExpression(e,d,s),f=null;if(p)if(s&&(s.targetSymbolHits+=1),o.has(p))s&&(s.compilerSymbolCacheHits+=1),f=o.get(p)??null;else{s&&(s.compilerSymbolCacheMisses+=1);let u=s?m.now():0;f=this.definitionFromCompilerSymbol(p,s),s&&(s.targetLookupMs+=m.now()-u),o.set(p,f)}else s&&(s.targetMisses+=1);return f?{callerId:l.symbolId,target:{symbol:f.symbol,file:f.file,line:f.line}}:null}compilerSymbolForExpression(e,t,n){let r=n?m.now():0,o=e.getSymbolAtLocation(t);if(n&&(n.expressionSymbolMs+=m.now()-r),o)return o;n&&(n.typeFallbacks+=1);let a=n?m.now():0,s=e.getTypeAtLocation(t).getSymbol();return n&&(n.typeSymbolMs+=m.now()-a),s}compilerCheckerForSourceFile(e){let t=e.getProject(),n=this.compilerCheckerCache.get(t);return n||(n=t.getTypeChecker().compilerObject,this.compilerCheckerCache.set(t,n)),n}};function K(i){let e=[],t=i.getDefaultImport();t&&e.push({identifier:t,importedName:"default",localName:t.getText(),kind:"default",isTypeOnly:i.getImportClause()?.isTypeOnly()??!1});let n=i.getNamespaceImport();n&&e.push({identifier:n,importedName:"*",localName:n.getText(),kind:"namespace",isTypeOnly:i.getImportClause()?.isTypeOnly()??!1});for(let r of i.getNamedImports()){let o=r.getNameNode(),s=r.getAliasNode()??(o.getKindName()==="Identifier"?o:null);e.push({identifier:s,importedName:o.getText(),localName:s?.getText()??o.getText(),kind:"named",isTypeOnly:r.isTypeOnly()||(i.getImportClause()?.isTypeOnly()??!1)})}return e.length===0&&e.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),e}function Je(i,e,t){return{importer:i,sourcePath:e,importedName:t.importedName,localName:t.localName,kind:t.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function Ye(){return{declarations:0,entries:0,bindingSymbols:0,missingBindingSymbols:0,scannedIdentifiers:0,symbolLookups:0,matchedReferences:0,fallbackEntries:0}}function Xe(i){for(let e=i;e;e=e.getParent())if(e.getKindName()==="ImportDeclaration")return!0;return!1}function Qe(i,e,t){let n=i.get(e);n||(n=[],i.set(e,n)),n.push(t)}function Ze(i){let e=new Set;for(let t of i.getImportDeclarations())for(let n of K(t))n.localName&&e.add(n.localName);return e}function et(i,e){let t=null;for(let n of i)e<n.startLine||e>n.endLine||(!t||n.startLine>=t.startLine)&&(t=n);return t}function ve(i,e){return i.getLineAndCharacterOfPosition(e.getStart(i)).line}function tt(i,e,t){return e===i.relativePath&&t>=i.startLine&&t<=i.endLine}function De(i){return i.symbol.includes("#")?se(i.symbol)==="type"&&i.relativePath.endsWith(".d.ts"):!1}function nt(){return{callerLookupMs:0,expressionSymbolMs:0,typeSymbolMs:0,targetLookupMs:0,declarationsMs:0,declarationLocationMs:0,indexedLookupMs:0,compilerSymbolCacheHits:0,compilerSymbolCacheMisses:0,targetSymbolHits:0,targetMisses:0,typeFallbacks:0,declarationChecks:0,skippedUnrequestedCallers:0}}function it(i){return{...i,callerLookupMs:Math.round(i.callerLookupMs),expressionSymbolMs:Math.round(i.expressionSymbolMs),typeSymbolMs:Math.round(i.typeSymbolMs),targetLookupMs:Math.round(i.targetLookupMs),declarationsMs:Math.round(i.declarationsMs),declarationLocationMs:Math.round(i.declarationLocationMs),indexedLookupMs:Math.round(i.indexedLookupMs)}}function Fe(){return{cacheHits:0,cacheMisses:0,nodeHits:0,nodeMisses:0,scanFiles:0,identifiers:0,symbolLookups:0,aliasResolutions:0,targetHits:0,targetMisses:0,requestedHits:0,scanMs:0,packageRefsMs:0,semanticRefsMs:0,packageReferenceCount:0,referenceCount:0}}function ke(i){return{...i,scanMs:Math.round(i.scanMs),packageRefsMs:Math.round(i.packageRefsMs),semanticRefsMs:Math.round(i.semanticRefsMs)}}function rt(i,e,t){for(let n of e){let r=i.get(n)??[];r.push(...t),i.set(n,r)}}function ot(i){let e=new Set,t=[];for(let n of i){let r=`${n.symbol}|${n.file}|${n.line}`;e.has(r)||(e.add(r),t.push(n))}return t}function Ce(i){return i.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}var G=new WeakMap;Q({name:"semantic-provider",groups:["semantic-provider"],clearAll:i=>G.delete(i)});function J(i,e){let t=`${i.config.projectRoot}:typescript-workspace`,n=G.get(i);n||(n=new Map,G.set(i,n));let r=n.get(t);if(r)return r;let o=Re(i,e);return n.set(t,o),o}function E(i){return{capability:(e,t)=>we(i,e,t),importUsage:e=>st(i,e),references:e=>at(i,e),callerMap:e=>ct(i,e),calleeMap:e=>pt(i,e),signature:e=>dt(i,e)}}function fn(i,e){return E(i).importUsage(e)}function st(i,e){let t=j(i,e);return t?t.importUsage(e):[]}function pn(i,e){return E(i).references(e)}function at(i,e){let t=j(i,e.relativePath);return t?t.referencesFor(e):[]}function dn(i,e){return E(i).callerMap(e)}function ct(i,e){let t=v(),n=new Map,r=ee(i),o=[],a=[],s=[],c=0,l=0,d=0,p=0;if(S("semantic.references.cache-scan",()=>{for(let f of e){if(!r||!D(f.relativePath)){t&&!D(f.relativePath)&&(c+=1),s.push(f);continue}let u=te(i,f.relativePath,f.symbol,r);if(u!==null){let g=ft(u);if(g){t&&(l+=1),p+=Ne(i,n,f,g);continue}t&&(d+=1)}a.push(f)}},()=>({definitions:e.length,skippedNonTs:c,cacheHits:l,parseFailures:d,misses:a.length,unkeyed:s.length,resultRows:n.size,callerFiles:p})),a.length>0||s.length>0){let f=[...s,...a],u=0,g=S("semantic.references.compute-misses",()=>{let y=lt(i,f);return u=y.size,y},()=>({definitions:f.length,misses:a.length,unkeyed:s.length,rows:u}));for(let y of f)p+=Ne(i,n,y,g.get(y.symbolId)??[]);if(r)for(let y of a)o.push({relativePath:y.relativePath,symbol:y.symbol,projectFingerprint:r,payload:JSON.stringify(g.get(y.symbolId)??[])})}return o.length>0&&(we(i,"semantic-references").available?S("semantic.references.cache-write",()=>ne(i,o),()=>({entries:o.length})):S("semantic.references.cache-write-skip",()=>{},()=>({reason:"provider-unavailable",entries:o.length}))),n}function lt(i,e){let t=v(),n=new Map,r=0,o=0,a=0,s=0;return S("semantic.references.provider-loop",()=>{let c=new Map,l=[];for(let d of e){let p=j(i,d.relativePath);if(!p){t&&(o+=1);continue}if(t&&(r+=1),p.referencesForDefinitions){let f=c.get(p);f?f.push(d):c.set(p,[d])}else l.push({provider:p,definition:d})}for(let[d,p]of c){let f=d.referencesForDefinitions(p);for(let u of p){let g=f.get(u.symbolId)??[];Pe(n,u.symbolId,g,t,y=>{a+=1,s+=y})}}for(let{provider:d,definition:p}of l){let f=d.referencesFor(p);Pe(n,p.symbolId,f,t,u=>{a+=1,s+=u})}return n},()=>({definitions:e.length,providerHits:r,providerMisses:o,definitionsWithReferences:a,referenceCount:s,rows:n.size}))}function Pe(i,e,t,n,r){i.set(e,t),n&&t.length>0&&r(t.length)}function Ne(i,e,t,n){let r=0;for(let o of n){if(o.file===t.relativePath||i.isIgnored(o.file))continue;let a=e.get(t.symbolId);a||(a=new Set,e.set(t.symbolId,a));let s=a.size;a.add(o.file),a.size!==s&&(r+=1)}return r}function ft(i){try{return JSON.parse(i)}catch{return null}}function un(i,e){return E(i).calleeMap(e)}function pt(i,e){let t=v(),n=new Map,r=0,o=0,a=0,s=0;return S("semantic.callees.provider-loop",()=>{let c=new Map,l=[];for(let d of e){let p=j(i,d.relativePath);if(!p){t&&(o+=1);continue}t&&(r+=1);let f=d;if(p.calleesForDefinitions){let u=c.get(p);u?u.push(f):c.set(p,[f])}else l.push({provider:p,definition:f})}for(let[d,p]of c){let f=d.calleesForDefinitions(p);for(let u of p){let g=f.get(u.symbolId)??[];Te(n,u.symbolId,g,t,y=>{a+=1,s+=y})}}for(let{provider:d,definition:p}of l){let f=d.calleesFor(p);Te(n,p.symbolId,f,t,u=>{a+=1,s+=u})}return n},()=>({definitions:e.length,providerHits:r,providerMisses:o,definitionsWithCallees:a,calleeCount:s,rows:n.size}))}function Te(i,e,t,n,r){t.length>0&&(i.set(e,t),n&&r(t.length))}function mn(i,e){return E(i).signature(e)}function dt(i,e){let t=j(i,e.relativePath);return t?t.signatureFor(e):null}function we(i,e,t){if(t!==void 0&&!D(t))return{slot:e,language:"typescript",available:!1,reason:"semantic evidence is only available for TypeScript files"};try{return{slot:e,language:"typescript",...J(i,t).availability()}}catch(n){return{slot:e,language:"typescript",available:!1,reason:n instanceof Error?n.message:String(n)}}}function j(i,e){if(!D(e))return null;let t=J(i,e);return t.availability().available?t:null}export{D as a,E as b,fn as c,pn as d,dn as e,un as f,mn as g};
3
- //# sourceMappingURL=chunk-C4ICAIJ4.js.map
3
+ //# sourceMappingURL=chunk-YDDGCJJG.js.map