docuvia 1.17.2 → 1.18.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.
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c,d as i,g as P,h as f,i as S,k as _}from"./chunk-DXPDAPXW.js";import{d as b,ta as R,wa as y}from"./chunk-HYERMOZO.js";import"./chunk-KVOCOCYJ.js";import{parentPort as x}from"worker_threads";import{Parser as U,Language as ee}from"web-tree-sitter";import*as H from"path";import*as K from"fs";import{createHash as Y}from"crypto";var Q=new Set([c.VARIABLE_DECLARATOR,c.ASSIGNMENT_EXPRESSION,c.PAIR,c.PUBLIC_FIELD_DEFINITION]);function h(e){return Y(R).update(e.text).digest("hex")}function E(e){return e.childForFieldName("name")?.text||e.descendantsOfType(f.IDENTIFIER)[0]?.text||i.ANONYMOUS_NAME}function W(e){return e.childForFieldName("declarator")?.childForFieldName("declarator")}function J(e){let t=e.childForFieldName("name");if(t)return{name:t.text,nameNode:t};let n=W(e);if(!n)return;if(n.type!==c.QUALIFIED_IDENTIFIER)return{name:n.text,nameNode:n};let r=n.childForFieldName("name");return{name:r?.text??i.ANONYMOUS_NAME,nameNode:r}}function j(e){let t=e.parent;for(;t;){if(t.type===c.ARGUMENTS)return;if(Q.has(t.type)){let n=t.childForFieldName("name")||t.childForFieldName("key")||t.childForFieldName("left");if(n)return{name:n.text,nameNode:n}}t=t.parent}}function C(e){return J(e)??j(e)??{name:i.ANONYMOUS_NAME,nameNode:void 0}}function B(e){return C(e).name}function m(e,t){let n=e.parent;for(;n;){if(t.has(n.id))return E(n);n=n.parent}return i.ANONYMOUS_NAME}function D(e){return e.type===c.TYPE_IDENTIFIER?e.text:e.descendantsOfType(c.TYPE_IDENTIFIER)[0]?.text}function X(e){let t=e.parent;for(;t;){if(t.type===c.IMPL_ITEM){let n=t.childForFieldName("type");return n?D(n):void 0}t=t.parent}}function z(e){let n=e.childForFieldName("receiver")?.namedChild(0)?.childForFieldName("type");return n?D(n):void 0}function Z(e){let n=e.childForFieldName("declarator")?.childForFieldName("declarator");if(n?.type!==c.QUALIFIED_IDENTIFIER)return;let r=n.childForFieldName("scope");if(r)return r.type===c.QUALIFIED_IDENTIFIER?r.childForFieldName("name")?.text:r.text}function $(e){return X(e)??z(e)??Z(e)}function w(e,t,n){let r=t.extractClasses(e.rootNode);for(let a of r)n.push({name:E(a),startLine:a.startPosition.row,endLine:a.endPosition.row,methods:[],contentHash:h(a)});return r}var q=new Set([f.ARROW_FUNCTION,f.FUNCTION_EXPRESSION]);function O(e,t,n){let r=t.extractVariables?.(e.rootNode)??[],a=[];for(let o of r){let s=o.childForFieldName("value");s&&q.has(s.type)||(a.push(o),n.push({name:E(o),startLine:o.startPosition.row,endLine:o.endPosition.row,contentHash:h(o)}))}return a}function F(e,t,n,r){let a=new Set(r.map(s=>s.id)),o=t.extractFunctions(e.rootNode);for(let s of o){let d=m(s,a),l=d===i.ANONYMOUS_NAME?$(s):d;n.push({name:C(s).name,startLine:s.startPosition.row,endLine:s.endPosition.row,contentHash:h(s),containerName:l})}return o}var I=new b(e=>x?.postMessage(e));process.on("uncaughtException",e=>{I.error(i.WORKER_UNCAUGHT_EXCEPTION,{error:e instanceof Error?e.message:String(e)})});process.on("unhandledRejection",e=>{I.error(i.WORKER_UNHANDLED_REJECTION,{error:e instanceof Error?e.message:String(e)})});var v=!1,M=null;function te(){return M??=S(),M}var k=new Map;function ne(e){let t=k.get(e);return t||(t=ee.load(e),k.set(e,t)),t}function re(e){let t=[],n=e.matchAll(/import\s+{([^}]+)}\s+from\s+['"]([^'"]+)['"]/g);for(let r of n)t.push({localName:r[1].trim(),originalName:r[1].trim(),modulePath:r[2]});return t}function oe(e){return e.childForFieldName("function")||e.childForFieldName("expression")||e.childForFieldName("type")||e.childForFieldName("name")||e.childForFieldName("method")||e}function ae(e){let t=oe(e),n=t.namedChildren,r=n[n.length-1],a=n.length>=2?n[n.length-2]:void 0;if(!r||!a)return{targetFunction:p(t.text),calleeName:t.text,calleeKind:"bare"};if(!se.has(r.type))return{targetFunction:p(t.text),calleeKind:"computed"};let o=r.text,s=a.text;return s.includes("(")?{targetFunction:p(t.text),calleeName:o,receiverText:s,calleeKind:"arg-chain"}:{targetFunction:p(t.text),calleeName:o,receiverText:s,calleeKind:s==="this"||s==="super"?"this":"member"}}function p(e){return e.replace(/\s+/g,"")}var se=new Set(["identifier","property_identifier","field_identifier","shorthand_property_identifier","attribute"]);function ie(e){return((e.childForFieldName("property")||e.childForFieldName("field")||e.childForFieldName("attribute")||e.childForFieldName("name")||e.childForFieldName("method"))??e).startPosition}function ce(e,t,n,r){let a=new Set(n.map(s=>s.id)),o=t.extractCalls(e.rootNode);for(let s of o){if(r.length>=1e3)break;let d=ie(s),l=ae(s);r.push({sourceFunction:m(s,a),targetFunction:l.targetFunction,startLine:d.row,startColumn:d.column,calleeName:l.calleeName,receiverText:l.receiverText,calleeKind:l.calleeKind})}}function le(e,t,n,r){if(!t.extractImplements)return;let a=new Set(n.map(o=>o.id));for(let o of t.extractImplements(e.rootNode))r.push({sourceClass:m(o,a),targetInterface:o.text})}function de(e,t,n,r){if(!t.extractExtends)return;let a=new Set(n.map(o=>o.id));for(let o of t.extractExtends(e.rootNode))r.push({sourceClass:m(o,a),targetClass:o.text})}var ue=new Set([y.TYPESCRIPT,y.JAVASCRIPT]),me="Worker",Ne="path",ge="resolve",fe="join",pe="__dirname";function xe(e){if(e.type!=="call_expression")return!1;let t=e.childForFieldName("function");if(!t||t.type!=="member_expression")return!1;let n=t.childForFieldName("object")?.text,r=t.childForFieldName("property")?.text;return n===Ne&&(r===ge||r===fe)}function ye(e){let t=e.childForFieldName("arguments");return!t||!t.namedChildren.some(a=>a?.type==="identifier"&&a.text===pe)?void 0:t.descendantsOfType("string")[0]?.text.replace(/['"]/g,"")}function he(e,t){for(let n of e.rootNode.descendantsOfType(c.ASSIGNMENT_EXPRESSION)){if(!n)continue;let r=n.childForFieldName("left"),a=n.childForFieldName("right");if(r?.text!==t||!a||!xe(a))continue;let o=ye(a);if(o)return o}}function Ee(e,t){if(t.type==="string")return t.text.replace(/['"]/g,"");if(t.type==="identifier"||t.type==="member_expression")return he(e,t.text)}function Fe(e,t,n,r){if(!ue.has(t))return;let a=new Set(n.map(o=>o.id));for(let o of e.rootNode.descendantsOfType("new_expression")){if(!o||o.childForFieldName("constructor")?.text!==me)continue;let l=o.childForFieldName("arguments")?.namedChildren.find(g=>g!==null);if(!l)continue;let N=Ee(e,l);N&&r.push({sourceFunction:m(o,a),targetPath:N})}}function Ie(e,t,n){let r=[],a=[],o=[],s=[],d=[],l=[],N=[],g=[],A=[],T=[];if(e){r.push(i.parsedViaTreeSitter(e.rootNode.childCount));try{let u=w(e,t,d),L=F(e,t,s,u),G=t.extractImports(e.rootNode);a.push(...P(G)),O(e,t,l),ce(e,t,L,N),le(e,t,u,g),de(e,t,u,A),Fe(e,n,L,T),r.push(i.QUERIED_VIA_LANGUAGE_PROVIDER)}catch(u){r.push(i.providerQueryFailed(u instanceof Error?u.message:String(u)))}}return{imports:a,exports:o,functions:s,classes:d,variables:l,calls:N,implements:g,extends:A,workerSpawns:T,decisions:r}}function Ae(e,t){for(let n of e.drainQueryCompileFailures?.()??[])I.error(i.QUERY_COMPILE_FAILED,{language:t,kind:n.kind,pattern:n.pattern,message:n.message})}function Te(e,t,n,r){let a=new U;a.setLanguage(n),t.initQueries?.(n),Ae(t,r);let o=a.parse(e),s=Ie(o,t,r);return o&&o.delete(),a.delete(),s}async function Le(e){v||(await U.init(),v=!0);let t=await te(),n=H.extname(e.filePath),r=t.getProviderForExtension(n);if(!r)return{taskId:e.taskId,success:!0,data:{imports:[],exports:[],functions:[],classes:[],calls:[],decisions:[i.noLanguageProviderForExtension(n)]}};let{wasmPath:a,attemptedPaths:o}=_(r.wasm_file);if(!K.existsSync(a))return{taskId:e.taskId,success:!0,data:{imports:re(e.code),exports:[],functions:[],classes:[],calls:[],decisions:[i.wasmNotFound(e.language,o.join(", "))]}};let s=await ne(a),d=Te(e.code,r,s,e.language);return{taskId:e.taskId,success:!0,data:d}}x?.on("message",async e=>{try{let t=await Le(e);x?.postMessage(t)}catch(t){x?.postMessage({taskId:e.taskId,success:!1,error:t.stack||String(t)})}});export{Le as buildParseResponse,F as collectFunctionNodes,Fe as collectWorkerSpawns,ae as getCalleeEvidence,Ae as reportQueryCompileFailures,B as resolveCallableName,_ as resolveWasmPath};
2
+ import{c as N,d as f,g as le,h as ce,i as u,j as de,l as ue}from"./chunk-QLKE7SQF.js";import{Ga as se,Ja as F,d as oe}from"./chunk-AUAV2EQW.js";import"./chunk-KVOCOCYJ.js";import{parentPort as Q}from"worker_threads";import{Parser as Ke,Language as Kn}from"web-tree-sitter";import*as re from"path";import*as Ue from"fs";var je=new Map([["public_field_definition","field-annotation"],["field_definition","field-annotation"],["property_signature","field-annotation"],["required_parameter","parameter-annotation"],["optional_parameter","parameter-annotation"],["variable_declarator","variable-annotation"]]),fe=new Set(["function_declaration","function_expression","generator_function","generator_function_declaration","arrow_function","method_definition","method_signature","abstract_method_signature"]),Qe=new Set(["function_type","constructor_type","call_signature","construct_signature","index_signature"]),q=new Map([["program","program"],["class_declaration","class"],["abstract_class_declaration","class"],["interface_declaration","interface"],["object","object"],["function_declaration","function"],["function_expression","function"],["generator_function","function"],["generator_function_declaration","function"],["arrow_function","function"],["method_definition","method"],["method_signature","method"],["abstract_method_signature","method"]]),Ge=new Set(["class_declaration","abstract_class_declaration","interface_declaration","object"]),qe=new Map([["method_definition","method"],["method_signature","method"],["abstract_method_signature","method"],["public_field_definition","field"],["field_definition","field"],["property_signature","field"]]),me=new Map([["function_declaration","function"],["function_expression","function-expression"],["generator_function","function-expression"],["generator_function_declaration","function"],["arrow_function","arrow"]]),$e=new Set(["comment","class_static_block"]),g=new Set(["identifier","type_identifier","property_identifier","private_property_identifier"]);function c(e){return{start:e.startIndex,end:e.endIndex}}function _(e){let t=[];for(let n=0;n<e.namedChildCount;n+=1){let r=e.namedChild(n);r&&t.push(r)}return t}function K(e){let t=[];for(let n=0;n<e.childCount;n+=1){let r=e.child(n);r&&t.push(r)}return t}function $(e,t){t(e);for(let n of _(e))$(n,t)}function U(e){let t=e.childForFieldName("name");return!t||!g.has(t.type)?null:t.text}function I(e){let t=e.childForFieldName("type_parameters");return t?_(t).filter(n=>n.type==="type_parameter").map(n=>n.childForFieldName("name")?.text).filter(n=>!!n):[]}function M(e){let t=q.get(e.type)??"program",n=t==="program"?null:U(e);return{kind:t,name:n,span:c(e),genericTypeParameterNames:I(e)}}function E(e){let t=e;for(;t;){if(q.has(t.type))return M(t);t=t.parent}return{kind:"program",name:null,span:{start:0,end:0},genericTypeParameterNames:[]}}function T(e,t){let n=e;for(;n;){if(t(n))return n;n=n.parent}return null}function H(e){return e.type==="class_declaration"||e.type==="abstract_class_declaration"}function Ne(e){return H(e)||e.type==="interface_declaration"}function C(e){return fe.has(e.type)}function ze(e){let t=e.parent;for(;t;){if(C(t))return!1;if(Qe.has(t.type))return!0;t=t.parent}return!1}function ye(e){let t=e.parent;for(;t;){if(t.type==="object_type")return!0;t=t.parent}return!1}function ge(e){let t=U(e);if(t)return t;if(e.type!=="arrow_function"&&e.type!=="function_expression")return null;let n=e.parent;if(!n)return null;let r=n.type==="variable_declarator"?n.childForFieldName("name"):n.type==="pair"?n.childForFieldName("key"):null;return r&&g.has(r.type)?r.text:null}function D(e){let t=e;for(;t;){if(t.type==="program"||t.type==="class_body"||t.type==="interface_body"||t.type==="statement_block"||t.type==="object")return c(t);if(C(t)){let n=t.childForFieldName("body");return c(n??t)}t=t.parent}return c(e)}function he(e){if(e.type!=="variable_declarator")return null;let t=e.parent;if(t?.type!=="variable_declaration")return null;let n=t.parent;for(;n;){if(C(n)){let r=n.childForFieldName("body");return c(r??n)}if(n.type==="program")return c(n);n=n.parent}return null}function B(e,t){return K(e).some(n=>n.text===t)}function Je(e){let t=e.parent;for(;t;){if(t.type==="method_definition"&&U(t)==="constructor")return t;if(t.type==="class_body"||t.type==="program")return null;t=t.parent}return null}function _e(e,t){return t==="javascript"||!Je(e)?!1:K(e).some(n=>n.type==="accessibility_modifier"||n.text==="readonly")}function xe(e,t){let n=e.parent;for(;n;){if(I(n).includes(t))return!0;n=n.parent}return!1}function R(e){return!e||!g.has(e.type)?null:e}function Fe(e){if(!e||e.type!=="type_annotation")return null;let t=_(e).filter(n=>n.type!=="comment");return t.length===1?R(t[0]):null}function z(e){if(e.type==="required_parameter"||e.type==="optional_parameter"){let n=e.childForFieldName("pattern");return n&&g.has(n.type)?n.text:null}let t=e.childForFieldName("name")??e.childForFieldName("property");return t&&g.has(t.type)?t.text:null}function Xe(e,t){if(t==="return-annotation")return M(e);let n=t==="parameter-property"?T(e.parent,H):t==="parameter-annotation"?T(e.parent,C):t==="field-annotation"||t==="implements"||t==="extends"?T(e.parent,Ne):null;return n?M(n):E(e.parent)}function Ze(e,t){if(t==="variable-annotation"||t==="new-initializer"){let n=he(e);if(n)return n}if(t==="parameter-property"||t==="implements"||t==="extends"){let n=T(e.parent,H);if(n)return c(n.childForFieldName("body")??n)}return D(e)}function w(e,t,n,r,a){let i=R(n);if(!i||xe(i,i.text))return null;let o=Xe(a,e);return{kind:e,name:t,typeName:i.text,typeText:i.text,declarationSpan:c(r),typeSpan:c(i),owner:o,lexicalScopeSpan:Ze(r,e)}}function et(e,t){let n=je.get(e.type);if(!n||t==="javascript"||tt(e,n))return null;let r=e.childForFieldName("type");if(e.hasError||r?.hasError)return null;let a=Fe(r),i=n==="parameter-annotation"&&_e(e,t)?"parameter-property":n;return w(i,z(e),a,e,e)}function tt(e,t){return ye(e)||t==="parameter-annotation"&&ze(e)}function nt(e){if(ye(e))return null;let t=e.childForFieldName("return_type");if(e.hasError||t?.hasError)return null;let n=Fe(t);return w("return-annotation",ge(e),n,e,e)}function rt(e){let t=Ae(e);return t?w("new-initializer",z(e),t,e,e):null}function Ae(e){if(e.type!=="variable_declarator"&&e.type!=="public_field_definition"&&e.type!=="field_definition")return null;let t=e.childForFieldName("value");return e.hasError||t?.type!=="new_expression"||t.hasError||t.childForFieldName("type_arguments")?null:R(t.childForFieldName("constructor"))}function at(e){if(e.type!=="type_alias_declaration"||e.hasError)return null;let t=e.childForFieldName("name"),n=R(e.childForFieldName("value"));return!t||!g.has(t.type)||!n||xe(n,n.text)?null:{name:t.text,typeName:n.text,declarationSpan:c(e),typeSpan:c(n),owner:E(e.parent),scopeSpan:D(e.parent??e),genericTypeParameterNames:I(e),isExported:e.parent?.type==="export_statement"}}function it(e){let t=e.type==="interface_declaration"?"interface":e.type==="class_declaration"||e.type==="abstract_class_declaration"?"class":null,n=U(e);return!t||!n?null:{kind:t,name:n,declarationSpan:c(e),scopeSpan:D(e.parent??e),genericTypeParameterNames:I(e)}}function ot(e){if(e.type!=="variable_declarator")return null;let t=e.parent;if(!t)return null;let n=/^(const|let|var)\b/u.exec(t.text);return n?.[1]==="const"||n?.[1]==="let"||n?.[1]==="var"?n[1]:null}function st(e){return e.type==="assignment_expression"||e.type==="augmented_assignment_expression"||e.type==="for_in_statement"||e.type==="for_of_statement"?e.childForFieldName("left"):e.type==="update_expression"?_(e).find(t=>g.has(t.type))??null:null}function lt(e){let t=new Map;return $(e,n=>{let r=st(n);if(r&&g.has(r.type)&&r.text){let a=t.get(r.text)??[];a.push(n.startIndex),t.set(r.text,a)}}),t}function ct(e,t,n,r){return(e.get(t)??[]).some(a=>a>r&&a<=n.end)}function dt(e,t){let n=Ae(e),r=e.childForFieldName("name"),a=ot(e);if(!n||!r||!g.has(r.type)||!a)return null;let o=he(e)??D(e);return{name:r.text,typeName:n.text,declarationSpan:c(e),scopeSpan:o,bindingKind:a,isReassigned:ct(t,r.text,o,r.endIndex)}}function ut(e,t){if(e.hasError)return[];if(t==="javascript"&&e.type==="class_heritage")return pt(e);let n=ft(e);if(!n||!Nt(e))return[];let r=yt(e),a=E(e.parent);return r.map(i=>w(n,a.name,i,e,e)).filter(i=>i!==null)}function pt(e){let t=R(_(e)[0]??null),n=E(e.parent),r=w("extends",n.name,t,e,e);return r?[r]:[]}function ft(e){return e.type==="implements_clause"?"implements":e.type==="extends_clause"||e.type==="extends_type_clause"?"extends":null}function mt(e){let t=T(e.parent,Ne),n=T(e.parent,r=>r.type==="conditional_type"||r.type==="type_alias_declaration");return n&&(!t||n.startIndex>t.startIndex)?null:t}function Nt(e){let t=mt(e);return!t||e.childForFieldName("type_arguments")?!1:e.type==="extends_type_clause"?t.type==="interface_declaration":H(t)}function yt(e){if(e.type!=="extends_clause")return _(e);let t=e.childForFieldName("value");return t?[t]:[]}function G(e){return e.type==="ERROR"||e.isMissing||e.hasError}function Se(e,t){if(t?.startsWith("#"))return"private";let n=_(e).find(r=>r.type==="accessibility_modifier");return n?.text==="private"||n?.text==="protected"?n.text:"public"}function J(e){return K(e).some(t=>t.text==="?")}function gt(e){let t=e.childForFieldName("parameters");if(t)return _(t).filter(r=>r.type!=="comment");let n=e.childForFieldName("parameter");return n?[n]:[]}function Te(e){return e.childForFieldName("pattern")??e}function ht(e){return e.type==="rest_pattern"||Te(e)?.type==="rest_pattern"}function _t(e){return e.type==="optional_parameter"||e.type==="rest_pattern"||e.type==="assignment_pattern"||e.childForFieldName("value")?!0:K(e).some(t=>t.text==="?")}function xt(e){return Te(e)?.text==="this"}function k(e){let t=gt(e).filter(a=>!xt(a)),n=0,r=!1;return t.forEach((a,i)=>{ht(a)?r=!0:_t(a)||(n=i+1)}),{requiredParameterCount:n,maxParameterCount:r?null:t.length}}function Ft(e){let t=e.childForFieldName("name")??e.childForFieldName("property");return t&&g.has(t.type)?t.text:null}function pe(e,t,n,r){return{kind:"unknown",name:r,declarationSpan:c(e),owner:t,lexicalScopeSpan:c(e),visibility:null,isStatic:!1,isAbstract:!1,isOptional:!1,arity:null,genericTypeParameterNames:[],unsupportedReason:n}}function At(e,t,n){return e!=="method"?e:n==="constructor"?"constructor":B(t,"get")?"getter":B(t,"set")?"setter":e}function St(e,t){if(t==="method"||t==="constructor"||t==="getter"||t==="setter")return k(e);let r=e.childForFieldName("value");return r&&fe.has(r.type)?k(r):null}function Tt(e,t){let n=qe.get(e.type),r=Ft(e);if(G(e))return pe(e,t,"syntax-error",r);if(!n||!r)return pe(e,t,r?"unsupported-member":"computed-name",r);let a=At(n,e,r);return{kind:a,name:r,declarationSpan:c(e),owner:t,lexicalScopeSpan:D(e),visibility:Se(e,r),isStatic:B(e,"static"),isAbstract:e.type==="abstract_method_signature"||B(e,"abstract"),isOptional:J(e),arity:St(e,a),genericTypeParameterNames:I(e)}}function It(e,t){let n=e.childForFieldName("key"),r=e.childForFieldName("value"),a=n&&g.has(n.type)?n.text:null;if(!a||!r||G(e)){let i=G(e)?"syntax-error":"computed-name";return{kind:"unknown",name:a,declarationSpan:c(e),owner:t,lexicalScopeSpan:c(e),visibility:null,isStatic:!1,isAbstract:!1,isOptional:!1,arity:null,genericTypeParameterNames:[],unsupportedReason:i}}return{kind:"field",name:a,declarationSpan:c(e),owner:t,lexicalScopeSpan:c(Dt(e,t)),visibility:"public",isStatic:!1,isAbstract:!1,isOptional:J(e),arity:C(r)?k(r):null,genericTypeParameterNames:[]}}function Dt(e,t){let n=e.parent;for(;n;){if(q.get(n.type)===t.kind&&n.startIndex===t.span.start&&n.endIndex===t.span.end)return n;n=n.parent}return e}function bt(e){return e.type==="object"?e:e.childForFieldName("body")}function Et(e,t,n){return{kind:"unknown",name:null,declarationSpan:c(e),owner:t,lexicalScopeSpan:c(n),visibility:null,isStatic:!1,isAbstract:!1,isOptional:!1,arity:null,genericTypeParameterNames:[],unsupportedReason:"computed-name"}}function Ct(e,t,n){let r=z(e);return r?{kind:"field",name:r,declarationSpan:c(e),owner:t,lexicalScopeSpan:c(n),visibility:Se(e,r),isStatic:!1,isAbstract:!1,isOptional:J(e),arity:null,genericTypeParameterNames:[]}:Et(e,t,n)}function Rt(e,t,n){let r=e.childForFieldName("parameters");return(r?_(r):[]).filter(a=>_e(a,"typescript")).map(a=>Ct(a,t,n))}function wt(e,t,n,r){if(e.type==="pair"&&t==="object")return[It(e,n)];let a=Tt(e,n),i=a.kind==="constructor"?Rt(e,n,r):[];return[a,...i]}function Ot(e,t,n){let r=[],a=new Set;e.hasError&&a.add("syntax-error");for(let i of _(e)){if($e.has(i.type))continue;let o=wt(i,t,n,e);r.push(...o);for(let s of o)s.unsupportedReason&&a.add(s.unsupportedReason)}return{declarations:r,reasons:a}}function vt(e){let t=M(e),n=bt(e),r=n?Ot(n,e.type,t):{declarations:[],reasons:new Set(["unsupported-member"])};return{inventory:{owner:t,complete:r.reasons.size===0,incompleteReasons:[...r.reasons].sort()},declarations:r.declarations}}function Pt(e){return{kind:me.get(e.type)??"function",name:ge(e),declarationSpan:c(e),owner:E(e.parent),lexicalScopeSpan:D(e),visibility:null,isStatic:!1,isAbstract:!1,isOptional:!1,arity:k(e),genericTypeParameterNames:I(e)}}function Lt(e){let t=e.parent;if(!t)return!1;let n=r=>r?.type===e.type&&r.startIndex===e.startIndex&&r.endIndex===e.endIndex;return!!((t.type==="public_field_definition"||t.type==="field_definition")&&n(t.childForFieldName("value"))||t.type==="pair"&&n(t.childForFieldName("value")))}function Mt(e){return e.type==="function_expression"&&e.parent?.type==="export_statement"&&/^export\s+default\s+(?:async\s+)?function(?:\s|\*|\()/u.test(e.parent.text)}function Bt(e,t){return e.declarationSpan.start-t.declarationSpan.start||e.typeSpan.start-t.typeSpan.start||e.kind.localeCompare(t.kind)}function kt(e,t){return e.declarationSpan.start-t.declarationSpan.start||e.declarationSpan.end-t.declarationSpan.end||e.kind.localeCompare(t.kind)}function Kt(e,t,n,r){let a=et(e,t);a&&r.facts.push(a);let i=nt(e);i&&r.facts.push(i);let o=rt(e);o&&r.facts.push(o);let s=at(e);s&&r.q3TypeAliases.push(s);let l=it(e);l&&r.q3Classes.push(l);let d=dt(e,n);d&&r.q3NewReceiverBindings.push(d),r.facts.push(...ut(e,t))}function Ut(e,t){if(!Ge.has(e.type))return;let n=`${e.startIndex}:${e.endIndex}:${e.type}`;if(t.visitedOwners.has(n))return;t.visitedOwners.add(n);let r=vt(e);t.ownerInventories.push(r.inventory),t.declarations.push(...r.declarations)}function Ht(e,t){!me.has(e.type)||Lt(e)&&!Mt(e)||t.declarations.push(Pt(e))}function Yt(e,t,n,r){Kt(e,t,n,r),Ut(e,r),Ht(e,r)}function Ie(e,t){if(t!=="typescript"&&t!=="tsx"&&t!=="javascript")throw new RangeError(`Unsupported declared-type grammar: ${String(t)}`);let n=[],r=[],a=[],i=[],o=[],s=[],l=lt(e),y={facts:n,declarations:r,ownerInventories:a,q3Classes:i,q3TypeAliases:o,q3NewReceiverBindings:s,visitedOwners:new Set};return $(e,p=>Yt(p,t,l,y)),n.sort(Bt),r.sort(kt),a.sort((p,m)=>p.owner.span.start-m.owner.span.start||p.owner.kind.localeCompare(m.owner.kind)),o.sort((p,m)=>p.declarationSpan.start-m.declarationSpan.start),i.sort((p,m)=>p.declarationSpan.start-m.declarationSpan.start),s.sort((p,m)=>p.declarationSpan.start-m.declarationSpan.start),{schemaVersion:1,language:t,facts:n,declarations:r,ownerInventories:a,q3ReceiverFacts:{schemaVersion:1,classes:i,typeAliases:o,newReceiverBindings:s}}}var O=new Set(["arrow_function","function_declaration","function_expression","generator_function","generator_function_declaration","method_definition"]),De=new Set(["class_declaration","abstract_class_declaration","class"]),Wt=new Set(["class","class_declaration","abstract_class_declaration","function_expression","function_declaration","generator_function","generator_function_declaration"]),jt=new Set(["function_type","constructor_type","call_signature","construct_signature","index_signature","object_type"]),X=new Set(["for_statement","for_in_statement","for_of_statement","for_await_statement"]),Qt=new Set(["object_pattern","array_pattern","pair_pattern","assignment_pattern","object_assignment_pattern","rest_pattern"]),Gt=/^[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*$/u;function h(e){return{start:e.startIndex,end:e.endIndex}}function A(e){let t=[];for(let n=0;n<e.namedChildCount;n+=1){let r=e.namedChild(n);r&&t.push(r)}return t}function qt(e){let t=[];for(let n=0;n<e.childCount;n+=1){let r=e.child(n);r&&t.push(r)}return t}function W(e,t){t(e);for(let n of A(e))W(n,t)}function v(e,t){let n=e;for(;n;){if(t(n))return n;n=n.parent}return null}function $t(e){let t=e.childForFieldName("name")??e.childForFieldName("pattern")??e.childForFieldName("declarator");return t?.type==="identifier"?t.text:null}function Y(e,t,n){return v(e.parent,t)??n}function zt(e){return e.parent?.text.trimStart().match(/^(var|let|const)\b/)?.[1]}function Jt(e,t){if(e.type==="required_parameter"||e.type==="optional_parameter")return Y(e,a=>O.has(a.type),t);if(zt(e)==="var")return Y(e,a=>O.has(a.type),t);let r=v(e.parent,a=>X.has(a.type));return r||Y(e,a=>a.type==="statement_block",t)}function Xt(e,t){return v(e.parent,n=>O.has(n.type))??t}function be(e){let t=e.parent;for(;t;){if(De.has(t.type))return t;if(t.type==="arrow_function"){t=t.parent;continue}if(O.has(t.type)&&!(t.type==="method_definition"&&t.parent?.type==="class_body"))return null;t=t.parent}return null}function Zt(e){let t=be(e),n=t?.childForFieldName("name")?.text;return t&&n?{name:n,span:h(t)}:null}function en(e,t,n){return n.type!=="public_field_definition"&&n.type!=="field_definition"||n.childForFieldName("name")?.text!==e?null:{kind:"field",name:e,declarationSpan:h(n),scopeSpan:h(t)}}function P(e){return e.type==="identifier"?[e.text]:e.type==="shorthand_property_identifier_pattern"||e.type==="shorthand_property_identifier"?[e.text]:Qt.has(e.type)?A(e).flatMap(P):[]}function L(e,t,n,r,a){let i=V(n),o=e.get(i)??new Map;for(let s of a){let l=o.get(s);if(l){(l.declarationSpan.start!==t.startIndex||l.declarationSpan.end!==t.endIndex)&&o.set(s,{...l,kind:"unsupported"});continue}o.set(s,{name:s,declarationSpan:h(t),scopeSpan:h(n),kind:r})}e.set(i,o)}function tn(e,t,n){if(v(e.parent,l=>jt.has(l.type)))return;let r=e.childForFieldName("name")??e.childForFieldName("pattern")??e.childForFieldName("declarator");if(!r)return;let a=P(r),i=r.type==="identifier",o=v(e.parent,l=>X.has(l.type)),s=i&&(e.type==="required_parameter"||e.type==="optional_parameter")?"parameter":o?"unsupported":i?"local":"unsupported";L(n,e,Jt(e,t),s,a)}function nn(e,t){if(!O.has(e.type))return;let n=e.childForFieldName("parameters"),r=e.childForFieldName("parameter"),a=n?A(n):r?[r]:[];for(let i of a){if(i.type==="required_parameter"||i.type==="optional_parameter")continue;let o=P(i);if(o.length===0)continue;let s=i.type==="identifier";L(t,i,e,s?"parameter":"unsupported",o)}}function rn(e,t,n){if(!Wt.has(e.type))return;let r=e.childForFieldName("name");if(r?.type!=="identifier"&&r?.type!=="type_identifier")return;let i=e.type==="class"||e.type==="function_expression"||e.type==="generator_function"?e:Y(e,o=>o.type==="statement_block",t);L(n,r,i,"unsupported",[r.text])}function an(e,t){if(e.type!=="catch_clause")return;let n=e.childForFieldName("parameter");if(!n)return;let r=e.childForFieldName("body")??e;L(t,n,r,"unsupported",P(n))}function on(e,t){if(!X.has(e.type))return;let n=e.childForFieldName("left")??e.childForFieldName("initializer");if(!n)return;let r=n.type==="variable_declaration"?A(n).find(i=>i.type==="variable_declarator"):n,a=r?.type==="variable_declarator"?r.childForFieldName("name"):r;a&&L(t,a,e,"unsupported",P(a))}function sn(e,t,n){let r=n.get(V(e))??new Map;for(let[a,i]of ln(t))cn(e,r,a,i);n.set(V(e),r)}function ln(e){let t=new Map;for(let n of e){if(n.viaReexport)continue;let r=t.get(n.localName)??[];r.push(n),t.set(n.localName,r)}return t}function cn(e,t,n,r){let a=t.get(n),i=h(e);if(r.length!==1||a){t.set(n,{name:n,declarationSpan:a?.declarationSpan??i,scopeSpan:i,kind:"unsupported"});return}t.set(n,{name:n,declarationSpan:i,scopeSpan:i,kind:r[0]?.isTypeOnly?"type-only-import":"import"})}function dn(e,t){let n=new Map;return W(e,r=>{(r.type==="required_parameter"||r.type==="optional_parameter"||r.type==="variable_declarator")&&tn(r,e,n),nn(r,n),rn(r,e,n),an(r,n),on(r,n)}),sn(e,t,n),n}function Z(e,t){return`${e.startIndex}:${t}`}function V(e){return`${e.type}:${e.startIndex}:${e.endIndex}`}function Ee(e,t,n){e.set(t,e.has(t)?null:n)}function un(e){return qt(e).some(t=>t.type==="accessibility_modifier"||t.text==="readonly")}function pn(e,t,n){if(t.type!=="method_definition"||t.childForFieldName("name")?.text!=="constructor")return;let r=t.childForFieldName("parameters");for(let a of r?A(r):[]){let i=$t(a);!i||!un(a)||Ee(n,Z(e,i),{kind:"parameter-property",name:i,declarationSpan:h(a),scopeSpan:h(e)})}}function fn(e,t){let n=e.childForFieldName("body");for(let r of n?A(n):[]){let a=r.childForFieldName("name")?.text,i=a?en(a,e,r):null;i&&Ee(t,Z(e,a),i),pn(e,r,t)}}function mn(e){let t=new Map;return W(e,n=>{De.has(n.type)&&fn(n,t)}),t}function Ce(e,t,n){return`${e}:${t}:${n}`}function Nn(e,t){let n=new Map;return W(e,r=>{if(r.type!=="call_expression")return;let a=r.childForFieldName("function");if(!a)return;let i=a.childForFieldName("property")??a.childForFieldName("name")??a,o=a.childForFieldName("property")?.text??a.text,s=Ce(i.startPosition.row,i.startPosition.column,o);n.set(s,[...n.get(s)??[],r])}),{callExpressions:n,bindingsByScope:dn(e,t),propertiesByClassAndName:mn(e)}}function yn(e,t,n){let r=be(t);if(e==="this")return r?{kind:"this",name:"this",declarationSpan:h(r),scopeSpan:h(r)}:null;let a=e.match(/^this\.([\p{ID_Start}_$][\p{ID_Continue}$]*)$/u);if(a)return r?n.propertiesByClassAndName.get(Z(r,a[1]))??null:null}function gn(e,t,n){if(!e)return null;let r=yn(e,t,n);if(r!==void 0)return r;if(!Gt.test(e))return null;let a=Re(e,t,n);return a?hn(e,a):null}function Re(e,t,n){let r=t;for(;r;){let a=n.bindingsByScope.get(V(r))?.get(e);if(a)return a;r=r.parent}}function hn(e,t){return!t||t.kind==="unsupported"||t.kind==="import"||t.kind==="type-only-import"?null:{kind:t.kind,name:e,declarationSpan:t.declarationSpan,scopeSpan:t.scopeSpan}}function _n(e,t,n){if((e.calleeKind??"bare")!=="bare")return null;let a=e.calleeName,i=Re(a,t,n);return i?{kind:i.kind==="import"||i.kind==="type-only-import"||i.kind==="local"||i.kind==="parameter"?i.kind:"unsupported",name:a,declarationSpan:i.declarationSpan,scopeSpan:i.scopeSpan}:{kind:"unbound",name:a}}function xn(e){switch(e.type){case"string":return"string";case"number":return"number";case"true":case"false":return"boolean";case"null":return"null";case"object":return"object";case"array":return"array";case"arrow_function":case"function_expression":return"function";default:return"unknown"}}function Fn(e,t){return t?[e.start,e.end,t.kind,t.declarationSpan.start,t.declarationSpan.end,t.scopeSpan.start,t.scopeSpan.end].join(":"):null}function An(e,t){if(!e.calleeName||e.calleeKind==="computed")return null;let n=t.callExpressions.get(Ce(e.startLine,e.startColumn,e.calleeName));return n?.length===1?n[0]??null:null}function Sn(e){return!!e.calleeName&&e.calleeKind!=="computed"}function Tn(e,t,n,r){let a=t.childForFieldName("arguments"),i=a?A(a).filter(S=>S.type!=="comment"):[],o=i.some(S=>S.type==="spread_element"),s=Xt(t,n),l=gn(e.receiverText,t,r),d=_n(e,t,r),y=t.childForFieldName("arguments")?.startIndex,p=t.text.slice(0,y===void 0?t.text.length:y-t.startIndex),m={startLine:e.startLine,startColumn:e.startColumn,calleeName:e.calleeName??"",calleeKind:e.calleeKind??"bare",receiverText:e.receiverText??null,receiverBinding:l,receiverOptional:p.includes("?."),calleeBinding:d,lexicalScopeSpan:h(s),callerType:Zt(t),argumentCount:o?null:i.length,hasSpreadArgument:o,argumentKinds:i.map(xn)};return{fact:m,peerKey:Fn(m.lexicalScopeSpan,l)}}function In(e,t,n){if(!n||t.calleeKind!=="member"&&t.calleeKind!=="this")return;let r=e.get(n)??new Set;r.add(t.calleeName),e.set(n,r)}function we(e,t,n,r){let a=Nn(e,r),i=n.flatMap(l=>{if(!Sn(l))return[];let d=An(l,a);return d?[Tn(l,d,e,a)]:[]}),o=new Map;for(let{fact:l,peerKey:d}of i)In(o,l,d);let s=i.map(({fact:l,peerKey:d})=>({...l,peerMemberNames:[...d?o.get(d)??[]:[]].filter(y=>y!==l.calleeName).sort()}));return{schemaVersion:2,language:t,callSites:s}}import{createHash as bn}from"crypto";var En=new Set([N.VARIABLE_DECLARATOR,N.ASSIGNMENT_EXPRESSION,N.PAIR,N.PUBLIC_FIELD_DEFINITION]),Cn=new Set([u.ARROW_FUNCTION,u.FUNCTION_EXPRESSION,u.FUNCTION_DECLARATION,u.GENERATOR_FUNCTION,u.GENERATOR_FUNCTION_DECLARATION,u.FUNCTION_DEFINITION,u.METHOD_DECLARATION,u.METHOD_DEFINITION,u.LOCAL_FUNCTION_STATEMENT,u.CONSTRUCTOR_DECLARATION,u.DESTRUCTOR_DECLARATION,u.CONVERSION_OPERATOR_DECLARATION,u.OPERATOR_DECLARATION,u.COMPACT_CONSTRUCTOR_DECLARATION,u.METHOD,u.SINGLETON_METHOD,u.FUNCTION_ITEM]);function ee(e){return bn(se).update(e.text).digest("hex")}function te(e){return e.childForFieldName("name")?.text||e.descendantsOfType(u.IDENTIFIER)[0]?.text||f.ANONYMOUS_NAME}function Rn(e){return e.childForFieldName("declarator")?.childForFieldName("declarator")}function wn(e){let t=e.childForFieldName("name");if(t)return{name:t.text,nameNode:t};let n=Rn(e);if(!n)return;if(n.type!==N.QUALIFIED_IDENTIFIER)return{name:n.text,nameNode:n};let r=n.childForFieldName("name");return{name:r?.text??f.ANONYMOUS_NAME,nameNode:r}}function On(e){let t=e.parent;for(;t;){if(t.type===N.ARGUMENTS||Cn.has(t.type))return;if(En.has(t.type)){let n=t.childForFieldName("name")||t.childForFieldName("key")||t.childForFieldName("left");if(n)return{name:n.text,nameNode:n}}t=t.parent}}function Oe(e){return wn(e)??On(e)??{name:f.ANONYMOUS_NAME,nameNode:void 0}}function vn(e){return Oe(e).name}function b(e,t){let n=e.parent;for(;n;){if(t.has(n.id))return te(n);n=n.parent}return f.ANONYMOUS_NAME}function ve(e){return e.type===N.TYPE_IDENTIFIER?e.text:e.descendantsOfType(N.TYPE_IDENTIFIER)[0]?.text}function Pn(e){let t=e.parent;for(;t;){if(t.type===N.IMPL_ITEM){let n=t.childForFieldName("type");return n?ve(n):void 0}t=t.parent}}function Ln(e){let n=e.childForFieldName("receiver")?.namedChild(0)?.childForFieldName("type");return n?ve(n):void 0}function Mn(e){let n=e.childForFieldName("declarator")?.childForFieldName("declarator");if(n?.type!==N.QUALIFIED_IDENTIFIER)return;let r=n.childForFieldName("scope");if(r)return r.type===N.QUALIFIED_IDENTIFIER?r.childForFieldName("name")?.text:r.text}function Bn(e){return Pn(e)??Ln(e)??Mn(e)}function Pe(e,t,n){let r=t.extractClasses(e.rootNode);for(let a of r)n.push({name:te(a),startLine:a.startPosition.row,endLine:a.endPosition.row,methods:[],contentHash:ee(a)});return r}var kn=new Set([u.ARROW_FUNCTION,u.FUNCTION_EXPRESSION]);function Le(e,t,n){let r=t.extractVariables?.(e.rootNode)??[],a=[];for(let i of r){let o=i.childForFieldName("value");o&&kn.has(o.type)||(a.push(i),n.push({name:te(i),startLine:i.startPosition.row,endLine:i.endPosition.row,contentHash:ee(i)}))}return a}function ne(e,t,n,r){let a=new Set(r.map(o=>o.id)),i=t.extractFunctions(e.rootNode);for(let o of i){let s=b(o,a),l=s===f.ANONYMOUS_NAME?Bn(o):s;n.push({name:Oe(o).name,startLine:o.startPosition.row,endLine:o.endPosition.row,contentHash:ee(o),containerName:l})}return i}var ae=new oe(e=>Q?.postMessage(e));process.on("uncaughtException",e=>{ae.error(f.WORKER_UNCAUGHT_EXCEPTION,{error:e instanceof Error?e.message:String(e)})});process.on("unhandledRejection",e=>{ae.error(f.WORKER_UNHANDLED_REJECTION,{error:e instanceof Error?e.message:String(e)})});var Me=!1,Be=null;function Un(){return Be??=de(),Be}var ke=new Map;function Hn(e){let t=ke.get(e);return t||(t=Kn.load(e),ke.set(e,t)),t}function Yn(e){let t=[],n=e.matchAll(/import\s+{([^}]+)}\s+from\s+['"]([^'"]+)['"]/g);for(let r of n)t.push({localName:r[1].trim(),originalName:r[1].trim(),modulePath:r[2]});return t}function Vn(e){return e.childForFieldName("function")||e.childForFieldName("expression")||e.childForFieldName("type")||e.childForFieldName("name")||e.childForFieldName("method")||e}function Wn(e){let t=Vn(e),n=t.namedChildren,r=n[n.length-1],a=n.length>=2?n[n.length-2]:void 0;if(!r||!a)return{targetFunction:j(t.text),calleeName:t.text,calleeKind:"bare"};if(!jn.has(r.type))return{targetFunction:j(t.text),calleeKind:"computed"};let i=r.text,o=a.text;return o.includes("(")?{targetFunction:j(t.text),calleeName:i,receiverText:o,calleeKind:"arg-chain"}:{targetFunction:j(t.text),calleeName:i,receiverText:o,calleeKind:o==="this"||o==="super"?"this":"member"}}function j(e){return e.replace(/\s+/g,"")}var jn=new Set(["identifier","property_identifier","field_identifier","shorthand_property_identifier","attribute"]);function Qn(e){return((e.childForFieldName("property")||e.childForFieldName("field")||e.childForFieldName("attribute")||e.childForFieldName("name")||e.childForFieldName("method"))??e).startPosition}function Gn(e,t,n,r){let a=new Set(n.map(o=>o.id)),i=t.extractCalls(e.rootNode);for(let o of i){if(r.length>=1e3)break;let s=Qn(o),l=Wn(o);r.push({sourceFunction:b(o,a),targetFunction:l.targetFunction,startLine:s.row,startColumn:s.column,calleeName:l.calleeName,receiverText:l.receiverText,calleeKind:l.calleeKind})}}function qn(e,t,n,r){if(!t.extractImplements)return;let a=new Set(n.map(i=>i.id));for(let i of t.extractImplements(e.rootNode))r.push({sourceClass:b(i,a),targetInterface:i.text})}function $n(e,t,n,r){if(!t.extractExtends)return;let a=new Set(n.map(i=>i.id));for(let i of t.extractExtends(e.rootNode))r.push({sourceClass:b(i,a),targetClass:i.text})}var zn=new Set([F.TYPESCRIPT,F.JAVASCRIPT]),Jn="Worker",Xn="path",Zn="resolve",er="join",tr="__dirname";function nr(e){if(e.type!=="call_expression")return!1;let t=e.childForFieldName("function");if(!t||t.type!=="member_expression")return!1;let n=t.childForFieldName("object")?.text,r=t.childForFieldName("property")?.text;return n===Xn&&(r===Zn||r===er)}function rr(e){let t=e.childForFieldName("arguments");return!t||!t.namedChildren.some(a=>a?.type==="identifier"&&a.text===tr)?void 0:t.descendantsOfType("string")[0]?.text.replace(/['"]/g,"")}function ar(e,t){for(let n of e.rootNode.descendantsOfType(N.ASSIGNMENT_EXPRESSION)){if(!n)continue;let r=n.childForFieldName("left"),a=n.childForFieldName("right");if(r?.text!==t||!a||!nr(a))continue;let i=rr(a);if(i)return i}}function ir(e,t){if(t.type==="string")return t.text.replace(/['"]/g,"");if(t.type==="identifier"||t.type==="member_expression")return ar(e,t.text)}function or(e,t,n,r){if(!zn.has(t))return;let a=new Set(n.map(i=>i.id));for(let i of e.rootNode.descendantsOfType("new_expression")){if(!i||i.childForFieldName("constructor")?.text!==Jn)continue;let l=i.childForFieldName("arguments")?.namedChildren.find(y=>y!==null);if(!l)continue;let d=ir(e,l);d&&r.push({sourceFunction:b(i,a),targetPath:d})}}function He(e){let t=[];for(let n=0;n<e.namedChildCount;n+=1){let r=e.namedChild(n);r&&t.push(r)}return t}function sr(e){let t=[];for(let n of He(e))t.push(...lr(n));return t}function lr(e){if(e.type!=="export_statement")return[];if(/^export\s+default\b/u.test(e.text))return[cr(e)];let t=e.childForFieldName("declaration");return t?dr(t):[]}function cr(e){let t=/^export\s+default\s+(?:async\s+)?function(?:\s|\*|\()/u.test(e.text),n=[...e.descendantsOfType("function_declaration"),...e.descendantsOfType("generator_function_declaration"),...e.descendantsOfType("function_expression"),...e.descendantsOfType("generator_function"),...e.descendantsOfType("class_declaration"),...e.descendantsOfType("abstract_class_declaration")].filter(i=>i!==null),r=e.childForFieldName("declaration")??n.sort((i,o)=>i.startIndex-o.startIndex)[0];return r&&t&&["function_declaration","generator_function_declaration","function_expression","generator_function"].includes(r.type)?{name:"default",type:"function",declarationSpan:{start:r.startIndex,end:r.endIndex}}:{name:"default",type:r?.type==="class_declaration"||r?.type==="abstract_class_declaration"?"class":"other",declarationSpan:r?{start:r.startIndex,end:r.endIndex}:{start:e.startIndex,end:e.endIndex}}}function dr(e){let t=ur(e);if(t)return[t];let n=pr(e);return n?[n]:e.type!=="lexical_declaration"&&e.type!=="variable_declaration"?[]:fr(e)}function ur(e){if(e.type!=="class_declaration"&&e.type!=="abstract_class_declaration")return;let t=e.childForFieldName("name");return t&&["identifier","type_identifier"].includes(t.type)?{name:t.text,type:"class"}:void 0}function pr(e){if(e.type!=="function_declaration"&&e.type!=="generator_function_declaration")return;let t=e.childForFieldName("name");return t?.type==="identifier"?{name:t.text,type:"function"}:void 0}function fr(e){let t=[];for(let n of He(e)){if(n.type!=="variable_declarator")continue;let r=n.childForFieldName("name");r?.type==="identifier"&&t.push({name:r.text,type:"variable"})}return t}function mr(e,t,n){let r=[],a=[],i=[],o,s=[],l=[],d=[],y=[],p=[],m=[],S=[];if(e){r.push(f.parsedViaTreeSitter(e.rootNode.childCount));try{i.push(...sr(e.rootNode)),(n===F.TYPESCRIPT||n===F.JAVASCRIPT)&&(o=ce(e.rootNode));let x=Pe(e,t,l),ie=ne(e,t,s,x),Ye=t.extractImports(e.rootNode);a.push(...le(Ye)),Le(e,t,d),Gn(e,t,ie,y),qn(e,t,x,p),$n(e,t,x,m),or(e,n,ie,S),r.push(f.QUERIED_VIA_LANGUAGE_PROVIDER)}catch(x){r.push(f.providerQueryFailed(x instanceof Error?x.message:String(x)))}}return{imports:a,exports:i,...o===void 0?{}:{reexports:o},functions:s,classes:l,variables:d,calls:y,implements:p,extends:m,workerSpawns:S,decisions:r}}function Nr(e,t){for(let n of e.drainQueryCompileFailures?.()??[])ae.error(f.QUERY_COMPILE_FAILED,{language:t,kind:n.kind,pattern:n.pattern,message:n.message})}function yr(e,t,n,r,a){let i=new Ke;i.setLanguage(n),t.initQueries?.(n),Nr(t,r);let o=i.parse(e),s=mr(o,t,r),l=gr(r,a),d=o&&l?{...s,declaredTypeFacts:Ie(o.rootNode,l),callSiteShapeFacts:we(o.rootNode,l,s.calls,s.imports)}:s;return o&&o.delete(),i.delete(),d}function gr(e,t){if(e===F.TYPESCRIPT)return re.extname(t).toLowerCase()===".tsx"?"tsx":"typescript";if(e===F.JAVASCRIPT)return"javascript"}async function hr(e){Me||(await Ke.init(),Me=!0);let t=await Un(),n=re.extname(e.filePath),r=t.getProviderForExtension(n);if(!r)return{taskId:e.taskId,success:!0,data:{imports:[],exports:[],functions:[],classes:[],calls:[],decisions:[f.noLanguageProviderForExtension(n)]}};let{wasmPath:a,attemptedPaths:i}=ue(r.wasm_file);if(!Ue.existsSync(a))return{taskId:e.taskId,success:!0,data:{imports:Yn(e.code),exports:[],functions:[],classes:[],calls:[],decisions:[f.wasmNotFound(e.language,i.join(", "))]}};let o=await Hn(a),s=yr(e.code,r,o,e.language,e.filePath);return{taskId:e.taskId,success:!0,data:s}}Q?.on("message",async e=>{try{let t=await hr(e);Q?.postMessage(t)}catch(t){Q?.postMessage({taskId:e.taskId,success:!1,error:t.stack||String(t)})}});export{hr as buildParseResponse,ne as collectFunctionNodes,or as collectWorkerSpawns,Wn as getCalleeEvidence,Nr as reportQueryCompileFailures,vn as resolveCallableName,ue as resolveWasmPath};
3
3
  //# sourceMappingURL=ast-worker.js.map