diff --git a/microShield-ios-blocker.user.js b/microShield-ios-blocker.user.js index cfdec90..499fc6c 100644 --- a/microShield-ios-blocker.user.js +++ b/microShield-ios-blocker.user.js @@ -8,7 +8,7 @@ // @downloadURL https://cdn.jsdelivr.net/gh/List-KR/microShield@latest/microShield-ios-blocker.user.js // @license Apache-2.0 // -// @version 4.8.0 +// @version 4.9.0 // @author PiQuark6046 and contributors // // @match *://ygosu.com/* diff --git a/microShield-ios-recovery.user.js b/microShield-ios-recovery.user.js index 04c90a1..3636f1f 100644 --- a/microShield-ios-recovery.user.js +++ b/microShield-ios-recovery.user.js @@ -8,7 +8,7 @@ // @downloadURL https://cdn.jsdelivr.net/gh/List-KR/microShield@latest/microShield-ios-recovery.user.js // @license Apache-2.0 // -// @version 4.8.0 +// @version 4.9.0 // @author PiQuark6046 and contributors // // @match *://ygosu.com/* @@ -31144,17 +31144,19 @@ Node text: ${this.#forgottenText}`),new common.errors.InvalidOperationError(mess `)&&(insertText=insertText.replace(/\r?\n$/,"")));let insertPos=getInsertPosFromIndex(index,this,this.getChildren());insertIntoParentTextRange({insertPos,newText:insertText,parent:this});let finalChildren=this.getChildren();return getNodesToReturn(initialChildCount,finalChildren,index,!0)}};function renameNode(node,newName,options){if(common.errors.throwIfWhitespaceOrNotString(newName,"newName"),node.getText()===newName)return;let renameLocations=node._context.languageService.findRenameLocations(node,options),renameLocationsBySourceFile=new common.KeyValueCache;for(let renameLocation of renameLocations)renameLocationsBySourceFile.getOrCreate(renameLocation.getSourceFile(),()=>[]).push(renameLocation);for(let[sourceFile,locations]of renameLocationsBySourceFile.getEntries())replaceSourceFileTextForRename({sourceFile,renameLocations:locations,newName})}function setBodyTextForNode(body,textOrWriterFunction){let newText=getBodyText(body._getWriterWithIndentation(),textOrWriterFunction),openBrace=body.getFirstChildByKindOrThrow(common.SyntaxKind.OpenBraceToken),closeBrace=body.getFirstChildByKindOrThrow(common.SyntaxKind.CloseBraceToken);insertIntoParentTextRange({insertPos:openBrace.getEnd(),newText,parent:body,replacing:{textLength:closeBrace.getStart()-openBrace.getEnd()}})}function BodiedNode(Base){return class extends Base{getBody(){let body=this.compilerNode.body;if(body==null)throw new common.errors.InvalidOperationError("Bodied node should have a body.");return this._getNodeFromCompilerNode(body)}setBodyText(textOrWriterFunction){let body=this.getBody();return setBodyTextForNode(body,textOrWriterFunction),this}getBodyText(){return getBodyTextWithoutLeadingIndentation(this.getBody())}}}function BodyableNode(Base){return class extends Base{getBodyOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getBody(),message??"Expected to find the node's body.",this)}getBody(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.body)}getBodyText(){let body=this.getBody();return body==null?void 0:getBodyTextWithoutLeadingIndentation(body)}setBodyText(textOrWriterFunction){return this.addBody(),setBodyTextForNode(this.getBodyOrThrow(),textOrWriterFunction),this}hasBody(){return this.compilerNode.body!=null}addBody(){if(this.hasBody())return this;let semiColon=this.getLastChildByKind(common.SyntaxKind.SemicolonToken);return insertIntoParentTextRange({parent:this,insertPos:semiColon==null?this.getEnd():semiColon.getStart(),newText:this._getWriterWithQueuedIndentation().space().block().toString(),replacing:{textLength:semiColon?.getFullWidth()??0}}),this}removeBody(){let body=this.getBody();return body==null?this:(insertIntoParentTextRange({parent:this,insertPos:body.getPos(),newText:";",replacing:{textLength:body.getFullWidth()}}),this)}}}function ChildOrderableNode(Base){return class extends Base{setOrder(order){let childIndex=this.getChildIndex(),parent=this.getParentSyntaxList()||this.getParentSyntaxListOrThrow();return common.errors.throwIfOutOfRange(order,[0,parent.getChildCount()-1],"order"),childIndex===order?this:(changeChildOrder({parent,getSiblingFormatting:getGeneralFormatting,oldIndex:childIndex,newIndex:order}),this)}}}function DecoratableNode(Base){return class extends Base{getDecorator(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getDecorators(),nameOrFindFunction)}getDecoratorOrThrow(nameOrFindFunction,message){return common.errors.throwIfNullOrUndefined(this.getDecorator(nameOrFindFunction),message??(()=>getNotFoundErrorMessageForNameOrFindFunction("decorator",nameOrFindFunction)),this)}getDecorators(){return getCompilerNodeDecorators(this.compilerNode).map(d=>this._getNodeFromCompilerNode(d))}addDecorator(structure){return this.insertDecorator(getEndIndexFromArray(getCompilerNodeDecorators(this.compilerNode)),structure)}addDecorators(structures){return this.insertDecorators(getEndIndexFromArray(getCompilerNodeDecorators(this.compilerNode)),structures)}insertDecorator(index,structure){return this.insertDecorators(index,[structure])[0]}insertDecorators(index,structures){if(common.ArrayUtils.isNullOrEmpty(structures))return[];let decoratorLines=getDecoratorLines(this,structures),decorators=this.getDecorators();index=verifyAndGetIndex(index,decorators.length);let formattingKind=getDecoratorFormattingKind(this,decorators),previousDecorator=decorators[index-1],decoratorCode=getNewInsertCode({structures,newCodes:decoratorLines,parent:this,indentationText:this.getIndentationText(),getSeparator:()=>formattingKind,previousFormattingKind:previousDecorator==null?FormattingKind.None:formattingKind,nextFormattingKind:previousDecorator==null?formattingKind:FormattingKind.None});return insertIntoParentTextRange({parent:decorators[0]?.getParentSyntaxListOrThrow()??this.getModifiers()[0]?.getParentSyntaxListOrThrow()??this,insertPos:index===0?(decorators[0]??this).getStart():decorators[index-1].getEnd(),newText:decoratorCode}),getNodesToReturn(decorators,this.getDecorators(),index,!1)}set(structure){return callBaseSet(Base.prototype,this,structure),structure.decorators!=null&&(this.getDecorators().forEach(d=>d.remove()),this.addDecorators(structure.decorators)),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{decorators:this.getDecorators().map(d=>d.getStructure())})}}}function getCompilerNodeDecorators(node){return common.ts.canHaveDecorators(node)?common.ts.getDecorators(node)??[]:[]}function getDecoratorLines(node,structures){let lines=[];for(let structure of structures){let writer=node._getWriter();node._context.structurePrinterFactory.forDecorator().printText(writer,structure),lines.push(writer.toString())}return lines}function getDecoratorFormattingKind(parent,currentDecorators){return areDecoratorsOnSameLine(parent,currentDecorators)?FormattingKind.Space:FormattingKind.Newline}function areDecoratorsOnSameLine(parent,currentDecorators){if(currentDecorators.length===1){let previousNode=currentDecorators[0].getPreviousSibling();if(previousNode!=null&&previousNode.getStartLinePos()===currentDecorators[0].getStartLinePos())return!0}if(currentDecorators.length<=1)return parent.getKind()===common.SyntaxKind.Parameter;let startLinePos=currentDecorators[0].getStartLinePos();for(let i=1;ie===thisSymbol||e.getAliasedSymbol()===thisSymbol)}isDefaultExport(){if(this.hasDefaultKeyword())return!0;let thisSymbol=this.getSymbol();if(thisSymbol==null)return!1;let defaultExportSymbol=this.getSourceFile().getDefaultExportSymbol();if(defaultExportSymbol==null)return!1;if(thisSymbol===defaultExportSymbol)return!0;let aliasedSymbol=defaultExportSymbol.getAliasedSymbol();return thisSymbol===aliasedSymbol}isNamedExport(){let thisSymbol=this.getSymbol(),sourceFileSymbol=this.getSourceFile().getSymbol();if(thisSymbol==null||sourceFileSymbol==null)return!1;return!isDefaultExport()&&sourceFileSymbol.getExports().some(e=>e===thisSymbol||e.getAliasedSymbol()===thisSymbol);function isDefaultExport(){let defaultExportSymbol=sourceFileSymbol.getExport("default");return defaultExportSymbol==null?!1:thisSymbol===defaultExportSymbol||thisSymbol===defaultExportSymbol.getAliasedSymbol()}}}}function throwForNotModifierableNode(){throw new common.errors.NotImplementedError("Not implemented situation where node was not a ModifierableNode.")}function ExportableNode(Base){return apply$1(ExportGetableNode(Base))}function apply$1(Base){return class extends Base{setIsDefaultExport(value){if(value===this.isDefaultExport())return this;if(value&&!Node.isSourceFile(this.getParentOrThrow()))throw new common.errors.InvalidOperationError("The parent must be a source file in order to set this node as a default export.");let sourceFile=this.getSourceFile(),fileDefaultExportSymbol=sourceFile.getDefaultExportSymbol();if(fileDefaultExportSymbol!=null&&sourceFile.removeDefaultExport(fileDefaultExportSymbol),!value)return this;if(Node.hasName(this)&&shouldWriteAsSeparateStatement.call(this)){let parentSyntaxList=this.getFirstAncestorByKindOrThrow(common.SyntaxKind.SyntaxList),name=this.getName();parentSyntaxList.insertChildText(this.getChildIndex()+1,writer=>{writer.newLine().write(`export default ${name};`)})}else this.addModifier("export"),this.addModifier("default");return this;function shouldWriteAsSeparateStatement(){return!!(Node.isEnumDeclaration(this)||Node.isModuleDeclaration(this)||Node.isTypeAliasDeclaration(this)||Node.isAmbientable(this)&&this.isAmbient())}}setIsExported(value){return Node.isSourceFile(this.getParentOrThrow())&&this.toggleModifier("default",!1),this.toggleModifier("export",value),this}set(structure){return callBaseSet(Base.prototype,this,structure),structure.isExported!=null&&this.setIsExported(structure.isExported),structure.isDefaultExport!=null&&this.setIsDefaultExport(structure.isDefaultExport),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{isExported:this.hasExportKeyword(),isDefaultExport:this.hasDefaultKeyword()})}}}var Printer=class{printTextOrWriterFunc(writer,textOrWriterFunc){typeof textOrWriterFunc=="string"?writer.write(textOrWriterFunc):textOrWriterFunc?.(writer)}getNewWriter(writer){return new CodeBlockWriter__default.default(writer.getOptions())}getNewWriterWithQueuedChildIndentation(writer){let newWriter=new CodeBlockWriter__default.default(writer.getOptions());return newWriter.queueIndentationLevel(1),newWriter}getText(writer,textOrWriterFunc){let newWriter=this.getNewWriter(writer);return this.printTextOrWriterFunc(newWriter,textOrWriterFunc),newWriter.toString()}getTextWithQueuedChildIndentation(writer,textOrWriterFunc){let queuedChildIndentationWriter=this.getNewWriterWithQueuedChildIndentation(writer);return this.printTextOrWriterFunc(queuedChildIndentationWriter,textOrWriterFunc),queuedChildIndentationWriter.toString()}},InitializerExpressionableNodeStructurePrinter=class extends Printer{printText(writer,structure){let{initializer}=structure;if(initializer==null)return;let initializerText=this.getText(writer,initializer);common.StringUtils.isNullOrWhitespace(initializerText)||writer.hangingIndent(()=>{writer.spaceIfLastNot(),writer.write(`= ${initializerText}`)})}},ModifierableNodeStructurePrinter=class extends Printer{printText(writer,structure){let scope=structure.scope;structure.isDefaultExport?writer.write("export default "):structure.isExported&&writer.write("export "),structure.hasDeclareKeyword&&writer.write("declare "),scope!=null&&writer.write(`${scope} `),structure.isStatic&&writer.write("static "),structure.hasOverrideKeyword&&writer.write("override "),structure.isAbstract&&writer.write("abstract "),structure.isAsync&&writer.write("async "),structure.isReadonly&&writer.write("readonly "),structure.hasAccessorKeyword&&writer.write("accessor ")}},ReturnTypedNodeStructurePrinter=class extends Printer{#alwaysWrite;constructor(alwaysWrite=!1){super(),this.#alwaysWrite=alwaysWrite}printText(writer,structure){let{returnType}=structure;if(returnType==null&&this.#alwaysWrite===!1)return;returnType=returnType??"void";let returnTypeText=this.getText(writer,returnType);common.StringUtils.isNullOrWhitespace(returnTypeText)||writer.hangingIndent(()=>{writer.write(`: ${returnTypeText}`)})}},TypedNodeStructurePrinter=class extends Printer{#separator;#alwaysWrite;constructor(separator,alwaysWrite=!1){super(),this.#alwaysWrite=alwaysWrite,this.#separator=separator}printText(writer,structure){let{type}=structure;if(type==null&&this.#alwaysWrite===!1)return;type=type??"any";let typeText=this.getText(writer,type);common.StringUtils.isNullOrWhitespace(typeText)||writer.hangingIndent(()=>{writer.write(`${this.#separator} ${typeText}`)})}},BlankLineFormattingStructuresPrinter=class extends Printer{#printer;constructor(printer){super(),this.#printer=printer}printText(writer,structures){if(structures!=null)for(let i=0;i0),this.#printer.printText(writer,structures[i])}},CommaSeparatedStructuresPrinter=class extends Printer{#printer;constructor(printer){super(),this.#printer=printer}printText(writer,structures){printTextWithSeparator(this.#printer,writer,structures,()=>writer.spaceIfLastNot())}};function printTextWithSeparator(printer,writer,structures,separator){if(structures!=null)if(structures instanceof Function||typeof structures=="string")printer.printText(writer,structures);else{let commaAppendPositions=new Array(structures.length);for(let i=0;i0&&separator();let structure=structures[i],startPos=writer.getLength();printer.printText(writer,structure);let pos=getAppendCommaPos(WriterUtils.getLastCharactersToPos(writer,startPos));commaAppendPositions[i]=pos===-1?!1:pos+startPos}let foundFirst=!1;for(let i=commaAppendPositions.length-1;i>=0;i--){let pos=commaAppendPositions[i];pos!==!1&&(foundFirst?writer.unsafeInsert(pos,","):foundFirst=!0)}}}var CommaNewLineSeparatedStructuresPrinter=class extends Printer{#printer;constructor(printer){super(),this.#printer=printer}printText(writer,structures){printTextWithSeparator(this.#printer,writer,structures,()=>writer.newLineIfLastNot())}},NewLineFormattingStructuresPrinter=class extends Printer{#printer;constructor(printer){super(),this.#printer=printer}printText(writer,structures){if(structures!=null)for(let i=0;i0),this.#printer.printText(writer,structures[i])}},SpaceFormattingStructuresPrinter=class extends Printer{#printer;constructor(printer){super(),this.#printer=printer}printText(writer,structures){if(structures!=null)for(let i=0;i0," "),this.#printer.printText(writer,structures[i])}},NodePrinter=class extends Printer{factory;constructor(factory){super(),this.factory=factory}printTextWithoutTrivia(writer,structure){this.printTextInternal(writer,structure)}printText(writer,structure){this.printLeadingTrivia(writer,structure),writer.closeComment(),this.printTextInternal(writer,structure),this.printTrailingTrivia(writer,structure)}printLeadingTrivia(writer,structure){let leadingTrivia=structure?.leadingTrivia;leadingTrivia&&(this.#printTrivia(writer,leadingTrivia),writer.isInComment()&&writer.closeComment())}printTrailingTrivia(writer,structure){let trailingTrivia=structure?.trailingTrivia;trailingTrivia!=null&&this.#printTrivia(writer,trailingTrivia)}#printTrivia(writer,trivia){if(trivia instanceof Array)for(let i=0;iitem.name===getAccessor.name);setAccessorIndex>=0&&(this.#conditionalSeparator(writer,isAmbient),this.#setAccessorPrinter.printText(writer,setAccessors[setAccessorIndex]),setAccessors.splice(setAccessorIndex,1))}for(let setAccessor of setAccessors)this.#conditionalSeparator(writer,isAmbient),this.#setAccessorPrinter.printText(writer,setAccessor)}#conditionalSeparator(writer,isAmbient){writer.isAtStartOfFirstLineOfBlock()||(isAmbient?writer.newLine():writer.blankLine())}},ClassDeclarationStructurePrinter=class extends NodePrinter{#options;#multipleWriter=new BlankLineFormattingStructuresPrinter(this);constructor(factory,options){super(factory),this.#options=options}printTexts(writer,structures){this.#multipleWriter.printText(writer,structures)}printTextInternal(writer,structure){let isAmbient=structure.hasDeclareKeyword||this.#options.isAmbient;this.factory.forJSDoc().printDocs(writer,structure.docs),this.factory.forDecorator().printTexts(writer,structure.decorators),this.#printHeader(writer,structure),writer.inlineBlock(()=>{this.factory.forPropertyDeclaration().printTexts(writer,structure.properties),this.#printStaticBlocks(writer,structure),this.#printCtors(writer,structure,isAmbient),this.#printGetAndSet(writer,structure,isAmbient),common.ArrayUtils.isNullOrEmpty(structure.methods)||(this.#conditionalSeparator(writer,isAmbient),this.factory.forMethodDeclaration({isAmbient}).printTexts(writer,structure.methods))})}#printHeader(writer,structure){this.factory.forModifierableNode().printText(writer,structure),writer.write("class"),common.StringUtils.isNullOrWhitespace(structure.name)||writer.space().write(structure.name),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(writer,structure.typeParameters),writer.space(),writer.hangingIndent(()=>{if(structure.extends!=null){let extendsText=this.getText(writer,structure.extends);common.StringUtils.isNullOrWhitespace(extendsText)||writer.write(`extends ${extendsText} `)}if(structure.implements!=null){let implementsText=structure.implements instanceof Array?structure.implements.map(i=>this.getText(writer,i)).join(", "):this.getText(writer,structure.implements);common.StringUtils.isNullOrWhitespace(implementsText)||writer.write(`implements ${implementsText} `)}})}#printCtors(writer,structure,isAmbient){if(!common.ArrayUtils.isNullOrEmpty(structure.ctors))for(let ctor of structure.ctors)this.#conditionalSeparator(writer,isAmbient),this.factory.forConstructorDeclaration({isAmbient}).printText(writer,ctor)}#printStaticBlocks(writer,structure){if(!common.ArrayUtils.isNullOrEmpty(structure.staticBlocks))for(let block of structure.staticBlocks)this.#conditionalSeparator(writer,!1),this.factory.forClassStaticBlockDeclaration().printText(writer,block)}#printGetAndSet(writer,structure,isAmbient){if(structure.getAccessors==null&&structure.setAccessors==null)return;let getAccessorWriter=this.factory.forGetAccessorDeclaration({isAmbient}),setAccessorWriter=this.factory.forSetAccessorDeclaration({isAmbient});new GetAndSetAccessorStructurePrinter(getAccessorWriter,setAccessorWriter).printGetAndSet(writer,structure.getAccessors,structure.setAccessors,isAmbient)}#conditionalSeparator(writer,isAmbient){writer.isAtStartOfFirstLineOfBlock()||(isAmbient?writer.newLine():writer.blankLine())}};exports.StructureKind=void 0;(function(StructureKind){StructureKind[StructureKind.ImportAttribute=0]="ImportAttribute",StructureKind[StructureKind.CallSignature=1]="CallSignature",StructureKind[StructureKind.Class=2]="Class",StructureKind[StructureKind.ClassStaticBlock=3]="ClassStaticBlock",StructureKind[StructureKind.ConstructSignature=4]="ConstructSignature",StructureKind[StructureKind.Constructor=5]="Constructor",StructureKind[StructureKind.ConstructorOverload=6]="ConstructorOverload",StructureKind[StructureKind.Decorator=7]="Decorator",StructureKind[StructureKind.Enum=8]="Enum",StructureKind[StructureKind.EnumMember=9]="EnumMember",StructureKind[StructureKind.ExportAssignment=10]="ExportAssignment",StructureKind[StructureKind.ExportDeclaration=11]="ExportDeclaration",StructureKind[StructureKind.ExportSpecifier=12]="ExportSpecifier",StructureKind[StructureKind.Function=13]="Function",StructureKind[StructureKind.FunctionOverload=14]="FunctionOverload",StructureKind[StructureKind.GetAccessor=15]="GetAccessor",StructureKind[StructureKind.ImportDeclaration=16]="ImportDeclaration",StructureKind[StructureKind.ImportSpecifier=17]="ImportSpecifier",StructureKind[StructureKind.IndexSignature=18]="IndexSignature",StructureKind[StructureKind.Interface=19]="Interface",StructureKind[StructureKind.JsxAttribute=20]="JsxAttribute",StructureKind[StructureKind.JsxSpreadAttribute=21]="JsxSpreadAttribute",StructureKind[StructureKind.JsxElement=22]="JsxElement",StructureKind[StructureKind.JsxSelfClosingElement=23]="JsxSelfClosingElement",StructureKind[StructureKind.JSDoc=24]="JSDoc",StructureKind[StructureKind.JSDocTag=25]="JSDocTag",StructureKind[StructureKind.Method=26]="Method",StructureKind[StructureKind.MethodOverload=27]="MethodOverload",StructureKind[StructureKind.MethodSignature=28]="MethodSignature",StructureKind[StructureKind.Module=29]="Module",StructureKind[StructureKind.Parameter=30]="Parameter",StructureKind[StructureKind.Property=31]="Property",StructureKind[StructureKind.PropertyAssignment=32]="PropertyAssignment",StructureKind[StructureKind.PropertySignature=33]="PropertySignature",StructureKind[StructureKind.SetAccessor=34]="SetAccessor",StructureKind[StructureKind.ShorthandPropertyAssignment=35]="ShorthandPropertyAssignment",StructureKind[StructureKind.SourceFile=36]="SourceFile",StructureKind[StructureKind.SpreadAssignment=37]="SpreadAssignment",StructureKind[StructureKind.TypeAlias=38]="TypeAlias",StructureKind[StructureKind.TypeParameter=39]="TypeParameter",StructureKind[StructureKind.VariableDeclaration=40]="VariableDeclaration",StructureKind[StructureKind.VariableStatement=41]="VariableStatement"})(exports.StructureKind||(exports.StructureKind={}));var Structure={hasName(structure){return typeof structure.name=="string"},isCallSignature(structure){return structure?.kind===exports.StructureKind.CallSignature},isJSDocable(structure){switch(structure?.kind){case exports.StructureKind.CallSignature:case exports.StructureKind.Class:case exports.StructureKind.ClassStaticBlock:case exports.StructureKind.ConstructorOverload:case exports.StructureKind.Constructor:case exports.StructureKind.ConstructSignature:case exports.StructureKind.Enum:case exports.StructureKind.EnumMember:case exports.StructureKind.ExportAssignment:case exports.StructureKind.FunctionOverload:case exports.StructureKind.Function:case exports.StructureKind.GetAccessor:case exports.StructureKind.IndexSignature:case exports.StructureKind.Interface:case exports.StructureKind.MethodOverload:case exports.StructureKind.Method:case exports.StructureKind.MethodSignature:case exports.StructureKind.Module:case exports.StructureKind.Property:case exports.StructureKind.PropertySignature:case exports.StructureKind.SetAccessor:case exports.StructureKind.TypeAlias:case exports.StructureKind.VariableStatement:return!0;default:return!1}},isSignatured(structure){switch(structure?.kind){case exports.StructureKind.CallSignature:case exports.StructureKind.ConstructorOverload:case exports.StructureKind.Constructor:case exports.StructureKind.ConstructSignature:case exports.StructureKind.FunctionOverload:case exports.StructureKind.Function:case exports.StructureKind.GetAccessor:case exports.StructureKind.MethodOverload:case exports.StructureKind.Method:case exports.StructureKind.MethodSignature:case exports.StructureKind.SetAccessor:return!0;default:return!1}},isParametered(structure){switch(structure?.kind){case exports.StructureKind.CallSignature:case exports.StructureKind.ConstructorOverload:case exports.StructureKind.Constructor:case exports.StructureKind.ConstructSignature:case exports.StructureKind.FunctionOverload:case exports.StructureKind.Function:case exports.StructureKind.GetAccessor:case exports.StructureKind.MethodOverload:case exports.StructureKind.Method:case exports.StructureKind.MethodSignature:case exports.StructureKind.SetAccessor:return!0;default:return!1}},isReturnTyped(structure){switch(structure?.kind){case exports.StructureKind.CallSignature:case exports.StructureKind.ConstructorOverload:case exports.StructureKind.Constructor:case exports.StructureKind.ConstructSignature:case exports.StructureKind.FunctionOverload:case exports.StructureKind.Function:case exports.StructureKind.GetAccessor:case exports.StructureKind.IndexSignature:case exports.StructureKind.MethodOverload:case exports.StructureKind.Method:case exports.StructureKind.MethodSignature:case exports.StructureKind.SetAccessor:return!0;default:return!1}},isTypeParametered(structure){switch(structure?.kind){case exports.StructureKind.CallSignature:case exports.StructureKind.Class:case exports.StructureKind.ConstructorOverload:case exports.StructureKind.Constructor:case exports.StructureKind.ConstructSignature:case exports.StructureKind.FunctionOverload:case exports.StructureKind.Function:case exports.StructureKind.GetAccessor:case exports.StructureKind.Interface:case exports.StructureKind.MethodOverload:case exports.StructureKind.Method:case exports.StructureKind.MethodSignature:case exports.StructureKind.SetAccessor:case exports.StructureKind.TypeAlias:return!0;default:return!1}},isClass(structure){return structure?.kind===exports.StructureKind.Class},isClassLikeDeclarationBase(structure){return structure?.kind===exports.StructureKind.Class},isNameable(structure){switch(structure?.kind){case exports.StructureKind.Class:case exports.StructureKind.Function:return!0;default:return!1}},isImplementsClauseable(structure){return structure?.kind===exports.StructureKind.Class},isDecoratable(structure){switch(structure?.kind){case exports.StructureKind.Class:case exports.StructureKind.GetAccessor:case exports.StructureKind.Method:case exports.StructureKind.Parameter:case exports.StructureKind.Property:case exports.StructureKind.SetAccessor:return!0;default:return!1}},isAbstractable(structure){switch(structure?.kind){case exports.StructureKind.Class:case exports.StructureKind.GetAccessor:case exports.StructureKind.MethodOverload:case exports.StructureKind.Method:case exports.StructureKind.Property:case exports.StructureKind.SetAccessor:return!0;default:return!1}},isAmbientable(structure){switch(structure?.kind){case exports.StructureKind.Class:case exports.StructureKind.Enum:case exports.StructureKind.FunctionOverload:case exports.StructureKind.Function:case exports.StructureKind.Interface:case exports.StructureKind.Module:case exports.StructureKind.Property:case exports.StructureKind.TypeAlias:case exports.StructureKind.VariableStatement:return!0;default:return!1}},isExportable(structure){switch(structure?.kind){case exports.StructureKind.Class:case exports.StructureKind.Enum:case exports.StructureKind.FunctionOverload:case exports.StructureKind.Function:case exports.StructureKind.Interface:case exports.StructureKind.Module:case exports.StructureKind.TypeAlias:case exports.StructureKind.VariableStatement:return!0;default:return!1}},isClassStaticBlock(structure){return structure?.kind===exports.StructureKind.ClassStaticBlock},isStatemented(structure){switch(structure?.kind){case exports.StructureKind.ClassStaticBlock:case exports.StructureKind.Constructor:case exports.StructureKind.Function:case exports.StructureKind.GetAccessor:case exports.StructureKind.Method:case exports.StructureKind.Module:case exports.StructureKind.SetAccessor:case exports.StructureKind.SourceFile:return!0;default:return!1}},isConstructorDeclarationOverload(structure){return structure?.kind===exports.StructureKind.ConstructorOverload},isScoped(structure){switch(structure?.kind){case exports.StructureKind.ConstructorOverload:case exports.StructureKind.Constructor:case exports.StructureKind.GetAccessor:case exports.StructureKind.MethodOverload:case exports.StructureKind.Method:case exports.StructureKind.Property:case exports.StructureKind.SetAccessor:return!0;default:return!1}},isConstructor(structure){return structure?.kind===exports.StructureKind.Constructor},isFunctionLike(structure){switch(structure?.kind){case exports.StructureKind.Constructor:case exports.StructureKind.Function:case exports.StructureKind.GetAccessor:case exports.StructureKind.Method:case exports.StructureKind.SetAccessor:return!0;default:return!1}},isConstructSignature(structure){return structure?.kind===exports.StructureKind.ConstructSignature},isDecorator(structure){return structure?.kind===exports.StructureKind.Decorator},isEnum(structure){return structure?.kind===exports.StructureKind.Enum},isNamed(structure){switch(structure?.kind){case exports.StructureKind.Enum:case exports.StructureKind.Interface:case exports.StructureKind.ShorthandPropertyAssignment:case exports.StructureKind.TypeAlias:case exports.StructureKind.TypeParameter:return!0;default:return!1}},isEnumMember(structure){return structure?.kind===exports.StructureKind.EnumMember},isPropertyNamed(structure){switch(structure?.kind){case exports.StructureKind.EnumMember:case exports.StructureKind.GetAccessor:case exports.StructureKind.Method:case exports.StructureKind.MethodSignature:case exports.StructureKind.PropertyAssignment:case exports.StructureKind.Property:case exports.StructureKind.PropertySignature:case exports.StructureKind.SetAccessor:return!0;default:return!1}},isInitializerExpressionable(structure){switch(structure?.kind){case exports.StructureKind.EnumMember:case exports.StructureKind.Parameter:case exports.StructureKind.Property:case exports.StructureKind.PropertySignature:case exports.StructureKind.VariableDeclaration:return!0;default:return!1}},isExportAssignment(structure){return structure?.kind===exports.StructureKind.ExportAssignment},isExportDeclaration(structure){return structure?.kind===exports.StructureKind.ExportDeclaration},isExportSpecifier(structure){return structure?.kind===exports.StructureKind.ExportSpecifier},isFunctionDeclarationOverload(structure){return structure?.kind===exports.StructureKind.FunctionOverload},isAsyncable(structure){switch(structure?.kind){case exports.StructureKind.FunctionOverload:case exports.StructureKind.Function:case exports.StructureKind.MethodOverload:case exports.StructureKind.Method:return!0;default:return!1}},isGeneratorable(structure){switch(structure?.kind){case exports.StructureKind.FunctionOverload:case exports.StructureKind.Function:case exports.StructureKind.MethodOverload:case exports.StructureKind.Method:return!0;default:return!1}},isFunction(structure){return structure?.kind===exports.StructureKind.Function},isGetAccessor(structure){return structure?.kind===exports.StructureKind.GetAccessor},isStaticable(structure){switch(structure?.kind){case exports.StructureKind.GetAccessor:case exports.StructureKind.MethodOverload:case exports.StructureKind.Method:case exports.StructureKind.Property:case exports.StructureKind.SetAccessor:return!0;default:return!1}},isImportAttribute(structure){return structure?.kind===exports.StructureKind.ImportAttribute},isImportAttributeNamed(structure){return structure?.kind===exports.StructureKind.ImportAttribute},isImportDeclaration(structure){return structure?.kind===exports.StructureKind.ImportDeclaration},isImportSpecifier(structure){return structure?.kind===exports.StructureKind.ImportSpecifier},isIndexSignature(structure){return structure?.kind===exports.StructureKind.IndexSignature},isReadonlyable(structure){switch(structure?.kind){case exports.StructureKind.IndexSignature:case exports.StructureKind.Parameter:case exports.StructureKind.Property:case exports.StructureKind.PropertySignature:return!0;default:return!1}},isInterface(structure){return structure?.kind===exports.StructureKind.Interface},isExtendsClauseable(structure){return structure?.kind===exports.StructureKind.Interface},isTypeElementMembered(structure){return structure?.kind===exports.StructureKind.Interface},isJSDoc(structure){return structure?.kind===exports.StructureKind.JSDoc},isJSDocTag(structure){return structure?.kind===exports.StructureKind.JSDocTag},isJsxAttribute(structure){return structure?.kind===exports.StructureKind.JsxAttribute},isJsxElement(structure){return structure?.kind===exports.StructureKind.JsxElement},isJsxSelfClosingElement(structure){return structure?.kind===exports.StructureKind.JsxSelfClosingElement},isJsxTagNamed(structure){return structure?.kind===exports.StructureKind.JsxSelfClosingElement},isJsxAttributed(structure){return structure?.kind===exports.StructureKind.JsxSelfClosingElement},isJsxSpreadAttribute(structure){return structure?.kind===exports.StructureKind.JsxSpreadAttribute},isMethodDeclarationOverload(structure){return structure?.kind===exports.StructureKind.MethodOverload},isQuestionTokenable(structure){switch(structure?.kind){case exports.StructureKind.MethodOverload:case exports.StructureKind.Method:case exports.StructureKind.MethodSignature:case exports.StructureKind.Parameter:case exports.StructureKind.Property:case exports.StructureKind.PropertySignature:return!0;default:return!1}},isOverrideable(structure){switch(structure?.kind){case exports.StructureKind.MethodOverload:case exports.StructureKind.Method:case exports.StructureKind.Parameter:case exports.StructureKind.Property:return!0;default:return!1}},isMethod(structure){return structure?.kind===exports.StructureKind.Method},isMethodSignature(structure){return structure?.kind===exports.StructureKind.MethodSignature},isModule(structure){return structure?.kind===exports.StructureKind.Module},isModuleNamed(structure){return structure?.kind===exports.StructureKind.Module},isParameter(structure){return structure?.kind===exports.StructureKind.Parameter},isBindingNamed(structure){switch(structure?.kind){case exports.StructureKind.Parameter:case exports.StructureKind.VariableDeclaration:return!0;default:return!1}},isTyped(structure){switch(structure?.kind){case exports.StructureKind.Parameter:case exports.StructureKind.Property:case exports.StructureKind.PropertySignature:case exports.StructureKind.TypeAlias:case exports.StructureKind.VariableDeclaration:return!0;default:return!1}},isScopeable(structure){return structure?.kind===exports.StructureKind.Parameter},isPropertyAssignment(structure){return structure?.kind===exports.StructureKind.PropertyAssignment},isProperty(structure){return structure?.kind===exports.StructureKind.Property},isExclamationTokenable(structure){switch(structure?.kind){case exports.StructureKind.Property:case exports.StructureKind.VariableDeclaration:return!0;default:return!1}},isPropertySignature(structure){return structure?.kind===exports.StructureKind.PropertySignature},isSetAccessor(structure){return structure?.kind===exports.StructureKind.SetAccessor},isShorthandPropertyAssignment(structure){return structure?.kind===exports.StructureKind.ShorthandPropertyAssignment},isSourceFile(structure){return structure?.kind===exports.StructureKind.SourceFile},isSpreadAssignment(structure){return structure?.kind===exports.StructureKind.SpreadAssignment},isExpressioned(structure){return structure?.kind===exports.StructureKind.SpreadAssignment},isTypeAlias(structure){return structure?.kind===exports.StructureKind.TypeAlias},isTypeParameter(structure){return structure?.kind===exports.StructureKind.TypeParameter},isVariableDeclaration(structure){return structure?.kind===exports.StructureKind.VariableDeclaration},isVariableStatement(structure){return structure?.kind===exports.StructureKind.VariableStatement}};function forEachStructureChild(structure,callback){if(common.ArrayUtils.isReadonlyArray(structure)){for(let item of structure){let result=callback(item);if(result)return result}return}switch(structure.kind){case exports.StructureKind.CallSignature:return forCallSignatureDeclaration(structure,callback);case exports.StructureKind.Class:return forClassDeclaration(structure,callback);case exports.StructureKind.ClassStaticBlock:return forClassStaticBlockDeclaration(structure,callback);case exports.StructureKind.ConstructorOverload:return forConstructorDeclarationOverload(structure,callback);case exports.StructureKind.Constructor:return forConstructorDeclaration(structure,callback);case exports.StructureKind.ConstructSignature:return forConstructSignatureDeclaration(structure,callback);case exports.StructureKind.Enum:return forEnumDeclaration(structure,callback);case exports.StructureKind.EnumMember:return forEnumMember(structure,callback);case exports.StructureKind.ExportAssignment:return forExportAssignment(structure,callback);case exports.StructureKind.ExportDeclaration:return forExportDeclaration(structure,callback);case exports.StructureKind.FunctionOverload:return forFunctionDeclarationOverload(structure,callback);case exports.StructureKind.Function:return forFunctionDeclaration(structure,callback);case exports.StructureKind.GetAccessor:return forGetAccessorDeclaration(structure,callback);case exports.StructureKind.ImportDeclaration:return forImportDeclaration(structure,callback);case exports.StructureKind.IndexSignature:return forIndexSignatureDeclaration(structure,callback);case exports.StructureKind.Interface:return forInterfaceDeclaration(structure,callback);case exports.StructureKind.JSDoc:return forJSDoc(structure,callback);case exports.StructureKind.JsxElement:return forJsxElement(structure,callback);case exports.StructureKind.JsxSelfClosingElement:return forJsxSelfClosingElement(structure,callback);case exports.StructureKind.MethodOverload:return forMethodDeclarationOverload(structure,callback);case exports.StructureKind.Method:return forMethodDeclaration(structure,callback);case exports.StructureKind.MethodSignature:return forMethodSignature(structure,callback);case exports.StructureKind.Module:return forModuleDeclaration(structure,callback);case exports.StructureKind.Parameter:return forParameterDeclaration(structure,callback);case exports.StructureKind.Property:return forPropertyDeclaration(structure,callback);case exports.StructureKind.PropertySignature:return forPropertySignature(structure,callback);case exports.StructureKind.SetAccessor:return forSetAccessorDeclaration(structure,callback);case exports.StructureKind.SourceFile:return forSourceFile(structure,callback);case exports.StructureKind.TypeAlias:return forTypeAliasDeclaration(structure,callback);case exports.StructureKind.VariableStatement:return forVariableStatement(structure,callback);default:return}}function forCallSignatureDeclaration(structure,callback){return forJSDocableNode(structure,callback)||forSignaturedDeclaration(structure,callback)||forTypeParameteredNode(structure,callback)}function forJSDocableNode(structure,callback){return forAllIfStructure(structure.docs,callback,exports.StructureKind.JSDoc)}function forSignaturedDeclaration(structure,callback){return forParameteredNode(structure,callback)}function forParameteredNode(structure,callback){return forAll(structure.parameters,callback,exports.StructureKind.Parameter)}function forTypeParameteredNode(structure,callback){return forAllIfStructure(structure.typeParameters,callback,exports.StructureKind.TypeParameter)}function forClassDeclaration(structure,callback){return forClassLikeDeclarationBase(structure,callback)}function forClassLikeDeclarationBase(structure,callback){return forDecoratableNode(structure,callback)||forTypeParameteredNode(structure,callback)||forJSDocableNode(structure,callback)||forAll(structure.ctors,callback,exports.StructureKind.Constructor)||forAll(structure.staticBlocks,callback,exports.StructureKind.ClassStaticBlock)||forAll(structure.properties,callback,exports.StructureKind.Property)||forAll(structure.getAccessors,callback,exports.StructureKind.GetAccessor)||forAll(structure.setAccessors,callback,exports.StructureKind.SetAccessor)||forAll(structure.methods,callback,exports.StructureKind.Method)}function forDecoratableNode(structure,callback){return forAll(structure.decorators,callback,exports.StructureKind.Decorator)}function forClassStaticBlockDeclaration(structure,callback){return forJSDocableNode(structure,callback)||forStatementedNode(structure,callback)}function forStatementedNode(structure,callback){return forAllUnknownKindIfStructure(structure.statements,callback)}function forConstructorDeclarationOverload(structure,callback){return forSignaturedDeclaration(structure,callback)||forTypeParameteredNode(structure,callback)||forJSDocableNode(structure,callback)}function forConstructorDeclaration(structure,callback){return forFunctionLikeDeclaration(structure,callback)||forAll(structure.overloads,callback,exports.StructureKind.ConstructorOverload)}function forFunctionLikeDeclaration(structure,callback){return forSignaturedDeclaration(structure,callback)||forTypeParameteredNode(structure,callback)||forJSDocableNode(structure,callback)||forStatementedNode(structure,callback)}function forConstructSignatureDeclaration(structure,callback){return forJSDocableNode(structure,callback)||forSignaturedDeclaration(structure,callback)||forTypeParameteredNode(structure,callback)}function forEnumDeclaration(structure,callback){return forJSDocableNode(structure,callback)||forAll(structure.members,callback,exports.StructureKind.EnumMember)}function forEnumMember(structure,callback){return forJSDocableNode(structure,callback)}function forExportAssignment(structure,callback){return forJSDocableNode(structure,callback)}function forExportDeclaration(structure,callback){return forAllIfStructure(structure.namedExports,callback,exports.StructureKind.ExportSpecifier)||forAll(structure.attributes,callback,exports.StructureKind.ImportAttribute)}function forFunctionDeclarationOverload(structure,callback){return forSignaturedDeclaration(structure,callback)||forTypeParameteredNode(structure,callback)||forJSDocableNode(structure,callback)}function forFunctionDeclaration(structure,callback){return forFunctionLikeDeclaration(structure,callback)||forAll(structure.overloads,callback,exports.StructureKind.FunctionOverload)}function forGetAccessorDeclaration(structure,callback){return forDecoratableNode(structure,callback)||forFunctionLikeDeclaration(structure,callback)}function forImportDeclaration(structure,callback){return forAllIfStructure(structure.namedImports,callback,exports.StructureKind.ImportSpecifier)||forAll(structure.attributes,callback,exports.StructureKind.ImportAttribute)}function forIndexSignatureDeclaration(structure,callback){return forJSDocableNode(structure,callback)}function forInterfaceDeclaration(structure,callback){return forTypeParameteredNode(structure,callback)||forJSDocableNode(structure,callback)||forTypeElementMemberedNode(structure,callback)}function forTypeElementMemberedNode(structure,callback){return forAll(structure.callSignatures,callback,exports.StructureKind.CallSignature)||forAll(structure.constructSignatures,callback,exports.StructureKind.ConstructSignature)||forAll(structure.getAccessors,callback,exports.StructureKind.GetAccessor)||forAll(structure.indexSignatures,callback,exports.StructureKind.IndexSignature)||forAll(structure.methods,callback,exports.StructureKind.MethodSignature)||forAll(structure.properties,callback,exports.StructureKind.PropertySignature)||forAll(structure.setAccessors,callback,exports.StructureKind.SetAccessor)}function forJSDoc(structure,callback){return forAll(structure.tags,callback,exports.StructureKind.JSDocTag)}function forJsxElement(structure,callback){return forAllUnknownKindIfStructure(structure.attributes,callback)||forAllUnknownKindIfStructure(structure.children,callback)}function forJsxSelfClosingElement(structure,callback){return forJsxAttributedNode(structure,callback)}function forJsxAttributedNode(structure,callback){return forAllUnknownKindIfStructure(structure.attributes,callback)}function forMethodDeclarationOverload(structure,callback){return forSignaturedDeclaration(structure,callback)||forTypeParameteredNode(structure,callback)||forJSDocableNode(structure,callback)}function forMethodDeclaration(structure,callback){return forDecoratableNode(structure,callback)||forFunctionLikeDeclaration(structure,callback)||forAll(structure.overloads,callback,exports.StructureKind.MethodOverload)}function forMethodSignature(structure,callback){return forJSDocableNode(structure,callback)||forSignaturedDeclaration(structure,callback)||forTypeParameteredNode(structure,callback)}function forModuleDeclaration(structure,callback){return forJSDocableNode(structure,callback)||forStatementedNode(structure,callback)}function forParameterDeclaration(structure,callback){return forDecoratableNode(structure,callback)}function forPropertyDeclaration(structure,callback){return forJSDocableNode(structure,callback)||forDecoratableNode(structure,callback)}function forPropertySignature(structure,callback){return forJSDocableNode(structure,callback)}function forSetAccessorDeclaration(structure,callback){return forDecoratableNode(structure,callback)||forFunctionLikeDeclaration(structure,callback)}function forSourceFile(structure,callback){return forStatementedNode(structure,callback)}function forTypeAliasDeclaration(structure,callback){return forTypeParameteredNode(structure,callback)||forJSDocableNode(structure,callback)}function forVariableStatement(structure,callback){return forJSDocableNode(structure,callback)||forAll(structure.declarations,callback,exports.StructureKind.VariableDeclaration)}function forAll(structures,callback,kind){if(structures!=null)for(let structure of structures){let result=callback(ensureKind(structure,kind));if(result)return result}}function forAllIfStructure(values,callback,kind){if(!(values==null||!(values instanceof Array))){for(let value of values)if(isStructure(value)){let result=callback(ensureKind(value,kind));if(result)return result}}}function forAllUnknownKindIfStructure(values,callback){if(!(values==null||!(values instanceof Array))){for(let value of values)if(isStructure(value)){let result=callback(value);if(result)return result}}}function ensureKind(structure,kind){return structure.kind==null&&(structure.kind=kind),structure}function isStructure(value){return value!=null&&typeof value.kind=="number"}function isLastNonWhitespaceCharCloseBrace(writer){return writer.iterateLastCharCodes(charCode=>charCode===CharCodes.CLOSE_BRACE?!0:common.StringUtils.isWhitespaceCharCode(charCode)?void 0:!1)||!1}var ClassMemberStructurePrinter=class extends Printer{#options;#factory;constructor(factory,options){super(),this.#factory=factory,this.#options=options}printTexts(writer,members){if(members!=null)if(typeof members=="string"||members instanceof Function)this.printText(writer,members);else for(let member of members)isLastNonWhitespaceCharCloseBrace(writer)?writer.blankLineIfLastNot():writer.isAtStartOfFirstLineOfBlock()||writer.newLineIfLastNot(),this.printText(writer,member)}printText(writer,member){if(typeof member=="string"||member instanceof Function||member==null){this.printTextOrWriterFunc(writer,member);return}switch(member.kind){case exports.StructureKind.Method:this.#options.isAmbient||ensureBlankLine(),this.#factory.forMethodDeclaration(this.#options).printText(writer,member);break;case exports.StructureKind.Property:this.#factory.forPropertyDeclaration().printText(writer,member);break;case exports.StructureKind.GetAccessor:this.#options.isAmbient||ensureBlankLine(),this.#factory.forGetAccessorDeclaration(this.#options).printText(writer,member);break;case exports.StructureKind.SetAccessor:this.#options.isAmbient||ensureBlankLine(),this.#factory.forSetAccessorDeclaration(this.#options).printText(writer,member);break;case exports.StructureKind.Constructor:this.#options.isAmbient||ensureBlankLine(),this.#factory.forConstructorDeclaration(this.#options).printText(writer,member);break;case exports.StructureKind.ClassStaticBlock:ensureBlankLine(),this.#factory.forClassStaticBlockDeclaration().printText(writer,member);break;default:common.errors.throwNotImplementedForNeverValueError(member)}function ensureBlankLine(){writer.isAtStartOfFirstLineOfBlock()||writer.blankLineIfLastNot()}}},ClassStaticBlockDeclarationStructurePrinter=class extends NodePrinter{constructor(factory){super(factory)}printTexts(writer,structures){if(structures!=null)for(let i=0;i0&&writer.blankLine(),this.printText(writer,structures[i])}printTextInternal(writer,structure){writer.write("static"),writer.space().inlineBlock(()=>{this.factory.forStatementedNode({isAmbient:!1}).printText(writer,structure)})}},ConstructorDeclarationStructurePrinter=class extends NodePrinter{#options;constructor(factory,options){super(factory),this.#options=options}printTexts(writer,structures){if(structures!=null)for(let i=0;i0&&(this.#options.isAmbient?writer.newLine():writer.blankLine()),this.printText(writer,structures[i])}printTextInternal(writer,structure){this.#printOverloads(writer,getOverloadStructures()),this.#printHeader(writer,structure),this.#options.isAmbient?writer.write(";"):writer.space().inlineBlock(()=>{this.factory.forStatementedNode(this.#options).printText(writer,structure)});function getOverloadStructures(){let overloads=common.ObjectUtils.clone(structure.overloads);if(!(overloads==null||overloads.length===0)){for(let overload of overloads)setValueIfUndefined(overload,"scope",structure.scope);return overloads}}}#printOverloads(writer,structures){if(!(structures==null||structures.length===0))for(let structure of structures)this.printOverload(writer,structure),writer.newLine()}printOverload(writer,structure){this.printLeadingTrivia(writer,structure),this.#printHeader(writer,structure),writer.write(";"),this.printTrailingTrivia(writer,structure)}#printHeader(writer,structure){this.factory.forJSDoc().printDocs(writer,structure.docs),this.factory.forModifierableNode().printText(writer,structure),writer.write("constructor"),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(writer,structure.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(writer,structure.parameters)}},GetAccessorDeclarationStructurePrinter=class extends NodePrinter{#options;#multipleWriter;constructor(factory,options){super(factory),this.#options=options,this.#multipleWriter=this.#options.isAmbient?new NewLineFormattingStructuresPrinter(this):new BlankLineFormattingStructuresPrinter(this)}printTexts(writer,structures){structures!=null&&this.#multipleWriter.printText(writer,structures)}printTextInternal(writer,structure){this.factory.forJSDoc().printDocs(writer,structure.docs),this.factory.forDecorator().printTexts(writer,structure.decorators),this.factory.forModifierableNode().printText(writer,structure),writer.write(`get ${structure.name}`),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(writer,structure.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(writer,structure.parameters),this.factory.forReturnTypedNode().printText(writer,structure),this.#options.isAmbient||structure.isAbstract?writer.write(";"):writer.spaceIfLastNot().inlineBlock(()=>{this.factory.forStatementedNode(this.#options).printText(writer,structure)})}},MethodDeclarationStructurePrinter=class extends NodePrinter{#options;constructor(factory,options){super(factory),this.#options=options}printTexts(writer,structures){if(structures!=null)for(let i=0;i0&&(this.#options.isAmbient?writer.newLine():writer.blankLine()),this.printText(writer,structures[i])}printTextInternal(writer,structure){this.#printOverloads(writer,structure.name,getOverloadStructures()),this.#printHeader(writer,structure.name,structure),this.#options.isAmbient||structure.isAbstract?writer.write(";"):writer.spaceIfLastNot().inlineBlock(()=>{this.factory.forStatementedNode(this.#options).printText(writer,structure)});function getOverloadStructures(){let overloads=common.ObjectUtils.clone(structure.overloads);if(!(overloads==null||overloads.length===0)){for(let overload of overloads)setValueIfUndefined(overload,"scope",structure.scope),setValueIfUndefined(overload,"isStatic",structure.isStatic),setValueIfUndefined(overload,"isAbstract",structure.isAbstract),setValueIfUndefined(overload,"hasQuestionToken",structure.hasQuestionToken);return overloads}}}#printOverloads(writer,name,structures){if(!(structures==null||structures.length===0))for(let structure of structures)this.printOverload(writer,name,structure),writer.newLine()}printOverload(writer,name,structure){this.printLeadingTrivia(writer,structure),this.#printHeader(writer,name,structure),writer.write(";"),this.printTrailingTrivia(writer,structure)}#printHeader(writer,name,structure){this.factory.forJSDoc().printDocs(writer,structure.docs),structure.decorators!=null&&this.factory.forDecorator().printTexts(writer,structure.decorators),this.factory.forModifierableNode().printText(writer,structure),writer.conditionalWrite(structure.isGenerator,"*"),writer.write(name),writer.conditionalWrite(structure.hasQuestionToken,"?"),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(writer,structure.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(writer,structure.parameters),this.factory.forReturnTypedNode().printText(writer,structure)}},PropertyDeclarationStructurePrinter=class extends NodePrinter{#multipleWriter=new NewLineFormattingStructuresPrinter(this);printTexts(writer,structures){this.#multipleWriter.printText(writer,structures)}printTextInternal(writer,structure){this.factory.forJSDoc().printDocs(writer,structure.docs),this.factory.forDecorator().printTexts(writer,structure.decorators),this.factory.forModifierableNode().printText(writer,structure),writer.write(structure.name),writer.conditionalWrite(structure.hasQuestionToken,"?"),writer.conditionalWrite(structure.hasExclamationToken&&!structure.hasQuestionToken,"!"),this.factory.forTypedNode(":").printText(writer,structure),this.factory.forInitializerExpressionableNode().printText(writer,structure),writer.write(";")}},SetAccessorDeclarationStructurePrinter=class extends NodePrinter{#options;#multipleWriter;constructor(factory,options){super(factory),this.#options=options,this.#multipleWriter=this.#options.isAmbient?new NewLineFormattingStructuresPrinter(this):new BlankLineFormattingStructuresPrinter(this)}printTexts(writer,structures){structures!=null&&this.#multipleWriter.printText(writer,structures)}printTextInternal(writer,structure){this.factory.forJSDoc().printDocs(writer,structure.docs),this.factory.forDecorator().printTexts(writer,structure.decorators),this.factory.forModifierableNode().printText(writer,structure),writer.write(`set ${structure.name}`),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(writer,structure.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(writer,structure.parameters),this.factory.forReturnTypedNode().printText(writer,structure),this.#options.isAmbient||structure.isAbstract?writer.write(";"):writer.spaceIfLastNot().inlineBlock(()=>{this.factory.forStatementedNode(this.#options).printText(writer,structure)})}},StringStructurePrinter=class extends Printer{printText(writer,textOrWriterFunc){typeof textOrWriterFunc=="string"?writer.write(textOrWriterFunc):textOrWriterFunc(writer)}},DecoratorStructurePrinter=class extends NodePrinter{printTexts(writer,structures){this.#printMultiple(writer,structures,()=>writer.newLine())}printTextsInline(writer,structures){this.#printMultiple(writer,structures,()=>writer.space())}printTextInternal(writer,structure){writer.write(`@${structure.name}`),this.#printTypeArguments(writer,structure),this.#printArguments(writer,structure)}#printTypeArguments(writer,structure){if(!(structure.typeArguments==null||structure.typeArguments.length===0)){writer.write("<");for(let i=0;i0,", "),writer.write(this.getTextWithQueuedChildIndentation(writer,structure.typeArguments[i]));writer.write(">")}}#printArguments(writer,structure){if(structure.arguments==null)return;writer.write("(");let args=structure.arguments instanceof Array?structure.arguments:[structure.arguments];for(let i=0;i0,", "),writer.write(this.getTextWithQueuedChildIndentation(writer,args[i]));writer.write(")")}#printMultiple(writer,structures,separator){if(!(structures==null||structures.length===0))for(let structure of structures)this.printText(writer,structure),separator()}},JSDocStructurePrinter=class extends NodePrinter{printDocs(writer,structures){if(structures!=null)for(let structure of structures)this.printText(writer,structure),writer.newLine()}printTextInternal(writer,structure){let lines=getText2(this).split(/\r?\n/),startsWithNewLine=lines[0].length===0,isSingleLine=lines.length<=1,startIndex=startsWithNewLine?1:0;if(writer.write("/**"),isSingleLine?writer.space():writer.newLine(),isSingleLine)writer.write(lines[startIndex]);else for(let i=startIndex;i0&&writer.write(` ${lines[i]}`),writer.newLine();writer.spaceIfLastNot(),writer.write("*/");function getText2(jsdocPrinter){if(typeof structure=="string")return structure;let tempWriter=jsdocPrinter.getNewWriter(writer);return typeof structure=="function"?structure(tempWriter):(structure.description&&printTextFromStringOrWriter(tempWriter,structure.description),structure.tags&&structure.tags.length>0&&(tempWriter.getLength()>0&&tempWriter.newLine(),jsdocPrinter.factory.forJSDocTag({printStarsOnNewLine:!1}).printTexts(tempWriter,structure.tags))),tempWriter.toString()}}},JSDocTagStructurePrinter=class extends NodePrinter{#options;constructor(factory,options){super(factory),this.#options=options}printTexts(writer,structures){if(structures!=null)for(let i=0;i0&&(writer.newLine(),writer.conditionalWrite(this.#options.printStarsOnNewLine," * ")),this.printText(writer,structures[i])}printTextInternal(writer,structure){let lines=getText2(this).split(/\r?\n/);for(let i=0;i0&&(writer.newLine(),this.#options.printStarsOnNewLine&&writer.write(" *")),lines[i].length>0&&(this.#options.printStarsOnNewLine&&i>0&&writer.space(),writer.write(lines[i]));function getText2(tagPrinter){if(typeof structure=="string")return structure;let tempWriter=tagPrinter.getNewWriter(writer);if(typeof structure=="function")structure(tempWriter);else{structure.text&&printTextFromStringOrWriter(tempWriter,structure.text);let currentText=tempWriter.toString();tempWriter.unsafeInsert(0,`@${structure.tagName}`+(currentText.length>0&&!common.StringUtils.startsWithNewLine(currentText)?" ":""))}return tempWriter.toString()}}},EnumDeclarationStructurePrinter=class extends NodePrinter{#multipleWriter=new BlankLineFormattingStructuresPrinter(this);printTexts(writer,structures){this.#multipleWriter.printText(writer,structures)}printTextInternal(writer,structure){this.factory.forJSDoc().printDocs(writer,structure.docs),this.factory.forModifierableNode().printText(writer,structure),writer.conditionalWrite(structure.isConst,"const "),writer.write(`enum ${structure.name} `).inlineBlock(()=>{this.factory.forEnumMember().printTexts(writer,structure.members)})}},EnumMemberStructurePrinter=class extends NodePrinter{#multipleWriter=new CommaNewLineSeparatedStructuresPrinter(this);printTexts(writer,structures){this.#multipleWriter.printText(writer,structures)}printTextInternal(writer,structure){if(structure instanceof Function){structure(writer);return}else if(typeof structure=="string"){writer.write(structure);return}if(this.factory.forJSDoc().printDocs(writer,structure.docs),isValidVariableName(structure.name)||common.StringUtils.isQuoted(structure.name)?writer.write(structure.name):writer.quote(structure.name),typeof structure.value=="string"){let{value}=structure;writer.hangingIndent(()=>writer.write(" = ").quote(value))}else typeof structure.value=="number"?writer.write(` = ${structure.value}`):this.factory.forInitializerExpressionableNode().printText(writer,structure)}},ObjectLiteralExpressionPropertyStructurePrinter=class extends Printer{#factory;#multipleWriter=new CommaNewLineSeparatedStructuresPrinter(this);#options={isAmbient:!1};constructor(factory){super(),this.#factory=factory}printTexts(writer,members){this.#multipleWriter.printText(writer,members)}printText(writer,member){if(typeof member=="string"||member instanceof Function||member==null){this.printTextOrWriterFunc(writer,member);return}switch(member.kind){case exports.StructureKind.PropertyAssignment:this.#factory.forPropertyAssignment().printText(writer,member);break;case exports.StructureKind.ShorthandPropertyAssignment:this.#factory.forShorthandPropertyAssignment().printText(writer,member);break;case exports.StructureKind.SpreadAssignment:this.#factory.forSpreadAssignment().printText(writer,member);break;case exports.StructureKind.Method:this.#factory.forMethodDeclaration(this.#options).printText(writer,member);break;case exports.StructureKind.GetAccessor:this.#factory.forGetAccessorDeclaration(this.#options).printText(writer,member);break;case exports.StructureKind.SetAccessor:this.#factory.forSetAccessorDeclaration(this.#options).printText(writer,member);break;default:common.errors.throwNotImplementedForNeverValueError(member)}}},PropertyAssignmentStructurePrinter=class extends NodePrinter{printTextInternal(writer,structure){writer.hangingIndent(()=>{writer.write(`${structure.name}: `),printTextFromStringOrWriter(writer,structure.initializer)})}},ShorthandPropertyAssignmentStructurePrinter=class extends NodePrinter{printTextInternal(writer,structure){writer.write(`${structure.name}`)}},SpreadAssignmentStructurePrinter=class extends NodePrinter{printTextInternal(writer,structure){writer.hangingIndent(()=>{writer.write("..."),printTextFromStringOrWriter(writer,structure.expression)})}},FunctionDeclarationStructurePrinter=class extends NodePrinter{#options;constructor(factory,options){super(factory),this.#options=options}printTexts(writer,structures){if(structures!=null)for(let i=0;i0){let previousStructure=structures[i-1];this.#options.isAmbient||previousStructure.hasDeclareKeyword&¤tStructure.hasDeclareKeyword?writer.newLine():writer.blankLine()}this.printText(writer,currentStructure)}}printTextInternal(writer,structure){this.#printOverloads(writer,structure.name,getOverloadStructures()),this.#printHeader(writer,structure.name,structure),this.#options.isAmbient||structure.hasDeclareKeyword?writer.write(";"):writer.space().inlineBlock(()=>{this.factory.forStatementedNode({isAmbient:!1}).printText(writer,structure)});function getOverloadStructures(){let overloads=common.ObjectUtils.clone(structure.overloads);if(!(overloads==null||overloads.length===0)){for(let overload of overloads)setValueIfUndefined(overload,"hasDeclareKeyword",structure.hasDeclareKeyword),setValueIfUndefined(overload,"isExported",structure.isExported),setValueIfUndefined(overload,"isDefaultExport",structure.isDefaultExport);return overloads}}}#printOverloads(writer,name,structures){if(!(structures==null||structures.length===0))for(let structure of structures)this.printOverload(writer,name,structure),writer.newLine()}printOverload(writer,name,structure){this.printLeadingTrivia(writer,structure),this.#printHeader(writer,name,structure),writer.write(";"),this.printTrailingTrivia(writer,structure)}#printHeader(writer,name,structure){this.factory.forJSDoc().printDocs(writer,structure.docs),this.factory.forModifierableNode().printText(writer,structure),writer.write("function"),writer.conditionalWrite(structure.isGenerator,"*"),common.StringUtils.isNullOrWhitespace(name)||writer.write(` ${name}`),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(writer,structure.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(writer,structure.parameters),this.factory.forReturnTypedNode().printText(writer,structure)}},ParameterDeclarationStructurePrinter=class extends NodePrinter{#multipleWriter=new CommaSeparatedStructuresPrinter(this);printTextsWithParenthesis(writer,structures){writer.write("("),structures!=null&&this.factory.forParameterDeclaration().printTexts(writer,structures),writer.write(")")}printTexts(writer,structures){structures==null||structures.length===0||writer.hangingIndent(()=>{this.#multipleWriter.printText(writer,structures)})}printTextInternal(writer,structure){if(structure.name==null)throw new common.errors.NotImplementedError("Not implemented scenario where parameter declaration structure doesn't have a name. Please open an issue if you need this.");this.factory.forDecorator().printTextsInline(writer,structure.decorators),this.factory.forModifierableNode().printText(writer,structure),writer.conditionalWrite(structure.isRestParameter,"..."),writer.write(structure.name),writer.conditionalWrite(structure.hasQuestionToken,"?"),this.factory.forTypedNode(":",structure.hasQuestionToken).printText(writer,structure),this.factory.forInitializerExpressionableNode().printText(writer,structure)}},CallSignatureDeclarationStructurePrinter=class extends NodePrinter{#multipleWriter=new NewLineFormattingStructuresPrinter(this);printTexts(writer,structures){this.#multipleWriter.printText(writer,structures)}printTextInternal(writer,structure){this.factory.forJSDoc().printDocs(writer,structure.docs),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(writer,structure.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(writer,structure.parameters),this.factory.forReturnTypedNode(!0).printText(writer,structure),writer.write(";")}},ConstructSignatureDeclarationStructurePrinter=class extends NodePrinter{#multipleWriter=new NewLineFormattingStructuresPrinter(this);printTexts(writer,structures){this.#multipleWriter.printText(writer,structures)}printTextInternal(writer,structure){this.factory.forJSDoc().printDocs(writer,structure.docs),writer.write("new"),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(writer,structure.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(writer,structure.parameters),this.factory.forReturnTypedNode().printText(writer,structure),writer.write(";")}},IndexSignatureDeclarationStructurePrinter=class extends NodePrinter{#multipleWriter=new NewLineFormattingStructuresPrinter(this);printTexts(writer,structures){this.#multipleWriter.printText(writer,structures)}printTextInternal(writer,structure){this.factory.forJSDoc().printDocs(writer,structure.docs),this.factory.forModifierableNode().printText(writer,structure),writer.write(`[${structure.keyName||"key"}: ${structure.keyType||"string"}]`),this.factory.forReturnTypedNode().printText(writer,structure),writer.write(";")}},InterfaceDeclarationStructurePrinter=class extends NodePrinter{#multipleWriter=new BlankLineFormattingStructuresPrinter(this);printTexts(writer,structures){this.#multipleWriter.printText(writer,structures)}printTextInternal(writer,structure){if(this.factory.forJSDoc().printDocs(writer,structure.docs),this.factory.forModifierableNode().printText(writer,structure),writer.write(`interface ${structure.name}`),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(writer,structure.typeParameters),writer.space(),structure.extends!=null){let extendsText=structure.extends instanceof Array?structure.extends.map(i=>this.getText(writer,i)).join(", "):this.getText(writer,structure.extends);common.StringUtils.isNullOrWhitespace(extendsText)||writer.hangingIndent(()=>writer.write(`extends ${extendsText} `))}writer.inlineBlock(()=>{this.factory.forTypeElementMemberedNode().printText(writer,structure)})}},MethodSignatureStructurePrinter=class extends NodePrinter{#multipleWriter=new NewLineFormattingStructuresPrinter(this);printTexts(writer,structures){this.#multipleWriter.printText(writer,structures)}printTextInternal(writer,structure){this.factory.forJSDoc().printDocs(writer,structure.docs),writer.write(structure.name),writer.conditionalWrite(structure.hasQuestionToken,"?"),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(writer,structure.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(writer,structure.parameters),this.factory.forReturnTypedNode().printText(writer,structure),writer.write(";")}},PropertySignatureStructurePrinter=class extends NodePrinter{#multipleWriter=new NewLineFormattingStructuresPrinter(this);printTexts(writer,structures){this.#multipleWriter.printText(writer,structures)}printTextInternal(writer,structure){this.factory.forJSDoc().printDocs(writer,structure.docs),this.factory.forModifierableNode().printText(writer,structure),writer.write(structure.name),writer.conditionalWrite(structure.hasQuestionToken,"?"),this.factory.forTypedNode(":").printText(writer,structure),this.factory.forInitializerExpressionableNode().printText(writer,structure),writer.write(";")}},TypeElementMemberedNodeStructurePrinter=class extends Printer{#factory;constructor(factory){super(),this.#factory=factory}printText(writer,structure){this.#factory.forCallSignatureDeclaration().printTexts(writer,structure.callSignatures),this.#conditionalSeparator(writer,structure.constructSignatures),this.#factory.forConstructSignatureDeclaration().printTexts(writer,structure.constructSignatures),this.#conditionalSeparator(writer,structure.indexSignatures),this.#factory.forIndexSignatureDeclaration().printTexts(writer,structure.indexSignatures),this.#printGetAndSet(writer,structure),this.#conditionalSeparator(writer,structure.properties),this.#factory.forPropertySignature().printTexts(writer,structure.properties),this.#conditionalSeparator(writer,structure.methods),this.#factory.forMethodSignature().printTexts(writer,structure.methods)}#printGetAndSet(writer,structure){if(structure.getAccessors==null&&structure.setAccessors==null)return;let getAccessorWriter=this.#factory.forGetAccessorDeclaration({isAmbient:!0}),setAccessorWriter=this.#factory.forSetAccessorDeclaration({isAmbient:!0});new GetAndSetAccessorStructurePrinter(getAccessorWriter,setAccessorWriter).printGetAndSet(writer,structure.getAccessors,structure.setAccessors,!0)}#conditionalSeparator(writer,structures){!common.ArrayUtils.isNullOrEmpty(structures)&&!writer.isAtStartOfFirstLineOfBlock()&&writer.newLine()}},TypeElementMemberStructurePrinter=class extends Printer{#factory;constructor(factory){super(),this.#factory=factory}printTexts(writer,members){if(members!=null)if(typeof members=="string"||members instanceof Function)this.printText(writer,members);else for(let member of members)isLastNonWhitespaceCharCloseBrace(writer)?writer.blankLineIfLastNot():writer.isAtStartOfFirstLineOfBlock()||writer.newLineIfLastNot(),this.printText(writer,member)}printText(writer,members){if(typeof members=="string"||members instanceof Function||members==null){this.printTextOrWriterFunc(writer,members);return}switch(members.kind){case exports.StructureKind.PropertySignature:this.#factory.forPropertySignature().printText(writer,members);break;case exports.StructureKind.MethodSignature:this.#factory.forMethodSignature().printText(writer,members);break;case exports.StructureKind.CallSignature:this.#factory.forCallSignatureDeclaration().printText(writer,members);break;case exports.StructureKind.IndexSignature:this.#factory.forIndexSignatureDeclaration().printText(writer,members);break;case exports.StructureKind.ConstructSignature:this.#factory.forConstructSignatureDeclaration().printText(writer,members);break;default:common.errors.throwNotImplementedForNeverValueError(members)}}},JsxAttributeDeciderStructurePrinter=class extends NodePrinter{printTextInternal(writer,structure){if(isJsxAttribute())this.factory.forJsxAttribute().printTextWithoutTrivia(writer,structure);else if(structure.kind===exports.StructureKind.JsxSpreadAttribute)this.factory.forJsxSpreadAttribute().printTextWithoutTrivia(writer,structure);else throw common.errors.throwNotImplementedForNeverValueError(structure);function isJsxAttribute(struct){return structure.kind==null||structure.kind===exports.StructureKind.JsxAttribute}}},JsxAttributeStructurePrinter=class extends NodePrinter{printTextInternal(writer,structure){typeof structure.name=="object"?this.factory.forJsxNamespacedName().printText(writer,structure.name):writer.write(structure.name),structure.initializer!=null&&writer.write("=").write(structure.initializer)}},JsxChildDeciderStructurePrinter=class extends NodePrinter{printTextInternal(writer,structure){isJsxElement(structure)?this.factory.forJsxElement().printText(writer,structure):structure.kind===exports.StructureKind.JsxSelfClosingElement?this.factory.forJsxSelfClosingElement().printText(writer,structure):common.errors.throwNotImplementedForNeverValueError(structure);function isJsxElement(struct){return struct.kind==null||struct.kind===exports.StructureKind.JsxElement}}},JsxElementStructurePrinter=class extends NodePrinter{printTextInternal(writer,structure){writer.hangingIndent(()=>{writer.write(`<${structure.name}`),structure.attributes&&this.#printAttributes(writer,structure.attributes),writer.write(">")}),this.#printChildren(writer,structure.children),writer.write(``)}#printAttributes(writer,attributes){let attributePrinter=this.factory.forJsxAttributeDecider();for(let attrib of attributes)writer.space(),attributePrinter.printText(writer,attrib)}#printChildren(writer,children){children!=null&&(writer.newLine(),writer.indent(()=>{for(let child of children)this.factory.forJsxChildDecider().printText(writer,child),writer.newLine()}))}},JsxNamespacedNameStructurePrinter=class extends NodePrinter{printTextInternal(writer,structure){writer.write(structure.namespace).write(":").write(structure.name)}},JsxSelfClosingElementStructurePrinter=class extends NodePrinter{printTextInternal(writer,structure){writer.hangingIndent(()=>{writer.write(`<${structure.name}`),structure.attributes&&this.#printAttributes(writer,structure.attributes),writer.write(" />")})}#printAttributes(writer,attributes){let attributePrinter=this.factory.forJsxAttributeDecider();for(let attrib of attributes)writer.space(),attributePrinter.printText(writer,attrib)}},JsxSpreadAttributeStructurePrinter=class extends NodePrinter{printTextInternal(writer,structure){writer.hangingIndent(()=>{writer.write("{"),writer.write("..."),writer.write(structure.expression),writer.write("}")})}},ExportAssignmentStructurePrinter=class extends NodePrinter{#multipleWriter=new NewLineFormattingStructuresPrinter(this);printTexts(writer,structures){this.#multipleWriter.printText(writer,structures)}printTextInternal(writer,structure){this.factory.forJSDoc().printDocs(writer,structure.docs),writer.write("export"),structure.isExportEquals!==!1?writer.write(" = "):writer.write(" default "),writer.write(this.getTextWithQueuedChildIndentation(writer,structure.expression)).write(";")}},ExportDeclarationStructurePrinter=class extends NodePrinter{#multipleWriter=new NewLineFormattingStructuresPrinter(this);printTexts(writer,structures){this.#multipleWriter.printText(writer,structures)}printTextInternal(writer,structure){let hasModuleSpecifier=structure.moduleSpecifier!=null&&structure.moduleSpecifier.length>0;if(structure.namedExports!=null&&structure.namedExports.length>0&&structure.namespaceExport!=null)throw new common.errors.InvalidOperationError("An export declaration cannot have both a namespace export and a named export.");writer.write("export"),structure.isTypeOnly&&writer.write(" type"),structure.namedExports!=null&&structure.namedExports.length>0?(writer.space(),this.factory.forNamedImportExportSpecifier().printTextsWithBraces(writer,structure.namedExports)):structure.namespaceExport!=null?(writer.write(" *"),common.StringUtils.isNullOrWhitespace(structure.namespaceExport)||writer.write(` as ${structure.namespaceExport}`)):hasModuleSpecifier?writer.write(" *"):writer.write(" {").conditionalWrite(this.factory.getFormatCodeSettings().insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces," ").write("}"),hasModuleSpecifier&&(writer.write(" from "),writer.quote(structure.moduleSpecifier)),structure.attributes&&(writer.space(),this.factory.forImportAttribute().printAttributes(writer,structure.attributes)),writer.write(";")}},ImportAttributeStructurePrinter=class extends NodePrinter{#multipleWriter=new CommaNewLineSeparatedStructuresPrinter(this);printTexts(writer,structures){this.#multipleWriter.printText(writer,structures)}printAttributes(writer,structures){structures&&(writer.write("with "),writer.inlineBlock(()=>{this.printTexts(writer,structures)}))}printTextInternal(writer,structure){writer.write(structure.name),writer.write(": "),writer.quote(structure.value)}},ImportDeclarationStructurePrinter=class extends NodePrinter{#multipleWriter=new NewLineFormattingStructuresPrinter(this);printTexts(writer,structures){this.#multipleWriter.printText(writer,structures)}printTextInternal(writer,structure){let hasNamedImport=structure.namedImports!=null&&structure.namedImports.length>0;if(hasNamedImport&&structure.namespaceImport!=null)throw new common.errors.InvalidOperationError("An import declaration cannot have both a namespace import and a named import.");writer.write("import"),structure.isTypeOnly&&writer.write(" type"),structure.defaultImport!=null&&(writer.write(` ${structure.defaultImport}`),writer.conditionalWrite(hasNamedImport||structure.namespaceImport!=null,",")),structure.namespaceImport!=null&&writer.write(` * as ${structure.namespaceImport}`),structure.namedImports!=null&&structure.namedImports.length>0&&(writer.space(),this.factory.forNamedImportExportSpecifier().printTextsWithBraces(writer,structure.namedImports)),writer.conditionalWrite(structure.defaultImport!=null||hasNamedImport||structure.namespaceImport!=null," from"),writer.write(" "),writer.quote(structure.moduleSpecifier),structure.attributes&&(writer.space(),this.factory.forImportAttribute().printAttributes(writer,structure.attributes)),writer.write(";")}},ModuleDeclarationStructurePrinter=class extends NodePrinter{#options;#blankLineFormattingWriter=new BlankLineFormattingStructuresPrinter(this);constructor(factory,options){super(factory),this.#options=options}printTexts(writer,structures){this.#blankLineFormattingWriter.printText(writer,structures)}printTextInternal(writer,structure){structure=this.#validateAndGetStructure(structure),this.factory.forJSDoc().printDocs(writer,structure.docs),this.factory.forModifierableNode().printText(writer,structure),structure.declarationKind==null||structure.declarationKind!==exports.ModuleDeclarationKind.Global?writer.write(`${structure.declarationKind||"namespace"} ${structure.name}`):writer.write("global"),structure.hasDeclareKeyword&&common.StringUtils.isQuoted(structure.name.trim())&&structure.hasOwnProperty(common.nameof(structure,"statements"))&&structure.statements==null?writer.write(";"):(writer.write(" "),writer.inlineBlock(()=>{this.factory.forStatementedNode({isAmbient:structure.hasDeclareKeyword||this.#options.isAmbient}).printText(writer,structure)}))}#validateAndGetStructure(structure){if(common.StringUtils.isQuoted(structure.name.trim())){if(structure.declarationKind===exports.ModuleDeclarationKind.Namespace)throw new common.errors.InvalidOperationError(`Cannot print a namespace with quotes for namespace with name ${structure.name}. Use ModuleDeclarationKind.Module instead.`);structure=common.ObjectUtils.clone(structure),setValueIfUndefined(structure,"hasDeclareKeyword",!0),setValueIfUndefined(structure,"declarationKind",exports.ModuleDeclarationKind.Module)}return structure}},NamedImportExportSpecifierStructurePrinter=class extends NodePrinter{#multipleWriter=new CommaSeparatedStructuresPrinter(this);printTextsWithBraces(writer,structures){let formatSettings=this.factory.getFormatCodeSettings();writer.write("{");let specifierWriter=this.getNewWriter(writer);this.printTexts(specifierWriter,structures);let specifierText=specifierWriter.toString();formatSettings.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces&&!common.StringUtils.startsWithNewLine(specifierText)&&writer.space(),writer.write(specifierText),formatSettings.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces&&!common.StringUtils.endsWithNewLine(specifierText)&&writer.space(),writer.write("}")}printTexts(writer,structures){structures instanceof Function?this.printText(writer,structures):this.#multipleWriter.printText(writer,structures)}printTextInternal(writer,structure){let specifierWriter=this.getNewWriterWithQueuedChildIndentation(writer);typeof structure=="string"?specifierWriter.write(structure):structure instanceof Function?structure(specifierWriter):(structure.isTypeOnly&&writer.write("type "),specifierWriter.write(structure.name),common.StringUtils.isNullOrWhitespace(structure.alias)||(specifierWriter.isLastNewLine()||specifierWriter.space(),specifierWriter.write(`as ${structure.alias}`))),writer.write(specifierWriter.toString())}},SourceFileStructurePrinter=class extends NodePrinter{#options;constructor(factory,options){super(factory),this.#options=options}printTextInternal(writer,structure){this.factory.forStatementedNode(this.#options).printText(writer,structure),writer.conditionalNewLine(!writer.isAtStartOfFirstLineOfBlock()&&!writer.isLastNewLine())}},StatementedNodeStructurePrinter=class extends Printer{#options;#factory;constructor(factory,options){super(),this.#factory=factory,this.#options=options}printText(writer,structure){this.#factory.forStatement(this.#options).printTexts(writer,structure.statements)}},StatementStructurePrinter=class extends Printer{#options;#factory;constructor(factory,options){super(),this.#factory=factory,this.#options=options}printTexts(writer,statements){if(statements!=null)if(typeof statements=="string"||statements instanceof Function)this.printText(writer,statements);else for(let statement of statements)isLastNonWhitespaceCharCloseBrace(writer)?writer.blankLineIfLastNot():writer.isAtStartOfFirstLineOfBlock()||writer.newLineIfLastNot(),this.printText(writer,statement)}printText(writer,statement){if(typeof statement=="string"||statement instanceof Function||statement==null){this.printTextOrWriterFunc(writer,statement);return}switch(statement.kind){case exports.StructureKind.Function:this.#options.isAmbient||ensureBlankLine(),this.#factory.forFunctionDeclaration(this.#options).printText(writer,statement);break;case exports.StructureKind.Class:ensureBlankLine(),this.#factory.forClassDeclaration(this.#options).printText(writer,statement);break;case exports.StructureKind.Interface:ensureBlankLine(),this.#factory.forInterfaceDeclaration().printText(writer,statement);break;case exports.StructureKind.TypeAlias:this.#factory.forTypeAliasDeclaration().printText(writer,statement);break;case exports.StructureKind.VariableStatement:this.#factory.forVariableStatement().printText(writer,statement);break;case exports.StructureKind.ImportDeclaration:this.#factory.forImportDeclaration().printText(writer,statement);break;case exports.StructureKind.Module:ensureBlankLine(),this.#factory.forModuleDeclaration(this.#options).printText(writer,statement);break;case exports.StructureKind.Enum:ensureBlankLine(),this.#factory.forEnumDeclaration().printText(writer,statement);break;case exports.StructureKind.ExportDeclaration:this.#factory.forExportDeclaration().printText(writer,statement);break;case exports.StructureKind.ExportAssignment:this.#factory.forExportAssignment().printText(writer,statement);break;default:common.errors.throwNotImplementedForNeverValueError(statement)}function ensureBlankLine(){writer.isAtStartOfFirstLineOfBlock()||writer.blankLineIfLastNot()}}};exports.VariableDeclarationKind=void 0;(function(VariableDeclarationKind){VariableDeclarationKind.Var="var",VariableDeclarationKind.Let="let",VariableDeclarationKind.Const="const",VariableDeclarationKind.AwaitUsing="await using",VariableDeclarationKind.Using="using"})(exports.VariableDeclarationKind||(exports.VariableDeclarationKind={}));var VariableStatementStructurePrinter=class extends NodePrinter{#multipleWriter=new NewLineFormattingStructuresPrinter(this);printTexts(writer,structures){this.#multipleWriter.printText(writer,structures)}printTextInternal(writer,structure){this.factory.forJSDoc().printDocs(writer,structure.docs),writer.hangingIndent(()=>{this.factory.forModifierableNode().printText(writer,structure),writer.write(`${structure.declarationKind||exports.VariableDeclarationKind.Let} `),this.factory.forVariableDeclaration().printTexts(writer,structure.declarations),writer.write(";")})}},TypeAliasDeclarationStructurePrinter=class extends NodePrinter{#multipleWriter=new NewLineFormattingStructuresPrinter(this);printTexts(writer,structures){this.#multipleWriter.printText(writer,structures)}printTextInternal(writer,structure){this.factory.forJSDoc().printDocs(writer,structure.docs),this.factory.forModifierableNode().printText(writer,structure),writer.write(`type ${structure.name}`),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(writer,structure.typeParameters),this.factory.forTypedNode(" =").printText(writer,structure),writer.write(";")}},TypeParameterDeclarationStructurePrinter=class extends NodePrinter{#multipleWriter=new CommaSeparatedStructuresPrinter(this);printTextsWithBrackets(writer,structures){structures==null||structures.length===0||(writer.write("<"),this.printTexts(writer,structures),writer.write(">"))}printTexts(writer,structures){this.#multipleWriter.printText(writer,structures)}printTextInternal(writer,structure){if(typeof structure=="string"){writer.write(structure);return}writer.hangingIndent(()=>{if(structure.isConst&&writer.write("const "),structure.variance!=null&&(structure.variance&exports.TypeParameterVariance.In&&writer.write("in "),structure.variance&exports.TypeParameterVariance.Out&&writer.write("out ")),writer.write(structure.name),structure.constraint!=null){let constraintText=this.getText(writer,structure.constraint);common.StringUtils.isNullOrWhitespace(constraintText)||writer.write(` extends ${constraintText}`)}if(structure.default!=null){let defaultText=this.getText(writer,structure.default);common.StringUtils.isNullOrWhitespace(defaultText)||writer.write(` = ${defaultText}`)}})}},VariableDeclarationStructurePrinter=class extends NodePrinter{#multipleWriter=new CommaSeparatedStructuresPrinter(this);printTexts(writer,structures){this.#multipleWriter.printText(writer,structures)}printTextInternal(writer,structure){writer.write(structure.name),writer.conditionalWrite(structure.hasExclamationToken,"!"),this.factory.forTypedNode(":").printText(writer,structure),this.factory.forInitializerExpressionableNode().printText(writer,structure)}};function ExtendsClauseableNode(Base){return class extends Base{getExtends(){return this.getHeritageClauseByKind(common.SyntaxKind.ExtendsKeyword)?.getTypeNodes()??[]}addExtends(text){return this.insertExtends(this.getExtends().length,text)}insertExtends(index,texts){let originalExtends=this.getExtends(),wasStringInput=typeof texts=="string";if(typeof texts=="string")common.errors.throwIfWhitespaceOrNotString(texts,"texts"),texts=[texts];else if(texts.length===0)return[];let writer=this._getWriterWithQueuedChildIndentation();if(new CommaSeparatedStructuresPrinter(new StringStructurePrinter).printText(writer,texts),index=verifyAndGetIndex(index,originalExtends.length),originalExtends.length>0){let extendsClause=this.getHeritageClauseByKindOrThrow(common.SyntaxKind.ExtendsKeyword);insertIntoCommaSeparatedNodes({parent:extendsClause.getFirstChildByKindOrThrow(common.SyntaxKind.SyntaxList),currentNodes:originalExtends,insertIndex:index,newText:writer.toString(),useTrailingCommas:!1})}else{let openBraceStart=this.getFirstChildByKindOrThrow(common.SyntaxKind.OpenBraceToken).getStart(),isLastSpace=/\s/.test(this.getSourceFile().getFullText()[openBraceStart-1]),insertText=`extends ${writer.toString()} `;isLastSpace||(insertText=" "+insertText),insertIntoParentTextRange({parent:this,insertPos:openBraceStart,newText:insertText})}let newExtends=this.getExtends();return wasStringInput?newExtends[index]:getNodesToReturn(originalExtends,newExtends,index,!1)}removeExtends(implementsNodeOrIndex){let extendsClause=this.getHeritageClauseByKind(common.SyntaxKind.ExtendsKeyword);if(extendsClause==null)throw new common.errors.InvalidOperationError("Cannot remove an extends when none exist.");return extendsClause.removeExpression(implementsNodeOrIndex),this}set(structure){return callBaseSet(Base.prototype,this,structure),structure.extends!=null&&(this.getExtends().forEach(e=>this.removeExtends(e)),this.addExtends(structure.extends)),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{extends:this.getExtends().map(e=>e.getText())})}}}function GeneratorableNode(Base){return class extends Base{isGenerator(){return this.compilerNode.asteriskToken!=null}getAsteriskToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.asteriskToken)}getAsteriskTokenOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getAsteriskToken(),message??"Expected to find an asterisk token.",this)}setIsGenerator(value){let asteriskToken=this.getAsteriskToken();return asteriskToken!=null===value?this:(asteriskToken==null?insertIntoParentTextRange({insertPos:getAsteriskInsertPos(this),parent:this,newText:"*"}):removeChildrenWithFormatting({children:[asteriskToken],getSiblingFormatting:()=>FormattingKind.Space}),this)}set(structure){return callBaseSet(Base.prototype,this,structure),structure.isGenerator!=null&&this.setIsGenerator(structure.isGenerator),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{isGenerator:this.isGenerator()})}}}function getAsteriskInsertPos(node){if(node.getKind()===common.SyntaxKind.FunctionDeclaration)return node.getFirstChildByKindOrThrow(common.SyntaxKind.FunctionKeyword).getEnd();let namedNode=node;if(namedNode.getName==null)throw new common.errors.NotImplementedError("Expected a name node for a non-function declaration.");return namedNode.getNameNode().getStart()}function HeritageClauseableNode(Base){return class extends Base{getHeritageClauses(){return this.compilerNode.heritageClauses?.map(c=>this._getNodeFromCompilerNode(c))??[]}getHeritageClauseByKindOrThrow(kind,message){return common.errors.throwIfNullOrUndefined(this.getHeritageClauseByKind(kind),message??(()=>`Expected to have heritage clause of kind ${common.getSyntaxKindName(kind)}.`),this)}getHeritageClauseByKind(kind){return this.getHeritageClauses().find(c=>c.compilerNode.token===kind)}}}function ImplementsClauseableNode(Base){return class extends Base{getImplements(){return this.getHeritageClauseByKind(common.SyntaxKind.ImplementsKeyword)?.getTypeNodes()??[]}addImplements(text){return this.insertImplements(this.getImplements().length,text)}insertImplements(index,texts){let originalImplements=this.getImplements(),wasStringInput=typeof texts=="string";if(typeof texts=="string")common.errors.throwIfWhitespaceOrNotString(texts,"texts"),texts=[texts];else if(texts.length===0)return[];let writer=this._getWriterWithQueuedChildIndentation();new CommaSeparatedStructuresPrinter(new StringStructurePrinter).printText(writer,texts);let heritageClauses=this.getHeritageClauses();if(index=verifyAndGetIndex(index,originalImplements.length),originalImplements.length>0){let implementsClause=this.getHeritageClauseByKindOrThrow(common.SyntaxKind.ImplementsKeyword);insertIntoCommaSeparatedNodes({parent:implementsClause.getFirstChildByKindOrThrow(common.SyntaxKind.SyntaxList),currentNodes:originalImplements,insertIndex:index,newText:writer.toString(),useTrailingCommas:!1})}else{let openBraceStart=this.getFirstChildByKindOrThrow(common.SyntaxKind.OpenBraceToken).getStart(),isLastSpace=/\s/.test(this.getSourceFile().getFullText()[openBraceStart-1]),insertText=`implements ${writer.toString()} `;isLastSpace||(insertText=" "+insertText),insertIntoParentTextRange({parent:heritageClauses.length===0?this:heritageClauses[0].getParentSyntaxListOrThrow(),insertPos:openBraceStart,newText:insertText})}let newImplements=this.getImplements();return wasStringInput?newImplements[0]:getNodesToReturn(originalImplements,newImplements,index,!1)}removeImplements(implementsNodeOrIndex){let implementsClause=this.getHeritageClauseByKind(common.SyntaxKind.ImplementsKeyword);if(implementsClause==null)throw new common.errors.InvalidOperationError("Cannot remove an implements when none exist.");return implementsClause.removeExpression(implementsNodeOrIndex),this}set(structure){return callBaseSet(Base.prototype,this,structure),structure.implements!=null&&(this.getImplements().forEach(expr=>this.removeImplements(expr)),this.addImplements(structure.implements)),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{implements:this.getImplements().map(node=>node.getText())})}}}function InitializerExpressionGetableNode(Base){return class extends Base{hasInitializer(){return this.compilerNode.initializer!=null}getInitializerIfKindOrThrow(kind,message){return common.errors.throwIfNullOrUndefined(this.getInitializerIfKind(kind),message??`Expected to find an initializer of kind '${common.getSyntaxKindName(kind)}'.`,this)}getInitializerIfKind(kind){let initializer=this.getInitializer();if(!(initializer!=null&&initializer.getKind()!==kind))return initializer}getInitializerOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getInitializer(),message??"Expected to find an initializer.",this)}getInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.initializer)}}}function InitializerExpressionableNode(Base){return apply(InitializerExpressionGetableNode(Base))}function apply(Base){return class extends Base{removeInitializer(){let initializer=this.getInitializer();if(initializer==null)return this;let previousSibling=initializer.getPreviousSiblingIfKindOrThrow(common.SyntaxKind.EqualsToken);return removeChildren({children:[previousSibling,initializer],removePrecedingSpaces:!0}),this}setInitializer(textOrWriterFunction){let text=getTextFromStringOrWriter(this._getWriterWithQueuedChildIndentation(),textOrWriterFunction);common.errors.throwIfWhitespaceOrNotString(text,"textOrWriterFunction"),this.hasInitializer()&&this.removeInitializer();let semiColonToken=this.getLastChildIfKind(common.SyntaxKind.SemicolonToken);return insertIntoParentTextRange({insertPos:semiColonToken!=null?semiColonToken.getPos():this.getEnd(),parent:this,newText:` = ${text}`}),this}set(structure){return callBaseSet(Base.prototype,this,structure),structure.initializer!=null?this.setInitializer(structure.initializer):structure.hasOwnProperty(common.nameof(structure,"initializer"))&&this.removeInitializer(),this}getStructure(){let initializer=this.getInitializer();return callBaseGetStructure(Base.prototype,this,{initializer:initializer?initializer.getText():void 0})}}}function JSDocableNode(Base){return class extends Base{getJsDocs(){return this.compilerNode.jsDoc?.map(n=>this._getNodeFromCompilerNode(n))??[]}addJsDoc(structure){return this.addJsDocs([structure])[0]}addJsDocs(structures){return this.insertJsDocs(getEndIndexFromArray(this.compilerNode.jsDoc),structures)}insertJsDoc(index,structure){return this.insertJsDocs(index,[structure])[0]}insertJsDocs(index,structures){if(common.ArrayUtils.isNullOrEmpty(structures))return[];let writer=this._getWriterWithQueuedIndentation();this._context.structurePrinterFactory.forJSDoc().printDocs(writer,structures),writer.write("");let code=writer.toString(),nodes=this.getJsDocs();index=verifyAndGetIndex(index,nodes.length);let insertPos=index===nodes.length?this.getStart():nodes[index].getStart();return insertIntoParentTextRange({insertPos,parent:this,newText:code}),getNodesToReturn(nodes,this.getJsDocs(),index,!1)}set(structure){return callBaseSet(Base.prototype,this,structure),structure.docs!=null&&(this.getJsDocs().forEach(doc=>doc.remove()),this.addJsDocs(structure.docs)),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{docs:this.getJsDocs().map(jsdoc=>jsdoc.getStructure())})}}}function LiteralLikeNode(Base){return class extends Base{getLiteralText(){return this.compilerNode.text}isTerminated(){return!this.compilerNode.isUnterminated}hasExtendedUnicodeEscape(){return this.compilerNode.hasExtendedUnicodeEscape||!1}}}function ModifierableNode(Base){return class extends Base{getModifiers(){return this.getCompilerModifiers().map(m=>this._getNodeFromCompilerNode(m))}getFirstModifierByKindOrThrow(kind,message){return common.errors.throwIfNullOrUndefined(this.getFirstModifierByKind(kind),message??(()=>`Expected a modifier of syntax kind: ${common.getSyntaxKindName(kind)}`),this)}getFirstModifierByKind(kind){for(let modifier of this.getCompilerModifiers())if(modifier.kind===kind)return this._getNodeFromCompilerNode(modifier)}hasModifier(textOrKind){return typeof textOrKind=="string"?this.getModifiers().some(m=>m.getText()===textOrKind):this.getCompilerModifiers().some(m=>m.kind===textOrKind)}toggleModifier(text,value){return value==null&&(value=!this.hasModifier(text)),value?this.addModifier(text):this.removeModifier(text),this}addModifier(text){let rawModifiers=this.getModifiers(),modifiers=this.getModifiers().filter(m=>m.getKind()!==common.SyntaxKind.Decorator),existingModifier=modifiers.find(m=>m.getText()===text);if(existingModifier!=null)return existingModifier;let insertPos=getInsertPos2(this),startPos,newText;return modifiers.length===0||insertPos===modifiers[0].getStart()?(newText=text+" ",startPos=insertPos):(newText=" "+text,startPos=insertPos+1),insertIntoParentTextRange({parent:rawModifiers.length===0?this:rawModifiers[0].getParentSyntaxListOrThrow(),insertPos,newText}),this.getModifiers().find(m=>m.getStart()===startPos);function getInsertPos2(node){let pos=getInitialInsertPos();for(let addAfterText of getAddAfterModifierTexts(text))for(let i=0;i0)return modifiers[0].getStart();for(let child of node._getChildrenIterator())if(!(child.getKind()===common.SyntaxKind.SyntaxList||common.ts.isJSDocCommentContainingNode(child.compilerNode)))return child.getStart();return node.getStart()}}}removeModifier(text){let modifiers=this.getModifiers(),modifier=modifiers.find(m=>m.getText()===text);return modifier==null?!1:(removeChildren({children:[modifiers.length===1?modifier.getParentSyntaxListOrThrow():modifier],removeFollowingSpaces:!0}),!0)}getCompilerModifiers(){return this.compilerNode.modifiers??[]}}}function getAddAfterModifierTexts(text){switch(text){case"export":return[];case"public":case"protected":case"private":return[];case"default":return["export"];case"const":return["export"];case"declare":return["export","default"];case"static":return["public","protected","private"];case"override":return["public","private","protected","static"];case"abstract":return["export","default","declare","public","private","protected","static","override"];case"async":return["export","default","declare","public","private","protected","static","override","abstract"];case"readonly":return["export","default","declare","public","private","protected","static","override","abstract"];case"out":return["const","in"];case"in":return["const"];case"accessor":return["public","private","protected","declare","override","static","abstract","readonly"];default:common.errors.throwNotImplementedForNeverValueError(text)}}function ModuledNode(Base){return class extends Base{addImportDeclaration(structure){return this.addImportDeclarations([structure])[0]}addImportDeclarations(structures){let compilerChildren=this._getCompilerStatementsWithComments();return this.insertImportDeclarations(getInsertIndex(),structures);function getInsertIndex(){let insertIndex=0,wasLastComment=!0;for(let i=0;i{this._standardWrite(writer,info,()=>{this._context.structurePrinterFactory.forImportDeclaration().printTexts(writer,structures)},{previousNewLine:previousMember=>Node.isImportDeclaration(previousMember)||isComment(previousMember.compilerNode),nextNewLine:nextMember=>Node.isImportDeclaration(nextMember)})}})}getImportDeclaration(conditionOrModuleSpecifier){return this.getImportDeclarations().find(getCondition());function getCondition(){return typeof conditionOrModuleSpecifier=="string"?dec=>dec.getModuleSpecifierValue()===conditionOrModuleSpecifier:conditionOrModuleSpecifier}}getImportDeclarationOrThrow(conditionOrModuleSpecifier,message){return common.errors.throwIfNullOrUndefined(this.getImportDeclaration(conditionOrModuleSpecifier),message??"Expected to find an import with the provided condition.",this)}getImportDeclarations(){return this.getStatements().filter(Node.isImportDeclaration)}addExportDeclaration(structure){return this.addExportDeclarations([structure])[0]}addExportDeclarations(structures){return this.insertExportDeclarations(this.getChildSyntaxListOrThrow().getChildCount(),structures)}insertExportDeclaration(index,structure){return this.insertExportDeclarations(index,[structure])[0]}insertExportDeclarations(index,structures){return this._insertChildren({expectedKind:common.SyntaxKind.ExportDeclaration,index,structures,write:(writer,info)=>{this._standardWrite(writer,info,()=>{this._context.structurePrinterFactory.forExportDeclaration().printTexts(writer,structures)},{previousNewLine:previousMember=>Node.isExportDeclaration(previousMember)||isComment(previousMember.compilerNode),nextNewLine:nextMember=>Node.isExportDeclaration(nextMember)})}})}getExportDeclaration(conditionOrModuleSpecifier){return this.getExportDeclarations().find(getCondition());function getCondition(){return typeof conditionOrModuleSpecifier=="string"?dec=>dec.getModuleSpecifierValue()===conditionOrModuleSpecifier:conditionOrModuleSpecifier}}getExportDeclarationOrThrow(conditionOrModuleSpecifier,message){return common.errors.throwIfNullOrUndefined(this.getExportDeclaration(conditionOrModuleSpecifier),message??"Expected to find an export declaration with the provided condition.",this)}getExportDeclarations(){return this.getStatements().filter(Node.isExportDeclaration)}addExportAssignment(structure){return this.addExportAssignments([structure])[0]}addExportAssignments(structures){return this.insertExportAssignments(this.getChildSyntaxListOrThrow().getChildCount(),structures)}insertExportAssignment(index,structure){return this.insertExportAssignments(index,[structure])[0]}insertExportAssignments(index,structures){return this._insertChildren({expectedKind:common.SyntaxKind.ExportAssignment,index,structures,write:(writer,info)=>{this._standardWrite(writer,info,()=>{this._context.structurePrinterFactory.forExportAssignment().printTexts(writer,structures)},{previousNewLine:previousMember=>Node.isExportAssignment(previousMember)||isComment(previousMember.compilerNode),nextNewLine:nextMember=>Node.isExportAssignment(nextMember)})}})}getExportAssignment(condition){return this.getExportAssignments().find(condition)}getExportAssignmentOrThrow(condition,message){return common.errors.throwIfNullOrUndefined(this.getExportAssignment(condition),message??"Expected to find an export assignment with the provided condition.",this)}getExportAssignments(){return this.getStatements().filter(Node.isExportAssignment)}getDefaultExportSymbol(){let sourceFileSymbol=this.getSymbol();if(sourceFileSymbol!=null)return sourceFileSymbol.getExport("default")}getDefaultExportSymbolOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getDefaultExportSymbol(),message??"Expected to find a default export symbol")}getExportSymbols(){let symbol=this.getSymbol();return symbol==null?[]:this._context.typeChecker.getExportsOfModule(symbol)}getExportedDeclarations(){let result=new Map,exportSymbols=this.getExportSymbols();for(let symbol of exportSymbols)for(let declaration of symbol.getDeclarations()){let declarations=Array.from(getDeclarationHandlingImportsAndExports(declaration)),name=symbol.getName(),existingArray=result.get(name);existingArray!=null?existingArray.push(...declarations):result.set(symbol.getName(),declarations)}return result;function*getDeclarationHandlingImportsAndExports(declaration){if(Node.isExportSpecifier(declaration))for(let d of declaration.getLocalTargetDeclarations())yield*getDeclarationHandlingImportsAndExports(d);else if(Node.isExportAssignment(declaration)){let expression=declaration.getExpression();if(expression==null||expression.getKind()!==common.SyntaxKind.Identifier){yield expression;return}yield*getDeclarationsForSymbol(expression.getSymbol())}else if(Node.isImportSpecifier(declaration)){let symbol=declaration.getNameNode().getSymbol();if(symbol==null)return;yield*getDeclarationsForSymbol(symbol.getAliasedSymbol()||symbol)}else if(Node.isImportClause(declaration)){let identifier=declaration.getDefaultImport();if(identifier==null)return;let symbol=identifier.getSymbol();if(symbol==null)return;yield*getDeclarationsForSymbol(symbol.getAliasedSymbol()||symbol)}else if(Node.isNamespaceImport(declaration)||Node.isNamespaceExport(declaration)){let symbol=declaration.getNameNode().getSymbol();if(symbol==null)return;yield*getDeclarationsForSymbol(symbol.getAliasedSymbol()||symbol)}else yield declaration;function*getDeclarationsForSymbol(symbol){if(symbol!=null)for(let d of symbol.getDeclarations())yield*getDeclarationHandlingImportsAndExports(d)}}}removeDefaultExport(defaultExportSymbol){if(defaultExportSymbol=defaultExportSymbol||this.getDefaultExportSymbol(),defaultExportSymbol==null)return this;let declaration=defaultExportSymbol.getDeclarations()[0];return declaration.compilerNode.kind===common.SyntaxKind.ExportAssignment?removeChildrenWithFormatting({children:[declaration],getSiblingFormatting:()=>FormattingKind.Newline}):Node.isModifierable(declaration)&&(declaration.toggleModifier("default",!1),declaration.toggleModifier("export",!1)),this}}}function NamedNodeBase(Base){return class extends Base{getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}getName(){return this.getNameNode().getText()}set(structure){return callBaseSet(Base.prototype,this,structure),structure.name!=null&&this.getNameNode().replaceWithText(structure.name),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{name:this.getName()})}}}function ReferenceFindableNode(Base){return class extends Base{findReferences(){return this._context.languageService.findReferences(getNodeForReferences(this))}findReferencesAsNodes(){return this._context.languageService.findReferencesAsNodes(getNodeForReferences(this))}}}function getNodeForReferences(node){if(Node.isIdentifier(node)||Node.isStringLiteral(node))return node;let nameNode=node.getNodeProperty("name");return nameNode??(Node.isExportable(node)&&node.getDefaultKeyword()||node)}function RenameableNode(Base){return class extends Base{rename(newName,options){return renameNode(getNodeToRename(this),newName,options),this;function getNodeToRename(thisNode){if(Node.isIdentifier(thisNode)||Node.isPrivateIdentifier(thisNode)||Node.isStringLiteral(thisNode))return thisNode;if(thisNode.getNameNode!=null){let node=thisNode.getNameNode();if(common.errors.throwIfNullOrUndefined(node,"Expected to find a name node when renaming."),Node.isArrayBindingPattern(node)||Node.isObjectBindingPattern(node))throw new common.errors.NotImplementedError(`Not implemented renameable scenario for ${node.getKindName()}.`);return node}else throw new common.errors.NotImplementedError(`Not implemented renameable scenario for ${thisNode.getKindName()}`)}}}}function BindingNamedNode(Base){let base=ReferenceFindableNode(RenameableNode(Base));return NamedNodeBase(base)}function ImportAttributeNamedNode(Base){let base=ReferenceFindableNode(RenameableNode(Base));return NamedNodeBase(base)}function ModuleNamedNode(Base){let base=ReferenceFindableNode(RenameableNode(Base));return NamedNodeBase(base)}function NameableNode(Base){return NameableNodeInternal(ReferenceFindableNode(RenameableNode(Base)))}function NameableNodeInternal(Base){return class extends Base{getNameNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.name)}getNameNodeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getNameNode(),message??"Expected to have a name node.",this)}getName(){return this.getNameNode()?.getText()??void 0}getNameOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getName(),message??"Expected to have a name.",this)}rename(newName){return newName===this.getName()?this:common.StringUtils.isNullOrWhitespace(newName)?(this.removeName(),this):(this.getNameNode()==null?addNameNode(this,newName):Base.prototype.rename.call(this,newName),this)}removeName(){let nameNode=this.getNameNode();return nameNode==null?this:(removeChildren({children:[nameNode],removePrecedingSpaces:!0}),this)}set(structure){if(callBaseSet(Base.prototype,this,structure),structure.name!=null){common.errors.throwIfWhitespaceOrNotString(structure.name,"structure.name");let nameNode=this.getNameNode();nameNode==null?addNameNode(this,structure.name):nameNode.replaceWithText(structure.name)}else structure.hasOwnProperty(common.nameof(structure,"name"))&&this.removeName();return this}getStructure(){return callBaseGetStructure(Base.prototype,this,{name:this.getName()})}}}function addNameNode(node,newName){if(Node.isClassDeclaration(node)||Node.isClassExpression(node)){let classKeyword=node.getFirstChildByKindOrThrow(common.SyntaxKind.ClassKeyword);insertIntoParentTextRange({insertPos:classKeyword.getEnd(),newText:" "+newName,parent:node})}else{let openParenToken=node.getFirstChildByKindOrThrow(common.SyntaxKind.OpenParenToken);insertIntoParentTextRange({insertPos:openParenToken.getStart(),newText:" "+newName,parent:node})}}function NamedNode(Base){let base=RenameableNode(ReferenceFindableNode(Base));return NamedNodeBase(base)}function PropertyNamedNode(Base){let base=ReferenceFindableNode(RenameableNode(Base));return NamedNodeBase(base)}function OverrideableNode(Base){return class extends Base{hasOverrideKeyword(){return this.hasModifier(common.SyntaxKind.OverrideKeyword)}getOverrideKeyword(){return this.getFirstModifierByKind(common.SyntaxKind.OverrideKeyword)}getOverrideKeywordOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getOverrideKeyword(),message??"Expected to find an override keyword.",this)}setHasOverrideKeyword(value){return this.toggleModifier("override",value),this}set(structure){return callBaseSet(Base.prototype,this,structure),structure.hasOverrideKeyword!=null&&this.setHasOverrideKeyword(structure.hasOverrideKeyword),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{hasOverrideKeyword:this.hasOverrideKeyword()})}}}function ParameteredNode(Base){return class extends Base{getParameter(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getParameters(),nameOrFindFunction)}getParameterOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getParameter(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("parameter",nameOrFindFunction))}getParameters(){return this.compilerNode.parameters.map(p=>this._getNodeFromCompilerNode(p))}addParameter(structure){return this.addParameters([structure])[0]}addParameters(structures){return this.insertParameters(getEndIndexFromArray(this.compilerNode.parameters),structures)}insertParameter(index,structure){return this.insertParameters(index,[structure])[0]}insertParameters(index,structures){if(common.ArrayUtils.isNullOrEmpty(structures))return[];let parameters=this.getParameters(),syntaxList=this.getFirstChildByKindOrThrow(common.SyntaxKind.OpenParenToken).getNextSiblingIfKindOrThrow(common.SyntaxKind.SyntaxList);index=verifyAndGetIndex(index,parameters.length);let writer=this._getWriterWithQueuedChildIndentation();return this._context.structurePrinterFactory.forParameterDeclaration().printTexts(writer,structures),insertIntoCommaSeparatedNodes({parent:syntaxList,currentNodes:parameters,insertIndex:index,newText:writer.toString(),useTrailingCommas:!1}),getNodesToReturn(parameters,this.getParameters(),index,!1)}set(structure){return callBaseSet(Base.prototype,this,structure),structure.parameters!=null&&(this.getParameters().forEach(p=>p.remove()),this.addParameters(structure.parameters)),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{parameters:this.getParameters().map(p=>p.getStructure())})}}}function QuestionDotTokenableNode(Base){return class extends Base{hasQuestionDotToken(){return this.compilerNode.questionDotToken!=null}getQuestionDotTokenNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.questionDotToken)}getQuestionDotTokenNodeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getQuestionDotTokenNode(),message??"Expected to find a question dot token.",this)}setHasQuestionDotToken(value){let questionDotTokenNode=this.getQuestionDotTokenNode(),hasQuestionDotToken=questionDotTokenNode!=null;if(value===hasQuestionDotToken)return this;return value?Node.isPropertyAccessExpression(this)?this.getFirstChildByKindOrThrow(common.SyntaxKind.DotToken).replaceWithText("?."):insertIntoParentTextRange({insertPos:getInsertPos2.call(this),parent:this,newText:"?."}):Node.isPropertyAccessExpression(this)?questionDotTokenNode.replaceWithText("."):removeChildren({children:[questionDotTokenNode]}),this;function getInsertPos2(){if(Node.isCallExpression(this))return this.getFirstChildByKindOrThrow(common.SyntaxKind.OpenParenToken).getStart();if(Node.isElementAccessExpression(this))return this.getFirstChildByKindOrThrow(common.SyntaxKind.OpenBracketToken).getStart();common.errors.throwNotImplementedForSyntaxKindError(this.compilerNode.kind)}}set(structure){return callBaseSet(Base.prototype,this,structure),structure.hasQuestionDotToken!=null&&this.setHasQuestionDotToken(structure.hasQuestionDotToken),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{hasQuestionDotToken:this.hasQuestionDotToken()})}}}function QuestionTokenableNode(Base){return class extends Base{hasQuestionToken(){return this.compilerNode.questionToken!=null}getQuestionTokenNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.questionToken)}getQuestionTokenNodeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getQuestionTokenNode(),message??"Expected to find a question token.",this)}setHasQuestionToken(value){let questionTokenNode=this.getQuestionTokenNode(),hasQuestionToken=questionTokenNode!=null;if(value===hasQuestionToken)return this;return value?(Node.isExclamationTokenable(this)&&this.setHasExclamationToken(!1),insertIntoParentTextRange({insertPos:getInsertPos2.call(this),parent:this,newText:"?"})):removeChildren({children:[questionTokenNode]}),this;function getInsertPos2(){if(Node.hasName(this))return this.getNameNode().getEnd();let colonNode=this.getFirstChildByKind(common.SyntaxKind.ColonToken);if(colonNode!=null)return colonNode.getStart();let semicolonToken=this.getLastChildByKind(common.SyntaxKind.SemicolonToken);return semicolonToken!=null?semicolonToken.getStart():this.getEnd()}}set(structure){return callBaseSet(Base.prototype,this,structure),structure.hasQuestionToken!=null&&this.setHasQuestionToken(structure.hasQuestionToken),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{hasQuestionToken:this.hasQuestionToken()})}}}function ReadonlyableNode(Base){return class extends Base{isReadonly(){return this.getReadonlyKeyword()!=null}getReadonlyKeyword(){return this.getFirstModifierByKind(common.SyntaxKind.ReadonlyKeyword)}getReadonlyKeywordOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getReadonlyKeyword(),message??"Expected to find a readonly keyword.",this)}setIsReadonly(value){return this.toggleModifier("readonly",value),this}set(structure){return callBaseSet(Base.prototype,this,structure),structure.isReadonly!=null&&this.setIsReadonly(structure.isReadonly),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{isReadonly:this.isReadonly()})}}}function ReturnTypedNode(Base){return class extends Base{getReturnType(){return this.getSignature().getReturnType()}getReturnTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getReturnTypeNodeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getReturnTypeNode(),message??"Expected to find a return type node.",this)}setReturnType(textOrWriterFunction){let text=getTextFromStringOrWriter(this._getWriterWithQueuedChildIndentation(),textOrWriterFunction);if(common.StringUtils.isNullOrWhitespace(text))return this.removeReturnType();let returnTypeNode=this.getReturnTypeNode();if(returnTypeNode!=null)return returnTypeNode.getText()!==text&&returnTypeNode.replaceWithText(text),this;return insertIntoParentTextRange({parent:this,insertPos:getEndNode(this).getEnd(),newText:`: ${text}`}),this;function getEndNode(thisNode){return thisNode.getKind()===common.SyntaxKind.IndexSignature?thisNode.getFirstChildByKindOrThrow(common.SyntaxKind.CloseBracketToken):thisNode.getFirstChildByKindOrThrow(common.SyntaxKind.CloseParenToken)}}removeReturnType(){let returnTypeNode=this.getReturnTypeNode();if(returnTypeNode==null)return this;let colonToken=returnTypeNode.getPreviousSiblingIfKindOrThrow(common.SyntaxKind.ColonToken);return removeChildren({children:[colonToken,returnTypeNode],removePrecedingSpaces:!0}),this}getSignature(){let signature=this._context.typeChecker.getSignatureFromNode(this);if(signature==null)throw new common.errors.NotImplementedError("Expected the node to have a signature.");return signature}set(structure){return callBaseSet(Base.prototype,this,structure),structure.returnType!=null?this.setReturnType(structure.returnType):structure.hasOwnProperty(common.nameof(structure,"returnType"))&&this.removeReturnType(),this}getStructure(){let returnTypeNode=this.getReturnTypeNode();return callBaseGetStructure(Base.prototype,this,{returnType:returnTypeNode?returnTypeNode.getText({trimLeadingIndentation:!0}):void 0})}}}function ScopeableNode(Base){return class extends Base{getScope(){let scope=getScopeForNode(this);if(scope!=null)return scope;if(Node.isParameterDeclaration(this)&&this.isReadonly())return exports.Scope.Public}setScope(scope){return setScopeForNode(this,scope),this}getScopeKeyword(){return this.getModifiers().find(m=>{let text=m.getText();return text==="public"||text==="protected"||text==="private"})}hasScopeKeyword(){return this.getScopeKeyword()!=null}set(structure){return callBaseSet(Base.prototype,this,structure),structure.hasOwnProperty(common.nameof(structure,"scope"))&&this.setScope(structure.scope),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{scope:this.getScope()})}}}function getScopeForNode(node){let modifierFlags=node.getCombinedModifierFlags();return modifierFlags&common.ts.ModifierFlags.Private?exports.Scope.Private:modifierFlags&common.ts.ModifierFlags.Protected?exports.Scope.Protected:modifierFlags&common.ts.ModifierFlags.Public?exports.Scope.Public:void 0}function setScopeForNode(node,scope){node.toggleModifier("public",scope===exports.Scope.Public),node.toggleModifier("protected",scope===exports.Scope.Protected),node.toggleModifier("private",scope===exports.Scope.Private)}function ScopedNode(Base){return class extends Base{getScope(){return getScopeForNode(this)||exports.Scope.Public}setScope(scope){return setScopeForNode(this,scope),this}hasScopeKeyword(){return getScopeForNode(this)!=null}set(structure){return callBaseSet(Base.prototype,this,structure),structure.hasOwnProperty(common.nameof(structure,"scope"))&&this.setScope(structure.scope),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{scope:this.hasScopeKeyword()?this.getScope():void 0})}}}function SignaturedDeclaration(Base){return ReturnTypedNode(ParameteredNode(Base))}function StaticableNode(Base){return class extends Base{isStatic(){return this.hasModifier(common.SyntaxKind.StaticKeyword)}getStaticKeyword(){return this.getFirstModifierByKind(common.SyntaxKind.StaticKeyword)}getStaticKeywordOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getStaticKeyword(),message??"Expected to find a static keyword.",this)}setIsStatic(value){return this.toggleModifier("static",value),this}set(structure){return callBaseSet(Base.prototype,this,structure),structure.isStatic!=null&&this.setIsStatic(structure.isStatic),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{isStatic:this.isStatic()})}}}function TextInsertableNode(Base){return class extends Base{insertText(pos,textOrWriterFunction){return this.replaceText([pos,pos],textOrWriterFunction),this}removeText(pos,end){return pos==null?this.replaceText(getValidRange(this),""):this.replaceText([pos,end],""),this}replaceText(range,textOrWriterFunction){let childSyntaxList=this.getChildSyntaxListOrThrow(),validRange=getValidRange(this),pos=range[0],end=range[1];return verifyArguments(),insertIntoParentTextRange({insertPos:pos,newText:getTextFromStringOrWriter(this._getWriter(),textOrWriterFunction),parent:childSyntaxList.getParentOrThrow(),replacing:{textLength:end-pos,nodes:[childSyntaxList]}}),this;function verifyArguments(){if(verifyInRange(pos),verifyInRange(end),pos>end)throw new common.errors.ArgumentError("range","Cannot specify a start position greater than the end position.")}function verifyInRange(i){if(!(i>=validRange[0]&&i<=validRange[1]))throw new common.errors.InvalidOperationError(`Cannot insert or replace text outside the bounds of the node. Expected a position between [${validRange[0]}, ${validRange[1]}], but received ${i}.`)}}}}function getValidRange(thisNode){let rangeNode=getRangeNode(),openBrace=Node.isSourceFile(rangeNode)?void 0:rangeNode.getPreviousSiblingIfKind(common.SyntaxKind.OpenBraceToken),closeBrace=openBrace==null?void 0:rangeNode.getNextSiblingIfKind(common.SyntaxKind.CloseBraceToken);if(openBrace!=null&&closeBrace!=null)return[openBrace.getEnd(),closeBrace.getStart()];return[rangeNode.getPos(),rangeNode.getEnd()];function getRangeNode(){return Node.isSourceFile(thisNode)?thisNode:thisNode.getChildSyntaxListOrThrow()}}function TypeArgumentedNode(Base){return class extends Base{getTypeArguments(){return this.compilerNode.typeArguments==null?[]:this.compilerNode.typeArguments.map(a=>this._getNodeFromCompilerNode(a))}addTypeArgument(argumentText){return this.addTypeArguments([argumentText])[0]}addTypeArguments(argumentTexts){return this.insertTypeArguments(this.getTypeArguments().length,argumentTexts)}insertTypeArgument(index,argumentText){return this.insertTypeArguments(index,[argumentText])[0]}insertTypeArguments(index,argumentTexts){if(common.ArrayUtils.isNullOrEmpty(argumentTexts))return[];let typeArguments=this.getTypeArguments();if(index=verifyAndGetIndex(index,typeArguments.length),typeArguments.length===0){let identifier=this.getFirstChildByKindOrThrow(common.SyntaxKind.Identifier);insertIntoParentTextRange({insertPos:identifier.getEnd(),parent:this,newText:`<${argumentTexts.join(", ")}>`})}else insertIntoCommaSeparatedNodes({parent:this.getFirstChildByKindOrThrow(common.SyntaxKind.LessThanToken).getNextSiblingIfKindOrThrow(common.SyntaxKind.SyntaxList),currentNodes:typeArguments,insertIndex:index,newText:argumentTexts.join(", "),useTrailingCommas:!1});return getNodesToReturn(typeArguments,this.getTypeArguments(),index,!1)}removeTypeArgument(typeArgOrIndex){let typeArguments=this.getTypeArguments();if(typeArguments.length===0)throw new common.errors.InvalidOperationError("Cannot remove a type argument when none exist.");let typeArgToRemove=typeof typeArgOrIndex=="number"?getTypeArgFromIndex(typeArgOrIndex):typeArgOrIndex;if(typeArguments.length===1){let childSyntaxList=typeArguments[0].getParentSyntaxListOrThrow();removeChildren({children:[childSyntaxList.getPreviousSiblingIfKindOrThrow(common.SyntaxKind.LessThanToken),childSyntaxList,childSyntaxList.getNextSiblingIfKindOrThrow(common.SyntaxKind.GreaterThanToken)]})}else removeCommaSeparatedChild(typeArgToRemove);return this;function getTypeArgFromIndex(index){return typeArguments[verifyAndGetIndex(index,typeArguments.length-1)]}}}}function TypedNode(Base){return class extends Base{getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getTypeNode(),message??"Expected to find a type node.",this)}setType(textOrWriterFunction){let text=getTextFromStringOrWriter(this._getWriterWithQueuedChildIndentation(),textOrWriterFunction);if(common.StringUtils.isNullOrWhitespace(text))return this.removeType();let typeNode=this.getTypeNode();if(typeNode!=null&&typeNode.getText()===text)return this;let separatorSyntaxKind=getSeparatorSyntaxKindForNode(this),separatorNode=this.getFirstChildByKind(separatorSyntaxKind),insertPos,newText;return separatorNode==null?(insertPos=getInsertPosWhenNoType(this),newText=(separatorSyntaxKind===common.SyntaxKind.EqualsToken?" = ":": ")+text):(insertPos=typeNode.getStart(),newText=text),insertIntoParentTextRange({parent:this,insertPos,newText,replacing:{textLength:typeNode==null?0:typeNode.getWidth()}}),this;function getInsertPosWhenNoType(node){let identifier=node.getFirstChildByKind(common.SyntaxKind.Identifier)??node.getFirstChildByKind(common.SyntaxKind.ArrayBindingPattern)??node.getFirstChildIfKindOrThrow(common.SyntaxKind.ObjectBindingPattern,"A first child of the kind Identifier, ArrayBindingPattern, or ObjectBindingPattern was expected."),nextSibling=identifier.getNextSibling();return(isQuestionOrExclamation(nextSibling)?nextSibling:identifier).getEnd()}function isQuestionOrExclamation(node){if(node==null)return!1;let kind=node.getKind();return kind===common.SyntaxKind.QuestionToken||kind===common.SyntaxKind.ExclamationToken}}set(structure){return callBaseSet(Base.prototype,this,structure),structure.type!=null?this.setType(structure.type):structure.hasOwnProperty(common.nameof(structure,"type"))&&this.removeType(),this}removeType(){if(this.getKind()===common.SyntaxKind.TypeAliasDeclaration)throw new common.errors.NotSupportedError(`Cannot remove the type of a type alias. Use ${common.nameof("setType")} instead.`);let typeNode=this.getTypeNode();if(typeNode==null)return this;let separatorToken=typeNode.getPreviousSiblingIfKindOrThrow(getSeparatorSyntaxKindForNode(this));return removeChildren({children:[separatorToken,typeNode],removePrecedingSpaces:!0}),this}getStructure(){let typeNode=this.getTypeNode();return callBaseGetStructure(Base.prototype,this,{type:typeNode?typeNode.getText({trimLeadingIndentation:!0}):void 0})}}}function getSeparatorSyntaxKindForNode(node){switch(node.getKind()){case common.SyntaxKind.TypeAliasDeclaration:return common.SyntaxKind.EqualsToken;default:return common.SyntaxKind.ColonToken}}function TypeElementMemberedNode(Base){return class extends Base{addMember(member){return this.addMembers([member])[0]}addMembers(members){return this.insertMembers(getEndIndexFromArray(this.getMembersWithComments()),members)}insertMember(index,member){return this.insertMembers(index,[member])[0]}insertMembers(index,members){return insertIntoBracesOrSourceFileWithGetChildrenWithComments({getIndexedChildren:()=>this.getMembersWithComments(),index,parent:this,write:writer=>{writer.newLineIfLastNot();let memberWriter=this._getWriter();this._context.structurePrinterFactory.forTypeElementMember().printTexts(memberWriter,members),writer.write(memberWriter.toString()),writer.newLineIfLastNot()}})}addConstructSignature(structure){return this.addConstructSignatures([structure])[0]}addConstructSignatures(structures){return this.insertConstructSignatures(getEndIndexFromArray(this.getMembersWithComments()),structures)}insertConstructSignature(index,structure){return this.insertConstructSignatures(index,[structure])[0]}insertConstructSignatures(index,structures){return insertChildren$1({thisNode:this,index,structures,expectedKind:common.SyntaxKind.ConstructSignature,createStructurePrinter:()=>this._context.structurePrinterFactory.forConstructSignatureDeclaration()})}getConstructSignature(findFunction){return this.getConstructSignatures().find(findFunction)}getConstructSignatureOrThrow(findFunction,message){return common.errors.throwIfNullOrUndefined(this.getConstructSignature(findFunction),message??"Expected to find a construct signature with the provided condition.",this)}getConstructSignatures(){return this.compilerNode.members.filter(m=>m.kind===common.SyntaxKind.ConstructSignature).map(m=>this._getNodeFromCompilerNode(m))}addCallSignature(structure){return this.addCallSignatures([structure])[0]}addCallSignatures(structures){return this.insertCallSignatures(getEndIndexFromArray(this.getMembersWithComments()),structures)}insertCallSignature(index,structure){return this.insertCallSignatures(index,[structure])[0]}insertCallSignatures(index,structures){return insertChildren$1({thisNode:this,index,structures,expectedKind:common.SyntaxKind.CallSignature,createStructurePrinter:()=>this._context.structurePrinterFactory.forCallSignatureDeclaration()})}getCallSignature(findFunction){return this.getCallSignatures().find(findFunction)}getCallSignatureOrThrow(findFunction,message){return common.errors.throwIfNullOrUndefined(this.getCallSignature(findFunction),message??"Expected to find a call signature with the provided condition.",this)}getCallSignatures(){return this.compilerNode.members.filter(m=>m.kind===common.SyntaxKind.CallSignature).map(m=>this._getNodeFromCompilerNode(m))}addIndexSignature(structure){return this.addIndexSignatures([structure])[0]}addIndexSignatures(structures){return this.insertIndexSignatures(getEndIndexFromArray(this.getMembersWithComments()),structures)}insertIndexSignature(index,structure){return this.insertIndexSignatures(index,[structure])[0]}insertIndexSignatures(index,structures){return insertChildren$1({thisNode:this,index,structures,expectedKind:common.SyntaxKind.IndexSignature,createStructurePrinter:()=>this._context.structurePrinterFactory.forIndexSignatureDeclaration()})}getIndexSignature(findFunction){return this.getIndexSignatures().find(findFunction)}getIndexSignatureOrThrow(findFunction,message){return common.errors.throwIfNullOrUndefined(this.getIndexSignature(findFunction),message??"Expected to find a index signature with the provided condition.",this)}getIndexSignatures(){return this.compilerNode.members.filter(m=>m.kind===common.SyntaxKind.IndexSignature).map(m=>this._getNodeFromCompilerNode(m))}addMethod(structure){return this.addMethods([structure])[0]}addMethods(structures){return this.insertMethods(getEndIndexFromArray(this.getMembersWithComments()),structures)}insertMethod(index,structure){return this.insertMethods(index,[structure])[0]}insertMethods(index,structures){return insertChildren$1({thisNode:this,index,structures,expectedKind:common.SyntaxKind.MethodSignature,createStructurePrinter:()=>this._context.structurePrinterFactory.forMethodSignature()})}getMethod(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getMethods(),nameOrFindFunction)}getMethodOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getMethod(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("interface method signature",nameOrFindFunction))}getMethods(){return this.compilerNode.members.filter(m=>m.kind===common.SyntaxKind.MethodSignature).map(m=>this._getNodeFromCompilerNode(m))}addProperty(structure){return this.addProperties([structure])[0]}addProperties(structures){return this.insertProperties(getEndIndexFromArray(this.getMembersWithComments()),structures)}insertProperty(index,structure){return this.insertProperties(index,[structure])[0]}insertProperties(index,structures){return insertChildren$1({thisNode:this,index,structures,expectedKind:common.SyntaxKind.PropertySignature,createStructurePrinter:()=>this._context.structurePrinterFactory.forPropertySignature()})}getProperty(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getProperties(),nameOrFindFunction)}getPropertyOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getProperty(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("interface property signature",nameOrFindFunction))}getProperties(){return this.compilerNode.members.filter(m=>m.kind===common.SyntaxKind.PropertySignature).map(m=>this._getNodeFromCompilerNode(m))}addGetAccessor(structure){return this.addGetAccessors([structure])[0]}addGetAccessors(structures){let result=[];for(let structure of structures){let setAccessor=this.getSetAccessor(structure.name),index=setAccessor==null?getEndIndexFromArray(this.getMembersWithComments()):setAccessor.getChildIndex();result.push(this.insertGetAccessor(index,structure))}return result}insertGetAccessor(index,structure){return this.insertGetAccessors(index,[structure])[0]}insertGetAccessors(index,structures){return insertChildren$1({thisNode:this,index,structures,expectedKind:common.SyntaxKind.GetAccessor,createStructurePrinter:()=>this._context.structurePrinterFactory.forGetAccessorDeclaration({isAmbient:!0})})}getGetAccessor(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getGetAccessors(),nameOrFindFunction)}getGetAccessorOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getGetAccessor(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("interface get accessor",nameOrFindFunction))}getGetAccessors(){return this.compilerNode.members.filter(m=>m.kind===common.SyntaxKind.GetAccessor).map(m=>this._getNodeFromCompilerNode(m))}addSetAccessor(structure){return this.addSetAccessors([structure])[0]}addSetAccessors(structures){let result=[];for(let structure of structures){let getAccessor=this.getGetAccessor(structure.name),index=getAccessor==null?getEndIndexFromArray(this.getMembersWithComments()):getAccessor.getChildIndex()+1;result.push(this.insertSetAccessor(index,structure))}return result}insertSetAccessor(index,structure){return this.insertSetAccessors(index,[structure])[0]}insertSetAccessors(index,structures){return insertChildren$1({thisNode:this,index,structures,expectedKind:common.SyntaxKind.SetAccessor,createStructurePrinter:()=>this._context.structurePrinterFactory.forSetAccessorDeclaration({isAmbient:!0})})}getSetAccessor(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getSetAccessors(),nameOrFindFunction)}getSetAccessorOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getSetAccessor(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("interface set accessor",nameOrFindFunction))}getSetAccessors(){return this.compilerNode.members.filter(m=>m.kind===common.SyntaxKind.SetAccessor).map(m=>this._getNodeFromCompilerNode(m))}getMembers(){return this.compilerNode.members.map(m=>this._getNodeFromCompilerNode(m))}getMembersWithComments(){let compilerNode=this.compilerNode;return ExtendedParser.getContainerArray(compilerNode,this._sourceFile.compilerNode).map(m=>this._getNodeFromCompilerNode(m))}set(structure){return callBaseSet(Base.prototype,this,structure),structure.callSignatures!=null&&(this.getCallSignatures().forEach(c=>c.remove()),this.addCallSignatures(structure.callSignatures)),structure.constructSignatures!=null&&(this.getConstructSignatures().forEach(c=>c.remove()),this.addConstructSignatures(structure.constructSignatures)),structure.indexSignatures!=null&&(this.getIndexSignatures().forEach(c=>c.remove()),this.addIndexSignatures(structure.indexSignatures)),structure.properties!=null&&(this.getProperties().forEach(c=>c.remove()),this.addProperties(structure.properties)),structure.getAccessors!=null&&(this.getGetAccessors().forEach(c=>c.remove()),this.addGetAccessors(structure.getAccessors)),structure.setAccessors!=null&&(this.getSetAccessors().forEach(c=>c.remove()),this.addSetAccessors(structure.setAccessors)),structure.methods!=null&&(this.getMethods().forEach(c=>c.remove()),this.addMethods(structure.methods)),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{callSignatures:this.getCallSignatures().map(node=>node.getStructure()),constructSignatures:this.getConstructSignatures().map(node=>node.getStructure()),getAccessors:this.getGetAccessors().map(node=>node.getStructure()),indexSignatures:this.getIndexSignatures().map(node=>node.getStructure()),methods:this.getMethods().map(node=>node.getStructure()),properties:this.getProperties().map(node=>node.getStructure()),setAccessors:this.getSetAccessors().map(node=>node.getStructure())})}}}function insertChildren$1(opts){return insertIntoBracesOrSourceFileWithGetChildren({getIndexedChildren:()=>opts.thisNode.getMembersWithComments(),parent:opts.thisNode,index:opts.index,structures:opts.structures,expectedKind:opts.expectedKind,write:(writer,info)=>{writer.newLineIfLastNot(),opts.createStructurePrinter().printTexts(writer,opts.structures),writer.newLineIfLastNot()}})}function TypeParameteredNode(Base){return class extends Base{getTypeParameter(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getTypeParameters(),nameOrFindFunction)}getTypeParameterOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getTypeParameter(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("type parameter",nameOrFindFunction))}getTypeParameters(){let typeParameters=this.compilerNode.typeParameters;return typeParameters==null?[]:typeParameters.map(t=>this._getNodeFromCompilerNode(t))}addTypeParameter(structure){return this.addTypeParameters([structure])[0]}addTypeParameters(structures){return this.insertTypeParameters(getEndIndexFromArray(this.compilerNode.typeParameters),structures)}insertTypeParameter(index,structure){return this.insertTypeParameters(index,[structure])[0]}insertTypeParameters(index,structures){if(common.ArrayUtils.isNullOrEmpty(structures))return[];let typeParameters=this.getTypeParameters(),writer=this._getWriterWithQueuedChildIndentation(),structurePrinter=this._context.structurePrinterFactory.forTypeParameterDeclaration();return index=verifyAndGetIndex(index,typeParameters.length),structurePrinter.printTexts(writer,structures),typeParameters.length===0?insertIntoParentTextRange({insertPos:getInsertPos(this),parent:this,newText:`<${writer.toString()}>`}):insertIntoCommaSeparatedNodes({parent:this.getFirstChildByKindOrThrow(common.SyntaxKind.LessThanToken).getNextSiblingIfKindOrThrow(common.SyntaxKind.SyntaxList),currentNodes:typeParameters,insertIndex:index,newText:writer.toString(),useTrailingCommas:!1}),getNodesToReturn(typeParameters,this.getTypeParameters(),index,!1)}set(structure){return callBaseSet(Base.prototype,this,structure),structure.typeParameters!=null&&(this.getTypeParameters().forEach(t=>t.remove()),this.addTypeParameters(structure.typeParameters)),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{typeParameters:this.getTypeParameters().map(p=>p.getStructure())})}}}function getInsertPos(node){let namedNode=node;if(namedNode.getNameNode!=null)return namedNode.getNameNode().getEnd();if(Node.isCallSignatureDeclaration(node)||Node.isFunctionTypeNode(node))return node.getFirstChildByKindOrThrow(common.SyntaxKind.OpenParenToken).getStart();throw new common.errors.NotImplementedError(`Not implemented scenario inserting type parameters for node with kind ${node.getKindName()}.`)}function UnwrappableNode(Base){return class extends Base{unwrap(){unwrapNode(this)}}}var ArrayBindingPattern=class extends Node{getElements(){return this.compilerNode.elements.map(e=>this._getNodeFromCompilerNode(e))}},createBase$F=ctor=>DotDotDotTokenableNode(InitializerExpressionableNode(BindingNamedNode(ctor))),BindingElementBase=createBase$F(Node),BindingElement=class extends BindingElementBase{getPropertyNameNodeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getPropertyNameNode(),message??"Expected to find a property name node.",this)}getPropertyNameNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.propertyName)}},ObjectBindingPattern=class extends Node{getElements(){return this.compilerNode.elements.map(e=>this._getNodeFromCompilerNode(e))}};function AbstractableNode(Base){return class extends Base{isAbstract(){return this.getAbstractKeyword()!=null}getAbstractKeyword(){return this.getFirstModifierByKind(common.SyntaxKind.AbstractKeyword)}getAbstractKeywordOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getAbstractKeyword(),message??"Expected to find an abstract keyword.",this)}setIsAbstract(isAbstract){return this.toggleModifier("abstract",isAbstract),this}set(structure){return callBaseSet(Base.prototype,this,structure),structure.isAbstract!=null&&this.setIsAbstract(structure.isAbstract),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{isAbstract:this.isAbstract()})}}}var Expression=class extends Node{getContextualType(){return this._context.typeChecker.getContextualType(this)}},BinaryExpressionBase=Expression,BinaryExpression=class extends BinaryExpressionBase{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}getOperatorToken(){return this._getNodeFromCompilerNode(this.compilerNode.operatorToken)}getRight(){return this._getNodeFromCompilerNode(this.compilerNode.right)}},AssignmentExpressionBase=BinaryExpression,AssignmentExpression=class extends AssignmentExpressionBase{getOperatorToken(){return this._getNodeFromCompilerNode(this.compilerNode.operatorToken)}},ArrayDestructuringAssignmentBase=AssignmentExpression,ArrayDestructuringAssignment=class extends ArrayDestructuringAssignmentBase{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}},UnaryExpression=class extends Expression{},UpdateExpression=class extends UnaryExpression{},LeftHandSideExpression=class extends UpdateExpression{},MemberExpression=class extends LeftHandSideExpression{},PrimaryExpression=class extends MemberExpression{},ArrayLiteralExpression=class extends PrimaryExpression{getElements(){return this.compilerNode.elements.map(e=>this._getNodeFromCompilerNode(e))}addElement(textOrWriterFunction,options){return this.addElements([textOrWriterFunction],options)[0]}addElements(textsOrWriterFunction,options){return this.insertElements(this.compilerNode.elements.length,textsOrWriterFunction,options)}insertElement(index,textOrWriterFunction,options){return this.insertElements(index,[textOrWriterFunction],options)[0]}insertElements(index,textsOrWriterFunction,options={}){let elements=this.getElements();index=verifyAndGetIndex(index,elements.length);let useNewLines=getUseNewLines(this),writer=useNewLines?this._getWriterWithChildIndentation():this._getWriterWithQueuedChildIndentation(),stringStructurePrinter=new StringStructurePrinter;return(useNewLines?new CommaNewLineSeparatedStructuresPrinter(stringStructurePrinter):new CommaSeparatedStructuresPrinter(stringStructurePrinter)).printText(writer,textsOrWriterFunction),insertTexts(this);function insertTexts(node){insertIntoCommaSeparatedNodes({parent:node.getFirstChildByKindOrThrow(common.SyntaxKind.SyntaxList),currentNodes:elements,insertIndex:index,newText:writer.toString(),useNewLines,useTrailingCommas:useNewLines&&node._context.manipulationSettings.getUseTrailingCommas()});let newElements=node.getElements();return getNodesToReturn(elements,newElements,index,!1)}function getUseNewLines(node){if(options.useNewLines!=null)return options.useNewLines;if(elements.length>1)return allElementsOnDifferentLines();return node.getStartLineNumber()!==node.getEndLineNumber();function allElementsOnDifferentLines(){let previousLine=elements[0].getStartLineNumber();for(let i=1;iTypedNode(ExpressionedNode(ctor)),AsExpressionBase=createBase$E(Expression),AsExpression=class extends AsExpressionBase{},AwaitExpressionBase=UnaryExpressionedNode(UnaryExpression),AwaitExpression=class extends AwaitExpressionBase{},createBase$D=ctor=>TypeArgumentedNode(ArgumentedNode(QuestionDotTokenableNode(LeftHandSideExpressionedNode(ctor)))),CallExpressionBase=createBase$D(LeftHandSideExpression),CallExpression=class extends CallExpressionBase{getReturnType(){return this._context.typeChecker.getTypeAtLocation(this)}},CommaListExpressionBase=Expression,CommaListExpression=class extends CommaListExpressionBase{getElements(){return this.compilerNode.elements.map(e=>this._getNodeFromCompilerNode(e))}},ConditionalExpressionBase=Expression,ConditionalExpression=class extends ConditionalExpressionBase{getCondition(){return this._getNodeFromCompilerNode(this.compilerNode.condition)}getQuestionToken(){return this._getNodeFromCompilerNode(this.compilerNode.questionToken)}getWhenTrue(){return this._getNodeFromCompilerNode(this.compilerNode.whenTrue)}getColonToken(){return this._getNodeFromCompilerNode(this.compilerNode.colonToken)}getWhenFalse(){return this._getNodeFromCompilerNode(this.compilerNode.whenFalse)}},DeleteExpressionBase=UnaryExpressionedNode(UnaryExpression),DeleteExpression=class extends DeleteExpressionBase{},createBase$C=ctor=>QuestionDotTokenableNode(LeftHandSideExpressionedNode(ctor)),ElementAccessExpressionBase=createBase$C(MemberExpression),ElementAccessExpression=class extends ElementAccessExpressionBase{getArgumentExpression(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.argumentExpression)}getArgumentExpressionOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getArgumentExpression(),message??"Expected to find an argument expression.",this)}},ImportExpressionBase=PrimaryExpression,ImportExpression=class extends ImportExpressionBase{},LiteralExpressionBase=LiteralLikeNode(PrimaryExpression),LiteralExpression=class extends LiteralExpressionBase{},MetaPropertyBase=NamedNode(PrimaryExpression),MetaProperty=class extends MetaPropertyBase{getKeywordToken(){return this.compilerNode.keywordToken}},createBase$B=ctor=>TypeArgumentedNode(ArgumentedNode(LeftHandSideExpressionedNode(ctor))),NewExpressionBase=createBase$B(PrimaryExpression),NewExpression=class extends NewExpressionBase{},NonNullExpressionBase=ExpressionedNode(LeftHandSideExpression),NonNullExpression=class extends NonNullExpressionBase{},ObjectLiteralElement=class extends Node{remove(){removeCommaSeparatedChild(this)}},CommentObjectLiteralElement=class extends ObjectLiteralElement{},ObjectDestructuringAssignmentBase=AssignmentExpression,ObjectDestructuringAssignment=class extends ObjectDestructuringAssignmentBase{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}},ObjectLiteralExpressionBase=PrimaryExpression,ObjectLiteralExpression=class extends ObjectLiteralExpressionBase{getPropertyOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getProperty(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("property",nameOrFindFunction))}getProperty(nameOrFindFunction){let findFunc;return typeof nameOrFindFunction=="string"?findFunc=prop=>prop[common.nameof("getName")]==null?!1:prop.getName()===nameOrFindFunction:findFunc=nameOrFindFunction,this.getProperties().find(findFunc)}getProperties(){return this.compilerNode.properties.map(p=>this._getNodeFromCompilerNode(p))}getPropertiesWithComments(){return ExtendedParser.getContainerArray(this.compilerNode,this.getSourceFile().compilerNode).map(p=>this._getNodeFromCompilerNode(p))}#getAddIndex(){return ExtendedParser.getContainerArray(this.compilerNode,this.getSourceFile().compilerNode).length}addProperty(structure){return this.insertProperties(this.#getAddIndex(),[structure])[0]}addProperties(structures){return this.insertProperties(this.#getAddIndex(),structures)}insertProperty(index,structure){return this.insertProperties(index,[structure])[0]}insertProperties(index,structures){let properties=this.getPropertiesWithComments();index=verifyAndGetIndex(index,properties.length);let writer=this._getWriterWithChildIndentation();return this._context.structurePrinterFactory.forObjectLiteralExpressionProperty().printTexts(writer,structures),insertIntoCommaSeparatedNodes({parent:this.getChildSyntaxListOrThrow(),currentNodes:properties,insertIndex:index,newText:writer.toString(),useNewLines:!0,useTrailingCommas:this._context.manipulationSettings.getUseTrailingCommas()}),getNodesToReturn(properties,this.getPropertiesWithComments(),index,!0)}addPropertyAssignment(structure){return this.addPropertyAssignments([structure])[0]}addPropertyAssignments(structures){return this.insertPropertyAssignments(this.#getAddIndex(),structures)}insertPropertyAssignment(index,structure){return this.insertPropertyAssignments(index,[structure])[0]}insertPropertyAssignments(index,structures){return this.#insertProperty(index,structures,()=>this._context.structurePrinterFactory.forPropertyAssignment())}addShorthandPropertyAssignment(structure){return this.addShorthandPropertyAssignments([structure])[0]}addShorthandPropertyAssignments(structures){return this.insertShorthandPropertyAssignments(this.#getAddIndex(),structures)}insertShorthandPropertyAssignment(index,structure){return this.insertShorthandPropertyAssignments(index,[structure])[0]}insertShorthandPropertyAssignments(index,structures){return this.#insertProperty(index,structures,()=>this._context.structurePrinterFactory.forShorthandPropertyAssignment())}addSpreadAssignment(structure){return this.addSpreadAssignments([structure])[0]}addSpreadAssignments(structures){return this.insertSpreadAssignments(this.#getAddIndex(),structures)}insertSpreadAssignment(index,structure){return this.insertSpreadAssignments(index,[structure])[0]}insertSpreadAssignments(index,structures){return this.#insertProperty(index,structures,()=>this._context.structurePrinterFactory.forSpreadAssignment())}addMethod(structure){return this.addMethods([structure])[0]}addMethods(structures){return this.insertMethods(this.#getAddIndex(),structures)}insertMethod(index,structure){return this.insertMethods(index,[structure])[0]}insertMethods(index,structures){return this.#insertProperty(index,structures,()=>this._context.structurePrinterFactory.forMethodDeclaration({isAmbient:!1}))}addGetAccessor(structure){return this.addGetAccessors([structure])[0]}addGetAccessors(structures){return this.insertGetAccessors(this.#getAddIndex(),structures)}insertGetAccessor(index,structure){return this.insertGetAccessors(index,[structure])[0]}insertGetAccessors(index,structures){return this.#insertProperty(index,structures,()=>this._context.structurePrinterFactory.forGetAccessorDeclaration({isAmbient:!1}))}addSetAccessor(structure){return this.addSetAccessors([structure])[0]}addSetAccessors(structures){return this.insertSetAccessors(this.#getAddIndex(),structures)}insertSetAccessor(index,structure){return this.insertSetAccessors(index,[structure])[0]}insertSetAccessors(index,structures){return this.#insertProperty(index,structures,()=>this._context.structurePrinterFactory.forSetAccessorDeclaration({isAmbient:!1}))}#insertProperty(index,structures,createStructurePrinter){index=verifyAndGetIndex(index,this.#getAddIndex());let writer=this._getWriterWithChildIndentation(),structurePrinter=new CommaNewLineSeparatedStructuresPrinter(createStructurePrinter()),oldProperties=this.getPropertiesWithComments();return structurePrinter.printText(writer,structures),insertIntoCommaSeparatedNodes({parent:this.getFirstChildByKindOrThrow(common.SyntaxKind.SyntaxList),currentNodes:oldProperties,insertIndex:index,newText:writer.toString(),useNewLines:!0,useTrailingCommas:this._context.manipulationSettings.getUseTrailingCommas()}),getNodesToReturn(oldProperties,this.getPropertiesWithComments(),index,!1)}},createBase$A=ctor=>InitializerExpressionGetableNode(QuestionTokenableNode(PropertyNamedNode(ctor))),PropertyAssignmentBase=createBase$A(ObjectLiteralElement),PropertyAssignment=class extends PropertyAssignmentBase{removeInitializer(){let initializer=this.getInitializerOrThrow(),colonToken=initializer.getPreviousSiblingIfKindOrThrow(common.SyntaxKind.ColonToken),childIndex=this.getChildIndex(),sourceFileText=this._sourceFile.getFullText(),insertPos=this.getStart(),newText=sourceFileText.substring(insertPos,colonToken.getPos())+sourceFileText.substring(initializer.getEnd(),this.getEnd()),parent=this.getParentSyntaxList()||this.getParentOrThrow();return insertIntoParentTextRange({insertPos,newText,parent,replacing:{textLength:this.getWidth()}}),parent.getChildAtIndexIfKindOrThrow(childIndex,common.SyntaxKind.ShorthandPropertyAssignment)}setInitializer(textOrWriterFunction){let initializer=this.getInitializerOrThrow();return insertIntoParentTextRange({insertPos:initializer.getStart(),newText:getTextFromStringOrWriter(this._getWriterWithQueuedChildIndentation(),textOrWriterFunction),parent:this,replacing:{textLength:initializer.getWidth()}}),this}set(structure){if(callBaseSet(PropertyAssignmentBase.prototype,this,structure),structure.initializer!=null)this.setInitializer(structure.initializer);else if(structure.hasOwnProperty(common.nameof(structure,"initializer")))return this.removeInitializer();return this}getStructure(){let initializer=this.getInitializerOrThrow(),structure=callBaseGetStructure(PropertyAssignmentBase.prototype,this,{kind:exports.StructureKind.PropertyAssignment,initializer:initializer.getText()});return delete structure.hasQuestionToken,structure}},createBase$z=ctor=>InitializerExpressionGetableNode(QuestionTokenableNode(NamedNode(ctor))),ShorthandPropertyAssignmentBase=createBase$z(ObjectLiteralElement),ShorthandPropertyAssignment=class extends ShorthandPropertyAssignmentBase{hasObjectAssignmentInitializer(){return this.compilerNode.objectAssignmentInitializer!=null}getObjectAssignmentInitializerOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getObjectAssignmentInitializer(),message??"Expected to find an object assignment initializer.",this)}getObjectAssignmentInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.objectAssignmentInitializer)}getEqualsTokenOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getEqualsToken(),message??"Expected to find an equals token.",this)}getEqualsToken(){let equalsToken=this.compilerNode.equalsToken;if(equalsToken!=null)return this._getNodeFromCompilerNode(equalsToken)}removeObjectAssignmentInitializer(){return this.hasObjectAssignmentInitializer()?(removeChildren({children:[this.getEqualsTokenOrThrow(),this.getObjectAssignmentInitializerOrThrow()],removePrecedingSpaces:!0}),this):this}setInitializer(text){let parent=this.getParentSyntaxList()||this.getParentOrThrow(),childIndex=this.getChildIndex();return insertIntoParentTextRange({insertPos:this.getStart(),newText:this.getText()+`: ${text}`,parent,replacing:{textLength:this.getWidth()}}),parent.getChildAtIndexIfKindOrThrow(childIndex,common.SyntaxKind.PropertyAssignment)}set(structure){return callBaseSet(ShorthandPropertyAssignmentBase.prototype,this,structure),this}getStructure(){let structure=callBaseGetStructure(ShorthandPropertyAssignmentBase.prototype,this,{kind:exports.StructureKind.ShorthandPropertyAssignment});return delete structure.hasQuestionToken,structure}getValueSymbol(){return this._context.typeChecker.getShorthandAssignmentValueSymbol(this)}getValueSymbolOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getValueSymbol(),message??"Expected to find a value symbol.",this)}},SpreadAssignmentBase=ExpressionedNode(ObjectLiteralElement),SpreadAssignment=class extends SpreadAssignmentBase{set(structure){return callBaseSet(SpreadAssignmentBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(SpreadAssignmentBase.prototype,this,{kind:exports.StructureKind.SpreadAssignment,expression:this.getExpression().getText()})}},OmittedExpressionBase=Expression,OmittedExpression=class extends OmittedExpressionBase{},ParenthesizedExpressionBase=ExpressionedNode(Expression),ParenthesizedExpression=class extends ParenthesizedExpressionBase{},PartiallyEmittedExpressionBase=ExpressionedNode(Expression),PartiallyEmittedExpression=class extends PartiallyEmittedExpressionBase{},PostfixUnaryExpressionBase=UnaryExpression,PostfixUnaryExpression=class extends PostfixUnaryExpressionBase{getOperatorToken(){return this.compilerNode.operator}getOperand(){return this._getNodeFromCompilerNode(this.compilerNode.operand)}},PrefixUnaryExpressionBase=UnaryExpression,PrefixUnaryExpression=class extends PrefixUnaryExpressionBase{getOperatorToken(){return this.compilerNode.operator}getOperand(){return this._getNodeFromCompilerNode(this.compilerNode.operand)}},createBase$y=ctor=>NamedNode(QuestionDotTokenableNode(LeftHandSideExpressionedNode(ctor))),PropertyAccessExpressionBase=createBase$y(MemberExpression),PropertyAccessExpression=class extends PropertyAccessExpressionBase{},createBase$x=ctor=>TypedNode(ExpressionedNode(ctor)),SatisfiesExpressionBase=createBase$x(Expression),SatisfiesExpression=class extends SatisfiesExpressionBase{},SpreadElementBase=ExpressionedNode(Expression),SpreadElement=class extends SpreadElementBase{},SuperElementAccessExpressionBase=SuperExpressionedNode(ElementAccessExpression),SuperElementAccessExpression=class extends SuperElementAccessExpressionBase{},SuperExpressionBase=PrimaryExpression,SuperExpression=class extends SuperExpressionBase{},SuperPropertyAccessExpressionBase=SuperExpressionedNode(PropertyAccessExpression),SuperPropertyAccessExpression=class extends SuperPropertyAccessExpressionBase{},ThisExpressionBase=PrimaryExpression,ThisExpression=class extends ThisExpressionBase{},createBase$w=ctor=>TypedNode(UnaryExpressionedNode(ctor)),TypeAssertionBase=createBase$w(UnaryExpression),TypeAssertion=class extends TypeAssertionBase{},TypeOfExpressionBase=UnaryExpressionedNode(UnaryExpression),TypeOfExpression=class extends TypeOfExpressionBase{},VoidExpressionBase=UnaryExpressionedNode(UnaryExpression),VoidExpression=class extends VoidExpressionBase{},YieldExpressionBase=ExpressionableNode(GeneratorableNode(Expression)),YieldExpression=class extends YieldExpressionBase{},StatementBase=ChildOrderableNode(Node),Statement=class extends StatementBase{remove(){removeStatementedNodeChild(this)}};function StatementedNode(Base){return class extends Base{getStatements(){return(this._getCompilerStatementsContainer()?.statements??[]).map(s=>this._getNodeFromCompilerNode(s))}getStatementsWithComments(){return this._getCompilerStatementsWithComments().map(s=>this._getNodeFromCompilerNode(s))}getStatement(findFunction){return this.getStatements().find(findFunction)}getStatementOrThrow(findFunction,message){return common.errors.throwIfNullOrUndefined(this.getStatement(findFunction),message??"Expected to find a statement matching the provided condition.",this)}getStatementByKind(kind){let statement=this._getCompilerStatementsWithComments().find(s=>s.kind===kind);return this._getNodeFromCompilerNodeIfExists(statement)}getStatementByKindOrThrow(kind,message){return common.errors.throwIfNullOrUndefined(this.getStatementByKind(kind),message??`Expected to find a statement with syntax kind ${common.getSyntaxKindName(kind)}.`,this)}addStatements(textOrWriterFunction){return this.insertStatements(this._getCompilerStatementsWithComments().length,textOrWriterFunction)}insertStatements(index,statements){addBodyIfNotExists(this);let writerFunction=writer=>{this._context.structurePrinterFactory.forStatement({isAmbient:isNodeAmbientOrInAmbientContext(this)}).printTexts(writer,statements)};return getChildSyntaxList.call(this).insertChildText(index,writerFunction);function getChildSyntaxList(){let childSyntaxList=this.getChildSyntaxListOrThrow();if(Node.isCaseClause(this)||Node.isDefaultClause(this)){let block=childSyntaxList.getFirstChildIfKind(common.SyntaxKind.Block);if(block!=null)return block.getChildSyntaxListOrThrow()}return childSyntaxList}}removeStatement(index){return index=verifyAndGetIndex(index,this._getCompilerStatementsWithComments().length-1),this.removeStatements([index,index])}removeStatements(indexRange){let statements=this.getStatementsWithComments();return common.errors.throwIfRangeOutOfRange(indexRange,[0,statements.length],"indexRange"),removeStatementedNodeChildren(statements.slice(indexRange[0],indexRange[1]+1)),this}addClass(structure){return this.addClasses([structure])[0]}addClasses(structures){return this.insertClasses(this._getCompilerStatementsWithComments().length,structures)}insertClass(index,structure){return this.insertClasses(index,[structure])[0]}insertClasses(index,structures){return this._insertChildren({expectedKind:common.SyntaxKind.ClassDeclaration,index,structures,write:(writer,info)=>{this._standardWrite(writer,info,()=>{this._context.structurePrinterFactory.forClassDeclaration({isAmbient:isNodeAmbientOrInAmbientContext(this)}).printTexts(writer,structures)})}})}getClasses(){return this.getStatements().filter(Node.isClassDeclaration)}getClass(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getClasses(),nameOrFindFunction)}getClassOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getClass(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("class",nameOrFindFunction))}addEnum(structure){return this.addEnums([structure])[0]}addEnums(structures){return this.insertEnums(this._getCompilerStatementsWithComments().length,structures)}insertEnum(index,structure){return this.insertEnums(index,[structure])[0]}insertEnums(index,structures){return this._insertChildren({expectedKind:common.SyntaxKind.EnumDeclaration,index,structures,write:(writer,info)=>{this._standardWrite(writer,info,()=>{this._context.structurePrinterFactory.forEnumDeclaration().printTexts(writer,structures)})}})}getEnums(){return this.getStatements().filter(Node.isEnumDeclaration)}getEnum(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getEnums(),nameOrFindFunction)}getEnumOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getEnum(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("enum",nameOrFindFunction))}addFunction(structure){return this.addFunctions([structure])[0]}addFunctions(structures){return this.insertFunctions(this._getCompilerStatementsWithComments().length,structures)}insertFunction(index,structure){return this.insertFunctions(index,[structure])[0]}insertFunctions(index,structures){return this._insertChildren({expectedKind:common.SyntaxKind.FunctionDeclaration,index,structures,write:(writer,info)=>{this._standardWrite(writer,info,()=>{this._context.structurePrinterFactory.forFunctionDeclaration({isAmbient:isNodeAmbientOrInAmbientContext(this)}).printTexts(writer,structures)},{previousNewLine:previousMember=>structures[0].hasDeclareKeyword===!0&&Node.isFunctionDeclaration(previousMember)&&previousMember.getBody()==null,nextNewLine:nextMember=>structures[structures.length-1].hasDeclareKeyword===!0&&Node.isFunctionDeclaration(nextMember)&&nextMember.getBody()==null})}})}getFunctions(){return this.getStatements().filter(Node.isFunctionDeclaration).filter(f=>f.isAmbient()||f.isImplementation())}getFunction(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getFunctions(),nameOrFindFunction)}getFunctionOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getFunction(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("function",nameOrFindFunction))}addInterface(structure){return this.addInterfaces([structure])[0]}addInterfaces(structures){return this.insertInterfaces(this._getCompilerStatementsWithComments().length,structures)}insertInterface(index,structure){return this.insertInterfaces(index,[structure])[0]}insertInterfaces(index,structures){return this._insertChildren({expectedKind:common.SyntaxKind.InterfaceDeclaration,index,structures,write:(writer,info)=>{this._standardWrite(writer,info,()=>{this._context.structurePrinterFactory.forInterfaceDeclaration().printTexts(writer,structures)})}})}getInterfaces(){return this.getStatements().filter(Node.isInterfaceDeclaration)}getInterface(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getInterfaces(),nameOrFindFunction)}getInterfaceOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getInterface(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("interface",nameOrFindFunction))}addModule(structure){return this.addModules([structure])[0]}addModules(structures){return this.insertModules(this._getCompilerStatementsWithComments().length,structures)}insertModule(index,structure){return this.insertModules(index,[structure])[0]}insertModules(index,structures){return this._insertChildren({expectedKind:common.SyntaxKind.ModuleDeclaration,index,structures,write:(writer,info)=>{this._standardWrite(writer,info,()=>{this._context.structurePrinterFactory.forModuleDeclaration({isAmbient:isNodeAmbientOrInAmbientContext(this)}).printTexts(writer,structures)})}})}getModules(){return this.getStatements().filter(Node.isModuleDeclaration)}getModule(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getModules(),nameOrFindFunction)}getModuleOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getModule(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("module",nameOrFindFunction))}addTypeAlias(structure){return this.addTypeAliases([structure])[0]}addTypeAliases(structures){return this.insertTypeAliases(this._getCompilerStatementsWithComments().length,structures)}insertTypeAlias(index,structure){return this.insertTypeAliases(index,[structure])[0]}insertTypeAliases(index,structures){return this._insertChildren({expectedKind:common.SyntaxKind.TypeAliasDeclaration,index,structures,write:(writer,info)=>{this._standardWrite(writer,info,()=>{this._context.structurePrinterFactory.forTypeAliasDeclaration().printTexts(writer,structures)},{previousNewLine:previousMember=>Node.isTypeAliasDeclaration(previousMember),nextNewLine:nextMember=>Node.isTypeAliasDeclaration(nextMember)})}})}getTypeAliases(){return this.getStatements().filter(Node.isTypeAliasDeclaration)}getTypeAlias(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getTypeAliases(),nameOrFindFunction)}getTypeAliasOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getTypeAlias(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("type alias",nameOrFindFunction))}getVariableStatements(){return this.getStatements().filter(Node.isVariableStatement)}getVariableStatement(nameOrFindFunction){return this.getVariableStatements().find(getFindFunction());function getFindFunction(){return typeof nameOrFindFunction=="string"?statement=>statement.getDeclarations().some(d=>nodeHasName(d,nameOrFindFunction)):nameOrFindFunction}}getVariableStatementOrThrow(nameOrFindFunction,message){return common.errors.throwIfNullOrUndefined(this.getVariableStatement(nameOrFindFunction),message??"Expected to find a variable statement that matched the provided condition.",this)}addVariableStatement(structure){return this.addVariableStatements([structure])[0]}addVariableStatements(structures){return this.insertVariableStatements(this._getCompilerStatementsWithComments().length,structures)}insertVariableStatement(index,structure){return this.insertVariableStatements(index,[structure])[0]}insertVariableStatements(index,structures){return this._insertChildren({expectedKind:common.SyntaxKind.VariableStatement,index,structures,write:(writer,info)=>{this._standardWrite(writer,info,()=>{this._context.structurePrinterFactory.forVariableStatement().printTexts(writer,structures)},{previousNewLine:previousMember=>Node.isVariableStatement(previousMember),nextNewLine:nextMember=>Node.isVariableStatement(nextMember)})}})}getVariableDeclarations(){let variables=[];for(let list of this.getVariableStatements())variables.push(...list.getDeclarations());return variables}getVariableDeclaration(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getVariableDeclarations(),nameOrFindFunction)}getVariableDeclarationOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getVariableDeclaration(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("variable declaration",nameOrFindFunction))}getStructure(){let structure={};return Node.isBodyable(this)&&!this.hasBody()?structure.statements=void 0:structure.statements=this.getStatements().map(s=>Node._hasStructure(s)?s.getStructure():s.getText({trimLeadingIndentation:!0})),callBaseGetStructure(Base.prototype,this,structure)}set(structure){if(Node.isBodyable(this)&&structure.statements==null&&structure.hasOwnProperty(common.nameof(structure,"statements")))this.removeBody();else if(structure.statements!=null){let statementCount=this._getCompilerStatementsWithComments().length;statementCount>0&&this.removeStatements([0,statementCount-1])}return callBaseSet(Base.prototype,this,structure),structure.statements!=null&&this.addStatements(structure.statements),this}_getCompilerStatementsWithComments(){let statementsContainer=this._getCompilerStatementsContainer();return statementsContainer==null?[]:ExtendedParser.getContainerArray(statementsContainer,this._sourceFile.compilerNode)}_getCompilerStatementsContainer(){if(Node.isSourceFile(this)||Node.isCaseClause(this)||Node.isDefaultClause(this))return this.compilerNode;if(Node.isModuleDeclaration(this)){let body=this._getInnerBody();return body?.compilerNode}else{if(Node.isBodyable(this)||Node.isBodied(this))return this.getBody()?.compilerNode;if(Node.isBlock(this)||Node.isModuleBlock(this))return this.compilerNode;throw new common.errors.NotImplementedError(`Could not find the statements for node kind: ${this.getKindName()}, text: ${this.getText()}`)}}_insertChildren(opts){return addBodyIfNotExists(this),insertIntoBracesOrSourceFileWithGetChildren({expectedKind:opts.expectedKind,getIndexedChildren:()=>this.getStatementsWithComments(),index:opts.index,parent:this,structures:opts.structures,write:(writer,info)=>opts.write(writer,info)})}_standardWrite(writer,info,writeStructures,opts={}){info.previousMember!=null&&(opts.previousNewLine==null||!opts.previousNewLine(info.previousMember))&&!Node.isCommentNode(info.previousMember)?writer.blankLine():info.isStartOfFile||writer.newLineIfLastNot(),writeStructures(),info.nextMember!=null&&(opts.nextNewLine==null||!opts.nextNewLine(info.nextMember))?writer.blankLine():writer.newLineIfLastNot()}}}function addBodyIfNotExists(node){Node.isBodyable(node)&&!node.hasBody()&&node.addBody()}var createBase$v=ctor=>TextInsertableNode(StatementedNode(ctor)),BlockBase=createBase$v(Statement),Block=class extends BlockBase{},BreakStatement=class extends Statement{getLabel(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.label)}getLabelOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getLabel(),message??"Expected to find a label.",this)}},CaseBlockBase=TextInsertableNode(Node),CaseBlock=class extends CaseBlockBase{getClauses(){return(this.compilerNode.clauses||[]).map(s=>this._getNodeFromCompilerNode(s))}removeClause(index){return index=verifyAndGetIndex(index,this.getClauses().length-1),this.removeClauses([index,index])}removeClauses(indexRange){let clauses=this.getClauses();return common.errors.throwIfRangeOutOfRange(indexRange,[0,clauses.length],"indexRange"),removeClausedNodeChildren(clauses.slice(indexRange[0],indexRange[1]+1)),this}},createBase$u=ctor=>JSDocableNode(ExpressionedNode(TextInsertableNode(StatementedNode(ctor)))),CaseClauseBase=createBase$u(Node),CaseClause=class extends CaseClauseBase{remove(){removeClausedNodeChild(this)}},CatchClauseBase=Node,CatchClause=class extends CatchClauseBase{getBlock(){return this._getNodeFromCompilerNode(this.compilerNode.block)}getVariableDeclaration(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.variableDeclaration)}getVariableDeclarationOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getVariableDeclaration(),message??"Expected to find a variable declaration.",this)}},CommentStatement=class extends Statement{},ContinueStatement=class extends Statement{getLabel(){return this.compilerNode.label==null?void 0:this._getNodeFromCompilerNode(this.compilerNode.label)}getLabelOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getLabel(),message??"Expected to find a label.",this)}},DebuggerStatementBase=Statement,DebuggerStatement=class extends DebuggerStatementBase{},createBase$t=ctor=>TextInsertableNode(StatementedNode(ctor)),DefaultClauseBase=createBase$t(Node),DefaultClause=class extends DefaultClauseBase{remove(){removeClausedNodeChild(this)}},IterationStatement=class extends Statement{getStatement(){return this._getNodeFromCompilerNode(this.compilerNode.statement)}},DoStatementBase=ExpressionedNode(IterationStatement),DoStatement=class extends DoStatementBase{},EmptyStatementBase=Statement,EmptyStatement=class extends EmptyStatementBase{},ExpressionStatementBase=ExpressionedNode(JSDocableNode(Statement)),ExpressionStatement=class extends ExpressionStatementBase{},ForInStatementBase=ExpressionedNode(IterationStatement),ForInStatement=class extends ForInStatementBase{getInitializer(){return this._getNodeFromCompilerNode(this.compilerNode.initializer)}},ForOfStatementBase=ExpressionedNode(AwaitableNode(IterationStatement)),ForOfStatement=class extends ForOfStatementBase{getInitializer(){return this._getNodeFromCompilerNode(this.compilerNode.initializer)}},ForStatementBase=IterationStatement,ForStatement=class extends ForStatementBase{getInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.initializer)}getInitializerOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getInitializer(),message??"Expected to find an initializer.",this)}getCondition(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.condition)}getConditionOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getCondition(),message??"Expected to find a condition.",this)}getIncrementor(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.incrementor)}getIncrementorOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getIncrementor(),message??"Expected to find an incrementor.",this)}},IfStatementBase=ExpressionedNode(Statement),IfStatement=class extends IfStatementBase{getThenStatement(){return this._getNodeFromCompilerNode(this.compilerNode.thenStatement)}getElseStatement(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.elseStatement)}remove(){let nodes=[];Node.isIfStatement(this.getParentOrThrow())&&nodes.push(this.getPreviousSiblingIfKindOrThrow(common.SyntaxKind.ElseKeyword)),nodes.push(this),removeStatementedNodeChildren(nodes)}},LabeledStatementBase=JSDocableNode(Statement),LabeledStatement=class extends LabeledStatementBase{getLabel(){return this._getNodeFromCompilerNode(this.compilerNode.label)}getStatement(){return this._getNodeFromCompilerNode(this.compilerNode.statement)}},NotEmittedStatementBase=Statement,NotEmittedStatement=class extends NotEmittedStatementBase{},ReturnStatementBase=ExpressionableNode(Statement),ReturnStatement=class extends ReturnStatementBase{},SwitchStatementBase=ExpressionedNode(Statement),SwitchStatement=class extends SwitchStatementBase{getCaseBlock(){return this._getNodeFromCompilerNode(this.compilerNode.caseBlock)}getClauses(){return this.getCaseBlock().getClauses()}removeClause(index){return this.getCaseBlock().removeClause(index)}removeClauses(indexRange){return this.getCaseBlock().removeClauses(indexRange)}},ThrowStatementBase=ExpressionedNode(Statement),ThrowStatement=class extends ThrowStatementBase{},TryStatementBase=Statement,TryStatement=class extends TryStatementBase{getTryBlock(){return this._getNodeFromCompilerNode(this.compilerNode.tryBlock)}getCatchClause(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.catchClause)}getCatchClauseOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getCatchClause(),message??"Expected to find a catch clause.",this)}getFinallyBlock(){if(!(this.compilerNode.finallyBlock==null||this.compilerNode.finallyBlock.getFullWidth()===0))return this._getNodeFromCompilerNode(this.compilerNode.finallyBlock)}getFinallyBlockOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getFinallyBlock(),message??"Expected to find a finally block.",this)}},ExportAssignmentBase=ExpressionedNode(JSDocableNode(Statement)),ExportAssignment=class extends ExportAssignmentBase{isExportEquals(){return this.compilerNode.isExportEquals||!1}setIsExportEquals(value){return this.isExportEquals()===value?this:(value?this.getFirstChildByKindOrThrow(common.SyntaxKind.DefaultKeyword).replaceWithText("="):this.getFirstChildByKindOrThrow(common.SyntaxKind.EqualsToken).replaceWithText("default"),this)}set(structure){return callBaseSet(ExportAssignmentBase.prototype,this,structure),structure.expression!=null&&this.setExpression(structure.expression),structure.isExportEquals!=null&&this.setIsExportEquals(structure.isExportEquals),this}getStructure(){return callBaseGetStructure(Statement.prototype,this,{kind:exports.StructureKind.ExportAssignment,expression:this.getExpression().getText(),isExportEquals:this.isExportEquals()})}},ExportDeclarationBase=Statement,ExportDeclaration=class extends ExportDeclarationBase{isTypeOnly(){return this.compilerNode.isTypeOnly}setIsTypeOnly(value){if(this.isTypeOnly()===value)return this;if(value)insertIntoParentTextRange({parent:this,insertPos:(this.getNodeProperty("exportClause")??this.getFirstChildByKindOrThrow(common.SyntaxKind.AsteriskToken)).getStart(),newText:"type "});else{let typeKeyword=this.getFirstChildByKindOrThrow(common.ts.SyntaxKind.TypeKeyword);removeChildren({children:[typeKeyword],removeFollowingSpaces:!0})}return this}getNamespaceExport(){let exportClause=this.getNodeProperty("exportClause");return exportClause!=null&&Node.isNamespaceExport(exportClause)?exportClause:void 0}getNamespaceExportOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getNamespaceExport(),message??"Expected to find a namespace export.",this)}setNamespaceExport(name){let exportClause=this.getNodeProperty("exportClause"),newText=common.StringUtils.isNullOrWhitespace(name)?"*":`* as ${name}`;if(exportClause==null){let asteriskToken=this.getFirstChildByKindOrThrow(common.SyntaxKind.AsteriskToken);insertIntoParentTextRange({insertPos:asteriskToken.getStart(),parent:this,newText,replacing:{textLength:1}})}else Node.isNamespaceExport(exportClause)?exportClause.getNameNode().replaceWithText(name):insertIntoParentTextRange({insertPos:exportClause.getStart(),parent:this,newText,replacing:{textLength:exportClause.getWidth()}});return this}setModuleSpecifier(textOrSourceFile){let text=typeof textOrSourceFile=="string"?textOrSourceFile:this._sourceFile.getRelativePathAsModuleSpecifierTo(textOrSourceFile);if(common.StringUtils.isNullOrEmpty(text))return this.removeModuleSpecifier(),this;let stringLiteral=this.getModuleSpecifier();if(stringLiteral==null){let semiColonToken=this.getLastChildIfKind(common.SyntaxKind.SemicolonToken),quoteKind=this._context.manipulationSettings.getQuoteKind();insertIntoParentTextRange({insertPos:semiColonToken!=null?semiColonToken.getPos():this.getEnd(),parent:this,newText:` from ${quoteKind}${text}${quoteKind}`})}else stringLiteral.setLiteralValue(text);return this}getModuleSpecifier(){let moduleSpecifier=this._getNodeFromCompilerNodeIfExists(this.compilerNode.moduleSpecifier);if(moduleSpecifier!=null){if(!Node.isStringLiteral(moduleSpecifier))throw new common.errors.InvalidOperationError("Expected the module specifier to be a string literal.");return moduleSpecifier}}getModuleSpecifierValue(){return this.getModuleSpecifier()?.getLiteralValue()}getModuleSpecifierSourceFileOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getModuleSpecifierSourceFile(),message??"A module specifier source file was expected.",this)}getModuleSpecifierSourceFile(){let stringLiteral=this.getLastChildByKind(common.SyntaxKind.StringLiteral);if(stringLiteral==null)return;let symbol=stringLiteral.getSymbol();if(symbol==null)return;let declaration=symbol.getDeclarations()[0];return declaration!=null&&Node.isSourceFile(declaration)?declaration:void 0}isModuleSpecifierRelative(){let moduleSpecifierValue=this.getModuleSpecifierValue();return moduleSpecifierValue==null?!1:ModuleUtils.isModuleSpecifierRelative(moduleSpecifierValue)}removeModuleSpecifier(){let moduleSpecifier=this.getModuleSpecifier();if(moduleSpecifier==null)return this;if(!this.hasNamedExports())throw new common.errors.InvalidOperationError("Cannot remove the module specifier from an export declaration that has no named exports.");return removeChildren({children:[this.getFirstChildByKindOrThrow(common.SyntaxKind.FromKeyword),moduleSpecifier],removePrecedingNewLines:!0,removePrecedingSpaces:!0}),this}hasModuleSpecifier(){return this.getLastChildByKind(common.SyntaxKind.StringLiteral)!=null}isNamespaceExport(){return!this.hasNamedExports()}hasNamedExports(){return this.compilerNode.exportClause?.kind===common.SyntaxKind.NamedExports}addNamedExport(namedExport){return this.addNamedExports([namedExport])[0]}addNamedExports(namedExports){return this.insertNamedExports(this.getNamedExports().length,namedExports)}insertNamedExport(index,namedExport){return this.insertNamedExports(index,[namedExport])[0]}insertNamedExports(index,namedExports){if(!(namedExports instanceof Function)&&common.ArrayUtils.isNullOrEmpty(namedExports))return[];let originalNamedExports=this.getNamedExports(),writer=this._getWriterWithIndentation(),namedExportStructurePrinter=this._context.structurePrinterFactory.forNamedImportExportSpecifier();index=verifyAndGetIndex(index,originalNamedExports.length);let exportClause=this.getNodeProperty("exportClause");if(exportClause==null){namedExportStructurePrinter.printTextsWithBraces(writer,namedExports);let asteriskToken=this.getFirstChildByKindOrThrow(common.SyntaxKind.AsteriskToken);insertIntoParentTextRange({insertPos:asteriskToken.getStart(),parent:this,newText:writer.toString(),replacing:{textLength:1}})}else exportClause.getKind()===common.SyntaxKind.NamespaceExport?(namedExportStructurePrinter.printTextsWithBraces(writer,namedExports),insertIntoParentTextRange({insertPos:exportClause.getStart(),parent:this,newText:writer.toString(),replacing:{textLength:exportClause.getWidth()}})):(namedExportStructurePrinter.printTexts(writer,namedExports),insertIntoCommaSeparatedNodes({parent:this.getFirstChildByKindOrThrow(common.SyntaxKind.NamedExports).getFirstChildByKindOrThrow(common.SyntaxKind.SyntaxList),currentNodes:originalNamedExports,insertIndex:index,newText:writer.toString(),surroundWithSpaces:this._context.getFormatCodeSettings().insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces,useTrailingCommas:!1}));let newNamedExports=this.getNamedExports();return getNodesToReturn(originalNamedExports,newNamedExports,index,!1)}getNamedExports(){let namedExports=this.compilerNode.exportClause;return namedExports==null||common.ts.isNamespaceExport(namedExports)?[]:namedExports.elements.map(e=>this._getNodeFromCompilerNode(e))}toNamespaceExport(){if(!this.hasModuleSpecifier())throw new common.errors.InvalidOperationError("Cannot change to a namespace export when no module specifier exists.");let namedExportsNode=this.getNodeProperty("exportClause");return namedExportsNode==null?this:(insertIntoParentTextRange({parent:this,newText:"*",insertPos:namedExportsNode.getStart(),replacing:{textLength:namedExportsNode.getWidth()}}),this)}setAttributes(elements){let attributes=this.getAttributes();if(attributes)elements?attributes.setElements(elements):attributes.remove();else if(elements){let printer=this._context.structurePrinterFactory.forImportAttribute(),writer=this._context.createWriter();writer.space(),printer.printAttributes(writer,elements),insertIntoParentTextRange({parent:this,newText:writer.toString(),insertPos:this.getSourceFile().getFullText()[this.getEnd()-1]===";"?this.getEnd()-1:this.getEnd()})}return this}getAttributes(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.attributes)}set(structure){return callBaseSet(ExportDeclarationBase.prototype,this,structure),structure.namedExports!=null?(setEmptyNamedExport(this),this.addNamedExports(structure.namedExports)):structure.hasOwnProperty(common.nameof(structure,"namedExports"))&&structure.moduleSpecifier==null&&this.toNamespaceExport(),structure.moduleSpecifier!=null?this.setModuleSpecifier(structure.moduleSpecifier):structure.hasOwnProperty(common.nameof(structure,"moduleSpecifier"))&&this.removeModuleSpecifier(),structure.namedExports==null&&structure.hasOwnProperty(common.nameof(structure,"namedExports"))&&this.toNamespaceExport(),structure.namespaceExport!=null&&this.setNamespaceExport(structure.namespaceExport),structure.isTypeOnly!=null&&this.setIsTypeOnly(structure.isTypeOnly),structure.hasOwnProperty(common.nameof(structure,"attributes"))&&this.setAttributes(structure.attributes),this}getStructure(){let moduleSpecifier=this.getModuleSpecifier(),attributes=this.getAttributes();return callBaseGetStructure(ExportDeclarationBase.prototype,this,{kind:exports.StructureKind.ExportDeclaration,isTypeOnly:this.isTypeOnly(),moduleSpecifier:moduleSpecifier?.getLiteralText(),namedExports:this.getNamedExports().map(node=>node.getStructure()),namespaceExport:this.getNamespaceExport()?.getName(),attributes:attributes?attributes.getElements().map(e=>e.getStructure()):void 0})}};function setEmptyNamedExport(node){let namedExportsNode=node.getNodeProperty("exportClause"),replaceNode;if(namedExportsNode!=null){if(node.getNamedExports().length===0)return;replaceNode=namedExportsNode}else replaceNode=node.getFirstChildByKindOrThrow(common.SyntaxKind.AsteriskToken);insertIntoParentTextRange({parent:node,newText:"{ }",insertPos:replaceNode.getStart(),replacing:{textLength:replaceNode.getWidth()}})}var ExportSpecifierBase=Node,ExportSpecifier=class extends ExportSpecifierBase{setName(name){let nameNode=this.getNameNode();return nameNode.getText()===name?this:(nameNode.replaceWithText(name),this)}getName(){return this.getNameNode().getText()}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.propertyName||this.compilerNode.name)}renameAlias(alias){if(common.StringUtils.isNullOrWhitespace(alias))return this.removeAliasWithRename(),this;let aliasIdentifier=this.getAliasNode();return aliasIdentifier==null&&(this.setAlias(this.getName()),aliasIdentifier=this.getAliasNode()),aliasIdentifier.rename(alias),this}setAlias(alias){if(common.StringUtils.isNullOrWhitespace(alias))return this.removeAlias(),this;let aliasIdentifier=this.getAliasNode();return aliasIdentifier==null?insertIntoParentTextRange({insertPos:this.getNameNode().getEnd(),parent:this,newText:` as ${alias}`}):aliasIdentifier.replaceWithText(alias),this}removeAlias(){let aliasIdentifier=this.getAliasNode();return aliasIdentifier==null?this:(removeChildren({children:[this.getFirstChildByKindOrThrow(common.SyntaxKind.AsKeyword),aliasIdentifier],removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this)}removeAliasWithRename(){let aliasIdentifier=this.getAliasNode();return aliasIdentifier==null?this:(aliasIdentifier.rename(this.getName()),this.removeAlias(),this)}getAliasNode(){if(this.compilerNode.propertyName!=null)return this._getNodeFromCompilerNode(this.compilerNode.name)}isTypeOnly(){return this.compilerNode.isTypeOnly}setIsTypeOnly(value){return this.isTypeOnly()===value?this:(value?insertIntoParentTextRange({insertPos:this.getStart(),parent:this,newText:"type "}):removeChildren({children:[this.getFirstChildByKindOrThrow(common.ts.SyntaxKind.TypeKeyword)],removeFollowingSpaces:!0}),this)}getExportDeclaration(){return this.getFirstAncestorByKindOrThrow(common.SyntaxKind.ExportDeclaration)}getLocalTargetSymbolOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getLocalTargetSymbol(),message??"The export specifier's local target symbol was expected.",this)}getLocalTargetSymbol(){return this._context.typeChecker.getExportSpecifierLocalTargetSymbol(this)}getLocalTargetDeclarations(){return this.getLocalTargetSymbol()?.getDeclarations()??[]}remove(){let exportDeclaration=this.getExportDeclaration();exportDeclaration.getNamedExports().length>1?removeCommaSeparatedChild(this):exportDeclaration.hasModuleSpecifier()?exportDeclaration.toNamespaceExport():exportDeclaration.remove()}set(structure){return callBaseSet(ExportSpecifierBase.prototype,this,structure),structure.isTypeOnly!=null&&this.setIsTypeOnly(structure.isTypeOnly),structure.name!=null&&this.setName(structure.name),structure.alias!=null?this.setAlias(structure.alias):structure.hasOwnProperty(common.nameof(structure,"alias"))&&this.removeAlias(),this}getStructure(){let alias=this.getAliasNode();return callBaseGetStructure(Node.prototype,this,{kind:exports.StructureKind.ExportSpecifier,alias:alias?alias.getText():void 0,name:this.getNameNode().getText(),isTypeOnly:this.isTypeOnly()})}},ExternalModuleReferenceBase=ExpressionableNode(Node),ExternalModuleReference=class extends ExternalModuleReferenceBase{getReferencedSourceFileOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getReferencedSourceFile(),message??"Expected to find the referenced source file.",this)}isRelative(){let expression=this.getExpression();return expression==null||!Node.isStringLiteral(expression)?!1:ModuleUtils.isModuleSpecifierRelative(expression.getLiteralText())}getReferencedSourceFile(){let expression=this.getExpression();if(expression==null)return;let symbol=expression.getSymbol();if(symbol!=null)return ModuleUtils.getReferencedSourceFileFromSymbol(symbol)}},ImportAttributeBase=ImportAttributeNamedNode(Node),ImportAttribute=class extends ImportAttributeBase{getValue(){return this._getNodeFromCompilerNode(this.compilerNode.value)}set(structure){return callBaseSet(ImportAttributeBase.prototype,this,structure),structure.value&&this.getValue().replaceWithText(structure.value),this}getStructure(){return callBaseGetStructure(ImportAttributeBase.prototype,this,{kind:exports.StructureKind.ImportAttribute,value:this.getValue().getText()})}},ImportAttributesBase=Node,ImportAttributes=class extends ImportAttributesBase{setElements(elements){return this.replaceWithText(writer=>{this._context.structurePrinterFactory.forImportAttribute().printAttributes(writer,elements)}),this}getElements(){return this.compilerNode.elements.map(e=>this._getNodeFromCompilerNode(e))}remove(){removeChildren({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}},ImportClauseBase=Node,ImportClause=class extends ImportClauseBase{isTypeOnly(){return this.compilerNode.isTypeOnly}setIsTypeOnly(value){if(this.isTypeOnly()===value)return this;if(value)insertIntoParentTextRange({parent:this,insertPos:this.getStart(),newText:"type "});else{let typeKeyword=this.getFirstChildByKindOrThrow(common.ts.SyntaxKind.TypeKeyword);removeChildren({children:[typeKeyword],removeFollowingSpaces:!0})}return this}getDefaultImportOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getDefaultImport(),message??"Expected to find a default import.",this)}getDefaultImport(){return this.getNodeProperty("name")}getNamedBindingsOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getNamedBindings(),message??"Expected to find an import declaration's named bindings.",this)}getNamedBindings(){return this.getNodeProperty("namedBindings")}getNamespaceImportOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getNamespaceImport(),message??"Expected to find a namespace import.",this)}getNamespaceImport(){let namedBindings=this.getNamedBindings();if(!(namedBindings==null||!Node.isNamespaceImport(namedBindings)))return namedBindings.getNameNode()}getNamedImports(){let namedBindings=this.getNamedBindings();return namedBindings==null||!Node.isNamedImports(namedBindings)?[]:namedBindings.getElements()}},ImportDeclarationBase=Statement,ImportDeclaration=class extends ImportDeclarationBase{isTypeOnly(){return this.getImportClause()?.isTypeOnly()??!1}setIsTypeOnly(value){let importClause=this.getImportClause();if(importClause==null){if(value)throw new common.errors.InvalidOperationError("Cannot set an import as type only when there is no import clause.");return this}return importClause.setIsTypeOnly(value),this}setModuleSpecifier(textOrSourceFile){let text=typeof textOrSourceFile=="string"?textOrSourceFile:this._sourceFile.getRelativePathAsModuleSpecifierTo(textOrSourceFile);return this.getModuleSpecifier().setLiteralValue(text),this}getModuleSpecifier(){let moduleSpecifier=this._getNodeFromCompilerNode(this.compilerNode.moduleSpecifier);if(!Node.isStringLiteral(moduleSpecifier))throw new common.errors.InvalidOperationError("Expected the module specifier to be a string literal.");return moduleSpecifier}getModuleSpecifierValue(){return this.getModuleSpecifier().getLiteralValue()}getModuleSpecifierSourceFileOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getModuleSpecifierSourceFile(),message??"A module specifier source file was expected.",this)}getModuleSpecifierSourceFile(){let symbol=this.getModuleSpecifier().getSymbol();if(symbol!=null)return ModuleUtils.getReferencedSourceFileFromSymbol(symbol)}isModuleSpecifierRelative(){return ModuleUtils.isModuleSpecifierRelative(this.getModuleSpecifierValue())}setDefaultImport(text){if(common.StringUtils.isNullOrWhitespace(text))return this.removeDefaultImport();let defaultImport=this.getDefaultImport();if(defaultImport!=null)return defaultImport.replaceWithText(text),this;let importKeyword=this.getFirstChildByKindOrThrow(common.SyntaxKind.ImportKeyword),importClause=this.getImportClause();return importClause==null?(insertIntoParentTextRange({insertPos:importKeyword.getEnd(),parent:this,newText:` ${text} from`}),this):(insertIntoParentTextRange({insertPos:importKeyword.getEnd(),parent:importClause,newText:` ${text},`}),this)}renameDefaultImport(text){if(common.StringUtils.isNullOrWhitespace(text))return this.removeDefaultImport();let defaultImport=this.getDefaultImport();return defaultImport!=null?(defaultImport.rename(text),this):(this.setDefaultImport(text),this)}getDefaultImportOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getDefaultImport(),message??"Expected to find a default import.",this)}getDefaultImport(){return this.getImportClause()?.getDefaultImport()??void 0}setNamespaceImport(text){if(common.StringUtils.isNullOrWhitespace(text))return this.removeNamespaceImport();let namespaceImport=this.getNamespaceImport();if(namespaceImport!=null)return namespaceImport.rename(text),this;if(this.getNamedImports().length>0)throw new common.errors.InvalidOperationError("Cannot add a namespace import to an import declaration that has named imports.");let defaultImport=this.getDefaultImport();return defaultImport!=null?(insertIntoParentTextRange({insertPos:defaultImport.getEnd(),parent:this.getImportClause(),newText:`, * as ${text}`}),this):(insertIntoParentTextRange({insertPos:this.getFirstChildByKindOrThrow(common.SyntaxKind.ImportKeyword).getEnd(),parent:this,newText:` * as ${text} from`}),this)}removeNamespaceImport(){let namespaceImport=this.getNamespaceImport();if(namespaceImport==null)return this;return removeChildren({children:getChildrenToRemove.call(this),removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this;function getChildrenToRemove(){let defaultImport=this.getDefaultImport();return defaultImport==null?[this.getImportClauseOrThrow(),this.getLastChildByKindOrThrow(common.SyntaxKind.FromKeyword)]:[defaultImport.getNextSiblingIfKindOrThrow(common.SyntaxKind.CommaToken),namespaceImport]}}removeDefaultImport(){let importClause=this.getImportClause();if(importClause==null)return this;let defaultImport=importClause.getDefaultImport();return defaultImport==null?this:(importClause.getNamedBindings()==null?importClause.isTypeOnly()?insertIntoParentTextRange({parent:importClause,newText:"{}",insertPos:defaultImport.getStart(),replacing:{textLength:defaultImport.getWidth()}}):removeChildren({children:[importClause,importClause.getNextSiblingIfKindOrThrow(common.SyntaxKind.FromKeyword)],removePrecedingSpaces:!0,removePrecedingNewLines:!0}):removeChildren({children:[defaultImport,defaultImport.getNextSiblingIfKindOrThrow(common.SyntaxKind.CommaToken)],removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this)}getNamespaceImportOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getNamespaceImport(),message??"Expected to find a namespace import.",this)}getNamespaceImport(){return this.getImportClause()?.getNamespaceImport()??void 0}addNamedImport(namedImport){return this.addNamedImports([namedImport])[0]}addNamedImports(namedImports){return this.insertNamedImports(this.getNamedImports().length,namedImports)}insertNamedImport(index,namedImport){return this.insertNamedImports(index,[namedImport])[0]}insertNamedImports(index,namedImports){if(!(namedImports instanceof Function)&&common.ArrayUtils.isNullOrEmpty(namedImports))return[];let originalNamedImports=this.getNamedImports(),writer=this._getWriterWithQueuedIndentation(),namedImportStructurePrinter=this._context.structurePrinterFactory.forNamedImportExportSpecifier(),importClause=this.getImportClause();if(index=verifyAndGetIndex(index,originalNamedImports.length),originalNamedImports.length===0)if(namedImportStructurePrinter.printTextsWithBraces(writer,namedImports),importClause==null)insertIntoParentTextRange({insertPos:this.getFirstChildByKindOrThrow(common.SyntaxKind.ImportKeyword).getEnd(),parent:this,newText:` ${writer.toString()} from`});else{if(this.getNamespaceImport()!=null)throw getErrorWhenNamespaceImportsExist();if(importClause.getNamedBindings()!=null){let namedBindings=importClause.getNamedBindingsOrThrow();insertIntoParentTextRange({insertPos:namedBindings.getStart(),replacing:{textLength:namedBindings.getWidth()},parent:importClause,newText:writer.toString()})}else insertIntoParentTextRange({insertPos:this.getDefaultImport().getEnd(),parent:importClause,newText:`, ${writer.toString()}`})}else{if(importClause==null)throw new common.errors.NotImplementedError("Expected to have an import clause.");namedImportStructurePrinter.printTexts(writer,namedImports),insertIntoCommaSeparatedNodes({parent:importClause.getFirstChildByKindOrThrow(common.SyntaxKind.NamedImports).getFirstChildByKindOrThrow(common.SyntaxKind.SyntaxList),currentNodes:originalNamedImports,insertIndex:index,newText:writer.toString(),surroundWithSpaces:this._context.getFormatCodeSettings().insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces,useTrailingCommas:!1})}let newNamedImports=this.getNamedImports();return getNodesToReturn(originalNamedImports,newNamedImports,index,!1)}getNamedImports(){return this.getImportClause()?.getNamedImports()??[]}removeNamedImports(){let importClause=this.getImportClause();if(importClause==null)return this;let namedImportsNode=importClause.getNamedBindings();if(namedImportsNode==null||namedImportsNode.getKind()!==common.SyntaxKind.NamedImports)return this;let defaultImport=this.getDefaultImport();if(defaultImport!=null){let commaToken=defaultImport.getNextSiblingIfKindOrThrow(common.SyntaxKind.CommaToken);return removeChildren({children:[commaToken,namedImportsNode]}),this}let fromKeyword=importClause.getNextSiblingIfKindOrThrow(common.SyntaxKind.FromKeyword);return removeChildren({children:[importClause,fromKeyword],removePrecedingSpaces:!0}),this}getImportClauseOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getImportClause(),message??"Expected to find an import clause.",this)}getImportClause(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.importClause)}setAttributes(elements){let attributes=this.getAttributes();if(attributes)elements?attributes.setElements(elements):attributes.remove();else if(elements){let printer=this._context.structurePrinterFactory.forImportAttribute(),writer=this._context.createWriter();writer.space(),printer.printAttributes(writer,elements),insertIntoParentTextRange({parent:this,newText:writer.toString(),insertPos:this.getSourceFile().getFullText()[this.getEnd()-1]===";"?this.getEnd()-1:this.getEnd()})}return this}getAttributes(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.attributes)}set(structure){return callBaseSet(ImportDeclarationBase.prototype,this,structure),structure.defaultImport!=null?this.setDefaultImport(structure.defaultImport):structure.hasOwnProperty(common.nameof(structure,"defaultImport"))&&this.removeDefaultImport(),structure.hasOwnProperty(common.nameof(structure,"namedImports"))&&this.removeNamedImports(),structure.namespaceImport!=null?this.setNamespaceImport(structure.namespaceImport):structure.hasOwnProperty(common.nameof(structure,"namespaceImport"))&&this.removeNamespaceImport(),structure.namedImports!=null&&(setEmptyNamedImport(this),this.addNamedImports(structure.namedImports)),structure.moduleSpecifier!=null&&this.setModuleSpecifier(structure.moduleSpecifier),structure.isTypeOnly!=null&&this.setIsTypeOnly(structure.isTypeOnly),structure.hasOwnProperty(common.nameof(structure,"attributes"))&&this.setAttributes(structure.attributes),this}getStructure(){let namespaceImport=this.getNamespaceImport(),defaultImport=this.getDefaultImport(),attributes=this.getAttributes();return callBaseGetStructure(ImportDeclarationBase.prototype,this,{kind:exports.StructureKind.ImportDeclaration,isTypeOnly:this.isTypeOnly(),defaultImport:defaultImport?defaultImport.getText():void 0,moduleSpecifier:this.getModuleSpecifier().getLiteralText(),namedImports:this.getNamedImports().map(node=>node.getStructure()),namespaceImport:namespaceImport?namespaceImport.getText():void 0,attributes:attributes?attributes.getElements().map(e=>e.getStructure()):void 0})}};function setEmptyNamedImport(node){let importClause=node.getNodeProperty("importClause"),writer=node._getWriterWithQueuedChildIndentation();node._context.structurePrinterFactory.forNamedImportExportSpecifier().printTextsWithBraces(writer,[]);let emptyBracesText=writer.toString();if(node.getNamespaceImport()!=null)throw getErrorWhenNamespaceImportsExist();if(importClause==null){insertIntoParentTextRange({insertPos:node.getFirstChildByKindOrThrow(common.SyntaxKind.ImportKeyword).getEnd(),parent:node,newText:` ${emptyBracesText} from`});return}let replaceNode=importClause.getNamedBindings();if(replaceNode!=null){insertIntoParentTextRange({parent:importClause,newText:emptyBracesText,insertPos:replaceNode.getStart(),replacing:{textLength:replaceNode.getWidth()}});return}let defaultImport=importClause.getDefaultImport();if(defaultImport!=null){insertIntoParentTextRange({insertPos:defaultImport.getEnd(),parent:importClause,newText:`, ${emptyBracesText}`});return}}function getErrorWhenNamespaceImportsExist(){return new common.errors.InvalidOperationError("Cannot add a named import to an import declaration that has a namespace import.")}var createBase$s=ctor=>ExportableNode(ModifierableNode(JSDocableNode(NamedNode(ctor)))),ImportEqualsDeclarationBase=createBase$s(Statement),ImportEqualsDeclaration=class extends ImportEqualsDeclarationBase{isTypeOnly(){return this.compilerNode.isTypeOnly??!1}setIsTypeOnly(value){if(this.isTypeOnly()===value)return this;if(value)insertIntoParentTextRange({parent:this,insertPos:this.getNameNode().getStart(),newText:"type "});else{let typeKeyword=this.getFirstChildByKindOrThrow(common.ts.SyntaxKind.TypeKeyword);removeChildren({children:[typeKeyword],removeFollowingSpaces:!0})}return this}getModuleReference(){return this._getNodeFromCompilerNode(this.compilerNode.moduleReference)}isExternalModuleReferenceRelative(){let moduleReference=this.getModuleReference();return Node.isExternalModuleReference(moduleReference)?moduleReference.isRelative():!1}setExternalModuleReference(textOrSourceFile){let text=typeof textOrSourceFile=="string"?textOrSourceFile:this._sourceFile.getRelativePathAsModuleSpecifierTo(textOrSourceFile),moduleReference=this.getModuleReference();return Node.isExternalModuleReference(moduleReference)&&moduleReference.getExpression()!=null?moduleReference.getExpressionOrThrow().replaceWithText(writer=>writer.quote(text)):moduleReference.replaceWithText(writer=>writer.write("require(").quote(text).write(")")),this}getExternalModuleReferenceSourceFileOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getExternalModuleReferenceSourceFile(),message??"Expected to find an external module reference's referenced source file.",this)}getExternalModuleReferenceSourceFile(){let moduleReference=this.getModuleReference();if(Node.isExternalModuleReference(moduleReference))return moduleReference.getReferencedSourceFile()}},ImportSpecifierBase=Node,ImportSpecifier=class extends ImportSpecifierBase{setName(name){let nameNode=this.getNameNode();return nameNode.getText()===name?this:(nameNode.replaceWithText(name),this)}getName(){return this.getNameNode().getText()}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.propertyName??this.compilerNode.name)}renameAlias(alias){if(common.StringUtils.isNullOrWhitespace(alias))return this.removeAliasWithRename(),this;let aliasIdentifier=this.getAliasNode();return aliasIdentifier==null&&(this.setAlias(this.getName()),aliasIdentifier=this.getAliasNode()),aliasIdentifier.rename(alias),this}setAlias(alias){if(common.StringUtils.isNullOrWhitespace(alias))return this.removeAlias(),this;let aliasIdentifier=this.getAliasNode();return aliasIdentifier==null?insertIntoParentTextRange({insertPos:this.getNameNode().getEnd(),parent:this,newText:` as ${alias}`}):aliasIdentifier.replaceWithText(alias),this}removeAlias(){let aliasIdentifier=this.getAliasNode();return aliasIdentifier==null?this:(removeChildren({children:[this.getFirstChildByKindOrThrow(common.SyntaxKind.AsKeyword),aliasIdentifier],removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this)}removeAliasWithRename(){let aliasIdentifier=this.getAliasNode();return aliasIdentifier==null?this:(aliasIdentifier.rename(this.getName()),this.removeAlias(),this)}getAliasNode(){if(this.compilerNode.propertyName!=null)return this._getNodeFromCompilerNode(this.compilerNode.name)}isTypeOnly(){return this.compilerNode.isTypeOnly}setIsTypeOnly(value){return this.isTypeOnly()===value?this:(value?insertIntoParentTextRange({insertPos:this.getStart(),parent:this,newText:"type "}):removeChildren({children:[this.getFirstChildByKindOrThrow(common.ts.SyntaxKind.TypeKeyword)],removeFollowingSpaces:!0}),this)}getImportDeclaration(){return this.getFirstAncestorByKindOrThrow(common.SyntaxKind.ImportDeclaration)}remove(){let importDeclaration=this.getImportDeclaration();importDeclaration.getNamedImports().length>1?removeCommaSeparatedChild(this):importDeclaration.removeNamedImports()}set(structure){return callBaseSet(ImportSpecifierBase.prototype,this,structure),structure.isTypeOnly!=null&&this.setIsTypeOnly(structure.isTypeOnly),structure.name!=null&&this.setName(structure.name),structure.alias!=null?this.setAlias(structure.alias):structure.hasOwnProperty(common.nameof(structure,"alias"))&&this.removeAlias(),this}getStructure(){let alias=this.getAliasNode();return callBaseGetStructure(ImportSpecifierBase.prototype,this,{kind:exports.StructureKind.ImportSpecifier,name:this.getName(),alias:alias?alias.getText():void 0,isTypeOnly:this.isTypeOnly()})}},ModuleBlockBase=StatementedNode(Statement),ModuleBlock=class extends ModuleBlockBase{};function ModuleChildableNode(Base){return class extends Base{getParentModuleOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getParentModule(),message??"Expected to find the parent module declaration.",this)}getParentModule(){let parent=this.getParentOrThrow();if(Node.isModuleBlock(parent)){for(;parent.getParentOrThrow().getKind()===common.SyntaxKind.ModuleDeclaration;)parent=parent.getParentOrThrow();return parent}}}}exports.ModuleDeclarationKind=void 0;(function(ModuleDeclarationKind){ModuleDeclarationKind.Namespace="namespace",ModuleDeclarationKind.Module="module",ModuleDeclarationKind.Global="global"})(exports.ModuleDeclarationKind||(exports.ModuleDeclarationKind={}));var createBase$r=ctor=>ModuledNode(UnwrappableNode(TextInsertableNode(BodyableNode(ModuleChildableNode(StatementedNode(JSDocableNode(AmbientableNode(ExportableNode(ModifierableNode(ModuleNamedNode(ctor))))))))))),ModuleDeclarationBase=createBase$r(Statement),ModuleDeclaration=class extends ModuleDeclarationBase{getName(){let nameNodesOrStringLit=this.getNameNodes();return nameNodesOrStringLit instanceof Array?nameNodesOrStringLit.map(n=>n.getText()).join("."):nameNodesOrStringLit.getText()}setName(newName){let openIssueText="Please open an issue if you really need this and I'll up the priority.";if(newName.indexOf(".")>=0)throw new common.errors.NotImplementedError(`Not implemented to set a namespace name to a name containing a period. ${openIssueText}`);let moduleName=this.getNameNodes();if(moduleName instanceof Array){if(moduleName.length>1)throw new common.errors.NotImplementedError(`Not implemented to set a namespace name that uses dot notation. ${openIssueText}`);newName!=="global"&&addNamespaceKeywordIfNecessary(this),common.StringUtils.isQuoted(newName)&&changeToAmbientModuleIfNecessary(this),moduleName[0].replaceWithText(newName)}else moduleName.replaceWithText(newName);return this}rename(newName,options){if(newName.indexOf(".")>=0)throw new common.errors.NotSupportedError("Cannot rename a namespace name to a name containing a period.");let nameNodes=this.getNameNodes();if(nameNodes instanceof Array){if(nameNodes.length>1)throw new common.errors.NotSupportedError(`Cannot rename a namespace name that uses dot notation. Rename the individual nodes via .${common.nameof(this,"getNameNodes")}()`);newName!=="global"&&addNamespaceKeywordIfNecessary(this),nameNodes[0].rename(newName,options)}else renameNode(nameNodes,common.StringUtils.stripQuotes(newName),options);return this}getNameNodes(){let name=this.getNameNode();if(Node.isStringLiteral(name))return name;{let nodes=[],current=this;do nodes.push(this._getNodeFromCompilerNode(current.compilerNode.name)),current=current.getFirstChildByKind(common.SyntaxKind.ModuleDeclaration);while(current!=null);return nodes}}hasNamespaceKeyword(){return this.getDeclarationKind()===exports.ModuleDeclarationKind.Namespace}hasModuleKeyword(){return this.getDeclarationKind()===exports.ModuleDeclarationKind.Module}setDeclarationKind(kind){if(this.getDeclarationKind()===kind)return this;if(kind===exports.ModuleDeclarationKind.Global){let declarationKindKeyword=this.getDeclarationKindKeyword();this.getNameNode().replaceWithText("global"),declarationKindKeyword!=null&&removeChildren({children:[declarationKindKeyword],removeFollowingNewLines:!0,removeFollowingSpaces:!0})}else{let declarationKindKeyword=this.getDeclarationKindKeyword();declarationKindKeyword!=null?declarationKindKeyword.replaceWithText(kind):insertIntoParentTextRange({parent:this,insertPos:this.getNameNode().getStart(),newText:kind+" "})}return this}getDeclarationKind(){let nodeFlags=this.getFlags();return nodeFlags&common.ts.NodeFlags.GlobalAugmentation?exports.ModuleDeclarationKind.Global:nodeFlags&common.ts.NodeFlags.Namespace?exports.ModuleDeclarationKind.Namespace:exports.ModuleDeclarationKind.Module}getDeclarationKindKeyword(){return this.getFirstChild(child=>child.getKind()===common.SyntaxKind.NamespaceKeyword||child.getKind()===common.SyntaxKind.ModuleKeyword)}set(structure){return structure.name!=null&&structure.name!=="global"&&addNamespaceKeywordIfNecessary(this),callBaseSet(ModuleDeclarationBase.prototype,this,structure),structure.declarationKind!=null&&this.setDeclarationKind(structure.declarationKind),this}getStructure(){return callBaseGetStructure(ModuleDeclarationBase.prototype,this,{kind:exports.StructureKind.Module,declarationKind:this.getDeclarationKind()})}_getInnerBody(){let node=this.getBody();for(;node!=null&&Node.isBodyable(node)&&node.compilerNode.statements==null;)node=node.getBody();return node}};function addNamespaceKeywordIfNecessary(namespaceDec){namespaceDec.getDeclarationKind()===exports.ModuleDeclarationKind.Global&&namespaceDec.setDeclarationKind(exports.ModuleDeclarationKind.Namespace)}function changeToAmbientModuleIfNecessary(namespaceDec){namespaceDec.hasNamespaceKeyword()&&namespaceDec.setDeclarationKind(exports.ModuleDeclarationKind.Module),namespaceDec.hasDeclareKeyword()||namespaceDec.setHasDeclareKeyword(!0)}var NamedExportsBase=Node,NamedExports=class extends NamedExportsBase{getElements(){return this.compilerNode.elements.map(e=>this._getNodeFromCompilerNode(e))}},NamedImportsBase=Node,NamedImports=class extends NamedImportsBase{getElements(){return this.compilerNode.elements.map(e=>this._getNodeFromCompilerNode(e))}},NamespaceExportBase=RenameableNode(Node),NamespaceExport=class extends NamespaceExportBase{setName(name){let nameNode=this.getNameNode();return nameNode.getText()===name?this:(nameNode.replaceWithText(name),this)}getName(){return this.getNameNode().getText()}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}},NamespaceImportBase=RenameableNode(Node),NamespaceImport=class extends NamespaceImportBase{setName(name){let nameNode=this.getNameNode();return nameNode.getText()===name?this:(nameNode.replaceWithText(name),this)}getName(){return this.getNameNode().getText()}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}},FileReference=class extends TextRange{constructor(compilerObject,sourceFile){super(compilerObject,sourceFile)}getFileName(){return this.compilerObject.fileName}};exports.FileSystemRefreshResult=void 0;(function(FileSystemRefreshResult){FileSystemRefreshResult[FileSystemRefreshResult.NoChange=0]="NoChange",FileSystemRefreshResult[FileSystemRefreshResult.Updated=1]="Updated",FileSystemRefreshResult[FileSystemRefreshResult.Deleted=2]="Deleted"})(exports.FileSystemRefreshResult||(exports.FileSystemRefreshResult={}));function __decorate(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r}var SourceFileBase=ModuledNode(TextInsertableNode(StatementedNode(Node))),SourceFile=class extends SourceFileBase{#isSaved=!1;#modifiedEventContainer=new common.EventContainer;#preModifiedEventContainer=new common.EventContainer;_referenceContainer=new SourceFileReferenceContainer(this);#referencedFiles;#libReferenceDirectives;#typeReferenceDirectives;_hasBom;constructor(context,node){super(context,node,void 0),this.__sourceFile=this;let onPreModified=()=>{this.isFromExternalLibrary(),this.#preModifiedEventContainer.unsubscribe(onPreModified)};this.#preModifiedEventContainer.subscribe(onPreModified)}_replaceCompilerNodeFromFactory(compilerNode){super._replaceCompilerNodeFromFactory(compilerNode),this._context.resetProgram(),this.#isSaved=!1,this.#modifiedEventContainer.fire(this)}_clearInternals(){super._clearInternals(),clearTextRanges(this.#referencedFiles),clearTextRanges(this.#typeReferenceDirectives),clearTextRanges(this.#libReferenceDirectives),this.#referencedFiles=void 0,this.#typeReferenceDirectives=void 0,this.#libReferenceDirectives=void 0;function clearTextRanges(textRanges){textRanges?.forEach(r=>r._forget())}}getFilePath(){return this.compilerNode.fileName}getBaseName(){return common.FileUtils.getBaseName(this.getFilePath())}getBaseNameWithoutExtension(){let baseName=this.getBaseName(),extension=this.getExtension();return baseName.substring(0,baseName.length-extension.length)}getExtension(){return common.FileUtils.getExtension(this.getFilePath())}getDirectory(){return this._context.compilerFactory.getDirectoryFromCache(this.getDirectoryPath())}getDirectoryPath(){return this._context.fileSystemWrapper.getStandardizedAbsolutePath(common.FileUtils.getDirPath(this.compilerNode.fileName))}getFullText(){return this.compilerNode.text}getLineAndColumnAtPos(pos){let fullText=this.getFullText();return{line:common.StringUtils.getLineNumberAtPos(fullText,pos),column:common.StringUtils.getLengthFromLineStartAtPos(fullText,pos)+1}}getLengthFromLineStartAtPos(pos){return common.StringUtils.getLengthFromLineStartAtPos(this.getFullText(),pos)}copyToDirectory(dirPathOrDirectory,options){let dirPath=typeof dirPathOrDirectory=="string"?dirPathOrDirectory:dirPathOrDirectory.getPath();return this.copy(common.FileUtils.pathJoin(dirPath,this.getBaseName()),options)}copy(filePath,options={}){this._throwIfIsInMemoryLibFile();let result=this._copyInternal(filePath,options);if(result===!1)return this;let copiedSourceFile=result;return copiedSourceFile.getDirectoryPath()!==this.getDirectoryPath()&&copiedSourceFile._updateReferencesForCopyInternal(this._getReferencesForCopyInternal()),copiedSourceFile}_copyInternal(fileAbsoluteOrRelativePath,options={}){let{overwrite=!1}=options,{compilerFactory,fileSystemWrapper}=this._context,standardizedFilePath=fileSystemWrapper.getStandardizedAbsolutePath(fileAbsoluteOrRelativePath,this.getDirectoryPath());if(standardizedFilePath===this.getFilePath())return!1;return getCopiedSourceFile(this);function getCopiedSourceFile(currentFile){try{return compilerFactory.createSourceFileFromText(standardizedFilePath,currentFile.getFullText(),{overwrite,markInProject:getShouldBeInProject()})}catch(err){throw err instanceof common.errors.InvalidOperationError?new common.errors.InvalidOperationError("Did you mean to provide the overwrite option? "+err.message):err}function getShouldBeInProject(){if(currentFile._isInProject())return!0;let destinationFile=compilerFactory.getSourceFileFromCacheFromFilePath(standardizedFilePath);return destinationFile!=null&&destinationFile._isInProject()}}}_getReferencesForCopyInternal(){return Array.from(this._referenceContainer.getLiteralsReferencingOtherSourceFilesEntries())}_updateReferencesForCopyInternal(literalReferences){for(let reference of literalReferences)reference[0]=this.getChildSyntaxListOrThrow().getDescendantAtStartWithWidth(reference[0].getStart(),reference[0].getWidth());updateStringLiteralReferences(literalReferences)}async copyImmediately(filePath,options){let newSourceFile=this.copy(filePath,options);return await newSourceFile.save(),newSourceFile}copyImmediatelySync(filePath,options){let newSourceFile=this.copy(filePath,options);return newSourceFile.saveSync(),newSourceFile}moveToDirectory(dirPathOrDirectory,options){let dirPath=typeof dirPathOrDirectory=="string"?dirPathOrDirectory:dirPathOrDirectory.getPath();return this.move(common.FileUtils.pathJoin(dirPath,this.getBaseName()),options)}move(filePath,options={}){this._throwIfIsInMemoryLibFile();let oldDirPath=this.getDirectoryPath(),sourceFileReferences=this._getReferencesForMoveInternal(),oldFilePath=this.getFilePath();return this._moveInternal(filePath,options)?(this._context.fileSystemWrapper.queueFileDelete(oldFilePath),this._updateReferencesForMoveInternal(sourceFileReferences,oldDirPath),this._context.lazyReferenceCoordinator.clearDirtySourceFiles(),this._context.lazyReferenceCoordinator.addDirtySourceFile(this),this):this}_moveInternal(fileRelativeOrAbsolutePath,options={}){let{overwrite=!1}=options,filePath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(fileRelativeOrAbsolutePath,this.getDirectoryPath());if(filePath===this.getFilePath())return!1;let markAsInProject=!1;if(overwrite){let existingSourceFile=this._context.compilerFactory.getSourceFileFromCacheFromFilePath(filePath);existingSourceFile!=null&&(markAsInProject=existingSourceFile._isInProject(),existingSourceFile.forget())}else this._context.compilerFactory.throwIfFileExists(filePath,"Did you mean to provide the overwrite option?");return replaceSourceFileForFilePathMove({newFilePath:filePath,sourceFile:this}),markAsInProject&&this._markAsInProject(),this._isInProject()&&this.getDirectory()._markAsInProject(),!0}_getReferencesForMoveInternal(){return{literalReferences:Array.from(this._referenceContainer.getLiteralsReferencingOtherSourceFilesEntries()),referencingLiterals:Array.from(this._referenceContainer.getReferencingLiteralsInOtherSourceFiles())}}_updateReferencesForMoveInternal(sourceFileReferences,oldDirPath){let{literalReferences,referencingLiterals}=sourceFileReferences;oldDirPath!==this.getDirectoryPath()&&updateStringLiteralReferences(literalReferences),updateStringLiteralReferences(referencingLiterals.map(node=>[node,this]))}async moveImmediately(filePath,options){let oldFilePath=this.getFilePath(),newFilePath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(filePath,this.getDirectoryPath());return this.move(filePath,options),oldFilePath!==newFilePath?(await this._context.fileSystemWrapper.moveFileImmediately(oldFilePath,newFilePath,this.getFullText()),this.#isSaved=!0):await this.save(),this}moveImmediatelySync(filePath,options){let oldFilePath=this.getFilePath(),newFilePath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(filePath,this.getDirectoryPath());return this.move(filePath,options),oldFilePath!==newFilePath?(this._context.fileSystemWrapper.moveFileImmediatelySync(oldFilePath,newFilePath,this.getFullText()),this.#isSaved=!0):this.saveSync(),this}delete(){this._throwIfIsInMemoryLibFile();let filePath=this.getFilePath();this.forget(),this._context.fileSystemWrapper.queueFileDelete(filePath)}async deleteImmediately(){this._throwIfIsInMemoryLibFile();let filePath=this.getFilePath();this.forget(),await this._context.fileSystemWrapper.deleteFileImmediately(filePath)}deleteImmediatelySync(){this._throwIfIsInMemoryLibFile();let filePath=this.getFilePath();this.forget(),this._context.fileSystemWrapper.deleteFileImmediatelySync(filePath)}async save(){this._isLibFileInMemory()||(await this._context.fileSystemWrapper.writeFile(this.getFilePath(),this.#getTextForSave()),this.#isSaved=!0)}saveSync(){this._isLibFileInMemory()||(this._context.fileSystemWrapper.writeFileSync(this.getFilePath(),this.#getTextForSave()),this.#isSaved=!0)}#getTextForSave(){let text=this.getFullText();return this._hasBom?"\uFEFF"+text:text}getPathReferenceDirectives(){return this.#referencedFiles==null&&(this.#referencedFiles=(this.compilerNode.referencedFiles||[]).map(f=>new FileReference(f,this))),this.#referencedFiles}getTypeReferenceDirectives(){return this.#typeReferenceDirectives==null&&(this.#typeReferenceDirectives=(this.compilerNode.typeReferenceDirectives||[]).map(f=>new FileReference(f,this))),this.#typeReferenceDirectives}getLibReferenceDirectives(){return this.#libReferenceDirectives==null&&(this.#libReferenceDirectives=(this.compilerNode.libReferenceDirectives||[]).map(f=>new FileReference(f,this))),this.#libReferenceDirectives}getReferencingSourceFiles(){return Array.from(this._referenceContainer.getDependentSourceFiles())}getReferencingNodesInOtherSourceFiles(){let literals=this.getReferencingLiteralsInOtherSourceFiles();return Array.from(getNodes2());function*getNodes2(){for(let literal of literals)yield getReferencingNodeFromStringLiteral(literal)}}getReferencingLiteralsInOtherSourceFiles(){return Array.from(this._referenceContainer.getReferencingLiteralsInOtherSourceFiles())}getReferencedSourceFiles(){let entries=this._referenceContainer.getLiteralsReferencingOtherSourceFilesEntries();return Array.from(new Set(getSourceFilesFromEntries()).values());function*getSourceFilesFromEntries(){for(let[,sourceFile]of entries)yield sourceFile}}getNodesReferencingOtherSourceFiles(){let entries=this._referenceContainer.getLiteralsReferencingOtherSourceFilesEntries();return Array.from(getNodes2());function*getNodes2(){for(let[literal]of entries)yield getReferencingNodeFromStringLiteral(literal)}}getLiteralsReferencingOtherSourceFiles(){let entries=this._referenceContainer.getLiteralsReferencingOtherSourceFilesEntries();return Array.from(getLiteralsFromEntries());function*getLiteralsFromEntries(){for(let[literal]of entries)yield literal}}getImportStringLiterals(){return this._ensureBound(),(this.compilerNode.imports||[]).filter(l=>l.pos!==-1).map(l=>this._getNodeFromCompilerNode(l))}getLanguageVersion(){return this.compilerNode.languageVersion}getLanguageVariant(){return this.compilerNode.languageVariant}getScriptKind(){return this.compilerNode.scriptKind}isDeclarationFile(){return this.compilerNode.isDeclarationFile}isFromExternalLibrary(){return this._context.program._isCompilerProgramCreated()?this._context.program.compilerObject.isSourceFileFromExternalLibrary(this.compilerNode):!1}isInNodeModules(){return this.getFilePath().indexOf("/node_modules/")>=0}isSaved(){return this.#isSaved&&!this._isLibFileInMemory()}_setIsSaved(value){this.#isSaved=value}getPreEmitDiagnostics(){return this._context.getPreEmitDiagnostics(this)}unindent(positionRangeOrPos,times=1){return this.indent(positionRangeOrPos,times*-1)}indent(positionRangeOrPos,times=1){if(times===0)return this;let sourceFileText=this.getFullText(),positionRange=typeof positionRangeOrPos=="number"?[positionRangeOrPos,positionRangeOrPos]:positionRangeOrPos;common.errors.throwIfRangeOutOfRange(positionRange,[0,sourceFileText.length],"positionRange");let startLinePos=getPreviousMatchingPos(sourceFileText,positionRange[0],char=>char===CharCodes.NEWLINE),endLinePos=getNextMatchingPos(sourceFileText,positionRange[1],char=>char===CharCodes.CARRIAGE_RETURN||char===CharCodes.NEWLINE),correctedText=common.StringUtils.indent(sourceFileText.substring(startLinePos,endLinePos),times,{indentText:this._context.manipulationSettings.getIndentationText(),indentSizeInSpaces:this._context.manipulationSettings._getIndentSizeInSpaces(),isInStringAtPos:pos=>this.isInStringAtPos(pos+startLinePos)});return replaceSourceFileTextForFormatting({sourceFile:this,newText:sourceFileText.substring(0,startLinePos)+correctedText+sourceFileText.substring(endLinePos)}),this}emit(options){return this._context.program.emit({targetSourceFile:this,...options})}emitSync(options){return this._context.program.emitSync({targetSourceFile:this,...options})}getEmitOutput(options={}){return this._context.languageService.getEmitOutput(this,options.emitOnlyDtsFiles||!1)}formatText(settings={}){replaceSourceFileTextForFormatting({sourceFile:this,newText:this._context.languageService.getFormattedDocumentText(this.getFilePath(),settings)})}async refreshFromFileSystem(){let fileReadResult=await this._context.fileSystemWrapper.readFileOrNotExists(this.getFilePath(),this._context.getEncoding());return this.#refreshFromFileSystemInternal(fileReadResult)}refreshFromFileSystemSync(){let fileReadResult=this._context.fileSystemWrapper.readFileOrNotExistsSync(this.getFilePath(),this._context.getEncoding());return this.#refreshFromFileSystemInternal(fileReadResult)}getRelativePathTo(sourceFileDirOrPath){return this.getDirectory().getRelativePathTo(sourceFileDirOrPath)}getRelativePathAsModuleSpecifierTo(sourceFileDirOrFilePath){return this.getDirectory().getRelativePathAsModuleSpecifierTo(sourceFileDirOrFilePath)}onModified(subscription,subscribe=!0){return subscribe?this.#modifiedEventContainer.subscribe(subscription):this.#modifiedEventContainer.unsubscribe(subscription),this}_doActionPreNextModification(action){let wrappedSubscription=()=>{action(),this.#preModifiedEventContainer.unsubscribe(wrappedSubscription)};return this.#preModifiedEventContainer.subscribe(wrappedSubscription),this}_firePreModified(){this.#preModifiedEventContainer.fire(this)}organizeImports(formatSettings={},userPreferences={}){return this._context.languageService.organizeImports(this,formatSettings,userPreferences).forEach(fileTextChanges=>fileTextChanges.applyChanges()),this}fixUnusedIdentifiers(formatSettings={},userPreferences={}){return this._context.languageService.getCombinedCodeFix(this,"unusedIdentifier_delete",formatSettings,userPreferences).applyChanges(),this._context.languageService.getCombinedCodeFix(this,"unusedIdentifier_deleteImports",formatSettings,userPreferences).applyChanges(),this}fixMissingImports(formatSettings={},userPreferences={}){let combinedCodeFix=this._context.languageService.getCombinedCodeFix(this,"fixMissingImport",formatSettings,userPreferences),sourceFile=this;for(let fileTextChanges of combinedCodeFix.getChanges()){let changes=fileTextChanges.getTextChanges();removeUnnecessaryDoubleBlankLines(changes),applyTextChanges(changes)}return this;function removeUnnecessaryDoubleBlankLines(changes){changes.sort((a,b)=>a.getSpan().getStart()-b.getSpan().getStart());for(let i=0;ichange.getSpan().getStart()),addedLength=0;for(let group of groups){let insertPos=group[0].getSpan().getStart()+addedLength,newText=group.map(item=>item.getNewText()).join("");insertIntoTextRange({sourceFile,insertPos,newText}),addedLength+=newText.length}}}applyTextChanges(textChanges2){return textChanges2.length===0?this:(this.forgetDescendants(),replaceNodeText({sourceFile:this._sourceFile,start:0,replacingLength:this.getFullWidth(),newText:getTextFromTextChanges(this,textChanges2)}),this)}set(structure){return callBaseSet(SourceFileBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(SourceFileBase.prototype,this,{kind:exports.StructureKind.SourceFile})}#refreshFromFileSystemInternal(fileReadResult){if(fileReadResult===!1)return this.forget(),exports.FileSystemRefreshResult.Deleted;let fileText=fileReadResult;return fileText===this.getFullText()?exports.FileSystemRefreshResult.NoChange:(this.replaceText([0,this.getEnd()],fileText),this._setIsSaved(!0),exports.FileSystemRefreshResult.Updated)}_isLibFileInMemory(){return this.compilerNode.fileName.startsWith(common.libFolderInMemoryPath)}_throwIfIsInMemoryLibFile(){if(this._isLibFileInMemory())throw new common.errors.InvalidOperationError("This operation is not permitted on an in memory lib folder file.")}_isInProject(){return this._context.inProjectCoordinator.isSourceFileInProject(this)}_markAsInProject(){this._context.inProjectCoordinator.markSourceFileAsInProject(this)}};__decorate([common.Memoize],SourceFile.prototype,"isFromExternalLibrary",null);function updateStringLiteralReferences(nodeReferences){for(let[stringLiteral,sourceFile]of nodeReferences)ModuleUtils.isModuleSpecifierRelative(stringLiteral.getLiteralText())&&stringLiteral.setLiteralValue(stringLiteral._sourceFile.getRelativePathAsModuleSpecifierTo(sourceFile))}function getReferencingNodeFromStringLiteral(literal){let parent=literal.getParentOrThrow(),grandParent=parent.getParent();return grandParent!=null&&Node.isImportEqualsDeclaration(grandParent)?grandParent:parent}var createBase$q=ctor=>ModuleChildableNode(JSDocableNode(AmbientableNode(ExportableNode(ModifierableNode(ctor))))),VariableStatementBase=createBase$q(Statement),VariableStatement=class extends VariableStatementBase{getDeclarationList(){return this._getNodeFromCompilerNode(this.compilerNode.declarationList)}getDeclarations(){return this.getDeclarationList().getDeclarations()}getDeclarationKind(){return this.getDeclarationList().getDeclarationKind()}getDeclarationKindKeywords(){return this.getDeclarationList().getDeclarationKindKeywords()}setDeclarationKind(type){return this.getDeclarationList().setDeclarationKind(type)}addDeclaration(structure){return this.getDeclarationList().addDeclaration(structure)}addDeclarations(structures){return this.getDeclarationList().addDeclarations(structures)}insertDeclaration(index,structure){return this.getDeclarationList().insertDeclaration(index,structure)}insertDeclarations(index,structures){return this.getDeclarationList().insertDeclarations(index,structures)}set(structure){if(callBaseSet(VariableStatementBase.prototype,this,structure),structure.declarationKind!=null&&this.setDeclarationKind(structure.declarationKind),structure.declarations!=null){let existingDeclarations=this.getDeclarations();this.addDeclarations(structure.declarations),existingDeclarations.forEach(d=>d.remove())}return this}getStructure(){return callBaseGetStructure(VariableStatementBase.prototype,this,{kind:exports.StructureKind.VariableStatement,declarationKind:this.getDeclarationKind(),declarations:this.getDeclarations().map(declaration=>declaration.getStructure())})}},WhileStatementBase=ExpressionedNode(IterationStatement),WhileStatement=class extends WhileStatementBase{},WithStatementBase=ExpressionedNode(Statement),WithStatement=class extends WithStatementBase{getStatement(){return this._getNodeFromCompilerNode(this.compilerNode.statement)}};function FunctionLikeDeclaration(Base){return JSDocableNode(TypeParameteredNode(SignaturedDeclaration(StatementedNode(ModifierableNode(Base)))))}var createBase$p=ctor=>TextInsertableNode(BodiedNode(AsyncableNode(FunctionLikeDeclaration(ctor)))),ArrowFunctionBase=createBase$p(Expression),ArrowFunction=class extends ArrowFunctionBase{getEqualsGreaterThan(){return this._getNodeFromCompilerNode(this.compilerNode.equalsGreaterThanToken)}};function OverloadableNode(Base){return class extends Base{getOverloads(){return getOverloadsAndImplementation(this).filter(n=>n.isOverload())}getImplementation(){return this.isImplementation()?this:getOverloadsAndImplementation(this).find(n=>n.isImplementation())}getImplementationOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getImplementation(),message??"Expected to find a corresponding implementation for the overload.",this)}isOverload(){return!this.isImplementation()}isImplementation(){return this.getBody()!=null}}}function getOverloadsAndImplementation(node){let parent=node.getParentOrThrow(),name=getNameIfNamedNode(node),isStatic=getStaticIfStaticable(node),kind=node.getKind();return parent.forEachChildAsArray().filter(n=>getNameIfNamedNode(n)===name&&n.getKind()===kind&&getStaticIfStaticable(n)===isStatic)}function getNameIfNamedNode(node){let nodeAsNamedNode=node;if(nodeAsNamedNode.getName instanceof Function)return nodeAsNamedNode.getName()}function getStaticIfStaticable(node){let nodeAsStaticableNode=node;return nodeAsStaticableNode.isStatic instanceof Function?nodeAsStaticableNode.isStatic():!1}function insertOverloads(opts){if(opts.structures.length===0)return[];let parentSyntaxList=opts.node.getParentSyntaxListOrThrow(),implementationNode=opts.node.getImplementation()||opts.node,overloads=opts.node.getOverloads(),overloadsCount=overloads.length,firstIndex=overloads.length>0?overloads[0].getChildIndex():implementationNode.getChildIndex(),index=verifyAndGetIndex(opts.index,overloadsCount),mainIndex=firstIndex+index,thisStructure=opts.getThisStructure(implementationNode),structures=opts.structures.map(structure=>Object.assign(Object.assign({},thisStructure),structure)),writer=implementationNode._getWriterWithQueuedIndentation();for(let structure of structures)writer.getLength()>0&&writer.newLine(),opts.printStructure(writer,structure);return writer.newLine(),writer.write(""),insertIntoParentTextRange({parent:parentSyntaxList,insertPos:(overloads[index]||implementationNode).getNonWhitespaceStart(),newText:writer.toString()}),getRangeWithoutCommentsFromArray(parentSyntaxList.getChildren(),mainIndex,structures.length,opts.expectedSyntaxKind)}var createBase$o=ctor=>UnwrappableNode(TextInsertableNode(OverloadableNode(BodyableNode(AsyncableNode(GeneratorableNode(AmbientableNode(ExportableNode(FunctionLikeDeclaration(ModuleChildableNode(NameableNode(ctor))))))))))),FunctionDeclarationBase=createBase$o(Statement),createOverloadBase$2=ctor=>UnwrappableNode(TextInsertableNode(AsyncableNode(GeneratorableNode(SignaturedDeclaration(AmbientableNode(ModuleChildableNode(JSDocableNode(TypeParameteredNode(ExportableNode(ModifierableNode(ctor))))))))))),FunctionDeclarationOverloadBase=createOverloadBase$2(Statement),FunctionDeclaration=class extends FunctionDeclarationBase{addOverload(structure){return this.addOverloads([structure])[0]}addOverloads(structures){return this.insertOverloads(this.getOverloads().length,structures)}insertOverload(index,structure){return this.insertOverloads(index,[structure])[0]}insertOverloads(index,structures){let thisName=this.getName(),printer=this._context.structurePrinterFactory.forFunctionDeclaration({isAmbient:this.isAmbient()});return insertOverloads({node:this,index,structures,printStructure:(writer,structure)=>{printer.printOverload(writer,thisName,structure)},getThisStructure:fromFunctionDeclarationOverload,expectedSyntaxKind:common.SyntaxKind.FunctionDeclaration})}remove(){removeOverloadableStatementedNodeChild(this)}set(structure){return callBaseSet(FunctionDeclarationBase.prototype,this,structure),structure.overloads!=null&&(this.getOverloads().forEach(o=>o.remove()),this.addOverloads(structure.overloads)),this}getStructure(){let isOverload=this.isOverload(),hasImplementation=this.getImplementation(),basePrototype=isOverload&&hasImplementation?FunctionDeclarationOverloadBase.prototype:FunctionDeclarationBase.prototype;return callBaseGetStructure(basePrototype,this,getStructure(this));function getStructure(thisNode){if(hasImplementation&&isOverload)return getOverloadSpecificStructure();return getSpecificStructure();function getOverloadSpecificStructure(){return{kind:exports.StructureKind.FunctionOverload}}function getSpecificStructure(){return hasImplementation?{kind:exports.StructureKind.Function,overloads:thisNode.getOverloads().map(o=>o.getStructure())}:{kind:exports.StructureKind.Function}}}}},createBase$n=ctor=>JSDocableNode(TextInsertableNode(BodiedNode(AsyncableNode(GeneratorableNode(StatementedNode(TypeParameteredNode(SignaturedDeclaration(ModifierableNode(NameableNode(ctor)))))))))),FunctionExpressionBase=createBase$n(PrimaryExpression),FunctionExpression=class extends FunctionExpressionBase{},createBase$m=ctor=>OverrideableNode(QuestionTokenableNode(DecoratableNode(ScopeableNode(ReadonlyableNode(ModifierableNode(DotDotDotTokenableNode(TypedNode(InitializerExpressionableNode(BindingNamedNode(ctor)))))))))),ParameterDeclarationBase=createBase$m(Node),ParameterDeclaration=class extends ParameterDeclarationBase{isRestParameter(){return this.compilerNode.dotDotDotToken!=null}isParameterProperty(){return this.getScope()!=null||this.isReadonly()||this.hasOverrideKeyword()}setIsRestParameter(value){return this.isRestParameter()===value?this:(value?(addParensIfNecessary(this),insertIntoParentTextRange({insertPos:this.getNameNode().getStart(),parent:this,newText:"..."})):removeChildren({children:[this.getDotDotDotTokenOrThrow()]}),this)}isOptional(){return this.compilerNode.questionToken!=null||this.isRestParameter()||this.hasInitializer()}remove(){removeCommaSeparatedChild(this)}set(structure){return callBaseSet(ParameterDeclarationBase.prototype,this,structure),structure.isRestParameter!=null&&this.setIsRestParameter(structure.isRestParameter),this}getStructure(){return callBaseGetStructure(ParameterDeclarationBase.prototype,this,{kind:exports.StructureKind.Parameter,isRestParameter:this.isRestParameter()})}setHasQuestionToken(value){return value&&addParensIfNecessary(this),super.setHasQuestionToken(value),this}setInitializer(textOrWriterFunction){return addParensIfNecessary(this),super.setInitializer(textOrWriterFunction),this}setType(textOrWriterFunction){return addParensIfNecessary(this),super.setType.call(this,textOrWriterFunction),this}};function addParensIfNecessary(parameter){let parent=parameter.getParentOrThrow();isParameterWithoutParens()&&addParens();function isParameterWithoutParens(){return Node.isArrowFunction(parent)&&parent.compilerNode.parameters.length===1&¶meter.getParentSyntaxListOrThrow().getPreviousSiblingIfKind(common.SyntaxKind.OpenParenToken)==null}function addParens(){let paramText=parameter.getText();insertIntoParentTextRange({parent,insertPos:parameter.getStart(),newText:`(${paramText})`,replacing:{textLength:paramText.length},customMappings:newParent=>[{currentNode:parameter,newNode:newParent.parameters[0]}]})}}var ClassElement=class extends Node{remove(){let parent=this.getParentOrThrow();Node.isClassDeclaration(parent)||Node.isClassExpression(parent)?removeClassMember(this):Node.isObjectLiteralExpression(parent)?removeCommaSeparatedChild(this):Node.isInterfaceDeclaration(parent)?removeInterfaceMember(this):common.errors.throwNotImplementedForSyntaxKindError(parent.getKind())}},createBase$l=ctor=>ChildOrderableNode(TextInsertableNode(OverrideableNode(OverloadableNode(BodyableNode(DecoratableNode(AbstractableNode(ScopedNode(QuestionTokenableNode(StaticableNode(AsyncableNode(GeneratorableNode(FunctionLikeDeclaration(PropertyNamedNode(ctor)))))))))))))),MethodDeclarationBase=createBase$l(ClassElement),createOverloadBase$1=ctor=>JSDocableNode(ChildOrderableNode(TextInsertableNode(OverrideableNode(ScopedNode(TypeParameteredNode(AbstractableNode(QuestionTokenableNode(StaticableNode(AsyncableNode(ModifierableNode(GeneratorableNode(SignaturedDeclaration(ctor))))))))))))),MethodDeclarationOverloadBase=createOverloadBase$1(ClassElement),MethodDeclaration=class extends MethodDeclarationBase{set(structure){return callBaseSet(MethodDeclarationBase.prototype,this,structure),structure.overloads!=null&&(this.getOverloads().forEach(o=>o.remove()),this.addOverloads(structure.overloads)),this}addOverload(structure){return this.addOverloads([structure])[0]}addOverloads(structures){return this.insertOverloads(this.getOverloads().length,structures)}insertOverload(index,structure){return this.insertOverloads(index,[structure])[0]}insertOverloads(index,structures){let thisName=this.getName(),printer=this._context.structurePrinterFactory.forMethodDeclaration({isAmbient:isNodeAmbientOrInAmbientContext(this)});return insertOverloads({node:this,index,structures,printStructure:(writer,structure)=>{printer.printOverload(writer,thisName,structure)},getThisStructure:fromMethodDeclarationOverload,expectedSyntaxKind:common.SyntaxKind.MethodDeclaration})}getStructure(){let hasImplementation=this.getImplementation()!=null,isOverload=this.isOverload(),basePrototype=isOverload&&hasImplementation?MethodDeclarationOverloadBase.prototype:MethodDeclarationBase.prototype;return callBaseGetStructure(basePrototype,this,getStructure(this));function getStructure(thisNode){if(hasImplementation&&isOverload)return getOverloadSpecificStructure();return getSpecificStructure();function getOverloadSpecificStructure(){return{kind:exports.StructureKind.MethodOverload}}function getSpecificStructure(){return hasImplementation?{kind:exports.StructureKind.Method,overloads:thisNode.getOverloads().map(o=>o.getStructure())}:{kind:exports.StructureKind.Method}}}}};function ClassLikeDeclarationBase(Base){return ClassLikeDeclarationBaseSpecific(NameableNode(TextInsertableNode(ImplementsClauseableNode(HeritageClauseableNode(AbstractableNode(JSDocableNode(TypeParameteredNode(DecoratableNode(ModifierableNode(Base))))))))))}function ClassLikeDeclarationBaseSpecific(Base){return class extends Base{setExtends(text){if(text=this._getTextWithQueuedChildIndentation(text),common.StringUtils.isNullOrWhitespace(text))return this.removeExtends();let extendsClause=this.getHeritageClauseByKind(common.SyntaxKind.ExtendsKeyword);if(extendsClause!=null){let childSyntaxList=extendsClause.getFirstChildByKindOrThrow(common.SyntaxKind.SyntaxList),childSyntaxListStart=childSyntaxList.getStart();insertIntoParentTextRange({parent:extendsClause,newText:text,insertPos:childSyntaxListStart,replacing:{textLength:childSyntaxList.getEnd()-childSyntaxListStart}})}else{let implementsClause=this.getHeritageClauseByKind(common.SyntaxKind.ImplementsKeyword),insertPos;implementsClause!=null?insertPos=implementsClause.getStart():insertPos=this.getFirstChildByKindOrThrow(common.SyntaxKind.OpenBraceToken).getStart();let isLastSpace=/\s/.test(this.getSourceFile().getFullText()[insertPos-1]),newText=`extends ${text} `;isLastSpace||(newText=" "+newText),insertIntoParentTextRange({parent:implementsClause==null?this:implementsClause.getParentSyntaxListOrThrow(),insertPos,newText})}return this}removeExtends(){let extendsClause=this.getHeritageClauseByKind(common.SyntaxKind.ExtendsKeyword);return extendsClause==null?this:(extendsClause.removeExpression(0),this)}getExtendsOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getExtends(),message??`Expected to find the extends expression for the class ${this.getName()}.`,this)}getExtends(){let extendsClause=this.getHeritageClauseByKind(common.SyntaxKind.ExtendsKeyword);if(extendsClause==null)return;let types=extendsClause.getTypeNodes();return types.length===0?void 0:types[0]}addMembers(members){return this.insertMembers(getEndIndexFromArray(this.getMembersWithComments()),members)}addMember(member){return this.insertMember(getEndIndexFromArray(this.getMembersWithComments()),member)}insertMember(index,member){return this.insertMembers(index,[member])[0]}insertMembers(index,members){let isAmbient=isNodeAmbientOrInAmbientContext(this);return insertIntoBracesOrSourceFileWithGetChildrenWithComments({getIndexedChildren:()=>this.getMembersWithComments(),index,parent:this,write:(writer,info)=>{let previousMemberHasBody=!isAmbient&&info.previousMember!=null&&Node.isBodyable(info.previousMember)&&info.previousMember.hasBody(),firstStructureHasBody=!isAmbient&&members instanceof Array&&structureHasBody(members[0]);previousMemberHasBody||info.previousMember!=null&&firstStructureHasBody?writer.blankLineIfLastNot():writer.newLineIfLastNot();let memberWriter=this._getWriter();this._context.structurePrinterFactory.forClassMember({isAmbient}).printTexts(memberWriter,members),writer.write(memberWriter.toString());let lastStructureHasBody=!isAmbient&&members instanceof Array&&structureHasBody(members[members.length-1]),nextMemberHasBody=!isAmbient&&info.nextMember!=null&&Node.isBodyable(info.nextMember)&&info.nextMember.hasBody();info.nextMember!=null&&lastStructureHasBody||nextMemberHasBody?writer.blankLineIfLastNot():writer.newLineIfLastNot()}});function structureHasBody(value){if(isAmbient||value==null||typeof value.kind!="number")return!1;let structure=value;return Structure.isMethod(structure)||Structure.isGetAccessor(structure)||Structure.isSetAccessor(structure)||Structure.isConstructor(structure)}}addConstructor(structure={}){return this.insertConstructor(getEndIndexFromArray(this.getMembersWithComments()),structure)}addConstructors(structures){return this.insertConstructors(getEndIndexFromArray(this.getMembersWithComments()),structures)}insertConstructor(index,structure={}){return this.insertConstructors(index,[structure])[0]}insertConstructors(index,structures){let isAmbient=isNodeAmbientOrInAmbientContext(this);return insertChildren(this,{index,structures,expectedKind:common.SyntaxKind.Constructor,write:(writer,info)=>{!isAmbient&&info.previousMember!=null&&!Node.isCommentNode(info.previousMember)?writer.blankLineIfLastNot():writer.newLineIfLastNot(),this._context.structurePrinterFactory.forConstructorDeclaration({isAmbient}).printTexts(writer,structures),!isAmbient&&info.nextMember!=null?writer.blankLineIfLastNot():writer.newLineIfLastNot()}})}getConstructors(){return this.getMembers().filter(m=>Node.isConstructorDeclaration(m))}addStaticBlock(structure={}){return this.insertStaticBlock(getEndIndexFromArray(this.getMembersWithComments()),structure)}addStaticBlocks(structures){return this.insertStaticBlocks(getEndIndexFromArray(this.getMembersWithComments()),structures)}insertStaticBlock(index,structure={}){return this.insertStaticBlocks(index,[structure])[0]}insertStaticBlocks(index,structures){let isAmbient=isNodeAmbientOrInAmbientContext(this);return insertChildren(this,{index,structures,expectedKind:common.SyntaxKind.ClassStaticBlockDeclaration,write:(writer,info)=>{!isAmbient&&info.previousMember!=null&&!Node.isCommentNode(info.previousMember)?writer.blankLineIfLastNot():writer.newLineIfLastNot(),this._context.structurePrinterFactory.forClassStaticBlockDeclaration().printTexts(writer,structures),!isAmbient&&info.nextMember!=null?writer.blankLineIfLastNot():writer.newLineIfLastNot()}})}getStaticBlocks(){return this.getMembers().filter(m=>Node.isClassStaticBlockDeclaration(m))}addGetAccessor(structure){return this.addGetAccessors([structure])[0]}addGetAccessors(structures){return this.insertGetAccessors(getEndIndexFromArray(this.getMembersWithComments()),structures)}insertGetAccessor(index,structure){return this.insertGetAccessors(index,[structure])[0]}insertGetAccessors(index,structures){return insertChildren(this,{index,structures,expectedKind:common.SyntaxKind.GetAccessor,write:(writer,info)=>{info.previousMember!=null&&!Node.isCommentNode(info.previousMember)?writer.blankLineIfLastNot():writer.newLineIfLastNot(),this._context.structurePrinterFactory.forGetAccessorDeclaration({isAmbient:isNodeAmbientOrInAmbientContext(this)}).printTexts(writer,structures),info.nextMember!=null?writer.blankLineIfLastNot():writer.newLineIfLastNot()}})}addSetAccessor(structure){return this.addSetAccessors([structure])[0]}addSetAccessors(structures){return this.insertSetAccessors(getEndIndexFromArray(this.getMembersWithComments()),structures)}insertSetAccessor(index,structure){return this.insertSetAccessors(index,[structure])[0]}insertSetAccessors(index,structures){return insertChildren(this,{index,structures,expectedKind:common.SyntaxKind.SetAccessor,write:(writer,info)=>{info.previousMember!=null&&!Node.isCommentNode(info.previousMember)?writer.blankLineIfLastNot():writer.newLineIfLastNot(),this._context.structurePrinterFactory.forSetAccessorDeclaration({isAmbient:isNodeAmbientOrInAmbientContext(this)}).printTexts(writer,structures),info.nextMember!=null?writer.blankLineIfLastNot():writer.newLineIfLastNot()}})}addProperty(structure){return this.addProperties([structure])[0]}addProperties(structures){return this.insertProperties(getEndIndexFromArray(this.getMembersWithComments()),structures)}insertProperty(index,structure){return this.insertProperties(index,[structure])[0]}insertProperties(index,structures){return insertChildren(this,{index,structures,expectedKind:common.SyntaxKind.PropertyDeclaration,write:(writer,info)=>{info.previousMember!=null&&Node.hasBody(info.previousMember)?writer.blankLineIfLastNot():writer.newLineIfLastNot(),this._context.structurePrinterFactory.forPropertyDeclaration().printTexts(writer,structures),info.nextMember!=null&&Node.hasBody(info.nextMember)?writer.blankLineIfLastNot():writer.newLineIfLastNot()}})}addMethod(structure){return this.addMethods([structure])[0]}addMethods(structures){return this.insertMethods(getEndIndexFromArray(this.getMembersWithComments()),structures)}insertMethod(index,structure){return this.insertMethods(index,[structure])[0]}insertMethods(index,structures){let isAmbient=isNodeAmbientOrInAmbientContext(this);return structures=structures.map(s=>({...s})),insertChildren(this,{index,write:(writer,info)=>{!isAmbient&&info.previousMember!=null&&!Node.isCommentNode(info.previousMember)?writer.blankLineIfLastNot():writer.newLineIfLastNot(),this._context.structurePrinterFactory.forMethodDeclaration({isAmbient}).printTexts(writer,structures),!isAmbient&&info.nextMember!=null?writer.blankLineIfLastNot():writer.newLineIfLastNot()},structures,expectedKind:common.SyntaxKind.MethodDeclaration})}getInstanceProperty(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getInstanceProperties(),nameOrFindFunction)}getInstancePropertyOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getInstanceProperty(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("class instance property",nameOrFindFunction))}getInstanceProperties(){return this.getInstanceMembers().filter(m=>isClassPropertyType(m))}getStaticProperty(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getStaticProperties(),nameOrFindFunction)}getStaticPropertyOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getStaticProperty(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("class static property",nameOrFindFunction))}getStaticProperties(){return this.getStaticMembers().filter(m=>isClassPropertyType(m))}getProperty(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getProperties(),nameOrFindFunction)}getPropertyOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getProperty(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("class property declaration",nameOrFindFunction))}getProperties(){return this.getMembers().filter(m=>Node.isPropertyDeclaration(m))}getGetAccessor(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getGetAccessors(),nameOrFindFunction)}getGetAccessorOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getGetAccessor(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("class getAccessor declaration",nameOrFindFunction))}getGetAccessors(){return this.getMembers().filter(m=>Node.isGetAccessorDeclaration(m))}getSetAccessor(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getSetAccessors(),nameOrFindFunction)}getSetAccessorOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getSetAccessor(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("class setAccessor declaration",nameOrFindFunction))}getSetAccessors(){return this.getMembers().filter(m=>Node.isSetAccessorDeclaration(m))}getMethod(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getMethods(),nameOrFindFunction)}getMethodOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getMethod(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("class method declaration",nameOrFindFunction))}getMethods(){return this.getMembers().filter(m=>Node.isMethodDeclaration(m))}getInstanceMethod(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getInstanceMethods(),nameOrFindFunction)}getInstanceMethodOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getInstanceMethod(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("class instance method",nameOrFindFunction))}getInstanceMethods(){return this.getInstanceMembers().filter(m=>m instanceof MethodDeclaration)}getStaticMethod(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getStaticMethods(),nameOrFindFunction)}getStaticMethodOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getStaticMethod(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("class static method",nameOrFindFunction))}getStaticMethods(){return this.getStaticMembers().filter(m=>m instanceof MethodDeclaration)}getInstanceMember(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getInstanceMembers(),nameOrFindFunction)}getInstanceMemberOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getInstanceMember(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("class instance member",nameOrFindFunction))}getInstanceMembers(){return this.getMembersWithParameterProperties().filter(m=>Node.isConstructorDeclaration(m)?!1:Node.isParameterDeclaration(m)||!m.isStatic())}getStaticMember(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getStaticMembers(),nameOrFindFunction)}getStaticMemberOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getStaticMember(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("class static member",nameOrFindFunction))}getStaticMembers(){return this.getMembers().filter(m=>Node.isConstructorDeclaration(m)?!1:!Node.isParameterDeclaration(m)&&m.isStatic())}getMembersWithParameterProperties(){let members=this.getMembers(),implementationCtors=members.filter(c=>Node.isConstructorDeclaration(c)&&c.isImplementation());for(let ctor of implementationCtors){let insertIndex=members.indexOf(ctor)+1;for(let param of ctor.getParameters())param.isParameterProperty()&&(members.splice(insertIndex,0,param),insertIndex++)}return members}getMembers(){return getAllMembers(this,this.compilerNode.members).filter(m=>isSupportedClassMember(m))}getMembersWithComments(){let compilerNode=this.compilerNode,members=ExtendedParser.getContainerArray(compilerNode,this.getSourceFile().compilerNode);return getAllMembers(this,members).filter(m=>isSupportedClassMember(m)||Node.isCommentClassElement(m))}getMember(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getMembers(),nameOrFindFunction)}getMemberOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getMember(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("class member",nameOrFindFunction))}getBaseTypes(){return this.getType().getBaseTypes()}getBaseClassOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getBaseClass(),message??`Expected to find the base class of ${this.getName()}.`,this)}getBaseClass(){let declarations=this.getBaseTypes().map(t=>t.isIntersection()?t.getIntersectionTypes():[t]).flat().map(t=>t.getSymbol()).filter(s=>s!=null).map(s=>s.getDeclarations()).reduce((a,b)=>a.concat(b),[]).filter(d=>d.getKind()===common.SyntaxKind.ClassDeclaration);if(declarations.length===1)return declarations[0]}getDerivedClasses(){let classes=getImmediateDerivedClasses(this);for(let i=0;iclassDec._getNodeFromCompilerNode(m));return isAmbient?members:members.filter(m=>!(Node.isConstructorDeclaration(m)||Node.isMethodDeclaration(m))||Node.isMethodDeclaration(m)&&m.isAbstract()?!0:m.isImplementation())}function getImmediateDerivedClasses(classDec){let classes=[],nameNode=classDec.getNameNode();if(nameNode==null)return classes;for(let node of nameNode.findReferencesAsNodes()){let nodeParent=node.getParentIfKind(common.SyntaxKind.ExpressionWithTypeArguments);if(nodeParent==null)continue;let heritageClause=nodeParent.getParentIfKind(common.SyntaxKind.HeritageClause);if(heritageClause==null||heritageClause.getToken()!==common.SyntaxKind.ExtendsKeyword)continue;let derivedClass=heritageClause.getParentIfKind(common.SyntaxKind.ClassDeclaration);derivedClass!=null&&classes.push(derivedClass)}return classes}function isClassPropertyType(m){return Node.isPropertyDeclaration(m)||Node.isSetAccessorDeclaration(m)||Node.isGetAccessorDeclaration(m)||Node.isParameterDeclaration(m)}function isSupportedClassMember(m){return Node.isMethodDeclaration(m)||Node.isPropertyDeclaration(m)||Node.isGetAccessorDeclaration(m)||Node.isSetAccessorDeclaration(m)||Node.isConstructorDeclaration(m)||Node.isClassStaticBlockDeclaration(m)}function insertChildren(classDeclaration,opts){return insertIntoBracesOrSourceFileWithGetChildren({getIndexedChildren:()=>classDeclaration.getMembersWithComments(),parent:classDeclaration,...opts})}var createBase$k=ctor=>ModuleChildableNode(AmbientableNode(ExportableNode(ClassLikeDeclarationBase(ctor)))),ClassDeclarationBase=createBase$k(Statement),ClassDeclaration=class extends ClassDeclarationBase{set(structure){return callBaseSet(ClassDeclarationBase.prototype,this,structure),structure.extends!=null?this.setExtends(structure.extends):structure.hasOwnProperty(common.nameof(structure,"extends"))&&this.removeExtends(),structure.ctors!=null&&(this.getConstructors().forEach(c=>c.remove()),this.addConstructors(structure.ctors)),structure.staticBlocks!=null&&(this.getStaticBlocks().forEach(c=>c.remove()),this.addStaticBlocks(structure.staticBlocks)),structure.properties!=null&&(this.getProperties().forEach(p=>p.remove()),this.addProperties(structure.properties)),structure.getAccessors!=null&&(this.getGetAccessors().forEach(a=>a.remove()),this.addGetAccessors(structure.getAccessors)),structure.setAccessors!=null&&(this.getSetAccessors().forEach(a=>a.remove()),this.addSetAccessors(structure.setAccessors)),structure.methods!=null&&(this.getMethods().forEach(m=>m.remove()),this.addMethods(structure.methods)),this}getStructure(){let getExtends=this.getExtends(),isAmbient=this.isAmbient();return callBaseGetStructure(ClassDeclarationBase.prototype,this,{kind:exports.StructureKind.Class,ctors:this.getConstructors().filter(ctor=>isAmbient||!ctor.isOverload()).map(ctor=>ctor.getStructure()),staticBlocks:this.getStaticBlocks().map(ctor=>ctor.getStructure()),methods:this.getMethods().filter(method=>isAmbient||!method.isOverload()).map(method=>method.getStructure()),properties:this.getProperties().map(property=>property.getStructure()),extends:getExtends?getExtends.getText():void 0,getAccessors:this.getGetAccessors().map(getAccessor=>getAccessor.getStructure()),setAccessors:this.getSetAccessors().map(accessor=>accessor.getStructure())})}extractInterface(name){let{constructors,properties,methods,accessors}=getExtractedClassDetails(this,!1),parameterProperties=constructors.map(c=>c.getParameters().filter(p=>p.isParameterProperty())).flat().filter(p=>p.getName()!=null&&p.getScope()===exports.Scope.Public);return{kind:exports.StructureKind.Interface,name:getDefaultExtractedName(name,this),docs:this.getJsDocs().map(d=>d.getStructure()),typeParameters:this.getTypeParameters().map(p=>p.getStructure()),properties:[...parameterProperties.map(p=>{let jsDocComment=p.getParentOrThrow().getJsDocs().map(j=>j.getTags()).flat().filter(Node.isJSDocParameterTag).filter(t=>t.getTagName()==="param"&&t.getName()===p.getName()&&t.getComment()!=null).map(t=>t.getCommentText().trim())[0];return{kind:exports.StructureKind.PropertySignature,docs:jsDocComment==null?[]:[{kind:exports.StructureKind.JSDoc,description:jsDocComment}],name:p.getName(),type:p.getType().getText(p),hasQuestionToken:p.hasQuestionToken(),isReadonly:p.isReadonly()}}),...properties.map(getExtractedInterfacePropertyStructure),...accessors.map(getExtractedInterfaceAccessorStructure)],methods:methods.map(getExtractedInterfaceMethodStructure)}}extractStaticInterface(name){let{constructors,properties,methods,accessors}=getExtractedClassDetails(this,!0),instanceName=getDefaultExtractedName(void 0,this);return{kind:exports.StructureKind.Interface,name,properties:[...properties.map(getExtractedInterfacePropertyStructure),...accessors.map(getExtractedInterfaceAccessorStructure)],methods:methods.map(getExtractedInterfaceMethodStructure),constructSignatures:constructors.map(c=>({kind:exports.StructureKind.ConstructSignature,docs:c.getJsDocs().map(d=>d.getStructure()),parameters:c.getParameters().map(p=>({...getExtractedInterfaceParameterStructure(p),scope:void 0,isReadonly:!1})),returnType:instanceName}))}}};function getExtractedClassDetails(classDec,isStatic){let constructors=classDec.getConstructors().map(c=>c.getOverloads().length>0?c.getOverloads():[c]).flat(),properties=classDec.getProperties().filter(p=>p.isStatic()===isStatic&&p.getScope()===exports.Scope.Public),methods=classDec.getMethods().filter(p=>p.isStatic()===isStatic&&p.getScope()===exports.Scope.Public).map(m=>m.getOverloads().length>0?m.getOverloads():[m]).flat();return{constructors,properties,methods,accessors:getAccessors()};function getAccessors(){let result=new common.KeyValueCache;for(let accessor of[...classDec.getGetAccessors(),...classDec.getSetAccessors()])accessor.isStatic()===isStatic&&accessor.getScope()===exports.Scope.Public&&result.getOrCreate(accessor.getName(),()=>[]).push(accessor);return result.getValuesAsArray()}}function getDefaultExtractedName(name,classDec){return name=common.StringUtils.isNullOrWhitespace(name)?void 0:name,name||classDec.getName()||classDec.getSourceFile().getBaseNameWithoutExtension().replace(/[^a-zA-Z0-9_$]/g,"")}function getExtractedInterfacePropertyStructure(prop){return{kind:exports.StructureKind.PropertySignature,docs:prop.getJsDocs().map(d=>d.getStructure()),name:prop.getName(),type:prop.getType().getText(prop),hasQuestionToken:prop.hasQuestionToken(),isReadonly:prop.isReadonly()}}function getExtractedInterfaceAccessorStructure(getAndSet){return{kind:exports.StructureKind.PropertySignature,docs:getAndSet[0].getJsDocs().map(d=>d.getStructure()),name:getAndSet[0].getName(),type:getAndSet[0].getType().getText(getAndSet[0]),hasQuestionToken:!1,isReadonly:getAndSet.every(Node.isGetAccessorDeclaration)}}function getExtractedInterfaceMethodStructure(method){return{kind:exports.StructureKind.MethodSignature,docs:method.getJsDocs().map(d=>d.getStructure()),name:method.getName(),hasQuestionToken:method.hasQuestionToken(),returnType:method.getReturnType().getText(method),parameters:method.getParameters().map(getExtractedInterfaceParameterStructure),typeParameters:method.getTypeParameters().map(p=>p.getStructure())}}function getExtractedInterfaceParameterStructure(param){return{...param.getStructure(),decorators:[]}}var ClassExpressionBase=ClassLikeDeclarationBase(PrimaryExpression),ClassExpression=class extends ClassExpressionBase{},createBase$j=ctor=>ChildOrderableNode(TextInsertableNode(StatementedNode(JSDocableNode(BodiedNode(ctor))))),ClassStaticBlockDeclarationBase=createBase$j(ClassElement),ClassStaticBlockDeclaration=class extends ClassStaticBlockDeclarationBase{getName(){return"static"}isStatic(){return!0}set(structure){return callBaseSet(ClassStaticBlockDeclarationBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(ClassStaticBlockDeclarationBase.prototype,this,{kind:exports.StructureKind.ClassStaticBlock})}},CommentClassElement=class extends ClassElement{},createBase$i=ctor=>ReferenceFindableNode(ChildOrderableNode(TextInsertableNode(OverloadableNode(ScopedNode(FunctionLikeDeclaration(BodyableNode(ctor))))))),ConstructorDeclarationBase=createBase$i(ClassElement),createOverloadBase=ctor=>TypeParameteredNode(JSDocableNode(ChildOrderableNode(TextInsertableNode(ScopedNode(ModifierableNode(SignaturedDeclaration(ctor))))))),ConstructorDeclarationOverloadBase=createOverloadBase(ClassElement),ConstructorDeclaration=class extends ConstructorDeclarationBase{set(structure){return callBaseSet(ConstructorDeclarationBase.prototype,this,structure),structure.overloads!=null&&(this.getOverloads().forEach(o=>o.remove()),this.addOverloads(structure.overloads)),this}addOverload(structure){return this.addOverloads([structure])[0]}addOverloads(structures){return this.insertOverloads(this.getOverloads().length,structures)}insertOverload(index,structure){return this.insertOverloads(index,[structure])[0]}insertOverloads(index,structures){let printer=this._context.structurePrinterFactory.forConstructorDeclaration({isAmbient:isNodeAmbientOrInAmbientContext(this)});return insertOverloads({node:this,index,structures,printStructure:(writer,structure)=>{printer.printOverload(writer,structure)},getThisStructure:fromConstructorDeclarationOverload,expectedSyntaxKind:common.SyntaxKind.Constructor})}getStructure(){let hasImplementation=this.getImplementation()!=null,isOverload=this.isOverload(),basePrototype=isOverload&&hasImplementation?ConstructorDeclarationOverloadBase.prototype:ConstructorDeclarationBase.prototype;return callBaseGetStructure(basePrototype,this,getStructure(this));function getStructure(thisNode){if(hasImplementation&&isOverload)return getSpecificOverloadStructure();return getSpecificStructure();function getSpecificOverloadStructure(){return{kind:exports.StructureKind.ConstructorOverload}}function getSpecificStructure(){return hasImplementation?{kind:exports.StructureKind.Constructor,overloads:thisNode.getOverloads().map(o=>o.getStructure())}:{kind:exports.StructureKind.Constructor}}}}},createBase$h=ctor=>ChildOrderableNode(TextInsertableNode(DecoratableNode(AbstractableNode(ScopedNode(StaticableNode(FunctionLikeDeclaration(BodyableNode(PropertyNamedNode(ctor))))))))),GetAccessorDeclarationBase=createBase$h(ClassElement),GetAccessorDeclaration=class extends GetAccessorDeclarationBase{set(structure){return callBaseSet(GetAccessorDeclarationBase.prototype,this,structure),this}getSetAccessor(){let thisName=this.getName(),isStatic=this.isStatic();return this.getParentOrThrow().forEachChild(sibling=>{if(Node.isSetAccessorDeclaration(sibling)&&sibling.getName()===thisName&&sibling.isStatic()===isStatic)return sibling})}getSetAccessorOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getSetAccessor(),message??(()=>`Expected to find a corresponding set accessor for ${this.getName()}.`),this)}getStructure(){return callBaseGetStructure(GetAccessorDeclarationBase.prototype,this,{kind:exports.StructureKind.GetAccessor})}},createBase$g=ctor=>ChildOrderableNode(OverrideableNode(AmbientableNode(DecoratableNode(AbstractableNode(ScopedNode(StaticableNode(JSDocableNode(ReadonlyableNode(ExclamationTokenableNode(QuestionTokenableNode(InitializerExpressionableNode(TypedNode(PropertyNamedNode(ModifierableNode(ctor))))))))))))))),PropertyDeclarationBase=createBase$g(ClassElement),PropertyDeclaration=class extends PropertyDeclarationBase{hasAccessorKeyword(){return this.hasModifier(common.SyntaxKind.AccessorKeyword)}setHasAccessorKeyword(value){return this.toggleModifier("accessor",value)}set(structure){return callBaseSet(PropertyDeclarationBase.prototype,this,structure),structure.hasAccessorKeyword!=null&&this.setHasAccessorKeyword(structure.hasAccessorKeyword),this}remove(){let parent=this.getParentOrThrow();switch(parent.getKind()){case common.SyntaxKind.ClassDeclaration:super.remove();break;default:throw new common.errors.NotImplementedError(`Not implemented parent syntax kind: ${parent.getKindName()}`)}}getStructure(){return callBaseGetStructure(PropertyDeclarationBase.prototype,this,{kind:exports.StructureKind.Property,hasAccessorKeyword:this.hasAccessorKeyword()})}},createBase$f=ctor=>ChildOrderableNode(TextInsertableNode(DecoratableNode(AbstractableNode(ScopedNode(StaticableNode(FunctionLikeDeclaration(BodyableNode(PropertyNamedNode(ctor))))))))),SetAccessorDeclarationBase=createBase$f(ClassElement),SetAccessorDeclaration=class extends SetAccessorDeclarationBase{set(structure){return callBaseSet(SetAccessorDeclarationBase.prototype,this,structure),this}getGetAccessor(){let thisName=this.getName(),isStatic=this.isStatic();return this.getParentOrThrow().forEachChild(sibling=>{if(Node.isGetAccessorDeclaration(sibling)&&sibling.getName()===thisName&&sibling.isStatic()===isStatic)return sibling})}getGetAccessorOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getGetAccessor(),message??(()=>`Expected to find a corresponding get accessor for ${this.getName()}.`),this)}getStructure(){return callBaseGetStructure(SetAccessorDeclarationBase.prototype,this,{kind:exports.StructureKind.SetAccessor})}},DecoratorBase=LeftHandSideExpressionedNode(Node),Decorator=class extends DecoratorBase{getName(){return this.getNameNode().getText()}getNameNode(){let callExpression=this.getCallExpression();if(callExpression)return getIdentifierFromName(callExpression.getExpression());return getIdentifierFromName(this._getInnerExpression());function getIdentifierFromName(expression){let identifier=getNameFromExpression(expression);if(!Node.isIdentifier(identifier))throw new common.errors.NotImplementedError(`Expected the decorator expression '${identifier.getText()}' to be an identifier. Please deal directly with 'getExpression()' on the decorator to handle more complex scenarios.`);return identifier}function getNameFromExpression(expression){return Node.isPropertyAccessExpression(expression)?expression.getNameNode():expression}}getFullName(){let sourceFile=this.getSourceFile();return this.isDecoratorFactory()?this.getCallExpression().getExpression().getText():this.compilerNode.expression.getText(sourceFile.compilerNode)}isDecoratorFactory(){return Node.isCallExpression(this._getInnerExpression())}setIsDecoratorFactory(isDecoratorFactory){if(this.isDecoratorFactory()===isDecoratorFactory)return this;if(isDecoratorFactory){let expression=this._getInnerExpression(),expressionText=expression.getText();insertIntoParentTextRange({parent:this,insertPos:expression.getStart(),newText:`${expressionText}()`,replacing:{textLength:expressionText.length},customMappings:newParent=>[{currentNode:expression,newNode:newParent.expression.expression}]})}else{let callExpression=this.getCallExpressionOrThrow(),expression=callExpression.getExpression(),expressionText=expression.getText();insertIntoParentTextRange({parent:this,insertPos:callExpression.getStart(),newText:`${expressionText}`,replacing:{textLength:callExpression.getWidth()},customMappings:newParent=>[{currentNode:expression,newNode:newParent.expression}]})}return this}getCallExpressionOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getCallExpression(),message??"Expected to find a call expression.",this)}getCallExpression(){let expression=this._getInnerExpression();return Node.isCallExpression(expression)?expression:void 0}getArguments(){return this.getCallExpression()?.getArguments()??[]}getTypeArguments(){return this.getCallExpression()?.getTypeArguments()??[]}addTypeArgument(argumentText){return this.getCallExpressionOrThrow().addTypeArgument(argumentText)}addTypeArguments(argumentTexts){return this.getCallExpressionOrThrow().addTypeArguments(argumentTexts)}insertTypeArgument(index,argumentText){return this.getCallExpressionOrThrow().insertTypeArgument(index,argumentText)}insertTypeArguments(index,argumentTexts){return this.getCallExpressionOrThrow().insertTypeArguments(index,argumentTexts)}removeTypeArgument(typeArgOrIndex){let callExpression=this.getCallExpression();if(callExpression==null)throw new common.errors.InvalidOperationError("Cannot remove a type argument from a decorator that has no type arguments.");return callExpression.removeTypeArgument(typeArgOrIndex),this}addArgument(argumentText){return this.addArguments([argumentText])[0]}addArguments(argumentTexts){return this.insertArguments(this.getArguments().length,argumentTexts)}insertArgument(index,argumentText){return this.insertArguments(index,[argumentText])[0]}insertArguments(index,argumentTexts){return this.setIsDecoratorFactory(!0),this.getCallExpressionOrThrow().insertArguments(index,argumentTexts)}removeArgument(argOrIndex){let callExpression=this.getCallExpression();if(callExpression==null)throw new common.errors.InvalidOperationError("Cannot remove an argument from a decorator that has no arguments.");return callExpression.removeArgument(argOrIndex),this}remove(){let thisStartLinePos=this.getStartLinePos(),previousDecorator=this.getPreviousSiblingIfKind(common.SyntaxKind.Decorator);previousDecorator!=null&&previousDecorator.getStartLinePos()===thisStartLinePos?removeChildren({children:[this],removePrecedingSpaces:!0}):removeChildrenWithFormattingFromCollapsibleSyntaxList({children:[this],getSiblingFormatting:(parent,sibling)=>sibling.getStartLinePos()===thisStartLinePos?FormattingKind.Space:FormattingKind.Newline})}_getInnerExpression(){let expr=this.getExpression();for(;Node.isParenthesizedExpression(expr);)expr=expr.getExpression();return expr}set(structure){return callBaseSet(DecoratorBase.prototype,this,structure),structure.name!=null&&this.getNameNode().replaceWithText(structure.name),structure.arguments!=null&&(this.setIsDecoratorFactory(!0),this.getArguments().map(a=>this.removeArgument(a)),this.addArguments(structure.arguments)),structure.typeArguments!=null&&structure.typeArguments.length>0&&(this.setIsDecoratorFactory(!0),this.getTypeArguments().map(a=>this.removeTypeArgument(a)),this.addTypeArguments(structure.typeArguments)),this}getStructure(){let isDecoratorFactory=this.isDecoratorFactory();return callBaseGetStructure(DecoratorBase.prototype,this,{kind:exports.StructureKind.Decorator,name:this.getName(),arguments:isDecoratorFactory?this.getArguments().map(arg=>arg.getText()):void 0,typeArguments:isDecoratorFactory?this.getTypeArguments().map(arg=>arg.getText()):void 0})}};function JSDocPropertyLikeTag(Base){return class extends Base{getTypeExpression(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression)}getTypeExpressionOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getTypeExpression(),message??"Expected to find a JS doc type expression.",this)}getName(){return this.getNameNode().getText()}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}isBracketed(){return this.compilerNode.isBracketed}}}function JSDocTypeExpressionableTag(Base){return class extends Base{getTypeExpression(){let result=this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression);if(!(result!=null&&result.getWidth()===0))return result}getTypeExpressionOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getTypeExpression(),message??"Expected to find the JS doc tag's type expression.",this)}}}function JSDocTypeParameteredTag(Base){return class extends Base{getTypeParameters(){return this.compilerNode.typeParameters.map(p=>this._getNodeFromCompilerNode(p)).filter(p=>p.getWidth()>0)}}}function getTextWithoutStars(inputText){return inputText.replace(/^\/\*\*[^\S\n]*\n?/,"").replace(/(\r?\n)?[^\S\n]*\*\/$/,"").split(/\n/).map(line=>{let starPos=getStarPosIfFirstNonWhitespaceChar(line);if(starPos===-1)return line;let substringStart=line[starPos+1]===" "?starPos+2:starPos+1;return line.substring(substringStart)}).join(` `);function getStarPosIfFirstNonWhitespaceChar(text){for(let i=0;ithis._getNodeFromCompilerNode(t))??[]}getInnerText(){return getTextWithoutStars(this.getText())}getComment(){if(this.compilerNode.comment!=null)return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:this.compilerNode.comment.map(n=>this._getNodeFromCompilerNodeIfExists(n))}getCommentText(){return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:common.ts.getTextOfJSDocComment(this.compilerNode.comment)}getDescription(){let sourceFileText=this.getSourceFile().getFullText(),endSearchStart=this.getTags()[0]?.getStart()??this.getEnd()-2,start=getStart(this);return getTextWithoutStars(sourceFileText.substring(start,Math.max(start,getEndPos())));function getStart(jsDoc){let startOrSpacePos=jsDoc.getStart()+3;return sourceFileText.charCodeAt(startOrSpacePos)===CharCodes.SPACE?startOrSpacePos+1:startOrSpacePos}function getEndPos(){let endOrNewLinePos=getPreviousMatchingPos(sourceFileText,endSearchStart,charCode=>charCode===CharCodes.NEWLINE||!common.StringUtils.isWhitespaceCharCode(charCode)&&charCode!==CharCodes.ASTERISK);return getPreviousMatchingPos(sourceFileText,endOrNewLinePos,charCode=>charCode!==CharCodes.NEWLINE&&charCode!==CharCodes.CARRIAGE_RETURN)}}setDescription(textOrWriterFunction){let tags=this.getTags(),startEditPos=this.getStart()+3,endEditPos=tags.length>0?getPreviousMatchingPos(this._sourceFile.getFullText(),tags[0].getStart(),c=>c===CharCodes.ASTERISK)-1:this.getEnd()-2;return replaceTextPossiblyCreatingChildNodes({parent:this,newText:getNewText.call(this),replacePos:startEditPos,replacingLength:endEditPos-startEditPos}),this;function getNewText(){let indentationText=this.getIndentationText(),newLineKind=this._context.manipulationSettings.getNewLineKindAsString(),rawLines=getTextFromStringOrWriter(this._getWriter(),textOrWriterFunction).split(/\r?\n/),startsWithNewLine=rawLines[0].length===0,isSingleLine=rawLines.length===1&&(this.compilerNode.tags?.length??0)===0,linesText=isSingleLine?rawLines[0]:rawLines.map(l=>l.length===0?`${indentationText} *`:`${indentationText} * ${l}`).slice(startsWithNewLine?1:0).join(newLineKind);return isSingleLine?" "+linesText+" ":newLineKind+linesText+newLineKind+indentationText+" "}}addTag(structure){return this.addTags([structure])[0]}addTags(structures){return this.insertTags(this.compilerNode.tags?.length??0,structures)}insertTag(index,structure){return this.insertTags(index,[structure])[0]}insertTags(index,structures){if(common.ArrayUtils.isNullOrEmpty(structures))return[];let writer=this._getWriterWithQueuedIndentation(),tags=this.getTags();if(index=verifyAndGetIndex(index,tags.length),tags.length===0&&!this.isMultiLine()){let structurePrinter=this._context.structurePrinterFactory.forJSDoc();this.replaceWithText(writer2=>{structurePrinter.printText(writer2,{description:this.getDescription(),tags:structures})})}else{let structurePrinter=this._context.structurePrinterFactory.forJSDocTag({printStarsOnNewLine:!0});writer.newLine().write(" * "),structurePrinter.printTexts(writer,structures),writer.newLine().write(" *"),writer.conditionalWrite(index!common.StringUtils.isWhitespaceCharCode(charCode)&&charCode!==CharCodes.ASTERISK))}function getReplaceEnd(){return index{this._context.structurePrinterFactory.forJSDoc().printText(writer,{description:structure.description??this.getDescription(),tags:structure.tags})}):(structure.description!=null&&this.setDescription(structure.description),this)}getStructure(){return callBaseGetStructure(JSDocBase.prototype,this,{kind:exports.StructureKind.JSDoc,description:this.getDescription(),tags:this.getTags().map(t=>t.getStructure())})}},TypeNode=class extends Node{},NodeWithTypeArgumentsBase=TypeArgumentedNode(TypeNode),NodeWithTypeArguments=class extends NodeWithTypeArgumentsBase{},ArrayTypeNode=class extends TypeNode{getElementTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.elementType)}},ConditionalTypeNode=class extends TypeNode{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)}},FunctionOrConstructorTypeNodeBaseBase=SignaturedDeclaration(TypeNode),FunctionOrConstructorTypeNodeBase=class extends FunctionOrConstructorTypeNodeBaseBase{},ConstructorTypeNodeBase=AbstractableNode(ModifierableNode(FunctionOrConstructorTypeNodeBase)),ConstructorTypeNode=class extends ConstructorTypeNodeBase{},ExpressionWithTypeArgumentsBase=LeftHandSideExpressionedNode(NodeWithTypeArguments),ExpressionWithTypeArguments=class extends ExpressionWithTypeArgumentsBase{},FunctionTypeNodeBase=TypeParameteredNode(FunctionOrConstructorTypeNodeBase),FunctionTypeNode=class extends FunctionTypeNodeBase{},ImportTypeNode=class extends NodeWithTypeArguments{setArgument(text){let arg=this.getArgument();if(Node.isLiteralTypeNode(arg)){let literal=arg.getLiteral();if(Node.isStringLiteral(literal))return literal.setLiteralValue(text),this}return arg.replaceWithText(writer=>writer.quote(text),this._getWriterWithQueuedChildIndentation()),this}getArgument(){return this._getNodeFromCompilerNode(this.compilerNode.argument)}setQualifier(text){let qualifier=this.getQualifier();if(qualifier!=null)qualifier.replaceWithText(text,this._getWriterWithQueuedChildIndentation());else{let paren=this.getFirstChildByKindOrThrow(common.SyntaxKind.CloseParenToken);insertIntoParentTextRange({insertPos:paren.getEnd(),parent:this,newText:this._getWriterWithQueuedIndentation().write(".").write(text).toString()})}return this}getQualifierOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getQualifier(),message??(()=>`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(message){return common.errors.throwIfNullOrUndefined(this._getNodeFromCompilerNodeIfExists(this.compilerNode.attributes),message??"Could not find import type assertion container.",this)}},IndexedAccessTypeNode=class extends TypeNode{getObjectTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.objectType)}getIndexTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.indexType)}},InferTypeNode=class extends TypeNode{getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}},IntersectionTypeNode=class extends TypeNode{getTypeNodes(){return this.compilerNode.types.map(t=>this._getNodeFromCompilerNode(t))}},LiteralTypeNode=class extends TypeNode{getLiteral(){let tsLiteral=this.compilerNode.literal;return this._getNodeFromCompilerNode(tsLiteral)}},MappedTypeNode=class extends TypeNode{getNameTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.nameType)}getNameTypeNodeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getNameTypeNode(),message??"Type did not exist.",this)}getReadonlyToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.readonlyToken)}getReadonlyTokenOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getReadonlyToken(),message??"Readonly token did not exist.",this)}getQuestionToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.questionToken)}getQuestionTokenOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getQuestionToken(),message??"Question token did not exist.",this)}getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getTypeNode(),message??"Type did not exist, but was expected to exist.",this)}},createBase$e=ctor=>TypedNode(QuestionTokenableNode(DotDotDotTokenableNode(JSDocableNode(NamedNode(ctor))))),NamedTupleMemberBase=createBase$e(TypeNode),NamedTupleMember=class extends NamedTupleMemberBase{getTypeNode(){return super.getTypeNode()}removeType(){throw new common.errors.InvalidOperationError("Cannot remove the type of a named tuple member.")}},ParenthesizedTypeNode=class extends TypeNode{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}setType(textOrWriterFunction){return this.getTypeNode().replaceWithText(textOrWriterFunction),this}},RestTypeNode=class extends TypeNode{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},TemplateLiteralTypeNode=class extends TypeNode{getHead(){return this._getNodeFromCompilerNode(this.compilerNode.head)}getTemplateSpans(){return this.compilerNode.templateSpans.map(s=>this._getNodeFromCompilerNode(s))}setLiteralValue(value){let childIndex=this.getChildIndex(),parent=this.getParentSyntaxList()??this.getParentOrThrow();return replaceNodeText({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:value}),parent.getChildAtIndex(childIndex)}},ThisTypeNode=class extends TypeNode{},TupleTypeNode=class extends TypeNode{getElements(){return this.compilerNode.elements.map(t=>this._getNodeFromCompilerNode(t))}},createBase$d=ctor=>TypeParameteredNode(TypedNode(JSDocableNode(AmbientableNode(ExportableNode(ModifierableNode(NamedNode(ctor))))))),TypeAliasDeclarationBase=createBase$d(Statement),TypeAliasDeclaration=class extends TypeAliasDeclarationBase{set(structure){return callBaseSet(TypeAliasDeclarationBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(TypeAliasDeclarationBase.prototype,this,{kind:exports.StructureKind.TypeAlias,type:this.getTypeNodeOrThrow().getText()})}},TypeLiteralNodeBase=TypeElementMemberedNode(TypeNode),TypeLiteralNode=class extends TypeLiteralNodeBase{},TypeOperatorTypeNode=class extends TypeNode{getOperator(){return this.compilerNode.operator}getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}};exports.TypeParameterVariance=void 0;(function(TypeParameterVariance){TypeParameterVariance[TypeParameterVariance.None=0]="None",TypeParameterVariance[TypeParameterVariance.In=1]="In",TypeParameterVariance[TypeParameterVariance.Out=2]="Out",TypeParameterVariance[TypeParameterVariance.InOut=3]="InOut"})(exports.TypeParameterVariance||(exports.TypeParameterVariance={}));var createBase$c=ctor=>ModifierableNode(NamedNode(ctor)),TypeParameterDeclarationBase=createBase$c(Node),TypeParameterDeclaration=class extends TypeParameterDeclarationBase{isConst(){return this.hasModifier(common.SyntaxKind.ConstKeyword)}setIsConst(value){return this.toggleModifier("const",value)}getConstraint(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.constraint)}getConstraintOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getConstraint(),message??"Expected to find the type parameter's constraint.",this)}setConstraint(text){if(text=this.getParentOrThrow()._getTextWithQueuedChildIndentation(text),common.StringUtils.isNullOrWhitespace(text))return this.removeConstraint(),this;let constraint=this.getConstraint();if(constraint!=null)return constraint.replaceWithText(text),this;let nameNode=this.getNameNode();return insertIntoParentTextRange({parent:this,insertPos:nameNode.getEnd(),newText:` extends ${text}`}),this}removeConstraint(){return removeConstraintOrDefault(this.getConstraint(),common.SyntaxKind.ExtendsKeyword),this}getDefault(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.default)}getDefaultOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getDefault(),message??"Expected to find the type parameter's default.",this)}setDefault(text){if(text=this.getParentOrThrow()._getTextWithQueuedChildIndentation(text),common.StringUtils.isNullOrWhitespace(text))return this.removeDefault(),this;let defaultNode=this.getDefault();if(defaultNode!=null)return defaultNode.replaceWithText(text),this;let insertAfterNode=this.getConstraint()||this.getNameNode();return insertIntoParentTextRange({parent:this,insertPos:insertAfterNode.getEnd(),newText:` = ${text}`}),this}removeDefault(){return removeConstraintOrDefault(this.getDefault(),common.SyntaxKind.EqualsToken),this}setVariance(variance){return this.toggleModifier("in",(variance&exports.TypeParameterVariance.In)!==0),this.toggleModifier("out",(variance&exports.TypeParameterVariance.Out)!==0),this}getVariance(){let variance=exports.TypeParameterVariance.None;return this.hasModifier(common.SyntaxKind.InKeyword)&&(variance|=exports.TypeParameterVariance.In),this.hasModifier(common.SyntaxKind.OutKeyword)&&(variance|=exports.TypeParameterVariance.Out),variance}remove(){let parentSyntaxList=this.getParentSyntaxListOrThrow();parentSyntaxList.getChildrenOfKind(common.SyntaxKind.TypeParameter).length===1?removeAllTypeParameters():removeCommaSeparatedChild(this);function removeAllTypeParameters(){let children=[parentSyntaxList.getPreviousSiblingIfKindOrThrow(common.SyntaxKind.LessThanToken),parentSyntaxList,parentSyntaxList.getNextSiblingIfKindOrThrow(common.SyntaxKind.GreaterThanToken)];removeChildren({children})}}set(structure){return callBaseSet(TypeParameterDeclarationBase.prototype,this,structure),structure.isConst!=null&&this.setIsConst(structure.isConst),structure.constraint!=null?this.setConstraint(structure.constraint):structure.hasOwnProperty(common.nameof(structure,"constraint"))&&this.removeConstraint(),structure.default!=null?this.setDefault(structure.default):structure.hasOwnProperty(common.nameof(structure,"default"))&&this.removeDefault(),structure.variance!=null&&this.setVariance(structure.variance),this}getStructure(){let constraintNode=this.getConstraint(),defaultNode=this.getDefault();return callBaseGetStructure(TypeParameterDeclarationBase.prototype,this,{kind:exports.StructureKind.TypeParameter,isConst:this.isConst(),constraint:constraintNode?.getText({trimLeadingIndentation:!0}),default:defaultNode?defaultNode.getText({trimLeadingIndentation:!0}):void 0,variance:this.getVariance()})}};function removeConstraintOrDefault(nodeToRemove,siblingKind){nodeToRemove!=null&&removeChildren({children:[nodeToRemove.getPreviousSiblingIfKindOrThrow(siblingKind),nodeToRemove],removePrecedingSpaces:!0})}var TypePredicateNode=class extends TypeNode{getParameterNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.parameterName)}hasAssertsModifier(){return this.compilerNode.assertsModifier!=null}getAssertsModifier(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertsModifier)}getAssertsModifierOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getAssertsModifier(),message??"Expected to find an asserts modifier.",this)}getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getTypeNode(),message??"Expected to find a type node.",this)}},TypeQueryNode=class extends NodeWithTypeArguments{getExprName(){return this._getNodeFromCompilerNode(this.compilerNode.exprName)}},TypeReferenceNode=class extends NodeWithTypeArguments{getTypeName(){return this._getNodeFromCompilerNode(this.compilerNode.typeName)}},UnionTypeNode=class extends TypeNode{getTypeNodes(){return this.compilerNode.types.map(t=>this._getNodeFromCompilerNode(t))}},JSDocType=class extends TypeNode{},JSDocAllType=class extends JSDocType{},JSDocTagBase=Node,JSDocTag=class extends JSDocTagBase{getTagName(){return this.getTagNameNode().getText()}getTagNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.tagName)}setTagName(tagName){return this.set({tagName})}getComment(){if(this.compilerNode.comment!=null)return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:this.compilerNode.comment.map(n=>this._getNodeFromCompilerNodeIfExists(n))}getCommentText(){return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:common.ts.getTextOfJSDocComment(this.compilerNode.comment)}remove(){let jsDocBodyStart=this.getParentOrThrow().getStart()+3,nextJsDocTag=getNextJsDocTag(this),isLastJsDoc=nextJsDocTag==null,removalStart=getRemovalStart.call(this);removeChildren({children:[this],customRemovalPos:removalStart,customRemovalEnd:getNextTagStartOrDocEnd(this,nextJsDocTag),replaceTrivia:getReplaceTrivia.call(this)});function getRemovalStart(){return Math.max(jsDocBodyStart,getPreviousNonWhiteSpacePos(this,this.getStart()))}function getReplaceTrivia(){if(removalStart===jsDocBodyStart&&isLastJsDoc)return"";let newLineKind=this._context.manipulationSettings.getNewLineKindAsString(),indentationText=this.getParentOrThrow().getIndentationText();return`${newLineKind}${indentationText} `+(isLastJsDoc?"":"* ")}}set(structure){return callBaseSet(JSDocTagBase.prototype,this,structure),structure.text!=null||structure.tagName!=null?this.replaceWithText(writer=>{this._context.structurePrinterFactory.forJSDocTag({printStarsOnNewLine:!0}).printText(writer,{tagName:structure.tagName??this.getTagName(),text:structure.text!=null?structure.text:getText(this)})}):this}replaceWithText(textOrWriterFunction){let newText=getTextFromStringOrWriter(this._getWriterWithQueuedIndentation(),textOrWriterFunction),parent=this.getParentOrThrow(),childIndex=this.getChildIndex(),start=this.getStart();return insertIntoParentTextRange({parent,insertPos:start,newText,replacing:{textLength:getTagEnd(this)-start}}),parent.getChildren()[childIndex]}getStructure(){let text=getText(this);return callBaseGetStructure(JSDocTagBase.prototype,this,{kind:exports.StructureKind.JSDocTag,tagName:this.getTagName(),text:text.length===0?void 0:text})}};function getText(jsDocTag){let text=jsDocTag.getSourceFile().getFullText(),nameEnd=jsDocTag.getTagNameNode().getEnd(),tagEnd=getTagEnd(jsDocTag),startPos=Math.min(text.charCodeAt(nameEnd)===CharCodes.SPACE?nameEnd+1:nameEnd,tagEnd);return getTextWithoutStars(text.substring(startPos,tagEnd))}function getTagEnd(jsDocTag){return getPreviousNonWhiteSpacePos(jsDocTag,getNextTagStartOrDocEnd(jsDocTag))}function getNextTagStartOrDocEnd(jsDocTag,nextJsDocTag){return nextJsDocTag=nextJsDocTag??getNextJsDocTag(jsDocTag),nextJsDocTag!=null?nextJsDocTag.getStart():jsDocTag.getParentOrThrow().getEnd()-2}function getNextJsDocTag(jsDocTag){let tags=jsDocTag.getParentIfKindOrThrow(common.SyntaxKind.JSDoc).getTags(),thisIndex=tags.indexOf(jsDocTag);return tags[thisIndex+1]}function getPreviousNonWhiteSpacePos(jsDocTag,pos){let sourceFileText=jsDocTag.getSourceFile().getFullText();return getPreviousMatchingPos(sourceFileText,pos,charCode=>charCode!==CharCodes.ASTERISK&&!common.StringUtils.isWhitespaceCharCode(charCode))}var JSDocAugmentsTag=class extends JSDocTag{},JSDocAuthorTag=class extends JSDocTag{},JSDocCallbackTag=class extends JSDocTag{},JSDocClassTag=class extends JSDocTag{},JSDocDeprecatedTag=class extends JSDocTag{},JSDocEnumTag=class extends JSDocTag{},JSDocFunctionTypeBase=SignaturedDeclaration(JSDocType),JSDocFunctionType=class extends JSDocFunctionTypeBase{},JSDocImplementsTag=class extends JSDocTag{},JSDocLink=class extends Node{},JSDocLinkCode=class extends Node{},JSDocLinkPlain=class extends Node{},JSDocMemberName=class extends Node{},JSDocNamepathType=class extends JSDocType{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},JSDocNameReference=class extends Node{getName(){return this._getNodeFromCompilerNode(this.compilerNode.name)}},JSDocNonNullableType=class extends JSDocType{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}isPostfix(){return this.compilerNode.postfix}},JSDocNullableType=class extends JSDocType{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}isPostfix(){return this.compilerNode.postfix}},JSDocOptionalType=class extends JSDocType{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},JSDocOverloadTagBase=JSDocTypeExpressionableTag(JSDocTag),JSDocOverloadTag=class extends JSDocOverloadTagBase{},JSDocOverrideTag=class extends JSDocTag{},JSDocParameterTagBase=JSDocPropertyLikeTag(JSDocTag),JSDocParameterTag=class extends JSDocParameterTagBase{},JSDocPrivateTag=class extends JSDocTag{},JSDocPropertyTagBase=JSDocPropertyLikeTag(JSDocTag),JSDocPropertyTag=class extends JSDocPropertyTagBase{},JSDocProtectedTag=class extends JSDocTag{},JSDocPublicTag=class extends JSDocTag{},JSDocReadonlyTag=class extends JSDocTag{},JSDocReturnTagBase=JSDocTypeExpressionableTag(JSDocTag),JSDocReturnTag=class extends JSDocReturnTagBase{},JSDocSatisfiesTagBase=JSDocTypeExpressionableTag(JSDocTag),JSDocSatisfiesTag=class extends JSDocSatisfiesTagBase{},JSDocSeeTagBase=JSDocTypeExpressionableTag(JSDocTag),JSDocSeeTag=class extends JSDocSeeTagBase{},JSDocSignature=class extends JSDocType{getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}},JSDocTagInfo=class{#compilerObject;constructor(compilerObject){this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getName(){return this.compilerObject.name}getText(){return this.compilerObject.text??[]}},JSDocTemplateTagBase=JSDocTypeParameteredTag(JSDocTag),JSDocTemplateTag=class extends JSDocTemplateTagBase{getConstraint(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.constraint)}getConstraintOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getConstraint(),message??"Expected to find the JS doc template tag's constraint.",this)}},JSDocText=class extends Node{},JSDocThisTagBase=JSDocTypeExpressionableTag(JSDocTag),JSDocThisTag=class extends JSDocThisTagBase{},JSDocThrowsTagBase=JSDocTypeExpressionableTag(JSDocTag),JSDocThrowsTag=class extends JSDocThrowsTagBase{},JSDocTypedefTag=class extends JSDocTag{},JSDocTypeExpression=class extends TypeNode{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},JSDocTypeLiteral=class extends JSDocType{isArrayType(){return this.compilerNode.isArrayType}getPropertyTags(){return this.compilerNode.jsDocPropertyTags?this.compilerNode.jsDocPropertyTags.map(t=>this._getNodeFromCompilerNode(t)):void 0}},JSDocTypeTag=class extends JSDocTag{getTypeExpression(){let node=this.compilerNode.typeExpression;if(!(node!=null&&node.pos===node.end))return this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression)}},JSDocUnknownTag=class extends JSDocTag{},JSDocUnknownType=class extends JSDocType{},JSDocVariadicType=class extends JSDocType{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},CommentEnumMember=class extends Node{remove(){removeChildrenWithFormatting({children:[this],getSiblingFormatting:()=>FormattingKind.Newline})}},createBase$b=ctor=>TextInsertableNode(ModuleChildableNode(JSDocableNode(AmbientableNode(ExportableNode(ModifierableNode(NamedNode(ctor))))))),EnumDeclarationBase=createBase$b(Statement),EnumDeclaration=class extends EnumDeclarationBase{set(structure){return callBaseSet(EnumDeclarationBase.prototype,this,structure),structure.isConst!=null&&this.setIsConstEnum(structure.isConst),structure.members!=null&&(this.getMembers().forEach(m=>m.remove()),this.addMembers(structure.members)),this}addMember(structure){return this.addMembers([structure])[0]}addMembers(structures){return this.insertMembers(this.getMembers().length,structures)}insertMember(index,structure){return this.insertMembers(index,[structure])[0]}insertMembers(index,structures){if(structures.length===0)return[];let members=this.getMembersWithComments();index=verifyAndGetIndex(index,members.length);let writer=this._getWriterWithChildIndentation();return this._context.structurePrinterFactory.forEnumMember().printTexts(writer,structures),insertIntoCommaSeparatedNodes({parent:this.getChildSyntaxListOrThrow(),currentNodes:members,insertIndex:index,newText:writer.toString(),useNewLines:!0,useTrailingCommas:this._context.manipulationSettings.getUseTrailingCommas()}),getNodesToReturn(members,this.getMembersWithComments(),index,!areAllStructuresStructures());function areAllStructuresStructures(){return structures instanceof Array?structures.every(s=>typeof s=="object"):!1}}getMember(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getMembers(),nameOrFindFunction)}getMemberOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getMember(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("enum member",nameOrFindFunction))}getMembers(){return this.compilerNode.members.map(m=>this._getNodeFromCompilerNode(m))}getMembersWithComments(){let compilerNode=this.compilerNode;return ExtendedParser.getContainerArray(compilerNode,this.getSourceFile().compilerNode).map(m=>this._getNodeFromCompilerNode(m))}setIsConstEnum(value){return this.toggleModifier("const",value)}isConstEnum(){return this.getConstKeyword()!=null}getConstKeyword(){return this.getFirstModifierByKind(common.SyntaxKind.ConstKeyword)}getStructure(){return callBaseGetStructure(EnumDeclarationBase.prototype,this,{kind:exports.StructureKind.Enum,isConst:this.isConstEnum(),members:this.getMembers().map(member=>member.getStructure())})}},createBase$a=ctor=>JSDocableNode(InitializerExpressionableNode(PropertyNamedNode(ctor))),EnumMemberBase=createBase$a(Node),EnumMember=class extends EnumMemberBase{getValue(){return this._context.typeChecker.getConstantValue(this)}setValue(value){let text;if(typeof value=="string"){let quoteKind=this._context.manipulationSettings.getQuoteKind();text=quoteKind+common.StringUtils.escapeForWithinString(value,quoteKind)+quoteKind}else text=value.toString();return this.setInitializer(text),this}remove(){let childrenToRemove=[this],commaToken=this.getNextSiblingIfKind(common.SyntaxKind.CommaToken);commaToken!=null&&childrenToRemove.push(commaToken),removeChildrenWithFormatting({children:childrenToRemove,getSiblingFormatting:()=>FormattingKind.Newline})}set(structure){return callBaseSet(EnumMemberBase.prototype,this,structure),structure.value!=null?this.setValue(structure.value):structure.hasOwnProperty(common.nameof(structure,"value"))&&structure.initializer==null&&this.removeInitializer(),this}getStructure(){return callBaseGetStructure(EnumMemberBase.prototype,this,{kind:exports.StructureKind.EnumMember,value:void 0})}},HeritageClause=class extends Node{getTypeNodes(){return this.compilerNode.types?.map(t=>this._getNodeFromCompilerNode(t))??[]}getToken(){return this.compilerNode.token}removeExpression(expressionNodeOrIndex){let expressions=this.getTypeNodes(),expressionNodeToRemove=typeof expressionNodeOrIndex=="number"?getExpressionFromIndex(expressionNodeOrIndex):expressionNodeOrIndex;if(expressions.length===1){let heritageClauses=this.getParentSyntaxListOrThrow().getChildren();heritageClauses.length===1?removeChildren({children:[heritageClauses[0].getParentSyntaxListOrThrow()],removePrecedingSpaces:!0}):removeChildren({children:[this],removePrecedingSpaces:!0})}else removeCommaSeparatedChild(expressionNodeToRemove);return this;function getExpressionFromIndex(index){return expressions[verifyAndGetIndex(index,expressions.length-1)]}}},TypeElement=class extends Node{remove(){removeInterfaceMember(this)}},createBase$9=ctor=>TypeParameteredNode(ChildOrderableNode(JSDocableNode(SignaturedDeclaration(ctor)))),CallSignatureDeclarationBase=createBase$9(TypeElement),CallSignatureDeclaration=class extends CallSignatureDeclarationBase{set(structure){return callBaseSet(CallSignatureDeclarationBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(CallSignatureDeclarationBase.prototype,this,{kind:exports.StructureKind.CallSignature})}},CommentTypeElement=class extends TypeElement{},createBase$8=ctor=>TypeParameteredNode(ChildOrderableNode(JSDocableNode(SignaturedDeclaration(ctor)))),ConstructSignatureDeclarationBase=createBase$8(TypeElement),ConstructSignatureDeclaration=class extends ConstructSignatureDeclarationBase{set(structure){return callBaseSet(ConstructSignatureDeclarationBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(ConstructSignatureDeclarationBase.prototype,this,{kind:exports.StructureKind.ConstructSignature})}},createBase$7=ctor=>ReturnTypedNode(ChildOrderableNode(JSDocableNode(ReadonlyableNode(ModifierableNode(ctor))))),IndexSignatureDeclarationBase=createBase$7(TypeElement),IndexSignatureDeclaration=class extends IndexSignatureDeclarationBase{getKeyName(){return this.getKeyNameNode().getText()}setKeyName(name){common.errors.throwIfWhitespaceOrNotString(name,"name"),this.getKeyName()!==name&&this.getKeyNameNode().replaceWithText(name,this._getWriterWithQueuedChildIndentation())}getKeyNameNode(){let param=this.compilerNode.parameters[0];return this._getNodeFromCompilerNode(param.name)}getKeyType(){return this.getKeyNameNode().getType()}setKeyType(type){common.errors.throwIfWhitespaceOrNotString(type,"type");let keyTypeNode=this.getKeyTypeNode();return keyTypeNode.getText()===type?this:(keyTypeNode.replaceWithText(type,this._getWriterWithQueuedChildIndentation()),this)}getKeyTypeNode(){let param=this.compilerNode.parameters[0];return this._getNodeFromCompilerNode(param.type)}set(structure){return callBaseSet(IndexSignatureDeclarationBase.prototype,this,structure),structure.keyName!=null&&this.setKeyName(structure.keyName),structure.keyType!=null&&this.setKeyType(structure.keyType),this}getStructure(){let keyTypeNode=this.getKeyTypeNode();return callBaseGetStructure(IndexSignatureDeclarationBase.prototype,this,{kind:exports.StructureKind.IndexSignature,keyName:this.getKeyName(),keyType:keyTypeNode.getText()})}},createBase$6=ctor=>TypeElementMemberedNode(TextInsertableNode(ExtendsClauseableNode(HeritageClauseableNode(TypeParameteredNode(JSDocableNode(AmbientableNode(ModuleChildableNode(ExportableNode(ModifierableNode(NamedNode(ctor))))))))))),InterfaceDeclarationBase=createBase$6(Statement),InterfaceDeclaration=class extends InterfaceDeclarationBase{getBaseTypes(){return this.getType().getBaseTypes()}getBaseDeclarations(){return this.getType().getBaseTypes().map(t=>t.getSymbol()?.getDeclarations()??[]).flat()}getImplementations(){return this.getNameNode().getImplementations()}set(structure){return callBaseSet(InterfaceDeclarationBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(InterfaceDeclarationBase.prototype,this,{kind:exports.StructureKind.Interface})}},createBase$5=ctor=>ChildOrderableNode(JSDocableNode(QuestionTokenableNode(TypeParameteredNode(SignaturedDeclaration(PropertyNamedNode(ctor)))))),MethodSignatureBase=createBase$5(TypeElement),MethodSignature=class extends MethodSignatureBase{set(structure){return callBaseSet(MethodSignatureBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(MethodSignatureBase.prototype,this,{kind:exports.StructureKind.MethodSignature})}},createBase$4=ctor=>ChildOrderableNode(JSDocableNode(ReadonlyableNode(QuestionTokenableNode(InitializerExpressionableNode(TypedNode(PropertyNamedNode(ModifierableNode(ctor)))))))),PropertySignatureBase=createBase$4(TypeElement),PropertySignature=class extends PropertySignatureBase{set(structure){return callBaseSet(PropertySignatureBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(PropertySignatureBase.prototype,this,{kind:exports.StructureKind.PropertySignature})}};function JsxAttributedNode(Base){return class extends Base{getAttributes(){return this.compilerNode.attributes.properties.map(p=>this._getNodeFromCompilerNode(p))}getAttributeOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getAttribute(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("attribute",nameOrFindFunction))}getAttribute(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getAttributes(),nameOrFindFunction)}addAttribute(structure){return this.addAttributes([structure])[0]}addAttributes(structures){return this.insertAttributes(this.compilerNode.attributes.properties.length,structures)}insertAttribute(index,structure){return this.insertAttributes(index,[structure])[0]}insertAttributes(index,structures){if(structures.length===0)return[];let originalChildrenCount=this.compilerNode.attributes.properties.length;index=verifyAndGetIndex(index,originalChildrenCount);let insertPos=index===0?this.getTagNameNode().getEnd():this.getAttributes()[index-1].getEnd(),writer=this._getWriterWithQueuedChildIndentation();return new SpaceFormattingStructuresPrinter(this._context.structurePrinterFactory.forJsxAttributeDecider()).printText(writer,structures),insertIntoParentTextRange({insertPos,newText:" "+writer.toString(),parent:this.getNodeProperty("attributes").getFirstChildByKindOrThrow(common.SyntaxKind.SyntaxList)}),getNodesToReturn(originalChildrenCount,this.getAttributes(),index,!1)}set(structure){return callBaseSet(Base.prototype,this,structure),structure.attributes!=null&&(this.getAttributes().forEach(a=>a.remove()),this.addAttributes(structure.attributes)),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{attributes:this.getAttributes().map(a=>a.getStructure())})}}}function JsxTagNamedNode(Base){return class extends Base{getTagNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.tagName)}set(structure){return callBaseSet(Base.prototype,this,structure),structure.name!=null&&this.getTagNameNode().replaceWithText(structure.name),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{name:this.getTagNameNode().getText()})}}}function CommonIdentifierBase(Base){return class extends Base{getText(){return this.compilerNode.text}getDefinitionNodes(){return this.getDefinitions().map(d=>d.getDeclarationNode()).filter(d=>d!=null)}getDefinitions(){return this._context.languageService.getDefinitions(this)}}}var ComputedPropertyNameBase=ExpressionedNode(Node),ComputedPropertyName=class extends ComputedPropertyNameBase{},IdentifierBase=CommonIdentifierBase(ReferenceFindableNode(RenameableNode(PrimaryExpression))),Identifier=class extends IdentifierBase{getImplementations(){return this._context.languageService.getImplementations(this)}},PrivateIdentifierBase=CommonIdentifierBase(ReferenceFindableNode(RenameableNode(Node))),PrivateIdentifier=class extends PrivateIdentifierBase{},QualifiedName=class extends Node{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}getRight(){return this._getNodeFromCompilerNode(this.compilerNode.right)}},JsxAttributeBase=Node,JsxAttribute=class extends JsxAttributeBase{getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}setName(name){return this.getNameNode().replaceWithText(writer=>{typeof name=="object"?this._context.structurePrinterFactory.forJsxNamespacedName().printText(writer,name):writer.write(name)}),this}getInitializerOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getInitializer(),message??`Expected to find an initializer for the JSX attribute '${this.getNameNode().getText()}'`,this)}getInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.initializer)}setInitializer(textOrWriterFunction){let text=getTextFromStringOrWriter(this._getWriterWithQueuedIndentation(),textOrWriterFunction);if(common.StringUtils.isNullOrWhitespace(text))return this.removeInitializer(),this;let initializer=this.getInitializer();return initializer!=null?(initializer.replaceWithText(text),this):(insertIntoParentTextRange({insertPos:this.getNameNode().getEnd(),parent:this,newText:`=${text}`}),this)}removeInitializer(){let initializer=this.getInitializer();return initializer==null?this:(removeChildren({children:[initializer.getPreviousSiblingIfKindOrThrow(common.SyntaxKind.EqualsToken),initializer],removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this)}remove(){removeChildren({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(structure){return callBaseSet(JsxAttributeBase.prototype,this,structure),structure.name!=null&&this.setName(structure.name),structure.initializer!=null?this.setInitializer(structure.initializer):structure.hasOwnProperty(common.nameof(structure,"initializer"))&&this.removeInitializer(),this}getStructure(){let initializer=this.getInitializer(),nameNode=this.getNameNode();return callBaseGetStructure(JsxAttributeBase.prototype,this,{name:nameNode instanceof Identifier?nameNode.getText():nameNode.getStructure(),kind:exports.StructureKind.JsxAttribute,initializer:initializer?.getText()})}},createBase$3=ctor=>JsxTagNamedNode(ctor),JsxClosingElementBase=createBase$3(Node),JsxClosingElement=class extends JsxClosingElementBase{},JsxClosingFragment=class extends Expression{},JsxElementBase=PrimaryExpression,JsxElement=class extends JsxElementBase{getJsxChildren(){return this.compilerNode.children.map(c=>this._getNodeFromCompilerNode(c))}getOpeningElement(){return this._getNodeFromCompilerNode(this.compilerNode.openingElement)}getClosingElement(){return this._getNodeFromCompilerNode(this.compilerNode.closingElement)}setBodyText(textOrWriterFunction){let newText=getBodyText(this._getWriterWithIndentation(),textOrWriterFunction);return setText(this,newText),this}setBodyTextInline(textOrWriterFunction){let writer=this._getWriterWithQueuedChildIndentation();return printTextFromStringOrWriter(writer,textOrWriterFunction),writer.isLastNewLine()&&(writer.setIndentationLevel(Math.max(0,this.getIndentationLevel()-1)),writer.write("")),setText(this,writer.toString()),this}set(structure){if(callBaseSet(JsxElementBase.prototype,this,structure),structure.attributes!=null){let openingElement=this.getOpeningElement();openingElement.getAttributes().forEach(a=>a.remove()),openingElement.addAttributes(structure.attributes)}if(structure.children!=null)throw new common.errors.NotImplementedError("Setting JSX children is currently not implemented. Please open an issue if you need this.");return structure.bodyText!=null?this.setBodyText(structure.bodyText):structure.hasOwnProperty(common.nameof(structure,"bodyText"))&&this.setBodyTextInline(""),structure.name!=null&&(this.getOpeningElement().getTagNameNode().replaceWithText(structure.name),this.getClosingElement().getTagNameNode().replaceWithText(structure.name)),this}getStructure(){let openingElement=this.getOpeningElement(),structure=callBaseGetStructure(JsxElementBase.prototype,this,{kind:exports.StructureKind.JsxElement,name:openingElement.getTagNameNode().getText(),attributes:openingElement.getAttributes().map(a=>a.getStructure()),children:void 0,bodyText:getBodyTextWithoutLeadingIndentation(this)});return delete structure.children,structure}};function setText(element,newText){let openingElement=element.getOpeningElement(),closingElement=element.getClosingElement();insertIntoParentTextRange({insertPos:openingElement.getEnd(),newText,parent:element.getChildSyntaxListOrThrow(),replacing:{textLength:closingElement.getStart()-openingElement.getEnd()}})}var JsxExpressionBase=ExpressionableNode(DotDotDotTokenableNode(Expression)),JsxExpression=class extends JsxExpressionBase{},JsxFragment=class extends PrimaryExpression{getJsxChildren(){return this.compilerNode.children.map(c=>this._getNodeFromCompilerNode(c))}getOpeningFragment(){return this._getNodeFromCompilerNode(this.compilerNode.openingFragment)}getClosingFragment(){return this._getNodeFromCompilerNode(this.compilerNode.closingFragment)}},JsxNamespacedNameBase=Node,JsxNamespacedName=class extends JsxNamespacedNameBase{getNamespaceNode(){return this._getNodeFromCompilerNode(this.compilerNode.namespace)}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}set(structure){return this.getNamespaceNode().replaceWithText(structure.namespace),this.getNameNode().replaceWithText(structure.name),this}getStructure(){return{namespace:this.getNamespaceNode().getText(),name:this.getNameNode().getText()}}},createBase$2=ctor=>JsxAttributedNode(JsxTagNamedNode(ctor)),JsxOpeningElementBase=createBase$2(Expression),JsxOpeningElement=class extends JsxOpeningElementBase{},JsxOpeningFragment=class extends Expression{},createBase$1=ctor=>JsxAttributedNode(JsxTagNamedNode(ctor)),JsxSelfClosingElementBase=createBase$1(PrimaryExpression),JsxSelfClosingElement=class extends JsxSelfClosingElementBase{set(structure){return callBaseSet(JsxSelfClosingElementBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(JsxSelfClosingElementBase.prototype,this,{kind:exports.StructureKind.JsxSelfClosingElement})}},JsxSpreadAttributeBase=ExpressionedNode(Node),JsxSpreadAttribute=class extends JsxSpreadAttributeBase{remove(){removeChildren({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(structure){return callBaseSet(JsxSpreadAttributeBase.prototype,this,structure),structure.expression!=null&&this.setExpression(structure.expression),this}getStructure(){return callBaseGetStructure(JsxSpreadAttributeBase.prototype,this,{kind:exports.StructureKind.JsxSpreadAttribute,expression:this.getExpression().getText()})}},JsxTextBase=LiteralLikeNode(Node),JsxText=class extends JsxTextBase{containsOnlyTriviaWhiteSpaces(){let oldCompilerNode=this.compilerNode;return typeof oldCompilerNode.containsOnlyWhiteSpaces=="boolean"?oldCompilerNode.containsOnlyWhiteSpaces:this.compilerNode.containsOnlyTriviaWhiteSpaces}},BigIntLiteralBase=LiteralExpression,BigIntLiteral=class extends BigIntLiteralBase{getLiteralValue(){let text=this.compilerNode.text;if(typeof BigInt>"u")throw new common.errors.InvalidOperationError("Runtime environment does not support BigInts. Perhaps work with the text instead?");let textWithoutN=text.substring(0,text.length-1);return BigInt(textWithoutN)}setLiteralValue(value){if(typeof value!="bigint")throw new common.errors.ArgumentTypeError("value","bigint",typeof value);return replaceNodeText({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:value.toString()+"n"}),this}},TrueLiteralBase=PrimaryExpression,TrueLiteral=class extends TrueLiteralBase{getLiteralValue(){return getLiteralValue(this)}setLiteralValue(value){return setLiteralValue(this,value)}},FalseLiteralBase=PrimaryExpression,FalseLiteral=class extends FalseLiteralBase{getLiteralValue(){return getLiteralValue(this)}setLiteralValue(value){return setLiteralValue(this,value)}};function setLiteralValue(node,value){if(getLiteralValue(node)===value)return node;let parent=node.getParentSyntaxList()||node.getParentOrThrow(),index=node.getChildIndex();return node.replaceWithText(value?"true":"false"),parent.getChildAtIndex(index)}function getLiteralValue(node){return node.getKind()===common.SyntaxKind.TrueKeyword}var NullLiteralBase=PrimaryExpression,NullLiteral=class extends NullLiteralBase{},NumericLiteralBase=LiteralExpression,NumericLiteral=class extends NumericLiteralBase{getLiteralValue(){let text=this.compilerNode.text;return text.indexOf(".")>=0?parseFloat(text):parseInt(text,10)}setLiteralValue(value){return replaceNodeText({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:value.toString(10)}),this}};exports.QuoteKind=void 0;(function(QuoteKind){QuoteKind.Single="'",QuoteKind.Double='"'})(exports.QuoteKind||(exports.QuoteKind={}));var RegularExpressionLiteralBase=LiteralExpression,RegularExpressionLiteral=class extends RegularExpressionLiteralBase{getLiteralValue(){let pattern=/^\/(.*)\/([^\/]*)$/,text=this.compilerNode.text,matches=pattern.exec(text);return new RegExp(matches[1],matches[2])}setLiteralValue(regExpOrPattern,flags){let pattern;return typeof regExpOrPattern=="string"?pattern=regExpOrPattern:(pattern=regExpOrPattern.source,flags=regExpOrPattern.flags),replaceNodeText({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:`/${pattern}/${flags||""}`}),this}},StringLiteralBase=LiteralExpression,StringLiteral=class extends StringLiteralBase{getLiteralValue(){return this.compilerNode.text}setLiteralValue(value){return replaceNodeText({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:common.StringUtils.escapeForWithinString(value,this.getQuoteKind())}),this}getQuoteKind(){return this.getText()[0]==="'"?exports.QuoteKind.Single:exports.QuoteKind.Double}},NoSubstitutionTemplateLiteralBase=LiteralExpression,NoSubstitutionTemplateLiteral=class extends NoSubstitutionTemplateLiteralBase{getLiteralValue(){return this.compilerNode.text}setLiteralValue(value){let childIndex=this.getChildIndex(),parent=this.getParentSyntaxList()||this.getParentOrThrow();return replaceNodeText({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:value}),parent.getChildAtIndex(childIndex)}},TaggedTemplateExpression=class extends MemberExpression{getTag(){return this._getNodeFromCompilerNode(this.compilerNode.tag)}getTemplate(){return this._getNodeFromCompilerNode(this.compilerNode.template)}removeTag(){let parent=this.getParentSyntaxList()??this.getParentOrThrow(),index=this.getChildIndex(),template=this.getTemplate();return insertIntoParentTextRange({customMappings:(newParent,newSourceFile)=>[{currentNode:template,newNode:newParent.getChildren(newSourceFile)[index]}],parent,insertPos:this.getStart(),newText:this.getTemplate().getText(),replacing:{textLength:this.getWidth(),nodes:[this]}}),parent.getChildAtIndex(index)}},TemplateExpressionBase=PrimaryExpression,TemplateExpression=class extends TemplateExpressionBase{getHead(){return this._getNodeFromCompilerNode(this.compilerNode.head)}getTemplateSpans(){return this.compilerNode.templateSpans.map(s=>this._getNodeFromCompilerNode(s))}setLiteralValue(value){let childIndex=this.getChildIndex(),parent=this.getParentSyntaxList()??this.getParentOrThrow();return replaceNodeText({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:value}),parent.getChildAtIndex(childIndex)}},TemplateHeadBase=LiteralLikeNode(Node),TemplateHead=class extends TemplateHeadBase{},TemplateMiddleBase=LiteralLikeNode(Node),TemplateMiddle=class extends TemplateMiddleBase{},TemplateSpanBase=ExpressionedNode(Node),TemplateSpan=class extends TemplateSpanBase{getLiteral(){return this._getNodeFromCompilerNode(this.compilerNode.literal)}},TemplateTailBase=LiteralLikeNode(Node),TemplateTail=class extends TemplateTailBase{},createBase=ctor=>ExportGetableNode(ExclamationTokenableNode(TypedNode(InitializerExpressionableNode(BindingNamedNode(ctor))))),VariableDeclarationBase=createBase(Node),VariableDeclaration=class extends VariableDeclarationBase{remove(){let parent=this.getParentOrThrow();switch(parent.getKind()){case common.SyntaxKind.VariableDeclarationList:removeFromDeclarationList(this);break;case common.SyntaxKind.CatchClause:removeFromCatchClause(this);break;default:throw new common.errors.NotImplementedError(`Not implemented for syntax kind: ${parent.getKindName()}`)}function removeFromDeclarationList(node){let variableStatement=parent.getParentIfKindOrThrow(common.SyntaxKind.VariableStatement);variableStatement.getDeclarations().length===1?variableStatement.remove():removeCommaSeparatedChild(node)}function removeFromCatchClause(node){removeChildren({children:[node.getPreviousSiblingIfKindOrThrow(common.SyntaxKind.OpenParenToken),node,node.getNextSiblingIfKindOrThrow(common.SyntaxKind.CloseParenToken)],removePrecedingSpaces:!0})}}getVariableStatementOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getVariableStatement(),message??"Expected the grandparent to be a variable statement.",this)}getVariableStatement(){let grandParent=this.getParentOrThrow().getParentOrThrow();return Node.isVariableStatement(grandParent)?grandParent:void 0}set(structure){return callBaseSet(VariableDeclarationBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(VariableDeclarationBase.prototype,this,{kind:exports.StructureKind.VariableDeclaration})}},VariableDeclarationListBase=ModifierableNode(Node),VariableDeclarationList=class extends VariableDeclarationListBase{getDeclarations(){return this.compilerNode.declarations.map(d=>this._getNodeFromCompilerNode(d))}getDeclarationKind(){let nodeFlags=this.compilerNode.flags;return nodeFlags&common.ts.NodeFlags.Let?exports.VariableDeclarationKind.Let:(nodeFlags&common.ts.NodeFlags.AwaitUsing)===common.ts.NodeFlags.AwaitUsing?exports.VariableDeclarationKind.AwaitUsing:(nodeFlags&common.ts.NodeFlags.Using)===common.ts.NodeFlags.Using?exports.VariableDeclarationKind.Using:nodeFlags&common.ts.NodeFlags.Const?exports.VariableDeclarationKind.Const:exports.VariableDeclarationKind.Var}getDeclarationKindKeywords(){let declarationKind=this.getDeclarationKind();switch(declarationKind){case exports.VariableDeclarationKind.Const:return[this.getFirstChildByKindOrThrow(common.SyntaxKind.ConstKeyword)];case exports.VariableDeclarationKind.Let:return[this.getFirstChildByKindOrThrow(common.SyntaxKind.LetKeyword)];case exports.VariableDeclarationKind.Var:return[this.getFirstChildByKindOrThrow(common.SyntaxKind.VarKeyword)];case exports.VariableDeclarationKind.Using:return[this.getFirstChildByKindOrThrow(common.SyntaxKind.UsingKeyword)];case exports.VariableDeclarationKind.AwaitUsing:let awaitKeyword=this.getFirstChildByKindOrThrow(common.SyntaxKind.AwaitKeyword),usingKeyword=awaitKeyword.getNextSiblingIfKindOrThrow(common.SyntaxKind.UsingKeyword);return[awaitKeyword,usingKeyword];default:return common.errors.throwNotImplementedForNeverValueError(declarationKind)}}setDeclarationKind(type){if(this.getDeclarationKind()===type)return this;let keywords=this.getDeclarationKindKeywords(),start=keywords[0].getStart(),end=keywords[keywords.length-1].getEnd();return insertIntoParentTextRange({insertPos:start,newText:type,parent:this,replacing:{textLength:end-start}}),this}addDeclaration(structure){return this.addDeclarations([structure])[0]}addDeclarations(structures){return this.insertDeclarations(this.getDeclarations().length,structures)}insertDeclaration(index,structure){return this.insertDeclarations(index,[structure])[0]}insertDeclarations(index,structures){let writer=this._getWriterWithQueuedChildIndentation(),structurePrinter=new CommaSeparatedStructuresPrinter(this._context.structurePrinterFactory.forVariableDeclaration()),originalChildrenCount=this.compilerNode.declarations.length;return index=verifyAndGetIndex(index,originalChildrenCount),structurePrinter.printText(writer,structures),insertIntoCommaSeparatedNodes({parent:this.getFirstChildByKindOrThrow(common.SyntaxKind.SyntaxList),currentNodes:this.getDeclarations(),insertIndex:index,newText:writer.toString(),useTrailingCommas:!1}),getNodesToReturn(originalChildrenCount,this.getDeclarations(),index,!1)}},Signature=class{#context;#compilerSignature;constructor(context,signature){this.#context=context,this.#compilerSignature=signature}get compilerSignature(){return this.#compilerSignature}getTypeParameters(){return(this.compilerSignature.typeParameters||[]).map(t=>this.#context.compilerFactory.getTypeParameter(t))}getParameters(){return this.compilerSignature.parameters.map(p=>this.#context.compilerFactory.getSymbol(p))}getReturnType(){return this.#context.compilerFactory.getType(this.compilerSignature.getReturnType())}getDocumentationComments(){return this.compilerSignature.getDocumentationComment(this.#context.typeChecker.compilerObject).map(d=>this.#context.compilerFactory.getSymbolDisplayPart(d))}getJsDocTags(){return this.compilerSignature.getJsDocTags().map(t=>this.#context.compilerFactory.getJSDocTagInfo(t))}getDeclaration(){let{compilerFactory}=this.#context,compilerSignatureDeclaration=this.compilerSignature.getDeclaration();return compilerFactory.getNodeFromCompilerNode(compilerSignatureDeclaration,compilerFactory.getSourceFileForNode(compilerSignatureDeclaration))}},Symbol2=class{#context;#compilerSymbol;get compilerSymbol(){return this.#compilerSymbol}constructor(context,symbol){this.#context=context,this.#compilerSymbol=symbol,this.getValueDeclaration(),this.getDeclarations()}getName(){return this.compilerSymbol.getName()}getEscapedName(){return this.compilerSymbol.getEscapedName()}getAliasedSymbolOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getAliasedSymbol(),message??"Expected to find an aliased symbol.")}getImmediatelyAliasedSymbol(){return this.#context.typeChecker.getImmediatelyAliasedSymbol(this)}getImmediatelyAliasedSymbolOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getImmediatelyAliasedSymbol(),message??"Expected to find an immediately aliased symbol.")}getAliasedSymbol(){return this.#context.typeChecker.getAliasedSymbol(this)}getExportSymbol(){return this.#context.typeChecker.getExportSymbolOfSymbol(this)}isAlias(){return(this.getFlags()&common.SymbolFlags.Alias)===common.SymbolFlags.Alias}isOptional(){return(this.getFlags()&common.SymbolFlags.Optional)===common.SymbolFlags.Optional}getFlags(){return this.compilerSymbol.getFlags()}hasFlags(flags){return(this.compilerSymbol.flags&flags)===flags}getValueDeclarationOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getValueDeclaration(),message??(()=>`Expected to find the value declaration of symbol '${this.getName()}'.`))}getValueDeclaration(){let declaration=this.compilerSymbol.valueDeclaration;if(declaration!=null)return this.#context.compilerFactory.getNodeFromCompilerNode(declaration,this.#context.compilerFactory.getSourceFileForNode(declaration))}getDeclarations(){return(this.compilerSymbol.declarations??[]).map(d=>this.#context.compilerFactory.getNodeFromCompilerNode(d,this.#context.compilerFactory.getSourceFileForNode(d)))}getExportOrThrow(name,message){return common.errors.throwIfNullOrUndefined(this.getExport(name),message??(()=>`Expected to find export with name: ${name}`))}getExport(name){if(this.compilerSymbol.exports==null)return;let tsSymbol=this.compilerSymbol.exports.get(common.ts.escapeLeadingUnderscores(name));return tsSymbol==null?void 0:this.#context.compilerFactory.getSymbol(tsSymbol)}getExports(){return this.compilerSymbol.exports==null?[]:Array.from(this.compilerSymbol.exports.values()).map(symbol=>this.#context.compilerFactory.getSymbol(symbol))}getGlobalExportOrThrow(name,message){return common.errors.throwIfNullOrUndefined(this.getGlobalExport(name),message??(()=>`Expected to find global export with name: ${name}`))}getGlobalExport(name){if(this.compilerSymbol.globalExports==null)return;let tsSymbol=this.compilerSymbol.globalExports.get(common.ts.escapeLeadingUnderscores(name));return tsSymbol==null?void 0:this.#context.compilerFactory.getSymbol(tsSymbol)}getGlobalExports(){return this.compilerSymbol.globalExports==null?[]:Array.from(this.compilerSymbol.globalExports.values()).map(symbol=>this.#context.compilerFactory.getSymbol(symbol))}getMemberOrThrow(name,message){return common.errors.throwIfNullOrUndefined(this.getMember(name),message??`Expected to find member with name: ${name}`)}getMember(name){if(this.compilerSymbol.members==null)return;let tsSymbol=this.compilerSymbol.members.get(common.ts.escapeLeadingUnderscores(name));return tsSymbol==null?void 0:this.#context.compilerFactory.getSymbol(tsSymbol)}getMembers(){return this.compilerSymbol.members==null?[]:Array.from(this.compilerSymbol.members.values()).map(symbol=>this.#context.compilerFactory.getSymbol(symbol))}getDeclaredType(){return this.#context.typeChecker.getDeclaredTypeOfSymbol(this)}getTypeAtLocation(node){return this.#context.typeChecker.getTypeOfSymbolAtLocation(this,node)}getFullyQualifiedName(){return this.#context.typeChecker.getFullyQualifiedName(this)}getJsDocTags(){return this.compilerSymbol.getJsDocTags(this.#context.typeChecker.compilerObject).map(info=>new JSDocTagInfo(info))}},TextSpan=class{#compilerObject;constructor(compilerObject){this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getStart(){return this.compilerObject.start}getEnd(){return this.compilerObject.start+this.compilerObject.length}getLength(){return this.compilerObject.length}},TextChange=class{#compilerObject;constructor(compilerObject){this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getSpan(){return new TextSpan(this.compilerObject.span)}getNewText(){return this.compilerObject.newText}};__decorate([common.Memoize],TextChange.prototype,"getSpan",null);var FileTextChanges=class{#context;#compilerObject;#sourceFile;#existingFileExists;#isApplied;constructor(context,compilerObject){this.#context=context,this.#compilerObject=compilerObject;let file=context.compilerFactory.addOrGetSourceFileFromFilePath(context.fileSystemWrapper.getStandardizedAbsolutePath(compilerObject.fileName),{markInProject:!1,scriptKind:void 0});this.#existingFileExists=file!=null,compilerObject.isNewFile||(this.#sourceFile=file)}getFilePath(){return this.#compilerObject.fileName}getSourceFile(){return this.#sourceFile}getTextChanges(){return this.#compilerObject.textChanges.map(c=>new TextChange(c))}applyChanges(options={}){if(this.#isApplied)return;if(this.isNewFile()&&this.#existingFileExists&&!options.overwrite)throw new common.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 file;if(this.isNewFile()?file=this.#context.project.createSourceFile(this.getFilePath(),"",{overwrite:options.overwrite}):file=this.getSourceFile(),file==null)throw new common.errors.InvalidOperationError(`Cannot apply file text change to modify existing file that doesn't exist at path: ${this.getFilePath()}`);return file.applyTextChanges(this.getTextChanges()),file._markAsInProject(),this.#isApplied=!0,this}isNewFile(){return!!this.#compilerObject.isNewFile}};__decorate([common.Memoize],FileTextChanges.prototype,"getTextChanges",null);var CodeAction=class{#context;#compilerObject;constructor(context,compilerObject){this.#context=context,this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getDescription(){return this.compilerObject.description}getChanges(){return this.compilerObject.changes.map(change=>new FileTextChanges(this.#context,change))}},CodeFixAction=class extends CodeAction{getFixName(){return this.compilerObject.fixName}getFixId(){return this.compilerObject.fixId}getFixAllDescription(){return this.compilerObject.fixAllDescription}},CombinedCodeActions=class{#context;#compilerObject;constructor(context,compilerObject){this.#context=context,this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getChanges(){return this.compilerObject.changes.map(change=>new FileTextChanges(this.#context,change))}applyChanges(options){for(let change of this.getChanges())change.applyChanges(options);return this}};__decorate([common.Memoize],CombinedCodeActions.prototype,"getChanges",null);var DocumentSpan=class{_context;_compilerObject;_sourceFile;constructor(context,compilerObject){this._context=context,this._compilerObject=compilerObject,this._sourceFile=this._context.compilerFactory.addOrGetSourceFileFromFilePath(context.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 TextSpan(this.compilerObject.textSpan)}getNode(){let textSpan=this.getTextSpan(),sourceFile=this.getSourceFile(),start=textSpan.getStart(),width=textSpan.getEnd();return findBestMatchingNode();function findBestMatchingNode(){let bestNode;return sourceFile._context.compilerFactory.forgetNodesCreatedInBlock(remember=>{let foundNode,nextNode=sourceFile;for(;nextNode!=null;){if(foundNode==null&&(bestNode=nextNode),nextNode.getStart()===start&&nextNode.getWidth()===width)bestNode=foundNode=nextNode;else if(foundNode!=null)break;nextNode=nextNode.getChildAtPos(start)}bestNode!=null&&remember(bestNode)}),bestNode}}getOriginalTextSpan(){let{originalTextSpan}=this.compilerObject;return originalTextSpan==null?void 0:new TextSpan(originalTextSpan)}getOriginalFileName(){return this.compilerObject.originalFileName}};__decorate([common.Memoize],DocumentSpan.prototype,"getTextSpan",null);__decorate([common.Memoize],DocumentSpan.prototype,"getNode",null);__decorate([common.Memoize],DocumentSpan.prototype,"getOriginalTextSpan",null);var DefinitionInfo=class extends DocumentSpan{constructor(context,compilerObject){super(context,compilerObject),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 start=this.getTextSpan().getStart(),identifier=findIdentifier(this.getSourceFile());return identifier?.getParentOrThrow();function findIdentifier(node){if(node.getKind()===common.SyntaxKind.Identifier&&node.getStart()===start)return node;for(let child of node._getChildrenIterator())if(child.getPos()<=start&&child.getEnd()>start)return findIdentifier(child)}}};__decorate([common.Memoize],DefinitionInfo.prototype,"getDeclarationNode",null);var DiagnosticMessageChain=class _DiagnosticMessageChain{_compilerObject;constructor(compilerObject){this._compilerObject=compilerObject}get compilerObject(){return this._compilerObject}getMessageText(){return this.compilerObject.messageText}getNext(){let next=this.compilerObject.next;if(next!=null)return next instanceof Array?next.map(n=>new _DiagnosticMessageChain(n)):[new _DiagnosticMessageChain(next)]}getCode(){return this.compilerObject.code}getCategory(){return this.compilerObject.category}},Diagnostic=class{_context;_compilerObject;constructor(context,compilerObject){this._context=context,this._compilerObject=compilerObject,this.getSourceFile()}get compilerObject(){return this._compilerObject}getSourceFile(){if(this._context==null)return;let file=this.compilerObject.file;return file==null?void 0:this._context.compilerFactory.getSourceFile(file,{markInProject:!1})}getMessageText(){let messageText=this._compilerObject.messageText;return typeof messageText=="string"?messageText:this._context==null?new DiagnosticMessageChain(messageText):this._context.compilerFactory.getDiagnosticMessageChain(messageText)}getLineNumber(){let sourceFile=this.getSourceFile(),start=this.getStart();if(!(sourceFile==null||start==null))return common.StringUtils.getLineNumberAtPos(sourceFile.getFullText(),start)}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}};__decorate([common.Memoize],Diagnostic.prototype,"getSourceFile",null);var DiagnosticWithLocation=class extends Diagnostic{constructor(context,compilerObject){super(context,compilerObject)}getLineNumber(){return super.getLineNumber()}getStart(){return super.getStart()}getLength(){return super.getLength()}getSourceFile(){return super.getSourceFile()}},OutputFile=class{#compilerObject;#context;constructor(context,compilerObject){this.#compilerObject=compilerObject,this.#context=context}get compilerObject(){return this.#compilerObject}getFilePath(){return this.#context.fileSystemWrapper.getStandardizedAbsolutePath(this.compilerObject.name)}getWriteByteOrderMark(){return this.compilerObject.writeByteOrderMark||!1}getText(){return this.compilerObject.text}},EmitOutput=class{#context;#compilerObject;constructor(context,compilerObject){this.#context=context,this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getDiagnostics(){return this.compilerObject.diagnostics.map(d=>this.#context.compilerFactory.getDiagnostic(d))}getEmitSkipped(){return this.compilerObject.emitSkipped}getOutputFiles(){return this.compilerObject.outputFiles.map(f=>new OutputFile(this.#context,f))}};__decorate([common.Memoize],EmitOutput.prototype,"getDiagnostics",null);__decorate([common.Memoize],EmitOutput.prototype,"getOutputFiles",null);var EmitResult=class{_context;_compilerObject;constructor(context,compilerObject){this._context=context,this._compilerObject=compilerObject,this.getDiagnostics()}get compilerObject(){return this._compilerObject}getEmitSkipped(){return this.compilerObject.emitSkipped}getDiagnostics(){return this.compilerObject.diagnostics.map(d=>this._context.compilerFactory.getDiagnostic(d))}};__decorate([common.Memoize],EmitResult.prototype,"getDiagnostics",null);var ImplementationLocation=class extends DocumentSpan{constructor(context,compilerObject){super(context,compilerObject)}getKind(){return this.compilerObject.kind}getDisplayParts(){return this.compilerObject.displayParts.map(p=>this._context.compilerFactory.getSymbolDisplayPart(p))}};__decorate([common.Memoize],ImplementationLocation.prototype,"getDisplayParts",null);var MemoryEmitResult=class extends EmitResult{#files;constructor(context,compilerObject,files){super(context,compilerObject),this.#files=files}getFiles(){return this.#files}saveFiles(){let fileSystem=this._context.fileSystemWrapper,promises=this.#files.map(f=>fileSystem.writeFile(f.filePath,f.writeByteOrderMark?"\uFEFF"+f.text:f.text));return Promise.all(promises)}saveFilesSync(){let fileSystem=this._context.fileSystemWrapper;for(let file of this.#files)fileSystem.writeFileSync(file.filePath,file.writeByteOrderMark?"\uFEFF"+file.text:file.text)}},RefactorEditInfo=class{#context;#compilerObject;constructor(context,compilerObject){this.#context=context,this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getEdits(){return this.compilerObject.edits.map(edit=>new FileTextChanges(this.#context,edit))}getRenameFilePath(){return this.compilerObject.renameFilename}getRenameLocation(){return this.compilerObject.renameLocation}applyChanges(options){for(let change of this.getEdits())change.applyChanges(options);return this}};__decorate([common.Memoize],RefactorEditInfo.prototype,"getEdits",null);var ReferencedSymbol=class{_context;#compilerObject;#references;constructor(context,compilerObject){this._context=context,this.#compilerObject=compilerObject,this.#references=this.compilerObject.references.map(r=>context.compilerFactory.getReferencedSymbolEntry(r))}get compilerObject(){return this.#compilerObject}getDefinition(){return this._context.compilerFactory.getReferencedSymbolDefinitionInfo(this.compilerObject.definition)}getReferences(){return this.#references}};__decorate([common.Memoize],ReferencedSymbol.prototype,"getDefinition",null);var ReferencedSymbolDefinitionInfo=class extends DefinitionInfo{constructor(context,compilerObject){super(context,compilerObject)}getDisplayParts(){return this.compilerObject.displayParts.map(p=>this._context.compilerFactory.getSymbolDisplayPart(p))}};__decorate([common.Memoize],ReferencedSymbolDefinitionInfo.prototype,"getDisplayParts",null);var ReferenceEntry=class extends DocumentSpan{constructor(context,compilerObject){super(context,compilerObject)}isWriteAccess(){return this.compilerObject.isWriteAccess}isInString(){return this.compilerObject.isInString}},ReferencedSymbolEntry=class extends ReferenceEntry{constructor(context,compilerObject){super(context,compilerObject)}isDefinition(){return this.compilerObject.isDefinition}},RenameLocation=class extends DocumentSpan{getPrefixText(){return this._compilerObject.prefixText}getSuffixText(){return this._compilerObject.suffixText}},SymbolDisplayPart=class{#compilerObject;constructor(compilerObject){this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getText(){return this.compilerObject.text}getKind(){return this.compilerObject.kind}},TypeChecker=class{#context;#getCompilerObject;constructor(context){this.#context=context}get compilerObject(){return this.#getCompilerObject()}_reset(getTypeChecker){this.#getCompilerObject=getTypeChecker}getAmbientModules(){return this.compilerObject.getAmbientModules().map(s=>this.#context.compilerFactory.getSymbol(s))}getApparentType(type){return this.#context.compilerFactory.getType(this.compilerObject.getApparentType(type.compilerType))}getConstantValue(node){return this.compilerObject.getConstantValue(node.compilerNode)}getFullyQualifiedName(symbol){return this.compilerObject.getFullyQualifiedName(symbol.compilerSymbol)}getTypeAtLocation(node){return this.#context.compilerFactory.getType(this.compilerObject.getTypeAtLocation(node.compilerNode))}getContextualType(expression){let contextualType=this.compilerObject.getContextualType(expression.compilerNode);return contextualType==null?void 0:this.#context.compilerFactory.getType(contextualType)}getTypeOfSymbolAtLocation(symbol,node){return this.#context.compilerFactory.getType(this.compilerObject.getTypeOfSymbolAtLocation(symbol.compilerSymbol,node.compilerNode))}getDeclaredTypeOfSymbol(symbol){return this.#context.compilerFactory.getType(this.compilerObject.getDeclaredTypeOfSymbol(symbol.compilerSymbol))}getSymbolAtLocation(node){let compilerSymbol=this.compilerObject.getSymbolAtLocation(node.compilerNode);return compilerSymbol==null?void 0:this.#context.compilerFactory.getSymbol(compilerSymbol)}getAliasedSymbol(symbol){if(!symbol.hasFlags(common.SymbolFlags.Alias))return;let tsAliasSymbol=this.compilerObject.getAliasedSymbol(symbol.compilerSymbol);return tsAliasSymbol==null?void 0:this.#context.compilerFactory.getSymbol(tsAliasSymbol)}getImmediatelyAliasedSymbol(symbol){let tsAliasSymbol=this.compilerObject.getImmediateAliasedSymbol(symbol.compilerSymbol);return tsAliasSymbol==null?void 0:this.#context.compilerFactory.getSymbol(tsAliasSymbol)}getExportSymbolOfSymbol(symbol){return this.#context.compilerFactory.getSymbol(this.compilerObject.getExportSymbolOfSymbol(symbol.compilerSymbol))}getPropertiesOfType(type){return this.compilerObject.getPropertiesOfType(type.compilerType).map(p=>this.#context.compilerFactory.getSymbol(p))}getTypeText(type,enclosingNode,typeFormatFlags){return typeFormatFlags==null&&(typeFormatFlags=this.#getDefaultTypeFormatFlags(enclosingNode)),this.compilerObject.typeToString(type.compilerType,enclosingNode?.compilerNode,typeFormatFlags)}getReturnTypeOfSignature(signature){return this.#context.compilerFactory.getType(this.compilerObject.getReturnTypeOfSignature(signature.compilerSignature))}getSignatureFromNode(node){let signature=this.compilerObject.getSignatureFromDeclaration(node.compilerNode);return signature==null?void 0:this.#context.compilerFactory.getSignature(signature)}getExportsOfModule(moduleSymbol){return(this.compilerObject.getExportsOfModule(moduleSymbol.compilerSymbol)||[]).map(s=>this.#context.compilerFactory.getSymbol(s))}getExportSpecifierLocalTargetSymbol(exportSpecifier){let symbol=this.compilerObject.getExportSpecifierLocalTargetSymbol(exportSpecifier.compilerNode);return symbol==null?void 0:this.#context.compilerFactory.getSymbol(symbol)}getResolvedSignature(node){let resolvedSignature=this.compilerObject.getResolvedSignature(node.compilerNode);if(!(!resolvedSignature||!resolvedSignature.declaration))return this.#context.compilerFactory.getSignature(resolvedSignature)}getResolvedSignatureOrThrow(node,message){return common.errors.throwIfNullOrUndefined(this.getResolvedSignature(node),message??"Signature could not be resolved.",node)}getBaseTypeOfLiteralType(type){return this.#context.compilerFactory.getType(this.compilerObject.getBaseTypeOfLiteralType(type.compilerType))}getSymbolsInScope(node,meaning){return this.compilerObject.getSymbolsInScope(node.compilerNode,meaning).map(s=>this.#context.compilerFactory.getSymbol(s))}getTypeArguments(typeReference){return this.compilerObject.getTypeArguments(typeReference.compilerType).map(arg=>this.#context.compilerFactory.getType(arg))}isTypeAssignableTo(sourceType,targetType){return this.compilerObject.isTypeAssignableTo(sourceType.compilerType,targetType.compilerType)}#getDefaultTypeFormatFlags(enclosingNode){let formatFlags=common.TypeFormatFlags.UseTypeOfFunction|common.TypeFormatFlags.NoTruncation|common.TypeFormatFlags.UseFullyQualifiedType|common.TypeFormatFlags.WriteTypeArgumentsOfSignature;return enclosingNode!=null&&enclosingNode.getKind()===common.SyntaxKind.TypeAliasDeclaration&&(formatFlags|=common.TypeFormatFlags.InTypeAlias),formatFlags}getShorthandAssignmentValueSymbol(node){let symbol=this.compilerObject.getShorthandAssignmentValueSymbol(node.compilerNode);return symbol?this.#context.compilerFactory.getSymbol(symbol):void 0}resolveName(name,location2,meaning,excludeGlobals){let symbol=this.compilerObject.resolveName(name,location2?.compilerNode,meaning,excludeGlobals);return symbol?this.#context.compilerFactory.getSymbol(symbol):void 0}},Program=class{#context;#typeChecker;#createdCompilerObject;#oldProgram;#getOrCreateCompilerObject;#configFileParsingDiagnostics;constructor(opts){this.#context=opts.context,this.#configFileParsingDiagnostics=opts.configFileParsingDiagnostics,this.#typeChecker=new TypeChecker(this.#context),this._reset(opts.rootNames,opts.host)}get compilerObject(){return this.#getOrCreateCompilerObject()}_isCompilerProgramCreated(){return this.#createdCompilerObject!=null}_reset(rootNames,host){let compilerOptions=this.#context.compilerOptions.get();this.#getOrCreateCompilerObject=()=>(this.#createdCompilerObject==null&&(this.#createdCompilerObject=common.ts.createProgram(rootNames,compilerOptions,host,this.#oldProgram,this.#configFileParsingDiagnostics),this.#oldProgram=void 0),this.#createdCompilerObject),this.#createdCompilerObject!=null&&(this.#oldProgram=this.#createdCompilerObject,this.#createdCompilerObject=void 0),this.#typeChecker._reset(()=>this.compilerObject.getTypeChecker())}getTypeChecker(){return this.#typeChecker}async emit(options={}){if(options.writeFile){let message=`Cannot specify a ${common.nameof(options,"writeFile")} option when emitting asynchrously. Use ${common.nameof(this,"emitSync")}() instead.`;throw new common.errors.InvalidOperationError(message)}let{fileSystemWrapper}=this.#context,promises=[],emitResult=this.#emit({writeFile:(filePath,text,writeByteOrderMark)=>{promises.push(fileSystemWrapper.writeFile(fileSystemWrapper.getStandardizedAbsolutePath(filePath),writeByteOrderMark?"\uFEFF"+text:text))},...options});return await Promise.all(promises),new EmitResult(this.#context,emitResult)}emitSync(options={}){return new EmitResult(this.#context,this.#emit(options))}emitToMemory(options={}){let sourceFiles=[],{fileSystemWrapper}=this.#context,emitResult=this.#emit({writeFile:(filePath,text,writeByteOrderMark)=>{sourceFiles.push({filePath:fileSystemWrapper.getStandardizedAbsolutePath(filePath),text,writeByteOrderMark:writeByteOrderMark||!1})},...options});return new MemoryEmitResult(this.#context,emitResult,sourceFiles)}#emit(options={}){let targetSourceFile=options.targetSourceFile!=null?options.targetSourceFile.compilerNode:void 0,{emitOnlyDtsFiles,customTransformers,writeFile}=options;return this.compilerObject.emit(targetSourceFile,writeFile,void 0,emitOnlyDtsFiles,customTransformers)}getSyntacticDiagnostics(sourceFile){return this.compilerObject.getSyntacticDiagnostics(sourceFile?.compilerNode).map(d=>this.#context.compilerFactory.getDiagnosticWithLocation(d))}getSemanticDiagnostics(sourceFile){return this.compilerObject.getSemanticDiagnostics(sourceFile?.compilerNode).map(d=>this.#context.compilerFactory.getDiagnostic(d))}getDeclarationDiagnostics(sourceFile){return this.compilerObject.getDeclarationDiagnostics(sourceFile?.compilerNode).map(d=>this.#context.compilerFactory.getDiagnosticWithLocation(d))}getGlobalDiagnostics(){return this.compilerObject.getGlobalDiagnostics().map(d=>this.#context.compilerFactory.getDiagnostic(d))}getConfigFileParsingDiagnostics(){return this.compilerObject.getConfigFileParsingDiagnostics().map(d=>this.#context.compilerFactory.getDiagnostic(d))}getEmitModuleResolutionKind(){return common.getEmitModuleResolutionKind(this.compilerObject.getCompilerOptions())}isSourceFileFromExternalLibrary(sourceFile){return sourceFile.isFromExternalLibrary()}},LanguageService=class{#compilerObject;#compilerHost;#program;#context;#projectVersion=0;get compilerObject(){return this.#compilerObject}constructor(params){this.#context=params.context;let{languageServiceHost,compilerHost}=common.createHosts({transactionalFileSystem:this.#context.fileSystemWrapper,sourceFileContainer:this.#context.getSourceFileContainer(),compilerOptions:this.#context.compilerOptions,getNewLine:()=>this.#context.manipulationSettings.getNewLineKindAsString(),getProjectVersion:()=>`${this.#projectVersion}`,resolutionHost:params.resolutionHost??{},libFolderPath:params.libFolderPath,skipLoadingLibFiles:params.skipLoadingLibFiles});this.#compilerHost=compilerHost,this.#compilerObject=common.ts.createLanguageService(languageServiceHost,this.#context.compilerFactory.documentRegistry),this.#program=new Program({context:this.#context,rootNames:Array.from(this.#context.compilerFactory.getSourceFilePaths()),host:this.#compilerHost,configFileParsingDiagnostics:params.configFileParsingDiagnostics}),this.#context.compilerFactory.onSourceFileAdded(sourceFile=>{sourceFile._isInProject()&&this._reset()}),this.#context.compilerFactory.onSourceFileRemoved(()=>this._reset())}_reset(){this.#projectVersion+=1,this.#program._reset(Array.from(this.#context.compilerFactory.getSourceFilePaths()),this.#compilerHost)}getProgram(){return this.#program}getDefinitions(node){return this.getDefinitionsAtPosition(node._sourceFile,node.getStart())}getDefinitionsAtPosition(sourceFile,pos){return(this.compilerObject.getDefinitionAtPosition(sourceFile.getFilePath(),pos)||[]).map(info=>this.#context.compilerFactory.getDefinitionInfo(info))}getImplementations(node){return this.getImplementationsAtPosition(node._sourceFile,node.getStart())}getImplementationsAtPosition(sourceFile,pos){return(this.compilerObject.getImplementationAtPosition(sourceFile.getFilePath(),pos)||[]).map(location2=>new ImplementationLocation(this.#context,location2))}findReferences(node){return this.findReferencesAtPosition(node._sourceFile,node.getStart())}findReferencesAsNodes(node){let referencedSymbols=this.findReferences(node);return Array.from(getReferencingNodes());function*getReferencingNodes(){for(let referencedSymbol of referencedSymbols){let isAlias=referencedSymbol.getDefinition().getKind()===common.ts.ScriptElementKind.alias,references=referencedSymbol.getReferences();for(let i=0;i0)&&(yield reference.getNode())}}}}findReferencesAtPosition(sourceFile,pos){return(this.compilerObject.findReferences(sourceFile.getFilePath(),pos)||[]).map(s=>this.#context.compilerFactory.getReferencedSymbol(s))}findRenameLocations(node,options={}){let usePrefixAndSuffixText=options.usePrefixAndSuffixText==null?this.#context.manipulationSettings.getUsePrefixAndSuffixTextForRename():options.usePrefixAndSuffixText;return(this.compilerObject.findRenameLocations(node._sourceFile.getFilePath(),node.getStart(),options.renameInStrings||!1,options.renameInComments||!1,usePrefixAndSuffixText)||[]).map(l=>new RenameLocation(this.#context,l))}getSuggestionDiagnostics(filePathOrSourceFile){let filePath=this.#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile);return this.compilerObject.getSuggestionDiagnostics(filePath).map(d=>this.#context.compilerFactory.getDiagnosticWithLocation(d))}getFormattingEditsForRange(filePath,range,formatSettings){return(this.compilerObject.getFormattingEditsForRange(filePath,range[0],range[1],this.#getFilledSettings(formatSettings))||[]).map(e=>new TextChange(e))}getFormattingEditsForDocument(filePath,formatSettings){let standardizedFilePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePath);return(this.compilerObject.getFormattingEditsForDocument(standardizedFilePath,this.#getFilledSettings(formatSettings))||[]).map(e=>new TextChange(e))}getFormattedDocumentText(filePath,formatSettings){let standardizedFilePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePath),sourceFile=this.#context.compilerFactory.getSourceFileFromCacheFromFilePath(standardizedFilePath);if(sourceFile==null)throw new common.errors.FileNotFoundError(standardizedFilePath);formatSettings=this.#getFilledSettings(formatSettings);let formattingEdits=this.getFormattingEditsForDocument(standardizedFilePath,formatSettings),newText=getTextFromTextChanges(sourceFile,formattingEdits),newLineChar=formatSettings.newLineCharacter;return formatSettings.ensureNewLineAtEndOfFile&&!newText.endsWith(newLineChar)&&(newText+=newLineChar),newText.replace(/\r?\n/g,newLineChar)}getEmitOutput(filePathOrSourceFile,emitOnlyDtsFiles){let filePath=this.#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile),compilerObject=this.compilerObject;return new EmitOutput(this.#context,getCompilerEmitOutput());function getCompilerEmitOutput(){let program=compilerObject.getProgram();return program==null||program.getSourceFile(filePath)==null?{emitSkipped:!0,outputFiles:[],diagnostics:[]}:compilerObject.getEmitOutput(filePath,emitOnlyDtsFiles)}}getIdentationAtPosition(filePathOrSourceFile,position,settings){let filePath=this.#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile);return settings==null?settings=this.#context.manipulationSettings.getEditorSettings():fillDefaultEditorSettings(settings,this.#context.manipulationSettings),this.compilerObject.getIndentationAtPosition(filePath,position,settings)}organizeImports(filePathOrSourceFile,formatSettings={},userPreferences={}){let scope={type:"file",fileName:this.#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile)};return this.compilerObject.organizeImports(scope,this.#getFilledSettings(formatSettings),this.#getFilledUserPreferences(userPreferences)).map(fileTextChanges=>new FileTextChanges(this.#context,fileTextChanges))}getEditsForRefactor(filePathOrSourceFile,formatSettings,positionOrRange,refactorName,actionName,preferences={}){let filePath=this.#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile),position=typeof positionOrRange=="number"?positionOrRange:{pos:positionOrRange.getPos(),end:positionOrRange.getEnd()},compilerObject=this.compilerObject.getEditsForRefactor(filePath,this.#getFilledSettings(formatSettings),position,refactorName,actionName,this.#getFilledUserPreferences(preferences));return compilerObject!=null?new RefactorEditInfo(this.#context,compilerObject):void 0}getCombinedCodeFix(filePathOrSourceFile,fixId,formatSettings={},preferences={}){let compilerResult=this.compilerObject.getCombinedCodeFix({type:"file",fileName:this.#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile)},fixId,this.#getFilledSettings(formatSettings),this.#getFilledUserPreferences(preferences||{}));return new CombinedCodeActions(this.#context,compilerResult)}getCodeFixesAtPosition(filePathOrSourceFile,start,end,errorCodes,formatOptions={},preferences={}){let filePath=this.#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile);return this.compilerObject.getCodeFixesAtPosition(filePath,start,end,errorCodes,this.#getFilledSettings(formatOptions),this.#getFilledUserPreferences(preferences||{})).map(compilerObject=>new CodeFixAction(this.#context,compilerObject))}#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile){let filePath=typeof filePathOrSourceFile=="string"?this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePathOrSourceFile):filePathOrSourceFile.getFilePath();if(!this.#context.compilerFactory.containsSourceFileAtPath(filePath))throw new common.errors.FileNotFoundError(filePath);return filePath}#getFilledSettings(settings){return settings._filled||(settings=Object.assign(this.#context.getFormatCodeSettings(),settings),fillDefaultFormatCodeSettings(settings,this.#context.manipulationSettings),settings._filled=!0),settings}#getFilledUserPreferences(userPreferences){return Object.assign(this.#context.getUserPreferences(),userPreferences)}},Type=class{_context;#compilerType;get compilerType(){return this.#compilerType}constructor(context,type){this._context=context,this.#compilerType=type}getText(enclosingNode,typeFormatFlags){return this._context.typeChecker.getTypeText(this,enclosingNode,typeFormatFlags)}getAliasSymbol(){return this.compilerType.aliasSymbol==null?void 0:this._context.compilerFactory.getSymbol(this.compilerType.aliasSymbol)}getAliasSymbolOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getAliasSymbol(),"Expected to find an alias symbol.")}getAliasTypeArguments(){return(this.compilerType.aliasTypeArguments||[]).map(t=>this._context.compilerFactory.getType(t))}getApparentType(){return this._context.typeChecker.getApparentType(this)}getArrayElementTypeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getArrayElementType(),message??"Expected to find an array element type.")}getArrayElementType(){if(this.isArray())return this.getTypeArguments()[0]}getBaseTypes(){return(this.compilerType.getBaseTypes()||[]).map(t=>this._context.compilerFactory.getType(t))}getBaseTypeOfLiteralType(){return this._context.typeChecker.getBaseTypeOfLiteralType(this)}getCallSignatures(){return this.compilerType.getCallSignatures().map(s=>this._context.compilerFactory.getSignature(s))}getConstructSignatures(){return this.compilerType.getConstructSignatures().map(s=>this._context.compilerFactory.getSignature(s))}getConstraintOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getConstraint(),message??"Expected to find a constraint.")}getConstraint(){let constraint=this.compilerType.getConstraint();return constraint==null?void 0:this._context.compilerFactory.getType(constraint)}getDefaultOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getDefault(),message??"Expected to find a default type.")}getDefault(){let defaultType=this.compilerType.getDefault();return defaultType==null?void 0:this._context.compilerFactory.getType(defaultType)}getProperties(){return this.compilerType.getProperties().map(s=>this._context.compilerFactory.getSymbol(s))}getPropertyOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getProperty(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("symbol property",nameOrFindFunction))}getProperty(nameOrFindFunction){return getSymbolByNameOrFindFunction(this.getProperties(),nameOrFindFunction)}getApparentProperties(){return this.compilerType.getApparentProperties().map(s=>this._context.compilerFactory.getSymbol(s))}getApparentProperty(nameOrFindFunction){return getSymbolByNameOrFindFunction(this.getApparentProperties(),nameOrFindFunction)}isNullable(){return this.getUnionTypes().some(t=>t.isNull()||t.isUndefined())}getNonNullableType(){return this._context.compilerFactory.getType(this.compilerType.getNonNullableType())}getNumberIndexType(){let numberIndexType=this.compilerType.getNumberIndexType();return numberIndexType==null?void 0:this._context.compilerFactory.getType(numberIndexType)}getStringIndexType(){let stringIndexType=this.compilerType.getStringIndexType();return stringIndexType==null?void 0:this._context.compilerFactory.getType(stringIndexType)}getTargetType(){let targetType=this.compilerType.target||void 0;return targetType==null?void 0:this._context.compilerFactory.getType(targetType)}getTargetTypeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getTargetType(),message??"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(t=>this._context.compilerFactory.getType(t)):[]}getIntersectionTypes(){return this.isIntersection()?this.compilerType.types.map(t=>this._context.compilerFactory.getType(t)):[]}getLiteralValue(){return this.compilerType?.value}getLiteralValueOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getLiteralValue(),message??"Type was not a literal type.")}getLiteralFreshType(){let type=this.compilerType?.freshType;return type==null?void 0:this._context.compilerFactory.getType(type)}getLiteralFreshTypeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getLiteralFreshType(),message??"Type was not a literal type.")}getLiteralRegularType(){let type=this.compilerType?.regularType;return type==null?void 0:this._context.compilerFactory.getType(type)}getLiteralRegularTypeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getLiteralRegularType(),message??"Type was not a literal type.")}getSymbol(){let tsSymbol=this.compilerType.getSymbol();return tsSymbol==null?void 0:this._context.compilerFactory.getSymbol(tsSymbol)}getSymbolOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getSymbol(),message??"Expected to find a symbol.")}isAssignableTo(target){return this._context.typeChecker.isTypeAssignableTo(this,target)}isAnonymous(){return this.#hasObjectFlag(common.ObjectFlags.Anonymous)}isAny(){return this.#hasTypeFlag(common.TypeFlags.Any)}isNever(){return this.#hasTypeFlag(common.TypeFlags.Never)}isArray(){let symbol=this.getSymbol();return symbol==null?!1:(symbol.getName()==="Array"||symbol.getName()==="ReadonlyArray")&&this.getTypeArguments().length===1}isReadonlyArray(){let symbol=this.getSymbol();return symbol==null?!1:symbol.getName()==="ReadonlyArray"&&this.getTypeArguments().length===1}isTemplateLiteral(){return this.#hasTypeFlag(common.TypeFlags.TemplateLiteral)}isBoolean(){return this.#hasTypeFlag(common.TypeFlags.Boolean)}isString(){return this.#hasTypeFlag(common.TypeFlags.String)}isNumber(){return this.#hasTypeFlag(common.TypeFlags.Number)}isBigInt(){return this.#hasTypeFlag(common.TypeFlags.BigInt)}isLiteral(){let isBooleanLiteralForTs3_0=this.isBooleanLiteral();return this.compilerType.isLiteral()||isBooleanLiteralForTs3_0}isBooleanLiteral(){return this.#hasTypeFlag(common.TypeFlags.BooleanLiteral)}isBigIntLiteral(){return this.#hasTypeFlag(common.TypeFlags.BigIntLiteral)}isEnumLiteral(){return this.#hasTypeFlag(common.TypeFlags.EnumLiteral)&&!this.isUnion()}isNumberLiteral(){return this.#hasTypeFlag(common.TypeFlags.NumberLiteral)}isStringLiteral(){return this.compilerType.isStringLiteral()}isClass(){return this.compilerType.isClass()}isClassOrInterface(){return this.compilerType.isClassOrInterface()}isEnum(){if(this.#hasTypeFlag(common.TypeFlags.Enum))return!0;if(this.isEnumLiteral()&&!this.isUnion())return!1;let symbol=this.getSymbol();if(symbol==null)return!1;let valueDeclaration=symbol.getValueDeclaration();return valueDeclaration!=null&&Node.isEnumDeclaration(valueDeclaration)}isInterface(){return this.#hasObjectFlag(common.ObjectFlags.Interface)}isObject(){return this.#hasTypeFlag(common.TypeFlags.Object)}isTypeParameter(){return this.compilerType.isTypeParameter()}isTuple(){let targetType=this.getTargetType();return targetType==null?!1:targetType.#hasObjectFlag(common.ObjectFlags.Tuple)}isUnion(){return this.compilerType.isUnion()}isIntersection(){return this.compilerType.isIntersection()}isUnionOrIntersection(){return this.compilerType.isUnionOrIntersection()}isUnknown(){return this.#hasTypeFlag(common.TypeFlags.Unknown)}isNull(){return this.#hasTypeFlag(common.TypeFlags.Null)}isUndefined(){return this.#hasTypeFlag(common.TypeFlags.Undefined)}isVoid(){return this.#hasTypeFlag(common.TypeFlags.Void)}getFlags(){return this.compilerType.flags}getObjectFlags(){return this.isObject()&&this.compilerType.objectFlags||0}#hasTypeFlag(flag){return(this.compilerType.flags&flag)===flag}#hasObjectFlag(flag){return(this.getObjectFlags()&flag)===flag}},TypeParameter=class extends Type{getConstraintOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getConstraint(),message??"Expected type parameter to have a constraint.")}getConstraint(){let declaration=this.#getTypeParameterDeclaration();if(declaration==null)return;let constraintNode=declaration.getConstraint();if(constraintNode!=null)return this._context.typeChecker.getTypeAtLocation(constraintNode)}getDefaultOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getDefault(),message??"Expected type parameter to have a default type.")}getDefault(){let declaration=this.#getTypeParameterDeclaration();if(declaration==null)return;let defaultNode=declaration.getDefault();if(defaultNode!=null)return this._context.typeChecker.getTypeAtLocation(defaultNode)}#getTypeParameterDeclaration(){let symbol=this.getSymbol();if(symbol==null)return;let declaration=symbol.getDeclarations()[0];if(declaration!=null&&Node.isTypeParameterDeclaration(declaration))return declaration}},DirectoryEmitResult=class{#outputFilePaths;#skippedFilePaths;constructor(skippedFilePaths,outputFilePaths){this.#skippedFilePaths=skippedFilePaths,this.#outputFilePaths=outputFilePaths}getSkippedFilePaths(){return this.#skippedFilePaths}getOutputFilePaths(){return this.#outputFilePaths}},Directory=class _Directory{#context;#path;#pathParts;constructor(context,path){this.#context=context,this._setPathInternal(path)}_setPathInternal(path){this.#path=path,this.#pathParts=path.split("/").filter(p=>p.length>0)}get _context(){return this.#throwIfDeletedOrRemoved(),this.#context}isAncestorOf(possibleDescendant){return _Directory.#isAncestorOfDir(this,possibleDescendant)}isDescendantOf(possibleAncestor){return _Directory.#isAncestorOfDir(possibleAncestor,this)}_getDepth(){return this.#pathParts.length}getPath(){return this.#throwIfDeletedOrRemoved(),this.#path}getBaseName(){return this.#pathParts[this.#pathParts.length-1]}getParentOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getParent(),message??(()=>`Parent directory of ${this.getPath()} does not exist or was never added.`))}getParent(){if(!common.FileUtils.isRootDirPath(this.getPath()))return this.addDirectoryAtPathIfExists(common.FileUtils.getDirPath(this.getPath()))}getDirectoryOrThrow(pathOrCondition){return common.errors.throwIfNullOrUndefined(this.getDirectory(pathOrCondition),()=>typeof pathOrCondition=="string"?`Could not find a directory at path '${this._context.fileSystemWrapper.getStandardizedAbsolutePath(pathOrCondition,this.getPath())}'.`:"Could not find child directory that matched condition.")}getDirectory(pathOrCondition){if(typeof pathOrCondition=="string"){let path=this._context.fileSystemWrapper.getStandardizedAbsolutePath(pathOrCondition,this.getPath());return this._context.compilerFactory.getDirectoryFromCache(path)}return this.getDirectories().find(pathOrCondition)}getSourceFileOrThrow(pathOrCondition){return common.errors.throwIfNullOrUndefined(this.getSourceFile(pathOrCondition),()=>typeof pathOrCondition=="string"?`Could not find child source file at path '${this._context.fileSystemWrapper.getStandardizedAbsolutePath(pathOrCondition,this.getPath())}'.`:"Could not find child source file that matched condition.")}getSourceFile(pathOrCondition){if(typeof pathOrCondition=="string"){let path=this._context.fileSystemWrapper.getStandardizedAbsolutePath(pathOrCondition,this.getPath());return this._context.compilerFactory.getSourceFileFromCacheFromFilePath(path)}for(let sourceFile of this._getSourceFilesIterator())if(pathOrCondition(sourceFile))return sourceFile}getDirectories(){return Array.from(this._getDirectoriesIterator())}_getDirectoriesIterator(){return this._context.compilerFactory.getChildDirectoriesOfDirectory(this.getPath())}getSourceFiles(globPatterns){let{compilerFactory,fileSystemWrapper}=this._context,dir=this;if(typeof globPatterns=="string"||globPatterns instanceof Array){let finalGlobPatterns=typeof globPatterns=="string"?[globPatterns]:globPatterns;return Array.from(getFilteredSourceFiles(finalGlobPatterns))}else return Array.from(this._getSourceFilesIterator());function*getFilteredSourceFiles(globPatterns2){let sourceFilePaths=Array.from(getSourceFilePaths()),matchedPaths=common.matchGlobs(sourceFilePaths,globPatterns2,dir.getPath());for(let matchedPath of matchedPaths)yield compilerFactory.getSourceFileFromCacheFromFilePath(fileSystemWrapper.getStandardizedAbsolutePath(matchedPath));function*getSourceFilePaths(){for(let sourceFile of dir._getDescendantSourceFilesIterator())yield sourceFile.getFilePath()}}}_getSourceFilesIterator(){return this._context.compilerFactory.getChildSourceFilesOfDirectory(this.getPath())}getDescendantSourceFiles(){return Array.from(this._getDescendantSourceFilesIterator())}*_getDescendantSourceFilesIterator(){for(let sourceFile of this._getSourceFilesIterator())yield sourceFile;for(let directory of this._getDirectoriesIterator())yield*directory._getDescendantSourceFilesIterator()}getDescendantDirectories(){return Array.from(this._getDescendantDirectoriesIterator())}*_getDescendantDirectoriesIterator(){for(let directory of this.getDirectories())yield directory,yield*directory._getDescendantDirectoriesIterator()}addSourceFilesAtPaths(fileGlobs){return fileGlobs=typeof fileGlobs=="string"?[fileGlobs]:fileGlobs,fileGlobs=fileGlobs.map(g=>common.FileUtils.pathIsAbsolute(g)?g:common.FileUtils.pathJoin(this.getPath(),g)),this._context.directoryCoordinator.addSourceFilesAtPaths(fileGlobs,{markInProject:this._isInProject()})}addDirectoryAtPathIfExists(relativeOrAbsoluteDirPath,options={}){let dirPath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(relativeOrAbsoluteDirPath,this.getPath());return this._context.directoryCoordinator.addDirectoryAtPathIfExists(dirPath,{...options,markInProject:this._isInProject()})}addDirectoryAtPath(relativeOrAbsoluteDirPath,options={}){let dirPath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(relativeOrAbsoluteDirPath,this.getPath());return this._context.directoryCoordinator.addDirectoryAtPath(dirPath,{...options,markInProject:this._isInProject()})}createDirectory(relativeOrAbsoluteDirPath){let dirPath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(relativeOrAbsoluteDirPath,this.getPath());return this._context.directoryCoordinator.createDirectoryOrAddIfExists(dirPath,{markInProject:this._isInProject()})}createSourceFile(relativeFilePath,sourceFileText,options){let filePath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(relativeFilePath,this.getPath());return this._context.compilerFactory.createSourceFile(filePath,sourceFileText||"",{...options||{},markInProject:this._isInProject()})}addSourceFileAtPathIfExists(relativeFilePath){let filePath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(relativeFilePath,this.getPath());return this._context.directoryCoordinator.addSourceFileAtPathIfExists(filePath,{markInProject:this._isInProject()})}addSourceFileAtPath(relativeFilePath){let filePath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(relativeFilePath,this.getPath());return this._context.directoryCoordinator.addSourceFileAtPath(filePath,{markInProject:this._isInProject()})}async emit(options={}){let{fileSystemWrapper}=this._context,writeTasks=[],outputFilePaths=[],skippedFilePaths=[];for(let emitResult of this.#emitInternal(options))isStandardizedFilePath(emitResult)?skippedFilePaths.push(emitResult):(writeTasks.push(fileSystemWrapper.writeFile(emitResult.filePath,emitResult.fileText)),outputFilePaths.push(emitResult.filePath));return await Promise.all(writeTasks),new DirectoryEmitResult(skippedFilePaths,outputFilePaths)}emitSync(options={}){let{fileSystemWrapper}=this._context,outputFilePaths=[],skippedFilePaths=[];for(let emitResult of this.#emitInternal(options))isStandardizedFilePath(emitResult)?skippedFilePaths.push(emitResult):(fileSystemWrapper.writeFileSync(emitResult.filePath,emitResult.fileText),outputFilePaths.push(emitResult.filePath));return new DirectoryEmitResult(skippedFilePaths,outputFilePaths)}#emitInternal(options={}){let{emitOnlyDtsFiles=!1}=options,isJsFile=options.outDir==null?void 0:/\.js$/i,isMapFile=options.outDir==null?void 0:/\.js\.map$/i,isDtsFile=options.declarationDir==null&&options.outDir==null?void 0:/\.d\.ts$/i,getStandardizedPath=path=>path==null?void 0:this._context.fileSystemWrapper.getStandardizedAbsolutePath(path,this.getPath()),getSubDirPath=(path,dir)=>path==null?void 0:common.FileUtils.pathJoin(path,dir.getBaseName()),hasDeclarationDir=this._context.compilerOptions.get().declarationDir!=null||options.declarationDir!=null;return emitDirectory(this,getStandardizedPath(options.outDir),getStandardizedPath(options.declarationDir));function*emitDirectory(directory,outDir,declarationDir){for(let sourceFile of directory.getSourceFiles()){let output=sourceFile.getEmitOutput({emitOnlyDtsFiles});if(output.getEmitSkipped()){yield sourceFile.getFilePath();continue}for(let outputFile of output.getOutputFiles()){let filePath=outputFile.getFilePath(),fileText=outputFile.getWriteByteOrderMark()?common.FileUtils.getTextWithByteOrderMark(outputFile.getText()):outputFile.getText();outDir!=null&&(isJsFile.test(filePath)||isMapFile.test(filePath)||!hasDeclarationDir&&isDtsFile.test(filePath))?filePath=common.FileUtils.pathJoin(outDir,common.FileUtils.getBaseName(filePath)):declarationDir!=null&&isDtsFile.test(filePath)&&(filePath=common.FileUtils.pathJoin(declarationDir,common.FileUtils.getBaseName(filePath))),yield{filePath,fileText}}}for(let dir of directory.getDirectories())yield*emitDirectory(dir,getSubDirPath(outDir,dir),getSubDirPath(declarationDir,dir))}}copyToDirectory(dirPathOrDirectory,options){let dirPath=typeof dirPathOrDirectory=="string"?dirPathOrDirectory:dirPathOrDirectory.getPath();return this.copy(common.FileUtils.pathJoin(dirPath,this.getBaseName()),options)}copy(relativeOrAbsolutePath,options){let originalPath=this.getPath(),fileSystem=this._context.fileSystemWrapper,newPath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(relativeOrAbsolutePath,this.getPath());return originalPath===newPath?this:(options=getDirectoryCopyOptions(options),options.includeUntrackedFiles&&fileSystem.queueCopyDirectory(originalPath,newPath),this.#copyInternal(newPath,options))}async copyImmediately(relativeOrAbsolutePath,options){let fileSystem=this._context.fileSystemWrapper,originalPath=this.getPath(),newPath=fileSystem.getStandardizedAbsolutePath(relativeOrAbsolutePath,originalPath);if(originalPath===newPath)return await this.save(),this;options=getDirectoryCopyOptions(options);let newDir=this.#copyInternal(newPath,options);return options.includeUntrackedFiles&&await fileSystem.copyDirectoryImmediately(originalPath,newPath),await newDir.save(),newDir}copyImmediatelySync(relativeOrAbsolutePath,options){let fileSystem=this._context.fileSystemWrapper,originalPath=this.getPath(),newPath=fileSystem.getStandardizedAbsolutePath(relativeOrAbsolutePath,originalPath);if(originalPath===newPath)return this.saveSync(),this;options=getDirectoryCopyOptions(options);let newDir=this.#copyInternal(newPath,options);return options.includeUntrackedFiles&&fileSystem.copyDirectoryImmediatelySync(originalPath,newPath),newDir.saveSync(),newDir}#copyInternal(newPath,options){if(this.getPath()===newPath)return this;let{fileSystemWrapper:fileSystem,compilerFactory}=this._context,copyingDirectories=[this,...this.getDescendantDirectories()].map(directory=>({newDirPath:directory===this?newPath:fileSystem.getStandardizedAbsolutePath(this.getRelativePathTo(directory),newPath)})),copyingSourceFiles=this.getDescendantSourceFiles().map(sourceFile=>({sourceFile,newFilePath:fileSystem.getStandardizedAbsolutePath(this.getRelativePathTo(sourceFile),newPath),references:this.#getReferencesForCopy(sourceFile)}));for(let{newDirPath}of copyingDirectories)this._context.compilerFactory.createDirectoryOrAddIfExists(newDirPath,{markInProject:this._isInProject()});for(let{sourceFile,newFilePath}of copyingSourceFiles)sourceFile._copyInternal(newFilePath,options);for(let{references,newFilePath}of copyingSourceFiles)this.getSourceFileOrThrow(newFilePath)._updateReferencesForCopyInternal(references);return compilerFactory.getDirectoryFromCache(newPath)}moveToDirectory(dirPathOrDirectory,options){let dirPath=typeof dirPathOrDirectory=="string"?dirPathOrDirectory:dirPathOrDirectory.getPath();return this.move(common.FileUtils.pathJoin(dirPath,this.getBaseName()),options)}move(relativeOrAbsolutePath,options){let fileSystem=this._context.fileSystemWrapper,originalPath=this.getPath(),newPath=fileSystem.getStandardizedAbsolutePath(relativeOrAbsolutePath,originalPath);return originalPath===newPath?this:this.#moveInternal(newPath,options,()=>fileSystem.queueMoveDirectory(originalPath,newPath))}async moveImmediately(relativeOrAbsolutePath,options){let fileSystem=this._context.fileSystemWrapper,originalPath=this.getPath(),newPath=fileSystem.getStandardizedAbsolutePath(relativeOrAbsolutePath,originalPath);return originalPath===newPath?(await this.save(),this):(this.#moveInternal(newPath,options),await fileSystem.moveDirectoryImmediately(originalPath,newPath),await this.save(),this)}moveImmediatelySync(relativeOrAbsolutePath,options){let fileSystem=this._context.fileSystemWrapper,originalPath=this.getPath(),newPath=fileSystem.getStandardizedAbsolutePath(relativeOrAbsolutePath,originalPath);return originalPath===newPath?(this.saveSync(),this):(this.#moveInternal(newPath,options),fileSystem.moveDirectoryImmediatelySync(originalPath,newPath),this.saveSync(),this)}#moveInternal(newPath,options,preAction){let originalPath=this.getPath();if(originalPath===newPath)return this;let existingDir=this._context.compilerFactory.getDirectoryFromCacheOnlyIfInCache(newPath),markInProject=existingDir!=null&&existingDir._isInProject();preAction&&preAction();let fileSystem=this._context.fileSystemWrapper,compilerFactory=this._context.compilerFactory,movingDirectories=[this,...this.getDescendantDirectories()].map(directory=>({directory,oldPath:directory.getPath(),newDirPath:directory===this?newPath:fileSystem.getStandardizedAbsolutePath(this.getRelativePathTo(directory),newPath)})),movingSourceFiles=this.getDescendantSourceFiles().map(sourceFile=>({sourceFile,newFilePath:fileSystem.getStandardizedAbsolutePath(this.getRelativePathTo(sourceFile),newPath),references:this.#getReferencesForMove(sourceFile)}));for(let{directory,oldPath,newDirPath}of movingDirectories){compilerFactory.removeDirectoryFromCache(oldPath);let dirToOverwrite=compilerFactory.getDirectoryFromCache(newDirPath);dirToOverwrite?._forgetOnlyThis(),directory._setPathInternal(newDirPath),compilerFactory.addDirectoryToCache(directory)}for(let{sourceFile,newFilePath}of movingSourceFiles)sourceFile._moveInternal(newFilePath,options);for(let{sourceFile,references}of movingSourceFiles)sourceFile._updateReferencesForMoveInternal(references,originalPath);return markInProject&&this._markAsInProject(),this}clear(){let path=this.getPath();this.#deleteDescendants(),this._context.fileSystemWrapper.queueDirectoryDelete(path),this._context.fileSystemWrapper.queueMkdir(path)}async clearImmediately(){let path=this.getPath();this.#deleteDescendants(),await this._context.fileSystemWrapper.clearDirectoryImmediately(path)}clearImmediatelySync(){let path=this.getPath();this.#deleteDescendants(),this._context.fileSystemWrapper.clearDirectoryImmediatelySync(path)}delete(){let path=this.getPath();this.#deleteDescendants(),this._context.fileSystemWrapper.queueDirectoryDelete(path),this.forget()}#deleteDescendants(){for(let sourceFile of this.getSourceFiles())sourceFile.delete();for(let dir of this.getDirectories())dir.delete()}async deleteImmediately(){let{fileSystemWrapper}=this._context,path=this.getPath();this.forget(),await fileSystemWrapper.deleteDirectoryImmediately(path)}deleteImmediatelySync(){let{fileSystemWrapper}=this._context,path=this.getPath();this.forget(),fileSystemWrapper.deleteDirectoryImmediatelySync(path)}forget(){if(!this.wasForgotten()){for(let sourceFile of this.getSourceFiles())sourceFile.forget();for(let dir of this.getDirectories())dir.forget();this._forgetOnlyThis()}}_forgetOnlyThis(){this.wasForgotten()||(this._context.compilerFactory.removeDirectoryFromCache(this.getPath()),this.#context=void 0)}async save(){await this._context.fileSystemWrapper.saveForDirectory(this.getPath());let unsavedSourceFiles=this.getDescendantSourceFiles().filter(s=>!s.isSaved());await Promise.all(unsavedSourceFiles.map(s=>s.save()))}saveSync(){this._context.fileSystemWrapper.saveForDirectorySync(this.getPath()),this.getDescendantSourceFiles().filter(s=>!s.isSaved()).forEach(s=>s.saveSync())}getRelativePathTo(sourceFileDirOrPath){let thisDirectory=this;return common.FileUtils.getRelativePathTo(this.getPath(),getPath());function getPath(){return sourceFileDirOrPath instanceof SourceFile?sourceFileDirOrPath.getFilePath():sourceFileDirOrPath instanceof _Directory?sourceFileDirOrPath.getPath():thisDirectory._context.fileSystemWrapper.getStandardizedAbsolutePath(sourceFileDirOrPath,thisDirectory.getPath())}}getRelativePathAsModuleSpecifierTo(sourceFileDirOrFilePath){let moduleResolution=this._context.program.getEmitModuleResolutionKind(),thisDirectory=this,moduleSpecifier=common.FileUtils.getRelativePathTo(this.getPath(),getPath()).replace(/((\.d\.ts$)|(\.[^/.]+$))/i,"");return moduleSpecifier.startsWith("../")?moduleSpecifier:"./"+moduleSpecifier;function getPath(){return sourceFileDirOrFilePath instanceof SourceFile?getPathForSourceFile(sourceFileDirOrFilePath):sourceFileDirOrFilePath instanceof _Directory?getPathForDirectory(sourceFileDirOrFilePath):getPathForFilePath(thisDirectory._context.fileSystemWrapper.getStandardizedAbsolutePath(sourceFileDirOrFilePath,thisDirectory.getPath()));function getPathForSourceFile(sourceFile){return getPathForFilePath(sourceFile.getFilePath())}function getPathForDirectory(dir){switch(moduleResolution){case common.ModuleResolutionKind.Node10:return dir===thisDirectory?common.FileUtils.pathJoin(dir.getPath(),"index.ts"):dir.getPath();case common.ModuleResolutionKind.Classic:case common.ModuleResolutionKind.Node16:case common.ModuleResolutionKind.NodeNext:case common.ModuleResolutionKind.Bundler:return common.FileUtils.pathJoin(dir.getPath(),"index.ts");default:return common.errors.throwNotImplementedForNeverValueError(moduleResolution)}}function getPathForFilePath(filePath){let dirPath=common.FileUtils.getDirPath(filePath);switch(moduleResolution){case common.ModuleResolutionKind.Node10:return dirPath===thisDirectory.getPath()?filePath:filePath.replace(/\/index?(\.d\.ts|\.ts|\.js)$/i,"");case common.ModuleResolutionKind.Classic:case common.ModuleResolutionKind.Node16:case common.ModuleResolutionKind.NodeNext:case common.ModuleResolutionKind.Bundler:return filePath;default:return common.errors.throwNotImplementedForNeverValueError(moduleResolution)}}}}getProject(){return this._context.project}wasForgotten(){return this.#context==null}_isInProject(){return this._context.inProjectCoordinator.isDirectoryInProject(this)}_markAsInProject(){this._context.inProjectCoordinator.markDirectoryAsInProject(this)}_hasLoadedParent(){return this._context.compilerFactory.containsDirectoryAtPath(common.FileUtils.getDirPath(this.getPath()))}#throwIfDeletedOrRemoved(){if(this.wasForgotten())throw new common.errors.InvalidOperationError("Cannot use a directory that was deleted, removed, or overwritten.")}#getReferencesForCopy(sourceFile){return sourceFile._getReferencesForCopyInternal().filter(r=>!this.isAncestorOf(r[1]))}#getReferencesForMove(sourceFile){let{literalReferences,referencingLiterals}=sourceFile._getReferencesForMoveInternal();return{literalReferences:literalReferences.filter(r=>!this.isAncestorOf(r[1])),referencingLiterals:referencingLiterals.filter(l=>!this.isAncestorOf(l._sourceFile))}}static#isAncestorOfDir(ancestor,descendant){if(descendant instanceof SourceFile&&(descendant=descendant.getDirectory(),ancestor===descendant))return!0;if(ancestor.#pathParts.length>=descendant.#pathParts.length)return!1;for(let i=ancestor.#pathParts.length-1;i>=0;i--)if(ancestor.#pathParts[i]!==descendant.#pathParts[i])return!1;return!0}};function getDirectoryCopyOptions(options){return options=common.ObjectUtils.clone(options||{}),setValueIfUndefined(options,"includeUntrackedFiles",!0),options}function isStandardizedFilePath(filePath){return typeof filePath=="string"}var DirectoryCoordinator=class{#fileSystemWrapper;#compilerFactory;constructor(compilerFactory,fileSystemWrapper){this.#compilerFactory=compilerFactory,this.#fileSystemWrapper=fileSystemWrapper}addDirectoryAtPathIfExists(dirPath,options){let directory=this.#compilerFactory.getDirectoryFromPath(dirPath,options);if(directory!=null){if(options.recursive)for(let descendantDirPath of common.FileUtils.getDescendantDirectories(this.#fileSystemWrapper,dirPath))this.#compilerFactory.createDirectoryOrAddIfExists(descendantDirPath,options);return directory}}addDirectoryAtPath(dirPath,options){let directory=this.addDirectoryAtPathIfExists(dirPath,options);if(directory==null)throw new common.errors.DirectoryNotFoundError(dirPath);return directory}createDirectoryOrAddIfExists(dirPath,options){return this.#compilerFactory.createDirectoryOrAddIfExists(dirPath,options)}addSourceFileAtPathIfExists(filePath,options){return this.#compilerFactory.addOrGetSourceFileFromFilePath(filePath,{markInProject:options.markInProject,scriptKind:void 0})}addSourceFileAtPath(filePath,options){let sourceFile=this.addSourceFileAtPathIfExists(filePath,options);if(sourceFile==null)throw new common.errors.FileNotFoundError(this.#fileSystemWrapper.getStandardizedAbsolutePath(filePath));return sourceFile}addSourceFilesAtPaths(fileGlobs,options){typeof fileGlobs=="string"&&(fileGlobs=[fileGlobs]);let sourceFiles=[],globbedDirectories=new Set;for(let filePath of this.#fileSystemWrapper.globSync(fileGlobs)){let sourceFile=this.addSourceFileAtPathIfExists(filePath,options);sourceFile!=null&&sourceFiles.push(sourceFile),globbedDirectories.add(common.FileUtils.getDirPath(filePath))}for(let dirPath of common.FileUtils.getParentMostPaths(Array.from(globbedDirectories)))this.addDirectoryAtPathIfExists(dirPath,{recursive:!0,markInProject:options.markInProject});return sourceFiles}},DirectoryCache=class{#context;#directoriesByPath=new common.KeyValueCache;#sourceFilesByDirPath=new common.KeyValueCache;#directoriesByDirPath=new common.KeyValueCache;#orphanDirs=new common.KeyValueCache;constructor(context){this.#context=context}has(dirPath){return this.#directoriesByPath.has(dirPath)}get(dirPath){if(!this.#directoriesByPath.has(dirPath)){for(let orphanDir of this.#orphanDirs.getValues())if(common.FileUtils.pathStartsWith(orphanDir.getPath(),dirPath))return this.createOrAddIfExists(dirPath);return}return this.#directoriesByPath.get(dirPath)}getOrphans(){return this.#orphanDirs.getValues()}getAll(){return this.#directoriesByPath.getValuesAsArray()}*getAllByDepth(){let dirLevels=new common.KeyValueCache,depth=0;for(let orphanDir of this.getOrphans())addToDirLevels(orphanDir);for(depth=Math.min(...Array.from(dirLevels.getKeys()));dirLevels.getSize()>0;){for(let dir of dirLevels.get(depth)||[])yield dir,dir.getDirectories().forEach(addToDirLevels);dirLevels.removeByKey(depth),depth++}function addToDirLevels(dir){let dirDepth=dir._getDepth();if(depth>dirDepth)throw new Error(`For some reason a subdirectory had a lower depth than the parent directory: ${dir.getPath()}`);dirLevels.getOrCreate(dirDepth,()=>[]).push(dir)}}remove(dirPath){this.#removeFromDirectoriesByDirPath(dirPath),this.#directoriesByPath.removeByKey(dirPath),this.#orphanDirs.removeByKey(dirPath)}*getChildDirectoriesOfDirectory(dirPath){let entries=this.#directoriesByDirPath.get(dirPath)?.entries();if(entries!=null)for(let dir of entries)yield dir}*getChildSourceFilesOfDirectory(dirPath){let entries=this.#sourceFilesByDirPath.get(dirPath)?.entries();if(entries!=null)for(let sourceFile of entries)yield sourceFile}addSourceFile(sourceFile){let dirPath=sourceFile.getDirectoryPath();this.createOrAddIfExists(dirPath),this.#sourceFilesByDirPath.getOrCreate(dirPath,()=>new common.SortedKeyValueArray(item=>item.getBaseName(),common.LocaleStringComparer.instance)).set(sourceFile)}removeSourceFile(filePath){let dirPath=common.FileUtils.getDirPath(filePath),sourceFiles=this.#sourceFilesByDirPath.get(dirPath);sourceFiles!=null&&(sourceFiles.removeByKey(common.FileUtils.getBaseName(filePath)),sourceFiles.hasItems()||this.#sourceFilesByDirPath.removeByKey(dirPath))}createOrAddIfExists(dirPath){return this.has(dirPath)?this.get(dirPath):(this.#fillParentsOfDirPath(dirPath),this.#createDirectory(dirPath))}#createDirectory(path){let newDirectory=new Directory(this.#context,path);return this.addDirectory(newDirectory),newDirectory}addDirectory(directory){let path=directory.getPath(),parentDirPath=common.FileUtils.getDirPath(path),isRootDir=parentDirPath===path;for(let orphanDir of this.#orphanDirs.getValues()){let orphanDirPath=orphanDir.getPath(),orphanDirParentPath=common.FileUtils.getDirPath(orphanDirPath);!(orphanDirParentPath===orphanDirPath)&&orphanDirParentPath===path&&this.#orphanDirs.removeByKey(orphanDirPath)}isRootDir||this.#addToDirectoriesByDirPath(directory),this.has(parentDirPath)||this.#orphanDirs.set(path,directory),this.#directoriesByPath.set(path,directory),this.#context.fileSystemWrapper.directoryExistsSync(path)||this.#context.fileSystemWrapper.queueMkdir(path);for(let orphanDir of this.#orphanDirs.getValues())directory.isAncestorOf(orphanDir)&&this.#fillParentsOfDirPath(orphanDir.getPath())}#addToDirectoriesByDirPath(directory){if(common.FileUtils.isRootDirPath(directory.getPath()))return;let parentDirPath=common.FileUtils.getDirPath(directory.getPath());this.#directoriesByDirPath.getOrCreate(parentDirPath,()=>new common.SortedKeyValueArray(item=>item.getBaseName(),common.LocaleStringComparer.instance)).set(directory)}#removeFromDirectoriesByDirPath(dirPath){if(common.FileUtils.isRootDirPath(dirPath))return;let parentDirPath=common.FileUtils.getDirPath(dirPath),directories=this.#directoriesByDirPath.get(parentDirPath);directories!=null&&(directories.removeByKey(common.FileUtils.getBaseName(dirPath)),directories.hasItems()||this.#directoriesByDirPath.removeByKey(parentDirPath))}#fillParentsOfDirPath(dirPath){let passedDirPaths=[],parentDir=common.FileUtils.getDirPath(dirPath);for(;dirPath!==parentDir;){if(dirPath=parentDir,parentDir=common.FileUtils.getDirPath(dirPath),this.#directoriesByPath.has(dirPath)){for(let currentDirPath of passedDirPaths)this.#createDirectory(currentDirPath);break}passedDirPaths.unshift(dirPath)}}},ForgetfulNodeCache=class extends common.KeyValueCache{#forgetStack=[];getOrCreate(key,createFunc){return super.getOrCreate(key,()=>{let node=createFunc();return this.#forgetStack.length>0&&this.#forgetStack[this.#forgetStack.length-1].add(node),node})}setForgetPoint(){this.#forgetStack.push(new Set)}forgetLastPoint(){let nodes=this.#forgetStack.pop();nodes!=null&&this.#forgetNodes(nodes.values())}rememberNode(node){if(node.wasForgotten())throw new common.errors.InvalidOperationError("Cannot remember a node that was removed or forgotten.");let wasInForgetStack=!1;for(let stackItem of this.#forgetStack)if(stackItem.delete(node)){wasInForgetStack=!0;break}return wasInForgetStack&&this.#rememberParentOfNode(node),wasInForgetStack}#rememberParentOfNode(node){let parent=node.getParentSyntaxList()||node.getParent();parent!=null&&this.rememberNode(parent)}#forgetNodes(nodes){for(let node of nodes)node.wasForgotten()||node.getKind()===common.SyntaxKind.SourceFile||node._forgetOnlyThis()}},kindToWrapperMappings={[common.SyntaxKind.SourceFile]:SourceFile,[common.SyntaxKind.ArrayBindingPattern]:ArrayBindingPattern,[common.SyntaxKind.ArrayLiteralExpression]:ArrayLiteralExpression,[common.SyntaxKind.ArrayType]:ArrayTypeNode,[common.SyntaxKind.ArrowFunction]:ArrowFunction,[common.SyntaxKind.AsExpression]:AsExpression,[common.SyntaxKind.AwaitExpression]:AwaitExpression,[common.SyntaxKind.BigIntLiteral]:BigIntLiteral,[common.SyntaxKind.BindingElement]:BindingElement,[common.SyntaxKind.BinaryExpression]:BinaryExpression,[common.SyntaxKind.Block]:Block,[common.SyntaxKind.BreakStatement]:BreakStatement,[common.SyntaxKind.CallExpression]:CallExpression,[common.SyntaxKind.CallSignature]:CallSignatureDeclaration,[common.SyntaxKind.CaseBlock]:CaseBlock,[common.SyntaxKind.CaseClause]:CaseClause,[common.SyntaxKind.CatchClause]:CatchClause,[common.SyntaxKind.ClassDeclaration]:ClassDeclaration,[common.SyntaxKind.ClassExpression]:ClassExpression,[common.SyntaxKind.ClassStaticBlockDeclaration]:ClassStaticBlockDeclaration,[common.SyntaxKind.ConditionalType]:ConditionalTypeNode,[common.SyntaxKind.Constructor]:ConstructorDeclaration,[common.SyntaxKind.ConstructorType]:ConstructorTypeNode,[common.SyntaxKind.ConstructSignature]:ConstructSignatureDeclaration,[common.SyntaxKind.ContinueStatement]:ContinueStatement,[common.SyntaxKind.CommaListExpression]:CommaListExpression,[common.SyntaxKind.ComputedPropertyName]:ComputedPropertyName,[common.SyntaxKind.ConditionalExpression]:ConditionalExpression,[common.SyntaxKind.DebuggerStatement]:DebuggerStatement,[common.SyntaxKind.Decorator]:Decorator,[common.SyntaxKind.DefaultClause]:DefaultClause,[common.SyntaxKind.DeleteExpression]:DeleteExpression,[common.SyntaxKind.DoStatement]:DoStatement,[common.SyntaxKind.ElementAccessExpression]:ElementAccessExpression,[common.SyntaxKind.EmptyStatement]:EmptyStatement,[common.SyntaxKind.EnumDeclaration]:EnumDeclaration,[common.SyntaxKind.EnumMember]:EnumMember,[common.SyntaxKind.ExportAssignment]:ExportAssignment,[common.SyntaxKind.ExportDeclaration]:ExportDeclaration,[common.SyntaxKind.ExportSpecifier]:ExportSpecifier,[common.SyntaxKind.ExpressionWithTypeArguments]:ExpressionWithTypeArguments,[common.SyntaxKind.ExpressionStatement]:ExpressionStatement,[common.SyntaxKind.ExternalModuleReference]:ExternalModuleReference,[common.SyntaxKind.QualifiedName]:QualifiedName,[common.SyntaxKind.ForInStatement]:ForInStatement,[common.SyntaxKind.ForOfStatement]:ForOfStatement,[common.SyntaxKind.ForStatement]:ForStatement,[common.SyntaxKind.FunctionDeclaration]:FunctionDeclaration,[common.SyntaxKind.FunctionExpression]:FunctionExpression,[common.SyntaxKind.FunctionType]:FunctionTypeNode,[common.SyntaxKind.GetAccessor]:GetAccessorDeclaration,[common.SyntaxKind.HeritageClause]:HeritageClause,[common.SyntaxKind.Identifier]:Identifier,[common.SyntaxKind.IfStatement]:IfStatement,[common.SyntaxKind.ImportClause]:ImportClause,[common.SyntaxKind.ImportDeclaration]:ImportDeclaration,[common.SyntaxKind.ImportEqualsDeclaration]:ImportEqualsDeclaration,[common.SyntaxKind.ImportSpecifier]:ImportSpecifier,[common.SyntaxKind.ImportType]:ImportTypeNode,[common.SyntaxKind.ImportAttribute]:ImportAttribute,[common.SyntaxKind.ImportAttributes]:ImportAttributes,[common.SyntaxKind.IndexedAccessType]:IndexedAccessTypeNode,[common.SyntaxKind.IndexSignature]:IndexSignatureDeclaration,[common.SyntaxKind.InferType]:InferTypeNode,[common.SyntaxKind.InterfaceDeclaration]:InterfaceDeclaration,[common.SyntaxKind.IntersectionType]:IntersectionTypeNode,[common.SyntaxKind.JSDocAllType]:JSDocAllType,[common.SyntaxKind.JSDocAugmentsTag]:JSDocAugmentsTag,[common.SyntaxKind.JSDocAuthorTag]:JSDocAuthorTag,[common.SyntaxKind.JSDocCallbackTag]:JSDocCallbackTag,[common.SyntaxKind.JSDocClassTag]:JSDocClassTag,[common.SyntaxKind.JSDocDeprecatedTag]:JSDocDeprecatedTag,[common.SyntaxKind.JSDocEnumTag]:JSDocEnumTag,[common.SyntaxKind.JSDocFunctionType]:JSDocFunctionType,[common.SyntaxKind.JSDocImplementsTag]:JSDocImplementsTag,[common.SyntaxKind.JSDocLink]:JSDocLink,[common.SyntaxKind.JSDocLinkCode]:JSDocLinkCode,[common.SyntaxKind.JSDocLinkPlain]:JSDocLinkPlain,[common.SyntaxKind.JSDocMemberName]:JSDocMemberName,[common.SyntaxKind.JSDocNamepathType]:JSDocNamepathType,[common.SyntaxKind.JSDocNameReference]:JSDocNameReference,[common.SyntaxKind.JSDocNonNullableType]:JSDocNonNullableType,[common.SyntaxKind.JSDocNullableType]:JSDocNullableType,[common.SyntaxKind.JSDocOptionalType]:JSDocOptionalType,[common.SyntaxKind.JSDocOverrideTag]:JSDocOverrideTag,[common.SyntaxKind.JSDocParameterTag]:JSDocParameterTag,[common.SyntaxKind.JSDocPrivateTag]:JSDocPrivateTag,[common.SyntaxKind.JSDocPropertyTag]:JSDocPropertyTag,[common.SyntaxKind.JSDocProtectedTag]:JSDocProtectedTag,[common.SyntaxKind.JSDocPublicTag]:JSDocPublicTag,[common.SyntaxKind.JSDocReturnTag]:JSDocReturnTag,[common.SyntaxKind.JSDocReadonlyTag]:JSDocReadonlyTag,[common.SyntaxKind.JSDocThrowsTag]:JSDocThrowsTag,[common.SyntaxKind.JSDocOverloadTag]:JSDocOverloadTag,[common.SyntaxKind.JSDocSatisfiesTag]:JSDocSatisfiesTag,[common.SyntaxKind.JSDocSeeTag]:JSDocSeeTag,[common.SyntaxKind.JSDocSignature]:JSDocSignature,[common.SyntaxKind.JSDocTag]:JSDocUnknownTag,[common.SyntaxKind.JSDocTemplateTag]:JSDocTemplateTag,[common.SyntaxKind.JSDocText]:JSDocText,[common.SyntaxKind.JSDocThisTag]:JSDocThisTag,[common.SyntaxKind.JSDocTypeExpression]:JSDocTypeExpression,[common.SyntaxKind.JSDocTypeLiteral]:JSDocTypeLiteral,[common.SyntaxKind.JSDocTypeTag]:JSDocTypeTag,[common.SyntaxKind.JSDocTypedefTag]:JSDocTypedefTag,[common.SyntaxKind.JSDocUnknownType]:JSDocUnknownType,[common.SyntaxKind.JSDocVariadicType]:JSDocVariadicType,[common.SyntaxKind.JsxAttribute]:JsxAttribute,[common.SyntaxKind.JsxClosingElement]:JsxClosingElement,[common.SyntaxKind.JsxClosingFragment]:JsxClosingFragment,[common.SyntaxKind.JsxElement]:JsxElement,[common.SyntaxKind.JsxExpression]:JsxExpression,[common.SyntaxKind.JsxFragment]:JsxFragment,[common.SyntaxKind.JsxNamespacedName]:JsxNamespacedName,[common.SyntaxKind.JsxOpeningElement]:JsxOpeningElement,[common.SyntaxKind.JsxOpeningFragment]:JsxOpeningFragment,[common.SyntaxKind.JsxSelfClosingElement]:JsxSelfClosingElement,[common.SyntaxKind.JsxSpreadAttribute]:JsxSpreadAttribute,[common.SyntaxKind.JsxText]:JsxText,[common.SyntaxKind.LabeledStatement]:LabeledStatement,[common.SyntaxKind.LiteralType]:LiteralTypeNode,[common.SyntaxKind.MappedType]:MappedTypeNode,[common.SyntaxKind.MetaProperty]:MetaProperty,[common.SyntaxKind.MethodDeclaration]:MethodDeclaration,[common.SyntaxKind.MethodSignature]:MethodSignature,[common.SyntaxKind.ModuleBlock]:ModuleBlock,[common.SyntaxKind.ModuleDeclaration]:ModuleDeclaration,[common.SyntaxKind.NamedExports]:NamedExports,[common.SyntaxKind.NamedImports]:NamedImports,[common.SyntaxKind.NamedTupleMember]:NamedTupleMember,[common.SyntaxKind.NamespaceExport]:NamespaceExport,[common.SyntaxKind.NamespaceImport]:NamespaceImport,[common.SyntaxKind.NewExpression]:NewExpression,[common.SyntaxKind.NonNullExpression]:NonNullExpression,[common.SyntaxKind.NotEmittedStatement]:NotEmittedStatement,[common.SyntaxKind.NoSubstitutionTemplateLiteral]:NoSubstitutionTemplateLiteral,[common.SyntaxKind.NumericLiteral]:NumericLiteral,[common.SyntaxKind.ObjectBindingPattern]:ObjectBindingPattern,[common.SyntaxKind.ObjectLiteralExpression]:ObjectLiteralExpression,[common.SyntaxKind.OmittedExpression]:OmittedExpression,[common.SyntaxKind.Parameter]:ParameterDeclaration,[common.SyntaxKind.ParenthesizedExpression]:ParenthesizedExpression,[common.SyntaxKind.ParenthesizedType]:ParenthesizedTypeNode,[common.SyntaxKind.PartiallyEmittedExpression]:PartiallyEmittedExpression,[common.SyntaxKind.PostfixUnaryExpression]:PostfixUnaryExpression,[common.SyntaxKind.PrefixUnaryExpression]:PrefixUnaryExpression,[common.SyntaxKind.PrivateIdentifier]:PrivateIdentifier,[common.SyntaxKind.PropertyAccessExpression]:PropertyAccessExpression,[common.SyntaxKind.PropertyAssignment]:PropertyAssignment,[common.SyntaxKind.PropertyDeclaration]:PropertyDeclaration,[common.SyntaxKind.PropertySignature]:PropertySignature,[common.SyntaxKind.RegularExpressionLiteral]:RegularExpressionLiteral,[common.SyntaxKind.RestType]:RestTypeNode,[common.SyntaxKind.ReturnStatement]:ReturnStatement,[common.SyntaxKind.SatisfiesExpression]:SatisfiesExpression,[common.SyntaxKind.SetAccessor]:SetAccessorDeclaration,[common.SyntaxKind.ShorthandPropertyAssignment]:ShorthandPropertyAssignment,[common.SyntaxKind.SpreadAssignment]:SpreadAssignment,[common.SyntaxKind.SpreadElement]:SpreadElement,[common.SyntaxKind.StringLiteral]:StringLiteral,[common.SyntaxKind.SwitchStatement]:SwitchStatement,[common.SyntaxKind.SyntaxList]:SyntaxList,[common.SyntaxKind.TaggedTemplateExpression]:TaggedTemplateExpression,[common.SyntaxKind.TemplateExpression]:TemplateExpression,[common.SyntaxKind.TemplateHead]:TemplateHead,[common.SyntaxKind.TemplateLiteralType]:TemplateLiteralTypeNode,[common.SyntaxKind.TemplateMiddle]:TemplateMiddle,[common.SyntaxKind.TemplateSpan]:TemplateSpan,[common.SyntaxKind.TemplateTail]:TemplateTail,[common.SyntaxKind.ThisType]:ThisTypeNode,[common.SyntaxKind.ThrowStatement]:ThrowStatement,[common.SyntaxKind.TryStatement]:TryStatement,[common.SyntaxKind.TupleType]:TupleTypeNode,[common.SyntaxKind.TypeAliasDeclaration]:TypeAliasDeclaration,[common.SyntaxKind.TypeAssertionExpression]:TypeAssertion,[common.SyntaxKind.TypeLiteral]:TypeLiteralNode,[common.SyntaxKind.TypeOperator]:TypeOperatorTypeNode,[common.SyntaxKind.TypeParameter]:TypeParameterDeclaration,[common.SyntaxKind.TypePredicate]:TypePredicateNode,[common.SyntaxKind.TypeQuery]:TypeQueryNode,[common.SyntaxKind.TypeReference]:TypeReferenceNode,[common.SyntaxKind.UnionType]:UnionTypeNode,[common.SyntaxKind.VariableDeclaration]:VariableDeclaration,[common.SyntaxKind.VariableDeclarationList]:VariableDeclarationList,[common.SyntaxKind.VariableStatement]:VariableStatement,[common.SyntaxKind.JSDoc]:JSDoc,[common.SyntaxKind.TypeOfExpression]:TypeOfExpression,[common.SyntaxKind.WhileStatement]:WhileStatement,[common.SyntaxKind.WithStatement]:WithStatement,[common.SyntaxKind.YieldExpression]:YieldExpression,[common.SyntaxKind.SemicolonToken]:Node,[common.SyntaxKind.AnyKeyword]:Expression,[common.SyntaxKind.BooleanKeyword]:Expression,[common.SyntaxKind.FalseKeyword]:FalseLiteral,[common.SyntaxKind.ImportKeyword]:ImportExpression,[common.SyntaxKind.InferKeyword]:Node,[common.SyntaxKind.NeverKeyword]:Node,[common.SyntaxKind.NullKeyword]:NullLiteral,[common.SyntaxKind.NumberKeyword]:Expression,[common.SyntaxKind.ObjectKeyword]:Expression,[common.SyntaxKind.StringKeyword]:Expression,[common.SyntaxKind.SymbolKeyword]:Expression,[common.SyntaxKind.SuperKeyword]:SuperExpression,[common.SyntaxKind.ThisKeyword]:ThisExpression,[common.SyntaxKind.TrueKeyword]:TrueLiteral,[common.SyntaxKind.UndefinedKeyword]:Expression,[common.SyntaxKind.VoidExpression]:VoidExpression},CompilerFactory=class{#context;#sourceFileCacheByFilePath=new Map;#diagnosticCache=new common.WeakCache;#definitionInfoCache=new common.WeakCache;#documentSpanCache=new common.WeakCache;#diagnosticMessageChainCache=new common.WeakCache;#jsDocTagInfoCache=new common.WeakCache;#signatureCache=new common.WeakCache;#symbolCache=new common.WeakCache;#symbolDisplayPartCache=new common.WeakCache;#referencedSymbolEntryCache=new common.WeakCache;#referencedSymbolCache=new common.WeakCache;#referencedSymbolDefinitionInfoCache=new common.WeakCache;#typeCache=new common.WeakCache;#typeParameterCache=new common.WeakCache;#nodeCache=new ForgetfulNodeCache;#directoryCache;#sourceFileAddedEventContainer=new common.EventContainer;#sourceFileRemovedEventContainer=new common.EventContainer;documentRegistry;constructor(context){this.documentRegistry=new common.DocumentRegistry(context.fileSystemWrapper),this.#directoryCache=new DirectoryCache(context),context.compilerOptions.onModified(()=>{let currentSourceFiles=Array.from(this.#sourceFileCacheByFilePath.values());for(let sourceFile of currentSourceFiles)replaceSourceFileForCacheUpdate(sourceFile)}),this.#context=context}*getSourceFilesByDirectoryDepth(){for(let dir of this.getDirectoriesByDepth())yield*dir.getSourceFiles()}getSourceFilePaths(){return this.#sourceFileCacheByFilePath.keys()}getChildDirectoriesOfDirectory(dirPath){return this.#directoryCache.getChildDirectoriesOfDirectory(dirPath)}getChildSourceFilesOfDirectory(dirPath){return this.#directoryCache.getChildSourceFilesOfDirectory(dirPath)}onSourceFileAdded(subscription,subscribe=!0){subscribe?this.#sourceFileAddedEventContainer.subscribe(subscription):this.#sourceFileAddedEventContainer.unsubscribe(subscription)}onSourceFileRemoved(subscription){this.#sourceFileRemovedEventContainer.subscribe(subscription)}createSourceFile(filePath,sourceFileText,options){if(sourceFileText=sourceFileText instanceof Function?getTextFromStringOrWriter(this.#context.createWriter(),sourceFileText):sourceFileText||"",typeof sourceFileText=="string")return this.createSourceFileFromText(filePath,sourceFileText,options);let writer=this.#context.createWriter();return this.#context.structurePrinterFactory.forSourceFile({isAmbient:common.FileUtils.getExtension(filePath)===".d.ts"}).printText(writer,sourceFileText),this.createSourceFileFromText(filePath,writer.toString(),options)}createSourceFileFromText(filePath,sourceText,options){return filePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePath),options.overwrite===!0?this.#createOrOverwriteSourceFileFromText(filePath,sourceText,options):(this.throwIfFileExists(filePath,"Did you mean to provide the overwrite option?"),this.#createSourceFileFromTextInternal(filePath,sourceText,options))}throwIfFileExists(filePath,prefixMessage){if(!(!this.containsSourceFileAtPath(filePath)&&!this.#context.fileSystemWrapper.fileExistsSync(filePath)))throw prefixMessage=prefixMessage==null?"":prefixMessage+" ",new common.errors.InvalidOperationError(`${prefixMessage}A source file already exists at the provided file path: ${filePath}`)}#createOrOverwriteSourceFileFromText(filePath,sourceText,options){filePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePath);let existingSourceFile=this.addOrGetSourceFileFromFilePath(filePath,options);return existingSourceFile!=null?(existingSourceFile.getChildren().forEach(c=>c.forget()),this.replaceCompilerNode(existingSourceFile,this.createCompilerSourceFileFromText(filePath,sourceText,options.scriptKind)),existingSourceFile):this.#createSourceFileFromTextInternal(filePath,sourceText,options)}getSourceFileFromCacheFromFilePath(filePath){return filePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePath),this.#sourceFileCacheByFilePath.get(filePath)}addOrGetSourceFileFromFilePath(filePath,options){filePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePath);let sourceFile=this.#sourceFileCacheByFilePath.get(filePath);if(sourceFile==null){let fileText=this.#context.fileSystemWrapper.readFileIfExistsSync(filePath,this.#context.getEncoding());fileText!=null&&(this.#context.logger.log(`Loaded file: ${filePath}`),sourceFile=this.#createSourceFileFromTextInternal(filePath,fileText,options),sourceFile._setIsSaved(!0))}return sourceFile!=null&&options.markInProject&&sourceFile._markAsInProject(),sourceFile}containsSourceFileAtPath(filePath){return filePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePath),this.#sourceFileCacheByFilePath.has(filePath)}containsDirectoryAtPath(dirPath){return dirPath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(dirPath),this.#directoryCache.has(dirPath)}getSourceFileForNode(compilerNode){let currentNode=compilerNode;for(;currentNode.kind!==common.SyntaxKind.SourceFile;){if(currentNode.parent==null)return;currentNode=currentNode.parent}return this.getSourceFile(currentNode,{markInProject:!1})}hasCompilerNode(compilerNode){return this.#nodeCache.has(compilerNode)}getExistingNodeFromCompilerNode(compilerNode){return this.#nodeCache.get(compilerNode)}getNodeFromCompilerNode(compilerNode,sourceFile){if(compilerNode.kind===common.SyntaxKind.SourceFile)return this.getSourceFile(compilerNode,{markInProject:!1});return this.#nodeCache.getOrCreate(compilerNode,()=>{let node=createNode.call(this);return initializeNode.call(this,node),node});function createNode(){if(isCommentNode(compilerNode))return CommentNodeParser.isCommentStatement(compilerNode)?new CommentStatement(this.#context,compilerNode,sourceFile):CommentNodeParser.isCommentClassElement(compilerNode)?new CommentClassElement(this.#context,compilerNode,sourceFile):CommentNodeParser.isCommentTypeElement(compilerNode)?new CommentTypeElement(this.#context,compilerNode,sourceFile):CommentNodeParser.isCommentObjectLiteralElement(compilerNode)?new CommentObjectLiteralElement(this.#context,compilerNode,sourceFile):CommentNodeParser.isCommentEnumMember(compilerNode)?new CommentEnumMember(this.#context,compilerNode,sourceFile):common.errors.throwNotImplementedForNeverValueError(compilerNode);let ctor=kindToWrapperMappings[compilerNode.kind]||Node;return new ctor(this.#context,compilerNode,sourceFile)}function isCommentNode(node){return node._commentKind!=null}function initializeNode(node){if(compilerNode.parent!=null){let parentNode=this.getNodeFromCompilerNode(compilerNode.parent,sourceFile);parentNode._wrappedChildCount++}let parentSyntaxList=node._getParentSyntaxListIfWrapped();if(parentSyntaxList!=null&&parentSyntaxList._wrappedChildCount++,compilerNode.kind===common.SyntaxKind.SyntaxList){let count=0;for(let _ of node._getChildrenInCacheIterator())count++;node._wrappedChildCount=count}}}#createSourceFileFromTextInternal(filePath,text,options){let hasBom=common.StringUtils.hasBom(text);hasBom&&(text=common.StringUtils.stripBom(text));let sourceFile=this.getSourceFile(this.createCompilerSourceFileFromText(filePath,text,options.scriptKind),options);return hasBom&&(sourceFile._hasBom=!0),sourceFile}createCompilerSourceFileFromText(filePath,text,scriptKind){return this.documentRegistry.createOrUpdateSourceFile(filePath,this.#context.compilerOptions.get(),common.ts.ScriptSnapshot.fromString(text),scriptKind)}getSourceFile(compilerSourceFile,options){let wasAdded=!1,sourceFile=this.#sourceFileCacheByFilePath.get(compilerSourceFile.fileName)??this.#nodeCache.getOrCreate(compilerSourceFile,()=>{let createdSourceFile=new SourceFile(this.#context,compilerSourceFile);return options.markInProject||this.#context.inProjectCoordinator.setSourceFileNotInProject(createdSourceFile),this.#addSourceFileToCache(createdSourceFile),wasAdded=!0,createdSourceFile});return options.markInProject&&sourceFile._markAsInProject(),wasAdded&&this.#sourceFileAddedEventContainer.fire(sourceFile),sourceFile}#addSourceFileToCache(sourceFile){this.#sourceFileCacheByFilePath.set(sourceFile.getFilePath(),sourceFile),this.#context.fileSystemWrapper.removeFileDelete(sourceFile.getFilePath()),this.#directoryCache.addSourceFile(sourceFile)}getDirectoryFromPath(dirPath,options){dirPath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(dirPath);let directory=this.#directoryCache.get(dirPath);return directory==null&&this.#context.fileSystemWrapper.directoryExistsSync(dirPath)&&(directory=this.#directoryCache.createOrAddIfExists(dirPath)),directory!=null&&options.markInProject&&directory._markAsInProject(),directory}createDirectoryOrAddIfExists(dirPath,options){let directory=this.#directoryCache.createOrAddIfExists(dirPath);return directory!=null&&options.markInProject&&directory._markAsInProject(),directory}getDirectoryFromCache(dirPath){return this.#directoryCache.get(dirPath)}getDirectoryFromCacheOnlyIfInCache(dirPath){return this.#directoryCache.has(dirPath)?this.#directoryCache.get(dirPath):void 0}getDirectoriesByDepth(){return this.#directoryCache.getAllByDepth()}getOrphanDirectories(){return this.#directoryCache.getOrphans()}getSymbolDisplayPart(compilerObject){return this.#symbolDisplayPartCache.getOrCreate(compilerObject,()=>new SymbolDisplayPart(compilerObject))}getType(type){return(type.flags&common.TypeFlags.TypeParameter)===common.TypeFlags.TypeParameter?this.getTypeParameter(type):this.#typeCache.getOrCreate(type,()=>new Type(this.#context,type))}getTypeParameter(typeParameter){return this.#typeParameterCache.getOrCreate(typeParameter,()=>new TypeParameter(this.#context,typeParameter))}getSignature(signature){return this.#signatureCache.getOrCreate(signature,()=>new Signature(this.#context,signature))}getSymbol(symbol){return this.#symbolCache.getOrCreate(symbol,()=>new Symbol2(this.#context,symbol))}getDefinitionInfo(compilerObject){return this.#definitionInfoCache.getOrCreate(compilerObject,()=>new DefinitionInfo(this.#context,compilerObject))}getDocumentSpan(compilerObject){return this.#documentSpanCache.getOrCreate(compilerObject,()=>new DocumentSpan(this.#context,compilerObject))}getReferencedSymbolEntry(compilerObject){return this.#referencedSymbolEntryCache.getOrCreate(compilerObject,()=>new ReferencedSymbolEntry(this.#context,compilerObject))}getReferencedSymbol(compilerObject){return this.#referencedSymbolCache.getOrCreate(compilerObject,()=>new ReferencedSymbol(this.#context,compilerObject))}getReferencedSymbolDefinitionInfo(compilerObject){return this.#referencedSymbolDefinitionInfoCache.getOrCreate(compilerObject,()=>new ReferencedSymbolDefinitionInfo(this.#context,compilerObject))}getDiagnostic(diagnostic){return this.#diagnosticCache.getOrCreate(diagnostic,()=>diagnostic.start!=null?new DiagnosticWithLocation(this.#context,diagnostic):new Diagnostic(this.#context,diagnostic))}getDiagnosticWithLocation(diagnostic){return this.#diagnosticCache.getOrCreate(diagnostic,()=>new DiagnosticWithLocation(this.#context,diagnostic))}getDiagnosticMessageChain(compilerObject){return this.#diagnosticMessageChainCache.getOrCreate(compilerObject,()=>new DiagnosticMessageChain(compilerObject))}getJSDocTagInfo(jsDocTagInfo){return this.#jsDocTagInfoCache.getOrCreate(jsDocTagInfo,()=>new JSDocTagInfo(jsDocTagInfo))}replaceCompilerNode(oldNode,newNode){let nodeToReplace=oldNode instanceof Node?oldNode.compilerNode:oldNode,node=oldNode instanceof Node?oldNode:this.#nodeCache.get(oldNode);if(nodeToReplace.kind===common.SyntaxKind.SourceFile&&nodeToReplace.fileName!==newNode.fileName){let sourceFile=node;this.#removeCompilerNodeFromCache(nodeToReplace),sourceFile._replaceCompilerNodeFromFactory(newNode),this.#nodeCache.set(newNode,sourceFile),this.#addSourceFileToCache(sourceFile),this.#sourceFileAddedEventContainer.fire(sourceFile)}else this.#nodeCache.replaceKey(nodeToReplace,newNode),node?._replaceCompilerNodeFromFactory(newNode)}removeNodeFromCache(node){this.#removeCompilerNodeFromCache(node.compilerNode)}#removeCompilerNodeFromCache(compilerNode){if(this.#nodeCache.removeByKey(compilerNode),compilerNode.kind===common.SyntaxKind.SourceFile){let sourceFile=compilerNode,standardizedFilePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(sourceFile.fileName);this.#directoryCache.removeSourceFile(standardizedFilePath);let wrappedSourceFile=this.#sourceFileCacheByFilePath.get(standardizedFilePath);this.#sourceFileCacheByFilePath.delete(standardizedFilePath),this.documentRegistry.removeSourceFile(standardizedFilePath),wrappedSourceFile!=null&&this.#sourceFileRemovedEventContainer.fire(wrappedSourceFile)}}addDirectoryToCache(directory){this.#directoryCache.addDirectory(directory)}removeDirectoryFromCache(dirPath){this.#directoryCache.remove(dirPath)}forgetNodesCreatedInBlock(block){this.#nodeCache.setForgetPoint();let wasPromise=!1,result;try{if(result=block((...nodes)=>{for(let node of nodes)this.#nodeCache.rememberNode(node)}),Node.isNode(result)&&this.#nodeCache.rememberNode(result),isPromise(result))return wasPromise=!0,result.then(value=>(Node.isNode(value)&&this.#nodeCache.rememberNode(value),this.#nodeCache.forgetLastPoint(),value))}finally{wasPromise||this.#nodeCache.forgetLastPoint()}return result;function isPromise(value){return value!=null&&typeof value.then=="function"}}},InProjectCoordinator=class{#compilerFactory;#notInProjectFiles=new Set;constructor(compilerFactory){compilerFactory.onSourceFileRemoved(sourceFile=>{this.#notInProjectFiles.delete(sourceFile)}),this.#compilerFactory=compilerFactory}setSourceFileNotInProject(sourceFile){this.#notInProjectFiles.add(sourceFile),sourceFile._inProject=!1}markSourceFileAsInProject(sourceFile){this.isSourceFileInProject(sourceFile)||(this.#internalMarkSourceFileAsInProject(sourceFile),this.#notInProjectFiles.delete(sourceFile))}markSourceFilesAsInProjectForResolution(){let nodeModulesSearchName="/node_modules/",compilerFactory=this.#compilerFactory,changedSourceFiles=[],unchangedSourceFiles=[];for(let sourceFile of[...this.#notInProjectFiles.values()])shouldMarkInProject(sourceFile)?(this.#internalMarkSourceFileAsInProject(sourceFile),this.#notInProjectFiles.delete(sourceFile),changedSourceFiles.push(sourceFile)):unchangedSourceFiles.push(sourceFile);return{changedSourceFiles,unchangedSourceFiles};function shouldMarkInProject(sourceFile){let filePath=sourceFile.getFilePath(),index=filePath.toLowerCase().lastIndexOf(nodeModulesSearchName);if(index===-1)return!0;let nodeModulesPath=filePath.substring(0,index+nodeModulesSearchName.length-1),nodeModulesDir=compilerFactory.getDirectoryFromCacheOnlyIfInCache(nodeModulesPath);if(nodeModulesDir!=null&&nodeModulesDir._isInProject())return!0;let directory=sourceFile.getDirectory();for(;directory!=null&&directory.getPath()!==nodeModulesPath;){if(directory._isInProject())return!0;directory=compilerFactory.getDirectoryFromCacheOnlyIfInCache(common.FileUtils.getDirPath(directory.getPath()))}return!1}}#internalMarkSourceFileAsInProject(sourceFile){sourceFile._inProject=!0,this.markDirectoryAsInProject(sourceFile.getDirectory())}isSourceFileInProject(sourceFile){return sourceFile._inProject===!0}setDirectoryAndFilesAsNotInProjectForTesting(directory){for(let subDir of directory.getDirectories())this.setDirectoryAndFilesAsNotInProjectForTesting(subDir);for(let file of directory.getSourceFiles())delete file._inProject,this.#notInProjectFiles.add(file);delete directory._inProject}markDirectoryAsInProject(directory){if(this.isDirectoryInProject(directory))return;let inProjectCoordinator=this,compilerFactory=this.#compilerFactory;directory._inProject=!0,markAncestorDirs(directory);function markAncestorDirs(dir){let ancestorDirs=Array.from(getAncestorsUpToOneInProject(dir)),topAncestor=ancestorDirs[ancestorDirs.length-1];if(!(topAncestor==null||!inProjectCoordinator.isDirectoryInProject(topAncestor)))for(let ancestorDir of ancestorDirs)ancestorDir._inProject=!0}function*getAncestorsUpToOneInProject(dir){if(common.FileUtils.isRootDirPath(dir.getPath()))return;let parentDirPath=common.FileUtils.getDirPath(dir.getPath()),parentDir=compilerFactory.getDirectoryFromCacheOnlyIfInCache(parentDirPath);parentDir!=null&&(yield parentDir,inProjectCoordinator.isDirectoryInProject(parentDir)||(yield*getAncestorsUpToOneInProject(parentDir)))}}isDirectoryInProject(directory){return directory._inProject===!0}},StructurePrinterFactory=class{_getFormatCodeSettings;constructor(_getFormatCodeSettings){this._getFormatCodeSettings=_getFormatCodeSettings}getFormatCodeSettings(){return this._getFormatCodeSettings()}forInitializerExpressionableNode(){return new InitializerExpressionableNodeStructurePrinter}forModifierableNode(){return new ModifierableNodeStructurePrinter}forReturnTypedNode(alwaysWrite){return new ReturnTypedNodeStructurePrinter(alwaysWrite)}forTypedNode(separator,alwaysWrite){return new TypedNodeStructurePrinter(separator,alwaysWrite)}forClassDeclaration(options){return new ClassDeclarationStructurePrinter(this,options)}forClassMember(options){return new ClassMemberStructurePrinter(this,options)}forClassStaticBlockDeclaration(){return new ClassStaticBlockDeclarationStructurePrinter(this)}forConstructorDeclaration(options){return new ConstructorDeclarationStructurePrinter(this,options)}forGetAccessorDeclaration(options){return new GetAccessorDeclarationStructurePrinter(this,options)}forMethodDeclaration(options){return new MethodDeclarationStructurePrinter(this,options)}forPropertyDeclaration(){return new PropertyDeclarationStructurePrinter(this)}forSetAccessorDeclaration(options){return new SetAccessorDeclarationStructurePrinter(this,options)}forDecorator(){return new DecoratorStructurePrinter(this)}forJSDoc(){return new JSDocStructurePrinter(this)}forJSDocTag(options){return new JSDocTagStructurePrinter(this,options)}forEnumDeclaration(){return new EnumDeclarationStructurePrinter(this)}forEnumMember(){return new EnumMemberStructurePrinter(this)}forObjectLiteralExpressionProperty(){return new ObjectLiteralExpressionPropertyStructurePrinter(this)}forPropertyAssignment(){return new PropertyAssignmentStructurePrinter(this)}forShorthandPropertyAssignment(){return new ShorthandPropertyAssignmentStructurePrinter(this)}forSpreadAssignment(){return new SpreadAssignmentStructurePrinter(this)}forFunctionDeclaration(options){return new FunctionDeclarationStructurePrinter(this,options)}forParameterDeclaration(){return new ParameterDeclarationStructurePrinter(this)}forCallSignatureDeclaration(){return new CallSignatureDeclarationStructurePrinter(this)}forConstructSignatureDeclaration(){return new ConstructSignatureDeclarationStructurePrinter(this)}forIndexSignatureDeclaration(){return new IndexSignatureDeclarationStructurePrinter(this)}forInterfaceDeclaration(){return new InterfaceDeclarationStructurePrinter(this)}forMethodSignature(){return new MethodSignatureStructurePrinter(this)}forPropertySignature(){return new PropertySignatureStructurePrinter(this)}forTypeElementMemberedNode(){return new TypeElementMemberedNodeStructurePrinter(this)}forTypeElementMember(){return new TypeElementMemberStructurePrinter(this)}forJsxAttributeDecider(){return new JsxAttributeDeciderStructurePrinter(this)}forJsxAttribute(){return new JsxAttributeStructurePrinter(this)}forJsxChildDecider(){return new JsxChildDeciderStructurePrinter(this)}forJsxElement(){return new JsxElementStructurePrinter(this)}forJsxNamespacedName(){return new JsxNamespacedNameStructurePrinter(this)}forJsxSelfClosingElement(){return new JsxSelfClosingElementStructurePrinter(this)}forJsxSpreadAttribute(){return new JsxSpreadAttributeStructurePrinter(this)}forExportAssignment(){return new ExportAssignmentStructurePrinter(this)}forExportDeclaration(){return new ExportDeclarationStructurePrinter(this)}forImportAttribute(){return new ImportAttributeStructurePrinter(this)}forImportDeclaration(){return new ImportDeclarationStructurePrinter(this)}forModuleDeclaration(options){return new ModuleDeclarationStructurePrinter(this,options)}forNamedImportExportSpecifier(){return new NamedImportExportSpecifierStructurePrinter(this)}forSourceFile(options){return new SourceFileStructurePrinter(this,options)}forStatementedNode(options){return new StatementedNodeStructurePrinter(this,options)}forStatement(options){return new StatementStructurePrinter(this,options)}forVariableStatement(){return new VariableStatementStructurePrinter(this)}forTypeAliasDeclaration(){return new TypeAliasDeclarationStructurePrinter(this)}forTypeParameterDeclaration(){return new TypeParameterDeclarationStructurePrinter(this)}forVariableDeclaration(){return new VariableDeclarationStructurePrinter(this)}};__decorate([common.Memoize],StructurePrinterFactory.prototype,"forInitializerExpressionableNode",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forModifierableNode",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forReturnTypedNode",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forTypedNode",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forClassDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forClassMember",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forClassStaticBlockDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forConstructorDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forGetAccessorDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forMethodDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forPropertyDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forSetAccessorDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forDecorator",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJSDoc",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJSDocTag",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forEnumDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forEnumMember",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forObjectLiteralExpressionProperty",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forPropertyAssignment",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forShorthandPropertyAssignment",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forSpreadAssignment",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forFunctionDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forParameterDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forCallSignatureDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forConstructSignatureDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forIndexSignatureDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forInterfaceDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forMethodSignature",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forPropertySignature",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forTypeElementMemberedNode",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forTypeElementMember",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJsxAttributeDecider",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJsxAttribute",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJsxChildDecider",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJsxElement",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJsxNamespacedName",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJsxSelfClosingElement",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJsxSpreadAttribute",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forExportAssignment",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forExportDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forImportAttribute",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forImportDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forModuleDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forNamedImportExportSpecifier",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forSourceFile",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forStatementedNode",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forStatement",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forVariableStatement",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forTypeAliasDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forTypeParameterDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forVariableDeclaration",null);var ProjectContext=class{#languageService;#compilerOptions;#customTypeChecker;#project;get project(){if(this.#project==null)throw new common.errors.InvalidOperationError("This operation is not permitted in this context.");return this.#project}logger=new ConsoleLogger;lazyReferenceCoordinator;directoryCoordinator;fileSystemWrapper;manipulationSettings=new ManipulationSettingsContainer;structurePrinterFactory;compilerFactory;inProjectCoordinator;constructor(params){this.#project=params.project,this.fileSystemWrapper=params.fileSystemWrapper,this.#compilerOptions=params.compilerOptionsContainer,this.compilerFactory=new CompilerFactory(this),this.inProjectCoordinator=new InProjectCoordinator(this.compilerFactory),this.structurePrinterFactory=new StructurePrinterFactory(()=>this.manipulationSettings.getFormatCodeSettings()),this.lazyReferenceCoordinator=new LazyReferenceCoordinator(this.compilerFactory),this.directoryCoordinator=new DirectoryCoordinator(this.compilerFactory,params.fileSystemWrapper),this.#languageService=params.createLanguageService?new LanguageService({context:this,configFileParsingDiagnostics:params.configFileParsingDiagnostics,resolutionHost:params.resolutionHost&¶ms.resolutionHost(this.getModuleResolutionHost(),()=>this.compilerOptions.get()),skipLoadingLibFiles:params.skipLoadingLibFiles,libFolderPath:params.libFolderPath}):void 0,params.typeChecker!=null&&(common.errors.throwIfTrue(params.createLanguageService,"Cannot specify a type checker and create a language service."),this.#customTypeChecker=new TypeChecker(this),this.#customTypeChecker._reset(()=>params.typeChecker))}get compilerOptions(){return this.#compilerOptions}get languageService(){if(this.#languageService==null)throw this.#getToolRequiredError("language service");return this.#languageService}get program(){if(this.#languageService==null)throw this.#getToolRequiredError("program");return this.languageService.getProgram()}get typeChecker(){if(this.#customTypeChecker!=null)return this.#customTypeChecker;if(this.#languageService==null)throw this.#getToolRequiredError("type checker");return this.program.getTypeChecker()}hasLanguageService(){return this.#languageService!=null}getEncoding(){return this.compilerOptions.getEncoding()}getFormatCodeSettings(){return this.manipulationSettings.getFormatCodeSettings()}getUserPreferences(){return this.manipulationSettings.getUserPreferences()}resetProgram(){this.languageService._reset()}createWriter(){let indentationText=this.manipulationSettings.getIndentationText();return new CodeBlockWriter__default.default({newLine:this.manipulationSettings.getNewLineKindAsString(),indentNumberOfSpaces:indentationText===exports.IndentationText.Tab?void 0:indentationText.length,useTabs:indentationText===exports.IndentationText.Tab,useSingleQuote:this.manipulationSettings.getQuoteKind()===exports.QuoteKind.Single})}getPreEmitDiagnostics(sourceFile){return common.ts.getPreEmitDiagnostics(this.program.compilerObject,sourceFile?.compilerNode).map(d=>this.compilerFactory.getDiagnostic(d))}getSourceFileContainer(){return{addOrGetSourceFileFromFilePath:(filePath,opts)=>Promise.resolve(this.compilerFactory.addOrGetSourceFileFromFilePath(filePath,opts)?.compilerNode),addOrGetSourceFileFromFilePathSync:(filePath,opts)=>this.compilerFactory.addOrGetSourceFileFromFilePath(filePath,opts)?.compilerNode,containsDirectoryAtPath:dirPath=>this.compilerFactory.containsDirectoryAtPath(dirPath),containsSourceFileAtPath:filePath=>this.compilerFactory.containsSourceFileAtPath(filePath),getSourceFileFromCacheFromFilePath:filePath=>this.compilerFactory.getSourceFileFromCacheFromFilePath(filePath)?.compilerNode,getSourceFilePaths:()=>this.compilerFactory.getSourceFilePaths(),getSourceFileVersion:sourceFile=>this.compilerFactory.documentRegistry.getSourceFileVersion(sourceFile),getChildDirectoriesOfDirectory:dirPath=>{let result=[];for(let dir of this.compilerFactory.getChildDirectoriesOfDirectory(dirPath))result.push(dir.getPath());return result}}}getModuleResolutionHost(){return common.createModuleResolutionHost({transactionalFileSystem:this.fileSystemWrapper,getEncoding:()=>this.getEncoding(),sourceFileContainer:this.getSourceFileContainer()})}#getToolRequiredError(name){return new common.errors.InvalidOperationError(`A ${name} 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 ${name} should be required for this operation.`)}};__decorate([common.Memoize],ProjectContext.prototype,"getSourceFileContainer",null);__decorate([common.Memoize],ProjectContext.prototype,"getModuleResolutionHost",null);var Project2=class{_context;constructor(options={}){verifyOptions();let fileSystem=getFileSystem(),fileSystemWrapper=new common.TransactionalFileSystem({fileSystem,skipLoadingLibFiles:options.skipLoadingLibFiles,libFolderPath:options.libFolderPath}),tsConfigResolver=options.tsConfigFilePath==null?void 0:new common.TsConfigResolver(fileSystemWrapper,fileSystemWrapper.getStandardizedAbsolutePath(options.tsConfigFilePath),getEncoding()),compilerOptions=getCompilerOptions(),compilerOptionsContainer=new common.CompilerOptionsContainer(options.defaultCompilerOptions);compilerOptionsContainer.set(compilerOptions),this._context=new ProjectContext({project:this,compilerOptionsContainer,fileSystemWrapper,createLanguageService:!0,resolutionHost:options.resolutionHost,configFileParsingDiagnostics:tsConfigResolver?.getErrors()??[],skipLoadingLibFiles:options.skipLoadingLibFiles,libFolderPath:options.libFolderPath}),options.manipulationSettings!=null&&this._context.manipulationSettings.set(options.manipulationSettings),tsConfigResolver!=null&&options.skipAddingFilesFromTsConfig!==!0&&(this.#addSourceFilesForTsConfigResolver(tsConfigResolver,compilerOptions),options.skipFileDependencyResolution||this.resolveSourceFileDependencies());function verifyOptions(){if(options.fileSystem!=null&&options.useInMemoryFileSystem)throw new common.errors.InvalidOperationError("Cannot provide a file system when specifying to use an in-memory file system.")}function getFileSystem(){return options.useInMemoryFileSystem?new common.InMemoryFileSystemHost:options.fileSystem??new common.RealFileSystemHost}function getCompilerOptions(){return{...getTsConfigCompilerOptions(),...options.compilerOptions??{}}}function getTsConfigCompilerOptions(){return tsConfigResolver?.getCompilerOptions()??{}}function getEncoding(){let defaultEncoding="utf-8";return options.compilerOptions!=null?options.compilerOptions.charset??defaultEncoding:defaultEncoding}}get manipulationSettings(){return this._context.manipulationSettings}get compilerOptions(){return this._context.compilerOptions}resolveSourceFileDependencies(){let sourceFiles=new Set,onSourceFileAdded=sourceFile=>sourceFiles.add(sourceFile),{compilerFactory,inProjectCoordinator}=this._context;compilerFactory.onSourceFileAdded(onSourceFileAdded);try{this.getProgram().compilerObject}finally{compilerFactory.onSourceFileAdded(onSourceFileAdded,!1)}let result=inProjectCoordinator.markSourceFilesAsInProjectForResolution();for(let sourceFile of result.changedSourceFiles)sourceFiles.add(sourceFile);for(let sourceFile of result.unchangedSourceFiles)sourceFiles.delete(sourceFile);return Array.from(sourceFiles.values())}addDirectoryAtPathIfExists(dirPath,options={}){return this._context.directoryCoordinator.addDirectoryAtPathIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(dirPath),{...options,markInProject:!0})}addDirectoryAtPath(dirPath,options={}){return this._context.directoryCoordinator.addDirectoryAtPath(this._context.fileSystemWrapper.getStandardizedAbsolutePath(dirPath),{...options,markInProject:!0})}createDirectory(dirPath){return this._context.directoryCoordinator.createDirectoryOrAddIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(dirPath),{markInProject:!0})}getDirectoryOrThrow(dirPath,message){return common.errors.throwIfNullOrUndefined(this.getDirectory(dirPath),message??(()=>`Could not find a directory at the specified path: ${this._context.fileSystemWrapper.getStandardizedAbsolutePath(dirPath)}`))}getDirectory(dirPath){let{compilerFactory}=this._context;return compilerFactory.getDirectoryFromCache(this._context.fileSystemWrapper.getStandardizedAbsolutePath(dirPath))}getDirectories(){return Array.from(this.#getProjectDirectoriesByDirectoryDepth())}getRootDirectories(){let{inProjectCoordinator}=this._context,result=[];for(let dir of this._context.compilerFactory.getOrphanDirectories())for(let inProjectDir of findInProjectDirectories(dir))result.push(inProjectDir);return result;function*findInProjectDirectories(dir){if(inProjectCoordinator.isDirectoryInProject(dir)){yield dir;return}for(let childDir of dir._getDirectoriesIterator())yield*findInProjectDirectories(childDir)}}addSourceFilesAtPaths(fileGlobs){return this._context.directoryCoordinator.addSourceFilesAtPaths(fileGlobs,{markInProject:!0})}addSourceFileAtPathIfExists(filePath){return this._context.directoryCoordinator.addSourceFileAtPathIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(filePath),{markInProject:!0})}addSourceFileAtPath(filePath){return this._context.directoryCoordinator.addSourceFileAtPath(this._context.fileSystemWrapper.getStandardizedAbsolutePath(filePath),{markInProject:!0})}addSourceFilesFromTsConfig(tsConfigFilePath){let resolver=new common.TsConfigResolver(this._context.fileSystemWrapper,this._context.fileSystemWrapper.getStandardizedAbsolutePath(tsConfigFilePath),this._context.getEncoding());return this.#addSourceFilesForTsConfigResolver(resolver,resolver.getCompilerOptions())}#addSourceFilesForTsConfigResolver(tsConfigResolver,compilerOptions){let paths=tsConfigResolver.getPaths(compilerOptions),addedSourceFiles=paths.filePaths.map(p=>this.addSourceFileAtPath(p));for(let dirPath of paths.directoryPaths)this.addDirectoryAtPathIfExists(dirPath);return addedSourceFiles}createSourceFile(filePath,sourceFileText,options){return this._context.compilerFactory.createSourceFile(this._context.fileSystemWrapper.getStandardizedAbsolutePath(filePath),sourceFileText??"",{...options??{},markInProject:!0})}removeSourceFile(sourceFile){let previouslyForgotten=sourceFile.wasForgotten();return sourceFile.forget(),!previouslyForgotten}getSourceFileOrThrow(fileNameOrSearchFunction){let sourceFile=this.getSourceFile(fileNameOrSearchFunction);if(sourceFile!=null)return sourceFile;if(typeof fileNameOrSearchFunction=="string"){let fileNameOrPath=common.FileUtils.standardizeSlashes(fileNameOrSearchFunction);if(common.FileUtils.pathIsAbsolute(fileNameOrPath)||fileNameOrPath.indexOf("/")>=0){let errorFileNameOrPath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(fileNameOrPath);throw new common.errors.InvalidOperationError(`Could not find source file in project at the provided path: ${errorFileNameOrPath}`)}else throw new common.errors.InvalidOperationError(`Could not find source file in project with the provided file name: ${fileNameOrSearchFunction}`)}else throw new common.errors.InvalidOperationError("Could not find source file in project based on the provided condition.")}getSourceFile(fileNameOrSearchFunction){let filePathOrSearchFunction=getFilePathOrSearchFunction(this._context.fileSystemWrapper);if(isStandardizedFilePath2(filePathOrSearchFunction))return this._context.compilerFactory.getSourceFileFromCacheFromFilePath(filePathOrSearchFunction);return common.IterableUtils.find(this.#getProjectSourceFilesByDirectoryDepth(),filePathOrSearchFunction);function getFilePathOrSearchFunction(fileSystemWrapper){if(fileNameOrSearchFunction instanceof Function)return fileNameOrSearchFunction;let fileNameOrPath=common.FileUtils.standardizeSlashes(fileNameOrSearchFunction);return common.FileUtils.pathIsAbsolute(fileNameOrPath)||fileNameOrPath.indexOf("/")>=0?fileSystemWrapper.getStandardizedAbsolutePath(fileNameOrPath):def=>common.FileUtils.pathEndsWith(def.getFilePath(),fileNameOrPath)}function isStandardizedFilePath2(obj){return typeof obj=="string"}}getSourceFiles(globPatterns){let{compilerFactory,fileSystemWrapper}=this._context,sourceFiles=this.#getProjectSourceFilesByDirectoryDepth();if(typeof globPatterns=="string"||globPatterns instanceof Array)return Array.from(getFilteredSourceFiles());return Array.from(sourceFiles);function*getFilteredSourceFiles(){let sourceFilePaths=Array.from(getSourceFilePaths()),matchedPaths=common.matchGlobs(sourceFilePaths,globPatterns,fileSystemWrapper.getCurrentDirectory());for(let matchedPath of matchedPaths)yield compilerFactory.getSourceFileFromCacheFromFilePath(fileSystemWrapper.getStandardizedAbsolutePath(matchedPath));function*getSourceFilePaths(){for(let sourceFile of sourceFiles)yield sourceFile.getFilePath()}}}*#getProjectSourceFilesByDirectoryDepth(){let{compilerFactory,inProjectCoordinator}=this._context;for(let sourceFile of compilerFactory.getSourceFilesByDirectoryDepth())inProjectCoordinator.isSourceFileInProject(sourceFile)&&(yield sourceFile)}*#getProjectDirectoriesByDirectoryDepth(){let{compilerFactory,inProjectCoordinator}=this._context;for(let directory of compilerFactory.getDirectoriesByDepth())inProjectCoordinator.isDirectoryInProject(directory)&&(yield directory)}getAmbientModule(moduleName){return moduleName=normalizeAmbientModuleName(moduleName),this.getAmbientModules().find(s=>s.getName()===moduleName)}getAmbientModuleOrThrow(moduleName,message){return common.errors.throwIfNullOrUndefined(this.getAmbientModule(moduleName),message??(()=>`Could not find ambient module with name: ${normalizeAmbientModuleName(moduleName)}`))}getAmbientModules(){return this.getTypeChecker().getAmbientModules()}async save(){await this._context.fileSystemWrapper.flush(),await Promise.all(this.#getUnsavedSourceFiles().map(f=>f.save()))}saveSync(){this._context.fileSystemWrapper.flushSync();for(let file of this.#getUnsavedSourceFiles())file.saveSync()}enableLogging(enabled=!0){this._context.logger.setEnabled(enabled)}#getUnsavedSourceFiles(){return Array.from(getUnsavedIterator(this._context.compilerFactory.getSourceFilesByDirectoryDepth()));function*getUnsavedIterator(sourceFiles){for(let sourceFile of sourceFiles)sourceFile.isSaved()||(yield sourceFile)}}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(emitOptions={}){return this._context.program.emit(emitOptions)}emitSync(emitOptions={}){return this._context.program.emitSync(emitOptions)}emitToMemory(emitOptions={}){return this._context.program.emitToMemory(emitOptions)}getCompilerOptions(){return this._context.compilerOptions.get()}getConfigFileParsingDiagnostics(){return this.getProgram().getConfigFileParsingDiagnostics()}createWriter(){return this._context.createWriter()}forgetNodesCreatedInBlock(block){return this._context.compilerFactory.forgetNodesCreatedInBlock(block)}formatDiagnosticsWithColorAndContext(diagnostics,opts={}){return common.ts.formatDiagnosticsWithColorAndContext(diagnostics.map(d=>d.compilerObject),{getCurrentDirectory:()=>this._context.fileSystemWrapper.getCurrentDirectory(),getCanonicalFileName:fileName=>fileName,getNewLine:()=>opts.newLineChar??common.runtime.getEndOfLine()})}getModuleResolutionHost(){return this._context.getModuleResolutionHost()}};function normalizeAmbientModuleName(moduleName){return isQuote(moduleName[0])&&isQuote(moduleName[moduleName.length-1])&&(moduleName=moduleName.substring(1,moduleName.length-1)),`"${moduleName}"`;function isQuote(char){return char==='"'||char==="'"}}function createWrappedNode(node,opts={}){let{compilerOptions={},sourceFile,typeChecker}=opts,compilerOptionsContainer=new common.CompilerOptionsContainer;compilerOptionsContainer.set(compilerOptions);let projectContext=new ProjectContext({project:void 0,fileSystemWrapper:new common.TransactionalFileSystem({fileSystem:new common.RealFileSystemHost,skipLoadingLibFiles:!0,libFolderPath:void 0}),compilerOptionsContainer,createLanguageService:!1,typeChecker,configFileParsingDiagnostics:[],skipLoadingLibFiles:!0,libFolderPath:void 0}),wrappedSourceFile=projectContext.compilerFactory.getSourceFile(getSourceFileNode(),{markInProject:!0});return projectContext.compilerFactory.getNodeFromCompilerNode(node,wrappedSourceFile);function getSourceFileNode(){return sourceFile??getSourceFileFromNode(node)}function getSourceFileFromNode(compilerNode){if(compilerNode.kind===common.SyntaxKind.SourceFile)return compilerNode;if(compilerNode.parent==null)throw new common.errors.InvalidOperationError("Please ensure the node was created from a source file with 'setParentNodes' set to 'true'.");let parent=compilerNode;for(;parent.parent!=null;)parent=parent.parent;if(parent.kind!==common.SyntaxKind.SourceFile)throw new common.errors.NotImplementedError("For some reason the top parent was not a source file.");return parent}}var structurePrinterFactory=new StructurePrinterFactory(()=>{throw new common.errors.NotImplementedError("Not implemented scenario for getting code format settings when using a writer function. Please open an issue.")}),Writers=class{constructor(){}static object(obj){return writer=>{let keyNames=Object.keys(obj);writer.write("{"),keyNames.length>0&&writer.indent(()=>{writeObject()}),writer.write("}");function writeObject(){for(let i=0;i0&&writer.write(",").newLine();let keyName=keyNames[i],value=obj[keyName];writer.write(keyName),value!=null&&(writer.write(": "),writeValue(writer,value))}writer.newLine()}}}static objectType(structure){return writer=>{writer.write("{"),anyPropertyHasValue(structure)&&writer.indent(()=>{structurePrinterFactory.forTypeElementMemberedNode().printText(writer,structure)}),writer.write("}")}}static unionType(firstType,secondType,...additionalTypes){return getWriteFunctionForUnionOrIntersectionType("|",[firstType,secondType,...additionalTypes])}static intersectionType(firstType,secondType,...additionalTypes){return getWriteFunctionForUnionOrIntersectionType("&",[firstType,secondType,...additionalTypes])}static assertion(type,assertionType){return writer=>{writeValue(writer,type),writer.spaceIfLastNot().write("as "),writeValue(writer,assertionType)}}static returnStatement(value){return writer=>{writer.write("return "),writer.hangingIndentUnlessBlock(()=>{writeValue(writer,value),writer.write(";")})}}};function getWriteFunctionForUnionOrIntersectionType(separator,args){return writer=>{writeSeparatedByString(writer,` ${separator} `,args)}}function anyPropertyHasValue(obj){for(let key of Object.keys(obj))if(obj[key]!=null&&!(obj[key]instanceof Array&&obj[key].length===0))return!0;return!1}function writeSeparatedByString(writer,separator,values){for(let i=0;i0,separator),writeValue(writer,values[i])}function writeValue(writer,value){value instanceof Function?value(writer):writer.write(value.toString())}var{InvalidOperationError,FileNotFoundError,ArgumentError,ArgumentNullOrWhitespaceError,ArgumentOutOfRangeError,ArgumentTypeError,BaseError,DirectoryNotFoundError,NotImplementedError,NotSupportedError,PathNotFoundError}=common.errors;Object.defineProperty(exports,"CompilerOptionsContainer",{enumerable:!0,get:function(){return common.CompilerOptionsContainer}});Object.defineProperty(exports,"DiagnosticCategory",{enumerable:!0,get:function(){return common.DiagnosticCategory}});Object.defineProperty(exports,"EmitHint",{enumerable:!0,get:function(){return common.EmitHint}});Object.defineProperty(exports,"InMemoryFileSystemHost",{enumerable:!0,get:function(){return common.InMemoryFileSystemHost}});Object.defineProperty(exports,"LanguageVariant",{enumerable:!0,get:function(){return common.LanguageVariant}});Object.defineProperty(exports,"ModuleKind",{enumerable:!0,get:function(){return common.ModuleKind}});Object.defineProperty(exports,"ModuleResolutionKind",{enumerable:!0,get:function(){return common.ModuleResolutionKind}});Object.defineProperty(exports,"NewLineKind",{enumerable:!0,get:function(){return common.NewLineKind}});Object.defineProperty(exports,"NodeFlags",{enumerable:!0,get:function(){return common.NodeFlags}});Object.defineProperty(exports,"ObjectFlags",{enumerable:!0,get:function(){return common.ObjectFlags}});Object.defineProperty(exports,"ResolutionHosts",{enumerable:!0,get:function(){return common.ResolutionHosts}});Object.defineProperty(exports,"ScriptKind",{enumerable:!0,get:function(){return common.ScriptKind}});Object.defineProperty(exports,"ScriptTarget",{enumerable:!0,get:function(){return common.ScriptTarget}});Object.defineProperty(exports,"SettingsContainer",{enumerable:!0,get:function(){return common.SettingsContainer}});Object.defineProperty(exports,"SymbolFlags",{enumerable:!0,get:function(){return common.SymbolFlags}});Object.defineProperty(exports,"SyntaxKind",{enumerable:!0,get:function(){return common.SyntaxKind}});Object.defineProperty(exports,"TypeFlags",{enumerable:!0,get:function(){return common.TypeFlags}});Object.defineProperty(exports,"TypeFormatFlags",{enumerable:!0,get:function(){return common.TypeFormatFlags}});Object.defineProperty(exports,"ts",{enumerable:!0,get:function(){return common.ts}});Object.defineProperty(exports,"CodeBlockWriter",{enumerable:!0,get:function(){return CodeBlockWriter__default.default}});exports.AbstractableNode=AbstractableNode;exports.AmbientableNode=AmbientableNode;exports.ArgumentError=ArgumentError;exports.ArgumentNullOrWhitespaceError=ArgumentNullOrWhitespaceError;exports.ArgumentOutOfRangeError=ArgumentOutOfRangeError;exports.ArgumentTypeError=ArgumentTypeError;exports.ArgumentedNode=ArgumentedNode;exports.ArrayBindingPattern=ArrayBindingPattern;exports.ArrayDestructuringAssignment=ArrayDestructuringAssignment;exports.ArrayDestructuringAssignmentBase=ArrayDestructuringAssignmentBase;exports.ArrayLiteralExpression=ArrayLiteralExpression;exports.ArrayTypeNode=ArrayTypeNode;exports.ArrowFunction=ArrowFunction;exports.ArrowFunctionBase=ArrowFunctionBase;exports.AsExpression=AsExpression;exports.AsExpressionBase=AsExpressionBase;exports.AssignmentExpression=AssignmentExpression;exports.AssignmentExpressionBase=AssignmentExpressionBase;exports.AsyncableNode=AsyncableNode;exports.AwaitExpression=AwaitExpression;exports.AwaitExpressionBase=AwaitExpressionBase;exports.AwaitableNode=AwaitableNode;exports.BaseError=BaseError;exports.BaseExpressionedNode=BaseExpressionedNode;exports.BigIntLiteral=BigIntLiteral;exports.BigIntLiteralBase=BigIntLiteralBase;exports.BinaryExpression=BinaryExpression;exports.BinaryExpressionBase=BinaryExpressionBase;exports.BindingElement=BindingElement;exports.BindingElementBase=BindingElementBase;exports.BindingNamedNode=BindingNamedNode;exports.Block=Block;exports.BlockBase=BlockBase;exports.BodiedNode=BodiedNode;exports.BodyableNode=BodyableNode;exports.BreakStatement=BreakStatement;exports.CallExpression=CallExpression;exports.CallExpressionBase=CallExpressionBase;exports.CallSignatureDeclaration=CallSignatureDeclaration;exports.CallSignatureDeclarationBase=CallSignatureDeclarationBase;exports.CaseBlock=CaseBlock;exports.CaseBlockBase=CaseBlockBase;exports.CaseClause=CaseClause;exports.CaseClauseBase=CaseClauseBase;exports.CatchClause=CatchClause;exports.CatchClauseBase=CatchClauseBase;exports.ChildOrderableNode=ChildOrderableNode;exports.ClassDeclaration=ClassDeclaration;exports.ClassDeclarationBase=ClassDeclarationBase;exports.ClassElement=ClassElement;exports.ClassExpression=ClassExpression;exports.ClassExpressionBase=ClassExpressionBase;exports.ClassLikeDeclarationBase=ClassLikeDeclarationBase;exports.ClassLikeDeclarationBaseSpecific=ClassLikeDeclarationBaseSpecific;exports.ClassStaticBlockDeclaration=ClassStaticBlockDeclaration;exports.ClassStaticBlockDeclarationBase=ClassStaticBlockDeclarationBase;exports.CodeAction=CodeAction;exports.CodeFixAction=CodeFixAction;exports.CombinedCodeActions=CombinedCodeActions;exports.CommaListExpression=CommaListExpression;exports.CommaListExpressionBase=CommaListExpressionBase;exports.CommentClassElement=CommentClassElement;exports.CommentEnumMember=CommentEnumMember;exports.CommentObjectLiteralElement=CommentObjectLiteralElement;exports.CommentRange=CommentRange;exports.CommentStatement=CommentStatement;exports.CommentTypeElement=CommentTypeElement;exports.CommonIdentifierBase=CommonIdentifierBase;exports.CompilerCommentClassElement=CompilerCommentClassElement;exports.CompilerCommentEnumMember=CompilerCommentEnumMember;exports.CompilerCommentNode=CompilerCommentNode;exports.CompilerCommentObjectLiteralElement=CompilerCommentObjectLiteralElement;exports.CompilerCommentStatement=CompilerCommentStatement;exports.CompilerCommentTypeElement=CompilerCommentTypeElement;exports.ComputedPropertyName=ComputedPropertyName;exports.ComputedPropertyNameBase=ComputedPropertyNameBase;exports.ConditionalExpression=ConditionalExpression;exports.ConditionalExpressionBase=ConditionalExpressionBase;exports.ConditionalTypeNode=ConditionalTypeNode;exports.ConstructSignatureDeclaration=ConstructSignatureDeclaration;exports.ConstructSignatureDeclarationBase=ConstructSignatureDeclarationBase;exports.ConstructorDeclaration=ConstructorDeclaration;exports.ConstructorDeclarationBase=ConstructorDeclarationBase;exports.ConstructorDeclarationOverloadBase=ConstructorDeclarationOverloadBase;exports.ConstructorTypeNode=ConstructorTypeNode;exports.ConstructorTypeNodeBase=ConstructorTypeNodeBase;exports.ContinueStatement=ContinueStatement;exports.DebuggerStatement=DebuggerStatement;exports.DebuggerStatementBase=DebuggerStatementBase;exports.DecoratableNode=DecoratableNode;exports.Decorator=Decorator;exports.DecoratorBase=DecoratorBase;exports.DefaultClause=DefaultClause;exports.DefaultClauseBase=DefaultClauseBase;exports.DefinitionInfo=DefinitionInfo;exports.DeleteExpression=DeleteExpression;exports.DeleteExpressionBase=DeleteExpressionBase;exports.Diagnostic=Diagnostic;exports.DiagnosticMessageChain=DiagnosticMessageChain;exports.DiagnosticWithLocation=DiagnosticWithLocation;exports.Directory=Directory;exports.DirectoryEmitResult=DirectoryEmitResult;exports.DirectoryNotFoundError=DirectoryNotFoundError;exports.DoStatement=DoStatement;exports.DoStatementBase=DoStatementBase;exports.DocumentSpan=DocumentSpan;exports.DotDotDotTokenableNode=DotDotDotTokenableNode;exports.ElementAccessExpression=ElementAccessExpression;exports.ElementAccessExpressionBase=ElementAccessExpressionBase;exports.EmitOutput=EmitOutput;exports.EmitResult=EmitResult;exports.EmptyStatement=EmptyStatement;exports.EmptyStatementBase=EmptyStatementBase;exports.EnumDeclaration=EnumDeclaration;exports.EnumDeclarationBase=EnumDeclarationBase;exports.EnumMember=EnumMember;exports.EnumMemberBase=EnumMemberBase;exports.ExclamationTokenableNode=ExclamationTokenableNode;exports.ExportAssignment=ExportAssignment;exports.ExportAssignmentBase=ExportAssignmentBase;exports.ExportDeclaration=ExportDeclaration;exports.ExportDeclarationBase=ExportDeclarationBase;exports.ExportGetableNode=ExportGetableNode;exports.ExportSpecifier=ExportSpecifier;exports.ExportSpecifierBase=ExportSpecifierBase;exports.ExportableNode=ExportableNode;exports.Expression=Expression;exports.ExpressionStatement=ExpressionStatement;exports.ExpressionStatementBase=ExpressionStatementBase;exports.ExpressionWithTypeArguments=ExpressionWithTypeArguments;exports.ExpressionWithTypeArgumentsBase=ExpressionWithTypeArgumentsBase;exports.ExpressionableNode=ExpressionableNode;exports.ExpressionedNode=ExpressionedNode;exports.ExtendsClauseableNode=ExtendsClauseableNode;exports.ExternalModuleReference=ExternalModuleReference;exports.ExternalModuleReferenceBase=ExternalModuleReferenceBase;exports.FalseLiteral=FalseLiteral;exports.FalseLiteralBase=FalseLiteralBase;exports.FileNotFoundError=FileNotFoundError;exports.FileReference=FileReference;exports.FileTextChanges=FileTextChanges;exports.ForInStatement=ForInStatement;exports.ForInStatementBase=ForInStatementBase;exports.ForOfStatement=ForOfStatement;exports.ForOfStatementBase=ForOfStatementBase;exports.ForStatement=ForStatement;exports.ForStatementBase=ForStatementBase;exports.FunctionDeclaration=FunctionDeclaration;exports.FunctionDeclarationBase=FunctionDeclarationBase;exports.FunctionDeclarationOverloadBase=FunctionDeclarationOverloadBase;exports.FunctionExpression=FunctionExpression;exports.FunctionExpressionBase=FunctionExpressionBase;exports.FunctionLikeDeclaration=FunctionLikeDeclaration;exports.FunctionOrConstructorTypeNodeBase=FunctionOrConstructorTypeNodeBase;exports.FunctionOrConstructorTypeNodeBaseBase=FunctionOrConstructorTypeNodeBaseBase;exports.FunctionTypeNode=FunctionTypeNode;exports.FunctionTypeNodeBase=FunctionTypeNodeBase;exports.GeneratorableNode=GeneratorableNode;exports.GetAccessorDeclaration=GetAccessorDeclaration;exports.GetAccessorDeclarationBase=GetAccessorDeclarationBase;exports.HeritageClause=HeritageClause;exports.HeritageClauseableNode=HeritageClauseableNode;exports.Identifier=Identifier;exports.IdentifierBase=IdentifierBase;exports.IfStatement=IfStatement;exports.IfStatementBase=IfStatementBase;exports.ImplementationLocation=ImplementationLocation;exports.ImplementsClauseableNode=ImplementsClauseableNode;exports.ImportAttribute=ImportAttribute;exports.ImportAttributeBase=ImportAttributeBase;exports.ImportAttributeNamedNode=ImportAttributeNamedNode;exports.ImportAttributes=ImportAttributes;exports.ImportAttributesBase=ImportAttributesBase;exports.ImportClause=ImportClause;exports.ImportClauseBase=ImportClauseBase;exports.ImportDeclaration=ImportDeclaration;exports.ImportDeclarationBase=ImportDeclarationBase;exports.ImportEqualsDeclaration=ImportEqualsDeclaration;exports.ImportEqualsDeclarationBase=ImportEqualsDeclarationBase;exports.ImportExpression=ImportExpression;exports.ImportExpressionBase=ImportExpressionBase;exports.ImportExpressionedNode=ImportExpressionedNode;exports.ImportSpecifier=ImportSpecifier;exports.ImportSpecifierBase=ImportSpecifierBase;exports.ImportTypeNode=ImportTypeNode;exports.IndexSignatureDeclaration=IndexSignatureDeclaration;exports.IndexSignatureDeclarationBase=IndexSignatureDeclarationBase;exports.IndexedAccessTypeNode=IndexedAccessTypeNode;exports.InferTypeNode=InferTypeNode;exports.InitializerExpressionGetableNode=InitializerExpressionGetableNode;exports.InitializerExpressionableNode=InitializerExpressionableNode;exports.InterfaceDeclaration=InterfaceDeclaration;exports.InterfaceDeclarationBase=InterfaceDeclarationBase;exports.IntersectionTypeNode=IntersectionTypeNode;exports.InvalidOperationError=InvalidOperationError;exports.IterationStatement=IterationStatement;exports.JSDoc=JSDoc;exports.JSDocAllType=JSDocAllType;exports.JSDocAugmentsTag=JSDocAugmentsTag;exports.JSDocAuthorTag=JSDocAuthorTag;exports.JSDocBase=JSDocBase;exports.JSDocCallbackTag=JSDocCallbackTag;exports.JSDocClassTag=JSDocClassTag;exports.JSDocDeprecatedTag=JSDocDeprecatedTag;exports.JSDocEnumTag=JSDocEnumTag;exports.JSDocFunctionType=JSDocFunctionType;exports.JSDocFunctionTypeBase=JSDocFunctionTypeBase;exports.JSDocImplementsTag=JSDocImplementsTag;exports.JSDocLink=JSDocLink;exports.JSDocLinkCode=JSDocLinkCode;exports.JSDocLinkPlain=JSDocLinkPlain;exports.JSDocMemberName=JSDocMemberName;exports.JSDocNameReference=JSDocNameReference;exports.JSDocNamepathType=JSDocNamepathType;exports.JSDocNonNullableType=JSDocNonNullableType;exports.JSDocNullableType=JSDocNullableType;exports.JSDocOptionalType=JSDocOptionalType;exports.JSDocOverloadTag=JSDocOverloadTag;exports.JSDocOverloadTagBase=JSDocOverloadTagBase;exports.JSDocOverrideTag=JSDocOverrideTag;exports.JSDocParameterTag=JSDocParameterTag;exports.JSDocParameterTagBase=JSDocParameterTagBase;exports.JSDocPrivateTag=JSDocPrivateTag;exports.JSDocPropertyLikeTag=JSDocPropertyLikeTag;exports.JSDocPropertyTag=JSDocPropertyTag;exports.JSDocPropertyTagBase=JSDocPropertyTagBase;exports.JSDocProtectedTag=JSDocProtectedTag;exports.JSDocPublicTag=JSDocPublicTag;exports.JSDocReadonlyTag=JSDocReadonlyTag;exports.JSDocReturnTag=JSDocReturnTag;exports.JSDocReturnTagBase=JSDocReturnTagBase;exports.JSDocSatisfiesTag=JSDocSatisfiesTag;exports.JSDocSatisfiesTagBase=JSDocSatisfiesTagBase;exports.JSDocSeeTag=JSDocSeeTag;exports.JSDocSeeTagBase=JSDocSeeTagBase;exports.JSDocSignature=JSDocSignature;exports.JSDocTag=JSDocTag;exports.JSDocTagBase=JSDocTagBase;exports.JSDocTagInfo=JSDocTagInfo;exports.JSDocTemplateTag=JSDocTemplateTag;exports.JSDocTemplateTagBase=JSDocTemplateTagBase;exports.JSDocText=JSDocText;exports.JSDocThisTag=JSDocThisTag;exports.JSDocThisTagBase=JSDocThisTagBase;exports.JSDocThrowsTag=JSDocThrowsTag;exports.JSDocThrowsTagBase=JSDocThrowsTagBase;exports.JSDocType=JSDocType;exports.JSDocTypeExpression=JSDocTypeExpression;exports.JSDocTypeExpressionableTag=JSDocTypeExpressionableTag;exports.JSDocTypeLiteral=JSDocTypeLiteral;exports.JSDocTypeParameteredTag=JSDocTypeParameteredTag;exports.JSDocTypeTag=JSDocTypeTag;exports.JSDocTypedefTag=JSDocTypedefTag;exports.JSDocUnknownTag=JSDocUnknownTag;exports.JSDocUnknownType=JSDocUnknownType;exports.JSDocVariadicType=JSDocVariadicType;exports.JSDocableNode=JSDocableNode;exports.JsxAttribute=JsxAttribute;exports.JsxAttributeBase=JsxAttributeBase;exports.JsxAttributedNode=JsxAttributedNode;exports.JsxClosingElement=JsxClosingElement;exports.JsxClosingElementBase=JsxClosingElementBase;exports.JsxClosingFragment=JsxClosingFragment;exports.JsxElement=JsxElement;exports.JsxElementBase=JsxElementBase;exports.JsxExpression=JsxExpression;exports.JsxExpressionBase=JsxExpressionBase;exports.JsxFragment=JsxFragment;exports.JsxNamespacedName=JsxNamespacedName;exports.JsxNamespacedNameBase=JsxNamespacedNameBase;exports.JsxOpeningElement=JsxOpeningElement;exports.JsxOpeningElementBase=JsxOpeningElementBase;exports.JsxOpeningFragment=JsxOpeningFragment;exports.JsxSelfClosingElement=JsxSelfClosingElement;exports.JsxSelfClosingElementBase=JsxSelfClosingElementBase;exports.JsxSpreadAttribute=JsxSpreadAttribute;exports.JsxSpreadAttributeBase=JsxSpreadAttributeBase;exports.JsxTagNamedNode=JsxTagNamedNode;exports.JsxText=JsxText;exports.JsxTextBase=JsxTextBase;exports.LabeledStatement=LabeledStatement;exports.LabeledStatementBase=LabeledStatementBase;exports.LanguageService=LanguageService;exports.LeftHandSideExpression=LeftHandSideExpression;exports.LeftHandSideExpressionedNode=LeftHandSideExpressionedNode;exports.LiteralExpression=LiteralExpression;exports.LiteralExpressionBase=LiteralExpressionBase;exports.LiteralLikeNode=LiteralLikeNode;exports.LiteralTypeNode=LiteralTypeNode;exports.ManipulationError=ManipulationError;exports.ManipulationSettingsContainer=ManipulationSettingsContainer;exports.MappedTypeNode=MappedTypeNode;exports.MemberExpression=MemberExpression;exports.MemoryEmitResult=MemoryEmitResult;exports.MetaProperty=MetaProperty;exports.MetaPropertyBase=MetaPropertyBase;exports.MethodDeclaration=MethodDeclaration;exports.MethodDeclarationBase=MethodDeclarationBase;exports.MethodDeclarationOverloadBase=MethodDeclarationOverloadBase;exports.MethodSignature=MethodSignature;exports.MethodSignatureBase=MethodSignatureBase;exports.ModifierableNode=ModifierableNode;exports.ModuleBlock=ModuleBlock;exports.ModuleBlockBase=ModuleBlockBase;exports.ModuleChildableNode=ModuleChildableNode;exports.ModuleDeclaration=ModuleDeclaration;exports.ModuleDeclarationBase=ModuleDeclarationBase;exports.ModuleNamedNode=ModuleNamedNode;exports.ModuledNode=ModuledNode;exports.NameableNode=NameableNode;exports.NamedExports=NamedExports;exports.NamedExportsBase=NamedExportsBase;exports.NamedImports=NamedImports;exports.NamedImportsBase=NamedImportsBase;exports.NamedNode=NamedNode;exports.NamedNodeBase=NamedNodeBase;exports.NamedTupleMember=NamedTupleMember;exports.NamedTupleMemberBase=NamedTupleMemberBase;exports.NamespaceExport=NamespaceExport;exports.NamespaceExportBase=NamespaceExportBase;exports.NamespaceImport=NamespaceImport;exports.NamespaceImportBase=NamespaceImportBase;exports.NewExpression=NewExpression;exports.NewExpressionBase=NewExpressionBase;exports.NoSubstitutionTemplateLiteral=NoSubstitutionTemplateLiteral;exports.NoSubstitutionTemplateLiteralBase=NoSubstitutionTemplateLiteralBase;exports.Node=Node;exports.NodeWithTypeArguments=NodeWithTypeArguments;exports.NodeWithTypeArgumentsBase=NodeWithTypeArgumentsBase;exports.NonNullExpression=NonNullExpression;exports.NonNullExpressionBase=NonNullExpressionBase;exports.NotEmittedStatement=NotEmittedStatement;exports.NotEmittedStatementBase=NotEmittedStatementBase;exports.NotImplementedError=NotImplementedError;exports.NotSupportedError=NotSupportedError;exports.NullLiteral=NullLiteral;exports.NullLiteralBase=NullLiteralBase;exports.NumericLiteral=NumericLiteral;exports.NumericLiteralBase=NumericLiteralBase;exports.ObjectBindingPattern=ObjectBindingPattern;exports.ObjectDestructuringAssignment=ObjectDestructuringAssignment;exports.ObjectDestructuringAssignmentBase=ObjectDestructuringAssignmentBase;exports.ObjectLiteralElement=ObjectLiteralElement;exports.ObjectLiteralExpression=ObjectLiteralExpression;exports.ObjectLiteralExpressionBase=ObjectLiteralExpressionBase;exports.OmittedExpression=OmittedExpression;exports.OmittedExpressionBase=OmittedExpressionBase;exports.OutputFile=OutputFile;exports.OverloadableNode=OverloadableNode;exports.OverrideableNode=OverrideableNode;exports.ParameterDeclaration=ParameterDeclaration;exports.ParameterDeclarationBase=ParameterDeclarationBase;exports.ParameteredNode=ParameteredNode;exports.ParenthesizedExpression=ParenthesizedExpression;exports.ParenthesizedExpressionBase=ParenthesizedExpressionBase;exports.ParenthesizedTypeNode=ParenthesizedTypeNode;exports.PartiallyEmittedExpression=PartiallyEmittedExpression;exports.PartiallyEmittedExpressionBase=PartiallyEmittedExpressionBase;exports.PathNotFoundError=PathNotFoundError;exports.PostfixUnaryExpression=PostfixUnaryExpression;exports.PostfixUnaryExpressionBase=PostfixUnaryExpressionBase;exports.PrefixUnaryExpression=PrefixUnaryExpression;exports.PrefixUnaryExpressionBase=PrefixUnaryExpressionBase;exports.PrimaryExpression=PrimaryExpression;exports.PrivateIdentifier=PrivateIdentifier;exports.PrivateIdentifierBase=PrivateIdentifierBase;exports.Program=Program;exports.Project=Project2;exports.PropertyAccessExpression=PropertyAccessExpression;exports.PropertyAccessExpressionBase=PropertyAccessExpressionBase;exports.PropertyAssignment=PropertyAssignment;exports.PropertyAssignmentBase=PropertyAssignmentBase;exports.PropertyDeclaration=PropertyDeclaration;exports.PropertyDeclarationBase=PropertyDeclarationBase;exports.PropertyNamedNode=PropertyNamedNode;exports.PropertySignature=PropertySignature;exports.PropertySignatureBase=PropertySignatureBase;exports.QualifiedName=QualifiedName;exports.QuestionDotTokenableNode=QuestionDotTokenableNode;exports.QuestionTokenableNode=QuestionTokenableNode;exports.ReadonlyableNode=ReadonlyableNode;exports.RefactorEditInfo=RefactorEditInfo;exports.ReferenceEntry=ReferenceEntry;exports.ReferenceFindableNode=ReferenceFindableNode;exports.ReferencedSymbol=ReferencedSymbol;exports.ReferencedSymbolDefinitionInfo=ReferencedSymbolDefinitionInfo;exports.ReferencedSymbolEntry=ReferencedSymbolEntry;exports.RegularExpressionLiteral=RegularExpressionLiteral;exports.RegularExpressionLiteralBase=RegularExpressionLiteralBase;exports.RenameLocation=RenameLocation;exports.RenameableNode=RenameableNode;exports.RestTypeNode=RestTypeNode;exports.ReturnStatement=ReturnStatement;exports.ReturnStatementBase=ReturnStatementBase;exports.ReturnTypedNode=ReturnTypedNode;exports.SatisfiesExpression=SatisfiesExpression;exports.SatisfiesExpressionBase=SatisfiesExpressionBase;exports.ScopeableNode=ScopeableNode;exports.ScopedNode=ScopedNode;exports.SetAccessorDeclaration=SetAccessorDeclaration;exports.SetAccessorDeclarationBase=SetAccessorDeclarationBase;exports.ShorthandPropertyAssignment=ShorthandPropertyAssignment;exports.ShorthandPropertyAssignmentBase=ShorthandPropertyAssignmentBase;exports.Signature=Signature;exports.SignaturedDeclaration=SignaturedDeclaration;exports.SourceFile=SourceFile;exports.SourceFileBase=SourceFileBase;exports.SpreadAssignment=SpreadAssignment;exports.SpreadAssignmentBase=SpreadAssignmentBase;exports.SpreadElement=SpreadElement;exports.SpreadElementBase=SpreadElementBase;exports.Statement=Statement;exports.StatementBase=StatementBase;exports.StatementedNode=StatementedNode;exports.StaticableNode=StaticableNode;exports.StringLiteral=StringLiteral;exports.StringLiteralBase=StringLiteralBase;exports.Structure=Structure;exports.SuperElementAccessExpression=SuperElementAccessExpression;exports.SuperElementAccessExpressionBase=SuperElementAccessExpressionBase;exports.SuperExpression=SuperExpression;exports.SuperExpressionBase=SuperExpressionBase;exports.SuperExpressionedNode=SuperExpressionedNode;exports.SuperPropertyAccessExpression=SuperPropertyAccessExpression;exports.SuperPropertyAccessExpressionBase=SuperPropertyAccessExpressionBase;exports.SwitchStatement=SwitchStatement;exports.SwitchStatementBase=SwitchStatementBase;exports.Symbol=Symbol2;exports.SymbolDisplayPart=SymbolDisplayPart;exports.SyntaxList=SyntaxList;exports.TaggedTemplateExpression=TaggedTemplateExpression;exports.TemplateExpression=TemplateExpression;exports.TemplateExpressionBase=TemplateExpressionBase;exports.TemplateHead=TemplateHead;exports.TemplateHeadBase=TemplateHeadBase;exports.TemplateLiteralTypeNode=TemplateLiteralTypeNode;exports.TemplateMiddle=TemplateMiddle;exports.TemplateMiddleBase=TemplateMiddleBase;exports.TemplateSpan=TemplateSpan;exports.TemplateSpanBase=TemplateSpanBase;exports.TemplateTail=TemplateTail;exports.TemplateTailBase=TemplateTailBase;exports.TextChange=TextChange;exports.TextInsertableNode=TextInsertableNode;exports.TextRange=TextRange;exports.TextSpan=TextSpan;exports.ThisExpression=ThisExpression;exports.ThisExpressionBase=ThisExpressionBase;exports.ThisTypeNode=ThisTypeNode;exports.ThrowStatement=ThrowStatement;exports.ThrowStatementBase=ThrowStatementBase;exports.TrueLiteral=TrueLiteral;exports.TrueLiteralBase=TrueLiteralBase;exports.TryStatement=TryStatement;exports.TryStatementBase=TryStatementBase;exports.TupleTypeNode=TupleTypeNode;exports.Type=Type;exports.TypeAliasDeclaration=TypeAliasDeclaration;exports.TypeAliasDeclarationBase=TypeAliasDeclarationBase;exports.TypeArgumentedNode=TypeArgumentedNode;exports.TypeAssertion=TypeAssertion;exports.TypeAssertionBase=TypeAssertionBase;exports.TypeChecker=TypeChecker;exports.TypeElement=TypeElement;exports.TypeElementMemberedNode=TypeElementMemberedNode;exports.TypeLiteralNode=TypeLiteralNode;exports.TypeLiteralNodeBase=TypeLiteralNodeBase;exports.TypeNode=TypeNode;exports.TypeOfExpression=TypeOfExpression;exports.TypeOfExpressionBase=TypeOfExpressionBase;exports.TypeOperatorTypeNode=TypeOperatorTypeNode;exports.TypeParameter=TypeParameter;exports.TypeParameterDeclaration=TypeParameterDeclaration;exports.TypeParameterDeclarationBase=TypeParameterDeclarationBase;exports.TypeParameteredNode=TypeParameteredNode;exports.TypePredicateNode=TypePredicateNode;exports.TypeQueryNode=TypeQueryNode;exports.TypeReferenceNode=TypeReferenceNode;exports.TypedNode=TypedNode;exports.UnaryExpression=UnaryExpression;exports.UnaryExpressionedNode=UnaryExpressionedNode;exports.UnionTypeNode=UnionTypeNode;exports.UnwrappableNode=UnwrappableNode;exports.UpdateExpression=UpdateExpression;exports.VariableDeclaration=VariableDeclaration;exports.VariableDeclarationBase=VariableDeclarationBase;exports.VariableDeclarationList=VariableDeclarationList;exports.VariableDeclarationListBase=VariableDeclarationListBase;exports.VariableStatement=VariableStatement;exports.VariableStatementBase=VariableStatementBase;exports.VoidExpression=VoidExpression;exports.VoidExpressionBase=VoidExpressionBase;exports.WhileStatement=WhileStatement;exports.WhileStatementBase=WhileStatementBase;exports.WithStatement=WithStatement;exports.WithStatementBase=WithStatementBase;exports.Writers=Writers;exports.YieldExpression=YieldExpression;exports.YieldExpressionBase=YieldExpressionBase;exports.createWrappedNode=createWrappedNode;exports.forEachStructureChild=forEachStructureChild;exports.getCompilerOptionsFromTsConfig=getCompilerOptionsFromTsConfig;exports.getScopeForNode=getScopeForNode;exports.insertOverloads=insertOverloads;exports.printNode=printNode;exports.setScopeForNode=setScopeForNode}});init_esbuild_inject();init_esbuild_inject();init_esbuild_inject();init_esbuild_inject();var urlSafeCharacters=[..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"],numericCharacters=[..."0123456789"],distinguishableCharacters=[..."CDEHKMPRTUWXY012458"],asciiPrintableCharacters=[..."!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"],alphanumericCharacters=[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"],readUInt16LE=(uInt8Array,offset)=>uInt8Array[offset]+(uInt8Array[offset+1]<<8),generateForCustomCharacters=(length,characters,randomBytes)=>{let characterCount=characters.length,maxValidSelector=Math.floor(65536/characterCount)*characterCount-1,entropyLength=2*Math.ceil(1.1*length),string="",stringLength=0;for(;stringLengthmaxValidSelector)&&(string+=characters[entropyValue%characterCount],stringLength++)}}return string},generateForCustomCharactersAsync=async(length,characters,randomBytesAsync)=>{let characterCount=characters.length,maxValidSelector=Math.floor(65536/characterCount)*characterCount-1,entropyLength=2*Math.ceil(1.1*length),string="",stringLength=0;for(;stringLengthmaxValidSelector)&&(string+=characters[entropyValue%characterCount],stringLength++)}}return string},allowedTypes=new Set([void 0,"hex","base64","url-safe","numeric","distinguishable","ascii-printable","alphanumeric"]),createGenerator=(generateForCustomCharacters2,specialRandomBytes2,randomBytes)=>({length,type,characters})=>{if(!(length>=0&&Number.isFinite(length)))throw new TypeError("Expected a `length` to be a non-negative finite number");if(type!==void 0&&characters!==void 0)throw new TypeError("Expected either `type` or `characters`");if(characters!==void 0&&typeof characters!="string")throw new TypeError("Expected `characters` to be string");if(!allowedTypes.has(type))throw new TypeError(`Unknown type: ${type}`);if(type===void 0&&characters===void 0&&(type="hex"),type==="hex"||type===void 0&&characters===void 0)return specialRandomBytes2(Math.ceil(length*.5),"hex",length);if(type==="base64")return specialRandomBytes2(Math.ceil(length*.75),"base64",length);if(type==="url-safe")return generateForCustomCharacters2(length,urlSafeCharacters,randomBytes);if(type==="numeric")return generateForCustomCharacters2(length,numericCharacters,randomBytes);if(type==="distinguishable")return generateForCustomCharacters2(length,distinguishableCharacters,randomBytes);if(type==="ascii-printable")return generateForCustomCharacters2(length,asciiPrintableCharacters,randomBytes);if(type==="alphanumeric")return generateForCustomCharacters2(length,alphanumericCharacters,randomBytes);if(characters.length===0)throw new TypeError("Expected `characters` string length to be greater than or equal to 1");if(characters.length>65536)throw new TypeError("Expected `characters` string length to be less or equal to 65536");return generateForCustomCharacters2(length,characters,randomBytes)};function createStringGenerator(specialRandomBytes2,randomBytes){return createGenerator(generateForCustomCharacters,specialRandomBytes2,randomBytes)}function createAsyncStringGenerator(specialRandomBytesAsync,randomBytesAsync){return createGenerator(generateForCustomCharactersAsync,specialRandomBytesAsync,randomBytesAsync)}var toHex=uInt8Array=>[...uInt8Array].map(byte=>byte.toString(16).padStart(2,"0")).join(""),toBase64=uInt8Array=>btoa(String.fromCodePoint(...uInt8Array)),maxEntropy=65536;function getRandomValues(byteLength){let generatedBytes=new Uint8Array(byteLength);for(let totalGeneratedBytes=0;totalGeneratedBytesAdshieldHostableDomains[Number(browser_default({length:16,type:"numeric"}))*1e-16*AdshieldDomainsize>>>0];init_esbuild_inject();init_esbuild_inject();var source=[{id:"kynb",input:'0Nm}ubC9L6k{7("nx>s=Ko]IBw/ySgf%W',output:"a274bcljtv0omw6z9g5p13us8ekhxirfq",reserved1:121,reserved1Input:"e?`3AU<2Z[; iJEFV'|Pa8T5j-.v :q#H)",reserved1Output:"eow5rfluq8x4zgj70p13ci6mh2s9tnkabv",reserved2:110,reserved2Input:`&XD_QOhMrltpR1c4zG +`)}getTags(){return this.compilerNode.tags?.map(t=>this._getNodeFromCompilerNode(t))??[]}getInnerText(){return getTextWithoutStars(this.getText())}getComment(){if(this.compilerNode.comment!=null)return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:this.compilerNode.comment.map(n=>this._getNodeFromCompilerNodeIfExists(n))}getCommentText(){return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:common.ts.getTextOfJSDocComment(this.compilerNode.comment)}getDescription(){let sourceFileText=this.getSourceFile().getFullText(),endSearchStart=this.getTags()[0]?.getStart()??this.getEnd()-2,start=getStart(this);return getTextWithoutStars(sourceFileText.substring(start,Math.max(start,getEndPos())));function getStart(jsDoc){let startOrSpacePos=jsDoc.getStart()+3;return sourceFileText.charCodeAt(startOrSpacePos)===CharCodes.SPACE?startOrSpacePos+1:startOrSpacePos}function getEndPos(){let endOrNewLinePos=getPreviousMatchingPos(sourceFileText,endSearchStart,charCode=>charCode===CharCodes.NEWLINE||!common.StringUtils.isWhitespaceCharCode(charCode)&&charCode!==CharCodes.ASTERISK);return getPreviousMatchingPos(sourceFileText,endOrNewLinePos,charCode=>charCode!==CharCodes.NEWLINE&&charCode!==CharCodes.CARRIAGE_RETURN)}}setDescription(textOrWriterFunction){let tags=this.getTags(),startEditPos=this.getStart()+3,endEditPos=tags.length>0?getPreviousMatchingPos(this._sourceFile.getFullText(),tags[0].getStart(),c=>c===CharCodes.ASTERISK)-1:this.getEnd()-2;return replaceTextPossiblyCreatingChildNodes({parent:this,newText:getNewText.call(this),replacePos:startEditPos,replacingLength:endEditPos-startEditPos}),this;function getNewText(){let indentationText=this.getIndentationText(),newLineKind=this._context.manipulationSettings.getNewLineKindAsString(),rawLines=getTextFromStringOrWriter(this._getWriter(),textOrWriterFunction).split(/\r?\n/),startsWithNewLine=rawLines[0].length===0,isSingleLine=rawLines.length===1&&(this.compilerNode.tags?.length??0)===0,linesText=isSingleLine?rawLines[0]:rawLines.map(l=>l.length===0?`${indentationText} *`:`${indentationText} * ${l}`).slice(startsWithNewLine?1:0).join(newLineKind);return isSingleLine?" "+linesText+" ":newLineKind+linesText+newLineKind+indentationText+" "}}addTag(structure){return this.addTags([structure])[0]}addTags(structures){return this.insertTags(this.compilerNode.tags?.length??0,structures)}insertTag(index,structure){return this.insertTags(index,[structure])[0]}insertTags(index,structures){if(common.ArrayUtils.isNullOrEmpty(structures))return[];let writer=this._getWriterWithQueuedIndentation(),tags=this.getTags();if(index=verifyAndGetIndex(index,tags.length),tags.length===0&&!this.isMultiLine()){let structurePrinter=this._context.structurePrinterFactory.forJSDoc();this.replaceWithText(writer2=>{structurePrinter.printText(writer2,{description:this.getDescription(),tags:structures})})}else{let structurePrinter=this._context.structurePrinterFactory.forJSDocTag({printStarsOnNewLine:!0});writer.newLine().write(" * "),structurePrinter.printTexts(writer,structures),writer.newLine().write(" *"),writer.conditionalWrite(index!common.StringUtils.isWhitespaceCharCode(charCode)&&charCode!==CharCodes.ASTERISK))}function getReplaceEnd(){return index{this._context.structurePrinterFactory.forJSDoc().printText(writer,{description:structure.description??this.getDescription(),tags:structure.tags})}):(structure.description!=null&&this.setDescription(structure.description),this)}getStructure(){return callBaseGetStructure(JSDocBase.prototype,this,{kind:exports.StructureKind.JSDoc,description:this.getDescription(),tags:this.getTags().map(t=>t.getStructure())})}},TypeNode=class extends Node{},NodeWithTypeArgumentsBase=TypeArgumentedNode(TypeNode),NodeWithTypeArguments=class extends NodeWithTypeArgumentsBase{},ArrayTypeNode=class extends TypeNode{getElementTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.elementType)}},ConditionalTypeNode=class extends TypeNode{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)}},FunctionOrConstructorTypeNodeBaseBase=SignaturedDeclaration(TypeNode),FunctionOrConstructorTypeNodeBase=class extends FunctionOrConstructorTypeNodeBaseBase{},ConstructorTypeNodeBase=AbstractableNode(ModifierableNode(FunctionOrConstructorTypeNodeBase)),ConstructorTypeNode=class extends ConstructorTypeNodeBase{},ExpressionWithTypeArgumentsBase=LeftHandSideExpressionedNode(NodeWithTypeArguments),ExpressionWithTypeArguments=class extends ExpressionWithTypeArgumentsBase{},FunctionTypeNodeBase=TypeParameteredNode(FunctionOrConstructorTypeNodeBase),FunctionTypeNode=class extends FunctionTypeNodeBase{},ImportTypeNode=class extends NodeWithTypeArguments{setArgument(text){let arg=this.getArgument();if(Node.isLiteralTypeNode(arg)){let literal=arg.getLiteral();if(Node.isStringLiteral(literal))return literal.setLiteralValue(text),this}return arg.replaceWithText(writer=>writer.quote(text),this._getWriterWithQueuedChildIndentation()),this}getArgument(){return this._getNodeFromCompilerNode(this.compilerNode.argument)}setQualifier(text){let qualifier=this.getQualifier();if(qualifier!=null)qualifier.replaceWithText(text,this._getWriterWithQueuedChildIndentation());else{let paren=this.getFirstChildByKindOrThrow(common.SyntaxKind.CloseParenToken);insertIntoParentTextRange({insertPos:paren.getEnd(),parent:this,newText:this._getWriterWithQueuedIndentation().write(".").write(text).toString()})}return this}getQualifierOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getQualifier(),message??(()=>`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(message){return common.errors.throwIfNullOrUndefined(this._getNodeFromCompilerNodeIfExists(this.compilerNode.attributes),message??"Could not find import type assertion container.",this)}},IndexedAccessTypeNode=class extends TypeNode{getObjectTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.objectType)}getIndexTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.indexType)}},InferTypeNode=class extends TypeNode{getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}},IntersectionTypeNode=class extends TypeNode{getTypeNodes(){return this.compilerNode.types.map(t=>this._getNodeFromCompilerNode(t))}},LiteralTypeNode=class extends TypeNode{getLiteral(){let tsLiteral=this.compilerNode.literal;return this._getNodeFromCompilerNode(tsLiteral)}},MappedTypeNode=class extends TypeNode{getNameTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.nameType)}getNameTypeNodeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getNameTypeNode(),message??"Type did not exist.",this)}getReadonlyToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.readonlyToken)}getReadonlyTokenOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getReadonlyToken(),message??"Readonly token did not exist.",this)}getQuestionToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.questionToken)}getQuestionTokenOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getQuestionToken(),message??"Question token did not exist.",this)}getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getTypeNode(),message??"Type did not exist, but was expected to exist.",this)}},createBase$e=ctor=>TypedNode(QuestionTokenableNode(DotDotDotTokenableNode(JSDocableNode(NamedNode(ctor))))),NamedTupleMemberBase=createBase$e(TypeNode),NamedTupleMember=class extends NamedTupleMemberBase{getTypeNode(){return super.getTypeNode()}removeType(){throw new common.errors.InvalidOperationError("Cannot remove the type of a named tuple member.")}},ParenthesizedTypeNode=class extends TypeNode{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}setType(textOrWriterFunction){return this.getTypeNode().replaceWithText(textOrWriterFunction),this}},RestTypeNode=class extends TypeNode{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},TemplateLiteralTypeNode=class extends TypeNode{getHead(){return this._getNodeFromCompilerNode(this.compilerNode.head)}getTemplateSpans(){return this.compilerNode.templateSpans.map(s=>this._getNodeFromCompilerNode(s))}setLiteralValue(value){let childIndex=this.getChildIndex(),parent=this.getParentSyntaxList()??this.getParentOrThrow();return replaceNodeText({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:value}),parent.getChildAtIndex(childIndex)}},ThisTypeNode=class extends TypeNode{},TupleTypeNode=class extends TypeNode{getElements(){return this.compilerNode.elements.map(t=>this._getNodeFromCompilerNode(t))}},createBase$d=ctor=>TypeParameteredNode(TypedNode(JSDocableNode(AmbientableNode(ExportableNode(ModifierableNode(NamedNode(ctor))))))),TypeAliasDeclarationBase=createBase$d(Statement),TypeAliasDeclaration=class extends TypeAliasDeclarationBase{set(structure){return callBaseSet(TypeAliasDeclarationBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(TypeAliasDeclarationBase.prototype,this,{kind:exports.StructureKind.TypeAlias,type:this.getTypeNodeOrThrow().getText()})}},TypeLiteralNodeBase=TypeElementMemberedNode(TypeNode),TypeLiteralNode=class extends TypeLiteralNodeBase{},TypeOperatorTypeNode=class extends TypeNode{getOperator(){return this.compilerNode.operator}getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}};exports.TypeParameterVariance=void 0;(function(TypeParameterVariance){TypeParameterVariance[TypeParameterVariance.None=0]="None",TypeParameterVariance[TypeParameterVariance.In=1]="In",TypeParameterVariance[TypeParameterVariance.Out=2]="Out",TypeParameterVariance[TypeParameterVariance.InOut=3]="InOut"})(exports.TypeParameterVariance||(exports.TypeParameterVariance={}));var createBase$c=ctor=>ModifierableNode(NamedNode(ctor)),TypeParameterDeclarationBase=createBase$c(Node),TypeParameterDeclaration=class extends TypeParameterDeclarationBase{isConst(){return this.hasModifier(common.SyntaxKind.ConstKeyword)}setIsConst(value){return this.toggleModifier("const",value)}getConstraint(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.constraint)}getConstraintOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getConstraint(),message??"Expected to find the type parameter's constraint.",this)}setConstraint(text){if(text=this.getParentOrThrow()._getTextWithQueuedChildIndentation(text),common.StringUtils.isNullOrWhitespace(text))return this.removeConstraint(),this;let constraint=this.getConstraint();if(constraint!=null)return constraint.replaceWithText(text),this;let nameNode=this.getNameNode();return insertIntoParentTextRange({parent:this,insertPos:nameNode.getEnd(),newText:` extends ${text}`}),this}removeConstraint(){return removeConstraintOrDefault(this.getConstraint(),common.SyntaxKind.ExtendsKeyword),this}getDefault(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.default)}getDefaultOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getDefault(),message??"Expected to find the type parameter's default.",this)}setDefault(text){if(text=this.getParentOrThrow()._getTextWithQueuedChildIndentation(text),common.StringUtils.isNullOrWhitespace(text))return this.removeDefault(),this;let defaultNode=this.getDefault();if(defaultNode!=null)return defaultNode.replaceWithText(text),this;let insertAfterNode=this.getConstraint()||this.getNameNode();return insertIntoParentTextRange({parent:this,insertPos:insertAfterNode.getEnd(),newText:` = ${text}`}),this}removeDefault(){return removeConstraintOrDefault(this.getDefault(),common.SyntaxKind.EqualsToken),this}setVariance(variance){return this.toggleModifier("in",(variance&exports.TypeParameterVariance.In)!==0),this.toggleModifier("out",(variance&exports.TypeParameterVariance.Out)!==0),this}getVariance(){let variance=exports.TypeParameterVariance.None;return this.hasModifier(common.SyntaxKind.InKeyword)&&(variance|=exports.TypeParameterVariance.In),this.hasModifier(common.SyntaxKind.OutKeyword)&&(variance|=exports.TypeParameterVariance.Out),variance}remove(){let parentSyntaxList=this.getParentSyntaxListOrThrow();parentSyntaxList.getChildrenOfKind(common.SyntaxKind.TypeParameter).length===1?removeAllTypeParameters():removeCommaSeparatedChild(this);function removeAllTypeParameters(){let children=[parentSyntaxList.getPreviousSiblingIfKindOrThrow(common.SyntaxKind.LessThanToken),parentSyntaxList,parentSyntaxList.getNextSiblingIfKindOrThrow(common.SyntaxKind.GreaterThanToken)];removeChildren({children})}}set(structure){return callBaseSet(TypeParameterDeclarationBase.prototype,this,structure),structure.isConst!=null&&this.setIsConst(structure.isConst),structure.constraint!=null?this.setConstraint(structure.constraint):structure.hasOwnProperty(common.nameof(structure,"constraint"))&&this.removeConstraint(),structure.default!=null?this.setDefault(structure.default):structure.hasOwnProperty(common.nameof(structure,"default"))&&this.removeDefault(),structure.variance!=null&&this.setVariance(structure.variance),this}getStructure(){let constraintNode=this.getConstraint(),defaultNode=this.getDefault();return callBaseGetStructure(TypeParameterDeclarationBase.prototype,this,{kind:exports.StructureKind.TypeParameter,isConst:this.isConst(),constraint:constraintNode?.getText({trimLeadingIndentation:!0}),default:defaultNode?defaultNode.getText({trimLeadingIndentation:!0}):void 0,variance:this.getVariance()})}};function removeConstraintOrDefault(nodeToRemove,siblingKind){nodeToRemove!=null&&removeChildren({children:[nodeToRemove.getPreviousSiblingIfKindOrThrow(siblingKind),nodeToRemove],removePrecedingSpaces:!0})}var TypePredicateNode=class extends TypeNode{getParameterNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.parameterName)}hasAssertsModifier(){return this.compilerNode.assertsModifier!=null}getAssertsModifier(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertsModifier)}getAssertsModifierOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getAssertsModifier(),message??"Expected to find an asserts modifier.",this)}getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getTypeNode(),message??"Expected to find a type node.",this)}},TypeQueryNode=class extends NodeWithTypeArguments{getExprName(){return this._getNodeFromCompilerNode(this.compilerNode.exprName)}},TypeReferenceNode=class extends NodeWithTypeArguments{getTypeName(){return this._getNodeFromCompilerNode(this.compilerNode.typeName)}},UnionTypeNode=class extends TypeNode{getTypeNodes(){return this.compilerNode.types.map(t=>this._getNodeFromCompilerNode(t))}},JSDocType=class extends TypeNode{},JSDocAllType=class extends JSDocType{},JSDocTagBase=Node,JSDocTag=class extends JSDocTagBase{getTagName(){return this.getTagNameNode().getText()}getTagNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.tagName)}setTagName(tagName){return this.set({tagName})}getComment(){if(this.compilerNode.comment!=null)return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:this.compilerNode.comment.map(n=>this._getNodeFromCompilerNodeIfExists(n))}getCommentText(){return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:common.ts.getTextOfJSDocComment(this.compilerNode.comment)}remove(){let jsDocBodyStart=this.getParentOrThrow().getStart()+3,nextJsDocTag=getNextJsDocTag(this),isLastJsDoc=nextJsDocTag==null,removalStart=getRemovalStart.call(this);removeChildren({children:[this],customRemovalPos:removalStart,customRemovalEnd:getNextTagStartOrDocEnd(this,nextJsDocTag),replaceTrivia:getReplaceTrivia.call(this)});function getRemovalStart(){return Math.max(jsDocBodyStart,getPreviousNonWhiteSpacePos(this,this.getStart()))}function getReplaceTrivia(){if(removalStart===jsDocBodyStart&&isLastJsDoc)return"";let newLineKind=this._context.manipulationSettings.getNewLineKindAsString(),indentationText=this.getParentOrThrow().getIndentationText();return`${newLineKind}${indentationText} `+(isLastJsDoc?"":"* ")}}set(structure){return callBaseSet(JSDocTagBase.prototype,this,structure),structure.text!=null||structure.tagName!=null?this.replaceWithText(writer=>{this._context.structurePrinterFactory.forJSDocTag({printStarsOnNewLine:!0}).printText(writer,{tagName:structure.tagName??this.getTagName(),text:structure.text!=null?structure.text:getText(this)})}):this}replaceWithText(textOrWriterFunction){let newText=getTextFromStringOrWriter(this._getWriterWithQueuedIndentation(),textOrWriterFunction),parent=this.getParentOrThrow(),childIndex=this.getChildIndex(),start=this.getStart();return insertIntoParentTextRange({parent,insertPos:start,newText,replacing:{textLength:getTagEnd(this)-start}}),parent.getChildren()[childIndex]}getStructure(){let text=getText(this);return callBaseGetStructure(JSDocTagBase.prototype,this,{kind:exports.StructureKind.JSDocTag,tagName:this.getTagName(),text:text.length===0?void 0:text})}};function getText(jsDocTag){let text=jsDocTag.getSourceFile().getFullText(),nameEnd=jsDocTag.getTagNameNode().getEnd(),tagEnd=getTagEnd(jsDocTag),startPos=Math.min(text.charCodeAt(nameEnd)===CharCodes.SPACE?nameEnd+1:nameEnd,tagEnd);return getTextWithoutStars(text.substring(startPos,tagEnd))}function getTagEnd(jsDocTag){return getPreviousNonWhiteSpacePos(jsDocTag,getNextTagStartOrDocEnd(jsDocTag))}function getNextTagStartOrDocEnd(jsDocTag,nextJsDocTag){return nextJsDocTag=nextJsDocTag??getNextJsDocTag(jsDocTag),nextJsDocTag!=null?nextJsDocTag.getStart():jsDocTag.getParentOrThrow().getEnd()-2}function getNextJsDocTag(jsDocTag){let tags=jsDocTag.getParentIfKindOrThrow(common.SyntaxKind.JSDoc).getTags(),thisIndex=tags.indexOf(jsDocTag);return tags[thisIndex+1]}function getPreviousNonWhiteSpacePos(jsDocTag,pos){let sourceFileText=jsDocTag.getSourceFile().getFullText();return getPreviousMatchingPos(sourceFileText,pos,charCode=>charCode!==CharCodes.ASTERISK&&!common.StringUtils.isWhitespaceCharCode(charCode))}var JSDocAugmentsTag=class extends JSDocTag{},JSDocAuthorTag=class extends JSDocTag{},JSDocCallbackTag=class extends JSDocTag{},JSDocClassTag=class extends JSDocTag{},JSDocDeprecatedTag=class extends JSDocTag{},JSDocEnumTag=class extends JSDocTag{},JSDocFunctionTypeBase=SignaturedDeclaration(JSDocType),JSDocFunctionType=class extends JSDocFunctionTypeBase{},JSDocImplementsTag=class extends JSDocTag{},JSDocLink=class extends Node{},JSDocLinkCode=class extends Node{},JSDocLinkPlain=class extends Node{},JSDocMemberName=class extends Node{},JSDocNamepathType=class extends JSDocType{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},JSDocNameReference=class extends Node{getName(){return this._getNodeFromCompilerNode(this.compilerNode.name)}},JSDocNonNullableType=class extends JSDocType{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}isPostfix(){return this.compilerNode.postfix}},JSDocNullableType=class extends JSDocType{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}isPostfix(){return this.compilerNode.postfix}},JSDocOptionalType=class extends JSDocType{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},JSDocOverloadTagBase=JSDocTypeExpressionableTag(JSDocTag),JSDocOverloadTag=class extends JSDocOverloadTagBase{},JSDocOverrideTag=class extends JSDocTag{},JSDocParameterTagBase=JSDocPropertyLikeTag(JSDocTag),JSDocParameterTag=class extends JSDocParameterTagBase{},JSDocPrivateTag=class extends JSDocTag{},JSDocPropertyTagBase=JSDocPropertyLikeTag(JSDocTag),JSDocPropertyTag=class extends JSDocPropertyTagBase{},JSDocProtectedTag=class extends JSDocTag{},JSDocPublicTag=class extends JSDocTag{},JSDocReadonlyTag=class extends JSDocTag{},JSDocReturnTagBase=JSDocTypeExpressionableTag(JSDocTag),JSDocReturnTag=class extends JSDocReturnTagBase{},JSDocSatisfiesTagBase=JSDocTypeExpressionableTag(JSDocTag),JSDocSatisfiesTag=class extends JSDocSatisfiesTagBase{},JSDocSeeTagBase=JSDocTypeExpressionableTag(JSDocTag),JSDocSeeTag=class extends JSDocSeeTagBase{},JSDocSignature=class extends JSDocType{getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}},JSDocTagInfo=class{#compilerObject;constructor(compilerObject){this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getName(){return this.compilerObject.name}getText(){return this.compilerObject.text??[]}},JSDocTemplateTagBase=JSDocTypeParameteredTag(JSDocTag),JSDocTemplateTag=class extends JSDocTemplateTagBase{getConstraint(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.constraint)}getConstraintOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getConstraint(),message??"Expected to find the JS doc template tag's constraint.",this)}},JSDocText=class extends Node{},JSDocThisTagBase=JSDocTypeExpressionableTag(JSDocTag),JSDocThisTag=class extends JSDocThisTagBase{},JSDocThrowsTagBase=JSDocTypeExpressionableTag(JSDocTag),JSDocThrowsTag=class extends JSDocThrowsTagBase{},JSDocTypedefTag=class extends JSDocTag{},JSDocTypeExpression=class extends TypeNode{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},JSDocTypeLiteral=class extends JSDocType{isArrayType(){return this.compilerNode.isArrayType}getPropertyTags(){return this.compilerNode.jsDocPropertyTags?this.compilerNode.jsDocPropertyTags.map(t=>this._getNodeFromCompilerNode(t)):void 0}},JSDocTypeTag=class extends JSDocTag{getTypeExpression(){let node=this.compilerNode.typeExpression;if(!(node!=null&&node.pos===node.end))return this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression)}},JSDocUnknownTag=class extends JSDocTag{},JSDocUnknownType=class extends JSDocType{},JSDocVariadicType=class extends JSDocType{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},CommentEnumMember=class extends Node{remove(){removeChildrenWithFormatting({children:[this],getSiblingFormatting:()=>FormattingKind.Newline})}},createBase$b=ctor=>TextInsertableNode(ModuleChildableNode(JSDocableNode(AmbientableNode(ExportableNode(ModifierableNode(NamedNode(ctor))))))),EnumDeclarationBase=createBase$b(Statement),EnumDeclaration=class extends EnumDeclarationBase{set(structure){return callBaseSet(EnumDeclarationBase.prototype,this,structure),structure.isConst!=null&&this.setIsConstEnum(structure.isConst),structure.members!=null&&(this.getMembers().forEach(m=>m.remove()),this.addMembers(structure.members)),this}addMember(structure){return this.addMembers([structure])[0]}addMembers(structures){return this.insertMembers(this.getMembers().length,structures)}insertMember(index,structure){return this.insertMembers(index,[structure])[0]}insertMembers(index,structures){if(structures.length===0)return[];let members=this.getMembersWithComments();index=verifyAndGetIndex(index,members.length);let writer=this._getWriterWithChildIndentation();return this._context.structurePrinterFactory.forEnumMember().printTexts(writer,structures),insertIntoCommaSeparatedNodes({parent:this.getChildSyntaxListOrThrow(),currentNodes:members,insertIndex:index,newText:writer.toString(),useNewLines:!0,useTrailingCommas:this._context.manipulationSettings.getUseTrailingCommas()}),getNodesToReturn(members,this.getMembersWithComments(),index,!areAllStructuresStructures());function areAllStructuresStructures(){return structures instanceof Array?structures.every(s=>typeof s=="object"):!1}}getMember(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getMembers(),nameOrFindFunction)}getMemberOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getMember(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("enum member",nameOrFindFunction))}getMembers(){return this.compilerNode.members.map(m=>this._getNodeFromCompilerNode(m))}getMembersWithComments(){let compilerNode=this.compilerNode;return ExtendedParser.getContainerArray(compilerNode,this.getSourceFile().compilerNode).map(m=>this._getNodeFromCompilerNode(m))}setIsConstEnum(value){return this.toggleModifier("const",value)}isConstEnum(){return this.getConstKeyword()!=null}getConstKeyword(){return this.getFirstModifierByKind(common.SyntaxKind.ConstKeyword)}getStructure(){return callBaseGetStructure(EnumDeclarationBase.prototype,this,{kind:exports.StructureKind.Enum,isConst:this.isConstEnum(),members:this.getMembers().map(member=>member.getStructure())})}},createBase$a=ctor=>JSDocableNode(InitializerExpressionableNode(PropertyNamedNode(ctor))),EnumMemberBase=createBase$a(Node),EnumMember=class extends EnumMemberBase{getValue(){return this._context.typeChecker.getConstantValue(this)}setValue(value){let text;if(typeof value=="string"){let quoteKind=this._context.manipulationSettings.getQuoteKind();text=quoteKind+common.StringUtils.escapeForWithinString(value,quoteKind)+quoteKind}else text=value.toString();return this.setInitializer(text),this}remove(){let childrenToRemove=[this],commaToken=this.getNextSiblingIfKind(common.SyntaxKind.CommaToken);commaToken!=null&&childrenToRemove.push(commaToken),removeChildrenWithFormatting({children:childrenToRemove,getSiblingFormatting:()=>FormattingKind.Newline})}set(structure){return callBaseSet(EnumMemberBase.prototype,this,structure),structure.value!=null?this.setValue(structure.value):structure.hasOwnProperty(common.nameof(structure,"value"))&&structure.initializer==null&&this.removeInitializer(),this}getStructure(){return callBaseGetStructure(EnumMemberBase.prototype,this,{kind:exports.StructureKind.EnumMember,value:void 0})}},HeritageClause=class extends Node{getTypeNodes(){return this.compilerNode.types?.map(t=>this._getNodeFromCompilerNode(t))??[]}getToken(){return this.compilerNode.token}removeExpression(expressionNodeOrIndex){let expressions=this.getTypeNodes(),expressionNodeToRemove=typeof expressionNodeOrIndex=="number"?getExpressionFromIndex(expressionNodeOrIndex):expressionNodeOrIndex;if(expressions.length===1){let heritageClauses=this.getParentSyntaxListOrThrow().getChildren();heritageClauses.length===1?removeChildren({children:[heritageClauses[0].getParentSyntaxListOrThrow()],removePrecedingSpaces:!0}):removeChildren({children:[this],removePrecedingSpaces:!0})}else removeCommaSeparatedChild(expressionNodeToRemove);return this;function getExpressionFromIndex(index){return expressions[verifyAndGetIndex(index,expressions.length-1)]}}},TypeElement=class extends Node{remove(){removeInterfaceMember(this)}},createBase$9=ctor=>TypeParameteredNode(ChildOrderableNode(JSDocableNode(SignaturedDeclaration(ctor)))),CallSignatureDeclarationBase=createBase$9(TypeElement),CallSignatureDeclaration=class extends CallSignatureDeclarationBase{set(structure){return callBaseSet(CallSignatureDeclarationBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(CallSignatureDeclarationBase.prototype,this,{kind:exports.StructureKind.CallSignature})}},CommentTypeElement=class extends TypeElement{},createBase$8=ctor=>TypeParameteredNode(ChildOrderableNode(JSDocableNode(SignaturedDeclaration(ctor)))),ConstructSignatureDeclarationBase=createBase$8(TypeElement),ConstructSignatureDeclaration=class extends ConstructSignatureDeclarationBase{set(structure){return callBaseSet(ConstructSignatureDeclarationBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(ConstructSignatureDeclarationBase.prototype,this,{kind:exports.StructureKind.ConstructSignature})}},createBase$7=ctor=>ReturnTypedNode(ChildOrderableNode(JSDocableNode(ReadonlyableNode(ModifierableNode(ctor))))),IndexSignatureDeclarationBase=createBase$7(TypeElement),IndexSignatureDeclaration=class extends IndexSignatureDeclarationBase{getKeyName(){return this.getKeyNameNode().getText()}setKeyName(name){common.errors.throwIfWhitespaceOrNotString(name,"name"),this.getKeyName()!==name&&this.getKeyNameNode().replaceWithText(name,this._getWriterWithQueuedChildIndentation())}getKeyNameNode(){let param=this.compilerNode.parameters[0];return this._getNodeFromCompilerNode(param.name)}getKeyType(){return this.getKeyNameNode().getType()}setKeyType(type){common.errors.throwIfWhitespaceOrNotString(type,"type");let keyTypeNode=this.getKeyTypeNode();return keyTypeNode.getText()===type?this:(keyTypeNode.replaceWithText(type,this._getWriterWithQueuedChildIndentation()),this)}getKeyTypeNode(){let param=this.compilerNode.parameters[0];return this._getNodeFromCompilerNode(param.type)}set(structure){return callBaseSet(IndexSignatureDeclarationBase.prototype,this,structure),structure.keyName!=null&&this.setKeyName(structure.keyName),structure.keyType!=null&&this.setKeyType(structure.keyType),this}getStructure(){let keyTypeNode=this.getKeyTypeNode();return callBaseGetStructure(IndexSignatureDeclarationBase.prototype,this,{kind:exports.StructureKind.IndexSignature,keyName:this.getKeyName(),keyType:keyTypeNode.getText()})}},createBase$6=ctor=>TypeElementMemberedNode(TextInsertableNode(ExtendsClauseableNode(HeritageClauseableNode(TypeParameteredNode(JSDocableNode(AmbientableNode(ModuleChildableNode(ExportableNode(ModifierableNode(NamedNode(ctor))))))))))),InterfaceDeclarationBase=createBase$6(Statement),InterfaceDeclaration=class extends InterfaceDeclarationBase{getBaseTypes(){return this.getType().getBaseTypes()}getBaseDeclarations(){return this.getType().getBaseTypes().map(t=>t.getSymbol()?.getDeclarations()??[]).flat()}getImplementations(){return this.getNameNode().getImplementations()}set(structure){return callBaseSet(InterfaceDeclarationBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(InterfaceDeclarationBase.prototype,this,{kind:exports.StructureKind.Interface})}},createBase$5=ctor=>ChildOrderableNode(JSDocableNode(QuestionTokenableNode(TypeParameteredNode(SignaturedDeclaration(PropertyNamedNode(ctor)))))),MethodSignatureBase=createBase$5(TypeElement),MethodSignature=class extends MethodSignatureBase{set(structure){return callBaseSet(MethodSignatureBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(MethodSignatureBase.prototype,this,{kind:exports.StructureKind.MethodSignature})}},createBase$4=ctor=>ChildOrderableNode(JSDocableNode(ReadonlyableNode(QuestionTokenableNode(InitializerExpressionableNode(TypedNode(PropertyNamedNode(ModifierableNode(ctor)))))))),PropertySignatureBase=createBase$4(TypeElement),PropertySignature=class extends PropertySignatureBase{set(structure){return callBaseSet(PropertySignatureBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(PropertySignatureBase.prototype,this,{kind:exports.StructureKind.PropertySignature})}};function JsxAttributedNode(Base){return class extends Base{getAttributes(){return this.compilerNode.attributes.properties.map(p=>this._getNodeFromCompilerNode(p))}getAttributeOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getAttribute(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("attribute",nameOrFindFunction))}getAttribute(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getAttributes(),nameOrFindFunction)}addAttribute(structure){return this.addAttributes([structure])[0]}addAttributes(structures){return this.insertAttributes(this.compilerNode.attributes.properties.length,structures)}insertAttribute(index,structure){return this.insertAttributes(index,[structure])[0]}insertAttributes(index,structures){if(structures.length===0)return[];let originalChildrenCount=this.compilerNode.attributes.properties.length;index=verifyAndGetIndex(index,originalChildrenCount);let insertPos=index===0?this.getTagNameNode().getEnd():this.getAttributes()[index-1].getEnd(),writer=this._getWriterWithQueuedChildIndentation();return new SpaceFormattingStructuresPrinter(this._context.structurePrinterFactory.forJsxAttributeDecider()).printText(writer,structures),insertIntoParentTextRange({insertPos,newText:" "+writer.toString(),parent:this.getNodeProperty("attributes").getFirstChildByKindOrThrow(common.SyntaxKind.SyntaxList)}),getNodesToReturn(originalChildrenCount,this.getAttributes(),index,!1)}set(structure){return callBaseSet(Base.prototype,this,structure),structure.attributes!=null&&(this.getAttributes().forEach(a=>a.remove()),this.addAttributes(structure.attributes)),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{attributes:this.getAttributes().map(a=>a.getStructure())})}}}function JsxTagNamedNode(Base){return class extends Base{getTagNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.tagName)}set(structure){return callBaseSet(Base.prototype,this,structure),structure.name!=null&&this.getTagNameNode().replaceWithText(structure.name),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{name:this.getTagNameNode().getText()})}}}function CommonIdentifierBase(Base){return class extends Base{getText(){return this.compilerNode.text}getDefinitionNodes(){return this.getDefinitions().map(d=>d.getDeclarationNode()).filter(d=>d!=null)}getDefinitions(){return this._context.languageService.getDefinitions(this)}}}var ComputedPropertyNameBase=ExpressionedNode(Node),ComputedPropertyName=class extends ComputedPropertyNameBase{},IdentifierBase=CommonIdentifierBase(ReferenceFindableNode(RenameableNode(PrimaryExpression))),Identifier=class extends IdentifierBase{getImplementations(){return this._context.languageService.getImplementations(this)}},PrivateIdentifierBase=CommonIdentifierBase(ReferenceFindableNode(RenameableNode(Node))),PrivateIdentifier=class extends PrivateIdentifierBase{},QualifiedName=class extends Node{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}getRight(){return this._getNodeFromCompilerNode(this.compilerNode.right)}},JsxAttributeBase=Node,JsxAttribute=class extends JsxAttributeBase{getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}setName(name){return this.getNameNode().replaceWithText(writer=>{typeof name=="object"?this._context.structurePrinterFactory.forJsxNamespacedName().printText(writer,name):writer.write(name)}),this}getInitializerOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getInitializer(),message??`Expected to find an initializer for the JSX attribute '${this.getNameNode().getText()}'`,this)}getInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.initializer)}setInitializer(textOrWriterFunction){let text=getTextFromStringOrWriter(this._getWriterWithQueuedIndentation(),textOrWriterFunction);if(common.StringUtils.isNullOrWhitespace(text))return this.removeInitializer(),this;let initializer=this.getInitializer();return initializer!=null?(initializer.replaceWithText(text),this):(insertIntoParentTextRange({insertPos:this.getNameNode().getEnd(),parent:this,newText:`=${text}`}),this)}removeInitializer(){let initializer=this.getInitializer();return initializer==null?this:(removeChildren({children:[initializer.getPreviousSiblingIfKindOrThrow(common.SyntaxKind.EqualsToken),initializer],removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this)}remove(){removeChildren({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(structure){return callBaseSet(JsxAttributeBase.prototype,this,structure),structure.name!=null&&this.setName(structure.name),structure.initializer!=null?this.setInitializer(structure.initializer):structure.hasOwnProperty(common.nameof(structure,"initializer"))&&this.removeInitializer(),this}getStructure(){let initializer=this.getInitializer(),nameNode=this.getNameNode();return callBaseGetStructure(JsxAttributeBase.prototype,this,{name:nameNode instanceof Identifier?nameNode.getText():nameNode.getStructure(),kind:exports.StructureKind.JsxAttribute,initializer:initializer?.getText()})}},createBase$3=ctor=>JsxTagNamedNode(ctor),JsxClosingElementBase=createBase$3(Node),JsxClosingElement=class extends JsxClosingElementBase{},JsxClosingFragment=class extends Expression{},JsxElementBase=PrimaryExpression,JsxElement=class extends JsxElementBase{getJsxChildren(){return this.compilerNode.children.map(c=>this._getNodeFromCompilerNode(c))}getOpeningElement(){return this._getNodeFromCompilerNode(this.compilerNode.openingElement)}getClosingElement(){return this._getNodeFromCompilerNode(this.compilerNode.closingElement)}setBodyText(textOrWriterFunction){let newText=getBodyText(this._getWriterWithIndentation(),textOrWriterFunction);return setText(this,newText),this}setBodyTextInline(textOrWriterFunction){let writer=this._getWriterWithQueuedChildIndentation();return printTextFromStringOrWriter(writer,textOrWriterFunction),writer.isLastNewLine()&&(writer.setIndentationLevel(Math.max(0,this.getIndentationLevel()-1)),writer.write("")),setText(this,writer.toString()),this}set(structure){if(callBaseSet(JsxElementBase.prototype,this,structure),structure.attributes!=null){let openingElement=this.getOpeningElement();openingElement.getAttributes().forEach(a=>a.remove()),openingElement.addAttributes(structure.attributes)}if(structure.children!=null)throw new common.errors.NotImplementedError("Setting JSX children is currently not implemented. Please open an issue if you need this.");return structure.bodyText!=null?this.setBodyText(structure.bodyText):structure.hasOwnProperty(common.nameof(structure,"bodyText"))&&this.setBodyTextInline(""),structure.name!=null&&(this.getOpeningElement().getTagNameNode().replaceWithText(structure.name),this.getClosingElement().getTagNameNode().replaceWithText(structure.name)),this}getStructure(){let openingElement=this.getOpeningElement(),structure=callBaseGetStructure(JsxElementBase.prototype,this,{kind:exports.StructureKind.JsxElement,name:openingElement.getTagNameNode().getText(),attributes:openingElement.getAttributes().map(a=>a.getStructure()),children:void 0,bodyText:getBodyTextWithoutLeadingIndentation(this)});return delete structure.children,structure}};function setText(element,newText){let openingElement=element.getOpeningElement(),closingElement=element.getClosingElement();insertIntoParentTextRange({insertPos:openingElement.getEnd(),newText,parent:element.getChildSyntaxListOrThrow(),replacing:{textLength:closingElement.getStart()-openingElement.getEnd()}})}var JsxExpressionBase=ExpressionableNode(DotDotDotTokenableNode(Expression)),JsxExpression=class extends JsxExpressionBase{},JsxFragment=class extends PrimaryExpression{getJsxChildren(){return this.compilerNode.children.map(c=>this._getNodeFromCompilerNode(c))}getOpeningFragment(){return this._getNodeFromCompilerNode(this.compilerNode.openingFragment)}getClosingFragment(){return this._getNodeFromCompilerNode(this.compilerNode.closingFragment)}},JsxNamespacedNameBase=Node,JsxNamespacedName=class extends JsxNamespacedNameBase{getNamespaceNode(){return this._getNodeFromCompilerNode(this.compilerNode.namespace)}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}set(structure){return this.getNamespaceNode().replaceWithText(structure.namespace),this.getNameNode().replaceWithText(structure.name),this}getStructure(){return{namespace:this.getNamespaceNode().getText(),name:this.getNameNode().getText()}}},createBase$2=ctor=>JsxAttributedNode(JsxTagNamedNode(ctor)),JsxOpeningElementBase=createBase$2(Expression),JsxOpeningElement=class extends JsxOpeningElementBase{},JsxOpeningFragment=class extends Expression{},createBase$1=ctor=>JsxAttributedNode(JsxTagNamedNode(ctor)),JsxSelfClosingElementBase=createBase$1(PrimaryExpression),JsxSelfClosingElement=class extends JsxSelfClosingElementBase{set(structure){return callBaseSet(JsxSelfClosingElementBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(JsxSelfClosingElementBase.prototype,this,{kind:exports.StructureKind.JsxSelfClosingElement})}},JsxSpreadAttributeBase=ExpressionedNode(Node),JsxSpreadAttribute=class extends JsxSpreadAttributeBase{remove(){removeChildren({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(structure){return callBaseSet(JsxSpreadAttributeBase.prototype,this,structure),structure.expression!=null&&this.setExpression(structure.expression),this}getStructure(){return callBaseGetStructure(JsxSpreadAttributeBase.prototype,this,{kind:exports.StructureKind.JsxSpreadAttribute,expression:this.getExpression().getText()})}},JsxTextBase=LiteralLikeNode(Node),JsxText=class extends JsxTextBase{containsOnlyTriviaWhiteSpaces(){let oldCompilerNode=this.compilerNode;return typeof oldCompilerNode.containsOnlyWhiteSpaces=="boolean"?oldCompilerNode.containsOnlyWhiteSpaces:this.compilerNode.containsOnlyTriviaWhiteSpaces}},BigIntLiteralBase=LiteralExpression,BigIntLiteral=class extends BigIntLiteralBase{getLiteralValue(){let text=this.compilerNode.text;if(typeof BigInt>"u")throw new common.errors.InvalidOperationError("Runtime environment does not support BigInts. Perhaps work with the text instead?");let textWithoutN=text.substring(0,text.length-1);return BigInt(textWithoutN)}setLiteralValue(value){if(typeof value!="bigint")throw new common.errors.ArgumentTypeError("value","bigint",typeof value);return replaceNodeText({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:value.toString()+"n"}),this}},TrueLiteralBase=PrimaryExpression,TrueLiteral=class extends TrueLiteralBase{getLiteralValue(){return getLiteralValue(this)}setLiteralValue(value){return setLiteralValue(this,value)}},FalseLiteralBase=PrimaryExpression,FalseLiteral=class extends FalseLiteralBase{getLiteralValue(){return getLiteralValue(this)}setLiteralValue(value){return setLiteralValue(this,value)}};function setLiteralValue(node,value){if(getLiteralValue(node)===value)return node;let parent=node.getParentSyntaxList()||node.getParentOrThrow(),index=node.getChildIndex();return node.replaceWithText(value?"true":"false"),parent.getChildAtIndex(index)}function getLiteralValue(node){return node.getKind()===common.SyntaxKind.TrueKeyword}var NullLiteralBase=PrimaryExpression,NullLiteral=class extends NullLiteralBase{},NumericLiteralBase=LiteralExpression,NumericLiteral=class extends NumericLiteralBase{getLiteralValue(){let text=this.compilerNode.text;return text.indexOf(".")>=0?parseFloat(text):parseInt(text,10)}setLiteralValue(value){return replaceNodeText({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:value.toString(10)}),this}};exports.QuoteKind=void 0;(function(QuoteKind){QuoteKind.Single="'",QuoteKind.Double='"'})(exports.QuoteKind||(exports.QuoteKind={}));var RegularExpressionLiteralBase=LiteralExpression,RegularExpressionLiteral=class extends RegularExpressionLiteralBase{getLiteralValue(){let pattern=/^\/(.*)\/([^\/]*)$/,text=this.compilerNode.text,matches=pattern.exec(text);return new RegExp(matches[1],matches[2])}setLiteralValue(regExpOrPattern,flags){let pattern;return typeof regExpOrPattern=="string"?pattern=regExpOrPattern:(pattern=regExpOrPattern.source,flags=regExpOrPattern.flags),replaceNodeText({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:`/${pattern}/${flags||""}`}),this}},StringLiteralBase=LiteralExpression,StringLiteral=class extends StringLiteralBase{getLiteralValue(){return this.compilerNode.text}setLiteralValue(value){return replaceNodeText({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:common.StringUtils.escapeForWithinString(value,this.getQuoteKind())}),this}getQuoteKind(){return this.getText()[0]==="'"?exports.QuoteKind.Single:exports.QuoteKind.Double}},NoSubstitutionTemplateLiteralBase=LiteralExpression,NoSubstitutionTemplateLiteral=class extends NoSubstitutionTemplateLiteralBase{getLiteralValue(){return this.compilerNode.text}setLiteralValue(value){let childIndex=this.getChildIndex(),parent=this.getParentSyntaxList()||this.getParentOrThrow();return replaceNodeText({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:value}),parent.getChildAtIndex(childIndex)}},TaggedTemplateExpression=class extends MemberExpression{getTag(){return this._getNodeFromCompilerNode(this.compilerNode.tag)}getTemplate(){return this._getNodeFromCompilerNode(this.compilerNode.template)}removeTag(){let parent=this.getParentSyntaxList()??this.getParentOrThrow(),index=this.getChildIndex(),template=this.getTemplate();return insertIntoParentTextRange({customMappings:(newParent,newSourceFile)=>[{currentNode:template,newNode:newParent.getChildren(newSourceFile)[index]}],parent,insertPos:this.getStart(),newText:this.getTemplate().getText(),replacing:{textLength:this.getWidth(),nodes:[this]}}),parent.getChildAtIndex(index)}},TemplateExpressionBase=PrimaryExpression,TemplateExpression=class extends TemplateExpressionBase{getHead(){return this._getNodeFromCompilerNode(this.compilerNode.head)}getTemplateSpans(){return this.compilerNode.templateSpans.map(s=>this._getNodeFromCompilerNode(s))}setLiteralValue(value){let childIndex=this.getChildIndex(),parent=this.getParentSyntaxList()??this.getParentOrThrow();return replaceNodeText({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:value}),parent.getChildAtIndex(childIndex)}},TemplateHeadBase=LiteralLikeNode(Node),TemplateHead=class extends TemplateHeadBase{},TemplateMiddleBase=LiteralLikeNode(Node),TemplateMiddle=class extends TemplateMiddleBase{},TemplateSpanBase=ExpressionedNode(Node),TemplateSpan=class extends TemplateSpanBase{getLiteral(){return this._getNodeFromCompilerNode(this.compilerNode.literal)}},TemplateTailBase=LiteralLikeNode(Node),TemplateTail=class extends TemplateTailBase{},createBase=ctor=>ExportGetableNode(ExclamationTokenableNode(TypedNode(InitializerExpressionableNode(BindingNamedNode(ctor))))),VariableDeclarationBase=createBase(Node),VariableDeclaration=class extends VariableDeclarationBase{remove(){let parent=this.getParentOrThrow();switch(parent.getKind()){case common.SyntaxKind.VariableDeclarationList:removeFromDeclarationList(this);break;case common.SyntaxKind.CatchClause:removeFromCatchClause(this);break;default:throw new common.errors.NotImplementedError(`Not implemented for syntax kind: ${parent.getKindName()}`)}function removeFromDeclarationList(node){let variableStatement=parent.getParentIfKindOrThrow(common.SyntaxKind.VariableStatement);variableStatement.getDeclarations().length===1?variableStatement.remove():removeCommaSeparatedChild(node)}function removeFromCatchClause(node){removeChildren({children:[node.getPreviousSiblingIfKindOrThrow(common.SyntaxKind.OpenParenToken),node,node.getNextSiblingIfKindOrThrow(common.SyntaxKind.CloseParenToken)],removePrecedingSpaces:!0})}}getVariableStatementOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getVariableStatement(),message??"Expected the grandparent to be a variable statement.",this)}getVariableStatement(){let grandParent=this.getParentOrThrow().getParentOrThrow();return Node.isVariableStatement(grandParent)?grandParent:void 0}set(structure){return callBaseSet(VariableDeclarationBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(VariableDeclarationBase.prototype,this,{kind:exports.StructureKind.VariableDeclaration})}},VariableDeclarationListBase=ModifierableNode(Node),VariableDeclarationList=class extends VariableDeclarationListBase{getDeclarations(){return this.compilerNode.declarations.map(d=>this._getNodeFromCompilerNode(d))}getDeclarationKind(){let nodeFlags=this.compilerNode.flags;return nodeFlags&common.ts.NodeFlags.Let?exports.VariableDeclarationKind.Let:(nodeFlags&common.ts.NodeFlags.AwaitUsing)===common.ts.NodeFlags.AwaitUsing?exports.VariableDeclarationKind.AwaitUsing:(nodeFlags&common.ts.NodeFlags.Using)===common.ts.NodeFlags.Using?exports.VariableDeclarationKind.Using:nodeFlags&common.ts.NodeFlags.Const?exports.VariableDeclarationKind.Const:exports.VariableDeclarationKind.Var}getDeclarationKindKeywords(){let declarationKind=this.getDeclarationKind();switch(declarationKind){case exports.VariableDeclarationKind.Const:return[this.getFirstChildByKindOrThrow(common.SyntaxKind.ConstKeyword)];case exports.VariableDeclarationKind.Let:return[this.getFirstChildByKindOrThrow(common.SyntaxKind.LetKeyword)];case exports.VariableDeclarationKind.Var:return[this.getFirstChildByKindOrThrow(common.SyntaxKind.VarKeyword)];case exports.VariableDeclarationKind.Using:return[this.getFirstChildByKindOrThrow(common.SyntaxKind.UsingKeyword)];case exports.VariableDeclarationKind.AwaitUsing:let awaitKeyword=this.getFirstChildByKindOrThrow(common.SyntaxKind.AwaitKeyword),usingKeyword=awaitKeyword.getNextSiblingIfKindOrThrow(common.SyntaxKind.UsingKeyword);return[awaitKeyword,usingKeyword];default:return common.errors.throwNotImplementedForNeverValueError(declarationKind)}}setDeclarationKind(type){if(this.getDeclarationKind()===type)return this;let keywords=this.getDeclarationKindKeywords(),start=keywords[0].getStart(),end=keywords[keywords.length-1].getEnd();return insertIntoParentTextRange({insertPos:start,newText:type,parent:this,replacing:{textLength:end-start}}),this}addDeclaration(structure){return this.addDeclarations([structure])[0]}addDeclarations(structures){return this.insertDeclarations(this.getDeclarations().length,structures)}insertDeclaration(index,structure){return this.insertDeclarations(index,[structure])[0]}insertDeclarations(index,structures){let writer=this._getWriterWithQueuedChildIndentation(),structurePrinter=new CommaSeparatedStructuresPrinter(this._context.structurePrinterFactory.forVariableDeclaration()),originalChildrenCount=this.compilerNode.declarations.length;return index=verifyAndGetIndex(index,originalChildrenCount),structurePrinter.printText(writer,structures),insertIntoCommaSeparatedNodes({parent:this.getFirstChildByKindOrThrow(common.SyntaxKind.SyntaxList),currentNodes:this.getDeclarations(),insertIndex:index,newText:writer.toString(),useTrailingCommas:!1}),getNodesToReturn(originalChildrenCount,this.getDeclarations(),index,!1)}},Signature=class{#context;#compilerSignature;constructor(context,signature){this.#context=context,this.#compilerSignature=signature}get compilerSignature(){return this.#compilerSignature}getTypeParameters(){return(this.compilerSignature.typeParameters||[]).map(t=>this.#context.compilerFactory.getTypeParameter(t))}getParameters(){return this.compilerSignature.parameters.map(p=>this.#context.compilerFactory.getSymbol(p))}getReturnType(){return this.#context.compilerFactory.getType(this.compilerSignature.getReturnType())}getDocumentationComments(){return this.compilerSignature.getDocumentationComment(this.#context.typeChecker.compilerObject).map(d=>this.#context.compilerFactory.getSymbolDisplayPart(d))}getJsDocTags(){return this.compilerSignature.getJsDocTags().map(t=>this.#context.compilerFactory.getJSDocTagInfo(t))}getDeclaration(){let{compilerFactory}=this.#context,compilerSignatureDeclaration=this.compilerSignature.getDeclaration();return compilerFactory.getNodeFromCompilerNode(compilerSignatureDeclaration,compilerFactory.getSourceFileForNode(compilerSignatureDeclaration))}},Symbol2=class{#context;#compilerSymbol;get compilerSymbol(){return this.#compilerSymbol}constructor(context,symbol){this.#context=context,this.#compilerSymbol=symbol,this.getValueDeclaration(),this.getDeclarations()}getName(){return this.compilerSymbol.getName()}getEscapedName(){return this.compilerSymbol.getEscapedName()}getAliasedSymbolOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getAliasedSymbol(),message??"Expected to find an aliased symbol.")}getImmediatelyAliasedSymbol(){return this.#context.typeChecker.getImmediatelyAliasedSymbol(this)}getImmediatelyAliasedSymbolOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getImmediatelyAliasedSymbol(),message??"Expected to find an immediately aliased symbol.")}getAliasedSymbol(){return this.#context.typeChecker.getAliasedSymbol(this)}getExportSymbol(){return this.#context.typeChecker.getExportSymbolOfSymbol(this)}isAlias(){return(this.getFlags()&common.SymbolFlags.Alias)===common.SymbolFlags.Alias}isOptional(){return(this.getFlags()&common.SymbolFlags.Optional)===common.SymbolFlags.Optional}getFlags(){return this.compilerSymbol.getFlags()}hasFlags(flags){return(this.compilerSymbol.flags&flags)===flags}getValueDeclarationOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getValueDeclaration(),message??(()=>`Expected to find the value declaration of symbol '${this.getName()}'.`))}getValueDeclaration(){let declaration=this.compilerSymbol.valueDeclaration;if(declaration!=null)return this.#context.compilerFactory.getNodeFromCompilerNode(declaration,this.#context.compilerFactory.getSourceFileForNode(declaration))}getDeclarations(){return(this.compilerSymbol.declarations??[]).map(d=>this.#context.compilerFactory.getNodeFromCompilerNode(d,this.#context.compilerFactory.getSourceFileForNode(d)))}getExportOrThrow(name,message){return common.errors.throwIfNullOrUndefined(this.getExport(name),message??(()=>`Expected to find export with name: ${name}`))}getExport(name){if(this.compilerSymbol.exports==null)return;let tsSymbol=this.compilerSymbol.exports.get(common.ts.escapeLeadingUnderscores(name));return tsSymbol==null?void 0:this.#context.compilerFactory.getSymbol(tsSymbol)}getExports(){return this.compilerSymbol.exports==null?[]:Array.from(this.compilerSymbol.exports.values()).map(symbol=>this.#context.compilerFactory.getSymbol(symbol))}getGlobalExportOrThrow(name,message){return common.errors.throwIfNullOrUndefined(this.getGlobalExport(name),message??(()=>`Expected to find global export with name: ${name}`))}getGlobalExport(name){if(this.compilerSymbol.globalExports==null)return;let tsSymbol=this.compilerSymbol.globalExports.get(common.ts.escapeLeadingUnderscores(name));return tsSymbol==null?void 0:this.#context.compilerFactory.getSymbol(tsSymbol)}getGlobalExports(){return this.compilerSymbol.globalExports==null?[]:Array.from(this.compilerSymbol.globalExports.values()).map(symbol=>this.#context.compilerFactory.getSymbol(symbol))}getMemberOrThrow(name,message){return common.errors.throwIfNullOrUndefined(this.getMember(name),message??`Expected to find member with name: ${name}`)}getMember(name){if(this.compilerSymbol.members==null)return;let tsSymbol=this.compilerSymbol.members.get(common.ts.escapeLeadingUnderscores(name));return tsSymbol==null?void 0:this.#context.compilerFactory.getSymbol(tsSymbol)}getMembers(){return this.compilerSymbol.members==null?[]:Array.from(this.compilerSymbol.members.values()).map(symbol=>this.#context.compilerFactory.getSymbol(symbol))}getDeclaredType(){return this.#context.typeChecker.getDeclaredTypeOfSymbol(this)}getTypeAtLocation(node){return this.#context.typeChecker.getTypeOfSymbolAtLocation(this,node)}getFullyQualifiedName(){return this.#context.typeChecker.getFullyQualifiedName(this)}getJsDocTags(){return this.compilerSymbol.getJsDocTags(this.#context.typeChecker.compilerObject).map(info=>new JSDocTagInfo(info))}},TextSpan=class{#compilerObject;constructor(compilerObject){this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getStart(){return this.compilerObject.start}getEnd(){return this.compilerObject.start+this.compilerObject.length}getLength(){return this.compilerObject.length}},TextChange=class{#compilerObject;constructor(compilerObject){this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getSpan(){return new TextSpan(this.compilerObject.span)}getNewText(){return this.compilerObject.newText}};__decorate([common.Memoize],TextChange.prototype,"getSpan",null);var FileTextChanges=class{#context;#compilerObject;#sourceFile;#existingFileExists;#isApplied;constructor(context,compilerObject){this.#context=context,this.#compilerObject=compilerObject;let file=context.compilerFactory.addOrGetSourceFileFromFilePath(context.fileSystemWrapper.getStandardizedAbsolutePath(compilerObject.fileName),{markInProject:!1,scriptKind:void 0});this.#existingFileExists=file!=null,compilerObject.isNewFile||(this.#sourceFile=file)}getFilePath(){return this.#compilerObject.fileName}getSourceFile(){return this.#sourceFile}getTextChanges(){return this.#compilerObject.textChanges.map(c=>new TextChange(c))}applyChanges(options={}){if(this.#isApplied)return;if(this.isNewFile()&&this.#existingFileExists&&!options.overwrite)throw new common.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 file;if(this.isNewFile()?file=this.#context.project.createSourceFile(this.getFilePath(),"",{overwrite:options.overwrite}):file=this.getSourceFile(),file==null)throw new common.errors.InvalidOperationError(`Cannot apply file text change to modify existing file that doesn't exist at path: ${this.getFilePath()}`);return file.applyTextChanges(this.getTextChanges()),file._markAsInProject(),this.#isApplied=!0,this}isNewFile(){return!!this.#compilerObject.isNewFile}};__decorate([common.Memoize],FileTextChanges.prototype,"getTextChanges",null);var CodeAction=class{#context;#compilerObject;constructor(context,compilerObject){this.#context=context,this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getDescription(){return this.compilerObject.description}getChanges(){return this.compilerObject.changes.map(change=>new FileTextChanges(this.#context,change))}},CodeFixAction=class extends CodeAction{getFixName(){return this.compilerObject.fixName}getFixId(){return this.compilerObject.fixId}getFixAllDescription(){return this.compilerObject.fixAllDescription}},CombinedCodeActions=class{#context;#compilerObject;constructor(context,compilerObject){this.#context=context,this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getChanges(){return this.compilerObject.changes.map(change=>new FileTextChanges(this.#context,change))}applyChanges(options){for(let change of this.getChanges())change.applyChanges(options);return this}};__decorate([common.Memoize],CombinedCodeActions.prototype,"getChanges",null);var DocumentSpan=class{_context;_compilerObject;_sourceFile;constructor(context,compilerObject){this._context=context,this._compilerObject=compilerObject,this._sourceFile=this._context.compilerFactory.addOrGetSourceFileFromFilePath(context.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 TextSpan(this.compilerObject.textSpan)}getNode(){let textSpan=this.getTextSpan(),sourceFile=this.getSourceFile(),start=textSpan.getStart(),width=textSpan.getEnd();return findBestMatchingNode();function findBestMatchingNode(){let bestNode;return sourceFile._context.compilerFactory.forgetNodesCreatedInBlock(remember=>{let foundNode,nextNode=sourceFile;for(;nextNode!=null;){if(foundNode==null&&(bestNode=nextNode),nextNode.getStart()===start&&nextNode.getWidth()===width)bestNode=foundNode=nextNode;else if(foundNode!=null)break;nextNode=nextNode.getChildAtPos(start)}bestNode!=null&&remember(bestNode)}),bestNode}}getOriginalTextSpan(){let{originalTextSpan}=this.compilerObject;return originalTextSpan==null?void 0:new TextSpan(originalTextSpan)}getOriginalFileName(){return this.compilerObject.originalFileName}};__decorate([common.Memoize],DocumentSpan.prototype,"getTextSpan",null);__decorate([common.Memoize],DocumentSpan.prototype,"getNode",null);__decorate([common.Memoize],DocumentSpan.prototype,"getOriginalTextSpan",null);var DefinitionInfo=class extends DocumentSpan{constructor(context,compilerObject){super(context,compilerObject),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 start=this.getTextSpan().getStart(),identifier=findIdentifier(this.getSourceFile());return identifier?.getParentOrThrow();function findIdentifier(node){if(node.getKind()===common.SyntaxKind.Identifier&&node.getStart()===start)return node;for(let child of node._getChildrenIterator())if(child.getPos()<=start&&child.getEnd()>start)return findIdentifier(child)}}};__decorate([common.Memoize],DefinitionInfo.prototype,"getDeclarationNode",null);var DiagnosticMessageChain=class _DiagnosticMessageChain{_compilerObject;constructor(compilerObject){this._compilerObject=compilerObject}get compilerObject(){return this._compilerObject}getMessageText(){return this.compilerObject.messageText}getNext(){let next=this.compilerObject.next;if(next!=null)return next instanceof Array?next.map(n=>new _DiagnosticMessageChain(n)):[new _DiagnosticMessageChain(next)]}getCode(){return this.compilerObject.code}getCategory(){return this.compilerObject.category}},Diagnostic=class{_context;_compilerObject;constructor(context,compilerObject){this._context=context,this._compilerObject=compilerObject,this.getSourceFile()}get compilerObject(){return this._compilerObject}getSourceFile(){if(this._context==null)return;let file=this.compilerObject.file;return file==null?void 0:this._context.compilerFactory.getSourceFile(file,{markInProject:!1})}getMessageText(){let messageText=this._compilerObject.messageText;return typeof messageText=="string"?messageText:this._context==null?new DiagnosticMessageChain(messageText):this._context.compilerFactory.getDiagnosticMessageChain(messageText)}getLineNumber(){let sourceFile=this.getSourceFile(),start=this.getStart();if(!(sourceFile==null||start==null))return common.StringUtils.getLineNumberAtPos(sourceFile.getFullText(),start)}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}};__decorate([common.Memoize],Diagnostic.prototype,"getSourceFile",null);var DiagnosticWithLocation=class extends Diagnostic{constructor(context,compilerObject){super(context,compilerObject)}getLineNumber(){return super.getLineNumber()}getStart(){return super.getStart()}getLength(){return super.getLength()}getSourceFile(){return super.getSourceFile()}},OutputFile=class{#compilerObject;#context;constructor(context,compilerObject){this.#compilerObject=compilerObject,this.#context=context}get compilerObject(){return this.#compilerObject}getFilePath(){return this.#context.fileSystemWrapper.getStandardizedAbsolutePath(this.compilerObject.name)}getWriteByteOrderMark(){return this.compilerObject.writeByteOrderMark||!1}getText(){return this.compilerObject.text}},EmitOutput=class{#context;#compilerObject;constructor(context,compilerObject){this.#context=context,this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getDiagnostics(){return this.compilerObject.diagnostics.map(d=>this.#context.compilerFactory.getDiagnostic(d))}getEmitSkipped(){return this.compilerObject.emitSkipped}getOutputFiles(){return this.compilerObject.outputFiles.map(f=>new OutputFile(this.#context,f))}};__decorate([common.Memoize],EmitOutput.prototype,"getDiagnostics",null);__decorate([common.Memoize],EmitOutput.prototype,"getOutputFiles",null);var EmitResult=class{_context;_compilerObject;constructor(context,compilerObject){this._context=context,this._compilerObject=compilerObject,this.getDiagnostics()}get compilerObject(){return this._compilerObject}getEmitSkipped(){return this.compilerObject.emitSkipped}getDiagnostics(){return this.compilerObject.diagnostics.map(d=>this._context.compilerFactory.getDiagnostic(d))}};__decorate([common.Memoize],EmitResult.prototype,"getDiagnostics",null);var ImplementationLocation=class extends DocumentSpan{constructor(context,compilerObject){super(context,compilerObject)}getKind(){return this.compilerObject.kind}getDisplayParts(){return this.compilerObject.displayParts.map(p=>this._context.compilerFactory.getSymbolDisplayPart(p))}};__decorate([common.Memoize],ImplementationLocation.prototype,"getDisplayParts",null);var MemoryEmitResult=class extends EmitResult{#files;constructor(context,compilerObject,files){super(context,compilerObject),this.#files=files}getFiles(){return this.#files}saveFiles(){let fileSystem=this._context.fileSystemWrapper,promises=this.#files.map(f=>fileSystem.writeFile(f.filePath,f.writeByteOrderMark?"\uFEFF"+f.text:f.text));return Promise.all(promises)}saveFilesSync(){let fileSystem=this._context.fileSystemWrapper;for(let file of this.#files)fileSystem.writeFileSync(file.filePath,file.writeByteOrderMark?"\uFEFF"+file.text:file.text)}},RefactorEditInfo=class{#context;#compilerObject;constructor(context,compilerObject){this.#context=context,this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getEdits(){return this.compilerObject.edits.map(edit=>new FileTextChanges(this.#context,edit))}getRenameFilePath(){return this.compilerObject.renameFilename}getRenameLocation(){return this.compilerObject.renameLocation}applyChanges(options){for(let change of this.getEdits())change.applyChanges(options);return this}};__decorate([common.Memoize],RefactorEditInfo.prototype,"getEdits",null);var ReferencedSymbol=class{_context;#compilerObject;#references;constructor(context,compilerObject){this._context=context,this.#compilerObject=compilerObject,this.#references=this.compilerObject.references.map(r=>context.compilerFactory.getReferencedSymbolEntry(r))}get compilerObject(){return this.#compilerObject}getDefinition(){return this._context.compilerFactory.getReferencedSymbolDefinitionInfo(this.compilerObject.definition)}getReferences(){return this.#references}};__decorate([common.Memoize],ReferencedSymbol.prototype,"getDefinition",null);var ReferencedSymbolDefinitionInfo=class extends DefinitionInfo{constructor(context,compilerObject){super(context,compilerObject)}getDisplayParts(){return this.compilerObject.displayParts.map(p=>this._context.compilerFactory.getSymbolDisplayPart(p))}};__decorate([common.Memoize],ReferencedSymbolDefinitionInfo.prototype,"getDisplayParts",null);var ReferenceEntry=class extends DocumentSpan{constructor(context,compilerObject){super(context,compilerObject)}isWriteAccess(){return this.compilerObject.isWriteAccess}isInString(){return this.compilerObject.isInString}},ReferencedSymbolEntry=class extends ReferenceEntry{constructor(context,compilerObject){super(context,compilerObject)}isDefinition(){return this.compilerObject.isDefinition}},RenameLocation=class extends DocumentSpan{getPrefixText(){return this._compilerObject.prefixText}getSuffixText(){return this._compilerObject.suffixText}},SymbolDisplayPart=class{#compilerObject;constructor(compilerObject){this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getText(){return this.compilerObject.text}getKind(){return this.compilerObject.kind}},TypeChecker=class{#context;#getCompilerObject;constructor(context){this.#context=context}get compilerObject(){return this.#getCompilerObject()}_reset(getTypeChecker){this.#getCompilerObject=getTypeChecker}getAmbientModules(){return this.compilerObject.getAmbientModules().map(s=>this.#context.compilerFactory.getSymbol(s))}getApparentType(type){return this.#context.compilerFactory.getType(this.compilerObject.getApparentType(type.compilerType))}getConstantValue(node){return this.compilerObject.getConstantValue(node.compilerNode)}getFullyQualifiedName(symbol){return this.compilerObject.getFullyQualifiedName(symbol.compilerSymbol)}getTypeAtLocation(node){return this.#context.compilerFactory.getType(this.compilerObject.getTypeAtLocation(node.compilerNode))}getContextualType(expression){let contextualType=this.compilerObject.getContextualType(expression.compilerNode);return contextualType==null?void 0:this.#context.compilerFactory.getType(contextualType)}getTypeOfSymbolAtLocation(symbol,node){return this.#context.compilerFactory.getType(this.compilerObject.getTypeOfSymbolAtLocation(symbol.compilerSymbol,node.compilerNode))}getDeclaredTypeOfSymbol(symbol){return this.#context.compilerFactory.getType(this.compilerObject.getDeclaredTypeOfSymbol(symbol.compilerSymbol))}getSymbolAtLocation(node){let compilerSymbol=this.compilerObject.getSymbolAtLocation(node.compilerNode);return compilerSymbol==null?void 0:this.#context.compilerFactory.getSymbol(compilerSymbol)}getAliasedSymbol(symbol){if(!symbol.hasFlags(common.SymbolFlags.Alias))return;let tsAliasSymbol=this.compilerObject.getAliasedSymbol(symbol.compilerSymbol);return tsAliasSymbol==null?void 0:this.#context.compilerFactory.getSymbol(tsAliasSymbol)}getImmediatelyAliasedSymbol(symbol){let tsAliasSymbol=this.compilerObject.getImmediateAliasedSymbol(symbol.compilerSymbol);return tsAliasSymbol==null?void 0:this.#context.compilerFactory.getSymbol(tsAliasSymbol)}getExportSymbolOfSymbol(symbol){return this.#context.compilerFactory.getSymbol(this.compilerObject.getExportSymbolOfSymbol(symbol.compilerSymbol))}getPropertiesOfType(type){return this.compilerObject.getPropertiesOfType(type.compilerType).map(p=>this.#context.compilerFactory.getSymbol(p))}getTypeText(type,enclosingNode,typeFormatFlags){return typeFormatFlags==null&&(typeFormatFlags=this.#getDefaultTypeFormatFlags(enclosingNode)),this.compilerObject.typeToString(type.compilerType,enclosingNode?.compilerNode,typeFormatFlags)}getReturnTypeOfSignature(signature){return this.#context.compilerFactory.getType(this.compilerObject.getReturnTypeOfSignature(signature.compilerSignature))}getSignatureFromNode(node){let signature=this.compilerObject.getSignatureFromDeclaration(node.compilerNode);return signature==null?void 0:this.#context.compilerFactory.getSignature(signature)}getExportsOfModule(moduleSymbol){return(this.compilerObject.getExportsOfModule(moduleSymbol.compilerSymbol)||[]).map(s=>this.#context.compilerFactory.getSymbol(s))}getExportSpecifierLocalTargetSymbol(exportSpecifier){let symbol=this.compilerObject.getExportSpecifierLocalTargetSymbol(exportSpecifier.compilerNode);return symbol==null?void 0:this.#context.compilerFactory.getSymbol(symbol)}getResolvedSignature(node){let resolvedSignature=this.compilerObject.getResolvedSignature(node.compilerNode);if(!(!resolvedSignature||!resolvedSignature.declaration))return this.#context.compilerFactory.getSignature(resolvedSignature)}getResolvedSignatureOrThrow(node,message){return common.errors.throwIfNullOrUndefined(this.getResolvedSignature(node),message??"Signature could not be resolved.",node)}getBaseTypeOfLiteralType(type){return this.#context.compilerFactory.getType(this.compilerObject.getBaseTypeOfLiteralType(type.compilerType))}getSymbolsInScope(node,meaning){return this.compilerObject.getSymbolsInScope(node.compilerNode,meaning).map(s=>this.#context.compilerFactory.getSymbol(s))}getTypeArguments(typeReference){return this.compilerObject.getTypeArguments(typeReference.compilerType).map(arg=>this.#context.compilerFactory.getType(arg))}isTypeAssignableTo(sourceType,targetType){return this.compilerObject.isTypeAssignableTo(sourceType.compilerType,targetType.compilerType)}#getDefaultTypeFormatFlags(enclosingNode){let formatFlags=common.TypeFormatFlags.UseTypeOfFunction|common.TypeFormatFlags.NoTruncation|common.TypeFormatFlags.UseFullyQualifiedType|common.TypeFormatFlags.WriteTypeArgumentsOfSignature;return enclosingNode!=null&&enclosingNode.getKind()===common.SyntaxKind.TypeAliasDeclaration&&(formatFlags|=common.TypeFormatFlags.InTypeAlias),formatFlags}getShorthandAssignmentValueSymbol(node){let symbol=this.compilerObject.getShorthandAssignmentValueSymbol(node.compilerNode);return symbol?this.#context.compilerFactory.getSymbol(symbol):void 0}resolveName(name,location2,meaning,excludeGlobals){let symbol=this.compilerObject.resolveName(name,location2?.compilerNode,meaning,excludeGlobals);return symbol?this.#context.compilerFactory.getSymbol(symbol):void 0}},Program=class{#context;#typeChecker;#createdCompilerObject;#oldProgram;#getOrCreateCompilerObject;#configFileParsingDiagnostics;constructor(opts){this.#context=opts.context,this.#configFileParsingDiagnostics=opts.configFileParsingDiagnostics,this.#typeChecker=new TypeChecker(this.#context),this._reset(opts.rootNames,opts.host)}get compilerObject(){return this.#getOrCreateCompilerObject()}_isCompilerProgramCreated(){return this.#createdCompilerObject!=null}_reset(rootNames,host){let compilerOptions=this.#context.compilerOptions.get();this.#getOrCreateCompilerObject=()=>(this.#createdCompilerObject==null&&(this.#createdCompilerObject=common.ts.createProgram(rootNames,compilerOptions,host,this.#oldProgram,this.#configFileParsingDiagnostics),this.#oldProgram=void 0),this.#createdCompilerObject),this.#createdCompilerObject!=null&&(this.#oldProgram=this.#createdCompilerObject,this.#createdCompilerObject=void 0),this.#typeChecker._reset(()=>this.compilerObject.getTypeChecker())}getTypeChecker(){return this.#typeChecker}async emit(options={}){if(options.writeFile){let message=`Cannot specify a ${common.nameof(options,"writeFile")} option when emitting asynchrously. Use ${common.nameof(this,"emitSync")}() instead.`;throw new common.errors.InvalidOperationError(message)}let{fileSystemWrapper}=this.#context,promises=[],emitResult=this.#emit({writeFile:(filePath,text,writeByteOrderMark)=>{promises.push(fileSystemWrapper.writeFile(fileSystemWrapper.getStandardizedAbsolutePath(filePath),writeByteOrderMark?"\uFEFF"+text:text))},...options});return await Promise.all(promises),new EmitResult(this.#context,emitResult)}emitSync(options={}){return new EmitResult(this.#context,this.#emit(options))}emitToMemory(options={}){let sourceFiles=[],{fileSystemWrapper}=this.#context,emitResult=this.#emit({writeFile:(filePath,text,writeByteOrderMark)=>{sourceFiles.push({filePath:fileSystemWrapper.getStandardizedAbsolutePath(filePath),text,writeByteOrderMark:writeByteOrderMark||!1})},...options});return new MemoryEmitResult(this.#context,emitResult,sourceFiles)}#emit(options={}){let targetSourceFile=options.targetSourceFile!=null?options.targetSourceFile.compilerNode:void 0,{emitOnlyDtsFiles,customTransformers,writeFile}=options;return this.compilerObject.emit(targetSourceFile,writeFile,void 0,emitOnlyDtsFiles,customTransformers)}getSyntacticDiagnostics(sourceFile){return this.compilerObject.getSyntacticDiagnostics(sourceFile?.compilerNode).map(d=>this.#context.compilerFactory.getDiagnosticWithLocation(d))}getSemanticDiagnostics(sourceFile){return this.compilerObject.getSemanticDiagnostics(sourceFile?.compilerNode).map(d=>this.#context.compilerFactory.getDiagnostic(d))}getDeclarationDiagnostics(sourceFile){return this.compilerObject.getDeclarationDiagnostics(sourceFile?.compilerNode).map(d=>this.#context.compilerFactory.getDiagnosticWithLocation(d))}getGlobalDiagnostics(){return this.compilerObject.getGlobalDiagnostics().map(d=>this.#context.compilerFactory.getDiagnostic(d))}getConfigFileParsingDiagnostics(){return this.compilerObject.getConfigFileParsingDiagnostics().map(d=>this.#context.compilerFactory.getDiagnostic(d))}getEmitModuleResolutionKind(){return common.getEmitModuleResolutionKind(this.compilerObject.getCompilerOptions())}isSourceFileFromExternalLibrary(sourceFile){return sourceFile.isFromExternalLibrary()}},LanguageService=class{#compilerObject;#compilerHost;#program;#context;#projectVersion=0;get compilerObject(){return this.#compilerObject}constructor(params){this.#context=params.context;let{languageServiceHost,compilerHost}=common.createHosts({transactionalFileSystem:this.#context.fileSystemWrapper,sourceFileContainer:this.#context.getSourceFileContainer(),compilerOptions:this.#context.compilerOptions,getNewLine:()=>this.#context.manipulationSettings.getNewLineKindAsString(),getProjectVersion:()=>`${this.#projectVersion}`,resolutionHost:params.resolutionHost??{},libFolderPath:params.libFolderPath,skipLoadingLibFiles:params.skipLoadingLibFiles});this.#compilerHost=compilerHost,this.#compilerObject=common.ts.createLanguageService(languageServiceHost,this.#context.compilerFactory.documentRegistry),this.#program=new Program({context:this.#context,rootNames:Array.from(this.#context.compilerFactory.getSourceFilePaths()),host:this.#compilerHost,configFileParsingDiagnostics:params.configFileParsingDiagnostics}),this.#context.compilerFactory.onSourceFileAdded(sourceFile=>{sourceFile._isInProject()&&this._reset()}),this.#context.compilerFactory.onSourceFileRemoved(()=>this._reset())}_reset(){this.#projectVersion+=1,this.#program._reset(Array.from(this.#context.compilerFactory.getSourceFilePaths()),this.#compilerHost)}getProgram(){return this.#program}getDefinitions(node){return this.getDefinitionsAtPosition(node._sourceFile,node.getStart())}getDefinitionsAtPosition(sourceFile,pos){return(this.compilerObject.getDefinitionAtPosition(sourceFile.getFilePath(),pos)||[]).map(info=>this.#context.compilerFactory.getDefinitionInfo(info))}getImplementations(node){return this.getImplementationsAtPosition(node._sourceFile,node.getStart())}getImplementationsAtPosition(sourceFile,pos){return(this.compilerObject.getImplementationAtPosition(sourceFile.getFilePath(),pos)||[]).map(location2=>new ImplementationLocation(this.#context,location2))}findReferences(node){return this.findReferencesAtPosition(node._sourceFile,node.getStart())}findReferencesAsNodes(node){let referencedSymbols=this.findReferences(node);return Array.from(getReferencingNodes());function*getReferencingNodes(){for(let referencedSymbol of referencedSymbols){let isAlias=referencedSymbol.getDefinition().getKind()===common.ts.ScriptElementKind.alias,references=referencedSymbol.getReferences();for(let i=0;i0)&&(yield reference.getNode())}}}}findReferencesAtPosition(sourceFile,pos){return(this.compilerObject.findReferences(sourceFile.getFilePath(),pos)||[]).map(s=>this.#context.compilerFactory.getReferencedSymbol(s))}findRenameLocations(node,options={}){let usePrefixAndSuffixText=options.usePrefixAndSuffixText==null?this.#context.manipulationSettings.getUsePrefixAndSuffixTextForRename():options.usePrefixAndSuffixText;return(this.compilerObject.findRenameLocations(node._sourceFile.getFilePath(),node.getStart(),options.renameInStrings||!1,options.renameInComments||!1,usePrefixAndSuffixText)||[]).map(l=>new RenameLocation(this.#context,l))}getSuggestionDiagnostics(filePathOrSourceFile){let filePath=this.#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile);return this.compilerObject.getSuggestionDiagnostics(filePath).map(d=>this.#context.compilerFactory.getDiagnosticWithLocation(d))}getFormattingEditsForRange(filePath,range,formatSettings){return(this.compilerObject.getFormattingEditsForRange(filePath,range[0],range[1],this.#getFilledSettings(formatSettings))||[]).map(e=>new TextChange(e))}getFormattingEditsForDocument(filePath,formatSettings){let standardizedFilePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePath);return(this.compilerObject.getFormattingEditsForDocument(standardizedFilePath,this.#getFilledSettings(formatSettings))||[]).map(e=>new TextChange(e))}getFormattedDocumentText(filePath,formatSettings){let standardizedFilePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePath),sourceFile=this.#context.compilerFactory.getSourceFileFromCacheFromFilePath(standardizedFilePath);if(sourceFile==null)throw new common.errors.FileNotFoundError(standardizedFilePath);formatSettings=this.#getFilledSettings(formatSettings);let formattingEdits=this.getFormattingEditsForDocument(standardizedFilePath,formatSettings),newText=getTextFromTextChanges(sourceFile,formattingEdits),newLineChar=formatSettings.newLineCharacter;return formatSettings.ensureNewLineAtEndOfFile&&!newText.endsWith(newLineChar)&&(newText+=newLineChar),newText.replace(/\r?\n/g,newLineChar)}getEmitOutput(filePathOrSourceFile,emitOnlyDtsFiles){let filePath=this.#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile),compilerObject=this.compilerObject;return new EmitOutput(this.#context,getCompilerEmitOutput());function getCompilerEmitOutput(){let program=compilerObject.getProgram();return program==null||program.getSourceFile(filePath)==null?{emitSkipped:!0,outputFiles:[],diagnostics:[]}:compilerObject.getEmitOutput(filePath,emitOnlyDtsFiles)}}getIdentationAtPosition(filePathOrSourceFile,position,settings){let filePath=this.#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile);return settings==null?settings=this.#context.manipulationSettings.getEditorSettings():fillDefaultEditorSettings(settings,this.#context.manipulationSettings),this.compilerObject.getIndentationAtPosition(filePath,position,settings)}organizeImports(filePathOrSourceFile,formatSettings={},userPreferences={}){let scope={type:"file",fileName:this.#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile)};return this.compilerObject.organizeImports(scope,this.#getFilledSettings(formatSettings),this.#getFilledUserPreferences(userPreferences)).map(fileTextChanges=>new FileTextChanges(this.#context,fileTextChanges))}getEditsForRefactor(filePathOrSourceFile,formatSettings,positionOrRange,refactorName,actionName,preferences={}){let filePath=this.#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile),position=typeof positionOrRange=="number"?positionOrRange:{pos:positionOrRange.getPos(),end:positionOrRange.getEnd()},compilerObject=this.compilerObject.getEditsForRefactor(filePath,this.#getFilledSettings(formatSettings),position,refactorName,actionName,this.#getFilledUserPreferences(preferences));return compilerObject!=null?new RefactorEditInfo(this.#context,compilerObject):void 0}getCombinedCodeFix(filePathOrSourceFile,fixId,formatSettings={},preferences={}){let compilerResult=this.compilerObject.getCombinedCodeFix({type:"file",fileName:this.#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile)},fixId,this.#getFilledSettings(formatSettings),this.#getFilledUserPreferences(preferences||{}));return new CombinedCodeActions(this.#context,compilerResult)}getCodeFixesAtPosition(filePathOrSourceFile,start,end,errorCodes,formatOptions={},preferences={}){let filePath=this.#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile);return this.compilerObject.getCodeFixesAtPosition(filePath,start,end,errorCodes,this.#getFilledSettings(formatOptions),this.#getFilledUserPreferences(preferences||{})).map(compilerObject=>new CodeFixAction(this.#context,compilerObject))}#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile){let filePath=typeof filePathOrSourceFile=="string"?this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePathOrSourceFile):filePathOrSourceFile.getFilePath();if(!this.#context.compilerFactory.containsSourceFileAtPath(filePath))throw new common.errors.FileNotFoundError(filePath);return filePath}#getFilledSettings(settings){return settings._filled||(settings=Object.assign(this.#context.getFormatCodeSettings(),settings),fillDefaultFormatCodeSettings(settings,this.#context.manipulationSettings),settings._filled=!0),settings}#getFilledUserPreferences(userPreferences){return Object.assign(this.#context.getUserPreferences(),userPreferences)}},Type=class{_context;#compilerType;get compilerType(){return this.#compilerType}constructor(context,type){this._context=context,this.#compilerType=type}getText(enclosingNode,typeFormatFlags){return this._context.typeChecker.getTypeText(this,enclosingNode,typeFormatFlags)}getAliasSymbol(){return this.compilerType.aliasSymbol==null?void 0:this._context.compilerFactory.getSymbol(this.compilerType.aliasSymbol)}getAliasSymbolOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getAliasSymbol(),"Expected to find an alias symbol.")}getAliasTypeArguments(){return(this.compilerType.aliasTypeArguments||[]).map(t=>this._context.compilerFactory.getType(t))}getApparentType(){return this._context.typeChecker.getApparentType(this)}getArrayElementTypeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getArrayElementType(),message??"Expected to find an array element type.")}getArrayElementType(){if(this.isArray())return this.getTypeArguments()[0]}getBaseTypes(){return(this.compilerType.getBaseTypes()||[]).map(t=>this._context.compilerFactory.getType(t))}getBaseTypeOfLiteralType(){return this._context.typeChecker.getBaseTypeOfLiteralType(this)}getCallSignatures(){return this.compilerType.getCallSignatures().map(s=>this._context.compilerFactory.getSignature(s))}getConstructSignatures(){return this.compilerType.getConstructSignatures().map(s=>this._context.compilerFactory.getSignature(s))}getConstraintOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getConstraint(),message??"Expected to find a constraint.")}getConstraint(){let constraint=this.compilerType.getConstraint();return constraint==null?void 0:this._context.compilerFactory.getType(constraint)}getDefaultOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getDefault(),message??"Expected to find a default type.")}getDefault(){let defaultType=this.compilerType.getDefault();return defaultType==null?void 0:this._context.compilerFactory.getType(defaultType)}getProperties(){return this.compilerType.getProperties().map(s=>this._context.compilerFactory.getSymbol(s))}getPropertyOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getProperty(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("symbol property",nameOrFindFunction))}getProperty(nameOrFindFunction){return getSymbolByNameOrFindFunction(this.getProperties(),nameOrFindFunction)}getApparentProperties(){return this.compilerType.getApparentProperties().map(s=>this._context.compilerFactory.getSymbol(s))}getApparentProperty(nameOrFindFunction){return getSymbolByNameOrFindFunction(this.getApparentProperties(),nameOrFindFunction)}isNullable(){return this.getUnionTypes().some(t=>t.isNull()||t.isUndefined())}getNonNullableType(){return this._context.compilerFactory.getType(this.compilerType.getNonNullableType())}getNumberIndexType(){let numberIndexType=this.compilerType.getNumberIndexType();return numberIndexType==null?void 0:this._context.compilerFactory.getType(numberIndexType)}getStringIndexType(){let stringIndexType=this.compilerType.getStringIndexType();return stringIndexType==null?void 0:this._context.compilerFactory.getType(stringIndexType)}getTargetType(){let targetType=this.compilerType.target||void 0;return targetType==null?void 0:this._context.compilerFactory.getType(targetType)}getTargetTypeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getTargetType(),message??"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(t=>this._context.compilerFactory.getType(t)):[]}getIntersectionTypes(){return this.isIntersection()?this.compilerType.types.map(t=>this._context.compilerFactory.getType(t)):[]}getLiteralValue(){return this.compilerType?.value}getLiteralValueOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getLiteralValue(),message??"Type was not a literal type.")}getLiteralFreshType(){let type=this.compilerType?.freshType;return type==null?void 0:this._context.compilerFactory.getType(type)}getLiteralFreshTypeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getLiteralFreshType(),message??"Type was not a literal type.")}getLiteralRegularType(){let type=this.compilerType?.regularType;return type==null?void 0:this._context.compilerFactory.getType(type)}getLiteralRegularTypeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getLiteralRegularType(),message??"Type was not a literal type.")}getSymbol(){let tsSymbol=this.compilerType.getSymbol();return tsSymbol==null?void 0:this._context.compilerFactory.getSymbol(tsSymbol)}getSymbolOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getSymbol(),message??"Expected to find a symbol.")}isAssignableTo(target){return this._context.typeChecker.isTypeAssignableTo(this,target)}isAnonymous(){return this.#hasObjectFlag(common.ObjectFlags.Anonymous)}isAny(){return this.#hasTypeFlag(common.TypeFlags.Any)}isNever(){return this.#hasTypeFlag(common.TypeFlags.Never)}isArray(){let symbol=this.getSymbol();return symbol==null?!1:(symbol.getName()==="Array"||symbol.getName()==="ReadonlyArray")&&this.getTypeArguments().length===1}isReadonlyArray(){let symbol=this.getSymbol();return symbol==null?!1:symbol.getName()==="ReadonlyArray"&&this.getTypeArguments().length===1}isTemplateLiteral(){return this.#hasTypeFlag(common.TypeFlags.TemplateLiteral)}isBoolean(){return this.#hasTypeFlag(common.TypeFlags.Boolean)}isString(){return this.#hasTypeFlag(common.TypeFlags.String)}isNumber(){return this.#hasTypeFlag(common.TypeFlags.Number)}isBigInt(){return this.#hasTypeFlag(common.TypeFlags.BigInt)}isLiteral(){let isBooleanLiteralForTs3_0=this.isBooleanLiteral();return this.compilerType.isLiteral()||isBooleanLiteralForTs3_0}isBooleanLiteral(){return this.#hasTypeFlag(common.TypeFlags.BooleanLiteral)}isBigIntLiteral(){return this.#hasTypeFlag(common.TypeFlags.BigIntLiteral)}isEnumLiteral(){return this.#hasTypeFlag(common.TypeFlags.EnumLiteral)&&!this.isUnion()}isNumberLiteral(){return this.#hasTypeFlag(common.TypeFlags.NumberLiteral)}isStringLiteral(){return this.compilerType.isStringLiteral()}isClass(){return this.compilerType.isClass()}isClassOrInterface(){return this.compilerType.isClassOrInterface()}isEnum(){if(this.#hasTypeFlag(common.TypeFlags.Enum))return!0;if(this.isEnumLiteral()&&!this.isUnion())return!1;let symbol=this.getSymbol();if(symbol==null)return!1;let valueDeclaration=symbol.getValueDeclaration();return valueDeclaration!=null&&Node.isEnumDeclaration(valueDeclaration)}isInterface(){return this.#hasObjectFlag(common.ObjectFlags.Interface)}isObject(){return this.#hasTypeFlag(common.TypeFlags.Object)}isTypeParameter(){return this.compilerType.isTypeParameter()}isTuple(){let targetType=this.getTargetType();return targetType==null?!1:targetType.#hasObjectFlag(common.ObjectFlags.Tuple)}isUnion(){return this.compilerType.isUnion()}isIntersection(){return this.compilerType.isIntersection()}isUnionOrIntersection(){return this.compilerType.isUnionOrIntersection()}isUnknown(){return this.#hasTypeFlag(common.TypeFlags.Unknown)}isNull(){return this.#hasTypeFlag(common.TypeFlags.Null)}isUndefined(){return this.#hasTypeFlag(common.TypeFlags.Undefined)}isVoid(){return this.#hasTypeFlag(common.TypeFlags.Void)}getFlags(){return this.compilerType.flags}getObjectFlags(){return this.isObject()&&this.compilerType.objectFlags||0}#hasTypeFlag(flag){return(this.compilerType.flags&flag)===flag}#hasObjectFlag(flag){return(this.getObjectFlags()&flag)===flag}},TypeParameter=class extends Type{getConstraintOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getConstraint(),message??"Expected type parameter to have a constraint.")}getConstraint(){let declaration=this.#getTypeParameterDeclaration();if(declaration==null)return;let constraintNode=declaration.getConstraint();if(constraintNode!=null)return this._context.typeChecker.getTypeAtLocation(constraintNode)}getDefaultOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getDefault(),message??"Expected type parameter to have a default type.")}getDefault(){let declaration=this.#getTypeParameterDeclaration();if(declaration==null)return;let defaultNode=declaration.getDefault();if(defaultNode!=null)return this._context.typeChecker.getTypeAtLocation(defaultNode)}#getTypeParameterDeclaration(){let symbol=this.getSymbol();if(symbol==null)return;let declaration=symbol.getDeclarations()[0];if(declaration!=null&&Node.isTypeParameterDeclaration(declaration))return declaration}},DirectoryEmitResult=class{#outputFilePaths;#skippedFilePaths;constructor(skippedFilePaths,outputFilePaths){this.#skippedFilePaths=skippedFilePaths,this.#outputFilePaths=outputFilePaths}getSkippedFilePaths(){return this.#skippedFilePaths}getOutputFilePaths(){return this.#outputFilePaths}},Directory=class _Directory{#context;#path;#pathParts;constructor(context,path){this.#context=context,this._setPathInternal(path)}_setPathInternal(path){this.#path=path,this.#pathParts=path.split("/").filter(p=>p.length>0)}get _context(){return this.#throwIfDeletedOrRemoved(),this.#context}isAncestorOf(possibleDescendant){return _Directory.#isAncestorOfDir(this,possibleDescendant)}isDescendantOf(possibleAncestor){return _Directory.#isAncestorOfDir(possibleAncestor,this)}_getDepth(){return this.#pathParts.length}getPath(){return this.#throwIfDeletedOrRemoved(),this.#path}getBaseName(){return this.#pathParts[this.#pathParts.length-1]}getParentOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getParent(),message??(()=>`Parent directory of ${this.getPath()} does not exist or was never added.`))}getParent(){if(!common.FileUtils.isRootDirPath(this.getPath()))return this.addDirectoryAtPathIfExists(common.FileUtils.getDirPath(this.getPath()))}getDirectoryOrThrow(pathOrCondition){return common.errors.throwIfNullOrUndefined(this.getDirectory(pathOrCondition),()=>typeof pathOrCondition=="string"?`Could not find a directory at path '${this._context.fileSystemWrapper.getStandardizedAbsolutePath(pathOrCondition,this.getPath())}'.`:"Could not find child directory that matched condition.")}getDirectory(pathOrCondition){if(typeof pathOrCondition=="string"){let path=this._context.fileSystemWrapper.getStandardizedAbsolutePath(pathOrCondition,this.getPath());return this._context.compilerFactory.getDirectoryFromCache(path)}return this.getDirectories().find(pathOrCondition)}getSourceFileOrThrow(pathOrCondition){return common.errors.throwIfNullOrUndefined(this.getSourceFile(pathOrCondition),()=>typeof pathOrCondition=="string"?`Could not find child source file at path '${this._context.fileSystemWrapper.getStandardizedAbsolutePath(pathOrCondition,this.getPath())}'.`:"Could not find child source file that matched condition.")}getSourceFile(pathOrCondition){if(typeof pathOrCondition=="string"){let path=this._context.fileSystemWrapper.getStandardizedAbsolutePath(pathOrCondition,this.getPath());return this._context.compilerFactory.getSourceFileFromCacheFromFilePath(path)}for(let sourceFile of this._getSourceFilesIterator())if(pathOrCondition(sourceFile))return sourceFile}getDirectories(){return Array.from(this._getDirectoriesIterator())}_getDirectoriesIterator(){return this._context.compilerFactory.getChildDirectoriesOfDirectory(this.getPath())}getSourceFiles(globPatterns){let{compilerFactory,fileSystemWrapper}=this._context,dir=this;if(typeof globPatterns=="string"||globPatterns instanceof Array){let finalGlobPatterns=typeof globPatterns=="string"?[globPatterns]:globPatterns;return Array.from(getFilteredSourceFiles(finalGlobPatterns))}else return Array.from(this._getSourceFilesIterator());function*getFilteredSourceFiles(globPatterns2){let sourceFilePaths=Array.from(getSourceFilePaths()),matchedPaths=common.matchGlobs(sourceFilePaths,globPatterns2,dir.getPath());for(let matchedPath of matchedPaths)yield compilerFactory.getSourceFileFromCacheFromFilePath(fileSystemWrapper.getStandardizedAbsolutePath(matchedPath));function*getSourceFilePaths(){for(let sourceFile of dir._getDescendantSourceFilesIterator())yield sourceFile.getFilePath()}}}_getSourceFilesIterator(){return this._context.compilerFactory.getChildSourceFilesOfDirectory(this.getPath())}getDescendantSourceFiles(){return Array.from(this._getDescendantSourceFilesIterator())}*_getDescendantSourceFilesIterator(){for(let sourceFile of this._getSourceFilesIterator())yield sourceFile;for(let directory of this._getDirectoriesIterator())yield*directory._getDescendantSourceFilesIterator()}getDescendantDirectories(){return Array.from(this._getDescendantDirectoriesIterator())}*_getDescendantDirectoriesIterator(){for(let directory of this.getDirectories())yield directory,yield*directory._getDescendantDirectoriesIterator()}addSourceFilesAtPaths(fileGlobs){return fileGlobs=typeof fileGlobs=="string"?[fileGlobs]:fileGlobs,fileGlobs=fileGlobs.map(g=>common.FileUtils.pathIsAbsolute(g)?g:common.FileUtils.pathJoin(this.getPath(),g)),this._context.directoryCoordinator.addSourceFilesAtPaths(fileGlobs,{markInProject:this._isInProject()})}addDirectoryAtPathIfExists(relativeOrAbsoluteDirPath,options={}){let dirPath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(relativeOrAbsoluteDirPath,this.getPath());return this._context.directoryCoordinator.addDirectoryAtPathIfExists(dirPath,{...options,markInProject:this._isInProject()})}addDirectoryAtPath(relativeOrAbsoluteDirPath,options={}){let dirPath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(relativeOrAbsoluteDirPath,this.getPath());return this._context.directoryCoordinator.addDirectoryAtPath(dirPath,{...options,markInProject:this._isInProject()})}createDirectory(relativeOrAbsoluteDirPath){let dirPath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(relativeOrAbsoluteDirPath,this.getPath());return this._context.directoryCoordinator.createDirectoryOrAddIfExists(dirPath,{markInProject:this._isInProject()})}createSourceFile(relativeFilePath,sourceFileText,options){let filePath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(relativeFilePath,this.getPath());return this._context.compilerFactory.createSourceFile(filePath,sourceFileText||"",{...options||{},markInProject:this._isInProject()})}addSourceFileAtPathIfExists(relativeFilePath){let filePath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(relativeFilePath,this.getPath());return this._context.directoryCoordinator.addSourceFileAtPathIfExists(filePath,{markInProject:this._isInProject()})}addSourceFileAtPath(relativeFilePath){let filePath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(relativeFilePath,this.getPath());return this._context.directoryCoordinator.addSourceFileAtPath(filePath,{markInProject:this._isInProject()})}async emit(options={}){let{fileSystemWrapper}=this._context,writeTasks=[],outputFilePaths=[],skippedFilePaths=[];for(let emitResult of this.#emitInternal(options))isStandardizedFilePath(emitResult)?skippedFilePaths.push(emitResult):(writeTasks.push(fileSystemWrapper.writeFile(emitResult.filePath,emitResult.fileText)),outputFilePaths.push(emitResult.filePath));return await Promise.all(writeTasks),new DirectoryEmitResult(skippedFilePaths,outputFilePaths)}emitSync(options={}){let{fileSystemWrapper}=this._context,outputFilePaths=[],skippedFilePaths=[];for(let emitResult of this.#emitInternal(options))isStandardizedFilePath(emitResult)?skippedFilePaths.push(emitResult):(fileSystemWrapper.writeFileSync(emitResult.filePath,emitResult.fileText),outputFilePaths.push(emitResult.filePath));return new DirectoryEmitResult(skippedFilePaths,outputFilePaths)}#emitInternal(options={}){let{emitOnlyDtsFiles=!1}=options,isJsFile=options.outDir==null?void 0:/\.js$/i,isMapFile=options.outDir==null?void 0:/\.js\.map$/i,isDtsFile=options.declarationDir==null&&options.outDir==null?void 0:/\.d\.ts$/i,getStandardizedPath=path=>path==null?void 0:this._context.fileSystemWrapper.getStandardizedAbsolutePath(path,this.getPath()),getSubDirPath=(path,dir)=>path==null?void 0:common.FileUtils.pathJoin(path,dir.getBaseName()),hasDeclarationDir=this._context.compilerOptions.get().declarationDir!=null||options.declarationDir!=null;return emitDirectory(this,getStandardizedPath(options.outDir),getStandardizedPath(options.declarationDir));function*emitDirectory(directory,outDir,declarationDir){for(let sourceFile of directory.getSourceFiles()){let output=sourceFile.getEmitOutput({emitOnlyDtsFiles});if(output.getEmitSkipped()){yield sourceFile.getFilePath();continue}for(let outputFile of output.getOutputFiles()){let filePath=outputFile.getFilePath(),fileText=outputFile.getWriteByteOrderMark()?common.FileUtils.getTextWithByteOrderMark(outputFile.getText()):outputFile.getText();outDir!=null&&(isJsFile.test(filePath)||isMapFile.test(filePath)||!hasDeclarationDir&&isDtsFile.test(filePath))?filePath=common.FileUtils.pathJoin(outDir,common.FileUtils.getBaseName(filePath)):declarationDir!=null&&isDtsFile.test(filePath)&&(filePath=common.FileUtils.pathJoin(declarationDir,common.FileUtils.getBaseName(filePath))),yield{filePath,fileText}}}for(let dir of directory.getDirectories())yield*emitDirectory(dir,getSubDirPath(outDir,dir),getSubDirPath(declarationDir,dir))}}copyToDirectory(dirPathOrDirectory,options){let dirPath=typeof dirPathOrDirectory=="string"?dirPathOrDirectory:dirPathOrDirectory.getPath();return this.copy(common.FileUtils.pathJoin(dirPath,this.getBaseName()),options)}copy(relativeOrAbsolutePath,options){let originalPath=this.getPath(),fileSystem=this._context.fileSystemWrapper,newPath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(relativeOrAbsolutePath,this.getPath());return originalPath===newPath?this:(options=getDirectoryCopyOptions(options),options.includeUntrackedFiles&&fileSystem.queueCopyDirectory(originalPath,newPath),this.#copyInternal(newPath,options))}async copyImmediately(relativeOrAbsolutePath,options){let fileSystem=this._context.fileSystemWrapper,originalPath=this.getPath(),newPath=fileSystem.getStandardizedAbsolutePath(relativeOrAbsolutePath,originalPath);if(originalPath===newPath)return await this.save(),this;options=getDirectoryCopyOptions(options);let newDir=this.#copyInternal(newPath,options);return options.includeUntrackedFiles&&await fileSystem.copyDirectoryImmediately(originalPath,newPath),await newDir.save(),newDir}copyImmediatelySync(relativeOrAbsolutePath,options){let fileSystem=this._context.fileSystemWrapper,originalPath=this.getPath(),newPath=fileSystem.getStandardizedAbsolutePath(relativeOrAbsolutePath,originalPath);if(originalPath===newPath)return this.saveSync(),this;options=getDirectoryCopyOptions(options);let newDir=this.#copyInternal(newPath,options);return options.includeUntrackedFiles&&fileSystem.copyDirectoryImmediatelySync(originalPath,newPath),newDir.saveSync(),newDir}#copyInternal(newPath,options){if(this.getPath()===newPath)return this;let{fileSystemWrapper:fileSystem,compilerFactory}=this._context,copyingDirectories=[this,...this.getDescendantDirectories()].map(directory=>({newDirPath:directory===this?newPath:fileSystem.getStandardizedAbsolutePath(this.getRelativePathTo(directory),newPath)})),copyingSourceFiles=this.getDescendantSourceFiles().map(sourceFile=>({sourceFile,newFilePath:fileSystem.getStandardizedAbsolutePath(this.getRelativePathTo(sourceFile),newPath),references:this.#getReferencesForCopy(sourceFile)}));for(let{newDirPath}of copyingDirectories)this._context.compilerFactory.createDirectoryOrAddIfExists(newDirPath,{markInProject:this._isInProject()});for(let{sourceFile,newFilePath}of copyingSourceFiles)sourceFile._copyInternal(newFilePath,options);for(let{references,newFilePath}of copyingSourceFiles)this.getSourceFileOrThrow(newFilePath)._updateReferencesForCopyInternal(references);return compilerFactory.getDirectoryFromCache(newPath)}moveToDirectory(dirPathOrDirectory,options){let dirPath=typeof dirPathOrDirectory=="string"?dirPathOrDirectory:dirPathOrDirectory.getPath();return this.move(common.FileUtils.pathJoin(dirPath,this.getBaseName()),options)}move(relativeOrAbsolutePath,options){let fileSystem=this._context.fileSystemWrapper,originalPath=this.getPath(),newPath=fileSystem.getStandardizedAbsolutePath(relativeOrAbsolutePath,originalPath);return originalPath===newPath?this:this.#moveInternal(newPath,options,()=>fileSystem.queueMoveDirectory(originalPath,newPath))}async moveImmediately(relativeOrAbsolutePath,options){let fileSystem=this._context.fileSystemWrapper,originalPath=this.getPath(),newPath=fileSystem.getStandardizedAbsolutePath(relativeOrAbsolutePath,originalPath);return originalPath===newPath?(await this.save(),this):(this.#moveInternal(newPath,options),await fileSystem.moveDirectoryImmediately(originalPath,newPath),await this.save(),this)}moveImmediatelySync(relativeOrAbsolutePath,options){let fileSystem=this._context.fileSystemWrapper,originalPath=this.getPath(),newPath=fileSystem.getStandardizedAbsolutePath(relativeOrAbsolutePath,originalPath);return originalPath===newPath?(this.saveSync(),this):(this.#moveInternal(newPath,options),fileSystem.moveDirectoryImmediatelySync(originalPath,newPath),this.saveSync(),this)}#moveInternal(newPath,options,preAction){let originalPath=this.getPath();if(originalPath===newPath)return this;let existingDir=this._context.compilerFactory.getDirectoryFromCacheOnlyIfInCache(newPath),markInProject=existingDir!=null&&existingDir._isInProject();preAction&&preAction();let fileSystem=this._context.fileSystemWrapper,compilerFactory=this._context.compilerFactory,movingDirectories=[this,...this.getDescendantDirectories()].map(directory=>({directory,oldPath:directory.getPath(),newDirPath:directory===this?newPath:fileSystem.getStandardizedAbsolutePath(this.getRelativePathTo(directory),newPath)})),movingSourceFiles=this.getDescendantSourceFiles().map(sourceFile=>({sourceFile,newFilePath:fileSystem.getStandardizedAbsolutePath(this.getRelativePathTo(sourceFile),newPath),references:this.#getReferencesForMove(sourceFile)}));for(let{directory,oldPath,newDirPath}of movingDirectories){compilerFactory.removeDirectoryFromCache(oldPath);let dirToOverwrite=compilerFactory.getDirectoryFromCache(newDirPath);dirToOverwrite?._forgetOnlyThis(),directory._setPathInternal(newDirPath),compilerFactory.addDirectoryToCache(directory)}for(let{sourceFile,newFilePath}of movingSourceFiles)sourceFile._moveInternal(newFilePath,options);for(let{sourceFile,references}of movingSourceFiles)sourceFile._updateReferencesForMoveInternal(references,originalPath);return markInProject&&this._markAsInProject(),this}clear(){let path=this.getPath();this.#deleteDescendants(),this._context.fileSystemWrapper.queueDirectoryDelete(path),this._context.fileSystemWrapper.queueMkdir(path)}async clearImmediately(){let path=this.getPath();this.#deleteDescendants(),await this._context.fileSystemWrapper.clearDirectoryImmediately(path)}clearImmediatelySync(){let path=this.getPath();this.#deleteDescendants(),this._context.fileSystemWrapper.clearDirectoryImmediatelySync(path)}delete(){let path=this.getPath();this.#deleteDescendants(),this._context.fileSystemWrapper.queueDirectoryDelete(path),this.forget()}#deleteDescendants(){for(let sourceFile of this.getSourceFiles())sourceFile.delete();for(let dir of this.getDirectories())dir.delete()}async deleteImmediately(){let{fileSystemWrapper}=this._context,path=this.getPath();this.forget(),await fileSystemWrapper.deleteDirectoryImmediately(path)}deleteImmediatelySync(){let{fileSystemWrapper}=this._context,path=this.getPath();this.forget(),fileSystemWrapper.deleteDirectoryImmediatelySync(path)}forget(){if(!this.wasForgotten()){for(let sourceFile of this.getSourceFiles())sourceFile.forget();for(let dir of this.getDirectories())dir.forget();this._forgetOnlyThis()}}_forgetOnlyThis(){this.wasForgotten()||(this._context.compilerFactory.removeDirectoryFromCache(this.getPath()),this.#context=void 0)}async save(){await this._context.fileSystemWrapper.saveForDirectory(this.getPath());let unsavedSourceFiles=this.getDescendantSourceFiles().filter(s=>!s.isSaved());await Promise.all(unsavedSourceFiles.map(s=>s.save()))}saveSync(){this._context.fileSystemWrapper.saveForDirectorySync(this.getPath()),this.getDescendantSourceFiles().filter(s=>!s.isSaved()).forEach(s=>s.saveSync())}getRelativePathTo(sourceFileDirOrPath){let thisDirectory=this;return common.FileUtils.getRelativePathTo(this.getPath(),getPath());function getPath(){return sourceFileDirOrPath instanceof SourceFile?sourceFileDirOrPath.getFilePath():sourceFileDirOrPath instanceof _Directory?sourceFileDirOrPath.getPath():thisDirectory._context.fileSystemWrapper.getStandardizedAbsolutePath(sourceFileDirOrPath,thisDirectory.getPath())}}getRelativePathAsModuleSpecifierTo(sourceFileDirOrFilePath){let moduleResolution=this._context.program.getEmitModuleResolutionKind(),thisDirectory=this,moduleSpecifier=common.FileUtils.getRelativePathTo(this.getPath(),getPath()).replace(/((\.d\.ts$)|(\.[^/.]+$))/i,"");return moduleSpecifier.startsWith("../")?moduleSpecifier:"./"+moduleSpecifier;function getPath(){return sourceFileDirOrFilePath instanceof SourceFile?getPathForSourceFile(sourceFileDirOrFilePath):sourceFileDirOrFilePath instanceof _Directory?getPathForDirectory(sourceFileDirOrFilePath):getPathForFilePath(thisDirectory._context.fileSystemWrapper.getStandardizedAbsolutePath(sourceFileDirOrFilePath,thisDirectory.getPath()));function getPathForSourceFile(sourceFile){return getPathForFilePath(sourceFile.getFilePath())}function getPathForDirectory(dir){switch(moduleResolution){case common.ModuleResolutionKind.Node10:return dir===thisDirectory?common.FileUtils.pathJoin(dir.getPath(),"index.ts"):dir.getPath();case common.ModuleResolutionKind.Classic:case common.ModuleResolutionKind.Node16:case common.ModuleResolutionKind.NodeNext:case common.ModuleResolutionKind.Bundler:return common.FileUtils.pathJoin(dir.getPath(),"index.ts");default:return common.errors.throwNotImplementedForNeverValueError(moduleResolution)}}function getPathForFilePath(filePath){let dirPath=common.FileUtils.getDirPath(filePath);switch(moduleResolution){case common.ModuleResolutionKind.Node10:return dirPath===thisDirectory.getPath()?filePath:filePath.replace(/\/index?(\.d\.ts|\.ts|\.js)$/i,"");case common.ModuleResolutionKind.Classic:case common.ModuleResolutionKind.Node16:case common.ModuleResolutionKind.NodeNext:case common.ModuleResolutionKind.Bundler:return filePath;default:return common.errors.throwNotImplementedForNeverValueError(moduleResolution)}}}}getProject(){return this._context.project}wasForgotten(){return this.#context==null}_isInProject(){return this._context.inProjectCoordinator.isDirectoryInProject(this)}_markAsInProject(){this._context.inProjectCoordinator.markDirectoryAsInProject(this)}_hasLoadedParent(){return this._context.compilerFactory.containsDirectoryAtPath(common.FileUtils.getDirPath(this.getPath()))}#throwIfDeletedOrRemoved(){if(this.wasForgotten())throw new common.errors.InvalidOperationError("Cannot use a directory that was deleted, removed, or overwritten.")}#getReferencesForCopy(sourceFile){return sourceFile._getReferencesForCopyInternal().filter(r=>!this.isAncestorOf(r[1]))}#getReferencesForMove(sourceFile){let{literalReferences,referencingLiterals}=sourceFile._getReferencesForMoveInternal();return{literalReferences:literalReferences.filter(r=>!this.isAncestorOf(r[1])),referencingLiterals:referencingLiterals.filter(l=>!this.isAncestorOf(l._sourceFile))}}static#isAncestorOfDir(ancestor,descendant){if(descendant instanceof SourceFile&&(descendant=descendant.getDirectory(),ancestor===descendant))return!0;if(ancestor.#pathParts.length>=descendant.#pathParts.length)return!1;for(let i=ancestor.#pathParts.length-1;i>=0;i--)if(ancestor.#pathParts[i]!==descendant.#pathParts[i])return!1;return!0}};function getDirectoryCopyOptions(options){return options=common.ObjectUtils.clone(options||{}),setValueIfUndefined(options,"includeUntrackedFiles",!0),options}function isStandardizedFilePath(filePath){return typeof filePath=="string"}var DirectoryCoordinator=class{#fileSystemWrapper;#compilerFactory;constructor(compilerFactory,fileSystemWrapper){this.#compilerFactory=compilerFactory,this.#fileSystemWrapper=fileSystemWrapper}addDirectoryAtPathIfExists(dirPath,options){let directory=this.#compilerFactory.getDirectoryFromPath(dirPath,options);if(directory!=null){if(options.recursive)for(let descendantDirPath of common.FileUtils.getDescendantDirectories(this.#fileSystemWrapper,dirPath))this.#compilerFactory.createDirectoryOrAddIfExists(descendantDirPath,options);return directory}}addDirectoryAtPath(dirPath,options){let directory=this.addDirectoryAtPathIfExists(dirPath,options);if(directory==null)throw new common.errors.DirectoryNotFoundError(dirPath);return directory}createDirectoryOrAddIfExists(dirPath,options){return this.#compilerFactory.createDirectoryOrAddIfExists(dirPath,options)}addSourceFileAtPathIfExists(filePath,options){return this.#compilerFactory.addOrGetSourceFileFromFilePath(filePath,{markInProject:options.markInProject,scriptKind:void 0})}addSourceFileAtPath(filePath,options){let sourceFile=this.addSourceFileAtPathIfExists(filePath,options);if(sourceFile==null)throw new common.errors.FileNotFoundError(this.#fileSystemWrapper.getStandardizedAbsolutePath(filePath));return sourceFile}addSourceFilesAtPaths(fileGlobs,options){typeof fileGlobs=="string"&&(fileGlobs=[fileGlobs]);let sourceFiles=[],globbedDirectories=new Set;for(let filePath of this.#fileSystemWrapper.globSync(fileGlobs)){let sourceFile=this.addSourceFileAtPathIfExists(filePath,options);sourceFile!=null&&sourceFiles.push(sourceFile),globbedDirectories.add(common.FileUtils.getDirPath(filePath))}for(let dirPath of common.FileUtils.getParentMostPaths(Array.from(globbedDirectories)))this.addDirectoryAtPathIfExists(dirPath,{recursive:!0,markInProject:options.markInProject});return sourceFiles}},DirectoryCache=class{#context;#directoriesByPath=new common.KeyValueCache;#sourceFilesByDirPath=new common.KeyValueCache;#directoriesByDirPath=new common.KeyValueCache;#orphanDirs=new common.KeyValueCache;constructor(context){this.#context=context}has(dirPath){return this.#directoriesByPath.has(dirPath)}get(dirPath){if(!this.#directoriesByPath.has(dirPath)){for(let orphanDir of this.#orphanDirs.getValues())if(common.FileUtils.pathStartsWith(orphanDir.getPath(),dirPath))return this.createOrAddIfExists(dirPath);return}return this.#directoriesByPath.get(dirPath)}getOrphans(){return this.#orphanDirs.getValues()}getAll(){return this.#directoriesByPath.getValuesAsArray()}*getAllByDepth(){let dirLevels=new common.KeyValueCache,depth=0;for(let orphanDir of this.getOrphans())addToDirLevels(orphanDir);for(depth=Math.min(...Array.from(dirLevels.getKeys()));dirLevels.getSize()>0;){for(let dir of dirLevels.get(depth)||[])yield dir,dir.getDirectories().forEach(addToDirLevels);dirLevels.removeByKey(depth),depth++}function addToDirLevels(dir){let dirDepth=dir._getDepth();if(depth>dirDepth)throw new Error(`For some reason a subdirectory had a lower depth than the parent directory: ${dir.getPath()}`);dirLevels.getOrCreate(dirDepth,()=>[]).push(dir)}}remove(dirPath){this.#removeFromDirectoriesByDirPath(dirPath),this.#directoriesByPath.removeByKey(dirPath),this.#orphanDirs.removeByKey(dirPath)}*getChildDirectoriesOfDirectory(dirPath){let entries=this.#directoriesByDirPath.get(dirPath)?.entries();if(entries!=null)for(let dir of entries)yield dir}*getChildSourceFilesOfDirectory(dirPath){let entries=this.#sourceFilesByDirPath.get(dirPath)?.entries();if(entries!=null)for(let sourceFile of entries)yield sourceFile}addSourceFile(sourceFile){let dirPath=sourceFile.getDirectoryPath();this.createOrAddIfExists(dirPath),this.#sourceFilesByDirPath.getOrCreate(dirPath,()=>new common.SortedKeyValueArray(item=>item.getBaseName(),common.LocaleStringComparer.instance)).set(sourceFile)}removeSourceFile(filePath){let dirPath=common.FileUtils.getDirPath(filePath),sourceFiles=this.#sourceFilesByDirPath.get(dirPath);sourceFiles!=null&&(sourceFiles.removeByKey(common.FileUtils.getBaseName(filePath)),sourceFiles.hasItems()||this.#sourceFilesByDirPath.removeByKey(dirPath))}createOrAddIfExists(dirPath){return this.has(dirPath)?this.get(dirPath):(this.#fillParentsOfDirPath(dirPath),this.#createDirectory(dirPath))}#createDirectory(path){let newDirectory=new Directory(this.#context,path);return this.addDirectory(newDirectory),newDirectory}addDirectory(directory){let path=directory.getPath(),parentDirPath=common.FileUtils.getDirPath(path),isRootDir=parentDirPath===path;for(let orphanDir of this.#orphanDirs.getValues()){let orphanDirPath=orphanDir.getPath(),orphanDirParentPath=common.FileUtils.getDirPath(orphanDirPath);!(orphanDirParentPath===orphanDirPath)&&orphanDirParentPath===path&&this.#orphanDirs.removeByKey(orphanDirPath)}isRootDir||this.#addToDirectoriesByDirPath(directory),this.has(parentDirPath)||this.#orphanDirs.set(path,directory),this.#directoriesByPath.set(path,directory),this.#context.fileSystemWrapper.directoryExistsSync(path)||this.#context.fileSystemWrapper.queueMkdir(path);for(let orphanDir of this.#orphanDirs.getValues())directory.isAncestorOf(orphanDir)&&this.#fillParentsOfDirPath(orphanDir.getPath())}#addToDirectoriesByDirPath(directory){if(common.FileUtils.isRootDirPath(directory.getPath()))return;let parentDirPath=common.FileUtils.getDirPath(directory.getPath());this.#directoriesByDirPath.getOrCreate(parentDirPath,()=>new common.SortedKeyValueArray(item=>item.getBaseName(),common.LocaleStringComparer.instance)).set(directory)}#removeFromDirectoriesByDirPath(dirPath){if(common.FileUtils.isRootDirPath(dirPath))return;let parentDirPath=common.FileUtils.getDirPath(dirPath),directories=this.#directoriesByDirPath.get(parentDirPath);directories!=null&&(directories.removeByKey(common.FileUtils.getBaseName(dirPath)),directories.hasItems()||this.#directoriesByDirPath.removeByKey(parentDirPath))}#fillParentsOfDirPath(dirPath){let passedDirPaths=[],parentDir=common.FileUtils.getDirPath(dirPath);for(;dirPath!==parentDir;){if(dirPath=parentDir,parentDir=common.FileUtils.getDirPath(dirPath),this.#directoriesByPath.has(dirPath)){for(let currentDirPath of passedDirPaths)this.#createDirectory(currentDirPath);break}passedDirPaths.unshift(dirPath)}}},ForgetfulNodeCache=class extends common.KeyValueCache{#forgetStack=[];getOrCreate(key,createFunc){return super.getOrCreate(key,()=>{let node=createFunc();return this.#forgetStack.length>0&&this.#forgetStack[this.#forgetStack.length-1].add(node),node})}setForgetPoint(){this.#forgetStack.push(new Set)}forgetLastPoint(){let nodes=this.#forgetStack.pop();nodes!=null&&this.#forgetNodes(nodes.values())}rememberNode(node){if(node.wasForgotten())throw new common.errors.InvalidOperationError("Cannot remember a node that was removed or forgotten.");let wasInForgetStack=!1;for(let stackItem of this.#forgetStack)if(stackItem.delete(node)){wasInForgetStack=!0;break}return wasInForgetStack&&this.#rememberParentOfNode(node),wasInForgetStack}#rememberParentOfNode(node){let parent=node.getParentSyntaxList()||node.getParent();parent!=null&&this.rememberNode(parent)}#forgetNodes(nodes){for(let node of nodes)node.wasForgotten()||node.getKind()===common.SyntaxKind.SourceFile||node._forgetOnlyThis()}},kindToWrapperMappings={[common.SyntaxKind.SourceFile]:SourceFile,[common.SyntaxKind.ArrayBindingPattern]:ArrayBindingPattern,[common.SyntaxKind.ArrayLiteralExpression]:ArrayLiteralExpression,[common.SyntaxKind.ArrayType]:ArrayTypeNode,[common.SyntaxKind.ArrowFunction]:ArrowFunction,[common.SyntaxKind.AsExpression]:AsExpression,[common.SyntaxKind.AwaitExpression]:AwaitExpression,[common.SyntaxKind.BigIntLiteral]:BigIntLiteral,[common.SyntaxKind.BindingElement]:BindingElement,[common.SyntaxKind.BinaryExpression]:BinaryExpression,[common.SyntaxKind.Block]:Block,[common.SyntaxKind.BreakStatement]:BreakStatement,[common.SyntaxKind.CallExpression]:CallExpression,[common.SyntaxKind.CallSignature]:CallSignatureDeclaration,[common.SyntaxKind.CaseBlock]:CaseBlock,[common.SyntaxKind.CaseClause]:CaseClause,[common.SyntaxKind.CatchClause]:CatchClause,[common.SyntaxKind.ClassDeclaration]:ClassDeclaration,[common.SyntaxKind.ClassExpression]:ClassExpression,[common.SyntaxKind.ClassStaticBlockDeclaration]:ClassStaticBlockDeclaration,[common.SyntaxKind.ConditionalType]:ConditionalTypeNode,[common.SyntaxKind.Constructor]:ConstructorDeclaration,[common.SyntaxKind.ConstructorType]:ConstructorTypeNode,[common.SyntaxKind.ConstructSignature]:ConstructSignatureDeclaration,[common.SyntaxKind.ContinueStatement]:ContinueStatement,[common.SyntaxKind.CommaListExpression]:CommaListExpression,[common.SyntaxKind.ComputedPropertyName]:ComputedPropertyName,[common.SyntaxKind.ConditionalExpression]:ConditionalExpression,[common.SyntaxKind.DebuggerStatement]:DebuggerStatement,[common.SyntaxKind.Decorator]:Decorator,[common.SyntaxKind.DefaultClause]:DefaultClause,[common.SyntaxKind.DeleteExpression]:DeleteExpression,[common.SyntaxKind.DoStatement]:DoStatement,[common.SyntaxKind.ElementAccessExpression]:ElementAccessExpression,[common.SyntaxKind.EmptyStatement]:EmptyStatement,[common.SyntaxKind.EnumDeclaration]:EnumDeclaration,[common.SyntaxKind.EnumMember]:EnumMember,[common.SyntaxKind.ExportAssignment]:ExportAssignment,[common.SyntaxKind.ExportDeclaration]:ExportDeclaration,[common.SyntaxKind.ExportSpecifier]:ExportSpecifier,[common.SyntaxKind.ExpressionWithTypeArguments]:ExpressionWithTypeArguments,[common.SyntaxKind.ExpressionStatement]:ExpressionStatement,[common.SyntaxKind.ExternalModuleReference]:ExternalModuleReference,[common.SyntaxKind.QualifiedName]:QualifiedName,[common.SyntaxKind.ForInStatement]:ForInStatement,[common.SyntaxKind.ForOfStatement]:ForOfStatement,[common.SyntaxKind.ForStatement]:ForStatement,[common.SyntaxKind.FunctionDeclaration]:FunctionDeclaration,[common.SyntaxKind.FunctionExpression]:FunctionExpression,[common.SyntaxKind.FunctionType]:FunctionTypeNode,[common.SyntaxKind.GetAccessor]:GetAccessorDeclaration,[common.SyntaxKind.HeritageClause]:HeritageClause,[common.SyntaxKind.Identifier]:Identifier,[common.SyntaxKind.IfStatement]:IfStatement,[common.SyntaxKind.ImportClause]:ImportClause,[common.SyntaxKind.ImportDeclaration]:ImportDeclaration,[common.SyntaxKind.ImportEqualsDeclaration]:ImportEqualsDeclaration,[common.SyntaxKind.ImportSpecifier]:ImportSpecifier,[common.SyntaxKind.ImportType]:ImportTypeNode,[common.SyntaxKind.ImportAttribute]:ImportAttribute,[common.SyntaxKind.ImportAttributes]:ImportAttributes,[common.SyntaxKind.IndexedAccessType]:IndexedAccessTypeNode,[common.SyntaxKind.IndexSignature]:IndexSignatureDeclaration,[common.SyntaxKind.InferType]:InferTypeNode,[common.SyntaxKind.InterfaceDeclaration]:InterfaceDeclaration,[common.SyntaxKind.IntersectionType]:IntersectionTypeNode,[common.SyntaxKind.JSDocAllType]:JSDocAllType,[common.SyntaxKind.JSDocAugmentsTag]:JSDocAugmentsTag,[common.SyntaxKind.JSDocAuthorTag]:JSDocAuthorTag,[common.SyntaxKind.JSDocCallbackTag]:JSDocCallbackTag,[common.SyntaxKind.JSDocClassTag]:JSDocClassTag,[common.SyntaxKind.JSDocDeprecatedTag]:JSDocDeprecatedTag,[common.SyntaxKind.JSDocEnumTag]:JSDocEnumTag,[common.SyntaxKind.JSDocFunctionType]:JSDocFunctionType,[common.SyntaxKind.JSDocImplementsTag]:JSDocImplementsTag,[common.SyntaxKind.JSDocLink]:JSDocLink,[common.SyntaxKind.JSDocLinkCode]:JSDocLinkCode,[common.SyntaxKind.JSDocLinkPlain]:JSDocLinkPlain,[common.SyntaxKind.JSDocMemberName]:JSDocMemberName,[common.SyntaxKind.JSDocNamepathType]:JSDocNamepathType,[common.SyntaxKind.JSDocNameReference]:JSDocNameReference,[common.SyntaxKind.JSDocNonNullableType]:JSDocNonNullableType,[common.SyntaxKind.JSDocNullableType]:JSDocNullableType,[common.SyntaxKind.JSDocOptionalType]:JSDocOptionalType,[common.SyntaxKind.JSDocOverrideTag]:JSDocOverrideTag,[common.SyntaxKind.JSDocParameterTag]:JSDocParameterTag,[common.SyntaxKind.JSDocPrivateTag]:JSDocPrivateTag,[common.SyntaxKind.JSDocPropertyTag]:JSDocPropertyTag,[common.SyntaxKind.JSDocProtectedTag]:JSDocProtectedTag,[common.SyntaxKind.JSDocPublicTag]:JSDocPublicTag,[common.SyntaxKind.JSDocReturnTag]:JSDocReturnTag,[common.SyntaxKind.JSDocReadonlyTag]:JSDocReadonlyTag,[common.SyntaxKind.JSDocThrowsTag]:JSDocThrowsTag,[common.SyntaxKind.JSDocOverloadTag]:JSDocOverloadTag,[common.SyntaxKind.JSDocSatisfiesTag]:JSDocSatisfiesTag,[common.SyntaxKind.JSDocSeeTag]:JSDocSeeTag,[common.SyntaxKind.JSDocSignature]:JSDocSignature,[common.SyntaxKind.JSDocTag]:JSDocUnknownTag,[common.SyntaxKind.JSDocTemplateTag]:JSDocTemplateTag,[common.SyntaxKind.JSDocText]:JSDocText,[common.SyntaxKind.JSDocThisTag]:JSDocThisTag,[common.SyntaxKind.JSDocTypeExpression]:JSDocTypeExpression,[common.SyntaxKind.JSDocTypeLiteral]:JSDocTypeLiteral,[common.SyntaxKind.JSDocTypeTag]:JSDocTypeTag,[common.SyntaxKind.JSDocTypedefTag]:JSDocTypedefTag,[common.SyntaxKind.JSDocUnknownType]:JSDocUnknownType,[common.SyntaxKind.JSDocVariadicType]:JSDocVariadicType,[common.SyntaxKind.JsxAttribute]:JsxAttribute,[common.SyntaxKind.JsxClosingElement]:JsxClosingElement,[common.SyntaxKind.JsxClosingFragment]:JsxClosingFragment,[common.SyntaxKind.JsxElement]:JsxElement,[common.SyntaxKind.JsxExpression]:JsxExpression,[common.SyntaxKind.JsxFragment]:JsxFragment,[common.SyntaxKind.JsxNamespacedName]:JsxNamespacedName,[common.SyntaxKind.JsxOpeningElement]:JsxOpeningElement,[common.SyntaxKind.JsxOpeningFragment]:JsxOpeningFragment,[common.SyntaxKind.JsxSelfClosingElement]:JsxSelfClosingElement,[common.SyntaxKind.JsxSpreadAttribute]:JsxSpreadAttribute,[common.SyntaxKind.JsxText]:JsxText,[common.SyntaxKind.LabeledStatement]:LabeledStatement,[common.SyntaxKind.LiteralType]:LiteralTypeNode,[common.SyntaxKind.MappedType]:MappedTypeNode,[common.SyntaxKind.MetaProperty]:MetaProperty,[common.SyntaxKind.MethodDeclaration]:MethodDeclaration,[common.SyntaxKind.MethodSignature]:MethodSignature,[common.SyntaxKind.ModuleBlock]:ModuleBlock,[common.SyntaxKind.ModuleDeclaration]:ModuleDeclaration,[common.SyntaxKind.NamedExports]:NamedExports,[common.SyntaxKind.NamedImports]:NamedImports,[common.SyntaxKind.NamedTupleMember]:NamedTupleMember,[common.SyntaxKind.NamespaceExport]:NamespaceExport,[common.SyntaxKind.NamespaceImport]:NamespaceImport,[common.SyntaxKind.NewExpression]:NewExpression,[common.SyntaxKind.NonNullExpression]:NonNullExpression,[common.SyntaxKind.NotEmittedStatement]:NotEmittedStatement,[common.SyntaxKind.NoSubstitutionTemplateLiteral]:NoSubstitutionTemplateLiteral,[common.SyntaxKind.NumericLiteral]:NumericLiteral,[common.SyntaxKind.ObjectBindingPattern]:ObjectBindingPattern,[common.SyntaxKind.ObjectLiteralExpression]:ObjectLiteralExpression,[common.SyntaxKind.OmittedExpression]:OmittedExpression,[common.SyntaxKind.Parameter]:ParameterDeclaration,[common.SyntaxKind.ParenthesizedExpression]:ParenthesizedExpression,[common.SyntaxKind.ParenthesizedType]:ParenthesizedTypeNode,[common.SyntaxKind.PartiallyEmittedExpression]:PartiallyEmittedExpression,[common.SyntaxKind.PostfixUnaryExpression]:PostfixUnaryExpression,[common.SyntaxKind.PrefixUnaryExpression]:PrefixUnaryExpression,[common.SyntaxKind.PrivateIdentifier]:PrivateIdentifier,[common.SyntaxKind.PropertyAccessExpression]:PropertyAccessExpression,[common.SyntaxKind.PropertyAssignment]:PropertyAssignment,[common.SyntaxKind.PropertyDeclaration]:PropertyDeclaration,[common.SyntaxKind.PropertySignature]:PropertySignature,[common.SyntaxKind.RegularExpressionLiteral]:RegularExpressionLiteral,[common.SyntaxKind.RestType]:RestTypeNode,[common.SyntaxKind.ReturnStatement]:ReturnStatement,[common.SyntaxKind.SatisfiesExpression]:SatisfiesExpression,[common.SyntaxKind.SetAccessor]:SetAccessorDeclaration,[common.SyntaxKind.ShorthandPropertyAssignment]:ShorthandPropertyAssignment,[common.SyntaxKind.SpreadAssignment]:SpreadAssignment,[common.SyntaxKind.SpreadElement]:SpreadElement,[common.SyntaxKind.StringLiteral]:StringLiteral,[common.SyntaxKind.SwitchStatement]:SwitchStatement,[common.SyntaxKind.SyntaxList]:SyntaxList,[common.SyntaxKind.TaggedTemplateExpression]:TaggedTemplateExpression,[common.SyntaxKind.TemplateExpression]:TemplateExpression,[common.SyntaxKind.TemplateHead]:TemplateHead,[common.SyntaxKind.TemplateLiteralType]:TemplateLiteralTypeNode,[common.SyntaxKind.TemplateMiddle]:TemplateMiddle,[common.SyntaxKind.TemplateSpan]:TemplateSpan,[common.SyntaxKind.TemplateTail]:TemplateTail,[common.SyntaxKind.ThisType]:ThisTypeNode,[common.SyntaxKind.ThrowStatement]:ThrowStatement,[common.SyntaxKind.TryStatement]:TryStatement,[common.SyntaxKind.TupleType]:TupleTypeNode,[common.SyntaxKind.TypeAliasDeclaration]:TypeAliasDeclaration,[common.SyntaxKind.TypeAssertionExpression]:TypeAssertion,[common.SyntaxKind.TypeLiteral]:TypeLiteralNode,[common.SyntaxKind.TypeOperator]:TypeOperatorTypeNode,[common.SyntaxKind.TypeParameter]:TypeParameterDeclaration,[common.SyntaxKind.TypePredicate]:TypePredicateNode,[common.SyntaxKind.TypeQuery]:TypeQueryNode,[common.SyntaxKind.TypeReference]:TypeReferenceNode,[common.SyntaxKind.UnionType]:UnionTypeNode,[common.SyntaxKind.VariableDeclaration]:VariableDeclaration,[common.SyntaxKind.VariableDeclarationList]:VariableDeclarationList,[common.SyntaxKind.VariableStatement]:VariableStatement,[common.SyntaxKind.JSDoc]:JSDoc,[common.SyntaxKind.TypeOfExpression]:TypeOfExpression,[common.SyntaxKind.WhileStatement]:WhileStatement,[common.SyntaxKind.WithStatement]:WithStatement,[common.SyntaxKind.YieldExpression]:YieldExpression,[common.SyntaxKind.SemicolonToken]:Node,[common.SyntaxKind.AnyKeyword]:Expression,[common.SyntaxKind.BooleanKeyword]:Expression,[common.SyntaxKind.FalseKeyword]:FalseLiteral,[common.SyntaxKind.ImportKeyword]:ImportExpression,[common.SyntaxKind.InferKeyword]:Node,[common.SyntaxKind.NeverKeyword]:Node,[common.SyntaxKind.NullKeyword]:NullLiteral,[common.SyntaxKind.NumberKeyword]:Expression,[common.SyntaxKind.ObjectKeyword]:Expression,[common.SyntaxKind.StringKeyword]:Expression,[common.SyntaxKind.SymbolKeyword]:Expression,[common.SyntaxKind.SuperKeyword]:SuperExpression,[common.SyntaxKind.ThisKeyword]:ThisExpression,[common.SyntaxKind.TrueKeyword]:TrueLiteral,[common.SyntaxKind.UndefinedKeyword]:Expression,[common.SyntaxKind.VoidExpression]:VoidExpression},CompilerFactory=class{#context;#sourceFileCacheByFilePath=new Map;#diagnosticCache=new common.WeakCache;#definitionInfoCache=new common.WeakCache;#documentSpanCache=new common.WeakCache;#diagnosticMessageChainCache=new common.WeakCache;#jsDocTagInfoCache=new common.WeakCache;#signatureCache=new common.WeakCache;#symbolCache=new common.WeakCache;#symbolDisplayPartCache=new common.WeakCache;#referencedSymbolEntryCache=new common.WeakCache;#referencedSymbolCache=new common.WeakCache;#referencedSymbolDefinitionInfoCache=new common.WeakCache;#typeCache=new common.WeakCache;#typeParameterCache=new common.WeakCache;#nodeCache=new ForgetfulNodeCache;#directoryCache;#sourceFileAddedEventContainer=new common.EventContainer;#sourceFileRemovedEventContainer=new common.EventContainer;documentRegistry;constructor(context){this.documentRegistry=new common.DocumentRegistry(context.fileSystemWrapper),this.#directoryCache=new DirectoryCache(context),context.compilerOptions.onModified(()=>{let currentSourceFiles=Array.from(this.#sourceFileCacheByFilePath.values());for(let sourceFile of currentSourceFiles)replaceSourceFileForCacheUpdate(sourceFile)}),this.#context=context}*getSourceFilesByDirectoryDepth(){for(let dir of this.getDirectoriesByDepth())yield*dir.getSourceFiles()}getSourceFilePaths(){return this.#sourceFileCacheByFilePath.keys()}getChildDirectoriesOfDirectory(dirPath){return this.#directoryCache.getChildDirectoriesOfDirectory(dirPath)}getChildSourceFilesOfDirectory(dirPath){return this.#directoryCache.getChildSourceFilesOfDirectory(dirPath)}onSourceFileAdded(subscription,subscribe=!0){subscribe?this.#sourceFileAddedEventContainer.subscribe(subscription):this.#sourceFileAddedEventContainer.unsubscribe(subscription)}onSourceFileRemoved(subscription){this.#sourceFileRemovedEventContainer.subscribe(subscription)}createSourceFile(filePath,sourceFileText,options){if(sourceFileText=sourceFileText instanceof Function?getTextFromStringOrWriter(this.#context.createWriter(),sourceFileText):sourceFileText||"",typeof sourceFileText=="string")return this.createSourceFileFromText(filePath,sourceFileText,options);let writer=this.#context.createWriter();return this.#context.structurePrinterFactory.forSourceFile({isAmbient:common.FileUtils.getExtension(filePath)===".d.ts"}).printText(writer,sourceFileText),this.createSourceFileFromText(filePath,writer.toString(),options)}createSourceFileFromText(filePath,sourceText,options){return filePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePath),options.overwrite===!0?this.#createOrOverwriteSourceFileFromText(filePath,sourceText,options):(this.throwIfFileExists(filePath,"Did you mean to provide the overwrite option?"),this.#createSourceFileFromTextInternal(filePath,sourceText,options))}throwIfFileExists(filePath,prefixMessage){if(!(!this.containsSourceFileAtPath(filePath)&&!this.#context.fileSystemWrapper.fileExistsSync(filePath)))throw prefixMessage=prefixMessage==null?"":prefixMessage+" ",new common.errors.InvalidOperationError(`${prefixMessage}A source file already exists at the provided file path: ${filePath}`)}#createOrOverwriteSourceFileFromText(filePath,sourceText,options){filePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePath);let existingSourceFile=this.addOrGetSourceFileFromFilePath(filePath,options);return existingSourceFile!=null?(existingSourceFile.getChildren().forEach(c=>c.forget()),this.replaceCompilerNode(existingSourceFile,this.createCompilerSourceFileFromText(filePath,sourceText,options.scriptKind)),existingSourceFile):this.#createSourceFileFromTextInternal(filePath,sourceText,options)}getSourceFileFromCacheFromFilePath(filePath){return filePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePath),this.#sourceFileCacheByFilePath.get(filePath)}addOrGetSourceFileFromFilePath(filePath,options){filePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePath);let sourceFile=this.#sourceFileCacheByFilePath.get(filePath);if(sourceFile==null){let fileText=this.#context.fileSystemWrapper.readFileIfExistsSync(filePath,this.#context.getEncoding());fileText!=null&&(this.#context.logger.log(`Loaded file: ${filePath}`),sourceFile=this.#createSourceFileFromTextInternal(filePath,fileText,options),sourceFile._setIsSaved(!0))}return sourceFile!=null&&options.markInProject&&sourceFile._markAsInProject(),sourceFile}containsSourceFileAtPath(filePath){return filePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePath),this.#sourceFileCacheByFilePath.has(filePath)}containsDirectoryAtPath(dirPath){return dirPath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(dirPath),this.#directoryCache.has(dirPath)}getSourceFileForNode(compilerNode){let currentNode=compilerNode;for(;currentNode.kind!==common.SyntaxKind.SourceFile;){if(currentNode.parent==null)return;currentNode=currentNode.parent}return this.getSourceFile(currentNode,{markInProject:!1})}hasCompilerNode(compilerNode){return this.#nodeCache.has(compilerNode)}getExistingNodeFromCompilerNode(compilerNode){return this.#nodeCache.get(compilerNode)}getNodeFromCompilerNode(compilerNode,sourceFile){if(compilerNode.kind===common.SyntaxKind.SourceFile)return this.getSourceFile(compilerNode,{markInProject:!1});return this.#nodeCache.getOrCreate(compilerNode,()=>{let node=createNode.call(this);return initializeNode.call(this,node),node});function createNode(){if(isCommentNode(compilerNode))return CommentNodeParser.isCommentStatement(compilerNode)?new CommentStatement(this.#context,compilerNode,sourceFile):CommentNodeParser.isCommentClassElement(compilerNode)?new CommentClassElement(this.#context,compilerNode,sourceFile):CommentNodeParser.isCommentTypeElement(compilerNode)?new CommentTypeElement(this.#context,compilerNode,sourceFile):CommentNodeParser.isCommentObjectLiteralElement(compilerNode)?new CommentObjectLiteralElement(this.#context,compilerNode,sourceFile):CommentNodeParser.isCommentEnumMember(compilerNode)?new CommentEnumMember(this.#context,compilerNode,sourceFile):common.errors.throwNotImplementedForNeverValueError(compilerNode);let ctor=kindToWrapperMappings[compilerNode.kind]||Node;return new ctor(this.#context,compilerNode,sourceFile)}function isCommentNode(node){return node._commentKind!=null}function initializeNode(node){if(compilerNode.parent!=null){let parentNode=this.getNodeFromCompilerNode(compilerNode.parent,sourceFile);parentNode._wrappedChildCount++}let parentSyntaxList=node._getParentSyntaxListIfWrapped();if(parentSyntaxList!=null&&parentSyntaxList._wrappedChildCount++,compilerNode.kind===common.SyntaxKind.SyntaxList){let count=0;for(let _ of node._getChildrenInCacheIterator())count++;node._wrappedChildCount=count}}}#createSourceFileFromTextInternal(filePath,text,options){let hasBom=common.StringUtils.hasBom(text);hasBom&&(text=common.StringUtils.stripBom(text));let sourceFile=this.getSourceFile(this.createCompilerSourceFileFromText(filePath,text,options.scriptKind),options);return hasBom&&(sourceFile._hasBom=!0),sourceFile}createCompilerSourceFileFromText(filePath,text,scriptKind){return this.documentRegistry.createOrUpdateSourceFile(filePath,this.#context.compilerOptions.get(),common.ts.ScriptSnapshot.fromString(text),scriptKind)}getSourceFile(compilerSourceFile,options){let wasAdded=!1,sourceFile=this.#sourceFileCacheByFilePath.get(compilerSourceFile.fileName)??this.#nodeCache.getOrCreate(compilerSourceFile,()=>{let createdSourceFile=new SourceFile(this.#context,compilerSourceFile);return options.markInProject||this.#context.inProjectCoordinator.setSourceFileNotInProject(createdSourceFile),this.#addSourceFileToCache(createdSourceFile),wasAdded=!0,createdSourceFile});return options.markInProject&&sourceFile._markAsInProject(),wasAdded&&this.#sourceFileAddedEventContainer.fire(sourceFile),sourceFile}#addSourceFileToCache(sourceFile){this.#sourceFileCacheByFilePath.set(sourceFile.getFilePath(),sourceFile),this.#context.fileSystemWrapper.removeFileDelete(sourceFile.getFilePath()),this.#directoryCache.addSourceFile(sourceFile)}getDirectoryFromPath(dirPath,options){dirPath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(dirPath);let directory=this.#directoryCache.get(dirPath);return directory==null&&this.#context.fileSystemWrapper.directoryExistsSync(dirPath)&&(directory=this.#directoryCache.createOrAddIfExists(dirPath)),directory!=null&&options.markInProject&&directory._markAsInProject(),directory}createDirectoryOrAddIfExists(dirPath,options){let directory=this.#directoryCache.createOrAddIfExists(dirPath);return directory!=null&&options.markInProject&&directory._markAsInProject(),directory}getDirectoryFromCache(dirPath){return this.#directoryCache.get(dirPath)}getDirectoryFromCacheOnlyIfInCache(dirPath){return this.#directoryCache.has(dirPath)?this.#directoryCache.get(dirPath):void 0}getDirectoriesByDepth(){return this.#directoryCache.getAllByDepth()}getOrphanDirectories(){return this.#directoryCache.getOrphans()}getSymbolDisplayPart(compilerObject){return this.#symbolDisplayPartCache.getOrCreate(compilerObject,()=>new SymbolDisplayPart(compilerObject))}getType(type){return(type.flags&common.TypeFlags.TypeParameter)===common.TypeFlags.TypeParameter?this.getTypeParameter(type):this.#typeCache.getOrCreate(type,()=>new Type(this.#context,type))}getTypeParameter(typeParameter){return this.#typeParameterCache.getOrCreate(typeParameter,()=>new TypeParameter(this.#context,typeParameter))}getSignature(signature){return this.#signatureCache.getOrCreate(signature,()=>new Signature(this.#context,signature))}getSymbol(symbol){return this.#symbolCache.getOrCreate(symbol,()=>new Symbol2(this.#context,symbol))}getDefinitionInfo(compilerObject){return this.#definitionInfoCache.getOrCreate(compilerObject,()=>new DefinitionInfo(this.#context,compilerObject))}getDocumentSpan(compilerObject){return this.#documentSpanCache.getOrCreate(compilerObject,()=>new DocumentSpan(this.#context,compilerObject))}getReferencedSymbolEntry(compilerObject){return this.#referencedSymbolEntryCache.getOrCreate(compilerObject,()=>new ReferencedSymbolEntry(this.#context,compilerObject))}getReferencedSymbol(compilerObject){return this.#referencedSymbolCache.getOrCreate(compilerObject,()=>new ReferencedSymbol(this.#context,compilerObject))}getReferencedSymbolDefinitionInfo(compilerObject){return this.#referencedSymbolDefinitionInfoCache.getOrCreate(compilerObject,()=>new ReferencedSymbolDefinitionInfo(this.#context,compilerObject))}getDiagnostic(diagnostic){return this.#diagnosticCache.getOrCreate(diagnostic,()=>diagnostic.start!=null?new DiagnosticWithLocation(this.#context,diagnostic):new Diagnostic(this.#context,diagnostic))}getDiagnosticWithLocation(diagnostic){return this.#diagnosticCache.getOrCreate(diagnostic,()=>new DiagnosticWithLocation(this.#context,diagnostic))}getDiagnosticMessageChain(compilerObject){return this.#diagnosticMessageChainCache.getOrCreate(compilerObject,()=>new DiagnosticMessageChain(compilerObject))}getJSDocTagInfo(jsDocTagInfo){return this.#jsDocTagInfoCache.getOrCreate(jsDocTagInfo,()=>new JSDocTagInfo(jsDocTagInfo))}replaceCompilerNode(oldNode,newNode){let nodeToReplace=oldNode instanceof Node?oldNode.compilerNode:oldNode,node=oldNode instanceof Node?oldNode:this.#nodeCache.get(oldNode);if(nodeToReplace.kind===common.SyntaxKind.SourceFile&&nodeToReplace.fileName!==newNode.fileName){let sourceFile=node;this.#removeCompilerNodeFromCache(nodeToReplace),sourceFile._replaceCompilerNodeFromFactory(newNode),this.#nodeCache.set(newNode,sourceFile),this.#addSourceFileToCache(sourceFile),this.#sourceFileAddedEventContainer.fire(sourceFile)}else this.#nodeCache.replaceKey(nodeToReplace,newNode),node?._replaceCompilerNodeFromFactory(newNode)}removeNodeFromCache(node){this.#removeCompilerNodeFromCache(node.compilerNode)}#removeCompilerNodeFromCache(compilerNode){if(this.#nodeCache.removeByKey(compilerNode),compilerNode.kind===common.SyntaxKind.SourceFile){let sourceFile=compilerNode,standardizedFilePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(sourceFile.fileName);this.#directoryCache.removeSourceFile(standardizedFilePath);let wrappedSourceFile=this.#sourceFileCacheByFilePath.get(standardizedFilePath);this.#sourceFileCacheByFilePath.delete(standardizedFilePath),this.documentRegistry.removeSourceFile(standardizedFilePath),wrappedSourceFile!=null&&this.#sourceFileRemovedEventContainer.fire(wrappedSourceFile)}}addDirectoryToCache(directory){this.#directoryCache.addDirectory(directory)}removeDirectoryFromCache(dirPath){this.#directoryCache.remove(dirPath)}forgetNodesCreatedInBlock(block){this.#nodeCache.setForgetPoint();let wasPromise=!1,result;try{if(result=block((...nodes)=>{for(let node of nodes)this.#nodeCache.rememberNode(node)}),Node.isNode(result)&&this.#nodeCache.rememberNode(result),isPromise(result))return wasPromise=!0,result.then(value=>(Node.isNode(value)&&this.#nodeCache.rememberNode(value),this.#nodeCache.forgetLastPoint(),value))}finally{wasPromise||this.#nodeCache.forgetLastPoint()}return result;function isPromise(value){return value!=null&&typeof value.then=="function"}}},InProjectCoordinator=class{#compilerFactory;#notInProjectFiles=new Set;constructor(compilerFactory){compilerFactory.onSourceFileRemoved(sourceFile=>{this.#notInProjectFiles.delete(sourceFile)}),this.#compilerFactory=compilerFactory}setSourceFileNotInProject(sourceFile){this.#notInProjectFiles.add(sourceFile),sourceFile._inProject=!1}markSourceFileAsInProject(sourceFile){this.isSourceFileInProject(sourceFile)||(this.#internalMarkSourceFileAsInProject(sourceFile),this.#notInProjectFiles.delete(sourceFile))}markSourceFilesAsInProjectForResolution(){let nodeModulesSearchName="/node_modules/",compilerFactory=this.#compilerFactory,changedSourceFiles=[],unchangedSourceFiles=[];for(let sourceFile of[...this.#notInProjectFiles.values()])shouldMarkInProject(sourceFile)?(this.#internalMarkSourceFileAsInProject(sourceFile),this.#notInProjectFiles.delete(sourceFile),changedSourceFiles.push(sourceFile)):unchangedSourceFiles.push(sourceFile);return{changedSourceFiles,unchangedSourceFiles};function shouldMarkInProject(sourceFile){let filePath=sourceFile.getFilePath(),index=filePath.toLowerCase().lastIndexOf(nodeModulesSearchName);if(index===-1)return!0;let nodeModulesPath=filePath.substring(0,index+nodeModulesSearchName.length-1),nodeModulesDir=compilerFactory.getDirectoryFromCacheOnlyIfInCache(nodeModulesPath);if(nodeModulesDir!=null&&nodeModulesDir._isInProject())return!0;let directory=sourceFile.getDirectory();for(;directory!=null&&directory.getPath()!==nodeModulesPath;){if(directory._isInProject())return!0;directory=compilerFactory.getDirectoryFromCacheOnlyIfInCache(common.FileUtils.getDirPath(directory.getPath()))}return!1}}#internalMarkSourceFileAsInProject(sourceFile){sourceFile._inProject=!0,this.markDirectoryAsInProject(sourceFile.getDirectory())}isSourceFileInProject(sourceFile){return sourceFile._inProject===!0}setDirectoryAndFilesAsNotInProjectForTesting(directory){for(let subDir of directory.getDirectories())this.setDirectoryAndFilesAsNotInProjectForTesting(subDir);for(let file of directory.getSourceFiles())delete file._inProject,this.#notInProjectFiles.add(file);delete directory._inProject}markDirectoryAsInProject(directory){if(this.isDirectoryInProject(directory))return;let inProjectCoordinator=this,compilerFactory=this.#compilerFactory;directory._inProject=!0,markAncestorDirs(directory);function markAncestorDirs(dir){let ancestorDirs=Array.from(getAncestorsUpToOneInProject(dir)),topAncestor=ancestorDirs[ancestorDirs.length-1];if(!(topAncestor==null||!inProjectCoordinator.isDirectoryInProject(topAncestor)))for(let ancestorDir of ancestorDirs)ancestorDir._inProject=!0}function*getAncestorsUpToOneInProject(dir){if(common.FileUtils.isRootDirPath(dir.getPath()))return;let parentDirPath=common.FileUtils.getDirPath(dir.getPath()),parentDir=compilerFactory.getDirectoryFromCacheOnlyIfInCache(parentDirPath);parentDir!=null&&(yield parentDir,inProjectCoordinator.isDirectoryInProject(parentDir)||(yield*getAncestorsUpToOneInProject(parentDir)))}}isDirectoryInProject(directory){return directory._inProject===!0}},StructurePrinterFactory=class{_getFormatCodeSettings;constructor(_getFormatCodeSettings){this._getFormatCodeSettings=_getFormatCodeSettings}getFormatCodeSettings(){return this._getFormatCodeSettings()}forInitializerExpressionableNode(){return new InitializerExpressionableNodeStructurePrinter}forModifierableNode(){return new ModifierableNodeStructurePrinter}forReturnTypedNode(alwaysWrite){return new ReturnTypedNodeStructurePrinter(alwaysWrite)}forTypedNode(separator,alwaysWrite){return new TypedNodeStructurePrinter(separator,alwaysWrite)}forClassDeclaration(options){return new ClassDeclarationStructurePrinter(this,options)}forClassMember(options){return new ClassMemberStructurePrinter(this,options)}forClassStaticBlockDeclaration(){return new ClassStaticBlockDeclarationStructurePrinter(this)}forConstructorDeclaration(options){return new ConstructorDeclarationStructurePrinter(this,options)}forGetAccessorDeclaration(options){return new GetAccessorDeclarationStructurePrinter(this,options)}forMethodDeclaration(options){return new MethodDeclarationStructurePrinter(this,options)}forPropertyDeclaration(){return new PropertyDeclarationStructurePrinter(this)}forSetAccessorDeclaration(options){return new SetAccessorDeclarationStructurePrinter(this,options)}forDecorator(){return new DecoratorStructurePrinter(this)}forJSDoc(){return new JSDocStructurePrinter(this)}forJSDocTag(options){return new JSDocTagStructurePrinter(this,options)}forEnumDeclaration(){return new EnumDeclarationStructurePrinter(this)}forEnumMember(){return new EnumMemberStructurePrinter(this)}forObjectLiteralExpressionProperty(){return new ObjectLiteralExpressionPropertyStructurePrinter(this)}forPropertyAssignment(){return new PropertyAssignmentStructurePrinter(this)}forShorthandPropertyAssignment(){return new ShorthandPropertyAssignmentStructurePrinter(this)}forSpreadAssignment(){return new SpreadAssignmentStructurePrinter(this)}forFunctionDeclaration(options){return new FunctionDeclarationStructurePrinter(this,options)}forParameterDeclaration(){return new ParameterDeclarationStructurePrinter(this)}forCallSignatureDeclaration(){return new CallSignatureDeclarationStructurePrinter(this)}forConstructSignatureDeclaration(){return new ConstructSignatureDeclarationStructurePrinter(this)}forIndexSignatureDeclaration(){return new IndexSignatureDeclarationStructurePrinter(this)}forInterfaceDeclaration(){return new InterfaceDeclarationStructurePrinter(this)}forMethodSignature(){return new MethodSignatureStructurePrinter(this)}forPropertySignature(){return new PropertySignatureStructurePrinter(this)}forTypeElementMemberedNode(){return new TypeElementMemberedNodeStructurePrinter(this)}forTypeElementMember(){return new TypeElementMemberStructurePrinter(this)}forJsxAttributeDecider(){return new JsxAttributeDeciderStructurePrinter(this)}forJsxAttribute(){return new JsxAttributeStructurePrinter(this)}forJsxChildDecider(){return new JsxChildDeciderStructurePrinter(this)}forJsxElement(){return new JsxElementStructurePrinter(this)}forJsxNamespacedName(){return new JsxNamespacedNameStructurePrinter(this)}forJsxSelfClosingElement(){return new JsxSelfClosingElementStructurePrinter(this)}forJsxSpreadAttribute(){return new JsxSpreadAttributeStructurePrinter(this)}forExportAssignment(){return new ExportAssignmentStructurePrinter(this)}forExportDeclaration(){return new ExportDeclarationStructurePrinter(this)}forImportAttribute(){return new ImportAttributeStructurePrinter(this)}forImportDeclaration(){return new ImportDeclarationStructurePrinter(this)}forModuleDeclaration(options){return new ModuleDeclarationStructurePrinter(this,options)}forNamedImportExportSpecifier(){return new NamedImportExportSpecifierStructurePrinter(this)}forSourceFile(options){return new SourceFileStructurePrinter(this,options)}forStatementedNode(options){return new StatementedNodeStructurePrinter(this,options)}forStatement(options){return new StatementStructurePrinter(this,options)}forVariableStatement(){return new VariableStatementStructurePrinter(this)}forTypeAliasDeclaration(){return new TypeAliasDeclarationStructurePrinter(this)}forTypeParameterDeclaration(){return new TypeParameterDeclarationStructurePrinter(this)}forVariableDeclaration(){return new VariableDeclarationStructurePrinter(this)}};__decorate([common.Memoize],StructurePrinterFactory.prototype,"forInitializerExpressionableNode",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forModifierableNode",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forReturnTypedNode",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forTypedNode",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forClassDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forClassMember",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forClassStaticBlockDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forConstructorDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forGetAccessorDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forMethodDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forPropertyDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forSetAccessorDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forDecorator",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJSDoc",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJSDocTag",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forEnumDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forEnumMember",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forObjectLiteralExpressionProperty",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forPropertyAssignment",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forShorthandPropertyAssignment",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forSpreadAssignment",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forFunctionDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forParameterDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forCallSignatureDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forConstructSignatureDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forIndexSignatureDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forInterfaceDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forMethodSignature",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forPropertySignature",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forTypeElementMemberedNode",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forTypeElementMember",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJsxAttributeDecider",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJsxAttribute",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJsxChildDecider",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJsxElement",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJsxNamespacedName",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJsxSelfClosingElement",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJsxSpreadAttribute",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forExportAssignment",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forExportDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forImportAttribute",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forImportDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forModuleDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forNamedImportExportSpecifier",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forSourceFile",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forStatementedNode",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forStatement",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forVariableStatement",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forTypeAliasDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forTypeParameterDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forVariableDeclaration",null);var ProjectContext=class{#languageService;#compilerOptions;#customTypeChecker;#project;get project(){if(this.#project==null)throw new common.errors.InvalidOperationError("This operation is not permitted in this context.");return this.#project}logger=new ConsoleLogger;lazyReferenceCoordinator;directoryCoordinator;fileSystemWrapper;manipulationSettings=new ManipulationSettingsContainer;structurePrinterFactory;compilerFactory;inProjectCoordinator;constructor(params){this.#project=params.project,this.fileSystemWrapper=params.fileSystemWrapper,this.#compilerOptions=params.compilerOptionsContainer,this.compilerFactory=new CompilerFactory(this),this.inProjectCoordinator=new InProjectCoordinator(this.compilerFactory),this.structurePrinterFactory=new StructurePrinterFactory(()=>this.manipulationSettings.getFormatCodeSettings()),this.lazyReferenceCoordinator=new LazyReferenceCoordinator(this.compilerFactory),this.directoryCoordinator=new DirectoryCoordinator(this.compilerFactory,params.fileSystemWrapper),this.#languageService=params.createLanguageService?new LanguageService({context:this,configFileParsingDiagnostics:params.configFileParsingDiagnostics,resolutionHost:params.resolutionHost&¶ms.resolutionHost(this.getModuleResolutionHost(),()=>this.compilerOptions.get()),skipLoadingLibFiles:params.skipLoadingLibFiles,libFolderPath:params.libFolderPath}):void 0,params.typeChecker!=null&&(common.errors.throwIfTrue(params.createLanguageService,"Cannot specify a type checker and create a language service."),this.#customTypeChecker=new TypeChecker(this),this.#customTypeChecker._reset(()=>params.typeChecker))}get compilerOptions(){return this.#compilerOptions}get languageService(){if(this.#languageService==null)throw this.#getToolRequiredError("language service");return this.#languageService}get program(){if(this.#languageService==null)throw this.#getToolRequiredError("program");return this.languageService.getProgram()}get typeChecker(){if(this.#customTypeChecker!=null)return this.#customTypeChecker;if(this.#languageService==null)throw this.#getToolRequiredError("type checker");return this.program.getTypeChecker()}hasLanguageService(){return this.#languageService!=null}getEncoding(){return this.compilerOptions.getEncoding()}getFormatCodeSettings(){return this.manipulationSettings.getFormatCodeSettings()}getUserPreferences(){return this.manipulationSettings.getUserPreferences()}resetProgram(){this.languageService._reset()}createWriter(){let indentationText=this.manipulationSettings.getIndentationText();return new CodeBlockWriter__default.default({newLine:this.manipulationSettings.getNewLineKindAsString(),indentNumberOfSpaces:indentationText===exports.IndentationText.Tab?void 0:indentationText.length,useTabs:indentationText===exports.IndentationText.Tab,useSingleQuote:this.manipulationSettings.getQuoteKind()===exports.QuoteKind.Single})}getPreEmitDiagnostics(sourceFile){return common.ts.getPreEmitDiagnostics(this.program.compilerObject,sourceFile?.compilerNode).map(d=>this.compilerFactory.getDiagnostic(d))}getSourceFileContainer(){return{addOrGetSourceFileFromFilePath:(filePath,opts)=>Promise.resolve(this.compilerFactory.addOrGetSourceFileFromFilePath(filePath,opts)?.compilerNode),addOrGetSourceFileFromFilePathSync:(filePath,opts)=>this.compilerFactory.addOrGetSourceFileFromFilePath(filePath,opts)?.compilerNode,containsDirectoryAtPath:dirPath=>this.compilerFactory.containsDirectoryAtPath(dirPath),containsSourceFileAtPath:filePath=>this.compilerFactory.containsSourceFileAtPath(filePath),getSourceFileFromCacheFromFilePath:filePath=>this.compilerFactory.getSourceFileFromCacheFromFilePath(filePath)?.compilerNode,getSourceFilePaths:()=>this.compilerFactory.getSourceFilePaths(),getSourceFileVersion:sourceFile=>this.compilerFactory.documentRegistry.getSourceFileVersion(sourceFile),getChildDirectoriesOfDirectory:dirPath=>{let result=[];for(let dir of this.compilerFactory.getChildDirectoriesOfDirectory(dirPath))result.push(dir.getPath());return result}}}getModuleResolutionHost(){return common.createModuleResolutionHost({transactionalFileSystem:this.fileSystemWrapper,getEncoding:()=>this.getEncoding(),sourceFileContainer:this.getSourceFileContainer()})}#getToolRequiredError(name){return new common.errors.InvalidOperationError(`A ${name} 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 ${name} should be required for this operation.`)}};__decorate([common.Memoize],ProjectContext.prototype,"getSourceFileContainer",null);__decorate([common.Memoize],ProjectContext.prototype,"getModuleResolutionHost",null);var Project2=class{_context;constructor(options={}){verifyOptions();let fileSystem=getFileSystem(),fileSystemWrapper=new common.TransactionalFileSystem({fileSystem,skipLoadingLibFiles:options.skipLoadingLibFiles,libFolderPath:options.libFolderPath}),tsConfigResolver=options.tsConfigFilePath==null?void 0:new common.TsConfigResolver(fileSystemWrapper,fileSystemWrapper.getStandardizedAbsolutePath(options.tsConfigFilePath),getEncoding()),compilerOptions=getCompilerOptions(),compilerOptionsContainer=new common.CompilerOptionsContainer(options.defaultCompilerOptions);compilerOptionsContainer.set(compilerOptions),this._context=new ProjectContext({project:this,compilerOptionsContainer,fileSystemWrapper,createLanguageService:!0,resolutionHost:options.resolutionHost,configFileParsingDiagnostics:tsConfigResolver?.getErrors()??[],skipLoadingLibFiles:options.skipLoadingLibFiles,libFolderPath:options.libFolderPath}),options.manipulationSettings!=null&&this._context.manipulationSettings.set(options.manipulationSettings),tsConfigResolver!=null&&options.skipAddingFilesFromTsConfig!==!0&&(this.#addSourceFilesForTsConfigResolver(tsConfigResolver,compilerOptions),options.skipFileDependencyResolution||this.resolveSourceFileDependencies());function verifyOptions(){if(options.fileSystem!=null&&options.useInMemoryFileSystem)throw new common.errors.InvalidOperationError("Cannot provide a file system when specifying to use an in-memory file system.")}function getFileSystem(){return options.useInMemoryFileSystem?new common.InMemoryFileSystemHost:options.fileSystem??new common.RealFileSystemHost}function getCompilerOptions(){return{...getTsConfigCompilerOptions(),...options.compilerOptions??{}}}function getTsConfigCompilerOptions(){return tsConfigResolver?.getCompilerOptions()??{}}function getEncoding(){let defaultEncoding="utf-8";return options.compilerOptions!=null?options.compilerOptions.charset??defaultEncoding:defaultEncoding}}get manipulationSettings(){return this._context.manipulationSettings}get compilerOptions(){return this._context.compilerOptions}resolveSourceFileDependencies(){let sourceFiles=new Set,onSourceFileAdded=sourceFile=>sourceFiles.add(sourceFile),{compilerFactory,inProjectCoordinator}=this._context;compilerFactory.onSourceFileAdded(onSourceFileAdded);try{this.getProgram().compilerObject}finally{compilerFactory.onSourceFileAdded(onSourceFileAdded,!1)}let result=inProjectCoordinator.markSourceFilesAsInProjectForResolution();for(let sourceFile of result.changedSourceFiles)sourceFiles.add(sourceFile);for(let sourceFile of result.unchangedSourceFiles)sourceFiles.delete(sourceFile);return Array.from(sourceFiles.values())}addDirectoryAtPathIfExists(dirPath,options={}){return this._context.directoryCoordinator.addDirectoryAtPathIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(dirPath),{...options,markInProject:!0})}addDirectoryAtPath(dirPath,options={}){return this._context.directoryCoordinator.addDirectoryAtPath(this._context.fileSystemWrapper.getStandardizedAbsolutePath(dirPath),{...options,markInProject:!0})}createDirectory(dirPath){return this._context.directoryCoordinator.createDirectoryOrAddIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(dirPath),{markInProject:!0})}getDirectoryOrThrow(dirPath,message){return common.errors.throwIfNullOrUndefined(this.getDirectory(dirPath),message??(()=>`Could not find a directory at the specified path: ${this._context.fileSystemWrapper.getStandardizedAbsolutePath(dirPath)}`))}getDirectory(dirPath){let{compilerFactory}=this._context;return compilerFactory.getDirectoryFromCache(this._context.fileSystemWrapper.getStandardizedAbsolutePath(dirPath))}getDirectories(){return Array.from(this.#getProjectDirectoriesByDirectoryDepth())}getRootDirectories(){let{inProjectCoordinator}=this._context,result=[];for(let dir of this._context.compilerFactory.getOrphanDirectories())for(let inProjectDir of findInProjectDirectories(dir))result.push(inProjectDir);return result;function*findInProjectDirectories(dir){if(inProjectCoordinator.isDirectoryInProject(dir)){yield dir;return}for(let childDir of dir._getDirectoriesIterator())yield*findInProjectDirectories(childDir)}}addSourceFilesAtPaths(fileGlobs){return this._context.directoryCoordinator.addSourceFilesAtPaths(fileGlobs,{markInProject:!0})}addSourceFileAtPathIfExists(filePath){return this._context.directoryCoordinator.addSourceFileAtPathIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(filePath),{markInProject:!0})}addSourceFileAtPath(filePath){return this._context.directoryCoordinator.addSourceFileAtPath(this._context.fileSystemWrapper.getStandardizedAbsolutePath(filePath),{markInProject:!0})}addSourceFilesFromTsConfig(tsConfigFilePath){let resolver=new common.TsConfigResolver(this._context.fileSystemWrapper,this._context.fileSystemWrapper.getStandardizedAbsolutePath(tsConfigFilePath),this._context.getEncoding());return this.#addSourceFilesForTsConfigResolver(resolver,resolver.getCompilerOptions())}#addSourceFilesForTsConfigResolver(tsConfigResolver,compilerOptions){let paths=tsConfigResolver.getPaths(compilerOptions),addedSourceFiles=paths.filePaths.map(p=>this.addSourceFileAtPath(p));for(let dirPath of paths.directoryPaths)this.addDirectoryAtPathIfExists(dirPath);return addedSourceFiles}createSourceFile(filePath,sourceFileText,options){return this._context.compilerFactory.createSourceFile(this._context.fileSystemWrapper.getStandardizedAbsolutePath(filePath),sourceFileText??"",{...options??{},markInProject:!0})}removeSourceFile(sourceFile){let previouslyForgotten=sourceFile.wasForgotten();return sourceFile.forget(),!previouslyForgotten}getSourceFileOrThrow(fileNameOrSearchFunction){let sourceFile=this.getSourceFile(fileNameOrSearchFunction);if(sourceFile!=null)return sourceFile;if(typeof fileNameOrSearchFunction=="string"){let fileNameOrPath=common.FileUtils.standardizeSlashes(fileNameOrSearchFunction);if(common.FileUtils.pathIsAbsolute(fileNameOrPath)||fileNameOrPath.indexOf("/")>=0){let errorFileNameOrPath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(fileNameOrPath);throw new common.errors.InvalidOperationError(`Could not find source file in project at the provided path: ${errorFileNameOrPath}`)}else throw new common.errors.InvalidOperationError(`Could not find source file in project with the provided file name: ${fileNameOrSearchFunction}`)}else throw new common.errors.InvalidOperationError("Could not find source file in project based on the provided condition.")}getSourceFile(fileNameOrSearchFunction){let filePathOrSearchFunction=getFilePathOrSearchFunction(this._context.fileSystemWrapper);if(isStandardizedFilePath2(filePathOrSearchFunction))return this._context.compilerFactory.getSourceFileFromCacheFromFilePath(filePathOrSearchFunction);return common.IterableUtils.find(this.#getProjectSourceFilesByDirectoryDepth(),filePathOrSearchFunction);function getFilePathOrSearchFunction(fileSystemWrapper){if(fileNameOrSearchFunction instanceof Function)return fileNameOrSearchFunction;let fileNameOrPath=common.FileUtils.standardizeSlashes(fileNameOrSearchFunction);return common.FileUtils.pathIsAbsolute(fileNameOrPath)||fileNameOrPath.indexOf("/")>=0?fileSystemWrapper.getStandardizedAbsolutePath(fileNameOrPath):def=>common.FileUtils.pathEndsWith(def.getFilePath(),fileNameOrPath)}function isStandardizedFilePath2(obj){return typeof obj=="string"}}getSourceFiles(globPatterns){let{compilerFactory,fileSystemWrapper}=this._context,sourceFiles=this.#getProjectSourceFilesByDirectoryDepth();if(typeof globPatterns=="string"||globPatterns instanceof Array)return Array.from(getFilteredSourceFiles());return Array.from(sourceFiles);function*getFilteredSourceFiles(){let sourceFilePaths=Array.from(getSourceFilePaths()),matchedPaths=common.matchGlobs(sourceFilePaths,globPatterns,fileSystemWrapper.getCurrentDirectory());for(let matchedPath of matchedPaths)yield compilerFactory.getSourceFileFromCacheFromFilePath(fileSystemWrapper.getStandardizedAbsolutePath(matchedPath));function*getSourceFilePaths(){for(let sourceFile of sourceFiles)yield sourceFile.getFilePath()}}}*#getProjectSourceFilesByDirectoryDepth(){let{compilerFactory,inProjectCoordinator}=this._context;for(let sourceFile of compilerFactory.getSourceFilesByDirectoryDepth())inProjectCoordinator.isSourceFileInProject(sourceFile)&&(yield sourceFile)}*#getProjectDirectoriesByDirectoryDepth(){let{compilerFactory,inProjectCoordinator}=this._context;for(let directory of compilerFactory.getDirectoriesByDepth())inProjectCoordinator.isDirectoryInProject(directory)&&(yield directory)}getAmbientModule(moduleName){return moduleName=normalizeAmbientModuleName(moduleName),this.getAmbientModules().find(s=>s.getName()===moduleName)}getAmbientModuleOrThrow(moduleName,message){return common.errors.throwIfNullOrUndefined(this.getAmbientModule(moduleName),message??(()=>`Could not find ambient module with name: ${normalizeAmbientModuleName(moduleName)}`))}getAmbientModules(){return this.getTypeChecker().getAmbientModules()}async save(){await this._context.fileSystemWrapper.flush(),await Promise.all(this.#getUnsavedSourceFiles().map(f=>f.save()))}saveSync(){this._context.fileSystemWrapper.flushSync();for(let file of this.#getUnsavedSourceFiles())file.saveSync()}enableLogging(enabled=!0){this._context.logger.setEnabled(enabled)}#getUnsavedSourceFiles(){return Array.from(getUnsavedIterator(this._context.compilerFactory.getSourceFilesByDirectoryDepth()));function*getUnsavedIterator(sourceFiles){for(let sourceFile of sourceFiles)sourceFile.isSaved()||(yield sourceFile)}}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(emitOptions={}){return this._context.program.emit(emitOptions)}emitSync(emitOptions={}){return this._context.program.emitSync(emitOptions)}emitToMemory(emitOptions={}){return this._context.program.emitToMemory(emitOptions)}getCompilerOptions(){return this._context.compilerOptions.get()}getConfigFileParsingDiagnostics(){return this.getProgram().getConfigFileParsingDiagnostics()}createWriter(){return this._context.createWriter()}forgetNodesCreatedInBlock(block){return this._context.compilerFactory.forgetNodesCreatedInBlock(block)}formatDiagnosticsWithColorAndContext(diagnostics,opts={}){return common.ts.formatDiagnosticsWithColorAndContext(diagnostics.map(d=>d.compilerObject),{getCurrentDirectory:()=>this._context.fileSystemWrapper.getCurrentDirectory(),getCanonicalFileName:fileName=>fileName,getNewLine:()=>opts.newLineChar??common.runtime.getEndOfLine()})}getModuleResolutionHost(){return this._context.getModuleResolutionHost()}};function normalizeAmbientModuleName(moduleName){return isQuote(moduleName[0])&&isQuote(moduleName[moduleName.length-1])&&(moduleName=moduleName.substring(1,moduleName.length-1)),`"${moduleName}"`;function isQuote(char){return char==='"'||char==="'"}}function createWrappedNode(node,opts={}){let{compilerOptions={},sourceFile,typeChecker}=opts,compilerOptionsContainer=new common.CompilerOptionsContainer;compilerOptionsContainer.set(compilerOptions);let projectContext=new ProjectContext({project:void 0,fileSystemWrapper:new common.TransactionalFileSystem({fileSystem:new common.RealFileSystemHost,skipLoadingLibFiles:!0,libFolderPath:void 0}),compilerOptionsContainer,createLanguageService:!1,typeChecker,configFileParsingDiagnostics:[],skipLoadingLibFiles:!0,libFolderPath:void 0}),wrappedSourceFile=projectContext.compilerFactory.getSourceFile(getSourceFileNode(),{markInProject:!0});return projectContext.compilerFactory.getNodeFromCompilerNode(node,wrappedSourceFile);function getSourceFileNode(){return sourceFile??getSourceFileFromNode(node)}function getSourceFileFromNode(compilerNode){if(compilerNode.kind===common.SyntaxKind.SourceFile)return compilerNode;if(compilerNode.parent==null)throw new common.errors.InvalidOperationError("Please ensure the node was created from a source file with 'setParentNodes' set to 'true'.");let parent=compilerNode;for(;parent.parent!=null;)parent=parent.parent;if(parent.kind!==common.SyntaxKind.SourceFile)throw new common.errors.NotImplementedError("For some reason the top parent was not a source file.");return parent}}var structurePrinterFactory=new StructurePrinterFactory(()=>{throw new common.errors.NotImplementedError("Not implemented scenario for getting code format settings when using a writer function. Please open an issue.")}),Writers=class{constructor(){}static object(obj){return writer=>{let keyNames=Object.keys(obj);writer.write("{"),keyNames.length>0&&writer.indent(()=>{writeObject()}),writer.write("}");function writeObject(){for(let i=0;i0&&writer.write(",").newLine();let keyName=keyNames[i],value=obj[keyName];writer.write(keyName),value!=null&&(writer.write(": "),writeValue(writer,value))}writer.newLine()}}}static objectType(structure){return writer=>{writer.write("{"),anyPropertyHasValue(structure)&&writer.indent(()=>{structurePrinterFactory.forTypeElementMemberedNode().printText(writer,structure)}),writer.write("}")}}static unionType(firstType,secondType,...additionalTypes){return getWriteFunctionForUnionOrIntersectionType("|",[firstType,secondType,...additionalTypes])}static intersectionType(firstType,secondType,...additionalTypes){return getWriteFunctionForUnionOrIntersectionType("&",[firstType,secondType,...additionalTypes])}static assertion(type,assertionType){return writer=>{writeValue(writer,type),writer.spaceIfLastNot().write("as "),writeValue(writer,assertionType)}}static returnStatement(value){return writer=>{writer.write("return "),writer.hangingIndentUnlessBlock(()=>{writeValue(writer,value),writer.write(";")})}}};function getWriteFunctionForUnionOrIntersectionType(separator,args){return writer=>{writeSeparatedByString(writer,` ${separator} `,args)}}function anyPropertyHasValue(obj){for(let key of Object.keys(obj))if(obj[key]!=null&&!(obj[key]instanceof Array&&obj[key].length===0))return!0;return!1}function writeSeparatedByString(writer,separator,values){for(let i=0;i0,separator),writeValue(writer,values[i])}function writeValue(writer,value){value instanceof Function?value(writer):writer.write(value.toString())}var{InvalidOperationError,FileNotFoundError,ArgumentError,ArgumentNullOrWhitespaceError,ArgumentOutOfRangeError,ArgumentTypeError,BaseError,DirectoryNotFoundError,NotImplementedError,NotSupportedError,PathNotFoundError}=common.errors;Object.defineProperty(exports,"CompilerOptionsContainer",{enumerable:!0,get:function(){return common.CompilerOptionsContainer}});Object.defineProperty(exports,"DiagnosticCategory",{enumerable:!0,get:function(){return common.DiagnosticCategory}});Object.defineProperty(exports,"EmitHint",{enumerable:!0,get:function(){return common.EmitHint}});Object.defineProperty(exports,"InMemoryFileSystemHost",{enumerable:!0,get:function(){return common.InMemoryFileSystemHost}});Object.defineProperty(exports,"LanguageVariant",{enumerable:!0,get:function(){return common.LanguageVariant}});Object.defineProperty(exports,"ModuleKind",{enumerable:!0,get:function(){return common.ModuleKind}});Object.defineProperty(exports,"ModuleResolutionKind",{enumerable:!0,get:function(){return common.ModuleResolutionKind}});Object.defineProperty(exports,"NewLineKind",{enumerable:!0,get:function(){return common.NewLineKind}});Object.defineProperty(exports,"NodeFlags",{enumerable:!0,get:function(){return common.NodeFlags}});Object.defineProperty(exports,"ObjectFlags",{enumerable:!0,get:function(){return common.ObjectFlags}});Object.defineProperty(exports,"ResolutionHosts",{enumerable:!0,get:function(){return common.ResolutionHosts}});Object.defineProperty(exports,"ScriptKind",{enumerable:!0,get:function(){return common.ScriptKind}});Object.defineProperty(exports,"ScriptTarget",{enumerable:!0,get:function(){return common.ScriptTarget}});Object.defineProperty(exports,"SettingsContainer",{enumerable:!0,get:function(){return common.SettingsContainer}});Object.defineProperty(exports,"SymbolFlags",{enumerable:!0,get:function(){return common.SymbolFlags}});Object.defineProperty(exports,"SyntaxKind",{enumerable:!0,get:function(){return common.SyntaxKind}});Object.defineProperty(exports,"TypeFlags",{enumerable:!0,get:function(){return common.TypeFlags}});Object.defineProperty(exports,"TypeFormatFlags",{enumerable:!0,get:function(){return common.TypeFormatFlags}});Object.defineProperty(exports,"ts",{enumerable:!0,get:function(){return common.ts}});Object.defineProperty(exports,"CodeBlockWriter",{enumerable:!0,get:function(){return CodeBlockWriter__default.default}});exports.AbstractableNode=AbstractableNode;exports.AmbientableNode=AmbientableNode;exports.ArgumentError=ArgumentError;exports.ArgumentNullOrWhitespaceError=ArgumentNullOrWhitespaceError;exports.ArgumentOutOfRangeError=ArgumentOutOfRangeError;exports.ArgumentTypeError=ArgumentTypeError;exports.ArgumentedNode=ArgumentedNode;exports.ArrayBindingPattern=ArrayBindingPattern;exports.ArrayDestructuringAssignment=ArrayDestructuringAssignment;exports.ArrayDestructuringAssignmentBase=ArrayDestructuringAssignmentBase;exports.ArrayLiteralExpression=ArrayLiteralExpression;exports.ArrayTypeNode=ArrayTypeNode;exports.ArrowFunction=ArrowFunction;exports.ArrowFunctionBase=ArrowFunctionBase;exports.AsExpression=AsExpression;exports.AsExpressionBase=AsExpressionBase;exports.AssignmentExpression=AssignmentExpression;exports.AssignmentExpressionBase=AssignmentExpressionBase;exports.AsyncableNode=AsyncableNode;exports.AwaitExpression=AwaitExpression;exports.AwaitExpressionBase=AwaitExpressionBase;exports.AwaitableNode=AwaitableNode;exports.BaseError=BaseError;exports.BaseExpressionedNode=BaseExpressionedNode;exports.BigIntLiteral=BigIntLiteral;exports.BigIntLiteralBase=BigIntLiteralBase;exports.BinaryExpression=BinaryExpression;exports.BinaryExpressionBase=BinaryExpressionBase;exports.BindingElement=BindingElement;exports.BindingElementBase=BindingElementBase;exports.BindingNamedNode=BindingNamedNode;exports.Block=Block;exports.BlockBase=BlockBase;exports.BodiedNode=BodiedNode;exports.BodyableNode=BodyableNode;exports.BreakStatement=BreakStatement;exports.CallExpression=CallExpression;exports.CallExpressionBase=CallExpressionBase;exports.CallSignatureDeclaration=CallSignatureDeclaration;exports.CallSignatureDeclarationBase=CallSignatureDeclarationBase;exports.CaseBlock=CaseBlock;exports.CaseBlockBase=CaseBlockBase;exports.CaseClause=CaseClause;exports.CaseClauseBase=CaseClauseBase;exports.CatchClause=CatchClause;exports.CatchClauseBase=CatchClauseBase;exports.ChildOrderableNode=ChildOrderableNode;exports.ClassDeclaration=ClassDeclaration;exports.ClassDeclarationBase=ClassDeclarationBase;exports.ClassElement=ClassElement;exports.ClassExpression=ClassExpression;exports.ClassExpressionBase=ClassExpressionBase;exports.ClassLikeDeclarationBase=ClassLikeDeclarationBase;exports.ClassLikeDeclarationBaseSpecific=ClassLikeDeclarationBaseSpecific;exports.ClassStaticBlockDeclaration=ClassStaticBlockDeclaration;exports.ClassStaticBlockDeclarationBase=ClassStaticBlockDeclarationBase;exports.CodeAction=CodeAction;exports.CodeFixAction=CodeFixAction;exports.CombinedCodeActions=CombinedCodeActions;exports.CommaListExpression=CommaListExpression;exports.CommaListExpressionBase=CommaListExpressionBase;exports.CommentClassElement=CommentClassElement;exports.CommentEnumMember=CommentEnumMember;exports.CommentObjectLiteralElement=CommentObjectLiteralElement;exports.CommentRange=CommentRange;exports.CommentStatement=CommentStatement;exports.CommentTypeElement=CommentTypeElement;exports.CommonIdentifierBase=CommonIdentifierBase;exports.CompilerCommentClassElement=CompilerCommentClassElement;exports.CompilerCommentEnumMember=CompilerCommentEnumMember;exports.CompilerCommentNode=CompilerCommentNode;exports.CompilerCommentObjectLiteralElement=CompilerCommentObjectLiteralElement;exports.CompilerCommentStatement=CompilerCommentStatement;exports.CompilerCommentTypeElement=CompilerCommentTypeElement;exports.ComputedPropertyName=ComputedPropertyName;exports.ComputedPropertyNameBase=ComputedPropertyNameBase;exports.ConditionalExpression=ConditionalExpression;exports.ConditionalExpressionBase=ConditionalExpressionBase;exports.ConditionalTypeNode=ConditionalTypeNode;exports.ConstructSignatureDeclaration=ConstructSignatureDeclaration;exports.ConstructSignatureDeclarationBase=ConstructSignatureDeclarationBase;exports.ConstructorDeclaration=ConstructorDeclaration;exports.ConstructorDeclarationBase=ConstructorDeclarationBase;exports.ConstructorDeclarationOverloadBase=ConstructorDeclarationOverloadBase;exports.ConstructorTypeNode=ConstructorTypeNode;exports.ConstructorTypeNodeBase=ConstructorTypeNodeBase;exports.ContinueStatement=ContinueStatement;exports.DebuggerStatement=DebuggerStatement;exports.DebuggerStatementBase=DebuggerStatementBase;exports.DecoratableNode=DecoratableNode;exports.Decorator=Decorator;exports.DecoratorBase=DecoratorBase;exports.DefaultClause=DefaultClause;exports.DefaultClauseBase=DefaultClauseBase;exports.DefinitionInfo=DefinitionInfo;exports.DeleteExpression=DeleteExpression;exports.DeleteExpressionBase=DeleteExpressionBase;exports.Diagnostic=Diagnostic;exports.DiagnosticMessageChain=DiagnosticMessageChain;exports.DiagnosticWithLocation=DiagnosticWithLocation;exports.Directory=Directory;exports.DirectoryEmitResult=DirectoryEmitResult;exports.DirectoryNotFoundError=DirectoryNotFoundError;exports.DoStatement=DoStatement;exports.DoStatementBase=DoStatementBase;exports.DocumentSpan=DocumentSpan;exports.DotDotDotTokenableNode=DotDotDotTokenableNode;exports.ElementAccessExpression=ElementAccessExpression;exports.ElementAccessExpressionBase=ElementAccessExpressionBase;exports.EmitOutput=EmitOutput;exports.EmitResult=EmitResult;exports.EmptyStatement=EmptyStatement;exports.EmptyStatementBase=EmptyStatementBase;exports.EnumDeclaration=EnumDeclaration;exports.EnumDeclarationBase=EnumDeclarationBase;exports.EnumMember=EnumMember;exports.EnumMemberBase=EnumMemberBase;exports.ExclamationTokenableNode=ExclamationTokenableNode;exports.ExportAssignment=ExportAssignment;exports.ExportAssignmentBase=ExportAssignmentBase;exports.ExportDeclaration=ExportDeclaration;exports.ExportDeclarationBase=ExportDeclarationBase;exports.ExportGetableNode=ExportGetableNode;exports.ExportSpecifier=ExportSpecifier;exports.ExportSpecifierBase=ExportSpecifierBase;exports.ExportableNode=ExportableNode;exports.Expression=Expression;exports.ExpressionStatement=ExpressionStatement;exports.ExpressionStatementBase=ExpressionStatementBase;exports.ExpressionWithTypeArguments=ExpressionWithTypeArguments;exports.ExpressionWithTypeArgumentsBase=ExpressionWithTypeArgumentsBase;exports.ExpressionableNode=ExpressionableNode;exports.ExpressionedNode=ExpressionedNode;exports.ExtendsClauseableNode=ExtendsClauseableNode;exports.ExternalModuleReference=ExternalModuleReference;exports.ExternalModuleReferenceBase=ExternalModuleReferenceBase;exports.FalseLiteral=FalseLiteral;exports.FalseLiteralBase=FalseLiteralBase;exports.FileNotFoundError=FileNotFoundError;exports.FileReference=FileReference;exports.FileTextChanges=FileTextChanges;exports.ForInStatement=ForInStatement;exports.ForInStatementBase=ForInStatementBase;exports.ForOfStatement=ForOfStatement;exports.ForOfStatementBase=ForOfStatementBase;exports.ForStatement=ForStatement;exports.ForStatementBase=ForStatementBase;exports.FunctionDeclaration=FunctionDeclaration;exports.FunctionDeclarationBase=FunctionDeclarationBase;exports.FunctionDeclarationOverloadBase=FunctionDeclarationOverloadBase;exports.FunctionExpression=FunctionExpression;exports.FunctionExpressionBase=FunctionExpressionBase;exports.FunctionLikeDeclaration=FunctionLikeDeclaration;exports.FunctionOrConstructorTypeNodeBase=FunctionOrConstructorTypeNodeBase;exports.FunctionOrConstructorTypeNodeBaseBase=FunctionOrConstructorTypeNodeBaseBase;exports.FunctionTypeNode=FunctionTypeNode;exports.FunctionTypeNodeBase=FunctionTypeNodeBase;exports.GeneratorableNode=GeneratorableNode;exports.GetAccessorDeclaration=GetAccessorDeclaration;exports.GetAccessorDeclarationBase=GetAccessorDeclarationBase;exports.HeritageClause=HeritageClause;exports.HeritageClauseableNode=HeritageClauseableNode;exports.Identifier=Identifier;exports.IdentifierBase=IdentifierBase;exports.IfStatement=IfStatement;exports.IfStatementBase=IfStatementBase;exports.ImplementationLocation=ImplementationLocation;exports.ImplementsClauseableNode=ImplementsClauseableNode;exports.ImportAttribute=ImportAttribute;exports.ImportAttributeBase=ImportAttributeBase;exports.ImportAttributeNamedNode=ImportAttributeNamedNode;exports.ImportAttributes=ImportAttributes;exports.ImportAttributesBase=ImportAttributesBase;exports.ImportClause=ImportClause;exports.ImportClauseBase=ImportClauseBase;exports.ImportDeclaration=ImportDeclaration;exports.ImportDeclarationBase=ImportDeclarationBase;exports.ImportEqualsDeclaration=ImportEqualsDeclaration;exports.ImportEqualsDeclarationBase=ImportEqualsDeclarationBase;exports.ImportExpression=ImportExpression;exports.ImportExpressionBase=ImportExpressionBase;exports.ImportExpressionedNode=ImportExpressionedNode;exports.ImportSpecifier=ImportSpecifier;exports.ImportSpecifierBase=ImportSpecifierBase;exports.ImportTypeNode=ImportTypeNode;exports.IndexSignatureDeclaration=IndexSignatureDeclaration;exports.IndexSignatureDeclarationBase=IndexSignatureDeclarationBase;exports.IndexedAccessTypeNode=IndexedAccessTypeNode;exports.InferTypeNode=InferTypeNode;exports.InitializerExpressionGetableNode=InitializerExpressionGetableNode;exports.InitializerExpressionableNode=InitializerExpressionableNode;exports.InterfaceDeclaration=InterfaceDeclaration;exports.InterfaceDeclarationBase=InterfaceDeclarationBase;exports.IntersectionTypeNode=IntersectionTypeNode;exports.InvalidOperationError=InvalidOperationError;exports.IterationStatement=IterationStatement;exports.JSDoc=JSDoc;exports.JSDocAllType=JSDocAllType;exports.JSDocAugmentsTag=JSDocAugmentsTag;exports.JSDocAuthorTag=JSDocAuthorTag;exports.JSDocBase=JSDocBase;exports.JSDocCallbackTag=JSDocCallbackTag;exports.JSDocClassTag=JSDocClassTag;exports.JSDocDeprecatedTag=JSDocDeprecatedTag;exports.JSDocEnumTag=JSDocEnumTag;exports.JSDocFunctionType=JSDocFunctionType;exports.JSDocFunctionTypeBase=JSDocFunctionTypeBase;exports.JSDocImplementsTag=JSDocImplementsTag;exports.JSDocLink=JSDocLink;exports.JSDocLinkCode=JSDocLinkCode;exports.JSDocLinkPlain=JSDocLinkPlain;exports.JSDocMemberName=JSDocMemberName;exports.JSDocNameReference=JSDocNameReference;exports.JSDocNamepathType=JSDocNamepathType;exports.JSDocNonNullableType=JSDocNonNullableType;exports.JSDocNullableType=JSDocNullableType;exports.JSDocOptionalType=JSDocOptionalType;exports.JSDocOverloadTag=JSDocOverloadTag;exports.JSDocOverloadTagBase=JSDocOverloadTagBase;exports.JSDocOverrideTag=JSDocOverrideTag;exports.JSDocParameterTag=JSDocParameterTag;exports.JSDocParameterTagBase=JSDocParameterTagBase;exports.JSDocPrivateTag=JSDocPrivateTag;exports.JSDocPropertyLikeTag=JSDocPropertyLikeTag;exports.JSDocPropertyTag=JSDocPropertyTag;exports.JSDocPropertyTagBase=JSDocPropertyTagBase;exports.JSDocProtectedTag=JSDocProtectedTag;exports.JSDocPublicTag=JSDocPublicTag;exports.JSDocReadonlyTag=JSDocReadonlyTag;exports.JSDocReturnTag=JSDocReturnTag;exports.JSDocReturnTagBase=JSDocReturnTagBase;exports.JSDocSatisfiesTag=JSDocSatisfiesTag;exports.JSDocSatisfiesTagBase=JSDocSatisfiesTagBase;exports.JSDocSeeTag=JSDocSeeTag;exports.JSDocSeeTagBase=JSDocSeeTagBase;exports.JSDocSignature=JSDocSignature;exports.JSDocTag=JSDocTag;exports.JSDocTagBase=JSDocTagBase;exports.JSDocTagInfo=JSDocTagInfo;exports.JSDocTemplateTag=JSDocTemplateTag;exports.JSDocTemplateTagBase=JSDocTemplateTagBase;exports.JSDocText=JSDocText;exports.JSDocThisTag=JSDocThisTag;exports.JSDocThisTagBase=JSDocThisTagBase;exports.JSDocThrowsTag=JSDocThrowsTag;exports.JSDocThrowsTagBase=JSDocThrowsTagBase;exports.JSDocType=JSDocType;exports.JSDocTypeExpression=JSDocTypeExpression;exports.JSDocTypeExpressionableTag=JSDocTypeExpressionableTag;exports.JSDocTypeLiteral=JSDocTypeLiteral;exports.JSDocTypeParameteredTag=JSDocTypeParameteredTag;exports.JSDocTypeTag=JSDocTypeTag;exports.JSDocTypedefTag=JSDocTypedefTag;exports.JSDocUnknownTag=JSDocUnknownTag;exports.JSDocUnknownType=JSDocUnknownType;exports.JSDocVariadicType=JSDocVariadicType;exports.JSDocableNode=JSDocableNode;exports.JsxAttribute=JsxAttribute;exports.JsxAttributeBase=JsxAttributeBase;exports.JsxAttributedNode=JsxAttributedNode;exports.JsxClosingElement=JsxClosingElement;exports.JsxClosingElementBase=JsxClosingElementBase;exports.JsxClosingFragment=JsxClosingFragment;exports.JsxElement=JsxElement;exports.JsxElementBase=JsxElementBase;exports.JsxExpression=JsxExpression;exports.JsxExpressionBase=JsxExpressionBase;exports.JsxFragment=JsxFragment;exports.JsxNamespacedName=JsxNamespacedName;exports.JsxNamespacedNameBase=JsxNamespacedNameBase;exports.JsxOpeningElement=JsxOpeningElement;exports.JsxOpeningElementBase=JsxOpeningElementBase;exports.JsxOpeningFragment=JsxOpeningFragment;exports.JsxSelfClosingElement=JsxSelfClosingElement;exports.JsxSelfClosingElementBase=JsxSelfClosingElementBase;exports.JsxSpreadAttribute=JsxSpreadAttribute;exports.JsxSpreadAttributeBase=JsxSpreadAttributeBase;exports.JsxTagNamedNode=JsxTagNamedNode;exports.JsxText=JsxText;exports.JsxTextBase=JsxTextBase;exports.LabeledStatement=LabeledStatement;exports.LabeledStatementBase=LabeledStatementBase;exports.LanguageService=LanguageService;exports.LeftHandSideExpression=LeftHandSideExpression;exports.LeftHandSideExpressionedNode=LeftHandSideExpressionedNode;exports.LiteralExpression=LiteralExpression;exports.LiteralExpressionBase=LiteralExpressionBase;exports.LiteralLikeNode=LiteralLikeNode;exports.LiteralTypeNode=LiteralTypeNode;exports.ManipulationError=ManipulationError;exports.ManipulationSettingsContainer=ManipulationSettingsContainer;exports.MappedTypeNode=MappedTypeNode;exports.MemberExpression=MemberExpression;exports.MemoryEmitResult=MemoryEmitResult;exports.MetaProperty=MetaProperty;exports.MetaPropertyBase=MetaPropertyBase;exports.MethodDeclaration=MethodDeclaration;exports.MethodDeclarationBase=MethodDeclarationBase;exports.MethodDeclarationOverloadBase=MethodDeclarationOverloadBase;exports.MethodSignature=MethodSignature;exports.MethodSignatureBase=MethodSignatureBase;exports.ModifierableNode=ModifierableNode;exports.ModuleBlock=ModuleBlock;exports.ModuleBlockBase=ModuleBlockBase;exports.ModuleChildableNode=ModuleChildableNode;exports.ModuleDeclaration=ModuleDeclaration;exports.ModuleDeclarationBase=ModuleDeclarationBase;exports.ModuleNamedNode=ModuleNamedNode;exports.ModuledNode=ModuledNode;exports.NameableNode=NameableNode;exports.NamedExports=NamedExports;exports.NamedExportsBase=NamedExportsBase;exports.NamedImports=NamedImports;exports.NamedImportsBase=NamedImportsBase;exports.NamedNode=NamedNode;exports.NamedNodeBase=NamedNodeBase;exports.NamedTupleMember=NamedTupleMember;exports.NamedTupleMemberBase=NamedTupleMemberBase;exports.NamespaceExport=NamespaceExport;exports.NamespaceExportBase=NamespaceExportBase;exports.NamespaceImport=NamespaceImport;exports.NamespaceImportBase=NamespaceImportBase;exports.NewExpression=NewExpression;exports.NewExpressionBase=NewExpressionBase;exports.NoSubstitutionTemplateLiteral=NoSubstitutionTemplateLiteral;exports.NoSubstitutionTemplateLiteralBase=NoSubstitutionTemplateLiteralBase;exports.Node=Node;exports.NodeWithTypeArguments=NodeWithTypeArguments;exports.NodeWithTypeArgumentsBase=NodeWithTypeArgumentsBase;exports.NonNullExpression=NonNullExpression;exports.NonNullExpressionBase=NonNullExpressionBase;exports.NotEmittedStatement=NotEmittedStatement;exports.NotEmittedStatementBase=NotEmittedStatementBase;exports.NotImplementedError=NotImplementedError;exports.NotSupportedError=NotSupportedError;exports.NullLiteral=NullLiteral;exports.NullLiteralBase=NullLiteralBase;exports.NumericLiteral=NumericLiteral;exports.NumericLiteralBase=NumericLiteralBase;exports.ObjectBindingPattern=ObjectBindingPattern;exports.ObjectDestructuringAssignment=ObjectDestructuringAssignment;exports.ObjectDestructuringAssignmentBase=ObjectDestructuringAssignmentBase;exports.ObjectLiteralElement=ObjectLiteralElement;exports.ObjectLiteralExpression=ObjectLiteralExpression;exports.ObjectLiteralExpressionBase=ObjectLiteralExpressionBase;exports.OmittedExpression=OmittedExpression;exports.OmittedExpressionBase=OmittedExpressionBase;exports.OutputFile=OutputFile;exports.OverloadableNode=OverloadableNode;exports.OverrideableNode=OverrideableNode;exports.ParameterDeclaration=ParameterDeclaration;exports.ParameterDeclarationBase=ParameterDeclarationBase;exports.ParameteredNode=ParameteredNode;exports.ParenthesizedExpression=ParenthesizedExpression;exports.ParenthesizedExpressionBase=ParenthesizedExpressionBase;exports.ParenthesizedTypeNode=ParenthesizedTypeNode;exports.PartiallyEmittedExpression=PartiallyEmittedExpression;exports.PartiallyEmittedExpressionBase=PartiallyEmittedExpressionBase;exports.PathNotFoundError=PathNotFoundError;exports.PostfixUnaryExpression=PostfixUnaryExpression;exports.PostfixUnaryExpressionBase=PostfixUnaryExpressionBase;exports.PrefixUnaryExpression=PrefixUnaryExpression;exports.PrefixUnaryExpressionBase=PrefixUnaryExpressionBase;exports.PrimaryExpression=PrimaryExpression;exports.PrivateIdentifier=PrivateIdentifier;exports.PrivateIdentifierBase=PrivateIdentifierBase;exports.Program=Program;exports.Project=Project2;exports.PropertyAccessExpression=PropertyAccessExpression;exports.PropertyAccessExpressionBase=PropertyAccessExpressionBase;exports.PropertyAssignment=PropertyAssignment;exports.PropertyAssignmentBase=PropertyAssignmentBase;exports.PropertyDeclaration=PropertyDeclaration;exports.PropertyDeclarationBase=PropertyDeclarationBase;exports.PropertyNamedNode=PropertyNamedNode;exports.PropertySignature=PropertySignature;exports.PropertySignatureBase=PropertySignatureBase;exports.QualifiedName=QualifiedName;exports.QuestionDotTokenableNode=QuestionDotTokenableNode;exports.QuestionTokenableNode=QuestionTokenableNode;exports.ReadonlyableNode=ReadonlyableNode;exports.RefactorEditInfo=RefactorEditInfo;exports.ReferenceEntry=ReferenceEntry;exports.ReferenceFindableNode=ReferenceFindableNode;exports.ReferencedSymbol=ReferencedSymbol;exports.ReferencedSymbolDefinitionInfo=ReferencedSymbolDefinitionInfo;exports.ReferencedSymbolEntry=ReferencedSymbolEntry;exports.RegularExpressionLiteral=RegularExpressionLiteral;exports.RegularExpressionLiteralBase=RegularExpressionLiteralBase;exports.RenameLocation=RenameLocation;exports.RenameableNode=RenameableNode;exports.RestTypeNode=RestTypeNode;exports.ReturnStatement=ReturnStatement;exports.ReturnStatementBase=ReturnStatementBase;exports.ReturnTypedNode=ReturnTypedNode;exports.SatisfiesExpression=SatisfiesExpression;exports.SatisfiesExpressionBase=SatisfiesExpressionBase;exports.ScopeableNode=ScopeableNode;exports.ScopedNode=ScopedNode;exports.SetAccessorDeclaration=SetAccessorDeclaration;exports.SetAccessorDeclarationBase=SetAccessorDeclarationBase;exports.ShorthandPropertyAssignment=ShorthandPropertyAssignment;exports.ShorthandPropertyAssignmentBase=ShorthandPropertyAssignmentBase;exports.Signature=Signature;exports.SignaturedDeclaration=SignaturedDeclaration;exports.SourceFile=SourceFile;exports.SourceFileBase=SourceFileBase;exports.SpreadAssignment=SpreadAssignment;exports.SpreadAssignmentBase=SpreadAssignmentBase;exports.SpreadElement=SpreadElement;exports.SpreadElementBase=SpreadElementBase;exports.Statement=Statement;exports.StatementBase=StatementBase;exports.StatementedNode=StatementedNode;exports.StaticableNode=StaticableNode;exports.StringLiteral=StringLiteral;exports.StringLiteralBase=StringLiteralBase;exports.Structure=Structure;exports.SuperElementAccessExpression=SuperElementAccessExpression;exports.SuperElementAccessExpressionBase=SuperElementAccessExpressionBase;exports.SuperExpression=SuperExpression;exports.SuperExpressionBase=SuperExpressionBase;exports.SuperExpressionedNode=SuperExpressionedNode;exports.SuperPropertyAccessExpression=SuperPropertyAccessExpression;exports.SuperPropertyAccessExpressionBase=SuperPropertyAccessExpressionBase;exports.SwitchStatement=SwitchStatement;exports.SwitchStatementBase=SwitchStatementBase;exports.Symbol=Symbol2;exports.SymbolDisplayPart=SymbolDisplayPart;exports.SyntaxList=SyntaxList;exports.TaggedTemplateExpression=TaggedTemplateExpression;exports.TemplateExpression=TemplateExpression;exports.TemplateExpressionBase=TemplateExpressionBase;exports.TemplateHead=TemplateHead;exports.TemplateHeadBase=TemplateHeadBase;exports.TemplateLiteralTypeNode=TemplateLiteralTypeNode;exports.TemplateMiddle=TemplateMiddle;exports.TemplateMiddleBase=TemplateMiddleBase;exports.TemplateSpan=TemplateSpan;exports.TemplateSpanBase=TemplateSpanBase;exports.TemplateTail=TemplateTail;exports.TemplateTailBase=TemplateTailBase;exports.TextChange=TextChange;exports.TextInsertableNode=TextInsertableNode;exports.TextRange=TextRange;exports.TextSpan=TextSpan;exports.ThisExpression=ThisExpression;exports.ThisExpressionBase=ThisExpressionBase;exports.ThisTypeNode=ThisTypeNode;exports.ThrowStatement=ThrowStatement;exports.ThrowStatementBase=ThrowStatementBase;exports.TrueLiteral=TrueLiteral;exports.TrueLiteralBase=TrueLiteralBase;exports.TryStatement=TryStatement;exports.TryStatementBase=TryStatementBase;exports.TupleTypeNode=TupleTypeNode;exports.Type=Type;exports.TypeAliasDeclaration=TypeAliasDeclaration;exports.TypeAliasDeclarationBase=TypeAliasDeclarationBase;exports.TypeArgumentedNode=TypeArgumentedNode;exports.TypeAssertion=TypeAssertion;exports.TypeAssertionBase=TypeAssertionBase;exports.TypeChecker=TypeChecker;exports.TypeElement=TypeElement;exports.TypeElementMemberedNode=TypeElementMemberedNode;exports.TypeLiteralNode=TypeLiteralNode;exports.TypeLiteralNodeBase=TypeLiteralNodeBase;exports.TypeNode=TypeNode;exports.TypeOfExpression=TypeOfExpression;exports.TypeOfExpressionBase=TypeOfExpressionBase;exports.TypeOperatorTypeNode=TypeOperatorTypeNode;exports.TypeParameter=TypeParameter;exports.TypeParameterDeclaration=TypeParameterDeclaration;exports.TypeParameterDeclarationBase=TypeParameterDeclarationBase;exports.TypeParameteredNode=TypeParameteredNode;exports.TypePredicateNode=TypePredicateNode;exports.TypeQueryNode=TypeQueryNode;exports.TypeReferenceNode=TypeReferenceNode;exports.TypedNode=TypedNode;exports.UnaryExpression=UnaryExpression;exports.UnaryExpressionedNode=UnaryExpressionedNode;exports.UnionTypeNode=UnionTypeNode;exports.UnwrappableNode=UnwrappableNode;exports.UpdateExpression=UpdateExpression;exports.VariableDeclaration=VariableDeclaration;exports.VariableDeclarationBase=VariableDeclarationBase;exports.VariableDeclarationList=VariableDeclarationList;exports.VariableDeclarationListBase=VariableDeclarationListBase;exports.VariableStatement=VariableStatement;exports.VariableStatementBase=VariableStatementBase;exports.VoidExpression=VoidExpression;exports.VoidExpressionBase=VoidExpressionBase;exports.WhileStatement=WhileStatement;exports.WhileStatementBase=WhileStatementBase;exports.WithStatement=WithStatement;exports.WithStatementBase=WithStatementBase;exports.Writers=Writers;exports.YieldExpression=YieldExpression;exports.YieldExpressionBase=YieldExpressionBase;exports.createWrappedNode=createWrappedNode;exports.forEachStructureChild=forEachStructureChild;exports.getCompilerOptionsFromTsConfig=getCompilerOptionsFromTsConfig;exports.getScopeForNode=getScopeForNode;exports.insertOverloads=insertOverloads;exports.printNode=printNode;exports.setScopeForNode=setScopeForNode}});init_esbuild_inject();init_esbuild_inject();init_esbuild_inject();init_esbuild_inject();var urlSafeCharacters=[..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"],numericCharacters=[..."0123456789"],distinguishableCharacters=[..."CDEHKMPRTUWXY012458"],asciiPrintableCharacters=[..."!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"],alphanumericCharacters=[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"],readUInt16LE=(uInt8Array,offset)=>uInt8Array[offset]+(uInt8Array[offset+1]<<8),generateForCustomCharacters=(length,characters,randomBytes)=>{let characterCount=characters.length,maxValidSelector=Math.floor(65536/characterCount)*characterCount-1,entropyLength=2*Math.ceil(1.1*length),string="",stringLength=0;for(;stringLengthmaxValidSelector)&&(string+=characters[entropyValue%characterCount],stringLength++)}}return string},generateForCustomCharactersAsync=async(length,characters,randomBytesAsync)=>{let characterCount=characters.length,maxValidSelector=Math.floor(65536/characterCount)*characterCount-1,entropyLength=2*Math.ceil(1.1*length),string="",stringLength=0;for(;stringLengthmaxValidSelector)&&(string+=characters[entropyValue%characterCount],stringLength++)}}return string},allowedTypes=new Set([void 0,"hex","base64","url-safe","numeric","distinguishable","ascii-printable","alphanumeric"]),createGenerator=(generateForCustomCharacters2,specialRandomBytes2,randomBytes)=>({length,type,characters})=>{if(!(length>=0&&Number.isFinite(length)))throw new TypeError("Expected a `length` to be a non-negative finite number");if(type!==void 0&&characters!==void 0)throw new TypeError("Expected either `type` or `characters`");if(characters!==void 0&&typeof characters!="string")throw new TypeError("Expected `characters` to be string");if(!allowedTypes.has(type))throw new TypeError(`Unknown type: ${type}`);if(type===void 0&&characters===void 0&&(type="hex"),type==="hex"||type===void 0&&characters===void 0)return specialRandomBytes2(Math.ceil(length*.5),"hex",length);if(type==="base64")return specialRandomBytes2(Math.ceil(length*.75),"base64",length);if(type==="url-safe")return generateForCustomCharacters2(length,urlSafeCharacters,randomBytes);if(type==="numeric")return generateForCustomCharacters2(length,numericCharacters,randomBytes);if(type==="distinguishable")return generateForCustomCharacters2(length,distinguishableCharacters,randomBytes);if(type==="ascii-printable")return generateForCustomCharacters2(length,asciiPrintableCharacters,randomBytes);if(type==="alphanumeric")return generateForCustomCharacters2(length,alphanumericCharacters,randomBytes);if(characters.length===0)throw new TypeError("Expected `characters` string length to be greater than or equal to 1");if(characters.length>65536)throw new TypeError("Expected `characters` string length to be less or equal to 65536");return generateForCustomCharacters2(length,characters,randomBytes)};function createStringGenerator(specialRandomBytes2,randomBytes){return createGenerator(generateForCustomCharacters,specialRandomBytes2,randomBytes)}function createAsyncStringGenerator(specialRandomBytesAsync,randomBytesAsync){return createGenerator(generateForCustomCharactersAsync,specialRandomBytesAsync,randomBytesAsync)}var toHex=uInt8Array=>[...uInt8Array].map(byte=>byte.toString(16).padStart(2,"0")).join(""),toBase64=uInt8Array=>btoa(String.fromCodePoint(...uInt8Array)),maxEntropy=65536;function getRandomValues(byteLength){let generatedBytes=new Uint8Array(byteLength);for(let totalGeneratedBytes=0;totalGeneratedBytesAdshieldHostableDomains[Number(browser_default({length:16,type:"numeric"}))*1e-16*AdshieldDomainsize>>>0];init_esbuild_inject();init_esbuild_inject();var source=[{id:"dggn",input:`_l< VzqDF:2g61w{im("7LAZa/^j%'K?`,output:"x29hb8pwvsilcmq065t437rnyuo1jfzke",reserved1:103,reserved1Input:"`H;4SyMB.\nfuxnv#RrP3EJQ&9Y[O0c CUo",reserved1Output:"x8b3ln1k9mceis4u0whjoyrzv5qgtapf27",reserved2:97,reserved2Input:"NXGt5=}]bIkh)8T>p-|eWs",reserved2Output:"qxn6iup3ot8gz7flcw09by"},{id:"ithc",input:"B c1 3FY%so6TiAx\nLP?qapt0]-Iye',reserved1Output:"k523tlpzeqvs0yjh81ogua6wnbr7c9mf4i",reserved2:49,reserved2Input:"hn[RXm|DOH/:.EVKJ;4}SU",reserved2Output:"m0ryiqt8362p1faulj4zgh"},{id:"irrr",input:"W0|7_z}{roYkhXL^%('/>NtQGguZSA4vU",output:"v9apyik6230j5ml7n8buqrf1zgscewxt4",reserved1:111,reserved1Input:`yjMF-f"R[ Hwxns)pIC1=258E96PK:JO +`,reserved1Output:"7gtkrpc45nwh6i8jfv93bsylaqezmu2o10",reserved2:104,reserved2Input:"milb`#3Baq];DTV?e.< &c",reserved2Output:"0t8kbf26uz9smh714pcexy"},{id:"vkds",input:`nSyNDG'Mj/o0# +rbqI7}-A|c`,reserved2Output:"uy8oa2s6g4j301t9bip7rc"},{id:"zmpc",input:"i;Uj'[np3JN]47u",reserved2Output:"9jmanwyqx0s54zuto6h"},{id:"fwbh",input:`x5A8hE9= +QG1"CuJ'oV(I)>lbW4D#e L6`,output:"wr275yogsj4kv03izcnx1uaqb8pflm6th",reserved1:57,reserved1Input:"3%t {2rckfyXR]?NK&/Fgw;TSMmn-7_iU.",reserved1Output:"y93rfts7lxq8vkgjen5m0i6wzhap1ucb2o",reserved2:101,reserved2Input:"}qBnp3JN]47u",reserved2Output:"9jmanwyqx0s54zuto6h"},{id:"nloc",input:"x<[ykY%1-sK9_C0Raj#8OLl]/HwhqFU 3",output:"0ozupkrx6qjwnygl34m7i9th1f8v2bec5",reserved1:97,reserved1Input:'&m2GT5IrP" .B(o=:igbJpWnz7tcvNZ`>\n',reserved1Output:"74hfvbtcj2eroa0ul56yw3inqxkgp9m1zs",reserved2:115,reserved2Input:"uV6})Q'?D{SeAMX4;Ef",reserved2Output:"91ysxe8luorn6vpciwq"},{id:"kynb",input:'0Nm}ubC9L6k{7("nx>s=Ko]IBw/ySgf%W',output:"a274bcljtv0omw6z9g5p13us8ekhxirfq",reserved1:121,reserved1Input:"e?`3AU<2Z[; iJEFV'|Pa8T5j-.v :q#H)",reserved1Output:"eow5rfluq8x4zgj70p13ci6mh2s9tnkabv",reserved2:110,reserved2Input:`&XD_QOhMrltpR1c4zG Y`,reserved2Output:"c7863qbsmwy54otnhiv1"},{id:"uyyk",input:"Tx2h{s[",output:"mjb0feu6lzx7kqhgop4at831c92ywir5n",reserved1:118,reserved1Input:`5f;Vt"qDLB91'm }?R6S(Z#A\`Jr0HQlKP)`,reserved1Output:"qp5r842ycvxjowbaz7uhts9gk6i0emn13f",reserved2:115,reserved2Input:"NGnE8a_y.FjYO=4w3]p7",reserved2Output:"kn1eho6fjbr40pxc9i2q"},{id:"rypa",input:`B8 /Y9o]VHC_p3yt hTONi5q6IG-r=2g%`,output:"ul2ow01j9zq58mfk4cv37absyigteh6xn",reserved1:112,reserved1Input:`nEeJKa.:P{A;x0UL"4'XFm|}wfvzQ#7ZS(`,reserved1Output:"m8961qwzghu27xeoapn3k5ilvrfjc4syt0",reserved2:114,reserved2Input:"&jbukM`c?1) l",reserved2Output:"6akyhor80m37slfw1vxp"},{id:"ehor",input:`"q4 -J3fkZhj<\`wH50T='g|(EP[B-QYD`,output:"7uil5a3gxbrptvjeymo4c09wqzs682nf1",reserved1:107,reserved1Input:"Ks_)v;Vu",reserved1Output:"ypwzx2usm8og5q74tanlb6ri3vcehj9kf1",reserved2:104,reserved2Input:"7y:x218]U#NC}nWaMS{L",reserved2Output:"bja3zkfvqltgu5sw678n"},{id:"zmpc",input:`.Ip>szJ8EwahYM/v;yKc=f -([_T q3nOS`,output:"5nv1iegza269ju8soky04h3p7rltcxmbq",reserved1:119,reserved1Input:'QCABV"]#0jb&Wo6t:UuiHg1rPD4%)RlNk-',reserved1Output:"le4971m5irpukxjv3sq2o8y60gnbzthwfa",reserved2:102,reserved2Input:"G752e`LXx'Zm}9< {?F",reserved2Output:"plbi21cxfmo36tn50uq"},{id:"fwbh",input:`x5A8hE9= -QG1"CuJ'oV(I)>lbW4D#e L6`,output:"wr275yogsj4kv03izcnx1uaqb8pflm6th",reserved1:57,reserved1Input:"3%t {2rckfyXR]?NK&/Fgw;TSMmn-7_iU.",reserved1Output:"y93rfts7lxq8vkgjen5m0i6wzhap1ucb2o",reserved2:101,reserved2Input:"}qBnp3JN]47u",reserved2Output:"9jmanwyqx0s54zuto6h"},{id:"nloc",input:"x<[ykY%1-sK9_C0Raj#8OLl]/HwhqFU 3",output:"0ozupkrx6qjwnygl34m7i9th1f8v2bec5",reserved1:97,reserved1Input:'&m2GT5IrP" .B(o=:igbJpWnz7tcvNZ`>\n',reserved1Output:"74hfvbtcj2eroa0ul56yw3inqxkgp9m1zs",reserved2:115,reserved2Input:"uV6})Q'?D{SeAMX4;Ef",reserved2Output:"91ysxe8luorn6vpciwq"},{id:"fkad",input:"7z>g}{/W#`c[ZT&sI<2-haKXYn\no)xSFA",output:"niue8tmyacj3l91q65fxbwzrv7po2gk40",reserved1:115,reserved1Input:"1EHb.|u?p(qfPity'r6O% w=]9BJRD;:8k",reserved1Output:"phm21v9cw4b73yglnfxotazsuj8qrk650i",reserved2:104,reserved2Input:'Qj^ NCUv54le"VMm_30GL',reserved2Output:"bixqrhwn9zjm54o12fe0s"},{id:"svmm",input:`maG;FT.e2cYzV:%i})g4bp-KUZy#[h{X19o&SEAM/n"O= 05P',reserved1Output:"36qz0mv9tne7kwra5i1ujx28oyfspcglh4",reserved2:101,reserved2Input:"|` 'Rqj6CNWH]I8sx7u3f",reserved2Output:"wegyjpzux38q2a9vmifot"},{id:"cokq",input:`(r%96jVK7{kP gDhOcFs'1;M"IuQZ/yqA`,output:"izxsomqh3p8bvga49w7fy2tluc6e5n01r",reserved1:106,reserved1Input:"^zG[wm\nC`=8Bv><&]0:T L#px3Xli-n).4",reserved1Output:"p91tzx4ibshwf3qyen506ugo2mkv8lrjc7",reserved2:107,reserved2Input:"EYf?RN2a}WbU5eH_|StJo",reserved2Output:"sm8fkhrwa94y0eupj2nq1"},{id:"znbg",input:"( EHC_;s/.WgNfVl z9MYhQ}Tj:JFUS)#",output:"o5hkm78up2yxwvzsj0at1bglr6ei43ncq",reserved1:102,reserved1Input:`KZi{^4#[h{X19o&SEAM/n"O= 05P',reserved1Output:"36qz0mv9tne7kwra5i1ujx28oyfspcglh4",reserved2:101,reserved2Input:"|` 'Rqj6CNWH]I8sx7u3f",reserved2Output:"wegyjpzux38q2a9vmifot"},{id:"cokq",input:`"(r%96jVK7{kP gDhOcFs'1;M"IuQZ/yqA"`,output:"izxsomqh3p8bvga49w7fy2tluc6e5n01r",reserved1:106,reserved1Input:"^zG[wm\nC`=8Bv><&]0:T L#px3Xli-n).4",reserved1Output:"p91tzx4ibshwf3qyen506ugo2mkv8lrjc7",reserved2:107,reserved2Input:"EYf?RN2a}WbU5eH_|StJo",reserved2Output:"sm8fkhrwa94y0eupj2nq1"},{id:"znbg",input:"( EHC_;s/.WgNfVl z9MYhQ}Tj:JFUS)#",output:"o5hkm78up2yxwvzsj0at1bglr6ei43ncq",reserved1:102,reserved1Input:`KZi{^4POo37nv?x&1`]2t",reserved2Output:"crxmjf7yhgt6o3p8l09iv"}];init_esbuild_inject();init_esbuild_inject();init_esbuild_inject();init_esbuild_inject();var CreateDebug=Namespace=>{let Header=`[microShield:${Namespace}]`;return new Proxy(console.debug,{apply(Target,ThisArg,ArgArray){Reflect.apply(Target,ThisArg,[Header,...ArgArray])}})};var Debug=CreateDebug("secret"),Secret=browser_default({length:20});var UnprotectedFetch=fetch;init_esbuild_inject();var TsMorph=__toESM(require_ts_morph(),1),TokenExtractor=class{Code;constructor(Code){this.Code=Code}GetToken(){let FileInstance=new TsMorph.Project({compilerOptions:{allowJs:!0,skipLibCheck:!0,target:TsMorph.ScriptTarget.ES2020},skipFileDependencyResolution:!0,useInMemoryFileSystem:!0}).createSourceFile("code.js",this.Code,{overwrite:!0}),Tokens=[],EncoderNodes=FileInstance.getDescendantsOfKind(TsMorph.SyntaxKind.FunctionDeclaration).filter(Descendant=>Descendant.getParent().getChildrenOfKind(TsMorph.SyntaxKind.ExpressionStatement).length>0).filter(EncoderNode2=>EncoderNode2.getKind()===TsMorph.SyntaxKind.FunctionDeclaration).filter(EncoderNode2=>EncoderNode2.getParent().getChildrenOfKind(TsMorph.SyntaxKind.ExpressionStatement)[0].getChildrenOfKind(TsMorph.SyntaxKind.BinaryExpression).length>0).filter(EncoderNode2=>EncoderNode2.getFullText().includes("=="));EncoderNodes=EncoderNodes[0].getParent().getChildrenOfKind(TsMorph.SyntaxKind.FunctionDeclaration);let DecoderNode=EncoderNodes.filter(EncoderNode2=>!EncoderNode2.getText().includes("=="))[0],EncoderNode=EncoderNodes.filter(EncoderNode2=>EncoderNode2.getText().includes("=="))[0],MinusNumber=Number(DecoderNode.getFirstDescendantByKind(TsMorph.SyntaxKind.MinusEqualsToken).getParent().getFirstDescendantByKind(TsMorph.SyntaxKind.NumericLiteral).getText()),EncoderStringArray=[];EncoderNode.getFirstDescendantByKind(TsMorph.SyntaxKind.ArrayLiteralExpression).getDescendantsOfKind(TsMorph.SyntaxKind.StringLiteral).forEach(Child=>{EncoderStringArray.push(Child.getText().slice(1,-1))});let ReorderConditionNode=FileInstance.getDescendantsOfKind(TsMorph.SyntaxKind.IfStatement).filter(IfStatement=>IfStatement.getText().match(/parseInt\(/g)?.length>4&&IfStatement.getText().includes("break"))[0].getFirstDescendantByKind(TsMorph.SyntaxKind.BinaryExpression),ReorderConditionVar=ReorderConditionNode.getDescendantsOfKind(TsMorph.SyntaxKind.Identifier).filter(Identifier=>Identifier.getParent().getDescendantsOfKind(TsMorph.SyntaxKind.NumericLiteral).length===1&&Identifier.getText()!=="parseInt")[0].getText();for(;!new Function("EncoderStringArray","MinusNumber",`const ${ReorderConditionVar} = (I) => { return EncoderStringArray[I - MinusNumber] } - return ${ReorderConditionNode.getText()}`)(EncoderStringArray,MinusNumber);)EncoderStringArray.push(EncoderStringArray.shift());return FileInstance.getDescendantsOfKind(TsMorph.SyntaxKind.Identifier).filter(Identifier=>{if(Identifier.getParent().getDescendantsOfKind(TsMorph.SyntaxKind.Identifier).length!==10||typeof Identifier.getFirstAncestorByKind(TsMorph.SyntaxKind.ReturnStatement)>"u")return!1;let ReturnStatementText=Identifier.getFirstAncestorByKind(TsMorph.SyntaxKind.ReturnStatement).getText();return ReturnStatementText.includes(".concat([")||ReturnStatementText.includes("/resources/")||ReturnStatementText.includes(".endpoint")||ReturnStatementText.includes("token=")||ReturnStatementText.includes("_")||ReturnStatementText.includes("resources://")}).forEach(TokenIdentifier=>{let TokenDeclarationNode=TokenIdentifier.findReferences()[0].getDefinition().getDeclarationNode();if(typeof TokenDeclarationNode.getFirstChildByKind(TsMorph.SyntaxKind.StringLiteral)<"u")Tokens.push(TokenDeclarationNode.getFirstChildByKind(TsMorph.SyntaxKind.StringLiteral).getText().slice(1,-1));else{let CurrentParam=Number(TokenDeclarationNode.getFirstDescendantByKind(TsMorph.SyntaxKind.NumericLiteral).getText());Tokens.push(EncoderStringArray[CurrentParam-MinusNumber])}}),Tokens.join("")}};var GetCachableHtml=async Url=>{let Text=await(await UnprotectedFetch(Url,{cache:"force-cache"})).text();if(Text.length===0)throw new Error("Failed to fetch resource!");return""},GetResourceToken=async ScriptUrl=>{let Text=await(await UnprotectedFetch(ScriptUrl,{cache:"force-cache"})).text(),Match=/eyJ[\w-]*\.eyJ[\w-]*\.[\w-]*/.exec(Text);if(Match===null){let ResponseHash=Array.from(new Uint8Array(await crypto.subtle.digest("SHA-1",new TextEncoder().encode(Text)))).map(Block=>Block.toString(16).padStart(2,"0")).join("");try{return await GetResourceTokenFromCDN(ResponseHash)}catch{if(await GM.getValue(ResponseHash,null)===null){let Token=new TokenExtractor(Text).GetToken();return await GM.setValue(ResponseHash,Token),Token}else return await GM.getValue(ResponseHash,null)}}return Match[0]},GetResourceTokenFromCDN=async Hash=>{let CurrentDate=new Date,XHR=await GM.xmlHttpRequest({url:`https://cdn.jsdelivr.net/gh/List-KR/microShield-token@latest/${CurrentDate.getUTCFullYear()}/${CurrentDate.getUTCMonth()}/${CurrentDate.getUTCDate()}/${Hash}.token`});if(XHR.status!==200)throw new Error("Failed to fetch token!");return XHR.response},ResolveResourceUrls=async(Html,Token)=>{let Pattern=/(resources:\/\/[^'"]+)/g,Host=GetRandomAdShieldHost(),NewHtml="",Matches=null;for(;(Matches=Pattern.exec(Html))!==null;){let Url="https://"+Host+"/resources/"+Matches[1].slice(12)+"?token="+Token;NewHtml+=await GetCachableHtml(Url).catch(Errors=>(console.error(Errors),""))}return NewHtml};init_esbuild_inject();init_esbuild_inject();var ProtectedPrefix="asdf-";var Pull=Key=>localStorage.getItem(ProtectedPrefix+Key,Secret),Push=(Key,Value)=>{localStorage.setItem(ProtectedPrefix+Key,Value,Secret)};var Debug2=CreateDebug("entities");var InsertTextEntity=Entity=>{let SelectedNode=document.querySelector(Entity.Selector);if(!SelectedNode)throw new Error("The target node was not found in the frame!");SelectedNode.before(Entity.TextContent),SelectedNode.remove()},IsInstailledInAdGuardCoreLib=new Error().stack?.includes("local.adguard.org"),InsertHeadEntity=Entity=>{IsInstailledInAdGuardCoreLib&&location.hostname.includes("etoday.co.kr")&&document.querySelectorAll(".sticky-body-spacer, .sticky-body-spacer_sub").forEach(Element=>Element.classList.remove("sticky-body-spacer","sticky-body-spacer_sub")),document.head.insertAdjacentHTML("beforeend",Entity.Html)},InsertEntity=async Entity=>{Entity.Type===1?InsertHeadEntity(Entity):Entity.Type===0&&InsertTextEntity(Entity)},InsertEntities=async Entities=>Promise.allSettled(Entities.map(async Entity=>InsertEntity(Entity))),TryCachedEntities=async()=>{let Json=Pull("entity-cache-rev2");if(!Json)throw new Error("The cached entities does not exist on this browser!");let Data=JSON.parse(Json);if(Date.now()-Data.CreatedAt>1e3*60*60*24*30)throw new Error("The cached entities are too old!");if(!Data.Entities.reduce((State,Entity)=>Entity.Type===1?State+Entity.Html.length:State,0))throw new Error("The cached entities has no content!");return Debug2("restoring cached entities data=",Data),await InsertEntities(Data.Entities),!0},PutCachedEntities=Entity=>{Entity.length!==0&&Push("entity-cache-rev2",JSON.stringify({Entity,CreatedAt:Date.now()}))};init_esbuild_inject();var DocumentReady=async(Doc=document)=>{if(Doc.readyState==="loading")return new Promise(Resolve=>{Doc.addEventListener("readystatechange",()=>{Resolve()})})};init_esbuild_inject();var HardcodedEntities=[{domain:"mydaily.co.kr",css:[".header_top > .header_right { width: 180px !important; }"]}],LoadHardcoded=()=>HardcodedEntities.find(Entity=>location.hostname.includes(Entity.domain));var Debug3=CreateDebug("ztinywave"),Decode=Payload=>{let Id=Payload.slice(0,4),Key=source.find(Store=>Store.id===Id);if(!Key)throw new Error("DEFUSER_ZTINYWAVE_KEY_NOT_FOUND");let Ra=String.fromCharCode(Key.reserved1),Rb=String.fromCharCode(Key.reserved2),Unwrap=(Input,Output,Char)=>{let Index=Output.indexOf(Char);return Index>=0?Input[Index]:Char},Mode=0,Data=Payload.slice(4).split("").map(Char=>{if(!Mode){if(Char===Ra)return Mode=1,"";if(Char===Rb)return Mode=2,""}return Mode===1?(Mode=0,Key.reserved1Output.includes(Char)?Unwrap(Key.reserved1Input,Key.reserved1Output,Char):Unwrap(Key.input,Key.output,Char)+Char):Mode===2?(Mode=0,Key.reserved2Output.includes(Char)?Unwrap(Key.reserved2Input,Key.reserved2Output,Char):Unwrap(Key.input,Key.output,Char)+Char):Unwrap(Key.input,Key.output,Char)}).join("");return JSON.parse(Data)},Extract=async()=>{let Sources=[],Pick=()=>{let Targets=document.querySelectorAll('script[data]:not([data=""]),script[wp-data]:not([wp-data=""])');for(let Target of Targets){let Script=Target.getAttribute("src"),Data=Target.getAttribute("data");Script&&Data&&Sources.push({Script,Data})}};if(Pick(),Sources.length===0&&(await DocumentReady(document),Pick()),Sources.length===0)throw new Error("DEFUSER_ZTINYWAVE_TARGET_NOT_FOUND");return Sources},Tinywave=async()=>{if(await TryCachedEntities().catch(Errors=>(Debug3("Failed to initialise cached entities",Errors),!1)))return;let Entities=[],Sources=await Extract(),LoadedHardcoded=LoadHardcoded();if(LoadedHardcoded?.domain)for(let Item of LoadedHardcoded.css)Sources.push({Script:LoadedHardcoded.domain,Data:``});let SourcesResolves=Sources.map(async Source=>{Debug3("source",Source);let Payload=[{tags:Source.Data}];Source.Data.startsWith("{await DocumentReady(document);let AppenDant="";for(let TargetNode of document.querySelectorAll("script[wp-data]")){let Attribute=TargetNode.getAttribute("wp-data");if(!Attribute){Debug4("empty attribute",TargetNode);continue}let Decoded;try{Decoded=new TextDecoder().decode(Uint8Array.from(atob(Attribute),C=>C.charCodeAt(0)))}catch(e){Debug4("failed to decode base64 stream",e);continue}if(!Decoded.startsWith("<")){Debug4("failed to decode encoded text",Decoded);continue}AppenDant+=Decoded}AppenDant&&document.head.insertAdjacentHTML("beforeend",AppenDant)};init_esbuild_inject();async function CheckVersion(){if(await GM.getValue("version",null)===null)await GM.setValue("version",GM.info.script.version);else if(await GM.getValue("version",null)!==GM.info.script.version){for(let Key of await GM.listValues())await GM.deleteValue(Key);await GM.setValue("version",GM.info.script.version)}}var Bootstrap=()=>{Tinywave(),BaseDrop()};CheckVersion();Bootstrap();})(); + return ${ReorderConditionNode.getText()}`)(EncoderStringArray,MinusNumber);)EncoderStringArray.push(EncoderStringArray.shift());return FileInstance.getDescendantsOfKind(TsMorph.SyntaxKind.Identifier).filter(Identifier=>{if(Identifier.getParent().getDescendantsOfKind(TsMorph.SyntaxKind.Identifier).length!==10||typeof Identifier.getFirstAncestorByKind(TsMorph.SyntaxKind.ReturnStatement)>"u")return!1;let ReturnStatementText=Identifier.getFirstAncestorByKind(TsMorph.SyntaxKind.ReturnStatement).getText();return ReturnStatementText.includes(".concat([")||ReturnStatementText.includes("/resources/")||ReturnStatementText.includes(".endpoint")||ReturnStatementText.includes("token=")||ReturnStatementText.includes("_")||ReturnStatementText.includes("resources://")}).forEach(TokenIdentifier=>{let TokenDeclarationNode=TokenIdentifier.findReferences()[0].getDefinition().getDeclarationNode();if(typeof TokenDeclarationNode.getFirstChildByKind(TsMorph.SyntaxKind.StringLiteral)<"u")Tokens.push(TokenDeclarationNode.getFirstChildByKind(TsMorph.SyntaxKind.StringLiteral).getText().slice(1,-1));else{let CurrentParam=Number(TokenDeclarationNode.getFirstDescendantByKind(TsMorph.SyntaxKind.NumericLiteral).getText());Tokens.push(EncoderStringArray[CurrentParam-MinusNumber])}}),Tokens.filter((Token,Index)=>Index<10).join("")}};var GetCachableHtml=async Url=>{let Text=await(await UnprotectedFetch(Url,{cache:"force-cache"})).text();if(Text.length===0)throw new Error("Failed to fetch resource!");return""},GetResourceToken=async ScriptUrl=>{let Text=await(await UnprotectedFetch(ScriptUrl,{cache:"force-cache"})).text(),Match=/eyJ[\w-]*\.eyJ[\w-]*\.[\w-]*/.exec(Text);if(Match===null){let ResponseHash=Array.from(new Uint8Array(await crypto.subtle.digest("SHA-1",new TextEncoder().encode(Text)))).map(Block=>Block.toString(16).padStart(2,"0")).join("");try{return await GetResourceTokenFromCDN(ResponseHash)}catch{if(await GM.getValue(ResponseHash,null)===null){let Token=new TokenExtractor(Text).GetToken();return await GM.setValue(ResponseHash,Token),Token}else return await GM.getValue(ResponseHash,null)}}return Match[0]},GetResourceTokenFromCDN=async Hash=>{let CurrentDate=new Date,XHR=await GM.xmlHttpRequest({url:`https://cdn.jsdelivr.net/gh/List-KR/microShield-token@latest/${CurrentDate.getUTCFullYear()}/${CurrentDate.getUTCMonth()}/${CurrentDate.getUTCDate()}/${Hash}.token`});if(XHR.status!==200)throw new Error("Failed to fetch token!");return XHR.response},ResolveResourceUrls=async(Html,Token)=>{let Pattern=/(resources:\/\/[^'"]+)/g,Host=GetRandomAdShieldHost(),NewHtml="",Matches=null;for(;(Matches=Pattern.exec(Html))!==null;){let Url="https://"+Host+"/resources/"+Matches[1].slice(12)+"?token="+Token;NewHtml+=await GetCachableHtml(Url).catch(Errors=>(console.error(Errors),""))}return NewHtml};init_esbuild_inject();init_esbuild_inject();var ProtectedPrefix="asdf-";var Pull=Key=>localStorage.getItem(ProtectedPrefix+Key,Secret),Push=(Key,Value)=>{localStorage.setItem(ProtectedPrefix+Key,Value,Secret)};var Debug2=CreateDebug("entities");var InsertTextEntity=Entity=>{let SelectedNode=document.querySelector(Entity.Selector);if(!SelectedNode)throw new Error("The target node was not found in the frame!");SelectedNode.before(Entity.TextContent),SelectedNode.remove()},IsInstailledInAdGuardCoreLib=new Error().stack?.includes("local.adguard.org"),InsertHeadEntity=Entity=>{IsInstailledInAdGuardCoreLib&&location.hostname.includes("etoday.co.kr")&&document.querySelectorAll(".sticky-body-spacer, .sticky-body-spacer_sub").forEach(Element=>Element.classList.remove("sticky-body-spacer","sticky-body-spacer_sub")),document.head.insertAdjacentHTML("beforeend",Entity.Html)},InsertEntity=async Entity=>{Entity.Type===1?InsertHeadEntity(Entity):Entity.Type===0&&InsertTextEntity(Entity)},InsertEntities=async Entities=>Promise.allSettled(Entities.map(async Entity=>InsertEntity(Entity))),TryCachedEntities=async()=>{let Json=Pull("entity-cache-rev2");if(!Json)throw new Error("The cached entities does not exist on this browser!");let Data=JSON.parse(Json);if(Date.now()-Data.CreatedAt>1e3*60*60*24*30)throw new Error("The cached entities are too old!");if(!Data.Entities.reduce((State,Entity)=>Entity.Type===1?State+Entity.Html.length:State,0))throw new Error("The cached entities has no content!");return Debug2("restoring cached entities data=",Data),await InsertEntities(Data.Entities),!0},PutCachedEntities=Entity=>{Entity.length!==0&&Push("entity-cache-rev2",JSON.stringify({Entity,CreatedAt:Date.now()}))};init_esbuild_inject();var DocumentReady=async(Doc=document)=>{if(Doc.readyState==="loading")return new Promise(Resolve=>{Doc.addEventListener("readystatechange",()=>{Resolve()})})};init_esbuild_inject();var HardcodedEntities=[{domain:"mydaily.co.kr",css:[".header_top > .header_right { width: 180px !important; }"]}],LoadHardcoded=()=>HardcodedEntities.find(Entity=>location.hostname.includes(Entity.domain));var Debug3=CreateDebug("ztinywave"),Decode=Payload=>{let Id=Payload.slice(0,4),Key=source.find(Store=>Store.id===Id);if(!Key)throw new Error("DEFUSER_ZTINYWAVE_KEY_NOT_FOUND");let Ra=String.fromCharCode(Key.reserved1),Rb=String.fromCharCode(Key.reserved2),Unwrap=(Input,Output,Char)=>{let Index=Output.indexOf(Char);return Index>=0?Input[Index]:Char},Mode=0,Data=Payload.slice(4).split("").map(Char=>{if(!Mode){if(Char===Ra)return Mode=1,"";if(Char===Rb)return Mode=2,""}return Mode===1?(Mode=0,Key.reserved1Output.includes(Char)?Unwrap(Key.reserved1Input,Key.reserved1Output,Char):Unwrap(Key.input,Key.output,Char)+Char):Mode===2?(Mode=0,Key.reserved2Output.includes(Char)?Unwrap(Key.reserved2Input,Key.reserved2Output,Char):Unwrap(Key.input,Key.output,Char)+Char):Unwrap(Key.input,Key.output,Char)}).join("");return JSON.parse(Data)},Extract=async()=>{let Sources=[],Pick=()=>{let Targets=document.querySelectorAll('script[data]:not([data=""]),script[wp-data]:not([wp-data=""])');for(let Target of Targets){let Script=Target.getAttribute("src"),Data=Target.getAttribute("data");Script&&Data&&Sources.push({Script,Data})}};if(Pick(),Sources.length===0&&(await DocumentReady(document),Pick()),Sources.length===0)throw new Error("DEFUSER_ZTINYWAVE_TARGET_NOT_FOUND");return Sources},Tinywave=async()=>{if(await TryCachedEntities().catch(Errors=>(Debug3("Failed to initialise cached entities",Errors),!1)))return;let Entities=[],Sources=await Extract(),LoadedHardcoded=LoadHardcoded();if(LoadedHardcoded?.domain)for(let Item of LoadedHardcoded.css)Sources.push({Script:LoadedHardcoded.domain,Data:``});let SourcesResolves=Sources.map(async Source=>{Debug3("source",Source);let Payload=[{tags:Source.Data}];Source.Data.startsWith("{await DocumentReady(document);let AppenDant="";for(let TargetNode of document.querySelectorAll("script[wp-data]")){let Attribute=TargetNode.getAttribute("wp-data");if(!Attribute){Debug4("empty attribute",TargetNode);continue}let Decoded;try{Decoded=new TextDecoder().decode(Uint8Array.from(atob(Attribute),C=>C.charCodeAt(0)))}catch(e){Debug4("failed to decode base64 stream",e);continue}if(!Decoded.startsWith("<")){Debug4("failed to decode encoded text",Decoded);continue}AppenDant+=Decoded}AppenDant&&document.head.insertAdjacentHTML("beforeend",AppenDant)};init_esbuild_inject();async function CheckVersion(){if(await GM.getValue("version",null)===null)await GM.setValue("version",GM.info.script.version);else if(await GM.getValue("version",null)!==GM.info.script.version){for(let Key of await GM.listValues())await GM.deleteValue(Key);await GM.setValue("version",GM.info.script.version)}}var Bootstrap=()=>{Tinywave(),BaseDrop()};CheckVersion();Bootstrap();})(); /*! Bundled license information: @ts-morph/common/dist/typescript.js: diff --git a/microShield.user.js b/microShield.user.js index 9b988c2..608cf07 100644 --- a/microShield.user.js +++ b/microShield.user.js @@ -8,7 +8,7 @@ // @downloadURL https://cdn.jsdelivr.net/gh/List-KR/microShield@latest/microShield.user.js // @license Apache-2.0 // -// @version 4.8.0 +// @version 4.9.0 // @author PiQuark6046 and contributors // // @match *://ygosu.com/* @@ -31146,18 +31146,20 @@ Node text: ${this.#forgottenText}`),new common.errors.InvalidOperationError(mess `);function getStarPosIfFirstNonWhitespaceChar(text){for(let i=0;ithis._getNodeFromCompilerNode(t))??[]}getInnerText(){return getTextWithoutStars(this.getText())}getComment(){if(this.compilerNode.comment!=null)return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:this.compilerNode.comment.map(n=>this._getNodeFromCompilerNodeIfExists(n))}getCommentText(){return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:common.ts.getTextOfJSDocComment(this.compilerNode.comment)}getDescription(){let sourceFileText=this.getSourceFile().getFullText(),endSearchStart=this.getTags()[0]?.getStart()??this.getEnd()-2,start=getStart(this);return getTextWithoutStars(sourceFileText.substring(start,Math.max(start,getEndPos())));function getStart(jsDoc){let startOrSpacePos=jsDoc.getStart()+3;return sourceFileText.charCodeAt(startOrSpacePos)===CharCodes.SPACE?startOrSpacePos+1:startOrSpacePos}function getEndPos(){let endOrNewLinePos=getPreviousMatchingPos(sourceFileText,endSearchStart,charCode=>charCode===CharCodes.NEWLINE||!common.StringUtils.isWhitespaceCharCode(charCode)&&charCode!==CharCodes.ASTERISK);return getPreviousMatchingPos(sourceFileText,endOrNewLinePos,charCode=>charCode!==CharCodes.NEWLINE&&charCode!==CharCodes.CARRIAGE_RETURN)}}setDescription(textOrWriterFunction){let tags=this.getTags(),startEditPos=this.getStart()+3,endEditPos=tags.length>0?getPreviousMatchingPos(this._sourceFile.getFullText(),tags[0].getStart(),c=>c===CharCodes.ASTERISK)-1:this.getEnd()-2;return replaceTextPossiblyCreatingChildNodes({parent:this,newText:getNewText.call(this),replacePos:startEditPos,replacingLength:endEditPos-startEditPos}),this;function getNewText(){let indentationText=this.getIndentationText(),newLineKind=this._context.manipulationSettings.getNewLineKindAsString(),rawLines=getTextFromStringOrWriter(this._getWriter(),textOrWriterFunction).split(/\r?\n/),startsWithNewLine=rawLines[0].length===0,isSingleLine=rawLines.length===1&&(this.compilerNode.tags?.length??0)===0,linesText=isSingleLine?rawLines[0]:rawLines.map(l=>l.length===0?`${indentationText} *`:`${indentationText} * ${l}`).slice(startsWithNewLine?1:0).join(newLineKind);return isSingleLine?" "+linesText+" ":newLineKind+linesText+newLineKind+indentationText+" "}}addTag(structure){return this.addTags([structure])[0]}addTags(structures){return this.insertTags(this.compilerNode.tags?.length??0,structures)}insertTag(index,structure){return this.insertTags(index,[structure])[0]}insertTags(index,structures){if(common.ArrayUtils.isNullOrEmpty(structures))return[];let writer=this._getWriterWithQueuedIndentation(),tags=this.getTags();if(index=verifyAndGetIndex(index,tags.length),tags.length===0&&!this.isMultiLine()){let structurePrinter=this._context.structurePrinterFactory.forJSDoc();this.replaceWithText(writer2=>{structurePrinter.printText(writer2,{description:this.getDescription(),tags:structures})})}else{let structurePrinter=this._context.structurePrinterFactory.forJSDocTag({printStarsOnNewLine:!0});writer.newLine().write(" * "),structurePrinter.printTexts(writer,structures),writer.newLine().write(" *"),writer.conditionalWrite(index!common.StringUtils.isWhitespaceCharCode(charCode)&&charCode!==CharCodes.ASTERISK))}function getReplaceEnd(){return index{this._context.structurePrinterFactory.forJSDoc().printText(writer,{description:structure.description??this.getDescription(),tags:structure.tags})}):(structure.description!=null&&this.setDescription(structure.description),this)}getStructure(){return callBaseGetStructure(JSDocBase.prototype,this,{kind:exports.StructureKind.JSDoc,description:this.getDescription(),tags:this.getTags().map(t=>t.getStructure())})}},TypeNode=class extends Node{},NodeWithTypeArgumentsBase=TypeArgumentedNode(TypeNode),NodeWithTypeArguments=class extends NodeWithTypeArgumentsBase{},ArrayTypeNode=class extends TypeNode{getElementTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.elementType)}},ConditionalTypeNode=class extends TypeNode{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)}},FunctionOrConstructorTypeNodeBaseBase=SignaturedDeclaration(TypeNode),FunctionOrConstructorTypeNodeBase=class extends FunctionOrConstructorTypeNodeBaseBase{},ConstructorTypeNodeBase=AbstractableNode(ModifierableNode(FunctionOrConstructorTypeNodeBase)),ConstructorTypeNode=class extends ConstructorTypeNodeBase{},ExpressionWithTypeArgumentsBase=LeftHandSideExpressionedNode(NodeWithTypeArguments),ExpressionWithTypeArguments=class extends ExpressionWithTypeArgumentsBase{},FunctionTypeNodeBase=TypeParameteredNode(FunctionOrConstructorTypeNodeBase),FunctionTypeNode=class extends FunctionTypeNodeBase{},ImportTypeNode=class extends NodeWithTypeArguments{setArgument(text){let arg=this.getArgument();if(Node.isLiteralTypeNode(arg)){let literal=arg.getLiteral();if(Node.isStringLiteral(literal))return literal.setLiteralValue(text),this}return arg.replaceWithText(writer=>writer.quote(text),this._getWriterWithQueuedChildIndentation()),this}getArgument(){return this._getNodeFromCompilerNode(this.compilerNode.argument)}setQualifier(text){let qualifier=this.getQualifier();if(qualifier!=null)qualifier.replaceWithText(text,this._getWriterWithQueuedChildIndentation());else{let paren=this.getFirstChildByKindOrThrow(common.SyntaxKind.CloseParenToken);insertIntoParentTextRange({insertPos:paren.getEnd(),parent:this,newText:this._getWriterWithQueuedIndentation().write(".").write(text).toString()})}return this}getQualifierOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getQualifier(),message??(()=>`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(message){return common.errors.throwIfNullOrUndefined(this._getNodeFromCompilerNodeIfExists(this.compilerNode.attributes),message??"Could not find import type assertion container.",this)}},IndexedAccessTypeNode=class extends TypeNode{getObjectTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.objectType)}getIndexTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.indexType)}},InferTypeNode=class extends TypeNode{getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}},IntersectionTypeNode=class extends TypeNode{getTypeNodes(){return this.compilerNode.types.map(t=>this._getNodeFromCompilerNode(t))}},LiteralTypeNode=class extends TypeNode{getLiteral(){let tsLiteral=this.compilerNode.literal;return this._getNodeFromCompilerNode(tsLiteral)}},MappedTypeNode=class extends TypeNode{getNameTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.nameType)}getNameTypeNodeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getNameTypeNode(),message??"Type did not exist.",this)}getReadonlyToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.readonlyToken)}getReadonlyTokenOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getReadonlyToken(),message??"Readonly token did not exist.",this)}getQuestionToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.questionToken)}getQuestionTokenOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getQuestionToken(),message??"Question token did not exist.",this)}getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getTypeNode(),message??"Type did not exist, but was expected to exist.",this)}},createBase$e=ctor=>TypedNode(QuestionTokenableNode(DotDotDotTokenableNode(JSDocableNode(NamedNode(ctor))))),NamedTupleMemberBase=createBase$e(TypeNode),NamedTupleMember=class extends NamedTupleMemberBase{getTypeNode(){return super.getTypeNode()}removeType(){throw new common.errors.InvalidOperationError("Cannot remove the type of a named tuple member.")}},ParenthesizedTypeNode=class extends TypeNode{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}setType(textOrWriterFunction){return this.getTypeNode().replaceWithText(textOrWriterFunction),this}},RestTypeNode=class extends TypeNode{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},TemplateLiteralTypeNode=class extends TypeNode{getHead(){return this._getNodeFromCompilerNode(this.compilerNode.head)}getTemplateSpans(){return this.compilerNode.templateSpans.map(s=>this._getNodeFromCompilerNode(s))}setLiteralValue(value){let childIndex=this.getChildIndex(),parent=this.getParentSyntaxList()??this.getParentOrThrow();return replaceNodeText({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:value}),parent.getChildAtIndex(childIndex)}},ThisTypeNode=class extends TypeNode{},TupleTypeNode=class extends TypeNode{getElements(){return this.compilerNode.elements.map(t=>this._getNodeFromCompilerNode(t))}},createBase$d=ctor=>TypeParameteredNode(TypedNode(JSDocableNode(AmbientableNode(ExportableNode(ModifierableNode(NamedNode(ctor))))))),TypeAliasDeclarationBase=createBase$d(Statement),TypeAliasDeclaration=class extends TypeAliasDeclarationBase{set(structure){return callBaseSet(TypeAliasDeclarationBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(TypeAliasDeclarationBase.prototype,this,{kind:exports.StructureKind.TypeAlias,type:this.getTypeNodeOrThrow().getText()})}},TypeLiteralNodeBase=TypeElementMemberedNode(TypeNode),TypeLiteralNode=class extends TypeLiteralNodeBase{},TypeOperatorTypeNode=class extends TypeNode{getOperator(){return this.compilerNode.operator}getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}};exports.TypeParameterVariance=void 0;(function(TypeParameterVariance){TypeParameterVariance[TypeParameterVariance.None=0]="None",TypeParameterVariance[TypeParameterVariance.In=1]="In",TypeParameterVariance[TypeParameterVariance.Out=2]="Out",TypeParameterVariance[TypeParameterVariance.InOut=3]="InOut"})(exports.TypeParameterVariance||(exports.TypeParameterVariance={}));var createBase$c=ctor=>ModifierableNode(NamedNode(ctor)),TypeParameterDeclarationBase=createBase$c(Node),TypeParameterDeclaration=class extends TypeParameterDeclarationBase{isConst(){return this.hasModifier(common.SyntaxKind.ConstKeyword)}setIsConst(value){return this.toggleModifier("const",value)}getConstraint(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.constraint)}getConstraintOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getConstraint(),message??"Expected to find the type parameter's constraint.",this)}setConstraint(text){if(text=this.getParentOrThrow()._getTextWithQueuedChildIndentation(text),common.StringUtils.isNullOrWhitespace(text))return this.removeConstraint(),this;let constraint=this.getConstraint();if(constraint!=null)return constraint.replaceWithText(text),this;let nameNode=this.getNameNode();return insertIntoParentTextRange({parent:this,insertPos:nameNode.getEnd(),newText:` extends ${text}`}),this}removeConstraint(){return removeConstraintOrDefault(this.getConstraint(),common.SyntaxKind.ExtendsKeyword),this}getDefault(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.default)}getDefaultOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getDefault(),message??"Expected to find the type parameter's default.",this)}setDefault(text){if(text=this.getParentOrThrow()._getTextWithQueuedChildIndentation(text),common.StringUtils.isNullOrWhitespace(text))return this.removeDefault(),this;let defaultNode=this.getDefault();if(defaultNode!=null)return defaultNode.replaceWithText(text),this;let insertAfterNode=this.getConstraint()||this.getNameNode();return insertIntoParentTextRange({parent:this,insertPos:insertAfterNode.getEnd(),newText:` = ${text}`}),this}removeDefault(){return removeConstraintOrDefault(this.getDefault(),common.SyntaxKind.EqualsToken),this}setVariance(variance){return this.toggleModifier("in",(variance&exports.TypeParameterVariance.In)!==0),this.toggleModifier("out",(variance&exports.TypeParameterVariance.Out)!==0),this}getVariance(){let variance=exports.TypeParameterVariance.None;return this.hasModifier(common.SyntaxKind.InKeyword)&&(variance|=exports.TypeParameterVariance.In),this.hasModifier(common.SyntaxKind.OutKeyword)&&(variance|=exports.TypeParameterVariance.Out),variance}remove(){let parentSyntaxList=this.getParentSyntaxListOrThrow();parentSyntaxList.getChildrenOfKind(common.SyntaxKind.TypeParameter).length===1?removeAllTypeParameters():removeCommaSeparatedChild(this);function removeAllTypeParameters(){let children=[parentSyntaxList.getPreviousSiblingIfKindOrThrow(common.SyntaxKind.LessThanToken),parentSyntaxList,parentSyntaxList.getNextSiblingIfKindOrThrow(common.SyntaxKind.GreaterThanToken)];removeChildren({children})}}set(structure){return callBaseSet(TypeParameterDeclarationBase.prototype,this,structure),structure.isConst!=null&&this.setIsConst(structure.isConst),structure.constraint!=null?this.setConstraint(structure.constraint):structure.hasOwnProperty(common.nameof(structure,"constraint"))&&this.removeConstraint(),structure.default!=null?this.setDefault(structure.default):structure.hasOwnProperty(common.nameof(structure,"default"))&&this.removeDefault(),structure.variance!=null&&this.setVariance(structure.variance),this}getStructure(){let constraintNode=this.getConstraint(),defaultNode=this.getDefault();return callBaseGetStructure(TypeParameterDeclarationBase.prototype,this,{kind:exports.StructureKind.TypeParameter,isConst:this.isConst(),constraint:constraintNode?.getText({trimLeadingIndentation:!0}),default:defaultNode?defaultNode.getText({trimLeadingIndentation:!0}):void 0,variance:this.getVariance()})}};function removeConstraintOrDefault(nodeToRemove,siblingKind){nodeToRemove!=null&&removeChildren({children:[nodeToRemove.getPreviousSiblingIfKindOrThrow(siblingKind),nodeToRemove],removePrecedingSpaces:!0})}var TypePredicateNode=class extends TypeNode{getParameterNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.parameterName)}hasAssertsModifier(){return this.compilerNode.assertsModifier!=null}getAssertsModifier(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertsModifier)}getAssertsModifierOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getAssertsModifier(),message??"Expected to find an asserts modifier.",this)}getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getTypeNode(),message??"Expected to find a type node.",this)}},TypeQueryNode=class extends NodeWithTypeArguments{getExprName(){return this._getNodeFromCompilerNode(this.compilerNode.exprName)}},TypeReferenceNode=class extends NodeWithTypeArguments{getTypeName(){return this._getNodeFromCompilerNode(this.compilerNode.typeName)}},UnionTypeNode=class extends TypeNode{getTypeNodes(){return this.compilerNode.types.map(t=>this._getNodeFromCompilerNode(t))}},JSDocType=class extends TypeNode{},JSDocAllType=class extends JSDocType{},JSDocTagBase=Node,JSDocTag=class extends JSDocTagBase{getTagName(){return this.getTagNameNode().getText()}getTagNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.tagName)}setTagName(tagName){return this.set({tagName})}getComment(){if(this.compilerNode.comment!=null)return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:this.compilerNode.comment.map(n=>this._getNodeFromCompilerNodeIfExists(n))}getCommentText(){return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:common.ts.getTextOfJSDocComment(this.compilerNode.comment)}remove(){let jsDocBodyStart=this.getParentOrThrow().getStart()+3,nextJsDocTag=getNextJsDocTag(this),isLastJsDoc=nextJsDocTag==null,removalStart=getRemovalStart.call(this);removeChildren({children:[this],customRemovalPos:removalStart,customRemovalEnd:getNextTagStartOrDocEnd(this,nextJsDocTag),replaceTrivia:getReplaceTrivia.call(this)});function getRemovalStart(){return Math.max(jsDocBodyStart,getPreviousNonWhiteSpacePos(this,this.getStart()))}function getReplaceTrivia(){if(removalStart===jsDocBodyStart&&isLastJsDoc)return"";let newLineKind=this._context.manipulationSettings.getNewLineKindAsString(),indentationText=this.getParentOrThrow().getIndentationText();return`${newLineKind}${indentationText} `+(isLastJsDoc?"":"* ")}}set(structure){return callBaseSet(JSDocTagBase.prototype,this,structure),structure.text!=null||structure.tagName!=null?this.replaceWithText(writer=>{this._context.structurePrinterFactory.forJSDocTag({printStarsOnNewLine:!0}).printText(writer,{tagName:structure.tagName??this.getTagName(),text:structure.text!=null?structure.text:getText(this)})}):this}replaceWithText(textOrWriterFunction){let newText=getTextFromStringOrWriter(this._getWriterWithQueuedIndentation(),textOrWriterFunction),parent=this.getParentOrThrow(),childIndex=this.getChildIndex(),start=this.getStart();return insertIntoParentTextRange({parent,insertPos:start,newText,replacing:{textLength:getTagEnd(this)-start}}),parent.getChildren()[childIndex]}getStructure(){let text=getText(this);return callBaseGetStructure(JSDocTagBase.prototype,this,{kind:exports.StructureKind.JSDocTag,tagName:this.getTagName(),text:text.length===0?void 0:text})}};function getText(jsDocTag){let text=jsDocTag.getSourceFile().getFullText(),nameEnd=jsDocTag.getTagNameNode().getEnd(),tagEnd=getTagEnd(jsDocTag),startPos=Math.min(text.charCodeAt(nameEnd)===CharCodes.SPACE?nameEnd+1:nameEnd,tagEnd);return getTextWithoutStars(text.substring(startPos,tagEnd))}function getTagEnd(jsDocTag){return getPreviousNonWhiteSpacePos(jsDocTag,getNextTagStartOrDocEnd(jsDocTag))}function getNextTagStartOrDocEnd(jsDocTag,nextJsDocTag){return nextJsDocTag=nextJsDocTag??getNextJsDocTag(jsDocTag),nextJsDocTag!=null?nextJsDocTag.getStart():jsDocTag.getParentOrThrow().getEnd()-2}function getNextJsDocTag(jsDocTag){let tags=jsDocTag.getParentIfKindOrThrow(common.SyntaxKind.JSDoc).getTags(),thisIndex=tags.indexOf(jsDocTag);return tags[thisIndex+1]}function getPreviousNonWhiteSpacePos(jsDocTag,pos){let sourceFileText=jsDocTag.getSourceFile().getFullText();return getPreviousMatchingPos(sourceFileText,pos,charCode=>charCode!==CharCodes.ASTERISK&&!common.StringUtils.isWhitespaceCharCode(charCode))}var JSDocAugmentsTag=class extends JSDocTag{},JSDocAuthorTag=class extends JSDocTag{},JSDocCallbackTag=class extends JSDocTag{},JSDocClassTag=class extends JSDocTag{},JSDocDeprecatedTag=class extends JSDocTag{},JSDocEnumTag=class extends JSDocTag{},JSDocFunctionTypeBase=SignaturedDeclaration(JSDocType),JSDocFunctionType=class extends JSDocFunctionTypeBase{},JSDocImplementsTag=class extends JSDocTag{},JSDocLink=class extends Node{},JSDocLinkCode=class extends Node{},JSDocLinkPlain=class extends Node{},JSDocMemberName=class extends Node{},JSDocNamepathType=class extends JSDocType{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},JSDocNameReference=class extends Node{getName(){return this._getNodeFromCompilerNode(this.compilerNode.name)}},JSDocNonNullableType=class extends JSDocType{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}isPostfix(){return this.compilerNode.postfix}},JSDocNullableType=class extends JSDocType{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}isPostfix(){return this.compilerNode.postfix}},JSDocOptionalType=class extends JSDocType{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},JSDocOverloadTagBase=JSDocTypeExpressionableTag(JSDocTag),JSDocOverloadTag=class extends JSDocOverloadTagBase{},JSDocOverrideTag=class extends JSDocTag{},JSDocParameterTagBase=JSDocPropertyLikeTag(JSDocTag),JSDocParameterTag=class extends JSDocParameterTagBase{},JSDocPrivateTag=class extends JSDocTag{},JSDocPropertyTagBase=JSDocPropertyLikeTag(JSDocTag),JSDocPropertyTag=class extends JSDocPropertyTagBase{},JSDocProtectedTag=class extends JSDocTag{},JSDocPublicTag=class extends JSDocTag{},JSDocReadonlyTag=class extends JSDocTag{},JSDocReturnTagBase=JSDocTypeExpressionableTag(JSDocTag),JSDocReturnTag=class extends JSDocReturnTagBase{},JSDocSatisfiesTagBase=JSDocTypeExpressionableTag(JSDocTag),JSDocSatisfiesTag=class extends JSDocSatisfiesTagBase{},JSDocSeeTagBase=JSDocTypeExpressionableTag(JSDocTag),JSDocSeeTag=class extends JSDocSeeTagBase{},JSDocSignature=class extends JSDocType{getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}},JSDocTagInfo=class{#compilerObject;constructor(compilerObject){this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getName(){return this.compilerObject.name}getText(){return this.compilerObject.text??[]}},JSDocTemplateTagBase=JSDocTypeParameteredTag(JSDocTag),JSDocTemplateTag=class extends JSDocTemplateTagBase{getConstraint(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.constraint)}getConstraintOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getConstraint(),message??"Expected to find the JS doc template tag's constraint.",this)}},JSDocText=class extends Node{},JSDocThisTagBase=JSDocTypeExpressionableTag(JSDocTag),JSDocThisTag=class extends JSDocThisTagBase{},JSDocThrowsTagBase=JSDocTypeExpressionableTag(JSDocTag),JSDocThrowsTag=class extends JSDocThrowsTagBase{},JSDocTypedefTag=class extends JSDocTag{},JSDocTypeExpression=class extends TypeNode{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},JSDocTypeLiteral=class extends JSDocType{isArrayType(){return this.compilerNode.isArrayType}getPropertyTags(){return this.compilerNode.jsDocPropertyTags?this.compilerNode.jsDocPropertyTags.map(t=>this._getNodeFromCompilerNode(t)):void 0}},JSDocTypeTag=class extends JSDocTag{getTypeExpression(){let node=this.compilerNode.typeExpression;if(!(node!=null&&node.pos===node.end))return this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression)}},JSDocUnknownTag=class extends JSDocTag{},JSDocUnknownType=class extends JSDocType{},JSDocVariadicType=class extends JSDocType{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},CommentEnumMember=class extends Node{remove(){removeChildrenWithFormatting({children:[this],getSiblingFormatting:()=>FormattingKind.Newline})}},createBase$b=ctor=>TextInsertableNode(ModuleChildableNode(JSDocableNode(AmbientableNode(ExportableNode(ModifierableNode(NamedNode(ctor))))))),EnumDeclarationBase=createBase$b(Statement),EnumDeclaration=class extends EnumDeclarationBase{set(structure){return callBaseSet(EnumDeclarationBase.prototype,this,structure),structure.isConst!=null&&this.setIsConstEnum(structure.isConst),structure.members!=null&&(this.getMembers().forEach(m=>m.remove()),this.addMembers(structure.members)),this}addMember(structure){return this.addMembers([structure])[0]}addMembers(structures){return this.insertMembers(this.getMembers().length,structures)}insertMember(index,structure){return this.insertMembers(index,[structure])[0]}insertMembers(index,structures){if(structures.length===0)return[];let members=this.getMembersWithComments();index=verifyAndGetIndex(index,members.length);let writer=this._getWriterWithChildIndentation();return this._context.structurePrinterFactory.forEnumMember().printTexts(writer,structures),insertIntoCommaSeparatedNodes({parent:this.getChildSyntaxListOrThrow(),currentNodes:members,insertIndex:index,newText:writer.toString(),useNewLines:!0,useTrailingCommas:this._context.manipulationSettings.getUseTrailingCommas()}),getNodesToReturn(members,this.getMembersWithComments(),index,!areAllStructuresStructures());function areAllStructuresStructures(){return structures instanceof Array?structures.every(s=>typeof s=="object"):!1}}getMember(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getMembers(),nameOrFindFunction)}getMemberOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getMember(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("enum member",nameOrFindFunction))}getMembers(){return this.compilerNode.members.map(m=>this._getNodeFromCompilerNode(m))}getMembersWithComments(){let compilerNode=this.compilerNode;return ExtendedParser.getContainerArray(compilerNode,this.getSourceFile().compilerNode).map(m=>this._getNodeFromCompilerNode(m))}setIsConstEnum(value){return this.toggleModifier("const",value)}isConstEnum(){return this.getConstKeyword()!=null}getConstKeyword(){return this.getFirstModifierByKind(common.SyntaxKind.ConstKeyword)}getStructure(){return callBaseGetStructure(EnumDeclarationBase.prototype,this,{kind:exports.StructureKind.Enum,isConst:this.isConstEnum(),members:this.getMembers().map(member=>member.getStructure())})}},createBase$a=ctor=>JSDocableNode(InitializerExpressionableNode(PropertyNamedNode(ctor))),EnumMemberBase=createBase$a(Node),EnumMember=class extends EnumMemberBase{getValue(){return this._context.typeChecker.getConstantValue(this)}setValue(value){let text;if(typeof value=="string"){let quoteKind=this._context.manipulationSettings.getQuoteKind();text=quoteKind+common.StringUtils.escapeForWithinString(value,quoteKind)+quoteKind}else text=value.toString();return this.setInitializer(text),this}remove(){let childrenToRemove=[this],commaToken=this.getNextSiblingIfKind(common.SyntaxKind.CommaToken);commaToken!=null&&childrenToRemove.push(commaToken),removeChildrenWithFormatting({children:childrenToRemove,getSiblingFormatting:()=>FormattingKind.Newline})}set(structure){return callBaseSet(EnumMemberBase.prototype,this,structure),structure.value!=null?this.setValue(structure.value):structure.hasOwnProperty(common.nameof(structure,"value"))&&structure.initializer==null&&this.removeInitializer(),this}getStructure(){return callBaseGetStructure(EnumMemberBase.prototype,this,{kind:exports.StructureKind.EnumMember,value:void 0})}},HeritageClause=class extends Node{getTypeNodes(){return this.compilerNode.types?.map(t=>this._getNodeFromCompilerNode(t))??[]}getToken(){return this.compilerNode.token}removeExpression(expressionNodeOrIndex){let expressions=this.getTypeNodes(),expressionNodeToRemove=typeof expressionNodeOrIndex=="number"?getExpressionFromIndex(expressionNodeOrIndex):expressionNodeOrIndex;if(expressions.length===1){let heritageClauses=this.getParentSyntaxListOrThrow().getChildren();heritageClauses.length===1?removeChildren({children:[heritageClauses[0].getParentSyntaxListOrThrow()],removePrecedingSpaces:!0}):removeChildren({children:[this],removePrecedingSpaces:!0})}else removeCommaSeparatedChild(expressionNodeToRemove);return this;function getExpressionFromIndex(index){return expressions[verifyAndGetIndex(index,expressions.length-1)]}}},TypeElement=class extends Node{remove(){removeInterfaceMember(this)}},createBase$9=ctor=>TypeParameteredNode(ChildOrderableNode(JSDocableNode(SignaturedDeclaration(ctor)))),CallSignatureDeclarationBase=createBase$9(TypeElement),CallSignatureDeclaration=class extends CallSignatureDeclarationBase{set(structure){return callBaseSet(CallSignatureDeclarationBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(CallSignatureDeclarationBase.prototype,this,{kind:exports.StructureKind.CallSignature})}},CommentTypeElement=class extends TypeElement{},createBase$8=ctor=>TypeParameteredNode(ChildOrderableNode(JSDocableNode(SignaturedDeclaration(ctor)))),ConstructSignatureDeclarationBase=createBase$8(TypeElement),ConstructSignatureDeclaration=class extends ConstructSignatureDeclarationBase{set(structure){return callBaseSet(ConstructSignatureDeclarationBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(ConstructSignatureDeclarationBase.prototype,this,{kind:exports.StructureKind.ConstructSignature})}},createBase$7=ctor=>ReturnTypedNode(ChildOrderableNode(JSDocableNode(ReadonlyableNode(ModifierableNode(ctor))))),IndexSignatureDeclarationBase=createBase$7(TypeElement),IndexSignatureDeclaration=class extends IndexSignatureDeclarationBase{getKeyName(){return this.getKeyNameNode().getText()}setKeyName(name){common.errors.throwIfWhitespaceOrNotString(name,"name"),this.getKeyName()!==name&&this.getKeyNameNode().replaceWithText(name,this._getWriterWithQueuedChildIndentation())}getKeyNameNode(){let param=this.compilerNode.parameters[0];return this._getNodeFromCompilerNode(param.name)}getKeyType(){return this.getKeyNameNode().getType()}setKeyType(type){common.errors.throwIfWhitespaceOrNotString(type,"type");let keyTypeNode=this.getKeyTypeNode();return keyTypeNode.getText()===type?this:(keyTypeNode.replaceWithText(type,this._getWriterWithQueuedChildIndentation()),this)}getKeyTypeNode(){let param=this.compilerNode.parameters[0];return this._getNodeFromCompilerNode(param.type)}set(structure){return callBaseSet(IndexSignatureDeclarationBase.prototype,this,structure),structure.keyName!=null&&this.setKeyName(structure.keyName),structure.keyType!=null&&this.setKeyType(structure.keyType),this}getStructure(){let keyTypeNode=this.getKeyTypeNode();return callBaseGetStructure(IndexSignatureDeclarationBase.prototype,this,{kind:exports.StructureKind.IndexSignature,keyName:this.getKeyName(),keyType:keyTypeNode.getText()})}},createBase$6=ctor=>TypeElementMemberedNode(TextInsertableNode(ExtendsClauseableNode(HeritageClauseableNode(TypeParameteredNode(JSDocableNode(AmbientableNode(ModuleChildableNode(ExportableNode(ModifierableNode(NamedNode(ctor))))))))))),InterfaceDeclarationBase=createBase$6(Statement),InterfaceDeclaration=class extends InterfaceDeclarationBase{getBaseTypes(){return this.getType().getBaseTypes()}getBaseDeclarations(){return this.getType().getBaseTypes().map(t=>t.getSymbol()?.getDeclarations()??[]).flat()}getImplementations(){return this.getNameNode().getImplementations()}set(structure){return callBaseSet(InterfaceDeclarationBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(InterfaceDeclarationBase.prototype,this,{kind:exports.StructureKind.Interface})}},createBase$5=ctor=>ChildOrderableNode(JSDocableNode(QuestionTokenableNode(TypeParameteredNode(SignaturedDeclaration(PropertyNamedNode(ctor)))))),MethodSignatureBase=createBase$5(TypeElement),MethodSignature=class extends MethodSignatureBase{set(structure){return callBaseSet(MethodSignatureBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(MethodSignatureBase.prototype,this,{kind:exports.StructureKind.MethodSignature})}},createBase$4=ctor=>ChildOrderableNode(JSDocableNode(ReadonlyableNode(QuestionTokenableNode(InitializerExpressionableNode(TypedNode(PropertyNamedNode(ModifierableNode(ctor)))))))),PropertySignatureBase=createBase$4(TypeElement),PropertySignature=class extends PropertySignatureBase{set(structure){return callBaseSet(PropertySignatureBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(PropertySignatureBase.prototype,this,{kind:exports.StructureKind.PropertySignature})}};function JsxAttributedNode(Base){return class extends Base{getAttributes(){return this.compilerNode.attributes.properties.map(p=>this._getNodeFromCompilerNode(p))}getAttributeOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getAttribute(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("attribute",nameOrFindFunction))}getAttribute(nameOrFindFunction){return getNodeByNameOrFindFunction(this.getAttributes(),nameOrFindFunction)}addAttribute(structure){return this.addAttributes([structure])[0]}addAttributes(structures){return this.insertAttributes(this.compilerNode.attributes.properties.length,structures)}insertAttribute(index,structure){return this.insertAttributes(index,[structure])[0]}insertAttributes(index,structures){if(structures.length===0)return[];let originalChildrenCount=this.compilerNode.attributes.properties.length;index=verifyAndGetIndex(index,originalChildrenCount);let insertPos=index===0?this.getTagNameNode().getEnd():this.getAttributes()[index-1].getEnd(),writer=this._getWriterWithQueuedChildIndentation();return new SpaceFormattingStructuresPrinter(this._context.structurePrinterFactory.forJsxAttributeDecider()).printText(writer,structures),insertIntoParentTextRange({insertPos,newText:" "+writer.toString(),parent:this.getNodeProperty("attributes").getFirstChildByKindOrThrow(common.SyntaxKind.SyntaxList)}),getNodesToReturn(originalChildrenCount,this.getAttributes(),index,!1)}set(structure){return callBaseSet(Base.prototype,this,structure),structure.attributes!=null&&(this.getAttributes().forEach(a=>a.remove()),this.addAttributes(structure.attributes)),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{attributes:this.getAttributes().map(a=>a.getStructure())})}}}function JsxTagNamedNode(Base){return class extends Base{getTagNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.tagName)}set(structure){return callBaseSet(Base.prototype,this,structure),structure.name!=null&&this.getTagNameNode().replaceWithText(structure.name),this}getStructure(){return callBaseGetStructure(Base.prototype,this,{name:this.getTagNameNode().getText()})}}}function CommonIdentifierBase(Base){return class extends Base{getText(){return this.compilerNode.text}getDefinitionNodes(){return this.getDefinitions().map(d=>d.getDeclarationNode()).filter(d=>d!=null)}getDefinitions(){return this._context.languageService.getDefinitions(this)}}}var ComputedPropertyNameBase=ExpressionedNode(Node),ComputedPropertyName=class extends ComputedPropertyNameBase{},IdentifierBase=CommonIdentifierBase(ReferenceFindableNode(RenameableNode(PrimaryExpression))),Identifier=class extends IdentifierBase{getImplementations(){return this._context.languageService.getImplementations(this)}},PrivateIdentifierBase=CommonIdentifierBase(ReferenceFindableNode(RenameableNode(Node))),PrivateIdentifier=class extends PrivateIdentifierBase{},QualifiedName=class extends Node{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}getRight(){return this._getNodeFromCompilerNode(this.compilerNode.right)}},JsxAttributeBase=Node,JsxAttribute=class extends JsxAttributeBase{getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}setName(name){return this.getNameNode().replaceWithText(writer=>{typeof name=="object"?this._context.structurePrinterFactory.forJsxNamespacedName().printText(writer,name):writer.write(name)}),this}getInitializerOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getInitializer(),message??`Expected to find an initializer for the JSX attribute '${this.getNameNode().getText()}'`,this)}getInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.initializer)}setInitializer(textOrWriterFunction){let text=getTextFromStringOrWriter(this._getWriterWithQueuedIndentation(),textOrWriterFunction);if(common.StringUtils.isNullOrWhitespace(text))return this.removeInitializer(),this;let initializer=this.getInitializer();return initializer!=null?(initializer.replaceWithText(text),this):(insertIntoParentTextRange({insertPos:this.getNameNode().getEnd(),parent:this,newText:`=${text}`}),this)}removeInitializer(){let initializer=this.getInitializer();return initializer==null?this:(removeChildren({children:[initializer.getPreviousSiblingIfKindOrThrow(common.SyntaxKind.EqualsToken),initializer],removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this)}remove(){removeChildren({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(structure){return callBaseSet(JsxAttributeBase.prototype,this,structure),structure.name!=null&&this.setName(structure.name),structure.initializer!=null?this.setInitializer(structure.initializer):structure.hasOwnProperty(common.nameof(structure,"initializer"))&&this.removeInitializer(),this}getStructure(){let initializer=this.getInitializer(),nameNode=this.getNameNode();return callBaseGetStructure(JsxAttributeBase.prototype,this,{name:nameNode instanceof Identifier?nameNode.getText():nameNode.getStructure(),kind:exports.StructureKind.JsxAttribute,initializer:initializer?.getText()})}},createBase$3=ctor=>JsxTagNamedNode(ctor),JsxClosingElementBase=createBase$3(Node),JsxClosingElement=class extends JsxClosingElementBase{},JsxClosingFragment=class extends Expression{},JsxElementBase=PrimaryExpression,JsxElement=class extends JsxElementBase{getJsxChildren(){return this.compilerNode.children.map(c=>this._getNodeFromCompilerNode(c))}getOpeningElement(){return this._getNodeFromCompilerNode(this.compilerNode.openingElement)}getClosingElement(){return this._getNodeFromCompilerNode(this.compilerNode.closingElement)}setBodyText(textOrWriterFunction){let newText=getBodyText(this._getWriterWithIndentation(),textOrWriterFunction);return setText(this,newText),this}setBodyTextInline(textOrWriterFunction){let writer=this._getWriterWithQueuedChildIndentation();return printTextFromStringOrWriter(writer,textOrWriterFunction),writer.isLastNewLine()&&(writer.setIndentationLevel(Math.max(0,this.getIndentationLevel()-1)),writer.write("")),setText(this,writer.toString()),this}set(structure){if(callBaseSet(JsxElementBase.prototype,this,structure),structure.attributes!=null){let openingElement=this.getOpeningElement();openingElement.getAttributes().forEach(a=>a.remove()),openingElement.addAttributes(structure.attributes)}if(structure.children!=null)throw new common.errors.NotImplementedError("Setting JSX children is currently not implemented. Please open an issue if you need this.");return structure.bodyText!=null?this.setBodyText(structure.bodyText):structure.hasOwnProperty(common.nameof(structure,"bodyText"))&&this.setBodyTextInline(""),structure.name!=null&&(this.getOpeningElement().getTagNameNode().replaceWithText(structure.name),this.getClosingElement().getTagNameNode().replaceWithText(structure.name)),this}getStructure(){let openingElement=this.getOpeningElement(),structure=callBaseGetStructure(JsxElementBase.prototype,this,{kind:exports.StructureKind.JsxElement,name:openingElement.getTagNameNode().getText(),attributes:openingElement.getAttributes().map(a=>a.getStructure()),children:void 0,bodyText:getBodyTextWithoutLeadingIndentation(this)});return delete structure.children,structure}};function setText(element,newText){let openingElement=element.getOpeningElement(),closingElement=element.getClosingElement();insertIntoParentTextRange({insertPos:openingElement.getEnd(),newText,parent:element.getChildSyntaxListOrThrow(),replacing:{textLength:closingElement.getStart()-openingElement.getEnd()}})}var JsxExpressionBase=ExpressionableNode(DotDotDotTokenableNode(Expression)),JsxExpression=class extends JsxExpressionBase{},JsxFragment=class extends PrimaryExpression{getJsxChildren(){return this.compilerNode.children.map(c=>this._getNodeFromCompilerNode(c))}getOpeningFragment(){return this._getNodeFromCompilerNode(this.compilerNode.openingFragment)}getClosingFragment(){return this._getNodeFromCompilerNode(this.compilerNode.closingFragment)}},JsxNamespacedNameBase=Node,JsxNamespacedName=class extends JsxNamespacedNameBase{getNamespaceNode(){return this._getNodeFromCompilerNode(this.compilerNode.namespace)}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}set(structure){return this.getNamespaceNode().replaceWithText(structure.namespace),this.getNameNode().replaceWithText(structure.name),this}getStructure(){return{namespace:this.getNamespaceNode().getText(),name:this.getNameNode().getText()}}},createBase$2=ctor=>JsxAttributedNode(JsxTagNamedNode(ctor)),JsxOpeningElementBase=createBase$2(Expression),JsxOpeningElement=class extends JsxOpeningElementBase{},JsxOpeningFragment=class extends Expression{},createBase$1=ctor=>JsxAttributedNode(JsxTagNamedNode(ctor)),JsxSelfClosingElementBase=createBase$1(PrimaryExpression),JsxSelfClosingElement=class extends JsxSelfClosingElementBase{set(structure){return callBaseSet(JsxSelfClosingElementBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(JsxSelfClosingElementBase.prototype,this,{kind:exports.StructureKind.JsxSelfClosingElement})}},JsxSpreadAttributeBase=ExpressionedNode(Node),JsxSpreadAttribute=class extends JsxSpreadAttributeBase{remove(){removeChildren({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(structure){return callBaseSet(JsxSpreadAttributeBase.prototype,this,structure),structure.expression!=null&&this.setExpression(structure.expression),this}getStructure(){return callBaseGetStructure(JsxSpreadAttributeBase.prototype,this,{kind:exports.StructureKind.JsxSpreadAttribute,expression:this.getExpression().getText()})}},JsxTextBase=LiteralLikeNode(Node),JsxText=class extends JsxTextBase{containsOnlyTriviaWhiteSpaces(){let oldCompilerNode=this.compilerNode;return typeof oldCompilerNode.containsOnlyWhiteSpaces=="boolean"?oldCompilerNode.containsOnlyWhiteSpaces:this.compilerNode.containsOnlyTriviaWhiteSpaces}},BigIntLiteralBase=LiteralExpression,BigIntLiteral=class extends BigIntLiteralBase{getLiteralValue(){let text=this.compilerNode.text;if(typeof BigInt>"u")throw new common.errors.InvalidOperationError("Runtime environment does not support BigInts. Perhaps work with the text instead?");let textWithoutN=text.substring(0,text.length-1);return BigInt(textWithoutN)}setLiteralValue(value){if(typeof value!="bigint")throw new common.errors.ArgumentTypeError("value","bigint",typeof value);return replaceNodeText({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:value.toString()+"n"}),this}},TrueLiteralBase=PrimaryExpression,TrueLiteral=class extends TrueLiteralBase{getLiteralValue(){return getLiteralValue(this)}setLiteralValue(value){return setLiteralValue(this,value)}},FalseLiteralBase=PrimaryExpression,FalseLiteral=class extends FalseLiteralBase{getLiteralValue(){return getLiteralValue(this)}setLiteralValue(value){return setLiteralValue(this,value)}};function setLiteralValue(node,value){if(getLiteralValue(node)===value)return node;let parent=node.getParentSyntaxList()||node.getParentOrThrow(),index=node.getChildIndex();return node.replaceWithText(value?"true":"false"),parent.getChildAtIndex(index)}function getLiteralValue(node){return node.getKind()===common.SyntaxKind.TrueKeyword}var NullLiteralBase=PrimaryExpression,NullLiteral=class extends NullLiteralBase{},NumericLiteralBase=LiteralExpression,NumericLiteral=class extends NumericLiteralBase{getLiteralValue(){let text=this.compilerNode.text;return text.indexOf(".")>=0?parseFloat(text):parseInt(text,10)}setLiteralValue(value){return replaceNodeText({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:value.toString(10)}),this}};exports.QuoteKind=void 0;(function(QuoteKind){QuoteKind.Single="'",QuoteKind.Double='"'})(exports.QuoteKind||(exports.QuoteKind={}));var RegularExpressionLiteralBase=LiteralExpression,RegularExpressionLiteral=class extends RegularExpressionLiteralBase{getLiteralValue(){let pattern=/^\/(.*)\/([^\/]*)$/,text=this.compilerNode.text,matches=pattern.exec(text);return new RegExp(matches[1],matches[2])}setLiteralValue(regExpOrPattern,flags){let pattern;return typeof regExpOrPattern=="string"?pattern=regExpOrPattern:(pattern=regExpOrPattern.source,flags=regExpOrPattern.flags),replaceNodeText({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:`/${pattern}/${flags||""}`}),this}},StringLiteralBase=LiteralExpression,StringLiteral=class extends StringLiteralBase{getLiteralValue(){return this.compilerNode.text}setLiteralValue(value){return replaceNodeText({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:common.StringUtils.escapeForWithinString(value,this.getQuoteKind())}),this}getQuoteKind(){return this.getText()[0]==="'"?exports.QuoteKind.Single:exports.QuoteKind.Double}},NoSubstitutionTemplateLiteralBase=LiteralExpression,NoSubstitutionTemplateLiteral=class extends NoSubstitutionTemplateLiteralBase{getLiteralValue(){return this.compilerNode.text}setLiteralValue(value){let childIndex=this.getChildIndex(),parent=this.getParentSyntaxList()||this.getParentOrThrow();return replaceNodeText({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:value}),parent.getChildAtIndex(childIndex)}},TaggedTemplateExpression=class extends MemberExpression{getTag(){return this._getNodeFromCompilerNode(this.compilerNode.tag)}getTemplate(){return this._getNodeFromCompilerNode(this.compilerNode.template)}removeTag(){let parent=this.getParentSyntaxList()??this.getParentOrThrow(),index=this.getChildIndex(),template=this.getTemplate();return insertIntoParentTextRange({customMappings:(newParent,newSourceFile)=>[{currentNode:template,newNode:newParent.getChildren(newSourceFile)[index]}],parent,insertPos:this.getStart(),newText:this.getTemplate().getText(),replacing:{textLength:this.getWidth(),nodes:[this]}}),parent.getChildAtIndex(index)}},TemplateExpressionBase=PrimaryExpression,TemplateExpression=class extends TemplateExpressionBase{getHead(){return this._getNodeFromCompilerNode(this.compilerNode.head)}getTemplateSpans(){return this.compilerNode.templateSpans.map(s=>this._getNodeFromCompilerNode(s))}setLiteralValue(value){let childIndex=this.getChildIndex(),parent=this.getParentSyntaxList()??this.getParentOrThrow();return replaceNodeText({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:value}),parent.getChildAtIndex(childIndex)}},TemplateHeadBase=LiteralLikeNode(Node),TemplateHead=class extends TemplateHeadBase{},TemplateMiddleBase=LiteralLikeNode(Node),TemplateMiddle=class extends TemplateMiddleBase{},TemplateSpanBase=ExpressionedNode(Node),TemplateSpan=class extends TemplateSpanBase{getLiteral(){return this._getNodeFromCompilerNode(this.compilerNode.literal)}},TemplateTailBase=LiteralLikeNode(Node),TemplateTail=class extends TemplateTailBase{},createBase=ctor=>ExportGetableNode(ExclamationTokenableNode(TypedNode(InitializerExpressionableNode(BindingNamedNode(ctor))))),VariableDeclarationBase=createBase(Node),VariableDeclaration=class extends VariableDeclarationBase{remove(){let parent=this.getParentOrThrow();switch(parent.getKind()){case common.SyntaxKind.VariableDeclarationList:removeFromDeclarationList(this);break;case common.SyntaxKind.CatchClause:removeFromCatchClause(this);break;default:throw new common.errors.NotImplementedError(`Not implemented for syntax kind: ${parent.getKindName()}`)}function removeFromDeclarationList(node){let variableStatement=parent.getParentIfKindOrThrow(common.SyntaxKind.VariableStatement);variableStatement.getDeclarations().length===1?variableStatement.remove():removeCommaSeparatedChild(node)}function removeFromCatchClause(node){removeChildren({children:[node.getPreviousSiblingIfKindOrThrow(common.SyntaxKind.OpenParenToken),node,node.getNextSiblingIfKindOrThrow(common.SyntaxKind.CloseParenToken)],removePrecedingSpaces:!0})}}getVariableStatementOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getVariableStatement(),message??"Expected the grandparent to be a variable statement.",this)}getVariableStatement(){let grandParent=this.getParentOrThrow().getParentOrThrow();return Node.isVariableStatement(grandParent)?grandParent:void 0}set(structure){return callBaseSet(VariableDeclarationBase.prototype,this,structure),this}getStructure(){return callBaseGetStructure(VariableDeclarationBase.prototype,this,{kind:exports.StructureKind.VariableDeclaration})}},VariableDeclarationListBase=ModifierableNode(Node),VariableDeclarationList=class extends VariableDeclarationListBase{getDeclarations(){return this.compilerNode.declarations.map(d=>this._getNodeFromCompilerNode(d))}getDeclarationKind(){let nodeFlags=this.compilerNode.flags;return nodeFlags&common.ts.NodeFlags.Let?exports.VariableDeclarationKind.Let:(nodeFlags&common.ts.NodeFlags.AwaitUsing)===common.ts.NodeFlags.AwaitUsing?exports.VariableDeclarationKind.AwaitUsing:(nodeFlags&common.ts.NodeFlags.Using)===common.ts.NodeFlags.Using?exports.VariableDeclarationKind.Using:nodeFlags&common.ts.NodeFlags.Const?exports.VariableDeclarationKind.Const:exports.VariableDeclarationKind.Var}getDeclarationKindKeywords(){let declarationKind=this.getDeclarationKind();switch(declarationKind){case exports.VariableDeclarationKind.Const:return[this.getFirstChildByKindOrThrow(common.SyntaxKind.ConstKeyword)];case exports.VariableDeclarationKind.Let:return[this.getFirstChildByKindOrThrow(common.SyntaxKind.LetKeyword)];case exports.VariableDeclarationKind.Var:return[this.getFirstChildByKindOrThrow(common.SyntaxKind.VarKeyword)];case exports.VariableDeclarationKind.Using:return[this.getFirstChildByKindOrThrow(common.SyntaxKind.UsingKeyword)];case exports.VariableDeclarationKind.AwaitUsing:let awaitKeyword=this.getFirstChildByKindOrThrow(common.SyntaxKind.AwaitKeyword),usingKeyword=awaitKeyword.getNextSiblingIfKindOrThrow(common.SyntaxKind.UsingKeyword);return[awaitKeyword,usingKeyword];default:return common.errors.throwNotImplementedForNeverValueError(declarationKind)}}setDeclarationKind(type){if(this.getDeclarationKind()===type)return this;let keywords=this.getDeclarationKindKeywords(),start=keywords[0].getStart(),end=keywords[keywords.length-1].getEnd();return insertIntoParentTextRange({insertPos:start,newText:type,parent:this,replacing:{textLength:end-start}}),this}addDeclaration(structure){return this.addDeclarations([structure])[0]}addDeclarations(structures){return this.insertDeclarations(this.getDeclarations().length,structures)}insertDeclaration(index,structure){return this.insertDeclarations(index,[structure])[0]}insertDeclarations(index,structures){let writer=this._getWriterWithQueuedChildIndentation(),structurePrinter=new CommaSeparatedStructuresPrinter(this._context.structurePrinterFactory.forVariableDeclaration()),originalChildrenCount=this.compilerNode.declarations.length;return index=verifyAndGetIndex(index,originalChildrenCount),structurePrinter.printText(writer,structures),insertIntoCommaSeparatedNodes({parent:this.getFirstChildByKindOrThrow(common.SyntaxKind.SyntaxList),currentNodes:this.getDeclarations(),insertIndex:index,newText:writer.toString(),useTrailingCommas:!1}),getNodesToReturn(originalChildrenCount,this.getDeclarations(),index,!1)}},Signature=class{#context;#compilerSignature;constructor(context,signature){this.#context=context,this.#compilerSignature=signature}get compilerSignature(){return this.#compilerSignature}getTypeParameters(){return(this.compilerSignature.typeParameters||[]).map(t=>this.#context.compilerFactory.getTypeParameter(t))}getParameters(){return this.compilerSignature.parameters.map(p=>this.#context.compilerFactory.getSymbol(p))}getReturnType(){return this.#context.compilerFactory.getType(this.compilerSignature.getReturnType())}getDocumentationComments(){return this.compilerSignature.getDocumentationComment(this.#context.typeChecker.compilerObject).map(d=>this.#context.compilerFactory.getSymbolDisplayPart(d))}getJsDocTags(){return this.compilerSignature.getJsDocTags().map(t=>this.#context.compilerFactory.getJSDocTagInfo(t))}getDeclaration(){let{compilerFactory}=this.#context,compilerSignatureDeclaration=this.compilerSignature.getDeclaration();return compilerFactory.getNodeFromCompilerNode(compilerSignatureDeclaration,compilerFactory.getSourceFileForNode(compilerSignatureDeclaration))}},Symbol2=class{#context;#compilerSymbol;get compilerSymbol(){return this.#compilerSymbol}constructor(context,symbol){this.#context=context,this.#compilerSymbol=symbol,this.getValueDeclaration(),this.getDeclarations()}getName(){return this.compilerSymbol.getName()}getEscapedName(){return this.compilerSymbol.getEscapedName()}getAliasedSymbolOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getAliasedSymbol(),message??"Expected to find an aliased symbol.")}getImmediatelyAliasedSymbol(){return this.#context.typeChecker.getImmediatelyAliasedSymbol(this)}getImmediatelyAliasedSymbolOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getImmediatelyAliasedSymbol(),message??"Expected to find an immediately aliased symbol.")}getAliasedSymbol(){return this.#context.typeChecker.getAliasedSymbol(this)}getExportSymbol(){return this.#context.typeChecker.getExportSymbolOfSymbol(this)}isAlias(){return(this.getFlags()&common.SymbolFlags.Alias)===common.SymbolFlags.Alias}isOptional(){return(this.getFlags()&common.SymbolFlags.Optional)===common.SymbolFlags.Optional}getFlags(){return this.compilerSymbol.getFlags()}hasFlags(flags){return(this.compilerSymbol.flags&flags)===flags}getValueDeclarationOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getValueDeclaration(),message??(()=>`Expected to find the value declaration of symbol '${this.getName()}'.`))}getValueDeclaration(){let declaration=this.compilerSymbol.valueDeclaration;if(declaration!=null)return this.#context.compilerFactory.getNodeFromCompilerNode(declaration,this.#context.compilerFactory.getSourceFileForNode(declaration))}getDeclarations(){return(this.compilerSymbol.declarations??[]).map(d=>this.#context.compilerFactory.getNodeFromCompilerNode(d,this.#context.compilerFactory.getSourceFileForNode(d)))}getExportOrThrow(name,message){return common.errors.throwIfNullOrUndefined(this.getExport(name),message??(()=>`Expected to find export with name: ${name}`))}getExport(name){if(this.compilerSymbol.exports==null)return;let tsSymbol=this.compilerSymbol.exports.get(common.ts.escapeLeadingUnderscores(name));return tsSymbol==null?void 0:this.#context.compilerFactory.getSymbol(tsSymbol)}getExports(){return this.compilerSymbol.exports==null?[]:Array.from(this.compilerSymbol.exports.values()).map(symbol=>this.#context.compilerFactory.getSymbol(symbol))}getGlobalExportOrThrow(name,message){return common.errors.throwIfNullOrUndefined(this.getGlobalExport(name),message??(()=>`Expected to find global export with name: ${name}`))}getGlobalExport(name){if(this.compilerSymbol.globalExports==null)return;let tsSymbol=this.compilerSymbol.globalExports.get(common.ts.escapeLeadingUnderscores(name));return tsSymbol==null?void 0:this.#context.compilerFactory.getSymbol(tsSymbol)}getGlobalExports(){return this.compilerSymbol.globalExports==null?[]:Array.from(this.compilerSymbol.globalExports.values()).map(symbol=>this.#context.compilerFactory.getSymbol(symbol))}getMemberOrThrow(name,message){return common.errors.throwIfNullOrUndefined(this.getMember(name),message??`Expected to find member with name: ${name}`)}getMember(name){if(this.compilerSymbol.members==null)return;let tsSymbol=this.compilerSymbol.members.get(common.ts.escapeLeadingUnderscores(name));return tsSymbol==null?void 0:this.#context.compilerFactory.getSymbol(tsSymbol)}getMembers(){return this.compilerSymbol.members==null?[]:Array.from(this.compilerSymbol.members.values()).map(symbol=>this.#context.compilerFactory.getSymbol(symbol))}getDeclaredType(){return this.#context.typeChecker.getDeclaredTypeOfSymbol(this)}getTypeAtLocation(node){return this.#context.typeChecker.getTypeOfSymbolAtLocation(this,node)}getFullyQualifiedName(){return this.#context.typeChecker.getFullyQualifiedName(this)}getJsDocTags(){return this.compilerSymbol.getJsDocTags(this.#context.typeChecker.compilerObject).map(info=>new JSDocTagInfo(info))}},TextSpan=class{#compilerObject;constructor(compilerObject){this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getStart(){return this.compilerObject.start}getEnd(){return this.compilerObject.start+this.compilerObject.length}getLength(){return this.compilerObject.length}},TextChange=class{#compilerObject;constructor(compilerObject){this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getSpan(){return new TextSpan(this.compilerObject.span)}getNewText(){return this.compilerObject.newText}};__decorate([common.Memoize],TextChange.prototype,"getSpan",null);var FileTextChanges=class{#context;#compilerObject;#sourceFile;#existingFileExists;#isApplied;constructor(context,compilerObject){this.#context=context,this.#compilerObject=compilerObject;let file=context.compilerFactory.addOrGetSourceFileFromFilePath(context.fileSystemWrapper.getStandardizedAbsolutePath(compilerObject.fileName),{markInProject:!1,scriptKind:void 0});this.#existingFileExists=file!=null,compilerObject.isNewFile||(this.#sourceFile=file)}getFilePath(){return this.#compilerObject.fileName}getSourceFile(){return this.#sourceFile}getTextChanges(){return this.#compilerObject.textChanges.map(c=>new TextChange(c))}applyChanges(options={}){if(this.#isApplied)return;if(this.isNewFile()&&this.#existingFileExists&&!options.overwrite)throw new common.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 file;if(this.isNewFile()?file=this.#context.project.createSourceFile(this.getFilePath(),"",{overwrite:options.overwrite}):file=this.getSourceFile(),file==null)throw new common.errors.InvalidOperationError(`Cannot apply file text change to modify existing file that doesn't exist at path: ${this.getFilePath()}`);return file.applyTextChanges(this.getTextChanges()),file._markAsInProject(),this.#isApplied=!0,this}isNewFile(){return!!this.#compilerObject.isNewFile}};__decorate([common.Memoize],FileTextChanges.prototype,"getTextChanges",null);var CodeAction=class{#context;#compilerObject;constructor(context,compilerObject){this.#context=context,this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getDescription(){return this.compilerObject.description}getChanges(){return this.compilerObject.changes.map(change=>new FileTextChanges(this.#context,change))}},CodeFixAction=class extends CodeAction{getFixName(){return this.compilerObject.fixName}getFixId(){return this.compilerObject.fixId}getFixAllDescription(){return this.compilerObject.fixAllDescription}},CombinedCodeActions=class{#context;#compilerObject;constructor(context,compilerObject){this.#context=context,this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getChanges(){return this.compilerObject.changes.map(change=>new FileTextChanges(this.#context,change))}applyChanges(options){for(let change of this.getChanges())change.applyChanges(options);return this}};__decorate([common.Memoize],CombinedCodeActions.prototype,"getChanges",null);var DocumentSpan=class{_context;_compilerObject;_sourceFile;constructor(context,compilerObject){this._context=context,this._compilerObject=compilerObject,this._sourceFile=this._context.compilerFactory.addOrGetSourceFileFromFilePath(context.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 TextSpan(this.compilerObject.textSpan)}getNode(){let textSpan=this.getTextSpan(),sourceFile=this.getSourceFile(),start=textSpan.getStart(),width=textSpan.getEnd();return findBestMatchingNode();function findBestMatchingNode(){let bestNode;return sourceFile._context.compilerFactory.forgetNodesCreatedInBlock(remember=>{let foundNode,nextNode=sourceFile;for(;nextNode!=null;){if(foundNode==null&&(bestNode=nextNode),nextNode.getStart()===start&&nextNode.getWidth()===width)bestNode=foundNode=nextNode;else if(foundNode!=null)break;nextNode=nextNode.getChildAtPos(start)}bestNode!=null&&remember(bestNode)}),bestNode}}getOriginalTextSpan(){let{originalTextSpan}=this.compilerObject;return originalTextSpan==null?void 0:new TextSpan(originalTextSpan)}getOriginalFileName(){return this.compilerObject.originalFileName}};__decorate([common.Memoize],DocumentSpan.prototype,"getTextSpan",null);__decorate([common.Memoize],DocumentSpan.prototype,"getNode",null);__decorate([common.Memoize],DocumentSpan.prototype,"getOriginalTextSpan",null);var DefinitionInfo=class extends DocumentSpan{constructor(context,compilerObject){super(context,compilerObject),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 start=this.getTextSpan().getStart(),identifier=findIdentifier(this.getSourceFile());return identifier?.getParentOrThrow();function findIdentifier(node){if(node.getKind()===common.SyntaxKind.Identifier&&node.getStart()===start)return node;for(let child of node._getChildrenIterator())if(child.getPos()<=start&&child.getEnd()>start)return findIdentifier(child)}}};__decorate([common.Memoize],DefinitionInfo.prototype,"getDeclarationNode",null);var DiagnosticMessageChain=class _DiagnosticMessageChain{_compilerObject;constructor(compilerObject){this._compilerObject=compilerObject}get compilerObject(){return this._compilerObject}getMessageText(){return this.compilerObject.messageText}getNext(){let next=this.compilerObject.next;if(next!=null)return next instanceof Array?next.map(n=>new _DiagnosticMessageChain(n)):[new _DiagnosticMessageChain(next)]}getCode(){return this.compilerObject.code}getCategory(){return this.compilerObject.category}},Diagnostic=class{_context;_compilerObject;constructor(context,compilerObject){this._context=context,this._compilerObject=compilerObject,this.getSourceFile()}get compilerObject(){return this._compilerObject}getSourceFile(){if(this._context==null)return;let file=this.compilerObject.file;return file==null?void 0:this._context.compilerFactory.getSourceFile(file,{markInProject:!1})}getMessageText(){let messageText=this._compilerObject.messageText;return typeof messageText=="string"?messageText:this._context==null?new DiagnosticMessageChain(messageText):this._context.compilerFactory.getDiagnosticMessageChain(messageText)}getLineNumber(){let sourceFile=this.getSourceFile(),start=this.getStart();if(!(sourceFile==null||start==null))return common.StringUtils.getLineNumberAtPos(sourceFile.getFullText(),start)}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}};__decorate([common.Memoize],Diagnostic.prototype,"getSourceFile",null);var DiagnosticWithLocation=class extends Diagnostic{constructor(context,compilerObject){super(context,compilerObject)}getLineNumber(){return super.getLineNumber()}getStart(){return super.getStart()}getLength(){return super.getLength()}getSourceFile(){return super.getSourceFile()}},OutputFile=class{#compilerObject;#context;constructor(context,compilerObject){this.#compilerObject=compilerObject,this.#context=context}get compilerObject(){return this.#compilerObject}getFilePath(){return this.#context.fileSystemWrapper.getStandardizedAbsolutePath(this.compilerObject.name)}getWriteByteOrderMark(){return this.compilerObject.writeByteOrderMark||!1}getText(){return this.compilerObject.text}},EmitOutput=class{#context;#compilerObject;constructor(context,compilerObject){this.#context=context,this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getDiagnostics(){return this.compilerObject.diagnostics.map(d=>this.#context.compilerFactory.getDiagnostic(d))}getEmitSkipped(){return this.compilerObject.emitSkipped}getOutputFiles(){return this.compilerObject.outputFiles.map(f=>new OutputFile(this.#context,f))}};__decorate([common.Memoize],EmitOutput.prototype,"getDiagnostics",null);__decorate([common.Memoize],EmitOutput.prototype,"getOutputFiles",null);var EmitResult=class{_context;_compilerObject;constructor(context,compilerObject){this._context=context,this._compilerObject=compilerObject,this.getDiagnostics()}get compilerObject(){return this._compilerObject}getEmitSkipped(){return this.compilerObject.emitSkipped}getDiagnostics(){return this.compilerObject.diagnostics.map(d=>this._context.compilerFactory.getDiagnostic(d))}};__decorate([common.Memoize],EmitResult.prototype,"getDiagnostics",null);var ImplementationLocation=class extends DocumentSpan{constructor(context,compilerObject){super(context,compilerObject)}getKind(){return this.compilerObject.kind}getDisplayParts(){return this.compilerObject.displayParts.map(p=>this._context.compilerFactory.getSymbolDisplayPart(p))}};__decorate([common.Memoize],ImplementationLocation.prototype,"getDisplayParts",null);var MemoryEmitResult=class extends EmitResult{#files;constructor(context,compilerObject,files){super(context,compilerObject),this.#files=files}getFiles(){return this.#files}saveFiles(){let fileSystem=this._context.fileSystemWrapper,promises=this.#files.map(f=>fileSystem.writeFile(f.filePath,f.writeByteOrderMark?"\uFEFF"+f.text:f.text));return Promise.all(promises)}saveFilesSync(){let fileSystem=this._context.fileSystemWrapper;for(let file of this.#files)fileSystem.writeFileSync(file.filePath,file.writeByteOrderMark?"\uFEFF"+file.text:file.text)}},RefactorEditInfo=class{#context;#compilerObject;constructor(context,compilerObject){this.#context=context,this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getEdits(){return this.compilerObject.edits.map(edit=>new FileTextChanges(this.#context,edit))}getRenameFilePath(){return this.compilerObject.renameFilename}getRenameLocation(){return this.compilerObject.renameLocation}applyChanges(options){for(let change of this.getEdits())change.applyChanges(options);return this}};__decorate([common.Memoize],RefactorEditInfo.prototype,"getEdits",null);var ReferencedSymbol=class{_context;#compilerObject;#references;constructor(context,compilerObject){this._context=context,this.#compilerObject=compilerObject,this.#references=this.compilerObject.references.map(r=>context.compilerFactory.getReferencedSymbolEntry(r))}get compilerObject(){return this.#compilerObject}getDefinition(){return this._context.compilerFactory.getReferencedSymbolDefinitionInfo(this.compilerObject.definition)}getReferences(){return this.#references}};__decorate([common.Memoize],ReferencedSymbol.prototype,"getDefinition",null);var ReferencedSymbolDefinitionInfo=class extends DefinitionInfo{constructor(context,compilerObject){super(context,compilerObject)}getDisplayParts(){return this.compilerObject.displayParts.map(p=>this._context.compilerFactory.getSymbolDisplayPart(p))}};__decorate([common.Memoize],ReferencedSymbolDefinitionInfo.prototype,"getDisplayParts",null);var ReferenceEntry=class extends DocumentSpan{constructor(context,compilerObject){super(context,compilerObject)}isWriteAccess(){return this.compilerObject.isWriteAccess}isInString(){return this.compilerObject.isInString}},ReferencedSymbolEntry=class extends ReferenceEntry{constructor(context,compilerObject){super(context,compilerObject)}isDefinition(){return this.compilerObject.isDefinition}},RenameLocation=class extends DocumentSpan{getPrefixText(){return this._compilerObject.prefixText}getSuffixText(){return this._compilerObject.suffixText}},SymbolDisplayPart=class{#compilerObject;constructor(compilerObject){this.#compilerObject=compilerObject}get compilerObject(){return this.#compilerObject}getText(){return this.compilerObject.text}getKind(){return this.compilerObject.kind}},TypeChecker=class{#context;#getCompilerObject;constructor(context){this.#context=context}get compilerObject(){return this.#getCompilerObject()}_reset(getTypeChecker){this.#getCompilerObject=getTypeChecker}getAmbientModules(){return this.compilerObject.getAmbientModules().map(s=>this.#context.compilerFactory.getSymbol(s))}getApparentType(type){return this.#context.compilerFactory.getType(this.compilerObject.getApparentType(type.compilerType))}getConstantValue(node){return this.compilerObject.getConstantValue(node.compilerNode)}getFullyQualifiedName(symbol){return this.compilerObject.getFullyQualifiedName(symbol.compilerSymbol)}getTypeAtLocation(node){return this.#context.compilerFactory.getType(this.compilerObject.getTypeAtLocation(node.compilerNode))}getContextualType(expression){let contextualType=this.compilerObject.getContextualType(expression.compilerNode);return contextualType==null?void 0:this.#context.compilerFactory.getType(contextualType)}getTypeOfSymbolAtLocation(symbol,node){return this.#context.compilerFactory.getType(this.compilerObject.getTypeOfSymbolAtLocation(symbol.compilerSymbol,node.compilerNode))}getDeclaredTypeOfSymbol(symbol){return this.#context.compilerFactory.getType(this.compilerObject.getDeclaredTypeOfSymbol(symbol.compilerSymbol))}getSymbolAtLocation(node){let compilerSymbol=this.compilerObject.getSymbolAtLocation(node.compilerNode);return compilerSymbol==null?void 0:this.#context.compilerFactory.getSymbol(compilerSymbol)}getAliasedSymbol(symbol){if(!symbol.hasFlags(common.SymbolFlags.Alias))return;let tsAliasSymbol=this.compilerObject.getAliasedSymbol(symbol.compilerSymbol);return tsAliasSymbol==null?void 0:this.#context.compilerFactory.getSymbol(tsAliasSymbol)}getImmediatelyAliasedSymbol(symbol){let tsAliasSymbol=this.compilerObject.getImmediateAliasedSymbol(symbol.compilerSymbol);return tsAliasSymbol==null?void 0:this.#context.compilerFactory.getSymbol(tsAliasSymbol)}getExportSymbolOfSymbol(symbol){return this.#context.compilerFactory.getSymbol(this.compilerObject.getExportSymbolOfSymbol(symbol.compilerSymbol))}getPropertiesOfType(type){return this.compilerObject.getPropertiesOfType(type.compilerType).map(p=>this.#context.compilerFactory.getSymbol(p))}getTypeText(type,enclosingNode,typeFormatFlags){return typeFormatFlags==null&&(typeFormatFlags=this.#getDefaultTypeFormatFlags(enclosingNode)),this.compilerObject.typeToString(type.compilerType,enclosingNode?.compilerNode,typeFormatFlags)}getReturnTypeOfSignature(signature){return this.#context.compilerFactory.getType(this.compilerObject.getReturnTypeOfSignature(signature.compilerSignature))}getSignatureFromNode(node){let signature=this.compilerObject.getSignatureFromDeclaration(node.compilerNode);return signature==null?void 0:this.#context.compilerFactory.getSignature(signature)}getExportsOfModule(moduleSymbol){return(this.compilerObject.getExportsOfModule(moduleSymbol.compilerSymbol)||[]).map(s=>this.#context.compilerFactory.getSymbol(s))}getExportSpecifierLocalTargetSymbol(exportSpecifier){let symbol=this.compilerObject.getExportSpecifierLocalTargetSymbol(exportSpecifier.compilerNode);return symbol==null?void 0:this.#context.compilerFactory.getSymbol(symbol)}getResolvedSignature(node){let resolvedSignature=this.compilerObject.getResolvedSignature(node.compilerNode);if(!(!resolvedSignature||!resolvedSignature.declaration))return this.#context.compilerFactory.getSignature(resolvedSignature)}getResolvedSignatureOrThrow(node,message){return common.errors.throwIfNullOrUndefined(this.getResolvedSignature(node),message??"Signature could not be resolved.",node)}getBaseTypeOfLiteralType(type){return this.#context.compilerFactory.getType(this.compilerObject.getBaseTypeOfLiteralType(type.compilerType))}getSymbolsInScope(node,meaning){return this.compilerObject.getSymbolsInScope(node.compilerNode,meaning).map(s=>this.#context.compilerFactory.getSymbol(s))}getTypeArguments(typeReference){return this.compilerObject.getTypeArguments(typeReference.compilerType).map(arg=>this.#context.compilerFactory.getType(arg))}isTypeAssignableTo(sourceType,targetType){return this.compilerObject.isTypeAssignableTo(sourceType.compilerType,targetType.compilerType)}#getDefaultTypeFormatFlags(enclosingNode){let formatFlags=common.TypeFormatFlags.UseTypeOfFunction|common.TypeFormatFlags.NoTruncation|common.TypeFormatFlags.UseFullyQualifiedType|common.TypeFormatFlags.WriteTypeArgumentsOfSignature;return enclosingNode!=null&&enclosingNode.getKind()===common.SyntaxKind.TypeAliasDeclaration&&(formatFlags|=common.TypeFormatFlags.InTypeAlias),formatFlags}getShorthandAssignmentValueSymbol(node){let symbol=this.compilerObject.getShorthandAssignmentValueSymbol(node.compilerNode);return symbol?this.#context.compilerFactory.getSymbol(symbol):void 0}resolveName(name,location2,meaning,excludeGlobals){let symbol=this.compilerObject.resolveName(name,location2?.compilerNode,meaning,excludeGlobals);return symbol?this.#context.compilerFactory.getSymbol(symbol):void 0}},Program=class{#context;#typeChecker;#createdCompilerObject;#oldProgram;#getOrCreateCompilerObject;#configFileParsingDiagnostics;constructor(opts){this.#context=opts.context,this.#configFileParsingDiagnostics=opts.configFileParsingDiagnostics,this.#typeChecker=new TypeChecker(this.#context),this._reset(opts.rootNames,opts.host)}get compilerObject(){return this.#getOrCreateCompilerObject()}_isCompilerProgramCreated(){return this.#createdCompilerObject!=null}_reset(rootNames,host){let compilerOptions=this.#context.compilerOptions.get();this.#getOrCreateCompilerObject=()=>(this.#createdCompilerObject==null&&(this.#createdCompilerObject=common.ts.createProgram(rootNames,compilerOptions,host,this.#oldProgram,this.#configFileParsingDiagnostics),this.#oldProgram=void 0),this.#createdCompilerObject),this.#createdCompilerObject!=null&&(this.#oldProgram=this.#createdCompilerObject,this.#createdCompilerObject=void 0),this.#typeChecker._reset(()=>this.compilerObject.getTypeChecker())}getTypeChecker(){return this.#typeChecker}async emit(options={}){if(options.writeFile){let message=`Cannot specify a ${common.nameof(options,"writeFile")} option when emitting asynchrously. Use ${common.nameof(this,"emitSync")}() instead.`;throw new common.errors.InvalidOperationError(message)}let{fileSystemWrapper}=this.#context,promises=[],emitResult=this.#emit({writeFile:(filePath,text,writeByteOrderMark)=>{promises.push(fileSystemWrapper.writeFile(fileSystemWrapper.getStandardizedAbsolutePath(filePath),writeByteOrderMark?"\uFEFF"+text:text))},...options});return await Promise.all(promises),new EmitResult(this.#context,emitResult)}emitSync(options={}){return new EmitResult(this.#context,this.#emit(options))}emitToMemory(options={}){let sourceFiles=[],{fileSystemWrapper}=this.#context,emitResult=this.#emit({writeFile:(filePath,text,writeByteOrderMark)=>{sourceFiles.push({filePath:fileSystemWrapper.getStandardizedAbsolutePath(filePath),text,writeByteOrderMark:writeByteOrderMark||!1})},...options});return new MemoryEmitResult(this.#context,emitResult,sourceFiles)}#emit(options={}){let targetSourceFile=options.targetSourceFile!=null?options.targetSourceFile.compilerNode:void 0,{emitOnlyDtsFiles,customTransformers,writeFile}=options;return this.compilerObject.emit(targetSourceFile,writeFile,void 0,emitOnlyDtsFiles,customTransformers)}getSyntacticDiagnostics(sourceFile){return this.compilerObject.getSyntacticDiagnostics(sourceFile?.compilerNode).map(d=>this.#context.compilerFactory.getDiagnosticWithLocation(d))}getSemanticDiagnostics(sourceFile){return this.compilerObject.getSemanticDiagnostics(sourceFile?.compilerNode).map(d=>this.#context.compilerFactory.getDiagnostic(d))}getDeclarationDiagnostics(sourceFile){return this.compilerObject.getDeclarationDiagnostics(sourceFile?.compilerNode).map(d=>this.#context.compilerFactory.getDiagnosticWithLocation(d))}getGlobalDiagnostics(){return this.compilerObject.getGlobalDiagnostics().map(d=>this.#context.compilerFactory.getDiagnostic(d))}getConfigFileParsingDiagnostics(){return this.compilerObject.getConfigFileParsingDiagnostics().map(d=>this.#context.compilerFactory.getDiagnostic(d))}getEmitModuleResolutionKind(){return common.getEmitModuleResolutionKind(this.compilerObject.getCompilerOptions())}isSourceFileFromExternalLibrary(sourceFile){return sourceFile.isFromExternalLibrary()}},LanguageService=class{#compilerObject;#compilerHost;#program;#context;#projectVersion=0;get compilerObject(){return this.#compilerObject}constructor(params){this.#context=params.context;let{languageServiceHost,compilerHost}=common.createHosts({transactionalFileSystem:this.#context.fileSystemWrapper,sourceFileContainer:this.#context.getSourceFileContainer(),compilerOptions:this.#context.compilerOptions,getNewLine:()=>this.#context.manipulationSettings.getNewLineKindAsString(),getProjectVersion:()=>`${this.#projectVersion}`,resolutionHost:params.resolutionHost??{},libFolderPath:params.libFolderPath,skipLoadingLibFiles:params.skipLoadingLibFiles});this.#compilerHost=compilerHost,this.#compilerObject=common.ts.createLanguageService(languageServiceHost,this.#context.compilerFactory.documentRegistry),this.#program=new Program({context:this.#context,rootNames:Array.from(this.#context.compilerFactory.getSourceFilePaths()),host:this.#compilerHost,configFileParsingDiagnostics:params.configFileParsingDiagnostics}),this.#context.compilerFactory.onSourceFileAdded(sourceFile=>{sourceFile._isInProject()&&this._reset()}),this.#context.compilerFactory.onSourceFileRemoved(()=>this._reset())}_reset(){this.#projectVersion+=1,this.#program._reset(Array.from(this.#context.compilerFactory.getSourceFilePaths()),this.#compilerHost)}getProgram(){return this.#program}getDefinitions(node){return this.getDefinitionsAtPosition(node._sourceFile,node.getStart())}getDefinitionsAtPosition(sourceFile,pos){return(this.compilerObject.getDefinitionAtPosition(sourceFile.getFilePath(),pos)||[]).map(info=>this.#context.compilerFactory.getDefinitionInfo(info))}getImplementations(node){return this.getImplementationsAtPosition(node._sourceFile,node.getStart())}getImplementationsAtPosition(sourceFile,pos){return(this.compilerObject.getImplementationAtPosition(sourceFile.getFilePath(),pos)||[]).map(location2=>new ImplementationLocation(this.#context,location2))}findReferences(node){return this.findReferencesAtPosition(node._sourceFile,node.getStart())}findReferencesAsNodes(node){let referencedSymbols=this.findReferences(node);return Array.from(getReferencingNodes());function*getReferencingNodes(){for(let referencedSymbol of referencedSymbols){let isAlias=referencedSymbol.getDefinition().getKind()===common.ts.ScriptElementKind.alias,references=referencedSymbol.getReferences();for(let i=0;i0)&&(yield reference.getNode())}}}}findReferencesAtPosition(sourceFile,pos){return(this.compilerObject.findReferences(sourceFile.getFilePath(),pos)||[]).map(s=>this.#context.compilerFactory.getReferencedSymbol(s))}findRenameLocations(node,options={}){let usePrefixAndSuffixText=options.usePrefixAndSuffixText==null?this.#context.manipulationSettings.getUsePrefixAndSuffixTextForRename():options.usePrefixAndSuffixText;return(this.compilerObject.findRenameLocations(node._sourceFile.getFilePath(),node.getStart(),options.renameInStrings||!1,options.renameInComments||!1,usePrefixAndSuffixText)||[]).map(l=>new RenameLocation(this.#context,l))}getSuggestionDiagnostics(filePathOrSourceFile){let filePath=this.#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile);return this.compilerObject.getSuggestionDiagnostics(filePath).map(d=>this.#context.compilerFactory.getDiagnosticWithLocation(d))}getFormattingEditsForRange(filePath,range,formatSettings){return(this.compilerObject.getFormattingEditsForRange(filePath,range[0],range[1],this.#getFilledSettings(formatSettings))||[]).map(e=>new TextChange(e))}getFormattingEditsForDocument(filePath,formatSettings){let standardizedFilePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePath);return(this.compilerObject.getFormattingEditsForDocument(standardizedFilePath,this.#getFilledSettings(formatSettings))||[]).map(e=>new TextChange(e))}getFormattedDocumentText(filePath,formatSettings){let standardizedFilePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePath),sourceFile=this.#context.compilerFactory.getSourceFileFromCacheFromFilePath(standardizedFilePath);if(sourceFile==null)throw new common.errors.FileNotFoundError(standardizedFilePath);formatSettings=this.#getFilledSettings(formatSettings);let formattingEdits=this.getFormattingEditsForDocument(standardizedFilePath,formatSettings),newText=getTextFromTextChanges(sourceFile,formattingEdits),newLineChar=formatSettings.newLineCharacter;return formatSettings.ensureNewLineAtEndOfFile&&!newText.endsWith(newLineChar)&&(newText+=newLineChar),newText.replace(/\r?\n/g,newLineChar)}getEmitOutput(filePathOrSourceFile,emitOnlyDtsFiles){let filePath=this.#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile),compilerObject=this.compilerObject;return new EmitOutput(this.#context,getCompilerEmitOutput());function getCompilerEmitOutput(){let program=compilerObject.getProgram();return program==null||program.getSourceFile(filePath)==null?{emitSkipped:!0,outputFiles:[],diagnostics:[]}:compilerObject.getEmitOutput(filePath,emitOnlyDtsFiles)}}getIdentationAtPosition(filePathOrSourceFile,position,settings){let filePath=this.#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile);return settings==null?settings=this.#context.manipulationSettings.getEditorSettings():fillDefaultEditorSettings(settings,this.#context.manipulationSettings),this.compilerObject.getIndentationAtPosition(filePath,position,settings)}organizeImports(filePathOrSourceFile,formatSettings={},userPreferences={}){let scope={type:"file",fileName:this.#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile)};return this.compilerObject.organizeImports(scope,this.#getFilledSettings(formatSettings),this.#getFilledUserPreferences(userPreferences)).map(fileTextChanges=>new FileTextChanges(this.#context,fileTextChanges))}getEditsForRefactor(filePathOrSourceFile,formatSettings,positionOrRange,refactorName,actionName,preferences={}){let filePath=this.#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile),position=typeof positionOrRange=="number"?positionOrRange:{pos:positionOrRange.getPos(),end:positionOrRange.getEnd()},compilerObject=this.compilerObject.getEditsForRefactor(filePath,this.#getFilledSettings(formatSettings),position,refactorName,actionName,this.#getFilledUserPreferences(preferences));return compilerObject!=null?new RefactorEditInfo(this.#context,compilerObject):void 0}getCombinedCodeFix(filePathOrSourceFile,fixId,formatSettings={},preferences={}){let compilerResult=this.compilerObject.getCombinedCodeFix({type:"file",fileName:this.#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile)},fixId,this.#getFilledSettings(formatSettings),this.#getFilledUserPreferences(preferences||{}));return new CombinedCodeActions(this.#context,compilerResult)}getCodeFixesAtPosition(filePathOrSourceFile,start,end,errorCodes,formatOptions={},preferences={}){let filePath=this.#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile);return this.compilerObject.getCodeFixesAtPosition(filePath,start,end,errorCodes,this.#getFilledSettings(formatOptions),this.#getFilledUserPreferences(preferences||{})).map(compilerObject=>new CodeFixAction(this.#context,compilerObject))}#getFilePathFromFilePathOrSourceFile(filePathOrSourceFile){let filePath=typeof filePathOrSourceFile=="string"?this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePathOrSourceFile):filePathOrSourceFile.getFilePath();if(!this.#context.compilerFactory.containsSourceFileAtPath(filePath))throw new common.errors.FileNotFoundError(filePath);return filePath}#getFilledSettings(settings){return settings._filled||(settings=Object.assign(this.#context.getFormatCodeSettings(),settings),fillDefaultFormatCodeSettings(settings,this.#context.manipulationSettings),settings._filled=!0),settings}#getFilledUserPreferences(userPreferences){return Object.assign(this.#context.getUserPreferences(),userPreferences)}},Type=class{_context;#compilerType;get compilerType(){return this.#compilerType}constructor(context,type){this._context=context,this.#compilerType=type}getText(enclosingNode,typeFormatFlags){return this._context.typeChecker.getTypeText(this,enclosingNode,typeFormatFlags)}getAliasSymbol(){return this.compilerType.aliasSymbol==null?void 0:this._context.compilerFactory.getSymbol(this.compilerType.aliasSymbol)}getAliasSymbolOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getAliasSymbol(),"Expected to find an alias symbol.")}getAliasTypeArguments(){return(this.compilerType.aliasTypeArguments||[]).map(t=>this._context.compilerFactory.getType(t))}getApparentType(){return this._context.typeChecker.getApparentType(this)}getArrayElementTypeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getArrayElementType(),message??"Expected to find an array element type.")}getArrayElementType(){if(this.isArray())return this.getTypeArguments()[0]}getBaseTypes(){return(this.compilerType.getBaseTypes()||[]).map(t=>this._context.compilerFactory.getType(t))}getBaseTypeOfLiteralType(){return this._context.typeChecker.getBaseTypeOfLiteralType(this)}getCallSignatures(){return this.compilerType.getCallSignatures().map(s=>this._context.compilerFactory.getSignature(s))}getConstructSignatures(){return this.compilerType.getConstructSignatures().map(s=>this._context.compilerFactory.getSignature(s))}getConstraintOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getConstraint(),message??"Expected to find a constraint.")}getConstraint(){let constraint=this.compilerType.getConstraint();return constraint==null?void 0:this._context.compilerFactory.getType(constraint)}getDefaultOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getDefault(),message??"Expected to find a default type.")}getDefault(){let defaultType=this.compilerType.getDefault();return defaultType==null?void 0:this._context.compilerFactory.getType(defaultType)}getProperties(){return this.compilerType.getProperties().map(s=>this._context.compilerFactory.getSymbol(s))}getPropertyOrThrow(nameOrFindFunction){return common.errors.throwIfNullOrUndefined(this.getProperty(nameOrFindFunction),()=>getNotFoundErrorMessageForNameOrFindFunction("symbol property",nameOrFindFunction))}getProperty(nameOrFindFunction){return getSymbolByNameOrFindFunction(this.getProperties(),nameOrFindFunction)}getApparentProperties(){return this.compilerType.getApparentProperties().map(s=>this._context.compilerFactory.getSymbol(s))}getApparentProperty(nameOrFindFunction){return getSymbolByNameOrFindFunction(this.getApparentProperties(),nameOrFindFunction)}isNullable(){return this.getUnionTypes().some(t=>t.isNull()||t.isUndefined())}getNonNullableType(){return this._context.compilerFactory.getType(this.compilerType.getNonNullableType())}getNumberIndexType(){let numberIndexType=this.compilerType.getNumberIndexType();return numberIndexType==null?void 0:this._context.compilerFactory.getType(numberIndexType)}getStringIndexType(){let stringIndexType=this.compilerType.getStringIndexType();return stringIndexType==null?void 0:this._context.compilerFactory.getType(stringIndexType)}getTargetType(){let targetType=this.compilerType.target||void 0;return targetType==null?void 0:this._context.compilerFactory.getType(targetType)}getTargetTypeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getTargetType(),message??"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(t=>this._context.compilerFactory.getType(t)):[]}getIntersectionTypes(){return this.isIntersection()?this.compilerType.types.map(t=>this._context.compilerFactory.getType(t)):[]}getLiteralValue(){return this.compilerType?.value}getLiteralValueOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getLiteralValue(),message??"Type was not a literal type.")}getLiteralFreshType(){let type=this.compilerType?.freshType;return type==null?void 0:this._context.compilerFactory.getType(type)}getLiteralFreshTypeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getLiteralFreshType(),message??"Type was not a literal type.")}getLiteralRegularType(){let type=this.compilerType?.regularType;return type==null?void 0:this._context.compilerFactory.getType(type)}getLiteralRegularTypeOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getLiteralRegularType(),message??"Type was not a literal type.")}getSymbol(){let tsSymbol=this.compilerType.getSymbol();return tsSymbol==null?void 0:this._context.compilerFactory.getSymbol(tsSymbol)}getSymbolOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getSymbol(),message??"Expected to find a symbol.")}isAssignableTo(target){return this._context.typeChecker.isTypeAssignableTo(this,target)}isAnonymous(){return this.#hasObjectFlag(common.ObjectFlags.Anonymous)}isAny(){return this.#hasTypeFlag(common.TypeFlags.Any)}isNever(){return this.#hasTypeFlag(common.TypeFlags.Never)}isArray(){let symbol=this.getSymbol();return symbol==null?!1:(symbol.getName()==="Array"||symbol.getName()==="ReadonlyArray")&&this.getTypeArguments().length===1}isReadonlyArray(){let symbol=this.getSymbol();return symbol==null?!1:symbol.getName()==="ReadonlyArray"&&this.getTypeArguments().length===1}isTemplateLiteral(){return this.#hasTypeFlag(common.TypeFlags.TemplateLiteral)}isBoolean(){return this.#hasTypeFlag(common.TypeFlags.Boolean)}isString(){return this.#hasTypeFlag(common.TypeFlags.String)}isNumber(){return this.#hasTypeFlag(common.TypeFlags.Number)}isBigInt(){return this.#hasTypeFlag(common.TypeFlags.BigInt)}isLiteral(){let isBooleanLiteralForTs3_0=this.isBooleanLiteral();return this.compilerType.isLiteral()||isBooleanLiteralForTs3_0}isBooleanLiteral(){return this.#hasTypeFlag(common.TypeFlags.BooleanLiteral)}isBigIntLiteral(){return this.#hasTypeFlag(common.TypeFlags.BigIntLiteral)}isEnumLiteral(){return this.#hasTypeFlag(common.TypeFlags.EnumLiteral)&&!this.isUnion()}isNumberLiteral(){return this.#hasTypeFlag(common.TypeFlags.NumberLiteral)}isStringLiteral(){return this.compilerType.isStringLiteral()}isClass(){return this.compilerType.isClass()}isClassOrInterface(){return this.compilerType.isClassOrInterface()}isEnum(){if(this.#hasTypeFlag(common.TypeFlags.Enum))return!0;if(this.isEnumLiteral()&&!this.isUnion())return!1;let symbol=this.getSymbol();if(symbol==null)return!1;let valueDeclaration=symbol.getValueDeclaration();return valueDeclaration!=null&&Node.isEnumDeclaration(valueDeclaration)}isInterface(){return this.#hasObjectFlag(common.ObjectFlags.Interface)}isObject(){return this.#hasTypeFlag(common.TypeFlags.Object)}isTypeParameter(){return this.compilerType.isTypeParameter()}isTuple(){let targetType=this.getTargetType();return targetType==null?!1:targetType.#hasObjectFlag(common.ObjectFlags.Tuple)}isUnion(){return this.compilerType.isUnion()}isIntersection(){return this.compilerType.isIntersection()}isUnionOrIntersection(){return this.compilerType.isUnionOrIntersection()}isUnknown(){return this.#hasTypeFlag(common.TypeFlags.Unknown)}isNull(){return this.#hasTypeFlag(common.TypeFlags.Null)}isUndefined(){return this.#hasTypeFlag(common.TypeFlags.Undefined)}isVoid(){return this.#hasTypeFlag(common.TypeFlags.Void)}getFlags(){return this.compilerType.flags}getObjectFlags(){return this.isObject()&&this.compilerType.objectFlags||0}#hasTypeFlag(flag){return(this.compilerType.flags&flag)===flag}#hasObjectFlag(flag){return(this.getObjectFlags()&flag)===flag}},TypeParameter=class extends Type{getConstraintOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getConstraint(),message??"Expected type parameter to have a constraint.")}getConstraint(){let declaration=this.#getTypeParameterDeclaration();if(declaration==null)return;let constraintNode=declaration.getConstraint();if(constraintNode!=null)return this._context.typeChecker.getTypeAtLocation(constraintNode)}getDefaultOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getDefault(),message??"Expected type parameter to have a default type.")}getDefault(){let declaration=this.#getTypeParameterDeclaration();if(declaration==null)return;let defaultNode=declaration.getDefault();if(defaultNode!=null)return this._context.typeChecker.getTypeAtLocation(defaultNode)}#getTypeParameterDeclaration(){let symbol=this.getSymbol();if(symbol==null)return;let declaration=symbol.getDeclarations()[0];if(declaration!=null&&Node.isTypeParameterDeclaration(declaration))return declaration}},DirectoryEmitResult=class{#outputFilePaths;#skippedFilePaths;constructor(skippedFilePaths,outputFilePaths){this.#skippedFilePaths=skippedFilePaths,this.#outputFilePaths=outputFilePaths}getSkippedFilePaths(){return this.#skippedFilePaths}getOutputFilePaths(){return this.#outputFilePaths}},Directory=class _Directory{#context;#path;#pathParts;constructor(context,path){this.#context=context,this._setPathInternal(path)}_setPathInternal(path){this.#path=path,this.#pathParts=path.split("/").filter(p=>p.length>0)}get _context(){return this.#throwIfDeletedOrRemoved(),this.#context}isAncestorOf(possibleDescendant){return _Directory.#isAncestorOfDir(this,possibleDescendant)}isDescendantOf(possibleAncestor){return _Directory.#isAncestorOfDir(possibleAncestor,this)}_getDepth(){return this.#pathParts.length}getPath(){return this.#throwIfDeletedOrRemoved(),this.#path}getBaseName(){return this.#pathParts[this.#pathParts.length-1]}getParentOrThrow(message){return common.errors.throwIfNullOrUndefined(this.getParent(),message??(()=>`Parent directory of ${this.getPath()} does not exist or was never added.`))}getParent(){if(!common.FileUtils.isRootDirPath(this.getPath()))return this.addDirectoryAtPathIfExists(common.FileUtils.getDirPath(this.getPath()))}getDirectoryOrThrow(pathOrCondition){return common.errors.throwIfNullOrUndefined(this.getDirectory(pathOrCondition),()=>typeof pathOrCondition=="string"?`Could not find a directory at path '${this._context.fileSystemWrapper.getStandardizedAbsolutePath(pathOrCondition,this.getPath())}'.`:"Could not find child directory that matched condition.")}getDirectory(pathOrCondition){if(typeof pathOrCondition=="string"){let path=this._context.fileSystemWrapper.getStandardizedAbsolutePath(pathOrCondition,this.getPath());return this._context.compilerFactory.getDirectoryFromCache(path)}return this.getDirectories().find(pathOrCondition)}getSourceFileOrThrow(pathOrCondition){return common.errors.throwIfNullOrUndefined(this.getSourceFile(pathOrCondition),()=>typeof pathOrCondition=="string"?`Could not find child source file at path '${this._context.fileSystemWrapper.getStandardizedAbsolutePath(pathOrCondition,this.getPath())}'.`:"Could not find child source file that matched condition.")}getSourceFile(pathOrCondition){if(typeof pathOrCondition=="string"){let path=this._context.fileSystemWrapper.getStandardizedAbsolutePath(pathOrCondition,this.getPath());return this._context.compilerFactory.getSourceFileFromCacheFromFilePath(path)}for(let sourceFile of this._getSourceFilesIterator())if(pathOrCondition(sourceFile))return sourceFile}getDirectories(){return Array.from(this._getDirectoriesIterator())}_getDirectoriesIterator(){return this._context.compilerFactory.getChildDirectoriesOfDirectory(this.getPath())}getSourceFiles(globPatterns){let{compilerFactory,fileSystemWrapper}=this._context,dir=this;if(typeof globPatterns=="string"||globPatterns instanceof Array){let finalGlobPatterns=typeof globPatterns=="string"?[globPatterns]:globPatterns;return Array.from(getFilteredSourceFiles(finalGlobPatterns))}else return Array.from(this._getSourceFilesIterator());function*getFilteredSourceFiles(globPatterns2){let sourceFilePaths=Array.from(getSourceFilePaths()),matchedPaths=common.matchGlobs(sourceFilePaths,globPatterns2,dir.getPath());for(let matchedPath of matchedPaths)yield compilerFactory.getSourceFileFromCacheFromFilePath(fileSystemWrapper.getStandardizedAbsolutePath(matchedPath));function*getSourceFilePaths(){for(let sourceFile of dir._getDescendantSourceFilesIterator())yield sourceFile.getFilePath()}}}_getSourceFilesIterator(){return this._context.compilerFactory.getChildSourceFilesOfDirectory(this.getPath())}getDescendantSourceFiles(){return Array.from(this._getDescendantSourceFilesIterator())}*_getDescendantSourceFilesIterator(){for(let sourceFile of this._getSourceFilesIterator())yield sourceFile;for(let directory of this._getDirectoriesIterator())yield*directory._getDescendantSourceFilesIterator()}getDescendantDirectories(){return Array.from(this._getDescendantDirectoriesIterator())}*_getDescendantDirectoriesIterator(){for(let directory of this.getDirectories())yield directory,yield*directory._getDescendantDirectoriesIterator()}addSourceFilesAtPaths(fileGlobs){return fileGlobs=typeof fileGlobs=="string"?[fileGlobs]:fileGlobs,fileGlobs=fileGlobs.map(g=>common.FileUtils.pathIsAbsolute(g)?g:common.FileUtils.pathJoin(this.getPath(),g)),this._context.directoryCoordinator.addSourceFilesAtPaths(fileGlobs,{markInProject:this._isInProject()})}addDirectoryAtPathIfExists(relativeOrAbsoluteDirPath,options={}){let dirPath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(relativeOrAbsoluteDirPath,this.getPath());return this._context.directoryCoordinator.addDirectoryAtPathIfExists(dirPath,{...options,markInProject:this._isInProject()})}addDirectoryAtPath(relativeOrAbsoluteDirPath,options={}){let dirPath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(relativeOrAbsoluteDirPath,this.getPath());return this._context.directoryCoordinator.addDirectoryAtPath(dirPath,{...options,markInProject:this._isInProject()})}createDirectory(relativeOrAbsoluteDirPath){let dirPath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(relativeOrAbsoluteDirPath,this.getPath());return this._context.directoryCoordinator.createDirectoryOrAddIfExists(dirPath,{markInProject:this._isInProject()})}createSourceFile(relativeFilePath,sourceFileText,options){let filePath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(relativeFilePath,this.getPath());return this._context.compilerFactory.createSourceFile(filePath,sourceFileText||"",{...options||{},markInProject:this._isInProject()})}addSourceFileAtPathIfExists(relativeFilePath){let filePath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(relativeFilePath,this.getPath());return this._context.directoryCoordinator.addSourceFileAtPathIfExists(filePath,{markInProject:this._isInProject()})}addSourceFileAtPath(relativeFilePath){let filePath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(relativeFilePath,this.getPath());return this._context.directoryCoordinator.addSourceFileAtPath(filePath,{markInProject:this._isInProject()})}async emit(options={}){let{fileSystemWrapper}=this._context,writeTasks=[],outputFilePaths=[],skippedFilePaths=[];for(let emitResult of this.#emitInternal(options))isStandardizedFilePath(emitResult)?skippedFilePaths.push(emitResult):(writeTasks.push(fileSystemWrapper.writeFile(emitResult.filePath,emitResult.fileText)),outputFilePaths.push(emitResult.filePath));return await Promise.all(writeTasks),new DirectoryEmitResult(skippedFilePaths,outputFilePaths)}emitSync(options={}){let{fileSystemWrapper}=this._context,outputFilePaths=[],skippedFilePaths=[];for(let emitResult of this.#emitInternal(options))isStandardizedFilePath(emitResult)?skippedFilePaths.push(emitResult):(fileSystemWrapper.writeFileSync(emitResult.filePath,emitResult.fileText),outputFilePaths.push(emitResult.filePath));return new DirectoryEmitResult(skippedFilePaths,outputFilePaths)}#emitInternal(options={}){let{emitOnlyDtsFiles=!1}=options,isJsFile=options.outDir==null?void 0:/\.js$/i,isMapFile=options.outDir==null?void 0:/\.js\.map$/i,isDtsFile=options.declarationDir==null&&options.outDir==null?void 0:/\.d\.ts$/i,getStandardizedPath=path=>path==null?void 0:this._context.fileSystemWrapper.getStandardizedAbsolutePath(path,this.getPath()),getSubDirPath=(path,dir)=>path==null?void 0:common.FileUtils.pathJoin(path,dir.getBaseName()),hasDeclarationDir=this._context.compilerOptions.get().declarationDir!=null||options.declarationDir!=null;return emitDirectory(this,getStandardizedPath(options.outDir),getStandardizedPath(options.declarationDir));function*emitDirectory(directory,outDir,declarationDir){for(let sourceFile of directory.getSourceFiles()){let output=sourceFile.getEmitOutput({emitOnlyDtsFiles});if(output.getEmitSkipped()){yield sourceFile.getFilePath();continue}for(let outputFile of output.getOutputFiles()){let filePath=outputFile.getFilePath(),fileText=outputFile.getWriteByteOrderMark()?common.FileUtils.getTextWithByteOrderMark(outputFile.getText()):outputFile.getText();outDir!=null&&(isJsFile.test(filePath)||isMapFile.test(filePath)||!hasDeclarationDir&&isDtsFile.test(filePath))?filePath=common.FileUtils.pathJoin(outDir,common.FileUtils.getBaseName(filePath)):declarationDir!=null&&isDtsFile.test(filePath)&&(filePath=common.FileUtils.pathJoin(declarationDir,common.FileUtils.getBaseName(filePath))),yield{filePath,fileText}}}for(let dir of directory.getDirectories())yield*emitDirectory(dir,getSubDirPath(outDir,dir),getSubDirPath(declarationDir,dir))}}copyToDirectory(dirPathOrDirectory,options){let dirPath=typeof dirPathOrDirectory=="string"?dirPathOrDirectory:dirPathOrDirectory.getPath();return this.copy(common.FileUtils.pathJoin(dirPath,this.getBaseName()),options)}copy(relativeOrAbsolutePath,options){let originalPath=this.getPath(),fileSystem=this._context.fileSystemWrapper,newPath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(relativeOrAbsolutePath,this.getPath());return originalPath===newPath?this:(options=getDirectoryCopyOptions(options),options.includeUntrackedFiles&&fileSystem.queueCopyDirectory(originalPath,newPath),this.#copyInternal(newPath,options))}async copyImmediately(relativeOrAbsolutePath,options){let fileSystem=this._context.fileSystemWrapper,originalPath=this.getPath(),newPath=fileSystem.getStandardizedAbsolutePath(relativeOrAbsolutePath,originalPath);if(originalPath===newPath)return await this.save(),this;options=getDirectoryCopyOptions(options);let newDir=this.#copyInternal(newPath,options);return options.includeUntrackedFiles&&await fileSystem.copyDirectoryImmediately(originalPath,newPath),await newDir.save(),newDir}copyImmediatelySync(relativeOrAbsolutePath,options){let fileSystem=this._context.fileSystemWrapper,originalPath=this.getPath(),newPath=fileSystem.getStandardizedAbsolutePath(relativeOrAbsolutePath,originalPath);if(originalPath===newPath)return this.saveSync(),this;options=getDirectoryCopyOptions(options);let newDir=this.#copyInternal(newPath,options);return options.includeUntrackedFiles&&fileSystem.copyDirectoryImmediatelySync(originalPath,newPath),newDir.saveSync(),newDir}#copyInternal(newPath,options){if(this.getPath()===newPath)return this;let{fileSystemWrapper:fileSystem,compilerFactory}=this._context,copyingDirectories=[this,...this.getDescendantDirectories()].map(directory=>({newDirPath:directory===this?newPath:fileSystem.getStandardizedAbsolutePath(this.getRelativePathTo(directory),newPath)})),copyingSourceFiles=this.getDescendantSourceFiles().map(sourceFile=>({sourceFile,newFilePath:fileSystem.getStandardizedAbsolutePath(this.getRelativePathTo(sourceFile),newPath),references:this.#getReferencesForCopy(sourceFile)}));for(let{newDirPath}of copyingDirectories)this._context.compilerFactory.createDirectoryOrAddIfExists(newDirPath,{markInProject:this._isInProject()});for(let{sourceFile,newFilePath}of copyingSourceFiles)sourceFile._copyInternal(newFilePath,options);for(let{references,newFilePath}of copyingSourceFiles)this.getSourceFileOrThrow(newFilePath)._updateReferencesForCopyInternal(references);return compilerFactory.getDirectoryFromCache(newPath)}moveToDirectory(dirPathOrDirectory,options){let dirPath=typeof dirPathOrDirectory=="string"?dirPathOrDirectory:dirPathOrDirectory.getPath();return this.move(common.FileUtils.pathJoin(dirPath,this.getBaseName()),options)}move(relativeOrAbsolutePath,options){let fileSystem=this._context.fileSystemWrapper,originalPath=this.getPath(),newPath=fileSystem.getStandardizedAbsolutePath(relativeOrAbsolutePath,originalPath);return originalPath===newPath?this:this.#moveInternal(newPath,options,()=>fileSystem.queueMoveDirectory(originalPath,newPath))}async moveImmediately(relativeOrAbsolutePath,options){let fileSystem=this._context.fileSystemWrapper,originalPath=this.getPath(),newPath=fileSystem.getStandardizedAbsolutePath(relativeOrAbsolutePath,originalPath);return originalPath===newPath?(await this.save(),this):(this.#moveInternal(newPath,options),await fileSystem.moveDirectoryImmediately(originalPath,newPath),await this.save(),this)}moveImmediatelySync(relativeOrAbsolutePath,options){let fileSystem=this._context.fileSystemWrapper,originalPath=this.getPath(),newPath=fileSystem.getStandardizedAbsolutePath(relativeOrAbsolutePath,originalPath);return originalPath===newPath?(this.saveSync(),this):(this.#moveInternal(newPath,options),fileSystem.moveDirectoryImmediatelySync(originalPath,newPath),this.saveSync(),this)}#moveInternal(newPath,options,preAction){let originalPath=this.getPath();if(originalPath===newPath)return this;let existingDir=this._context.compilerFactory.getDirectoryFromCacheOnlyIfInCache(newPath),markInProject=existingDir!=null&&existingDir._isInProject();preAction&&preAction();let fileSystem=this._context.fileSystemWrapper,compilerFactory=this._context.compilerFactory,movingDirectories=[this,...this.getDescendantDirectories()].map(directory=>({directory,oldPath:directory.getPath(),newDirPath:directory===this?newPath:fileSystem.getStandardizedAbsolutePath(this.getRelativePathTo(directory),newPath)})),movingSourceFiles=this.getDescendantSourceFiles().map(sourceFile=>({sourceFile,newFilePath:fileSystem.getStandardizedAbsolutePath(this.getRelativePathTo(sourceFile),newPath),references:this.#getReferencesForMove(sourceFile)}));for(let{directory,oldPath,newDirPath}of movingDirectories){compilerFactory.removeDirectoryFromCache(oldPath);let dirToOverwrite=compilerFactory.getDirectoryFromCache(newDirPath);dirToOverwrite?._forgetOnlyThis(),directory._setPathInternal(newDirPath),compilerFactory.addDirectoryToCache(directory)}for(let{sourceFile,newFilePath}of movingSourceFiles)sourceFile._moveInternal(newFilePath,options);for(let{sourceFile,references}of movingSourceFiles)sourceFile._updateReferencesForMoveInternal(references,originalPath);return markInProject&&this._markAsInProject(),this}clear(){let path=this.getPath();this.#deleteDescendants(),this._context.fileSystemWrapper.queueDirectoryDelete(path),this._context.fileSystemWrapper.queueMkdir(path)}async clearImmediately(){let path=this.getPath();this.#deleteDescendants(),await this._context.fileSystemWrapper.clearDirectoryImmediately(path)}clearImmediatelySync(){let path=this.getPath();this.#deleteDescendants(),this._context.fileSystemWrapper.clearDirectoryImmediatelySync(path)}delete(){let path=this.getPath();this.#deleteDescendants(),this._context.fileSystemWrapper.queueDirectoryDelete(path),this.forget()}#deleteDescendants(){for(let sourceFile of this.getSourceFiles())sourceFile.delete();for(let dir of this.getDirectories())dir.delete()}async deleteImmediately(){let{fileSystemWrapper}=this._context,path=this.getPath();this.forget(),await fileSystemWrapper.deleteDirectoryImmediately(path)}deleteImmediatelySync(){let{fileSystemWrapper}=this._context,path=this.getPath();this.forget(),fileSystemWrapper.deleteDirectoryImmediatelySync(path)}forget(){if(!this.wasForgotten()){for(let sourceFile of this.getSourceFiles())sourceFile.forget();for(let dir of this.getDirectories())dir.forget();this._forgetOnlyThis()}}_forgetOnlyThis(){this.wasForgotten()||(this._context.compilerFactory.removeDirectoryFromCache(this.getPath()),this.#context=void 0)}async save(){await this._context.fileSystemWrapper.saveForDirectory(this.getPath());let unsavedSourceFiles=this.getDescendantSourceFiles().filter(s=>!s.isSaved());await Promise.all(unsavedSourceFiles.map(s=>s.save()))}saveSync(){this._context.fileSystemWrapper.saveForDirectorySync(this.getPath()),this.getDescendantSourceFiles().filter(s=>!s.isSaved()).forEach(s=>s.saveSync())}getRelativePathTo(sourceFileDirOrPath){let thisDirectory=this;return common.FileUtils.getRelativePathTo(this.getPath(),getPath());function getPath(){return sourceFileDirOrPath instanceof SourceFile?sourceFileDirOrPath.getFilePath():sourceFileDirOrPath instanceof _Directory?sourceFileDirOrPath.getPath():thisDirectory._context.fileSystemWrapper.getStandardizedAbsolutePath(sourceFileDirOrPath,thisDirectory.getPath())}}getRelativePathAsModuleSpecifierTo(sourceFileDirOrFilePath){let moduleResolution=this._context.program.getEmitModuleResolutionKind(),thisDirectory=this,moduleSpecifier=common.FileUtils.getRelativePathTo(this.getPath(),getPath()).replace(/((\.d\.ts$)|(\.[^/.]+$))/i,"");return moduleSpecifier.startsWith("../")?moduleSpecifier:"./"+moduleSpecifier;function getPath(){return sourceFileDirOrFilePath instanceof SourceFile?getPathForSourceFile(sourceFileDirOrFilePath):sourceFileDirOrFilePath instanceof _Directory?getPathForDirectory(sourceFileDirOrFilePath):getPathForFilePath(thisDirectory._context.fileSystemWrapper.getStandardizedAbsolutePath(sourceFileDirOrFilePath,thisDirectory.getPath()));function getPathForSourceFile(sourceFile){return getPathForFilePath(sourceFile.getFilePath())}function getPathForDirectory(dir){switch(moduleResolution){case common.ModuleResolutionKind.Node10:return dir===thisDirectory?common.FileUtils.pathJoin(dir.getPath(),"index.ts"):dir.getPath();case common.ModuleResolutionKind.Classic:case common.ModuleResolutionKind.Node16:case common.ModuleResolutionKind.NodeNext:case common.ModuleResolutionKind.Bundler:return common.FileUtils.pathJoin(dir.getPath(),"index.ts");default:return common.errors.throwNotImplementedForNeverValueError(moduleResolution)}}function getPathForFilePath(filePath){let dirPath=common.FileUtils.getDirPath(filePath);switch(moduleResolution){case common.ModuleResolutionKind.Node10:return dirPath===thisDirectory.getPath()?filePath:filePath.replace(/\/index?(\.d\.ts|\.ts|\.js)$/i,"");case common.ModuleResolutionKind.Classic:case common.ModuleResolutionKind.Node16:case common.ModuleResolutionKind.NodeNext:case common.ModuleResolutionKind.Bundler:return filePath;default:return common.errors.throwNotImplementedForNeverValueError(moduleResolution)}}}}getProject(){return this._context.project}wasForgotten(){return this.#context==null}_isInProject(){return this._context.inProjectCoordinator.isDirectoryInProject(this)}_markAsInProject(){this._context.inProjectCoordinator.markDirectoryAsInProject(this)}_hasLoadedParent(){return this._context.compilerFactory.containsDirectoryAtPath(common.FileUtils.getDirPath(this.getPath()))}#throwIfDeletedOrRemoved(){if(this.wasForgotten())throw new common.errors.InvalidOperationError("Cannot use a directory that was deleted, removed, or overwritten.")}#getReferencesForCopy(sourceFile){return sourceFile._getReferencesForCopyInternal().filter(r=>!this.isAncestorOf(r[1]))}#getReferencesForMove(sourceFile){let{literalReferences,referencingLiterals}=sourceFile._getReferencesForMoveInternal();return{literalReferences:literalReferences.filter(r=>!this.isAncestorOf(r[1])),referencingLiterals:referencingLiterals.filter(l=>!this.isAncestorOf(l._sourceFile))}}static#isAncestorOfDir(ancestor,descendant){if(descendant instanceof SourceFile&&(descendant=descendant.getDirectory(),ancestor===descendant))return!0;if(ancestor.#pathParts.length>=descendant.#pathParts.length)return!1;for(let i=ancestor.#pathParts.length-1;i>=0;i--)if(ancestor.#pathParts[i]!==descendant.#pathParts[i])return!1;return!0}};function getDirectoryCopyOptions(options){return options=common.ObjectUtils.clone(options||{}),setValueIfUndefined(options,"includeUntrackedFiles",!0),options}function isStandardizedFilePath(filePath){return typeof filePath=="string"}var DirectoryCoordinator=class{#fileSystemWrapper;#compilerFactory;constructor(compilerFactory,fileSystemWrapper){this.#compilerFactory=compilerFactory,this.#fileSystemWrapper=fileSystemWrapper}addDirectoryAtPathIfExists(dirPath,options){let directory=this.#compilerFactory.getDirectoryFromPath(dirPath,options);if(directory!=null){if(options.recursive)for(let descendantDirPath of common.FileUtils.getDescendantDirectories(this.#fileSystemWrapper,dirPath))this.#compilerFactory.createDirectoryOrAddIfExists(descendantDirPath,options);return directory}}addDirectoryAtPath(dirPath,options){let directory=this.addDirectoryAtPathIfExists(dirPath,options);if(directory==null)throw new common.errors.DirectoryNotFoundError(dirPath);return directory}createDirectoryOrAddIfExists(dirPath,options){return this.#compilerFactory.createDirectoryOrAddIfExists(dirPath,options)}addSourceFileAtPathIfExists(filePath,options){return this.#compilerFactory.addOrGetSourceFileFromFilePath(filePath,{markInProject:options.markInProject,scriptKind:void 0})}addSourceFileAtPath(filePath,options){let sourceFile=this.addSourceFileAtPathIfExists(filePath,options);if(sourceFile==null)throw new common.errors.FileNotFoundError(this.#fileSystemWrapper.getStandardizedAbsolutePath(filePath));return sourceFile}addSourceFilesAtPaths(fileGlobs,options){typeof fileGlobs=="string"&&(fileGlobs=[fileGlobs]);let sourceFiles=[],globbedDirectories=new Set;for(let filePath of this.#fileSystemWrapper.globSync(fileGlobs)){let sourceFile=this.addSourceFileAtPathIfExists(filePath,options);sourceFile!=null&&sourceFiles.push(sourceFile),globbedDirectories.add(common.FileUtils.getDirPath(filePath))}for(let dirPath of common.FileUtils.getParentMostPaths(Array.from(globbedDirectories)))this.addDirectoryAtPathIfExists(dirPath,{recursive:!0,markInProject:options.markInProject});return sourceFiles}},DirectoryCache=class{#context;#directoriesByPath=new common.KeyValueCache;#sourceFilesByDirPath=new common.KeyValueCache;#directoriesByDirPath=new common.KeyValueCache;#orphanDirs=new common.KeyValueCache;constructor(context){this.#context=context}has(dirPath){return this.#directoriesByPath.has(dirPath)}get(dirPath){if(!this.#directoriesByPath.has(dirPath)){for(let orphanDir of this.#orphanDirs.getValues())if(common.FileUtils.pathStartsWith(orphanDir.getPath(),dirPath))return this.createOrAddIfExists(dirPath);return}return this.#directoriesByPath.get(dirPath)}getOrphans(){return this.#orphanDirs.getValues()}getAll(){return this.#directoriesByPath.getValuesAsArray()}*getAllByDepth(){let dirLevels=new common.KeyValueCache,depth=0;for(let orphanDir of this.getOrphans())addToDirLevels(orphanDir);for(depth=Math.min(...Array.from(dirLevels.getKeys()));dirLevels.getSize()>0;){for(let dir of dirLevels.get(depth)||[])yield dir,dir.getDirectories().forEach(addToDirLevels);dirLevels.removeByKey(depth),depth++}function addToDirLevels(dir){let dirDepth=dir._getDepth();if(depth>dirDepth)throw new Error(`For some reason a subdirectory had a lower depth than the parent directory: ${dir.getPath()}`);dirLevels.getOrCreate(dirDepth,()=>[]).push(dir)}}remove(dirPath){this.#removeFromDirectoriesByDirPath(dirPath),this.#directoriesByPath.removeByKey(dirPath),this.#orphanDirs.removeByKey(dirPath)}*getChildDirectoriesOfDirectory(dirPath){let entries=this.#directoriesByDirPath.get(dirPath)?.entries();if(entries!=null)for(let dir of entries)yield dir}*getChildSourceFilesOfDirectory(dirPath){let entries=this.#sourceFilesByDirPath.get(dirPath)?.entries();if(entries!=null)for(let sourceFile of entries)yield sourceFile}addSourceFile(sourceFile){let dirPath=sourceFile.getDirectoryPath();this.createOrAddIfExists(dirPath),this.#sourceFilesByDirPath.getOrCreate(dirPath,()=>new common.SortedKeyValueArray(item=>item.getBaseName(),common.LocaleStringComparer.instance)).set(sourceFile)}removeSourceFile(filePath){let dirPath=common.FileUtils.getDirPath(filePath),sourceFiles=this.#sourceFilesByDirPath.get(dirPath);sourceFiles!=null&&(sourceFiles.removeByKey(common.FileUtils.getBaseName(filePath)),sourceFiles.hasItems()||this.#sourceFilesByDirPath.removeByKey(dirPath))}createOrAddIfExists(dirPath){return this.has(dirPath)?this.get(dirPath):(this.#fillParentsOfDirPath(dirPath),this.#createDirectory(dirPath))}#createDirectory(path){let newDirectory=new Directory(this.#context,path);return this.addDirectory(newDirectory),newDirectory}addDirectory(directory){let path=directory.getPath(),parentDirPath=common.FileUtils.getDirPath(path),isRootDir=parentDirPath===path;for(let orphanDir of this.#orphanDirs.getValues()){let orphanDirPath=orphanDir.getPath(),orphanDirParentPath=common.FileUtils.getDirPath(orphanDirPath);!(orphanDirParentPath===orphanDirPath)&&orphanDirParentPath===path&&this.#orphanDirs.removeByKey(orphanDirPath)}isRootDir||this.#addToDirectoriesByDirPath(directory),this.has(parentDirPath)||this.#orphanDirs.set(path,directory),this.#directoriesByPath.set(path,directory),this.#context.fileSystemWrapper.directoryExistsSync(path)||this.#context.fileSystemWrapper.queueMkdir(path);for(let orphanDir of this.#orphanDirs.getValues())directory.isAncestorOf(orphanDir)&&this.#fillParentsOfDirPath(orphanDir.getPath())}#addToDirectoriesByDirPath(directory){if(common.FileUtils.isRootDirPath(directory.getPath()))return;let parentDirPath=common.FileUtils.getDirPath(directory.getPath());this.#directoriesByDirPath.getOrCreate(parentDirPath,()=>new common.SortedKeyValueArray(item=>item.getBaseName(),common.LocaleStringComparer.instance)).set(directory)}#removeFromDirectoriesByDirPath(dirPath){if(common.FileUtils.isRootDirPath(dirPath))return;let parentDirPath=common.FileUtils.getDirPath(dirPath),directories=this.#directoriesByDirPath.get(parentDirPath);directories!=null&&(directories.removeByKey(common.FileUtils.getBaseName(dirPath)),directories.hasItems()||this.#directoriesByDirPath.removeByKey(parentDirPath))}#fillParentsOfDirPath(dirPath){let passedDirPaths=[],parentDir=common.FileUtils.getDirPath(dirPath);for(;dirPath!==parentDir;){if(dirPath=parentDir,parentDir=common.FileUtils.getDirPath(dirPath),this.#directoriesByPath.has(dirPath)){for(let currentDirPath of passedDirPaths)this.#createDirectory(currentDirPath);break}passedDirPaths.unshift(dirPath)}}},ForgetfulNodeCache=class extends common.KeyValueCache{#forgetStack=[];getOrCreate(key,createFunc){return super.getOrCreate(key,()=>{let node=createFunc();return this.#forgetStack.length>0&&this.#forgetStack[this.#forgetStack.length-1].add(node),node})}setForgetPoint(){this.#forgetStack.push(new Set)}forgetLastPoint(){let nodes=this.#forgetStack.pop();nodes!=null&&this.#forgetNodes(nodes.values())}rememberNode(node){if(node.wasForgotten())throw new common.errors.InvalidOperationError("Cannot remember a node that was removed or forgotten.");let wasInForgetStack=!1;for(let stackItem of this.#forgetStack)if(stackItem.delete(node)){wasInForgetStack=!0;break}return wasInForgetStack&&this.#rememberParentOfNode(node),wasInForgetStack}#rememberParentOfNode(node){let parent=node.getParentSyntaxList()||node.getParent();parent!=null&&this.rememberNode(parent)}#forgetNodes(nodes){for(let node of nodes)node.wasForgotten()||node.getKind()===common.SyntaxKind.SourceFile||node._forgetOnlyThis()}},kindToWrapperMappings={[common.SyntaxKind.SourceFile]:SourceFile,[common.SyntaxKind.ArrayBindingPattern]:ArrayBindingPattern,[common.SyntaxKind.ArrayLiteralExpression]:ArrayLiteralExpression,[common.SyntaxKind.ArrayType]:ArrayTypeNode,[common.SyntaxKind.ArrowFunction]:ArrowFunction,[common.SyntaxKind.AsExpression]:AsExpression,[common.SyntaxKind.AwaitExpression]:AwaitExpression,[common.SyntaxKind.BigIntLiteral]:BigIntLiteral,[common.SyntaxKind.BindingElement]:BindingElement,[common.SyntaxKind.BinaryExpression]:BinaryExpression,[common.SyntaxKind.Block]:Block,[common.SyntaxKind.BreakStatement]:BreakStatement,[common.SyntaxKind.CallExpression]:CallExpression,[common.SyntaxKind.CallSignature]:CallSignatureDeclaration,[common.SyntaxKind.CaseBlock]:CaseBlock,[common.SyntaxKind.CaseClause]:CaseClause,[common.SyntaxKind.CatchClause]:CatchClause,[common.SyntaxKind.ClassDeclaration]:ClassDeclaration,[common.SyntaxKind.ClassExpression]:ClassExpression,[common.SyntaxKind.ClassStaticBlockDeclaration]:ClassStaticBlockDeclaration,[common.SyntaxKind.ConditionalType]:ConditionalTypeNode,[common.SyntaxKind.Constructor]:ConstructorDeclaration,[common.SyntaxKind.ConstructorType]:ConstructorTypeNode,[common.SyntaxKind.ConstructSignature]:ConstructSignatureDeclaration,[common.SyntaxKind.ContinueStatement]:ContinueStatement,[common.SyntaxKind.CommaListExpression]:CommaListExpression,[common.SyntaxKind.ComputedPropertyName]:ComputedPropertyName,[common.SyntaxKind.ConditionalExpression]:ConditionalExpression,[common.SyntaxKind.DebuggerStatement]:DebuggerStatement,[common.SyntaxKind.Decorator]:Decorator,[common.SyntaxKind.DefaultClause]:DefaultClause,[common.SyntaxKind.DeleteExpression]:DeleteExpression,[common.SyntaxKind.DoStatement]:DoStatement,[common.SyntaxKind.ElementAccessExpression]:ElementAccessExpression,[common.SyntaxKind.EmptyStatement]:EmptyStatement,[common.SyntaxKind.EnumDeclaration]:EnumDeclaration,[common.SyntaxKind.EnumMember]:EnumMember,[common.SyntaxKind.ExportAssignment]:ExportAssignment,[common.SyntaxKind.ExportDeclaration]:ExportDeclaration,[common.SyntaxKind.ExportSpecifier]:ExportSpecifier,[common.SyntaxKind.ExpressionWithTypeArguments]:ExpressionWithTypeArguments,[common.SyntaxKind.ExpressionStatement]:ExpressionStatement,[common.SyntaxKind.ExternalModuleReference]:ExternalModuleReference,[common.SyntaxKind.QualifiedName]:QualifiedName,[common.SyntaxKind.ForInStatement]:ForInStatement,[common.SyntaxKind.ForOfStatement]:ForOfStatement,[common.SyntaxKind.ForStatement]:ForStatement,[common.SyntaxKind.FunctionDeclaration]:FunctionDeclaration,[common.SyntaxKind.FunctionExpression]:FunctionExpression,[common.SyntaxKind.FunctionType]:FunctionTypeNode,[common.SyntaxKind.GetAccessor]:GetAccessorDeclaration,[common.SyntaxKind.HeritageClause]:HeritageClause,[common.SyntaxKind.Identifier]:Identifier,[common.SyntaxKind.IfStatement]:IfStatement,[common.SyntaxKind.ImportClause]:ImportClause,[common.SyntaxKind.ImportDeclaration]:ImportDeclaration,[common.SyntaxKind.ImportEqualsDeclaration]:ImportEqualsDeclaration,[common.SyntaxKind.ImportSpecifier]:ImportSpecifier,[common.SyntaxKind.ImportType]:ImportTypeNode,[common.SyntaxKind.ImportAttribute]:ImportAttribute,[common.SyntaxKind.ImportAttributes]:ImportAttributes,[common.SyntaxKind.IndexedAccessType]:IndexedAccessTypeNode,[common.SyntaxKind.IndexSignature]:IndexSignatureDeclaration,[common.SyntaxKind.InferType]:InferTypeNode,[common.SyntaxKind.InterfaceDeclaration]:InterfaceDeclaration,[common.SyntaxKind.IntersectionType]:IntersectionTypeNode,[common.SyntaxKind.JSDocAllType]:JSDocAllType,[common.SyntaxKind.JSDocAugmentsTag]:JSDocAugmentsTag,[common.SyntaxKind.JSDocAuthorTag]:JSDocAuthorTag,[common.SyntaxKind.JSDocCallbackTag]:JSDocCallbackTag,[common.SyntaxKind.JSDocClassTag]:JSDocClassTag,[common.SyntaxKind.JSDocDeprecatedTag]:JSDocDeprecatedTag,[common.SyntaxKind.JSDocEnumTag]:JSDocEnumTag,[common.SyntaxKind.JSDocFunctionType]:JSDocFunctionType,[common.SyntaxKind.JSDocImplementsTag]:JSDocImplementsTag,[common.SyntaxKind.JSDocLink]:JSDocLink,[common.SyntaxKind.JSDocLinkCode]:JSDocLinkCode,[common.SyntaxKind.JSDocLinkPlain]:JSDocLinkPlain,[common.SyntaxKind.JSDocMemberName]:JSDocMemberName,[common.SyntaxKind.JSDocNamepathType]:JSDocNamepathType,[common.SyntaxKind.JSDocNameReference]:JSDocNameReference,[common.SyntaxKind.JSDocNonNullableType]:JSDocNonNullableType,[common.SyntaxKind.JSDocNullableType]:JSDocNullableType,[common.SyntaxKind.JSDocOptionalType]:JSDocOptionalType,[common.SyntaxKind.JSDocOverrideTag]:JSDocOverrideTag,[common.SyntaxKind.JSDocParameterTag]:JSDocParameterTag,[common.SyntaxKind.JSDocPrivateTag]:JSDocPrivateTag,[common.SyntaxKind.JSDocPropertyTag]:JSDocPropertyTag,[common.SyntaxKind.JSDocProtectedTag]:JSDocProtectedTag,[common.SyntaxKind.JSDocPublicTag]:JSDocPublicTag,[common.SyntaxKind.JSDocReturnTag]:JSDocReturnTag,[common.SyntaxKind.JSDocReadonlyTag]:JSDocReadonlyTag,[common.SyntaxKind.JSDocThrowsTag]:JSDocThrowsTag,[common.SyntaxKind.JSDocOverloadTag]:JSDocOverloadTag,[common.SyntaxKind.JSDocSatisfiesTag]:JSDocSatisfiesTag,[common.SyntaxKind.JSDocSeeTag]:JSDocSeeTag,[common.SyntaxKind.JSDocSignature]:JSDocSignature,[common.SyntaxKind.JSDocTag]:JSDocUnknownTag,[common.SyntaxKind.JSDocTemplateTag]:JSDocTemplateTag,[common.SyntaxKind.JSDocText]:JSDocText,[common.SyntaxKind.JSDocThisTag]:JSDocThisTag,[common.SyntaxKind.JSDocTypeExpression]:JSDocTypeExpression,[common.SyntaxKind.JSDocTypeLiteral]:JSDocTypeLiteral,[common.SyntaxKind.JSDocTypeTag]:JSDocTypeTag,[common.SyntaxKind.JSDocTypedefTag]:JSDocTypedefTag,[common.SyntaxKind.JSDocUnknownType]:JSDocUnknownType,[common.SyntaxKind.JSDocVariadicType]:JSDocVariadicType,[common.SyntaxKind.JsxAttribute]:JsxAttribute,[common.SyntaxKind.JsxClosingElement]:JsxClosingElement,[common.SyntaxKind.JsxClosingFragment]:JsxClosingFragment,[common.SyntaxKind.JsxElement]:JsxElement,[common.SyntaxKind.JsxExpression]:JsxExpression,[common.SyntaxKind.JsxFragment]:JsxFragment,[common.SyntaxKind.JsxNamespacedName]:JsxNamespacedName,[common.SyntaxKind.JsxOpeningElement]:JsxOpeningElement,[common.SyntaxKind.JsxOpeningFragment]:JsxOpeningFragment,[common.SyntaxKind.JsxSelfClosingElement]:JsxSelfClosingElement,[common.SyntaxKind.JsxSpreadAttribute]:JsxSpreadAttribute,[common.SyntaxKind.JsxText]:JsxText,[common.SyntaxKind.LabeledStatement]:LabeledStatement,[common.SyntaxKind.LiteralType]:LiteralTypeNode,[common.SyntaxKind.MappedType]:MappedTypeNode,[common.SyntaxKind.MetaProperty]:MetaProperty,[common.SyntaxKind.MethodDeclaration]:MethodDeclaration,[common.SyntaxKind.MethodSignature]:MethodSignature,[common.SyntaxKind.ModuleBlock]:ModuleBlock,[common.SyntaxKind.ModuleDeclaration]:ModuleDeclaration,[common.SyntaxKind.NamedExports]:NamedExports,[common.SyntaxKind.NamedImports]:NamedImports,[common.SyntaxKind.NamedTupleMember]:NamedTupleMember,[common.SyntaxKind.NamespaceExport]:NamespaceExport,[common.SyntaxKind.NamespaceImport]:NamespaceImport,[common.SyntaxKind.NewExpression]:NewExpression,[common.SyntaxKind.NonNullExpression]:NonNullExpression,[common.SyntaxKind.NotEmittedStatement]:NotEmittedStatement,[common.SyntaxKind.NoSubstitutionTemplateLiteral]:NoSubstitutionTemplateLiteral,[common.SyntaxKind.NumericLiteral]:NumericLiteral,[common.SyntaxKind.ObjectBindingPattern]:ObjectBindingPattern,[common.SyntaxKind.ObjectLiteralExpression]:ObjectLiteralExpression,[common.SyntaxKind.OmittedExpression]:OmittedExpression,[common.SyntaxKind.Parameter]:ParameterDeclaration,[common.SyntaxKind.ParenthesizedExpression]:ParenthesizedExpression,[common.SyntaxKind.ParenthesizedType]:ParenthesizedTypeNode,[common.SyntaxKind.PartiallyEmittedExpression]:PartiallyEmittedExpression,[common.SyntaxKind.PostfixUnaryExpression]:PostfixUnaryExpression,[common.SyntaxKind.PrefixUnaryExpression]:PrefixUnaryExpression,[common.SyntaxKind.PrivateIdentifier]:PrivateIdentifier,[common.SyntaxKind.PropertyAccessExpression]:PropertyAccessExpression,[common.SyntaxKind.PropertyAssignment]:PropertyAssignment,[common.SyntaxKind.PropertyDeclaration]:PropertyDeclaration,[common.SyntaxKind.PropertySignature]:PropertySignature,[common.SyntaxKind.RegularExpressionLiteral]:RegularExpressionLiteral,[common.SyntaxKind.RestType]:RestTypeNode,[common.SyntaxKind.ReturnStatement]:ReturnStatement,[common.SyntaxKind.SatisfiesExpression]:SatisfiesExpression,[common.SyntaxKind.SetAccessor]:SetAccessorDeclaration,[common.SyntaxKind.ShorthandPropertyAssignment]:ShorthandPropertyAssignment,[common.SyntaxKind.SpreadAssignment]:SpreadAssignment,[common.SyntaxKind.SpreadElement]:SpreadElement,[common.SyntaxKind.StringLiteral]:StringLiteral,[common.SyntaxKind.SwitchStatement]:SwitchStatement,[common.SyntaxKind.SyntaxList]:SyntaxList,[common.SyntaxKind.TaggedTemplateExpression]:TaggedTemplateExpression,[common.SyntaxKind.TemplateExpression]:TemplateExpression,[common.SyntaxKind.TemplateHead]:TemplateHead,[common.SyntaxKind.TemplateLiteralType]:TemplateLiteralTypeNode,[common.SyntaxKind.TemplateMiddle]:TemplateMiddle,[common.SyntaxKind.TemplateSpan]:TemplateSpan,[common.SyntaxKind.TemplateTail]:TemplateTail,[common.SyntaxKind.ThisType]:ThisTypeNode,[common.SyntaxKind.ThrowStatement]:ThrowStatement,[common.SyntaxKind.TryStatement]:TryStatement,[common.SyntaxKind.TupleType]:TupleTypeNode,[common.SyntaxKind.TypeAliasDeclaration]:TypeAliasDeclaration,[common.SyntaxKind.TypeAssertionExpression]:TypeAssertion,[common.SyntaxKind.TypeLiteral]:TypeLiteralNode,[common.SyntaxKind.TypeOperator]:TypeOperatorTypeNode,[common.SyntaxKind.TypeParameter]:TypeParameterDeclaration,[common.SyntaxKind.TypePredicate]:TypePredicateNode,[common.SyntaxKind.TypeQuery]:TypeQueryNode,[common.SyntaxKind.TypeReference]:TypeReferenceNode,[common.SyntaxKind.UnionType]:UnionTypeNode,[common.SyntaxKind.VariableDeclaration]:VariableDeclaration,[common.SyntaxKind.VariableDeclarationList]:VariableDeclarationList,[common.SyntaxKind.VariableStatement]:VariableStatement,[common.SyntaxKind.JSDoc]:JSDoc,[common.SyntaxKind.TypeOfExpression]:TypeOfExpression,[common.SyntaxKind.WhileStatement]:WhileStatement,[common.SyntaxKind.WithStatement]:WithStatement,[common.SyntaxKind.YieldExpression]:YieldExpression,[common.SyntaxKind.SemicolonToken]:Node,[common.SyntaxKind.AnyKeyword]:Expression,[common.SyntaxKind.BooleanKeyword]:Expression,[common.SyntaxKind.FalseKeyword]:FalseLiteral,[common.SyntaxKind.ImportKeyword]:ImportExpression,[common.SyntaxKind.InferKeyword]:Node,[common.SyntaxKind.NeverKeyword]:Node,[common.SyntaxKind.NullKeyword]:NullLiteral,[common.SyntaxKind.NumberKeyword]:Expression,[common.SyntaxKind.ObjectKeyword]:Expression,[common.SyntaxKind.StringKeyword]:Expression,[common.SyntaxKind.SymbolKeyword]:Expression,[common.SyntaxKind.SuperKeyword]:SuperExpression,[common.SyntaxKind.ThisKeyword]:ThisExpression,[common.SyntaxKind.TrueKeyword]:TrueLiteral,[common.SyntaxKind.UndefinedKeyword]:Expression,[common.SyntaxKind.VoidExpression]:VoidExpression},CompilerFactory=class{#context;#sourceFileCacheByFilePath=new Map;#diagnosticCache=new common.WeakCache;#definitionInfoCache=new common.WeakCache;#documentSpanCache=new common.WeakCache;#diagnosticMessageChainCache=new common.WeakCache;#jsDocTagInfoCache=new common.WeakCache;#signatureCache=new common.WeakCache;#symbolCache=new common.WeakCache;#symbolDisplayPartCache=new common.WeakCache;#referencedSymbolEntryCache=new common.WeakCache;#referencedSymbolCache=new common.WeakCache;#referencedSymbolDefinitionInfoCache=new common.WeakCache;#typeCache=new common.WeakCache;#typeParameterCache=new common.WeakCache;#nodeCache=new ForgetfulNodeCache;#directoryCache;#sourceFileAddedEventContainer=new common.EventContainer;#sourceFileRemovedEventContainer=new common.EventContainer;documentRegistry;constructor(context){this.documentRegistry=new common.DocumentRegistry(context.fileSystemWrapper),this.#directoryCache=new DirectoryCache(context),context.compilerOptions.onModified(()=>{let currentSourceFiles=Array.from(this.#sourceFileCacheByFilePath.values());for(let sourceFile of currentSourceFiles)replaceSourceFileForCacheUpdate(sourceFile)}),this.#context=context}*getSourceFilesByDirectoryDepth(){for(let dir of this.getDirectoriesByDepth())yield*dir.getSourceFiles()}getSourceFilePaths(){return this.#sourceFileCacheByFilePath.keys()}getChildDirectoriesOfDirectory(dirPath){return this.#directoryCache.getChildDirectoriesOfDirectory(dirPath)}getChildSourceFilesOfDirectory(dirPath){return this.#directoryCache.getChildSourceFilesOfDirectory(dirPath)}onSourceFileAdded(subscription,subscribe=!0){subscribe?this.#sourceFileAddedEventContainer.subscribe(subscription):this.#sourceFileAddedEventContainer.unsubscribe(subscription)}onSourceFileRemoved(subscription){this.#sourceFileRemovedEventContainer.subscribe(subscription)}createSourceFile(filePath,sourceFileText,options){if(sourceFileText=sourceFileText instanceof Function?getTextFromStringOrWriter(this.#context.createWriter(),sourceFileText):sourceFileText||"",typeof sourceFileText=="string")return this.createSourceFileFromText(filePath,sourceFileText,options);let writer=this.#context.createWriter();return this.#context.structurePrinterFactory.forSourceFile({isAmbient:common.FileUtils.getExtension(filePath)===".d.ts"}).printText(writer,sourceFileText),this.createSourceFileFromText(filePath,writer.toString(),options)}createSourceFileFromText(filePath,sourceText,options){return filePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePath),options.overwrite===!0?this.#createOrOverwriteSourceFileFromText(filePath,sourceText,options):(this.throwIfFileExists(filePath,"Did you mean to provide the overwrite option?"),this.#createSourceFileFromTextInternal(filePath,sourceText,options))}throwIfFileExists(filePath,prefixMessage){if(!(!this.containsSourceFileAtPath(filePath)&&!this.#context.fileSystemWrapper.fileExistsSync(filePath)))throw prefixMessage=prefixMessage==null?"":prefixMessage+" ",new common.errors.InvalidOperationError(`${prefixMessage}A source file already exists at the provided file path: ${filePath}`)}#createOrOverwriteSourceFileFromText(filePath,sourceText,options){filePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePath);let existingSourceFile=this.addOrGetSourceFileFromFilePath(filePath,options);return existingSourceFile!=null?(existingSourceFile.getChildren().forEach(c=>c.forget()),this.replaceCompilerNode(existingSourceFile,this.createCompilerSourceFileFromText(filePath,sourceText,options.scriptKind)),existingSourceFile):this.#createSourceFileFromTextInternal(filePath,sourceText,options)}getSourceFileFromCacheFromFilePath(filePath){return filePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePath),this.#sourceFileCacheByFilePath.get(filePath)}addOrGetSourceFileFromFilePath(filePath,options){filePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePath);let sourceFile=this.#sourceFileCacheByFilePath.get(filePath);if(sourceFile==null){let fileText=this.#context.fileSystemWrapper.readFileIfExistsSync(filePath,this.#context.getEncoding());fileText!=null&&(this.#context.logger.log(`Loaded file: ${filePath}`),sourceFile=this.#createSourceFileFromTextInternal(filePath,fileText,options),sourceFile._setIsSaved(!0))}return sourceFile!=null&&options.markInProject&&sourceFile._markAsInProject(),sourceFile}containsSourceFileAtPath(filePath){return filePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(filePath),this.#sourceFileCacheByFilePath.has(filePath)}containsDirectoryAtPath(dirPath){return dirPath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(dirPath),this.#directoryCache.has(dirPath)}getSourceFileForNode(compilerNode){let currentNode=compilerNode;for(;currentNode.kind!==common.SyntaxKind.SourceFile;){if(currentNode.parent==null)return;currentNode=currentNode.parent}return this.getSourceFile(currentNode,{markInProject:!1})}hasCompilerNode(compilerNode){return this.#nodeCache.has(compilerNode)}getExistingNodeFromCompilerNode(compilerNode){return this.#nodeCache.get(compilerNode)}getNodeFromCompilerNode(compilerNode,sourceFile){if(compilerNode.kind===common.SyntaxKind.SourceFile)return this.getSourceFile(compilerNode,{markInProject:!1});return this.#nodeCache.getOrCreate(compilerNode,()=>{let node=createNode.call(this);return initializeNode.call(this,node),node});function createNode(){if(isCommentNode(compilerNode))return CommentNodeParser.isCommentStatement(compilerNode)?new CommentStatement(this.#context,compilerNode,sourceFile):CommentNodeParser.isCommentClassElement(compilerNode)?new CommentClassElement(this.#context,compilerNode,sourceFile):CommentNodeParser.isCommentTypeElement(compilerNode)?new CommentTypeElement(this.#context,compilerNode,sourceFile):CommentNodeParser.isCommentObjectLiteralElement(compilerNode)?new CommentObjectLiteralElement(this.#context,compilerNode,sourceFile):CommentNodeParser.isCommentEnumMember(compilerNode)?new CommentEnumMember(this.#context,compilerNode,sourceFile):common.errors.throwNotImplementedForNeverValueError(compilerNode);let ctor=kindToWrapperMappings[compilerNode.kind]||Node;return new ctor(this.#context,compilerNode,sourceFile)}function isCommentNode(node){return node._commentKind!=null}function initializeNode(node){if(compilerNode.parent!=null){let parentNode=this.getNodeFromCompilerNode(compilerNode.parent,sourceFile);parentNode._wrappedChildCount++}let parentSyntaxList=node._getParentSyntaxListIfWrapped();if(parentSyntaxList!=null&&parentSyntaxList._wrappedChildCount++,compilerNode.kind===common.SyntaxKind.SyntaxList){let count=0;for(let _ of node._getChildrenInCacheIterator())count++;node._wrappedChildCount=count}}}#createSourceFileFromTextInternal(filePath,text,options){let hasBom=common.StringUtils.hasBom(text);hasBom&&(text=common.StringUtils.stripBom(text));let sourceFile=this.getSourceFile(this.createCompilerSourceFileFromText(filePath,text,options.scriptKind),options);return hasBom&&(sourceFile._hasBom=!0),sourceFile}createCompilerSourceFileFromText(filePath,text,scriptKind){return this.documentRegistry.createOrUpdateSourceFile(filePath,this.#context.compilerOptions.get(),common.ts.ScriptSnapshot.fromString(text),scriptKind)}getSourceFile(compilerSourceFile,options){let wasAdded=!1,sourceFile=this.#sourceFileCacheByFilePath.get(compilerSourceFile.fileName)??this.#nodeCache.getOrCreate(compilerSourceFile,()=>{let createdSourceFile=new SourceFile(this.#context,compilerSourceFile);return options.markInProject||this.#context.inProjectCoordinator.setSourceFileNotInProject(createdSourceFile),this.#addSourceFileToCache(createdSourceFile),wasAdded=!0,createdSourceFile});return options.markInProject&&sourceFile._markAsInProject(),wasAdded&&this.#sourceFileAddedEventContainer.fire(sourceFile),sourceFile}#addSourceFileToCache(sourceFile){this.#sourceFileCacheByFilePath.set(sourceFile.getFilePath(),sourceFile),this.#context.fileSystemWrapper.removeFileDelete(sourceFile.getFilePath()),this.#directoryCache.addSourceFile(sourceFile)}getDirectoryFromPath(dirPath,options){dirPath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(dirPath);let directory=this.#directoryCache.get(dirPath);return directory==null&&this.#context.fileSystemWrapper.directoryExistsSync(dirPath)&&(directory=this.#directoryCache.createOrAddIfExists(dirPath)),directory!=null&&options.markInProject&&directory._markAsInProject(),directory}createDirectoryOrAddIfExists(dirPath,options){let directory=this.#directoryCache.createOrAddIfExists(dirPath);return directory!=null&&options.markInProject&&directory._markAsInProject(),directory}getDirectoryFromCache(dirPath){return this.#directoryCache.get(dirPath)}getDirectoryFromCacheOnlyIfInCache(dirPath){return this.#directoryCache.has(dirPath)?this.#directoryCache.get(dirPath):void 0}getDirectoriesByDepth(){return this.#directoryCache.getAllByDepth()}getOrphanDirectories(){return this.#directoryCache.getOrphans()}getSymbolDisplayPart(compilerObject){return this.#symbolDisplayPartCache.getOrCreate(compilerObject,()=>new SymbolDisplayPart(compilerObject))}getType(type){return(type.flags&common.TypeFlags.TypeParameter)===common.TypeFlags.TypeParameter?this.getTypeParameter(type):this.#typeCache.getOrCreate(type,()=>new Type(this.#context,type))}getTypeParameter(typeParameter){return this.#typeParameterCache.getOrCreate(typeParameter,()=>new TypeParameter(this.#context,typeParameter))}getSignature(signature){return this.#signatureCache.getOrCreate(signature,()=>new Signature(this.#context,signature))}getSymbol(symbol){return this.#symbolCache.getOrCreate(symbol,()=>new Symbol2(this.#context,symbol))}getDefinitionInfo(compilerObject){return this.#definitionInfoCache.getOrCreate(compilerObject,()=>new DefinitionInfo(this.#context,compilerObject))}getDocumentSpan(compilerObject){return this.#documentSpanCache.getOrCreate(compilerObject,()=>new DocumentSpan(this.#context,compilerObject))}getReferencedSymbolEntry(compilerObject){return this.#referencedSymbolEntryCache.getOrCreate(compilerObject,()=>new ReferencedSymbolEntry(this.#context,compilerObject))}getReferencedSymbol(compilerObject){return this.#referencedSymbolCache.getOrCreate(compilerObject,()=>new ReferencedSymbol(this.#context,compilerObject))}getReferencedSymbolDefinitionInfo(compilerObject){return this.#referencedSymbolDefinitionInfoCache.getOrCreate(compilerObject,()=>new ReferencedSymbolDefinitionInfo(this.#context,compilerObject))}getDiagnostic(diagnostic){return this.#diagnosticCache.getOrCreate(diagnostic,()=>diagnostic.start!=null?new DiagnosticWithLocation(this.#context,diagnostic):new Diagnostic(this.#context,diagnostic))}getDiagnosticWithLocation(diagnostic){return this.#diagnosticCache.getOrCreate(diagnostic,()=>new DiagnosticWithLocation(this.#context,diagnostic))}getDiagnosticMessageChain(compilerObject){return this.#diagnosticMessageChainCache.getOrCreate(compilerObject,()=>new DiagnosticMessageChain(compilerObject))}getJSDocTagInfo(jsDocTagInfo){return this.#jsDocTagInfoCache.getOrCreate(jsDocTagInfo,()=>new JSDocTagInfo(jsDocTagInfo))}replaceCompilerNode(oldNode,newNode){let nodeToReplace=oldNode instanceof Node?oldNode.compilerNode:oldNode,node=oldNode instanceof Node?oldNode:this.#nodeCache.get(oldNode);if(nodeToReplace.kind===common.SyntaxKind.SourceFile&&nodeToReplace.fileName!==newNode.fileName){let sourceFile=node;this.#removeCompilerNodeFromCache(nodeToReplace),sourceFile._replaceCompilerNodeFromFactory(newNode),this.#nodeCache.set(newNode,sourceFile),this.#addSourceFileToCache(sourceFile),this.#sourceFileAddedEventContainer.fire(sourceFile)}else this.#nodeCache.replaceKey(nodeToReplace,newNode),node?._replaceCompilerNodeFromFactory(newNode)}removeNodeFromCache(node){this.#removeCompilerNodeFromCache(node.compilerNode)}#removeCompilerNodeFromCache(compilerNode){if(this.#nodeCache.removeByKey(compilerNode),compilerNode.kind===common.SyntaxKind.SourceFile){let sourceFile=compilerNode,standardizedFilePath=this.#context.fileSystemWrapper.getStandardizedAbsolutePath(sourceFile.fileName);this.#directoryCache.removeSourceFile(standardizedFilePath);let wrappedSourceFile=this.#sourceFileCacheByFilePath.get(standardizedFilePath);this.#sourceFileCacheByFilePath.delete(standardizedFilePath),this.documentRegistry.removeSourceFile(standardizedFilePath),wrappedSourceFile!=null&&this.#sourceFileRemovedEventContainer.fire(wrappedSourceFile)}}addDirectoryToCache(directory){this.#directoryCache.addDirectory(directory)}removeDirectoryFromCache(dirPath){this.#directoryCache.remove(dirPath)}forgetNodesCreatedInBlock(block){this.#nodeCache.setForgetPoint();let wasPromise=!1,result;try{if(result=block((...nodes)=>{for(let node of nodes)this.#nodeCache.rememberNode(node)}),Node.isNode(result)&&this.#nodeCache.rememberNode(result),isPromise(result))return wasPromise=!0,result.then(value=>(Node.isNode(value)&&this.#nodeCache.rememberNode(value),this.#nodeCache.forgetLastPoint(),value))}finally{wasPromise||this.#nodeCache.forgetLastPoint()}return result;function isPromise(value){return value!=null&&typeof value.then=="function"}}},InProjectCoordinator=class{#compilerFactory;#notInProjectFiles=new Set;constructor(compilerFactory){compilerFactory.onSourceFileRemoved(sourceFile=>{this.#notInProjectFiles.delete(sourceFile)}),this.#compilerFactory=compilerFactory}setSourceFileNotInProject(sourceFile){this.#notInProjectFiles.add(sourceFile),sourceFile._inProject=!1}markSourceFileAsInProject(sourceFile){this.isSourceFileInProject(sourceFile)||(this.#internalMarkSourceFileAsInProject(sourceFile),this.#notInProjectFiles.delete(sourceFile))}markSourceFilesAsInProjectForResolution(){let nodeModulesSearchName="/node_modules/",compilerFactory=this.#compilerFactory,changedSourceFiles=[],unchangedSourceFiles=[];for(let sourceFile of[...this.#notInProjectFiles.values()])shouldMarkInProject(sourceFile)?(this.#internalMarkSourceFileAsInProject(sourceFile),this.#notInProjectFiles.delete(sourceFile),changedSourceFiles.push(sourceFile)):unchangedSourceFiles.push(sourceFile);return{changedSourceFiles,unchangedSourceFiles};function shouldMarkInProject(sourceFile){let filePath=sourceFile.getFilePath(),index=filePath.toLowerCase().lastIndexOf(nodeModulesSearchName);if(index===-1)return!0;let nodeModulesPath=filePath.substring(0,index+nodeModulesSearchName.length-1),nodeModulesDir=compilerFactory.getDirectoryFromCacheOnlyIfInCache(nodeModulesPath);if(nodeModulesDir!=null&&nodeModulesDir._isInProject())return!0;let directory=sourceFile.getDirectory();for(;directory!=null&&directory.getPath()!==nodeModulesPath;){if(directory._isInProject())return!0;directory=compilerFactory.getDirectoryFromCacheOnlyIfInCache(common.FileUtils.getDirPath(directory.getPath()))}return!1}}#internalMarkSourceFileAsInProject(sourceFile){sourceFile._inProject=!0,this.markDirectoryAsInProject(sourceFile.getDirectory())}isSourceFileInProject(sourceFile){return sourceFile._inProject===!0}setDirectoryAndFilesAsNotInProjectForTesting(directory){for(let subDir of directory.getDirectories())this.setDirectoryAndFilesAsNotInProjectForTesting(subDir);for(let file of directory.getSourceFiles())delete file._inProject,this.#notInProjectFiles.add(file);delete directory._inProject}markDirectoryAsInProject(directory){if(this.isDirectoryInProject(directory))return;let inProjectCoordinator=this,compilerFactory=this.#compilerFactory;directory._inProject=!0,markAncestorDirs(directory);function markAncestorDirs(dir){let ancestorDirs=Array.from(getAncestorsUpToOneInProject(dir)),topAncestor=ancestorDirs[ancestorDirs.length-1];if(!(topAncestor==null||!inProjectCoordinator.isDirectoryInProject(topAncestor)))for(let ancestorDir of ancestorDirs)ancestorDir._inProject=!0}function*getAncestorsUpToOneInProject(dir){if(common.FileUtils.isRootDirPath(dir.getPath()))return;let parentDirPath=common.FileUtils.getDirPath(dir.getPath()),parentDir=compilerFactory.getDirectoryFromCacheOnlyIfInCache(parentDirPath);parentDir!=null&&(yield parentDir,inProjectCoordinator.isDirectoryInProject(parentDir)||(yield*getAncestorsUpToOneInProject(parentDir)))}}isDirectoryInProject(directory){return directory._inProject===!0}},StructurePrinterFactory=class{_getFormatCodeSettings;constructor(_getFormatCodeSettings){this._getFormatCodeSettings=_getFormatCodeSettings}getFormatCodeSettings(){return this._getFormatCodeSettings()}forInitializerExpressionableNode(){return new InitializerExpressionableNodeStructurePrinter}forModifierableNode(){return new ModifierableNodeStructurePrinter}forReturnTypedNode(alwaysWrite){return new ReturnTypedNodeStructurePrinter(alwaysWrite)}forTypedNode(separator,alwaysWrite){return new TypedNodeStructurePrinter(separator,alwaysWrite)}forClassDeclaration(options){return new ClassDeclarationStructurePrinter(this,options)}forClassMember(options){return new ClassMemberStructurePrinter(this,options)}forClassStaticBlockDeclaration(){return new ClassStaticBlockDeclarationStructurePrinter(this)}forConstructorDeclaration(options){return new ConstructorDeclarationStructurePrinter(this,options)}forGetAccessorDeclaration(options){return new GetAccessorDeclarationStructurePrinter(this,options)}forMethodDeclaration(options){return new MethodDeclarationStructurePrinter(this,options)}forPropertyDeclaration(){return new PropertyDeclarationStructurePrinter(this)}forSetAccessorDeclaration(options){return new SetAccessorDeclarationStructurePrinter(this,options)}forDecorator(){return new DecoratorStructurePrinter(this)}forJSDoc(){return new JSDocStructurePrinter(this)}forJSDocTag(options){return new JSDocTagStructurePrinter(this,options)}forEnumDeclaration(){return new EnumDeclarationStructurePrinter(this)}forEnumMember(){return new EnumMemberStructurePrinter(this)}forObjectLiteralExpressionProperty(){return new ObjectLiteralExpressionPropertyStructurePrinter(this)}forPropertyAssignment(){return new PropertyAssignmentStructurePrinter(this)}forShorthandPropertyAssignment(){return new ShorthandPropertyAssignmentStructurePrinter(this)}forSpreadAssignment(){return new SpreadAssignmentStructurePrinter(this)}forFunctionDeclaration(options){return new FunctionDeclarationStructurePrinter(this,options)}forParameterDeclaration(){return new ParameterDeclarationStructurePrinter(this)}forCallSignatureDeclaration(){return new CallSignatureDeclarationStructurePrinter(this)}forConstructSignatureDeclaration(){return new ConstructSignatureDeclarationStructurePrinter(this)}forIndexSignatureDeclaration(){return new IndexSignatureDeclarationStructurePrinter(this)}forInterfaceDeclaration(){return new InterfaceDeclarationStructurePrinter(this)}forMethodSignature(){return new MethodSignatureStructurePrinter(this)}forPropertySignature(){return new PropertySignatureStructurePrinter(this)}forTypeElementMemberedNode(){return new TypeElementMemberedNodeStructurePrinter(this)}forTypeElementMember(){return new TypeElementMemberStructurePrinter(this)}forJsxAttributeDecider(){return new JsxAttributeDeciderStructurePrinter(this)}forJsxAttribute(){return new JsxAttributeStructurePrinter(this)}forJsxChildDecider(){return new JsxChildDeciderStructurePrinter(this)}forJsxElement(){return new JsxElementStructurePrinter(this)}forJsxNamespacedName(){return new JsxNamespacedNameStructurePrinter(this)}forJsxSelfClosingElement(){return new JsxSelfClosingElementStructurePrinter(this)}forJsxSpreadAttribute(){return new JsxSpreadAttributeStructurePrinter(this)}forExportAssignment(){return new ExportAssignmentStructurePrinter(this)}forExportDeclaration(){return new ExportDeclarationStructurePrinter(this)}forImportAttribute(){return new ImportAttributeStructurePrinter(this)}forImportDeclaration(){return new ImportDeclarationStructurePrinter(this)}forModuleDeclaration(options){return new ModuleDeclarationStructurePrinter(this,options)}forNamedImportExportSpecifier(){return new NamedImportExportSpecifierStructurePrinter(this)}forSourceFile(options){return new SourceFileStructurePrinter(this,options)}forStatementedNode(options){return new StatementedNodeStructurePrinter(this,options)}forStatement(options){return new StatementStructurePrinter(this,options)}forVariableStatement(){return new VariableStatementStructurePrinter(this)}forTypeAliasDeclaration(){return new TypeAliasDeclarationStructurePrinter(this)}forTypeParameterDeclaration(){return new TypeParameterDeclarationStructurePrinter(this)}forVariableDeclaration(){return new VariableDeclarationStructurePrinter(this)}};__decorate([common.Memoize],StructurePrinterFactory.prototype,"forInitializerExpressionableNode",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forModifierableNode",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forReturnTypedNode",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forTypedNode",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forClassDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forClassMember",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forClassStaticBlockDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forConstructorDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forGetAccessorDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forMethodDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forPropertyDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forSetAccessorDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forDecorator",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJSDoc",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJSDocTag",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forEnumDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forEnumMember",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forObjectLiteralExpressionProperty",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forPropertyAssignment",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forShorthandPropertyAssignment",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forSpreadAssignment",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forFunctionDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forParameterDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forCallSignatureDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forConstructSignatureDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forIndexSignatureDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forInterfaceDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forMethodSignature",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forPropertySignature",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forTypeElementMemberedNode",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forTypeElementMember",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJsxAttributeDecider",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJsxAttribute",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJsxChildDecider",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJsxElement",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJsxNamespacedName",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJsxSelfClosingElement",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forJsxSpreadAttribute",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forExportAssignment",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forExportDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forImportAttribute",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forImportDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forModuleDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forNamedImportExportSpecifier",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forSourceFile",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forStatementedNode",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forStatement",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forVariableStatement",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forTypeAliasDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forTypeParameterDeclaration",null);__decorate([common.Memoize],StructurePrinterFactory.prototype,"forVariableDeclaration",null);var ProjectContext=class{#languageService;#compilerOptions;#customTypeChecker;#project;get project(){if(this.#project==null)throw new common.errors.InvalidOperationError("This operation is not permitted in this context.");return this.#project}logger=new ConsoleLogger;lazyReferenceCoordinator;directoryCoordinator;fileSystemWrapper;manipulationSettings=new ManipulationSettingsContainer;structurePrinterFactory;compilerFactory;inProjectCoordinator;constructor(params){this.#project=params.project,this.fileSystemWrapper=params.fileSystemWrapper,this.#compilerOptions=params.compilerOptionsContainer,this.compilerFactory=new CompilerFactory(this),this.inProjectCoordinator=new InProjectCoordinator(this.compilerFactory),this.structurePrinterFactory=new StructurePrinterFactory(()=>this.manipulationSettings.getFormatCodeSettings()),this.lazyReferenceCoordinator=new LazyReferenceCoordinator(this.compilerFactory),this.directoryCoordinator=new DirectoryCoordinator(this.compilerFactory,params.fileSystemWrapper),this.#languageService=params.createLanguageService?new LanguageService({context:this,configFileParsingDiagnostics:params.configFileParsingDiagnostics,resolutionHost:params.resolutionHost&¶ms.resolutionHost(this.getModuleResolutionHost(),()=>this.compilerOptions.get()),skipLoadingLibFiles:params.skipLoadingLibFiles,libFolderPath:params.libFolderPath}):void 0,params.typeChecker!=null&&(common.errors.throwIfTrue(params.createLanguageService,"Cannot specify a type checker and create a language service."),this.#customTypeChecker=new TypeChecker(this),this.#customTypeChecker._reset(()=>params.typeChecker))}get compilerOptions(){return this.#compilerOptions}get languageService(){if(this.#languageService==null)throw this.#getToolRequiredError("language service");return this.#languageService}get program(){if(this.#languageService==null)throw this.#getToolRequiredError("program");return this.languageService.getProgram()}get typeChecker(){if(this.#customTypeChecker!=null)return this.#customTypeChecker;if(this.#languageService==null)throw this.#getToolRequiredError("type checker");return this.program.getTypeChecker()}hasLanguageService(){return this.#languageService!=null}getEncoding(){return this.compilerOptions.getEncoding()}getFormatCodeSettings(){return this.manipulationSettings.getFormatCodeSettings()}getUserPreferences(){return this.manipulationSettings.getUserPreferences()}resetProgram(){this.languageService._reset()}createWriter(){let indentationText=this.manipulationSettings.getIndentationText();return new CodeBlockWriter__default.default({newLine:this.manipulationSettings.getNewLineKindAsString(),indentNumberOfSpaces:indentationText===exports.IndentationText.Tab?void 0:indentationText.length,useTabs:indentationText===exports.IndentationText.Tab,useSingleQuote:this.manipulationSettings.getQuoteKind()===exports.QuoteKind.Single})}getPreEmitDiagnostics(sourceFile){return common.ts.getPreEmitDiagnostics(this.program.compilerObject,sourceFile?.compilerNode).map(d=>this.compilerFactory.getDiagnostic(d))}getSourceFileContainer(){return{addOrGetSourceFileFromFilePath:(filePath,opts)=>Promise.resolve(this.compilerFactory.addOrGetSourceFileFromFilePath(filePath,opts)?.compilerNode),addOrGetSourceFileFromFilePathSync:(filePath,opts)=>this.compilerFactory.addOrGetSourceFileFromFilePath(filePath,opts)?.compilerNode,containsDirectoryAtPath:dirPath=>this.compilerFactory.containsDirectoryAtPath(dirPath),containsSourceFileAtPath:filePath=>this.compilerFactory.containsSourceFileAtPath(filePath),getSourceFileFromCacheFromFilePath:filePath=>this.compilerFactory.getSourceFileFromCacheFromFilePath(filePath)?.compilerNode,getSourceFilePaths:()=>this.compilerFactory.getSourceFilePaths(),getSourceFileVersion:sourceFile=>this.compilerFactory.documentRegistry.getSourceFileVersion(sourceFile),getChildDirectoriesOfDirectory:dirPath=>{let result=[];for(let dir of this.compilerFactory.getChildDirectoriesOfDirectory(dirPath))result.push(dir.getPath());return result}}}getModuleResolutionHost(){return common.createModuleResolutionHost({transactionalFileSystem:this.fileSystemWrapper,getEncoding:()=>this.getEncoding(),sourceFileContainer:this.getSourceFileContainer()})}#getToolRequiredError(name){return new common.errors.InvalidOperationError(`A ${name} 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 ${name} should be required for this operation.`)}};__decorate([common.Memoize],ProjectContext.prototype,"getSourceFileContainer",null);__decorate([common.Memoize],ProjectContext.prototype,"getModuleResolutionHost",null);var Project2=class{_context;constructor(options={}){verifyOptions();let fileSystem=getFileSystem(),fileSystemWrapper=new common.TransactionalFileSystem({fileSystem,skipLoadingLibFiles:options.skipLoadingLibFiles,libFolderPath:options.libFolderPath}),tsConfigResolver=options.tsConfigFilePath==null?void 0:new common.TsConfigResolver(fileSystemWrapper,fileSystemWrapper.getStandardizedAbsolutePath(options.tsConfigFilePath),getEncoding()),compilerOptions=getCompilerOptions(),compilerOptionsContainer=new common.CompilerOptionsContainer(options.defaultCompilerOptions);compilerOptionsContainer.set(compilerOptions),this._context=new ProjectContext({project:this,compilerOptionsContainer,fileSystemWrapper,createLanguageService:!0,resolutionHost:options.resolutionHost,configFileParsingDiagnostics:tsConfigResolver?.getErrors()??[],skipLoadingLibFiles:options.skipLoadingLibFiles,libFolderPath:options.libFolderPath}),options.manipulationSettings!=null&&this._context.manipulationSettings.set(options.manipulationSettings),tsConfigResolver!=null&&options.skipAddingFilesFromTsConfig!==!0&&(this.#addSourceFilesForTsConfigResolver(tsConfigResolver,compilerOptions),options.skipFileDependencyResolution||this.resolveSourceFileDependencies());function verifyOptions(){if(options.fileSystem!=null&&options.useInMemoryFileSystem)throw new common.errors.InvalidOperationError("Cannot provide a file system when specifying to use an in-memory file system.")}function getFileSystem(){return options.useInMemoryFileSystem?new common.InMemoryFileSystemHost:options.fileSystem??new common.RealFileSystemHost}function getCompilerOptions(){return{...getTsConfigCompilerOptions(),...options.compilerOptions??{}}}function getTsConfigCompilerOptions(){return tsConfigResolver?.getCompilerOptions()??{}}function getEncoding(){let defaultEncoding="utf-8";return options.compilerOptions!=null?options.compilerOptions.charset??defaultEncoding:defaultEncoding}}get manipulationSettings(){return this._context.manipulationSettings}get compilerOptions(){return this._context.compilerOptions}resolveSourceFileDependencies(){let sourceFiles=new Set,onSourceFileAdded=sourceFile=>sourceFiles.add(sourceFile),{compilerFactory,inProjectCoordinator}=this._context;compilerFactory.onSourceFileAdded(onSourceFileAdded);try{this.getProgram().compilerObject}finally{compilerFactory.onSourceFileAdded(onSourceFileAdded,!1)}let result=inProjectCoordinator.markSourceFilesAsInProjectForResolution();for(let sourceFile of result.changedSourceFiles)sourceFiles.add(sourceFile);for(let sourceFile of result.unchangedSourceFiles)sourceFiles.delete(sourceFile);return Array.from(sourceFiles.values())}addDirectoryAtPathIfExists(dirPath,options={}){return this._context.directoryCoordinator.addDirectoryAtPathIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(dirPath),{...options,markInProject:!0})}addDirectoryAtPath(dirPath,options={}){return this._context.directoryCoordinator.addDirectoryAtPath(this._context.fileSystemWrapper.getStandardizedAbsolutePath(dirPath),{...options,markInProject:!0})}createDirectory(dirPath){return this._context.directoryCoordinator.createDirectoryOrAddIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(dirPath),{markInProject:!0})}getDirectoryOrThrow(dirPath,message){return common.errors.throwIfNullOrUndefined(this.getDirectory(dirPath),message??(()=>`Could not find a directory at the specified path: ${this._context.fileSystemWrapper.getStandardizedAbsolutePath(dirPath)}`))}getDirectory(dirPath){let{compilerFactory}=this._context;return compilerFactory.getDirectoryFromCache(this._context.fileSystemWrapper.getStandardizedAbsolutePath(dirPath))}getDirectories(){return Array.from(this.#getProjectDirectoriesByDirectoryDepth())}getRootDirectories(){let{inProjectCoordinator}=this._context,result=[];for(let dir of this._context.compilerFactory.getOrphanDirectories())for(let inProjectDir of findInProjectDirectories(dir))result.push(inProjectDir);return result;function*findInProjectDirectories(dir){if(inProjectCoordinator.isDirectoryInProject(dir)){yield dir;return}for(let childDir of dir._getDirectoriesIterator())yield*findInProjectDirectories(childDir)}}addSourceFilesAtPaths(fileGlobs){return this._context.directoryCoordinator.addSourceFilesAtPaths(fileGlobs,{markInProject:!0})}addSourceFileAtPathIfExists(filePath){return this._context.directoryCoordinator.addSourceFileAtPathIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(filePath),{markInProject:!0})}addSourceFileAtPath(filePath){return this._context.directoryCoordinator.addSourceFileAtPath(this._context.fileSystemWrapper.getStandardizedAbsolutePath(filePath),{markInProject:!0})}addSourceFilesFromTsConfig(tsConfigFilePath){let resolver=new common.TsConfigResolver(this._context.fileSystemWrapper,this._context.fileSystemWrapper.getStandardizedAbsolutePath(tsConfigFilePath),this._context.getEncoding());return this.#addSourceFilesForTsConfigResolver(resolver,resolver.getCompilerOptions())}#addSourceFilesForTsConfigResolver(tsConfigResolver,compilerOptions){let paths=tsConfigResolver.getPaths(compilerOptions),addedSourceFiles=paths.filePaths.map(p=>this.addSourceFileAtPath(p));for(let dirPath of paths.directoryPaths)this.addDirectoryAtPathIfExists(dirPath);return addedSourceFiles}createSourceFile(filePath,sourceFileText,options){return this._context.compilerFactory.createSourceFile(this._context.fileSystemWrapper.getStandardizedAbsolutePath(filePath),sourceFileText??"",{...options??{},markInProject:!0})}removeSourceFile(sourceFile){let previouslyForgotten=sourceFile.wasForgotten();return sourceFile.forget(),!previouslyForgotten}getSourceFileOrThrow(fileNameOrSearchFunction){let sourceFile=this.getSourceFile(fileNameOrSearchFunction);if(sourceFile!=null)return sourceFile;if(typeof fileNameOrSearchFunction=="string"){let fileNameOrPath=common.FileUtils.standardizeSlashes(fileNameOrSearchFunction);if(common.FileUtils.pathIsAbsolute(fileNameOrPath)||fileNameOrPath.indexOf("/")>=0){let errorFileNameOrPath=this._context.fileSystemWrapper.getStandardizedAbsolutePath(fileNameOrPath);throw new common.errors.InvalidOperationError(`Could not find source file in project at the provided path: ${errorFileNameOrPath}`)}else throw new common.errors.InvalidOperationError(`Could not find source file in project with the provided file name: ${fileNameOrSearchFunction}`)}else throw new common.errors.InvalidOperationError("Could not find source file in project based on the provided condition.")}getSourceFile(fileNameOrSearchFunction){let filePathOrSearchFunction=getFilePathOrSearchFunction(this._context.fileSystemWrapper);if(isStandardizedFilePath2(filePathOrSearchFunction))return this._context.compilerFactory.getSourceFileFromCacheFromFilePath(filePathOrSearchFunction);return common.IterableUtils.find(this.#getProjectSourceFilesByDirectoryDepth(),filePathOrSearchFunction);function getFilePathOrSearchFunction(fileSystemWrapper){if(fileNameOrSearchFunction instanceof Function)return fileNameOrSearchFunction;let fileNameOrPath=common.FileUtils.standardizeSlashes(fileNameOrSearchFunction);return common.FileUtils.pathIsAbsolute(fileNameOrPath)||fileNameOrPath.indexOf("/")>=0?fileSystemWrapper.getStandardizedAbsolutePath(fileNameOrPath):def=>common.FileUtils.pathEndsWith(def.getFilePath(),fileNameOrPath)}function isStandardizedFilePath2(obj){return typeof obj=="string"}}getSourceFiles(globPatterns){let{compilerFactory,fileSystemWrapper}=this._context,sourceFiles=this.#getProjectSourceFilesByDirectoryDepth();if(typeof globPatterns=="string"||globPatterns instanceof Array)return Array.from(getFilteredSourceFiles());return Array.from(sourceFiles);function*getFilteredSourceFiles(){let sourceFilePaths=Array.from(getSourceFilePaths()),matchedPaths=common.matchGlobs(sourceFilePaths,globPatterns,fileSystemWrapper.getCurrentDirectory());for(let matchedPath of matchedPaths)yield compilerFactory.getSourceFileFromCacheFromFilePath(fileSystemWrapper.getStandardizedAbsolutePath(matchedPath));function*getSourceFilePaths(){for(let sourceFile of sourceFiles)yield sourceFile.getFilePath()}}}*#getProjectSourceFilesByDirectoryDepth(){let{compilerFactory,inProjectCoordinator}=this._context;for(let sourceFile of compilerFactory.getSourceFilesByDirectoryDepth())inProjectCoordinator.isSourceFileInProject(sourceFile)&&(yield sourceFile)}*#getProjectDirectoriesByDirectoryDepth(){let{compilerFactory,inProjectCoordinator}=this._context;for(let directory of compilerFactory.getDirectoriesByDepth())inProjectCoordinator.isDirectoryInProject(directory)&&(yield directory)}getAmbientModule(moduleName){return moduleName=normalizeAmbientModuleName(moduleName),this.getAmbientModules().find(s=>s.getName()===moduleName)}getAmbientModuleOrThrow(moduleName,message){return common.errors.throwIfNullOrUndefined(this.getAmbientModule(moduleName),message??(()=>`Could not find ambient module with name: ${normalizeAmbientModuleName(moduleName)}`))}getAmbientModules(){return this.getTypeChecker().getAmbientModules()}async save(){await this._context.fileSystemWrapper.flush(),await Promise.all(this.#getUnsavedSourceFiles().map(f=>f.save()))}saveSync(){this._context.fileSystemWrapper.flushSync();for(let file of this.#getUnsavedSourceFiles())file.saveSync()}enableLogging(enabled=!0){this._context.logger.setEnabled(enabled)}#getUnsavedSourceFiles(){return Array.from(getUnsavedIterator(this._context.compilerFactory.getSourceFilesByDirectoryDepth()));function*getUnsavedIterator(sourceFiles){for(let sourceFile of sourceFiles)sourceFile.isSaved()||(yield sourceFile)}}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(emitOptions={}){return this._context.program.emit(emitOptions)}emitSync(emitOptions={}){return this._context.program.emitSync(emitOptions)}emitToMemory(emitOptions={}){return this._context.program.emitToMemory(emitOptions)}getCompilerOptions(){return this._context.compilerOptions.get()}getConfigFileParsingDiagnostics(){return this.getProgram().getConfigFileParsingDiagnostics()}createWriter(){return this._context.createWriter()}forgetNodesCreatedInBlock(block){return this._context.compilerFactory.forgetNodesCreatedInBlock(block)}formatDiagnosticsWithColorAndContext(diagnostics,opts={}){return common.ts.formatDiagnosticsWithColorAndContext(diagnostics.map(d=>d.compilerObject),{getCurrentDirectory:()=>this._context.fileSystemWrapper.getCurrentDirectory(),getCanonicalFileName:fileName=>fileName,getNewLine:()=>opts.newLineChar??common.runtime.getEndOfLine()})}getModuleResolutionHost(){return this._context.getModuleResolutionHost()}};function normalizeAmbientModuleName(moduleName){return isQuote(moduleName[0])&&isQuote(moduleName[moduleName.length-1])&&(moduleName=moduleName.substring(1,moduleName.length-1)),`"${moduleName}"`;function isQuote(char){return char==='"'||char==="'"}}function createWrappedNode(node,opts={}){let{compilerOptions={},sourceFile,typeChecker}=opts,compilerOptionsContainer=new common.CompilerOptionsContainer;compilerOptionsContainer.set(compilerOptions);let projectContext=new ProjectContext({project:void 0,fileSystemWrapper:new common.TransactionalFileSystem({fileSystem:new common.RealFileSystemHost,skipLoadingLibFiles:!0,libFolderPath:void 0}),compilerOptionsContainer,createLanguageService:!1,typeChecker,configFileParsingDiagnostics:[],skipLoadingLibFiles:!0,libFolderPath:void 0}),wrappedSourceFile=projectContext.compilerFactory.getSourceFile(getSourceFileNode(),{markInProject:!0});return projectContext.compilerFactory.getNodeFromCompilerNode(node,wrappedSourceFile);function getSourceFileNode(){return sourceFile??getSourceFileFromNode(node)}function getSourceFileFromNode(compilerNode){if(compilerNode.kind===common.SyntaxKind.SourceFile)return compilerNode;if(compilerNode.parent==null)throw new common.errors.InvalidOperationError("Please ensure the node was created from a source file with 'setParentNodes' set to 'true'.");let parent=compilerNode;for(;parent.parent!=null;)parent=parent.parent;if(parent.kind!==common.SyntaxKind.SourceFile)throw new common.errors.NotImplementedError("For some reason the top parent was not a source file.");return parent}}var structurePrinterFactory=new StructurePrinterFactory(()=>{throw new common.errors.NotImplementedError("Not implemented scenario for getting code format settings when using a writer function. Please open an issue.")}),Writers=class{constructor(){}static object(obj){return writer=>{let keyNames=Object.keys(obj);writer.write("{"),keyNames.length>0&&writer.indent(()=>{writeObject()}),writer.write("}");function writeObject(){for(let i=0;i0&&writer.write(",").newLine();let keyName=keyNames[i],value=obj[keyName];writer.write(keyName),value!=null&&(writer.write(": "),writeValue(writer,value))}writer.newLine()}}}static objectType(structure){return writer=>{writer.write("{"),anyPropertyHasValue(structure)&&writer.indent(()=>{structurePrinterFactory.forTypeElementMemberedNode().printText(writer,structure)}),writer.write("}")}}static unionType(firstType,secondType,...additionalTypes){return getWriteFunctionForUnionOrIntersectionType("|",[firstType,secondType,...additionalTypes])}static intersectionType(firstType,secondType,...additionalTypes){return getWriteFunctionForUnionOrIntersectionType("&",[firstType,secondType,...additionalTypes])}static assertion(type,assertionType){return writer=>{writeValue(writer,type),writer.spaceIfLastNot().write("as "),writeValue(writer,assertionType)}}static returnStatement(value){return writer=>{writer.write("return "),writer.hangingIndentUnlessBlock(()=>{writeValue(writer,value),writer.write(";")})}}};function getWriteFunctionForUnionOrIntersectionType(separator,args){return writer=>{writeSeparatedByString(writer,` ${separator} `,args)}}function anyPropertyHasValue(obj){for(let key of Object.keys(obj))if(obj[key]!=null&&!(obj[key]instanceof Array&&obj[key].length===0))return!0;return!1}function writeSeparatedByString(writer,separator,values){for(let i=0;i0,separator),writeValue(writer,values[i])}function writeValue(writer,value){value instanceof Function?value(writer):writer.write(value.toString())}var{InvalidOperationError,FileNotFoundError,ArgumentError,ArgumentNullOrWhitespaceError,ArgumentOutOfRangeError,ArgumentTypeError,BaseError,DirectoryNotFoundError,NotImplementedError,NotSupportedError,PathNotFoundError}=common.errors;Object.defineProperty(exports,"CompilerOptionsContainer",{enumerable:!0,get:function(){return common.CompilerOptionsContainer}});Object.defineProperty(exports,"DiagnosticCategory",{enumerable:!0,get:function(){return common.DiagnosticCategory}});Object.defineProperty(exports,"EmitHint",{enumerable:!0,get:function(){return common.EmitHint}});Object.defineProperty(exports,"InMemoryFileSystemHost",{enumerable:!0,get:function(){return common.InMemoryFileSystemHost}});Object.defineProperty(exports,"LanguageVariant",{enumerable:!0,get:function(){return common.LanguageVariant}});Object.defineProperty(exports,"ModuleKind",{enumerable:!0,get:function(){return common.ModuleKind}});Object.defineProperty(exports,"ModuleResolutionKind",{enumerable:!0,get:function(){return common.ModuleResolutionKind}});Object.defineProperty(exports,"NewLineKind",{enumerable:!0,get:function(){return common.NewLineKind}});Object.defineProperty(exports,"NodeFlags",{enumerable:!0,get:function(){return common.NodeFlags}});Object.defineProperty(exports,"ObjectFlags",{enumerable:!0,get:function(){return common.ObjectFlags}});Object.defineProperty(exports,"ResolutionHosts",{enumerable:!0,get:function(){return common.ResolutionHosts}});Object.defineProperty(exports,"ScriptKind",{enumerable:!0,get:function(){return common.ScriptKind}});Object.defineProperty(exports,"ScriptTarget",{enumerable:!0,get:function(){return common.ScriptTarget}});Object.defineProperty(exports,"SettingsContainer",{enumerable:!0,get:function(){return common.SettingsContainer}});Object.defineProperty(exports,"SymbolFlags",{enumerable:!0,get:function(){return common.SymbolFlags}});Object.defineProperty(exports,"SyntaxKind",{enumerable:!0,get:function(){return common.SyntaxKind}});Object.defineProperty(exports,"TypeFlags",{enumerable:!0,get:function(){return common.TypeFlags}});Object.defineProperty(exports,"TypeFormatFlags",{enumerable:!0,get:function(){return common.TypeFormatFlags}});Object.defineProperty(exports,"ts",{enumerable:!0,get:function(){return common.ts}});Object.defineProperty(exports,"CodeBlockWriter",{enumerable:!0,get:function(){return CodeBlockWriter__default.default}});exports.AbstractableNode=AbstractableNode;exports.AmbientableNode=AmbientableNode;exports.ArgumentError=ArgumentError;exports.ArgumentNullOrWhitespaceError=ArgumentNullOrWhitespaceError;exports.ArgumentOutOfRangeError=ArgumentOutOfRangeError;exports.ArgumentTypeError=ArgumentTypeError;exports.ArgumentedNode=ArgumentedNode;exports.ArrayBindingPattern=ArrayBindingPattern;exports.ArrayDestructuringAssignment=ArrayDestructuringAssignment;exports.ArrayDestructuringAssignmentBase=ArrayDestructuringAssignmentBase;exports.ArrayLiteralExpression=ArrayLiteralExpression;exports.ArrayTypeNode=ArrayTypeNode;exports.ArrowFunction=ArrowFunction;exports.ArrowFunctionBase=ArrowFunctionBase;exports.AsExpression=AsExpression;exports.AsExpressionBase=AsExpressionBase;exports.AssignmentExpression=AssignmentExpression;exports.AssignmentExpressionBase=AssignmentExpressionBase;exports.AsyncableNode=AsyncableNode;exports.AwaitExpression=AwaitExpression;exports.AwaitExpressionBase=AwaitExpressionBase;exports.AwaitableNode=AwaitableNode;exports.BaseError=BaseError;exports.BaseExpressionedNode=BaseExpressionedNode;exports.BigIntLiteral=BigIntLiteral;exports.BigIntLiteralBase=BigIntLiteralBase;exports.BinaryExpression=BinaryExpression;exports.BinaryExpressionBase=BinaryExpressionBase;exports.BindingElement=BindingElement;exports.BindingElementBase=BindingElementBase;exports.BindingNamedNode=BindingNamedNode;exports.Block=Block;exports.BlockBase=BlockBase;exports.BodiedNode=BodiedNode;exports.BodyableNode=BodyableNode;exports.BreakStatement=BreakStatement;exports.CallExpression=CallExpression;exports.CallExpressionBase=CallExpressionBase;exports.CallSignatureDeclaration=CallSignatureDeclaration;exports.CallSignatureDeclarationBase=CallSignatureDeclarationBase;exports.CaseBlock=CaseBlock;exports.CaseBlockBase=CaseBlockBase;exports.CaseClause=CaseClause;exports.CaseClauseBase=CaseClauseBase;exports.CatchClause=CatchClause;exports.CatchClauseBase=CatchClauseBase;exports.ChildOrderableNode=ChildOrderableNode;exports.ClassDeclaration=ClassDeclaration;exports.ClassDeclarationBase=ClassDeclarationBase;exports.ClassElement=ClassElement;exports.ClassExpression=ClassExpression;exports.ClassExpressionBase=ClassExpressionBase;exports.ClassLikeDeclarationBase=ClassLikeDeclarationBase;exports.ClassLikeDeclarationBaseSpecific=ClassLikeDeclarationBaseSpecific;exports.ClassStaticBlockDeclaration=ClassStaticBlockDeclaration;exports.ClassStaticBlockDeclarationBase=ClassStaticBlockDeclarationBase;exports.CodeAction=CodeAction;exports.CodeFixAction=CodeFixAction;exports.CombinedCodeActions=CombinedCodeActions;exports.CommaListExpression=CommaListExpression;exports.CommaListExpressionBase=CommaListExpressionBase;exports.CommentClassElement=CommentClassElement;exports.CommentEnumMember=CommentEnumMember;exports.CommentObjectLiteralElement=CommentObjectLiteralElement;exports.CommentRange=CommentRange;exports.CommentStatement=CommentStatement;exports.CommentTypeElement=CommentTypeElement;exports.CommonIdentifierBase=CommonIdentifierBase;exports.CompilerCommentClassElement=CompilerCommentClassElement;exports.CompilerCommentEnumMember=CompilerCommentEnumMember;exports.CompilerCommentNode=CompilerCommentNode;exports.CompilerCommentObjectLiteralElement=CompilerCommentObjectLiteralElement;exports.CompilerCommentStatement=CompilerCommentStatement;exports.CompilerCommentTypeElement=CompilerCommentTypeElement;exports.ComputedPropertyName=ComputedPropertyName;exports.ComputedPropertyNameBase=ComputedPropertyNameBase;exports.ConditionalExpression=ConditionalExpression;exports.ConditionalExpressionBase=ConditionalExpressionBase;exports.ConditionalTypeNode=ConditionalTypeNode;exports.ConstructSignatureDeclaration=ConstructSignatureDeclaration;exports.ConstructSignatureDeclarationBase=ConstructSignatureDeclarationBase;exports.ConstructorDeclaration=ConstructorDeclaration;exports.ConstructorDeclarationBase=ConstructorDeclarationBase;exports.ConstructorDeclarationOverloadBase=ConstructorDeclarationOverloadBase;exports.ConstructorTypeNode=ConstructorTypeNode;exports.ConstructorTypeNodeBase=ConstructorTypeNodeBase;exports.ContinueStatement=ContinueStatement;exports.DebuggerStatement=DebuggerStatement;exports.DebuggerStatementBase=DebuggerStatementBase;exports.DecoratableNode=DecoratableNode;exports.Decorator=Decorator;exports.DecoratorBase=DecoratorBase;exports.DefaultClause=DefaultClause;exports.DefaultClauseBase=DefaultClauseBase;exports.DefinitionInfo=DefinitionInfo;exports.DeleteExpression=DeleteExpression;exports.DeleteExpressionBase=DeleteExpressionBase;exports.Diagnostic=Diagnostic;exports.DiagnosticMessageChain=DiagnosticMessageChain;exports.DiagnosticWithLocation=DiagnosticWithLocation;exports.Directory=Directory;exports.DirectoryEmitResult=DirectoryEmitResult;exports.DirectoryNotFoundError=DirectoryNotFoundError;exports.DoStatement=DoStatement;exports.DoStatementBase=DoStatementBase;exports.DocumentSpan=DocumentSpan;exports.DotDotDotTokenableNode=DotDotDotTokenableNode;exports.ElementAccessExpression=ElementAccessExpression;exports.ElementAccessExpressionBase=ElementAccessExpressionBase;exports.EmitOutput=EmitOutput;exports.EmitResult=EmitResult;exports.EmptyStatement=EmptyStatement;exports.EmptyStatementBase=EmptyStatementBase;exports.EnumDeclaration=EnumDeclaration;exports.EnumDeclarationBase=EnumDeclarationBase;exports.EnumMember=EnumMember;exports.EnumMemberBase=EnumMemberBase;exports.ExclamationTokenableNode=ExclamationTokenableNode;exports.ExportAssignment=ExportAssignment;exports.ExportAssignmentBase=ExportAssignmentBase;exports.ExportDeclaration=ExportDeclaration;exports.ExportDeclarationBase=ExportDeclarationBase;exports.ExportGetableNode=ExportGetableNode;exports.ExportSpecifier=ExportSpecifier;exports.ExportSpecifierBase=ExportSpecifierBase;exports.ExportableNode=ExportableNode;exports.Expression=Expression;exports.ExpressionStatement=ExpressionStatement;exports.ExpressionStatementBase=ExpressionStatementBase;exports.ExpressionWithTypeArguments=ExpressionWithTypeArguments;exports.ExpressionWithTypeArgumentsBase=ExpressionWithTypeArgumentsBase;exports.ExpressionableNode=ExpressionableNode;exports.ExpressionedNode=ExpressionedNode;exports.ExtendsClauseableNode=ExtendsClauseableNode;exports.ExternalModuleReference=ExternalModuleReference;exports.ExternalModuleReferenceBase=ExternalModuleReferenceBase;exports.FalseLiteral=FalseLiteral;exports.FalseLiteralBase=FalseLiteralBase;exports.FileNotFoundError=FileNotFoundError;exports.FileReference=FileReference;exports.FileTextChanges=FileTextChanges;exports.ForInStatement=ForInStatement;exports.ForInStatementBase=ForInStatementBase;exports.ForOfStatement=ForOfStatement;exports.ForOfStatementBase=ForOfStatementBase;exports.ForStatement=ForStatement;exports.ForStatementBase=ForStatementBase;exports.FunctionDeclaration=FunctionDeclaration;exports.FunctionDeclarationBase=FunctionDeclarationBase;exports.FunctionDeclarationOverloadBase=FunctionDeclarationOverloadBase;exports.FunctionExpression=FunctionExpression;exports.FunctionExpressionBase=FunctionExpressionBase;exports.FunctionLikeDeclaration=FunctionLikeDeclaration;exports.FunctionOrConstructorTypeNodeBase=FunctionOrConstructorTypeNodeBase;exports.FunctionOrConstructorTypeNodeBaseBase=FunctionOrConstructorTypeNodeBaseBase;exports.FunctionTypeNode=FunctionTypeNode;exports.FunctionTypeNodeBase=FunctionTypeNodeBase;exports.GeneratorableNode=GeneratorableNode;exports.GetAccessorDeclaration=GetAccessorDeclaration;exports.GetAccessorDeclarationBase=GetAccessorDeclarationBase;exports.HeritageClause=HeritageClause;exports.HeritageClauseableNode=HeritageClauseableNode;exports.Identifier=Identifier;exports.IdentifierBase=IdentifierBase;exports.IfStatement=IfStatement;exports.IfStatementBase=IfStatementBase;exports.ImplementationLocation=ImplementationLocation;exports.ImplementsClauseableNode=ImplementsClauseableNode;exports.ImportAttribute=ImportAttribute;exports.ImportAttributeBase=ImportAttributeBase;exports.ImportAttributeNamedNode=ImportAttributeNamedNode;exports.ImportAttributes=ImportAttributes;exports.ImportAttributesBase=ImportAttributesBase;exports.ImportClause=ImportClause;exports.ImportClauseBase=ImportClauseBase;exports.ImportDeclaration=ImportDeclaration;exports.ImportDeclarationBase=ImportDeclarationBase;exports.ImportEqualsDeclaration=ImportEqualsDeclaration;exports.ImportEqualsDeclarationBase=ImportEqualsDeclarationBase;exports.ImportExpression=ImportExpression;exports.ImportExpressionBase=ImportExpressionBase;exports.ImportExpressionedNode=ImportExpressionedNode;exports.ImportSpecifier=ImportSpecifier;exports.ImportSpecifierBase=ImportSpecifierBase;exports.ImportTypeNode=ImportTypeNode;exports.IndexSignatureDeclaration=IndexSignatureDeclaration;exports.IndexSignatureDeclarationBase=IndexSignatureDeclarationBase;exports.IndexedAccessTypeNode=IndexedAccessTypeNode;exports.InferTypeNode=InferTypeNode;exports.InitializerExpressionGetableNode=InitializerExpressionGetableNode;exports.InitializerExpressionableNode=InitializerExpressionableNode;exports.InterfaceDeclaration=InterfaceDeclaration;exports.InterfaceDeclarationBase=InterfaceDeclarationBase;exports.IntersectionTypeNode=IntersectionTypeNode;exports.InvalidOperationError=InvalidOperationError;exports.IterationStatement=IterationStatement;exports.JSDoc=JSDoc;exports.JSDocAllType=JSDocAllType;exports.JSDocAugmentsTag=JSDocAugmentsTag;exports.JSDocAuthorTag=JSDocAuthorTag;exports.JSDocBase=JSDocBase;exports.JSDocCallbackTag=JSDocCallbackTag;exports.JSDocClassTag=JSDocClassTag;exports.JSDocDeprecatedTag=JSDocDeprecatedTag;exports.JSDocEnumTag=JSDocEnumTag;exports.JSDocFunctionType=JSDocFunctionType;exports.JSDocFunctionTypeBase=JSDocFunctionTypeBase;exports.JSDocImplementsTag=JSDocImplementsTag;exports.JSDocLink=JSDocLink;exports.JSDocLinkCode=JSDocLinkCode;exports.JSDocLinkPlain=JSDocLinkPlain;exports.JSDocMemberName=JSDocMemberName;exports.JSDocNameReference=JSDocNameReference;exports.JSDocNamepathType=JSDocNamepathType;exports.JSDocNonNullableType=JSDocNonNullableType;exports.JSDocNullableType=JSDocNullableType;exports.JSDocOptionalType=JSDocOptionalType;exports.JSDocOverloadTag=JSDocOverloadTag;exports.JSDocOverloadTagBase=JSDocOverloadTagBase;exports.JSDocOverrideTag=JSDocOverrideTag;exports.JSDocParameterTag=JSDocParameterTag;exports.JSDocParameterTagBase=JSDocParameterTagBase;exports.JSDocPrivateTag=JSDocPrivateTag;exports.JSDocPropertyLikeTag=JSDocPropertyLikeTag;exports.JSDocPropertyTag=JSDocPropertyTag;exports.JSDocPropertyTagBase=JSDocPropertyTagBase;exports.JSDocProtectedTag=JSDocProtectedTag;exports.JSDocPublicTag=JSDocPublicTag;exports.JSDocReadonlyTag=JSDocReadonlyTag;exports.JSDocReturnTag=JSDocReturnTag;exports.JSDocReturnTagBase=JSDocReturnTagBase;exports.JSDocSatisfiesTag=JSDocSatisfiesTag;exports.JSDocSatisfiesTagBase=JSDocSatisfiesTagBase;exports.JSDocSeeTag=JSDocSeeTag;exports.JSDocSeeTagBase=JSDocSeeTagBase;exports.JSDocSignature=JSDocSignature;exports.JSDocTag=JSDocTag;exports.JSDocTagBase=JSDocTagBase;exports.JSDocTagInfo=JSDocTagInfo;exports.JSDocTemplateTag=JSDocTemplateTag;exports.JSDocTemplateTagBase=JSDocTemplateTagBase;exports.JSDocText=JSDocText;exports.JSDocThisTag=JSDocThisTag;exports.JSDocThisTagBase=JSDocThisTagBase;exports.JSDocThrowsTag=JSDocThrowsTag;exports.JSDocThrowsTagBase=JSDocThrowsTagBase;exports.JSDocType=JSDocType;exports.JSDocTypeExpression=JSDocTypeExpression;exports.JSDocTypeExpressionableTag=JSDocTypeExpressionableTag;exports.JSDocTypeLiteral=JSDocTypeLiteral;exports.JSDocTypeParameteredTag=JSDocTypeParameteredTag;exports.JSDocTypeTag=JSDocTypeTag;exports.JSDocTypedefTag=JSDocTypedefTag;exports.JSDocUnknownTag=JSDocUnknownTag;exports.JSDocUnknownType=JSDocUnknownType;exports.JSDocVariadicType=JSDocVariadicType;exports.JSDocableNode=JSDocableNode;exports.JsxAttribute=JsxAttribute;exports.JsxAttributeBase=JsxAttributeBase;exports.JsxAttributedNode=JsxAttributedNode;exports.JsxClosingElement=JsxClosingElement;exports.JsxClosingElementBase=JsxClosingElementBase;exports.JsxClosingFragment=JsxClosingFragment;exports.JsxElement=JsxElement;exports.JsxElementBase=JsxElementBase;exports.JsxExpression=JsxExpression;exports.JsxExpressionBase=JsxExpressionBase;exports.JsxFragment=JsxFragment;exports.JsxNamespacedName=JsxNamespacedName;exports.JsxNamespacedNameBase=JsxNamespacedNameBase;exports.JsxOpeningElement=JsxOpeningElement;exports.JsxOpeningElementBase=JsxOpeningElementBase;exports.JsxOpeningFragment=JsxOpeningFragment;exports.JsxSelfClosingElement=JsxSelfClosingElement;exports.JsxSelfClosingElementBase=JsxSelfClosingElementBase;exports.JsxSpreadAttribute=JsxSpreadAttribute;exports.JsxSpreadAttributeBase=JsxSpreadAttributeBase;exports.JsxTagNamedNode=JsxTagNamedNode;exports.JsxText=JsxText;exports.JsxTextBase=JsxTextBase;exports.LabeledStatement=LabeledStatement;exports.LabeledStatementBase=LabeledStatementBase;exports.LanguageService=LanguageService;exports.LeftHandSideExpression=LeftHandSideExpression;exports.LeftHandSideExpressionedNode=LeftHandSideExpressionedNode;exports.LiteralExpression=LiteralExpression;exports.LiteralExpressionBase=LiteralExpressionBase;exports.LiteralLikeNode=LiteralLikeNode;exports.LiteralTypeNode=LiteralTypeNode;exports.ManipulationError=ManipulationError;exports.ManipulationSettingsContainer=ManipulationSettingsContainer;exports.MappedTypeNode=MappedTypeNode;exports.MemberExpression=MemberExpression;exports.MemoryEmitResult=MemoryEmitResult;exports.MetaProperty=MetaProperty;exports.MetaPropertyBase=MetaPropertyBase;exports.MethodDeclaration=MethodDeclaration;exports.MethodDeclarationBase=MethodDeclarationBase;exports.MethodDeclarationOverloadBase=MethodDeclarationOverloadBase;exports.MethodSignature=MethodSignature;exports.MethodSignatureBase=MethodSignatureBase;exports.ModifierableNode=ModifierableNode;exports.ModuleBlock=ModuleBlock;exports.ModuleBlockBase=ModuleBlockBase;exports.ModuleChildableNode=ModuleChildableNode;exports.ModuleDeclaration=ModuleDeclaration;exports.ModuleDeclarationBase=ModuleDeclarationBase;exports.ModuleNamedNode=ModuleNamedNode;exports.ModuledNode=ModuledNode;exports.NameableNode=NameableNode;exports.NamedExports=NamedExports;exports.NamedExportsBase=NamedExportsBase;exports.NamedImports=NamedImports;exports.NamedImportsBase=NamedImportsBase;exports.NamedNode=NamedNode;exports.NamedNodeBase=NamedNodeBase;exports.NamedTupleMember=NamedTupleMember;exports.NamedTupleMemberBase=NamedTupleMemberBase;exports.NamespaceExport=NamespaceExport;exports.NamespaceExportBase=NamespaceExportBase;exports.NamespaceImport=NamespaceImport;exports.NamespaceImportBase=NamespaceImportBase;exports.NewExpression=NewExpression;exports.NewExpressionBase=NewExpressionBase;exports.NoSubstitutionTemplateLiteral=NoSubstitutionTemplateLiteral;exports.NoSubstitutionTemplateLiteralBase=NoSubstitutionTemplateLiteralBase;exports.Node=Node;exports.NodeWithTypeArguments=NodeWithTypeArguments;exports.NodeWithTypeArgumentsBase=NodeWithTypeArgumentsBase;exports.NonNullExpression=NonNullExpression;exports.NonNullExpressionBase=NonNullExpressionBase;exports.NotEmittedStatement=NotEmittedStatement;exports.NotEmittedStatementBase=NotEmittedStatementBase;exports.NotImplementedError=NotImplementedError;exports.NotSupportedError=NotSupportedError;exports.NullLiteral=NullLiteral;exports.NullLiteralBase=NullLiteralBase;exports.NumericLiteral=NumericLiteral;exports.NumericLiteralBase=NumericLiteralBase;exports.ObjectBindingPattern=ObjectBindingPattern;exports.ObjectDestructuringAssignment=ObjectDestructuringAssignment;exports.ObjectDestructuringAssignmentBase=ObjectDestructuringAssignmentBase;exports.ObjectLiteralElement=ObjectLiteralElement;exports.ObjectLiteralExpression=ObjectLiteralExpression;exports.ObjectLiteralExpressionBase=ObjectLiteralExpressionBase;exports.OmittedExpression=OmittedExpression;exports.OmittedExpressionBase=OmittedExpressionBase;exports.OutputFile=OutputFile;exports.OverloadableNode=OverloadableNode;exports.OverrideableNode=OverrideableNode;exports.ParameterDeclaration=ParameterDeclaration;exports.ParameterDeclarationBase=ParameterDeclarationBase;exports.ParameteredNode=ParameteredNode;exports.ParenthesizedExpression=ParenthesizedExpression;exports.ParenthesizedExpressionBase=ParenthesizedExpressionBase;exports.ParenthesizedTypeNode=ParenthesizedTypeNode;exports.PartiallyEmittedExpression=PartiallyEmittedExpression;exports.PartiallyEmittedExpressionBase=PartiallyEmittedExpressionBase;exports.PathNotFoundError=PathNotFoundError;exports.PostfixUnaryExpression=PostfixUnaryExpression;exports.PostfixUnaryExpressionBase=PostfixUnaryExpressionBase;exports.PrefixUnaryExpression=PrefixUnaryExpression;exports.PrefixUnaryExpressionBase=PrefixUnaryExpressionBase;exports.PrimaryExpression=PrimaryExpression;exports.PrivateIdentifier=PrivateIdentifier;exports.PrivateIdentifierBase=PrivateIdentifierBase;exports.Program=Program;exports.Project=Project2;exports.PropertyAccessExpression=PropertyAccessExpression;exports.PropertyAccessExpressionBase=PropertyAccessExpressionBase;exports.PropertyAssignment=PropertyAssignment;exports.PropertyAssignmentBase=PropertyAssignmentBase;exports.PropertyDeclaration=PropertyDeclaration;exports.PropertyDeclarationBase=PropertyDeclarationBase;exports.PropertyNamedNode=PropertyNamedNode;exports.PropertySignature=PropertySignature;exports.PropertySignatureBase=PropertySignatureBase;exports.QualifiedName=QualifiedName;exports.QuestionDotTokenableNode=QuestionDotTokenableNode;exports.QuestionTokenableNode=QuestionTokenableNode;exports.ReadonlyableNode=ReadonlyableNode;exports.RefactorEditInfo=RefactorEditInfo;exports.ReferenceEntry=ReferenceEntry;exports.ReferenceFindableNode=ReferenceFindableNode;exports.ReferencedSymbol=ReferencedSymbol;exports.ReferencedSymbolDefinitionInfo=ReferencedSymbolDefinitionInfo;exports.ReferencedSymbolEntry=ReferencedSymbolEntry;exports.RegularExpressionLiteral=RegularExpressionLiteral;exports.RegularExpressionLiteralBase=RegularExpressionLiteralBase;exports.RenameLocation=RenameLocation;exports.RenameableNode=RenameableNode;exports.RestTypeNode=RestTypeNode;exports.ReturnStatement=ReturnStatement;exports.ReturnStatementBase=ReturnStatementBase;exports.ReturnTypedNode=ReturnTypedNode;exports.SatisfiesExpression=SatisfiesExpression;exports.SatisfiesExpressionBase=SatisfiesExpressionBase;exports.ScopeableNode=ScopeableNode;exports.ScopedNode=ScopedNode;exports.SetAccessorDeclaration=SetAccessorDeclaration;exports.SetAccessorDeclarationBase=SetAccessorDeclarationBase;exports.ShorthandPropertyAssignment=ShorthandPropertyAssignment;exports.ShorthandPropertyAssignmentBase=ShorthandPropertyAssignmentBase;exports.Signature=Signature;exports.SignaturedDeclaration=SignaturedDeclaration;exports.SourceFile=SourceFile;exports.SourceFileBase=SourceFileBase;exports.SpreadAssignment=SpreadAssignment;exports.SpreadAssignmentBase=SpreadAssignmentBase;exports.SpreadElement=SpreadElement;exports.SpreadElementBase=SpreadElementBase;exports.Statement=Statement;exports.StatementBase=StatementBase;exports.StatementedNode=StatementedNode;exports.StaticableNode=StaticableNode;exports.StringLiteral=StringLiteral;exports.StringLiteralBase=StringLiteralBase;exports.Structure=Structure;exports.SuperElementAccessExpression=SuperElementAccessExpression;exports.SuperElementAccessExpressionBase=SuperElementAccessExpressionBase;exports.SuperExpression=SuperExpression;exports.SuperExpressionBase=SuperExpressionBase;exports.SuperExpressionedNode=SuperExpressionedNode;exports.SuperPropertyAccessExpression=SuperPropertyAccessExpression;exports.SuperPropertyAccessExpressionBase=SuperPropertyAccessExpressionBase;exports.SwitchStatement=SwitchStatement;exports.SwitchStatementBase=SwitchStatementBase;exports.Symbol=Symbol2;exports.SymbolDisplayPart=SymbolDisplayPart;exports.SyntaxList=SyntaxList;exports.TaggedTemplateExpression=TaggedTemplateExpression;exports.TemplateExpression=TemplateExpression;exports.TemplateExpressionBase=TemplateExpressionBase;exports.TemplateHead=TemplateHead;exports.TemplateHeadBase=TemplateHeadBase;exports.TemplateLiteralTypeNode=TemplateLiteralTypeNode;exports.TemplateMiddle=TemplateMiddle;exports.TemplateMiddleBase=TemplateMiddleBase;exports.TemplateSpan=TemplateSpan;exports.TemplateSpanBase=TemplateSpanBase;exports.TemplateTail=TemplateTail;exports.TemplateTailBase=TemplateTailBase;exports.TextChange=TextChange;exports.TextInsertableNode=TextInsertableNode;exports.TextRange=TextRange;exports.TextSpan=TextSpan;exports.ThisExpression=ThisExpression;exports.ThisExpressionBase=ThisExpressionBase;exports.ThisTypeNode=ThisTypeNode;exports.ThrowStatement=ThrowStatement;exports.ThrowStatementBase=ThrowStatementBase;exports.TrueLiteral=TrueLiteral;exports.TrueLiteralBase=TrueLiteralBase;exports.TryStatement=TryStatement;exports.TryStatementBase=TryStatementBase;exports.TupleTypeNode=TupleTypeNode;exports.Type=Type;exports.TypeAliasDeclaration=TypeAliasDeclaration;exports.TypeAliasDeclarationBase=TypeAliasDeclarationBase;exports.TypeArgumentedNode=TypeArgumentedNode;exports.TypeAssertion=TypeAssertion;exports.TypeAssertionBase=TypeAssertionBase;exports.TypeChecker=TypeChecker;exports.TypeElement=TypeElement;exports.TypeElementMemberedNode=TypeElementMemberedNode;exports.TypeLiteralNode=TypeLiteralNode;exports.TypeLiteralNodeBase=TypeLiteralNodeBase;exports.TypeNode=TypeNode;exports.TypeOfExpression=TypeOfExpression;exports.TypeOfExpressionBase=TypeOfExpressionBase;exports.TypeOperatorTypeNode=TypeOperatorTypeNode;exports.TypeParameter=TypeParameter;exports.TypeParameterDeclaration=TypeParameterDeclaration;exports.TypeParameterDeclarationBase=TypeParameterDeclarationBase;exports.TypeParameteredNode=TypeParameteredNode;exports.TypePredicateNode=TypePredicateNode;exports.TypeQueryNode=TypeQueryNode;exports.TypeReferenceNode=TypeReferenceNode;exports.TypedNode=TypedNode;exports.UnaryExpression=UnaryExpression;exports.UnaryExpressionedNode=UnaryExpressionedNode;exports.UnionTypeNode=UnionTypeNode;exports.UnwrappableNode=UnwrappableNode;exports.UpdateExpression=UpdateExpression;exports.VariableDeclaration=VariableDeclaration;exports.VariableDeclarationBase=VariableDeclarationBase;exports.VariableDeclarationList=VariableDeclarationList;exports.VariableDeclarationListBase=VariableDeclarationListBase;exports.VariableStatement=VariableStatement;exports.VariableStatementBase=VariableStatementBase;exports.VoidExpression=VoidExpression;exports.VoidExpressionBase=VoidExpressionBase;exports.WhileStatement=WhileStatement;exports.WhileStatementBase=WhileStatementBase;exports.WithStatement=WithStatement;exports.WithStatementBase=WithStatementBase;exports.Writers=Writers;exports.YieldExpression=YieldExpression;exports.YieldExpressionBase=YieldExpressionBase;exports.createWrappedNode=createWrappedNode;exports.forEachStructureChild=forEachStructureChild;exports.getCompilerOptionsFromTsConfig=getCompilerOptionsFromTsConfig;exports.getScopeForNode=getScopeForNode;exports.insertOverloads=insertOverloads;exports.printNode=printNode;exports.setScopeForNode=setScopeForNode}});init_esbuild_inject();init_esbuild_inject();init_esbuild_inject();init_esbuild_inject();var urlSafeCharacters=[..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"],numericCharacters=[..."0123456789"],distinguishableCharacters=[..."CDEHKMPRTUWXY012458"],asciiPrintableCharacters=[..."!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"],alphanumericCharacters=[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"],readUInt16LE=(uInt8Array,offset)=>uInt8Array[offset]+(uInt8Array[offset+1]<<8),generateForCustomCharacters=(length,characters,randomBytes)=>{let characterCount=characters.length,maxValidSelector=Math.floor(65536/characterCount)*characterCount-1,entropyLength=2*Math.ceil(1.1*length),string="",stringLength=0;for(;stringLengthmaxValidSelector)&&(string+=characters[entropyValue%characterCount],stringLength++)}}return string},generateForCustomCharactersAsync=async(length,characters,randomBytesAsync)=>{let characterCount=characters.length,maxValidSelector=Math.floor(65536/characterCount)*characterCount-1,entropyLength=2*Math.ceil(1.1*length),string="",stringLength=0;for(;stringLengthmaxValidSelector)&&(string+=characters[entropyValue%characterCount],stringLength++)}}return string},allowedTypes=new Set([void 0,"hex","base64","url-safe","numeric","distinguishable","ascii-printable","alphanumeric"]),createGenerator=(generateForCustomCharacters2,specialRandomBytes2,randomBytes)=>({length,type,characters})=>{if(!(length>=0&&Number.isFinite(length)))throw new TypeError("Expected a `length` to be a non-negative finite number");if(type!==void 0&&characters!==void 0)throw new TypeError("Expected either `type` or `characters`");if(characters!==void 0&&typeof characters!="string")throw new TypeError("Expected `characters` to be string");if(!allowedTypes.has(type))throw new TypeError(`Unknown type: ${type}`);if(type===void 0&&characters===void 0&&(type="hex"),type==="hex"||type===void 0&&characters===void 0)return specialRandomBytes2(Math.ceil(length*.5),"hex",length);if(type==="base64")return specialRandomBytes2(Math.ceil(length*.75),"base64",length);if(type==="url-safe")return generateForCustomCharacters2(length,urlSafeCharacters,randomBytes);if(type==="numeric")return generateForCustomCharacters2(length,numericCharacters,randomBytes);if(type==="distinguishable")return generateForCustomCharacters2(length,distinguishableCharacters,randomBytes);if(type==="ascii-printable")return generateForCustomCharacters2(length,asciiPrintableCharacters,randomBytes);if(type==="alphanumeric")return generateForCustomCharacters2(length,alphanumericCharacters,randomBytes);if(characters.length===0)throw new TypeError("Expected `characters` string length to be greater than or equal to 1");if(characters.length>65536)throw new TypeError("Expected `characters` string length to be less or equal to 65536");return generateForCustomCharacters2(length,characters,randomBytes)};function createStringGenerator(specialRandomBytes2,randomBytes){return createGenerator(generateForCustomCharacters,specialRandomBytes2,randomBytes)}function createAsyncStringGenerator(specialRandomBytesAsync,randomBytesAsync){return createGenerator(generateForCustomCharactersAsync,specialRandomBytesAsync,randomBytesAsync)}var toHex=uInt8Array=>[...uInt8Array].map(byte=>byte.toString(16).padStart(2,"0")).join(""),toBase64=uInt8Array=>btoa(String.fromCodePoint(...uInt8Array)),maxEntropy=65536;function getRandomValues(byteLength){let generatedBytes=new Uint8Array(byteLength);for(let totalGeneratedBytes=0;totalGeneratedBytes{let E=new Error;if(!E.stack)throw new Error("Stack trace is not available!");return E.stack},ParseCallStack=(Stack=GenerateCallStack())=>{if(Stack.includes("@")){let Raw2=Stack.split(` `).slice(2),Trace2=[];navigator.userAgent.includes("Firefox/")&&Raw2.splice(-1,1);for(let Line of Raw2){let Start=Line.indexOf("@")+1,LastColon=Line.lastIndexOf(":"),Dump=LastColon<0?Line.slice(Start):Line.slice(Start,Line.lastIndexOf(":",LastColon-1));Trace2.push(Dump)}return Trace2}let Raw=Stack.slice(6).split(` -`).slice(2),Trace=[];for(let Line of Raw){let Dump=Line.slice(Line.indexOf("(")+1||Line.indexOf("at")+3,Line.lastIndexOf(":",Line.lastIndexOf(":")-1));Trace.push(Dump)}return Trace},JustifyCallStack=(Stack=ParseCallStack())=>{let SkipLines=0;for(let Line of Stack){let Index=Line.indexOf("://");if(Index===5||Index===4)break;SkipLines++}return Stack.slice(SkipLines)};init_esbuild_inject();var HasSubstringSetsInString=(Text,Substrings)=>{for(let Substring of Substrings)if(Text.includes(Substring))return!0;return!1};var AdshieldHostableDomains=["07c225f3.online","css-load.com","html-load.com","content-loader.com","html-load.cc"],AdshieldDomains=[...AdshieldHostableDomains,"22d2d4d9-0c15-4a3a-9562-384f2c100146.xyz","f97ae142.online","error-report.com","2aeabdd4-3280-4f03-bc92-1890494f28be.xyz","e1577bbd-2a7e-4bee-b2fe-12a6406689e5.xyz","fadeb9a7-2417-4a51-8d99-0421a5622cbe.xyz","8bf6c3e9-3f4f-40db-89b3-58248f943ce3.online","b714b1e8-4b7d-4ce9-a248-48fd5472aa0b.online","657475b7-0095-478d-90d4-96ce440604f9.online","4e55.xyz","4e68.xyz","b211.xyz","4a0e.xyz","safe-load.xyz","da29e6b8-f018-490f-b25f-39a887fc95e7.xyz","81ac.xyz","e076.xyz","b59c.xyz","48a16802.site","7e809ed7-e553-4e29-acb1-4e3c0e986562.site","d84bc26d.site","b1181fb1.site","f6176563.site","7fc8.site","295c.site","3a2e.site","58e0.site","bbd8.site","ca3d.site","ec44.site","f090.site","02777e.site","05751c.site","8acc5c.site","b9f25b.site","4aae8f.site","07e197.site","f2f8.xyz","a67d12.xyz","ca9246.xyz","a49ebd.xyz","485728.xyz","caa2c4.xyz","d980ed.xyz","4e04f7.xyz","68646f.xyz","1350c3.xyz","20519a.xyz","634369.xyz","d8b0a5.xyz","5fd6bc.xyz","1116c5.xyz","1a1fb6.xyz","7608d5.xyz","977878.xyz","bc98ad.xyz","11c7a3.xyz","5ceea3.xyz","97b448.xyz","dd2270.xyz","605efe.xyz","fbfec2.xyz","b0eb63.xyz","ce357c.xyz","b903c2.xyz","22dd31.xyz","cfb98a.xyz","072551.xyz","5550be.xyz","f8a070.xyz","4e990.xyz","6a6672.xyz","0395d1.xyz","156fd4.xyz","b82978.xyz"],AdshieldKeywords=[...AdshieldDomains,"failed to load website","blocking software"],AdshieldDomainsize=AdshieldHostableDomains.length,GetRandomAdShieldHost=()=>AdshieldHostableDomains[Number(browser_default({length:16,type:"numeric"}))*1e-16*AdshieldDomainsize>>>0],IsAdShieldCall=(Trace=JustifyCallStack())=>Trace.length===0?!1:!!HasSubstringSetsInString(Trace[Trace.length-1],AdshieldDomains);init_esbuild_inject();init_esbuild_inject();var source=[{id:"kynb",input:'0Nm}ubC9L6k{7("nx>s=Ko]IBw/ySgf%W',output:"a274bcljtv0omw6z9g5p13us8ekhxirfq",reserved1:121,reserved1Input:"e?`3AU<2Z[; iJEFV'|Pa8T5j-.v :q#H)",reserved1Output:"eow5rfluq8x4zgj70p13ci6mh2s9tnkabv",reserved2:110,reserved2Input:`&XD_QOhMrltpR1c4zG +`).slice(2),Trace=[];for(let Line of Raw){let Dump=Line.slice(Line.indexOf("(")+1||Line.indexOf("at")+3,Line.lastIndexOf(":",Line.lastIndexOf(":")-1));Trace.push(Dump)}return Trace},JustifyCallStack=(Stack=ParseCallStack())=>{let SkipLines=0;for(let Line of Stack){let Index=Line.indexOf("://");if(Index===5||Index===4)break;SkipLines++}return Stack.slice(SkipLines)};init_esbuild_inject();var HasSubstringSetsInString=(Text,Substrings)=>{for(let Substring of Substrings)if(Text.includes(Substring))return!0;return!1};var AdshieldHostableDomains=["07c225f3.online","css-load.com","html-load.com","content-loader.com","html-load.cc"],AdshieldDomains=[...AdshieldHostableDomains,"22d2d4d9-0c15-4a3a-9562-384f2c100146.xyz","f97ae142.online","error-report.com","2aeabdd4-3280-4f03-bc92-1890494f28be.xyz","e1577bbd-2a7e-4bee-b2fe-12a6406689e5.xyz","fadeb9a7-2417-4a51-8d99-0421a5622cbe.xyz","8bf6c3e9-3f4f-40db-89b3-58248f943ce3.online","b714b1e8-4b7d-4ce9-a248-48fd5472aa0b.online","657475b7-0095-478d-90d4-96ce440604f9.online","4e55.xyz","4e68.xyz","b211.xyz","4a0e.xyz","safe-load.xyz","da29e6b8-f018-490f-b25f-39a887fc95e7.xyz","81ac.xyz","e076.xyz","b59c.xyz","48a16802.site","7e809ed7-e553-4e29-acb1-4e3c0e986562.site","d84bc26d.site","b1181fb1.site","f6176563.site","7fc8.site","295c.site","3a2e.site","58e0.site","bbd8.site","ca3d.site","ec44.site","f090.site","02777e.site","05751c.site","8acc5c.site","b9f25b.site","4aae8f.site","07e197.site","f2f8.xyz","a67d12.xyz","ca9246.xyz","a49ebd.xyz","485728.xyz","caa2c4.xyz","d980ed.xyz","4e04f7.xyz","68646f.xyz","1350c3.xyz","20519a.xyz","634369.xyz","d8b0a5.xyz","5fd6bc.xyz","1116c5.xyz","1a1fb6.xyz","7608d5.xyz","977878.xyz","bc98ad.xyz","11c7a3.xyz","5ceea3.xyz","97b448.xyz","dd2270.xyz","605efe.xyz","fbfec2.xyz","b0eb63.xyz","ce357c.xyz","b903c2.xyz","22dd31.xyz","cfb98a.xyz","072551.xyz","5550be.xyz","f8a070.xyz","4e990.xyz","6a6672.xyz","0395d1.xyz","156fd4.xyz","b82978.xyz"],AdshieldKeywords=[...AdshieldDomains,"failed to load website","blocking software"],AdshieldDomainsize=AdshieldHostableDomains.length,GetRandomAdShieldHost=()=>AdshieldHostableDomains[Number(browser_default({length:16,type:"numeric"}))*1e-16*AdshieldDomainsize>>>0],IsAdShieldCall=(Trace=JustifyCallStack())=>Trace.length===0?!1:!!HasSubstringSetsInString(Trace[Trace.length-1],AdshieldDomains);init_esbuild_inject();init_esbuild_inject();var source=[{id:"dggn",input:`_l< VzqDF:2g61w{im("7LAZa/^j%'K?`,output:"x29hb8pwvsilcmq065t437rnyuo1jfzke",reserved1:103,reserved1Input:"`H;4SyMB.\nfuxnv#RrP3EJQ&9Y[O0c CUo",reserved1Output:"x8b3ln1k9mceis4u0whjoyrzv5qgtapf27",reserved2:97,reserved2Input:"NXGt5=}]bIkh)8T>p-|eWs",reserved2Output:"qxn6iup3ot8gz7flcw09by"},{id:"ithc",input:"B c1 3FY%so6TiAx\nLP?qapt0]-Iye',reserved1Output:"k523tlpzeqvs0yjh81ogua6wnbr7c9mf4i",reserved2:49,reserved2Input:"hn[RXm|DOH/:.EVKJ;4}SU",reserved2Output:"m0ryiqt8362p1faulj4zgh"},{id:"irrr",input:"W0|7_z}{roYkhXL^%('/>NtQGguZSA4vU",output:"v9apyik6230j5ml7n8buqrf1zgscewxt4",reserved1:111,reserved1Input:`yjMF-f"R[ Hwxns)pIC1=258E96PK:JO +`,reserved1Output:"7gtkrpc45nwh6i8jfv93bsylaqezmu2o10",reserved2:104,reserved2Input:"milb`#3Baq];DTV?e.< &c",reserved2Output:"0t8kbf26uz9smh714pcexy"},{id:"vkds",input:`nSyNDG'Mj/o0# +rbqI7}-A|c`,reserved2Output:"uy8oa2s6g4j301t9bip7rc"},{id:"zmpc",input:"i;Uj'[np3JN]47u",reserved2Output:"9jmanwyqx0s54zuto6h"},{id:"fwbh",input:`x5A8hE9= +QG1"CuJ'oV(I)>lbW4D#e L6`,output:"wr275yogsj4kv03izcnx1uaqb8pflm6th",reserved1:57,reserved1Input:"3%t {2rckfyXR]?NK&/Fgw;TSMmn-7_iU.",reserved1Output:"y93rfts7lxq8vkgjen5m0i6wzhap1ucb2o",reserved2:101,reserved2Input:"}qBnp3JN]47u",reserved2Output:"9jmanwyqx0s54zuto6h"},{id:"nloc",input:"x<[ykY%1-sK9_C0Raj#8OLl]/HwhqFU 3",output:"0ozupkrx6qjwnygl34m7i9th1f8v2bec5",reserved1:97,reserved1Input:'&m2GT5IrP" .B(o=:igbJpWnz7tcvNZ`>\n',reserved1Output:"74hfvbtcj2eroa0ul56yw3inqxkgp9m1zs",reserved2:115,reserved2Input:"uV6})Q'?D{SeAMX4;Ef",reserved2Output:"91ysxe8luorn6vpciwq"},{id:"kynb",input:'0Nm}ubC9L6k{7("nx>s=Ko]IBw/ySgf%W',output:"a274bcljtv0omw6z9g5p13us8ekhxirfq",reserved1:121,reserved1Input:"e?`3AU<2Z[; iJEFV'|Pa8T5j-.v :q#H)",reserved1Output:"eow5rfluq8x4zgj70p13ci6mh2s9tnkabv",reserved2:110,reserved2Input:`&XD_QOhMrltpR1c4zG Y`,reserved2Output:"c7863qbsmwy54otnhiv1"},{id:"uyyk",input:"Tx2h{s[",output:"mjb0feu6lzx7kqhgop4at831c92ywir5n",reserved1:118,reserved1Input:`5f;Vt"qDLB91'm }?R6S(Z#A\`Jr0HQlKP)`,reserved1Output:"qp5r842ycvxjowbaz7uhts9gk6i0emn13f",reserved2:115,reserved2Input:"NGnE8a_y.FjYO=4w3]p7",reserved2Output:"kn1eho6fjbr40pxc9i2q"},{id:"rypa",input:`B8 /Y9o]VHC_p3yt hTONi5q6IG-r=2g%`,output:"ul2ow01j9zq58mfk4cv37absyigteh6xn",reserved1:112,reserved1Input:`nEeJKa.:P{A;x0UL"4'XFm|}wfvzQ#7ZS(`,reserved1Output:"m8961qwzghu27xeoapn3k5ilvrfjc4syt0",reserved2:114,reserved2Input:"&jbukM`c?1) l",reserved2Output:"6akyhor80m37slfw1vxp"},{id:"ehor",input:`"q4 -J3fkZhj<\`wH50T='g|(EP[B-QYD`,output:"7uil5a3gxbrptvjeymo4c09wqzs682nf1",reserved1:107,reserved1Input:"Ks_)v;Vu",reserved1Output:"ypwzx2usm8og5q74tanlb6ri3vcehj9kf1",reserved2:104,reserved2Input:"7y:x218]U#NC}nWaMS{L",reserved2Output:"bja3zkfvqltgu5sw678n"},{id:"zmpc",input:`.Ip>szJ8EwahYM/v;yKc=f -([_T q3nOS`,output:"5nv1iegza269ju8soky04h3p7rltcxmbq",reserved1:119,reserved1Input:'QCABV"]#0jb&Wo6t:UuiHg1rPD4%)RlNk-',reserved1Output:"le4971m5irpukxjv3sq2o8y60gnbzthwfa",reserved2:102,reserved2Input:"G752e`LXx'Zm}9< {?F",reserved2Output:"plbi21cxfmo36tn50uq"},{id:"fwbh",input:`x5A8hE9= -QG1"CuJ'oV(I)>lbW4D#e L6`,output:"wr275yogsj4kv03izcnx1uaqb8pflm6th",reserved1:57,reserved1Input:"3%t {2rckfyXR]?NK&/Fgw;TSMmn-7_iU.",reserved1Output:"y93rfts7lxq8vkgjen5m0i6wzhap1ucb2o",reserved2:101,reserved2Input:"}qBnp3JN]47u",reserved2Output:"9jmanwyqx0s54zuto6h"},{id:"nloc",input:"x<[ykY%1-sK9_C0Raj#8OLl]/HwhqFU 3",output:"0ozupkrx6qjwnygl34m7i9th1f8v2bec5",reserved1:97,reserved1Input:'&m2GT5IrP" .B(o=:igbJpWnz7tcvNZ`>\n',reserved1Output:"74hfvbtcj2eroa0ul56yw3inqxkgp9m1zs",reserved2:115,reserved2Input:"uV6})Q'?D{SeAMX4;Ef",reserved2Output:"91ysxe8luorn6vpciwq"},{id:"fkad",input:"7z>g}{/W#`c[ZT&sI<2-haKXYn\no)xSFA",output:"niue8tmyacj3l91q65fxbwzrv7po2gk40",reserved1:115,reserved1Input:"1EHb.|u?p(qfPity'r6O% w=]9BJRD;:8k",reserved1Output:"phm21v9cw4b73yglnfxotazsuj8qrk650i",reserved2:104,reserved2Input:'Qj^ NCUv54le"VMm_30GL',reserved2Output:"bixqrhwn9zjm54o12fe0s"},{id:"svmm",input:`maG;FT.e2cYzV:%i})g4bp-KUZy#[h{X19o&SEAM/n"O= 05P',reserved1Output:"36qz0mv9tne7kwra5i1ujx28oyfspcglh4",reserved2:101,reserved2Input:"|` 'Rqj6CNWH]I8sx7u3f",reserved2Output:"wegyjpzux38q2a9vmifot"},{id:"cokq",input:`(r%96jVK7{kP gDhOcFs'1;M"IuQZ/yqA`,output:"izxsomqh3p8bvga49w7fy2tluc6e5n01r",reserved1:106,reserved1Input:"^zG[wm\nC`=8Bv><&]0:T L#px3Xli-n).4",reserved1Output:"p91tzx4ibshwf3qyen506ugo2mkv8lrjc7",reserved2:107,reserved2Input:"EYf?RN2a}WbU5eH_|StJo",reserved2Output:"sm8fkhrwa94y0eupj2nq1"},{id:"znbg",input:"( EHC_;s/.WgNfVl z9MYhQ}Tj:JFUS)#",output:"o5hkm78up2yxwvzsj0at1bglr6ei43ncq",reserved1:102,reserved1Input:`KZi{^4#[h{X19o&SEAM/n"O= 05P',reserved1Output:"36qz0mv9tne7kwra5i1ujx28oyfspcglh4",reserved2:101,reserved2Input:"|` 'Rqj6CNWH]I8sx7u3f",reserved2Output:"wegyjpzux38q2a9vmifot"},{id:"cokq",input:`"(r%96jVK7{kP gDhOcFs'1;M"IuQZ/yqA"`,output:"izxsomqh3p8bvga49w7fy2tluc6e5n01r",reserved1:106,reserved1Input:"^zG[wm\nC`=8Bv><&]0:T L#px3Xli-n).4",reserved1Output:"p91tzx4ibshwf3qyen506ugo2mkv8lrjc7",reserved2:107,reserved2Input:"EYf?RN2a}WbU5eH_|StJo",reserved2Output:"sm8fkhrwa94y0eupj2nq1"},{id:"znbg",input:"( EHC_;s/.WgNfVl z9MYhQ}Tj:JFUS)#",output:"o5hkm78up2yxwvzsj0at1bglr6ei43ncq",reserved1:102,reserved1Input:`KZi{^4POo37nv?x&1`]2t",reserved2Output:"crxmjf7yhgt6o3p8l09iv"}];init_esbuild_inject();init_esbuild_inject();init_esbuild_inject();var Config={Debug:!1};init_esbuild_inject();var CreateDebug=Namespace=>{let Header=`[microShield:${Namespace}]`;return new Proxy(console.debug,{apply(Target,ThisArg,ArgArray){Reflect.apply(Target,ThisArg,[Header,...ArgArray])}})};var Win=typeof unsafeWindow<"u"?unsafeWindow:window,Debug=CreateDebug("secret"),Secret=browser_default({length:20}),PprintCall=(Name,WasBlocked,V)=>{Debug(WasBlocked?"-":"+","name="+Name,"v=",V,"stack=",GenerateCallStack())},ProtectFunction=(F,Options)=>new Proxy(F,{apply(Target,ThisArg,ArgArray){let E=()=>{throw PprintCall(Options.Name,!0,ArgArray),new Error};if(IsAdShieldCall()&&E(),Options.CheckArguments){for(let Arg of ArgArray.filter(Arg2=>typeof Arg2=="string"))HasSubstringSetsInString(Arg,AdshieldKeywords)&&E();for(let Arg of ArgArray.filter(Arg2=>typeof Arg2=="function"))HasSubstringSetsInString(Arg.toString(),AdshieldKeywords)&&E();for(let Arg of ArgArray.filter(Arg2=>Arg2 instanceof URL))HasSubstringSetsInString(Arg.href,AdshieldKeywords)&&E()}if(Options.CheckErrorStack&&HasSubstringSetsInString(location.hostname,Options.CheckErrorStack))for(let Arg of ArgArray.filter(Arg2=>Arg2 instanceof Error))HasSubstringSetsInString(Arg.stack??"",[...AdshieldKeywords,"microShield",`@[native code] E@${location.protocol}//${location.hostname+location.pathname}:`])&&E();if(Options.CheckArgumentFunctions)for(let CheckFunction of Options.CheckArgumentFunctions)CheckFunction(ArgArray)||E();if(Options.CheckOutputs){let Output=Reflect.apply(Target,ThisArg,ArgArray);HasSubstringSetsInString(Output.toLowerCase(),AdshieldKeywords)&&E()}return Config.Debug&&PprintCall(Options.Name,!1,ArgArray),Reflect.apply(Target,ThisArg,ArgArray)},setPrototypeOf(Target,V){throw PprintCall(Options.Name,!0,V),new Error}}),UnprotectedFetch=fetch,ProtectedDescriptors=new Set,ProtectDescriptors=(O,Key,NewProperty)=>{if(ProtectedDescriptors.size===0){let DefineProperty=ProtectFunction(Object.defineProperty,{CheckArgumentFunctions:[]}),DefineProperties=ProtectFunction(Object.defineProperties,{CheckArgumentFunctions:[ArgArray=>{if(location.hostname.includes("raenonx.cc"))return!0;for(let TargetProperty of Object.keys(ArgArray[1]))if(ProtectedDescriptors.has(ArgArray[0][TargetProperty]))return!1;return!0}]});ProtectedDescriptors.add(DefineProperty),ProtectedDescriptors.add(DefineProperties),Object.defineProperty(Win.Object,"defineProperty",{value:DefineProperty}),Object.defineProperties(Win.Object,{defineProperty:{value:DefineProperty},defineProperties:{value:DefineProperties}})}Object.defineProperty(O,Key,{value:NewProperty}),ProtectedDescriptors.add(NewProperty)},ProtectFunctionDescriptors=(O,Key,Options)=>{let Property=O[Key];Options===void 0&&(Options={}),Options.Name===void 0&&(Options.Name=Property.name),ProtectDescriptors(O,Key,ProtectFunction(Property,Options))};init_esbuild_inject();var TsMorph=__toESM(require_ts_morph(),1),TokenExtractor=class{Code;constructor(Code){this.Code=Code}GetToken(){let FileInstance=new TsMorph.Project({compilerOptions:{allowJs:!0,skipLibCheck:!0,target:TsMorph.ScriptTarget.ES2020},skipFileDependencyResolution:!0,useInMemoryFileSystem:!0}).createSourceFile("code.js",this.Code,{overwrite:!0}),Tokens=[],EncoderNodes=FileInstance.getDescendantsOfKind(TsMorph.SyntaxKind.FunctionDeclaration).filter(Descendant=>Descendant.getParent().getChildrenOfKind(TsMorph.SyntaxKind.ExpressionStatement).length>0).filter(EncoderNode2=>EncoderNode2.getKind()===TsMorph.SyntaxKind.FunctionDeclaration).filter(EncoderNode2=>EncoderNode2.getParent().getChildrenOfKind(TsMorph.SyntaxKind.ExpressionStatement)[0].getChildrenOfKind(TsMorph.SyntaxKind.BinaryExpression).length>0).filter(EncoderNode2=>EncoderNode2.getFullText().includes("=="));EncoderNodes=EncoderNodes[0].getParent().getChildrenOfKind(TsMorph.SyntaxKind.FunctionDeclaration);let DecoderNode=EncoderNodes.filter(EncoderNode2=>!EncoderNode2.getText().includes("=="))[0],EncoderNode=EncoderNodes.filter(EncoderNode2=>EncoderNode2.getText().includes("=="))[0],MinusNumber=Number(DecoderNode.getFirstDescendantByKind(TsMorph.SyntaxKind.MinusEqualsToken).getParent().getFirstDescendantByKind(TsMorph.SyntaxKind.NumericLiteral).getText()),EncoderStringArray=[];EncoderNode.getFirstDescendantByKind(TsMorph.SyntaxKind.ArrayLiteralExpression).getDescendantsOfKind(TsMorph.SyntaxKind.StringLiteral).forEach(Child=>{EncoderStringArray.push(Child.getText().slice(1,-1))});let ReorderConditionNode=FileInstance.getDescendantsOfKind(TsMorph.SyntaxKind.IfStatement).filter(IfStatement=>IfStatement.getText().match(/parseInt\(/g)?.length>4&&IfStatement.getText().includes("break"))[0].getFirstDescendantByKind(TsMorph.SyntaxKind.BinaryExpression),ReorderConditionVar=ReorderConditionNode.getDescendantsOfKind(TsMorph.SyntaxKind.Identifier).filter(Identifier=>Identifier.getParent().getDescendantsOfKind(TsMorph.SyntaxKind.NumericLiteral).length===1&&Identifier.getText()!=="parseInt")[0].getText();for(;!new Function("EncoderStringArray","MinusNumber",`const ${ReorderConditionVar} = (I) => { return EncoderStringArray[I - MinusNumber] } - return ${ReorderConditionNode.getText()}`)(EncoderStringArray,MinusNumber);)EncoderStringArray.push(EncoderStringArray.shift());return FileInstance.getDescendantsOfKind(TsMorph.SyntaxKind.Identifier).filter(Identifier=>{if(Identifier.getParent().getDescendantsOfKind(TsMorph.SyntaxKind.Identifier).length!==10||typeof Identifier.getFirstAncestorByKind(TsMorph.SyntaxKind.ReturnStatement)>"u")return!1;let ReturnStatementText=Identifier.getFirstAncestorByKind(TsMorph.SyntaxKind.ReturnStatement).getText();return ReturnStatementText.includes(".concat([")||ReturnStatementText.includes("/resources/")||ReturnStatementText.includes(".endpoint")||ReturnStatementText.includes("token=")||ReturnStatementText.includes("_")||ReturnStatementText.includes("resources://")}).forEach(TokenIdentifier=>{let TokenDeclarationNode=TokenIdentifier.findReferences()[0].getDefinition().getDeclarationNode();if(typeof TokenDeclarationNode.getFirstChildByKind(TsMorph.SyntaxKind.StringLiteral)<"u")Tokens.push(TokenDeclarationNode.getFirstChildByKind(TsMorph.SyntaxKind.StringLiteral).getText().slice(1,-1));else{let CurrentParam=Number(TokenDeclarationNode.getFirstDescendantByKind(TsMorph.SyntaxKind.NumericLiteral).getText());Tokens.push(EncoderStringArray[CurrentParam-MinusNumber])}}),Tokens.join("")}};var GetCachableHtml=async Url=>{let Text=await(await UnprotectedFetch(Url,{cache:"force-cache"})).text();if(Text.length===0)throw new Error("Failed to fetch resource!");return""},GetResourceToken=async ScriptUrl=>{let Text=await(await UnprotectedFetch(ScriptUrl,{cache:"force-cache"})).text(),Match=/eyJ[\w-]*\.eyJ[\w-]*\.[\w-]*/.exec(Text);if(Match===null){let ResponseHash=Array.from(new Uint8Array(await crypto.subtle.digest("SHA-1",new TextEncoder().encode(Text)))).map(Block=>Block.toString(16).padStart(2,"0")).join("");try{return await GetResourceTokenFromCDN(ResponseHash)}catch{if(await GM.getValue(ResponseHash,null)===null){let Token=new TokenExtractor(Text).GetToken();return await GM.setValue(ResponseHash,Token),Token}else return await GM.getValue(ResponseHash,null)}}return Match[0]},GetResourceTokenFromCDN=async Hash=>{let CurrentDate=new Date,XHR=await GM.xmlHttpRequest({url:`https://cdn.jsdelivr.net/gh/List-KR/microShield-token@latest/${CurrentDate.getUTCFullYear()}/${CurrentDate.getUTCMonth()}/${CurrentDate.getUTCDate()}/${Hash}.token`});if(XHR.status!==200)throw new Error("Failed to fetch token!");return XHR.response},ResolveResourceUrls=async(Html,Token)=>{let Pattern=/(resources:\/\/[^'"]+)/g,Host=GetRandomAdShieldHost(),NewHtml="",Matches=null;for(;(Matches=Pattern.exec(Html))!==null;){let Url="https://"+Host+"/resources/"+Matches[1].slice(12)+"?token="+Token;NewHtml+=await GetCachableHtml(Url).catch(Errors=>(console.error(Errors),""))}return NewHtml};init_esbuild_inject();init_esbuild_inject();var ProtectedPrefix="asdf-",ProtectStorageApis=()=>{ProtectFunctionDescriptors(window.Storage.prototype,"setItem",{CheckArgumentFunctions:[ArgArray=>!ArgArray[0].startsWith(ProtectedPrefix)||ArgArray[2]===Secret]}),ProtectFunctionDescriptors(window.Storage.prototype,"removeItem",{CheckArgumentFunctions:[ArgArray=>!ArgArray[0].startsWith(ProtectedPrefix)||ArgArray[1]===Secret]}),ProtectFunctionDescriptors(window.Storage.prototype,"clear")},Pull=Key=>localStorage.getItem(ProtectedPrefix+Key,Secret),Push=(Key,Value)=>{localStorage.setItem(ProtectedPrefix+Key,Value,Secret)};var Debug2=CreateDebug("entities");var InsertTextEntity=Entity=>{let SelectedNode=document.querySelector(Entity.Selector);if(!SelectedNode)throw new Error("The target node was not found in the frame!");SelectedNode.before(Entity.TextContent),SelectedNode.remove()},IsInstailledInAdGuardCoreLib=new Error().stack?.includes("local.adguard.org"),InsertHeadEntity=Entity=>{IsInstailledInAdGuardCoreLib&&location.hostname.includes("etoday.co.kr")&&document.querySelectorAll(".sticky-body-spacer, .sticky-body-spacer_sub").forEach(Element=>Element.classList.remove("sticky-body-spacer","sticky-body-spacer_sub")),document.head.insertAdjacentHTML("beforeend",Entity.Html)},InsertEntity=async Entity=>{Entity.Type===1?InsertHeadEntity(Entity):Entity.Type===0&&InsertTextEntity(Entity)},InsertEntities=async Entities=>Promise.allSettled(Entities.map(async Entity=>InsertEntity(Entity))),TryCachedEntities=async()=>{let Json=Pull("entity-cache-rev2");if(!Json)throw new Error("The cached entities does not exist on this browser!");let Data=JSON.parse(Json);if(Date.now()-Data.CreatedAt>1e3*60*60*24*30)throw new Error("The cached entities are too old!");if(!Data.Entities.reduce((State,Entity)=>Entity.Type===1?State+Entity.Html.length:State,0))throw new Error("The cached entities has no content!");return Debug2("restoring cached entities data=",Data),await InsertEntities(Data.Entities),!0},PutCachedEntities=Entity=>{Entity.length!==0&&Push("entity-cache-rev2",JSON.stringify({Entity,CreatedAt:Date.now()}))};init_esbuild_inject();var DocumentReady=async(Doc=document)=>{if(Doc.readyState==="loading")return new Promise(Resolve=>{Doc.addEventListener("readystatechange",()=>{Resolve()})})};init_esbuild_inject();var HardcodedEntities=[{domain:"mydaily.co.kr",css:[".header_top > .header_right { width: 180px !important; }"]}],LoadHardcoded=()=>HardcodedEntities.find(Entity=>location.hostname.includes(Entity.domain));var Debug3=CreateDebug("ztinywave"),Decode=Payload=>{let Id=Payload.slice(0,4),Key=source.find(Store=>Store.id===Id);if(!Key)throw new Error("DEFUSER_ZTINYWAVE_KEY_NOT_FOUND");let Ra=String.fromCharCode(Key.reserved1),Rb=String.fromCharCode(Key.reserved2),Unwrap=(Input,Output,Char)=>{let Index=Output.indexOf(Char);return Index>=0?Input[Index]:Char},Mode=0,Data=Payload.slice(4).split("").map(Char=>{if(!Mode){if(Char===Ra)return Mode=1,"";if(Char===Rb)return Mode=2,""}return Mode===1?(Mode=0,Key.reserved1Output.includes(Char)?Unwrap(Key.reserved1Input,Key.reserved1Output,Char):Unwrap(Key.input,Key.output,Char)+Char):Mode===2?(Mode=0,Key.reserved2Output.includes(Char)?Unwrap(Key.reserved2Input,Key.reserved2Output,Char):Unwrap(Key.input,Key.output,Char)+Char):Unwrap(Key.input,Key.output,Char)}).join("");return JSON.parse(Data)},Extract=async()=>{let Sources=[],Pick=()=>{let Targets=document.querySelectorAll('script[data]:not([data=""]),script[wp-data]:not([wp-data=""])');for(let Target of Targets){let Script=Target.getAttribute("src"),Data=Target.getAttribute("data");Script&&Data&&Sources.push({Script,Data})}};if(Pick(),Sources.length===0&&(await DocumentReady(document),Pick()),Sources.length===0)throw new Error("DEFUSER_ZTINYWAVE_TARGET_NOT_FOUND");return Sources},Tinywave=async()=>{if(await TryCachedEntities().catch(Errors=>(Debug3("Failed to initialise cached entities",Errors),!1)))return;let Entities=[],Sources=await Extract(),LoadedHardcoded=LoadHardcoded();if(LoadedHardcoded?.domain)for(let Item of LoadedHardcoded.css)Sources.push({Script:LoadedHardcoded.domain,Data:``});let SourcesResolves=Sources.map(async Source=>{Debug3("source",Source);let Payload=[{tags:Source.Data}];Source.Data.startsWith("{await DocumentReady(document);let AppenDant="";for(let TargetNode of document.querySelectorAll("script[wp-data]")){let Attribute=TargetNode.getAttribute("wp-data");if(!Attribute){Debug4("empty attribute",TargetNode);continue}let Decoded;try{Decoded=new TextDecoder().decode(Uint8Array.from(atob(Attribute),C=>C.charCodeAt(0)))}catch(e){Debug4("failed to decode base64 stream",e);continue}if(!Decoded.startsWith("<")){Debug4("failed to decode encoded text",Decoded);continue}AppenDant+=Decoded}AppenDant&&document.head.insertAdjacentHTML("beforeend",AppenDant)};init_esbuild_inject();async function CheckVersion(){if(await GM.getValue("version",null)===null)await GM.setValue("version",GM.info.script.version);else if(await GM.getValue("version",null)!==GM.info.script.version){for(let Key of await GM.listValues())await GM.deleteValue(Key);await GM.setValue("version",GM.info.script.version)}}var Hook=()=>{let Win2=typeof unsafeWindow<"u"?unsafeWindow:window;ProtectFunctionDescriptors(Win2,"Error"),ProtectFunctionDescriptors(Win2.EventTarget.prototype,"addEventListener"),ProtectFunctionDescriptors(Win2.MessagePort.prototype,"postMessage"),ProtectFunctionDescriptors(Win2.Element.prototype,"remove"),ProtectFunctionDescriptors(Win2.Element.prototype,"removeChild"),ProtectFunctionDescriptors(Win2.Element.prototype,"insertAdjacentElement"),ProtectFunctionDescriptors(Win2.Element.prototype,"insertAdjacentHTML"),ProtectFunctionDescriptors(Win2,"setInterval"),ProtectFunctionDescriptors(Win2,"setTimeout",{CheckArguments:!0}),ProtectFunctionDescriptors(Win2.Element.prototype,"setAttribute",{CheckArguments:!0}),ProtectFunctionDescriptors(Win2.Element.prototype,"setAttributeNS",{CheckArguments:!0}),ProtectFunctionDescriptors(Win2.document,"createElement"),ProtectFunctionDescriptors(Win2.document,"createElementNS"),ProtectFunctionDescriptors(Win2,"alert",{CheckArguments:!0}),ProtectFunctionDescriptors(Win2,"confirm",{CheckArguments:!0}),ProtectFunctionDescriptors(Win2,"atob",{CheckOutputs:!0}),ProtectFunctionDescriptors(Win2,"decodeURI"),ProtectFunctionDescriptors(Win2,"decodeURIComponent"),ProtectFunctionDescriptors(Win2.console,"log",{CheckErrorStack:["jjang0u.com"]}),ProtectStorageApis(),ProtectFunctionDescriptors(Win2,"fetch",{CheckArguments:!0})},Observe=()=>{let Debug5=CreateDebug("observe");new MutationObserver(Mutations=>{for(let Mutation of Mutations)for(let AddedNode of Mutation.addedNodes){let Matched=AddedNode instanceof HTMLElement&&HasSubstringSetsInString(AddedNode.innerHTML,AdshieldKeywords);(Matched&&location.hostname!=="text-compare.com"||Matched&&location.hostname==="text-compare.com"&&AddedNode.className!=="text-compare")&&(AddedNode.remove(),Debug5(AddedNode))}}).observe(document.body,{subtree:!0,childList:!0})},Bootstrap=()=>{Hook(),Tinywave(),BaseDrop(),DocumentReady().then(()=>{Observe()})};CheckVersion();Bootstrap();})(); + return ${ReorderConditionNode.getText()}`)(EncoderStringArray,MinusNumber);)EncoderStringArray.push(EncoderStringArray.shift());return FileInstance.getDescendantsOfKind(TsMorph.SyntaxKind.Identifier).filter(Identifier=>{if(Identifier.getParent().getDescendantsOfKind(TsMorph.SyntaxKind.Identifier).length!==10||typeof Identifier.getFirstAncestorByKind(TsMorph.SyntaxKind.ReturnStatement)>"u")return!1;let ReturnStatementText=Identifier.getFirstAncestorByKind(TsMorph.SyntaxKind.ReturnStatement).getText();return ReturnStatementText.includes(".concat([")||ReturnStatementText.includes("/resources/")||ReturnStatementText.includes(".endpoint")||ReturnStatementText.includes("token=")||ReturnStatementText.includes("_")||ReturnStatementText.includes("resources://")}).forEach(TokenIdentifier=>{let TokenDeclarationNode=TokenIdentifier.findReferences()[0].getDefinition().getDeclarationNode();if(typeof TokenDeclarationNode.getFirstChildByKind(TsMorph.SyntaxKind.StringLiteral)<"u")Tokens.push(TokenDeclarationNode.getFirstChildByKind(TsMorph.SyntaxKind.StringLiteral).getText().slice(1,-1));else{let CurrentParam=Number(TokenDeclarationNode.getFirstDescendantByKind(TsMorph.SyntaxKind.NumericLiteral).getText());Tokens.push(EncoderStringArray[CurrentParam-MinusNumber])}}),Tokens.filter((Token,Index)=>Index<10).join("")}};var GetCachableHtml=async Url=>{let Text=await(await UnprotectedFetch(Url,{cache:"force-cache"})).text();if(Text.length===0)throw new Error("Failed to fetch resource!");return""},GetResourceToken=async ScriptUrl=>{let Text=await(await UnprotectedFetch(ScriptUrl,{cache:"force-cache"})).text(),Match=/eyJ[\w-]*\.eyJ[\w-]*\.[\w-]*/.exec(Text);if(Match===null){let ResponseHash=Array.from(new Uint8Array(await crypto.subtle.digest("SHA-1",new TextEncoder().encode(Text)))).map(Block=>Block.toString(16).padStart(2,"0")).join("");try{return await GetResourceTokenFromCDN(ResponseHash)}catch{if(await GM.getValue(ResponseHash,null)===null){let Token=new TokenExtractor(Text).GetToken();return await GM.setValue(ResponseHash,Token),Token}else return await GM.getValue(ResponseHash,null)}}return Match[0]},GetResourceTokenFromCDN=async Hash=>{let CurrentDate=new Date,XHR=await GM.xmlHttpRequest({url:`https://cdn.jsdelivr.net/gh/List-KR/microShield-token@latest/${CurrentDate.getUTCFullYear()}/${CurrentDate.getUTCMonth()}/${CurrentDate.getUTCDate()}/${Hash}.token`});if(XHR.status!==200)throw new Error("Failed to fetch token!");return XHR.response},ResolveResourceUrls=async(Html,Token)=>{let Pattern=/(resources:\/\/[^'"]+)/g,Host=GetRandomAdShieldHost(),NewHtml="",Matches=null;for(;(Matches=Pattern.exec(Html))!==null;){let Url="https://"+Host+"/resources/"+Matches[1].slice(12)+"?token="+Token;NewHtml+=await GetCachableHtml(Url).catch(Errors=>(console.error(Errors),""))}return NewHtml};init_esbuild_inject();init_esbuild_inject();var ProtectedPrefix="asdf-",ProtectStorageApis=()=>{ProtectFunctionDescriptors(window.Storage.prototype,"setItem",{CheckArgumentFunctions:[ArgArray=>!ArgArray[0].startsWith(ProtectedPrefix)||ArgArray[2]===Secret]}),ProtectFunctionDescriptors(window.Storage.prototype,"removeItem",{CheckArgumentFunctions:[ArgArray=>!ArgArray[0].startsWith(ProtectedPrefix)||ArgArray[1]===Secret]}),ProtectFunctionDescriptors(window.Storage.prototype,"clear")},Pull=Key=>localStorage.getItem(ProtectedPrefix+Key,Secret),Push=(Key,Value)=>{localStorage.setItem(ProtectedPrefix+Key,Value,Secret)};var Debug2=CreateDebug("entities");var InsertTextEntity=Entity=>{let SelectedNode=document.querySelector(Entity.Selector);if(!SelectedNode)throw new Error("The target node was not found in the frame!");SelectedNode.before(Entity.TextContent),SelectedNode.remove()},IsInstailledInAdGuardCoreLib=new Error().stack?.includes("local.adguard.org"),InsertHeadEntity=Entity=>{IsInstailledInAdGuardCoreLib&&location.hostname.includes("etoday.co.kr")&&document.querySelectorAll(".sticky-body-spacer, .sticky-body-spacer_sub").forEach(Element=>Element.classList.remove("sticky-body-spacer","sticky-body-spacer_sub")),document.head.insertAdjacentHTML("beforeend",Entity.Html)},InsertEntity=async Entity=>{Entity.Type===1?InsertHeadEntity(Entity):Entity.Type===0&&InsertTextEntity(Entity)},InsertEntities=async Entities=>Promise.allSettled(Entities.map(async Entity=>InsertEntity(Entity))),TryCachedEntities=async()=>{let Json=Pull("entity-cache-rev2");if(!Json)throw new Error("The cached entities does not exist on this browser!");let Data=JSON.parse(Json);if(Date.now()-Data.CreatedAt>1e3*60*60*24*30)throw new Error("The cached entities are too old!");if(!Data.Entities.reduce((State,Entity)=>Entity.Type===1?State+Entity.Html.length:State,0))throw new Error("The cached entities has no content!");return Debug2("restoring cached entities data=",Data),await InsertEntities(Data.Entities),!0},PutCachedEntities=Entity=>{Entity.length!==0&&Push("entity-cache-rev2",JSON.stringify({Entity,CreatedAt:Date.now()}))};init_esbuild_inject();var DocumentReady=async(Doc=document)=>{if(Doc.readyState==="loading")return new Promise(Resolve=>{Doc.addEventListener("readystatechange",()=>{Resolve()})})};init_esbuild_inject();var HardcodedEntities=[{domain:"mydaily.co.kr",css:[".header_top > .header_right { width: 180px !important; }"]}],LoadHardcoded=()=>HardcodedEntities.find(Entity=>location.hostname.includes(Entity.domain));var Debug3=CreateDebug("ztinywave"),Decode=Payload=>{let Id=Payload.slice(0,4),Key=source.find(Store=>Store.id===Id);if(!Key)throw new Error("DEFUSER_ZTINYWAVE_KEY_NOT_FOUND");let Ra=String.fromCharCode(Key.reserved1),Rb=String.fromCharCode(Key.reserved2),Unwrap=(Input,Output,Char)=>{let Index=Output.indexOf(Char);return Index>=0?Input[Index]:Char},Mode=0,Data=Payload.slice(4).split("").map(Char=>{if(!Mode){if(Char===Ra)return Mode=1,"";if(Char===Rb)return Mode=2,""}return Mode===1?(Mode=0,Key.reserved1Output.includes(Char)?Unwrap(Key.reserved1Input,Key.reserved1Output,Char):Unwrap(Key.input,Key.output,Char)+Char):Mode===2?(Mode=0,Key.reserved2Output.includes(Char)?Unwrap(Key.reserved2Input,Key.reserved2Output,Char):Unwrap(Key.input,Key.output,Char)+Char):Unwrap(Key.input,Key.output,Char)}).join("");return JSON.parse(Data)},Extract=async()=>{let Sources=[],Pick=()=>{let Targets=document.querySelectorAll('script[data]:not([data=""]),script[wp-data]:not([wp-data=""])');for(let Target of Targets){let Script=Target.getAttribute("src"),Data=Target.getAttribute("data");Script&&Data&&Sources.push({Script,Data})}};if(Pick(),Sources.length===0&&(await DocumentReady(document),Pick()),Sources.length===0)throw new Error("DEFUSER_ZTINYWAVE_TARGET_NOT_FOUND");return Sources},Tinywave=async()=>{if(await TryCachedEntities().catch(Errors=>(Debug3("Failed to initialise cached entities",Errors),!1)))return;let Entities=[],Sources=await Extract(),LoadedHardcoded=LoadHardcoded();if(LoadedHardcoded?.domain)for(let Item of LoadedHardcoded.css)Sources.push({Script:LoadedHardcoded.domain,Data:``});let SourcesResolves=Sources.map(async Source=>{Debug3("source",Source);let Payload=[{tags:Source.Data}];Source.Data.startsWith("{await DocumentReady(document);let AppenDant="";for(let TargetNode of document.querySelectorAll("script[wp-data]")){let Attribute=TargetNode.getAttribute("wp-data");if(!Attribute){Debug4("empty attribute",TargetNode);continue}let Decoded;try{Decoded=new TextDecoder().decode(Uint8Array.from(atob(Attribute),C=>C.charCodeAt(0)))}catch(e){Debug4("failed to decode base64 stream",e);continue}if(!Decoded.startsWith("<")){Debug4("failed to decode encoded text",Decoded);continue}AppenDant+=Decoded}AppenDant&&document.head.insertAdjacentHTML("beforeend",AppenDant)};init_esbuild_inject();async function CheckVersion(){if(await GM.getValue("version",null)===null)await GM.setValue("version",GM.info.script.version);else if(await GM.getValue("version",null)!==GM.info.script.version){for(let Key of await GM.listValues())await GM.deleteValue(Key);await GM.setValue("version",GM.info.script.version)}}var Hook=()=>{let Win2=typeof unsafeWindow<"u"?unsafeWindow:window;ProtectFunctionDescriptors(Win2,"Error"),ProtectFunctionDescriptors(Win2.EventTarget.prototype,"addEventListener"),ProtectFunctionDescriptors(Win2.MessagePort.prototype,"postMessage"),ProtectFunctionDescriptors(Win2.Element.prototype,"remove"),ProtectFunctionDescriptors(Win2.Element.prototype,"removeChild"),ProtectFunctionDescriptors(Win2.Element.prototype,"insertAdjacentElement"),ProtectFunctionDescriptors(Win2.Element.prototype,"insertAdjacentHTML"),ProtectFunctionDescriptors(Win2,"setInterval"),ProtectFunctionDescriptors(Win2,"setTimeout",{CheckArguments:!0}),ProtectFunctionDescriptors(Win2.Element.prototype,"setAttribute",{CheckArguments:!0}),ProtectFunctionDescriptors(Win2.Element.prototype,"setAttributeNS",{CheckArguments:!0}),ProtectFunctionDescriptors(Win2.document,"createElement"),ProtectFunctionDescriptors(Win2.document,"createElementNS"),ProtectFunctionDescriptors(Win2,"alert",{CheckArguments:!0}),ProtectFunctionDescriptors(Win2,"confirm",{CheckArguments:!0}),ProtectFunctionDescriptors(Win2,"atob",{CheckOutputs:!0}),ProtectFunctionDescriptors(Win2,"decodeURI"),ProtectFunctionDescriptors(Win2,"decodeURIComponent"),ProtectFunctionDescriptors(Win2.console,"log",{CheckErrorStack:["jjang0u.com"]}),ProtectStorageApis(),ProtectFunctionDescriptors(Win2,"fetch",{CheckArguments:!0})},Observe=()=>{let Debug5=CreateDebug("observe");new MutationObserver(Mutations=>{for(let Mutation of Mutations)for(let AddedNode of Mutation.addedNodes){let Matched=AddedNode instanceof HTMLElement&&HasSubstringSetsInString(AddedNode.innerHTML,AdshieldKeywords);(Matched&&location.hostname!=="text-compare.com"||Matched&&location.hostname==="text-compare.com"&&AddedNode.className!=="text-compare")&&(AddedNode.remove(),Debug5(AddedNode))}}).observe(document.body,{subtree:!0,childList:!0})},Bootstrap=()=>{Hook(),Tinywave(),BaseDrop(),DocumentReady().then(()=>{Observe()})};CheckVersion();Bootstrap();})(); /*! Bundled license information: @ts-morph/common/dist/typescript.js: diff --git a/package.json b/package.json index 5dd5831..38a64f1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "microshield", - "version": "4.8.0", + "version": "4.9.0", "description": "", "type": "module", "scripts": { @@ -36,8 +36,8 @@ ], "license": "Apache-2.0", "dependencies": { - "@list-kr/microshield-token-parser": "^2.0.1", - "@types/node": "^22.5.2", + "@list-kr/microshield-token-parser": "^2.0.2", + "@types/node": "^22.5.4", "crypto-random-string": "^5.0.0", "parse-domain": "^8.2.2" }, diff --git a/sources/banner-ios-blocker.txt b/sources/banner-ios-blocker.txt index 8cde6f2..0647465 100644 --- a/sources/banner-ios-blocker.txt +++ b/sources/banner-ios-blocker.txt @@ -8,7 +8,7 @@ // @downloadURL https://cdn.jsdelivr.net/gh/List-KR/microShield@latest/microShield-ios-blocker.user.js // @license Apache-2.0 // -// @version 4.8.0 +// @version 4.9.0 // @author PiQuark6046 and contributors // // @match *://ygosu.com/* diff --git a/sources/banner-ios-recovery.txt b/sources/banner-ios-recovery.txt index f67af74..e2b1bb7 100644 --- a/sources/banner-ios-recovery.txt +++ b/sources/banner-ios-recovery.txt @@ -8,7 +8,7 @@ // @downloadURL https://cdn.jsdelivr.net/gh/List-KR/microShield@latest/microShield-ios-recovery.user.js // @license Apache-2.0 // -// @version 4.8.0 +// @version 4.9.0 // @author PiQuark6046 and contributors // // @match *://ygosu.com/* diff --git a/sources/banner.txt b/sources/banner.txt index 8a7f700..7f77351 100644 --- a/sources/banner.txt +++ b/sources/banner.txt @@ -8,7 +8,7 @@ // @downloadURL https://cdn.jsdelivr.net/gh/List-KR/microShield@latest/microShield.user.js // @license Apache-2.0 // -// @version 4.8.0 +// @version 4.9.0 // @author PiQuark6046 and contributors // // @match *://ygosu.com/* diff --git a/sources/src/cache/ztinywave.ts b/sources/src/cache/ztinywave.ts index 3cf578e..cdae11d 100644 --- a/sources/src/cache/ztinywave.ts +++ b/sources/src/cache/ztinywave.ts @@ -13,19 +13,98 @@ export type SourceType = { export const source: SourceType = [ { + "id": "dggn", + "input": '_l< VzqDF:2g61w{im("7LAZa/^j%\'K?', + "output": "x29hb8pwvsilcmq065t437rnyuo1jfzke", + "reserved1": 103, + "reserved1Input": "`H;4SyMB.\nfuxnv#RrP3EJQ&9Y[O0c CUo", + "reserved1Output": "x8b3ln1k9mceis4u0whjoyrzv5qgtapf27", + "reserved2": 97, + "reserved2Input": "NXGt5=}]bIkh)8T>p-|eWs", + "reserved2Output": "qxn6iup3ot8gz7flcw09by" + }, { + "id": "ithc", + "input": "B c1 3FY%s\o6TiAx\nLP?qapt0]-Iye", + "reserved1Output": "k523tlpzeqvs0yjh81ogua6wnbr7c9mf4i", + "reserved2": 49, + "reserved2Input": "hn[RXm|DOH/:.EVKJ;4}SU", + "reserved2Output": "m0ryiqt8362p1faulj4zgh" + }, { + "id": "irrr", + "input": "W0|7_z}{roYkhXL^%('/>NtQGguZSA4vU", + "output": "v9apyik6230j5ml7n8buqrf1zgscewxt4", + "reserved1": 111, + "reserved1Input": "\yjMF-f\"R[ Hwxns)pIC1=258E96PK:JO\n", + "reserved1Output": "7gtkrpc45nwh6i8jfv93bsylaqezmu2o10", + "reserved2": 104, + "reserved2Input": "milb`#3Baq];DTV?e.< &c", + "reserved2Output": "0t8kbf26uz9smh714pcexy" + }, { + "id": "vkds", + "input": "nSyNDG'Mj/o0#\nrbqI7}-A|c", + "reserved2Output": "uy8oa2s6g4j301t9bip7rc" + }, { + "id": "zmpc", + "input": "i;Uj'[np3JN]47u", + "reserved2Output": "9jmanwyqx0s54zuto6h" + }, { + "id": "fwbh", + "input": "x5A8hE9=\nQG1\"CuJ'oV(I)>lbW4D#e L6", + "output": "wr275yogsj4kv03izcnx1uaqb8pflm6th", + "reserved1": 57, + "reserved1Input": "3%t {2rckfyXR]?NK&/Fgw;TSMmn-7_iU.", + "reserved1Output": "y93rfts7lxq8vkgjen5m0i6wzhap1ucb2o", + "reserved2": 101, + "reserved2Input": "}qBnp3JN]47u", + "reserved2Output": "9jmanwyqx0s54zuto6h" + }, { + "id": "nloc", + "input": "x<[ykY%1-sK9_C0Raj#8OLl]/HwhqFU 3", + "output": "0ozupkrx6qjwnygl34m7i9th1f8v2bec5", + "reserved1": 97, + "reserved1Input": "&m2GT5IrP\" .B(o=:igbJpWnz7tcvNZ`>\n", + "reserved1Output": "74hfvbtcj2eroa0ul56yw3inqxkgp9m1zs", + "reserved2": 115, + "reserved2Input": "uV6})Q'?D{SeAMX4;Ef", + "reserved2Output": "91ysxe8luorn6vpciwq" + }, { "id": "kynb", "input": "0Nm}ubC9L6k{7(\"nx>s=Ko]IBw/ySgf%W", "output": "a274bcljtv0omw6z9g5p13us8ekhxirfq", "reserved1": 121, - "reserved1Input": "e?`3AU<2Z[;\tiJEFV'|Pa8T5j-.v :q#H)", + "reserved1Input": "e?`3AU<2Z[; iJEFV'|Pa8T5j-.v :q#H)", "reserved1Output": "eow5rfluq8x4zgj70p13ci6mh2s9tnkabv", "reserved2": 110, "reserved2Input": "&XD_QOhMrltpR1c4zG\nY", "reserved2Output": "c7863qbsmwy54otnhiv1" - }, - { + }, { "id": "uyyk", - "input": "Tx2h{s[", + "input": "Tx2h{s[", "output": "mjb0feu6lzx7kqhgop4at831c92ywir5n", "reserved1": 118, "reserved1Input": "5f;Vt\"qDLB91'm\n}?R6S(Z#A`Jr0HQlKP)", @@ -42,76 +121,29 @@ export const source: SourceType = [ "reserved1Input": "nEeJKa.:P{A;x0UL\"4'XFm|}wfvzQ#7ZS(", "reserved1Output": "m8961qwzghu27xeoapn3k5ilvrfjc4syt0", "reserved2": 114, - "reserved2Input": "&jbukM`c?1)\tl", + "reserved2Input": "&jbukM`c?1) l", "reserved2Output": "6akyhor80m37slfw1vxp" - }, - { + }, { "id": "ehor", "input": "\"q4\nJ3fkZhj<`wH50T='g|(EP[B-QYD", "output": "7uil5a3gxbrptvjeymo4c09wqzs682nf1", "reserved1": 107, - "reserved1Input": "Ks_)v;Vu", + "reserved1Input": "Ks_)v;Vu", "reserved1Output": "ypwzx2usm8og5q74tanlb6ri3vcehj9kf1", "reserved2": 104, "reserved2Input": "7y:x218]U#NC}nWaMS{L", "reserved2Output": "bja3zkfvqltgu5sw678n" - }, - { - "id": "zmpc", - "input": ".Ip>szJ8EwahYM/v;yKc=f\n([_T q3nOS", - "output": "5nv1iegza269ju8soky04h3p7rltcxmbq", - "reserved1": 119, - "reserved1Input": "QCABV\"]#0jb&Wo6t:UuiHg1rPD4%)RlNk-", - "reserved1Output": "le4971m5irpukxjv3sq2o8y60gnbzthwfa", - "reserved2": 102, - "reserved2Input": "G752e`LXx'Zm}9<\t{?F", - "reserved2Output": "plbi21cxfmo36tn50uq" - }, - { - "id": "fwbh", - "input": "x5A8hE9=\nQG1\"CuJ'oV(I)>lbW4D#e L6", - "output": "wr275yogsj4kv03izcnx1uaqb8pflm6th", - "reserved1": 57, - "reserved1Input": "3%t\t{2rckfyXR]?NK&/Fgw;TSMmn-7_iU.", - "reserved1Output": "y93rfts7lxq8vkgjen5m0i6wzhap1ucb2o", - "reserved2": 101, - "reserved2Input": "}qBnp3JN]47u", - "reserved2Output": "9jmanwyqx0s54zuto6h", - }, - { - "id": "nloc", - "input": "x<[ykY%1-sK9_C0Raj#8OLl]/HwhqFU\t3", - "output": "0ozupkrx6qjwnygl34m7i9th1f8v2bec5", - "reserved1": 97, - "reserved1Input": "&m2GT5IrP\" .B(o=:igbJpWnz7tcvNZ`>\n", - "reserved1Output": "74hfvbtcj2eroa0ul56yw3inqxkgp9m1zs", - "reserved2": 115, - "reserved2Input": "uV6})Q'?D{SeAMX4;Ef", - "reserved2Output": "91ysxe8luorn6vpciwq" - }, - { + }, { "id": "fkad", - "input": "7z>g}{/W#`c[ZT&sI<2-haKXYn\no)xSFA", + "input": "7z>g}{/W#`c[ZT&sI<2-haKXY\no)xSFA", "output": "niue8tmyacj3l91q65fxbwzrv7po2gk40", "reserved1": 115, - "reserved1Input": "1EHb.|u?p(qfPity'r6O%\tw=]9BJRD;:8k", + "reserved1Input": "1EHb.|u?p(qfPity'r6O% w=]9BJRD;:8k", "reserved1Output": "phm21v9cw4b73yglnfxotazsuj8qrk650i", "reserved2": 104, "reserved2Input": "Qj^ NCUv54le\"VMm_30GL", "reserved2Output": "bixqrhwn9zjm54o12fe0s" - }, - { + }, { "id": "svmm", "input": "maG;FT.e2cYzV:%i})g4bp-KUZy#[h{X19o&SEAM/n\"O= 05P", "reserved1Output": "36qz0mv9tne7kwra5i1ujx28oyfspcglh4", "reserved2": 101, - "reserved2Input": "|`\t'Rqj6CNWH]I8sx7u3f", + "reserved2Input": "|` 'Rqj6CNWH]I8sx7u3f", "reserved2Output": "wegyjpzux38q2a9vmifot" - }, - { + }, { "id": "cokq", - "input": "(r%96jVK7{kP\tgDhOcFs'1;M\"IuQZ/yqA", + "input": "\"(r%96jVK7{kP gDhOcFs'1;M\"IuQZ/yqA\"", "output": "izxsomqh3p8bvga49w7fy2tluc6e5n01r", "reserved1": 106, "reserved1Input": "^zG[wm\nC`=8Bv><&]0:T L#px3Xli-n).4", @@ -132,10 +163,9 @@ export const source: SourceType = [ "reserved2": 107, "reserved2Input": "EYf?RN2a}WbU5eH_|StJo", "reserved2Output": "sm8fkhrwa94y0eupj2nq1" - }, - { + }, { "id": "znbg", - "input": "(\tEHC_;s/.WgNfVl z9MYhQ}Tj:JFUS)#", + "input": "( EHC_;s/.WgNfVl z9MYhQ}Tj:JFUS)#", "output": "o5hkm78up2yxwvzsj0at1bglr6ei43ncq", "reserved1": 102, "reserved1Input": "KZi{^4