docuvia 1.20.1 → 1.22.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 as N,d as f,g as ce,h as de,i as u,j as ue,l as pe}from"./chunk-34USPXMP.js";import{Ha as le,Ka as F,d as se}from"./chunk-2OLMINDD.js";import"./chunk-KVOCOCYJ.js";import{parentPort as Q}from"worker_threads";import{Parser as Ke,Language as Wn}from"web-tree-sitter";import*as ae 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"]]),me=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"]]),$=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"]),y=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 z(e,t){t(e);for(let n of _(e))z(n,t)}function U(e){let t=e.childForFieldName("name");return!t||!y.has(t.type)?null:t.text}function b(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:b(e)}}function A(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 D(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 me.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&&y.has(r.type)?r.text:null}function S(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 k(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(b(n).includes(t))return!0;n=n.parent}return!1}function R(e){return!e||!y.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 J(e){if(e.type==="required_parameter"||e.type==="optional_parameter"){let n=e.childForFieldName("pattern");return n&&y.has(n.type)?n.text:null}let t=e.childForFieldName("name")??e.childForFieldName("property");return t&&y.has(t.type)?t.text:null}function Xe(e,t){if(t==="return-annotation")return M(e);let n=t==="parameter-property"?D(e.parent,H):t==="parameter-annotation"?D(e.parent,C):t==="field-annotation"||t==="implements"||t==="extends"?D(e.parent,Ne):null;return n?M(n):A(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=D(e.parent,H);if(n)return c(n.childForFieldName("body")??n)}return S(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,J(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",J(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||!y.has(t.type)||!n||xe(n,n.text)?null:{name:t.text,typeName:n.text,declarationSpan:c(e),typeSpan:c(n),owner:A(e.parent),scopeSpan:S(e.parent??e),genericTypeParameterNames:b(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:S(e.parent??e),genericTypeParameterNames:b(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=>y.has(t.type))??null:null}function lt(e){let t=new Map;return z(e,n=>{let r=st(n);if(r&&y.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||!y.has(r.type)||!a)return null;let o=he(e)??S(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=A(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=A(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=D(e.parent,Ne),n=D(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 X(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 B(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&&y.has(t.type)?t.text:null}function fe(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":k(t,"get")?"getter":k(t,"set")?"setter":e}function St(e,t){if(t==="method"||t==="constructor"||t==="getter"||t==="setter")return B(e);let r=e.childForFieldName("value");return r&&me.has(r.type)?B(r):null}function Tt(e,t){let n=qe.get(e.type),r=Ft(e);if(G(e))return fe(e,t,"syntax-error",r);if(!n||!r)return fe(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:S(e),visibility:Se(e,r),isStatic:k(e,"static"),isAbstract:e.type==="abstract_method_signature"||k(e,"abstract"),isOptional:X(e),arity:St(e,a),genericTypeParameterNames:b(e)}}function It(e,t){let n=e.childForFieldName("key"),r=e.childForFieldName("value"),a=n&&y.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:X(e),arity:C(r)?B(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=J(e);return r?{kind:"field",name:r,declarationSpan:c(e),owner:t,lexicalScopeSpan:c(n),visibility:Se(e,r),isStatic:!1,isAbstract:!1,isOptional:X(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:$.get(e.type)??"function",name:ge(e),declarationSpan:c(e),owner:A(e.parent),lexicalScopeSpan:S(e),visibility:null,isStatic:!1,isAbstract:!1,isOptional:!1,arity:B(e),genericTypeParameterNames:b(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 kt(e,t){return e.declarationSpan.start-t.declarationSpan.start||e.typeSpan.start-t.typeSpan.start||e.kind.localeCompare(t.kind)}function Bt(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){!$.has(e.type)||Lt(e)&&!Mt(e)||t.declarations.push(Pt(e))}function Vt(e){if(e.type!=="variable_declarator"||e.hasError)return!1;let t=e.childForFieldName("name");if(!t||!y.has(t.type)||A(e.parent).kind!=="program")return!1;let n=e.childForFieldName("value");return!n||!$.has(n.type)}function Yt(e){return e?.type==="lexical_declaration"||e?.type==="variable_declaration"}function Wt(e,t){if(e?.type!=="export_statement"||e.parent?.type!=="program")return!1;let n=e.childForFieldName("declaration");return n?.type===t.type&&n.startIndex===t.startIndex&&n.endIndex===t.endIndex}function jt(e){let t=e.parent;return Yt(t)?Wt(t.parent,t):!1}function Qt(e){if(!Vt(e)||!jt(e))return null;let t=e.childForFieldName("name");if(!t)return null;let n=A(e.parent);return{kind:"unknown",name:t.text,declarationSpan:c(e),owner:n,lexicalScopeSpan:S(e),visibility:null,isStatic:!1,isAbstract:!1,isOptional:!1,arity:null,genericTypeParameterNames:[]}}function Gt(e,t,n,r){Kt(e,t,n,r),Ut(e,r),Ht(e,r);let a=Qt(e);a&&r.declarations.push(a)}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),g={facts:n,declarations:r,ownerInventories:a,q3Classes:i,q3TypeAliases:o,q3NewReceiverBindings:s,visitedOwners:new Set};return z(e,p=>Gt(p,t,l,g)),n.sort(kt),r.sort(Bt),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"]),$t=new Set(["class","class_declaration","abstract_class_declaration","function_expression","function_declaration","generator_function","generator_function_declaration"]),zt=new Set(["function_type","constructor_type","call_signature","construct_signature","index_signature","object_type"]),Z=new Set(["for_statement","for_in_statement","for_of_statement","for_await_statement"]),Jt=new Set(["object_pattern","array_pattern","pair_pattern","assignment_pattern","object_assignment_pattern","rest_pattern"]),Xt=/^[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*$/u;function h(e){return{start:e.startIndex,end:e.endIndex}}function T(e){let t=[];for(let n=0;n<e.namedChildCount;n+=1){let r=e.namedChild(n);r&&t.push(r)}return t}function Zt(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 T(e))W(n,t)}function v(e,t){let n=e;for(;n;){if(t(n))return n;n=n.parent}return null}function en(e){let t=e.childForFieldName("name")??e.childForFieldName("pattern")??e.childForFieldName("declarator");return t?.type==="identifier"?t.text:null}function V(e,t,n){return v(e.parent,t)??n}function tn(e){return e.parent?.text.trimStart().match(/^(var|let|const)\b/)?.[1]}function nn(e,t){if(e.type==="required_parameter"||e.type==="optional_parameter")return V(e,a=>O.has(a.type),t);if(tn(e)==="var")return V(e,a=>O.has(a.type),t);let r=v(e.parent,a=>Z.has(a.type));return r||V(e,a=>a.type==="statement_block",t)}function rn(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 an(e){let t=be(e),n=t?.childForFieldName("name")?.text;return t&&n?{name:n,span:h(t)}:null}function on(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]:Jt.has(e.type)?T(e).flatMap(P):[]}function L(e,t,n,r,a){let i=Y(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 sn(e,t,n){if(v(e.parent,l=>zt.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=>Z.has(l.type)),s=i&&(e.type==="required_parameter"||e.type==="optional_parameter")?"parameter":o?"unsupported":i?"local":"unsupported";L(n,e,nn(e,t),s,a)}function ln(e,t){if(!O.has(e.type))return;let n=e.childForFieldName("parameters"),r=e.childForFieldName("parameter"),a=n?T(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 cn(e,t,n){if(!$t.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:V(e,o=>o.type==="statement_block",t);L(n,r,i,"unsupported",[r.text])}function dn(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 un(e,t){if(!Z.has(e.type))return;let n=e.childForFieldName("left")??e.childForFieldName("initializer");if(!n)return;let r=n.type==="variable_declaration"?T(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 pn(e,t,n){let r=n.get(Y(e))??new Map;for(let[a,i]of fn(t))mn(e,r,a,i);n.set(Y(e),r)}function fn(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 mn(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 Nn(e,t){let n=new Map;return W(e,r=>{(r.type==="required_parameter"||r.type==="optional_parameter"||r.type==="variable_declarator")&&sn(r,e,n),ln(r,n),cn(r,e,n),dn(r,n),un(r,n)}),pn(e,t,n),n}function ee(e,t){return`${e.startIndex}:${t}`}function Y(e){return`${e.type}:${e.startIndex}:${e.endIndex}`}function Ee(e,t,n){e.set(t,e.has(t)?null:n)}function yn(e){return Zt(e).some(t=>t.type==="accessibility_modifier"||t.text==="readonly")}function gn(e,t,n){if(t.type!=="method_definition"||t.childForFieldName("name")?.text!=="constructor")return;let r=t.childForFieldName("parameters");for(let a of r?T(r):[]){let i=en(a);!i||!yn(a)||Ee(n,ee(e,i),{kind:"parameter-property",name:i,declarationSpan:h(a),scopeSpan:h(e)})}}function hn(e,t){let n=e.childForFieldName("body");for(let r of n?T(n):[]){let a=r.childForFieldName("name")?.text,i=a?on(a,e,r):null;i&&Ee(t,ee(e,a),i),gn(e,r,t)}}function _n(e){let t=new Map;return W(e,n=>{De.has(n.type)&&hn(n,t)}),t}function Ce(e,t,n){return`${e}:${t}:${n}`}function xn(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:Nn(e,t),propertiesByClassAndName:_n(e)}}function Fn(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(ee(r,a[1]))??null:null}function An(e,t,n){if(!e)return null;let r=Fn(e,t,n);if(r!==void 0)return r;if(!Xt.test(e))return null;let a=Re(e,t,n);return a?Sn(e,a):null}function Re(e,t,n){let r=t;for(;r;){let a=n.bindingsByScope.get(Y(r))?.get(e);if(a)return a;r=r.parent}}function Sn(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 Tn(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 In(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 Dn(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 bn(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 En(e){return!!e.calleeName&&e.calleeKind!=="computed"}function Cn(e,t,n,r){let a=t.childForFieldName("arguments"),i=a?T(a).filter(I=>I.type!=="comment"):[],o=i.some(I=>I.type==="spread_element"),s=rn(t,n),l=An(e.receiverText,t,r),d=Tn(e,t,r),g=t.childForFieldName("arguments")?.startIndex,p=t.text.slice(0,g===void 0?t.text.length:g-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:an(t),argumentCount:o?null:i.length,hasSpreadArgument:o,argumentKinds:i.map(In)};return{fact:m,peerKey:Dn(m.lexicalScopeSpan,l)}}function Rn(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=xn(e,r),i=n.flatMap(l=>{if(!En(l))return[];let d=bn(l,a);return d?[Cn(l,d,e,a)]:[]}),o=new Map;for(let{fact:l,peerKey:d}of i)Rn(o,l,d);let s=i.map(({fact:l,peerKey:d})=>({...l,peerMemberNames:[...d?o.get(d)??[]:[]].filter(g=>g!==l.calleeName).sort()}));return{schemaVersion:2,language:t,callSites:s}}import{createHash as On}from"crypto";var vn=new Set([N.VARIABLE_DECLARATOR,N.ASSIGNMENT_EXPRESSION,N.PAIR,N.PUBLIC_FIELD_DEFINITION]),Pn=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 te(e){return On(le).update(e.text).digest("hex")}function ne(e){return e.childForFieldName("name")?.text||e.descendantsOfType(u.IDENTIFIER)[0]?.text||f.ANONYMOUS_NAME}function Ln(e){return e.childForFieldName("declarator")?.childForFieldName("declarator")}function Mn(e){let t=e.childForFieldName("name");if(t)return{name:t.text,nameNode:t};let n=Ln(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 kn(e){let t=e.parent;for(;t;){if(t.type===N.ARGUMENTS||Pn.has(t.type))return;if(vn.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 Mn(e)??kn(e)??{name:f.ANONYMOUS_NAME,nameNode:void 0}}function Bn(e){return Oe(e).name}function E(e,t){let n=e.parent;for(;n;){if(t.has(n.id))return ne(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 Kn(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 Un(e){let n=e.childForFieldName("receiver")?.namedChild(0)?.childForFieldName("type");return n?ve(n):void 0}function Hn(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 Vn(e){return Kn(e)??Un(e)??Hn(e)}function Pe(e,t,n){let r=t.extractClasses(e.rootNode);for(let a of r)n.push({name:ne(a),startLine:a.startPosition.row,endLine:a.endPosition.row,methods:[],contentHash:te(a)});return r}var Yn=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&&Yn.has(o.type)||(a.push(i),n.push({name:ne(i),startLine:i.startPosition.row,endLine:i.endPosition.row,contentHash:te(i)}))}return a}function re(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=E(o,a),l=s===f.ANONYMOUS_NAME?Vn(o):s;n.push({name:Oe(o).name,startLine:o.startPosition.row,endLine:o.endPosition.row,declarationSpan:{start:o.startIndex,end:o.endIndex},contentHash:te(o),containerName:l})}return i}var ie=new se(e=>Q?.postMessage(e));process.on("uncaughtException",e=>{ie.error(f.WORKER_UNCAUGHT_EXCEPTION,{error:e instanceof Error?e.message:String(e)})});process.on("unhandledRejection",e=>{ie.error(f.WORKER_UNHANDLED_REJECTION,{error:e instanceof Error?e.message:String(e)})});var Me=!1,ke=null;function jn(){return ke??=ue(),ke}var Be=new Map;function Qn(e){let t=Be.get(e);return t||(t=Wn.load(e),Be.set(e,t)),t}function Gn(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 qn(e){return e.childForFieldName("function")||e.childForFieldName("expression")||e.childForFieldName("type")||e.childForFieldName("name")||e.childForFieldName("method")||e}function $n(e){let t=qn(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(!zn.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 zn=new Set(["identifier","property_identifier","field_identifier","shorthand_property_identifier","attribute"]);function Jn(e){return((e.childForFieldName("property")||e.childForFieldName("field")||e.childForFieldName("attribute")||e.childForFieldName("name")||e.childForFieldName("method"))??e).startPosition}function Xn(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=Jn(o),l=$n(o);r.push({sourceFunction:E(o,a),targetFunction:l.targetFunction,startLine:s.row,startColumn:s.column,calleeName:l.calleeName,receiverText:l.receiverText,calleeKind:l.calleeKind})}}function Zn(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:E(i,a),targetInterface:i.text})}function er(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:E(i,a),targetClass:i.text})}var tr=new Set([F.TYPESCRIPT,F.JAVASCRIPT]),nr="Worker",rr="path",ar="resolve",ir="join",or="__dirname";function sr(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===rr&&(r===ar||r===ir)}function lr(e){let t=e.childForFieldName("arguments");return!t||!t.namedChildren.some(a=>a?.type==="identifier"&&a.text===or)?void 0:t.descendantsOfType("string")[0]?.text.replace(/['"]/g,"")}function cr(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||!sr(a))continue;let i=lr(a);if(i)return i}}function dr(e,t){if(t.type==="string")return t.text.replace(/['"]/g,"");if(t.type==="identifier"||t.type==="member_expression")return cr(e,t.text)}function ur(e,t,n,r){if(!tr.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!==nr)continue;let l=i.childForFieldName("arguments")?.namedChildren.find(g=>g!==null);if(!l)continue;let d=dr(e,l);d&&r.push({sourceFunction:E(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 pr(e){let t=[];for(let n of He(e))t.push(...fr(n));return t}function fr(e){if(e.type!=="export_statement")return[];if(/^export\s+default\b/u.test(e.text))return[mr(e)];let t=e.childForFieldName("declaration");return t?Nr(t):[]}function mr(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 Nr(e){let t=yr(e);if(t)return[t];let n=gr(e);return n?[n]:e.type!=="lexical_declaration"&&e.type!=="variable_declaration"?[]:hr(e)}function yr(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 gr(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 hr(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 _r(e,t,n){let r=[],a=[],i=[],o,s=[],l=[],d=[],g=[],p=[],m=[],I=[];if(e){r.push(f.parsedViaTreeSitter(e.rootNode.childCount));try{i.push(...pr(e.rootNode)),(n===F.TYPESCRIPT||n===F.JAVASCRIPT)&&(o=de(e.rootNode));let x=Pe(e,t,l),oe=re(e,t,s,x),Ve=t.extractImports(e.rootNode);a.push(...ce(Ve)),Le(e,t,d),Xn(e,t,oe,g),Zn(e,t,x,p),er(e,t,x,m),ur(e,n,oe,I),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:g,implements:p,extends:m,workerSpawns:I,decisions:r}}function xr(e,t){for(let n of e.drainQueryCompileFailures?.()??[])ie.error(f.QUERY_COMPILE_FAILED,{language:t,kind:n.kind,pattern:n.pattern,message:n.message})}function Fr(e,t,n,r,a){let i=new Ke;i.setLanguage(n),t.initQueries?.(n),xr(t,r);let o=i.parse(e),s=_r(o,t,r),l=Ar(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 Ar(e,t){if(e===F.TYPESCRIPT)return ae.extname(t).toLowerCase()===".tsx"?"tsx":"typescript";if(e===F.JAVASCRIPT)return"javascript"}async function Sr(e){Me||(await Ke.init(),Me=!0);let t=await jn(),n=ae.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}=pe(r.wasm_file);if(!Ue.existsSync(a))return{taskId:e.taskId,success:!0,data:{imports:Gn(e.code),exports:[],functions:[],classes:[],calls:[],decisions:[f.wasmNotFound(e.language,i.join(", "))]}};let o=await Qn(a),s=Fr(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 Sr(e);Q?.postMessage(t)}catch(t){Q?.postMessage({taskId:e.taskId,success:!1,error:t.stack||String(t)})}});export{Sr as buildParseResponse,re as collectFunctionNodes,ur as collectWorkerSpawns,$n as getCalleeEvidence,xr as reportQueryCompileFailures,Bn as resolveCallableName,pe as resolveWasmPath};
2
+ import{c as N,d as f,g as ce,h as de,i as u,j as ue,l as pe}from"./chunk-3PNI46VR.js";import{Ja as le,Ma as F,d as se}from"./chunk-UUYEPLGA.js";import"./chunk-KVOCOCYJ.js";import{parentPort as Q}from"worker_threads";import{Parser as Ke,Language as Wn}from"web-tree-sitter";import*as ae 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"]]),me=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"]]),$=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"]),y=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 z(e,t){t(e);for(let n of _(e))z(n,t)}function U(e){let t=e.childForFieldName("name");return!t||!y.has(t.type)?null:t.text}function b(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:b(e)}}function A(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 D(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 me.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&&y.has(r.type)?r.text:null}function S(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 k(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(b(n).includes(t))return!0;n=n.parent}return!1}function R(e){return!e||!y.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 J(e){if(e.type==="required_parameter"||e.type==="optional_parameter"){let n=e.childForFieldName("pattern");return n&&y.has(n.type)?n.text:null}let t=e.childForFieldName("name")??e.childForFieldName("property");return t&&y.has(t.type)?t.text:null}function Xe(e,t){if(t==="return-annotation")return M(e);let n=t==="parameter-property"?D(e.parent,H):t==="parameter-annotation"?D(e.parent,C):t==="field-annotation"||t==="implements"||t==="extends"?D(e.parent,Ne):null;return n?M(n):A(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=D(e.parent,H);if(n)return c(n.childForFieldName("body")??n)}return S(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,J(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",J(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||!y.has(t.type)||!n||xe(n,n.text)?null:{name:t.text,typeName:n.text,declarationSpan:c(e),typeSpan:c(n),owner:A(e.parent),scopeSpan:S(e.parent??e),genericTypeParameterNames:b(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:S(e.parent??e),genericTypeParameterNames:b(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=>y.has(t.type))??null:null}function lt(e){let t=new Map;return z(e,n=>{let r=st(n);if(r&&y.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||!y.has(r.type)||!a)return null;let o=he(e)??S(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=A(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=A(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=D(e.parent,Ne),n=D(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 X(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 B(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&&y.has(t.type)?t.text:null}function fe(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":k(t,"get")?"getter":k(t,"set")?"setter":e}function St(e,t){if(t==="method"||t==="constructor"||t==="getter"||t==="setter")return B(e);let r=e.childForFieldName("value");return r&&me.has(r.type)?B(r):null}function Tt(e,t){let n=qe.get(e.type),r=Ft(e);if(G(e))return fe(e,t,"syntax-error",r);if(!n||!r)return fe(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:S(e),visibility:Se(e,r),isStatic:k(e,"static"),isAbstract:e.type==="abstract_method_signature"||k(e,"abstract"),isOptional:X(e),arity:St(e,a),genericTypeParameterNames:b(e)}}function It(e,t){let n=e.childForFieldName("key"),r=e.childForFieldName("value"),a=n&&y.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:X(e),arity:C(r)?B(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=J(e);return r?{kind:"field",name:r,declarationSpan:c(e),owner:t,lexicalScopeSpan:c(n),visibility:Se(e,r),isStatic:!1,isAbstract:!1,isOptional:X(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:$.get(e.type)??"function",name:ge(e),declarationSpan:c(e),owner:A(e.parent),lexicalScopeSpan:S(e),visibility:null,isStatic:!1,isAbstract:!1,isOptional:!1,arity:B(e),genericTypeParameterNames:b(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 kt(e,t){return e.declarationSpan.start-t.declarationSpan.start||e.typeSpan.start-t.typeSpan.start||e.kind.localeCompare(t.kind)}function Bt(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){!$.has(e.type)||Lt(e)&&!Mt(e)||t.declarations.push(Pt(e))}function Vt(e){if(e.type!=="variable_declarator"||e.hasError)return!1;let t=e.childForFieldName("name");if(!t||!y.has(t.type)||A(e.parent).kind!=="program")return!1;let n=e.childForFieldName("value");return!n||!$.has(n.type)}function Yt(e){return e?.type==="lexical_declaration"||e?.type==="variable_declaration"}function Wt(e,t){if(e?.type!=="export_statement"||e.parent?.type!=="program")return!1;let n=e.childForFieldName("declaration");return n?.type===t.type&&n.startIndex===t.startIndex&&n.endIndex===t.endIndex}function jt(e){let t=e.parent;return Yt(t)?Wt(t.parent,t):!1}function Qt(e){if(!Vt(e)||!jt(e))return null;let t=e.childForFieldName("name");if(!t)return null;let n=A(e.parent);return{kind:"unknown",name:t.text,declarationSpan:c(e),owner:n,lexicalScopeSpan:S(e),visibility:null,isStatic:!1,isAbstract:!1,isOptional:!1,arity:null,genericTypeParameterNames:[]}}function Gt(e,t,n,r){Kt(e,t,n,r),Ut(e,r),Ht(e,r);let a=Qt(e);a&&r.declarations.push(a)}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),g={facts:n,declarations:r,ownerInventories:a,q3Classes:i,q3TypeAliases:o,q3NewReceiverBindings:s,visitedOwners:new Set};return z(e,p=>Gt(p,t,l,g)),n.sort(kt),r.sort(Bt),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"]),$t=new Set(["class","class_declaration","abstract_class_declaration","function_expression","function_declaration","generator_function","generator_function_declaration"]),zt=new Set(["function_type","constructor_type","call_signature","construct_signature","index_signature","object_type"]),Z=new Set(["for_statement","for_in_statement","for_of_statement","for_await_statement"]),Jt=new Set(["object_pattern","array_pattern","pair_pattern","assignment_pattern","object_assignment_pattern","rest_pattern"]),Xt=/^[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*$/u;function h(e){return{start:e.startIndex,end:e.endIndex}}function T(e){let t=[];for(let n=0;n<e.namedChildCount;n+=1){let r=e.namedChild(n);r&&t.push(r)}return t}function Zt(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 T(e))W(n,t)}function v(e,t){let n=e;for(;n;){if(t(n))return n;n=n.parent}return null}function en(e){let t=e.childForFieldName("name")??e.childForFieldName("pattern")??e.childForFieldName("declarator");return t?.type==="identifier"?t.text:null}function V(e,t,n){return v(e.parent,t)??n}function tn(e){return e.parent?.text.trimStart().match(/^(var|let|const)\b/)?.[1]}function nn(e,t){if(e.type==="required_parameter"||e.type==="optional_parameter")return V(e,a=>O.has(a.type),t);if(tn(e)==="var")return V(e,a=>O.has(a.type),t);let r=v(e.parent,a=>Z.has(a.type));return r||V(e,a=>a.type==="statement_block",t)}function rn(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 an(e){let t=be(e),n=t?.childForFieldName("name")?.text;return t&&n?{name:n,span:h(t)}:null}function on(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]:Jt.has(e.type)?T(e).flatMap(P):[]}function L(e,t,n,r,a){let i=Y(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 sn(e,t,n){if(v(e.parent,l=>zt.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=>Z.has(l.type)),s=i&&(e.type==="required_parameter"||e.type==="optional_parameter")?"parameter":o?"unsupported":i?"local":"unsupported";L(n,e,nn(e,t),s,a)}function ln(e,t){if(!O.has(e.type))return;let n=e.childForFieldName("parameters"),r=e.childForFieldName("parameter"),a=n?T(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 cn(e,t,n){if(!$t.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:V(e,o=>o.type==="statement_block",t);L(n,r,i,"unsupported",[r.text])}function dn(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 un(e,t){if(!Z.has(e.type))return;let n=e.childForFieldName("left")??e.childForFieldName("initializer");if(!n)return;let r=n.type==="variable_declaration"?T(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 pn(e,t,n){let r=n.get(Y(e))??new Map;for(let[a,i]of fn(t))mn(e,r,a,i);n.set(Y(e),r)}function fn(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 mn(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 Nn(e,t){let n=new Map;return W(e,r=>{(r.type==="required_parameter"||r.type==="optional_parameter"||r.type==="variable_declarator")&&sn(r,e,n),ln(r,n),cn(r,e,n),dn(r,n),un(r,n)}),pn(e,t,n),n}function ee(e,t){return`${e.startIndex}:${t}`}function Y(e){return`${e.type}:${e.startIndex}:${e.endIndex}`}function Ee(e,t,n){e.set(t,e.has(t)?null:n)}function yn(e){return Zt(e).some(t=>t.type==="accessibility_modifier"||t.text==="readonly")}function gn(e,t,n){if(t.type!=="method_definition"||t.childForFieldName("name")?.text!=="constructor")return;let r=t.childForFieldName("parameters");for(let a of r?T(r):[]){let i=en(a);!i||!yn(a)||Ee(n,ee(e,i),{kind:"parameter-property",name:i,declarationSpan:h(a),scopeSpan:h(e)})}}function hn(e,t){let n=e.childForFieldName("body");for(let r of n?T(n):[]){let a=r.childForFieldName("name")?.text,i=a?on(a,e,r):null;i&&Ee(t,ee(e,a),i),gn(e,r,t)}}function _n(e){let t=new Map;return W(e,n=>{De.has(n.type)&&hn(n,t)}),t}function Ce(e,t,n){return`${e}:${t}:${n}`}function xn(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:Nn(e,t),propertiesByClassAndName:_n(e)}}function Fn(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(ee(r,a[1]))??null:null}function An(e,t,n){if(!e)return null;let r=Fn(e,t,n);if(r!==void 0)return r;if(!Xt.test(e))return null;let a=Re(e,t,n);return a?Sn(e,a):null}function Re(e,t,n){let r=t;for(;r;){let a=n.bindingsByScope.get(Y(r))?.get(e);if(a)return a;r=r.parent}}function Sn(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 Tn(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 In(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 Dn(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 bn(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 En(e){return!!e.calleeName&&e.calleeKind!=="computed"}function Cn(e,t,n,r){let a=t.childForFieldName("arguments"),i=a?T(a).filter(I=>I.type!=="comment"):[],o=i.some(I=>I.type==="spread_element"),s=rn(t,n),l=An(e.receiverText,t,r),d=Tn(e,t,r),g=t.childForFieldName("arguments")?.startIndex,p=t.text.slice(0,g===void 0?t.text.length:g-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:an(t),argumentCount:o?null:i.length,hasSpreadArgument:o,argumentKinds:i.map(In)};return{fact:m,peerKey:Dn(m.lexicalScopeSpan,l)}}function Rn(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=xn(e,r),i=n.flatMap(l=>{if(!En(l))return[];let d=bn(l,a);return d?[Cn(l,d,e,a)]:[]}),o=new Map;for(let{fact:l,peerKey:d}of i)Rn(o,l,d);let s=i.map(({fact:l,peerKey:d})=>({...l,peerMemberNames:[...d?o.get(d)??[]:[]].filter(g=>g!==l.calleeName).sort()}));return{schemaVersion:2,language:t,callSites:s}}import{createHash as On}from"crypto";var vn=new Set([N.VARIABLE_DECLARATOR,N.ASSIGNMENT_EXPRESSION,N.PAIR,N.PUBLIC_FIELD_DEFINITION]),Pn=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 te(e){return On(le).update(e.text).digest("hex")}function ne(e){return e.childForFieldName("name")?.text||e.descendantsOfType(u.IDENTIFIER)[0]?.text||f.ANONYMOUS_NAME}function Ln(e){return e.childForFieldName("declarator")?.childForFieldName("declarator")}function Mn(e){let t=e.childForFieldName("name");if(t)return{name:t.text,nameNode:t};let n=Ln(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 kn(e){let t=e.parent;for(;t;){if(t.type===N.ARGUMENTS||Pn.has(t.type))return;if(vn.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 Mn(e)??kn(e)??{name:f.ANONYMOUS_NAME,nameNode:void 0}}function Bn(e){return Oe(e).name}function E(e,t){let n=e.parent;for(;n;){if(t.has(n.id))return ne(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 Kn(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 Un(e){let n=e.childForFieldName("receiver")?.namedChild(0)?.childForFieldName("type");return n?ve(n):void 0}function Hn(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 Vn(e){return Kn(e)??Un(e)??Hn(e)}function Pe(e,t,n){let r=t.extractClasses(e.rootNode);for(let a of r)n.push({name:ne(a),startLine:a.startPosition.row,endLine:a.endPosition.row,methods:[],contentHash:te(a)});return r}var Yn=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&&Yn.has(o.type)||(a.push(i),n.push({name:ne(i),startLine:i.startPosition.row,endLine:i.endPosition.row,contentHash:te(i)}))}return a}function re(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=E(o,a),l=s===f.ANONYMOUS_NAME?Vn(o):s;n.push({name:Oe(o).name,startLine:o.startPosition.row,endLine:o.endPosition.row,declarationSpan:{start:o.startIndex,end:o.endIndex},contentHash:te(o),containerName:l})}return i}var ie=new se(e=>Q?.postMessage(e));process.on("uncaughtException",e=>{ie.error(f.WORKER_UNCAUGHT_EXCEPTION,{error:e instanceof Error?e.message:String(e)})});process.on("unhandledRejection",e=>{ie.error(f.WORKER_UNHANDLED_REJECTION,{error:e instanceof Error?e.message:String(e)})});var Me=!1,ke=null;function jn(){return ke??=ue(),ke}var Be=new Map;function Qn(e){let t=Be.get(e);return t||(t=Wn.load(e),Be.set(e,t)),t}function Gn(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 qn(e){return e.childForFieldName("function")||e.childForFieldName("expression")||e.childForFieldName("type")||e.childForFieldName("name")||e.childForFieldName("method")||e}function $n(e){let t=qn(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(!zn.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 zn=new Set(["identifier","property_identifier","field_identifier","shorthand_property_identifier","attribute"]);function Jn(e){return((e.childForFieldName("property")||e.childForFieldName("field")||e.childForFieldName("attribute")||e.childForFieldName("name")||e.childForFieldName("method"))??e).startPosition}function Xn(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=Jn(o),l=$n(o);r.push({sourceFunction:E(o,a),targetFunction:l.targetFunction,startLine:s.row,startColumn:s.column,calleeName:l.calleeName,receiverText:l.receiverText,calleeKind:l.calleeKind})}}function Zn(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:E(i,a),targetInterface:i.text})}function er(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:E(i,a),targetClass:i.text})}var tr=new Set([F.TYPESCRIPT,F.JAVASCRIPT]),nr="Worker",rr="path",ar="resolve",ir="join",or="__dirname";function sr(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===rr&&(r===ar||r===ir)}function lr(e){let t=e.childForFieldName("arguments");return!t||!t.namedChildren.some(a=>a?.type==="identifier"&&a.text===or)?void 0:t.descendantsOfType("string")[0]?.text.replace(/['"]/g,"")}function cr(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||!sr(a))continue;let i=lr(a);if(i)return i}}function dr(e,t){if(t.type==="string")return t.text.replace(/['"]/g,"");if(t.type==="identifier"||t.type==="member_expression")return cr(e,t.text)}function ur(e,t,n,r){if(!tr.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!==nr)continue;let l=i.childForFieldName("arguments")?.namedChildren.find(g=>g!==null);if(!l)continue;let d=dr(e,l);d&&r.push({sourceFunction:E(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 pr(e){let t=[];for(let n of He(e))t.push(...fr(n));return t}function fr(e){if(e.type!=="export_statement")return[];if(/^export\s+default\b/u.test(e.text))return[mr(e)];let t=e.childForFieldName("declaration");return t?Nr(t):[]}function mr(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 Nr(e){let t=yr(e);if(t)return[t];let n=gr(e);return n?[n]:e.type!=="lexical_declaration"&&e.type!=="variable_declaration"?[]:hr(e)}function yr(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 gr(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 hr(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 _r(e,t,n){let r=[],a=[],i=[],o,s=[],l=[],d=[],g=[],p=[],m=[],I=[];if(e){r.push(f.parsedViaTreeSitter(e.rootNode.childCount));try{i.push(...pr(e.rootNode)),(n===F.TYPESCRIPT||n===F.JAVASCRIPT)&&(o=de(e.rootNode));let x=Pe(e,t,l),oe=re(e,t,s,x),Ve=t.extractImports(e.rootNode);a.push(...ce(Ve)),Le(e,t,d),Xn(e,t,oe,g),Zn(e,t,x,p),er(e,t,x,m),ur(e,n,oe,I),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:g,implements:p,extends:m,workerSpawns:I,decisions:r}}function xr(e,t){for(let n of e.drainQueryCompileFailures?.()??[])ie.error(f.QUERY_COMPILE_FAILED,{language:t,kind:n.kind,pattern:n.pattern,message:n.message})}function Fr(e,t,n,r,a){let i=new Ke;i.setLanguage(n),t.initQueries?.(n),xr(t,r);let o=i.parse(e),s=_r(o,t,r),l=Ar(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 Ar(e,t){if(e===F.TYPESCRIPT)return ae.extname(t).toLowerCase()===".tsx"?"tsx":"typescript";if(e===F.JAVASCRIPT)return"javascript"}async function Sr(e){Me||(await Ke.init(),Me=!0);let t=await jn(),n=ae.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}=pe(r.wasm_file);if(!Ue.existsSync(a))return{taskId:e.taskId,success:!0,data:{imports:Gn(e.code),exports:[],functions:[],classes:[],calls:[],decisions:[f.wasmNotFound(e.language,i.join(", "))]}};let o=await Qn(a),s=Fr(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 Sr(e);Q?.postMessage(t)}catch(t){Q?.postMessage({taskId:e.taskId,success:!1,error:t.stack||String(t)})}});export{Sr as buildParseResponse,re as collectFunctionNodes,ur as collectWorkerSpawns,$n as getCalleeEvidence,xr as reportQueryCompileFailures,Bn as resolveCallableName,pe as resolveWasmPath};
3
3
  //# sourceMappingURL=ast-worker.js.map
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{Ga as P,Ka as d,Qa as Y,Ra as B,Sa as G,Ta as H,Ua as Q,Va as V,Wa as j,Xa as W,Ya as q,Za as J,_a as K}from"./chunk-2OLMINDD.js";var z="anonymous";var Jt="AstWorkerCrashError",Kt={ARGUMENTS:"arguments",VARIABLE_DECLARATOR:"variable_declarator",ASSIGNMENT_EXPRESSION:"assignment_expression",PAIR:"pair",PUBLIC_FIELD_DEFINITION:"public_field_definition",IMPL_ITEM:"impl_item",TYPE_IDENTIFIER:"type_identifier",POINTER_TYPE:"pointer_type",QUALIFIED_IDENTIFIER:"qualified_identifier"},zt={PARSE_FAILURE_NO_DETAIL:"parse returned success=false with no error detail",PARSE_FAILURE_RESULT:"AST parse returned failure result",PARSE_THREW:"AST parse threw (worker crash or rejection)",WORKER_UNCAUGHT_EXCEPTION:"AST worker uncaughtException",QUERY_COMPILE_FAILED:"AST language query failed to compile; using fallback",WORKER_UNHANDLED_REJECTION:"AST worker unhandledRejection",WORKER_EXITED_DURING_SHUTDOWN:"AST worker exited during pool shutdown (expected)",WORKER_CRASHED_EXITED:"AST worker crashed/exited",WORKER_EXITED_UNEXPECTEDLY:"Worker exited unexpectedly",POOL_TERMINATED:"AST worker pool terminated before task completion",UNKNOWN_FILE:"(unknown file)",PARSE_CACHE_HIT:"AST parse cache hit",CACHE_METRICS_AND_QUEUE_PERFORMANCE:"AST cache metrics and queue performance",TASK_TIMED_OUT_TERMINATING:"AST worker task timed out \u2014 terminating stuck worker",WORKER_TERMINATE_FAILED:"AST worker terminate() rejected \u2014 forced termination did not complete",QUERIED_VIA_LANGUAGE_PROVIDER:"Queried nodes using @workspace/ast-core LanguageProvider",ANONYMOUS_NAME:z,workerCrashWhileParsing:t=>`AST worker crashed while parsing ${t}: `,taskTimedOutAfterMs:(t,e)=>`AST worker task ${t} timed out after ${e}ms`,workerExitedWithCode:t=>`Worker exited with code ${t}`,noLanguageProviderForExtension:t=>`No language provider registered for extension ${t}`,wasmNotFound:(t,e)=>`WASM not found for ${t}, AST parsing skipped (Regex fallback used). Tried paths: ${e}`,parsedViaTreeSitter:t=>`Parsed via web-tree-sitter (nodes: ${t})`,providerQueryFailed:t=>`ast-core provider query failed: ${t}`};var A={FILE:"file",CLASS:"class",FUNCTION:"function",CALL:"call",METHOD_CALL:"method_call",IMPORT:"import",API_CONTRACT:"api_contract"};var l={IDENTIFIER:"identifier",SCOPED_IDENTIFIER:"scoped_identifier",QUALIFIED_IDENTIFIER:"qualified_identifier",DOTTED_NAME:"dotted_name",ALIASED_IMPORT:"aliased_import",USE_AS_CLAUSE:"use_as_clause",USE_WILDCARD:"use_wildcard",SCOPED_USE_LIST:"scoped_use_list",USE_LIST:"use_list",DOT:"dot",BLANK_IDENTIFIER:"blank_identifier",NAMESPACE_USE_DECLARATION:"namespace_use_declaration",INCLUDE_EXPRESSION:"include_expression",INCLUDE_ONCE_EXPRESSION:"include_once_expression",REQUIRE_EXPRESSION:"require_expression",REQUIRE_ONCE_EXPRESSION:"require_once_expression",IMPORT_STATEMENT:"import_statement",IMPORT_FROM_STATEMENT:"import_from_statement",USE_DECLARATION:"use_declaration",IMPORT_DECLARATION:"import_declaration",PREPROC_INCLUDE:"preproc_include",USING_DECLARATION:"using_declaration",CALL:"call",USING_DIRECTIVE:"using_directive",CALL_EXPRESSION:"call_expression",METHOD_INVOCATION:"method_invocation",EXPLICIT_CONSTRUCTOR_INVOCATION:"explicit_constructor_invocation",COMMAND_CALL:"command_call",FUNCTION_CALL_EXPRESSION:"function_call_expression",MEMBER_CALL_EXPRESSION:"member_call_expression",SCOPED_CALL_EXPRESSION:"scoped_call_expression",INVOCATION_EXPRESSION:"invocation_expression",OBJECT_CREATION_EXPRESSION:"object_creation_expression",MEMBER_EXPRESSION:"member_expression",ATTRIBUTE:"attribute",MEMBER_ACCESS_EXPRESSION:"member_access_expression",VARIABLE_DECLARATION:"variable_declaration",LEXICAL_DECLARATION:"lexical_declaration",VARIABLE_DECLARATOR:"variable_declarator",ARROW_FUNCTION:"arrow_function",FUNCTION_DECLARATION:"function_declaration",METHOD_DEFINITION:"method_definition",CLASS_DECLARATION:"class_declaration",INTERFACE_DECLARATION:"interface_declaration",TYPE_ALIAS_DECLARATION:"type_alias_declaration",EXPORT_STATEMENT:"export_statement"};var T="*",pe=["require","require_relative","load"],Z="this",Ae="new";function on(t){let e=[];for(let n of t){let o=n.type,i=Ce[o];if(i){i(n,e);continue}if(ze(o)){tt(n,o,e);continue}rt(n,e)}return e}var Ce={[l.IMPORT_STATEMENT]:Oe,[l.EXPORT_STATEMENT]:xe,[l.IMPORT_FROM_STATEMENT]:Xe,[l.USE_DECLARATION]:Ve,[l.IMPORT_DECLARATION]:We,[l.PREPROC_INCLUDE]:qe,[l.USING_DECLARATION]:Je,[l.CALL]:Ke,[l.USING_DIRECTIVE]:nt};function Oe(t,e){let n=t.descendantsOfType("string").pop();if(!n)return;let o=n.text.replace(/['"]/g,""),i=/^import\s+type\b/u.test(t.text.trimStart());if(!Se(t,o,i,e)){if(Re(t,o,i,e)){he(t,o,i,e);return}ge(t,o,i,e)}}function Se(t,e,n,o){let i=t.descendantsOfType("namespace_import")[0];if(!i)return!1;let s=i.descendantsOfType("identifier")[0];return s&&o.push({localName:s.text,originalName:T,modulePath:e,...n?{isTypeOnly:!0}:{}}),!0}function Re(t,e,n,o){let i=t.descendantsOfType("named_imports")[0];if(!i)return!1;for(let s of i.descendantsOfType("import_specifier"))s&&Le(s,e,n,o);return!0}function Le(t,e,n,o){let i=t.childForFieldName("name");if(!i)return;let s=t.childForFieldName("alias"),a=i.text;o.push({localName:s?s.text:a,originalName:a,modulePath:e,...n||/^type\s/u.test(t.text.trimStart())?{isTypeOnly:!0}:{}})}function he(t,e,n,o){let i=De(t);!i||!Pe(t)||!Fe(t)||o.push({localName:i,originalName:"default",modulePath:e,isCombinedDefaultImport:!0,...n?{isTypeOnly:!0}:{}})}function De(t){let o=(t.descendantsOfType("import_clause")[0]?.namedChildren??[]).filter(s=>s!==null).find(s=>s.type==="identifier"),i=t.text.trimStart().match(/^import\s+(?:type\s+)?([$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*)\s*,\s*\{/u)?.[1];return o?.text??i}function Pe(t){return(t.descendantsOfType("import_clause")[0]?.namedChildren??[]).some(o=>o?.type==="named_imports")?!0:/^import\s+(?:type\s+)?[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*\s*,\s*\{/u.test(t.text.trimStart())}function Fe(t){return!!t.descendantsOfType("named_imports")[0]?.descendantsOfType("import_specifier").length}function ge(t,e,n,o){let i=t.descendantsOfType("identifier")[0];i&&o.push({localName:i.text,originalName:T,modulePath:e,isDefaultImport:!0,...n?{isTypeOnly:!0}:{}})}function xe(t,e){let n=t.childForFieldName("source");if(!n)return;let o=n.text.replace(/['"]/g,""),i=t.descendantsOfType("export_clause")[0];if(i)for(let s of i.descendantsOfType("export_specifier")){if(!s)continue;let a=s.childForFieldName("name");if(!a)continue;let E=s.childForFieldName("alias");e.push({localName:E?E.text:a.text,originalName:a.text,modulePath:o,viaReexport:!0})}}function $e(t){let e=t.childForFieldName("source");return e?e.text.replace(/^['"]|['"]$/gu,""):void 0}function w(t,e){return/^export\s+type\b/u.test(t.text.trimStart())||e!==void 0&&/^type(?:\s|$)/u.test(e.text.trimStart())}function ye(t,e,n){let o=n.childForFieldName("name");if(!o)return null;let i=n.childForFieldName("alias"),s=w(t,n),a=i?.text??o.text;return e!==void 0?{kind:"named",exportedName:a,importedName:o.text,modulePath:e,...s?{isTypeOnly:!0}:{}}:{kind:"local",exportedName:a,localName:o.text,...s?{isTypeOnly:!0}:{}}}function Me(t,e){let n=t.descendantsOfType("export_clause")[0];return n?n.descendantsOfType("export_specifier").flatMap(o=>{if(!o)return[];let i=ye(t,e,o);return i?[i]:[]}):null}function Ue(t,e){let n=t.text.trimStart().match(/^export\s+(?:type\s+)?\*\s+as\s+([$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*)/u)?.[1];return n?{kind:"namespace",exportedName:n,modulePath:e,...w(t)?{isTypeOnly:!0}:{}}:null}function we(t,e){return/^export\s+(?:type\s+)?\*\s+from\b/u.test(t.text.trimStart())?{kind:"star",exportedName:"*",modulePath:e,...w(t)?{isTypeOnly:!0}:{}}:null}function be(t){let e=$e(t),n=Me(t,e);if(n)return n;if(e===void 0)return[];let o=Ue(t,e);if(o)return[o];let i=we(t,e);return i?[i]:[]}function sn(t){let e=[];for(let n of t.namedChildren)n?.type===l.EXPORT_STATEMENT&&e.push(...be(n));return e}function Xe(t,e){let n=t.childForFieldName("module_name");if(!n)return;let o=n.text;if(t.descendantsOfType("wildcard_import")[0])return;t.childForFieldName("name")&&ot(t,o,e)}function ve(t,e){let n=t.childForFieldName("path"),o=t.childForFieldName("alias");n&&o&&e.push({localName:o.text,originalName:T,modulePath:n.text})}function ke(t,e,n){let o=t.childForFieldName("path"),i=t.childForFieldName("alias");o&&i&&n.push({localName:i.text,originalName:T,modulePath:`${e}::${o.text}`})}function Ye(t,e,n){let o=t.descendantsOfType("identifier").pop();o&&n.push({localName:o.text,originalName:T,modulePath:`${e}::${t.text}`})}function Be(t,e,n){if(t.type===l.USE_AS_CLAUSE){ke(t,e,n);return}if(t.type===l.IDENTIFIER){n.push({localName:t.text,originalName:T,modulePath:`${e}::${t.text}`});return}t.type===l.SCOPED_IDENTIFIER&&Ye(t,e,n)}function Ge(t,e){let n=t.childForFieldName("path"),o=t.childForFieldName("list");if(!n||!o)return;let i=n.text;for(let s of o.namedChildren)s&&Be(s,i,e)}function He(t,e){let n=t.descendantsOfType("identifier"),o=n[n.length-1];o&&e.push({localName:o.text,originalName:T,modulePath:t.text})}function Qe(t,e){for(let n of t.namedChildren)n&&n.type===l.IDENTIFIER&&e.push({localName:n.text,originalName:T,modulePath:n.text})}function Ve(t,e){let n=t.childForFieldName("argument");if(n){if(n.type===l.USE_AS_CLAUSE){ve(n,e);return}if(n.type!==l.USE_WILDCARD){if(n.type===l.SCOPED_USE_LIST){Ge(n,e);return}if(n.type===l.SCOPED_IDENTIFIER||n.type===l.IDENTIFIER){He(n,e);return}n.type===l.USE_LIST&&Qe(n,e)}}}function je(t,e){let n=t.childForFieldName("path");if(!n)return;let o=n.text.replace(/['"]/g,""),i=t.childForFieldName("name");if(i){if(i.type===l.DOT||i.type===l.BLANK_IDENTIFIER)return;e.push({localName:i.text,originalName:T,modulePath:o})}else{let s=o.split("/"),a=s[s.length-1];e.push({localName:a,originalName:T,modulePath:o})}}function We(t,e){let n=t.descendantsOfType("import_spec_list")[0];if(!n)return;let o=n.descendantsOfType("import_spec");for(let i of o)i&&je(i,e)}function qe(t,e){let n=t.childForFieldName("path");if(n){let o=n.text.replace(/[<>"']/g,"");e.push({localName:o,originalName:T,modulePath:o})}}function Je(t,e){let n=t.namedChildren;for(let o of n)if(o)if(o.type===l.QUALIFIED_IDENTIFIER){let i=o.descendantsOfType("identifier"),s=i[i.length-1];s&&e.push({localName:s.text,originalName:T,modulePath:o.text})}else o.type===l.IDENTIFIER&&e.push({localName:o.text,originalName:T,modulePath:o.text})}function Ke(t,e){let n=t.childForFieldName("method");if(!n)return;let o=n.text;if(!pe.includes(o))return;let i=t.childForFieldName("arguments");if(!i)return;let s=i.descendantsOfType("string_content")[0]||i.descendantsOfType("string")[0];if(!s)return;let a=s.text.replace(/['"]/g,""),E=a.replace(/\.rb$/,"");e.push({localName:E,originalName:T,modulePath:a})}function ze(t){return t===l.NAMESPACE_USE_DECLARATION||t===l.INCLUDE_EXPRESSION||t===l.INCLUDE_ONCE_EXPRESSION||t===l.REQUIRE_EXPRESSION||t===l.REQUIRE_ONCE_EXPRESSION}function Ze(t,e){let n=t.descendantsOfType("qualified_name")[0]||t.descendantsOfType("name")[0];if(n){let o=n.text,i=o.split("\\"),s=i[i.length-1];e.push({localName:s,originalName:T,modulePath:o})}}function et(t,e){let n=t.descendantsOfType("string")[0]||t.descendantsOfType("string_content")[0];if(n){let o=n.text.replace(/['"]/g,"");e.push({localName:o,originalName:T,modulePath:o})}}function tt(t,e,n){e===l.NAMESPACE_USE_DECLARATION?Ze(t,n):et(t,n)}function nt(t,e){let n=t.descendantsOfType("qualified_name")[0]||t.descendantsOfType("identifier")[0];if(n){let o=n.text,i=o.split("."),s=i[i.length-1];e.push({localName:s,originalName:T,modulePath:o})}}function rt(t,e){let n=t.descendantsOfType("string").pop();if(!n)return;let o=n.text.replace(/['"]/g,""),i=t.descendantsOfType("identifier");for(let s of i)s&&(e.some(a=>a.localName===s.text)||e.push({localName:s.text,originalName:s.text,modulePath:o}))}function ot(t,e,n){if(t.childForFieldName("name")){for(let i of t.namedChildren)if(i)if(i.type===l.ALIASED_IMPORT){let s=i.childForFieldName("name"),a=i.childForFieldName("alias");s&&a&&n.push({localName:a.text,originalName:s.text,modulePath:e})}else if(i.type===l.DOTTED_NAME){let s=i.descendantsOfType("identifier"),a=s[s.length-1];a&&n.push({localName:a.text,originalName:i.text,modulePath:e})}else i.type===l.IDENTIFIER&&n.push({localName:i.text,originalName:i.text,modulePath:e})}}function it(t){let e=t.childForFieldName("function");if(!e)return{isMethodCall:!1,methodName:""};if(e.type===l.MEMBER_EXPRESSION){let n=e.childForFieldName("property"),o=e.childForFieldName("object");if(n)return{isMethodCall:!0,methodName:n.text,objectName:o?.text}}return{isMethodCall:!1,methodName:e.text}}function st(t){let e=t.childForFieldName("function");if(!e)return{isMethodCall:!1,methodName:""};if(e.type===l.ATTRIBUTE){let n=e.childForFieldName("attribute"),o=e.childForFieldName("object");if(n)return{isMethodCall:!0,methodName:n.text,objectName:o?.text}}return{isMethodCall:!1,methodName:e.text}}function at(t){let e=t.childForFieldName("name"),n=t.childForFieldName("object");if(e)return{isMethodCall:!0,methodName:e.text,objectName:n?.text}}function ct(t){return{isMethodCall:!0,methodName:t.childForFieldName("constructor")?.text||Z,objectName:Z}}function lt(t){let e=t.childForFieldName("method");if(!e)return;let n=t.childForFieldName("receiver");return n?{isMethodCall:!0,methodName:e.text,objectName:n.text}:{isMethodCall:!1,methodName:e.text}}function U(t){let e=t.type,o=t.childForFieldName("name")?.text||"";if(e===l.MEMBER_CALL_EXPRESSION){let i=t.childForFieldName("object");return{isMethodCall:!0,methodName:o,objectName:i?.text}}if(e===l.SCOPED_CALL_EXPRESSION){let i=t.childForFieldName("scope");return{isMethodCall:!0,methodName:o,objectName:i?.text}}return{isMethodCall:!1,methodName:o}}function Et(t){let e=t.childForFieldName("function")||t.namedChildren[0];if(e&&e.type===l.MEMBER_ACCESS_EXPRESSION){let n=e.childForFieldName("name"),o=e.childForFieldName("expression");if(n)return{isMethodCall:!0,methodName:n.text,objectName:o?.text}}if(e)return{isMethodCall:!1,methodName:e.text}}function Nt(t){let e=t.childForFieldName("type");return{isMethodCall:!0,methodName:Ae,objectName:e?.text}}var an={[l.CALL_EXPRESSION]:it,[l.CALL]:st,[l.METHOD_INVOCATION]:at,[l.EXPLICIT_CONSTRUCTOR_INVOCATION]:ct,[l.COMMAND_CALL]:lt,[l.FUNCTION_CALL_EXPRESSION]:U,[l.MEMBER_CALL_EXPRESSION]:U,[l.SCOPED_CALL_EXPRESSION]:U,[l.INVOCATION_EXPRESSION]:Et,[l.OBJECT_CREATION_EXPRESSION]:Nt};var It=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,L=class t extends Date{#t=!1;#n=!1;#e=null;constructor(e){let n=!0,o=!0,i="Z";if(typeof e=="string"){let s=e.match(It);s?(s[1]||(n=!1,e=`0000-01-01T${e}`),o=!!s[2],o&&e[10]===" "&&(e=e.replace(" ","T")),s[2]&&+s[2]>23?e="":(i=s[3]||null,e=e.toUpperCase(),!i&&o&&(e+="Z"))):e=""}super(e),isNaN(this.getTime())||(this.#t=n,this.#n=o,this.#e=i)}isDateTime(){return this.#t&&this.#n}isLocal(){return!this.#t||!this.#n||!this.#e}isDate(){return this.#t&&!this.#n}isTime(){return this.#n&&!this.#t}isValid(){return this.#t||this.#n}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#e===null)return e.slice(0,-1);if(this.#e==="Z")return e;let n=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return n=this.#e[0]==="-"?n:-n,new Date(this.getTime()-n*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(e,n="Z"){let o=new t(e);return o.#e=n,o}static wrapAsLocalDateTime(e){let n=new t(e);return n.#e=null,n}static wrapAsLocalDate(e){let n=new t(e);return n.#n=!1,n.#e=null,n}static wrapAsLocalTime(e){let n=new t(e);return n.#t=!1,n.#e=null,n}};function ft(t,e){let n=t.slice(0,e).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function ut(t,e,n){let o=t.split(/\r\n|\n|\r/g),i="",s=(Math.log10(e+1)|0)+1;for(let a=e-1;a<=e+1;a++){let E=o[a-1];E&&(i+=a.toString().padEnd(s," "),i+=": ",i+=E,i+=`
2
+ import{$a as J,Ia as P,Ma as d,Sa as Y,Ta as B,Ua as G,Va as H,Wa as Q,Xa as V,Ya as j,Za as W,_a as q,ab as K}from"./chunk-UUYEPLGA.js";var z="anonymous";var Jt="AstWorkerCrashError",Kt={ARGUMENTS:"arguments",VARIABLE_DECLARATOR:"variable_declarator",ASSIGNMENT_EXPRESSION:"assignment_expression",PAIR:"pair",PUBLIC_FIELD_DEFINITION:"public_field_definition",IMPL_ITEM:"impl_item",TYPE_IDENTIFIER:"type_identifier",POINTER_TYPE:"pointer_type",QUALIFIED_IDENTIFIER:"qualified_identifier"},zt={PARSE_FAILURE_NO_DETAIL:"parse returned success=false with no error detail",PARSE_FAILURE_RESULT:"AST parse returned failure result",PARSE_THREW:"AST parse threw (worker crash or rejection)",WORKER_UNCAUGHT_EXCEPTION:"AST worker uncaughtException",QUERY_COMPILE_FAILED:"AST language query failed to compile; using fallback",WORKER_UNHANDLED_REJECTION:"AST worker unhandledRejection",WORKER_EXITED_DURING_SHUTDOWN:"AST worker exited during pool shutdown (expected)",WORKER_CRASHED_EXITED:"AST worker crashed/exited",WORKER_EXITED_UNEXPECTEDLY:"Worker exited unexpectedly",POOL_TERMINATED:"AST worker pool terminated before task completion",UNKNOWN_FILE:"(unknown file)",PARSE_CACHE_HIT:"AST parse cache hit",CACHE_METRICS_AND_QUEUE_PERFORMANCE:"AST cache metrics and queue performance",TASK_TIMED_OUT_TERMINATING:"AST worker task timed out \u2014 terminating stuck worker",WORKER_TERMINATE_FAILED:"AST worker terminate() rejected \u2014 forced termination did not complete",QUERIED_VIA_LANGUAGE_PROVIDER:"Queried nodes using @workspace/ast-core LanguageProvider",ANONYMOUS_NAME:z,workerCrashWhileParsing:t=>`AST worker crashed while parsing ${t}: `,taskTimedOutAfterMs:(t,e)=>`AST worker task ${t} timed out after ${e}ms`,workerExitedWithCode:t=>`Worker exited with code ${t}`,noLanguageProviderForExtension:t=>`No language provider registered for extension ${t}`,wasmNotFound:(t,e)=>`WASM not found for ${t}, AST parsing skipped (Regex fallback used). Tried paths: ${e}`,parsedViaTreeSitter:t=>`Parsed via web-tree-sitter (nodes: ${t})`,providerQueryFailed:t=>`ast-core provider query failed: ${t}`};var A={FILE:"file",CLASS:"class",FUNCTION:"function",CALL:"call",METHOD_CALL:"method_call",IMPORT:"import",API_CONTRACT:"api_contract"};var l={IDENTIFIER:"identifier",SCOPED_IDENTIFIER:"scoped_identifier",QUALIFIED_IDENTIFIER:"qualified_identifier",DOTTED_NAME:"dotted_name",ALIASED_IMPORT:"aliased_import",USE_AS_CLAUSE:"use_as_clause",USE_WILDCARD:"use_wildcard",SCOPED_USE_LIST:"scoped_use_list",USE_LIST:"use_list",DOT:"dot",BLANK_IDENTIFIER:"blank_identifier",NAMESPACE_USE_DECLARATION:"namespace_use_declaration",INCLUDE_EXPRESSION:"include_expression",INCLUDE_ONCE_EXPRESSION:"include_once_expression",REQUIRE_EXPRESSION:"require_expression",REQUIRE_ONCE_EXPRESSION:"require_once_expression",IMPORT_STATEMENT:"import_statement",IMPORT_FROM_STATEMENT:"import_from_statement",USE_DECLARATION:"use_declaration",IMPORT_DECLARATION:"import_declaration",PREPROC_INCLUDE:"preproc_include",USING_DECLARATION:"using_declaration",CALL:"call",USING_DIRECTIVE:"using_directive",CALL_EXPRESSION:"call_expression",METHOD_INVOCATION:"method_invocation",EXPLICIT_CONSTRUCTOR_INVOCATION:"explicit_constructor_invocation",COMMAND_CALL:"command_call",FUNCTION_CALL_EXPRESSION:"function_call_expression",MEMBER_CALL_EXPRESSION:"member_call_expression",SCOPED_CALL_EXPRESSION:"scoped_call_expression",INVOCATION_EXPRESSION:"invocation_expression",OBJECT_CREATION_EXPRESSION:"object_creation_expression",MEMBER_EXPRESSION:"member_expression",ATTRIBUTE:"attribute",MEMBER_ACCESS_EXPRESSION:"member_access_expression",VARIABLE_DECLARATION:"variable_declaration",LEXICAL_DECLARATION:"lexical_declaration",VARIABLE_DECLARATOR:"variable_declarator",ARROW_FUNCTION:"arrow_function",FUNCTION_DECLARATION:"function_declaration",METHOD_DEFINITION:"method_definition",CLASS_DECLARATION:"class_declaration",INTERFACE_DECLARATION:"interface_declaration",TYPE_ALIAS_DECLARATION:"type_alias_declaration",EXPORT_STATEMENT:"export_statement"};var T="*",pe=["require","require_relative","load"],Z="this",Ae="new";function on(t){let e=[];for(let n of t){let o=n.type,i=Ce[o];if(i){i(n,e);continue}if(ze(o)){tt(n,o,e);continue}rt(n,e)}return e}var Ce={[l.IMPORT_STATEMENT]:Oe,[l.EXPORT_STATEMENT]:xe,[l.IMPORT_FROM_STATEMENT]:Xe,[l.USE_DECLARATION]:Ve,[l.IMPORT_DECLARATION]:We,[l.PREPROC_INCLUDE]:qe,[l.USING_DECLARATION]:Je,[l.CALL]:Ke,[l.USING_DIRECTIVE]:nt};function Oe(t,e){let n=t.descendantsOfType("string").pop();if(!n)return;let o=n.text.replace(/['"]/g,""),i=/^import\s+type\b/u.test(t.text.trimStart());if(!Se(t,o,i,e)){if(Re(t,o,i,e)){he(t,o,i,e);return}ge(t,o,i,e)}}function Se(t,e,n,o){let i=t.descendantsOfType("namespace_import")[0];if(!i)return!1;let s=i.descendantsOfType("identifier")[0];return s&&o.push({localName:s.text,originalName:T,modulePath:e,...n?{isTypeOnly:!0}:{}}),!0}function Re(t,e,n,o){let i=t.descendantsOfType("named_imports")[0];if(!i)return!1;for(let s of i.descendantsOfType("import_specifier"))s&&Le(s,e,n,o);return!0}function Le(t,e,n,o){let i=t.childForFieldName("name");if(!i)return;let s=t.childForFieldName("alias"),a=i.text;o.push({localName:s?s.text:a,originalName:a,modulePath:e,...n||/^type\s/u.test(t.text.trimStart())?{isTypeOnly:!0}:{}})}function he(t,e,n,o){let i=De(t);!i||!Pe(t)||!Fe(t)||o.push({localName:i,originalName:"default",modulePath:e,isCombinedDefaultImport:!0,...n?{isTypeOnly:!0}:{}})}function De(t){let o=(t.descendantsOfType("import_clause")[0]?.namedChildren??[]).filter(s=>s!==null).find(s=>s.type==="identifier"),i=t.text.trimStart().match(/^import\s+(?:type\s+)?([$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*)\s*,\s*\{/u)?.[1];return o?.text??i}function Pe(t){return(t.descendantsOfType("import_clause")[0]?.namedChildren??[]).some(o=>o?.type==="named_imports")?!0:/^import\s+(?:type\s+)?[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*\s*,\s*\{/u.test(t.text.trimStart())}function Fe(t){return!!t.descendantsOfType("named_imports")[0]?.descendantsOfType("import_specifier").length}function ge(t,e,n,o){let i=t.descendantsOfType("identifier")[0];i&&o.push({localName:i.text,originalName:T,modulePath:e,isDefaultImport:!0,...n?{isTypeOnly:!0}:{}})}function xe(t,e){let n=t.childForFieldName("source");if(!n)return;let o=n.text.replace(/['"]/g,""),i=t.descendantsOfType("export_clause")[0];if(i)for(let s of i.descendantsOfType("export_specifier")){if(!s)continue;let a=s.childForFieldName("name");if(!a)continue;let E=s.childForFieldName("alias");e.push({localName:E?E.text:a.text,originalName:a.text,modulePath:o,viaReexport:!0})}}function $e(t){let e=t.childForFieldName("source");return e?e.text.replace(/^['"]|['"]$/gu,""):void 0}function w(t,e){return/^export\s+type\b/u.test(t.text.trimStart())||e!==void 0&&/^type(?:\s|$)/u.test(e.text.trimStart())}function ye(t,e,n){let o=n.childForFieldName("name");if(!o)return null;let i=n.childForFieldName("alias"),s=w(t,n),a=i?.text??o.text;return e!==void 0?{kind:"named",exportedName:a,importedName:o.text,modulePath:e,...s?{isTypeOnly:!0}:{}}:{kind:"local",exportedName:a,localName:o.text,...s?{isTypeOnly:!0}:{}}}function Me(t,e){let n=t.descendantsOfType("export_clause")[0];return n?n.descendantsOfType("export_specifier").flatMap(o=>{if(!o)return[];let i=ye(t,e,o);return i?[i]:[]}):null}function Ue(t,e){let n=t.text.trimStart().match(/^export\s+(?:type\s+)?\*\s+as\s+([$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*)/u)?.[1];return n?{kind:"namespace",exportedName:n,modulePath:e,...w(t)?{isTypeOnly:!0}:{}}:null}function we(t,e){return/^export\s+(?:type\s+)?\*\s+from\b/u.test(t.text.trimStart())?{kind:"star",exportedName:"*",modulePath:e,...w(t)?{isTypeOnly:!0}:{}}:null}function be(t){let e=$e(t),n=Me(t,e);if(n)return n;if(e===void 0)return[];let o=Ue(t,e);if(o)return[o];let i=we(t,e);return i?[i]:[]}function sn(t){let e=[];for(let n of t.namedChildren)n?.type===l.EXPORT_STATEMENT&&e.push(...be(n));return e}function Xe(t,e){let n=t.childForFieldName("module_name");if(!n)return;let o=n.text;if(t.descendantsOfType("wildcard_import")[0])return;t.childForFieldName("name")&&ot(t,o,e)}function ve(t,e){let n=t.childForFieldName("path"),o=t.childForFieldName("alias");n&&o&&e.push({localName:o.text,originalName:T,modulePath:n.text})}function ke(t,e,n){let o=t.childForFieldName("path"),i=t.childForFieldName("alias");o&&i&&n.push({localName:i.text,originalName:T,modulePath:`${e}::${o.text}`})}function Ye(t,e,n){let o=t.descendantsOfType("identifier").pop();o&&n.push({localName:o.text,originalName:T,modulePath:`${e}::${t.text}`})}function Be(t,e,n){if(t.type===l.USE_AS_CLAUSE){ke(t,e,n);return}if(t.type===l.IDENTIFIER){n.push({localName:t.text,originalName:T,modulePath:`${e}::${t.text}`});return}t.type===l.SCOPED_IDENTIFIER&&Ye(t,e,n)}function Ge(t,e){let n=t.childForFieldName("path"),o=t.childForFieldName("list");if(!n||!o)return;let i=n.text;for(let s of o.namedChildren)s&&Be(s,i,e)}function He(t,e){let n=t.descendantsOfType("identifier"),o=n[n.length-1];o&&e.push({localName:o.text,originalName:T,modulePath:t.text})}function Qe(t,e){for(let n of t.namedChildren)n&&n.type===l.IDENTIFIER&&e.push({localName:n.text,originalName:T,modulePath:n.text})}function Ve(t,e){let n=t.childForFieldName("argument");if(n){if(n.type===l.USE_AS_CLAUSE){ve(n,e);return}if(n.type!==l.USE_WILDCARD){if(n.type===l.SCOPED_USE_LIST){Ge(n,e);return}if(n.type===l.SCOPED_IDENTIFIER||n.type===l.IDENTIFIER){He(n,e);return}n.type===l.USE_LIST&&Qe(n,e)}}}function je(t,e){let n=t.childForFieldName("path");if(!n)return;let o=n.text.replace(/['"]/g,""),i=t.childForFieldName("name");if(i){if(i.type===l.DOT||i.type===l.BLANK_IDENTIFIER)return;e.push({localName:i.text,originalName:T,modulePath:o})}else{let s=o.split("/"),a=s[s.length-1];e.push({localName:a,originalName:T,modulePath:o})}}function We(t,e){let n=t.descendantsOfType("import_spec_list")[0];if(!n)return;let o=n.descendantsOfType("import_spec");for(let i of o)i&&je(i,e)}function qe(t,e){let n=t.childForFieldName("path");if(n){let o=n.text.replace(/[<>"']/g,"");e.push({localName:o,originalName:T,modulePath:o})}}function Je(t,e){let n=t.namedChildren;for(let o of n)if(o)if(o.type===l.QUALIFIED_IDENTIFIER){let i=o.descendantsOfType("identifier"),s=i[i.length-1];s&&e.push({localName:s.text,originalName:T,modulePath:o.text})}else o.type===l.IDENTIFIER&&e.push({localName:o.text,originalName:T,modulePath:o.text})}function Ke(t,e){let n=t.childForFieldName("method");if(!n)return;let o=n.text;if(!pe.includes(o))return;let i=t.childForFieldName("arguments");if(!i)return;let s=i.descendantsOfType("string_content")[0]||i.descendantsOfType("string")[0];if(!s)return;let a=s.text.replace(/['"]/g,""),E=a.replace(/\.rb$/,"");e.push({localName:E,originalName:T,modulePath:a})}function ze(t){return t===l.NAMESPACE_USE_DECLARATION||t===l.INCLUDE_EXPRESSION||t===l.INCLUDE_ONCE_EXPRESSION||t===l.REQUIRE_EXPRESSION||t===l.REQUIRE_ONCE_EXPRESSION}function Ze(t,e){let n=t.descendantsOfType("qualified_name")[0]||t.descendantsOfType("name")[0];if(n){let o=n.text,i=o.split("\\"),s=i[i.length-1];e.push({localName:s,originalName:T,modulePath:o})}}function et(t,e){let n=t.descendantsOfType("string")[0]||t.descendantsOfType("string_content")[0];if(n){let o=n.text.replace(/['"]/g,"");e.push({localName:o,originalName:T,modulePath:o})}}function tt(t,e,n){e===l.NAMESPACE_USE_DECLARATION?Ze(t,n):et(t,n)}function nt(t,e){let n=t.descendantsOfType("qualified_name")[0]||t.descendantsOfType("identifier")[0];if(n){let o=n.text,i=o.split("."),s=i[i.length-1];e.push({localName:s,originalName:T,modulePath:o})}}function rt(t,e){let n=t.descendantsOfType("string").pop();if(!n)return;let o=n.text.replace(/['"]/g,""),i=t.descendantsOfType("identifier");for(let s of i)s&&(e.some(a=>a.localName===s.text)||e.push({localName:s.text,originalName:s.text,modulePath:o}))}function ot(t,e,n){if(t.childForFieldName("name")){for(let i of t.namedChildren)if(i)if(i.type===l.ALIASED_IMPORT){let s=i.childForFieldName("name"),a=i.childForFieldName("alias");s&&a&&n.push({localName:a.text,originalName:s.text,modulePath:e})}else if(i.type===l.DOTTED_NAME){let s=i.descendantsOfType("identifier"),a=s[s.length-1];a&&n.push({localName:a.text,originalName:i.text,modulePath:e})}else i.type===l.IDENTIFIER&&n.push({localName:i.text,originalName:i.text,modulePath:e})}}function it(t){let e=t.childForFieldName("function");if(!e)return{isMethodCall:!1,methodName:""};if(e.type===l.MEMBER_EXPRESSION){let n=e.childForFieldName("property"),o=e.childForFieldName("object");if(n)return{isMethodCall:!0,methodName:n.text,objectName:o?.text}}return{isMethodCall:!1,methodName:e.text}}function st(t){let e=t.childForFieldName("function");if(!e)return{isMethodCall:!1,methodName:""};if(e.type===l.ATTRIBUTE){let n=e.childForFieldName("attribute"),o=e.childForFieldName("object");if(n)return{isMethodCall:!0,methodName:n.text,objectName:o?.text}}return{isMethodCall:!1,methodName:e.text}}function at(t){let e=t.childForFieldName("name"),n=t.childForFieldName("object");if(e)return{isMethodCall:!0,methodName:e.text,objectName:n?.text}}function ct(t){return{isMethodCall:!0,methodName:t.childForFieldName("constructor")?.text||Z,objectName:Z}}function lt(t){let e=t.childForFieldName("method");if(!e)return;let n=t.childForFieldName("receiver");return n?{isMethodCall:!0,methodName:e.text,objectName:n.text}:{isMethodCall:!1,methodName:e.text}}function U(t){let e=t.type,o=t.childForFieldName("name")?.text||"";if(e===l.MEMBER_CALL_EXPRESSION){let i=t.childForFieldName("object");return{isMethodCall:!0,methodName:o,objectName:i?.text}}if(e===l.SCOPED_CALL_EXPRESSION){let i=t.childForFieldName("scope");return{isMethodCall:!0,methodName:o,objectName:i?.text}}return{isMethodCall:!1,methodName:o}}function Et(t){let e=t.childForFieldName("function")||t.namedChildren[0];if(e&&e.type===l.MEMBER_ACCESS_EXPRESSION){let n=e.childForFieldName("name"),o=e.childForFieldName("expression");if(n)return{isMethodCall:!0,methodName:n.text,objectName:o?.text}}if(e)return{isMethodCall:!1,methodName:e.text}}function Nt(t){let e=t.childForFieldName("type");return{isMethodCall:!0,methodName:Ae,objectName:e?.text}}var an={[l.CALL_EXPRESSION]:it,[l.CALL]:st,[l.METHOD_INVOCATION]:at,[l.EXPLICIT_CONSTRUCTOR_INVOCATION]:ct,[l.COMMAND_CALL]:lt,[l.FUNCTION_CALL_EXPRESSION]:U,[l.MEMBER_CALL_EXPRESSION]:U,[l.SCOPED_CALL_EXPRESSION]:U,[l.INVOCATION_EXPRESSION]:Et,[l.OBJECT_CREATION_EXPRESSION]:Nt};var It=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,L=class t extends Date{#t=!1;#n=!1;#e=null;constructor(e){let n=!0,o=!0,i="Z";if(typeof e=="string"){let s=e.match(It);s?(s[1]||(n=!1,e=`0000-01-01T${e}`),o=!!s[2],o&&e[10]===" "&&(e=e.replace(" ","T")),s[2]&&+s[2]>23?e="":(i=s[3]||null,e=e.toUpperCase(),!i&&o&&(e+="Z"))):e=""}super(e),isNaN(this.getTime())||(this.#t=n,this.#n=o,this.#e=i)}isDateTime(){return this.#t&&this.#n}isLocal(){return!this.#t||!this.#n||!this.#e}isDate(){return this.#t&&!this.#n}isTime(){return this.#n&&!this.#t}isValid(){return this.#t||this.#n}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#e===null)return e.slice(0,-1);if(this.#e==="Z")return e;let n=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return n=this.#e[0]==="-"?n:-n,new Date(this.getTime()-n*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(e,n="Z"){let o=new t(e);return o.#e=n,o}static wrapAsLocalDateTime(e){let n=new t(e);return n.#e=null,n}static wrapAsLocalDate(e){let n=new t(e);return n.#n=!1,n.#e=null,n}static wrapAsLocalTime(e){let n=new t(e);return n.#t=!1,n.#e=null,n}};function ft(t,e){let n=t.slice(0,e).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function ut(t,e,n){let o=t.split(/\r\n|\n|\r/g),i="",s=(Math.log10(e+1)|0)+1;for(let a=e-1;a<=e+1;a++){let E=o[a-1];E&&(i+=a.toString().padEnd(s," "),i+=": ",i+=E,i+=`
3
3
  `,a===e&&(i+=" ".repeat(s+n+2),i+=`^
4
4
  `))}return i}var f=class extends Error{line;column;codeblock;constructor(e,n){let[o,i]=ft(n.toml,n.ptr),s=ut(n.toml,o,i);super(`Invalid TOML document: ${e}
5
5
 
@@ -59,4 +59,4 @@ smol-toml/dist/index.js:
59
59
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60
60
  *)
61
61
  */
62
- //# sourceMappingURL=chunk-34USPXMP.js.map
62
+ //# sourceMappingURL=chunk-3PNI46VR.js.map
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{Aa as n,La as t,da as e,ha as o}from"./chunk-2OLMINDD.js";var _=".github",u=".claude",d="hooks.json",O="settings.json",E=".cursor/mcp.json",h="claude_desktop_config.json",x="docuvia-local",A="copilot-instructions.md",N="CLAUDE.md",R=".cursorrules",r="docuvia:start",g="docuvia:end",S=".windsurfrules",I="llms.txt",L="AGENTS.md",C=".hermes.md",m=".continue/rules",f="docuvia.md",T="Cursor",U="Claude",M="GitHub Copilot",D="Codex",y="Continue",F="Hermes Agent",b="cursor",v="claude",P="copilot",G="codex",w="continue",H="hermes",K="${CLAUDE_PLUGIN_ROOT}/hooks",k="${CURSOR_PLUGIN_ROOT}/hooks",J="${CLAUDE_PROJECT_DIR}/"+t,q="npx",V="-y",$="--no-install",j=["docuvia","mcp"],X="DOCUVIA_WORKSPACE_ROOT",B=`#!/usr/bin/env node
2
+ import{Ca as n,Na as t,fa as e,ja as o}from"./chunk-UUYEPLGA.js";var _=".github",u=".claude",d="hooks.json",O="settings.json",E=".cursor/mcp.json",h="claude_desktop_config.json",x="docuvia-local",A="copilot-instructions.md",N="CLAUDE.md",R=".cursorrules",r="docuvia:start",g="docuvia:end",S=".windsurfrules",I="llms.txt",L="AGENTS.md",C=".hermes.md",m=".continue/rules",f="docuvia.md",T="Cursor",U="Claude",M="GitHub Copilot",D="Codex",y="Continue",F="Hermes Agent",b="cursor",v="claude",P="copilot",G="codex",w="continue",H="hermes",K="${CLAUDE_PLUGIN_ROOT}/hooks",k="${CURSOR_PLUGIN_ROOT}/hooks",J="${CLAUDE_PROJECT_DIR}/"+t,q="npx",V="-y",$="--no-install",j=["docuvia","mcp"],X="DOCUVIA_WORKSPACE_ROOT",B=`#!/usr/bin/env node
3
3
  /**
4
4
  * Docuvia Agent Hook
5
5
  * Intercepts AI searches and augments with high-density AST context from local SQLite.
@@ -79,4 +79,4 @@ Run: \`npx --no-install docuvia analyze <file> --agent-authored --stage\`
79
79
  Pipe a JSON payload on stdin (default) \u2014 \`{"decisions":[{"title":string,"content":string,"nodeType":"change"|"rule"|"decision"|"context","confidence":number}]}\` \u2014 or pass \`--decisions-file=<path>\` instead. Put \`--agent-authored\`/\`--stage\` after the positional \`<file>\`, not before \u2014 a flag preceding the path silently swallows it as the flag's own value. Staged decisions flush into the knowledge graph automatically the next time you commit a change touching that file \u2014 nothing else to run.
80
80
  <!-- docuvia:end -->
81
81
  `;export{_ as a,u as b,d as c,O as d,E as e,h as f,x as g,A as h,N as i,R as j,r as k,g as l,S as m,I as n,L as o,C as p,m as q,f as r,T as s,U as t,M as u,D as v,y as w,F as x,b as y,v as z,P as A,G as B,w as C,H as D,K as E,k as F,J as G,q as H,V as I,$ as J,j as K,X as L,B as M,s as N,W as O,z as P};
82
- //# sourceMappingURL=chunk-WULDFQHU.js.map
82
+ //# sourceMappingURL=chunk-6U6L55OL.js.map
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{Ga as N,nb as O}from"./chunk-2OLMINDD.js";import*as E from"fs/promises";import*as U from"path";import{select as P,confirm as H,input as b,checkbox as F}from"@inquirer/prompts";import Y from"picocolors";import M from"ora";var r={TOP_LEFT:"\u250C",TOP_RIGHT:"\u2510",BOTTOM_LEFT:"\u2514",BOTTOM_RIGHT:"\u2518",HORIZONTAL:"\u2500",VERTICAL:"\u2502",T_DOWN:"\u252C",T_UP:"\u2534",T_RIGHT:"\u251C",T_LEFT:"\u2524",CROSS:"\u253C"},w={PASS:"\u2713",FAIL:"\u2717"},c="\u25C6";var s={SPACE:" ",EMPTY:""};function u(e){return e.replace(/\s+/g,s.SPACE).trim()}function h(e,t){if(e.length<=t)return[e];let n=e.split(s.SPACE),i=[],o=s.EMPTY;for(let _ of n){let A=o?`${o}${s.SPACE}${_}`:_;A.length>t&&o?(i.push(o),o=_):o=A}return o&&i.push(o),i}function m(e,t){return e+s.SPACE.repeat(Math.max(0,t-e.length))}function d(e,t,n,i){return t+e.map(o=>r.HORIZONTAL.repeat(o+2)).join(n)+i}function C(e,t){let n=e.map((i,o)=>m(i??s.EMPTY,t[o]));return`${r.VERTICAL} ${n.join(` ${r.VERTICAL} `)} ${r.VERTICAL}`}function f(e,t){return e.map((n,i)=>{let o=Math.max(n.header.length,...t.map(_=>(_[i]??s.EMPTY).length));return n.maxWidth?Math.min(o,n.maxWidth):o})}function D(e,t){let n=e.map(a=>u(a.header)),i=t.map(a=>a.map(I=>u(I??s.EMPTY))),o=f(e.map((a,I)=>({...a,header:n[I]})),i),_=i.map(a=>e.map((I,T)=>h(a[T]??s.EMPTY,o[T]))),A=[d(o,r.TOP_LEFT,r.T_DOWN,r.TOP_RIGHT),C(n,o),d(o,r.T_RIGHT,r.CROSS,r.T_LEFT)];for(let a of _){let I=Math.max(...a.map(T=>T.length));for(let T=0;T<I;T++)A.push(C(a.map(p=>p[T]??s.EMPTY),o))}return A.push(d(o,r.BOTTOM_LEFT,r.T_UP,r.BOTTOM_RIGHT)),A}function g(e){let t=r.HORIZONTAL.repeat(e.length+2);return[`${r.TOP_LEFT}${t}${r.TOP_RIGHT}`,`${r.VERTICAL} ${e} ${r.VERTICAL}`,`${r.BOTTOM_LEFT}${t}${r.BOTTOM_RIGHT}`]}var y="cyan",R={INFO:"\u2139",SUCCESS:"\u2714",WARN:"\u26A0",ERROR:"\u2716"},l=Y.createColors(!!process.stdout.isTTY&&!process.env.NO_COLOR),L={spinner:e=>M({text:e,color:y}),info:e=>console.log(l.cyan(`${R.INFO} ${e}`)),success:e=>console.log(l.green(`${R.SUCCESS} ${e}`)),warn:e=>console.warn(l.yellow(`${R.WARN} ${e}`)),error:e=>console.error(l.red(`${R.ERROR} ${e}`)),log:e=>console.log(e??""),header:e=>{console.log();for(let t of g(e))console.log(l.cyan(t));console.log()},section:e=>{console.log(),console.log(l.bold(l.cyan(`${c} ${e}`)))},table:(e,t)=>{for(let n of D(e,t))console.log(n)},askConfirm:async(e,t=!0)=>await H({message:e,default:t}),askSelect:async(e,t)=>await P({message:e,choices:t}),askCheckbox:async(e,t)=>await F({message:e,choices:t}),askInput:async(e,t)=>await b({message:e,default:t})};var S={CLI_HEADER:"Docuvia Knowledge Graph",CLI_PROMPT_ACTION:"What would you like to do?",CLI_UNKNOWN_COMMAND:"Unknown command: ",CLI_FATAL_ERROR:"Fatal error: ",CLI_INTERACTIVE_NO_TTY:"--interactive requires a real terminal and is disabled under CI -- cannot launch the wizard menu.",CLI_INTERACTIVE_UNAVAILABLE:"--interactive was requested, but this session has no usable TTY (or is running under CI) -- continuing non-interactively.",INIT_HEADER:"Initialize Docuvia",INIT_CONFIRM:"Initialize Docuvia in this workspace?",INIT_ABORTED:"Initialization aborted.",INIT_START:"Starting initialization...",INIT_FAILED:"Initialization failed: ",INIT_AGENT_HOOKS:"Initializing AI Agent integrations for Docuvia...",INIT_LOCK_WAITING:"Another `docuvia init` is already running in this workspace; waiting for it to finish...",INIT_HOOKS_CONFIG_MCP:"Configuring MCP Servers...",INIT_HOOKS_REGISTERED_MCP:"Registered MCP server in: ",INIT_HOOKS_FAIL_CURSOR_MCP:"Could not configure Cursor MCP: ",INIT_HOOKS_SUCCESS:"Docuvia Agent Integrations successfully installed!",INIT_HOOKS_SUPPORTED:"Supported platforms: Claude Code, Cursor, GitHub Copilot, Codex, Continue, Hermes Agent.",INIT_HOOKS_FAIL:"Failed to initialize agent integrations: ",INIT_HOOKS_SELECT:"Which AI Agent integrations would you like to install?",INIT_HOOKS_NONE_SELECTED:"No platforms selected. Skipping agent integrations.",INIT_CLAUDE_MCP_MANUAL_SNIPPET:"To use Docuvia from Claude Desktop, add this to your global MCP config",FS_APPENDED:"Appended instructions to: ",FS_ALREADY_EXISTS:"Instructions already exist in: ",FS_CREATED:"Created: ",FS_READ_ERROR:"Could not read ",FS_READ_ERROR_UNKNOWN_CODE:"unknown error",FS_BLOCK_REMOVED_PREFIX:"Removed block from ",FS_BLOCK_REMOVED_SUFFIX:" (backup created)",FS_UNEXPECTED_SHAPE:(e,t)=>`Unexpected shape for "${e}" in ${t} (expected an array); leaving it untouched`,CLEAN_HEADER:"Clean Docuvia Database",CLEAN_CONFIRM:"This will permanently delete the local Docuvia database. Continue?",CLEAN_ABORTED:"Clean aborted.",CLEAN_START:"Cleaning database...",CLEAN_SUCCESS:"Clean complete. ",CLEAN_FAIL:"Clean failed: ",STATUS_START:"Getting status...",STATUS_SUCCESS:"Status retrieved.",STATUS_FAIL:"Failed to get status: ",STATUS_HEADER:"Docuvia Status",STATUS_COL_METRIC:"Metric",STATUS_COL_VALUE:"Value",STATUS_METRIC_PROJECTS:"Projects",STATUS_METRIC_L2_NODES:"L2 Nodes",STATUS_METRIC_L3_DECISIONS:"L3 Decisions",STATUS_METRIC_TIER_B_COVERAGE:"Tier B Coverage",STATUS_METRIC_TIER_C_QUEUE:"Tier C Queue",STATUS_METRIC_GRAPH_FRESHNESS:"Graph Freshness",STATUS_FRESHNESS_FRESH:"\u2713 fresh",STATUS_FRESHNESS_STALE:"\u26A0 stale (run 'docuvia analyze' or see 'docuvia doctor')",STATUS_FRESHNESS_UNKNOWN:"? unknown",PUBLISH_HEADER:"Publish to Docuvia",PUBLISH_MISSING_PROJECT_ID:"Project ID is required when not running interactively.",PUBLISH_NO_PROJECT_ID_PROVIDED:"No project ID provided.",PUBLISH_PROMPT_PROJECT_ID:"Enter the project ID to publish to: ",PUBLISH_PROJECT_ID_REQUIRED:"Project ID is required.",PUBLISH_MISSING_ENV:"DOCUVIA_API_URL and/or MCP_PAT are not set.",PUBLISH_SKIP:"Skipping publish.",PUBLISH_START:"Starting publish for project ",PUBLISH_SUCCESS:"Publish complete.",PUBLISH_FAIL:"Publish failed: ",ANALYZE_HEADER:"Analyze Project",ANALYZE_START:"Analyzing project...",ANALYZE_SUCCESS:"Analysis complete.",ANALYZE_FAIL:"Analysis failed: ",ANALYZE_PROJECT_TYPE:"Project Type: ",ANALYZE_SUGGESTED_TAGS:"Suggested Tags: ",ANALYZE_NONE:"none",ANALYZE_AUTO_FULL_SUCCESS:"Full ingestion complete.",ANALYZE_AUTO_FULL_SUMMARY:(e,t,n)=>`Parsed ${e}/${t} file(s) (${n} failed).`,ANALYZE_AUTO_DELTA_SUCCESS:"Delta ingestion complete.",ANALYZE_AUTO_DELTA_SUMMARY:(e,t,n)=>`Re-parsed ${e} file(s), dropped ${t} deleted file(s)`+(n>0?`, queued ${n} file(s) for Tier B.`:"."),ANALYZE_AUTO_NOOP_SUCCESS:"Already up to date.",ANALYZE_AUTO_NOOP_DIRTY_WORKTREE_SUCCESS:"Already up to date with HEAD -- uncommitted changes in the working tree were not analyzed (commit them, then re-run).",ANALYZE_LLM_MISSING_ENV:"AI_DOCUVIA_INTEGRATIONS_OPENAI_BASE_URL and a model (AI_DOCUVIA_MODEL or AI_DOCUVIA_FAST_MODEL) must be set to analyze a specific path.",ANALYZE_FOCUSED_HEADER:"Analyze Path",ANALYZE_FOCUSED_START:"Extracting decisions from ",ANALYZE_FOCUSED_SUCCESS:"Decision extraction complete.",ANALYZE_FOCUSED_FAIL:"Decision extraction failed: ",ANALYZE_FOCUSED_NONE:"No decision-worthy content found.",ANALYZE_FOCUSED_PERSISTED:(e,t)=>`${e} persisted, ${t} deduplicated`,ANALYZE_DECISION_LINE:(e,t,n)=>`${t} (${e}, confidence: ${n})`,ANALYZE_DECISION_CONTENT_PREFIX:" ",ANALYZE_TIER_B_HEADER:"Analyze -- Tier B (LSP escalation)",ANALYZE_TIER_B_START:"Running the Tier B LSP escalation batch...",ANALYZE_TIER_B_SUCCESS:"Tier B batch complete.",ANALYZE_TIER_B_FAIL:"Tier B batch failed: ",ANALYZE_TIER_B_SUMMARY:(e,t,n,i,o,_)=>`${e} file(s) processed, ${t} corrected edge(s) applied`+(n>0?`, ${n} file(s) left queued for the next batch`:"")+(o>0?`, ${o} file(s) not applicable to their LSP project (kept at Tier A)`:"")+(i>0?`, ${i} file(s) permanently failed (not re-queued)`:"")+(_?", zero-progress watchdog tripped: no next-batch re-queue remains":"")+".",ANALYZE_TIER_B_DEGRADED:e=>`LSP unavailable -- AST-level edges left untouched (${e})`,ANALYZE_TIER_B_GATE_NOT_READY:e=>`LSP prerequisites are not ready: ${e}`,ANALYZE_TIER_B_GATE_PROMPT:"Continue with AST-only precision (skip the LSP-corrected cross-file edges this batch)?",ANALYZE_TIER_B_GATE_DECLINED:"Aborted -- install typescript-language-server as a project devDependency (or pass --fallback-ast) and try again.",ANALYZE_TIER_B_GATE_FAILED:e=>`LSP prerequisites are not ready: ${e}
2
+ import{Ia as N,vb as O}from"./chunk-UUYEPLGA.js";import*as E from"fs/promises";import*as U from"path";import{select as P,confirm as H,input as b,checkbox as F}from"@inquirer/prompts";import Y from"picocolors";import M from"ora";var r={TOP_LEFT:"\u250C",TOP_RIGHT:"\u2510",BOTTOM_LEFT:"\u2514",BOTTOM_RIGHT:"\u2518",HORIZONTAL:"\u2500",VERTICAL:"\u2502",T_DOWN:"\u252C",T_UP:"\u2534",T_RIGHT:"\u251C",T_LEFT:"\u2524",CROSS:"\u253C"},w={PASS:"\u2713",FAIL:"\u2717"},c="\u25C6";var s={SPACE:" ",EMPTY:""};function u(e){return e.replace(/\s+/g,s.SPACE).trim()}function h(e,t){if(e.length<=t)return[e];let n=e.split(s.SPACE),i=[],o=s.EMPTY;for(let _ of n){let A=o?`${o}${s.SPACE}${_}`:_;A.length>t&&o?(i.push(o),o=_):o=A}return o&&i.push(o),i}function m(e,t){return e+s.SPACE.repeat(Math.max(0,t-e.length))}function d(e,t,n,i){return t+e.map(o=>r.HORIZONTAL.repeat(o+2)).join(n)+i}function C(e,t){let n=e.map((i,o)=>m(i??s.EMPTY,t[o]));return`${r.VERTICAL} ${n.join(` ${r.VERTICAL} `)} ${r.VERTICAL}`}function f(e,t){return e.map((n,i)=>{let o=Math.max(n.header.length,...t.map(_=>(_[i]??s.EMPTY).length));return n.maxWidth?Math.min(o,n.maxWidth):o})}function D(e,t){let n=e.map(a=>u(a.header)),i=t.map(a=>a.map(I=>u(I??s.EMPTY))),o=f(e.map((a,I)=>({...a,header:n[I]})),i),_=i.map(a=>e.map((I,T)=>h(a[T]??s.EMPTY,o[T]))),A=[d(o,r.TOP_LEFT,r.T_DOWN,r.TOP_RIGHT),C(n,o),d(o,r.T_RIGHT,r.CROSS,r.T_LEFT)];for(let a of _){let I=Math.max(...a.map(T=>T.length));for(let T=0;T<I;T++)A.push(C(a.map(p=>p[T]??s.EMPTY),o))}return A.push(d(o,r.BOTTOM_LEFT,r.T_UP,r.BOTTOM_RIGHT)),A}function g(e){let t=r.HORIZONTAL.repeat(e.length+2);return[`${r.TOP_LEFT}${t}${r.TOP_RIGHT}`,`${r.VERTICAL} ${e} ${r.VERTICAL}`,`${r.BOTTOM_LEFT}${t}${r.BOTTOM_RIGHT}`]}var y="cyan",R={INFO:"\u2139",SUCCESS:"\u2714",WARN:"\u26A0",ERROR:"\u2716"},l=Y.createColors(!!process.stdout.isTTY&&!process.env.NO_COLOR),L={spinner:e=>M({text:e,color:y}),info:e=>console.log(l.cyan(`${R.INFO} ${e}`)),success:e=>console.log(l.green(`${R.SUCCESS} ${e}`)),warn:e=>console.warn(l.yellow(`${R.WARN} ${e}`)),error:e=>console.error(l.red(`${R.ERROR} ${e}`)),log:e=>console.log(e??""),header:e=>{console.log();for(let t of g(e))console.log(l.cyan(t));console.log()},section:e=>{console.log(),console.log(l.bold(l.cyan(`${c} ${e}`)))},table:(e,t)=>{for(let n of D(e,t))console.log(n)},askConfirm:async(e,t=!0)=>await H({message:e,default:t}),askSelect:async(e,t)=>await P({message:e,choices:t}),askCheckbox:async(e,t)=>await F({message:e,choices:t}),askInput:async(e,t)=>await b({message:e,default:t})};var S={CLI_HEADER:"Docuvia Knowledge Graph",CLI_PROMPT_ACTION:"What would you like to do?",CLI_UNKNOWN_COMMAND:"Unknown command: ",CLI_FATAL_ERROR:"Fatal error: ",CLI_INTERACTIVE_NO_TTY:"--interactive requires a real terminal and is disabled under CI -- cannot launch the wizard menu.",CLI_INTERACTIVE_UNAVAILABLE:"--interactive was requested, but this session has no usable TTY (or is running under CI) -- continuing non-interactively.",INIT_HEADER:"Initialize Docuvia",INIT_CONFIRM:"Initialize Docuvia in this workspace?",INIT_ABORTED:"Initialization aborted.",INIT_START:"Starting initialization...",INIT_FAILED:"Initialization failed: ",INIT_AGENT_HOOKS:"Initializing AI Agent integrations for Docuvia...",INIT_LOCK_WAITING:"Another `docuvia init` is already running in this workspace; waiting for it to finish...",INIT_HOOKS_CONFIG_MCP:"Configuring MCP Servers...",INIT_HOOKS_REGISTERED_MCP:"Registered MCP server in: ",INIT_HOOKS_FAIL_CURSOR_MCP:"Could not configure Cursor MCP: ",INIT_HOOKS_SUCCESS:"Docuvia Agent Integrations successfully installed!",INIT_HOOKS_SUPPORTED:"Supported platforms: Claude Code, Cursor, GitHub Copilot, Codex, Continue, Hermes Agent.",INIT_HOOKS_FAIL:"Failed to initialize agent integrations: ",INIT_HOOKS_SELECT:"Which AI Agent integrations would you like to install?",INIT_HOOKS_NONE_SELECTED:"No platforms selected. Skipping agent integrations.",INIT_CLAUDE_MCP_MANUAL_SNIPPET:"To use Docuvia from Claude Desktop, add this to your global MCP config",FS_APPENDED:"Appended instructions to: ",FS_ALREADY_EXISTS:"Instructions already exist in: ",FS_CREATED:"Created: ",FS_READ_ERROR:"Could not read ",FS_READ_ERROR_UNKNOWN_CODE:"unknown error",FS_BLOCK_REMOVED_PREFIX:"Removed block from ",FS_BLOCK_REMOVED_SUFFIX:" (backup created)",FS_UNEXPECTED_SHAPE:(e,t)=>`Unexpected shape for "${e}" in ${t} (expected an array); leaving it untouched`,CLEAN_HEADER:"Clean Docuvia Database",CLEAN_CONFIRM:"This will permanently delete the local Docuvia database. Continue?",CLEAN_ABORTED:"Clean aborted.",CLEAN_START:"Cleaning database...",CLEAN_SUCCESS:"Clean complete. ",CLEAN_FAIL:"Clean failed: ",STATUS_START:"Getting status...",STATUS_SUCCESS:"Status retrieved.",STATUS_FAIL:"Failed to get status: ",STATUS_HEADER:"Docuvia Status",STATUS_COL_METRIC:"Metric",STATUS_COL_VALUE:"Value",STATUS_METRIC_PROJECTS:"Projects",STATUS_METRIC_L2_NODES:"L2 Nodes",STATUS_METRIC_L3_DECISIONS:"L3 Decisions",STATUS_METRIC_TIER_B_COVERAGE:"Tier B Coverage",STATUS_METRIC_TIER_C_QUEUE:"Tier C Queue",STATUS_METRIC_GRAPH_FRESHNESS:"Graph Freshness",STATUS_FRESHNESS_FRESH:"\u2713 fresh",STATUS_FRESHNESS_STALE:"\u26A0 stale (run 'docuvia analyze' or see 'docuvia doctor')",STATUS_FRESHNESS_UNKNOWN:"? unknown",PUBLISH_HEADER:"Publish to Docuvia",PUBLISH_MISSING_PROJECT_ID:"Project ID is required when not running interactively.",PUBLISH_NO_PROJECT_ID_PROVIDED:"No project ID provided.",PUBLISH_PROMPT_PROJECT_ID:"Enter the project ID to publish to: ",PUBLISH_PROJECT_ID_REQUIRED:"Project ID is required.",PUBLISH_MISSING_ENV:"DOCUVIA_API_URL and/or MCP_PAT are not set.",PUBLISH_SKIP:"Skipping publish.",PUBLISH_START:"Starting publish for project ",PUBLISH_SUCCESS:"Publish complete.",PUBLISH_FAIL:"Publish failed: ",ANALYZE_HEADER:"Analyze Project",ANALYZE_START:"Analyzing project...",ANALYZE_SUCCESS:"Analysis complete.",ANALYZE_FAIL:"Analysis failed: ",ANALYZE_PROJECT_TYPE:"Project Type: ",ANALYZE_SUGGESTED_TAGS:"Suggested Tags: ",ANALYZE_NONE:"none",ANALYZE_AUTO_FULL_SUCCESS:"Full ingestion complete.",ANALYZE_AUTO_FULL_SUMMARY:(e,t,n)=>`Parsed ${e}/${t} file(s) (${n} failed).`,ANALYZE_AUTO_DELTA_SUCCESS:"Delta ingestion complete.",ANALYZE_AUTO_DELTA_SUMMARY:(e,t,n)=>`Re-parsed ${e} file(s), dropped ${t} deleted file(s)`+(n>0?`, queued ${n} file(s) for Tier B.`:"."),ANALYZE_AUTO_NOOP_SUCCESS:"Already up to date.",ANALYZE_AUTO_NOOP_DIRTY_WORKTREE_SUCCESS:"Already up to date with HEAD -- uncommitted changes in the working tree were not analyzed (commit them, then re-run).",ANALYZE_LLM_MISSING_ENV:"AI_DOCUVIA_INTEGRATIONS_OPENAI_BASE_URL and a model (AI_DOCUVIA_MODEL or AI_DOCUVIA_FAST_MODEL) must be set to analyze a specific path.",ANALYZE_FOCUSED_HEADER:"Analyze Path",ANALYZE_FOCUSED_START:"Extracting decisions from ",ANALYZE_FOCUSED_SUCCESS:"Decision extraction complete.",ANALYZE_FOCUSED_FAIL:"Decision extraction failed: ",ANALYZE_FOCUSED_NONE:"No decision-worthy content found.",ANALYZE_FOCUSED_PERSISTED:(e,t)=>`${e} persisted, ${t} deduplicated`,ANALYZE_DECISION_LINE:(e,t,n)=>`${t} (${e}, confidence: ${n})`,ANALYZE_DECISION_CONTENT_PREFIX:" ",ANALYZE_TIER_B_HEADER:"Analyze -- Tier B (LSP escalation)",ANALYZE_TIER_B_START:"Running the Tier B LSP escalation batch...",ANALYZE_TIER_B_SUCCESS:"Tier B batch complete.",ANALYZE_TIER_B_FAIL:"Tier B batch failed: ",ANALYZE_TIER_B_SUMMARY:(e,t,n,i,o,_)=>`${e} file(s) processed, ${t} corrected edge(s) applied`+(n>0?`, ${n} file(s) left queued for the next batch`:"")+(o>0?`, ${o} file(s) not applicable to their LSP project (kept at Tier A)`:"")+(i>0?`, ${i} file(s) permanently failed (not re-queued)`:"")+(_?", zero-progress watchdog tripped: no next-batch re-queue remains":"")+".",ANALYZE_TIER_B_DEGRADED:e=>`LSP unavailable -- AST-level edges left untouched (${e})`,ANALYZE_TIER_B_GATE_NOT_READY:e=>`LSP prerequisites are not ready: ${e}`,ANALYZE_TIER_B_GATE_PROMPT:"Continue with AST-only precision (skip the LSP-corrected cross-file edges this batch)?",ANALYZE_TIER_B_GATE_DECLINED:"Aborted -- install typescript-language-server as a project devDependency (or pass --fallback-ast) and try again.",ANALYZE_TIER_B_GATE_FAILED:e=>`LSP prerequisites are not ready: ${e}
3
3
  Build/compile the target project (Docuvia's Tier B relies on a working language server), then run 'docuvia doctor' to confirm. Pass --fallback-ast to proceed with AST-only precision instead.`,ANALYZE_TIER_C_SUMMARY:(e,t,n)=>`Tier C: ${e} candidate(s) processed, ${t} decision(s) persisted`+(n>0?`, ${n} left queued for the next run.`:"."),ANALYZE_TIER_C_SKIPPED:e=>`Tier C: drain skipped this run (${e}).`,ANALYZE_AGENT_AUTHORED_MISSING_TARGET:"--agent-authored requires a target path, e.g. docuvia analyze <path> --agent-authored",ANALYZE_AGENT_AUTHORED_MISSING_PAYLOAD:"No decisions payload found -- pipe JSON via stdin or pass --decisions-file=<path>",ANALYZE_AGENT_AUTHORED_INVALID_JSON:e=>`--agent-authored payload is not valid JSON: ${e}`,ANALYZE_AGENT_AUTHORED_INVALID_SHAPE:e=>`--agent-authored payload does not match the expected shape: ${e}`,ANALYZE_LSP_ARGS_INVALID_JSON:e=>`DOCUVIA_LSP_ARGS starts with '[' but is not valid JSON -- use a JSON array of strings, or plain space-separated args: ${e}`,ANALYZE_LSP_ARGS_INVALID_SHAPE:"DOCUVIA_LSP_ARGS JSON array must contain only strings",ANALYZE_STAGE_HEADER:"Stage Decisions",ANALYZE_STAGE_START:"Staging decisions from ",ANALYZE_STAGE_SUCCESS:"Staged.",ANALYZE_STAGE_SUMMARY:e=>`${e} decision(s) staged -- flushed automatically on the next commit that touches this file.`,ANALYZE_FLUSH_STAGED_L3_HEADER:"Flush Staged L3 Decisions",ANALYZE_FLUSH_STAGED_L3_START:"Flushing staged L3 decisions...",ANALYZE_FLUSH_STAGED_L3_SUCCESS:"Flush complete.",ANALYZE_FLUSH_STAGED_L3_DISABLED_SUCCESS:"commit-l3-write is disabled -- nothing flushed.",ANALYZE_FLUSH_STAGED_L3_SUMMARY:(e,t,n)=>`${e} flushed, ${t} deduplicated`+(n>0?`, ${n} left staged for a future commit.`:"."),ANALYZE_AGENT_AUTHORED_STAGED_UNTIL_INGESTED:(e,t)=>t?`${e} decision(s) staged, not written: there is no knowledge graph yet. Run \`docuvia init\`; they are written on the next commit that touches this file.`:`${e} decision(s) staged, not written: this file is not in the knowledge graph yet (new or uncommitted). They are written automatically when a commit that touches it is ingested.`,ANALYZE_FLUSH_STAGED_L3_NO_GRAPH_ADVICE:"Some staged decisions could not be attached: the knowledge graph is empty (or hasn't ingested this file yet). Run `docuvia init` first -- decisions need a graph to attach to. They stay staged and retry on the next flush.",REVIEW_HEADER:"Review Changes",REVIEW_START:"Analyzing changes...",REVIEW_SUCCESS:"Analysis complete.",REVIEW_AGAINST:" against ",REVIEW_FAIL:"Review failed: ",REVIEW_FILES_CHANGED:"Files changed: ",REVIEW_RISK_PREFIX:"Risk level: ",REVIEW_WHY_HEADER:"Why (L3 decisions/context)",REVIEW_WHY_PREFIX:"Decision: ",IMPACT_HEADER:"Impact Analysis",IMPACT_MISSING_TARGET:"A target symbol/module name is required.",IMPACT_START:"Resolving blast radius for ",IMPACT_SUCCESS:"Resolved blast radius for ",IMPACT_FAIL:"Impact analysis failed: ",IMPACT_NOT_FOUND:"No matching node found for ",IMPACT_BLAST_RADIUS_HEADER:"Blast Radius",IMPACT_NO_DEPENDENTS:"No dependents found.",IMPACT_RISK_PREFIX:"Risk level: ",IMPACT_WHY_PREFIX:"Decision: ",IMPACT_COL_NAME:"Name",IMPACT_COL_TYPE:"Type",IMPACT_COL_SOURCE:"Source",IMPACT_EDGE_SOURCE_STATIC:"static",IMPACT_ENTRY_WHY_LABEL:e=>`${e}:`,IMPACT_TIER_B_INCOMPLETE:(e,t)=>`${e} of ${t} tracked file(s) have never been Tier B-processed -- this may be incomplete, not confirmed zero. Run \`docuvia analyze --escalate-to-lsp --full\` to resync.`,IMPACT_RISK_NOTE_PREFIX:"Note: ",UNINSTALL_HEADER:"Uninstall Docuvia2 Integrations",UNINSTALL_START:"Uninstalling Docuvia2 integrations...",UNINSTALL_SUCCESS_CLEAN:"Cleaned Docuvia: ",UNINSTALL_FAIL_CLEAN:"Failed to clean Docuvia directory: ",UNINSTALL_SUCCESS:"Docuvia2 uninstalled successfully. Backup files (.bak) were created for modified Markdown files.",UNINSTALL_FAIL:"Uninstall failed: ",UNINSTALL_HOOKS_SELECT:"Which AI Agent integrations would you like to uninstall?",UNINSTALL_KEEP_DB:"Skipping local database cleanup (--keep-db).",UNINSTALL_INVALID_WORKSPACE_ROOT:"Workspace root must not be empty.",UNINSTALL_PLATFORM_FAIL:"Failed to uninstall hooks for ",UNINSTALL_PLATFORM_FAIL_MID:": ",UNINSTALL_PARTIAL:"Uninstall completed with failures: ",UNINSTALL_DB_CLEANUP_FAILURE_NAME:"local database cleanup",UNINSTALL_HOOKS_FAIL_LOG:"uninstallHooks failed for platform ",UNINSTALL_DB_CLEANUP_FAIL_LOG:"uninstall's database cleanup failed",UNINSTALL_FAIL_LOG:"uninstall failed",UNINSTALL_REMOVED_FILE_PREFIX:"Removed ",UNINSTALL_REMOVED_MCP_SERVER_PREFIX:"Removed MCP server from ",UNINSTALL_REMOVED_HOOK_FROM_SETTINGS_PREFIX:"Removed the Docuvia hook entry from ",UNINSTALL_CLAUDE_MCP_MANUAL_REMINDER:"To finish uninstalling, manually remove the Docuvia MCP server entry from your global MCP config",UNINSTALL_GIT_HOOKS_SUCCESS:(e,t)=>`Removed git hooks (post-commit: ${e?"removed":"not present"}, pre-push: ${t?"removed":"not present"}).`,UNINSTALL_GIT_HOOKS_FAIL:"Failed to remove git hooks: ",UNINSTALL_GIT_HOOKS_FAIL_LOG:"uninstall's git hooks removal failed",UNINSTALL_GIT_HOOKS_FAILURE_NAME:"git hooks removal",UNINSTALL_KNOWLEDGE_BRANCH_DELETED:"Deleted the hidden docuvia-knowledge git branch.",UNINSTALL_DOCUVIA_DIR_REMOVED:"Removed the .docuvia/ directory.",UNINSTALL_DOCUVIA_DIR_FAIL:"Failed to remove the .docuvia/ directory: ",UNINSTALL_DOCUVIA_DIR_FAIL_LOG:"uninstall's .docuvia/ directory removal failed",UNINSTALL_DOCUVIA_DIR_FAILURE_NAME:".docuvia/ directory removal",DOCTOR_HEADER:"Docuvia Doctor Diagnostics",DOCTOR_START:"Running diagnostics...",DOCTOR_FAIL:"Doctor failed: ",DOCTOR_SUMMARY_PASSED:(e,t)=>`Summary: ${e}/${t} checks passed.`,DOCTOR_FIX_HINT:"Tip: run `docuvia doctor --fix` to attempt automatic repair.",DOCTOR_COL_CHECK:"Check",DOCTOR_COL_STATUS:"Status",DOCTOR_COL_MESSAGE:"Message",DOCTOR_COL_FIX:"Suggested Fix",DOCTOR_STATUS_PASS:"PASS",DOCTOR_STATUS_FAIL:"FAIL",DOCTOR_CATEGORY_DATABASE:"Database",DOCTOR_CATEGORY_GIT:"Git",DOCTOR_CATEGORY_GIT_HOOKS:"Git Hooks",DOCTOR_CATEGORY_LOGS:"Logs",DOCTOR_CATEGORY_TIER_B:"Tier B Batch",DOCTOR_CATEGORY_TIER_B_COVERAGE:"Tier B Coverage",DOCTOR_CATEGORY_LLM:"LLM Integration",DOCTOR_CATEGORY_LSP:"LSP Providers",DOCTOR_CATEGORY_AGENT_HOOKS:"AI Agent Hooks",DOCTOR_CATEGORY_AGENT_ADOPTION:"Docuvia-First Workflow",DOCTOR_CATEGORY_OTHER:"Other",QUERY_HEADER:"Query Knowledge Graph",QUERY_PROMPT_TARGET:"What would you like to query? ",QUERY_MISSING_TARGET:"A query target is required (pass it as an argument).",QUERY_MISSING_TARGET_NON_TTY:"A query target is required.",QUERY_START:"Querying local knowledge graph for ",QUERY_FOUND:"Query resolved for ",QUERY_FAIL:"Query failed: ",QUERY_CONTEXT_HEADER:"Query Results",QUERY_L2_PREFIX:"Module: ",QUERY_NO_L2:"No matching module found.",QUERY_L3_PREFIX:"Decision: ",QUERY_L3_PROVENANCE:e=>` (${e.join(", ")})`,QUERY_UNKNOWN_STATUS:"unknown",QUERY_INCOMING_HEADER:"Incoming (callers/dependents)",QUERY_OUTGOING_HEADER:"Outgoing (dependencies)",QUERY_COL_NAME:"Name",QUERY_COL_RELATION:"Relation",QUERY_INVALID_LIMIT:"Ignoring invalid --limit value (must be a positive integer): ",QUERY_TIER_B_INCOMING_UNPROCESSED:(e,t)=>`No callers found, but ${e} of ${t} tracked file(s) have never been Tier B-processed -- this may be incomplete, not confirmed zero. Run \`docuvia analyze --escalate-to-lsp --full\` to resync.`,QUERY_TIER_B_OUTGOING_UNPROCESSED:"No callees found, but this symbol's own file has never been Tier B-processed -- this may be incomplete, not confirmed zero. Run `docuvia analyze --escalate-to-lsp --full` to resync.",QUERY_MATCH_TYPE_EXACT:" (exact match)",QUERY_MATCH_TYPE_KEYWORD:" (keyword match -- verify with Grep/Glob if unsure)",QUERY_MATCH_TYPE_NEIGHBOR:" (neighbor match)",EXPORT_HEADER:"Export Topology",EXPORT_START:"Exporting topology...",EXPORT_SUCCESS:"Exported topology to ",EXPORT_FAIL:"Export failed: ",EXPORT_STATS_LINE:(e,t,n)=>`Nodes: ${e}, Links: ${t}, Groups: ${n}`,EXPORT_COLLAPSED_LINE:"Collapsed: yes (fewer nodes than the raw graph).",EXPORT_FOLDED_LINE:e=>`Folded links: ${e} more relationship(s) folded within files at this granularity; pass --collapse=symbol for the full symbol-level view.`,EXPORT_HTML_PATH_LINE:e=>`HTML viewer: ${e}`,SNAPSHOT_HEADER:"Snapshot Knowledge Graph",SNAPSHOT_START:"Packing knowledge graph snapshot...",SNAPSHOT_SUCCESS:"Snapshot packed onto the knowledge branch.",SNAPSHOT_FAIL:"Snapshot failed: ",SNAPSHOT_NODES_WRITTEN_LINE:e=>`Nodes written: ${e}`,SNAPSHOT_EDGES_WRITTEN_LINE:e=>`Edges written: ${e}`,SNAPSHOT_MARKDOWN_WRITTEN_LINE:e=>`Markdown files written: ${e}`,HYDRATE_HEADER:"Hydrate Local Database",HYDRATE_START:"Hydrating local database from the knowledge branch...",HYDRATE_SUCCESS:"Hydrated local database.",HYDRATE_NOTHING:'Nothing to hydrate from yet \u2014 run "docuvia init" first.',HYDRATE_FAIL:"Hydrate failed: ",HYDRATE_NODES_LOADED_LINE:e=>`Nodes loaded: ${e}`,HYDRATE_EDGES_LOADED_LINE:e=>`Edges loaded: ${e}`,HYDRATE_EDGES_DROPPED_LINE:e=>`Dangling edges dropped: ${e}`,HYDRATE_REFUSED:e=>`Refused to hydrate: ${e==="pending-local-write"?"a knowledge-branch write from this workspace hasn't been confirmed yet":"this would replace local.db's graph with a drastically smaller one"}. Local data was left untouched. Re-run with --force if you're sure.`,SYNC_KNOWLEDGE_HEADER:"Sync Knowledge Branch",SYNC_KNOWLEDGE_START:"Reconciling the knowledge branch with the remote...",SYNC_KNOWLEDGE_NO_REMOTE:"No remote reachable \u2014 nothing to reconcile (offline or no origin configured).",SYNC_KNOWLEDGE_UP_TO_DATE:"Knowledge branch is already up to date with the remote.",SYNC_KNOWLEDGE_FAST_FORWARDED:"Fast-forwarded the local knowledge branch to the remote.",SYNC_KNOWLEDGE_PUSHED:"Pushed the local knowledge branch to the remote.",SYNC_KNOWLEDGE_MERGED:"Merged the diverged knowledge branch and pushed the result.",SYNC_KNOWLEDGE_FAIL:"Knowledge branch sync failed: ",HOOKS_HEADER:"Docuvia Hooks",HOOKS_COL_NAME:"Hook",HOOKS_COL_STATUS:"Status",HOOKS_STATUS_ENABLED:"enabled",HOOKS_STATUS_DISABLED:"disabled",HOOKS_LIST_FAIL:"Failed to list hooks: ",HOOKS_SET_FAIL:"Failed to update hook: ",HOOKS_ENABLED:e=>`Enabled hook: ${e}`,HOOKS_DISABLED:e=>`Disabled hook: ${e}`,HOOKS_INVALID_NAME:(e,t)=>`Unknown hook '${e??""}' -- valid names: ${t.join(", ")}`,HOOKS_UNKNOWN_SUBCOMMAND:e=>`Unknown 'docuvia hooks' subcommand '${e??""}' -- expected list, enable, disable, or check`,CALL_RESOLUTION_QUARANTINE_HEADER:"Call-resolution Rule Quarantines",CALL_RESOLUTION_QUARANTINE_AUDIT_HEADER:"Quarantine Clear Audit",CALL_RESOLUTION_QUARANTINE_CLEAR_PREVIEW:"Quarantine Clear Preview",CALL_RESOLUTION_QUARANTINE_NONE:"No active call-resolution quarantines.",CALL_RESOLUTION_QUARANTINE_ALREADY_CLEARED:"No active quarantine exists; the latest clear audit is unchanged.",CALL_RESOLUTION_QUARANTINE_CLEAR_SUCCESS:e=>`Cleared call-resolution quarantine for ${e}.`,CALL_RESOLUTION_QUARANTINE_LIST_FAIL:"Failed to list call-resolution quarantines: ",CALL_RESOLUTION_QUARANTINE_CLEAR_FAIL:"Failed to clear call-resolution quarantine: ",CALL_RESOLUTION_QUARANTINE_INVALID_SUBCOMMAND:e=>`Unknown 'docuvia call-resolution quarantine' subcommand '${e??""}' -- expected list or clear`,CALL_RESOLUTION_QUARANTINE_USAGE:"Usage: docuvia call-resolution quarantine list | clear <ruleSignature> (--artifact <path> --trusted-inputs <path> | --operator <identity> --reason <text>)",CALL_RESOLUTION_QUARANTINE_EVIDENCE_REQUIRED:"Clear requires either --artifact with --trusted-inputs, or both --operator and --reason.",CALL_RESOLUTION_QUARANTINE_EVIDENCE_EXCLUSIVE:"Choose certification evidence or operator reason and identity, not both.",CALL_RESOLUTION_QUARANTINE_COL_SIGNATURE:"Rule signature",CALL_RESOLUTION_QUARANTINE_COL_CREATED:"Quarantined at",CALL_RESOLUTION_QUARANTINE_COL_REASON:"Reason",CALL_RESOLUTION_QUARANTINE_COL_PREVIOUS_HASH:"Previous config SHA-256",CALL_RESOLUTION_QUARANTINE_COL_NEW_HASH:"New config SHA-256",CALL_RESOLUTION_QUARANTINE_COL_METHOD:"Clear method",CALL_RESOLUTION_QUARANTINE_COL_EVIDENCE:"Evidence SHA-256",CALL_RESOLUTION_QUARANTINE_COL_OPERATOR:"Operator",CALL_RESOLUTION_QUARANTINE_COL_CLEARED:"Cleared at"};async function j(e,t,n){let i;try{i=await E.readFile(e,N)}catch(o){o.code!==O&&L.warn(`${S.FS_READ_ERROR}${e} (${o.code??S.FS_READ_ERROR_UNKNOWN_CODE}); creating a new file instead of appending`)}if(i===void 0){await E.mkdir(U.dirname(e),{recursive:!0}),await E.writeFile(e,t),L.success(S.FS_CREATED+e);return}i.includes(n)?L.info(S.FS_ALREADY_EXISTS+e):(await E.appendFile(e,`
4
4
  ${t}`),L.success(S.FS_APPENDED+e))}async function G(e){try{let t=await E.readFile(e,N),n=`${e}.bak`;return await E.writeFile(n,t,N),n}catch{return null}}async function J(e,t,n){try{let i=await E.readFile(e,N),o=i.indexOf(t);if(o===-1)return!1;let _=i.indexOf(n,o);if(_===-1)return!1;await G(e);let A=i.slice(0,o),a=i.slice(_+n.length);return await E.writeFile(e,(A+a).trim()+`
5
5
  `,N),L.success(`${S.FS_BLOCK_REMOVED_PREFIX}${e}${S.FS_BLOCK_REMOVED_SUFFIX}`),!0}catch{return!1}}export{r as a,w as b,L as c,S as d,j as e,G as f,J as g};
6
- //# sourceMappingURL=chunk-PXZ4QCE3.js.map
6
+ //# sourceMappingURL=chunk-CZA5NDHY.js.map
@@ -1,5 +1,5 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- var a={DEBUG:"debug",INFO:"info",WARN:"warn",ERROR:"error"};var d="ipc-log",te=new Set(Object.values(a));function v(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function R(e){if(!v(e))return!1;let{type:t,level:n,message:o,context:i}=e;return t===d&&typeof n=="string"&&te.has(n)&&typeof o=="string"&&(i===void 0||v(i))}var C=class{constructor(t){this.postMessageFn=t}postMessageFn;debug(t,n){this.send(a.DEBUG,t,n)}info(t,n){this.send(a.INFO,t,n)}warn(t,n){this.send(a.WARN,t,n)}error(t,n){this.send(a.ERROR,t,n)}onLog(){return()=>{}}send(t,n,o){let i=o?{type:d,level:t,message:n,context:o}:{type:d,level:t,message:n};this.postMessageFn(i)}};var y={CONTEXT_INJECTION:"context-injection",COMMIT_L3_WRITE:"commit-l3-write",TIER_B_C_PREPUSH:"tier-b-c-prepush"},ne={[y.CONTEXT_INJECTION]:!0,[y.COMMIT_L3_WRITE]:!0,[y.TIER_B_C_PREPUSH]:!0};var f=".docuvia",oe="logs",re="init.log",ie="clean.log",se="status.log",ae="sync.log",le="analyze.log",ce="review.log",de="impact.log",pe="query.log",ue="export-topology.log",ge="snapshot.log",ye="hydrate.log",me="sync-knowledge.log",A="node_modules",Se="local.db",Ee="init.lock",_e="tierC.lock",Re="sync-state.json",Ce="hooks-config.json",fe="pending-l3-decisions.json";var Ae="utf8";var Te="sha256";var s={TYPESCRIPT:"typescript",JAVASCRIPT:"javascript",PYTHON:"python",RUST:"rust",GO:"go",JAVA:"java",C:"c",CPP:"cpp",RUBY:"ruby",PHP:"php",CSHARP:"csharp"};var x=".claude/hooks",P=".cursor/hooks",b="docuvia-hook.js",M="docuvia-hook.cjs";var Ie=[`${x}/${b}`,`${P}/${M}`];function T(e){let t=e.replaceAll("\\","/");return Ie.includes(t)}var Le="EEXIST",Ne="ENOENT",Oe="EPERM",he="EACCES",De="EBUSY",ve="win32";var p=class{listeners=new Set;debug(t,n){this.emit(a.DEBUG,t,n)}info(t,n){this.emit(a.INFO,t,n)}warn(t,n){this.emit(a.WARN,t,n)}error(t,n){this.emit(a.ERROR,t,n)}onLog(t){return this.listeners.add(t),()=>this.listeners.delete(t)}emit(t,n,o){let i=o?{level:t,message:n,context:o}:{level:t,message:n};for(let u of this.listeners)u(i)}};function xe(){return new p}var I=class{constructor(t){this.logger=t}logger;handleMessage(t){return R(t)?(this.logger[t.level](t.message,t.context),!0):!1}};var c={GIT_COMMAND_FAILED:"GIT_COMMAND_FAILED",GIT_NETWORK_TIMEOUT:"GIT_NETWORK_TIMEOUT",GIT_NOT_A_REPOSITORY:"GIT_NOT_A_REPOSITORY",GIT_BRANCH_CREATE_FAILED:"GIT_BRANCH_CREATE_FAILED",GIT_HOOK_INSTALL_FAILED:"GIT_HOOK_INSTALL_FAILED",GIT_FAST_IMPORT_FAILED:"GIT_FAST_IMPORT_FAILED",DB_OPEN_FAILED:"DB_OPEN_FAILED",DB_NOT_FOUND:"DB_NOT_FOUND",DB_MIGRATION_FAILED:"DB_MIGRATION_FAILED",DB_QUERY_FAILED:"DB_QUERY_FAILED",DB_LOCKED:"DB_LOCKED",AST_WORKER_CRASHED:"AST_WORKER_CRASHED",AST_PARSE_FAILED:"AST_PARSE_FAILED",CALL_RESOLUTION_PROJECTION_SOURCE_MISSING:"CALL_RESOLUTION_PROJECTION_SOURCE_MISSING",CALL_RESOLUTION_QUARANTINE_UNAVAILABLE:"CALL_RESOLUTION_QUARANTINE_UNAVAILABLE",FS_READ_FAILED:"FS_READ_FAILED",FS_PATH_TRAVERSAL:"FS_PATH_TRAVERSAL",FACTORY_TOKEN_NOT_REGISTERED:"FACTORY_TOKEN_NOT_REGISTERED",FACTORY_LOCKED:"FACTORY_LOCKED",MEMORY_SCOPE_NOT_FOUND:"MEMORY_SCOPE_NOT_FOUND",SYNC_FETCH_FAILED:"SYNC_FETCH_FAILED",SYNC_PUSH_FAILED:"SYNC_PUSH_FAILED",LLM_NOT_INITIALIZED:"LLM_NOT_INITIALIZED",LLM_CHAT_COMPLETION_FAILED:"LLM_CHAT_COMPLETION_FAILED",LLM_HTTP_FAILED:"LLM_HTTP_FAILED",LLM_RATE_LIMITED:"LLM_RATE_LIMITED",LLM_AUTH_FAILED:"LLM_AUTH_FAILED",LLM_STREAM_FAILED:"LLM_STREAM_FAILED",LLM_INVALID_RESPONSE:"LLM_INVALID_RESPONSE",SEMANTIC_CORPUS_LEAKAGE:"SEMANTIC_CORPUS_LEAKAGE",SEMANTIC_CORPUS_IO_FAILED:"SEMANTIC_CORPUS_IO_FAILED",SEMANTIC_CORPUS_INVALID:"SEMANTIC_CORPUS_INVALID",SEMANTIC_INVALID_REQUEST:"SEMANTIC_INVALID_REQUEST",SEMANTIC_INVALID_RESPONSE:"SEMANTIC_INVALID_RESPONSE",SEMANTIC_INPUT_LIMIT_EXCEEDED:"SEMANTIC_INPUT_LIMIT_EXCEEDED",SEMANTIC_CANCELLED:"SEMANTIC_CANCELLED",SEMANTIC_DEADLINE_EXCEEDED:"SEMANTIC_DEADLINE_EXCEEDED",SEMANTIC_INFERENCE_FAILED:"SEMANTIC_INFERENCE_FAILED",INIT_WORKFLOW_FAILED:"INIT_WORKFLOW_FAILED",CLEAN_WORKFLOW_FAILED:"CLEAN_WORKFLOW_FAILED",UNINSTALL_WORKFLOW_FAILED:"UNINSTALL_WORKFLOW_FAILED",INVALID_INPUT:"INVALID_INPUT"};var Pe="DocuviaError",l=class e extends Error{code;cause;constructor(t,n,o){super(n),this.name=Pe,this.code=t,this.cause=o}static wrap(t,n,o){if(o instanceof e)return o;let i=o instanceof Error?o.message:String(o);return new e(t,`${n}: ${i}`,o)}};var be={WORKSPACE_ROOT:"workspaceRoot",API_URL:"apiUrl",PROJECT_ID:"projectId",COMMIT_SHA:"commitSha",TARGET_PATH:"targetPath",LLM_BASE_URL:"llmBaseUrl",LLM_MODEL:"llmModel",BASE_REF:"baseRef",HEAD_REF:"headRef",TARGET:"target",ESCALATE_TO_LSP:"escalateToLsp",TIER_B_FULL_RESYNC:"tierBFullResync",LIMIT:"limit",EXPLAIN_RESOLUTION:"explainResolution",COLLAPSE:"collapse",KEEP_DB:"keepDb",LSP_BINARY_OVERRIDE:"lspBinaryOverride",LSP_ARGS_OVERRIDE:"lspArgsOverride",LSP_TIMEOUT_MS:"lspTimeoutMs",LSP_MAX_PROCESSES:"lspMaxProcesses",TIER_B_COMMIT_CAP:"tierBCommitCap",TIER_C_DAILY_CALL_CAP:"tierCDailyCallCap",TIER_C_DAILY_TOKEN_CAP:"tierCDailyTokenCap",TIER_C_WALL_CLOCK_MS:"tierCWallClockMs",TIER_C_ITEM_CAP:"tierCItemCap",TIER_C_LOAD_THRESHOLD:"tierCLoadThreshold",GIT_NETWORK_TIMEOUT_MS:"gitNetworkTimeoutMs",FORCE:"force",TIER_C_DRAIN_ALL:"tierCDrainAll",AGENT_AUTHORED_DECISIONS:"agentAuthoredDecisions",HOOK_NAME:"hookName",HOOK_ENABLED:"hookEnabled",FLUSH_STAGED_L3:"flushStagedL3"},Me={SCOPE_NOT_FOUND:(e,t)=>`Cannot set "${e}": memory scope "${t}" was never created`},m=class{scopes=new Map;createScope(t){this.scopes.has(t)||this.scopes.set(t,new Map)}set(t,n,o){let i=this.scopes.get(t);if(!i)throw new l(c.MEMORY_SCOPE_NOT_FOUND,Me.SCOPE_NOT_FOUND(n,t));i.set(n,o)}get(t,n){return this.scopes.get(t)?.get(n)}deleteScope(t){this.scopes.delete(t)}hasScope(t){return this.scopes.has(t)}},Fe=new m;var F={REGISTER_LOCKED:e=>`Cannot register "${e}": factory is locked (test isolation)`,PROVIDER_NOT_REGISTERED:e=>`No provider registered for "${e}" \u2014 the implementation library that owns it was never imported for its registration side effect`},S=class{providers=new Map;locked=!1;register(t,n){if(this.locked)throw new l(c.FACTORY_LOCKED,F.REGISTER_LOCKED(String(t.description)));this.providers.set(t,n)}resolve(t,n){let o=this.providers.get(t);if(!o)throw new l(c.FACTORY_TOKEN_NOT_REGISTERED,F.PROVIDER_NOT_REGISTERED(String(t.description)));return o(this,n)}has(t){return this.providers.has(t)}lock(){this.locked=!0}unlock(){this.locked=!1}reset(){this.providers.clear(),this.locked=!1}},k=new S;function r(e){return Symbol(e)}var ke={HostEnvironment:r("HostEnvironmentSnapshot"),GitProvider:r("IGitProvider"),LineBlameProvider:r("ILineBlameProvider"),KnowledgeGitService:r("IKnowledgeGitService"),FileDiscovery:r("IFileDiscovery"),ConfigScanner:r("IConfigScanner"),VcsScanner:r("IVcsScanner"),AstProcessor:r("IAstProcessor"),GraphPersister:r("IGraphPersister"),TempFileManager:r("TempFileManager"),GraphStoreOpener:r("GraphStoreOpener"),ProcessLock:r("ProcessLock"),RemoteSyncClient:r("RemoteSyncClient"),LlmClient:r("LlmClient"),QueryService:r("IQueryService"),TierBCoverageHintProvider:r("ITierBCoverageHintProvider"),ImpactService:r("IImpactService"),ChangeDetectionService:r("IChangeDetectionService"),TopologyBuilder:r("ITopologyBuilder"),SnapshotRenderer:r("ISnapshotRenderer"),HydrationService:r("IHydrationService"),DiagnosticRunnerDb:r("DiagnosticRunnerDb"),DiagnosticRunnerGit:r("DiagnosticRunnerGit"),SemanticDiffAnalyzer:r("ISemanticDiffAnalyzer"),SemanticCorpusService:r("ISemanticCorpusService"),SemanticDecisionValidator:r("ISemanticDecisionValidator"),SemanticDecisionProvider:r("ISemanticDecisionProvider"),CallResolutionHypothesisService:r("ICallResolutionHypothesisService"),EdgeResolutionProviders:r("EdgeResolutionProviders")};var we={ADDED:"added",MODIFIED:"modified",DELETED:"deleted",RENAMED:"renamed"};var Ue={LSP:"lsp",LLM_INFERRED:"llm-inferred"},He={TYPESCRIPT:"typescript",PYTHON:"python",GO:"go",RUST:"rust",JAVA:"java",CPP:"cpp",CSHARP:"csharp",PHP:"php",RUBY:"ruby"};var Ke={EDGE_RELATION:"edge-relation",IMPACT_RELEVANCE:"impact-relevance",NEEDS_VERIFICATION:"needs-verification"};var Ge={CANDIDATE:"candidate",UNKNOWN:"unknown",VERIFY:"verify"},Be=1,Ve={MAX_CANDIDATES:32,MAX_OPTIONS:34,MAX_INPUT_BYTES:32*1024},je={SCORED:"scored",UNAVAILABLE:"unavailable"},Ye={RAW:"raw",CALIBRATED:"calibrated"},Qe={MODEL_NOT_INSTALLED:"model-not-installed",UNSUPPORTED_CAPABILITY:"unsupported-capability"};var qe={NO_REMOTE:"no-remote",UP_TO_DATE:"up-to-date",FAST_FORWARDED_LOCAL:"fast-forwarded-local",PUSHED_LOCAL:"pushed-local",MERGED:"merged"};import{createHash as We}from"crypto";function Xe(e){let t=Je(e.filePath);if(!/^[a-f0-9]{64}$/.test(e.sourceContentHash))throw new Error("Call-site source content hash must be a lowercase SHA-256 hex digest");if(!Number.isSafeInteger(e.startLine)||e.startLine<0)throw new Error("Call-site start line must be a non-negative zero-based integer");if(!Number.isSafeInteger(e.startColumn)||e.startColumn<0)throw new Error("Call-site start column must be a non-negative zero-based integer");if(!w(e.calleeKind))throw new Error("Call-site callee kind must be a non-empty string without NUL bytes");if(!w(e.calleeName))throw new Error("Call-site callee name must be a non-empty string without NUL bytes");return`call-site:v1:${We("sha256").update([t,e.sourceContentHash,String(e.startLine),String(e.startColumn),e.calleeKind,e.calleeName].join("\0"),"utf8").digest("hex")}`}function Je(e){if(typeof e!="string")throw new Error("Call-site path must be a workspace-relative POSIX path");if([e.length===0,e.endsWith("/"),e.startsWith("/"),/^[a-zA-Z]:/.test(e),e.includes("\\"),e.includes("\0")].some(Boolean))throw new Error("Call-site path must be a workspace-relative POSIX path");let n=[];for(let o of e.split("/"))if(!(!o||o===".")){if(o!==".."){n.push(o);continue}if(n.length===0)throw new Error("Call-site path must be a workspace-relative POSIX path");n.pop()}if(n.length===0)throw new Error("Call-site path must be a workspace-relative POSIX path");return n.join("/")}function w(e){return typeof e=="string"&&e.trim().length>0&&!e.includes("\0")}var ze="declared-member-hypothesis-v7",$e="ordered-evidence-v1";var Ze="q2:reexport-trace:v1",et="q3:super-call:v1",tt="q3:this-inherited:v1",nt="q3:typed-receiver:v1",ot="q3:new-receiver:v1";var rt="17f29ba13f08a288186c7bdbed2651248664643f98613df8d3087aade7b4f768";var it={MODULE:"module",PACKAGE:"package",PCD:"pcd"},st={CONTAINS:"contains",CALLS:"calls",IMPLEMENTS:"implements",EXTENDS:"extends",IMPORTS:"imports",DEPENDS_ON:"depends_on",DECISION:"decision"},L={CHANGE:"change",RULE:"rule",DECISION:"decision",CONTEXT:"context"},at={PENDING:"pending",ACTIVE:"active",DRAFT:"draft",GARBAGE:"garbage"},lt={ANALYZE:"analyze",AGENT_AUTHORED:"agent-authored"},ct={PROVEN:"proven",LIKELY:"likely",AMBIGUOUS:"ambiguous",UNRESOLVED:"unresolved",EXTERNAL:"external",UNSUPPORTED:"unsupported"},dt={TIER_B_TARGET_MISMATCH:"tier-b-target-mismatch"},pt={UNVERIFIED:"unverified",VERIFIED:"verified",CONTRADICTED:"contradicted"},ut="sha256-callsite-rule-v2",gt={SCOPE_RESOLVER:"scope-resolver",STRICT_PROOF:"strict-proof",HYPOTHESIS:"hypothesis",TIER_B:"tier-b"};var yt=L,mt={AUTO_FULL_INGESTION:"autoFullIngestion",AUTO_DELTA:"autoDelta",AUTO_DELTA_NOOP:"autoDeltaNoop",DECISION_EXTRACTION:"decisionExtraction",TIER_B_BATCH:"tierBBatch",FLUSH_STAGED_L3:"flushStagedL3"},St={NO_GRAPH:"no-graph",ANCHOR_NOT_IN_GRAPH:"anchor-not-in-graph"};var Et={CREATE_L3:"CREATE_L3"};var _t={SYSTEM:"system",USER:"user",ASSISTANT:"assistant",TOOL:"tool"},Rt="function";var Ct={LOW:"LOW",MEDIUM:"MEDIUM",HIGH:"HIGH",CRITICAL:"CRITICAL",UNKNOWN:"UNKNOWN"},ft={EXACT:"exact",LOWER_BOUND:"lower-bound"},At={BOUNDED:"bounded",UNRESOLVED:"unresolved"},Tt={DYNAMIC_IMPORT:"dynamic-import"},It={CORRUPT_JSON:"corrupt-json",NOT_ARRAY:"not-array",INVALID_RECORD:"invalid-record",MISSING:"missing",INCOMPLETE_SCAN:"incomplete-scan"},Lt={AVAILABLE:"available",UNAVAILABLE:"unavailable"},Nt={LSP_FALLBACK:"lsp-fallback",DYNAMIC_CANDIDATE:"dynamic-candidate"};var Ot={L2:"l2",L3:"l3"};var ht={FILE:"file",SYMBOL:"symbol",DECISION:"decision"},Dt={AUTO:"auto",FILE:"file",SYMBOL:"symbol"},vt={L1_TAG:"l1_tag",DIRECTORY:"directory"};var E={COMMIT_MESSAGE:"commitMessage",CONTRACT_SYMBOL:"contractSymbol"};function xt(e){if(e===void 0)return Ft();let t;try{t=JSON.parse(e)}catch{return U()}if(!Array.isArray(t))return U();let n=[],o=0;for(let i of t)Pt(i)?n.push(i):o++;return{entries:n,invalidCount:o,corrupt:!1}}function Pt(e){return!bt(e)||typeof e.target!="string"||typeof e.commitSha!="string"||!Mt(e)?!1:e.kind===E.COMMIT_MESSAGE?typeof e.message=="string":e.kind===E.CONTRACT_SYMBOL?typeof e.file=="string":!1}function bt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Mt(e){return e.failCount===void 0||typeof e.failCount=="number"&&Number.isInteger(e.failCount)&&e.failCount>=0}function Ft(){return{entries:[],invalidCount:0,corrupt:!1}}function U(){return{entries:[],invalidCount:0,corrupt:!0}}var kt={TYPESCRIPT:"typescript",REACT:"react",EXPRESS:"express",VUE:"vue"},wt={UNKNOWN:"unknown",JAVASCRIPT:"javascript",GENERIC:"generic",RUST:"rust",PYTHON:"python",GO:"go"},Ut="general",Ht={FRONTEND:"frontend",BACKEND:"backend",NEXTJS:"nextjs",SSR:"ssr",DRIZZLE:"drizzle",DATABASE:"database",TAILWINDCSS:"tailwindcss",CSS:"css",JEST:"jest",TESTING:"testing",VITEST:"vitest",POSTGRES:"postgres",MONOREPO:"monorepo",TOKIO:"tokio",ASYNC:"async",ACTIX:"actix",SERDE:"serde",TAURI:"tauri",DESKTOP:"desktop",DJANGO:"django",FASTAPI:"fastapi",PANDAS:"pandas",DATA:"data",GIN:"gin",STRICT_TS:"strict-ts",VITE:"vite",BUILD_TOOL:"build-tool"};var H="origin",N={KNOWLEDGE_ROOT:"docuvia-knowledge",KNOWLEDGE_LOG_SCAN_LIMIT:5e3,KNOWLEDGE_DIR_NAME:"knowledge",GRAPH_DIR_NAME:"graph",L3_DIR_NAME:"_l3",NODES_JSONL_NAME:"nodes.jsonl",EDGES_JSONL_NAME:"edges.jsonl",METADATA_JSON_NAME:"metadata.json",SOURCE_COMMIT_TRAILER_KEY:"Docuvia-Source",POST_COMMIT_HOOK_NAME:"post-commit",POST_COMMIT_HOOK_MARKER:"docuvia analyze",POST_COMMIT_FLUSH_L3_MARKER:"docuvia analyze --flush-staged-l3",POST_COMMIT_NOHUP_MARKER:"nohup npx --no-install docuvia analyze",DOCUVIA_HOOK_HEADER_COMMENT:"# Docuvia Knowledge Graph Evolver Hook",POST_COMMIT_HOOK_CONTENT:`#!/bin/bash
2
+ var a={DEBUG:"debug",INFO:"info",WARN:"warn",ERROR:"error"};var d="ipc-log",se=new Set(Object.values(a));function b(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function A(e){if(!b(e))return!1;let{type:t,level:n,message:o,context:i}=e;return t===d&&typeof n=="string"&&se.has(n)&&typeof o=="string"&&(i===void 0||b(i))}var f=class{constructor(t){this.postMessageFn=t}postMessageFn;debug(t,n){this.send(a.DEBUG,t,n)}info(t,n){this.send(a.INFO,t,n)}warn(t,n){this.send(a.WARN,t,n)}error(t,n){this.send(a.ERROR,t,n)}onLog(){return()=>{}}send(t,n,o){let i=o?{type:d,level:t,message:n,context:o}:{type:d,level:t,message:n};this.postMessageFn(i)}};var y={CONTEXT_INJECTION:"context-injection",COMMIT_L3_WRITE:"commit-l3-write",TIER_B_C_PREPUSH:"tier-b-c-prepush"},ae={[y.CONTEXT_INJECTION]:!0,[y.COMMIT_L3_WRITE]:!0,[y.TIER_B_C_PREPUSH]:!0};var T=".docuvia",le="logs",ce="init.log",de="clean.log",pe="status.log",ue="sync.log",ge="analyze.log",ye="review.log",me="impact.log",Se="query.log",Ee="export-topology.log",_e="snapshot.log",Re="hydrate.log",Ce="sync-knowledge.log",I="node_modules",Ae="local.db",fe="init.lock",Te="tierC.lock",Ie="sync-state.json",Le="hooks-config.json",Ne="pending-l3-decisions.json";var Oe="utf8";var he="sha256";var s={TYPESCRIPT:"typescript",JAVASCRIPT:"javascript",PYTHON:"python",RUST:"rust",GO:"go",JAVA:"java",C:"c",CPP:"cpp",RUBY:"ruby",PHP:"php",CSHARP:"csharp"};var M=".claude/hooks",F=".cursor/hooks",k="docuvia-hook.js",U="docuvia-hook.cjs";var De=[`${M}/${k}`,`${F}/${U}`];function L(e){let t=e.replaceAll("\\","/");return De.includes(t)}var ve="EEXIST",Pe="ENOENT",xe="EPERM",be="EACCES",Me="EBUSY",Fe="win32";var p=class{listeners=new Set;debug(t,n){this.emit(a.DEBUG,t,n)}info(t,n){this.emit(a.INFO,t,n)}warn(t,n){this.emit(a.WARN,t,n)}error(t,n){this.emit(a.ERROR,t,n)}onLog(t){return this.listeners.add(t),()=>this.listeners.delete(t)}emit(t,n,o){let i=o?{level:t,message:n,context:o}:{level:t,message:n};for(let u of this.listeners)u(i)}};function ke(){return new p}var N=class{constructor(t){this.logger=t}logger;handleMessage(t){return A(t)?(this.logger[t.level](t.message,t.context),!0):!1}};var c={GIT_COMMAND_FAILED:"GIT_COMMAND_FAILED",GIT_NETWORK_TIMEOUT:"GIT_NETWORK_TIMEOUT",GIT_NOT_A_REPOSITORY:"GIT_NOT_A_REPOSITORY",GIT_BRANCH_CREATE_FAILED:"GIT_BRANCH_CREATE_FAILED",GIT_HOOK_INSTALL_FAILED:"GIT_HOOK_INSTALL_FAILED",GIT_FAST_IMPORT_FAILED:"GIT_FAST_IMPORT_FAILED",DB_OPEN_FAILED:"DB_OPEN_FAILED",DB_NOT_FOUND:"DB_NOT_FOUND",DB_MIGRATION_FAILED:"DB_MIGRATION_FAILED",DB_QUERY_FAILED:"DB_QUERY_FAILED",DB_LOCKED:"DB_LOCKED",AST_WORKER_CRASHED:"AST_WORKER_CRASHED",AST_PARSE_FAILED:"AST_PARSE_FAILED",CALL_RESOLUTION_PROJECTION_SOURCE_MISSING:"CALL_RESOLUTION_PROJECTION_SOURCE_MISSING",CALL_RESOLUTION_QUARANTINE_UNAVAILABLE:"CALL_RESOLUTION_QUARANTINE_UNAVAILABLE",FS_READ_FAILED:"FS_READ_FAILED",FS_PATH_TRAVERSAL:"FS_PATH_TRAVERSAL",FACTORY_TOKEN_NOT_REGISTERED:"FACTORY_TOKEN_NOT_REGISTERED",FACTORY_LOCKED:"FACTORY_LOCKED",MEMORY_SCOPE_NOT_FOUND:"MEMORY_SCOPE_NOT_FOUND",SYNC_FETCH_FAILED:"SYNC_FETCH_FAILED",SYNC_PUSH_FAILED:"SYNC_PUSH_FAILED",LLM_NOT_INITIALIZED:"LLM_NOT_INITIALIZED",LLM_CHAT_COMPLETION_FAILED:"LLM_CHAT_COMPLETION_FAILED",LLM_HTTP_FAILED:"LLM_HTTP_FAILED",LLM_RATE_LIMITED:"LLM_RATE_LIMITED",LLM_AUTH_FAILED:"LLM_AUTH_FAILED",LLM_STREAM_FAILED:"LLM_STREAM_FAILED",LLM_INVALID_RESPONSE:"LLM_INVALID_RESPONSE",SEMANTIC_CORPUS_LEAKAGE:"SEMANTIC_CORPUS_LEAKAGE",SEMANTIC_CORPUS_IO_FAILED:"SEMANTIC_CORPUS_IO_FAILED",SEMANTIC_CORPUS_INVALID:"SEMANTIC_CORPUS_INVALID",SEMANTIC_INVALID_REQUEST:"SEMANTIC_INVALID_REQUEST",SEMANTIC_INVALID_RESPONSE:"SEMANTIC_INVALID_RESPONSE",SEMANTIC_INPUT_LIMIT_EXCEEDED:"SEMANTIC_INPUT_LIMIT_EXCEEDED",SEMANTIC_CANCELLED:"SEMANTIC_CANCELLED",SEMANTIC_DEADLINE_EXCEEDED:"SEMANTIC_DEADLINE_EXCEEDED",SEMANTIC_INFERENCE_FAILED:"SEMANTIC_INFERENCE_FAILED",INIT_WORKFLOW_FAILED:"INIT_WORKFLOW_FAILED",CLEAN_WORKFLOW_FAILED:"CLEAN_WORKFLOW_FAILED",UNINSTALL_WORKFLOW_FAILED:"UNINSTALL_WORKFLOW_FAILED",INVALID_INPUT:"INVALID_INPUT"};var Ue="DocuviaError",l=class e extends Error{code;cause;constructor(t,n,o){super(n),this.name=Ue,this.code=t,this.cause=o}static wrap(t,n,o){if(o instanceof e)return o;let i=o instanceof Error?o.message:String(o);return new e(t,`${n}: ${i}`,o)}};var we={WORKSPACE_ROOT:"workspaceRoot",API_URL:"apiUrl",PROJECT_ID:"projectId",COMMIT_SHA:"commitSha",TARGET_PATH:"targetPath",LLM_BASE_URL:"llmBaseUrl",LLM_MODEL:"llmModel",BASE_REF:"baseRef",HEAD_REF:"headRef",TARGET:"target",ESCALATE_TO_LSP:"escalateToLsp",TIER_B_FULL_RESYNC:"tierBFullResync",LIMIT:"limit",EXPLAIN_RESOLUTION:"explainResolution",COLLAPSE:"collapse",KEEP_DB:"keepDb",LSP_BINARY_OVERRIDE:"lspBinaryOverride",LSP_ARGS_OVERRIDE:"lspArgsOverride",LSP_TIMEOUT_MS:"lspTimeoutMs",LSP_MAX_PROCESSES:"lspMaxProcesses",TIER_B_COMMIT_CAP:"tierBCommitCap",TIER_C_DAILY_CALL_CAP:"tierCDailyCallCap",TIER_C_DAILY_TOKEN_CAP:"tierCDailyTokenCap",TIER_C_WALL_CLOCK_MS:"tierCWallClockMs",TIER_C_ITEM_CAP:"tierCItemCap",TIER_C_LOAD_THRESHOLD:"tierCLoadThreshold",GIT_NETWORK_TIMEOUT_MS:"gitNetworkTimeoutMs",FORCE:"force",TIER_C_DRAIN_ALL:"tierCDrainAll",AGENT_AUTHORED_DECISIONS:"agentAuthoredDecisions",HOOK_NAME:"hookName",HOOK_ENABLED:"hookEnabled",FLUSH_STAGED_L3:"flushStagedL3"},He={SCOPE_NOT_FOUND:(e,t)=>`Cannot set "${e}": memory scope "${t}" was never created`},m=class{scopes=new Map;createScope(t){this.scopes.has(t)||this.scopes.set(t,new Map)}set(t,n,o){let i=this.scopes.get(t);if(!i)throw new l(c.MEMORY_SCOPE_NOT_FOUND,He.SCOPE_NOT_FOUND(n,t));i.set(n,o)}get(t,n){return this.scopes.get(t)?.get(n)}deleteScope(t){this.scopes.delete(t)}hasScope(t){return this.scopes.has(t)}},Ge=new m;var w={REGISTER_LOCKED:e=>`Cannot register "${e}": factory is locked (test isolation)`,PROVIDER_NOT_REGISTERED:e=>`No provider registered for "${e}" \u2014 the implementation library that owns it was never imported for its registration side effect`},S=class{providers=new Map;locked=!1;register(t,n){if(this.locked)throw new l(c.FACTORY_LOCKED,w.REGISTER_LOCKED(String(t.description)));this.providers.set(t,n)}resolve(t,n){let o=this.providers.get(t);if(!o)throw new l(c.FACTORY_TOKEN_NOT_REGISTERED,w.PROVIDER_NOT_REGISTERED(String(t.description)));return o(this,n)}has(t){return this.providers.has(t)}lock(){this.locked=!0}unlock(){this.locked=!1}reset(){this.providers.clear(),this.locked=!1}},H=new S;function r(e){return Symbol(e)}var Ke={HostEnvironment:r("HostEnvironmentSnapshot"),GitProvider:r("IGitProvider"),LineBlameProvider:r("ILineBlameProvider"),KnowledgeGitService:r("IKnowledgeGitService"),FileDiscovery:r("IFileDiscovery"),ConfigScanner:r("IConfigScanner"),VcsScanner:r("IVcsScanner"),AstProcessor:r("IAstProcessor"),GraphPersister:r("IGraphPersister"),TempFileManager:r("TempFileManager"),GraphStoreOpener:r("GraphStoreOpener"),ProcessLock:r("ProcessLock"),RemoteSyncClient:r("RemoteSyncClient"),LlmClient:r("LlmClient"),QueryService:r("IQueryService"),TierBCoverageHintProvider:r("ITierBCoverageHintProvider"),ImpactService:r("IImpactService"),ChangeDetectionService:r("IChangeDetectionService"),TopologyBuilder:r("ITopologyBuilder"),SnapshotRenderer:r("ISnapshotRenderer"),HydrationService:r("IHydrationService"),DiagnosticRunnerDb:r("DiagnosticRunnerDb"),DiagnosticRunnerGit:r("DiagnosticRunnerGit"),SemanticDiffAnalyzer:r("ISemanticDiffAnalyzer"),SemanticCorpusService:r("ISemanticCorpusService"),SemanticDecisionValidator:r("ISemanticDecisionValidator"),SemanticDecisionProvider:r("ISemanticDecisionProvider"),CallResolutionHypothesisService:r("ICallResolutionHypothesisService"),EdgeResolutionProviders:r("EdgeResolutionProviders")};var Be={ADDED:"added",MODIFIED:"modified",DELETED:"deleted",RENAMED:"renamed"};var je={LSP:"lsp",LLM_INFERRED:"llm-inferred"},Ve={TYPESCRIPT:"typescript",PYTHON:"python",GO:"go",RUST:"rust",JAVA:"java",CPP:"cpp",CSHARP:"csharp",PHP:"php",RUBY:"ruby"};var Ye={EDGE_RELATION:"edge-relation",IMPACT_RELEVANCE:"impact-relevance",NEEDS_VERIFICATION:"needs-verification"};var Qe={CANDIDATE:"candidate",UNKNOWN:"unknown",VERIFY:"verify"},qe=1,We={MAX_CANDIDATES:32,MAX_OPTIONS:34,MAX_INPUT_BYTES:32*1024},Xe={SCORED:"scored",UNAVAILABLE:"unavailable"},Je={RAW:"raw",CALIBRATED:"calibrated"},ze={MODEL_NOT_INSTALLED:"model-not-installed",UNSUPPORTED_CAPABILITY:"unsupported-capability"};var $e={NO_REMOTE:"no-remote",UP_TO_DATE:"up-to-date",FAST_FORWARDED_LOCAL:"fast-forwarded-local",PUSHED_LOCAL:"pushed-local",MERGED:"merged"};import{createHash as Ze}from"crypto";function et(e){let t=tt(e.filePath);if(!/^[a-f0-9]{64}$/.test(e.sourceContentHash))throw new Error("Call-site source content hash must be a lowercase SHA-256 hex digest");if(!Number.isSafeInteger(e.startLine)||e.startLine<0)throw new Error("Call-site start line must be a non-negative zero-based integer");if(!Number.isSafeInteger(e.startColumn)||e.startColumn<0)throw new Error("Call-site start column must be a non-negative zero-based integer");if(!G(e.calleeKind))throw new Error("Call-site callee kind must be a non-empty string without NUL bytes");if(!G(e.calleeName))throw new Error("Call-site callee name must be a non-empty string without NUL bytes");return`call-site:v1:${Ze("sha256").update([t,e.sourceContentHash,String(e.startLine),String(e.startColumn),e.calleeKind,e.calleeName].join("\0"),"utf8").digest("hex")}`}function tt(e){if(typeof e!="string")throw new Error("Call-site path must be a workspace-relative POSIX path");if([e.length===0,e.endsWith("/"),e.startsWith("/"),/^[a-zA-Z]:/.test(e),e.includes("\\"),e.includes("\0")].some(Boolean))throw new Error("Call-site path must be a workspace-relative POSIX path");let n=[];for(let o of e.split("/"))if(!(!o||o===".")){if(o!==".."){n.push(o);continue}if(n.length===0)throw new Error("Call-site path must be a workspace-relative POSIX path");n.pop()}if(n.length===0)throw new Error("Call-site path must be a workspace-relative POSIX path");return n.join("/")}function G(e){return typeof e=="string"&&e.trim().length>0&&!e.includes("\0")}var nt="declared-member-hypothesis-v7",ot="ordered-evidence-v1";var rt="q1:named-import:v1",it="q2:reexport-trace:v1",st="q3:super-call:v1",at="q3:this-inherited:v1",lt="q3:typed-receiver:v1",ct="q3:new-receiver:v1";var dt="17f29ba13f08a288186c7bdbed2651248664643f98613df8d3087aade7b4f768";var pt={MODULE:"module",PACKAGE:"package",PCD:"pcd"},E={CONTAINS:"contains",LEXICAL_PARENT:"lexical_parent",LEXICAL_OWNER:"lexical_owner",CALLS:"calls",IMPLEMENTS:"implements",EXTENDS:"extends",IMPORTS:"imports",DEPENDS_ON:"depends_on",DECISION:"decision"},ut=[E.CONTAINS,E.LEXICAL_PARENT,E.LEXICAL_OWNER],O={CHANGE:"change",RULE:"rule",DECISION:"decision",CONTEXT:"context"},gt={PENDING:"pending",ACTIVE:"active",DRAFT:"draft",GARBAGE:"garbage"},yt={ANALYZE:"analyze",AGENT_AUTHORED:"agent-authored"},mt={PROVEN:"proven",LIKELY:"likely",AMBIGUOUS:"ambiguous",UNRESOLVED:"unresolved",EXTERNAL:"external",UNSUPPORTED:"unsupported"},St={TIER_B_TARGET_MISMATCH:"tier-b-target-mismatch"},Et={UNVERIFIED:"unverified",VERIFIED:"verified",CONTRADICTED:"contradicted"},_t="sha256-callsite-rule-v2",Rt={SCOPE_RESOLVER:"scope-resolver",STRICT_PROOF:"strict-proof",HYPOTHESIS:"hypothesis",TIER_B:"tier-b"};var Ct=O,At={AUTO_FULL_INGESTION:"autoFullIngestion",AUTO_DELTA:"autoDelta",AUTO_DELTA_NOOP:"autoDeltaNoop",DECISION_EXTRACTION:"decisionExtraction",TIER_B_BATCH:"tierBBatch",FLUSH_STAGED_L3:"flushStagedL3"},ft={NO_GRAPH:"no-graph",ANCHOR_NOT_IN_GRAPH:"anchor-not-in-graph"};var Tt={CREATE_L3:"CREATE_L3"};var It={SYSTEM:"system",USER:"user",ASSISTANT:"assistant",TOOL:"tool"},Lt="function";var Nt={LOW:"LOW",MEDIUM:"MEDIUM",HIGH:"HIGH",CRITICAL:"CRITICAL",UNKNOWN:"UNKNOWN"},Ot={EXACT:"exact",LOWER_BOUND:"lower-bound"},ht={BOUNDED:"bounded",UNRESOLVED:"unresolved"},Dt={DYNAMIC_IMPORT:"dynamic-import"},vt={CORRUPT_JSON:"corrupt-json",NOT_ARRAY:"not-array",INVALID_RECORD:"invalid-record",MISSING:"missing",INCOMPLETE_SCAN:"incomplete-scan"},Pt={AVAILABLE:"available",UNAVAILABLE:"unavailable"},xt={LSP_FALLBACK:"lsp-fallback",DYNAMIC_CANDIDATE:"dynamic-candidate"};var bt={L2:"l2",L3:"l3"};var Mt={FILE:"file",SYMBOL:"symbol",DECISION:"decision"},Ft={AUTO:"auto",FILE:"file",SYMBOL:"symbol"},kt={L1_TAG:"l1_tag",DIRECTORY:"directory"};var _={COMMIT_MESSAGE:"commitMessage",CONTRACT_SYMBOL:"contractSymbol"};function Ut(e){if(e===void 0)return Kt();let t;try{t=JSON.parse(e)}catch{return K()}if(!Array.isArray(t))return K();let n=[],o=0;for(let i of t)wt(i)?n.push(i):o++;return{entries:n,invalidCount:o,corrupt:!1}}function wt(e){return!Ht(e)||typeof e.target!="string"||typeof e.commitSha!="string"||!Gt(e)?!1:e.kind===_.COMMIT_MESSAGE?typeof e.message=="string":e.kind===_.CONTRACT_SYMBOL?typeof e.file=="string":!1}function Ht(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Gt(e){return e.failCount===void 0||typeof e.failCount=="number"&&Number.isInteger(e.failCount)&&e.failCount>=0}function Kt(){return{entries:[],invalidCount:0,corrupt:!1}}function K(){return{entries:[],invalidCount:0,corrupt:!0}}var Bt={TYPESCRIPT:"typescript",REACT:"react",EXPRESS:"express",VUE:"vue"},jt={UNKNOWN:"unknown",JAVASCRIPT:"javascript",GENERIC:"generic",RUST:"rust",PYTHON:"python",GO:"go"},Vt="general",Yt={FRONTEND:"frontend",BACKEND:"backend",NEXTJS:"nextjs",SSR:"ssr",DRIZZLE:"drizzle",DATABASE:"database",TAILWINDCSS:"tailwindcss",CSS:"css",JEST:"jest",TESTING:"testing",VITEST:"vitest",POSTGRES:"postgres",MONOREPO:"monorepo",TOKIO:"tokio",ASYNC:"async",ACTIX:"actix",SERDE:"serde",TAURI:"tauri",DESKTOP:"desktop",DJANGO:"django",FASTAPI:"fastapi",PANDAS:"pandas",DATA:"data",GIN:"gin",STRICT_TS:"strict-ts",VITE:"vite",BUILD_TOOL:"build-tool"};var B="origin",h={KNOWLEDGE_ROOT:"docuvia-knowledge",KNOWLEDGE_LOG_SCAN_LIMIT:5e3,KNOWLEDGE_DIR_NAME:"knowledge",GRAPH_DIR_NAME:"graph",L3_DIR_NAME:"_l3",NODES_JSONL_NAME:"nodes.jsonl",EDGES_JSONL_NAME:"edges.jsonl",METADATA_JSON_NAME:"metadata.json",SOURCE_COMMIT_TRAILER_KEY:"Docuvia-Source",POST_COMMIT_HOOK_NAME:"post-commit",POST_COMMIT_HOOK_MARKER:"docuvia analyze",POST_COMMIT_FLUSH_L3_MARKER:"docuvia analyze --flush-staged-l3",POST_COMMIT_NOHUP_MARKER:"nohup npx --no-install docuvia analyze",DOCUVIA_HOOK_HEADER_COMMENT:"# Docuvia Knowledge Graph Evolver Hook",POST_COMMIT_HOOK_CONTENT:`#!/bin/bash
3
3
  # Docuvia Knowledge Graph Evolver Hook
4
4
  # Non-intrusively extracts AST deltas in the background
5
5
  if command -v npx > /dev/null 2>&1; then
@@ -35,7 +35,7 @@ if command -v npx &> /dev/null; then
35
35
  # Fire and forget (do not block commit)
36
36
  npx --no-install docuvia snapshot > /dev/null 2>&1 &
37
37
  fi
38
- `,LOCAL_REMOTE_URL_SCHEME:"file://",DEFAULT_REMOTE_NAME:H,REMOTE_REF_PREFIX:"refs/remotes/",HEAD_REF:"HEAD",DEFAULT_LOCAL_PROJECT_ID:1,META_KEY_KNOWLEDGE_TIP_SHA:"hydratedKnowledgeSha",META_KEY_LAST_INGESTED_SOURCE_SHA:"lastIngestedSourceSha",META_KEY_NODE_KEY_FORMAT_VERSION:"nodeKeyFormatVersion",META_KEY_TIER_B_QUEUE:"tierBQueue",EMPTY_KNOWLEDGE_TEMP_DIR_PREFIX:"docuvia-empty-knowledge-",META_KEY_LAST_TIER_B_BATCH_SHA:"lastTierBBatchSha",META_KEY_TIER_B_BATCH_PENDING:"tierBBatchPending",META_KEY_KNOWLEDGE_PACK_PENDING:"knowledgePackPending",META_KEY_TIER_B_CHANGED_BYTES:"tierBChangedBytes",DEFAULT_TIER_B_COMMIT_CAP_BYTES:512e3,DEFAULT_TIER_B_COVERAGE_FAIL_THRESHOLD:.5,DEFAULT_L2_SEMANTIC_COVERAGE_FAIL_THRESHOLD:.1,DEFAULT_STAGED_L3_STRANDED_AFTER_MS:864e5,META_KEY_TIER_B_ZERO_PROGRESS_BATCHES:"tierBZeroProgressBatches",DEFAULT_TIER_B_ZERO_PROGRESS_MAX_BATCHES:3,DEFAULT_POST_COMMIT_INGESTION_GRACE_MS:6e5,META_KEY_CALL_RESOLUTION_STATS:"callResolutionStats",DEFAULT_CALL_RESOLUTION_NOTE_THRESHOLD:.5,DEFAULT_CALL_RESOLUTION_MIN_SAMPLE:5,DEFAULT_CANARY_SAMPLE_SIZE:20,PRE_PUSH_HOOK_NAME:"pre-push",PRE_PUSH_HOOK_MARKER:"docuvia analyze --escalate-to-lsp",PRE_PUSH_SYNC_KNOWLEDGE_MARKER:"docuvia sync-knowledge",PRE_PUSH_ENV_GATE_MARKER:"--fallback-ast",PRE_PUSH_HOOKS_CHECK_MARKER:"docuvia hooks check",PRE_PUSH_FAILURE_HINT_MARKER:"tier-b/sync failed",PRE_PUSH_HOOK_CONTENT:`#!/bin/bash
38
+ `,LOCAL_REMOTE_URL_SCHEME:"file://",DEFAULT_REMOTE_NAME:B,REMOTE_REF_PREFIX:"refs/remotes/",HEAD_REF:"HEAD",DEFAULT_LOCAL_PROJECT_ID:1,META_KEY_KNOWLEDGE_TIP_SHA:"hydratedKnowledgeSha",META_KEY_LAST_INGESTED_SOURCE_SHA:"lastIngestedSourceSha",META_KEY_NODE_KEY_FORMAT_VERSION:"nodeKeyFormatVersion",META_KEY_TIER_B_QUEUE:"tierBQueue",EMPTY_KNOWLEDGE_TEMP_DIR_PREFIX:"docuvia-empty-knowledge-",META_KEY_LAST_TIER_B_BATCH_SHA:"lastTierBBatchSha",META_KEY_TIER_B_BATCH_PENDING:"tierBBatchPending",META_KEY_KNOWLEDGE_PACK_PENDING:"knowledgePackPending",META_KEY_TIER_B_CHANGED_BYTES:"tierBChangedBytes",DEFAULT_TIER_B_COMMIT_CAP_BYTES:512e3,DEFAULT_TIER_B_COVERAGE_FAIL_THRESHOLD:.5,DEFAULT_L2_SEMANTIC_COVERAGE_FAIL_THRESHOLD:.1,DEFAULT_STAGED_L3_STRANDED_AFTER_MS:864e5,META_KEY_TIER_B_ZERO_PROGRESS_BATCHES:"tierBZeroProgressBatches",DEFAULT_TIER_B_ZERO_PROGRESS_MAX_BATCHES:3,DEFAULT_POST_COMMIT_INGESTION_GRACE_MS:6e5,META_KEY_CALL_RESOLUTION_STATS:"callResolutionStats",DEFAULT_CALL_RESOLUTION_NOTE_THRESHOLD:.5,DEFAULT_CALL_RESOLUTION_MIN_SAMPLE:5,DEFAULT_CANARY_SAMPLE_SIZE:20,PRE_PUSH_HOOK_NAME:"pre-push",PRE_PUSH_HOOK_MARKER:"docuvia analyze --escalate-to-lsp",PRE_PUSH_SYNC_KNOWLEDGE_MARKER:"docuvia sync-knowledge",PRE_PUSH_ENV_GATE_MARKER:"--fallback-ast",PRE_PUSH_HOOKS_CHECK_MARKER:"docuvia hooks check",PRE_PUSH_FAILURE_HINT_MARKER:"tier-b/sync failed",PRE_PUSH_HOOK_CONTENT:`#!/bin/bash
39
39
  # Docuvia Tier B Batch Hook (LSP escalation + snapshot + knowledge sync)
40
40
  # Runs synchronously (generous timeout) so pushed code carries corrected knowledge -- see
41
41
  # docs/gitbook/analysis/phase1-decision-integration.md \xA78h and
@@ -94,6 +94,6 @@ fi
94
94
  # Never blocks the push on a Tier B failure -- PLAT-007's reliability requirement (failures
95
95
  # only ever surface via JSONL logs / doctor, never to the pushing developer).
96
96
  exit 0
97
- `,META_KEY_TIER_C_QUEUE:"tierCQueue",META_KEY_TIER_C_BUDGET:"tierCBudget",DEFAULT_TIER_C_DAILY_CALL_CAP:50,DEFAULT_TIER_C_DAILY_TOKEN_CAP:1e5,DEFAULT_TIER_C_WALL_CLOCK_MS:12e3,DEFAULT_TIER_C_ITEM_CAP:20,DEFAULT_TIER_C_LOAD_THRESHOLD:.8,DEFAULT_TIER_C_MAX_ITEM_FAILURES:3};import _ from"path";var K=[".ts",".tsx",".mts",".cts"],G=[".js",".jsx",".mjs",".cjs"],B=[".py"],V=[".rs"],j=[".go"],Y=[".java"],Q=[".c",".h"],q=[".cpp",".cxx",".cc",".hpp",".hxx",".hh",".cu",".cuh"],W=[".rb",".rake",".gemspec"],X=[".php",".phtml",".php3",".php4",".php5",".phps"],J=[".cs"],O=new Set(["Rakefile","Gemfile","Guardfile","Vagrantfile","Brewfile"]),h=(()=>{let e=new Map,t=[[s.TYPESCRIPT,K],[s.JAVASCRIPT,G],[s.PYTHON,B],[s.RUST,V],[s.GO,j],[s.JAVA,Y],[s.C,Q],[s.CPP,q],[s.RUBY,W],[s.PHP,X],[s.CSHARP,J]];for(let[n,o]of t)for(let i of o)e.set(i,n);return e})();function Kt(e){let t=h.get(_.extname(e).toLowerCase());return t||(O.has(_.basename(e))?s.RUBY:void 0)}function z(e){return h.has(_.extname(e).toLowerCase())?!0:O.has(_.basename(e))}function Gt(){return Array.from(h.keys()).map(e=>e.replace(/^\./,""))}function Bt(e){return!T(e)&&z(e)&&!e.includes(`${A}/`)&&!e.includes(`${f}/`)}var Vt="call-sites.jsonl";var jt="call-resolutions.jsonl",Yt="impact.dynamic-dependencies.v1:",Qt="snapshot.call-sites.availability.v1:",qt={AVAILABLE:"available",UNAVAILABLE:"unavailable"},Wt="snapshot-call-sites-unavailable",Xt="snapshot.call-resolutions.availability.v1:",Jt={AVAILABLE:"available",UNAVAILABLE:"unavailable"};var zt={TIMED_OUT_WAITING:e=>`Timed out waiting for the lock at ${e} \u2014 another process may be stuck`},D=class extends Error{constructor(t){super(zt.TIMED_OUT_WAITING(t)),this.name="ProcessLockTimeoutError"}};var $=`${N.SOURCE_COMMIT_TRAILER_KEY}: `;function $t(e){for(let t of e.split(`
98
- `)){let n=t.trim();if(n.startsWith($))return n.slice($.length).trim()}}function Zt(e,t,n,o){if(!n&&!o)return;let u=(t?e.files.getTierBFileStatus(t):void 0)?.lastProcessedAt??null,Z=o&&u===null,g=e.files.getTierBCoverage(),ee=n&&g.processedFiles<g.totalFiles;if(!(!Z&&!ee))return{ownFileLastProcessedAt:u,workspaceFilesProcessed:g.processedFiles,workspaceFilesTotal:g.totalFiles}}function en(e){let t={total:0,resolved:0,selfDiscarded:0,unresolved:0,unresolvable:0,external:0,unknownReceiver:0};for(let n of Object.values(e))t.total+=n.total,t.resolved+=n.resolved,t.selfDiscarded+=n.selfDiscarded,t.unresolvable=(t.unresolvable??0)+(n.unresolvable??0),t.external=(t.external??0)+(n.external??0),t.unknownReceiver=(t.unknownReceiver??0)+(n.unknownReceiver??0),t.unresolved+=n.unresolved;return t}function tn(e){return e.total-e.selfDiscarded-(e.unresolvable??0)-(e.external??0)-(e.unknownReceiver??0)}var nn={PASS:"pass",FAIL:"fail"};export{a,p as b,xe as c,C as d,I as e,c as f,l as g,be as h,Fe as i,k as j,ke as k,we as l,Ue as m,He as n,Ke as o,Ge as p,Be as q,Ve as r,je as s,Ye as t,Qe as u,qe as v,Xe as w,ze as x,$e as y,Ze as z,et as A,tt as B,nt as C,ot as D,rt as E,it as F,st as G,at as H,lt as I,ct as J,dt as K,pt as L,ut as M,gt as N,yt as O,mt as P,St as Q,Et as R,_t as S,Rt as T,Ct as U,ft as V,At as W,Tt as X,It as Y,Lt as Z,Nt as _,Ot as $,ht as aa,Dt as ba,vt as ca,y as da,ne as ea,E as fa,xt as ga,f as ha,oe as ia,re as ja,ie as ka,se as la,ae as ma,le as na,ce as oa,de as pa,pe as qa,ue as ra,ge as sa,ye as ta,me as ua,A as va,Se as wa,Ee as xa,_e as ya,Re as za,Ce as Aa,fe as Ba,kt as Ca,wt as Da,Ut as Ea,Ht as Fa,Ae as Ga,Te as Ha,H as Ia,N as Ja,s as Ka,x as La,P as Ma,b as Na,M as Oa,T as Pa,K as Qa,G as Ra,B as Sa,V as Ta,j as Ua,Y as Va,Q as Wa,q as Xa,W as Ya,X as Za,J as _a,O as $a,Kt as ab,z as bb,Gt as cb,Bt as db,Vt as eb,jt as fb,Yt as gb,Qt as hb,qt as ib,Wt as jb,Xt as kb,Jt as lb,Le as mb,Ne as nb,Oe as ob,he as pb,De as qb,ve as rb,D as sb,$t as tb,Zt as ub,en as vb,tn as wb,nn as xb};
99
- //# sourceMappingURL=chunk-2OLMINDD.js.map
97
+ `,META_KEY_TIER_C_QUEUE:"tierCQueue",META_KEY_TIER_C_BUDGET:"tierCBudget",DEFAULT_TIER_C_DAILY_CALL_CAP:50,DEFAULT_TIER_C_DAILY_TOKEN_CAP:1e5,DEFAULT_TIER_C_WALL_CLOCK_MS:12e3,DEFAULT_TIER_C_ITEM_CAP:20,DEFAULT_TIER_C_LOAD_THRESHOLD:.8,DEFAULT_TIER_C_MAX_ITEM_FAILURES:3};import R from"path";var j=[".ts",".tsx",".mts",".cts"],V=[".js",".jsx",".mjs",".cjs"],Y=[".py"],Q=[".rs"],q=[".go"],W=[".java"],X=[".c",".h"],J=[".cpp",".cxx",".cc",".hpp",".hxx",".hh",".cu",".cuh"],z=[".rb",".rake",".gemspec"],$=[".php",".phtml",".php3",".php4",".php5",".phps"],Z=[".cs"],D=new Set(["Rakefile","Gemfile","Guardfile","Vagrantfile","Brewfile"]),v=(()=>{let e=new Map,t=[[s.TYPESCRIPT,j],[s.JAVASCRIPT,V],[s.PYTHON,Y],[s.RUST,Q],[s.GO,q],[s.JAVA,W],[s.C,X],[s.CPP,J],[s.RUBY,z],[s.PHP,$],[s.CSHARP,Z]];for(let[n,o]of t)for(let i of o)e.set(i,n);return e})();function Qt(e){let t=v.get(R.extname(e).toLowerCase());return t||(D.has(R.basename(e))?s.RUBY:void 0)}function ee(e){return v.has(R.extname(e).toLowerCase())?!0:D.has(R.basename(e))}function qt(){return Array.from(v.keys()).map(e=>e.replace(/^\./,""))}function Wt(e){return!L(e)&&ee(e)&&!e.includes(`${I}/`)&&!e.includes(`${T}/`)}var Xt="call-sites.jsonl";var Jt="call-resolutions.jsonl",zt="impact.dynamic-dependencies.v1:",$t="snapshot.call-sites.availability.v1:",Zt={AVAILABLE:"available",UNAVAILABLE:"unavailable"},en="snapshot-call-sites-unavailable",tn="snapshot.call-resolutions.availability.v1:",nn={AVAILABLE:"available",UNAVAILABLE:"unavailable"};var C={SCOPE_RESOLVER_V1:"scope-resolver-v1",EXACT_ENCLOSING_V1:"exact-enclosing-v1",EXACT_ENCLOSING_V2:"exact-enclosing-v2"};function te(e){return typeof e=="string"&&Object.values(C).some(t=>t===e)}var ne=C.SCOPE_RESOLVER_V1,P="DOCUVIA_CALLS_CALLER_POLICY";function on(e){let t=e[P]?.trim();if(!t)return ne;if(te(t))return t;throw new l(c.INVALID_INPUT,`${P}=${t} is not one of: ${Object.values(C).join(", ")}`)}var rn="graph.calls-projection.caller-policy.v1:",sn=1;var an={TIMED_OUT_WAITING:e=>`Timed out waiting for the lock at ${e} \u2014 another process may be stuck`},x=class extends Error{constructor(t){super(an.TIMED_OUT_WAITING(t)),this.name="ProcessLockTimeoutError"}};var oe=`${h.SOURCE_COMMIT_TRAILER_KEY}: `;function ln(e){for(let t of e.split(`
98
+ `)){let n=t.trim();if(n.startsWith(oe))return n.slice(oe.length).trim()}}function cn(e,t,n,o){if(!n&&!o)return;let u=(t?e.files.getTierBFileStatus(t):void 0)?.lastProcessedAt??null,re=o&&u===null,g=e.files.getTierBCoverage(),ie=n&&g.processedFiles<g.totalFiles;if(!(!re&&!ie))return{ownFileLastProcessedAt:u,workspaceFilesProcessed:g.processedFiles,workspaceFilesTotal:g.totalFiles}}function dn(e){let t={total:0,resolved:0,selfDiscarded:0,unresolved:0,unresolvable:0,external:0,unknownReceiver:0};for(let n of Object.values(e))t.total+=n.total,t.resolved+=n.resolved,t.selfDiscarded+=n.selfDiscarded,t.unresolvable=(t.unresolvable??0)+(n.unresolvable??0),t.external=(t.external??0)+(n.external??0),t.unknownReceiver=(t.unknownReceiver??0)+(n.unknownReceiver??0),t.unresolved+=n.unresolved;return t}function pn(e){return e.total-e.selfDiscarded-(e.unresolvable??0)-(e.external??0)-(e.unknownReceiver??0)}var un={PASS:"pass",FAIL:"fail"};export{a,p as b,ke as c,f as d,N as e,c as f,l as g,we as h,Ge as i,H as j,Ke as k,Be as l,je as m,Ve as n,Ye as o,Qe as p,qe as q,We as r,Xe as s,Je as t,ze as u,$e as v,et as w,nt as x,ot as y,rt as z,it as A,st as B,at as C,lt as D,ct as E,dt as F,pt as G,E as H,ut as I,gt as J,yt as K,mt as L,St as M,Et as N,_t as O,Rt as P,Ct as Q,At as R,ft as S,Tt as T,It as U,Lt as V,Nt as W,Ot as X,ht as Y,Dt as Z,vt as _,Pt as $,xt as aa,bt as ba,Mt as ca,Ft as da,kt as ea,y as fa,ae as ga,_ as ha,Ut as ia,T as ja,le as ka,ce as la,de as ma,pe as na,ue as oa,ge as pa,ye as qa,me as ra,Se as sa,Ee as ta,_e as ua,Re as va,Ce as wa,I as xa,Ae as ya,fe as za,Te as Aa,Ie as Ba,Le as Ca,Ne as Da,Bt as Ea,jt as Fa,Vt as Ga,Yt as Ha,Oe as Ia,he as Ja,B as Ka,h as La,s as Ma,M as Na,F as Oa,k as Pa,U as Qa,L as Ra,j as Sa,V as Ta,Y as Ua,Q as Va,q as Wa,W as Xa,X as Ya,J as Za,z as _a,$ as $a,Z as ab,D as bb,Qt as cb,ee as db,qt as eb,Wt as fb,Xt as gb,Jt as hb,zt as ib,$t as jb,Zt as kb,en as lb,tn as mb,nn as nb,C as ob,te as pb,ne as qb,on as rb,rn as sb,sn as tb,ve as ub,Pe as vb,xe as wb,be as xb,Me as yb,Fe as zb,x as Ab,ln as Bb,cn as Cb,dn as Db,pn as Eb,un as Fb};
99
+ //# sourceMappingURL=chunk-UUYEPLGA.js.map