zenstack 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4249,7 +4249,7 @@ Node text: ${this._forgottenText}`),new b.errors.InvalidOperationError(r)}return
4249
4249
  `)&&(p=p.replace(/\r?\n$/,"")));let f=Dpe(r,this,this.getChildren());qa({insertPos:f,newText:p,parent:this});let m=this.getChildren();return af(i,m,r,!0)}};function Gpe(e,r,n){if(b.errors.throwIfWhitespaceOrNotString(r,"newName"),e.getText()===r)return;let i=e._context.languageService.findRenameLocations(e,n),a=new b.KeyValueCache;for(let s of i)a.getOrCreate(s.getSourceFile(),()=>[]).push(s);for(let[s,u]of a.getEntries())p9e({sourceFile:s,renameLocations:u,newName:r})}function Bpe(e,r){let n=Fpe(e._getWriterWithIndentation(),r),i=e.getFirstChildByKindOrThrow(b.SyntaxKind.OpenBraceToken),a=e.getFirstChildByKindOrThrow(b.SyntaxKind.CloseBraceToken);qa({insertPos:i.getEnd(),newText:n,parent:e,replacing:{textLength:a.getStart()-i.getEnd()}})}function rG(e){return class extends e{getBody(){let r=this.compilerNode.body;if(r==null)throw new b.errors.InvalidOperationError("Bodied node should have a body.");return this._getNodeFromCompilerNode(r)}setBodyText(r){let n=this.getBody();return Bpe(n,r),this}getBodyText(){return nq(this.getBody())}}}function qT(e){return class extends e{getBodyOrThrow(){return b.errors.throwIfNullOrUndefined(this.getBody(),"Expected to find the node's body.")}getBody(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.body)}getBodyText(){let r=this.getBody();return r==null?void 0:nq(r)}setBodyText(r){return this.addBody(),Bpe(this.getBodyOrThrow(),r),this}hasBody(){return this.compilerNode.body!=null}addBody(){var r;if(this.hasBody())return this;let n=this.getLastChildByKind(b.SyntaxKind.SemicolonToken);return qa({parent:this,insertPos:n==null?this.getEnd():n.getStart(),newText:this._getWriterWithQueuedIndentation().space().block().toString(),replacing:{textLength:(r=n?.getFullWidth())!==null&&r!==void 0?r:0}}),this}removeBody(){let r=this.getBody();return r==null?this:(qa({parent:this,insertPos:r.getPos(),newText:";",replacing:{textLength:r.getFullWidth()}}),this)}}}function Im(e){return class extends e{setOrder(r){let n=this.getChildIndex(),i=this.getParentSyntaxList()||this.getParentSyntaxListOrThrow();return b.errors.throwIfOutOfRange(r,[0,i.getChildCount()-1],"order"),n===r?this:(a9e({parent:i,getSiblingFormatting:F7e,oldIndex:n,newIndex:r}),this)}}}function JT(e){return class extends e{getDecorator(r){return ic(this.getDecorators(),r)}getDecoratorOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getDecorator(r),()=>Ou("decorator",r))}getDecorators(){return fj(this.compilerNode).map(r=>this._getNodeFromCompilerNode(r))}addDecorator(r){return this.insertDecorator(ad(fj(this.compilerNode)),r)}addDecorators(r){return this.insertDecorators(ad(fj(this.compilerNode)),r)}insertDecorator(r,n){return this.insertDecorators(r,[n])[0]}insertDecorators(r,n){var i,a,s,u;if(b.ArrayUtils.isNullOrEmpty(n))return[];let p=y9e(this,n),f=this.getDecorators();r=ku(r,f.length);let m=v9e(this,f),g=f[r-1],D=G7e({structures:n,newCodes:p,parent:this,indentationText:this.getIndentationText(),getSeparator:()=>m,previousFormattingKind:g==null?El.None:m,nextFormattingKind:g==null?m:El.None});return qa({parent:(u=(a=(i=f[0])===null||i===void 0?void 0:i.getParentSyntaxListOrThrow())!==null&&a!==void 0?a:(s=this.getModifiers()[0])===null||s===void 0?void 0:s.getParentSyntaxListOrThrow())!==null&&u!==void 0?u:this,insertPos:f[r-1]==null?this.getStart():f[r-1].getEnd(),newText:D}),af(f,this.getDecorators(),r,!1)}set(r){return io(e.prototype,this,r),r.decorators!=null&&(this.getDecorators().forEach(n=>n.remove()),this.addDecorators(r.decorators)),this}getStructure(){return uo(e.prototype,this,{decorators:this.getDecorators().map(r=>r.getStructure())})}}}function fj(e){var r;return b.ts.canHaveDecorators(e)?(r=b.ts.getDecorators(e))!==null&&r!==void 0?r:[]:[]}function y9e(e,r){let n=[];for(let i of r){let a=e._getWriter();e._context.structurePrinterFactory.forDecorator().printText(a,i),n.push(a.toString())}return n}function v9e(e,r){return h9e(e,r)?El.Space:El.Newline}function h9e(e,r){if(r.length<=1)return e.getKind()===b.SyntaxKind.Parameter;let n=r[0].getStartLinePos();for(let i=1;i<r.length;i++)if(r[i].getStartLinePos()!==n)return!1;return!0}function SL(e){return class extends e{getDotDotDotTokenOrThrow(){return b.errors.throwIfNullOrUndefined(this.getDotDotDotToken(),"Expected to find a dot dot dot token (...).")}getDotDotDotToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.dotDotDotToken)}}}function iq(e){return class extends e{hasExclamationToken(){return this.compilerNode.exclamationToken!=null}getExclamationTokenNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.exclamationToken)}getExclamationTokenNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getExclamationTokenNode(),"Expected to find an exclamation token.")}setHasExclamationToken(r){let n=this.getExclamationTokenNode(),i=n!=null;if(r===i)return this;if(r){Tr.isQuestionTokenable(this)&&this.setHasQuestionToken(!1);let a=this.getFirstChildByKind(b.SyntaxKind.ColonToken);if(a==null)throw new b.errors.InvalidOperationError("Cannot add an exclamation token to a node that does not have a type.");qa({insertPos:a.getStart(),parent:this,newText:"!"})}else Bs({children:[n]});return this}set(r){return io(e.prototype,this,r),r.hasExclamationToken!=null&&this.setHasExclamationToken(r.hasExclamationToken),this}getStructure(){return uo(e.prototype,this,{hasExclamationToken:this.hasExclamationToken()})}}}function aq(e){return class extends e{hasExportKeyword(){return this.getExportKeyword()!=null}getExportKeyword(){if(Tr.isVariableDeclaration(this)){let r=this.getVariableStatement();return r?.getExportKeyword()}return Tr.isModifierable(this)?this.getFirstModifierByKind(b.SyntaxKind.ExportKeyword):Jfe()}getExportKeywordOrThrow(){return b.errors.throwIfNullOrUndefined(this.getExportKeyword(),"Expected to find an export keyword.")}hasDefaultKeyword(){return this.getDefaultKeyword()!=null}getDefaultKeyword(){if(Tr.isVariableDeclaration(this)){let r=this.getVariableStatement();return r?.getDefaultKeyword()}return Tr.isModifierable(this)?this.getFirstModifierByKind(b.SyntaxKind.DefaultKeyword):Jfe()}getDefaultKeywordOrThrow(){return b.errors.throwIfNullOrUndefined(this.getDefaultKeyword(),"Expected to find a default keyword.")}isExported(){if(this.hasExportKeyword())return!0;let r=this.getSymbol(),n=this.getSourceFile().getSymbol();return r==null||n==null?!1:n.getExports().some(i=>i===r||i.getAliasedSymbol()===r)}isDefaultExport(){if(this.hasDefaultKeyword())return!0;let r=this.getSymbol();if(r==null)return!1;let n=this.getSourceFile().getDefaultExportSymbol();if(n==null)return!1;if(r===n)return!0;let i=n.getAliasedSymbol();return r===i}isNamedExport(){let r=this.getSymbol(),n=this.getSourceFile().getSymbol();if(r==null||n==null)return!1;return!i()&&n.getExports().some(a=>a===r||a.getAliasedSymbol()===r);function i(){let a=n.getExport("default");return a==null?!1:r===a||r===a.getAliasedSymbol()}}}}function Jfe(){throw new b.errors.NotImplementedError("Not implemented situation where node was not a ModifierableNode.")}function BE(e){return E9e(aq(e))}function E9e(e){return class extends e{setIsDefaultExport(r){if(r===this.isDefaultExport())return this;if(r&&!Tr.isSourceFile(this.getParentOrThrow()))throw new b.errors.InvalidOperationError("The parent must be a source file in order to set this node as a default export.");let n=this.getSourceFile(),i=n.getDefaultExportSymbol();if(i!=null&&n.removeDefaultExport(i),!r)return this;if(Tr.hasName(this)&&a.call(this)){let s=this.getFirstAncestorByKindOrThrow(b.SyntaxKind.SyntaxList),u=this.getName();s.insertChildText(this.getChildIndex()+1,p=>{p.newLine().write(`export default ${u};`)})}else this.addModifier("export"),this.addModifier("default");return this;function a(){return!!(Tr.isEnumDeclaration(this)||Tr.isModuleDeclaration(this)||Tr.isTypeAliasDeclaration(this)||Tr.isAmbientable(this)&&this.isAmbient())}}setIsExported(r){return Tr.isSourceFile(this.getParentOrThrow())&&this.toggleModifier("default",!1),this.toggleModifier("export",r),this}set(r){return io(e.prototype,this,r),r.isExported!=null&&this.setIsExported(r.isExported),r.isDefaultExport!=null&&this.setIsDefaultExport(r.isDefaultExport),this}getStructure(){return uo(e.prototype,this,{isExported:this.hasExportKeyword(),isDefaultExport:this.hasDefaultKeyword()})}}}var of=class{printTextOrWriterFunc(r,n){typeof n=="string"?r.write(n):n?.(r)}getNewWriter(r){return new YR.default(r.getOptions())}getNewWriterWithQueuedChildIndentation(r){let n=new YR.default(r.getOptions());return n.queueIndentationLevel(1),n}getText(r,n){let i=this.getNewWriter(r);return this.printTextOrWriterFunc(i,n),i.toString()}getTextWithQueuedChildIndentation(r,n){let i=this.getNewWriterWithQueuedChildIndentation(r);return this.printTextOrWriterFunc(i,n),i.toString()}},Uj=class extends of{printText(r,n){let{initializer:i}=n;if(i==null)return;let a=this.getText(r,i);b.StringUtils.isNullOrWhitespace(a)||r.hangingIndent(()=>{r.spaceIfLastNot(),r.write(`= ${a}`)})}},Kj=class extends of{printText(r,n){let i=n.scope;n.isDefaultExport?r.write("export default "):n.isExported&&r.write("export "),n.hasDeclareKeyword&&r.write("declare "),i!=null&&r.write(`${i} `),n.isStatic&&r.write("static "),n.hasOverrideKeyword&&r.write("override "),n.isAbstract&&r.write("abstract "),n.isAsync&&r.write("async "),n.isReadonly&&r.write("readonly ")}},Wj=class extends of{constructor(r=!1){super(),this.alwaysWrite=r}printText(r,n){let{returnType:i}=n;if(i==null&&this.alwaysWrite===!1)return;i=i??"void";let a=this.getText(r,i);b.StringUtils.isNullOrWhitespace(a)||r.hangingIndent(()=>{r.write(`: ${a}`)})}},Vj=class extends of{constructor(r,n=!1){super(),this.separator=r,this.alwaysWrite=n}printText(r,n){let{type:i}=n;if(i==null&&this.alwaysWrite===!1)return;i=i??"any";let a=this.getText(r,i);b.StringUtils.isNullOrWhitespace(a)||r.hangingIndent(()=>{r.write(`${this.separator} ${a}`)})}},cS=class extends of{constructor(r){super(),this.printer=r}printText(r,n){if(n!=null)for(let i=0;i<n.length;i++)r.conditionalBlankLine(i>0),this.printer.printText(r,n[i])}},Nh=class extends of{constructor(r){super(),this.printer=r}printText(r,n){Upe(this.printer,r,n,()=>r.spaceIfLastNot())}};function Upe(e,r,n,i){if(n!=null)if(n instanceof Function||typeof n=="string")e.printText(r,n);else{let a=new Array(n.length);for(let u=0;u<n.length;u++){u>0&&i();let p=n[u],f=r.getLength();e.printText(r,p);let m=bpe(bj.getLastCharactersToPos(r,f));a[u]=m===-1?!1:m+f}let s=!1;for(let u=a.length-1;u>=0;u--){let p=a[u];p!==!1&&(s?r.unsafeInsert(p,","):s=!0)}}}var BT=class extends of{constructor(r){super(),this.printer=r}printText(r,n){Upe(this.printer,r,n,()=>r.newLineIfLastNot())}},q_=class extends of{constructor(r){super(),this.printer=r}printText(r,n){if(n!=null)for(let i=0;i<n.length;i++)r.conditionalNewLine(i>0),this.printer.printText(r,n[i])}},jj=class extends of{constructor(r){super(),this.printer=r}printText(r,n){if(n!=null)for(let i=0;i<n.length;i++)r.conditionalWrite(i>0," "),this.printer.printText(r,n[i])}},Is=class extends of{constructor(r){super(),this.factory=r}printTextWithoutTrivia(r,n){this.printTextInternal(r,n)}printText(r,n){this.printLeadingTrivia(r,n),r.closeComment(),this.printTextInternal(r,n),this.printTrailingTrivia(r,n)}printLeadingTrivia(r,n){let i=n.leadingTrivia;i!=null&&(this.printTrivia(r,i),r.isInComment()&&r.closeComment())}printTrailingTrivia(r,n){let i=n.trailingTrivia;i!=null&&this.printTrivia(r,i)}printTrivia(r,n){if(n instanceof Array)for(let i=0;i<n.length;i++)this.printTextOrWriterFunc(r,n[i]),i!==n.length-1&&r.newLineIfLastNot();else this.printTextOrWriterFunc(r,n)}},Hj=class extends Is{constructor(r,n){super(r),this.options=n,this.multipleWriter=new cS(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){let i=n.hasDeclareKeyword||this.options.isAmbient;this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forDecorator().printTexts(r,n.decorators),this.printHeader(r,n),r.inlineBlock(()=>{this.factory.forPropertyDeclaration().printTexts(r,n.properties),this.printCtors(r,n,i),this.printGetAndSet(r,n,i),b.ArrayUtils.isNullOrEmpty(n.methods)||(this.conditionalSeparator(r,i),this.factory.forMethodDeclaration({isAmbient:i}).printTexts(r,n.methods))})}printHeader(r,n){this.factory.forModifierableNode().printText(r,n),r.write("class"),b.StringUtils.isNullOrWhitespace(n.name)||r.space().write(n.name),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(r,n.typeParameters),r.space(),r.hangingIndent(()=>{if(n.extends!=null){let i=this.getText(r,n.extends);b.StringUtils.isNullOrWhitespace(i)||r.write(`extends ${i} `)}if(n.implements!=null){let i=n.implements instanceof Array?n.implements.map(a=>this.getText(r,a)).join(", "):this.getText(r,n.implements);b.StringUtils.isNullOrWhitespace(i)||r.write(`implements ${i} `)}})}printCtors(r,n,i){if(!b.ArrayUtils.isNullOrEmpty(n.ctors))for(let a of n.ctors)this.conditionalSeparator(r,i),this.factory.forConstructorDeclaration({isAmbient:i}).printText(r,a)}printGetAndSet(r,n,i){var a,s;let u=[...(a=n.getAccessors)!==null&&a!==void 0?a:[]],p=[...(s=n.setAccessors)!==null&&s!==void 0?s:[]],f=this.factory.forGetAccessorDeclaration({isAmbient:i}),m=this.factory.forSetAccessorDeclaration({isAmbient:i});for(let g of u){this.conditionalSeparator(r,i),f.printText(r,g);let D=p.findIndex(P=>P.name===g.name);D>=0&&(this.conditionalSeparator(r,i),m.printText(r,p[D]),p.splice(D,1))}for(let g of p)this.conditionalSeparator(r,i),m.printText(r,g)}conditionalSeparator(r,n){r.isAtStartOfFirstLineOfBlock()||(n?r.newLine():r.blankLine())}};Oe.StructureKind=void 0;(function(e){e[e.AssertEntry=0]="AssertEntry",e[e.CallSignature=1]="CallSignature",e[e.Class=2]="Class",e[e.ClassStaticBlock=3]="ClassStaticBlock",e[e.ConstructSignature=4]="ConstructSignature",e[e.Constructor=5]="Constructor",e[e.ConstructorOverload=6]="ConstructorOverload",e[e.Decorator=7]="Decorator",e[e.Enum=8]="Enum",e[e.EnumMember=9]="EnumMember",e[e.ExportAssignment=10]="ExportAssignment",e[e.ExportDeclaration=11]="ExportDeclaration",e[e.ExportSpecifier=12]="ExportSpecifier",e[e.Function=13]="Function",e[e.FunctionOverload=14]="FunctionOverload",e[e.GetAccessor=15]="GetAccessor",e[e.ImportDeclaration=16]="ImportDeclaration",e[e.ImportSpecifier=17]="ImportSpecifier",e[e.IndexSignature=18]="IndexSignature",e[e.Interface=19]="Interface",e[e.JsxAttribute=20]="JsxAttribute",e[e.JsxSpreadAttribute=21]="JsxSpreadAttribute",e[e.JsxElement=22]="JsxElement",e[e.JsxSelfClosingElement=23]="JsxSelfClosingElement",e[e.JSDoc=24]="JSDoc",e[e.JSDocTag=25]="JSDocTag",e[e.Method=26]="Method",e[e.MethodOverload=27]="MethodOverload",e[e.MethodSignature=28]="MethodSignature",e[e.Module=29]="Module",e[e.Parameter=30]="Parameter",e[e.Property=31]="Property",e[e.PropertyAssignment=32]="PropertyAssignment",e[e.PropertySignature=33]="PropertySignature",e[e.SetAccessor=34]="SetAccessor",e[e.ShorthandPropertyAssignment=35]="ShorthandPropertyAssignment",e[e.SourceFile=36]="SourceFile",e[e.SpreadAssignment=37]="SpreadAssignment",e[e.TypeAlias=38]="TypeAlias",e[e.TypeParameter=39]="TypeParameter",e[e.VariableDeclaration=40]="VariableDeclaration",e[e.VariableStatement=41]="VariableStatement"})(Oe.StructureKind||(Oe.StructureKind={}));var tL={hasName(e){return typeof e.name=="string"},isAssertEntry(e){return e?.kind===Oe.StructureKind.AssertEntry},isAssertionKeyNamed(e){return e?.kind===Oe.StructureKind.AssertEntry},isCallSignature(e){return e?.kind===Oe.StructureKind.CallSignature},isJSDocable(e){switch(e?.kind){case Oe.StructureKind.CallSignature:case Oe.StructureKind.Class:case Oe.StructureKind.ClassStaticBlock:case Oe.StructureKind.ConstructorOverload:case Oe.StructureKind.Constructor:case Oe.StructureKind.ConstructSignature:case Oe.StructureKind.Enum:case Oe.StructureKind.EnumMember:case Oe.StructureKind.FunctionOverload:case Oe.StructureKind.Function:case Oe.StructureKind.GetAccessor:case Oe.StructureKind.IndexSignature:case Oe.StructureKind.Interface:case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:case Oe.StructureKind.MethodSignature:case Oe.StructureKind.Module:case Oe.StructureKind.Property:case Oe.StructureKind.PropertySignature:case Oe.StructureKind.SetAccessor:case Oe.StructureKind.TypeAlias:case Oe.StructureKind.VariableStatement:return!0;default:return!1}},isSignatured(e){switch(e?.kind){case Oe.StructureKind.CallSignature:case Oe.StructureKind.ConstructorOverload:case Oe.StructureKind.Constructor:case Oe.StructureKind.ConstructSignature:case Oe.StructureKind.FunctionOverload:case Oe.StructureKind.Function:case Oe.StructureKind.GetAccessor:case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:case Oe.StructureKind.MethodSignature:case Oe.StructureKind.SetAccessor:return!0;default:return!1}},isParametered(e){switch(e?.kind){case Oe.StructureKind.CallSignature:case Oe.StructureKind.ConstructorOverload:case Oe.StructureKind.Constructor:case Oe.StructureKind.ConstructSignature:case Oe.StructureKind.FunctionOverload:case Oe.StructureKind.Function:case Oe.StructureKind.GetAccessor:case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:case Oe.StructureKind.MethodSignature:case Oe.StructureKind.SetAccessor:return!0;default:return!1}},isReturnTyped(e){switch(e?.kind){case Oe.StructureKind.CallSignature:case Oe.StructureKind.ConstructorOverload:case Oe.StructureKind.Constructor:case Oe.StructureKind.ConstructSignature:case Oe.StructureKind.FunctionOverload:case Oe.StructureKind.Function:case Oe.StructureKind.GetAccessor:case Oe.StructureKind.IndexSignature:case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:case Oe.StructureKind.MethodSignature:case Oe.StructureKind.SetAccessor:return!0;default:return!1}},isTypeParametered(e){switch(e?.kind){case Oe.StructureKind.CallSignature:case Oe.StructureKind.Class:case Oe.StructureKind.ConstructorOverload:case Oe.StructureKind.Constructor:case Oe.StructureKind.ConstructSignature:case Oe.StructureKind.FunctionOverload:case Oe.StructureKind.Function:case Oe.StructureKind.GetAccessor:case Oe.StructureKind.Interface:case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:case Oe.StructureKind.MethodSignature:case Oe.StructureKind.SetAccessor:case Oe.StructureKind.TypeAlias:return!0;default:return!1}},isClass(e){return e?.kind===Oe.StructureKind.Class},isClassLikeDeclarationBase(e){return e?.kind===Oe.StructureKind.Class},isNameable(e){switch(e?.kind){case Oe.StructureKind.Class:case Oe.StructureKind.Function:return!0;default:return!1}},isImplementsClauseable(e){return e?.kind===Oe.StructureKind.Class},isDecoratable(e){switch(e?.kind){case Oe.StructureKind.Class:case Oe.StructureKind.GetAccessor:case Oe.StructureKind.Method:case Oe.StructureKind.Parameter:case Oe.StructureKind.Property:case Oe.StructureKind.SetAccessor:return!0;default:return!1}},isAbstractable(e){switch(e?.kind){case Oe.StructureKind.Class:case Oe.StructureKind.GetAccessor:case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:case Oe.StructureKind.Property:case Oe.StructureKind.SetAccessor:return!0;default:return!1}},isAmbientable(e){switch(e?.kind){case Oe.StructureKind.Class:case Oe.StructureKind.Enum:case Oe.StructureKind.FunctionOverload:case Oe.StructureKind.Function:case Oe.StructureKind.Interface:case Oe.StructureKind.Module:case Oe.StructureKind.Property:case Oe.StructureKind.TypeAlias:case Oe.StructureKind.VariableStatement:return!0;default:return!1}},isExportable(e){switch(e?.kind){case Oe.StructureKind.Class:case Oe.StructureKind.Enum:case Oe.StructureKind.FunctionOverload:case Oe.StructureKind.Function:case Oe.StructureKind.Interface:case Oe.StructureKind.Module:case Oe.StructureKind.TypeAlias:case Oe.StructureKind.VariableStatement:return!0;default:return!1}},isClassStaticBlock(e){return e?.kind===Oe.StructureKind.ClassStaticBlock},isStatemented(e){switch(e?.kind){case Oe.StructureKind.ClassStaticBlock:case Oe.StructureKind.Constructor:case Oe.StructureKind.Function:case Oe.StructureKind.GetAccessor:case Oe.StructureKind.Method:case Oe.StructureKind.Module:case Oe.StructureKind.SetAccessor:case Oe.StructureKind.SourceFile:return!0;default:return!1}},isConstructorDeclarationOverload(e){return e?.kind===Oe.StructureKind.ConstructorOverload},isScoped(e){switch(e?.kind){case Oe.StructureKind.ConstructorOverload:case Oe.StructureKind.Constructor:case Oe.StructureKind.GetAccessor:case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:case Oe.StructureKind.Property:case Oe.StructureKind.SetAccessor:return!0;default:return!1}},isConstructor(e){return e?.kind===Oe.StructureKind.Constructor},isFunctionLike(e){switch(e?.kind){case Oe.StructureKind.Constructor:case Oe.StructureKind.Function:case Oe.StructureKind.GetAccessor:case Oe.StructureKind.Method:case Oe.StructureKind.SetAccessor:return!0;default:return!1}},isConstructSignature(e){return e?.kind===Oe.StructureKind.ConstructSignature},isDecorator(e){return e?.kind===Oe.StructureKind.Decorator},isEnum(e){return e?.kind===Oe.StructureKind.Enum},isNamed(e){switch(e?.kind){case Oe.StructureKind.Enum:case Oe.StructureKind.Interface:case Oe.StructureKind.JsxAttribute:case Oe.StructureKind.ShorthandPropertyAssignment:case Oe.StructureKind.TypeAlias:case Oe.StructureKind.TypeParameter:return!0;default:return!1}},isEnumMember(e){return e?.kind===Oe.StructureKind.EnumMember},isPropertyNamed(e){switch(e?.kind){case Oe.StructureKind.EnumMember:case Oe.StructureKind.GetAccessor:case Oe.StructureKind.Method:case Oe.StructureKind.MethodSignature:case Oe.StructureKind.PropertyAssignment:case Oe.StructureKind.Property:case Oe.StructureKind.PropertySignature:case Oe.StructureKind.SetAccessor:return!0;default:return!1}},isInitializerExpressionable(e){switch(e?.kind){case Oe.StructureKind.EnumMember:case Oe.StructureKind.Parameter:case Oe.StructureKind.Property:case Oe.StructureKind.PropertySignature:case Oe.StructureKind.VariableDeclaration:return!0;default:return!1}},isExportAssignment(e){return e?.kind===Oe.StructureKind.ExportAssignment},isExportDeclaration(e){return e?.kind===Oe.StructureKind.ExportDeclaration},isExportSpecifier(e){return e?.kind===Oe.StructureKind.ExportSpecifier},isFunctionDeclarationOverload(e){return e?.kind===Oe.StructureKind.FunctionOverload},isAsyncable(e){switch(e?.kind){case Oe.StructureKind.FunctionOverload:case Oe.StructureKind.Function:case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:return!0;default:return!1}},isGeneratorable(e){switch(e?.kind){case Oe.StructureKind.FunctionOverload:case Oe.StructureKind.Function:case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:return!0;default:return!1}},isFunction(e){return e?.kind===Oe.StructureKind.Function},isGetAccessor(e){return e?.kind===Oe.StructureKind.GetAccessor},isStaticable(e){switch(e?.kind){case Oe.StructureKind.GetAccessor:case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:case Oe.StructureKind.Property:case Oe.StructureKind.SetAccessor:return!0;default:return!1}},isImportDeclaration(e){return e?.kind===Oe.StructureKind.ImportDeclaration},isImportSpecifier(e){return e?.kind===Oe.StructureKind.ImportSpecifier},isIndexSignature(e){return e?.kind===Oe.StructureKind.IndexSignature},isReadonlyable(e){switch(e?.kind){case Oe.StructureKind.IndexSignature:case Oe.StructureKind.Parameter:case Oe.StructureKind.Property:case Oe.StructureKind.PropertySignature:return!0;default:return!1}},isInterface(e){return e?.kind===Oe.StructureKind.Interface},isExtendsClauseable(e){return e?.kind===Oe.StructureKind.Interface},isTypeElementMembered(e){return e?.kind===Oe.StructureKind.Interface},isJSDoc(e){return e?.kind===Oe.StructureKind.JSDoc},isJSDocTag(e){return e?.kind===Oe.StructureKind.JSDocTag},isJsxAttribute(e){return e?.kind===Oe.StructureKind.JsxAttribute},isJsxElement(e){return e?.kind===Oe.StructureKind.JsxElement},isJsxSelfClosingElement(e){return e?.kind===Oe.StructureKind.JsxSelfClosingElement},isJsxTagNamed(e){return e?.kind===Oe.StructureKind.JsxSelfClosingElement},isJsxAttributed(e){return e?.kind===Oe.StructureKind.JsxSelfClosingElement},isJsxSpreadAttribute(e){return e?.kind===Oe.StructureKind.JsxSpreadAttribute},isMethodDeclarationOverload(e){return e?.kind===Oe.StructureKind.MethodOverload},isQuestionTokenable(e){switch(e?.kind){case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:case Oe.StructureKind.MethodSignature:case Oe.StructureKind.Parameter:case Oe.StructureKind.Property:case Oe.StructureKind.PropertySignature:return!0;default:return!1}},isOverrideable(e){switch(e?.kind){case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:case Oe.StructureKind.Parameter:case Oe.StructureKind.Property:return!0;default:return!1}},isMethod(e){return e?.kind===Oe.StructureKind.Method},isMethodSignature(e){return e?.kind===Oe.StructureKind.MethodSignature},isModule(e){return e?.kind===Oe.StructureKind.Module},isModuleNamed(e){return e?.kind===Oe.StructureKind.Module},isParameter(e){return e?.kind===Oe.StructureKind.Parameter},isBindingNamed(e){switch(e?.kind){case Oe.StructureKind.Parameter:case Oe.StructureKind.VariableDeclaration:return!0;default:return!1}},isTyped(e){switch(e?.kind){case Oe.StructureKind.Parameter:case Oe.StructureKind.Property:case Oe.StructureKind.PropertySignature:case Oe.StructureKind.TypeAlias:case Oe.StructureKind.VariableDeclaration:return!0;default:return!1}},isScopeable(e){return e?.kind===Oe.StructureKind.Parameter},isPropertyAssignment(e){return e?.kind===Oe.StructureKind.PropertyAssignment},isProperty(e){return e?.kind===Oe.StructureKind.Property},isExclamationTokenable(e){switch(e?.kind){case Oe.StructureKind.Property:case Oe.StructureKind.VariableDeclaration:return!0;default:return!1}},isPropertySignature(e){return e?.kind===Oe.StructureKind.PropertySignature},isSetAccessor(e){return e?.kind===Oe.StructureKind.SetAccessor},isShorthandPropertyAssignment(e){return e?.kind===Oe.StructureKind.ShorthandPropertyAssignment},isSourceFile(e){return e?.kind===Oe.StructureKind.SourceFile},isSpreadAssignment(e){return e?.kind===Oe.StructureKind.SpreadAssignment},isExpressioned(e){return e?.kind===Oe.StructureKind.SpreadAssignment},isTypeAlias(e){return e?.kind===Oe.StructureKind.TypeAlias},isTypeParameter(e){return e?.kind===Oe.StructureKind.TypeParameter},isVariableDeclaration(e){return e?.kind===Oe.StructureKind.VariableDeclaration},isVariableStatement(e){return e?.kind===Oe.StructureKind.VariableStatement}};function b9e(e,r){if(b.ArrayUtils.isReadonlyArray(e)){for(let n of e){let i=r(n);if(i)return i}return}switch(e.kind){case Oe.StructureKind.CallSignature:return S9e(e,r);case Oe.StructureKind.Class:return x9e(e,r);case Oe.StructureKind.ClassStaticBlock:return C9e(e,r);case Oe.StructureKind.ConstructorOverload:return A9e(e,r);case Oe.StructureKind.Constructor:return L9e(e,r);case Oe.StructureKind.ConstructSignature:return N9e(e,r);case Oe.StructureKind.Enum:return I9e(e,r);case Oe.StructureKind.EnumMember:return P9e(e,r);case Oe.StructureKind.ExportDeclaration:return O9e(e,r);case Oe.StructureKind.FunctionOverload:return k9e(e,r);case Oe.StructureKind.Function:return R9e(e,r);case Oe.StructureKind.GetAccessor:return M9e(e,r);case Oe.StructureKind.ImportDeclaration:return w9e(e,r);case Oe.StructureKind.IndexSignature:return F9e(e,r);case Oe.StructureKind.Interface:return G9e(e,r);case Oe.StructureKind.JSDoc:return U9e(e,r);case Oe.StructureKind.JsxElement:return K9e(e,r);case Oe.StructureKind.JsxSelfClosingElement:return W9e(e,r);case Oe.StructureKind.MethodOverload:return j9e(e,r);case Oe.StructureKind.Method:return H9e(e,r);case Oe.StructureKind.MethodSignature:return q9e(e,r);case Oe.StructureKind.Module:return J9e(e,r);case Oe.StructureKind.Parameter:return z9e(e,r);case Oe.StructureKind.Property:return $9e(e,r);case Oe.StructureKind.PropertySignature:return X9e(e,r);case Oe.StructureKind.SetAccessor:return Y9e(e,r);case Oe.StructureKind.SourceFile:return Q9e(e,r);case Oe.StructureKind.TypeAlias:return Z9e(e,r);case Oe.StructureKind.VariableStatement:return eUe(e,r);default:return}}function S9e(e,r){return Pf(e,r)||zT(e,r)||Ph(e,r)}function Pf(e,r){return nG(e.docs,r,Oe.StructureKind.JSDoc)}function zT(e,r){return T9e(e,r)}function T9e(e,r){return kd(e.parameters,r,Oe.StructureKind.Parameter)}function Ph(e,r){return nG(e.typeParameters,r,Oe.StructureKind.TypeParameter)}function x9e(e,r){return D9e(e,r)}function D9e(e,r){return HD(e,r)||Ph(e,r)||Pf(e,r)||kd(e.ctors,r,Oe.StructureKind.Constructor)||kd(e.properties,r,Oe.StructureKind.Property)||kd(e.getAccessors,r,Oe.StructureKind.GetAccessor)||kd(e.setAccessors,r,Oe.StructureKind.SetAccessor)||kd(e.methods,r,Oe.StructureKind.Method)}function HD(e,r){return kd(e.decorators,r,Oe.StructureKind.Decorator)}function C9e(e,r){return Pf(e,r)||tG(e,r)}function tG(e,r){return lM(e.statements,r)}function A9e(e,r){return zT(e,r)||Ph(e,r)||Pf(e,r)}function L9e(e,r){return TL(e,r)||kd(e.overloads,r,Oe.StructureKind.ConstructorOverload)}function TL(e,r){return zT(e,r)||Ph(e,r)||Pf(e,r)||tG(e,r)}function N9e(e,r){return Pf(e,r)||zT(e,r)||Ph(e,r)}function I9e(e,r){return Pf(e,r)||kd(e.members,r,Oe.StructureKind.EnumMember)}function P9e(e,r){return Pf(e,r)}function O9e(e,r){return nG(e.namedExports,r,Oe.StructureKind.ExportSpecifier)||kd(e.assertElements,r,Oe.StructureKind.AssertEntry)}function k9e(e,r){return zT(e,r)||Ph(e,r)||Pf(e,r)}function R9e(e,r){return TL(e,r)||kd(e.overloads,r,Oe.StructureKind.FunctionOverload)}function M9e(e,r){return HD(e,r)||TL(e,r)}function w9e(e,r){return nG(e.namedImports,r,Oe.StructureKind.ImportSpecifier)||kd(e.assertElements,r,Oe.StructureKind.AssertEntry)}function F9e(e,r){return Pf(e,r)}function G9e(e,r){return Ph(e,r)||Pf(e,r)||B9e(e,r)}function B9e(e,r){return kd(e.callSignatures,r,Oe.StructureKind.CallSignature)||kd(e.constructSignatures,r,Oe.StructureKind.ConstructSignature)||kd(e.indexSignatures,r,Oe.StructureKind.IndexSignature)||kd(e.methods,r,Oe.StructureKind.MethodSignature)||kd(e.properties,r,Oe.StructureKind.PropertySignature)}function U9e(e,r){return kd(e.tags,r,Oe.StructureKind.JSDocTag)}function K9e(e,r){return lM(e.attributes,r)||lM(e.children,r)}function W9e(e,r){return V9e(e,r)}function V9e(e,r){return lM(e.attributes,r)}function j9e(e,r){return zT(e,r)||Ph(e,r)||Pf(e,r)}function H9e(e,r){return HD(e,r)||TL(e,r)||kd(e.overloads,r,Oe.StructureKind.MethodOverload)}function q9e(e,r){return Pf(e,r)||zT(e,r)||Ph(e,r)}function J9e(e,r){return Pf(e,r)||tG(e,r)}function z9e(e,r){return HD(e,r)}function $9e(e,r){return Pf(e,r)||HD(e,r)}function X9e(e,r){return Pf(e,r)}function Y9e(e,r){return HD(e,r)||TL(e,r)}function Q9e(e,r){return tG(e,r)}function Z9e(e,r){return Ph(e,r)||Pf(e,r)}function eUe(e,r){return Pf(e,r)||kd(e.declarations,r,Oe.StructureKind.VariableDeclaration)}function kd(e,r,n){if(e!=null)for(let i of e){let a=r(Kpe(i,n));if(a)return a}}function nG(e,r,n){if(!(e==null||!(e instanceof Array))){for(let i of e)if(Wpe(i)){let a=r(Kpe(i,n));if(a)return a}}}function lM(e,r){if(!(e==null||!(e instanceof Array))){for(let n of e)if(Wpe(n)){let i=r(n);if(i)return i}}}function Kpe(e,r){return e.kind==null&&(e.kind=r),e}function Wpe(e){return e!=null&&typeof e.kind=="number"}function oq(e){return e.iterateLastCharCodes(r=>r===ac.CLOSE_BRACE?!0:b.StringUtils.isWhitespaceCharCode(r)?void 0:!1)||!1}var qj=class extends of{constructor(r,n){super(),this.factory=r,this.options=n}printTexts(r,n){if(n!=null)if(typeof n=="string"||n instanceof Function)this.printText(r,n);else for(let i of n)oq(r)?r.blankLineIfLastNot():r.isAtStartOfFirstLineOfBlock()||r.newLineIfLastNot(),this.printText(r,i)}printText(r,n){if(typeof n=="string"||n instanceof Function||n==null){this.printTextOrWriterFunc(r,n);return}switch(n.kind){case Oe.StructureKind.Method:this.options.isAmbient||i(),this.factory.forMethodDeclaration(this.options).printText(r,n);break;case Oe.StructureKind.Property:this.factory.forPropertyDeclaration().printText(r,n);break;case Oe.StructureKind.GetAccessor:this.options.isAmbient||i(),this.factory.forGetAccessorDeclaration(this.options).printText(r,n);break;case Oe.StructureKind.SetAccessor:this.options.isAmbient||i(),this.factory.forSetAccessorDeclaration(this.options).printText(r,n);break;case Oe.StructureKind.Constructor:this.options.isAmbient||i(),this.factory.forConstructorDeclaration(this.options).printText(r,n);break;case Oe.StructureKind.ClassStaticBlock:i(),this.factory.forClassStaticBlockDeclaration().printText(r,n);break;default:b.errors.throwNotImplementedForNeverValueError(n)}function i(){r.isAtStartOfFirstLineOfBlock()||r.blankLineIfLastNot()}}},Jj=class extends Is{constructor(r){super(r)}printTexts(r,n){if(n!=null)for(let i=0;i<n.length;i++)i>0&&r.blankLine(),this.printText(r,n[i])}printTextInternal(r,n){r.write("static"),r.space().inlineBlock(()=>{this.factory.forStatementedNode({isAmbient:!1}).printText(r,n)})}},zj=class extends Is{constructor(r,n){super(r),this.options=n}printTexts(r,n){if(n!=null)for(let i=0;i<n.length;i++)i>0&&(this.options.isAmbient?r.newLine():r.blankLine()),this.printText(r,n[i])}printTextInternal(r,n){this.printOverloads(r,i()),this.printHeader(r,n),this.options.isAmbient?r.write(";"):r.space().inlineBlock(()=>{this.factory.forStatementedNode(this.options).printText(r,n)});function i(){let a=b.ObjectUtils.clone(n.overloads);if(!(a==null||a.length===0)){for(let s of a)_u(s,"scope",n.scope);return a}}}printOverloads(r,n){if(!(n==null||n.length===0))for(let i of n)this.printOverload(r,i),r.newLine()}printOverload(r,n){this.printLeadingTrivia(r,n),this.printHeader(r,n),r.write(";"),this.printTrailingTrivia(r,n)}printHeader(r,n){this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forModifierableNode().printText(r,n),r.write("constructor"),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(r,n.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(r,n.parameters)}},$j=class extends Is{constructor(r,n){super(r),this.options=n,this.blankLineWriter=new cS(this)}printTexts(r,n){this.blankLineWriter.printText(r,n)}printTextInternal(r,n){this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forDecorator().printTexts(r,n.decorators),this.factory.forModifierableNode().printText(r,n),r.write(`get ${n.name}`),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(r,n.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(r,n.parameters),this.factory.forReturnTypedNode().printText(r,n),this.options.isAmbient||n.isAbstract?r.write(";"):r.spaceIfLastNot().inlineBlock(()=>{this.factory.forStatementedNode(this.options).printText(r,n)})}},Xj=class extends Is{constructor(r,n){super(r),this.options=n}printTexts(r,n){if(n!=null)for(let i=0;i<n.length;i++)i>0&&(this.options.isAmbient?r.newLine():r.blankLine()),this.printText(r,n[i])}printTextInternal(r,n){this.printOverloads(r,n.name,i()),this.printHeader(r,n.name,n),this.options.isAmbient||n.isAbstract?r.write(";"):r.spaceIfLastNot().inlineBlock(()=>{this.factory.forStatementedNode(this.options).printText(r,n)});function i(){let a=b.ObjectUtils.clone(n.overloads);if(!(a==null||a.length===0)){for(let s of a)_u(s,"scope",n.scope),_u(s,"isStatic",n.isStatic),_u(s,"isAbstract",n.isAbstract),_u(s,"hasQuestionToken",n.hasQuestionToken);return a}}}printOverloads(r,n,i){if(!(i==null||i.length===0))for(let a of i)this.printOverload(r,n,a),r.newLine()}printOverload(r,n,i){this.printLeadingTrivia(r,i),this.printHeader(r,n,i),r.write(";"),this.printTrailingTrivia(r,i)}printHeader(r,n,i){this.factory.forJSDoc().printDocs(r,i.docs),i.decorators!=null&&this.factory.forDecorator().printTexts(r,i.decorators),this.factory.forModifierableNode().printText(r,i),r.write(n),r.conditionalWrite(i.hasQuestionToken,"?"),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(r,i.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(r,i.parameters),this.factory.forReturnTypedNode().printText(r,i)}},Yj=class extends Is{constructor(){super(...arguments),this.multipleWriter=new q_(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forDecorator().printTexts(r,n.decorators),this.factory.forModifierableNode().printText(r,n),r.write(n.name),r.conditionalWrite(n.hasQuestionToken,"?"),r.conditionalWrite(n.hasExclamationToken&&!n.hasQuestionToken,"!"),this.factory.forTypedNode(":").printText(r,n),this.factory.forInitializerExpressionableNode().printText(r,n),r.write(";")}},Qj=class extends Is{constructor(r,n){super(r),this.options=n,this.multipleWriter=new cS(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forDecorator().printTexts(r,n.decorators),this.factory.forModifierableNode().printText(r,n),r.write(`set ${n.name}`),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(r,n.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(r,n.parameters),this.factory.forReturnTypedNode().printText(r,n),this.options.isAmbient||n.isAbstract?r.write(";"):r.spaceIfLastNot().inlineBlock(()=>{this.factory.forStatementedNode(this.options).printText(r,n)})}},aL=class extends of{printText(r,n){typeof n=="string"?r.write(n):n(r)}},Zj=class extends Is{printTexts(r,n){this.printMultiple(r,n,()=>r.newLine())}printTextsInline(r,n){this.printMultiple(r,n,()=>r.space())}printTextInternal(r,n){r.write(`@${n.name}`),this.printTypeArguments(r,n),this.printArguments(r,n)}printTypeArguments(r,n){if(!(n.typeArguments==null||n.typeArguments.length===0)){r.write("<");for(let i=0;i<n.typeArguments.length;i++)r.conditionalWrite(i>0,", "),r.write(this.getTextWithQueuedChildIndentation(r,n.typeArguments[i]));r.write(">")}}printArguments(r,n){if(n.arguments==null)return;r.write("(");let i=n.arguments instanceof Array?n.arguments:[n.arguments];for(let a=0;a<i.length;a++)r.conditionalWrite(a>0,", "),r.write(this.getTextWithQueuedChildIndentation(r,i[a]));r.write(")")}printMultiple(r,n,i){if(!(n==null||n.length===0))for(let a of n)this.printText(r,a),i()}},eH=class extends Is{printDocs(r,n){if(n!=null)for(let i of n)this.printText(r,i),r.newLine()}printTextInternal(r,n){let a=f(this).split(/\r?\n/),s=a[0].length===0,u=a.length<=1,p=s?1:0;if(r.write("/**"),u?r.space():r.newLine(),u)r.write(a[p]);else for(let m=p;m<a.length;m++)r.write(" *"),a[m].length>0&&r.write(` ${a[m]}`),r.newLine();r.spaceIfLastNot(),r.write("*/");function f(m){if(typeof n=="string")return n;let g=m.getNewWriter(r);return typeof n=="function"?n(g):(n.description&&GE(g,n.description),n.tags&&n.tags.length>0&&(g.getLength()>0&&g.newLine(),m.factory.forJSDocTag({printStarsOnNewLine:!1}).printTexts(g,n.tags))),g.toString()}}},rH=class extends Is{constructor(r,n){super(r),this.options=n}printTexts(r,n){if(n!=null)for(let i=0;i<n.length;i++)i>0&&(r.newLine(),r.conditionalWrite(this.options.printStarsOnNewLine," * ")),this.printText(r,n[i])}printTextInternal(r,n){let a=s(this).split(/\r?\n/);for(let u=0;u<a.length;u++)u>0&&(r.newLine(),this.options.printStarsOnNewLine&&r.write(" *")),a[u].length>0&&(this.options.printStarsOnNewLine&&u>0&&r.space(),r.write(a[u]));function s(u){if(typeof n=="string")return n;let p=u.getNewWriter(r);if(typeof n=="function")n(p);else{n.text&&GE(p,n.text);let f=p.toString();p.unsafeInsert(0,`@${n.tagName}`+(f.length>0&&!b.StringUtils.startsWithNewLine(f)?" ":""))}return p.toString()}}},tH=class extends Is{constructor(){super(...arguments),this.multipleWriter=new cS(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forModifierableNode().printText(r,n),r.conditionalWrite(n.isConst,"const "),r.write(`enum ${n.name} `).inlineBlock(()=>{this.factory.forEnumMember().printTexts(r,n.members)})}},nH=class extends Is{constructor(){super(...arguments),this.multipleWriter=new BT(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){if(n instanceof Function){n(r);return}else if(typeof n=="string"){r.write(n);return}if(this.factory.forJSDoc().printDocs(r,n.docs),I7e(n.name)||b.StringUtils.isQuoted(n.name)?r.write(n.name):r.quote(n.name),typeof n.value=="string"){let{value:i}=n;r.hangingIndent(()=>r.write(" = ").quote(i))}else typeof n.value=="number"?r.write(` = ${n.value}`):this.factory.forInitializerExpressionableNode().printText(r,n)}},iH=class extends of{constructor(r){super(),this.factory=r,this.multipleWriter=new BT(this),this.options={isAmbient:!1}}printTexts(r,n){this.multipleWriter.printText(r,n)}printText(r,n){if(typeof n=="string"||n instanceof Function||n==null){this.printTextOrWriterFunc(r,n);return}switch(n.kind){case Oe.StructureKind.PropertyAssignment:this.factory.forPropertyAssignment().printText(r,n);break;case Oe.StructureKind.ShorthandPropertyAssignment:this.factory.forShorthandPropertyAssignment().printText(r,n);break;case Oe.StructureKind.SpreadAssignment:this.factory.forSpreadAssignment().printText(r,n);break;case Oe.StructureKind.Method:this.factory.forMethodDeclaration(this.options).printText(r,n);break;case Oe.StructureKind.GetAccessor:this.factory.forGetAccessorDeclaration(this.options).printText(r,n);break;case Oe.StructureKind.SetAccessor:this.factory.forSetAccessorDeclaration(this.options).printText(r,n);break;default:b.errors.throwNotImplementedForNeverValueError(n)}}},aH=class extends Is{printTextInternal(r,n){r.hangingIndent(()=>{r.write(`${n.name}: `),GE(r,n.initializer)})}},oH=class extends Is{printTextInternal(r,n){r.write(`${n.name}`)}},sH=class extends Is{printTextInternal(r,n){r.hangingIndent(()=>{r.write("..."),GE(r,n.expression)})}},lH=class extends Is{constructor(r,n){super(r),this.options=n}printTexts(r,n){if(n!=null)for(let i=0;i<n.length;i++){let a=n[i];if(i>0){let s=n[i-1];this.options.isAmbient||s.hasDeclareKeyword&&a.hasDeclareKeyword?r.newLine():r.blankLine()}this.printText(r,a)}}printTextInternal(r,n){this.printOverloads(r,n.name,i()),this.printHeader(r,n.name,n),this.options.isAmbient||n.hasDeclareKeyword?r.write(";"):r.space().inlineBlock(()=>{this.factory.forStatementedNode({isAmbient:!1}).printText(r,n)});function i(){let a=b.ObjectUtils.clone(n.overloads);if(!(a==null||a.length===0)){for(let s of a)_u(s,"hasDeclareKeyword",n.hasDeclareKeyword),_u(s,"isExported",n.isExported),_u(s,"isDefaultExport",n.isDefaultExport);return a}}}printOverloads(r,n,i){if(!(i==null||i.length===0))for(let a of i)this.printOverload(r,n,a),r.newLine()}printOverload(r,n,i){this.printLeadingTrivia(r,i),this.printHeader(r,n,i),r.write(";"),this.printTrailingTrivia(r,i)}printHeader(r,n,i){this.factory.forJSDoc().printDocs(r,i.docs),this.factory.forModifierableNode().printText(r,i),r.write("function"),r.conditionalWrite(i.isGenerator,"*"),b.StringUtils.isNullOrWhitespace(n)||r.write(` ${n}`),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(r,i.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(r,i.parameters),this.factory.forReturnTypedNode().printText(r,i)}},uH=class extends Is{constructor(){super(...arguments),this.multipleWriter=new Nh(this)}printTextsWithParenthesis(r,n){r.write("("),n!=null&&this.factory.forParameterDeclaration().printTexts(r,n),r.write(")")}printTexts(r,n){n==null||n.length===0||r.hangingIndent(()=>{this.multipleWriter.printText(r,n)})}printTextInternal(r,n){if(n.name==null)throw new b.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(r,n.decorators),this.factory.forModifierableNode().printText(r,n),r.conditionalWrite(n.isRestParameter,"..."),r.write(n.name),r.conditionalWrite(n.hasQuestionToken,"?"),this.factory.forTypedNode(":",n.hasQuestionToken).printText(r,n),this.factory.forInitializerExpressionableNode().printText(r,n)}},cH=class extends Is{constructor(){super(...arguments),this.multipleWriter=new q_(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(r,n.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(r,n.parameters),this.factory.forReturnTypedNode(!0).printText(r,n),r.write(";")}},dH=class extends Is{constructor(){super(...arguments),this.multipleWriter=new q_(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){this.factory.forJSDoc().printDocs(r,n.docs),r.write("new"),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(r,n.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(r,n.parameters),this.factory.forReturnTypedNode().printText(r,n),r.write(";")}},fH=class extends Is{constructor(){super(...arguments),this.multipleWriter=new q_(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forModifierableNode().printText(r,n),r.write(`[${n.keyName||"key"}: ${n.keyType||"string"}]`),this.factory.forReturnTypedNode().printText(r,n),r.write(";")}},pH=class extends Is{constructor(){super(...arguments),this.multipleWriter=new cS(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){if(this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forModifierableNode().printText(r,n),r.write(`interface ${n.name}`),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(r,n.typeParameters),r.space(),n.extends!=null){let i=n.extends instanceof Array?n.extends.map(a=>this.getText(r,a)).join(", "):this.getText(r,n.extends);b.StringUtils.isNullOrWhitespace(i)||r.hangingIndent(()=>r.write(`extends ${i} `))}r.inlineBlock(()=>{this.factory.forTypeElementMemberedNode().printText(r,n)})}},mH=class extends Is{constructor(){super(...arguments),this.multipleWriter=new q_(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){this.factory.forJSDoc().printDocs(r,n.docs),r.write(n.name),r.conditionalWrite(n.hasQuestionToken,"?"),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(r,n.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(r,n.parameters),this.factory.forReturnTypedNode().printText(r,n),r.write(";")}},_H=class extends Is{constructor(){super(...arguments),this.multipleWriter=new q_(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forModifierableNode().printText(r,n),r.write(n.name),r.conditionalWrite(n.hasQuestionToken,"?"),this.factory.forTypedNode(":").printText(r,n),this.factory.forInitializerExpressionableNode().printText(r,n),r.write(";")}},gH=class extends of{constructor(r){super(),this.factory=r}printText(r,n){this.factory.forCallSignatureDeclaration().printTexts(r,n.callSignatures),this.conditionalSeparator(r,n.constructSignatures),this.factory.forConstructSignatureDeclaration().printTexts(r,n.constructSignatures),this.conditionalSeparator(r,n.indexSignatures),this.factory.forIndexSignatureDeclaration().printTexts(r,n.indexSignatures),this.conditionalSeparator(r,n.properties),this.factory.forPropertySignature().printTexts(r,n.properties),this.conditionalSeparator(r,n.methods),this.factory.forMethodSignature().printTexts(r,n.methods)}conditionalSeparator(r,n){!b.ArrayUtils.isNullOrEmpty(n)&&!r.isAtStartOfFirstLineOfBlock()&&r.newLine()}},yH=class extends of{constructor(r){super(),this.factory=r}printTexts(r,n){if(n!=null)if(typeof n=="string"||n instanceof Function)this.printText(r,n);else for(let i of n)oq(r)?r.blankLineIfLastNot():r.isAtStartOfFirstLineOfBlock()||r.newLineIfLastNot(),this.printText(r,i)}printText(r,n){if(typeof n=="string"||n instanceof Function||n==null){this.printTextOrWriterFunc(r,n);return}switch(n.kind){case Oe.StructureKind.PropertySignature:this.factory.forPropertySignature().printText(r,n);break;case Oe.StructureKind.MethodSignature:this.factory.forMethodSignature().printText(r,n);break;case Oe.StructureKind.CallSignature:this.factory.forCallSignatureDeclaration().printText(r,n);break;case Oe.StructureKind.IndexSignature:this.factory.forIndexSignatureDeclaration().printText(r,n);break;case Oe.StructureKind.ConstructSignature:this.factory.forConstructSignatureDeclaration().printText(r,n);break;default:b.errors.throwNotImplementedForNeverValueError(n)}}},vH=class extends Is{printTextInternal(r,n){if(i())this.factory.forJsxAttribute().printTextWithoutTrivia(r,n);else if(n.kind===Oe.StructureKind.JsxSpreadAttribute)this.factory.forJsxSpreadAttribute().printTextWithoutTrivia(r,n);else throw b.errors.throwNotImplementedForNeverValueError(n);function i(a){return n.kind==null||n.kind===Oe.StructureKind.JsxAttribute}}},hH=class extends Is{printTextInternal(r,n){r.write(n.name),n.initializer!=null&&r.write("=").write(n.initializer)}},EH=class extends Is{printTextInternal(r,n){i(n)?this.factory.forJsxElement().printText(r,n):n.kind===Oe.StructureKind.JsxSelfClosingElement?this.factory.forJsxSelfClosingElement().printText(r,n):b.errors.throwNotImplementedForNeverValueError(n);function i(a){return a.kind==null||a.kind===Oe.StructureKind.JsxElement}}},bH=class extends Is{printTextInternal(r,n){r.hangingIndent(()=>{r.write(`<${n.name}`),n.attributes&&this.printAttributes(r,n.attributes),r.write(">")}),this.printChildren(r,n.children),r.write(`</${n.name}>`)}printAttributes(r,n){let i=this.factory.forJsxAttributeDecider();for(let a of n)r.space(),i.printText(r,a)}printChildren(r,n){n!=null&&(r.newLine(),r.indent(()=>{for(let i of n)this.factory.forJsxChildDecider().printText(r,i),r.newLine()}))}},SH=class extends Is{printTextInternal(r,n){r.hangingIndent(()=>{r.write(`<${n.name}`),n.attributes&&this.printAttributes(r,n.attributes),r.write(" />")})}printAttributes(r,n){let i=this.factory.forJsxAttributeDecider();for(let a of n)r.space(),i.printText(r,a)}},TH=class extends Is{printTextInternal(r,n){r.hangingIndent(()=>{r.write("{"),r.write("..."),r.write(n.expression),r.write("}")})}},xH=class extends Is{constructor(){super(...arguments),this.multipleWriter=new BT(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printAssertClause(r,n){!n||(r.write("assert "),r.inlineBlock(()=>{this.printTexts(r,n)}))}printTextInternal(r,n){r.write(n.name),r.write(": "),r.quote(n.value)}},DH=class extends Is{constructor(){super(...arguments),this.multipleWriter=new q_(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){r.write("export"),n.isExportEquals!==!1?r.write(" = "):r.write(" default "),r.write(this.getTextWithQueuedChildIndentation(r,n.expression)).write(";")}},CH=class extends Is{constructor(){super(...arguments),this.multipleWriter=new q_(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){let i=n.moduleSpecifier!=null&&n.moduleSpecifier.length>0;if(n.namedExports!=null&&n.namedExports.length>0&&n.namespaceExport!=null)throw new b.errors.InvalidOperationError("An export declaration cannot have both a namespace export and a named export.");r.write("export"),n.isTypeOnly&&r.write(" type"),n.namedExports!=null&&n.namedExports.length>0?(r.space(),this.factory.forNamedImportExportSpecifier().printTextsWithBraces(r,n.namedExports)):n.namespaceExport!=null?(r.write(" *"),b.StringUtils.isNullOrWhitespace(n.namespaceExport)||r.write(` as ${n.namespaceExport}`)):i?r.write(" *"):r.write(" {").conditionalWrite(this.factory.getFormatCodeSettings().insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces," ").write("}"),i&&(r.write(" from "),r.quote(n.moduleSpecifier)),n.assertElements&&(r.space(),this.factory.forAssertEntry().printAssertClause(r,n.assertElements)),r.write(";")}},AH=class extends Is{constructor(){super(...arguments),this.multipleWriter=new q_(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){let i=n.namedImports!=null&&n.namedImports.length>0;if(i&&n.namespaceImport!=null)throw new b.errors.InvalidOperationError("An import declaration cannot have both a namespace import and a named import.");r.write("import"),n.isTypeOnly&&r.write(" type"),n.defaultImport!=null&&(r.write(` ${n.defaultImport}`),r.conditionalWrite(i||n.namespaceImport!=null,",")),n.namespaceImport!=null&&r.write(` * as ${n.namespaceImport}`),n.namedImports!=null&&n.namedImports.length>0&&(r.space(),this.factory.forNamedImportExportSpecifier().printTextsWithBraces(r,n.namedImports)),r.conditionalWrite(n.defaultImport!=null||i||n.namespaceImport!=null," from"),r.write(" "),r.quote(n.moduleSpecifier),n.assertElements&&(r.space(),this.factory.forAssertEntry().printAssertClause(r,n.assertElements)),r.write(";")}},LH=class extends Is{constructor(r,n){super(r),this.options=n,this.blankLineFormattingWriter=new cS(this)}printTexts(r,n){this.blankLineFormattingWriter.printText(r,n)}printTextInternal(r,n){n=this.validateAndGetStructure(n),this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forModifierableNode().printText(r,n),n.declarationKind==null||n.declarationKind!==Oe.ModuleDeclarationKind.Global?r.write(`${n.declarationKind||"namespace"} ${n.name}`):r.write("global"),n.hasDeclareKeyword&&b.StringUtils.isQuoted(n.name.trim())&&n.hasOwnProperty(b.nameof(n,"statements"))&&n.statements==null?r.write(";"):(r.write(" "),r.inlineBlock(()=>{this.factory.forStatementedNode({isAmbient:n.hasDeclareKeyword||this.options.isAmbient}).printText(r,n)}))}validateAndGetStructure(r){if(b.StringUtils.isQuoted(r.name.trim())){if(r.declarationKind===Oe.ModuleDeclarationKind.Namespace)throw new b.errors.InvalidOperationError(`Cannot print a namespace with quotes for namespace with name ${r.name}. Use ModuleDeclarationKind.Module instead.`);r=b.ObjectUtils.clone(r),_u(r,"hasDeclareKeyword",!0),_u(r,"declarationKind",Oe.ModuleDeclarationKind.Module)}return r}},NH=class extends Is{constructor(){super(...arguments),this.multipleWriter=new Nh(this)}printTextsWithBraces(r,n){let i=this.factory.getFormatCodeSettings();r.write("{");let a=this.getNewWriter(r);this.printTexts(a,n);let s=a.toString();i.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces&&!b.StringUtils.startsWithNewLine(s)&&r.space(),r.write(s),i.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces&&!b.StringUtils.endsWithNewLine(s)&&r.space(),r.write("}")}printTexts(r,n){n instanceof Function?this.printText(r,n):this.multipleWriter.printText(r,n)}printTextInternal(r,n){let i=this.getNewWriterWithQueuedChildIndentation(r);typeof n=="string"?i.write(n):n instanceof Function?n(i):(i.write(n.name),b.StringUtils.isNullOrWhitespace(n.alias)||(i.isLastNewLine()||i.space(),i.write(`as ${n.alias}`))),r.write(i.toString())}},IH=class extends Is{constructor(r,n){super(r),this.options=n}printTextInternal(r,n){this.factory.forStatementedNode(this.options).printText(r,n),r.conditionalNewLine(!r.isAtStartOfFirstLineOfBlock()&&!r.isLastNewLine())}},PH=class extends of{constructor(r,n){super(),this.factory=r,this.options=n}printText(r,n){this.factory.forStatement(this.options).printTexts(r,n.statements)}},OH=class extends of{constructor(r,n){super(),this.factory=r,this.options=n}printTexts(r,n){if(n!=null)if(typeof n=="string"||n instanceof Function)this.printText(r,n);else for(let i of n)oq(r)?r.blankLineIfLastNot():r.isAtStartOfFirstLineOfBlock()||r.newLineIfLastNot(),this.printText(r,i)}printText(r,n){if(typeof n=="string"||n instanceof Function||n==null){this.printTextOrWriterFunc(r,n);return}switch(n.kind){case Oe.StructureKind.Function:this.options.isAmbient||i(),this.factory.forFunctionDeclaration(this.options).printText(r,n);break;case Oe.StructureKind.Class:i(),this.factory.forClassDeclaration(this.options).printText(r,n);break;case Oe.StructureKind.Interface:i(),this.factory.forInterfaceDeclaration().printText(r,n);break;case Oe.StructureKind.TypeAlias:this.factory.forTypeAliasDeclaration().printText(r,n);break;case Oe.StructureKind.VariableStatement:this.factory.forVariableStatement().printText(r,n);break;case Oe.StructureKind.ImportDeclaration:this.factory.forImportDeclaration().printText(r,n);break;case Oe.StructureKind.Module:i(),this.factory.forModuleDeclaration(this.options).printText(r,n);break;case Oe.StructureKind.Enum:i(),this.factory.forEnumDeclaration().printText(r,n);break;case Oe.StructureKind.ExportDeclaration:this.factory.forExportDeclaration().printText(r,n);break;case Oe.StructureKind.ExportAssignment:this.factory.forExportAssignment().printText(r,n);break;default:b.errors.throwNotImplementedForNeverValueError(n)}function i(){r.isAtStartOfFirstLineOfBlock()||r.blankLineIfLastNot()}}};Oe.VariableDeclarationKind=void 0;(function(e){e.Var="var",e.Let="let",e.Const="const"})(Oe.VariableDeclarationKind||(Oe.VariableDeclarationKind={}));var kH=class extends Is{constructor(){super(...arguments),this.multipleWriter=new q_(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){this.factory.forJSDoc().printDocs(r,n.docs),r.hangingIndent(()=>{this.factory.forModifierableNode().printText(r,n),r.write(`${n.declarationKind||Oe.VariableDeclarationKind.Let} `),this.factory.forVariableDeclaration().printTexts(r,n.declarations),r.write(";")})}},RH=class extends Is{constructor(){super(...arguments),this.multipleWriter=new q_(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forModifierableNode().printText(r,n),r.write(`type ${n.name}`),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(r,n.typeParameters),this.factory.forTypedNode(" =").printText(r,n),r.write(";")}},MH=class extends Is{constructor(){super(...arguments),this.multipleWriter=new Nh(this)}printTextsWithBrackets(r,n){n==null||n.length===0||(r.write("<"),this.printTexts(r,n),r.write(">"))}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){if(typeof n=="string"){r.write(n);return}r.hangingIndent(()=>{if(n.variance!=null&&((n.variance&Oe.TypeParameterVariance.In)!==0&&r.write("in "),(n.variance&Oe.TypeParameterVariance.Out)!==0&&r.write("out ")),r.write(n.name),n.constraint!=null){let i=this.getText(r,n.constraint);b.StringUtils.isNullOrWhitespace(i)||r.write(` extends ${i}`)}if(n.default!=null){let i=this.getText(r,n.default);b.StringUtils.isNullOrWhitespace(i)||r.write(` = ${i}`)}})}},wH=class extends Is{constructor(){super(...arguments),this.multipleWriter=new Nh(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){r.write(n.name),r.conditionalWrite(n.hasExclamationToken,"!"),this.factory.forTypedNode(":").printText(r,n),this.factory.forInitializerExpressionableNode().printText(r,n)}};function Vpe(e){return class extends e{getExtends(){var r;let n=this.getHeritageClauseByKind(b.SyntaxKind.ExtendsKeyword);return(r=n?.getTypeNodes())!==null&&r!==void 0?r:[]}addExtends(r){return this.insertExtends(this.getExtends().length,r)}insertExtends(r,n){let i=this.getExtends(),a=typeof n=="string";if(typeof n=="string")b.errors.throwIfWhitespaceOrNotString(n,"texts"),n=[n];else if(n.length===0)return[];let s=this._getWriterWithQueuedChildIndentation();if(new Nh(new aL).printText(s,n),r=ku(r,i.length),i.length>0){let f=this.getHeritageClauseByKindOrThrow(b.SyntaxKind.ExtendsKeyword);H_({parent:f.getFirstChildByKindOrThrow(b.SyntaxKind.SyntaxList),currentNodes:i,insertIndex:r,newText:s.toString(),useTrailingCommas:!1})}else{let m=this.getFirstChildByKindOrThrow(b.SyntaxKind.OpenBraceToken).getStart(),g=/\s/.test(this.getSourceFile().getFullText()[m-1]),D=`extends ${s.toString()} `;g||(D=" "+D),qa({parent:this,insertPos:m,newText:D})}let p=this.getExtends();return a?p[r]:af(i,p,r,!1)}removeExtends(r){let n=this.getHeritageClauseByKind(b.SyntaxKind.ExtendsKeyword);if(n==null)throw new b.errors.InvalidOperationError("Cannot remove an extends when none exist.");return n.removeExpression(r),this}set(r){return io(e.prototype,this,r),r.extends!=null&&(this.getExtends().forEach(n=>this.removeExtends(n)),this.addExtends(r.extends)),this}getStructure(){return uo(e.prototype,this,{extends:this.getExtends().map(r=>r.getText())})}}}function $T(e){return class extends e{isGenerator(){return this.compilerNode.asteriskToken!=null}getAsteriskToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.asteriskToken)}getAsteriskTokenOrThrow(){return b.errors.throwIfNullOrUndefined(this.getAsteriskToken(),"Expected to find an asterisk token.")}setIsGenerator(r){let n=this.getAsteriskToken();return n!=null===r?this:(n==null?qa({insertPos:rUe(this),parent:this,newText:"*"}):Lh({children:[n],getSiblingFormatting:()=>El.Space}),this)}set(r){return io(e.prototype,this,r),r.isGenerator!=null&&this.setIsGenerator(r.isGenerator),this}getStructure(){return uo(e.prototype,this,{isGenerator:this.isGenerator()})}}}function rUe(e){if(e.getKind()===b.SyntaxKind.FunctionDeclaration)return e.getFirstChildByKindOrThrow(b.SyntaxKind.FunctionKeyword).getEnd();let r=e;if(r.getName==null)throw new b.errors.NotImplementedError("Expected a name node for a non-function declaration.");return r.getNameNode().getStart()}function sq(e){return class extends e{getHeritageClauses(){var r;let n=this.compilerNode.heritageClauses;return(r=n?.map(i=>this._getNodeFromCompilerNode(i)))!==null&&r!==void 0?r:[]}getHeritageClauseByKindOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getHeritageClauseByKind(r),`Expected to have heritage clause of kind ${b.getSyntaxKindName(r)}.`)}getHeritageClauseByKind(r){return this.getHeritageClauses().find(n=>n.compilerNode.token===r)}}}function jpe(e){return class extends e{getImplements(){var r;let n=this.getHeritageClauseByKind(b.SyntaxKind.ImplementsKeyword);return(r=n?.getTypeNodes())!==null&&r!==void 0?r:[]}addImplements(r){return this.insertImplements(this.getImplements().length,r)}insertImplements(r,n){let i=this.getImplements(),a=typeof n=="string";if(typeof n=="string")b.errors.throwIfWhitespaceOrNotString(n,"texts"),n=[n];else if(n.length===0)return[];let s=this._getWriterWithQueuedChildIndentation();new Nh(new aL).printText(s,n);let p=this.getHeritageClauses();if(r=ku(r,i.length),i.length>0){let m=this.getHeritageClauseByKindOrThrow(b.SyntaxKind.ImplementsKeyword);H_({parent:m.getFirstChildByKindOrThrow(b.SyntaxKind.SyntaxList),currentNodes:i,insertIndex:r,newText:s.toString(),useTrailingCommas:!1})}else{let g=this.getFirstChildByKindOrThrow(b.SyntaxKind.OpenBraceToken).getStart(),D=/\s/.test(this.getSourceFile().getFullText()[g-1]),P=`implements ${s.toString()} `;D||(P=" "+P),qa({parent:p.length===0?this:p[0].getParentSyntaxListOrThrow(),insertPos:g,newText:P})}let f=this.getImplements();return a?f[0]:af(i,f,r,!1)}removeImplements(r){let n=this.getHeritageClauseByKind(b.SyntaxKind.ImplementsKeyword);if(n==null)throw new b.errors.InvalidOperationError("Cannot remove an implements when none exist.");return n.removeExpression(r),this}set(r){return io(e.prototype,this,r),r.implements!=null&&(this.getImplements().forEach(n=>this.removeImplements(n)),this.addImplements(r.implements)),this}getStructure(){return uo(e.prototype,this,{implements:this.getImplements().map(r=>r.getText())})}}}function iG(e){return class extends e{hasInitializer(){return this.compilerNode.initializer!=null}getInitializerIfKindOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getInitializerIfKind(r),`Expected to find an initializer of kind '${b.getSyntaxKindName(r)}'.`)}getInitializerIfKind(r){let n=this.getInitializer();if(!(n!=null&&n.getKind()!==r))return n}getInitializerOrThrow(){return b.errors.throwIfNullOrUndefined(this.getInitializer(),"Expected to find an initializer.")}getInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.initializer)}}}function XT(e){return tUe(iG(e))}function tUe(e){return class extends e{removeInitializer(){let r=this.getInitializer();if(r==null)return this;let n=r.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.EqualsToken);return Bs({children:[n,r],removePrecedingSpaces:!0}),this}setInitializer(r){let n=Yg(this._getWriterWithQueuedChildIndentation(),r);b.errors.throwIfWhitespaceOrNotString(n,"textOrWriterFunction"),this.hasInitializer()&&this.removeInitializer();let i=this.getLastChildIfKind(b.SyntaxKind.SemicolonToken);return qa({insertPos:i!=null?i.getPos():this.getEnd(),parent:this,newText:` = ${n}`}),this}set(r){return io(e.prototype,this,r),r.initializer!=null?this.setInitializer(r.initializer):r.hasOwnProperty(b.nameof(r,"initializer"))&&this.removeInitializer(),this}getStructure(){let r=this.getInitializer();return uo(e.prototype,this,{initializer:r?r.getText():void 0})}}}function sc(e){return class extends e{getJsDocs(){var r;let n=this.compilerNode.jsDoc;return(r=n?.map(i=>this._getNodeFromCompilerNode(i)))!==null&&r!==void 0?r:[]}addJsDoc(r){return this.addJsDocs([r])[0]}addJsDocs(r){return this.insertJsDocs(ad(this.compilerNode.jsDoc),r)}insertJsDoc(r,n){return this.insertJsDocs(r,[n])[0]}insertJsDocs(r,n){if(b.ArrayUtils.isNullOrEmpty(n))return[];let i=this._getWriterWithQueuedIndentation();this._context.structurePrinterFactory.forJSDoc().printDocs(i,n),i.write("");let s=i.toString(),u=this.getJsDocs();r=ku(r,u.length);let p=r===u.length?this.getStart():u[r].getStart();return qa({insertPos:p,parent:this,newText:s}),af(u,this.getJsDocs(),r,!1)}set(r){return io(e.prototype,this,r),r.docs!=null&&(this.getJsDocs().forEach(n=>n.remove()),this.addJsDocs(r.docs)),this}getStructure(){return uo(e.prototype,this,{docs:this.getJsDocs().map(r=>r.getStructure())})}}}function qD(e){return class extends e{getLiteralText(){return this.compilerNode.text}isTerminated(){return!this.compilerNode.isUnterminated}hasExtendedUnicodeEscape(){return this.compilerNode.hasExtendedUnicodeEscape||!1}}}function sf(e){return class extends e{getModifiers(){return this.getCompilerModifiers().map(r=>this._getNodeFromCompilerNode(r))}getFirstModifierByKindOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getFirstModifierByKind(r),`Expected a modifier of syntax kind: ${b.getSyntaxKindName(r)}`)}getFirstModifierByKind(r){for(let n of this.getCompilerModifiers())if(n.kind===r)return this._getNodeFromCompilerNode(n)}hasModifier(r){return typeof r=="string"?this.getModifiers().some(n=>n.getText()===r):this.getCompilerModifiers().some(n=>n.kind===r)}toggleModifier(r,n){return n==null&&(n=!this.hasModifier(r)),n?this.addModifier(r):this.removeModifier(r),this}addModifier(r){let n=this.getModifiers(),i=this.getModifiers().filter(g=>g.getKind()!==b.SyntaxKind.Decorator),a=i.find(g=>g.getText()===r);if(a!=null)return a;let s=m(this),u,p;return i.length===0||s===i[0].getStart()?(p=r+" ",u=s):(p=" "+r,u=s+1),qa({parent:n.length===0?this:n[0].getParentSyntaxListOrThrow(),insertPos:s,newText:p}),this.getModifiers().find(g=>g.getStart()===u);function m(g){let D=P();for(let B of nUe(r))for(let K=0;K<i.length;K++){let h=i[K];if(h.getText()===B){D<h.getEnd()&&(D=h.getEnd());break}}return D;function P(){if(i.length>0)return i[0].getStart();for(let B of g._getChildrenIterator())if(!(B.getKind()===b.SyntaxKind.SyntaxList||b.ts.isJSDocCommentContainingNode(B.compilerNode)))return B.getStart();return g.getStart()}}}removeModifier(r){let n=this.getModifiers(),i=n.find(a=>a.getText()===r);return i==null?!1:(Bs({children:[n.length===1?i.getParentSyntaxListOrThrow():i],removeFollowingSpaces:!0}),!0)}getCompilerModifiers(){return this.compilerNode.modifiers||[]}}}function nUe(e){switch(e){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["in"];case"in":return[];default:b.errors.throwNotImplementedForNeverValueError(e)}}function lq(e){return class extends e{addImportDeclaration(r){return this.addImportDeclarations([r])[0]}addImportDeclarations(r){let n=this._getCompilerStatementsWithComments();return this.insertImportDeclarations(i(),r);function i(){let a=0,s=!0;for(let u=0;u<n.length;u++){let p=n[u];s&&p.kind===b.SyntaxKind.MultiLineCommentTrivia?a=u+1:(s=!1,p.kind===b.SyntaxKind.ImportDeclaration&&(a=u+1))}return a}}insertImportDeclaration(r,n){return this.insertImportDeclarations(r,[n])[0]}insertImportDeclarations(r,n){return this._insertChildren({expectedKind:b.SyntaxKind.ImportDeclaration,index:r,structures:n,write:(i,a)=>{this._standardWrite(i,a,()=>{this._context.structurePrinterFactory.forImportDeclaration().printTexts(i,n)},{previousNewLine:s=>Tr.isImportDeclaration(s)||uj(s.compilerNode),nextNewLine:s=>Tr.isImportDeclaration(s)})}})}getImportDeclaration(r){return this.getImportDeclarations().find(n());function n(){return typeof r=="string"?i=>i.getModuleSpecifierValue()===r:r}}getImportDeclarationOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getImportDeclaration(r),"Expected to find an import with the provided condition.")}getImportDeclarations(){return this.getStatements().filter(Tr.isImportDeclaration)}addExportDeclaration(r){return this.addExportDeclarations([r])[0]}addExportDeclarations(r){return this.insertExportDeclarations(this.getChildSyntaxListOrThrow().getChildCount(),r)}insertExportDeclaration(r,n){return this.insertExportDeclarations(r,[n])[0]}insertExportDeclarations(r,n){return this._insertChildren({expectedKind:b.SyntaxKind.ExportDeclaration,index:r,structures:n,write:(i,a)=>{this._standardWrite(i,a,()=>{this._context.structurePrinterFactory.forExportDeclaration().printTexts(i,n)},{previousNewLine:s=>Tr.isExportDeclaration(s)||uj(s.compilerNode),nextNewLine:s=>Tr.isExportDeclaration(s)})}})}getExportDeclaration(r){return this.getExportDeclarations().find(n());function n(){return typeof r=="string"?i=>i.getModuleSpecifierValue()===r:r}}getExportDeclarationOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getExportDeclaration(r),"Expected to find an export declaration with the provided condition.")}getExportDeclarations(){return this.getStatements().filter(Tr.isExportDeclaration)}addExportAssignment(r){return this.addExportAssignments([r])[0]}addExportAssignments(r){return this.insertExportAssignments(this.getChildSyntaxListOrThrow().getChildCount(),r)}insertExportAssignment(r,n){return this.insertExportAssignments(r,[n])[0]}insertExportAssignments(r,n){return this._insertChildren({expectedKind:b.SyntaxKind.ExportAssignment,index:r,structures:n,write:(i,a)=>{this._standardWrite(i,a,()=>{this._context.structurePrinterFactory.forExportAssignment().printTexts(i,n)},{previousNewLine:s=>Tr.isExportAssignment(s)||uj(s.compilerNode),nextNewLine:s=>Tr.isExportAssignment(s)})}})}getExportAssignment(r){return this.getExportAssignments().find(r)}getExportAssignmentOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getExportAssignment(r),"Expected to find an export assignment with the provided condition.")}getExportAssignments(){return this.getStatements().filter(Tr.isExportAssignment)}getDefaultExportSymbol(){let r=this.getSymbol();if(r!=null)return r.getExport("default")}getDefaultExportSymbolOrThrow(){return b.errors.throwIfNullOrUndefined(this.getDefaultExportSymbol(),"Expected to find a default export symbol")}getExportSymbols(){let r=this.getSymbol();return r==null?[]:this._context.typeChecker.getExportsOfModule(r)}getExportedDeclarations(){let r=new Map,n=this.getExportSymbols();for(let a of n)for(let s of a.getDeclarations()){let u=Array.from(i(s)),p=a.getName(),f=r.get(p);f!=null?f.push(...u):r.set(a.getName(),u)}return r;function*i(a){if(Tr.isExportSpecifier(a))for(let u of a.getLocalTargetDeclarations())yield*i(u);else if(Tr.isExportAssignment(a)){let u=a.getExpression();if(u==null||u.getKind()!==b.SyntaxKind.Identifier){yield u;return}yield*s(u.getSymbol())}else if(Tr.isImportSpecifier(a)){let p=a.getNameNode().getSymbol();if(p==null)return;yield*s(p.getAliasedSymbol()||p)}else if(Tr.isImportClause(a)){let u=a.getDefaultImport();if(u==null)return;let p=u.getSymbol();if(p==null)return;yield*s(p.getAliasedSymbol()||p)}else if(Tr.isNamespaceImport(a)||Tr.isNamespaceExport(a)){let u=a.getNameNode().getSymbol();if(u==null)return;yield*s(u.getAliasedSymbol()||u)}else yield a;function*s(u){if(u!=null)for(let p of u.getDeclarations())yield*i(p)}}}removeDefaultExport(r){if(r=r||this.getDefaultExportSymbol(),r==null)return this;let n=r.getDeclarations()[0];return n.compilerNode.kind===b.SyntaxKind.ExportAssignment?Lh({children:[n],getSiblingFormatting:()=>El.Newline}):Tr.isModifierable(n)&&(n.toggleModifier("default",!1),n.toggleModifier("export",!1)),this}}}function JD(e){return class extends e{getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}getName(){return this.getNameNode().getText()}set(r){return io(e.prototype,this,r),r.name!=null&&this.getNameNode().replaceWithText(r.name),this}getStructure(){return uo(e.prototype,this,{name:this.getName()})}}}function Oh(e){return class extends e{findReferences(){return this._context.languageService.findReferences(zfe(this))}findReferencesAsNodes(){return this._context.languageService.findReferencesAsNodes(zfe(this))}}}function zfe(e){if(Tr.isIdentifier(e)||Tr.isStringLiteral(e))return e;let r=e.getNodeProperty("name");return r??(Tr.isExportable(e)&&e.getDefaultKeyword()||e)}function _v(e){return class extends e{rename(r,n){return Gpe(i(this),r,n),this;function i(a){if(Tr.isIdentifier(a)||Tr.isPrivateIdentifier(a)||Tr.isStringLiteral(a))return a;if(a.getNameNode!=null){let s=a.getNameNode();if(b.errors.throwIfNullOrUndefined(s,"Expected to find a name node when renaming."),Tr.isArrayBindingPattern(s)||Tr.isObjectBindingPattern(s))throw new b.errors.NotImplementedError(`Not implemented renameable scenario for ${s.getKindName()}.`);return s}else throw new b.errors.NotImplementedError(`Not implemented renameable scenario for ${a.getKindName()}`)}}}}function Hpe(e){let r=Oh(_v(e));return JD(r)}function aG(e){let r=Oh(_v(e));return JD(r)}function qpe(e){let r=Oh(_v(e));return JD(r)}function oG(e){return iUe(Oh(_v(e)))}function iUe(e){return class extends e{getNameNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.name)}getNameNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getNameNode(),"Expected to have a name node.")}getName(){var r,n;return(n=(r=this.getNameNode())===null||r===void 0?void 0:r.getText())!==null&&n!==void 0?n:void 0}getNameOrThrow(){return b.errors.throwIfNullOrUndefined(this.getName(),"Expected to have a name.")}rename(r){return r===this.getName()?this:b.StringUtils.isNullOrWhitespace(r)?(this.removeName(),this):(this.getNameNode()==null?$fe(this,r):e.prototype.rename.call(this,r),this)}removeName(){let r=this.getNameNode();return r==null?this:(Bs({children:[r],removePrecedingSpaces:!0}),this)}set(r){if(io(e.prototype,this,r),r.name!=null){b.errors.throwIfWhitespaceOrNotString(r.name,"structure.name");let n=this.getNameNode();n==null?$fe(this,r.name):n.replaceWithText(r.name)}else r.hasOwnProperty(b.nameof(r,"name"))&&this.removeName();return this}getStructure(){return uo(e.prototype,this,{name:this.getName()})}}}function $fe(e,r){if(Tr.isClassDeclaration(e)||Tr.isClassExpression(e)){let n=e.getFirstChildByKindOrThrow(b.SyntaxKind.ClassKeyword);qa({insertPos:n.getEnd(),newText:" "+r,parent:e})}else{let n=e.getFirstChildByKindOrThrow(b.SyntaxKind.OpenParenToken);qa({insertPos:n.getStart(),newText:" "+r,parent:e})}}function gv(e){let r=_v(Oh(e));return JD(r)}function UE(e){let r=Oh(_v(e));return JD(r)}function xL(e){return class extends e{hasOverrideKeyword(){return this.hasModifier(b.SyntaxKind.OverrideKeyword)}getOverrideKeyword(){return this.getFirstModifierByKind(b.SyntaxKind.OverrideKeyword)}getOverrideKeywordOrThrow(){return b.errors.throwIfNullOrUndefined(this.getOverrideKeyword(),"Expected to find an override keyword.")}setHasOverrideKeyword(r){return this.toggleModifier("override",r),this}set(r){return io(e.prototype,this,r),r.hasOverrideKeyword!=null&&this.setHasOverrideKeyword(r.hasOverrideKeyword),this}getStructure(){return uo(e.prototype,this,{hasOverrideKeyword:this.hasOverrideKeyword()})}}}function Jpe(e){return class extends e{getParameter(r){return ic(this.getParameters(),r)}getParameterOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getParameter(r),()=>Ou("parameter",r))}getParameters(){return this.compilerNode.parameters.map(r=>this._getNodeFromCompilerNode(r))}addParameter(r){return this.addParameters([r])[0]}addParameters(r){return this.insertParameters(ad(this.compilerNode.parameters),r)}insertParameter(r,n){return this.insertParameters(r,[n])[0]}insertParameters(r,n){if(b.ArrayUtils.isNullOrEmpty(n))return[];let i=this.getParameters(),a=this.getFirstChildByKindOrThrow(b.SyntaxKind.OpenParenToken).getNextSiblingIfKindOrThrow(b.SyntaxKind.SyntaxList);r=ku(r,i.length);let s=this._getWriterWithQueuedChildIndentation();return this._context.structurePrinterFactory.forParameterDeclaration().printTexts(s,n),H_({parent:a,currentNodes:i,insertIndex:r,newText:s.toString(),useTrailingCommas:!1}),af(i,this.getParameters(),r,!1)}set(r){return io(e.prototype,this,r),r.parameters!=null&&(this.getParameters().forEach(n=>n.remove()),this.addParameters(r.parameters)),this}getStructure(){return uo(e.prototype,this,{parameters:this.getParameters().map(r=>r.getStructure())})}}}function sG(e){return class extends e{hasQuestionDotToken(){return this.compilerNode.questionDotToken!=null}getQuestionDotTokenNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.questionDotToken)}getQuestionDotTokenNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getQuestionDotTokenNode(),"Expected to find a question dot token.")}setHasQuestionDotToken(r){let n=this.getQuestionDotTokenNode(),i=n!=null;if(r===i)return this;return r?Tr.isPropertyAccessExpression(this)?this.getFirstChildByKindOrThrow(b.SyntaxKind.DotToken).replaceWithText("?."):qa({insertPos:a.call(this),parent:this,newText:"?."}):Tr.isPropertyAccessExpression(this)?n.replaceWithText("."):Bs({children:[n]}),this;function a(){if(Tr.isCallExpression(this))return this.getFirstChildByKindOrThrow(b.SyntaxKind.OpenParenToken).getStart();if(Tr.isElementAccessExpression(this))return this.getFirstChildByKindOrThrow(b.SyntaxKind.OpenBracketToken).getStart();b.errors.throwNotImplementedForSyntaxKindError(this.compilerNode.kind)}}set(r){return io(e.prototype,this,r),r.hasQuestionDotToken!=null&&this.setHasQuestionDotToken(r.hasQuestionDotToken),this}getStructure(){return uo(e.prototype,this,{hasQuestionDotToken:this.hasQuestionDotToken()})}}}function kh(e){return class extends e{hasQuestionToken(){return this.compilerNode.questionToken!=null}getQuestionTokenNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.questionToken)}getQuestionTokenNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getQuestionTokenNode(),"Expected to find a question token.")}setHasQuestionToken(r){let n=this.getQuestionTokenNode(),i=n!=null;if(r===i)return this;return r?(Tr.isExclamationTokenable(this)&&this.setHasExclamationToken(!1),qa({insertPos:a.call(this),parent:this,newText:"?"})):Bs({children:[n]}),this;function a(){if(Tr.hasName(this))return this.getNameNode().getEnd();let s=this.getFirstChildByKind(b.SyntaxKind.ColonToken);if(s!=null)return s.getStart();let u=this.getLastChildByKind(b.SyntaxKind.SemicolonToken);return u!=null?u.getStart():this.getEnd()}}set(r){return io(e.prototype,this,r),r.hasQuestionToken!=null&&this.setHasQuestionToken(r.hasQuestionToken),this}getStructure(){return uo(e.prototype,this,{hasQuestionToken:this.hasQuestionToken()})}}}function DL(e){return class extends e{isReadonly(){return this.getReadonlyKeyword()!=null}getReadonlyKeyword(){return this.getFirstModifierByKind(b.SyntaxKind.ReadonlyKeyword)}getReadonlyKeywordOrThrow(){return b.errors.throwIfNullOrUndefined(this.getReadonlyKeyword(),"Expected to find a readonly keyword.")}setIsReadonly(r){return this.toggleModifier("readonly",r),this}set(r){return io(e.prototype,this,r),r.isReadonly!=null&&this.setIsReadonly(r.isReadonly),this}getStructure(){return uo(e.prototype,this,{isReadonly:this.isReadonly()})}}}function uq(e){return class extends e{getReturnType(){return this.getSignature().getReturnType()}getReturnTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getReturnTypeNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getReturnTypeNode(),"Expected to find a return type node.")}setReturnType(r){let n=Yg(this._getWriterWithQueuedChildIndentation(),r);if(b.StringUtils.isNullOrWhitespace(n))return this.removeReturnType();let i=this.getReturnTypeNode();if(i!=null)return i.getText()!==n&&i.replaceWithText(n),this;return qa({parent:this,insertPos:a(this).getEnd(),newText:`: ${n}`}),this;function a(s){return s.getKind()===b.SyntaxKind.IndexSignature?s.getFirstChildByKindOrThrow(b.SyntaxKind.CloseBracketToken):s.getFirstChildByKindOrThrow(b.SyntaxKind.CloseParenToken)}}removeReturnType(){let r=this.getReturnTypeNode();if(r==null)return this;let n=r.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.ColonToken);return Bs({children:[n,r],removePrecedingSpaces:!0}),this}getSignature(){let r=this._context.typeChecker.getSignatureFromNode(this);if(r==null)throw new b.errors.NotImplementedError("Expected the node to have a signature.");return r}set(r){return io(e.prototype,this,r),r.returnType!=null?this.setReturnType(r.returnType):r.hasOwnProperty(b.nameof(r,"returnType"))&&this.removeReturnType(),this}getStructure(){let r=this.getReturnTypeNode();return uo(e.prototype,this,{returnType:r?r.getText({trimLeadingIndentation:!0}):void 0})}}}function zpe(e){return class extends e{getScope(){let r=uM(this);if(r!=null)return r;if(Tr.isParameterDeclaration(this)&&this.isReadonly())return Oe.Scope.Public}setScope(r){return cq(this,r),this}getScopeKeyword(){return this.getModifiers().find(r=>{let n=r.getText();return n==="public"||n==="protected"||n==="private"})}hasScopeKeyword(){return this.getScopeKeyword()!=null}set(r){return io(e.prototype,this,r),r.hasOwnProperty(b.nameof(r,"scope"))&&this.setScope(r.scope),this}getStructure(){return uo(e.prototype,this,{scope:this.getScope()})}}}function uM(e){let r=e.getCombinedModifierFlags();return(r&b.ts.ModifierFlags.Private)!==0?Oe.Scope.Private:(r&b.ts.ModifierFlags.Protected)!==0?Oe.Scope.Protected:(r&b.ts.ModifierFlags.Public)!==0?Oe.Scope.Public:void 0}function cq(e,r){e.toggleModifier("public",r===Oe.Scope.Public),e.toggleModifier("protected",r===Oe.Scope.Protected),e.toggleModifier("private",r===Oe.Scope.Private)}function gS(e){return class extends e{getScope(){return uM(this)||Oe.Scope.Public}setScope(r){return cq(this,r),this}hasScopeKeyword(){return uM(this)!=null}set(r){return io(e.prototype,this,r),r.hasOwnProperty(b.nameof(r,"scope"))&&this.setScope(r.scope),this}getStructure(){return uo(e.prototype,this,{scope:this.hasScopeKeyword()?this.getScope():void 0})}}}function yv(e){return uq(Jpe(e))}function zD(e){return class extends e{isStatic(){return this.hasModifier(b.SyntaxKind.StaticKeyword)}getStaticKeyword(){return this.getFirstModifierByKind(b.SyntaxKind.StaticKeyword)}getStaticKeywordOrThrow(){return b.errors.throwIfNullOrUndefined(this.getStaticKeyword(),"Expected to find a static keyword.")}setIsStatic(r){return this.toggleModifier("static",r),this}set(r){return io(e.prototype,this,r),r.isStatic!=null&&this.setIsStatic(r.isStatic),this}getStructure(){return uo(e.prototype,this,{isStatic:this.isStatic()})}}}function ld(e){return class extends e{insertText(r,n){return this.replaceText([r,r],n),this}removeText(r,n){return r==null?this.replaceText(Xfe(this),""):this.replaceText([r,n],""),this}replaceText(r,n){let i=this.getChildSyntaxListOrThrow(),a=Xfe(this),s=r[0],u=r[1];return p(),qa({insertPos:s,newText:Yg(this._getWriter(),n),parent:i.getParentOrThrow(),replacing:{textLength:u-s,nodes:[i]}}),this;function p(){if(f(s),f(u),s>u)throw new b.errors.ArgumentError("range","Cannot specify a start position greater than the end position.")}function f(m){if(!(m>=a[0]&&m<=a[1]))throw new b.errors.InvalidOperationError(`Cannot insert or replace text outside the bounds of the node. Expected a position between [${a[0]}, ${a[1]}], but received ${m}.`)}}}}function Xfe(e){let r=a(),n=Tr.isSourceFile(r)?void 0:r.getPreviousSiblingIfKind(b.SyntaxKind.OpenBraceToken),i=n==null?void 0:r.getNextSiblingIfKind(b.SyntaxKind.CloseBraceToken);if(n!=null&&i!=null)return[n.getEnd(),i.getStart()];return[r.getPos(),r.getEnd()];function a(){return Tr.isSourceFile(e)?e:e.getChildSyntaxListOrThrow()}}function lG(e){return class extends e{getTypeArguments(){return this.compilerNode.typeArguments==null?[]:this.compilerNode.typeArguments.map(r=>this._getNodeFromCompilerNode(r))}addTypeArgument(r){return this.addTypeArguments([r])[0]}addTypeArguments(r){return this.insertTypeArguments(this.getTypeArguments().length,r)}insertTypeArgument(r,n){return this.insertTypeArguments(r,[n])[0]}insertTypeArguments(r,n){if(b.ArrayUtils.isNullOrEmpty(n))return[];let i=this.getTypeArguments();if(r=ku(r,i.length),i.length===0){let a=this.getFirstChildByKindOrThrow(b.SyntaxKind.Identifier);qa({insertPos:a.getEnd(),parent:this,newText:`<${n.join(", ")}>`})}else H_({parent:this.getFirstChildByKindOrThrow(b.SyntaxKind.LessThanToken).getNextSiblingIfKindOrThrow(b.SyntaxKind.SyntaxList),currentNodes:i,insertIndex:r,newText:n.join(", "),useTrailingCommas:!1});return af(i,this.getTypeArguments(),r,!1)}removeTypeArgument(r){let n=this.getTypeArguments();if(n.length===0)throw new b.errors.InvalidOperationError("Cannot remove a type argument when none exist.");let i=typeof r=="number"?a(r):r;if(n.length===1){let s=n[0].getParentSyntaxListOrThrow();Bs({children:[s.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.LessThanToken),s,s.getNextSiblingIfKindOrThrow(b.SyntaxKind.GreaterThanToken)]})}else mv(i);return this;function a(s){return n[ku(s,n.length-1)]}}}}function KE(e){return class extends e{getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getTypeNode(),"Expected to find a type node.")}setType(r){let n=Yg(this._getWriterWithQueuedChildIndentation(),r);if(b.StringUtils.isNullOrWhitespace(n))return this.removeType();let i=this.getTypeNode();if(i!=null&&i.getText()===n)return this;let a=Yfe(this),s=this.getFirstChildByKind(a),u,p;return s==null?(u=f(this),p=(a===b.SyntaxKind.EqualsToken?" = ":": ")+n):(u=i.getStart(),p=n),qa({parent:this,insertPos:u,newText:p,replacing:{textLength:i==null?0:i.getWidth()}}),this;function f(g){let D=g.getFirstChildByKindOrThrow(b.SyntaxKind.Identifier),P=D.getNextSibling();return(m(P)?P:D).getEnd()}function m(g){if(g==null)return!1;let D=g.getKind();return D===b.SyntaxKind.QuestionToken||D===b.SyntaxKind.ExclamationToken}}set(r){return io(e.prototype,this,r),r.type!=null?this.setType(r.type):r.hasOwnProperty(b.nameof(r,"type"))&&this.removeType(),this}removeType(){if(this.getKind()===b.SyntaxKind.TypeAliasDeclaration)throw new b.errors.NotSupportedError(`Cannot remove the type of a type alias. Use ${b.nameof("setType")} instead.`);let r=this.getTypeNode();if(r==null)return this;let n=r.getPreviousSiblingIfKindOrThrow(Yfe(this));return Bs({children:[n,r],removePrecedingSpaces:!0}),this}getStructure(){let r=this.getTypeNode();return uo(e.prototype,this,{type:r?r.getText({trimLeadingIndentation:!0}):void 0})}}}function Yfe(e){switch(e.getKind()){case b.SyntaxKind.TypeAliasDeclaration:return b.SyntaxKind.EqualsToken;default:return b.SyntaxKind.ColonToken}}function dq(e){return class extends e{addMember(r){return this.addMembers([r])[0]}addMembers(r){return this.insertMembers(ad(this.getMembersWithComments()),r)}insertMember(r,n){return this.insertMembers(r,[n])[0]}insertMembers(r,n){return Ppe({getIndexedChildren:()=>this.getMembersWithComments(),index:r,parent:this,write:i=>{i.newLineIfLastNot();let a=this._getWriter();this._context.structurePrinterFactory.forTypeElementMember().printTexts(a,n),i.write(a.toString()),i.newLineIfLastNot()}})}addConstructSignature(r){return this.addConstructSignatures([r])[0]}addConstructSignatures(r){return this.insertConstructSignatures(ad(this.getMembersWithComments()),r)}insertConstructSignature(r,n){return this.insertConstructSignatures(r,[n])[0]}insertConstructSignatures(r,n){return rL({thisNode:this,index:r,structures:n,expectedKind:b.SyntaxKind.ConstructSignature,createStructurePrinter:()=>this._context.structurePrinterFactory.forConstructSignatureDeclaration()})}getConstructSignature(r){return this.getConstructSignatures().find(r)}getConstructSignatureOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getConstructSignature(r),"Expected to find a construct signature with the provided condition.")}getConstructSignatures(){return this.compilerNode.members.filter(r=>r.kind===b.SyntaxKind.ConstructSignature).map(r=>this._getNodeFromCompilerNode(r))}addCallSignature(r){return this.addCallSignatures([r])[0]}addCallSignatures(r){return this.insertCallSignatures(ad(this.getMembersWithComments()),r)}insertCallSignature(r,n){return this.insertCallSignatures(r,[n])[0]}insertCallSignatures(r,n){return rL({thisNode:this,index:r,structures:n,expectedKind:b.SyntaxKind.CallSignature,createStructurePrinter:()=>this._context.structurePrinterFactory.forCallSignatureDeclaration()})}getCallSignature(r){return this.getCallSignatures().find(r)}getCallSignatureOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getCallSignature(r),"Expected to find a call signature with the provided condition.")}getCallSignatures(){return this.compilerNode.members.filter(r=>r.kind===b.SyntaxKind.CallSignature).map(r=>this._getNodeFromCompilerNode(r))}addIndexSignature(r){return this.addIndexSignatures([r])[0]}addIndexSignatures(r){return this.insertIndexSignatures(ad(this.getMembersWithComments()),r)}insertIndexSignature(r,n){return this.insertIndexSignatures(r,[n])[0]}insertIndexSignatures(r,n){return rL({thisNode:this,index:r,structures:n,expectedKind:b.SyntaxKind.IndexSignature,createStructurePrinter:()=>this._context.structurePrinterFactory.forIndexSignatureDeclaration()})}getIndexSignature(r){return this.getIndexSignatures().find(r)}getIndexSignatureOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getIndexSignature(r),"Expected to find a index signature with the provided condition.")}getIndexSignatures(){return this.compilerNode.members.filter(r=>r.kind===b.SyntaxKind.IndexSignature).map(r=>this._getNodeFromCompilerNode(r))}addMethod(r){return this.addMethods([r])[0]}addMethods(r){return this.insertMethods(ad(this.getMembersWithComments()),r)}insertMethod(r,n){return this.insertMethods(r,[n])[0]}insertMethods(r,n){return rL({thisNode:this,index:r,structures:n,expectedKind:b.SyntaxKind.MethodSignature,createStructurePrinter:()=>this._context.structurePrinterFactory.forMethodSignature()})}getMethod(r){return ic(this.getMethods(),r)}getMethodOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getMethod(r),()=>Ou("interface method signature",r))}getMethods(){return this.compilerNode.members.filter(r=>r.kind===b.SyntaxKind.MethodSignature).map(r=>this._getNodeFromCompilerNode(r))}addProperty(r){return this.addProperties([r])[0]}addProperties(r){return this.insertProperties(ad(this.getMembersWithComments()),r)}insertProperty(r,n){return this.insertProperties(r,[n])[0]}insertProperties(r,n){return rL({thisNode:this,index:r,structures:n,expectedKind:b.SyntaxKind.PropertySignature,createStructurePrinter:()=>this._context.structurePrinterFactory.forPropertySignature()})}getProperty(r){return ic(this.getProperties(),r)}getPropertyOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getProperty(r),()=>Ou("interface property signature",r))}getProperties(){return this.compilerNode.members.filter(r=>r.kind===b.SyntaxKind.PropertySignature).map(r=>this._getNodeFromCompilerNode(r))}getMembers(){return this.compilerNode.members.map(r=>this._getNodeFromCompilerNode(r))}getMembersWithComments(){let r=this.compilerNode;return od.getContainerArray(r,this._sourceFile.compilerNode).map(n=>this._getNodeFromCompilerNode(n))}set(r){return io(e.prototype,this,r),r.callSignatures!=null&&(this.getCallSignatures().forEach(n=>n.remove()),this.addCallSignatures(r.callSignatures)),r.constructSignatures!=null&&(this.getConstructSignatures().forEach(n=>n.remove()),this.addConstructSignatures(r.constructSignatures)),r.indexSignatures!=null&&(this.getIndexSignatures().forEach(n=>n.remove()),this.addIndexSignatures(r.indexSignatures)),r.properties!=null&&(this.getProperties().forEach(n=>n.remove()),this.addProperties(r.properties)),r.methods!=null&&(this.getMethods().forEach(n=>n.remove()),this.addMethods(r.methods)),this}getStructure(){return uo(e.prototype,this,{callSignatures:this.getCallSignatures().map(r=>r.getStructure()),constructSignatures:this.getConstructSignatures().map(r=>r.getStructure()),indexSignatures:this.getIndexSignatures().map(r=>r.getStructure()),methods:this.getMethods().map(r=>r.getStructure()),properties:this.getProperties().map(r=>r.getStructure())})}}}function rL(e){return rq({getIndexedChildren:()=>e.thisNode.getMembersWithComments(),parent:e.thisNode,index:e.index,structures:e.structures,expectedKind:e.expectedKind,write:(r,n)=>{r.newLineIfLastNot(),e.createStructurePrinter().printTexts(r,e.structures),r.newLineIfLastNot()}})}function z_(e){return class extends e{getTypeParameter(r){return ic(this.getTypeParameters(),r)}getTypeParameterOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getTypeParameter(r),()=>Ou("type parameter",r))}getTypeParameters(){let r=this.compilerNode.typeParameters;return r==null?[]:r.map(n=>this._getNodeFromCompilerNode(n))}addTypeParameter(r){return this.addTypeParameters([r])[0]}addTypeParameters(r){return this.insertTypeParameters(ad(this.compilerNode.typeParameters),r)}insertTypeParameter(r,n){return this.insertTypeParameters(r,[n])[0]}insertTypeParameters(r,n){if(b.ArrayUtils.isNullOrEmpty(n))return[];let i=this.getTypeParameters(),a=this._getWriterWithQueuedChildIndentation(),s=this._context.structurePrinterFactory.forTypeParameterDeclaration();return r=ku(r,i.length),s.printTexts(a,n),i.length===0?qa({insertPos:aUe(this),parent:this,newText:`<${a.toString()}>`}):H_({parent:this.getFirstChildByKindOrThrow(b.SyntaxKind.LessThanToken).getNextSiblingIfKindOrThrow(b.SyntaxKind.SyntaxList),currentNodes:i,insertIndex:r,newText:a.toString(),useTrailingCommas:!1}),af(i,this.getTypeParameters(),r,!1)}set(r){return io(e.prototype,this,r),r.typeParameters!=null&&(this.getTypeParameters().forEach(n=>n.remove()),this.addTypeParameters(r.typeParameters)),this}getStructure(){return uo(e.prototype,this,{typeParameters:this.getTypeParameters().map(r=>r.getStructure())})}}}function aUe(e){let r=e;if(r.getNameNode!=null)return r.getNameNode().getEnd();if(Tr.isCallSignatureDeclaration(e)||Tr.isFunctionTypeNode(e))return e.getFirstChildByKindOrThrow(b.SyntaxKind.OpenParenToken).getStart();throw new b.errors.NotImplementedError(`Not implemented scenario inserting type parameters for node with kind ${e.getKindName()}.`)}function uG(e){return class extends e{unwrap(){f9e(this)}}}var cM=class extends Tr{getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}},oUe=e=>SL(XT(aG(e))),$pe=oUe(Tr),dM=class extends $pe{getPropertyNameNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getPropertyNameNode(),"Expected to find a property name node.")}getPropertyNameNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.propertyName)}},fM=class extends Tr{getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}};function yS(e){return class extends e{isAbstract(){return this.getAbstractKeyword()!=null}getAbstractKeyword(){return this.getFirstModifierByKind(b.SyntaxKind.AbstractKeyword)}getAbstractKeywordOrThrow(){return b.errors.throwIfNullOrUndefined(this.getAbstractKeyword(),"Expected to find an abstract keyword.")}setIsAbstract(r){return this.toggleModifier("abstract",r),this}set(r){return io(e.prototype,this,r),r.isAbstract!=null&&this.setIsAbstract(r.isAbstract),this}getStructure(){return uo(e.prototype,this,{isAbstract:this.isAbstract()})}}}var oc=class extends Tr{getContextualType(){return this._context.typeChecker.getContextualType(this)}},Xpe=oc,oL=class extends Xpe{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}getOperatorToken(){return this._getNodeFromCompilerNode(this.compilerNode.operatorToken)}getRight(){return this._getNodeFromCompilerNode(this.compilerNode.right)}},Ype=oL,sL=class extends Ype{getOperatorToken(){return this._getNodeFromCompilerNode(this.compilerNode.operatorToken)}},Qpe=sL,FH=class extends Qpe{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}},fv=class extends oc{},pM=class extends fv{},UD=class extends pM{},UT=class extends UD{},sd=class extends UT{},mM=class extends sd{getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}addElement(r,n){return this.addElements([r],n)[0]}addElements(r,n){return this.insertElements(this.compilerNode.elements.length,r,n)}insertElement(r,n,i){return this.insertElements(r,[n],i)[0]}insertElements(r,n,i={}){let a=this.getElements();r=ku(r,a.length);let s=g(this),u=s?this._getWriterWithChildIndentation():this._getWriterWithQueuedChildIndentation(),p=new aL;return(s?new BT(p):new Nh(p)).printText(u,n),m(this);function m(D){H_({parent:D.getFirstChildByKindOrThrow(b.SyntaxKind.SyntaxList),currentNodes:a,insertIndex:r,newText:u.toString(),useNewLines:s,useTrailingCommas:s&&D._context.manipulationSettings.getUseTrailingCommas()});let P=D.getElements();return af(a,P,r,!1)}function g(D){if(i.useNewLines!=null)return i.useNewLines;if(a.length>1)return P();return D.getStartLineNumber()!==D.getEndLineNumber();function P(){let B=a[0].getStartLineNumber();for(let K=1;K<a.length;K++){let h=a[K].getStartLineNumber();if(B===h)return!1;B=h}return!0}}}removeElement(r){let n=this.getElements();if(n.length===0)throw new b.errors.InvalidOperationError("Cannot remove an element when none exist.");let i=typeof r=="number"?a(r):r;mv(i);function a(s){return n[ku(s,n.length-1)]}}};function CL(e){return class extends e{getExpression(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.expression)}getExpressionOrThrow(){return b.errors.throwIfNullOrUndefined(this.getExpression(),"Expected to find an expression.")}getExpressionIfKind(r){let n=this.getExpression();return n?.getKind()===r?n:void 0}getExpressionIfKindOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getExpressionIfKind(r),`An expression with the kind kind ${b.getSyntaxKindName(r)} was expected.`)}}}function $D(e){return class extends e{getExpression(){return this._getNodeFromCompilerNode(this.compilerNode.expression)}getExpressionIfKind(r){let{expression:n}=this.compilerNode;return n.kind===r?this._getNodeFromCompilerNode(n):void 0}getExpressionIfKindOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getExpressionIfKind(r),`An expression of the kind ${b.getSyntaxKindName(r)} was expected.`)}setExpression(r){return this.getExpression().replaceWithText(r,this._getWriterWithQueuedChildIndentation()),this}set(r){return io(e.prototype,this,r),r.expression!=null&&this.setExpression(r.expression),this}}}function ud(e){return $D(e)}function sUe(e){return $D(e)}function YT(e){return $D(e)}function fq(e){return $D(e)}function XD(e){return $D(e)}var lUe=e=>KE(ud(e)),Zpe=lUe(oc),_M=class extends Zpe{},eme=XD(fv),gM=class extends eme{},uUe=e=>lG(tq(sG(YT(e)))),rme=uUe(UD),yM=class extends rme{getReturnType(){return this._context.typeChecker.getTypeAtLocation(this)}},tme=oc,vM=class extends tme{getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}},nme=oc,hM=class extends nme{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)}},ime=XD(fv),EM=class extends ime{},cUe=e=>sG(YT(e)),ame=cUe(UT),lL=class extends ame{getArgumentExpression(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.argumentExpression)}getArgumentExpressionOrThrow(){return b.errors.throwIfNullOrUndefined(this.getArgumentExpression(),"Expected to find an argument expression.")}},ome=sd,bM=class extends ome{},sme=qD(sd),dS=class extends sme{},lme=gv(sd),SM=class extends lme{getKeywordToken(){return this.compilerNode.keywordToken}},dUe=e=>lG(tq(YT(e))),ume=dUe(sd),TM=class extends ume{},cme=ud(UD),xM=class extends cme{},KT=class extends Tr{remove(){mv(this)}},DM=class extends KT{},dme=sL,GH=class extends dme{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}},fme=sd,CM=class extends fme{getPropertyOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getProperty(r),()=>Ou("property",r))}getProperty(r){let n;return typeof r=="string"?n=i=>i[b.nameof("getName")]==null?!1:i.getName()===r:n=r,this.getProperties().find(n)}getProperties(){return this.compilerNode.properties.map(r=>this._getNodeFromCompilerNode(r))}getPropertiesWithComments(){return od.getContainerArray(this.compilerNode,this.getSourceFile().compilerNode).map(n=>this._getNodeFromCompilerNode(n))}_getAddIndex(){return od.getContainerArray(this.compilerNode,this.getSourceFile().compilerNode).length}addProperty(r){return this.insertProperties(this._getAddIndex(),[r])[0]}addProperties(r){return this.insertProperties(this._getAddIndex(),r)}insertProperty(r,n){return this.insertProperties(r,[n])[0]}insertProperties(r,n){let i=this.getPropertiesWithComments();r=ku(r,i.length);let a=this._getWriterWithChildIndentation();return this._context.structurePrinterFactory.forObjectLiteralExpressionProperty().printTexts(a,n),H_({parent:this.getChildSyntaxListOrThrow(),currentNodes:i,insertIndex:r,newText:a.toString(),useNewLines:!0,useTrailingCommas:this._context.manipulationSettings.getUseTrailingCommas()}),af(i,this.getPropertiesWithComments(),r,!0)}addPropertyAssignment(r){return this.addPropertyAssignments([r])[0]}addPropertyAssignments(r){return this.insertPropertyAssignments(this._getAddIndex(),r)}insertPropertyAssignment(r,n){return this.insertPropertyAssignments(r,[n])[0]}insertPropertyAssignments(r,n){return this._insertProperty(r,n,()=>this._context.structurePrinterFactory.forPropertyAssignment())}addShorthandPropertyAssignment(r){return this.addShorthandPropertyAssignments([r])[0]}addShorthandPropertyAssignments(r){return this.insertShorthandPropertyAssignments(this._getAddIndex(),r)}insertShorthandPropertyAssignment(r,n){return this.insertShorthandPropertyAssignments(r,[n])[0]}insertShorthandPropertyAssignments(r,n){return this._insertProperty(r,n,()=>this._context.structurePrinterFactory.forShorthandPropertyAssignment())}addSpreadAssignment(r){return this.addSpreadAssignments([r])[0]}addSpreadAssignments(r){return this.insertSpreadAssignments(this._getAddIndex(),r)}insertSpreadAssignment(r,n){return this.insertSpreadAssignments(r,[n])[0]}insertSpreadAssignments(r,n){return this._insertProperty(r,n,()=>this._context.structurePrinterFactory.forSpreadAssignment())}addMethod(r){return this.addMethods([r])[0]}addMethods(r){return this.insertMethods(this._getAddIndex(),r)}insertMethod(r,n){return this.insertMethods(r,[n])[0]}insertMethods(r,n){return this._insertProperty(r,n,()=>this._context.structurePrinterFactory.forMethodDeclaration({isAmbient:!1}))}addGetAccessor(r){return this.addGetAccessors([r])[0]}addGetAccessors(r){return this.insertGetAccessors(this._getAddIndex(),r)}insertGetAccessor(r,n){return this.insertGetAccessors(r,[n])[0]}insertGetAccessors(r,n){return this._insertProperty(r,n,()=>this._context.structurePrinterFactory.forGetAccessorDeclaration({isAmbient:!1}))}addSetAccessor(r){return this.addSetAccessors([r])[0]}addSetAccessors(r){return this.insertSetAccessors(this._getAddIndex(),r)}insertSetAccessor(r,n){return this.insertSetAccessors(r,[n])[0]}insertSetAccessors(r,n){return this._insertProperty(r,n,()=>this._context.structurePrinterFactory.forSetAccessorDeclaration({isAmbient:!1}))}_insertProperty(r,n,i){r=ku(r,this._getAddIndex());let a=this._getWriterWithChildIndentation(),s=new BT(i()),u=this.getPropertiesWithComments();return s.printText(a,n),H_({parent:this.getFirstChildByKindOrThrow(b.SyntaxKind.SyntaxList),currentNodes:u,insertIndex:r,newText:a.toString(),useNewLines:!0,useTrailingCommas:this._context.manipulationSettings.getUseTrailingCommas()}),af(u,this.getPropertiesWithComments(),r,!1)}},fUe=e=>iG(kh(UE(e))),mR=fUe(KT),AM=class extends mR{removeInitializer(){let r=this.getInitializerOrThrow(),n=r.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.ColonToken),i=this.getChildIndex(),a=this._sourceFile.getFullText(),s=this.getStart(),u=a.substring(s,n.getPos())+a.substring(r.getEnd(),this.getEnd()),p=this.getParentSyntaxList()||this.getParentOrThrow();return qa({insertPos:s,newText:u,parent:p,replacing:{textLength:this.getWidth()}}),p.getChildAtIndexIfKindOrThrow(i,b.SyntaxKind.ShorthandPropertyAssignment)}setInitializer(r){let n=this.getInitializerOrThrow();return qa({insertPos:n.getStart(),newText:Yg(this._getWriterWithQueuedChildIndentation(),r),parent:this,replacing:{textLength:n.getWidth()}}),this}set(r){if(io(mR.prototype,this,r),r.initializer!=null)this.setInitializer(r.initializer);else if(r.hasOwnProperty(b.nameof(r,"initializer")))return this.removeInitializer();return this}getStructure(){let r=this.getInitializerOrThrow(),n=uo(mR.prototype,this,{kind:Oe.StructureKind.PropertyAssignment,initializer:r.getText()});return delete n.hasQuestionToken,n}},pUe=e=>iG(kh(gv(e))),_R=pUe(KT),LM=class extends _R{hasObjectAssignmentInitializer(){return this.compilerNode.objectAssignmentInitializer!=null}getObjectAssignmentInitializerOrThrow(){return b.errors.throwIfNullOrUndefined(this.getObjectAssignmentInitializer(),"Expected to find an object assignment initializer.")}getObjectAssignmentInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.objectAssignmentInitializer)}getEqualsTokenOrThrow(){return b.errors.throwIfNullOrUndefined(this.getEqualsToken(),"Expected to find an equals token.")}getEqualsToken(){let r=this.compilerNode.equalsToken;if(r!=null)return this._getNodeFromCompilerNode(r)}removeObjectAssignmentInitializer(){return this.hasObjectAssignmentInitializer()?(Bs({children:[this.getEqualsTokenOrThrow(),this.getObjectAssignmentInitializerOrThrow()],removePrecedingSpaces:!0}),this):this}setInitializer(r){let n=this.getParentSyntaxList()||this.getParentOrThrow(),i=this.getChildIndex();return qa({insertPos:this.getStart(),newText:this.getText()+`: ${r}`,parent:n,replacing:{textLength:this.getWidth()}}),n.getChildAtIndexIfKindOrThrow(i,b.SyntaxKind.PropertyAssignment)}set(r){return io(_R.prototype,this,r),this}getStructure(){let r=uo(_R.prototype,this,{kind:Oe.StructureKind.ShorthandPropertyAssignment});return delete r.hasQuestionToken,r}},gR=ud(KT),NM=class extends gR{set(r){return io(gR.prototype,this,r),this}getStructure(){return uo(gR.prototype,this,{kind:Oe.StructureKind.SpreadAssignment,expression:this.getExpression().getText()})}},pme=oc,IM=class extends pme{},mme=ud(oc),PM=class extends mme{},_me=ud(oc),OM=class extends _me{},gme=fv,kM=class extends gme{getOperatorToken(){return this.compilerNode.operator}getOperand(){return this._getNodeFromCompilerNode(this.compilerNode.operand)}},yme=fv,RM=class extends yme{getOperatorToken(){return this.compilerNode.operator}getOperand(){return this._getNodeFromCompilerNode(this.compilerNode.operand)}},mUe=e=>gv(sG(YT(e))),vme=mUe(UT),uL=class extends vme{},hme=ud(oc),MM=class extends hme{},Eme=fq(lL),BH=class extends Eme{},bme=sd,wM=class extends bme{},Sme=fq(uL),UH=class extends Sme{},Tme=sd,FM=class extends Tme{},_Ue=e=>KE(XD(e)),xme=_Ue(fv),GM=class extends xme{},Dme=XD(fv),BM=class extends Dme{},Cme=XD(fv),UM=class extends Cme{},Ame=CL($T(oc)),KM=class extends Ame{},Lme=Im(Tr),Cl=class extends Lme{remove(){d9e(this)}};function Rh(e){return class extends e{getStatements(){var r;let n=this._getCompilerStatementsContainer();return((r=n?.statements)!==null&&r!==void 0?r:[]).map(a=>this._getNodeFromCompilerNode(a))}getStatementsWithComments(){return this._getCompilerStatementsWithComments().map(r=>this._getNodeFromCompilerNode(r))}getStatement(r){return this.getStatements().find(r)}getStatementOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getStatement(r),"Expected to find a statement matching the provided condition.")}getStatementByKind(r){let n=this._getCompilerStatementsWithComments().find(i=>i.kind===r);return this._getNodeFromCompilerNodeIfExists(n)}getStatementByKindOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getStatementByKind(r),`Expected to find a statement with syntax kind ${b.getSyntaxKindName(r)}.`)}addStatements(r){return this.insertStatements(this._getCompilerStatementsWithComments().length,r)}insertStatements(r,n){Qfe(this);let i=s=>{this._context.structurePrinterFactory.forStatement({isAmbient:f_(this)}).printTexts(s,n)};return a.call(this).insertChildText(r,i);function a(){let s=this.getChildSyntaxListOrThrow();if(Tr.isCaseClause(this)||Tr.isDefaultClause(this)){let u=s.getFirstChildIfKind(b.SyntaxKind.Block);if(u!=null)return u.getChildSyntaxListOrThrow()}return s}}removeStatement(r){return r=ku(r,this._getCompilerStatementsWithComments().length-1),this.removeStatements([r,r])}removeStatements(r){let n=this.getStatementsWithComments();return b.errors.throwIfRangeOutOfRange(r,[0,n.length],"indexRange"),eG(n.slice(r[0],r[1]+1)),this}addClass(r){return this.addClasses([r])[0]}addClasses(r){return this.insertClasses(this._getCompilerStatementsWithComments().length,r)}insertClass(r,n){return this.insertClasses(r,[n])[0]}insertClasses(r,n){return this._insertChildren({expectedKind:b.SyntaxKind.ClassDeclaration,index:r,structures:n,write:(i,a)=>{this._standardWrite(i,a,()=>{this._context.structurePrinterFactory.forClassDeclaration({isAmbient:f_(this)}).printTexts(i,n)})}})}getClasses(){return this.getStatements().filter(Tr.isClassDeclaration)}getClass(r){return ic(this.getClasses(),r)}getClassOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getClass(r),()=>Ou("class",r))}addEnum(r){return this.addEnums([r])[0]}addEnums(r){return this.insertEnums(this._getCompilerStatementsWithComments().length,r)}insertEnum(r,n){return this.insertEnums(r,[n])[0]}insertEnums(r,n){return this._insertChildren({expectedKind:b.SyntaxKind.EnumDeclaration,index:r,structures:n,write:(i,a)=>{this._standardWrite(i,a,()=>{this._context.structurePrinterFactory.forEnumDeclaration().printTexts(i,n)})}})}getEnums(){return this.getStatements().filter(Tr.isEnumDeclaration)}getEnum(r){return ic(this.getEnums(),r)}getEnumOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getEnum(r),()=>Ou("enum",r))}addFunction(r){return this.addFunctions([r])[0]}addFunctions(r){return this.insertFunctions(this._getCompilerStatementsWithComments().length,r)}insertFunction(r,n){return this.insertFunctions(r,[n])[0]}insertFunctions(r,n){return this._insertChildren({expectedKind:b.SyntaxKind.FunctionDeclaration,index:r,structures:n,write:(i,a)=>{this._standardWrite(i,a,()=>{this._context.structurePrinterFactory.forFunctionDeclaration({isAmbient:f_(this)}).printTexts(i,n)},{previousNewLine:s=>n[0].hasDeclareKeyword===!0&&Tr.isFunctionDeclaration(s)&&s.getBody()==null,nextNewLine:s=>n[n.length-1].hasDeclareKeyword===!0&&Tr.isFunctionDeclaration(s)&&s.getBody()==null})}})}getFunctions(){return this.getStatements().filter(Tr.isFunctionDeclaration).filter(r=>r.isAmbient()||r.isImplementation())}getFunction(r){return ic(this.getFunctions(),r)}getFunctionOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getFunction(r),()=>Ou("function",r))}addInterface(r){return this.addInterfaces([r])[0]}addInterfaces(r){return this.insertInterfaces(this._getCompilerStatementsWithComments().length,r)}insertInterface(r,n){return this.insertInterfaces(r,[n])[0]}insertInterfaces(r,n){return this._insertChildren({expectedKind:b.SyntaxKind.InterfaceDeclaration,index:r,structures:n,write:(i,a)=>{this._standardWrite(i,a,()=>{this._context.structurePrinterFactory.forInterfaceDeclaration().printTexts(i,n)})}})}getInterfaces(){return this.getStatements().filter(Tr.isInterfaceDeclaration)}getInterface(r){return ic(this.getInterfaces(),r)}getInterfaceOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getInterface(r),()=>Ou("interface",r))}addModule(r){return this.addModules([r])[0]}addModules(r){return this.insertModules(this._getCompilerStatementsWithComments().length,r)}insertModule(r,n){return this.insertModules(r,[n])[0]}insertModules(r,n){return this._insertChildren({expectedKind:b.SyntaxKind.ModuleDeclaration,index:r,structures:n,write:(i,a)=>{this._standardWrite(i,a,()=>{this._context.structurePrinterFactory.forModuleDeclaration({isAmbient:f_(this)}).printTexts(i,n)})}})}getModules(){return this.getStatements().filter(Tr.isModuleDeclaration)}getModule(r){return ic(this.getModules(),r)}getModuleOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getModule(r),()=>Ou("module",r))}addTypeAlias(r){return this.addTypeAliases([r])[0]}addTypeAliases(r){return this.insertTypeAliases(this._getCompilerStatementsWithComments().length,r)}insertTypeAlias(r,n){return this.insertTypeAliases(r,[n])[0]}insertTypeAliases(r,n){return this._insertChildren({expectedKind:b.SyntaxKind.TypeAliasDeclaration,index:r,structures:n,write:(i,a)=>{this._standardWrite(i,a,()=>{this._context.structurePrinterFactory.forTypeAliasDeclaration().printTexts(i,n)},{previousNewLine:s=>Tr.isTypeAliasDeclaration(s),nextNewLine:s=>Tr.isTypeAliasDeclaration(s)})}})}getTypeAliases(){return this.getStatements().filter(Tr.isTypeAliasDeclaration)}getTypeAlias(r){return ic(this.getTypeAliases(),r)}getTypeAliasOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getTypeAlias(r),()=>Ou("type alias",r))}getVariableStatements(){return this.getStatements().filter(Tr.isVariableStatement)}getVariableStatement(r){return this.getVariableStatements().find(n());function n(){return typeof r=="string"?i=>i.getDeclarations().some(a=>YH(a,r)):r}}getVariableStatementOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getVariableStatement(r),"Expected to find a variable statement that matched the provided condition.")}addVariableStatement(r){return this.addVariableStatements([r])[0]}addVariableStatements(r){return this.insertVariableStatements(this._getCompilerStatementsWithComments().length,r)}insertVariableStatement(r,n){return this.insertVariableStatements(r,[n])[0]}insertVariableStatements(r,n){return this._insertChildren({expectedKind:b.SyntaxKind.VariableStatement,index:r,structures:n,write:(i,a)=>{this._standardWrite(i,a,()=>{this._context.structurePrinterFactory.forVariableStatement().printTexts(i,n)},{previousNewLine:s=>Tr.isVariableStatement(s),nextNewLine:s=>Tr.isVariableStatement(s)})}})}getVariableDeclarations(){let r=[];for(let n of this.getVariableStatements())r.push(...n.getDeclarations());return r}getVariableDeclaration(r){return ic(this.getVariableDeclarations(),r)}getVariableDeclarationOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getVariableDeclaration(r),()=>Ou("variable declaration",r))}getStructure(){let r={};return Tr.isBodyable(this)&&!this.hasBody()?r.statements=void 0:r.statements=this.getStatements().map(n=>Tr._hasStructure(n)?n.getStructure():n.getText({trimLeadingIndentation:!0})),uo(e.prototype,this,r)}set(r){if(Tr.isBodyable(this)&&r.statements==null&&r.hasOwnProperty(b.nameof(r,"statements")))this.removeBody();else if(r.statements!=null){let n=this._getCompilerStatementsWithComments().length;n>0&&this.removeStatements([0,n-1])}return io(e.prototype,this,r),r.statements!=null&&this.addStatements(r.statements),this}_getCompilerStatementsWithComments(){let r=this._getCompilerStatementsContainer();return r==null?[]:od.getContainerArray(r,this._sourceFile.compilerNode)}_getCompilerStatementsContainer(){var r;if(Tr.isSourceFile(this)||Tr.isCaseClause(this)||Tr.isDefaultClause(this))return this.compilerNode;if(Tr.isModuleDeclaration(this)){let n=this._getInnerBody();return n?.compilerNode}else{if(Tr.isBodyable(this)||Tr.isBodied(this))return(r=this.getBody())===null||r===void 0?void 0:r.compilerNode;if(Tr.isBlock(this)||Tr.isModuleBlock(this))return this.compilerNode;throw new b.errors.NotImplementedError(`Could not find the statements for node kind: ${this.getKindName()}, text: ${this.getText()}`)}}_insertChildren(r){return Qfe(this),rq({expectedKind:r.expectedKind,getIndexedChildren:()=>this.getStatementsWithComments(),index:r.index,parent:this,structures:r.structures,write:(n,i)=>r.write(n,i)})}_standardWrite(r,n,i,a={}){n.previousMember!=null&&(a.previousNewLine==null||!a.previousNewLine(n.previousMember))&&!Tr.isCommentNode(n.previousMember)?r.blankLine():n.isStartOfFile||r.newLineIfLastNot(),i(),n.nextMember!=null&&(a.nextNewLine==null||!a.nextNewLine(n.nextMember))?r.blankLine():r.newLineIfLastNot()}}}function Qfe(e){Tr.isBodyable(e)&&!e.hasBody()&&e.addBody()}var gUe=e=>ld(Rh(e)),Nme=gUe(Cl),WM=class extends Nme{},VM=class extends Cl{getLabel(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.label)}getLabelOrThrow(){return b.errors.throwIfNullOrUndefined(this.getLabel(),"Expected to find a label.")}},Ime=ld(Tr),jM=class extends Ime{getClauses(){return(this.compilerNode.clauses||[]).map(n=>this._getNodeFromCompilerNode(n))}removeClause(r){return r=ku(r,this.getClauses().length-1),this.removeClauses([r,r])}removeClauses(r){let n=this.getClauses();return b.errors.throwIfRangeOutOfRange(r,[0,n.length],"indexRange"),kpe(n.slice(r[0],r[1]+1)),this}},yUe=e=>sc(ud(ld(Rh(e)))),Pme=yUe(Tr),HM=class extends Pme{remove(){Ope(this)}},Ome=Tr,qM=class extends Ome{getBlock(){return this._getNodeFromCompilerNode(this.compilerNode.block)}getVariableDeclaration(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.variableDeclaration)}getVariableDeclarationOrThrow(){return b.errors.throwIfNullOrUndefined(this.getVariableDeclaration(),"Expected to find a variable declaration.")}},JM=class extends Cl{},zM=class extends Cl{getLabel(){return this.compilerNode.label==null?void 0:this._getNodeFromCompilerNode(this.compilerNode.label)}getLabelOrThrow(){return b.errors.throwIfNullOrUndefined(this.getLabel(),"Expected to find a label.")}},kme=Cl,$M=class extends kme{},vUe=e=>ld(Rh(e)),Rme=vUe(Tr),XM=class extends Rme{remove(){Ope(this)}},fS=class extends Cl{getStatement(){return this._getNodeFromCompilerNode(this.compilerNode.statement)}},Mme=ud(fS),YM=class extends Mme{},wme=Cl,QM=class extends wme{},Fme=ud(sc(Cl)),ZM=class extends Fme{},Gme=ud(fS),ew=class extends Gme{getInitializer(){return this._getNodeFromCompilerNode(this.compilerNode.initializer)}},Bme=ud(wpe(fS)),rw=class extends Bme{getInitializer(){return this._getNodeFromCompilerNode(this.compilerNode.initializer)}},Ume=fS,tw=class extends Ume{getInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.initializer)}getInitializerOrThrow(){return b.errors.throwIfNullOrUndefined(this.getInitializer(),"Expected to find an initializer.")}getCondition(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.condition)}getConditionOrThrow(){return b.errors.throwIfNullOrUndefined(this.getCondition(),"Expected to find a condition.")}getIncrementor(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.incrementor)}getIncrementorOrThrow(){return b.errors.throwIfNullOrUndefined(this.getIncrementor(),"Expected to find an incrementor.")}},Kme=ud(Cl),nw=class extends Kme{getThenStatement(){return this._getNodeFromCompilerNode(this.compilerNode.thenStatement)}getElseStatement(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.elseStatement)}remove(){let r=[];Tr.isIfStatement(this.getParentOrThrow())&&r.push(this.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.ElseKeyword)),r.push(this),eG(r)}},Wme=sc(Cl),iw=class extends Wme{getLabel(){return this._getNodeFromCompilerNode(this.compilerNode.label)}getStatement(){return this._getNodeFromCompilerNode(this.compilerNode.statement)}},Vme=Cl,aw=class extends Vme{},jme=CL(Cl),ow=class extends jme{},Hme=ud(Cl),sw=class extends Hme{getCaseBlock(){return this._getNodeFromCompilerNode(this.compilerNode.caseBlock)}getClauses(){return this.getCaseBlock().getClauses()}removeClause(r){return this.getCaseBlock().removeClause(r)}removeClauses(r){return this.getCaseBlock().removeClauses(r)}},qme=ud(Cl),lw=class extends qme{},Jme=Cl,uw=class extends Jme{getTryBlock(){return this._getNodeFromCompilerNode(this.compilerNode.tryBlock)}getCatchClause(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.catchClause)}getCatchClauseOrThrow(){return b.errors.throwIfNullOrUndefined(this.getCatchClause(),"Expected to find a catch clause.")}getFinallyBlock(){if(!(this.compilerNode.finallyBlock==null||this.compilerNode.finallyBlock.getFullWidth()===0))return this._getNodeFromCompilerNode(this.compilerNode.finallyBlock)}getFinallyBlockOrThrow(){return b.errors.throwIfNullOrUndefined(this.getFinallyBlock(),"Expected to find a finally block.")}},zme=Tr,cw=class extends zme{setElements(r){return this.replaceWithText(n=>{this._context.structurePrinterFactory.forAssertEntry().printAssertClause(n,r)}),this}getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}remove(){Bs({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}},yR=Hpe(Tr),dw=class extends yR{getValue(){return this._getNodeFromCompilerNode(this.compilerNode.value)}set(r){return io(yR.prototype,this,r),r.value&&this.getValue().replaceWithText(r.value),this}getStructure(){return uo(yR.prototype,this,{kind:Oe.StructureKind.AssertEntry,value:this.getValue().getText()})}},KH=ud(Cl),fw=class extends KH{isExportEquals(){return this.compilerNode.isExportEquals||!1}setIsExportEquals(r){return this.isExportEquals()===r?this:(r?this.getFirstChildByKindOrThrow(b.SyntaxKind.DefaultKeyword).replaceWithText("="):this.getFirstChildByKindOrThrow(b.SyntaxKind.EqualsToken).replaceWithText("default"),this)}set(r){return io(KH.prototype,this,r),r.expression!=null&&this.setExpression(r.expression),r.isExportEquals!=null&&this.setIsExportEquals(r.isExportEquals),this}getStructure(){return uo(Cl.prototype,this,{kind:Oe.StructureKind.ExportAssignment,expression:this.getExpression().getText(),isExportEquals:this.isExportEquals()})}},vR=Cl,pw=class extends vR{isTypeOnly(){return this.compilerNode.isTypeOnly}setIsTypeOnly(r){var n;if(this.isTypeOnly()===r)return this;if(r)qa({parent:this,insertPos:((n=this.getNodeProperty("exportClause"))!==null&&n!==void 0?n:this.getFirstChildByKindOrThrow(b.SyntaxKind.AsteriskToken)).getStart(),newText:"type "});else{let i=this.getFirstChildByKindOrThrow(b.ts.SyntaxKind.TypeKeyword);Bs({children:[i],removeFollowingSpaces:!0})}return this}getNamespaceExport(){let r=this.getNodeProperty("exportClause");return r!=null&&Tr.isNamespaceExport(r)?r:void 0}getNamespaceExportOrThrow(){return b.errors.throwIfNullOrUndefined(this.getNamespaceExport(),"Expected to find a namespace export.")}setNamespaceExport(r){let n=this.getNodeProperty("exportClause"),i=b.StringUtils.isNullOrWhitespace(r)?"*":`* as ${r}`;if(n==null){let a=this.getFirstChildByKindOrThrow(b.SyntaxKind.AsteriskToken);qa({insertPos:a.getStart(),parent:this,newText:i,replacing:{textLength:1}})}else Tr.isNamespaceExport(n)?n.getNameNode().replaceWithText(r):qa({insertPos:n.getStart(),parent:this,newText:i,replacing:{textLength:n.getWidth()}});return this}setModuleSpecifier(r){let n=typeof r=="string"?r:this._sourceFile.getRelativePathAsModuleSpecifierTo(r);if(b.StringUtils.isNullOrEmpty(n))return this.removeModuleSpecifier(),this;let i=this.getModuleSpecifier();if(i==null){let a=this.getLastChildIfKind(b.SyntaxKind.SemicolonToken),s=this._context.manipulationSettings.getQuoteKind();qa({insertPos:a!=null?a.getPos():this.getEnd(),parent:this,newText:` from ${s}${n}${s}`})}else i.setLiteralValue(n);return this}getModuleSpecifier(){let r=this._getNodeFromCompilerNodeIfExists(this.compilerNode.moduleSpecifier);if(r!=null){if(!Tr.isStringLiteral(r))throw new b.errors.InvalidOperationError("Expected the module specifier to be a string literal.");return r}}getModuleSpecifierValue(){let r=this.getModuleSpecifier();return r?.getLiteralValue()}getModuleSpecifierSourceFileOrThrow(){return b.errors.throwIfNullOrUndefined(this.getModuleSpecifierSourceFile(),"A module specifier source file was expected.")}getModuleSpecifierSourceFile(){let r=this.getLastChildByKind(b.SyntaxKind.StringLiteral);if(r==null)return;let n=r.getSymbol();if(n==null)return;let i=n.getDeclarations()[0];return i!=null&&Tr.isSourceFile(i)?i:void 0}isModuleSpecifierRelative(){let r=this.getModuleSpecifierValue();return r==null?!1:RE.isModuleSpecifierRelative(r)}removeModuleSpecifier(){let r=this.getModuleSpecifier();if(r==null)return this;if(!this.hasNamedExports())throw new b.errors.InvalidOperationError("Cannot remove the module specifier from an export declaration that has no named exports.");return Bs({children:[this.getFirstChildByKindOrThrow(b.SyntaxKind.FromKeyword),r],removePrecedingNewLines:!0,removePrecedingSpaces:!0}),this}hasModuleSpecifier(){return this.getLastChildByKind(b.SyntaxKind.StringLiteral)!=null}isNamespaceExport(){return!this.hasNamedExports()}hasNamedExports(){var r;return((r=this.compilerNode.exportClause)===null||r===void 0?void 0:r.kind)===b.SyntaxKind.NamedExports}addNamedExport(r){return this.addNamedExports([r])[0]}addNamedExports(r){return this.insertNamedExports(this.getNamedExports().length,r)}insertNamedExport(r,n){return this.insertNamedExports(r,[n])[0]}insertNamedExports(r,n){if(!(n instanceof Function)&&b.ArrayUtils.isNullOrEmpty(n))return[];let i=this.getNamedExports(),a=this._getWriterWithIndentation(),s=this._context.structurePrinterFactory.forNamedImportExportSpecifier();r=ku(r,i.length);let u=this.getNodeProperty("exportClause");if(u==null){s.printTextsWithBraces(a,n);let f=this.getFirstChildByKindOrThrow(b.SyntaxKind.AsteriskToken);qa({insertPos:f.getStart(),parent:this,newText:a.toString(),replacing:{textLength:1}})}else u.getKind()===b.SyntaxKind.NamespaceExport?(s.printTextsWithBraces(a,n),qa({insertPos:u.getStart(),parent:this,newText:a.toString(),replacing:{textLength:u.getWidth()}})):(s.printTexts(a,n),H_({parent:this.getFirstChildByKindOrThrow(b.SyntaxKind.NamedExports).getFirstChildByKindOrThrow(b.SyntaxKind.SyntaxList),currentNodes:i,insertIndex:r,newText:a.toString(),surroundWithSpaces:this._context.getFormatCodeSettings().insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces,useTrailingCommas:!1}));let p=this.getNamedExports();return af(i,p,r,!1)}getNamedExports(){let r=this.compilerNode.exportClause;return r==null||b.ts.isNamespaceExport(r)?[]:r.elements.map(n=>this._getNodeFromCompilerNode(n))}toNamespaceExport(){if(!this.hasModuleSpecifier())throw new b.errors.InvalidOperationError("Cannot change to a namespace export when no module specifier exists.");let r=this.getNodeProperty("exportClause");return r==null?this:(qa({parent:this,newText:"*",insertPos:r.getStart(),replacing:{textLength:r.getWidth()}}),this)}setAssertElements(r){let n=this.getAssertClause();if(n)r?n.setElements(r):n.remove();else if(r){let i=this._context.structurePrinterFactory.forAssertEntry(),a=this._context.createWriter();a.space(),i.printAssertClause(a,r),qa({parent:this,newText:a.toString(),insertPos:this.getSourceFile().getFullText()[this.getEnd()-1]===";"?this.getEnd()-1:this.getEnd()})}return this}getAssertClause(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertClause)}set(r){return io(vR.prototype,this,r),r.namedExports!=null?(hUe(this),this.addNamedExports(r.namedExports)):r.hasOwnProperty(b.nameof(r,"namedExports"))&&r.moduleSpecifier==null&&this.toNamespaceExport(),r.moduleSpecifier!=null?this.setModuleSpecifier(r.moduleSpecifier):r.hasOwnProperty(b.nameof(r,"moduleSpecifier"))&&this.removeModuleSpecifier(),r.namedExports==null&&r.hasOwnProperty(b.nameof(r,"namedExports"))&&this.toNamespaceExport(),r.namespaceExport!=null&&this.setNamespaceExport(r.namespaceExport),r.isTypeOnly!=null&&this.setIsTypeOnly(r.isTypeOnly),r.hasOwnProperty(b.nameof(r,"assertElements"))&&this.setAssertElements(r.assertElements),this}getStructure(){var r;let n=this.getModuleSpecifier(),i=this.getAssertClause();return uo(vR.prototype,this,{kind:Oe.StructureKind.ExportDeclaration,isTypeOnly:this.isTypeOnly(),moduleSpecifier:n?.getLiteralText(),namedExports:this.getNamedExports().map(a=>a.getStructure()),namespaceExport:(r=this.getNamespaceExport())===null||r===void 0?void 0:r.getName(),assertElements:i?i.getElements().map(a=>a.getStructure()):void 0})}};function hUe(e){let r=e.getNodeProperty("exportClause"),n;if(r!=null){if(e.getNamedExports().length===0)return;n=r}else n=e.getFirstChildByKindOrThrow(b.SyntaxKind.AsteriskToken);qa({parent:e,newText:"{ }",insertPos:n.getStart(),replacing:{textLength:n.getWidth()}})}var WH=Tr,mw=class extends WH{setName(r){let n=this.getNameNode();return n.getText()===r?this:(n.replaceWithText(r),this)}getName(){return this.getNameNode().getText()}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.propertyName||this.compilerNode.name)}renameAlias(r){if(b.StringUtils.isNullOrWhitespace(r))return this.removeAliasWithRename(),this;let n=this.getAliasNode();return n==null&&(this.setAlias(this.getName()),n=this.getAliasNode()),n.rename(r),this}setAlias(r){if(b.StringUtils.isNullOrWhitespace(r))return this.removeAlias(),this;let n=this.getAliasNode();return n==null?qa({insertPos:this.getNameNode().getEnd(),parent:this,newText:` as ${r}`}):n.replaceWithText(r),this}removeAlias(){let r=this.getAliasNode();return r==null?this:(Bs({children:[this.getFirstChildByKindOrThrow(b.SyntaxKind.AsKeyword),r],removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this)}removeAliasWithRename(){let r=this.getAliasNode();return r==null?this:(r.rename(this.getName()),this.removeAlias(),this)}getAliasNode(){if(this.compilerNode.propertyName!=null)return this._getNodeFromCompilerNode(this.compilerNode.name)}isTypeOnly(){return this.compilerNode.isTypeOnly}setIsTypeOnly(r){return this.isTypeOnly()===r?this:(r?qa({insertPos:this.getStart(),parent:this,newText:"type "}):Bs({children:[this.getFirstChildByKindOrThrow(b.ts.SyntaxKind.TypeKeyword)],removeFollowingSpaces:!0}),this)}getExportDeclaration(){return this.getFirstAncestorByKindOrThrow(b.SyntaxKind.ExportDeclaration)}getLocalTargetSymbolOrThrow(){return b.errors.throwIfNullOrUndefined(this.getLocalTargetSymbol(),"The export specifier's local target symbol was expected.")}getLocalTargetSymbol(){return this._context.typeChecker.getExportSpecifierLocalTargetSymbol(this)}getLocalTargetDeclarations(){var r,n;return(n=(r=this.getLocalTargetSymbol())===null||r===void 0?void 0:r.getDeclarations())!==null&&n!==void 0?n:[]}remove(){let r=this.getExportDeclaration();r.getNamedExports().length>1?mv(this):r.hasModuleSpecifier()?r.toNamespaceExport():r.remove()}set(r){return io(WH.prototype,this,r),r.name!=null&&this.setName(r.name),r.alias!=null?this.setAlias(r.alias):r.hasOwnProperty(b.nameof(r,"alias"))&&this.removeAlias(),this}getStructure(){let r=this.getAliasNode();return uo(Tr.prototype,this,{kind:Oe.StructureKind.ExportSpecifier,alias:r?r.getText():void 0,name:this.getNameNode().getText()})}},$me=CL(Tr),_w=class extends $me{getReferencedSourceFileOrThrow(){return b.errors.throwIfNullOrUndefined(this.getReferencedSourceFile(),"Expected to find the referenced source file.")}isRelative(){let r=this.getExpression();return r==null||!Tr.isStringLiteral(r)?!1:RE.isModuleSpecifierRelative(r.getLiteralText())}getReferencedSourceFile(){let r=this.getExpression();if(r==null)return;let n=r.getSymbol();if(n!=null)return RE.getReferencedSourceFileFromSymbol(n)}},Xme=Tr,gw=class extends Xme{isTypeOnly(){return this.compilerNode.isTypeOnly}setIsTypeOnly(r){if(this.isTypeOnly()===r)return this;if(r)qa({parent:this,insertPos:this.getStart(),newText:"type "});else{let n=this.getFirstChildByKindOrThrow(b.ts.SyntaxKind.TypeKeyword);Bs({children:[n],removeFollowingSpaces:!0})}return this}getDefaultImportOrThrow(){return b.errors.throwIfNullOrUndefined(this.getDefaultImport(),"Expected to find a default import.")}getDefaultImport(){return this.getNodeProperty("name")}getNamedBindingsOrThrow(){return b.errors.throwIfNullOrUndefined(this.getNamedBindings(),"Expected to find an import declaration's named bindings.")}getNamedBindings(){return this.getNodeProperty("namedBindings")}getNamespaceImportOrThrow(){return b.errors.throwIfNullOrUndefined(this.getNamespaceImport(),"Expected to find a namespace import.")}getNamespaceImport(){let r=this.getNamedBindings();if(!(r==null||!Tr.isNamespaceImport(r)))return r.getNameNode()}getNamedImports(){let r=this.getNamedBindings();return r==null||!Tr.isNamedImports(r)?[]:r.getElements()}},hR=Cl,yw=class extends hR{isTypeOnly(){var r,n;return(n=(r=this.getImportClause())===null||r===void 0?void 0:r.isTypeOnly())!==null&&n!==void 0?n:!1}setIsTypeOnly(r){let n=this.getImportClause();if(n==null){if(r)throw new b.errors.InvalidOperationError("Cannot set an import as type only when there is no import clause.");return this}return n.setIsTypeOnly(r),this}setModuleSpecifier(r){let n=typeof r=="string"?r:this._sourceFile.getRelativePathAsModuleSpecifierTo(r);return this.getModuleSpecifier().setLiteralValue(n),this}getModuleSpecifier(){let r=this._getNodeFromCompilerNode(this.compilerNode.moduleSpecifier);if(!Tr.isStringLiteral(r))throw new b.errors.InvalidOperationError("Expected the module specifier to be a string literal.");return r}getModuleSpecifierValue(){return this.getModuleSpecifier().getLiteralValue()}getModuleSpecifierSourceFileOrThrow(){return b.errors.throwIfNullOrUndefined(this.getModuleSpecifierSourceFile(),"A module specifier source file was expected.")}getModuleSpecifierSourceFile(){let r=this.getModuleSpecifier().getSymbol();if(r!=null)return RE.getReferencedSourceFileFromSymbol(r)}isModuleSpecifierRelative(){return RE.isModuleSpecifierRelative(this.getModuleSpecifierValue())}setDefaultImport(r){if(b.StringUtils.isNullOrWhitespace(r))return this.removeDefaultImport();let n=this.getDefaultImport();if(n!=null)return n.replaceWithText(r),this;let i=this.getFirstChildByKindOrThrow(b.SyntaxKind.ImportKeyword),a=this.getImportClause();return a==null?(qa({insertPos:i.getEnd(),parent:this,newText:` ${r} from`}),this):(qa({insertPos:i.getEnd(),parent:a,newText:` ${r},`}),this)}renameDefaultImport(r){if(b.StringUtils.isNullOrWhitespace(r))return this.removeDefaultImport();let n=this.getDefaultImport();return n!=null?(n.rename(r),this):(this.setDefaultImport(r),this)}getDefaultImportOrThrow(){return b.errors.throwIfNullOrUndefined(this.getDefaultImport(),"Expected to find a default import.")}getDefaultImport(){var r,n;return(n=(r=this.getImportClause())===null||r===void 0?void 0:r.getDefaultImport())!==null&&n!==void 0?n:void 0}setNamespaceImport(r){if(b.StringUtils.isNullOrWhitespace(r))return this.removeNamespaceImport();let n=this.getNamespaceImport();if(n!=null)return n.rename(r),this;if(this.getNamedImports().length>0)throw new b.errors.InvalidOperationError("Cannot add a namespace import to an import declaration that has named imports.");let i=this.getDefaultImport();return i!=null?(qa({insertPos:i.getEnd(),parent:this.getImportClause(),newText:`, * as ${r}`}),this):(qa({insertPos:this.getFirstChildByKindOrThrow(b.SyntaxKind.ImportKeyword).getEnd(),parent:this,newText:` * as ${r} from`}),this)}removeNamespaceImport(){let r=this.getNamespaceImport();if(r==null)return this;return Bs({children:n.call(this),removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this;function n(){let i=this.getDefaultImport();return i==null?[this.getImportClauseOrThrow(),this.getLastChildByKindOrThrow(b.SyntaxKind.FromKeyword)]:[i.getNextSiblingIfKindOrThrow(b.SyntaxKind.CommaToken),r]}}removeDefaultImport(){let r=this.getImportClause();if(r==null)return this;let n=r.getDefaultImport();if(n==null)return this;let i=r.getChildCount()===1;return Bs(i?{children:[r,r.getNextSiblingIfKindOrThrow(b.SyntaxKind.FromKeyword)],removePrecedingSpaces:!0,removePrecedingNewLines:!0}:{children:[n,n.getNextSiblingIfKindOrThrow(b.SyntaxKind.CommaToken)],removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this}getNamespaceImportOrThrow(){return b.errors.throwIfNullOrUndefined(this.getNamespaceImport(),"Expected to find a namespace import.")}getNamespaceImport(){var r,n;return(n=(r=this.getImportClause())===null||r===void 0?void 0:r.getNamespaceImport())!==null&&n!==void 0?n:void 0}addNamedImport(r){return this.addNamedImports([r])[0]}addNamedImports(r){return this.insertNamedImports(this.getNamedImports().length,r)}insertNamedImport(r,n){return this.insertNamedImports(r,[n])[0]}insertNamedImports(r,n){if(!(n instanceof Function)&&b.ArrayUtils.isNullOrEmpty(n))return[];let i=this.getNamedImports(),a=this._getWriterWithQueuedIndentation(),s=this._context.structurePrinterFactory.forNamedImportExportSpecifier(),u=this.getImportClause();if(r=ku(r,i.length),i.length===0)if(s.printTextsWithBraces(a,n),u==null)qa({insertPos:this.getFirstChildByKindOrThrow(b.SyntaxKind.ImportKeyword).getEnd(),parent:this,newText:` ${a.toString()} from`});else{if(this.getNamespaceImport()!=null)throw Yme();if(u.getNamedBindings()!=null){let f=u.getNamedBindingsOrThrow();qa({insertPos:f.getStart(),replacing:{textLength:f.getWidth()},parent:u,newText:a.toString()})}else qa({insertPos:this.getDefaultImport().getEnd(),parent:u,newText:`, ${a.toString()}`})}else{if(u==null)throw new b.errors.NotImplementedError("Expected to have an import clause.");s.printTexts(a,n),H_({parent:u.getFirstChildByKindOrThrow(b.SyntaxKind.NamedImports).getFirstChildByKindOrThrow(b.SyntaxKind.SyntaxList),currentNodes:i,insertIndex:r,newText:a.toString(),surroundWithSpaces:this._context.getFormatCodeSettings().insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces,useTrailingCommas:!1})}let p=this.getNamedImports();return af(i,p,r,!1)}getNamedImports(){var r,n;return(n=(r=this.getImportClause())===null||r===void 0?void 0:r.getNamedImports())!==null&&n!==void 0?n:[]}removeNamedImports(){let r=this.getImportClause();if(r==null)return this;let n=r.getNamedBindings();if(n==null||n.getKind()!==b.SyntaxKind.NamedImports)return this;let i=this.getDefaultImport();if(i!=null){let s=i.getNextSiblingIfKindOrThrow(b.SyntaxKind.CommaToken);return Bs({children:[s,n]}),this}let a=r.getNextSiblingIfKindOrThrow(b.SyntaxKind.FromKeyword);return Bs({children:[r,a],removePrecedingSpaces:!0}),this}getImportClauseOrThrow(){return b.errors.throwIfNullOrUndefined(this.getImportClause(),"Expected to find an import clause.")}getImportClause(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.importClause)}setAssertElements(r){let n=this.getAssertClause();if(n)r?n.setElements(r):n.remove();else if(r){let i=this._context.structurePrinterFactory.forAssertEntry(),a=this._context.createWriter();a.space(),i.printAssertClause(a,r),qa({parent:this,newText:a.toString(),insertPos:this.getSourceFile().getFullText()[this.getEnd()-1]===";"?this.getEnd()-1:this.getEnd()})}return this}getAssertClause(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertClause)}set(r){return io(hR.prototype,this,r),r.defaultImport!=null?this.setDefaultImport(r.defaultImport):r.hasOwnProperty(b.nameof(r,"defaultImport"))&&this.removeDefaultImport(),r.hasOwnProperty(b.nameof(r,"namedImports"))&&this.removeNamedImports(),r.namespaceImport!=null?this.setNamespaceImport(r.namespaceImport):r.hasOwnProperty(b.nameof(r,"namespaceImport"))&&this.removeNamespaceImport(),r.namedImports!=null&&(EUe(this),this.addNamedImports(r.namedImports)),r.moduleSpecifier!=null&&this.setModuleSpecifier(r.moduleSpecifier),r.isTypeOnly!=null&&this.setIsTypeOnly(r.isTypeOnly),r.hasOwnProperty(b.nameof(r,"assertElements"))&&this.setAssertElements(r.assertElements),this}getStructure(){let r=this.getNamespaceImport(),n=this.getDefaultImport(),i=this.getAssertClause();return uo(hR.prototype,this,{kind:Oe.StructureKind.ImportDeclaration,isTypeOnly:this.isTypeOnly(),defaultImport:n?n.getText():void 0,moduleSpecifier:this.getModuleSpecifier().getLiteralText(),namedImports:this.getNamedImports().map(a=>a.getStructure()),namespaceImport:r?r.getText():void 0,assertElements:i?i.getElements().map(a=>a.getStructure()):void 0})}};function EUe(e){let r=e.getNodeProperty("importClause"),n=e._getWriterWithQueuedChildIndentation();e._context.structurePrinterFactory.forNamedImportExportSpecifier().printTextsWithBraces(n,[]);let a=n.toString();if(e.getNamespaceImport()!=null)throw Yme();if(r==null){qa({insertPos:e.getFirstChildByKindOrThrow(b.SyntaxKind.ImportKeyword).getEnd(),parent:e,newText:` ${a} from`});return}let s=r.getNamedBindings();if(s!=null){qa({parent:r,newText:a,insertPos:s.getStart(),replacing:{textLength:s.getWidth()}});return}let u=r.getDefaultImport();if(u!=null){qa({insertPos:u.getEnd(),parent:r,newText:`, ${a}`});return}}function Yme(){return new b.errors.InvalidOperationError("Cannot add a named import to an import declaration that has a namespace import.")}var bUe=e=>sc(gv(e)),Qme=bUe(Cl),vw=class extends Qme{isTypeOnly(){var r;return(r=this.compilerNode.isTypeOnly)!==null&&r!==void 0?r:!1}setIsTypeOnly(r){if(this.isTypeOnly()===r)return this;if(r)qa({parent:this,insertPos:this.getNameNode().getStart(),newText:"type "});else{let n=this.getFirstChildByKindOrThrow(b.ts.SyntaxKind.TypeKeyword);Bs({children:[n],removeFollowingSpaces:!0})}return this}getModuleReference(){return this._getNodeFromCompilerNode(this.compilerNode.moduleReference)}isExternalModuleReferenceRelative(){let r=this.getModuleReference();return Tr.isExternalModuleReference(r)?r.isRelative():!1}setExternalModuleReference(r){let n=typeof r=="string"?r:this._sourceFile.getRelativePathAsModuleSpecifierTo(r),i=this.getModuleReference();return Tr.isExternalModuleReference(i)&&i.getExpression()!=null?i.getExpressionOrThrow().replaceWithText(a=>a.quote(n)):i.replaceWithText(a=>a.write("require(").quote(n).write(")")),this}getExternalModuleReferenceSourceFileOrThrow(){return b.errors.throwIfNullOrUndefined(this.getExternalModuleReferenceSourceFile(),"Expected to find an external module reference's referenced source file.")}getExternalModuleReferenceSourceFile(){let r=this.getModuleReference();if(!!Tr.isExternalModuleReference(r))return r.getReferencedSourceFile()}},ER=Tr,hw=class extends ER{setName(r){let n=this.getNameNode();return n.getText()===r?this:(n.replaceWithText(r),this)}getName(){return this.getNameNode().getText()}getNameNode(){var r;return this._getNodeFromCompilerNode((r=this.compilerNode.propertyName)!==null&&r!==void 0?r:this.compilerNode.name)}renameAlias(r){if(b.StringUtils.isNullOrWhitespace(r))return this.removeAliasWithRename(),this;let n=this.getAliasNode();return n==null&&(this.setAlias(this.getName()),n=this.getAliasNode()),n.rename(r),this}setAlias(r){if(b.StringUtils.isNullOrWhitespace(r))return this.removeAlias(),this;let n=this.getAliasNode();return n==null?qa({insertPos:this.getNameNode().getEnd(),parent:this,newText:` as ${r}`}):n.replaceWithText(r),this}removeAlias(){let r=this.getAliasNode();return r==null?this:(Bs({children:[this.getFirstChildByKindOrThrow(b.SyntaxKind.AsKeyword),r],removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this)}removeAliasWithRename(){let r=this.getAliasNode();return r==null?this:(r.rename(this.getName()),this.removeAlias(),this)}getAliasNode(){if(this.compilerNode.propertyName!=null)return this._getNodeFromCompilerNode(this.compilerNode.name)}isTypeOnly(){return this.compilerNode.isTypeOnly}setIsTypeOnly(r){return this.isTypeOnly()===r?this:(r?qa({insertPos:this.getStart(),parent:this,newText:"type "}):Bs({children:[this.getFirstChildByKindOrThrow(b.ts.SyntaxKind.TypeKeyword)],removeFollowingSpaces:!0}),this)}getImportDeclaration(){return this.getFirstAncestorByKindOrThrow(b.SyntaxKind.ImportDeclaration)}remove(){let r=this.getImportDeclaration();r.getNamedImports().length>1?mv(this):r.removeNamedImports()}set(r){return io(ER.prototype,this,r),r.name!=null&&this.setName(r.name),r.alias!=null?this.setAlias(r.alias):r.hasOwnProperty(b.nameof(r,"alias"))&&this.removeAlias(),this}getStructure(){let r=this.getAliasNode();return uo(ER.prototype,this,{kind:Oe.StructureKind.ImportSpecifier,name:this.getName(),alias:r?r.getText():void 0})}},Zme=Rh(Cl),Ew=class extends Zme{};function vS(e){return class extends e{getParentModuleOrThrow(){return b.errors.throwIfNullOrUndefined(this.getParentModule(),"Expected to find the parent module declaration.")}getParentModule(){let r=this.getParentOrThrow();if(!!Tr.isModuleBlock(r)){for(;r.getParentOrThrow().getKind()===b.SyntaxKind.ModuleDeclaration;)r=r.getParentOrThrow();return r}}}}Oe.ModuleDeclarationKind=void 0;(function(e){e.Namespace="namespace",e.Module="module",e.Global="global"})(Oe.ModuleDeclarationKind||(Oe.ModuleDeclarationKind={}));var SUe=e=>lq(uG(ld(qT(vS(Rh(sc(Ih(BE(sf(qpe(e))))))))))),bR=SUe(Cl),bw=class extends bR{getName(){let r=this.getNameNodes();return r instanceof Array?r.map(n=>n.getText()).join("."):r.getText()}setName(r){let n="Please open an issue if you really need this and I'll up the priority.";if(r.indexOf(".")>=0)throw new b.errors.NotImplementedError(`Not implemented to set a namespace name to a name containing a period. ${n}`);let i=this.getNameNodes();if(i instanceof Array){if(i.length>1)throw new b.errors.NotImplementedError(`Not implemented to set a namespace name that uses dot notation. ${n}`);r!=="global"&&pj(this),b.StringUtils.isQuoted(r)&&TUe(this),i[0].replaceWithText(r)}else i.replaceWithText(r);return this}rename(r,n){if(r.indexOf(".")>=0)throw new b.errors.NotSupportedError("Cannot rename a namespace name to a name containing a period.");let i=this.getNameNodes();if(i instanceof Array){if(i.length>1)throw new b.errors.NotSupportedError(`Cannot rename a namespace name that uses dot notation. Rename the individual nodes via .${b.nameof(this,"getNameNodes")}()`);r!=="global"&&pj(this),i[0].rename(r,n)}else Gpe(i,b.StringUtils.stripQuotes(r),n);return this}getNameNodes(){let r=this.getNameNode();if(Tr.isStringLiteral(r))return r;{let n=[],i=this;do n.push(this._getNodeFromCompilerNode(i.compilerNode.name)),i=i.getFirstChildByKind(b.SyntaxKind.ModuleDeclaration);while(i!=null);return n}}hasNamespaceKeyword(){return this.getDeclarationKind()===Oe.ModuleDeclarationKind.Namespace}hasModuleKeyword(){return this.getDeclarationKind()===Oe.ModuleDeclarationKind.Module}setDeclarationKind(r){if(this.getDeclarationKind()===r)return this;if(r===Oe.ModuleDeclarationKind.Global){let n=this.getDeclarationKindKeyword();this.getNameNode().replaceWithText("global"),n!=null&&Bs({children:[n],removeFollowingNewLines:!0,removeFollowingSpaces:!0})}else{let n=this.getDeclarationKindKeyword();n!=null?n.replaceWithText(r):qa({parent:this,insertPos:this.getNameNode().getStart(),newText:r+" "})}return this}getDeclarationKind(){let r=this.getFlags();return(r&b.ts.NodeFlags.GlobalAugmentation)!==0?Oe.ModuleDeclarationKind.Global:(r&b.ts.NodeFlags.Namespace)!==0?Oe.ModuleDeclarationKind.Namespace:Oe.ModuleDeclarationKind.Module}getDeclarationKindKeyword(){return this.getFirstChild(r=>r.getKind()===b.SyntaxKind.NamespaceKeyword||r.getKind()===b.SyntaxKind.ModuleKeyword)}set(r){return r.name!=null&&r.name!=="global"&&pj(this),io(bR.prototype,this,r),r.declarationKind!=null&&this.setDeclarationKind(r.declarationKind),this}getStructure(){return uo(bR.prototype,this,{kind:Oe.StructureKind.Module,declarationKind:this.getDeclarationKind()})}_getInnerBody(){let r=this.getBody();for(;r!=null&&Tr.isBodyable(r)&&r.compilerNode.statements==null;)r=r.getBody();return r}};function pj(e){e.getDeclarationKind()===Oe.ModuleDeclarationKind.Global&&e.setDeclarationKind(Oe.ModuleDeclarationKind.Namespace)}function TUe(e){e.hasNamespaceKeyword()&&e.setDeclarationKind(Oe.ModuleDeclarationKind.Module),e.hasDeclareKeyword()||e.setHasDeclareKeyword(!0)}var e_e=Tr,Sw=class extends e_e{getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}},r_e=Tr,Tw=class extends r_e{getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}},t_e=_v(Tr),xw=class extends t_e{setName(r){let n=this.getNameNode();return n.getText()===r?this:(n.replaceWithText(r),this)}getName(){return this.getNameNode().getText()}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}},n_e=_v(Tr),Dw=class extends n_e{setName(r){let n=this.getNameNode();return n.getText()===r?this:(n.replaceWithText(r),this)}getName(){return this.getNameNode().getText()}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}},GD=class extends iL{constructor(r,n){super(r,n)}getFileName(){return this.compilerObject.fileName}};Oe.FileSystemRefreshResult=void 0;(function(e){e[e.NoChange=0]="NoChange",e[e.Updated=1]="Updated",e[e.Deleted=2]="Deleted"})(Oe.FileSystemRefreshResult||(Oe.FileSystemRefreshResult={}));function co(e,r,n,i){var a=arguments.length,s=a<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,r,n,i);else for(var p=e.length-1;p>=0;p--)(u=e[p])&&(s=(a<3?u(s):a>3?u(r,n,s):u(r,n))||s);return a>3&&s&&Object.defineProperty(r,n,s),s}var SR=lq(ld(Rh(Tr))),kE=class extends SR{constructor(r,n){super(r,n,void 0),this._isSaved=!1,this._modifiedEventContainer=new b.EventContainer,this._preModifiedEventContainer=new b.EventContainer,this._referenceContainer=new Ej(this),this.__sourceFile=this;let i=()=>{this.isFromExternalLibrary(),this._preModifiedEventContainer.unsubscribe(i)};this._preModifiedEventContainer.subscribe(i)}_replaceCompilerNodeFromFactory(r){super._replaceCompilerNodeFromFactory(r),this._context.resetProgram(),this._isSaved=!1,this._modifiedEventContainer.fire(this)}_clearInternals(){super._clearInternals(),r(this._referencedFiles),r(this._typeReferenceDirectives),r(this._libReferenceDirectives),delete this._referencedFiles,delete this._typeReferenceDirectives,delete this._libReferenceDirectives;function r(n){n?.forEach(i=>i._forget())}}getFilePath(){return this.compilerNode.fileName}getBaseName(){return b.FileUtils.getBaseName(this.getFilePath())}getBaseNameWithoutExtension(){let r=this.getBaseName(),n=this.getExtension();return r.substring(0,r.length-n.length)}getExtension(){return b.FileUtils.getExtension(this.getFilePath())}getDirectory(){return this._context.compilerFactory.getDirectoryFromCache(this.getDirectoryPath())}getDirectoryPath(){return this._context.fileSystemWrapper.getStandardizedAbsolutePath(b.FileUtils.getDirPath(this.compilerNode.fileName))}getFullText(){return this.compilerNode.text}getLineAndColumnAtPos(r){let n=this.getFullText();return{line:b.StringUtils.getLineNumberAtPos(n,r),column:b.StringUtils.getLengthFromLineStartAtPos(n,r)+1}}getLengthFromLineStartAtPos(r){return b.StringUtils.getLengthFromLineStartAtPos(this.getFullText(),r)}copyToDirectory(r,n){let i=typeof r=="string"?r:r.getPath();return this.copy(b.FileUtils.pathJoin(i,this.getBaseName()),n)}copy(r,n={}){this._throwIfIsInMemoryLibFile();let i=this._copyInternal(r,n);if(i===!1)return this;let a=i;return a.getDirectoryPath()!==this.getDirectoryPath()&&a._updateReferencesForCopyInternal(this._getReferencesForCopyInternal()),a}_copyInternal(r,n={}){let{overwrite:i=!1}=n,{compilerFactory:a,fileSystemWrapper:s}=this._context,u=s.getStandardizedAbsolutePath(r,this.getDirectoryPath());if(u===this.getFilePath())return!1;return p(this);function p(f){try{return a.createSourceFileFromText(u,f.getFullText(),{overwrite:i,markInProject:m()})}catch(g){throw g instanceof b.errors.InvalidOperationError?new b.errors.InvalidOperationError("Did you mean to provide the overwrite option? "+g.message):g}function m(){if(f._isInProject())return!0;let g=a.getSourceFileFromCacheFromFilePath(u);return g!=null&&g._isInProject()}}}_getReferencesForCopyInternal(){return Array.from(this._referenceContainer.getLiteralsReferencingOtherSourceFilesEntries())}_updateReferencesForCopyInternal(r){for(let n of r)n[0]=this.getChildSyntaxListOrThrow().getDescendantAtStartWithWidth(n[0].getStart(),n[0].getWidth());mj(r)}async copyImmediately(r,n){let i=this.copy(r,n);return await i.save(),i}copyImmediatelySync(r,n){let i=this.copy(r,n);return i.saveSync(),i}moveToDirectory(r,n){let i=typeof r=="string"?r:r.getPath();return this.move(b.FileUtils.pathJoin(i,this.getBaseName()),n)}move(r,n={}){this._throwIfIsInMemoryLibFile();let i=this.getDirectoryPath(),a=this._getReferencesForMoveInternal(),s=this.getFilePath();return this._moveInternal(r,n)?(this._context.fileSystemWrapper.queueFileDelete(s),this._updateReferencesForMoveInternal(a,i),this._context.lazyReferenceCoordinator.clearDirtySourceFiles(),this._context.lazyReferenceCoordinator.addDirtySourceFile(this),this):this}_moveInternal(r,n={}){let{overwrite:i=!1}=n,a=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getDirectoryPath());if(a===this.getFilePath())return!1;let s=!1;if(i){let u=this._context.compilerFactory.getSourceFileFromCacheFromFilePath(a);u!=null&&(s=u._isInProject(),u.forget())}else this._context.compilerFactory.throwIfFileExists(a,"Did you mean to provide the overwrite option?");return Mpe({newFilePath:a,sourceFile:this}),s&&this._markAsInProject(),this._isInProject()&&this.getDirectory()._markAsInProject(),!0}_getReferencesForMoveInternal(){return{literalReferences:Array.from(this._referenceContainer.getLiteralsReferencingOtherSourceFilesEntries()),referencingLiterals:Array.from(this._referenceContainer.getReferencingLiteralsInOtherSourceFiles())}}_updateReferencesForMoveInternal(r,n){let{literalReferences:i,referencingLiterals:a}=r;n!==this.getDirectoryPath()&&mj(i),mj(a.map(s=>[s,this]))}async moveImmediately(r,n){let i=this.getFilePath(),a=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getDirectoryPath());return this.move(r,n),i!==a?(await this._context.fileSystemWrapper.moveFileImmediately(i,a,this.getFullText()),this._isSaved=!0):await this.save(),this}moveImmediatelySync(r,n){let i=this.getFilePath(),a=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getDirectoryPath());return this.move(r,n),i!==a?(this._context.fileSystemWrapper.moveFileImmediatelySync(i,a,this.getFullText()),this._isSaved=!0):this.saveSync(),this}delete(){this._throwIfIsInMemoryLibFile();let r=this.getFilePath();this.forget(),this._context.fileSystemWrapper.queueFileDelete(r)}async deleteImmediately(){this._throwIfIsInMemoryLibFile();let r=this.getFilePath();this.forget(),await this._context.fileSystemWrapper.deleteFileImmediately(r)}deleteImmediatelySync(){this._throwIfIsInMemoryLibFile();let r=this.getFilePath();this.forget(),this._context.fileSystemWrapper.deleteFileImmediatelySync(r)}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 r=this.getFullText();return this._hasBom?"\uFEFF"+r:r}getPathReferenceDirectives(){return this._referencedFiles==null&&(this._referencedFiles=(this.compilerNode.referencedFiles||[]).map(r=>new GD(r,this))),this._referencedFiles}getTypeReferenceDirectives(){return this._typeReferenceDirectives==null&&(this._typeReferenceDirectives=(this.compilerNode.typeReferenceDirectives||[]).map(r=>new GD(r,this))),this._typeReferenceDirectives}getLibReferenceDirectives(){return this._libReferenceDirectives==null&&(this._libReferenceDirectives=(this.compilerNode.libReferenceDirectives||[]).map(r=>new GD(r,this))),this._libReferenceDirectives}getReferencingSourceFiles(){return Array.from(this._referenceContainer.getDependentSourceFiles())}getReferencingNodesInOtherSourceFiles(){let r=this.getReferencingLiteralsInOtherSourceFiles();return Array.from(n());function*n(){for(let i of r)yield Zfe(i)}}getReferencingLiteralsInOtherSourceFiles(){return Array.from(this._referenceContainer.getReferencingLiteralsInOtherSourceFiles())}getReferencedSourceFiles(){let r=this._referenceContainer.getLiteralsReferencingOtherSourceFilesEntries();return Array.from(new Set(n()).values());function*n(){for(let[,i]of r)yield i}}getNodesReferencingOtherSourceFiles(){let r=this._referenceContainer.getLiteralsReferencingOtherSourceFilesEntries();return Array.from(n());function*n(){for(let[i]of r)yield Zfe(i)}}getLiteralsReferencingOtherSourceFiles(){let r=this._referenceContainer.getLiteralsReferencingOtherSourceFilesEntries();return Array.from(n());function*n(){for(let[i]of r)yield i}}getImportStringLiterals(){return this._ensureBound(),(this.compilerNode.imports||[]).filter(n=>n.pos!==-1).map(n=>this._getNodeFromCompilerNode(n))}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(r){this._isSaved=r}getPreEmitDiagnostics(){return this._context.getPreEmitDiagnostics(this)}unindent(r,n=1){return this.indent(r,n*-1)}indent(r,n=1){if(n===0)return this;let i=this.getFullText(),a=typeof r=="number"?[r,r]:r;b.errors.throwIfRangeOutOfRange(a,[0,i.length],"positionRange");let s=dv(i,a[0],f=>f===ac.NEWLINE),u=Z6(i,a[1],f=>f===ac.CARRIAGE_RETURN||f===ac.NEWLINE),p=b.StringUtils.indent(i.substring(s,u),n,{indentText:this._context.manipulationSettings.getIndentationText(),indentSizeInSpaces:this._context.manipulationSettings._getIndentSizeInSpaces(),isInStringAtPos:f=>this.isInStringAtPos(f+s)});return Fj({sourceFile:this,newText:i.substring(0,s)+p+i.substring(u)}),this}emit(r){return this._context.program.emit({targetSourceFile:this,...r})}emitSync(r){return this._context.program.emitSync({targetSourceFile:this,...r})}getEmitOutput(r={}){return this._context.languageService.getEmitOutput(this,r.emitOnlyDtsFiles||!1)}formatText(r={}){Fj({sourceFile:this,newText:this._context.languageService.getFormattedDocumentText(this.getFilePath(),r)})}async refreshFromFileSystem(){let r=await this._context.fileSystemWrapper.readFileOrNotExists(this.getFilePath(),this._context.getEncoding());return this._refreshFromFileSystemInternal(r)}refreshFromFileSystemSync(){let r=this._context.fileSystemWrapper.readFileOrNotExistsSync(this.getFilePath(),this._context.getEncoding());return this._refreshFromFileSystemInternal(r)}getRelativePathTo(r){return this.getDirectory().getRelativePathTo(r)}getRelativePathAsModuleSpecifierTo(r){return this.getDirectory().getRelativePathAsModuleSpecifierTo(r)}onModified(r,n=!0){return n?this._modifiedEventContainer.subscribe(r):this._modifiedEventContainer.unsubscribe(r),this}_doActionPreNextModification(r){let n=()=>{r(),this._preModifiedEventContainer.unsubscribe(n)};return this._preModifiedEventContainer.subscribe(n),this}_firePreModified(){this._preModifiedEventContainer.fire(this)}organizeImports(r={},n={}){return this._context.languageService.organizeImports(this,r,n).forEach(i=>i.applyChanges()),this}fixUnusedIdentifiers(r={},n={}){return this._context.languageService.getCombinedCodeFix(this,"unusedIdentifier_delete",r,n).applyChanges(),this._context.languageService.getCombinedCodeFix(this,"unusedIdentifier_deleteImports",r,n).applyChanges(),this}fixMissingImports(r={},n={}){let i=this._context.languageService.getCombinedCodeFix(this,"fixMissingImport",r,n),a=this;for(let p of i.getChanges()){let f=p.getTextChanges();s(f),u(f)}return this;function s(p){p.sort((f,m)=>f.getSpan().getStart()-m.getSpan().getStart());for(let f=0;f<p.length-1;f++){let{compilerObject:m}=p[f];m.newText=m.newText.replace(/(\r?)\n\r?\n$/,`$1
4250
4250
  `)}}function u(p){let f=b.ArrayUtils.groupBy(p,g=>g.getSpan().getStart()),m=0;for(let g of f){let D=g[0].getSpan().getStart()+m,P=g.map(B=>B.getNewText()).join("");i9e({sourceFile:a,insertPos:D,newText:P}),m+=P.length}}}applyTextChanges(r){return r.length===0?this:(this.forgetDescendants(),_S({sourceFile:this._sourceFile,start:0,replacingLength:this.getFullWidth(),newText:ZH(this,r)}),this)}set(r){return io(SR.prototype,this,r),this}getStructure(){return uo(SR.prototype,this,{kind:Oe.StructureKind.SourceFile})}_refreshFromFileSystemInternal(r){if(r===!1)return this.forget(),Oe.FileSystemRefreshResult.Deleted;let n=r;return n===this.getFullText()?Oe.FileSystemRefreshResult.NoChange:(this.replaceText([0,this.getEnd()],n),this._setIsSaved(!0),Oe.FileSystemRefreshResult.Updated)}_isLibFileInMemory(){return this.compilerNode.fileName.startsWith(b.libFolderInMemoryPath)}_throwIfIsInMemoryLibFile(){if(this._isLibFileInMemory())throw new b.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)}};co([b.Memoize],kE.prototype,"isFromExternalLibrary",null);function mj(e){for(let[r,n]of e)RE.isModuleSpecifierRelative(r.getLiteralText())&&r.setLiteralValue(r._sourceFile.getRelativePathAsModuleSpecifierTo(n))}function Zfe(e){let r=e.getParentOrThrow(),n=r.getParent();return n!=null&&Tr.isImportEqualsDeclaration(n)?n:r}var xUe=e=>vS(sc(Ih(BE(sf(e))))),TR=xUe(Cl),Cw=class extends TR{getDeclarationList(){return this._getNodeFromCompilerNode(this.compilerNode.declarationList)}getDeclarations(){return this.getDeclarationList().getDeclarations()}getDeclarationKind(){return this.getDeclarationList().getDeclarationKind()}getDeclarationKindKeyword(){return this.getDeclarationList().getDeclarationKindKeyword()}setDeclarationKind(r){return this.getDeclarationList().setDeclarationKind(r)}addDeclaration(r){return this.getDeclarationList().addDeclaration(r)}addDeclarations(r){return this.getDeclarationList().addDeclarations(r)}insertDeclaration(r,n){return this.getDeclarationList().insertDeclaration(r,n)}insertDeclarations(r,n){return this.getDeclarationList().insertDeclarations(r,n)}set(r){if(io(TR.prototype,this,r),r.declarationKind!=null&&this.setDeclarationKind(r.declarationKind),r.declarations!=null){let n=this.getDeclarations();this.addDeclarations(r.declarations),n.forEach(i=>i.remove())}return this}getStructure(){return uo(TR.prototype,this,{kind:Oe.StructureKind.VariableStatement,declarationKind:this.getDeclarationKind(),declarations:this.getDeclarations().map(r=>r.getStructure())})}},i_e=ud(fS),Aw=class extends i_e{},a_e=ud(Cl),Lw=class extends a_e{getStatement(){return this._getNodeFromCompilerNode(this.compilerNode.statement)}};function QT(e){return sc(z_(yv(Rh(sf(e)))))}var DUe=e=>ld(rG(HT(QT(e)))),o_e=DUe(oc),Nw=class extends o_e{getEqualsGreaterThan(){return this._getNodeFromCompilerNode(this.compilerNode.equalsGreaterThanToken)}};function cG(e){return class extends e{getOverloads(){return epe(this).filter(r=>r.isOverload())}getImplementation(){return this.isImplementation()?this:epe(this).find(r=>r.isImplementation())}getImplementationOrThrow(){return b.errors.throwIfNullOrUndefined(this.getImplementation(),"Expected to find a corresponding implementation for the overload.")}isOverload(){return!this.isImplementation()}isImplementation(){return this.getBody()!=null}}}function epe(e){let r=e.getParentOrThrow(),n=rpe(e),i=e.getKind();return r.forEachChildAsArray().filter(a=>{let s=rpe(a)===n,u=a.getKind()===i;return s&&u})}function rpe(e){let r=e;if(r.getName instanceof Function)return r.getName()}function dG(e){if(e.structures.length===0)return[];let r=e.node.getParentSyntaxListOrThrow(),n=e.node.getImplementation()||e.node,i=e.node.getOverloads(),a=i.length,s=i.length>0?i[0].getChildIndex():n.getChildIndex(),u=ku(e.index,a),p=s+u,f=e.getThisStructure(n),m=e.structures.map(D=>Object.assign(Object.assign({},f),D)),g=n._getWriterWithQueuedIndentation();for(let D of m)g.getLength()>0&&g.newLine(),e.printStructure(g,D);return g.newLine(),g.write(""),qa({parent:r,insertPos:(i[u]||n).getNonWhitespaceStart(),newText:g.toString()}),Lpe(r.getChildren(),p,m.length,e.expectedSyntaxKind)}var CUe=e=>uG(ld(cG(qT(HT($T(Ih(BE(QT(vS(oG(e))))))))))),xR=CUe(Cl),AUe=e=>uG(ld(HT($T(yv(Ih(vS(sc(z_(BE(sf(e))))))))))),s_e=AUe(Cl),Iw=class extends xR{addOverload(r){return this.addOverloads([r])[0]}addOverloads(r){return this.insertOverloads(this.getOverloads().length,r)}insertOverload(r,n){return this.insertOverloads(r,[n])[0]}insertOverloads(r,n){let i=this.getName(),a=this._context.structurePrinterFactory.forFunctionDeclaration({isAmbient:this.isAmbient()});return dG({node:this,index:r,structures:n,printStructure:(s,u)=>{a.printOverload(s,i,u)},getThisStructure:X7e,expectedSyntaxKind:b.SyntaxKind.FunctionDeclaration})}remove(){c9e(this)}set(r){return io(xR.prototype,this,r),r.overloads!=null&&(this.getOverloads().forEach(n=>n.remove()),this.addOverloads(r.overloads)),this}getStructure(){let r=this.isOverload(),n=this.getImplementation(),i=r&&n?s_e.prototype:xR.prototype;return uo(i,this,a(this));function a(s){if(n&&r)return u();return p();function u(){return{kind:Oe.StructureKind.FunctionOverload}}function p(){return n?{kind:Oe.StructureKind.Function,overloads:s.getOverloads().map(f=>f.getStructure())}:{kind:Oe.StructureKind.Function}}}}},LUe=e=>sc(ld(rG(HT($T(Rh(z_(yv(sf(oG(e)))))))))),l_e=LUe(sd),Pw=class extends l_e{},NUe=e=>xL(kh(JT(zpe(DL(sf(SL(KE(XT(aG(e)))))))))),DR=NUe(Tr),Ow=class extends DR{isRestParameter(){return this.compilerNode.dotDotDotToken!=null}isParameterProperty(){return this.getScope()!=null||this.isReadonly()||this.hasOverrideKeyword()}setIsRestParameter(r){return this.isRestParameter()===r?this:(r?(pR(this),qa({insertPos:this.getNameNode().getStart(),parent:this,newText:"..."})):Bs({children:[this.getDotDotDotTokenOrThrow()]}),this)}isOptional(){return this.compilerNode.questionToken!=null||this.isRestParameter()||this.hasInitializer()}remove(){mv(this)}set(r){return io(DR.prototype,this,r),r.isRestParameter!=null&&this.setIsRestParameter(r.isRestParameter),this}getStructure(){return uo(DR.prototype,this,{kind:Oe.StructureKind.Parameter,isRestParameter:this.isRestParameter()})}setHasQuestionToken(r){return r&&pR(this),super.setHasQuestionToken(r),this}setInitializer(r){return pR(this),super.setInitializer(r),this}setType(r){return pR(this),super.setType.call(this,r),this}};function pR(e){let r=e.getParentOrThrow();n()&&i();function n(){return Tr.isArrowFunction(r)&&r.compilerNode.parameters.length===1&&e.getParentSyntaxListOrThrow().getPreviousSiblingIfKind(b.SyntaxKind.OpenParenToken)==null}function i(){let a=e.getText();qa({parent:r,insertPos:e.getStart(),newText:`(${a})`,replacing:{textLength:a.length},customMappings:s=>[{currentNode:e,newNode:s.parameters[0]}]})}}var Xg=class extends Tr{remove(){let r=this.getParentOrThrow();Tr.isClassDeclaration(r)||Tr.isClassExpression(r)?s9e(this):Tr.isObjectLiteralExpression(r)?mv(this):b.errors.throwNotImplementedForSyntaxKindError(r.getKind())}},IUe=e=>Im(ld(xL(cG(qT(JT(yS(gS(kh(zD(HT($T(QT(UE(e)))))))))))))),CR=IUe(Xg),PUe=e=>sc(Im(ld(xL(gS(z_(yS(kh(zD(HT(sf($T(yv(e))))))))))))),u_e=PUe(Xg),KD=class extends CR{set(r){return io(CR.prototype,this,r),r.overloads!=null&&(this.getOverloads().forEach(n=>n.remove()),this.addOverloads(r.overloads)),this}addOverload(r){return this.addOverloads([r])[0]}addOverloads(r){return this.insertOverloads(this.getOverloads().length,r)}insertOverload(r,n){return this.insertOverloads(r,[n])[0]}insertOverloads(r,n){let i=this.getName(),a=this._context.structurePrinterFactory.forMethodDeclaration({isAmbient:f_(this)});return dG({node:this,index:r,structures:n,printStructure:(s,u)=>{a.printOverload(s,i,u)},getThisStructure:Y7e,expectedSyntaxKind:b.SyntaxKind.MethodDeclaration})}getStructure(){let r=this.getImplementation()!=null,n=this.isOverload(),i=n&&r?u_e.prototype:CR.prototype;return uo(i,this,a(this));function a(s){if(r&&n)return u();return p();function u(){return{kind:Oe.StructureKind.MethodOverload}}function p(){return r?{kind:Oe.StructureKind.Method,overloads:s.getOverloads().map(f=>f.getStructure())}:{kind:Oe.StructureKind.Method}}}}};function pq(e){return c_e(oG(ld(jpe(sq(yS(sc(z_(JT(sf(e))))))))))}function c_e(e){return class extends e{setExtends(r){if(r=this._getTextWithQueuedChildIndentation(r),b.StringUtils.isNullOrWhitespace(r))return this.removeExtends();let n=this.getHeritageClauseByKind(b.SyntaxKind.ExtendsKeyword);if(n!=null){let i=n.getFirstChildByKindOrThrow(b.SyntaxKind.SyntaxList),a=i.getStart();qa({parent:n,newText:r,insertPos:a,replacing:{textLength:i.getEnd()-a}})}else{let i=this.getHeritageClauseByKind(b.SyntaxKind.ImplementsKeyword),a;i!=null?a=i.getStart():a=this.getFirstChildByKindOrThrow(b.SyntaxKind.OpenBraceToken).getStart();let s=/\s/.test(this.getSourceFile().getFullText()[a-1]),u=`extends ${r} `;s||(u=" "+u),qa({parent:i==null?this:i.getParentSyntaxListOrThrow(),insertPos:a,newText:u})}return this}removeExtends(){let r=this.getHeritageClauseByKind(b.SyntaxKind.ExtendsKeyword);return r==null?this:(r.removeExpression(0),this)}getExtendsOrThrow(){return b.errors.throwIfNullOrUndefined(this.getExtends(),`Expected to find the extends expression for the class ${this.getName()}.`)}getExtends(){let r=this.getHeritageClauseByKind(b.SyntaxKind.ExtendsKeyword);if(r==null)return;let n=r.getTypeNodes();return n.length===0?void 0:n[0]}addMembers(r){return this.insertMembers(ad(this.getMembersWithComments()),r)}addMember(r){return this.insertMember(ad(this.getMembersWithComments()),r)}insertMember(r,n){return this.insertMembers(r,[n])[0]}insertMembers(r,n){let i=f_(this);return Ppe({getIndexedChildren:()=>this.getMembersWithComments(),index:r,parent:this,write:(s,u)=>{let p=!i&&u.previousMember!=null&&Tr.isBodyable(u.previousMember)&&u.previousMember.hasBody(),f=!i&&n instanceof Array&&a(n[0]);p||u.previousMember!=null&&f?s.blankLineIfLastNot():s.newLineIfLastNot();let m=this._getWriter();this._context.structurePrinterFactory.forClassMember({isAmbient:i}).printTexts(m,n),s.write(m.toString());let D=!i&&n instanceof Array&&a(n[n.length-1]),P=!i&&u.nextMember!=null&&Tr.isBodyable(u.nextMember)&&u.nextMember.hasBody();u.nextMember!=null&&D||P?s.blankLineIfLastNot():s.newLineIfLastNot()}});function a(s){if(i||s==null||typeof s.kind!="number")return!1;let u=s;return tL.isMethod(u)||tL.isGetAccessor(u)||tL.isSetAccessor(u)||tL.isConstructor(u)}}addConstructor(r={}){return this.insertConstructor(ad(this.getMembersWithComments()),r)}addConstructors(r){return this.insertConstructors(ad(this.getMembersWithComments()),r)}insertConstructor(r,n={}){return this.insertConstructors(r,[n])[0]}insertConstructors(r,n){let i=f_(this);return MD(this,{index:r,structures:n,expectedKind:b.SyntaxKind.Constructor,write:(a,s)=>{!i&&s.previousMember!=null&&!Tr.isCommentNode(s.previousMember)?a.blankLineIfLastNot():a.newLineIfLastNot(),this._context.structurePrinterFactory.forConstructorDeclaration({isAmbient:i}).printTexts(a,n),!i&&s.nextMember!=null?a.blankLineIfLastNot():a.newLineIfLastNot()}})}getConstructors(){return this.getMembers().filter(r=>Tr.isConstructorDeclaration(r))}addStaticBlock(r={}){return this.insertStaticBlock(ad(this.getMembersWithComments()),r)}addStaticBlocks(r){return this.insertStaticBlocks(ad(this.getMembersWithComments()),r)}insertStaticBlock(r,n={}){return this.insertStaticBlocks(r,[n])[0]}insertStaticBlocks(r,n){let i=f_(this);return MD(this,{index:r,structures:n,expectedKind:b.SyntaxKind.ClassStaticBlockDeclaration,write:(a,s)=>{!i&&s.previousMember!=null&&!Tr.isCommentNode(s.previousMember)?a.blankLineIfLastNot():a.newLineIfLastNot(),this._context.structurePrinterFactory.forClassStaticBlockDeclaration().printTexts(a,n),!i&&s.nextMember!=null?a.blankLineIfLastNot():a.newLineIfLastNot()}})}getStaticBlocks(){return this.getMembers().filter(r=>Tr.isClassStaticBlockDeclaration(r))}addGetAccessor(r){return this.addGetAccessors([r])[0]}addGetAccessors(r){return this.insertGetAccessors(ad(this.getMembersWithComments()),r)}insertGetAccessor(r,n){return this.insertGetAccessors(r,[n])[0]}insertGetAccessors(r,n){return MD(this,{index:r,structures:n,expectedKind:b.SyntaxKind.GetAccessor,write:(i,a)=>{a.previousMember!=null&&!Tr.isCommentNode(a.previousMember)?i.blankLineIfLastNot():i.newLineIfLastNot(),this._context.structurePrinterFactory.forGetAccessorDeclaration({isAmbient:f_(this)}).printTexts(i,n),a.nextMember!=null?i.blankLineIfLastNot():i.newLineIfLastNot()}})}addSetAccessor(r){return this.addSetAccessors([r])[0]}addSetAccessors(r){return this.insertSetAccessors(ad(this.getMembersWithComments()),r)}insertSetAccessor(r,n){return this.insertSetAccessors(r,[n])[0]}insertSetAccessors(r,n){return MD(this,{index:r,structures:n,expectedKind:b.SyntaxKind.SetAccessor,write:(i,a)=>{a.previousMember!=null&&!Tr.isCommentNode(a.previousMember)?i.blankLineIfLastNot():i.newLineIfLastNot(),this._context.structurePrinterFactory.forSetAccessorDeclaration({isAmbient:f_(this)}).printTexts(i,n),a.nextMember!=null?i.blankLineIfLastNot():i.newLineIfLastNot()}})}addProperty(r){return this.addProperties([r])[0]}addProperties(r){return this.insertProperties(ad(this.getMembersWithComments()),r)}insertProperty(r,n){return this.insertProperties(r,[n])[0]}insertProperties(r,n){return MD(this,{index:r,structures:n,expectedKind:b.SyntaxKind.PropertyDeclaration,write:(i,a)=>{a.previousMember!=null&&Tr.hasBody(a.previousMember)?i.blankLineIfLastNot():i.newLineIfLastNot(),this._context.structurePrinterFactory.forPropertyDeclaration().printTexts(i,n),a.nextMember!=null&&Tr.hasBody(a.nextMember)?i.blankLineIfLastNot():i.newLineIfLastNot()}})}addMethod(r){return this.addMethods([r])[0]}addMethods(r){return this.insertMethods(ad(this.getMembersWithComments()),r)}insertMethod(r,n){return this.insertMethods(r,[n])[0]}insertMethods(r,n){let i=f_(this);return n=n.map(a=>({...a})),MD(this,{index:r,write:(a,s)=>{!i&&s.previousMember!=null&&!Tr.isCommentNode(s.previousMember)?a.blankLineIfLastNot():a.newLineIfLastNot(),this._context.structurePrinterFactory.forMethodDeclaration({isAmbient:i}).printTexts(a,n),!i&&s.nextMember!=null?a.blankLineIfLastNot():a.newLineIfLastNot()},structures:n,expectedKind:b.SyntaxKind.MethodDeclaration})}getInstanceProperty(r){return ic(this.getInstanceProperties(),r)}getInstancePropertyOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getInstanceProperty(r),()=>Ou("class instance property",r))}getInstanceProperties(){return this.getInstanceMembers().filter(r=>ipe(r))}getStaticProperty(r){return ic(this.getStaticProperties(),r)}getStaticPropertyOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getStaticProperty(r),()=>Ou("class static property",r))}getStaticProperties(){return this.getStaticMembers().filter(r=>ipe(r))}getProperty(r){return ic(this.getProperties(),r)}getPropertyOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getProperty(r),()=>Ou("class property declaration",r))}getProperties(){return this.getMembers().filter(r=>Tr.isPropertyDeclaration(r))}getGetAccessor(r){return ic(this.getGetAccessors(),r)}getGetAccessorOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getGetAccessor(r),()=>Ou("class getAccessor declaration",r))}getGetAccessors(){return this.getMembers().filter(r=>Tr.isGetAccessorDeclaration(r))}getSetAccessor(r){return ic(this.getSetAccessors(),r)}getSetAccessorOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getSetAccessor(r),()=>Ou("class setAccessor declaration",r))}getSetAccessors(){return this.getMembers().filter(r=>Tr.isSetAccessorDeclaration(r))}getMethod(r){return ic(this.getMethods(),r)}getMethodOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getMethod(r),()=>Ou("class method declaration",r))}getMethods(){return this.getMembers().filter(r=>Tr.isMethodDeclaration(r))}getInstanceMethod(r){return ic(this.getInstanceMethods(),r)}getInstanceMethodOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getInstanceMethod(r),()=>Ou("class instance method",r))}getInstanceMethods(){return this.getInstanceMembers().filter(r=>r instanceof KD)}getStaticMethod(r){return ic(this.getStaticMethods(),r)}getStaticMethodOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getStaticMethod(r),()=>Ou("class static method",r))}getStaticMethods(){return this.getStaticMembers().filter(r=>r instanceof KD)}getInstanceMember(r){return ic(this.getInstanceMembers(),r)}getInstanceMemberOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getInstanceMember(r),()=>Ou("class instance member",r))}getInstanceMembers(){return this.getMembersWithParameterProperties().filter(r=>Tr.isConstructorDeclaration(r)?!1:Tr.isParameterDeclaration(r)||!r.isStatic())}getStaticMember(r){return ic(this.getStaticMembers(),r)}getStaticMemberOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getStaticMember(r),()=>Ou("class static member",r))}getStaticMembers(){return this.getMembers().filter(r=>Tr.isConstructorDeclaration(r)?!1:!Tr.isParameterDeclaration(r)&&r.isStatic())}getMembersWithParameterProperties(){let r=this.getMembers(),n=r.filter(i=>Tr.isConstructorDeclaration(i)&&i.isImplementation());for(let i of n){let a=r.indexOf(i)+1;for(let s of i.getParameters())s.isParameterProperty()&&(r.splice(a,0,s),a++)}return r}getMembers(){return tpe(this,this.compilerNode.members).filter(r=>ape(r))}getMembersWithComments(){let r=this.compilerNode,n=od.getContainerArray(r,this.getSourceFile().compilerNode);return tpe(this,n).filter(i=>ape(i)||Tr.isCommentClassElement(i))}getMember(r){return ic(this.getMembers(),r)}getMemberOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getMember(r),()=>Ou("class member",r))}getBaseTypes(){return this.getType().getBaseTypes()}getBaseClassOrThrow(){return b.errors.throwIfNullOrUndefined(this.getBaseClass(),`Expected to find the base class of ${this.getName()}.`)}getBaseClass(){let n=b.ArrayUtils.flatten(this.getBaseTypes().map(i=>i.isIntersection()?i.getIntersectionTypes():[i])).map(i=>i.getSymbol()).filter(i=>i!=null).map(i=>i.getDeclarations()).reduce((i,a)=>i.concat(a),[]).filter(i=>i.getKind()===b.SyntaxKind.ClassDeclaration);if(n.length===1)return n[0]}getDerivedClasses(){let r=npe(this);for(let n=0;n<r.length;n++){let i=npe(r[n]);for(let a of i)a!==this&&r.indexOf(a)===-1&&r.push(a)}return r}}}function tpe(e,r){let n=f_(e),i=r.map(a=>e._getNodeFromCompilerNode(a));return n?i:i.filter(a=>!(Tr.isConstructorDeclaration(a)||Tr.isMethodDeclaration(a))||Tr.isMethodDeclaration(a)&&a.isAbstract()?!0:a.isImplementation())}function npe(e){let r=[],n=e.getNameNode();if(n==null)return r;for(let i of n.findReferencesAsNodes()){let a=i.getParentIfKind(b.SyntaxKind.ExpressionWithTypeArguments);if(a==null)continue;let s=a.getParentIfKind(b.SyntaxKind.HeritageClause);if(s==null||s.getToken()!==b.SyntaxKind.ExtendsKeyword)continue;let u=s.getParentIfKind(b.SyntaxKind.ClassDeclaration);u!=null&&r.push(u)}return r}function ipe(e){return Tr.isPropertyDeclaration(e)||Tr.isSetAccessorDeclaration(e)||Tr.isGetAccessorDeclaration(e)||Tr.isParameterDeclaration(e)}function ape(e){return Tr.isMethodDeclaration(e)||Tr.isPropertyDeclaration(e)||Tr.isGetAccessorDeclaration(e)||Tr.isSetAccessorDeclaration(e)||Tr.isConstructorDeclaration(e)||Tr.isClassStaticBlockDeclaration(e)}function MD(e,r){return rq({getIndexedChildren:()=>e.getMembersWithComments(),parent:e,...r})}var OUe=e=>vS(Ih(BE(pq(e)))),AR=OUe(Cl),kw=class extends AR{set(r){return io(AR.prototype,this,r),r.extends!=null?this.setExtends(r.extends):r.hasOwnProperty(b.nameof(r,"extends"))&&this.removeExtends(),r.ctors!=null&&(this.getConstructors().forEach(n=>n.remove()),this.addConstructors(r.ctors)),r.properties!=null&&(this.getProperties().forEach(n=>n.remove()),this.addProperties(r.properties)),r.getAccessors!=null&&(this.getGetAccessors().forEach(n=>n.remove()),this.addGetAccessors(r.getAccessors)),r.setAccessors!=null&&(this.getSetAccessors().forEach(n=>n.remove()),this.addSetAccessors(r.setAccessors)),r.methods!=null&&(this.getMethods().forEach(n=>n.remove()),this.addMethods(r.methods)),this}getStructure(){let r=this.getExtends(),n=this.isAmbient();return uo(AR.prototype,this,{kind:Oe.StructureKind.Class,ctors:this.getConstructors().filter(i=>n||!i.isOverload()).map(i=>i.getStructure()),methods:this.getMethods().filter(i=>n||!i.isOverload()).map(i=>i.getStructure()),properties:this.getProperties().map(i=>i.getStructure()),extends:r?r.getText():void 0,getAccessors:this.getGetAccessors().map(i=>i.getStructure()),setAccessors:this.getSetAccessors().map(i=>i.getStructure())})}extractInterface(r){let{constructors:n,properties:i,methods:a,accessors:s}=ope(this,!1),u=b.ArrayUtils.flatten(n.map(p=>p.getParameters().filter(f=>f.isParameterProperty()))).filter(p=>p.getName()!=null&&p.getScope()===Oe.Scope.Public);return{kind:Oe.StructureKind.Interface,name:spe(r,this),docs:this.getJsDocs().map(p=>p.getStructure()),typeParameters:this.getTypeParameters().map(p=>p.getStructure()),properties:[...u.map(p=>{let f=b.ArrayUtils.flatten(p.getParentOrThrow().getJsDocs().map(m=>m.getTags())).filter(Tr.isJSDocParameterTag).filter(m=>m.getTagName()==="param"&&m.getName()===p.getName()&&m.getComment()!=null).map(m=>m.getCommentText().trim())[0];return{kind:Oe.StructureKind.PropertySignature,docs:f==null?[]:[{kind:Oe.StructureKind.JSDoc,description:f}],name:p.getName(),type:p.getType().getText(p),hasQuestionToken:p.hasQuestionToken(),isReadonly:p.isReadonly()}}),...i.map(lpe),...s.map(upe)],methods:a.map(cpe)}}extractStaticInterface(r){let{constructors:n,properties:i,methods:a,accessors:s}=ope(this,!0),u=spe(void 0,this);return{kind:Oe.StructureKind.Interface,name:r,properties:[...i.map(lpe),...s.map(upe)],methods:a.map(cpe),constructSignatures:n.map(p=>({kind:Oe.StructureKind.ConstructSignature,docs:p.getJsDocs().map(f=>f.getStructure()),parameters:p.getParameters().map(f=>({...d_e(f),scope:void 0,isReadonly:!1})),returnType:u}))}}};function ope(e,r){let n=b.ArrayUtils.flatten(e.getConstructors().map(u=>u.getOverloads().length>0?u.getOverloads():[u])),i=e.getProperties().filter(u=>u.isStatic()===r&&u.getScope()===Oe.Scope.Public),a=b.ArrayUtils.flatten(e.getMethods().filter(u=>u.isStatic()===r&&u.getScope()===Oe.Scope.Public).map(u=>u.getOverloads().length>0?u.getOverloads():[u]));return{constructors:n,properties:i,methods:a,accessors:s()};function s(){let u=new b.KeyValueCache;for(let p of[...e.getGetAccessors(),...e.getSetAccessors()])p.isStatic()===r&&p.getScope()===Oe.Scope.Public&&u.getOrCreate(p.getName(),()=>[]).push(p);return u.getValuesAsArray()}}function spe(e,r){return e=b.StringUtils.isNullOrWhitespace(e)?void 0:e,e||r.getName()||r.getSourceFile().getBaseNameWithoutExtension().replace(/[^a-zA-Z0-9_$]/g,"")}function lpe(e){return{kind:Oe.StructureKind.PropertySignature,docs:e.getJsDocs().map(r=>r.getStructure()),name:e.getName(),type:e.getType().getText(e),hasQuestionToken:e.hasQuestionToken(),isReadonly:e.isReadonly()}}function upe(e){return{kind:Oe.StructureKind.PropertySignature,docs:e[0].getJsDocs().map(r=>r.getStructure()),name:e[0].getName(),type:e[0].getType().getText(e[0]),hasQuestionToken:!1,isReadonly:e.every(Tr.isGetAccessorDeclaration)}}function cpe(e){return{kind:Oe.StructureKind.MethodSignature,docs:e.getJsDocs().map(r=>r.getStructure()),name:e.getName(),hasQuestionToken:e.hasQuestionToken(),returnType:e.getReturnType().getText(e),parameters:e.getParameters().map(d_e),typeParameters:e.getTypeParameters().map(r=>r.getStructure())}}function d_e(e){return{...e.getStructure(),decorators:[]}}var f_e=pq(sd),Rw=class extends f_e{},kUe=e=>Im(ld(Rh(sc(rG(e))))),LR=kUe(Xg),Mw=class extends LR{getName(){return"static"}isStatic(){return!0}set(r){return io(LR.prototype,this,r),this}getStructure(){return uo(LR.prototype,this,{kind:Oe.StructureKind.ClassStaticBlock})}},ww=class extends Xg{},RUe=e=>Oh(Im(ld(cG(gS(QT(qT(e))))))),NR=RUe(Xg),MUe=e=>z_(sc(Im(ld(gS(sf(yv(e))))))),p_e=MUe(Xg),Fw=class extends NR{set(r){return io(NR.prototype,this,r),r.overloads!=null&&(this.getOverloads().forEach(n=>n.remove()),this.addOverloads(r.overloads)),this}addOverload(r){return this.addOverloads([r])[0]}addOverloads(r){return this.insertOverloads(this.getOverloads().length,r)}insertOverload(r,n){return this.insertOverloads(r,[n])[0]}insertOverloads(r,n){let i=this._context.structurePrinterFactory.forConstructorDeclaration({isAmbient:f_(this)});return dG({node:this,index:r,structures:n,printStructure:(a,s)=>{i.printOverload(a,s)},getThisStructure:$7e,expectedSyntaxKind:b.SyntaxKind.Constructor})}getStructure(){let r=this.getImplementation()!=null,n=this.isOverload(),i=n&&r?p_e.prototype:NR.prototype;return uo(i,this,a(this));function a(s){if(r&&n)return u();return p();function u(){return{kind:Oe.StructureKind.ConstructorOverload}}function p(){return r?{kind:Oe.StructureKind.Constructor,overloads:s.getOverloads().map(f=>f.getStructure())}:{kind:Oe.StructureKind.Constructor}}}}},wUe=e=>Im(ld(JT(yS(gS(zD(QT(qT(UE(e))))))))),IR=wUe(Xg),Gw=class extends IR{set(r){return io(IR.prototype,this,r),this}getSetAccessor(){let r=this.getName(),n=this.isStatic();return this.getParentOrThrow().forEachChild(i=>{if(Tr.isSetAccessorDeclaration(i)&&i.getName()===r&&i.isStatic()===n)return i})}getSetAccessorOrThrow(){return b.errors.throwIfNullOrUndefined(this.getSetAccessor(),()=>`Expected to find a corresponding set accessor for ${this.getName()}.`)}getStructure(){return uo(IR.prototype,this,{kind:Oe.StructureKind.GetAccessor})}},FUe=e=>Im(xL(Ih(JT(yS(gS(zD(sc(DL(iq(kh(XT(KE(UE(sf(e))))))))))))))),PR=FUe(Xg),Bw=class extends PR{set(r){return io(PR.prototype,this,r),this}remove(){let r=this.getParentOrThrow();switch(r.getKind()){case b.SyntaxKind.ClassDeclaration:super.remove();break;default:throw new b.errors.NotImplementedError(`Not implemented parent syntax kind: ${r.getKindName()}`)}}getStructure(){return uo(PR.prototype,this,{kind:Oe.StructureKind.Property})}},GUe=e=>Im(ld(JT(yS(gS(zD(QT(qT(UE(e))))))))),OR=GUe(Xg),Uw=class extends OR{set(r){return io(OR.prototype,this,r),this}getGetAccessor(){let r=this.getName(),n=this.isStatic();return this.getParentOrThrow().forEachChild(i=>{if(Tr.isGetAccessorDeclaration(i)&&i.getName()===r&&i.isStatic()===n)return i})}getGetAccessorOrThrow(){return b.errors.throwIfNullOrUndefined(this.getGetAccessor(),()=>`Expected to find a corresponding get accessor for ${this.getName()}.`)}getStructure(){return uo(OR.prototype,this,{kind:Oe.StructureKind.SetAccessor})}},kR=YT(Tr),Kw=class extends kR{getName(){return this.getNameNode().getText()}getNameNode(){let r=this.getCallExpression();if(r)return n(r.getExpression());return n(this._getInnerExpression());function n(a){let s=i(a);if(!Tr.isIdentifier(s))throw new b.errors.NotImplementedError(`Expected the decorator expression '${s.getText()}' to be an identifier. Please deal directly with 'getExpression()' on the decorator to handle more complex scenarios.`);return s}function i(a){return Tr.isPropertyAccessExpression(a)?a.getNameNode():a}}getFullName(){let r=this.getSourceFile();return this.isDecoratorFactory()?this.getCallExpression().getExpression().getText():this.compilerNode.expression.getText(r.compilerNode)}isDecoratorFactory(){return Tr.isCallExpression(this._getInnerExpression())}setIsDecoratorFactory(r){if(this.isDecoratorFactory()===r)return this;if(r){let n=this._getInnerExpression(),i=n.getText();qa({parent:this,insertPos:n.getStart(),newText:`${i}()`,replacing:{textLength:i.length},customMappings:a=>[{currentNode:n,newNode:a.expression.expression}]})}else{let n=this.getCallExpressionOrThrow(),i=n.getExpression(),a=i.getText();qa({parent:this,insertPos:n.getStart(),newText:`${a}`,replacing:{textLength:n.getWidth()},customMappings:s=>[{currentNode:i,newNode:s.expression}]})}return this}getCallExpressionOrThrow(){return b.errors.throwIfNullOrUndefined(this.getCallExpression(),"Expected to find a call expression.")}getCallExpression(){let r=this._getInnerExpression();return Tr.isCallExpression(r)?r:void 0}getArguments(){var r,n;return(n=(r=this.getCallExpression())===null||r===void 0?void 0:r.getArguments())!==null&&n!==void 0?n:[]}getTypeArguments(){var r,n;return(n=(r=this.getCallExpression())===null||r===void 0?void 0:r.getTypeArguments())!==null&&n!==void 0?n:[]}addTypeArgument(r){return this.getCallExpressionOrThrow().addTypeArgument(r)}addTypeArguments(r){return this.getCallExpressionOrThrow().addTypeArguments(r)}insertTypeArgument(r,n){return this.getCallExpressionOrThrow().insertTypeArgument(r,n)}insertTypeArguments(r,n){return this.getCallExpressionOrThrow().insertTypeArguments(r,n)}removeTypeArgument(r){let n=this.getCallExpression();if(n==null)throw new b.errors.InvalidOperationError("Cannot remove a type argument from a decorator that has no type arguments.");return n.removeTypeArgument(r),this}addArgument(r){return this.addArguments([r])[0]}addArguments(r){return this.insertArguments(this.getArguments().length,r)}insertArgument(r,n){return this.insertArguments(r,[n])[0]}insertArguments(r,n){return this.setIsDecoratorFactory(!0),this.getCallExpressionOrThrow().insertArguments(r,n)}removeArgument(r){let n=this.getCallExpression();if(n==null)throw new b.errors.InvalidOperationError("Cannot remove an argument from a decorator that has no arguments.");return n.removeArgument(r),this}remove(){let r=this.getStartLinePos(),n=this.getPreviousSiblingIfKind(b.SyntaxKind.Decorator);n!=null&&n.getStartLinePos()===r?Bs({children:[this],removePrecedingSpaces:!0}):o9e({children:[this],getSiblingFormatting:(i,a)=>a.getStartLinePos()===r?El.Space:El.Newline})}_getInnerExpression(){let r=this.getExpression();for(;Tr.isParenthesizedExpression(r);)r=r.getExpression();return r}set(r){return io(kR.prototype,this,r),r.name!=null&&this.getNameNode().replaceWithText(r.name),r.arguments!=null&&(this.setIsDecoratorFactory(!0),this.getArguments().map(n=>this.removeArgument(n)),this.addArguments(r.arguments)),r.typeArguments!=null&&r.typeArguments.length>0&&(this.setIsDecoratorFactory(!0),this.getTypeArguments().map(n=>this.removeTypeArgument(n)),this.addTypeArguments(r.typeArguments)),this}getStructure(){let r=this.isDecoratorFactory();return uo(kR.prototype,this,{kind:Oe.StructureKind.Decorator,name:this.getName(),arguments:r?this.getArguments().map(n=>n.getText()):void 0,typeArguments:r?this.getTypeArguments().map(n=>n.getText()):void 0})}};function mq(e){return class extends e{getTypeExpression(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression)}getTypeExpressionOrThrow(){return b.errors.throwIfNullOrUndefined(this.getTypeExpression(),"Expected to find a JS doc type expression.")}getName(){return this.getNameNode().getText()}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}isBracketed(){return this.compilerNode.isBracketed}}}function fG(e){return class extends e{getTypeExpression(){let r=this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression);if(!(r!=null&&r.getWidth()===0))return r}getTypeExpressionOrThrow(){return b.errors.throwIfNullOrUndefined(this.getTypeExpression(),"Expected to find the JS doc tag's type expression.")}}}function m_e(e){return class extends e{getTypeParameters(){return this.compilerNode.typeParameters.map(r=>this._getNodeFromCompilerNode(r)).filter(r=>r.getWidth()>0)}}}function VH(e){return e.replace(/^\/\*\*[^\S\n]*\n?/,"").replace(/(\r?\n)?[^\S\n]*\*\/$/,"").split(/\n/).map(i=>{let a=n(i);if(a===-1)return i;let s=i[a+1]===" "?a+2:a+1;return i.substring(s)}).join(`
4251
4251
  `);function n(i){for(let a=0;a<i.length;a++){let s=i.charCodeAt(a);if(s===ac.ASTERISK)return a;if(!b.StringUtils.isWhitespaceCharCode(s))break}return-1}}var RR=Tr,Ww=class extends RR{isMultiLine(){return this.getText().includes(`
4252
- `)}getTags(){var r,n;return(n=(r=this.compilerNode.tags)===null||r===void 0?void 0:r.map(i=>this._getNodeFromCompilerNode(i)))!==null&&n!==void 0?n:[]}getInnerText(){return VH(this.getText())}getComment(){if(this.compilerNode.comment!=null)return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:this.compilerNode.comment.map(r=>this._getNodeFromCompilerNodeIfExists(r))}getCommentText(){return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:b.ts.getTextOfJSDocComment(this.compilerNode.comment)}getDescription(){var r,n;let i=this.getSourceFile().getFullText(),a=(n=(r=this.getTags()[0])===null||r===void 0?void 0:r.getStart())!==null&&n!==void 0?n:this.getEnd()-2,s=u(this);return VH(i.substring(s,Math.max(s,p())));function u(f){let m=f.getStart()+3;return i.charCodeAt(m)===ac.SPACE?m+1:m}function p(){let f=dv(i,a,m=>m===ac.NEWLINE||!b.StringUtils.isWhitespaceCharCode(m)&&m!==ac.ASTERISK);return dv(i,f,m=>m!==ac.NEWLINE&&m!==ac.CARRIAGE_RETURN)}}setDescription(r){let n=this.getTags(),i=this.getStart()+3,a=n.length>0?dv(this._sourceFile.getFullText(),n[0].getStart(),u=>u===ac.ASTERISK)-1:this.getEnd()-2;return m9e({parent:this,newText:s.call(this),replacePos:i,replacingLength:a-i}),this;function s(){var u,p;let f=this.getIndentationText(),m=this._context.manipulationSettings.getNewLineKindAsString(),g=Yg(this._getWriter(),r).split(/\r?\n/),D=g[0].length===0,P=g.length===1&&((p=(u=this.compilerNode.tags)===null||u===void 0?void 0:u.length)!==null&&p!==void 0?p:0)===0,B=P?g[0]:g.map(K=>K.length===0?`${f} *`:`${f} * ${K}`).slice(D?1:0).join(m);return P?" "+B+" ":m+B+m+f+" "}}addTag(r){return this.addTags([r])[0]}addTags(r){var n,i;return this.insertTags((i=(n=this.compilerNode.tags)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,r)}insertTag(r,n){return this.insertTags(r,[n])[0]}insertTags(r,n){if(b.ArrayUtils.isNullOrEmpty(n))return[];let i=this._getWriterWithQueuedIndentation(),a=this.getTags();if(r=ku(r,a.length),a.length===0&&!this.isMultiLine()){let p=this._context.structurePrinterFactory.forJSDoc();this.replaceWithText(f=>{p.printText(f,{description:this.getDescription(),tags:n})})}else{let p=this._context.structurePrinterFactory.forJSDocTag({printStarsOnNewLine:!0});i.newLine().write(" * "),p.printTexts(i,n),i.newLine().write(" *"),i.conditionalWrite(r<a.length," ");let f=s.call(this),m=u.call(this);qa({parent:this,insertPos:f,replacing:{textLength:m-f},newText:i.toString()})}return af(a,this.getTags(),r,!1);function s(){let p=r<a.length?a[r].getStart():this.getEnd()-2,f=this.getStart()+3;return Math.max(f,dv(this.getSourceFile().getFullText(),p,m=>!b.StringUtils.isWhitespaceCharCode(m)&&m!==ac.ASTERISK))}function u(){return r<a.length?a[r].getStart():this.getEnd()-1}}remove(){Bs({children:[this],removeFollowingSpaces:!0,removeFollowingNewLines:!0})}set(r){return io(RR.prototype,this,r),r.tags!=null?this.replaceWithText(n=>{var i;this._context.structurePrinterFactory.forJSDoc().printText(n,{description:(i=r.description)!==null&&i!==void 0?i:this.getDescription(),tags:r.tags})}):(r.description!=null&&this.setDescription(r.description),this)}getStructure(){return uo(RR.prototype,this,{kind:Oe.StructureKind.JSDoc,description:this.getDescription(),tags:this.getTags().map(r=>r.getStructure())})}},wc=class extends Tr{},__e=lG(wc),WT=class extends __e{},Vw=class extends wc{getElementTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.elementType)}},jw=class extends wc{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)}},g_e=yv(wc),cL=class extends g_e{},y_e=yS(sf(cL)),Hw=class extends y_e{},v_e=YT(WT),qw=class extends v_e{},h_e=z_(cL),Jw=class extends h_e{},zw=class extends Tr{getAssertClause(){return this._getNodeFromCompilerNode(this.compilerNode.assertClause)}isMultiline(){var r;return(r=this.compilerNode.multiLine)!==null&&r!==void 0?r:!1}},$w=class extends WT{setArgument(r){let n=this.getArgument();if(Tr.isLiteralTypeNode(n)){let i=n.getLiteral();if(Tr.isStringLiteral(i))return i.setLiteralValue(r),this}return n.replaceWithText(i=>i.quote(r),this._getWriterWithQueuedChildIndentation()),this}getArgument(){return this._getNodeFromCompilerNode(this.compilerNode.argument)}setQualifier(r){let n=this.getQualifier();if(n!=null)n.replaceWithText(r,this._getWriterWithQueuedChildIndentation());else{let i=this.getFirstChildByKindOrThrow(b.SyntaxKind.CloseParenToken);qa({insertPos:i.getEnd(),parent:this,newText:this._getWriterWithQueuedIndentation().write(".").write(r).toString()})}return this}getQualifierOrThrow(){return b.errors.throwIfNullOrUndefined(this.getQualifier(),()=>`Expected to find a qualifier for the import type: ${this.getText()}`)}getQualifier(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.qualifier)}getAssertions(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertions)}getAssertionsOrThrow(){return b.errors.throwIfNullOrUndefined(this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertions),"Could not find import type assertion container.")}},Xw=class extends wc{getObjectTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.objectType)}getIndexTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.indexType)}},Yw=class extends wc{getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}},Qw=class extends wc{getTypeNodes(){return this.compilerNode.types.map(r=>this._getNodeFromCompilerNode(r))}},Zw=class extends wc{getLiteral(){let r=this.compilerNode.literal;return this._getNodeFromCompilerNode(r)}},eF=class extends wc{getNameTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.nameType)}getNameTypeNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getNameTypeNode(),"Type did not exist.")}getReadonlyToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.readonlyToken)}getReadonlyTokenOrThrow(){return b.errors.throwIfNullOrUndefined(this.getReadonlyToken(),"Readonly token did not exist.")}getQuestionToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.questionToken)}getQuestionTokenOrThrow(){return b.errors.throwIfNullOrUndefined(this.getQuestionToken(),"Question token did not exist.")}getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getTypeNode(),"Type did not exist, but was expected to exist.")}},BUe=e=>KE(kh(SL(sc(gv(e))))),E_e=BUe(wc),rF=class extends E_e{getTypeNode(){return super.getTypeNode()}removeType(){throw new b.errors.InvalidOperationError("Cannot remove the type of a named tuple member.")}},tF=class extends wc{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}setType(r){return this.getTypeNode().replaceWithText(r),this}},nF=class extends wc{getHead(){return this._getNodeFromCompilerNode(this.compilerNode.head)}getTemplateSpans(){return this.compilerNode.templateSpans.map(r=>this._getNodeFromCompilerNode(r))}setLiteralValue(r){var n;let i=this.getChildIndex(),a=(n=this.getParentSyntaxList())!==null&&n!==void 0?n:this.getParentOrThrow();return _S({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:r}),a.getChildAtIndex(i)}},iF=class extends wc{},aF=class extends wc{getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}},UUe=e=>z_(KE(sc(Ih(BE(sf(gv(e))))))),MR=UUe(Cl),oF=class extends MR{set(r){return io(MR.prototype,this,r),this}getStructure(){return uo(MR.prototype,this,{kind:Oe.StructureKind.TypeAlias,type:this.getTypeNodeOrThrow().getText()})}},b_e=dq(wc),sF=class extends b_e{},lF=class extends wc{getOperator(){return this.compilerNode.operator}getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}};Oe.TypeParameterVariance=void 0;(function(e){e[e.None=0]="None",e[e.In=1]="In",e[e.Out=2]="Out",e[e.InOut=3]="InOut"})(Oe.TypeParameterVariance||(Oe.TypeParameterVariance={}));var wR=sf(gv(Tr)),uF=class extends wR{getConstraint(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.constraint)}getConstraintOrThrow(){return b.errors.throwIfNullOrUndefined(this.getConstraint(),"Expected to find the type parameter's constraint.")}setConstraint(r){if(r=this.getParentOrThrow()._getTextWithQueuedChildIndentation(r),b.StringUtils.isNullOrWhitespace(r))return this.removeConstraint(),this;let n=this.getConstraint();if(n!=null)return n.replaceWithText(r),this;let i=this.getNameNode();return qa({parent:this,insertPos:i.getEnd(),newText:` extends ${r}`}),this}removeConstraint(){return dpe(this.getConstraint(),b.SyntaxKind.ExtendsKeyword),this}getDefault(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.default)}getDefaultOrThrow(){return b.errors.throwIfNullOrUndefined(this.getDefault(),"Expected to find the type parameter's default.")}setDefault(r){if(r=this.getParentOrThrow()._getTextWithQueuedChildIndentation(r),b.StringUtils.isNullOrWhitespace(r))return this.removeDefault(),this;let n=this.getDefault();if(n!=null)return n.replaceWithText(r),this;let i=this.getConstraint()||this.getNameNode();return qa({parent:this,insertPos:i.getEnd(),newText:` = ${r}`}),this}removeDefault(){return dpe(this.getDefault(),b.SyntaxKind.EqualsToken),this}setVariance(r){return this.toggleModifier("in",(r&Oe.TypeParameterVariance.In)!==0),this.toggleModifier("out",(r&Oe.TypeParameterVariance.Out)!==0),this}getVariance(){let r=Oe.TypeParameterVariance.None;return this.hasModifier("in")&&(r|=Oe.TypeParameterVariance.In),this.hasModifier("out")&&(r|=Oe.TypeParameterVariance.Out),r}remove(){let r=this.getParentSyntaxListOrThrow();r.getChildrenOfKind(b.SyntaxKind.TypeParameter).length===1?i():mv(this);function i(){let a=[r.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.LessThanToken),r,r.getNextSiblingIfKindOrThrow(b.SyntaxKind.GreaterThanToken)];Bs({children:a})}}set(r){return io(wR.prototype,this,r),r.constraint!=null?this.setConstraint(r.constraint):r.hasOwnProperty(b.nameof(r,"constraint"))&&this.removeConstraint(),r.default!=null?this.setDefault(r.default):r.hasOwnProperty(b.nameof(r,"default"))&&this.removeDefault(),r.variance!=null&&this.setVariance(r.variance),this}getStructure(){let r=this.getConstraint(),n=this.getDefault();return uo(wR.prototype,this,{kind:Oe.StructureKind.TypeParameter,constraint:r?.getText({trimLeadingIndentation:!0}),default:n?n.getText({trimLeadingIndentation:!0}):void 0,variance:this.getVariance()})}};function dpe(e,r){e!=null&&Bs({children:[e.getPreviousSiblingIfKindOrThrow(r),e],removePrecedingSpaces:!0})}var cF=class extends wc{getParameterNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.parameterName)}hasAssertsModifier(){return this.compilerNode.assertsModifier!=null}getAssertsModifier(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertsModifier)}getAssertsModifierOrThrow(){return b.errors.throwIfNullOrUndefined(this.getAssertsModifier(),"Expected to find an asserts modifier.")}getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getTypeNode(),"Expected to find a type node.")}},dF=class extends WT{getExprName(){return this._getNodeFromCompilerNode(this.compilerNode.exprName)}},fF=class extends WT{getTypeName(){return this._getNodeFromCompilerNode(this.compilerNode.typeName)}},pF=class extends wc{getTypeNodes(){return this.compilerNode.types.map(r=>this._getNodeFromCompilerNode(r))}},J_=class extends wc{},mF=class extends J_{},FR=Tr,bc=class extends FR{getTagName(){return this.getTagNameNode().getText()}getTagNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.tagName)}setTagName(r){return this.set({tagName:r})}getComment(){if(this.compilerNode.comment!=null)return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:this.compilerNode.comment.map(r=>this._getNodeFromCompilerNodeIfExists(r))}getCommentText(){return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:b.ts.getTextOfJSDocComment(this.compilerNode.comment)}remove(){let r=this.getParentOrThrow().getStart()+3,n=x_e(this),i=n==null,a=s.call(this);Bs({children:[this],customRemovalPos:a,customRemovalEnd:T_e(this,n),replaceTrivia:u.call(this)});function s(){return Math.max(r,D_e(this,this.getStart()))}function u(){if(a===r&&i)return"";let p=this._context.manipulationSettings.getNewLineKindAsString(),f=this.getParentOrThrow().getIndentationText();return`${p}${f} `+(i?"":"* ")}}set(r){return io(FR.prototype,this,r),r.text!=null||r.tagName!=null?this.replaceWithText(n=>{var i;this._context.structurePrinterFactory.forJSDocTag({printStarsOnNewLine:!0}).printText(n,{tagName:(i=r.tagName)!==null&&i!==void 0?i:this.getTagName(),text:r.text!=null?r.text:fpe(this)})}):this}replaceWithText(r){let n=Yg(this._getWriterWithQueuedIndentation(),r),i=this.getParentOrThrow(),a=this.getChildIndex(),s=this.getStart();return qa({parent:i,insertPos:s,newText:n,replacing:{textLength:S_e(this)-s}}),i.getChildren()[a]}getStructure(){let r=fpe(this);return uo(FR.prototype,this,{kind:Oe.StructureKind.JSDocTag,tagName:this.getTagName(),text:r.length===0?void 0:r})}};function fpe(e){let r=e.getSourceFile().getFullText(),n=e.getTagNameNode().getEnd(),i=S_e(e),a=Math.min(r.charCodeAt(n)===ac.SPACE?n+1:n,i);return VH(r.substring(a,i))}function S_e(e){return D_e(e,T_e(e))}function T_e(e,r){return r=r??x_e(e),r!=null?r.getStart():e.getParentOrThrow().getEnd()-2}function x_e(e){let n=e.getParentIfKindOrThrow(b.SyntaxKind.JSDoc).getTags(),i=n.indexOf(e);return n[i+1]}function D_e(e,r){let n=e.getSourceFile().getFullText();return dv(n,r,i=>i!==ac.ASTERISK&&!b.StringUtils.isWhitespaceCharCode(i))}var _F=class extends bc{},gF=class extends bc{},yF=class extends bc{},vF=class extends bc{},hF=class extends bc{},EF=class extends bc{},C_e=yv(J_),bF=class extends C_e{},SF=class extends bc{},TF=class extends Tr{},xF=class extends Tr{},DF=class extends Tr{},CF=class extends Tr{},AF=class extends J_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},LF=class extends Tr{getName(){return this._getNodeFromCompilerNode(this.compilerNode.name)}},NF=class extends J_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}isPostfix(){return this.compilerNode.postfix}},IF=class extends J_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}isPostfix(){return this.compilerNode.postfix}},PF=class extends J_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},OF=class extends bc{},A_e=mq(bc),kF=class extends A_e{},RF=class extends bc{},L_e=mq(bc),MF=class extends L_e{},wF=class extends bc{},FF=class extends bc{},GF=class extends bc{},N_e=fG(bc),BF=class extends N_e{},I_e=fG(bc),UF=class extends I_e{},KF=class extends J_{getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}},dL=class{constructor(r){this._compilerObject=r}get compilerObject(){return this._compilerObject}getName(){return this.compilerObject.name}getText(){var r;return(r=this.compilerObject.text)!==null&&r!==void 0?r:[]}},P_e=m_e(bc),WF=class extends P_e{getConstraint(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.constraint)}getConstraintOrThrow(){return b.errors.throwIfNullOrUndefined(this.getConstraint(),"Expected to find the JS doc template tag's constraint.")}},VF=class extends Tr{},O_e=fG(bc),jF=class extends O_e{},HF=class extends bc{},qF=class extends wc{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},JF=class extends J_{isArrayType(){return this.compilerNode.isArrayType}getPropertyTags(){return this.compilerNode.jsDocPropertyTags?this.compilerNode.jsDocPropertyTags.map(r=>this._getNodeFromCompilerNode(r)):void 0}},zF=class extends bc{getTypeExpression(){let r=this.compilerNode.typeExpression;if(!(r!=null&&r.pos===r.end))return this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression)}},$F=class extends bc{},XF=class extends J_{},YF=class extends J_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},QF=class extends Tr{remove(){Lh({children:[this],getSiblingFormatting:()=>El.Newline})}},KUe=e=>ld(vS(sc(Ih(BE(sf(gv(e))))))),GR=KUe(Cl),ZF=class extends GR{set(r){return io(GR.prototype,this,r),r.isConst!=null&&this.setIsConstEnum(r.isConst),r.members!=null&&(this.getMembers().forEach(n=>n.remove()),this.addMembers(r.members)),this}addMember(r){return this.addMembers([r])[0]}addMembers(r){return this.insertMembers(this.getMembers().length,r)}insertMember(r,n){return this.insertMembers(r,[n])[0]}insertMembers(r,n){if(n.length===0)return[];let i=this.getMembersWithComments();r=ku(r,i.length);let a=this._getWriterWithChildIndentation();return this._context.structurePrinterFactory.forEnumMember().printTexts(a,n),H_({parent:this.getChildSyntaxListOrThrow(),currentNodes:i,insertIndex:r,newText:a.toString(),useNewLines:!0,useTrailingCommas:this._context.manipulationSettings.getUseTrailingCommas()}),af(i,this.getMembersWithComments(),r,!u());function u(){return n instanceof Array?n.every(p=>typeof p=="object"):!1}}getMember(r){return ic(this.getMembers(),r)}getMemberOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getMember(r),()=>Ou("enum member",r))}getMembers(){return this.compilerNode.members.map(r=>this._getNodeFromCompilerNode(r))}getMembersWithComments(){let r=this.compilerNode;return od.getContainerArray(r,this.getSourceFile().compilerNode).map(n=>this._getNodeFromCompilerNode(n))}setIsConstEnum(r){return this.toggleModifier("const",r)}isConstEnum(){return this.getConstKeyword()!=null}getConstKeyword(){return this.getFirstModifierByKind(b.SyntaxKind.ConstKeyword)}getStructure(){return uo(GR.prototype,this,{kind:Oe.StructureKind.Enum,isConst:this.isConstEnum(),members:this.getMembers().map(r=>r.getStructure())})}},WUe=e=>sc(XT(UE(e))),BR=WUe(Tr),e6=class extends BR{getValue(){return this._context.typeChecker.getConstantValue(this)}setValue(r){let n;if(typeof r=="string"){let i=this._context.manipulationSettings.getQuoteKind();n=i+b.StringUtils.escapeForWithinString(r,i)+i}else n=r.toString();return this.setInitializer(n),this}remove(){let r=[this],n=this.getNextSiblingIfKind(b.SyntaxKind.CommaToken);n!=null&&r.push(n),Lh({children:r,getSiblingFormatting:()=>El.Newline})}set(r){return io(BR.prototype,this,r),r.value!=null?this.setValue(r.value):r.hasOwnProperty(b.nameof(r,"value"))&&r.initializer==null&&this.removeInitializer(),this}getStructure(){return uo(BR.prototype,this,{kind:Oe.StructureKind.EnumMember,value:void 0})}},r6=class extends Tr{getTypeNodes(){var r,n;return(n=(r=this.compilerNode.types)===null||r===void 0?void 0:r.map(i=>this._getNodeFromCompilerNode(i)))!==null&&n!==void 0?n:[]}getToken(){return this.compilerNode.token}removeExpression(r){let n=this.getTypeNodes(),i=typeof r=="number"?a(r):r;if(n.length===1){let s=this.getParentSyntaxListOrThrow().getChildren();s.length===1?Bs({children:[s[0].getParentSyntaxListOrThrow()],removePrecedingSpaces:!0}):Bs({children:[this],removePrecedingSpaces:!0})}else mv(i);return this;function a(s){return n[ku(s,n.length-1)]}}},wE=class extends Tr{remove(){l9e(this)}},VUe=e=>z_(Im(sc(yv(e)))),UR=VUe(wE),t6=class extends UR{set(r){return io(UR.prototype,this,r),this}getStructure(){return uo(UR.prototype,this,{kind:Oe.StructureKind.CallSignature})}},n6=class extends wE{},jUe=e=>z_(Im(sc(yv(e)))),KR=jUe(wE),i6=class extends KR{set(r){return io(KR.prototype,this,r),this}getStructure(){return uo(KR.prototype,this,{kind:Oe.StructureKind.ConstructSignature})}},HUe=e=>uq(Im(sc(DL(sf(e))))),WR=HUe(wE),a6=class extends WR{getKeyName(){return this.getKeyNameNode().getText()}setKeyName(r){b.errors.throwIfWhitespaceOrNotString(r,"name"),this.getKeyName()!==r&&this.getKeyNameNode().replaceWithText(r,this._getWriterWithQueuedChildIndentation())}getKeyNameNode(){let r=this.compilerNode.parameters[0];return this._getNodeFromCompilerNode(r.name)}getKeyType(){return this.getKeyNameNode().getType()}setKeyType(r){b.errors.throwIfWhitespaceOrNotString(r,"type");let n=this.getKeyTypeNode();return n.getText()===r?this:(n.replaceWithText(r,this._getWriterWithQueuedChildIndentation()),this)}getKeyTypeNode(){let r=this.compilerNode.parameters[0];return this._getNodeFromCompilerNode(r.type)}set(r){return io(WR.prototype,this,r),r.keyName!=null&&this.setKeyName(r.keyName),r.keyType!=null&&this.setKeyType(r.keyType),this}getStructure(){let r=this.getKeyTypeNode();return uo(WR.prototype,this,{kind:Oe.StructureKind.IndexSignature,keyName:this.getKeyName(),keyType:r.getText()})}},qUe=e=>dq(ld(Vpe(sq(z_(sc(Ih(vS(BE(sf(gv(e))))))))))),VR=qUe(Cl),o6=class extends VR{getBaseTypes(){return this.getType().getBaseTypes()}getBaseDeclarations(){return b.ArrayUtils.flatten(this.getType().getBaseTypes().map(r=>{var n,i;return(i=(n=r.getSymbol())===null||n===void 0?void 0:n.getDeclarations())!==null&&i!==void 0?i:[]}))}getImplementations(){return this.getNameNode().getImplementations()}set(r){return io(VR.prototype,this,r),this}getStructure(){return uo(VR.prototype,this,{kind:Oe.StructureKind.Interface})}},JUe=e=>Im(sc(kh(z_(yv(UE(e)))))),jR=JUe(wE),s6=class extends jR{set(r){return io(jR.prototype,this,r),this}getStructure(){return uo(jR.prototype,this,{kind:Oe.StructureKind.MethodSignature})}},zUe=e=>Im(sc(DL(kh(XT(KE(UE(sf(e)))))))),HR=zUe(wE),l6=class extends HR{set(r){return io(HR.prototype,this,r),this}getStructure(){return uo(HR.prototype,this,{kind:Oe.StructureKind.PropertySignature})}};function _q(e){return class extends e{getAttributes(){return this.compilerNode.attributes.properties.map(r=>this._getNodeFromCompilerNode(r))}getAttributeOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getAttribute(r),()=>Ou("attribute",r))}getAttribute(r){return ic(this.getAttributes(),r)}addAttribute(r){return this.addAttributes([r])[0]}addAttributes(r){return this.insertAttributes(this.compilerNode.attributes.properties.length,r)}insertAttribute(r,n){return this.insertAttributes(r,[n])[0]}insertAttributes(r,n){if(n.length===0)return[];let i=this.compilerNode.attributes.properties.length;r=ku(r,i);let a=r===0?this.getTagNameNode().getEnd():this.getAttributes()[r-1].getEnd(),s=this._getWriterWithQueuedChildIndentation();return new jj(this._context.structurePrinterFactory.forJsxAttributeDecider()).printText(s,n),qa({insertPos:a,newText:" "+s.toString(),parent:this.getNodeProperty("attributes").getFirstChildByKindOrThrow(b.SyntaxKind.SyntaxList)}),af(i,this.getAttributes(),r,!1)}set(r){return io(e.prototype,this,r),r.attributes!=null&&(this.getAttributes().forEach(n=>n.remove()),this.addAttributes(r.attributes)),this}getStructure(){return uo(e.prototype,this,{attributes:this.getAttributes().map(r=>r.getStructure())})}}}function pG(e){return class extends e{getTagNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.tagName)}set(r){return io(e.prototype,this,r),r.name!=null&&this.getTagNameNode().replaceWithText(r.name),this}getStructure(){return uo(e.prototype,this,{name:this.getTagNameNode().getText()})}}}var qR=gv(Tr),u6=class extends qR{getInitializerOrThrow(){return b.errors.throwIfNullOrUndefined(this.getInitializer(),`Expected to find an initializer for the JSX attribute '${this.getName()}'`)}getInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.initializer)}setInitializer(r){let n=Yg(this._getWriterWithQueuedIndentation(),r);if(b.StringUtils.isNullOrWhitespace(n))return this.removeInitializer(),this;let i=this.getInitializer();return i!=null?(i.replaceWithText(n),this):(qa({insertPos:this.getNameNode().getEnd(),parent:this,newText:`=${n}`}),this)}removeInitializer(){let r=this.getInitializer();return r==null?this:(Bs({children:[r.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.EqualsToken),r],removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this)}remove(){Bs({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(r){return io(qR.prototype,this,r),r.initializer!=null?this.setInitializer(r.initializer):r.hasOwnProperty(b.nameof(r,"initializer"))&&this.removeInitializer(),this}getStructure(){let r=this.getInitializer();return uo(qR.prototype,this,{kind:Oe.StructureKind.JsxAttribute,initializer:r?.getText()})}},$Ue=e=>pG(e),k_e=$Ue(Tr),c6=class extends k_e{},d6=class extends oc{},JR=sd,f6=class extends JR{getJsxChildren(){return this.compilerNode.children.map(r=>this._getNodeFromCompilerNode(r))}getOpeningElement(){return this._getNodeFromCompilerNode(this.compilerNode.openingElement)}getClosingElement(){return this._getNodeFromCompilerNode(this.compilerNode.closingElement)}setBodyText(r){let n=Fpe(this._getWriterWithIndentation(),r);return ppe(this,n),this}setBodyTextInline(r){let n=this._getWriterWithQueuedChildIndentation();return GE(n,r),n.isLastNewLine()&&(n.setIndentationLevel(Math.max(0,this.getIndentationLevel()-1)),n.write("")),ppe(this,n.toString()),this}set(r){if(io(JR.prototype,this,r),r.attributes!=null){let n=this.getOpeningElement();n.getAttributes().forEach(i=>i.remove()),n.addAttributes(r.attributes)}if(r.children!=null)throw new b.errors.NotImplementedError("Setting JSX children is currently not implemented. Please open an issue if you need this.");return r.bodyText!=null?this.setBodyText(r.bodyText):r.hasOwnProperty(b.nameof(r,"bodyText"))&&this.setBodyTextInline(""),r.name!=null&&(this.getOpeningElement().getTagNameNode().replaceWithText(r.name),this.getClosingElement().getTagNameNode().replaceWithText(r.name)),this}getStructure(){let r=this.getOpeningElement(),n=uo(JR.prototype,this,{kind:Oe.StructureKind.JsxElement,name:r.getTagNameNode().getText(),attributes:r.getAttributes().map(i=>i.getStructure()),children:void 0,bodyText:nq(this)});return delete n.children,n}};function ppe(e,r){let n=e.getOpeningElement(),i=e.getClosingElement();qa({insertPos:n.getEnd(),newText:r,parent:e.getChildSyntaxListOrThrow(),replacing:{textLength:i.getStart()-n.getEnd()}})}var R_e=CL(SL(oc)),p6=class extends R_e{},m6=class extends sd{getJsxChildren(){return this.compilerNode.children.map(r=>this._getNodeFromCompilerNode(r))}getOpeningFragment(){return this._getNodeFromCompilerNode(this.compilerNode.openingFragment)}getClosingFragment(){return this._getNodeFromCompilerNode(this.compilerNode.closingFragment)}},XUe=e=>_q(pG(e)),M_e=XUe(oc),_6=class extends M_e{},g6=class extends oc{},YUe=e=>_q(pG(e)),zR=YUe(sd),y6=class extends zR{set(r){return io(zR.prototype,this,r),this}getStructure(){return uo(zR.prototype,this,{kind:Oe.StructureKind.JsxSelfClosingElement})}},$R=ud(Tr),v6=class extends $R{remove(){Bs({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(r){return io($R.prototype,this,r),r.expression!=null&&this.setExpression(r.expression),this}getStructure(){return uo($R.prototype,this,{kind:Oe.StructureKind.JsxSpreadAttribute,expression:this.getExpression().getText()})}},w_e=qD(Tr),h6=class extends w_e{containsOnlyTriviaWhiteSpaces(){let r=this.compilerNode;return typeof r.containsOnlyWhiteSpaces=="boolean"?r.containsOnlyWhiteSpaces:this.compilerNode.containsOnlyTriviaWhiteSpaces}},F_e=dS,E6=class extends F_e{getLiteralValue(){let r=this.compilerNode.text;if(typeof BigInt>"u")throw new b.errors.InvalidOperationError("Runtime environment does not support BigInts. Perhaps work with the text instead?");let n=r.substring(0,r.length-1);return BigInt(n)}setLiteralValue(r){if(typeof r!="bigint")throw new b.errors.ArgumentTypeError("value","bigint",typeof r);return _S({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:r.toString()+"n"}),this}},G_e=sd,b6=class extends G_e{getLiteralValue(){return gq(this)}setLiteralValue(r){return U_e(this,r)}},B_e=sd,S6=class extends B_e{getLiteralValue(){return gq(this)}setLiteralValue(r){return U_e(this,r)}};function U_e(e,r){if(gq(e)===r)return e;let n=e.getParentSyntaxList()||e.getParentOrThrow(),i=e.getChildIndex();return e.replaceWithText(r?"true":"false"),n.getChildAtIndex(i)}function gq(e){return e.getKind()===b.SyntaxKind.TrueKeyword}var K_e=sd,T6=class extends K_e{},W_e=dS,x6=class extends W_e{getLiteralValue(){let r=this.compilerNode.text;return r.indexOf(".")>=0?parseFloat(r):parseInt(r,10)}setLiteralValue(r){return _S({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:r.toString(10)}),this}};Oe.QuoteKind=void 0;(function(e){e.Single="'",e.Double='"'})(Oe.QuoteKind||(Oe.QuoteKind={}));var V_e=dS,D6=class extends V_e{getLiteralValue(){let r=/^\/(.*)\/([^\/]*)$/,n=this.compilerNode.text,i=r.exec(n);return new RegExp(i[1],i[2])}setLiteralValue(r,n){let i;return typeof r=="string"?i=r:(i=r.source,n=r.flags),_S({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:`/${i}/${n||""}`}),this}},j_e=dS,C6=class extends j_e{getLiteralValue(){return this.compilerNode.text}setLiteralValue(r){return _S({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:b.StringUtils.escapeForWithinString(r,this.getQuoteKind())}),this}getQuoteKind(){return this.getText()[0]==="'"?Oe.QuoteKind.Single:Oe.QuoteKind.Double}},H_e=dS,A6=class extends H_e{getLiteralValue(){return this.compilerNode.text}setLiteralValue(r){let n=this.getChildIndex(),i=this.getParentSyntaxList()||this.getParentOrThrow();return _S({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:r}),i.getChildAtIndex(n)}},L6=class extends UT{getTag(){return this._getNodeFromCompilerNode(this.compilerNode.tag)}getTemplate(){return this._getNodeFromCompilerNode(this.compilerNode.template)}removeTag(){var r;let n=(r=this.getParentSyntaxList())!==null&&r!==void 0?r:this.getParentOrThrow(),i=this.getChildIndex(),a=this.getTemplate();return qa({customMappings:(s,u)=>[{currentNode:a,newNode:s.getChildren(u)[i]}],parent:n,insertPos:this.getStart(),newText:this.getTemplate().getText(),replacing:{textLength:this.getWidth(),nodes:[this]}}),n.getChildAtIndex(i)}},q_e=sd,N6=class extends q_e{getHead(){return this._getNodeFromCompilerNode(this.compilerNode.head)}getTemplateSpans(){return this.compilerNode.templateSpans.map(r=>this._getNodeFromCompilerNode(r))}setLiteralValue(r){var n;let i=this.getChildIndex(),a=(n=this.getParentSyntaxList())!==null&&n!==void 0?n:this.getParentOrThrow();return _S({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:r}),a.getChildAtIndex(i)}},J_e=qD(Tr),I6=class extends J_e{},z_e=qD(Tr),P6=class extends z_e{},$_e=ud(Tr),O6=class extends $_e{getLiteral(){return this._getNodeFromCompilerNode(this.compilerNode.literal)}},X_e=qD(Tr),k6=class extends X_e{};function yq(e){return class extends e{getText(){return this.compilerNode.text}getDefinitionNodes(){return this.getDefinitions().map(r=>r.getDeclarationNode()).filter(r=>r!=null)}getDefinitions(){return this._context.languageService.getDefinitions(this)}}}var Y_e=ud(Tr),R6=class extends Y_e{},Q_e=yq(Oh(_v(sd))),M6=class extends Q_e{getImplementations(){return this._context.languageService.getImplementations(this)}},Z_e=yq(Oh(_v(Tr))),w6=class extends Z_e{},F6=class extends Tr{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}getRight(){return this._getNodeFromCompilerNode(this.compilerNode.right)}},QUe=e=>aq(iq(KE(XT(aG(e))))),XR=QUe(Tr),G6=class extends XR{remove(){let r=this.getParentOrThrow();switch(r.getKind()){case b.SyntaxKind.VariableDeclarationList:n(this);break;case b.SyntaxKind.CatchClause:i(this);break;default:throw new b.errors.NotImplementedError(`Not implemented for syntax kind: ${r.getKindName()}`)}function n(a){let s=r.getParentIfKindOrThrow(b.SyntaxKind.VariableStatement);s.getDeclarations().length===1?s.remove():mv(a)}function i(a){Bs({children:[a.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.OpenParenToken),a,a.getNextSiblingIfKindOrThrow(b.SyntaxKind.CloseParenToken)],removePrecedingSpaces:!0})}}getVariableStatementOrThrow(){return b.errors.throwIfNullOrUndefined(this.getVariableStatement(),"Expected the grandparent to be a variable statement.")}getVariableStatement(){let r=this.getParentOrThrow().getParentOrThrow();return Tr.isVariableStatement(r)?r:void 0}set(r){return io(XR.prototype,this,r),this}getStructure(){return uo(XR.prototype,this,{kind:Oe.StructureKind.VariableDeclaration})}},ege=sf(Tr),B6=class extends ege{getDeclarations(){return this.compilerNode.declarations.map(r=>this._getNodeFromCompilerNode(r))}getDeclarationKind(){let r=this.compilerNode.flags;return r&b.ts.NodeFlags.Let?Oe.VariableDeclarationKind.Let:r&b.ts.NodeFlags.Const?Oe.VariableDeclarationKind.Const:Oe.VariableDeclarationKind.Var}getDeclarationKindKeyword(){let r=this.getDeclarationKind();switch(r){case Oe.VariableDeclarationKind.Const:return this.getFirstChildByKindOrThrow(b.SyntaxKind.ConstKeyword);case Oe.VariableDeclarationKind.Let:return this.getFirstChildByKindOrThrow(b.SyntaxKind.LetKeyword);case Oe.VariableDeclarationKind.Var:return this.getFirstChildByKindOrThrow(b.SyntaxKind.VarKeyword);default:return b.errors.throwNotImplementedForNeverValueError(r)}}setDeclarationKind(r){if(this.getDeclarationKind()===r)return this;let n=this.getDeclarationKindKeyword();return qa({insertPos:n.getStart(),newText:r,parent:this,replacing:{textLength:n.getWidth()}}),this}addDeclaration(r){return this.addDeclarations([r])[0]}addDeclarations(r){return this.insertDeclarations(this.getDeclarations().length,r)}insertDeclaration(r,n){return this.insertDeclarations(r,[n])[0]}insertDeclarations(r,n){let i=this._getWriterWithQueuedChildIndentation(),a=new Nh(this._context.structurePrinterFactory.forVariableDeclaration()),s=this.compilerNode.declarations.length;return r=ku(r,s),a.printText(i,n),H_({parent:this.getFirstChildByKindOrThrow(b.SyntaxKind.SyntaxList),currentNodes:this.getDeclarations(),insertIndex:r,newText:i.toString(),useTrailingCommas:!1}),af(s,this.getDeclarations(),r,!1)}},U6=class{constructor(r,n){this._context=r,this._compilerSignature=n}get compilerSignature(){return this._compilerSignature}getTypeParameters(){return(this.compilerSignature.typeParameters||[]).map(n=>this._context.compilerFactory.getTypeParameter(n))}getParameters(){return this.compilerSignature.parameters.map(r=>this._context.compilerFactory.getSymbol(r))}getReturnType(){return this._context.compilerFactory.getType(this.compilerSignature.getReturnType())}getDocumentationComments(){return this.compilerSignature.getDocumentationComment(this._context.typeChecker.compilerObject).map(n=>this._context.compilerFactory.getSymbolDisplayPart(n))}getJsDocTags(){return this.compilerSignature.getJsDocTags().map(n=>this._context.compilerFactory.getJSDocTagInfo(n))}getDeclaration(){let{compilerFactory:r}=this._context,n=this.compilerSignature.getDeclaration();return r.getNodeFromCompilerNode(n,r.getSourceFileForNode(n))}},K6=class{constructor(r,n){this._context=r,this._compilerSymbol=n,this.getValueDeclaration(),this.getDeclarations()}get compilerSymbol(){return this._compilerSymbol}getName(){return this.compilerSymbol.getName()}getEscapedName(){return this.compilerSymbol.getEscapedName()}getAliasedSymbolOrThrow(){return b.errors.throwIfNullOrUndefined(this.getAliasedSymbol(),"Expected to find an aliased symbol.")}getImmediatelyAliasedSymbol(){return this._context.typeChecker.getImmediatelyAliasedSymbol(this)}getImmediatelyAliasedSymbolOrThrow(){return b.errors.throwIfNullOrUndefined(this.getImmediatelyAliasedSymbol(),"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()&b.SymbolFlags.Alias)===b.SymbolFlags.Alias}isOptional(){return(this.getFlags()&b.SymbolFlags.Optional)===b.SymbolFlags.Optional}getFlags(){return this.compilerSymbol.getFlags()}hasFlags(r){return(this.compilerSymbol.flags&r)===r}getValueDeclarationOrThrow(){return b.errors.throwIfNullOrUndefined(this.getValueDeclaration(),()=>`Expected to find the value declaration of symbol '${this.getName()}'.`)}getValueDeclaration(){let r=this.compilerSymbol.valueDeclaration;if(r!=null)return this._context.compilerFactory.getNodeFromCompilerNode(r,this._context.compilerFactory.getSourceFileForNode(r))}getDeclarations(){var r;return((r=this.compilerSymbol.declarations)!==null&&r!==void 0?r:[]).map(n=>this._context.compilerFactory.getNodeFromCompilerNode(n,this._context.compilerFactory.getSourceFileForNode(n)))}getExportOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getExport(r),`Expected to find export with name: ${r}`)}getExport(r){if(this.compilerSymbol.exports==null)return;let n=this.compilerSymbol.exports.get(b.ts.escapeLeadingUnderscores(r));return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getExports(){return this.compilerSymbol.exports==null?[]:b.ArrayUtils.from(this.compilerSymbol.exports.values()).map(r=>this._context.compilerFactory.getSymbol(r))}getGlobalExportOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getGlobalExport(r),`Expected to find global export with name: ${r}`)}getGlobalExport(r){if(this.compilerSymbol.globalExports==null)return;let n=this.compilerSymbol.globalExports.get(b.ts.escapeLeadingUnderscores(r));return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getGlobalExports(){return this.compilerSymbol.globalExports==null?[]:b.ArrayUtils.from(this.compilerSymbol.globalExports.values()).map(r=>this._context.compilerFactory.getSymbol(r))}getMemberOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getMember(r),`Expected to find member with name: ${r}`)}getMember(r){if(this.compilerSymbol.members==null)return;let n=this.compilerSymbol.members.get(b.ts.escapeLeadingUnderscores(r));return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getMembers(){return this.compilerSymbol.members==null?[]:b.ArrayUtils.from(this.compilerSymbol.members.values()).map(r=>this._context.compilerFactory.getSymbol(r))}getDeclaredType(){return this._context.typeChecker.getDeclaredTypeOfSymbol(this)}getTypeAtLocation(r){return this._context.typeChecker.getTypeOfSymbolAtLocation(this,r)}getFullyQualifiedName(){return this._context.typeChecker.getFullyQualifiedName(this)}getJsDocTags(){return this.compilerSymbol.getJsDocTags(this._context.typeChecker.compilerObject).map(r=>new dL(r))}},WD=class{constructor(r){this._compilerObject=r}get compilerObject(){return this._compilerObject}getStart(){return this.compilerObject.start}getEnd(){return this.compilerObject.start+this.compilerObject.length}getLength(){return this.compilerObject.length}},FE=class{constructor(r){this._compilerObject=r}get compilerObject(){return this._compilerObject}getSpan(){return new WD(this.compilerObject.span)}getNewText(){return this.compilerObject.newText}};co([b.Memoize],FE.prototype,"getSpan",null);var pS=class{constructor(r,n){this._context=r,this._compilerObject=n;let i=r.compilerFactory.addOrGetSourceFileFromFilePath(r.fileSystemWrapper.getStandardizedAbsolutePath(n.fileName),{markInProject:!1,scriptKind:void 0});this._existingFileExists=i!=null,n.isNewFile||(this._sourceFile=i)}getFilePath(){return this._compilerObject.fileName}getSourceFile(){return this._sourceFile}getTextChanges(){return this._compilerObject.textChanges.map(r=>new FE(r))}applyChanges(r={}){if(this._isApplied)return;if(this.isNewFile()&&this._existingFileExists&&!r.overwrite)throw new b.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 n;if(this.isNewFile()?n=this._context.project.createSourceFile(this.getFilePath(),"",{overwrite:r.overwrite}):n=this.getSourceFile(),n==null)throw new b.errors.InvalidOperationError(`Cannot apply file text change to modify existing file that doesn't exist at path: ${this.getFilePath()}`);return n.applyTextChanges(this.getTextChanges()),n._markAsInProject(),this._isApplied=!0,this}isNewFile(){return!!this._compilerObject.isNewFile}};co([b.Memoize],pS.prototype,"getTextChanges",null);var W6=class{constructor(r,n){this._context=r,this._compilerObject=n}get compilerObject(){return this._compilerObject}getDescription(){return this.compilerObject.description}getChanges(){return this.compilerObject.changes.map(r=>new pS(this._context,r))}},V6=class extends W6{getFixName(){return this.compilerObject.fixName}getFixId(){return this.compilerObject.fixId}getFixAllDescription(){return this.compilerObject.fixAllDescription}},fL=class{constructor(r,n){this._context=r,this._compilerObject=n}get compilerObject(){return this._compilerObject}getChanges(){return this.compilerObject.changes.map(r=>new pS(this._context,r))}applyChanges(r){for(let n of this.getChanges())n.applyChanges(r);return this}};co([b.Memoize],fL.prototype,"getChanges",null);var pv=class{constructor(r,n){this._context=r,this._compilerObject=n,this._sourceFile=this._context.compilerFactory.addOrGetSourceFileFromFilePath(r.fileSystemWrapper.getStandardizedAbsolutePath(this.compilerObject.fileName),{markInProject:!1,scriptKind:void 0}),this._sourceFile._doActionPreNextModification(()=>this.getNode())}get compilerObject(){return this._compilerObject}getSourceFile(){return this._sourceFile}getTextSpan(){return new WD(this.compilerObject.textSpan)}getNode(){let r=this.getTextSpan(),n=this.getSourceFile(),i=r.getStart(),a=r.getEnd();return s();function s(){let u;return n._context.compilerFactory.forgetNodesCreatedInBlock(p=>{let f,m=n;for(;m!=null;){if(f==null&&(u=m),m.getStart()===i&&m.getWidth()===a)u=f=m;else if(f!=null)break;m=m.getChildAtPos(i)}u!=null&&p(u)}),u}}getOriginalTextSpan(){let{originalTextSpan:r}=this.compilerObject;return r==null?void 0:new WD(r)}getOriginalFileName(){return this.compilerObject.originalFileName}};co([b.Memoize],pv.prototype,"getTextSpan",null);co([b.Memoize],pv.prototype,"getNode",null);co([b.Memoize],pv.prototype,"getOriginalTextSpan",null);var VD=class extends pv{constructor(r,n){super(r,n),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 r=this.getTextSpan().getStart(),n=i(this.getSourceFile());return n?.getParentOrThrow();function i(a){if(a.getKind()===b.SyntaxKind.Identifier&&a.getStart()===r)return a;for(let s of a._getChildrenIterator())if(s.getPos()<=r&&s.getEnd()>r)return i(s)}}};co([b.Memoize],VD.prototype,"getDeclarationNode",null);var mS=class{constructor(r){this._compilerObject=r}get compilerObject(){return this._compilerObject}getMessageText(){return this.compilerObject.messageText}getNext(){let r=this.compilerObject.next;if(r!=null)return r instanceof Array?r.map(n=>new mS(n)):[new mS(r)]}getCode(){return this.compilerObject.code}getCategory(){return this.compilerObject.category}},VT=class{constructor(r,n){this._context=r,this._compilerObject=n,this.getSourceFile()}get compilerObject(){return this._compilerObject}getSourceFile(){if(this._context==null)return;let r=this.compilerObject.file;return r==null?void 0:this._context.compilerFactory.getSourceFile(r,{markInProject:!1})}getMessageText(){let r=this._compilerObject.messageText;return typeof r=="string"?r:this._context==null?new mS(r):this._context.compilerFactory.getDiagnosticMessageChain(r)}getLineNumber(){let r=this.getSourceFile(),n=this.getStart();if(!(r==null||n==null))return b.StringUtils.getLineNumberAtPos(r.getFullText(),n)}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}};co([b.Memoize],VT.prototype,"getSourceFile",null);var pL=class extends VT{constructor(r,n){super(r,n)}getLineNumber(){return super.getLineNumber()}getStart(){return super.getStart()}getLength(){return super.getLength()}getSourceFile(){return super.getSourceFile()}},j6=class{constructor(r,n){this._compilerObject=n,this._context=r}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}},mL=class{constructor(r,n){this._context=r,this._compilerObject=n}get compilerObject(){return this._compilerObject}getEmitSkipped(){return this.compilerObject.emitSkipped}getOutputFiles(){return this.compilerObject.outputFiles.map(r=>new j6(this._context,r))}};co([b.Memoize],mL.prototype,"getOutputFiles",null);var jT=class{constructor(r,n){this._context=r,this._compilerObject=n,this.getDiagnostics()}get compilerObject(){return this._compilerObject}getEmitSkipped(){return this.compilerObject.emitSkipped}getDiagnostics(){return this.compilerObject.diagnostics.map(r=>this._context.compilerFactory.getDiagnostic(r))}};co([b.Memoize],jT.prototype,"getDiagnostics",null);var _L=class extends pv{constructor(r,n){super(r,n)}getKind(){return this.compilerObject.kind}getDisplayParts(){return this.compilerObject.displayParts.map(r=>this._context.compilerFactory.getSymbolDisplayPart(r))}};co([b.Memoize],_L.prototype,"getDisplayParts",null);var H6=class extends jT{constructor(r,n,i){super(r,n),this._files=i}getFiles(){return this._files}saveFiles(){let r=this._context.fileSystemWrapper,n=this._files.map(i=>r.writeFile(i.filePath,i.writeByteOrderMark?"\uFEFF"+i.text:i.text));return Promise.all(n)}saveFilesSync(){let r=this._context.fileSystemWrapper;for(let n of this._files)r.writeFileSync(n.filePath,n.writeByteOrderMark?"\uFEFF"+n.text:n.text)}},gL=class{constructor(r,n){this._context=r,this._compilerObject=n}get compilerObject(){return this._compilerObject}getEdits(){return this.compilerObject.edits.map(r=>new pS(this._context,r))}getRenameFilePath(){return this.compilerObject.renameFilename}getRenameLocation(){return this.compilerObject.renameLocation}applyChanges(r){for(let n of this.getEdits())n.applyChanges(r);return this}};co([b.Memoize],gL.prototype,"getEdits",null);var yL=class{constructor(r,n){this._context=r,this._compilerObject=n,this._references=this.compilerObject.references.map(i=>r.compilerFactory.getReferencedSymbolEntry(i))}get compilerObject(){return this._compilerObject}getDefinition(){return this._context.compilerFactory.getReferencedSymbolDefinitionInfo(this.compilerObject.definition)}getReferences(){return this._references}};co([b.Memoize],yL.prototype,"getDefinition",null);var vL=class extends VD{constructor(r,n){super(r,n)}getDisplayParts(){return this.compilerObject.displayParts.map(r=>this._context.compilerFactory.getSymbolDisplayPart(r))}};co([b.Memoize],vL.prototype,"getDisplayParts",null);var q6=class extends pv{constructor(r,n){super(r,n)}isWriteAccess(){return this.compilerObject.isWriteAccess}isInString(){return this.compilerObject.isInString}},J6=class extends q6{constructor(r,n){super(r,n)}isDefinition(){return this.compilerObject.isDefinition}},z6=class extends pv{getPrefixText(){return this._compilerObject.prefixText}getSuffixText(){return this._compilerObject.suffixText}},$6=class{constructor(r){this._compilerObject=r}get compilerObject(){return this._compilerObject}getText(){return this.compilerObject.text}getKind(){return this.compilerObject.kind}},hL=class{constructor(r){this._context=r}get compilerObject(){return this._getCompilerObject()}_reset(r){this._getCompilerObject=r}getAmbientModules(){return this.compilerObject.getAmbientModules().map(r=>this._context.compilerFactory.getSymbol(r))}getApparentType(r){return this._context.compilerFactory.getType(this.compilerObject.getApparentType(r.compilerType))}getConstantValue(r){return this.compilerObject.getConstantValue(r.compilerNode)}getFullyQualifiedName(r){return this.compilerObject.getFullyQualifiedName(r.compilerSymbol)}getTypeAtLocation(r){return this._context.compilerFactory.getType(this.compilerObject.getTypeAtLocation(r.compilerNode))}getContextualType(r){let n=this.compilerObject.getContextualType(r.compilerNode);return n==null?void 0:this._context.compilerFactory.getType(n)}getTypeOfSymbolAtLocation(r,n){return this._context.compilerFactory.getType(this.compilerObject.getTypeOfSymbolAtLocation(r.compilerSymbol,n.compilerNode))}getDeclaredTypeOfSymbol(r){return this._context.compilerFactory.getType(this.compilerObject.getDeclaredTypeOfSymbol(r.compilerSymbol))}getSymbolAtLocation(r){let n=this.compilerObject.getSymbolAtLocation(r.compilerNode);return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getAliasedSymbol(r){if(!r.hasFlags(b.SymbolFlags.Alias))return;let n=this.compilerObject.getAliasedSymbol(r.compilerSymbol);return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getImmediatelyAliasedSymbol(r){let n=this.compilerObject.getImmediateAliasedSymbol(r.compilerSymbol);return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getExportSymbolOfSymbol(r){return this._context.compilerFactory.getSymbol(this.compilerObject.getExportSymbolOfSymbol(r.compilerSymbol))}getPropertiesOfType(r){return this.compilerObject.getPropertiesOfType(r.compilerType).map(n=>this._context.compilerFactory.getSymbol(n))}getTypeText(r,n,i){return i==null&&(i=this._getDefaultTypeFormatFlags(n)),this.compilerObject.typeToString(r.compilerType,n?.compilerNode,i)}getReturnTypeOfSignature(r){return this._context.compilerFactory.getType(this.compilerObject.getReturnTypeOfSignature(r.compilerSignature))}getSignatureFromNode(r){let n=this.compilerObject.getSignatureFromDeclaration(r.compilerNode);return n==null?void 0:this._context.compilerFactory.getSignature(n)}getExportsOfModule(r){return(this.compilerObject.getExportsOfModule(r.compilerSymbol)||[]).map(i=>this._context.compilerFactory.getSymbol(i))}getExportSpecifierLocalTargetSymbol(r){let n=this.compilerObject.getExportSpecifierLocalTargetSymbol(r.compilerNode);return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getResolvedSignature(r){let n=this.compilerObject.getResolvedSignature(r.compilerNode);if(!(!n||!n.declaration))return this._context.compilerFactory.getSignature(n)}getResolvedSignatureOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getResolvedSignature(r),"Signature could not be resolved.")}getBaseTypeOfLiteralType(r){return this._context.compilerFactory.getType(this.compilerObject.getBaseTypeOfLiteralType(r.compilerType))}getSymbolsInScope(r,n){return this.compilerObject.getSymbolsInScope(r.compilerNode,n).map(i=>this._context.compilerFactory.getSymbol(i))}getTypeArguments(r){return this.compilerObject.getTypeArguments(r.compilerType).map(n=>this._context.compilerFactory.getType(n))}_getDefaultTypeFormatFlags(r){let n=b.TypeFormatFlags.UseTypeOfFunction|b.TypeFormatFlags.NoTruncation|b.TypeFormatFlags.UseFullyQualifiedType|b.TypeFormatFlags.WriteTypeArgumentsOfSignature;return r!=null&&r.getKind()===b.SyntaxKind.TypeAliasDeclaration&&(n|=b.TypeFormatFlags.InTypeAlias),n}},X6=class{constructor(r){this._context=r.context,this._configFileParsingDiagnostics=r.configFileParsingDiagnostics,this._typeChecker=new hL(this._context),this._reset(r.rootNames,r.host)}get compilerObject(){return this._getOrCreateCompilerObject()}_isCompilerProgramCreated(){return this._createdCompilerObject!=null}_reset(r,n){let i=this._context.compilerOptions.get();this._getOrCreateCompilerObject=()=>(this._createdCompilerObject==null&&(this._createdCompilerObject=b.ts.createProgram(r,i,n,this._oldProgram,this._configFileParsingDiagnostics),delete this._oldProgram),this._createdCompilerObject),this._createdCompilerObject!=null&&(this._oldProgram=this._createdCompilerObject,delete this._createdCompilerObject),this._typeChecker._reset(()=>this.compilerObject.getTypeChecker())}getTypeChecker(){return this._typeChecker}async emit(r={}){if(r.writeFile){let s=`Cannot specify a ${b.nameof(r,"writeFile")} option when emitting asynchrously. Use ${b.nameof(this,"emitSync")}() instead.`;throw new b.errors.InvalidOperationError(s)}let{fileSystemWrapper:n}=this._context,i=[],a=this._emit({writeFile:(s,u,p)=>{i.push(n.writeFile(n.getStandardizedAbsolutePath(s),p?"\uFEFF"+u:u))},...r});return await Promise.all(i),new jT(this._context,a)}emitSync(r={}){return new jT(this._context,this._emit(r))}emitToMemory(r={}){let n=[],{fileSystemWrapper:i}=this._context,a=this._emit({writeFile:(s,u,p)=>{n.push({filePath:i.getStandardizedAbsolutePath(s),text:u,writeByteOrderMark:p||!1})},...r});return new H6(this._context,a,n)}_emit(r={}){let n=r.targetSourceFile!=null?r.targetSourceFile.compilerNode:void 0,{emitOnlyDtsFiles:i,customTransformers:a,writeFile:s}=r,u=void 0;return this.compilerObject.emit(n,s,u,i,a)}getSyntacticDiagnostics(r){return this.compilerObject.getSyntacticDiagnostics(r?.compilerNode).map(i=>this._context.compilerFactory.getDiagnosticWithLocation(i))}getSemanticDiagnostics(r){return this.compilerObject.getSemanticDiagnostics(r?.compilerNode).map(i=>this._context.compilerFactory.getDiagnostic(i))}getDeclarationDiagnostics(r){return this.compilerObject.getDeclarationDiagnostics(r?.compilerNode).map(i=>this._context.compilerFactory.getDiagnosticWithLocation(i))}getGlobalDiagnostics(){return this.compilerObject.getGlobalDiagnostics().map(n=>this._context.compilerFactory.getDiagnostic(n))}getConfigFileParsingDiagnostics(){return this.compilerObject.getConfigFileParsingDiagnostics().map(n=>this._context.compilerFactory.getDiagnostic(n))}getEmitModuleResolutionKind(){return b.getEmitModuleResolutionKind(this.compilerObject.getCompilerOptions())}isSourceFileFromExternalLibrary(r){return r.isFromExternalLibrary()}},Y6=class{constructor(r){var n;this._projectVersion=0,this._context=r.context;let{languageServiceHost:i,compilerHost:a}=b.createHosts({transactionalFileSystem:this._context.fileSystemWrapper,sourceFileContainer:this._context.getSourceFileContainer(),compilerOptions:this._context.compilerOptions,getNewLine:()=>this._context.manipulationSettings.getNewLineKindAsString(),getProjectVersion:()=>`${this._projectVersion}`,resolutionHost:(n=r.resolutionHost)!==null&&n!==void 0?n:{},libFolderPath:r.libFolderPath,skipLoadingLibFiles:r.skipLoadingLibFiles});this._compilerHost=a,this._compilerObject=b.ts.createLanguageService(i,this._context.compilerFactory.documentRegistry),this._program=new X6({context:this._context,rootNames:Array.from(this._context.compilerFactory.getSourceFilePaths()),host:this._compilerHost,configFileParsingDiagnostics:r.configFileParsingDiagnostics}),this._context.compilerFactory.onSourceFileAdded(s=>{s._isInProject()&&this._reset()}),this._context.compilerFactory.onSourceFileRemoved(()=>this._reset())}get compilerObject(){return this._compilerObject}_reset(){this._projectVersion+=1,this._program._reset(Array.from(this._context.compilerFactory.getSourceFilePaths()),this._compilerHost)}getProgram(){return this._program}getDefinitions(r){return this.getDefinitionsAtPosition(r._sourceFile,r.getStart())}getDefinitionsAtPosition(r,n){return(this.compilerObject.getDefinitionAtPosition(r.getFilePath(),n)||[]).map(a=>this._context.compilerFactory.getDefinitionInfo(a))}getImplementations(r){return this.getImplementationsAtPosition(r._sourceFile,r.getStart())}getImplementationsAtPosition(r,n){return(this.compilerObject.getImplementationAtPosition(r.getFilePath(),n)||[]).map(a=>new _L(this._context,a))}findReferences(r){return this.findReferencesAtPosition(r._sourceFile,r.getStart())}findReferencesAsNodes(r){let n=this.findReferences(r);return Array.from(i());function*i(){for(let a of n){let s=a.getDefinition().getKind()===b.ts.ScriptElementKind.alias,u=a.getReferences();for(let p=0;p<u.length;p++){let f=u[p];(s||!f.isDefinition()||p>0)&&(yield f.getNode())}}}}findReferencesAtPosition(r,n){return(this.compilerObject.findReferences(r.getFilePath(),n)||[]).map(a=>this._context.compilerFactory.getReferencedSymbol(a))}findRenameLocations(r,n={}){let i=n.usePrefixAndSuffixText==null?this._context.manipulationSettings.getUsePrefixAndSuffixTextForRename():n.usePrefixAndSuffixText;return(this.compilerObject.findRenameLocations(r._sourceFile.getFilePath(),r.getStart(),n.renameInStrings||!1,n.renameInComments||!1,i)||[]).map(s=>new z6(this._context,s))}getSuggestionDiagnostics(r){let n=this._getFilePathFromFilePathOrSourceFile(r);return this.compilerObject.getSuggestionDiagnostics(n).map(a=>this._context.compilerFactory.getDiagnosticWithLocation(a))}getFormattingEditsForRange(r,n,i){return(this.compilerObject.getFormattingEditsForRange(r,n[0],n[1],this._getFilledSettings(i))||[]).map(a=>new FE(a))}getFormattingEditsForDocument(r,n){let i=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r);return(this.compilerObject.getFormattingEditsForDocument(i,this._getFilledSettings(n))||[]).map(a=>new FE(a))}getFormattedDocumentText(r,n){let i=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),a=this._context.compilerFactory.getSourceFileFromCacheFromFilePath(i);if(a==null)throw new b.errors.FileNotFoundError(i);n=this._getFilledSettings(n);let s=this.getFormattingEditsForDocument(i,n),u=ZH(a,s),p=n.newLineCharacter;return n.ensureNewLineAtEndOfFile&&!u.endsWith(p)&&(u+=p),u.replace(/\r?\n/g,p)}getEmitOutput(r,n){let i=this._getFilePathFromFilePathOrSourceFile(r),a=this.compilerObject;return new mL(this._context,s());function s(){let u=a.getProgram();return u==null||u.getSourceFile(i)==null?{emitSkipped:!0,outputFiles:[]}:a.getEmitOutput(i,n)}}getIdentationAtPosition(r,n,i){let a=this._getFilePathFromFilePathOrSourceFile(r);return i==null?i=this._context.manipulationSettings.getEditorSettings():QH(i,this._context.manipulationSettings),this.compilerObject.getIndentationAtPosition(a,n,i)}organizeImports(r,n={},i={}){let a={type:"file",fileName:this._getFilePathFromFilePathOrSourceFile(r)};return this.compilerObject.organizeImports(a,this._getFilledSettings(n),this._getFilledUserPreferences(i)).map(s=>new pS(this._context,s))}getEditsForRefactor(r,n,i,a,s,u={}){let p=this._getFilePathFromFilePathOrSourceFile(r),f=typeof i=="number"?i:{pos:i.getPos(),end:i.getEnd()},m=this.compilerObject.getEditsForRefactor(p,this._getFilledSettings(n),f,a,s,this._getFilledUserPreferences(u));return m!=null?new gL(this._context,m):void 0}getCombinedCodeFix(r,n,i={},a={}){let s=this.compilerObject.getCombinedCodeFix({type:"file",fileName:this._getFilePathFromFilePathOrSourceFile(r)},n,this._getFilledSettings(i),this._getFilledUserPreferences(a||{}));return new fL(this._context,s)}getCodeFixesAtPosition(r,n,i,a,s={},u={}){let p=this._getFilePathFromFilePathOrSourceFile(r);return this.compilerObject.getCodeFixesAtPosition(p,n,i,a,this._getFilledSettings(s),this._getFilledUserPreferences(u||{})).map(m=>new V6(this._context,m))}_getFilePathFromFilePathOrSourceFile(r){let n=typeof r=="string"?this._context.fileSystemWrapper.getStandardizedAbsolutePath(r):r.getFilePath();if(!this._context.compilerFactory.containsSourceFileAtPath(n))throw new b.errors.FileNotFoundError(n);return n}_getFilledSettings(r){return r._filled||(r=Object.assign(this._context.getFormatCodeSettings(),r),L7e(r,this._context.manipulationSettings),r._filled=!0),r}_getFilledUserPreferences(r){return Object.assign(this._context.getUserPreferences(),r)}},EL=class{constructor(r,n){this._context=r,this._compilerType=n}get compilerType(){return this._compilerType}getText(r,n){return this._context.typeChecker.getTypeText(this,r,n)}getAliasSymbol(){return this.compilerType.aliasSymbol==null?void 0:this._context.compilerFactory.getSymbol(this.compilerType.aliasSymbol)}getAliasSymbolOrThrow(){return b.errors.throwIfNullOrUndefined(this.getAliasSymbol(),"Expected to find an alias symbol.")}getAliasTypeArguments(){return(this.compilerType.aliasTypeArguments||[]).map(n=>this._context.compilerFactory.getType(n))}getApparentType(){return this._context.typeChecker.getApparentType(this)}getArrayElementTypeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getArrayElementType(),"Expected to find an array element type.")}getArrayElementType(){if(!!this.isArray())return this.getTypeArguments()[0]}getBaseTypes(){return(this.compilerType.getBaseTypes()||[]).map(n=>this._context.compilerFactory.getType(n))}getBaseTypeOfLiteralType(){return this._context.typeChecker.getBaseTypeOfLiteralType(this)}getCallSignatures(){return this.compilerType.getCallSignatures().map(r=>this._context.compilerFactory.getSignature(r))}getConstructSignatures(){return this.compilerType.getConstructSignatures().map(r=>this._context.compilerFactory.getSignature(r))}getConstraintOrThrow(){return b.errors.throwIfNullOrUndefined(this.getConstraint(),"Expected to find a constraint.")}getConstraint(){let r=this.compilerType.getConstraint();return r==null?void 0:this._context.compilerFactory.getType(r)}getDefaultOrThrow(){return b.errors.throwIfNullOrUndefined(this.getDefault(),"Expected to find a default type.")}getDefault(){let r=this.compilerType.getDefault();return r==null?void 0:this._context.compilerFactory.getType(r)}getProperties(){return this.compilerType.getProperties().map(r=>this._context.compilerFactory.getSymbol(r))}getPropertyOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getProperty(r),()=>Ou("symbol property",r))}getProperty(r){return Ffe(this.getProperties(),r)}getApparentProperties(){return this.compilerType.getApparentProperties().map(r=>this._context.compilerFactory.getSymbol(r))}getApparentProperty(r){return Ffe(this.getApparentProperties(),r)}isNullable(){return this.getUnionTypes().some(r=>r.isNull()||r.isUndefined())}getNonNullableType(){return this._context.compilerFactory.getType(this.compilerType.getNonNullableType())}getNumberIndexType(){let r=this.compilerType.getNumberIndexType();return r==null?void 0:this._context.compilerFactory.getType(r)}getStringIndexType(){let r=this.compilerType.getStringIndexType();return r==null?void 0:this._context.compilerFactory.getType(r)}getTargetType(){let r=this.compilerType.target||void 0;return r==null?void 0:this._context.compilerFactory.getType(r)}getTargetTypeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getTargetType(),"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(r=>this._context.compilerFactory.getType(r)):[]}getIntersectionTypes(){return this.isIntersection()?this.compilerType.types.map(r=>this._context.compilerFactory.getType(r)):[]}getLiteralValue(){var r;return(r=this.compilerType)===null||r===void 0?void 0:r.value}getLiteralValueOrThrow(){return b.errors.throwIfNullOrUndefined(this.getLiteralValue(),"Type was not a literal type.")}getLiteralFreshType(){var r;let n=(r=this.compilerType)===null||r===void 0?void 0:r.freshType;return n==null?void 0:this._context.compilerFactory.getType(n)}getLiteralFreshTypeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getLiteralFreshType(),"Type was not a literal type.")}getLiteralRegularType(){var r;let n=(r=this.compilerType)===null||r===void 0?void 0:r.regularType;return n==null?void 0:this._context.compilerFactory.getType(n)}getLiteralRegularTypeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getLiteralRegularType(),"Type was not a literal type.")}getSymbol(){let r=this.compilerType.getSymbol();return r==null?void 0:this._context.compilerFactory.getSymbol(r)}getSymbolOrThrow(){return b.errors.throwIfNullOrUndefined(this.getSymbol(),"Expected to find a symbol.")}isAnonymous(){return this._hasObjectFlag(b.ObjectFlags.Anonymous)}isAny(){return this._hasTypeFlag(b.TypeFlags.Any)}isNever(){return this._hasTypeFlag(b.TypeFlags.Never)}isArray(){let r=this.getSymbol();return r==null?!1:(r.getName()==="Array"||r.getName()==="ReadonlyArray")&&this.getTypeArguments().length===1}isReadonlyArray(){let r=this.getSymbol();return r==null?!1:r.getName()==="ReadonlyArray"&&this.getTypeArguments().length===1}isTemplateLiteral(){return this._hasTypeFlag(b.TypeFlags.TemplateLiteral)}isBoolean(){return this._hasTypeFlag(b.TypeFlags.Boolean)}isString(){return this._hasTypeFlag(b.TypeFlags.String)}isNumber(){return this._hasTypeFlag(b.TypeFlags.Number)}isLiteral(){let r=this.isBooleanLiteral();return this.compilerType.isLiteral()||r}isBooleanLiteral(){return this._hasTypeFlag(b.TypeFlags.BooleanLiteral)}isEnumLiteral(){return this._hasTypeFlag(b.TypeFlags.EnumLiteral)&&!this.isUnion()}isNumberLiteral(){return this._hasTypeFlag(b.TypeFlags.NumberLiteral)}isStringLiteral(){return this.compilerType.isStringLiteral()}isClass(){return this.compilerType.isClass()}isClassOrInterface(){return this.compilerType.isClassOrInterface()}isEnum(){if(this._hasTypeFlag(b.TypeFlags.Enum))return!0;if(this.isEnumLiteral()&&!this.isUnion())return!1;let n=this.getSymbol();if(n==null)return!1;let i=n.getValueDeclaration();return i!=null&&Tr.isEnumDeclaration(i)}isInterface(){return this._hasObjectFlag(b.ObjectFlags.Interface)}isObject(){return this._hasTypeFlag(b.TypeFlags.Object)}isTypeParameter(){return this.compilerType.isTypeParameter()}isTuple(){let r=this.getTargetType();return r==null?!1:r._hasObjectFlag(b.ObjectFlags.Tuple)}isUnion(){return this.compilerType.isUnion()}isIntersection(){return this.compilerType.isIntersection()}isUnionOrIntersection(){return this.compilerType.isUnionOrIntersection()}isUnknown(){return this._hasTypeFlag(b.TypeFlags.Unknown)}isNull(){return this._hasTypeFlag(b.TypeFlags.Null)}isUndefined(){return this._hasTypeFlag(b.TypeFlags.Undefined)}getFlags(){return this.compilerType.flags}getObjectFlags(){return this.isObject()&&this.compilerType.objectFlags||0}_hasTypeFlag(r){return(this.compilerType.flags&r)===r}_hasObjectFlag(r){return(this.getObjectFlags()&r)===r}},Q6=class extends EL{getConstraintOrThrow(){return b.errors.throwIfNullOrUndefined(this.getConstraint(),"Expected type parameter to have a constraint.")}getConstraint(){let r=this._getTypeParameterDeclaration();if(r==null)return;let n=r.getConstraint();if(n!=null)return this._context.typeChecker.getTypeAtLocation(n)}getDefaultOrThrow(){return b.errors.throwIfNullOrUndefined(this.getDefault(),"Expected type parameter to have a default type.")}getDefault(){let r=this._getTypeParameterDeclaration();if(r==null)return;let n=r.getDefault();if(n!=null)return this._context.typeChecker.getTypeAtLocation(n)}_getTypeParameterDeclaration(){let r=this.getSymbol();if(r==null)return;let n=r.getDeclarations()[0];if(n!=null&&!!Tr.isTypeParameterDeclaration(n))return n}},bL=class{constructor(r,n){this._skippedFilePaths=r,this._outputFilePaths=n}getSkippedFilePaths(){return this._skippedFilePaths}getOutputFilePaths(){return this._outputFilePaths}},OE=class{constructor(r,n){this.__context=r,this._setPathInternal(n)}_setPathInternal(r){this._path=r,this._pathParts=r.split("/").filter(n=>n.length>0)}get _context(){return this._throwIfDeletedOrRemoved(),this.__context}isAncestorOf(r){return OE._isAncestorOfDir(this,r)}isDescendantOf(r){return OE._isAncestorOfDir(r,this)}_getDepth(){return this._pathParts.length}getPath(){return this._throwIfDeletedOrRemoved(),this._path}getBaseName(){return this._pathParts[this._pathParts.length-1]}getParentOrThrow(){return b.errors.throwIfNullOrUndefined(this.getParent(),()=>`Parent directory of ${this.getPath()} does not exist or was never added.`)}getParent(){if(!b.FileUtils.isRootDirPath(this.getPath()))return this.addDirectoryAtPathIfExists(b.FileUtils.getDirPath(this.getPath()))}getDirectoryOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getDirectory(r),()=>typeof r=="string"?`Could not find a directory at path '${this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath())}'.`:"Could not find child directory that matched condition.")}getDirectory(r){if(typeof r=="string"){let n=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.compilerFactory.getDirectoryFromCache(n)}return this.getDirectories().find(r)}getSourceFileOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getSourceFile(r),()=>typeof r=="string"?`Could not find child source file at path '${this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath())}'.`:"Could not find child source file that matched condition.")}getSourceFile(r){if(typeof r=="string"){let n=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.compilerFactory.getSourceFileFromCacheFromFilePath(n)}for(let n of this._getSourceFilesIterator())if(r(n))return n}getDirectories(){return Array.from(this._getDirectoriesIterator())}_getDirectoriesIterator(){return this._context.compilerFactory.getChildDirectoriesOfDirectory(this.getPath())}getSourceFiles(r){let{compilerFactory:n,fileSystemWrapper:i}=this._context,a=this;if(typeof r=="string"||r instanceof Array){let u=typeof r=="string"?[r]:r;return Array.from(s(u))}else return Array.from(this._getSourceFilesIterator());function*s(u){let p=Array.from(m()),f=b.matchGlobs(p,u,a.getPath());for(let g of f)yield n.getSourceFileFromCacheFromFilePath(i.getStandardizedAbsolutePath(g));function*m(){for(let g of a._getDescendantSourceFilesIterator())yield g.getFilePath()}}}_getSourceFilesIterator(){return this._context.compilerFactory.getChildSourceFilesOfDirectory(this.getPath())}getDescendantSourceFiles(){return Array.from(this._getDescendantSourceFilesIterator())}*_getDescendantSourceFilesIterator(){for(let r of this._getSourceFilesIterator())yield r;for(let r of this._getDirectoriesIterator())yield*r._getDescendantSourceFilesIterator()}getDescendantDirectories(){return Array.from(this._getDescendantDirectoriesIterator())}*_getDescendantDirectoriesIterator(){for(let r of this.getDirectories())yield r,yield*r._getDescendantDirectoriesIterator()}addSourceFilesAtPaths(r){return r=typeof r=="string"?[r]:r,r=r.map(n=>b.FileUtils.pathIsAbsolute(n)?n:b.FileUtils.pathJoin(this.getPath(),n)),this._context.directoryCoordinator.addSourceFilesAtPaths(r,{markInProject:this._isInProject()})}addDirectoryAtPathIfExists(r,n={}){let i=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.directoryCoordinator.addDirectoryAtPathIfExists(i,{...n,markInProject:this._isInProject()})}addDirectoryAtPath(r,n={}){let i=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.directoryCoordinator.addDirectoryAtPath(i,{...n,markInProject:this._isInProject()})}createDirectory(r){let n=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.directoryCoordinator.createDirectoryOrAddIfExists(n,{markInProject:this._isInProject()})}createSourceFile(r,n,i){let a=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.compilerFactory.createSourceFile(a,n||"",{...i||{},markInProject:this._isInProject()})}addSourceFileAtPathIfExists(r){let n=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.directoryCoordinator.addSourceFileAtPathIfExists(n,{markInProject:this._isInProject()})}addSourceFileAtPath(r){let n=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.directoryCoordinator.addSourceFileAtPath(n,{markInProject:this._isInProject()})}async emit(r={}){let{fileSystemWrapper:n}=this._context,i=[],a=[],s=[];for(let u of this._emitInternal(r))mpe(u)?s.push(u):(i.push(n.writeFile(u.filePath,u.fileText)),a.push(u.filePath));return await Promise.all(i),new bL(s,a)}emitSync(r={}){let{fileSystemWrapper:n}=this._context,i=[],a=[];for(let s of this._emitInternal(r))mpe(s)?a.push(s):(n.writeFileSync(s.filePath,s.fileText),i.push(s.filePath));return new bL(a,i)}_emitInternal(r={}){let{emitOnlyDtsFiles:n=!1}=r,i=r.outDir==null?void 0:/\.js$/i,a=r.outDir==null?void 0:/\.js\.map$/i,s=r.declarationDir==null&&r.outDir==null?void 0:/\.d\.ts$/i,u=g=>g==null?void 0:this._context.fileSystemWrapper.getStandardizedAbsolutePath(g,this.getPath()),p=(g,D)=>g==null?void 0:b.FileUtils.pathJoin(g,D.getBaseName()),f=this._context.compilerOptions.get().declarationDir!=null||r.declarationDir!=null;return m(this,u(r.outDir),u(r.declarationDir));function*m(g,D,P){for(let B of g.getSourceFiles()){let K=B.getEmitOutput({emitOnlyDtsFiles:n});if(K.getEmitSkipped()){yield B.getFilePath();continue}for(let h of K.getOutputFiles()){let S=h.getFilePath(),U=h.getWriteByteOrderMark()?b.FileUtils.getTextWithByteOrderMark(h.getText()):h.getText();D!=null&&(i.test(S)||a.test(S)||!f&&s.test(S))?S=b.FileUtils.pathJoin(D,b.FileUtils.getBaseName(S)):P!=null&&s.test(S)&&(S=b.FileUtils.pathJoin(P,b.FileUtils.getBaseName(S))),yield{filePath:S,fileText:U}}}for(let B of g.getDirectories())yield*m(B,p(D,B),p(P,B))}}copyToDirectory(r,n){let i=typeof r=="string"?r:r.getPath();return this.copy(b.FileUtils.pathJoin(i,this.getBaseName()),n)}copy(r,n){let i=this.getPath(),a=this._context.fileSystemWrapper,s=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return i===s?this:(n=_j(n),n.includeUntrackedFiles&&a.queueCopyDirectory(i,s),this._copyInternal(s,n))}async copyImmediately(r,n){let i=this._context.fileSystemWrapper,a=this.getPath(),s=i.getStandardizedAbsolutePath(r,a);if(a===s)return await this.save(),this;n=_j(n);let u=this._copyInternal(s,n);return n.includeUntrackedFiles&&await i.copyDirectoryImmediately(a,s),await u.save(),u}copyImmediatelySync(r,n){let i=this._context.fileSystemWrapper,a=this.getPath(),s=i.getStandardizedAbsolutePath(r,a);if(a===s)return this.saveSync(),this;n=_j(n);let u=this._copyInternal(s,n);return n.includeUntrackedFiles&&i.copyDirectoryImmediatelySync(a,s),u.saveSync(),u}_copyInternal(r,n){if(this.getPath()===r)return this;let{fileSystemWrapper:a,compilerFactory:s}=this._context,u=[this,...this.getDescendantDirectories()].map(f=>({newDirPath:f===this?r:a.getStandardizedAbsolutePath(this.getRelativePathTo(f),r)})),p=this.getDescendantSourceFiles().map(f=>({sourceFile:f,newFilePath:a.getStandardizedAbsolutePath(this.getRelativePathTo(f),r),references:this._getReferencesForCopy(f)}));for(let{newDirPath:f}of u)this._context.compilerFactory.createDirectoryOrAddIfExists(f,{markInProject:this._isInProject()});for(let{sourceFile:f,newFilePath:m}of p)f._copyInternal(m,n);for(let{references:f,newFilePath:m}of p)this.getSourceFileOrThrow(m)._updateReferencesForCopyInternal(f);return s.getDirectoryFromCache(r)}moveToDirectory(r,n){let i=typeof r=="string"?r:r.getPath();return this.move(b.FileUtils.pathJoin(i,this.getBaseName()),n)}move(r,n){let i=this._context.fileSystemWrapper,a=this.getPath(),s=i.getStandardizedAbsolutePath(r,a);return a===s?this:this._moveInternal(s,n,()=>i.queueMoveDirectory(a,s))}async moveImmediately(r,n){let i=this._context.fileSystemWrapper,a=this.getPath(),s=i.getStandardizedAbsolutePath(r,a);return a===s?(await this.save(),this):(this._moveInternal(s,n),await i.moveDirectoryImmediately(a,s),await this.save(),this)}moveImmediatelySync(r,n){let i=this._context.fileSystemWrapper,a=this.getPath(),s=i.getStandardizedAbsolutePath(r,a);return a===s?(this.saveSync(),this):(this._moveInternal(s,n),i.moveDirectoryImmediatelySync(a,s),this.saveSync(),this)}_moveInternal(r,n,i){let a=this.getPath();if(a===r)return this;let s=this._context.compilerFactory.getDirectoryFromCacheOnlyIfInCache(r),u=s!=null&&s._isInProject();i&&i();let p=this._context.fileSystemWrapper,f=this._context.compilerFactory,m=[this,...this.getDescendantDirectories()].map(D=>({directory:D,oldPath:D.getPath(),newDirPath:D===this?r:p.getStandardizedAbsolutePath(this.getRelativePathTo(D),r)})),g=this.getDescendantSourceFiles().map(D=>({sourceFile:D,newFilePath:p.getStandardizedAbsolutePath(this.getRelativePathTo(D),r),references:this._getReferencesForMove(D)}));for(let{directory:D,oldPath:P,newDirPath:B}of m){f.removeDirectoryFromCache(P);let K=f.getDirectoryFromCache(B);K?._forgetOnlyThis(),D._setPathInternal(B),f.addDirectoryToCache(D)}for(let{sourceFile:D,newFilePath:P}of g)D._moveInternal(P,n);for(let{sourceFile:D,references:P}of g)D._updateReferencesForMoveInternal(P,a);return u&&this._markAsInProject(),this}clear(){let r=this.getPath();this._deleteDescendants(),this._context.fileSystemWrapper.queueDirectoryDelete(r),this._context.fileSystemWrapper.queueMkdir(r)}async clearImmediately(){let r=this.getPath();this._deleteDescendants(),await this._context.fileSystemWrapper.clearDirectoryImmediately(r)}clearImmediatelySync(){let r=this.getPath();this._deleteDescendants(),this._context.fileSystemWrapper.clearDirectoryImmediatelySync(r)}delete(){let r=this.getPath();this._deleteDescendants(),this._context.fileSystemWrapper.queueDirectoryDelete(r),this.forget()}_deleteDescendants(){for(let r of this.getSourceFiles())r.delete();for(let r of this.getDirectories())r.delete()}async deleteImmediately(){let{fileSystemWrapper:r}=this._context,n=this.getPath();this.forget(),await r.deleteDirectoryImmediately(n)}deleteImmediatelySync(){let{fileSystemWrapper:r}=this._context,n=this.getPath();this.forget(),r.deleteDirectoryImmediatelySync(n)}forget(){if(!this.wasForgotten()){for(let r of this.getSourceFiles())r.forget();for(let r of this.getDirectories())r.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 r=this.getDescendantSourceFiles().filter(n=>!n.isSaved());await Promise.all(r.map(n=>n.save()))}saveSync(){this._context.fileSystemWrapper.saveForDirectorySync(this.getPath()),this.getDescendantSourceFiles().filter(n=>!n.isSaved()).forEach(n=>n.saveSync())}getRelativePathTo(r){let n=this;return b.FileUtils.getRelativePathTo(this.getPath(),i());function i(){return r instanceof kE?r.getFilePath():r instanceof OE?r.getPath():n._context.fileSystemWrapper.getStandardizedAbsolutePath(r,n.getPath())}}getRelativePathAsModuleSpecifierTo(r){let n=this._context.program.getEmitModuleResolutionKind(),i=this,a=b.FileUtils.getRelativePathTo(this.getPath(),s()).replace(/((\.d\.ts$)|(\.[^/.]+$))/i,"");return a.startsWith("../")?a:"./"+a;function s(){return r instanceof kE?u(r):r instanceof OE?p(r):f(i._context.fileSystemWrapper.getStandardizedAbsolutePath(r,i.getPath()));function u(m){return f(m.getFilePath())}function p(m){switch(n){case b.ModuleResolutionKind.NodeJs:return m===i?b.FileUtils.pathJoin(m.getPath(),"index.ts"):m.getPath();case b.ModuleResolutionKind.Classic:case b.ModuleResolutionKind.Node16:case b.ModuleResolutionKind.NodeNext:return b.FileUtils.pathJoin(m.getPath(),"index.ts");default:return b.errors.throwNotImplementedForNeverValueError(n)}}function f(m){let g=b.FileUtils.getDirPath(m);switch(n){case b.ModuleResolutionKind.NodeJs:return g===i.getPath()?m:m.replace(/\/index?(\.d\.ts|\.ts|\.js)$/i,"");case b.ModuleResolutionKind.Classic:case b.ModuleResolutionKind.Node16:case b.ModuleResolutionKind.NodeNext:return m;default:return b.errors.throwNotImplementedForNeverValueError(n)}}}}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(b.FileUtils.getDirPath(this.getPath()))}_throwIfDeletedOrRemoved(){if(this.wasForgotten())throw new b.errors.InvalidOperationError("Cannot use a directory that was deleted, removed, or overwritten.")}_getReferencesForCopy(r){return r._getReferencesForCopyInternal().filter(i=>!this.isAncestorOf(i[1]))}_getReferencesForMove(r){let{literalReferences:n,referencingLiterals:i}=r._getReferencesForMoveInternal();return{literalReferences:n.filter(a=>!this.isAncestorOf(a[1])),referencingLiterals:i.filter(a=>!this.isAncestorOf(a._sourceFile))}}static _isAncestorOfDir(r,n){if(n instanceof kE&&(n=n.getDirectory(),r===n))return!0;if(r._pathParts.length>=n._pathParts.length)return!1;for(let i=r._pathParts.length-1;i>=0;i--)if(r._pathParts[i]!==n._pathParts[i])return!1;return!0}};function _j(e){return e=b.ObjectUtils.clone(e||{}),_u(e,"includeUntrackedFiles",!0),e}function mpe(e){return typeof e=="string"}var jH=class{constructor(r,n){this.compilerFactory=r,this.fileSystemWrapper=n}addDirectoryAtPathIfExists(r,n){let i=this.compilerFactory.getDirectoryFromPath(r,n);if(i!=null){if(n.recursive)for(let a of b.FileUtils.getDescendantDirectories(this.fileSystemWrapper,r))this.compilerFactory.createDirectoryOrAddIfExists(a,n);return i}}addDirectoryAtPath(r,n){let i=this.addDirectoryAtPathIfExists(r,n);if(i==null)throw new b.errors.DirectoryNotFoundError(r);return i}createDirectoryOrAddIfExists(r,n){return this.compilerFactory.createDirectoryOrAddIfExists(r,n)}addSourceFileAtPathIfExists(r,n){return this.compilerFactory.addOrGetSourceFileFromFilePath(r,{markInProject:n.markInProject,scriptKind:void 0})}addSourceFileAtPath(r,n){let i=this.addSourceFileAtPathIfExists(r,n);if(i==null)throw new b.errors.FileNotFoundError(this.fileSystemWrapper.getStandardizedAbsolutePath(r));return i}addSourceFilesAtPaths(r,n){typeof r=="string"&&(r=[r]);let i=[],a=new Set;for(let s of this.fileSystemWrapper.globSync(r)){let u=this.addSourceFileAtPathIfExists(s,n);u!=null&&i.push(u),a.add(b.FileUtils.getDirPath(s))}for(let s of b.FileUtils.getParentMostPaths(Array.from(a)))this.addDirectoryAtPathIfExists(s,{recursive:!0,markInProject:n.markInProject});return i}},HH=class{constructor(r){this.context=r,this.directoriesByPath=new b.KeyValueCache,this.sourceFilesByDirPath=new b.KeyValueCache,this.directoriesByDirPath=new b.KeyValueCache,this.orphanDirs=new b.KeyValueCache}has(r){return this.directoriesByPath.has(r)}get(r){if(!this.directoriesByPath.has(r)){for(let n of this.orphanDirs.getValues())if(b.FileUtils.pathStartsWith(n.getPath(),r))return this.createOrAddIfExists(r);return}return this.directoriesByPath.get(r)}getOrphans(){return this.orphanDirs.getValues()}getAll(){return this.directoriesByPath.getValuesAsArray()}*getAllByDepth(){let r=new b.KeyValueCache,n=0;for(let a of this.getOrphans())i(a);for(n=Math.min(...Array.from(r.getKeys()));r.getSize()>0;){for(let a of r.get(n)||[])yield a,a.getDirectories().forEach(i);r.removeByKey(n),n++}function i(a){let s=a._getDepth();if(n>s)throw new Error(`For some reason a subdirectory had a lower depth than the parent directory: ${a.getPath()}`);r.getOrCreate(s,()=>[]).push(a)}}remove(r){this.removeFromDirectoriesByDirPath(r),this.directoriesByPath.removeByKey(r),this.orphanDirs.removeByKey(r)}*getChildDirectoriesOfDirectory(r){var n;let i=(n=this.directoriesByDirPath.get(r))===null||n===void 0?void 0:n.entries();if(i!=null)for(let a of i)yield a}*getChildSourceFilesOfDirectory(r){var n;let i=(n=this.sourceFilesByDirPath.get(r))===null||n===void 0?void 0:n.entries();if(i!=null)for(let a of i)yield a}addSourceFile(r){let n=r.getDirectoryPath();this.createOrAddIfExists(n),this.sourceFilesByDirPath.getOrCreate(n,()=>new b.SortedKeyValueArray(a=>a.getBaseName(),b.LocaleStringComparer.instance)).set(r)}removeSourceFile(r){let n=b.FileUtils.getDirPath(r),i=this.sourceFilesByDirPath.get(n);i!=null&&(i.removeByKey(b.FileUtils.getBaseName(r)),i.hasItems()||this.sourceFilesByDirPath.removeByKey(n))}createOrAddIfExists(r){return this.has(r)?this.get(r):(this.fillParentsOfDirPath(r),this.createDirectory(r))}createDirectory(r){let n=new OE(this.context,r);return this.addDirectory(n),n}addDirectory(r){let n=r.getPath(),i=b.FileUtils.getDirPath(n),a=i===n;for(let s of this.orphanDirs.getValues()){let u=s.getPath(),p=b.FileUtils.getDirPath(u);!(p===u)&&p===n&&this.orphanDirs.removeByKey(u)}a||this.addToDirectoriesByDirPath(r),this.has(i)||this.orphanDirs.set(n,r),this.directoriesByPath.set(n,r),this.context.fileSystemWrapper.directoryExistsSync(n)||this.context.fileSystemWrapper.queueMkdir(n);for(let s of this.orphanDirs.getValues())r.isAncestorOf(s)&&this.fillParentsOfDirPath(s.getPath())}addToDirectoriesByDirPath(r){if(b.FileUtils.isRootDirPath(r.getPath()))return;let n=b.FileUtils.getDirPath(r.getPath());this.directoriesByDirPath.getOrCreate(n,()=>new b.SortedKeyValueArray(a=>a.getBaseName(),b.LocaleStringComparer.instance)).set(r)}removeFromDirectoriesByDirPath(r){if(b.FileUtils.isRootDirPath(r))return;let n=b.FileUtils.getDirPath(r),i=this.directoriesByDirPath.get(n);i!=null&&(i.removeByKey(b.FileUtils.getBaseName(r)),i.hasItems()||this.directoriesByDirPath.removeByKey(n))}fillParentsOfDirPath(r){let n=[],i=b.FileUtils.getDirPath(r);for(;r!==i;){if(r=i,i=b.FileUtils.getDirPath(r),this.directoriesByPath.has(r)){for(let a of n)this.createDirectory(a);break}n.unshift(r)}}},qH=class extends b.KeyValueCache{constructor(){super(...arguments),this.forgetStack=[]}getOrCreate(r,n){return super.getOrCreate(r,()=>{let i=n();return this.forgetStack.length>0&&this.forgetStack[this.forgetStack.length-1].add(i),i})}setForgetPoint(){this.forgetStack.push(new Set)}forgetLastPoint(){let r=this.forgetStack.pop();r!=null&&this.forgetNodes(r.values())}rememberNode(r){if(r.wasForgotten())throw new b.errors.InvalidOperationError("Cannot remember a node that was removed or forgotten.");let n=!1;for(let i of this.forgetStack)if(i.delete(r)){n=!0;break}return n&&this.rememberParentOfNode(r),n}rememberParentOfNode(r){let n=r.getParentSyntaxList()||r.getParent();n!=null&&this.rememberNode(n)}forgetNodes(r){for(let n of r)n.wasForgotten()||n.getKind()===b.SyntaxKind.SourceFile||n._forgetOnlyThis()}},ZUe={[b.SyntaxKind.SourceFile]:kE,[b.SyntaxKind.ArrayBindingPattern]:cM,[b.SyntaxKind.ArrayLiteralExpression]:mM,[b.SyntaxKind.ArrayType]:Vw,[b.SyntaxKind.ArrowFunction]:Nw,[b.SyntaxKind.AsExpression]:_M,[b.SyntaxKind.AssertClause]:cw,[b.SyntaxKind.AssertEntry]:dw,[b.SyntaxKind.AwaitExpression]:gM,[b.SyntaxKind.BigIntLiteral]:E6,[b.SyntaxKind.BindingElement]:dM,[b.SyntaxKind.BinaryExpression]:oL,[b.SyntaxKind.Block]:WM,[b.SyntaxKind.BreakStatement]:VM,[b.SyntaxKind.CallExpression]:yM,[b.SyntaxKind.CallSignature]:t6,[b.SyntaxKind.CaseBlock]:jM,[b.SyntaxKind.CaseClause]:HM,[b.SyntaxKind.CatchClause]:qM,[b.SyntaxKind.ClassDeclaration]:kw,[b.SyntaxKind.ClassExpression]:Rw,[b.SyntaxKind.ClassStaticBlockDeclaration]:Mw,[b.SyntaxKind.ConditionalType]:jw,[b.SyntaxKind.Constructor]:Fw,[b.SyntaxKind.ConstructorType]:Hw,[b.SyntaxKind.ConstructSignature]:i6,[b.SyntaxKind.ContinueStatement]:zM,[b.SyntaxKind.CommaListExpression]:vM,[b.SyntaxKind.ComputedPropertyName]:R6,[b.SyntaxKind.ConditionalExpression]:hM,[b.SyntaxKind.DebuggerStatement]:$M,[b.SyntaxKind.Decorator]:Kw,[b.SyntaxKind.DefaultClause]:XM,[b.SyntaxKind.DeleteExpression]:EM,[b.SyntaxKind.DoStatement]:YM,[b.SyntaxKind.ElementAccessExpression]:lL,[b.SyntaxKind.EmptyStatement]:QM,[b.SyntaxKind.EnumDeclaration]:ZF,[b.SyntaxKind.EnumMember]:e6,[b.SyntaxKind.ExportAssignment]:fw,[b.SyntaxKind.ExportDeclaration]:pw,[b.SyntaxKind.ExportSpecifier]:mw,[b.SyntaxKind.ExpressionWithTypeArguments]:qw,[b.SyntaxKind.ExpressionStatement]:ZM,[b.SyntaxKind.ExternalModuleReference]:_w,[b.SyntaxKind.QualifiedName]:F6,[b.SyntaxKind.ForInStatement]:ew,[b.SyntaxKind.ForOfStatement]:rw,[b.SyntaxKind.ForStatement]:tw,[b.SyntaxKind.FunctionDeclaration]:Iw,[b.SyntaxKind.FunctionExpression]:Pw,[b.SyntaxKind.FunctionType]:Jw,[b.SyntaxKind.GetAccessor]:Gw,[b.SyntaxKind.HeritageClause]:r6,[b.SyntaxKind.Identifier]:M6,[b.SyntaxKind.IfStatement]:nw,[b.SyntaxKind.ImportClause]:gw,[b.SyntaxKind.ImportDeclaration]:yw,[b.SyntaxKind.ImportEqualsDeclaration]:vw,[b.SyntaxKind.ImportSpecifier]:hw,[b.SyntaxKind.ImportType]:$w,[b.SyntaxKind.ImportTypeAssertionContainer]:zw,[b.SyntaxKind.IndexedAccessType]:Xw,[b.SyntaxKind.IndexSignature]:a6,[b.SyntaxKind.InferType]:Yw,[b.SyntaxKind.InterfaceDeclaration]:o6,[b.SyntaxKind.IntersectionType]:Qw,[b.SyntaxKind.JSDocAllType]:mF,[b.SyntaxKind.JSDocAugmentsTag]:_F,[b.SyntaxKind.JSDocAuthorTag]:gF,[b.SyntaxKind.JSDocCallbackTag]:yF,[b.SyntaxKind.JSDocClassTag]:vF,[b.SyntaxKind.JSDocDeprecatedTag]:hF,[b.SyntaxKind.JSDocEnumTag]:EF,[b.SyntaxKind.JSDocFunctionType]:bF,[b.SyntaxKind.JSDocImplementsTag]:SF,[b.SyntaxKind.JSDocLink]:TF,[b.SyntaxKind.JSDocLinkCode]:xF,[b.SyntaxKind.JSDocLinkPlain]:DF,[b.SyntaxKind.JSDocMemberName]:CF,[b.SyntaxKind.JSDocNamepathType]:AF,[b.SyntaxKind.JSDocNameReference]:LF,[b.SyntaxKind.JSDocNonNullableType]:NF,[b.SyntaxKind.JSDocNullableType]:IF,[b.SyntaxKind.JSDocOptionalType]:PF,[b.SyntaxKind.JSDocOverrideTag]:OF,[b.SyntaxKind.JSDocParameterTag]:kF,[b.SyntaxKind.JSDocPrivateTag]:RF,[b.SyntaxKind.JSDocPropertyTag]:MF,[b.SyntaxKind.JSDocProtectedTag]:wF,[b.SyntaxKind.JSDocPublicTag]:FF,[b.SyntaxKind.JSDocReturnTag]:BF,[b.SyntaxKind.JSDocReadonlyTag]:GF,[b.SyntaxKind.JSDocSeeTag]:UF,[b.SyntaxKind.JSDocSignature]:KF,[b.SyntaxKind.JSDocTag]:$F,[b.SyntaxKind.JSDocTemplateTag]:WF,[b.SyntaxKind.JSDocText]:VF,[b.SyntaxKind.JSDocThisTag]:jF,[b.SyntaxKind.JSDocTypeExpression]:qF,[b.SyntaxKind.JSDocTypeLiteral]:JF,[b.SyntaxKind.JSDocTypeTag]:zF,[b.SyntaxKind.JSDocTypedefTag]:HF,[b.SyntaxKind.JSDocUnknownType]:XF,[b.SyntaxKind.JSDocVariadicType]:YF,[b.SyntaxKind.JsxAttribute]:u6,[b.SyntaxKind.JsxClosingElement]:c6,[b.SyntaxKind.JsxClosingFragment]:d6,[b.SyntaxKind.JsxElement]:f6,[b.SyntaxKind.JsxExpression]:p6,[b.SyntaxKind.JsxFragment]:m6,[b.SyntaxKind.JsxOpeningElement]:_6,[b.SyntaxKind.JsxOpeningFragment]:g6,[b.SyntaxKind.JsxSelfClosingElement]:y6,[b.SyntaxKind.JsxSpreadAttribute]:v6,[b.SyntaxKind.JsxText]:h6,[b.SyntaxKind.LabeledStatement]:iw,[b.SyntaxKind.LiteralType]:Zw,[b.SyntaxKind.MappedType]:eF,[b.SyntaxKind.MetaProperty]:SM,[b.SyntaxKind.MethodDeclaration]:KD,[b.SyntaxKind.MethodSignature]:s6,[b.SyntaxKind.ModuleBlock]:Ew,[b.SyntaxKind.ModuleDeclaration]:bw,[b.SyntaxKind.NamedExports]:Sw,[b.SyntaxKind.NamedImports]:Tw,[b.SyntaxKind.NamedTupleMember]:rF,[b.SyntaxKind.NamespaceExport]:xw,[b.SyntaxKind.NamespaceImport]:Dw,[b.SyntaxKind.NewExpression]:TM,[b.SyntaxKind.NonNullExpression]:xM,[b.SyntaxKind.NotEmittedStatement]:aw,[b.SyntaxKind.NoSubstitutionTemplateLiteral]:A6,[b.SyntaxKind.NumericLiteral]:x6,[b.SyntaxKind.ObjectBindingPattern]:fM,[b.SyntaxKind.ObjectLiteralExpression]:CM,[b.SyntaxKind.OmittedExpression]:IM,[b.SyntaxKind.Parameter]:Ow,[b.SyntaxKind.ParenthesizedExpression]:PM,[b.SyntaxKind.ParenthesizedType]:tF,[b.SyntaxKind.PartiallyEmittedExpression]:OM,[b.SyntaxKind.PostfixUnaryExpression]:kM,[b.SyntaxKind.PrefixUnaryExpression]:RM,[b.SyntaxKind.PrivateIdentifier]:w6,[b.SyntaxKind.PropertyAccessExpression]:uL,[b.SyntaxKind.PropertyAssignment]:AM,[b.SyntaxKind.PropertyDeclaration]:Bw,[b.SyntaxKind.PropertySignature]:l6,[b.SyntaxKind.RegularExpressionLiteral]:D6,[b.SyntaxKind.ReturnStatement]:ow,[b.SyntaxKind.SetAccessor]:Uw,[b.SyntaxKind.ShorthandPropertyAssignment]:LM,[b.SyntaxKind.SpreadAssignment]:NM,[b.SyntaxKind.SpreadElement]:MM,[b.SyntaxKind.StringLiteral]:C6,[b.SyntaxKind.SwitchStatement]:sw,[b.SyntaxKind.SyntaxList]:sM,[b.SyntaxKind.TaggedTemplateExpression]:L6,[b.SyntaxKind.TemplateExpression]:N6,[b.SyntaxKind.TemplateHead]:I6,[b.SyntaxKind.TemplateLiteralType]:nF,[b.SyntaxKind.TemplateMiddle]:P6,[b.SyntaxKind.TemplateSpan]:O6,[b.SyntaxKind.TemplateTail]:k6,[b.SyntaxKind.ThisType]:iF,[b.SyntaxKind.ThrowStatement]:lw,[b.SyntaxKind.TryStatement]:uw,[b.SyntaxKind.TupleType]:aF,[b.SyntaxKind.TypeAliasDeclaration]:oF,[b.SyntaxKind.TypeAssertionExpression]:GM,[b.SyntaxKind.TypeLiteral]:sF,[b.SyntaxKind.TypeOperator]:lF,[b.SyntaxKind.TypeParameter]:uF,[b.SyntaxKind.TypePredicate]:cF,[b.SyntaxKind.TypeQuery]:dF,[b.SyntaxKind.TypeReference]:fF,[b.SyntaxKind.UnionType]:pF,[b.SyntaxKind.VariableDeclaration]:G6,[b.SyntaxKind.VariableDeclarationList]:B6,[b.SyntaxKind.VariableStatement]:Cw,[b.SyntaxKind.JSDoc]:Ww,[b.SyntaxKind.TypeOfExpression]:BM,[b.SyntaxKind.WhileStatement]:Aw,[b.SyntaxKind.WithStatement]:Lw,[b.SyntaxKind.YieldExpression]:KM,[b.SyntaxKind.SemicolonToken]:Tr,[b.SyntaxKind.AnyKeyword]:oc,[b.SyntaxKind.BooleanKeyword]:oc,[b.SyntaxKind.FalseKeyword]:S6,[b.SyntaxKind.ImportKeyword]:bM,[b.SyntaxKind.InferKeyword]:Tr,[b.SyntaxKind.NeverKeyword]:Tr,[b.SyntaxKind.NullKeyword]:T6,[b.SyntaxKind.NumberKeyword]:oc,[b.SyntaxKind.ObjectKeyword]:oc,[b.SyntaxKind.StringKeyword]:oc,[b.SyntaxKind.SymbolKeyword]:oc,[b.SyntaxKind.SuperKeyword]:wM,[b.SyntaxKind.ThisKeyword]:FM,[b.SyntaxKind.TrueKeyword]:b6,[b.SyntaxKind.UndefinedKeyword]:oc,[b.SyntaxKind.VoidExpression]:UM},JH=class{constructor(r){this.context=r,this.sourceFileCacheByFilePath=new Map,this.diagnosticCache=new b.WeakCache,this.definitionInfoCache=new b.WeakCache,this.documentSpanCache=new b.WeakCache,this.diagnosticMessageChainCache=new b.WeakCache,this.jsDocTagInfoCache=new b.WeakCache,this.signatureCache=new b.WeakCache,this.symbolCache=new b.WeakCache,this.symbolDisplayPartCache=new b.WeakCache,this.referencedSymbolEntryCache=new b.WeakCache,this.referencedSymbolCache=new b.WeakCache,this.referencedSymbolDefinitionInfoCache=new b.WeakCache,this.typeCache=new b.WeakCache,this.typeParameterCache=new b.WeakCache,this.nodeCache=new qH,this.sourceFileAddedEventContainer=new b.EventContainer,this.sourceFileRemovedEventContainer=new b.EventContainer,this.documentRegistry=new b.DocumentRegistry(r.fileSystemWrapper),this.directoryCache=new HH(r),this.context.compilerOptions.onModified(()=>{let n=Array.from(this.sourceFileCacheByFilePath.values());for(let i of n)_9e(i)})}*getSourceFilesByDirectoryDepth(){for(let r of this.getDirectoriesByDepth())yield*r.getSourceFiles()}getSourceFilePaths(){return this.sourceFileCacheByFilePath.keys()}getChildDirectoriesOfDirectory(r){return this.directoryCache.getChildDirectoriesOfDirectory(r)}getChildSourceFilesOfDirectory(r){return this.directoryCache.getChildSourceFilesOfDirectory(r)}onSourceFileAdded(r,n=!0){n?this.sourceFileAddedEventContainer.subscribe(r):this.sourceFileAddedEventContainer.unsubscribe(r)}onSourceFileRemoved(r){this.sourceFileRemovedEventContainer.subscribe(r)}createSourceFile(r,n,i){if(n=n instanceof Function?Yg(this.context.createWriter(),n):n||"",typeof n=="string")return this.createSourceFileFromText(r,n,i);let a=this.context.createWriter();return this.context.structurePrinterFactory.forSourceFile({isAmbient:b.FileUtils.getExtension(r)===".d.ts"}).printText(a,n),this.createSourceFileFromText(r,a.toString(),i)}createSourceFileFromText(r,n,i){return r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r),i.overwrite===!0?this.createOrOverwriteSourceFileFromText(r,n,i):(this.throwIfFileExists(r,"Did you mean to provide the overwrite option?"),this.createSourceFileFromTextInternal(r,n,i))}throwIfFileExists(r,n){if(!(!this.containsSourceFileAtPath(r)&&!this.context.fileSystemWrapper.fileExistsSync(r)))throw n=n==null?"":n+" ",new b.errors.InvalidOperationError(`${n}A source file already exists at the provided file path: ${r}`)}createOrOverwriteSourceFileFromText(r,n,i){r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r);let a=this.addOrGetSourceFileFromFilePath(r,i);return a!=null?(a.getChildren().forEach(s=>s.forget()),this.replaceCompilerNode(a,this.createCompilerSourceFileFromText(r,n,i.scriptKind)),a):this.createSourceFileFromTextInternal(r,n,i)}getSourceFileFromCacheFromFilePath(r){return r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r),this.sourceFileCacheByFilePath.get(r)}addOrGetSourceFileFromFilePath(r,n){r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r);let i=this.sourceFileCacheByFilePath.get(r);if(i==null){let a=this.context.fileSystemWrapper.readFileIfExistsSync(r,this.context.getEncoding());a!=null&&(this.context.logger.log(`Loaded file: ${r}`),i=this.createSourceFileFromTextInternal(r,a,n),i._setIsSaved(!0))}return i!=null&&n.markInProject&&i._markAsInProject(),i}containsSourceFileAtPath(r){return r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r),this.sourceFileCacheByFilePath.has(r)}containsDirectoryAtPath(r){return r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r),this.directoryCache.has(r)}getSourceFileForNode(r){let n=r;for(;n.kind!==b.SyntaxKind.SourceFile;){if(n.parent==null)return;n=n.parent}return this.getSourceFile(n,{markInProject:!1})}hasCompilerNode(r){return this.nodeCache.has(r)}getExistingNodeFromCompilerNode(r){return this.nodeCache.get(r)}getNodeFromCompilerNode(r,n){if(r.kind===b.SyntaxKind.SourceFile)return this.getSourceFile(r,{markInProject:!1});return this.nodeCache.getOrCreate(r,()=>{let u=i.call(this);return s.call(this,u),u});function i(){if(a(r))return p_.isCommentStatement(r)?new JM(this.context,r,n):p_.isCommentClassElement(r)?new ww(this.context,r,n):p_.isCommentTypeElement(r)?new n6(this.context,r,n):p_.isCommentObjectLiteralElement(r)?new DM(this.context,r,n):p_.isCommentEnumMember(r)?new QF(this.context,r,n):b.errors.throwNotImplementedForNeverValueError(r);let u=ZUe[r.kind]||Tr;return new u(this.context,r,n)}function a(u){return u._commentKind!=null}function s(u){if(r.parent!=null){let f=this.getNodeFromCompilerNode(r.parent,n);f._wrappedChildCount++}let p=u._getParentSyntaxListIfWrapped();if(p!=null&&p._wrappedChildCount++,r.kind===b.SyntaxKind.SyntaxList){let f=0;for(let m of u._getChildrenInCacheIterator())f++;u._wrappedChildCount=f}}}createSourceFileFromTextInternal(r,n,i){let a=b.StringUtils.hasBom(n);a&&(n=b.StringUtils.stripBom(n));let s=this.getSourceFile(this.createCompilerSourceFileFromText(r,n,i.scriptKind),i);return a&&(s._hasBom=!0),s}createCompilerSourceFileFromText(r,n,i){return this.documentRegistry.createOrUpdateSourceFile(r,this.context.compilerOptions.get(),b.ts.ScriptSnapshot.fromString(n),i)}getSourceFile(r,n){var i;let a=!1,s=(i=this.sourceFileCacheByFilePath.get(r.fileName))!==null&&i!==void 0?i:this.nodeCache.getOrCreate(r,()=>{let u=new kE(this.context,r);return n.markInProject||this.context.inProjectCoordinator.setSourceFileNotInProject(u),this.addSourceFileToCache(u),a=!0,u});return n.markInProject&&s._markAsInProject(),a&&this.sourceFileAddedEventContainer.fire(s),s}addSourceFileToCache(r){this.sourceFileCacheByFilePath.set(r.getFilePath(),r),this.context.fileSystemWrapper.removeFileDelete(r.getFilePath()),this.directoryCache.addSourceFile(r)}getDirectoryFromPath(r,n){r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r);let i=this.directoryCache.get(r);return i==null&&this.context.fileSystemWrapper.directoryExistsSync(r)&&(i=this.directoryCache.createOrAddIfExists(r)),i!=null&&n.markInProject&&i._markAsInProject(),i}createDirectoryOrAddIfExists(r,n){let i=this.directoryCache.createOrAddIfExists(r);return i!=null&&n.markInProject&&i._markAsInProject(),i}getDirectoryFromCache(r){return this.directoryCache.get(r)}getDirectoryFromCacheOnlyIfInCache(r){return this.directoryCache.has(r)?this.directoryCache.get(r):void 0}getDirectoriesByDepth(){return this.directoryCache.getAllByDepth()}getOrphanDirectories(){return this.directoryCache.getOrphans()}getSymbolDisplayPart(r){return this.symbolDisplayPartCache.getOrCreate(r,()=>new $6(r))}getType(r){return(r.flags&b.TypeFlags.TypeParameter)===b.TypeFlags.TypeParameter?this.getTypeParameter(r):this.typeCache.getOrCreate(r,()=>new EL(this.context,r))}getTypeParameter(r){return this.typeParameterCache.getOrCreate(r,()=>new Q6(this.context,r))}getSignature(r){return this.signatureCache.getOrCreate(r,()=>new U6(this.context,r))}getSymbol(r){return this.symbolCache.getOrCreate(r,()=>new K6(this.context,r))}getDefinitionInfo(r){return this.definitionInfoCache.getOrCreate(r,()=>new VD(this.context,r))}getDocumentSpan(r){return this.documentSpanCache.getOrCreate(r,()=>new pv(this.context,r))}getReferencedSymbolEntry(r){return this.referencedSymbolEntryCache.getOrCreate(r,()=>new J6(this.context,r))}getReferencedSymbol(r){return this.referencedSymbolCache.getOrCreate(r,()=>new yL(this.context,r))}getReferencedSymbolDefinitionInfo(r){return this.referencedSymbolDefinitionInfoCache.getOrCreate(r,()=>new vL(this.context,r))}getDiagnostic(r){return this.diagnosticCache.getOrCreate(r,()=>r.start!=null?new pL(this.context,r):new VT(this.context,r))}getDiagnosticWithLocation(r){return this.diagnosticCache.getOrCreate(r,()=>new pL(this.context,r))}getDiagnosticMessageChain(r){return this.diagnosticMessageChainCache.getOrCreate(r,()=>new mS(r))}getJSDocTagInfo(r){return this.jsDocTagInfoCache.getOrCreate(r,()=>new dL(r))}replaceCompilerNode(r,n){let i=r instanceof Tr?r.compilerNode:r,a=r instanceof Tr?r:this.nodeCache.get(r);if(i.kind===b.SyntaxKind.SourceFile&&i.fileName!==n.fileName){let s=a;this.removeCompilerNodeFromCache(i),s._replaceCompilerNodeFromFactory(n),this.nodeCache.set(n,s),this.addSourceFileToCache(s),this.sourceFileAddedEventContainer.fire(s)}else this.nodeCache.replaceKey(i,n),a?._replaceCompilerNodeFromFactory(n)}removeNodeFromCache(r){this.removeCompilerNodeFromCache(r.compilerNode)}removeCompilerNodeFromCache(r){if(this.nodeCache.removeByKey(r),r.kind===b.SyntaxKind.SourceFile){let n=r,i=this.context.fileSystemWrapper.getStandardizedAbsolutePath(n.fileName);this.directoryCache.removeSourceFile(i);let a=this.sourceFileCacheByFilePath.get(i);this.sourceFileCacheByFilePath.delete(i),this.documentRegistry.removeSourceFile(i),a!=null&&this.sourceFileRemovedEventContainer.fire(a)}}addDirectoryToCache(r){this.directoryCache.addDirectory(r)}removeDirectoryFromCache(r){this.directoryCache.remove(r)}forgetNodesCreatedInBlock(r){this.nodeCache.setForgetPoint();let n=!1,i;try{if(i=r((...s)=>{for(let u of s)this.nodeCache.rememberNode(u)}),Tr.isNode(i)&&this.nodeCache.rememberNode(i),a(i))return n=!0,i.then(s=>(Tr.isNode(s)&&this.nodeCache.rememberNode(s),this.nodeCache.forgetLastPoint(),s))}finally{n||this.nodeCache.forgetLastPoint()}return i;function a(s){return s!=null&&typeof s.then=="function"}}},zH=class{constructor(r){this.compilerFactory=r,this.notInProjectFiles=new Set,r.onSourceFileRemoved(n=>{this.notInProjectFiles.delete(n)})}setSourceFileNotInProject(r){this.notInProjectFiles.add(r),r._inProject=!1}markSourceFileAsInProject(r){this.isSourceFileInProject(r)||(this._internalMarkSourceFileAsInProject(r),this.notInProjectFiles.delete(r))}markSourceFilesAsInProjectForResolution(){let r="/node_modules/",n=this.compilerFactory,i=[],a=[];for(let u of[...this.notInProjectFiles.values()])s(u)?(this._internalMarkSourceFileAsInProject(u),this.notInProjectFiles.delete(u),i.push(u)):a.push(u);return{changedSourceFiles:i,unchangedSourceFiles:a};function s(u){let p=u.getFilePath(),f=p.toLowerCase().lastIndexOf(r);if(f===-1)return!0;let m=p.substring(0,f+r.length-1),g=n.getDirectoryFromCacheOnlyIfInCache(m);if(g!=null&&g._isInProject())return!0;let D=u.getDirectory();for(;D!=null&&D.getPath()!==m;){if(D._isInProject())return!0;D=n.getDirectoryFromCacheOnlyIfInCache(b.FileUtils.getDirPath(D.getPath()))}return!1}}_internalMarkSourceFileAsInProject(r){r._inProject=!0,this.markDirectoryAsInProject(r.getDirectory())}isSourceFileInProject(r){return r._inProject===!0}setDirectoryAndFilesAsNotInProjectForTesting(r){for(let n of r.getDirectories())this.setDirectoryAndFilesAsNotInProjectForTesting(n);for(let n of r.getSourceFiles())delete n._inProject,this.notInProjectFiles.add(n);delete r._inProject}markDirectoryAsInProject(r){if(this.isDirectoryInProject(r))return;let n=this,i=this.compilerFactory;r._inProject=!0,a(r);function a(u){let p=Array.from(s(u)),f=p[p.length-1];if(!(f==null||!n.isDirectoryInProject(f)))for(let m of p)m._inProject=!0}function*s(u){if(b.FileUtils.isRootDirPath(u.getPath()))return;let p=b.FileUtils.getDirPath(u.getPath()),f=i.getDirectoryFromCacheOnlyIfInCache(p);f!=null&&(yield f,n.isDirectoryInProject(f)||(yield*s(f)))}}isDirectoryInProject(r){return r._inProject===!0}},Vo=class{constructor(r){this._getFormatCodeSettings=r}getFormatCodeSettings(){return this._getFormatCodeSettings()}forInitializerExpressionableNode(){return new Uj}forModifierableNode(){return new Kj}forReturnTypedNode(r){return new Wj(r)}forTypedNode(r,n){return new Vj(r,n)}forClassDeclaration(r){return new Hj(this,r)}forClassMember(r){return new qj(this,r)}forClassStaticBlockDeclaration(){return new Jj(this)}forConstructorDeclaration(r){return new zj(this,r)}forGetAccessorDeclaration(r){return new $j(this,r)}forMethodDeclaration(r){return new Xj(this,r)}forPropertyDeclaration(){return new Yj(this)}forSetAccessorDeclaration(r){return new Qj(this,r)}forDecorator(){return new Zj(this)}forJSDoc(){return new eH(this)}forJSDocTag(r){return new rH(this,r)}forEnumDeclaration(){return new tH(this)}forEnumMember(){return new nH(this)}forObjectLiteralExpressionProperty(){return new iH(this)}forPropertyAssignment(){return new aH(this)}forShorthandPropertyAssignment(){return new oH(this)}forSpreadAssignment(){return new sH(this)}forFunctionDeclaration(r){return new lH(this,r)}forParameterDeclaration(){return new uH(this)}forCallSignatureDeclaration(){return new cH(this)}forConstructSignatureDeclaration(){return new dH(this)}forIndexSignatureDeclaration(){return new fH(this)}forInterfaceDeclaration(){return new pH(this)}forMethodSignature(){return new mH(this)}forPropertySignature(){return new _H(this)}forTypeElementMemberedNode(){return new gH(this)}forTypeElementMember(){return new yH(this)}forJsxAttributeDecider(){return new vH(this)}forJsxAttribute(){return new hH(this)}forJsxChildDecider(){return new EH(this)}forJsxElement(){return new bH(this)}forJsxSelfClosingElement(){return new SH(this)}forJsxSpreadAttribute(){return new TH(this)}forAssertEntry(){return new xH(this)}forExportAssignment(){return new DH(this)}forExportDeclaration(){return new CH(this)}forImportDeclaration(){return new AH(this)}forModuleDeclaration(r){return new LH(this,r)}forNamedImportExportSpecifier(){return new NH(this)}forSourceFile(r){return new IH(this,r)}forStatementedNode(r){return new PH(this,r)}forStatement(r){return new OH(this,r)}forVariableStatement(){return new kH(this)}forTypeAliasDeclaration(){return new RH(this)}forTypeParameterDeclaration(){return new MH(this)}forVariableDeclaration(){return new wH(this)}};co([b.Memoize],Vo.prototype,"forInitializerExpressionableNode",null);co([b.Memoize],Vo.prototype,"forModifierableNode",null);co([b.Memoize],Vo.prototype,"forReturnTypedNode",null);co([b.Memoize],Vo.prototype,"forTypedNode",null);co([b.Memoize],Vo.prototype,"forClassDeclaration",null);co([b.Memoize],Vo.prototype,"forClassMember",null);co([b.Memoize],Vo.prototype,"forClassStaticBlockDeclaration",null);co([b.Memoize],Vo.prototype,"forConstructorDeclaration",null);co([b.Memoize],Vo.prototype,"forGetAccessorDeclaration",null);co([b.Memoize],Vo.prototype,"forMethodDeclaration",null);co([b.Memoize],Vo.prototype,"forPropertyDeclaration",null);co([b.Memoize],Vo.prototype,"forSetAccessorDeclaration",null);co([b.Memoize],Vo.prototype,"forDecorator",null);co([b.Memoize],Vo.prototype,"forJSDoc",null);co([b.Memoize],Vo.prototype,"forJSDocTag",null);co([b.Memoize],Vo.prototype,"forEnumDeclaration",null);co([b.Memoize],Vo.prototype,"forEnumMember",null);co([b.Memoize],Vo.prototype,"forObjectLiteralExpressionProperty",null);co([b.Memoize],Vo.prototype,"forPropertyAssignment",null);co([b.Memoize],Vo.prototype,"forShorthandPropertyAssignment",null);co([b.Memoize],Vo.prototype,"forSpreadAssignment",null);co([b.Memoize],Vo.prototype,"forFunctionDeclaration",null);co([b.Memoize],Vo.prototype,"forParameterDeclaration",null);co([b.Memoize],Vo.prototype,"forCallSignatureDeclaration",null);co([b.Memoize],Vo.prototype,"forConstructSignatureDeclaration",null);co([b.Memoize],Vo.prototype,"forIndexSignatureDeclaration",null);co([b.Memoize],Vo.prototype,"forInterfaceDeclaration",null);co([b.Memoize],Vo.prototype,"forMethodSignature",null);co([b.Memoize],Vo.prototype,"forPropertySignature",null);co([b.Memoize],Vo.prototype,"forTypeElementMemberedNode",null);co([b.Memoize],Vo.prototype,"forTypeElementMember",null);co([b.Memoize],Vo.prototype,"forJsxAttributeDecider",null);co([b.Memoize],Vo.prototype,"forJsxAttribute",null);co([b.Memoize],Vo.prototype,"forJsxChildDecider",null);co([b.Memoize],Vo.prototype,"forJsxElement",null);co([b.Memoize],Vo.prototype,"forJsxSelfClosingElement",null);co([b.Memoize],Vo.prototype,"forJsxSpreadAttribute",null);co([b.Memoize],Vo.prototype,"forAssertEntry",null);co([b.Memoize],Vo.prototype,"forExportAssignment",null);co([b.Memoize],Vo.prototype,"forExportDeclaration",null);co([b.Memoize],Vo.prototype,"forImportDeclaration",null);co([b.Memoize],Vo.prototype,"forModuleDeclaration",null);co([b.Memoize],Vo.prototype,"forNamedImportExportSpecifier",null);co([b.Memoize],Vo.prototype,"forSourceFile",null);co([b.Memoize],Vo.prototype,"forStatementedNode",null);co([b.Memoize],Vo.prototype,"forStatement",null);co([b.Memoize],Vo.prototype,"forVariableStatement",null);co([b.Memoize],Vo.prototype,"forTypeAliasDeclaration",null);co([b.Memoize],Vo.prototype,"forTypeParameterDeclaration",null);co([b.Memoize],Vo.prototype,"forVariableDeclaration",null);var jD=class{constructor(r){this.logger=new vj,this.manipulationSettings=new QR,this._project=r.project,this.fileSystemWrapper=r.fileSystemWrapper,this._compilerOptions=r.compilerOptionsContainer,this.compilerFactory=new JH(this),this.inProjectCoordinator=new zH(this.compilerFactory),this.structurePrinterFactory=new Vo(()=>this.manipulationSettings.getFormatCodeSettings()),this.lazyReferenceCoordinator=new hj(this.compilerFactory),this.directoryCoordinator=new jH(this.compilerFactory,r.fileSystemWrapper),this._languageService=r.createLanguageService?new Y6({context:this,configFileParsingDiagnostics:r.configFileParsingDiagnostics,resolutionHost:r.resolutionHost&&r.resolutionHost(this.getModuleResolutionHost(),()=>this.compilerOptions.get()),skipLoadingLibFiles:r.skipLoadingLibFiles,libFolderPath:r.libFolderPath}):void 0,r.typeChecker!=null&&(b.errors.throwIfTrue(r.createLanguageService,"Cannot specify a type checker and create a language service."),this._customTypeChecker=new hL(this),this._customTypeChecker._reset(()=>r.typeChecker))}get project(){if(this._project==null)throw new b.errors.InvalidOperationError("This operation is not permitted in this context.");return this._project}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 r=this.manipulationSettings.getIndentationText();return new YR.default({newLine:this.manipulationSettings.getNewLineKindAsString(),indentNumberOfSpaces:r===Oe.IndentationText.Tab?void 0:r.length,useTabs:r===Oe.IndentationText.Tab,useSingleQuote:this.manipulationSettings.getQuoteKind()===Oe.QuoteKind.Single})}getPreEmitDiagnostics(r){return b.ts.getPreEmitDiagnostics(this.program.compilerObject,r?.compilerNode).map(i=>this.compilerFactory.getDiagnostic(i))}getSourceFileContainer(){return{addOrGetSourceFileFromFilePath:(r,n)=>{var i;return Promise.resolve((i=this.compilerFactory.addOrGetSourceFileFromFilePath(r,n))===null||i===void 0?void 0:i.compilerNode)},addOrGetSourceFileFromFilePathSync:(r,n)=>{var i;return(i=this.compilerFactory.addOrGetSourceFileFromFilePath(r,n))===null||i===void 0?void 0:i.compilerNode},containsDirectoryAtPath:r=>this.compilerFactory.containsDirectoryAtPath(r),containsSourceFileAtPath:r=>this.compilerFactory.containsSourceFileAtPath(r),getSourceFileFromCacheFromFilePath:r=>{let n=this.compilerFactory.getSourceFileFromCacheFromFilePath(r);return n?.compilerNode},getSourceFilePaths:()=>this.compilerFactory.getSourceFilePaths(),getSourceFileVersion:r=>this.compilerFactory.documentRegistry.getSourceFileVersion(r),getChildDirectoriesOfDirectory:r=>{let n=[];for(let i of this.compilerFactory.getChildDirectoriesOfDirectory(r))n.push(i.getPath());return n}}}getModuleResolutionHost(){return b.createModuleResolutionHost({transactionalFileSystem:this.fileSystemWrapper,getEncoding:()=>this.getEncoding(),sourceFileContainer:this.getSourceFileContainer()})}getToolRequiredError(r){return new b.errors.InvalidOperationError(`A ${r} 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 ${r} should be required for this operation.`)}};co([b.Memoize],jD.prototype,"getSourceFileContainer",null);co([b.Memoize],jD.prototype,"getModuleResolutionHost",null);var $H=class{constructor(r={}){var n;f();let i=m(),a=new b.TransactionalFileSystem({fileSystem:i,skipLoadingLibFiles:r.skipLoadingLibFiles,libFolderPath:r.libFolderPath}),s=r.tsConfigFilePath==null?void 0:new b.TsConfigResolver(a,a.getStandardizedAbsolutePath(r.tsConfigFilePath),P()),u=g(),p=new b.CompilerOptionsContainer;p.set(u),this._context=new jD({project:this,compilerOptionsContainer:p,fileSystemWrapper:a,createLanguageService:!0,resolutionHost:r.resolutionHost,configFileParsingDiagnostics:(n=s?.getErrors())!==null&&n!==void 0?n:[],skipLoadingLibFiles:r.skipLoadingLibFiles,libFolderPath:r.libFolderPath}),r.manipulationSettings!=null&&this._context.manipulationSettings.set(r.manipulationSettings),s!=null&&r.skipAddingFilesFromTsConfig!==!0&&(this._addSourceFilesForTsConfigResolver(s,u),r.skipFileDependencyResolution||this.resolveSourceFileDependencies());function f(){if(r.fileSystem!=null&&r.useInMemoryFileSystem)throw new b.errors.InvalidOperationError("Cannot provide a file system when specifying to use an in-memory file system.")}function m(){var B;return r.useInMemoryFileSystem?new b.InMemoryFileSystemHost:(B=r.fileSystem)!==null&&B!==void 0?B:new b.RealFileSystemHost}function g(){var B;return{...D(),...(B=r.compilerOptions)!==null&&B!==void 0?B:{}}}function D(){var B;return(B=s?.getCompilerOptions())!==null&&B!==void 0?B:{}}function P(){var B;let K="utf-8";return r.compilerOptions!=null&&(B=r.compilerOptions.charset)!==null&&B!==void 0?B:K}}get manipulationSettings(){return this._context.manipulationSettings}get compilerOptions(){return this._context.compilerOptions}resolveSourceFileDependencies(){let r=new Set,n=u=>r.add(u),{compilerFactory:i,inProjectCoordinator:a}=this._context;i.onSourceFileAdded(n);try{this.getProgram().compilerObject}finally{i.onSourceFileAdded(n,!1)}let s=a.markSourceFilesAsInProjectForResolution();for(let u of s.changedSourceFiles)r.add(u);for(let u of s.unchangedSourceFiles)r.delete(u);return Array.from(r.values())}addDirectoryAtPathIfExists(r,n={}){return this._context.directoryCoordinator.addDirectoryAtPathIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),{...n,markInProject:!0})}addDirectoryAtPath(r,n={}){return this._context.directoryCoordinator.addDirectoryAtPath(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),{...n,markInProject:!0})}createDirectory(r){return this._context.directoryCoordinator.createDirectoryOrAddIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),{markInProject:!0})}getDirectoryOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getDirectory(r),()=>`Could not find a directory at the specified path: ${this._context.fileSystemWrapper.getStandardizedAbsolutePath(r)}`)}getDirectory(r){let{compilerFactory:n}=this._context;return n.getDirectoryFromCache(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r))}getDirectories(){return Array.from(this._getProjectDirectoriesByDirectoryDepth())}getRootDirectories(){let{inProjectCoordinator:r}=this._context,n=[];for(let a of this._context.compilerFactory.getOrphanDirectories())for(let s of i(a))n.push(s);return n;function*i(a){if(r.isDirectoryInProject(a)){yield a;return}for(let s of a._getDirectoriesIterator())yield*i(s)}}addSourceFilesAtPaths(r){return this._context.directoryCoordinator.addSourceFilesAtPaths(r,{markInProject:!0})}addSourceFileAtPathIfExists(r){return this._context.directoryCoordinator.addSourceFileAtPathIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),{markInProject:!0})}addSourceFileAtPath(r){return this._context.directoryCoordinator.addSourceFileAtPath(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),{markInProject:!0})}addSourceFilesFromTsConfig(r){let n=new b.TsConfigResolver(this._context.fileSystemWrapper,this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),this._context.getEncoding());return this._addSourceFilesForTsConfigResolver(n,n.getCompilerOptions())}_addSourceFilesForTsConfigResolver(r,n){let i=r.getPaths(n),a=i.filePaths.map(s=>this.addSourceFileAtPath(s));for(let s of i.directoryPaths)this.addDirectoryAtPathIfExists(s);return a}createSourceFile(r,n,i){return this._context.compilerFactory.createSourceFile(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),n??"",{...i??{},markInProject:!0})}removeSourceFile(r){let n=r.wasForgotten();return r.forget(),!n}getSourceFileOrThrow(r){let n=this.getSourceFile(r);if(n!=null)return n;if(typeof r=="string"){let i=b.FileUtils.standardizeSlashes(r);if(b.FileUtils.pathIsAbsolute(i)||i.indexOf("/")>=0){let a=this._context.fileSystemWrapper.getStandardizedAbsolutePath(i);throw new b.errors.InvalidOperationError(`Could not find source file in project at the provided path: ${a}`)}else throw new b.errors.InvalidOperationError(`Could not find source file in project with the provided file name: ${r}`)}else throw new b.errors.InvalidOperationError("Could not find source file in project based on the provided condition.")}getSourceFile(r){let n=i(this._context.fileSystemWrapper);if(a(n))return this._context.compilerFactory.getSourceFileFromCacheFromFilePath(n);return b.IterableUtils.find(this._getProjectSourceFilesByDirectoryDepth(),n);function i(s){if(r instanceof Function)return r;let u=b.FileUtils.standardizeSlashes(r);return b.FileUtils.pathIsAbsolute(u)||u.indexOf("/")>=0?s.getStandardizedAbsolutePath(u):p=>b.FileUtils.pathEndsWith(p.getFilePath(),u)}function a(s){return typeof s=="string"}}getSourceFiles(r){let{compilerFactory:n,fileSystemWrapper:i}=this._context,a=this._getProjectSourceFilesByDirectoryDepth();if(typeof r=="string"||r instanceof Array)return Array.from(s());return Array.from(a);function*s(){let u=Array.from(f()),p=b.matchGlobs(u,r,i.getCurrentDirectory());for(let m of p)yield n.getSourceFileFromCacheFromFilePath(i.getStandardizedAbsolutePath(m));function*f(){for(let m of a)yield m.getFilePath()}}}*_getProjectSourceFilesByDirectoryDepth(){let{compilerFactory:r,inProjectCoordinator:n}=this._context;for(let i of r.getSourceFilesByDirectoryDepth())n.isSourceFileInProject(i)&&(yield i)}*_getProjectDirectoriesByDirectoryDepth(){let{compilerFactory:r,inProjectCoordinator:n}=this._context;for(let i of r.getDirectoriesByDepth())n.isDirectoryInProject(i)&&(yield i)}getAmbientModule(r){return r=_pe(r),this.getAmbientModules().find(n=>n.getName()===r)}getAmbientModuleOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getAmbientModule(r),()=>`Could not find ambient module with name: ${_pe(r)}`)}getAmbientModules(){return this.getTypeChecker().getAmbientModules()}async save(){await this._context.fileSystemWrapper.flush(),await Promise.all(this._getUnsavedSourceFiles().map(r=>r.save()))}saveSync(){this._context.fileSystemWrapper.flushSync();for(let r of this._getUnsavedSourceFiles())r.saveSync()}enableLogging(r=!0){this._context.logger.setEnabled(r)}_getUnsavedSourceFiles(){return Array.from(r(this._context.compilerFactory.getSourceFilesByDirectoryDepth()));function*r(n){for(let i of n)i.isSaved()||(yield i)}}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(r={}){return this._context.program.emit(r)}emitSync(r={}){return this._context.program.emitSync(r)}emitToMemory(r={}){return this._context.program.emitToMemory(r)}getCompilerOptions(){return this._context.compilerOptions.get()}getConfigFileParsingDiagnostics(){return this.getProgram().getConfigFileParsingDiagnostics()}createWriter(){return this._context.createWriter()}forgetNodesCreatedInBlock(r){return this._context.compilerFactory.forgetNodesCreatedInBlock(r)}formatDiagnosticsWithColorAndContext(r,n={}){return b.ts.formatDiagnosticsWithColorAndContext(r.map(i=>i.compilerObject),{getCurrentDirectory:()=>this._context.fileSystemWrapper.getCurrentDirectory(),getCanonicalFileName:i=>i,getNewLine:()=>{var i;return(i=n.newLineChar)!==null&&i!==void 0?i:b.runtime.getEndOfLine()}})}getModuleResolutionHost(){return this._context.getModuleResolutionHost()}};function _pe(e){return r(e[0])&&r(e[e.length-1])&&(e=e.substring(1,e.length-1)),`"${e}"`;function r(n){return n==='"'||n==="'"}}function eKe(e,r={}){let{compilerOptions:n={},sourceFile:i,typeChecker:a}=r,s=new b.CompilerOptionsContainer;s.set(n);let u=new jD({project:void 0,fileSystemWrapper:new b.TransactionalFileSystem({fileSystem:new b.RealFileSystemHost,skipLoadingLibFiles:!0,libFolderPath:void 0}),compilerOptionsContainer:s,createLanguageService:!1,typeChecker:a,configFileParsingDiagnostics:[],skipLoadingLibFiles:!0,libFolderPath:void 0}),p=u.compilerFactory.getSourceFile(f(),{markInProject:!0});return u.compilerFactory.getNodeFromCompilerNode(e,p);function f(){return i??m(e)}function m(g){if(g.kind===b.SyntaxKind.SourceFile)return g;if(g.parent==null)throw new b.errors.InvalidOperationError("Please ensure the node was created from a source file with 'setParentNodes' set to 'true'.");let D=g;for(;D.parent!=null;)D=D.parent;if(D.kind!==b.SyntaxKind.SourceFile)throw new b.errors.NotImplementedError("For some reason the top parent was not a source file.");return D}}var rKe=new Vo(()=>{throw new b.errors.NotImplementedError("Not implemented scenario for getting code format settings when using a writer function. Please open an issue.")}),XH=class{constructor(){}static object(r){return n=>{let i=Object.keys(r);n.write("{"),i.length>0&&n.indent(()=>{a()}),n.write("}");function a(){for(let s=0;s<i.length;s++){s>0&&n.write(",").newLine();let u=i[s],p=r[u];n.write(u),p!=null&&(n.write(": "),nL(n,p))}n.newLine()}}}static objectType(r){return n=>{n.write("{"),tKe(r)&&n.indent(()=>{rKe.forTypeElementMemberedNode().printText(n,r)}),n.write("}")}}static unionType(r,n,...i){return gpe("|",[r,n,...i])}static intersectionType(r,n,...i){return gpe("&",[r,n,...i])}static assertion(r,n){return i=>{nL(i,r),i.spaceIfLastNot().write("as "),nL(i,n)}}static returnStatement(r){return n=>{n.write("return "),n.hangingIndentUnlessBlock(()=>{nL(n,r),n.write(";")})}}};function gpe(e,r){return n=>{nKe(n,` ${e} `,r)}}function tKe(e){for(let r of Object.keys(e))if(e[r]!=null&&!(e[r]instanceof Array&&e[r].length===0))return!0;return!1}function nKe(e,r,n){for(let i=0;i<n.length;i++)e.conditionalWrite(i>0,r),nL(e,n[i])}function nL(e,r){r instanceof Function?r(e):e.write(r.toString())}var{InvalidOperationError:iKe,FileNotFoundError:aKe,ArgumentError:oKe,ArgumentNullOrWhitespaceError:sKe,ArgumentOutOfRangeError:lKe,ArgumentTypeError:uKe,BaseError:cKe,DirectoryNotFoundError:dKe,NotImplementedError:fKe,NotSupportedError:pKe,PathNotFoundError:mKe}=b.errors;Object.defineProperty(Oe,"CompilerOptionsContainer",{enumerable:!0,get:function(){return b.CompilerOptionsContainer}});Object.defineProperty(Oe,"DiagnosticCategory",{enumerable:!0,get:function(){return b.DiagnosticCategory}});Object.defineProperty(Oe,"EmitHint",{enumerable:!0,get:function(){return b.EmitHint}});Object.defineProperty(Oe,"InMemoryFileSystemHost",{enumerable:!0,get:function(){return b.InMemoryFileSystemHost}});Object.defineProperty(Oe,"LanguageVariant",{enumerable:!0,get:function(){return b.LanguageVariant}});Object.defineProperty(Oe,"ModuleKind",{enumerable:!0,get:function(){return b.ModuleKind}});Object.defineProperty(Oe,"ModuleResolutionKind",{enumerable:!0,get:function(){return b.ModuleResolutionKind}});Object.defineProperty(Oe,"NewLineKind",{enumerable:!0,get:function(){return b.NewLineKind}});Object.defineProperty(Oe,"NodeFlags",{enumerable:!0,get:function(){return b.NodeFlags}});Object.defineProperty(Oe,"ObjectFlags",{enumerable:!0,get:function(){return b.ObjectFlags}});Object.defineProperty(Oe,"ResolutionHosts",{enumerable:!0,get:function(){return b.ResolutionHosts}});Object.defineProperty(Oe,"ScriptKind",{enumerable:!0,get:function(){return b.ScriptKind}});Object.defineProperty(Oe,"ScriptTarget",{enumerable:!0,get:function(){return b.ScriptTarget}});Object.defineProperty(Oe,"SettingsContainer",{enumerable:!0,get:function(){return b.SettingsContainer}});Object.defineProperty(Oe,"SymbolFlags",{enumerable:!0,get:function(){return b.SymbolFlags}});Object.defineProperty(Oe,"SyntaxKind",{enumerable:!0,get:function(){return b.SyntaxKind}});Object.defineProperty(Oe,"TypeFlags",{enumerable:!0,get:function(){return b.TypeFlags}});Object.defineProperty(Oe,"TypeFormatFlags",{enumerable:!0,get:function(){return b.TypeFormatFlags}});Object.defineProperty(Oe,"ts",{enumerable:!0,get:function(){return b.ts}});Object.defineProperty(Oe,"CodeBlockWriter",{enumerable:!0,get:function(){return YR.default}});Oe.AbstractableNode=yS;Oe.AmbientableNode=Ih;Oe.ArgumentError=oKe;Oe.ArgumentNullOrWhitespaceError=sKe;Oe.ArgumentOutOfRangeError=lKe;Oe.ArgumentTypeError=uKe;Oe.ArgumentedNode=tq;Oe.ArrayBindingPattern=cM;Oe.ArrayDestructuringAssignment=FH;Oe.ArrayDestructuringAssignmentBase=Qpe;Oe.ArrayLiteralExpression=mM;Oe.ArrayTypeNode=Vw;Oe.ArrowFunction=Nw;Oe.ArrowFunctionBase=o_e;Oe.AsExpression=_M;Oe.AsExpressionBase=Zpe;Oe.AssertClause=cw;Oe.AssertClauseBase=zme;Oe.AssertEntry=dw;Oe.AssertEntryBase=yR;Oe.AssertionKeyNamedNode=Hpe;Oe.AssignmentExpression=sL;Oe.AssignmentExpressionBase=Ype;Oe.AsyncableNode=HT;Oe.AwaitExpression=gM;Oe.AwaitExpressionBase=eme;Oe.AwaitableNode=wpe;Oe.BaseError=cKe;Oe.BaseExpressionedNode=$D;Oe.BigIntLiteral=E6;Oe.BigIntLiteralBase=F_e;Oe.BinaryExpression=oL;Oe.BinaryExpressionBase=Xpe;Oe.BindingElement=dM;Oe.BindingElementBase=$pe;Oe.BindingNamedNode=aG;Oe.Block=WM;Oe.BlockBase=Nme;Oe.BodiedNode=rG;Oe.BodyableNode=qT;Oe.BreakStatement=VM;Oe.CallExpression=yM;Oe.CallExpressionBase=rme;Oe.CallSignatureDeclaration=t6;Oe.CallSignatureDeclarationBase=UR;Oe.CaseBlock=jM;Oe.CaseBlockBase=Ime;Oe.CaseClause=HM;Oe.CaseClauseBase=Pme;Oe.CatchClause=qM;Oe.CatchClauseBase=Ome;Oe.ChildOrderableNode=Im;Oe.ClassDeclaration=kw;Oe.ClassDeclarationBase=AR;Oe.ClassElement=Xg;Oe.ClassExpression=Rw;Oe.ClassExpressionBase=f_e;Oe.ClassLikeDeclarationBase=pq;Oe.ClassLikeDeclarationBaseSpecific=c_e;Oe.ClassStaticBlockDeclaration=Mw;Oe.ClassStaticBlockDeclarationBase=LR;Oe.CodeAction=W6;Oe.CodeFixAction=V6;Oe.CombinedCodeActions=fL;Oe.CommaListExpression=vM;Oe.CommaListExpressionBase=tme;Oe.CommentClassElement=ww;Oe.CommentEnumMember=QF;Oe.CommentObjectLiteralElement=DM;Oe.CommentRange=oM;Oe.CommentStatement=JM;Oe.CommentTypeElement=n6;Oe.CommonIdentifierBase=yq;Oe.CompilerCommentClassElement=eM;Oe.CompilerCommentEnumMember=nM;Oe.CompilerCommentNode=lS;Oe.CompilerCommentObjectLiteralElement=tM;Oe.CompilerCommentStatement=ZR;Oe.CompilerCommentTypeElement=rM;Oe.ComputedPropertyName=R6;Oe.ComputedPropertyNameBase=Y_e;Oe.ConditionalExpression=hM;Oe.ConditionalExpressionBase=nme;Oe.ConditionalTypeNode=jw;Oe.ConstructSignatureDeclaration=i6;Oe.ConstructSignatureDeclarationBase=KR;Oe.ConstructorDeclaration=Fw;Oe.ConstructorDeclarationBase=NR;Oe.ConstructorDeclarationOverloadBase=p_e;Oe.ConstructorTypeNode=Hw;Oe.ConstructorTypeNodeBase=y_e;Oe.ContinueStatement=zM;Oe.DebuggerStatement=$M;Oe.DebuggerStatementBase=kme;Oe.DecoratableNode=JT;Oe.Decorator=Kw;Oe.DecoratorBase=kR;Oe.DefaultClause=XM;Oe.DefaultClauseBase=Rme;Oe.DefinitionInfo=VD;Oe.DeleteExpression=EM;Oe.DeleteExpressionBase=ime;Oe.Diagnostic=VT;Oe.DiagnosticMessageChain=mS;Oe.DiagnosticWithLocation=pL;Oe.Directory=OE;Oe.DirectoryEmitResult=bL;Oe.DirectoryNotFoundError=dKe;Oe.DoStatement=YM;Oe.DoStatementBase=Mme;Oe.DocumentSpan=pv;Oe.DotDotDotTokenableNode=SL;Oe.ElementAccessExpression=lL;Oe.ElementAccessExpressionBase=ame;Oe.EmitOutput=mL;Oe.EmitResult=jT;Oe.EmptyStatement=QM;Oe.EmptyStatementBase=wme;Oe.EnumDeclaration=ZF;Oe.EnumDeclarationBase=GR;Oe.EnumMember=e6;Oe.EnumMemberBase=BR;Oe.ExclamationTokenableNode=iq;Oe.ExportAssignment=fw;Oe.ExportAssignmentBase=KH;Oe.ExportDeclaration=pw;Oe.ExportDeclarationBase=vR;Oe.ExportGetableNode=aq;Oe.ExportSpecifier=mw;Oe.ExportSpecifierBase=WH;Oe.ExportableNode=BE;Oe.Expression=oc;Oe.ExpressionStatement=ZM;Oe.ExpressionStatementBase=Fme;Oe.ExpressionWithTypeArguments=qw;Oe.ExpressionWithTypeArgumentsBase=v_e;Oe.ExpressionableNode=CL;Oe.ExpressionedNode=ud;Oe.ExtendsClauseableNode=Vpe;Oe.ExternalModuleReference=_w;Oe.ExternalModuleReferenceBase=$me;Oe.FalseLiteral=S6;Oe.FalseLiteralBase=B_e;Oe.FileNotFoundError=aKe;Oe.FileReference=GD;Oe.FileTextChanges=pS;Oe.ForInStatement=ew;Oe.ForInStatementBase=Gme;Oe.ForOfStatement=rw;Oe.ForOfStatementBase=Bme;Oe.ForStatement=tw;Oe.ForStatementBase=Ume;Oe.FunctionDeclaration=Iw;Oe.FunctionDeclarationBase=xR;Oe.FunctionDeclarationOverloadBase=s_e;Oe.FunctionExpression=Pw;Oe.FunctionExpressionBase=l_e;Oe.FunctionLikeDeclaration=QT;Oe.FunctionOrConstructorTypeNodeBase=cL;Oe.FunctionOrConstructorTypeNodeBaseBase=g_e;Oe.FunctionTypeNode=Jw;Oe.FunctionTypeNodeBase=h_e;Oe.GeneratorableNode=$T;Oe.GetAccessorDeclaration=Gw;Oe.GetAccessorDeclarationBase=IR;Oe.HeritageClause=r6;Oe.HeritageClauseableNode=sq;Oe.Identifier=M6;Oe.IdentifierBase=Q_e;Oe.IfStatement=nw;Oe.IfStatementBase=Kme;Oe.ImplementationLocation=_L;Oe.ImplementsClauseableNode=jpe;Oe.ImportClause=gw;Oe.ImportClauseBase=Xme;Oe.ImportDeclaration=yw;Oe.ImportDeclarationBase=hR;Oe.ImportEqualsDeclaration=vw;Oe.ImportEqualsDeclarationBase=Qme;Oe.ImportExpression=bM;Oe.ImportExpressionBase=ome;Oe.ImportExpressionedNode=sUe;Oe.ImportSpecifier=hw;Oe.ImportSpecifierBase=ER;Oe.ImportTypeAssertionContainer=zw;Oe.ImportTypeNode=$w;Oe.IndexSignatureDeclaration=a6;Oe.IndexSignatureDeclarationBase=WR;Oe.IndexedAccessTypeNode=Xw;Oe.InferTypeNode=Yw;Oe.InitializerExpressionGetableNode=iG;Oe.InitializerExpressionableNode=XT;Oe.InterfaceDeclaration=o6;Oe.InterfaceDeclarationBase=VR;Oe.IntersectionTypeNode=Qw;Oe.InvalidOperationError=iKe;Oe.IterationStatement=fS;Oe.JSDoc=Ww;Oe.JSDocAllType=mF;Oe.JSDocAugmentsTag=_F;Oe.JSDocAuthorTag=gF;Oe.JSDocBase=RR;Oe.JSDocCallbackTag=yF;Oe.JSDocClassTag=vF;Oe.JSDocDeprecatedTag=hF;Oe.JSDocEnumTag=EF;Oe.JSDocFunctionType=bF;Oe.JSDocFunctionTypeBase=C_e;Oe.JSDocImplementsTag=SF;Oe.JSDocLink=TF;Oe.JSDocLinkCode=xF;Oe.JSDocLinkPlain=DF;Oe.JSDocMemberName=CF;Oe.JSDocNameReference=LF;Oe.JSDocNamepathType=AF;Oe.JSDocNonNullableType=NF;Oe.JSDocNullableType=IF;Oe.JSDocOptionalType=PF;Oe.JSDocOverrideTag=OF;Oe.JSDocParameterTag=kF;Oe.JSDocParameterTagBase=A_e;Oe.JSDocPrivateTag=RF;Oe.JSDocPropertyLikeTag=mq;Oe.JSDocPropertyTag=MF;Oe.JSDocPropertyTagBase=L_e;Oe.JSDocProtectedTag=wF;Oe.JSDocPublicTag=FF;Oe.JSDocReadonlyTag=GF;Oe.JSDocReturnTag=BF;Oe.JSDocReturnTagBase=N_e;Oe.JSDocSeeTag=UF;Oe.JSDocSeeTagBase=I_e;Oe.JSDocSignature=KF;Oe.JSDocTag=bc;Oe.JSDocTagBase=FR;Oe.JSDocTagInfo=dL;Oe.JSDocTemplateTag=WF;Oe.JSDocTemplateTagBase=P_e;Oe.JSDocText=VF;Oe.JSDocThisTag=jF;Oe.JSDocThisTagBase=O_e;Oe.JSDocType=J_;Oe.JSDocTypeExpression=qF;Oe.JSDocTypeExpressionableTag=fG;Oe.JSDocTypeLiteral=JF;Oe.JSDocTypeParameteredTag=m_e;Oe.JSDocTypeTag=zF;Oe.JSDocTypedefTag=HF;Oe.JSDocUnknownTag=$F;Oe.JSDocUnknownType=XF;Oe.JSDocVariadicType=YF;Oe.JSDocableNode=sc;Oe.JsxAttribute=u6;Oe.JsxAttributeBase=qR;Oe.JsxAttributedNode=_q;Oe.JsxClosingElement=c6;Oe.JsxClosingElementBase=k_e;Oe.JsxClosingFragment=d6;Oe.JsxElement=f6;Oe.JsxElementBase=JR;Oe.JsxExpression=p6;Oe.JsxExpressionBase=R_e;Oe.JsxFragment=m6;Oe.JsxOpeningElement=_6;Oe.JsxOpeningElementBase=M_e;Oe.JsxOpeningFragment=g6;Oe.JsxSelfClosingElement=y6;Oe.JsxSelfClosingElementBase=zR;Oe.JsxSpreadAttribute=v6;Oe.JsxSpreadAttributeBase=$R;Oe.JsxTagNamedNode=pG;Oe.JsxText=h6;Oe.JsxTextBase=w_e;Oe.LabeledStatement=iw;Oe.LabeledStatementBase=Wme;Oe.LanguageService=Y6;Oe.LeftHandSideExpression=UD;Oe.LeftHandSideExpressionedNode=YT;Oe.LiteralExpression=dS;Oe.LiteralExpressionBase=sme;Oe.LiteralLikeNode=qD;Oe.LiteralTypeNode=Zw;Oe.ManipulationError=aM;Oe.ManipulationSettingsContainer=QR;Oe.MappedTypeNode=eF;Oe.MemberExpression=UT;Oe.MemoryEmitResult=H6;Oe.MetaProperty=SM;Oe.MetaPropertyBase=lme;Oe.MethodDeclaration=KD;Oe.MethodDeclarationBase=CR;Oe.MethodDeclarationOverloadBase=u_e;Oe.MethodSignature=s6;Oe.MethodSignatureBase=jR;Oe.ModifierableNode=sf;Oe.ModuleBlock=Ew;Oe.ModuleBlockBase=Zme;Oe.ModuleChildableNode=vS;Oe.ModuleDeclaration=bw;Oe.ModuleDeclarationBase=bR;Oe.ModuleNamedNode=qpe;Oe.ModuledNode=lq;Oe.NameableNode=oG;Oe.NamedExports=Sw;Oe.NamedExportsBase=e_e;Oe.NamedImports=Tw;Oe.NamedImportsBase=r_e;Oe.NamedNode=gv;Oe.NamedNodeBase=JD;Oe.NamedTupleMember=rF;Oe.NamedTupleMemberBase=E_e;Oe.NamespaceExport=xw;Oe.NamespaceExportBase=t_e;Oe.NamespaceImport=Dw;Oe.NamespaceImportBase=n_e;Oe.NewExpression=TM;Oe.NewExpressionBase=ume;Oe.NoSubstitutionTemplateLiteral=A6;Oe.NoSubstitutionTemplateLiteralBase=H_e;Oe.Node=Tr;Oe.NodeWithTypeArguments=WT;Oe.NodeWithTypeArgumentsBase=__e;Oe.NonNullExpression=xM;Oe.NonNullExpressionBase=cme;Oe.NotEmittedStatement=aw;Oe.NotEmittedStatementBase=Vme;Oe.NotImplementedError=fKe;Oe.NotSupportedError=pKe;Oe.NullLiteral=T6;Oe.NullLiteralBase=K_e;Oe.NumericLiteral=x6;Oe.NumericLiteralBase=W_e;Oe.ObjectBindingPattern=fM;Oe.ObjectDestructuringAssignment=GH;Oe.ObjectDestructuringAssignmentBase=dme;Oe.ObjectLiteralElement=KT;Oe.ObjectLiteralExpression=CM;Oe.ObjectLiteralExpressionBase=fme;Oe.OmittedExpression=IM;Oe.OmittedExpressionBase=pme;Oe.OutputFile=j6;Oe.OverloadableNode=cG;Oe.OverrideableNode=xL;Oe.ParameterDeclaration=Ow;Oe.ParameterDeclarationBase=DR;Oe.ParameteredNode=Jpe;Oe.ParenthesizedExpression=PM;Oe.ParenthesizedExpressionBase=mme;Oe.ParenthesizedTypeNode=tF;Oe.PartiallyEmittedExpression=OM;Oe.PartiallyEmittedExpressionBase=_me;Oe.PathNotFoundError=mKe;Oe.PostfixUnaryExpression=kM;Oe.PostfixUnaryExpressionBase=gme;Oe.PrefixUnaryExpression=RM;Oe.PrefixUnaryExpressionBase=yme;Oe.PrimaryExpression=sd;Oe.PrivateIdentifier=w6;Oe.PrivateIdentifierBase=Z_e;Oe.Program=X6;Oe.Project=$H;Oe.PropertyAccessExpression=uL;Oe.PropertyAccessExpressionBase=vme;Oe.PropertyAssignment=AM;Oe.PropertyAssignmentBase=mR;Oe.PropertyDeclaration=Bw;Oe.PropertyDeclarationBase=PR;Oe.PropertyNamedNode=UE;Oe.PropertySignature=l6;Oe.PropertySignatureBase=HR;Oe.QualifiedName=F6;Oe.QuestionDotTokenableNode=sG;Oe.QuestionTokenableNode=kh;Oe.ReadonlyableNode=DL;Oe.RefactorEditInfo=gL;Oe.ReferenceEntry=q6;Oe.ReferenceFindableNode=Oh;Oe.ReferencedSymbol=yL;Oe.ReferencedSymbolDefinitionInfo=vL;Oe.ReferencedSymbolEntry=J6;Oe.RegularExpressionLiteral=D6;Oe.RegularExpressionLiteralBase=V_e;Oe.RenameLocation=z6;Oe.RenameableNode=_v;Oe.ReturnStatement=ow;Oe.ReturnStatementBase=jme;Oe.ReturnTypedNode=uq;Oe.ScopeableNode=zpe;Oe.ScopedNode=gS;Oe.SetAccessorDeclaration=Uw;Oe.SetAccessorDeclarationBase=OR;Oe.ShorthandPropertyAssignment=LM;Oe.ShorthandPropertyAssignmentBase=_R;Oe.Signature=U6;Oe.SignaturedDeclaration=yv;Oe.SourceFile=kE;Oe.SourceFileBase=SR;Oe.SpreadAssignment=NM;Oe.SpreadAssignmentBase=gR;Oe.SpreadElement=MM;Oe.SpreadElementBase=hme;Oe.Statement=Cl;Oe.StatementBase=Lme;Oe.StatementedNode=Rh;Oe.StaticableNode=zD;Oe.StringLiteral=C6;Oe.StringLiteralBase=j_e;Oe.Structure=tL;Oe.SuperElementAccessExpression=BH;Oe.SuperElementAccessExpressionBase=Eme;Oe.SuperExpression=wM;Oe.SuperExpressionBase=bme;Oe.SuperExpressionedNode=fq;Oe.SuperPropertyAccessExpression=UH;Oe.SuperPropertyAccessExpressionBase=Sme;Oe.SwitchStatement=sw;Oe.SwitchStatementBase=Hme;Oe.Symbol=K6;Oe.SymbolDisplayPart=$6;Oe.SyntaxList=sM;Oe.TaggedTemplateExpression=L6;Oe.TemplateExpression=N6;Oe.TemplateExpressionBase=q_e;Oe.TemplateHead=I6;Oe.TemplateHeadBase=J_e;Oe.TemplateLiteralTypeNode=nF;Oe.TemplateMiddle=P6;Oe.TemplateMiddleBase=z_e;Oe.TemplateSpan=O6;Oe.TemplateSpanBase=$_e;Oe.TemplateTail=k6;Oe.TemplateTailBase=X_e;Oe.TextChange=FE;Oe.TextInsertableNode=ld;Oe.TextRange=iL;Oe.TextSpan=WD;Oe.ThisExpression=FM;Oe.ThisExpressionBase=Tme;Oe.ThisTypeNode=iF;Oe.ThrowStatement=lw;Oe.ThrowStatementBase=qme;Oe.TrueLiteral=b6;Oe.TrueLiteralBase=G_e;Oe.TryStatement=uw;Oe.TryStatementBase=Jme;Oe.TupleTypeNode=aF;Oe.Type=EL;Oe.TypeAliasDeclaration=oF;Oe.TypeAliasDeclarationBase=MR;Oe.TypeArgumentedNode=lG;Oe.TypeAssertion=GM;Oe.TypeAssertionBase=xme;Oe.TypeChecker=hL;Oe.TypeElement=wE;Oe.TypeElementMemberedNode=dq;Oe.TypeLiteralNode=sF;Oe.TypeLiteralNodeBase=b_e;Oe.TypeNode=wc;Oe.TypeOfExpression=BM;Oe.TypeOfExpressionBase=Dme;Oe.TypeOperatorTypeNode=lF;Oe.TypeParameter=Q6;Oe.TypeParameterDeclaration=uF;Oe.TypeParameterDeclarationBase=wR;Oe.TypeParameteredNode=z_;Oe.TypePredicateNode=cF;Oe.TypeQueryNode=dF;Oe.TypeReferenceNode=fF;Oe.TypedNode=KE;Oe.UnaryExpression=fv;Oe.UnaryExpressionedNode=XD;Oe.UnionTypeNode=pF;Oe.UnwrappableNode=uG;Oe.UpdateExpression=pM;Oe.VariableDeclaration=G6;Oe.VariableDeclarationBase=XR;Oe.VariableDeclarationList=B6;Oe.VariableDeclarationListBase=ege;Oe.VariableStatement=Cw;Oe.VariableStatementBase=TR;Oe.VoidExpression=UM;Oe.VoidExpressionBase=Cme;Oe.WhileStatement=Aw;Oe.WhileStatementBase=i_e;Oe.WithStatement=Lw;Oe.WithStatementBase=a_e;Oe.Writers=XH;Oe.YieldExpression=KM;Oe.YieldExpressionBase=Ame;Oe.createWrappedNode=eKe;Oe.forEachStructureChild=b9e;Oe.getCompilerOptionsFromTsConfig=O7e;Oe.getScopeForNode=uM;Oe.insertOverloads=dG;Oe.printNode=gj;Oe.setScopeForNode=cq});var bq=gt((nQe,_Ke)=>{_Ke.exports={name:"zenstack",publisher:"zenstack",displayName:"ZenStack Language Tools",description:"A toolkit for modeling data and access policies in full-stack development with Next.js and Typescript",version:"0.3.1",author:{name:"ZenStack Team"},license:"MIT",keywords:["fullstack","react","typescript","data modeling"],preview:!0,icon:"asset/logo-light-256.png",repository:{type:"git",url:"https://github.com/zenstackhq/zenstack"},engines:{vscode:"^1.56.0"},categories:["Programming Languages"],contributes:{languages:[{id:"zmodel",aliases:["ZenStack Model","zmodel"],extensions:[".zmodel"],configuration:"./language-configuration.json",icon:{light:"./asset/logo-light-256.png",dark:"./asset/logo-dark-256.png"}}],grammars:[{language:"zmodel",scopeName:"source.zmodel",path:"./syntaxes/zmodel.tmLanguage.json"}]},activationEvents:["onLanguage:zmodel"],files:["bin","src","bundle"],bin:{zenstack:"./bin/cli"},main:"./bundle/extension.js",scripts:{"vscode:publish":"vsce publish --no-dependencies","vscode:prepublish":"cp ../../README.md ./ && pnpm lint && pnpm build","vscode:package":"vsce package --no-dependencies",clean:"rimraf bundle",build:"pnpm langium:generate && tsc --noEmit && pnpm bundle && cp -r src/res/* bundle/res/",bundle:"npm run clean && node build/bundle.js --minify","bundle-watch":"node build/bundle.js --watch","ts:watch":"tsc --watch --noEmit","tsc-alias:watch":"tsc-alias --watch",lint:"eslint src --ext ts","langium:generate":"langium generate","langium:watch":"langium generate --watch",watch:'concurrently --kill-others "npm:langium:watch" "npm:bundle-watch"',test:"jest",prepublishOnly:"cp ../../README.md ./ && pnpm build"},dependencies:{"@zenstackhq/internal":"workspace:*","change-case":"^4.1.2",chevrotain:"^9.1.0",colors:"1.4.0",commander:"^8.3.0",langium:"^0.5.0",pluralize:"^8.0.0",prisma:"^4.5.0",promisify:"^0.0.3","ts-morph":"^16.0.0",uuid:"^9.0.0","vscode-jsonrpc":"^8.0.2","vscode-languageclient":"^8.0.2","vscode-languageserver":"^8.0.2","vscode-languageserver-textdocument":"^1.0.7","vscode-uri":"^3.0.6"},devDependencies:{"@prisma/internals":"^4.5.0","@types/jest":"^29.2.0","@types/node":"^14.18.32","@types/pluralize":"^0.0.29","@types/tmp":"^0.2.3","@types/uuid":"^8.3.4","@types/vscode":"^1.56.0","@typescript-eslint/eslint-plugin":"^5.42.0","@typescript-eslint/parser":"^5.42.0",concurrently:"^7.4.0",esbuild:"^0.15.12",eslint:"^8.27.0",jest:"^29.2.1","langium-cli":"^0.5.0",rimraf:"^3.0.2",tmp:"^0.2.1","ts-jest":"^29.0.3","ts-node":"^10.9.1","tsc-alias":"^1.7.0","tsconfig-paths-jest":"^0.0.1",typescript:"^4.8.4",vsce:"^2.13.0"}}});var vKe={};rCe(vKe,{default:()=>yKe,generateAction:()=>mge});module.exports=tCe(vKe);var vG=Ts(mQ());var _oe=Ts(DE()),foe="AbstractDeclaration";var p6e="Expression";var poe="ReferenceTarget";var HO="TypeDeclaration";var Hx="ArrayExpr";function qO(e){return av.isInstance(e,Hx)}var eK="Attribute";var goe="AttributeArg";var xA="BinaryExpr";var JO="DataModel";function Lm(e){return av.isInstance(e,JO)}var rK="DataModelField";function qx(e){return av.isInstance(e,rK)}var zO="DataSource";function yoe(e){return av.isInstance(e,zO)}var $O="Enum";function voe(e){return av.isInstance(e,$O)}var XO="EnumField";function Jx(e){return av.isInstance(e,XO)}var moe="Function";var m6e="FunctionParam";var zx="InvocationExpr";function DA(e){return av.isInstance(e,zx)}var Bb="LiteralExpr";function iv(e){return av.isInstance(e,Bb)}var Ub="MemberAccessExpr";function tK(e){return av.isInstance(e,Ub)}var CA="NullExpr";var Kb="ReferenceExpr";function Wb(e){return av.isInstance(e,Kb)}var $x="ThisExpr";function TT(e){return av.isInstance(e,$x)}var AA="UnaryExpr";var TA=class{getAllTypes(){return["AbstractDeclaration","Argument","ArrayExpr","Attribute","AttributeArg","AttributeParam","AttributeParamType","BinaryExpr","DataModel","DataModelAttribute","DataModelField","DataModelFieldAttribute","DataModelFieldType","DataSource","DataSourceField","Enum","EnumField","Expression","Function","FunctionParam","FunctionParamType","InvocationExpr","LiteralExpr","MemberAccessExpr","Model","NullExpr","ReferenceArg","ReferenceExpr","ReferenceTarget","ThisExpr","TypeDeclaration","UnaryExpr"]}isInstance(r,n){return(0,_oe.isAstNode)(r)&&this.isSubtype(r.$type,n)}isSubtype(r,n){if(r===n)return!0;switch(r){case Hx:case xA:case zx:case Bb:case Ub:case CA:case Kb:case $x:case AA:return this.isSubtype(p6e,n);case eK:case zO:case moe:return this.isSubtype(foe,n);case JO:case $O:return this.isSubtype(foe,n)||this.isSubtype(HO,n);case rK:case XO:case m6e:return this.isSubtype(poe,n);default:return!1}}getReferenceType(r){let n=`${r.container.$type}:${r.property}`;switch(n){case"AttributeParamType:reference":return HO;case"DataModelAttribute:decl":return eK;case"DataModelFieldAttribute:decl":return eK;case"DataModelFieldType:reference":return HO;case"FunctionParamType:reference":return HO;case"InvocationExpr:function":return moe;case"MemberAccessExpr:member":return rK;case"ReferenceExpr:target":return poe;default:throw new Error(`${n} is not a valid reference id.`)}}getTypeMetaData(r){switch(r){case"ArrayExpr":return{name:"ArrayExpr",mandatory:[{name:"items",type:"array"}]};case"Attribute":return{name:"Attribute",mandatory:[{name:"params",type:"array"}]};case"AttributeParam":return{name:"AttributeParam",mandatory:[{name:"default",type:"boolean"}]};case"AttributeParamType":return{name:"AttributeParamType",mandatory:[{name:"array",type:"boolean"},{name:"optional",type:"boolean"}]};case"DataModel":return{name:"DataModel",mandatory:[{name:"attributes",type:"array"},{name:"fields",type:"array"}]};case"DataModelAttribute":return{name:"DataModelAttribute",mandatory:[{name:"args",type:"array"}]};case"DataModelField":return{name:"DataModelField",mandatory:[{name:"attributes",type:"array"}]};case"DataModelFieldAttribute":return{name:"DataModelFieldAttribute",mandatory:[{name:"args",type:"array"}]};case"DataModelFieldType":return{name:"DataModelFieldType",mandatory:[{name:"array",type:"boolean"},{name:"optional",type:"boolean"}]};case"DataSource":return{name:"DataSource",mandatory:[{name:"fields",type:"array"}]};case"Enum":return{name:"Enum",mandatory:[{name:"fields",type:"array"}]};case"Function":return{name:"Function",mandatory:[{name:"params",type:"array"}]};case"FunctionParamType":return{name:"FunctionParamType",mandatory:[{name:"array",type:"boolean"}]};case"InvocationExpr":return{name:"InvocationExpr",mandatory:[{name:"args",type:"array"}]};case"Model":return{name:"Model",mandatory:[{name:"declarations",type:"array"}]};case"ReferenceExpr":return{name:"ReferenceExpr",mandatory:[{name:"args",type:"array"}]};default:return{name:r,mandatory:[]}}}},av=new TA;var hoe=Ts(DE()),YO,Eoe=()=>YO!=null?YO:YO=(0,hoe.loadGrammarFromJson)(`{
4252
+ `)}getTags(){var r,n;return(n=(r=this.compilerNode.tags)===null||r===void 0?void 0:r.map(i=>this._getNodeFromCompilerNode(i)))!==null&&n!==void 0?n:[]}getInnerText(){return VH(this.getText())}getComment(){if(this.compilerNode.comment!=null)return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:this.compilerNode.comment.map(r=>this._getNodeFromCompilerNodeIfExists(r))}getCommentText(){return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:b.ts.getTextOfJSDocComment(this.compilerNode.comment)}getDescription(){var r,n;let i=this.getSourceFile().getFullText(),a=(n=(r=this.getTags()[0])===null||r===void 0?void 0:r.getStart())!==null&&n!==void 0?n:this.getEnd()-2,s=u(this);return VH(i.substring(s,Math.max(s,p())));function u(f){let m=f.getStart()+3;return i.charCodeAt(m)===ac.SPACE?m+1:m}function p(){let f=dv(i,a,m=>m===ac.NEWLINE||!b.StringUtils.isWhitespaceCharCode(m)&&m!==ac.ASTERISK);return dv(i,f,m=>m!==ac.NEWLINE&&m!==ac.CARRIAGE_RETURN)}}setDescription(r){let n=this.getTags(),i=this.getStart()+3,a=n.length>0?dv(this._sourceFile.getFullText(),n[0].getStart(),u=>u===ac.ASTERISK)-1:this.getEnd()-2;return m9e({parent:this,newText:s.call(this),replacePos:i,replacingLength:a-i}),this;function s(){var u,p;let f=this.getIndentationText(),m=this._context.manipulationSettings.getNewLineKindAsString(),g=Yg(this._getWriter(),r).split(/\r?\n/),D=g[0].length===0,P=g.length===1&&((p=(u=this.compilerNode.tags)===null||u===void 0?void 0:u.length)!==null&&p!==void 0?p:0)===0,B=P?g[0]:g.map(K=>K.length===0?`${f} *`:`${f} * ${K}`).slice(D?1:0).join(m);return P?" "+B+" ":m+B+m+f+" "}}addTag(r){return this.addTags([r])[0]}addTags(r){var n,i;return this.insertTags((i=(n=this.compilerNode.tags)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,r)}insertTag(r,n){return this.insertTags(r,[n])[0]}insertTags(r,n){if(b.ArrayUtils.isNullOrEmpty(n))return[];let i=this._getWriterWithQueuedIndentation(),a=this.getTags();if(r=ku(r,a.length),a.length===0&&!this.isMultiLine()){let p=this._context.structurePrinterFactory.forJSDoc();this.replaceWithText(f=>{p.printText(f,{description:this.getDescription(),tags:n})})}else{let p=this._context.structurePrinterFactory.forJSDocTag({printStarsOnNewLine:!0});i.newLine().write(" * "),p.printTexts(i,n),i.newLine().write(" *"),i.conditionalWrite(r<a.length," ");let f=s.call(this),m=u.call(this);qa({parent:this,insertPos:f,replacing:{textLength:m-f},newText:i.toString()})}return af(a,this.getTags(),r,!1);function s(){let p=r<a.length?a[r].getStart():this.getEnd()-2,f=this.getStart()+3;return Math.max(f,dv(this.getSourceFile().getFullText(),p,m=>!b.StringUtils.isWhitespaceCharCode(m)&&m!==ac.ASTERISK))}function u(){return r<a.length?a[r].getStart():this.getEnd()-1}}remove(){Bs({children:[this],removeFollowingSpaces:!0,removeFollowingNewLines:!0})}set(r){return io(RR.prototype,this,r),r.tags!=null?this.replaceWithText(n=>{var i;this._context.structurePrinterFactory.forJSDoc().printText(n,{description:(i=r.description)!==null&&i!==void 0?i:this.getDescription(),tags:r.tags})}):(r.description!=null&&this.setDescription(r.description),this)}getStructure(){return uo(RR.prototype,this,{kind:Oe.StructureKind.JSDoc,description:this.getDescription(),tags:this.getTags().map(r=>r.getStructure())})}},wc=class extends Tr{},__e=lG(wc),WT=class extends __e{},Vw=class extends wc{getElementTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.elementType)}},jw=class extends wc{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)}},g_e=yv(wc),cL=class extends g_e{},y_e=yS(sf(cL)),Hw=class extends y_e{},v_e=YT(WT),qw=class extends v_e{},h_e=z_(cL),Jw=class extends h_e{},zw=class extends Tr{getAssertClause(){return this._getNodeFromCompilerNode(this.compilerNode.assertClause)}isMultiline(){var r;return(r=this.compilerNode.multiLine)!==null&&r!==void 0?r:!1}},$w=class extends WT{setArgument(r){let n=this.getArgument();if(Tr.isLiteralTypeNode(n)){let i=n.getLiteral();if(Tr.isStringLiteral(i))return i.setLiteralValue(r),this}return n.replaceWithText(i=>i.quote(r),this._getWriterWithQueuedChildIndentation()),this}getArgument(){return this._getNodeFromCompilerNode(this.compilerNode.argument)}setQualifier(r){let n=this.getQualifier();if(n!=null)n.replaceWithText(r,this._getWriterWithQueuedChildIndentation());else{let i=this.getFirstChildByKindOrThrow(b.SyntaxKind.CloseParenToken);qa({insertPos:i.getEnd(),parent:this,newText:this._getWriterWithQueuedIndentation().write(".").write(r).toString()})}return this}getQualifierOrThrow(){return b.errors.throwIfNullOrUndefined(this.getQualifier(),()=>`Expected to find a qualifier for the import type: ${this.getText()}`)}getQualifier(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.qualifier)}getAssertions(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertions)}getAssertionsOrThrow(){return b.errors.throwIfNullOrUndefined(this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertions),"Could not find import type assertion container.")}},Xw=class extends wc{getObjectTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.objectType)}getIndexTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.indexType)}},Yw=class extends wc{getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}},Qw=class extends wc{getTypeNodes(){return this.compilerNode.types.map(r=>this._getNodeFromCompilerNode(r))}},Zw=class extends wc{getLiteral(){let r=this.compilerNode.literal;return this._getNodeFromCompilerNode(r)}},eF=class extends wc{getNameTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.nameType)}getNameTypeNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getNameTypeNode(),"Type did not exist.")}getReadonlyToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.readonlyToken)}getReadonlyTokenOrThrow(){return b.errors.throwIfNullOrUndefined(this.getReadonlyToken(),"Readonly token did not exist.")}getQuestionToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.questionToken)}getQuestionTokenOrThrow(){return b.errors.throwIfNullOrUndefined(this.getQuestionToken(),"Question token did not exist.")}getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getTypeNode(),"Type did not exist, but was expected to exist.")}},BUe=e=>KE(kh(SL(sc(gv(e))))),E_e=BUe(wc),rF=class extends E_e{getTypeNode(){return super.getTypeNode()}removeType(){throw new b.errors.InvalidOperationError("Cannot remove the type of a named tuple member.")}},tF=class extends wc{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}setType(r){return this.getTypeNode().replaceWithText(r),this}},nF=class extends wc{getHead(){return this._getNodeFromCompilerNode(this.compilerNode.head)}getTemplateSpans(){return this.compilerNode.templateSpans.map(r=>this._getNodeFromCompilerNode(r))}setLiteralValue(r){var n;let i=this.getChildIndex(),a=(n=this.getParentSyntaxList())!==null&&n!==void 0?n:this.getParentOrThrow();return _S({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:r}),a.getChildAtIndex(i)}},iF=class extends wc{},aF=class extends wc{getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}},UUe=e=>z_(KE(sc(Ih(BE(sf(gv(e))))))),MR=UUe(Cl),oF=class extends MR{set(r){return io(MR.prototype,this,r),this}getStructure(){return uo(MR.prototype,this,{kind:Oe.StructureKind.TypeAlias,type:this.getTypeNodeOrThrow().getText()})}},b_e=dq(wc),sF=class extends b_e{},lF=class extends wc{getOperator(){return this.compilerNode.operator}getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}};Oe.TypeParameterVariance=void 0;(function(e){e[e.None=0]="None",e[e.In=1]="In",e[e.Out=2]="Out",e[e.InOut=3]="InOut"})(Oe.TypeParameterVariance||(Oe.TypeParameterVariance={}));var wR=sf(gv(Tr)),uF=class extends wR{getConstraint(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.constraint)}getConstraintOrThrow(){return b.errors.throwIfNullOrUndefined(this.getConstraint(),"Expected to find the type parameter's constraint.")}setConstraint(r){if(r=this.getParentOrThrow()._getTextWithQueuedChildIndentation(r),b.StringUtils.isNullOrWhitespace(r))return this.removeConstraint(),this;let n=this.getConstraint();if(n!=null)return n.replaceWithText(r),this;let i=this.getNameNode();return qa({parent:this,insertPos:i.getEnd(),newText:` extends ${r}`}),this}removeConstraint(){return dpe(this.getConstraint(),b.SyntaxKind.ExtendsKeyword),this}getDefault(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.default)}getDefaultOrThrow(){return b.errors.throwIfNullOrUndefined(this.getDefault(),"Expected to find the type parameter's default.")}setDefault(r){if(r=this.getParentOrThrow()._getTextWithQueuedChildIndentation(r),b.StringUtils.isNullOrWhitespace(r))return this.removeDefault(),this;let n=this.getDefault();if(n!=null)return n.replaceWithText(r),this;let i=this.getConstraint()||this.getNameNode();return qa({parent:this,insertPos:i.getEnd(),newText:` = ${r}`}),this}removeDefault(){return dpe(this.getDefault(),b.SyntaxKind.EqualsToken),this}setVariance(r){return this.toggleModifier("in",(r&Oe.TypeParameterVariance.In)!==0),this.toggleModifier("out",(r&Oe.TypeParameterVariance.Out)!==0),this}getVariance(){let r=Oe.TypeParameterVariance.None;return this.hasModifier("in")&&(r|=Oe.TypeParameterVariance.In),this.hasModifier("out")&&(r|=Oe.TypeParameterVariance.Out),r}remove(){let r=this.getParentSyntaxListOrThrow();r.getChildrenOfKind(b.SyntaxKind.TypeParameter).length===1?i():mv(this);function i(){let a=[r.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.LessThanToken),r,r.getNextSiblingIfKindOrThrow(b.SyntaxKind.GreaterThanToken)];Bs({children:a})}}set(r){return io(wR.prototype,this,r),r.constraint!=null?this.setConstraint(r.constraint):r.hasOwnProperty(b.nameof(r,"constraint"))&&this.removeConstraint(),r.default!=null?this.setDefault(r.default):r.hasOwnProperty(b.nameof(r,"default"))&&this.removeDefault(),r.variance!=null&&this.setVariance(r.variance),this}getStructure(){let r=this.getConstraint(),n=this.getDefault();return uo(wR.prototype,this,{kind:Oe.StructureKind.TypeParameter,constraint:r?.getText({trimLeadingIndentation:!0}),default:n?n.getText({trimLeadingIndentation:!0}):void 0,variance:this.getVariance()})}};function dpe(e,r){e!=null&&Bs({children:[e.getPreviousSiblingIfKindOrThrow(r),e],removePrecedingSpaces:!0})}var cF=class extends wc{getParameterNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.parameterName)}hasAssertsModifier(){return this.compilerNode.assertsModifier!=null}getAssertsModifier(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertsModifier)}getAssertsModifierOrThrow(){return b.errors.throwIfNullOrUndefined(this.getAssertsModifier(),"Expected to find an asserts modifier.")}getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getTypeNode(),"Expected to find a type node.")}},dF=class extends WT{getExprName(){return this._getNodeFromCompilerNode(this.compilerNode.exprName)}},fF=class extends WT{getTypeName(){return this._getNodeFromCompilerNode(this.compilerNode.typeName)}},pF=class extends wc{getTypeNodes(){return this.compilerNode.types.map(r=>this._getNodeFromCompilerNode(r))}},J_=class extends wc{},mF=class extends J_{},FR=Tr,bc=class extends FR{getTagName(){return this.getTagNameNode().getText()}getTagNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.tagName)}setTagName(r){return this.set({tagName:r})}getComment(){if(this.compilerNode.comment!=null)return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:this.compilerNode.comment.map(r=>this._getNodeFromCompilerNodeIfExists(r))}getCommentText(){return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:b.ts.getTextOfJSDocComment(this.compilerNode.comment)}remove(){let r=this.getParentOrThrow().getStart()+3,n=x_e(this),i=n==null,a=s.call(this);Bs({children:[this],customRemovalPos:a,customRemovalEnd:T_e(this,n),replaceTrivia:u.call(this)});function s(){return Math.max(r,D_e(this,this.getStart()))}function u(){if(a===r&&i)return"";let p=this._context.manipulationSettings.getNewLineKindAsString(),f=this.getParentOrThrow().getIndentationText();return`${p}${f} `+(i?"":"* ")}}set(r){return io(FR.prototype,this,r),r.text!=null||r.tagName!=null?this.replaceWithText(n=>{var i;this._context.structurePrinterFactory.forJSDocTag({printStarsOnNewLine:!0}).printText(n,{tagName:(i=r.tagName)!==null&&i!==void 0?i:this.getTagName(),text:r.text!=null?r.text:fpe(this)})}):this}replaceWithText(r){let n=Yg(this._getWriterWithQueuedIndentation(),r),i=this.getParentOrThrow(),a=this.getChildIndex(),s=this.getStart();return qa({parent:i,insertPos:s,newText:n,replacing:{textLength:S_e(this)-s}}),i.getChildren()[a]}getStructure(){let r=fpe(this);return uo(FR.prototype,this,{kind:Oe.StructureKind.JSDocTag,tagName:this.getTagName(),text:r.length===0?void 0:r})}};function fpe(e){let r=e.getSourceFile().getFullText(),n=e.getTagNameNode().getEnd(),i=S_e(e),a=Math.min(r.charCodeAt(n)===ac.SPACE?n+1:n,i);return VH(r.substring(a,i))}function S_e(e){return D_e(e,T_e(e))}function T_e(e,r){return r=r??x_e(e),r!=null?r.getStart():e.getParentOrThrow().getEnd()-2}function x_e(e){let n=e.getParentIfKindOrThrow(b.SyntaxKind.JSDoc).getTags(),i=n.indexOf(e);return n[i+1]}function D_e(e,r){let n=e.getSourceFile().getFullText();return dv(n,r,i=>i!==ac.ASTERISK&&!b.StringUtils.isWhitespaceCharCode(i))}var _F=class extends bc{},gF=class extends bc{},yF=class extends bc{},vF=class extends bc{},hF=class extends bc{},EF=class extends bc{},C_e=yv(J_),bF=class extends C_e{},SF=class extends bc{},TF=class extends Tr{},xF=class extends Tr{},DF=class extends Tr{},CF=class extends Tr{},AF=class extends J_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},LF=class extends Tr{getName(){return this._getNodeFromCompilerNode(this.compilerNode.name)}},NF=class extends J_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}isPostfix(){return this.compilerNode.postfix}},IF=class extends J_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}isPostfix(){return this.compilerNode.postfix}},PF=class extends J_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},OF=class extends bc{},A_e=mq(bc),kF=class extends A_e{},RF=class extends bc{},L_e=mq(bc),MF=class extends L_e{},wF=class extends bc{},FF=class extends bc{},GF=class extends bc{},N_e=fG(bc),BF=class extends N_e{},I_e=fG(bc),UF=class extends I_e{},KF=class extends J_{getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}},dL=class{constructor(r){this._compilerObject=r}get compilerObject(){return this._compilerObject}getName(){return this.compilerObject.name}getText(){var r;return(r=this.compilerObject.text)!==null&&r!==void 0?r:[]}},P_e=m_e(bc),WF=class extends P_e{getConstraint(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.constraint)}getConstraintOrThrow(){return b.errors.throwIfNullOrUndefined(this.getConstraint(),"Expected to find the JS doc template tag's constraint.")}},VF=class extends Tr{},O_e=fG(bc),jF=class extends O_e{},HF=class extends bc{},qF=class extends wc{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},JF=class extends J_{isArrayType(){return this.compilerNode.isArrayType}getPropertyTags(){return this.compilerNode.jsDocPropertyTags?this.compilerNode.jsDocPropertyTags.map(r=>this._getNodeFromCompilerNode(r)):void 0}},zF=class extends bc{getTypeExpression(){let r=this.compilerNode.typeExpression;if(!(r!=null&&r.pos===r.end))return this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression)}},$F=class extends bc{},XF=class extends J_{},YF=class extends J_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},QF=class extends Tr{remove(){Lh({children:[this],getSiblingFormatting:()=>El.Newline})}},KUe=e=>ld(vS(sc(Ih(BE(sf(gv(e))))))),GR=KUe(Cl),ZF=class extends GR{set(r){return io(GR.prototype,this,r),r.isConst!=null&&this.setIsConstEnum(r.isConst),r.members!=null&&(this.getMembers().forEach(n=>n.remove()),this.addMembers(r.members)),this}addMember(r){return this.addMembers([r])[0]}addMembers(r){return this.insertMembers(this.getMembers().length,r)}insertMember(r,n){return this.insertMembers(r,[n])[0]}insertMembers(r,n){if(n.length===0)return[];let i=this.getMembersWithComments();r=ku(r,i.length);let a=this._getWriterWithChildIndentation();return this._context.structurePrinterFactory.forEnumMember().printTexts(a,n),H_({parent:this.getChildSyntaxListOrThrow(),currentNodes:i,insertIndex:r,newText:a.toString(),useNewLines:!0,useTrailingCommas:this._context.manipulationSettings.getUseTrailingCommas()}),af(i,this.getMembersWithComments(),r,!u());function u(){return n instanceof Array?n.every(p=>typeof p=="object"):!1}}getMember(r){return ic(this.getMembers(),r)}getMemberOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getMember(r),()=>Ou("enum member",r))}getMembers(){return this.compilerNode.members.map(r=>this._getNodeFromCompilerNode(r))}getMembersWithComments(){let r=this.compilerNode;return od.getContainerArray(r,this.getSourceFile().compilerNode).map(n=>this._getNodeFromCompilerNode(n))}setIsConstEnum(r){return this.toggleModifier("const",r)}isConstEnum(){return this.getConstKeyword()!=null}getConstKeyword(){return this.getFirstModifierByKind(b.SyntaxKind.ConstKeyword)}getStructure(){return uo(GR.prototype,this,{kind:Oe.StructureKind.Enum,isConst:this.isConstEnum(),members:this.getMembers().map(r=>r.getStructure())})}},WUe=e=>sc(XT(UE(e))),BR=WUe(Tr),e6=class extends BR{getValue(){return this._context.typeChecker.getConstantValue(this)}setValue(r){let n;if(typeof r=="string"){let i=this._context.manipulationSettings.getQuoteKind();n=i+b.StringUtils.escapeForWithinString(r,i)+i}else n=r.toString();return this.setInitializer(n),this}remove(){let r=[this],n=this.getNextSiblingIfKind(b.SyntaxKind.CommaToken);n!=null&&r.push(n),Lh({children:r,getSiblingFormatting:()=>El.Newline})}set(r){return io(BR.prototype,this,r),r.value!=null?this.setValue(r.value):r.hasOwnProperty(b.nameof(r,"value"))&&r.initializer==null&&this.removeInitializer(),this}getStructure(){return uo(BR.prototype,this,{kind:Oe.StructureKind.EnumMember,value:void 0})}},r6=class extends Tr{getTypeNodes(){var r,n;return(n=(r=this.compilerNode.types)===null||r===void 0?void 0:r.map(i=>this._getNodeFromCompilerNode(i)))!==null&&n!==void 0?n:[]}getToken(){return this.compilerNode.token}removeExpression(r){let n=this.getTypeNodes(),i=typeof r=="number"?a(r):r;if(n.length===1){let s=this.getParentSyntaxListOrThrow().getChildren();s.length===1?Bs({children:[s[0].getParentSyntaxListOrThrow()],removePrecedingSpaces:!0}):Bs({children:[this],removePrecedingSpaces:!0})}else mv(i);return this;function a(s){return n[ku(s,n.length-1)]}}},wE=class extends Tr{remove(){l9e(this)}},VUe=e=>z_(Im(sc(yv(e)))),UR=VUe(wE),t6=class extends UR{set(r){return io(UR.prototype,this,r),this}getStructure(){return uo(UR.prototype,this,{kind:Oe.StructureKind.CallSignature})}},n6=class extends wE{},jUe=e=>z_(Im(sc(yv(e)))),KR=jUe(wE),i6=class extends KR{set(r){return io(KR.prototype,this,r),this}getStructure(){return uo(KR.prototype,this,{kind:Oe.StructureKind.ConstructSignature})}},HUe=e=>uq(Im(sc(DL(sf(e))))),WR=HUe(wE),a6=class extends WR{getKeyName(){return this.getKeyNameNode().getText()}setKeyName(r){b.errors.throwIfWhitespaceOrNotString(r,"name"),this.getKeyName()!==r&&this.getKeyNameNode().replaceWithText(r,this._getWriterWithQueuedChildIndentation())}getKeyNameNode(){let r=this.compilerNode.parameters[0];return this._getNodeFromCompilerNode(r.name)}getKeyType(){return this.getKeyNameNode().getType()}setKeyType(r){b.errors.throwIfWhitespaceOrNotString(r,"type");let n=this.getKeyTypeNode();return n.getText()===r?this:(n.replaceWithText(r,this._getWriterWithQueuedChildIndentation()),this)}getKeyTypeNode(){let r=this.compilerNode.parameters[0];return this._getNodeFromCompilerNode(r.type)}set(r){return io(WR.prototype,this,r),r.keyName!=null&&this.setKeyName(r.keyName),r.keyType!=null&&this.setKeyType(r.keyType),this}getStructure(){let r=this.getKeyTypeNode();return uo(WR.prototype,this,{kind:Oe.StructureKind.IndexSignature,keyName:this.getKeyName(),keyType:r.getText()})}},qUe=e=>dq(ld(Vpe(sq(z_(sc(Ih(vS(BE(sf(gv(e))))))))))),VR=qUe(Cl),o6=class extends VR{getBaseTypes(){return this.getType().getBaseTypes()}getBaseDeclarations(){return b.ArrayUtils.flatten(this.getType().getBaseTypes().map(r=>{var n,i;return(i=(n=r.getSymbol())===null||n===void 0?void 0:n.getDeclarations())!==null&&i!==void 0?i:[]}))}getImplementations(){return this.getNameNode().getImplementations()}set(r){return io(VR.prototype,this,r),this}getStructure(){return uo(VR.prototype,this,{kind:Oe.StructureKind.Interface})}},JUe=e=>Im(sc(kh(z_(yv(UE(e)))))),jR=JUe(wE),s6=class extends jR{set(r){return io(jR.prototype,this,r),this}getStructure(){return uo(jR.prototype,this,{kind:Oe.StructureKind.MethodSignature})}},zUe=e=>Im(sc(DL(kh(XT(KE(UE(sf(e)))))))),HR=zUe(wE),l6=class extends HR{set(r){return io(HR.prototype,this,r),this}getStructure(){return uo(HR.prototype,this,{kind:Oe.StructureKind.PropertySignature})}};function _q(e){return class extends e{getAttributes(){return this.compilerNode.attributes.properties.map(r=>this._getNodeFromCompilerNode(r))}getAttributeOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getAttribute(r),()=>Ou("attribute",r))}getAttribute(r){return ic(this.getAttributes(),r)}addAttribute(r){return this.addAttributes([r])[0]}addAttributes(r){return this.insertAttributes(this.compilerNode.attributes.properties.length,r)}insertAttribute(r,n){return this.insertAttributes(r,[n])[0]}insertAttributes(r,n){if(n.length===0)return[];let i=this.compilerNode.attributes.properties.length;r=ku(r,i);let a=r===0?this.getTagNameNode().getEnd():this.getAttributes()[r-1].getEnd(),s=this._getWriterWithQueuedChildIndentation();return new jj(this._context.structurePrinterFactory.forJsxAttributeDecider()).printText(s,n),qa({insertPos:a,newText:" "+s.toString(),parent:this.getNodeProperty("attributes").getFirstChildByKindOrThrow(b.SyntaxKind.SyntaxList)}),af(i,this.getAttributes(),r,!1)}set(r){return io(e.prototype,this,r),r.attributes!=null&&(this.getAttributes().forEach(n=>n.remove()),this.addAttributes(r.attributes)),this}getStructure(){return uo(e.prototype,this,{attributes:this.getAttributes().map(r=>r.getStructure())})}}}function pG(e){return class extends e{getTagNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.tagName)}set(r){return io(e.prototype,this,r),r.name!=null&&this.getTagNameNode().replaceWithText(r.name),this}getStructure(){return uo(e.prototype,this,{name:this.getTagNameNode().getText()})}}}var qR=gv(Tr),u6=class extends qR{getInitializerOrThrow(){return b.errors.throwIfNullOrUndefined(this.getInitializer(),`Expected to find an initializer for the JSX attribute '${this.getName()}'`)}getInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.initializer)}setInitializer(r){let n=Yg(this._getWriterWithQueuedIndentation(),r);if(b.StringUtils.isNullOrWhitespace(n))return this.removeInitializer(),this;let i=this.getInitializer();return i!=null?(i.replaceWithText(n),this):(qa({insertPos:this.getNameNode().getEnd(),parent:this,newText:`=${n}`}),this)}removeInitializer(){let r=this.getInitializer();return r==null?this:(Bs({children:[r.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.EqualsToken),r],removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this)}remove(){Bs({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(r){return io(qR.prototype,this,r),r.initializer!=null?this.setInitializer(r.initializer):r.hasOwnProperty(b.nameof(r,"initializer"))&&this.removeInitializer(),this}getStructure(){let r=this.getInitializer();return uo(qR.prototype,this,{kind:Oe.StructureKind.JsxAttribute,initializer:r?.getText()})}},$Ue=e=>pG(e),k_e=$Ue(Tr),c6=class extends k_e{},d6=class extends oc{},JR=sd,f6=class extends JR{getJsxChildren(){return this.compilerNode.children.map(r=>this._getNodeFromCompilerNode(r))}getOpeningElement(){return this._getNodeFromCompilerNode(this.compilerNode.openingElement)}getClosingElement(){return this._getNodeFromCompilerNode(this.compilerNode.closingElement)}setBodyText(r){let n=Fpe(this._getWriterWithIndentation(),r);return ppe(this,n),this}setBodyTextInline(r){let n=this._getWriterWithQueuedChildIndentation();return GE(n,r),n.isLastNewLine()&&(n.setIndentationLevel(Math.max(0,this.getIndentationLevel()-1)),n.write("")),ppe(this,n.toString()),this}set(r){if(io(JR.prototype,this,r),r.attributes!=null){let n=this.getOpeningElement();n.getAttributes().forEach(i=>i.remove()),n.addAttributes(r.attributes)}if(r.children!=null)throw new b.errors.NotImplementedError("Setting JSX children is currently not implemented. Please open an issue if you need this.");return r.bodyText!=null?this.setBodyText(r.bodyText):r.hasOwnProperty(b.nameof(r,"bodyText"))&&this.setBodyTextInline(""),r.name!=null&&(this.getOpeningElement().getTagNameNode().replaceWithText(r.name),this.getClosingElement().getTagNameNode().replaceWithText(r.name)),this}getStructure(){let r=this.getOpeningElement(),n=uo(JR.prototype,this,{kind:Oe.StructureKind.JsxElement,name:r.getTagNameNode().getText(),attributes:r.getAttributes().map(i=>i.getStructure()),children:void 0,bodyText:nq(this)});return delete n.children,n}};function ppe(e,r){let n=e.getOpeningElement(),i=e.getClosingElement();qa({insertPos:n.getEnd(),newText:r,parent:e.getChildSyntaxListOrThrow(),replacing:{textLength:i.getStart()-n.getEnd()}})}var R_e=CL(SL(oc)),p6=class extends R_e{},m6=class extends sd{getJsxChildren(){return this.compilerNode.children.map(r=>this._getNodeFromCompilerNode(r))}getOpeningFragment(){return this._getNodeFromCompilerNode(this.compilerNode.openingFragment)}getClosingFragment(){return this._getNodeFromCompilerNode(this.compilerNode.closingFragment)}},XUe=e=>_q(pG(e)),M_e=XUe(oc),_6=class extends M_e{},g6=class extends oc{},YUe=e=>_q(pG(e)),zR=YUe(sd),y6=class extends zR{set(r){return io(zR.prototype,this,r),this}getStructure(){return uo(zR.prototype,this,{kind:Oe.StructureKind.JsxSelfClosingElement})}},$R=ud(Tr),v6=class extends $R{remove(){Bs({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(r){return io($R.prototype,this,r),r.expression!=null&&this.setExpression(r.expression),this}getStructure(){return uo($R.prototype,this,{kind:Oe.StructureKind.JsxSpreadAttribute,expression:this.getExpression().getText()})}},w_e=qD(Tr),h6=class extends w_e{containsOnlyTriviaWhiteSpaces(){let r=this.compilerNode;return typeof r.containsOnlyWhiteSpaces=="boolean"?r.containsOnlyWhiteSpaces:this.compilerNode.containsOnlyTriviaWhiteSpaces}},F_e=dS,E6=class extends F_e{getLiteralValue(){let r=this.compilerNode.text;if(typeof BigInt>"u")throw new b.errors.InvalidOperationError("Runtime environment does not support BigInts. Perhaps work with the text instead?");let n=r.substring(0,r.length-1);return BigInt(n)}setLiteralValue(r){if(typeof r!="bigint")throw new b.errors.ArgumentTypeError("value","bigint",typeof r);return _S({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:r.toString()+"n"}),this}},G_e=sd,b6=class extends G_e{getLiteralValue(){return gq(this)}setLiteralValue(r){return U_e(this,r)}},B_e=sd,S6=class extends B_e{getLiteralValue(){return gq(this)}setLiteralValue(r){return U_e(this,r)}};function U_e(e,r){if(gq(e)===r)return e;let n=e.getParentSyntaxList()||e.getParentOrThrow(),i=e.getChildIndex();return e.replaceWithText(r?"true":"false"),n.getChildAtIndex(i)}function gq(e){return e.getKind()===b.SyntaxKind.TrueKeyword}var K_e=sd,T6=class extends K_e{},W_e=dS,x6=class extends W_e{getLiteralValue(){let r=this.compilerNode.text;return r.indexOf(".")>=0?parseFloat(r):parseInt(r,10)}setLiteralValue(r){return _S({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:r.toString(10)}),this}};Oe.QuoteKind=void 0;(function(e){e.Single="'",e.Double='"'})(Oe.QuoteKind||(Oe.QuoteKind={}));var V_e=dS,D6=class extends V_e{getLiteralValue(){let r=/^\/(.*)\/([^\/]*)$/,n=this.compilerNode.text,i=r.exec(n);return new RegExp(i[1],i[2])}setLiteralValue(r,n){let i;return typeof r=="string"?i=r:(i=r.source,n=r.flags),_S({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:`/${i}/${n||""}`}),this}},j_e=dS,C6=class extends j_e{getLiteralValue(){return this.compilerNode.text}setLiteralValue(r){return _S({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:b.StringUtils.escapeForWithinString(r,this.getQuoteKind())}),this}getQuoteKind(){return this.getText()[0]==="'"?Oe.QuoteKind.Single:Oe.QuoteKind.Double}},H_e=dS,A6=class extends H_e{getLiteralValue(){return this.compilerNode.text}setLiteralValue(r){let n=this.getChildIndex(),i=this.getParentSyntaxList()||this.getParentOrThrow();return _S({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:r}),i.getChildAtIndex(n)}},L6=class extends UT{getTag(){return this._getNodeFromCompilerNode(this.compilerNode.tag)}getTemplate(){return this._getNodeFromCompilerNode(this.compilerNode.template)}removeTag(){var r;let n=(r=this.getParentSyntaxList())!==null&&r!==void 0?r:this.getParentOrThrow(),i=this.getChildIndex(),a=this.getTemplate();return qa({customMappings:(s,u)=>[{currentNode:a,newNode:s.getChildren(u)[i]}],parent:n,insertPos:this.getStart(),newText:this.getTemplate().getText(),replacing:{textLength:this.getWidth(),nodes:[this]}}),n.getChildAtIndex(i)}},q_e=sd,N6=class extends q_e{getHead(){return this._getNodeFromCompilerNode(this.compilerNode.head)}getTemplateSpans(){return this.compilerNode.templateSpans.map(r=>this._getNodeFromCompilerNode(r))}setLiteralValue(r){var n;let i=this.getChildIndex(),a=(n=this.getParentSyntaxList())!==null&&n!==void 0?n:this.getParentOrThrow();return _S({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:r}),a.getChildAtIndex(i)}},J_e=qD(Tr),I6=class extends J_e{},z_e=qD(Tr),P6=class extends z_e{},$_e=ud(Tr),O6=class extends $_e{getLiteral(){return this._getNodeFromCompilerNode(this.compilerNode.literal)}},X_e=qD(Tr),k6=class extends X_e{};function yq(e){return class extends e{getText(){return this.compilerNode.text}getDefinitionNodes(){return this.getDefinitions().map(r=>r.getDeclarationNode()).filter(r=>r!=null)}getDefinitions(){return this._context.languageService.getDefinitions(this)}}}var Y_e=ud(Tr),R6=class extends Y_e{},Q_e=yq(Oh(_v(sd))),M6=class extends Q_e{getImplementations(){return this._context.languageService.getImplementations(this)}},Z_e=yq(Oh(_v(Tr))),w6=class extends Z_e{},F6=class extends Tr{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}getRight(){return this._getNodeFromCompilerNode(this.compilerNode.right)}},QUe=e=>aq(iq(KE(XT(aG(e))))),XR=QUe(Tr),G6=class extends XR{remove(){let r=this.getParentOrThrow();switch(r.getKind()){case b.SyntaxKind.VariableDeclarationList:n(this);break;case b.SyntaxKind.CatchClause:i(this);break;default:throw new b.errors.NotImplementedError(`Not implemented for syntax kind: ${r.getKindName()}`)}function n(a){let s=r.getParentIfKindOrThrow(b.SyntaxKind.VariableStatement);s.getDeclarations().length===1?s.remove():mv(a)}function i(a){Bs({children:[a.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.OpenParenToken),a,a.getNextSiblingIfKindOrThrow(b.SyntaxKind.CloseParenToken)],removePrecedingSpaces:!0})}}getVariableStatementOrThrow(){return b.errors.throwIfNullOrUndefined(this.getVariableStatement(),"Expected the grandparent to be a variable statement.")}getVariableStatement(){let r=this.getParentOrThrow().getParentOrThrow();return Tr.isVariableStatement(r)?r:void 0}set(r){return io(XR.prototype,this,r),this}getStructure(){return uo(XR.prototype,this,{kind:Oe.StructureKind.VariableDeclaration})}},ege=sf(Tr),B6=class extends ege{getDeclarations(){return this.compilerNode.declarations.map(r=>this._getNodeFromCompilerNode(r))}getDeclarationKind(){let r=this.compilerNode.flags;return r&b.ts.NodeFlags.Let?Oe.VariableDeclarationKind.Let:r&b.ts.NodeFlags.Const?Oe.VariableDeclarationKind.Const:Oe.VariableDeclarationKind.Var}getDeclarationKindKeyword(){let r=this.getDeclarationKind();switch(r){case Oe.VariableDeclarationKind.Const:return this.getFirstChildByKindOrThrow(b.SyntaxKind.ConstKeyword);case Oe.VariableDeclarationKind.Let:return this.getFirstChildByKindOrThrow(b.SyntaxKind.LetKeyword);case Oe.VariableDeclarationKind.Var:return this.getFirstChildByKindOrThrow(b.SyntaxKind.VarKeyword);default:return b.errors.throwNotImplementedForNeverValueError(r)}}setDeclarationKind(r){if(this.getDeclarationKind()===r)return this;let n=this.getDeclarationKindKeyword();return qa({insertPos:n.getStart(),newText:r,parent:this,replacing:{textLength:n.getWidth()}}),this}addDeclaration(r){return this.addDeclarations([r])[0]}addDeclarations(r){return this.insertDeclarations(this.getDeclarations().length,r)}insertDeclaration(r,n){return this.insertDeclarations(r,[n])[0]}insertDeclarations(r,n){let i=this._getWriterWithQueuedChildIndentation(),a=new Nh(this._context.structurePrinterFactory.forVariableDeclaration()),s=this.compilerNode.declarations.length;return r=ku(r,s),a.printText(i,n),H_({parent:this.getFirstChildByKindOrThrow(b.SyntaxKind.SyntaxList),currentNodes:this.getDeclarations(),insertIndex:r,newText:i.toString(),useTrailingCommas:!1}),af(s,this.getDeclarations(),r,!1)}},U6=class{constructor(r,n){this._context=r,this._compilerSignature=n}get compilerSignature(){return this._compilerSignature}getTypeParameters(){return(this.compilerSignature.typeParameters||[]).map(n=>this._context.compilerFactory.getTypeParameter(n))}getParameters(){return this.compilerSignature.parameters.map(r=>this._context.compilerFactory.getSymbol(r))}getReturnType(){return this._context.compilerFactory.getType(this.compilerSignature.getReturnType())}getDocumentationComments(){return this.compilerSignature.getDocumentationComment(this._context.typeChecker.compilerObject).map(n=>this._context.compilerFactory.getSymbolDisplayPart(n))}getJsDocTags(){return this.compilerSignature.getJsDocTags().map(n=>this._context.compilerFactory.getJSDocTagInfo(n))}getDeclaration(){let{compilerFactory:r}=this._context,n=this.compilerSignature.getDeclaration();return r.getNodeFromCompilerNode(n,r.getSourceFileForNode(n))}},K6=class{constructor(r,n){this._context=r,this._compilerSymbol=n,this.getValueDeclaration(),this.getDeclarations()}get compilerSymbol(){return this._compilerSymbol}getName(){return this.compilerSymbol.getName()}getEscapedName(){return this.compilerSymbol.getEscapedName()}getAliasedSymbolOrThrow(){return b.errors.throwIfNullOrUndefined(this.getAliasedSymbol(),"Expected to find an aliased symbol.")}getImmediatelyAliasedSymbol(){return this._context.typeChecker.getImmediatelyAliasedSymbol(this)}getImmediatelyAliasedSymbolOrThrow(){return b.errors.throwIfNullOrUndefined(this.getImmediatelyAliasedSymbol(),"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()&b.SymbolFlags.Alias)===b.SymbolFlags.Alias}isOptional(){return(this.getFlags()&b.SymbolFlags.Optional)===b.SymbolFlags.Optional}getFlags(){return this.compilerSymbol.getFlags()}hasFlags(r){return(this.compilerSymbol.flags&r)===r}getValueDeclarationOrThrow(){return b.errors.throwIfNullOrUndefined(this.getValueDeclaration(),()=>`Expected to find the value declaration of symbol '${this.getName()}'.`)}getValueDeclaration(){let r=this.compilerSymbol.valueDeclaration;if(r!=null)return this._context.compilerFactory.getNodeFromCompilerNode(r,this._context.compilerFactory.getSourceFileForNode(r))}getDeclarations(){var r;return((r=this.compilerSymbol.declarations)!==null&&r!==void 0?r:[]).map(n=>this._context.compilerFactory.getNodeFromCompilerNode(n,this._context.compilerFactory.getSourceFileForNode(n)))}getExportOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getExport(r),`Expected to find export with name: ${r}`)}getExport(r){if(this.compilerSymbol.exports==null)return;let n=this.compilerSymbol.exports.get(b.ts.escapeLeadingUnderscores(r));return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getExports(){return this.compilerSymbol.exports==null?[]:b.ArrayUtils.from(this.compilerSymbol.exports.values()).map(r=>this._context.compilerFactory.getSymbol(r))}getGlobalExportOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getGlobalExport(r),`Expected to find global export with name: ${r}`)}getGlobalExport(r){if(this.compilerSymbol.globalExports==null)return;let n=this.compilerSymbol.globalExports.get(b.ts.escapeLeadingUnderscores(r));return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getGlobalExports(){return this.compilerSymbol.globalExports==null?[]:b.ArrayUtils.from(this.compilerSymbol.globalExports.values()).map(r=>this._context.compilerFactory.getSymbol(r))}getMemberOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getMember(r),`Expected to find member with name: ${r}`)}getMember(r){if(this.compilerSymbol.members==null)return;let n=this.compilerSymbol.members.get(b.ts.escapeLeadingUnderscores(r));return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getMembers(){return this.compilerSymbol.members==null?[]:b.ArrayUtils.from(this.compilerSymbol.members.values()).map(r=>this._context.compilerFactory.getSymbol(r))}getDeclaredType(){return this._context.typeChecker.getDeclaredTypeOfSymbol(this)}getTypeAtLocation(r){return this._context.typeChecker.getTypeOfSymbolAtLocation(this,r)}getFullyQualifiedName(){return this._context.typeChecker.getFullyQualifiedName(this)}getJsDocTags(){return this.compilerSymbol.getJsDocTags(this._context.typeChecker.compilerObject).map(r=>new dL(r))}},WD=class{constructor(r){this._compilerObject=r}get compilerObject(){return this._compilerObject}getStart(){return this.compilerObject.start}getEnd(){return this.compilerObject.start+this.compilerObject.length}getLength(){return this.compilerObject.length}},FE=class{constructor(r){this._compilerObject=r}get compilerObject(){return this._compilerObject}getSpan(){return new WD(this.compilerObject.span)}getNewText(){return this.compilerObject.newText}};co([b.Memoize],FE.prototype,"getSpan",null);var pS=class{constructor(r,n){this._context=r,this._compilerObject=n;let i=r.compilerFactory.addOrGetSourceFileFromFilePath(r.fileSystemWrapper.getStandardizedAbsolutePath(n.fileName),{markInProject:!1,scriptKind:void 0});this._existingFileExists=i!=null,n.isNewFile||(this._sourceFile=i)}getFilePath(){return this._compilerObject.fileName}getSourceFile(){return this._sourceFile}getTextChanges(){return this._compilerObject.textChanges.map(r=>new FE(r))}applyChanges(r={}){if(this._isApplied)return;if(this.isNewFile()&&this._existingFileExists&&!r.overwrite)throw new b.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 n;if(this.isNewFile()?n=this._context.project.createSourceFile(this.getFilePath(),"",{overwrite:r.overwrite}):n=this.getSourceFile(),n==null)throw new b.errors.InvalidOperationError(`Cannot apply file text change to modify existing file that doesn't exist at path: ${this.getFilePath()}`);return n.applyTextChanges(this.getTextChanges()),n._markAsInProject(),this._isApplied=!0,this}isNewFile(){return!!this._compilerObject.isNewFile}};co([b.Memoize],pS.prototype,"getTextChanges",null);var W6=class{constructor(r,n){this._context=r,this._compilerObject=n}get compilerObject(){return this._compilerObject}getDescription(){return this.compilerObject.description}getChanges(){return this.compilerObject.changes.map(r=>new pS(this._context,r))}},V6=class extends W6{getFixName(){return this.compilerObject.fixName}getFixId(){return this.compilerObject.fixId}getFixAllDescription(){return this.compilerObject.fixAllDescription}},fL=class{constructor(r,n){this._context=r,this._compilerObject=n}get compilerObject(){return this._compilerObject}getChanges(){return this.compilerObject.changes.map(r=>new pS(this._context,r))}applyChanges(r){for(let n of this.getChanges())n.applyChanges(r);return this}};co([b.Memoize],fL.prototype,"getChanges",null);var pv=class{constructor(r,n){this._context=r,this._compilerObject=n,this._sourceFile=this._context.compilerFactory.addOrGetSourceFileFromFilePath(r.fileSystemWrapper.getStandardizedAbsolutePath(this.compilerObject.fileName),{markInProject:!1,scriptKind:void 0}),this._sourceFile._doActionPreNextModification(()=>this.getNode())}get compilerObject(){return this._compilerObject}getSourceFile(){return this._sourceFile}getTextSpan(){return new WD(this.compilerObject.textSpan)}getNode(){let r=this.getTextSpan(),n=this.getSourceFile(),i=r.getStart(),a=r.getEnd();return s();function s(){let u;return n._context.compilerFactory.forgetNodesCreatedInBlock(p=>{let f,m=n;for(;m!=null;){if(f==null&&(u=m),m.getStart()===i&&m.getWidth()===a)u=f=m;else if(f!=null)break;m=m.getChildAtPos(i)}u!=null&&p(u)}),u}}getOriginalTextSpan(){let{originalTextSpan:r}=this.compilerObject;return r==null?void 0:new WD(r)}getOriginalFileName(){return this.compilerObject.originalFileName}};co([b.Memoize],pv.prototype,"getTextSpan",null);co([b.Memoize],pv.prototype,"getNode",null);co([b.Memoize],pv.prototype,"getOriginalTextSpan",null);var VD=class extends pv{constructor(r,n){super(r,n),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 r=this.getTextSpan().getStart(),n=i(this.getSourceFile());return n?.getParentOrThrow();function i(a){if(a.getKind()===b.SyntaxKind.Identifier&&a.getStart()===r)return a;for(let s of a._getChildrenIterator())if(s.getPos()<=r&&s.getEnd()>r)return i(s)}}};co([b.Memoize],VD.prototype,"getDeclarationNode",null);var mS=class{constructor(r){this._compilerObject=r}get compilerObject(){return this._compilerObject}getMessageText(){return this.compilerObject.messageText}getNext(){let r=this.compilerObject.next;if(r!=null)return r instanceof Array?r.map(n=>new mS(n)):[new mS(r)]}getCode(){return this.compilerObject.code}getCategory(){return this.compilerObject.category}},VT=class{constructor(r,n){this._context=r,this._compilerObject=n,this.getSourceFile()}get compilerObject(){return this._compilerObject}getSourceFile(){if(this._context==null)return;let r=this.compilerObject.file;return r==null?void 0:this._context.compilerFactory.getSourceFile(r,{markInProject:!1})}getMessageText(){let r=this._compilerObject.messageText;return typeof r=="string"?r:this._context==null?new mS(r):this._context.compilerFactory.getDiagnosticMessageChain(r)}getLineNumber(){let r=this.getSourceFile(),n=this.getStart();if(!(r==null||n==null))return b.StringUtils.getLineNumberAtPos(r.getFullText(),n)}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}};co([b.Memoize],VT.prototype,"getSourceFile",null);var pL=class extends VT{constructor(r,n){super(r,n)}getLineNumber(){return super.getLineNumber()}getStart(){return super.getStart()}getLength(){return super.getLength()}getSourceFile(){return super.getSourceFile()}},j6=class{constructor(r,n){this._compilerObject=n,this._context=r}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}},mL=class{constructor(r,n){this._context=r,this._compilerObject=n}get compilerObject(){return this._compilerObject}getEmitSkipped(){return this.compilerObject.emitSkipped}getOutputFiles(){return this.compilerObject.outputFiles.map(r=>new j6(this._context,r))}};co([b.Memoize],mL.prototype,"getOutputFiles",null);var jT=class{constructor(r,n){this._context=r,this._compilerObject=n,this.getDiagnostics()}get compilerObject(){return this._compilerObject}getEmitSkipped(){return this.compilerObject.emitSkipped}getDiagnostics(){return this.compilerObject.diagnostics.map(r=>this._context.compilerFactory.getDiagnostic(r))}};co([b.Memoize],jT.prototype,"getDiagnostics",null);var _L=class extends pv{constructor(r,n){super(r,n)}getKind(){return this.compilerObject.kind}getDisplayParts(){return this.compilerObject.displayParts.map(r=>this._context.compilerFactory.getSymbolDisplayPart(r))}};co([b.Memoize],_L.prototype,"getDisplayParts",null);var H6=class extends jT{constructor(r,n,i){super(r,n),this._files=i}getFiles(){return this._files}saveFiles(){let r=this._context.fileSystemWrapper,n=this._files.map(i=>r.writeFile(i.filePath,i.writeByteOrderMark?"\uFEFF"+i.text:i.text));return Promise.all(n)}saveFilesSync(){let r=this._context.fileSystemWrapper;for(let n of this._files)r.writeFileSync(n.filePath,n.writeByteOrderMark?"\uFEFF"+n.text:n.text)}},gL=class{constructor(r,n){this._context=r,this._compilerObject=n}get compilerObject(){return this._compilerObject}getEdits(){return this.compilerObject.edits.map(r=>new pS(this._context,r))}getRenameFilePath(){return this.compilerObject.renameFilename}getRenameLocation(){return this.compilerObject.renameLocation}applyChanges(r){for(let n of this.getEdits())n.applyChanges(r);return this}};co([b.Memoize],gL.prototype,"getEdits",null);var yL=class{constructor(r,n){this._context=r,this._compilerObject=n,this._references=this.compilerObject.references.map(i=>r.compilerFactory.getReferencedSymbolEntry(i))}get compilerObject(){return this._compilerObject}getDefinition(){return this._context.compilerFactory.getReferencedSymbolDefinitionInfo(this.compilerObject.definition)}getReferences(){return this._references}};co([b.Memoize],yL.prototype,"getDefinition",null);var vL=class extends VD{constructor(r,n){super(r,n)}getDisplayParts(){return this.compilerObject.displayParts.map(r=>this._context.compilerFactory.getSymbolDisplayPart(r))}};co([b.Memoize],vL.prototype,"getDisplayParts",null);var q6=class extends pv{constructor(r,n){super(r,n)}isWriteAccess(){return this.compilerObject.isWriteAccess}isInString(){return this.compilerObject.isInString}},J6=class extends q6{constructor(r,n){super(r,n)}isDefinition(){return this.compilerObject.isDefinition}},z6=class extends pv{getPrefixText(){return this._compilerObject.prefixText}getSuffixText(){return this._compilerObject.suffixText}},$6=class{constructor(r){this._compilerObject=r}get compilerObject(){return this._compilerObject}getText(){return this.compilerObject.text}getKind(){return this.compilerObject.kind}},hL=class{constructor(r){this._context=r}get compilerObject(){return this._getCompilerObject()}_reset(r){this._getCompilerObject=r}getAmbientModules(){return this.compilerObject.getAmbientModules().map(r=>this._context.compilerFactory.getSymbol(r))}getApparentType(r){return this._context.compilerFactory.getType(this.compilerObject.getApparentType(r.compilerType))}getConstantValue(r){return this.compilerObject.getConstantValue(r.compilerNode)}getFullyQualifiedName(r){return this.compilerObject.getFullyQualifiedName(r.compilerSymbol)}getTypeAtLocation(r){return this._context.compilerFactory.getType(this.compilerObject.getTypeAtLocation(r.compilerNode))}getContextualType(r){let n=this.compilerObject.getContextualType(r.compilerNode);return n==null?void 0:this._context.compilerFactory.getType(n)}getTypeOfSymbolAtLocation(r,n){return this._context.compilerFactory.getType(this.compilerObject.getTypeOfSymbolAtLocation(r.compilerSymbol,n.compilerNode))}getDeclaredTypeOfSymbol(r){return this._context.compilerFactory.getType(this.compilerObject.getDeclaredTypeOfSymbol(r.compilerSymbol))}getSymbolAtLocation(r){let n=this.compilerObject.getSymbolAtLocation(r.compilerNode);return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getAliasedSymbol(r){if(!r.hasFlags(b.SymbolFlags.Alias))return;let n=this.compilerObject.getAliasedSymbol(r.compilerSymbol);return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getImmediatelyAliasedSymbol(r){let n=this.compilerObject.getImmediateAliasedSymbol(r.compilerSymbol);return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getExportSymbolOfSymbol(r){return this._context.compilerFactory.getSymbol(this.compilerObject.getExportSymbolOfSymbol(r.compilerSymbol))}getPropertiesOfType(r){return this.compilerObject.getPropertiesOfType(r.compilerType).map(n=>this._context.compilerFactory.getSymbol(n))}getTypeText(r,n,i){return i==null&&(i=this._getDefaultTypeFormatFlags(n)),this.compilerObject.typeToString(r.compilerType,n?.compilerNode,i)}getReturnTypeOfSignature(r){return this._context.compilerFactory.getType(this.compilerObject.getReturnTypeOfSignature(r.compilerSignature))}getSignatureFromNode(r){let n=this.compilerObject.getSignatureFromDeclaration(r.compilerNode);return n==null?void 0:this._context.compilerFactory.getSignature(n)}getExportsOfModule(r){return(this.compilerObject.getExportsOfModule(r.compilerSymbol)||[]).map(i=>this._context.compilerFactory.getSymbol(i))}getExportSpecifierLocalTargetSymbol(r){let n=this.compilerObject.getExportSpecifierLocalTargetSymbol(r.compilerNode);return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getResolvedSignature(r){let n=this.compilerObject.getResolvedSignature(r.compilerNode);if(!(!n||!n.declaration))return this._context.compilerFactory.getSignature(n)}getResolvedSignatureOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getResolvedSignature(r),"Signature could not be resolved.")}getBaseTypeOfLiteralType(r){return this._context.compilerFactory.getType(this.compilerObject.getBaseTypeOfLiteralType(r.compilerType))}getSymbolsInScope(r,n){return this.compilerObject.getSymbolsInScope(r.compilerNode,n).map(i=>this._context.compilerFactory.getSymbol(i))}getTypeArguments(r){return this.compilerObject.getTypeArguments(r.compilerType).map(n=>this._context.compilerFactory.getType(n))}_getDefaultTypeFormatFlags(r){let n=b.TypeFormatFlags.UseTypeOfFunction|b.TypeFormatFlags.NoTruncation|b.TypeFormatFlags.UseFullyQualifiedType|b.TypeFormatFlags.WriteTypeArgumentsOfSignature;return r!=null&&r.getKind()===b.SyntaxKind.TypeAliasDeclaration&&(n|=b.TypeFormatFlags.InTypeAlias),n}},X6=class{constructor(r){this._context=r.context,this._configFileParsingDiagnostics=r.configFileParsingDiagnostics,this._typeChecker=new hL(this._context),this._reset(r.rootNames,r.host)}get compilerObject(){return this._getOrCreateCompilerObject()}_isCompilerProgramCreated(){return this._createdCompilerObject!=null}_reset(r,n){let i=this._context.compilerOptions.get();this._getOrCreateCompilerObject=()=>(this._createdCompilerObject==null&&(this._createdCompilerObject=b.ts.createProgram(r,i,n,this._oldProgram,this._configFileParsingDiagnostics),delete this._oldProgram),this._createdCompilerObject),this._createdCompilerObject!=null&&(this._oldProgram=this._createdCompilerObject,delete this._createdCompilerObject),this._typeChecker._reset(()=>this.compilerObject.getTypeChecker())}getTypeChecker(){return this._typeChecker}async emit(r={}){if(r.writeFile){let s=`Cannot specify a ${b.nameof(r,"writeFile")} option when emitting asynchrously. Use ${b.nameof(this,"emitSync")}() instead.`;throw new b.errors.InvalidOperationError(s)}let{fileSystemWrapper:n}=this._context,i=[],a=this._emit({writeFile:(s,u,p)=>{i.push(n.writeFile(n.getStandardizedAbsolutePath(s),p?"\uFEFF"+u:u))},...r});return await Promise.all(i),new jT(this._context,a)}emitSync(r={}){return new jT(this._context,this._emit(r))}emitToMemory(r={}){let n=[],{fileSystemWrapper:i}=this._context,a=this._emit({writeFile:(s,u,p)=>{n.push({filePath:i.getStandardizedAbsolutePath(s),text:u,writeByteOrderMark:p||!1})},...r});return new H6(this._context,a,n)}_emit(r={}){let n=r.targetSourceFile!=null?r.targetSourceFile.compilerNode:void 0,{emitOnlyDtsFiles:i,customTransformers:a,writeFile:s}=r,u=void 0;return this.compilerObject.emit(n,s,u,i,a)}getSyntacticDiagnostics(r){return this.compilerObject.getSyntacticDiagnostics(r?.compilerNode).map(i=>this._context.compilerFactory.getDiagnosticWithLocation(i))}getSemanticDiagnostics(r){return this.compilerObject.getSemanticDiagnostics(r?.compilerNode).map(i=>this._context.compilerFactory.getDiagnostic(i))}getDeclarationDiagnostics(r){return this.compilerObject.getDeclarationDiagnostics(r?.compilerNode).map(i=>this._context.compilerFactory.getDiagnosticWithLocation(i))}getGlobalDiagnostics(){return this.compilerObject.getGlobalDiagnostics().map(n=>this._context.compilerFactory.getDiagnostic(n))}getConfigFileParsingDiagnostics(){return this.compilerObject.getConfigFileParsingDiagnostics().map(n=>this._context.compilerFactory.getDiagnostic(n))}getEmitModuleResolutionKind(){return b.getEmitModuleResolutionKind(this.compilerObject.getCompilerOptions())}isSourceFileFromExternalLibrary(r){return r.isFromExternalLibrary()}},Y6=class{constructor(r){var n;this._projectVersion=0,this._context=r.context;let{languageServiceHost:i,compilerHost:a}=b.createHosts({transactionalFileSystem:this._context.fileSystemWrapper,sourceFileContainer:this._context.getSourceFileContainer(),compilerOptions:this._context.compilerOptions,getNewLine:()=>this._context.manipulationSettings.getNewLineKindAsString(),getProjectVersion:()=>`${this._projectVersion}`,resolutionHost:(n=r.resolutionHost)!==null&&n!==void 0?n:{},libFolderPath:r.libFolderPath,skipLoadingLibFiles:r.skipLoadingLibFiles});this._compilerHost=a,this._compilerObject=b.ts.createLanguageService(i,this._context.compilerFactory.documentRegistry),this._program=new X6({context:this._context,rootNames:Array.from(this._context.compilerFactory.getSourceFilePaths()),host:this._compilerHost,configFileParsingDiagnostics:r.configFileParsingDiagnostics}),this._context.compilerFactory.onSourceFileAdded(s=>{s._isInProject()&&this._reset()}),this._context.compilerFactory.onSourceFileRemoved(()=>this._reset())}get compilerObject(){return this._compilerObject}_reset(){this._projectVersion+=1,this._program._reset(Array.from(this._context.compilerFactory.getSourceFilePaths()),this._compilerHost)}getProgram(){return this._program}getDefinitions(r){return this.getDefinitionsAtPosition(r._sourceFile,r.getStart())}getDefinitionsAtPosition(r,n){return(this.compilerObject.getDefinitionAtPosition(r.getFilePath(),n)||[]).map(a=>this._context.compilerFactory.getDefinitionInfo(a))}getImplementations(r){return this.getImplementationsAtPosition(r._sourceFile,r.getStart())}getImplementationsAtPosition(r,n){return(this.compilerObject.getImplementationAtPosition(r.getFilePath(),n)||[]).map(a=>new _L(this._context,a))}findReferences(r){return this.findReferencesAtPosition(r._sourceFile,r.getStart())}findReferencesAsNodes(r){let n=this.findReferences(r);return Array.from(i());function*i(){for(let a of n){let s=a.getDefinition().getKind()===b.ts.ScriptElementKind.alias,u=a.getReferences();for(let p=0;p<u.length;p++){let f=u[p];(s||!f.isDefinition()||p>0)&&(yield f.getNode())}}}}findReferencesAtPosition(r,n){return(this.compilerObject.findReferences(r.getFilePath(),n)||[]).map(a=>this._context.compilerFactory.getReferencedSymbol(a))}findRenameLocations(r,n={}){let i=n.usePrefixAndSuffixText==null?this._context.manipulationSettings.getUsePrefixAndSuffixTextForRename():n.usePrefixAndSuffixText;return(this.compilerObject.findRenameLocations(r._sourceFile.getFilePath(),r.getStart(),n.renameInStrings||!1,n.renameInComments||!1,i)||[]).map(s=>new z6(this._context,s))}getSuggestionDiagnostics(r){let n=this._getFilePathFromFilePathOrSourceFile(r);return this.compilerObject.getSuggestionDiagnostics(n).map(a=>this._context.compilerFactory.getDiagnosticWithLocation(a))}getFormattingEditsForRange(r,n,i){return(this.compilerObject.getFormattingEditsForRange(r,n[0],n[1],this._getFilledSettings(i))||[]).map(a=>new FE(a))}getFormattingEditsForDocument(r,n){let i=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r);return(this.compilerObject.getFormattingEditsForDocument(i,this._getFilledSettings(n))||[]).map(a=>new FE(a))}getFormattedDocumentText(r,n){let i=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),a=this._context.compilerFactory.getSourceFileFromCacheFromFilePath(i);if(a==null)throw new b.errors.FileNotFoundError(i);n=this._getFilledSettings(n);let s=this.getFormattingEditsForDocument(i,n),u=ZH(a,s),p=n.newLineCharacter;return n.ensureNewLineAtEndOfFile&&!u.endsWith(p)&&(u+=p),u.replace(/\r?\n/g,p)}getEmitOutput(r,n){let i=this._getFilePathFromFilePathOrSourceFile(r),a=this.compilerObject;return new mL(this._context,s());function s(){let u=a.getProgram();return u==null||u.getSourceFile(i)==null?{emitSkipped:!0,outputFiles:[]}:a.getEmitOutput(i,n)}}getIdentationAtPosition(r,n,i){let a=this._getFilePathFromFilePathOrSourceFile(r);return i==null?i=this._context.manipulationSettings.getEditorSettings():QH(i,this._context.manipulationSettings),this.compilerObject.getIndentationAtPosition(a,n,i)}organizeImports(r,n={},i={}){let a={type:"file",fileName:this._getFilePathFromFilePathOrSourceFile(r)};return this.compilerObject.organizeImports(a,this._getFilledSettings(n),this._getFilledUserPreferences(i)).map(s=>new pS(this._context,s))}getEditsForRefactor(r,n,i,a,s,u={}){let p=this._getFilePathFromFilePathOrSourceFile(r),f=typeof i=="number"?i:{pos:i.getPos(),end:i.getEnd()},m=this.compilerObject.getEditsForRefactor(p,this._getFilledSettings(n),f,a,s,this._getFilledUserPreferences(u));return m!=null?new gL(this._context,m):void 0}getCombinedCodeFix(r,n,i={},a={}){let s=this.compilerObject.getCombinedCodeFix({type:"file",fileName:this._getFilePathFromFilePathOrSourceFile(r)},n,this._getFilledSettings(i),this._getFilledUserPreferences(a||{}));return new fL(this._context,s)}getCodeFixesAtPosition(r,n,i,a,s={},u={}){let p=this._getFilePathFromFilePathOrSourceFile(r);return this.compilerObject.getCodeFixesAtPosition(p,n,i,a,this._getFilledSettings(s),this._getFilledUserPreferences(u||{})).map(m=>new V6(this._context,m))}_getFilePathFromFilePathOrSourceFile(r){let n=typeof r=="string"?this._context.fileSystemWrapper.getStandardizedAbsolutePath(r):r.getFilePath();if(!this._context.compilerFactory.containsSourceFileAtPath(n))throw new b.errors.FileNotFoundError(n);return n}_getFilledSettings(r){return r._filled||(r=Object.assign(this._context.getFormatCodeSettings(),r),L7e(r,this._context.manipulationSettings),r._filled=!0),r}_getFilledUserPreferences(r){return Object.assign(this._context.getUserPreferences(),r)}},EL=class{constructor(r,n){this._context=r,this._compilerType=n}get compilerType(){return this._compilerType}getText(r,n){return this._context.typeChecker.getTypeText(this,r,n)}getAliasSymbol(){return this.compilerType.aliasSymbol==null?void 0:this._context.compilerFactory.getSymbol(this.compilerType.aliasSymbol)}getAliasSymbolOrThrow(){return b.errors.throwIfNullOrUndefined(this.getAliasSymbol(),"Expected to find an alias symbol.")}getAliasTypeArguments(){return(this.compilerType.aliasTypeArguments||[]).map(n=>this._context.compilerFactory.getType(n))}getApparentType(){return this._context.typeChecker.getApparentType(this)}getArrayElementTypeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getArrayElementType(),"Expected to find an array element type.")}getArrayElementType(){if(!!this.isArray())return this.getTypeArguments()[0]}getBaseTypes(){return(this.compilerType.getBaseTypes()||[]).map(n=>this._context.compilerFactory.getType(n))}getBaseTypeOfLiteralType(){return this._context.typeChecker.getBaseTypeOfLiteralType(this)}getCallSignatures(){return this.compilerType.getCallSignatures().map(r=>this._context.compilerFactory.getSignature(r))}getConstructSignatures(){return this.compilerType.getConstructSignatures().map(r=>this._context.compilerFactory.getSignature(r))}getConstraintOrThrow(){return b.errors.throwIfNullOrUndefined(this.getConstraint(),"Expected to find a constraint.")}getConstraint(){let r=this.compilerType.getConstraint();return r==null?void 0:this._context.compilerFactory.getType(r)}getDefaultOrThrow(){return b.errors.throwIfNullOrUndefined(this.getDefault(),"Expected to find a default type.")}getDefault(){let r=this.compilerType.getDefault();return r==null?void 0:this._context.compilerFactory.getType(r)}getProperties(){return this.compilerType.getProperties().map(r=>this._context.compilerFactory.getSymbol(r))}getPropertyOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getProperty(r),()=>Ou("symbol property",r))}getProperty(r){return Ffe(this.getProperties(),r)}getApparentProperties(){return this.compilerType.getApparentProperties().map(r=>this._context.compilerFactory.getSymbol(r))}getApparentProperty(r){return Ffe(this.getApparentProperties(),r)}isNullable(){return this.getUnionTypes().some(r=>r.isNull()||r.isUndefined())}getNonNullableType(){return this._context.compilerFactory.getType(this.compilerType.getNonNullableType())}getNumberIndexType(){let r=this.compilerType.getNumberIndexType();return r==null?void 0:this._context.compilerFactory.getType(r)}getStringIndexType(){let r=this.compilerType.getStringIndexType();return r==null?void 0:this._context.compilerFactory.getType(r)}getTargetType(){let r=this.compilerType.target||void 0;return r==null?void 0:this._context.compilerFactory.getType(r)}getTargetTypeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getTargetType(),"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(r=>this._context.compilerFactory.getType(r)):[]}getIntersectionTypes(){return this.isIntersection()?this.compilerType.types.map(r=>this._context.compilerFactory.getType(r)):[]}getLiteralValue(){var r;return(r=this.compilerType)===null||r===void 0?void 0:r.value}getLiteralValueOrThrow(){return b.errors.throwIfNullOrUndefined(this.getLiteralValue(),"Type was not a literal type.")}getLiteralFreshType(){var r;let n=(r=this.compilerType)===null||r===void 0?void 0:r.freshType;return n==null?void 0:this._context.compilerFactory.getType(n)}getLiteralFreshTypeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getLiteralFreshType(),"Type was not a literal type.")}getLiteralRegularType(){var r;let n=(r=this.compilerType)===null||r===void 0?void 0:r.regularType;return n==null?void 0:this._context.compilerFactory.getType(n)}getLiteralRegularTypeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getLiteralRegularType(),"Type was not a literal type.")}getSymbol(){let r=this.compilerType.getSymbol();return r==null?void 0:this._context.compilerFactory.getSymbol(r)}getSymbolOrThrow(){return b.errors.throwIfNullOrUndefined(this.getSymbol(),"Expected to find a symbol.")}isAnonymous(){return this._hasObjectFlag(b.ObjectFlags.Anonymous)}isAny(){return this._hasTypeFlag(b.TypeFlags.Any)}isNever(){return this._hasTypeFlag(b.TypeFlags.Never)}isArray(){let r=this.getSymbol();return r==null?!1:(r.getName()==="Array"||r.getName()==="ReadonlyArray")&&this.getTypeArguments().length===1}isReadonlyArray(){let r=this.getSymbol();return r==null?!1:r.getName()==="ReadonlyArray"&&this.getTypeArguments().length===1}isTemplateLiteral(){return this._hasTypeFlag(b.TypeFlags.TemplateLiteral)}isBoolean(){return this._hasTypeFlag(b.TypeFlags.Boolean)}isString(){return this._hasTypeFlag(b.TypeFlags.String)}isNumber(){return this._hasTypeFlag(b.TypeFlags.Number)}isLiteral(){let r=this.isBooleanLiteral();return this.compilerType.isLiteral()||r}isBooleanLiteral(){return this._hasTypeFlag(b.TypeFlags.BooleanLiteral)}isEnumLiteral(){return this._hasTypeFlag(b.TypeFlags.EnumLiteral)&&!this.isUnion()}isNumberLiteral(){return this._hasTypeFlag(b.TypeFlags.NumberLiteral)}isStringLiteral(){return this.compilerType.isStringLiteral()}isClass(){return this.compilerType.isClass()}isClassOrInterface(){return this.compilerType.isClassOrInterface()}isEnum(){if(this._hasTypeFlag(b.TypeFlags.Enum))return!0;if(this.isEnumLiteral()&&!this.isUnion())return!1;let n=this.getSymbol();if(n==null)return!1;let i=n.getValueDeclaration();return i!=null&&Tr.isEnumDeclaration(i)}isInterface(){return this._hasObjectFlag(b.ObjectFlags.Interface)}isObject(){return this._hasTypeFlag(b.TypeFlags.Object)}isTypeParameter(){return this.compilerType.isTypeParameter()}isTuple(){let r=this.getTargetType();return r==null?!1:r._hasObjectFlag(b.ObjectFlags.Tuple)}isUnion(){return this.compilerType.isUnion()}isIntersection(){return this.compilerType.isIntersection()}isUnionOrIntersection(){return this.compilerType.isUnionOrIntersection()}isUnknown(){return this._hasTypeFlag(b.TypeFlags.Unknown)}isNull(){return this._hasTypeFlag(b.TypeFlags.Null)}isUndefined(){return this._hasTypeFlag(b.TypeFlags.Undefined)}getFlags(){return this.compilerType.flags}getObjectFlags(){return this.isObject()&&this.compilerType.objectFlags||0}_hasTypeFlag(r){return(this.compilerType.flags&r)===r}_hasObjectFlag(r){return(this.getObjectFlags()&r)===r}},Q6=class extends EL{getConstraintOrThrow(){return b.errors.throwIfNullOrUndefined(this.getConstraint(),"Expected type parameter to have a constraint.")}getConstraint(){let r=this._getTypeParameterDeclaration();if(r==null)return;let n=r.getConstraint();if(n!=null)return this._context.typeChecker.getTypeAtLocation(n)}getDefaultOrThrow(){return b.errors.throwIfNullOrUndefined(this.getDefault(),"Expected type parameter to have a default type.")}getDefault(){let r=this._getTypeParameterDeclaration();if(r==null)return;let n=r.getDefault();if(n!=null)return this._context.typeChecker.getTypeAtLocation(n)}_getTypeParameterDeclaration(){let r=this.getSymbol();if(r==null)return;let n=r.getDeclarations()[0];if(n!=null&&!!Tr.isTypeParameterDeclaration(n))return n}},bL=class{constructor(r,n){this._skippedFilePaths=r,this._outputFilePaths=n}getSkippedFilePaths(){return this._skippedFilePaths}getOutputFilePaths(){return this._outputFilePaths}},OE=class{constructor(r,n){this.__context=r,this._setPathInternal(n)}_setPathInternal(r){this._path=r,this._pathParts=r.split("/").filter(n=>n.length>0)}get _context(){return this._throwIfDeletedOrRemoved(),this.__context}isAncestorOf(r){return OE._isAncestorOfDir(this,r)}isDescendantOf(r){return OE._isAncestorOfDir(r,this)}_getDepth(){return this._pathParts.length}getPath(){return this._throwIfDeletedOrRemoved(),this._path}getBaseName(){return this._pathParts[this._pathParts.length-1]}getParentOrThrow(){return b.errors.throwIfNullOrUndefined(this.getParent(),()=>`Parent directory of ${this.getPath()} does not exist or was never added.`)}getParent(){if(!b.FileUtils.isRootDirPath(this.getPath()))return this.addDirectoryAtPathIfExists(b.FileUtils.getDirPath(this.getPath()))}getDirectoryOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getDirectory(r),()=>typeof r=="string"?`Could not find a directory at path '${this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath())}'.`:"Could not find child directory that matched condition.")}getDirectory(r){if(typeof r=="string"){let n=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.compilerFactory.getDirectoryFromCache(n)}return this.getDirectories().find(r)}getSourceFileOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getSourceFile(r),()=>typeof r=="string"?`Could not find child source file at path '${this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath())}'.`:"Could not find child source file that matched condition.")}getSourceFile(r){if(typeof r=="string"){let n=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.compilerFactory.getSourceFileFromCacheFromFilePath(n)}for(let n of this._getSourceFilesIterator())if(r(n))return n}getDirectories(){return Array.from(this._getDirectoriesIterator())}_getDirectoriesIterator(){return this._context.compilerFactory.getChildDirectoriesOfDirectory(this.getPath())}getSourceFiles(r){let{compilerFactory:n,fileSystemWrapper:i}=this._context,a=this;if(typeof r=="string"||r instanceof Array){let u=typeof r=="string"?[r]:r;return Array.from(s(u))}else return Array.from(this._getSourceFilesIterator());function*s(u){let p=Array.from(m()),f=b.matchGlobs(p,u,a.getPath());for(let g of f)yield n.getSourceFileFromCacheFromFilePath(i.getStandardizedAbsolutePath(g));function*m(){for(let g of a._getDescendantSourceFilesIterator())yield g.getFilePath()}}}_getSourceFilesIterator(){return this._context.compilerFactory.getChildSourceFilesOfDirectory(this.getPath())}getDescendantSourceFiles(){return Array.from(this._getDescendantSourceFilesIterator())}*_getDescendantSourceFilesIterator(){for(let r of this._getSourceFilesIterator())yield r;for(let r of this._getDirectoriesIterator())yield*r._getDescendantSourceFilesIterator()}getDescendantDirectories(){return Array.from(this._getDescendantDirectoriesIterator())}*_getDescendantDirectoriesIterator(){for(let r of this.getDirectories())yield r,yield*r._getDescendantDirectoriesIterator()}addSourceFilesAtPaths(r){return r=typeof r=="string"?[r]:r,r=r.map(n=>b.FileUtils.pathIsAbsolute(n)?n:b.FileUtils.pathJoin(this.getPath(),n)),this._context.directoryCoordinator.addSourceFilesAtPaths(r,{markInProject:this._isInProject()})}addDirectoryAtPathIfExists(r,n={}){let i=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.directoryCoordinator.addDirectoryAtPathIfExists(i,{...n,markInProject:this._isInProject()})}addDirectoryAtPath(r,n={}){let i=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.directoryCoordinator.addDirectoryAtPath(i,{...n,markInProject:this._isInProject()})}createDirectory(r){let n=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.directoryCoordinator.createDirectoryOrAddIfExists(n,{markInProject:this._isInProject()})}createSourceFile(r,n,i){let a=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.compilerFactory.createSourceFile(a,n||"",{...i||{},markInProject:this._isInProject()})}addSourceFileAtPathIfExists(r){let n=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.directoryCoordinator.addSourceFileAtPathIfExists(n,{markInProject:this._isInProject()})}addSourceFileAtPath(r){let n=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.directoryCoordinator.addSourceFileAtPath(n,{markInProject:this._isInProject()})}async emit(r={}){let{fileSystemWrapper:n}=this._context,i=[],a=[],s=[];for(let u of this._emitInternal(r))mpe(u)?s.push(u):(i.push(n.writeFile(u.filePath,u.fileText)),a.push(u.filePath));return await Promise.all(i),new bL(s,a)}emitSync(r={}){let{fileSystemWrapper:n}=this._context,i=[],a=[];for(let s of this._emitInternal(r))mpe(s)?a.push(s):(n.writeFileSync(s.filePath,s.fileText),i.push(s.filePath));return new bL(a,i)}_emitInternal(r={}){let{emitOnlyDtsFiles:n=!1}=r,i=r.outDir==null?void 0:/\.js$/i,a=r.outDir==null?void 0:/\.js\.map$/i,s=r.declarationDir==null&&r.outDir==null?void 0:/\.d\.ts$/i,u=g=>g==null?void 0:this._context.fileSystemWrapper.getStandardizedAbsolutePath(g,this.getPath()),p=(g,D)=>g==null?void 0:b.FileUtils.pathJoin(g,D.getBaseName()),f=this._context.compilerOptions.get().declarationDir!=null||r.declarationDir!=null;return m(this,u(r.outDir),u(r.declarationDir));function*m(g,D,P){for(let B of g.getSourceFiles()){let K=B.getEmitOutput({emitOnlyDtsFiles:n});if(K.getEmitSkipped()){yield B.getFilePath();continue}for(let h of K.getOutputFiles()){let S=h.getFilePath(),U=h.getWriteByteOrderMark()?b.FileUtils.getTextWithByteOrderMark(h.getText()):h.getText();D!=null&&(i.test(S)||a.test(S)||!f&&s.test(S))?S=b.FileUtils.pathJoin(D,b.FileUtils.getBaseName(S)):P!=null&&s.test(S)&&(S=b.FileUtils.pathJoin(P,b.FileUtils.getBaseName(S))),yield{filePath:S,fileText:U}}}for(let B of g.getDirectories())yield*m(B,p(D,B),p(P,B))}}copyToDirectory(r,n){let i=typeof r=="string"?r:r.getPath();return this.copy(b.FileUtils.pathJoin(i,this.getBaseName()),n)}copy(r,n){let i=this.getPath(),a=this._context.fileSystemWrapper,s=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return i===s?this:(n=_j(n),n.includeUntrackedFiles&&a.queueCopyDirectory(i,s),this._copyInternal(s,n))}async copyImmediately(r,n){let i=this._context.fileSystemWrapper,a=this.getPath(),s=i.getStandardizedAbsolutePath(r,a);if(a===s)return await this.save(),this;n=_j(n);let u=this._copyInternal(s,n);return n.includeUntrackedFiles&&await i.copyDirectoryImmediately(a,s),await u.save(),u}copyImmediatelySync(r,n){let i=this._context.fileSystemWrapper,a=this.getPath(),s=i.getStandardizedAbsolutePath(r,a);if(a===s)return this.saveSync(),this;n=_j(n);let u=this._copyInternal(s,n);return n.includeUntrackedFiles&&i.copyDirectoryImmediatelySync(a,s),u.saveSync(),u}_copyInternal(r,n){if(this.getPath()===r)return this;let{fileSystemWrapper:a,compilerFactory:s}=this._context,u=[this,...this.getDescendantDirectories()].map(f=>({newDirPath:f===this?r:a.getStandardizedAbsolutePath(this.getRelativePathTo(f),r)})),p=this.getDescendantSourceFiles().map(f=>({sourceFile:f,newFilePath:a.getStandardizedAbsolutePath(this.getRelativePathTo(f),r),references:this._getReferencesForCopy(f)}));for(let{newDirPath:f}of u)this._context.compilerFactory.createDirectoryOrAddIfExists(f,{markInProject:this._isInProject()});for(let{sourceFile:f,newFilePath:m}of p)f._copyInternal(m,n);for(let{references:f,newFilePath:m}of p)this.getSourceFileOrThrow(m)._updateReferencesForCopyInternal(f);return s.getDirectoryFromCache(r)}moveToDirectory(r,n){let i=typeof r=="string"?r:r.getPath();return this.move(b.FileUtils.pathJoin(i,this.getBaseName()),n)}move(r,n){let i=this._context.fileSystemWrapper,a=this.getPath(),s=i.getStandardizedAbsolutePath(r,a);return a===s?this:this._moveInternal(s,n,()=>i.queueMoveDirectory(a,s))}async moveImmediately(r,n){let i=this._context.fileSystemWrapper,a=this.getPath(),s=i.getStandardizedAbsolutePath(r,a);return a===s?(await this.save(),this):(this._moveInternal(s,n),await i.moveDirectoryImmediately(a,s),await this.save(),this)}moveImmediatelySync(r,n){let i=this._context.fileSystemWrapper,a=this.getPath(),s=i.getStandardizedAbsolutePath(r,a);return a===s?(this.saveSync(),this):(this._moveInternal(s,n),i.moveDirectoryImmediatelySync(a,s),this.saveSync(),this)}_moveInternal(r,n,i){let a=this.getPath();if(a===r)return this;let s=this._context.compilerFactory.getDirectoryFromCacheOnlyIfInCache(r),u=s!=null&&s._isInProject();i&&i();let p=this._context.fileSystemWrapper,f=this._context.compilerFactory,m=[this,...this.getDescendantDirectories()].map(D=>({directory:D,oldPath:D.getPath(),newDirPath:D===this?r:p.getStandardizedAbsolutePath(this.getRelativePathTo(D),r)})),g=this.getDescendantSourceFiles().map(D=>({sourceFile:D,newFilePath:p.getStandardizedAbsolutePath(this.getRelativePathTo(D),r),references:this._getReferencesForMove(D)}));for(let{directory:D,oldPath:P,newDirPath:B}of m){f.removeDirectoryFromCache(P);let K=f.getDirectoryFromCache(B);K?._forgetOnlyThis(),D._setPathInternal(B),f.addDirectoryToCache(D)}for(let{sourceFile:D,newFilePath:P}of g)D._moveInternal(P,n);for(let{sourceFile:D,references:P}of g)D._updateReferencesForMoveInternal(P,a);return u&&this._markAsInProject(),this}clear(){let r=this.getPath();this._deleteDescendants(),this._context.fileSystemWrapper.queueDirectoryDelete(r),this._context.fileSystemWrapper.queueMkdir(r)}async clearImmediately(){let r=this.getPath();this._deleteDescendants(),await this._context.fileSystemWrapper.clearDirectoryImmediately(r)}clearImmediatelySync(){let r=this.getPath();this._deleteDescendants(),this._context.fileSystemWrapper.clearDirectoryImmediatelySync(r)}delete(){let r=this.getPath();this._deleteDescendants(),this._context.fileSystemWrapper.queueDirectoryDelete(r),this.forget()}_deleteDescendants(){for(let r of this.getSourceFiles())r.delete();for(let r of this.getDirectories())r.delete()}async deleteImmediately(){let{fileSystemWrapper:r}=this._context,n=this.getPath();this.forget(),await r.deleteDirectoryImmediately(n)}deleteImmediatelySync(){let{fileSystemWrapper:r}=this._context,n=this.getPath();this.forget(),r.deleteDirectoryImmediatelySync(n)}forget(){if(!this.wasForgotten()){for(let r of this.getSourceFiles())r.forget();for(let r of this.getDirectories())r.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 r=this.getDescendantSourceFiles().filter(n=>!n.isSaved());await Promise.all(r.map(n=>n.save()))}saveSync(){this._context.fileSystemWrapper.saveForDirectorySync(this.getPath()),this.getDescendantSourceFiles().filter(n=>!n.isSaved()).forEach(n=>n.saveSync())}getRelativePathTo(r){let n=this;return b.FileUtils.getRelativePathTo(this.getPath(),i());function i(){return r instanceof kE?r.getFilePath():r instanceof OE?r.getPath():n._context.fileSystemWrapper.getStandardizedAbsolutePath(r,n.getPath())}}getRelativePathAsModuleSpecifierTo(r){let n=this._context.program.getEmitModuleResolutionKind(),i=this,a=b.FileUtils.getRelativePathTo(this.getPath(),s()).replace(/((\.d\.ts$)|(\.[^/.]+$))/i,"");return a.startsWith("../")?a:"./"+a;function s(){return r instanceof kE?u(r):r instanceof OE?p(r):f(i._context.fileSystemWrapper.getStandardizedAbsolutePath(r,i.getPath()));function u(m){return f(m.getFilePath())}function p(m){switch(n){case b.ModuleResolutionKind.NodeJs:return m===i?b.FileUtils.pathJoin(m.getPath(),"index.ts"):m.getPath();case b.ModuleResolutionKind.Classic:case b.ModuleResolutionKind.Node16:case b.ModuleResolutionKind.NodeNext:return b.FileUtils.pathJoin(m.getPath(),"index.ts");default:return b.errors.throwNotImplementedForNeverValueError(n)}}function f(m){let g=b.FileUtils.getDirPath(m);switch(n){case b.ModuleResolutionKind.NodeJs:return g===i.getPath()?m:m.replace(/\/index?(\.d\.ts|\.ts|\.js)$/i,"");case b.ModuleResolutionKind.Classic:case b.ModuleResolutionKind.Node16:case b.ModuleResolutionKind.NodeNext:return m;default:return b.errors.throwNotImplementedForNeverValueError(n)}}}}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(b.FileUtils.getDirPath(this.getPath()))}_throwIfDeletedOrRemoved(){if(this.wasForgotten())throw new b.errors.InvalidOperationError("Cannot use a directory that was deleted, removed, or overwritten.")}_getReferencesForCopy(r){return r._getReferencesForCopyInternal().filter(i=>!this.isAncestorOf(i[1]))}_getReferencesForMove(r){let{literalReferences:n,referencingLiterals:i}=r._getReferencesForMoveInternal();return{literalReferences:n.filter(a=>!this.isAncestorOf(a[1])),referencingLiterals:i.filter(a=>!this.isAncestorOf(a._sourceFile))}}static _isAncestorOfDir(r,n){if(n instanceof kE&&(n=n.getDirectory(),r===n))return!0;if(r._pathParts.length>=n._pathParts.length)return!1;for(let i=r._pathParts.length-1;i>=0;i--)if(r._pathParts[i]!==n._pathParts[i])return!1;return!0}};function _j(e){return e=b.ObjectUtils.clone(e||{}),_u(e,"includeUntrackedFiles",!0),e}function mpe(e){return typeof e=="string"}var jH=class{constructor(r,n){this.compilerFactory=r,this.fileSystemWrapper=n}addDirectoryAtPathIfExists(r,n){let i=this.compilerFactory.getDirectoryFromPath(r,n);if(i!=null){if(n.recursive)for(let a of b.FileUtils.getDescendantDirectories(this.fileSystemWrapper,r))this.compilerFactory.createDirectoryOrAddIfExists(a,n);return i}}addDirectoryAtPath(r,n){let i=this.addDirectoryAtPathIfExists(r,n);if(i==null)throw new b.errors.DirectoryNotFoundError(r);return i}createDirectoryOrAddIfExists(r,n){return this.compilerFactory.createDirectoryOrAddIfExists(r,n)}addSourceFileAtPathIfExists(r,n){return this.compilerFactory.addOrGetSourceFileFromFilePath(r,{markInProject:n.markInProject,scriptKind:void 0})}addSourceFileAtPath(r,n){let i=this.addSourceFileAtPathIfExists(r,n);if(i==null)throw new b.errors.FileNotFoundError(this.fileSystemWrapper.getStandardizedAbsolutePath(r));return i}addSourceFilesAtPaths(r,n){typeof r=="string"&&(r=[r]);let i=[],a=new Set;for(let s of this.fileSystemWrapper.globSync(r)){let u=this.addSourceFileAtPathIfExists(s,n);u!=null&&i.push(u),a.add(b.FileUtils.getDirPath(s))}for(let s of b.FileUtils.getParentMostPaths(Array.from(a)))this.addDirectoryAtPathIfExists(s,{recursive:!0,markInProject:n.markInProject});return i}},HH=class{constructor(r){this.context=r,this.directoriesByPath=new b.KeyValueCache,this.sourceFilesByDirPath=new b.KeyValueCache,this.directoriesByDirPath=new b.KeyValueCache,this.orphanDirs=new b.KeyValueCache}has(r){return this.directoriesByPath.has(r)}get(r){if(!this.directoriesByPath.has(r)){for(let n of this.orphanDirs.getValues())if(b.FileUtils.pathStartsWith(n.getPath(),r))return this.createOrAddIfExists(r);return}return this.directoriesByPath.get(r)}getOrphans(){return this.orphanDirs.getValues()}getAll(){return this.directoriesByPath.getValuesAsArray()}*getAllByDepth(){let r=new b.KeyValueCache,n=0;for(let a of this.getOrphans())i(a);for(n=Math.min(...Array.from(r.getKeys()));r.getSize()>0;){for(let a of r.get(n)||[])yield a,a.getDirectories().forEach(i);r.removeByKey(n),n++}function i(a){let s=a._getDepth();if(n>s)throw new Error(`For some reason a subdirectory had a lower depth than the parent directory: ${a.getPath()}`);r.getOrCreate(s,()=>[]).push(a)}}remove(r){this.removeFromDirectoriesByDirPath(r),this.directoriesByPath.removeByKey(r),this.orphanDirs.removeByKey(r)}*getChildDirectoriesOfDirectory(r){var n;let i=(n=this.directoriesByDirPath.get(r))===null||n===void 0?void 0:n.entries();if(i!=null)for(let a of i)yield a}*getChildSourceFilesOfDirectory(r){var n;let i=(n=this.sourceFilesByDirPath.get(r))===null||n===void 0?void 0:n.entries();if(i!=null)for(let a of i)yield a}addSourceFile(r){let n=r.getDirectoryPath();this.createOrAddIfExists(n),this.sourceFilesByDirPath.getOrCreate(n,()=>new b.SortedKeyValueArray(a=>a.getBaseName(),b.LocaleStringComparer.instance)).set(r)}removeSourceFile(r){let n=b.FileUtils.getDirPath(r),i=this.sourceFilesByDirPath.get(n);i!=null&&(i.removeByKey(b.FileUtils.getBaseName(r)),i.hasItems()||this.sourceFilesByDirPath.removeByKey(n))}createOrAddIfExists(r){return this.has(r)?this.get(r):(this.fillParentsOfDirPath(r),this.createDirectory(r))}createDirectory(r){let n=new OE(this.context,r);return this.addDirectory(n),n}addDirectory(r){let n=r.getPath(),i=b.FileUtils.getDirPath(n),a=i===n;for(let s of this.orphanDirs.getValues()){let u=s.getPath(),p=b.FileUtils.getDirPath(u);!(p===u)&&p===n&&this.orphanDirs.removeByKey(u)}a||this.addToDirectoriesByDirPath(r),this.has(i)||this.orphanDirs.set(n,r),this.directoriesByPath.set(n,r),this.context.fileSystemWrapper.directoryExistsSync(n)||this.context.fileSystemWrapper.queueMkdir(n);for(let s of this.orphanDirs.getValues())r.isAncestorOf(s)&&this.fillParentsOfDirPath(s.getPath())}addToDirectoriesByDirPath(r){if(b.FileUtils.isRootDirPath(r.getPath()))return;let n=b.FileUtils.getDirPath(r.getPath());this.directoriesByDirPath.getOrCreate(n,()=>new b.SortedKeyValueArray(a=>a.getBaseName(),b.LocaleStringComparer.instance)).set(r)}removeFromDirectoriesByDirPath(r){if(b.FileUtils.isRootDirPath(r))return;let n=b.FileUtils.getDirPath(r),i=this.directoriesByDirPath.get(n);i!=null&&(i.removeByKey(b.FileUtils.getBaseName(r)),i.hasItems()||this.directoriesByDirPath.removeByKey(n))}fillParentsOfDirPath(r){let n=[],i=b.FileUtils.getDirPath(r);for(;r!==i;){if(r=i,i=b.FileUtils.getDirPath(r),this.directoriesByPath.has(r)){for(let a of n)this.createDirectory(a);break}n.unshift(r)}}},qH=class extends b.KeyValueCache{constructor(){super(...arguments),this.forgetStack=[]}getOrCreate(r,n){return super.getOrCreate(r,()=>{let i=n();return this.forgetStack.length>0&&this.forgetStack[this.forgetStack.length-1].add(i),i})}setForgetPoint(){this.forgetStack.push(new Set)}forgetLastPoint(){let r=this.forgetStack.pop();r!=null&&this.forgetNodes(r.values())}rememberNode(r){if(r.wasForgotten())throw new b.errors.InvalidOperationError("Cannot remember a node that was removed or forgotten.");let n=!1;for(let i of this.forgetStack)if(i.delete(r)){n=!0;break}return n&&this.rememberParentOfNode(r),n}rememberParentOfNode(r){let n=r.getParentSyntaxList()||r.getParent();n!=null&&this.rememberNode(n)}forgetNodes(r){for(let n of r)n.wasForgotten()||n.getKind()===b.SyntaxKind.SourceFile||n._forgetOnlyThis()}},ZUe={[b.SyntaxKind.SourceFile]:kE,[b.SyntaxKind.ArrayBindingPattern]:cM,[b.SyntaxKind.ArrayLiteralExpression]:mM,[b.SyntaxKind.ArrayType]:Vw,[b.SyntaxKind.ArrowFunction]:Nw,[b.SyntaxKind.AsExpression]:_M,[b.SyntaxKind.AssertClause]:cw,[b.SyntaxKind.AssertEntry]:dw,[b.SyntaxKind.AwaitExpression]:gM,[b.SyntaxKind.BigIntLiteral]:E6,[b.SyntaxKind.BindingElement]:dM,[b.SyntaxKind.BinaryExpression]:oL,[b.SyntaxKind.Block]:WM,[b.SyntaxKind.BreakStatement]:VM,[b.SyntaxKind.CallExpression]:yM,[b.SyntaxKind.CallSignature]:t6,[b.SyntaxKind.CaseBlock]:jM,[b.SyntaxKind.CaseClause]:HM,[b.SyntaxKind.CatchClause]:qM,[b.SyntaxKind.ClassDeclaration]:kw,[b.SyntaxKind.ClassExpression]:Rw,[b.SyntaxKind.ClassStaticBlockDeclaration]:Mw,[b.SyntaxKind.ConditionalType]:jw,[b.SyntaxKind.Constructor]:Fw,[b.SyntaxKind.ConstructorType]:Hw,[b.SyntaxKind.ConstructSignature]:i6,[b.SyntaxKind.ContinueStatement]:zM,[b.SyntaxKind.CommaListExpression]:vM,[b.SyntaxKind.ComputedPropertyName]:R6,[b.SyntaxKind.ConditionalExpression]:hM,[b.SyntaxKind.DebuggerStatement]:$M,[b.SyntaxKind.Decorator]:Kw,[b.SyntaxKind.DefaultClause]:XM,[b.SyntaxKind.DeleteExpression]:EM,[b.SyntaxKind.DoStatement]:YM,[b.SyntaxKind.ElementAccessExpression]:lL,[b.SyntaxKind.EmptyStatement]:QM,[b.SyntaxKind.EnumDeclaration]:ZF,[b.SyntaxKind.EnumMember]:e6,[b.SyntaxKind.ExportAssignment]:fw,[b.SyntaxKind.ExportDeclaration]:pw,[b.SyntaxKind.ExportSpecifier]:mw,[b.SyntaxKind.ExpressionWithTypeArguments]:qw,[b.SyntaxKind.ExpressionStatement]:ZM,[b.SyntaxKind.ExternalModuleReference]:_w,[b.SyntaxKind.QualifiedName]:F6,[b.SyntaxKind.ForInStatement]:ew,[b.SyntaxKind.ForOfStatement]:rw,[b.SyntaxKind.ForStatement]:tw,[b.SyntaxKind.FunctionDeclaration]:Iw,[b.SyntaxKind.FunctionExpression]:Pw,[b.SyntaxKind.FunctionType]:Jw,[b.SyntaxKind.GetAccessor]:Gw,[b.SyntaxKind.HeritageClause]:r6,[b.SyntaxKind.Identifier]:M6,[b.SyntaxKind.IfStatement]:nw,[b.SyntaxKind.ImportClause]:gw,[b.SyntaxKind.ImportDeclaration]:yw,[b.SyntaxKind.ImportEqualsDeclaration]:vw,[b.SyntaxKind.ImportSpecifier]:hw,[b.SyntaxKind.ImportType]:$w,[b.SyntaxKind.ImportTypeAssertionContainer]:zw,[b.SyntaxKind.IndexedAccessType]:Xw,[b.SyntaxKind.IndexSignature]:a6,[b.SyntaxKind.InferType]:Yw,[b.SyntaxKind.InterfaceDeclaration]:o6,[b.SyntaxKind.IntersectionType]:Qw,[b.SyntaxKind.JSDocAllType]:mF,[b.SyntaxKind.JSDocAugmentsTag]:_F,[b.SyntaxKind.JSDocAuthorTag]:gF,[b.SyntaxKind.JSDocCallbackTag]:yF,[b.SyntaxKind.JSDocClassTag]:vF,[b.SyntaxKind.JSDocDeprecatedTag]:hF,[b.SyntaxKind.JSDocEnumTag]:EF,[b.SyntaxKind.JSDocFunctionType]:bF,[b.SyntaxKind.JSDocImplementsTag]:SF,[b.SyntaxKind.JSDocLink]:TF,[b.SyntaxKind.JSDocLinkCode]:xF,[b.SyntaxKind.JSDocLinkPlain]:DF,[b.SyntaxKind.JSDocMemberName]:CF,[b.SyntaxKind.JSDocNamepathType]:AF,[b.SyntaxKind.JSDocNameReference]:LF,[b.SyntaxKind.JSDocNonNullableType]:NF,[b.SyntaxKind.JSDocNullableType]:IF,[b.SyntaxKind.JSDocOptionalType]:PF,[b.SyntaxKind.JSDocOverrideTag]:OF,[b.SyntaxKind.JSDocParameterTag]:kF,[b.SyntaxKind.JSDocPrivateTag]:RF,[b.SyntaxKind.JSDocPropertyTag]:MF,[b.SyntaxKind.JSDocProtectedTag]:wF,[b.SyntaxKind.JSDocPublicTag]:FF,[b.SyntaxKind.JSDocReturnTag]:BF,[b.SyntaxKind.JSDocReadonlyTag]:GF,[b.SyntaxKind.JSDocSeeTag]:UF,[b.SyntaxKind.JSDocSignature]:KF,[b.SyntaxKind.JSDocTag]:$F,[b.SyntaxKind.JSDocTemplateTag]:WF,[b.SyntaxKind.JSDocText]:VF,[b.SyntaxKind.JSDocThisTag]:jF,[b.SyntaxKind.JSDocTypeExpression]:qF,[b.SyntaxKind.JSDocTypeLiteral]:JF,[b.SyntaxKind.JSDocTypeTag]:zF,[b.SyntaxKind.JSDocTypedefTag]:HF,[b.SyntaxKind.JSDocUnknownType]:XF,[b.SyntaxKind.JSDocVariadicType]:YF,[b.SyntaxKind.JsxAttribute]:u6,[b.SyntaxKind.JsxClosingElement]:c6,[b.SyntaxKind.JsxClosingFragment]:d6,[b.SyntaxKind.JsxElement]:f6,[b.SyntaxKind.JsxExpression]:p6,[b.SyntaxKind.JsxFragment]:m6,[b.SyntaxKind.JsxOpeningElement]:_6,[b.SyntaxKind.JsxOpeningFragment]:g6,[b.SyntaxKind.JsxSelfClosingElement]:y6,[b.SyntaxKind.JsxSpreadAttribute]:v6,[b.SyntaxKind.JsxText]:h6,[b.SyntaxKind.LabeledStatement]:iw,[b.SyntaxKind.LiteralType]:Zw,[b.SyntaxKind.MappedType]:eF,[b.SyntaxKind.MetaProperty]:SM,[b.SyntaxKind.MethodDeclaration]:KD,[b.SyntaxKind.MethodSignature]:s6,[b.SyntaxKind.ModuleBlock]:Ew,[b.SyntaxKind.ModuleDeclaration]:bw,[b.SyntaxKind.NamedExports]:Sw,[b.SyntaxKind.NamedImports]:Tw,[b.SyntaxKind.NamedTupleMember]:rF,[b.SyntaxKind.NamespaceExport]:xw,[b.SyntaxKind.NamespaceImport]:Dw,[b.SyntaxKind.NewExpression]:TM,[b.SyntaxKind.NonNullExpression]:xM,[b.SyntaxKind.NotEmittedStatement]:aw,[b.SyntaxKind.NoSubstitutionTemplateLiteral]:A6,[b.SyntaxKind.NumericLiteral]:x6,[b.SyntaxKind.ObjectBindingPattern]:fM,[b.SyntaxKind.ObjectLiteralExpression]:CM,[b.SyntaxKind.OmittedExpression]:IM,[b.SyntaxKind.Parameter]:Ow,[b.SyntaxKind.ParenthesizedExpression]:PM,[b.SyntaxKind.ParenthesizedType]:tF,[b.SyntaxKind.PartiallyEmittedExpression]:OM,[b.SyntaxKind.PostfixUnaryExpression]:kM,[b.SyntaxKind.PrefixUnaryExpression]:RM,[b.SyntaxKind.PrivateIdentifier]:w6,[b.SyntaxKind.PropertyAccessExpression]:uL,[b.SyntaxKind.PropertyAssignment]:AM,[b.SyntaxKind.PropertyDeclaration]:Bw,[b.SyntaxKind.PropertySignature]:l6,[b.SyntaxKind.RegularExpressionLiteral]:D6,[b.SyntaxKind.ReturnStatement]:ow,[b.SyntaxKind.SetAccessor]:Uw,[b.SyntaxKind.ShorthandPropertyAssignment]:LM,[b.SyntaxKind.SpreadAssignment]:NM,[b.SyntaxKind.SpreadElement]:MM,[b.SyntaxKind.StringLiteral]:C6,[b.SyntaxKind.SwitchStatement]:sw,[b.SyntaxKind.SyntaxList]:sM,[b.SyntaxKind.TaggedTemplateExpression]:L6,[b.SyntaxKind.TemplateExpression]:N6,[b.SyntaxKind.TemplateHead]:I6,[b.SyntaxKind.TemplateLiteralType]:nF,[b.SyntaxKind.TemplateMiddle]:P6,[b.SyntaxKind.TemplateSpan]:O6,[b.SyntaxKind.TemplateTail]:k6,[b.SyntaxKind.ThisType]:iF,[b.SyntaxKind.ThrowStatement]:lw,[b.SyntaxKind.TryStatement]:uw,[b.SyntaxKind.TupleType]:aF,[b.SyntaxKind.TypeAliasDeclaration]:oF,[b.SyntaxKind.TypeAssertionExpression]:GM,[b.SyntaxKind.TypeLiteral]:sF,[b.SyntaxKind.TypeOperator]:lF,[b.SyntaxKind.TypeParameter]:uF,[b.SyntaxKind.TypePredicate]:cF,[b.SyntaxKind.TypeQuery]:dF,[b.SyntaxKind.TypeReference]:fF,[b.SyntaxKind.UnionType]:pF,[b.SyntaxKind.VariableDeclaration]:G6,[b.SyntaxKind.VariableDeclarationList]:B6,[b.SyntaxKind.VariableStatement]:Cw,[b.SyntaxKind.JSDoc]:Ww,[b.SyntaxKind.TypeOfExpression]:BM,[b.SyntaxKind.WhileStatement]:Aw,[b.SyntaxKind.WithStatement]:Lw,[b.SyntaxKind.YieldExpression]:KM,[b.SyntaxKind.SemicolonToken]:Tr,[b.SyntaxKind.AnyKeyword]:oc,[b.SyntaxKind.BooleanKeyword]:oc,[b.SyntaxKind.FalseKeyword]:S6,[b.SyntaxKind.ImportKeyword]:bM,[b.SyntaxKind.InferKeyword]:Tr,[b.SyntaxKind.NeverKeyword]:Tr,[b.SyntaxKind.NullKeyword]:T6,[b.SyntaxKind.NumberKeyword]:oc,[b.SyntaxKind.ObjectKeyword]:oc,[b.SyntaxKind.StringKeyword]:oc,[b.SyntaxKind.SymbolKeyword]:oc,[b.SyntaxKind.SuperKeyword]:wM,[b.SyntaxKind.ThisKeyword]:FM,[b.SyntaxKind.TrueKeyword]:b6,[b.SyntaxKind.UndefinedKeyword]:oc,[b.SyntaxKind.VoidExpression]:UM},JH=class{constructor(r){this.context=r,this.sourceFileCacheByFilePath=new Map,this.diagnosticCache=new b.WeakCache,this.definitionInfoCache=new b.WeakCache,this.documentSpanCache=new b.WeakCache,this.diagnosticMessageChainCache=new b.WeakCache,this.jsDocTagInfoCache=new b.WeakCache,this.signatureCache=new b.WeakCache,this.symbolCache=new b.WeakCache,this.symbolDisplayPartCache=new b.WeakCache,this.referencedSymbolEntryCache=new b.WeakCache,this.referencedSymbolCache=new b.WeakCache,this.referencedSymbolDefinitionInfoCache=new b.WeakCache,this.typeCache=new b.WeakCache,this.typeParameterCache=new b.WeakCache,this.nodeCache=new qH,this.sourceFileAddedEventContainer=new b.EventContainer,this.sourceFileRemovedEventContainer=new b.EventContainer,this.documentRegistry=new b.DocumentRegistry(r.fileSystemWrapper),this.directoryCache=new HH(r),this.context.compilerOptions.onModified(()=>{let n=Array.from(this.sourceFileCacheByFilePath.values());for(let i of n)_9e(i)})}*getSourceFilesByDirectoryDepth(){for(let r of this.getDirectoriesByDepth())yield*r.getSourceFiles()}getSourceFilePaths(){return this.sourceFileCacheByFilePath.keys()}getChildDirectoriesOfDirectory(r){return this.directoryCache.getChildDirectoriesOfDirectory(r)}getChildSourceFilesOfDirectory(r){return this.directoryCache.getChildSourceFilesOfDirectory(r)}onSourceFileAdded(r,n=!0){n?this.sourceFileAddedEventContainer.subscribe(r):this.sourceFileAddedEventContainer.unsubscribe(r)}onSourceFileRemoved(r){this.sourceFileRemovedEventContainer.subscribe(r)}createSourceFile(r,n,i){if(n=n instanceof Function?Yg(this.context.createWriter(),n):n||"",typeof n=="string")return this.createSourceFileFromText(r,n,i);let a=this.context.createWriter();return this.context.structurePrinterFactory.forSourceFile({isAmbient:b.FileUtils.getExtension(r)===".d.ts"}).printText(a,n),this.createSourceFileFromText(r,a.toString(),i)}createSourceFileFromText(r,n,i){return r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r),i.overwrite===!0?this.createOrOverwriteSourceFileFromText(r,n,i):(this.throwIfFileExists(r,"Did you mean to provide the overwrite option?"),this.createSourceFileFromTextInternal(r,n,i))}throwIfFileExists(r,n){if(!(!this.containsSourceFileAtPath(r)&&!this.context.fileSystemWrapper.fileExistsSync(r)))throw n=n==null?"":n+" ",new b.errors.InvalidOperationError(`${n}A source file already exists at the provided file path: ${r}`)}createOrOverwriteSourceFileFromText(r,n,i){r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r);let a=this.addOrGetSourceFileFromFilePath(r,i);return a!=null?(a.getChildren().forEach(s=>s.forget()),this.replaceCompilerNode(a,this.createCompilerSourceFileFromText(r,n,i.scriptKind)),a):this.createSourceFileFromTextInternal(r,n,i)}getSourceFileFromCacheFromFilePath(r){return r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r),this.sourceFileCacheByFilePath.get(r)}addOrGetSourceFileFromFilePath(r,n){r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r);let i=this.sourceFileCacheByFilePath.get(r);if(i==null){let a=this.context.fileSystemWrapper.readFileIfExistsSync(r,this.context.getEncoding());a!=null&&(this.context.logger.log(`Loaded file: ${r}`),i=this.createSourceFileFromTextInternal(r,a,n),i._setIsSaved(!0))}return i!=null&&n.markInProject&&i._markAsInProject(),i}containsSourceFileAtPath(r){return r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r),this.sourceFileCacheByFilePath.has(r)}containsDirectoryAtPath(r){return r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r),this.directoryCache.has(r)}getSourceFileForNode(r){let n=r;for(;n.kind!==b.SyntaxKind.SourceFile;){if(n.parent==null)return;n=n.parent}return this.getSourceFile(n,{markInProject:!1})}hasCompilerNode(r){return this.nodeCache.has(r)}getExistingNodeFromCompilerNode(r){return this.nodeCache.get(r)}getNodeFromCompilerNode(r,n){if(r.kind===b.SyntaxKind.SourceFile)return this.getSourceFile(r,{markInProject:!1});return this.nodeCache.getOrCreate(r,()=>{let u=i.call(this);return s.call(this,u),u});function i(){if(a(r))return p_.isCommentStatement(r)?new JM(this.context,r,n):p_.isCommentClassElement(r)?new ww(this.context,r,n):p_.isCommentTypeElement(r)?new n6(this.context,r,n):p_.isCommentObjectLiteralElement(r)?new DM(this.context,r,n):p_.isCommentEnumMember(r)?new QF(this.context,r,n):b.errors.throwNotImplementedForNeverValueError(r);let u=ZUe[r.kind]||Tr;return new u(this.context,r,n)}function a(u){return u._commentKind!=null}function s(u){if(r.parent!=null){let f=this.getNodeFromCompilerNode(r.parent,n);f._wrappedChildCount++}let p=u._getParentSyntaxListIfWrapped();if(p!=null&&p._wrappedChildCount++,r.kind===b.SyntaxKind.SyntaxList){let f=0;for(let m of u._getChildrenInCacheIterator())f++;u._wrappedChildCount=f}}}createSourceFileFromTextInternal(r,n,i){let a=b.StringUtils.hasBom(n);a&&(n=b.StringUtils.stripBom(n));let s=this.getSourceFile(this.createCompilerSourceFileFromText(r,n,i.scriptKind),i);return a&&(s._hasBom=!0),s}createCompilerSourceFileFromText(r,n,i){return this.documentRegistry.createOrUpdateSourceFile(r,this.context.compilerOptions.get(),b.ts.ScriptSnapshot.fromString(n),i)}getSourceFile(r,n){var i;let a=!1,s=(i=this.sourceFileCacheByFilePath.get(r.fileName))!==null&&i!==void 0?i:this.nodeCache.getOrCreate(r,()=>{let u=new kE(this.context,r);return n.markInProject||this.context.inProjectCoordinator.setSourceFileNotInProject(u),this.addSourceFileToCache(u),a=!0,u});return n.markInProject&&s._markAsInProject(),a&&this.sourceFileAddedEventContainer.fire(s),s}addSourceFileToCache(r){this.sourceFileCacheByFilePath.set(r.getFilePath(),r),this.context.fileSystemWrapper.removeFileDelete(r.getFilePath()),this.directoryCache.addSourceFile(r)}getDirectoryFromPath(r,n){r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r);let i=this.directoryCache.get(r);return i==null&&this.context.fileSystemWrapper.directoryExistsSync(r)&&(i=this.directoryCache.createOrAddIfExists(r)),i!=null&&n.markInProject&&i._markAsInProject(),i}createDirectoryOrAddIfExists(r,n){let i=this.directoryCache.createOrAddIfExists(r);return i!=null&&n.markInProject&&i._markAsInProject(),i}getDirectoryFromCache(r){return this.directoryCache.get(r)}getDirectoryFromCacheOnlyIfInCache(r){return this.directoryCache.has(r)?this.directoryCache.get(r):void 0}getDirectoriesByDepth(){return this.directoryCache.getAllByDepth()}getOrphanDirectories(){return this.directoryCache.getOrphans()}getSymbolDisplayPart(r){return this.symbolDisplayPartCache.getOrCreate(r,()=>new $6(r))}getType(r){return(r.flags&b.TypeFlags.TypeParameter)===b.TypeFlags.TypeParameter?this.getTypeParameter(r):this.typeCache.getOrCreate(r,()=>new EL(this.context,r))}getTypeParameter(r){return this.typeParameterCache.getOrCreate(r,()=>new Q6(this.context,r))}getSignature(r){return this.signatureCache.getOrCreate(r,()=>new U6(this.context,r))}getSymbol(r){return this.symbolCache.getOrCreate(r,()=>new K6(this.context,r))}getDefinitionInfo(r){return this.definitionInfoCache.getOrCreate(r,()=>new VD(this.context,r))}getDocumentSpan(r){return this.documentSpanCache.getOrCreate(r,()=>new pv(this.context,r))}getReferencedSymbolEntry(r){return this.referencedSymbolEntryCache.getOrCreate(r,()=>new J6(this.context,r))}getReferencedSymbol(r){return this.referencedSymbolCache.getOrCreate(r,()=>new yL(this.context,r))}getReferencedSymbolDefinitionInfo(r){return this.referencedSymbolDefinitionInfoCache.getOrCreate(r,()=>new vL(this.context,r))}getDiagnostic(r){return this.diagnosticCache.getOrCreate(r,()=>r.start!=null?new pL(this.context,r):new VT(this.context,r))}getDiagnosticWithLocation(r){return this.diagnosticCache.getOrCreate(r,()=>new pL(this.context,r))}getDiagnosticMessageChain(r){return this.diagnosticMessageChainCache.getOrCreate(r,()=>new mS(r))}getJSDocTagInfo(r){return this.jsDocTagInfoCache.getOrCreate(r,()=>new dL(r))}replaceCompilerNode(r,n){let i=r instanceof Tr?r.compilerNode:r,a=r instanceof Tr?r:this.nodeCache.get(r);if(i.kind===b.SyntaxKind.SourceFile&&i.fileName!==n.fileName){let s=a;this.removeCompilerNodeFromCache(i),s._replaceCompilerNodeFromFactory(n),this.nodeCache.set(n,s),this.addSourceFileToCache(s),this.sourceFileAddedEventContainer.fire(s)}else this.nodeCache.replaceKey(i,n),a?._replaceCompilerNodeFromFactory(n)}removeNodeFromCache(r){this.removeCompilerNodeFromCache(r.compilerNode)}removeCompilerNodeFromCache(r){if(this.nodeCache.removeByKey(r),r.kind===b.SyntaxKind.SourceFile){let n=r,i=this.context.fileSystemWrapper.getStandardizedAbsolutePath(n.fileName);this.directoryCache.removeSourceFile(i);let a=this.sourceFileCacheByFilePath.get(i);this.sourceFileCacheByFilePath.delete(i),this.documentRegistry.removeSourceFile(i),a!=null&&this.sourceFileRemovedEventContainer.fire(a)}}addDirectoryToCache(r){this.directoryCache.addDirectory(r)}removeDirectoryFromCache(r){this.directoryCache.remove(r)}forgetNodesCreatedInBlock(r){this.nodeCache.setForgetPoint();let n=!1,i;try{if(i=r((...s)=>{for(let u of s)this.nodeCache.rememberNode(u)}),Tr.isNode(i)&&this.nodeCache.rememberNode(i),a(i))return n=!0,i.then(s=>(Tr.isNode(s)&&this.nodeCache.rememberNode(s),this.nodeCache.forgetLastPoint(),s))}finally{n||this.nodeCache.forgetLastPoint()}return i;function a(s){return s!=null&&typeof s.then=="function"}}},zH=class{constructor(r){this.compilerFactory=r,this.notInProjectFiles=new Set,r.onSourceFileRemoved(n=>{this.notInProjectFiles.delete(n)})}setSourceFileNotInProject(r){this.notInProjectFiles.add(r),r._inProject=!1}markSourceFileAsInProject(r){this.isSourceFileInProject(r)||(this._internalMarkSourceFileAsInProject(r),this.notInProjectFiles.delete(r))}markSourceFilesAsInProjectForResolution(){let r="/node_modules/",n=this.compilerFactory,i=[],a=[];for(let u of[...this.notInProjectFiles.values()])s(u)?(this._internalMarkSourceFileAsInProject(u),this.notInProjectFiles.delete(u),i.push(u)):a.push(u);return{changedSourceFiles:i,unchangedSourceFiles:a};function s(u){let p=u.getFilePath(),f=p.toLowerCase().lastIndexOf(r);if(f===-1)return!0;let m=p.substring(0,f+r.length-1),g=n.getDirectoryFromCacheOnlyIfInCache(m);if(g!=null&&g._isInProject())return!0;let D=u.getDirectory();for(;D!=null&&D.getPath()!==m;){if(D._isInProject())return!0;D=n.getDirectoryFromCacheOnlyIfInCache(b.FileUtils.getDirPath(D.getPath()))}return!1}}_internalMarkSourceFileAsInProject(r){r._inProject=!0,this.markDirectoryAsInProject(r.getDirectory())}isSourceFileInProject(r){return r._inProject===!0}setDirectoryAndFilesAsNotInProjectForTesting(r){for(let n of r.getDirectories())this.setDirectoryAndFilesAsNotInProjectForTesting(n);for(let n of r.getSourceFiles())delete n._inProject,this.notInProjectFiles.add(n);delete r._inProject}markDirectoryAsInProject(r){if(this.isDirectoryInProject(r))return;let n=this,i=this.compilerFactory;r._inProject=!0,a(r);function a(u){let p=Array.from(s(u)),f=p[p.length-1];if(!(f==null||!n.isDirectoryInProject(f)))for(let m of p)m._inProject=!0}function*s(u){if(b.FileUtils.isRootDirPath(u.getPath()))return;let p=b.FileUtils.getDirPath(u.getPath()),f=i.getDirectoryFromCacheOnlyIfInCache(p);f!=null&&(yield f,n.isDirectoryInProject(f)||(yield*s(f)))}}isDirectoryInProject(r){return r._inProject===!0}},Vo=class{constructor(r){this._getFormatCodeSettings=r}getFormatCodeSettings(){return this._getFormatCodeSettings()}forInitializerExpressionableNode(){return new Uj}forModifierableNode(){return new Kj}forReturnTypedNode(r){return new Wj(r)}forTypedNode(r,n){return new Vj(r,n)}forClassDeclaration(r){return new Hj(this,r)}forClassMember(r){return new qj(this,r)}forClassStaticBlockDeclaration(){return new Jj(this)}forConstructorDeclaration(r){return new zj(this,r)}forGetAccessorDeclaration(r){return new $j(this,r)}forMethodDeclaration(r){return new Xj(this,r)}forPropertyDeclaration(){return new Yj(this)}forSetAccessorDeclaration(r){return new Qj(this,r)}forDecorator(){return new Zj(this)}forJSDoc(){return new eH(this)}forJSDocTag(r){return new rH(this,r)}forEnumDeclaration(){return new tH(this)}forEnumMember(){return new nH(this)}forObjectLiteralExpressionProperty(){return new iH(this)}forPropertyAssignment(){return new aH(this)}forShorthandPropertyAssignment(){return new oH(this)}forSpreadAssignment(){return new sH(this)}forFunctionDeclaration(r){return new lH(this,r)}forParameterDeclaration(){return new uH(this)}forCallSignatureDeclaration(){return new cH(this)}forConstructSignatureDeclaration(){return new dH(this)}forIndexSignatureDeclaration(){return new fH(this)}forInterfaceDeclaration(){return new pH(this)}forMethodSignature(){return new mH(this)}forPropertySignature(){return new _H(this)}forTypeElementMemberedNode(){return new gH(this)}forTypeElementMember(){return new yH(this)}forJsxAttributeDecider(){return new vH(this)}forJsxAttribute(){return new hH(this)}forJsxChildDecider(){return new EH(this)}forJsxElement(){return new bH(this)}forJsxSelfClosingElement(){return new SH(this)}forJsxSpreadAttribute(){return new TH(this)}forAssertEntry(){return new xH(this)}forExportAssignment(){return new DH(this)}forExportDeclaration(){return new CH(this)}forImportDeclaration(){return new AH(this)}forModuleDeclaration(r){return new LH(this,r)}forNamedImportExportSpecifier(){return new NH(this)}forSourceFile(r){return new IH(this,r)}forStatementedNode(r){return new PH(this,r)}forStatement(r){return new OH(this,r)}forVariableStatement(){return new kH(this)}forTypeAliasDeclaration(){return new RH(this)}forTypeParameterDeclaration(){return new MH(this)}forVariableDeclaration(){return new wH(this)}};co([b.Memoize],Vo.prototype,"forInitializerExpressionableNode",null);co([b.Memoize],Vo.prototype,"forModifierableNode",null);co([b.Memoize],Vo.prototype,"forReturnTypedNode",null);co([b.Memoize],Vo.prototype,"forTypedNode",null);co([b.Memoize],Vo.prototype,"forClassDeclaration",null);co([b.Memoize],Vo.prototype,"forClassMember",null);co([b.Memoize],Vo.prototype,"forClassStaticBlockDeclaration",null);co([b.Memoize],Vo.prototype,"forConstructorDeclaration",null);co([b.Memoize],Vo.prototype,"forGetAccessorDeclaration",null);co([b.Memoize],Vo.prototype,"forMethodDeclaration",null);co([b.Memoize],Vo.prototype,"forPropertyDeclaration",null);co([b.Memoize],Vo.prototype,"forSetAccessorDeclaration",null);co([b.Memoize],Vo.prototype,"forDecorator",null);co([b.Memoize],Vo.prototype,"forJSDoc",null);co([b.Memoize],Vo.prototype,"forJSDocTag",null);co([b.Memoize],Vo.prototype,"forEnumDeclaration",null);co([b.Memoize],Vo.prototype,"forEnumMember",null);co([b.Memoize],Vo.prototype,"forObjectLiteralExpressionProperty",null);co([b.Memoize],Vo.prototype,"forPropertyAssignment",null);co([b.Memoize],Vo.prototype,"forShorthandPropertyAssignment",null);co([b.Memoize],Vo.prototype,"forSpreadAssignment",null);co([b.Memoize],Vo.prototype,"forFunctionDeclaration",null);co([b.Memoize],Vo.prototype,"forParameterDeclaration",null);co([b.Memoize],Vo.prototype,"forCallSignatureDeclaration",null);co([b.Memoize],Vo.prototype,"forConstructSignatureDeclaration",null);co([b.Memoize],Vo.prototype,"forIndexSignatureDeclaration",null);co([b.Memoize],Vo.prototype,"forInterfaceDeclaration",null);co([b.Memoize],Vo.prototype,"forMethodSignature",null);co([b.Memoize],Vo.prototype,"forPropertySignature",null);co([b.Memoize],Vo.prototype,"forTypeElementMemberedNode",null);co([b.Memoize],Vo.prototype,"forTypeElementMember",null);co([b.Memoize],Vo.prototype,"forJsxAttributeDecider",null);co([b.Memoize],Vo.prototype,"forJsxAttribute",null);co([b.Memoize],Vo.prototype,"forJsxChildDecider",null);co([b.Memoize],Vo.prototype,"forJsxElement",null);co([b.Memoize],Vo.prototype,"forJsxSelfClosingElement",null);co([b.Memoize],Vo.prototype,"forJsxSpreadAttribute",null);co([b.Memoize],Vo.prototype,"forAssertEntry",null);co([b.Memoize],Vo.prototype,"forExportAssignment",null);co([b.Memoize],Vo.prototype,"forExportDeclaration",null);co([b.Memoize],Vo.prototype,"forImportDeclaration",null);co([b.Memoize],Vo.prototype,"forModuleDeclaration",null);co([b.Memoize],Vo.prototype,"forNamedImportExportSpecifier",null);co([b.Memoize],Vo.prototype,"forSourceFile",null);co([b.Memoize],Vo.prototype,"forStatementedNode",null);co([b.Memoize],Vo.prototype,"forStatement",null);co([b.Memoize],Vo.prototype,"forVariableStatement",null);co([b.Memoize],Vo.prototype,"forTypeAliasDeclaration",null);co([b.Memoize],Vo.prototype,"forTypeParameterDeclaration",null);co([b.Memoize],Vo.prototype,"forVariableDeclaration",null);var jD=class{constructor(r){this.logger=new vj,this.manipulationSettings=new QR,this._project=r.project,this.fileSystemWrapper=r.fileSystemWrapper,this._compilerOptions=r.compilerOptionsContainer,this.compilerFactory=new JH(this),this.inProjectCoordinator=new zH(this.compilerFactory),this.structurePrinterFactory=new Vo(()=>this.manipulationSettings.getFormatCodeSettings()),this.lazyReferenceCoordinator=new hj(this.compilerFactory),this.directoryCoordinator=new jH(this.compilerFactory,r.fileSystemWrapper),this._languageService=r.createLanguageService?new Y6({context:this,configFileParsingDiagnostics:r.configFileParsingDiagnostics,resolutionHost:r.resolutionHost&&r.resolutionHost(this.getModuleResolutionHost(),()=>this.compilerOptions.get()),skipLoadingLibFiles:r.skipLoadingLibFiles,libFolderPath:r.libFolderPath}):void 0,r.typeChecker!=null&&(b.errors.throwIfTrue(r.createLanguageService,"Cannot specify a type checker and create a language service."),this._customTypeChecker=new hL(this),this._customTypeChecker._reset(()=>r.typeChecker))}get project(){if(this._project==null)throw new b.errors.InvalidOperationError("This operation is not permitted in this context.");return this._project}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 r=this.manipulationSettings.getIndentationText();return new YR.default({newLine:this.manipulationSettings.getNewLineKindAsString(),indentNumberOfSpaces:r===Oe.IndentationText.Tab?void 0:r.length,useTabs:r===Oe.IndentationText.Tab,useSingleQuote:this.manipulationSettings.getQuoteKind()===Oe.QuoteKind.Single})}getPreEmitDiagnostics(r){return b.ts.getPreEmitDiagnostics(this.program.compilerObject,r?.compilerNode).map(i=>this.compilerFactory.getDiagnostic(i))}getSourceFileContainer(){return{addOrGetSourceFileFromFilePath:(r,n)=>{var i;return Promise.resolve((i=this.compilerFactory.addOrGetSourceFileFromFilePath(r,n))===null||i===void 0?void 0:i.compilerNode)},addOrGetSourceFileFromFilePathSync:(r,n)=>{var i;return(i=this.compilerFactory.addOrGetSourceFileFromFilePath(r,n))===null||i===void 0?void 0:i.compilerNode},containsDirectoryAtPath:r=>this.compilerFactory.containsDirectoryAtPath(r),containsSourceFileAtPath:r=>this.compilerFactory.containsSourceFileAtPath(r),getSourceFileFromCacheFromFilePath:r=>{let n=this.compilerFactory.getSourceFileFromCacheFromFilePath(r);return n?.compilerNode},getSourceFilePaths:()=>this.compilerFactory.getSourceFilePaths(),getSourceFileVersion:r=>this.compilerFactory.documentRegistry.getSourceFileVersion(r),getChildDirectoriesOfDirectory:r=>{let n=[];for(let i of this.compilerFactory.getChildDirectoriesOfDirectory(r))n.push(i.getPath());return n}}}getModuleResolutionHost(){return b.createModuleResolutionHost({transactionalFileSystem:this.fileSystemWrapper,getEncoding:()=>this.getEncoding(),sourceFileContainer:this.getSourceFileContainer()})}getToolRequiredError(r){return new b.errors.InvalidOperationError(`A ${r} 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 ${r} should be required for this operation.`)}};co([b.Memoize],jD.prototype,"getSourceFileContainer",null);co([b.Memoize],jD.prototype,"getModuleResolutionHost",null);var $H=class{constructor(r={}){var n;f();let i=m(),a=new b.TransactionalFileSystem({fileSystem:i,skipLoadingLibFiles:r.skipLoadingLibFiles,libFolderPath:r.libFolderPath}),s=r.tsConfigFilePath==null?void 0:new b.TsConfigResolver(a,a.getStandardizedAbsolutePath(r.tsConfigFilePath),P()),u=g(),p=new b.CompilerOptionsContainer;p.set(u),this._context=new jD({project:this,compilerOptionsContainer:p,fileSystemWrapper:a,createLanguageService:!0,resolutionHost:r.resolutionHost,configFileParsingDiagnostics:(n=s?.getErrors())!==null&&n!==void 0?n:[],skipLoadingLibFiles:r.skipLoadingLibFiles,libFolderPath:r.libFolderPath}),r.manipulationSettings!=null&&this._context.manipulationSettings.set(r.manipulationSettings),s!=null&&r.skipAddingFilesFromTsConfig!==!0&&(this._addSourceFilesForTsConfigResolver(s,u),r.skipFileDependencyResolution||this.resolveSourceFileDependencies());function f(){if(r.fileSystem!=null&&r.useInMemoryFileSystem)throw new b.errors.InvalidOperationError("Cannot provide a file system when specifying to use an in-memory file system.")}function m(){var B;return r.useInMemoryFileSystem?new b.InMemoryFileSystemHost:(B=r.fileSystem)!==null&&B!==void 0?B:new b.RealFileSystemHost}function g(){var B;return{...D(),...(B=r.compilerOptions)!==null&&B!==void 0?B:{}}}function D(){var B;return(B=s?.getCompilerOptions())!==null&&B!==void 0?B:{}}function P(){var B;let K="utf-8";return r.compilerOptions!=null&&(B=r.compilerOptions.charset)!==null&&B!==void 0?B:K}}get manipulationSettings(){return this._context.manipulationSettings}get compilerOptions(){return this._context.compilerOptions}resolveSourceFileDependencies(){let r=new Set,n=u=>r.add(u),{compilerFactory:i,inProjectCoordinator:a}=this._context;i.onSourceFileAdded(n);try{this.getProgram().compilerObject}finally{i.onSourceFileAdded(n,!1)}let s=a.markSourceFilesAsInProjectForResolution();for(let u of s.changedSourceFiles)r.add(u);for(let u of s.unchangedSourceFiles)r.delete(u);return Array.from(r.values())}addDirectoryAtPathIfExists(r,n={}){return this._context.directoryCoordinator.addDirectoryAtPathIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),{...n,markInProject:!0})}addDirectoryAtPath(r,n={}){return this._context.directoryCoordinator.addDirectoryAtPath(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),{...n,markInProject:!0})}createDirectory(r){return this._context.directoryCoordinator.createDirectoryOrAddIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),{markInProject:!0})}getDirectoryOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getDirectory(r),()=>`Could not find a directory at the specified path: ${this._context.fileSystemWrapper.getStandardizedAbsolutePath(r)}`)}getDirectory(r){let{compilerFactory:n}=this._context;return n.getDirectoryFromCache(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r))}getDirectories(){return Array.from(this._getProjectDirectoriesByDirectoryDepth())}getRootDirectories(){let{inProjectCoordinator:r}=this._context,n=[];for(let a of this._context.compilerFactory.getOrphanDirectories())for(let s of i(a))n.push(s);return n;function*i(a){if(r.isDirectoryInProject(a)){yield a;return}for(let s of a._getDirectoriesIterator())yield*i(s)}}addSourceFilesAtPaths(r){return this._context.directoryCoordinator.addSourceFilesAtPaths(r,{markInProject:!0})}addSourceFileAtPathIfExists(r){return this._context.directoryCoordinator.addSourceFileAtPathIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),{markInProject:!0})}addSourceFileAtPath(r){return this._context.directoryCoordinator.addSourceFileAtPath(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),{markInProject:!0})}addSourceFilesFromTsConfig(r){let n=new b.TsConfigResolver(this._context.fileSystemWrapper,this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),this._context.getEncoding());return this._addSourceFilesForTsConfigResolver(n,n.getCompilerOptions())}_addSourceFilesForTsConfigResolver(r,n){let i=r.getPaths(n),a=i.filePaths.map(s=>this.addSourceFileAtPath(s));for(let s of i.directoryPaths)this.addDirectoryAtPathIfExists(s);return a}createSourceFile(r,n,i){return this._context.compilerFactory.createSourceFile(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),n??"",{...i??{},markInProject:!0})}removeSourceFile(r){let n=r.wasForgotten();return r.forget(),!n}getSourceFileOrThrow(r){let n=this.getSourceFile(r);if(n!=null)return n;if(typeof r=="string"){let i=b.FileUtils.standardizeSlashes(r);if(b.FileUtils.pathIsAbsolute(i)||i.indexOf("/")>=0){let a=this._context.fileSystemWrapper.getStandardizedAbsolutePath(i);throw new b.errors.InvalidOperationError(`Could not find source file in project at the provided path: ${a}`)}else throw new b.errors.InvalidOperationError(`Could not find source file in project with the provided file name: ${r}`)}else throw new b.errors.InvalidOperationError("Could not find source file in project based on the provided condition.")}getSourceFile(r){let n=i(this._context.fileSystemWrapper);if(a(n))return this._context.compilerFactory.getSourceFileFromCacheFromFilePath(n);return b.IterableUtils.find(this._getProjectSourceFilesByDirectoryDepth(),n);function i(s){if(r instanceof Function)return r;let u=b.FileUtils.standardizeSlashes(r);return b.FileUtils.pathIsAbsolute(u)||u.indexOf("/")>=0?s.getStandardizedAbsolutePath(u):p=>b.FileUtils.pathEndsWith(p.getFilePath(),u)}function a(s){return typeof s=="string"}}getSourceFiles(r){let{compilerFactory:n,fileSystemWrapper:i}=this._context,a=this._getProjectSourceFilesByDirectoryDepth();if(typeof r=="string"||r instanceof Array)return Array.from(s());return Array.from(a);function*s(){let u=Array.from(f()),p=b.matchGlobs(u,r,i.getCurrentDirectory());for(let m of p)yield n.getSourceFileFromCacheFromFilePath(i.getStandardizedAbsolutePath(m));function*f(){for(let m of a)yield m.getFilePath()}}}*_getProjectSourceFilesByDirectoryDepth(){let{compilerFactory:r,inProjectCoordinator:n}=this._context;for(let i of r.getSourceFilesByDirectoryDepth())n.isSourceFileInProject(i)&&(yield i)}*_getProjectDirectoriesByDirectoryDepth(){let{compilerFactory:r,inProjectCoordinator:n}=this._context;for(let i of r.getDirectoriesByDepth())n.isDirectoryInProject(i)&&(yield i)}getAmbientModule(r){return r=_pe(r),this.getAmbientModules().find(n=>n.getName()===r)}getAmbientModuleOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getAmbientModule(r),()=>`Could not find ambient module with name: ${_pe(r)}`)}getAmbientModules(){return this.getTypeChecker().getAmbientModules()}async save(){await this._context.fileSystemWrapper.flush(),await Promise.all(this._getUnsavedSourceFiles().map(r=>r.save()))}saveSync(){this._context.fileSystemWrapper.flushSync();for(let r of this._getUnsavedSourceFiles())r.saveSync()}enableLogging(r=!0){this._context.logger.setEnabled(r)}_getUnsavedSourceFiles(){return Array.from(r(this._context.compilerFactory.getSourceFilesByDirectoryDepth()));function*r(n){for(let i of n)i.isSaved()||(yield i)}}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(r={}){return this._context.program.emit(r)}emitSync(r={}){return this._context.program.emitSync(r)}emitToMemory(r={}){return this._context.program.emitToMemory(r)}getCompilerOptions(){return this._context.compilerOptions.get()}getConfigFileParsingDiagnostics(){return this.getProgram().getConfigFileParsingDiagnostics()}createWriter(){return this._context.createWriter()}forgetNodesCreatedInBlock(r){return this._context.compilerFactory.forgetNodesCreatedInBlock(r)}formatDiagnosticsWithColorAndContext(r,n={}){return b.ts.formatDiagnosticsWithColorAndContext(r.map(i=>i.compilerObject),{getCurrentDirectory:()=>this._context.fileSystemWrapper.getCurrentDirectory(),getCanonicalFileName:i=>i,getNewLine:()=>{var i;return(i=n.newLineChar)!==null&&i!==void 0?i:b.runtime.getEndOfLine()}})}getModuleResolutionHost(){return this._context.getModuleResolutionHost()}};function _pe(e){return r(e[0])&&r(e[e.length-1])&&(e=e.substring(1,e.length-1)),`"${e}"`;function r(n){return n==='"'||n==="'"}}function eKe(e,r={}){let{compilerOptions:n={},sourceFile:i,typeChecker:a}=r,s=new b.CompilerOptionsContainer;s.set(n);let u=new jD({project:void 0,fileSystemWrapper:new b.TransactionalFileSystem({fileSystem:new b.RealFileSystemHost,skipLoadingLibFiles:!0,libFolderPath:void 0}),compilerOptionsContainer:s,createLanguageService:!1,typeChecker:a,configFileParsingDiagnostics:[],skipLoadingLibFiles:!0,libFolderPath:void 0}),p=u.compilerFactory.getSourceFile(f(),{markInProject:!0});return u.compilerFactory.getNodeFromCompilerNode(e,p);function f(){return i??m(e)}function m(g){if(g.kind===b.SyntaxKind.SourceFile)return g;if(g.parent==null)throw new b.errors.InvalidOperationError("Please ensure the node was created from a source file with 'setParentNodes' set to 'true'.");let D=g;for(;D.parent!=null;)D=D.parent;if(D.kind!==b.SyntaxKind.SourceFile)throw new b.errors.NotImplementedError("For some reason the top parent was not a source file.");return D}}var rKe=new Vo(()=>{throw new b.errors.NotImplementedError("Not implemented scenario for getting code format settings when using a writer function. Please open an issue.")}),XH=class{constructor(){}static object(r){return n=>{let i=Object.keys(r);n.write("{"),i.length>0&&n.indent(()=>{a()}),n.write("}");function a(){for(let s=0;s<i.length;s++){s>0&&n.write(",").newLine();let u=i[s],p=r[u];n.write(u),p!=null&&(n.write(": "),nL(n,p))}n.newLine()}}}static objectType(r){return n=>{n.write("{"),tKe(r)&&n.indent(()=>{rKe.forTypeElementMemberedNode().printText(n,r)}),n.write("}")}}static unionType(r,n,...i){return gpe("|",[r,n,...i])}static intersectionType(r,n,...i){return gpe("&",[r,n,...i])}static assertion(r,n){return i=>{nL(i,r),i.spaceIfLastNot().write("as "),nL(i,n)}}static returnStatement(r){return n=>{n.write("return "),n.hangingIndentUnlessBlock(()=>{nL(n,r),n.write(";")})}}};function gpe(e,r){return n=>{nKe(n,` ${e} `,r)}}function tKe(e){for(let r of Object.keys(e))if(e[r]!=null&&!(e[r]instanceof Array&&e[r].length===0))return!0;return!1}function nKe(e,r,n){for(let i=0;i<n.length;i++)e.conditionalWrite(i>0,r),nL(e,n[i])}function nL(e,r){r instanceof Function?r(e):e.write(r.toString())}var{InvalidOperationError:iKe,FileNotFoundError:aKe,ArgumentError:oKe,ArgumentNullOrWhitespaceError:sKe,ArgumentOutOfRangeError:lKe,ArgumentTypeError:uKe,BaseError:cKe,DirectoryNotFoundError:dKe,NotImplementedError:fKe,NotSupportedError:pKe,PathNotFoundError:mKe}=b.errors;Object.defineProperty(Oe,"CompilerOptionsContainer",{enumerable:!0,get:function(){return b.CompilerOptionsContainer}});Object.defineProperty(Oe,"DiagnosticCategory",{enumerable:!0,get:function(){return b.DiagnosticCategory}});Object.defineProperty(Oe,"EmitHint",{enumerable:!0,get:function(){return b.EmitHint}});Object.defineProperty(Oe,"InMemoryFileSystemHost",{enumerable:!0,get:function(){return b.InMemoryFileSystemHost}});Object.defineProperty(Oe,"LanguageVariant",{enumerable:!0,get:function(){return b.LanguageVariant}});Object.defineProperty(Oe,"ModuleKind",{enumerable:!0,get:function(){return b.ModuleKind}});Object.defineProperty(Oe,"ModuleResolutionKind",{enumerable:!0,get:function(){return b.ModuleResolutionKind}});Object.defineProperty(Oe,"NewLineKind",{enumerable:!0,get:function(){return b.NewLineKind}});Object.defineProperty(Oe,"NodeFlags",{enumerable:!0,get:function(){return b.NodeFlags}});Object.defineProperty(Oe,"ObjectFlags",{enumerable:!0,get:function(){return b.ObjectFlags}});Object.defineProperty(Oe,"ResolutionHosts",{enumerable:!0,get:function(){return b.ResolutionHosts}});Object.defineProperty(Oe,"ScriptKind",{enumerable:!0,get:function(){return b.ScriptKind}});Object.defineProperty(Oe,"ScriptTarget",{enumerable:!0,get:function(){return b.ScriptTarget}});Object.defineProperty(Oe,"SettingsContainer",{enumerable:!0,get:function(){return b.SettingsContainer}});Object.defineProperty(Oe,"SymbolFlags",{enumerable:!0,get:function(){return b.SymbolFlags}});Object.defineProperty(Oe,"SyntaxKind",{enumerable:!0,get:function(){return b.SyntaxKind}});Object.defineProperty(Oe,"TypeFlags",{enumerable:!0,get:function(){return b.TypeFlags}});Object.defineProperty(Oe,"TypeFormatFlags",{enumerable:!0,get:function(){return b.TypeFormatFlags}});Object.defineProperty(Oe,"ts",{enumerable:!0,get:function(){return b.ts}});Object.defineProperty(Oe,"CodeBlockWriter",{enumerable:!0,get:function(){return YR.default}});Oe.AbstractableNode=yS;Oe.AmbientableNode=Ih;Oe.ArgumentError=oKe;Oe.ArgumentNullOrWhitespaceError=sKe;Oe.ArgumentOutOfRangeError=lKe;Oe.ArgumentTypeError=uKe;Oe.ArgumentedNode=tq;Oe.ArrayBindingPattern=cM;Oe.ArrayDestructuringAssignment=FH;Oe.ArrayDestructuringAssignmentBase=Qpe;Oe.ArrayLiteralExpression=mM;Oe.ArrayTypeNode=Vw;Oe.ArrowFunction=Nw;Oe.ArrowFunctionBase=o_e;Oe.AsExpression=_M;Oe.AsExpressionBase=Zpe;Oe.AssertClause=cw;Oe.AssertClauseBase=zme;Oe.AssertEntry=dw;Oe.AssertEntryBase=yR;Oe.AssertionKeyNamedNode=Hpe;Oe.AssignmentExpression=sL;Oe.AssignmentExpressionBase=Ype;Oe.AsyncableNode=HT;Oe.AwaitExpression=gM;Oe.AwaitExpressionBase=eme;Oe.AwaitableNode=wpe;Oe.BaseError=cKe;Oe.BaseExpressionedNode=$D;Oe.BigIntLiteral=E6;Oe.BigIntLiteralBase=F_e;Oe.BinaryExpression=oL;Oe.BinaryExpressionBase=Xpe;Oe.BindingElement=dM;Oe.BindingElementBase=$pe;Oe.BindingNamedNode=aG;Oe.Block=WM;Oe.BlockBase=Nme;Oe.BodiedNode=rG;Oe.BodyableNode=qT;Oe.BreakStatement=VM;Oe.CallExpression=yM;Oe.CallExpressionBase=rme;Oe.CallSignatureDeclaration=t6;Oe.CallSignatureDeclarationBase=UR;Oe.CaseBlock=jM;Oe.CaseBlockBase=Ime;Oe.CaseClause=HM;Oe.CaseClauseBase=Pme;Oe.CatchClause=qM;Oe.CatchClauseBase=Ome;Oe.ChildOrderableNode=Im;Oe.ClassDeclaration=kw;Oe.ClassDeclarationBase=AR;Oe.ClassElement=Xg;Oe.ClassExpression=Rw;Oe.ClassExpressionBase=f_e;Oe.ClassLikeDeclarationBase=pq;Oe.ClassLikeDeclarationBaseSpecific=c_e;Oe.ClassStaticBlockDeclaration=Mw;Oe.ClassStaticBlockDeclarationBase=LR;Oe.CodeAction=W6;Oe.CodeFixAction=V6;Oe.CombinedCodeActions=fL;Oe.CommaListExpression=vM;Oe.CommaListExpressionBase=tme;Oe.CommentClassElement=ww;Oe.CommentEnumMember=QF;Oe.CommentObjectLiteralElement=DM;Oe.CommentRange=oM;Oe.CommentStatement=JM;Oe.CommentTypeElement=n6;Oe.CommonIdentifierBase=yq;Oe.CompilerCommentClassElement=eM;Oe.CompilerCommentEnumMember=nM;Oe.CompilerCommentNode=lS;Oe.CompilerCommentObjectLiteralElement=tM;Oe.CompilerCommentStatement=ZR;Oe.CompilerCommentTypeElement=rM;Oe.ComputedPropertyName=R6;Oe.ComputedPropertyNameBase=Y_e;Oe.ConditionalExpression=hM;Oe.ConditionalExpressionBase=nme;Oe.ConditionalTypeNode=jw;Oe.ConstructSignatureDeclaration=i6;Oe.ConstructSignatureDeclarationBase=KR;Oe.ConstructorDeclaration=Fw;Oe.ConstructorDeclarationBase=NR;Oe.ConstructorDeclarationOverloadBase=p_e;Oe.ConstructorTypeNode=Hw;Oe.ConstructorTypeNodeBase=y_e;Oe.ContinueStatement=zM;Oe.DebuggerStatement=$M;Oe.DebuggerStatementBase=kme;Oe.DecoratableNode=JT;Oe.Decorator=Kw;Oe.DecoratorBase=kR;Oe.DefaultClause=XM;Oe.DefaultClauseBase=Rme;Oe.DefinitionInfo=VD;Oe.DeleteExpression=EM;Oe.DeleteExpressionBase=ime;Oe.Diagnostic=VT;Oe.DiagnosticMessageChain=mS;Oe.DiagnosticWithLocation=pL;Oe.Directory=OE;Oe.DirectoryEmitResult=bL;Oe.DirectoryNotFoundError=dKe;Oe.DoStatement=YM;Oe.DoStatementBase=Mme;Oe.DocumentSpan=pv;Oe.DotDotDotTokenableNode=SL;Oe.ElementAccessExpression=lL;Oe.ElementAccessExpressionBase=ame;Oe.EmitOutput=mL;Oe.EmitResult=jT;Oe.EmptyStatement=QM;Oe.EmptyStatementBase=wme;Oe.EnumDeclaration=ZF;Oe.EnumDeclarationBase=GR;Oe.EnumMember=e6;Oe.EnumMemberBase=BR;Oe.ExclamationTokenableNode=iq;Oe.ExportAssignment=fw;Oe.ExportAssignmentBase=KH;Oe.ExportDeclaration=pw;Oe.ExportDeclarationBase=vR;Oe.ExportGetableNode=aq;Oe.ExportSpecifier=mw;Oe.ExportSpecifierBase=WH;Oe.ExportableNode=BE;Oe.Expression=oc;Oe.ExpressionStatement=ZM;Oe.ExpressionStatementBase=Fme;Oe.ExpressionWithTypeArguments=qw;Oe.ExpressionWithTypeArgumentsBase=v_e;Oe.ExpressionableNode=CL;Oe.ExpressionedNode=ud;Oe.ExtendsClauseableNode=Vpe;Oe.ExternalModuleReference=_w;Oe.ExternalModuleReferenceBase=$me;Oe.FalseLiteral=S6;Oe.FalseLiteralBase=B_e;Oe.FileNotFoundError=aKe;Oe.FileReference=GD;Oe.FileTextChanges=pS;Oe.ForInStatement=ew;Oe.ForInStatementBase=Gme;Oe.ForOfStatement=rw;Oe.ForOfStatementBase=Bme;Oe.ForStatement=tw;Oe.ForStatementBase=Ume;Oe.FunctionDeclaration=Iw;Oe.FunctionDeclarationBase=xR;Oe.FunctionDeclarationOverloadBase=s_e;Oe.FunctionExpression=Pw;Oe.FunctionExpressionBase=l_e;Oe.FunctionLikeDeclaration=QT;Oe.FunctionOrConstructorTypeNodeBase=cL;Oe.FunctionOrConstructorTypeNodeBaseBase=g_e;Oe.FunctionTypeNode=Jw;Oe.FunctionTypeNodeBase=h_e;Oe.GeneratorableNode=$T;Oe.GetAccessorDeclaration=Gw;Oe.GetAccessorDeclarationBase=IR;Oe.HeritageClause=r6;Oe.HeritageClauseableNode=sq;Oe.Identifier=M6;Oe.IdentifierBase=Q_e;Oe.IfStatement=nw;Oe.IfStatementBase=Kme;Oe.ImplementationLocation=_L;Oe.ImplementsClauseableNode=jpe;Oe.ImportClause=gw;Oe.ImportClauseBase=Xme;Oe.ImportDeclaration=yw;Oe.ImportDeclarationBase=hR;Oe.ImportEqualsDeclaration=vw;Oe.ImportEqualsDeclarationBase=Qme;Oe.ImportExpression=bM;Oe.ImportExpressionBase=ome;Oe.ImportExpressionedNode=sUe;Oe.ImportSpecifier=hw;Oe.ImportSpecifierBase=ER;Oe.ImportTypeAssertionContainer=zw;Oe.ImportTypeNode=$w;Oe.IndexSignatureDeclaration=a6;Oe.IndexSignatureDeclarationBase=WR;Oe.IndexedAccessTypeNode=Xw;Oe.InferTypeNode=Yw;Oe.InitializerExpressionGetableNode=iG;Oe.InitializerExpressionableNode=XT;Oe.InterfaceDeclaration=o6;Oe.InterfaceDeclarationBase=VR;Oe.IntersectionTypeNode=Qw;Oe.InvalidOperationError=iKe;Oe.IterationStatement=fS;Oe.JSDoc=Ww;Oe.JSDocAllType=mF;Oe.JSDocAugmentsTag=_F;Oe.JSDocAuthorTag=gF;Oe.JSDocBase=RR;Oe.JSDocCallbackTag=yF;Oe.JSDocClassTag=vF;Oe.JSDocDeprecatedTag=hF;Oe.JSDocEnumTag=EF;Oe.JSDocFunctionType=bF;Oe.JSDocFunctionTypeBase=C_e;Oe.JSDocImplementsTag=SF;Oe.JSDocLink=TF;Oe.JSDocLinkCode=xF;Oe.JSDocLinkPlain=DF;Oe.JSDocMemberName=CF;Oe.JSDocNameReference=LF;Oe.JSDocNamepathType=AF;Oe.JSDocNonNullableType=NF;Oe.JSDocNullableType=IF;Oe.JSDocOptionalType=PF;Oe.JSDocOverrideTag=OF;Oe.JSDocParameterTag=kF;Oe.JSDocParameterTagBase=A_e;Oe.JSDocPrivateTag=RF;Oe.JSDocPropertyLikeTag=mq;Oe.JSDocPropertyTag=MF;Oe.JSDocPropertyTagBase=L_e;Oe.JSDocProtectedTag=wF;Oe.JSDocPublicTag=FF;Oe.JSDocReadonlyTag=GF;Oe.JSDocReturnTag=BF;Oe.JSDocReturnTagBase=N_e;Oe.JSDocSeeTag=UF;Oe.JSDocSeeTagBase=I_e;Oe.JSDocSignature=KF;Oe.JSDocTag=bc;Oe.JSDocTagBase=FR;Oe.JSDocTagInfo=dL;Oe.JSDocTemplateTag=WF;Oe.JSDocTemplateTagBase=P_e;Oe.JSDocText=VF;Oe.JSDocThisTag=jF;Oe.JSDocThisTagBase=O_e;Oe.JSDocType=J_;Oe.JSDocTypeExpression=qF;Oe.JSDocTypeExpressionableTag=fG;Oe.JSDocTypeLiteral=JF;Oe.JSDocTypeParameteredTag=m_e;Oe.JSDocTypeTag=zF;Oe.JSDocTypedefTag=HF;Oe.JSDocUnknownTag=$F;Oe.JSDocUnknownType=XF;Oe.JSDocVariadicType=YF;Oe.JSDocableNode=sc;Oe.JsxAttribute=u6;Oe.JsxAttributeBase=qR;Oe.JsxAttributedNode=_q;Oe.JsxClosingElement=c6;Oe.JsxClosingElementBase=k_e;Oe.JsxClosingFragment=d6;Oe.JsxElement=f6;Oe.JsxElementBase=JR;Oe.JsxExpression=p6;Oe.JsxExpressionBase=R_e;Oe.JsxFragment=m6;Oe.JsxOpeningElement=_6;Oe.JsxOpeningElementBase=M_e;Oe.JsxOpeningFragment=g6;Oe.JsxSelfClosingElement=y6;Oe.JsxSelfClosingElementBase=zR;Oe.JsxSpreadAttribute=v6;Oe.JsxSpreadAttributeBase=$R;Oe.JsxTagNamedNode=pG;Oe.JsxText=h6;Oe.JsxTextBase=w_e;Oe.LabeledStatement=iw;Oe.LabeledStatementBase=Wme;Oe.LanguageService=Y6;Oe.LeftHandSideExpression=UD;Oe.LeftHandSideExpressionedNode=YT;Oe.LiteralExpression=dS;Oe.LiteralExpressionBase=sme;Oe.LiteralLikeNode=qD;Oe.LiteralTypeNode=Zw;Oe.ManipulationError=aM;Oe.ManipulationSettingsContainer=QR;Oe.MappedTypeNode=eF;Oe.MemberExpression=UT;Oe.MemoryEmitResult=H6;Oe.MetaProperty=SM;Oe.MetaPropertyBase=lme;Oe.MethodDeclaration=KD;Oe.MethodDeclarationBase=CR;Oe.MethodDeclarationOverloadBase=u_e;Oe.MethodSignature=s6;Oe.MethodSignatureBase=jR;Oe.ModifierableNode=sf;Oe.ModuleBlock=Ew;Oe.ModuleBlockBase=Zme;Oe.ModuleChildableNode=vS;Oe.ModuleDeclaration=bw;Oe.ModuleDeclarationBase=bR;Oe.ModuleNamedNode=qpe;Oe.ModuledNode=lq;Oe.NameableNode=oG;Oe.NamedExports=Sw;Oe.NamedExportsBase=e_e;Oe.NamedImports=Tw;Oe.NamedImportsBase=r_e;Oe.NamedNode=gv;Oe.NamedNodeBase=JD;Oe.NamedTupleMember=rF;Oe.NamedTupleMemberBase=E_e;Oe.NamespaceExport=xw;Oe.NamespaceExportBase=t_e;Oe.NamespaceImport=Dw;Oe.NamespaceImportBase=n_e;Oe.NewExpression=TM;Oe.NewExpressionBase=ume;Oe.NoSubstitutionTemplateLiteral=A6;Oe.NoSubstitutionTemplateLiteralBase=H_e;Oe.Node=Tr;Oe.NodeWithTypeArguments=WT;Oe.NodeWithTypeArgumentsBase=__e;Oe.NonNullExpression=xM;Oe.NonNullExpressionBase=cme;Oe.NotEmittedStatement=aw;Oe.NotEmittedStatementBase=Vme;Oe.NotImplementedError=fKe;Oe.NotSupportedError=pKe;Oe.NullLiteral=T6;Oe.NullLiteralBase=K_e;Oe.NumericLiteral=x6;Oe.NumericLiteralBase=W_e;Oe.ObjectBindingPattern=fM;Oe.ObjectDestructuringAssignment=GH;Oe.ObjectDestructuringAssignmentBase=dme;Oe.ObjectLiteralElement=KT;Oe.ObjectLiteralExpression=CM;Oe.ObjectLiteralExpressionBase=fme;Oe.OmittedExpression=IM;Oe.OmittedExpressionBase=pme;Oe.OutputFile=j6;Oe.OverloadableNode=cG;Oe.OverrideableNode=xL;Oe.ParameterDeclaration=Ow;Oe.ParameterDeclarationBase=DR;Oe.ParameteredNode=Jpe;Oe.ParenthesizedExpression=PM;Oe.ParenthesizedExpressionBase=mme;Oe.ParenthesizedTypeNode=tF;Oe.PartiallyEmittedExpression=OM;Oe.PartiallyEmittedExpressionBase=_me;Oe.PathNotFoundError=mKe;Oe.PostfixUnaryExpression=kM;Oe.PostfixUnaryExpressionBase=gme;Oe.PrefixUnaryExpression=RM;Oe.PrefixUnaryExpressionBase=yme;Oe.PrimaryExpression=sd;Oe.PrivateIdentifier=w6;Oe.PrivateIdentifierBase=Z_e;Oe.Program=X6;Oe.Project=$H;Oe.PropertyAccessExpression=uL;Oe.PropertyAccessExpressionBase=vme;Oe.PropertyAssignment=AM;Oe.PropertyAssignmentBase=mR;Oe.PropertyDeclaration=Bw;Oe.PropertyDeclarationBase=PR;Oe.PropertyNamedNode=UE;Oe.PropertySignature=l6;Oe.PropertySignatureBase=HR;Oe.QualifiedName=F6;Oe.QuestionDotTokenableNode=sG;Oe.QuestionTokenableNode=kh;Oe.ReadonlyableNode=DL;Oe.RefactorEditInfo=gL;Oe.ReferenceEntry=q6;Oe.ReferenceFindableNode=Oh;Oe.ReferencedSymbol=yL;Oe.ReferencedSymbolDefinitionInfo=vL;Oe.ReferencedSymbolEntry=J6;Oe.RegularExpressionLiteral=D6;Oe.RegularExpressionLiteralBase=V_e;Oe.RenameLocation=z6;Oe.RenameableNode=_v;Oe.ReturnStatement=ow;Oe.ReturnStatementBase=jme;Oe.ReturnTypedNode=uq;Oe.ScopeableNode=zpe;Oe.ScopedNode=gS;Oe.SetAccessorDeclaration=Uw;Oe.SetAccessorDeclarationBase=OR;Oe.ShorthandPropertyAssignment=LM;Oe.ShorthandPropertyAssignmentBase=_R;Oe.Signature=U6;Oe.SignaturedDeclaration=yv;Oe.SourceFile=kE;Oe.SourceFileBase=SR;Oe.SpreadAssignment=NM;Oe.SpreadAssignmentBase=gR;Oe.SpreadElement=MM;Oe.SpreadElementBase=hme;Oe.Statement=Cl;Oe.StatementBase=Lme;Oe.StatementedNode=Rh;Oe.StaticableNode=zD;Oe.StringLiteral=C6;Oe.StringLiteralBase=j_e;Oe.Structure=tL;Oe.SuperElementAccessExpression=BH;Oe.SuperElementAccessExpressionBase=Eme;Oe.SuperExpression=wM;Oe.SuperExpressionBase=bme;Oe.SuperExpressionedNode=fq;Oe.SuperPropertyAccessExpression=UH;Oe.SuperPropertyAccessExpressionBase=Sme;Oe.SwitchStatement=sw;Oe.SwitchStatementBase=Hme;Oe.Symbol=K6;Oe.SymbolDisplayPart=$6;Oe.SyntaxList=sM;Oe.TaggedTemplateExpression=L6;Oe.TemplateExpression=N6;Oe.TemplateExpressionBase=q_e;Oe.TemplateHead=I6;Oe.TemplateHeadBase=J_e;Oe.TemplateLiteralTypeNode=nF;Oe.TemplateMiddle=P6;Oe.TemplateMiddleBase=z_e;Oe.TemplateSpan=O6;Oe.TemplateSpanBase=$_e;Oe.TemplateTail=k6;Oe.TemplateTailBase=X_e;Oe.TextChange=FE;Oe.TextInsertableNode=ld;Oe.TextRange=iL;Oe.TextSpan=WD;Oe.ThisExpression=FM;Oe.ThisExpressionBase=Tme;Oe.ThisTypeNode=iF;Oe.ThrowStatement=lw;Oe.ThrowStatementBase=qme;Oe.TrueLiteral=b6;Oe.TrueLiteralBase=G_e;Oe.TryStatement=uw;Oe.TryStatementBase=Jme;Oe.TupleTypeNode=aF;Oe.Type=EL;Oe.TypeAliasDeclaration=oF;Oe.TypeAliasDeclarationBase=MR;Oe.TypeArgumentedNode=lG;Oe.TypeAssertion=GM;Oe.TypeAssertionBase=xme;Oe.TypeChecker=hL;Oe.TypeElement=wE;Oe.TypeElementMemberedNode=dq;Oe.TypeLiteralNode=sF;Oe.TypeLiteralNodeBase=b_e;Oe.TypeNode=wc;Oe.TypeOfExpression=BM;Oe.TypeOfExpressionBase=Dme;Oe.TypeOperatorTypeNode=lF;Oe.TypeParameter=Q6;Oe.TypeParameterDeclaration=uF;Oe.TypeParameterDeclarationBase=wR;Oe.TypeParameteredNode=z_;Oe.TypePredicateNode=cF;Oe.TypeQueryNode=dF;Oe.TypeReferenceNode=fF;Oe.TypedNode=KE;Oe.UnaryExpression=fv;Oe.UnaryExpressionedNode=XD;Oe.UnionTypeNode=pF;Oe.UnwrappableNode=uG;Oe.UpdateExpression=pM;Oe.VariableDeclaration=G6;Oe.VariableDeclarationBase=XR;Oe.VariableDeclarationList=B6;Oe.VariableDeclarationListBase=ege;Oe.VariableStatement=Cw;Oe.VariableStatementBase=TR;Oe.VoidExpression=UM;Oe.VoidExpressionBase=Cme;Oe.WhileStatement=Aw;Oe.WhileStatementBase=i_e;Oe.WithStatement=Lw;Oe.WithStatementBase=a_e;Oe.Writers=XH;Oe.YieldExpression=KM;Oe.YieldExpressionBase=Ame;Oe.createWrappedNode=eKe;Oe.forEachStructureChild=b9e;Oe.getCompilerOptionsFromTsConfig=O7e;Oe.getScopeForNode=uM;Oe.insertOverloads=dG;Oe.printNode=gj;Oe.setScopeForNode=cq});var bq=gt((nQe,_Ke)=>{_Ke.exports={name:"zenstack",publisher:"zenstack",displayName:"ZenStack Language Tools",description:"A toolkit for modeling data and access policies in full-stack development with Next.js and Typescript",version:"0.3.2",author:{name:"ZenStack Team"},license:"MIT",keywords:["fullstack","react","typescript","data modeling"],preview:!0,icon:"asset/logo-light-256.png",repository:{type:"git",url:"https://github.com/zenstackhq/zenstack"},engines:{vscode:"^1.56.0"},categories:["Programming Languages"],contributes:{languages:[{id:"zmodel",aliases:["ZenStack Model","zmodel"],extensions:[".zmodel"],configuration:"./language-configuration.json",icon:{light:"./asset/logo-light-256.png",dark:"./asset/logo-dark-256.png"}}],grammars:[{language:"zmodel",scopeName:"source.zmodel",path:"./syntaxes/zmodel.tmLanguage.json"}]},activationEvents:["onLanguage:zmodel"],files:["bin","src","bundle"],bin:{zenstack:"./bin/cli"},main:"./bundle/extension.js",scripts:{"vscode:publish":"vsce publish --no-dependencies","vscode:prepublish":"cp ../../README.md ./ && pnpm lint && pnpm build","vscode:package":"vsce package --no-dependencies",clean:"rimraf bundle",build:"pnpm langium:generate && tsc --noEmit && pnpm bundle && cp -r src/res/* bundle/res/",bundle:"npm run clean && node build/bundle.js --minify","bundle-watch":"node build/bundle.js --watch","ts:watch":"tsc --watch --noEmit","tsc-alias:watch":"tsc-alias --watch",lint:"eslint src --ext ts","langium:generate":"langium generate","langium:watch":"langium generate --watch",watch:'concurrently --kill-others "npm:langium:watch" "npm:bundle-watch"',test:"jest",prepublishOnly:"cp ../../README.md ./ && pnpm build"},dependencies:{"@zenstackhq/internal":"workspace:*","change-case":"^4.1.2",chevrotain:"^9.1.0",colors:"1.4.0",commander:"^8.3.0",langium:"^0.5.0",pluralize:"^8.0.0",prisma:"^4.5.0",promisify:"^0.0.3","ts-morph":"^16.0.0",uuid:"^9.0.0","vscode-jsonrpc":"^8.0.2","vscode-languageclient":"^8.0.2","vscode-languageserver":"^8.0.2","vscode-languageserver-textdocument":"^1.0.7","vscode-uri":"^3.0.6"},devDependencies:{"@prisma/internals":"^4.5.0","@types/jest":"^29.2.0","@types/node":"^14.18.32","@types/pluralize":"^0.0.29","@types/tmp":"^0.2.3","@types/uuid":"^8.3.4","@types/vscode":"^1.56.0","@typescript-eslint/eslint-plugin":"^5.42.0","@typescript-eslint/parser":"^5.42.0",concurrently:"^7.4.0",esbuild:"^0.15.12",eslint:"^8.27.0",jest:"^29.2.1","langium-cli":"^0.5.0",rimraf:"^3.0.2",tmp:"^0.2.1","ts-jest":"^29.0.3","ts-node":"^10.9.1","tsc-alias":"^1.7.0","tsconfig-paths-jest":"^0.0.1",typescript:"^4.8.4",vsce:"^2.13.0"}}});var vKe={};rCe(vKe,{default:()=>yKe,generateAction:()=>mge});module.exports=tCe(vKe);var vG=Ts(mQ());var _oe=Ts(DE()),foe="AbstractDeclaration";var p6e="Expression";var poe="ReferenceTarget";var HO="TypeDeclaration";var Hx="ArrayExpr";function qO(e){return av.isInstance(e,Hx)}var eK="Attribute";var goe="AttributeArg";var xA="BinaryExpr";var JO="DataModel";function Lm(e){return av.isInstance(e,JO)}var rK="DataModelField";function qx(e){return av.isInstance(e,rK)}var zO="DataSource";function yoe(e){return av.isInstance(e,zO)}var $O="Enum";function voe(e){return av.isInstance(e,$O)}var XO="EnumField";function Jx(e){return av.isInstance(e,XO)}var moe="Function";var m6e="FunctionParam";var zx="InvocationExpr";function DA(e){return av.isInstance(e,zx)}var Bb="LiteralExpr";function iv(e){return av.isInstance(e,Bb)}var Ub="MemberAccessExpr";function tK(e){return av.isInstance(e,Ub)}var CA="NullExpr";var Kb="ReferenceExpr";function Wb(e){return av.isInstance(e,Kb)}var $x="ThisExpr";function TT(e){return av.isInstance(e,$x)}var AA="UnaryExpr";var TA=class{getAllTypes(){return["AbstractDeclaration","Argument","ArrayExpr","Attribute","AttributeArg","AttributeParam","AttributeParamType","BinaryExpr","DataModel","DataModelAttribute","DataModelField","DataModelFieldAttribute","DataModelFieldType","DataSource","DataSourceField","Enum","EnumField","Expression","Function","FunctionParam","FunctionParamType","InvocationExpr","LiteralExpr","MemberAccessExpr","Model","NullExpr","ReferenceArg","ReferenceExpr","ReferenceTarget","ThisExpr","TypeDeclaration","UnaryExpr"]}isInstance(r,n){return(0,_oe.isAstNode)(r)&&this.isSubtype(r.$type,n)}isSubtype(r,n){if(r===n)return!0;switch(r){case Hx:case xA:case zx:case Bb:case Ub:case CA:case Kb:case $x:case AA:return this.isSubtype(p6e,n);case eK:case zO:case moe:return this.isSubtype(foe,n);case JO:case $O:return this.isSubtype(foe,n)||this.isSubtype(HO,n);case rK:case XO:case m6e:return this.isSubtype(poe,n);default:return!1}}getReferenceType(r){let n=`${r.container.$type}:${r.property}`;switch(n){case"AttributeParamType:reference":return HO;case"DataModelAttribute:decl":return eK;case"DataModelFieldAttribute:decl":return eK;case"DataModelFieldType:reference":return HO;case"FunctionParamType:reference":return HO;case"InvocationExpr:function":return moe;case"MemberAccessExpr:member":return rK;case"ReferenceExpr:target":return poe;default:throw new Error(`${n} is not a valid reference id.`)}}getTypeMetaData(r){switch(r){case"ArrayExpr":return{name:"ArrayExpr",mandatory:[{name:"items",type:"array"}]};case"Attribute":return{name:"Attribute",mandatory:[{name:"params",type:"array"}]};case"AttributeParam":return{name:"AttributeParam",mandatory:[{name:"default",type:"boolean"}]};case"AttributeParamType":return{name:"AttributeParamType",mandatory:[{name:"array",type:"boolean"},{name:"optional",type:"boolean"}]};case"DataModel":return{name:"DataModel",mandatory:[{name:"attributes",type:"array"},{name:"fields",type:"array"}]};case"DataModelAttribute":return{name:"DataModelAttribute",mandatory:[{name:"args",type:"array"}]};case"DataModelField":return{name:"DataModelField",mandatory:[{name:"attributes",type:"array"}]};case"DataModelFieldAttribute":return{name:"DataModelFieldAttribute",mandatory:[{name:"args",type:"array"}]};case"DataModelFieldType":return{name:"DataModelFieldType",mandatory:[{name:"array",type:"boolean"},{name:"optional",type:"boolean"}]};case"DataSource":return{name:"DataSource",mandatory:[{name:"fields",type:"array"}]};case"Enum":return{name:"Enum",mandatory:[{name:"fields",type:"array"}]};case"Function":return{name:"Function",mandatory:[{name:"params",type:"array"}]};case"FunctionParamType":return{name:"FunctionParamType",mandatory:[{name:"array",type:"boolean"}]};case"InvocationExpr":return{name:"InvocationExpr",mandatory:[{name:"args",type:"array"}]};case"Model":return{name:"Model",mandatory:[{name:"declarations",type:"array"}]};case"ReferenceExpr":return{name:"ReferenceExpr",mandatory:[{name:"args",type:"array"}]};default:return{name:r,mandatory:[]}}}},av=new TA;var hoe=Ts(DE()),YO,Eoe=()=>YO!=null?YO:YO=(0,hoe.loadGrammarFromJson)(`{
4253
4253
  "$type": "Grammar",
4254
4254
  "isDeclared": true,
4255
4255
  "name": "ZModel",