@magic5644/graph-it-live 1.9.5 → 1.9.6

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.
@@ -42155,9 +42155,9 @@ Node text: ${this.#t}`),new x.errors.InvalidOperationError(o)}return this.#e}con
42155
42155
  `)}getTags(){return this.compilerNode.tags?.map(o=>this._getNodeFromCompilerNode(o))??[]}getInnerText(){return hDe(this.getText())}getComment(){if(this.compilerNode.comment!=null)return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:this.compilerNode.comment.map(o=>this._getNodeFromCompilerNodeIfExists(o))}getCommentText(){return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:x.ts.getTextOfJSDocComment(this.compilerNode.comment)}getDescription(){let o=this.getSourceFile().getFullText(),d=this.getTags()[0]?.getStart()??this.getEnd()-2,g=E(this);return hDe(o.substring(g,Math.max(g,R())));function E(G){let le=G.getStart()+3;return o.charCodeAt(le)===Af.SPACE?le+1:le}function R(){let G=Mx(o,d,le=>le===Af.NEWLINE||!x.StringUtils.isWhitespaceCharCode(le)&&le!==Af.ASTERISK);return Mx(o,G,le=>le!==Af.NEWLINE&&le!==Af.CARRIAGE_RETURN)}}setDescription(o){let d=this.getTags(),g=this.getStart()+3,E=d.length>0?Mx(this._sourceFile.getFullText(),d[0].getStart(),G=>G===Af.ASTERISK)-1:this.getEnd()-2;return Bkt({parent:this,newText:R.call(this),replacePos:g,replacingLength:E-g}),this;function R(){let G=this.getIndentationText(),le=this._context.manipulationSettings.getNewLineKindAsString(),Re=t0(this._getWriter(),o).split(/\r?\n/),nt=Re[0].length===0,at=Re.length===1&&(this.compilerNode.tags?.length??0)===0,dt=at?Re[0]:Re.map(xe=>xe.length===0?`${G} *`:`${G} * ${xe}`).slice(nt?1:0).join(le);return at?" "+dt+" ":le+dt+le+G+" "}}addTag(o){return this.addTags([o])[0]}addTags(o){return this.insertTags(this.compilerNode.tags?.length??0,o)}insertTag(o,d){return this.insertTags(o,[d])[0]}insertTags(o,d){if(x.ArrayUtils.isNullOrEmpty(d))return[];let g=this._getWriterWithQueuedIndentation(),E=this.getTags();if(o=wp(o,E.length),E.length===0&&!this.isMultiLine()){let le=this._context.structurePrinterFactory.forJSDoc();this.replaceWithText(Re=>{le.printText(Re,{description:this.getDescription(),tags:d})})}else{let le=this._context.structurePrinterFactory.forJSDocTag({printStarsOnNewLine:!0});g.newLine().write(" * "),le.printTexts(g,d),g.newLine().write(" *"),g.conditionalWrite(o<E.length," ");let Re=R.call(this),nt=G.call(this);pa({parent:this,insertPos:Re,replacing:{textLength:nt-Re},newText:g.toString()})}return yh(E,this.getTags(),o,!1);function R(){let le=o<E.length?E[o].getStart():this.getEnd()-2,Re=this.getStart()+3;return Math.max(Re,Mx(this.getSourceFile().getFullText(),le,nt=>!x.StringUtils.isWhitespaceCharCode(nt)&&nt!==Af.ASTERISK))}function G(){return o<E.length?E[o].getStart():this.getEnd()-1}}remove(){hc({children:[this],removeFollowingSpaces:!0,removeFollowingNewLines:!0})}set(o){return Ua(Mee.prototype,this,o),o.tags!=null?this.replaceWithText(d=>{this._context.structurePrinterFactory.forJSDoc().printText(d,{description:o.description??this.getDescription(),tags:o.tags})}):(o.description!=null&&this.setDescription(o.description),this)}getStructure(){return ns(Mee.prototype,this,{kind:te.StructureKind.JSDoc,description:this.getDescription(),tags:this.getTags().map(o=>o.getStructure())})}},Df=class extends yn{},Kqe=foe(Df),mw=class extends Kqe{},Vne=class extends Df{getElementTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.elementType)}},jne=class extends Df{getCheckType(){return this._getNodeFromCompilerNode(this.compilerNode.checkType)}getExtendsType(){return this._getNodeFromCompilerNode(this.compilerNode.extendsType)}getTrueType(){return this._getNodeFromCompilerNode(this.compilerNode.trueType)}getFalseType(){return this._getNodeFromCompilerNode(this.compilerNode.falseType)}},Jqe=Ox(Df),Q5=class extends Jqe{},qqe=SR(B_(Q5)),Une=class extends qqe{},Xqe=Sw(mw),Hne=class extends Xqe{},$qe=gT(Q5),Kne=class extends $qe{},Jne=class extends mw{setArgument(o){let d=this.getArgument();if(yn.isLiteralTypeNode(d)){let g=d.getLiteral();if(yn.isStringLiteral(g))return g.setLiteralValue(o),this}return d.replaceWithText(g=>g.quote(o),this._getWriterWithQueuedChildIndentation()),this}getArgument(){return this._getNodeFromCompilerNode(this.compilerNode.argument)}setQualifier(o){let d=this.getQualifier();if(d!=null)d.replaceWithText(o,this._getWriterWithQueuedChildIndentation());else{let g=this.getFirstChildByKindOrThrow(x.SyntaxKind.CloseParenToken);pa({insertPos:g.getEnd(),parent:this,newText:this._getWriterWithQueuedIndentation().write(".").write(o).toString()})}return this}getQualifierOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getQualifier(),o??(()=>`Expected to find a qualifier for the import type: ${this.getText()}`),this)}getQualifier(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.qualifier)}getAttributes(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.attributes)}getAttributesOrThrow(o){return x.errors.throwIfNullOrUndefined(this._getNodeFromCompilerNodeIfExists(this.compilerNode.attributes),o??"Could not find import type assertion container.",this)}},qne=class extends Df{getObjectTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.objectType)}getIndexTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.indexType)}},Xne=class extends Df{getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}},$ne=class extends Df{getTypeNodes(){return this.compilerNode.types.map(o=>this._getNodeFromCompilerNode(o))}},Yne=class extends Df{getLiteral(){let o=this.compilerNode.literal;return this._getNodeFromCompilerNode(o)}},Qne=class extends Df{getNameTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.nameType)}getNameTypeNodeOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getNameTypeNode(),o??"Type did not exist.",this)}getReadonlyToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.readonlyToken)}getReadonlyTokenOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getReadonlyToken(),o??"Readonly token did not exist.",this)}getQuestionToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.questionToken)}getQuestionTokenOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getQuestionToken(),o??"Question token did not exist.",this)}getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getTypeNode(),o??"Type did not exist, but was expected to exist.",this)}},p2t=h=>X1(q1(a9($p(J1(h))))),Yqe=p2t(Df),Zne=class extends Yqe{getTypeNode(){return super.getTypeNode()}removeType(){throw new x.errors.InvalidOperationError("Cannot remove the type of a named tuple member.")}},ere=class extends Df{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},tre=class extends Df{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}setType(o){return this.getTypeNode().replaceWithText(o),this}},nre=class extends Df{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},rre=class extends Df{getHead(){return this._getNodeFromCompilerNode(this.compilerNode.head)}getTemplateSpans(){return this.compilerNode.templateSpans.map(o=>this._getNodeFromCompilerNode(o))}setLiteralValue(o){let d=this.getChildIndex(),g=this.getParentSyntaxList()??this.getParentOrThrow();return vR({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:o}),g.getChildAtIndex(d)}},ire=class extends Df{},ore=class extends Df{getElements(){return this.compilerNode.elements.map(o=>this._getNodeFromCompilerNode(o))}},f2t=h=>gT(X1($p(j1(U1(B_(J1(h))))))),Lee=f2t(Ud),are=class extends Lee{set(o){return Ua(Lee.prototype,this,o),this}getStructure(){return ns(Lee.prototype,this,{kind:te.StructureKind.TypeAlias,type:this.getTypeNodeOrThrow().getText()})}},Qqe=WDe(Df),sre=class extends Qqe{},lre=class extends Df{getOperator(){return this.compilerNode.operator}getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}};te.TypeParameterVariance=void 0;(function(h){h[h.None=0]="None",h[h.In=1]="In",h[h.Out=2]="Out",h[h.InOut=3]="InOut"})(te.TypeParameterVariance||(te.TypeParameterVariance={}));var m2t=h=>B_(J1(h)),kee=m2t(yn),cre=class extends kee{isConst(){return this.hasModifier(x.SyntaxKind.ConstKeyword)}setIsConst(o){return this.toggleModifier("const",o)}getConstraint(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.constraint)}getConstraintOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getConstraint(),o??"Expected to find the type parameter's constraint.",this)}setConstraint(o){if(o=this.getParentOrThrow()._getTextWithQueuedChildIndentation(o),x.StringUtils.isNullOrWhitespace(o))return this.removeConstraint(),this;let d=this.getConstraint();if(d!=null)return d.replaceWithText(o),this;let g=this.getNameNode();return pa({parent:this,insertPos:g.getEnd(),newText:` extends ${o}`}),this}removeConstraint(){return zKe(this.getConstraint(),x.SyntaxKind.ExtendsKeyword),this}getDefault(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.default)}getDefaultOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getDefault(),o??"Expected to find the type parameter's default.",this)}setDefault(o){if(o=this.getParentOrThrow()._getTextWithQueuedChildIndentation(o),x.StringUtils.isNullOrWhitespace(o))return this.removeDefault(),this;let d=this.getDefault();if(d!=null)return d.replaceWithText(o),this;let g=this.getConstraint()||this.getNameNode();return pa({parent:this,insertPos:g.getEnd(),newText:` = ${o}`}),this}removeDefault(){return zKe(this.getDefault(),x.SyntaxKind.EqualsToken),this}setVariance(o){return this.toggleModifier("in",(o&te.TypeParameterVariance.In)!==0),this.toggleModifier("out",(o&te.TypeParameterVariance.Out)!==0),this}getVariance(){let o=te.TypeParameterVariance.None;return this.hasModifier(x.SyntaxKind.InKeyword)&&(o|=te.TypeParameterVariance.In),this.hasModifier(x.SyntaxKind.OutKeyword)&&(o|=te.TypeParameterVariance.Out),o}remove(){let o=this.getParentSyntaxListOrThrow();o.getChildrenOfKind(x.SyntaxKind.TypeParameter).length===1?g():kx(this);function g(){let E=[o.getPreviousSiblingIfKindOrThrow(x.SyntaxKind.LessThanToken),o,o.getNextSiblingIfKindOrThrow(x.SyntaxKind.GreaterThanToken)];hc({children:E})}}set(o){return Ua(kee.prototype,this,o),o.isConst!=null&&this.setIsConst(o.isConst),o.constraint!=null?this.setConstraint(o.constraint):o.hasOwnProperty(x.nameof(o,"constraint"))&&this.removeConstraint(),o.default!=null?this.setDefault(o.default):o.hasOwnProperty(x.nameof(o,"default"))&&this.removeDefault(),o.variance!=null&&this.setVariance(o.variance),this}getStructure(){let o=this.getConstraint(),d=this.getDefault();return ns(kee.prototype,this,{kind:te.StructureKind.TypeParameter,isConst:this.isConst(),constraint:o?.getText({trimLeadingIndentation:!0}),default:d?d.getText({trimLeadingIndentation:!0}):void 0,variance:this.getVariance()})}};function zKe(h,o){h!=null&&hc({children:[h.getPreviousSiblingIfKindOrThrow(o),h],removePrecedingSpaces:!0})}var dre=class extends Df{getParameterNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.parameterName)}hasAssertsModifier(){return this.compilerNode.assertsModifier!=null}getAssertsModifier(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertsModifier)}getAssertsModifierOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getAssertsModifier(),o??"Expected to find an asserts modifier.",this)}getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getTypeNode(),o??"Expected to find a type node.",this)}},ure=class extends mw{getExprName(){return this._getNodeFromCompilerNode(this.compilerNode.exprName)}},pre=class extends mw{getTypeName(){return this._getNodeFromCompilerNode(this.compilerNode.typeName)}},fre=class extends Df{getTypeNodes(){return this.compilerNode.types.map(o=>this._getNodeFromCompilerNode(o))}},hT=class extends Df{},mre=class extends hT{},wee=yn,_p=class extends wee{getTagName(){return this.getTagNameNode().getText()}getTagNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.tagName)}setTagName(o){return this.set({tagName:o})}getComment(){if(this.compilerNode.comment!=null)return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:this.compilerNode.comment.map(o=>this._getNodeFromCompilerNodeIfExists(o))}getCommentText(){return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:x.ts.getTextOfJSDocComment(this.compilerNode.comment)}remove(){let o=this.getParentOrThrow().getStart()+3,d=tXe(this),g=d==null,E=R.call(this);hc({children:[this],customRemovalPos:E,customRemovalEnd:eXe(this,d),replaceTrivia:G.call(this)});function R(){return Math.max(o,nXe(this,this.getStart()))}function G(){if(E===o&&g)return"";let le=this._context.manipulationSettings.getNewLineKindAsString(),Re=this.getParentOrThrow().getIndentationText();return`${le}${Re} `+(g?"":"* ")}}set(o){return Ua(wee.prototype,this,o),o.text!=null||o.tagName!=null?this.replaceWithText(d=>{this._context.structurePrinterFactory.forJSDocTag({printStarsOnNewLine:!0}).printText(d,{tagName:o.tagName??this.getTagName(),text:o.text!=null?o.text:GKe(this)})}):this}replaceWithText(o){let d=t0(this._getWriterWithQueuedIndentation(),o),g=this.getParentOrThrow(),E=this.getChildIndex(),R=this.getStart();return pa({parent:g,insertPos:R,newText:d,replacing:{textLength:Zqe(this)-R}}),g.getChildren()[E]}getStructure(){let o=GKe(this);return ns(wee.prototype,this,{kind:te.StructureKind.JSDocTag,tagName:this.getTagName(),text:o.length===0?void 0:o})}};function GKe(h){let o=h.getSourceFile().getFullText(),d=h.getTagNameNode().getEnd(),g=Zqe(h),E=Math.min(o.charCodeAt(d)===Af.SPACE?d+1:d,g);return hDe(o.substring(E,g))}function Zqe(h){return nXe(h,eXe(h))}function eXe(h,o){return o=o??tXe(h),o!=null?o.getStart():h.getParentOrThrow().getEnd()-2}function tXe(h){let d=h.getParentIfKindOrThrow(x.SyntaxKind.JSDoc).getTags(),g=d.indexOf(h);return d[g+1]}function nXe(h,o){let d=h.getSourceFile().getFullText();return Mx(d,o,g=>g!==Af.ASTERISK&&!x.StringUtils.isWhitespaceCharCode(g))}var _re=class extends _p{},hre=class extends _p{},gre=class extends _p{},yre=class extends _p{},vre=class extends _p{},bre=class extends _p{},rXe=Ox(hT),Sre=class extends rXe{},Tre=class extends _p{},Ere=class extends _p{},xre=class extends yn{},Are=class extends yn{},Dre=class extends yn{},Ire=class extends yn{},Cre=class extends hT{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},Pre=class extends yn{getName(){return this._getNodeFromCompilerNode(this.compilerNode.name)}},Nre=class extends hT{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}isPostfix(){return this.compilerNode.postfix}},Rre=class extends hT{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}isPostfix(){return this.compilerNode.postfix}},Mre=class extends hT{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},iXe=Ew(_p),Lre=class extends iXe{},kre=class extends _p{},oXe=GDe(_p),wre=class extends oXe{},Ore=class extends _p{},aXe=GDe(_p),Fre=class extends aXe{},Wre=class extends _p{},Bre=class extends _p{},zre=class extends _p{},sXe=Ew(_p),Gre=class extends sXe{},lXe=Ew(_p),Vre=class extends lXe{},cXe=Ew(_p),jre=class extends cXe{},Ure=class extends hT{getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}},Z5=class{#e;constructor(o){this.#e=o}get compilerObject(){return this.#e}getName(){return this.compilerObject.name}getText(){return this.compilerObject.text??[]}},dXe=Hqe(_p),Hre=class extends dXe{getConstraint(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.constraint)}getConstraintOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getConstraint(),o??"Expected to find the JS doc template tag's constraint.",this)}},Kre=class extends yn{},uXe=Ew(_p),Jre=class extends uXe{},pXe=Ew(_p),qre=class extends pXe{},Xre=class extends _p{},$re=class extends Df{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},Yre=class extends hT{isArrayType(){return this.compilerNode.isArrayType}getPropertyTags(){return this.compilerNode.jsDocPropertyTags?this.compilerNode.jsDocPropertyTags.map(o=>this._getNodeFromCompilerNode(o)):void 0}},Qre=class extends _p{getTypeExpression(){let o=this.compilerNode.typeExpression;if(!(o!=null&&o.pos===o.end))return this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression)}},Zre=class extends _p{},eie=class extends hT{},tie=class extends hT{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},nie=class extends yn{remove(){G1({children:[this],getSiblingFormatting:()=>Ld.Newline})}},_2t=h=>h_(TR($p(j1(U1(B_(J1(h))))))),Oee=_2t(Ud),rie=class extends Oee{set(o){return Ua(Oee.prototype,this,o),o.isConst!=null&&this.setIsConstEnum(o.isConst),o.members!=null&&(this.getMembers().forEach(d=>d.remove()),this.addMembers(o.members)),this}addMember(o){return this.addMembers([o])[0]}addMembers(o){return this.insertMembers(this.getMembers().length,o)}insertMember(o,d){return this.insertMembers(o,[d])[0]}insertMembers(o,d){if(d.length===0)return[];let g=this.getMembersWithComments();o=wp(o,g.length);let E=this._getWriterWithChildIndentation();return this._context.structurePrinterFactory.forEnumMember().printTexts(E,d),_T({parent:this.getChildSyntaxListOrThrow(),currentNodes:g,insertIndex:o,newText:E.toString(),useNewLines:!0,useTrailingCommas:this._context.manipulationSettings.getUseTrailingCommas()}),yh(g,this.getMembersWithComments(),o,!G());function G(){return d instanceof Array?d.every(le=>typeof le=="object"):!1}}getMember(o){return kp(this.getMembers(),o)}getMemberOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getMember(o),()=>Yu("enum member",o))}getMembers(){return this.compilerNode.members.map(o=>this._getNodeFromCompilerNode(o))}getMembersWithComments(){let o=this.compilerNode;return Vm.getContainerArray(o,this.getSourceFile().compilerNode).map(d=>this._getNodeFromCompilerNode(d))}setIsConstEnum(o){return this.toggleModifier("const",o)}isConstEnum(){return this.getConstKeyword()!=null}getConstKeyword(){return this.getFirstModifierByKind(x.SyntaxKind.ConstKeyword)}getStructure(){return ns(Oee.prototype,this,{kind:te.StructureKind.Enum,isConst:this.isConstEnum(),members:this.getMembers().map(o=>o.getStructure())})}},h2t=h=>$p(bw(IC(h))),Fee=h2t(yn),iie=class extends Fee{getValue(){return this._context.typeChecker.getConstantValue(this)}setValue(o){let d;if(typeof o=="string"){let g=this._context.manipulationSettings.getQuoteKind();d=g+x.StringUtils.escapeForWithinString(o,g)+g}else d=o.toString();return this.setInitializer(d),this}remove(){let o=[this],d=this.getNextSiblingIfKind(x.SyntaxKind.CommaToken);d!=null&&o.push(d),G1({children:o,getSiblingFormatting:()=>Ld.Newline})}set(o){return Ua(Fee.prototype,this,o),o.value!=null?this.setValue(o.value):o.hasOwnProperty(x.nameof(o,"value"))&&o.initializer==null&&this.removeInitializer(),this}getStructure(){return ns(Fee.prototype,this,{kind:te.StructureKind.EnumMember,value:void 0})}},oie=class extends yn{getTypeNodes(){return this.compilerNode.types?.map(o=>this._getNodeFromCompilerNode(o))??[]}getToken(){return this.compilerNode.token}removeExpression(o){let d=this.getTypeNodes(),g=typeof o=="number"?E(o):o;if(d.length===1){let R=this.getParentSyntaxListOrThrow().getChildren();R.length===1?hc({children:[R[0].getParentSyntaxListOrThrow()],removePrecedingSpaces:!0}):hc({children:[this],removePrecedingSpaces:!0})}else kx(g);return this;function E(R){return d[wp(R,d.length-1)]}}},AC=class extends yn{remove(){sJe(this)}},g2t=h=>gT(Lv($p(Ox(h)))),Wee=g2t(AC),aie=class extends Wee{set(o){return Ua(Wee.prototype,this,o),this}getStructure(){return ns(Wee.prototype,this,{kind:te.StructureKind.CallSignature})}},sie=class extends AC{},y2t=h=>gT(Lv($p(Ox(h)))),Bee=y2t(AC),lie=class extends Bee{set(o){return Ua(Bee.prototype,this,o),this}getStructure(){return ns(Bee.prototype,this,{kind:te.StructureKind.ConstructSignature})}},v2t=h=>ODe(Lv($p(c9(B_(h))))),zee=v2t(AC),cie=class extends zee{getKeyName(){return this.getKeyNameNode().getText()}setKeyName(o){x.errors.throwIfWhitespaceOrNotString(o,"name"),this.getKeyName()!==o&&this.getKeyNameNode().replaceWithText(o,this._getWriterWithQueuedChildIndentation())}getKeyNameNode(){let o=this.compilerNode.parameters[0];return this._getNodeFromCompilerNode(o.name)}getKeyType(){return this.getKeyNameNode().getType()}setKeyType(o){x.errors.throwIfWhitespaceOrNotString(o,"type");let d=this.getKeyTypeNode();return d.getText()===o?this:(d.replaceWithText(o,this._getWriterWithQueuedChildIndentation()),this)}getKeyTypeNode(){let o=this.compilerNode.parameters[0];return this._getNodeFromCompilerNode(o.type)}set(o){return Ua(zee.prototype,this,o),o.keyName!=null&&this.setKeyName(o.keyName),o.keyType!=null&&this.setKeyType(o.keyType),this}getStructure(){let o=this.getKeyTypeNode();return ns(zee.prototype,this,{kind:te.StructureKind.IndexSignature,keyName:this.getKeyName(),keyType:o.getText()})}},b2t=h=>WDe(h_(vJe(kDe(gT($p(j1(TR(U1(B_(J1(h))))))))))),Gee=b2t(Ud),die=class extends Gee{getBaseTypes(){return this.getType().getBaseTypes()}getBaseDeclarations(){return this.getType().getBaseTypes().map(o=>o.getSymbol()?.getDeclarations()??[]).flat()}getImplementations(){return this.getNameNode().getImplementations()}set(o){return Ua(Gee.prototype,this,o),this}getStructure(){return ns(Gee.prototype,this,{kind:te.StructureKind.Interface})}},S2t=h=>Lv($p(q1(gT(Ox(IC(h)))))),Vee=S2t(AC),uie=class extends Vee{set(o){return Ua(Vee.prototype,this,o),this}getStructure(){return ns(Vee.prototype,this,{kind:te.StructureKind.MethodSignature})}},T2t=h=>Lv($p(c9(q1(bw(X1(IC(B_(h)))))))),jee=T2t(AC),pie=class extends jee{set(o){return Ua(jee.prototype,this,o),this}getStructure(){return ns(jee.prototype,this,{kind:te.StructureKind.PropertySignature})}};function VDe(h){return class extends h{getAttributes(){return this.compilerNode.attributes.properties.map(o=>this._getNodeFromCompilerNode(o))}getAttributeOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getAttribute(o),()=>Yu("attribute",o))}getAttribute(o){return kp(this.getAttributes(),o)}addAttribute(o){return this.addAttributes([o])[0]}addAttributes(o){return this.insertAttributes(this.compilerNode.attributes.properties.length,o)}insertAttribute(o,d){return this.insertAttributes(o,[d])[0]}insertAttributes(o,d){if(d.length===0)return[];let g=this.compilerNode.attributes.properties.length;o=wp(o,g);let E=o===0?this.getTagNameNode().getEnd():this.getAttributes()[o-1].getEnd(),R=this._getWriterWithQueuedChildIndentation();return new h1e(this._context.structurePrinterFactory.forJsxAttributeDecider()).printText(R,d),pa({insertPos:E,newText:" "+R.toString(),parent:this.getNodeProperty("attributes").getFirstChildByKindOrThrow(x.SyntaxKind.SyntaxList)}),yh(g,this.getAttributes(),o,!1)}set(o){return Ua(h.prototype,this,o),o.attributes!=null&&(this.getAttributes().forEach(d=>d.remove()),this.addAttributes(o.attributes)),this}getStructure(){return ns(h.prototype,this,{attributes:this.getAttributes().map(o=>o.getStructure())})}}}function goe(h){return class extends h{getTagNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.tagName)}set(o){return Ua(h.prototype,this,o),o.name!=null&&this.getTagNameNode().replaceWithText(o.name),this}getStructure(){return ns(h.prototype,this,{name:this.getTagNameNode().getText()})}}}function jDe(h){return class extends h{getText(){return this.compilerNode.text}getDefinitionNodes(){return this.getDefinitions().map(o=>o.getDeclarationNode()).filter(o=>o!=null)}getDefinitions(){return this._context.languageService.getDefinitions(this)}}}var fXe=jm(yn),fie=class extends fXe{},mXe=jDe(K1(wx(__))),e9=class extends mXe{getImplementations(){return this._context.languageService.getImplementations(this)}},_Xe=jDe(K1(wx(yn))),mie=class extends _Xe{},_ie=class extends yn{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}getRight(){return this._getNodeFromCompilerNode(this.compilerNode.right)}},Uee=yn,hie=class extends Uee{getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}setName(o){return this.getNameNode().replaceWithText(d=>{typeof o=="object"?this._context.structurePrinterFactory.forJsxNamespacedName().printText(d,o):d.write(o)}),this}getInitializerOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getInitializer(),o??`Expected to find an initializer for the JSX attribute '${this.getNameNode().getText()}'`,this)}getInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.initializer)}setInitializer(o){let d=t0(this._getWriterWithQueuedIndentation(),o);if(x.StringUtils.isNullOrWhitespace(d))return this.removeInitializer(),this;let g=this.getInitializer();return g!=null?(g.replaceWithText(d),this):(pa({insertPos:this.getNameNode().getEnd(),parent:this,newText:`=${d}`}),this)}removeInitializer(){let o=this.getInitializer();return o==null?this:(hc({children:[o.getPreviousSiblingIfKindOrThrow(x.SyntaxKind.EqualsToken),o],removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this)}remove(){hc({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(o){return Ua(Uee.prototype,this,o),o.name!=null&&this.setName(o.name),o.initializer!=null?this.setInitializer(o.initializer):o.hasOwnProperty(x.nameof(o,"initializer"))&&this.removeInitializer(),this}getStructure(){let o=this.getInitializer(),d=this.getNameNode();return ns(Uee.prototype,this,{name:d instanceof e9?d.getText():d.getStructure(),kind:te.StructureKind.JsxAttribute,initializer:o?.getText()})}},E2t=h=>goe(h),hXe=E2t(yn),gie=class extends hXe{},yie=class extends Xp{},Hee=__,vie=class extends Hee{getJsxChildren(){return this.compilerNode.children.map(o=>this._getNodeFromCompilerNode(o))}getOpeningElement(){return this._getNodeFromCompilerNode(this.compilerNode.openingElement)}getClosingElement(){return this._getNodeFromCompilerNode(this.compilerNode.closingElement)}setBodyText(o){let d=fJe(this._getWriterWithIndentation(),o);return VKe(this,d),this}setBodyTextInline(o){let d=this._getWriterWithQueuedChildIndentation();return DC(d,o),d.isLastNewLine()&&(d.setIndentationLevel(Math.max(0,this.getIndentationLevel()-1)),d.write("")),VKe(this,d.toString()),this}set(o){if(Ua(Hee.prototype,this,o),o.attributes!=null){let d=this.getOpeningElement();d.getAttributes().forEach(g=>g.remove()),d.addAttributes(o.attributes)}if(o.children!=null)throw new x.errors.NotImplementedError("Setting JSX children is currently not implemented. Please open an issue if you need this.");return o.bodyText!=null?this.setBodyText(o.bodyText):o.hasOwnProperty(x.nameof(o,"bodyText"))&&this.setBodyTextInline(""),o.name!=null&&(this.getOpeningElement().getTagNameNode().replaceWithText(o.name),this.getClosingElement().getTagNameNode().replaceWithText(o.name)),this}getStructure(){let o=this.getOpeningElement(),d=ns(Hee.prototype,this,{kind:te.StructureKind.JsxElement,name:o.getTagNameNode().getText(),attributes:o.getAttributes().map(g=>g.getStructure()),children:void 0,bodyText:NDe(this)});return delete d.children,d}};function VKe(h,o){let d=h.getOpeningElement(),g=h.getClosingElement();pa({insertPos:d.getEnd(),newText:o,parent:h.getChildSyntaxListOrThrow(),replacing:{textLength:g.getStart()-d.getEnd()}})}var gXe=d9(a9(Xp)),bie=class extends gXe{},Sie=class extends __{getJsxChildren(){return this.compilerNode.children.map(o=>this._getNodeFromCompilerNode(o))}getOpeningFragment(){return this._getNodeFromCompilerNode(this.compilerNode.openingFragment)}getClosingFragment(){return this._getNodeFromCompilerNode(this.compilerNode.closingFragment)}},yXe=yn,Tie=class extends yXe{getNamespaceNode(){return this._getNodeFromCompilerNode(this.compilerNode.namespace)}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}set(o){return this.getNamespaceNode().replaceWithText(o.namespace),this.getNameNode().replaceWithText(o.name),this}getStructure(){return{namespace:this.getNamespaceNode().getText(),name:this.getNameNode().getText()}}},x2t=h=>VDe(goe(h)),vXe=x2t(Xp),Eie=class extends vXe{},xie=class extends Xp{},A2t=h=>VDe(goe(h)),Kee=A2t(__),Aie=class extends Kee{set(o){return Ua(Kee.prototype,this,o),this}getStructure(){return ns(Kee.prototype,this,{kind:te.StructureKind.JsxSelfClosingElement})}},Jee=jm(yn),Die=class extends Jee{remove(){hc({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(o){return Ua(Jee.prototype,this,o),o.expression!=null&&this.setExpression(o.expression),this}getStructure(){return ns(Jee.prototype,this,{kind:te.StructureKind.JsxSpreadAttribute,expression:this.getExpression().getText()})}},bXe=n6(yn),Iie=class extends bXe{containsOnlyTriviaWhiteSpaces(){let o=this.compilerNode;return typeof o.containsOnlyWhiteSpaces=="boolean"?o.containsOnlyWhiteSpaces:this.compilerNode.containsOnlyTriviaWhiteSpaces}},SXe=gR,Cie=class extends SXe{getLiteralValue(){let o=this.compilerNode.text;if(typeof BigInt>"u")throw new x.errors.InvalidOperationError("Runtime environment does not support BigInts. Perhaps work with the text instead?");let d=o.substring(0,o.length-1);return BigInt(d)}setLiteralValue(o){if(typeof o!="bigint")throw new x.errors.ArgumentTypeError("value","bigint",typeof o);return vR({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:o.toString()+"n"}),this}},TXe=__,Pie=class extends TXe{getLiteralValue(){return UDe(this)}setLiteralValue(o){return xXe(this,o)}},EXe=__,Nie=class extends EXe{getLiteralValue(){return UDe(this)}setLiteralValue(o){return xXe(this,o)}};function xXe(h,o){if(UDe(h)===o)return h;let d=h.getParentSyntaxList()||h.getParentOrThrow(),g=h.getChildIndex();return h.replaceWithText(o?"true":"false"),d.getChildAtIndex(g)}function UDe(h){return h.getKind()===x.SyntaxKind.TrueKeyword}var AXe=__,Rie=class extends AXe{},DXe=gR,Mie=class extends DXe{getLiteralValue(){let o=this.compilerNode.text;return o.indexOf(".")>=0?parseFloat(o):parseInt(o,10)}setLiteralValue(o){return vR({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:o.toString(10)}),this}};te.QuoteKind=void 0;(function(h){h.Single="'",h.Double='"'})(te.QuoteKind||(te.QuoteKind={}));var IXe=gR,Lie=class extends IXe{getLiteralValue(){let o=/^\/(.*)\/([^\/]*)$/,d=this.compilerNode.text,g=o.exec(d);return new RegExp(g[1],g[2])}setLiteralValue(o,d){let g;return typeof o=="string"?g=o:(g=o.source,d=o.flags),vR({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:`/${g}/${d||""}`}),this}},CXe=gR,kie=class extends CXe{getLiteralValue(){return this.compilerNode.text}setLiteralValue(o){return vR({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:x.StringUtils.escapeForWithinString(o,this.getQuoteKind())}),this}getQuoteKind(){return this.getText()[0]==="'"?te.QuoteKind.Single:te.QuoteKind.Double}},PXe=gR,wie=class extends PXe{getLiteralValue(){return this.compilerNode.text}setLiteralValue(o){let d=this.getChildIndex(),g=this.getParentSyntaxList()||this.getParentOrThrow();return vR({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:o}),g.getChildAtIndex(d)}},Oie=class extends pw{getTag(){return this._getNodeFromCompilerNode(this.compilerNode.tag)}getTemplate(){return this._getNodeFromCompilerNode(this.compilerNode.template)}removeTag(){let o=this.getParentSyntaxList()??this.getParentOrThrow(),d=this.getChildIndex(),g=this.getTemplate();return pa({customMappings:(E,R)=>[{currentNode:g,newNode:E.getChildren(R)[d]}],parent:o,insertPos:this.getStart(),newText:this.getTemplate().getText(),replacing:{textLength:this.getWidth(),nodes:[this]}}),o.getChildAtIndex(d)}},NXe=__,Fie=class extends NXe{getHead(){return this._getNodeFromCompilerNode(this.compilerNode.head)}getTemplateSpans(){return this.compilerNode.templateSpans.map(o=>this._getNodeFromCompilerNode(o))}setLiteralValue(o){let d=this.getChildIndex(),g=this.getParentSyntaxList()??this.getParentOrThrow();return vR({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:o}),g.getChildAtIndex(d)}},RXe=n6(yn),Wie=class extends RXe{},MXe=n6(yn),Bie=class extends MXe{},LXe=jm(yn),zie=class extends LXe{getLiteral(){return this._getNodeFromCompilerNode(this.compilerNode.literal)}},kXe=n6(yn),Gie=class extends kXe{},D2t=h=>MDe(RDe(X1(bw(doe(h))))),qee=D2t(yn),Vie=class extends qee{remove(){let o=this.getParentOrThrow();switch(o.getKind()){case x.SyntaxKind.VariableDeclarationList:d(this);break;case x.SyntaxKind.CatchClause:g(this);break;default:throw new x.errors.NotImplementedError(`Not implemented for syntax kind: ${o.getKindName()}`)}function d(E){let R=o.getParentIfKindOrThrow(x.SyntaxKind.VariableStatement);R.getDeclarations().length===1?R.remove():kx(E)}function g(E){hc({children:[E.getPreviousSiblingIfKindOrThrow(x.SyntaxKind.OpenParenToken),E,E.getNextSiblingIfKindOrThrow(x.SyntaxKind.CloseParenToken)],removePrecedingSpaces:!0})}}getVariableStatementOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getVariableStatement(),o??"Expected the grandparent to be a variable statement.",this)}getVariableStatement(){let o=this.getParentOrThrow().getParentOrThrow();return yn.isVariableStatement(o)?o:void 0}set(o){return Ua(qee.prototype,this,o),this}getStructure(){return ns(qee.prototype,this,{kind:te.StructureKind.VariableDeclaration})}},wXe=B_(yn),jie=class extends wXe{getDeclarations(){return this.compilerNode.declarations.map(o=>this._getNodeFromCompilerNode(o))}getDeclarationKind(){let o=this.compilerNode.flags;return o&x.ts.NodeFlags.Let?te.VariableDeclarationKind.Let:(o&x.ts.NodeFlags.AwaitUsing)===x.ts.NodeFlags.AwaitUsing?te.VariableDeclarationKind.AwaitUsing:(o&x.ts.NodeFlags.Using)===x.ts.NodeFlags.Using?te.VariableDeclarationKind.Using:o&x.ts.NodeFlags.Const?te.VariableDeclarationKind.Const:te.VariableDeclarationKind.Var}getDeclarationKindKeywords(){let o=this.getDeclarationKind();switch(o){case te.VariableDeclarationKind.Const:return[this.getFirstChildByKindOrThrow(x.SyntaxKind.ConstKeyword)];case te.VariableDeclarationKind.Let:return[this.getFirstChildByKindOrThrow(x.SyntaxKind.LetKeyword)];case te.VariableDeclarationKind.Var:return[this.getFirstChildByKindOrThrow(x.SyntaxKind.VarKeyword)];case te.VariableDeclarationKind.Using:return[this.getFirstChildByKindOrThrow(x.SyntaxKind.UsingKeyword)];case te.VariableDeclarationKind.AwaitUsing:let d=this.getFirstChildByKindOrThrow(x.SyntaxKind.AwaitKeyword),g=d.getNextSiblingIfKindOrThrow(x.SyntaxKind.UsingKeyword);return[d,g];default:return x.errors.throwNotImplementedForNeverValueError(o)}}setDeclarationKind(o){if(this.getDeclarationKind()===o)return this;let d=this.getDeclarationKindKeywords(),g=d[0].getStart(),E=d[d.length-1].getEnd();return pa({insertPos:g,newText:o,parent:this,replacing:{textLength:E-g}}),this}addDeclaration(o){return this.addDeclarations([o])[0]}addDeclarations(o){return this.insertDeclarations(this.getDeclarations().length,o)}insertDeclaration(o,d){return this.insertDeclarations(o,[d])[0]}insertDeclarations(o,d){let g=this._getWriterWithQueuedChildIndentation(),E=new V1(this._context.structurePrinterFactory.forVariableDeclaration()),R=this.compilerNode.declarations.length;return o=wp(o,R),E.printText(g,d),_T({parent:this.getFirstChildByKindOrThrow(x.SyntaxKind.SyntaxList),currentNodes:this.getDeclarations(),insertIndex:o,newText:g.toString(),useTrailingCommas:!1}),yh(R,this.getDeclarations(),o,!1)}},Uie=class{#e;#t;constructor(o,d){this.#e=o,this.#t=d}get compilerSignature(){return this.#t}getTypeParameters(){return(this.compilerSignature.typeParameters||[]).map(d=>this.#e.compilerFactory.getTypeParameter(d))}getParameters(){return this.compilerSignature.parameters.map(o=>this.#e.compilerFactory.getSymbol(o))}getReturnType(){return this.#e.compilerFactory.getType(this.compilerSignature.getReturnType())}getDocumentationComments(){return this.compilerSignature.getDocumentationComment(this.#e.typeChecker.compilerObject).map(d=>this.#e.compilerFactory.getSymbolDisplayPart(d))}getJsDocTags(){return this.compilerSignature.getJsDocTags().map(d=>this.#e.compilerFactory.getJSDocTagInfo(d))}getDeclaration(){let{compilerFactory:o}=this.#e,d=this.compilerSignature.getDeclaration();return o.getNodeFromCompilerNode(d,o.getSourceFileForNode(d))}},OXe=class{#e;#t;get compilerSymbol(){return this.#t}constructor(o,d){this.#e=o,this.#t=d,this.getValueDeclaration(),this.getDeclarations()}getName(){return this.compilerSymbol.getName()}getEscapedName(){return this.compilerSymbol.getEscapedName()}getAliasedSymbolOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getAliasedSymbol(),o??"Expected to find an aliased symbol.")}getImmediatelyAliasedSymbol(){return this.#e.typeChecker.getImmediatelyAliasedSymbol(this)}getImmediatelyAliasedSymbolOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getImmediatelyAliasedSymbol(),o??"Expected to find an immediately aliased symbol.")}getAliasedSymbol(){return this.#e.typeChecker.getAliasedSymbol(this)}getExportSymbol(){return this.#e.typeChecker.getExportSymbolOfSymbol(this)}isAlias(){return(this.getFlags()&x.SymbolFlags.Alias)===x.SymbolFlags.Alias}isOptional(){return(this.getFlags()&x.SymbolFlags.Optional)===x.SymbolFlags.Optional}getFlags(){return this.compilerSymbol.getFlags()}hasFlags(o){return(this.compilerSymbol.flags&o)===o}getValueDeclarationOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getValueDeclaration(),o??(()=>`Expected to find the value declaration of symbol '${this.getName()}'.`))}getValueDeclaration(){let o=this.compilerSymbol.valueDeclaration;if(o!=null)return this.#e.compilerFactory.getNodeFromCompilerNode(o,this.#e.compilerFactory.getSourceFileForNode(o))}getDeclarations(){return(this.compilerSymbol.declarations??[]).map(o=>this.#e.compilerFactory.getNodeFromCompilerNode(o,this.#e.compilerFactory.getSourceFileForNode(o)))}getExportOrThrow(o,d){return x.errors.throwIfNullOrUndefined(this.getExport(o),d??(()=>`Expected to find export with name: ${o}`))}getExport(o){if(this.compilerSymbol.exports==null)return;let d=this.compilerSymbol.exports.get(x.ts.escapeLeadingUnderscores(o));return d==null?void 0:this.#e.compilerFactory.getSymbol(d)}getExports(){return this.compilerSymbol.exports==null?[]:Array.from(this.compilerSymbol.exports.values()).map(o=>this.#e.compilerFactory.getSymbol(o))}getGlobalExportOrThrow(o,d){return x.errors.throwIfNullOrUndefined(this.getGlobalExport(o),d??(()=>`Expected to find global export with name: ${o}`))}getGlobalExport(o){if(this.compilerSymbol.globalExports==null)return;let d=this.compilerSymbol.globalExports.get(x.ts.escapeLeadingUnderscores(o));return d==null?void 0:this.#e.compilerFactory.getSymbol(d)}getGlobalExports(){return this.compilerSymbol.globalExports==null?[]:Array.from(this.compilerSymbol.globalExports.values()).map(o=>this.#e.compilerFactory.getSymbol(o))}getMemberOrThrow(o,d){return x.errors.throwIfNullOrUndefined(this.getMember(o),d??`Expected to find member with name: ${o}`)}getMember(o){if(this.compilerSymbol.members==null)return;let d=this.compilerSymbol.members.get(x.ts.escapeLeadingUnderscores(o));return d==null?void 0:this.#e.compilerFactory.getSymbol(d)}getMembers(){return this.compilerSymbol.members==null?[]:Array.from(this.compilerSymbol.members.values()).map(o=>this.#e.compilerFactory.getSymbol(o))}getDeclaredType(){return this.#e.typeChecker.getDeclaredTypeOfSymbol(this)}getTypeAtLocation(o){return this.#e.typeChecker.getTypeOfSymbolAtLocation(this,o)}getFullyQualifiedName(){return this.#e.typeChecker.getFullyQualifiedName(this)}getJsDocTags(){return this.compilerSymbol.getJsDocTags(this.#e.typeChecker.compilerObject).map(o=>new Z5(o))}},Z8=class{#e;constructor(o){this.#e=o}get compilerObject(){return this.#e}getStart(){return this.compilerObject.start}getEnd(){return this.compilerObject.start+this.compilerObject.length}getLength(){return this.compilerObject.length}},e6=(()=>{let h=[],o;return class{static{let g=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;o=[x.Memoize],ja(this,null,o,{kind:"method",name:"getSpan",static:!1,private:!1,access:{has:E=>"getSpan"in E,get:E=>E.getSpan},metadata:g},null,h),g&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:g})}#e=kv(this,h);constructor(g){this.#e=g}get compilerObject(){return this.#e}getSpan(){return new Z8(this.compilerObject.span)}getNewText(){return this.compilerObject.newText}}})(),u9=(()=>{let h=[],o;return class{static{let g=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;o=[x.Memoize],ja(this,null,o,{kind:"method",name:"getTextChanges",static:!1,private:!1,access:{has:E=>"getTextChanges"in E,get:E=>E.getTextChanges},metadata:g},null,h),g&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:g})}#e=kv(this,h);#t;#n;#r;#i;constructor(g,E){this.#e=g,this.#t=E;let R=g.compilerFactory.addOrGetSourceFileFromFilePath(g.fileSystemWrapper.getStandardizedAbsolutePath(E.fileName),{markInProject:!1,scriptKind:void 0});this.#r=R!=null,E.isNewFile||(this.#n=R)}getFilePath(){return this.#t.fileName}getSourceFile(){return this.#n}getTextChanges(){return this.#t.textChanges.map(g=>new e6(g))}applyChanges(g={}){if(this.#i)return;if(this.isNewFile()&&this.#r&&!g.overwrite)throw new x.errors.InvalidOperationError(`Cannot apply file text change for creating a new file when the file exists at path ${this.getFilePath()}. Did you mean to provide the overwrite option?`);let E;if(this.isNewFile()?E=this.#e.project.createSourceFile(this.getFilePath(),"",{overwrite:g.overwrite}):E=this.getSourceFile(),E==null)throw new x.errors.InvalidOperationError(`Cannot apply file text change to modify existing file that doesn't exist at path: ${this.getFilePath()}`);return E.applyTextChanges(this.getTextChanges()),E._markAsInProject(),this.#i=!0,this}isNewFile(){return!!this.#t.isNewFile}}})(),Hie=class{#e;#t;constructor(o,d){this.#e=o,this.#t=d}get compilerObject(){return this.#t}getDescription(){return this.compilerObject.description}getChanges(){return this.compilerObject.changes.map(o=>new u9(this.#e,o))}},Kie=class extends Hie{getFixName(){return this.compilerObject.fixName}getFixId(){return this.compilerObject.fixId}getFixAllDescription(){return this.compilerObject.fixAllDescription}},FXe=(()=>{let h=[],o;return class{static{let g=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;o=[x.Memoize],ja(this,null,o,{kind:"method",name:"getChanges",static:!1,private:!1,access:{has:E=>"getChanges"in E,get:E=>E.getChanges},metadata:g},null,h),g&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:g})}#e=kv(this,h);#t;constructor(g,E){this.#e=g,this.#t=E}get compilerObject(){return this.#t}getChanges(){return this.compilerObject.changes.map(g=>new u9(this.#e,g))}applyChanges(g){for(let E of this.getChanges())E.applyChanges(g);return this}}})(),s6=(()=>{let h=[],o,d,g;return class{static{let R=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;o=[x.Memoize],d=[x.Memoize],g=[x.Memoize],ja(this,null,o,{kind:"method",name:"getTextSpan",static:!1,private:!1,access:{has:G=>"getTextSpan"in G,get:G=>G.getTextSpan},metadata:R},null,h),ja(this,null,d,{kind:"method",name:"getNode",static:!1,private:!1,access:{has:G=>"getNode"in G,get:G=>G.getNode},metadata:R},null,h),ja(this,null,g,{kind:"method",name:"getOriginalTextSpan",static:!1,private:!1,access:{has:G=>"getOriginalTextSpan"in G,get:G=>G.getOriginalTextSpan},metadata:R},null,h),R&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:R})}_context=kv(this,h);_compilerObject;_sourceFile;constructor(R,G){this._context=R,this._compilerObject=G,this._sourceFile=this._context.compilerFactory.addOrGetSourceFileFromFilePath(R.fileSystemWrapper.getStandardizedAbsolutePath(this.compilerObject.fileName),{markInProject:!1,scriptKind:void 0}),this._sourceFile._doActionPreNextModification(()=>this.getNode())}get compilerObject(){return this._compilerObject}getSourceFile(){return this._sourceFile}getTextSpan(){return new Z8(this.compilerObject.textSpan)}getNode(){let R=this.getTextSpan(),G=this.getSourceFile(),le=R.getStart(),Re=R.getEnd();return nt();function nt(){let at;return G._context.compilerFactory.forgetNodesCreatedInBlock(dt=>{let xe,gn=G;for(;gn!=null;){if(xe==null&&(at=gn),gn.getStart()===le&&gn.getWidth()===Re)at=xe=gn;else if(xe!=null)break;gn=gn.getChildAtPos(le)}at!=null&&dt(at)}),at}}getOriginalTextSpan(){let{originalTextSpan:R}=this.compilerObject;return R==null?void 0:new Z8(R)}getOriginalFileName(){return this.compilerObject.originalFileName}}})(),HDe=(()=>{let h=s6,o=[],d;return class extends h{static{let E=typeof Symbol=="function"&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;d=[x.Memoize],ja(this,null,d,{kind:"method",name:"getDeclarationNode",static:!1,private:!1,access:{has:R=>"getDeclarationNode"in R,get:R=>R.getDeclarationNode},metadata:E},null,o),E&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:E})}constructor(E,R){super(E,R),kv(this,o),this.getSourceFile()._doActionPreNextModification(()=>this.getDeclarationNode())}getKind(){return this.compilerObject.kind}getName(){return this.compilerObject.name}getContainerKind(){return this.compilerObject.containerKind}getContainerName(){return this.compilerObject.containerName}getDeclarationNode(){if(this.getKind()==="module"&&this.getTextSpan().getLength()===this.getSourceFile().getFullWidth())return this.getSourceFile();let E=this.getTextSpan().getStart(),R=G(this.getSourceFile());return R?.getParentOrThrow();function G(le){if(le.getKind()===x.SyntaxKind.Identifier&&le.getStart()===E)return le;for(let Re of le._getChildrenIterator())if(Re.getPos()<=E&&Re.getEnd()>E)return G(Re)}}}})(),t9=class h{_compilerObject;constructor(o){this._compilerObject=o}get compilerObject(){return this._compilerObject}getMessageText(){return this.compilerObject.messageText}getNext(){let o=this.compilerObject.next;if(o!=null)return o instanceof Array?o.map(d=>new h(d)):[new h(o)]}getCode(){return this.compilerObject.code}getCategory(){return this.compilerObject.category}},yoe=(()=>{let h=[],o;return class{static{let g=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;o=[x.Memoize],ja(this,null,o,{kind:"method",name:"getSourceFile",static:!1,private:!1,access:{has:E=>"getSourceFile"in E,get:E=>E.getSourceFile},metadata:g},null,h),g&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:g})}_context=kv(this,h);_compilerObject;constructor(g,E){this._context=g,this._compilerObject=E,this.getSourceFile()}get compilerObject(){return this._compilerObject}getSourceFile(){if(this._context==null)return;let g=this.compilerObject.file;return g==null?void 0:this._context.compilerFactory.getSourceFile(g,{markInProject:!1})}getMessageText(){let g=this._compilerObject.messageText;return typeof g=="string"?g:this._context==null?new t9(g):this._context.compilerFactory.getDiagnosticMessageChain(g)}getLineNumber(){let g=this.getSourceFile(),E=this.getStart();if(!(g==null||E==null))return x.StringUtils.getLineNumberAtPos(g.getFullText(),E)}getStart(){return this.compilerObject.start}getLength(){return this.compilerObject.length}getCategory(){return this.compilerObject.category}getCode(){return this.compilerObject.code}getSource(){return this.compilerObject.source}}})(),n9=class extends yoe{constructor(o,d){super(o,d)}getLineNumber(){return super.getLineNumber()}getStart(){return super.getStart()}getLength(){return super.getLength()}getSourceFile(){return super.getSourceFile()}},Jie=class{#e;#t;constructor(o,d){this.#e=d,this.#t=o}get compilerObject(){return this.#e}getFilePath(){return this.#t.fileSystemWrapper.getStandardizedAbsolutePath(this.compilerObject.name)}getWriteByteOrderMark(){return this.compilerObject.writeByteOrderMark||!1}getText(){return this.compilerObject.text}},WXe=(()=>{let h=[],o,d;return class{static{let E=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;o=[x.Memoize],d=[x.Memoize],ja(this,null,o,{kind:"method",name:"getDiagnostics",static:!1,private:!1,access:{has:R=>"getDiagnostics"in R,get:R=>R.getDiagnostics},metadata:E},null,h),ja(this,null,d,{kind:"method",name:"getOutputFiles",static:!1,private:!1,access:{has:R=>"getOutputFiles"in R,get:R=>R.getOutputFiles},metadata:E},null,h),E&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:E})}#e=kv(this,h);#t;constructor(E,R){this.#e=E,this.#t=R}get compilerObject(){return this.#t}getDiagnostics(){return this.compilerObject.diagnostics.map(E=>this.#e.compilerFactory.getDiagnostic(E))}getEmitSkipped(){return this.compilerObject.emitSkipped}getOutputFiles(){return this.compilerObject.outputFiles.map(E=>new Jie(this.#e,E))}}})(),qie=(()=>{let h=[],o;return class{static{let g=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;o=[x.Memoize],ja(this,null,o,{kind:"method",name:"getDiagnostics",static:!1,private:!1,access:{has:E=>"getDiagnostics"in E,get:E=>E.getDiagnostics},metadata:g},null,h),g&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:g})}_context=kv(this,h);_compilerObject;constructor(g,E){this._context=g,this._compilerObject=E,this.getDiagnostics()}get compilerObject(){return this._compilerObject}getEmitSkipped(){return this.compilerObject.emitSkipped}getDiagnostics(){return this.compilerObject.diagnostics.map(g=>this._context.compilerFactory.getDiagnostic(g))}}})(),BXe=(()=>{let h=s6,o=[],d;return class extends h{static{let E=typeof Symbol=="function"&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;d=[x.Memoize],ja(this,null,d,{kind:"method",name:"getDisplayParts",static:!1,private:!1,access:{has:R=>"getDisplayParts"in R,get:R=>R.getDisplayParts},metadata:E},null,o),E&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:E})}constructor(E,R){super(E,R),kv(this,o)}getKind(){return this.compilerObject.kind}getDisplayParts(){return this.compilerObject.displayParts.map(E=>this._context.compilerFactory.getSymbolDisplayPart(E))}}})(),Xie=class extends qie{#e;constructor(o,d,g){super(o,d),this.#e=g}getFiles(){return this.#e}saveFiles(){let o=this._context.fileSystemWrapper,d=this.#e.map(g=>o.writeFile(g.filePath,g.writeByteOrderMark?"\uFEFF"+g.text:g.text));return Promise.all(d)}saveFilesSync(){let o=this._context.fileSystemWrapper;for(let d of this.#e)o.writeFileSync(d.filePath,d.writeByteOrderMark?"\uFEFF"+d.text:d.text)}},zXe=(()=>{let h=[],o;return class{static{let g=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;o=[x.Memoize],ja(this,null,o,{kind:"method",name:"getEdits",static:!1,private:!1,access:{has:E=>"getEdits"in E,get:E=>E.getEdits},metadata:g},null,h),g&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:g})}#e=kv(this,h);#t;constructor(g,E){this.#e=g,this.#t=E}get compilerObject(){return this.#t}getEdits(){return this.compilerObject.edits.map(g=>new u9(this.#e,g))}getRenameFilePath(){return this.compilerObject.renameFilename}getRenameLocation(){return this.compilerObject.renameLocation}applyChanges(g){for(let E of this.getEdits())E.applyChanges(g);return this}}})(),GXe=(()=>{let h=[],o;return class{static{let g=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;o=[x.Memoize],ja(this,null,o,{kind:"method",name:"getDefinition",static:!1,private:!1,access:{has:E=>"getDefinition"in E,get:E=>E.getDefinition},metadata:g},null,h),g&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:g})}_context=kv(this,h);#e;#t;constructor(g,E){this._context=g,this.#e=E,this.#t=this.compilerObject.references.map(R=>g.compilerFactory.getReferencedSymbolEntry(R))}get compilerObject(){return this.#e}getDefinition(){return this._context.compilerFactory.getReferencedSymbolDefinitionInfo(this.compilerObject.definition)}getReferences(){return this.#t}}})(),VXe=(()=>{let h=HDe,o=[],d;return class extends h{static{let E=typeof Symbol=="function"&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;d=[x.Memoize],ja(this,null,d,{kind:"method",name:"getDisplayParts",static:!1,private:!1,access:{has:R=>"getDisplayParts"in R,get:R=>R.getDisplayParts},metadata:E},null,o),E&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:E})}constructor(E,R){super(E,R),kv(this,o)}getDisplayParts(){return this.compilerObject.displayParts.map(E=>this._context.compilerFactory.getSymbolDisplayPart(E))}}})(),$ie=class extends s6{constructor(o,d){super(o,d)}isWriteAccess(){return this.compilerObject.isWriteAccess}isInString(){return this.compilerObject.isInString}},Yie=class extends $ie{constructor(o,d){super(o,d)}isDefinition(){return this.compilerObject.isDefinition}},Qie=class extends s6{getPrefixText(){return this._compilerObject.prefixText}getSuffixText(){return this._compilerObject.suffixText}},Zie=class{#e;constructor(o){this.#e=o}get compilerObject(){return this.#e}getText(){return this.compilerObject.text}getKind(){return this.compilerObject.kind}},r9=class{#e;#t;constructor(o){this.#e=o}get compilerObject(){return this.#t()}_reset(o){this.#t=o}getAmbientModules(){return this.compilerObject.getAmbientModules().map(o=>this.#e.compilerFactory.getSymbol(o))}getApparentType(o){return this.#e.compilerFactory.getType(this.compilerObject.getApparentType(o.compilerType))}getAwaitedType(o){let d=this.compilerObject.getAwaitedType(o.compilerType);return d?this.#e.compilerFactory.getType(d):void 0}getConstantValue(o){return this.compilerObject.getConstantValue(o.compilerNode)}getFullyQualifiedName(o){return this.compilerObject.getFullyQualifiedName(o.compilerSymbol)}getTypeAtLocation(o){return this.#e.compilerFactory.getType(this.compilerObject.getTypeAtLocation(o.compilerNode))}getContextualType(o){let d=this.compilerObject.getContextualType(o.compilerNode);return d==null?void 0:this.#e.compilerFactory.getType(d)}getTypeOfSymbolAtLocation(o,d){return this.#e.compilerFactory.getType(this.compilerObject.getTypeOfSymbolAtLocation(o.compilerSymbol,d.compilerNode))}getDeclaredTypeOfSymbol(o){return this.#e.compilerFactory.getType(this.compilerObject.getDeclaredTypeOfSymbol(o.compilerSymbol))}getSymbolAtLocation(o){let d=this.compilerObject.getSymbolAtLocation(o.compilerNode);return d==null?void 0:this.#e.compilerFactory.getSymbol(d)}getAliasedSymbol(o){if(!o.hasFlags(x.SymbolFlags.Alias))return;let d=this.compilerObject.getAliasedSymbol(o.compilerSymbol);return d==null?void 0:this.#e.compilerFactory.getSymbol(d)}getImmediatelyAliasedSymbol(o){let d=this.compilerObject.getImmediateAliasedSymbol(o.compilerSymbol);return d==null?void 0:this.#e.compilerFactory.getSymbol(d)}getExportSymbolOfSymbol(o){return this.#e.compilerFactory.getSymbol(this.compilerObject.getExportSymbolOfSymbol(o.compilerSymbol))}getPropertiesOfType(o){return this.compilerObject.getPropertiesOfType(o.compilerType).map(d=>this.#e.compilerFactory.getSymbol(d))}getTypeText(o,d,g){return g==null&&(g=this.#n(d)),this.compilerObject.typeToString(o.compilerType,d?.compilerNode,g)}getReturnTypeOfSignature(o){return this.#e.compilerFactory.getType(this.compilerObject.getReturnTypeOfSignature(o.compilerSignature))}getSignatureFromNode(o){let d=this.compilerObject.getSignatureFromDeclaration(o.compilerNode);return d==null?void 0:this.#e.compilerFactory.getSignature(d)}getExportsOfModule(o){return(this.compilerObject.getExportsOfModule(o.compilerSymbol)||[]).map(g=>this.#e.compilerFactory.getSymbol(g))}getExportSpecifierLocalTargetSymbol(o){let d=this.compilerObject.getExportSpecifierLocalTargetSymbol(o.compilerNode);return d==null?void 0:this.#e.compilerFactory.getSymbol(d)}getResolvedSignature(o){let d=this.compilerObject.getResolvedSignature(o.compilerNode);if(!(!d||!d.declaration))return this.#e.compilerFactory.getSignature(d)}getResolvedSignatureOrThrow(o,d){return x.errors.throwIfNullOrUndefined(this.getResolvedSignature(o),d??"Signature could not be resolved.",o)}getBaseTypeOfLiteralType(o){return this.#e.compilerFactory.getType(this.compilerObject.getBaseTypeOfLiteralType(o.compilerType))}getSymbolsInScope(o,d){return this.compilerObject.getSymbolsInScope(o.compilerNode,d).map(g=>this.#e.compilerFactory.getSymbol(g))}getTypeArguments(o){return this.compilerObject.getTypeArguments(o.compilerType).map(d=>this.#e.compilerFactory.getType(d))}isTypeAssignableTo(o,d){return this.compilerObject.isTypeAssignableTo(o.compilerType,d.compilerType)}#n(o){let d=x.TypeFormatFlags.UseTypeOfFunction|x.TypeFormatFlags.NoTruncation|x.TypeFormatFlags.UseFullyQualifiedType|x.TypeFormatFlags.WriteTypeArgumentsOfSignature;return o!=null&&o.getKind()===x.SyntaxKind.TypeAliasDeclaration&&(d|=x.TypeFormatFlags.InTypeAlias),d}getShorthandAssignmentValueSymbol(o){let d=this.compilerObject.getShorthandAssignmentValueSymbol(o.compilerNode);return d?this.#e.compilerFactory.getSymbol(d):void 0}resolveName(o,d,g,E){let R=this.compilerObject.resolveName(o,d?.compilerNode,g,E);return R?this.#e.compilerFactory.getSymbol(R):void 0}},eoe=class{#e;#t;#n;#r;#i;#o;constructor(o){this.#e=o.context,this.#o=o.configFileParsingDiagnostics,this.#t=new r9(this.#e),this._reset(o.rootNames,o.host)}get compilerObject(){return this.#i()}_isCompilerProgramCreated(){return this.#n!=null}_reset(o,d){let g=this.#e.compilerOptions.get();this.#i=()=>(this.#n==null&&(this.#n=x.ts.createProgram(o,g,d,this.#r,this.#o),this.#r=void 0),this.#n),this.#n!=null&&(this.#r=this.#n,this.#n=void 0),this.#t._reset(()=>this.compilerObject.getTypeChecker())}getTypeChecker(){return this.#t}async emit(o={}){if(o.writeFile){let R=`Cannot specify a ${x.nameof(o,"writeFile")} option when emitting asynchrously. Use ${x.nameof(this,"emitSync")}() instead.`;throw new x.errors.InvalidOperationError(R)}let{fileSystemWrapper:d}=this.#e,g=[],E=this.#a({writeFile:(R,G,le)=>{g.push(d.writeFile(d.getStandardizedAbsolutePath(R),le?"\uFEFF"+G:G))},...o});return await Promise.all(g),new qie(this.#e,E)}emitSync(o={}){return new qie(this.#e,this.#a(o))}emitToMemory(o={}){let d=[],{fileSystemWrapper:g}=this.#e,E=this.#a({writeFile:(R,G,le)=>{d.push({filePath:g.getStandardizedAbsolutePath(R),text:G,writeByteOrderMark:le||!1})},...o});return new Xie(this.#e,E,d)}#a(o={}){let d=o.targetSourceFile!=null?o.targetSourceFile.compilerNode:void 0,{emitOnlyDtsFiles:g,customTransformers:E,writeFile:R}=o;return this.compilerObject.emit(d,R,void 0,g,E)}getSyntacticDiagnostics(o){return this.compilerObject.getSyntacticDiagnostics(o?.compilerNode).map(g=>this.#e.compilerFactory.getDiagnosticWithLocation(g))}getSemanticDiagnostics(o){return this.compilerObject.getSemanticDiagnostics(o?.compilerNode).map(g=>this.#e.compilerFactory.getDiagnostic(g))}getDeclarationDiagnostics(o){return this.compilerObject.getDeclarationDiagnostics(o?.compilerNode).map(g=>this.#e.compilerFactory.getDiagnosticWithLocation(g))}getGlobalDiagnostics(){return this.compilerObject.getGlobalDiagnostics().map(d=>this.#e.compilerFactory.getDiagnostic(d))}getConfigFileParsingDiagnostics(){return this.compilerObject.getConfigFileParsingDiagnostics().map(d=>this.#e.compilerFactory.getDiagnostic(d))}getEmitModuleResolutionKind(){return x.getEmitModuleResolutionKind(this.compilerObject.getCompilerOptions())}isSourceFileFromExternalLibrary(o){return o.isFromExternalLibrary()}},toe=class{#e;#t;#n;#r;#i=0;get compilerObject(){return this.#e}constructor(o){this.#r=o.context;let{languageServiceHost:d,compilerHost:g}=x.createHosts({transactionalFileSystem:this.#r.fileSystemWrapper,sourceFileContainer:this.#r.getSourceFileContainer(),compilerOptions:this.#r.compilerOptions,getNewLine:()=>this.#r.manipulationSettings.getNewLineKindAsString(),getProjectVersion:()=>`${this.#i}`,resolutionHost:o.resolutionHost??{},libFolderPath:o.libFolderPath,skipLoadingLibFiles:o.skipLoadingLibFiles});this.#t=g,this.#e=x.ts.createLanguageService(d,this.#r.compilerFactory.documentRegistry),this.#n=new eoe({context:this.#r,rootNames:Array.from(this.#r.compilerFactory.getSourceFilePaths()),host:this.#t,configFileParsingDiagnostics:o.configFileParsingDiagnostics}),this.#r.compilerFactory.onSourceFileAdded(E=>{E._isInProject()&&this._reset()}),this.#r.compilerFactory.onSourceFileRemoved(()=>this._reset())}_reset(){this.#i+=1,this.#n._reset(Array.from(this.#r.compilerFactory.getSourceFilePaths()),this.#t)}getProgram(){return this.#n}getDefinitions(o){return this.getDefinitionsAtPosition(o._sourceFile,o.getStart())}getDefinitionsAtPosition(o,d){return(this.compilerObject.getDefinitionAtPosition(o.getFilePath(),d)||[]).map(E=>this.#r.compilerFactory.getDefinitionInfo(E))}getImplementations(o){return this.getImplementationsAtPosition(o._sourceFile,o.getStart())}getImplementationsAtPosition(o,d){return(this.compilerObject.getImplementationAtPosition(o.getFilePath(),d)||[]).map(E=>new BXe(this.#r,E))}findReferences(o){return this.findReferencesAtPosition(o._sourceFile,o.getStart())}findReferencesAsNodes(o){let d=this.findReferences(o);return Array.from(g());function*g(){for(let E of d){let R=E.getDefinition().getKind()===x.ts.ScriptElementKind.alias,G=E.getReferences();for(let le=0;le<G.length;le++){let Re=G[le];(R||!Re.isDefinition()||le>0)&&(yield Re.getNode())}}}}findReferencesAtPosition(o,d){return(this.compilerObject.findReferences(o.getFilePath(),d)||[]).map(E=>this.#r.compilerFactory.getReferencedSymbol(E))}findRenameLocations(o,d={}){let g=d.usePrefixAndSuffixText==null?this.#r.manipulationSettings.getUsePrefixAndSuffixTextForRename():d.usePrefixAndSuffixText;return(this.compilerObject.findRenameLocations(o._sourceFile.getFilePath(),o.getStart(),d.renameInStrings||!1,d.renameInComments||!1,g)||[]).map(R=>new Qie(this.#r,R))}getSuggestionDiagnostics(o){let d=this.#o(o);return this.compilerObject.getSuggestionDiagnostics(d).map(E=>this.#r.compilerFactory.getDiagnosticWithLocation(E))}getFormattingEditsForRange(o,d,g){return(this.compilerObject.getFormattingEditsForRange(o,d[0],d[1],this.#a(g))||[]).map(E=>new e6(E))}getFormattingEditsForDocument(o,d){let g=this.#r.fileSystemWrapper.getStandardizedAbsolutePath(o);return(this.compilerObject.getFormattingEditsForDocument(g,this.#a(d))||[]).map(E=>new e6(E))}getFormattedDocumentText(o,d){let g=this.#r.fileSystemWrapper.getStandardizedAbsolutePath(o),E=this.#r.compilerFactory.getSourceFileFromCacheFromFilePath(g);if(E==null)throw new x.errors.FileNotFoundError(g);d=this.#a(d);let R=this.getFormattingEditsForDocument(g,d),G=DDe(E,R),le=d.newLineCharacter;return d.ensureNewLineAtEndOfFile&&!G.endsWith(le)&&(G+=le),G.replace(/\r?\n/g,le)}getEmitOutput(o,d){let g=this.#o(o),E=this.compilerObject;return new WXe(this.#r,R());function R(){let G=E.getProgram();return G==null||G.getSourceFile(g)==null?{emitSkipped:!0,outputFiles:[],diagnostics:[]}:E.getEmitOutput(g,d)}}getIdentationAtPosition(o,d,g){let E=this.#o(o);return g==null?g=this.#r.manipulationSettings.getEditorSettings():ADe(g,this.#r.manipulationSettings),this.compilerObject.getIndentationAtPosition(E,d,g)}organizeImports(o,d={},g={}){let E={type:"file",fileName:this.#o(o)};return this.compilerObject.organizeImports(E,this.#a(d),this.#s(g)).map(R=>new u9(this.#r,R))}getEditsForRefactor(o,d,g,E,R,G={}){let le=this.#o(o),Re=typeof g=="number"?g:{pos:g.getPos(),end:g.getEnd()},nt=this.compilerObject.getEditsForRefactor(le,this.#a(d),Re,E,R,this.#s(G));return nt!=null?new zXe(this.#r,nt):void 0}getCombinedCodeFix(o,d,g={},E={}){let R=this.compilerObject.getCombinedCodeFix({type:"file",fileName:this.#o(o)},d,this.#a(g),this.#s(E||{}));return new FXe(this.#r,R)}getCodeFixesAtPosition(o,d,g,E,R={},G={}){let le=this.#o(o);return this.compilerObject.getCodeFixesAtPosition(le,d,g,E,this.#a(R),this.#s(G||{})).map(nt=>new Kie(this.#r,nt))}#o(o){let d=typeof o=="string"?this.#r.fileSystemWrapper.getStandardizedAbsolutePath(o):o.getFilePath();if(!this.#r.compilerFactory.containsSourceFileAtPath(d))throw new x.errors.FileNotFoundError(d);return d}#a(o){return o._filled||(o=Object.assign(this.#r.getFormatCodeSettings(),o),nkt(o,this.#r.manipulationSettings),o._filled=!0),o}#s(o){return Object.assign(this.#r.getUserPreferences(),o)}},i9=class{_context;#e;get compilerType(){return this.#e}constructor(o,d){this._context=o,this.#e=d}getText(o,d){return this._context.typeChecker.getTypeText(this,o,d)}getAliasSymbol(){return this.compilerType.aliasSymbol==null?void 0:this._context.compilerFactory.getSymbol(this.compilerType.aliasSymbol)}getAliasSymbolOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getAliasSymbol(),"Expected to find an alias symbol.")}getAliasTypeArguments(){return(this.compilerType.aliasTypeArguments||[]).map(d=>this._context.compilerFactory.getType(d))}getApparentType(){return this._context.typeChecker.getApparentType(this)}getAwaitedType(){return this._context.typeChecker.getAwaitedType(this)}getArrayElementTypeOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getArrayElementType(),o??"Expected to find an array element type.")}getArrayElementType(){if(this.isArray())return this.getTypeArguments()[0]}getBaseTypes(){return(this.compilerType.getBaseTypes()||[]).map(d=>this._context.compilerFactory.getType(d))}getBaseTypeOfLiteralType(){return this._context.typeChecker.getBaseTypeOfLiteralType(this)}getCallSignatures(){return this.compilerType.getCallSignatures().map(o=>this._context.compilerFactory.getSignature(o))}getConstructSignatures(){return this.compilerType.getConstructSignatures().map(o=>this._context.compilerFactory.getSignature(o))}getConstraintOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getConstraint(),o??"Expected to find a constraint.")}getConstraint(){let o=this.compilerType.getConstraint();return o==null?void 0:this._context.compilerFactory.getType(o)}getDefaultOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getDefault(),o??"Expected to find a default type.")}getDefault(){let o=this.compilerType.getDefault();return o==null?void 0:this._context.compilerFactory.getType(o)}getProperties(){return this.compilerType.getProperties().map(o=>this._context.compilerFactory.getSymbol(o))}getPropertyOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getProperty(o),()=>Yu("symbol property",o))}getProperty(o){return _Ke(this.getProperties(),o)}getApparentProperties(){return this.compilerType.getApparentProperties().map(o=>this._context.compilerFactory.getSymbol(o))}getApparentProperty(o){return _Ke(this.getApparentProperties(),o)}isNullable(){return this.getUnionTypes().some(o=>o.isNull()||o.isUndefined())}getNonNullableType(){return this._context.compilerFactory.getType(this.compilerType.getNonNullableType())}getNumberIndexType(){let o=this.compilerType.getNumberIndexType();return o==null?void 0:this._context.compilerFactory.getType(o)}getStringIndexType(){let o=this.compilerType.getStringIndexType();return o==null?void 0:this._context.compilerFactory.getType(o)}getTargetType(){let o=this.compilerType.target||void 0;return o==null?void 0:this._context.compilerFactory.getType(o)}getTargetTypeOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getTargetType(),o??"Expected to find the target type.")}getTypeArguments(){return this._context.typeChecker.getTypeArguments(this)}getTupleElements(){return this.isTuple()?this.getTypeArguments():[]}getUnionTypes(){return this.isUnion()?this.compilerType.types.map(o=>this._context.compilerFactory.getType(o)):[]}getIntersectionTypes(){return this.isIntersection()?this.compilerType.types.map(o=>this._context.compilerFactory.getType(o)):[]}getLiteralValue(){return this.compilerType?.value}getLiteralValueOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getLiteralValue(),o??"Type was not a literal type.")}getLiteralFreshType(){let o=this.compilerType?.freshType;return o==null?void 0:this._context.compilerFactory.getType(o)}getLiteralFreshTypeOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getLiteralFreshType(),o??"Type was not a literal type.")}getLiteralRegularType(){let o=this.compilerType?.regularType;return o==null?void 0:this._context.compilerFactory.getType(o)}getLiteralRegularTypeOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getLiteralRegularType(),o??"Type was not a literal type.")}getSymbol(){let o=this.compilerType.getSymbol();return o==null?void 0:this._context.compilerFactory.getSymbol(o)}getSymbolOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getSymbol(),o??"Expected to find a symbol.")}isAssignableTo(o){return this._context.typeChecker.isTypeAssignableTo(this,o)}isAnonymous(){return this.#n(x.ObjectFlags.Anonymous)}isAny(){return this.#t(x.TypeFlags.Any)}isNever(){return this.#t(x.TypeFlags.Never)}isArray(){let o=this.getSymbol();return o==null?!1:(o.getName()==="Array"||o.getName()==="ReadonlyArray")&&this.getTypeArguments().length===1}isReadonlyArray(){let o=this.getSymbol();return o==null?!1:o.getName()==="ReadonlyArray"&&this.getTypeArguments().length===1}isTemplateLiteral(){return this.#t(x.TypeFlags.TemplateLiteral)}isBoolean(){return this.#t(x.TypeFlags.Boolean)}isString(){return this.#t(x.TypeFlags.String)}isNumber(){return this.#t(x.TypeFlags.Number)}isBigInt(){return this.#t(x.TypeFlags.BigInt)}isLiteral(){let o=this.isBooleanLiteral();return this.compilerType.isLiteral()||o}isBooleanLiteral(){return this.#t(x.TypeFlags.BooleanLiteral)}isBigIntLiteral(){return this.#t(x.TypeFlags.BigIntLiteral)}isEnumLiteral(){return this.#t(x.TypeFlags.EnumLiteral)&&!this.isUnion()}isNumberLiteral(){return this.#t(x.TypeFlags.NumberLiteral)}isStringLiteral(){return this.compilerType.isStringLiteral()}isClass(){return this.compilerType.isClass()}isClassOrInterface(){return this.compilerType.isClassOrInterface()}isEnum(){if(this.#t(x.TypeFlags.Enum))return!0;if(this.isEnumLiteral()&&!this.isUnion())return!1;let d=this.getSymbol();if(d==null)return!1;let g=d.getValueDeclaration();return g!=null&&yn.isEnumDeclaration(g)}isInterface(){return this.#n(x.ObjectFlags.Interface)}isObject(){return this.#t(x.TypeFlags.Object)}isTypeParameter(){return this.compilerType.isTypeParameter()}isTuple(){let o=this.getTargetType();return o==null?!1:o.#n(x.ObjectFlags.Tuple)}isUnion(){return this.compilerType.isUnion()}isIntersection(){return this.compilerType.isIntersection()}isUnionOrIntersection(){return this.compilerType.isUnionOrIntersection()}isUnknown(){return this.#t(x.TypeFlags.Unknown)}isNull(){return this.#t(x.TypeFlags.Null)}isUndefined(){return this.#t(x.TypeFlags.Undefined)}isVoid(){return this.#t(x.TypeFlags.Void)}getFlags(){return this.compilerType.flags}getObjectFlags(){return this.isObject()&&this.compilerType.objectFlags||0}#t(o){return(this.compilerType.flags&o)===o}#n(o){return(this.getObjectFlags()&o)===o}},noe=class extends i9{getConstraintOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getConstraint(),o??"Expected type parameter to have a constraint.")}getConstraint(){let o=this.#e();if(o==null)return;let d=o.getConstraint();if(d!=null)return this._context.typeChecker.getTypeAtLocation(d)}getDefaultOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getDefault(),o??"Expected type parameter to have a default type.")}getDefault(){let o=this.#e();if(o==null)return;let d=o.getDefault();if(d!=null)return this._context.typeChecker.getTypeAtLocation(d)}#e(){let o=this.getSymbol();if(o==null)return;let d=o.getDeclarations()[0];if(d!=null&&yn.isTypeParameterDeclaration(d))return d}},o9=class{#e;#t;constructor(o,d){this.#t=o,this.#e=d}getSkippedFilePaths(){return this.#t}getOutputFilePaths(){return this.#e}},roe=class h{#e;#t;#n;constructor(o,d){this.#e=o,this._setPathInternal(d)}_setPathInternal(o){this.#t=o,this.#n=o.split("/").filter(d=>d.length>0)}get _context(){return this.#s(),this.#e}isAncestorOf(o){return h.#_(this,o)}isDescendantOf(o){return h.#_(o,this)}_getDepth(){return this.#n.length}getPath(){return this.#s(),this.#t}getBaseName(){return this.#n[this.#n.length-1]}getParentOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getParent(),o??(()=>`Parent directory of ${this.getPath()} does not exist or was never added.`))}getParent(){if(!x.FileUtils.isRootDirPath(this.getPath()))return this.addDirectoryAtPathIfExists(x.FileUtils.getDirPath(this.getPath()))}getDirectoryOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getDirectory(o),()=>typeof o=="string"?`Could not find a directory at path '${this._context.fileSystemWrapper.getStandardizedAbsolutePath(o,this.getPath())}'.`:"Could not find child directory that matched condition.")}getDirectory(o){if(typeof o=="string"){let d=this._context.fileSystemWrapper.getStandardizedAbsolutePath(o,this.getPath());return this._context.compilerFactory.getDirectoryFromCache(d)}return this.getDirectories().find(o)}getSourceFileOrThrow(o){return x.errors.throwIfNullOrUndefined(this.getSourceFile(o),()=>typeof o=="string"?`Could not find child source file at path '${this._context.fileSystemWrapper.getStandardizedAbsolutePath(o,this.getPath())}'.`:"Could not find child source file that matched condition.")}getSourceFile(o){if(typeof o=="string"){let d=this._context.fileSystemWrapper.getStandardizedAbsolutePath(o,this.getPath());return this._context.compilerFactory.getSourceFileFromCacheFromFilePath(d)}for(let d of this._getSourceFilesIterator())if(o(d))return d}getDirectories(){return Array.from(this._getDirectoriesIterator())}_getDirectoriesIterator(){return this._context.compilerFactory.getChildDirectoriesOfDirectory(this.getPath())}getSourceFiles(o){let{compilerFactory:d,fileSystemWrapper:g}=this._context,E=this;if(typeof o=="string"||o instanceof Array)return Array.from(R(typeof o=="string"?[o]:o));return Array.from(this._getSourceFilesIterator());function*R(G){let le=Array.from(nt()),Re=x.matchGlobs(le,G,E.getPath());for(let at of Re)yield d.getSourceFileFromCacheFromFilePath(g.getStandardizedAbsolutePath(at));function*nt(){for(let at of E._getDescendantSourceFilesIterator())yield at.getFilePath()}}}_getSourceFilesIterator(){return this._context.compilerFactory.getChildSourceFilesOfDirectory(this.getPath())}getDescendantSourceFiles(){return Array.from(this._getDescendantSourceFilesIterator())}*_getDescendantSourceFilesIterator(){for(let o of this._getSourceFilesIterator())yield o;for(let o of this._getDirectoriesIterator())yield*o._getDescendantSourceFilesIterator()}getDescendantDirectories(){return Array.from(this._getDescendantDirectoriesIterator())}*_getDescendantDirectoriesIterator(){for(let o of this.getDirectories())yield o,yield*o._getDescendantDirectoriesIterator()}addSourceFilesAtPaths(o){return o=typeof o=="string"?[o]:o,o=o.map(d=>x.FileUtils.pathIsAbsolute(d)?d:x.FileUtils.pathJoin(this.getPath(),d)),this._context.directoryCoordinator.addSourceFilesAtPaths(o,{markInProject:this._isInProject()})}addDirectoryAtPathIfExists(o,d={}){let g=this._context.fileSystemWrapper.getStandardizedAbsolutePath(o,this.getPath());return this._context.directoryCoordinator.addDirectoryAtPathIfExists(g,{...d,markInProject:this._isInProject()})}addDirectoryAtPath(o,d={}){let g=this._context.fileSystemWrapper.getStandardizedAbsolutePath(o,this.getPath());return this._context.directoryCoordinator.addDirectoryAtPath(g,{...d,markInProject:this._isInProject()})}createDirectory(o){let d=this._context.fileSystemWrapper.getStandardizedAbsolutePath(o,this.getPath());return this._context.directoryCoordinator.createDirectoryOrAddIfExists(d,{markInProject:this._isInProject()})}createSourceFile(o,d,g){let E=this._context.fileSystemWrapper.getStandardizedAbsolutePath(o,this.getPath());return this._context.compilerFactory.createSourceFile(E,d||"",{...g||{},markInProject:this._isInProject()})}addSourceFileAtPathIfExists(o){let d=this._context.fileSystemWrapper.getStandardizedAbsolutePath(o,this.getPath());return this._context.directoryCoordinator.addSourceFileAtPathIfExists(d,{markInProject:this._isInProject()})}addSourceFileAtPath(o){let d=this._context.fileSystemWrapper.getStandardizedAbsolutePath(o,this.getPath());return this._context.directoryCoordinator.addSourceFileAtPath(d,{markInProject:this._isInProject()})}async emit(o={}){let{fileSystemWrapper:d}=this._context,g=[],E=[],R=[];for(let G of this.#r(o))jKe(G)?R.push(G):(g.push(d.writeFile(G.filePath,G.fileText)),E.push(G.filePath));return await Promise.all(g),new o9(R,E)}emitSync(o={}){let{fileSystemWrapper:d}=this._context,g=[],E=[];for(let R of this.#r(o))jKe(R)?E.push(R):(d.writeFileSync(R.filePath,R.fileText),g.push(R.filePath));return new o9(E,g)}#r(o={}){let{emitOnlyDtsFiles:d=!1}=o,g=o.outDir==null?void 0:/\.js$/i,E=o.outDir==null?void 0:/\.js\.map$/i,R=o.declarationDir==null&&o.outDir==null?void 0:/\.d\.ts$/i,G=at=>at==null?void 0:this._context.fileSystemWrapper.getStandardizedAbsolutePath(at,this.getPath()),le=(at,dt)=>at==null?void 0:x.FileUtils.pathJoin(at,dt.getBaseName()),Re=this._context.compilerOptions.get().declarationDir!=null||o.declarationDir!=null;return nt(this,G(o.outDir),G(o.declarationDir));function*nt(at,dt,xe){for(let gn of at.getSourceFiles()){let pt=gn.getEmitOutput({emitOnlyDtsFiles:d});if(pt.getEmitSkipped()){yield gn.getFilePath();continue}for(let ut of pt.getOutputFiles()){let yi=ut.getFilePath(),wi=ut.getWriteByteOrderMark()?x.FileUtils.getTextWithByteOrderMark(ut.getText()):ut.getText();dt!=null&&(g.test(yi)||E.test(yi)||!Re&&R.test(yi))?yi=x.FileUtils.pathJoin(dt,x.FileUtils.getBaseName(yi)):xe!=null&&R.test(yi)&&(yi=x.FileUtils.pathJoin(xe,x.FileUtils.getBaseName(yi))),yield{filePath:yi,fileText:wi}}}for(let gn of at.getDirectories())yield*nt(gn,le(dt,gn),le(xe,gn))}}copyToDirectory(o,d){let g=typeof o=="string"?o:o.getPath();return this.copy(x.FileUtils.pathJoin(g,this.getBaseName()),d)}copy(o,d){let g=this.getPath(),E=this._context.fileSystemWrapper,R=this._context.fileSystemWrapper.getStandardizedAbsolutePath(o,this.getPath());return g===R?this:(d=GAe(d),d.includeUntrackedFiles&&E.queueCopyDirectory(g,R),this.#i(R,d))}async copyImmediately(o,d){let g=this._context.fileSystemWrapper,E=this.getPath(),R=g.getStandardizedAbsolutePath(o,E);if(E===R)return await this.save(),this;d=GAe(d);let G=this.#i(R,d);return d.includeUntrackedFiles&&await g.copyDirectoryImmediately(E,R),await G.save(),G}copyImmediatelySync(o,d){let g=this._context.fileSystemWrapper,E=this.getPath(),R=g.getStandardizedAbsolutePath(o,E);if(E===R)return this.saveSync(),this;d=GAe(d);let G=this.#i(R,d);return d.includeUntrackedFiles&&g.copyDirectoryImmediatelySync(E,R),G.saveSync(),G}#i(o,d){if(this.getPath()===o)return this;let{fileSystemWrapper:E,compilerFactory:R}=this._context,G=[this,...this.getDescendantDirectories()].map(Re=>({newDirPath:Re===this?o:E.getStandardizedAbsolutePath(this.getRelativePathTo(Re),o)})),le=this.getDescendantSourceFiles().map(Re=>({sourceFile:Re,newFilePath:E.getStandardizedAbsolutePath(this.getRelativePathTo(Re),o),references:this.#c(Re)}));for(let{newDirPath:Re}of G)this._context.compilerFactory.createDirectoryOrAddIfExists(Re,{markInProject:this._isInProject()});for(let{sourceFile:Re,newFilePath:nt}of le)Re._copyInternal(nt,d);for(let{references:Re,newFilePath:nt}of le)this.getSourceFileOrThrow(nt)._updateReferencesForCopyInternal(Re);return R.getDirectoryFromCache(o)}moveToDirectory(o,d){let g=typeof o=="string"?o:o.getPath();return this.move(x.FileUtils.pathJoin(g,this.getBaseName()),d)}move(o,d){let g=this._context.fileSystemWrapper,E=this.getPath(),R=g.getStandardizedAbsolutePath(o,E);return E===R?this:this.#o(R,d,()=>g.queueMoveDirectory(E,R))}async moveImmediately(o,d){let g=this._context.fileSystemWrapper,E=this.getPath(),R=g.getStandardizedAbsolutePath(o,E);return E===R?(await this.save(),this):(this.#o(R,d),await g.moveDirectoryImmediately(E,R),await this.save(),this)}moveImmediatelySync(o,d){let g=this._context.fileSystemWrapper,E=this.getPath(),R=g.getStandardizedAbsolutePath(o,E);return E===R?(this.saveSync(),this):(this.#o(R,d),g.moveDirectoryImmediatelySync(E,R),this.saveSync(),this)}#o(o,d,g){let E=this.getPath();if(E===o)return this;let R=this._context.compilerFactory.getDirectoryFromCacheOnlyIfInCache(o),G=R!=null&&R._isInProject();g&&g();let le=this._context.fileSystemWrapper,Re=this._context.compilerFactory,nt=[this,...this.getDescendantDirectories()].map(dt=>({directory:dt,oldPath:dt.getPath(),newDirPath:dt===this?o:le.getStandardizedAbsolutePath(this.getRelativePathTo(dt),o)})),at=this.getDescendantSourceFiles().map(dt=>({sourceFile:dt,newFilePath:le.getStandardizedAbsolutePath(this.getRelativePathTo(dt),o),references:this.#m(dt)}));for(let{directory:dt,oldPath:xe,newDirPath:gn}of nt){Re.removeDirectoryFromCache(xe);let pt=Re.getDirectoryFromCache(gn);pt?._forgetOnlyThis(),dt._setPathInternal(gn),Re.addDirectoryToCache(dt)}for(let{sourceFile:dt,newFilePath:xe}of at)dt._moveInternal(xe,d);for(let{sourceFile:dt,references:xe}of at)dt._updateReferencesForMoveInternal(xe,E);return G&&this._markAsInProject(),this}clear(){let o=this.getPath();this.#a(),this._context.fileSystemWrapper.queueDirectoryDelete(o),this._context.fileSystemWrapper.queueMkdir(o)}async clearImmediately(){let o=this.getPath();this.#a(),await this._context.fileSystemWrapper.clearDirectoryImmediately(o)}clearImmediatelySync(){let o=this.getPath();this.#a(),this._context.fileSystemWrapper.clearDirectoryImmediatelySync(o)}delete(){let o=this.getPath();this.#a(),this._context.fileSystemWrapper.queueDirectoryDelete(o),this.forget()}#a(){for(let o of this.getSourceFiles())o.delete();for(let o of this.getDirectories())o.delete()}async deleteImmediately(){let{fileSystemWrapper:o}=this._context,d=this.getPath();this.forget(),await o.deleteDirectoryImmediately(d)}deleteImmediatelySync(){let{fileSystemWrapper:o}=this._context,d=this.getPath();this.forget(),o.deleteDirectoryImmediatelySync(d)}forget(){if(!this.wasForgotten()){for(let o of this.getSourceFiles())o.forget();for(let o of this.getDirectories())o.forget();this._forgetOnlyThis()}}_forgetOnlyThis(){this.wasForgotten()||(this._context.compilerFactory.removeDirectoryFromCache(this.getPath()),this.#e=void 0)}async save(){await this._context.fileSystemWrapper.saveForDirectory(this.getPath());let o=this.getDescendantSourceFiles().filter(d=>!d.isSaved());await Promise.all(o.map(d=>d.save()))}saveSync(){this._context.fileSystemWrapper.saveForDirectorySync(this.getPath()),this.getDescendantSourceFiles().filter(d=>!d.isSaved()).forEach(d=>d.saveSync())}getRelativePathTo(o){let d=this;return x.FileUtils.getRelativePathTo(this.getPath(),g());function g(){return o instanceof X8?o.getFilePath():o instanceof h?o.getPath():d._context.fileSystemWrapper.getStandardizedAbsolutePath(o,d.getPath())}}getRelativePathAsModuleSpecifierTo(o){let d=this._context.program.getEmitModuleResolutionKind(),g=this,E=x.FileUtils.getRelativePathTo(this.getPath(),R()).replace(/((\.d\.ts$)|(\.[^/.]+$))/i,"");return E.startsWith("../")?E:"./"+E;function R(){return o instanceof X8?G(o):o instanceof h?le(o):Re(g._context.fileSystemWrapper.getStandardizedAbsolutePath(o,g.getPath()));function G(nt){return Re(nt.getFilePath())}function le(nt){switch(d){case x.ModuleResolutionKind.Node10:return nt===g?x.FileUtils.pathJoin(nt.getPath(),"index.ts"):nt.getPath();case x.ModuleResolutionKind.Classic:case x.ModuleResolutionKind.Node16:case x.ModuleResolutionKind.NodeNext:case x.ModuleResolutionKind.Bundler:return x.FileUtils.pathJoin(nt.getPath(),"index.ts");default:return x.errors.throwNotImplementedForNeverValueError(d)}}function Re(nt){let at=x.FileUtils.getDirPath(nt);switch(d){case x.ModuleResolutionKind.Node10:return at===g.getPath()?nt:nt.replace(/\/index?(\.d\.ts|\.ts|\.js)$/i,"");case x.ModuleResolutionKind.Classic:case x.ModuleResolutionKind.Node16:case x.ModuleResolutionKind.NodeNext:case x.ModuleResolutionKind.Bundler:return nt;default:return x.errors.throwNotImplementedForNeverValueError(d)}}}}getProject(){return this._context.project}wasForgotten(){return this.#e==null}_isInProject(){return this._context.inProjectCoordinator.isDirectoryInProject(this)}_markAsInProject(){this._context.inProjectCoordinator.markDirectoryAsInProject(this)}_hasLoadedParent(){return this._context.compilerFactory.containsDirectoryAtPath(x.FileUtils.getDirPath(this.getPath()))}#s(){if(this.wasForgotten())throw new x.errors.InvalidOperationError("Cannot use a directory that was deleted, removed, or overwritten.")}#c(o){return o._getReferencesForCopyInternal().filter(g=>!this.isAncestorOf(g[1]))}#m(o){let{literalReferences:d,referencingLiterals:g}=o._getReferencesForMoveInternal();return{literalReferences:d.filter(E=>!this.isAncestorOf(E[1])),referencingLiterals:g.filter(E=>!this.isAncestorOf(E._sourceFile))}}static#_(o,d){if(d instanceof X8&&(d=d.getDirectory(),o===d))return!0;if(o.#n.length>=d.#n.length)return!1;for(let g=o.#n.length-1;g>=0;g--)if(o.#n[g]!==d.#n[g])return!1;return!0}};function GAe(h){return h=x.ObjectUtils.clone(h||{}),$u(h,"includeUntrackedFiles",!0),h}function jKe(h){return typeof h=="string"}var gDe=class{#e;#t;constructor(o,d){this.#t=o,this.#e=d}addDirectoryAtPathIfExists(o,d){let g=this.#t.getDirectoryFromPath(o,d);if(g!=null){if(d.recursive)for(let E of x.FileUtils.getDescendantDirectories(this.#e,o))this.#t.createDirectoryOrAddIfExists(E,d);return g}}addDirectoryAtPath(o,d){let g=this.addDirectoryAtPathIfExists(o,d);if(g==null)throw new x.errors.DirectoryNotFoundError(o);return g}createDirectoryOrAddIfExists(o,d){return this.#t.createDirectoryOrAddIfExists(o,d)}addSourceFileAtPathIfExists(o,d){return this.#t.addOrGetSourceFileFromFilePath(o,{markInProject:d.markInProject,scriptKind:void 0})}addSourceFileAtPath(o,d){let g=this.addSourceFileAtPathIfExists(o,d);if(g==null)throw new x.errors.FileNotFoundError(this.#e.getStandardizedAbsolutePath(o));return g}addSourceFilesAtPaths(o,d){typeof o=="string"&&(o=[o]);let g=[],E=new Set;for(let R of this.#e.globSync(o)){let G=this.addSourceFileAtPathIfExists(R,d);G!=null&&g.push(G),E.add(x.FileUtils.getDirPath(R))}for(let R of x.FileUtils.getParentMostPaths(Array.from(E)))this.addDirectoryAtPathIfExists(R,{recursive:!0,markInProject:d.markInProject});return g}},yDe=class{#e;#t=new x.KeyValueCache;#n=new x.KeyValueCache;#r=new x.KeyValueCache;#i=new x.KeyValueCache;constructor(o){this.#e=o}has(o){return this.#t.has(o)}get(o){if(!this.#t.has(o)){for(let d of this.#i.getValues())if(x.FileUtils.pathStartsWith(d.getPath(),o))return this.createOrAddIfExists(o);return}return this.#t.get(o)}getOrphans(){return this.#i.getValues()}getAll(){return this.#t.getValuesAsArray()}*getAllByDepth(){let o=new x.KeyValueCache,d=0;for(let E of this.getOrphans())g(E);for(d=Math.min(...Array.from(o.getKeys()));o.getSize()>0;){for(let E of o.get(d)||[])yield E,E.getDirectories().forEach(g);o.removeByKey(d),d++}function g(E){let R=E._getDepth();if(d>R)throw new Error(`For some reason a subdirectory had a lower depth than the parent directory: ${E.getPath()}`);o.getOrCreate(R,()=>[]).push(E)}}remove(o){this.#s(o),this.#t.removeByKey(o),this.#i.removeByKey(o)}*getChildDirectoriesOfDirectory(o){let d=this.#r.get(o)?.entries();if(d!=null)for(let g of d)yield g}*getChildSourceFilesOfDirectory(o){let d=this.#n.get(o)?.entries();if(d!=null)for(let g of d)yield g}addSourceFile(o){let d=o.getDirectoryPath();this.createOrAddIfExists(d),this.#n.getOrCreate(d,()=>new x.SortedKeyValueArray(E=>E.getBaseName(),x.LocaleStringComparer.instance)).set(o)}removeSourceFile(o){let d=x.FileUtils.getDirPath(o),g=this.#n.get(d);g!=null&&(g.removeByKey(x.FileUtils.getBaseName(o)),g.hasItems()||this.#n.removeByKey(d))}createOrAddIfExists(o){return this.has(o)?this.get(o):(this.#c(o),this.#o(o))}#o(o){let d=new roe(this.#e,o);return this.addDirectory(d),d}addDirectory(o){let d=o.getPath(),g=x.FileUtils.getDirPath(d),E=g===d;for(let R of this.#i.getValues()){let G=R.getPath(),le=x.FileUtils.getDirPath(G);!(le===G)&&le===d&&this.#i.removeByKey(G)}E||this.#a(o),this.has(g)||this.#i.set(d,o),this.#t.set(d,o),this.#e.fileSystemWrapper.directoryExistsSync(d)||this.#e.fileSystemWrapper.queueMkdir(d);for(let R of this.#i.getValues())o.isAncestorOf(R)&&this.#c(R.getPath())}#a(o){if(x.FileUtils.isRootDirPath(o.getPath()))return;let d=x.FileUtils.getDirPath(o.getPath());this.#r.getOrCreate(d,()=>new x.SortedKeyValueArray(E=>E.getBaseName(),x.LocaleStringComparer.instance)).set(o)}#s(o){if(x.FileUtils.isRootDirPath(o))return;let d=x.FileUtils.getDirPath(o),g=this.#r.get(d);g!=null&&(g.removeByKey(x.FileUtils.getBaseName(o)),g.hasItems()||this.#r.removeByKey(d))}#c(o){let d=[],g=x.FileUtils.getDirPath(o);for(;o!==g;){if(o=g,g=x.FileUtils.getDirPath(o),this.#t.has(o)){for(let E of d)this.#o(E);break}d.unshift(o)}}},vDe=class extends x.KeyValueCache{#e=[];getOrCreate(o,d){return super.getOrCreate(o,()=>{let g=d();return this.#e.length>0&&this.#e[this.#e.length-1].add(g),g})}setForgetPoint(){this.#e.push(new Set)}forgetLastPoint(){let o=this.#e.pop();o!=null&&this.#n(o.values())}rememberNode(o){if(o.wasForgotten())throw new x.errors.InvalidOperationError("Cannot remember a node that was removed or forgotten.");let d=!1;for(let g of this.#e)if(g.delete(o)){d=!0;break}return d&&this.#t(o),d}#t(o){let d=o.getParentSyntaxList()||o.getParent();d!=null&&this.rememberNode(d)}#n(o){for(let d of o)d.wasForgotten()||d.getKind()===x.SyntaxKind.SourceFile||d._forgetOnlyThis()}},I2t={[x.SyntaxKind.SourceFile]:X8,[x.SyntaxKind.ArrayBindingPattern]:lte,[x.SyntaxKind.ArrayLiteralExpression]:pte,[x.SyntaxKind.ArrayType]:Vne,[x.SyntaxKind.ArrowFunction]:Cne,[x.SyntaxKind.AsExpression]:fte,[x.SyntaxKind.AwaitExpression]:mte,[x.SyntaxKind.BigIntLiteral]:Cie,[x.SyntaxKind.BindingElement]:cte,[x.SyntaxKind.BinaryExpression]:q5,[x.SyntaxKind.Block]:Gte,[x.SyntaxKind.BreakStatement]:Vte,[x.SyntaxKind.CallExpression]:_te,[x.SyntaxKind.CallSignature]:aie,[x.SyntaxKind.CaseBlock]:jte,[x.SyntaxKind.CaseClause]:Ute,[x.SyntaxKind.CatchClause]:Hte,[x.SyntaxKind.ClassDeclaration]:Mne,[x.SyntaxKind.ClassExpression]:Lne,[x.SyntaxKind.ClassStaticBlockDeclaration]:kne,[x.SyntaxKind.ConditionalType]:jne,[x.SyntaxKind.Constructor]:One,[x.SyntaxKind.ConstructorType]:Une,[x.SyntaxKind.ConstructSignature]:lie,[x.SyntaxKind.ContinueStatement]:Jte,[x.SyntaxKind.CommaListExpression]:hte,[x.SyntaxKind.ComputedPropertyName]:fie,[x.SyntaxKind.ConditionalExpression]:gte,[x.SyntaxKind.DebuggerStatement]:qte,[x.SyntaxKind.Decorator]:zne,[x.SyntaxKind.DefaultClause]:Xte,[x.SyntaxKind.DeleteExpression]:yte,[x.SyntaxKind.DoStatement]:$te,[x.SyntaxKind.ElementAccessExpression]:$5,[x.SyntaxKind.EmptyStatement]:Yte,[x.SyntaxKind.EnumDeclaration]:rie,[x.SyntaxKind.EnumMember]:iie,[x.SyntaxKind.ExportAssignment]:cne,[x.SyntaxKind.ExportDeclaration]:dne,[x.SyntaxKind.ExportSpecifier]:une,[x.SyntaxKind.ExpressionWithTypeArguments]:Hne,[x.SyntaxKind.ExpressionStatement]:Qte,[x.SyntaxKind.ExternalModuleReference]:pne,[x.SyntaxKind.QualifiedName]:_ie,[x.SyntaxKind.ForInStatement]:Zte,[x.SyntaxKind.ForOfStatement]:ene,[x.SyntaxKind.ForStatement]:tne,[x.SyntaxKind.FunctionDeclaration]:Pne,[x.SyntaxKind.FunctionExpression]:Nne,[x.SyntaxKind.FunctionType]:Kne,[x.SyntaxKind.GetAccessor]:Fne,[x.SyntaxKind.HeritageClause]:oie,[x.SyntaxKind.Identifier]:e9,[x.SyntaxKind.IfStatement]:nne,[x.SyntaxKind.ImportClause]:_ne,[x.SyntaxKind.ImportDeclaration]:hne,[x.SyntaxKind.ImportEqualsDeclaration]:gne,[x.SyntaxKind.ImportSpecifier]:yne,[x.SyntaxKind.ImportType]:Jne,[x.SyntaxKind.ImportAttribute]:fne,[x.SyntaxKind.ImportAttributes]:mne,[x.SyntaxKind.IndexedAccessType]:qne,[x.SyntaxKind.IndexSignature]:cie,[x.SyntaxKind.InferType]:Xne,[x.SyntaxKind.InterfaceDeclaration]:die,[x.SyntaxKind.IntersectionType]:$ne,[x.SyntaxKind.JSDocAllType]:mre,[x.SyntaxKind.JSDocAugmentsTag]:_re,[x.SyntaxKind.JSDocAuthorTag]:hre,[x.SyntaxKind.JSDocCallbackTag]:gre,[x.SyntaxKind.JSDocClassTag]:yre,[x.SyntaxKind.JSDocDeprecatedTag]:vre,[x.SyntaxKind.JSDocEnumTag]:bre,[x.SyntaxKind.JSDocFunctionType]:Sre,[x.SyntaxKind.JSDocImplementsTag]:Tre,[x.SyntaxKind.JSDocImportTag]:Ere,[x.SyntaxKind.JSDocLink]:xre,[x.SyntaxKind.JSDocLinkCode]:Are,[x.SyntaxKind.JSDocLinkPlain]:Dre,[x.SyntaxKind.JSDocMemberName]:Ire,[x.SyntaxKind.JSDocNamepathType]:Cre,[x.SyntaxKind.JSDocNameReference]:Pre,[x.SyntaxKind.JSDocNonNullableType]:Nre,[x.SyntaxKind.JSDocNullableType]:Rre,[x.SyntaxKind.JSDocOptionalType]:Mre,[x.SyntaxKind.JSDocOverrideTag]:kre,[x.SyntaxKind.JSDocParameterTag]:wre,[x.SyntaxKind.JSDocPrivateTag]:Ore,[x.SyntaxKind.JSDocPropertyTag]:Fre,[x.SyntaxKind.JSDocProtectedTag]:Wre,[x.SyntaxKind.JSDocPublicTag]:Bre,[x.SyntaxKind.JSDocReturnTag]:Gre,[x.SyntaxKind.JSDocReadonlyTag]:zre,[x.SyntaxKind.JSDocThrowsTag]:qre,[x.SyntaxKind.JSDocOverloadTag]:Lre,[x.SyntaxKind.JSDocSatisfiesTag]:Vre,[x.SyntaxKind.JSDocSeeTag]:jre,[x.SyntaxKind.JSDocSignature]:Ure,[x.SyntaxKind.JSDocTag]:Zre,[x.SyntaxKind.JSDocTemplateTag]:Hre,[x.SyntaxKind.JSDocText]:Kre,[x.SyntaxKind.JSDocThisTag]:Jre,[x.SyntaxKind.JSDocTypeExpression]:$re,[x.SyntaxKind.JSDocTypeLiteral]:Yre,[x.SyntaxKind.JSDocTypeTag]:Qre,[x.SyntaxKind.JSDocTypedefTag]:Xre,[x.SyntaxKind.JSDocUnknownType]:eie,[x.SyntaxKind.JSDocVariadicType]:tie,[x.SyntaxKind.JsxAttribute]:hie,[x.SyntaxKind.JsxClosingElement]:gie,[x.SyntaxKind.JsxClosingFragment]:yie,[x.SyntaxKind.JsxElement]:vie,[x.SyntaxKind.JsxExpression]:bie,[x.SyntaxKind.JsxFragment]:Sie,[x.SyntaxKind.JsxNamespacedName]:Tie,[x.SyntaxKind.JsxOpeningElement]:Eie,[x.SyntaxKind.JsxOpeningFragment]:xie,[x.SyntaxKind.JsxSelfClosingElement]:Aie,[x.SyntaxKind.JsxSpreadAttribute]:Die,[x.SyntaxKind.JsxText]:Iie,[x.SyntaxKind.LabeledStatement]:rne,[x.SyntaxKind.LiteralType]:Yne,[x.SyntaxKind.MappedType]:Qne,[x.SyntaxKind.MetaProperty]:bte,[x.SyntaxKind.MethodDeclaration]:Q8,[x.SyntaxKind.MethodSignature]:uie,[x.SyntaxKind.ModuleBlock]:vne,[x.SyntaxKind.ModuleDeclaration]:bne,[x.SyntaxKind.NamedExports]:Sne,[x.SyntaxKind.NamedImports]:Tne,[x.SyntaxKind.NamedTupleMember]:Zne,[x.SyntaxKind.NamespaceExport]:Ene,[x.SyntaxKind.NamespaceImport]:xne,[x.SyntaxKind.NewExpression]:Ste,[x.SyntaxKind.NonNullExpression]:Tte,[x.SyntaxKind.NotEmittedStatement]:ine,[x.SyntaxKind.NoSubstitutionTemplateLiteral]:wie,[x.SyntaxKind.NumericLiteral]:Mie,[x.SyntaxKind.ObjectBindingPattern]:dte,[x.SyntaxKind.ObjectLiteralExpression]:xte,[x.SyntaxKind.OmittedExpression]:Cte,[x.SyntaxKind.OptionalType]:ere,[x.SyntaxKind.Parameter]:Rne,[x.SyntaxKind.ParenthesizedExpression]:Pte,[x.SyntaxKind.ParenthesizedType]:tre,[x.SyntaxKind.PartiallyEmittedExpression]:Nte,[x.SyntaxKind.PostfixUnaryExpression]:Rte,[x.SyntaxKind.PrefixUnaryExpression]:Mte,[x.SyntaxKind.PrivateIdentifier]:mie,[x.SyntaxKind.PropertyAccessExpression]:Y5,[x.SyntaxKind.PropertyAssignment]:Ate,[x.SyntaxKind.PropertyDeclaration]:Wne,[x.SyntaxKind.PropertySignature]:pie,[x.SyntaxKind.RegularExpressionLiteral]:Lie,[x.SyntaxKind.RestType]:nre,[x.SyntaxKind.ReturnStatement]:one,[x.SyntaxKind.SatisfiesExpression]:Lte,[x.SyntaxKind.SetAccessor]:Bne,[x.SyntaxKind.ShorthandPropertyAssignment]:Dte,[x.SyntaxKind.SpreadAssignment]:Ite,[x.SyntaxKind.SpreadElement]:kte,[x.SyntaxKind.StringLiteral]:kie,[x.SyntaxKind.SwitchStatement]:ane,[x.SyntaxKind.SyntaxList]:ite,[x.SyntaxKind.TaggedTemplateExpression]:Oie,[x.SyntaxKind.TemplateExpression]:Fie,[x.SyntaxKind.TemplateHead]:Wie,[x.SyntaxKind.TemplateLiteralType]:rre,[x.SyntaxKind.TemplateMiddle]:Bie,[x.SyntaxKind.TemplateSpan]:zie,[x.SyntaxKind.TemplateTail]:Gie,[x.SyntaxKind.ThisType]:ire,[x.SyntaxKind.ThrowStatement]:sne,[x.SyntaxKind.TryStatement]:lne,[x.SyntaxKind.TupleType]:ore,[x.SyntaxKind.TypeAliasDeclaration]:are,[x.SyntaxKind.TypeAssertionExpression]:Fte,[x.SyntaxKind.TypeLiteral]:sre,[x.SyntaxKind.TypeOperator]:lre,[x.SyntaxKind.TypeParameter]:cre,[x.SyntaxKind.TypePredicate]:dre,[x.SyntaxKind.TypeQuery]:ure,[x.SyntaxKind.TypeReference]:pre,[x.SyntaxKind.UnionType]:fre,[x.SyntaxKind.VariableDeclaration]:Vie,[x.SyntaxKind.VariableDeclarationList]:jie,[x.SyntaxKind.VariableStatement]:Ane,[x.SyntaxKind.JSDoc]:Gne,[x.SyntaxKind.TypeOfExpression]:Wte,[x.SyntaxKind.WhileStatement]:Dne,[x.SyntaxKind.WithStatement]:Ine,[x.SyntaxKind.YieldExpression]:zte,[x.SyntaxKind.SemicolonToken]:yn,[x.SyntaxKind.AnyKeyword]:Xp,[x.SyntaxKind.BooleanKeyword]:Xp,[x.SyntaxKind.FalseKeyword]:Nie,[x.SyntaxKind.ImportKeyword]:vte,[x.SyntaxKind.InferKeyword]:yn,[x.SyntaxKind.NeverKeyword]:yn,[x.SyntaxKind.NullKeyword]:Rie,[x.SyntaxKind.NumberKeyword]:Xp,[x.SyntaxKind.ObjectKeyword]:Xp,[x.SyntaxKind.StringKeyword]:Xp,[x.SyntaxKind.SymbolKeyword]:Xp,[x.SyntaxKind.SuperKeyword]:wte,[x.SyntaxKind.ThisKeyword]:Ote,[x.SyntaxKind.TrueKeyword]:Pie,[x.SyntaxKind.UndefinedKeyword]:Xp,[x.SyntaxKind.VoidExpression]:Bte},bDe=class{#e;#t=new Map;#n=new x.WeakCache;#r=new x.WeakCache;#i=new x.WeakCache;#o=new x.WeakCache;#a=new x.WeakCache;#s=new x.WeakCache;#c=new x.WeakCache;#m=new x.WeakCache;#_=new x.WeakCache;#E=new x.WeakCache;#S=new x.WeakCache;#g=new x.WeakCache;#y=new x.WeakCache;#u=new vDe;#p;#h=new x.EventContainer;#T=new x.EventContainer;documentRegistry;constructor(o){this.documentRegistry=new x.DocumentRegistry(o.fileSystemWrapper),this.#p=new yDe(o),o.compilerOptions.onModified(()=>{let d=Array.from(this.#t.values());for(let g of d)zkt(g)}),this.#e=o}*getSourceFilesByDirectoryDepth(){for(let o of this.getDirectoriesByDepth())yield*o.getSourceFiles()}getSourceFilePaths(){return this.#t.keys()}getChildDirectoriesOfDirectory(o){return this.#p.getChildDirectoriesOfDirectory(o)}getChildSourceFilesOfDirectory(o){return this.#p.getChildSourceFilesOfDirectory(o)}onSourceFileAdded(o,d=!0){d?this.#h.subscribe(o):this.#h.unsubscribe(o)}onSourceFileRemoved(o){this.#T.subscribe(o)}createSourceFile(o,d,g){if(d=d instanceof Function?t0(this.#e.createWriter(),d):d||"",typeof d=="string")return this.createSourceFileFromText(o,d,g);let E=this.#e.createWriter();return this.#e.structurePrinterFactory.forSourceFile({isAmbient:x.FileUtils.getExtension(o)===".d.ts"}).printText(E,d),this.createSourceFileFromText(o,E.toString(),g)}createSourceFileFromText(o,d,g){return o=this.#e.fileSystemWrapper.getStandardizedAbsolutePath(o),g.overwrite===!0?this.#f(o,d,g):(this.throwIfFileExists(o,"Did you mean to provide the overwrite option?"),this.#v(o,d,g))}throwIfFileExists(o,d){if(!(!this.containsSourceFileAtPath(o)&&!this.#e.fileSystemWrapper.fileExistsSync(o)))throw d=d==null?"":d+" ",new x.errors.InvalidOperationError(`${d}A source file already exists at the provided file path: ${o}`)}#f(o,d,g){o=this.#e.fileSystemWrapper.getStandardizedAbsolutePath(o);let E=this.addOrGetSourceFileFromFilePath(o,g);return E!=null?(E.getChildren().forEach(R=>R.forget()),this.replaceCompilerNode(E,this.createCompilerSourceFileFromText(o,d,g.scriptKind)),E):this.#v(o,d,g)}getSourceFileFromCacheFromFilePath(o){return o=this.#e.fileSystemWrapper.getStandardizedAbsolutePath(o),this.#t.get(o)}addOrGetSourceFileFromFilePath(o,d){o=this.#e.fileSystemWrapper.getStandardizedAbsolutePath(o);let g=this.#t.get(o);if(g==null){let E=this.#e.fileSystemWrapper.readFileIfExistsSync(o,this.#e.getEncoding());E!=null&&(this.#e.logger.log(`Loaded file: ${o}`),g=this.#v(o,E,d),g._setIsSaved(!0))}return g!=null&&d.markInProject&&g._markAsInProject(),g}containsSourceFileAtPath(o){return o=this.#e.fileSystemWrapper.getStandardizedAbsolutePath(o),this.#t.has(o)}containsDirectoryAtPath(o){return o=this.#e.fileSystemWrapper.getStandardizedAbsolutePath(o),this.#p.has(o)}getSourceFileForNode(o){let d=o;for(;d.kind!==x.SyntaxKind.SourceFile;){if(d.parent==null)return;d=d.parent}return this.getSourceFile(d,{markInProject:!1})}hasCompilerNode(o){return this.#u.has(o)}getExistingNodeFromCompilerNode(o){return this.#u.get(o)}getNodeFromCompilerNode(o,d){if(o.kind===x.SyntaxKind.SourceFile)return this.getSourceFile(o,{markInProject:!1});return this.#u.getOrCreate(o,()=>{let G=g.call(this);return R.call(this,G),G});function g(){if(E(o))return Fb.isCommentStatement(o)?new Kte(this.#e,o,d):Fb.isCommentClassElement(o)?new wne(this.#e,o,d):Fb.isCommentTypeElement(o)?new sie(this.#e,o,d):Fb.isCommentObjectLiteralElement(o)?new Ete(this.#e,o,d):Fb.isCommentEnumMember(o)?new nie(this.#e,o,d):x.errors.throwNotImplementedForNeverValueError(o);let G=I2t[o.kind]||yn;return new G(this.#e,o,d)}function E(G){return G._commentKind!=null}function R(G){if(o.parent!=null){let Re=this.getNodeFromCompilerNode(o.parent,d);Re._wrappedChildCount++}let le=G._getParentSyntaxListIfWrapped();if(le!=null&&le._wrappedChildCount++,o.kind===x.SyntaxKind.SyntaxList){let Re=0;for(let nt of G._getChildrenInCacheIterator())Re++;G._wrappedChildCount=Re}}}#v(o,d,g){let E=x.StringUtils.hasBom(d);E&&(d=x.StringUtils.stripBom(d));let R=this.getSourceFile(this.createCompilerSourceFileFromText(o,d,g.scriptKind),g);return E&&(R._hasBom=!0),R}createCompilerSourceFileFromText(o,d,g){return this.documentRegistry.createOrUpdateSourceFile(o,this.#e.compilerOptions.get(),x.ts.ScriptSnapshot.fromString(d),g)}getSourceFile(o,d){let g=!1,E=this.#t.get(o.fileName)??this.#u.getOrCreate(o,()=>{let R=new X8(this.#e,o);return d.markInProject||this.#e.inProjectCoordinator.setSourceFileNotInProject(R),this.#l(R),g=!0,R});return d.markInProject&&E._markAsInProject(),g&&this.#h.fire(E),E}#l(o){this.#t.set(o.getFilePath(),o),this.#e.fileSystemWrapper.removeFileDelete(o.getFilePath()),this.#p.addSourceFile(o)}getDirectoryFromPath(o,d){o=this.#e.fileSystemWrapper.getStandardizedAbsolutePath(o);let g=this.#p.get(o);return g==null&&this.#e.fileSystemWrapper.directoryExistsSync(o)&&(g=this.#p.createOrAddIfExists(o)),g!=null&&d.markInProject&&g._markAsInProject(),g}createDirectoryOrAddIfExists(o,d){let g=this.#p.createOrAddIfExists(o);return g!=null&&d.markInProject&&g._markAsInProject(),g}getDirectoryFromCache(o){return this.#p.get(o)}getDirectoryFromCacheOnlyIfInCache(o){return this.#p.has(o)?this.#p.get(o):void 0}getDirectoriesByDepth(){return this.#p.getAllByDepth()}getOrphanDirectories(){return this.#p.getOrphans()}getSymbolDisplayPart(o){return this.#m.getOrCreate(o,()=>new Zie(o))}getType(o){return(o.flags&x.TypeFlags.TypeParameter)===x.TypeFlags.TypeParameter?this.getTypeParameter(o):this.#g.getOrCreate(o,()=>new i9(this.#e,o))}getTypeParameter(o){return this.#y.getOrCreate(o,()=>new noe(this.#e,o))}getSignature(o){return this.#s.getOrCreate(o,()=>new Uie(this.#e,o))}getSymbol(o){return this.#c.getOrCreate(o,()=>new OXe(this.#e,o))}getDefinitionInfo(o){return this.#r.getOrCreate(o,()=>new HDe(this.#e,o))}getDocumentSpan(o){return this.#i.getOrCreate(o,()=>new s6(this.#e,o))}getReferencedSymbolEntry(o){return this.#_.getOrCreate(o,()=>new Yie(this.#e,o))}getReferencedSymbol(o){return this.#E.getOrCreate(o,()=>new GXe(this.#e,o))}getReferencedSymbolDefinitionInfo(o){return this.#S.getOrCreate(o,()=>new VXe(this.#e,o))}getDiagnostic(o){return this.#n.getOrCreate(o,()=>o.start!=null?new n9(this.#e,o):new yoe(this.#e,o))}getDiagnosticWithLocation(o){return this.#n.getOrCreate(o,()=>new n9(this.#e,o))}getDiagnosticMessageChain(o){return this.#o.getOrCreate(o,()=>new t9(o))}getJSDocTagInfo(o){return this.#a.getOrCreate(o,()=>new Z5(o))}replaceCompilerNode(o,d){let g=o instanceof yn?o.compilerNode:o,E=o instanceof yn?o:this.#u.get(o);if(g.kind===x.SyntaxKind.SourceFile&&g.fileName!==d.fileName){let R=E;this.#d(g),R._replaceCompilerNodeFromFactory(d),this.#u.set(d,R),this.#l(R),this.#h.fire(R)}else this.#u.replaceKey(g,d),E?._replaceCompilerNodeFromFactory(d)}removeNodeFromCache(o){this.#d(o.compilerNode)}#d(o){if(this.#u.removeByKey(o),o.kind===x.SyntaxKind.SourceFile){let d=o,g=this.#e.fileSystemWrapper.getStandardizedAbsolutePath(d.fileName);this.#p.removeSourceFile(g);let E=this.#t.get(g);this.#t.delete(g),this.documentRegistry.removeSourceFile(g),E!=null&&this.#T.fire(E)}}addDirectoryToCache(o){this.#p.addDirectory(o)}removeDirectoryFromCache(o){this.#p.remove(o)}forgetNodesCreatedInBlock(o){this.#u.setForgetPoint();let d=!1,g;try{if(g=o((...R)=>{for(let G of R)this.#u.rememberNode(G)}),yn.isNode(g)&&this.#u.rememberNode(g),E(g))return d=!0,g.then(R=>(yn.isNode(R)&&this.#u.rememberNode(R),this.#u.forgetLastPoint(),R))}finally{d||this.#u.forgetLastPoint()}return g;function E(R){return R!=null&&typeof R.then=="function"}}},SDe=class{#e;#t=new Set;constructor(o){o.onSourceFileRemoved(d=>{this.#t.delete(d)}),this.#e=o}setSourceFileNotInProject(o){this.#t.add(o),o._inProject=!1}markSourceFileAsInProject(o){this.isSourceFileInProject(o)||(this.#n(o),this.#t.delete(o))}markSourceFilesAsInProjectForResolution(){let o="/node_modules/",d=this.#e,g=[],E=[];for(let G of[...this.#t.values()])R(G)?(this.#n(G),this.#t.delete(G),g.push(G)):E.push(G);return{changedSourceFiles:g,unchangedSourceFiles:E};function R(G){let le=G.getFilePath(),Re=le.toLowerCase().lastIndexOf(o);if(Re===-1)return!0;let nt=le.substring(0,Re+o.length-1),at=d.getDirectoryFromCacheOnlyIfInCache(nt);if(at!=null&&at._isInProject())return!0;let dt=G.getDirectory();for(;dt!=null&&dt.getPath()!==nt;){if(dt._isInProject())return!0;dt=d.getDirectoryFromCacheOnlyIfInCache(x.FileUtils.getDirPath(dt.getPath()))}return!1}}#n(o){o._inProject=!0,this.markDirectoryAsInProject(o.getDirectory())}isSourceFileInProject(o){return o._inProject===!0}setDirectoryAndFilesAsNotInProjectForTesting(o){for(let d of o.getDirectories())this.setDirectoryAndFilesAsNotInProjectForTesting(d);for(let d of o.getSourceFiles())delete d._inProject,this.#t.add(d);delete o._inProject}markDirectoryAsInProject(o){if(this.isDirectoryInProject(o))return;let d=this,g=this.#e;o._inProject=!0,E(o);function E(G){let le=Array.from(R(G)),Re=le[le.length-1];if(!(Re==null||!d.isDirectoryInProject(Re)))for(let nt of le)nt._inProject=!0}function*R(G){if(x.FileUtils.isRootDirPath(G.getPath()))return;let le=x.FileUtils.getDirPath(G.getPath()),Re=g.getDirectoryFromCacheOnlyIfInCache(le);Re!=null&&(yield Re,d.isDirectoryInProject(Re)||(yield*R(Re)))}}isDirectoryInProject(o){return o._inProject===!0}},jXe=(()=>{let h=[],o,d,g,E,R,G,le,Re,nt,at,dt,xe,gn,pt,ut,yi,wi,eo,qa,bl,Sa,Lr,In,Ii,_i,Fr,bi,fd,Rc,fn,Ai,qc,vn,vd,Qs,Xc,aa,yT,vT,ky,wl,Gi,Sh,Uo,lc,Ko,Ol,Hd,gt,bd,Wi;return class{static{let Wo=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;o=[x.Memoize],d=[x.Memoize],g=[x.Memoize],E=[x.Memoize],R=[x.Memoize],G=[x.Memoize],le=[x.Memoize],Re=[x.Memoize],nt=[x.Memoize],at=[x.Memoize],dt=[x.Memoize],xe=[x.Memoize],gn=[x.Memoize],pt=[x.Memoize],ut=[x.Memoize],yi=[x.Memoize],wi=[x.Memoize],eo=[x.Memoize],qa=[x.Memoize],bl=[x.Memoize],Sa=[x.Memoize],Lr=[x.Memoize],In=[x.Memoize],Ii=[x.Memoize],_i=[x.Memoize],Fr=[x.Memoize],bi=[x.Memoize],fd=[x.Memoize],Rc=[x.Memoize],fn=[x.Memoize],Ai=[x.Memoize],qc=[x.Memoize],vn=[x.Memoize],vd=[x.Memoize],Qs=[x.Memoize],Xc=[x.Memoize],aa=[x.Memoize],yT=[x.Memoize],vT=[x.Memoize],ky=[x.Memoize],wl=[x.Memoize],Gi=[x.Memoize],Sh=[x.Memoize],Uo=[x.Memoize],lc=[x.Memoize],Ko=[x.Memoize],Ol=[x.Memoize],Hd=[x.Memoize],gt=[x.Memoize],bd=[x.Memoize],Wi=[x.Memoize],ja(this,null,o,{kind:"method",name:"forInitializerExpressionableNode",static:!1,private:!1,access:{has:jn=>"forInitializerExpressionableNode"in jn,get:jn=>jn.forInitializerExpressionableNode},metadata:Wo},null,h),ja(this,null,d,{kind:"method",name:"forModifierableNode",static:!1,private:!1,access:{has:jn=>"forModifierableNode"in jn,get:jn=>jn.forModifierableNode},metadata:Wo},null,h),ja(this,null,g,{kind:"method",name:"forReturnTypedNode",static:!1,private:!1,access:{has:jn=>"forReturnTypedNode"in jn,get:jn=>jn.forReturnTypedNode},metadata:Wo},null,h),ja(this,null,E,{kind:"method",name:"forTypedNode",static:!1,private:!1,access:{has:jn=>"forTypedNode"in jn,get:jn=>jn.forTypedNode},metadata:Wo},null,h),ja(this,null,R,{kind:"method",name:"forClassDeclaration",static:!1,private:!1,access:{has:jn=>"forClassDeclaration"in jn,get:jn=>jn.forClassDeclaration},metadata:Wo},null,h),ja(this,null,G,{kind:"method",name:"forClassMember",static:!1,private:!1,access:{has:jn=>"forClassMember"in jn,get:jn=>jn.forClassMember},metadata:Wo},null,h),ja(this,null,le,{kind:"method",name:"forClassStaticBlockDeclaration",static:!1,private:!1,access:{has:jn=>"forClassStaticBlockDeclaration"in jn,get:jn=>jn.forClassStaticBlockDeclaration},metadata:Wo},null,h),ja(this,null,Re,{kind:"method",name:"forConstructorDeclaration",static:!1,private:!1,access:{has:jn=>"forConstructorDeclaration"in jn,get:jn=>jn.forConstructorDeclaration},metadata:Wo},null,h),ja(this,null,nt,{kind:"method",name:"forGetAccessorDeclaration",static:!1,private:!1,access:{has:jn=>"forGetAccessorDeclaration"in jn,get:jn=>jn.forGetAccessorDeclaration},metadata:Wo},null,h),ja(this,null,at,{kind:"method",name:"forMethodDeclaration",static:!1,private:!1,access:{has:jn=>"forMethodDeclaration"in jn,get:jn=>jn.forMethodDeclaration},metadata:Wo},null,h),ja(this,null,dt,{kind:"method",name:"forPropertyDeclaration",static:!1,private:!1,access:{has:jn=>"forPropertyDeclaration"in jn,get:jn=>jn.forPropertyDeclaration},metadata:Wo},null,h),ja(this,null,xe,{kind:"method",name:"forSetAccessorDeclaration",static:!1,private:!1,access:{has:jn=>"forSetAccessorDeclaration"in jn,get:jn=>jn.forSetAccessorDeclaration},metadata:Wo},null,h),ja(this,null,gn,{kind:"method",name:"forDecorator",static:!1,private:!1,access:{has:jn=>"forDecorator"in jn,get:jn=>jn.forDecorator},metadata:Wo},null,h),ja(this,null,pt,{kind:"method",name:"forJSDoc",static:!1,private:!1,access:{has:jn=>"forJSDoc"in jn,get:jn=>jn.forJSDoc},metadata:Wo},null,h),ja(this,null,ut,{kind:"method",name:"forJSDocTag",static:!1,private:!1,access:{has:jn=>"forJSDocTag"in jn,get:jn=>jn.forJSDocTag},metadata:Wo},null,h),ja(this,null,yi,{kind:"method",name:"forEnumDeclaration",static:!1,private:!1,access:{has:jn=>"forEnumDeclaration"in jn,get:jn=>jn.forEnumDeclaration},metadata:Wo},null,h),ja(this,null,wi,{kind:"method",name:"forEnumMember",static:!1,private:!1,access:{has:jn=>"forEnumMember"in jn,get:jn=>jn.forEnumMember},metadata:Wo},null,h),ja(this,null,eo,{kind:"method",name:"forObjectLiteralExpressionProperty",static:!1,private:!1,access:{has:jn=>"forObjectLiteralExpressionProperty"in jn,get:jn=>jn.forObjectLiteralExpressionProperty},metadata:Wo},null,h),ja(this,null,qa,{kind:"method",name:"forPropertyAssignment",static:!1,private:!1,access:{has:jn=>"forPropertyAssignment"in jn,get:jn=>jn.forPropertyAssignment},metadata:Wo},null,h),ja(this,null,bl,{kind:"method",name:"forShorthandPropertyAssignment",static:!1,private:!1,access:{has:jn=>"forShorthandPropertyAssignment"in jn,get:jn=>jn.forShorthandPropertyAssignment},metadata:Wo},null,h),ja(this,null,Sa,{kind:"method",name:"forSpreadAssignment",static:!1,private:!1,access:{has:jn=>"forSpreadAssignment"in jn,get:jn=>jn.forSpreadAssignment},metadata:Wo},null,h),ja(this,null,Lr,{kind:"method",name:"forFunctionDeclaration",static:!1,private:!1,access:{has:jn=>"forFunctionDeclaration"in jn,get:jn=>jn.forFunctionDeclaration},metadata:Wo},null,h),ja(this,null,In,{kind:"method",name:"forParameterDeclaration",static:!1,private:!1,access:{has:jn=>"forParameterDeclaration"in jn,get:jn=>jn.forParameterDeclaration},metadata:Wo},null,h),ja(this,null,Ii,{kind:"method",name:"forCallSignatureDeclaration",static:!1,private:!1,access:{has:jn=>"forCallSignatureDeclaration"in jn,get:jn=>jn.forCallSignatureDeclaration},metadata:Wo},null,h),ja(this,null,_i,{kind:"method",name:"forConstructSignatureDeclaration",static:!1,private:!1,access:{has:jn=>"forConstructSignatureDeclaration"in jn,get:jn=>jn.forConstructSignatureDeclaration},metadata:Wo},null,h),ja(this,null,Fr,{kind:"method",name:"forIndexSignatureDeclaration",static:!1,private:!1,access:{has:jn=>"forIndexSignatureDeclaration"in jn,get:jn=>jn.forIndexSignatureDeclaration},metadata:Wo},null,h),ja(this,null,bi,{kind:"method",name:"forInterfaceDeclaration",static:!1,private:!1,access:{has:jn=>"forInterfaceDeclaration"in jn,get:jn=>jn.forInterfaceDeclaration},metadata:Wo},null,h),ja(this,null,fd,{kind:"method",name:"forMethodSignature",static:!1,private:!1,access:{has:jn=>"forMethodSignature"in jn,get:jn=>jn.forMethodSignature},metadata:Wo},null,h),ja(this,null,Rc,{kind:"method",name:"forPropertySignature",static:!1,private:!1,access:{has:jn=>"forPropertySignature"in jn,get:jn=>jn.forPropertySignature},metadata:Wo},null,h),ja(this,null,fn,{kind:"method",name:"forTypeElementMemberedNode",static:!1,private:!1,access:{has:jn=>"forTypeElementMemberedNode"in jn,get:jn=>jn.forTypeElementMemberedNode},metadata:Wo},null,h),ja(this,null,Ai,{kind:"method",name:"forTypeElementMember",static:!1,private:!1,access:{has:jn=>"forTypeElementMember"in jn,get:jn=>jn.forTypeElementMember},metadata:Wo},null,h),ja(this,null,qc,{kind:"method",name:"forJsxAttributeDecider",static:!1,private:!1,access:{has:jn=>"forJsxAttributeDecider"in jn,get:jn=>jn.forJsxAttributeDecider},metadata:Wo},null,h),ja(this,null,vn,{kind:"method",name:"forJsxAttribute",static:!1,private:!1,access:{has:jn=>"forJsxAttribute"in jn,get:jn=>jn.forJsxAttribute},metadata:Wo},null,h),ja(this,null,vd,{kind:"method",name:"forJsxChildDecider",static:!1,private:!1,access:{has:jn=>"forJsxChildDecider"in jn,get:jn=>jn.forJsxChildDecider},metadata:Wo},null,h),ja(this,null,Qs,{kind:"method",name:"forJsxElement",static:!1,private:!1,access:{has:jn=>"forJsxElement"in jn,get:jn=>jn.forJsxElement},metadata:Wo},null,h),ja(this,null,Xc,{kind:"method",name:"forJsxNamespacedName",static:!1,private:!1,access:{has:jn=>"forJsxNamespacedName"in jn,get:jn=>jn.forJsxNamespacedName},metadata:Wo},null,h),ja(this,null,aa,{kind:"method",name:"forJsxSelfClosingElement",static:!1,private:!1,access:{has:jn=>"forJsxSelfClosingElement"in jn,get:jn=>jn.forJsxSelfClosingElement},metadata:Wo},null,h),ja(this,null,yT,{kind:"method",name:"forJsxSpreadAttribute",static:!1,private:!1,access:{has:jn=>"forJsxSpreadAttribute"in jn,get:jn=>jn.forJsxSpreadAttribute},metadata:Wo},null,h),ja(this,null,vT,{kind:"method",name:"forExportAssignment",static:!1,private:!1,access:{has:jn=>"forExportAssignment"in jn,get:jn=>jn.forExportAssignment},metadata:Wo},null,h),ja(this,null,ky,{kind:"method",name:"forExportDeclaration",static:!1,private:!1,access:{has:jn=>"forExportDeclaration"in jn,get:jn=>jn.forExportDeclaration},metadata:Wo},null,h),ja(this,null,wl,{kind:"method",name:"forImportAttribute",static:!1,private:!1,access:{has:jn=>"forImportAttribute"in jn,get:jn=>jn.forImportAttribute},metadata:Wo},null,h),ja(this,null,Gi,{kind:"method",name:"forImportDeclaration",static:!1,private:!1,access:{has:jn=>"forImportDeclaration"in jn,get:jn=>jn.forImportDeclaration},metadata:Wo},null,h),ja(this,null,Sh,{kind:"method",name:"forModuleDeclaration",static:!1,private:!1,access:{has:jn=>"forModuleDeclaration"in jn,get:jn=>jn.forModuleDeclaration},metadata:Wo},null,h),ja(this,null,Uo,{kind:"method",name:"forNamedImportExportSpecifier",static:!1,private:!1,access:{has:jn=>"forNamedImportExportSpecifier"in jn,get:jn=>jn.forNamedImportExportSpecifier},metadata:Wo},null,h),ja(this,null,lc,{kind:"method",name:"forSourceFile",static:!1,private:!1,access:{has:jn=>"forSourceFile"in jn,get:jn=>jn.forSourceFile},metadata:Wo},null,h),ja(this,null,Ko,{kind:"method",name:"forStatementedNode",static:!1,private:!1,access:{has:jn=>"forStatementedNode"in jn,get:jn=>jn.forStatementedNode},metadata:Wo},null,h),ja(this,null,Ol,{kind:"method",name:"forStatement",static:!1,private:!1,access:{has:jn=>"forStatement"in jn,get:jn=>jn.forStatement},metadata:Wo},null,h),ja(this,null,Hd,{kind:"method",name:"forVariableStatement",static:!1,private:!1,access:{has:jn=>"forVariableStatement"in jn,get:jn=>jn.forVariableStatement},metadata:Wo},null,h),ja(this,null,gt,{kind:"method",name:"forTypeAliasDeclaration",static:!1,private:!1,access:{has:jn=>"forTypeAliasDeclaration"in jn,get:jn=>jn.forTypeAliasDeclaration},metadata:Wo},null,h),ja(this,null,bd,{kind:"method",name:"forTypeParameterDeclaration",static:!1,private:!1,access:{has:jn=>"forTypeParameterDeclaration"in jn,get:jn=>jn.forTypeParameterDeclaration},metadata:Wo},null,h),ja(this,null,Wi,{kind:"method",name:"forVariableDeclaration",static:!1,private:!1,access:{has:jn=>"forVariableDeclaration"in jn,get:jn=>jn.forVariableDeclaration},metadata:Wo},null,h),Wo&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:Wo})}_getFormatCodeSettings=kv(this,h);constructor(Wo){this._getFormatCodeSettings=Wo}getFormatCodeSettings(){return this._getFormatCodeSettings()}forInitializerExpressionableNode(){return new p1e}forModifierableNode(){return new f1e}forReturnTypedNode(Wo){return new m1e(Wo)}forTypedNode(Wo,jn){return new _1e(Wo,jn)}forClassDeclaration(Wo){return new g1e(this,Wo)}forClassMember(Wo){return new y1e(this,Wo)}forClassStaticBlockDeclaration(){return new v1e(this)}forConstructorDeclaration(Wo){return new b1e(this,Wo)}forGetAccessorDeclaration(Wo){return new S1e(this,Wo)}forMethodDeclaration(Wo){return new T1e(this,Wo)}forPropertyDeclaration(){return new E1e(this)}forSetAccessorDeclaration(Wo){return new x1e(this,Wo)}forDecorator(){return new A1e(this)}forJSDoc(){return new D1e(this)}forJSDocTag(Wo){return new I1e(this,Wo)}forEnumDeclaration(){return new C1e(this)}forEnumMember(){return new P1e(this)}forObjectLiteralExpressionProperty(){return new N1e(this)}forPropertyAssignment(){return new R1e(this)}forShorthandPropertyAssignment(){return new M1e(this)}forSpreadAssignment(){return new L1e(this)}forFunctionDeclaration(Wo){return new k1e(this,Wo)}forParameterDeclaration(){return new w1e(this)}forCallSignatureDeclaration(){return new O1e(this)}forConstructSignatureDeclaration(){return new F1e(this)}forIndexSignatureDeclaration(){return new W1e(this)}forInterfaceDeclaration(){return new B1e(this)}forMethodSignature(){return new z1e(this)}forPropertySignature(){return new G1e(this)}forTypeElementMemberedNode(){return new V1e(this)}forTypeElementMember(){return new j1e(this)}forJsxAttributeDecider(){return new U1e(this)}forJsxAttribute(){return new H1e(this)}forJsxChildDecider(){return new K1e(this)}forJsxElement(){return new J1e(this)}forJsxNamespacedName(){return new q1e(this)}forJsxSelfClosingElement(){return new X1e(this)}forJsxSpreadAttribute(){return new $1e(this)}forExportAssignment(){return new Y1e(this)}forExportDeclaration(){return new Q1e(this)}forImportAttribute(){return new Z1e(this)}forImportDeclaration(){return new eDe(this)}forModuleDeclaration(Wo){return new tDe(this,Wo)}forNamedImportExportSpecifier(){return new nDe(this)}forSourceFile(Wo){return new rDe(this,Wo)}forStatementedNode(Wo){return new iDe(this,Wo)}forStatement(Wo){return new oDe(this,Wo)}forVariableStatement(){return new aDe(this)}forTypeAliasDeclaration(){return new sDe(this)}forTypeParameterDeclaration(){return new lDe(this)}forVariableDeclaration(){return new cDe(this)}}})(),UXe=(()=>{let h=[],o,d;return class{static{let E=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;o=[x.Memoize],d=[x.Memoize],ja(this,null,o,{kind:"method",name:"getSourceFileContainer",static:!1,private:!1,access:{has:R=>"getSourceFileContainer"in R,get:R=>R.getSourceFileContainer},metadata:E},null,h),ja(this,null,d,{kind:"method",name:"getModuleResolutionHost",static:!1,private:!1,access:{has:R=>"getModuleResolutionHost"in R,get:R=>R.getModuleResolutionHost},metadata:E},null,h),E&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:E})}#e=kv(this,h);#t;#n;#r;get project(){if(this.#r==null)throw new x.errors.InvalidOperationError("This operation is not permitted in this context.");return this.#r}logger=new UAe;lazyReferenceCoordinator;directoryCoordinator;fileSystemWrapper;manipulationSettings=new tte;structurePrinterFactory;compilerFactory;inProjectCoordinator;constructor(E){this.#r=E.project,this.fileSystemWrapper=E.fileSystemWrapper,this.#t=E.compilerOptionsContainer,this.compilerFactory=new bDe(this),this.inProjectCoordinator=new SDe(this.compilerFactory),this.structurePrinterFactory=new jXe(()=>this.manipulationSettings.getFormatCodeSettings()),this.lazyReferenceCoordinator=new HAe(this.compilerFactory),this.directoryCoordinator=new gDe(this.compilerFactory,E.fileSystemWrapper),this.#e=E.createLanguageService?new toe({context:this,configFileParsingDiagnostics:E.configFileParsingDiagnostics,resolutionHost:E.resolutionHost&&E.resolutionHost(this.getModuleResolutionHost(),()=>this.compilerOptions.get()),skipLoadingLibFiles:E.skipLoadingLibFiles,libFolderPath:E.libFolderPath}):void 0,E.typeChecker!=null&&(x.errors.throwIfTrue(E.createLanguageService,"Cannot specify a type checker and create a language service."),this.#n=new r9(this),this.#n._reset(()=>E.typeChecker))}get compilerOptions(){return this.#t}get languageService(){if(this.#e==null)throw this.#i("language service");return this.#e}get program(){if(this.#e==null)throw this.#i("program");return this.languageService.getProgram()}get typeChecker(){if(this.#n!=null)return this.#n;if(this.#e==null)throw this.#i("type checker");return this.program.getTypeChecker()}hasLanguageService(){return this.#e!=null}getEncoding(){return this.compilerOptions.getEncoding()}getFormatCodeSettings(){return this.manipulationSettings.getFormatCodeSettings()}getUserPreferences(){return this.manipulationSettings.getUserPreferences()}resetProgram(){this.languageService._reset()}createWriter(){let E=this.manipulationSettings.getIndentationText();return new Xee.default({newLine:this.manipulationSettings.getNewLineKindAsString(),indentNumberOfSpaces:E===te.IndentationText.Tab?void 0:E.length,useTabs:E===te.IndentationText.Tab,useSingleQuote:this.manipulationSettings.getQuoteKind()===te.QuoteKind.Single})}getPreEmitDiagnostics(E){return x.ts.getPreEmitDiagnostics(this.program.compilerObject,E?.compilerNode).map(G=>this.compilerFactory.getDiagnostic(G))}getSourceFileContainer(){return{addOrGetSourceFileFromFilePath:(E,R)=>Promise.resolve(this.compilerFactory.addOrGetSourceFileFromFilePath(E,R)?.compilerNode),addOrGetSourceFileFromFilePathSync:(E,R)=>this.compilerFactory.addOrGetSourceFileFromFilePath(E,R)?.compilerNode,containsDirectoryAtPath:E=>this.compilerFactory.containsDirectoryAtPath(E),containsSourceFileAtPath:E=>this.compilerFactory.containsSourceFileAtPath(E),getSourceFileFromCacheFromFilePath:E=>this.compilerFactory.getSourceFileFromCacheFromFilePath(E)?.compilerNode,getSourceFilePaths:()=>this.compilerFactory.getSourceFilePaths(),getSourceFileVersion:E=>this.compilerFactory.documentRegistry.getSourceFileVersion(E),getChildDirectoriesOfDirectory:E=>{let R=[];for(let G of this.compilerFactory.getChildDirectoriesOfDirectory(E))R.push(G.getPath());return R}}}getModuleResolutionHost(){return x.createModuleResolutionHost({transactionalFileSystem:this.fileSystemWrapper,getEncoding:()=>this.getEncoding(),sourceFileContainer:this.getSourceFileContainer()})}#i(E){return new x.errors.InvalidOperationError(`A ${E} is required for this operation. This might occur when manipulating or getting type information from a node that was not added to a Project object and created via createWrappedNode. Please submit a bug report if you don't believe a ${E} should be required for this operation.`)}}})(),TDe=class{_context;constructor(o={}){le();let d=Re(),g=new x.TransactionalFileSystem({fileSystem:d,skipLoadingLibFiles:o.skipLoadingLibFiles,libFolderPath:o.libFolderPath}),E=o.tsConfigFilePath==null?void 0:new x.TsConfigResolver(g,g.getStandardizedAbsolutePath(o.tsConfigFilePath),dt()),R=nt(),G=new x.CompilerOptionsContainer(o.defaultCompilerOptions);G.set(R),this._context=new UXe({project:this,compilerOptionsContainer:G,fileSystemWrapper:g,createLanguageService:!0,resolutionHost:o.resolutionHost,configFileParsingDiagnostics:E?.getErrors()??[],skipLoadingLibFiles:o.skipLoadingLibFiles,libFolderPath:o.libFolderPath}),o.manipulationSettings!=null&&this._context.manipulationSettings.set(o.manipulationSettings),E!=null&&o.skipAddingFilesFromTsConfig!==!0&&(this.#e(E,R),o.skipFileDependencyResolution||this.resolveSourceFileDependencies());function le(){if(o.fileSystem!=null&&o.useInMemoryFileSystem)throw new x.errors.InvalidOperationError("Cannot provide a file system when specifying to use an in-memory file system.")}function Re(){return o.useInMemoryFileSystem?new x.InMemoryFileSystemHost:o.fileSystem??new x.RealFileSystemHost}function nt(){return{...at(),...o.compilerOptions??{}}}function at(){return E?.getCompilerOptions()??{}}function dt(){let xe="utf-8";return o.compilerOptions!=null?o.compilerOptions.charset??xe:xe}}get manipulationSettings(){return this._context.manipulationSettings}get compilerOptions(){return this._context.compilerOptions}resolveSourceFileDependencies(){let o=new Set,d=G=>o.add(G),{compilerFactory:g,inProjectCoordinator:E}=this._context;g.onSourceFileAdded(d);try{this.getProgram().compilerObject}finally{g.onSourceFileAdded(d,!1)}let R=E.markSourceFilesAsInProjectForResolution();for(let G of R.changedSourceFiles)o.add(G);for(let G of R.unchangedSourceFiles)o.delete(G);return Array.from(o.values())}addDirectoryAtPathIfExists(o,d={}){return this._context.directoryCoordinator.addDirectoryAtPathIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(o),{...d,markInProject:!0})}addDirectoryAtPath(o,d={}){return this._context.directoryCoordinator.addDirectoryAtPath(this._context.fileSystemWrapper.getStandardizedAbsolutePath(o),{...d,markInProject:!0})}createDirectory(o){return this._context.directoryCoordinator.createDirectoryOrAddIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(o),{markInProject:!0})}getDirectoryOrThrow(o,d){return x.errors.throwIfNullOrUndefined(this.getDirectory(o),d??(()=>`Could not find a directory at the specified path: ${this._context.fileSystemWrapper.getStandardizedAbsolutePath(o)}`))}getDirectory(o){let{compilerFactory:d}=this._context;return d.getDirectoryFromCache(this._context.fileSystemWrapper.getStandardizedAbsolutePath(o))}getDirectories(){return Array.from(this.#n())}getRootDirectories(){let{inProjectCoordinator:o}=this._context,d=[];for(let E of this._context.compilerFactory.getOrphanDirectories())for(let R of g(E))d.push(R);return d;function*g(E){if(o.isDirectoryInProject(E)){yield E;return}for(let R of E._getDirectoriesIterator())yield*g(R)}}addSourceFilesAtPaths(o){return this._context.directoryCoordinator.addSourceFilesAtPaths(o,{markInProject:!0})}addSourceFileAtPathIfExists(o){return this._context.directoryCoordinator.addSourceFileAtPathIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(o),{markInProject:!0})}addSourceFileAtPath(o){return this._context.directoryCoordinator.addSourceFileAtPath(this._context.fileSystemWrapper.getStandardizedAbsolutePath(o),{markInProject:!0})}addSourceFilesFromTsConfig(o){let d=new x.TsConfigResolver(this._context.fileSystemWrapper,this._context.fileSystemWrapper.getStandardizedAbsolutePath(o),this._context.getEncoding());return this.#e(d,d.getCompilerOptions())}#e(o,d){let g=o.getPaths(d),E=g.filePaths.map(R=>this.addSourceFileAtPath(R));for(let R of g.directoryPaths)this.addDirectoryAtPathIfExists(R);return E}createSourceFile(o,d,g){return this._context.compilerFactory.createSourceFile(this._context.fileSystemWrapper.getStandardizedAbsolutePath(o),d??"",{...g??{},markInProject:!0})}removeSourceFile(o){let d=o.wasForgotten();return o.forget(),!d}getSourceFileOrThrow(o){let d=this.getSourceFile(o);if(d!=null)return d;if(typeof o=="string"){let g=x.FileUtils.standardizeSlashes(o);if(x.FileUtils.pathIsAbsolute(g)||g.indexOf("/")>=0){let E=this._context.fileSystemWrapper.getStandardizedAbsolutePath(g);throw new x.errors.InvalidOperationError(`Could not find source file in project at the provided path: ${E}`)}else throw new x.errors.InvalidOperationError(`Could not find source file in project with the provided file name: ${o}`)}else throw new x.errors.InvalidOperationError("Could not find source file in project based on the provided condition.")}getSourceFile(o){let d=g(this._context.fileSystemWrapper);if(E(d))return this._context.compilerFactory.getSourceFileFromCacheFromFilePath(d);return x.IterableUtils.find(this.#t(),d);function g(R){if(o instanceof Function)return o;let G=x.FileUtils.standardizeSlashes(o);return x.FileUtils.pathIsAbsolute(G)||G.indexOf("/")>=0?R.getStandardizedAbsolutePath(G):le=>x.FileUtils.pathEndsWith(le.getFilePath(),G)}function E(R){return typeof R=="string"}}getSourceFiles(o){let{compilerFactory:d,fileSystemWrapper:g}=this._context,E=this.#t();if(typeof o=="string"||o instanceof Array)return Array.from(R());return Array.from(E);function*R(){let G=Array.from(Re()),le=x.matchGlobs(G,o,g.getCurrentDirectory());for(let nt of le)yield d.getSourceFileFromCacheFromFilePath(g.getStandardizedAbsolutePath(nt));function*Re(){for(let nt of E)yield nt.getFilePath()}}}*#t(){let{compilerFactory:o,inProjectCoordinator:d}=this._context;for(let g of o.getSourceFilesByDirectoryDepth())d.isSourceFileInProject(g)&&(yield g)}*#n(){let{compilerFactory:o,inProjectCoordinator:d}=this._context;for(let g of o.getDirectoriesByDepth())d.isDirectoryInProject(g)&&(yield g)}getAmbientModule(o){return o=UKe(o),this.getAmbientModules().find(d=>d.getName()===o)}getAmbientModuleOrThrow(o,d){return x.errors.throwIfNullOrUndefined(this.getAmbientModule(o),d??(()=>`Could not find ambient module with name: ${UKe(o)}`))}getAmbientModules(){return this.getTypeChecker().getAmbientModules()}async save(){await this._context.fileSystemWrapper.flush(),await Promise.all(this.#r().map(o=>o.save()))}saveSync(){this._context.fileSystemWrapper.flushSync();for(let o of this.#r())o.saveSync()}enableLogging(o=!0){this._context.logger.setEnabled(o)}#r(){return Array.from(o(this._context.compilerFactory.getSourceFilesByDirectoryDepth()));function*o(d){for(let g of d)g.isSaved()||(yield g)}}getPreEmitDiagnostics(){return this._context.getPreEmitDiagnostics()}getLanguageService(){return this._context.languageService}getProgram(){return this._context.program}getTypeChecker(){return this._context.typeChecker}getFileSystem(){return this._context.fileSystemWrapper.getFileSystem()}emit(o={}){return this._context.program.emit(o)}emitSync(o={}){return this._context.program.emitSync(o)}emitToMemory(o={}){return this._context.program.emitToMemory(o)}getCompilerOptions(){return this._context.compilerOptions.get()}getConfigFileParsingDiagnostics(){return this.getProgram().getConfigFileParsingDiagnostics()}createWriter(){return this._context.createWriter()}forgetNodesCreatedInBlock(o){return this._context.compilerFactory.forgetNodesCreatedInBlock(o)}formatDiagnosticsWithColorAndContext(o,d={}){return x.ts.formatDiagnosticsWithColorAndContext(o.map(g=>g.compilerObject),{getCurrentDirectory:()=>this._context.fileSystemWrapper.getCurrentDirectory(),getCanonicalFileName:g=>g,getNewLine:()=>d.newLineChar??x.runtime.getEndOfLine()})}getModuleResolutionHost(){return this._context.getModuleResolutionHost()}};function UKe(h){return o(h[0])&&o(h[h.length-1])&&(h=h.substring(1,h.length-1)),`"${h}"`;function o(d){return d==='"'||d==="'"}}function C2t(h,o={}){let{compilerOptions:d={},sourceFile:g,typeChecker:E}=o,R=new x.CompilerOptionsContainer;R.set(d);let G=new UXe({project:void 0,fileSystemWrapper:new x.TransactionalFileSystem({fileSystem:new x.RealFileSystemHost,skipLoadingLibFiles:!0,libFolderPath:void 0}),compilerOptionsContainer:R,createLanguageService:!1,typeChecker:E,configFileParsingDiagnostics:[],skipLoadingLibFiles:!0,libFolderPath:void 0}),le=G.compilerFactory.getSourceFile(Re(),{markInProject:!0});return G.compilerFactory.getNodeFromCompilerNode(h,le);function Re(){return g??nt(h)}function nt(at){if(at.kind===x.SyntaxKind.SourceFile)return at;if(at.parent==null)throw new x.errors.InvalidOperationError("Please ensure the node was created from a source file with 'setParentNodes' set to 'true'.");let dt=at;for(;dt.parent!=null;)dt=dt.parent;if(dt.kind!==x.SyntaxKind.SourceFile)throw new x.errors.NotImplementedError("For some reason the top parent was not a source file.");return dt}}var P2t=new jXe(()=>{throw new x.errors.NotImplementedError("Not implemented scenario for getting code format settings when using a writer function. Please open an issue.")}),EDe=class{constructor(){}static object(o){return d=>{let g=Object.keys(o);d.write("{"),g.length>0&&d.indent(()=>{E()}),d.write("}");function E(){for(let R=0;R<g.length;R++){R>0&&d.write(",").newLine();let G=g[R],le=o[G];d.write(G),le!=null&&(d.write(": "),U5(d,le))}d.newLine()}}}static objectType(o){return d=>{d.write("{"),N2t(o)&&d.indent(()=>{P2t.forTypeElementMemberedNode().printText(d,o)}),d.write("}")}}static unionType(o,d,...g){return HKe("|",[o,d,...g])}static intersectionType(o,d,...g){return HKe("&",[o,d,...g])}static assertion(o,d){return g=>{U5(g,o),g.spaceIfLastNot().write("as "),U5(g,d)}}static returnStatement(o){return d=>{d.write("return "),d.hangingIndentUnlessBlock(()=>{U5(d,o),d.write(";")})}}};function HKe(h,o){return d=>{R2t(d,` ${h} `,o)}}function N2t(h){for(let o of Object.keys(h))if(h[o]!=null&&!(h[o]instanceof Array&&h[o].length===0))return!0;return!1}function R2t(h,o,d){for(let g=0;g<d.length;g++)h.conditionalWrite(g>0,o),U5(h,d[g])}function U5(h,o){o instanceof Function?o(h):h.write(o.toString())}var{InvalidOperationError:M2t,FileNotFoundError:L2t,ArgumentError:k2t,ArgumentNullOrWhitespaceError:w2t,ArgumentOutOfRangeError:O2t,ArgumentTypeError:F2t,BaseError:W2t,DirectoryNotFoundError:B2t,NotImplementedError:z2t,NotSupportedError:G2t,PathNotFoundError:V2t}=x.errors;Object.defineProperty(te,"CompilerOptionsContainer",{enumerable:!0,get:function(){return x.CompilerOptionsContainer}});Object.defineProperty(te,"DiagnosticCategory",{enumerable:!0,get:function(){return x.DiagnosticCategory}});Object.defineProperty(te,"EmitHint",{enumerable:!0,get:function(){return x.EmitHint}});Object.defineProperty(te,"InMemoryFileSystemHost",{enumerable:!0,get:function(){return x.InMemoryFileSystemHost}});Object.defineProperty(te,"LanguageVariant",{enumerable:!0,get:function(){return x.LanguageVariant}});Object.defineProperty(te,"ModuleKind",{enumerable:!0,get:function(){return x.ModuleKind}});Object.defineProperty(te,"ModuleResolutionKind",{enumerable:!0,get:function(){return x.ModuleResolutionKind}});Object.defineProperty(te,"NewLineKind",{enumerable:!0,get:function(){return x.NewLineKind}});Object.defineProperty(te,"NodeFlags",{enumerable:!0,get:function(){return x.NodeFlags}});Object.defineProperty(te,"ObjectFlags",{enumerable:!0,get:function(){return x.ObjectFlags}});Object.defineProperty(te,"ResolutionHosts",{enumerable:!0,get:function(){return x.ResolutionHosts}});Object.defineProperty(te,"ScriptKind",{enumerable:!0,get:function(){return x.ScriptKind}});Object.defineProperty(te,"ScriptTarget",{enumerable:!0,get:function(){return x.ScriptTarget}});Object.defineProperty(te,"SettingsContainer",{enumerable:!0,get:function(){return x.SettingsContainer}});Object.defineProperty(te,"SymbolFlags",{enumerable:!0,get:function(){return x.SymbolFlags}});Object.defineProperty(te,"SyntaxKind",{enumerable:!0,get:function(){return x.SyntaxKind}});Object.defineProperty(te,"TypeFlags",{enumerable:!0,get:function(){return x.TypeFlags}});Object.defineProperty(te,"TypeFormatFlags",{enumerable:!0,get:function(){return x.TypeFormatFlags}});Object.defineProperty(te,"ts",{enumerable:!0,get:function(){return x.ts}});Object.defineProperty(te,"CodeBlockWriter",{enumerable:!0,get:function(){return Xee.default}});te.AbstractableNode=SR;te.AmbientableNode=j1;te.ArgumentError=k2t;te.ArgumentNullOrWhitespaceError=w2t;te.ArgumentOutOfRangeError=O2t;te.ArgumentTypeError=F2t;te.ArgumentedNode=PDe;te.ArrayBindingPattern=lte;te.ArrayDestructuringAssignment=dDe;te.ArrayDestructuringAssignmentBase=CJe;te.ArrayLiteralExpression=pte;te.ArrayTypeNode=Vne;te.ArrowFunction=Cne;te.ArrowFunctionBase=Fqe;te.AsExpression=fte;te.AsExpressionBase=PJe;te.AssignmentExpression=X5;te.AssignmentExpressionBase=IJe;te.AsyncableNode=_w;te.AwaitExpression=mte;te.AwaitExpressionBase=NJe;te.AwaitableNode=pJe;te.BaseError=W2t;te.BaseExpressionedNode=o6;te.BigIntLiteral=Cie;te.BigIntLiteralBase=SXe;te.BinaryExpression=q5;te.BinaryExpressionBase=DJe;te.BindingElement=cte;te.BindingElementBase=AJe;te.BindingNamedNode=doe;te.Block=Gte;te.BlockBase=aqe;te.BodiedNode=aoe;te.BodyableNode=hw;te.BreakStatement=Vte;te.CallExpression=_te;te.CallExpressionBase=RJe;te.CallSignatureDeclaration=aie;te.CallSignatureDeclarationBase=Wee;te.CaseBlock=jte;te.CaseBlockBase=sqe;te.CaseClause=Ute;te.CaseClauseBase=lqe;te.CatchClause=Hte;te.CatchClauseBase=cqe;te.ChildOrderableNode=Lv;te.ClassDeclaration=Mne;te.ClassDeclarationBase=Aee;te.ClassElement=e0;te.ClassExpression=Lne;te.ClassExpressionBase=jqe;te.ClassLikeDeclarationBase=zDe;te.ClassLikeDeclarationBaseSpecific=Gqe;te.ClassStaticBlockDeclaration=kne;te.ClassStaticBlockDeclarationBase=Dee;te.CodeAction=Hie;te.CodeFixAction=Kie;te.CombinedCodeActions=FXe;te.CommaListExpression=hte;te.CommaListExpressionBase=MJe;te.CommentClassElement=wne;te.CommentEnumMember=nie;te.CommentObjectLiteralElement=Ete;te.CommentRange=rte;te.CommentStatement=Kte;te.CommentTypeElement=sie;te.CommonIdentifierBase=jDe;te.CompilerCommentClassElement=Yee;te.CompilerCommentEnumMember=ete;te.CompilerCommentNode=mR;te.CompilerCommentObjectLiteralElement=Zee;te.CompilerCommentStatement=$ee;te.CompilerCommentTypeElement=Qee;te.ComputedPropertyName=fie;te.ComputedPropertyNameBase=fXe;te.ConditionalExpression=gte;te.ConditionalExpressionBase=LJe;te.ConditionalTypeNode=jne;te.ConstructSignatureDeclaration=lie;te.ConstructSignatureDeclarationBase=Bee;te.ConstructorDeclaration=One;te.ConstructorDeclarationBase=Iee;te.ConstructorDeclarationOverloadBase=Uqe;te.ConstructorTypeNode=Une;te.ConstructorTypeNodeBase=qqe;te.ContinueStatement=Jte;te.DebuggerStatement=qte;te.DebuggerStatementBase=dqe;te.DecoratableNode=gw;te.Decorator=zne;te.DecoratorBase=Ree;te.DefaultClause=Xte;te.DefaultClauseBase=uqe;te.DefinitionInfo=HDe;te.DeleteExpression=yte;te.DeleteExpressionBase=kJe;te.Diagnostic=yoe;te.DiagnosticMessageChain=t9;te.DiagnosticWithLocation=n9;te.Directory=roe;te.DirectoryEmitResult=o9;te.DirectoryNotFoundError=B2t;te.DoStatement=$te;te.DoStatementBase=pqe;te.DocumentSpan=s6;te.DotDotDotTokenableNode=a9;te.ElementAccessExpression=$5;te.ElementAccessExpressionBase=wJe;te.EmitOutput=WXe;te.EmitResult=qie;te.EmptyStatement=Yte;te.EmptyStatementBase=fqe;te.EnumDeclaration=rie;te.EnumDeclarationBase=Oee;te.EnumMember=iie;te.EnumMemberBase=Fee;te.ExclamationTokenableNode=RDe;te.ExportAssignment=cne;te.ExportAssignmentBase=mDe;te.ExportDeclaration=dne;te.ExportDeclarationBase=_ee;te.ExportGetableNode=MDe;te.ExportSpecifier=une;te.ExportSpecifierBase=_De;te.ExportableNode=U1;te.Expression=Xp;te.ExpressionStatement=Qte;te.ExpressionStatementBase=mqe;te.ExpressionWithTypeArguments=Hne;te.ExpressionWithTypeArgumentsBase=Xqe;te.ExpressionableNode=d9;te.ExpressionedNode=jm;te.ExtendsClauseableNode=vJe;te.ExternalModuleReference=pne;te.ExternalModuleReferenceBase=Aqe;te.FalseLiteral=Nie;te.FalseLiteralBase=EXe;te.FileNotFoundError=L2t;te.FileReference=q8;te.FileTextChanges=u9;te.ForInStatement=Zte;te.ForInStatementBase=_qe;te.ForOfStatement=ene;te.ForOfStatementBase=hqe;te.ForStatement=tne;te.ForStatementBase=gqe;te.FunctionDeclaration=Pne;te.FunctionDeclarationBase=Tee;te.FunctionDeclarationOverloadBase=Wqe;te.FunctionExpression=Nne;te.FunctionExpressionBase=Bqe;te.FunctionLikeDeclaration=Tw;te.FunctionOrConstructorTypeNodeBase=Q5;te.FunctionOrConstructorTypeNodeBaseBase=Jqe;te.FunctionTypeNode=Kne;te.FunctionTypeNodeBase=$qe;te.GeneratorableNode=vw;te.GetAccessorDeclaration=Fne;te.GetAccessorDeclarationBase=Cee;te.HeritageClause=oie;te.HeritageClauseableNode=kDe;te.Identifier=e9;te.IdentifierBase=mXe;te.IfStatement=nne;te.IfStatementBase=yqe;te.ImplementationLocation=BXe;te.ImplementsClauseableNode=bJe;te.ImportAttribute=fne;te.ImportAttributeBase=hee;te.ImportAttributeNamedNode=SJe;te.ImportAttributes=mne;te.ImportAttributesBase=Dqe;te.ImportClause=_ne;te.ImportClauseBase=Iqe;te.ImportDeclaration=hne;te.ImportDeclarationBase=gee;te.ImportEqualsDeclaration=gne;te.ImportEqualsDeclarationBase=Pqe;te.ImportExpression=vte;te.ImportExpressionBase=OJe;te.ImportExpressionedNode=Lwt;te.ImportSpecifier=yne;te.ImportSpecifierBase=yee;te.ImportTypeNode=Jne;te.IndexSignatureDeclaration=cie;te.IndexSignatureDeclarationBase=zee;te.IndexedAccessTypeNode=qne;te.InferTypeNode=Xne;te.InitializerExpressionGetableNode=coe;te.InitializerExpressionableNode=bw;te.InterfaceDeclaration=die;te.InterfaceDeclarationBase=Gee;te.IntersectionTypeNode=$ne;te.InvalidOperationError=M2t;te.IterationStatement=yR;te.JSDoc=Gne;te.JSDocAllType=mre;te.JSDocAugmentsTag=_re;te.JSDocAuthorTag=hre;te.JSDocBase=Mee;te.JSDocCallbackTag=gre;te.JSDocClassTag=yre;te.JSDocDeprecatedTag=vre;te.JSDocEnumTag=bre;te.JSDocFunctionType=Sre;te.JSDocFunctionTypeBase=rXe;te.JSDocImplementsTag=Tre;te.JSDocImportTag=Ere;te.JSDocLink=xre;te.JSDocLinkCode=Are;te.JSDocLinkPlain=Dre;te.JSDocMemberName=Ire;te.JSDocNameReference=Pre;te.JSDocNamepathType=Cre;te.JSDocNonNullableType=Nre;te.JSDocNullableType=Rre;te.JSDocOptionalType=Mre;te.JSDocOverloadTag=Lre;te.JSDocOverloadTagBase=iXe;te.JSDocOverrideTag=kre;te.JSDocParameterTag=wre;te.JSDocParameterTagBase=oXe;te.JSDocPrivateTag=Ore;te.JSDocPropertyLikeTag=GDe;te.JSDocPropertyTag=Fre;te.JSDocPropertyTagBase=aXe;te.JSDocProtectedTag=Wre;te.JSDocPublicTag=Bre;te.JSDocReadonlyTag=zre;te.JSDocReturnTag=Gre;te.JSDocReturnTagBase=sXe;te.JSDocSatisfiesTag=Vre;te.JSDocSatisfiesTagBase=lXe;te.JSDocSeeTag=jre;te.JSDocSeeTagBase=cXe;te.JSDocSignature=Ure;te.JSDocTag=_p;te.JSDocTagBase=wee;te.JSDocTagInfo=Z5;te.JSDocTemplateTag=Hre;te.JSDocTemplateTagBase=dXe;te.JSDocText=Kre;te.JSDocThisTag=Jre;te.JSDocThisTagBase=uXe;te.JSDocThrowsTag=qre;te.JSDocThrowsTagBase=pXe;te.JSDocType=hT;te.JSDocTypeExpression=$re;te.JSDocTypeExpressionableTag=Ew;te.JSDocTypeLiteral=Yre;te.JSDocTypeParameteredTag=Hqe;te.JSDocTypeTag=Qre;te.JSDocTypedefTag=Xre;te.JSDocUnknownTag=Zre;te.JSDocUnknownType=eie;te.JSDocVariadicType=tie;te.JSDocableNode=$p;te.JsxAttribute=hie;te.JsxAttributeBase=Uee;te.JsxAttributedNode=VDe;te.JsxClosingElement=gie;te.JsxClosingElementBase=hXe;te.JsxClosingFragment=yie;te.JsxElement=vie;te.JsxElementBase=Hee;te.JsxExpression=bie;te.JsxExpressionBase=gXe;te.JsxFragment=Sie;te.JsxNamespacedName=Tie;te.JsxNamespacedNameBase=yXe;te.JsxOpeningElement=Eie;te.JsxOpeningElementBase=vXe;te.JsxOpeningFragment=xie;te.JsxSelfClosingElement=Aie;te.JsxSelfClosingElementBase=Kee;te.JsxSpreadAttribute=Die;te.JsxSpreadAttributeBase=Jee;te.JsxTagNamedNode=goe;te.JsxText=Iie;te.JsxTextBase=bXe;te.LabeledStatement=rne;te.LabeledStatementBase=vqe;te.LanguageService=toe;te.LeftHandSideExpression=Y8;te.LeftHandSideExpressionedNode=Sw;te.LiteralExpression=gR;te.LiteralExpressionBase=FJe;te.LiteralLikeNode=n6;te.LiteralTypeNode=Yne;te.ManipulationError=nte;te.ManipulationSettingsContainer=tte;te.MappedTypeNode=Qne;te.MemberExpression=pw;te.MemoryEmitResult=Xie;te.MetaProperty=bte;te.MetaPropertyBase=WJe;te.MethodDeclaration=Q8;te.MethodDeclarationBase=xee;te.MethodDeclarationOverloadBase=zqe;te.MethodSignature=uie;te.MethodSignatureBase=Vee;te.ModifierableNode=B_;te.ModuleBlock=vne;te.ModuleBlockBase=Nqe;te.ModuleChildableNode=TR;te.ModuleDeclaration=bne;te.ModuleDeclarationBase=vee;te.ModuleNamedNode=TJe;te.ModuledNode=wDe;te.NameableNode=uoe;te.NamedExports=Sne;te.NamedExportsBase=Rqe;te.NamedImports=Tne;te.NamedImportsBase=Mqe;te.NamedNode=J1;te.NamedNodeBase=r6;te.NamedTupleMember=Zne;te.NamedTupleMemberBase=Yqe;te.NamespaceExport=Ene;te.NamespaceExportBase=Lqe;te.NamespaceImport=xne;te.NamespaceImportBase=kqe;te.NewExpression=Ste;te.NewExpressionBase=BJe;te.NoSubstitutionTemplateLiteral=wie;te.NoSubstitutionTemplateLiteralBase=PXe;te.Node=yn;te.NodeWithTypeArguments=mw;te.NodeWithTypeArgumentsBase=Kqe;te.NonNullExpression=Tte;te.NonNullExpressionBase=zJe;te.NotEmittedStatement=ine;te.NotEmittedStatementBase=bqe;te.NotImplementedError=z2t;te.NotSupportedError=G2t;te.NullLiteral=Rie;te.NullLiteralBase=AXe;te.NumericLiteral=Mie;te.NumericLiteralBase=DXe;te.ObjectBindingPattern=dte;te.ObjectDestructuringAssignment=uDe;te.ObjectDestructuringAssignmentBase=GJe;te.ObjectLiteralElement=fw;te.ObjectLiteralExpression=xte;te.ObjectLiteralExpressionBase=VJe;te.OmittedExpression=Cte;te.OmittedExpressionBase=jJe;te.OptionalTypeNode=ere;te.OutputFile=Jie;te.OverloadableNode=_oe;te.OverrideableNode=l9;te.ParameterDeclaration=Rne;te.ParameterDeclarationBase=Eee;te.ParameteredNode=EJe;te.ParenthesizedExpression=Pte;te.ParenthesizedExpressionBase=UJe;te.ParenthesizedTypeNode=tre;te.PartiallyEmittedExpression=Nte;te.PartiallyEmittedExpressionBase=HJe;te.PathNotFoundError=V2t;te.PostfixUnaryExpression=Rte;te.PostfixUnaryExpressionBase=KJe;te.PrefixUnaryExpression=Mte;te.PrefixUnaryExpressionBase=JJe;te.PrimaryExpression=__;te.PrivateIdentifier=mie;te.PrivateIdentifierBase=_Xe;te.Program=eoe;te.Project=TDe;te.PropertyAccessExpression=Y5;te.PropertyAccessExpressionBase=qJe;te.PropertyAssignment=Ate;te.PropertyAssignmentBase=pee;te.PropertyDeclaration=Wne;te.PropertyDeclarationBase=Pee;te.PropertyNamedNode=IC;te.PropertySignature=pie;te.PropertySignatureBase=jee;te.QualifiedName=_ie;te.QuestionDotTokenableNode=poe;te.QuestionTokenableNode=q1;te.ReadonlyableNode=c9;te.RefactorEditInfo=zXe;te.ReferenceEntry=$ie;te.ReferenceFindableNode=K1;te.ReferencedSymbol=GXe;te.ReferencedSymbolDefinitionInfo=VXe;te.ReferencedSymbolEntry=Yie;te.RegularExpressionLiteral=Lie;te.RegularExpressionLiteralBase=IXe;te.RenameLocation=Qie;te.RenameableNode=wx;te.RestTypeNode=nre;te.ReturnStatement=one;te.ReturnStatementBase=Sqe;te.ReturnTypedNode=ODe;te.SatisfiesExpression=Lte;te.SatisfiesExpressionBase=XJe;te.ScopeableNode=xJe;te.ScopedNode=bR;te.SetAccessorDeclaration=Bne;te.SetAccessorDeclarationBase=Nee;te.ShorthandPropertyAssignment=Dte;te.ShorthandPropertyAssignmentBase=fee;te.Signature=Uie;te.SignaturedDeclaration=Ox;te.SourceFile=X8;te.SourceFileBase=bee;te.SpreadAssignment=Ite;te.SpreadAssignmentBase=mee;te.SpreadElement=kte;te.SpreadElementBase=$Je;te.Statement=Ud;te.StatementBase=oqe;te.StatementedNode=$1;te.StaticableNode=i6;te.StringLiteral=kie;te.StringLiteralBase=CXe;te.Structure=j5;te.SuperElementAccessExpression=pDe;te.SuperElementAccessExpressionBase=YJe;te.SuperExpression=wte;te.SuperExpressionBase=QJe;te.SuperExpressionedNode=BDe;te.SuperPropertyAccessExpression=fDe;te.SuperPropertyAccessExpressionBase=ZJe;te.SwitchStatement=ane;te.SwitchStatementBase=Tqe;te.Symbol=OXe;te.SymbolDisplayPart=Zie;te.SyntaxList=ite;te.TaggedTemplateExpression=Oie;te.TemplateExpression=Fie;te.TemplateExpressionBase=NXe;te.TemplateHead=Wie;te.TemplateHeadBase=RXe;te.TemplateLiteralTypeNode=rre;te.TemplateMiddle=Bie;te.TemplateMiddleBase=MXe;te.TemplateSpan=zie;te.TemplateSpanBase=LXe;te.TemplateTail=Gie;te.TemplateTailBase=kXe;te.TextChange=e6;te.TextInsertableNode=h_;te.TextRange=K5;te.TextSpan=Z8;te.ThisExpression=Ote;te.ThisExpressionBase=eqe;te.ThisTypeNode=ire;te.ThrowStatement=sne;te.ThrowStatementBase=Eqe;te.TrueLiteral=Pie;te.TrueLiteralBase=TXe;te.TryStatement=lne;te.TryStatementBase=xqe;te.TupleTypeNode=ore;te.Type=i9;te.TypeAliasDeclaration=are;te.TypeAliasDeclarationBase=Lee;te.TypeArgumentedNode=foe;te.TypeAssertion=Fte;te.TypeAssertionBase=tqe;te.TypeChecker=r9;te.TypeElement=AC;te.TypeElementMemberedNode=WDe;te.TypeLiteralNode=sre;te.TypeLiteralNodeBase=Qqe;te.TypeNode=Df;te.TypeOfExpression=Wte;te.TypeOfExpressionBase=nqe;te.TypeOperatorTypeNode=lre;te.TypeParameter=noe;te.TypeParameterDeclaration=cre;te.TypeParameterDeclarationBase=kee;te.TypeParameteredNode=gT;te.TypePredicateNode=dre;te.TypeQueryNode=ure;te.TypeReferenceNode=pre;te.TypedNode=X1;te.UnaryExpression=Lx;te.UnaryExpressionedNode=a6;te.UnionTypeNode=fre;te.UnwrappableNode=moe;te.UpdateExpression=ute;te.VariableDeclaration=Vie;te.VariableDeclarationBase=qee;te.VariableDeclarationList=jie;te.VariableDeclarationListBase=wXe;te.VariableStatement=Ane;te.VariableStatementBase=See;te.VoidExpression=Bte;te.VoidExpressionBase=rqe;te.WhileStatement=Dne;te.WhileStatementBase=wqe;te.WithStatement=Ine;te.WithStatementBase=Oqe;te.Writers=EDe;te.YieldExpression=zte;te.YieldExpressionBase=iqe;te.createWrappedNode=C2t;te.forEachStructureChild=Kkt;te.getCompilerOptionsFromTsConfig=skt;te.getScopeForNode=ste;te.insertOverloads=hoe;te.printNode=VAe;te.setScopeForNode=FDe});var q2t={};module.exports=uPt(q2t);var _Ue={debug:0,info:1,warn:2,error:3,none:4};function pPt(h){let o=globalThis.process,d=h==="stdout"?o?.stdout:o?.stderr;return d?.write?d:null}function fPt(h,o){h&&h.write(o.endsWith(`
42156
42156
  `)?o:`${o}
42157
42157
  `)}function mPt(h){let o=typeof h.name=="string"?h.name:void 0,d=typeof h.message=="string"?h.message:void 0,g=typeof h.stack=="string"?h.stack:void 0;if(!o&&!d)return null;let E=`${o??"Error"}: ${d??""}`;return g?`${E}
42158
- ${g}`:E}function _Pt(h){if(typeof h=="string")return h;if(h instanceof Error)return`${h.name}: ${h.message}`;if(h&&typeof h=="object"){let o=mPt(h);if(o)return o}try{return JSON.stringify(h)}catch{return String(h)}}function hPt(h){return h.length===0?"":" "+h.map(_Pt).join(" ")}var k8=class{_level;prefix;constructor(o="",d="info"){this.prefix=o?`[${o}]`:"",this._level=d}get level(){return this._level}setLevel(o){this._level=o}shouldLog(o){return _Ue[o]>=_Ue[this._level]}formatMessage(o,d){return`${new Date().toISOString()} ${this.prefix} [${o.toUpperCase()}] ${d}`}logTo(o,d,g,E){this.shouldLog(d)&&fPt(pPt(o),this.formatMessage(d,g+hPt(E)))}debug(o,...d){this.logTo("stdout","debug",o,d)}info(o,...d){this.logTo("stdout","info",o,d)}warn(o,...d){this.logTo("stderr","warn",o,d)}error(o,...d){this.logTo("stderr","error",o,d)}};var Oxe=class{level="none";setLevel(){}debug(){}info(){}warn(){}error(){}},LZ=class{delegate;constructor(o){this.delegate=o}get level(){return this.delegate.level}setLevel(o){this.delegate.setLevel(o)}setDelegate(o){this.delegate=o}debug(o,...d){this.delegate.debug(o,...d)}info(o,...d){this.delegate.info(o,...d)}warn(o,...d){this.delegate.warn(o,...d)}error(o,...d){this.delegate.error(o,...d)}},Fxe=class{defaultLevel="info";loggers=new Map;backend;setDefaultLevel(o){this.defaultLevel=o;for(let d of this.loggers.values())d.setLevel(o)}getDefaultLevel(){return this.defaultLevel}getLogger(o){let d=this.loggers.get(o);if(!d){let g=this.backend?this.backend.createLogger(o,this.defaultLevel):new k8(o,this.defaultLevel);d=new LZ(g),this.loggers.set(o,d)}return d}getNullLogger(){let o=new Oxe;return new LZ(o)}clear(){this.loggers.clear()}setBackend(o){this.backend=o;for(let[d,g]of this.loggers.entries()){let E=g.level??this.defaultLevel,R=o?o.createLogger(d,E):new k8(d,E);g.setDelegate(R)}}getBackend(){return this.backend}},gPt=new Fxe;function w8(h){return gPt.getLogger(h)}var Roe=wf(require("node:fs/promises")),ZXe=wf(require("node:path")),f9=require("node:worker_threads");var $Xe=wf(require("node:path"));var iw=wf(require("node:fs/promises")),kZ=wf(require("node:fs"));function il(h){if(!h)return h;let o=h.replaceAll("\\","/");return o=o.replaceAll(/\/+/g,"/"),/^[A-Za-z]:\//.test(o)&&(o=o[0].toLowerCase()+o.slice(1)),o.length>1&&o.endsWith("/")&&!/^[a-zA-Z]:\/$/.test(o)&&(o=o.slice(0,-1)),o}var qp=class h extends Error{code;filePath;cause;timestamp;constructor(o,d,g){super(o),this.name="SpiderError",this.code=d,this.filePath=g?.filePath,this.cause=g?.cause,this.timestamp=Date.now(),Error.captureStackTrace&&Error.captureStackTrace(this,h)}static fromError(o,d){if(o instanceof h)return o;let g=o instanceof Error?o:void 0,E=g?.message??(o!==null&&typeof o=="object"?JSON.stringify(o):String(o)),R="UNKNOWN";if(g){let G=g.code;G==="ENOENT"?R="FILE_NOT_FOUND":G==="EACCES"||G==="EPERM"?R="PERMISSION_DENIED":E.includes("too large")||G==="EFBIG"?R="FILE_TOO_LARGE":E.includes("parse")||E.includes("syntax")?R="PARSE_ERROR":(E.includes("timeout")||G==="ETIMEDOUT")&&(R="TIMEOUT")}return new h(E,R,{filePath:d,cause:g})}isRecoverable(){return["FILE_NOT_FOUND","PERMISSION_DENIED","PARSE_ERROR","RESOLUTION_FAILED"].includes(this.code)}toUserMessage(){switch(this.code){case"FILE_NOT_FOUND":return`File not found: ${this.filePath||"unknown"}`;case"PERMISSION_DENIED":return`Permission denied: ${this.filePath||"unknown"}`;case"FILE_TOO_LARGE":return`File too large to process: ${this.filePath||"unknown"}`;case"PARSE_ERROR":return`Failed to parse: ${this.filePath||"unknown"}`;case"RESOLUTION_FAILED":return`Could not resolve module in: ${this.filePath||"unknown"}`;case"TIMEOUT":return"Operation timed out";case"CIRCULAR_DEPENDENCY":return"Circular dependency detected";default:return this.message}}toJSON(){return{name:this.name,code:this.code,message:this.message,filePath:this.filePath,timestamp:this.timestamp,stack:this.stack}}};var yPt=w8("FileReader"),vPt=5*1024*1024,bPt=64*1024,SPt=3e4,F_=class{maxSize;chunkSize;timeout;constructor(o={}){this.maxSize=o.maxSize??vPt,this.chunkSize=o.chunkSize??bPt,this.timeout=o.timeout??SPt}async getFileSize(o){try{let d=await iw.stat(o);return{size:d.size,isLarge:d.size>this.maxSize,path:o}}catch(d){throw qp.fromError(d,o)}}async readFile(o,d){let g=d?.maxSize??this.maxSize,E=d?.timeout??this.timeout,R=d?.streaming??!1,G=new Promise((le,Re)=>{setTimeout(()=>{Re(new qp(`File read timed out after ${E}ms: ${o}`,"TIMEOUT",{filePath:o}))},E)});try{let le=await iw.stat(o);if(le.size>g)throw new qp(`File too large: ${o} (${this.formatSize(le.size)} > ${this.formatSize(g)})`,"FILE_TOO_LARGE",{filePath:o});return R||le.size>1024*1024?(yPt.debug(`Streaming read for large file: ${o} (${this.formatSize(le.size)})`),await Promise.race([this.readFileStreaming(o),G])):await Promise.race([iw.readFile(o,"utf-8"),G])}catch(le){throw le instanceof qp?le:qp.fromError(le,o)}}async readFileStreaming(o){return new Promise((d,g)=>{let E=[],R=kZ.createReadStream(o,{highWaterMark:this.chunkSize});R.on("data",G=>{E.push(Buffer.isBuffer(G)?G:Buffer.from(G))}),R.on("end",()=>{let G=Buffer.concat(E).toString("utf-8");d(G)}),R.on("error",G=>{g(qp.fromError(G,o))})})}async readFileIfExists(o){try{return await this.readFile(o)}catch(d){if(d instanceof qp&&d.code==="FILE_NOT_FOUND")return null;throw d}}async canRead(o){try{return await iw.access(o,kZ.constants.R_OK),!0}catch{return!1}}formatSize(o){return o<1024?`${o}B`:o<1024*1024?`${(o/1024).toFixed(1)}KB`:`${(o/(1024*1024)).toFixed(1)}MB`}};function Gm(h){let d=/^(.+\.(ts|tsx|js|jsx|mjs|cjs|py|pyi|rs|vue|svelte|gql|graphql)):(.+)$/i.exec(h);if(!d)return h;let g=d[1];return d[3]?(g.length>1&&g[1]===":"&&/^[a-zA-Z]:/.test(g),w8("PathExtractor").warn(`Symbol ID detected where file path expected: ${h}. Extracting file path: ${g}`),g):h}var cR=wf(require("node:fs/promises")),Ys=wf(require("node:path"));var hUe=[".ts",".tsx"],gUe=[".js",".jsx",".mjs",".cjs"],wZ=[".py",".pyi"],yUe=[".rs"],TPt=[".vue"],EPt=[".svelte"],xPt=[".gql",".graphql"],APt=[".toml"],DPt=[".cs",".csproj"],IPt=[".go"],CPt=[".java"],OZ=[...hUe,...gUe,...TPt,...EPt,...xPt,...wZ,...yUe,...APt,...DPt,...IPt,...CPt],lOt=[...hUe,...gUe,...wZ,...yUe];var vUe=["node_modules",".git","dist","build","out","coverage",".next",".nuxt","__pycache__",".venv","venv","target"];var W_={typescript:"#3178c6",javascript:"#f7df1e",python:"#3776ab",rust:"#ce422b",vue:"#41b883",svelte:"#ff3e00",graphql:"#e535ab",toml:"#9c4221",csharp:"#9b4f96",go:"#00acd7",java:"#f8981d",unknown:"#6b6b6b"},cOt={".ts":W_.typescript,".tsx":W_.typescript,".mts":W_.typescript,".cts":W_.typescript,".js":W_.javascript,".jsx":W_.javascript,".mjs":W_.javascript,".cjs":W_.javascript,".py":W_.python,".pyi":W_.python,".rs":W_.rust,".vue":W_.vue,".svelte":W_.svelte,".gql":W_.graphql,".graphql":W_.graphql,".toml":W_.toml,".cs":W_.csharp,".csproj":W_.csharp,".go":W_.go,".java":W_.java};var FZ=class{pathAliases=new Map;tsConfigPromise;tsConfigPath;isConfigLoaded=!1;excludeNodeModules;workspaceRoot;directoryToPackageJson=new Map;directoryToTsConfig=new Map;tsConfigPathAliases=new Map;packageJsonImports=new Map;packageJsonLoadPromises=new Map;tsConfigLoadPromises=new Map;constructor(o,d=!0,g){this.excludeNodeModules=d,this.tsConfigPath=o,this.workspaceRoot=g??(o?Ys.dirname(o):void 0)}updateConfig(o){this.excludeNodeModules=o}async ensureTsConfigLoaded(){this.isConfigLoaded||!this.tsConfigPath||(this.tsConfigPromise??=this.loadTsConfig(this.tsConfigPath),await this.tsConfigPromise,this.tsConfigPromise=void 0,this.isConfigLoaded=!0)}async loadTsConfig(o){try{let d=await cR.readFile(o,"utf-8"),g=JSON.parse(d),E=g?.compilerOptions?.paths,R=g?.compilerOptions?.baseUrl||".";if(E)for(let[G,le]of Object.entries(E)){let Re=G.replace(/\/\*$/,""),nt=le[0]?.replace(/\/\*$/,"");if(nt){let at=Ys.dirname(o),dt=Ys.resolve(at,R,nt);this.pathAliases.set(Re,il(dt))}}}catch{}}async tryTsConfigAliases(o,d){let g=this.resolveAlias(d);if(g)return this.resolveWithExtensions(g);let E=await this.resolveDynamicTsConfigAlias(o,d);return E?this.resolveWithExtensions(E):null}async tryPythonImports(o,d){if(!this.isPythonFile(o))return null;if(this.isPythonRelativeImport(d)){let g=await this.resolvePythonRelativeImport(o,d);if(g)return g}if(d.includes(".")&&!d.includes("/")){let g=await this.resolvePythonModule(o,d);if(g)return g}return null}async trySpecialModulePatterns(o,d){if(this.isSubpathImport(d))return this.resolveSubpathImport(o,d);let g=await this.resolveRustModule(o,d);return g||(this.isPackageJsonAliasCandidate(d)?this.resolveScopedPackage(o,d):null)}async tryRelativePath(o,d){if(!this.isRelativePath(d))return null;let g=Ys.dirname(o),E=Ys.resolve(g,d);if(this.isPythonFile(o)&&!this.hasFileExtension(d)){let R=await this.resolveWithExtensions(E);if(R)return R}return this.resolveWithExtensions(E)}async resolve(o,d){await this.ensureTsConfigLoaded();let g=await this.tryTsConfigAliases(o,d);if(g)return g;let E=await this.trySpecialModulePatterns(o,d);if(E)return E;let R=await this.tryPythonImports(o,d);return R||(this.isNodeModule(d)?this.excludeNodeModules?null:d:this.tryRelativePath(o,d))}async resolveSubpathImport(o,d){let g=await this.resolvePackageJsonImport(o,d);return g?this.resolveWithExtensions(g):null}async resolveScopedPackage(o,d){let g=await this.resolvePackageJsonImport(o,d);if(g)return this.resolveWithExtensions(g);let E=await this.resolveWorkspacePackage(o,d);return E||(this.excludeNodeModules?null:d)}async resolveDynamicTsConfigAlias(o,d){if(!this.isPackageJsonAliasCandidate(d))return null;let g=await this.findNearestTsConfig(o);if(!g)return null;let E=await this.getTsConfigPathAliases(g);for(let[R,G]of E.entries())if(d===R||d.startsWith(R+"/")){let le=d.replace(R,G);return il(le)}return null}async findNearestTsConfig(o){let d=Ys.dirname(o);return this.directoryToTsConfig.has(d)?this.directoryToTsConfig.get(d)??null:await this.searchTsConfigUpward(d)}async searchTsConfigUpward(o){let d=[],g=o;for(;!this.shouldStopSearch(g);){d.push(g);let E=this.directoryToTsConfig.get(g);if(E!==void 0)return this.cacheTsConfigResultForDirs(d,E),E;let R=Ys.join(g,"tsconfig.json");if(await this.fileExists(R))return this.cacheTsConfigResultForDirs(d,R),R;let le=Ys.dirname(g);if(le===g)break;g=le}return this.cacheTsConfigResultForDirs(d,null),null}cacheTsConfigResultForDirs(o,d){for(let g of o)this.directoryToTsConfig.set(g,d)}async getTsConfigPathAliases(o){if(this.tsConfigPathAliases.has(o))return this.tsConfigPathAliases.get(o);if(this.tsConfigLoadPromises.has(o))return this.tsConfigLoadPromises.get(o);let d=this.loadTsConfigPathAliases(o);this.tsConfigLoadPromises.set(o,d);try{let g=await d;return this.tsConfigPathAliases.set(o,g),g}finally{this.tsConfigLoadPromises.delete(o)}}async loadTsConfigPathAliases(o){let d=new Map,g=new Set;return await this.loadTsConfigPathAliasesRecursive(o,d,g),d}async loadTsConfigPathAliasesRecursive(o,d,g){let E=Ys.resolve(o);if(!g.has(E)){g.add(E);try{let R=await cR.readFile(o,"utf-8"),G=JSON.parse(R),le=Ys.dirname(o);if(G.extends){let at=Ys.resolve(le,G.extends),dt=at.endsWith(".json")?at:at+".json",xe=await this.fileExists(dt)?dt:at;await this.fileExists(xe)&&await this.loadTsConfigPathAliasesRecursive(xe,d,g)}let Re=G?.compilerOptions?.paths,nt=G?.compilerOptions?.baseUrl||".";if(Re)for(let[at,dt]of Object.entries(Re)){let xe=at.replace(/\/\*$/,""),gn=dt[0]?.replace(/\/\*$/,"");if(gn){let pt=Ys.resolve(le,nt,gn);d.set(xe,il(pt))}}}catch{}}}resolveAlias(o){for(let[d,g]of this.pathAliases.entries())if(o===d||o.startsWith(d+"/"))return o.replace(d,g);return null}async resolveWithExtensions(o){let d=OZ;if(await this.fileExists(o))return il(o);for(let g of d){let E=o+g;if(await this.fileExists(E))return il(E)}for(let g of d){let E=Ys.join(o,`index${g}`);if(await this.fileExists(E))return il(E)}return null}async fileExists(o){try{return(await cR.stat(o)).isFile()}catch{return!1}}isRelativePath(o){return o.startsWith("./")||o.startsWith("../")}async resolveRustModule(o,d){if(!o.endsWith(".rs")||d.startsWith(".")||d.startsWith("@")||d.startsWith("#")||d.startsWith("/")||!/^\w+(?:::\w+)*$/u.test(d))return null;let E=Ys.dirname(o),R=d.replaceAll("::",Ys.sep),G=[Ys.join(E,`${R}.rs`),Ys.join(E,R,"mod.rs")];for(let le of G)if(await this.fileExists(le))return il(le);return null}isNodeModule(o){return!o.startsWith(".")&&!o.startsWith("/")&&!o.startsWith("#")&&!o.startsWith("@")}isSubpathImport(o){return o.startsWith("#")}isPackageJsonAliasCandidate(o){return o.startsWith("@")}isPythonFile(o){return wZ.some(d=>o.endsWith(d))}hasFileExtension(o){let d=Ys.basename(o);return d.includes(".")&&!d.startsWith(".")}isPythonRelativeImport(o){return(o.startsWith(".")||o.startsWith(".."))&&!o.includes("/")&&o!=="."&&o!==".."}async resolvePythonRelativeImport(o,d){let g=Ys.dirname(o),E=0,R=d;for(;R.startsWith(".");)E++,R=R.substring(1);let G=g;for(let le=1;le<E;le++)G=Ys.dirname(G);if(R){let le=Ys.join(G,R+".py");if(await this.fileExists(le))return il(le);let Re=Ys.join(G,R,"__init__.py");if(await this.fileExists(Re))return il(Re)}return null}async resolvePythonModule(o,d){let g=d.replaceAll(".","/"),E=Ys.dirname(o),R=this.workspaceRoot||E,G=E;for(;;){let le=Ys.resolve(G,g+".py");if(await this.fileExists(le))return il(le);let Re=Ys.resolve(G,g,"__init__.py");if(await this.fileExists(Re))return il(Re);if(il(G)===il(R))break;let nt=Ys.dirname(G);if(nt===G)break;G=nt}return null}async resolvePackageJsonImport(o,d){let g=await this.findNearestPackageJson(o);if(!g)return null;let E=await this.getPackageJsonImports(g),R=Ys.dirname(g);if(E.has(d)){let G=E.get(d);return il(Ys.resolve(R,G))}for(let[G,le]of E.entries())if(G.endsWith("/*")){let Re=G.slice(0,-2);if(d.startsWith(Re+"/")){let nt=d.slice(Re.length+1),at=le.endsWith("/*")?le.slice(0,-2):le,dt=Ys.resolve(R,at,nt);return il(dt)}}return null}async findNearestPackageJson(o){let d=Ys.dirname(o);return this.directoryToPackageJson.has(d)?this.directoryToPackageJson.get(d)??null:await this.searchPackageJsonUpward(d)}async searchPackageJsonUpward(o){let d=[],g=o;for(;!this.shouldStopSearch(g);){d.push(g);let E=this.directoryToPackageJson.get(g);if(E!==void 0)return this.cacheResultForDirs(d,E),E;let R=Ys.join(g,"package.json");if(await this.fileExists(R))return this.cacheResultForDirs(d,R),R;let G=Ys.dirname(g);if(G===g)break;g=G}return this.cacheResultForDirs(d,null),null}shouldStopSearch(o){return!!(this.workspaceRoot&&o===Ys.dirname(this.workspaceRoot))}cacheResultForDirs(o,d){for(let g of o)this.directoryToPackageJson.set(g,d)}async getPackageJsonImports(o){if(this.packageJsonImports.has(o))return this.packageJsonImports.get(o);if(this.packageJsonLoadPromises.has(o))return this.packageJsonLoadPromises.get(o);let d=this.loadPackageJsonImports(o);this.packageJsonLoadPromises.set(o,d);try{let g=await d;return this.packageJsonImports.set(o,g),g}finally{this.packageJsonLoadPromises.delete(o)}}async loadPackageJsonImports(o){let d=new Map;try{let g=await cR.readFile(o,"utf-8"),E=JSON.parse(g);this.parseImportsField(E?.imports,d),this.parseAliasesField(E?.aliases,d)}catch{}return d}parseImportsField(o,d){if(!(!o||typeof o!="object"))for(let[g,E]of Object.entries(o)){let R=this.resolveImportTarget(E);R&&d.set(g,R)}}resolveImportTarget(o){if(typeof o=="string")return o;if(typeof o=="object"&&o!==null){let d=o,g=d.default??d.import??d.require??d.node;if(typeof g=="string")return g}return null}parseAliasesField(o,d){if(!(!o||typeof o!="object"))for(let[g,E]of Object.entries(o))typeof E=="string"&&d.set(g,E)}async resolveWorkspacePackage(o,d){if(!d.startsWith("@"))return null;let E=/^@([^/]+)\/([^/]+)(\/.*)?$/.exec(d);if(!E)return null;let[,,R,G]=E,le=d.split("/").slice(0,2).join("/"),Re=await this.resolveFileDependency(o,le);if(Re)return this.resolvePackageEntry(Re,d,G);if(this.workspaceRoot){let nt=await this.findWorkspacePackageDir(R);if(nt)return this.resolvePackageEntry(nt,d,G)}return null}async resolveFileDependency(o,d){let E=Ys.dirname(o);for(;!this.shouldStopSearch(E);){let R=Ys.join(E,"package.json");if(await this.fileExists(R)){let le=await this.findFileDependencyInPackageJson(R,d);if(le)return le}let G=Ys.dirname(E);if(G===E)break;E=G}return null}async findFileDependencyInPackageJson(o,d){try{let g=await cR.readFile(o,"utf-8"),E=JSON.parse(g),R=Ys.dirname(o),le={...E.dependencies,...E.devDependencies,...E.peerDependencies}[d];if(typeof le=="string"&&le.startsWith("file:")){let Re=le.slice(5),nt=Ys.resolve(R,Re),at=il(nt),dt=Ys.join(nt,"package.json");if(await this.fileExists(dt))return at}}catch{}return null}async findWorkspacePackageDir(o){if(!this.workspaceRoot)return null;let d=["packages","libs","modules"];for(let g of d){let E=Ys.join(this.workspaceRoot,g,o),R=Ys.join(E,"package.json");if(await this.fileExists(R))return E}return null}async resolvePackageEntry(o,d,g){let E=Ys.join(o,"package.json");try{let R=await cR.readFile(E,"utf-8"),G=JSON.parse(R),le=d.split("/").slice(0,2).join("/"),Re=d.split("/").slice(1,2).join("/"),nt=G.name;if(nt!==le&&nt!==Re)return null;if(g){let at=G.source?Ys.dirname(G.source):"src",dt=Ys.join(o,at,g);return this.resolveWithExtensions(dt)}return this.findPackageEntryPoint(o,G)}catch{return null}}async findPackageEntryPoint(o,d){let g=d.main||d.module||"index",E=[Ys.join(o,"src","index"),Ys.join(o,g),Ys.join(o,"index")];for(let R of E){let G=await this.resolveWithExtensions(R);if(G)return G}return null}};var WZ=class h{fileReader;pathResolver;static STRIP_COMMENTS_RE=(()=>{let o=/'[^']*'|"[^"]*"/,d=/\/\/[^\n]*|\/\*[\s\S]*?\*\//;return new RegExp(`(${o.source})|(${d.source})`,"g")})();constructor(o){this.fileReader=new F_,this.pathResolver=new FZ(o)}patterns={importFrom:/import\s+(?:[^;'"]|'[^']*'|"[^"]*")*?\s+from\s+['"]([^'"]+)['"]/g,exportFrom:/export\s+(?:[^;'"]|'[^']*'|"[^"]*")*?\s+from\s+['"]([^'"]+)['"]/g,require:/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g,dynamicImport:/import\s*\(\s*['"]([^'"]+)['"]\s*\)/g,graphqlImport:/#import\s+['"]([^'"]+)['"]/g};parse(o,d){d&&(d.endsWith(".vue")||d.endsWith(".svelte"))&&(o=this.extractScript(o));let g=[],E=new Set;return d?.endsWith(".gql")||d?.endsWith(".graphql")?(this.extractImports(o,this.patterns.graphqlImport,"import",g,E),g):(o=this.stripComments(o),this.extractImports(o,this.patterns.importFrom,"import",g,E),this.extractImports(o,this.patterns.exportFrom,"export",g,E),this.extractImports(o,this.patterns.require,"require",g,E),this.extractImports(o,this.patterns.dynamicImport,"dynamic",g,E),g)}extractScript(o){let d=/<script[^>]*>([\s\S]*?)<\/script\s*[^>]*>/gi;return[...o.matchAll(d)].map(E=>E[1]).join(`
42158
+ ${g}`:E}function _Pt(h){if(typeof h=="string")return h;if(h instanceof Error)return`${h.name}: ${h.message}`;if(h&&typeof h=="object"){let o=mPt(h);if(o)return o}try{return JSON.stringify(h)}catch{return String(h)}}function hPt(h){return h.length===0?"":" "+h.map(_Pt).join(" ")}var k8=class{_level;prefix;constructor(o="",d="info"){this.prefix=o?`[${o}]`:"",this._level=d}get level(){return this._level}setLevel(o){this._level=o}shouldLog(o){return _Ue[o]>=_Ue[this._level]}formatMessage(o,d){return`${new Date().toISOString()} ${this.prefix} [${o.toUpperCase()}] ${d}`}logTo(o,d,g,E){this.shouldLog(d)&&fPt(pPt(o),this.formatMessage(d,g+hPt(E)))}debug(o,...d){this.logTo("stdout","debug",o,d)}info(o,...d){this.logTo("stdout","info",o,d)}warn(o,...d){this.logTo("stderr","warn",o,d)}error(o,...d){this.logTo("stderr","error",o,d)}};var Oxe=class{level="none";setLevel(){}debug(){}info(){}warn(){}error(){}},LZ=class{delegate;constructor(o){this.delegate=o}get level(){return this.delegate.level}setLevel(o){this.delegate.setLevel(o)}setDelegate(o){this.delegate=o}debug(o,...d){this.delegate.debug(o,...d)}info(o,...d){this.delegate.info(o,...d)}warn(o,...d){this.delegate.warn(o,...d)}error(o,...d){this.delegate.error(o,...d)}},Fxe=class{defaultLevel="info";loggers=new Map;backend;setDefaultLevel(o){this.defaultLevel=o;for(let d of this.loggers.values())d.setLevel(o)}getDefaultLevel(){return this.defaultLevel}getLogger(o){let d=this.loggers.get(o);if(!d){let g=this.backend?this.backend.createLogger(o,this.defaultLevel):new k8(o,this.defaultLevel);d=new LZ(g),this.loggers.set(o,d)}return d}getNullLogger(){let o=new Oxe;return new LZ(o)}clear(){this.loggers.clear()}setBackend(o){this.backend=o;for(let[d,g]of this.loggers.entries()){let E=g.level??this.defaultLevel,R=o?o.createLogger(d,E):new k8(d,E);g.setDelegate(R)}}getBackend(){return this.backend}},gPt=new Fxe;function w8(h){return gPt.getLogger(h)}var Roe=wf(require("node:fs/promises")),ZXe=wf(require("node:path")),f9=require("node:worker_threads");var $Xe=wf(require("node:path"));var iw=wf(require("node:fs/promises")),kZ=wf(require("node:fs"));function il(h){if(!h)return h;let o=h.replaceAll("\\","/");return o=o.replaceAll(/\/+/g,"/"),/^[A-Za-z]:\//.test(o)&&(o=o[0].toLowerCase()+o.slice(1)),o.length>1&&o.endsWith("/")&&!/^[a-zA-Z]:\/$/.test(o)&&(o=o.slice(0,-1)),o}var qp=class h extends Error{code;filePath;cause;timestamp;constructor(o,d,g){super(o),this.name="SpiderError",this.code=d,this.filePath=g?.filePath,this.cause=g?.cause,this.timestamp=Date.now(),Error.captureStackTrace&&Error.captureStackTrace(this,h)}static fromError(o,d){if(o instanceof h)return o;let g=o instanceof Error?o:void 0,E=g?.message??(o!==null&&typeof o=="object"?JSON.stringify(o):String(o)),R="UNKNOWN";if(g){let G=g.code;G==="ENOENT"?R="FILE_NOT_FOUND":G==="EACCES"||G==="EPERM"?R="PERMISSION_DENIED":E.includes("too large")||G==="EFBIG"?R="FILE_TOO_LARGE":E.includes("parse")||E.includes("syntax")?R="PARSE_ERROR":(E.includes("timeout")||G==="ETIMEDOUT")&&(R="TIMEOUT")}return new h(E,R,{filePath:d,cause:g})}isRecoverable(){return["FILE_NOT_FOUND","PERMISSION_DENIED","PARSE_ERROR","RESOLUTION_FAILED"].includes(this.code)}toUserMessage(){switch(this.code){case"FILE_NOT_FOUND":return`File not found: ${this.filePath||"unknown"}`;case"PERMISSION_DENIED":return`Permission denied: ${this.filePath||"unknown"}`;case"FILE_TOO_LARGE":return`File too large to process: ${this.filePath||"unknown"}`;case"PARSE_ERROR":return`Failed to parse: ${this.filePath||"unknown"}`;case"RESOLUTION_FAILED":return`Could not resolve module in: ${this.filePath||"unknown"}`;case"TIMEOUT":return"Operation timed out";case"CIRCULAR_DEPENDENCY":return"Circular dependency detected";default:return this.message}}toJSON(){return{name:this.name,code:this.code,message:this.message,filePath:this.filePath,timestamp:this.timestamp,stack:this.stack}}};var yPt=w8("FileReader"),vPt=5*1024*1024,bPt=64*1024,SPt=3e4,F_=class{maxSize;chunkSize;timeout;constructor(o={}){this.maxSize=o.maxSize??vPt,this.chunkSize=o.chunkSize??bPt,this.timeout=o.timeout??SPt}async getFileSize(o){try{let d=await iw.stat(o);return{size:d.size,isLarge:d.size>this.maxSize,path:o}}catch(d){throw qp.fromError(d,o)}}async readFile(o,d){let g=d?.maxSize??this.maxSize,E=d?.timeout??this.timeout,R=d?.streaming??!1,G=new Promise((le,Re)=>{setTimeout(()=>{Re(new qp(`File read timed out after ${E}ms: ${o}`,"TIMEOUT",{filePath:o}))},E)});try{let le=await iw.stat(o);if(le.size>g)throw new qp(`File too large: ${o} (${this.formatSize(le.size)} > ${this.formatSize(g)})`,"FILE_TOO_LARGE",{filePath:o});return R||le.size>1024*1024?(yPt.debug(`Streaming read for large file: ${o} (${this.formatSize(le.size)})`),await Promise.race([this.readFileStreaming(o),G])):await Promise.race([iw.readFile(o,"utf-8"),G])}catch(le){throw le instanceof qp?le:qp.fromError(le,o)}}async readFileStreaming(o){return new Promise((d,g)=>{let E=[],R=kZ.createReadStream(o,{highWaterMark:this.chunkSize});R.on("data",G=>{E.push(Buffer.isBuffer(G)?G:Buffer.from(G))}),R.on("end",()=>{let G=Buffer.concat(E).toString("utf-8");d(G)}),R.on("error",G=>{g(qp.fromError(G,o))})})}async readFileIfExists(o){try{return await this.readFile(o)}catch(d){if(d instanceof qp&&d.code==="FILE_NOT_FOUND")return null;throw d}}async canRead(o){try{return await iw.access(o,kZ.constants.R_OK),!0}catch{return!1}}formatSize(o){return o<1024?`${o}B`:o<1024*1024?`${(o/1024).toFixed(1)}KB`:`${(o/(1024*1024)).toFixed(1)}MB`}};function Gm(h){let d=/^(.+\.(ts|tsx|js|jsx|mjs|cjs|py|pyi|rs|vue|svelte|gql|graphql)):(.+)$/i.exec(h);if(!d)return h;let g=d[1];return d[3]?(g.length>1&&g[1]===":"&&/^[a-zA-Z]:/.test(g),w8("PathExtractor").warn(`Symbol ID detected where file path expected: ${h}. Extracting file path: ${g}`),g):h}var cR=wf(require("node:fs/promises")),Ys=wf(require("node:path"));var hUe=[".ts",".tsx"],gUe=[".js",".jsx",".mjs",".cjs"],wZ=[".py",".pyi"],yUe=[".rs"],TPt=[".vue"],EPt=[".svelte"],xPt=[".gql",".graphql"],APt=[".toml"],DPt=[".cs",".csproj"],IPt=[".go"],CPt=[".java"],OZ=[...hUe,...gUe,...TPt,...EPt,...xPt,...wZ,...yUe,...APt,...DPt,...IPt,...CPt],lOt=[...hUe,...gUe,...wZ,...yUe];var vUe=["node_modules",".git","dist","build","out","coverage",".next",".nuxt","__pycache__",".venv","venv","target"];var W_={typescript:"#3178c6",javascript:"#f7df1e",python:"#3776ab",rust:"#ce422b",vue:"#41b883",svelte:"#ff3e00",graphql:"#e535ab",toml:"#9c4221",csharp:"#9b4f96",go:"#00acd7",java:"#f8981d",unknown:"#6b6b6b"},cOt={".ts":W_.typescript,".tsx":W_.typescript,".mts":W_.typescript,".cts":W_.typescript,".js":W_.javascript,".jsx":W_.javascript,".mjs":W_.javascript,".cjs":W_.javascript,".py":W_.python,".pyi":W_.python,".rs":W_.rust,".vue":W_.vue,".svelte":W_.svelte,".gql":W_.graphql,".graphql":W_.graphql,".toml":W_.toml,".cs":W_.csharp,".csproj":W_.csharp,".go":W_.go,".java":W_.java};var FZ=class{pathAliases=new Map;tsConfigPromise;tsConfigPath;isConfigLoaded=!1;excludeNodeModules;workspaceRoot;directoryToPackageJson=new Map;directoryToTsConfig=new Map;tsConfigPathAliases=new Map;packageJsonImports=new Map;packageJsonLoadPromises=new Map;tsConfigLoadPromises=new Map;constructor(o,d=!0,g){this.excludeNodeModules=d,this.tsConfigPath=o,this.workspaceRoot=g??(o?Ys.dirname(o):void 0)}updateConfig(o){this.excludeNodeModules=o}async ensureTsConfigLoaded(){this.isConfigLoaded||!this.tsConfigPath||(this.tsConfigPromise??=this.loadTsConfig(this.tsConfigPath),await this.tsConfigPromise,this.tsConfigPromise=void 0,this.isConfigLoaded=!0)}async loadTsConfig(o){try{let d=await cR.readFile(o,"utf-8"),g=JSON.parse(d),E=g?.compilerOptions?.paths,R=g?.compilerOptions?.baseUrl||".";if(E)for(let[G,le]of Object.entries(E)){let Re=G.replace(/\/\*$/,""),nt=le[0]?.replace(/\/\*$/,"");if(nt){let at=Ys.dirname(o),dt=Ys.resolve(at,R,nt);this.pathAliases.set(Re,il(dt))}}}catch{}}async tryTsConfigAliases(o,d){let g=this.resolveAlias(d);if(g)return this.resolveWithExtensions(g);let E=await this.resolveDynamicTsConfigAlias(o,d);return E?this.resolveWithExtensions(E):null}async tryPythonImports(o,d){if(!this.isPythonFile(o))return null;if(this.isPythonRelativeImport(d)){let g=await this.resolvePythonRelativeImport(o,d);if(g)return g}if(d.includes(".")&&!d.includes("/")){let g=await this.resolvePythonModule(o,d);if(g)return g}return null}async trySpecialModulePatterns(o,d){if(this.isSubpathImport(d))return this.resolveSubpathImport(o,d);let g=await this.resolveRustModule(o,d);return g||(this.isPackageJsonAliasCandidate(d)?this.resolveScopedPackage(o,d):null)}async tryRelativePath(o,d){if(!this.isRelativePath(d))return null;let g=Ys.dirname(o),E=Ys.resolve(g,d);if(this.isPythonFile(o)&&!this.hasFileExtension(d)){let R=await this.resolveWithExtensions(E);if(R)return R}return this.resolveWithExtensions(E)}async resolve(o,d){await this.ensureTsConfigLoaded();let g=await this.tryTsConfigAliases(o,d);if(g)return g;let E=await this.trySpecialModulePatterns(o,d);if(E)return E;let R=await this.tryPythonImports(o,d);return R||(this.isNodeModule(d)?this.excludeNodeModules?null:d:this.tryRelativePath(o,d))}async resolveSubpathImport(o,d){let g=await this.resolvePackageJsonImport(o,d);return g?this.resolveWithExtensions(g):null}async resolveScopedPackage(o,d){let g=await this.resolvePackageJsonImport(o,d);if(g)return this.resolveWithExtensions(g);let E=await this.resolveWorkspacePackage(o,d);return E||(this.excludeNodeModules?null:d)}async resolveDynamicTsConfigAlias(o,d){if(!this.isPackageJsonAliasCandidate(d))return null;let g=await this.findNearestTsConfig(o);if(!g)return null;let E=await this.getTsConfigPathAliases(g);for(let[R,G]of E.entries())if(d===R||d.startsWith(R+"/")){let le=d.replace(R,G);return il(le)}return null}async findNearestTsConfig(o){let d=Ys.dirname(o);return this.directoryToTsConfig.has(d)?this.directoryToTsConfig.get(d)??null:await this.searchTsConfigUpward(d)}async searchTsConfigUpward(o){let d=[],g=o;for(;!this.shouldStopSearch(g);){d.push(g);let E=this.directoryToTsConfig.get(g);if(E!==void 0)return this.cacheTsConfigResultForDirs(d,E),E;let R=Ys.join(g,"tsconfig.json");if(await this.fileExists(R))return this.cacheTsConfigResultForDirs(d,R),R;let le=Ys.dirname(g);if(le===g)break;g=le}return this.cacheTsConfigResultForDirs(d,null),null}cacheTsConfigResultForDirs(o,d){for(let g of o)this.directoryToTsConfig.set(g,d)}async getTsConfigPathAliases(o){let d=this.tsConfigPathAliases.get(o);if(d!==void 0)return d;let g=this.tsConfigLoadPromises.get(o);if(g!==void 0)return g;let E=this.loadTsConfigPathAliases(o);this.tsConfigLoadPromises.set(o,E);try{let R=await E;return this.tsConfigPathAliases.set(o,R),R}finally{this.tsConfigLoadPromises.delete(o)}}async loadTsConfigPathAliases(o){let d=new Map,g=new Set;return await this.loadTsConfigPathAliasesRecursive(o,d,g),d}async loadTsConfigPathAliasesRecursive(o,d,g){let E=Ys.resolve(o);if(!g.has(E)){g.add(E);try{let R=await cR.readFile(o,"utf-8"),G=JSON.parse(R),le=Ys.dirname(o);if(G.extends){let at=Ys.resolve(le,G.extends),dt=at.endsWith(".json")?at:at+".json",xe=await this.fileExists(dt)?dt:at;await this.fileExists(xe)&&await this.loadTsConfigPathAliasesRecursive(xe,d,g)}let Re=G?.compilerOptions?.paths,nt=G?.compilerOptions?.baseUrl||".";if(Re)for(let[at,dt]of Object.entries(Re)){let xe=at.replace(/\/\*$/,""),gn=dt[0]?.replace(/\/\*$/,"");if(gn){let pt=Ys.resolve(le,nt,gn);d.set(xe,il(pt))}}}catch{}}}resolveAlias(o){for(let[d,g]of this.pathAliases.entries())if(o===d||o.startsWith(d+"/"))return o.replace(d,g);return null}async resolveWithExtensions(o){let d=OZ;if(await this.fileExists(o))return il(o);for(let g of d){let E=o+g;if(await this.fileExists(E))return il(E)}for(let g of d){let E=Ys.join(o,`index${g}`);if(await this.fileExists(E))return il(E)}return null}async fileExists(o){try{return(await cR.stat(o)).isFile()}catch{return!1}}isRelativePath(o){return o.startsWith("./")||o.startsWith("../")}async resolveRustModule(o,d){if(!o.endsWith(".rs")||d.startsWith(".")||d.startsWith("@")||d.startsWith("#")||d.startsWith("/")||!/^\w+(?:::\w+)*$/u.test(d))return null;let E=Ys.dirname(o),R=d.replaceAll("::",Ys.sep),G=[Ys.join(E,`${R}.rs`),Ys.join(E,R,"mod.rs")];for(let le of G)if(await this.fileExists(le))return il(le);return null}isNodeModule(o){return!o.startsWith(".")&&!o.startsWith("/")&&!o.startsWith("#")&&!o.startsWith("@")}isSubpathImport(o){return o.startsWith("#")}isPackageJsonAliasCandidate(o){return o.startsWith("@")}isPythonFile(o){return wZ.some(d=>o.endsWith(d))}hasFileExtension(o){let d=Ys.basename(o);return d.includes(".")&&!d.startsWith(".")}isPythonRelativeImport(o){return(o.startsWith(".")||o.startsWith(".."))&&!o.includes("/")&&o!=="."&&o!==".."}async resolvePythonRelativeImport(o,d){let g=Ys.dirname(o),E=0,R=d;for(;R.startsWith(".");)E++,R=R.substring(1);let G=g;for(let le=1;le<E;le++)G=Ys.dirname(G);if(R){let le=Ys.join(G,R+".py");if(await this.fileExists(le))return il(le);let Re=Ys.join(G,R,"__init__.py");if(await this.fileExists(Re))return il(Re)}return null}async resolvePythonModule(o,d){let g=d.replaceAll(".","/"),E=Ys.dirname(o),R=this.workspaceRoot||E,G=E;for(;;){let le=Ys.resolve(G,g+".py");if(await this.fileExists(le))return il(le);let Re=Ys.resolve(G,g,"__init__.py");if(await this.fileExists(Re))return il(Re);if(il(G)===il(R))break;let nt=Ys.dirname(G);if(nt===G)break;G=nt}return null}async resolvePackageJsonImport(o,d){let g=await this.findNearestPackageJson(o);if(!g)return null;let E=await this.getPackageJsonImports(g),R=Ys.dirname(g),G=E.get(d);if(G!==void 0)return il(Ys.resolve(R,G));for(let[le,Re]of E.entries())if(le.endsWith("/*")){let nt=le.slice(0,-2);if(d.startsWith(nt+"/")){let at=d.slice(nt.length+1),dt=Re.endsWith("/*")?Re.slice(0,-2):Re,xe=Ys.resolve(R,dt,at);return il(xe)}}return null}async findNearestPackageJson(o){let d=Ys.dirname(o);return this.directoryToPackageJson.has(d)?this.directoryToPackageJson.get(d)??null:await this.searchPackageJsonUpward(d)}async searchPackageJsonUpward(o){let d=[],g=o;for(;!this.shouldStopSearch(g);){d.push(g);let E=this.directoryToPackageJson.get(g);if(E!==void 0)return this.cacheResultForDirs(d,E),E;let R=Ys.join(g,"package.json");if(await this.fileExists(R))return this.cacheResultForDirs(d,R),R;let G=Ys.dirname(g);if(G===g)break;g=G}return this.cacheResultForDirs(d,null),null}shouldStopSearch(o){return!!(this.workspaceRoot&&o===Ys.dirname(this.workspaceRoot))}cacheResultForDirs(o,d){for(let g of o)this.directoryToPackageJson.set(g,d)}async getPackageJsonImports(o){let d=this.packageJsonImports.get(o);if(d!==void 0)return d;let g=this.packageJsonLoadPromises.get(o);if(g!==void 0)return g;let E=this.loadPackageJsonImports(o);this.packageJsonLoadPromises.set(o,E);try{let R=await E;return this.packageJsonImports.set(o,R),R}finally{this.packageJsonLoadPromises.delete(o)}}async loadPackageJsonImports(o){let d=new Map;try{let g=await cR.readFile(o,"utf-8"),E=JSON.parse(g);this.parseImportsField(E?.imports,d),this.parseAliasesField(E?.aliases,d)}catch{}return d}parseImportsField(o,d){if(!(!o||typeof o!="object"))for(let[g,E]of Object.entries(o)){let R=this.resolveImportTarget(E);R&&d.set(g,R)}}resolveImportTarget(o){if(typeof o=="string")return o;if(typeof o=="object"&&o!==null){let d=o,g=d.default??d.import??d.require??d.node;if(typeof g=="string")return g}return null}parseAliasesField(o,d){if(!(!o||typeof o!="object"))for(let[g,E]of Object.entries(o))typeof E=="string"&&d.set(g,E)}async resolveWorkspacePackage(o,d){if(!d.startsWith("@"))return null;let E=/^@([^/]+)\/([^/]+)(\/.*)?$/.exec(d);if(!E)return null;let[,,R,G]=E,le=d.split("/").slice(0,2).join("/"),Re=await this.resolveFileDependency(o,le);if(Re)return this.resolvePackageEntry(Re,d,G);if(this.workspaceRoot){let nt=await this.findWorkspacePackageDir(R);if(nt)return this.resolvePackageEntry(nt,d,G)}return null}async resolveFileDependency(o,d){let E=Ys.dirname(o);for(;!this.shouldStopSearch(E);){let R=Ys.join(E,"package.json");if(await this.fileExists(R)){let le=await this.findFileDependencyInPackageJson(R,d);if(le)return le}let G=Ys.dirname(E);if(G===E)break;E=G}return null}async findFileDependencyInPackageJson(o,d){try{let g=await cR.readFile(o,"utf-8"),E=JSON.parse(g),R=Ys.dirname(o),le={...E.dependencies,...E.devDependencies,...E.peerDependencies}[d];if(typeof le=="string"&&le.startsWith("file:")){let Re=le.slice(5),nt=Ys.resolve(R,Re),at=il(nt),dt=Ys.join(nt,"package.json");if(await this.fileExists(dt))return at}}catch{}return null}async findWorkspacePackageDir(o){if(!this.workspaceRoot)return null;let d=["packages","libs","modules"];for(let g of d){let E=Ys.join(this.workspaceRoot,g,o),R=Ys.join(E,"package.json");if(await this.fileExists(R))return E}return null}async resolvePackageEntry(o,d,g){let E=Ys.join(o,"package.json");try{let R=await cR.readFile(E,"utf-8"),G=JSON.parse(R),le=d.split("/").slice(0,2).join("/"),Re=d.split("/").slice(1,2).join("/"),nt=G.name;if(nt!==le&&nt!==Re)return null;if(g){let at=G.source?Ys.dirname(G.source):"src",dt=Ys.join(o,at,g);return this.resolveWithExtensions(dt)}return this.findPackageEntryPoint(o,G)}catch{return null}}async findPackageEntryPoint(o,d){let g=d.main||d.module||"index",E=[Ys.join(o,"src","index"),Ys.join(o,g),Ys.join(o,"index")];for(let R of E){let G=await this.resolveWithExtensions(R);if(G)return G}return null}};var WZ=class h{fileReader;pathResolver;static STRIP_COMMENTS_RE=(()=>{let o=/'[^']*'|"[^"]*"/,d=/\/\/[^\n]*|\/\*[\s\S]*?\*\//;return new RegExp(`(${o.source})|(${d.source})`,"g")})();constructor(o){this.fileReader=new F_,this.pathResolver=new FZ(o)}patterns={importFrom:/import\s+(?:[^;'"]|'[^']*'|"[^"]*")*?\s+from\s+['"]([^'"]+)['"]/g,exportFrom:/export\s+(?:[^;'"]|'[^']*'|"[^"]*")*?\s+from\s+['"]([^'"]+)['"]/g,require:/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g,dynamicImport:/import\s*\(\s*['"]([^'"]+)['"]\s*\)/g,graphqlImport:/#import\s+['"]([^'"]+)['"]/g};parse(o,d){d&&(d.endsWith(".vue")||d.endsWith(".svelte"))&&(o=this.extractScript(o));let g=[],E=new Set;return d?.endsWith(".gql")||d?.endsWith(".graphql")?(this.extractImports(o,this.patterns.graphqlImport,"import",g,E),g):(o=this.stripComments(o),this.extractImports(o,this.patterns.importFrom,"import",g,E),this.extractImports(o,this.patterns.exportFrom,"export",g,E),this.extractImports(o,this.patterns.require,"require",g,E),this.extractImports(o,this.patterns.dynamicImport,"dynamic",g,E),g)}extractScript(o){let d=/<script[^>]*>([\s\S]*?)<\/script\s*[^>]*>/gi;return[...o.matchAll(d)].map(E=>E[1]).join(`
42159
42159
  `)}stripComments(o){return h.STRIP_COMMENTS_RE.lastIndex=0,o.replaceAll(h.STRIP_COMMENTS_RE,(d,g,E)=>g||E.replaceAll(/[^\n]/g," "))}extractImports(o,d,g,E,R){let G;for(d.lastIndex=0;(G=d.exec(o))!==null;){let le=G[1];if(R.has(le))continue;R.add(le);let Re=this.getLineNumber(o,G.index);E.push({module:le,type:g,line:Re})}}getLineNumber(o,d){return o.substring(0,d).split(`
42160
- `).length}async parseImports(o){let d=Gm(o),g=await this.fileReader.readFile(d);return this.parse(g,d).map(R=>({path:"",type:R.type,line:R.line,module:R.module}))}async resolvePath(o,d){let g=Gm(o);return this.pathResolver.resolve(g,d)}};var kd=wf(HXe());function KDe(h){switch(h){case"FunctionDeclaration":case"ArrowFunction":case"MethodDeclaration":case"GetAccessor":case"SetAccessor":return"function";case"ClassDeclaration":return"class";case"InterfaceDeclaration":return"interface";case"TypeAliasDeclaration":return"type";case"VariableDeclaration":case"PropertyDeclaration":case"EnumDeclaration":return"variable";default:return"other"}}var KXe=w8("SymbolAnalyzer"),voe=class{project;maxFiles;fileCount=0;fileReader;constructor(o,d={}){this.maxFiles=d.maxFiles??100,this.project=this.createProject(),this.fileReader=new F_}createProject(){return new kd.Project({skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0,compilerOptions:{target:99,module:99}})}maybeResetProject(){this.fileCount>=this.maxFiles&&(KXe.debug(`Resetting ts-morph project (${this.fileCount} files in memory)`),this.project=this.createProject(),this.fileCount=0)}getFileCount(){return this.fileCount}reset(){KXe.debug("Forcing ts-morph project reset"),this.project=this.createProject(),this.fileCount=0}analyzeFileContent(o,d){this.maybeResetProject();let g=this.getOrCreateSourceFile(o,d),E=[],R=[],G=this.extractExportedSymbols(g,o,E);return this.extractNonExportedSymbols(g,o,G,E),this.buildDependencies(g,R),{symbols:E,dependencies:R}}getOrCreateSourceFile(o,d){let g=this.project.getSourceFile(o);return g?g.replaceWithText(d):(g=this.project.createSourceFile(o,d),this.fileCount++),g}extractExportedSymbols(o,d,g){let E=o.getExportedDeclarations(),R=new Set(E.keys());for(let[G,le]of E){let Re=le[0];Re&&(this.addSymbol(g,G,Re.getKindName(),Re.getStartLineNumber(),d,!0),Re.getKindName()==="ClassDeclaration"&&kd.Node.isClassDeclaration(Re)&&this.extractClassMembers(Re,d,g))}return R}extractNonExportedSymbols(o,d,g,E){let R=o.getStatements();for(let G of R)kd.Node.isVariableStatement(G)?this.extractVariableDeclarations(G,d,g,E):this.extractOtherDeclarations(G,d,g,E)}extractVariableDeclarations(o,d,g,E){let R=o.getDeclarations();for(let G of R){let le=G.getName();g.has(le)||this.addSymbol(E,le,"VariableDeclaration",G.getStartLineNumber(),d,!1)}}extractOtherDeclarations(o,d,g,E){let R=this.getDeclarationInfo(o);!R||g.has(R.name)||(this.addSymbol(E,R.name,R.kind,o.getStartLineNumber(),d,!1),R.isClass&&kd.Node.isClassDeclaration(o)&&this.extractClassMembers(o,d,E))}getDeclarationInfo(o){if(kd.Node.isClassDeclaration(o)){let d=o.getName();if(d)return{name:d,kind:"ClassDeclaration",isClass:!0}}else if(kd.Node.isFunctionDeclaration(o)){let d=o.getName();if(d)return{name:d,kind:"FunctionDeclaration",isClass:!1}}else{if(kd.Node.isInterfaceDeclaration(o))return{name:o.getName(),kind:"InterfaceDeclaration",isClass:!1};if(kd.Node.isTypeAliasDeclaration(o))return{name:o.getName(),kind:"TypeAliasDeclaration",isClass:!1};if(kd.Node.isEnumDeclaration(o))return{name:o.getName(),kind:"EnumDeclaration",isClass:!1}}return null}addSymbol(o,d,g,E,R,G){o.push({name:d,kind:g,line:E,isExported:G,id:`${R}:${d}`,category:KDe(g)})}buildDependencies(o,d){let g=this.buildImportMap(o),E=this.findSymbolUsage(o,g);for(let[R,G]of Object.entries(E))for(let le of G)d.push({sourceSymbolId:R,targetSymbolId:le.symbolId,targetFilePath:le.filePath,isTypeOnly:le.isTypeOnly})}getInternalExportDependencyGraph(o,d){this.maybeResetProject();let E=this.getOrCreateSourceFile(o,d).getExportedDeclarations(),R=new Set(E.keys()),G=new Map;for(let[le,Re]of E){let nt=`${o}:${le}`,at=this.getOrCreateDependencySet(G,nt);this.collectExportDependencies(Re,le,R,o,at)}return G}getOrCreateDependencySet(o,d){let g=o.get(d);return g||(g=new Set,o.set(d,g)),g}collectExportDependencies(o,d,g,E,R){for(let G of o){let le=G.getDescendantsOfKind(kd.SyntaxKind.Identifier);for(let Re of le){let nt=Re.getText();this.isValidDependency(nt,d,g)&&R.add(`${E}:${nt}`)}}}isValidDependency(o,d,g){return g.has(o)&&o!==d}buildImportMap(o){let d=new Map,g=o.getImportDeclarations();for(let E of g){let R=E.getModuleSpecifierValue(),G=E.isTypeOnly(),le=E.getDefaultImport();if(le){let at=le.getText();d.set(at,{originalName:"default",modulePath:R,isType:G})}let Re=E.getNamedImports();for(let at of Re){let dt=at.getNameNode().getText(),xe=at.getAliasNode(),gn=xe?xe.getText():dt;d.set(gn,{originalName:dt,modulePath:R,isType:G||at.isTypeOnly()})}let nt=E.getNamespaceImport();if(nt){let at=nt.getText();d.set(at,{originalName:"*",modulePath:R,isType:G})}}return d}extractIntraFileCalls(o,d){let g=[],E=d.getFilePath(),R=this.collectFunctionNames(d),G=o.getDescendantsOfKind(kd.SyntaxKind.CallExpression);for(let le of G)this.processCallExpression(le,R,E,g);return g}collectFunctionNames(o){let d=new Set;for(let g of o.getFunctions()){let E=g.getName();E&&d.add(E)}for(let g of o.getClasses())for(let E of g.getMethods()){let R=E.getName();R&&d.add(R)}return d}processCallExpression(o,d,g,E){if(!kd.Node.isCallExpression(o))return;let R=o.getExpression();if(kd.Node.isIdentifier(R)){this.addDirectFunctionCall(R,d,g,E);return}kd.Node.isPropertyAccessExpression(R)&&this.addPropertyAccessCall(R,d,g,E)}addDirectFunctionCall(o,d,g,E){let R=o.getText();d.has(R)&&E.push({symbolId:`${g}:${R}`,filePath:g,isTypeOnly:!1})}addPropertyAccessCall(o,d,g,E){if(kd.Node.isPropertyAccessExpression(o)){let R=o.getName();d.has(R)&&E.push({symbolId:`${g}:${R}`,filePath:g,isTypeOnly:!1})}}findSymbolUsage(o,d){let g={},E=o.getFilePath(),R=[...o.getFunctions(),...o.getClasses(),...o.getVariableDeclarations()];for(let Re of R){let nt=Re.getName();if(!nt)continue;let at=`${E}:${nt}`,dt=this.extractSymbolDependencies(Re,d),xe=this.extractIntraFileCalls(Re,o);dt.push(...xe),g[at]=dt}let G=o.getStatements(),le=[];for(let Re of G){if(kd.Node.isFunctionDeclaration(Re)||kd.Node.isClassDeclaration(Re)||kd.Node.isVariableStatement(Re)||kd.Node.isInterfaceDeclaration(Re)||kd.Node.isTypeAliasDeclaration(Re)||kd.Node.isEnumDeclaration(Re)||kd.Node.isImportDeclaration(Re))continue;let nt=this.extractSymbolDependencies(Re,d);le.push(...nt)}if(le.length>0){let Re=`${E}:(file)`;g[Re]=le}return g}extractSymbolDependencies(o,d){let g=[];return this.extractStaticImportDependencies(o,d,g),this.extractDynamicImportDependencies(o,g),g}extractStaticImportDependencies(o,d,g){let E=o.getDescendantsOfKind(kd.SyntaxKind.Identifier);for(let R of E){let G=d.get(R.getText());if(!G)continue;let le=this.buildTargetSymbolId(G);g.some(Re=>Re.symbolId===le)||g.push({symbolId:le,filePath:G.modulePath,isTypeOnly:G.isType})}}extractDynamicImportDependencies(o,d){let g=o.getDescendantsOfKind(kd.SyntaxKind.CallExpression);for(let E of g){let R=this.extractDynamicImportPath(E);if(!R)continue;let G=`${R}:default`;d.some(le=>le.symbolId===G)||d.push({symbolId:G,filePath:R,isTypeOnly:!1})}}extractDynamicImportPath(o){if(!kd.Node.isCallExpression(o)||o.getExpression().getKind()!==kd.SyntaxKind.ImportKeyword)return null;let g=o.getArguments();if(g.length===0)return null;let E=g[0];return kd.Node.isStringLiteral(E)?E.getLiteralValue():null}buildTargetSymbolId(o){return o.originalName==="default"?`${o.modulePath}:default`:`${o.modulePath}:${o.originalName}`}extractClassMembers(o,d,g){let E=o.getName();if(!E)return;let R=`${d}:${E}`,G=o.getMembers();for(let le of G){let Re=le.getKindName();if(!kd.Node.isMethodDeclaration(le)&&!kd.Node.isPropertyDeclaration(le)&&!kd.Node.isGetAccessorDeclaration(le)&&!kd.Node.isSetAccessorDeclaration(le))continue;let nt=le.getName();if(!nt)continue;let at=le.isStatic()??!1,dt=`${E}.${nt}`,xe=at?`Static${Re}`:Re;g.push({name:dt,kind:xe,line:le.getStartLineNumber(),isExported:!1,id:`${d}:${dt}`,parentSymbolId:R,category:KDe(Re)})}}getExportedSymbols(o,d){let g=this.project.getSourceFile(o);g?g.replaceWithText(d):g=this.project.createSourceFile(o,d);let E=[],R=g.getExportedDeclarations();for(let[G,le]of R){let Re=le[0];if(!Re)continue;let nt=Re.getKindName();E.push({name:G,kind:nt,line:Re.getStartLineNumber(),isExported:!0,id:`${o}:${G}`,category:KDe(nt)})}return E}filterRuntimeSymbols(o){let d=new Set(["InterfaceDeclaration","TypeAliasDeclaration","TypeParameter"]);return o.filter(g=>!d.has(g.kind))}async analyzeFile(o){let d=await this.fileReader.readFile(o),g=this.analyzeFileContent(o,d),E=new Map;for(let R of g.symbols)E.set(R.id,R);return E}async getSymbolDependencies(o){let d=await this.fileReader.readFile(o);return this.analyzeFileContent(o,d).dependencies}};var JDe=wf(require("node:fs/promises")),Y1=wf(require("node:path"));var JXe=wf(require("node:fs/promises")),l6=require("web-tree-sitter"),Ly=class h{static instance=null;initPromise=null;parsers=new Map;parserPromises=new Map;languages=new Map;initialized=!1;textEncoder=new TextEncoder;constructor(){}static getInstance(){return h.instance??=new h,h.instance}async init(o){if(!this.initialized){if(this.initPromise)return this.initPromise;this.initPromise=(async()=>{try{await l6.Parser.init({locateFile:()=>o}),this.initialized=!0}catch(d){this.initPromise=null;let g=d instanceof Error?d.message:String(d);throw new Error(`Failed to initialize web-tree-sitter from ${o}: ${g}. Ensure the WASM file exists and is not corrupted.`,{cause:d})}})(),await this.initPromise}}async getParser(o,d){if(!this.initialized)throw new Error("WasmParserFactory must be initialized with init() before creating parsers");if(this.parsers.has(o))return this.parsers.get(o);if(this.parserPromises.has(o))return this.parserPromises.get(o);let g=(async()=>{try{this.languages.has(o)||await this.loadLanguage(o,d);let E=new l6.Parser,R=this.languages.get(o);return E.setLanguage(R),this.parsers.set(o,E),E}finally{this.parserPromises.delete(o)}})();return this.parserPromises.set(o,g),g}async loadLanguage(o,d){try{let g;try{let E=await JXe.default.readFile(d),R=this.normalizeLegacyDylinkSection(new Uint8Array(E));g=await l6.Language.load(R)}catch(E){let R=E instanceof Error?E.message:String(E);if(R.includes("ENOENT")||R.includes("not found"))g=await l6.Language.load(d);else throw E}this.languages.set(o,g)}catch(g){let E=g instanceof Error?g.message:String(g);throw E.includes("ENOENT")||E.includes("not found")?new Error(`Language WASM file not found: ${d}. Ensure the extension is properly installed and WASM files are in the dist directory.`,{cause:g}):E.includes("magic")||E.includes("invalid")?new Error(`Failed to load language WASM from ${d}: ${E}. The WASM file may be corrupted. Try reinstalling the extension.`,{cause:g}):new Error(`Failed to load language WASM from ${d}: ${E}`,{cause:g})}}normalizeLegacyDylinkSection(o){try{if(o.length<12||o[0]!==0||o[1]!==97||o[2]!==115||o[3]!==109)return o;let d=8;if(o[d]!==0)return o;let g=this.readUnsignedLeb128(o,d+1),E=g.nextOffset,R=E+g.value;if(R>o.length)return o;let G=this.readUnsignedLeb128(o,E),le=G.nextOffset,Re=le+G.value;if(Re>R||Buffer.from(o.subarray(le,Re)).toString("utf8")!=="dylink")return o;let at=Re,dt=this.readUnsignedLeb128(o,at);at=dt.nextOffset;let xe=this.readUnsignedLeb128(o,at);at=xe.nextOffset;let gn=this.readUnsignedLeb128(o,at);at=gn.nextOffset;let pt=this.readUnsignedLeb128(o,at);at=pt.nextOffset;let ut=this.readUnsignedLeb128(o,at);at=ut.nextOffset;let yi=[];for(let Fr=0;Fr<ut.value;Fr++){let bi=this.readUnsignedLeb128(o,at);at=bi.nextOffset;let fd=at+bi.value;if(fd>R)return o;yi.push(o.subarray(at,fd)),at=fd}let wi=this.concatUint8Arrays(this.encodeUnsignedLeb128(dt.value),this.encodeUnsignedLeb128(xe.value),this.encodeUnsignedLeb128(gn.value),this.encodeUnsignedLeb128(pt.value)),eo=this.concatUint8Arrays(this.encodeUnsignedLeb128(yi.length),...yi.flatMap(Fr=>[this.encodeUnsignedLeb128(Fr.length),Fr])),qa=1,bl=2,Sa=this.concatUint8Arrays(Uint8Array.of(qa),this.encodeUnsignedLeb128(wi.length),wi),Lr=this.concatUint8Arrays(Uint8Array.of(bl),this.encodeUnsignedLeb128(eo.length),eo),In=this.textEncoder.encode("dylink.0"),Ii=this.concatUint8Arrays(this.encodeUnsignedLeb128(In.length),In,Sa,Lr),_i=this.concatUint8Arrays(Uint8Array.of(0),this.encodeUnsignedLeb128(Ii.length),Ii);return this.concatUint8Arrays(o.subarray(0,8),_i,o.subarray(R))}catch{return o}}readUnsignedLeb128(o,d){let g=0,E=0,R=d;for(;R<o.length;){let G=o[R];if(g|=(G&127)<<E,R++,(G&128)===0)return{value:g,nextOffset:R};if(E+=7,E>35)throw new Error("Invalid LEB128 value")}throw new Error("Unexpected EOF while reading LEB128")}encodeUnsignedLeb128(o){let d=[],g=o>>>0;do{let E=g&127;g>>>=7,g!==0&&(E|=128),d.push(E)}while(g!==0);return Uint8Array.from(d)}concatUint8Arrays(...o){let d=o.reduce((R,G)=>R+G.length,0),g=new Uint8Array(d),E=0;for(let R of o)g.set(R,E),E+=R.length;return g}isInitialized(){return this.initialized}reset(){this.parsers.clear(),this.parserPromises.clear(),this.languages.clear(),this.initialized=!1,this.initPromise=null}};var boe=class h{parser=null;fileReader;rootDir;extensionPath;initPromise=null;constructor(o,d){this.fileReader=new F_,this.rootDir=o??process.cwd(),this.extensionPath=d}async ensureInitialized(){if(!this.parser)return this.initPromise!==null?this.initPromise:(this.initPromise=(async()=>{let o=this.extensionPath;if(!o)throw new Error("Extension path required for WASM parser initialization. Ensure CSharpParser is constructed with extensionPath parameter.");try{let d=Ly.getInstance(),g=Y1.default.join(o,"dist","wasm","tree-sitter.wasm");await d.init(g);let E=Y1.default.join(o,"dist","wasm","tree-sitter-c_sharp.wasm");this.parser=await d.getParser("c_sharp",E)}catch(d){this.initPromise=null;let g=d instanceof Error?d.message:String(d);throw new Error(`Failed to initialize C# WASM parser: ${g}`,{cause:d})}})(),this.initPromise)}async parseImports(o){let d=Gm(o),g;try{g=await this.fileReader.readFile(d)}catch(G){throw qp.fromError(G,d)}if(await this.ensureInitialized(),!this.parser)return[];let E=this.parser.parse(g);if(!E)return[];let R=[];return this.extractUsings(E.rootNode,d,R),R}extractUsings(o,d,g){if(o.type==="using_directive"){let E=o.children.find(R=>R.type==="identifier"||R.type==="qualified_name"||R.type==="member_access_expression");if(E){let R=E.text.trim();R&&g.push({path:il(d),type:"import",line:E.startPosition.row+1,module:R})}}for(let E of o.children)this.extractUsings(E,d,g)}async resolvePath(o,d){if(this.isFrameworkNamespace(d))return null;let g=d.split(".");return g.length<2||g.some(h.isUnsafeSegment)?null:this.resolveNamespace(g)}async resolveNamespace(o){try{return await this.resolveViaSuffix(o)??await this.resolveViaLastSegment(o)}catch{return null}}static isUnsafeSegment(o){return o===""||o===".."||o.includes("/")}async resolveViaSuffix(o){for(let d=o.length-1;d>=1;d--){let g=Y1.default.resolve(this.rootDir,o.slice(d).join(Y1.default.sep));if(!this.isWithinRoot(g))continue;let E=await this.findFirstCsFile(g);if(E)return il(E)}return null}async resolveViaLastSegment(o){let d=o.at(-1)??"";if(!d)return null;let g=await this.findDirectory(this.rootDir,d,3);if(!g||!this.isWithinRoot(g))return null;let E=await this.findFirstCsFile(g);return E?il(E):null}isWithinRoot(o){let d=il(Y1.default.resolve(o)),g=il(Y1.default.resolve(this.rootDir));return d===g||d.startsWith(g+"/")}isFrameworkNamespace(o){return["System","Microsoft","Newtonsoft","NUnit","Xunit","MSTest","AutoMapper","FluentValidation","MediatR","Serilog"].some(g=>o===g||o.startsWith(g+"."))}async findFirstCsFile(o){try{let g=(await JDe.default.readdir(o,{withFileTypes:!0})).filter(E=>E.isFile()&&E.name.endsWith(".cs")).sort((E,R)=>E.name.localeCompare(R.name));return g.length>0?Y1.default.join(o,g[0].name):null}catch{return null}}async findDirectory(o,d,g){if(g<=0)return null;try{let R=(await JDe.default.readdir(o,{withFileTypes:!0})).filter(h.isTraversableDir);for(let G of R){if(G.name===d)return Y1.default.join(o,G.name);let le=await this.findDirectory(Y1.default.join(o,G.name),d,g-1);if(le)return le}}catch{}return null}static isTraversableDir(o){return o.isDirectory()&&!o.name.startsWith(".")&&o.name!=="node_modules"}};var Soe=wf(require("node:fs/promises")),r0=wf(require("node:path"));var Toe=class h{parser=null;fileReader;rootDir;extensionPath;initPromise=null;constructor(o,d){this.fileReader=new F_,this.rootDir=o??process.cwd(),this.extensionPath=d}async ensureInitialized(){if(!this.parser)return this.initPromise!==null?this.initPromise:(this.initPromise=(async()=>{let o=this.extensionPath;if(!o)throw new Error("Extension path required for WASM parser initialization. Ensure GoParser is constructed with extensionPath parameter.");try{let d=Ly.getInstance(),g=r0.default.join(o,"dist","wasm","tree-sitter.wasm");await d.init(g);let E=r0.default.join(o,"dist","wasm","tree-sitter-go.wasm");this.parser=await d.getParser("go",E)}catch(d){this.initPromise=null;let g=d instanceof Error?d.message:String(d);throw new Error(`Failed to initialize Go WASM parser: ${g}`,{cause:d})}})(),this.initPromise)}async parseImports(o){let d=Gm(o),g;try{g=await this.fileReader.readFile(d)}catch(G){throw qp.fromError(G,d)}if(await this.ensureInitialized(),!this.parser)return[];let E=this.parser.parse(g);if(!E)return[];let R=[];return this.extractImports(E.rootNode,d,R),R}extractImports(o,d,g){if(o.type==="import_spec"){let E=o.children.find(R=>R.type==="interpreted_string_literal"||R.type==="raw_string_literal");if(E){let R=E.text.replaceAll(/^["`]|["`]$/g,"").trim();R&&g.push({path:il(d),type:"import",line:E.startPosition.row+1,module:R})}}for(let E of o.children)this.extractImports(E,d,g)}async resolvePath(o,d){if(this.isGoStdlibImport(d))return null;let g=d.split("/");return g.some(h.isUnsafePart)?null:this.resolveGoImport(Gm(o),d,g)}async resolveGoImport(o,d,g){try{let E=await this.resolveViaGoMod(o,d)??await this.resolveViaLastSegment(g);return E?il(E):null}catch{return null}}static isUnsafePart(o){return o===".."||o===""}async resolveViaGoMod(o,d){let g=await this.findGoModuleInfo(r0.default.dirname(o));if(!g||!d.startsWith(g.moduleName+"/"))return null;let R=d.slice(g.moduleName.length+1).split("/");if(R.some(h.isUnsafePart))return null;let G=r0.default.resolve(g.moduleDir,...R);return this.isWithinRoot(G)?this.findFirstGoFile(G):null}async resolveViaLastSegment(o){let d=o.at(-1)??"";if(!d)return null;let g=await this.findDirectory(this.rootDir,d,3);return!g||!this.isWithinRoot(g)?null:this.findFirstGoFile(g)}isWithinRoot(o){let d=il(r0.default.resolve(o)),g=il(r0.default.resolve(this.rootDir));return d===g||d.startsWith(g+"/")}isGoStdlibImport(o){return!(o.split("/")[0]??"").includes(".")}async findGoModuleInfo(o){let d=o,g=il(this.rootDir);for(;;){let E=await this.readGoModuleName(r0.default.join(d,"go.mod"));if(E)return{moduleDir:d,moduleName:E};let R=r0.default.dirname(d);if(R===d||!il(R).startsWith(g))break;d=R}return null}async readGoModuleName(o){try{let d=await Soe.default.readFile(o,"utf-8"),g=/^module\s+(\S+)/mu.exec(d);return g?g[1]:null}catch{return null}}async findFirstGoFile(o){try{let g=(await Soe.default.readdir(o,{withFileTypes:!0})).filter(E=>E.isFile()&&E.name.endsWith(".go")&&!E.name.endsWith("_test.go")).sort((E,R)=>E.name.localeCompare(R.name));return g.length>0?r0.default.join(o,g[0].name):null}catch{return null}}async findDirectory(o,d,g){if(g<=0)return null;try{let R=(await Soe.default.readdir(o,{withFileTypes:!0})).filter(h.isTraversableDir);for(let G of R){if(G.name===d)return r0.default.join(o,G.name);let le=await this.findDirectory(r0.default.join(o,G.name),d,g-1);if(le)return le}}catch{}return null}static isTraversableDir(o){return o.isDirectory()&&!o.name.startsWith(".")&&o.name!=="node_modules"}};var qDe=wf(require("node:fs/promises")),CC=wf(require("node:path"));var Eoe=class{parser=null;fileReader;rootDir;extensionPath;initPromise=null;constructor(o,d){this.fileReader=new F_,this.rootDir=o??process.cwd(),this.extensionPath=d}async ensureInitialized(){if(!this.parser)return this.initPromise!==null?this.initPromise:(this.initPromise=(async()=>{let o=this.extensionPath;if(!o)throw new Error("Extension path required for WASM parser initialization. Ensure JavaParser is constructed with extensionPath parameter.");try{let d=Ly.getInstance(),g=CC.default.join(o,"dist","wasm","tree-sitter.wasm");await d.init(g);let E=CC.default.join(o,"dist","wasm","tree-sitter-java.wasm");this.parser=await d.getParser("java",E)}catch(d){this.initPromise=null;let g=d instanceof Error?d.message:String(d);throw new Error(`Failed to initialize Java WASM parser: ${g}`,{cause:d})}})(),this.initPromise)}async parseImports(o){let d=Gm(o),g;try{g=await this.fileReader.readFile(d)}catch(G){throw qp.fromError(G,d)}if(await this.ensureInitialized(),!this.parser)return[];let E=this.parser.parse(g);if(!E)return[];let R=[];return this.extractImports(E.rootNode,d,R),R}extractImports(o,d,g){if(o.type==="import_declaration"){let E=o.children.find(R=>R.type==="identifier"||R.type==="scoped_identifier");if(E){let R=E.text.trim();R&&g.push({path:il(d),type:"import",line:E.startPosition.row+1,module:R})}}for(let E of o.children)this.extractImports(E,d,g)}async resolvePath(o,d){try{if(this.isJavaStdlibImport(d)||d.endsWith(".*"))return null;let g=d.split(".");if(g.some(Re=>Re===""||Re===".."||Re.includes("/")))return null;let E=g.at(-1)??"",R=g.join(CC.default.sep)+".java",G=CC.default.resolve(this.rootDir,R);if(this.isWithinRoot(G)&&await this.fileExists(G))return il(G);let le=await this.findFile(this.rootDir,E+".java",4);return le?il(le):null}catch{return null}}isWithinRoot(o){let d=il(CC.default.resolve(o)),g=il(CC.default.resolve(this.rootDir));return d===g||d.startsWith(g+"/")}isJavaStdlibImport(o){return["java.","javax.","sun.","com.sun.","org.w3c.","org.xml.","org.ietf.","org.omg.","jdk.","javafx."].some(g=>o.startsWith(g))}async findFile(o,d,g){if(g<=0)return null;try{let E=await qDe.default.readdir(o,{withFileTypes:!0});for(let R of E)if(R.isFile()&&R.name===d)return CC.default.join(o,R.name);for(let R of E)if(R.isDirectory()&&!R.name.startsWith(".")&&R.name!=="node_modules"){let G=await this.findFile(CC.default.join(o,R.name),d,g-1);if(G)return G}}catch{}return null}async fileExists(o){try{return await qDe.default.access(o),!0}catch{return!1}}};var XDe=wf(require("node:fs/promises")),wv=wf(require("node:path"));var xoe=class{parser=null;fileReader;rootDir;extensionPath;initPromise=null;constructor(o,d){this.fileReader=new F_,this.rootDir=o||process.cwd(),this.extensionPath=d}async ensureInitialized(){if(!this.parser){if(this.initPromise)return this.initPromise;this.initPromise=(async()=>{let o=await this.resolveExtensionPath();if(!o)throw new Error("Extension path required for WASM parser initialization. Ensure PythonParser is constructed with extensionPath parameter.");try{let d=Ly.getInstance(),g=wv.default.join(o,"dist","wasm","tree-sitter.wasm");await d.init(g);let E=wv.default.join(o,"dist","wasm","tree-sitter-python.wasm");this.parser=await d.getParser("python",E)}catch(d){this.initPromise=null;let g=d instanceof Error?d.message:String(d);throw new Error(`Failed to initialize Python WASM parser: ${g}`,{cause:d})}})(),await this.initPromise}}async resolveExtensionPath(){if(this.extensionPath)return this.extensionPath;let o=process.cwd(),d=wv.default.join(o,"dist","wasm","tree-sitter.wasm");try{return await XDe.default.access(d),o}catch{return}}async parseImports(o){try{await this.ensureInitialized();let d=Gm(o),g=await this.fileReader.readFile(d),E=this.parser.parse(g);if(!E)throw new Error(`Failed to parse Python file: ${d}`);let R=[],G=new Set;return this.traverseTree(E.rootNode,le=>{le.type==="import_statement"?this.extractImportStatement(le,R,G,g):le.type==="import_from_statement"&&this.extractImportFromStatement(le,R,G,g)}),R}catch(d){throw qp.fromError(d,o)}}async resolvePath(o,d){try{await this.ensureInitialized();let g=Gm(o),E=wv.default.dirname(g);return d.startsWith(".")?await this.resolveRelativeImport(E,d):await this.resolveAbsoluteImport(E,d)}catch{return null}}extractImportStatement(o,d,g,E){let R=this.findChildrenByType(o,"dotted_name");for(let G of R){let le=this.getNodeText(G,E);le&&!g.has(le)&&(g.add(le),d.push({path:"",type:"import",line:G.startPosition.row+1,module:le}))}}extractImportFromStatement(o,d,g,E){let R=null,G=this.findChildByType(o,"relative_import");if(G)R=this.getNodeText(G,E);else{let le=this.findChildByType(o,"dotted_name");le&&(R=this.getNodeText(le,E))}R&&!g.has(R)&&(g.add(R),d.push({path:"",type:"import",line:o.startPosition.row+1,module:R}))}async resolveRelativeImport(o,d){let g=/^\.*/u.exec(d),E=g?g[0].length:0,R=d.slice(E).replaceAll(".","/"),G=o;for(let Re=1;Re<E;Re++)G=wv.default.dirname(G);let le=[wv.default.join(G,R+".py"),wv.default.join(G,R+".pyi"),wv.default.join(G,R,"__init__.py"),wv.default.join(G,R,"__init__.pyi")];for(let Re of le)if(await this.fileExists(Re))return il(Re);return null}async resolveAbsoluteImport(o,d){let g=d.replaceAll(".","/"),E=il(this.rootDir),R=new Set,G=async Re=>{let nt=il(Re);if(R.has(nt))return null;R.add(nt);let at=[wv.default.join(Re,g+".py"),wv.default.join(Re,g+".pyi"),wv.default.join(Re,g,"__init__.py"),wv.default.join(Re,g,"__init__.pyi")];for(let dt of at)if(await this.fileExists(dt))return il(dt);return null},le=o;for(;;){let Re=await G(le);if(Re)return Re;let nt=wv.default.dirname(le);if(nt===le)break;if(il(nt)===E){let at=await G(nt);if(at)return at;break}le=nt}if(!R.has(E)){let Re=await G(this.rootDir);if(Re)return Re}return null}async fileExists(o){try{return await XDe.default.access(o),!0}catch{return!1}}traverseTree(o,d){d(o);for(let g of o.children)this.traverseTree(g,d)}findChildrenByType(o,d){let g=[];for(let E of o.children)E.type===d&&g.push(E);return g}findChildByType(o,d){for(let g of o.children)if(g.type===d)return g;return null}getNodeText(o,d){return d.slice(o.startIndex,o.endIndex)}};var qXe=wf(require("node:fs/promises")),Aoe=wf(require("node:path"));var Doe=class{parser=null;fileReader;initPromise=null;extensionPath;constructor(o,d){this.extensionPath=d??o,this.fileReader=new F_}async ensureInitialized(){if(!this.parser){if(this.initPromise)return this.initPromise;this.initPromise=(async()=>{let o=await this.resolveExtensionPath();if(!o)throw new Error("Extension path required for WASM parser initialization. Ensure PythonSymbolAnalyzer is constructed with extensionPath parameter.");try{let d=Ly.getInstance(),g=Aoe.default.join(o,"dist","wasm","tree-sitter.wasm");await d.init(g);let E=Aoe.default.join(o,"dist","wasm","tree-sitter-python.wasm");this.parser=await d.getParser("python",E)}catch(d){this.initPromise=null;let g=d instanceof Error?d.message:String(d);throw new Error(`Failed to initialize Python WASM parser for symbol analysis: ${g}`,{cause:d})}})(),await this.initPromise}}async resolveExtensionPath(){if(this.extensionPath)return this.extensionPath;let o=process.cwd(),d=Aoe.default.join(o,"dist","wasm","tree-sitter.wasm");try{return await qXe.default.access(d),o}catch{return}}async analyzeFile(o){try{await this.ensureInitialized();let d=await this.fileReader.readFile(o);return this.analyzeFileFromContent(o,d)}catch(d){throw qp.fromError(d,o)}}analyzeFileFromContent(o,d){if(!this.parser)throw new Error("Parser not initialized. Call ensureInitialized() before using analyzeFileFromContent().");let g=this.parser.parse(d);if(!g)throw new Error(`Failed to parse Python file: ${o}`);let E=new Map,R=il(o);return this.extractSymbols(g.rootNode,R,d,E),E}analyzeFileContent(o,d){if(!this.parser)throw new Error("Parser not initialized. Call ensureInitialized() before using analyzeFileContent().");let g=this.parser.parse(d);if(!g)throw new Error(`Failed to parse Python file: ${o}`);let E=new Map,R=[],G=il(o);this.extractSymbols(g.rootNode,G,d,E);let le=this.buildImportMap(g.rootNode,d);return this.extractDependencies(g.rootNode,G,d,R,E,void 0,le),{symbols:Array.from(E.values()),dependencies:R}}async getSymbolDependencies(o){try{await this.ensureInitialized();let d=await this.fileReader.readFile(o);return this.analyzeFileContent(o,d).dependencies}catch(d){throw qp.fromError(d,o)}}extractSymbols(o,d,g,E,R){this.tryExtractSymbolFromNode(o,d,g,E,R)||this.extractSymbolsFromChildren(o,d,g,E,R)}tryExtractSymbolFromNode(o,d,g,E,R){return o.type==="function_definition"?(this.handleFunctionDefinition(o,d,g,E,R),!0):o.type==="class_definition"?(this.handleClassDefinition(o,d,g,E,R),!0):o.type==="decorated_definition"?(this.handleDecoratedDefinition(o,d,g,E,R),!0):!1}handleFunctionDefinition(o,d,g,E,R){let G=o.childForFieldName("name");if(!G)return;let le=this.getNodeText(G,g),Re=`${d}:${le}`,nt=this.hasChild(o,"async");E.set(Re,{name:le,kind:nt?"AsyncFunction":"FunctionDeclaration",line:G.startPosition.row+1,isExported:this.isExported(o,g),id:Re,parentSymbolId:R,category:"function"}),this.extractSymbolsFromChildren(o,d,g,E,Re)}handleClassDefinition(o,d,g,E,R){let G=o.childForFieldName("name");if(!G)return;let le=this.getNodeText(G,g),Re=`${d}:${le}`;E.set(Re,{name:le,kind:"ClassDeclaration",line:G.startPosition.row+1,isExported:this.isExported(o,g),id:Re,parentSymbolId:R,category:"class"}),this.extractSymbolsFromChildren(o,d,g,E,Re)}handleDecoratedDefinition(o,d,g,E,R){for(let G of o.children)(G.type==="function_definition"||G.type==="class_definition")&&this.extractSymbols(G,d,g,E,R)}extractSymbolsFromChildren(o,d,g,E,R){for(let G of o.children)this.extractSymbols(G,d,g,E,R)}buildImportMap(o,d){let g=new Map;return this.traverseForImports(o,g,d),g}traverseForImports(o,d,g){o.type==="import_from_statement"?this.processFromImport(o,d,g):o.type==="import_statement"&&this.processImportStatement(o,d,g);for(let E of o.children)this.traverseForImports(E,d,g)}processFromImport(o,d,g){let E=o.childForFieldName("module_name");if(!E)return;let R=this.getNodeText(E,g);for(let G of o.children)this.processFromImportChild(G,d,g,R)}processFromImportChild(o,d,g,E){if(o.type==="aliased_import"){this.addAliasedFromImport(o,d,g,E);return}if(o.type==="dotted_name"||o.type==="identifier"){let R=this.getNodeText(o,g);if(R===E||o.parent?.type==="aliased_import")return;d.set(R,E)}}addAliasedFromImport(o,d,g,E){let R=o.childForFieldName("name");if(!R)return;let G=this.getNodeText(R,g),le=o.childForFieldName("alias"),Re=le?this.getNodeText(le,g):G;d.set(Re,E)}processImportStatement(o,d,g){for(let E of o.children)this.processImportStatementChild(E,d,g)}processImportStatementChild(o,d,g){if(o.type==="aliased_import"){let E=o.childForFieldName("name");if(!E)return;let R=this.getNodeText(E,g),G=o.childForFieldName("alias"),le=G?this.getNodeText(G,g):R;d.set(le,R);return}if(o.type==="dotted_name"||o.type==="identifier"){let E=this.getNodeText(o,g);E!=="import"&&d.set(E,E)}}extractDependencies(o,d,g,E,R,G,le){let Re=this.getScopeForNode(o,d,g,G);this.addCallDependencyIfAny(o,d,g,E,R,Re,le);for(let nt of o.children)this.extractDependencies(nt,d,g,E,R,Re,le)}getScopeForNode(o,d,g,E){if(o.type!=="function_definition"&&o.type!=="class_definition")return E;let R=o.childForFieldName("name");if(!R)return E;let G=this.getNodeText(R,g);return`${d}:${G}`}addCallDependencyIfAny(o,d,g,E,R,G,le){if(o.type!=="call")return;let Re=o.childForFieldName("function");if(!Re||!G)return;let nt=this.getCalledName(Re,g),at=`${d}:${nt}`;if(R.has(at)){E.push({sourceSymbolId:G,targetSymbolId:at,targetFilePath:d,isTypeOnly:!1});return}if(le?.has(nt)){let dt=le.get(nt);E.push({sourceSymbolId:G,targetSymbolId:`${dt}:${nt}`,targetFilePath:dt,isTypeOnly:!1})}}getCalledName(o,d){if(o.type!=="attribute")return this.getNodeText(o,d);let g=o.childForFieldName("attribute");return g?this.getNodeText(g,d):this.getNodeText(o,d)}isExported(o,d){let g=o.childForFieldName("name");return g?!this.getNodeText(g,d).startsWith("_"):!1}hasChild(o,d){for(let g of o.children)if(g.type===d)return!0;return!1}getNodeText(o,d){return d.slice(o.startIndex,o.endIndex)}};var $De=wf(require("node:fs/promises")),PC=wf(require("node:path"));var Ioe=class{parser=null;fileReader;rootDir;extensionPath;initPromise=null;constructor(o,d){this.fileReader=new F_,this.rootDir=o||process.cwd(),this.extensionPath=d}async ensureInitialized(){if(!this.parser){if(this.initPromise)return this.initPromise;this.initPromise=(async()=>{let o=await this.resolveExtensionPath();if(!o)throw new Error("Extension path required for WASM parser initialization. Ensure RustParser is constructed with extensionPath parameter.");try{let d=Ly.getInstance(),g=PC.default.join(o,"dist","wasm","tree-sitter.wasm");await d.init(g);let E=PC.default.join(o,"dist","wasm","tree-sitter-rust.wasm");this.parser=await d.getParser("rust",E)}catch(d){this.initPromise=null;let g=d instanceof Error?d.message:String(d);throw new Error(`Failed to initialize Rust WASM parser: ${g}`,{cause:d})}})(),await this.initPromise}}async resolveExtensionPath(){if(this.extensionPath)return this.extensionPath;let o=process.cwd(),d=PC.default.join(o,"dist","wasm","tree-sitter.wasm");try{return await $De.default.access(d),o}catch{return}}async parseImports(o){try{await this.ensureInitialized();let d=Gm(o),g=await this.fileReader.readFile(d),E=this.parser.parse(g);if(!E)throw new Error(`Failed to parse Rust file: ${d}`);let R=[],G=new Set;return this.traverseTree(E.rootNode,le=>{le.type==="use_declaration"?this.extractUseDeclaration(le,R,G,g):le.type==="mod_item"?this.extractModItem(le,R,G,g,o):le.type==="extern_crate_declaration"&&this.extractExternCrate(le,R,G,g)}),R}catch(d){throw qp.fromError(d,o)}}async resolvePath(o,d){try{await this.ensureInitialized();let g=d.split("::")[0];if(new Set(["std","core","alloc","proc_macro","test","serde","tokio","async_std","futures","vm","rustpython_vm","rustpython","rustpython_parser","rustpython_compiler","num_traits","enum_dispatch","dashmap"]).has(g))return null;let R=Gm(o),G=PC.default.dirname(R);return d.startsWith("self::")||d.startsWith("super::")||d.startsWith("crate::")?await this.resolveRelativeModule(o,d):await this.resolveModDeclaration(G,d)}catch{return null}}extractUseDeclaration(o,d,g,E){let R=this.collectIdentifiers(o,E);for(let G of R){if(!G)continue;let le=G.split("::")[0];if(new Set(["std","core","alloc","proc_macro","test","serde","tokio","async_std","futures","vm","rustpython_vm","rustpython","rustpython_parser","rustpython_compiler","num_traits","enum_dispatch","dashmap"]).has(le))continue;let nt=G.toLowerCase();g.has(nt)||(g.add(nt),d.push({path:"",type:"import",line:o.startPosition.row+1,module:nt}))}}extractModItem(o,d,g,E,R){if(this.findChildByType(o,"declaration_list"))return;let le=this.findChildByType(o,"identifier");if(le){let Re=this.getNodeText(le,E);Re=Re.toLowerCase(),Re&&!g.has(Re)&&(g.add(Re),d.push({path:"",type:"import",line:o.startPosition.row+1,module:Re}))}}extractExternCrate(o,d,g,E){let R=this.findChildByType(o,"identifier");if(R){let G=this.getNodeText(R,E);if(!G||new Set(["std","core","alloc","proc_macro","test","serde","tokio","async_std","futures","vm","rustpython_vm","rustpython","rustpython_parser","rustpython_compiler","num_traits","enum_dispatch","dashmap"]).has(G))return;let Re=G.toLowerCase();g.has(Re)||(g.add(Re),d.push({path:"",type:"import",line:o.startPosition.row+1,module:Re}))}}collectIdentifiers(o,d){let g=[],E=this.findAllByType(o,"scoped_identifier");for(let G of E){let le=this.getNodeText(G,d);le&&g.push(le)}let R=this.findAllByType(o,"identifier");for(let G of R){let le=this.getNodeText(G,d);if(!le||le==="self"||le==="super"||le==="crate")continue;let Re=le.charAt(0);Re===Re.toUpperCase()&&Re!==Re.toLowerCase()||g.push(le)}return g}async resolveRelativeModule(o,d){let g=PC.default.dirname(o);if(d.startsWith("crate::")){let E=d.slice(7).replaceAll("::","/");return await this.resolveModDeclaration(this.rootDir,E)}if(d.startsWith("super::")){let E=PC.default.dirname(g),R=d.slice(7).replaceAll("::","/");return await this.resolveModDeclaration(E,R)}if(d.startsWith("self::")){let E=d.slice(6).replaceAll("::","/");return await this.resolveModDeclaration(g,E)}return null}async resolveModDeclaration(o,d){if(d!==d.toLowerCase())return null;let g=d.replaceAll("::","/");g=g.toLowerCase();let E=[PC.default.join(o,g+".rs"),PC.default.join(o,g,"mod.rs")];for(let R of E)if(await this.fileExists(R))return il(R);return null}async fileExists(o){try{return await $De.default.access(o),!0}catch{return!1}}traverseTree(o,d){d(o);for(let g of o.children)this.traverseTree(g,d)}findChildByType(o,d){for(let g of o.children)if(g.type===d)return g;return null}findAllByType(o,d){let g=[],E=R=>{R.type===d&&g.push(R);for(let G of R.children)E(G)};return E(o),g}getNodeText(o,d){return d.slice(o.startIndex,o.endIndex)}};var XXe=wf(require("node:fs/promises")),Coe=wf(require("node:path"));var Poe=class{parser=null;fileReader;initPromise=null;extensionPath;constructor(o,d){this.extensionPath=d??o,this.fileReader=new F_}async ensureInitialized(){if(!this.parser){if(this.initPromise)return this.initPromise;this.initPromise=(async()=>{let o=await this.resolveExtensionPath();if(!o)throw new Error("Extension path required for WASM parser initialization. Ensure RustSymbolAnalyzer is constructed with extensionPath parameter.");try{let d=Ly.getInstance(),g=Coe.default.join(o,"dist","wasm","tree-sitter.wasm");await d.init(g);let E=Coe.default.join(o,"dist","wasm","tree-sitter-rust.wasm");this.parser=await d.getParser("rust",E)}catch(d){this.initPromise=null;let g=d instanceof Error?d.message:String(d);throw new Error(`Failed to initialize Rust WASM parser for symbol analysis: ${g}`,{cause:d})}})(),await this.initPromise}}async resolveExtensionPath(){if(this.extensionPath)return this.extensionPath;let o=process.cwd(),d=Coe.default.join(o,"dist","wasm","tree-sitter.wasm");try{return await XXe.default.access(d),o}catch{return}}async analyzeFile(o){try{await this.ensureInitialized();let d=await this.fileReader.readFile(o);return this.analyzeFileFromContent(o,d)}catch(d){throw qp.fromError(d,o)}}analyzeFileFromContent(o,d){if(!this.parser)throw new Error("Parser not initialized. Call ensureInitialized() before using analyzeFileFromContent().");let g=this.parser.parse(d);if(!g)throw new Error(`Failed to parse Rust file: ${o}`);let E=new Map,R=il(o);return this.extractSymbols(g.rootNode,R,d,E),E}analyzeFileContent(o,d){if(!this.parser)throw new Error("Parser not initialized. Call ensureInitialized() before using analyzeFileContent().");let g=this.parser.parse(d);if(!g)throw new Error(`Failed to parse Rust file: ${o}`);let E=new Map,R=[],G=il(o);this.extractSymbols(g.rootNode,G,d,E);let le=this.buildImportMap(g.rootNode,d);return this.extractDependencies(g.rootNode,G,d,R,E,void 0,le),{symbols:Array.from(E.values()),dependencies:R}}async getSymbolDependencies(o){try{await this.ensureInitialized();let d=await this.fileReader.readFile(o);return this.analyzeFileContent(o,d).dependencies}catch(d){throw qp.fromError(d,o)}}extractSymbols(o,d,g,E,R){this.tryExtractSymbolFromNode(o,d,g,E,R)||this.extractSymbolsFromChildren(o,d,g,E,R)}tryExtractSymbolFromNode(o,d,g,E,R){return o.type==="function_item"?(this.handleFunctionItem(o,d,g,E,R),!0):o.type==="struct_item"?(this.handleStructItem(o,d,g,E,R),!0):o.type==="enum_item"?(this.handleEnumItem(o,d,g,E,R),!0):o.type==="trait_item"?(this.handleTraitItem(o,d,g,E,R),!0):o.type==="impl_item"?(this.handleImplItem(o,d,g,E,R),!0):!1}handleFunctionItem(o,d,g,E,R){let G=o.childForFieldName("name");if(!G)return;let le=this.getNodeText(G,g),Re=`${d}:${le}`,nt=this.hasModifier(o,"async"),at=this.hasVisibilityModifier(o,"pub");E.set(Re,{name:le,kind:nt?"AsyncFunction":"FunctionDeclaration",line:G.startPosition.row+1,isExported:at,id:Re,parentSymbolId:R,category:"function"}),this.extractSymbolsFromChildren(o,d,g,E,Re)}handleStructItem(o,d,g,E,R){let G=o.childForFieldName("name");if(!G)return;let le=this.getNodeText(G,g),Re=`${d}:${le}`,nt=this.hasVisibilityModifier(o,"pub");E.set(Re,{name:le,kind:"StructDeclaration",line:G.startPosition.row+1,isExported:nt,id:Re,parentSymbolId:R,category:"class"}),this.extractSymbolsFromChildren(o,d,g,E,Re)}handleEnumItem(o,d,g,E,R){let G=o.childForFieldName("name");if(!G)return;let le=this.getNodeText(G,g),Re=`${d}:${le}`,nt=this.hasVisibilityModifier(o,"pub");E.set(Re,{name:le,kind:"EnumDeclaration",line:G.startPosition.row+1,isExported:nt,id:Re,parentSymbolId:R,category:"type"}),this.extractSymbolsFromChildren(o,d,g,E,Re)}handleTraitItem(o,d,g,E,R){let G=o.childForFieldName("name");if(!G)return;let le=this.getNodeText(G,g),Re=`${d}:${le}`,nt=this.hasVisibilityModifier(o,"pub");E.set(Re,{name:le,kind:"InterfaceDeclaration",line:G.startPosition.row+1,isExported:nt,id:Re,parentSymbolId:R,category:"type"}),this.extractSymbolsFromChildren(o,d,g,E,Re)}handleImplItem(o,d,g,E,R){this.extractSymbolsFromChildren(o,d,g,E,R)}extractSymbolsFromChildren(o,d,g,E,R){for(let G of o.children)this.extractSymbols(G,d,g,E,R)}buildImportMap(o,d){let g=new Map,E=R=>{if(R.type==="use_declaration"&&this.extractUseDeclarationImports(R,d,g),R.type==="mod_item"){let G=R.childForFieldName("name");if(G){let le=this.getNodeText(G,d);g.set(le,le)}}for(let G of R.children)E(G)};return E(o),g}extractUseDeclarationImports(o,d,g){this.extractFromUseLists(o,d,g),this.extractFromScopedIdentifiers(o,d,g),this.extractFromUseAsClauses(o,d,g)}extractFromUseLists(o,d,g){let E=this.findAllByType(o,"use_list");for(let R of E){let G=this.findBaseModuleForUseList(R,d);this.extractIdentifiersFromUseList(R,G,d,g)}}findBaseModuleForUseList(o,d){let g=o.parent;for(;g;){if(g.type==="scoped_use_list"){let E=this.findScopedIdentifierInChildren(g,d);if(E)return E}g=g.parent}return""}findScopedIdentifierInChildren(o,d){for(let g of o.children)if(g.type==="scoped_identifier")return this.getNodeText(g,d);return""}extractIdentifiersFromUseList(o,d,g,E){for(let R of o.children)if(R.type==="identifier"){let G=this.getNodeText(R,g);E.set(G,d)}}extractFromScopedIdentifiers(o,d,g){let E=this.findAllByType(o,"scoped_identifier");for(let R of E){if(this.hasAncestorOfType(R,"use_list"))continue;let G=this.getNodeText(R,d),{localName:le,modulePath:Re}=this.splitModulePath(G);g.set(le,Re)}}splitModulePath(o){let d=o.split("::"),g=d.at(-1),E=d.slice(0,-1).join("::");return{localName:g,modulePath:E}}extractFromUseAsClauses(o,d,g){let E=this.findAllByType(o,"use_as_clause");for(let R of E){let G=R.childForFieldName("path"),le=R.childForFieldName("alias");if(G&&le){let Re=this.getNodeText(G,d),nt=this.getNodeText(le,d);g.set(nt,Re)}}}extractDependencies(o,d,g,E,R,G,le){let Re=this.getScopeForNode(o,d,g,G);this.addCallDependencyIfAny(o,d,g,E,R,Re,le);for(let nt of o.children)this.extractDependencies(nt,d,g,E,R,Re,le)}getScopeForNode(o,d,g,E){if(o.type!=="function_item")return E;let R=o.childForFieldName("name");if(!R)return E;let G=this.getNodeText(R,g);return`${d}:${G}`}addCallDependencyIfAny(o,d,g,E,R,G,le){if(o.type!=="call_expression")return;let Re=o.childForFieldName("function");if(!Re||!G)return;let{moduleName:nt,symbolName:at}=this.extractModuleAndSymbolName(Re,g),dt=`${d}:${at}`;if(R.has(dt)){E.push({sourceSymbolId:G,targetSymbolId:dt,targetFilePath:d,isTypeOnly:!1});return}if(nt&&le?.has(nt)){let xe=le.get(nt);E.push({sourceSymbolId:G,targetSymbolId:`${xe}:${at}`,targetFilePath:xe,isTypeOnly:!1});return}if(le?.has(at)){let xe=le.get(at);E.push({sourceSymbolId:G,targetSymbolId:`${xe}:${at}`,targetFilePath:xe,isTypeOnly:!1})}}extractModuleAndSymbolName(o,d){if(o.type==="field_expression"){let g=o.childForFieldName("field");if(g)return{moduleName:void 0,symbolName:this.getNodeText(g,d)}}if(o.type==="scoped_identifier"){let E=this.getNodeText(o,d).split("::");if(E.length>=2){let R=E.at(-1);return{moduleName:E.slice(0,-1).join("::"),symbolName:R}}return{moduleName:void 0,symbolName:E[0]}}return{moduleName:void 0,symbolName:this.getNodeText(o,d)}}hasVisibilityModifier(o,d){if(o.childForFieldName("visibility_modifier"))return!0;for(let E of o.children)if(E.type==="visibility_modifier")return!0;return!1}hasAncestorOfType(o,d){let g=o.parent;for(;g;){if(g.type===d)return!0;g=g.parent}return!1}hasModifier(o,d){for(let g of o.children)if(g.type===d)return!0;return!1}findAllByType(o,d){let g=[],E=R=>{R.type===d&&g.push(R);for(let G of R.children)E(G)};return E(o),g}getNodeText(o,d){return d.slice(o.startIndex,o.endIndex)}};var Noe=class h{static typeScriptParsers=new Map;static typeScriptSymbolAnalyzers=new Map;static pythonParsers=new Map;static pythonSymbolAnalyzers=new Map;static rustParsers=new Map;static rustSymbolAnalyzers=new Map;static csharpParsers=new Map;static goParsers=new Map;static javaParsers=new Map;rootDir;extensionPath;constructor(o,d,g){this.rootDir=o,this.extensionPath=g}getAnalyzer(o){let d=Gm(o);return h.getAnalyzer(d,this.rootDir,this.extensionPath)}getSymbolAnalyzer(o){let d=Gm(o);return h.getSymbolAnalyzer(d,this.rootDir,this.extensionPath)}static detectLanguage(o){let d=Gm(o);switch($Xe.default.extname(d).toLowerCase()){case".ts":case".tsx":case".js":case".jsx":case".mjs":case".cjs":case".vue":case".svelte":case".gql":case".graphql":return"typescript";case".py":case".pyi":return"python";case".rs":case".toml":return"rust";case".cs":case".csproj":return"csharp";case".go":return"go";case".java":return"java";default:return"unknown"}}static getAnalyzer(o,d,g){let E=Gm(o);switch(this.detectLanguage(E)){case"typescript":{let G=this.buildCacheKey(d),le=this.typeScriptParsers.get(G);if(le)return le;let Re=new WZ(d);return this.typeScriptParsers.set(G,Re),Re}case"python":{let G=this.buildCacheKey(d,g),le=this.pythonParsers.get(G);if(le)return le;let Re=new xoe(d,g);return this.pythonParsers.set(G,Re),Re}case"rust":{let G=this.buildCacheKey(d,g),le=this.rustParsers.get(G);if(le)return le;let Re=new Ioe(d,g);return this.rustParsers.set(G,Re),Re}case"csharp":{let G=this.buildCacheKey(d,g),le=this.csharpParsers.get(G);if(le)return le;let Re=new boe(d,g);return this.csharpParsers.set(G,Re),Re}case"go":{let G=this.buildCacheKey(d,g),le=this.goParsers.get(G);if(le)return le;let Re=new Toe(d,g);return this.goParsers.set(G,Re),Re}case"java":{let G=this.buildCacheKey(d,g),le=this.javaParsers.get(G);if(le)return le;let Re=new Eoe(d,g);return this.javaParsers.set(G,Re),Re}default:throw new Error(`Unsupported language for file: ${o}`)}}static getSymbolAnalyzer(o,d,g){let E=Gm(o);switch(this.detectLanguage(E)){case"typescript":{let G=this.buildCacheKey(d),le=this.typeScriptSymbolAnalyzers.get(G);if(le)return le;let Re=new voe(d);return this.typeScriptSymbolAnalyzers.set(G,Re),Re}case"python":{let G=this.buildCacheKey(d,g),le=this.pythonSymbolAnalyzers.get(G);if(le)return le;let Re=new Doe(d,g);return this.pythonSymbolAnalyzers.set(G,Re),Re}case"rust":{let G=this.buildCacheKey(d,g),le=this.rustSymbolAnalyzers.get(G);if(le)return le;let Re=new Poe(d,g);return this.rustSymbolAnalyzers.set(G,Re),Re}default:throw new Error(`Unsupported language for file: ${o}`)}}static isSupported(o){return this.detectLanguage(o)!=="unknown"}static reset(){this.typeScriptParsers.clear(),this.typeScriptSymbolAnalyzers.clear(),this.pythonParsers.clear(),this.pythonSymbolAnalyzers.clear(),this.rustParsers.clear(),this.rustSymbolAnalyzers.clear(),this.csharpParsers.clear(),this.goParsers.clear(),this.javaParsers.clear()}static buildCacheKey(...o){return o.map(d=>d??"").join("\0")}};var j2t=new Set(vUe.filter(h=>h!=="node_modules"));function YXe(h){return OZ.some(o=>h.endsWith(o))}function QXe(h,o){return o&&h==="node_modules"||j2t.has(h)?!0:h.startsWith(".")}var U2t=new k8("IndexerWorker"),xw=!1;function p9(h){f9.parentPort?.postMessage(h)}async function*YDe(h,o){if(xw)return;let d;try{d=await Roe.readdir(h,{withFileTypes:!0})}catch(g){g.code!=="ENOENT"&&g.code!=="EACCES"&&U2t.error("Error reading directory in IndexerWorker",h,g);return}for(let g of d){if(xw)return;let E=ZXe.join(h,g.name);g.isDirectory()?QXe(g.name,o)||(yield*YDe(E,o)):g.isFile()&&YXe(g.name)&&(yield E)}}async function H2t(h,o){let d=0;for await(let g of YDe(h,o)){if(xw)break;d++}return d}async function K2t(h,o){try{let d=await Roe.stat(h),g=o.getAnalyzer(h),E=await g.parseImports(h),R=[];for(let G of E){let le=await g.resolvePath(h,G.module);le&&R.push({path:le,type:G.type,line:G.line,module:G.module})}return{filePath:h,dependencies:R,mtime:d.mtimeMs,size:d.size}}catch{return null}}async function J2t(h){let o=Date.now(),d=h.progressInterval??100;try{let g=new Noe(h.rootDir,h.tsConfigPath,h.extensionPath);p9({type:"counting"});let E=await H2t(h.rootDir,h.excludeNodeModules??!0);if(xw){p9({type:"complete",data:{duration:Date.now()-o,indexData:[]}});return}let R=[],G=0;for await(let Re of YDe(h.rootDir,h.excludeNodeModules??!0)){if(xw)break;let nt=await K2t(Re,g);nt&&R.push(nt),G++,(G%d===0||G===E)&&p9({type:"progress",data:{processed:G,total:E,currentFile:Re}})}let le=Date.now()-o;p9({type:"complete",data:{duration:le,processed:R.length,total:E,indexData:R}})}catch(g){p9({type:"error",error:g instanceof Error?g.message:"Unknown error"})}}f9.parentPort?.on("message",h=>{switch(h.type){case"start":xw=!1,J2t(f9.workerData);break;case"cancel":xw=!0;break}});
42160
+ `).length}async parseImports(o){let d=Gm(o),g=await this.fileReader.readFile(d);return this.parse(g,d).map(R=>({path:"",type:R.type,line:R.line,module:R.module}))}async resolvePath(o,d){let g=Gm(o);return this.pathResolver.resolve(g,d)}};var kd=wf(HXe());function KDe(h){switch(h){case"FunctionDeclaration":case"ArrowFunction":case"MethodDeclaration":case"GetAccessor":case"SetAccessor":return"function";case"ClassDeclaration":return"class";case"InterfaceDeclaration":return"interface";case"TypeAliasDeclaration":return"type";case"VariableDeclaration":case"PropertyDeclaration":case"EnumDeclaration":return"variable";default:return"other"}}var KXe=w8("SymbolAnalyzer"),voe=class{project;maxFiles;fileCount=0;fileReader;constructor(o,d={}){this.maxFiles=d.maxFiles??100,this.project=this.createProject(),this.fileReader=new F_}createProject(){return new kd.Project({skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0,compilerOptions:{target:99,module:99}})}maybeResetProject(){this.fileCount>=this.maxFiles&&(KXe.debug(`Resetting ts-morph project (${this.fileCount} files in memory)`),this.project=this.createProject(),this.fileCount=0)}getFileCount(){return this.fileCount}reset(){KXe.debug("Forcing ts-morph project reset"),this.project=this.createProject(),this.fileCount=0}analyzeFileContent(o,d){this.maybeResetProject();let g=this.getOrCreateSourceFile(o,d),E=[],R=[],G=this.extractExportedSymbols(g,o,E);return this.extractNonExportedSymbols(g,o,G,E),this.buildDependencies(g,R),{symbols:E,dependencies:R}}getOrCreateSourceFile(o,d){let g=this.project.getSourceFile(o);return g?g.replaceWithText(d):(g=this.project.createSourceFile(o,d),this.fileCount++),g}extractExportedSymbols(o,d,g){let E=o.getExportedDeclarations(),R=new Set(E.keys());for(let[G,le]of E){let Re=le[0];Re&&(this.addSymbol(g,G,Re.getKindName(),Re.getStartLineNumber(),d,!0),Re.getKindName()==="ClassDeclaration"&&kd.Node.isClassDeclaration(Re)&&this.extractClassMembers(Re,d,g))}return R}extractNonExportedSymbols(o,d,g,E){let R=o.getStatements();for(let G of R)kd.Node.isVariableStatement(G)?this.extractVariableDeclarations(G,d,g,E):this.extractOtherDeclarations(G,d,g,E)}extractVariableDeclarations(o,d,g,E){let R=o.getDeclarations();for(let G of R){let le=G.getName();g.has(le)||this.addSymbol(E,le,"VariableDeclaration",G.getStartLineNumber(),d,!1)}}extractOtherDeclarations(o,d,g,E){let R=this.getDeclarationInfo(o);!R||g.has(R.name)||(this.addSymbol(E,R.name,R.kind,o.getStartLineNumber(),d,!1),R.isClass&&kd.Node.isClassDeclaration(o)&&this.extractClassMembers(o,d,E))}getDeclarationInfo(o){if(kd.Node.isClassDeclaration(o)){let d=o.getName();if(d)return{name:d,kind:"ClassDeclaration",isClass:!0}}else if(kd.Node.isFunctionDeclaration(o)){let d=o.getName();if(d)return{name:d,kind:"FunctionDeclaration",isClass:!1}}else{if(kd.Node.isInterfaceDeclaration(o))return{name:o.getName(),kind:"InterfaceDeclaration",isClass:!1};if(kd.Node.isTypeAliasDeclaration(o))return{name:o.getName(),kind:"TypeAliasDeclaration",isClass:!1};if(kd.Node.isEnumDeclaration(o))return{name:o.getName(),kind:"EnumDeclaration",isClass:!1}}return null}addSymbol(o,d,g,E,R,G){o.push({name:d,kind:g,line:E,isExported:G,id:`${R}:${d}`,category:KDe(g)})}buildDependencies(o,d){let g=this.buildImportMap(o),E=this.findSymbolUsage(o,g);for(let[R,G]of Object.entries(E))for(let le of G)d.push({sourceSymbolId:R,targetSymbolId:le.symbolId,targetFilePath:le.filePath,isTypeOnly:le.isTypeOnly})}getInternalExportDependencyGraph(o,d){this.maybeResetProject();let E=this.getOrCreateSourceFile(o,d).getExportedDeclarations(),R=new Set(E.keys()),G=new Map;for(let[le,Re]of E){let nt=`${o}:${le}`,at=this.getOrCreateDependencySet(G,nt);this.collectExportDependencies(Re,le,R,o,at)}return G}getOrCreateDependencySet(o,d){let g=o.get(d);return g||(g=new Set,o.set(d,g)),g}collectExportDependencies(o,d,g,E,R){for(let G of o){let le=G.getDescendantsOfKind(kd.SyntaxKind.Identifier);for(let Re of le){let nt=Re.getText();this.isValidDependency(nt,d,g)&&R.add(`${E}:${nt}`)}}}isValidDependency(o,d,g){return g.has(o)&&o!==d}buildImportMap(o){let d=new Map,g=o.getImportDeclarations();for(let E of g){let R=E.getModuleSpecifierValue(),G=E.isTypeOnly(),le=E.getDefaultImport();if(le){let at=le.getText();d.set(at,{originalName:"default",modulePath:R,isType:G})}let Re=E.getNamedImports();for(let at of Re){let dt=at.getNameNode().getText(),xe=at.getAliasNode(),gn=xe?xe.getText():dt;d.set(gn,{originalName:dt,modulePath:R,isType:G||at.isTypeOnly()})}let nt=E.getNamespaceImport();if(nt){let at=nt.getText();d.set(at,{originalName:"*",modulePath:R,isType:G})}}return d}extractIntraFileCalls(o,d){let g=[],E=d.getFilePath(),R=this.collectFunctionNames(d),G=o.getDescendantsOfKind(kd.SyntaxKind.CallExpression);for(let le of G)this.processCallExpression(le,R,E,g);return g}collectFunctionNames(o){let d=new Set;for(let g of o.getFunctions()){let E=g.getName();E&&d.add(E)}for(let g of o.getClasses())for(let E of g.getMethods()){let R=E.getName();R&&d.add(R)}return d}processCallExpression(o,d,g,E){if(!kd.Node.isCallExpression(o))return;let R=o.getExpression();if(kd.Node.isIdentifier(R)){this.addDirectFunctionCall(R,d,g,E);return}kd.Node.isPropertyAccessExpression(R)&&this.addPropertyAccessCall(R,d,g,E)}addDirectFunctionCall(o,d,g,E){let R=o.getText();d.has(R)&&E.push({symbolId:`${g}:${R}`,filePath:g,isTypeOnly:!1})}addPropertyAccessCall(o,d,g,E){if(kd.Node.isPropertyAccessExpression(o)){let R=o.getName();d.has(R)&&E.push({symbolId:`${g}:${R}`,filePath:g,isTypeOnly:!1})}}findSymbolUsage(o,d){let g={},E=o.getFilePath(),R=[...o.getFunctions(),...o.getClasses(),...o.getVariableDeclarations()];for(let Re of R){let nt=Re.getName();if(!nt)continue;let at=`${E}:${nt}`,dt=this.extractSymbolDependencies(Re,d),xe=this.extractIntraFileCalls(Re,o);dt.push(...xe),g[at]=dt}let G=o.getStatements(),le=[];for(let Re of G){if(kd.Node.isFunctionDeclaration(Re)||kd.Node.isClassDeclaration(Re)||kd.Node.isVariableStatement(Re)||kd.Node.isInterfaceDeclaration(Re)||kd.Node.isTypeAliasDeclaration(Re)||kd.Node.isEnumDeclaration(Re)||kd.Node.isImportDeclaration(Re))continue;let nt=this.extractSymbolDependencies(Re,d);le.push(...nt)}if(le.length>0){let Re=`${E}:(file)`;g[Re]=le}return g}extractSymbolDependencies(o,d){let g=[];return this.extractStaticImportDependencies(o,d,g),this.extractDynamicImportDependencies(o,g),g}extractStaticImportDependencies(o,d,g){let E=o.getDescendantsOfKind(kd.SyntaxKind.Identifier);for(let R of E){let G=d.get(R.getText());if(!G)continue;let le=this.buildTargetSymbolId(G);g.some(Re=>Re.symbolId===le)||g.push({symbolId:le,filePath:G.modulePath,isTypeOnly:G.isType})}}extractDynamicImportDependencies(o,d){let g=o.getDescendantsOfKind(kd.SyntaxKind.CallExpression);for(let E of g){let R=this.extractDynamicImportPath(E);if(!R)continue;let G=`${R}:default`;d.some(le=>le.symbolId===G)||d.push({symbolId:G,filePath:R,isTypeOnly:!1})}}extractDynamicImportPath(o){if(!kd.Node.isCallExpression(o)||o.getExpression().getKind()!==kd.SyntaxKind.ImportKeyword)return null;let g=o.getArguments();if(g.length===0)return null;let E=g[0];return kd.Node.isStringLiteral(E)?E.getLiteralValue():null}buildTargetSymbolId(o){return o.originalName==="default"?`${o.modulePath}:default`:`${o.modulePath}:${o.originalName}`}extractClassMembers(o,d,g){let E=o.getName();if(!E)return;let R=`${d}:${E}`,G=o.getMembers();for(let le of G){let Re=le.getKindName();if(!kd.Node.isMethodDeclaration(le)&&!kd.Node.isPropertyDeclaration(le)&&!kd.Node.isGetAccessorDeclaration(le)&&!kd.Node.isSetAccessorDeclaration(le))continue;let nt=le.getName();if(!nt)continue;let at=le.isStatic()??!1,dt=`${E}.${nt}`,xe=at?`Static${Re}`:Re;g.push({name:dt,kind:xe,line:le.getStartLineNumber(),isExported:!1,id:`${d}:${dt}`,parentSymbolId:R,category:KDe(Re)})}}getExportedSymbols(o,d){let g=this.project.getSourceFile(o);g?g.replaceWithText(d):g=this.project.createSourceFile(o,d);let E=[],R=g.getExportedDeclarations();for(let[G,le]of R){let Re=le[0];if(!Re)continue;let nt=Re.getKindName();E.push({name:G,kind:nt,line:Re.getStartLineNumber(),isExported:!0,id:`${o}:${G}`,category:KDe(nt)})}return E}filterRuntimeSymbols(o){let d=new Set(["InterfaceDeclaration","TypeAliasDeclaration","TypeParameter"]);return o.filter(g=>!d.has(g.kind))}async analyzeFile(o){let d=await this.fileReader.readFile(o),g=this.analyzeFileContent(o,d),E=new Map;for(let R of g.symbols)E.set(R.id,R);return E}async getSymbolDependencies(o){let d=await this.fileReader.readFile(o);return this.analyzeFileContent(o,d).dependencies}};var JDe=wf(require("node:fs/promises")),Y1=wf(require("node:path"));var JXe=wf(require("node:fs/promises")),l6=require("web-tree-sitter"),Ly=class h{static instance=null;initPromise=null;parsers=new Map;parserPromises=new Map;languages=new Map;initialized=!1;textEncoder=new TextEncoder;constructor(){}static getInstance(){return h.instance??=new h,h.instance}async init(o){this.initialized||(this.initPromise??=(async()=>{try{await l6.Parser.init({locateFile:()=>o}),this.initialized=!0}catch(d){this.initPromise=null;let g=d instanceof Error?d.message:String(d);throw new Error(`Failed to initialize web-tree-sitter from ${o}: ${g}. Ensure the WASM file exists and is not corrupted.`,{cause:d})}})(),await this.initPromise)}async getParser(o,d){if(!this.initialized)throw new Error("WasmParserFactory must be initialized with init() before creating parsers");let g=this.parsers.get(o);if(g!==void 0)return g;let E=this.parserPromises.get(o);if(E!==void 0)return E;let R=(async()=>{try{this.languages.has(o)||await this.loadLanguage(o,d);let G=new l6.Parser,le=this.languages.get(o);if(le==null)throw new Error(`Failed to load language WASM for: ${o}`);return G.setLanguage(le),this.parsers.set(o,G),G}finally{this.parserPromises.delete(o)}})();return this.parserPromises.set(o,R),R}async loadLanguage(o,d){try{let g;try{let E=await JXe.default.readFile(d),R=this.normalizeLegacyDylinkSection(new Uint8Array(E));g=await l6.Language.load(R)}catch(E){let R=E instanceof Error?E.message:String(E);if(R.includes("ENOENT")||R.includes("not found"))g=await l6.Language.load(d);else throw E}this.languages.set(o,g)}catch(g){let E=g instanceof Error?g.message:String(g);throw E.includes("ENOENT")||E.includes("not found")?new Error(`Language WASM file not found: ${d}. Ensure the extension is properly installed and WASM files are in the dist directory.`,{cause:g}):E.includes("magic")||E.includes("invalid")?new Error(`Failed to load language WASM from ${d}: ${E}. The WASM file may be corrupted. Try reinstalling the extension.`,{cause:g}):new Error(`Failed to load language WASM from ${d}: ${E}`,{cause:g})}}normalizeLegacyDylinkSection(o){try{if(o.length<12||o[0]!==0||o[1]!==97||o[2]!==115||o[3]!==109)return o;let d=8;if(o[d]!==0)return o;let g=this.readUnsignedLeb128(o,d+1),E=g.nextOffset,R=E+g.value;if(R>o.length)return o;let G=this.readUnsignedLeb128(o,E),le=G.nextOffset,Re=le+G.value;if(Re>R||Buffer.from(o.subarray(le,Re)).toString("utf8")!=="dylink")return o;let at=Re,dt=this.readUnsignedLeb128(o,at);at=dt.nextOffset;let xe=this.readUnsignedLeb128(o,at);at=xe.nextOffset;let gn=this.readUnsignedLeb128(o,at);at=gn.nextOffset;let pt=this.readUnsignedLeb128(o,at);at=pt.nextOffset;let ut=this.readUnsignedLeb128(o,at);at=ut.nextOffset;let yi=[];for(let Fr=0;Fr<ut.value;Fr++){let bi=this.readUnsignedLeb128(o,at);at=bi.nextOffset;let fd=at+bi.value;if(fd>R)return o;yi.push(o.subarray(at,fd)),at=fd}let wi=this.concatUint8Arrays(this.encodeUnsignedLeb128(dt.value),this.encodeUnsignedLeb128(xe.value),this.encodeUnsignedLeb128(gn.value),this.encodeUnsignedLeb128(pt.value)),eo=this.concatUint8Arrays(this.encodeUnsignedLeb128(yi.length),...yi.flatMap(Fr=>[this.encodeUnsignedLeb128(Fr.length),Fr])),qa=1,bl=2,Sa=this.concatUint8Arrays(Uint8Array.of(qa),this.encodeUnsignedLeb128(wi.length),wi),Lr=this.concatUint8Arrays(Uint8Array.of(bl),this.encodeUnsignedLeb128(eo.length),eo),In=this.textEncoder.encode("dylink.0"),Ii=this.concatUint8Arrays(this.encodeUnsignedLeb128(In.length),In,Sa,Lr),_i=this.concatUint8Arrays(Uint8Array.of(0),this.encodeUnsignedLeb128(Ii.length),Ii);return this.concatUint8Arrays(o.subarray(0,8),_i,o.subarray(R))}catch{return o}}readUnsignedLeb128(o,d){let g=0,E=0,R=d;for(;R<o.length;){let G=o[R];if(g|=(G&127)<<E,R++,(G&128)===0)return{value:g,nextOffset:R};if(E+=7,E>35)throw new Error("Invalid LEB128 value")}throw new Error("Unexpected EOF while reading LEB128")}encodeUnsignedLeb128(o){let d=[],g=o>>>0;do{let E=g&127;g>>>=7,g!==0&&(E|=128),d.push(E)}while(g!==0);return Uint8Array.from(d)}concatUint8Arrays(...o){let d=o.reduce((R,G)=>R+G.length,0),g=new Uint8Array(d),E=0;for(let R of o)g.set(R,E),E+=R.length;return g}isInitialized(){return this.initialized}reset(){this.parsers.clear(),this.parserPromises.clear(),this.languages.clear(),this.initialized=!1,this.initPromise=null}};var boe=class h{parser=null;fileReader;rootDir;extensionPath;initPromise=null;constructor(o,d){this.fileReader=new F_,this.rootDir=o??process.cwd(),this.extensionPath=d}async ensureInitialized(){if(!this.parser)return this.initPromise!==null?this.initPromise:(this.initPromise=(async()=>{let o=this.extensionPath;if(!o)throw new Error("Extension path required for WASM parser initialization. Ensure CSharpParser is constructed with extensionPath parameter.");try{let d=Ly.getInstance(),g=Y1.default.join(o,"dist","wasm","tree-sitter.wasm");await d.init(g);let E=Y1.default.join(o,"dist","wasm","tree-sitter-c_sharp.wasm");this.parser=await d.getParser("c_sharp",E)}catch(d){this.initPromise=null;let g=d instanceof Error?d.message:String(d);throw new Error(`Failed to initialize C# WASM parser: ${g}`,{cause:d})}})(),this.initPromise)}async parseImports(o){let d=Gm(o),g;try{g=await this.fileReader.readFile(d)}catch(G){throw qp.fromError(G,d)}if(await this.ensureInitialized(),!this.parser)return[];let E=this.parser.parse(g);if(!E)return[];let R=[];return this.extractUsings(E.rootNode,d,R),R}extractUsings(o,d,g){if(o.type==="using_directive"){let E=o.children.find(R=>R.type==="identifier"||R.type==="qualified_name"||R.type==="member_access_expression");if(E){let R=E.text.trim();R&&g.push({path:il(d),type:"import",line:E.startPosition.row+1,module:R})}}for(let E of o.children)this.extractUsings(E,d,g)}async resolvePath(o,d){if(this.isFrameworkNamespace(d))return null;let g=d.split(".");return g.length<2||g.some(h.isUnsafeSegment)?null:this.resolveNamespace(g)}async resolveNamespace(o){try{return await this.resolveViaSuffix(o)??await this.resolveViaLastSegment(o)}catch{return null}}static isUnsafeSegment(o){return o===""||o===".."||o.includes("/")}async resolveViaSuffix(o){for(let d=o.length-1;d>=1;d--){let g=Y1.default.resolve(this.rootDir,o.slice(d).join(Y1.default.sep));if(!this.isWithinRoot(g))continue;let E=await this.findFirstCsFile(g);if(E)return il(E)}return null}async resolveViaLastSegment(o){let d=o.at(-1)??"";if(!d)return null;let g=await this.findDirectory(this.rootDir,d,3);if(!g||!this.isWithinRoot(g))return null;let E=await this.findFirstCsFile(g);return E?il(E):null}isWithinRoot(o){let d=il(Y1.default.resolve(o)),g=il(Y1.default.resolve(this.rootDir));return d===g||d.startsWith(g+"/")}isFrameworkNamespace(o){return["System","Microsoft","Newtonsoft","NUnit","Xunit","MSTest","AutoMapper","FluentValidation","MediatR","Serilog"].some(g=>o===g||o.startsWith(g+"."))}async findFirstCsFile(o){try{let g=(await JDe.default.readdir(o,{withFileTypes:!0})).filter(E=>E.isFile()&&E.name.endsWith(".cs")).sort((E,R)=>E.name.localeCompare(R.name));return g.length>0?Y1.default.join(o,g[0].name):null}catch{return null}}async findDirectory(o,d,g){if(g<=0)return null;try{let R=(await JDe.default.readdir(o,{withFileTypes:!0})).filter(h.isTraversableDir);for(let G of R){if(G.name===d)return Y1.default.join(o,G.name);let le=await this.findDirectory(Y1.default.join(o,G.name),d,g-1);if(le)return le}}catch{}return null}static isTraversableDir(o){return o.isDirectory()&&!o.name.startsWith(".")&&o.name!=="node_modules"}};var Soe=wf(require("node:fs/promises")),r0=wf(require("node:path"));var Toe=class h{parser=null;fileReader;rootDir;extensionPath;initPromise=null;constructor(o,d){this.fileReader=new F_,this.rootDir=o??process.cwd(),this.extensionPath=d}async ensureInitialized(){if(!this.parser)return this.initPromise!==null?this.initPromise:(this.initPromise=(async()=>{let o=this.extensionPath;if(!o)throw new Error("Extension path required for WASM parser initialization. Ensure GoParser is constructed with extensionPath parameter.");try{let d=Ly.getInstance(),g=r0.default.join(o,"dist","wasm","tree-sitter.wasm");await d.init(g);let E=r0.default.join(o,"dist","wasm","tree-sitter-go.wasm");this.parser=await d.getParser("go",E)}catch(d){this.initPromise=null;let g=d instanceof Error?d.message:String(d);throw new Error(`Failed to initialize Go WASM parser: ${g}`,{cause:d})}})(),this.initPromise)}async parseImports(o){let d=Gm(o),g;try{g=await this.fileReader.readFile(d)}catch(G){throw qp.fromError(G,d)}if(await this.ensureInitialized(),!this.parser)return[];let E=this.parser.parse(g);if(!E)return[];let R=[];return this.extractImports(E.rootNode,d,R),R}extractImports(o,d,g){if(o.type==="import_spec"){let E=o.children.find(R=>R.type==="interpreted_string_literal"||R.type==="raw_string_literal");if(E){let R=E.text.replaceAll(/^["`]|["`]$/g,"").trim();R&&g.push({path:il(d),type:"import",line:E.startPosition.row+1,module:R})}}for(let E of o.children)this.extractImports(E,d,g)}async resolvePath(o,d){if(this.isGoStdlibImport(d))return null;let g=d.split("/");return g.some(h.isUnsafePart)?null:this.resolveGoImport(Gm(o),d,g)}async resolveGoImport(o,d,g){try{let E=await this.resolveViaGoMod(o,d)??await this.resolveViaLastSegment(g);return E?il(E):null}catch{return null}}static isUnsafePart(o){return o===".."||o===""}async resolveViaGoMod(o,d){let g=await this.findGoModuleInfo(r0.default.dirname(o));if(!g||!d.startsWith(g.moduleName+"/"))return null;let R=d.slice(g.moduleName.length+1).split("/");if(R.some(h.isUnsafePart))return null;let G=r0.default.resolve(g.moduleDir,...R);return this.isWithinRoot(G)?this.findFirstGoFile(G):null}async resolveViaLastSegment(o){let d=o.at(-1)??"";if(!d)return null;let g=await this.findDirectory(this.rootDir,d,3);return!g||!this.isWithinRoot(g)?null:this.findFirstGoFile(g)}isWithinRoot(o){let d=il(r0.default.resolve(o)),g=il(r0.default.resolve(this.rootDir));return d===g||d.startsWith(g+"/")}isGoStdlibImport(o){return!(o.split("/")[0]??"").includes(".")}async findGoModuleInfo(o){let d=o,g=il(this.rootDir);for(;;){let E=await this.readGoModuleName(r0.default.join(d,"go.mod"));if(E)return{moduleDir:d,moduleName:E};let R=r0.default.dirname(d);if(R===d||!il(R).startsWith(g))break;d=R}return null}async readGoModuleName(o){try{let d=await Soe.default.readFile(o,"utf-8"),g=/^module\s+(\S+)/mu.exec(d);return g?g[1]:null}catch{return null}}async findFirstGoFile(o){try{let g=(await Soe.default.readdir(o,{withFileTypes:!0})).filter(E=>E.isFile()&&E.name.endsWith(".go")&&!E.name.endsWith("_test.go")).sort((E,R)=>E.name.localeCompare(R.name));return g.length>0?r0.default.join(o,g[0].name):null}catch{return null}}async findDirectory(o,d,g){if(g<=0)return null;try{let R=(await Soe.default.readdir(o,{withFileTypes:!0})).filter(h.isTraversableDir);for(let G of R){if(G.name===d)return r0.default.join(o,G.name);let le=await this.findDirectory(r0.default.join(o,G.name),d,g-1);if(le)return le}}catch{}return null}static isTraversableDir(o){return o.isDirectory()&&!o.name.startsWith(".")&&o.name!=="node_modules"}};var qDe=wf(require("node:fs/promises")),CC=wf(require("node:path"));var Eoe=class{parser=null;fileReader;rootDir;extensionPath;initPromise=null;constructor(o,d){this.fileReader=new F_,this.rootDir=o??process.cwd(),this.extensionPath=d}async ensureInitialized(){if(!this.parser)return this.initPromise!==null?this.initPromise:(this.initPromise=(async()=>{let o=this.extensionPath;if(!o)throw new Error("Extension path required for WASM parser initialization. Ensure JavaParser is constructed with extensionPath parameter.");try{let d=Ly.getInstance(),g=CC.default.join(o,"dist","wasm","tree-sitter.wasm");await d.init(g);let E=CC.default.join(o,"dist","wasm","tree-sitter-java.wasm");this.parser=await d.getParser("java",E)}catch(d){this.initPromise=null;let g=d instanceof Error?d.message:String(d);throw new Error(`Failed to initialize Java WASM parser: ${g}`,{cause:d})}})(),this.initPromise)}async parseImports(o){let d=Gm(o),g;try{g=await this.fileReader.readFile(d)}catch(G){throw qp.fromError(G,d)}if(await this.ensureInitialized(),!this.parser)return[];let E=this.parser.parse(g);if(!E)return[];let R=[];return this.extractImports(E.rootNode,d,R),R}extractImports(o,d,g){if(o.type==="import_declaration"){let E=o.children.find(R=>R.type==="identifier"||R.type==="scoped_identifier");if(E){let R=E.text.trim();R&&g.push({path:il(d),type:"import",line:E.startPosition.row+1,module:R})}}for(let E of o.children)this.extractImports(E,d,g)}async resolvePath(o,d){try{if(this.isJavaStdlibImport(d)||d.endsWith(".*"))return null;let g=d.split(".");if(g.some(Re=>Re===""||Re===".."||Re.includes("/")))return null;let E=g.at(-1)??"",R=g.join(CC.default.sep)+".java",G=CC.default.resolve(this.rootDir,R);if(this.isWithinRoot(G)&&await this.fileExists(G))return il(G);let le=await this.findFile(this.rootDir,E+".java",4);return le?il(le):null}catch{return null}}isWithinRoot(o){let d=il(CC.default.resolve(o)),g=il(CC.default.resolve(this.rootDir));return d===g||d.startsWith(g+"/")}isJavaStdlibImport(o){return["java.","javax.","sun.","com.sun.","org.w3c.","org.xml.","org.ietf.","org.omg.","jdk.","javafx."].some(g=>o.startsWith(g))}async findFile(o,d,g){if(g<=0)return null;try{let E=await qDe.default.readdir(o,{withFileTypes:!0});for(let R of E)if(R.isFile()&&R.name===d)return CC.default.join(o,R.name);for(let R of E)if(R.isDirectory()&&!R.name.startsWith(".")&&R.name!=="node_modules"){let G=await this.findFile(CC.default.join(o,R.name),d,g-1);if(G)return G}}catch{}return null}async fileExists(o){try{return await qDe.default.access(o),!0}catch{return!1}}};var XDe=wf(require("node:fs/promises")),wv=wf(require("node:path"));var xoe=class{parser=null;fileReader;rootDir;extensionPath;initPromise=null;constructor(o,d){this.fileReader=new F_,this.rootDir=o||process.cwd(),this.extensionPath=d}async ensureInitialized(){this.parser||(this.initPromise??=(async()=>{let o=await this.resolveExtensionPath();if(!o)throw new Error("Extension path required for WASM parser initialization. Ensure PythonParser is constructed with extensionPath parameter.");try{let d=Ly.getInstance(),g=wv.default.join(o,"dist","wasm","tree-sitter.wasm");await d.init(g);let E=wv.default.join(o,"dist","wasm","tree-sitter-python.wasm");this.parser=await d.getParser("python",E)}catch(d){this.initPromise=null;let g=d instanceof Error?d.message:String(d);throw new Error(`Failed to initialize Python WASM parser: ${g}`,{cause:d})}})(),await this.initPromise)}async resolveExtensionPath(){if(this.extensionPath)return this.extensionPath;let o=process.cwd(),d=wv.default.join(o,"dist","wasm","tree-sitter.wasm");try{return await XDe.default.access(d),o}catch{return}}async parseImports(o){try{await this.ensureInitialized();let d=Gm(o),g=await this.fileReader.readFile(d),E=this.parser?.parse(g);if(!E)throw new Error(`Failed to parse Python file: ${d}`);let R=[],G=new Set;return this.traverseTree(E.rootNode,le=>{le.type==="import_statement"?this.extractImportStatement(le,R,G,g):le.type==="import_from_statement"&&this.extractImportFromStatement(le,R,G,g)}),R}catch(d){throw qp.fromError(d,o)}}async resolvePath(o,d){try{await this.ensureInitialized();let g=Gm(o),E=wv.default.dirname(g);return d.startsWith(".")?await this.resolveRelativeImport(E,d):await this.resolveAbsoluteImport(E,d)}catch{return null}}extractImportStatement(o,d,g,E){let R=this.findChildrenByType(o,"dotted_name");for(let G of R){let le=this.getNodeText(G,E);le&&!g.has(le)&&(g.add(le),d.push({path:"",type:"import",line:G.startPosition.row+1,module:le}))}}extractImportFromStatement(o,d,g,E){let R=null,G=this.findChildByType(o,"relative_import");if(G)R=this.getNodeText(G,E);else{let le=this.findChildByType(o,"dotted_name");le&&(R=this.getNodeText(le,E))}R&&!g.has(R)&&(g.add(R),d.push({path:"",type:"import",line:o.startPosition.row+1,module:R}))}async resolveRelativeImport(o,d){let g=/^\.*/u.exec(d),E=g?g[0].length:0,R=d.slice(E).replaceAll(".","/"),G=o;for(let Re=1;Re<E;Re++)G=wv.default.dirname(G);let le=[wv.default.join(G,R+".py"),wv.default.join(G,R+".pyi"),wv.default.join(G,R,"__init__.py"),wv.default.join(G,R,"__init__.pyi")];for(let Re of le)if(await this.fileExists(Re))return il(Re);return null}async resolveAbsoluteImport(o,d){let g=d.replaceAll(".","/"),E=il(this.rootDir),R=new Set,G=async Re=>{let nt=il(Re);if(R.has(nt))return null;R.add(nt);let at=[wv.default.join(Re,g+".py"),wv.default.join(Re,g+".pyi"),wv.default.join(Re,g,"__init__.py"),wv.default.join(Re,g,"__init__.pyi")];for(let dt of at)if(await this.fileExists(dt))return il(dt);return null},le=o;for(;;){let Re=await G(le);if(Re)return Re;let nt=wv.default.dirname(le);if(nt===le)break;if(il(nt)===E){let at=await G(nt);if(at)return at;break}le=nt}if(!R.has(E)){let Re=await G(this.rootDir);if(Re)return Re}return null}async fileExists(o){try{return await XDe.default.access(o),!0}catch{return!1}}traverseTree(o,d){d(o);for(let g of o.children)this.traverseTree(g,d)}findChildrenByType(o,d){let g=[];for(let E of o.children)E.type===d&&g.push(E);return g}findChildByType(o,d){for(let g of o.children)if(g.type===d)return g;return null}getNodeText(o,d){return d.slice(o.startIndex,o.endIndex)}};var qXe=wf(require("node:fs/promises")),Aoe=wf(require("node:path"));var Doe=class{parser=null;fileReader;initPromise=null;extensionPath;constructor(o,d){this.extensionPath=d??o,this.fileReader=new F_}async ensureInitialized(){this.parser||(this.initPromise??=(async()=>{let o=await this.resolveExtensionPath();if(!o)throw new Error("Extension path required for WASM parser initialization. Ensure PythonSymbolAnalyzer is constructed with extensionPath parameter.");try{let d=Ly.getInstance(),g=Aoe.default.join(o,"dist","wasm","tree-sitter.wasm");await d.init(g);let E=Aoe.default.join(o,"dist","wasm","tree-sitter-python.wasm");this.parser=await d.getParser("python",E)}catch(d){this.initPromise=null;let g=d instanceof Error?d.message:String(d);throw new Error(`Failed to initialize Python WASM parser for symbol analysis: ${g}`,{cause:d})}})(),await this.initPromise)}async resolveExtensionPath(){if(this.extensionPath)return this.extensionPath;let o=process.cwd(),d=Aoe.default.join(o,"dist","wasm","tree-sitter.wasm");try{return await qXe.default.access(d),o}catch{return}}async analyzeFile(o){try{await this.ensureInitialized();let d=await this.fileReader.readFile(o);return this.analyzeFileFromContent(o,d)}catch(d){throw qp.fromError(d,o)}}analyzeFileFromContent(o,d){if(!this.parser)throw new Error("Parser not initialized. Call ensureInitialized() before using analyzeFileFromContent().");let g=this.parser.parse(d);if(!g)throw new Error(`Failed to parse Python file: ${o}`);let E=new Map,R=il(o);return this.extractSymbols(g.rootNode,R,d,E),E}analyzeFileContent(o,d){if(!this.parser)throw new Error("Parser not initialized. Call ensureInitialized() before using analyzeFileContent().");let g=this.parser.parse(d);if(!g)throw new Error(`Failed to parse Python file: ${o}`);let E=new Map,R=[],G=il(o);this.extractSymbols(g.rootNode,G,d,E);let le=this.buildImportMap(g.rootNode,d);return this.extractDependencies(g.rootNode,G,d,R,E,void 0,le),{symbols:Array.from(E.values()),dependencies:R}}async getSymbolDependencies(o){try{await this.ensureInitialized();let d=await this.fileReader.readFile(o);return this.analyzeFileContent(o,d).dependencies}catch(d){throw qp.fromError(d,o)}}extractSymbols(o,d,g,E,R){this.tryExtractSymbolFromNode(o,d,g,E,R)||this.extractSymbolsFromChildren(o,d,g,E,R)}tryExtractSymbolFromNode(o,d,g,E,R){return o.type==="function_definition"?(this.handleFunctionDefinition(o,d,g,E,R),!0):o.type==="class_definition"?(this.handleClassDefinition(o,d,g,E,R),!0):o.type==="decorated_definition"?(this.handleDecoratedDefinition(o,d,g,E,R),!0):!1}handleFunctionDefinition(o,d,g,E,R){let G=o.childForFieldName("name");if(!G)return;let le=this.getNodeText(G,g),Re=`${d}:${le}`,nt=this.hasChild(o,"async");E.set(Re,{name:le,kind:nt?"AsyncFunction":"FunctionDeclaration",line:G.startPosition.row+1,isExported:this.isExported(o,g),id:Re,parentSymbolId:R,category:"function"}),this.extractSymbolsFromChildren(o,d,g,E,Re)}handleClassDefinition(o,d,g,E,R){let G=o.childForFieldName("name");if(!G)return;let le=this.getNodeText(G,g),Re=`${d}:${le}`;E.set(Re,{name:le,kind:"ClassDeclaration",line:G.startPosition.row+1,isExported:this.isExported(o,g),id:Re,parentSymbolId:R,category:"class"}),this.extractSymbolsFromChildren(o,d,g,E,Re)}handleDecoratedDefinition(o,d,g,E,R){for(let G of o.children)(G.type==="function_definition"||G.type==="class_definition")&&this.extractSymbols(G,d,g,E,R)}extractSymbolsFromChildren(o,d,g,E,R){for(let G of o.children)this.extractSymbols(G,d,g,E,R)}buildImportMap(o,d){let g=new Map;return this.traverseForImports(o,g,d),g}traverseForImports(o,d,g){o.type==="import_from_statement"?this.processFromImport(o,d,g):o.type==="import_statement"&&this.processImportStatement(o,d,g);for(let E of o.children)this.traverseForImports(E,d,g)}processFromImport(o,d,g){let E=o.childForFieldName("module_name");if(!E)return;let R=this.getNodeText(E,g);for(let G of o.children)this.processFromImportChild(G,d,g,R)}processFromImportChild(o,d,g,E){if(o.type==="aliased_import"){this.addAliasedFromImport(o,d,g,E);return}if(o.type==="dotted_name"||o.type==="identifier"){let R=this.getNodeText(o,g);if(R===E||o.parent?.type==="aliased_import")return;d.set(R,E)}}addAliasedFromImport(o,d,g,E){let R=o.childForFieldName("name");if(!R)return;let G=this.getNodeText(R,g),le=o.childForFieldName("alias"),Re=le?this.getNodeText(le,g):G;d.set(Re,E)}processImportStatement(o,d,g){for(let E of o.children)this.processImportStatementChild(E,d,g)}processImportStatementChild(o,d,g){if(o.type==="aliased_import"){let E=o.childForFieldName("name");if(!E)return;let R=this.getNodeText(E,g),G=o.childForFieldName("alias"),le=G?this.getNodeText(G,g):R;d.set(le,R);return}if(o.type==="dotted_name"||o.type==="identifier"){let E=this.getNodeText(o,g);E!=="import"&&d.set(E,E)}}extractDependencies(o,d,g,E,R,G,le){let Re=this.getScopeForNode(o,d,g,G);this.addCallDependencyIfAny(o,d,g,E,R,Re,le);for(let nt of o.children)this.extractDependencies(nt,d,g,E,R,Re,le)}getScopeForNode(o,d,g,E){if(o.type!=="function_definition"&&o.type!=="class_definition")return E;let R=o.childForFieldName("name");if(!R)return E;let G=this.getNodeText(R,g);return`${d}:${G}`}addCallDependencyIfAny(o,d,g,E,R,G,le){if(o.type!=="call")return;let Re=o.childForFieldName("function");if(!Re||!G)return;let nt=this.getCalledName(Re,g),at=`${d}:${nt}`;if(R.has(at)){E.push({sourceSymbolId:G,targetSymbolId:at,targetFilePath:d,isTypeOnly:!1});return}if(le?.has(nt)){let dt=le.get(nt);if(dt===void 0)return;E.push({sourceSymbolId:G,targetSymbolId:`${dt}:${nt}`,targetFilePath:dt,isTypeOnly:!1})}}getCalledName(o,d){if(o.type!=="attribute")return this.getNodeText(o,d);let g=o.childForFieldName("attribute");return g?this.getNodeText(g,d):this.getNodeText(o,d)}isExported(o,d){let g=o.childForFieldName("name");return g?!this.getNodeText(g,d).startsWith("_"):!1}hasChild(o,d){for(let g of o.children)if(g.type===d)return!0;return!1}getNodeText(o,d){return d.slice(o.startIndex,o.endIndex)}};var $De=wf(require("node:fs/promises")),PC=wf(require("node:path"));var Ioe=class{parser=null;fileReader;rootDir;extensionPath;initPromise=null;constructor(o,d){this.fileReader=new F_,this.rootDir=o||process.cwd(),this.extensionPath=d}async ensureInitialized(){this.parser||(this.initPromise??=(async()=>{let o=await this.resolveExtensionPath();if(!o)throw new Error("Extension path required for WASM parser initialization. Ensure RustParser is constructed with extensionPath parameter.");try{let d=Ly.getInstance(),g=PC.default.join(o,"dist","wasm","tree-sitter.wasm");await d.init(g);let E=PC.default.join(o,"dist","wasm","tree-sitter-rust.wasm");this.parser=await d.getParser("rust",E)}catch(d){this.initPromise=null;let g=d instanceof Error?d.message:String(d);throw new Error(`Failed to initialize Rust WASM parser: ${g}`,{cause:d})}})(),await this.initPromise)}async resolveExtensionPath(){if(this.extensionPath)return this.extensionPath;let o=process.cwd(),d=PC.default.join(o,"dist","wasm","tree-sitter.wasm");try{return await $De.default.access(d),o}catch{return}}async parseImports(o){try{await this.ensureInitialized();let d=Gm(o),g=await this.fileReader.readFile(d),E=this.parser?.parse(g);if(!E)throw new Error(`Failed to parse Rust file: ${d}`);let R=[],G=new Set;return this.traverseTree(E.rootNode,le=>{le.type==="use_declaration"?this.extractUseDeclaration(le,R,G,g):le.type==="mod_item"?this.extractModItem(le,R,G,g,o):le.type==="extern_crate_declaration"&&this.extractExternCrate(le,R,G,g)}),R}catch(d){throw qp.fromError(d,o)}}async resolvePath(o,d){try{await this.ensureInitialized();let g=d.split("::")[0];if(new Set(["std","core","alloc","proc_macro","test","serde","tokio","async_std","futures","vm","rustpython_vm","rustpython","rustpython_parser","rustpython_compiler","num_traits","enum_dispatch","dashmap"]).has(g))return null;let R=Gm(o),G=PC.default.dirname(R);return d.startsWith("self::")||d.startsWith("super::")||d.startsWith("crate::")?await this.resolveRelativeModule(o,d):await this.resolveModDeclaration(G,d)}catch{return null}}extractUseDeclaration(o,d,g,E){let R=this.collectIdentifiers(o,E);for(let G of R){if(!G)continue;let le=G.split("::")[0];if(new Set(["std","core","alloc","proc_macro","test","serde","tokio","async_std","futures","vm","rustpython_vm","rustpython","rustpython_parser","rustpython_compiler","num_traits","enum_dispatch","dashmap"]).has(le))continue;let nt=G.toLowerCase();g.has(nt)||(g.add(nt),d.push({path:"",type:"import",line:o.startPosition.row+1,module:nt}))}}extractModItem(o,d,g,E,R){if(this.findChildByType(o,"declaration_list"))return;let le=this.findChildByType(o,"identifier");if(le){let Re=this.getNodeText(le,E);Re=Re.toLowerCase(),Re&&!g.has(Re)&&(g.add(Re),d.push({path:"",type:"import",line:o.startPosition.row+1,module:Re}))}}extractExternCrate(o,d,g,E){let R=this.findChildByType(o,"identifier");if(R){let G=this.getNodeText(R,E);if(!G||new Set(["std","core","alloc","proc_macro","test","serde","tokio","async_std","futures","vm","rustpython_vm","rustpython","rustpython_parser","rustpython_compiler","num_traits","enum_dispatch","dashmap"]).has(G))return;let Re=G.toLowerCase();g.has(Re)||(g.add(Re),d.push({path:"",type:"import",line:o.startPosition.row+1,module:Re}))}}collectIdentifiers(o,d){let g=[],E=this.findAllByType(o,"scoped_identifier");for(let G of E){let le=this.getNodeText(G,d);le&&g.push(le)}let R=this.findAllByType(o,"identifier");for(let G of R){let le=this.getNodeText(G,d);if(!le||le==="self"||le==="super"||le==="crate")continue;let Re=le.charAt(0);Re===Re.toUpperCase()&&Re!==Re.toLowerCase()||g.push(le)}return g}async resolveRelativeModule(o,d){let g=PC.default.dirname(o);if(d.startsWith("crate::")){let E=d.slice(7).replaceAll("::","/");return await this.resolveModDeclaration(this.rootDir,E)}if(d.startsWith("super::")){let E=PC.default.dirname(g),R=d.slice(7).replaceAll("::","/");return await this.resolveModDeclaration(E,R)}if(d.startsWith("self::")){let E=d.slice(6).replaceAll("::","/");return await this.resolveModDeclaration(g,E)}return null}async resolveModDeclaration(o,d){if(d!==d.toLowerCase())return null;let g=d.replaceAll("::","/");g=g.toLowerCase();let E=[PC.default.join(o,g+".rs"),PC.default.join(o,g,"mod.rs")];for(let R of E)if(await this.fileExists(R))return il(R);return null}async fileExists(o){try{return await $De.default.access(o),!0}catch{return!1}}traverseTree(o,d){d(o);for(let g of o.children)this.traverseTree(g,d)}findChildByType(o,d){for(let g of o.children)if(g.type===d)return g;return null}findAllByType(o,d){let g=[],E=R=>{R.type===d&&g.push(R);for(let G of R.children)E(G)};return E(o),g}getNodeText(o,d){return d.slice(o.startIndex,o.endIndex)}};var XXe=wf(require("node:fs/promises")),Coe=wf(require("node:path"));var Poe=class{parser=null;fileReader;initPromise=null;extensionPath;constructor(o,d){this.extensionPath=d??o,this.fileReader=new F_}async ensureInitialized(){this.parser||(this.initPromise??=(async()=>{let o=await this.resolveExtensionPath();if(!o)throw new Error("Extension path required for WASM parser initialization. Ensure RustSymbolAnalyzer is constructed with extensionPath parameter.");try{let d=Ly.getInstance(),g=Coe.default.join(o,"dist","wasm","tree-sitter.wasm");await d.init(g);let E=Coe.default.join(o,"dist","wasm","tree-sitter-rust.wasm");this.parser=await d.getParser("rust",E)}catch(d){this.initPromise=null;let g=d instanceof Error?d.message:String(d);throw new Error(`Failed to initialize Rust WASM parser for symbol analysis: ${g}`,{cause:d})}})(),await this.initPromise)}async resolveExtensionPath(){if(this.extensionPath)return this.extensionPath;let o=process.cwd(),d=Coe.default.join(o,"dist","wasm","tree-sitter.wasm");try{return await XXe.default.access(d),o}catch{return}}async analyzeFile(o){try{await this.ensureInitialized();let d=await this.fileReader.readFile(o);return this.analyzeFileFromContent(o,d)}catch(d){throw qp.fromError(d,o)}}analyzeFileFromContent(o,d){if(!this.parser)throw new Error("Parser not initialized. Call ensureInitialized() before using analyzeFileFromContent().");let g=this.parser.parse(d);if(!g)throw new Error(`Failed to parse Rust file: ${o}`);let E=new Map,R=il(o);return this.extractSymbols(g.rootNode,R,d,E),E}analyzeFileContent(o,d){if(!this.parser)throw new Error("Parser not initialized. Call ensureInitialized() before using analyzeFileContent().");let g=this.parser.parse(d);if(!g)throw new Error(`Failed to parse Rust file: ${o}`);let E=new Map,R=[],G=il(o);this.extractSymbols(g.rootNode,G,d,E);let le=this.buildImportMap(g.rootNode,d);return this.extractDependencies(g.rootNode,G,d,R,E,void 0,le),{symbols:Array.from(E.values()),dependencies:R}}async getSymbolDependencies(o){try{await this.ensureInitialized();let d=await this.fileReader.readFile(o);return this.analyzeFileContent(o,d).dependencies}catch(d){throw qp.fromError(d,o)}}extractSymbols(o,d,g,E,R){this.tryExtractSymbolFromNode(o,d,g,E,R)||this.extractSymbolsFromChildren(o,d,g,E,R)}tryExtractSymbolFromNode(o,d,g,E,R){return o.type==="function_item"?(this.handleFunctionItem(o,d,g,E,R),!0):o.type==="struct_item"?(this.handleStructItem(o,d,g,E,R),!0):o.type==="enum_item"?(this.handleEnumItem(o,d,g,E,R),!0):o.type==="trait_item"?(this.handleTraitItem(o,d,g,E,R),!0):o.type==="impl_item"?(this.handleImplItem(o,d,g,E,R),!0):!1}handleFunctionItem(o,d,g,E,R){let G=o.childForFieldName("name");if(!G)return;let le=this.getNodeText(G,g),Re=`${d}:${le}`,nt=this.hasModifier(o,"async"),at=this.hasVisibilityModifier(o,"pub");E.set(Re,{name:le,kind:nt?"AsyncFunction":"FunctionDeclaration",line:G.startPosition.row+1,isExported:at,id:Re,parentSymbolId:R,category:"function"}),this.extractSymbolsFromChildren(o,d,g,E,Re)}handleStructItem(o,d,g,E,R){let G=o.childForFieldName("name");if(!G)return;let le=this.getNodeText(G,g),Re=`${d}:${le}`,nt=this.hasVisibilityModifier(o,"pub");E.set(Re,{name:le,kind:"StructDeclaration",line:G.startPosition.row+1,isExported:nt,id:Re,parentSymbolId:R,category:"class"}),this.extractSymbolsFromChildren(o,d,g,E,Re)}handleEnumItem(o,d,g,E,R){let G=o.childForFieldName("name");if(!G)return;let le=this.getNodeText(G,g),Re=`${d}:${le}`,nt=this.hasVisibilityModifier(o,"pub");E.set(Re,{name:le,kind:"EnumDeclaration",line:G.startPosition.row+1,isExported:nt,id:Re,parentSymbolId:R,category:"type"}),this.extractSymbolsFromChildren(o,d,g,E,Re)}handleTraitItem(o,d,g,E,R){let G=o.childForFieldName("name");if(!G)return;let le=this.getNodeText(G,g),Re=`${d}:${le}`,nt=this.hasVisibilityModifier(o,"pub");E.set(Re,{name:le,kind:"InterfaceDeclaration",line:G.startPosition.row+1,isExported:nt,id:Re,parentSymbolId:R,category:"type"}),this.extractSymbolsFromChildren(o,d,g,E,Re)}handleImplItem(o,d,g,E,R){this.extractSymbolsFromChildren(o,d,g,E,R)}extractSymbolsFromChildren(o,d,g,E,R){for(let G of o.children)this.extractSymbols(G,d,g,E,R)}buildImportMap(o,d){let g=new Map,E=R=>{if(R.type==="use_declaration"&&this.extractUseDeclarationImports(R,d,g),R.type==="mod_item"){let G=R.childForFieldName("name");if(G){let le=this.getNodeText(G,d);g.set(le,le)}}for(let G of R.children)E(G)};return E(o),g}extractUseDeclarationImports(o,d,g){this.extractFromUseLists(o,d,g),this.extractFromScopedIdentifiers(o,d,g),this.extractFromUseAsClauses(o,d,g)}extractFromUseLists(o,d,g){let E=this.findAllByType(o,"use_list");for(let R of E){let G=this.findBaseModuleForUseList(R,d);this.extractIdentifiersFromUseList(R,G,d,g)}}findBaseModuleForUseList(o,d){let g=o.parent;for(;g;){if(g.type==="scoped_use_list"){let E=this.findScopedIdentifierInChildren(g,d);if(E)return E}g=g.parent}return""}findScopedIdentifierInChildren(o,d){for(let g of o.children)if(g.type==="scoped_identifier")return this.getNodeText(g,d);return""}extractIdentifiersFromUseList(o,d,g,E){for(let R of o.children)if(R.type==="identifier"){let G=this.getNodeText(R,g);E.set(G,d)}}extractFromScopedIdentifiers(o,d,g){let E=this.findAllByType(o,"scoped_identifier");for(let R of E){if(this.hasAncestorOfType(R,"use_list"))continue;let G=this.getNodeText(R,d),{localName:le,modulePath:Re}=this.splitModulePath(G);g.set(le,Re)}}splitModulePath(o){let d=o.split("::"),g=d.at(-1)??"",E=d.slice(0,-1).join("::");return{localName:g,modulePath:E}}extractFromUseAsClauses(o,d,g){let E=this.findAllByType(o,"use_as_clause");for(let R of E){let G=R.childForFieldName("path"),le=R.childForFieldName("alias");if(G&&le){let Re=this.getNodeText(G,d),nt=this.getNodeText(le,d);g.set(nt,Re)}}}extractDependencies(o,d,g,E,R,G,le){let Re=this.getScopeForNode(o,d,g,G);this.addCallDependencyIfAny(o,d,g,E,R,Re,le);for(let nt of o.children)this.extractDependencies(nt,d,g,E,R,Re,le)}getScopeForNode(o,d,g,E){if(o.type!=="function_item")return E;let R=o.childForFieldName("name");if(!R)return E;let G=this.getNodeText(R,g);return`${d}:${G}`}addCallDependencyIfAny(o,d,g,E,R,G,le){if(o.type!=="call_expression")return;let Re=o.childForFieldName("function");if(!Re||!G)return;let{moduleName:nt,symbolName:at}=this.extractModuleAndSymbolName(Re,g),dt=`${d}:${at}`;if(R.has(dt)){E.push({sourceSymbolId:G,targetSymbolId:dt,targetFilePath:d,isTypeOnly:!1});return}if(nt&&le?.has(nt)){let xe=le.get(nt);if(xe===void 0)return;E.push({sourceSymbolId:G,targetSymbolId:`${xe}:${at}`,targetFilePath:xe,isTypeOnly:!1});return}if(le?.has(at)){let xe=le.get(at);if(xe===void 0)return;E.push({sourceSymbolId:G,targetSymbolId:`${xe}:${at}`,targetFilePath:xe,isTypeOnly:!1})}}extractModuleAndSymbolName(o,d){if(o.type==="field_expression"){let g=o.childForFieldName("field");if(g)return{moduleName:void 0,symbolName:this.getNodeText(g,d)}}if(o.type==="scoped_identifier"){let E=this.getNodeText(o,d).split("::");if(E.length>=2){let R=E.at(-1)??"";return{moduleName:E.slice(0,-1).join("::"),symbolName:R}}return{moduleName:void 0,symbolName:E[0]}}return{moduleName:void 0,symbolName:this.getNodeText(o,d)}}hasVisibilityModifier(o,d){if(o.childForFieldName("visibility_modifier"))return!0;for(let E of o.children)if(E.type==="visibility_modifier")return!0;return!1}hasAncestorOfType(o,d){let g=o.parent;for(;g;){if(g.type===d)return!0;g=g.parent}return!1}hasModifier(o,d){for(let g of o.children)if(g.type===d)return!0;return!1}findAllByType(o,d){let g=[],E=R=>{R.type===d&&g.push(R);for(let G of R.children)E(G)};return E(o),g}getNodeText(o,d){return d.slice(o.startIndex,o.endIndex)}};var Noe=class h{static typeScriptParsers=new Map;static typeScriptSymbolAnalyzers=new Map;static pythonParsers=new Map;static pythonSymbolAnalyzers=new Map;static rustParsers=new Map;static rustSymbolAnalyzers=new Map;static csharpParsers=new Map;static goParsers=new Map;static javaParsers=new Map;rootDir;extensionPath;constructor(o,d,g){this.rootDir=o,this.extensionPath=g}getAnalyzer(o){let d=Gm(o);return h.getAnalyzer(d,this.rootDir,this.extensionPath)}getSymbolAnalyzer(o){let d=Gm(o);return h.getSymbolAnalyzer(d,this.rootDir,this.extensionPath)}static detectLanguage(o){let d=Gm(o);switch($Xe.default.extname(d).toLowerCase()){case".ts":case".tsx":case".js":case".jsx":case".mjs":case".cjs":case".vue":case".svelte":case".gql":case".graphql":return"typescript";case".py":case".pyi":return"python";case".rs":case".toml":return"rust";case".cs":case".csproj":return"csharp";case".go":return"go";case".java":return"java";default:return"unknown"}}static getAnalyzer(o,d,g){let E=Gm(o);switch(this.detectLanguage(E)){case"typescript":{let G=this.buildCacheKey(d),le=this.typeScriptParsers.get(G);if(le)return le;let Re=new WZ(d);return this.typeScriptParsers.set(G,Re),Re}case"python":{let G=this.buildCacheKey(d,g),le=this.pythonParsers.get(G);if(le)return le;let Re=new xoe(d,g);return this.pythonParsers.set(G,Re),Re}case"rust":{let G=this.buildCacheKey(d,g),le=this.rustParsers.get(G);if(le)return le;let Re=new Ioe(d,g);return this.rustParsers.set(G,Re),Re}case"csharp":{let G=this.buildCacheKey(d,g),le=this.csharpParsers.get(G);if(le)return le;let Re=new boe(d,g);return this.csharpParsers.set(G,Re),Re}case"go":{let G=this.buildCacheKey(d,g),le=this.goParsers.get(G);if(le)return le;let Re=new Toe(d,g);return this.goParsers.set(G,Re),Re}case"java":{let G=this.buildCacheKey(d,g),le=this.javaParsers.get(G);if(le)return le;let Re=new Eoe(d,g);return this.javaParsers.set(G,Re),Re}default:throw new Error(`Unsupported language for file: ${o}`)}}static getSymbolAnalyzer(o,d,g){let E=Gm(o);switch(this.detectLanguage(E)){case"typescript":{let G=this.buildCacheKey(d),le=this.typeScriptSymbolAnalyzers.get(G);if(le)return le;let Re=new voe(d);return this.typeScriptSymbolAnalyzers.set(G,Re),Re}case"python":{let G=this.buildCacheKey(d,g),le=this.pythonSymbolAnalyzers.get(G);if(le)return le;let Re=new Doe(d,g);return this.pythonSymbolAnalyzers.set(G,Re),Re}case"rust":{let G=this.buildCacheKey(d,g),le=this.rustSymbolAnalyzers.get(G);if(le)return le;let Re=new Poe(d,g);return this.rustSymbolAnalyzers.set(G,Re),Re}default:throw new Error(`Unsupported language for file: ${o}`)}}static isSupported(o){return this.detectLanguage(o)!=="unknown"}static reset(){this.typeScriptParsers.clear(),this.typeScriptSymbolAnalyzers.clear(),this.pythonParsers.clear(),this.pythonSymbolAnalyzers.clear(),this.rustParsers.clear(),this.rustSymbolAnalyzers.clear(),this.csharpParsers.clear(),this.goParsers.clear(),this.javaParsers.clear()}static buildCacheKey(...o){return o.map(d=>d??"").join("\0")}};var j2t=new Set(vUe.filter(h=>h!=="node_modules"));function YXe(h){return OZ.some(o=>h.endsWith(o))}function QXe(h,o){return o&&h==="node_modules"||j2t.has(h)?!0:h.startsWith(".")}var U2t=new k8("IndexerWorker"),xw=!1;function p9(h){f9.parentPort?.postMessage(h)}async function*YDe(h,o){if(xw)return;let d;try{d=await Roe.readdir(h,{withFileTypes:!0})}catch(g){g.code!=="ENOENT"&&g.code!=="EACCES"&&U2t.error("Error reading directory in IndexerWorker",h,g);return}for(let g of d){if(xw)return;let E=ZXe.join(h,g.name);g.isDirectory()?QXe(g.name,o)||(yield*YDe(E,o)):g.isFile()&&YXe(g.name)&&(yield E)}}async function H2t(h,o){let d=0;for await(let g of YDe(h,o)){if(xw)break;d++}return d}async function K2t(h,o){try{let d=await Roe.stat(h),g=o.getAnalyzer(h),E=await g.parseImports(h),R=[];for(let G of E){let le=await g.resolvePath(h,G.module);le&&R.push({path:le,type:G.type,line:G.line,module:G.module})}return{filePath:h,dependencies:R,mtime:d.mtimeMs,size:d.size}}catch{return null}}async function J2t(h){let o=Date.now(),d=h.progressInterval??100;try{let g=new Noe(h.rootDir,h.tsConfigPath,h.extensionPath);p9({type:"counting"});let E=await H2t(h.rootDir,h.excludeNodeModules??!0);if(xw){p9({type:"complete",data:{duration:Date.now()-o,indexData:[]}});return}let R=[],G=0;for await(let Re of YDe(h.rootDir,h.excludeNodeModules??!0)){if(xw)break;let nt=await K2t(Re,g);nt&&R.push(nt),G++,(G%d===0||G===E)&&p9({type:"progress",data:{processed:G,total:E,currentFile:Re}})}let le=Date.now()-o;p9({type:"complete",data:{duration:le,processed:R.length,total:E,indexData:R}})}catch(g){p9({type:"error",error:g instanceof Error?g.message:"Unknown error"})}}f9.parentPort?.on("message",h=>{switch(h.type){case"start":xw=!1,J2t(f9.workerData);break;case"cancel":xw=!0;break}});
42161
42161
  /*! Bundled license information:
42162
42162
 
42163
42163
  @ts-morph/common/dist/typescript.js: