@oddington/cli 0.1.50 → 0.1.51

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.
Files changed (2) hide show
  1. package/dist/os.js +1 -1
  2. package/package.json +2 -2
package/dist/os.js CHANGED
@@ -294,7 +294,7 @@ ${Z}
294
294
  `;else G=String.fromCharCode(Z);return++this.state.curLine,this.state.lineStart=this.state.pos,G}jsxReadString(Q){let Z="",G=++this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(u.UnterminatedString,this.state.startLoc);let Y=this.input.charCodeAt(this.state.pos);if(Y===Q)break;if(Y===38)Z+=this.input.slice(G,this.state.pos),Z+=this.jsxReadEntity(),G=this.state.pos;else if(XJ(Y))Z+=this.input.slice(G,this.state.pos),Z+=this.jsxReadNewLine(!1),G=this.state.pos;else++this.state.pos}Z+=this.input.slice(G,this.state.pos++),this.finishToken(130,Z)}jsxReadEntity(){let Q=++this.state.pos;if(this.codePointAtPos(this.state.pos)===35){++this.state.pos;let Z=10;if(this.codePointAtPos(this.state.pos)===120)Z=16,++this.state.pos;let G=this.readInt(Z,void 0,!1,"bail");if(G!==null&&G<=1114111&&this.codePointAtPos(this.state.pos)===59)return++this.state.pos,String.fromCodePoint(G)}else{let Z=0,G=!1;while(Z++<10&&this.state.pos<this.length&&!(G=this.codePointAtPos(this.state.pos)===59))++this.state.pos;if(G){let Y=this.input.slice(Q,this.state.pos),V=GQ0[Y];if(++this.state.pos,V)return V}}return this.state.pos=Q,"&"}jsxReadWord(){let Q,Z=this.state.pos;do Q=this.input.charCodeAt(++this.state.pos);while(eX(Q)||Q===45);this.finishToken(136,this.input.slice(Z,this.state.pos))}jsxParseIdentifier(){let Q=this.startNode();if(this.match(136))Q.name=this.state.value;else if(fL(this.state.type))Q.name=x4(this.state.type);else this.unexpected();return this.next(),this.finishNode(Q,"JSXIdentifier")}jsxParseNamespacedName(){let Q=this.state.startLoc,Z=this.jsxParseIdentifier();if(!this.eat(10))return Z;let G=this.startNodeAt(Q);return G.namespace=Z,G.name=this.jsxParseIdentifier(),this.finishNode(G,"JSXNamespacedName")}jsxParseElementName(){let Q=this.state.startLoc,Z=this.jsxParseNamespacedName();if(Z.type==="JSXNamespacedName")return Z;while(this.eat(12)){let G=this.startNodeAt(Q);G.object=Z,G.property=this.jsxParseIdentifier(),Z=this.finishNode(G,"JSXMemberExpression")}return Z}jsxParseAttributeValue(){let Q;switch(this.state.type){case 2:if(Q=this.startNode(),this.setContext(l5.brace),this.next(),Q=this.jsxParseExpressionContainer(Q,l5.j_oTag),Q.expression.type==="JSXEmptyExpression")this.raise(S3.AttributeIsEmpty,Q);return Q;case 138:case 130:return this.parseExprAtom();default:throw this.raise(S3.UnsupportedJsxValue,this.state.startLoc)}}jsxParseEmptyExpression(){let Q=this.startNodeAt(this.state.lastTokEndLoc);return this.finishNodeAt(Q,"JSXEmptyExpression",this.state.startLoc)}jsxParseSpreadChild(Q){return this.next(),Q.expression=this.parseExpression(),this.setContext(l5.j_expr),this.state.canStartJSXElement=!0,this.expect(4),this.finishNode(Q,"JSXSpreadChild")}jsxParseExpressionContainer(Q,Z){if(this.match(4))Q.expression=this.jsxParseEmptyExpression();else{let G=this.parseExpression();if(G.type==="SequenceExpression"&&!G.extra?.parenthesized)this.raise(S3.UnexpectedSequenceExpression,G.expressions[1]);Q.expression=G}return this.setContext(Z),this.state.canStartJSXElement=!0,this.expect(4),this.finishNode(Q,"JSXExpressionContainer")}jsxParseAttribute(){if(this.match(2)){let Z=this.startNode();return this.setContext(l5.brace),this.next(),this.expect(17),Z.argument=this.parseMaybeAssignAllowIn(),this.setContext(l5.j_oTag),this.state.canStartJSXElement=!0,this.expect(4),this.finishNode(Z,"JSXSpreadAttribute")}let Q=this.startNode();return Q.name=this.jsxParseNamespacedName(),Q.value=this.eat(25)?this.jsxParseAttributeValue():null,this.finishNode(Q,"JSXAttribute")}jsxParseOpeningElementAt(Q){if(this.eat(139)){let G=this.startNodeAt(Q);return this.finishNode(G,"JSXOpeningFragment")}let Z=this.startNodeAt(Q);return Z.name=this.jsxParseElementName(),this.jsxParseOpeningElementAfterName(Z)}jsxParseOpeningElementAfterName(Q){let Z=[];while(!this.match(52)&&!this.match(139))Z.push(this.jsxParseAttribute());return Q.attributes=Z,Q.selfClosing=this.eat(52),this.expect(139),this.finishNode(Q,"JSXOpeningElement")}jsxParseClosingElementAt(Q){if(this.eat(139)){let G=this.startNodeAt(Q);return this.finishNode(G,"JSXClosingFragment")}let Z=this.startNodeAt(Q);return Z.name=this.jsxParseElementName(),this.expect(139),this.finishNode(Z,"JSXClosingElement")}jsxParseElementAt(Q){let Z=this.startNodeAt(Q),G=[],Y=this.jsxParseOpeningElementAt(Q),V=null;if(!Y.selfClosing){X:for(;;)switch(this.state.type){case 138:if(Q=this.state.startLoc,this.next(),this.eat(52)){this.setLoc(Q),V=this.jsxParseClosingElementAt(Q);break X}G.push(this.jsxParseElementAt(Q));break;case 137:G.push(this.parseLiteral(this.state.value,"JSXText"));break;case 2:{let K=this.startNode();if(this.setContext(l5.brace),this.next(),this.match(17))G.push(this.jsxParseSpreadChild(K));else G.push(this.jsxParseExpressionContainer(K,l5.j_expr));break}default:this.unexpected()}if(D4(Y)&&!D4(V)&&V!==null)this.raise(S3.MissingClosingTagFragment,V);else if(!D4(Y)&&D4(V))this.raise(S3.MissingClosingTagElement,V,{openingTagName:tQ(Y.name)});else if(!D4(Y)&&!D4(V)){if(tQ(V.name)!==tQ(Y.name))this.raise(S3.MissingClosingTagElement,V,{openingTagName:tQ(Y.name)})}}if(D4(Y))Z.openingFragment=Y,Z.closingFragment=V;else Z.openingElement=Y,Z.closingElement=V;if(Z.children=G,this.match(43))throw this.raise(S3.UnwrappedAdjacentJSXElements,this.state.startLoc);return D4(Y)?this.finishNode(Z,"JSXFragment"):this.finishNode(Z,"JSXElement")}jsxParseElement(){let Q=this.state.startLoc;return this.next(),this.jsxParseElementAt(Q)}setContext(Q){let{context:Z}=this.state;Z[Z.length-1]=Q}parseExprAtom(Q){if(this.match(138))return this.jsxParseElement();else if(this.match(43)&&this.input.charCodeAt(this.state.pos)!==33)return this.replaceToken(138),this.jsxParseElement();else return super.parseExprAtom(Q)}skipSpace(){if(!this.curContext().preserveSpace)super.skipSpace()}getTokenFromCode(Q){let Z=this.curContext();if(Z===l5.j_expr){this.jsxReadToken();return}if(Z===l5.j_oTag||Z===l5.j_cTag){if(u9(Q)){this.jsxReadWord();return}if(Q===62){++this.state.pos,this.finishToken(139);return}if((Q===34||Q===39)&&Z===l5.j_oTag){this.jsxReadString(Q);return}}if(Q===60&&this.state.canStartJSXElement&&this.input.charCodeAt(this.state.pos+1)!==33){++this.state.pos,this.finishToken(138);return}super.getTokenFromCode(Q)}updateContext(Q){let{context:Z,type:G}=this.state;if(G===52&&Q===138)Z.splice(-2,2,l5.j_cTag),this.state.canStartJSXElement=!1;else if(G===138)Z.push(l5.j_oTag);else if(G===139){let Y=Z[Z.length-1];if(Y===l5.j_oTag&&Q===52||Y===l5.j_cTag)Z.pop(),this.state.canStartJSXElement=Z[Z.length-1]===l5.j_expr;else this.setContext(l5.j_expr),this.state.canStartJSXElement=!0}else this.state.canStartJSXElement=b10(G)}};class $P extends mW{tsNames=new Map}class RP extends uW{get inTSNamespace(){let X=this.scopeStack;return X.length>=2&&X[X.length-1].flags===0&&(X[X.length-2].flags&2048)>0}importsStack=[];createScope(X){return this.importsStack.push(new Set),new $P(X)}enter(X){if(X&3072)this.importsStack.push(new Set);super.enter(X)}exit(){let X=super.exit();if(X&3072)this.importsStack.pop();return X}hasImport(X,J){let Q=this.importsStack.length;if(this.importsStack[Q-1].has(X))return!0;if(!J&&Q>1){for(let Z=0;Z<Q-1;Z++)if(this.importsStack[Z].has(X))return!0}return!1}declareName(X,J,Q){if(J&4096){if(this.hasImport(X,!0))this.parser.raise(u.VarRedeclaration,Q,{identifierName:X});this.importsStack[this.importsStack.length-1].add(X);return}let Z=this.currentScope(),G=Z.tsNames.get(X)||0;if(J&1024){this.maybeExportDefined(Z,X),Z.tsNames.set(X,G|16);return}if(super.declareName(X,J,Q),J&2){if(!(J&1))this.checkRedeclarationInScope(Z,X,J,Q),this.maybeExportDefined(Z,X);G=G|1}if(J&256)G=G|2;if(J&512)G=G|4;if(J&128)G=G|8;if(G)Z.tsNames.set(X,G)}isRedeclaredInScope(X,J,Q){let Z=X.tsNames.get(J);if((Z&2)>0){if(Q&256){let G=(Q&512)>0,Y=(Z&4)>0;return G!==Y}return!0}if(Q&128&&(Z&8)>0)if(X.names.get(J)&2)return!!(Q&1);else return!1;if(Q&2&&(Z&1)>0)return!0;return super.isRedeclaredInScope(X,J,Q)}checkLocalExport(X){let{name:J}=X;if(this.hasImport(J))return;let Q=this.scopeStack.length;for(let Z=Q-1;Z>=0;Z--){let Y=this.scopeStack[Z].tsNames.get(J);if((Y&1)>0||(Y&16)>0)return}super.checkLocalExport(X)}}class AP{sawUnambiguousESM=!1;ambiguousScriptDifferentAst=!1;sourceToOffsetPos(X){return X+this.startIndex}offsetToSourcePos(X){return X-this.startIndex}hasPlugin(X){if(typeof X==="string")return this.plugins.has(X);else{let[J,Q]=X;if(!this.hasPlugin(J))return!1;let Z=this.plugins.get(J);for(let G of Object.keys(Q))if(Z?.[G]!==Q[G])return!1;return!0}}getPluginOption(X,J){return this.plugins.get(X)?.[J]}}function SP(X,J){if(X.trailingComments===void 0)X.trailingComments=J;else X.trailingComments.unshift(...J)}function WQ0(X,J){if(X.leadingComments===void 0)X.leadingComments=J;else X.leadingComments.unshift(...J)}function EG(X,J){if(X.innerComments===void 0)X.innerComments=J;else X.innerComments.unshift(...J)}function y4(X,J,Q){let Z=null,G=J.length;while(Z===null&&G>0)Z=J[--G];if(Z===null||Z.start>Q.start)EG(X,Q.comments);else SP(Z,Q.comments)}class EP extends AP{addComment(X){if(this.filename)X.loc.filename=this.filename;let{commentsLen:J}=this.state;if(this.comments.length!==J)this.comments.length=J;this.comments.push(X),this.state.commentsLen++}processComment(X){let{commentStack:J}=this.state,Q=J.length;if(Q===0)return;let Z=Q-1,G=J[Z];if(G.start===X.end)G.leadingNode=X,Z--;let Y=X.start;for(;Z>=0;Z--){let V=J[Z],K=V.end;if(K>Y)V.containingNode=X,this.finalizeComment(V),J.splice(Z,1);else{if(K===Y)V.trailingNode=X;break}}}finalizeComment(X){let{comments:J}=X;if(X.leadingNode!==null||X.trailingNode!==null){if(X.leadingNode!==null)SP(X.leadingNode,J);if(X.trailingNode!==null)WQ0(X.trailingNode,J)}else{let{containingNode:Q,start:Z}=X;if(this.input.charCodeAt(this.offsetToSourcePos(Z)-1)===44)switch(Q.type){case"ObjectExpression":case"ObjectPattern":y4(Q,Q.properties,X);break;case"CallExpression":case"NewExpression":case"OptionalCallExpression":y4(Q,Q.arguments,X);break;case"ImportExpression":y4(Q,[Q.source,Q.options??null],X);break;case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"ObjectMethod":case"ClassMethod":case"ClassPrivateMethod":case"TSTypeParameterDeclaration":y4(Q,Q.params,X);break;case"ArrayExpression":case"ArrayPattern":y4(Q,Q.elements,X);break;case"ExportNamedDeclaration":case"ImportDeclaration":y4(Q,Q.specifiers,X);break;case"TSEnumBody":y4(Q,Q.members,X);break;case"TSInterfaceBody":y4(Q,Q.body,X);break;default:EG(Q,J)}else EG(Q,J)}}finalizeRemainingComments(){let{commentStack:X}=this.state;for(let J=X.length-1;J>=0;J--)this.finalizeComment(X[J]);this.state.commentStack=[]}resetPreviousNodeTrailingComments(X){let{commentStack:J}=this.state,{length:Q}=J;if(Q===0)return;let Z=J[Q-1];if(Z.leadingNode===X)Z.leadingNode=null}takeSurroundingComments(X,J,Q){let{commentStack:Z}=this.state,G=Z.length;if(G===0)return;let Y=G-1;for(;Y>=0;Y--){let V=Z[Y],K=V.end;if(V.start===Q)V.leadingNode=X;else if(K===J)V.trailingNode=X;else if(K<J)break}}}class mL{flags=2048;get strict(){return(this.flags&1)>0}set strict(X){if(X)this.flags|=1;else this.flags&=-2}startIndex;curLine;lineStart;startLoc;endLoc;init({strictMode:X,sourceType:J,startIndex:Q,startLine:Z,startColumn:G}){this.strict=X===!1?!1:X===!0?!0:J==="module",this.startIndex=Q,this.curLine=Z,this.lineStart=-G,this.startLoc=this.endLoc=new E8(Z,G,Q)}errors=[];noArrowAt=[];noArrowParamsConversionAt=[];get canStartArrow(){return(this.flags&2)>0}set canStartArrow(X){if(X)this.flags|=2;else this.flags&=-3}get inType(){return(this.flags&4)>0}set inType(X){if(X)this.flags|=4;else this.flags&=-5}get noAnonFunctionType(){return(this.flags&8)>0}set noAnonFunctionType(X){if(X)this.flags|=8;else this.flags&=-9}get hasFlowComment(){return(this.flags&16)>0}set hasFlowComment(X){if(X)this.flags|=16;else this.flags&=-17}get isAmbientContext(){return(this.flags&32)>0}set isAmbientContext(X){if(X)this.flags|=32;else this.flags&=-33}get inAbstractClass(){return(this.flags&64)>0}set inAbstractClass(X){if(X)this.flags|=64;else this.flags&=-65}get inDisallowConditionalTypesContext(){return(this.flags&128)>0}set inDisallowConditionalTypesContext(X){if(X)this.flags|=128;else this.flags&=-129}get inConditionalConsequent(){return(this.flags&256)>0}set inConditionalConsequent(X){if(X)this.flags|=256;else this.flags&=-257}get inHackPipelineBody(){return(this.flags&512)>0}set inHackPipelineBody(X){if(X)this.flags|=512;else this.flags&=-513}get seenTopicReference(){return(this.flags&1024)>0}set seenTopicReference(X){if(X)this.flags|=1024;else this.flags&=-1025}labels=[];commentsLen=0;commentStack=[];pos=0;type=135;value=null;start=0;end=0;lastTokEndLoc=null;lastTokStartLoc=null;context=[l5.brace];get canStartJSXElement(){return(this.flags&2048)>0}set canStartJSXElement(X){if(X)this.flags|=2048;else this.flags&=-2049}get containsEsc(){return(this.flags&4096)>0}set containsEsc(X){if(X)this.flags|=4096;else this.flags&=-4097}firstInvalidTemplateEscapePos=null;get hasTopLevelAwait(){return(this.flags&8192)>0}set hasTopLevelAwait(X){if(X)this.flags|=8192;else this.flags&=-8193}strictErrors=new Map;tokensLength=0;curPosition(){return new E8(this.curLine,this.pos-this.lineStart,this.pos+this.startIndex)}clone(){let X=new mL;return X.flags=this.flags,X.startIndex=this.startIndex,X.curLine=this.curLine,X.lineStart=this.lineStart,X.startLoc=this.startLoc,X.endLoc=this.endLoc,X.errors=this.errors.slice(),X.noArrowAt=this.noArrowAt.slice(),X.noArrowParamsConversionAt=this.noArrowParamsConversionAt.slice(),X.labels=this.labels.slice(),X.commentsLen=this.commentsLen,X.commentStack=this.commentStack.slice(),X.pos=this.pos,X.type=this.type,X.value=this.value,X.start=this.start,X.end=this.end,X.lastTokEndLoc=this.lastTokEndLoc,X.lastTokStartLoc=this.lastTokStartLoc,X.context=this.context.slice(),X.firstInvalidTemplateEscapePos=this.firstInvalidTemplateEscapePos,X.strictErrors=this.strictErrors,X.tokensLength=this.tokensLength,X}}var HQ0=function X(J){return J>=48&&J<=57},ZP={decBinOct:new Set([46,66,69,79,95,98,101,111]),hex:new Set([46,88,95,120])},gW={bin:(X)=>X===48||X===49,oct:(X)=>X>=48&&X<=55,dec:(X)=>X>=48&&X<=57,hex:(X)=>X>=48&&X<=57||X>=65&&X<=70||X>=97&&X<=102};function GP(X,J,Q,Z,G,Y){let V=Q,K=Z,H=G,W="",U=null,z=Q,{length:q}=J;for(;;){if(Q>=q){Y.unterminated(V,K,H),W+=J.slice(z,Q);break}let B=J.charCodeAt(Q);if(UQ0(X,B,J,Q)){W+=J.slice(z,Q);break}if(B===92){W+=J.slice(z,Q);let M=zQ0(J,Q,Z,G,X==="template",Y);if(M.ch===null&&!U)U={pos:Q,lineStart:Z,curLine:G};else W+=M.ch;({pos:Q,lineStart:Z,curLine:G}=M),z=Q}else if(B===8232||B===8233)++Q,++G,Z=Q;else if(B===10||B===13)if(X==="template"){if(W+=J.slice(z,Q)+`
295
295
  `,++Q,B===13&&J.charCodeAt(Q)===10)++Q;++G,z=Z=Q}else Y.unterminated(V,K,H);else++Q}return{pos:Q,str:W,firstInvalidLoc:U,lineStart:Z,curLine:G}}function UQ0(X,J,Q,Z){if(X==="template")return J===96||J===36&&Q.charCodeAt(Z+1)===123;return J===(X==="double"?34:39)}function zQ0(X,J,Q,Z,G,Y){let V=!G;J++;let K=(W)=>({pos:J,ch:W,lineStart:Q,curLine:Z}),H=X.charCodeAt(J++);switch(H){case 110:return K(`
296
296
  `);case 114:return K("\r");case 120:{let W;return{code:W,pos:J}=CL(X,J,Q,Z,2,!1,V,Y),K(W===null?null:String.fromCharCode(W))}case 117:{let W;return{code:W,pos:J}=wP(X,J,Q,Z,V,Y),K(W===null?null:String.fromCodePoint(W))}case 116:return K("\t");case 98:return K("\b");case 118:return K("\v");case 102:return K("\f");case 13:if(X.charCodeAt(J)===10)++J;case 10:Q=J,++Z;case 8232:case 8233:return K("");case 56:case 57:if(G)return K(null);else Y.strictNumericEscape(J-1,Q,Z);default:if(H>=48&&H<=55){let W=J-1,z=/^[0-7]+/.exec(X.slice(W,J+2))[0],q=parseInt(z,8);if(q>255)z=z.slice(0,-1),q=parseInt(z,8);J+=z.length-1;let B=X.charCodeAt(J);if(z!=="0"||B===56||B===57)if(G)return K(null);else Y.strictNumericEscape(W,Q,Z);return K(String.fromCharCode(q))}return K(String.fromCharCode(H))}}function CL(X,J,Q,Z,G,Y,V,K){let H=J,W;if({n:W,pos:J}=CP(X,J,Q,Z,16,G,Y,!1,K,!V),W===null)if(V)K.invalidEscapeSequence(H,Q,Z);else J=H-1;return{code:W,pos:J}}function CP(X,J,Q,Z,G,Y,V,K,H,W){let U=J,z=G===16?ZP.hex:ZP.decBinOct,q=G===16?gW.hex:G===10?gW.dec:G===8?gW.oct:gW.bin,B=!1,M=0;for(let L=0,T=Y==null?1/0:Y;L<T;++L){let O=X.charCodeAt(J),I;if(O===95&&K!=="bail"){let j=X.charCodeAt(J-1),$=X.charCodeAt(J+1);if(!K){if(W)return{n:null,pos:J};H.numericSeparatorInEscapeSequence(J,Q,Z)}else if(Number.isNaN($)||!q($)||z.has(j)||z.has($)){if(W)return{n:null,pos:J};H.unexpectedNumericSeparator(J,Q,Z)}++J;continue}if(O>=97)I=O-97+10;else if(O>=65)I=O-65+10;else if(HQ0(O))I=O-48;else I=1/0;if(I>=G)if(I<=9){if(W)return{n:null,pos:J};H.invalidDigit(J,Q,Z,G),I=0}else if(V)I=0,B=!0;else break;++J,M=M*G+I}if(J===U||Y!=null&&J-U!==Y||B)return{n:null,pos:J};return{n:M,pos:J}}function wP(X,J,Q,Z,G,Y){let V=X.charCodeAt(J),K;if(V===123){if(++J,{code:K,pos:J}=CL(X,J,Q,Z,X.indexOf("}",J)-J,!0,G,Y),++J,K!==null&&K>1114111)if(G)Y.invalidCodePoint(J,Q,Z);else return{code:null,pos:J}}else({code:K,pos:J}=CL(X,J,Q,Z,4,!1,G,Y));return{code:K,pos:J}}function jG(X,J,Q){return new E8(Q,X-J,X)}var qQ0=new Set([103,109,115,105,121,117,100,118]);class kP{constructor(X){let J=X.startIndex||0;this.type=X.type,this.value=X.value,this.start=J+X.start,this.end=J+X.end,this.loc=new SG(X.startLoc,X.endLoc)}}var bW;class FP extends EP{isLookahead;tokens=[];constructor(X,J){super();if(this.state=new mL,this.state.init(X),this.input=J,this.length=J.length,this.comments=[],this.isLookahead=!1,!bW||bW.length<(this.length+1)*2)bW=new Uint32Array((this.length+1)*2);this.locData=bW}setLoc(X){let J=this.offsetToSourcePos(X.index);this.locData[J*2]=X.line,this.locData[J*2+1]=X.column}getLoc(X){let J=this.offsetToSourcePos(X);return new E8(this.locData[J*2],this.locData[J*2+1],X)}pushToken(X){this.tokens.length=this.state.tokensLength,this.tokens.push(X),++this.state.tokensLength}next(){if(this.checkKeywordEscapes(),this.optionFlags&512)this.pushToken(new kP(this.state));this.state.lastTokEndLoc=this.state.endLoc,this.state.lastTokStartLoc=this.state.startLoc,this.nextToken()}eat(X){if(this.match(X))return this.next(),!0;else return!1}match(X){return this.state.type===X}createLookaheadState(X){return{pos:X.pos,value:null,type:X.type,start:X.start,end:X.end,context:[this.curContext()],inType:X.inType,startLoc:X.startLoc,lastTokEndLoc:X.lastTokEndLoc,curLine:X.curLine,lineStart:X.lineStart,curPosition:X.curPosition}}lookahead(){let X=this.state;this.state=this.createLookaheadState(X),this.isLookahead=!0,this.nextToken(),this.isLookahead=!1;let J=this.state;return this.state=X,J}nextTokenStart(){return this.nextTokenStartSince(this.state.pos)}nextTokenStartSince(X){return jL.lastIndex=X,jL.test(this.input)?jL.lastIndex:X}lookaheadCharCode(){return this.lookaheadCharCodeSince(this.state.pos)}lookaheadCharCodeSince(X){return this.input.charCodeAt(this.nextTokenStartSince(X))}nextTokenInLineStart(){return this.nextTokenInLineStartSince(this.state.pos)}nextTokenInLineStartSince(X){return NL.lastIndex=X,NL.test(this.input)?NL.lastIndex:X}lookaheadInLineCharCode(){return this.input.charCodeAt(this.nextTokenInLineStart())}codePointAtPos(X){let J=this.input.charCodeAt(X);if((J&64512)===55296&&++X<this.input.length){let Q=this.input.charCodeAt(X);if((Q&64512)===56320)J=65536+((J&1023)<<10)+(Q&1023)}return J}setStrict(X){if(this.state.strict=X,X)this.state.strictErrors.forEach(([J,Q])=>this.raise(J,Q)),this.state.strictErrors.clear()}curContext(){return this.state.context[this.state.context.length-1]}nextToken(){if(this.skipSpace(),this.state.start=this.state.pos,!this.isLookahead)this.state.startLoc=this.state.curPosition();if(this.state.pos>=this.length){this.finishToken(135);return}this.getTokenFromCode(this.codePointAtPos(this.state.pos))}skipBlockComment(X){let J;if(!this.isLookahead)J=this.state.curPosition();let Q=this.state.pos,Z=this.input.indexOf(X,Q+2);if(Z===-1)throw this.raise(u.UnterminatedComment,this.state.curPosition());this.state.pos=Z+X.length,xW.lastIndex=Q+2;while(xW.test(this.input)&&xW.lastIndex<=Z)++this.state.curLine,this.state.lineStart=xW.lastIndex;if(this.isLookahead)return;let G={type:"CommentBlock",value:this.input.slice(Q+2,Z),start:this.sourceToOffsetPos(Q),end:this.sourceToOffsetPos(Z+X.length),loc:new SG(J,this.state.curPosition())};if(this.optionFlags&512)this.pushToken(G);return G}skipLineComment(X){let J=this.state.pos,Q;if(!this.isLookahead)Q=this.state.curPosition();let Z=this.input.charCodeAt(this.state.pos+=X);if(this.state.pos<this.length)while(!XJ(Z)&&++this.state.pos<this.length)Z=this.input.charCodeAt(this.state.pos);if(this.isLookahead)return;let G=this.state.pos,V={type:"CommentLine",value:this.input.slice(J+X,G),start:this.sourceToOffsetPos(J),end:this.sourceToOffsetPos(G),loc:new SG(Q,this.state.curPosition())};if(this.optionFlags&512)this.pushToken(V);return V}skipSpace(){let X=this.state.pos,J=(this.optionFlags&8192)>0,Q;X:while(this.state.pos<this.length){let Z=this.input.charCodeAt(this.state.pos);switch(Z){case 32:case 160:case 9:++this.state.pos;break;case 13:if(this.input.charCodeAt(this.state.pos+1)===10)++this.state.pos;case 10:case 8232:case 8233:++this.state.pos,++this.state.curLine,this.state.lineStart=this.state.pos;break;case 47:switch(this.input.charCodeAt(this.state.pos+1)){case 42:{let G=this.skipBlockComment("*/");if(G!==void 0){if(this.addComment(G),J)(Q??=[]).push(G)}break}case 47:{let G=this.skipLineComment(2);if(G!==void 0){if(this.addComment(G),J)(Q??=[]).push(G)}break}default:break X}break;default:if(YQ0(Z))++this.state.pos;else if(Z===45&&!this.inModule&&this.optionFlags&16384){let G=this.state.pos;if(this.input.charCodeAt(G+1)===45&&this.input.charCodeAt(G+2)===62&&(X===0||this.state.lineStart>X)){let Y=this.skipLineComment(3);if(Y!==void 0){if(this.addComment(Y),J)(Q??=[]).push(Y)}}else break X}else if(Z===60&&!this.inModule&&this.optionFlags&16384){let G=this.state.pos;if(this.input.charCodeAt(G+1)===33&&this.input.charCodeAt(G+2)===45&&this.input.charCodeAt(G+3)===45){let Y=this.skipLineComment(4);if(Y!==void 0){if(this.addComment(Y),J)(Q??=[]).push(Y)}}else break X}else break X}}if(Q?.length){let Z=this.state.pos,G={start:this.sourceToOffsetPos(X),end:this.sourceToOffsetPos(Z),comments:Q,leadingNode:null,trailingNode:null,containingNode:null};this.state.commentStack.push(G)}}finishToken(X,J){this.state.end=this.state.pos,this.state.endLoc=this.state.curPosition();let Q=this.state.type;if(this.state.type=X,this.state.value=J,!this.isLookahead)this.updateContext(Q)}replaceToken(X){this.state.type=X,this.updateContext()}readToken_numberSign(){if(this.state.pos===0&&this.readToken_interpreter())return;let X=this.state.pos+1,J=this.codePointAtPos(X);if(J>=48&&J<=57)throw this.raise(u.UnexpectedDigitAfterHash,this.state.curPosition());if(u9(J))++this.state.pos,this.finishToken(134,this.readWord1(J));else if(J===92)++this.state.pos,this.finishToken(134,this.readWord1());else this.finishOp(23,1)}readToken_dot(){let X=this.input.charCodeAt(this.state.pos+1);if(X>=48&&X<=57){this.readNumber(!0);return}if(X===46&&this.input.charCodeAt(this.state.pos+2)===46)this.state.pos+=3,this.finishToken(17);else++this.state.pos,this.finishToken(12)}readToken_slash(){if(this.input.charCodeAt(this.state.pos+1)===61)this.finishOp(27,2);else this.finishOp(52,1)}readToken_interpreter(){if(this.state.pos!==0||this.length<2)return!1;let X=this.input.charCodeAt(this.state.pos+1);if(X!==33)return!1;let J=this.state.pos;this.state.pos+=1;while(!XJ(X)&&++this.state.pos<this.length)X=this.input.charCodeAt(this.state.pos);let Q=this.input.slice(J+2,this.state.pos);return this.finishToken(24,Q),!0}readToken_mult_modulo(X){let J=X===42?51:50,Q=1,Z=this.input.charCodeAt(this.state.pos+1);if(X===42&&Z===42)Q++,Z=this.input.charCodeAt(this.state.pos+2),J=53;if(Z===61&&!this.state.inType)Q++,J=X===37?29:26;this.finishOp(J,Q)}readToken_pipe_amp(X){let J=this.input.charCodeAt(this.state.pos+1);if(J===X){if(this.input.charCodeAt(this.state.pos+2)===61)this.finishOp(26,3);else this.finishOp(X===124?37:38,2);return}if(X===124){if(J===62){this.finishOp(35,2);return}}if(J===61){this.finishOp(26,2);return}this.finishOp(X===124?39:41,1)}readToken_caret(){let X=this.input.charCodeAt(this.state.pos+1);if(X===61&&!this.state.inType)this.finishOp(28,2);else if(X===94&&this.hasPlugin(["pipelineOperator",{proposal:"hack",topicToken:"^^"}])){if(this.finishOp(33,2),this.input.codePointAt(this.state.pos)===94)this.unexpected()}else this.finishOp(40,1)}readToken_atSign(){if(this.input.charCodeAt(this.state.pos+1)===64&&this.hasPlugin(["pipelineOperator",{proposal:"hack",topicToken:"@@"}]))this.finishOp(34,2);else this.finishOp(22,1)}readToken_plus_min(X){let J=this.input.charCodeAt(this.state.pos+1);if(J===X){this.finishOp(30,2);return}if(J===61)this.finishOp(26,2);else this.finishOp(49,1)}readToken_lt(){let{pos:X}=this.state,J=this.input.charCodeAt(X+1);if(J===60){if(this.input.charCodeAt(X+2)===61){this.finishOp(26,3);return}this.finishOp(47,2);return}if(J===61){this.finishOp(45,2);return}this.finishOp(43,1)}readToken_gt(){let{pos:X}=this.state,J=this.input.charCodeAt(X+1);if(J===62){let Q=this.input.charCodeAt(X+2)===62?3:2;if(this.input.charCodeAt(X+Q)===61){this.finishOp(26,Q+1);return}this.finishOp(48,Q);return}if(J===61){this.finishOp(45,2);return}this.finishOp(44,1)}readToken_eq_excl(X){let J=this.input.charCodeAt(this.state.pos+1);if(J===61){this.finishOp(42,this.input.charCodeAt(this.state.pos+2)===61?3:2);return}if(X===61&&J===62){this.state.pos+=2,this.finishToken(15);return}this.finishOp(X===61?25:31,1)}readToken_question(){let X=this.input.charCodeAt(this.state.pos+1),J=this.input.charCodeAt(this.state.pos+2);if(X===63)if(J===61)this.finishOp(26,3);else this.finishOp(36,2);else if(X===46&&!(J>=48&&J<=57))this.state.pos+=2,this.finishToken(14);else++this.state.pos,this.finishToken(13)}getTokenFromCode(X){switch(X){case 46:this.readToken_dot();return;case 40:++this.state.pos,this.finishToken(6);return;case 41:++this.state.pos,this.finishToken(7);return;case 59:++this.state.pos,this.finishToken(9);return;case 44:++this.state.pos,this.finishToken(8);return;case 91:++this.state.pos,this.finishToken(0);return;case 93:++this.state.pos,this.finishToken(1);return;case 123:++this.state.pos,this.finishToken(2);return;case 125:++this.state.pos,this.finishToken(4);return;case 58:if(this.hasPlugin("functionBind")&&this.input.charCodeAt(this.state.pos+1)===58)this.finishOp(11,2);else++this.state.pos,this.finishToken(10);return;case 63:this.readToken_question();return;case 96:this.readTemplateToken();return;case 48:{let J=this.input.charCodeAt(this.state.pos+1);if(J===120||J===88){this.readRadixNumber(16);return}if(J===111||J===79){this.readRadixNumber(8);return}if(J===98||J===66){this.readRadixNumber(2);return}}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:this.readNumber(!1);return;case 34:case 39:this.readString(X);return;case 47:this.readToken_slash();return;case 37:case 42:this.readToken_mult_modulo(X);return;case 124:case 38:this.readToken_pipe_amp(X);return;case 94:this.readToken_caret();return;case 43:case 45:this.readToken_plus_min(X);return;case 60:this.readToken_lt();return;case 62:this.readToken_gt();return;case 61:case 33:this.readToken_eq_excl(X);return;case 126:this.finishOp(32,1);return;case 64:this.readToken_atSign();return;case 35:this.readToken_numberSign();return;case 92:this.readWord();return;default:if(u9(X)){this.readWord(X);return}}throw this.raise(u.InvalidOrUnexpectedToken,this.state.curPosition(),{unexpected:String.fromCodePoint(X)})}finishOp(X,J){let Q=this.input.slice(this.state.pos,this.state.pos+J);this.state.pos+=J,this.finishToken(X,Q)}readRegexp(){let X=this.state.startLoc,J=this.state.start+1,Q,Z,{pos:G}=this.state;for(;;++G){if(G>=this.length)throw this.raise(u.UnterminatedRegExp,g7(X,1));let H=this.input.charCodeAt(G);if(XJ(H))throw this.raise(u.UnterminatedRegExp,g7(X,1));if(Q)Q=!1;else{if(H===91)Z=!0;else if(H===93&&Z)Z=!1;else if(H===47&&!Z)break;Q=H===92}}let Y=this.input.slice(J,G);++G;let V="",K=()=>g7(X,G+2-J);while(G<this.length){let H=this.codePointAtPos(G),W=String.fromCharCode(H);if(qQ0.has(H)){if(H===118){if(V.includes("u"))this.raise(u.IncompatibleRegExpUVFlags,K())}else if(H===117){if(V.includes("v"))this.raise(u.IncompatibleRegExpUVFlags,K())}if(V.includes(W))this.raise(u.DuplicateRegExpFlags,K())}else if(eX(H)||H===92)this.raise(u.MalformedRegExpFlags,K());else break;++G,V+=W}this.state.pos=G,this.finishToken(133,{pattern:Y,flags:V})}readInt(X,J,Q=!1,Z=!0){let{n:G,pos:Y}=CP(this.input,this.state.pos,this.state.lineStart,this.state.curLine,X,J,Q,Z,this.errorHandlers_readInt,!1);return this.state.pos=Y,G}readRadixNumber(X){let J=this.state.pos,Q=this.state.curPosition(),Z=!1;this.state.pos+=2;let G=this.readInt(X);if(G==null)this.raise(u.InvalidDigit,g7(Q,2),{radix:X});if(this.input.charCodeAt(this.state.pos)===110)++this.state.pos,Z=!0;if(u9(this.codePointAtPos(this.state.pos)))throw this.raise(u.NumberIdentifier,this.state.curPosition());if(Z){let V=this.input.slice(J,this.state.pos).replace(/[_n]/g,"");this.finishToken(132,V);return}this.finishToken(131,G)}readNumber(X){let J=this.state.pos,Q=this.state.curPosition(),Z=!1,G=!1,Y=!1;if(!X&&this.readInt(10)===null)this.raise(u.InvalidNumber,this.state.curPosition());let V=this.state.pos-J>=2&&this.input.charCodeAt(J)===48;if(V){let U=this.input.slice(J,this.state.pos);if(this.recordStrictModeErrors(u.StrictOctalLiteral,Q),!this.state.strict){let z=U.indexOf("_");if(z>0)this.raise(u.ZeroDigitNumericSeparator,g7(Q,z))}Y=V&&!/[89]/.test(U)}let K=this.input.charCodeAt(this.state.pos);if(K===46&&!Y)++this.state.pos,this.readInt(10),Z=!0,K=this.input.charCodeAt(this.state.pos);if((K===69||K===101)&&!Y){if(K=this.input.charCodeAt(++this.state.pos),K===43||K===45)++this.state.pos;if(this.readInt(10)===null)this.raise(u.InvalidOrMissingExponent,Q);Z=!0,K=this.input.charCodeAt(this.state.pos)}let H=this.input.slice(J,this.state.pos).replaceAll("_","");if(K===110){if(Z||V)this.raise(u.InvalidBigIntLiteral,Q);++this.state.pos,G=!0}if(u9(this.codePointAtPos(this.state.pos)))throw this.raise(u.NumberIdentifier,this.state.curPosition());if(G){this.finishToken(132,H);return}let W=Y?parseInt(H,8):parseFloat(H);this.finishToken(131,W)}readCodePoint(X){let{code:J,pos:Q}=wP(this.input,this.state.pos,this.state.lineStart,this.state.curLine,X,this.errorHandlers_readCodePoint);return this.state.pos=Q,J}readString(X){let{str:J,pos:Q,curLine:Z,lineStart:G}=GP(X===34?"double":"single",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_string);this.state.pos=Q+1,this.state.lineStart=G,this.state.curLine=Z,this.finishToken(130,J)}readTemplateContinuation(){if(!this.match(4))this.unexpected(null,4);this.state.pos--,this.readTemplateToken()}readTemplateToken(){let X=this.input[this.state.pos],{str:J,firstInvalidLoc:Q,pos:Z,curLine:G,lineStart:Y}=GP("template",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_template);if(this.state.pos=Z+1,this.state.lineStart=Y,this.state.curLine=G,Q)this.state.firstInvalidTemplateEscapePos=new E8(Q.curLine,Q.pos-Q.lineStart,this.sourceToOffsetPos(Q.pos));if(this.input.codePointAt(Z)===96)this.finishToken(20,Q?null:X+J+"`");else this.state.pos++,this.finishToken(21,Q?null:X+J+"${")}recordStrictModeErrors(X,J){let Q=J.index;if(this.state.strict&&!this.state.strictErrors.has(Q))this.raise(X,J);else this.state.strictErrors.set(Q,[X,J])}readWord1(X){this.state.containsEsc=!1;let J="",Q=this.state.pos,Z=this.state.pos;if(X!==void 0)this.state.pos+=X<=65535?1:2;while(this.state.pos<this.length){let G=this.codePointAtPos(this.state.pos);if(eX(G))this.state.pos+=G<=65535?1:2;else if(G===92){this.state.containsEsc=!0,J+=this.input.slice(Z,this.state.pos);let Y=this.state.curPosition(),V=this.state.pos===Q?u9:eX;if(this.input.charCodeAt(++this.state.pos)!==117){this.raise(u.MissingUnicodeEscape,this.state.curPosition()),Z=this.state.pos-1;continue}++this.state.pos;let K=this.readCodePoint(!0);if(K!==null){if(!V(K))this.raise(u.EscapedCharNotAnIdentifier,Y);J+=String.fromCodePoint(K)}Z=this.state.pos}else break}return J+this.input.slice(Z,this.state.pos)}readWord(X){let J=this.readWord1(X),Q=DL.get(J);if(Q!==void 0)this.finishToken(Q,x4(Q));else this.finishToken(128,J)}checkKeywordEscapes(){let{type:X}=this.state;if(fL(X)&&this.state.containsEsc)this.raise(u.InvalidEscapedReservedWord,this.state.startLoc,{reservedWord:x4(X)})}raise(X,J,Q={}){let Z=J instanceof E8?J:typeof J==="number"?this.getLoc(J):this.optionFlags&256?J.loc.start:this.getLoc(J.start),G=J instanceof E8?Z.index:typeof J==="number"?J:J.start,Y=X(Z,G,Q);if(!(this.optionFlags&4096))throw Y;if(!this.isLookahead)this.state.errors.push(Y);return Y}raiseOverwrite(X,J,Q={}){let Z=J instanceof E8?J:this.optionFlags&256?J.loc.start:this.getLoc(J.start),G=J instanceof E8?Z.index:J.start,Y=this.state.errors;for(let V=Y.length-1;V>=0;V--){let K=Y[V];if(K.pos===G)return Y[V]=X(Z,G,Q);if(K.pos<G)break}return this.raise(X,Z,Q)}updateContext(X){}unexpected(X,J){throw this.raise(u.UnexpectedToken,X!=null?X:this.state.startLoc,{expected:J?x4(J):null})}expectPlugin(X,J){if(this.hasPlugin(X))return!0;throw this.raise(u.MissingPlugin,J!=null?J:this.state.startLoc,{missingPlugin:[X]})}expectOnePlugin(X){if(!X.some((J)=>this.hasPlugin(J)))throw this.raise(u.MissingOneOfPlugins,this.state.startLoc,{missingPlugin:X})}errorBuilder(X){return(J,Q,Z)=>{this.raise(X,jG(J,Q,Z))}}errorHandlers_readInt={invalidDigit:(X,J,Q,Z)=>{this.raise(u.InvalidDigit,jG(X,J,Q),{radix:Z})},numericSeparatorInEscapeSequence:this.errorBuilder(u.NumericSeparatorInEscapeSequence),unexpectedNumericSeparator:this.errorBuilder(u.UnexpectedNumericSeparator)};errorHandlers_readCodePoint={...this.errorHandlers_readInt,invalidEscapeSequence:this.errorBuilder(u.InvalidEscapeSequence),invalidCodePoint:this.errorBuilder(u.InvalidCodePoint)};errorHandlers_readStringContents_string={...this.errorHandlers_readCodePoint,strictNumericEscape:(X,J,Q)=>{this.recordStrictModeErrors(u.StrictNumericEscape,jG(X,J,Q))},unterminated:(X,J,Q)=>{throw this.raise(u.UnterminatedString,jG(X-1,J,Q))}};errorHandlers_readStringContents_template={...this.errorHandlers_readCodePoint,strictNumericEscape:this.errorBuilder(u.StrictNumericEscape),unterminated:(X,J,Q)=>{throw this.raise(u.UnterminatedTemplate,jG(X,J,Q))}}}class PP{privateNames=new Set;loneAccessors=new Map;undefinedPrivateNames=new Map}class DP{parser;stack=[];constructor(X){this.parser=X}current(){return this.stack[this.stack.length-1]}enter(){this.stack.push(new PP)}exit(){let X=this.stack.pop(),J=this.current();for(let[Q,Z]of Array.from(X.undefinedPrivateNames))if(J){if(!J.undefinedPrivateNames.has(Q))J.undefinedPrivateNames.set(Q,Z)}else this.parser.raise(u.InvalidPrivateFieldResolution,Z,{identifierName:Q})}declarePrivateName(X,J,Q){let{privateNames:Z,loneAccessors:G,undefinedPrivateNames:Y}=this.current(),V=Z.has(X);if(J&3){let K=V&&G.get(X);if(K){let H=K&4,W=J&4,U=K&3,z=J&3;if(V=U===z||H!==W,!V)G.delete(X)}else if(!V)G.set(X,J)}if(V)this.parser.raise(u.PrivateNameRedeclaration,Q,{identifierName:X});Z.add(X),Y.delete(X)}usePrivateName(X,J){let Q;for(Q of this.stack)if(Q.privateNames.has(X))return;if(Q)Q.undefinedPrivateNames.set(X,J);else this.parser.raise(u.InvalidPrivateFieldResolution,J,{identifierName:X})}}class CG{constructor(X=0){this.type=X}canBeArrowParameterDeclaration(){return this.type===2||this.type===1}isCertainlyParameterDeclaration(){return this.type===3}}class uL extends CG{declarationErrors=new Map;constructor(X){super(X)}recordDeclarationError(X,J){this.declarationErrors.set(J,X)}clearDeclarationError(X){this.declarationErrors.delete(X)}iterateErrors(X){this.declarationErrors.forEach(X)}}class yP{parser;stack=[new CG];constructor(X){this.parser=X}enter(X){this.stack.push(X)}exit(){this.stack.pop()}recordParameterInitializerError(X,J){let{stack:Q}=this,Z=Q.length-1,G=Q[Z];while(!G.isCertainlyParameterDeclaration()){if(G.canBeArrowParameterDeclaration())G.recordDeclarationError(X,J);else return;G=Q[--Z]}this.parser.raise(X,J)}recordArrowParameterBindingError(X,J){let{stack:Q}=this,Z=Q[Q.length-1],G=J.start;if(Z.isCertainlyParameterDeclaration())this.parser.raise(X,G);else if(Z.canBeArrowParameterDeclaration())Z.recordDeclarationError(X,G);else return}recordAsyncArrowParametersError(X){let{stack:J}=this,Q=J.length-1,Z=J[Q];while(Z.canBeArrowParameterDeclaration()){if(Z.type===2)Z.recordDeclarationError(u.AwaitBindingIdentifier,X);Z=J[--Q]}}validateAsPattern(){let{stack:X}=this,J=X[X.length-1];if(!J.canBeArrowParameterDeclaration())return;J.iterateErrors((Q,Z)=>{this.parser.raise(Q,Z);let G=X.length-2,Y=X[G];while(Y.canBeArrowParameterDeclaration())Y.clearDeclarationError(Z),Y=X[--G]})}}function MQ0(){return new CG(3)}function BQ0(){return new uL(1)}function LQ0(){return new uL(2)}function wL(){return new CG}class xP{stacks=[];enter(X){this.stacks.push(X)}exit(){this.stacks.pop()}currentFlags(){return this.stacks[this.stacks.length-1]}get hasAwait(){return(this.currentFlags()&2)>0}get hasYield(){return(this.currentFlags()&1)>0}get hasReturn(){return(this.currentFlags()&4)>0}get hasIn(){return(this.currentFlags()&8)>0}get inFSharpPipelineDirectBody(){return(this.currentFlags()&16)===0}}function _W(X,J){return(X?2:0)|(J?1:0)}class gP extends FP{addExtra(X,J,Q,Z=!0){if(!X)return;let{extra:G}=X;if(G==null)G={},X.extra=G;if(Z)G[J]=Q;else Object.defineProperty(G,J,{enumerable:Z,value:Q})}isContextual(X){return this.state.type===X&&!this.state.containsEsc}isUnparsedContextual(X,J){if(this.input.startsWith(J,X)){let Q=this.input.charCodeAt(X+J.length);return!(eX(Q)||(Q&64512)===55296)}return!1}isLookaheadContextual(X){let J=this.nextTokenStart();return this.isUnparsedContextual(J,X)}eatContextual(X){if(this.isContextual(X))return this.next(),!0;return!1}expectContextual(X,J){if(!this.eatContextual(X)){if(J!=null)throw this.raise(J,this.state.startLoc);this.unexpected(null,X)}}canInsertSemicolon(){return this.match(135)||this.match(4)||this.hasPrecedingLineBreak()}hasPrecedingLineBreak(){return JP(this.input,this.offsetToSourcePos(this.state.lastTokEndLoc.index),this.state.start)}hasFollowingLineBreak(){return JP(this.input,this.state.end,this.nextTokenStart())}isLineTerminator(){return this.eat(9)||this.canInsertSemicolon()}semicolon(X=!0){if(X?this.isLineTerminator():this.eat(9))return;this.raise(u.MissingSemicolon,this.state.lastTokEndLoc)}expect(X,J){if(!this.eat(X))this.unexpected(J,X)}tryParse(X,J=this.state.clone()){let Q={node:null};try{let Z=X((G=null)=>{throw Q.node=G,Q});if(this.state.errors.length>J.errors.length){let G=this.state;return this.state=J,this.state.tokensLength=G.tokensLength,{node:Z,error:G.errors[J.errors.length],thrown:!1,aborted:!1,failState:G}}return{node:Z,error:null,thrown:!1,aborted:!1,failState:null}}catch(Z){let G=this.state;if(this.state=J,Z instanceof SyntaxError)return{node:null,error:Z,thrown:!0,aborted:!1,failState:G};if(Z===Q)return{node:Q.node,error:null,thrown:!1,aborted:!0,failState:G};throw Z}}checkExpressionErrors(X,J){if(!X)return!1;let{shorthandAssignLoc:Q,doubleProtoLoc:Z,privateKeyLoc:G,optionalParametersLoc:Y,voidPatternLoc:V}=X,K=!!Q||!!Z||!!Y||!!G||!!V;if(!J)return K;if(Q!=null)this.raise(u.InvalidCoverInitializedName,Q);if(Z!=null)this.raise(u.DuplicateProto,Z);if(G!=null)this.raise(u.UnexpectedPrivateField,G);if(Y!=null)this.unexpected(Y);if(V!=null)this.raise(u.InvalidCoverDiscardElement,V)}isLiteralPropertyName(){return qP(this.state.type)}isPrivateName(X){return X.type==="PrivateName"}getPrivateNameSV(X){return X.id.name}hasPropertyAsPrivateName(X){return(X.type==="MemberExpression"||X.type==="OptionalMemberExpression")&&this.isPrivateName(X.property)}isObjectProperty(X){return X.type==="ObjectProperty"}isObjectMethod(X){return X.type==="ObjectMethod"}initializeScopes(X=this.options.sourceType==="module"){let J=this.state.labels;this.state.labels=[];let Q=this.exportedIdentifiers;this.exportedIdentifiers=new Set;let Z=this.inModule;this.inModule=X;let G=this.scope,Y=this.getScopeHandler();this.scope=new Y(this,X);let V=this.prodParam;this.prodParam=new xP;let K=this.classScope;this.classScope=new DP(this);let H=this.expressionScope;return this.expressionScope=new yP(this),()=>{this.state.labels=J,this.exportedIdentifiers=Q,this.inModule=Z,this.scope=G,this.prodParam=V,this.classScope=K,this.expressionScope=H}}enterInitialScopes(){let X=0;if(this.inModule||this.optionFlags&1)X|=2;if(this.optionFlags&32)X|=1;let J=!this.inModule&&this.options.sourceType==="commonjs";if(J||this.optionFlags&2)X|=4;this.prodParam.enter(X);let Q=J?514:1;if(this.optionFlags&4)Q|=512;if(this.optionFlags&16)Q|=48;this.scope.enter(Q)}checkDestructuringPrivate(X){let{privateKeyLoc:J}=X;if(J!==null)this.expectPlugin("destructuringPrivate",J)}}class AG{shorthandAssignLoc=null;doubleProtoLoc=null;privateKeyLoc=null;optionalParametersLoc=null;voidPatternLoc=null}class eQ{constructor(X,J,Q,Z){if(this.start=Q,this.end=0,Z!==void 0)this.loc=new SG(Z);if(X&128)this.range=[Q,0];if(Z!==void 0&&J)this.loc.filename=J}type=""}var YP=eQ.prototype;class bP extends gP{createPosition(X){return X}startNode(){let{startLoc:X}=this.state;return this.setLoc(X),this.startNodeAt(X)}startNodeAt(X){let{optionFlags:J,filename:Q}=this;if(!(J&256))return new eQ(J,Q,X.index);return new eQ(J,Q,X.index,this.createPosition(X))}startNodeAtNode(X){let{optionFlags:J,filename:Q}=this;if(!(J&256))return new eQ(J,Q,X.start);return new eQ(J,Q,X.start,X.loc.start)}finishNode(X,J){return this.finishNodeAt(X,J,this.state.lastTokEndLoc)}finishNodeAt(X,J,Q){X.type=J,X.end=Q.index;let{optionFlags:Z}=this;if(Z&256)X.loc.end=this.createPosition(Q);if(Z&128)X.range[1]=Q.index;if(Z&8192)this.processComment(X);return X}finishNodeAtNode(X,J,Q){X.type=J,X.end=Q.end;let{optionFlags:Z}=this;if(Z&256)X.loc.end=Q.loc.end;if(Z&128)X.range[1]=X.end;if(Z&8192)this.processComment(X);return X}resetStartLocation(X,J){X.start=J.index;let{optionFlags:Q}=this;if(Q&256)X.loc.start=this.createPosition(J);if(Q&128)X.range[0]=J.index}resetEndLocation(X,J=this.state.lastTokEndLoc){X.end=J.index;let{optionFlags:Q}=this;if(Q&256)X.loc.end=this.createPosition(J);if(Q&128)X.range[1]=J.index}resetStartLocationFromNode(X,J){X.start=J.start;let{optionFlags:Q}=this;if(Q&256)X.loc.start=J.loc.start;if(Q&128)X.range[0]=J.start}resetEndLocationFromNode(X,J){X.end=J.end;let{optionFlags:Q}=this;if(Q&256)X.loc.end=J.loc.end;if(Q&128)X.range[1]=J.end}castNodeTo(X,J){return X.type=J,X}cloneIdentifier(X){let{type:J,start:Q,end:Z,loc:G,range:Y,name:V}=X,K=Object.create(YP);if(K.type=J,K.start=Q,K.end=Z,K.loc=G,K.range=Y,K.name=V,X.extra)K.extra=X.extra;return K}cloneStringLiteral(X){let{type:J,start:Q,end:Z,loc:G,range:Y,extra:V}=X,K=Object.create(YP);return K.type=J,K.start=Q,K.end=Z,K.loc=G,K.range=Y,K.extra=V,K.value=X.value,K}}var kL=(X)=>{return X.type==="ParenthesizedExpression"?kL(X.expression):X};class hP extends bP{toAssignable(X,J=!1){let Q=void 0;if(X.type==="ParenthesizedExpression"||X.extra?.parenthesized)if(Q=kL(X),J){if(Q.type==="Identifier")this.expressionScope.recordArrowParameterBindingError(u.InvalidParenthesizedAssignment,X);else if(Q.type!=="CallExpression"&&Q.type!=="MemberExpression"&&!this.isOptionalMemberExpression(Q))this.raise(u.InvalidParenthesizedAssignment,X)}else this.raise(u.InvalidParenthesizedAssignment,X);switch(X.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":case"VoidPattern":break;case"ObjectExpression":this.castNodeTo(X,"ObjectPattern");for(let Z=0,G=X.properties.length,Y=G-1;Z<G;Z++){let V=X.properties[Z],K=Z===Y;if(this.toAssignableObjectExpressionProp(V,K,J),K&&V.type==="RestElement"&&X.extra?.trailingCommaLoc)this.raise(u.RestTrailingComma,X.extra.trailingCommaLoc)}break;case"ObjectProperty":{let{key:Z,value:G}=X;if(this.isPrivateName(Z))this.classScope.usePrivateName(this.getPrivateNameSV(Z),Z.start);this.toAssignable(G,J);break}case"SpreadElement":throw Error("Internal @babel/parser error (this is a bug, please report it). SpreadElement should be converted by .toAssignable's caller.");case"ArrayExpression":this.castNodeTo(X,"ArrayPattern"),this.toAssignableList(X.elements,X.extra?.trailingCommaLoc,J);break;case"AssignmentExpression":if(X.operator!=="=")this.raise(u.MissingEqInAssignment,this.optionFlags&256?X.left.loc.end:X.left);if(this.castNodeTo(X,"AssignmentPattern"),delete X.operator,X.left.type==="VoidPattern")this.raise(u.VoidPatternInitializer,X.left);this.toAssignable(X.left,J);break;case"ParenthesizedExpression":this.toAssignable(Q,J);break}}toAssignableObjectExpressionProp(X,J,Q){if(X.type==="ObjectMethod")this.raise(X.kind==="get"||X.kind==="set"?u.PatternHasAccessor:u.PatternHasMethod,X.key);else if(X.type==="SpreadElement"){this.castNodeTo(X,"RestElement");let Z=X.argument;if(this.checkToRestConversion(Z,!1),this.toAssignable(Z,Q),!J)this.raise(u.RestTrailingComma,X)}else this.toAssignable(X,Q)}toAssignableList(X,J,Q){let Z=X.length-1;for(let G=0;G<=Z;G++){let Y=X[G];if(!Y)continue;if(this.toAssignableListItem(X,G,Q),Y.type==="RestElement"){if(G<Z)this.raise(u.RestTrailingComma,Y);else if(J)this.raise(u.RestTrailingComma,J)}}}toAssignableListItem(X,J,Q){let Z=X[J];if(Z.type==="SpreadElement"){this.castNodeTo(Z,"RestElement");let G=Z.argument;this.checkToRestConversion(G,!0),this.toAssignable(G,Q)}else this.toAssignable(Z,Q)}isAssignable(X,J){switch(X.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":case"VoidPattern":return!0;case"ObjectExpression":{let Q=X.properties.length-1;return X.properties.every((Z,G)=>{return Z.type!=="ObjectMethod"&&(G===Q||Z.type!=="SpreadElement")&&this.isAssignable(Z)})}case"ObjectProperty":return this.isAssignable(X.value);case"SpreadElement":return this.isAssignable(X.argument);case"ArrayExpression":return X.elements.every((Q)=>Q===null||this.isAssignable(Q));case"AssignmentExpression":return X.operator==="=";case"ParenthesizedExpression":return this.isAssignable(X.expression);case"MemberExpression":case"OptionalMemberExpression":return!J;default:return!1}}toReferencedList(X,J){return X}parseSpread(X){let J=this.startNode();return this.next(),J.argument=this.parseMaybeAssignAllowIn(X),this.finishNode(J,"SpreadElement")}parseRestBinding(){let X=this.startNode();this.next();let J=this.parseBindingAtom();if(J.type==="VoidPattern")this.raise(u.UnexpectedVoidPattern,J);return X.argument=J,this.finishNode(X,"RestElement")}parseBindingAtom(){switch(this.state.type){case 0:{let X=this.startNode();return this.next(),X.elements=this.parseBindingList(1,93,1),this.finishNode(X,"ArrayPattern")}case 2:return this.parseObjectLike(4,!0);case 84:return this.parseVoidPattern(null)}return this.parseIdentifier()}parseBindingList(X,J,Q){let Z=Q&1,G=[],Y=!0;while(!this.eat(X)){if(Y)Y=!1;else this.expect(8);if(Z&&this.match(8))G.push(null);else if(this.eat(X))break;else if(this.match(17)){let V=this.parseRestBinding();if(Q&2)V=this.parseFunctionParamType(V);if(G.push(V),!this.checkCommaAfterRest(J)){this.expect(X);break}}else{let V=[];if(Q&2){if(this.match(22)&&this.hasPlugin("decorators"))this.raise(u.UnsupportedParameterDecorator,this.state.startLoc);while(this.match(22))V.push(this.parseDecorator())}G.push(this.parseBindingElement(Q,V))}}return G}parseBindingRestProperty(X){if(this.next(),this.hasPlugin("discardBinding")&&this.match(84))X.argument=this.parseVoidPattern(null),this.raise(u.UnexpectedVoidPattern,X.argument);else X.argument=this.parseIdentifier();return this.checkCommaAfterRest(125),this.finishNode(X,"RestElement")}parseBindingProperty(){let{type:X,startLoc:J}=this.state;if(X===17)return this.parseBindingRestProperty(this.startNode());let Q=this.startNode();if(X===134)this.expectPlugin("destructuringPrivate",J),this.classScope.usePrivateName(this.state.value,J),Q.key=this.parsePrivateName();else this.parsePropertyName(Q);return Q.method=!1,this.parseObjPropValue(Q,J,!1,!1,!0,!1)}parseBindingElement(X,J){let{startLoc:Q}=this.state,Z=this.parseMaybeDefault();if(X&2)this.parseFunctionParamType(Z);if(J.length)Z.decorators=J,this.resetStartLocationFromNode(Z,J[0]);return this.parseMaybeDefault(Q,Z)}parseFunctionParamType(X){return X}parseMaybeDefault(X,J){if(X??=this.state.startLoc,J=J??this.parseBindingAtom(),!this.eat(25))return J;let Q=this.startNodeAt(X);if(J.type==="VoidPattern")this.raise(u.VoidPatternInitializer,J);return Q.left=J,Q.right=this.parseMaybeAssignAllowIn(),this.finishNode(Q,"AssignmentPattern")}isValidLVal(X,J,Q,Z){switch(X){case"AssignmentPattern":return"left";case"RestElement":return"argument";case"ObjectProperty":return"value";case"ParenthesizedExpression":return"expression";case"ArrayPattern":return"elements";case"ObjectPattern":return"properties";case"VoidPattern":return!0;case"CallExpression":if(!J&&!this.state.strict&&this.optionFlags&16384)return!0}return!1}isOptionalMemberExpression(X){return X.type==="OptionalMemberExpression"}checkLVal(X,J,Q=64,Z=!1,G=!1,Y=!1,V=!1){let K=X.type;if(this.isObjectMethod(X))return;let H=this.isOptionalMemberExpression(X);if(H||K==="MemberExpression"){if(H){if(this.expectPlugin("optionalChainingAssign",X.start),J.type!=="AssignmentExpression")this.raise(u.InvalidLhsOptionalChaining,X,{ancestor:J})}if(Q!==64)this.raise(u.InvalidPropertyBindingPattern,X);return}if(K==="Identifier"){this.checkIdentifier(X,Q,G);let{name:L}=X;if(Z)if(Z.has(L))this.raise(u.ParamDupe,X);else Z.add(L);return}else if(K==="VoidPattern"&&J.type==="CatchClause")this.raise(u.VoidPatternCatchClauseParam,X);let W=kL(X);V||=W.type==="CallExpression"&&(W.callee.type==="Import"||W.callee.type==="Super");let U=this.isValidLVal(K,V,!(Y||X.extra?.parenthesized)&&J.type==="AssignmentExpression",Q);if(U===!0)return;if(U===!1){let L=Q===64?u.InvalidLhs:u.InvalidLhsBinding;this.raise(L,X,{ancestor:J});return}let z,q;if(typeof U==="string")z=U,q=K==="ParenthesizedExpression";else[z,q]=U;let B=K==="ArrayPattern"||K==="ObjectPattern"?{type:K}:J,M=X[z];if(Array.isArray(M)){for(let L of M)if(L)this.checkLVal(L,B,Q,Z,G,q,!0)}else if(M)this.checkLVal(M,B,Q,Z,G,q,V)}checkIdentifier(X,J,Q=!1){if(this.state.strict&&(Q?IP(X.name,this.inModule):TP(X.name)))if(J===64)this.raise(u.StrictEvalArguments,X,{referenceName:X.name});else this.raise(u.StrictEvalArgumentsBinding,X,{bindingName:X.name});if(J&8192&&X.name==="let")this.raise(u.LetInLexicalBinding,X);if(!(J&64))this.declareNameFromIdentifier(X,J)}declareNameFromIdentifier(X,J){this.scope.declareName(X.name,J,X.start)}checkToRestConversion(X,J){switch(X.type){case"ParenthesizedExpression":this.checkToRestConversion(X.expression,J);break;case"Identifier":case"MemberExpression":break;case"ArrayExpression":case"ObjectExpression":if(J)break;default:this.raise(u.InvalidRestAssignmentPattern,X)}}checkCommaAfterRest(X){if(!this.match(8))return!1;return this.raise(this.lookaheadCharCode()===X?u.RestTrailingComma:u.ElementAfterRest,this.state.startLoc),!0}}class vP extends hP{checkProto(X,J,Q){if(X.type==="SpreadElement"||this.isObjectMethod(X)||X.computed||X.shorthand)return J;let Z=X.key;if((Z.type==="Identifier"?Z.name:Z.value)==="__proto__"){if(J)if(Q){if(Q.doubleProtoLoc===null)Q.doubleProtoLoc=this.getLoc(Z.start)}else this.raise(u.DuplicateProto,Z);return!0}return J}shouldExitDescending(X){return X.type==="ArrowFunctionExpression"&&!X.extra?.parenthesized}getExpression(){if(this.enterInitialScopes(),this.nextToken(),this.match(135))throw this.raise(u.ParseExpressionEmptyInput,this.state.startLoc);let X=this.parseExpression();if(!this.match(135))throw this.raise(u.ParseExpressionExpectsEOF,this.state.startLoc,{unexpected:this.input.codePointAt(this.state.start)});if(this.finalizeRemainingComments(),X.comments=this.comments,X.errors=this.state.errors,this.optionFlags&512)X.tokens=fP(this.tokens);return X}parseExpression(X,J){if(X)return this.disallowInAnd(()=>this.parseExpressionBase(J));return this.allowInAnd(()=>this.parseExpressionBase(J))}parseExpressionBase(X){let J=this.state.startLoc,Q=this.parseMaybeAssign(X);if(this.match(8)){let Z=this.startNodeAt(J);Z.expressions=[Q];while(this.eat(8))Z.expressions.push(this.parseMaybeAssign(X));return this.toReferencedList(Z.expressions),this.finishNode(Z,"SequenceExpression")}return Q}parseMaybeAssignDisallowIn(X){return this.disallowInAnd(()=>this.parseMaybeAssign(X))}parseMaybeAssignAllowIn(X,J){return this.allowInAnd(()=>this.parseMaybeAssign(X,J))}setOptionalParametersError(X){X.optionalParametersLoc=this.state.startLoc}parseMaybeAssign(X,J){let Q=this.state.startLoc,Z=this.isContextual(104);if(Z){if(this.prodParam.hasYield){this.next();let V=this.parseYield(Q);if(J)V=this.parseParenItem(V,Q);return V}}let G;if(X)G=!1;else X=new AG,G=!0;this.state.canStartArrow=!0;let Y=this.parseMaybeConditional(X);if(J)Y=this.parseParenItem(Y,Q);if(h10(this.state.type)){let V=this.startNodeAt(Q),K=this.state.value;if(V.operator=K,this.match(25)){this.toAssignable(Y,!0),V.left=Y;let H=Q.index;if(X.doubleProtoLoc!=null&&X.doubleProtoLoc.index>=H)X.doubleProtoLoc=null;if(X.shorthandAssignLoc!=null&&X.shorthandAssignLoc.index>=H)X.shorthandAssignLoc=null;if(X.privateKeyLoc!=null&&X.privateKeyLoc.index>=H)this.checkDestructuringPrivate(X),X.privateKeyLoc=null;if(X.voidPatternLoc!=null&&X.voidPatternLoc.index>=H)X.voidPatternLoc=null}else V.left=Y;return this.next(),V.right=this.parseMaybeAssign(),this.checkLVal(Y,this.finishNode(V,"AssignmentExpression"),void 0,void 0,void 0,void 0,K==="||="||K==="&&="||K==="??="),V}else if(G)this.checkExpressionErrors(X,!0);if(Z){let{type:V}=this.state;if((this.hasPlugin("v8intrinsic")?NG(V):NG(V)&&!this.match(50))&&!this.isAmbiguousPrefixOrIdentifier())return this.raiseOverwrite(u.YieldNotInGeneratorFunction,Q),this.parseYield(Q)}return Y}parseMaybeConditional(X){let J=this.state.startLoc,Q=this.parseExprOps(X);if(this.shouldExitDescending(Q))return Q;return this.parseConditional(Q,J,X)}parseConditional(X,J,Q){if(this.eat(13)){let Z=this.startNodeAt(J);return Z.test=X,Z.consequent=this.parseMaybeAssignAllowIn(),this.expect(10),Z.alternate=this.parseMaybeAssign(),this.finishNode(Z,"ConditionalExpression")}return X}parseMaybeUnaryOrPrivate(X){return this.match(134)?this.parsePrivateName():this.parseMaybeUnary(X)}parseExprOps(X){let J=this.state.startLoc,Q=this.parseMaybeUnaryOrPrivate(X);if(this.shouldExitDescending(Q))return Q;return this.state.canStartArrow=!1,this.parseExprOp(Q,J,-1)}parseExprOp(X,J,Q){if(this.isPrivateName(X)){let G=this.getPrivateNameSV(X);if(Q>=fW(54)||!this.prodParam.hasIn||!this.match(54))this.raise(u.PrivateInExpectedIn,J,{identifierName:G});this.classScope.usePrivateName(G,J)}let Z=this.state.type;if(tF(Z)&&(this.prodParam.hasIn||!this.match(54))){let G=fW(Z);if(G>Q){if(Z===35){if(this.expectPlugin("pipelineOperator"),this.prodParam.inFSharpPipelineDirectBody)return X}let Y=this.startNodeAt(J);Y.left=X,Y.operator=this.state.value;let V=Z===37||Z===38,K=Z===36;if(K)G=fW(38);this.next(),Y.right=this.parseExprOpRightExpr(Z,G);let H=this.finishNode(Y,V||K?"LogicalExpression":"BinaryExpression"),W=this.state.type;if(K&&(W===37||W===38)||V&&W===36)throw this.raise(u.MixingCoalesceWithLogical,this.state.startLoc);return this.parseExprOp(H,J,Q)}}return X}parseExprOpRightExpr(X,J){switch(X){case 35:switch(this.getPluginOption("pipelineOperator","proposal")){case"hack":return this.withTopicBindingContext(()=>{return this.parseHackPipeBody()});case"fsharp":return this.parseFSharpPipelineBody(J)}default:return this.parseExprOpBaseRightExpr(X,J)}}parseExprOpBaseRightExpr(X,J){let Q=this.state.startLoc;return this.parseExprOp(this.parseMaybeUnaryOrPrivate(),Q,p10(X)?J-1:J)}parseHackPipeBody(){let{startLoc:X}=this.state,J=this.parseMaybeAssign();if(E10.has(J.type)&&!J.extra?.parenthesized)this.raise(u.PipeUnparenthesizedBody,X,{type:J.type});if(!this.topicReferenceWasUsedInCurrentContext())this.raise(u.PipeTopicUnused,X);return J}checkExponentialAfterUnary(X){if(this.match(53))this.raise(u.UnexpectedTokenUnaryExponentiation,X.argument)}parseMaybeUnary(X,J){let Q=this.state.startLoc,Z=this.isContextual(92);if(Z&&this.recordAwaitIfAllowed()){this.next();let K=this.parseAwait(Q);if(!J)this.checkExponentialAfterUnary(K);return K}let G=this.match(30),Y=this.startNode();if(_10(this.state.type)){if(Y.operator=this.state.value,Y.prefix=!0,this.state.canStartArrow=!1,this.match(68))this.expectPlugin("throwExpressions");let K=this.match(85);if(this.next(),Y.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(X,!0),this.state.strict&&K){let H=Y.argument;if(H.type==="Identifier")this.raise(u.StrictDelete,Y);else if(this.hasPropertyAsPrivateName(H))this.raise(u.DeletePrivateField,Y)}if(!G){if(!J)this.checkExponentialAfterUnary(Y);return this.finishNode(Y,"UnaryExpression")}}let V=this.parseUpdate(Y,G,X);if(Z){let{type:K}=this.state;if((this.hasPlugin("v8intrinsic")?NG(K):NG(K)&&!this.match(50))&&!this.isAmbiguousPrefixOrIdentifier())return this.raiseOverwrite(u.AwaitNotInAsyncContext,Q),this.parseAwait(Q)}return V}parseUpdate(X,J,Q){if(J){let Y=this.finishNode(X,"UpdateExpression");return this.checkLVal(Y.argument,Y),Y}let Z=this.state.startLoc,G=this.parseExprSubscripts(Q);if(this.checkExpressionErrors(Q,!1))return G;while(f10(this.state.type)&&!this.canInsertSemicolon()){let Y=this.startNodeAt(Z);Y.operator=this.state.value,Y.prefix=!1,Y.argument=G,this.next(),this.checkLVal(G,G=this.finishNode(Y,"UpdateExpression"))}return G}parseExprSubscripts(X){let J=this.state.startLoc;this.setLoc(J);let Q=this.parseExprAtom(X);if(this.shouldExitDescending(Q))return Q;return this.parseSubscripts(Q,J)}parseSubscripts(X,J,Q){let Z={optionalChainMember:!1,maybeAsyncArrow:this.atPossibleAsyncArrow(X),stop:!1};do X=this.parseSubscript(X,J,Q,Z),Z.maybeAsyncArrow=!1;while(!Z.stop);return X}parseSubscript(X,J,Q,Z){let{type:G}=this.state;if(!Q&&G===11)return this.parseBind(X,J,Z);else if(SL(G))return this.parseTaggedTemplateExpression(X,J,Z);let Y=!1;if(G===14){if(Q){if(this.raise(u.OptionalChainingNoNew,this.state.startLoc),this.lookaheadCharCode()===40)return this.stopParseSubscript(X,Z)}Z.optionalChainMember=Y=!0,this.next()}if(!Q&&this.match(6))return this.parseCoverCallAndAsyncArrowHead(X,J,Z,Y);else{let V=this.eat(0);if(V||Y||this.eat(12))return this.parseMember(X,J,Z,V,Y);else return this.stopParseSubscript(X,Z)}}stopParseSubscript(X,J){return J.stop=!0,X}parseMember(X,J,Q,Z,G){let Y=this.startNodeAt(J);if(Y.object=X,Y.computed=Z,Z)Y.property=this.parseExpression(),this.expect(1);else if(this.match(134)){if(X.type==="Super")this.raise(u.SuperPrivateField,J);this.classScope.usePrivateName(this.state.value,this.state.startLoc),Y.property=this.parsePrivateName()}else Y.property=this.parseIdentifier(!0);if(Q.optionalChainMember)return Y.optional=G,this.finishNode(Y,"OptionalMemberExpression");else return this.finishNode(Y,"MemberExpression")}parseBind(X,J,Q){let Z=this.startNodeAt(J);Z.object=X,this.next();let G=this.parseNoCallExpr((Y)=>{throw this.raise(u.UnsupportedBindRHS,Y)});if(G.type==="Super"||G.type==="Import")throw this.raise(u.UnsupportedBindRHS,G);return Z.callee=G,Q.stop=!0,this.parseSubscripts(this.finishNode(Z,"BindExpression"),J,!1)}parseCoverCallAndAsyncArrowHead(X,J,Q,Z){let G=null;this.next();let Y=this.startNodeAt(J);Y.callee=X;let{maybeAsyncArrow:V,optionalChainMember:K}=Q;if(V)this.expressionScope.enter(LQ0()),G=new AG;if(K)Y.optional=Z;if(Z)Y.arguments=this.parseCallExpressionArguments();else Y.arguments=this.parseCallExpressionArguments(X.type!=="Super",Y,G);let H=this.finishCallExpression(Y,K);if(V&&this.shouldParseAsyncArrow()&&!Z)Q.stop=!0,this.checkDestructuringPrivate(G),this.expressionScope.validateAsPattern(),this.expressionScope.exit(),H=this.parseAsyncArrowFromCallExpression(this.startNodeAt(J),H);else{if(V)this.checkExpressionErrors(G,!0),this.expressionScope.exit();this.toReferencedList(Y.arguments)}return H}parseTaggedTemplateExpression(X,J,Q){let Z=this.startNodeAt(J);if(Z.tag=X,Z.quasi=this.parseTemplate(!0),Q.optionalChainMember)this.raise(u.OptionalChainingNoTemplate,J);return this.finishNode(Z,"TaggedTemplateExpression")}atPossibleAsyncArrow(X){return X.type==="Identifier"&&X.name==="async"&&this.state.lastTokEndLoc.index===X.end&&!this.canInsertSemicolon()&&X.end-X.start===5&&this.state.canStartArrow}finishCallExpression(X,J){if(X.callee.type==="Import"){if(X.arguments.length===0||X.arguments.length>2)this.raise(u.ImportCallArity,X);else for(let Q of X.arguments)if(Q.type==="SpreadElement")this.raise(u.ImportCallSpreadArgument,Q)}return this.finishNode(X,J?"OptionalCallExpression":"CallExpression")}parseCallExpressionArguments(X,J,Q){let Z=[],G=!0;while(!this.eat(7)){if(G)G=!1;else if(this.expect(8),this.match(7)){if(J)this.addTrailingCommaExtraToNode(J);this.next();break}Z.push(this.parseExprListItem(7,!1,Q,X))}return Z}shouldParseAsyncArrow(){return this.match(15)&&!this.canInsertSemicolon()}parseAsyncArrowFromCallExpression(X,J){if(this.resetPreviousNodeTrailingComments(J),this.expect(15),this.parseArrowExpression(X,J.arguments,!0,J.extra?.trailingCommaLoc),J.innerComments)EG(X,J.innerComments);if(J.callee.trailingComments)EG(X,J.callee.trailingComments);return X}parseNoCallExpr(X){let J=this.state.startLoc,Q=this.match(79),Z=this.parseExprAtom();if(Q&&Z.type==="ImportExpression")X(Z);return this.parseSubscripts(Z,J,!0)}parseExprAtom(X){let J,Q=null,{type:Z}=this.state;switch(Z){case 75:return this.parseSuper();case 79:if(J=this.startNode(),this.next(),this.match(12))return this.parseImportMetaPropertyOrPhaseCall(J);if(this.match(6))if(this.optionFlags&1024)return this.parseImportCall(J);else return this.finishNode(J,"Import");else return this.raise(u.UnsupportedImport,this.state.lastTokStartLoc),this.finishNode(J,"Import");case 74:return J=this.startNode(),this.next(),this.finishNode(J,"ThisExpression");case 86:return this.parseDo(this.startNode(),!1);case 52:case 27:return this.readRegexp(),this.parseRegExpLiteral(this.state.value);case 131:return this.parseNumericLiteral(this.state.value);case 132:return this.parseBigIntLiteral(this.state.value);case 130:return this.parseStringLiteral(this.state.value);case 80:return this.parseNullLiteral();case 81:return this.parseBooleanLiteral(!0);case 82:return this.parseBooleanLiteral(!1);case 6:return this.parseParenAndDistinguishExpression(this.state.canStartArrow);case 0:return this.parseArrayLike(1,X);case 2:return this.parseObjectLike(4,!1,X);case 64:return this.parseFunctionOrFunctionSent();case 22:Q=this.parseDecorators();case 76:return this.parseClass(this.maybeTakeDecorators(Q,this.startNode()),!1);case 73:return this.parseNewOrNewTarget();case 21:case 20:return this.parseTemplate(!1);case 11:{J=this.startNode(),this.next(),J.object=null;let G=J.callee=this.parseNoCallExpr((Y)=>{throw this.raise(u.UnsupportedBind,Y)});if(G.type==="MemberExpression")return this.finishNode(J,"BindExpression");else throw this.raise(u.UnsupportedBind,G)}case 134:return this.raise(u.PrivateInExpectedIn,this.state.startLoc,{identifierName:this.state.value}),this.parsePrivateName();case 29:return this.parseTopicReferenceThenEqualsSign(50,"%");case 28:return this.parseTopicReferenceThenEqualsSign(40,"^");case 33:case 34:return this.parseTopicReference("hack");case 40:case 50:case 23:{let G=this.getPluginOption("pipelineOperator","proposal");if(G)return this.parseTopicReference(G);throw this.unexpected()}case 43:{let G=this.input.codePointAt(this.nextTokenStart());if(u9(G)||G===62)throw this.expectOnePlugin(["jsx","flow","typescript"]);throw this.unexpected()}default:if(R5(Z)){if(this.isContextual(123)&&this.lookaheadInLineCharCode()===123)return this.parseModuleExpression();let{canStartArrow:G,containsEsc:Y}=this.state,V=this.parseIdentifier();if(!Y&&V.name==="async"&&!this.canInsertSemicolon()){let{type:K}=this.state;if(K===64)return this.resetPreviousNodeTrailingComments(V),this.next(),this.parseAsyncFunctionExpression(this.startNodeAtNode(V));else if(R5(K))if(G&&this.lookaheadCharCode()===61)return this.parseAsyncArrowUnaryFunction(this.startNodeAtNode(V));else return V;else if(K===86)return this.resetPreviousNodeTrailingComments(V),this.parseDo(this.startNodeAtNode(V),!0)}if(G&&this.match(15)&&!this.canInsertSemicolon())return this.next(),this.parseArrowExpression(this.startNodeAtNode(V),[V],!1);return V}else throw this.unexpected()}}parseTopicReferenceThenEqualsSign(X,J){let Q=this.getPluginOption("pipelineOperator","proposal");if(Q)return this.state.type=X,this.state.value=J,this.state.pos--,this.state.end--,this.state.endLoc=g7(this.state.endLoc,-1),this.parseTopicReference(Q);throw this.unexpected()}parseTopicReference(X){let J=this.startNode(),Q=this.state.startLoc,Z=this.state.type;return this.next(),this.finishTopicReference(J,Q,X,Z)}finishTopicReference(X,J,Q,Z){if(this.testTopicReferenceConfiguration(Q,J,Z)){if(!this.topicReferenceIsAllowedInCurrentContext())this.raise(u.PipeTopicUnbound,J);return this.registerTopicReference(),this.finishNode(X,"TopicReference")}else throw this.raise(u.PipeTopicUnconfiguredToken,J,{token:x4(Z)})}testTopicReferenceConfiguration(X,J,Q){switch(X){case"hack":return this.hasPlugin(["pipelineOperator",{topicToken:x4(Q)}]);default:throw this.raise(u.PipeTopicRequiresHackPipes,J)}}parseAsyncArrowUnaryFunction(X){this.prodParam.enter(_W(!0,this.prodParam.hasYield));let J=[this.parseIdentifier()];if(this.prodParam.exit(),this.hasPrecedingLineBreak())this.raise(u.LineTerminatorBeforeArrow,this.state.curPosition());return this.expect(15),this.parseArrowExpression(X,J,!0)}parseDo(X,J){if(this.expectPlugin("doExpressions"),J)this.expectPlugin("asyncDoExpressions");X.async=J,this.next();let Q=this.state.labels;if(this.state.labels=[],J)this.prodParam.enter(2),X.body=this.parseBlock(),this.prodParam.exit();else X.body=this.parseBlock();return this.state.labels=Q,this.finishNode(X,"DoExpression")}parseSuper(){let X=this.startNode();if(this.next(),this.match(6)&&!this.scope.allowDirectSuper)this.raise(u.SuperNotAllowed,X);else if(!this.scope.allowSuper)this.raise(u.UnexpectedSuper,X);if(!this.match(6)&&!this.match(0)&&!this.match(12))this.raise(u.UnsupportedSuper,X);return this.finishNode(X,"Super")}parsePrivateName(){let X=this.startNode(),J=this.startNodeAt(g7(this.state.startLoc,1)),Q=this.state.value;return this.next(),X.id=this.createIdentifier(J,Q),this.finishNode(X,"PrivateName")}parseFunctionOrFunctionSent(){let X=this.startNode();if(this.next(),this.prodParam.hasYield&&this.match(12)){let J=this.createIdentifier(this.startNodeAtNode(X),"function");if(this.next(),this.match(99))this.expectPlugin("functionSent");else if(!this.hasPlugin("functionSent"))this.unexpected();return this.parseMetaProperty(X,J,"sent")}return this.parseFunction(X)}parseMetaProperty(X,J,Q){X.meta=J;let Z=this.state.containsEsc;if(X.property=this.parseIdentifier(!0),X.property.name!==Q||Z)this.raise(u.UnsupportedMetaProperty,X.property,{target:J.name,onlyValidPropertyName:Q});return this.finishNode(X,"MetaProperty")}parseImportMetaPropertyOrPhaseCall(X){if(this.next(),this.isContextual(101)||this.isContextual(93)){let J=this.isContextual(101);return this.expectPlugin(J?"sourcePhaseImports":"deferredImportEvaluation"),this.next(),X.phase=J?"source":"defer",this.parseImportCall(X)}else{let J=this.createIdentifierAt(this.startNodeAtNode(X),"import",this.state.lastTokStartLoc);if(this.isContextual(97)){if(!this.inModule)this.raise(u.ImportMetaOutsideModule,J);this.sawUnambiguousESM=!0}return this.parseMetaProperty(X,J,"meta")}}parseLiteralAtNode(X,J,Q){return this.addExtra(Q,"rawValue",X),this.addExtra(Q,"raw",this.input.slice(this.offsetToSourcePos(Q.start),this.state.end)),Q.value=X,this.next(),this.finishNode(Q,J)}parseLiteral(X,J){let Q=this.startNode();return this.parseLiteralAtNode(X,J,Q)}parseStringLiteral(X){return this.parseLiteral(X,"StringLiteral")}parseNumericLiteral(X){return this.parseLiteral(X,"NumericLiteral")}parseBigIntLiteral(X){let J;try{J=BigInt(X)}catch{J=null}return this.parseLiteral(J,"BigIntLiteral")}parseRegExpLiteral(X){let J=this.startNode();return this.addExtra(J,"raw",this.input.slice(this.offsetToSourcePos(J.start),this.state.end)),J.pattern=X.pattern,J.flags=X.flags,this.next(),this.finishNode(J,"RegExpLiteral")}parseBooleanLiteral(X){let J=this.startNode();return J.value=X,this.next(),this.finishNode(J,"BooleanLiteral")}parseNullLiteral(){let X=this.startNode();return this.next(),this.finishNode(X,"NullLiteral")}parseParenAndDistinguishExpression(X){let J=this.state.startLoc,Q;this.next(),this.expressionScope.enter(BQ0());let Z=this.state.startLoc,G=[],Y=new AG,V=!0,K,H;while(!this.match(7)){if(V)V=!1;else if(this.expect(8,Y.optionalParametersLoc===null?null:Y.optionalParametersLoc),this.match(7)){H=this.state.startLoc;break}if(this.match(17)){let z=this.state.startLoc;if(K=this.state.startLoc,G.push(this.parseParenItem(this.parseRestBinding(),z)),!this.checkCommaAfterRest(41))break}else G.push(this.parseMaybeAssignAllowInOrVoidPattern(7,Y,!0))}let W=this.state.lastTokEndLoc;this.expect(7);let U=this.startNodeAt(J);if(X&&this.shouldParseArrow(G)&&(U=this.parseArrow(U)))return this.checkDestructuringPrivate(Y),this.expressionScope.validateAsPattern(),this.expressionScope.exit(),this.parseArrowExpression(U,G,!1),U;if(this.expressionScope.exit(),!G.length)this.unexpected(this.state.lastTokStartLoc);if(H)this.unexpected(H);if(K)this.unexpected(K);if(this.checkExpressionErrors(Y,!0),this.toReferencedList(G,!0),G.length>1)Q=this.startNodeAt(Z),Q.expressions=G,this.finishNode(Q,"SequenceExpression"),this.resetEndLocation(Q,W);else Q=G[0];return this.wrapParenthesis(J,Q)}wrapParenthesis(X,J){if(!(this.optionFlags&2048))return this.addExtra(J,"parenthesized",!0),this.addExtra(J,"parenStart",X.index),this.takeSurroundingComments(J,X.index,this.state.lastTokEndLoc.index),J;let Q=this.startNodeAt(X);return Q.expression=J,this.finishNode(Q,"ParenthesizedExpression")}shouldParseArrow(X){return!this.canInsertSemicolon()}parseArrow(X){if(this.eat(15))return X}parseParenItem(X,J){return X}parseNewOrNewTarget(){let X=this.startNode();if(this.next(),this.match(12)){let J=this.createIdentifier(this.startNodeAtNode(X),"new");this.next();let Q=this.parseMetaProperty(X,J,"target");if(!this.scope.allowNewTarget)this.raise(u.UnexpectedNewTarget,Q);return Q}return this.parseNew(X)}parseNew(X){if(this.parseNewCallee(X),this.eat(6)){let J=this.parseExprList(7);this.toReferencedList(J),X.arguments=J}else X.arguments=[];return this.finishNode(X,"NewExpression")}parseNewCallee(X){let J=this.parseNoCallExpr((Q)=>{this.raise(u.ImportCallNotNewExpression,Q,Q)});if(X.callee=J,J.type==="Import")this.raise(u.ImportCallNotNewExpression,J);if(J.type==="Super")this.raise(u.SuperCallNotNewExpression,J)}parseTemplateElement(X){let{start:J,startLoc:Q,end:Z,value:G}=this.state,Y=J+1,V=this.startNodeAt(g7(Q,1));if(G===null){if(!X)this.raise(u.InvalidEscapeSequenceTemplate,g7(this.state.firstInvalidTemplateEscapePos,1))}let K=this.match(20),H=K?-1:-2,W=Z+H;V.value={raw:this.input.slice(Y,W).replace(/\r\n?/g,`
297
- `),cooked:G===null?null:G.slice(1,H)},V.tail=K,this.next();let U=this.finishNode(V,"TemplateElement");return this.resetEndLocation(U,g7(this.state.lastTokEndLoc,H)),U}parseTemplate(X){let J=this.startNode(),Q=this.parseTemplateElement(X),Z=[Q],G=[];while(!Q.tail)G.push(this.parseTemplateSubstitution()),this.readTemplateContinuation(),Z.push(Q=this.parseTemplateElement(X));return J.expressions=G,J.quasis=Z,this.finishNode(J,"TemplateLiteral")}parseTemplateSubstitution(){return this.parseExpression()}parseObjectLike(X,J,Q){let Z=!1,G=!0,Y=this.startNode();Y.properties=[],this.next();while(!this.match(X)){if(G)G=!1;else if(this.expect(8),this.match(X)){this.addTrailingCommaExtraToNode(Y);break}let K;if(J)K=this.parseBindingProperty();else K=this.parsePropertyDefinition(Q),Z=this.checkProto(K,Z,Q);Y.properties.push(K)}this.next();let V=J?"ObjectPattern":"ObjectExpression";return this.finishNode(Y,V)}addTrailingCommaExtraToNode(X){this.addExtra(X,"trailingComma",this.state.lastTokStartLoc.index),this.addExtra(X,"trailingCommaLoc",this.state.lastTokStartLoc,!1)}maybeAsyncOrAccessorProp(X){return!X.computed&&X.key.type==="Identifier"&&(this.isLiteralPropertyName()||this.match(0)||this.match(51))}parsePropertyDefinition(X){let J=[];if(this.match(22)){if(this.hasPlugin("decorators"))this.raise(u.UnsupportedPropertyDecorator,this.state.startLoc);while(this.match(22))J.push(this.parseDecorator())}let Q=this.startNode(),Z=!1,G=!1,Y;if(this.match(17)){if(J.length)this.unexpected();return this.parseSpread()}if(J.length)Q.decorators=J;if(Q.method=!1,X)Y=this.state.startLoc;let V=this.eat(51);this.parsePropertyNamePrefixOperator(Q);let K=this.state.containsEsc;if(this.parsePropertyName(Q,X),!V&&!K&&this.maybeAsyncOrAccessorProp(Q)){let{key:H}=Q,W=H.name;if(W==="async"&&!this.hasPrecedingLineBreak())Z=!0,this.resetPreviousNodeTrailingComments(H),V=this.eat(51),this.parsePropertyName(Q);if(W==="get"||W==="set"){if(G=!0,this.resetPreviousNodeTrailingComments(H),Q.kind=W,this.match(51))V=!0,this.raise(u.AccessorIsGenerator,this.state.curPosition(),{kind:W}),this.next();this.parsePropertyName(Q)}}return this.parseObjPropValue(Q,Y,V,Z,!1,G,X)}getGetterSetterExpectedParamCount(X){return X.kind==="get"?0:1}getObjectOrClassMethodParams(X){return X.params}checkGetterSetterParams(X){let J=this.getGetterSetterExpectedParamCount(X),Q=this.getObjectOrClassMethodParams(X);if(Q.length!==J)this.raise(X.kind==="get"?u.BadGetterArity:u.BadSetterArity,X);if(X.kind==="set"&&Q[Q.length-1]?.type==="RestElement")this.raise(u.BadSetterRestParameter,X)}parseObjectMethod(X,J,Q,Z,G){if(G){let Y=this.parseMethod(X,J,!1,!1,!1,"ObjectMethod");return this.checkGetterSetterParams(Y),Y}if(Q||J||this.match(6)){if(Z)this.unexpected();return X.kind="method",X.method=!0,this.parseMethod(X,J,Q,!1,!1,"ObjectMethod")}}parseObjectProperty(X,J,Q,Z){if(X.shorthand=!1,this.eat(10))return X.value=Q?this.parseMaybeDefault(this.state.startLoc):this.parseMaybeAssignAllowInOrVoidPattern(4,Z),this.finishObjectProperty(X);if(!X.computed&&X.key.type==="Identifier"){if(this.checkReservedWord(X.key.name,X.key.start,!0,!1),Q)X.value=this.parseMaybeDefault(J,this.cloneIdentifier(X.key));else if(this.match(25)){let G=this.state.startLoc;if(Z!=null){if(Z.shorthandAssignLoc===null)Z.shorthandAssignLoc=G}else this.raise(u.InvalidCoverInitializedName,G);X.value=this.parseMaybeDefault(J,this.cloneIdentifier(X.key))}else X.value=this.cloneIdentifier(X.key);return X.shorthand=!0,this.finishObjectProperty(X)}}finishObjectProperty(X){return this.finishNode(X,"ObjectProperty")}parseObjPropValue(X,J,Q,Z,G,Y,V){let K=this.parseObjectMethod(X,Q,Z,G,Y)||this.parseObjectProperty(X,J,G,V);if(!K)this.unexpected();return K}parsePropertyName(X,J){if(this.eat(0))X.computed=!0,X.key=this.parseMaybeAssignAllowIn(),this.expect(1);else{let{type:Q,value:Z}=this.state,G;if(s8(Q))G=this.parseIdentifier(!0);else switch(Q){case 131:G=this.parseNumericLiteral(Z);break;case 130:G=this.parseStringLiteral(Z);break;case 132:G=this.parseBigIntLiteral(Z);break;case 134:{let Y=this.state.startLoc;if(J!=null){if(J.privateKeyLoc===null)J.privateKeyLoc=Y}else this.raise(u.UnexpectedPrivateField,Y);G=this.parsePrivateName();break}default:throw this.unexpected()}if(X.key=G,Q!==134)X.computed=!1}}initFunction(X,J){X.id=null,X.generator=!1,X.async=J}parseMethod(X,J,Q,Z,G,Y,V=!1){this.initFunction(X,Q),X.generator=J,this.scope.enter(530|(V?576:0)|(G?32:0)),this.prodParam.enter(_W(Q,X.generator)),this.parseFunctionParams(X,Z);let K=this.parseFunctionBodyAndFinish(X,Y,!0);return this.prodParam.exit(),this.scope.exit(),K}parseArrayLike(X,J){let Q=this.startNode();return this.next(),Q.elements=this.parseExprList(X,!0,J,Q),this.finishNode(Q,"ArrayExpression")}parseArrowExpression(X,J,Q,Z){this.scope.enter(518);let G=_W(Q,!1);if(!this.match(2))G|=this.prodParam.currentFlags()&24;if(this.prodParam.enter(G),this.initFunction(X,Q),J)this.setArrowFunctionParameters(X,J,Z);return this.parseFunctionBody(X,!0),this.prodParam.exit(),this.scope.exit(),this.finishNode(X,"ArrowFunctionExpression")}setArrowFunctionParameters(X,J,Q){this.toAssignableList(J,Q,!1),X.params=J}parseFunctionBodyAndFinish(X,J,Q=!1){return this.parseFunctionBody(X,!1,Q),this.finishNode(X,J)}parseFunctionBody(X,J,Q=!1){let Z=J&&!this.match(2);if(this.expressionScope.enter(wL()),Z)X.body=this.parseMaybeAssign(),this.checkParams(X,!1,J,!1);else{let G=this.state.strict,Y=this.state.labels;this.state.labels=[],this.prodParam.enter(this.prodParam.currentFlags()|4),X.body=this.parseBlock(!0,!1,(V)=>{let K=!this.isSimpleParamList(X.params);if(V&&K)this.raise(u.IllegalLanguageModeDirective,(X.kind==="method"||X.kind==="constructor")&&!!X.key?this.optionFlags&256?X.key.loc.end:X.key:X);let H=!G&&this.state.strict;if(this.checkParams(X,!this.state.strict&&!J&&!Q&&!K,J,H),this.state.strict&&X.id)this.checkIdentifier(X.id,65,H)}),this.prodParam.exit(),this.state.labels=Y}this.expressionScope.exit()}isSimpleParameter(X){return X.type==="Identifier"}isSimpleParamList(X){for(let J=0,Q=X.length;J<Q;J++)if(!this.isSimpleParameter(X[J]))return!1;return!0}checkParams(X,J,Q,Z=!0){let G=!J&&new Set,Y={type:"FormalParameters"};for(let V of X.params)this.checkLVal(V,Y,5,G,Z)}parseExprList(X,J,Q,Z){let G=[],Y=!0;while(!this.eat(X)){if(Y)Y=!1;else if(this.expect(8),this.match(X)){if(Z)this.addTrailingCommaExtraToNode(Z);this.next();break}G.push(this.parseExprListItem(X,J,Q))}return G}parseExprListItem(X,J,Q,Z){let G;if(this.match(8)){if(!J)this.raise(u.UnexpectedToken,this.state.curPosition(),{unexpected:","});G=null}else if(this.match(17)){let Y=this.state.startLoc;G=this.parseParenItem(this.parseSpread(Q),Y)}else if(this.match(13)){if(this.expectPlugin("partialApplication"),!Z)this.raise(u.UnexpectedArgumentPlaceholder,this.state.startLoc);let Y=this.startNode();this.next(),G=this.finishNode(Y,"ArgumentPlaceholder")}else G=this.parseMaybeAssignAllowInOrVoidPattern(X,Q,!0);return G}parseIdentifier(X){let J=this.startNode(),Q=this.parseIdentifierName(X);return this.createIdentifier(J,Q)}createIdentifier(X,J){if(X.name=J,this.optionFlags&256)X.loc.identifierName=J;return this.finishNode(X,"Identifier")}createIdentifierAt(X,J,Q){if(X.name=J,this.optionFlags&256)X.loc.identifierName=J;return this.finishNodeAt(X,"Identifier",Q)}parseIdentifierName(X){let J,{start:Q,type:Z}=this.state;if(s8(Z))J=this.state.value;else this.unexpected();let G=g10(Z);if(X){if(G)this.replaceToken(128)}else this.checkReservedWord(J,this.sourceToOffsetPos(Q),G,!1);return this.next(),J}checkReservedWord(X,J,Q,Z){if(X.length>10)return;if(!r10(X))return;if(Q&&s10(X)){this.raise(u.UnexpectedKeyword,J,{keyword:X});return}if((!this.state.strict?LP:Z?IP:OP)(X,this.inModule)){this.raise(u.UnexpectedReservedWord,J,{reservedWord:X});return}else if(X==="yield"){if(this.prodParam.hasYield){this.raise(u.YieldBindingIdentifier,J);return}}else if(X==="await"){if(this.prodParam.hasAwait){this.raise(u.AwaitBindingIdentifier,J);return}if(this.scope.inStaticBlock){this.raise(u.AwaitBindingIdentifierInStaticBlock,J);return}this.expressionScope.recordAsyncArrowParametersError(J)}else if(X==="arguments"){if(this.scope.inClassAndNotInNonArrowFunction){this.raise(u.ArgumentsInClass,J);return}}}recordAwaitIfAllowed(){let X=this.prodParam.hasAwait;if(X&&!this.scope.inFunction)this.state.hasTopLevelAwait=!0;return X}parseAwait(X,J){let Q=X.index;this.setLoc(X);let Z=this.startNodeAt(X);if(this.expressionScope.recordParameterInitializerError(u.AwaitExpressionFormalParameter,Q),this.eat(51))this.raise(u.ObsoleteAwaitStar,X);if(!this.scope.inFunction&&!(this.optionFlags&1))if(this.isAmbiguousPrefixOrIdentifier())this.ambiguousScriptDifferentAst=!0;else this.sawUnambiguousESM=!0;if(!J)Z.argument=this.parseMaybeUnary(null,!0);return this.finishNode(Z,"AwaitExpression")}isAmbiguousPrefixOrIdentifier(){if(this.hasPrecedingLineBreak())return!0;let{type:X}=this.state;return X===49||X===6||X===0||SL(X)||X===98&&!this.state.containsEsc||X===133||X===52||this.hasPlugin("v8intrinsic")&&X===50}parseYield(X){this.setLoc(X);let J=this.startNodeAt(X);this.expressionScope.recordParameterInitializerError(u.YieldInParameter,X.index);let Q=!1,Z=null;if(!this.hasPrecedingLineBreak())switch(Q=this.eat(51),this.state.type){case 9:case 135:case 4:case 7:case 1:case 5:case 10:case 8:if(!Q)break;default:Z=this.parseMaybeAssign()}return J.delegate=Q,J.argument=Z,this.finishNode(J,"YieldExpression")}parseImportCall(X){this.next();let J=this.parseCallExpressionArguments();if(J.length===0||J.length>2)this.raise(u.ImportCallArity,X,X);else for(let Q of J)if(Q.type==="SpreadElement")this.raise(u.ImportCallSpreadArgument,Q,X);return X.source=J[0],X.options=J[1]??null,this.finishNode(X,"ImportExpression")}withTopicBindingContext(X){let J=this.state.inHackPipelineBody;this.state.inHackPipelineBody=!0;let Q=this.state.seenTopicReference;this.state.seenTopicReference=!1;try{return X()}finally{this.state.inHackPipelineBody=J,this.state.seenTopicReference=Q}}allowInAnd(X){let J=this.prodParam.currentFlags();if(24&~J){this.prodParam.enter(J|8|16);try{return X()}finally{this.prodParam.exit()}}return X()}disallowInAnd(X){let J=this.prodParam.currentFlags(),Q=8&J,Z=16&~J;if(Q||Z){this.prodParam.enter(J&-9|16);try{return X()}finally{this.prodParam.exit()}}return X()}registerTopicReference(){this.state.seenTopicReference=!0}topicReferenceIsAllowedInCurrentContext(){return this.state.inHackPipelineBody}topicReferenceWasUsedInCurrentContext(){return this.state.seenTopicReference}parseFSharpPipelineBody(X){let J=this.state.startLoc;this.prodParam.enter(this.prodParam.currentFlags()&-17);let Q;if(this.isContextual(92)&&this.recordAwaitIfAllowed()){this.next(),Q=this.parseAwait(J,!0);let Z=this.state.type;if(tF(Z)&&Z!==35&&(this.prodParam.hasIn||Z!==54))this.raise(u.PipelineUnparenthesized,J)}else this.state.canStartArrow=!0,Q=this.parseExprOp(this.parseMaybeUnaryOrPrivate(),J,X);return this.prodParam.exit(),Q}parseModuleExpression(){this.expectPlugin("moduleBlocks");let X=this.startNode();if(this.next(),!this.match(2))this.unexpected(null,2);let J=this.startNodeAt(this.state.endLoc);this.next();let Q=this.initializeScopes(!0);this.enterInitialScopes();try{X.body=this.parseProgram(J,4,"module")}finally{Q()}return this.finishNode(X,"ModuleExpression")}parseVoidPattern(X){this.expectPlugin("discardBinding");let J=this.startNode();if(X!=null)X.voidPatternLoc=this.state.startLoc;return this.next(),this.finishNode(J,"VoidPattern")}parseMaybeAssignAllowInOrVoidPattern(X,J,Q){if(J!=null&&this.match(84)){let Z=this.lookaheadCharCode();if(Z===44||Z===(X===1?93:X===4?125:41)||Z===61)return this.parseMaybeDefault(this.state.startLoc,this.parseVoidPattern(J))}return this.parseMaybeAssignAllowIn(J,Q)}parsePropertyNamePrefixOperator(X){}}var $L={kind:1},OQ0={kind:2},TQ0=/[\uD800-\uDFFF]/u,RL=/in(?:stanceof)?/y;function fP(X){for(let J=0;J<X.length;J++){let Q=X[J],{type:Z}=Q;if(typeof Z==="number")Q.type=MP(Z)}return X}class _P extends vP{parseTopLevel(X,J){if(X.program=this.parseProgram(J,135,this.options.sourceType==="module"?"module":"script"),X.comments=this.comments,this.optionFlags&512)X.tokens=fP(this.tokens);return this.finishNode(X,"File")}parseProgram(X,J,Q){if(X.sourceType=Q,X.interpreter=this.parseInterpreterDirective(),this.parseBlockBody(X,!0,!0,J),this.inModule){if(!(this.optionFlags&64)&&this.scope.undefinedExports.size>0)for(let[G,Y]of Array.from(this.scope.undefinedExports))this.raise(u.ModuleExportUndefined,Y,{localName:G});this.addExtra(X,"topLevelAwait",this.state.hasTopLevelAwait)}let Z;if(J===135)Z=this.finishNode(X,"Program");else Z=this.finishNodeAt(X,"Program",g7(this.state.startLoc,-1));return Z}stmtToDirective(X){let J=this.castNodeTo(X,"Directive"),Q=this.castNodeTo(X.expression,"DirectiveLiteral"),Z=Q.value,G=this.input.slice(this.offsetToSourcePos(Q.start),this.offsetToSourcePos(Q.end)),Y=Q.value=G.slice(1,-1);return this.addExtra(Q,"raw",G),this.addExtra(Q,"rawValue",Y),this.addExtra(Q,"expressionValue",Z),J.value=Q,delete X.expression,J}parseInterpreterDirective(){if(!this.match(24))return null;let X=this.startNode();return X.value=this.state.value,this.next(),this.finishNode(X,"InterpreterDirective")}isLet(){if(!this.isContextual(96))return!1;return this.hasFollowingBindingAtom()}isUsing(){if(!this.isContextual(103))return!1;return this.nextTokenIsIdentifierOnSameLine()}isForUsing(){if(!this.isContextual(103))return!1;let X=this.nextTokenInLineStart(),J=this.codePointAtPos(X);if(this.isUnparsedContextual(X,"of")){let Q=this.lookaheadCharCodeSince(X+2);if(Q!==61&&Q!==58&&Q!==59)return!1}if(this.chStartsBindingIdentifier(J,X)||this.isUnparsedContextual(X,"void"))return!0;return!1}nextTokenIsIdentifierOnSameLine(){let X=this.nextTokenInLineStart(),J=this.codePointAtPos(X);return this.chStartsBindingIdentifier(J,X)}isAwaitUsing(){if(!this.isContextual(92))return!1;let X=this.nextTokenInLineStart();if(this.isUnparsedContextual(X,"using")){X=this.nextTokenInLineStartSince(X+5);let J=this.codePointAtPos(X);if(this.chStartsBindingIdentifier(J,X))return!0}return!1}chStartsBindingIdentifier(X,J){if(u9(X)){if(RL.lastIndex=J,RL.test(this.input)){let Q=this.codePointAtPos(RL.lastIndex);if(!eX(Q)&&Q!==92)return!1}return!0}else if(X===92)return!0;else return!1}chStartsBindingPattern(X){return X===91||X===123}hasFollowingBindingAtom(){let X=this.nextTokenStart(),J=this.codePointAtPos(X);return this.chStartsBindingPattern(J)||this.chStartsBindingIdentifier(J,X)}hasInLineFollowingBindingIdentifierOrBrace(){let X=this.nextTokenInLineStart(),J=this.codePointAtPos(X);return J===123||this.chStartsBindingIdentifier(J,X)}allowsUsing(){return(this.scope.inModule||!this.scope.inTopLevel)&&!this.scope.inBareCaseStatement}parseModuleItem(){return this.parseStatementLike(15)}parseStatementListItem(){return this.parseStatementLike(6|(!this.options.annexB||this.state.strict?0:8))}parseStatementOrSloppyAnnexBFunctionDeclaration(X=!1){let J=0;if(this.options.annexB&&!this.state.strict){if(J|=4,X)J|=8}return this.parseStatementLike(J)}parseStatement(){return this.parseStatementLike(0)}parseStatementLike(X){let J=null;if(this.match(22))J=this.parseDecorators(!0);return this.parseStatementContent(X,J)}parseStatementContent(X,J){let Q=this.state.type,Z=this.startNode(),G=!!(X&2),Y=!!(X&4),V=X&1;switch(Q){case 56:return this.parseBreakContinueStatement(Z,!0);case 59:return this.parseBreakContinueStatement(Z,!1);case 60:return this.parseDebuggerStatement(Z);case 86:return this.parseDoWhileStatement(Z);case 87:return this.parseForStatement(Z);case 64:if(this.lookaheadCharCode()===46)break;if(!Y)this.raise(this.state.strict?u.StrictFunction:this.options.annexB?u.SloppyFunctionAnnexB:u.SloppyFunction,this.state.startLoc);return this.parseFunctionStatement(Z,!1,!G&&Y);case 76:if(!G)this.unexpected();return this.parseClass(this.maybeTakeDecorators(J,Z),!0);case 65:return this.parseIfStatement(Z);case 66:return this.parseReturnStatement(Z);case 67:return this.parseSwitchStatement(Z);case 68:return this.parseThrowStatement(Z);case 69:return this.parseTryStatement(Z);case 92:if(this.isAwaitUsing()){if(!this.allowsUsing())this.raise(u.UnexpectedUsingDeclaration,Z);else if(!G)this.raise(u.UnexpectedLexicalDeclaration,Z);else if(!this.recordAwaitIfAllowed())this.raise(u.AwaitUsingNotInAsyncContext,Z);return this.next(),this.parseVarStatement(Z,"await using")}break;case 103:if(this.state.containsEsc||!this.hasInLineFollowingBindingIdentifierOrBrace())break;if(!this.allowsUsing())this.raise(u.UnexpectedUsingDeclaration,this.state.startLoc);else if(!G)this.raise(u.UnexpectedLexicalDeclaration,this.state.startLoc);return this.parseVarStatement(Z,"using");case 96:{if(this.state.containsEsc)break;let W=this.nextTokenStart(),U=this.codePointAtPos(W);if(U!==91){if(!G&&this.hasFollowingLineBreak())break;if(!this.chStartsBindingIdentifier(U,W)&&U!==123)break}}case 71:if(!G)this.raise(u.UnexpectedLexicalDeclaration,this.state.startLoc);case 70:{let W=this.state.value;return this.parseVarStatement(Z,W)}case 88:return this.parseWhileStatement(Z);case 72:return this.parseWithStatement(Z);case 2:return this.parseBlock();case 9:return this.parseEmptyStatement(Z);case 79:{let W=this.lookaheadCharCode();if(W===40||W===46)break}case 78:{if(!(this.optionFlags&8)&&!V)this.raise(u.UnexpectedImportExport,this.state.startLoc);this.next();let W;if(Q===79)W=this.parseImport(Z);else W=this.parseExport(Z,J);return this.assertModuleNodeAllowed(W),W}default:if(this.isAsyncFunction()){if(!G)this.raise(u.AsyncFunctionInSingleStatementContext,this.state.startLoc);return this.next(),this.parseFunctionStatement(Z,!0,!G&&Y)}}let K=this.state.value,H=this.parseExpression();if(R5(Q)&&H.type==="Identifier"&&this.eat(10))return this.parseLabeledStatement(Z,K,H,X);else return this.parseExpressionStatement(Z,H)}assertModuleNodeAllowed(X){if(!(this.optionFlags&8)&&!this.inModule)this.raise(u.ImportOutsideModule,X)}maybeTakeDecorators(X,J,Q){if(X){if(J.decorators?.length)this.raise(u.DecoratorsBeforeAfterExport,J.decorators[0]),J.decorators.unshift(...X);else J.decorators=X;if(this.resetStartLocationFromNode(J,X[0]),Q)this.resetStartLocationFromNode(Q,J)}return J}canHaveLeadingDecorator(){return this.match(76)}parseDecorators(X){let J=[];do J.push(this.parseDecorator());while(this.match(22));if(this.match(78)){if(!X)this.unexpected()}else if(!this.canHaveLeadingDecorator())throw this.raise(u.UnexpectedLeadingDecorator,this.state.startLoc);return J}parseDecorator(){this.expectOnePlugin(["decorators","decorators-legacy"]);let X=this.startNode();if(this.next(),this.hasPlugin("decorators")){let J=this.state.startLoc,Q;if(this.match(6)){let Z=this.state.startLoc;this.next(),Q=this.parseExpression(),this.expect(7),Q=this.wrapParenthesis(Z,Q);let G=this.state.startLoc;if(X.expression=this.parseMaybeDecoratorArguments(Q,Z),X.expression!==Q)this.raise(u.DecoratorArgumentsOutsideParentheses,G)}else{Q=this.parseIdentifier(!1);while(this.eat(12)){let Z=this.startNodeAt(J);if(Z.object=Q,this.match(134))this.classScope.usePrivateName(this.state.value,this.state.startLoc),Z.property=this.parsePrivateName();else Z.property=this.parseIdentifier(!0);Z.computed=!1,Q=this.finishNode(Z,"MemberExpression")}X.expression=this.parseMaybeDecoratorArguments(Q,J)}}else this.state.canStartArrow=!1,X.expression=this.parseExprSubscripts();return this.finishNode(X,"Decorator")}parseMaybeDecoratorArguments(X,J){if(this.eat(6)){let Q=this.startNodeAt(J);return Q.callee=X,Q.arguments=this.parseCallExpressionArguments(),this.toReferencedList(Q.arguments),this.finishNode(Q,"CallExpression")}return X}parseBreakContinueStatement(X,J){if(this.next(),this.isLineTerminator())X.label=null;else X.label=this.parseIdentifier(),this.semicolon();return this.verifyBreakContinue(X,J),this.finishNode(X,J?"BreakStatement":"ContinueStatement")}verifyBreakContinue(X,J){let Q;for(Q=0;Q<this.state.labels.length;++Q){let Z=this.state.labels[Q];if(X.label==null||Z.name===X.label.name){if(Z.kind!=null&&(J||Z.kind===1))break;if(X.label&&J)break}}if(Q===this.state.labels.length){let Z=J?"BreakStatement":"ContinueStatement";this.raise(u.IllegalBreakContinue,X,{type:Z})}}parseDebuggerStatement(X){return this.next(),this.semicolon(),this.finishNode(X,"DebuggerStatement")}parseHeaderExpression(){this.expect(6);let X=this.parseExpression();return this.expect(7),X}parseDoWhileStatement(X){return this.next(),this.state.labels.push($L),X.body=this.parseStatement(),this.state.labels.pop(),this.expect(88),X.test=this.parseHeaderExpression(),this.eat(9),this.finishNode(X,"DoWhileStatement")}parseForStatement(X){this.next(),this.state.labels.push($L);let J=null;if(this.isContextual(92)&&this.recordAwaitIfAllowed())J=this.state.startLoc,this.next();if(this.scope.enter(0),this.expect(6),this.match(9)){if(J!==null)this.unexpected(J);return this.parseFor(X,null)}let Q=this.isContextual(96);{let K=this.isAwaitUsing(),H=K||this.isForUsing(),W=Q&&this.hasFollowingBindingAtom()||H;if(this.match(70)||this.match(71)||W){let U=this.startNode(),z;if(K){if(z="await using",!this.recordAwaitIfAllowed())this.raise(u.AwaitUsingNotInAsyncContext,this.state.startLoc);this.next()}else z=this.state.value;this.next(),this.parseVar(U,!0,z);let q=this.finishNode(U,"VariableDeclaration"),B=this.match(54);if(B&&H)this.raise(u.ForInUsing,q);if((B||this.isContextual(98))&&q.declarations.length===1)return this.parseForX(X,q,J);if(J!==null)this.unexpected(J);return this.parseFor(X,q)}}let Z=this.isContextual(91),G=new AG,Y=this.parseExpression(!0,G),V=this.isContextual(98);if(V){if(Q)this.raise(u.ForOfLet,Y);if(J===null&&Z&&Y.type==="Identifier")this.raise(u.ForOfAsync,Y)}if(V||this.match(54)){this.checkDestructuringPrivate(G),this.toAssignable(Y,!0);let K=V?"ForOfStatement":"ForInStatement";return this.checkLVal(Y,{type:K}),this.parseForX(X,Y,J)}else this.checkExpressionErrors(G,!0);if(J!==null)this.unexpected(J);return this.parseFor(X,Y)}parseFunctionStatement(X,J,Q){return this.next(),this.parseFunction(X,1|(Q?2:0)|(J?8:0))}parseIfStatement(X){return this.next(),X.test=this.parseHeaderExpression(),X.consequent=this.parseStatementOrSloppyAnnexBFunctionDeclaration(),X.alternate=this.eat(62)?this.parseStatementOrSloppyAnnexBFunctionDeclaration():null,this.finishNode(X,"IfStatement")}parseReturnStatement(X){if(!this.prodParam.hasReturn)this.raise(u.IllegalReturn,this.state.startLoc);if(this.next(),this.isLineTerminator())X.argument=null;else X.argument=this.parseExpression(),this.semicolon();return this.finishNode(X,"ReturnStatement")}parseSwitchStatement(X){this.next(),X.discriminant=this.parseHeaderExpression();let J=X.cases=[];this.expect(2),this.state.labels.push(OQ0),this.scope.enter(256);let Q;for(let Z;!this.match(4);)if(this.match(57)||this.match(61)){let G=this.match(57);if(Q)this.finishNode(Q,"SwitchCase");if(J.push(Q=this.startNode()),Q.consequent=[],this.next(),G)Q.test=this.parseExpression();else{if(Z)this.raise(u.MultipleDefaultsInSwitch,this.state.lastTokStartLoc);Z=!0,Q.test=null}this.expect(10)}else if(Q)Q.consequent.push(this.parseStatementListItem());else this.unexpected();if(this.scope.exit(),Q)this.finishNode(Q,"SwitchCase");return this.next(),this.state.labels.pop(),this.finishNode(X,"SwitchStatement")}parseThrowStatement(X){if(this.next(),this.hasPrecedingLineBreak())this.raise(u.NewlineAfterThrow,this.state.lastTokEndLoc);return X.argument=this.parseExpression(),this.semicolon(),this.finishNode(X,"ThrowStatement")}parseCatchClauseParam(){let X=this.parseBindingAtom();return this.scope.enter(this.options.annexB&&X.type==="Identifier"?8:0),this.checkLVal(X,{type:"CatchClause"},9),X}parseTryStatement(X){if(this.next(),X.block=this.parseBlock(),X.handler=null,this.match(58)){let J=this.startNode();if(this.next(),this.match(6))this.expect(6),J.param=this.parseCatchClauseParam(),this.expect(7);else J.param=null,this.scope.enter(0);J.body=this.parseBlock(!1,!1),this.scope.exit(),X.handler=this.finishNode(J,"CatchClause")}if(X.finalizer=this.eat(63)?this.parseBlock():null,!X.handler&&!X.finalizer)this.raise(u.NoCatchOrFinally,X);return this.finishNode(X,"TryStatement")}parseVarStatement(X,J,Q=!1){return this.next(),this.parseVar(X,!1,J,Q),this.semicolon(),this.finishNode(X,"VariableDeclaration")}parseWhileStatement(X){return this.next(),X.test=this.parseHeaderExpression(),this.state.labels.push($L),X.body=this.parseStatement(),this.state.labels.pop(),this.finishNode(X,"WhileStatement")}parseWithStatement(X){if(this.state.strict)this.raise(u.StrictWith,this.state.startLoc);return this.next(),X.object=this.parseHeaderExpression(),X.body=this.parseStatement(),this.finishNode(X,"WithStatement")}parseEmptyStatement(X){return this.next(),this.finishNode(X,"EmptyStatement")}parseLabeledStatement(X,J,Q,Z){for(let Y of this.state.labels)if(Y.name===J)this.raise(u.LabelRedeclaration,Q,{labelName:J});let G=v10(this.state.type)?1:this.match(67)?2:null;for(let Y=this.state.labels.length-1;Y>=0;Y--){let V=this.state.labels[Y];if(V.statementStart===X.start)V.statementStart=this.sourceToOffsetPos(this.state.start),V.kind=G;else break}return this.state.labels.push({name:J,kind:G,statementStart:this.sourceToOffsetPos(this.state.start)}),X.body=Z&8?this.parseStatementOrSloppyAnnexBFunctionDeclaration(!0):this.parseStatement(),this.state.labels.pop(),X.label=Q,this.finishNode(X,"LabeledStatement")}parseExpressionStatement(X,J){return X.expression=J,this.semicolon(),this.finishNode(X,"ExpressionStatement")}parseBlock(X=!1,J=!0,Q){let Z=this.startNode();if(X)this.state.strictErrors.clear();if(this.expect(2),J)this.scope.enter(0);if(this.parseBlockBody(Z,X,!1,4,Q),J)this.scope.exit();return this.finishNode(Z,"BlockStatement")}isValidDirective(X){return X.type==="ExpressionStatement"&&X.expression.type==="StringLiteral"&&!X.expression.extra.parenthesized}parseBlockBody(X,J,Q,Z,G){let Y=X.body=[],V=X.directives=[];this.parseBlockOrModuleBlockBody(Y,J?V:void 0,Q,Z,G)}parseBlockOrModuleBlockBody(X,J,Q,Z,G){let Y=this.state.strict,V=!1,K=!1;while(!this.match(Z)){let H=Q?this.parseModuleItem():this.parseStatementListItem();if(J&&!K){if(this.isValidDirective(H)){let W=this.stmtToDirective(H);if(J.push(W),!V&&W.value.value==="use strict")V=!0,this.setStrict(!0);continue}K=!0,this.state.strictErrors.clear()}X.push(H)}if(G?.call(this,V),!Y)this.setStrict(!1);this.next()}parseFor(X,J){return X.init=J,this.semicolon(!1),X.test=this.match(9)?null:this.parseExpression(),this.semicolon(!1),X.update=this.match(7)?null:this.parseExpression(),this.expect(7),X.body=this.parseStatement(),this.scope.exit(),this.state.labels.pop(),this.finishNode(X,"ForStatement")}parseForX(X,J,Q){let Z=this.match(54);if(this.next(),Z){if(Q!==null)this.unexpected(Q)}else X.await=Q!==null;if(J.type==="VariableDeclaration"&&J.declarations[0].init!=null&&(!Z||!this.options.annexB||this.state.strict||J.kind!=="var"||J.declarations[0].id.type!=="Identifier"))this.raise(u.ForInOfLoopInitializer,J,{type:Z?"ForInStatement":"ForOfStatement"});if(J.type==="AssignmentPattern")this.raise(u.InvalidLhs,J,{ancestor:{type:"ForStatement"}});return X.left=J,X.right=Z?this.parseExpression():this.parseMaybeAssignAllowIn(),this.expect(7),X.body=this.parseStatement(),this.scope.exit(),this.state.labels.pop(),this.finishNode(X,Z?"ForInStatement":"ForOfStatement")}parseVar(X,J,Q,Z=!1){let G=X.declarations=[];X.kind=Q;for(;;){let Y=this.startNode();if(this.parseVarId(Y,Q),Y.init=!this.eat(25)?null:J?this.parseMaybeAssignDisallowIn():this.parseMaybeAssignAllowIn(),Y.init===null&&!Z){if(Y.id.type!=="Identifier"&&!(J&&(this.match(54)||this.isContextual(98))))this.raise(u.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:"destructuring"});else if((Q==="const"||Q==="using"||Q==="await using")&&!(this.match(54)||this.isContextual(98)))this.raise(u.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:Q})}if(G.push(this.finishNode(Y,"VariableDeclarator")),!this.eat(8))break}return X}parseVarId(X,J){let Q=this.parseBindingAtom();if(J==="using"||J==="await using"){if(Q.type==="ArrayPattern"||Q.type==="ObjectPattern")this.raise(u.UsingDeclarationHasBindingPattern,Q)}else if(Q.type==="VoidPattern")this.raise(u.UnexpectedVoidPattern,Q);this.checkLVal(Q,{type:"VariableDeclarator"},J==="var"?5:8201),X.id=Q}parseAsyncFunctionExpression(X){return this.parseFunction(X,8)}parseFunction(X,J=0){let Q=J&2,Z=!!(J&1),G=Z&&!(J&4),Y=!!(J&8);if(this.initFunction(X,Y),this.match(51)){if(Q)this.raise(u.GeneratorInSingleStatementContext,this.state.startLoc);this.next(),X.generator=!0}if(Z)X.id=this.parseFunctionId(G);if(this.scope.enter(514),this.prodParam.enter(_W(Y,X.generator)),!Z&&R5(this.state.type))this.expressionScope.enter(wL()),X.id=this.parseFunctionId(),this.expressionScope.exit();if(this.parseFunctionParams(X,!1),this.parseFunctionBodyAndFinish(X,Z?"FunctionDeclaration":"FunctionExpression"),this.prodParam.exit(),this.scope.exit(),Z&&!Q)this.registerFunctionStatementId(X);return X}parseFunctionId(X){return X||R5(this.state.type)?this.parseIdentifier():null}parseFunctionParams(X,J){this.expect(6),this.expressionScope.enter(MQ0()),X.params=this.parseBindingList(7,41,2|(J?4:0)),this.expressionScope.exit()}registerFunctionStatementId(X){if(!X.id)return;this.scope.declareName(X.id.name,!this.options.annexB||this.state.strict||X.generator||X.async?this.scope.treatFunctionsAsVar?5:8201:17,X.id.start)}parseClass(X,J,Q){this.next();let Z=this.state.strict;return this.state.strict=!0,this.parseClassId(X,J,Q),this.parseClassSuper(X),X.body=this.parseClassBody(!!X.superClass,Z),this.finishNode(X,J?"ClassDeclaration":"ClassExpression")}isClassProperty(){return this.match(25)||this.match(9)||this.match(4)}isClassMethod(){return this.match(6)}nameIsConstructor(X){return X.type==="Identifier"&&X.name==="constructor"||X.type==="StringLiteral"&&X.value==="constructor"}isNonstaticConstructor(X){return!X.computed&&!X.static&&this.nameIsConstructor(X.key)}parseClassBody(X,J){this.classScope.enter();let Q={hadConstructor:!1,hadSuperClass:X},Z=[],G=this.startNode();G.body=[],this.expect(2);while(!this.match(4)){if(this.eat(9)){if(Z.length>0)throw this.raise(u.DecoratorSemicolon,this.state.lastTokEndLoc);continue}if(this.match(22)){Z.push(this.parseDecorator());continue}let Y=this.startNode();if(Z.length)Y.decorators=Z,this.resetStartLocationFromNode(Y,Z[0]),Z=[];this.parseClassMember(G,Y,Q)}if(this.state.strict=J,this.next(),Z.length)throw this.raise(u.TrailingDecorator,this.state.startLoc);return this.classScope.exit(),this.finishNode(G,"ClassBody")}parseClassMemberFromModifier(X,J){let Q=this.parseIdentifier(!0);if(this.isClassMethod()){let Z=J;return Z.kind="method",Z.computed=!1,Z.key=Q,Z.static=!1,this.pushClassMethod(X,Z,!1,!1,!1,!1),!0}else if(this.isClassProperty()){let Z=J;return Z.computed=!1,Z.key=Q,Z.static=!1,X.body.push(this.parseClassProperty(Z)),!0}return this.resetPreviousNodeTrailingComments(Q),!1}parseClassMember(X,J,Q){let Z=this.isContextual(102);if(Z){if(this.parseClassMemberFromModifier(X,J))return;if(this.eat(2)){this.parseClassStaticBlock(X,J);return}}this.parseClassMemberWithIsStatic(X,J,Q,Z)}parseClassMemberWithIsStatic(X,J,Q,Z){let G=J,Y=J,V=J,K=J,H=J,W=G,U=G;if(J.static=Z,this.parsePropertyNamePrefixOperator(J),this.eat(51)){W.kind="method";let T=this.match(134);if(this.parseClassElementName(W),this.parsePostMemberNameModifiers(W),T){this.pushClassPrivateMethod(X,Y,!0,!1);return}if(this.isNonstaticConstructor(G))this.raise(u.ConstructorIsGenerator,G.key);this.pushClassMethod(X,G,!0,!1,!1,!1);return}let z=!this.state.containsEsc&&R5(this.state.type),q=this.parseClassElementName(J),B=z?q.name:null,M=this.isPrivateName(q),L=this.state.startLoc;if(this.parsePostMemberNameModifiers(U),this.isClassMethod()){if(W.kind="method",M){this.pushClassPrivateMethod(X,Y,!1,!1);return}let T=this.isNonstaticConstructor(G),O=!1;if(T){if(G.kind="constructor",G.decorators&&G.decorators.length>0)this.raise(u.DecoratorConstructor,J);if(Q.hadConstructor&&!this.hasPlugin("typescript"))this.raise(u.DuplicateConstructor,q);if(T&&this.hasPlugin("typescript")&&J.override)this.raise(u.OverrideOnConstructor,q);Q.hadConstructor=!0,O=Q.hadSuperClass}this.pushClassMethod(X,G,!1,!1,T,O)}else if(this.isClassProperty())if(M)this.pushClassPrivateProperty(X,K);else this.pushClassProperty(X,V);else if(B==="async"&&!this.isLineTerminator()){this.resetPreviousNodeTrailingComments(q);let T=this.eat(51);if(U.optional)this.unexpected(L);W.kind="method";let O=this.match(134);if(this.parseClassElementName(W),this.parsePostMemberNameModifiers(U),O)this.pushClassPrivateMethod(X,Y,T,!0);else{if(this.isNonstaticConstructor(G))this.raise(u.ConstructorIsAsync,G.key);this.pushClassMethod(X,G,T,!0,!1,!1)}}else if((B==="get"||B==="set")&&!(this.match(51)&&this.isLineTerminator())){this.resetPreviousNodeTrailingComments(q),W.kind=B;let T=this.match(134);if(this.parseClassElementName(G),T)this.pushClassPrivateMethod(X,Y,!1,!1);else{if(this.isNonstaticConstructor(G))this.raise(u.ConstructorIsAccessor,G.key);this.pushClassMethod(X,G,!1,!1,!1,!1)}this.checkGetterSetterParams(G)}else if(B==="accessor"&&!this.isLineTerminator()){this.expectPlugin("decoratorAutoAccessors"),this.resetPreviousNodeTrailingComments(q);let T=this.match(134);this.parseClassElementName(V),this.pushClassAccessorProperty(X,H,T)}else if(this.isLineTerminator())if(M)this.pushClassPrivateProperty(X,K);else this.pushClassProperty(X,V);else this.unexpected()}parseClassElementName(X){let{type:J,value:Q}=this.state;if((J===128||J===130)&&X.static&&Q==="prototype")this.raise(u.StaticPrototype,this.state.startLoc);if(J===134){if(Q==="constructor")this.raise(u.ConstructorClassPrivateField,this.state.startLoc);let Z=this.parsePrivateName();return X.key=Z,Z}return this.parsePropertyName(X),X.key}parseClassStaticBlock(X,J){this.scope.enter(720);let Q=this.state.labels;this.state.labels=[],this.prodParam.enter(0);let Z=J.body=[];if(this.parseBlockOrModuleBlockBody(Z,void 0,!1,4),this.prodParam.exit(),this.scope.exit(),this.state.labels=Q,X.body.push(this.finishNode(J,"StaticBlock")),J.decorators?.length)this.raise(u.DecoratorStaticBlock,J)}pushClassProperty(X,J){if(!J.computed&&this.nameIsConstructor(J.key))this.raise(u.ConstructorClassField,J.key);X.body.push(this.parseClassProperty(J))}pushClassPrivateProperty(X,J){let Q=this.parseClassPrivateProperty(J);X.body.push(Q),this.classScope.declarePrivateName(this.getPrivateNameSV(Q.key),0,Q.key.start)}pushClassAccessorProperty(X,J,Q){if(!Q&&!J.computed&&this.nameIsConstructor(J.key))this.raise(u.ConstructorClassField,J.key);let Z=this.parseClassAccessorProperty(J);if(X.body.push(Z),Q)this.classScope.declarePrivateName(this.getPrivateNameSV(Z.key),0,Z.key.start)}pushClassMethod(X,J,Q,Z,G,Y){X.body.push(this.parseMethod(J,Q,Z,G,Y,"ClassMethod",!0))}pushClassPrivateMethod(X,J,Q,Z){let G=this.parseMethod(J,Q,Z,!1,!1,"ClassPrivateMethod",!0);X.body.push(G);let Y=G.kind==="get"?G.static?6:2:G.kind==="set"?G.static?5:1:0;this.declareClassPrivateMethodInScope(G,Y)}declareClassPrivateMethodInScope(X,J){this.classScope.declarePrivateName(this.getPrivateNameSV(X.key),J,X.key.start)}parsePostMemberNameModifiers(X){}parseClassPrivateProperty(X){return this.parseInitializer(X),this.semicolon(),this.finishNode(X,"ClassPrivateProperty")}parseClassProperty(X){return this.parseInitializer(X),this.semicolon(),this.finishNode(X,"ClassProperty")}parseClassAccessorProperty(X){return this.parseInitializer(X),this.semicolon(),this.finishNode(X,"ClassAccessorProperty")}parseInitializer(X){this.scope.enter(592),this.expressionScope.enter(wL()),this.prodParam.enter(0),X.value=this.eat(25)?this.parseMaybeAssignAllowIn():null,this.expressionScope.exit(),this.prodParam.exit(),this.scope.exit()}parseClassId(X,J,Q,Z=8331){if(R5(this.state.type)){if(X.id=this.parseIdentifier(),J)this.declareNameFromIdentifier(X.id,Z)}else if(Q||!J)X.id=null;else throw this.raise(u.MissingClassName,this.state.startLoc)}parseClassSuper(X){if(this.eat(77))this.state.canStartArrow=!1,X.superClass=this.parseExprSubscripts();else X.superClass=null}parseExport(X,J){let Q=this.parseMaybeImportPhase(X,!0),Z=this.maybeParseExportDefaultSpecifier(X,Q),G=!Z||this.eat(8),Y=G&&this.eatExportStar(X),V=Y&&this.maybeParseExportNamespaceSpecifier(X),K=G&&(!V||this.eat(8)),H=Z||Y;if(Y&&!V){if(Z)this.unexpected();if(J)throw this.raise(u.UnsupportedDecoratorExport,X);return this.parseExportFrom(X,!0),this.sawUnambiguousESM=!0,this.finishNode(X,"ExportAllDeclaration")}let W=this.maybeParseExportNamedSpecifiers(X);if(Z&&G&&!Y&&!W)this.unexpected(null,2);if(V&&K)this.unexpected(null,94);let U;if(H||W){if(U=!1,J)throw this.raise(u.UnsupportedDecoratorExport,X);this.parseExportFrom(X,H)}else U=this.maybeParseExportDeclaration(X);if(H||W||U){let z=X;if(this.checkNamedExport(z,!!z.source),z.declaration?.type==="ClassDeclaration")this.maybeTakeDecorators(J,z.declaration,z);else if(J)throw this.raise(u.UnsupportedDecoratorExport,X);return this.sawUnambiguousESM=!0,this.finishNode(z,"ExportNamedDeclaration")}if(this.eat(61)){let z=X,q=this.parseExportDefaultExpression();if(z.declaration=q,q.type==="ClassDeclaration")this.maybeTakeDecorators(J,q,z);else if(J)throw this.raise(u.UnsupportedDecoratorExport,X);if(this.checkDuplicateExports(X,"default"),this.hasPlugin("exportDefaultFrom")){if(q.type==="Identifier"&&q.name==="from"&&q.end-q.start===4&&!q.extra?.parenthesized)this.raise(u.ExportDefaultFromAsIdentifier,q)}return this.sawUnambiguousESM=!0,this.finishNode(z,"ExportDefaultDeclaration")}throw this.unexpected(null,2)}eatExportStar(X){return this.eat(51)}maybeParseExportDefaultSpecifier(X,J){if(J||this.isExportDefaultSpecifier()){this.expectPlugin("exportDefaultFrom",J?.start);let Q=J||this.parseIdentifier(!0),Z=this.startNodeAtNode(Q);return Z.exported=Q,X.specifiers=[this.finishNode(Z,"ExportDefaultSpecifier")],!0}return!1}maybeParseExportNamespaceSpecifier(X){if(this.isContextual(89)){X.specifiers??=[];let J=this.startNodeAt(this.state.lastTokStartLoc);return this.next(),J.exported=this.parseModuleExportName(),X.specifiers.push(this.finishNode(J,"ExportNamespaceSpecifier")),!0}return!1}maybeParseExportNamedSpecifiers(X){if(this.match(2)){let J=X;if(!J.specifiers)J.specifiers=[];let Q=J.exportKind==="type";return J.specifiers.push(...this.parseExportSpecifiers(Q)),J.source=null,J.attributes=[],J.declaration=null,!0}return!1}maybeParseExportDeclaration(X){if(this.shouldParseExportDeclaration())return X.specifiers=[],X.source=null,X.attributes=[],X.declaration=this.parseExportDeclaration(X),!0;return!1}isAsyncFunction(){if(!this.isContextual(91))return!1;let X=this.nextTokenInLineStart();return this.isUnparsedContextual(X,"function")}parseExportDefaultExpression(){let X=this.startNode();if(this.match(64))return this.next(),this.parseFunction(X,5);else if(this.isAsyncFunction())return this.next(),this.next(),this.parseFunction(X,13);if(this.match(76))return this.parseClass(X,!0,!0);if(this.match(22))return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(!1),this.startNode()),!0,!0);if(this.match(71)||this.match(70)||this.isLet()||this.isUsing()||this.isAwaitUsing())throw this.raise(u.UnsupportedDefaultExport,this.state.startLoc);let J=this.parseMaybeAssignAllowIn();return this.semicolon(),J}parseExportDeclaration(X){if(this.match(76))return this.parseClass(this.startNode(),!0,!1);return this.parseStatementListItem()}isExportDefaultSpecifier(){let{type:X}=this.state;if(R5(X)){if(X===91&&!this.state.containsEsc||X===96)return!1;if((X===126||X===125)&&!this.state.containsEsc){let Z=this.nextTokenStart(),G=this.input.charCodeAt(Z);if(G===123||this.chStartsBindingIdentifier(G,Z)&&!this.input.startsWith("from",Z))return this.expectOnePlugin(["flow","typescript"]),!1}}else if(!this.match(61))return!1;let J=this.nextTokenStart(),Q=this.isUnparsedContextual(J,"from");if(this.input.charCodeAt(J)===44||R5(this.state.type)&&Q)return!0;if(this.match(61)&&Q){let Z=this.input.charCodeAt(this.nextTokenStartSince(J+4));return Z===34||Z===39}return!1}parseExportFrom(X,J){if(this.eatContextual(94))X.source=this.parseImportSource(),this.maybeParseImportAttributes(X);else if(J)this.unexpected();this.semicolon()}shouldParseExportDeclaration(){let{type:X}=this.state;if(X===22){if(this.expectOnePlugin(["decorators","decorators-legacy"]),this.hasPlugin("decorators"))return!0}if(this.isUsing())return this.raise(u.UsingDeclarationExport,this.state.startLoc),!0;if(this.isAwaitUsing())return this.raise(u.UsingDeclarationExport,this.state.startLoc),!0;return X===70||X===71||X===64||X===76||this.isLet()||this.isAsyncFunction()}checkNamedExport(X,J){if(X.specifiers?.length)for(let Q of X.specifiers){let{exported:Z}=Q,G=Z.type==="Identifier"?Z.name:Z.value;if(this.checkDuplicateExports(Q,G),!J&&Q.type==="ExportSpecifier"){let{local:Y}=Q;if(Y.type!=="Identifier")this.raise(u.ExportBindingIsString,Q,{localName:Y.value,exportName:G});else this.checkReservedWord(Y.name,Y.start,!0,!1),this.scope.checkLocalExport(Y)}}else if(X.declaration){let Q=X.declaration;if(Q.type==="FunctionDeclaration"||Q.type==="ClassDeclaration"){let{id:Z}=Q;if(!Z)throw Error("Assertion failure");this.checkDuplicateExports(X,Z.name)}else if(Q.type==="VariableDeclaration")for(let Z of Q.declarations)this.checkDeclaration(Z.id)}}checkDeclaration(X){if(X.type==="Identifier")this.checkDuplicateExports(X,X.name);else if(X.type==="ObjectPattern")for(let J of X.properties)this.checkDeclaration(J);else if(X.type==="ArrayPattern"){for(let J of X.elements)if(J)this.checkDeclaration(J)}else if(X.type==="ObjectProperty")this.checkDeclaration(X.value);else if(X.type==="RestElement")this.checkDeclaration(X.argument);else if(X.type==="AssignmentPattern")this.checkDeclaration(X.left)}checkDuplicateExports(X,J){if(this.exportedIdentifiers.has(J))if(J==="default")this.raise(u.DuplicateDefaultExport,X);else this.raise(u.DuplicateExport,X,{exportName:J});this.exportedIdentifiers.add(J)}parseExportSpecifiers(X){let J=[],Q=!0;this.expect(2);while(!this.eat(4)){if(Q)Q=!1;else if(this.expect(8),this.eat(4))break;let Z=this.isContextual(126),G=this.match(130),Y=this.startNode();Y.local=this.parseModuleExportName(),J.push(this.parseExportSpecifier(Y,G,X,Z))}return J}parseExportSpecifier(X,J,Q,Z){if(this.eatContextual(89))X.exported=this.parseModuleExportName();else if(J)X.exported=this.cloneStringLiteral(X.local);else if(!X.exported)X.exported=this.cloneIdentifier(X.local);return this.finishNode(X,"ExportSpecifier")}parseModuleExportName(){if(this.match(130)){let X=this.parseStringLiteral(this.state.value),J=TQ0.exec(X.value);if(J)this.raise(u.ModuleExportNameHasLoneSurrogate,X,{surrogateCharCode:J[0].charCodeAt(0)});return X}return this.parseIdentifier(!0)}checkImportPhase(X){let{specifiers:J}=X,Q=J.length===1?J[0].type:null;if(X.phase==="source"){if(Q!=="ImportDefaultSpecifier")this.raise(u.SourcePhaseImportRequiresDefault,J[0])}else if(X.phase==="defer"){if(Q!=="ImportNamespaceSpecifier")this.raise(u.DeferImportRequiresNamespace,J[0])}}isPotentialImportPhase(X){if(X)return!1;return this.isContextual(101)||this.isContextual(93)}applyImportPhase(X,J,Q,Z){if(J)return;if(Q==="source")this.expectPlugin("sourcePhaseImports",Z),X.phase="source";else if(Q==="defer")this.expectPlugin("deferredImportEvaluation",Z),X.phase="defer";else if(this.hasPlugin("sourcePhaseImports"))X.phase=null}parseMaybeImportPhase(X,J){if(!this.isPotentialImportPhase(J))return this.applyImportPhase(X,J,null),null;let Q=this.startNode(),Z=this.parseIdentifierName(!0),{type:G}=this.state;if(s8(G)?G!==94||this.lookaheadCharCode()===102:G!==8)return this.applyImportPhase(X,J,Z,Q.start),null;else return this.applyImportPhase(X,J,null),this.createIdentifier(Q,Z)}isPrecedingIdImportPhase(X){let{type:J}=this.state;return R5(J)?J!==94||this.lookaheadCharCode()===102:J!==8}parseImport(X){if(this.match(130))return this.parseImportSourceAndAttributes(X);return this.parseImportSpecifiersAndAfter(X,this.parseMaybeImportPhase(X,!1))}parseImportSpecifiersAndAfter(X,J){X.specifiers=[];let Z=!this.maybeParseDefaultImportSpecifier(X,J)||this.eat(8),G=Z&&this.maybeParseStarImportSpecifier(X);if(Z&&!G)this.parseNamedImportSpecifiers(X);return this.expectContextual(94),this.parseImportSourceAndAttributes(X)}parseImportSourceAndAttributes(X){return X.specifiers??=[],X.source=this.parseImportSource(),this.maybeParseImportAttributes(X),this.checkImportPhase(X),this.semicolon(),this.sawUnambiguousESM=!0,this.finishNode(X,"ImportDeclaration")}parseImportSource(){if(!this.match(130))this.unexpected();return this.parseExprAtom()}parseImportSpecifierLocal(X,J,Q){J.local=this.parseIdentifier(),X.specifiers.push(this.finishImportSpecifier(J,Q))}finishImportSpecifier(X,J,Q=8201){return this.checkLVal(X.local,{type:J},Q),this.finishNode(X,J)}parseImportAttributes(){this.expect(2);let X=[],J=new Set;do{if(this.match(4))break;let Q=this.startNode(),Z=this.state.value;if(J.has(Z))this.raise(u.ModuleAttributesWithDuplicateKeys,this.state.startLoc,{key:Z});if(J.add(Z),this.match(130))Q.key=this.parseStringLiteral(Z);else Q.key=this.parseIdentifier(!0);if(this.expect(10),!this.match(130))throw this.raise(u.ModuleAttributeInvalidValue,this.state.startLoc);Q.value=this.parseStringLiteral(this.state.value),X.push(this.finishNode(Q,"ImportAttribute"))}while(this.eat(8));return this.expect(4),X}maybeParseImportAttributes(X){let J;if(this.match(72)){if(this.hasPrecedingLineBreak()&&this.lookaheadCharCode()===40)return;this.next(),J=this.parseImportAttributes()}else J=[];X.attributes=J}maybeParseDefaultImportSpecifier(X,J){if(J){let Q=this.startNodeAtNode(J);return Q.local=J,X.specifiers.push(this.finishImportSpecifier(Q,"ImportDefaultSpecifier")),!0}else if(s8(this.state.type))return this.parseImportSpecifierLocal(X,this.startNode(),"ImportDefaultSpecifier"),!0;return!1}maybeParseStarImportSpecifier(X){if(this.match(51)){let J=this.startNode();return this.next(),this.expectContextual(89),this.parseImportSpecifierLocal(X,J,"ImportNamespaceSpecifier"),!0}return!1}parseNamedImportSpecifiers(X){let J=!0;this.expect(2);while(!this.eat(4)){if(J)J=!1;else{if(this.eat(10))throw this.raise(u.DestructureNamedImport,this.state.startLoc);if(this.expect(8),this.eat(4))break}let Q=this.startNode(),Z=this.match(130),G=this.isContextual(126);Q.imported=this.parseModuleExportName();let Y=this.parseImportSpecifier(Q,Z,X.importKind==="type"||X.importKind==="typeof",G,void 0);X.specifiers.push(Y)}}parseImportSpecifier(X,J,Q,Z,G){if(this.eatContextual(89))X.local=this.parseIdentifier();else{let{imported:Y}=X;if(J)throw this.raise(u.ImportBindingIsString,X,{importName:Y.value});if(this.checkReservedWord(Y.name,X.start,!0,!0),!X.local)X.local=this.cloneIdentifier(Y)}return this.finishImportSpecifier(X,"ImportSpecifier",G)}isThisParam(X){return X.type==="Identifier"&&X.name==="this"}}var AL=/in(?:stanceof)?|as|satisfies/y;function IQ0(X){if(X==null)throw Error(`Unexpected ${X} value.`);return X}function VP(X){if(!X)throw Error("Assert fail")}var jQ0={AbstractMethodHasImplementation:({methodName:X})=>`Method '${X}' cannot have an implementation because it is marked abstract.`,AbstractPropertyHasInitializer:({propertyName:X})=>`Property '${X}' cannot have an initializer because it is marked abstract.`,AccessorCannotBeOptional:"An 'accessor' property cannot be declared optional.",AccessorCannotDeclareThisParameter:"'get' and 'set' accessors cannot declare 'this' parameters.",AccessorCannotHaveTypeParameters:"An accessor cannot have type parameters.",ClassMethodHasDeclare:"Class methods cannot have the 'declare' modifier.",ClassMethodHasReadonly:"Class methods cannot have the 'readonly' modifier.",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",ConstructorHasTypeParameters:"Type parameters cannot appear on a constructor declaration.",DeclaratorDefiniteAssertionRequiresTypeAnnotation:"Declarations with definite assignment assertions must also have type annotations.",DeclaratorDefiniteAssertionWithInitializer:"Declarations with initializers cannot also have definite assignment assertions.",DeclareAccessor:({kind:X})=>`'declare' is not allowed in ${X}ters.`,DeclareClassFieldHasInitializer:"Initializers are not allowed in ambient contexts.",DeclareFunctionHasImplementation:"An implementation cannot be declared in ambient contexts.",DecoratorAbstractMethod:({kind:X})=>`Decorators can't be used with ${X.startsWith("a")?"an":"a"} ${X}.`,DuplicateAccessibilityModifier:({modifier:X})=>`Accessibility modifier already seen: '${X}'.`,DuplicateModifier:({modifier:X})=>`Duplicate modifier: '${X}'.`,EmptyHeritageClauseType:({token:X})=>`'${X}' list cannot be empty.`,EmptyNamespaceName:"Namespace must be given a name.",EmptyTypeArguments:"Type argument list cannot be empty.",EmptyTypeParameters:"Type parameter list cannot be empty.",ExpectedAmbientAfterExportDeclare:"'export declare' must be followed by an ambient declaration.",ExportAssignmentInTSNamespace:"An export assignment cannot be used in a namespace.",ExportInTSNamespace:"Export declarations are not permitted in a namespace.",ImportAliasHasImportType:"An import alias can not use 'import type'.",ImportInTSNamespace:"Import declarations in a namespace cannot reference a module.",IncompatibleModifiers:({modifiers:X})=>`'${X[0]}' modifier cannot be used with '${X[1]}' modifier.`,IndexSignatureHasAbstract:"Index signatures cannot have the 'abstract' modifier.",IndexSignatureHasAccessibility:({modifier:X})=>`Index signatures cannot have an accessibility modifier ('${X}').`,IndexSignatureHasDeclare:"Index signatures cannot have the 'declare' modifier.",IndexSignatureHasOverride:"'override' modifier cannot appear on an index signature.",IndexSignatureHasStatic:"Index signatures cannot have the 'static' modifier.",InitializerNotAllowedInAmbientContext:"Initializers are not allowed in ambient contexts.",InlineModuleDeclarationMustUseString:"`module ... {}` declarations must have a string name. Use `namespace ... {}` instead.",InvalidHeritageClauseType:({token:X})=>`'${X}' list can only include identifiers or qualified-names with optional type arguments.`,InvalidModifierOnAwaitUsingDeclaration:(X)=>`'${X}' modifier cannot appear on an await using declaration.`,InvalidModifierOnTypeMember:({modifier:X})=>`'${X}' modifier cannot appear on a type member.`,InvalidModifierOnTypeParameter:({modifier:X})=>`'${X}' modifier cannot appear on a type parameter.`,InvalidModifierOnTypeParameterPositions:({modifier:X})=>`'${X}' modifier can only appear on a type parameter of a class, interface or type alias.`,InvalidModifierOnUsingDeclaration:(X)=>`'${X}' modifier cannot appear on a using declaration.`,InvalidModifiersOrder:({orderedModifiers:X})=>`'${X[0]}' modifier must precede '${X[1]}' modifier.`,InvalidNamespaceName:(X)=>`Namespace name cannot be '${X}'.`,InvalidPropertyAccessAfterInstantiationExpression:"Invalid property access after an instantiation expression. You can either wrap the instantiation expression in parentheses, or delete the type arguments.",InvalidTupleMemberLabel:"Tuple members must be labeled with a simple identifier.",MissingInterfaceName:"'interface' declarations must be followed by an identifier.",NamespaceExportInTSNamespace:"Global module exports may only appear at top level.",NonAbstractClassHasAbstractMethod:"Abstract methods can only appear within an abstract class.",NonClassMethodPropertyHasAbstractModifier:"'abstract' modifier can only appear on a class, method, or property declaration.",OptionalTypeBeforeRequired:"A required element cannot follow an optional element.",OverrideNotInSubClass:"This member cannot have an 'override' modifier because its containing class does not extend another class.",PatternIsOptional:"A binding pattern parameter cannot be optional in an implementation signature.",PrivateElementHasAbstract:"Private elements cannot have the 'abstract' modifier.",PrivateElementHasAccessibility:({modifier:X})=>`Private elements cannot have an accessibility modifier ('${X}').`,ReadonlyForMethodSignature:"'readonly' modifier can only appear on a property declaration or index signature.",ReservedArrowTypeParam:"This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.",ReservedTypeAssertion:"This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",SetAccessorCannotHaveOptionalParameter:"A 'set' accessor cannot have an optional parameter.",SetAccessorCannotHaveRestParameter:"A 'set' accessor cannot have rest parameter.",SetAccessorCannotHaveReturnType:"A 'set' accessor cannot have a return type annotation.",SingleTypeParameterWithoutTrailingComma:({typeParameterName:X})=>`Single type parameter ${X} should have a trailing comma. Example usage: <${X},>.`,StaticBlockCannotHaveModifier:"Static class blocks cannot have any modifier.",TupleOptionalAfterType:"A labeled tuple optional element must be declared using a question mark after the name and before the colon (`name?: type`), rather than after the type (`name: type?`).",TypeAnnotationAfterAssign:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeImportCannotSpecifyDefaultAndNamed:"A type-only import can specify a default import or named bindings, but not both.",TypeModifierIsUsedInTypeExports:"The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",TypeModifierIsUsedInTypeImports:"The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",UnexpectedParameterInitializer:"A parameter initializer is only allowed in a function or constructor implementation.",UnexpectedParameterModifier:"A parameter property is only allowed in a constructor implementation.",UnexpectedReadonly:"'readonly' type modifier is only permitted on array and tuple literal types.",UnexpectedTypeAnnotation:"Did not expect a type annotation here.",UnexpectedTypeCastInParameter:"Unexpected type cast in parameter position.",UnexpectedTypeDeclaration:(X)=>`'${X}' declarations can only be declared inside a block.`,UnsupportedImportTypeArgument:"Argument in a type import must be a string literal.",UnsupportedParameterPropertyKind:"A parameter property may not be declared using a binding pattern.",UnsupportedSignatureParameterKind:({type:X})=>`Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${X}.`,UsingDeclarationInAmbientContext:(X)=>`'${X}' declarations are not allowed in ambient contexts.`},U0=Z9`typescript`(jQ0);function NQ0(X){switch(X){case"any":return"TSAnyKeyword";case"boolean":return"TSBooleanKeyword";case"bigint":return"TSBigIntKeyword";case"never":return"TSNeverKeyword";case"number":return"TSNumberKeyword";case"object":return"TSObjectKeyword";case"string":return"TSStringKeyword";case"symbol":return"TSSymbolKeyword";case"undefined":return"TSUndefinedKeyword";case"unknown":return"TSUnknownKeyword";default:return}}function KP(X){return X==="private"||X==="public"||X==="protected"}function $Q0(X){return X==="in"||X==="out"}function FL(X){if(X.extra?.parenthesized)return!1;switch(X.type){case"Identifier":return!0;case"MemberExpression":return!X.computed&&FL(X.object);case"TSInstantiationExpression":return FL(X.expression);default:return!1}}var RQ0=X1(["declare","private","public","protected","override","abstract","readonly","static"],["in","out"]),AQ0=X1(["readonly"],["declare","abstract","private","protected","public","static","override"]),SQ0=X1(["public","private","protected","override","readonly"]),EQ0=X1(["private","public","protected"]),CQ0=(X)=>class J extends X{getScopeHandler(){return RP}tsIsIdentifier(){return R5(this.state.type)}tsTokenCanFollowModifier(){return this.match(0)||this.match(2)||this.match(51)||this.match(17)||this.match(134)||this.isLiteralPropertyName()}tsNextTokenOnSameLineAndCanFollowModifier(){if(this.next(),this.hasPrecedingLineBreak())return!1;return this.tsTokenCanFollowModifier()}tsNextTokenCanFollowModifier(){if(this.match(102))return this.next(),this.tsTokenCanFollowModifier();return this.tsNextTokenOnSameLineAndCanFollowModifier()}tsParseModifier(Q,Z,G){if(!R5(this.state.type)&&this.state.type!==54&&this.state.type!==71)return;let Y=this.state.value;if(Q.has(Y)){if(G&&this.match(102))return;if(Z&&this.tsIsStartOfStaticBlocks())return;if(this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this)))return Y}return}tsParseModifiers(Q,Z=U0.InvalidModifierOnTypeMember,G,Y=!1){let V=(H,W,U,z)=>{if(W===U&&G[z])this.raise(U0.InvalidModifiersOrder,H,{orderedModifiers:[U,z]})},K=(H,W,U,z)=>{if(G[U]&&W===z||G[z]&&W===U)this.raise(U0.IncompatibleModifiers,H,{modifiers:[U,z]})};for(;;){let{startLoc:H}=this.state,W=this.tsParseModifier(Q,Y,G.static);if(!W)break;if(KP(W))if(G.accessibility)this.raise(U0.DuplicateAccessibilityModifier,H,{modifier:W});else V(H,W,W,"override"),V(H,W,W,"static"),V(H,W,W,"readonly"),G.accessibility=W;else if($Q0(W)){if(G[W])this.raise(U0.DuplicateModifier,H,{modifier:W});G[W]=!0,V(H,W,"in","out")}else{if(Object.hasOwn(G,W))this.raise(U0.DuplicateModifier,H,{modifier:W});else V(H,W,"static","readonly"),V(H,W,"static","override"),V(H,W,"override","readonly"),V(H,W,"abstract","override"),K(H,W,"declare","override"),K(H,W,"static","abstract");G[W]=!0}if(!Q.get(W))this.raise(Z,H,{modifier:W})}}tsIsListTerminator(Q){switch(Q){case"EnumMembers":case"TypeMembers":return this.match(4);case"HeritageClauseElement":return this.match(2);case"TupleElementTypes":return this.match(1);case"TypeParametersOrArguments":return this.match(44)}}tsParseList(Q,Z){let G=[];while(!this.tsIsListTerminator(Q))G.push(Z());return G}tsParseDelimitedList(Q,Z,G){return IQ0(this.tsParseDelimitedListWorker(Q,Z,!0,G))}tsParseDelimitedListWorker(Q,Z,G,Y){let V=[],K=-1;for(;;){if(this.tsIsListTerminator(Q))break;K=-1;let H=Z();if(H==null)return;if(V.push(H),this.eat(8)){K=this.state.lastTokStartLoc.index;continue}if(this.tsIsListTerminator(Q))break;if(G)this.expect(8);return}if(Y)Y.value=K;return V}tsParseBracketedList(Q,Z,G,Y,V){if(!Y)if(G)this.expect(0);else this.expect(43);let K=this.tsParseDelimitedList(Q,Z,V);if(G)this.expect(1);else this.expect(44);return K}tsParseImportType(){let Q=this.startNode();if(this.expect(79),this.expect(6),!this.match(130))this.raise(U0.UnsupportedImportTypeArgument,this.state.startLoc),Q.source=this.tsParseNonConditionalType();else Q.source=this.parseStringLiteral(this.state.value);if(this.eat(8))Q.options=this.tsParseImportTypeOptions();else Q.options=null;if(this.expect(7),this.eat(12))Q.qualifier=this.tsParseEntityName(3);if(this.match(43))Q.typeArguments=this.tsParseTypeArguments();return this.finishNode(Q,"TSImportType")}tsParseImportTypeOptions(){let Q=this.startNode();this.expect(2);let Z=this.startNode();if(this.isContextual(72))Z.method=!1,Z.key=this.parseIdentifier(!0),Z.computed=!1,Z.shorthand=!1;else this.unexpected(null,72);return this.expect(10),Z.value=this.tsParseImportTypeWithPropertyValue(),Q.properties=[this.finishObjectProperty(Z)],this.eat(8),this.expect(4),this.finishNode(Q,"ObjectExpression")}tsParseImportTypeWithPropertyValue(){let Q=this.startNode(),Z=[];this.expect(2);while(!this.match(4)){let G=this.state.type;if(R5(G)||G===130)Z.push(super.parsePropertyDefinition(null));else this.unexpected();this.eat(8)}return Q.properties=Z,this.next(),this.finishNode(Q,"ObjectExpression")}tsParseEntityName(Q){let Z;if(Q&1&&this.match(74))if(Q&2)Z=this.parseIdentifier(!0);else{let G=this.startNode();this.next(),Z=this.finishNode(G,"ThisExpression")}else Z=this.parseIdentifier(!!(Q&1));while(this.eat(12)){let G=this.startNodeAtNode(Z);G.left=Z,G.right=this.parseIdentifier(!!(Q&1)),Z=this.finishNode(G,"TSQualifiedName")}return Z}tsParseTypeReference(){let Q=this.startNode();if(Q.typeName=this.tsParseEntityName(1),!this.hasPrecedingLineBreak()&&this.match(43))Q.typeArguments=this.tsParseTypeArguments();return this.finishNode(Q,"TSTypeReference")}tsParseThisTypePredicate(Q){this.next();let Z=this.startNodeAtNode(Q);return Z.parameterName=Q,Z.typeAnnotation=this.tsParseTypeAnnotation(!1),Z.asserts=!1,this.finishNode(Z,"TSTypePredicate")}tsParseThisTypeNode(){let Q=this.startNode();return this.next(),this.finishNode(Q,"TSThisType")}tsParseTypeQuery(){let Q=this.startNode();if(this.expect(83),this.match(79))Q.exprName=this.tsParseImportType();else Q.exprName=this.tsParseEntityName(1);if(!this.hasPrecedingLineBreak()&&this.match(43))Q.typeArguments=this.tsParseTypeArguments();return this.finishNode(Q,"TSTypeQuery")}tsParseInOutModifiers=this.tsParseModifiers.bind(this,X1(["in","out"],["const","public","private","protected","readonly","declare","abstract","override"]),U0.InvalidModifierOnTypeParameter);tsParseConstModifier=this.tsParseModifiers.bind(this,X1(["const"],["in","out"]),U0.InvalidModifierOnTypeParameterPositions);tsParseInOutConstModifiers=this.tsParseModifiers.bind(this,X1(["in","out","const"],["public","private","protected","readonly","declare","abstract","override"]),U0.InvalidModifierOnTypeParameter);tsParseTypeParameter(Q){let Z=this.startNode();return Q(Z),Z.name=this.tsParseTypeParameterName(),Z.constraint=this.tsEatThenParseType(77),Z.default=this.tsEatThenParseType(25),this.finishNode(Z,"TSTypeParameter")}tsTryParseTypeParameters(Q){if(this.match(43))return this.tsParseTypeParameters(Q)}tsParseTypeParameters(Q){let Z=this.startNode();if(this.match(43)||this.match(138))this.next();else this.unexpected();let G={value:-1};if(Z.params=this.tsParseBracketedList("TypeParametersOrArguments",this.tsParseTypeParameter.bind(this,Q),!1,!0,G),Z.params.length===0)this.raise(U0.EmptyTypeParameters,Z);if(G.value!==-1)this.addExtra(Z,"trailingComma",G.value);return this.finishNode(Z,"TSTypeParameterDeclaration")}tsFillSignature(Q,Z){let G=Q===15,Y="params",V="returnType";if(Z.typeParameters=this.tsTryParseTypeParameters(this.tsParseConstModifier),this.expect(6),Z.params=this.tsParseBindingListForSignature(),G)Z.returnType=this.tsParseTypeOrTypePredicateAnnotation(Q);else if(this.match(Q))Z.returnType=this.tsParseTypeOrTypePredicateAnnotation(Q)}tsParseBindingListForSignature(){let Q=super.parseBindingList(7,41,2);for(let Z of Q){let{type:G}=Z;if(G==="AssignmentPattern"||G==="TSParameterProperty")this.raise(U0.UnsupportedSignatureParameterKind,Z,{type:G})}return Q}tsParseTypeMemberSemicolon(){if(!this.eat(8)&&!this.isLineTerminator())this.expect(9)}tsParseSignatureMember(Q,Z){return this.tsFillSignature(10,Z),this.tsParseTypeMemberSemicolon(),this.finishNode(Z,Q)}tsIsUnambiguouslyIndexSignature(){if(this.next(),R5(this.state.type))return this.next(),this.match(10);return!1}tsTryParseIndexSignature(Q){if(!(this.match(0)&&this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this))))return;this.expect(0);let Z=this.parseIdentifier();Z.typeAnnotation=this.tsParseTypeAnnotation(),this.resetEndLocation(Z),this.expect(1),Q.parameters=[Z];let G=this.tsTryParseTypeAnnotation();if(G)Q.typeAnnotation=G;return this.tsParseTypeMemberSemicolon(),this.finishNode(Q,"TSIndexSignature")}tsParsePropertyOrMethodSignature(Q,Z){if(this.eat(13))Q.optional=!0;if(this.match(6)||this.match(43)){if(Z)this.raise(U0.ReadonlyForMethodSignature,Q);let G=Q;if(G.kind&&this.match(43))this.raise(U0.AccessorCannotHaveTypeParameters,this.state.curPosition());if(this.tsFillSignature(10,G),this.tsParseTypeMemberSemicolon(),G.kind==="get"){if(G.params.length>0){if(this.raise(u.BadGetterArity,this.state.curPosition()),this.isThisParam(G.params[0]))this.raise(U0.AccessorCannotDeclareThisParameter,this.state.curPosition())}}else if(G.kind==="set"){if(G.params.length!==1)this.raise(u.BadSetterArity,this.state.curPosition());else{let Y=G.params[0];if(this.isThisParam(Y))this.raise(U0.AccessorCannotDeclareThisParameter,this.state.curPosition());if(Y.type==="Identifier"&&Y.optional)this.raise(U0.SetAccessorCannotHaveOptionalParameter,this.state.curPosition());if(Y.type==="RestElement")this.raise(U0.SetAccessorCannotHaveRestParameter,this.state.curPosition())}if(G.returnType)this.raise(U0.SetAccessorCannotHaveReturnType,G.returnType)}else G.kind="method";return this.finishNode(G,"TSMethodSignature")}else{let G=Q;if(Z)G.readonly=!0;let Y=this.tsTryParseTypeAnnotation();if(Y)G.typeAnnotation=Y;return this.tsParseTypeMemberSemicolon(),this.finishNode(G,"TSPropertySignature")}}tsParseTypeMember(){let Q=this.startNode();if(this.match(6)||this.match(43))return this.tsParseSignatureMember("TSCallSignatureDeclaration",Q);if(this.match(73)){let G=this.startNode();if(this.next(),this.match(6)||this.match(43))return this.tsParseSignatureMember("TSConstructSignatureDeclaration",Q);else return Q.key=this.createIdentifier(G,"new"),this.tsParsePropertyOrMethodSignature(Q,!1)}this.tsParseModifiers(AQ0,void 0,Q);let Z=this.tsTryParseIndexSignature(Q);if(Z)return Z;if(super.parsePropertyName(Q),!Q.computed&&Q.key.type==="Identifier"&&(Q.key.name==="get"||Q.key.name==="set")&&this.tsTokenCanFollowModifier()){if(Q.kind=Q.key.name,super.parsePropertyName(Q),!this.match(6)&&!this.match(43))this.unexpected(null,6)}return this.tsParsePropertyOrMethodSignature(Q,!!Q.readonly)}tsParseTypeLiteral(){let Q=this.startNode();return Q.members=this.tsParseObjectTypeMembers(),this.finishNode(Q,"TSTypeLiteral")}tsParseObjectTypeMembers(){this.expect(2);let Q=this.tsParseList("TypeMembers",this.tsParseTypeMember.bind(this));return this.expect(4),Q}tsIsStartOfMappedType(){if(this.next(),this.eat(49))return this.isContextual(118);if(this.isContextual(118))this.next();if(!this.match(0))return!1;if(this.next(),!this.tsIsIdentifier())return!1;return this.next(),this.match(54)}tsParseMappedType(){let Q=this.startNode();if(this.expect(2),this.match(49))Q.readonly=this.state.value,this.next(),this.expectContextual(118);else if(this.eatContextual(118))Q.readonly=!0;if(this.expect(0),Q.key=this.tsParseTypeParameterName(),Q.constraint=this.tsExpectThenParseType(54),Q.nameType=this.eatContextual(89)?this.tsParseType():null,this.expect(1),this.match(49))Q.optional=this.state.value,this.next(),this.expect(13);else if(this.eat(13))Q.optional=!0;return Q.typeAnnotation=this.tsTryParseType(),this.semicolon(),this.expect(4),this.finishNode(Q,"TSMappedType")}tsParseTupleType(){let Q=this.startNode();Q.elementTypes=this.tsParseBracketedList("TupleElementTypes",this.tsParseTupleElementType.bind(this),!0,!1);let Z=!1;return Q.elementTypes.forEach((G)=>{let{type:Y}=G;if(Z&&Y!=="TSRestType"&&Y!=="TSOptionalType"&&!(Y==="TSNamedTupleMember"&&G.optional))this.raise(U0.OptionalTypeBeforeRequired,G);Z||=Y==="TSNamedTupleMember"&&G.optional||Y==="TSOptionalType"}),this.finishNode(Q,"TSTupleType")}tsParseTupleElementType(){let Q=this.state.startLoc,Z=this.eat(17),{startLoc:G}=this.state,Y,V,K,H,U=s8(this.state.type)?this.lookaheadCharCode():null;if(U===58)Y=!0,K=!1,V=this.parseIdentifier(!0),this.expect(10),H=this.tsParseType();else if(U===63){K=!0;let z=this.state.value,q=this.tsParseNonArrayType();if(this.lookaheadCharCode()===58)Y=!0,V=this.createIdentifier(this.startNodeAt(G),z),this.expect(13),this.expect(10),H=this.tsParseType();else Y=!1,H=q,this.expect(13)}else H=this.tsParseType(),K=this.eat(13),Y=this.eat(10);if(Y){let z;if(V){if(z=this.startNodeAt(G),z.optional=K,z.label=V,z.elementType=H,this.eat(13))z.optional=!0,this.raise(U0.TupleOptionalAfterType,this.state.lastTokStartLoc)}else z=this.startNodeAt(G),z.optional=K,this.raise(U0.InvalidTupleMemberLabel,H),z.label=H,z.elementType=this.tsParseType();H=this.finishNode(z,"TSNamedTupleMember")}else if(K){let z=this.startNodeAt(G);z.typeAnnotation=H,H=this.finishNode(z,"TSOptionalType")}if(Z){let z=this.startNodeAt(Q);z.typeAnnotation=H,H=this.finishNode(z,"TSRestType")}return H}tsParseParenthesizedType(){let Q=this.startNode();return this.expect(6),Q.typeAnnotation=this.tsParseType(),this.expect(7),this.finishNode(Q,"TSParenthesizedType")}tsParseFunctionOrConstructorType(Q,Z){let G=this.startNode();if(Q==="TSConstructorType"){if(G.abstract=!!Z,Z)this.next();this.next()}return this.tsInAllowConditionalTypesContext(()=>this.tsFillSignature(15,G)),this.finishNode(G,Q)}tsParseLiteralTypeNode(){let Q=this.startNode();switch(this.state.type){case 131:case 132:case 130:case 81:case 82:Q.literal=super.parseExprAtom();break;default:this.unexpected()}return this.finishNode(Q,"TSLiteralType")}tsParseTemplateLiteralType(){let Q=this.state.startLoc,Z=this.parseTemplateElement(!1),G=[Z];if(Z.tail){let Y=this.startNodeAt(Q),V=this.startNodeAt(Q);return V.expressions=[],V.quasis=G,Y.literal=this.finishNode(V,"TemplateLiteral"),this.finishNode(Y,"TSLiteralType")}else{let Y=[];while(!Z.tail)Y.push(this.tsParseType()),this.readTemplateContinuation(),G.push(Z=this.parseTemplateElement(!1));let V=this.startNodeAt(Q);return V.types=Y,V.quasis=G,this.finishNode(V,"TSTemplateLiteralType")}}parseTemplateSubstitution(){if(this.state.inType)return this.tsParseType();return super.parseTemplateSubstitution()}tsParseThisTypeOrThisTypePredicate(){let Q=this.tsParseThisTypeNode();if(this.isContextual(112)&&!this.hasPrecedingLineBreak())return this.tsParseThisTypePredicate(Q);else return Q}tsParseNonArrayType(){switch(this.state.type){case 130:case 131:case 132:case 81:case 82:return this.tsParseLiteralTypeNode();case 49:if(this.state.value==="-"){let Q=this.startNode(),Z=this.lookahead();if(Z.type!==131&&Z.type!==132)this.unexpected();return Q.literal=this.parseMaybeUnary(),this.finishNode(Q,"TSLiteralType")}break;case 74:return this.tsParseThisTypeOrThisTypePredicate();case 83:return this.tsParseTypeQuery();case 79:return this.tsParseImportType();case 2:return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this))?this.tsParseMappedType():this.tsParseTypeLiteral();case 0:return this.tsParseTupleType();case 6:if(!(this.optionFlags&2048)){let Q=this.state.startLoc;this.next();let Z=this.tsParseType();return this.expect(7),this.addExtra(Z,"parenthesized",!0),this.addExtra(Z,"parenStart",Q.index),Z}return this.tsParseParenthesizedType();case 21:case 20:return this.tsParseTemplateLiteralType();default:{let{type:Q}=this.state;if(R5(Q)||Q===84||Q===80){let Z=Q===84?"TSVoidKeyword":Q===80?"TSNullKeyword":NQ0(this.state.value);if(Z!==void 0&&this.lookaheadCharCode()!==46){let G=this.startNode();return this.next(),this.finishNode(G,Z)}return this.tsParseTypeReference()}}}throw this.unexpected()}tsParseArrayTypeOrHigher(){let{startLoc:Q}=this.state,Z=this.tsParseNonArrayType();while(!this.hasPrecedingLineBreak()&&this.eat(0))if(this.match(1)){let G=this.startNodeAt(Q);G.elementType=Z,this.expect(1),Z=this.finishNode(G,"TSArrayType")}else{let G=this.startNodeAt(Q);G.objectType=Z,G.indexType=this.tsParseType(),this.expect(1),Z=this.finishNode(G,"TSIndexedAccessType")}return Z}tsParseTypeOperator(){let Q=this.startNode(),Z=this.state.value;if(this.next(),Q.operator=Z,Q.typeAnnotation=this.tsParseTypeOperatorOrHigher(),Z==="readonly")this.tsCheckTypeAnnotationForReadOnly(Q);return this.finishNode(Q,"TSTypeOperator")}tsCheckTypeAnnotationForReadOnly(Q){switch(Q.typeAnnotation.type){case"TSTupleType":case"TSArrayType":return;default:this.raise(U0.UnexpectedReadonly,Q)}}tsParseInferType(){let Q=this.startNode();this.expectContextual(111);let Z=this.startNode();return Z.name=this.tsParseTypeParameterName(),Z.constraint=this.tsTryParse(()=>this.tsParseConstraintForInferType()),Q.typeParameter=this.finishNode(Z,"TSTypeParameter"),this.finishNode(Q,"TSInferType")}tsParseConstraintForInferType(){if(this.eat(77)){let Q=this.tsInDisallowConditionalTypesContext(()=>this.tsParseType());if(this.state.inDisallowConditionalTypesContext||!this.match(13))return Q}}tsParseTypeOperatorOrHigher(){return m10(this.state.type)&&!this.state.containsEsc?this.tsParseTypeOperator():this.isContextual(111)?this.tsParseInferType():this.tsInAllowConditionalTypesContext(()=>this.tsParseArrayTypeOrHigher())}tsParseUnionOrIntersectionType(Q,Z,G){let Y=this.startNode(),V=this.eat(G),K=[];do K.push(Z());while(this.eat(G));if(K.length===1&&!V)return K[0];return Y.types=K,this.finishNode(Y,Q)}tsParseIntersectionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSIntersectionType",this.tsParseTypeOperatorOrHigher.bind(this),41)}tsParseUnionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSUnionType",this.tsParseIntersectionTypeOrHigher.bind(this),39)}tsIsStartOfFunctionType(){if(this.match(43))return!0;return this.match(6)&&this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this))}tsSkipParameterStart(){if(R5(this.state.type)||this.match(74))return this.next(),!0;if(this.match(2)){let{errors:Q}=this.state,Z=Q.length;try{return this.parseObjectLike(4,!0),Q.length===Z}catch{return!1}}if(this.match(0)){this.next();let{errors:Q}=this.state,Z=Q.length;try{return super.parseBindingList(1,93,1),Q.length===Z}catch{return!1}}return!1}tsIsUnambiguouslyStartOfFunctionType(){if(this.next(),this.match(7)||this.match(17))return!0;if(this.tsSkipParameterStart()){if(this.match(10)||this.match(8)||this.match(13)||this.match(25))return!0;if(this.match(7)){if(this.next(),this.match(15))return!0}}return!1}tsParseTypeOrTypePredicateAnnotation(Q){return this.tsInType(()=>{let Z=this.startNode();this.expect(Q);let G=this.startNode(),Y=!!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));if(Y&&this.match(74)){let H=this.tsParseThisTypeOrThisTypePredicate();if(H.type==="TSThisType")G.parameterName=H,G.asserts=!0,G.typeAnnotation=null,H=this.finishNode(G,"TSTypePredicate");else this.resetStartLocationFromNode(H,G),H.asserts=!0;return Z.typeAnnotation=H,this.finishNode(Z,"TSTypeAnnotation")}let V=this.tsIsIdentifier()&&this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this));if(!V){if(!Y)return this.tsParseTypeAnnotation(!1,Z);return G.parameterName=this.parseIdentifier(),G.asserts=Y,G.typeAnnotation=null,Z.typeAnnotation=this.finishNode(G,"TSTypePredicate"),this.finishNode(Z,"TSTypeAnnotation")}let K=this.tsParseTypeAnnotation(!1);return G.parameterName=V,G.typeAnnotation=K,G.asserts=Y,Z.typeAnnotation=this.finishNode(G,"TSTypePredicate"),this.finishNode(Z,"TSTypeAnnotation")})}tsTryParseTypeOrTypePredicateAnnotation(){if(this.match(10))return this.tsParseTypeOrTypePredicateAnnotation(10)}tsTryParseTypeAnnotation(){if(this.match(10))return this.tsParseTypeAnnotation()}tsTryParseType(){return this.tsEatThenParseType(10)}tsParseTypePredicatePrefix(){let Q=this.parseIdentifier();if(this.isContextual(112)&&!this.hasPrecedingLineBreak())return this.next(),Q}tsParseTypePredicateAsserts(){if(this.state.type!==105)return!1;let Q=this.state.containsEsc;if(this.next(),!R5(this.state.type)&&!this.match(74))return!1;if(Q)this.raise(u.InvalidEscapedReservedWord,this.state.lastTokStartLoc,{reservedWord:"asserts"});return!0}tsParseTypeAnnotation(Q=!0,Z=this.startNode()){return this.tsInType(()=>{if(Q)this.expect(10);Z.typeAnnotation=this.tsParseType()}),this.finishNode(Z,"TSTypeAnnotation")}tsParseType(){VP(this.state.inType);let Q=this.tsParseNonConditionalType();if(this.state.inDisallowConditionalTypesContext||this.hasPrecedingLineBreak()||!this.eat(77))return Q;let Z=this.startNodeAtNode(Q);return Z.checkType=Q,Z.extendsType=this.tsInDisallowConditionalTypesContext(()=>this.tsParseNonConditionalType()),this.expect(13),Z.trueType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.expect(10),Z.falseType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.finishNode(Z,"TSConditionalType")}isAbstractConstructorSignature(){return this.isContextual(120)&&this.isLookaheadContextual("new")}tsParseNonConditionalType(){if(this.tsIsStartOfFunctionType())return this.tsParseFunctionOrConstructorType("TSFunctionType");if(this.match(73))return this.tsParseFunctionOrConstructorType("TSConstructorType");else if(this.isAbstractConstructorSignature())return this.tsParseFunctionOrConstructorType("TSConstructorType",!0);return this.tsParseUnionTypeOrHigher()}tsParseTypeAssertion(){if(this.getPluginOption("typescript","disallowAmbiguousJSXLike"))this.raise(U0.ReservedTypeAssertion,this.state.startLoc);let Q=this.startNode();return Q.typeAnnotation=this.tsInType(()=>{return this.next(),this.match(71)?this.tsParseTypeReference():this.tsParseType()}),this.expect(44),Q.expression=this.parseMaybeUnary(),this.finishNode(Q,"TSTypeAssertion")}tsParseHeritageClause(Q){let Z=this.state.startLoc,G=this.tsParseDelimitedList("HeritageClauseElement",()=>{let Y=(this.state.canStartArrow=!1,super.parseExprSubscripts());if(!FL(Y))this.raise(U0.InvalidHeritageClauseType,Y.start,{token:Q});let V=Q==="extends"?"TSInterfaceHeritage":"TSClassImplements";if(Y.type==="TSInstantiationExpression")return Y.type=V,Y;let K=this.startNodeAtNode(Y);if(K.expression=Y,this.match(43)||this.match(47))K.typeArguments=this.tsParseTypeArgumentsInExpression();return this.finishNode(K,V)});if(!G.length)this.raise(U0.EmptyHeritageClauseType,Z,{token:Q});return G}tsParseInterfaceDeclaration(Q,Z={}){if(this.hasFollowingLineBreak())return null;if(this.expectContextual(125),Z.declare)Q.declare=!0;if(R5(this.state.type))Q.id=this.parseIdentifier(),this.checkIdentifier(Q.id,130);else Q.id=null,this.raise(U0.MissingInterfaceName,this.state.startLoc);if(Q.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers),this.eat(77))Q.extends=this.tsParseHeritageClause("extends");let G=this.startNode();return G.body=this.tsInType(this.tsParseObjectTypeMembers.bind(this)),Q.body=this.finishNode(G,"TSInterfaceBody"),this.finishNode(Q,"TSInterfaceDeclaration")}tsParseTypeAliasDeclaration(Q){return Q.id=this.parseIdentifier(),this.checkIdentifier(Q.id,2),Q.typeAnnotation=this.tsInType(()=>{if(Q.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutModifiers),this.expect(25),this.isContextual(110)&&this.lookaheadCharCode()!==46){let Z=this.startNode();return this.next(),this.finishNode(Z,"TSIntrinsicKeyword")}return this.tsParseType()}),this.semicolon(),this.finishNode(Q,"TSTypeAliasDeclaration")}tsInTopLevelContext(Q){if(this.curContext()!==l5.brace){let Z=this.state.context;this.state.context=[Z[0]];try{return Q()}finally{this.state.context=Z}}else return Q()}tsInType(Q){let Z=this.state.inType;this.state.inType=!0;try{return Q()}finally{this.state.inType=Z}}tsInDisallowConditionalTypesContext(Q){let Z=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!0;try{return Q()}finally{this.state.inDisallowConditionalTypesContext=Z}}tsInAllowConditionalTypesContext(Q){let Z=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!1;try{return Q()}finally{this.state.inDisallowConditionalTypesContext=Z}}tsEatThenParseType(Q){if(this.match(Q))return this.tsNextThenParseType()}tsExpectThenParseType(Q){return this.tsInType(()=>{return this.expect(Q),this.tsParseType()})}tsNextThenParseType(){return this.tsInType(()=>{return this.next(),this.tsParseType()})}tsParseEnumMember(){let Q=this.startNode();if(Q.id=this.match(130)?super.parseStringLiteral(this.state.value):this.parseIdentifier(!0),this.eat(25))Q.initializer=super.parseMaybeAssignAllowIn();return this.finishNode(Q,"TSEnumMember")}tsParseEnumDeclaration(Q,Z={}){if(Z.const)Q.const=!0;if(Z.declare)Q.declare=!0;return this.expectContextual(122),Q.id=this.parseIdentifier(),this.checkIdentifier(Q.id,Q.const?8971:8459),Q.body=this.tsParseEnumBody(),this.finishNode(Q,"TSEnumDeclaration")}tsParseEnumBody(){let Q=this.startNode();return this.expect(2),Q.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this)),this.expect(4),this.finishNode(Q,"TSEnumBody")}tsParseModuleBlock(Q){let Z=this.startNode();if(!Q)this.scope.enter(0);if(this.expect(2),super.parseBlockOrModuleBlockBody(Z.body=[],void 0,!0,4),!Q)this.scope.exit();return this.finishNode(Z,"TSModuleBlock")}tsParseNamespaceDeclaration(Q){if(Q.id=this.tsParseEntityName(0),Q.id.type==="Identifier")this.checkIdentifier(Q.id,1024);return this.scope.enter(2048),this.prodParam.enter(0),Q.body=this.tsParseModuleBlock(!1),this.prodParam.exit(),this.scope.exit(),this.finishNode(Q,"TSModuleDeclaration")}tsParseAmbientExternalModuleDeclaration(Q){let Z=this.isContextual(108);if(Z)Q.kind="global",Q.id=this.parseIdentifier();else{Q.kind="module";let{type:G,value:Y}=this.state;if(G===130)Q.id=super.parseStringLiteral(Y);else if(R5(G))this.raise(U0.InlineModuleDeclarationMustUseString,this.state.startLoc),Q.id=this.tsParseEntityName(0);else if(G===2)this.raise(U0.EmptyNamespaceName,this.state.startLoc);else this.raise(U0.InvalidNamespaceName,this.state.startLoc,Y),Q.id=super.parseExprAtom()}if(this.match(2)){if(!Z)this.scope.enter(1024);if(this.prodParam.enter(0),Q.body=this.tsParseModuleBlock(Z),this.prodParam.exit(),!Z)this.scope.exit()}else this.semicolon();return this.finishNode(Q,"TSModuleDeclaration")}tsParseImportEqualsDeclaration(Q,Z){Q.id=Z||this.parseIdentifier(),this.checkIdentifier(Q.id,4096),this.expect(25);let G=this.tsParseModuleReference();if(Q.importKind==="type"&&G.type!=="TSExternalModuleReference")this.raise(U0.ImportAliasHasImportType,G);return Q.moduleReference=G,this.semicolon(),this.finishNode(Q,"TSImportEqualsDeclaration")}tsIsExternalModuleReference(){return this.isContextual(115)&&this.lookaheadCharCode()===40}tsParseModuleReference(){return this.tsIsExternalModuleReference()?this.tsParseExternalModuleReference():this.tsParseEntityName(0)}tsParseExternalModuleReference(){let Q=this.startNode();if(this.expectContextual(115),this.expect(6),!this.match(130))this.unexpected();return Q.expression=super.parseExprAtom(),this.expect(7),this.sawUnambiguousESM=!0,this.finishNode(Q,"TSExternalModuleReference")}tsLookAhead(Q){let Z=this.state.clone(),G=Q();return this.state=Z,G}tsTryParseAndCatch(Q){let Z=this.tryParse((G)=>Q()||G());if(Z.aborted||!Z.node)return;if(Z.error)this.state=Z.failState;return Z.node}tsTryParse(Q){let Z=this.state.clone(),G=Q();if(G!==void 0&&G!==!1)return G;this.state=Z}tsTryParseDeclare(Q){if(this.isLineTerminator())return;let Z=this.state.type;return this.tsInAmbientContext(()=>{switch(Z){case 64:return Q.declare=!0,super.parseFunctionStatement(Q,!1,!1);case 76:return Q.declare=!0,this.parseClass(Q,!0,!1);case 122:return this.tsParseEnumDeclaration(Q,{declare:!0});case 108:return this.tsParseAmbientExternalModuleDeclaration(Q);case 96:if(this.state.containsEsc)return;case 71:case 70:if(!this.match(71)||!this.isLookaheadContextual("enum"))return Q.declare=!0,this.parseVarStatement(Q,this.state.value,!0);return this.expect(71),this.tsParseEnumDeclaration(Q,{const:!0,declare:!0});case 103:if(this.isUsing())return this.raise(U0.InvalidModifierOnUsingDeclaration,this.state.startLoc,"declare"),Q.declare=!0,this.parseVarStatement(Q,"using",!0);break;case 92:if(this.isAwaitUsing())return this.raise(U0.InvalidModifierOnAwaitUsingDeclaration,this.state.startLoc,"declare"),Q.declare=!0,this.next(),this.parseVarStatement(Q,"await using",!0);break;case 125:{let G=this.tsParseInterfaceDeclaration(Q,{declare:!0});if(G)return G}default:if(R5(Z))return this.tsParseDeclaration(Q,this.state.type,!0,null)}})}tsTryParseExportDeclaration(){return this.tsParseDeclaration(this.startNode(),this.state.type,!0,null)}tsParseDeclaration(Q,Z,G,Y){switch(Z){case 120:if(this.tsCheckLineTerminator(G)&&(this.match(76)||R5(this.state.type)))return this.tsParseAbstractDeclaration(Q,Y);break;case 123:if(this.tsCheckLineTerminator(G))return this.tsParseAmbientExternalModuleDeclaration(Q);break;case 124:if(this.tsCheckLineTerminator(G)&&R5(this.state.type))return Q.kind="namespace",this.tsParseNamespaceDeclaration(Q);break;case 126:if(this.tsCheckLineTerminator(G)&&R5(this.state.type))return this.tsParseTypeAliasDeclaration(Q);break}}tsCheckLineTerminator(Q){if(Q){if(this.hasFollowingLineBreak())return!1;return this.next(),!0}return!this.isLineTerminator()}tsTryParseGenericAsyncArrowFunction(Q){if(!this.match(43))return;let Z=this.tsTryParseAndCatch(()=>{let G=this.startNodeAt(Q);return G.typeParameters=this.tsParseTypeParameters(this.tsParseConstModifier),super.parseFunctionParams(G),G.returnType=this.tsTryParseTypeOrTypePredicateAnnotation(),this.expect(15),G});if(!Z)return;return super.parseArrowExpression(Z,null,!0)}tsParseTypeArgumentsInExpression(){if(this.reScan_lt()!==43)return;return this.tsParseTypeArguments()}tsParseTypeArguments(){let Q=this.startNode();if(Q.params=this.tsInType(()=>this.tsInTopLevelContext(()=>{return this.expect(43),this.tsParseDelimitedList("TypeParametersOrArguments",this.tsParseType.bind(this))})),Q.params.length===0)this.raise(U0.EmptyTypeArguments,Q);else if(!this.state.inType&&this.curContext()===l5.brace)this.reScan_lt_gt();return this.expect(44),this.finishNode(Q,"TSTypeParameterInstantiation")}tsIsDeclarationStart(){return u10(this.state.type)}isExportDefaultSpecifier(){if(this.tsIsDeclarationStart())return!1;return super.isExportDefaultSpecifier()}parseBindingElement(Q,Z){let G=Z.length?null:this.state.startLoc,Y={};this.tsParseModifiers(SQ0,void 0,Y);let{accessibility:V,override:K,readonly:H}=Y;if(!(Q&4)&&(V||H||K))this.raise(U0.UnexpectedParameterModifier,G||Z[0]);let W=this.state.startLoc,U=this.parseMaybeDefault(W);if(Q&2)this.parseFunctionParamType(U);let z=this.parseMaybeDefault(W,U);if(V||H||K){let q=G?this.startNodeAt(G):this.startNodeAtNode(Z[0]);if(Z.length)q.decorators=Z;else this.setLoc(G);if(V)q.accessibility=V;if(H)q.readonly=H;if(K)q.override=K;if(z.type!=="Identifier"&&z.type!=="AssignmentPattern")this.raise(U0.UnsupportedParameterPropertyKind,G||Z[0]);return q.parameter=z,this.finishNode(q,"TSParameterProperty")}if(Z.length)U.decorators=Z;return z}isSimpleParameter(Q){return Q.type==="TSParameterProperty"&&super.isSimpleParameter(Q.parameter)||super.isSimpleParameter(Q)}tsDisallowOptionalPattern(Q){for(let Z of Q.params)if(Z.type!=="Identifier"&&Z.optional&&!this.state.isAmbientContext)this.raise(U0.PatternIsOptional,Z)}setArrowFunctionParameters(Q,Z,G){super.setArrowFunctionParameters(Q,Z,G),this.tsDisallowOptionalPattern(Q)}parseFunctionBodyAndFinish(Q,Z,G=!1){if(this.match(10))Q.returnType=this.tsParseTypeOrTypePredicateAnnotation(10);let Y=Z==="FunctionDeclaration"?"TSDeclareFunction":Z==="ClassMethod"||Z==="ClassPrivateMethod"?"TSDeclareMethod":void 0;if(Y&&!this.match(2)&&this.isLineTerminator()){if(Y==="TSDeclareMethod"&&Q.kind==="constructor"){for(let V of Q.params)if(V.type==="TSParameterProperty")this.raise(U0.UnexpectedParameterModifier,V);else if(V.type==="AssignmentPattern")this.raise(U0.UnexpectedParameterInitializer,V)}else for(let V of Q.params)if(V.type==="AssignmentPattern")this.raise(U0.UnexpectedParameterInitializer,V);return this.finishNode(Q,Y)}if(Y&&this.state.isAmbientContext){if(this.raise(U0.DeclareFunctionHasImplementation,this.state.startLoc),Y==="TSDeclareFunction"&&Q.declare)return super.parseFunctionBodyAndFinish(Q,Y,G)}return this.tsDisallowOptionalPattern(Q),super.parseFunctionBodyAndFinish(Q,Z,G)}registerFunctionStatementId(Q){if(!Q.body&&Q.id)this.checkIdentifier(Q.id,1024);else super.registerFunctionStatementId(Q)}tsCheckForInvalidTypeCasts(Q){Q.forEach((Z)=>{if(Z?.type==="TSTypeCastExpression")this.raise(U0.UnexpectedTypeAnnotation,Z.typeAnnotation)})}toReferencedList(Q,Z){return this.tsCheckForInvalidTypeCasts(Q),Q}parseArrayLike(Q,Z){let G=super.parseArrayLike(Q,Z);if(G.type==="ArrayExpression")this.tsCheckForInvalidTypeCasts(G.elements);return G}parseSubscript(Q,Z,G,Y){if(!this.hasPrecedingLineBreak()&&this.match(31)){this.state.canStartJSXElement=!1,this.next();let K=this.startNodeAt(Z);return K.expression=Q,this.finishNode(K,"TSNonNullExpression")}let V=!1;if(this.match(14)&&this.lookaheadCharCode()===60){if(G)return Y.stop=!0,Q;Y.optionalChainMember=V=!0,this.next()}if(this.match(43)||this.match(47)){let K,H=this.tsTryParseAndCatch(()=>{if(!G&&this.atPossibleAsyncArrow(Q)){let q=this.tsTryParseGenericAsyncArrowFunction(Z);if(q)return Y.stop=!0,q}let W=this.tsParseTypeArgumentsInExpression();if(!W)return;if(V&&!this.match(6)){K=this.state.curPosition();return}if(SL(this.state.type)){let q=super.parseTaggedTemplateExpression(Q,Z,Y);return q.typeArguments=W,q}if(!G&&this.eat(6)){let q=this.startNodeAt(Z);if(q.callee=Q,q.arguments=this.parseCallExpressionArguments(),this.tsCheckForInvalidTypeCasts(q.arguments),q.typeArguments=W,Y.optionalChainMember)q.optional=V;return this.finishCallExpression(q,Y.optionalChainMember)}let U=this.state.type;if(U===44||U===48||U!==6&&U!==89&&U!==116&&NG(U)&&!this.hasPrecedingLineBreak())return;let z=this.startNodeAt(Z);return z.expression=Q,z.typeArguments=W,this.finishNode(z,"TSInstantiationExpression")});if(K)this.unexpected(K,6);if(H){if(H.type==="TSInstantiationExpression"){if(this.match(12)||this.match(14)&&this.lookaheadCharCode()!==40)this.raise(U0.InvalidPropertyAccessAfterInstantiationExpression,this.state.startLoc);if(!this.match(12)&&!this.match(14))H.expression=super.stopParseSubscript(Q,Y)}return H}}return super.parseSubscript(Q,Z,G,Y)}parseNewCallee(Q){super.parseNewCallee(Q);let{callee:Z}=Q;if(Z.type==="TSInstantiationExpression"&&!Z.extra?.parenthesized)Q.typeArguments=Z.typeArguments,Q.callee=Z.expression}parseExprOp(Q,Z,G){let Y;if(fW(54)>G&&!this.hasPrecedingLineBreak()&&(this.isContextual(89)||(Y=this.isContextual(116)))){let V=this.startNodeAt(Z);V.expression=Q,V.typeAnnotation=this.tsInType(()=>{if(this.next(),this.match(71)){if(Y)this.raise(u.UnexpectedKeyword,this.state.startLoc,{keyword:"const"});return this.tsParseTypeReference()}return this.tsParseType()});let K=this.finishNode(V,Y?"TSSatisfiesExpression":"TSAsExpression");return this.reScan_lt_gt(),this.parseExprOp(K,Z,G)}return super.parseExprOp(Q,Z,G)}checkReservedWord(Q,Z,G,Y){if(!this.state.isAmbientContext)super.checkReservedWord(Q,Z,G,Y)}checkDuplicateExports(){}isPotentialImportPhase(Q){if(super.isPotentialImportPhase(Q))return!0;if(this.isContextual(126)){let Z=this.lookaheadCharCode();return Q?Z===123||Z===42:Z!==61}return!Q&&this.isContextual(83)}applyImportPhase(Q,Z,G,Y){if(super.applyImportPhase(Q,Z,G,Y),Z)Q.exportKind=G==="type"?"type":"value";else Q.importKind=G==="type"||G==="typeof"?G:"value"}parseImport(Q){if(this.match(130)){if(Q.importKind="value",this.scope.inTSNamespace)this.raise(U0.ImportInTSNamespace,Q);return super.parseImport(Q)}let Z;if(R5(this.state.type)&&this.lookaheadCharCode()===61){Q.importKind="value";let G=this.tsParseImportEqualsDeclaration(Q);if(this.scope.inTSNamespace&&G.moduleReference.type==="TSExternalModuleReference")this.raise(U0.ImportInTSNamespace,Q);return G}else if(this.isContextual(126)){let G=this.parseMaybeImportPhase(Q,!1);if(this.lookaheadCharCode()===61){if(this.scope.inTSNamespace)this.raise(U0.ImportInTSNamespace,Q);return this.tsParseImportEqualsDeclaration(Q,G)}else Z=super.parseImportSpecifiersAndAfter(Q,G)}else Z=super.parseImport(Q);if(Z.importKind==="type"&&Z.specifiers.length>1&&Z.specifiers[0].type==="ImportDefaultSpecifier")this.raise(U0.TypeImportCannotSpecifyDefaultAndNamed,Z);else if(this.scope.inTSNamespace)this.raise(U0.ImportInTSNamespace,Z);return Z}parseExport(Q,Z){if(this.match(79)){let G=this.startNode();this.next();let Y=null;if(this.isContextual(126)&&this.isPotentialImportPhase(!1))Y=this.parseMaybeImportPhase(G,!1);else G.importKind="value";let V=this.tsParseImportEqualsDeclaration(G,Y);return Q.attributes=[],Q.declaration=V,Q.exportKind="value",Q.source=null,Q.specifiers=[],this.finishNode(Q,"ExportNamedDeclaration")}else if(this.eat(25)){let G=Q;if(G.expression=super.parseExpression(),this.semicolon(),this.sawUnambiguousESM=!0,this.scope.inTSNamespace)this.raise(U0.ExportAssignmentInTSNamespace,G);return this.finishNode(G,"TSExportAssignment")}else if(this.eatContextual(89)){let G=Q;if(this.expectContextual(124),G.id=this.parseIdentifier(),this.checkIdentifier(G.id,8201),this.semicolon(),this.scope.inTSNamespace)this.raise(U0.NamespaceExportInTSNamespace,G);return this.finishNode(G,"TSNamespaceExportDeclaration")}else{let G=super.parseExport(Q,Z);if(this.scope.inTSNamespace&&(G.type!=="ExportNamedDeclaration"||G.source||!G.declaration&&!this.state.isAmbientContext))this.raise(U0.ExportInTSNamespace,G);return G}}isAbstractClass(){return this.isContextual(120)&&this.isLookaheadContextual("class")}parseExportDefaultExpression(){if(this.isAbstractClass()){let Q=this.startNode();return this.next(),Q.abstract=!0,this.parseClass(Q,!0,!0)}if(this.match(125)){let Q=this.tsParseInterfaceDeclaration(this.startNode());if(Q)return Q}return super.parseExportDefaultExpression()}parseVarStatement(Q,Z,G=!1){let{isAmbientContext:Y}=this.state,V=super.parseVarStatement(Q,Z,G||Y);if(Y&&!Q.declare&&(Z==="using"||Z==="await using"))return this.raiseOverwrite(U0.UsingDeclarationInAmbientContext,Q,Z),V;for(let K of V.declarations){let{id:H,init:W,definite:U}=K;if(U){if(W)this.raise(U0.DeclaratorDefiniteAssertionWithInitializer,H);else if(!H.typeAnnotation)this.raise(U0.DeclaratorDefiniteAssertionRequiresTypeAnnotation,H)}if(Y&&W){if(Z==="var"||Z==="let"||!!H.typeAnnotation)this.raise(U0.InitializerNotAllowedInAmbientContext,W);else if(!kQ0(W,this.hasPlugin("estree")))this.raise(U0.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference,W)}}return V}parseStatementContent(Q,Z){let G=!!(Q&2);if(!this.state.containsEsc)switch(this.state.type){case 71:{if(this.isLookaheadContextual("enum")){let Y=this.startNode();return this.next(),this.tsParseEnumDeclaration(Y,{const:!0})}break}case 120:case 121:{if(this.nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine()){let Y=this.state.type,V=this.startNode();this.next();let K=Y===121?this.tsTryParseDeclare(V):this.tsParseAbstractDeclaration(V,Z);if(K){if(Y===121)K.declare=!0;return K}else return V.expression=this.createIdentifier(this.startNodeAtNode(V),Y===121?"declare":"abstract"),this.semicolon(!1),this.finishNode(V,"ExpressionStatement")}break}case 122:return this.tsParseEnumDeclaration(this.startNode());case 108:{if(this.lookaheadCharCode()===123){let V=this.startNode();return this.tsParseAmbientExternalModuleDeclaration(V)}break}case 125:{let Y=this.tsParseInterfaceDeclaration(this.startNode());if(Y){if(!G)this.raise(U0.UnexpectedTypeDeclaration,Y,"interface");return Y}break}case 123:{if(this.nextTokenIsStringLiteralOnSameLine()){let Y=this.startNode();return this.next(),this.tsParseDeclaration(Y,123,!1,Z)}else if(this.nextTokenIsIdentifierOnSameLine()){this.raise(U0.InlineModuleDeclarationMustUseString,this.state.startLoc);let Y=this.startNode();return this.next(),this.tsParseDeclaration(Y,124,!1,Z)}break}case 124:{if(this.nextTokenIsIdentifierOnSameLine()){let Y=this.startNode();return this.next(),this.tsParseDeclaration(Y,124,!1,Z)}break}case 126:{if(this.nextTokenIsIdentifierOnSameLine()){let Y=this.startNode();if(!G)this.raise(U0.UnexpectedTypeDeclaration,Y,"type");return this.next(),this.tsParseTypeAliasDeclaration(Y)}break}}return super.parseStatementContent(Q,Z)}parseAccessModifier(){return this.tsParseModifier(EQ0)}tsHasSomeModifiers(Q,Z){return Z.some((G)=>{if(KP(G))return Q.accessibility===G;return!!Q[G]})}tsIsStartOfStaticBlocks(){return this.isContextual(102)&&this.lookaheadCharCode()===123}parseClassMember(Q,Z,G){this.tsParseModifiers(RQ0,U0.InvalidModifierOnTypeParameterPositions,Z,!0);let Y=()=>{if(this.tsIsStartOfStaticBlocks()){if(this.next(),this.next(),this.tsHasSomeModifiers(Z,["declare","private","public","protected","override","abstract","readonly","static"]))this.raise(U0.StaticBlockCannotHaveModifier,this.state.curPosition());super.parseClassStaticBlock(Q,Z)}else this.parseClassMemberWithIsStatic(Q,Z,G,!!Z.static)};if(Z.declare)this.tsInAmbientContext(Y);else Y();if(Z.decorators&&Z.decorators.length>0&&!this.hasPlugin("decorators-legacy")){if(Z.type==="TSAbstractMethodDefinition"||Z.type==="TSDeclareMethod")this.raise(U0.DecoratorAbstractMethod,Z,{kind:"abstract method"});else if(Z.type==="ClassProperty"&&Z.abstract||Z.type==="ClassProperty"&&Z.declare||Z.type==="TSAbstractPropertyDefinition"||Z.type==="PropertyDefinition"&&Z.declare)this.raise(U0.DecoratorAbstractMethod,Z,{kind:Z.declare?"declare field":"abstract field"})}}parseClassMemberWithIsStatic(Q,Z,G,Y){let V=this.tsTryParseIndexSignature(Z);if(V){if(Q.body.push(V),Z.abstract)this.raise(U0.IndexSignatureHasAbstract,Z);if(Z.accessibility)this.raise(U0.IndexSignatureHasAccessibility,Z,{modifier:Z.accessibility});if(Z.declare)this.raise(U0.IndexSignatureHasDeclare,Z);if(Z.override)this.raise(U0.IndexSignatureHasOverride,Z);return}if(!this.state.inAbstractClass&&Z.abstract)this.raise(U0.NonAbstractClassHasAbstractMethod,Z);if(Z.override){if(!G.hadSuperClass)this.raise(U0.OverrideNotInSubClass,Z)}super.parseClassMemberWithIsStatic(Q,Z,G,Y)}parsePostMemberNameModifiers(Q){if(this.eat(13))Q.optional=!0;if(Q.readonly&&this.match(6))this.raise(U0.ClassMethodHasReadonly,Q);if(Q.declare&&this.match(6))this.raise(U0.ClassMethodHasDeclare,Q)}shouldParseExportDeclaration(){if(this.tsIsDeclarationStart())return!0;return super.shouldParseExportDeclaration()}parseConditional(Q,Z,G){if(!this.match(13))return Q;if(G!=null){let K=this.lookaheadCharCode();if(K===44||K===61||K===58||K===41)return this.setOptionalParametersError(G),Q}this.next();let Y=this.startNodeAt(Z);Y.test=Q;let V=this.state.inConditionalConsequent;return this.state.inConditionalConsequent=!0,Y.consequent=this.parseMaybeAssignAllowIn(),this.state.inConditionalConsequent=V,this.expect(10),Y.alternate=this.parseMaybeAssign(),this.finishNode(Y,"ConditionalExpression")}parseParenItem(Q,Z){let G=super.parseParenItem(Q,Z);if(this.eat(13))G.optional=!0,this.resetEndLocation(Q);if(this.match(10)){let Y=this.startNodeAt(Z);return Y.expression=Q,Y.typeAnnotation=this.tsParseTypeAnnotation(),this.finishNode(Y,"TSTypeCastExpression")}return Q}parseExportDeclaration(Q){if(!this.state.isAmbientContext&&this.isContextual(121))return this.tsInAmbientContext(()=>this.parseExportDeclaration(Q));let Z=this.state.startLoc,G=this.eatContextual(121);if(G&&(this.isContextual(121)||!this.shouldParseExportDeclaration()))throw this.raise(U0.ExpectedAmbientAfterExportDeclare,this.state.startLoc);let V=R5(this.state.type)&&this.tsTryParseExportDeclaration()||super.parseExportDeclaration(Q);if(!V)return null;if(V.type==="TSInterfaceDeclaration"||V.type==="TSTypeAliasDeclaration"||G)Q.exportKind="type";if(G&&V.type!=="TSImportEqualsDeclaration")this.resetStartLocation(V,Z),V.declare=!0;return V}parseClassId(Q,Z,G,Y){if((!Z||G)&&this.isContextual(109)){Q.id=null;return}super.parseClassId(Q,Z,G,Q.declare?1024:8331);let V=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);if(V)Q.typeParameters=V}parseClassPropertyAnnotation(Q){if(!Q.optional){if(this.eat(31))Q.definite=!0;else if(this.eat(13))Q.optional=!0}let Z=this.tsTryParseTypeAnnotation();if(Z)Q.typeAnnotation=Z;if(Q.definite){if(this.match(25))this.raise(U0.DeclaratorDefiniteAssertionWithInitializer,Q);else if(!Z)this.raise(U0.DeclaratorDefiniteAssertionRequiresTypeAnnotation,Q)}}parseClassProperty(Q){if(this.parseClassPropertyAnnotation(Q),this.state.isAmbientContext&&!(Q.readonly&&!Q.typeAnnotation)&&this.match(25))this.raise(U0.DeclareClassFieldHasInitializer,this.state.startLoc);if(Q.abstract&&this.match(25)){let{key:Z}=Q;this.raise(U0.AbstractPropertyHasInitializer,this.state.startLoc,{propertyName:Z.type==="Identifier"&&!Q.computed?Z.name:`[${this.input.slice(this.offsetToSourcePos(Z.start),this.offsetToSourcePos(Z.end))}]`})}return super.parseClassProperty(Q)}parseClassPrivateProperty(Q){if(Q.abstract)this.raise(U0.PrivateElementHasAbstract,Q);if(Q.accessibility)this.raise(U0.PrivateElementHasAccessibility,Q,{modifier:Q.accessibility});return this.parseClassPropertyAnnotation(Q),super.parseClassPrivateProperty(Q)}parseClassAccessorProperty(Q){if(this.parseClassPropertyAnnotation(Q),Q.optional)this.raise(U0.AccessorCannotBeOptional,Q);return super.parseClassAccessorProperty(Q)}pushClassMethod(Q,Z,G,Y,V,K){let H=this.tsTryParseTypeParameters(this.tsParseConstModifier);if(H&&V)this.raise(U0.ConstructorHasTypeParameters,H);let{declare:W=!1,kind:U}=Z;if(W&&(U==="get"||U==="set"))this.raise(U0.DeclareAccessor,Z,{kind:U});if(H)Z.typeParameters=H;super.pushClassMethod(Q,Z,G,Y,V,K)}pushClassPrivateMethod(Q,Z,G,Y){let V=this.tsTryParseTypeParameters(this.tsParseConstModifier);if(V)Z.typeParameters=V;super.pushClassPrivateMethod(Q,Z,G,Y)}declareClassPrivateMethodInScope(Q,Z){if(Q.type==="TSDeclareMethod")return;if(Q.type==="MethodDefinition"&&Q.value.body==null)return;super.declareClassPrivateMethodInScope(Q,Z)}parseClassSuper(Q){if(super.parseClassSuper(Q),Q.superClass){if(Q.superClass.type==="TSInstantiationExpression"){let Z=Q.superClass,G=Z.expression;this.takeSurroundingComments(G,G.start,G.end);let Y=Z.typeArguments;this.takeSurroundingComments(Y,Y.start,Y.end),Q.superClass=G,Q.superTypeArguments=Y}else if(this.match(43)||this.match(47))Q.superTypeArguments=this.tsParseTypeArgumentsInExpression()}if(this.eatContextual(109))Q.implements=this.tsParseHeritageClause("implements")}parseObjPropValue(Q,Z,G,Y,V,K,H){let W=this.tsTryParseTypeParameters(this.tsParseConstModifier);if(W)Q.typeParameters=W;return super.parseObjPropValue(Q,Z,G,Y,V,K,H)}parseFunctionParams(Q,Z){let G=this.tsTryParseTypeParameters(this.tsParseConstModifier);if(G)Q.typeParameters=G;super.parseFunctionParams(Q,Z)}parseVarId(Q,Z){if(super.parseVarId(Q,Z),Q.id.type==="Identifier"&&!this.hasPrecedingLineBreak()&&this.eat(31))Q.definite=!0;let G=this.tsTryParseTypeAnnotation();if(G)Q.id.typeAnnotation=G,this.resetEndLocation(Q.id)}parseAsyncArrowFromCallExpression(Q,Z){if(this.match(10))Q.returnType=this.tsParseTypeAnnotation();return super.parseAsyncArrowFromCallExpression(Q,Z)}parseMaybeAssign(Q,Z){let G,Y,V;if(this.hasPlugin("jsx")&&(this.match(138)||this.match(43))){if(G=this.state.clone(),Y=this.tryParse(()=>super.parseMaybeAssign(Q,Z),G),!Y.error)return Y.node;let{context:W}=this.state,U=W[W.length-1];if(U===l5.j_oTag||U===l5.j_expr)W.pop()}if(!Y?.error&&!this.match(43))return super.parseMaybeAssign(Q,Z);if(!G||G===this.state)G=this.state.clone();let K,H=this.tryParse((W)=>{K=this.tsParseTypeParameters(this.tsParseConstModifier);let U=super.parseMaybeAssign(Q,Z);if(U.type!=="ArrowFunctionExpression"||U.extra?.parenthesized)W();if(K?.params.length!==0)this.resetStartLocationFromNode(U,K);if(U.typeParameters=K,this.hasPlugin("jsx")&&U.typeParameters.params.length===1&&!U.typeParameters.extra?.trailingComma){let z=U.typeParameters.params[0];if(!z.constraint)this.raise(U0.SingleTypeParameterWithoutTrailingComma,this.optionFlags&256?g7(z.loc.end,1):z,{typeParameterName:z.name.name})}return U},G);if(!H.error&&!H.aborted){if(K)this.reportReservedArrowTypeParam(K);return H.node}if(!Y){if(VP(!this.hasPlugin("jsx")),V=this.tryParse(()=>super.parseMaybeAssign(Q,Z),G),!V.error)return V.node}if(Y?.node)return this.state=Y.failState,Y.node;if(H.node){if(this.state=H.failState,K)this.reportReservedArrowTypeParam(K);return H.node}if(V?.node)return this.state=V.failState,V.node;throw Y?.error||H.error||V?.error}reportReservedArrowTypeParam(Q){if(Q.params.length===1&&!Q.params[0].constraint&&!Q.extra?.trailingComma&&this.getPluginOption("typescript","disallowAmbiguousJSXLike"))this.raise(U0.ReservedArrowTypeParam,Q)}parseMaybeUnary(Q,Z){if(!this.hasPlugin("jsx")&&this.match(43))return this.tsParseTypeAssertion();return super.parseMaybeUnary(Q,Z)}parseArrow(Q){if(this.match(10)){let Z=this.tryParse((G)=>{let Y=this.tsParseTypeOrTypePredicateAnnotation(10);if(this.canInsertSemicolon()||!this.match(15))G();return Y});if(Z.aborted)return;if(!Z.thrown){if(Z.error)this.state=Z.failState;Q.returnType=Z.node}}return super.parseArrow(Q)}parseFunctionParamType(Q){if(this.eat(13))Q.optional=!0;let Z=this.tsTryParseTypeAnnotation();if(Z)Q.typeAnnotation=Z;return this.resetEndLocation(Q),Q}isAssignable(Q,Z){switch(Q.type){case"TSTypeCastExpression":return this.isAssignable(Q.expression,Z);case"TSParameterProperty":return!0;default:return super.isAssignable(Q,Z)}}toAssignable(Q,Z=!1){switch(Q.type){case"ParenthesizedExpression":this.toAssignableParenthesizedExpression(Q,Z);break;case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":if(Z)this.expressionScope.recordArrowParameterBindingError(U0.UnexpectedTypeCastInParameter,Q);else this.raise(U0.UnexpectedTypeCastInParameter,Q);this.toAssignable(Q.expression,Z);break;case"AssignmentExpression":if(!Z&&Q.left.type==="TSTypeCastExpression")Q.left=this.typeCastToParameter(Q.left);default:super.toAssignable(Q,Z)}}toAssignableParenthesizedExpression(Q,Z){switch(Q.expression.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":case"ParenthesizedExpression":this.toAssignable(Q.expression,Z);break;default:super.toAssignable(Q,Z)}}checkToRestConversion(Q,Z){switch(Q.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":this.checkToRestConversion(Q.expression,!1);break;default:super.checkToRestConversion(Q,Z)}}isValidLVal(Q,Z,G,Y){switch(Q){case"TSTypeCastExpression":return!0;case"TSParameterProperty":return"parameter";case"TSNonNullExpression":return"expression";case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":return(Y!==64||!G)&&["expression",!0];default:return super.isValidLVal(Q,Z,G,Y)}}parseBindingAtom(){if(this.state.type===74)return this.parseIdentifier(!0);return super.parseBindingAtom()}parseMaybeDecoratorArguments(Q,Z){if(this.match(43)||this.match(47)){let G=this.tsParseTypeArgumentsInExpression();if(this.match(6)){let Y=super.parseMaybeDecoratorArguments(Q,Z);return Y.typeArguments=G,Y}this.unexpected(null,6)}return super.parseMaybeDecoratorArguments(Q,Z)}checkCommaAfterRest(Q){if(this.state.isAmbientContext&&this.match(8)&&this.lookaheadCharCode()===Q)return this.next(),!1;return super.checkCommaAfterRest(Q)}isClassMethod(){return this.match(43)||super.isClassMethod()}isClassProperty(){return this.match(31)||this.match(10)||super.isClassProperty()}parseMaybeDefault(Q,Z){let G=super.parseMaybeDefault(Q,Z);if(G.type==="AssignmentPattern"&&G.typeAnnotation&&G.right.start<G.typeAnnotation.start)this.raise(U0.TypeAnnotationAfterAssign,G.typeAnnotation);return G}getTokenFromCode(Q){if(this.state.inType){if(Q===62){this.finishOp(44,1);return}if(Q===60){this.finishOp(43,1);return}}super.getTokenFromCode(Q)}reScan_lt_gt(){let{type:Q}=this.state;if(Q===43)this.state.pos-=1,this.readToken_lt();else if(Q===44)this.state.pos-=1,this.readToken_gt()}reScan_lt(){let{type:Q}=this.state;if(Q===47)return this.state.pos-=2,this.finishOp(43,1),43;return Q}toAssignableListItem(Q,Z,G){let Y=Q[Z];if(Y.type==="TSTypeCastExpression")Q[Z]=this.typeCastToParameter(Y);super.toAssignableListItem(Q,Z,G)}typeCastToParameter(Q){return Q.expression.typeAnnotation=Q.typeAnnotation,this.resetEndLocationFromNode(Q.expression,Q.typeAnnotation),Q.expression}shouldParseArrow(Q){if(this.match(10))return Q.every((Z)=>this.isAssignable(Z,!0));return super.shouldParseArrow(Q)}shouldParseAsyncArrow(){if(this.match(10)){if(this.state.inConditionalConsequent)return!1;return!0}return super.shouldParseAsyncArrow()}parseParenAndDistinguishExpression(Q){let Z=this.state.inConditionalConsequent;this.state.inConditionalConsequent=!1;let G=super.parseParenAndDistinguishExpression(Q);return this.state.inConditionalConsequent=Z,G}canHaveLeadingDecorator(){return super.canHaveLeadingDecorator()||this.isAbstractClass()}jsxParseOpeningElementAfterName(Q){if(this.match(43)||this.match(47)){let Z=this.tsTryParseAndCatch(()=>this.tsParseTypeArgumentsInExpression());if(Z)Q.typeArguments=Z}return super.jsxParseOpeningElementAfterName(Q)}getGetterSetterExpectedParamCount(Q){let Z=super.getGetterSetterExpectedParamCount(Q),Y=this.getObjectOrClassMethodParams(Q)[0];return Y&&this.isThisParam(Y)?Z+1:Z}parseCatchClauseParam(){let Q=super.parseCatchClauseParam(),Z=this.tsTryParseTypeAnnotation();if(Z)Q.typeAnnotation=Z,this.resetEndLocation(Q);return Q}tsInAmbientContext(Q){let{isAmbientContext:Z,strict:G}=this.state;this.state.isAmbientContext=!0,this.state.strict=!1;try{return Q()}finally{this.state.isAmbientContext=Z,this.state.strict=G}}parseClass(Q,Z,G){let Y=this.state.inAbstractClass;this.state.inAbstractClass=!!Q.abstract;try{return super.parseClass(Q,Z,G)}finally{this.state.inAbstractClass=Y}}tsParseAbstractDeclaration(Q,Z){if(this.match(76))return Q.abstract=!0,this.maybeTakeDecorators(Z,this.parseClass(Q,!0,!1));else if(this.isContextual(125))if(!this.hasFollowingLineBreak())return Q.abstract=!0,this.raise(U0.NonClassMethodPropertyHasAbstractModifier,Q),this.tsParseInterfaceDeclaration(Q);else return null;throw this.unexpected(null,76)}parseMethod(Q,Z,G,Y,V,K,H){let W=super.parseMethod(Q,Z,G,Y,V,K,H);if(W.abstract||W.type==="TSAbstractMethodDefinition"){if((this.hasPlugin("estree")?W.value:W).body){let{key:q}=W;this.raise(U0.AbstractMethodHasImplementation,W,{methodName:q.type==="Identifier"&&!W.computed?q.name:`[${this.input.slice(this.offsetToSourcePos(q.start),this.offsetToSourcePos(q.end))}]`})}}return W}tsParseTypeParameterName(){return this.parseIdentifier()}shouldParseAsAmbientContext(){return!!this.getPluginOption("typescript","dts")}parse(){if(this.shouldParseAsAmbientContext())this.state.isAmbientContext=!0;return super.parse()}getExpression(){if(this.shouldParseAsAmbientContext())this.state.isAmbientContext=!0;return super.getExpression()}parseExportSpecifier(Q,Z,G,Y){if(!Z&&Y)return this.parseTypeOnlyExportSpecifier(Q,G),this.finishNode(Q,"ExportSpecifier");return Q.exportKind="value",super.parseExportSpecifier(Q,Z,G,Y)}parseImportSpecifier(Q,Z,G,Y,V){if(!Z&&Y)return this.parseTypeOnlyImportSpecifier(Q,G),this.finishNode(Q,"ImportSpecifier");return Q.importKind="value",super.parseImportSpecifier(Q,Z,G,Y,G?4098:4096)}parseTypeOnlyImportSpecifier(Q,Z){let G=Q.imported,Y=!1;if(this.isContextual(89)){let V=this.parseIdentifier();if(this.isContextual(89)){let K=this.parseIdentifier();if(s8(this.state.type))Y=!0,G=V,Q.local=this.parseIdentifier();else Q.local=K}else if(s8(this.state.type))Q.local=this.parseIdentifier();else Y=!0,G=V}else if(s8(this.state.type)){if(Y=!0,G=this.parseIdentifier(!0),!this.isContextual(89))this.checkReservedWord(G.name,G.start,!0,!0)}if(Y&&Z)this.raise(U0.TypeModifierIsUsedInTypeImports,Q.imported);Q.imported=G,Q.importKind=Y?"type":"value",this.checkIdentifier(Q.local??=this.eatContextual(89)?this.parseIdentifier():this.cloneIdentifier(Q.imported),Y?4098:4096)}parseTypeOnlyExportSpecifier(Q,Z){let G=Q.local,Y=!1;if(this.isContextual(89)){let V=this.parseIdentifier();if(this.isContextual(89)){let K=this.parseIdentifier();if(s8(this.state.type))Y=!0,Q.local=V,Q.exported=this.parseModuleExportName();else Q.exported=K}else if(s8(this.state.type))Q.exported=this.parseModuleExportName();else Y=!0,Q.local=V}else if(s8(this.state.type))Y=!0,Q.local=this.parseModuleExportName();if(Y&&Z)this.raise(U0.TypeModifierIsUsedInTypeExports,G);Q.exportKind=Y?"type":"value",Q.exported??=this.eatContextual(89)?this.parseModuleExportName():this.cloneIdentifier(Q.local)}fillOptionalPropertiesForTSESLint(Q){switch(Q.type){case"ImportDeclaration":Q.phase??=null;return;case"ExpressionStatement":Q.directive??=void 0;return;case"RestElement":Q.value=void 0;case"Identifier":case"ArrayPattern":case"AssignmentPattern":case"ObjectPattern":Q.decorators??=[],Q.optional??=!1,Q.typeAnnotation??=void 0;return;case"TSParameterProperty":Q.accessibility??=void 0,Q.decorators??=[],Q.override??=!1,Q.readonly??=!1,Q.static??=!1;return;case"TSEmptyBodyFunctionExpression":Q.body=null;case"TSDeclareFunction":case"FunctionDeclaration":case"FunctionExpression":case"ClassMethod":case"ClassPrivateMethod":Q.declare??=!1,Q.returnType??=void 0,Q.typeParameters??=void 0;return;case"Property":Q.optional??=!1;return;case"TSMethodSignature":case"TSPropertySignature":Q.optional??=!1;case"TSIndexSignature":Q.accessibility??=void 0,Q.readonly??=!1,Q.static??=!1;return;case"TSAbstractPropertyDefinition":case"PropertyDefinition":case"TSAbstractAccessorProperty":case"AccessorProperty":Q.declare??=!1,Q.definite??=!1,Q.readonly??=!1,Q.typeAnnotation??=void 0;case"TSAbstractMethodDefinition":case"MethodDefinition":Q.accessibility??=void 0,Q.decorators??=[],Q.override??=!1,Q.optional??=!1;return;case"ClassExpression":Q.id??=null;case"ClassDeclaration":Q.abstract??=!1,Q.declare??=!1,Q.decorators??=[],Q.implements??=[],Q.superTypeArguments??=void 0,Q.typeParameters??=void 0;return;case"TSTypeAliasDeclaration":case"VariableDeclaration":Q.declare??=!1;return;case"VariableDeclarator":Q.definite??=!1;return;case"TSEnumDeclaration":Q.const??=!1,Q.declare??=!1;return;case"TSEnumMember":Q.computed??=!1;return;case"TSImportType":Q.qualifier??=null,Q.options??=null,Q.typeArguments??=null;return;case"TSInterfaceDeclaration":Q.declare??=!1,Q.extends??=[];return;case"TSMappedType":Q.optional??=!1,Q.readonly??=void 0;return;case"TSModuleDeclaration":Q.declare??=!1,Q.global??=Q.kind==="global";return;case"TSTypeParameter":Q.const??=!1,Q.in??=!1,Q.out??=!1;return}}chStartsBindingIdentifierAndNotRelationalOperator(Q,Z){if(u9(Q)){if(AL.lastIndex=Z,AL.test(this.input)){let G=this.codePointAtPos(AL.lastIndex);if(!eX(G)&&G!==92)return!1}return!0}else if(Q===92)return!0;else return!1}nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine(){let Q=this.nextTokenInLineStart(),Z=this.codePointAtPos(Q);return this.chStartsBindingIdentifierAndNotRelationalOperator(Z,Q)}nextTokenIsStringLiteralOnSameLine(){let Q=this.nextTokenInLineStart(),Z=this.codePointAtPos(Q);return Z===34||Z===39}};function wQ0(X){if(X.type!=="MemberExpression")return!1;let{computed:J,property:Q}=X;if(J&&Q.type!=="StringLiteral"&&(Q.type!=="TemplateLiteral"||Q.expressions.length>0))return!1;return uP(X.object)}function kQ0(X,J){let{type:Q}=X;if(X.extra?.parenthesized)return!1;if(J){if(Q==="Literal"){let{value:Z}=X;if(typeof Z==="string"||typeof Z==="boolean")return!0}}else if(Q==="StringLiteral"||Q==="BooleanLiteral")return!0;if(mP(X,J)||FQ0(X,J))return!0;if(Q==="TemplateLiteral"&&X.expressions.length===0)return!0;if(wQ0(X))return!0;return!1}function mP(X,J){if(J)return X.type==="Literal"&&(typeof X.value==="number"||("bigint"in X));return X.type==="NumericLiteral"||X.type==="BigIntLiteral"}function FQ0(X,J){if(X.type==="UnaryExpression"){let{operator:Q,argument:Z}=X;if(Q==="-"&&mP(Z,J))return!0}return!1}function uP(X){if(X.type==="Identifier")return!0;if(X.type!=="MemberExpression"||X.computed)return!1;return uP(X.object)}function X1(X,J=[]){let Q=new Map;for(let Z of X)Q.set(Z,!0);for(let Z of J)Q.set(Z,!1);return Q}var PQ0={ClassNameIsRequired:"A class name is required.",UnexpectedSpace:"Unexpected space in placeholder."},WP=Z9`placeholders`(PQ0),DQ0=(X)=>class J extends X{parsePlaceholder(Q){if(this.match(129)){let Z=this.startNode();return this.next(),this.assertNoSpace(),Z.name=super.parseIdentifier(!0),this.assertNoSpace(),this.expect(129),this.finishPlaceholder(Z,Q)}}finishPlaceholder(Q,Z){let G=Q;if(!G.expectedNode||!G.type)G=this.finishNode(G,"Placeholder");return G.expectedNode=Z,G}getTokenFromCode(Q){if(Q===37&&this.input.charCodeAt(this.state.pos+1)===37)this.finishOp(129,2);else super.getTokenFromCode(Q)}parseExprAtom(Q){return this.parsePlaceholder("Expression")||super.parseExprAtom(Q)}parseIdentifier(Q){return this.parsePlaceholder("Identifier")||super.parseIdentifier(Q)}checkReservedWord(Q,Z,G,Y){if(Q!==void 0)super.checkReservedWord(Q,Z,G,Y)}cloneIdentifier(Q){let Z=super.cloneIdentifier(Q);if(Z.type==="Placeholder")Z.expectedNode=Q.expectedNode;return Z}cloneStringLiteral(Q){if(Q.type==="Placeholder")return this.cloneIdentifier(Q);return super.cloneStringLiteral(Q)}parseBindingAtom(){return this.parsePlaceholder("Pattern")||super.parseBindingAtom()}isValidLVal(Q,Z,G,Y){return Q==="Placeholder"||super.isValidLVal(Q,Z,G,Y)}toAssignable(Q,Z){if(Q&&Q.type==="Placeholder"&&Q.expectedNode==="Expression")Q.expectedNode="Pattern";else super.toAssignable(Q,Z)}chStartsBindingIdentifier(Q,Z){if(super.chStartsBindingIdentifier(Q,Z))return!0;let G=this.nextTokenStart();if(this.input.charCodeAt(G)===37&&this.input.charCodeAt(G+1)===37)return!0;return!1}verifyBreakContinue(Q,Z){if(Q.label?.type==="Placeholder")return;super.verifyBreakContinue(Q,Z)}parseExpressionStatement(Q,Z){if(Z.type!=="Placeholder"||Z.extra?.parenthesized)return super.parseExpressionStatement(Q,Z);if(this.match(10)){let Y=Q;return Y.label=this.finishPlaceholder(Z,"Identifier"),this.next(),Y.body=super.parseStatementOrSloppyAnnexBFunctionDeclaration(),this.finishNode(Y,"LabeledStatement")}this.semicolon();let G=Q;return G.name=Z.name,this.finishPlaceholder(G,"Statement")}parseBlock(Q,Z,G){return this.parsePlaceholder("BlockStatement")||super.parseBlock(Q,Z,G)}parseFunctionId(Q){return this.parsePlaceholder("Identifier")||super.parseFunctionId(Q)}parseClass(Q,Z,G){let Y=Z?"ClassDeclaration":"ClassExpression";this.next();let V=this.state.strict,K=this.parsePlaceholder("Identifier");if(K)if(this.match(77)||this.match(129)||this.match(2))Q.id=K;else if(G||!Z)return Q.id=null,Q.body=this.finishPlaceholder(K,"ClassBody"),this.finishNode(Q,Y);else throw this.raise(WP.ClassNameIsRequired,this.state.startLoc);else this.parseClassId(Q,Z,G);return super.parseClassSuper(Q),Q.body=this.parsePlaceholder("ClassBody")||super.parseClassBody(!!Q.superClass,V),this.finishNode(Q,Y)}parseExport(Q,Z){let G=this.parsePlaceholder("Identifier");if(!G)return super.parseExport(Q,Z);let Y=Q;if(!this.isContextual(94)&&!this.match(8))return Y.specifiers=[],Y.source=null,Y.declaration=this.finishPlaceholder(G,"Declaration"),this.finishNode(Y,"ExportNamedDeclaration");this.expectPlugin("exportDefaultFrom");let V=this.startNode();return V.exported=G,Y.specifiers=[this.finishNode(V,"ExportDefaultSpecifier")],super.parseExport(Y,Z)}isExportDefaultSpecifier(){if(this.match(61)){let Q=this.nextTokenStart();if(this.isUnparsedContextual(Q,"from")){if(this.input.startsWith(x4(129),this.nextTokenStartSince(Q+4)))return!0}}return super.isExportDefaultSpecifier()}maybeParseExportDefaultSpecifier(Q,Z){if(Q.specifiers?.length)return!0;return super.maybeParseExportDefaultSpecifier(Q,Z)}checkNamedExport(){}parseImport(Q){let Z=this.parsePlaceholder("Identifier");if(!Z)return super.parseImport(Q);if(Q.specifiers=[],!this.isContextual(94)&&!this.match(8))return Q.source=this.finishPlaceholder(Z,"StringLiteral"),this.semicolon(),this.finishNode(Q,"ImportDeclaration");let G=this.startNodeAtNode(Z);if(G.local=Z,Q.specifiers.push(this.finishNode(G,"ImportDefaultSpecifier")),this.eat(8)){if(!this.maybeParseStarImportSpecifier(Q))this.parseNamedImportSpecifiers(Q)}return this.expectContextual(94),Q.source=this.parseImportSource(),this.semicolon(),this.finishNode(Q,"ImportDeclaration")}parseImportSource(){return this.parsePlaceholder("StringLiteral")||super.parseImportSource()}assertNoSpace(){if(this.state.start>this.offsetToSourcePos(this.state.lastTokEndLoc.index))this.raise(WP.UnexpectedSpace,this.state.lastTokEndLoc)}},yQ0=(X)=>class J extends X{parseV8Intrinsic(){if(this.match(50)){let Q=this.state.startLoc,Z=this.startNode();if(this.next(),R5(this.state.type)){let G=this.parseIdentifierName(),Y=this.createIdentifier(Z,G);if(this.castNodeTo(Y,"V8IntrinsicIdentifier"),this.match(6))return Y}this.unexpected(Q)}}parseExprAtom(Q){return this.parseV8Intrinsic()||super.parseExprAtom(Q)}},HP=["fsharp","hack"],UP=["^^","@@","^","%","#"];function xQ0(X){if(X.has("decorators")){if(X.has("decorators-legacy"))throw Error("Cannot use the decorators and decorators-legacy plugin together")}if(X.has("flow")&&X.has("typescript"))throw Error("Cannot combine flow and typescript plugins.");if(X.has("placeholders")&&X.has("v8intrinsic"))throw Error("Cannot combine placeholders and v8intrinsic plugins.");if(X.has("pipelineOperator")){let J=X.get("pipelineOperator").proposal;if(!HP.includes(J)){let Q=HP.map((Z)=>`"${Z}"`).join(", ");throw Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${Q}.`)}if(J==="hack"){if(X.has("placeholders"))throw Error("Cannot combine placeholders plugin and Hack-style pipes.");if(X.has("v8intrinsic"))throw Error("Cannot combine v8intrinsic plugin and Hack-style pipes.");let Q=X.get("pipelineOperator").topicToken;if(!UP.includes(Q)){let Z=UP.map((G)=>`"${G}"`).join(", ");throw Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${Z}.`)}}}if(X.has("moduleAttributes"))throw Error("`moduleAttributes` has been removed in Babel 8, please migrate to import attributes instead.");if(X.has("importAssertions"))throw Error("`importAssertions` has been removed in Babel 8, please use import attributes instead.");if(X.has("deprecatedImportAssert"))console.warn("`deprecatedImportAssert` has been removed in Babel 8, please use import attributes instead.");else if(X.has("importAttributes")&&X.get("importAttributes").deprecatedAssertSyntax)console.warn("The 'importAttributes' plugin has been removed in Babel 8. Please migrate any usage of `assert`-style attributes to `with`.");if(X.has("recordAndTuple"))throw Error("The 'recordAndTuple' plugin has been removed in Babel 8. Please remove it from your configuration.");if(X.has("asyncDoExpressions")&&!X.has("doExpressions")){let J=Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.");throw J.missingPlugins="doExpressions",J}if(X.has("optionalChainingAssign")&&X.get("optionalChainingAssign").version!=="2023-07")throw Error("The 'optionalChainingAssign' plugin requires a 'version' option, representing the last proposal update. Currently, the only supported value is '2023-07'.");if(X.has("discardBinding")&&X.get("discardBinding").syntaxType!=="void")throw Error("The 'discardBinding' plugin requires a 'syntaxType' option. Currently the only supported value is 'void'.");if(X.has("decimal"))throw Error("The 'decimal' plugin has been removed in Babel 8. Please remove it from your configuration.");if(X.has("importReflection"))throw Error("The 'importReflection' plugin has been removed in Babel 8. Use 'sourcePhaseImports' instead, and replace 'import module' with 'import source' in your code.")}var pP={estree:D10,jsx:KQ0,flow:ZQ0,typescript:CQ0,v8intrinsic:yQ0,placeholders:DQ0},gQ0=Object.keys(pP);class pL extends _P{constructor(X,J,Q){let Z=P10(X);super(Z,J);this.options=Z,this.initializeScopes(),this.plugins=Q,this.filename=Z.sourceFilename,this.startIndex=Z.startIndex;let G=0;if(Z.allowAwaitOutsideFunction)G|=1;if(Z.allowReturnOutsideFunction)G|=2;if(Z.allowImportExportEverywhere)G|=8;if(Z.allowSuperOutsideMethod)G|=16;if(Z.allowUndeclaredExports)G|=64;if(Z.allowNewTargetOutsideFunction)G|=4;if(Z.allowYieldOutsideFunction)G|=32;if(Z.ranges)G|=128;if(Z.locations===!0)G|=256;if(Z.tokens)G|=512;if(Z.createImportExpressions)G|=1024;if(Z.createParenthesizedExpressions)G|=2048;if(Z.errorRecovery)G|=4096;if(Z.attachComment)G|=8192;if(Z.annexB)G|=16384;this.optionFlags=G}getScopeHandler(){return uW}parse(){this.enterInitialScopes();let X=this.startNode(),J=this.startNode();this.nextToken(),X.errors=[];let Q=this.parseTopLevel(X,J);return Q.errors=this.state.errors,Q.comments.length=this.state.commentsLen,Q}}function cP(X,J){if(J?.sourceType==="unambiguous"){J={...J};try{J.sourceType="module";let Q=hW(J,X),Z=Q.parse();if(Q.sawUnambiguousESM)return Z;if(Q.ambiguousScriptDifferentAst)try{return J.sourceType="script",hW(J,X).parse()}catch{}else Z.program.sourceType="script";return Z}catch(Q){try{return J.sourceType="script",hW(J,X).parse()}catch{}throw Q}}else return hW(J,X).parse()}function bQ0(X){let J={};for(let Q of Object.keys(X))J[Q]=MP(X[Q]);return J}var iO0=bQ0(x10);function hW(X,J){let Q=pL,Z=new Map;if(X?.plugins){for(let G of X.plugins){let Y,V;if(typeof G==="string")Y=G;else[Y,V]=G;if(!Z.has(Y))Z.set(Y,V||{})}xQ0(Z),Q=hQ0(Z)}return new Q(X,J,Z)}var zP=new Map;function hQ0(X){let J=[];for(let G of gQ0)if(X.has(G))J.push(G);let Q=J.join("|"),Z=zP.get(Q);if(!Z){Z=pL;for(let G of J)Z=pP[G](Z);zP.set(Q,Z)}return Z}var E3=(X)=>!!X&&typeof X==="object"&&typeof X.type==="string",B8=(X,J)=>E3(X)&&X.type==="Identifier"&&X.name===J,lP=(X,J,Q)=>E3(X)&&X.type==="MemberExpression"&&!X.computed&&B8(X.object,J)&&B8(X.property,Q),cL=(X)=>E3(X)&&X.type==="MemberExpression"&&!X.computed&&E3(X.object)&&X.object.type==="MetaProperty"&&B8(X.object.meta,"import")&&B8(X.object.property,"meta")&&B8(X.property,"url"),dP=(X)=>E3(X)&&X.type==="StringLiteral"?X.value:void 0;function g4(X,J,Q){let Z=[],G=[],Y=[],V=()=>{throw Error(`Local routine source unavailable: unsupported dynamic source or asset in ${J}. Use literal imports/requires and new URL('./asset', import.meta.url).`)},K=(W,U=!1)=>{let z=dP(W);if(z===void 0)V();Z.push({specifier:z,require:U})},H=(W,U)=>{if(["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration"].includes(W.type)&&W.source){let z=W.specifiers;if(W.importKind==="type"||W.exportKind==="type"||z?.length&&z.every((q)=>q.importKind==="type"||q.exportKind==="type"))return;K(W.source)}if(W.type==="ImportExpression"){let z=W.source;if(!(Q&&E3(z)&&z.type==="MemberExpression"&&!z.computed&&B8(z.property,"href")&&E3(z.object)&&z.object.type==="CallExpression"&&B8(z.object.callee,"pathToFileURL")&&Array.isArray(z.object.arguments)&&z.object.arguments.length===1&&lP(z.object.arguments[0],"bootstrap","entry")))K(z)}if(W.type==="CallExpression"&&B8(W.callee,"require"))K(W.arguments[0],!0);if((W.type==="CallExpression"||W.type==="NewExpression")&&(B8(W.callee,"eval")||B8(W.callee,"Function")||B8(W.callee,"createRequire")||lP(W.callee,"module","require")))V();if(W.type==="NewExpression"&&B8(W.callee,"URL")){let z=W.arguments;if(cL(z[1])){let q=dP(z[0]);if(!q||!q.startsWith("./")&&!q.startsWith("../")||z.length!==2)V();G.push(q);let B=z[0];Y.push({start:B.start,end:B.end,path:q})}}if(cL(W)&&!(U?.type==="NewExpression"&&B8(U.callee,"URL")))V();if(W.type==="MetaProperty"&&B8(W.meta,"import")&&!cL(U))V();if(B8(W,"createRequire"))V();if(W.type==="Identifier"&&(W.name==="__dirname"||W.name==="__filename")&&!(U?.type==="MemberExpression"&&U.property===W&&!U.computed))V();if(!Q&&B8(W,"require")&&!(U?.type==="CallExpression"&&U.callee===W)&&!(U?.type==="MemberExpression"&&U.property===W&&!U.computed))V();for(let z of Object.values(W))if(E3(z))H(z,W);else if(Array.isArray(z)){for(let q of z)if(E3(q))H(q,W)}};try{H(cP(X,{sourceType:"unambiguous",createImportExpressions:!0,plugins:J.endsWith(".ts")||J.endsWith(".mts")||J.endsWith(".cts")?["typescript"]:[]}))}catch(W){if(W instanceof Error&&W.message.startsWith("Local routine source unavailable:"))throw W;throw Error(`Local routine source unavailable: unsupported module syntax in ${J}.`)}return{modules:Z,assets:G,assetLiterals:Y}}var YH=zY(QH(),1);import{execFile as lG0}from"node:child_process";import{chmod as dG0,mkdtemp as nG0,readFile as sG0,readdir as aG0,realpath as Q1,rm as iG0,stat as fy}from"node:fs/promises";import{tmpdir as rG0}from"node:os";import{isAbsolute as oG0,join as C3,relative as tG0}from"node:path";O8();var uG0=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,pG0=(X)=>X!==null&&typeof X==="object"&&!Array.isArray(X),cG0=(X,J)=>Object.keys(X).sort().join(",")===J.sort().join(",");function VO(X,J){if(!uG0.test(J)||!pG0(X)||!cG0(X,["name","repositories","routines"])||X.name!==J||!Array.isArray(X.repositories)||!X.repositories.every(o5)||new Set(X.repositories).size!==X.repositories.length||!Array.isArray(X.routines)||!X.routines.every(I8)||new Set(X.routines).size!==X.routines.length)throw Error("Invalid app declaration");return{name:J,repositories:[...X.repositories],routines:[...X.routines]}}function vy(X){return Object.freeze([...X.routines])}function JH(X){let J=VO(X,X.name);function Q(Z){for(let G of Object.values(Z))if(G&&typeof G==="object")Q(G);Object.freeze(Z)}return Q(J),J}var eG0=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,KO="Run os app launch from inside the app’s Git worktree. Git must be available.",ZH="Check apps/<name>/app.json: launch requires a confined V0 declaration with only matching name, repository aliases and ordered routine IDs.";function _y(X){return X!==null&&typeof X==="object"&&!Array.isArray(X)}function GH(X,J){let Q=tG0(X,J);return Q.length>0&&!oG0(Q)&&Q!==".."&&!Q.startsWith(`..${process.platform==="win32"?"\\":"/"}`)}async function WO(X){let J=Object.fromEntries(Object.entries(process.env).filter(([Y])=>!Y.startsWith("GIT_"))),Q=await new Promise((Y,V)=>{lG0("git",["-C",X,"rev-parse","--show-toplevel"],{env:J,encoding:"utf8",timeout:1e4,maxBuffer:65536},(K,H)=>{if(K)V(Error(KO));else Y(H.replace(/\r?\n$/,""))})}),Z=await Q1(Q),G=await Q1(X);if(G!==Z&&!GH(Z,G))throw Error(KO);return Z}async function HO(X,J=process.cwd()){if(!eG0.test(X))throw Error("Use an app name containing lowercase letters, numbers and single separating hyphens.");let Q;try{Q=await WO(J)}catch{throw Error(KO)}try{let Z=await Q1(C3(Q,"apps"));if(!GH(Q,Z))throw Error(ZH);let G=await Q1(C3(Z,X));if(!GH(Z,G)||!(await fy(G)).isDirectory())throw Error(ZH);let Y=await Q1(C3(G,"app.json"));if(!GH(G,Y)||!(await fy(Y)).isFile())throw Error(ZH);let V=JH(VO(JSON.parse(await sG0(Y,"utf8")),X));return{worktreeRoot:Q,appDirectory:G,declarationPath:Y,declaration:V}}catch{throw Error(ZH)}}async function my(X,J,Q={nodeVersion:process.versions.node,typescript:process.features.typescript}){return await XY0(X,J,Q)!==void 0}function uy(X,J){return J.typescript==="strip"&&_y(X)&&X.type==="module"&&_y(X.engines)&&typeof X.engines.node==="string"&&!!YH.validRange(X.engines.node)&&YH.satisfies(J.nodeVersion,X.engines.node)}async function XY0(X,J,Q={nodeVersion:process.versions.node,typescript:process.features.typescript}){if(!X.declaration.routines.includes(J)||!X.prepared)return;try{if(Q.typescript!=="strip")return;let Z=await Q1(X.worktreeRoot);if(Z!==X.worktreeRoot)return;let G=X.prepared.definitions.get(J);if(!G)return;let Y=await Q1(await nG0(C3(rG0(),"os-app-routine-")));try{let V=await ZJ({root:Z,gitDirectory:"",remote:"",branch:""},J,C3(Y,"source"),Q,G.entry);if(V.version!==G.source.version)return;return{entry:C3(Z,G.entry),directory:C3(Z,"routines"),sdk:C3(Z,V.sdk)}}finally{for(let V of await aG0(Y))await dG0(C3(Y,V),448);await iG0(Y,{recursive:!0,force:!0})}}catch{return}}X3();var h4=(X)=>/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.test(X);function xG(X){return X.startsWith("routines/")&&!/[\x00-\x1f\x7f\\:]/.test(X)&&X.split("/").every((J)=>!!J&&J!==".."&&!J.startsWith(".")&&!["node_modules","runs","credentials","secrets"].includes(J.toLowerCase()))&&!/(?:^|\/)(?:Dockerfile(?:\..*)?|(?:bun|vite|webpack|rollup|eslint)\.config\..*|(?:package|tsconfig)\.json|(?:bun|package|yarn|pnpm).*lock|requirements\.lock|.*\.(?:pem|key|p12|pfx|node|swp|swo)|id_(?:rsa|dsa|ecdsa|ed25519)(?:\..*)?|(?:credentials|secrets)(?:\..*)?)$/i.test(X)}var w8="https://schemas.oddington.ai/routine/v1.json",v7={files:20000,bytes:268435456,declarationBytes:65536};function py(X){return K8({$schema:w8,access:X.access})}function GJ(X){let J=/^routines\/([^/]+)\/routine\.ts$/.exec(X);if(!J||!h4(J[1]))throw Error("Invalid frozen routine definition entry");return J[1]}var Y9=(X)=>{throw Error(`Invalid routine declaration: ${X}`)},gG=(X,J,Q)=>{if(!X||typeof X!=="object"||Array.isArray(X)||Object.getPrototypeOf(X)!==Object.prototype&&Object.getPrototypeOf(X)!==null||Reflect.ownKeys(X).some((Z)=>typeof Z!=="string"||!J.includes(Z)||!Object.getOwnPropertyDescriptor(X,Z).enumerable||!Object.hasOwn(Object.getOwnPropertyDescriptor(X,Z),"value")))Y9(Q);return X},zO=(X)=>typeof X==="string"&&/^[a-z][a-z0-9-]{0,62}$/.test(X),UO=(X,J,Q,Z=!1)=>{if(X===void 0)return[];if(!Array.isArray(X)||X.length>64||X.some((G)=>!(zO(G)||Z&&typeof G==="string"&&G.split("/").length===2&&G.split("/").every(zO))||Q&&!Q.includes(G))||new Set(X).size!==X.length)Y9(J);return[...X].sort()};function QY0(X){return typeof X==="string"&&X.length<=512&&!X.startsWith("/")&&!X.includes("\\")&&!X.includes(":")&&X.split("/").every((J)=>!!J&&J!=="."&&J!==".."&&/^[a-zA-Z0-9_.*-]+$/.test(J))}function K8(X){let J=gG(X,["$schema","access","runtime","retry","assets"],"fields");if(J.$schema!==w8)Y9("$schema");let Q=gG(J.access===void 0?{}:J.access,["repositories","connections","ai","files","publish"],"access");if(Object.hasOwn(Q,"ai")&&Q.ai!==!0)Y9("access.ai");let Z=Q.repositories===void 0?{}:Q.repositories,G=gG(Z,Z&&typeof Z==="object"?Object.keys(Z):[],"access.repositories");if(Object.keys(G).length>64)Y9("access.repositories");let Y={};for(let z of Object.keys(G).sort()){if(!zO(z)||!["read","write"].includes(G[z]))Y9(`access.repositories.${z}`);Y[z]=G[z]}if(Q.files!==void 0&&!["read","read-write"].includes(Q.files))Y9("access.files");let V=gG(J.runtime===void 0?{}:J.runtime,["features","resources","maxDuration"],"runtime");if(V.resources!==void 0&&!["standard","large"].includes(V.resources))Y9("runtime.resources");let K=V.maxDuration===void 0?"15m":V.maxDuration;if(typeof K!=="string"||!/^(?:[1-5][0-9]|60)m$/.test(K)||Number(K.slice(0,-1))<15)Y9("runtime.maxDuration");let H=gG(J.retry===void 0?{}:J.retry,["maxAttempts"],"retry"),W=H.maxAttempts===void 0?1:H.maxAttempts;if(!Number.isInteger(W)||W<1||W>3)Y9("retry.maxAttempts");let U=J.assets===void 0?[]:J.assets;if(!Array.isArray(U)||U.length>64||U.some((z)=>!QY0(z))||new Set(U).size!==U.length)Y9("assets");return{$schema:w8,access:{repositories:Y,connections:UO(Q.connections,"access.connections",void 0,!0),...Q.ai===!0?{ai:!0}:{},...Q.files===void 0?{}:{files:Q.files},publish:UO(Q.publish,"access.publish",["asks","digests"])},runtime:{features:UO(V.features,"runtime.features",["python","documents","browser"]),resources:V.resources??"standard",maxDuration:K},retry:{maxAttempts:W},assets:[...U].sort()}}X3();import{createHash as JY0}from"node:crypto";var VH=(X,J)=>x1({PATH:process.env.PATH,GIT_CONFIG_NOSYSTEM:"1",GIT_CONFIG_GLOBAL:"/dev/null"},()=>N5(X,["-c","core.fsmonitor=false",...J],void 0,{localObjectsOnly:!0}));async function ZY0(X){let J=(await VH(X,["symbolic-ref","HEAD"])).toString().trim();if(!J.startsWith("refs/heads/"))throw Error("Routine checkout branch unavailable");try{let Q=(await VH(X,["rev-parse","--verify",`${J}^{commit}`])).toString().trim();if(!/^[0-9a-f]{40}$/.test(Q))throw Error("Routine checkout commit unavailable");return{branch:J,commit:Q}}catch(Q){if(!(Q instanceof X7))throw Q;try{await VH(X,["show-ref","--verify","--quiet",J])}catch(Z){if(Z instanceof X7&&Z.exitCode===1)return{branch:J};throw Z}throw Q}}async function KH(X,J){let Q=await ZY0(X);if(!Q.commit)return{...Q,dirty:!0};let Z=[...new Set([...J.keys()].filter((V)=>!V.split("/").includes("node_modules")).map((V)=>V.split("/")[0]))],G=(await VH(X,["ls-tree","-rz","--full-tree",Q.commit,"--",...Z])).toString("utf8"),Y=new Map(G.split("\x00").flatMap((V)=>{let K=/^[0-7]{6} blob ([0-9a-f]{40})\t(.+)$/.exec(V);return K?[[K[2],K[1]]]:[]}));return{...Q,dirty:[...J].some(([V,K])=>!V.split("/").includes("node_modules")&&JY0("sha1").update(`blob ${K.length}\x00`).update(K).digest("hex")!==Y.get(V))}}var kO=zY(QH(),1);import{execFile as FY0}from"node:child_process";import{constants as OH}from"node:fs";import{access as PY0,lstat as TH,mkdir as Ux,open as DY0,readdir as yY0,realpath as K1,writeFile as zx}from"node:fs/promises";import{dirname as IH,join as I6,posix as xY0,relative as gY0,sep as jH,win32 as bY0}from"node:path";import{promisify as hY0}from"node:util";var W8=zY(QH(),1);var V9="0.1.27",Q5=()=>{throw Error("Invalid frozen routine dependencies: use an admitted routines manifest and Bun lock with frozen registry packages and no runtime scripts or SDK replacement.")},w6=(X)=>{if(!X||typeof X!=="object"||Array.isArray(X))return Q5();return X};function VJ(X){let J="",Q=!1,Z=!1;for(let G=0;G<X.length;G++){let Y=X[G];if(!Q&&Y===","&&/^[\s]*[}\]]/.test(X.slice(G+1)))continue;if(J+=Y,Q){if(Z)Z=!1;else if(Y==="\\")Z=!0;else if(Y==='"')Q=!1}else if(Y==='"')Q=!0}try{return JSON.parse(J)}catch{return Q5()}}var YJ=(X)=>/^(?:@[a-z0-9][a-z0-9_.-]*\/)?[a-z0-9][a-z0-9_.-]*$/.test(X),ly=(X)=>/^(?:@?[a-z0-9][a-z0-9_.-]*\/)*[a-z0-9][a-z0-9_.-]*$/.test(X)&&X.split("/").every((J,Q,Z)=>!J.startsWith("@")||Q<Z.length-1&&!Z[Q+1].startsWith("@")),cy=(X)=>{try{return w6(JSON.parse(X))}catch{return Q5()}},qO=(X)=>Object.fromEntries(Object.keys(X).sort().map((J)=>[J,WH(X[J])])),WH=(X)=>Array.isArray(X)?X.map(WH):X&&typeof X==="object"?qO(w6(X)):X,bG=(X)=>{let J=w6(X===void 0?{}:X);for(let[Q,Z]of Object.entries(J))if(!YJ(Q)||typeof Z!=="string"||!Z||!W8.validRange(Z))Q5();return J},GY0=(X)=>{let J=X.match(/@[^/]+\/[^/]+|[^/]+/g)??[];return J.pop(),J.join("/")},MO=(X,J,Q)=>{for(;;){let Z=J?`${J}/${Q}`:Q;if(Object.hasOwn(X,Z))return Z;if(!J)return;J=GY0(J)}};function hG(X,J,Q,Z){if(!h4(Z))Q5();let G=cy(X),Y=cy(J),V=(I)=>{let j=I.replace(/^\.\//,"").replace(/\/$/,"");if(j.includes("/")&&!j.includes("**"))return!1;if(!/^[a-zA-Z0-9_.*-]+$/.test(j))return Q5();return new RegExp(`^${j.replace(/\./g,"\\.").replace(/\*/g,".*")}$`).test(Z)};if(!Array.isArray(G.workspaces)||!G.workspaces.every((I)=>typeof I==="string")||!G.workspaces.some((I)=>!I.startsWith("!")&&V(I))||G.workspaces.some((I)=>I.startsWith("!")&&V(I.slice(1))))Q5();if(Y.private!==!0||Y.type!=="module"||Object.keys(Y).some((I)=>!["name","version","private","type","engines","dependencies"].includes(I)))Q5();if(typeof Y.name!=="string"||!YJ(Y.name))Q5();if(Y.version!==void 0&&(typeof Y.version!=="string"||!W8.valid(Y.version)))Q5();let K=w6(Y.engines===void 0?{}:Y.engines);if(Object.keys(K).some((I)=>I!=="node")||K.node!==void 0&&(typeof K.node!=="string"||!W8.validRange(K.node)))Q5();let H=bG(Y.dependencies);if(Object.hasOwn(H,"@oddington/sdk")||Object.values(H).some((I)=>I==="*"))Q5();let W=w6(VJ(Q));if(W.lockfileVersion!==1||W.configVersion!==void 0&&W.configVersion!==0&&W.configVersion!==1||Object.keys(W).some((I)=>!["lockfileVersion","configVersion","workspaces","packages","trustedDependencies","patchedDependencies","overrides","catalog","catalogs"].includes(I)))Q5();let U=w6(W.patchedDependencies===void 0?{}:W.patchedDependencies),z=w6(w6(W.workspaces)[Z]);if(z.name!==Y.name||z.version!==Y.version||JSON.stringify(qO(bG(z.dependencies)))!==JSON.stringify(qO(H))||Object.keys(z).some((I)=>!["name","version","dependencies"].includes(I)))Q5();let q=w6(W.packages),B=Object.create(null),M=Y.name,L=q[M];if(!Array.isArray(L)||L.length!==1||L[0]!==`${M}@workspace:${Z}`)Q5();B[M]=L;let T=[],O=(I,j,$,R=!1)=>{if(j==="@oddington/sdk"){if(!W8.satisfies(V9,$))Q5();return}let A=MO(q,I,j);if(!A){if(R)return;return Q5()}let S=q[A];if(!ly(A)||!Array.isArray(S)||S.length!==4||typeof S[0]!=="string"||S[1]!==""||typeof S[3]!=="string"||!/^sha512-[A-Za-z0-9+/]{86}==$/.test(S[3]))return Q5();let N=S[0],E=N.slice(j.length+1);if(!N.startsWith(`${j}@`)||!W8.valid(E)||!W8.satisfies(E,$)||Object.hasOwn(U,N))Q5();if(Object.hasOwn(B,A))return;B[A]=S,T.push({original:A,row:S})};for(let I of Object.keys(H).sort())O(M,I,H[I]);for(let I=0;I<T.length;I++){if(T.length>20000)Q5();let{original:j,row:$}=T[I],R=w6($[2]);if(Object.keys(R).some((y)=>!["dependencies","optionalDependencies","peerDependencies","optionalPeers","bin","os","cpu"].includes(y)))Q5();let A=bG(R.dependencies),S=bG(R.optionalDependencies),N=bG(R.peerDependencies),E=R.optionalPeers??[];if(!Array.isArray(E)||E.some((y)=>typeof y!=="string"||!Object.hasOwn(N,y))||new Set(E).size!==E.length)Q5();if(Object.hasOwn(A,"@oddington/sdk")||Object.hasOwn(S,"@oddington/sdk"))Q5();for(let[y,C]of Object.entries({...N,...A,...S}).sort(([w],[P])=>w.localeCompare(P)))O(j,y,C,Object.hasOwn(S,y)||!Object.hasOwn(A,y)&&E.includes(y));for(let[y,C]of Object.entries(N))O(j,y,C,E.includes(y))}return{manifest:JSON.stringify(WH({type:"module",private:!0,workspaces:[Z]})),lock:JSON.stringify(WH({lockfileVersion:1,...W.configVersion===void 0?{}:{configVersion:W.configVersion},workspaces:{"":{},[Z]:{name:M,...Y.version?{version:Y.version}:{},dependencies:H}},packages:B})),dependencies:new Set(Object.keys(H))}}function BO(X,J){let Q;try{Q=w6(JSON.parse(X))}catch{return Q5()}if(Q.type!=="module"||Object.keys(Q).some((U)=>!["name","version","private","type","engines","dependencies"].includes(U)))Q5();if(Q.name!==void 0&&(typeof Q.name!=="string"||!YJ(Q.name)))Q5();if(Q.version!==void 0&&(typeof Q.version!=="string"||!W8.valid(Q.version)))Q5();if(Q.private!==void 0&&typeof Q.private!=="boolean")Q5();let Z=w6(Q.engines===void 0?{}:Q.engines);if(Object.keys(Z).some((U)=>U!=="node")||Z.node!==void 0&&(typeof Z.node!=="string"||!W8.validRange(Z.node)))Q5();let G=w6(Q.dependencies===void 0?{}:Q.dependencies);for(let[U,z]of Object.entries(G)){if(!YJ(U)||typeof z!=="string"||!W8.validRange(z)||z==="*"||z==="")Q5();if(U==="@oddington/sdk"&&!W8.satisfies(V9,z))Q5()}let Y=w6(VJ(J));if(Y.lockfileVersion!==1||Object.keys(Y).some((U)=>!["lockfileVersion","configVersion","workspaces","packages"].includes(U)))Q5();let V=w6(Y.workspaces);if(Object.keys(V).join()!=="")Q5();let K=w6(V[""]);if(Object.keys(K).some((U)=>!["name","version","dependencies"].includes(U)))Q5();let H=w6(K.dependencies===void 0?{}:K.dependencies);if(Object.keys(H).length!==Object.keys(G).length||Object.entries(G).some(([U,z])=>H[U]!==z))Q5();let W=w6(Y.packages);for(let[U,z]of Object.entries(W)){if(!Array.isArray(z)||z.length!==4||typeof z[0]!=="string"||z[1]!==""||typeof z[3]!=="string"||!/^sha512-[A-Za-z0-9+/]{86}==$/.test(z[3]))return Q5();let q=z[0],B=q.lastIndexOf("@"),M=q.slice(0,B),L=q.slice(B+1);if(!YJ(M)||!W8.valid(L)||!ly(U)||!(U===M||U.endsWith(`/${M}`))||M==="@oddington/sdk"&&L!==V9)Q5();let T=w6(z[2]);if(Object.keys(T).some((O)=>!["dependencies","optionalDependencies","peerDependencies","optionalPeers","bin","os","cpu"].includes(O)))Q5();for(let O of["dependencies","optionalDependencies","peerDependencies"])for(let[I,j]of Object.entries(w6(T[O]===void 0?{}:T[O]))){if(!YJ(I)||typeof j!=="string"||!W8.validRange(j))Q5();if(I==="@oddington/sdk"&&O!=="peerDependencies")Q5();if(O!=="peerDependencies"&&!Object.values(W).some(($)=>Array.isArray($)&&typeof $[0]==="string"&&$[0].startsWith(`${I}@`)&&W8.satisfies($[0].slice(I.length+1),j)))Q5()}}for(let[U,z]of Object.entries(G)){let q=W[U];if(!Array.isArray(q)||typeof q[0]!=="string"||!q[0].startsWith(`${U}@`)||!W8.satisfies(q[0].slice(U.length+1),z))Q5()}return new Set(Object.keys(G))}function LO(X){let J=new Set;for(let Q of X.split(/\r?\n/).map((Z)=>Z.trim()).filter((Z)=>Z&&!Z.startsWith("#"))){let Z=/^([a-zA-Z0-9][a-zA-Z0-9_.-]*)==([0-9]+(?:\.[0-9]+)*(?:(?:a|b|rc)[0-9]+|\.post[0-9]+|\.dev[0-9]+)?)((?: --hash=sha256:[0-9a-f]{64})+)$/.exec(Q),G=Z?.[1]?.toLowerCase().replace(/[_.]/g,"-");if(!Z||!G||J.has(G))throw Error("Invalid frozen Python dependencies: use unique exact versions with SHA-256 hashes, one requirement per line.");J.add(G)}}import{spawn as YY0}from"node:child_process";import{mkdir as VY0,mkdtemp as KY0,rm as WY0,stat as HY0,writeFile as HH}from"node:fs/promises";import{tmpdir as UY0}from"node:os";import{dirname as zY0,extname as dy,join as v4,posix as f4}from"node:path";var OO="routine-v3",vG="1.3.14",J1=(X,J)=>`routines/${X}/.os-executable/${J}.mjs`;async function ny(X,J,Q,Z,G){await new Promise((Y,V)=>{let K=YY0(X,J,{cwd:Q,env:Z,stdio:"ignore",detached:!0}),H=!1,W=()=>{try{process.kill(-K.pid,"SIGKILL")}catch{}},U=setTimeout(()=>{H=!0,W()},G);K.once("error",()=>{clearTimeout(U),V(Error("Fixed routine build tool unavailable"))}),K.once("close",(z)=>{if(clearTimeout(U),W(),z===0&&!H)Y();else V(Error(H?"Fixed routine build timed out":"Fixed routine build failed"))})})}async function sy(X,J,Q,Z){if(!/^[a-z0-9][a-z0-9-]{0,62}$/.test(J))throw Error("Invalid routine name");let G=await KY0(v4(UY0(),"os-routine-compiler-")),Y=Date.now()+Z.timeoutMs,V=()=>{let W=Y-Date.now();if(W<=0)throw Error("Fixed routine build timed out");return W},K=new Map,H=(W)=>{if(K.has(W)||dy(W)===".json")return;let U=Q.get(W);if(!U)throw Error("Frozen module missing");K.set(W,U);for(let{specifier:z}of g4(Buffer.from(U).toString("utf8"),W,!1).modules){if(!z.startsWith("./")&&!z.startsWith("../"))continue;let q=f4.normalize(f4.join(f4.dirname(W),z));if(!dy(q)){let B=[".ts",".js",".json",".mts",".mjs",".cts",".cjs"].map((M)=>q+M).filter((M)=>Q.has(M));if(B.length!==1)throw Error("Frozen module ambiguous");q=B[0]}H(q)}};try{if(H(Z.definitionEntry??`routines/${J}/run.ts`),!Z.definitionEntry&&Q.has(`routines/${J}/responses.ts`))H(`routines/${J}/responses.ts`);let W=v4(G,"tsconfig.json");await HH(W,JSON.stringify({compilerOptions:{target:"ESNext",module:"ESNext",moduleResolution:"Bundler",jsx:"react-jsx"}}),{flag:"wx",mode:384}),await ny(Z.bun,["--no-env-file","-e",`if(Bun.version!==${JSON.stringify(vG)})process.exit(1)`],G,Z.environment,V());for(let U of["run","responses"]){if(Z.definitionEntry&&U==="responses"){await HH(v4(X,J1(J,"responses")),`import definition from "./run.mjs"; export const handlers = definition.responses;
297
+ `),cooked:G===null?null:G.slice(1,H)},V.tail=K,this.next();let U=this.finishNode(V,"TemplateElement");return this.resetEndLocation(U,g7(this.state.lastTokEndLoc,H)),U}parseTemplate(X){let J=this.startNode(),Q=this.parseTemplateElement(X),Z=[Q],G=[];while(!Q.tail)G.push(this.parseTemplateSubstitution()),this.readTemplateContinuation(),Z.push(Q=this.parseTemplateElement(X));return J.expressions=G,J.quasis=Z,this.finishNode(J,"TemplateLiteral")}parseTemplateSubstitution(){return this.parseExpression()}parseObjectLike(X,J,Q){let Z=!1,G=!0,Y=this.startNode();Y.properties=[],this.next();while(!this.match(X)){if(G)G=!1;else if(this.expect(8),this.match(X)){this.addTrailingCommaExtraToNode(Y);break}let K;if(J)K=this.parseBindingProperty();else K=this.parsePropertyDefinition(Q),Z=this.checkProto(K,Z,Q);Y.properties.push(K)}this.next();let V=J?"ObjectPattern":"ObjectExpression";return this.finishNode(Y,V)}addTrailingCommaExtraToNode(X){this.addExtra(X,"trailingComma",this.state.lastTokStartLoc.index),this.addExtra(X,"trailingCommaLoc",this.state.lastTokStartLoc,!1)}maybeAsyncOrAccessorProp(X){return!X.computed&&X.key.type==="Identifier"&&(this.isLiteralPropertyName()||this.match(0)||this.match(51))}parsePropertyDefinition(X){let J=[];if(this.match(22)){if(this.hasPlugin("decorators"))this.raise(u.UnsupportedPropertyDecorator,this.state.startLoc);while(this.match(22))J.push(this.parseDecorator())}let Q=this.startNode(),Z=!1,G=!1,Y;if(this.match(17)){if(J.length)this.unexpected();return this.parseSpread()}if(J.length)Q.decorators=J;if(Q.method=!1,X)Y=this.state.startLoc;let V=this.eat(51);this.parsePropertyNamePrefixOperator(Q);let K=this.state.containsEsc;if(this.parsePropertyName(Q,X),!V&&!K&&this.maybeAsyncOrAccessorProp(Q)){let{key:H}=Q,W=H.name;if(W==="async"&&!this.hasPrecedingLineBreak())Z=!0,this.resetPreviousNodeTrailingComments(H),V=this.eat(51),this.parsePropertyName(Q);if(W==="get"||W==="set"){if(G=!0,this.resetPreviousNodeTrailingComments(H),Q.kind=W,this.match(51))V=!0,this.raise(u.AccessorIsGenerator,this.state.curPosition(),{kind:W}),this.next();this.parsePropertyName(Q)}}return this.parseObjPropValue(Q,Y,V,Z,!1,G,X)}getGetterSetterExpectedParamCount(X){return X.kind==="get"?0:1}getObjectOrClassMethodParams(X){return X.params}checkGetterSetterParams(X){let J=this.getGetterSetterExpectedParamCount(X),Q=this.getObjectOrClassMethodParams(X);if(Q.length!==J)this.raise(X.kind==="get"?u.BadGetterArity:u.BadSetterArity,X);if(X.kind==="set"&&Q[Q.length-1]?.type==="RestElement")this.raise(u.BadSetterRestParameter,X)}parseObjectMethod(X,J,Q,Z,G){if(G){let Y=this.parseMethod(X,J,!1,!1,!1,"ObjectMethod");return this.checkGetterSetterParams(Y),Y}if(Q||J||this.match(6)){if(Z)this.unexpected();return X.kind="method",X.method=!0,this.parseMethod(X,J,Q,!1,!1,"ObjectMethod")}}parseObjectProperty(X,J,Q,Z){if(X.shorthand=!1,this.eat(10))return X.value=Q?this.parseMaybeDefault(this.state.startLoc):this.parseMaybeAssignAllowInOrVoidPattern(4,Z),this.finishObjectProperty(X);if(!X.computed&&X.key.type==="Identifier"){if(this.checkReservedWord(X.key.name,X.key.start,!0,!1),Q)X.value=this.parseMaybeDefault(J,this.cloneIdentifier(X.key));else if(this.match(25)){let G=this.state.startLoc;if(Z!=null){if(Z.shorthandAssignLoc===null)Z.shorthandAssignLoc=G}else this.raise(u.InvalidCoverInitializedName,G);X.value=this.parseMaybeDefault(J,this.cloneIdentifier(X.key))}else X.value=this.cloneIdentifier(X.key);return X.shorthand=!0,this.finishObjectProperty(X)}}finishObjectProperty(X){return this.finishNode(X,"ObjectProperty")}parseObjPropValue(X,J,Q,Z,G,Y,V){let K=this.parseObjectMethod(X,Q,Z,G,Y)||this.parseObjectProperty(X,J,G,V);if(!K)this.unexpected();return K}parsePropertyName(X,J){if(this.eat(0))X.computed=!0,X.key=this.parseMaybeAssignAllowIn(),this.expect(1);else{let{type:Q,value:Z}=this.state,G;if(s8(Q))G=this.parseIdentifier(!0);else switch(Q){case 131:G=this.parseNumericLiteral(Z);break;case 130:G=this.parseStringLiteral(Z);break;case 132:G=this.parseBigIntLiteral(Z);break;case 134:{let Y=this.state.startLoc;if(J!=null){if(J.privateKeyLoc===null)J.privateKeyLoc=Y}else this.raise(u.UnexpectedPrivateField,Y);G=this.parsePrivateName();break}default:throw this.unexpected()}if(X.key=G,Q!==134)X.computed=!1}}initFunction(X,J){X.id=null,X.generator=!1,X.async=J}parseMethod(X,J,Q,Z,G,Y,V=!1){this.initFunction(X,Q),X.generator=J,this.scope.enter(530|(V?576:0)|(G?32:0)),this.prodParam.enter(_W(Q,X.generator)),this.parseFunctionParams(X,Z);let K=this.parseFunctionBodyAndFinish(X,Y,!0);return this.prodParam.exit(),this.scope.exit(),K}parseArrayLike(X,J){let Q=this.startNode();return this.next(),Q.elements=this.parseExprList(X,!0,J,Q),this.finishNode(Q,"ArrayExpression")}parseArrowExpression(X,J,Q,Z){this.scope.enter(518);let G=_W(Q,!1);if(!this.match(2))G|=this.prodParam.currentFlags()&24;if(this.prodParam.enter(G),this.initFunction(X,Q),J)this.setArrowFunctionParameters(X,J,Z);return this.parseFunctionBody(X,!0),this.prodParam.exit(),this.scope.exit(),this.finishNode(X,"ArrowFunctionExpression")}setArrowFunctionParameters(X,J,Q){this.toAssignableList(J,Q,!1),X.params=J}parseFunctionBodyAndFinish(X,J,Q=!1){return this.parseFunctionBody(X,!1,Q),this.finishNode(X,J)}parseFunctionBody(X,J,Q=!1){let Z=J&&!this.match(2);if(this.expressionScope.enter(wL()),Z)X.body=this.parseMaybeAssign(),this.checkParams(X,!1,J,!1);else{let G=this.state.strict,Y=this.state.labels;this.state.labels=[],this.prodParam.enter(this.prodParam.currentFlags()|4),X.body=this.parseBlock(!0,!1,(V)=>{let K=!this.isSimpleParamList(X.params);if(V&&K)this.raise(u.IllegalLanguageModeDirective,(X.kind==="method"||X.kind==="constructor")&&!!X.key?this.optionFlags&256?X.key.loc.end:X.key:X);let H=!G&&this.state.strict;if(this.checkParams(X,!this.state.strict&&!J&&!Q&&!K,J,H),this.state.strict&&X.id)this.checkIdentifier(X.id,65,H)}),this.prodParam.exit(),this.state.labels=Y}this.expressionScope.exit()}isSimpleParameter(X){return X.type==="Identifier"}isSimpleParamList(X){for(let J=0,Q=X.length;J<Q;J++)if(!this.isSimpleParameter(X[J]))return!1;return!0}checkParams(X,J,Q,Z=!0){let G=!J&&new Set,Y={type:"FormalParameters"};for(let V of X.params)this.checkLVal(V,Y,5,G,Z)}parseExprList(X,J,Q,Z){let G=[],Y=!0;while(!this.eat(X)){if(Y)Y=!1;else if(this.expect(8),this.match(X)){if(Z)this.addTrailingCommaExtraToNode(Z);this.next();break}G.push(this.parseExprListItem(X,J,Q))}return G}parseExprListItem(X,J,Q,Z){let G;if(this.match(8)){if(!J)this.raise(u.UnexpectedToken,this.state.curPosition(),{unexpected:","});G=null}else if(this.match(17)){let Y=this.state.startLoc;G=this.parseParenItem(this.parseSpread(Q),Y)}else if(this.match(13)){if(this.expectPlugin("partialApplication"),!Z)this.raise(u.UnexpectedArgumentPlaceholder,this.state.startLoc);let Y=this.startNode();this.next(),G=this.finishNode(Y,"ArgumentPlaceholder")}else G=this.parseMaybeAssignAllowInOrVoidPattern(X,Q,!0);return G}parseIdentifier(X){let J=this.startNode(),Q=this.parseIdentifierName(X);return this.createIdentifier(J,Q)}createIdentifier(X,J){if(X.name=J,this.optionFlags&256)X.loc.identifierName=J;return this.finishNode(X,"Identifier")}createIdentifierAt(X,J,Q){if(X.name=J,this.optionFlags&256)X.loc.identifierName=J;return this.finishNodeAt(X,"Identifier",Q)}parseIdentifierName(X){let J,{start:Q,type:Z}=this.state;if(s8(Z))J=this.state.value;else this.unexpected();let G=g10(Z);if(X){if(G)this.replaceToken(128)}else this.checkReservedWord(J,this.sourceToOffsetPos(Q),G,!1);return this.next(),J}checkReservedWord(X,J,Q,Z){if(X.length>10)return;if(!r10(X))return;if(Q&&s10(X)){this.raise(u.UnexpectedKeyword,J,{keyword:X});return}if((!this.state.strict?LP:Z?IP:OP)(X,this.inModule)){this.raise(u.UnexpectedReservedWord,J,{reservedWord:X});return}else if(X==="yield"){if(this.prodParam.hasYield){this.raise(u.YieldBindingIdentifier,J);return}}else if(X==="await"){if(this.prodParam.hasAwait){this.raise(u.AwaitBindingIdentifier,J);return}if(this.scope.inStaticBlock){this.raise(u.AwaitBindingIdentifierInStaticBlock,J);return}this.expressionScope.recordAsyncArrowParametersError(J)}else if(X==="arguments"){if(this.scope.inClassAndNotInNonArrowFunction){this.raise(u.ArgumentsInClass,J);return}}}recordAwaitIfAllowed(){let X=this.prodParam.hasAwait;if(X&&!this.scope.inFunction)this.state.hasTopLevelAwait=!0;return X}parseAwait(X,J){let Q=X.index;this.setLoc(X);let Z=this.startNodeAt(X);if(this.expressionScope.recordParameterInitializerError(u.AwaitExpressionFormalParameter,Q),this.eat(51))this.raise(u.ObsoleteAwaitStar,X);if(!this.scope.inFunction&&!(this.optionFlags&1))if(this.isAmbiguousPrefixOrIdentifier())this.ambiguousScriptDifferentAst=!0;else this.sawUnambiguousESM=!0;if(!J)Z.argument=this.parseMaybeUnary(null,!0);return this.finishNode(Z,"AwaitExpression")}isAmbiguousPrefixOrIdentifier(){if(this.hasPrecedingLineBreak())return!0;let{type:X}=this.state;return X===49||X===6||X===0||SL(X)||X===98&&!this.state.containsEsc||X===133||X===52||this.hasPlugin("v8intrinsic")&&X===50}parseYield(X){this.setLoc(X);let J=this.startNodeAt(X);this.expressionScope.recordParameterInitializerError(u.YieldInParameter,X.index);let Q=!1,Z=null;if(!this.hasPrecedingLineBreak())switch(Q=this.eat(51),this.state.type){case 9:case 135:case 4:case 7:case 1:case 5:case 10:case 8:if(!Q)break;default:Z=this.parseMaybeAssign()}return J.delegate=Q,J.argument=Z,this.finishNode(J,"YieldExpression")}parseImportCall(X){this.next();let J=this.parseCallExpressionArguments();if(J.length===0||J.length>2)this.raise(u.ImportCallArity,X,X);else for(let Q of J)if(Q.type==="SpreadElement")this.raise(u.ImportCallSpreadArgument,Q,X);return X.source=J[0],X.options=J[1]??null,this.finishNode(X,"ImportExpression")}withTopicBindingContext(X){let J=this.state.inHackPipelineBody;this.state.inHackPipelineBody=!0;let Q=this.state.seenTopicReference;this.state.seenTopicReference=!1;try{return X()}finally{this.state.inHackPipelineBody=J,this.state.seenTopicReference=Q}}allowInAnd(X){let J=this.prodParam.currentFlags();if(24&~J){this.prodParam.enter(J|8|16);try{return X()}finally{this.prodParam.exit()}}return X()}disallowInAnd(X){let J=this.prodParam.currentFlags(),Q=8&J,Z=16&~J;if(Q||Z){this.prodParam.enter(J&-9|16);try{return X()}finally{this.prodParam.exit()}}return X()}registerTopicReference(){this.state.seenTopicReference=!0}topicReferenceIsAllowedInCurrentContext(){return this.state.inHackPipelineBody}topicReferenceWasUsedInCurrentContext(){return this.state.seenTopicReference}parseFSharpPipelineBody(X){let J=this.state.startLoc;this.prodParam.enter(this.prodParam.currentFlags()&-17);let Q;if(this.isContextual(92)&&this.recordAwaitIfAllowed()){this.next(),Q=this.parseAwait(J,!0);let Z=this.state.type;if(tF(Z)&&Z!==35&&(this.prodParam.hasIn||Z!==54))this.raise(u.PipelineUnparenthesized,J)}else this.state.canStartArrow=!0,Q=this.parseExprOp(this.parseMaybeUnaryOrPrivate(),J,X);return this.prodParam.exit(),Q}parseModuleExpression(){this.expectPlugin("moduleBlocks");let X=this.startNode();if(this.next(),!this.match(2))this.unexpected(null,2);let J=this.startNodeAt(this.state.endLoc);this.next();let Q=this.initializeScopes(!0);this.enterInitialScopes();try{X.body=this.parseProgram(J,4,"module")}finally{Q()}return this.finishNode(X,"ModuleExpression")}parseVoidPattern(X){this.expectPlugin("discardBinding");let J=this.startNode();if(X!=null)X.voidPatternLoc=this.state.startLoc;return this.next(),this.finishNode(J,"VoidPattern")}parseMaybeAssignAllowInOrVoidPattern(X,J,Q){if(J!=null&&this.match(84)){let Z=this.lookaheadCharCode();if(Z===44||Z===(X===1?93:X===4?125:41)||Z===61)return this.parseMaybeDefault(this.state.startLoc,this.parseVoidPattern(J))}return this.parseMaybeAssignAllowIn(J,Q)}parsePropertyNamePrefixOperator(X){}}var $L={kind:1},OQ0={kind:2},TQ0=/[\uD800-\uDFFF]/u,RL=/in(?:stanceof)?/y;function fP(X){for(let J=0;J<X.length;J++){let Q=X[J],{type:Z}=Q;if(typeof Z==="number")Q.type=MP(Z)}return X}class _P extends vP{parseTopLevel(X,J){if(X.program=this.parseProgram(J,135,this.options.sourceType==="module"?"module":"script"),X.comments=this.comments,this.optionFlags&512)X.tokens=fP(this.tokens);return this.finishNode(X,"File")}parseProgram(X,J,Q){if(X.sourceType=Q,X.interpreter=this.parseInterpreterDirective(),this.parseBlockBody(X,!0,!0,J),this.inModule){if(!(this.optionFlags&64)&&this.scope.undefinedExports.size>0)for(let[G,Y]of Array.from(this.scope.undefinedExports))this.raise(u.ModuleExportUndefined,Y,{localName:G});this.addExtra(X,"topLevelAwait",this.state.hasTopLevelAwait)}let Z;if(J===135)Z=this.finishNode(X,"Program");else Z=this.finishNodeAt(X,"Program",g7(this.state.startLoc,-1));return Z}stmtToDirective(X){let J=this.castNodeTo(X,"Directive"),Q=this.castNodeTo(X.expression,"DirectiveLiteral"),Z=Q.value,G=this.input.slice(this.offsetToSourcePos(Q.start),this.offsetToSourcePos(Q.end)),Y=Q.value=G.slice(1,-1);return this.addExtra(Q,"raw",G),this.addExtra(Q,"rawValue",Y),this.addExtra(Q,"expressionValue",Z),J.value=Q,delete X.expression,J}parseInterpreterDirective(){if(!this.match(24))return null;let X=this.startNode();return X.value=this.state.value,this.next(),this.finishNode(X,"InterpreterDirective")}isLet(){if(!this.isContextual(96))return!1;return this.hasFollowingBindingAtom()}isUsing(){if(!this.isContextual(103))return!1;return this.nextTokenIsIdentifierOnSameLine()}isForUsing(){if(!this.isContextual(103))return!1;let X=this.nextTokenInLineStart(),J=this.codePointAtPos(X);if(this.isUnparsedContextual(X,"of")){let Q=this.lookaheadCharCodeSince(X+2);if(Q!==61&&Q!==58&&Q!==59)return!1}if(this.chStartsBindingIdentifier(J,X)||this.isUnparsedContextual(X,"void"))return!0;return!1}nextTokenIsIdentifierOnSameLine(){let X=this.nextTokenInLineStart(),J=this.codePointAtPos(X);return this.chStartsBindingIdentifier(J,X)}isAwaitUsing(){if(!this.isContextual(92))return!1;let X=this.nextTokenInLineStart();if(this.isUnparsedContextual(X,"using")){X=this.nextTokenInLineStartSince(X+5);let J=this.codePointAtPos(X);if(this.chStartsBindingIdentifier(J,X))return!0}return!1}chStartsBindingIdentifier(X,J){if(u9(X)){if(RL.lastIndex=J,RL.test(this.input)){let Q=this.codePointAtPos(RL.lastIndex);if(!eX(Q)&&Q!==92)return!1}return!0}else if(X===92)return!0;else return!1}chStartsBindingPattern(X){return X===91||X===123}hasFollowingBindingAtom(){let X=this.nextTokenStart(),J=this.codePointAtPos(X);return this.chStartsBindingPattern(J)||this.chStartsBindingIdentifier(J,X)}hasInLineFollowingBindingIdentifierOrBrace(){let X=this.nextTokenInLineStart(),J=this.codePointAtPos(X);return J===123||this.chStartsBindingIdentifier(J,X)}allowsUsing(){return(this.scope.inModule||!this.scope.inTopLevel)&&!this.scope.inBareCaseStatement}parseModuleItem(){return this.parseStatementLike(15)}parseStatementListItem(){return this.parseStatementLike(6|(!this.options.annexB||this.state.strict?0:8))}parseStatementOrSloppyAnnexBFunctionDeclaration(X=!1){let J=0;if(this.options.annexB&&!this.state.strict){if(J|=4,X)J|=8}return this.parseStatementLike(J)}parseStatement(){return this.parseStatementLike(0)}parseStatementLike(X){let J=null;if(this.match(22))J=this.parseDecorators(!0);return this.parseStatementContent(X,J)}parseStatementContent(X,J){let Q=this.state.type,Z=this.startNode(),G=!!(X&2),Y=!!(X&4),V=X&1;switch(Q){case 56:return this.parseBreakContinueStatement(Z,!0);case 59:return this.parseBreakContinueStatement(Z,!1);case 60:return this.parseDebuggerStatement(Z);case 86:return this.parseDoWhileStatement(Z);case 87:return this.parseForStatement(Z);case 64:if(this.lookaheadCharCode()===46)break;if(!Y)this.raise(this.state.strict?u.StrictFunction:this.options.annexB?u.SloppyFunctionAnnexB:u.SloppyFunction,this.state.startLoc);return this.parseFunctionStatement(Z,!1,!G&&Y);case 76:if(!G)this.unexpected();return this.parseClass(this.maybeTakeDecorators(J,Z),!0);case 65:return this.parseIfStatement(Z);case 66:return this.parseReturnStatement(Z);case 67:return this.parseSwitchStatement(Z);case 68:return this.parseThrowStatement(Z);case 69:return this.parseTryStatement(Z);case 92:if(this.isAwaitUsing()){if(!this.allowsUsing())this.raise(u.UnexpectedUsingDeclaration,Z);else if(!G)this.raise(u.UnexpectedLexicalDeclaration,Z);else if(!this.recordAwaitIfAllowed())this.raise(u.AwaitUsingNotInAsyncContext,Z);return this.next(),this.parseVarStatement(Z,"await using")}break;case 103:if(this.state.containsEsc||!this.hasInLineFollowingBindingIdentifierOrBrace())break;if(!this.allowsUsing())this.raise(u.UnexpectedUsingDeclaration,this.state.startLoc);else if(!G)this.raise(u.UnexpectedLexicalDeclaration,this.state.startLoc);return this.parseVarStatement(Z,"using");case 96:{if(this.state.containsEsc)break;let W=this.nextTokenStart(),U=this.codePointAtPos(W);if(U!==91){if(!G&&this.hasFollowingLineBreak())break;if(!this.chStartsBindingIdentifier(U,W)&&U!==123)break}}case 71:if(!G)this.raise(u.UnexpectedLexicalDeclaration,this.state.startLoc);case 70:{let W=this.state.value;return this.parseVarStatement(Z,W)}case 88:return this.parseWhileStatement(Z);case 72:return this.parseWithStatement(Z);case 2:return this.parseBlock();case 9:return this.parseEmptyStatement(Z);case 79:{let W=this.lookaheadCharCode();if(W===40||W===46)break}case 78:{if(!(this.optionFlags&8)&&!V)this.raise(u.UnexpectedImportExport,this.state.startLoc);this.next();let W;if(Q===79)W=this.parseImport(Z);else W=this.parseExport(Z,J);return this.assertModuleNodeAllowed(W),W}default:if(this.isAsyncFunction()){if(!G)this.raise(u.AsyncFunctionInSingleStatementContext,this.state.startLoc);return this.next(),this.parseFunctionStatement(Z,!0,!G&&Y)}}let K=this.state.value,H=this.parseExpression();if(R5(Q)&&H.type==="Identifier"&&this.eat(10))return this.parseLabeledStatement(Z,K,H,X);else return this.parseExpressionStatement(Z,H)}assertModuleNodeAllowed(X){if(!(this.optionFlags&8)&&!this.inModule)this.raise(u.ImportOutsideModule,X)}maybeTakeDecorators(X,J,Q){if(X){if(J.decorators?.length)this.raise(u.DecoratorsBeforeAfterExport,J.decorators[0]),J.decorators.unshift(...X);else J.decorators=X;if(this.resetStartLocationFromNode(J,X[0]),Q)this.resetStartLocationFromNode(Q,J)}return J}canHaveLeadingDecorator(){return this.match(76)}parseDecorators(X){let J=[];do J.push(this.parseDecorator());while(this.match(22));if(this.match(78)){if(!X)this.unexpected()}else if(!this.canHaveLeadingDecorator())throw this.raise(u.UnexpectedLeadingDecorator,this.state.startLoc);return J}parseDecorator(){this.expectOnePlugin(["decorators","decorators-legacy"]);let X=this.startNode();if(this.next(),this.hasPlugin("decorators")){let J=this.state.startLoc,Q;if(this.match(6)){let Z=this.state.startLoc;this.next(),Q=this.parseExpression(),this.expect(7),Q=this.wrapParenthesis(Z,Q);let G=this.state.startLoc;if(X.expression=this.parseMaybeDecoratorArguments(Q,Z),X.expression!==Q)this.raise(u.DecoratorArgumentsOutsideParentheses,G)}else{Q=this.parseIdentifier(!1);while(this.eat(12)){let Z=this.startNodeAt(J);if(Z.object=Q,this.match(134))this.classScope.usePrivateName(this.state.value,this.state.startLoc),Z.property=this.parsePrivateName();else Z.property=this.parseIdentifier(!0);Z.computed=!1,Q=this.finishNode(Z,"MemberExpression")}X.expression=this.parseMaybeDecoratorArguments(Q,J)}}else this.state.canStartArrow=!1,X.expression=this.parseExprSubscripts();return this.finishNode(X,"Decorator")}parseMaybeDecoratorArguments(X,J){if(this.eat(6)){let Q=this.startNodeAt(J);return Q.callee=X,Q.arguments=this.parseCallExpressionArguments(),this.toReferencedList(Q.arguments),this.finishNode(Q,"CallExpression")}return X}parseBreakContinueStatement(X,J){if(this.next(),this.isLineTerminator())X.label=null;else X.label=this.parseIdentifier(),this.semicolon();return this.verifyBreakContinue(X,J),this.finishNode(X,J?"BreakStatement":"ContinueStatement")}verifyBreakContinue(X,J){let Q;for(Q=0;Q<this.state.labels.length;++Q){let Z=this.state.labels[Q];if(X.label==null||Z.name===X.label.name){if(Z.kind!=null&&(J||Z.kind===1))break;if(X.label&&J)break}}if(Q===this.state.labels.length){let Z=J?"BreakStatement":"ContinueStatement";this.raise(u.IllegalBreakContinue,X,{type:Z})}}parseDebuggerStatement(X){return this.next(),this.semicolon(),this.finishNode(X,"DebuggerStatement")}parseHeaderExpression(){this.expect(6);let X=this.parseExpression();return this.expect(7),X}parseDoWhileStatement(X){return this.next(),this.state.labels.push($L),X.body=this.parseStatement(),this.state.labels.pop(),this.expect(88),X.test=this.parseHeaderExpression(),this.eat(9),this.finishNode(X,"DoWhileStatement")}parseForStatement(X){this.next(),this.state.labels.push($L);let J=null;if(this.isContextual(92)&&this.recordAwaitIfAllowed())J=this.state.startLoc,this.next();if(this.scope.enter(0),this.expect(6),this.match(9)){if(J!==null)this.unexpected(J);return this.parseFor(X,null)}let Q=this.isContextual(96);{let K=this.isAwaitUsing(),H=K||this.isForUsing(),W=Q&&this.hasFollowingBindingAtom()||H;if(this.match(70)||this.match(71)||W){let U=this.startNode(),z;if(K){if(z="await using",!this.recordAwaitIfAllowed())this.raise(u.AwaitUsingNotInAsyncContext,this.state.startLoc);this.next()}else z=this.state.value;this.next(),this.parseVar(U,!0,z);let q=this.finishNode(U,"VariableDeclaration"),B=this.match(54);if(B&&H)this.raise(u.ForInUsing,q);if((B||this.isContextual(98))&&q.declarations.length===1)return this.parseForX(X,q,J);if(J!==null)this.unexpected(J);return this.parseFor(X,q)}}let Z=this.isContextual(91),G=new AG,Y=this.parseExpression(!0,G),V=this.isContextual(98);if(V){if(Q)this.raise(u.ForOfLet,Y);if(J===null&&Z&&Y.type==="Identifier")this.raise(u.ForOfAsync,Y)}if(V||this.match(54)){this.checkDestructuringPrivate(G),this.toAssignable(Y,!0);let K=V?"ForOfStatement":"ForInStatement";return this.checkLVal(Y,{type:K}),this.parseForX(X,Y,J)}else this.checkExpressionErrors(G,!0);if(J!==null)this.unexpected(J);return this.parseFor(X,Y)}parseFunctionStatement(X,J,Q){return this.next(),this.parseFunction(X,1|(Q?2:0)|(J?8:0))}parseIfStatement(X){return this.next(),X.test=this.parseHeaderExpression(),X.consequent=this.parseStatementOrSloppyAnnexBFunctionDeclaration(),X.alternate=this.eat(62)?this.parseStatementOrSloppyAnnexBFunctionDeclaration():null,this.finishNode(X,"IfStatement")}parseReturnStatement(X){if(!this.prodParam.hasReturn)this.raise(u.IllegalReturn,this.state.startLoc);if(this.next(),this.isLineTerminator())X.argument=null;else X.argument=this.parseExpression(),this.semicolon();return this.finishNode(X,"ReturnStatement")}parseSwitchStatement(X){this.next(),X.discriminant=this.parseHeaderExpression();let J=X.cases=[];this.expect(2),this.state.labels.push(OQ0),this.scope.enter(256);let Q;for(let Z;!this.match(4);)if(this.match(57)||this.match(61)){let G=this.match(57);if(Q)this.finishNode(Q,"SwitchCase");if(J.push(Q=this.startNode()),Q.consequent=[],this.next(),G)Q.test=this.parseExpression();else{if(Z)this.raise(u.MultipleDefaultsInSwitch,this.state.lastTokStartLoc);Z=!0,Q.test=null}this.expect(10)}else if(Q)Q.consequent.push(this.parseStatementListItem());else this.unexpected();if(this.scope.exit(),Q)this.finishNode(Q,"SwitchCase");return this.next(),this.state.labels.pop(),this.finishNode(X,"SwitchStatement")}parseThrowStatement(X){if(this.next(),this.hasPrecedingLineBreak())this.raise(u.NewlineAfterThrow,this.state.lastTokEndLoc);return X.argument=this.parseExpression(),this.semicolon(),this.finishNode(X,"ThrowStatement")}parseCatchClauseParam(){let X=this.parseBindingAtom();return this.scope.enter(this.options.annexB&&X.type==="Identifier"?8:0),this.checkLVal(X,{type:"CatchClause"},9),X}parseTryStatement(X){if(this.next(),X.block=this.parseBlock(),X.handler=null,this.match(58)){let J=this.startNode();if(this.next(),this.match(6))this.expect(6),J.param=this.parseCatchClauseParam(),this.expect(7);else J.param=null,this.scope.enter(0);J.body=this.parseBlock(!1,!1),this.scope.exit(),X.handler=this.finishNode(J,"CatchClause")}if(X.finalizer=this.eat(63)?this.parseBlock():null,!X.handler&&!X.finalizer)this.raise(u.NoCatchOrFinally,X);return this.finishNode(X,"TryStatement")}parseVarStatement(X,J,Q=!1){return this.next(),this.parseVar(X,!1,J,Q),this.semicolon(),this.finishNode(X,"VariableDeclaration")}parseWhileStatement(X){return this.next(),X.test=this.parseHeaderExpression(),this.state.labels.push($L),X.body=this.parseStatement(),this.state.labels.pop(),this.finishNode(X,"WhileStatement")}parseWithStatement(X){if(this.state.strict)this.raise(u.StrictWith,this.state.startLoc);return this.next(),X.object=this.parseHeaderExpression(),X.body=this.parseStatement(),this.finishNode(X,"WithStatement")}parseEmptyStatement(X){return this.next(),this.finishNode(X,"EmptyStatement")}parseLabeledStatement(X,J,Q,Z){for(let Y of this.state.labels)if(Y.name===J)this.raise(u.LabelRedeclaration,Q,{labelName:J});let G=v10(this.state.type)?1:this.match(67)?2:null;for(let Y=this.state.labels.length-1;Y>=0;Y--){let V=this.state.labels[Y];if(V.statementStart===X.start)V.statementStart=this.sourceToOffsetPos(this.state.start),V.kind=G;else break}return this.state.labels.push({name:J,kind:G,statementStart:this.sourceToOffsetPos(this.state.start)}),X.body=Z&8?this.parseStatementOrSloppyAnnexBFunctionDeclaration(!0):this.parseStatement(),this.state.labels.pop(),X.label=Q,this.finishNode(X,"LabeledStatement")}parseExpressionStatement(X,J){return X.expression=J,this.semicolon(),this.finishNode(X,"ExpressionStatement")}parseBlock(X=!1,J=!0,Q){let Z=this.startNode();if(X)this.state.strictErrors.clear();if(this.expect(2),J)this.scope.enter(0);if(this.parseBlockBody(Z,X,!1,4,Q),J)this.scope.exit();return this.finishNode(Z,"BlockStatement")}isValidDirective(X){return X.type==="ExpressionStatement"&&X.expression.type==="StringLiteral"&&!X.expression.extra.parenthesized}parseBlockBody(X,J,Q,Z,G){let Y=X.body=[],V=X.directives=[];this.parseBlockOrModuleBlockBody(Y,J?V:void 0,Q,Z,G)}parseBlockOrModuleBlockBody(X,J,Q,Z,G){let Y=this.state.strict,V=!1,K=!1;while(!this.match(Z)){let H=Q?this.parseModuleItem():this.parseStatementListItem();if(J&&!K){if(this.isValidDirective(H)){let W=this.stmtToDirective(H);if(J.push(W),!V&&W.value.value==="use strict")V=!0,this.setStrict(!0);continue}K=!0,this.state.strictErrors.clear()}X.push(H)}if(G?.call(this,V),!Y)this.setStrict(!1);this.next()}parseFor(X,J){return X.init=J,this.semicolon(!1),X.test=this.match(9)?null:this.parseExpression(),this.semicolon(!1),X.update=this.match(7)?null:this.parseExpression(),this.expect(7),X.body=this.parseStatement(),this.scope.exit(),this.state.labels.pop(),this.finishNode(X,"ForStatement")}parseForX(X,J,Q){let Z=this.match(54);if(this.next(),Z){if(Q!==null)this.unexpected(Q)}else X.await=Q!==null;if(J.type==="VariableDeclaration"&&J.declarations[0].init!=null&&(!Z||!this.options.annexB||this.state.strict||J.kind!=="var"||J.declarations[0].id.type!=="Identifier"))this.raise(u.ForInOfLoopInitializer,J,{type:Z?"ForInStatement":"ForOfStatement"});if(J.type==="AssignmentPattern")this.raise(u.InvalidLhs,J,{ancestor:{type:"ForStatement"}});return X.left=J,X.right=Z?this.parseExpression():this.parseMaybeAssignAllowIn(),this.expect(7),X.body=this.parseStatement(),this.scope.exit(),this.state.labels.pop(),this.finishNode(X,Z?"ForInStatement":"ForOfStatement")}parseVar(X,J,Q,Z=!1){let G=X.declarations=[];X.kind=Q;for(;;){let Y=this.startNode();if(this.parseVarId(Y,Q),Y.init=!this.eat(25)?null:J?this.parseMaybeAssignDisallowIn():this.parseMaybeAssignAllowIn(),Y.init===null&&!Z){if(Y.id.type!=="Identifier"&&!(J&&(this.match(54)||this.isContextual(98))))this.raise(u.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:"destructuring"});else if((Q==="const"||Q==="using"||Q==="await using")&&!(this.match(54)||this.isContextual(98)))this.raise(u.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:Q})}if(G.push(this.finishNode(Y,"VariableDeclarator")),!this.eat(8))break}return X}parseVarId(X,J){let Q=this.parseBindingAtom();if(J==="using"||J==="await using"){if(Q.type==="ArrayPattern"||Q.type==="ObjectPattern")this.raise(u.UsingDeclarationHasBindingPattern,Q)}else if(Q.type==="VoidPattern")this.raise(u.UnexpectedVoidPattern,Q);this.checkLVal(Q,{type:"VariableDeclarator"},J==="var"?5:8201),X.id=Q}parseAsyncFunctionExpression(X){return this.parseFunction(X,8)}parseFunction(X,J=0){let Q=J&2,Z=!!(J&1),G=Z&&!(J&4),Y=!!(J&8);if(this.initFunction(X,Y),this.match(51)){if(Q)this.raise(u.GeneratorInSingleStatementContext,this.state.startLoc);this.next(),X.generator=!0}if(Z)X.id=this.parseFunctionId(G);if(this.scope.enter(514),this.prodParam.enter(_W(Y,X.generator)),!Z&&R5(this.state.type))this.expressionScope.enter(wL()),X.id=this.parseFunctionId(),this.expressionScope.exit();if(this.parseFunctionParams(X,!1),this.parseFunctionBodyAndFinish(X,Z?"FunctionDeclaration":"FunctionExpression"),this.prodParam.exit(),this.scope.exit(),Z&&!Q)this.registerFunctionStatementId(X);return X}parseFunctionId(X){return X||R5(this.state.type)?this.parseIdentifier():null}parseFunctionParams(X,J){this.expect(6),this.expressionScope.enter(MQ0()),X.params=this.parseBindingList(7,41,2|(J?4:0)),this.expressionScope.exit()}registerFunctionStatementId(X){if(!X.id)return;this.scope.declareName(X.id.name,!this.options.annexB||this.state.strict||X.generator||X.async?this.scope.treatFunctionsAsVar?5:8201:17,X.id.start)}parseClass(X,J,Q){this.next();let Z=this.state.strict;return this.state.strict=!0,this.parseClassId(X,J,Q),this.parseClassSuper(X),X.body=this.parseClassBody(!!X.superClass,Z),this.finishNode(X,J?"ClassDeclaration":"ClassExpression")}isClassProperty(){return this.match(25)||this.match(9)||this.match(4)}isClassMethod(){return this.match(6)}nameIsConstructor(X){return X.type==="Identifier"&&X.name==="constructor"||X.type==="StringLiteral"&&X.value==="constructor"}isNonstaticConstructor(X){return!X.computed&&!X.static&&this.nameIsConstructor(X.key)}parseClassBody(X,J){this.classScope.enter();let Q={hadConstructor:!1,hadSuperClass:X},Z=[],G=this.startNode();G.body=[],this.expect(2);while(!this.match(4)){if(this.eat(9)){if(Z.length>0)throw this.raise(u.DecoratorSemicolon,this.state.lastTokEndLoc);continue}if(this.match(22)){Z.push(this.parseDecorator());continue}let Y=this.startNode();if(Z.length)Y.decorators=Z,this.resetStartLocationFromNode(Y,Z[0]),Z=[];this.parseClassMember(G,Y,Q)}if(this.state.strict=J,this.next(),Z.length)throw this.raise(u.TrailingDecorator,this.state.startLoc);return this.classScope.exit(),this.finishNode(G,"ClassBody")}parseClassMemberFromModifier(X,J){let Q=this.parseIdentifier(!0);if(this.isClassMethod()){let Z=J;return Z.kind="method",Z.computed=!1,Z.key=Q,Z.static=!1,this.pushClassMethod(X,Z,!1,!1,!1,!1),!0}else if(this.isClassProperty()){let Z=J;return Z.computed=!1,Z.key=Q,Z.static=!1,X.body.push(this.parseClassProperty(Z)),!0}return this.resetPreviousNodeTrailingComments(Q),!1}parseClassMember(X,J,Q){let Z=this.isContextual(102);if(Z){if(this.parseClassMemberFromModifier(X,J))return;if(this.eat(2)){this.parseClassStaticBlock(X,J);return}}this.parseClassMemberWithIsStatic(X,J,Q,Z)}parseClassMemberWithIsStatic(X,J,Q,Z){let G=J,Y=J,V=J,K=J,H=J,W=G,U=G;if(J.static=Z,this.parsePropertyNamePrefixOperator(J),this.eat(51)){W.kind="method";let T=this.match(134);if(this.parseClassElementName(W),this.parsePostMemberNameModifiers(W),T){this.pushClassPrivateMethod(X,Y,!0,!1);return}if(this.isNonstaticConstructor(G))this.raise(u.ConstructorIsGenerator,G.key);this.pushClassMethod(X,G,!0,!1,!1,!1);return}let z=!this.state.containsEsc&&R5(this.state.type),q=this.parseClassElementName(J),B=z?q.name:null,M=this.isPrivateName(q),L=this.state.startLoc;if(this.parsePostMemberNameModifiers(U),this.isClassMethod()){if(W.kind="method",M){this.pushClassPrivateMethod(X,Y,!1,!1);return}let T=this.isNonstaticConstructor(G),O=!1;if(T){if(G.kind="constructor",G.decorators&&G.decorators.length>0)this.raise(u.DecoratorConstructor,J);if(Q.hadConstructor&&!this.hasPlugin("typescript"))this.raise(u.DuplicateConstructor,q);if(T&&this.hasPlugin("typescript")&&J.override)this.raise(u.OverrideOnConstructor,q);Q.hadConstructor=!0,O=Q.hadSuperClass}this.pushClassMethod(X,G,!1,!1,T,O)}else if(this.isClassProperty())if(M)this.pushClassPrivateProperty(X,K);else this.pushClassProperty(X,V);else if(B==="async"&&!this.isLineTerminator()){this.resetPreviousNodeTrailingComments(q);let T=this.eat(51);if(U.optional)this.unexpected(L);W.kind="method";let O=this.match(134);if(this.parseClassElementName(W),this.parsePostMemberNameModifiers(U),O)this.pushClassPrivateMethod(X,Y,T,!0);else{if(this.isNonstaticConstructor(G))this.raise(u.ConstructorIsAsync,G.key);this.pushClassMethod(X,G,T,!0,!1,!1)}}else if((B==="get"||B==="set")&&!(this.match(51)&&this.isLineTerminator())){this.resetPreviousNodeTrailingComments(q),W.kind=B;let T=this.match(134);if(this.parseClassElementName(G),T)this.pushClassPrivateMethod(X,Y,!1,!1);else{if(this.isNonstaticConstructor(G))this.raise(u.ConstructorIsAccessor,G.key);this.pushClassMethod(X,G,!1,!1,!1,!1)}this.checkGetterSetterParams(G)}else if(B==="accessor"&&!this.isLineTerminator()){this.expectPlugin("decoratorAutoAccessors"),this.resetPreviousNodeTrailingComments(q);let T=this.match(134);this.parseClassElementName(V),this.pushClassAccessorProperty(X,H,T)}else if(this.isLineTerminator())if(M)this.pushClassPrivateProperty(X,K);else this.pushClassProperty(X,V);else this.unexpected()}parseClassElementName(X){let{type:J,value:Q}=this.state;if((J===128||J===130)&&X.static&&Q==="prototype")this.raise(u.StaticPrototype,this.state.startLoc);if(J===134){if(Q==="constructor")this.raise(u.ConstructorClassPrivateField,this.state.startLoc);let Z=this.parsePrivateName();return X.key=Z,Z}return this.parsePropertyName(X),X.key}parseClassStaticBlock(X,J){this.scope.enter(720);let Q=this.state.labels;this.state.labels=[],this.prodParam.enter(0);let Z=J.body=[];if(this.parseBlockOrModuleBlockBody(Z,void 0,!1,4),this.prodParam.exit(),this.scope.exit(),this.state.labels=Q,X.body.push(this.finishNode(J,"StaticBlock")),J.decorators?.length)this.raise(u.DecoratorStaticBlock,J)}pushClassProperty(X,J){if(!J.computed&&this.nameIsConstructor(J.key))this.raise(u.ConstructorClassField,J.key);X.body.push(this.parseClassProperty(J))}pushClassPrivateProperty(X,J){let Q=this.parseClassPrivateProperty(J);X.body.push(Q),this.classScope.declarePrivateName(this.getPrivateNameSV(Q.key),0,Q.key.start)}pushClassAccessorProperty(X,J,Q){if(!Q&&!J.computed&&this.nameIsConstructor(J.key))this.raise(u.ConstructorClassField,J.key);let Z=this.parseClassAccessorProperty(J);if(X.body.push(Z),Q)this.classScope.declarePrivateName(this.getPrivateNameSV(Z.key),0,Z.key.start)}pushClassMethod(X,J,Q,Z,G,Y){X.body.push(this.parseMethod(J,Q,Z,G,Y,"ClassMethod",!0))}pushClassPrivateMethod(X,J,Q,Z){let G=this.parseMethod(J,Q,Z,!1,!1,"ClassPrivateMethod",!0);X.body.push(G);let Y=G.kind==="get"?G.static?6:2:G.kind==="set"?G.static?5:1:0;this.declareClassPrivateMethodInScope(G,Y)}declareClassPrivateMethodInScope(X,J){this.classScope.declarePrivateName(this.getPrivateNameSV(X.key),J,X.key.start)}parsePostMemberNameModifiers(X){}parseClassPrivateProperty(X){return this.parseInitializer(X),this.semicolon(),this.finishNode(X,"ClassPrivateProperty")}parseClassProperty(X){return this.parseInitializer(X),this.semicolon(),this.finishNode(X,"ClassProperty")}parseClassAccessorProperty(X){return this.parseInitializer(X),this.semicolon(),this.finishNode(X,"ClassAccessorProperty")}parseInitializer(X){this.scope.enter(592),this.expressionScope.enter(wL()),this.prodParam.enter(0),X.value=this.eat(25)?this.parseMaybeAssignAllowIn():null,this.expressionScope.exit(),this.prodParam.exit(),this.scope.exit()}parseClassId(X,J,Q,Z=8331){if(R5(this.state.type)){if(X.id=this.parseIdentifier(),J)this.declareNameFromIdentifier(X.id,Z)}else if(Q||!J)X.id=null;else throw this.raise(u.MissingClassName,this.state.startLoc)}parseClassSuper(X){if(this.eat(77))this.state.canStartArrow=!1,X.superClass=this.parseExprSubscripts();else X.superClass=null}parseExport(X,J){let Q=this.parseMaybeImportPhase(X,!0),Z=this.maybeParseExportDefaultSpecifier(X,Q),G=!Z||this.eat(8),Y=G&&this.eatExportStar(X),V=Y&&this.maybeParseExportNamespaceSpecifier(X),K=G&&(!V||this.eat(8)),H=Z||Y;if(Y&&!V){if(Z)this.unexpected();if(J)throw this.raise(u.UnsupportedDecoratorExport,X);return this.parseExportFrom(X,!0),this.sawUnambiguousESM=!0,this.finishNode(X,"ExportAllDeclaration")}let W=this.maybeParseExportNamedSpecifiers(X);if(Z&&G&&!Y&&!W)this.unexpected(null,2);if(V&&K)this.unexpected(null,94);let U;if(H||W){if(U=!1,J)throw this.raise(u.UnsupportedDecoratorExport,X);this.parseExportFrom(X,H)}else U=this.maybeParseExportDeclaration(X);if(H||W||U){let z=X;if(this.checkNamedExport(z,!!z.source),z.declaration?.type==="ClassDeclaration")this.maybeTakeDecorators(J,z.declaration,z);else if(J)throw this.raise(u.UnsupportedDecoratorExport,X);return this.sawUnambiguousESM=!0,this.finishNode(z,"ExportNamedDeclaration")}if(this.eat(61)){let z=X,q=this.parseExportDefaultExpression();if(z.declaration=q,q.type==="ClassDeclaration")this.maybeTakeDecorators(J,q,z);else if(J)throw this.raise(u.UnsupportedDecoratorExport,X);if(this.checkDuplicateExports(X,"default"),this.hasPlugin("exportDefaultFrom")){if(q.type==="Identifier"&&q.name==="from"&&q.end-q.start===4&&!q.extra?.parenthesized)this.raise(u.ExportDefaultFromAsIdentifier,q)}return this.sawUnambiguousESM=!0,this.finishNode(z,"ExportDefaultDeclaration")}throw this.unexpected(null,2)}eatExportStar(X){return this.eat(51)}maybeParseExportDefaultSpecifier(X,J){if(J||this.isExportDefaultSpecifier()){this.expectPlugin("exportDefaultFrom",J?.start);let Q=J||this.parseIdentifier(!0),Z=this.startNodeAtNode(Q);return Z.exported=Q,X.specifiers=[this.finishNode(Z,"ExportDefaultSpecifier")],!0}return!1}maybeParseExportNamespaceSpecifier(X){if(this.isContextual(89)){X.specifiers??=[];let J=this.startNodeAt(this.state.lastTokStartLoc);return this.next(),J.exported=this.parseModuleExportName(),X.specifiers.push(this.finishNode(J,"ExportNamespaceSpecifier")),!0}return!1}maybeParseExportNamedSpecifiers(X){if(this.match(2)){let J=X;if(!J.specifiers)J.specifiers=[];let Q=J.exportKind==="type";return J.specifiers.push(...this.parseExportSpecifiers(Q)),J.source=null,J.attributes=[],J.declaration=null,!0}return!1}maybeParseExportDeclaration(X){if(this.shouldParseExportDeclaration())return X.specifiers=[],X.source=null,X.attributes=[],X.declaration=this.parseExportDeclaration(X),!0;return!1}isAsyncFunction(){if(!this.isContextual(91))return!1;let X=this.nextTokenInLineStart();return this.isUnparsedContextual(X,"function")}parseExportDefaultExpression(){let X=this.startNode();if(this.match(64))return this.next(),this.parseFunction(X,5);else if(this.isAsyncFunction())return this.next(),this.next(),this.parseFunction(X,13);if(this.match(76))return this.parseClass(X,!0,!0);if(this.match(22))return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(!1),this.startNode()),!0,!0);if(this.match(71)||this.match(70)||this.isLet()||this.isUsing()||this.isAwaitUsing())throw this.raise(u.UnsupportedDefaultExport,this.state.startLoc);let J=this.parseMaybeAssignAllowIn();return this.semicolon(),J}parseExportDeclaration(X){if(this.match(76))return this.parseClass(this.startNode(),!0,!1);return this.parseStatementListItem()}isExportDefaultSpecifier(){let{type:X}=this.state;if(R5(X)){if(X===91&&!this.state.containsEsc||X===96)return!1;if((X===126||X===125)&&!this.state.containsEsc){let Z=this.nextTokenStart(),G=this.input.charCodeAt(Z);if(G===123||this.chStartsBindingIdentifier(G,Z)&&!this.input.startsWith("from",Z))return this.expectOnePlugin(["flow","typescript"]),!1}}else if(!this.match(61))return!1;let J=this.nextTokenStart(),Q=this.isUnparsedContextual(J,"from");if(this.input.charCodeAt(J)===44||R5(this.state.type)&&Q)return!0;if(this.match(61)&&Q){let Z=this.input.charCodeAt(this.nextTokenStartSince(J+4));return Z===34||Z===39}return!1}parseExportFrom(X,J){if(this.eatContextual(94))X.source=this.parseImportSource(),this.maybeParseImportAttributes(X);else if(J)this.unexpected();this.semicolon()}shouldParseExportDeclaration(){let{type:X}=this.state;if(X===22){if(this.expectOnePlugin(["decorators","decorators-legacy"]),this.hasPlugin("decorators"))return!0}if(this.isUsing())return this.raise(u.UsingDeclarationExport,this.state.startLoc),!0;if(this.isAwaitUsing())return this.raise(u.UsingDeclarationExport,this.state.startLoc),!0;return X===70||X===71||X===64||X===76||this.isLet()||this.isAsyncFunction()}checkNamedExport(X,J){if(X.specifiers?.length)for(let Q of X.specifiers){let{exported:Z}=Q,G=Z.type==="Identifier"?Z.name:Z.value;if(this.checkDuplicateExports(Q,G),!J&&Q.type==="ExportSpecifier"){let{local:Y}=Q;if(Y.type!=="Identifier")this.raise(u.ExportBindingIsString,Q,{localName:Y.value,exportName:G});else this.checkReservedWord(Y.name,Y.start,!0,!1),this.scope.checkLocalExport(Y)}}else if(X.declaration){let Q=X.declaration;if(Q.type==="FunctionDeclaration"||Q.type==="ClassDeclaration"){let{id:Z}=Q;if(!Z)throw Error("Assertion failure");this.checkDuplicateExports(X,Z.name)}else if(Q.type==="VariableDeclaration")for(let Z of Q.declarations)this.checkDeclaration(Z.id)}}checkDeclaration(X){if(X.type==="Identifier")this.checkDuplicateExports(X,X.name);else if(X.type==="ObjectPattern")for(let J of X.properties)this.checkDeclaration(J);else if(X.type==="ArrayPattern"){for(let J of X.elements)if(J)this.checkDeclaration(J)}else if(X.type==="ObjectProperty")this.checkDeclaration(X.value);else if(X.type==="RestElement")this.checkDeclaration(X.argument);else if(X.type==="AssignmentPattern")this.checkDeclaration(X.left)}checkDuplicateExports(X,J){if(this.exportedIdentifiers.has(J))if(J==="default")this.raise(u.DuplicateDefaultExport,X);else this.raise(u.DuplicateExport,X,{exportName:J});this.exportedIdentifiers.add(J)}parseExportSpecifiers(X){let J=[],Q=!0;this.expect(2);while(!this.eat(4)){if(Q)Q=!1;else if(this.expect(8),this.eat(4))break;let Z=this.isContextual(126),G=this.match(130),Y=this.startNode();Y.local=this.parseModuleExportName(),J.push(this.parseExportSpecifier(Y,G,X,Z))}return J}parseExportSpecifier(X,J,Q,Z){if(this.eatContextual(89))X.exported=this.parseModuleExportName();else if(J)X.exported=this.cloneStringLiteral(X.local);else if(!X.exported)X.exported=this.cloneIdentifier(X.local);return this.finishNode(X,"ExportSpecifier")}parseModuleExportName(){if(this.match(130)){let X=this.parseStringLiteral(this.state.value),J=TQ0.exec(X.value);if(J)this.raise(u.ModuleExportNameHasLoneSurrogate,X,{surrogateCharCode:J[0].charCodeAt(0)});return X}return this.parseIdentifier(!0)}checkImportPhase(X){let{specifiers:J}=X,Q=J.length===1?J[0].type:null;if(X.phase==="source"){if(Q!=="ImportDefaultSpecifier")this.raise(u.SourcePhaseImportRequiresDefault,J[0])}else if(X.phase==="defer"){if(Q!=="ImportNamespaceSpecifier")this.raise(u.DeferImportRequiresNamespace,J[0])}}isPotentialImportPhase(X){if(X)return!1;return this.isContextual(101)||this.isContextual(93)}applyImportPhase(X,J,Q,Z){if(J)return;if(Q==="source")this.expectPlugin("sourcePhaseImports",Z),X.phase="source";else if(Q==="defer")this.expectPlugin("deferredImportEvaluation",Z),X.phase="defer";else if(this.hasPlugin("sourcePhaseImports"))X.phase=null}parseMaybeImportPhase(X,J){if(!this.isPotentialImportPhase(J))return this.applyImportPhase(X,J,null),null;let Q=this.startNode(),Z=this.parseIdentifierName(!0),{type:G}=this.state;if(s8(G)?G!==94||this.lookaheadCharCode()===102:G!==8)return this.applyImportPhase(X,J,Z,Q.start),null;else return this.applyImportPhase(X,J,null),this.createIdentifier(Q,Z)}isPrecedingIdImportPhase(X){let{type:J}=this.state;return R5(J)?J!==94||this.lookaheadCharCode()===102:J!==8}parseImport(X){if(this.match(130))return this.parseImportSourceAndAttributes(X);return this.parseImportSpecifiersAndAfter(X,this.parseMaybeImportPhase(X,!1))}parseImportSpecifiersAndAfter(X,J){X.specifiers=[];let Z=!this.maybeParseDefaultImportSpecifier(X,J)||this.eat(8),G=Z&&this.maybeParseStarImportSpecifier(X);if(Z&&!G)this.parseNamedImportSpecifiers(X);return this.expectContextual(94),this.parseImportSourceAndAttributes(X)}parseImportSourceAndAttributes(X){return X.specifiers??=[],X.source=this.parseImportSource(),this.maybeParseImportAttributes(X),this.checkImportPhase(X),this.semicolon(),this.sawUnambiguousESM=!0,this.finishNode(X,"ImportDeclaration")}parseImportSource(){if(!this.match(130))this.unexpected();return this.parseExprAtom()}parseImportSpecifierLocal(X,J,Q){J.local=this.parseIdentifier(),X.specifiers.push(this.finishImportSpecifier(J,Q))}finishImportSpecifier(X,J,Q=8201){return this.checkLVal(X.local,{type:J},Q),this.finishNode(X,J)}parseImportAttributes(){this.expect(2);let X=[],J=new Set;do{if(this.match(4))break;let Q=this.startNode(),Z=this.state.value;if(J.has(Z))this.raise(u.ModuleAttributesWithDuplicateKeys,this.state.startLoc,{key:Z});if(J.add(Z),this.match(130))Q.key=this.parseStringLiteral(Z);else Q.key=this.parseIdentifier(!0);if(this.expect(10),!this.match(130))throw this.raise(u.ModuleAttributeInvalidValue,this.state.startLoc);Q.value=this.parseStringLiteral(this.state.value),X.push(this.finishNode(Q,"ImportAttribute"))}while(this.eat(8));return this.expect(4),X}maybeParseImportAttributes(X){let J;if(this.match(72)){if(this.hasPrecedingLineBreak()&&this.lookaheadCharCode()===40)return;this.next(),J=this.parseImportAttributes()}else J=[];X.attributes=J}maybeParseDefaultImportSpecifier(X,J){if(J){let Q=this.startNodeAtNode(J);return Q.local=J,X.specifiers.push(this.finishImportSpecifier(Q,"ImportDefaultSpecifier")),!0}else if(s8(this.state.type))return this.parseImportSpecifierLocal(X,this.startNode(),"ImportDefaultSpecifier"),!0;return!1}maybeParseStarImportSpecifier(X){if(this.match(51)){let J=this.startNode();return this.next(),this.expectContextual(89),this.parseImportSpecifierLocal(X,J,"ImportNamespaceSpecifier"),!0}return!1}parseNamedImportSpecifiers(X){let J=!0;this.expect(2);while(!this.eat(4)){if(J)J=!1;else{if(this.eat(10))throw this.raise(u.DestructureNamedImport,this.state.startLoc);if(this.expect(8),this.eat(4))break}let Q=this.startNode(),Z=this.match(130),G=this.isContextual(126);Q.imported=this.parseModuleExportName();let Y=this.parseImportSpecifier(Q,Z,X.importKind==="type"||X.importKind==="typeof",G,void 0);X.specifiers.push(Y)}}parseImportSpecifier(X,J,Q,Z,G){if(this.eatContextual(89))X.local=this.parseIdentifier();else{let{imported:Y}=X;if(J)throw this.raise(u.ImportBindingIsString,X,{importName:Y.value});if(this.checkReservedWord(Y.name,X.start,!0,!0),!X.local)X.local=this.cloneIdentifier(Y)}return this.finishImportSpecifier(X,"ImportSpecifier",G)}isThisParam(X){return X.type==="Identifier"&&X.name==="this"}}var AL=/in(?:stanceof)?|as|satisfies/y;function IQ0(X){if(X==null)throw Error(`Unexpected ${X} value.`);return X}function VP(X){if(!X)throw Error("Assert fail")}var jQ0={AbstractMethodHasImplementation:({methodName:X})=>`Method '${X}' cannot have an implementation because it is marked abstract.`,AbstractPropertyHasInitializer:({propertyName:X})=>`Property '${X}' cannot have an initializer because it is marked abstract.`,AccessorCannotBeOptional:"An 'accessor' property cannot be declared optional.",AccessorCannotDeclareThisParameter:"'get' and 'set' accessors cannot declare 'this' parameters.",AccessorCannotHaveTypeParameters:"An accessor cannot have type parameters.",ClassMethodHasDeclare:"Class methods cannot have the 'declare' modifier.",ClassMethodHasReadonly:"Class methods cannot have the 'readonly' modifier.",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",ConstructorHasTypeParameters:"Type parameters cannot appear on a constructor declaration.",DeclaratorDefiniteAssertionRequiresTypeAnnotation:"Declarations with definite assignment assertions must also have type annotations.",DeclaratorDefiniteAssertionWithInitializer:"Declarations with initializers cannot also have definite assignment assertions.",DeclareAccessor:({kind:X})=>`'declare' is not allowed in ${X}ters.`,DeclareClassFieldHasInitializer:"Initializers are not allowed in ambient contexts.",DeclareFunctionHasImplementation:"An implementation cannot be declared in ambient contexts.",DecoratorAbstractMethod:({kind:X})=>`Decorators can't be used with ${X.startsWith("a")?"an":"a"} ${X}.`,DuplicateAccessibilityModifier:({modifier:X})=>`Accessibility modifier already seen: '${X}'.`,DuplicateModifier:({modifier:X})=>`Duplicate modifier: '${X}'.`,EmptyHeritageClauseType:({token:X})=>`'${X}' list cannot be empty.`,EmptyNamespaceName:"Namespace must be given a name.",EmptyTypeArguments:"Type argument list cannot be empty.",EmptyTypeParameters:"Type parameter list cannot be empty.",ExpectedAmbientAfterExportDeclare:"'export declare' must be followed by an ambient declaration.",ExportAssignmentInTSNamespace:"An export assignment cannot be used in a namespace.",ExportInTSNamespace:"Export declarations are not permitted in a namespace.",ImportAliasHasImportType:"An import alias can not use 'import type'.",ImportInTSNamespace:"Import declarations in a namespace cannot reference a module.",IncompatibleModifiers:({modifiers:X})=>`'${X[0]}' modifier cannot be used with '${X[1]}' modifier.`,IndexSignatureHasAbstract:"Index signatures cannot have the 'abstract' modifier.",IndexSignatureHasAccessibility:({modifier:X})=>`Index signatures cannot have an accessibility modifier ('${X}').`,IndexSignatureHasDeclare:"Index signatures cannot have the 'declare' modifier.",IndexSignatureHasOverride:"'override' modifier cannot appear on an index signature.",IndexSignatureHasStatic:"Index signatures cannot have the 'static' modifier.",InitializerNotAllowedInAmbientContext:"Initializers are not allowed in ambient contexts.",InlineModuleDeclarationMustUseString:"`module ... {}` declarations must have a string name. Use `namespace ... {}` instead.",InvalidHeritageClauseType:({token:X})=>`'${X}' list can only include identifiers or qualified-names with optional type arguments.`,InvalidModifierOnAwaitUsingDeclaration:(X)=>`'${X}' modifier cannot appear on an await using declaration.`,InvalidModifierOnTypeMember:({modifier:X})=>`'${X}' modifier cannot appear on a type member.`,InvalidModifierOnTypeParameter:({modifier:X})=>`'${X}' modifier cannot appear on a type parameter.`,InvalidModifierOnTypeParameterPositions:({modifier:X})=>`'${X}' modifier can only appear on a type parameter of a class, interface or type alias.`,InvalidModifierOnUsingDeclaration:(X)=>`'${X}' modifier cannot appear on a using declaration.`,InvalidModifiersOrder:({orderedModifiers:X})=>`'${X[0]}' modifier must precede '${X[1]}' modifier.`,InvalidNamespaceName:(X)=>`Namespace name cannot be '${X}'.`,InvalidPropertyAccessAfterInstantiationExpression:"Invalid property access after an instantiation expression. You can either wrap the instantiation expression in parentheses, or delete the type arguments.",InvalidTupleMemberLabel:"Tuple members must be labeled with a simple identifier.",MissingInterfaceName:"'interface' declarations must be followed by an identifier.",NamespaceExportInTSNamespace:"Global module exports may only appear at top level.",NonAbstractClassHasAbstractMethod:"Abstract methods can only appear within an abstract class.",NonClassMethodPropertyHasAbstractModifier:"'abstract' modifier can only appear on a class, method, or property declaration.",OptionalTypeBeforeRequired:"A required element cannot follow an optional element.",OverrideNotInSubClass:"This member cannot have an 'override' modifier because its containing class does not extend another class.",PatternIsOptional:"A binding pattern parameter cannot be optional in an implementation signature.",PrivateElementHasAbstract:"Private elements cannot have the 'abstract' modifier.",PrivateElementHasAccessibility:({modifier:X})=>`Private elements cannot have an accessibility modifier ('${X}').`,ReadonlyForMethodSignature:"'readonly' modifier can only appear on a property declaration or index signature.",ReservedArrowTypeParam:"This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.",ReservedTypeAssertion:"This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",SetAccessorCannotHaveOptionalParameter:"A 'set' accessor cannot have an optional parameter.",SetAccessorCannotHaveRestParameter:"A 'set' accessor cannot have rest parameter.",SetAccessorCannotHaveReturnType:"A 'set' accessor cannot have a return type annotation.",SingleTypeParameterWithoutTrailingComma:({typeParameterName:X})=>`Single type parameter ${X} should have a trailing comma. Example usage: <${X},>.`,StaticBlockCannotHaveModifier:"Static class blocks cannot have any modifier.",TupleOptionalAfterType:"A labeled tuple optional element must be declared using a question mark after the name and before the colon (`name?: type`), rather than after the type (`name: type?`).",TypeAnnotationAfterAssign:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeImportCannotSpecifyDefaultAndNamed:"A type-only import can specify a default import or named bindings, but not both.",TypeModifierIsUsedInTypeExports:"The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",TypeModifierIsUsedInTypeImports:"The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",UnexpectedParameterInitializer:"A parameter initializer is only allowed in a function or constructor implementation.",UnexpectedParameterModifier:"A parameter property is only allowed in a constructor implementation.",UnexpectedReadonly:"'readonly' type modifier is only permitted on array and tuple literal types.",UnexpectedTypeAnnotation:"Did not expect a type annotation here.",UnexpectedTypeCastInParameter:"Unexpected type cast in parameter position.",UnexpectedTypeDeclaration:(X)=>`'${X}' declarations can only be declared inside a block.`,UnsupportedImportTypeArgument:"Argument in a type import must be a string literal.",UnsupportedParameterPropertyKind:"A parameter property may not be declared using a binding pattern.",UnsupportedSignatureParameterKind:({type:X})=>`Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${X}.`,UsingDeclarationInAmbientContext:(X)=>`'${X}' declarations are not allowed in ambient contexts.`},U0=Z9`typescript`(jQ0);function NQ0(X){switch(X){case"any":return"TSAnyKeyword";case"boolean":return"TSBooleanKeyword";case"bigint":return"TSBigIntKeyword";case"never":return"TSNeverKeyword";case"number":return"TSNumberKeyword";case"object":return"TSObjectKeyword";case"string":return"TSStringKeyword";case"symbol":return"TSSymbolKeyword";case"undefined":return"TSUndefinedKeyword";case"unknown":return"TSUnknownKeyword";default:return}}function KP(X){return X==="private"||X==="public"||X==="protected"}function $Q0(X){return X==="in"||X==="out"}function FL(X){if(X.extra?.parenthesized)return!1;switch(X.type){case"Identifier":return!0;case"MemberExpression":return!X.computed&&FL(X.object);case"TSInstantiationExpression":return FL(X.expression);default:return!1}}var RQ0=X1(["declare","private","public","protected","override","abstract","readonly","static"],["in","out"]),AQ0=X1(["readonly"],["declare","abstract","private","protected","public","static","override"]),SQ0=X1(["public","private","protected","override","readonly"]),EQ0=X1(["private","public","protected"]),CQ0=(X)=>class J extends X{getScopeHandler(){return RP}tsIsIdentifier(){return R5(this.state.type)}tsTokenCanFollowModifier(){return this.match(0)||this.match(2)||this.match(51)||this.match(17)||this.match(134)||this.isLiteralPropertyName()}tsNextTokenOnSameLineAndCanFollowModifier(){if(this.next(),this.hasPrecedingLineBreak())return!1;return this.tsTokenCanFollowModifier()}tsNextTokenCanFollowModifier(){if(this.match(102))return this.next(),this.tsTokenCanFollowModifier();return this.tsNextTokenOnSameLineAndCanFollowModifier()}tsParseModifier(Q,Z,G){if(!R5(this.state.type)&&this.state.type!==54&&this.state.type!==71)return;let Y=this.state.value;if(Q.has(Y)){if(G&&this.match(102))return;if(Z&&this.tsIsStartOfStaticBlocks())return;if(this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this)))return Y}return}tsParseModifiers(Q,Z=U0.InvalidModifierOnTypeMember,G,Y=!1){let V=(H,W,U,z)=>{if(W===U&&G[z])this.raise(U0.InvalidModifiersOrder,H,{orderedModifiers:[U,z]})},K=(H,W,U,z)=>{if(G[U]&&W===z||G[z]&&W===U)this.raise(U0.IncompatibleModifiers,H,{modifiers:[U,z]})};for(;;){let{startLoc:H}=this.state,W=this.tsParseModifier(Q,Y,G.static);if(!W)break;if(KP(W))if(G.accessibility)this.raise(U0.DuplicateAccessibilityModifier,H,{modifier:W});else V(H,W,W,"override"),V(H,W,W,"static"),V(H,W,W,"readonly"),G.accessibility=W;else if($Q0(W)){if(G[W])this.raise(U0.DuplicateModifier,H,{modifier:W});G[W]=!0,V(H,W,"in","out")}else{if(Object.hasOwn(G,W))this.raise(U0.DuplicateModifier,H,{modifier:W});else V(H,W,"static","readonly"),V(H,W,"static","override"),V(H,W,"override","readonly"),V(H,W,"abstract","override"),K(H,W,"declare","override"),K(H,W,"static","abstract");G[W]=!0}if(!Q.get(W))this.raise(Z,H,{modifier:W})}}tsIsListTerminator(Q){switch(Q){case"EnumMembers":case"TypeMembers":return this.match(4);case"HeritageClauseElement":return this.match(2);case"TupleElementTypes":return this.match(1);case"TypeParametersOrArguments":return this.match(44)}}tsParseList(Q,Z){let G=[];while(!this.tsIsListTerminator(Q))G.push(Z());return G}tsParseDelimitedList(Q,Z,G){return IQ0(this.tsParseDelimitedListWorker(Q,Z,!0,G))}tsParseDelimitedListWorker(Q,Z,G,Y){let V=[],K=-1;for(;;){if(this.tsIsListTerminator(Q))break;K=-1;let H=Z();if(H==null)return;if(V.push(H),this.eat(8)){K=this.state.lastTokStartLoc.index;continue}if(this.tsIsListTerminator(Q))break;if(G)this.expect(8);return}if(Y)Y.value=K;return V}tsParseBracketedList(Q,Z,G,Y,V){if(!Y)if(G)this.expect(0);else this.expect(43);let K=this.tsParseDelimitedList(Q,Z,V);if(G)this.expect(1);else this.expect(44);return K}tsParseImportType(){let Q=this.startNode();if(this.expect(79),this.expect(6),!this.match(130))this.raise(U0.UnsupportedImportTypeArgument,this.state.startLoc),Q.source=this.tsParseNonConditionalType();else Q.source=this.parseStringLiteral(this.state.value);if(this.eat(8))Q.options=this.tsParseImportTypeOptions();else Q.options=null;if(this.expect(7),this.eat(12))Q.qualifier=this.tsParseEntityName(3);if(this.match(43))Q.typeArguments=this.tsParseTypeArguments();return this.finishNode(Q,"TSImportType")}tsParseImportTypeOptions(){let Q=this.startNode();this.expect(2);let Z=this.startNode();if(this.isContextual(72))Z.method=!1,Z.key=this.parseIdentifier(!0),Z.computed=!1,Z.shorthand=!1;else this.unexpected(null,72);return this.expect(10),Z.value=this.tsParseImportTypeWithPropertyValue(),Q.properties=[this.finishObjectProperty(Z)],this.eat(8),this.expect(4),this.finishNode(Q,"ObjectExpression")}tsParseImportTypeWithPropertyValue(){let Q=this.startNode(),Z=[];this.expect(2);while(!this.match(4)){let G=this.state.type;if(R5(G)||G===130)Z.push(super.parsePropertyDefinition(null));else this.unexpected();this.eat(8)}return Q.properties=Z,this.next(),this.finishNode(Q,"ObjectExpression")}tsParseEntityName(Q){let Z;if(Q&1&&this.match(74))if(Q&2)Z=this.parseIdentifier(!0);else{let G=this.startNode();this.next(),Z=this.finishNode(G,"ThisExpression")}else Z=this.parseIdentifier(!!(Q&1));while(this.eat(12)){let G=this.startNodeAtNode(Z);G.left=Z,G.right=this.parseIdentifier(!!(Q&1)),Z=this.finishNode(G,"TSQualifiedName")}return Z}tsParseTypeReference(){let Q=this.startNode();if(Q.typeName=this.tsParseEntityName(1),!this.hasPrecedingLineBreak()&&this.match(43))Q.typeArguments=this.tsParseTypeArguments();return this.finishNode(Q,"TSTypeReference")}tsParseThisTypePredicate(Q){this.next();let Z=this.startNodeAtNode(Q);return Z.parameterName=Q,Z.typeAnnotation=this.tsParseTypeAnnotation(!1),Z.asserts=!1,this.finishNode(Z,"TSTypePredicate")}tsParseThisTypeNode(){let Q=this.startNode();return this.next(),this.finishNode(Q,"TSThisType")}tsParseTypeQuery(){let Q=this.startNode();if(this.expect(83),this.match(79))Q.exprName=this.tsParseImportType();else Q.exprName=this.tsParseEntityName(1);if(!this.hasPrecedingLineBreak()&&this.match(43))Q.typeArguments=this.tsParseTypeArguments();return this.finishNode(Q,"TSTypeQuery")}tsParseInOutModifiers=this.tsParseModifiers.bind(this,X1(["in","out"],["const","public","private","protected","readonly","declare","abstract","override"]),U0.InvalidModifierOnTypeParameter);tsParseConstModifier=this.tsParseModifiers.bind(this,X1(["const"],["in","out"]),U0.InvalidModifierOnTypeParameterPositions);tsParseInOutConstModifiers=this.tsParseModifiers.bind(this,X1(["in","out","const"],["public","private","protected","readonly","declare","abstract","override"]),U0.InvalidModifierOnTypeParameter);tsParseTypeParameter(Q){let Z=this.startNode();return Q(Z),Z.name=this.tsParseTypeParameterName(),Z.constraint=this.tsEatThenParseType(77),Z.default=this.tsEatThenParseType(25),this.finishNode(Z,"TSTypeParameter")}tsTryParseTypeParameters(Q){if(this.match(43))return this.tsParseTypeParameters(Q)}tsParseTypeParameters(Q){let Z=this.startNode();if(this.match(43)||this.match(138))this.next();else this.unexpected();let G={value:-1};if(Z.params=this.tsParseBracketedList("TypeParametersOrArguments",this.tsParseTypeParameter.bind(this,Q),!1,!0,G),Z.params.length===0)this.raise(U0.EmptyTypeParameters,Z);if(G.value!==-1)this.addExtra(Z,"trailingComma",G.value);return this.finishNode(Z,"TSTypeParameterDeclaration")}tsFillSignature(Q,Z){let G=Q===15,Y="params",V="returnType";if(Z.typeParameters=this.tsTryParseTypeParameters(this.tsParseConstModifier),this.expect(6),Z.params=this.tsParseBindingListForSignature(),G)Z.returnType=this.tsParseTypeOrTypePredicateAnnotation(Q);else if(this.match(Q))Z.returnType=this.tsParseTypeOrTypePredicateAnnotation(Q)}tsParseBindingListForSignature(){let Q=super.parseBindingList(7,41,2);for(let Z of Q){let{type:G}=Z;if(G==="AssignmentPattern"||G==="TSParameterProperty")this.raise(U0.UnsupportedSignatureParameterKind,Z,{type:G})}return Q}tsParseTypeMemberSemicolon(){if(!this.eat(8)&&!this.isLineTerminator())this.expect(9)}tsParseSignatureMember(Q,Z){return this.tsFillSignature(10,Z),this.tsParseTypeMemberSemicolon(),this.finishNode(Z,Q)}tsIsUnambiguouslyIndexSignature(){if(this.next(),R5(this.state.type))return this.next(),this.match(10);return!1}tsTryParseIndexSignature(Q){if(!(this.match(0)&&this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this))))return;this.expect(0);let Z=this.parseIdentifier();Z.typeAnnotation=this.tsParseTypeAnnotation(),this.resetEndLocation(Z),this.expect(1),Q.parameters=[Z];let G=this.tsTryParseTypeAnnotation();if(G)Q.typeAnnotation=G;return this.tsParseTypeMemberSemicolon(),this.finishNode(Q,"TSIndexSignature")}tsParsePropertyOrMethodSignature(Q,Z){if(this.eat(13))Q.optional=!0;if(this.match(6)||this.match(43)){if(Z)this.raise(U0.ReadonlyForMethodSignature,Q);let G=Q;if(G.kind&&this.match(43))this.raise(U0.AccessorCannotHaveTypeParameters,this.state.curPosition());if(this.tsFillSignature(10,G),this.tsParseTypeMemberSemicolon(),G.kind==="get"){if(G.params.length>0){if(this.raise(u.BadGetterArity,this.state.curPosition()),this.isThisParam(G.params[0]))this.raise(U0.AccessorCannotDeclareThisParameter,this.state.curPosition())}}else if(G.kind==="set"){if(G.params.length!==1)this.raise(u.BadSetterArity,this.state.curPosition());else{let Y=G.params[0];if(this.isThisParam(Y))this.raise(U0.AccessorCannotDeclareThisParameter,this.state.curPosition());if(Y.type==="Identifier"&&Y.optional)this.raise(U0.SetAccessorCannotHaveOptionalParameter,this.state.curPosition());if(Y.type==="RestElement")this.raise(U0.SetAccessorCannotHaveRestParameter,this.state.curPosition())}if(G.returnType)this.raise(U0.SetAccessorCannotHaveReturnType,G.returnType)}else G.kind="method";return this.finishNode(G,"TSMethodSignature")}else{let G=Q;if(Z)G.readonly=!0;let Y=this.tsTryParseTypeAnnotation();if(Y)G.typeAnnotation=Y;return this.tsParseTypeMemberSemicolon(),this.finishNode(G,"TSPropertySignature")}}tsParseTypeMember(){let Q=this.startNode();if(this.match(6)||this.match(43))return this.tsParseSignatureMember("TSCallSignatureDeclaration",Q);if(this.match(73)){let G=this.startNode();if(this.next(),this.match(6)||this.match(43))return this.tsParseSignatureMember("TSConstructSignatureDeclaration",Q);else return Q.key=this.createIdentifier(G,"new"),this.tsParsePropertyOrMethodSignature(Q,!1)}this.tsParseModifiers(AQ0,void 0,Q);let Z=this.tsTryParseIndexSignature(Q);if(Z)return Z;if(super.parsePropertyName(Q),!Q.computed&&Q.key.type==="Identifier"&&(Q.key.name==="get"||Q.key.name==="set")&&this.tsTokenCanFollowModifier()){if(Q.kind=Q.key.name,super.parsePropertyName(Q),!this.match(6)&&!this.match(43))this.unexpected(null,6)}return this.tsParsePropertyOrMethodSignature(Q,!!Q.readonly)}tsParseTypeLiteral(){let Q=this.startNode();return Q.members=this.tsParseObjectTypeMembers(),this.finishNode(Q,"TSTypeLiteral")}tsParseObjectTypeMembers(){this.expect(2);let Q=this.tsParseList("TypeMembers",this.tsParseTypeMember.bind(this));return this.expect(4),Q}tsIsStartOfMappedType(){if(this.next(),this.eat(49))return this.isContextual(118);if(this.isContextual(118))this.next();if(!this.match(0))return!1;if(this.next(),!this.tsIsIdentifier())return!1;return this.next(),this.match(54)}tsParseMappedType(){let Q=this.startNode();if(this.expect(2),this.match(49))Q.readonly=this.state.value,this.next(),this.expectContextual(118);else if(this.eatContextual(118))Q.readonly=!0;if(this.expect(0),Q.key=this.tsParseTypeParameterName(),Q.constraint=this.tsExpectThenParseType(54),Q.nameType=this.eatContextual(89)?this.tsParseType():null,this.expect(1),this.match(49))Q.optional=this.state.value,this.next(),this.expect(13);else if(this.eat(13))Q.optional=!0;return Q.typeAnnotation=this.tsTryParseType(),this.semicolon(),this.expect(4),this.finishNode(Q,"TSMappedType")}tsParseTupleType(){let Q=this.startNode();Q.elementTypes=this.tsParseBracketedList("TupleElementTypes",this.tsParseTupleElementType.bind(this),!0,!1);let Z=!1;return Q.elementTypes.forEach((G)=>{let{type:Y}=G;if(Z&&Y!=="TSRestType"&&Y!=="TSOptionalType"&&!(Y==="TSNamedTupleMember"&&G.optional))this.raise(U0.OptionalTypeBeforeRequired,G);Z||=Y==="TSNamedTupleMember"&&G.optional||Y==="TSOptionalType"}),this.finishNode(Q,"TSTupleType")}tsParseTupleElementType(){let Q=this.state.startLoc,Z=this.eat(17),{startLoc:G}=this.state,Y,V,K,H,U=s8(this.state.type)?this.lookaheadCharCode():null;if(U===58)Y=!0,K=!1,V=this.parseIdentifier(!0),this.expect(10),H=this.tsParseType();else if(U===63){K=!0;let z=this.state.value,q=this.tsParseNonArrayType();if(this.lookaheadCharCode()===58)Y=!0,V=this.createIdentifier(this.startNodeAt(G),z),this.expect(13),this.expect(10),H=this.tsParseType();else Y=!1,H=q,this.expect(13)}else H=this.tsParseType(),K=this.eat(13),Y=this.eat(10);if(Y){let z;if(V){if(z=this.startNodeAt(G),z.optional=K,z.label=V,z.elementType=H,this.eat(13))z.optional=!0,this.raise(U0.TupleOptionalAfterType,this.state.lastTokStartLoc)}else z=this.startNodeAt(G),z.optional=K,this.raise(U0.InvalidTupleMemberLabel,H),z.label=H,z.elementType=this.tsParseType();H=this.finishNode(z,"TSNamedTupleMember")}else if(K){let z=this.startNodeAt(G);z.typeAnnotation=H,H=this.finishNode(z,"TSOptionalType")}if(Z){let z=this.startNodeAt(Q);z.typeAnnotation=H,H=this.finishNode(z,"TSRestType")}return H}tsParseParenthesizedType(){let Q=this.startNode();return this.expect(6),Q.typeAnnotation=this.tsParseType(),this.expect(7),this.finishNode(Q,"TSParenthesizedType")}tsParseFunctionOrConstructorType(Q,Z){let G=this.startNode();if(Q==="TSConstructorType"){if(G.abstract=!!Z,Z)this.next();this.next()}return this.tsInAllowConditionalTypesContext(()=>this.tsFillSignature(15,G)),this.finishNode(G,Q)}tsParseLiteralTypeNode(){let Q=this.startNode();switch(this.state.type){case 131:case 132:case 130:case 81:case 82:Q.literal=super.parseExprAtom();break;default:this.unexpected()}return this.finishNode(Q,"TSLiteralType")}tsParseTemplateLiteralType(){let Q=this.state.startLoc,Z=this.parseTemplateElement(!1),G=[Z];if(Z.tail){let Y=this.startNodeAt(Q),V=this.startNodeAt(Q);return V.expressions=[],V.quasis=G,Y.literal=this.finishNode(V,"TemplateLiteral"),this.finishNode(Y,"TSLiteralType")}else{let Y=[];while(!Z.tail)Y.push(this.tsParseType()),this.readTemplateContinuation(),G.push(Z=this.parseTemplateElement(!1));let V=this.startNodeAt(Q);return V.types=Y,V.quasis=G,this.finishNode(V,"TSTemplateLiteralType")}}parseTemplateSubstitution(){if(this.state.inType)return this.tsParseType();return super.parseTemplateSubstitution()}tsParseThisTypeOrThisTypePredicate(){let Q=this.tsParseThisTypeNode();if(this.isContextual(112)&&!this.hasPrecedingLineBreak())return this.tsParseThisTypePredicate(Q);else return Q}tsParseNonArrayType(){switch(this.state.type){case 130:case 131:case 132:case 81:case 82:return this.tsParseLiteralTypeNode();case 49:if(this.state.value==="-"){let Q=this.startNode(),Z=this.lookahead();if(Z.type!==131&&Z.type!==132)this.unexpected();return Q.literal=this.parseMaybeUnary(),this.finishNode(Q,"TSLiteralType")}break;case 74:return this.tsParseThisTypeOrThisTypePredicate();case 83:return this.tsParseTypeQuery();case 79:return this.tsParseImportType();case 2:return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this))?this.tsParseMappedType():this.tsParseTypeLiteral();case 0:return this.tsParseTupleType();case 6:if(!(this.optionFlags&2048)){let Q=this.state.startLoc;this.next();let Z=this.tsParseType();return this.expect(7),this.addExtra(Z,"parenthesized",!0),this.addExtra(Z,"parenStart",Q.index),Z}return this.tsParseParenthesizedType();case 21:case 20:return this.tsParseTemplateLiteralType();default:{let{type:Q}=this.state;if(R5(Q)||Q===84||Q===80){let Z=Q===84?"TSVoidKeyword":Q===80?"TSNullKeyword":NQ0(this.state.value);if(Z!==void 0&&this.lookaheadCharCode()!==46){let G=this.startNode();return this.next(),this.finishNode(G,Z)}return this.tsParseTypeReference()}}}throw this.unexpected()}tsParseArrayTypeOrHigher(){let{startLoc:Q}=this.state,Z=this.tsParseNonArrayType();while(!this.hasPrecedingLineBreak()&&this.eat(0))if(this.match(1)){let G=this.startNodeAt(Q);G.elementType=Z,this.expect(1),Z=this.finishNode(G,"TSArrayType")}else{let G=this.startNodeAt(Q);G.objectType=Z,G.indexType=this.tsParseType(),this.expect(1),Z=this.finishNode(G,"TSIndexedAccessType")}return Z}tsParseTypeOperator(){let Q=this.startNode(),Z=this.state.value;if(this.next(),Q.operator=Z,Q.typeAnnotation=this.tsParseTypeOperatorOrHigher(),Z==="readonly")this.tsCheckTypeAnnotationForReadOnly(Q);return this.finishNode(Q,"TSTypeOperator")}tsCheckTypeAnnotationForReadOnly(Q){switch(Q.typeAnnotation.type){case"TSTupleType":case"TSArrayType":return;default:this.raise(U0.UnexpectedReadonly,Q)}}tsParseInferType(){let Q=this.startNode();this.expectContextual(111);let Z=this.startNode();return Z.name=this.tsParseTypeParameterName(),Z.constraint=this.tsTryParse(()=>this.tsParseConstraintForInferType()),Q.typeParameter=this.finishNode(Z,"TSTypeParameter"),this.finishNode(Q,"TSInferType")}tsParseConstraintForInferType(){if(this.eat(77)){let Q=this.tsInDisallowConditionalTypesContext(()=>this.tsParseType());if(this.state.inDisallowConditionalTypesContext||!this.match(13))return Q}}tsParseTypeOperatorOrHigher(){return m10(this.state.type)&&!this.state.containsEsc?this.tsParseTypeOperator():this.isContextual(111)?this.tsParseInferType():this.tsInAllowConditionalTypesContext(()=>this.tsParseArrayTypeOrHigher())}tsParseUnionOrIntersectionType(Q,Z,G){let Y=this.startNode(),V=this.eat(G),K=[];do K.push(Z());while(this.eat(G));if(K.length===1&&!V)return K[0];return Y.types=K,this.finishNode(Y,Q)}tsParseIntersectionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSIntersectionType",this.tsParseTypeOperatorOrHigher.bind(this),41)}tsParseUnionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSUnionType",this.tsParseIntersectionTypeOrHigher.bind(this),39)}tsIsStartOfFunctionType(){if(this.match(43))return!0;return this.match(6)&&this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this))}tsSkipParameterStart(){if(R5(this.state.type)||this.match(74))return this.next(),!0;if(this.match(2)){let{errors:Q}=this.state,Z=Q.length;try{return this.parseObjectLike(4,!0),Q.length===Z}catch{return!1}}if(this.match(0)){this.next();let{errors:Q}=this.state,Z=Q.length;try{return super.parseBindingList(1,93,1),Q.length===Z}catch{return!1}}return!1}tsIsUnambiguouslyStartOfFunctionType(){if(this.next(),this.match(7)||this.match(17))return!0;if(this.tsSkipParameterStart()){if(this.match(10)||this.match(8)||this.match(13)||this.match(25))return!0;if(this.match(7)){if(this.next(),this.match(15))return!0}}return!1}tsParseTypeOrTypePredicateAnnotation(Q){return this.tsInType(()=>{let Z=this.startNode();this.expect(Q);let G=this.startNode(),Y=!!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));if(Y&&this.match(74)){let H=this.tsParseThisTypeOrThisTypePredicate();if(H.type==="TSThisType")G.parameterName=H,G.asserts=!0,G.typeAnnotation=null,H=this.finishNode(G,"TSTypePredicate");else this.resetStartLocationFromNode(H,G),H.asserts=!0;return Z.typeAnnotation=H,this.finishNode(Z,"TSTypeAnnotation")}let V=this.tsIsIdentifier()&&this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this));if(!V){if(!Y)return this.tsParseTypeAnnotation(!1,Z);return G.parameterName=this.parseIdentifier(),G.asserts=Y,G.typeAnnotation=null,Z.typeAnnotation=this.finishNode(G,"TSTypePredicate"),this.finishNode(Z,"TSTypeAnnotation")}let K=this.tsParseTypeAnnotation(!1);return G.parameterName=V,G.typeAnnotation=K,G.asserts=Y,Z.typeAnnotation=this.finishNode(G,"TSTypePredicate"),this.finishNode(Z,"TSTypeAnnotation")})}tsTryParseTypeOrTypePredicateAnnotation(){if(this.match(10))return this.tsParseTypeOrTypePredicateAnnotation(10)}tsTryParseTypeAnnotation(){if(this.match(10))return this.tsParseTypeAnnotation()}tsTryParseType(){return this.tsEatThenParseType(10)}tsParseTypePredicatePrefix(){let Q=this.parseIdentifier();if(this.isContextual(112)&&!this.hasPrecedingLineBreak())return this.next(),Q}tsParseTypePredicateAsserts(){if(this.state.type!==105)return!1;let Q=this.state.containsEsc;if(this.next(),!R5(this.state.type)&&!this.match(74))return!1;if(Q)this.raise(u.InvalidEscapedReservedWord,this.state.lastTokStartLoc,{reservedWord:"asserts"});return!0}tsParseTypeAnnotation(Q=!0,Z=this.startNode()){return this.tsInType(()=>{if(Q)this.expect(10);Z.typeAnnotation=this.tsParseType()}),this.finishNode(Z,"TSTypeAnnotation")}tsParseType(){VP(this.state.inType);let Q=this.tsParseNonConditionalType();if(this.state.inDisallowConditionalTypesContext||this.hasPrecedingLineBreak()||!this.eat(77))return Q;let Z=this.startNodeAtNode(Q);return Z.checkType=Q,Z.extendsType=this.tsInDisallowConditionalTypesContext(()=>this.tsParseNonConditionalType()),this.expect(13),Z.trueType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.expect(10),Z.falseType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.finishNode(Z,"TSConditionalType")}isAbstractConstructorSignature(){return this.isContextual(120)&&this.isLookaheadContextual("new")}tsParseNonConditionalType(){if(this.tsIsStartOfFunctionType())return this.tsParseFunctionOrConstructorType("TSFunctionType");if(this.match(73))return this.tsParseFunctionOrConstructorType("TSConstructorType");else if(this.isAbstractConstructorSignature())return this.tsParseFunctionOrConstructorType("TSConstructorType",!0);return this.tsParseUnionTypeOrHigher()}tsParseTypeAssertion(){if(this.getPluginOption("typescript","disallowAmbiguousJSXLike"))this.raise(U0.ReservedTypeAssertion,this.state.startLoc);let Q=this.startNode();return Q.typeAnnotation=this.tsInType(()=>{return this.next(),this.match(71)?this.tsParseTypeReference():this.tsParseType()}),this.expect(44),Q.expression=this.parseMaybeUnary(),this.finishNode(Q,"TSTypeAssertion")}tsParseHeritageClause(Q){let Z=this.state.startLoc,G=this.tsParseDelimitedList("HeritageClauseElement",()=>{let Y=(this.state.canStartArrow=!1,super.parseExprSubscripts());if(!FL(Y))this.raise(U0.InvalidHeritageClauseType,Y.start,{token:Q});let V=Q==="extends"?"TSInterfaceHeritage":"TSClassImplements";if(Y.type==="TSInstantiationExpression")return Y.type=V,Y;let K=this.startNodeAtNode(Y);if(K.expression=Y,this.match(43)||this.match(47))K.typeArguments=this.tsParseTypeArgumentsInExpression();return this.finishNode(K,V)});if(!G.length)this.raise(U0.EmptyHeritageClauseType,Z,{token:Q});return G}tsParseInterfaceDeclaration(Q,Z={}){if(this.hasFollowingLineBreak())return null;if(this.expectContextual(125),Z.declare)Q.declare=!0;if(R5(this.state.type))Q.id=this.parseIdentifier(),this.checkIdentifier(Q.id,130);else Q.id=null,this.raise(U0.MissingInterfaceName,this.state.startLoc);if(Q.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers),this.eat(77))Q.extends=this.tsParseHeritageClause("extends");let G=this.startNode();return G.body=this.tsInType(this.tsParseObjectTypeMembers.bind(this)),Q.body=this.finishNode(G,"TSInterfaceBody"),this.finishNode(Q,"TSInterfaceDeclaration")}tsParseTypeAliasDeclaration(Q){return Q.id=this.parseIdentifier(),this.checkIdentifier(Q.id,2),Q.typeAnnotation=this.tsInType(()=>{if(Q.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutModifiers),this.expect(25),this.isContextual(110)&&this.lookaheadCharCode()!==46){let Z=this.startNode();return this.next(),this.finishNode(Z,"TSIntrinsicKeyword")}return this.tsParseType()}),this.semicolon(),this.finishNode(Q,"TSTypeAliasDeclaration")}tsInTopLevelContext(Q){if(this.curContext()!==l5.brace){let Z=this.state.context;this.state.context=[Z[0]];try{return Q()}finally{this.state.context=Z}}else return Q()}tsInType(Q){let Z=this.state.inType;this.state.inType=!0;try{return Q()}finally{this.state.inType=Z}}tsInDisallowConditionalTypesContext(Q){let Z=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!0;try{return Q()}finally{this.state.inDisallowConditionalTypesContext=Z}}tsInAllowConditionalTypesContext(Q){let Z=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!1;try{return Q()}finally{this.state.inDisallowConditionalTypesContext=Z}}tsEatThenParseType(Q){if(this.match(Q))return this.tsNextThenParseType()}tsExpectThenParseType(Q){return this.tsInType(()=>{return this.expect(Q),this.tsParseType()})}tsNextThenParseType(){return this.tsInType(()=>{return this.next(),this.tsParseType()})}tsParseEnumMember(){let Q=this.startNode();if(Q.id=this.match(130)?super.parseStringLiteral(this.state.value):this.parseIdentifier(!0),this.eat(25))Q.initializer=super.parseMaybeAssignAllowIn();return this.finishNode(Q,"TSEnumMember")}tsParseEnumDeclaration(Q,Z={}){if(Z.const)Q.const=!0;if(Z.declare)Q.declare=!0;return this.expectContextual(122),Q.id=this.parseIdentifier(),this.checkIdentifier(Q.id,Q.const?8971:8459),Q.body=this.tsParseEnumBody(),this.finishNode(Q,"TSEnumDeclaration")}tsParseEnumBody(){let Q=this.startNode();return this.expect(2),Q.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this)),this.expect(4),this.finishNode(Q,"TSEnumBody")}tsParseModuleBlock(Q){let Z=this.startNode();if(!Q)this.scope.enter(0);if(this.expect(2),super.parseBlockOrModuleBlockBody(Z.body=[],void 0,!0,4),!Q)this.scope.exit();return this.finishNode(Z,"TSModuleBlock")}tsParseNamespaceDeclaration(Q){if(Q.id=this.tsParseEntityName(0),Q.id.type==="Identifier")this.checkIdentifier(Q.id,1024);return this.scope.enter(2048),this.prodParam.enter(0),Q.body=this.tsParseModuleBlock(!1),this.prodParam.exit(),this.scope.exit(),this.finishNode(Q,"TSModuleDeclaration")}tsParseAmbientExternalModuleDeclaration(Q){let Z=this.isContextual(108);if(Z)Q.kind="global",Q.id=this.parseIdentifier();else{Q.kind="module";let{type:G,value:Y}=this.state;if(G===130)Q.id=super.parseStringLiteral(Y);else if(R5(G))this.raise(U0.InlineModuleDeclarationMustUseString,this.state.startLoc),Q.id=this.tsParseEntityName(0);else if(G===2)this.raise(U0.EmptyNamespaceName,this.state.startLoc);else this.raise(U0.InvalidNamespaceName,this.state.startLoc,Y),Q.id=super.parseExprAtom()}if(this.match(2)){if(!Z)this.scope.enter(1024);if(this.prodParam.enter(0),Q.body=this.tsParseModuleBlock(Z),this.prodParam.exit(),!Z)this.scope.exit()}else this.semicolon();return this.finishNode(Q,"TSModuleDeclaration")}tsParseImportEqualsDeclaration(Q,Z){Q.id=Z||this.parseIdentifier(),this.checkIdentifier(Q.id,4096),this.expect(25);let G=this.tsParseModuleReference();if(Q.importKind==="type"&&G.type!=="TSExternalModuleReference")this.raise(U0.ImportAliasHasImportType,G);return Q.moduleReference=G,this.semicolon(),this.finishNode(Q,"TSImportEqualsDeclaration")}tsIsExternalModuleReference(){return this.isContextual(115)&&this.lookaheadCharCode()===40}tsParseModuleReference(){return this.tsIsExternalModuleReference()?this.tsParseExternalModuleReference():this.tsParseEntityName(0)}tsParseExternalModuleReference(){let Q=this.startNode();if(this.expectContextual(115),this.expect(6),!this.match(130))this.unexpected();return Q.expression=super.parseExprAtom(),this.expect(7),this.sawUnambiguousESM=!0,this.finishNode(Q,"TSExternalModuleReference")}tsLookAhead(Q){let Z=this.state.clone(),G=Q();return this.state=Z,G}tsTryParseAndCatch(Q){let Z=this.tryParse((G)=>Q()||G());if(Z.aborted||!Z.node)return;if(Z.error)this.state=Z.failState;return Z.node}tsTryParse(Q){let Z=this.state.clone(),G=Q();if(G!==void 0&&G!==!1)return G;this.state=Z}tsTryParseDeclare(Q){if(this.isLineTerminator())return;let Z=this.state.type;return this.tsInAmbientContext(()=>{switch(Z){case 64:return Q.declare=!0,super.parseFunctionStatement(Q,!1,!1);case 76:return Q.declare=!0,this.parseClass(Q,!0,!1);case 122:return this.tsParseEnumDeclaration(Q,{declare:!0});case 108:return this.tsParseAmbientExternalModuleDeclaration(Q);case 96:if(this.state.containsEsc)return;case 71:case 70:if(!this.match(71)||!this.isLookaheadContextual("enum"))return Q.declare=!0,this.parseVarStatement(Q,this.state.value,!0);return this.expect(71),this.tsParseEnumDeclaration(Q,{const:!0,declare:!0});case 103:if(this.isUsing())return this.raise(U0.InvalidModifierOnUsingDeclaration,this.state.startLoc,"declare"),Q.declare=!0,this.parseVarStatement(Q,"using",!0);break;case 92:if(this.isAwaitUsing())return this.raise(U0.InvalidModifierOnAwaitUsingDeclaration,this.state.startLoc,"declare"),Q.declare=!0,this.next(),this.parseVarStatement(Q,"await using",!0);break;case 125:{let G=this.tsParseInterfaceDeclaration(Q,{declare:!0});if(G)return G}default:if(R5(Z))return this.tsParseDeclaration(Q,this.state.type,!0,null)}})}tsTryParseExportDeclaration(){return this.tsParseDeclaration(this.startNode(),this.state.type,!0,null)}tsParseDeclaration(Q,Z,G,Y){switch(Z){case 120:if(this.tsCheckLineTerminator(G)&&(this.match(76)||R5(this.state.type)))return this.tsParseAbstractDeclaration(Q,Y);break;case 123:if(this.tsCheckLineTerminator(G))return this.tsParseAmbientExternalModuleDeclaration(Q);break;case 124:if(this.tsCheckLineTerminator(G)&&R5(this.state.type))return Q.kind="namespace",this.tsParseNamespaceDeclaration(Q);break;case 126:if(this.tsCheckLineTerminator(G)&&R5(this.state.type))return this.tsParseTypeAliasDeclaration(Q);break}}tsCheckLineTerminator(Q){if(Q){if(this.hasFollowingLineBreak())return!1;return this.next(),!0}return!this.isLineTerminator()}tsTryParseGenericAsyncArrowFunction(Q){if(!this.match(43))return;let Z=this.tsTryParseAndCatch(()=>{let G=this.startNodeAt(Q);return G.typeParameters=this.tsParseTypeParameters(this.tsParseConstModifier),super.parseFunctionParams(G),G.returnType=this.tsTryParseTypeOrTypePredicateAnnotation(),this.expect(15),G});if(!Z)return;return super.parseArrowExpression(Z,null,!0)}tsParseTypeArgumentsInExpression(){if(this.reScan_lt()!==43)return;return this.tsParseTypeArguments()}tsParseTypeArguments(){let Q=this.startNode();if(Q.params=this.tsInType(()=>this.tsInTopLevelContext(()=>{return this.expect(43),this.tsParseDelimitedList("TypeParametersOrArguments",this.tsParseType.bind(this))})),Q.params.length===0)this.raise(U0.EmptyTypeArguments,Q);else if(!this.state.inType&&this.curContext()===l5.brace)this.reScan_lt_gt();return this.expect(44),this.finishNode(Q,"TSTypeParameterInstantiation")}tsIsDeclarationStart(){return u10(this.state.type)}isExportDefaultSpecifier(){if(this.tsIsDeclarationStart())return!1;return super.isExportDefaultSpecifier()}parseBindingElement(Q,Z){let G=Z.length?null:this.state.startLoc,Y={};this.tsParseModifiers(SQ0,void 0,Y);let{accessibility:V,override:K,readonly:H}=Y;if(!(Q&4)&&(V||H||K))this.raise(U0.UnexpectedParameterModifier,G||Z[0]);let W=this.state.startLoc,U=this.parseMaybeDefault(W);if(Q&2)this.parseFunctionParamType(U);let z=this.parseMaybeDefault(W,U);if(V||H||K){let q=G?this.startNodeAt(G):this.startNodeAtNode(Z[0]);if(Z.length)q.decorators=Z;else this.setLoc(G);if(V)q.accessibility=V;if(H)q.readonly=H;if(K)q.override=K;if(z.type!=="Identifier"&&z.type!=="AssignmentPattern")this.raise(U0.UnsupportedParameterPropertyKind,G||Z[0]);return q.parameter=z,this.finishNode(q,"TSParameterProperty")}if(Z.length)U.decorators=Z;return z}isSimpleParameter(Q){return Q.type==="TSParameterProperty"&&super.isSimpleParameter(Q.parameter)||super.isSimpleParameter(Q)}tsDisallowOptionalPattern(Q){for(let Z of Q.params)if(Z.type!=="Identifier"&&Z.optional&&!this.state.isAmbientContext)this.raise(U0.PatternIsOptional,Z)}setArrowFunctionParameters(Q,Z,G){super.setArrowFunctionParameters(Q,Z,G),this.tsDisallowOptionalPattern(Q)}parseFunctionBodyAndFinish(Q,Z,G=!1){if(this.match(10))Q.returnType=this.tsParseTypeOrTypePredicateAnnotation(10);let Y=Z==="FunctionDeclaration"?"TSDeclareFunction":Z==="ClassMethod"||Z==="ClassPrivateMethod"?"TSDeclareMethod":void 0;if(Y&&!this.match(2)&&this.isLineTerminator()){if(Y==="TSDeclareMethod"&&Q.kind==="constructor"){for(let V of Q.params)if(V.type==="TSParameterProperty")this.raise(U0.UnexpectedParameterModifier,V);else if(V.type==="AssignmentPattern")this.raise(U0.UnexpectedParameterInitializer,V)}else for(let V of Q.params)if(V.type==="AssignmentPattern")this.raise(U0.UnexpectedParameterInitializer,V);return this.finishNode(Q,Y)}if(Y&&this.state.isAmbientContext){if(this.raise(U0.DeclareFunctionHasImplementation,this.state.startLoc),Y==="TSDeclareFunction"&&Q.declare)return super.parseFunctionBodyAndFinish(Q,Y,G)}return this.tsDisallowOptionalPattern(Q),super.parseFunctionBodyAndFinish(Q,Z,G)}registerFunctionStatementId(Q){if(!Q.body&&Q.id)this.checkIdentifier(Q.id,1024);else super.registerFunctionStatementId(Q)}tsCheckForInvalidTypeCasts(Q){Q.forEach((Z)=>{if(Z?.type==="TSTypeCastExpression")this.raise(U0.UnexpectedTypeAnnotation,Z.typeAnnotation)})}toReferencedList(Q,Z){return this.tsCheckForInvalidTypeCasts(Q),Q}parseArrayLike(Q,Z){let G=super.parseArrayLike(Q,Z);if(G.type==="ArrayExpression")this.tsCheckForInvalidTypeCasts(G.elements);return G}parseSubscript(Q,Z,G,Y){if(!this.hasPrecedingLineBreak()&&this.match(31)){this.state.canStartJSXElement=!1,this.next();let K=this.startNodeAt(Z);return K.expression=Q,this.finishNode(K,"TSNonNullExpression")}let V=!1;if(this.match(14)&&this.lookaheadCharCode()===60){if(G)return Y.stop=!0,Q;Y.optionalChainMember=V=!0,this.next()}if(this.match(43)||this.match(47)){let K,H=this.tsTryParseAndCatch(()=>{if(!G&&this.atPossibleAsyncArrow(Q)){let q=this.tsTryParseGenericAsyncArrowFunction(Z);if(q)return Y.stop=!0,q}let W=this.tsParseTypeArgumentsInExpression();if(!W)return;if(V&&!this.match(6)){K=this.state.curPosition();return}if(SL(this.state.type)){let q=super.parseTaggedTemplateExpression(Q,Z,Y);return q.typeArguments=W,q}if(!G&&this.eat(6)){let q=this.startNodeAt(Z);if(q.callee=Q,q.arguments=this.parseCallExpressionArguments(),this.tsCheckForInvalidTypeCasts(q.arguments),q.typeArguments=W,Y.optionalChainMember)q.optional=V;return this.finishCallExpression(q,Y.optionalChainMember)}let U=this.state.type;if(U===44||U===48||U!==6&&U!==89&&U!==116&&NG(U)&&!this.hasPrecedingLineBreak())return;let z=this.startNodeAt(Z);return z.expression=Q,z.typeArguments=W,this.finishNode(z,"TSInstantiationExpression")});if(K)this.unexpected(K,6);if(H){if(H.type==="TSInstantiationExpression"){if(this.match(12)||this.match(14)&&this.lookaheadCharCode()!==40)this.raise(U0.InvalidPropertyAccessAfterInstantiationExpression,this.state.startLoc);if(!this.match(12)&&!this.match(14))H.expression=super.stopParseSubscript(Q,Y)}return H}}return super.parseSubscript(Q,Z,G,Y)}parseNewCallee(Q){super.parseNewCallee(Q);let{callee:Z}=Q;if(Z.type==="TSInstantiationExpression"&&!Z.extra?.parenthesized)Q.typeArguments=Z.typeArguments,Q.callee=Z.expression}parseExprOp(Q,Z,G){let Y;if(fW(54)>G&&!this.hasPrecedingLineBreak()&&(this.isContextual(89)||(Y=this.isContextual(116)))){let V=this.startNodeAt(Z);V.expression=Q,V.typeAnnotation=this.tsInType(()=>{if(this.next(),this.match(71)){if(Y)this.raise(u.UnexpectedKeyword,this.state.startLoc,{keyword:"const"});return this.tsParseTypeReference()}return this.tsParseType()});let K=this.finishNode(V,Y?"TSSatisfiesExpression":"TSAsExpression");return this.reScan_lt_gt(),this.parseExprOp(K,Z,G)}return super.parseExprOp(Q,Z,G)}checkReservedWord(Q,Z,G,Y){if(!this.state.isAmbientContext)super.checkReservedWord(Q,Z,G,Y)}checkDuplicateExports(){}isPotentialImportPhase(Q){if(super.isPotentialImportPhase(Q))return!0;if(this.isContextual(126)){let Z=this.lookaheadCharCode();return Q?Z===123||Z===42:Z!==61}return!Q&&this.isContextual(83)}applyImportPhase(Q,Z,G,Y){if(super.applyImportPhase(Q,Z,G,Y),Z)Q.exportKind=G==="type"?"type":"value";else Q.importKind=G==="type"||G==="typeof"?G:"value"}parseImport(Q){if(this.match(130)){if(Q.importKind="value",this.scope.inTSNamespace)this.raise(U0.ImportInTSNamespace,Q);return super.parseImport(Q)}let Z;if(R5(this.state.type)&&this.lookaheadCharCode()===61){Q.importKind="value";let G=this.tsParseImportEqualsDeclaration(Q);if(this.scope.inTSNamespace&&G.moduleReference.type==="TSExternalModuleReference")this.raise(U0.ImportInTSNamespace,Q);return G}else if(this.isContextual(126)){let G=this.parseMaybeImportPhase(Q,!1);if(this.lookaheadCharCode()===61){if(this.scope.inTSNamespace)this.raise(U0.ImportInTSNamespace,Q);return this.tsParseImportEqualsDeclaration(Q,G)}else Z=super.parseImportSpecifiersAndAfter(Q,G)}else Z=super.parseImport(Q);if(Z.importKind==="type"&&Z.specifiers.length>1&&Z.specifiers[0].type==="ImportDefaultSpecifier")this.raise(U0.TypeImportCannotSpecifyDefaultAndNamed,Z);else if(this.scope.inTSNamespace)this.raise(U0.ImportInTSNamespace,Z);return Z}parseExport(Q,Z){if(this.match(79)){let G=this.startNode();this.next();let Y=null;if(this.isContextual(126)&&this.isPotentialImportPhase(!1))Y=this.parseMaybeImportPhase(G,!1);else G.importKind="value";let V=this.tsParseImportEqualsDeclaration(G,Y);return Q.attributes=[],Q.declaration=V,Q.exportKind="value",Q.source=null,Q.specifiers=[],this.finishNode(Q,"ExportNamedDeclaration")}else if(this.eat(25)){let G=Q;if(G.expression=super.parseExpression(),this.semicolon(),this.sawUnambiguousESM=!0,this.scope.inTSNamespace)this.raise(U0.ExportAssignmentInTSNamespace,G);return this.finishNode(G,"TSExportAssignment")}else if(this.eatContextual(89)){let G=Q;if(this.expectContextual(124),G.id=this.parseIdentifier(),this.checkIdentifier(G.id,8201),this.semicolon(),this.scope.inTSNamespace)this.raise(U0.NamespaceExportInTSNamespace,G);return this.finishNode(G,"TSNamespaceExportDeclaration")}else{let G=super.parseExport(Q,Z);if(this.scope.inTSNamespace&&(G.type!=="ExportNamedDeclaration"||G.source||!G.declaration&&!this.state.isAmbientContext))this.raise(U0.ExportInTSNamespace,G);return G}}isAbstractClass(){return this.isContextual(120)&&this.isLookaheadContextual("class")}parseExportDefaultExpression(){if(this.isAbstractClass()){let Q=this.startNode();return this.next(),Q.abstract=!0,this.parseClass(Q,!0,!0)}if(this.match(125)){let Q=this.tsParseInterfaceDeclaration(this.startNode());if(Q)return Q}return super.parseExportDefaultExpression()}parseVarStatement(Q,Z,G=!1){let{isAmbientContext:Y}=this.state,V=super.parseVarStatement(Q,Z,G||Y);if(Y&&!Q.declare&&(Z==="using"||Z==="await using"))return this.raiseOverwrite(U0.UsingDeclarationInAmbientContext,Q,Z),V;for(let K of V.declarations){let{id:H,init:W,definite:U}=K;if(U){if(W)this.raise(U0.DeclaratorDefiniteAssertionWithInitializer,H);else if(!H.typeAnnotation)this.raise(U0.DeclaratorDefiniteAssertionRequiresTypeAnnotation,H)}if(Y&&W){if(Z==="var"||Z==="let"||!!H.typeAnnotation)this.raise(U0.InitializerNotAllowedInAmbientContext,W);else if(!kQ0(W,this.hasPlugin("estree")))this.raise(U0.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference,W)}}return V}parseStatementContent(Q,Z){let G=!!(Q&2);if(!this.state.containsEsc)switch(this.state.type){case 71:{if(this.isLookaheadContextual("enum")){let Y=this.startNode();return this.next(),this.tsParseEnumDeclaration(Y,{const:!0})}break}case 120:case 121:{if(this.nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine()){let Y=this.state.type,V=this.startNode();this.next();let K=Y===121?this.tsTryParseDeclare(V):this.tsParseAbstractDeclaration(V,Z);if(K){if(Y===121)K.declare=!0;return K}else return V.expression=this.createIdentifier(this.startNodeAtNode(V),Y===121?"declare":"abstract"),this.semicolon(!1),this.finishNode(V,"ExpressionStatement")}break}case 122:return this.tsParseEnumDeclaration(this.startNode());case 108:{if(this.lookaheadCharCode()===123){let V=this.startNode();return this.tsParseAmbientExternalModuleDeclaration(V)}break}case 125:{let Y=this.tsParseInterfaceDeclaration(this.startNode());if(Y){if(!G)this.raise(U0.UnexpectedTypeDeclaration,Y,"interface");return Y}break}case 123:{if(this.nextTokenIsStringLiteralOnSameLine()){let Y=this.startNode();return this.next(),this.tsParseDeclaration(Y,123,!1,Z)}else if(this.nextTokenIsIdentifierOnSameLine()){this.raise(U0.InlineModuleDeclarationMustUseString,this.state.startLoc);let Y=this.startNode();return this.next(),this.tsParseDeclaration(Y,124,!1,Z)}break}case 124:{if(this.nextTokenIsIdentifierOnSameLine()){let Y=this.startNode();return this.next(),this.tsParseDeclaration(Y,124,!1,Z)}break}case 126:{if(this.nextTokenIsIdentifierOnSameLine()){let Y=this.startNode();if(!G)this.raise(U0.UnexpectedTypeDeclaration,Y,"type");return this.next(),this.tsParseTypeAliasDeclaration(Y)}break}}return super.parseStatementContent(Q,Z)}parseAccessModifier(){return this.tsParseModifier(EQ0)}tsHasSomeModifiers(Q,Z){return Z.some((G)=>{if(KP(G))return Q.accessibility===G;return!!Q[G]})}tsIsStartOfStaticBlocks(){return this.isContextual(102)&&this.lookaheadCharCode()===123}parseClassMember(Q,Z,G){this.tsParseModifiers(RQ0,U0.InvalidModifierOnTypeParameterPositions,Z,!0);let Y=()=>{if(this.tsIsStartOfStaticBlocks()){if(this.next(),this.next(),this.tsHasSomeModifiers(Z,["declare","private","public","protected","override","abstract","readonly","static"]))this.raise(U0.StaticBlockCannotHaveModifier,this.state.curPosition());super.parseClassStaticBlock(Q,Z)}else this.parseClassMemberWithIsStatic(Q,Z,G,!!Z.static)};if(Z.declare)this.tsInAmbientContext(Y);else Y();if(Z.decorators&&Z.decorators.length>0&&!this.hasPlugin("decorators-legacy")){if(Z.type==="TSAbstractMethodDefinition"||Z.type==="TSDeclareMethod")this.raise(U0.DecoratorAbstractMethod,Z,{kind:"abstract method"});else if(Z.type==="ClassProperty"&&Z.abstract||Z.type==="ClassProperty"&&Z.declare||Z.type==="TSAbstractPropertyDefinition"||Z.type==="PropertyDefinition"&&Z.declare)this.raise(U0.DecoratorAbstractMethod,Z,{kind:Z.declare?"declare field":"abstract field"})}}parseClassMemberWithIsStatic(Q,Z,G,Y){let V=this.tsTryParseIndexSignature(Z);if(V){if(Q.body.push(V),Z.abstract)this.raise(U0.IndexSignatureHasAbstract,Z);if(Z.accessibility)this.raise(U0.IndexSignatureHasAccessibility,Z,{modifier:Z.accessibility});if(Z.declare)this.raise(U0.IndexSignatureHasDeclare,Z);if(Z.override)this.raise(U0.IndexSignatureHasOverride,Z);return}if(!this.state.inAbstractClass&&Z.abstract)this.raise(U0.NonAbstractClassHasAbstractMethod,Z);if(Z.override){if(!G.hadSuperClass)this.raise(U0.OverrideNotInSubClass,Z)}super.parseClassMemberWithIsStatic(Q,Z,G,Y)}parsePostMemberNameModifiers(Q){if(this.eat(13))Q.optional=!0;if(Q.readonly&&this.match(6))this.raise(U0.ClassMethodHasReadonly,Q);if(Q.declare&&this.match(6))this.raise(U0.ClassMethodHasDeclare,Q)}shouldParseExportDeclaration(){if(this.tsIsDeclarationStart())return!0;return super.shouldParseExportDeclaration()}parseConditional(Q,Z,G){if(!this.match(13))return Q;if(G!=null){let K=this.lookaheadCharCode();if(K===44||K===61||K===58||K===41)return this.setOptionalParametersError(G),Q}this.next();let Y=this.startNodeAt(Z);Y.test=Q;let V=this.state.inConditionalConsequent;return this.state.inConditionalConsequent=!0,Y.consequent=this.parseMaybeAssignAllowIn(),this.state.inConditionalConsequent=V,this.expect(10),Y.alternate=this.parseMaybeAssign(),this.finishNode(Y,"ConditionalExpression")}parseParenItem(Q,Z){let G=super.parseParenItem(Q,Z);if(this.eat(13))G.optional=!0,this.resetEndLocation(Q);if(this.match(10)){let Y=this.startNodeAt(Z);return Y.expression=Q,Y.typeAnnotation=this.tsParseTypeAnnotation(),this.finishNode(Y,"TSTypeCastExpression")}return Q}parseExportDeclaration(Q){if(!this.state.isAmbientContext&&this.isContextual(121))return this.tsInAmbientContext(()=>this.parseExportDeclaration(Q));let Z=this.state.startLoc,G=this.eatContextual(121);if(G&&(this.isContextual(121)||!this.shouldParseExportDeclaration()))throw this.raise(U0.ExpectedAmbientAfterExportDeclare,this.state.startLoc);let V=R5(this.state.type)&&this.tsTryParseExportDeclaration()||super.parseExportDeclaration(Q);if(!V)return null;if(V.type==="TSInterfaceDeclaration"||V.type==="TSTypeAliasDeclaration"||G)Q.exportKind="type";if(G&&V.type!=="TSImportEqualsDeclaration")this.resetStartLocation(V,Z),V.declare=!0;return V}parseClassId(Q,Z,G,Y){if((!Z||G)&&this.isContextual(109)){Q.id=null;return}super.parseClassId(Q,Z,G,Q.declare?1024:8331);let V=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);if(V)Q.typeParameters=V}parseClassPropertyAnnotation(Q){if(!Q.optional){if(this.eat(31))Q.definite=!0;else if(this.eat(13))Q.optional=!0}let Z=this.tsTryParseTypeAnnotation();if(Z)Q.typeAnnotation=Z;if(Q.definite){if(this.match(25))this.raise(U0.DeclaratorDefiniteAssertionWithInitializer,Q);else if(!Z)this.raise(U0.DeclaratorDefiniteAssertionRequiresTypeAnnotation,Q)}}parseClassProperty(Q){if(this.parseClassPropertyAnnotation(Q),this.state.isAmbientContext&&!(Q.readonly&&!Q.typeAnnotation)&&this.match(25))this.raise(U0.DeclareClassFieldHasInitializer,this.state.startLoc);if(Q.abstract&&this.match(25)){let{key:Z}=Q;this.raise(U0.AbstractPropertyHasInitializer,this.state.startLoc,{propertyName:Z.type==="Identifier"&&!Q.computed?Z.name:`[${this.input.slice(this.offsetToSourcePos(Z.start),this.offsetToSourcePos(Z.end))}]`})}return super.parseClassProperty(Q)}parseClassPrivateProperty(Q){if(Q.abstract)this.raise(U0.PrivateElementHasAbstract,Q);if(Q.accessibility)this.raise(U0.PrivateElementHasAccessibility,Q,{modifier:Q.accessibility});return this.parseClassPropertyAnnotation(Q),super.parseClassPrivateProperty(Q)}parseClassAccessorProperty(Q){if(this.parseClassPropertyAnnotation(Q),Q.optional)this.raise(U0.AccessorCannotBeOptional,Q);return super.parseClassAccessorProperty(Q)}pushClassMethod(Q,Z,G,Y,V,K){let H=this.tsTryParseTypeParameters(this.tsParseConstModifier);if(H&&V)this.raise(U0.ConstructorHasTypeParameters,H);let{declare:W=!1,kind:U}=Z;if(W&&(U==="get"||U==="set"))this.raise(U0.DeclareAccessor,Z,{kind:U});if(H)Z.typeParameters=H;super.pushClassMethod(Q,Z,G,Y,V,K)}pushClassPrivateMethod(Q,Z,G,Y){let V=this.tsTryParseTypeParameters(this.tsParseConstModifier);if(V)Z.typeParameters=V;super.pushClassPrivateMethod(Q,Z,G,Y)}declareClassPrivateMethodInScope(Q,Z){if(Q.type==="TSDeclareMethod")return;if(Q.type==="MethodDefinition"&&Q.value.body==null)return;super.declareClassPrivateMethodInScope(Q,Z)}parseClassSuper(Q){if(super.parseClassSuper(Q),Q.superClass){if(Q.superClass.type==="TSInstantiationExpression"){let Z=Q.superClass,G=Z.expression;this.takeSurroundingComments(G,G.start,G.end);let Y=Z.typeArguments;this.takeSurroundingComments(Y,Y.start,Y.end),Q.superClass=G,Q.superTypeArguments=Y}else if(this.match(43)||this.match(47))Q.superTypeArguments=this.tsParseTypeArgumentsInExpression()}if(this.eatContextual(109))Q.implements=this.tsParseHeritageClause("implements")}parseObjPropValue(Q,Z,G,Y,V,K,H){let W=this.tsTryParseTypeParameters(this.tsParseConstModifier);if(W)Q.typeParameters=W;return super.parseObjPropValue(Q,Z,G,Y,V,K,H)}parseFunctionParams(Q,Z){let G=this.tsTryParseTypeParameters(this.tsParseConstModifier);if(G)Q.typeParameters=G;super.parseFunctionParams(Q,Z)}parseVarId(Q,Z){if(super.parseVarId(Q,Z),Q.id.type==="Identifier"&&!this.hasPrecedingLineBreak()&&this.eat(31))Q.definite=!0;let G=this.tsTryParseTypeAnnotation();if(G)Q.id.typeAnnotation=G,this.resetEndLocation(Q.id)}parseAsyncArrowFromCallExpression(Q,Z){if(this.match(10))Q.returnType=this.tsParseTypeAnnotation();return super.parseAsyncArrowFromCallExpression(Q,Z)}parseMaybeAssign(Q,Z){let G,Y,V;if(this.hasPlugin("jsx")&&(this.match(138)||this.match(43))){if(G=this.state.clone(),Y=this.tryParse(()=>super.parseMaybeAssign(Q,Z),G),!Y.error)return Y.node;let{context:W}=this.state,U=W[W.length-1];if(U===l5.j_oTag||U===l5.j_expr)W.pop()}if(!Y?.error&&!this.match(43))return super.parseMaybeAssign(Q,Z);if(!G||G===this.state)G=this.state.clone();let K,H=this.tryParse((W)=>{K=this.tsParseTypeParameters(this.tsParseConstModifier);let U=super.parseMaybeAssign(Q,Z);if(U.type!=="ArrowFunctionExpression"||U.extra?.parenthesized)W();if(K?.params.length!==0)this.resetStartLocationFromNode(U,K);if(U.typeParameters=K,this.hasPlugin("jsx")&&U.typeParameters.params.length===1&&!U.typeParameters.extra?.trailingComma){let z=U.typeParameters.params[0];if(!z.constraint)this.raise(U0.SingleTypeParameterWithoutTrailingComma,this.optionFlags&256?g7(z.loc.end,1):z,{typeParameterName:z.name.name})}return U},G);if(!H.error&&!H.aborted){if(K)this.reportReservedArrowTypeParam(K);return H.node}if(!Y){if(VP(!this.hasPlugin("jsx")),V=this.tryParse(()=>super.parseMaybeAssign(Q,Z),G),!V.error)return V.node}if(Y?.node)return this.state=Y.failState,Y.node;if(H.node){if(this.state=H.failState,K)this.reportReservedArrowTypeParam(K);return H.node}if(V?.node)return this.state=V.failState,V.node;throw Y?.error||H.error||V?.error}reportReservedArrowTypeParam(Q){if(Q.params.length===1&&!Q.params[0].constraint&&!Q.extra?.trailingComma&&this.getPluginOption("typescript","disallowAmbiguousJSXLike"))this.raise(U0.ReservedArrowTypeParam,Q)}parseMaybeUnary(Q,Z){if(!this.hasPlugin("jsx")&&this.match(43))return this.tsParseTypeAssertion();return super.parseMaybeUnary(Q,Z)}parseArrow(Q){if(this.match(10)){let Z=this.tryParse((G)=>{let Y=this.tsParseTypeOrTypePredicateAnnotation(10);if(this.canInsertSemicolon()||!this.match(15))G();return Y});if(Z.aborted)return;if(!Z.thrown){if(Z.error)this.state=Z.failState;Q.returnType=Z.node}}return super.parseArrow(Q)}parseFunctionParamType(Q){if(this.eat(13))Q.optional=!0;let Z=this.tsTryParseTypeAnnotation();if(Z)Q.typeAnnotation=Z;return this.resetEndLocation(Q),Q}isAssignable(Q,Z){switch(Q.type){case"TSTypeCastExpression":return this.isAssignable(Q.expression,Z);case"TSParameterProperty":return!0;default:return super.isAssignable(Q,Z)}}toAssignable(Q,Z=!1){switch(Q.type){case"ParenthesizedExpression":this.toAssignableParenthesizedExpression(Q,Z);break;case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":if(Z)this.expressionScope.recordArrowParameterBindingError(U0.UnexpectedTypeCastInParameter,Q);else this.raise(U0.UnexpectedTypeCastInParameter,Q);this.toAssignable(Q.expression,Z);break;case"AssignmentExpression":if(!Z&&Q.left.type==="TSTypeCastExpression")Q.left=this.typeCastToParameter(Q.left);default:super.toAssignable(Q,Z)}}toAssignableParenthesizedExpression(Q,Z){switch(Q.expression.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":case"ParenthesizedExpression":this.toAssignable(Q.expression,Z);break;default:super.toAssignable(Q,Z)}}checkToRestConversion(Q,Z){switch(Q.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":this.checkToRestConversion(Q.expression,!1);break;default:super.checkToRestConversion(Q,Z)}}isValidLVal(Q,Z,G,Y){switch(Q){case"TSTypeCastExpression":return!0;case"TSParameterProperty":return"parameter";case"TSNonNullExpression":return"expression";case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":return(Y!==64||!G)&&["expression",!0];default:return super.isValidLVal(Q,Z,G,Y)}}parseBindingAtom(){if(this.state.type===74)return this.parseIdentifier(!0);return super.parseBindingAtom()}parseMaybeDecoratorArguments(Q,Z){if(this.match(43)||this.match(47)){let G=this.tsParseTypeArgumentsInExpression();if(this.match(6)){let Y=super.parseMaybeDecoratorArguments(Q,Z);return Y.typeArguments=G,Y}this.unexpected(null,6)}return super.parseMaybeDecoratorArguments(Q,Z)}checkCommaAfterRest(Q){if(this.state.isAmbientContext&&this.match(8)&&this.lookaheadCharCode()===Q)return this.next(),!1;return super.checkCommaAfterRest(Q)}isClassMethod(){return this.match(43)||super.isClassMethod()}isClassProperty(){return this.match(31)||this.match(10)||super.isClassProperty()}parseMaybeDefault(Q,Z){let G=super.parseMaybeDefault(Q,Z);if(G.type==="AssignmentPattern"&&G.typeAnnotation&&G.right.start<G.typeAnnotation.start)this.raise(U0.TypeAnnotationAfterAssign,G.typeAnnotation);return G}getTokenFromCode(Q){if(this.state.inType){if(Q===62){this.finishOp(44,1);return}if(Q===60){this.finishOp(43,1);return}}super.getTokenFromCode(Q)}reScan_lt_gt(){let{type:Q}=this.state;if(Q===43)this.state.pos-=1,this.readToken_lt();else if(Q===44)this.state.pos-=1,this.readToken_gt()}reScan_lt(){let{type:Q}=this.state;if(Q===47)return this.state.pos-=2,this.finishOp(43,1),43;return Q}toAssignableListItem(Q,Z,G){let Y=Q[Z];if(Y.type==="TSTypeCastExpression")Q[Z]=this.typeCastToParameter(Y);super.toAssignableListItem(Q,Z,G)}typeCastToParameter(Q){return Q.expression.typeAnnotation=Q.typeAnnotation,this.resetEndLocationFromNode(Q.expression,Q.typeAnnotation),Q.expression}shouldParseArrow(Q){if(this.match(10))return Q.every((Z)=>this.isAssignable(Z,!0));return super.shouldParseArrow(Q)}shouldParseAsyncArrow(){if(this.match(10)){if(this.state.inConditionalConsequent)return!1;return!0}return super.shouldParseAsyncArrow()}parseParenAndDistinguishExpression(Q){let Z=this.state.inConditionalConsequent;this.state.inConditionalConsequent=!1;let G=super.parseParenAndDistinguishExpression(Q);return this.state.inConditionalConsequent=Z,G}canHaveLeadingDecorator(){return super.canHaveLeadingDecorator()||this.isAbstractClass()}jsxParseOpeningElementAfterName(Q){if(this.match(43)||this.match(47)){let Z=this.tsTryParseAndCatch(()=>this.tsParseTypeArgumentsInExpression());if(Z)Q.typeArguments=Z}return super.jsxParseOpeningElementAfterName(Q)}getGetterSetterExpectedParamCount(Q){let Z=super.getGetterSetterExpectedParamCount(Q),Y=this.getObjectOrClassMethodParams(Q)[0];return Y&&this.isThisParam(Y)?Z+1:Z}parseCatchClauseParam(){let Q=super.parseCatchClauseParam(),Z=this.tsTryParseTypeAnnotation();if(Z)Q.typeAnnotation=Z,this.resetEndLocation(Q);return Q}tsInAmbientContext(Q){let{isAmbientContext:Z,strict:G}=this.state;this.state.isAmbientContext=!0,this.state.strict=!1;try{return Q()}finally{this.state.isAmbientContext=Z,this.state.strict=G}}parseClass(Q,Z,G){let Y=this.state.inAbstractClass;this.state.inAbstractClass=!!Q.abstract;try{return super.parseClass(Q,Z,G)}finally{this.state.inAbstractClass=Y}}tsParseAbstractDeclaration(Q,Z){if(this.match(76))return Q.abstract=!0,this.maybeTakeDecorators(Z,this.parseClass(Q,!0,!1));else if(this.isContextual(125))if(!this.hasFollowingLineBreak())return Q.abstract=!0,this.raise(U0.NonClassMethodPropertyHasAbstractModifier,Q),this.tsParseInterfaceDeclaration(Q);else return null;throw this.unexpected(null,76)}parseMethod(Q,Z,G,Y,V,K,H){let W=super.parseMethod(Q,Z,G,Y,V,K,H);if(W.abstract||W.type==="TSAbstractMethodDefinition"){if((this.hasPlugin("estree")?W.value:W).body){let{key:q}=W;this.raise(U0.AbstractMethodHasImplementation,W,{methodName:q.type==="Identifier"&&!W.computed?q.name:`[${this.input.slice(this.offsetToSourcePos(q.start),this.offsetToSourcePos(q.end))}]`})}}return W}tsParseTypeParameterName(){return this.parseIdentifier()}shouldParseAsAmbientContext(){return!!this.getPluginOption("typescript","dts")}parse(){if(this.shouldParseAsAmbientContext())this.state.isAmbientContext=!0;return super.parse()}getExpression(){if(this.shouldParseAsAmbientContext())this.state.isAmbientContext=!0;return super.getExpression()}parseExportSpecifier(Q,Z,G,Y){if(!Z&&Y)return this.parseTypeOnlyExportSpecifier(Q,G),this.finishNode(Q,"ExportSpecifier");return Q.exportKind="value",super.parseExportSpecifier(Q,Z,G,Y)}parseImportSpecifier(Q,Z,G,Y,V){if(!Z&&Y)return this.parseTypeOnlyImportSpecifier(Q,G),this.finishNode(Q,"ImportSpecifier");return Q.importKind="value",super.parseImportSpecifier(Q,Z,G,Y,G?4098:4096)}parseTypeOnlyImportSpecifier(Q,Z){let G=Q.imported,Y=!1;if(this.isContextual(89)){let V=this.parseIdentifier();if(this.isContextual(89)){let K=this.parseIdentifier();if(s8(this.state.type))Y=!0,G=V,Q.local=this.parseIdentifier();else Q.local=K}else if(s8(this.state.type))Q.local=this.parseIdentifier();else Y=!0,G=V}else if(s8(this.state.type)){if(Y=!0,G=this.parseIdentifier(!0),!this.isContextual(89))this.checkReservedWord(G.name,G.start,!0,!0)}if(Y&&Z)this.raise(U0.TypeModifierIsUsedInTypeImports,Q.imported);Q.imported=G,Q.importKind=Y?"type":"value",this.checkIdentifier(Q.local??=this.eatContextual(89)?this.parseIdentifier():this.cloneIdentifier(Q.imported),Y?4098:4096)}parseTypeOnlyExportSpecifier(Q,Z){let G=Q.local,Y=!1;if(this.isContextual(89)){let V=this.parseIdentifier();if(this.isContextual(89)){let K=this.parseIdentifier();if(s8(this.state.type))Y=!0,Q.local=V,Q.exported=this.parseModuleExportName();else Q.exported=K}else if(s8(this.state.type))Q.exported=this.parseModuleExportName();else Y=!0,Q.local=V}else if(s8(this.state.type))Y=!0,Q.local=this.parseModuleExportName();if(Y&&Z)this.raise(U0.TypeModifierIsUsedInTypeExports,G);Q.exportKind=Y?"type":"value",Q.exported??=this.eatContextual(89)?this.parseModuleExportName():this.cloneIdentifier(Q.local)}fillOptionalPropertiesForTSESLint(Q){switch(Q.type){case"ImportDeclaration":Q.phase??=null;return;case"ExpressionStatement":Q.directive??=void 0;return;case"RestElement":Q.value=void 0;case"Identifier":case"ArrayPattern":case"AssignmentPattern":case"ObjectPattern":Q.decorators??=[],Q.optional??=!1,Q.typeAnnotation??=void 0;return;case"TSParameterProperty":Q.accessibility??=void 0,Q.decorators??=[],Q.override??=!1,Q.readonly??=!1,Q.static??=!1;return;case"TSEmptyBodyFunctionExpression":Q.body=null;case"TSDeclareFunction":case"FunctionDeclaration":case"FunctionExpression":case"ClassMethod":case"ClassPrivateMethod":Q.declare??=!1,Q.returnType??=void 0,Q.typeParameters??=void 0;return;case"Property":Q.optional??=!1;return;case"TSMethodSignature":case"TSPropertySignature":Q.optional??=!1;case"TSIndexSignature":Q.accessibility??=void 0,Q.readonly??=!1,Q.static??=!1;return;case"TSAbstractPropertyDefinition":case"PropertyDefinition":case"TSAbstractAccessorProperty":case"AccessorProperty":Q.declare??=!1,Q.definite??=!1,Q.readonly??=!1,Q.typeAnnotation??=void 0;case"TSAbstractMethodDefinition":case"MethodDefinition":Q.accessibility??=void 0,Q.decorators??=[],Q.override??=!1,Q.optional??=!1;return;case"ClassExpression":Q.id??=null;case"ClassDeclaration":Q.abstract??=!1,Q.declare??=!1,Q.decorators??=[],Q.implements??=[],Q.superTypeArguments??=void 0,Q.typeParameters??=void 0;return;case"TSTypeAliasDeclaration":case"VariableDeclaration":Q.declare??=!1;return;case"VariableDeclarator":Q.definite??=!1;return;case"TSEnumDeclaration":Q.const??=!1,Q.declare??=!1;return;case"TSEnumMember":Q.computed??=!1;return;case"TSImportType":Q.qualifier??=null,Q.options??=null,Q.typeArguments??=null;return;case"TSInterfaceDeclaration":Q.declare??=!1,Q.extends??=[];return;case"TSMappedType":Q.optional??=!1,Q.readonly??=void 0;return;case"TSModuleDeclaration":Q.declare??=!1,Q.global??=Q.kind==="global";return;case"TSTypeParameter":Q.const??=!1,Q.in??=!1,Q.out??=!1;return}}chStartsBindingIdentifierAndNotRelationalOperator(Q,Z){if(u9(Q)){if(AL.lastIndex=Z,AL.test(this.input)){let G=this.codePointAtPos(AL.lastIndex);if(!eX(G)&&G!==92)return!1}return!0}else if(Q===92)return!0;else return!1}nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine(){let Q=this.nextTokenInLineStart(),Z=this.codePointAtPos(Q);return this.chStartsBindingIdentifierAndNotRelationalOperator(Z,Q)}nextTokenIsStringLiteralOnSameLine(){let Q=this.nextTokenInLineStart(),Z=this.codePointAtPos(Q);return Z===34||Z===39}};function wQ0(X){if(X.type!=="MemberExpression")return!1;let{computed:J,property:Q}=X;if(J&&Q.type!=="StringLiteral"&&(Q.type!=="TemplateLiteral"||Q.expressions.length>0))return!1;return uP(X.object)}function kQ0(X,J){let{type:Q}=X;if(X.extra?.parenthesized)return!1;if(J){if(Q==="Literal"){let{value:Z}=X;if(typeof Z==="string"||typeof Z==="boolean")return!0}}else if(Q==="StringLiteral"||Q==="BooleanLiteral")return!0;if(mP(X,J)||FQ0(X,J))return!0;if(Q==="TemplateLiteral"&&X.expressions.length===0)return!0;if(wQ0(X))return!0;return!1}function mP(X,J){if(J)return X.type==="Literal"&&(typeof X.value==="number"||("bigint"in X));return X.type==="NumericLiteral"||X.type==="BigIntLiteral"}function FQ0(X,J){if(X.type==="UnaryExpression"){let{operator:Q,argument:Z}=X;if(Q==="-"&&mP(Z,J))return!0}return!1}function uP(X){if(X.type==="Identifier")return!0;if(X.type!=="MemberExpression"||X.computed)return!1;return uP(X.object)}function X1(X,J=[]){let Q=new Map;for(let Z of X)Q.set(Z,!0);for(let Z of J)Q.set(Z,!1);return Q}var PQ0={ClassNameIsRequired:"A class name is required.",UnexpectedSpace:"Unexpected space in placeholder."},WP=Z9`placeholders`(PQ0),DQ0=(X)=>class J extends X{parsePlaceholder(Q){if(this.match(129)){let Z=this.startNode();return this.next(),this.assertNoSpace(),Z.name=super.parseIdentifier(!0),this.assertNoSpace(),this.expect(129),this.finishPlaceholder(Z,Q)}}finishPlaceholder(Q,Z){let G=Q;if(!G.expectedNode||!G.type)G=this.finishNode(G,"Placeholder");return G.expectedNode=Z,G}getTokenFromCode(Q){if(Q===37&&this.input.charCodeAt(this.state.pos+1)===37)this.finishOp(129,2);else super.getTokenFromCode(Q)}parseExprAtom(Q){return this.parsePlaceholder("Expression")||super.parseExprAtom(Q)}parseIdentifier(Q){return this.parsePlaceholder("Identifier")||super.parseIdentifier(Q)}checkReservedWord(Q,Z,G,Y){if(Q!==void 0)super.checkReservedWord(Q,Z,G,Y)}cloneIdentifier(Q){let Z=super.cloneIdentifier(Q);if(Z.type==="Placeholder")Z.expectedNode=Q.expectedNode;return Z}cloneStringLiteral(Q){if(Q.type==="Placeholder")return this.cloneIdentifier(Q);return super.cloneStringLiteral(Q)}parseBindingAtom(){return this.parsePlaceholder("Pattern")||super.parseBindingAtom()}isValidLVal(Q,Z,G,Y){return Q==="Placeholder"||super.isValidLVal(Q,Z,G,Y)}toAssignable(Q,Z){if(Q&&Q.type==="Placeholder"&&Q.expectedNode==="Expression")Q.expectedNode="Pattern";else super.toAssignable(Q,Z)}chStartsBindingIdentifier(Q,Z){if(super.chStartsBindingIdentifier(Q,Z))return!0;let G=this.nextTokenStart();if(this.input.charCodeAt(G)===37&&this.input.charCodeAt(G+1)===37)return!0;return!1}verifyBreakContinue(Q,Z){if(Q.label?.type==="Placeholder")return;super.verifyBreakContinue(Q,Z)}parseExpressionStatement(Q,Z){if(Z.type!=="Placeholder"||Z.extra?.parenthesized)return super.parseExpressionStatement(Q,Z);if(this.match(10)){let Y=Q;return Y.label=this.finishPlaceholder(Z,"Identifier"),this.next(),Y.body=super.parseStatementOrSloppyAnnexBFunctionDeclaration(),this.finishNode(Y,"LabeledStatement")}this.semicolon();let G=Q;return G.name=Z.name,this.finishPlaceholder(G,"Statement")}parseBlock(Q,Z,G){return this.parsePlaceholder("BlockStatement")||super.parseBlock(Q,Z,G)}parseFunctionId(Q){return this.parsePlaceholder("Identifier")||super.parseFunctionId(Q)}parseClass(Q,Z,G){let Y=Z?"ClassDeclaration":"ClassExpression";this.next();let V=this.state.strict,K=this.parsePlaceholder("Identifier");if(K)if(this.match(77)||this.match(129)||this.match(2))Q.id=K;else if(G||!Z)return Q.id=null,Q.body=this.finishPlaceholder(K,"ClassBody"),this.finishNode(Q,Y);else throw this.raise(WP.ClassNameIsRequired,this.state.startLoc);else this.parseClassId(Q,Z,G);return super.parseClassSuper(Q),Q.body=this.parsePlaceholder("ClassBody")||super.parseClassBody(!!Q.superClass,V),this.finishNode(Q,Y)}parseExport(Q,Z){let G=this.parsePlaceholder("Identifier");if(!G)return super.parseExport(Q,Z);let Y=Q;if(!this.isContextual(94)&&!this.match(8))return Y.specifiers=[],Y.source=null,Y.declaration=this.finishPlaceholder(G,"Declaration"),this.finishNode(Y,"ExportNamedDeclaration");this.expectPlugin("exportDefaultFrom");let V=this.startNode();return V.exported=G,Y.specifiers=[this.finishNode(V,"ExportDefaultSpecifier")],super.parseExport(Y,Z)}isExportDefaultSpecifier(){if(this.match(61)){let Q=this.nextTokenStart();if(this.isUnparsedContextual(Q,"from")){if(this.input.startsWith(x4(129),this.nextTokenStartSince(Q+4)))return!0}}return super.isExportDefaultSpecifier()}maybeParseExportDefaultSpecifier(Q,Z){if(Q.specifiers?.length)return!0;return super.maybeParseExportDefaultSpecifier(Q,Z)}checkNamedExport(){}parseImport(Q){let Z=this.parsePlaceholder("Identifier");if(!Z)return super.parseImport(Q);if(Q.specifiers=[],!this.isContextual(94)&&!this.match(8))return Q.source=this.finishPlaceholder(Z,"StringLiteral"),this.semicolon(),this.finishNode(Q,"ImportDeclaration");let G=this.startNodeAtNode(Z);if(G.local=Z,Q.specifiers.push(this.finishNode(G,"ImportDefaultSpecifier")),this.eat(8)){if(!this.maybeParseStarImportSpecifier(Q))this.parseNamedImportSpecifiers(Q)}return this.expectContextual(94),Q.source=this.parseImportSource(),this.semicolon(),this.finishNode(Q,"ImportDeclaration")}parseImportSource(){return this.parsePlaceholder("StringLiteral")||super.parseImportSource()}assertNoSpace(){if(this.state.start>this.offsetToSourcePos(this.state.lastTokEndLoc.index))this.raise(WP.UnexpectedSpace,this.state.lastTokEndLoc)}},yQ0=(X)=>class J extends X{parseV8Intrinsic(){if(this.match(50)){let Q=this.state.startLoc,Z=this.startNode();if(this.next(),R5(this.state.type)){let G=this.parseIdentifierName(),Y=this.createIdentifier(Z,G);if(this.castNodeTo(Y,"V8IntrinsicIdentifier"),this.match(6))return Y}this.unexpected(Q)}}parseExprAtom(Q){return this.parseV8Intrinsic()||super.parseExprAtom(Q)}},HP=["fsharp","hack"],UP=["^^","@@","^","%","#"];function xQ0(X){if(X.has("decorators")){if(X.has("decorators-legacy"))throw Error("Cannot use the decorators and decorators-legacy plugin together")}if(X.has("flow")&&X.has("typescript"))throw Error("Cannot combine flow and typescript plugins.");if(X.has("placeholders")&&X.has("v8intrinsic"))throw Error("Cannot combine placeholders and v8intrinsic plugins.");if(X.has("pipelineOperator")){let J=X.get("pipelineOperator").proposal;if(!HP.includes(J)){let Q=HP.map((Z)=>`"${Z}"`).join(", ");throw Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${Q}.`)}if(J==="hack"){if(X.has("placeholders"))throw Error("Cannot combine placeholders plugin and Hack-style pipes.");if(X.has("v8intrinsic"))throw Error("Cannot combine v8intrinsic plugin and Hack-style pipes.");let Q=X.get("pipelineOperator").topicToken;if(!UP.includes(Q)){let Z=UP.map((G)=>`"${G}"`).join(", ");throw Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${Z}.`)}}}if(X.has("moduleAttributes"))throw Error("`moduleAttributes` has been removed in Babel 8, please migrate to import attributes instead.");if(X.has("importAssertions"))throw Error("`importAssertions` has been removed in Babel 8, please use import attributes instead.");if(X.has("deprecatedImportAssert"))console.warn("`deprecatedImportAssert` has been removed in Babel 8, please use import attributes instead.");else if(X.has("importAttributes")&&X.get("importAttributes").deprecatedAssertSyntax)console.warn("The 'importAttributes' plugin has been removed in Babel 8. Please migrate any usage of `assert`-style attributes to `with`.");if(X.has("recordAndTuple"))throw Error("The 'recordAndTuple' plugin has been removed in Babel 8. Please remove it from your configuration.");if(X.has("asyncDoExpressions")&&!X.has("doExpressions")){let J=Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.");throw J.missingPlugins="doExpressions",J}if(X.has("optionalChainingAssign")&&X.get("optionalChainingAssign").version!=="2023-07")throw Error("The 'optionalChainingAssign' plugin requires a 'version' option, representing the last proposal update. Currently, the only supported value is '2023-07'.");if(X.has("discardBinding")&&X.get("discardBinding").syntaxType!=="void")throw Error("The 'discardBinding' plugin requires a 'syntaxType' option. Currently the only supported value is 'void'.");if(X.has("decimal"))throw Error("The 'decimal' plugin has been removed in Babel 8. Please remove it from your configuration.");if(X.has("importReflection"))throw Error("The 'importReflection' plugin has been removed in Babel 8. Use 'sourcePhaseImports' instead, and replace 'import module' with 'import source' in your code.")}var pP={estree:D10,jsx:KQ0,flow:ZQ0,typescript:CQ0,v8intrinsic:yQ0,placeholders:DQ0},gQ0=Object.keys(pP);class pL extends _P{constructor(X,J,Q){let Z=P10(X);super(Z,J);this.options=Z,this.initializeScopes(),this.plugins=Q,this.filename=Z.sourceFilename,this.startIndex=Z.startIndex;let G=0;if(Z.allowAwaitOutsideFunction)G|=1;if(Z.allowReturnOutsideFunction)G|=2;if(Z.allowImportExportEverywhere)G|=8;if(Z.allowSuperOutsideMethod)G|=16;if(Z.allowUndeclaredExports)G|=64;if(Z.allowNewTargetOutsideFunction)G|=4;if(Z.allowYieldOutsideFunction)G|=32;if(Z.ranges)G|=128;if(Z.locations===!0)G|=256;if(Z.tokens)G|=512;if(Z.createImportExpressions)G|=1024;if(Z.createParenthesizedExpressions)G|=2048;if(Z.errorRecovery)G|=4096;if(Z.attachComment)G|=8192;if(Z.annexB)G|=16384;this.optionFlags=G}getScopeHandler(){return uW}parse(){this.enterInitialScopes();let X=this.startNode(),J=this.startNode();this.nextToken(),X.errors=[];let Q=this.parseTopLevel(X,J);return Q.errors=this.state.errors,Q.comments.length=this.state.commentsLen,Q}}function cP(X,J){if(J?.sourceType==="unambiguous"){J={...J};try{J.sourceType="module";let Q=hW(J,X),Z=Q.parse();if(Q.sawUnambiguousESM)return Z;if(Q.ambiguousScriptDifferentAst)try{return J.sourceType="script",hW(J,X).parse()}catch{}else Z.program.sourceType="script";return Z}catch(Q){try{return J.sourceType="script",hW(J,X).parse()}catch{}throw Q}}else return hW(J,X).parse()}function bQ0(X){let J={};for(let Q of Object.keys(X))J[Q]=MP(X[Q]);return J}var iO0=bQ0(x10);function hW(X,J){let Q=pL,Z=new Map;if(X?.plugins){for(let G of X.plugins){let Y,V;if(typeof G==="string")Y=G;else[Y,V]=G;if(!Z.has(Y))Z.set(Y,V||{})}xQ0(Z),Q=hQ0(Z)}return new Q(X,J,Z)}var zP=new Map;function hQ0(X){let J=[];for(let G of gQ0)if(X.has(G))J.push(G);let Q=J.join("|"),Z=zP.get(Q);if(!Z){Z=pL;for(let G of J)Z=pP[G](Z);zP.set(Q,Z)}return Z}var E3=(X)=>!!X&&typeof X==="object"&&typeof X.type==="string",B8=(X,J)=>E3(X)&&X.type==="Identifier"&&X.name===J,lP=(X,J,Q)=>E3(X)&&X.type==="MemberExpression"&&!X.computed&&B8(X.object,J)&&B8(X.property,Q),cL=(X)=>E3(X)&&X.type==="MemberExpression"&&!X.computed&&E3(X.object)&&X.object.type==="MetaProperty"&&B8(X.object.meta,"import")&&B8(X.object.property,"meta")&&B8(X.property,"url"),dP=(X)=>E3(X)&&X.type==="StringLiteral"?X.value:void 0;function g4(X,J,Q){let Z=[],G=[],Y=[],V=()=>{throw Error(`Local routine source unavailable: unsupported dynamic source or asset in ${J}. Use literal imports/requires and new URL('./asset', import.meta.url).`)},K=(W,U=!1)=>{let z=dP(W);if(z===void 0)V();Z.push({specifier:z,require:U})},H=(W,U)=>{if(["ImportDeclaration","ExportNamedDeclaration","ExportAllDeclaration"].includes(W.type)&&W.source){let z=W.specifiers;if(W.importKind==="type"||W.exportKind==="type"||z?.length&&z.every((q)=>q.importKind==="type"||q.exportKind==="type"))return;K(W.source)}if(W.type==="ImportExpression"){let z=W.source;if(!(Q&&E3(z)&&z.type==="MemberExpression"&&!z.computed&&B8(z.property,"href")&&E3(z.object)&&z.object.type==="CallExpression"&&B8(z.object.callee,"pathToFileURL")&&Array.isArray(z.object.arguments)&&z.object.arguments.length===1&&lP(z.object.arguments[0],"bootstrap","entry")))K(z)}if(W.type==="CallExpression"&&B8(W.callee,"require"))K(W.arguments[0],!0);if((W.type==="CallExpression"||W.type==="NewExpression")&&(B8(W.callee,"eval")||B8(W.callee,"Function")||B8(W.callee,"createRequire")||lP(W.callee,"module","require")))V();if(W.type==="NewExpression"&&B8(W.callee,"URL")){let z=W.arguments;if(cL(z[1])){let q=dP(z[0]);if(!q||!q.startsWith("./")&&!q.startsWith("../")||z.length!==2)V();G.push(q);let B=z[0];Y.push({start:B.start,end:B.end,path:q})}}if(cL(W)&&!(U?.type==="NewExpression"&&B8(U.callee,"URL")))V();if(W.type==="MetaProperty"&&B8(W.meta,"import")&&!cL(U))V();if(B8(W,"createRequire"))V();if(W.type==="Identifier"&&(W.name==="__dirname"||W.name==="__filename")&&!(U?.type==="MemberExpression"&&U.property===W&&!U.computed))V();if(!Q&&B8(W,"require")&&!(U?.type==="CallExpression"&&U.callee===W)&&!(U?.type==="MemberExpression"&&U.property===W&&!U.computed))V();for(let z of Object.values(W))if(E3(z))H(z,W);else if(Array.isArray(z)){for(let q of z)if(E3(q))H(q,W)}};try{H(cP(X,{sourceType:"unambiguous",createImportExpressions:!0,plugins:J.endsWith(".ts")||J.endsWith(".mts")||J.endsWith(".cts")?["typescript"]:[]}))}catch(W){if(W instanceof Error&&W.message.startsWith("Local routine source unavailable:"))throw W;throw Error(`Local routine source unavailable: unsupported module syntax in ${J}.`)}return{modules:Z,assets:G,assetLiterals:Y}}var YH=zY(QH(),1);import{execFile as lG0}from"node:child_process";import{chmod as dG0,mkdtemp as nG0,readFile as sG0,readdir as aG0,realpath as Q1,rm as iG0,stat as fy}from"node:fs/promises";import{tmpdir as rG0}from"node:os";import{isAbsolute as oG0,join as C3,relative as tG0}from"node:path";O8();var uG0=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,pG0=(X)=>X!==null&&typeof X==="object"&&!Array.isArray(X),cG0=(X,J)=>Object.keys(X).sort().join(",")===J.sort().join(",");function VO(X,J){if(!uG0.test(J)||!pG0(X)||!cG0(X,["name","repositories","routines"])||X.name!==J||!Array.isArray(X.repositories)||!X.repositories.every(o5)||new Set(X.repositories).size!==X.repositories.length||!Array.isArray(X.routines)||!X.routines.every(I8)||new Set(X.routines).size!==X.routines.length)throw Error("Invalid app declaration");return{name:J,repositories:[...X.repositories],routines:[...X.routines]}}function vy(X){return Object.freeze([...X.routines])}function JH(X){let J=VO(X,X.name);function Q(Z){for(let G of Object.values(Z))if(G&&typeof G==="object")Q(G);Object.freeze(Z)}return Q(J),J}var eG0=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,KO="Run os app launch from inside the app’s Git worktree. Git must be available.",ZH="Check apps/<name>/app.json: launch requires a confined V0 declaration with only matching name, repository aliases and ordered routine IDs.";function _y(X){return X!==null&&typeof X==="object"&&!Array.isArray(X)}function GH(X,J){let Q=tG0(X,J);return Q.length>0&&!oG0(Q)&&Q!==".."&&!Q.startsWith(`..${process.platform==="win32"?"\\":"/"}`)}async function WO(X){let J=Object.fromEntries(Object.entries(process.env).filter(([Y])=>!Y.startsWith("GIT_"))),Q=await new Promise((Y,V)=>{lG0("git",["-C",X,"rev-parse","--show-toplevel"],{env:J,encoding:"utf8",timeout:1e4,maxBuffer:65536},(K,H)=>{if(K)V(Error(KO));else Y(H.replace(/\r?\n$/,""))})}),Z=await Q1(Q),G=await Q1(X);if(G!==Z&&!GH(Z,G))throw Error(KO);return Z}async function HO(X,J=process.cwd()){if(!eG0.test(X))throw Error("Use an app name containing lowercase letters, numbers and single separating hyphens.");let Q;try{Q=await WO(J)}catch{throw Error(KO)}try{let Z=await Q1(C3(Q,"apps"));if(!GH(Q,Z))throw Error(ZH);let G=await Q1(C3(Z,X));if(!GH(Z,G)||!(await fy(G)).isDirectory())throw Error(ZH);let Y=await Q1(C3(G,"app.json"));if(!GH(G,Y)||!(await fy(Y)).isFile())throw Error(ZH);let V=JH(VO(JSON.parse(await sG0(Y,"utf8")),X));return{worktreeRoot:Q,appDirectory:G,declarationPath:Y,declaration:V}}catch{throw Error(ZH)}}async function my(X,J,Q={nodeVersion:process.versions.node,typescript:process.features.typescript}){return await XY0(X,J,Q)!==void 0}function uy(X,J){return J.typescript==="strip"&&_y(X)&&X.type==="module"&&_y(X.engines)&&typeof X.engines.node==="string"&&!!YH.validRange(X.engines.node)&&YH.satisfies(J.nodeVersion,X.engines.node)}async function XY0(X,J,Q={nodeVersion:process.versions.node,typescript:process.features.typescript}){if(!X.declaration.routines.includes(J)||!X.prepared)return;try{if(Q.typescript!=="strip")return;let Z=await Q1(X.worktreeRoot);if(Z!==X.worktreeRoot)return;let G=X.prepared.definitions.get(J);if(!G)return;let Y=await Q1(await nG0(C3(rG0(),"os-app-routine-")));try{let V=await ZJ({root:Z,gitDirectory:"",remote:"",branch:""},J,C3(Y,"source"),Q,G.entry);if(V.version!==G.source.version)return;return{entry:C3(Z,G.entry),directory:C3(Z,"routines"),sdk:C3(Z,V.sdk)}}finally{for(let V of await aG0(Y))await dG0(C3(Y,V),448);await iG0(Y,{recursive:!0,force:!0})}}catch{return}}X3();var h4=(X)=>/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.test(X);function xG(X){return X.startsWith("routines/")&&!/[\x00-\x1f\x7f\\:]/.test(X)&&X.split("/").every((J)=>!!J&&J!==".."&&!J.startsWith(".")&&!["node_modules","runs","credentials","secrets"].includes(J.toLowerCase()))&&!/(?:^|\/)(?:Dockerfile(?:\..*)?|(?:bun|vite|webpack|rollup|eslint)\.config\..*|(?:package|tsconfig)\.json|(?:bun|package|yarn|pnpm).*lock|requirements\.lock|.*\.(?:pem|key|p12|pfx|node|swp|swo)|id_(?:rsa|dsa|ecdsa|ed25519)(?:\..*)?|(?:credentials|secrets)(?:\..*)?)$/i.test(X)}var w8="https://schemas.oddington.ai/routine/v1.json",v7={files:20000,bytes:268435456,declarationBytes:65536};function py(X){return K8({$schema:w8,access:X.access})}function GJ(X){let J=/^routines\/([^/]+)\/routine\.ts$/.exec(X);if(!J||!h4(J[1]))throw Error("Invalid frozen routine definition entry");return J[1]}var Y9=(X)=>{throw Error(`Invalid routine declaration: ${X}`)},gG=(X,J,Q)=>{if(!X||typeof X!=="object"||Array.isArray(X)||Object.getPrototypeOf(X)!==Object.prototype&&Object.getPrototypeOf(X)!==null||Reflect.ownKeys(X).some((Z)=>typeof Z!=="string"||!J.includes(Z)||!Object.getOwnPropertyDescriptor(X,Z).enumerable||!Object.hasOwn(Object.getOwnPropertyDescriptor(X,Z),"value")))Y9(Q);return X},zO=(X)=>typeof X==="string"&&/^[a-z][a-z0-9-]{0,62}$/.test(X),UO=(X,J,Q,Z=!1)=>{if(X===void 0)return[];if(!Array.isArray(X)||X.length>64||X.some((G)=>!(zO(G)||Z&&typeof G==="string"&&G.split("/").length===2&&G.split("/").every(zO))||Q&&!Q.includes(G))||new Set(X).size!==X.length)Y9(J);return[...X].sort()};function QY0(X){return typeof X==="string"&&X.length<=512&&!X.startsWith("/")&&!X.includes("\\")&&!X.includes(":")&&X.split("/").every((J)=>!!J&&J!=="."&&J!==".."&&/^[a-zA-Z0-9_.*-]+$/.test(J))}function K8(X){let J=gG(X,["$schema","access","runtime","retry","assets"],"fields");if(J.$schema!==w8)Y9("$schema");let Q=gG(J.access===void 0?{}:J.access,["repositories","connections","ai","files","publish"],"access");if(Object.hasOwn(Q,"ai")&&Q.ai!==!0)Y9("access.ai");let Z=Q.repositories===void 0?{}:Q.repositories,G=gG(Z,Z&&typeof Z==="object"?Object.keys(Z):[],"access.repositories");if(Object.keys(G).length>64)Y9("access.repositories");let Y={};for(let z of Object.keys(G).sort()){if(!zO(z)||!["read","write"].includes(G[z]))Y9(`access.repositories.${z}`);Y[z]=G[z]}if(Q.files!==void 0&&!["read","read-write"].includes(Q.files))Y9("access.files");let V=gG(J.runtime===void 0?{}:J.runtime,["features","resources","maxDuration"],"runtime");if(V.resources!==void 0&&!["standard","large"].includes(V.resources))Y9("runtime.resources");let K=V.maxDuration===void 0?"15m":V.maxDuration;if(typeof K!=="string"||!/^(?:[1-5][0-9]|60)m$/.test(K)||Number(K.slice(0,-1))<15)Y9("runtime.maxDuration");let H=gG(J.retry===void 0?{}:J.retry,["maxAttempts"],"retry"),W=H.maxAttempts===void 0?1:H.maxAttempts;if(!Number.isInteger(W)||W<1||W>3)Y9("retry.maxAttempts");let U=J.assets===void 0?[]:J.assets;if(!Array.isArray(U)||U.length>64||U.some((z)=>!QY0(z))||new Set(U).size!==U.length)Y9("assets");return{$schema:w8,access:{repositories:Y,connections:UO(Q.connections,"access.connections",void 0,!0),...Q.ai===!0?{ai:!0}:{},...Q.files===void 0?{}:{files:Q.files},publish:UO(Q.publish,"access.publish",["asks","digests"])},runtime:{features:UO(V.features,"runtime.features",["python","documents","browser"]),resources:V.resources??"standard",maxDuration:K},retry:{maxAttempts:W},assets:[...U].sort()}}X3();import{createHash as JY0}from"node:crypto";var VH=(X,J)=>x1({PATH:process.env.PATH,GIT_CONFIG_NOSYSTEM:"1",GIT_CONFIG_GLOBAL:"/dev/null"},()=>N5(X,["-c","core.fsmonitor=false",...J],void 0,{localObjectsOnly:!0}));async function ZY0(X){let J=(await VH(X,["symbolic-ref","HEAD"])).toString().trim();if(!J.startsWith("refs/heads/"))throw Error("Routine checkout branch unavailable");try{let Q=(await VH(X,["rev-parse","--verify",`${J}^{commit}`])).toString().trim();if(!/^[0-9a-f]{40}$/.test(Q))throw Error("Routine checkout commit unavailable");return{branch:J,commit:Q}}catch(Q){if(!(Q instanceof X7))throw Q;try{await VH(X,["show-ref","--verify","--quiet",J])}catch(Z){if(Z instanceof X7&&Z.exitCode===1)return{branch:J};throw Z}throw Q}}async function KH(X,J){let Q=await ZY0(X);if(!Q.commit)return{...Q,dirty:!0};let Z=[...new Set([...J.keys()].filter((V)=>!V.split("/").includes("node_modules")).map((V)=>V.split("/")[0]))],G=(await VH(X,["ls-tree","-rz","--full-tree",Q.commit,"--",...Z])).toString("utf8"),Y=new Map(G.split("\x00").flatMap((V)=>{let K=/^[0-7]{6} blob ([0-9a-f]{40})\t(.+)$/.exec(V);return K?[[K[2],K[1]]]:[]}));return{...Q,dirty:[...J].some(([V,K])=>!V.split("/").includes("node_modules")&&JY0("sha1").update(`blob ${K.length}\x00`).update(K).digest("hex")!==Y.get(V))}}var kO=zY(QH(),1);import{execFile as FY0}from"node:child_process";import{constants as OH}from"node:fs";import{access as PY0,lstat as TH,mkdir as Ux,open as DY0,readdir as yY0,realpath as K1,writeFile as zx}from"node:fs/promises";import{dirname as IH,join as I6,posix as xY0,relative as gY0,sep as jH,win32 as bY0}from"node:path";import{promisify as hY0}from"node:util";var W8=zY(QH(),1);var V9="0.1.28",Q5=()=>{throw Error("Invalid frozen routine dependencies: use an admitted routines manifest and Bun lock with frozen registry packages and no runtime scripts or SDK replacement.")},w6=(X)=>{if(!X||typeof X!=="object"||Array.isArray(X))return Q5();return X};function VJ(X){let J="",Q=!1,Z=!1;for(let G=0;G<X.length;G++){let Y=X[G];if(!Q&&Y===","&&/^[\s]*[}\]]/.test(X.slice(G+1)))continue;if(J+=Y,Q){if(Z)Z=!1;else if(Y==="\\")Z=!0;else if(Y==='"')Q=!1}else if(Y==='"')Q=!0}try{return JSON.parse(J)}catch{return Q5()}}var YJ=(X)=>/^(?:@[a-z0-9][a-z0-9_.-]*\/)?[a-z0-9][a-z0-9_.-]*$/.test(X),ly=(X)=>/^(?:@?[a-z0-9][a-z0-9_.-]*\/)*[a-z0-9][a-z0-9_.-]*$/.test(X)&&X.split("/").every((J,Q,Z)=>!J.startsWith("@")||Q<Z.length-1&&!Z[Q+1].startsWith("@")),cy=(X)=>{try{return w6(JSON.parse(X))}catch{return Q5()}},qO=(X)=>Object.fromEntries(Object.keys(X).sort().map((J)=>[J,WH(X[J])])),WH=(X)=>Array.isArray(X)?X.map(WH):X&&typeof X==="object"?qO(w6(X)):X,bG=(X)=>{let J=w6(X===void 0?{}:X);for(let[Q,Z]of Object.entries(J))if(!YJ(Q)||typeof Z!=="string"||!Z||!W8.validRange(Z))Q5();return J},GY0=(X)=>{let J=X.match(/@[^/]+\/[^/]+|[^/]+/g)??[];return J.pop(),J.join("/")},MO=(X,J,Q)=>{for(;;){let Z=J?`${J}/${Q}`:Q;if(Object.hasOwn(X,Z))return Z;if(!J)return;J=GY0(J)}};function hG(X,J,Q,Z){if(!h4(Z))Q5();let G=cy(X),Y=cy(J),V=(I)=>{let j=I.replace(/^\.\//,"").replace(/\/$/,"");if(j.includes("/")&&!j.includes("**"))return!1;if(!/^[a-zA-Z0-9_.*-]+$/.test(j))return Q5();return new RegExp(`^${j.replace(/\./g,"\\.").replace(/\*/g,".*")}$`).test(Z)};if(!Array.isArray(G.workspaces)||!G.workspaces.every((I)=>typeof I==="string")||!G.workspaces.some((I)=>!I.startsWith("!")&&V(I))||G.workspaces.some((I)=>I.startsWith("!")&&V(I.slice(1))))Q5();if(Y.private!==!0||Y.type!=="module"||Object.keys(Y).some((I)=>!["name","version","private","type","engines","dependencies"].includes(I)))Q5();if(typeof Y.name!=="string"||!YJ(Y.name))Q5();if(Y.version!==void 0&&(typeof Y.version!=="string"||!W8.valid(Y.version)))Q5();let K=w6(Y.engines===void 0?{}:Y.engines);if(Object.keys(K).some((I)=>I!=="node")||K.node!==void 0&&(typeof K.node!=="string"||!W8.validRange(K.node)))Q5();let H=bG(Y.dependencies);if(Object.hasOwn(H,"@oddington/sdk")||Object.values(H).some((I)=>I==="*"))Q5();let W=w6(VJ(Q));if(W.lockfileVersion!==1||W.configVersion!==void 0&&W.configVersion!==0&&W.configVersion!==1||Object.keys(W).some((I)=>!["lockfileVersion","configVersion","workspaces","packages","trustedDependencies","patchedDependencies","overrides","catalog","catalogs"].includes(I)))Q5();let U=w6(W.patchedDependencies===void 0?{}:W.patchedDependencies),z=w6(w6(W.workspaces)[Z]);if(z.name!==Y.name||z.version!==Y.version||JSON.stringify(qO(bG(z.dependencies)))!==JSON.stringify(qO(H))||Object.keys(z).some((I)=>!["name","version","dependencies"].includes(I)))Q5();let q=w6(W.packages),B=Object.create(null),M=Y.name,L=q[M];if(!Array.isArray(L)||L.length!==1||L[0]!==`${M}@workspace:${Z}`)Q5();B[M]=L;let T=[],O=(I,j,$,R=!1)=>{if(j==="@oddington/sdk"){if(!W8.satisfies(V9,$))Q5();return}let A=MO(q,I,j);if(!A){if(R)return;return Q5()}let S=q[A];if(!ly(A)||!Array.isArray(S)||S.length!==4||typeof S[0]!=="string"||S[1]!==""||typeof S[3]!=="string"||!/^sha512-[A-Za-z0-9+/]{86}==$/.test(S[3]))return Q5();let N=S[0],E=N.slice(j.length+1);if(!N.startsWith(`${j}@`)||!W8.valid(E)||!W8.satisfies(E,$)||Object.hasOwn(U,N))Q5();if(Object.hasOwn(B,A))return;B[A]=S,T.push({original:A,row:S})};for(let I of Object.keys(H).sort())O(M,I,H[I]);for(let I=0;I<T.length;I++){if(T.length>20000)Q5();let{original:j,row:$}=T[I],R=w6($[2]);if(Object.keys(R).some((y)=>!["dependencies","optionalDependencies","peerDependencies","optionalPeers","bin","os","cpu"].includes(y)))Q5();let A=bG(R.dependencies),S=bG(R.optionalDependencies),N=bG(R.peerDependencies),E=R.optionalPeers??[];if(!Array.isArray(E)||E.some((y)=>typeof y!=="string"||!Object.hasOwn(N,y))||new Set(E).size!==E.length)Q5();if(Object.hasOwn(A,"@oddington/sdk")||Object.hasOwn(S,"@oddington/sdk"))Q5();for(let[y,C]of Object.entries({...N,...A,...S}).sort(([w],[P])=>w.localeCompare(P)))O(j,y,C,Object.hasOwn(S,y)||!Object.hasOwn(A,y)&&E.includes(y));for(let[y,C]of Object.entries(N))O(j,y,C,E.includes(y))}return{manifest:JSON.stringify(WH({type:"module",private:!0,workspaces:[Z]})),lock:JSON.stringify(WH({lockfileVersion:1,...W.configVersion===void 0?{}:{configVersion:W.configVersion},workspaces:{"":{},[Z]:{name:M,...Y.version?{version:Y.version}:{},dependencies:H}},packages:B})),dependencies:new Set(Object.keys(H))}}function BO(X,J){let Q;try{Q=w6(JSON.parse(X))}catch{return Q5()}if(Q.type!=="module"||Object.keys(Q).some((U)=>!["name","version","private","type","engines","dependencies"].includes(U)))Q5();if(Q.name!==void 0&&(typeof Q.name!=="string"||!YJ(Q.name)))Q5();if(Q.version!==void 0&&(typeof Q.version!=="string"||!W8.valid(Q.version)))Q5();if(Q.private!==void 0&&typeof Q.private!=="boolean")Q5();let Z=w6(Q.engines===void 0?{}:Q.engines);if(Object.keys(Z).some((U)=>U!=="node")||Z.node!==void 0&&(typeof Z.node!=="string"||!W8.validRange(Z.node)))Q5();let G=w6(Q.dependencies===void 0?{}:Q.dependencies);for(let[U,z]of Object.entries(G)){if(!YJ(U)||typeof z!=="string"||!W8.validRange(z)||z==="*"||z==="")Q5();if(U==="@oddington/sdk"&&!W8.satisfies(V9,z))Q5()}let Y=w6(VJ(J));if(Y.lockfileVersion!==1||Object.keys(Y).some((U)=>!["lockfileVersion","configVersion","workspaces","packages"].includes(U)))Q5();let V=w6(Y.workspaces);if(Object.keys(V).join()!=="")Q5();let K=w6(V[""]);if(Object.keys(K).some((U)=>!["name","version","dependencies"].includes(U)))Q5();let H=w6(K.dependencies===void 0?{}:K.dependencies);if(Object.keys(H).length!==Object.keys(G).length||Object.entries(G).some(([U,z])=>H[U]!==z))Q5();let W=w6(Y.packages);for(let[U,z]of Object.entries(W)){if(!Array.isArray(z)||z.length!==4||typeof z[0]!=="string"||z[1]!==""||typeof z[3]!=="string"||!/^sha512-[A-Za-z0-9+/]{86}==$/.test(z[3]))return Q5();let q=z[0],B=q.lastIndexOf("@"),M=q.slice(0,B),L=q.slice(B+1);if(!YJ(M)||!W8.valid(L)||!ly(U)||!(U===M||U.endsWith(`/${M}`))||M==="@oddington/sdk"&&L!==V9)Q5();let T=w6(z[2]);if(Object.keys(T).some((O)=>!["dependencies","optionalDependencies","peerDependencies","optionalPeers","bin","os","cpu"].includes(O)))Q5();for(let O of["dependencies","optionalDependencies","peerDependencies"])for(let[I,j]of Object.entries(w6(T[O]===void 0?{}:T[O]))){if(!YJ(I)||typeof j!=="string"||!W8.validRange(j))Q5();if(I==="@oddington/sdk"&&O!=="peerDependencies")Q5();if(O!=="peerDependencies"&&!Object.values(W).some(($)=>Array.isArray($)&&typeof $[0]==="string"&&$[0].startsWith(`${I}@`)&&W8.satisfies($[0].slice(I.length+1),j)))Q5()}}for(let[U,z]of Object.entries(G)){let q=W[U];if(!Array.isArray(q)||typeof q[0]!=="string"||!q[0].startsWith(`${U}@`)||!W8.satisfies(q[0].slice(U.length+1),z))Q5()}return new Set(Object.keys(G))}function LO(X){let J=new Set;for(let Q of X.split(/\r?\n/).map((Z)=>Z.trim()).filter((Z)=>Z&&!Z.startsWith("#"))){let Z=/^([a-zA-Z0-9][a-zA-Z0-9_.-]*)==([0-9]+(?:\.[0-9]+)*(?:(?:a|b|rc)[0-9]+|\.post[0-9]+|\.dev[0-9]+)?)((?: --hash=sha256:[0-9a-f]{64})+)$/.exec(Q),G=Z?.[1]?.toLowerCase().replace(/[_.]/g,"-");if(!Z||!G||J.has(G))throw Error("Invalid frozen Python dependencies: use unique exact versions with SHA-256 hashes, one requirement per line.");J.add(G)}}import{spawn as YY0}from"node:child_process";import{mkdir as VY0,mkdtemp as KY0,rm as WY0,stat as HY0,writeFile as HH}from"node:fs/promises";import{tmpdir as UY0}from"node:os";import{dirname as zY0,extname as dy,join as v4,posix as f4}from"node:path";var OO="routine-v3",vG="1.3.14",J1=(X,J)=>`routines/${X}/.os-executable/${J}.mjs`;async function ny(X,J,Q,Z,G){await new Promise((Y,V)=>{let K=YY0(X,J,{cwd:Q,env:Z,stdio:"ignore",detached:!0}),H=!1,W=()=>{try{process.kill(-K.pid,"SIGKILL")}catch{}},U=setTimeout(()=>{H=!0,W()},G);K.once("error",()=>{clearTimeout(U),V(Error("Fixed routine build tool unavailable"))}),K.once("close",(z)=>{if(clearTimeout(U),W(),z===0&&!H)Y();else V(Error(H?"Fixed routine build timed out":"Fixed routine build failed"))})})}async function sy(X,J,Q,Z){if(!/^[a-z0-9][a-z0-9-]{0,62}$/.test(J))throw Error("Invalid routine name");let G=await KY0(v4(UY0(),"os-routine-compiler-")),Y=Date.now()+Z.timeoutMs,V=()=>{let W=Y-Date.now();if(W<=0)throw Error("Fixed routine build timed out");return W},K=new Map,H=(W)=>{if(K.has(W)||dy(W)===".json")return;let U=Q.get(W);if(!U)throw Error("Frozen module missing");K.set(W,U);for(let{specifier:z}of g4(Buffer.from(U).toString("utf8"),W,!1).modules){if(!z.startsWith("./")&&!z.startsWith("../"))continue;let q=f4.normalize(f4.join(f4.dirname(W),z));if(!dy(q)){let B=[".ts",".js",".json",".mts",".mjs",".cts",".cjs"].map((M)=>q+M).filter((M)=>Q.has(M));if(B.length!==1)throw Error("Frozen module ambiguous");q=B[0]}H(q)}};try{if(H(Z.definitionEntry??`routines/${J}/run.ts`),!Z.definitionEntry&&Q.has(`routines/${J}/responses.ts`))H(`routines/${J}/responses.ts`);let W=v4(G,"tsconfig.json");await HH(W,JSON.stringify({compilerOptions:{target:"ESNext",module:"ESNext",moduleResolution:"Bundler",jsx:"react-jsx"}}),{flag:"wx",mode:384}),await ny(Z.bun,["--no-env-file","-e",`if(Bun.version!==${JSON.stringify(vG)})process.exit(1)`],G,Z.environment,V());for(let U of["run","responses"]){if(Z.definitionEntry&&U==="responses"){await HH(v4(X,J1(J,"responses")),`import definition from "./run.mjs"; export const handlers = definition.responses;
298
298
  `,{flag:"wx"});continue}let z=Z.definitionEntry??`routines/${J}/${U}.ts`;if(!Q.has(z)){if(U==="run")throw Error("Conventional Run entry missing");continue}let q=J1(J,U);for(let[M,L]of K){let T=Buffer.from(L).toString("utf8"),{assetLiterals:O}=g4(T,M,!1);for(let I of O.reverse()){let j=f4.normalize(f4.join(f4.dirname(M),I.path));if(!Q.has(j))throw Error("Frozen asset missing");let $=f4.relative(f4.dirname(q),j);T=T.slice(0,I.start)+JSON.stringify($.startsWith(".")?$:`./${$}`)+T.slice(I.end)}await HH(v4(X,M),T)}await VY0(zY0(v4(X,q)),{recursive:!0}),await ny(Z.bun,["--no-env-file","build",z,"--target=node","--format=esm","--packages=bundle","--external=@oddington/sdk","--sourcemap=none",`--tsconfig-override=${W}`,`--outfile=${v4(X,q)}`,'--banner=import { createRequire as __osCreateRequire } from "node:module"; var require = __osCreateRequire(import.meta.url);'],X,Z.environment,V());let B=await HY0(v4(X,q));if(!B.isFile()||!B.size||B.size>v7.bytes)throw Error("Routine executable missing or exceeds bounds")}return{entry:J1(J,"run"),...Z.definitionEntry||Q.has(`routines/${J}/responses.ts`)?{responses:J1(J,"responses")}:{}}}finally{try{for(let[W,U]of K)await HH(v4(X,W),U)}finally{await WY0(G,{recursive:!0,force:!0})}}}var ay=Object.freeze({recipeVersion:OO,runtimeVersion:"bun-1.3.14",sdkVersion:`sdk-${V9}`,toolsVersion:"debian-bookworm-20251030-v1",features:{python:"python3@bookworm-20251030",documents:"poppler@bookworm-20251030",browser:"chromium@bookworm-20251030"}}),SI0=Object.freeze({timeoutMs:900000,checkTimeoutMs:30000,materialBytes:1073741824,contractBytes:65536});function iy(X,J=OO){return{...ay,...J==="routine-v2"?{recipeVersion:J,sdkVersion:"sdk-0.1.11"}:{},features:X.runtime.features,featureVersions:Object.fromEntries(X.runtime.features.map((Q)=>[Q,ay.features[Q]])),profile:X.runtime.resources,maxDuration:X.runtime.maxDuration,limits:X.runtime.resources==="large"?{memoryMiB:8192,cpu:2,scratchMiB:8192}:{memoryMiB:4096,cpu:0.5,scratchMiB:4096}}}import{createHash as RY0}from"node:crypto";import{constants as SO}from"node:fs";import{lstat as V1,open as AY0,readdir as SY0,realpath as MJ}from"node:fs/promises";import{isBuiltin as EY0}from"node:module";import{dirname as sG,extname as EO,join as s9,relative as CY0,resolve as wY0,sep as kY0}from"node:path";import{chmod as TY0,lstat as Yx,mkdtemp as IY0,readdir as Vx,realpath as RO,rm as jY0}from"node:fs/promises";import{tmpdir as NY0}from"node:os";import{join as qJ}from"node:path";import{spawn as LY0}from"node:child_process";import{join as Zx}from"node:path";import{pathToFileURL as Gx}from"node:url";D5();var c9=262144;function TO(X){let J=X;if(!J||Object.keys(J).some((Z)=>!["input","steps","result"].includes(Z))||!Array.isArray(J.steps))throw Error("Invalid routine contract");let Q=e9({...J,routine:"local",steps:J.steps.length?J.steps:[{id:"inspect"}]});return{input:Q.input,steps:J.steps.length?Q.steps:[],...Q.result?{result:Q.result}:{}}}function k8(X,J){if(t9(X,J),new TextEncoder().encode(JSON.stringify(J)).length>c9)throw Error("Routine value exceeds 256 KiB")}function Z1(X,J){if(X.type==="file")return[f5(J)];if(X.type==="array")return J.flatMap((Q)=>Z1(X.items,Q));if(X.type==="object")return Object.entries(J).flatMap(([Q,Z])=>Z1(X.properties[Q],Z));return[]}function fG(X,J,Q){if(X.type==="file")return[{file:f5(J),storage:X.storage??Q}];if(X.type==="array")return J.flatMap((Z)=>fG(X.items,Z,Q));if(X.type==="object")return Object.entries(J).flatMap(([Z,G])=>fG(X.properties[Z],G,Q));return[]}function UH(X){if(X.type==="file")return X.storage==="local";if(X.type==="array")return UH(X.items);return X.type==="object"&&Object.values(X.properties).some(UH)}o8();var KJ=()=>{throw new XX("invalid_value")},WJ=()=>{throw new XX("invalid_contract")},IO=(X)=>typeof X==="string"&&X.trim().length>0&&X.length<=256;function l9(X){if(X!==null&&typeof X==="object"){for(let J of Object.values(X))l9(J);Object.freeze(X)}return X}function d9(X,J=new Set){if(X===null||typeof X==="string"||typeof X==="boolean"||typeof X==="number"&&Number.isFinite(X))return;if(!X||typeof X!=="object"||J.has(X))return KJ();let Q=Array.isArray(X);if(!Q&&Object.getPrototypeOf(X)!==Object.prototype&&Object.getPrototypeOf(X)!==null)return KJ();let Z=Reflect.ownKeys(X);if(Q&&(Z.length!==X.length+1||!Array.from({length:X.length},(G,Y)=>Object.hasOwn(X,Y)).every(Boolean)))return KJ();J.add(X);for(let G of Z){if(Q&&G==="length")continue;if(typeof G!=="string")return KJ();let Y=Object.getOwnPropertyDescriptor(X,G);if(!Y.enumerable||!Object.hasOwn(Y,"value"))return KJ();d9(Y.value,J)}J.delete(X)}function w3(X,J){if(!X||typeof X!=="object"||Object.getPrototypeOf(X)!==Object.prototype||Reflect.ownKeys(X).some((Q)=>typeof Q!=="string"||J&&!J.includes(Q)||!Object.getOwnPropertyDescriptor(X,Q).enumerable||!Object.hasOwn(Object.getOwnPropertyDescriptor(X,Q),"value")))return WJ()}function ry(X){try{if(X!==void 0)d9(X);w3(X??{},["repositories","connections","ai","files","publish"]);let J=X,Q=J?.connections??[];if(!Array.isArray(Q)||Q.length>64||new Set(Q).size!==Q.length||Q.some((G)=>typeof G!=="string"||G.split("/").length!==2||G.split("/").some((Y)=>!I8(Y))))return WJ();let Z=K8({$schema:w8,access:{...J,connections:[]}}).access;return l9({...Z,connections:[...Q]})}catch{return WJ()}}function HJ(X){w3(X,["id","title","input","inputDefault","access","responses","steps","result"]),d9(X);let J=JSON.stringify(X);if(new TextEncoder().encode(J).byteLength>262144)return KJ();let Q=JSON.parse(J);if(!I8(Q.id)||Q.title!==void 0&&!IO(Q.title)||!Array.isArray(Q.steps)||!Array.isArray(Q.responses)||Q.responses.length>64)return WJ();for(let Y of Q.steps)if(w3(Y,["id","title"]),!IO(Y.title))return WJ();let Z=e9({routine:Q.id,input:Q.input,steps:Q.steps.length?Q.steps.map((Y)=>({id:Y.id})):[{id:"inspect"}],...Q.result===void 0?{}:{result:Q.result}}),G=new Set;for(let Y of Q.responses){if(w3(Y,["id"]),!I8(Y.id)||G.has(Y.id))return WJ();G.add(Y.id)}if(Object.hasOwn(Q,"inputDefault"))t9(Z.input,Q.inputDefault);return l9({id:Q.id,...Q.title===void 0?{}:{title:Q.title},input:Z.input,...Object.hasOwn(Q,"inputDefault")?{inputDefault:Q.inputDefault}:{},access:ry(Q.access),responses:Q.responses,steps:Q.steps,...Z.result===void 0?{}:{result:Z.result}})}D5();var _G=262144,zH=4096,oy=120000,ty=["access_denied","capability_unavailable","invalid_input","unsupported_file","file_unavailable","input_too_large","output_too_large","provider_failure","invalid_output","cancelled"];class k0 extends Error{code;constructor(X){super(X);this.code=X;this.name="RoutineAIError"}}function ey(X,J,Q){try{d9(X);let Z=JSON.stringify(X);if(new TextEncoder().encode(Z).byteLength>_G)throw new k0(Q);return l9(JSON.parse(Z))}catch(Z){if(Z instanceof k0)throw Z;throw new k0(J)}}function mG(X){let J=ey(X,"invalid_input","input_too_large");try{if(w3(J,J.kind==="generateObject"?["kind","instructions","input","schema"]:["kind","instructions","input"]),!["generateText","generateObject"].includes(J.kind)||typeof J.instructions!=="string"||!J.instructions.trim())throw Error();let Q=typeof J.input==="string"?J.input:f5(J.input);if(J.kind==="generateText")return l9({kind:J.kind,instructions:J.instructions,input:Q});let Z=e9({routine:"ai",input:J.schema,steps:[{id:"generate"}]}).input;return l9({kind:J.kind,instructions:J.instructions,input:Q,schema:Z})}catch{throw new k0("invalid_input")}}function jO(X,J){let Q=ey(J,"invalid_output","output_too_large");try{if(X.kind==="generateText"){if(w3(Q,["text"]),typeof Q.text!=="string"||!Q.text.trim())throw Error();return l9({text:Q.text})}else{if(w3(Q,["object"]),!Object.hasOwn(Q,"object"))throw Error();return t9(X.schema,Q.object),l9({object:Q.object})}}catch{throw new k0("invalid_output")}}function Xx(X,J){if(typeof J!=="string")throw new k0("invalid_output");if(new TextEncoder().encode(J).byteLength>_G)throw new k0("output_too_large");if(X.kind==="generateText")return jO(X,{text:J});let Q;try{Q=JSON.parse(J)}catch{throw new k0("invalid_output")}return jO(X,{object:Q})}function UJ(X){return typeof X==="string"&&X.length<=2048&&X.startsWith("/")&&!/[\\\x00-\x1f\x7f]/.test(X)&&X.slice(1).split("/").every((J)=>J.length>0&&J.trim()===J&&J!=="."&&J!=="..")}var Qx=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function Jx(X){return typeof X==="object"&&X!==null&&!Array.isArray(X)}function _4(X,J){return Object.keys(X).length===J.length&&J.every((Q)=>Object.hasOwn(X,Q))}function k3(X){return typeof X==="string"&&/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(X)}function qH(X){return typeof X==="string"&&X.length<=254&&/^[^\s@/?#\\\x00-\x1f\x7f]+@[^\s@/?#\\\x00-\x1f\x7f]+\.[^\s@/?#\\\x00-\x1f\x7f]+$/.test(X)}function qY0(X){return/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.sharepoint\.com$/.test(X)}function MH(X){if(typeof X!=="string"||X.length>2048||/[\s\\?#\x00-\x1f\x7f]/.test(X)||!/^https:\/\/[^/:@]+(?:\/|$)/i.test(X))return;try{let J=new URL(X);if(J.protocol!=="https:"||!qY0(J.hostname)||J.username||J.password||J.port)return;let Q=X.replace(/^https:\/\/[^/]+/i,"")||"/",Z=Q.endsWith("/")?Q.slice(0,-1):Q,G=Z.slice(1).split("/");if(Z&&G.some((K)=>!K))return;let Y=Z?G.map((K)=>{let H=decodeURIComponent(K);if(H==="."||H===".."||/[/%\\?#\x00-\x1f\x7f]/.test(H))throw Error();return encodeURIComponent(H)}).join("/"):"",V=`https://${J.hostname}/${Y}`;return V.length<=2048?V:void 0}catch{return}}function NO(X,J){if(typeof X!=="string"||X.length>512)return!1;let[Q,Z,G,Y]=X.split(",");return Y===void 0&&Q===new URL(J).hostname&&k3(Z)&&k3(G)}function zJ(X){return Array.isArray(X)&&X.length>0&&X.length<=32&&X.every((J)=>typeof J==="string"&&J.length<=256&&/^(https:\/\/www\.googleapis\.com\/auth\/[A-Za-z0-9._-]+|https:\/\/mail\.google\.com\/|openid|email|profile)$/.test(J))&&new Set(X).size===X.length}function MY0(X,J){if(!Jx(J))return!1;switch(X){case"github":return _4(J,["installationId","accountId","accountLogin"])&&Number.isSafeInteger(J.installationId)&&J.installationId>0&&Number.isSafeInteger(J.accountId)&&J.accountId>0&&typeof J.accountLogin==="string"&&/^[a-z\d][a-z\d-]{0,38}$/i.test(J.accountLogin);case"gmail":return _4(J,["accountEmail","clientId","scopes"])&&zJ(J.scopes)&&typeof J.accountEmail==="string"&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(J.accountEmail)&&typeof J.clientId==="string"&&J.clientId.trim().length>0;case"airtable":return _4(J,["baseId"])&&typeof J.baseId==="string"&&/^app[a-zA-Z0-9]+$/.test(J.baseId);case"dropbox":return typeof J.accountId==="string"&&/^dbid:[A-Za-z0-9_-]{1,128}$/.test(J.accountId)&&typeof J.appKey==="string"&&/^[A-Za-z0-9]{1,128}$/.test(J.appKey)&&(J.access==="app_folder"&&_4(J,["accountId","appKey","rootIdentity","access","scopes"])&&J.rootIdentity===BY0(J.appKey,J.accountId)||J.access==="full_dropbox"&&_4(J,["accountId","appKey","rootPath","access","scopes"])&&UJ(J.rootPath))&&pG(J.scopes);case"outlook":return _4(J,["tenantId","clientId","mailboxEmail","access"])&&k3(J.tenantId)&&k3(J.clientId)&&qH(J.mailboxEmail)&&J.access==="read";case"sharepoint":return _4(J,["tenantId","clientId","siteUrl","siteId","access"])&&k3(J.tenantId)&&k3(J.clientId)&&typeof J.siteUrl==="string"&&MH(J.siteUrl)===J.siteUrl&&NO(J.siteId,J.siteUrl)&&["read","read-write"].includes(J.access);default:return!1}}function BY0(X,J){return`app-folder/${X}/${J}`}var uG=["account_info.read","files.metadata.read","files.content.read","files.content.write"];function pG(X){return Array.isArray(X)&&X.length===uG.length&&new Set(X).size===X.length&&uG.every((J)=>X.includes(J))}function G1(X){if(!Jx(X)||!_4(X,["id","workspaceId","provider","name","config","enabled","hasCredentials","createdAt","updatedAt"])||typeof X.id!=="string"||!Qx.test(X.id)||typeof X.workspaceId!=="string"||!Qx.test(X.workspaceId)||typeof X.name!=="string"||!/^[a-z0-9][a-z0-9-]{0,62}$/.test(X.name)||!MY0(X.provider,X.config)||typeof X.enabled!=="boolean"||typeof X.hasCredentials!=="boolean"||typeof X.createdAt!=="string"||!Number.isFinite(Date.parse(X.createdAt))||typeof X.updatedAt!=="string"||!Number.isFinite(Date.parse(X.updatedAt)))throw Error("Invalid connection metadata");return X}var $O="OS_CONNECTION_CREDENTIAL",Y1="OS_ROUTINE_CONNECTION_CREDENTIALS";function cG(X){if(!Array.isArray(X)||X.some((J)=>typeof J!=="string"||!/^(gmail|airtable|dropbox)\/[a-z0-9][a-z0-9-]{0,62}$/.test(J))||new Set(X).size!==X.length)throw Error("Invalid routine connections");return X}var n9=(X)=>typeof X==="string"&&/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(X),lG=(X)=>X.provider==="airtable"?X.runExpiresAt:X.expiresAt;function BH(X,J=Date.now()){let Q=X;if(!Q||typeof Q!=="object"||Array.isArray(Q)||!n9(Q.connectionId)||!n9(Q.runId)||typeof Q.name!=="string"||!/^[a-z0-9][a-z0-9-]{0,62}$/.test(Q.name)||typeof Q.accessToken!=="string"||!/^[A-Za-z0-9._~+/-]{1,8192}={0,2}$/.test(Q.accessToken))throw Error("Invalid connection credential");if(Q.provider==="gmail"){if(Object.keys(Q).sort().join(",")!=="accessToken,accountEmail,connectionId,expiresAt,name,provider,runId,scopes"||typeof Q.accountEmail!=="string"||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(Q.accountEmail)||!zJ(Q.scopes)||typeof Q.expiresAt!=="string"||!Number.isFinite(Date.parse(Q.expiresAt))||Date.parse(Q.expiresAt)<=J+60000||Date.parse(Q.expiresAt)>J+3600000)throw Error("Invalid connection credential");return Q}if(Q.provider==="airtable"&&Object.keys(Q).sort().join(",")==="accessToken,baseId,connectionId,name,provider,runExpiresAt,runId"&&typeof Q.baseId==="string"&&/^app[A-Za-z0-9]+$/.test(Q.baseId)&&typeof Q.runExpiresAt==="string"&&Number.isFinite(Date.parse(Q.runExpiresAt))&&Date.parse(Q.runExpiresAt)>J+60000&&Date.parse(Q.runExpiresAt)<=J+900000)return Q;if(Q.provider==="dropbox"&&Object.keys(Q).sort().join(",")==="access,accessToken,accountId,connectionId,expiresAt,name,provider,rootPath,runId,scopes"&&typeof Q.accountId==="string"&&/^dbid:[A-Za-z0-9_-]{1,128}$/.test(Q.accountId)&&Q.access==="full_dropbox"&&UJ(Q.rootPath)&&pG(Q.scopes)&&typeof Q.expiresAt==="string"&&Number.isFinite(Date.parse(Q.expiresAt))&&Date.parse(Q.expiresAt)>J+60000&&Date.parse(Q.expiresAt)<=J+14400000)return Q;throw Error("Invalid connection credential")}function OY0(X,J,Q){return Array.isArray(X)&&X.length<=10&&X.every((Z)=>Z&&Object.keys(Z).sort().join(",")==="baseId,connection,operation,provider,records,table"&&Z.provider==="airtable"&&Z.connection===J&&Z.operation===Q.slice(8)&&typeof Z.baseId==="string"&&/^app[A-Za-z0-9]+$/.test(Z.baseId)&&typeof Z.table==="string"&&/^tbl[A-Za-z0-9]+$/.test(Z.table)&&Array.isArray(Z.records)&&Z.records.length<=10&&Z.records.every((G)=>G&&Object.keys(G).join(",")==="id"&&typeof G.id==="string"&&/^rec[A-Za-z0-9]+$/.test(G.id)))}async function dG(X){if(await m4(X.sourceDirectory,X.source),await X.assertCurrent(),X.signal?.aborted)throw Error("Local routine cancelled");let J={...X.environment,OS_LOCAL_ROUTINE_HOST:"1"};delete J[Y1];let Q=Gx(Zx(X.sourceDirectory,X.source.sdk)).href,Z=Gx(`${X.sourceDirectory}/`).href,G=`import { registerHooks } from 'node:module';
299
299
  registerHooks({ resolve(specifier, context, nextResolve) {
300
300
  const result = nextResolve(specifier, context);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oddington/cli",
3
- "version": "0.1.50",
3
+ "version": "0.1.51",
4
4
  "description": "OS command-line client",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -32,7 +32,7 @@
32
32
  "typescript": "7.0.2"
33
33
  },
34
34
  "dependencies": {
35
- "@oddington/sdk": "^0.1.27"
35
+ "@oddington/sdk": "^0.1.28"
36
36
  },
37
37
  "exports": {}
38
38
  }